-
Notifications
You must be signed in to change notification settings - Fork 16
/
只收货不换建筑分辨率适配版2.2
183 lines (167 loc) · 4.89 KB
/
只收货不换建筑分辨率适配版2.2
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
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
'云手机,适用分辨率设置: 720*1280 ,1080*1920
'代码参考自nga fetztech 模拟器代码
Dim screen_x = GetScreenX(), screen_y = GetScreenY()
'房子坐标
Dim hx() ={180, 360, 540, 180, 360, 540, 180, 360, 540}
Dim hy() ={870, 760, 680, 690, 580, 500, 510, 400, 320}
'小火车坐标
Dim tx() ={430, 530, 630}
Dim ty() ={1100, 1040, 980}
'功能性坐标
Dim fx()={360, 120, 630, 600, 360, 50, 180}
Dim fy()={800, 1200, 780, 1200, 1200, 100, 160}
'坐标变换
for j = 0 to 8
hx(j)=hx(j)*screen_x/720
hy(j)=hy(j)*screen_y/1280
tx(j)=tx(j)*screen_x/720
ty(j)=ty(j)*screen_y/1280
fx(j)=fx(j)*screen_x/720
fy(j)=fy(j)*screen_y/1280
j=j+1
next
'功能性坐标定义
Dim blan = {fx(0), fy(0)} '空白处,屏幕正中心
Dim inst = {fx(1), fy(1)} '修建按钮坐标,屏幕左下
Dim edit = {fx(2), fy(2)} '编辑按钮坐标
Dim upgr = {fx(3), fy(3)} '升级按钮坐标
Dim chan = {fx(4), fy(4)} '替换按钮坐标
Dim b = {fx(5), fy(5)} '选择区域时用到的坐标偏移量
Dim stra = {fx(6), fy(6)} '政策中心起始点
dim id=2 '指定升级建筑id,从左至右,从下到上依次为0~8
Function money() '收钱
For i=0 to 8
Tap hx(i), hy(i)
Delay 1000
Next
End Function
Function upgrade(id) '升级大哥
Tap edit(0), edit(1)
Delay 100
Tap hx(id), hy(id ) '大哥
Delay 500
Tap upgr(0), upgr(1)
Delay 300
Tap edit(0), edit(1)
Delay 100
End Function
Function loadtrain() '卸货
Dim ssx, ssy, sbx,sby,ax, ay, flag
flag = 0
For i = 0 To 2
/*
// 只收橙色,判断是否有紫色蓝色
FindColor tx(i)-b(0), ty(i) -b(1), tx(i), ty(i) - 0.5*b(1), "3CC1FF", 1, 1, ssx, ssy
FindColor tx(i)-b(0), ty(i) -b(1), tx(i), ty(i) - 0.5*b(1), "EAC254|FF989A", 1, 1, sbx, sby
*/
//只收橙色紫色,判断是否有蓝色
FindColor tx(i)-b(0), ty(i) -b(1), tx(i), ty(i) - 0.5*b(1), "3CC1FF|FF989A",1,1, ssx, ssy
FindColor tx(i)-b(0), ty(i) -b(1), tx(i), ty(i) - 0.5*b(1), "EAC254", 1, 1, sbx, sby
// ssx = 1 '收所有
// sbx= -1
If sbx > - 1 Then
flag = 1
end if
If ssx > - 1 Then
While True
TouchDown tx(i), ty(i)
Delay 500
FindColor hx(0)*.5, hy(8)*.5, hx(0)*3.5, hy(0), "44E167|4AD566|7FFD8E", 1, 0.98, ax, ay
If ax > -1 and ay > -1 Then
TouchMove ax, ay
Delay 100
TouchUp
Delay 100
Else
TouchUp
Delay 100
Goto xx
End If
Wend
End If
Rem xx
Next
loadtrain = flag
End Function
Dim package = "com.tencent.jgm"
Function RestartGame() '重启游戏
TracePrint "重启游戏"
Delay 500
KillApp package
Delay 1000
RunApp package
Delay 5000
End Function
'凌晨重启-注意模拟器时间要与实际之间一致
Function MidNightRestart()
Dim hourNow = datetime.hour()
Dim minuteNow = datetime.minute()
If hourNow = 0 and minuteNow <= 3 Then
TracePrint "当前时间:",hourNow,"时",minuteNow,"分,重启家国梦"
RestartGame() '杀后台
End If
End Function
function strategy() '升级政策
tap stra(0), stra(1) '打开政策中心界面
delay 2000
tap inst(0), inst(1)*.9 ' 确定已完成的政策
delay 1000
while true ' 寻找可升级政策
FindColor stra(0)*.5, 8*b(0), stra(0)*2.4, 7*b(1), "03fe01|07fc07", 0, 0.98, stx, sty
if stx < 0 then
touchdown blan(0), 8*b(1)
delay 500
touchmove blan(0), 4.8*b(1)
delay 300
touchup
delay 500
else
delay 500
tap stx+2*b(0), sty+.6*b(1) '选择第一个可升级项
delay 1000
tap blan(0), 8*b(1) ' 升级
delay 500
tap inst(0), inst(1) '退出政策界面
delay 500
tap inst(0), inst(1) '退出政策界面
exit while
end if
wend
end function
'主程序
While True
Dim m=1, n = 1
Dim iter = 60
While n < iter
Dim res
Dim cx1, cy1, stx, sty
MidNightRestart()
delay 1000
FindColor stra(0), stra(1)- 0.3*b(1), stra(0)+b(0), stra(1) + 0.3*b(1), "00d900" , 0, 0.98, stx, sty
if stx > -1 then
strategy()
end if
/*
while true
delay 1000
tap tx(0)-b(0), ty(0) - b(1)
wend
*/
FindColor tx(0)-b(0), ty(0) -b(1), tx(0), ty(0) - 0.5*b(1), "EAC254|FF989A|3CC1FF", 1, 1, cx1, cy1
If cx1<0 And cy1< 0 Then
If n = iter - 1 Then
tap inst(0), inst(1) '增加容错率,防止 弹出 通知 卡死
money ()'收钱,注释掉此行后不进行收钱
upgrade (id) '升级建筑,注释掉此行后不进行升级
Else
Delay 1000
End If
Else
res = loadtrain() '卸货
If res = 1 Then
RestartGame() '重新登陆
End If
End If
n = n + 1
Wend
Wend