From 0fcda2167c2e6ab0aac8339dc8cab925bb0fd7ca Mon Sep 17 00:00:00 2001 From: uye <99072975+ABA2396@users.noreply.github.com> Date: Tue, 11 Jun 2024 01:09:03 +0800 Subject: [PATCH] =?UTF-8?q?perf:=20=E4=BC=98=E5=8C=96=E5=85=B3=E5=8D=A1?= =?UTF-8?q?=E9=80=89=E6=8B=A9=E4=B8=BA=E5=89=BF=E7=81=AD=E6=97=B6=E7=9A=84?= =?UTF-8?q?=E9=80=BB=E8=BE=91=E5=88=A4=E6=96=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit fix #9327 --- src/MaaWpfGui/Main/AsstProxy.cs | 20 ++++++++++++++----- src/MaaWpfGui/Res/Localizations/en-us.xaml | 3 ++- src/MaaWpfGui/Res/Localizations/ja-jp.xaml | 1 + src/MaaWpfGui/Res/Localizations/ko-kr.xaml | 1 + src/MaaWpfGui/Res/Localizations/zh-cn.xaml | 3 ++- src/MaaWpfGui/Res/Localizations/zh-tw.xaml | 3 ++- .../ViewModels/UI/TaskQueueViewModel.cs | 3 ++- 7 files changed, 25 insertions(+), 9 deletions(-) diff --git a/src/MaaWpfGui/Main/AsstProxy.cs b/src/MaaWpfGui/Main/AsstProxy.cs index b68cd9305f..1297bdff41 100644 --- a/src/MaaWpfGui/Main/AsstProxy.cs +++ b/src/MaaWpfGui/Main/AsstProxy.cs @@ -36,6 +36,7 @@ using Newtonsoft.Json; using Newtonsoft.Json.Linq; using Serilog; using Stylet; +using static System.Windows.Forms.AxHost; using static MaaWpfGui.Helper.Instances.Data; using AsstHandle = System.IntPtr; using AsstInstanceOptionKey = System.Int32; @@ -611,6 +612,20 @@ namespace MaaWpfGui.Main case AsstMsg.TaskChainError: { + // 对剿灭的特殊处理,如果刷完了剿灭还选了剿灭会因为找不到入口报错 + if (taskChain == "Fight" && (Instances.TaskQueueViewModel.Stage == "Annihilation")) + { + if (new[] + { + Instances.TaskQueueViewModel.Stage1, + Instances.TaskQueueViewModel.Stage2, + Instances.TaskQueueViewModel.Stage3 + }.Any(stage => Instances.TaskQueueViewModel.IsStageOpen(stage) && (stage != "Annihilation"))) + { + Instances.TaskQueueViewModel.AddLog(LocalizationHelper.GetString("AnnihilationTaskFailed"), UiLogColor.Warning); + } + } + Instances.TaskQueueViewModel.AddLog(LocalizationHelper.GetString("TaskError") + taskChain, UiLogColor.Error); using var toast = new ToastNotification(LocalizationHelper.GetString("TaskError") + taskChain); toast.Show(); @@ -629,11 +644,6 @@ namespace MaaWpfGui.Main Instances.CopilotViewModel.AddLog(LocalizationHelper.GetString("CombatError"), UiLogColor.Error); } - if (taskChain == "Fight" && (Instances.TaskQueueViewModel.Stage == "Annihilation")) - { - Instances.TaskQueueViewModel.AddLog(LocalizationHelper.GetString("AnnihilationTaskFailed"), UiLogColor.Warning); - } - break; } diff --git a/src/MaaWpfGui/Res/Localizations/en-us.xaml b/src/MaaWpfGui/Res/Localizations/en-us.xaml index d34fc54f36..a838e5c388 100644 --- a/src/MaaWpfGui/Res/Localizations/en-us.xaml +++ b/src/MaaWpfGui/Res/Localizations/en-us.xaml @@ -462,7 +462,8 @@ Only supports Official(CN) and Bilibili server. Login account is not supported.< Tip Task(s) completed, about to hibernate Unknown ending action - Annihilation task failed, will try to use alternate stage, some combat settings will not be effective + The stage selected is an annihilation task. After the task is completed, the remaining alternative stages will be attempted. Some battle settings will not take effect. + Annihilation task failed, will try to use alternate stage, some combat settings will not be effective. Toolbox diff --git a/src/MaaWpfGui/Res/Localizations/ja-jp.xaml b/src/MaaWpfGui/Res/Localizations/ja-jp.xaml index 71a19b8117..4429af933b 100644 --- a/src/MaaWpfGui/Res/Localizations/ja-jp.xaml +++ b/src/MaaWpfGui/Res/Localizations/ja-jp.xaml @@ -463,6 +463,7 @@ ヒント 完了しました。休止状態にしようとしています 未知の終了動作 + ステージ選択は殲滅任務です。任務終了後、残りの代替ステージが試されます。一部の戦闘設定は有効になりません。 殲滅戦に失敗、代替ステージを使用しますが、一部の戦闘設定が有効ではありません diff --git a/src/MaaWpfGui/Res/Localizations/ko-kr.xaml b/src/MaaWpfGui/Res/Localizations/ko-kr.xaml index 2167969d78..306f89da13 100644 --- a/src/MaaWpfGui/Res/Localizations/ko-kr.xaml +++ b/src/MaaWpfGui/Res/Localizations/ko-kr.xaml @@ -463,6 +463,7 @@ OF-1을 해금하지 않았다면 선택하지 말아 주세요. 알림 작업을 완료했습니다. 곧 절전 모드에 진입합니다 알 수 없는 종료 동작 + 선택한 스테이지는 섬멸 임무입니다. 임무 완료 후 남은 대체 스테이지가 시도됩니다. 일부 전투 설정은 적용되지 않습니다. 섬멸 작전에 실패하여 대체 스테이지를 진행합니다. 일부 전투 설정이 무시될 수 있습니다 diff --git a/src/MaaWpfGui/Res/Localizations/zh-cn.xaml b/src/MaaWpfGui/Res/Localizations/zh-cn.xaml index 4e3fb838e1..56fdcf423d 100644 --- a/src/MaaWpfGui/Res/Localizations/zh-cn.xaml +++ b/src/MaaWpfGui/Res/Localizations/zh-cn.xaml @@ -464,7 +464,8 @@ 提示 已刷完,即将休眠 未知的结束动作 - 剿灭任务失败,将尝试使用剩余备选关卡,部分战斗设置将不生效 + 关卡选择为剿灭任务,任务结束后将尝试使用剩余备选关卡,部分战斗设置将不生效。 + 剿灭任务失败,将尝试使用剩余备选关卡,部分战斗设置将不生效。 小工具 diff --git a/src/MaaWpfGui/Res/Localizations/zh-tw.xaml b/src/MaaWpfGui/Res/Localizations/zh-tw.xaml index 48acfdd53a..5726f50046 100644 --- a/src/MaaWpfGui/Res/Localizations/zh-tw.xaml +++ b/src/MaaWpfGui/Res/Localizations/zh-tw.xaml @@ -460,7 +460,8 @@ 提示 已刷完,即將休眠 未知的結束動作 - 剿滅任務失敗,將嘗試使用剩餘備選關卡,部分戰鬥設定將不生效 + 關卡選擇為剿滅任務,任務結束後將嘗試使用剩餘備選關卡,部分戰鬥設置將不生效。 + 剿滅任務失敗,將嘗試使用剩餘備選關卡,部分戰鬥設定將不生效。 小工具 diff --git a/src/MaaWpfGui/ViewModels/UI/TaskQueueViewModel.cs b/src/MaaWpfGui/ViewModels/UI/TaskQueueViewModel.cs index 07510adf39..6b56d619a3 100644 --- a/src/MaaWpfGui/ViewModels/UI/TaskQueueViewModel.cs +++ b/src/MaaWpfGui/ViewModels/UI/TaskQueueViewModel.cs @@ -476,7 +476,7 @@ namespace MaaWpfGui.ViewModels.UI /// /// stage name /// Whether the specified stage is open - private bool IsStageOpen(string name) + public bool IsStageOpen(string name) { return _stageManager.IsStageOpen(name, _curDayOfWeek); } @@ -1222,6 +1222,7 @@ namespace MaaWpfGui.ViewModels.UI continue; } + AddLog(LocalizationHelper.GetString("AnnihilationTaskTip"), UiLogColor.Info); mainFightRet = Instances.AsstProxy.AsstAppendFight(stage, medicine, 0, int.MaxValue, series, string.Empty, 0); break; }