From d4cfdd01538c0324caf0acb4187797dc25dfd267 Mon Sep 17 00:00:00 2001 From: status102 <102887808+status102@users.noreply.github.com> Date: Thu, 20 Mar 2025 15:32:48 +0800 Subject: [PATCH] =?UTF-8?q?fix(wpf):=20=E8=87=AA=E5=8A=A8=E6=88=98?= =?UTF-8?q?=E6=96=97=E5=9C=A8=E5=BC=80=E5=90=AF=E6=88=98=E6=96=97=E5=88=97?= =?UTF-8?q?=E8=A1=A8=E6=97=B6=E5=AF=BC=E5=85=A5=E4=BD=9C=E4=B8=9A=E5=90=8E?= =?UTF-8?q?=EF=BC=8C=E5=85=B3=E9=97=AD=E6=88=98=E6=96=97=E5=88=97=E8=A1=A8?= =?UTF-8?q?=E5=BC=80=E5=A7=8B=E4=BB=BB=E5=8A=A1=E6=97=B6=E4=BD=9C=E4=B8=9A?= =?UTF-8?q?=E4=BD=BF=E7=94=A8=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ViewModels/UI/CopilotViewModel.cs | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/src/MaaWpfGui/ViewModels/UI/CopilotViewModel.cs b/src/MaaWpfGui/ViewModels/UI/CopilotViewModel.cs index 62d78bc30c..b8a3efd8e1 100644 --- a/src/MaaWpfGui/ViewModels/UI/CopilotViewModel.cs +++ b/src/MaaWpfGui/ViewModels/UI/CopilotViewModel.cs @@ -1130,6 +1130,12 @@ namespace MaaWpfGui.ViewModels.UI _runningState.SetIdle(true); return; } + else if (_taskType == AsstTaskType.Copilot && !UseCopilotList && _copilotCache is null) + { + AddLog("copilot is empty", UiLogColor.Error, showTime: false); + _runningState.SetIdle(true); + return; + } if (SettingsViewModel.GameSettings.CopilotWithScript) { @@ -1194,6 +1200,20 @@ namespace MaaWpfGui.ViewModels.UI } else { + if (IsDataFromWeb) + { + try + { + await File.WriteAllTextAsync(TempCopilotFile, JsonConvert.SerializeObject(_copilotCache, Formatting.Indented)); + } + catch + { + AddLog("Could not save copilot task to file: " + TempCopilotFile, UiLogColor.Error); + Stop(); + return; + } + } + var task = new AsstCopilotTask() { FileName = IsDataFromWeb ? TempCopilotFile : Filename,