95 lines
1.8 KiB
Lua
95 lines
1.8 KiB
Lua
TianMinOBJ = {}
|
|
|
|
TianMinOBJ.__cname = "TianMinOBJ"
|
|
|
|
-- 配置文件
|
|
-- TianMinOBJ.tbl = ssrRequireCsvCfg("cfg_WuqiRonghe")
|
|
|
|
|
|
|
|
|
|
function TianMinOBJ:main(objcfg, data)
|
|
local parent = GUI:Win_Create(self.__cname, 0, 0, 0, 0, false, false, true, false)
|
|
|
|
if data then
|
|
GUI:Win_BindNPC(parent, data)
|
|
end
|
|
|
|
GUI:LoadExport(parent, objcfg.UI_PATH)
|
|
|
|
self._parent = parent
|
|
self.ui = GUI:ui_delegate(parent)
|
|
|
|
|
|
--背景图关闭
|
|
GUI:addOnClickEvent(self.ui.bg_close, function()
|
|
GUI:Win_Close(self._parent)
|
|
end)
|
|
|
|
|
|
--关闭按钮背景板关闭
|
|
GUI:addOnClickEvent(self.ui.btn_close, function()
|
|
GUI:Win_Close(self._parent)
|
|
end)
|
|
---* 绑定事件
|
|
self:EventBind()
|
|
|
|
|
|
|
|
self:updata()
|
|
end
|
|
|
|
function TianMinOBJ:updata()
|
|
|
|
---* 初始化红点
|
|
self:reddot()
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
function TianMinOBJ:reddot()
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
------------------------网络消息------------------------
|
|
function TianMinOBJ:ZSResponse()
|
|
if GUI:Win_IsNotNull(self._parent) then
|
|
self:updata()
|
|
end
|
|
end
|
|
|
|
|
|
|
|
---* 注册事件
|
|
function TianMinOBJ:EventBind()
|
|
local function TianMinOBJ_bag_del_Reload(data)
|
|
if GUI:Win_IsNotNull(self._parent) then
|
|
self:show(self.z_select,self.zz_select)
|
|
end
|
|
end
|
|
SL:RegisterLUAEvent(LUA_EVENT_BAG_ITEM_CHANGE, self.__cname, TianMinOBJ_bag_del_Reload)
|
|
|
|
--关闭窗口
|
|
SL:RegisterLUAEvent(LUA_EVENT_CLOSEWIN, self.__cname, function(widgetName)
|
|
self:OnClose(widgetName)
|
|
end)
|
|
end
|
|
|
|
--关闭窗口
|
|
function TianMinOBJ:OnClose(widgetName)
|
|
if widgetName == self.__cname then
|
|
self:UnRegisterEvent()
|
|
end
|
|
end
|
|
|
|
function TianMinOBJ:UnRegisterEvent()
|
|
SL:UnRegisterLUAEvent(LUA_EVENT_BAG_ITEM_CHANGE, self.__cname)
|
|
SL:UnRegisterLUAEvent(LUA_EVENT_CLOSEWIN, self.__cname)
|
|
end
|
|
|
|
return TianMinOBJ
|