函数:multiColor 多点比色
函数名称:多点比色
函数功能:判断多个坐标相应颜色是否成立,成立返回 true,不成立返回 false
函数方法
bool = multiColor(array,dim,flag)
必填
参数 | 类型 | 说明 |
---|---|---|
array | table | 需要判断的颜色数组 |
选填
参数 | 类型 | 说明 |
---|---|---|
dim | number | 精度,不写默认为 90 |
flag | boolean | 是否保持屏幕,默认是 true, 保持屏幕 - true,取消保持屏幕 - false |
返回值
返回值 | 类型 | 说明 |
---|---|---|
bool | boolean | true - 全部坐标和颜色一致,false - 坐标和颜色值不符 |
函数用例
方式一
--全部坐标点和颜色一致时返回 true,== true 可省略不写
require "TSLib"
if multiColor({{78,272,0x00a8e9},{120,44,0xffffff},{122,197,0x00a8e9}},90,false) == true then
tap(x,y)
mSleep(50)
toast("找到颜色并点击")
mSleep(3000)
end
方式二(table 格式)
require "TSLib"
local options = {
["dim"] = 90,
["flag"] = false
}
local color_table = {
{ 45, 171, 0xff5722},
{ 45, 168, 0xfce6a8},
{ 45, 174, 0xfce6a8},
}
if multiColor(color_table,options) then--全部坐标点和颜色一致时返回 true,== true 可省略不写
toast("找到颜色")
else
toast("未找到颜色")
end
注意事项
array 为 table 表,坐标颜色值数量任意(填一个坐标和颜色值时为单点找色),可配合触动精灵抓色器自动生成代码使用。
触动智控已内置 TSLib 库,无需下载。
函数:toast 仅支持安卓,更多注意事项详见函数:toast 吐司提示(仅支持 Android)。