|
|
@@ -130,11 +130,12 @@ class Window(Handle):
|
|
|
logger.info(f"Mumu emulator head height: {height}")
|
|
|
return height
|
|
|
|
|
|
- def click_window_message(self, x: int, y: int):
|
|
|
+ def click_window_message(self, x: int, y: int, fast: bool = False):
|
|
|
"""
|
|
|
|
|
|
:param x:
|
|
|
:param y:
|
|
|
+ :param fast:
|
|
|
:return:
|
|
|
"""
|
|
|
# 我不知道为什么的使用的pywin32==306的版本会导致获取的图片的是(1024, 576)
|
|
|
@@ -143,7 +144,10 @@ class Window(Handle):
|
|
|
|
|
|
x = int(x / self.window_scale_rate)
|
|
|
y = int(y / self.window_scale_rate)
|
|
|
- # print(f"我点击的x:{x}, y:{y}")
|
|
|
+ if fast:
|
|
|
+ press_time: float = (random.randint(10, 40)) / 1000.0
|
|
|
+ else:
|
|
|
+ press_time: float = (random.randint(100, 200)) / 1000.0
|
|
|
emulator_type = len(self.control_handle_list)
|
|
|
if emulator_type == 2: # mumu模拟器
|
|
|
SendMessage(self.control_handle_list[0], WM_ACTIVATE, WA_ACTIVE, 0) # 激活窗口
|
|
|
@@ -151,20 +155,20 @@ class Window(Handle):
|
|
|
# SendMessage(self.control_handle_list[0], WM_LBUTTONDOWN, 0, MAKELONG(x, y+self.mumu_head_height)) # 模拟鼠标按下 先是父窗口 上面的框高度是57
|
|
|
# mumu12模拟器 V3.5.16 之后后可以用下面的方式
|
|
|
SendMessage(self.control_handle_list[1], WM_LBUTTONDOWN, 0, MAKELONG(x, y))
|
|
|
- time.sleep((random.randint(100, 200)) / 1000.0) # 点击弹起改为随机,时间100ms-200ms
|
|
|
+ time.sleep(press_time)
|
|
|
SendMessage(self.control_handle_list[1], WM_LBUTTONUP, 0, MAKELONG(x, y)) # 模拟鼠标弹起 后是子窗口
|
|
|
elif emulator_type > 2: # 夜神模拟器
|
|
|
SendMessage(self.control_handle_list[0], WM_LBUTTONDOWN, 0, MAKELONG(x, y)) # 模拟鼠标按下 先是父窗口 上面的框高度是57
|
|
|
SendMessage(self.control_handle_list[1], WM_LBUTTONDOWN, 0, MAKELONG(x, y))
|
|
|
SendMessage(self.control_handle_list[2], WM_LBUTTONDOWN, 0, MAKELONG(x, y))
|
|
|
SendMessage(self.control_handle_list[3], WM_LBUTTONDOWN, 0, MAKELONG(x, y))
|
|
|
- time.sleep((random.randint(100, 200)) / 1000.0) # 点击弹起改为随机,时间100ms-200ms
|
|
|
+ time.sleep(press_time)
|
|
|
SendMessage(self.control_handle_list[3], WM_LBUTTONUP, 0, MAKELONG(x, y)) # 模拟鼠标弹起 后是子窗口
|
|
|
elif emulator_type == 1: # 雷电模拟器
|
|
|
clickPos = MAKELONG(x, y)
|
|
|
- SendMessage(self.control_handle_list[0], WM_LBUTTONDOWN, 0, clickPos) # 模拟鼠标按下
|
|
|
- time.sleep((random.randint(100, 300)) / 1000.0) # 点击弹起改为随机,时间100ms-200ms
|
|
|
- SendMessage(self.control_handle_list[0], WM_LBUTTONUP, 0, clickPos) # 模拟鼠标弹起
|
|
|
+ SendMessage(self.control_handle_list[0], WM_LBUTTONDOWN, 0, clickPos)
|
|
|
+ time.sleep(press_time)
|
|
|
+ SendMessage(self.control_handle_list[0], WM_LBUTTONUP, 0, clickPos)
|
|
|
|
|
|
def long_click_window_message(self, x: int, y: int, duration: float):
|
|
|
"""
|