perf: 优化战斗列表反激活任务逻辑,仅三星结算时才会反激活任务,移除不必要的插件

This commit is contained in:
status102
2023-12-13 21:25:19 +08:00
parent ded33245fa
commit ffbbf55f20
6 changed files with 10 additions and 54 deletions

View File

@@ -80,7 +80,6 @@
<ClInclude Include="Task\Interface\VideoRecognitionTask.h" />
<ClInclude Include="Task\Interface\OperBoxTask.h" />
<ClInclude Include="Task\Miscellaneous\ScreenshotTaskPlugin.h" />
<ClInclude Include="Task\Miscellaneous\CopilotListNotificationPlugin.h" />
<ClInclude Include="Task\Miscellaneous\OperBoxRecognitionTask.h" />
<ClInclude Include="Task\Miscellaneous\AccountSwitchTask.h" />
<ClInclude Include="Task\Miscellaneous\TaskFileReloadTask.h" />
@@ -257,7 +256,6 @@
<ClCompile Include="Task\Interface\VideoRecognitionTask.cpp" />
<ClCompile Include="Task\Interface\OperBoxTask.cpp" />
<ClCompile Include="Task\Miscellaneous\ScreenshotTaskPlugin.cpp" />
<ClCompile Include="Task\Miscellaneous\CopilotListNotificationPlugin.cpp" />
<ClCompile Include="Task\Miscellaneous\OperBoxRecognitionTask.cpp" />
<ClCompile Include="Task\Miscellaneous\AccountSwitchTask.cpp" />
<ClCompile Include="Task\Miscellaneous\TaskFileReloadTask.cpp" />

View File

@@ -657,9 +657,6 @@
<ClInclude Include="Task\Infrast\InfrastProcessingTask.h">
<Filter>Source\Task\Infrast</Filter>
</ClInclude>
<ClInclude Include="Task\Miscellaneous\CopilotListNotificationPlugin.h">
<Filter>Source\Task\Miscellaneous</Filter>
</ClInclude>
<ClInclude Include="Task\Miscellaneous\TaskFileReloadTask.h">
<Filter>Source\Task\Miscellaneous</Filter>
</ClInclude>
@@ -1127,9 +1124,6 @@
<ClCompile Include="Task\Infrast\InfrastProcessingTask.cpp">
<Filter>Source\Task\Infrast</Filter>
</ClCompile>
<ClCompile Include="Task\Miscellaneous\CopilotListNotificationPlugin.cpp">
<Filter>Source\Task\Miscellaneous</Filter>
</ClCompile>
<ClCompile Include="Task\Miscellaneous\TaskFileReloadTask.cpp">
<Filter>Source\Task\Miscellaneous</Filter>
</ClCompile>

View File

@@ -1,24 +0,0 @@
#include "CopilotListNotificationPlugin.h"
bool asst::CopilotListNotificationPlugin::verify(AsstMsg msg, const json::value& details) const
{
if (msg != AsstMsg::SubTaskStart || details.get("subtask", std::string()) != "ProcessTask") {
return false;
}
const std::string task = details.at("details").at("task").as_string();
if (task != "BattleStartAll" && task.starts_with("BattleStart")) {
return true;
}
else {
return false;
}
}
bool asst::CopilotListNotificationPlugin::_run()
{
json::value info = basic_info_with_what("CopilotListEnterSuccess");
callback(AsstMsg::SubTaskExtraInfo, info);
return true;
}

View File

@@ -1,16 +0,0 @@
#pragma once
#include "Task/AbstractTaskPlugin.h"
namespace asst
{
class CopilotListNotificationPlugin : public AbstractTaskPlugin
{
public:
using AbstractTaskPlugin::AbstractTaskPlugin;
virtual ~CopilotListNotificationPlugin() override = default;
virtual bool verify(AsstMsg msg, const json::value& details) const override;
private:
virtual bool _run() override;
};
}

View File

@@ -601,6 +601,11 @@ namespace MaaWpfGui.Main
_runningState.SetIdle(true);
}
if (Instances.CopilotViewModel.UseCopilotList)
{
Instances.CopilotViewModel.CopilotTaskSuccess();
}
Instances.CopilotViewModel.AddLog(LocalizationHelper.GetString("CompleteCombat"), UiLogColor.Info, showTime: true);
}
@@ -1220,10 +1225,6 @@ namespace MaaWpfGui.Main
Instances.CopilotViewModel.AddLog($"Parse {subTaskDetails["file_name"]}[{subTaskDetails["stage_name"]}] Success");
break;
case "CopilotListEnterSuccess":
Instances.CopilotViewModel.EnterCopilotTask();
break;
case "SSSStage":
Instances.CopilotViewModel.AddLog("CurrentStage: " + subTaskDetails["stage"], UiLogColor.Info, showTime: true);
break;

View File

@@ -449,7 +449,7 @@ namespace MaaWpfGui.ViewModels.UI
}
/// <summary>
/// Import copilot json files from dictionary
/// 批量导入作业
/// </summary>
// ReSharper disable once UnusedMember.Global
public async void ImportFiles()
@@ -812,7 +812,10 @@ namespace MaaWpfGui.ViewModels.UI
}
}
public void EnterCopilotTask()
/// <summary>
/// 战斗列表的当前战斗任务成功
/// </summary>
public void CopilotTaskSuccess()
{
Application.Current.Dispatcher.InvokeAsync(() =>
{