Initializer.cs 2.0 KB

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