From 70421159e4c1b4f6511e20307941252e29fd15b3 Mon Sep 17 00:00:00 2001 From: GeWuYou <95328647+GeWuYou@users.noreply.github.com> Date: Fri, 30 Jan 2026 22:05:04 +0800 Subject: [PATCH] =?UTF-8?q?refactor(setting):=20=E4=BC=98=E5=8C=96?= =?UTF-8?q?=E8=AE=BE=E7=BD=AE=E5=BA=94=E7=94=A8=E5=99=A8=E6=B3=A8=E5=86=8C?= =?UTF-8?q?=E6=96=B9=E6=B3=95=E7=9A=84=E6=B3=9B=E5=9E=8B=E5=8F=82=E6=95=B0?= =?UTF-8?q?=E7=BA=A6=E6=9D=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 修改 RegisterApplicator 方法的参数类型从 IResetApplyAbleSettings 为具体泛型类型 T - 移除抽象层中的方法约束,统一实现层和抽象层的方法签名 - 保持泛型约束 T : class, IResetApplyAbleSettings 不变 - 确保接口和实现类的方法定义一致性 - [release ci] --- GFramework.Game.Abstractions/setting/ISettingsModel.cs | 3 +-- GFramework.Game/setting/SettingsModel.cs | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/GFramework.Game.Abstractions/setting/ISettingsModel.cs b/GFramework.Game.Abstractions/setting/ISettingsModel.cs index 3349e62..d27221a 100644 --- a/GFramework.Game.Abstractions/setting/ISettingsModel.cs +++ b/GFramework.Game.Abstractions/setting/ISettingsModel.cs @@ -38,8 +38,7 @@ public interface ISettingsModel : IModel /// 设置数据类型,必须实现IResetApplyAbleSettings接口且具有无参构造函数 /// 要注册的设置应用器 /// 当前设置模型实例,支持链式调用 - ISettingsModel RegisterApplicator(IResetApplyAbleSettings applicator) - where T : class, IResetApplyAbleSettings; + ISettingsModel RegisterApplicator(T applicator) where T : class, IResetApplyAbleSettings; /// diff --git a/GFramework.Game/setting/SettingsModel.cs b/GFramework.Game/setting/SettingsModel.cs index 1edcdd8..6490f06 100644 --- a/GFramework.Game/setting/SettingsModel.cs +++ b/GFramework.Game/setting/SettingsModel.cs @@ -62,7 +62,7 @@ public class SettingsModel : AbstractModel, ISettingsModel /// /// 注册设置应用器 /// - public ISettingsModel RegisterApplicator(IResetApplyAbleSettings applicator) + public ISettingsModel RegisterApplicator(T applicator) where T : class, IResetApplyAbleSettings { _applicators[typeof(T)] = applicator;