perf: 优化刷理智的SSReopen导航逻辑,允许从普通关页面启动时短路开始于主页的导航逻辑 (#6287)

This commit is contained in:
MistEO
2023-09-10 00:52:11 +08:00
committed by GitHub
2 changed files with 16 additions and 2 deletions

View File

@@ -65,10 +65,9 @@ bool asst::SideStoryReopenTask::_run()
callback(AsstMsg::SubTaskExtraInfo, task_not_exists);
return false;
}
Task.get("SideStoryReopen")->next = { m_sidestory_name + "ChapterTo" + m_sidestory_name };
if (!navigate_to_normal_page()) {
if (!at_normal_page() && !navigate_to_normal_page()) {
Log.error(__FUNCTION__, "cound not navigate to normal page");
return false;
}
@@ -125,6 +124,19 @@ bool asst::SideStoryReopenTask::_run()
}
return true;
}
bool asst::SideStoryReopenTask::at_normal_page()
{
std::vector<std::string> stage_name;
for (int stage_index = 1; stage_index < 10; stage_index++) {
stage_name.emplace_back(m_sidestory_name + "-" + std::to_string(stage_index));
}
Task.get<OcrTaskInfo>(m_sidestory_name + "@ClickStageName")->text = stage_name;
Task.get<OcrTaskInfo>(m_sidestory_name + "@ClickedCorrectStage")->text = std::move(stage_name);
Task.get<OcrTaskInfo>(m_sidestory_name + "@ClickedCorrectStageOrSwipe")->next = { m_sidestory_name +
"@ClickedCorrectStage" };
return ProcessTask(*this, { m_sidestory_name + "@ClickStageName" }).set_retry_times(0).run();
}
/// <summary>
/// 从首页导航至普通关页面
/// </summary>

View File

@@ -21,6 +21,8 @@ namespace asst
private:
virtual bool _run() override;
// 判断如果处于普通关页面,直接短路导航
bool at_normal_page();
bool navigate_to_normal_page();
bool select_stage(int stage_index);
bool activate_prts();