123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358 |
- 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<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";
- 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<Bundle>();
- }
- progress = "9";
- gameObject.AddComponent<ManaIAP>();
- progress = "10";
- gameObject.AddComponent<ManaVisit>();
- progress = "11";
- gameObject.AddComponent<ManaDebug>();
- progress = "12";
- gameObject.AddScript<Auxiliary>();
- progress = "13";
- gameObject.AddScript<ManaData>();
- progress = "14";
- gameObject.AddScript<ManaReso>();
- progress = "15";
- gameObject.AddScript<ManaTutorial>();
- progress = "16";
- gameObject.AddScript<ManaLan>();
- progress = "17";
- gameObject.AddScript<ManaAnim>();
- progress = "18";
- gameObject.AddScript<ManaAudio>();
- progress = "19";
- gameObject.AddScript<ManaAchieve>();
- progress = "20";
- gameObject.AddScript<ManaUI>();
- progress = "21";
- gameObject.AddScript<ManaSign>();
- progress = "22";
- gameObject.AddScript<ManaCenter>();
- progress = "23";
- gameObject.AddScript<ManaGarden>();
- progress = "24";
- gameObject.AddScript<ManaPlayer>();
- progress = "25";
- gameObject.AddScript<ManaServer>();
- progress = "26";
- gameObject.AddScript<ManaMiniGame>();
- progress = "27";
- gameObject.AddScript<ManaInfoBox>();
- progress = "28";
- gameObject.AddScript<ManaSocial>();
- progress = "29";
- gameObject.AddScript<ManaNickName>();
- progress = "30";
- gameObject.AddScript<GardenSmartFoxManager>();
- progress = "31";
- gameObject.AddScript<PlazaRoomMge>();
- 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>().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<Text>();
- 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<CanvasGroup>("C_Main").alpha = 0;
- Auxiliary.Instance.DelayCall(ActivateGame, 3f);
- }
- private static void ActivateGame()
- {
- ManaReso.Get("U_LoadingPanel").TweenForCG();
- ManaReso.Get<CanvasGroup>("C_Main").alpha = 1;
- ManaAudio.MusicTheme.TweenForAudio();
- }
- public static void EnableDebugLab()
- {
- ManaReso.Get<CanvasGroup>("U_Group").alpha = 0;
- ManaReso.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 (ManaData.DamageLock)
- {
- yield return null;
- }
- InitializeEntrance();
- }
- }
|