OnmyojiAutoScript
OnmyojiAutoScript copied to clipboard
每月神秘图案 所使用的draw_adb 無效,因 LDPlayer9 不支援 motionevent 這個ADB CMD,建議改用minitouch 達成
在提问之前...
- [x] 我已经搜索了现有的 issues
- [x] 我在提问题之前至少花费了 5 分钟来思考和准备
- [x] 我已经阅读了文档中的 常见问题(FAQ)
- [x] 这个问题出现了至少三次,不是偶发的
- [ ] 我使用 OAS 的 dev 分支
描述你的问题
我在測試每月神秘图案時 注意到 他跑了self.device.draw_adb(current_pattern) 但是遊戲內 沒劃出任何東西
因為 LDPlayer9 不support motionevent CMD
新增以下LOG 發現他會出現Unknown command
def draw_adb(self, points: list, interval=0.01):
"""
通过多个点画连续线段,模拟连续触摸绘制
Args:
points: 点的列表,格式为 [(x1, y1), (x2, y2), ...]
interval: 移动间隔时间(秒)
"""
if len(points) < 2:
logger.warning('至少需要2个点来画线')
return
# 平滑路径
smooth_points = smooth_path(points)
start_point = smooth_points[0]
# 按下起始点
logger.info(f'ADB Starting point: {start_point}')
result = self.adb_shell(['input', 'motionevent', 'DOWN', str(start_point[0]), str(start_point[1])])
logger.info(f'ADB DOWN result: {result}')
INFO 2025-10-10 09:47:51.602 │ Execute shell: ['input', 'motionevent', 'MOVE', '791', '183']
INFO 2025-10-10 09:47:51.698 │ Shell output: Error: Unknown command: motionevent
我有幾種想法
- 新增draw_minitouch 在module\device\method\minitouch.py ,並把draw_adb 改成draw_minitouch.
- 新增draw 在module\device\control.py 裡面,並為所有method 新增各自的draw_adb, draw_minitouch ...
目前測試draw_minitouch是OK的 module\device\method\minitouch.py
@retry
def draw_minitouch(self, points: list):
"""
Draw through given points.
Args: points: List of points [(x1, y1), (x2, y2), ...]
"""
if len(points) < 2:
logger.warning('Draw needs at least 2 points')
return
builder = self.minitouch_builder
# click down at the first point
builder.down(*points[0]).commit()
self.minitouch_send()
for i in range(len(points) - 1):
# insert intermediate points for smooth movement
segment_points = insert_swipe(
p0=points[i],
p3=points[i + 1]
)
# move through all intermediate points in the segment
for point in segment_points[1:]:
builder.move(*point).commit().wait(10)
# send all move commands at once
self.minitouch_send()
# lift up at the last point
builder.up().commit()
self.minitouch_send()
如何复现
使用不支援 motionevent 的模擬器(如 LDPlayer9)
執行每日琐事,
需要再CODE 裡面強制把draw_mystery_pattern 設定為TRUE 不然他是隱藏的BOOL
self.summon_one(draw_mystery_pattern=True)
觀察繪製失敗,沒有任何FAIL LOG 出現
需要自行新增以下LOG 才能知道有Shell output: Error: Unknown command: motionevent
result = self.adb_shell(['input', 'motionevent', 'DOWN', str(start_point[0]), str(start_point[1])])
logger.info(f'ADB DOWN result: {result}')
预期行为
No response
相关 Logs
截图
No response
还有别的吗?
No response