显示优化
This commit is contained in:
parent
eb2e858213
commit
cff917cac8
@ -650,23 +650,21 @@ function GFunc.addCosts(costs, itemGetType)
|
||||
end
|
||||
|
||||
-- 奖励排序 结构为后端结构
|
||||
-- function GFunc.sortRewards(rewards)
|
||||
-- rewards = rewards or {}
|
||||
-- local maxType = 10
|
||||
-- for i,v in ipairs(rewards) do
|
||||
-- if v.type == GConst.REWARD_TYPE.ITEM then
|
||||
-- rewards[i].sort = (maxType - v.type) * 1000000000 + (1000000000 - v.item.cfg_id)
|
||||
-- elseif v.type == GConst.REWARD_TYPE.EQUIP then
|
||||
-- local cfg = ConfigManager:getConfig("equip")[v.equip.id]
|
||||
-- rewards[i].sort = (maxType - v.type) * 1000000000 + cfg.qlt*100000000 + v.equip.id
|
||||
-- elseif v.type == GConst.REWARD_TYPE.JEWELRY then
|
||||
-- rewards[i].sort = (maxType - v.type) * 1000000000 + (1000000000 - v.jewelry.cfg_id)
|
||||
-- end
|
||||
-- end
|
||||
-- table.sort(rewards, function (a, b)
|
||||
-- return a.sort > b.sort
|
||||
-- end)
|
||||
-- end
|
||||
function GFunc.sortRewards(rewards)
|
||||
rewards = rewards or {}
|
||||
local maxType = 10
|
||||
for i,v in ipairs(rewards) do
|
||||
if v.type == GConst.REWARD_TYPE.ITEM then
|
||||
rewards[i].sort = (maxType - v.type) * 1000000000 + v.item.id
|
||||
elseif v.type == GConst.REWARD_TYPE.EQUIP then
|
||||
local cfg = ConfigManager:getConfig("equip")[v.equip.id]
|
||||
rewards[i].sort = (maxType - v.type) * 1000000000 + cfg.qlt*100000000 + v.equip.id
|
||||
end
|
||||
end
|
||||
table.sort(rewards, function (a, b)
|
||||
return a.sort > b.sort
|
||||
end)
|
||||
end
|
||||
|
||||
---- 奖励展示接口
|
||||
function GFunc.showRewardBox(rewards, extParams, callback)
|
||||
@ -683,7 +681,7 @@ function GFunc.showRewardBox(rewards, extParams, callback)
|
||||
ModuleManager.TipsManager:showRewardsBox(params)
|
||||
end
|
||||
|
||||
function GFunc.mergeRewards2(rewards, newRewards)
|
||||
function GFunc.mergeRewards2(rewards, newRewards, needSort)
|
||||
local items = {}
|
||||
for i,v in ipairs(rewards) do
|
||||
if v.type == GConst.REWARD_TYPE.ITEM then
|
||||
@ -695,6 +693,9 @@ function GFunc.mergeRewards2(rewards, newRewards)
|
||||
for k,v in pairs(items) do
|
||||
table.insert(newRewards, {type = GConst.REWARD_TYPE.ITEM, item = {id = k, count = v}})
|
||||
end
|
||||
if needSort then
|
||||
GFunc.sortRewards(newRewards)
|
||||
end
|
||||
end
|
||||
|
||||
-- reward 结构为 type id num 配置中结构
|
||||
|
||||
@ -86,8 +86,13 @@ function ChapterManager:endFightFinish(result)
|
||||
end
|
||||
|
||||
if rewards then
|
||||
GFunc.mergeRewards2(rewards, newRewards)
|
||||
local mergeRewards = {}
|
||||
GFunc.mergeRewards2(rewards, mergeRewards, true)
|
||||
for _, unit in ipairs(mergeRewards) do
|
||||
table.insert(newRewards, unit)
|
||||
end
|
||||
end
|
||||
|
||||
ModuleManager.BattleManager:showBattleResultUI(newRewards, reqData.combatReport, mysteryBoxIdx)
|
||||
DataManager.ChapterData:fightChapter(reqData.chapter_id, result.max_chapter_id, result.max_wave, reqData.mystery_box_idx)
|
||||
-- 处理金猪,要在章节更新之后
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user