|
前几天研究了 kudo 的myStatusWindow
现在使用面向对象技术重新封装myStatusWindow,做成window类,方便大家使用mini_Window只要写很少代码就能实现mini_window
require "sj_mini_win" --下载的 lua引用
local win=window.new() --监控窗体实例化
win.name="status_window" --名称属性 设置
win.font_height=8 --字体高度属性 设置 默认是18
win.font_name="幼圆" --默认是新宋体
win:addText("label1","my_status_window") --标签创建
win:addGauge ("jingsheng","精神: ", 100, "darkgreen", "mediumblue", "darkred", "50".."/".."100", 0) --创建进度条
win:addGauge ("qixue","气血: ", 50, "darkgreen", "mediumblue", "darkred", "50".."/".."100", 0)
win:addGauge ("jingli","精力: ", 50, "darkgreen", "mediumblue", "darkred", "50".."/".."70", 0)
win:addGauge("neili","内力: ", 100, "darkgreen", "mediumblue", "darkred", "200".."/".."100", 0)
win:addGauge("food","食物: ", 400, "darkgreen", "mediumblue", "darkred", "80".."/".."100", 0)
win:addGauge("drink","饮水: ", 500, "darkgreen", "mediumblue", "darkred", "100".."/".."100", 0)
win:addGauge("pot","潜能: ", 100, "darkgreen", "mediumblue", "darkred", "100", 1)
win:refresh() --刷新
--实现原来代码功能
--------------------
窗体内容更新
function test()
local win=window.new() --监控窗体实例化
win.name="status_window" --名称属性 设置
win.font_height=10 --字体高度属性 设置 默认是18
win.font_name="幼圆" --默认是新宋体
win:addText("label1","更新窗体") --标签创建
win:addGauge("pot","潜能: ", 100, "darkgreen", "mediumblue", "darkred", "200", 1) --利用第一个id参数 更新状态条信息 潜能从100-200
win:refresh()
end
我对原来代码简单的修改了下,可能还会有bug欢迎大家对代码修改更新! |
本帖子中包含更多资源
您需要 登录 才可以下载或查看,没有帐号?注册
x
|