mirror of
https://github.com/GeWuYou/GFramework.git
synced 2026-03-22 10:34:30 +08:00
- 添加层级UI管理功能,支持Overlay、Modal、Toast等浮层显示 - 实现路由守卫机制,支持页面跳转前后的权限检查 - 新增实例ID计数器,为每个UI实例生成唯一标识符 - 重构代码结构,添加区域划分提高代码可读性 - 优化页面栈管理逻辑,改进生命周期处理流程 - 修复Push和Pop操作中的日志输出格式问题 - 添加类型安全检查,防止重复注册相同UI实例 - 实现UI句柄公共构造函数,支持外部创建UI句柄对象 - 增强Show和Hide操作的重入性检测机制
50 lines
1.6 KiB
C#
50 lines
1.6 KiB
C#
// Copyright (c) 2026 GeWuYou
|
||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||
// you may not use this file except in compliance with the License.
|
||
// You may obtain a copy of the License at
|
||
//
|
||
// http://www.apache.org/licenses/LICENSE-2.0
|
||
//
|
||
// Unless required by applicable law or agreed to in writing, software
|
||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||
// See the License for the specific language governing permissions and
|
||
// limitations under the License.
|
||
|
||
using GFramework.Game.Abstractions.enums;
|
||
|
||
namespace GFramework.Game.Abstractions.ui;
|
||
|
||
/// <summary>
|
||
/// 表示一个UI句柄,用于唯一标识和管理UI实例。
|
||
/// </summary>
|
||
public readonly struct UiHandle
|
||
{
|
||
/// <summary>
|
||
/// 获取UI实例的唯一标识符。
|
||
/// </summary>
|
||
public string InstanceId { get; }
|
||
|
||
/// <summary>
|
||
/// 获取UI的键值,通常用于标识UI的类型或名称。
|
||
/// </summary>
|
||
public string Key { get; }
|
||
|
||
/// <summary>
|
||
/// 获取UI所在的层级,用于控制UI的显示顺序。
|
||
/// </summary>
|
||
public UiLayer Layer { get; }
|
||
|
||
/// <summary>
|
||
/// 初始化一个新的UiHandle实例。
|
||
/// </summary>
|
||
/// <param name="key">UI的键值,用于标识UI的类型或名称。</param>
|
||
/// <param name="instanceId">UI实例的唯一标识符。</param>
|
||
/// <param name="layer">UI所在的层级,用于控制UI的显示顺序。</param>
|
||
public UiHandle(string key, string instanceId, UiLayer layer)
|
||
{
|
||
Key = key;
|
||
InstanceId = instanceId;
|
||
Layer = layer;
|
||
}
|
||
} |