using System;
using System.Collections.Generic;
using System.Threading;
using Cysharp.Threading.Tasks;
using GameLogic;
using TEngine;
using UnityEngine;
using UnityEngine.UI;
namespace GameLogic
{
///
/// UI管理模块。
///
public sealed partial class UIModule : Singleton, IUpdate
{
// 核心字段
private static Transform _instanceRoot = null; // UI根节点变换组件
private bool _enableErrorLog = true; // 是否启用错误日志
private Camera _uiCamera = null; // UI专用摄像机
private readonly List _uiStack = new List(128); // 窗口堆栈
private ErrorLogger _errorLogger; // 错误日志记录器
// 常量定义
public const int LAYER_DEEP = 2000;
public const int WINDOW_DEEP = 100;
public const int WINDOW_HIDE_LAYER = 2; // Ignore Raycast
public const int WINDOW_SHOW_LAYER = 5; // UI
// 资源加载接口
public static IUIResourceLoader Resource;
///
/// UI根节点访问属性
///
public static Transform UIRoot => _instanceRoot;
///
/// UI摄像机访问属性
///
public Camera UICamera => _uiCamera;
///
/// 模块初始化(自动调用)。
/// 1. 查找场景中的UIRoot
/// 2. 初始化资源加载器
/// 3. 配置错误日志系统
///
protected override void OnInit()
{
var uiRoot = GameObject.Find("UIRoot");
if (uiRoot != null)
{
_instanceRoot = uiRoot.GetComponentInChildren