【灵兽分解】分解完碎片后,显示错误
parent
e2caaafbc5
commit
11b5425f8b
|
@ -89,98 +89,86 @@ function this:BindEvent()
|
|||
end
|
||||
UIManager.OpenPanel(UIName.MainShopPanel, SHOP_TYPE.SOUL_CONTRACT_SHOP)
|
||||
end)
|
||||
|
||||
--放生按钮
|
||||
Util.AddClick(this.confirmBtn,function()
|
||||
if isPokemon and tonumber(LengthOfTable(selectHeroData))==0 then
|
||||
PopupTipPanel.ShowTip(Language[11746])
|
||||
return
|
||||
--放生按钮
|
||||
Util.AddClick(this.confirmBtn,function()
|
||||
if isPokemon and tonumber(LengthOfTable(selectHeroData))==0 then
|
||||
PopupTipPanel.ShowTip(Language[11746])
|
||||
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
|
||||
|
||||
if not isPokemon and (selectChipId==0 or selectChipNum==0) then
|
||||
PopupTipPanel.ShowTip(Language[11746])
|
||||
return
|
||||
--升星消耗
|
||||
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
|
||||
|
||||
--奖励物品
|
||||
--所有材料
|
||||
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
|
||||
|
||||
--显示分解界面
|
||||
UIManager.OpenPanel(UIName.GeneralPopup,GENERAL_POPUP_TYPE.PokemonRestore,allMaterials,function()
|
||||
LogError("灵兽长度 "..#pokemonIds.."碎片id "..selectChipId.." num"..selectChipNum)
|
||||
NetManager.PokemonFreeRequest(pokemonIds,selectChipId,selectChipNum,function(msg)
|
||||
UIManager.OpenPanel(UIName.RewardItemPopup,msg.drop,1,function()
|
||||
|
||||
end)
|
||||
if pokemonIds and #pokemonIds>0 then
|
||||
PokemonManager.RemovePokemonData(pokemonIds)
|
||||
-- else
|
||||
-- LogError("分解前数量"..BagManager.GetItemCountById(selectChipId))
|
||||
-- BagManager.HeroLvUpUpdateItemsNum(selectChipId,selectChipNum)
|
||||
-- LogError("分解后数量"..BagManager.GetItemCountById(selectChipId))
|
||||
end
|
||||
this.SortTypeClick(sortingOrder)
|
||||
end
|
||||
--显示分解界面
|
||||
UIManager.OpenPanel(UIName.GeneralPopup,GENERAL_POPUP_TYPE.PokemonRestore,allMaterials,function()
|
||||
LogError("灵兽长度 "..#pokemonIds.."碎片id "..selectChipId.." num"..selectChipNum)
|
||||
NetManager.PokemonFreeRequest(pokemonIds,selectChipId,selectChipNum,function(msg)
|
||||
UIManager.OpenPanel(UIName.RewardItemPopup,msg.drop,1)
|
||||
if pokemonIds and #pokemonIds>0 then
|
||||
PokemonManager.RemovePokemonData(pokemonIds)
|
||||
end
|
||||
this.SortTypeClick(sortingOrder)
|
||||
this.chipObj:SetActive(false)
|
||||
this.selectText.gameObject:SetActive(true)
|
||||
end)
|
||||
|
||||
end)
|
||||
|
||||
end)
|
||||
|
||||
end)
|
||||
end)
|
||||
end
|
||||
|
||||
function this:AddListener()
|
||||
|
@ -210,16 +198,16 @@ function this.SortTypeClick(_sortType,isTop,isAni)
|
|||
hero.star=v.star
|
||||
hero.lv=v.lv
|
||||
hero.dynamicId=v.dynamicId
|
||||
hero.ischip=0
|
||||
hero.icon= GetResourcePath(heroConfig.Icon)
|
||||
hero.ischip=0
|
||||
hero.icon= GetResourcePath(heroConfig.Icon)
|
||||
hero.id=v.id
|
||||
hero.quality=heroConfig.Quality
|
||||
hero.name=heroConfig.Name
|
||||
hero.name=heroConfig.Name
|
||||
hero.returnCoin=heroConfig.CoinReturn
|
||||
hero.frame=GetHeroQuantityImageByquality(heroConfig.Quality)
|
||||
hero.num=1
|
||||
table.insert(items,hero)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -254,12 +242,6 @@ function this.SortTypeClick(_sortType,isTop,isAni)
|
|||
this.ScrollView:SetData(heroDatas, function (index, go)
|
||||
this.SingleHeroDataShow(go, heroDatas[index],false)
|
||||
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
|
||||
|
||||
--英雄单个数据展示
|
||||
|
@ -371,8 +353,7 @@ function this.SingleHeroDataShow(go,_heroData,isGray)
|
|||
this.selectText.gameObject:SetActive(true)
|
||||
this.chipObj:SetActive(false)
|
||||
isPokemon = true
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
end)
|
||||
|
||||
|
@ -380,7 +361,6 @@ function this.SingleHeroDataShow(go,_heroData,isGray)
|
|||
Util.AddOnceClick(formationMask, function()
|
||||
PopupTipPanel.ShowTip(Language[11748])
|
||||
end)
|
||||
|
||||
end
|
||||
--英雄排序
|
||||
function this.SortHeroDatas(_heroDatas)
|
||||
|
@ -406,8 +386,6 @@ function this.SortHeroDatas(_heroDatas)
|
|||
else
|
||||
return a.ischip<b.ischip
|
||||
end
|
||||
|
||||
|
||||
end)
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in New Issue