DefaultUIGroupHelper.cs 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. //------------------------------------------------------------
  2. // Game Framework
  3. // Copyright © 2013-2021 Jiang Yin. All rights reserved.
  4. // Homepage: https://gameframework.cn/
  5. // Feedback: mailto:ellan@gameframework.cn
  6. //------------------------------------------------------------
  7. using System;
  8. using UnityEngine;
  9. using UnityEngine.UI;
  10. namespace UnityGameFramework.Runtime
  11. {
  12. /// <summary>
  13. /// 默认界面组辅助器。
  14. /// </summary>
  15. public class DefaultUIGroupHelper : UIGroupHelperBase
  16. {
  17. private Canvas _canvas;
  18. private void Awake()
  19. {
  20. _canvas=this.gameObject.AddComponent<Canvas>();
  21. _canvas.renderMode = RenderMode.ScreenSpaceOverlay;
  22. RectTransform rect=this.gameObject.GetOrAddComponent<RectTransform>();
  23. rect.anchoredPosition = new Vector2(0, 0);
  24. gameObject.AddComponent<GraphicRaycaster>();
  25. }
  26. private void Start()
  27. {
  28. }
  29. /// <summary>
  30. /// 设置界面组深度。
  31. /// </summary>
  32. /// <param name="depth">界面组深度。</param>
  33. public override void SetDepth(int depth)
  34. {
  35. }
  36. }
  37. }