合成装备刷新界面

dev_chengFeng
jiaoyangna 2020-07-07 17:51:02 +08:00
parent c6bfa772e5
commit 0f611408b8
1 changed files with 18 additions and 2 deletions

View File

@ -24,6 +24,7 @@ local curSelectEquip = {}
local curSelectGO local curSelectGO
local materidaIsCan = false local materidaIsCan = false
local bagPosEquips = {} local bagPosEquips = {}
local needGoldNum = 0
function this:InitComponent(gameObject) function this:InitComponent(gameObject)
this.tabBox = Util.GetGameObject(gameObject, "CompoundPanel_Equip/TabBox") this.tabBox = Util.GetGameObject(gameObject, "CompoundPanel_Equip/TabBox")
this.needGoldText = Util.GetGameObject(gameObject, "CompoundPanel_Equip/compoundBtn/needGoldText"):GetComponent("Text") this.needGoldText = Util.GetGameObject(gameObject, "CompoundPanel_Equip/compoundBtn/needGoldText"):GetComponent("Text")
@ -66,14 +67,27 @@ function this:BindEvent()
end end
function this:AddListener() function this:AddListener()
Game.GlobalEvent:AddEvent(GameEvent.Bag.BagGold,this.ShowGoldNum0)
end end
function this:RemoveListener() function this:RemoveListener()
Game.GlobalEvent:RemoveEvent(GameEvent.Bag.BagGold,this.ShowGoldNum0)
end
function this.ShowGoldNum0()
if needGoldNum > BagManager.GetItemCountById(14) then
materidaIsCan = false
this.needGoldText.text = string.format("<color=#FF0011>%s</color>", needGoldNum)
else
materidaIsCan = true
this.needGoldText.text =string.format("<color=#FCF5D3FF>%s</color>", needGoldNum)
end
end end
function this:OnShow(...) function this:OnShow(...)
curIndex = 1 curIndex = 1
sortingOrder =0 sortingOrder =0
needGoldNum=0
this.TabCtrl = TabBox.New() this.TabCtrl = TabBox.New()
this.TabCtrl:SetTabAdapter(this.TabAdapter) this.TabCtrl:SetTabAdapter(this.TabAdapter)
this.TabCtrl:SetChangeTabCallBack(this.SwitchView) this.TabCtrl:SetChangeTabCallBack(this.SwitchView)
@ -118,7 +132,7 @@ function this.ShowTitleData(curEquipStarsConfig)
this.ShowGoldNum(equipStarsConfig[curSelectEquip.Star - 1],compoundNum) this.ShowGoldNum(equipStarsConfig[curSelectEquip.Star - 1],compoundNum)
end end
function this.ShowGoldNum(upEquipStarsConfig,compoundNum) function this.ShowGoldNum(upEquipStarsConfig,compoundNum)
local needGoldNum = compoundNum * upEquipStarsConfig.RankupResources[1][2] needGoldNum = compoundNum * upEquipStarsConfig.RankupResources[1][2]
if needGoldNum > BagManager.GetItemCountById(upEquipStarsConfig.RankupResources[1][1]) then if needGoldNum > BagManager.GetItemCountById(upEquipStarsConfig.RankupResources[1][1]) then
materidaIsCan = false materidaIsCan = false
this.needGoldText.text = string.format("<color=#FF0011>%s</color>", needGoldNum) this.needGoldText.text = string.format("<color=#FF0011>%s</color>", needGoldNum)
@ -330,9 +344,11 @@ function this.SwitchView(index)
end end
function this:OnClose() function this:OnClose()
needGoldNum=0
end end
function this:OnDestroy() function this:OnDestroy()
needGoldNum=0
end end
return this return this