Initialize local project and fix ranch growth synchronization
This commit is contained in:
@@ -0,0 +1,471 @@
|
||||
package
|
||||
{
|
||||
import flash.display.Sprite;
|
||||
import flash.errors.IOError;
|
||||
import flash.events.ErrorEvent;
|
||||
import flash.events.Event;
|
||||
import flash.filesystem.File;
|
||||
import flash.ui.Multitouch;
|
||||
import flash.utils.getTimer;
|
||||
import net.gaooo.nano.center.GAoNano;
|
||||
import net.pixvi.common.SysSetting;
|
||||
import net.pixvi.common.center.LoaderCenter;
|
||||
import net.pixvi.common.center.PopCenter;
|
||||
import net.pixvi.common.center.SoundCenter;
|
||||
import net.pixvi.common.center.StartUpCenter;
|
||||
import net.pixvi.common.driver.ActivityDriver;
|
||||
import net.pixvi.common.driver.ClockDriver;
|
||||
import net.pixvi.common.driver.SecondDriver;
|
||||
import net.pixvi.common.driver.StageDriver;
|
||||
import net.pixvi.common.driver.TipDriver;
|
||||
import net.pixvi.common.manager.resource.RM;
|
||||
import net.pixvi.common.net.ConfigLoader;
|
||||
import net.pixvi.common.net.resource.ResourceLoader;
|
||||
import net.pixvi.common.system.AppLayer;
|
||||
import net.pixvi.common.system.language.LangCenter;
|
||||
import net.pixvi.common.system.language.lang;
|
||||
import net.pixvi.common.utils.Alert;
|
||||
import net.pixvi.common.utils.Gesturer;
|
||||
import net.pixvi.common.utils.LogoShow;
|
||||
import net.pixvi.common.utils.PiFixVo;
|
||||
import net.pixvi.common.utils.StageLocator;
|
||||
import net.pixvi.common.utils.global;
|
||||
import net.pixvi.common.utils.mobi.MobiTools;
|
||||
import net.pixvi.myr.GameMath;
|
||||
import net.pixvi.myr.GamePool;
|
||||
import net.pixvi.myr.center.AccountCenter;
|
||||
import net.pixvi.myr.center.DisplayCenter;
|
||||
import net.pixvi.myr.center.Game;
|
||||
import net.pixvi.myr.center.Master;
|
||||
import net.pixvi.myr.center.Table;
|
||||
import net.pixvi.myr.element.snd.GameSound;
|
||||
import net.pixvi.myr.element.user.ServerVo;
|
||||
import net.pixvi.myr.net.NetCenter;
|
||||
import net.pixvi.myr.panel.login.LoginBg;
|
||||
import net.pixvi.myr.panel.login.PressStartPanel;
|
||||
import net.pixvi.myr.util.MyrCalendar;
|
||||
import net.pixvi.myrane.MyrAne;
|
||||
import net.pixvi.myrcryptor.MYRCryptor;
|
||||
import net.pixvi.myrloader.center.MyrCenter;
|
||||
import net.pixvi.myrloader.center.MyrUpdateCenter;
|
||||
import net.pixvi.pfw.display.NetBitImg;
|
||||
import net.pixvi.pfw.display.NetImg;
|
||||
import net.pixvi.pfw.net.PiStringLoader;
|
||||
import net.pixvi.pfw.utils.Browser;
|
||||
import net.pixvi.pfw.utils.Caller;
|
||||
import net.pixvi.pfw.utils.Paster;
|
||||
import net.pixvi.pfw.utils.Saver;
|
||||
import net.pixvi.pfw.utils.core.Singleton;
|
||||
import net.pixvi.psg.ui.PSGWaitingPanel;
|
||||
import net.pixvi.psg.utils.Blacker;
|
||||
|
||||
public class MYRStarter
|
||||
{
|
||||
|
||||
public static var binxueInitComplete:Boolean = false;
|
||||
|
||||
private var gesture:Gesturer;
|
||||
|
||||
private var logo:LogoShow;
|
||||
|
||||
private var rl:ResourceLoader;
|
||||
|
||||
private var prevBackTime:int = 0;
|
||||
|
||||
public function MYRStarter()
|
||||
{
|
||||
super();
|
||||
}
|
||||
|
||||
public static function binxueInitCompleteHandler(e:Event = null) : void
|
||||
{
|
||||
binxueInitComplete = true;
|
||||
}
|
||||
|
||||
public static function getIns() : MYRStarter
|
||||
{
|
||||
return Singleton.getInstanceOrCreate(MYRStarter) as MYRStarter;
|
||||
}
|
||||
|
||||
public function MYRStart(mainStage:Sprite) : void
|
||||
{
|
||||
var serverdata:Object = null;
|
||||
var serverReplaceData:Object = null;
|
||||
var newstVersion:Number = NaN;
|
||||
SysSetting.alphaPopPanelTime = 0;
|
||||
SysSetting.popMaskAlpha = 0;
|
||||
SysSetting.buttonUseTouchEvent = false;
|
||||
SysSetting.screenDelay = 1000;
|
||||
Saver.autoMode = 2;
|
||||
Alert.alertScreenMsgTime = 1200;
|
||||
Alert.showMsgAutoScaleCharNum = 23;
|
||||
Alert.globalize = net.pixvi.common.system.language.lang;
|
||||
NetImg.globalImgSrcHack = MyrUpdateCenter.getUpdateSrc;
|
||||
if((SoundCenter as Object).hasOwnProperty("globalSoundSrcHack"))
|
||||
{
|
||||
SoundCenter.globalSoundSrcHack = MyrUpdateCenter.getUpdateSrc;
|
||||
}
|
||||
RM.globalSrcHack = MyrUpdateCenter.getUpdateSrc;
|
||||
RM.swfSrcToBytesFunction = MyrUpdateCenter.swfSrcToBytes;
|
||||
if(MyrCenter.lang == "JP")
|
||||
{
|
||||
MyrCalendar.GLOBAL_TIMEOFFSET = MyrCalendar.TIMEOFFSET_JP;
|
||||
}
|
||||
else
|
||||
{
|
||||
MyrCalendar.GLOBAL_TIMEOFFSET = MyrCalendar.TIMEOFFSET_CN;
|
||||
}
|
||||
if(GameMath.ModeCrypto)
|
||||
{
|
||||
NetImg.globalImgCryptoGetBytes = MYRCryptor.getHashSrcBytes;
|
||||
NetImg.globalImgCryptoMode = true;
|
||||
PiStringLoader.globalCryptoModeSrcHash = MYRCryptor.getHashSrc;
|
||||
PiStringLoader.globalJsonCryptoModeFunction = MYRCryptor.jsonDecodeHandler;
|
||||
PiStringLoader.globalCryptoMode = true;
|
||||
}
|
||||
if(MobiTools.isMobi())
|
||||
{
|
||||
Multitouch.inputMode = "touchPoint";
|
||||
SysSetting.buttonUseTouchEvent = true;
|
||||
}
|
||||
mainStage.addChild(StartUpCenter.startUp(mainStage.stage,true));
|
||||
SecondDriver.getInstance().startup();
|
||||
ClockDriver.getInstance().startup();
|
||||
TipDriver.getInstance().startup(9);
|
||||
StageDriver.autoScaleMode();
|
||||
PopCenter.getIns().resizeMode = false;
|
||||
var fsFix1:PiFixVo = new PiFixVo();
|
||||
fsFix1.id = "fs1";
|
||||
fsFix1.maxHWScale = 1.775;
|
||||
var fsFix2:PiFixVo = new PiFixVo();
|
||||
fsFix2.id = "fs2";
|
||||
fsFix2.maxHWScale = 1.9125;
|
||||
StageLocator.autoFull(720,1136,[fsFix1,fsFix2]);
|
||||
StageDriver.stage.quality = "medium";
|
||||
ConfigLoader.getInstance().loadConfig(SysSetting.configFileSrc,onConfigLoaded,null,GameMath.ModeCrypto,MyrUpdateCenter.getIns().getConfigSrcHackLib());
|
||||
if(MyrUpdateCenter.getIns().versionListFile != null && MyrUpdateCenter.getIns().versionListFile.versionServer != null)
|
||||
{
|
||||
serverdata = MyrUpdateCenter.getIns().versionListFile.versionServer;
|
||||
if(serverdata[MyrCenter.channel] == null)
|
||||
{
|
||||
serverReplaceData = serverdata.defaultChannel;
|
||||
}
|
||||
else
|
||||
{
|
||||
serverReplaceData = serverdata[MyrCenter.channel];
|
||||
}
|
||||
newstVersion = MyrUpdateCenter.getIns().lastVersion;
|
||||
if(MyrUpdateCenter.getIns().buildVersion > newstVersion)
|
||||
{
|
||||
newstVersion = MyrUpdateCenter.getIns().buildVersion;
|
||||
}
|
||||
trace("lastVersion,channel",newstVersion,MyrCenter.channel);
|
||||
if(newstVersion >= serverReplaceData.min && newstVersion <= serverReplaceData.max)
|
||||
{
|
||||
MyrCenter.serverChannel = serverReplaceData.versionChannel;
|
||||
}
|
||||
trace("channel",MyrCenter.serverChannel);
|
||||
}
|
||||
}
|
||||
|
||||
private function onConfigLoaded() : void
|
||||
{
|
||||
LoaderCenter.getInstance().loadWhenStart(sourceComplete,null,null,null,false);
|
||||
}
|
||||
|
||||
private function sourceComplete() : void
|
||||
{
|
||||
var langdata:Object = null;
|
||||
trace("初始资源加载完毕");
|
||||
Saver.setGlobalSite(global.setting.gameSaveName);
|
||||
if(MyrCenter.hasLang())
|
||||
{
|
||||
trace("load lang...");
|
||||
langdata = RM.TXT.getJson("lang");
|
||||
LangCenter.getInstance().loadJson(langdata);
|
||||
}
|
||||
MobiTools.getIns().startup();
|
||||
MobiTools.getIns().onBackFun = backBtnHandler;
|
||||
DisplayCenter.getIns().startUp();
|
||||
initSdk();
|
||||
}
|
||||
|
||||
private function initSdk() : void
|
||||
{
|
||||
trace("startInitSDK",MyrCenter.channel,MyrCenter.platform,MyrCenter.lang);
|
||||
if(MobiTools.isMobi())
|
||||
{
|
||||
if(MyrCenter.channel == "BLBL")
|
||||
{
|
||||
MyrAne.initBlbl("777","04821523c52241d1b6fe52152022b54e","1383","1000",false,autoShowLogo);
|
||||
}
|
||||
else if(MyrCenter.channel == "MEIZU")
|
||||
{
|
||||
if(MyrAne.meizu2Bingxue)
|
||||
{
|
||||
autoShowLogo();
|
||||
}
|
||||
else
|
||||
{
|
||||
MyrAne.initMeizu("520","191fc001357fcdbacb37f5e92887b983","8a687a9798c0a3b77a3e247a620c65d2",autoShowLogo);
|
||||
}
|
||||
}
|
||||
else if(MyrCenter.channel == "XDG")
|
||||
{
|
||||
if(MyrCenter.platform == "IOS")
|
||||
{
|
||||
MyrAne.iosInitXD("163313","0e9676b93c53729a48890a87165ba0e3","ios_jp_shepherd");
|
||||
trace("myrXDAneSdkInit");
|
||||
}
|
||||
else
|
||||
{
|
||||
MyrAne.initXD("163314","0e9676b93c53729a48890a87165ba0e3","android_jp_shepherd","jp");
|
||||
}
|
||||
autoShowLogo();
|
||||
}
|
||||
else if(MyrCenter.channel == "CPG")
|
||||
{
|
||||
MyrAne.initCPG("2VQiS2uSWpK3T5l0d8c2",false,empty);
|
||||
autoShowLogo();
|
||||
}
|
||||
else
|
||||
{
|
||||
MyrAne.initDyd(76813411,"WicgaI9bN0FoQbK5","牧羊人之心",autoShowLogo);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
autoShowLogo();
|
||||
}
|
||||
}
|
||||
|
||||
public function empty(e:Object = null) : void
|
||||
{
|
||||
}
|
||||
|
||||
public function autoShowLogo() : void
|
||||
{
|
||||
trace("startShowLogo");
|
||||
var quickLogin:Object = Saver.getAuto(MyrCenter.channel + "quickLogin");
|
||||
var day:int = new Date().date;
|
||||
if(quickLogin != null && int(quickLogin) == day)
|
||||
{
|
||||
showLogo(null,true);
|
||||
}
|
||||
else
|
||||
{
|
||||
Saver.saveAuto(MyrCenter.channel + "quickLogin",day);
|
||||
showLogo();
|
||||
}
|
||||
}
|
||||
|
||||
private function showLogo(e:Event = null, quick:Boolean = false) : void
|
||||
{
|
||||
if(MyrCenter.lang == "JP")
|
||||
{
|
||||
logo = new LogoShow(showStartMenuBG,"ui.LogosXd",quick);
|
||||
}
|
||||
else if(MyrCenter.channel == "BLBL")
|
||||
{
|
||||
logo = new LogoShow(showStartMenuBG,"ui.LogosBlbl",quick);
|
||||
}
|
||||
else if(MyrCenter.channel == "MEIZU")
|
||||
{
|
||||
logo = new LogoShow(showStartMenuBG,"ui.LogosMeizu",quick);
|
||||
}
|
||||
else
|
||||
{
|
||||
logo = new LogoShow(showStartMenuBG,"ui.Logos",quick);
|
||||
}
|
||||
gesture = new Gesturer(logo);
|
||||
gesture.longPressTime = 5000;
|
||||
gesture.start();
|
||||
gesture.addEventListener(Gesturer.LONG_PRESS,longPressHandler);
|
||||
AppLayer.app.LAYER_BG.addChild(logo);
|
||||
logo.start();
|
||||
}
|
||||
|
||||
public function longPressHandler(e:Event = null) : void
|
||||
{
|
||||
logo.complete = null;
|
||||
Alert.yesno(net.pixvi.common.system.language.lang("更新修复"),net.pixvi.common.system.language.lang("修复因更新带来的文件损坏等问题,点击确定开始修复。"),startCleanHandler,MobiTools.getIns().exit);
|
||||
}
|
||||
|
||||
private function startCleanHandler() : void
|
||||
{
|
||||
try
|
||||
{
|
||||
File.applicationStorageDirectory.resolvePath("version.json").deleteFile();
|
||||
}
|
||||
catch(e:Error)
|
||||
{
|
||||
if(e is IOError)
|
||||
{
|
||||
Alert.yes("Remove denied","Remove denied,unknow error:" + e.toString(),MobiTools.getIns().exit);
|
||||
return;
|
||||
}
|
||||
Alert.yes("Remove denied","Security error:" + e.toString(),MobiTools.getIns().exit);
|
||||
return;
|
||||
}
|
||||
Alert.yes(net.pixvi.common.system.language.lang("提示"),net.pixvi.common.system.language.lang("已重置版本,请重新运行游戏。"),MobiTools.getIns().exit);
|
||||
}
|
||||
|
||||
private function showStartMenuBG() : void
|
||||
{
|
||||
logo = null;
|
||||
Game.getIns().initSetting();
|
||||
var hw:Number = StageLocator.MainFixVo.fixHeight / StageLocator.MainFixVo.fixWidth;
|
||||
if(MyrCenter.platform == "ios" && hw > 2)
|
||||
{
|
||||
Game.getIns().setting.liuhaiMode = true;
|
||||
Game.getIns().saveSetting();
|
||||
}
|
||||
SoundCenter.getInstance().bgmPlay(GameSound.bgm_theme);
|
||||
PopCenter.POP(LoginBg.getIns());
|
||||
LoginBg.getIns().trace("1%");
|
||||
Caller.delayCall(startLoadMainUI,330,1);
|
||||
}
|
||||
|
||||
private function startLoadMainUI() : void
|
||||
{
|
||||
PSGWaitingPanel.getIns().setPanel(net.pixvi.common.system.language.lang("数据读取中..."));
|
||||
PopCenter.POP(PSGWaitingPanel.getIns());
|
||||
rl = LoaderCenter.getInstance().loadTeam("secondload",onMainResourceLoadComplete,onMainResourceProcess,onSecondLoadErrorHandler);
|
||||
}
|
||||
|
||||
private function onMainResourceProcess(e:Event = null) : void
|
||||
{
|
||||
if(rl == null)
|
||||
{
|
||||
trace("rl=null");
|
||||
return;
|
||||
}
|
||||
if(rl.curResource != null)
|
||||
{
|
||||
trace(rl.filesLoaded.toString() + rl.curResource.id);
|
||||
LoginBg.getIns().trace(rl.filesLoaded.toString() + rl.curResource.id.substr(0,3));
|
||||
}
|
||||
else
|
||||
{
|
||||
LoginBg.getIns().trace(rl.filesLoaded.toString());
|
||||
}
|
||||
}
|
||||
|
||||
private function onSecondLoadErrorHandler(e:ErrorEvent) : void
|
||||
{
|
||||
Alert.yes("Load error",Paster.font(e.text,null,16));
|
||||
}
|
||||
|
||||
private function onMainResourceLoadComplete() : void
|
||||
{
|
||||
LoginBg.getIns().trace("10%");
|
||||
Table.startUp();
|
||||
NetCenter.autoSetServer();
|
||||
PSGWaitingPanel.getIns().setPanel("Loading...");
|
||||
LoginBg.getIns().trace("40%");
|
||||
prepareCenter();
|
||||
PSGWaitingPanel.getIns().setPanel("Loading....");
|
||||
LoginBg.getIns().trace("50%");
|
||||
showLoginPanel();
|
||||
}
|
||||
|
||||
public function updatefileProcess(fileloaded:int, filesTotal:int) : void
|
||||
{
|
||||
PSGWaitingPanel.getIns().setPanel("update files...(" + fileloaded + "/" + filesTotal + ")");
|
||||
}
|
||||
|
||||
private function prepareCenter() : void
|
||||
{
|
||||
Blacker.getIns().container = AppLayer.app.LAYER_AD;
|
||||
var transImg:NetBitImg = new NetBitImg("data/gc.jpg",0,0,true,true,0);
|
||||
Blacker.getIns().changeView(transImg);
|
||||
LoginBg.getIns().trace("60%");
|
||||
StageLocator.setfullWithNoFix(transImg);
|
||||
AppLayer.app.LAYER_AD.mouseChildren = AppLayer.app.LAYER_AD.mouseEnabled = true;
|
||||
GAoNano.getIns().startUp();
|
||||
if(GameMath.ModeTrace)
|
||||
{
|
||||
GAoNano.getIns().traceMode = true;
|
||||
}
|
||||
LoginBg.getIns().trace("70%");
|
||||
ActivityDriver.getIns().startup();
|
||||
GameSound.startup();
|
||||
GamePool.startUp();
|
||||
Alert.PSGMode = true;
|
||||
StageLocator.setfullWithNoFix(GAoNano.getIns().stage,1,"center","center");
|
||||
LoginBg.getIns().trace("80%");
|
||||
}
|
||||
|
||||
public function onForceUpdateDyd(e:Event = null) : void
|
||||
{
|
||||
Browser.gotoPage("https://myrzx.cdn.comiai.com/packages/diyidan-1.6.2-myrzx.apk");
|
||||
}
|
||||
|
||||
private function showLoginPanel() : void
|
||||
{
|
||||
if(MyrCenter.channel == "DYD" && MyrCenter.platform == "ANDROID" && (MyrUpdateCenter.getIns().buildVersion < 1.5 && MyrUpdateCenter.getIns().lastVersion < 1.41))
|
||||
{
|
||||
Alert.yes("提示","客户端版本过低,请更新客户端后进行游戏。",onForceUpdateDyd);
|
||||
return;
|
||||
}
|
||||
LoginBg.getIns().trace("");
|
||||
PSGWaitingPanel.getIns().showOut();
|
||||
PopCenter.POP(PressStartPanel.getIns());
|
||||
}
|
||||
|
||||
private function backBtnHandler(e:Event = null) : void
|
||||
{
|
||||
var curServer:ServerVo = null;
|
||||
if(PopCenter.getIns().panelNum > 1 && !(PopCenter.getIns().topPanel is PressStartPanel))
|
||||
{
|
||||
return;
|
||||
}
|
||||
if(MobiTools.isMobi() && MyrCenter.channel == "MEIZU" && Boolean(MyrAne.meizu2Bingxue))
|
||||
{
|
||||
MyrAne.bingxueExitGame(onExitGameHandler);
|
||||
return;
|
||||
}
|
||||
if(getTimer() - prevBackTime > 2000)
|
||||
{
|
||||
prevBackTime = getTimer();
|
||||
Alert.showMsg(Paster.font(net.pixvi.common.system.language.lang("再次按下[返回键]退出游戏。"),"#ff0000"));
|
||||
}
|
||||
else if(MyrCenter.channel == "MEIZU" && MobiTools.isMobi())
|
||||
{
|
||||
if(MyrAne.meizu2Bingxue)
|
||||
{
|
||||
if(MobiTools.isMobi() && MyrCenter.channel == "MEIZU" && Boolean(MyrAne.meizu2Bingxue))
|
||||
{
|
||||
curServer = AccountCenter.getIns().curServer;
|
||||
if(curServer != null && Master != null)
|
||||
{
|
||||
MyrAne.bingxueSetRoleData(5,curServer.serverId,curServer.serverName,curServer.masterId.toString(),curServer.masterName,Master.level.toString(),Master.money,"驯养师","","牧羊人之心");
|
||||
}
|
||||
}
|
||||
MyrAne.bingxueExitGame(onExitGameHandler);
|
||||
}
|
||||
else
|
||||
{
|
||||
MyrAne.meizuExitGame(onExitGameHandler);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
MobiTools.getIns().exit();
|
||||
}
|
||||
}
|
||||
|
||||
public function onExitGameHandler(re:String = "-1") : void
|
||||
{
|
||||
if(MobiTools.isMobi() && MyrCenter.channel == "MEIZU" && Boolean(MyrAne.meizu2Bingxue))
|
||||
{
|
||||
return;
|
||||
}
|
||||
if(re == "1")
|
||||
{
|
||||
MobiTools.getIns().exit();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user