diff --git a/.github/workflows/publish-docs.yml b/.github/workflows/publish-docs.yml index b956ba2..43a3cf7 100644 --- a/.github/workflows/publish-docs.yml +++ b/.github/workflows/publish-docs.yml @@ -1,5 +1,6 @@ # 工作流名称:Publish Docs # 该工作流用于在推送到 main 分支时自动构建并发布文档到 GitHub Pages。 +# 暂时关了,目前这个文档生成有问题,以后再改 name: Publish Docs @@ -7,13 +8,13 @@ name: Publish Docs # 定义工作流的触发规则。当代码仓库发生特定事件时,将自动执行相关操作。 # 此处配置表示:当向仓库推送(push)带有标签(tag)的提交时触发工作流。 # 标签匹配规则为通配符 '*',即任意标签都会触发。 -on: - push: - branches: - - '**' - tags: - - '*' - workflow_dispatch: +#on: +# push: +# branches: +# - '**' +# tags: +# - '*' +# workflow_dispatch: # 权限配置:指定工作流所需的权限。 # actions: read - 允许读取 GitHub Actions 相关信息。 diff --git a/GFramework.Game.Abstractions/ui/IUiRouter.cs b/GFramework.Game.Abstractions/ui/IUiRouter.cs index cc6c2e9..c8a07db 100644 --- a/GFramework.Game.Abstractions/ui/IUiRouter.cs +++ b/GFramework.Game.Abstractions/ui/IUiRouter.cs @@ -143,12 +143,29 @@ public interface IUiRouter : ISystem /// /// 在指定层级显示UI(Overlay / Modal / Toast等) /// + /// 要显示的UI页面的唯一标识符 + /// UI显示的层级,例如 Overlay、Modal 或 Toast + /// 可选参数,用于传递给UI页面的初始化数据 + /// UI实例策略,默认为复用已存在的实例 void Show( string uiKey, UiLayer layer, IUiPageEnterParam? param = null, UiInstancePolicy instancePolicy = UiInstancePolicy.Reuse); + /// + /// 在指定层级显示UI(Overlay / Modal / Toast等) + /// + /// 要显示的UI页面行为对象 + /// UI显示的层级,例如 Overlay、Modal 或 Toast + /// 传递给UI页面的初始化数据 + /// 是否立即进入UI页面,默认为 false + void Show( + IUiPageBehavior page, + UiLayer layer, + IUiPageEnterParam? param, + bool enter = false); + /// /// 在指定层级显示UI(基于已存在实例) /// diff --git a/GFramework.Game/ui/UiRouterBase.cs b/GFramework.Game/ui/UiRouterBase.cs index f480281..ee6ce1d 100644 --- a/GFramework.Game/ui/UiRouterBase.cs +++ b/GFramework.Game/ui/UiRouterBase.cs @@ -534,6 +534,34 @@ public abstract class UiRouterBase : AbstractSystem, IUiRouter Log.Debug("Show existing UI instance in layer: {0}, layer={1}", uiKey, layer); } + /// + /// 在指定层级显示UI(基于实例) + /// + public void Show( + IUiPageBehavior page, + UiLayer layer, + IUiPageEnterParam? param, + bool enter = false) + { + if (layer == UiLayer.Page) + throw new ArgumentException("Use Push() for Page layer"); + + var uiKey = page.Key; + + if (!_layers.ContainsKey(layer)) + _layers[layer] = new Dictionary(); + + _layers[layer][uiKey] = page; + _uiRoot.AddUiPage(page, layer); + + if (enter) + page.OnEnter(param); + + page.OnShow(); + + Log.Debug("Show existing UI instance in layer: {0}, layer={1}", uiKey, layer); + } + /// /// 隐藏指定层级的UI ///