From 78f0b9d91be6a19874cca019265885f2be76898c Mon Sep 17 00:00:00 2001 From: chenxi Date: Tue, 25 Apr 2023 12:08:46 +0800 Subject: [PATCH] =?UTF-8?q?=E8=BF=9B=E5=BA=A6=E6=9D=A1=E8=A7=84=E5=88=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lua/app/ui/common/cell/hero_cell.lua | 10 ++++++++++ lua/app/ui/hero/hero_detail_ui.lua | 9 ++++++++- 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/lua/app/ui/common/cell/hero_cell.lua b/lua/app/ui/common/cell/hero_cell.lua index 21140528..26115ad3 100644 --- a/lua/app/ui/common/cell/hero_cell.lua +++ b/lua/app/ui/common/cell/hero_cell.lua @@ -35,6 +35,11 @@ function HeroCell:refresh(heroEntity, isGray) local fragmentCount = DataManager.BagData.ItemData:getItemNumById(heroEntity:getFragmentId()) local needFragmentCount = materials[1] or 1 self.progressTx:setText(fragmentCount .. "/" .. needFragmentCount) + if fragmentCount >= needFragmentCount then + self.progress:setSprite(GConst.ATLAS_PATH.COMMON, "common_progress_1", nil, self.progress:getComponent(GConst.TYPEOF_UNITY_CLASS.BF_SLIDER)) + else + self.progress:setSprite(GConst.ATLAS_PATH.COMMON, "common_progress_2", nil, self.progress:getComponent(GConst.TYPEOF_UNITY_CLASS.BF_SLIDER)) + end self.progress:getComponent(GConst.TYPEOF_UNITY_CLASS.BF_SLIDER).value = fragmentCount / needFragmentCount self.lvTx:setText(I18N:getGlobalText(I18N.GlobalConst.HERO_DESC_1, heroEntity:getLv())) if heroEntity:isUnlock() then @@ -62,6 +67,11 @@ function HeroCell:refreshWithCfgId(id, isGray) local fragmentCount = DataManager.BagData.ItemData:getItemNumById(heroInfo.item_id) local needFragmentCount = materials[1] or 1 self.progressTx:setText(fragmentCount .. "/" .. needFragmentCount) + if fragmentCount >= needFragmentCount then + self.progress:setSprite(GConst.ATLAS_PATH.COMMON, "common_progress_1", nil, self.progress:getComponent(GConst.TYPEOF_UNITY_CLASS.BF_SLIDER)) + else + self.progress:setSprite(GConst.ATLAS_PATH.COMMON, "common_progress_2", nil, self.progress:getComponent(GConst.TYPEOF_UNITY_CLASS.BF_SLIDER)) + end self.progress:getComponent(GConst.TYPEOF_UNITY_CLASS.BF_SLIDER).value = fragmentCount / needFragmentCount self.lvTx:setText(I18N:getGlobalText(I18N.GlobalConst.HERO_DESC_1, lv)) self.lvTx:setVisible(true) diff --git a/lua/app/ui/hero/hero_detail_ui.lua b/lua/app/ui/hero/hero_detail_ui.lua index c9e238f0..ca9fd9c1 100644 --- a/lua/app/ui/hero/hero_detail_ui.lua +++ b/lua/app/ui/hero/hero_detail_ui.lua @@ -40,7 +40,14 @@ function HeroDetailUI:_display(lvChange) local fragmentCount = DataManager.BagData.ItemData:getItemNumById(self.heroEntity:getFragmentId()) local needFragmentCount = materials[1] or 1 uiMap["hero_detail_ui.bg.fragment_num"]:setText(fragmentCount .. "/" .. needFragmentCount) - uiMap["hero_detail_ui.bg.slider"]:getComponent(GConst.TYPEOF_UNITY_CLASS.BF_SLIDER).value = fragmentCount / needFragmentCount + + local slider = uiMap["hero_detail_ui.bg.slider"] + if fragmentCount >= needFragmentCount then + slider:setSprite(GConst.ATLAS_PATH.COMMON, "common_progress_1", nil, slider:getComponent(GConst.TYPEOF_UNITY_CLASS.BF_SLIDER)) + else + slider:setSprite(GConst.ATLAS_PATH.COMMON, "common_progress_2", nil, slider:getComponent(GConst.TYPEOF_UNITY_CLASS.BF_SLIDER)) + end + slider:getComponent(GConst.TYPEOF_UNITY_CLASS.BF_SLIDER).value = fragmentCount / needFragmentCount local activeCount = self.heroEntity:getActiveRogueCount() local skillList = self.heroEntity:getRogueSkillList()