perf.为滑动选择干员增加容错操作

This commit is contained in:
MistEO
2021-11-01 23:30:41 +08:00
parent 929a8fb1e1
commit 7df3cdc8c8
5 changed files with 97 additions and 54 deletions

View File

@@ -18,26 +18,32 @@ bool asst::InfrastOfficeTask::run()
swipe_to_the_right_of_main_ui();
enter_facility(FacilityName, 0);
click_bottomleft_tab();
swipe_to_the_left_of_operlist();
opers_detect_with_swipe();
swipe_to_the_left_of_operlist();
constexpr int retry_times = 1;
for (int i = 0; i <= retry_times; ++i) {
swipe_to_the_left_of_operlist();
opers_detect_with_swipe();
swipe_to_the_left_of_operlist();
auto find_iter = std::find_if(m_all_available_opers.begin(), m_all_available_opers.end(),
[&](const InfrastOperSkillInfo& info) -> bool {
return info.selected;
});
// 如果之前有干员在,那就不换人,直接退出办公室
if (find_iter != m_all_available_opers.end()) {
m_all_available_opers.erase(find_iter);
auto find_iter = std::find_if(m_all_available_opers.begin(), m_all_available_opers.end(),
[&](const InfrastOperSkillInfo& info) -> bool {
return info.selected;
});
// 如果之前有干员在,那就不换人,直接退出办公室
if (find_iter != m_all_available_opers.end()) {
m_all_available_opers.erase(find_iter);
}
else {
optimal_calc();
bool ret = opers_choose();
if (!ret) {
m_all_available_opers.clear();
continue;
}
}
break;
}
else {
optimal_calc();
opers_choose();
}
click_confirm_button();
click_return_button();