47 lines
No EOL
1.8 KiB
Lua
47 lines
No EOL
1.8 KiB
Lua
local XUiGridBabelChallengeItem = XClass(nil, "XUiGridBabelChallengeItem")
|
|
local UiButtonState = CS.UiButtonState
|
|
|
|
function XUiGridBabelChallengeItem:Ctor(ui, parentUi, index, itemType)
|
|
self.GameObject = ui.gameObject
|
|
self.Transform = ui.transform
|
|
self.ParentUi = parentUi
|
|
self.Index = index
|
|
self.ItemType = itemType
|
|
|
|
XTool.InitUiObject(self)
|
|
self.ToggleButon = self.Transform:GetComponent("XUiButton")
|
|
end
|
|
|
|
function XUiGridBabelChallengeItem:GetXUiButtonComp()
|
|
return self.ToggleButon
|
|
end
|
|
|
|
function XUiGridBabelChallengeItem:UpdateBuff(buffTemplate, buffConfigs, index, itemType)
|
|
self.BuffTemplate = buffTemplate
|
|
self.BuffConfigs = buffConfigs
|
|
if index then self.Index = index end
|
|
if itemType then self.ItemType = itemType end
|
|
if self.ItemType == XFubenBabelTowerConfigs.TYPE_CHALLENGE then
|
|
self.TxtNumber.text = buffTemplate.ScoreAdd
|
|
end
|
|
if self.ItemType == XFubenBabelTowerConfigs.TYPE_SUPPORT then
|
|
local isSelected = self.ParentUi:GetBuffSelectStatus(self.BuffTemplate.Id)
|
|
local isOver = self.ParentUi:IsBuffListOverCount()
|
|
self:ShowOverCount(isSelected and isOver)
|
|
self.TxtNumber.text = buffTemplate.PointSub
|
|
end
|
|
self.RImgChallengeIconNor:SetRawImage(self.BuffConfigs.BuffBg)
|
|
self.RImgChallengeIconPress:SetRawImage(self.BuffConfigs.BuffBg)
|
|
self.RImgChallengeIconSelect:SetRawImage(self.BuffConfigs.BuffBg)
|
|
self.RImgChallengeIconDisable:SetRawImage(self.BuffConfigs.BuffBg)
|
|
|
|
local btnState = (self.ParentUi:GetBuffSelectStatus(self.BuffTemplate.Id)) and UiButtonState.Select or UiButtonState.Normal
|
|
self.ToggleButon:SetButtonState(btnState)
|
|
|
|
end
|
|
|
|
function XUiGridBabelChallengeItem:ShowOverCount(isSlectAndOver)
|
|
self.ToggleButon:ShowReddot(isSlectAndOver)
|
|
end
|
|
|
|
return XUiGridBabelChallengeItem |