GFramework/GFramework.Game/ui/handler/UiTransitionHandlerBase.cs
GeWuYou 8fd7e2e952 feat(ui): 添加UI页面生命周期和路由管理相关接口及实现
- 定义了IPageBehavior接口,提供UI页面的生命周期方法如OnEnter、OnExit、OnPause、OnResume等
- 创建了IUiFactory接口用于创建UI页面实例,以及IUiPage接口定义页面基本操作
- 添加了IUiPageEnterParam接口用于定义页面跳转参数数据结构
- 实现了IUiRouter接口提供页面栈管理功能,支持Push、Pop、Replace、Clear等操作
- 创建了UI切换处理器相关接口和实现,包括IUiTransitionHandler和UiTransitionPipeline
- 添加了UI切换事件系统,支持BeforeChange和AfterChange两个执行阶段
- 实现了日志记录处理器LoggingTransitionHandler用于记录UI切换信息
- 定义了多种UI切换策略枚举如UiTransitionPolicy、UiTransitionType等
- 提供了UI注册表接口用于管理UI实例的注册和获取功能
2026-01-15 08:44:56 +08:00

33 lines
994 B
C#
Raw 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.

using GFramework.Game.Abstractions.enums;
using GFramework.Game.Abstractions.ui;
namespace GFramework.Game.ui.handler;
/// <summary>
/// UI切换处理器抽象基类提供一些默认实现
/// </summary>
public abstract class UiTransitionHandlerBase : IUiTransitionHandler
{
/// <summary>
/// 处理器适用的阶段,默认为所有阶段
/// </summary>
public virtual UITransitionPhases Phases => UITransitionPhases.All;
/// <summary>
/// 优先级,需要在子类中实现
/// </summary>
public abstract int Priority { get; }
/// <summary>
/// 判断是否应该处理当前事件默认返回true
/// </summary>
public virtual bool ShouldHandle(UiTransitionEvent @event, UITransitionPhases phases)
{
return true;
}
/// <summary>
/// 处理UI切换事件需要在子类中实现
/// </summary>
public abstract Task HandleAsync(UiTransitionEvent @event, CancellationToken cancellationToken);
}