mirror of
https://github.com/MaaAssistantArknights/MaaAssistantArknights.git
synced 2026-07-15 17:30:27 +08:00
feat.添加部分基建容错机制
This commit is contained in:
@@ -668,6 +668,7 @@
|
||||
"InfrastEnteredFlag": {
|
||||
"template": "InfrastOverview.png",
|
||||
"templThreshold": 0.8,
|
||||
"histThreshold": 0.8,
|
||||
"action": "doNothing",
|
||||
"next": [
|
||||
"InfrastNotification",
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 7.3 KiB After Width: | Height: | Size: 8.8 KiB |
@@ -26,11 +26,11 @@ namespace asst
|
||||
virtual int get_retry_times() { return m_retry_times; }
|
||||
virtual void set_task_chain(std::string name) { m_task_chain = std::move(name); }
|
||||
virtual const std::string& get_task_chain() { return m_task_chain; }
|
||||
virtual void on_run_fails(int retry_times) { ; }
|
||||
virtual void on_run_fails() { ; }
|
||||
|
||||
protected:
|
||||
virtual bool sleep(unsigned millisecond);
|
||||
virtual bool save_image(const cv::Mat& iamge, const std::string& dir);
|
||||
virtual bool save_image(const cv::Mat& image, const std::string& dir);
|
||||
virtual bool need_exit() const noexcept;
|
||||
|
||||
virtual void click_return_button();
|
||||
|
||||
@@ -406,7 +406,7 @@ void Assistance::working_proc()
|
||||
++retry_times;
|
||||
// 执行失败再还原回去
|
||||
m_tasks_deque.emplace_front(task_ptr);
|
||||
task_ptr->on_run_fails(retry_times);
|
||||
task_ptr->on_run_fails();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -27,6 +27,17 @@ void asst::InfrastAbstractTask::set_work_mode(infrast::WorkMode work_mode) noexc
|
||||
}
|
||||
}
|
||||
|
||||
void asst::InfrastAbstractTask::on_run_fails()
|
||||
{
|
||||
LogTraceFunction;
|
||||
|
||||
json::value next_json;
|
||||
next_json["task_chain"] = m_task_chain;
|
||||
next_json["retry_times"] = m_retry_times;
|
||||
next_json["tasks"] = json::array({ "InfrastBegin" });
|
||||
m_callback(AsstMsg::AppendProcessTask, next_json, m_callback_arg);
|
||||
}
|
||||
|
||||
bool asst::InfrastAbstractTask::enter_facility(const std::string& facility, int index)
|
||||
{
|
||||
LogTraceFunction;
|
||||
@@ -214,4 +225,4 @@ void asst::InfrastAbstractTask::swipe_to_the_right_of_main_ui()
|
||||
static int extra_delay = resource.task().task_ptr("InfrastOperListSwipeToTheLeftBegin")->rear_delay;
|
||||
|
||||
ctrler.swipe(begin_rect, end_rect, duration, true, extra_delay, false);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,6 +11,7 @@ namespace asst
|
||||
using AbstractTask::AbstractTask;
|
||||
virtual ~InfrastAbstractTask() = default;
|
||||
virtual void set_work_mode(infrast::WorkMode work_mode) noexcept;
|
||||
virtual void on_run_fails() override;
|
||||
|
||||
protected:
|
||||
virtual bool enter_facility(const std::string& facility, int index = 0);
|
||||
|
||||
@@ -21,7 +21,9 @@ bool asst::InfrastMfgTask::run()
|
||||
enter_facility(FacilityName, 0);
|
||||
click_bottomleft_tab();
|
||||
|
||||
shift_facility_list();
|
||||
if (!shift_facility_list()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -27,7 +27,9 @@ bool asst::InfrastProductionTask::run()
|
||||
|
||||
m_all_available_opers.clear();
|
||||
|
||||
shift_facility_list();
|
||||
if (!shift_facility_list()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -49,7 +51,9 @@ asst::InfrastProductionTask::InfrastProductionTask(AsstCallback callback, void*
|
||||
bool asst::InfrastProductionTask::shift_facility_list()
|
||||
{
|
||||
LogTraceFunction;
|
||||
facility_list_detect();
|
||||
if (!facility_list_detect()) {
|
||||
return false;
|
||||
}
|
||||
if (need_exit()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -17,7 +17,9 @@ bool asst::InfrastTradeTask::run()
|
||||
enter_facility(FacilityName, 0);
|
||||
click_bottomleft_tab();
|
||||
|
||||
shift_facility_list();
|
||||
if (!shift_facility_list()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user