mirror of
https://github.com/ok-oldking/ok-wuthering-waves.git
synced 2025-06-01 16:35:57 +00:00
修复某些机器可能后台点击失效的问题
This commit is contained in:
parent
dab35fa013
commit
63d2f1ff4a
@ -1,4 +1,4 @@
|
|||||||
ok-script==0.0.270
|
ok-script==0.0.271
|
||||||
#rapidocr_onnxruntime
|
#rapidocr_onnxruntime
|
||||||
rapidocr_openvino
|
rapidocr_openvino
|
||||||
pySide6-Fluent-Widgets>=1.5.5
|
pySide6-Fluent-Widgets>=1.5.5
|
||||||
|
@ -1,9 +1,7 @@
|
|||||||
import math
|
|
||||||
import time
|
import time
|
||||||
|
|
||||||
import cv2
|
import cv2
|
||||||
import numpy as np
|
import numpy as np
|
||||||
import win32api
|
|
||||||
|
|
||||||
import re
|
import re
|
||||||
from ok.color.Color import get_connected_area_by_color, color_range_to_bound
|
from ok.color.Color import get_connected_area_by_color, color_range_to_bound
|
||||||
@ -469,26 +467,27 @@ class BaseCombatTask(BaseWWTask, FindFeature, OCR, CombatCheck):
|
|||||||
# Function to check if a component forms a ring
|
# Function to check if a component forms a ring
|
||||||
|
|
||||||
def mouse_reset(self):
|
def mouse_reset(self):
|
||||||
# logger.debug("mouse_reset")
|
# # logger.debug("mouse_reset")
|
||||||
try:
|
# try:
|
||||||
current_position = win32api.GetCursorPos()
|
# current_position = win32api.GetCursorPos()
|
||||||
if self.mouse_pos:
|
# if self.mouse_pos:
|
||||||
distance = math.sqrt(
|
# distance = math.sqrt(
|
||||||
(current_position[0] - self.mouse_pos[0]) ** 2
|
# (current_position[0] - self.mouse_pos[0]) ** 2
|
||||||
+ (current_position[1] - self.mouse_pos[1]) ** 2
|
# + (current_position[1] - self.mouse_pos[1]) ** 2
|
||||||
)
|
# )
|
||||||
if distance > 400:
|
# if distance > 400:
|
||||||
logger.debug(f'move mouse back {self.mouse_pos}')
|
# logger.debug(f'move mouse back {self.mouse_pos}')
|
||||||
win32api.SetCursorPos(self.mouse_pos)
|
# win32api.SetCursorPos(self.mouse_pos)
|
||||||
self.mouse_pos = None
|
# self.mouse_pos = None
|
||||||
if self.enabled:
|
# if self.enabled:
|
||||||
self.handler.post(self.mouse_reset, 1)
|
# self.handler.post(self.mouse_reset, 1)
|
||||||
return
|
# return
|
||||||
self.mouse_pos = current_position
|
# self.mouse_pos = current_position
|
||||||
if self.enabled:
|
# if self.enabled:
|
||||||
return self.handler.post(self.mouse_reset, 0.005)
|
# return self.handler.post(self.mouse_reset, 0.005)
|
||||||
except Exception as e:
|
# except Exception as e:
|
||||||
logger.error('mouse_reset exception', e)
|
# logger.error('mouse_reset exception', e)
|
||||||
|
pass
|
||||||
|
|
||||||
def count_rings(self, image, color_range, min_area):
|
def count_rings(self, image, color_range, min_area):
|
||||||
# Define the color range
|
# Define the color range
|
||||||
|
Loading…
x
Reference in New Issue
Block a user