81 lines
2.4 KiB
Lua
81 lines
2.4 KiB
Lua
zhiBaoBox_lookOBJ = Up_BaseClassOBJ:new()
|
|
|
|
zhiBaoBox_lookOBJ.__cname = "zhiBaoBox_lookOBJ"
|
|
|
|
-- 配置文件
|
|
zhiBaoBox_lookOBJ.cfg = {}
|
|
|
|
zhiBaoBox_lookOBJ.UIfile = "game/B/player_zhibao_box_UI"
|
|
|
|
zhiBaoBox_lookOBJ.pos = {
|
|
[1] = { 248, 304 },
|
|
[2] = { 158, 214 },
|
|
[3] = { 335, 214 },
|
|
[4] = { 247, 123 },
|
|
}
|
|
|
|
function zhiBaoBox_lookOBJ:updata()
|
|
--界面拖拽
|
|
GUI:Win_SetDrag(self._parent, self.ui.img_bg)
|
|
GUI:removeAllChildren(self.ui.item_Layout)
|
|
|
|
for i = 1, 4, 1 do
|
|
local open = SL:Get_L_M_EQUIP_DATA(70+i)
|
|
|
|
if not open then
|
|
-- local btn = "btn_jieshuo_" .. i
|
|
-- self.ui[btn] = GUI:Button_Create(self.ui.item_Layout, btn, self.pos[i][1], self.pos[i][2], "res/private/player_zhibao_box_UI/7.png")
|
|
-- GUI:setAnchorPoint(self.ui[btn], 0.50, 0.50)
|
|
else
|
|
local EquipShow = "EquipShow_" .. (70 + i)
|
|
self.ui[EquipShow] = GUI:EquipShow_Create(self.ui.item_Layout, EquipShow, self.pos[i][1], self.pos[i][2], (70 + i), false, { bgVisible = false, doubleTakeOff = false, look = true, movable = false, starLv = true, lookPlayer = true, showModelEffect = true })
|
|
GUI:setAnchorPoint(self.ui[EquipShow], 0.50, 0.50)
|
|
end
|
|
end
|
|
end
|
|
|
|
|
|
|
|
|
|
---* 注册事件
|
|
function zhiBaoBox_lookOBJ:EventBind()
|
|
local function zhiBaoBox_lookOBJ_Var_Change(data)
|
|
if GUI:Win_IsNotNull(self._parent) then
|
|
if data.key == "HUMAN(STR_至宝盒子)" then
|
|
self:updata()
|
|
end
|
|
end
|
|
end
|
|
SL:RegisterLUAEvent(LUA_EVENT_SERVER_VALUE_CHANGE, self.__cname, zhiBaoBox_lookOBJ_Var_Change)
|
|
|
|
local function reloaditem()
|
|
self:updata()
|
|
end
|
|
|
|
SL:RegisterLUAEvent(LUA_EVENT_TAKE_ON_EQUIP, self.__cname, reloaditem)
|
|
SL:RegisterLUAEvent(LUA_EVENT_TAKE_OFF_EQUIP, self.__cname, reloaditem)
|
|
|
|
|
|
|
|
--关闭窗口
|
|
SL:RegisterLUAEvent(LUA_EVENT_CLOSEWIN, self.__cname, function(widgetName)
|
|
self:OnClose(widgetName)
|
|
end)
|
|
end
|
|
|
|
|
|
--关闭窗口
|
|
function zhiBaoBox_lookOBJ:OnClose(widgetName)
|
|
if widgetName == self.__cname then
|
|
self:UnRegisterEvent()
|
|
end
|
|
end
|
|
|
|
function zhiBaoBox_lookOBJ:UnRegisterEvent()
|
|
SL:UnRegisterLUAEvent(LUA_EVENT_SERVER_VALUE_CHANGE, self.__cname)
|
|
SL:UnRegisterLUAEvent(LUA_EVENT_TAKE_ON_EQUIP, self.__cname)
|
|
SL:UnRegisterLUAEvent(LUA_EVENT_TAKE_OFF_EQUIP, self.__cname)
|
|
SL:UnRegisterLUAEvent(LUA_EVENT_CLOSEWIN, self.__cname)
|
|
end
|
|
|
|
return zhiBaoBox_lookOBJ
|