fix
This commit is contained in:
parent
045b774449
commit
6099fe08fb
@ -112,6 +112,7 @@ BIReport.ITEM_GET_TYPE = {
|
|||||||
DUNGEON_SHARDS_SWEEP = "DungeonShardsSweep", -- 碎片副本扫荡
|
DUNGEON_SHARDS_SWEEP = "DungeonShardsSweep", -- 碎片副本扫荡
|
||||||
ARENA_REMATCH_CD = "ArenaRematchCd",
|
ARENA_REMATCH_CD = "ArenaRematchCd",
|
||||||
ARENA_REWARD = "ArenaReward",
|
ARENA_REWARD = "ArenaReward",
|
||||||
|
ARENA_AD_BOX_REWARD = "ArenaAdBoxReward",
|
||||||
ARENA_SETTLEMENT = "ArenaSettlement",
|
ARENA_SETTLEMENT = "ArenaSettlement",
|
||||||
CHANGE_NAME = "ChangeName", -- 重命名
|
CHANGE_NAME = "ChangeName", -- 重命名
|
||||||
CHANGE_AVATAR = "ChangeAvatar", -- 修改头像
|
CHANGE_AVATAR = "ChangeAvatar", -- 修改头像
|
||||||
@ -130,6 +131,7 @@ BIReport.ADS_CLICK_TYPE = {
|
|||||||
IDLE_QUICK_DROP = "IdleQuickDrop",
|
IDLE_QUICK_DROP = "IdleQuickDrop",
|
||||||
ARENA_TICKET = "ArenaTicket",
|
ARENA_TICKET = "ArenaTicket",
|
||||||
ARENA_REMATCH = "ArenaRematch",
|
ARENA_REMATCH = "ArenaRematch",
|
||||||
|
ARENA_AD_BOX = "ArenaAdBox",
|
||||||
|
|
||||||
MALL_DAILY = "MallDaily",
|
MALL_DAILY = "MallDaily",
|
||||||
MALL_DAILY_RESET = "MallDailyReset",
|
MALL_DAILY_RESET = "MallDailyReset",
|
||||||
|
|||||||
@ -209,6 +209,17 @@ function ArenaManager:rspOverCD(result)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- 领取广告宝箱
|
||||||
|
function ArenaManager:reqAdBoxReward(isWin)
|
||||||
|
self:sendMessage(ProtoMsgType.FromMsgEnum.PVPSettlementADRewardReq, {win = isWin}, {}, self.rspAdBoxReward, BIReport.ITEM_GET_TYPE.ARENA_AD_BOX_REWARD)
|
||||||
|
end
|
||||||
|
|
||||||
|
function ArenaManager:rspAdBoxReward(result)
|
||||||
|
if result.err_code == GConst.ERROR_STR.SUCCESS then
|
||||||
|
ModuleManager.ShopManager:showBoxOpenUI({type = GConst.ShopConst.BOX_REWARD_TYPE.SUMMON, params = summonType, rewards = result.rewards})
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
function ArenaManager:showGiftPopUI()
|
function ArenaManager:showGiftPopUI()
|
||||||
UIManager:showUI("app/ui/arena/arena_pop_gift_ui")
|
UIManager:showUI("app/ui/arena/arena_pop_gift_ui")
|
||||||
end
|
end
|
||||||
|
|||||||
@ -1,9 +1,18 @@
|
|||||||
local ShopManager = class("ShopManager", BaseModule)
|
local ShopManager = class("ShopManager", BaseModule)
|
||||||
|
|
||||||
|
-- 展示商城宝箱
|
||||||
function ShopManager:showBoxHeroUI(type)
|
function ShopManager:showBoxHeroUI(type)
|
||||||
UIManager:showUI("app/ui/shop/box_hero_ui", {type = type})
|
UIManager:showUI("app/ui/shop/box_hero_ui", {type = type})
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- 展示竞技场ad宝箱
|
||||||
|
function ShopManager:showArenaAdBoxUI(isWin)
|
||||||
|
local params = {
|
||||||
|
isWin = isWin
|
||||||
|
}
|
||||||
|
UIManager:showUI("app/ui/shop/box_hero_ui", {arena = params})
|
||||||
|
end
|
||||||
|
|
||||||
function ShopManager:showBoxLevelUI()
|
function ShopManager:showBoxLevelUI()
|
||||||
UIManager:showUI("app/ui/shop/box_level_ui")
|
UIManager:showUI("app/ui/shop/box_level_ui")
|
||||||
end
|
end
|
||||||
|
|||||||
@ -66,6 +66,10 @@ function BattleResultUI:onClose()
|
|||||||
self.arenaSequence:Kill()
|
self.arenaSequence:Kill()
|
||||||
self.arenaSequence = nil
|
self.arenaSequence = nil
|
||||||
end
|
end
|
||||||
|
if self.arenaSpine then
|
||||||
|
self.arenaSpine:destroy()
|
||||||
|
self.arenaSpine = nil
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function BattleResultUI:onLoadRootComplete()
|
function BattleResultUI:onLoadRootComplete()
|
||||||
@ -133,7 +137,7 @@ function BattleResultUI:onLoadRootComplete()
|
|||||||
self:onClickMask()
|
self:onClickMask()
|
||||||
end)
|
end)
|
||||||
self.arenaBoxBtnGet:addClickListener(function()
|
self.arenaBoxBtnGet:addClickListener(function()
|
||||||
-- 打开宝箱界面
|
ModuleManager.ShopManager:showArenaAdBoxUI(self.isWin)
|
||||||
end)
|
end)
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -155,8 +159,8 @@ function BattleResultUI:onRefresh()
|
|||||||
self:refreshDefeatNode()
|
self:refreshDefeatNode()
|
||||||
AudioManager:playEffect(AudioManager.EFFECT_ID.BATTLE_DEFEAT)
|
AudioManager:playEffect(AudioManager.EFFECT_ID.BATTLE_DEFEAT)
|
||||||
end
|
end
|
||||||
self:refreshRewards()
|
|
||||||
self:refreshUnitInfo()
|
self:refreshUnitInfo()
|
||||||
|
self:refreshRewards()
|
||||||
self:refreshArenaNode()
|
self:refreshArenaNode()
|
||||||
self:refreshArenaBoxNode()
|
self:refreshArenaBoxNode()
|
||||||
end
|
end
|
||||||
@ -268,6 +272,8 @@ function BattleResultUI:refreshArenaNode()
|
|||||||
end
|
end
|
||||||
|
|
||||||
function BattleResultUI:refreshArenaBoxNode()
|
function BattleResultUI:refreshArenaBoxNode()
|
||||||
|
self.rewardScrollRect:setSizeDeltaY(260)
|
||||||
|
self.rewardScrollRect:setAnchoredPositionY(-268)
|
||||||
if self.battleType ~= GConst.BattleConst.BATTLE_TYPE.ARENA then
|
if self.battleType ~= GConst.BattleConst.BATTLE_TYPE.ARENA then
|
||||||
self.arenaBoxNode:setVisible(false)
|
self.arenaBoxNode:setVisible(false)
|
||||||
return
|
return
|
||||||
@ -280,6 +286,8 @@ function BattleResultUI:refreshArenaBoxNode()
|
|||||||
end
|
end
|
||||||
self.arenaBoxNode:setVisible(true)
|
self.arenaBoxNode:setVisible(true)
|
||||||
self.arenaBoxTxGet:setText(I18N:getGlobalText(I18N.GlobalConst.BTN_CLAIM))
|
self.arenaBoxTxGet:setText(I18N:getGlobalText(I18N.GlobalConst.BTN_CLAIM))
|
||||||
|
self.rewardScrollRect:setSizeDeltaY(120)
|
||||||
|
self.rewardScrollRect:setAnchoredPositionY(-255)
|
||||||
|
|
||||||
if self.isWin then
|
if self.isWin then
|
||||||
-- 胜利宝箱
|
-- 胜利宝箱
|
||||||
|
|||||||
@ -15,7 +15,8 @@ local MAX_ITEM_NUM = 4
|
|||||||
function BoxHeroUI:ctor(params)
|
function BoxHeroUI:ctor(params)
|
||||||
params = params or {}
|
params = params or {}
|
||||||
|
|
||||||
self.summonType = params.type or GConst.SummonConst.SUMMON_TYPE.LV_1
|
self.summonType = params.type
|
||||||
|
self.arenaBoxInfo = params.arena
|
||||||
end
|
end
|
||||||
|
|
||||||
function BoxHeroUI:isFullScreen()
|
function BoxHeroUI:isFullScreen()
|
||||||
@ -39,9 +40,14 @@ function BoxHeroUI:onLoadRootComplete()
|
|||||||
self.titleTx = self.uiMap["box_hero_ui.bg.title"]
|
self.titleTx = self.uiMap["box_hero_ui.bg.title"]
|
||||||
self.boxImg = self.uiMap["box_hero_ui.bg.box"]
|
self.boxImg = self.uiMap["box_hero_ui.bg.box"]
|
||||||
|
|
||||||
|
-- 购买按钮
|
||||||
self.buyBtn = self.uiMap["box_hero_ui.bg.buy_btn"]
|
self.buyBtn = self.uiMap["box_hero_ui.bg.buy_btn"]
|
||||||
self.buyBtnTx = self.uiMap["box_hero_ui.bg.buy_btn.text"]
|
self.buyBtnTx = self.uiMap["box_hero_ui.bg.buy_btn.text"]
|
||||||
self.buyBtnIcon = self.uiMap["box_hero_ui.bg.buy_btn.icon"]
|
self.buyBtnIcon = self.uiMap["box_hero_ui.bg.buy_btn.icon"]
|
||||||
|
-- 视频按钮
|
||||||
|
self.adBtn = self.uiMap["box_hero_ui.bg.ad_btn"]
|
||||||
|
self.adBtnTx = self.uiMap["box_hero_ui.bg.ad_btn.tx_ad"]
|
||||||
|
self.adBtnIcon = self.uiMap["box_hero_ui.bg.ad_btn.img_ad"]
|
||||||
|
|
||||||
self.itemNodeLayout = self.uiMap["box_hero_ui.bg.item_node"]:getComponent(GConst.TYPEOF_UNITY_CLASS.BF_HORIZONTAL_OR_VERTICAL_LAYOUT)
|
self.itemNodeLayout = self.uiMap["box_hero_ui.bg.item_node"]:getComponent(GConst.TYPEOF_UNITY_CLASS.BF_HORIZONTAL_OR_VERTICAL_LAYOUT)
|
||||||
self.itemNodeList = {}
|
self.itemNodeList = {}
|
||||||
@ -55,11 +61,8 @@ function BoxHeroUI:onLoadRootComplete()
|
|||||||
table.insert(self.itemHelpList, self.uiMap["box_hero_ui.bg.item_" .. i .. ".help"])
|
table.insert(self.itemHelpList, self.uiMap["box_hero_ui.bg.item_" .. i .. ".help"])
|
||||||
end
|
end
|
||||||
|
|
||||||
self.buyBtn:addClickListener(function()
|
self.adBtnTx:setText(I18N:getGlobalText(I18N.GlobalConst.STR_FREE))
|
||||||
self:onClickSummon()
|
GFunc.centerImgAndTx(self.adBtnIcon, self.adBtnTx, 5)
|
||||||
end)
|
|
||||||
|
|
||||||
self:refresh()
|
|
||||||
|
|
||||||
-- 奖励界面打开时 关闭此界面
|
-- 奖励界面打开时 关闭此界面
|
||||||
self:addEventListener(EventManager.CUSTOM_EVENT.CLOSE_BOX_HERO_UI, function()
|
self:addEventListener(EventManager.CUSTOM_EVENT.CLOSE_BOX_HERO_UI, function()
|
||||||
@ -67,11 +70,60 @@ function BoxHeroUI:onLoadRootComplete()
|
|||||||
end)
|
end)
|
||||||
end
|
end
|
||||||
|
|
||||||
function BoxHeroUI:refresh()
|
function BoxHeroUI:onRefresh()
|
||||||
|
self.buyBtn:setActive(false)
|
||||||
|
self.adBtn:setActive(false)
|
||||||
|
|
||||||
|
if self.summonType then
|
||||||
|
self:refreshCummonBox()
|
||||||
|
elseif self.arenaBoxInfo then
|
||||||
|
self:refreshArenaAdBox()
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
-- 刷新商城宝箱
|
||||||
|
function BoxHeroUI:refreshCummonBox()
|
||||||
|
self.buyBtn:setActive(true)
|
||||||
|
self.buyBtn:addClickListener(function()
|
||||||
|
self:onClickSummon()
|
||||||
|
end)
|
||||||
|
|
||||||
self.titleTx:setText(TITLE_TEXT[self.summonType])
|
self.titleTx:setText(TITLE_TEXT[self.summonType])
|
||||||
self.boxImg:setSprite(GConst.ATLAS_PATH.SHOP, ICON_NAME[self.summonType])
|
self.boxImg:setSprite(GConst.ATLAS_PATH.SHOP, ICON_NAME[self.summonType])
|
||||||
|
|
||||||
local rewards = DataManager.SummonData:getSummonTotalRewardByLv(self.summonType) -- 本次实际奖励
|
self:showRewards(DataManager.SummonData:getSummonTotalRewardByLv(self.summonType))-- 本次实际奖励
|
||||||
|
|
||||||
|
local costItem, cost = DataManager.SummonData:getSummonCost(self.summonType)
|
||||||
|
if GFunc.checkCost(costItem.id, costItem.num, false) then
|
||||||
|
self.buyBtnIcon:setSprite(GFunc.getIconRes(costItem.id))
|
||||||
|
self.buyBtnTx:setText(costItem.num)
|
||||||
|
else
|
||||||
|
self.buyBtnIcon:setSprite(GFunc.getIconRes(cost.id))
|
||||||
|
self.buyBtnTx:setText(cost.num)
|
||||||
|
end
|
||||||
|
GFunc.centerImgAndTx(self.buyBtnIcon, self.buyBtnTx, 5)
|
||||||
|
end
|
||||||
|
|
||||||
|
-- 刷新竞技场ad宝箱
|
||||||
|
function BoxHeroUI:refreshArenaAdBox()
|
||||||
|
self.adBtn:setActive(true)
|
||||||
|
self.adBtn:addClickListener(function()
|
||||||
|
SDKManager:showFullScreenAds(BIReport.ADS_CLICK_TYPE.ARENA_AD_BOX, function ()
|
||||||
|
ModuleManager.ArenaManager:reqAdBoxReward(self.arenaBoxInfo.isWin)
|
||||||
|
end)
|
||||||
|
end)
|
||||||
|
|
||||||
|
if self.arenaBoxInfo.isWin then
|
||||||
|
self.titleTx:setText(I18N:getGlobalText(I18N.GlobalConst.ARENA_DESC_32))
|
||||||
|
self.boxImg:setSprite(GConst.ATLAS_PATH.SHOP, "shop_chest_5")
|
||||||
|
else
|
||||||
|
self.titleTx:setText(I18N:getGlobalText(I18N.GlobalConst.ARENA_DESC_33))
|
||||||
|
self.boxImg:setSprite(GConst.ATLAS_PATH.SHOP, "shop_chest_4")
|
||||||
|
end
|
||||||
|
self:showRewards(DataManager.ArenaData:getAdBoxRewards(self.arenaBoxInfo.isWin))
|
||||||
|
end
|
||||||
|
|
||||||
|
function BoxHeroUI:showRewards(rewards)
|
||||||
for i = 1, MAX_ITEM_NUM do
|
for i = 1, MAX_ITEM_NUM do
|
||||||
if i <= #rewards then
|
if i <= #rewards then
|
||||||
self.itemNodeList[i]:setVisible(true)
|
self.itemNodeList[i]:setVisible(true)
|
||||||
@ -95,16 +147,6 @@ function BoxHeroUI:refresh()
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
self.itemNodeLayout:RefreshLayout()
|
self.itemNodeLayout:RefreshLayout()
|
||||||
|
|
||||||
local costItem, cost = DataManager.SummonData:getSummonCost(self.summonType)
|
|
||||||
if GFunc.checkCost(costItem.id, costItem.num, false) then
|
|
||||||
self.buyBtnIcon:setSprite(GFunc.getIconRes(costItem.id))
|
|
||||||
self.buyBtnTx:setText(costItem.num)
|
|
||||||
else
|
|
||||||
self.buyBtnIcon:setSprite(GFunc.getIconRes(cost.id))
|
|
||||||
self.buyBtnTx:setText(cost.num)
|
|
||||||
end
|
|
||||||
GFunc.centerImgAndTx(self.buyBtnIcon, self.buyBtnTx, 5)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
function BoxHeroUI:onClickSummon()
|
function BoxHeroUI:onClickSummon()
|
||||||
|
|||||||
@ -176,25 +176,26 @@ end
|
|||||||
|
|
||||||
-- 获取积分所对应的段位id
|
-- 获取积分所对应的段位id
|
||||||
function ArenaData:getGradingIdFromScore(score, isLastSeason)
|
function ArenaData:getGradingIdFromScore(score, isLastSeason)
|
||||||
local seasonId,grading = nil
|
local gradingId,gradingInfo = nil
|
||||||
local cfg = self.cfgRank
|
local cfg = self.cfgRank
|
||||||
|
|
||||||
if isLastSeason then
|
if isLastSeason then
|
||||||
cfg = self:getRankCfg(self.season - 1)
|
cfg = self:getRankCfg(self.season - 1)
|
||||||
end
|
end
|
||||||
|
|
||||||
for id, data in pairs(cfg) do
|
local ids = table.keys(cfg)
|
||||||
if score >= data.score and (grading == nil or grading.score < data.score) then
|
table.sort(ids)
|
||||||
seasonId, grading = id, data
|
for index, id in ipairs(ids) do
|
||||||
|
if score >= cfg[id].score and (gradingInfo == nil or gradingInfo.score < cfg[id].score) then
|
||||||
|
gradingId, gradingInfo = id, cfg[id]
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
return seasonId
|
return gradingId
|
||||||
end
|
end
|
||||||
|
|
||||||
-- 获取所在段位的积分 cur - min
|
-- 获取所在段位的积分 cur - min
|
||||||
function ArenaData:getGradingScore(score)
|
function ArenaData:getGradingScore(score)
|
||||||
return score - self:getGradingMinScore(self.score)
|
return score - self:getGradingMinScore(score)
|
||||||
end
|
end
|
||||||
|
|
||||||
-- 获取所在段位的最低积分
|
-- 获取所在段位的最低积分
|
||||||
@ -209,20 +210,18 @@ end
|
|||||||
-- 获取所在段位的最高积分 full
|
-- 获取所在段位的最高积分 full
|
||||||
function ArenaData:getGradingMaxScore(score)
|
function ArenaData:getGradingMaxScore(score)
|
||||||
local gradingId = self:getGradingIdFromScore(score)
|
local gradingId = self:getGradingIdFromScore(score)
|
||||||
local isNext = false
|
local ids = self:getGradingIdList()
|
||||||
for id, data in pairs(self.cfgRank) do
|
local curIdx = table.indexof(ids, gradingId)
|
||||||
if isNext then
|
if curIdx and curIdx + 1 <= #ids then
|
||||||
return data.score
|
return self.cfgRank[ids[curIdx + 1]].score
|
||||||
end
|
|
||||||
if id == gradingId then
|
|
||||||
isNext = true
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
-- 获取所在段位的总积分
|
-- 获取所在段位的总积分
|
||||||
function ArenaData:getGradingScoreTotal(score)
|
function ArenaData:getGradingScoreTotal(score)
|
||||||
return self:getGradingMaxScore(score) - self:getGradingMinScore(score)
|
local max = self:getGradingMaxScore(score)
|
||||||
|
local min = self:getGradingMinScore(score)
|
||||||
|
return max - min
|
||||||
end
|
end
|
||||||
|
|
||||||
-- 获取段位图标名(大段位区分)
|
-- 获取段位图标名(大段位区分)
|
||||||
@ -412,6 +411,15 @@ function ArenaData:hasEntranceRedDot()
|
|||||||
return DataManager.BagData.ItemData:getItemNumById(GConst.ItemConst.ITEM_ID_ARENA_TICKET) > 0 or self:hasSeasonReward()
|
return DataManager.BagData.ItemData:getItemNumById(GConst.ItemConst.ITEM_ID_ARENA_TICKET) > 0 or self:hasSeasonReward()
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- 获取当前段位ad宝箱奖励
|
||||||
|
function ArenaData:getAdBoxRewards(isWin)
|
||||||
|
if isWin then
|
||||||
|
return self.cfgRank[self.curGradingId].win_adbox
|
||||||
|
else
|
||||||
|
return self.cfgRank[self.curGradingId].lose_adbox
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
-- 事件处理 ----------------------------------------------------------------------
|
-- 事件处理 ----------------------------------------------------------------------
|
||||||
|
|
||||||
-- 获取到排行榜数据
|
-- 获取到排行榜数据
|
||||||
@ -448,6 +456,7 @@ end
|
|||||||
|
|
||||||
-- 结算战斗数据
|
-- 结算战斗数据
|
||||||
function ArenaData:onBattleResultReceived(settlement)
|
function ArenaData:onBattleResultReceived(settlement)
|
||||||
|
self.matchInfo = nil
|
||||||
-- 战斗记录改变
|
-- 战斗记录改变
|
||||||
if self.recentBattle == nil then
|
if self.recentBattle == nil then
|
||||||
self.recentBattle = {}
|
self.recentBattle = {}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user