mirror of
https://github.com/MaaAssistantArknights/MaaAssistantArknights.git
synced 2026-07-15 17:30:27 +08:00
feat.进一步的异形屏流程任务适配,修复一些bug
This commit is contained in:
@@ -69,7 +69,8 @@ A game assistance for Arknights
|
||||
- 模拟器窗口可以被遮挡、可以最小化、甚至可以老板键隐藏!即使全屏看视频、玩游戏,也完全不影响软件运行
|
||||
- 软件支持自动更新✿✿ヽ(°▽°)ノ✿
|
||||
- 支持多款主流模拟器
|
||||
- 勉强兼容安卓手机(USB调试、无线调试)
|
||||
- 兼容安卓手机(USB调试、无线调试)
|
||||
- 兼容非16:9分辨率:包括宽屏、方屏,也兼容在游戏设置中的异形屏适配(基建换班功能除外,正在适配中)。但仍推荐使用16:9分辨率
|
||||
- 自适应分辨率及屏幕缩放
|
||||
- 未来更多功能见[Todo](#Todo)
|
||||
|
||||
@@ -183,7 +184,7 @@ A game assistance for Arknights
|
||||
1. `options`.`connectType`字段值为`1`
|
||||
2. `emulator`.`Custom`.`adb`.`addresses`字段填写为要连接的地址,请注意这是个数组,会以此尝试所有的(若不填写,或`addresses`中所有的都没连上,则会使用`adb devices`自动查找)
|
||||
|
||||
目前对非16:9分辨率的支持效果很不好,刷理智和公招识别勉强可用,其他功能几乎是不可用的状态,后期将逐步优化
|
||||
目前非16:9分辨率下,刷理智、访问好友、公招识别已初步可用,基建功能暂不可用,后期将逐步优化。但仍推荐使用16:9分辨率,经过的测试验证最多,也最稳定。
|
||||
|
||||
### 设置操作延时
|
||||
|
||||
|
||||
@@ -297,7 +297,7 @@
|
||||
]
|
||||
},
|
||||
"Friends": {
|
||||
"templThreshold": 0.85,
|
||||
"templThreshold": 0.7,
|
||||
"action": "clickSelf",
|
||||
"next": [
|
||||
"FriendsList",
|
||||
@@ -391,7 +391,17 @@
|
||||
]
|
||||
},
|
||||
"Mall": {
|
||||
"algorithm": "OcrDetect",
|
||||
"action": "clickSelf",
|
||||
"text": [
|
||||
"中心"
|
||||
],
|
||||
"roi": [
|
||||
640,
|
||||
360,
|
||||
640,
|
||||
360
|
||||
],
|
||||
"next": [
|
||||
"CreditStore",
|
||||
"CreditStoreOcr"
|
||||
|
||||
@@ -129,8 +129,8 @@ asst::Rect asst::Controller::shaped_correct(const Rect& rect) const
|
||||
// 明日方舟在异形屏上,有的地方是按比例缩放的,有的地方又是直接位移。没法整,这里简单粗暴一点截一个长条
|
||||
Rect dst = rect;
|
||||
if (m_scale_size.first != WindowWidthDefault) { // 说明是宽屏
|
||||
if (rect.width < WindowWidthDefault / 2) {
|
||||
if (rect.x + rect.width < WindowWidthDefault / 2) { // 整个矩形都在左半边
|
||||
if (rect.width <= WindowWidthDefault / 2) {
|
||||
if (rect.x + rect.width <= WindowWidthDefault / 2) { // 整个矩形都在左半边
|
||||
dst.x = 0;
|
||||
dst.width = m_scale_size.first / 2;
|
||||
}
|
||||
@@ -149,8 +149,8 @@ asst::Rect asst::Controller::shaped_correct(const Rect& rect) const
|
||||
}
|
||||
}
|
||||
else if (m_scale_size.second != WindowHeightDefault) { // 说明是偏方形屏
|
||||
if (rect.height < WindowHeightDefault / 2) {
|
||||
if (rect.y + rect.height < WindowHeightDefault / 2) { // 整个矩形都在上半边
|
||||
if (rect.height <= WindowHeightDefault / 2) {
|
||||
if (rect.y + rect.height <= WindowHeightDefault / 2) { // 整个矩形都在上半边
|
||||
dst.y = 0;
|
||||
dst.height = m_scale_size.second / 2;
|
||||
}
|
||||
|
||||
@@ -55,6 +55,11 @@ namespace asst
|
||||
Controller& operator=(const Controller&) = delete;
|
||||
Controller& operator=(Controller&&) = delete;
|
||||
|
||||
std::pair<int, int> get_scale_size() const noexcept
|
||||
{
|
||||
return m_scale_size;
|
||||
}
|
||||
|
||||
private:
|
||||
Controller();
|
||||
|
||||
|
||||
@@ -22,7 +22,8 @@ bool ProcessTask::run()
|
||||
};
|
||||
m_callback(AsstMsg::TaskStart, task_start_json, m_callback_arg);
|
||||
|
||||
ProcessTaskImageAnalyzer analyzer(ctrler.get_image(), m_cur_tasks_name);
|
||||
const auto& image = ctrler.get_image();
|
||||
ProcessTaskImageAnalyzer analyzer(image, m_cur_tasks_name);
|
||||
if (!analyzer.analyze()) {
|
||||
return false;
|
||||
}
|
||||
@@ -74,7 +75,7 @@ bool ProcessTask::run()
|
||||
exec_click_task(rect);
|
||||
break;
|
||||
case ProcessTaskAction::ClickRand: {
|
||||
static const Rect full_rect(0, 0, WindowWidthDefault, WindowHeightDefault);
|
||||
static const Rect full_rect(0, 0, image.cols, image.rows);
|
||||
exec_click_task(full_rect);
|
||||
} break;
|
||||
case ProcessTaskAction::SwipeToTheLeft:
|
||||
@@ -167,18 +168,17 @@ void asst::ProcessTask::exec_swipe_task(ProcessTaskAction action)
|
||||
if (!delay_random()) {
|
||||
return;
|
||||
}
|
||||
const auto&& [width, height] = ctrler.get_scale_size();
|
||||
|
||||
const static Rect right_rect = ctrler.shaped_correct(
|
||||
Rect(WindowWidthDefault * 0.8,
|
||||
WindowWidthDefault * 0.4,
|
||||
WindowWidthDefault * 0.1,
|
||||
WindowWidthDefault * 0.2));
|
||||
const static Rect right_rect(width * 0.8,
|
||||
height * 0.4,
|
||||
width * 0.1,
|
||||
height * 0.2);
|
||||
|
||||
const static Rect left_rect = ctrler.shaped_correct(
|
||||
Rect(WindowWidthDefault * 0.1,
|
||||
WindowWidthDefault * 0.4,
|
||||
WindowWidthDefault * 0.1,
|
||||
WindowWidthDefault * 0.2));
|
||||
const static Rect left_rect(width * 0.1,
|
||||
height * 0.4,
|
||||
width * 0.1,
|
||||
height * 0.2);
|
||||
|
||||
switch (action) {
|
||||
case asst::ProcessTaskAction::SwipeToTheLeft:
|
||||
|
||||
@@ -207,10 +207,7 @@ bool asst::TaskData::parse(const json::value& json)
|
||||
area_arr[3].as_integer());
|
||||
}
|
||||
else {
|
||||
task_info_ptr->roi = Rect(
|
||||
0, 0,
|
||||
WindowWidthDefault,
|
||||
WindowHeightDefault);
|
||||
task_info_ptr->roi = Rect();
|
||||
}
|
||||
|
||||
if (task_json.exist("next")) {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#pragma once
|
||||
#pragma once
|
||||
|
||||
namespace asst
|
||||
{
|
||||
constexpr static const char* Version = "v1.3.1";
|
||||
constexpr static const char* Version = "v1.3.2";
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user