英雄升级突破材料不足提示

wangzhenxing 2022-11-04 16:28:16 +08:00
parent b73735f7cb
commit d11e4a90cc
2 changed files with 36 additions and 5 deletions

View File

@ -143,6 +143,17 @@ function this.GetItemCountById(_itemId)
return have
end
function this.GetItemNameById(_itemId)
local name = ""
if this.bagDatas[_itemId] then
name = this.bagDatas[_itemId].name
else
name=itemConfig[_itemId].Name
end
return name
end
--通过物品id获取物品数量
function this.GetItemById(_itemId)
return this.bagDatas[_itemId]

View File

@ -19,6 +19,7 @@ local upTuPoRankUpConfig={}--即将要突破的数据
local upStarRankUpConfig={}--即将要升星的数据
local curStarRankUpConfig={}--当前升星的数据
local curTuPoRankUpConfig={}--当前突破的数据
local costId=0
--长按升级状态
local _isClicked = false --是否点击
local _isReqLvUp = false
@ -779,6 +780,7 @@ function this:UpdateHeroUpLvAndBreakMaterialShow()
this.costList[i].icon.sprite = this.spLoader:LoadSprite(GetSpriteNameByItemId(costItemList[i][1]))
if BagManager.GetItemCountById(costItemList[i][1])<costItemList[i][2] then
isUpLvMaterials=false
costId=costItemList[i][1]
this.costList[i].costText.text=string.format("<color=#FF0000FF>%s</color>",costItemList[i][2])
else
this.costList[i].costText.text=string.format("<color=#c5dedb>%s</color>",costItemList[i][2])
@ -915,7 +917,8 @@ function RoleInfoLayout:LvUpClick(isSingleLvUp)
if isUpLvMaterials then
this:DeleteLvUpMaterials()
else
PopupTipPanel.ShowTip(Language[11813])
--PopupTipPanel.ShowTip(Language[11813])
this:ShowCostNotEnoughTip()
end
_isClicked = false
_isLongPress = false
@ -927,9 +930,9 @@ function RoleInfoLayout:LvUpClick(isSingleLvUp)
else
_isClicked = false
if isHeroUpTuPo and curHeroData.lv == upTuPoRankUpConfig.LimitLevel then
PopupTipPanel.ShowTip(Language[11813])
this:ShowCostNotEnoughTip()
else
PopupTipPanel.ShowTip(Language[11814])
this:ShowCostNotEnoughTip()
end
end
end
@ -945,7 +948,7 @@ function RoleInfoLayout:LvUpClick(isSingleLvUp)
if isUpLvMaterials then
this:DeleteLvUpMaterials()
else
PopupTipPanel.ShowTip(Language[11813])
this:ShowCostNotEnoughTip()
end
_isClicked = false
_isLongPress = false
@ -955,7 +958,7 @@ function RoleInfoLayout:LvUpClick(isSingleLvUp)
if isUpLvMaterials then
this:DeleteLvUpMaterials()
else
PopupTipPanel.ShowTip(Language[11814])
this:ShowCostNotEnoughTip()
_isClicked = false
_isLongPress = false
this.isPressed = false
@ -963,6 +966,21 @@ function RoleInfoLayout:LvUpClick(isSingleLvUp)
end
end
end
function RoleInfoLayout:ShowCostNotEnoughTip()
if isHeroUpTuPo then
PopupTipPanel.ShowTip(BagManager.GetItemNameById(costId).."不足无法突破")
else
PopupTipPanel.ShowTip(BagManager.GetItemNameById(costId).."不足无法升级")
end
if costId==4 then
UIManager.OpenPanel(UIName.RewardItemSingleShowPopup,4)
end
end
--长按升级结束后请求协议
function RoleInfoLayout:LongLvUpClick(oldLv)
NetManager.HeroLvUpEvent(curHeroData.dynamicId,curHeroData.lv,oldLv,function (msg)
@ -1007,6 +1025,8 @@ function RoleInfoLayout:DeleteLvUpMaterials()
this.ShowProAddVal(allAddProValOld)
end
--连续升级更新后端英雄数据
function RoleInfoLayout:DeleteLvUpMaterials2(msg)
for i, v in pairs(herodatas) do