c1_lua/lua/app/ui/common/cell/player_info_cell.lua
2025-08-04 09:42:30 +08:00

27 lines
1.0 KiB
Lua

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
function PlayerInfoCell:setActive(active)
self.baseObject:setActive(active)
end
return PlayerInfoCell