Merge remote-tracking branch 'origin/main'

# Conflicts:
#	Utils/ControlUtils.py
This commit is contained in:
2025-09-16 15:38:59 +08:00
3 changed files with 95 additions and 28 deletions

View File

@@ -1,4 +1,3 @@
import math
import random
import re
import time
@@ -178,3 +177,30 @@ class ControlUtils(object):
left_x = max(1, rect.x - 20)
center_y = rect.y + rect.height // 2
session.tap(left_x, center_y)
# 点击一个随机范围
@classmethod
def tap_mini_cluster(cls, center_x: int, center_y: int, session, points=5, duration_ms=60):
"""
以 (center_x, center_y) 为中心,在 3×3 像素范围内摆 `points` 个邻近坐标,
一次性同时按下,持续 `duration_ms` 后抬起。
"""
# 1. 生成邻像素坐标±1 像素内)
cluster = []
for i in range(points):
dx = random.randint(-1, 1)
dy = random.randint(-1, 1)
cluster.append((center_x + dx, center_y + dy))
# 2. 随机持续时间 50100 ms
duration_s = random.randint(50, 100) / 1000.0
# 3. 下发多点触控
session.tap_hold(cluster, duration=duration_s)
# 检测五分钟前和当前的状态是否相同
# @classmethod
# def compareCurrentWithPreviousState(cls,xml):