函数:readUIConfigFile 读取脚本配置文件

函数功能:读取脚本配置文件

引擎版本:仅支持 Android v3.1.7、iOS v3.1.1 及其以上版本

其他版本要求:仅支持 v1.3.3 及其以上版本 TSLib

函数方法

textList = readUIConfigFile(path)

参数 类型 必填 说明
path string 脚本配置文件路径,支持相对路径(仅支持 v1.3.8 及其以上版本 TSLib)及绝对路径
返回值 类型 说明
textList table 脚本配置文件内容

函数示例

require "TSLib1"--使用本函数库必须在脚本开头引用并将文件放到设备 lua 目录下
w,h = getScreenSize()
local path ="ceshi1.dat"
UINew("我的脚本","运行脚本","退出脚本",path,0,120,w*0.9,h*0.9,"255,231,186","255,231,186") --方式一,宽高为屏幕的 90%
UIRadio("rdo","选项1,选项2,选项3","1",-1,0,"",1,1)--3 个单选选项,默认选择选项 2
UIShow()
if rdo == "选项1" then--返回值为字符型
    toast("选项1")
elseif rdo == "选项2" then
    toast("选项2")
elseif rdo == "选项3" then
    toast("选项3")
end
if  TSVersions() > "1.3.2" then
    -- 相对路径 相对于触动数据目录下 config 文件夹路径
    textList = readUIConfigFile(path)
    for k, v in pairs(textList) do
        dialog(k..":"..v,5)
    end
    -- 绝对路径
    -- textList = readUIConfigFile(userPath() .."/config/" .. path)
    -- for k, v in pairs(textList) do
    --     dialog(k..":"..v,5)
    -- end
else
    dialog("TSLib 版本低,请下载 v1.3.3 及其以上版本 TSLib")
end

注意事项

  • 默认配置文件路径:

    ​触动精灵 iOS 配置文件目录:/var/mobile/Media/TouchSprite/config/

    ​触动精灵安卓配置文件目录:/mnt/sdcard/TouchSprite/config/

    ​iOS 小精灵配置文件目录:/var/mobile/Media/小精灵包名/config/

    ​安卓小精灵配置文件目录:/mnt/sdcard/

Copyright 北京帮你玩科技有限公司 2023 all right reserved,powered by Gitbook该文章修订时间: 2024-03-06 17:50:18

results matching ""

    No results matching ""