GFramework/GFramework.Godot/UI/OverlayLayerUiPageBehavior.cs
GeWuYou fb14d7122c docs(style): 更新文档中的命名空间导入格式
- 将所有小写的命名空间导入更正为首字母大写格式
- 统一 GFramework 框架的命名空间引用规范
- 修复 core、ecs、godot 等模块的命名空间导入错误
- 标准化文档示例代码中的 using 语句格式
- 确保所有文档中的命名空间引用保持一致性
- 更新 global using 语句以匹配正确的命名空间格式
2026-03-10 07:18:49 +08:00

68 lines
2.4 KiB
C#
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

// 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;
using GFramework.Game.Abstractions.UI;
using Godot;
namespace GFramework.Godot.UI;
/// <summary>
/// 浮层 UI 行为类,用于管理覆盖层、对话框等 UI 元素。
/// 该行为支持可重入性,适用于需要叠加显示的场景。
/// </summary>
/// <typeparam name="T">UI 元素的类型,必须继承自 CanvasItem。</typeparam>
public class OverlayLayerUiPageBehavior<T> : CanvasItemUiPageBehaviorBase<T>
where T : CanvasItem
{
/// <summary>
/// 初始化 OverlayLayerUiPageBehavior 实例。
/// </summary>
/// <param name="owner">关联的 UI 元素实例。</param>
/// <param name="key">用于标识该行为的唯一键。</param>
public OverlayLayerUiPageBehavior(T owner, string key) : base(owner, key)
{
}
/// <summary>
/// 获取当前 UI 行为所属的层级固定为浮层Overlay
/// </summary>
public override UiLayer Layer => UiLayer.Overlay;
/// <summary>
/// 指示该行为是否支持可重入性,始终返回 true。
/// </summary>
public override bool IsReentrant => true;
/// <summary>
/// 指示该行为是否为模态行为,始终返回 false。
/// </summary>
public override bool IsModal => false;
/// <summary>
/// 指示该行为是否会阻塞输入,始终返回 false。
/// </summary>
public override bool BlocksInput => false;
/// <summary>
/// 当浮层被暂停时调用此方法。
/// 浮层在暂停时不中断处理逻辑(如动画等),仅触发业务层的 OnPause 方法。
/// </summary>
public override void OnPause()
{
// 浮层不暂停处理,保持动画和交互
// 只调用业务层的 OnPause
if (Owner is IUiPage page)
page.OnPause();
}
}