【宝物合成】一键合成预览处显示错误
parent
78634d7e04
commit
ba8b5a3c93
|
|
@ -6864,7 +6864,7 @@ GameObject:
|
|||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 0
|
||||
m_IsActive: 1
|
||||
--- !u!224 &2911701139505363764
|
||||
RectTransform:
|
||||
m_ObjectHideFlags: 0
|
||||
|
|
@ -6882,7 +6882,7 @@ RectTransform:
|
|||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0.5, y: 1}
|
||||
m_AnchorMax: {x: 0.5, y: 1}
|
||||
m_AnchoredPosition: {x: -274.2, y: -871.99994}
|
||||
m_AnchoredPosition: {x: -272.7, y: -871.99994}
|
||||
m_SizeDelta: {x: 295.63, y: 84.151}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!222 &2597305330074143555
|
||||
|
|
@ -13129,7 +13129,7 @@ ParticleSystem:
|
|||
--- !u!199 &1083645269967354099
|
||||
ParticleSystemRenderer:
|
||||
serializedVersion: 6
|
||||
m_ObjectHideFlags: 2
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
|
|
@ -19940,7 +19940,7 @@ RectTransform:
|
|||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0.5, y: 1}
|
||||
m_AnchorMax: {x: 0.5, y: 1}
|
||||
m_AnchoredPosition: {x: 0, y: -872}
|
||||
m_AnchoredPosition: {x: 268.78, y: -872}
|
||||
m_SizeDelta: {x: 295.63, y: 84.151}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!222 &3648998059851915409
|
||||
|
|
@ -26251,7 +26251,7 @@ ParticleSystem:
|
|||
--- !u!199 &8451515492985319499
|
||||
ParticleSystemRenderer:
|
||||
serializedVersion: 6
|
||||
m_ObjectHideFlags: 2
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
|
|
@ -32511,7 +32511,7 @@ ParticleSystem:
|
|||
--- !u!199 &6598447891554960103
|
||||
ParticleSystemRenderer:
|
||||
serializedVersion: 6
|
||||
m_ObjectHideFlags: 2
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
|
|
@ -43665,7 +43665,7 @@ ParticleSystem:
|
|||
--- !u!199 &5882379970318000206
|
||||
ParticleSystemRenderer:
|
||||
serializedVersion: 6
|
||||
m_ObjectHideFlags: 2
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
|
|
|
|||
|
|
@ -1334,6 +1334,7 @@ HELP_TYPE = {
|
|||
TimeLimitedCall=57,-- 限时召唤
|
||||
TreasureOfHeaven=58,--天宫秘宝
|
||||
QianKunBox=59,--乾坤宝囊
|
||||
TreasureResolve=60, --宝物分解
|
||||
}
|
||||
|
||||
NumToComplexFont = {
|
||||
|
|
|
|||
|
|
@ -16,7 +16,6 @@ local curNeedEquip = {}
|
|||
local curSelectEquip = {}
|
||||
local curSelectGO
|
||||
local materidaIsCan = false
|
||||
local bagPosEquips = {}
|
||||
local tabs={}
|
||||
function this:InitComponent(gameObject)
|
||||
this.tabBox = Util.GetGameObject(gameObject, "CompoundPanel_Treasure/TabBox")
|
||||
|
|
@ -90,8 +89,6 @@ function this.TreasureBtnClick(_btn,_curIndex)
|
|||
end
|
||||
--显示当前阵营的宝物
|
||||
function this.ShowCurrPosTreasures()
|
||||
bagPosEquips = EquipManager.GetEquipCompoundDataByEquipPosition1(curIndex)
|
||||
--LogError("curIndex "..curIndex)
|
||||
local equipDatas = EquipTreasureManager.GetAllTabletTreasuresByRace(curIndex)
|
||||
if equipDatas and #equipDatas > 0 then
|
||||
curSelectEquip = equipDatas[1]
|
||||
|
|
@ -225,108 +222,116 @@ function this.Compound()
|
|||
end)
|
||||
end
|
||||
|
||||
--一种装备一种装备的循环检测 金币能合成的数量 与 背包装备能合成的数量 取最小值 然后扣除临时消耗道具
|
||||
--最后所有装备存在curPosEquips 与 之前背包 bagPosEquips 作比较 看合成了什么装备 删除了什么装备 和计算消耗材料
|
||||
function this.AutoCompound(_position)
|
||||
--表数据
|
||||
local curPosEquips = EquipTreasureManager.GetAllTabletTreasuresByRaceAndType(_position)--,curSelectEquip.equipType)
|
||||
local shengGoldNum = 0
|
||||
--实际数据
|
||||
local curPosEquipsData = EquipTreasureManager.GeEquipTreasureDatas(_position)
|
||||
|
||||
local totalGoldNum = 0
|
||||
--jwelConfig.RankupResourcess对应所有背包数据
|
||||
local bagNums = {}
|
||||
--消耗材料对应所有背包数据
|
||||
--循环宝物的表消耗道具,得出对应的背包数据
|
||||
for i = 1, #curPosEquips do
|
||||
local equipData=curPosEquips[i]
|
||||
local equipData = curPosEquips[i]
|
||||
for j = 1, #equipData.costCoin do
|
||||
bagNums[equipData.costCoin[j][1]] = BagManager.GetItemCountById(equipData.costCoin[j][1])
|
||||
if not bagNums[equipData.costCoin[j][1]] then
|
||||
bagNums[equipData.costCoin[j][1]] = BagManager.GetItemCountById(equipData.costCoin[j][1])
|
||||
end
|
||||
end
|
||||
end
|
||||
--一种装备一种装备的循环检测 金币能合成的数量 与 背包装备能合成的数量 取最小值 然后扣除临时消耗道具
|
||||
--最后所有装备存在curPosEquips 与 之前背包 bagPosEquips 作比较 看合成了什么装备 删除了什么装备 和计算消耗材料
|
||||
local curRewards = {}
|
||||
--上一个便利的宝物的id和可合成数量
|
||||
local lastEquipId=0
|
||||
local lastEquipNum=0
|
||||
--便利符合条件的静态宝物数据
|
||||
|
||||
-- --LogGreen(LengthOfTable(bagNums))
|
||||
-- for n,m in pairs(bagNums) do
|
||||
-- --LogGreen("bagNums id:"..n.." num:"..m)
|
||||
-- end
|
||||
|
||||
--循环宝物的表数据,得到可以合成的宝物数量
|
||||
for i = 1, #curPosEquips do
|
||||
local equipData = curPosEquips[i]
|
||||
|
||||
--从表消耗道具得出可以合成的数量
|
||||
local materialEndNum = -1
|
||||
local materialNums = {}
|
||||
local equipData=curPosEquips[i]
|
||||
--循环宝物的表消耗数据,得出对应的消耗数据
|
||||
for j = 1, #equipData.costCoin do
|
||||
local itemId = equipData.costCoin[j][1]
|
||||
materialNums[itemId] = equipData.costCoin[j][2]
|
||||
local curItmeCompoundNums = math.floor(bagNums[itemId] / equipData.costCoin[j][2])
|
||||
--可以合成的宝物数量
|
||||
local config = ConfigManager.TryGetConfigDataByThreeKey(ConfigName.JewelConfig,"Location",equipData.equipType,"Level",equipData.quantity-1,"Race",_position)
|
||||
local curItmeCompoundNums = math.floor(bagNums[config.RankupResources[j][1]] / config.RankupResources[j][2])
|
||||
if materialEndNum == -1 then
|
||||
materialEndNum = curItmeCompoundNums
|
||||
elseif materialEndNum > curItmeCompoundNums then
|
||||
materialEndNum = curItmeCompoundNums
|
||||
end
|
||||
end
|
||||
if i <= #curPosEquips and materialEndNum>0 then
|
||||
--可合成当前装备的数量
|
||||
local materialHaveNum= LengthOfTable(EquipTreasureManager.GetBagCompoundEquipDatasByequipSData(equipData))
|
||||
--获取可以合成几个装备
|
||||
local curQuEquipCompoundNum = math.floor(materialHaveNum/equipData.quaUpCount)
|
||||
--加上上一个品质合成的装备
|
||||
local nextCompoundNum=math.floor((materialHaveNum+lastEquipNum)/equipData.quaUpCount)
|
||||
--如果加上一个品质合成的宝物又能多合成x个,算出多合成宝物需要消耗几个之前合成的,减去
|
||||
if nextCompoundNum>curQuEquipCompoundNum then
|
||||
local costNum=math.abs(materialHaveNum-(nextCompoundNum*equipData.quaUpCount))
|
||||
if curRewards[lastEquipId] then
|
||||
local haveNum=curRewards[lastEquipId]
|
||||
if haveNum<=costNum then
|
||||
curRewards[lastEquipId]=nil
|
||||
else
|
||||
--现在拥有的数量-提升消耗的-本来就有的=最终增加的
|
||||
local num=haveNum-costNum-materialHaveNum
|
||||
if num>0 then
|
||||
curRewards[lastEquipId]=num
|
||||
else
|
||||
curRewards[lastEquipId]=nil
|
||||
end
|
||||
end
|
||||
end
|
||||
curQuEquipCompoundNum=nextCompoundNum
|
||||
end
|
||||
--LogGreen("materialEndNum:"..materialEndNum)
|
||||
|
||||
if materialEndNum > 0 then
|
||||
--可消耗宝物的数量 (没有强化,没有精炼,没有装备,同样的位置,品级-1)
|
||||
local materialHaveNum= curPosEquipsData[equipData.equipType][equipData.quantity-1]
|
||||
--LogGreen("equipData.quantity-1:".. equipData.quantity - 1 .."num:".. materialHaveNum)
|
||||
--可以合成的
|
||||
local nextCompoundNum = math.floor(materialHaveNum / equipData.quaUpCount)
|
||||
--LogGreen("可以合成:".. nextCompoundNum .."个品质为"..equipData.quantity.."的宝器")
|
||||
|
||||
--消耗物品可以合成的和材料合成的作比较,取最小值
|
||||
local endCompoundNum = materialEndNum > curQuEquipCompoundNum and curQuEquipCompoundNum or materialEndNum
|
||||
--LogError("endCompoundNum "..endCompoundNum)
|
||||
for itemId, num in pairs(materialNums) do
|
||||
bagNums[itemId] = bagNums[itemId] - endCompoundNum * num
|
||||
shengGoldNum = shengGoldNum + endCompoundNum * num
|
||||
end
|
||||
local endCompoundNum = materialEndNum > nextCompoundNum and nextCompoundNum or materialEndNum
|
||||
--LogGreen("结合材料可以合成:".. endCompoundNum .."个品质为"..equipData.quantity.."的宝器")
|
||||
|
||||
--如果当前品质宝物可以合成,就把当前品质的id及合成的数量储存,判断下一个品质加上当前合成的是否能多合成
|
||||
if endCompoundNum>0 then
|
||||
lastEquipId=equipData.Id
|
||||
lastEquipNum=endCompoundNum
|
||||
--table.insert(curRewards,{equipData.Id,endCompoundNum})
|
||||
curRewards[equipData.Id]=endCompoundNum
|
||||
else
|
||||
lastEquipId=0
|
||||
lastEquipNum=0
|
||||
if endCompoundNum > 0 then
|
||||
local config = ConfigManager.TryGetConfigDataByThreeKey(ConfigName.JewelConfig,"Location",equipData.equipType,"Level",equipData.quantity-1,"Race",_position)
|
||||
if not config then
|
||||
LogRed("Location:".. equipData.equipType .." Level".. equipData.quantity-1 .." Race".. _position)
|
||||
else
|
||||
for j = 1, #config.RankupResources do
|
||||
bagNums[config.RankupResources[j][1]] =
|
||||
bagNums[config.RankupResources[j][1]] - endCompoundNum * config.RankupResources[j][2]
|
||||
totalGoldNum = totalGoldNum + endCompoundNum * config.RankupResources[j][2]
|
||||
--LogGreen("合成:".. endCompoundNum .."个品质为"..equipData.quantity.."的宝器需要消耗"..config.RankupResources[j][1].." "..endCompoundNum * config.RankupResources[j][2])
|
||||
--LogGreen("bagNums[config.RankupResources[j][1]]:"..bagNums[config.RankupResources[j][1]])
|
||||
end
|
||||
--消耗之后剩余的数量
|
||||
--LogGreen("消耗curPosEquipsData[equipData.equipType][equipData.quantity - 1]之前:"..curPosEquipsData[equipData.equipType][equipData.quantity - 1])
|
||||
curPosEquipsData[equipData.equipType][equipData.quantity - 1] = materialHaveNum - (endCompoundNum * equipData.quaUpCount)
|
||||
--LogGreen("合成:".. endCompoundNum .."个品质为"..equipData.quantity.."的宝器需要消耗".. equipData.quantity - 1 .." "..endCompoundNum * equipData.quaUpCount)
|
||||
--LogGreen("消耗curPosEquipsData[equipData.equipType][equipData.quantity - 1]之后:"..curPosEquipsData[equipData.equipType][equipData.quantity - 1])
|
||||
--LogGreen("合成curPosEquipsData[equipData.equipType][equipData.quantity]之前:"..curPosEquipsData[equipData.equipType][equipData.quantity])
|
||||
curPosEquipsData[equipData.equipType][equipData.quantity] = curPosEquipsData[equipData.equipType][equipData.quantity] + endCompoundNum
|
||||
--LogGreen("合成curPosEquipsData[equipData.equipType][equipData.quantity]之后:"..curPosEquipsData[equipData.equipType][equipData.quantity])
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
local origiData = EquipTreasureManager.GeEquipTreasureDatas(_position)
|
||||
local endReward={}
|
||||
for i, v in pairs(curRewards) do
|
||||
table.insert(endReward,{i,v})
|
||||
for i, v in pairs(curPosEquipsData) do
|
||||
for n, m in pairs(v) do
|
||||
--LogGreen("m:"..m.." origiData[i][n]:"..origiData[i][n])
|
||||
if m > origiData[i][n] then
|
||||
local config = ConfigManager.TryGetConfigDataByThreeKey(ConfigName.JewelConfig,"Location",i,"Level",n,"Race",_position)
|
||||
--LogGreen("config.id:"..config.Id.." num:"..m - origiData[i][n])
|
||||
table.insert(endReward,{config.Id,m - origiData[i][n]})
|
||||
end
|
||||
end
|
||||
end
|
||||
if shengGoldNum <= 0 then
|
||||
--if curSelectEquip.equipType==1 then
|
||||
-- PopupTipPanel.ShowTip("无可合成魂宝或金币不足!")
|
||||
--else
|
||||
-- PopupTipPanel.ShowTip("无可合成灵宝或金币不足!")
|
||||
--end
|
||||
PopupTipPanel.ShowTip(Language[10435])
|
||||
if LengthOfTable(endReward) < 1 then
|
||||
PopupTipPanel.ShowTip("消耗材料不足")
|
||||
return
|
||||
end
|
||||
end
|
||||
--BagManager.GetItemCountById(14) -
|
||||
UIManager.OpenPanel(UIName.GeneralPopup,GENERAL_POPUP_TYPE.TreasureCompound,
|
||||
shengGoldNum,endReward,function ()
|
||||
NetManager.ComplexTreasureRequest(curSelectEquip.equipType,curIndex,0,0, function(msg)
|
||||
for i = 1, #msg.equipIds do
|
||||
EquipTreasureManager.RemoveTreasureByIdDyn(msg.equipIds[i])
|
||||
end
|
||||
UIManager.OpenPanel(UIName.RewardItemPopup,msg.drop,1,function()
|
||||
this.ShowCurrPosTreasures()
|
||||
end)
|
||||
end)
|
||||
--LogGreen("totalGoldNum:"..totalGoldNum)
|
||||
UIManager.OpenPanel(UIName.GeneralPopup,GENERAL_POPUP_TYPE.TreasureCompound,totalGoldNum,endReward,function ()
|
||||
NetManager.ComplexTreasureRequest(curSelectEquip.equipType,curIndex,0,0, function(msg)
|
||||
for i = 1, #msg.equipIds do
|
||||
EquipTreasureManager.RemoveTreasureByIdDyn(msg.equipIds[i])
|
||||
end
|
||||
UIManager.OpenPanel(UIName.RewardItemPopup,msg.drop,1,function()
|
||||
this.ShowCurrPosTreasures()
|
||||
end)
|
||||
end)
|
||||
end)
|
||||
end
|
||||
|
||||
-- tab节点显示自定义
|
||||
|
|
|
|||
|
|
@ -363,7 +363,7 @@ function this.GetHeroFormationStr2(teamId)
|
|||
return ""
|
||||
end
|
||||
--删除本地英雄信息
|
||||
function this.DeleteHeroDatas(heroDIds)
|
||||
function this.DeleteHeroDatas(heroDIds,index)
|
||||
for i = 1, #heroDIds do
|
||||
if heroDatas[heroDIds[i]] then
|
||||
--清除英雄装备上挂载的英雄id
|
||||
|
|
@ -2763,4 +2763,11 @@ function this.GetIsShowTalismanRedPoint(curHeroData)
|
|||
end
|
||||
return true
|
||||
end
|
||||
|
||||
function this.ResetHero(dynamicloadId)
|
||||
if heroDatas[dynamicloadId] then
|
||||
heroDatas[dynamicloadId].lv = 1
|
||||
heroDatas[dynamicloadId].breakId = 0
|
||||
end
|
||||
end
|
||||
return this
|
||||
|
|
@ -35,11 +35,11 @@ function this:BindEvent()
|
|||
break
|
||||
end
|
||||
NetManager.HeroRetureEvent(data, function(msg)
|
||||
HeroManager.DeleteHeroDatas({data})
|
||||
HeroManager.ResetHero(data)
|
||||
PopupTipPanel.ShowTip("神将归元成功,等级重置为1级")
|
||||
parent:ClosePanel()
|
||||
UIManager.OpenPanel(UIName.RewardItemPopup,msg.drop,1,function ()
|
||||
ResolvePanel.SwitchView(1)
|
||||
PopupTipPanel.ShowTip(Language[12210])
|
||||
ResolvePanel.SwitchView(1)
|
||||
end,0,nil,nil,1)
|
||||
end)
|
||||
end)
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ end
|
|||
|
||||
function this:BindEvent()
|
||||
Util.AddClick(this.helpBtn,function()
|
||||
UIManager.OpenPanel(UIName.HelpPopup,HELP_TYPE.Resolve_Dismantle,this.helpPos.x,this.helpPos.y)
|
||||
UIManager.OpenPanel(UIName.HelpPopup,HELP_TYPE.TreasureResolve,this.helpPos.x,this.helpPos.y)
|
||||
end)
|
||||
Util.AddClick(this.confirmBtn,function()
|
||||
if tonumber(LengthOfTable(selectEquipTreasureData))==0 then
|
||||
|
|
|
|||
|
|
@ -231,6 +231,33 @@ function this.GetAllTabletTreasuresByRaceAndType(_index, _Location)
|
|||
end
|
||||
end
|
||||
|
||||
--获取所有可以合成宝物的数据
|
||||
function this.GeEquipTreasureDatas(_index)
|
||||
local equips = {}
|
||||
for i=1, 2 do
|
||||
if not equips[i] then
|
||||
equips[i] = {}
|
||||
end
|
||||
for j=2, 6 do
|
||||
equips[i][j] = 0
|
||||
end
|
||||
end
|
||||
|
||||
for i, v in pairs(allTreasures) do
|
||||
if v.upHeroDid == "" and v.lv == 0 and v.refineLv == 0 and v.race == _index then
|
||||
if not equips[v.equipType] then
|
||||
equips[v.equipType] = {}
|
||||
end
|
||||
if not equips[v.equipType][v.quantity] then
|
||||
equips[v.equipType][v.quantity] = 1
|
||||
else
|
||||
equips[v.equipType][v.quantity] = equips[v.equipType][v.quantity] + 1
|
||||
end
|
||||
end
|
||||
end
|
||||
return equips
|
||||
end
|
||||
|
||||
--获取所有可以合成宝物的数据
|
||||
function this.GetBagCompoundEquipDatasByequipSData(equipSData)
|
||||
local equips = {}
|
||||
|
|
@ -247,6 +274,7 @@ function this.GetBagCompoundEquipDatasByequipSData(equipSData)
|
|||
end
|
||||
return equips
|
||||
end
|
||||
|
||||
--获取可以合成宝物的数量根据宝物id
|
||||
function this.GetCanCompoundTreasureNumByTreasureId(_id, _type)
|
||||
local equips = {}
|
||||
|
|
|
|||
Loading…
Reference in New Issue