30 lines
857 B
Lua
30 lines
857 B
Lua
local PopCheckBar = class("PopCheckBar", LuaComponent)
|
|
|
|
function PopCheckBar:init()
|
|
self.baseObject:initPrefabHelper()
|
|
self.baseObject:genAllChildren()
|
|
end
|
|
|
|
function PopCheckBar:refresh(isCheck, customKey)
|
|
self.isCheck = isCheck
|
|
self.customKey = customKey
|
|
local uiMap = self:getUIMap()
|
|
local txObj = uiMap["pop_check_bar.desc"]
|
|
txObj:setText(I18N:getGlobalText(I18N.GlobalConst.NOT_POP_TODAY))
|
|
GFunc.expandImgToFitTx(self.baseObject, txObj, 20)
|
|
|
|
local checkIcon = uiMap["pop_check_bar.check"]
|
|
checkIcon:setVisible(self.isCheck)
|
|
self.baseObject:addClickListener(function()
|
|
self.isCheck = not self.isCheck
|
|
checkIcon:setVisible(self.isCheck)
|
|
end)
|
|
end
|
|
|
|
function PopCheckBar:saveCheckStatus()
|
|
if self.isCheck then
|
|
LocalData:setNotPopToday(self.customKey)
|
|
end
|
|
end
|
|
|
|
return PopCheckBar |