From 9deafac23481849dc0132af865d4bd664bf6853b Mon Sep 17 00:00:00 2001 From: gewuyou <95328647+GeWuYou@users.noreply.github.com> Date: Mon, 27 Apr 2026 07:59:27 +0800 Subject: [PATCH] =?UTF-8?q?fix(game):=20=E6=B8=85=E7=90=86=E8=B7=AF?= =?UTF-8?q?=E7=94=B1=E4=B8=8E=20UI=20=E4=BA=A4=E4=BA=92=E9=85=8D=E7=BD=AE?= =?UTF-8?q?=E7=9A=84=20analyzer=20warning?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 修复 RouterBase 中路由键比较的 MA0006,显式使用 Ordinal 字符串比较 - 修复 UiInteractionProfiles 中位掩码判定的 MA0099,改为与显式枚举值比较 --- GFramework.Game/Routing/RouterBase.cs | 4 ++-- GFramework.Game/UI/UiInteractionProfiles.cs | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/GFramework.Game/Routing/RouterBase.cs b/GFramework.Game/Routing/RouterBase.cs index 3fe43f54..efc2799a 100644 --- a/GFramework.Game/Routing/RouterBase.cs +++ b/GFramework.Game/Routing/RouterBase.cs @@ -218,7 +218,7 @@ public abstract class RouterBase : AbstractSystem /// 如果栈中包含指定路由返回 true,否则返回 false public bool Contains(string routeKey) { - return Stack.Any(r => r.Key == routeKey); + return Stack.Any(r => string.Equals(r.Key, routeKey, StringComparison.Ordinal)); } /// @@ -237,7 +237,7 @@ public abstract class RouterBase : AbstractSystem /// 如果栈顶是指定路由返回 true,否则返回 false public bool IsTop(string routeKey) { - return Stack.Count != 0 && Stack.Peek().Key.Equals(routeKey); + return Stack.Count != 0 && string.Equals(Stack.Peek().Key, routeKey, StringComparison.Ordinal); } #endregion diff --git a/GFramework.Game/UI/UiInteractionProfiles.cs b/GFramework.Game/UI/UiInteractionProfiles.cs index 224de6b6..1c30ec87 100644 --- a/GFramework.Game/UI/UiInteractionProfiles.cs +++ b/GFramework.Game/UI/UiInteractionProfiles.cs @@ -51,8 +51,8 @@ public static class UiInteractionProfiles { return action switch { - UiInputAction.Cancel => (profile.CapturedActions & UiInputActionMask.Cancel) != 0, - UiInputAction.Confirm => (profile.CapturedActions & UiInputActionMask.Confirm) != 0, + UiInputAction.Cancel => (profile.CapturedActions & UiInputActionMask.Cancel) != UiInputActionMask.None, + UiInputAction.Confirm => (profile.CapturedActions & UiInputActionMask.Confirm) != UiInputActionMask.None, _ => false }; }