UiSystemModule.cs 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. using KairoEngine.Core;
  5. using KairoEngine.Core.ModuleSystem;
  6. using Sirenix.OdinInspector;
  7. namespace KairoEngine.UI
  8. {
  9. public class UiSystemModule : IGameModule
  10. {
  11. private string _name = "UI Module";
  12. public string name { get => _name; set => _name = value; }
  13. public void Load(Transform parent)
  14. {
  15. Transform uiParent = CreateUiManager(parent);
  16. }
  17. public void Reset()
  18. {
  19. }
  20. private Transform CreateUiManager(Transform parent)
  21. {
  22. Transform UiTransform = parent.Find("UI");
  23. GameObject uiObj;
  24. if(UiTransform == null)
  25. {
  26. uiObj = GameObject.Instantiate(new GameObject(), new Vector3(), Quaternion.identity, parent);
  27. uiObj.name = "UI";
  28. }
  29. else uiObj = UiTransform.gameObject;
  30. uiObj.AddComponent<UiManager>();
  31. return uiObj.transform;
  32. }
  33. public void Destroy()
  34. {
  35. }
  36. }
  37. }