c1_lua/lua/app/ui/activity/pop_check_bar.lua
2023-09-01 21:10:05 +08:00

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