From 3d62daed59ef4e99b200752a7e134b87b9467154 Mon Sep 17 00:00:00 2001 From: status102 <102887808+status102@users.noreply.github.com> Date: Sat, 12 Apr 2025 22:34:15 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E9=9D=9E=E8=87=AA=E5=AE=9A=E4=B9=89?= =?UTF-8?q?=E5=85=B3=E5=8D=A1=E5=90=8D=E6=83=85=E5=86=B5=E4=B8=8B=EF=BC=8C?= =?UTF-8?q?=E6=9C=AA=E8=83=BD=E7=A7=BB=E9=99=A4=E4=B8=8D=E6=98=BE=E7=A4=BA?= =?UTF-8?q?=E7=9A=84=E5=85=B3=E5=8D=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit fix #12331 --- .../ViewModels/UI/TaskQueueViewModel.cs | 6 +++++- .../TaskQueue/FightSettingsUserControlModel.cs | 16 ++++++++++++++++ 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/src/MaaWpfGui/ViewModels/UI/TaskQueueViewModel.cs b/src/MaaWpfGui/ViewModels/UI/TaskQueueViewModel.cs index 42e88e6382..3168c52389 100644 --- a/src/MaaWpfGui/ViewModels/UI/TaskQueueViewModel.cs +++ b/src/MaaWpfGui/ViewModels/UI/TaskQueueViewModel.cs @@ -915,6 +915,10 @@ namespace MaaWpfGui.ViewModels.UI FightTask.Stage2 = stage2; FightTask.Stage3 = stage3; FightTask.RemainingSanityStage = rss; + if (!FightTask.CustomStageCode) + { + FightTask.RemoveNonExistStage(); + } Instances.TaskQueueViewModel.EnableSetFightParams = true; }); @@ -1367,7 +1371,7 @@ namespace MaaWpfGui.ViewModels.UI continue; } - AddLog(item.OriginalName + "Error", UiLogColor.Error); + AddLog($"{LocalizationHelper.GetString(item.OriginalName)} task append error", UiLogColor.Error); taskRet = true; --count; } diff --git a/src/MaaWpfGui/ViewModels/UserControl/TaskQueue/FightSettingsUserControlModel.cs b/src/MaaWpfGui/ViewModels/UserControl/TaskQueue/FightSettingsUserControlModel.cs index 97b3695b78..63b4f39b85 100644 --- a/src/MaaWpfGui/ViewModels/UserControl/TaskQueue/FightSettingsUserControlModel.cs +++ b/src/MaaWpfGui/ViewModels/UserControl/TaskQueue/FightSettingsUserControlModel.cs @@ -229,11 +229,27 @@ public class FightSettingsUserControlModel : TaskViewModel get => _customStageCode; set { + if (!value) + { + RemoveNonExistStage(); + } + SetAndNotify(ref _customStageCode, value); ConfigurationHelper.SetValue(ConfigurationKeys.CustomStageCode, value.ToString()); } } + /// + /// 移除不在关卡列表中的关卡,关闭自定义和刷新关卡列表时调用 + /// + public void RemoveNonExistStage() + { + Stage1 = StageList.Where(x => x.Value == Stage1).FirstOrDefault()?.Value ?? string.Empty; + Stage2 = StageList.Where(x => x.Value == Stage2).FirstOrDefault()?.Value ?? string.Empty; + Stage3 = StageList.Where(x => x.Value == Stage3).FirstOrDefault()?.Value ?? string.Empty; + RemainingSanityStage = RemainingSanityStageList.Where(x => x.Value == RemainingSanityStage).FirstOrDefault()?.Value ?? string.Empty; + } + private string _remainingSanityStage = ConfigurationHelper.GetValue(ConfigurationKeys.RemainingSanityStage, string.Empty) ?? string.Empty; public string RemainingSanityStage