函数:writeUIConfigFile 写入脚本配置文件
函数功能:写入脚本配置文件
引擎版本:仅支持 Android v3.1.7、iOS v3.1.1 及其以上版本
其他版本要求:仅支持 v1.3.3 及其以上版本 TSLib
函数方法
writeUIConfigFile(path,textList)
参数 | 类型 | 必填 | 说明 |
---|---|---|---|
path | string | 是 | 脚本配置文件路径,支持相对路径及绝对路径 |
textList | table | 是 | 需要写入的文件内容 |
函数用例
require "TSLib"--使用本函数库必须在脚本开头引用并将文件放到设备 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
textList = readUIConfigFile(path)
--需要保存的文件名称,保存在 config 文件夹下
path1="123.dat"
writeUIConfigFile(path1,textList)
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/