Initializer.cs 2.0 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. gameObject.AddScript<Auxiliary>();
  21. gameObject.AddScript<ManaReso>();
  22. gameObject.AddScript<ManaAnim>();
  23. gameObject.AddScript<ManaAudio>();
  24. gameObject.AddScript<ManaUI>();
  25. gameObject.AddScript<ManaGarden>();
  26. gameObject.AddScript<ManaData>();
  27. gameObject.AddScript<ManaPlayer>();
  28. gameObject.AddScript<ManaDebug>();
  29. gameObject.AddScript<ManaMiniGame>();
  30. StartCoroutine(IInitialize());
  31. }
  32. public static void Initialize()
  33. {
  34. for (int i = 0; i < RegistList.Count; i++)
  35. {
  36. RegistList[i].Instantiate();
  37. RegistList[i].enabled = true;
  38. }
  39. for (int i = 0; i < RegistList.Count; i++)
  40. {
  41. RegistList[i].RegistReference();
  42. }
  43. for (int i = 0; i < RegistList.Count; i++)
  44. {
  45. RegistList[i].RegistValueA();
  46. }
  47. for (int i = 0; i < RegistList.Count; i++)
  48. {
  49. RegistList[i].RegistValueB();
  50. }
  51. for (int i = 0; i < RegistList.Count; i++)
  52. {
  53. RegistList[i].RegistValueC();
  54. }
  55. //Bundle.UI.Unload(true);
  56. //Bundle.Skill.Unload(true);
  57. //Bundle.Config.Unload(true);
  58. //Bundle.Object.Unload(true);
  59. //Bundle.Shader.Unload(true);
  60. //Bundle.Garden.Unload(true);
  61. //Bundle.Character.Unload(true);
  62. }
  63. public IEnumerator IInitialize()
  64. {
  65. while (Bundle.LoadComplete == false)
  66. {
  67. yield return null;
  68. }
  69. Initialize();
  70. }
  71. }