Initializer.cs 1.8 KB

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