发帖
充值
 找回密码
 立即注册

QQ登录

只需一步,快速开始

搜索
首页源码分享封装的一些函数新手拿来用吧

封装的一些函数新手拿来用吧

28
回复
22412
查看
[ 复制链接 ]
已绑定手机
已实名认证

7

主题

11

回帖

284

积分

中级会员

积分
284
QQ
2021-10-22 01:29:38 显示全部楼层 阅读模式
function 判断前台(包名)
        local pkg = 包名
        local ret = appIsFront(pkg)
        if ret == false then
                调试("包名不在前台")
                return true
        else
                调试("在前台")
                return false
        end
end
function 随机数(最大数,最小数)
        local r = rnd(最大数,最小数)
end
function 输入文字(内容)
        inputText(内容,true)
        setIme(false) --切换系统默认输入法
end
function 划动(x1,y1,x2,y2,s)
        swipe(x1,y1,x2,y2,s)
end

function 调试(内容)
        print(内容)
end
function 调试坐标(x,y)
        print(x,y)
end

function 显示(文字)
        toast(文字,0,0,12)
end
function 点击(x,y)
        tap(x,y)
        显示("点:",x,y)
end
function 找色(v,s)
        a=1
        x,y = findMultiColor (v[1],v[2],v[3],v[4],v[5],v[6],v[7],v[8])
        if x>-1 and y >-1 then
                if s==a then
                        点击(x,y)
                        调试坐标(x,y)
                        return x,y
                else
                        调试坐标(x,y)
                        return x,y
                end
        else
                return false
        end
end
function 比色(v)
        ret = cmpColorEx(v[1],v[2])
        if ret==1 then
                return true
        else
                return false
        end
end

function 找节点点击(v)
        local ret = nodeLib.findOne(v[2],v[3])
        if ret ~= nil then
                nodeLib.click(ret)
                return true
        else
                return false
        end
end
function 找节点(v)
        local ret = nodeLib.findOne(v[2],v[3])
        if ret ~= nil then
                return true
        else
                return false
        end
end
function 顺序找节点(v)
        local ret = nodeLib.findByIndex(v[1])
        if ret ~= nil then
                return true
        else
                return false
        end
end
function 顺序找节点点击(v)
        local ret = nodeLib.findByIndex(v[1])
        if ret ~= nil then
                nodeLib.click(ret)
                return true
        else
                return false
        end
end
function 屏幕分辨率(w,h)
        w,h = getDisplaySize()
        print(w,h)
       
end
function 找坐标(x1,y1,x2,y2)
       
        local r = ocrEx(x1,y1,x2,y2)
        local a,z = "41","66"
        if r ~= nil then
                local 坐标 = r[1].text
                local 查找逗号 = string.find(坐标, ":", 1)
                if 查找逗号 ~= nil then
                        local 分割坐标 = splitStr(坐标,":")
                        y =分割坐标[2]
                        x =分割坐标[1]
                        print(x)
                        print(y)
                        if x == a and y == z then
                                print("找到")
                                return true
                        else
                                print("没有找到")
                                return false
                        end
                end
        end
end
function 识别点击(x1,y1,x2,y2,x3,y3,文字)
       
        识别=ocrEx(x1,y1,x2,y2)
       
        if 识别==int then
                return false
        else
                print(识别[1].text)
        if 识别[1].text==文字 then
                        调试("找到")
                        点击(x3,y3)
                        return true
                else
                       
                        调试("没有找到")
                        return false
                end
               
        end
       
       
end
function 识别点击(x1,y1,x2,y2,文字)
       
        识别=ocrEx(x1,y1,x2,y2)
       
        if 识别==int then
                return false
        else
                print(识别[1].text)
        if 识别[1].text==文字 then
                        调试("找到")
                       
                        return true
                else
                       
                        调试("没有找到")
                        return false
                end
               
        end
       
       
end

使用道具
举报

2

主题

40

回帖

1041

积分

金牌会员

积分
1041
回复
使用道具
举报

4

主题

16

回帖

138

积分

注册会员

积分
138
学习写法
回复
使用道具
举报

10

主题

50

回帖

575

积分

高级会员

积分
575
学习学习
回复
使用道具
举报

0

主题

26

回帖

50

积分

注册会员

积分
50
学习学习
回复
使用道具
举报

1

主题

17

回帖

24

积分

新手上路

积分
24
666666666666666666666
回复
使用道具
举报

0

主题

24

回帖

81

积分

注册会员

积分
81
这个点击节点是不是直接可以用了?
回复
使用道具
举报

4

主题

84

回帖

309

积分

中级会员

积分
309
QQ
666666666366

安卓脚本,苹果脚本
脚本定制接单;自动化操作;手动能完成的都能做;
Q: 9451045
回复
使用道具
举报

0

主题

2

回帖

8

积分

新手上路

积分
8
这个好用
回复
使用道具
举报

1

主题

15

回帖

74

积分

注册会员

积分
74
调试和显示可以放在一起. 然后可以加个随机点击.
回复
使用道具
举报
123下一页
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则