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

QQ登录

只需一步,快速开始

搜索
28 3
2022-4-3 09:19:17
很使用的 东西 收藏了
学习写法
2022-4-6 23:01:43
哇,好东西,特别是配置封装,谢谢分享
2022-4-6 23:03:39

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
2022-5-19 19:26:00


谢谢大佬分享 !
2022-5-23 01:58:11
findMultiColorT
2022-5-23 06:10:10
感谢楼主分享
2022-5-23 09:19:41

这个点击节点是不是直接可以用了?
2022-8-6 16:35:20
怎么不封装一个找图的?
2022-8-6 16:36:43
谢谢大佬!分享一个找图呗
您需要登录后才可以回帖 立即登录
高级模式
源码分享