mirror of
https://github.com/MaaAssistantArknights/MaaAssistantArknights.git
synced 2026-07-17 10:00:44 +08:00
增加一个task,可以执行tasks.json内任意一个task
This commit is contained in:
19
src/MaaCore/Task/Interface/CustomTask.cpp
Normal file
19
src/MaaCore/Task/Interface/CustomTask.cpp
Normal file
@@ -0,0 +1,19 @@
|
||||
#include "CustomTask.h"
|
||||
#include "Task/ProcessTask.h"
|
||||
|
||||
asst::CustomTask::CustomTask(const AsstCallback& callback, Assistant* inst) : InterfaceTask(callback, inst, TaskType)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
bool asst::CustomTask::set_params(const json::value& params)
|
||||
{
|
||||
std::vector<std::string> tasks {};
|
||||
for (const auto &i : params.at("task_names").as_array()) {
|
||||
tasks.emplace_back(i.as_string());
|
||||
}
|
||||
auto custom_task_ptr = std::make_shared<ProcessTask>(m_callback, m_inst, TaskType);
|
||||
custom_task_ptr->set_tasks(tasks);
|
||||
m_subtasks.emplace_back(custom_task_ptr);
|
||||
return true;
|
||||
}
|
||||
Reference in New Issue
Block a user