函数:multiColTap 多点比色点击

函数名称:多点比色点击

函数功能:判断多个坐标相应颜色是否成立,成立则点击最后一个坐标

函数方法

bool = multiColTap(array,dim,flag)

必填

参数 类型 说明
array table 需要判断的颜色数组,使用抓色器获取

选填

参数 类型 说明
dim number 精度,不写默认为 90
flag boolean 是否保持屏幕
默认是 true,true - 保持屏幕 - true,false - 取消保持屏幕

返回值

返回值 类型 说明
bool boolean true - 全部坐标和颜色一致,false - 坐标和颜色值不符

函数用例

方式一

require "TSLib"
local color_table = {
    {   45,  171, 0xff5722},
    {   45,  168, 0xfce6a8},
    {   45,  174, 0xfce6a8},
    }
--全部坐标点和颜色一致时返回 true,== true 可省略不写
if multiColTap(color_table,90,false) then
    toast("找到颜色")
else
    toast("未找到颜色")
end

方式二(table 格式)

require "TSLib"
local options = {
    ["dim"] = 90,
    ["flag"] = true
}
local color_table = {
    {   45,  171, 0xff5722},
    {   45,  168, 0xfce6a8},
    {   45,  174, 0xfce6a8},
}
if multiColTap(color_table,options) then--判断多个坐标相应颜色是否成立,成立则点击最后一个坐标
    toast("找到颜色")
else
    toast("未找到颜色")
end

点击视频查看演示效果。

注意事项

  • array 为 table 表,坐标颜色值数量任意(填一个坐标和颜色值时为单点找色),可配合触动精灵抓色器自动生成代码使用

  • 触动智控已内置 TSLib 库,无需下载。

  • 函数:toast 仅支持安卓,更多注意事项详见函数:toast 吐司提示(仅支持 Android)

Copyright 北京帮你玩科技有限公司 2024 all right reserved,powered by Gitbook该文章修订时间: 2025-03-04 15:43:41

results matching ""

    No results matching ""