| | |
| | | // 确保 DOTween 已初始化 |
| | | DOTween.SetTweensCapacity(500, 50); |
| | | |
| | | // 防止有人不写base.InitComponent引发错误 所以拆分 |
| | | InitComponentInternal(); |
| | | // 在Awake中进行基本初始化 |
| | | InitComponent(); |
| | | |
| | |
| | | |
| | | #region 初始化方法 |
| | | |
| | | // 获取必要的组件 |
| | | protected virtual void InitComponent() |
| | | private void InitComponentInternal() |
| | | { |
| | | // 获取或添加Canvas组件 |
| | | canvas = GetComponent<Canvas>(); |
| | |
| | | rectTransform = GetComponent<RectTransform>(); |
| | | } |
| | | |
| | | // 获取必要的组件 |
| | | protected virtual void InitComponent() |
| | | { |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region UI操作方法 |
| | |
| | | // 设置UI层级 |
| | | public void SetSortingOrder(int order) |
| | | { |
| | | if (canvas != null) |
| | | { |
| | | canvas.sortingOrder = order; |
| | | } |
| | | canvas.sortingOrder = order; |
| | | } |
| | | |
| | | protected virtual void OnPreOpen() |