【灵兽分解】分解完碎片后,显示错误

dev_chengFeng
ZhangBiao 2021-08-18 17:53:52 +08:00
parent e2caaafbc5
commit 11b5425f8b
1 changed files with 80 additions and 102 deletions

View File

@ -89,98 +89,86 @@ function this:BindEvent()
end end
UIManager.OpenPanel(UIName.MainShopPanel, SHOP_TYPE.SOUL_CONTRACT_SHOP) UIManager.OpenPanel(UIName.MainShopPanel, SHOP_TYPE.SOUL_CONTRACT_SHOP)
end) end)
--放生按钮
--放生按钮 Util.AddClick(this.confirmBtn,function()
Util.AddClick(this.confirmBtn,function() if isPokemon and tonumber(LengthOfTable(selectHeroData))==0 then
if isPokemon and tonumber(LengthOfTable(selectHeroData))==0 then PopupTipPanel.ShowTip(Language[11746])
PopupTipPanel.ShowTip(Language[11746]) return
return end
if not isPokemon and (selectChipId==0 or selectChipNum==0) then
PopupTipPanel.ShowTip(Language[11746])
return
end
--奖励物品
--所有材料
local allMaterials={}
local pokemonIds={}
--灵兽
if isPokemon then
local allCoin=0
for key, value in pairs(selectHeroData) do
--升级消耗
table.insert(pokemonIds,key)
local lvConfig=ConfigManager.GetConfigDataByDoubleKey(ConfigName.SpiritAnimalLevel,"Level",value.lv,"Quality",value.quality)
if lvConfig then
local matrs=lvConfig.SumConsume
if matrs then
for i = 1, #matrs do
local mat=matrs[i]
table.insert(allMaterials,{mat[1],mat[2]})
end
end
end end
--升星消耗
if not isPokemon and (selectChipId==0 or selectChipNum==0) then local lingshouConfig=ConfigManager.GetConfigData(ConfigName.SpiritAnimal,value.id)
PopupTipPanel.ShowTip(Language[11746]) local haveNum=0
return if value.star>0 then
local starConfig=ConfigManager.GetConfigDataByDoubleKey(ConfigName.SpiritAnimalStar,"Star",value.star,"Quality",value.quality)
if starConfig then
haveNum=starConfig.SumItemNum
local starMatrs=starConfig.SumConsume
--消耗材料
if starMatrs then
for i = 1, #starMatrs do
local starm=starMatrs[i]
table.insert(allMaterials,{starm[1],starm[2]})
end
end
end
end
--消耗本体数量,分解成碎片
allCoin=allCoin+lingshouConfig.CoinReturn[2]*(haveNum+1)
end
--加上所有的分解币
table.insert(allMaterials,{1205,allCoin})
else--灵兽碎片
local itemConfig=ConfigManager.GetConfigData(ConfigName.ItemConfig,selectChipId)
if itemConfig then
local groupId=itemConfig.RewardGroup[1]
local groupConfig=ConfigManager.GetConfigData(ConfigName.RewardGroup,groupId)
if groupConfig then
LogError("掉落组显示:"..groupConfig.ShowItem[1][1])
local pokemon=ConfigManager.GetConfigData(ConfigName.SpiritAnimal,groupConfig.ShowItem[1][1])
if pokemon then
table.insert(allMaterials,{pokemon.PiecesCoinReturn[1],pokemon.PiecesCoinReturn[2]*selectChipNum})
end end
--奖励物品
--所有材料
local allMaterials={}
local pokemonIds={}
--灵兽
if isPokemon then
local allCoin=0
for key, value in pairs(selectHeroData) do
--升级消耗
table.insert(pokemonIds,key)
local lvConfig=ConfigManager.GetConfigDataByDoubleKey(ConfigName.SpiritAnimalLevel,"Level",value.lv,"Quality",value.quality)
if lvConfig then
local matrs=lvConfig.SumConsume
if matrs then
for i = 1, #matrs do
local mat=matrs[i]
table.insert(allMaterials,{mat[1],mat[2]})
end
end
end
--升星消耗
local lingshouConfig=ConfigManager.GetConfigData(ConfigName.SpiritAnimal,value.id)
local haveNum=0
if value.star>0 then
local starConfig=ConfigManager.GetConfigDataByDoubleKey(ConfigName.SpiritAnimalStar,"Star",value.star,"Quality",value.quality)
if starConfig then
haveNum=starConfig.SumItemNum
local starMatrs=starConfig.SumConsume
--消耗材料
if starMatrs then
for i = 1, #starMatrs do
local starm=starMatrs[i]
table.insert(allMaterials,{starm[1],starm[2]})
end
end
end
end
--消耗本体数量,分解成碎片
allCoin=allCoin+lingshouConfig.CoinReturn[2]*(haveNum+1)
end
--加上所有的分解币
table.insert(allMaterials,{1205,allCoin})
else--灵兽碎片
local itemConfig=ConfigManager.GetConfigData(ConfigName.ItemConfig,selectChipId)
if itemConfig then
local groupId=itemConfig.RewardGroup[1]
local groupConfig=ConfigManager.GetConfigData(ConfigName.RewardGroup,groupId)
if groupConfig then
LogError("掉落组显示:"..groupConfig.ShowItem[1][1])
local pokemon=ConfigManager.GetConfigData(ConfigName.SpiritAnimal,groupConfig.ShowItem[1][1])
if pokemon then
table.insert(allMaterials,{pokemon.PiecesCoinReturn[1],pokemon.PiecesCoinReturn[2]*selectChipNum})
end
end
end end
end end
end
--显示分解界面 --显示分解界面
UIManager.OpenPanel(UIName.GeneralPopup,GENERAL_POPUP_TYPE.PokemonRestore,allMaterials,function() UIManager.OpenPanel(UIName.GeneralPopup,GENERAL_POPUP_TYPE.PokemonRestore,allMaterials,function()
LogError("灵兽长度 "..#pokemonIds.."碎片id "..selectChipId.." num"..selectChipNum) LogError("灵兽长度 "..#pokemonIds.."碎片id "..selectChipId.." num"..selectChipNum)
NetManager.PokemonFreeRequest(pokemonIds,selectChipId,selectChipNum,function(msg) NetManager.PokemonFreeRequest(pokemonIds,selectChipId,selectChipNum,function(msg)
UIManager.OpenPanel(UIName.RewardItemPopup,msg.drop,1,function() UIManager.OpenPanel(UIName.RewardItemPopup,msg.drop,1)
if pokemonIds and #pokemonIds>0 then
end) PokemonManager.RemovePokemonData(pokemonIds)
if pokemonIds and #pokemonIds>0 then end
PokemonManager.RemovePokemonData(pokemonIds) this.SortTypeClick(sortingOrder)
-- else this.chipObj:SetActive(false)
-- LogError("分解前数量"..BagManager.GetItemCountById(selectChipId)) this.selectText.gameObject:SetActive(true)
-- BagManager.HeroLvUpUpdateItemsNum(selectChipId,selectChipNum)
-- LogError("分解后数量"..BagManager.GetItemCountById(selectChipId))
end
this.SortTypeClick(sortingOrder)
end) end)
end)
end) end)
end)
end end
function this:AddListener() function this:AddListener()
@ -210,16 +198,16 @@ function this.SortTypeClick(_sortType,isTop,isAni)
hero.star=v.star hero.star=v.star
hero.lv=v.lv hero.lv=v.lv
hero.dynamicId=v.dynamicId hero.dynamicId=v.dynamicId
hero.ischip=0 hero.ischip=0
hero.icon= GetResourcePath(heroConfig.Icon) hero.icon= GetResourcePath(heroConfig.Icon)
hero.id=v.id hero.id=v.id
hero.quality=heroConfig.Quality hero.quality=heroConfig.Quality
hero.name=heroConfig.Name hero.name=heroConfig.Name
hero.returnCoin=heroConfig.CoinReturn hero.returnCoin=heroConfig.CoinReturn
hero.frame=GetHeroQuantityImageByquality(heroConfig.Quality) hero.frame=GetHeroQuantityImageByquality(heroConfig.Quality)
hero.num=1 hero.num=1
table.insert(items,hero) table.insert(items,hero)
end end
end end
end end
@ -254,12 +242,6 @@ function this.SortTypeClick(_sortType,isTop,isAni)
this.ScrollView:SetData(heroDatas, function (index, go) this.ScrollView:SetData(heroDatas, function (index, go)
this.SingleHeroDataShow(go, heroDatas[index],false) this.SingleHeroDataShow(go, heroDatas[index],false)
end,isTop,isAni) end,isTop,isAni)
-- this.ScrollView:ForeachItemGO(function(index, go)
-- Timer.New(function()
-- go.gameObject:SetActive(true)
-- PlayUIAnim(go.gameObject)
-- end, 0.001 * (index - 1)):Start()
-- end)
end end
--英雄单个数据展示 --英雄单个数据展示
@ -371,8 +353,7 @@ function this.SingleHeroDataShow(go,_heroData,isGray)
this.selectText.gameObject:SetActive(true) this.selectText.gameObject:SetActive(true)
this.chipObj:SetActive(false) this.chipObj:SetActive(false)
isPokemon = true isPokemon = true
end end
end end
end) end)
@ -380,7 +361,6 @@ function this.SingleHeroDataShow(go,_heroData,isGray)
Util.AddOnceClick(formationMask, function() Util.AddOnceClick(formationMask, function()
PopupTipPanel.ShowTip(Language[11748]) PopupTipPanel.ShowTip(Language[11748])
end) end)
end end
--英雄排序 --英雄排序
function this.SortHeroDatas(_heroDatas) function this.SortHeroDatas(_heroDatas)
@ -406,8 +386,6 @@ function this.SortHeroDatas(_heroDatas)
else else
return a.ischip<b.ischip return a.ischip<b.ischip
end end
end) end)
end end