From e761191613ac8bb9e6ba2bd2063e211df00e1fbf Mon Sep 17 00:00:00 2001 From: uye <99072975+ABA2396@users.noreply.github.com> Date: Thu, 28 Nov 2024 21:39:18 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E5=B9=B2=E5=91=98=E8=AF=86=E5=88=AB?= =?UTF-8?q?=E4=B8=AD=E5=87=BA=E7=8E=B0=E5=8D=AB=E6=88=8D=E4=B8=AD=E7=9A=84?= =?UTF-8?q?=204=E2=98=85=20=E9=A2=84=E5=A4=87=E5=B9=B2=E5=91=98=20?= =?UTF-8?q?=E5=8F=8A=20=E7=89=B9=E6=9C=89=206=E2=98=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit fix #11253 --- MAA.sln.DotSettings | 15 +++++ .../ViewModels/UI/RecognizerViewModel.cs | 58 ++++++++++++------- 2 files changed, 53 insertions(+), 20 deletions(-) diff --git a/MAA.sln.DotSettings b/MAA.sln.DotSettings index 56c2856ace..5f8667cf66 100644 --- a/MAA.sln.DotSettings +++ b/MAA.sln.DotSettings @@ -31,6 +31,11 @@ WSA XYAZ True + True + True + True + True + True True True True @@ -46,7 +51,15 @@ True True True + True + True + True + True True + True + True + True + True True True True @@ -106,6 +119,7 @@ True True True + True True True True @@ -123,6 +137,7 @@ True True True + True True True True diff --git a/src/MaaWpfGui/ViewModels/UI/RecognizerViewModel.cs b/src/MaaWpfGui/ViewModels/UI/RecognizerViewModel.cs index 2ca7d88ca1..f9c4de1f1f 100644 --- a/src/MaaWpfGui/ViewModels/UI/RecognizerViewModel.cs +++ b/src/MaaWpfGui/ViewModels/UI/RecognizerViewModel.cs @@ -455,18 +455,34 @@ namespace MaaWpfGui.ViewModels.UI /// private static readonly HashSet _virtuallyOpers = [ - "char_504_rguard", - "char_505_rcast", - "char_506_rmedic", - "char_507_rsnipe", - "char_514_rdfend", - "char_513_apionr", - "char_511_asnipe", - "char_510_amedic", - "char_509_acast", - "char_508_aguard", - "char_1001_amiya2", - "char_1037_amiya3" + "char_504_rguard", // 预备干员-近战 + "char_505_rcast", // 预备干员-术师 + "char_506_rmedic", // 预备干员-后勤 + "char_507_rsnipe", // 预备干员-狙击 + "char_508_aguard", // Sharp + "char_509_acast", // Pith + "char_510_amedic", // Touch + "char_511_asnipe", // Stormeye + "char_513_apionr", // 郁金香 + "char_514_rdfend", // 预备干员-重装 + + // 因为 core 是通过名字来判断的,所以下面干员中如果有和上面重名的不会用到,不过也加上了 + "char_600_cpione", // 预备干员-先锋 4★ + "char_601_cguard", // 预备干员-近卫 4★ + "char_602_cdfend", // 预备干员-重装 4★ + "char_603_csnipe", // 预备干员-狙击 4★ + "char_604_ccast", // 预备干员-术师 4★ + "char_605_cmedic", // 预备干员-医疗 4★ + "char_606_csuppo", // 预备干员-辅助 4★ + "char_607_cspec", // 预备干员-特种 4★ + "char_608_acpion", // 郁金香 6★ + "char_609_acguad", // Sharp 6★ + "char_610_acfend", // Mechanist + "char_614_acsupo", // Raidian + "char_615_acspec", // Misery + + "char_1001_amiya2", // 阿米娅-WARRIOR + "char_1037_amiya3", // 阿米娅-MEDIC ]; private string _operBoxInfo = LocalizationHelper.GetString("OperBoxRecognitionTip"); @@ -549,12 +565,13 @@ namespace MaaWpfGui.ViewModels.UI return false; } - List> operHave = []; - List> operNotHave = []; - + List<(string Name, int Rarity)> operHave = []; + List<(string Name, int Rarity)> operNotHave = []; + (string Name, int Rarity) tuple = ("???", -1); foreach (JObject operBox in operBoxes.Cast()) { - var tuple = new Tuple(DataHelper.GetLocalizedCharacterName((string?)operBox["name"]) ?? "???", (int)(operBox["rarity"] ?? -1)); + tuple.Name = DataHelper.GetLocalizedCharacterName((string?)operBox["name"]) ?? "???"; + tuple.Rarity = (int)(operBox["rarity"] ?? -1); if (_virtuallyOpers.Contains((string?)operBox["id"])) { @@ -573,11 +590,11 @@ namespace MaaWpfGui.ViewModels.UI } } - operHave.Sort((x, y) => y.Item2.CompareTo(x.Item2)); - operNotHave.Sort((x, y) => y.Item2.CompareTo(x.Item2)); + operHave.Sort((x, y) => y.Rarity.CompareTo(x.Rarity)); + operNotHave.Sort((x, y) => y.Rarity.CompareTo(x.Rarity)); - OperBoxHaveList = new ObservableCollection(operHave.Select(tuple => tuple.Item1)); - OperBoxNotHaveList = new ObservableCollection(operNotHave.Select(tuple => tuple.Item1)); + OperBoxHaveList = new(operHave.Select(valueTuple => valueTuple.Name)); + OperBoxNotHaveList = new(operNotHave.Select(valueTuple => valueTuple.Name)); bool done = (bool)(details?["done"] ?? false); if (!done) @@ -588,6 +605,7 @@ namespace MaaWpfGui.ViewModels.UI OperBoxInfo = LocalizationHelper.GetString("IdentificationCompleted") + "\n" + LocalizationHelper.GetString("OperBoxRecognitionTip"); OperBoxExportData = details?["own_opers"]?.ToString() ?? string.Empty; OperBoxDataArray = (JArray)(details?["own_opers"] ?? new JArray()); + _runningState.SetIdle(true); return true;