fix: 肉鸽重新编队应先回到首页

This commit is contained in:
YueLengM
2024-09-04 23:27:09 +08:00
parent b31810faaa
commit 29d052e34f
2 changed files with 12 additions and 6 deletions

View File

@@ -97,7 +97,7 @@ void asst::RoguelikeFormationTaskPlugin::clear_and_reselect()
m_last_detected_oper_names.clear();
oper_list.clear();
cur_page = 1;
swipe_to_first_page();
while (analyze()) { // 返回true说明新增了干员可能还有下一页
ProcessTask(*this, { "RoguelikeRecruitOperListSlowlySwipeToTheRight" }).run();
@@ -199,11 +199,7 @@ bool asst::RoguelikeFormationTaskPlugin::select(RoguelikeFormationImageAnalyzer:
Log.info(__FUNCTION__, "swipe from page", cur_page, "to page", oper.page);
// 在最大页码时(当总页数>=2从右往左划可能会有对不齐的问题直接划动到底
if ((cur_page > oper.page && max_page >= 2 && cur_page == max_page) || max_page == 1) {
for (; cur_page > 0; --cur_page) { // 多划一次到不存在的第0页
ProcessTask(*this, { "RoguelikeRecruitOperListSwipeToTheLeft" }).run();
}
ProcessTask(*this, { "SleepAfterOperListQuickSwipe" }).run();
cur_page = 1;
swipe_to_first_page();
}
// 中间页面划动姑且当成是相对准确的
while (cur_page > oper.page) {
@@ -219,3 +215,12 @@ bool asst::RoguelikeFormationTaskPlugin::select(RoguelikeFormationImageAnalyzer:
ctrler()->click(oper.rect);
return true;
}
void asst::RoguelikeFormationTaskPlugin::swipe_to_first_page()
{
for (; cur_page > 0; --cur_page) { // 多划一次到不存在的第0页
ProcessTask(*this, { "RoguelikeRecruitOperListSwipeToTheLeft" }).run();
}
ProcessTask(*this, { "SleepAfterOperListQuickSwipe" }).run();
cur_page = 1;
}

View File

@@ -23,6 +23,7 @@ namespace asst
void clear_and_reselect();
bool analyze();
bool select(RoguelikeFormationImageAnalyzer::FormationOper oper);
void swipe_to_first_page();
private:
int cur_page = 0;