This repository was archived by the owner on Apr 24, 2024. It is now read-only.
Repository navigation
Expand file tree
/
Copy pathFind.py
More file actions
96 lines (79 loc) · 3.2 KB
/
Copy pathFind.py
File metadata and controls
96 lines (79 loc) · 3.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
# -*- coding:utf-8 -*-
from PySide2 import QtCore
from DataUnCopy import Space
from Process.PersonMove import Move
from Process.Reset import Api_reset_usualy_play
class Find(QtCore.QObject):
def __init__(self):
super().__init__()
self.OnClick = None
Space['Control_Api']["Move"] = Move() # 定义一个移动器
self.Image_Width = Space["Script"]["Setting"]["ImageSize"][0]
self.control_api = {
'play': Space["CoreControl"].play.emit,
'sound': Space["CoreControl"].sound.emit,
'PushMsg': self.Api_PushMsg,
'ActionGroup': self.Api_ActionGroup,
'Import': self.Api_Import,
'Move':Space['Control_Api']["Move"].Move,
'Reset':self.Api_Reset
}
def Api_Reset(self,Struct):
Work = {
"usualy_play":Api_reset_usualy_play
}
Work[Struct["Target"]](Struct)
def Api_ActionGroup(self, Action):
Actions = Space["Script"]["ActionGroup"][Action]
for Order in Actions:
if (Order["From"] == "ActionGroup" and Order["Action"] == Action):
continue
# 防止有人嵌套ActionGroup同名Action,使程序进入死循环,
self.control_api[Order["From"]](Order["Action"])
def Api_Import(self,Action):
if Action["module"] in Space["Plugin"]:
Space["Plugin"][Action["module"]].Call(Action)
def Api_PushMsg(self, Action):
try:
Title = Action["Title"]
except:
Title = ''
try:
Msg = Action["Msg"]
except:
Msg = ''
Space["CoreControl"].MsgPush.emit(Title, Msg)
def ClickCheck(self, types):
try:
self.OnClick = Space["Script"]["OnClick"]
LeftWhat = self.OnClick[types]
if not LeftWhat[0]:
return False
except:
return False
return True
# 检查当前鼠标事件是否在Script中存在
def LeftClick(self, x, y, Change):
if self.ClickCheck("LeftClick"):
for Actions in self.OnClick["LeftClick"][1:]:
self.Action_run(x=x, y=y, Change=Change, Action=Actions)
def LeftRelease(self, x, y, Change):
if self.ClickCheck("LeftRelease"):
for Actions in self.OnClick["LeftRelease"][1:]:
self.Action_run(x=x, y=y, Change=Change, Action=Actions)
def Action_run(self, Action, x, y, Change):
Centre_Image_Width = self.Image_Width / 2
locate = Action["locate"]
if locate[0]:
locate_tmp = []
for i in locate[1:]:
locate_tmp.append(i * Change)
left = locate_tmp[0]
right = locate_tmp[1]
if (Space['CommonSet']["mirrored"]):
left = 2 * Centre_Image_Width * Change - locate_tmp[1] # 左x坐标
right = 2 * Centre_Image_Width * Change - locate_tmp[0] # 右x坐标
# print(left,right) # 输出左、右限制的x坐标
if not (left <= x <= right and locate_tmp[2] <= y <= locate_tmp[3]):
return 'Your mouse is not in place [play]'
self.control_api[Action["From"]](Action["Action"])