2023-07-14 19:35:33 +00:00
|
|
|
local XUiBuffGrid = XClass(nil, "XUiBuffGrid")
|
|
|
|
|
2024-09-01 20:49:41 +00:00
|
|
|
---黄金矿工通用Buff格子
|
|
|
|
---@class XUiGoldenMinerBuffGrid
|
|
|
|
function XUiBuffGrid:Ctor(ui, rootUi)
|
2023-07-14 19:35:33 +00:00
|
|
|
self.GameObject = ui.gameObject
|
|
|
|
self.Transform = ui.transform
|
|
|
|
self.RootUi = rootUi
|
|
|
|
XTool.InitUiObject(self)
|
|
|
|
|
|
|
|
XUiHelper.RegisterClickEvent(self, self.BtnClick, self.OnBtnClick)
|
|
|
|
|
|
|
|
if self.CountDownText then
|
|
|
|
self.CountDownText.gameObject:SetActiveEx(false)
|
|
|
|
end
|
|
|
|
self.GameObject:SetActiveEx(true)
|
|
|
|
end
|
|
|
|
|
|
|
|
function XUiBuffGrid:Refresh(buffId)
|
2024-09-01 20:49:41 +00:00
|
|
|
self:SetActive(true)
|
2023-07-14 19:35:33 +00:00
|
|
|
self.BuffId = buffId
|
|
|
|
local icon = XGoldenMinerConfigs.GetBuffIcon(buffId)
|
|
|
|
if self.RawBuffIcon then
|
|
|
|
self.RawBuffIcon:SetRawImage(icon)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2024-09-01 20:49:41 +00:00
|
|
|
function XUiBuffGrid:SetActive(active)
|
|
|
|
self.GameObject:SetActiveEx(active)
|
|
|
|
end
|
|
|
|
|
2023-07-14 19:35:33 +00:00
|
|
|
function XUiBuffGrid:OnBtnClick()
|
2024-09-01 20:49:41 +00:00
|
|
|
XEventManager.DispatchEvent(XEventId.EVENT_GOLDEN_MINER_SHOP_OPEN_TIP, self.BuffId, nil, self.Transform.position.x)
|
2023-07-14 19:35:33 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
return XUiBuffGrid
|