local RankRewardcell = class("RankRewardcell", BaseCell)

function RankRewardcell:refresh(ranking1, ranking2, rewards, totalIndex)
    local uiMap = self:getUIMap()

    local rankStr = ranking1 .. "-"
    if ranking2 then
        rankStr = rankStr .. ranking2
    else
        rankStr = rankStr .. "-"
    end
    if ranking1 == ranking2 then
        rankStr = ranking1
    end
    if self:getIndex() == totalIndex then
        rankStr = ranking1 .. "+"
    end
    uiMap["rank_reward_cell.bg.tx_rank"]:setText(I18N:getGlobalText(I18N.GlobalConst.ACT_BOSS_RUSH_DESC_23, rankStr))
    if not self.rewardCells then
        self.rewardCells = {}
        for i = 1, 2 do
            self.rewardCells[i] = uiMap["rank_reward_cell.bg.reward_cell_" .. i]:addLuaComponent(GConst.TYPEOF_LUA_CLASS.REWARD_CELL)
        end
    end
    for index, cell in ipairs(self.rewardCells) do
        if rewards and rewards[index] then
            cell:refreshByConfig(rewards[index])
            cell:getBaseObject():setActive(true)
        else
            cell:getBaseObject():setActive(false)
        end
    end
end

return RankRewardcell