lae下载地址:html
https://github.com/ouloba/laetool.gitgit
lae下载地址(国内):https://pan.baidu.com/s/1ckMy0Qgithub
相关视频:浏览器
http://www.tudou.com/listplay/aly7NDWz_sQ/AaqZ81jIt-k.html编辑器
教程:ide
关于lae工具问题单独介绍!
--lua代码
lua编辑器 csdn下载 github下载地址,csdn没有更新版本功能,这里改成git,可实时得到最新的版本 下载地址:
--目录浏览器下载地址
https://github.com/ouloba/folder-explorer.git
--辅助接口 LXZDoFile("LXZHelper.lua"); LXZDoFile("serial.lua"); --每帧调用,root窗口status中IsActive设置为true,便可触发OnUpdate事件。 local function OnUpdate(window, msg, sender) UpdateWindow(); end --更新目录子目录或者文件列表 local function UpdateDirectry(dir) local root = HelperGetRoot(); --set current dir. lfs.chdir(dir); HelperSetWindowText(root:GetLXZWindow("directry"), dir); -- local items = root:GetLXZWindow("folders:area:items"); --目录文件容器 local item = root:GetLXZWindow("folders:item"); --目录文件项 local path = lfs.currentdir(); --清除容器中内容 items:ClearChilds(); --遍历该目录下的子目录文件 local cnt = 0; for file in lfs.dir(lfs.currentdir()) do local wnd = item:Clone(); --克隆一个目录文件项"folders:item" wnd:Show(); --显示 HelperSetWindowText(wnd:GetChild("text"), file); --设置目录或者文件名 items:AddChild(wnd); --加入items容器中 local f = path.."\\"..file; local attr = lfs.attributes(f); if attr and attr.mode=="directory" then wnd:GetChild("icon"):SetState(0); --经过0状态设置目录图标 else wnd:GetChild("icon"):SetState(1);--经过1状态设置文件名图标 end cnt=cnt+1; end --若是没法访问该目录,则添加"."与".." if cnt==0 then local wnd = item:Clone(); wnd:Show(); HelperSetWindowText(wnd:GetChild("text"), "."); items:AddChild(wnd); local wnd = item:Clone(); wnd:Show(); HelperSetWindowText(wnd:GetChild("text"), ".."); items:AddChild(wnd); end --垂直滚动条适应内容大小。 local msg = CLXZMessage:new_local(); local wnd = root:GetLXZWindow("folders:vertical slider"); wnd:ProcMessage("OnReset", msg, wnd); end --点击目录或者文件项 local function OnClickItem(window, msg, sender) local file=HelperGetWindowText(sender:GetChild("text")); local path = lfs.currentdir(); local f = path.."\\"..file; local attr,err = lfs.attributes (f) if attr== nil then LXZMessageBox("error:"..err); return; end -- LXZMessageBox("type(attr)"..type(attr).."f:"..f) assert (type(attr) == "table"); if attr.mode == "directory" then --若是是目录 UpdateDirectry(f); end end --ui加载时触发该事件 local function OnLoad(window, msg, sender) local root = HelperGetRoot(); --set default. local default_dir = "c:\\"; HelperSetWindowText(root:GetLXZWindow("directry"), default_dir); --set folder list. UpdateDirectry(default_dir); end --事件与接口绑定 local event_callback = {} event_callback ["OnUpdate"] = OnUpdate; event_callback ["OnLoad"] = OnLoad; event_callback ["OnClickItem"] = OnClickItem; --事件分发器 function main_dispacher(window, cmd, msg, sender) --- LXZAPI_OutputDebugStr("cmd 1:"..cmd); if(event_callback[cmd] ~= nil) then -- LXZAPI_OutputDebugStr("cmd 2:"..cmd); event_callback[cmd](window, msg, sender); end end
增长权限、建立时间、修改时间等
--增长lua代码
if attr then HelperSetWindowText(wnd:GetChild("access time"), os.date("%c", attr.access) ); HelperSetWindowText(wnd:GetChild("modify time"), os.date("%c", attr.modification)); HelperSetWindowText(wnd:GetChild("change time"), os.date("%c", attr.change)); HelperSetWindowText(wnd:GetChild("permissions"), attr.permissions); end
--界面修改以下
--增长浏览图片的功能
--修改lua代码,增长事件
--获取扩展名 function getextension(filename) return filename:match(".+%.(%w+)$") end --鼠标进入 local function OnMouseEnterItem(window, msg, sender) local file=HelperGetWindowText(sender:GetChild("text")); local path = lfs.currentdir(); local f = path.."\\"..file; local attr,err = lfs.attributes (f) if attr== nil then LXZMessageBox("error:"..err); return; end local root = HelperGetRoot(); assert (type(attr) == "table"); local ext = getextension(file); LXZAPI_OutputDebugStr("OnMouseEnterItem:"..f.." mode:"..attr.mode); if attr.mode == "file" and (ext=="png" or ext=="PNG") then --若是是图片文件 LXZAPI_OutputDebugStr("OnMouseEnterItem:"..f.." ext:"..ext.." mode:"..attr.mode); local wnd = root:GetLXZWindow ("folders:show picture"); HelperSetWindowPictureFile(wnd,f); wnd:Show(); HelperCoroutine(function(thread) AddWndUpdateFunc(wnd, EffectFaceOut, {from=255, End=200,step=3, old=255, hide=true}, thread); coroutine.yield(); local texture = ILXZTexture:GetTexture(f); if texture then texture:RemoveTexture(); end end); end end
表现以下