123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371 |
- 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<Regist> RegistList = new List<Regist>();
- #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<Bundle>();
- }
- progress = "9";
- gameObject.AddComponent<IAPManager>();
- progress = "10";
- gameObject.AddComponent<VisitManager>();
- progress = "11";
- gameObject.AddComponent<DebugManager>();
- progress = "12";
- gameObject.AddScript<Auxiliary>();
- progress = "13";
- gameObject.AddScript<ConfigManager>();
- progress = "14";
- gameObject.AddScript<ResourceManager>();
- progress = "15";
- gameObject.AddScript<TutorialManager>();
- progress = "16";
- gameObject.AddScript<LanguageManager>();
- progress = "17";
- gameObject.AddScript<AnimManager>();
- progress = "18";
- gameObject.AddScript<AudioManager>();
- progress = "19";
- gameObject.AddScript<AchieveManager>();
- progress = "20";
- gameObject.AddScript<UIManager>();
- progress = "21";
- gameObject.AddScript<SignManager>();
- progress = "22";
- gameObject.AddScript<Manager>();
- progress = "23";
- gameObject.AddScript<GardenManager>();
- progress = "24";
- gameObject.AddScript<PlayerManager>();
- progress = "25";
- gameObject.AddScript<HttpManager>();
- progress = "26";
- gameObject.AddScript<MiniGameManager>();
- progress = "27";
- gameObject.AddScript<InfoBoxManager>();
- progress = "28";
- gameObject.AddScript<SocialManager>();
- progress = "29";
- gameObject.AddScript<NickNameManager>();
- progress = "30";
- gameObject.AddScript<SFSManager>();
- progress = "31";
- gameObject.AddScript<PlazaRoomManager>();
- progress = "31-1";
- gameObject.AddScript<ChestManager>();
- progress = "31-2";
- gameObject.AddScript<RobotManager>();
- 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>().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<Text>();
-
- 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<CanvasGroup>("C_Main").alpha = 0;
- Auxiliary.Instance.DelayCall(ActivateGame, 3f);
- }
- private static void ActivateGame()
- {
- ResourceManager.Get("U_LoadingPanel").TweenForCG();
- ResourceManager.Get<CanvasGroup>("C_Main").alpha = 1;
- AudioManager.MusicTheme.TweenForAudio();
- }
- public static void EnableDebugLab()
- {
- ResourceManager.Get<CanvasGroup>("U_Group").alpha = 0;
- ResourceManager.Get<Text>("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();
- }
- }
|