Initializer.cs 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  1. using LitJson;
  2. using UnityEngine;
  3. using UnityEngine.EventSystems;
  4. using System;
  5. using System.Xml;
  6. using System.Collections;
  7. using System.Collections.Generic;
  8. public class Initializer : MonoBehaviour
  9. {
  10. #region
  11. public static List<Regist> RegistList
  12. {
  13. get
  14. {
  15. if (_RegistList == null)
  16. {
  17. _RegistList = new List<Regist>();
  18. }
  19. return _RegistList;
  20. }
  21. set { _RegistList = value; }
  22. }
  23. public static List<Regist> _RegistList;
  24. public static bool Tutorial;
  25. #endregion
  26. private void Awake()
  27. {
  28. if (Bundle.Instance == null)
  29. {
  30. gameObject.AddScript<Bundle>();
  31. }
  32. if (Auxiliary.Instance == null)
  33. {
  34. gameObject.AddScript<Auxiliary>();
  35. }
  36. gameObject.AddScript<ManaText>();
  37. gameObject.AddScript<ManaReso>();
  38. gameObject.AddScript<ManaAnim>();
  39. gameObject.AddScript<ManaAudio>();
  40. gameObject.AddScript<ManaTutorial>();
  41. gameObject.AddScript<ManaUI>();
  42. gameObject.AddScript<ManaSign>();
  43. gameObject.AddScript<ManaData>();
  44. gameObject.AddScript<ManaPlayer>();
  45. gameObject.AddScript<ManaDebug>();
  46. gameObject.AddScript<ManaGarden>();
  47. gameObject.AddScript<ManaAchieve>();
  48. gameObject.AddScript<ManaMiniGame>();
  49. StartCoroutine(IInitialize());
  50. }
  51. public static void Initialize()
  52. {
  53. Tutorial = Data.GetPlayerBool("Tutorial");
  54. ManaTutorial.TutorialIndex = Data.GetPlayerInt("TutorialIndex");
  55. for (int i = 0; i < RegistList.Count; i++)
  56. {
  57. RegistList[i].Instantiate();
  58. }
  59. for (int i = 0; i < RegistList.Count; i++)
  60. {
  61. RegistList[i].RegistReference();
  62. }
  63. for (int i = 0; i < RegistList.Count; i++)
  64. {
  65. RegistList[i].RegistValueA();
  66. }
  67. for (int i = 0; i < RegistList.Count; i++)
  68. {
  69. RegistList[i].RegistValueB();
  70. }
  71. for (int i = 0; i < RegistList.Count; i++)
  72. {
  73. RegistList[i].RegistValueC();
  74. RegistList[i].enabled = true;
  75. }
  76. }
  77. public IEnumerator IInitialize()
  78. {
  79. while (Bundle.LoadComplete == false)
  80. {
  81. yield return null;
  82. }
  83. Initialize();
  84. }
  85. }