From e7a0f46fcb2e9f6d0b07d5a3856f57538153fda4 Mon Sep 17 00:00:00 2001 From: xiekaidong Date: Mon, 19 Jun 2023 15:14:56 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=A0=E5=8F=82=E6=94=B9=E4=B8=80=E4=B8=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lua/app/ui/common/cell/player_head_cell.lua | 11 +++-------- lua/app/ui/main_city/main_city_ui.lua | 3 +++ 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/lua/app/ui/common/cell/player_head_cell.lua b/lua/app/ui/common/cell/player_head_cell.lua index d18ba084..b272e289 100644 --- a/lua/app/ui/common/cell/player_head_cell.lua +++ b/lua/app/ui/common/cell/player_head_cell.lua @@ -5,21 +5,16 @@ function PlayerHeadCell:init() self.imgFrame = uiMap["player_head_cell.img_frame"] self.imgAvatar = uiMap["player_head_cell.img_avatar"] - - self:bind(DataManager.PlayerData, "dirty", function() - if self.isSelf then - self:refresh() - end - end, true) end -- (avatarId:头像id,frameId:头像框id) -function PlayerHeadCell:refresh(avatarId, frameId) +function PlayerHeadCell:refresh(avatarId, frameId, showRp) if avatarId == nil or frameId == nil then -- 是玩家自己 self.isSelf = true avatarId = DataManager.PlayerData:getUsingAvatarId() frameId = DataManager.PlayerData:getUsingFrameId() + showRp = DataManager.PlayerData:hasNewAvatar() or DataManager.PlayerData:hasNewFrame() end -- 头像 @@ -39,7 +34,7 @@ function PlayerHeadCell:refresh(avatarId, frameId) end -- 红点 - if DataManager.PlayerData:hasNewAvatar() or DataManager.PlayerData:hasNewFrame() then + if showRp then self.baseObject:addRedPoint(50, 50, 0.7) else self.baseObject:removeRedPoint() diff --git a/lua/app/ui/main_city/main_city_ui.lua b/lua/app/ui/main_city/main_city_ui.lua index 639b8ffc..79c51e0b 100644 --- a/lua/app/ui/main_city/main_city_ui.lua +++ b/lua/app/ui/main_city/main_city_ui.lua @@ -608,6 +608,9 @@ function MainCityUI:refreshPlayerInfo() self.playerLvTx:setText(I18N:getGlobalText(I18N.GlobalConst.HERO_DESC_1, lv)) self.playerSlider:getComponent(GConst.TYPEOF_UNITY_CLASS.BF_SLIDER).value = DataManager.PlayerData:getExpPercent() self.playerNameTx:setText(DataManager.PlayerData:getNickname()) + if self.headCell then + self.headCell:refresh() + end end function MainCityUI:initTopNode()