local PlayerInfoCell = class("PlayerInfoCell", BaseCell)

function PlayerInfoCell:init()
	local uiMap = self.baseObject:genAllChildren()

    self.txName = uiMap["player_info_cell.info.tx_name"]
    self.txLv = uiMap["player_info_cell.info.slider.tx_lv"]
    self.imgProgExp = uiMap["player_info_cell.info.slider.img_prog_exp"]:getComponent(GConst.TYPEOF_UNITY_CLASS.BF_SLIDER)
    self.playerHeadCell = CellManager:addCellComp(uiMap["player_info_cell.player_head_cell"], GConst.TYPEOF_LUA_CLASS.PLAYER_HEAD_CELL)

    self:getBaseObject():addClickListener(function ()
        UIManager:showUI("app/ui/player_info/player_info_ui")
	end)
end

function PlayerInfoCell:refresh()
    self.txName:setText(DataManager.PlayerData:getNickname())
    self.txLv:setText(I18N:getGlobalText(I18N.GlobalConst.HERO_DESC_1, DataManager.PlayerData:getLv()))
    self.imgProgExp.value = DataManager.PlayerData:getExpPercent()
    self.playerHeadCell:refresh(nil, nil, true)
end

return PlayerInfoCell