41 lines
1.2 KiB
Plaintext
41 lines
1.2 KiB
Plaintext
local BaseCell = autoImport("BaseCell");
|
|
local choosenLabCol = "[365A96]"
|
|
local unChoosenLabCol = "[676767]"
|
|
|
|
ServantRecommendToggleCell = class("ServantRecommendToggleCell", BaseCell);
|
|
|
|
function ServantRecommendToggleCell:Init()
|
|
ServantRecommendToggleCell.super.Init(self)
|
|
self:FindObjs()
|
|
-- self:InitCfg()
|
|
self:AddCellClickEvent()
|
|
end
|
|
|
|
-- 女僕今日推薦標籤頁分類
|
|
local pageCfg = GameConfig.Servant and GameConfig.Servant.ServantRecommendPageType
|
|
|
|
function ServantRecommendToggleCell:FindObjs()
|
|
self.chooseImg = self:FindComponent("ChooseImg",UISprite);
|
|
self.typeName = self:FindComponent("TypeName",UILabel);
|
|
end
|
|
|
|
function ServantRecommendToggleCell:ShowChooseImg(typeID)
|
|
local name = self.typeName.text
|
|
if(typeID==self.typeID)then
|
|
self:Show(self.chooseImg)
|
|
self.typeName.text=string.format("[c]%s%s[-][/c]",choosenLabCol,name)
|
|
else
|
|
self:Hide(self.chooseImg)
|
|
self.typeName.text=string.format("[c]%s%s[-][/c]",unChoosenLabCol,name)
|
|
end
|
|
end
|
|
|
|
function ServantRecommendToggleCell:SetData(data)
|
|
self.typeID = data
|
|
if(not pageCfg)then
|
|
helplog("GameConfig.Servant.ServantRecommendPageType 未配置")
|
|
return
|
|
end
|
|
self.typeName.text = pageCfg[data] or ""
|
|
end
|