fix(wpf): 自动战斗在开启战斗列表时导入作业后,关闭战斗列表开始任务时作业使用错误

This commit is contained in:
status102
2025-03-20 15:32:48 +08:00
parent a82fbe2193
commit d4cfdd0153

View File

@@ -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,