mirror of
https://github.com/MaaAssistantArknights/MaaAssistantArknights.git
synced 2026-07-17 10:00:44 +08:00
chore: 添加一些日志
This commit is contained in:
@@ -1,16 +1,33 @@
|
||||
#include "CustomTask.h"
|
||||
#include "Task/ProcessTask.h"
|
||||
|
||||
asst::CustomTask::CustomTask(const AsstCallback& callback, Assistant* inst) : InterfaceTask(callback, inst, TaskType) {}
|
||||
#include "Utils/Logger.hpp"
|
||||
|
||||
asst::CustomTask::CustomTask(const AsstCallback& callback, Assistant* inst) : InterfaceTask(callback, inst, TaskType)
|
||||
{
|
||||
LogTraceFunction;
|
||||
}
|
||||
|
||||
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());
|
||||
LogTraceFunction;
|
||||
|
||||
auto tasks_opt = params.find<json::array>("task_names");
|
||||
if (!tasks_opt) {
|
||||
Log.error("set_params failed, task_names not found");
|
||||
return false;
|
||||
}
|
||||
std::vector<std::string> tasks;
|
||||
|
||||
for (const auto& t : *tasks_opt) {
|
||||
if (!t.is_string()) {
|
||||
Log.error("set_params failed, task is not string");
|
||||
return false;
|
||||
}
|
||||
tasks.emplace_back(t.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);
|
||||
custom_task_ptr->set_tasks(std::move(tasks));
|
||||
m_subtasks.emplace_back(std::move(custom_task_ptr));
|
||||
return true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user