feat: 初步完成自定义换班协议解析,operators字段支持,重构一小部分代码

This commit is contained in:
MistEO
2022-09-17 22:46:59 +08:00
parent 7077d57648
commit 90b9f841b5
14 changed files with 335 additions and 166 deletions

View File

@@ -22,40 +22,23 @@ bool asst::InfrastOfficeTask::_run()
if (!opers_detect_with_swipe()) {
return false;
}
swipe_to_the_left_of_operlist();
auto find_iter =
ranges::find_if(m_all_available_opers, [&](const infrast::Oper& info) -> bool { return info.selected; });
bool need_shift = true;
if (find_iter != m_all_available_opers.end()) {
switch (m_work_mode) {
case infrast::WorkMode::Gentle:
// 如果之前有干员在,那就不换人,直接退出
m_all_available_opers.erase(find_iter);
need_shift = false;
break;
case infrast::WorkMode::Aggressive:
need_shift = true;
// TODO这里有个bug全部干员中的selected和当前的不一定是同一个页面
// 不过目前没影响反正滑动到最前面了selected的一定是在最前面
// m_ctrler->click(find_iter->rect);
// sleep(300);
break;
case infrast::WorkMode::Extreme: // TODO
break;
default:
if (is_use_custom_config()) {
bool name_select_ret = swipe_and_select_opers_by_name(m_current_room_custom_config.names);
if (name_select_ret) {
break;
}
}
if (need_shift) {
optimal_calc();
if (!opers_choose()) {
m_all_available_opers.clear();
else {
swipe_to_the_left_of_operlist();
continue;
}
}
optimal_calc();
if (!opers_choose()) {
m_all_available_opers.clear();
swipe_to_the_left_of_operlist();
continue;
}
break;
}
click_confirm_button();