123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443 |
- using LitJson;
- using UnityEngine;
- using UnityEngine.UI;
- using UnityEngine.EventSystems;
- using System;
- using System.Xml;
- using System.Collections;
- using System.Collections.Generic;
- using System.Linq.Expressions;
- public class LogoSceneLabel
- {
- public static string DebugText = "DebugText";
- public static string ManagerGame = "ManagerGame";
- }
- public class Initializer : MonoBehaviour
- {
- #region Config
- //public Texture2D Texture2D;
- public bool AuditEdition;
- public bool DebugMode;
- public bool CatchException;
- public GameObject DebugModeGo;
- public static bool Inited;
- public static string InitScriptProgress;
- public static Text DebugText;
- public static Initializer Instance;
- public static List<Regist> RegistList = new List<Regist>();
- #endregion
- private void Awake()
- {
- if (CatchException)
- {
- try
- {
- InitDataEye();
- }
- catch (Exception)
- {
- }
- }
- else
- {
- InitDataEye();
- }
- if (CatchException)
- {
- try
- {
- InitScript();
- }
- catch (Exception e)
- {
- Text debugText = GameObject.Find(LogoSceneLabel.DebugText).GetComponent<Text>();
- debugText.SetAlpha(1);
- debugText.text = InitScriptProgress + "\n" + e;
- throw new Exception();
- }
- }
- else
- {
- InitScript();
- }
- }
- private void InitDataEye()
- {
- 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");
- }
- }
- private void InitScript()
- {
- int index = 1;
- InitScriptProgress = index++.ToString();
- Application.targetFrameRate = 50;
- InitScriptProgress = index++.ToString();
- DontDestroyOnLoad(gameObject);
- InitScriptProgress = index++.ToString();
- HttpManager.Login(Manager.FirstTimeLoginCallback);
- InitScriptProgress = index++.ToString();
- HttpManager.GetMailAwardData();
- InitScriptProgress = index++.ToString();
- HttpManager.GetRankData();
- InitScriptProgress = index++.ToString();
- HttpManager.GetAlipayFlag();
- InitScriptProgress = index++.ToString();
- HttpManager.GetAnnounceData();
- Instance = this;
- InitScriptProgress = index++.ToString();
- if (DebugMode)
- {
- Instantiate(DebugModeGo, transform);
- }
- else
- {
- gameObject.AddComponent<Bundle>();
- }
- InitScriptProgress = index++.ToString();
- gameObject.AddComponent<IAPManager>();
- InitScriptProgress = index++.ToString();
- gameObject.AddComponent<VisitManager>();
- InitScriptProgress = index++.ToString();
- gameObject.AddComponent<DebugManager>();
- InitScriptProgress = index++.ToString();
- gameObject.AddScript<Auxiliary>();
- InitScriptProgress = index++.ToString();
- gameObject.AddScript<ConfigManager>();
- InitScriptProgress = index++.ToString();
- gameObject.AddScript<ResourceManager>();
- InitScriptProgress = index++.ToString();
- gameObject.AddScript<TutorialManager>();
- InitScriptProgress = index++.ToString();
- gameObject.AddScript<LanguageManager>();
- InitScriptProgress = index++.ToString();
- gameObject.AddScript<AnimManager>();
- InitScriptProgress = index++.ToString();
- gameObject.AddScript<AudioManager>();
- InitScriptProgress = index++.ToString();
- gameObject.AddScript<AchieveManager>();
- InitScriptProgress = index++.ToString();
- gameObject.AddScript<UIManager>();
- InitScriptProgress = index++.ToString();
- gameObject.AddScript<SignManager>();
- InitScriptProgress = index++.ToString();
- gameObject.AddScript<Manager>();
- InitScriptProgress = index++.ToString();
- gameObject.AddScript<GardenManager>();
- InitScriptProgress = index++.ToString();
- gameObject.AddScript<PlayerManager>();
- InitScriptProgress = index++.ToString();
- gameObject.AddScript<HttpManager>();
- InitScriptProgress = index++.ToString();
- gameObject.AddScript<MiniGameManager>();
- InitScriptProgress = index++.ToString();
- gameObject.AddScript<InfoBoxManager>();
- InitScriptProgress = index++.ToString();
- gameObject.AddScript<SocialManager>();
- InitScriptProgress = index++.ToString();
- gameObject.AddScript<NickNameManager>();
- InitScriptProgress = index++.ToString();
- gameObject.AddScript<SFSManager>();
- InitScriptProgress = index++.ToString();
- gameObject.AddScript<PlazaRoomManager>();
- InitScriptProgress = index++.ToString();
- gameObject.AddScript<ChestManager>();
- InitScriptProgress = index++.ToString();
- gameObject.AddScript<RobotManager>();
- InitScriptProgress = index++.ToString();
- gameObject.AddScript<CDMinigamePanelManager>();
- InitScriptProgress = index++.ToString();
- gameObject.AddScript<EnterMinigamePanelManager>();
- InitScriptProgress = index++.ToString();
- gameObject.AddScript<PlazaroomMemberPanel>();
- InitScriptProgress = index++.ToString();
- gameObject.AddScript<FriendPanel>();
- InitScriptProgress = index++.ToString();
- gameObject.AddScript<AddFriendPanel>();
- InitScriptProgress = index++.ToString();
- gameObject.AddScript<MessagePanel>();
- InitScriptProgress = index++.ToString();
- gameObject.AddScript<FashionShowEditPage>();
- InitScriptProgress = index++.ToString();
- gameObject.AddScript<FashionShowCommentPanel>();
- InitScriptProgress = index++.ToString();
- gameObject.AddScript<FashionShowHomePage>();
- InitScriptProgress = index++.ToString();
- StartCoroutine(WaitToInit());
- }
- public static void InitEntrance()
- {
- if (Instance.CatchException)
- {
- DebugManager.TryCatch(Init, EnableDebugLab);
- }
- else
- {
- Init();
- }
- }
- public static void Init()
- {
- DebugText = GameObject.Find(CanvasLabel.U_DebugLab).GetComponent<Text>();
-
- DebugText.text = "Error code : 1";
- TutorialManager.NewplayerTutorial = ConfigManager.GetBoolFormConfig(PlayerConfigLabel.NewplayerTutorial);
- DebugText.text = "Error code : 1-1";
- TutorialManager.memoryMinigameTutorial = ConfigManager.GetBoolFormConfig(PlayerConfigLabel.MemoryMinigameTutorial);
- DebugText.text = "Error code : 1-2";
- TutorialManager.visitTutorial = ConfigManager.GetBoolFormConfig(PlayerConfigLabel.VisitTutorial);
- DebugText.text = "Error code : 1-3";
- TutorialManager.dressroomTutorial = ConfigManager.GetBoolFormConfig(PlayerConfigLabel.DressroomTutorial);
- DebugText.text = "Error code : 1-4";
- TutorialManager.findMinigameTutorial = ConfigManager.GetBoolFormConfig(PlayerConfigLabel.FindMinigameTutorial);
- DebugText.text = "Error code : 1-5";
- TutorialManager.plazaRoomTutorial = ConfigManager.GetBoolFormConfig(PlayerConfigLabel.TutorialPlazaRoom);
- DebugText.text = "Error code : 1-5-1";
- TutorialManager.NewplayerTutorialIndex = ConfigManager.GetIntFormConfig(PlayerConfigLabel.NewplayerTutorialIndex);
- DebugText.text = "Error code : 1-6";
- TutorialManager.MemoryMinigameTutorialIndex = ConfigManager.GetIntFormConfig(PlayerConfigLabel.MemoryMinigameTutorialIndex);
- DebugText.text = "Error code : 1-7";
- TutorialManager.VisitTutorialIndex = ConfigManager.GetIntFormConfig(PlayerConfigLabel.VisitTutorialIndex);
- DebugText.text = "Error code : 1-8";
- TutorialManager.DressroomTutorialIndex = ConfigManager.GetIntFormConfig(PlayerConfigLabel.DressroomIndex);
- DebugText.text = "Error code : 1-9";
- TutorialManager.FindMinigameTutorialIndex = ConfigManager.GetIntFormConfig(PlayerConfigLabel.FindMinigameTutorialIndex);
- DebugText.text = "Error code : 1-10";
- TutorialManager.PlazaRoomTutorialIndex = ConfigManager.GetIntFormConfig(PlayerConfigLabel.TutorialIndexPlazaRoom);
- DebugText.text = "Error code : 1-10-1";
- Bundle.LoadAtlasSprites();
- DebugText.text = "Error code : 1-11";
- for (int i = 0; i < RegistList.Count; i++)
- {
- DebugText.text = "Error code : 1-12-" + i;
- //Debug.Log(i + " " + RegistList[i].GetType());
- RegistList[i].InstantiatePrefabs();
- }
- DebugText.text = "Error code : 2";
- for (int i = 0; i < RegistList.Count; i++)
- {
- DebugText.text = "Error code : 2-" + i;
- RegistList[i].RegistReference();
- }
- DebugText.text = "Error code : 3";
- for (int i = 0; i < RegistList.Count; i++)
- {
- DebugText.text = "Error code : 3-" + i;
- RegistList[i].FirstInit();
- }
- DebugText.text = "Error code : 4";
- for (int i = 0; i < RegistList.Count; i++)
- {
- DebugText.text = "Error code : 4-" + i;
- RegistList[i].SecondInit();
- }
- DebugText.text = "Error code : 5";
- for (int i = 0; i < RegistList.Count; i++)
- {
- DebugText.text = "Error code : 5-" + i;
- RegistList[i].ThirdInit();
- RegistList[i].enabled = true;
- }
- DebugText.text = "Error code : 6";
- Inited = true;
- if (HttpManager.IsAnnounceReady)
- {
- ResourceManager.SetActive(CanvasLabel.C_NotifyParent, true);
- ResourceManager.Get(CanvasLabel.C_Notify).TweenForCG();
- }
- DebugText.text = "Error code : 7";
- PlayerManager.InitDressRoom();
- DebugText.text = "Error code : 8";
- Manager.FirstTimeLoginCallback(new JsonData());
- //debugLab.text = "Error code : 9";
- //SFSManager.GardenSmartFox.Connector.Connect();
- DebugText.text = "Error code : 10";
- StringFilter.Init();
- DebugText.text = "Error code : 11";
- IAPManager.Init();
- DebugText.text = "Error code : 12";
- VisitManager.Init();
- DebugText.text = "Error code : 13";
- SocialManager.InitRankPanel();
- if (Instance.DebugMode)
- {
- ActivateGame();
- }
- else
- {
- ShowLoadingPanel();
- }
- }
- public IEnumerator WaitToInit()
- {
- while (!Logo.Complete)
- {
- yield return null;
- }
- while (!Bundle.Complete)
- {
- yield return null;
- }
- while (ConfigManager.PlayerDocumentDamageFlag)
- {
- yield return null;
- }
- InitEntrance();
- }
- private static float LoadingDelayTime = 3f;
- private static void ShowLoadingPanel()
- {
- ResourceManager.Get(CanvasLabel.U_Group).TweenForCG();
- ResourceManager.Get<CanvasGroup>(CanvasLabel.C_Main).alpha = 0;
- ResourceManager.SetText(CanvasLabel.U_Lab, Language.GetStr(LanguageLabel.UI__U_Lab));
- Auxiliary.Instance.DelayCall(ActivateGame, LoadingDelayTime);
- }
- public static void SetWarningTitleAndText()
- {
- SystemLanguage language = Application.systemLanguage;
- if (Instance.AuditEdition)
- {
- language = SystemLanguage.ChineseSimplified;
- }
- ResourceManager.SetText(CanvasLabel.U_WarningTitle, Language.GetStr(LanguageLabel.UI__U_WarningTitle, language));
- if (language == SystemLanguage.ChineseSimplified)
- {
- ResourceManager.SetText(CanvasLabel.U_WarningText, Language.GetStr(LanguageLabel.UI__U_WarningText, language));
- }
- else if (language == SystemLanguage.ChineseTraditional)
- {
- ResourceManager.SetActive(CanvasLabel.U_WarningText, false);
- }
- else
- {
- ResourceManager.SetActive(CanvasLabel.U_WarningText, false);
- }
- }
- private static void ActivateGame()
- {
- ResourceManager.Get(CanvasLabel.U_LoadingPanel).TweenForCG();
- ResourceManager.Get<CanvasGroup>(CanvasLabel.C_Main).alpha = 1;
- AudioManager.GardenThemeAudio.TweenForAudio();
- }
- public static void EnableDebugLab()
- {
- ResourceManager.Get<CanvasGroup>(CanvasLabel.U_Group).alpha = 0;
- ResourceManager.Get<Text>(CanvasLabel.U_DebugLab).enabled = true;
- }
- }
|