mirror of
https://github.com/MaaAssistantArknights/MaaAssistantArknights.git
synced 2026-07-18 10:10:45 +08:00
perf: 优化基建干员列表滑动次数
This commit is contained in:
@@ -408,7 +408,10 @@ void asst::InfrastAbstractTask::swipe_of_operlist()
|
||||
|
||||
void asst::InfrastAbstractTask::swipe_to_the_left_of_operlist(int loop_times)
|
||||
{
|
||||
for (int i = 0; i != loop_times; ++i) {
|
||||
if (loop_times < 0) {
|
||||
loop_times = operlist_swipe_times();
|
||||
}
|
||||
for (int i = 0; i < loop_times; ++i) {
|
||||
ProcessTask(*this, { "InfrastOperListSwipeToTheLeft" }).run();
|
||||
}
|
||||
ProcessTask(*this, { "SleepAfterOperListQuickSwipe" }).run();
|
||||
|
||||
@@ -30,9 +30,10 @@ namespace asst
|
||||
bool enter_facility(int index = 0);
|
||||
bool enter_oper_list_page(); // 从刚点进设施的界面,到干员列表页
|
||||
|
||||
void swipe_to_the_left_of_operlist(int loop_times = 2); // 滑动到干员列表的最左侧
|
||||
void swipe_to_the_left_of_main_ui(); // 滑动基建的主界面到最左侧
|
||||
void swipe_to_the_right_of_main_ui(); // 滑动基建的主界面到最右侧
|
||||
virtual int operlist_swipe_times() const noexcept { return 2; }
|
||||
void swipe_to_the_left_of_operlist(int loop_times = -1); // 滑动到干员列表的最左侧
|
||||
void swipe_to_the_left_of_main_ui(); // 滑动基建的主界面到最左侧
|
||||
void swipe_to_the_right_of_main_ui(); // 滑动基建的主界面到最右侧
|
||||
void swipe_of_operlist();
|
||||
bool is_use_custom_opers();
|
||||
infrast::CustomRoomConfig& current_room_config();
|
||||
@@ -58,4 +59,4 @@ namespace asst
|
||||
bool m_is_custom = false;
|
||||
infrast::CustomFacilityConfig m_custom_config;
|
||||
};
|
||||
}
|
||||
} // namespace asst
|
||||
|
||||
@@ -23,14 +23,13 @@ bool asst::InfrastControlTask::_run()
|
||||
if (need_exit()) {
|
||||
return false;
|
||||
}
|
||||
constexpr int MySwipeToTheLeftTimes = 4;
|
||||
if (is_use_custom_opers()) {
|
||||
bool name_select_ret = swipe_and_select_custom_opers();
|
||||
if (name_select_ret) {
|
||||
break;
|
||||
}
|
||||
else {
|
||||
swipe_to_the_left_of_operlist(MySwipeToTheLeftTimes);
|
||||
swipe_to_the_left_of_operlist();
|
||||
continue;
|
||||
}
|
||||
}
|
||||
@@ -40,12 +39,12 @@ bool asst::InfrastControlTask::_run()
|
||||
if (!opers_detect_with_swipe()) {
|
||||
return false;
|
||||
}
|
||||
swipe_to_the_left_of_operlist(MySwipeToTheLeftTimes);
|
||||
swipe_to_the_left_of_operlist();
|
||||
|
||||
optimal_calc();
|
||||
if (!opers_choose()) {
|
||||
m_all_available_opers.clear();
|
||||
swipe_to_the_left_of_operlist(MySwipeToTheLeftTimes);
|
||||
swipe_to_the_left_of_operlist();
|
||||
continue;
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -11,6 +11,9 @@ namespace asst
|
||||
|
||||
virtual size_t max_num_of_opers() const noexcept override { return 5ULL; }
|
||||
|
||||
protected:
|
||||
virtual int operlist_swipe_times() const noexcept override { return 4; }
|
||||
|
||||
private:
|
||||
virtual bool _run() override;
|
||||
};
|
||||
|
||||
@@ -14,5 +14,6 @@ namespace asst
|
||||
|
||||
protected:
|
||||
virtual bool _run() override;
|
||||
virtual int operlist_swipe_times() const noexcept override { return 5; }
|
||||
};
|
||||
}
|
||||
|
||||
@@ -170,7 +170,7 @@ bool asst::InfrastProductionTask::shift_facility_list()
|
||||
break;
|
||||
}
|
||||
else {
|
||||
swipe_to_the_left_of_operlist(SwipeToTheLeftTimes);
|
||||
swipe_to_the_left_of_operlist();
|
||||
continue;
|
||||
}
|
||||
}
|
||||
@@ -181,7 +181,7 @@ bool asst::InfrastProductionTask::shift_facility_list()
|
||||
if (!opers_detect_with_swipe()) {
|
||||
return false;
|
||||
}
|
||||
swipe_to_the_left_of_operlist(SwipeToTheLeftTimes);
|
||||
swipe_to_the_left_of_operlist();
|
||||
}
|
||||
else {
|
||||
opers_detect();
|
||||
@@ -189,7 +189,7 @@ bool asst::InfrastProductionTask::shift_facility_list()
|
||||
optimal_calc();
|
||||
if (!opers_choose()) {
|
||||
m_all_available_opers.clear();
|
||||
swipe_to_the_left_of_operlist(SwipeToTheLeftTimes);
|
||||
swipe_to_the_left_of_operlist();
|
||||
continue;
|
||||
}
|
||||
break;
|
||||
@@ -544,7 +544,7 @@ bool asst::InfrastProductionTask::opers_choose()
|
||||
if (!has_error) {
|
||||
has_error = true;
|
||||
// 倒回去再来一遍
|
||||
swipe_to_the_left_of_operlist(SwipeToTheLeftTimes);
|
||||
swipe_to_the_left_of_operlist();
|
||||
continue;
|
||||
}
|
||||
else {
|
||||
|
||||
@@ -19,8 +19,6 @@ namespace asst
|
||||
void clear_custom_drones_config();
|
||||
|
||||
protected:
|
||||
static constexpr int SwipeToTheLeftTimes = 6;
|
||||
|
||||
bool shift_facility_list();
|
||||
bool facility_list_detect();
|
||||
bool opers_detect_with_swipe();
|
||||
|
||||
@@ -186,14 +186,13 @@ bool asst::InfrastReceptionTask::shift()
|
||||
return false;
|
||||
}
|
||||
|
||||
constexpr int MySwipeToTheLeftTimes = 3;
|
||||
if (is_use_custom_opers()) {
|
||||
bool name_select_ret = swipe_and_select_custom_opers();
|
||||
if (name_select_ret) {
|
||||
break;
|
||||
}
|
||||
else {
|
||||
swipe_to_the_left_of_operlist(MySwipeToTheLeftTimes);
|
||||
swipe_to_the_left_of_operlist();
|
||||
continue;
|
||||
}
|
||||
}
|
||||
@@ -203,13 +202,13 @@ bool asst::InfrastReceptionTask::shift()
|
||||
if (!opers_detect_with_swipe()) {
|
||||
return false;
|
||||
}
|
||||
swipe_to_the_left_of_operlist(MySwipeToTheLeftTimes);
|
||||
swipe_to_the_left_of_operlist();
|
||||
|
||||
optimal_calc();
|
||||
bool ret = opers_choose();
|
||||
if (!ret) {
|
||||
m_all_available_opers.clear();
|
||||
swipe_to_the_left_of_operlist(MySwipeToTheLeftTimes);
|
||||
swipe_to_the_left_of_operlist();
|
||||
continue;
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -14,6 +14,7 @@ namespace asst
|
||||
virtual bool _run() override;
|
||||
|
||||
private:
|
||||
virtual int operlist_swipe_times() const noexcept override { return 4; }
|
||||
bool close_end_of_clue_exchange();
|
||||
bool get_clue();
|
||||
bool use_clue();
|
||||
|
||||
@@ -14,5 +14,6 @@ namespace asst
|
||||
|
||||
protected:
|
||||
virtual bool _run() override;
|
||||
virtual int operlist_swipe_times() const noexcept override { return 5; }
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user