Initializer.cs 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  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. #endregion
  13. private void Awake()
  14. {
  15. RegistList = new List<Regist>();
  16. if (Bundle.Instance == null)
  17. {
  18. gameObject.AddScript<Bundle>();
  19. }
  20. if (Auxiliary.Instance == null)
  21. {
  22. gameObject.AddScript<Auxiliary>();
  23. }
  24. gameObject.AddScript<ManaReso>();
  25. gameObject.AddScript<ManaAnim>();
  26. gameObject.AddScript<ManaAudio>();
  27. gameObject.AddScript<ManaText>();
  28. gameObject.AddScript<ManaUI>();
  29. gameObject.AddScript<ManaSign>();
  30. gameObject.AddScript<ManaGarden>();
  31. gameObject.AddScript<ManaData>();
  32. gameObject.AddScript<ManaPlayer>();
  33. gameObject.AddScript<ManaDebug>();
  34. gameObject.AddScript<ManaAchieve>();
  35. gameObject.AddScript<ManaMiniGame>();
  36. StartCoroutine(IInitialize());
  37. }
  38. public static void Initialize()
  39. {
  40. for (int i = 0; i < RegistList.Count; i++)
  41. {
  42. RegistList[i].Instantiate();
  43. RegistList[i].enabled = true;
  44. }
  45. for (int i = 0; i < RegistList.Count; i++)
  46. {
  47. RegistList[i].RegistReference();
  48. }
  49. for (int i = 0; i < RegistList.Count; i++)
  50. {
  51. RegistList[i].RegistValueA();
  52. }
  53. for (int i = 0; i < RegistList.Count; i++)
  54. {
  55. RegistList[i].RegistValueB();
  56. }
  57. for (int i = 0; i < RegistList.Count; i++)
  58. {
  59. RegistList[i].RegistValueC();
  60. }
  61. }
  62. public IEnumerator IInitialize()
  63. {
  64. while (Bundle.LoadComplete == false)
  65. {
  66. yield return null;
  67. }
  68. Initialize();
  69. }
  70. }