2023-07-14 19:35:33 +00:00
|
|
|
|
|
|
|
local XUiGWSelectBuffGrid = XClass(nil, "XUiGWSelectBuffGrid")
|
|
|
|
|
|
|
|
function XUiGWSelectBuffGrid:Ctor(prefab)
|
|
|
|
XTool.InitUiObjectByUi(self, prefab)
|
|
|
|
XUiHelper.RegisterClickEvent(self, self.RImgIcon, function() self:OnClick() end)
|
2024-09-01 20:49:41 +00:00
|
|
|
if self.BtnBuff then
|
|
|
|
XUiHelper.RegisterClickEvent(self, self.BtnBuff, function() self:OnClick() end)
|
|
|
|
end
|
2023-07-14 19:35:33 +00:00
|
|
|
end
|
|
|
|
|
2024-09-01 20:49:41 +00:00
|
|
|
function XUiGWSelectBuffGrid:Refresh(fightEventId, allFightEventId)
|
2023-07-14 19:35:33 +00:00
|
|
|
if not fightEventId or (fightEventId == 0) then return nil end
|
|
|
|
local cfg = XFubenConfigs.GetStageFightEventDetailsByStageFightEventId(fightEventId)
|
|
|
|
if not cfg then return nil end
|
2024-09-01 20:49:41 +00:00
|
|
|
-- 虽然会导致每个grid都重复创建list, 但相比代码在grid外要方便
|
|
|
|
local cfgList = {}
|
|
|
|
for i = 1, #allFightEventId do
|
|
|
|
local id = allFightEventId[i]
|
|
|
|
local c = XFubenConfigs.GetStageFightEventDetailsByStageFightEventId(id)
|
|
|
|
if c then
|
|
|
|
cfgList[#cfgList + 1] = c
|
|
|
|
end
|
|
|
|
end
|
|
|
|
self.BuffList = cfgList
|
|
|
|
--
|
2023-07-14 19:35:33 +00:00
|
|
|
self.RImgIcon:SetRawImage(cfg.Icon)
|
2024-09-01 20:49:41 +00:00
|
|
|
if self.TxtLv then
|
|
|
|
self.TxtLv.gameObject:SetActiveEx(false)
|
|
|
|
end
|
2023-07-14 19:35:33 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
function XUiGWSelectBuffGrid:OnClick()
|
|
|
|
XLuaUiManager.Open("UiCommonStageEvent", self.BuffList)
|
|
|
|
end
|
|
|
|
|
|
|
|
function XUiGWSelectBuffGrid:Hide()
|
|
|
|
self.GameObject:SetActiveEx(false)
|
|
|
|
end
|
|
|
|
|
|
|
|
function XUiGWSelectBuffGrid:Show()
|
|
|
|
self.GameObject:SetActiveEx(true)
|
|
|
|
end
|
|
|
|
|
|
|
|
return XUiGWSelectBuffGrid
|