From 3898c2fc423fb791fc7518dbcd04f072ab8ccd08 Mon Sep 17 00:00:00 2001 From: ManicSteiner Date: Mon, 5 Aug 2024 22:27:09 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E9=80=82=E9=85=8D=E7=BC=96=E7=BB=84?= =?UTF-8?q?=E3=80=81=E5=B9=B2=E5=91=98=E8=AF=86=E5=88=AB=E3=80=81=E5=85=AC?= =?UTF-8?q?=E6=8B=9B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/MaaWpfGui/Main/AsstProxy.cs | 8 +++++--- .../ViewModels/UI/RecognizerViewModel.cs | 15 ++++++++++++--- 2 files changed, 17 insertions(+), 6 deletions(-) diff --git a/src/MaaWpfGui/Main/AsstProxy.cs b/src/MaaWpfGui/Main/AsstProxy.cs index 55e7c68e75..e1775958bb 100644 --- a/src/MaaWpfGui/Main/AsstProxy.cs +++ b/src/MaaWpfGui/Main/AsstProxy.cs @@ -971,7 +971,8 @@ namespace MaaWpfGui.Main var missingOpers = details["details"]?["opers"]?.ToObject>>(); if (missingOpers is not null) { - var missingOpersStr = "[" + string.Join("]; [", missingOpers.Select(opers => string.Join(", ", opers))) + "]"; + var missingOpersStr = "[" + string.Join("]; [", missingOpers.Select(opers => + string.Join(", ", opers.Select(oper => DataHelper.GetLocalizedCharacterName(oper))))) + "]"; Instances.CopilotViewModel.AddLog(LocalizationHelper.GetString("MissingOperators") + missingOpersStr, UiLogColor.Error); } else @@ -1393,11 +1394,12 @@ namespace MaaWpfGui.Main } case "BattleFormation": - Instances.CopilotViewModel.AddLog(LocalizationHelper.GetString("BattleFormation") + "\n" + JsonConvert.SerializeObject(subTaskDetails!["formation"])); + Instances.CopilotViewModel.AddLog(LocalizationHelper.GetString("BattleFormation") + "\n[" + + string.Join(", ", subTaskDetails!["formation"]?.ToObject>().Select(oper => DataHelper.GetLocalizedCharacterName(oper))) + "]"); break; case "BattleFormationSelected": - Instances.CopilotViewModel.AddLog(LocalizationHelper.GetString("BattleFormationSelected") + subTaskDetails!["selected"]); + Instances.CopilotViewModel.AddLog(LocalizationHelper.GetString("BattleFormationSelected") + DataHelper.GetLocalizedCharacterName(subTaskDetails!["selected"]?.ToString())); break; case "CopilotAction": diff --git a/src/MaaWpfGui/ViewModels/UI/RecognizerViewModel.cs b/src/MaaWpfGui/ViewModels/UI/RecognizerViewModel.cs index ab51a3f6b0..0b4f0cdefa 100644 --- a/src/MaaWpfGui/ViewModels/UI/RecognizerViewModel.cs +++ b/src/MaaWpfGui/ViewModels/UI/RecognizerViewModel.cs @@ -316,8 +316,8 @@ namespace MaaWpfGui.ViewModels.UI foreach (var oper in (JArray?)combs["opers"] ?? []) { int operLevel = (int)oper["level"]; - string operId = oper["id"]?.ToString(); - string operName = oper["name"]?.ToString(); + var operId = oper["id"]?.ToString(); + var operName = DataHelper.GetLocalizedCharacterName(oper["name"]?.ToString()); string potential = string.Empty; @@ -617,7 +617,16 @@ namespace MaaWpfGui.ViewModels.UI List> operHave = []; List> operNotHave = []; - string localizedName = ConfigurationHelper.GetValue(ConfigurationKeys.Localization, string.Empty) switch + string localizedName = ConfigurationHelper.GetValue(ConfigurationKeys.OperNameLanguage, string.Empty) == "OperNameLanguageClient" ? + ConfigurationHelper.GetValue(ConfigurationKeys.ClientType, string.Empty) switch + { + "Official" => "name", + "Bilibili" => "name", + "YoStarJP" => "name_jp", + "YoStarKR" => "name_kr", + "txwy" => "name_tw", + _ => "name_en", + } : ConfigurationHelper.GetValue(ConfigurationKeys.Localization, string.Empty) switch { "zh-cn" => "name", "ja-jp" => "name_jp",