进度条规则

This commit is contained in:
chenxi 2023-04-25 12:08:46 +08:00
parent f58563c1c3
commit 78f0b9d91b
2 changed files with 18 additions and 1 deletions

View File

@ -35,6 +35,11 @@ function HeroCell:refresh(heroEntity, isGray)
local fragmentCount = DataManager.BagData.ItemData:getItemNumById(heroEntity:getFragmentId()) local fragmentCount = DataManager.BagData.ItemData:getItemNumById(heroEntity:getFragmentId())
local needFragmentCount = materials[1] or 1 local needFragmentCount = materials[1] or 1
self.progressTx:setText(fragmentCount .. "/" .. needFragmentCount) 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.progress:getComponent(GConst.TYPEOF_UNITY_CLASS.BF_SLIDER).value = fragmentCount / needFragmentCount
self.lvTx:setText(I18N:getGlobalText(I18N.GlobalConst.HERO_DESC_1, heroEntity:getLv())) self.lvTx:setText(I18N:getGlobalText(I18N.GlobalConst.HERO_DESC_1, heroEntity:getLv()))
if heroEntity:isUnlock() then if heroEntity:isUnlock() then
@ -62,6 +67,11 @@ function HeroCell:refreshWithCfgId(id, isGray)
local fragmentCount = DataManager.BagData.ItemData:getItemNumById(heroInfo.item_id) local fragmentCount = DataManager.BagData.ItemData:getItemNumById(heroInfo.item_id)
local needFragmentCount = materials[1] or 1 local needFragmentCount = materials[1] or 1
self.progressTx:setText(fragmentCount .. "/" .. needFragmentCount) 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.progress:getComponent(GConst.TYPEOF_UNITY_CLASS.BF_SLIDER).value = fragmentCount / needFragmentCount
self.lvTx:setText(I18N:getGlobalText(I18N.GlobalConst.HERO_DESC_1, lv)) self.lvTx:setText(I18N:getGlobalText(I18N.GlobalConst.HERO_DESC_1, lv))
self.lvTx:setVisible(true) self.lvTx:setVisible(true)

View File

@ -40,7 +40,14 @@ function HeroDetailUI:_display(lvChange)
local fragmentCount = DataManager.BagData.ItemData:getItemNumById(self.heroEntity:getFragmentId()) local fragmentCount = DataManager.BagData.ItemData:getItemNumById(self.heroEntity:getFragmentId())
local needFragmentCount = materials[1] or 1 local needFragmentCount = materials[1] or 1
uiMap["hero_detail_ui.bg.fragment_num"]:setText(fragmentCount .. "/" .. needFragmentCount) 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 activeCount = self.heroEntity:getActiveRogueCount()
local skillList = self.heroEntity:getRogueSkillList() local skillList = self.heroEntity:getRogueSkillList()