93 lines
2.7 KiB
Lua
93 lines
2.7 KiB
Lua
ZhiJinHuLuOBJ = Up_BaseClassOBJ:new()
|
|
|
|
ZhiJinHuLuOBJ.__cname = "ZhiJinHuLuOBJ"
|
|
|
|
-- 配置文件
|
|
ZhiJinHuLuOBJ.cfg = {}
|
|
|
|
ZhiJinHuLuOBJ.UIfile = "game/B/ZhiJinHuLuUI"
|
|
|
|
|
|
|
|
function ZhiJinHuLuOBJ:updata()
|
|
local equipData = SL:Get_EQUIP_DATA(16)
|
|
self.id = 1
|
|
-- SL:dump(equipData)
|
|
local _bool = (SL:Get_EQUIPBYPOS(16) == "紫金葫芦" and equipData) and true or false
|
|
if _bool then
|
|
local attlist = {}
|
|
|
|
for i, v in ipairs(equipData.DiyAdv or {}) do
|
|
if v.Type == 5 then
|
|
table.insert(attlist, string.format("3#%d#%d", v.Idx, v.Value))
|
|
end
|
|
end
|
|
|
|
|
|
local attTextList = hk.getequipAttribute(table.concat(attlist, "|"))
|
|
|
|
for i, v in ipairs(attlist or {}) do
|
|
-- SL:dump(next(hk.getequipAttribute(v)))
|
|
local parent = string.format("att_text_%d", i)
|
|
|
|
if GUI:Win_IsNotNull(self.ui[parent]) then
|
|
GUI:removeFromParent(self.ui[parent])
|
|
end
|
|
self.ui[parent] = GUI:RichTextFCOLOR_Create(self.ui["Panel_" .. i], parent, 155, 14, string.format("<[隐藏属性]第%s条:/FCOLOR=70>%s", SL:NumberToChinese(i), hk.getequipAttribute(v)[1]), 334, 16, "#00ff00", 5, nil, nil, { outlineSize = 1, outlineColor = SL:ConvertColorFromHexString("#000000") })
|
|
GUI:setAnchorPoint(self.ui[parent], 0.50, 0.50)
|
|
end
|
|
|
|
self.id = #attlist < 5 and #attlist + 1 or #attlist
|
|
end
|
|
|
|
|
|
|
|
self.xh = self.cfg[self.id].xh
|
|
self:seIitemShow()
|
|
|
|
SL:dump(self.id)
|
|
|
|
if self.id <= #self.cfg then
|
|
GUI:setTouchEnabled(self.ui.Up_btn, true)
|
|
GUI:setGrey(self.ui.Up_btn, false)
|
|
|
|
GUI:addOnClickEvent(self.ui.Up_btn, function()
|
|
ssrMessage:SubLink(self.__cname .. "_up")
|
|
end)
|
|
else
|
|
GUI:setTouchEnabled(self.ui.Up_btn, false)
|
|
GUI:setGrey(self.ui.Up_btn, true)
|
|
end
|
|
end
|
|
|
|
|
|
---* 注册事件
|
|
function ZhiJinHuLuOBJ:EventBind()
|
|
local function ZHIJINHULUOBJ_EQUIP_CHANGE(data)
|
|
if GUI:Win_IsNotNull(self._parent) then
|
|
if data.Where == 16 then
|
|
self:updata()
|
|
end
|
|
end
|
|
end
|
|
SL:RegisterLUAEvent(LUA_EVENT_PLAYER_EQUIP_CHANGE, self.__cname, ZHIJINHULUOBJ_EQUIP_CHANGE)
|
|
|
|
--关闭窗口
|
|
SL:RegisterLUAEvent(LUA_EVENT_CLOSEWIN, self.__cname, function(widgetName)
|
|
self:OnClose(widgetName)
|
|
end)
|
|
end
|
|
|
|
--关闭窗口
|
|
function ZhiJinHuLuOBJ:OnClose(widgetName)
|
|
if widgetName == self.__cname then
|
|
self:UnRegisterEvent()
|
|
end
|
|
end
|
|
|
|
function ZhiJinHuLuOBJ:UnRegisterEvent()
|
|
SL:UnRegisterLUAEvent(LUA_EVENT_PLAYER_EQUIP_CHANGE, self.__cname)
|
|
SL:UnRegisterLUAEvent(LUA_EVENT_CLOSEWIN, self.__cname)
|
|
end
|
|
|
|
return ZhiJinHuLuOBJ
|