UIPanel.cs 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. using UnityEngine;
  2. using XGame.Framework.ObjectCollection;
  3. namespace XGame.Framework.UI
  4. {
  5. /// <summary>
  6. /// UGUI的实现
  7. /// </summary>
  8. [DisallowMultipleComponent]
  9. [AddComponentMenu("XGame/UI/UIPanel")]
  10. public class UIPanel : MonoBehaviour, IUIPanel, IComponentGetter
  11. {
  12. [SerializeField]
  13. private ObjectCollector _collector = new ObjectCollector();
  14. [SerializeField]
  15. private UILayer _layer = UILayer.Normal;
  16. #region IUIPanel 接口实现
  17. public UILayer Layer => _layer;
  18. void IUIPanel.SetActive(bool isActive)
  19. {
  20. gameObject.SetActive(isActive);
  21. }
  22. #endregion
  23. T IComponentGetter.GetComponent<T>(string key)
  24. {
  25. return _collector.GetComponent<T>(key);
  26. }
  27. //#region IObjectCollector 接口实现
  28. //Object IObjectCollector.this[string key] => _collector[key];
  29. //List<string> IObjectCollector.Keys => _collector.Keys;
  30. //List<Object> IObjectCollector.Objects => _collector.Objects;
  31. //#endregion
  32. }
  33. }