local TopRankCell = class("TopRankCell", BaseCell)

function TopRankCell:refresh(info)
    local uiMap = self:getUIMap()
    if not self.playerHeadCell then
        self.playerHeadCell = CellManager:addCellComp(uiMap["top_rank_cell.player_head_cell"], GConst.TYPEOF_LUA_CLASS.PLAYER_HEAD_CELL)
    end

    local txName = uiMap["top_rank_cell.name"]
    local txWave = uiMap["top_rank_cell.wave"]
    local txRound = uiMap["top_rank_cell.round"]
    local imgWave = uiMap["top_rank_cell.img_wave"]
    local imgRound = uiMap["top_rank_cell.img_round"]

    if info then
        txName:setText(info.name)
        txWave:setText(info.wave)
        txRound:setText(info.round)
        imgWave:setVisible(true)
        imgRound:setVisible(true)
        self.playerHeadCell:getBaseObject():addClickListener(function()
            ModuleManager.ActBossRushManager:reqOtherPlayerInfo(info.id, function(formation)
                if not self.playerHeadCell or not self.playerHeadCell:getBaseObject() or self.playerHeadCell:getBaseObject():isDestroyed() then
                    return
                end
                ModuleManager.TipsManager:showHeroFormation(self.playerHeadCell:getBaseObject(), formation)
            end)
        end)
        self.playerHeadCell:refresh(info.avatar, info.avatar_frame, false)
        GFunc.centerImgAndTx(imgWave, txWave, 5)
        GFunc.centerImgAndTx(imgRound, txRound, 5)
    else
        txName:setText(I18N:getGlobalText(I18N.GlobalConst.ACT_BOSS_RUSH_DESC_8))
        txWave:setText(GConst.EMPTY_STRING)
        txRound:setText(GConst.EMPTY_STRING)
        imgWave:setVisible(false)
        imgRound:setVisible(false)
        self.playerHeadCell:getBaseObject():addClickListener(nil)
        self.playerHeadCell:refresh(3001, 1000, false) -- 默认
    end
end

return TopRankCell