void OnStoreItemBuy(C2G.StoreGoodsBuy packet, C2G.StoreGoodsBuyAck ack) { switch (m_ItemGoods.StoreID) { case "Gem": { Network.PlayerInfo.AddGoodsValue(m_ItemGoods.Target.goods_type, m_ItemGoods.Target.goods_value + m_ItemGoods.bonus); Network.PlayerInfo.AddGoodsValue(PacketInfo.pe_GoodsType.token_mileage, m_ItemGoods.mileage); MetapsAnalyticsScript.TrackPurchase(packet.item_id, m_ItemGoods.Price.goods_value, "WON"); } break; case "Gold": { m_StoreLimitInfo.available_count--; m_LabelNeedTicket.text = Localization.Format("StoreLimit", m_ItemGoods.limit, m_StoreLimitInfo.available_count); Network.PlayerInfo.AddGoodsValue(m_ItemGoods.Target.goods_type, m_ItemGoods.Target.goods_value + m_ItemGoods.bonus); Network.PlayerInfo.UseGoods(m_ItemGoods.Price); } break; case "Energy": { m_StoreLimitInfo.available_count--; m_LabelNeedTicket.text = Localization.Format("StoreLimit", m_ItemGoods.limit, m_StoreLimitInfo.available_count); Network.PlayerInfo.AddEnergy((int)(m_ItemGoods.Target.goods_value + m_ItemGoods.bonus)); Network.PlayerInfo.UseGoods(m_ItemGoods.Price); } break; } GameMain.Instance.UpdatePlayerInfo(); GameMain.Instance.UpdateMenu(); Tooltip.Instance.ShowMessageKey("SuccessPurchased"); }
public void Check() { if (CurrentInfo == null) { CurrentInfo = TutorialInfoManager.Instance.GetNextTutorial(PlayerInfo.tutorial_state); } if (CurrentInfo != null && Completed == false) { if (CurrentInfo.AfterNetworking == true) { AfterNetworking(); } else { if (CurrentInfo.Condition != null && GameMain.Instance.CurrentGameMenu != GameMenu.Battle) { SetConditionOK(); } showTime = Time.realtimeSinceStartup + CurrentInfo.delay; bShowed = false; gameObject.SetActive(true); if (CurrentInfo.IDN < 100) { MetapsAnalyticsScript.TrackEvent("Tutorial", "Begin"); } } } }
void Start() { // if (m_SRDebuggerInit != null && Debug.isDebugBuild) // m_SRDebuggerInit.gameObject.SetActive(true); #if UNITY_ANDROID //如果是安卓平台 AndroidKeyboardManager.Install(); //AndroidKeyboard.AdditionalOptions.fullScreen = false; //AndroidKeyboard.AdditionalOptions.noSuggestions = true; //AndroidKeyboard.TouchScreenKeyboard.hideInput = false; #endif ConfigData.Instance.Init(); //初始化配置数据 SoundManager.Instance.PlayBGM("Title"); //播放背景音效 Localization.language = ConfigData.Instance.Language; //初始化游戏语言 #if UNITY_EDITOR //如果是在unity编辑器中运行 if (m_Atlas.spriteMaterial == null || m_Atlas.spriteMaterial.name != "SHUIAtlas_mat") { m_Atlas.replacement = AssetManager.LoadUIAtlas(); } if (m_AtlasTitle.spriteMaterial == null) { m_AtlasTitle.replacement = AssetManager.LoadTitleAtlas(); } #else m_Atlas.replacement = AssetManager.LoadUIAtlas(); m_AtlasTitle.replacement = AssetManager.LoadTitleAtlas(); #endif m_BG.material.mainTexture = AssetManager.LoadBG("000_title"); //背景图片 #if UNITY_EDITOR m_Version.text = string.Format("{0} (editor, asset:{1})", Application.version, SHSavedData.Instance.BundleVersion); //版本信息的文字 #elif SH_DEV m_Version.text = string.Format("{0} (dev, asset:{1})", Application.version, SHSavedData.Instance.BundleVersion); #else m_Version.text = string.Format("{0} (test, asset:{1})", Application.version, SHSavedData.Instance.BundleVersion); #endif m_TouchToStart.SetActive(true); //开启点击的组件 MetapsAnalyticsScript.Init(Application.bundleIdentifier); if (!FB.IsInitialized) { // Initialize the Facebook SDK FB.Init(InitFacebookCallback, OnHideUnity); } else { FB.ActivateApp(); } #if TEST_LOGIN_POPUP Popup.Instance.Show(ePopupMode.Login, new Action(TouchToStart)); #endif }
void OnTutorialEndHandler(C2G.TutorialState packet, C2G.TutorialStateAck ack) { Network.PlayerInfo.tutorial_state = TutorialInfoManager.Instance.CompletedState; Network.Instance.ProcessReward3Ack(ack.rewards_ack); TutorialInfo info = TutorialInfoManager.Instance.GetInfoByIdn(TutorialInfoManager.Instance.CompletedState) as TutorialInfo; Popup.Instance.Show(ePopupMode.Reward, info.rewards, Localization.Get("TutorialRewardTitle"), Localization.Get("GetThisRewards"), ack.rewards_ack); MetapsAnalyticsScript.TrackEvent("Tutorial", "Finish"); #if SH_DEV || UNITY_EDITOR BtnSkip.SetActive(Completed == false); #endif }
public void ResDebugDataReset(WWWResult www) { if (Network.IsError) { Network.IsRetry = true; } else { bool flag = GameUtility.Config_UseAssetBundles.Value; GameUtility.ClearPreferences(); GameUtility.Config_UseAssetBundles.Value = flag; DebugUtility.Assert(www.text != null, "res == null"); MonoSingleton <GameManager> .Instance.ResetAuth(); GameUtility.Config_NewGame.Value = false; MetapsAnalyticsScript.ReInitialize(); Network.RemoveAPI(); this.Success(); } }
private void SetNextTutorial() { PlayerInfo.tutorial_state = (short)CurrentInfo.IDN; CurrentInfo = TutorialInfoManager.Instance.GetNextTutorial(CurrentState); if (CurrentInfo == null) { TutorialComplete(); return; } //Debug.LogFormat("Current info : {0} : {1}", CurrentInfo.IDN, CurrentMenu); // CurrentInfo.Targets.ForEach(e => Debug.LogFormat("{0}", e.Menu)); MetapsAnalyticsScript.TrackEvent("Tutorial", CurrentMenu.ToString(), CurrentInfo.IDN); if (CurrentInfo.Condition != null && CurrentInfo.Condition.Type == eConditionType.BattleEndPopup) { gameObject.SetActive(false); } else { if (CurrentInfo.Condition == null) { showTime = Time.realtimeSinceStartup + CurrentInfo.delay; bShowed = false; } gameObject.SetActive(true); } if (GameMain.Instance.gameObject.activeSelf == false && (CurrentInfo.Condition == null || CurrentInfo.Condition.IsConditionOK == false)) { TimeManager.Instance.SetPause(false); } BtnSkip.SetActive(false); #if SH_DEV || UNITY_EDITOR if (CurrentInfo.Targets.Exists(t => t.type == eTutorialType.Dialog)) { BtnSkip.SetActive(Completed == false); } #endif }
public void Logout(bool clear_account_idx) //登出 { m_MenuStack.Clear(); //清空当前的存档场景的栈 SoundManager.Instance.StopSound(); //结束声音 if (BattleBase.CurrentBattleMode != eBattleMode.None) //如果当前是某个战斗场景 { UnityEngine.SceneManagement.SceneManager.UnloadScene(GetBattleSceneName(BattleBase.CurrentBattleMode)); //卸载到当前的战斗场景 BattleBase.CurrentBattleMode = eBattleMode.None; //讲记录的战斗场景记为None } if (ChattingMain.IsInstance) //如果没有关闭聊天功能 { ChattingMain.Clear(); //关闭聊天功能 } ExceptionHandler.Instance.Reset(); //关闭下面的游戏体 Destroy(gameObject); Destroy(Tutorial.Instance.gameObject); Destroy(Popup.Instance.gameObject); Destroy(Tooltip.Instance.gameObject); Destroy(CodeStage.AdvancedFPSCounter.AFPSCounter.Instance.gameObject); Destroy(Networking.Instance.gameObject); if (MetapsAnalyticsScript.Instance != null) { MetapsAnalyticsScript.Clear(); } if (ExceptionHandler.IsInit) { Destroy(GameObject.Find("ExceptionHandler")); } //析构网络相关 Network.Uninit(); Network.ClearInstance(); Network.GameServer.ClearSession(); //清楚记录的数据 SaveDataManger.Instance.Clear(); SHSavedData.AccessToken = 0; if (clear_account_idx == true && SHSavedData.LoginPlatform != LoginPlatform.Guest && SHSavedData.LoginPlatform != LoginPlatform.Betakey) { SHSavedData.AccountIdx = -1; SHSavedData.LoginPlatform = PacketEnums.LoginPlatform.Invalid; } // if (SHSavedData.LoginPlatform == LoginPlatform.Facebook)// && Facebook.Unity.FB.IsLoggedIn) // return; // //Facebook.Unity.FB.LogOut(); if (SHSavedData.LoginPlatform == LoginPlatform.GooglePlay && UM_GameServiceManager.Instance.IsConnected) { UM_GameServiceManager.Instance.Disconnect(); } Network.ShowIndicator(); #if UNITY_EDITOR UnityEngine.SceneManagement.SceneManager.LoadScene("title", UnityEngine.SceneManagement.LoadSceneMode.Single); #else UnityEngine.SceneManagement.SceneManager.LoadScene("Splash", UnityEngine.SceneManagement.LoadSceneMode.Single); #endif //UnityEngine.SceneManagement.SceneManager.UnloadScene("Main"); }