- 引入 UnityGameFramework
- 使用 Luban 替代原来的 UGF 的数据表
This commit is contained in:
@@ -0,0 +1,46 @@
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
using UnityGameFramework.Runtime;
|
||||
|
||||
namespace SepCore.UI
|
||||
{
|
||||
/// <summary>
|
||||
/// uGUI 界面组辅助器。
|
||||
/// </summary>
|
||||
public class UGuiGroupHelper : UIGroupHelperBase
|
||||
{
|
||||
public const int DepthFactor = 10000;
|
||||
|
||||
private int m_Depth = 0;
|
||||
private Canvas m_CachedCanvas = null;
|
||||
|
||||
/// <summary>
|
||||
/// 设置界面组深度。
|
||||
/// </summary>
|
||||
/// <param name="depth">界面组深度。</param>
|
||||
public override void SetDepth(int depth)
|
||||
{
|
||||
m_Depth = depth;
|
||||
m_CachedCanvas.overrideSorting = true;
|
||||
m_CachedCanvas.sortingOrder = DepthFactor * depth;
|
||||
}
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
m_CachedCanvas = gameObject.GetOrAddComponent<Canvas>();
|
||||
gameObject.GetOrAddComponent<GraphicRaycaster>();
|
||||
}
|
||||
|
||||
private void Start()
|
||||
{
|
||||
m_CachedCanvas.overrideSorting = true;
|
||||
m_CachedCanvas.sortingOrder = DepthFactor * m_Depth;
|
||||
|
||||
RectTransform transform = GetComponent<RectTransform>();
|
||||
transform.anchorMin = Vector2.zero;
|
||||
transform.anchorMax = Vector2.one;
|
||||
transform.anchoredPosition = Vector2.zero;
|
||||
transform.sizeDelta = Vector2.zero;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user