-----------------------------------------------------------------------
-- 本文件为脚本入口文件,请不要删除
-- 脚本从第一行开始执行,中间定义的函数只有调用的时候才执行
-----------------------------------------------------------------------
-- 在这里添加你的脚本代码
function main()
local w,h = getResolutionRatio()
str="分辨率为"..w.."*"..h
toast(str);
tm=os.time();
--[[ 480*854 虚拟按键
x_qd,y_qd=62,597
jl=60;
quyu={28,209,450,631};]]
if w==320 and h==480 then
x_qd,y_qd=30,393
jl=45;
quyu={2,104,315,419};
elseif w==640 and h==960 then
x_qd,y_qd=57,786;
jl=90;
quyu={5,209,633,839};
elseif w==480 and h==800 then
x_qd,y_qd=40,630
jl=68;
quyu={1,198,473,670};
elseif w==480 and h==854 then
x_qd,y_qd=43,655
jl=67;
quyu={3,226,474,693};
elseif w==800 and h==1280 then
x_qd,y_qd=105,985
jl=101;
quyu={50,340,745,1035};
elseif w==720 and h==1280 then
x_qd,y_qd=55,982
jl=102;
quyu={5,334,711,1043};
elseif w==540 and h==960 then
x_qd,y_qd=45,745
jl=73
quyu={2,250,530,785};
else
toast("暂不支持此分辨率,请到www.jbelf.com反馈")
exit();
end
function bjcolor(x2,y2,r,g,b,wc)
wc=wc or 0;
if x2<quyu[1] or x2>quyu[3] or y2<quyu[2] or y2>quyu[4] then
return false
end
local r1,g1,b1=getColorRGB(x2,y2);
if (r<=r1+wc and r>=r1-wc) and (g<=g1+wc and g>=g1-wc) and (b<=b1+wc and b>=b1-wc) then
return true
else
return false
end
end
function click(x,y)
touchDown(x, y,0);
sleep(40);
touchUp(0);
end
repeat
local xt,yt=0,0;
for i=0,6 do
for j=0,6 do
xt=x_qd+jl*j;
yt=y_qd-jl*i;
r,g,b=getColorRGB(xt,yt);
if i<6 and bjcolor(xt,yt-jl,r,g,b,10)==false then--上
if bjcolor(xt-jl,yt-jl,r,g,b,10) and (bjcolor(xt+jl,yt-jl,r,g,b,10) or bjcolor(xt-2*jl,yt-jl,r,g,b,10)) or (bjcolor(xt+jl,yt-jl,r,g,b,10) and bjcolor(xt+2*jl,yt-jl,r,g,b,10)) or (bjcolor(xt,yt-2*jl,r,g,b,10) and bjcolor(xt,yt-3*jl,r,g,b,10)) then
click(xt,yt);
click(xt,yt-jl);
end
end
if i>0 and bjcolor(xt,yt+jl,r,g,b,10)==false then--下
if bjcolor(xt-jl,yt+jl,r,g,b,10) and (bjcolor(xt+jl,yt+jl,r,g,b,10) or bjcolor(xt-2*jl,yt+jl,r,g,b,10)) or (bjcolor(xt+jl,yt+jl,r,g,b,10) and bjcolor(xt+2*jl,yt+jl,r,g,b,10)) or (bjcolor(xt,yt+2*jl,r,g,b,10) and bjcolor(xt,yt+3*jl,r,g,b,10)) then
click(xt,yt);
click(xt,yt+jl);
end
end
if j>0 and bjcolor(xt-jl,yt,r,g,b,10)==false then--左
if bjcolor(xt-jl,yt+jl,r,g,b,10) and (bjcolor(xt-jl,yt+2*jl,r,g,b,10) or bjcolor(xt-jl,yt-jl,r,g,b,10)) or (bjcolor(xt-jl,yt-jl,r,g,b,10) and bjcolor(xt-jl,yt-2*jl,r,g,b,10)) or (bjcolor(xt-2*jl,yt,r,g,b,10) and bjcolor(xt-3*jl,yt,r,g,b,10)) then
click(xt,yt);
click(xt-jl,yt);
end
end
if j<6 and bjcolor(xt+jl,yt,r,g,b,10)==false then--右
if bjcolor(xt+jl,yt+jl,r,g,b,10) and (bjcolor(xt+jl,yt+2*jl,r,g,b,10) or bjcolor(xt+jl,yt-jl,r,g,b,10)) or (bjcolor(xt+jl,yt-jl,r,g,b,10) and bjcolor(xt+jl,yt-2*jl,r,g,b,10)) or (bjcolor(xt+2*jl,yt,r,g,b,10) and bjcolor(xt+3*jl,yt,r,g,b,10)) then
click(xt,yt);
click(xt+jl,yt);
end
end
end
end
tm2=os.time();
if tm2-tm>70000 then --改这个数字就可以设置脚本运行时间了,以秒为单位!意思为启动脚本70秒后自动停止
-- log("time is over"..tm2);检测运行时间
break
end
until false
end
|