键盘按键从 pyautogui 迁移到 pydirectinput

This commit is contained in:
王鹏
2026-03-25 16:09:10 +08:00
parent 7e26264463
commit 88c8201009
12 changed files with 88 additions and 82 deletions

View File

@@ -1,6 +1,6 @@
import time
import math
import pyautogui
import pydirectinput
class DeathManager:
@@ -24,7 +24,7 @@ class DeathManager:
self.corpse_pos = (state['x'], state['y'])
self.is_running_to_corpse = True
print(f">>> [系统] 记录死亡坐标: {self.corpse_pos},准备释放灵魂...")
pyautogui.press('9') # 绑定宏: /run RepopMe()
pydirectinput.press('9') # 绑定宏: /run RepopMe()
time.sleep(5) # 等待加载界面
def run_to_corpse(self, state):
@@ -36,7 +36,7 @@ class DeathManager:
# 如果距离尸体很近0.005 约等于 10-20 码)
if is_arrived:
print(">>> 已到达尸体附近,尝试复活...")
pyautogui.press('0') # 绑定宏: /run RetrieveCorpse()
pydirectinput.press('0') # 绑定宏: /run RetrieveCorpse()
time.sleep(5)
self.is_running_to_corpse = False
self.corpse_pos = None