mirror of
https://github.com/MaaAssistantArknights/MaaAssistantArknights.git
synced 2026-07-15 17:30:27 +08:00
feat: 给自定义任务添加 ScreenshotTaskPlugin 插件
This commit is contained in:
@@ -1,12 +1,15 @@
|
||||
#include "CustomTask.h"
|
||||
#include "Task/Miscellaneous/ScreenshotTaskPlugin.h"
|
||||
#include "Task/ProcessTask.h"
|
||||
|
||||
#include "Utils/Logger.hpp"
|
||||
|
||||
asst::CustomTask::CustomTask(const AsstCallback& callback, Assistant* inst) :
|
||||
InterfaceTask(callback, inst, TaskType)
|
||||
InterfaceTask(callback, inst, TaskType),
|
||||
m_custom_task_ptr(std::make_shared<ProcessTask>(callback, inst, TaskType))
|
||||
{
|
||||
LogTraceFunction;
|
||||
m_custom_task_ptr->register_plugin<ScreenshotTaskPlugin>();
|
||||
}
|
||||
|
||||
bool asst::CustomTask::set_params(const json::value& params)
|
||||
@@ -27,8 +30,7 @@ bool asst::CustomTask::set_params(const json::value& params)
|
||||
}
|
||||
tasks.emplace_back(t.as_string());
|
||||
}
|
||||
auto custom_task_ptr = std::make_shared<ProcessTask>(m_callback, m_inst, TaskType);
|
||||
custom_task_ptr->set_tasks(std::move(tasks));
|
||||
m_subtasks.emplace_back(std::move(custom_task_ptr));
|
||||
m_custom_task_ptr->set_tasks(std::move(tasks));
|
||||
m_subtasks.emplace_back(m_custom_task_ptr);
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -13,5 +13,8 @@ public:
|
||||
CustomTask(const AsstCallback& callback, Assistant* inst);
|
||||
virtual ~CustomTask() override = default;
|
||||
virtual bool set_params(const json::value& params) override;
|
||||
|
||||
private:
|
||||
std::shared_ptr<ProcessTask> m_custom_task_ptr = nullptr;
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user