bayuMIR/client/dev/GUILayout/game/B/TeJieBox_lookOBJ.lua
2026-06-12 02:32:15 +08:00

84 lines
2.6 KiB
Lua

TeJieBox_lookOBJ = Up_BaseClassOBJ:new()
TeJieBox_lookOBJ.__cname = "TeJieBox_lookOBJ"
-- 配置文件
TeJieBox_lookOBJ.cfg = {}
TeJieBox_lookOBJ.UIfile = "game/B/player_tejie_box_UI"
TeJieBox_lookOBJ.pos = {
[1] = { 192, 266 },
[2] = { 110, 186 },
[3] = { 276, 186 },
[4] = { 192, 106 },
}
function TeJieBox_lookOBJ:updata()
--界面拖拽
GUI:Win_SetDrag(self._parent, self.ui.img_bg)
local whereOpen = hk.getkeytbl("HUMAN(STR_特戒盒子)")
GUI:removeAllChildren(self.ui.item_Layout)
for i = 1, 4, 1 do
local open = SL:Get_L_M_EQUIP_DATA(78+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]-30, self.pos[i][2]-30, "res/custom/36/2.png")
-- GUI:setAnchorPoint(self.ui[btn], 0.50, 0.50)
-- GUI:addOnClickEvent(self.ui[btn], function()
-- ssrMessage:SubLink(self.__cname .. "_boxjiesuo", { id = i })
-- end)
else
local EquipShow = "EquipShow_" .. (78 + i)
self.ui[EquipShow] = GUI:EquipShow_Create(self.ui.item_Layout, EquipShow, self.pos[i][1]-30, self.pos[i][2]-30, (78 + 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 TeJieBox_lookOBJ:EventBind()
local function TeJieBox_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, TeJieBox_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 TeJieBox_lookOBJ:OnClose(widgetName)
if widgetName == self.__cname then
self:UnRegisterEvent()
end
end
function TeJieBox_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 TeJieBox_lookOBJ