-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrace_clubman.py
More file actions
165 lines (122 loc) · 3.16 KB
/
race_clubman.py
File metadata and controls
165 lines (122 loc) · 3.16 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
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
from util import *
from img import *
# just input esc to direct race until img continue image appear
def drag_race():
l("in drag race")
key_down(UP)
# key_down(CancelOrAccel)
# sleep(8)
#
# for i in range(1, 5):
# right()
# sleep(0.2)
while True:
if img_double_exists(IMG_CONTINUE_TEXT) == False:
l(f"detect image continue with text res : False")
sleep(1)
else:
l(f"detect image continue with text res : True")
l("game break")
key_up(UP)
# key_up(CancelOrAccel)
sleep(7)
return
# in the game calculate score page
def calc_dashboard():
try:
l("in dashboard ...")
# because image detect need 2s if not found
while img_double_exists(IMG_EXIT_TEXT) == False:
l("found exit button : False")
btn_confirm()
l("found exit button : True")
btn_confirm() # press exit
l("out dashboard")
except Exception as e:
print(e)
calc_dashboard()
def in_replay():
l("in start replay")
sleep(6)
while exists(IMG_RETRY) == False:
l("not found retry wait")
sleep(1)
l("found retry wait")
right()
sleep(0.2)
btn_confirm()
sleep(5)
# to start page
while exists(IMG_START) == False:
sleep(1)
btn_confirm()
l("out replay")
# return
# while True:
# img_replay = find_img(IMG_REPLAY)
# img_start = find_img(IMG_START)
# l(f"IMG_REPLAY {img_replay} , IMG_START {img_start}")
# if img_replay == False and img_start == False:
# btn_confirm()
# btn_confirm()
# l("not in replay page btn confirm twice")
# wait(2)
# continue
# if img_replay == True and img_start == True:
#
# ssbtn_confirm()
# l("out start replay")
# return
# if img_replay == True and img_start == False:
# right()
# wait(0.2)
# btn_confirm()
# wait(1)
# l("out replay page")
def race_clubman():
drag_race()
calc_dashboard()
in_replay()
race_clubman()
# race_clubman()
# almost samly process like race_clubman with race x
def race_x():
race_clubman()
# def dyna_replay():
# l("start replay")
# btn_cancel()
# sleep(0.2)
# btn_cancel()
# sleep(0.2)
# # in replay choose
# left()
# btn_confirm()
# while find_img(IMG_START) == False:
# sleep(1)
# btn_confirm()
# sleep(2)
# # to game run
def dyna_game():
sleep(5)
while True:
if find_img(IMG_CONTINUE_TEXT,True) == False:
l("detect_replay found res : False")
key_down(CancelOrAccel)
btn_confirm()
key_down(RIGHT)
sleep(0.05)
key_up(RIGHT)
sleep(2)
else:
l("game break")
key_up(RIGHT)
key_up(CancelOrAccel)
sleep(4)
break
def race_dyna():
dyna_game()
calc_dashboard()
in_replay()
race_dyna()
# dyna()
# race_x()