From ee3a087e353ea4fa8b054d12c6664a98f783770f Mon Sep 17 00:00:00 2001
From: GeWuYou <95328647+GeWuYou@users.noreply.github.com>
Date: Thu, 15 Jan 2026 21:33:51 +0800
Subject: [PATCH] =?UTF-8?q?refactor(ui):=20=E9=87=8D=E5=91=BD=E5=90=8D?=
=?UTF-8?q?=E9=A1=B5=E9=9D=A2=E8=A1=8C=E4=B8=BA=E6=8E=A5=E5=8F=A3=E5=B9=B6?=
=?UTF-8?q?=E6=9B=B4=E6=96=B0=E4=BE=9D=E8=B5=96=E5=8C=85=E7=89=88=E6=9C=AC?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
- 将 IPageBehavior 接口重命名为 IUiPageBehavior 并更新相关引用
- 将 CanvasItemPageBehavior 类重命名为 CanvasItemUiPageBehavior
- 更新 Newtonsoft.Json 从 13.0.3 到 13.0.4
- 更新 NUnit3TestAdapter 从 6.0.1 到 6.1.0
- 更新 Microsoft.CodeAnalysis.CSharp.SourceGenerators.Testing 从 1.1.2 到 1.3
- 为多个项目添加 Meziantou.Analyzer 和 Meziantou.Polyfill 包引用
---
.../GFramework.Core.Abstractions.csproj | 10 ++++++++++
GFramework.Core.Tests/GFramework.Core.Tests.csproj | 2 +-
.../GFramework.Game.Abstractions.csproj | 10 ++++++++++
GFramework.Game.Abstractions/ui/IUiFactory.cs | 2 +-
.../ui/{IPageBehavior.cs => IUiPageBehavior.cs} | 4 ++--
.../ui/IUiPageBehaviorProvider.cs | 2 +-
GFramework.Game.Abstractions/ui/IUiRoot.cs | 4 ++--
GFramework.Game/GFramework.Game.csproj | 2 +-
GFramework.Game/ui/UiRouterBase.cs | 2 +-
...ramework.Godot.SourceGenerators.Abstractions.csproj | 10 ++++++++++
...ItemPageBehavior.cs => CanvasItemUiPageBehavior.cs} | 2 +-
GFramework.Godot/ui/GodotUiFactory.cs | 2 +-
.../GFramework.SourceGenerators.Abstractions.csproj | 10 ++++++++++
.../GFramework.SourceGenerators.Common.csproj | 8 ++++++++
.../GFramework.SourceGenerators.Tests.csproj | 4 ++--
15 files changed, 61 insertions(+), 13 deletions(-)
rename GFramework.Game.Abstractions/ui/{IPageBehavior.cs => IUiPageBehavior.cs} (90%)
rename GFramework.Godot/ui/{CanvasItemPageBehavior.cs => CanvasItemUiPageBehavior.cs} (96%)
diff --git a/GFramework.Core.Abstractions/GFramework.Core.Abstractions.csproj b/GFramework.Core.Abstractions/GFramework.Core.Abstractions.csproj
index 7c51016..1330021 100644
--- a/GFramework.Core.Abstractions/GFramework.Core.Abstractions.csproj
+++ b/GFramework.Core.Abstractions/GFramework.Core.Abstractions.csproj
@@ -15,4 +15,14 @@
+
+
+ all
+ runtime; build; native; contentfiles; analyzers
+
+
+ all
+ runtime; build; native; contentfiles; analyzers
+
+
diff --git a/GFramework.Core.Tests/GFramework.Core.Tests.csproj b/GFramework.Core.Tests/GFramework.Core.Tests.csproj
index 2392396..e505aab 100644
--- a/GFramework.Core.Tests/GFramework.Core.Tests.csproj
+++ b/GFramework.Core.Tests/GFramework.Core.Tests.csproj
@@ -8,7 +8,7 @@
-
+
diff --git a/GFramework.Game.Abstractions/GFramework.Game.Abstractions.csproj b/GFramework.Game.Abstractions/GFramework.Game.Abstractions.csproj
index bfa355a..75e2628 100644
--- a/GFramework.Game.Abstractions/GFramework.Game.Abstractions.csproj
+++ b/GFramework.Game.Abstractions/GFramework.Game.Abstractions.csproj
@@ -17,4 +17,14 @@
+
+
+ all
+ runtime; build; native; contentfiles; analyzers
+
+
+ all
+ runtime; build; native; contentfiles; analyzers
+
+
diff --git a/GFramework.Game.Abstractions/ui/IUiFactory.cs b/GFramework.Game.Abstractions/ui/IUiFactory.cs
index fc8a715..56f78e1 100644
--- a/GFramework.Game.Abstractions/ui/IUiFactory.cs
+++ b/GFramework.Game.Abstractions/ui/IUiFactory.cs
@@ -12,5 +12,5 @@ public interface IUiFactory : IContextUtility
///
/// UI标识键,用于确定要创建的具体UI页面类型
/// 创建的UI页面实例,实现IUiPage接口
- IPageBehavior Create(string uiKey);
+ IUiPageBehavior Create(string uiKey);
}
\ No newline at end of file
diff --git a/GFramework.Game.Abstractions/ui/IPageBehavior.cs b/GFramework.Game.Abstractions/ui/IUiPageBehavior.cs
similarity index 90%
rename from GFramework.Game.Abstractions/ui/IPageBehavior.cs
rename to GFramework.Game.Abstractions/ui/IUiPageBehavior.cs
index 7307cd6..76c9c2a 100644
--- a/GFramework.Game.Abstractions/ui/IPageBehavior.cs
+++ b/GFramework.Game.Abstractions/ui/IUiPageBehavior.cs
@@ -1,9 +1,9 @@
namespace GFramework.Game.Abstractions.ui;
///
-/// UI页面接口,定义了UI页面的生命周期方法
+/// UI页面行为接口,定义了UI页面的生命周期方法和状态管理
///
-public interface IPageBehavior
+public interface IUiPageBehavior
{
///
/// 获取页面视图对象
diff --git a/GFramework.Game.Abstractions/ui/IUiPageBehaviorProvider.cs b/GFramework.Game.Abstractions/ui/IUiPageBehaviorProvider.cs
index 28b77b8..8bb5c15 100644
--- a/GFramework.Game.Abstractions/ui/IUiPageBehaviorProvider.cs
+++ b/GFramework.Game.Abstractions/ui/IUiPageBehaviorProvider.cs
@@ -9,5 +9,5 @@ public interface IUiPageBehaviorProvider
/// 获取页面行为实例
///
/// 页面行为接口实例
- IPageBehavior GetPage();
+ IUiPageBehavior GetPage();
}
\ No newline at end of file
diff --git a/GFramework.Game.Abstractions/ui/IUiRoot.cs b/GFramework.Game.Abstractions/ui/IUiRoot.cs
index 6785d72..f3f74cf 100644
--- a/GFramework.Game.Abstractions/ui/IUiRoot.cs
+++ b/GFramework.Game.Abstractions/ui/IUiRoot.cs
@@ -9,11 +9,11 @@ public interface IUiRoot
/// 向UI根节点添加子页面
///
/// 要添加的UI页面子节点
- void AddUiPage(IPageBehavior child);
+ void AddUiPage(IUiPageBehavior child);
///
/// 从UI根节点移除子页面
///
/// 要移除的UI页面子节点
- void RemoveUiPage(IPageBehavior child);
+ void RemoveUiPage(IUiPageBehavior child);
}
\ No newline at end of file
diff --git a/GFramework.Game/GFramework.Game.csproj b/GFramework.Game/GFramework.Game.csproj
index 13983d2..b81965b 100644
--- a/GFramework.Game/GFramework.Game.csproj
+++ b/GFramework.Game/GFramework.Game.csproj
@@ -11,6 +11,6 @@
-
+
diff --git a/GFramework.Game/ui/UiRouterBase.cs b/GFramework.Game/ui/UiRouterBase.cs
index cb7678f..99e8cc4 100644
--- a/GFramework.Game/ui/UiRouterBase.cs
+++ b/GFramework.Game/ui/UiRouterBase.cs
@@ -22,7 +22,7 @@ public abstract class UiRouterBase : AbstractSystem, IUiRouter
///
/// 页面栈,用于管理UI页面的显示顺序
///
- private readonly Stack _stack = new();
+ private readonly Stack _stack = new();
///
/// UI工厂实例,用于创建UI相关的对象
diff --git a/GFramework.Godot.SourceGenerators.Abstractions/GFramework.Godot.SourceGenerators.Abstractions.csproj b/GFramework.Godot.SourceGenerators.Abstractions/GFramework.Godot.SourceGenerators.Abstractions.csproj
index 477e9bc..2e67264 100644
--- a/GFramework.Godot.SourceGenerators.Abstractions/GFramework.Godot.SourceGenerators.Abstractions.csproj
+++ b/GFramework.Godot.SourceGenerators.Abstractions/GFramework.Godot.SourceGenerators.Abstractions.csproj
@@ -18,4 +18,14 @@
+
+
+ all
+ runtime; build; native; contentfiles; analyzers
+
+
+ all
+ runtime; build; native; contentfiles; analyzers
+
+
diff --git a/GFramework.Godot/ui/CanvasItemPageBehavior.cs b/GFramework.Godot/ui/CanvasItemUiPageBehavior.cs
similarity index 96%
rename from GFramework.Godot/ui/CanvasItemPageBehavior.cs
rename to GFramework.Godot/ui/CanvasItemUiPageBehavior.cs
index bf2fa4c..94da6db 100644
--- a/GFramework.Godot/ui/CanvasItemPageBehavior.cs
+++ b/GFramework.Godot/ui/CanvasItemUiPageBehavior.cs
@@ -9,7 +9,7 @@ namespace GFramework.Godot.ui;
/// 支持所有继承自 CanvasItem 的节点
///
/// CanvasItem 类型的视图节点
-public class CanvasItemPageBehavior(T owner) : IPageBehavior
+public class CanvasItemUiPageBehavior(T owner) : IUiPageBehavior
where T : CanvasItem
{
private readonly IUiPage? _page = owner as IUiPage;
diff --git a/GFramework.Godot/ui/GodotUiFactory.cs b/GFramework.Godot/ui/GodotUiFactory.cs
index 35f160c..c763bb8 100644
--- a/GFramework.Godot/ui/GodotUiFactory.cs
+++ b/GFramework.Godot/ui/GodotUiFactory.cs
@@ -22,7 +22,7 @@ public class GodotUiFactory : AbstractContextUtility, IUiFactory
/// UI资源的唯一标识键
/// 实现IUiPage接口的UI页面实例
/// 当UI场景没有继承IUiPage接口时抛出
- public IPageBehavior Create(string uiKey)
+ public IUiPageBehavior Create(string uiKey)
{
// 从注册表中获取对应的场景资源
var scene = _registry.Get(uiKey);
diff --git a/GFramework.SourceGenerators.Abstractions/GFramework.SourceGenerators.Abstractions.csproj b/GFramework.SourceGenerators.Abstractions/GFramework.SourceGenerators.Abstractions.csproj
index fe720ee..7fe590d 100644
--- a/GFramework.SourceGenerators.Abstractions/GFramework.SourceGenerators.Abstractions.csproj
+++ b/GFramework.SourceGenerators.Abstractions/GFramework.SourceGenerators.Abstractions.csproj
@@ -17,4 +17,14 @@
+
+
+ all
+ runtime; build; native; contentfiles; analyzers
+
+
+ all
+ runtime; build; native; contentfiles; analyzers
+
+
diff --git a/GFramework.SourceGenerators.Common/GFramework.SourceGenerators.Common.csproj b/GFramework.SourceGenerators.Common/GFramework.SourceGenerators.Common.csproj
index eb20b60..32e6407 100644
--- a/GFramework.SourceGenerators.Common/GFramework.SourceGenerators.Common.csproj
+++ b/GFramework.SourceGenerators.Common/GFramework.SourceGenerators.Common.csproj
@@ -22,6 +22,14 @@
runtime; build; native; contentfiles; analyzers
+
+ all
+ runtime; build; native; contentfiles; analyzers
+
+
+ all
+ runtime; build; native; contentfiles; analyzers
+
diff --git a/GFramework.SourceGenerators.Tests/GFramework.SourceGenerators.Tests.csproj b/GFramework.SourceGenerators.Tests/GFramework.SourceGenerators.Tests.csproj
index 3679072..e60f46a 100644
--- a/GFramework.SourceGenerators.Tests/GFramework.SourceGenerators.Tests.csproj
+++ b/GFramework.SourceGenerators.Tests/GFramework.SourceGenerators.Tests.csproj
@@ -12,10 +12,10 @@
-
+
-
+