fix.修修bug,改改界面

This commit is contained in:
MistEO
2021-12-11 03:57:19 +08:00
parent 590bb0848a
commit 6fbb3b6ccb
13 changed files with 40 additions and 31 deletions

View File

@@ -478,8 +478,7 @@ void Assistance::working_proc()
if (!ret) {
task_callback(AsstMsg::TaskError, task_json, this);
}
if (m_tasks_queue.empty() || cur_taskchain != m_tasks_queue.front()->get_task_chain()) {
else if (m_tasks_queue.empty() || cur_taskchain != m_tasks_queue.front()->get_task_chain()) {
task_callback(AsstMsg::TaskChainCompleted, task_json, this);
}
if (m_tasks_queue.empty()) {

View File

@@ -43,6 +43,7 @@ namespace asst
RecruitSpecialTag, // 公招识别到了特殊的Tag
RecruitResult, // 公开招募结果
RecruitSelected, // 选择了Tags
RecruitError, // 公招错误
/* Infrast Msg */
InfrastSkillsDetected = 4000, // 识别到了基建技能(当前页面)
InfrastSkillsResult, // 识别到的所有可用技能
@@ -64,6 +65,7 @@ namespace asst
{ AsstMsg::ImageMatched, "ImageMatched" },
{ AsstMsg::StageDrops, "StageDrops" },
{ AsstMsg::TaskMatched, "TaskMatched" },
{ AsstMsg::RecruitError, "RecruitError" },
{ AsstMsg::ReachedLimit, "ReachedLimit" },
{ AsstMsg::ReadyToSleep, "ReadyToSleep" },
{ AsstMsg::EndOfSleep, "EndOfSleep" },

View File

@@ -63,6 +63,7 @@ bool asst::AutoRecruitTask::_run()
// 识别错误,放弃这个公招位,直接返回
if (!recurit_task.run()) {
m_callback(AsstMsg::RecruitError, json::value(), m_callback_arg);
click_return_button();
break;
}

View File

@@ -207,16 +207,16 @@ void asst::InfrastAbstractTask::swipe_of_operlist(bool reverse)
await_swipe();
}
void asst::InfrastAbstractTask::swipe_to_the_left_of_operlist()
void asst::InfrastAbstractTask::swipe_to_the_left_of_operlist(int loop_times)
{
LogTraceFunction;
static Rect begin_rect = task.get("InfrastOperListSwipeToTheLeftBegin")->specific_rect;
static Rect end_rect = task.get("InfrastOperListSwipeToTheLeftEnd")->specific_rect;
static int duration = task.get("InfrastOperListSwipeToTheLeftBegin")->pre_delay;
static int extra_delay = task.get("InfrastOperListSwipeToTheLeftBegin")->rear_delay;
static int loop_times = task.get("InfrastOperListSwipeToTheLeftBegin")->max_times;
static int cfg_loop_times = task.get("InfrastOperListSwipeToTheLeftBegin")->max_times;
for (int i = 0; i != loop_times; ++i) {
for (int i = 0; i != cfg_loop_times * loop_times; ++i) {
if (need_exit()) {
return;
}

View File

@@ -15,13 +15,14 @@ namespace asst
virtual void set_work_mode(infrast::WorkMode work_mode) noexcept;
virtual void set_mood_threshold(double mood_thres) noexcept;
constexpr static int OperSelectRetryTimes = 3;
protected:
virtual bool on_run_fails() override;
virtual bool enter_facility(const std::string& facility, int index = 0);
virtual bool enter_oper_list_page(); // 从刚点进基建的界面,到干员列表页
virtual void swipe_to_the_left_of_operlist(); // 滑动到干员列表的最左侧
virtual void swipe_to_the_left_of_operlist(int loop_times = 1); // 滑动到干员列表的最左侧
virtual void swipe_to_the_left_of_main_ui(); // 滑动基建的主界面到最左侧
virtual void swipe_to_the_right_of_main_ui(); // 滑动基建的主界面到最右侧
virtual void swipe_of_operlist(bool reverse = false);

View File

@@ -23,8 +23,8 @@ bool asst::InfrastControlTask::_run()
if (!enter_oper_list_page()) {
return false;
}
constexpr int retry_times = 3;
for (int i = 0; i <= retry_times; ++i) {
for (int i = 0; i <= OperSelectRetryTimes; ++i) {
if (need_exit()) {
return false;
}

View File

@@ -22,8 +22,7 @@ bool asst::InfrastOfficeTask::_run()
enter_facility(FacilityName, 0);
click_bottomleft_tab();
constexpr int retry_times = 3;
for (int i = 0; i <= retry_times; ++i) {
for (int i = 0; i <= OperSelectRetryTimes; ++i) {
if (need_exit()) {
return false;
}

View File

@@ -31,8 +31,8 @@ bool asst::InfrastPowerTask::_run()
if (!enter_oper_list_page()) {
return false;
}
constexpr int retry_times = 3;
for (int i = 0; i <= retry_times; ++i) {
for (int i = 0; i <= OperSelectRetryTimes; ++i) {
swipe_to_the_left_of_operlist();
if (m_all_available_opers.empty()) {

View File

@@ -110,21 +110,18 @@ bool asst::InfrastProductionTask::shift_facility_list()
Ctrler.click(add_button);
sleep(add_task_ptr->rear_delay);
constexpr int retry_times = 3;
for (int i = 0; i <= retry_times; ++i) {
for (int i = 0; i <= OperSelectRetryTimes; ++i) {
if (need_exit()) {
return false;
}
click_clear_button();
swipe_to_the_left_of_operlist();
swipe_to_the_left_of_operlist();
swipe_to_the_left_of_operlist(2);
if (m_all_available_opers.empty()) {
if (!opers_detect_with_swipe()) {
return false;
}
swipe_to_the_left_of_operlist();
swipe_to_the_left_of_operlist();
swipe_to_the_left_of_operlist(2);
}
else {
opers_detect();

View File

@@ -179,8 +179,7 @@ bool asst::InfrastReceptionTask::shift()
}
sleep(raw_task_ptr->rear_delay);
constexpr int retry_times = 3;
for (int i = 0; i <= retry_times; ++i) {
for (int i = 0; i <= OperSelectRetryTimes; ++i) {
if (need_exit()) {
return false;
}

View File

@@ -2,5 +2,5 @@
namespace asst
{
constexpr static const char* Version = "v2.3.2";
constexpr static const char* Version = "v2.3.3";
}

View File

@@ -103,19 +103,23 @@ namespace MeoAsstGui
string taskName = detail["name"].ToString();
if (taskName == "StartButton2")
{
tvm.AddLog("已开始行动 " + (int)detail["exec_times"] + " 次");
tvm.AddLog("已开始行动 " + (int)detail["exec_times"] + " 次", "darkcyan");
}
else if (taskName == "MedicineConfirm")
{
tvm.AddLog("已吃药 " + (int)detail["exec_times"] + " 个");
tvm.AddLog("已吃药 " + (int)detail["exec_times"] + " 个", "darkcyan");
}
else if (taskName == "StoneConfirm")
{
tvm.AddLog("已碎石 " + (int)detail["exec_times"] + " 颗");
tvm.AddLog("已碎石 " + (int)detail["exec_times"] + " 颗", "darkcyan");
}
else if (taskName == "RecruitRefresh")
else if (taskName == "RecruitRefreshConfirm")
{
tvm.AddLog("已刷新标签");
tvm.AddLog("已刷新标签", "darkcyan");
}
else if (taskName == "RecruitConfirm")
{
tvm.AddLog("已确认招募", "darkcyan");
}
}
break;
@@ -168,7 +172,8 @@ namespace MeoAsstGui
case AsstMsg.OcrResultError:
case AsstMsg.RecruitSpecialTag:
case AsstMsg.RecruitResult:
case AsstMsg.RecruitSelected:
case AsstMsg.RecruitSelected:
case AsstMsg.RecruitError:
recruit_proc_msg(msg, detail);
break;
/* Infrast Msg */
@@ -180,7 +185,8 @@ namespace MeoAsstGui
infrast_proc_msg(msg, detail);
break;
case AsstMsg.TaskError:
case AsstMsg.TaskError:
tvm.AddLog("任务出错:" + detail["task_chain"].ToString(), "darkred");
break;
case AsstMsg.InitFaild:
@@ -274,11 +280,11 @@ namespace MeoAsstGui
if (combs_level >= 5)
{
new ToastContentBuilder().AddText("公招出 " + combs_level + " 星了哦!").Show(); ;
tvm.AddLog(combs_level + " 星Tags", "OrangeRed");
tvm.AddLog(combs_level + " 星Tags", "darkorange", "Bold");
}
else
{
tvm.AddLog(combs_level + " 星Tags");
tvm.AddLog(combs_level + " 星Tags", "darkcyan");
}
break;
@@ -293,6 +299,10 @@ namespace MeoAsstGui
selected_log = selected_log.EndsWith("\n") ? selected_log.TrimEnd('\n') : "无";
tvm.AddLog("选择Tags\n" + selected_log);
break;
case AsstMsg.RecruitError:
tvm.AddLog("公招识别错误,已返回", "darkred");
break;
}
}
@@ -401,6 +411,7 @@ namespace MeoAsstGui
RecruitSpecialTag, // 公招识别到了特殊的Tag
RecruitResult, // 公开招募结果
RecruitSelected, // 选择了Tags
RecruitError, // 公招错误
/* Infrast Msg */
InfrastSkillsDetected = 4000, // 识别到了基建技能(当前页面)
InfrastSkillsResult, // 识别到的所有可用技能

View File

@@ -74,7 +74,7 @@ namespace MeoAsstGui
bool catchd = await task;
if (!catchd)
{
AddLog("捕获模拟器窗口失败,若是第一次运行,请尝试使用管理员权限", "Red");
AddLog("捕获模拟器窗口失败,若是第一次运行,请尝试使用管理员权限", "darkred");
return;
}