diff --git a/src/MaaWpfGui/ViewModels/UI/CopilotViewModel.cs b/src/MaaWpfGui/ViewModels/UI/CopilotViewModel.cs
index 2037d91d9f..8c3b0c9a43 100644
--- a/src/MaaWpfGui/ViewModels/UI/CopilotViewModel.cs
+++ b/src/MaaWpfGui/ViewModels/UI/CopilotViewModel.cs
@@ -115,7 +115,7 @@ namespace MaaWpfGui.ViewModels.UI
/// The content.
/// The font color.
/// The font weight.
- /// Wether show time.
+ /// Whether show time.
public void AddLog(string content, string color = UiLogColor.Trace, string weight = "Regular", bool showTime = true)
{
Execute.OnUIThread(() =>
@@ -444,24 +444,26 @@ namespace MaaWpfGui.ViewModels.UI
File.Delete(TempCopilotFile);
File.WriteAllText(TempCopilotFile, json.ToString());
- if (_taskType == "Copilot" && UseCopilotList)
+ if (_taskType != "Copilot" || !UseCopilotList)
{
- var value = json["difficulty"];
- var diff = value?.Type == JTokenType.Integer ? (int)value : 0;
- switch (diff)
- {
- case 0:
- case 1:
- AddCopilotTask();
- break;
- case 2:
- AddCopilotTask_Adverse();
- break;
- case 3:
- AddCopilotTask();
- AddCopilotTask_Adverse();
- break;
- }
+ return;
+ }
+
+ var value = json["difficulty"];
+ var diff = value?.Type == JTokenType.Integer ? (int)value : 0;
+ switch (diff)
+ {
+ case 0:
+ case 1:
+ AddCopilotTask();
+ break;
+ case 2:
+ AddCopilotTask_Adverse();
+ break;
+ case 3:
+ AddCopilotTask();
+ AddCopilotTask_Adverse();
+ break;
}
}
catch (Exception)
@@ -472,20 +474,6 @@ namespace MaaWpfGui.ViewModels.UI
private async Task ParseCopilotSet(string jsonStr)
{
- void Log(string? name, string? description)
- {
- ClearLog();
- if (!string.IsNullOrWhiteSpace(name))
- {
- AddLog(name, UiLogColor.Message, showTime: false);
- }
-
- if (!string.IsNullOrWhiteSpace(description))
- {
- AddLog(description, UiLogColor.Message, showTime: false);
- }
- }
-
UseCopilotList = true;
IsCopilotSet = false;
try
@@ -518,6 +506,22 @@ namespace MaaWpfGui.ViewModels.UI
{
AddLog(LocalizationHelper.GetString("CopilotJsonError"), UiLogColor.Error, showTime: false);
}
+
+ return;
+
+ void Log(string? name, string? description)
+ {
+ ClearLog();
+ if (!string.IsNullOrWhiteSpace(name))
+ {
+ AddLog(name, UiLogColor.Message, showTime: false);
+ }
+
+ if (!string.IsNullOrWhiteSpace(description))
+ {
+ AddLog(description, UiLogColor.Message, showTime: false);
+ }
+ }
}
///