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()