fix.修复收取信用、战斗结束会点到屏幕外面的问题

This commit is contained in:
MistEO
2021-09-28 14:08:38 +08:00
parent aaf59defb3
commit 5dd40f01e4
2 changed files with 24 additions and 14 deletions

View File

@@ -72,14 +72,14 @@
]
},
"ClickCornerAfterPRTS": {
"ClickCorner_Doc": "点击右下角,既不会点到掉落物品,又能点到蓝色开始按钮(为了容错)的一块位置。",
"ClickCorner_Doc": "点击屏幕右边,不会点到掉落物品,且不会关掉关卡选择的一块区域",
"algorithm": "justreturn",
"action": "clickRect",
"specificArea": [
1100,
700,
150,
30
1000,
1,
270,
340
],
"next": [
"EndOfAction",
@@ -103,15 +103,15 @@
]
},
"ClickCorner": {
"ClickCorner_Doc": "点击右下角,既不会点到掉落物品,又能点到蓝色开始按钮(为了容错)的一块位置。",
"ClickCorner_Doc": "点击屏幕右边,不会点到掉落物品,且不会关掉关卡选择的一块区域",
"algorithm": "justreturn",
"action": "clickRect",
"rearDelay": 2000,
"specificArea": [
1100,
700,
150,
30
1000,
1,
270,
340
],
"next": [
"Loading",
@@ -343,10 +343,10 @@
"algorithm": "justReturn",
"action": "clickRect",
"specificArea": [
1100,
700,
150,
30
1000,
1,
270,
340
],
"next": [
"Stop"

View File

@@ -416,6 +416,10 @@ int WinMacro::click(const Rect& rect, bool block)
int asst::WinMacro::click_without_scale(const Point& p, bool block)
{
if (p.x < 0 || p.x >= m_emulator_info.adb.display_width
|| p.y < 0 || p.y >= m_emulator_info.adb.display_height) {
DebugTraceError("click point out of range");
}
std::string cur_cmd = StringReplaceAll(m_emulator_info.adb.click, "[x]", std::to_string(p.x));
cur_cmd = StringReplaceAll(cur_cmd, "[y]", std::to_string(p.y));
int id = push_cmd(cur_cmd);
@@ -448,6 +452,12 @@ int asst::WinMacro::swipe(const Rect& r1, const Rect& r2, int duration, bool blo
int asst::WinMacro::swipe_without_scale(const Point& p1, const Point& p2, int duration, bool block)
{
if (p1.x < 0 || p1.x >= m_emulator_info.adb.display_width
|| p1.y < 0 || p1.y >= m_emulator_info.adb.display_height
|| p2.x < 0 || p2.x >= m_emulator_info.adb.display_width
|| p2.y < 0 || p2.y >= m_emulator_info.adb.display_height) {
DebugTraceError("swipe point out of range");
}
std::string cur_cmd = StringReplaceAll(m_emulator_info.adb.swipe, "[x1]", std::to_string(p1.x));
cur_cmd = StringReplaceAll(cur_cmd, "[y1]", std::to_string(p1.y));
cur_cmd = StringReplaceAll(cur_cmd, "[x2]", std::to_string(p2.x));