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 Config public bool DebugMode; public bool CatchException; 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"; HttpManager.Login(Manager.LoginCallbackInitial); progress = "4"; HttpManager.MailRequest(); progress = "5"; HttpManager.RankRequest(); progress = "6"; HttpManager.IOSAlipayRequest(); progress = "7"; HttpManager.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 = "31-1"; gameObject.AddScript(); progress = "31-2"; gameObject.AddScript(); progress = "32"; StartCoroutine(IInitialize()); } catch (Exception e) { GameObject.Find(PrefabLabel.Canvas).GetChild(0).SetActive(true); GameObject.Find(PrefabLabel.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() { //DelayCall.Call //( // 1, // () => // { if (Instance.CatchException) { DebugManager.TryCatch(Initialize, EnableDebugLab); } else { Initialize(); } // } //); } public static Text DebugLab; public static void Initialize() { DebugLab = GameObject.Find("U_DebugLab").GetComponent(); DebugLab.text = "Error code : 1"; TutorialManager.NewplayerTutorial = ConfigManager.GetPlayerBool("TutorialA"); DebugLab.text = "Error code : 1-1"; TutorialManager.memoryMinigameTutorial = ConfigManager.GetPlayerBool("TutorialB"); DebugLab.text = "Error code : 1-2"; TutorialManager.visitTutorial = ConfigManager.GetPlayerBool("TutorialC"); DebugLab.text = "Error code : 1-3"; TutorialManager.dressroomTutorial = ConfigManager.GetPlayerBool("TutorialD"); DebugLab.text = "Error code : 1-4"; TutorialManager.findMinigameTutorial = ConfigManager.GetPlayerBool("TutorialE"); DebugLab.text = "Error code : 1-5"; TutorialManager.plazaRoomTutorial = ConfigManager.GetPlayerBool("TutorialPlazaRoom"); DebugLab.text = "Error code : 1-5-1"; TutorialManager.NewplayerTutorialIndex = ConfigManager.GetPlayerInt("TutorialIndexA"); DebugLab.text = "Error code : 1-6"; TutorialManager.MemoryMinigameTutorialIndex = ConfigManager.GetPlayerInt("TutorialIndexB"); DebugLab.text = "Error code : 1-7"; TutorialManager.VisitTutorialIndex = ConfigManager.GetPlayerInt("TutorialIndexC"); DebugLab.text = "Error code : 1-8"; TutorialManager.DressroomTutorialIndex = ConfigManager.GetPlayerInt("TutorialIndexD"); DebugLab.text = "Error code : 1-9"; TutorialManager.FindMinigameTutorialIndex = ConfigManager.GetPlayerInt("TutorialIndexE"); DebugLab.text = "Error code : 1-10"; TutorialManager.PlazaRoomTutorialIndex = ConfigManager.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; //Debug.Log(i + " " + RegistList[i].GetType()); RegistList[i].InstantiatePrefabs(); } 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].FirstInit(); } DebugLab.text = "Error code : 4"; for (int i = 0; i < RegistList.Count; i++) { DebugLab.text = "Error code : 4-" + i; RegistList[i].SecondInit(); } DebugLab.text = "Error code : 5"; for (int i = 0; i < RegistList.Count; i++) { DebugLab.text = "Error code : 5-" + i; RegistList[i].ThirdInit(); RegistList[i].enabled = true; } DebugLab.text = "Error code : 6"; Complete = true; if (HttpManager.NotificationReady) { ResourceManager.Get("C_Notify").TweenForCG(); } DebugLab.text = "Error code : 7"; PlayerManager.InitializeDressRoom(); DebugLab.text = "Error code : 8"; Manager.LoginCallbackInitial(new JsonData()); //debugLab.text = "Error code : 9"; //SFSManager.GardenSmartFox.Connector.Connect(); DebugLab.text = "Error code : 10"; StringFilter.Init(); DebugLab.text = "Error code : 11"; IAPManager.Initialize(); DebugLab.text = "Error code : 12"; VisitManager.Initialize(); DebugLab.text = "Error code : 13"; SocialManager.InitializeRankPanel(); if (Instance.DebugMode) { ActivateGame(); } else { ShowLoadingPanel(); } } private static void ShowLoadingPanel() { ResourceManager.Get("U_Group").TweenForCG(); ResourceManager.Get("C_Main").alpha = 0; Auxiliary.Instance.DelayCall(ActivateGame, 3f); } private static void ActivateGame() { ResourceManager.Get("U_LoadingPanel").TweenForCG(); ResourceManager.Get("C_Main").alpha = 1; AudioManager.MusicTheme.TweenForAudio(); } public static void EnableDebugLab() { ResourceManager.Get("U_Group").alpha = 0; ResourceManager.Get("U_DebugLab").enabled = true; throw new Exception(); } public IEnumerator IInitialize() { while (!Logo.Complete) { yield return null; } while (!Bundle.Complete) { yield return null; } while (ConfigManager.DamageLock) { yield return null; } InitializeEntrance(); } }