perf: 移除图像识别,点击固定位置切换编队

This commit is contained in:
status102
2023-10-25 10:53:28 +08:00
committed by youqii
parent ddfcc7c9ce
commit 71aa1b7029
4 changed files with 26 additions and 49 deletions

View File

@@ -7216,55 +7216,41 @@
]
]
},
"BattleSelectedFormation": {
"action": "DoNothing",
"roi": [
50,
600,
1180,
120
],
"cache": false,
"maskRange": [
1,
255
]
},
"BattleSelectFormation1": {
"algorithm": "JustReturn",
"action": "ClickRect",
"specificRect": [
180,
670,
115,
40
105,
662,
10,
58
]
},
"BattleSelectFormation2": {
"baseTask": "BattleSelectFormation1",
"specificRect": [
460,
670,
100,
40
380,
662,
10,
58
]
},
"BattleSelectFormation3": {
"baseTask": "BattleSelectFormation1",
"specificRect": [
720,
670,
120,
40
650,
662,
10,
58
]
},
"BattleSelectFormation4": {
"baseTask": "BattleSelectFormation1",
"specificRect": [
995,
675,
110,
40
920,
662,
10,
58
]
},
"BattleSupportUnitFormation": {

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.6 KiB

View File

@@ -57,7 +57,7 @@ bool asst::BattleFormationTask::_run()
return false;
}
if (m_select_formation_index > 0 && !select_formation(ctrler()->get_image())) {
if (m_select_formation_index > 0 && !select_formation()) {
return false;
}
@@ -70,8 +70,7 @@ bool asst::BattleFormationTask::_run()
add_formation(role, oper_groups);
}
if (m_add_user_additional) {
for (auto& [name, skill] : m_user_additional) {
for (const auto& [name, skill] : m_user_additional) {
if (m_operators_in_formation.contains(name)) {
continue;
}
@@ -299,7 +298,7 @@ std::vector<asst::TextRect> asst::BattleFormationTask::analyzer_opers()
return tr_res;
}
bool asst::BattleFormationTask::enter_selection_page()
inline bool asst::BattleFormationTask::enter_selection_page()
{
return ProcessTask(*this, { "BattleQuickFormation" }).set_retry_times(3).run();
}
@@ -435,19 +434,11 @@ bool asst::BattleFormationTask::parse_formation()
return true;
}
bool asst::BattleFormationTask::select_formation(const cv::Mat& image)
inline bool asst::BattleFormationTask::select_formation()
{
LogTraceFunction;
Matcher selected_searcher(image);
selected_searcher.set_task_info("BattleSelectedFormation");
if (!selected_searcher.analyze()) {
return false;
}
int result = formation_index_from_rect(selected_searcher.get_result().rect);
if (result == m_select_formation_index) return true;
int a[] = {1, 2};
return ProcessTask { *this, { "BattleSelectFormation" + m_select_formation_index } }.run();
// 编队不会触发改名的区域有两组
// 一组是上面的黑长条 260*9
// 第二组是名字最左边和最右边的一块区域
// 右边比左边窄,暂定为左边 10*58
return ProcessTask { *this, { m_battle_select_formation_task_name[m_select_formation_index] } }.run();
}

View File

@@ -59,7 +59,7 @@ namespace asst
bool confirm_selection();
bool click_role_table(battle::Role role);
bool parse_formation();
bool select_formation(const cv::Mat& image);
bool select_formation();
bool select_random_support_unit();
// 返回当前rect所属的编队序号
// 1 | 2 | 3 | 4