using LitJson; using UnityEngine; using UnityEngine.UI; using UnityEngine.EventSystems; using System; using System.Xml; using System.Collections; using System.Collections.Generic; public class Initializer : MonoBehaviour { #region 变量 public bool DebugMode; public GameObject DebugModeGo; public static bool Complete; public static Initializer Instance; public static Transform Transform; public static List RegistList = new List(); #endregion private void Awake() { try { InitializeDataEye(); } catch (Exception) { } string progress = ""; try { progress = "1"; Application.targetFrameRate = 50; progress = "2"; DontDestroyOnLoad(gameObject); progress = "3"; ManaServer.Login(ManaCenter.LoginCallbackInitial); progress = "4"; ManaServer.MailRequest(); progress = "5"; ManaServer.RankRequest(); progress = "6"; ManaServer.IOSAlipayRequest(); progress = "7"; ManaServer.NotificationRequest(); Instance = this; Transform = transform; progress = "8"; if (DebugMode) { Instantiate(DebugModeGo, transform); } else { gameObject.AddComponent(); } progress = "9"; gameObject.AddComponent(); progress = "10"; gameObject.AddComponent(); progress = "11"; gameObject.AddComponent(); progress = "12"; gameObject.AddScript(); progress = "13"; gameObject.AddScript(); progress = "14"; gameObject.AddScript(); progress = "15"; gameObject.AddScript(); progress = "16"; gameObject.AddScript(); progress = "17"; gameObject.AddScript(); progress = "18"; gameObject.AddScript(); progress = "19"; gameObject.AddScript(); progress = "20"; gameObject.AddScript(); progress = "21"; gameObject.AddScript(); progress = "22"; gameObject.AddScript(); progress = "23"; gameObject.AddScript(); progress = "24"; gameObject.AddScript(); progress = "25"; gameObject.AddScript(); progress = "26"; gameObject.AddScript(); progress = "27"; gameObject.AddScript(); progress = "28"; gameObject.AddScript(); progress = "29"; gameObject.AddScript(); progress = "30"; gameObject.AddScript(); progress = "31"; gameObject.AddScript(); progress = "32"; StartCoroutine(IInitialize()); } catch (Exception e) { GameObject.Find("Canvas").GetChild(0).SetActive(true); GameObject.Find("Canvas").GetChild(1).SetActive(true); GameObject.Find("Text").GetComponent().text = progress + "\n" + e; throw new Exception(); } } private void InitializeDataEye() { if (Application.platform == RuntimePlatform.IPhonePlayer) { DataEyeGA.Init("C5790DBD2CFE97BD18C7BE9A95482C05", DataEyeGA.PlatformType.IOS, "Official", "IOS"); } else if (Application.isMobilePlatform) { DataEyeGA.Init("ADE884FAAF61A2CB45B02431A70932B8", DataEyeGA.PlatformType.ADR, "Official", "Android"); } else if (Application.isEditor) { DataEyeGA.Init("ADE884FAAF61A2CB45B02431A70932B8", DataEyeGA.PlatformType.WP, "Official", "Windows"); } } public static void InitializeEntrance() { if (Instance.DebugMode) { Initialize(); } else { ManaDebug.TryCatch(Initialize, EnableDebugLab); } } public static void Initialize() { Text debugLab = GameObject.Find("U_DebugLab").GetComponent(); debugLab.text = "Error code : 1"; ManaTutorial.TutorialA = ManaData.GetPlayerBool("TutorialA"); debugLab.text = "Error code : 1-1"; ManaTutorial.TutorialB_ = ManaData.GetPlayerBool("TutorialB"); debugLab.text = "Error code : 1-2"; ManaTutorial.TutorialC_ = ManaData.GetPlayerBool("TutorialC"); debugLab.text = "Error code : 1-3"; ManaTutorial.TutorialD_ = ManaData.GetPlayerBool("TutorialD"); debugLab.text = "Error code : 1-4"; ManaTutorial.TutorialE_ = ManaData.GetPlayerBool("TutorialE"); debugLab.text = "Error code : 1-5"; ManaTutorial.TutorialPlazaRoom_ = ManaData.GetPlayerBool("TutorialPlazaRoom"); debugLab.text = "Error code : 1-5-1"; ManaTutorial.TutorialIndexA = ManaData.GetPlayerInt("TutorialIndexA"); debugLab.text = "Error code : 1-6"; ManaTutorial.TutorialIndexB = ManaData.GetPlayerInt("TutorialIndexB"); debugLab.text = "Error code : 1-7"; ManaTutorial.TutorialIndexC = ManaData.GetPlayerInt("TutorialIndexC"); debugLab.text = "Error code : 1-8"; ManaTutorial.TutorialIndexD = ManaData.GetPlayerInt("TutorialIndexD"); debugLab.text = "Error code : 1-9"; ManaTutorial.TutorialIndexE = ManaData.GetPlayerInt("TutorialIndexE"); debugLab.text = "Error code : 1-10"; ManaTutorial.TutorialIndexPlazaRoom = ManaData.GetPlayerInt("TutorialIndexPlazaRoom"); debugLab.text = "Error code : 1-10-1"; Bundle.LoadAtlasSprites(); debugLab.text = "Error code : 1-11"; for (int i = 0; i < RegistList.Count; i++) { debugLab.text = "Error code : 1-12-" + i; RegistList[i].Instantiate(); } debugLab.text = "Error code : 2"; for (int i = 0; i < RegistList.Count; i++) { debugLab.text = "Error code : 2-" + i; RegistList[i].RegistReference(); } debugLab.text = "Error code : 3"; for (int i = 0; i < RegistList.Count; i++) { debugLab.text = "Error code : 3-" + i; RegistList[i].RegistValueA(); } debugLab.text = "Error code : 4"; for (int i = 0; i < RegistList.Count; i++) { debugLab.text = "Error code : 4-" + i; RegistList[i].RegistValueB(); } debugLab.text = "Error code : 5"; for (int i = 0; i < RegistList.Count; i++) { debugLab.text = "Error code : 5-" + i; RegistList[i].RegistValueC(); RegistList[i].enabled = true; } debugLab.text = "Error code : 6"; Complete = true; if (ManaServer.NotificationReady) { ManaReso.Get("C_Notify").TweenForCG(); } debugLab.text = "Error code : 7"; ManaPlayer.InitializeDressRoom(); debugLab.text = "Error code : 8"; ManaCenter.LoginCallbackInitial(new JsonData()); debugLab.text = "Error code : 9"; //GardenSmartFoxManager.GardenSmartFox.PlazaRoomManager.SyncClose(); debugLab.text = "Error code : 10"; StringFilter.Init(); debugLab.text = "Error code : 11"; ManaIAP.Initialize(); debugLab.text = "Error code : 12"; ManaVisit.Initialize(); debugLab.text = "Error code : 13"; ManaSocial.InitializeRankPanel(); debugLab.text = "Error code : 14"; ManaReso.Release(); if (Instance.DebugMode) { ActivateGame(); } else { ShowLoadingPanel(); } } private static void ShowLoadingPanel() { ManaReso.Get("U_Group").TweenForCG(); ManaReso.Get("C_Main").alpha = 0; Auxiliary.Instance.DelayCall(ActivateGame, 3f); } private static void ActivateGame() { ManaReso.Get("U_LoadingPanel").TweenForCG(); ManaReso.Get("C_Main").alpha = 1; ManaAudio.MusicTheme.TweenForAudio(); } public static void EnableDebugLab() { ManaReso.Get("U_Group").alpha = 0; ManaReso.Get("U_DebugLab").enabled = true; throw new Exception(); } public IEnumerator IInitialize() { while (!Logo.Complete) { yield return null; } while (!Bundle.Complete) { yield return null; } while (ManaData.DamageLock) { yield return null; } InitializeEntrance(); } }