Initializer.cs 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201
  1. using LitJson;
  2. using UnityEngine;
  3. using UnityEngine.UI;
  4. using UnityEngine.EventSystems;
  5. using System;
  6. using System.Xml;
  7. using System.Collections;
  8. using System.Collections.Generic;
  9. public class Initializer : MonoBehaviour
  10. {
  11. #region 变量
  12. public bool DebugMode;
  13. public GameObject DebugModeGo;
  14. public static bool Complete;
  15. public static Initializer Instance;
  16. public static Transform Transform;
  17. public static List<Regist> RegistList = new List<Regist>();
  18. #endregion
  19. private void Awake()
  20. {
  21. if (Application.platform == RuntimePlatform.IPhonePlayer)
  22. {
  23. DataEyeGA.Init("C5790DBD2CFE97BD18C7BE9A95482C05", DataEyeGA.PlatformType.IOS, "Official", "IOS");
  24. }
  25. else if (Application.isMobilePlatform)
  26. {
  27. DataEyeGA.Init("ADE884FAAF61A2CB45B02431A70932B8", DataEyeGA.PlatformType.ADR, "Official", "Android");
  28. }
  29. else if (Application.isEditor)
  30. {
  31. DataEyeGA.Init("ADE884FAAF61A2CB45B02431A70932B8", DataEyeGA.PlatformType.WP, "Official", "Windows");
  32. }
  33. Application.targetFrameRate = 60;
  34. DontDestroyOnLoad(gameObject);
  35. ManaServer.Login(ManaCenter.LoginCallbackInitial);
  36. ManaServer.MailRequest();
  37. Instance = this;
  38. Transform = transform;
  39. if (DebugMode)
  40. {
  41. Instantiate(DebugModeGo, transform);
  42. }
  43. else
  44. {
  45. gameObject.AddComponent<Bundle>();
  46. }
  47. gameObject.AddComponent<ManaIAP>();
  48. gameObject.AddComponent<ManaDebug>();
  49. gameObject.AddScript<Auxiliary>();
  50. gameObject.AddScript<ManaData>();
  51. gameObject.AddScript<ManaReso>();
  52. gameObject.AddScript<ManaTutorial>();
  53. gameObject.AddScript<ManaLan>();
  54. gameObject.AddScript<ManaAnim>();
  55. gameObject.AddScript<ManaAudio>();
  56. gameObject.AddScript<ManaAchieve>();
  57. gameObject.AddScript<ManaUI>();
  58. gameObject.AddScript<ManaSign>();
  59. gameObject.AddScript<ManaCenter>();
  60. gameObject.AddScript<ManaGarden>();
  61. gameObject.AddScript<ManaPlayer>();
  62. gameObject.AddScript<ManaServer>();
  63. gameObject.AddScript<ManaMiniGame>();
  64. gameObject.AddScript<ManaInfo>();
  65. StartCoroutine(IInitialize());
  66. }
  67. public static void Initialize()
  68. {
  69. GameObject.Find("I_Lab").GetComponent<Text>().text = "Error code : 1";
  70. ManaTutorial.TutorialA = ManaData.GetPlayerBool("TutorialA");
  71. GameObject.Find("I_Lab").GetComponent<Text>().text = "Error code : 1-1";
  72. ManaTutorial.TutorialB_ = ManaData.GetPlayerBool("TutorialB");
  73. GameObject.Find("I_Lab").GetComponent<Text>().text = "Error code : 1-2";
  74. ManaTutorial.TutorialC_ = ManaData.GetPlayerBool("TutorialC");
  75. GameObject.Find("I_Lab").GetComponent<Text>().text = "Error code : 1-3";
  76. ManaTutorial.TutorialD_ = ManaData.GetPlayerBool("TutorialD");
  77. GameObject.Find("I_Lab").GetComponent<Text>().text = "Error code : 1-4";
  78. ManaTutorial.TutorialE_ = ManaData.GetPlayerBool("TutorialE");
  79. GameObject.Find("I_Lab").GetComponent<Text>().text = "Error code : 1-5";
  80. ManaTutorial.TutorialIndexA = ManaData.GetPlayerInt("TutorialIndexA");
  81. GameObject.Find("I_Lab").GetComponent<Text>().text = "Error code : 1-6";
  82. ManaTutorial.TutorialIndexB = ManaData.GetPlayerInt("TutorialIndexB");
  83. GameObject.Find("I_Lab").GetComponent<Text>().text = "Error code : 1-7";
  84. ManaTutorial.TutorialIndexC = ManaData.GetPlayerInt("TutorialIndexC");
  85. GameObject.Find("I_Lab").GetComponent<Text>().text = "Error code : 1-8";
  86. ManaTutorial.TutorialIndexD = ManaData.GetPlayerInt("TutorialIndexD");
  87. GameObject.Find("I_Lab").GetComponent<Text>().text = "Error code : 1-9";
  88. ManaTutorial.TutorialIndexE = ManaData.GetPlayerInt("TutorialIndexE");
  89. GameObject.Find("I_Lab").GetComponent<Text>().text = "Error code : 1-10";
  90. Bundle.LoadAtlas2Sprite();
  91. GameObject.Find("I_Lab").GetComponent<Text>().text = "Error code : 1-11";
  92. for (int i = 0; i < RegistList.Count; i++)
  93. {
  94. GameObject.Find("I_Lab").GetComponent<Text>().text = "Error code : 1-12-" + RegistList[i].GetType();
  95. RegistList[i].Instantiate();
  96. }
  97. GameObject.Find("I_Lab").GetComponent<Text>().text = "Error code : 2";
  98. for (int i = 0; i < RegistList.Count; i++)
  99. {
  100. RegistList[i].RegistReference();
  101. }
  102. GameObject.Find("I_Lab").GetComponent<Text>().text = "Error code : 3";
  103. for (int i = 0; i < RegistList.Count; i++)
  104. {
  105. RegistList[i].RegistValueA();
  106. }
  107. GameObject.Find("I_Lab").GetComponent<Text>().text = "Error code : 4";
  108. for (int i = 0; i < RegistList.Count; i++)
  109. {
  110. RegistList[i].RegistValueB();
  111. }
  112. GameObject.Find("I_Lab").GetComponent<Text>().text = "Error code : 5";
  113. for (int i = 0; i < RegistList.Count; i++)
  114. {
  115. RegistList[i].RegistValueC();
  116. RegistList[i].enabled = true;
  117. }
  118. GameObject.Find("I_Lab").GetComponent<Text>().text = "Error code : 6";
  119. Complete = true;
  120. ManaPlayer.InitializeDressRoom();
  121. ManaCenter.LoginCallbackInitial(new JsonData());
  122. ManaIAP.Initialize();
  123. ManaVisit.Initialize();
  124. ManaReso.Get("I_BlackMask").TweenForCG();
  125. ManaReso.SetActive("I_Lab", false);
  126. ManaReso.Release();
  127. }
  128. public IEnumerator IInitialize()
  129. {
  130. while (!Logo.Complete)
  131. {
  132. yield return null;
  133. }
  134. while (!Bundle.Complete)
  135. {
  136. yield return null;
  137. }
  138. while (ManaData.DamageLock)
  139. {
  140. yield return null;
  141. }
  142. Initialize();
  143. }
  144. }