/// <summary> /// 初始化 /// </summary> public bool Init() { LoggerSystem.Instance.Debug("LocalStorageSystem init begin"); // 注册管理器 RegisterLocalStorage(LocalAccountStorage.Get()); RegisterLocalStorage(LocalSettingStorage.Get()); RegisterLocalStorage(LocalLevelStorage.Get()); // 获取客户端版本 appVersion = UpdateSystem.Get().GetAppVersion(); // 加载存储信息 LoadStorage(); LoggerSystem.Instance.Debug("LocalStorageSystem init end"); return(true); }
// 发送退出战斗指令 public void QuitBattle(bool finish = false) { #if !SERVER BattleSystem.Instance.StopLockStep(); if (BattleSystem.Instance.battleData.gameType != GameType.TestLevel && BattleSystem.Instance.battleData.gameType != GameType.SingleLevel) { // 单机关卡需要上报完成当前关卡 if (battleData.currentTeam == battleData.winTEAM && LocalPlayer.Get().playerData.singleFightNext) { } else { // 只有在创关卡的时候才设置 if (LocalPlayer.Get().playerData.singleFightNext&& finish) { LocalLevelStorage.Get().Levelfails = LocalLevelStorage.Get().Levelfails + 1; LocalLevelStorage.Get().SetLevelInfo(battleData.matchId); } } } if (finish) { // 闪白 Team winTeam = BattleSystem.Instance.sceneManager.teamManager.GetTeam(battleData.winTEAM); Color winColor = winTeam.color; BattleSystem.Instance.sceneManager.ShowWinEffect(winTeam, winColor); Debug.Log("win team ***************************hitships: " + winTeam.hitships + " destroy ******************: " + winTeam.destory); UISystem.Get().ShowWindow("BattleEndWindow"); //EventSystem.Instance.FireEvent(EventId.VictionaryWinTeam, winTeam); EventSystem.Instance.FireEvent(EventId.OnFinished); EventSystem.Instance.FireEvent(EventId.OnFinishedColor, winColor, winTeam); if (battleData.winTEAM != battleData.currentTeam) { Team ownTeam = BattleSystem.Instance.sceneManager.teamManager.GetTeam(BattleSystem.Instance.battleData.currentTeam); int destorys = ownTeam.destory; int hitships = ownTeam.hitships; int produce = ownTeam.produces; float totalTime = BattleSystem.Instance.sceneManager.GetBattleTime(); Flurry.Instance.FlurryBattleEndEvent(battleData.matchId, "2", "0", "0", hitships.ToString(), destorys.ToString(), totalTime.ToString()); } //sdk ThirdPartySystem.Instance.OnFinishPve(battleData.matchId); } else { // 记录失败事件 Team ownTeam = BattleSystem.Instance.sceneManager.teamManager.GetTeam(BattleSystem.Instance.battleData.currentTeam); int destorys = ownTeam.destory; int hitships = ownTeam.hitships; int produce = ownTeam.produces; float totalTime = BattleSystem.Instance.sceneManager.GetBattleTime(); Flurry.Instance.FlurryBattleEndEvent(battleData.matchId, "1", "0", "0", hitships.ToString(), destorys.ToString(), totalTime.ToString()); // 关闭窗口退出 UISystem.Get().HideAllWindow(); BattleSystem.Instance.BeginFadeOut(); //ShipFadeManager.Get().SetFadeType(ShipFadeManager.FADETYPE.OUT, 0.1f); //UISystem.Get().FadeBattle(false, new EventDelegate(() => //{ // if (BattleSystem.Instance.battleData.gameType == GameType.Single) // { // BattleSystem.Instance.Reset(); // UISystem.Get().ShowWindow("CustomSelectWindow"); // } // if (BattleSystem.Instance.battleData.gameType == GameType.TestLevel) // { // BattleSystem.Instance.Reset(); // UISystem.Get().ShowWindow("CustomTestLevelWindow"); // } // if (BattleSystem.Instance.battleData.gameType == GameType.SingleLevel) // { // BattleSystem.Instance.Reset(); // UISystem.Get().ShowWindow("LobbyWindowView"); // } // if (BattleSystem.Instance.battleData.gameType == GameType.PayLevel) // { // BattleSystem.Instance.Reset(); // UISystem.Get().ShowWindow("ChapterWindow"); // EventSystem.Instance.FireEvent(EventId.OnSingleBattleEnd, 0); // } //})); //sdk ThirdPartySystem.Instance.OnFailPve(battleData.matchId); } // 扣除5点体力 //LocalPlayer.Get().ChangePower(-5); #endif }