Initializer.cs 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  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<ManaMiniGame>();
  35. StartCoroutine(IInitialize());
  36. }
  37. public static void Initialize()
  38. {
  39. for (int i = 0; i < RegistList.Count; i++)
  40. {
  41. RegistList[i].Instantiate();
  42. RegistList[i].enabled = true;
  43. }
  44. for (int i = 0; i < RegistList.Count; i++)
  45. {
  46. RegistList[i].RegistReference();
  47. }
  48. for (int i = 0; i < RegistList.Count; i++)
  49. {
  50. RegistList[i].RegistValueA();
  51. }
  52. for (int i = 0; i < RegistList.Count; i++)
  53. {
  54. RegistList[i].RegistValueB();
  55. }
  56. for (int i = 0; i < RegistList.Count; i++)
  57. {
  58. RegistList[i].RegistValueC();
  59. }
  60. }
  61. public IEnumerator IInitialize()
  62. {
  63. while (Bundle.LoadComplete == false)
  64. {
  65. yield return null;
  66. }
  67. Initialize();
  68. }
  69. }