feat: 单步任务支持设置关卡名

This commit is contained in:
MistEO
2023-01-28 03:41:41 +08:00
parent a0807bd3d9
commit 826bb26d45
4 changed files with 28 additions and 7 deletions

View File

@@ -18,7 +18,10 @@ bool asst::SingleStepTask::set_params(const json::value& params)
auto details_opt = params.find("details");
if (type == "copilot") {
if (subtype == "start") {
if (subtype == "stage" && details_opt) {
return set_copilot_stage(*details_opt);
}
else if (subtype == "start") {
return append_copllot_start();
}
else if (subtype == "action" && details_opt) {
@@ -28,6 +31,11 @@ bool asst::SingleStepTask::set_params(const json::value& params)
return false;
}
bool asst::SingleStepTask::set_copilot_stage(const json::value& details)
{
return SingleStepBattleProcessTask::set_stage_name_cache(details.get("stage_name", ""));
}
bool asst::SingleStepTask::append_copllot_start()
{
LogTraceFunction;
@@ -45,9 +53,6 @@ bool asst::SingleStepTask::append_copilot_action(const json::value& details)
auto task = std::make_shared<SingleStepBattleProcessTask>(m_callback, m_inst, TaskType);
// for debug
task->set_stage_name("OF-1");
try {
// 请参考自动战斗协议
auto actions = CopilotConfig::parse_actions(details);