local PageBtnCell = class("PageBtnCell", BaseCell)

function PageBtnCell:init()
    local uiMap = self:getUIMap()
    self.imgIcon = uiMap["page_btn_cell.img_icon"]
    self.txDesc = uiMap["page_btn_cell.tx_desc"]

    self.redPosX = 32
    self.redPosY = 20
    self.redScale = 1
end

function PageBtnCell:setRedPointPos(posX, posY, scale)
    self.redPosX = posX or self.redPosX
    self.redPosY = posY or self.redPosY
    self.redScale = scale or self.redScale
end

function PageBtnCell:refresh(info)
    local atlas = info.atlas
    local icon = info.icon
    local desc = info.desc
    local redPoint = info.redPoint
    local callback = info.callback

    self:getBaseObject():getGameObject().name = icon
    self.imgIcon:setSprite(atlas, icon, function()
        self.imgIcon:getComponent(GConst.TYPEOF_UNITY_CLASS.UI_IMAGE):SetNativeSize()
    end)
    self.txDesc:setText(desc)
    self:addClickListener(callback)

    if redPoint then
        self:getBaseObject():addRedPoint(self.redPosX, self.redPosY, self.redScale)
    else
        self:getBaseObject():removeRedPoint()
    end
end

return PageBtnCell