From 439fd655d714af99992b2f6c23f5aaa396e9b0f2 Mon Sep 17 00:00:00 2001 From: MistEO Date: Sun, 3 Apr 2022 01:17:28 +0800 Subject: [PATCH] =?UTF-8?q?perf.=E8=87=AA=E5=8A=A8=E6=88=98=E6=96=97?= =?UTF-8?q?=EF=BC=8C=E8=8B=A5oper=E4=B8=BA=E7=A9=BA=EF=BC=8C=E5=88=99?= =?UTF-8?q?=E4=B8=8D=E9=80=89=E4=BA=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/MeoAssistant/BattleFormationTask.cpp | 8 ++++++-- src/MeoAssistant/BattleProcessTask.cpp | 19 ++++++++++--------- 2 files changed, 16 insertions(+), 11 deletions(-) diff --git a/src/MeoAssistant/BattleFormationTask.cpp b/src/MeoAssistant/BattleFormationTask.cpp index 75b957877e..c28dbc7770 100644 --- a/src/MeoAssistant/BattleFormationTask.cpp +++ b/src/MeoAssistant/BattleFormationTask.cpp @@ -16,12 +16,16 @@ bool asst::BattleFormationTask::_run() if (!battle.contains_actions(m_stage_name)) { return false; } + + m_groups = battle.get_actions(m_stage_name).groups; + if (m_groups.empty()) { + return true; + } + if (!enter_selection_page()) { return false; } - m_groups = battle.get_actions(m_stage_name).groups; - // TODO: 需要加一个滑到头了的检测 while (true) { select_opers_in_cur_page(); diff --git a/src/MeoAssistant/BattleProcessTask.cpp b/src/MeoAssistant/BattleProcessTask.cpp index 6f5caecb9d..bc3c784739 100644 --- a/src/MeoAssistant/BattleProcessTask.cpp +++ b/src/MeoAssistant/BattleProcessTask.cpp @@ -45,15 +45,6 @@ bool asst::BattleProcessTask::get_stage_info() m_normal_tile_info = tile.calc(m_stage_name, false); m_side_tile_info = tile.calc(m_stage_name, true); - //#ifdef ASST_DEBUG - auto draw = m_ctrler->get_image(); - for (const auto& [loc, info] : m_normal_tile_info) { - std::string text = "( " + std::to_string(loc.x) + ", " + std::to_string(loc.y) + " )"; - cv::putText(draw, text, cv::Point(info.pos.x - 30, info.pos.y), 1, 1.2, cv::Scalar(0, 0, 255), 2); - } - cv::imwrite(utils::utf8_to_gbk(m_stage_name) + ".png", draw); - //#endif - if (m_side_tile_info.empty() || m_normal_tile_info.empty()) { return false; } @@ -81,6 +72,16 @@ bool asst::BattleProcessTask::analyze_opers_preview() } std::this_thread::yield(); } + + //#ifdef ASST_DEBUG + auto draw = m_ctrler->get_image(); + for (const auto& [loc, info] : m_normal_tile_info) { + std::string text = "( " + std::to_string(loc.x) + ", " + std::to_string(loc.y) + " )"; + cv::putText(draw, text, cv::Point(info.pos.x - 30, info.pos.y), 1, 1.2, cv::Scalar(0, 0, 255), 2); + } + cv::imwrite(utils::utf8_to_gbk(m_stage_name) + ".png", draw); + //#endif + // 干员头像出来之后,还要过 2 秒左右才可以点击,这里要加个延时 sleep(Task.get("BattleWaitingToLoad")->rear_delay); battle_pause();