//------------------------------------------------------------
// Game Framework
// Copyright © 2013-2021 Jiang Yin. All rights reserved.
// Homepage: https://gameframework.cn/
// Feedback: mailto:ellan@gameframework.cn
//------------------------------------------------------------
using UnityEngine;
using UnityEngine.UI;
using UnityGameFramework.Runtime;
using GeometryTD.CustomComponent;
namespace UI
{
///
/// uGUI 界面组辅助器。
///
[DefaultExecutionOrder(200)]
public class UGuiGroupHelper : UIGroupHelperBase
{
public const int DepthFactor = 10000;
private int m_Depth = 0;
private Canvas m_CachedCanvas = null;
private RectTransform m_RectTransform = null;
private int m_LastScreenWidth = -1;
private int m_LastScreenHeight = -1;
private Rect m_LastViewport = new Rect(float.MinValue, float.MinValue, float.MinValue, float.MinValue);
///
/// 设置界面组深度。
///
/// 界面组深度。
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