forked from chudongjingling/open_code
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path精准滑动.lua
36 lines (35 loc) · 1.66 KB
/
精准滑动.lua
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
--该函数来自于 QQ 群 592860666,由开发者“一个人自嘲”分享
Direction = {left=0,right=1,up=2,down=3}
function slide(x1,y1,dist,dir,ms,step)
ms = ms or 100
step = step or 30
local x2,y2
if dir == Direction.up then
moveTo(x1,y1, x1, y1-dist,{["step"] = step,["ms"] = 50,["index"] = 1,["stop"] = false})
mSleep(ms)
moveTo(x1, y1-dist, x1, y1-dist+1,{["step"] = 1,["ms"] = 50,["index"] = 1,["stop"] = false})
mSleep(ms)
moveTo(x1, y1-dist+1, x1, y1-dist+2,{["step"] = 1,["ms"] = 50,["index"] = 1,["stop"] = false})
elseif dir == Direction.down then
moveTo(x1,y1, x1, y1+dist,{["step"] = step,["ms"] = 50,["index"] = 1,["stop"] = false})
mSleep(ms)
moveTo(x1, y1+dist, x1, y1+dist-1,{["step"] = 1,["ms"] = 50,["index"] = 1,["stop"] = false})
mSleep(ms)
moveTo(x1, y1+dist-1, x1, y1+dist-2,{["step"] = 1,["ms"] = 50,["index"] = 1,["stop"] = false})
elseif dir == Direction.left then
moveTo(x1,y1, x1-dist, y1,{["step"] = step,["ms"] = 50,["index"] = 1,["stop"] = false})
mSleep(ms)
moveTo(x1, y1, x1-dist+1, y1,{["step"] = 1,["ms"] = 50,["index"] = 1,["stop"] = false})
mSleep(ms)
moveTo( x1-dist+1, y1, x1-dist+2, y1,{["step"] = 1,["ms"] = 50,["index"] = 1,["stop"] = false})
elseif dir == Direction.right then
moveTo(x1,y1, x1+dist, y1,{["step"] = step,["ms"] = 50,["index"] = 1,["stop"] = false})
mSleep(ms)
moveTo(x1, y1, x1+dist-1, y1,{["step"] = 1,["ms"] = 50,["index"] = 1,["stop"] = false})
mSleep(ms)
moveTo( x1+dist-1, y1, x1+dist-2, y1,{["step"] = 1,["ms"] = 50,["index"] = 1,["stop"] = false})
else
nLog('滑动方向错误,必须为上下左右中的一个')
end
mSleep(500)
end