竞技场宝箱弹出规则优化、bugfix
This commit is contained in:
parent
7247cada75
commit
34282dc81b
@ -34,6 +34,16 @@ function ArenaManager:onSeasonChanged()
|
|||||||
EventManager:dispatchEvent(EventManager.CUSTOM_EVENT.ARENA_SEASON_END)
|
EventManager:dispatchEvent(EventManager.CUSTOM_EVENT.ARENA_SEASON_END)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- 标记ad宝箱
|
||||||
|
function ArenaManager:markAdBox(isWin)
|
||||||
|
self.willShowAdBoxState = isWin
|
||||||
|
end
|
||||||
|
|
||||||
|
-- 获取ad宝箱弹出状态
|
||||||
|
function ArenaManager:getAdBoxState()
|
||||||
|
return self.willShowAdBoxState
|
||||||
|
end
|
||||||
|
|
||||||
-- 匹配
|
-- 匹配
|
||||||
function ArenaManager:reqMatch()
|
function ArenaManager:reqMatch()
|
||||||
self:sendMessage(ProtoMsgType.FromMsgEnum.MatchReq, {}, {}, self.rspMatch, nil)
|
self:sendMessage(ProtoMsgType.FromMsgEnum.MatchReq, {}, {}, self.rspMatch, nil)
|
||||||
@ -220,6 +230,7 @@ end
|
|||||||
|
|
||||||
function ArenaManager:rspAdBoxReward(result)
|
function ArenaManager:rspAdBoxReward(result)
|
||||||
if result.err_code == GConst.ERROR_STR.SUCCESS then
|
if result.err_code == GConst.ERROR_STR.SUCCESS then
|
||||||
|
self.willShowAdBoxState = nil
|
||||||
local idx = result.reqData.win and 2 or 1
|
local idx = result.reqData.win and 2 or 1
|
||||||
ModuleManager.ShopManager:showBoxOpenUI({type = GConst.ShopConst.BOX_REWARD_TYPE.ARENA_AD_BOX, params = idx, rewards = result.rewards})
|
ModuleManager.ShopManager:showBoxOpenUI({type = GConst.ShopConst.BOX_REWARD_TYPE.ARENA_AD_BOX, params = idx, rewards = result.rewards})
|
||||||
EventManager:dispatchEvent(EventManager.CUSTOM_EVENT.ARENA_AD_BOX_SUCCESS)
|
EventManager:dispatchEvent(EventManager.CUSTOM_EVENT.ARENA_AD_BOX_SUCCESS)
|
||||||
|
|||||||
@ -92,6 +92,11 @@ function MainComp:refreshModule(selectModule)
|
|||||||
end
|
end
|
||||||
ModuleManager.ArenaManager:showGiftPopUI(showType)
|
ModuleManager.ArenaManager:showGiftPopUI(showType)
|
||||||
end
|
end
|
||||||
|
local adBoxState = ModuleManager.ArenaManager:getAdBoxState()
|
||||||
|
if adBoxState ~= nil then
|
||||||
|
ModuleManager.ShopManager:showArenaAdBoxUI(adBoxState)
|
||||||
|
ModuleManager.ArenaManager:markAdBox(nil)
|
||||||
|
end
|
||||||
-- 是否是否有英雄解锁弹窗
|
-- 是否是否有英雄解锁弹窗
|
||||||
if DataManager.HeroData:getIfCanShowHeroUnlock() then
|
if DataManager.HeroData:getIfCanShowHeroUnlock() then
|
||||||
local list = DataManager.HeroData:getHeroChapterUnlockList()
|
local list = DataManager.HeroData:getHeroChapterUnlockList()
|
||||||
|
|||||||
@ -12,7 +12,6 @@ function ActivityData:init()
|
|||||||
self.actData = {}
|
self.actData = {}
|
||||||
|
|
||||||
ModuleManager.ActivityManager:reqSummerData()
|
ModuleManager.ActivityManager:reqSummerData()
|
||||||
self:markGiftPop()
|
|
||||||
end
|
end
|
||||||
|
|
||||||
function ActivityData:setDirty()
|
function ActivityData:setDirty()
|
||||||
@ -23,7 +22,7 @@ function ActivityData:isOpen()
|
|||||||
if not ModuleManager:getIsOpen(ModuleManager.MODULE_KEY.ACTIVITY, true) then
|
if not ModuleManager:getIsOpen(ModuleManager.MODULE_KEY.ACTIVITY, true) then
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
if #self:getActiveIdList() <= 0 then
|
if not self:isInActiveTime() then
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
return true
|
return true
|
||||||
@ -52,20 +51,9 @@ function ActivityData:getBountyCfg()
|
|||||||
return self.bountyCfg
|
return self.bountyCfg
|
||||||
end
|
end
|
||||||
|
|
||||||
-- 获取当前开启的活动id列表
|
|
||||||
function ActivityData:getActiveIdList()
|
|
||||||
local result = {}
|
|
||||||
for id, data in pairs(ConfigManager:getConfig("activity")) do
|
|
||||||
if self:isInActiveTime() then
|
|
||||||
table.insert(result, id)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
return result
|
|
||||||
end
|
|
||||||
|
|
||||||
-- 是否在活动时间内
|
-- 是否在活动时间内
|
||||||
function ActivityData:isInActiveTime()
|
function ActivityData:isInActiveTime()
|
||||||
if self.actData.activated_at == nil or self.actData.activated_at <= 0 then
|
if self.actData == nil or self.actData.activated_at == nil or self.actData.activated_at <= 0 then
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -82,6 +70,10 @@ end
|
|||||||
|
|
||||||
-- 获取活动结束剩余时间(秒)
|
-- 获取活动结束剩余时间(秒)
|
||||||
function ActivityData:getEndRemainTime()
|
function ActivityData:getEndRemainTime()
|
||||||
|
if self.actData == nil or self.actData.activated_at == nil or self.actData.activated_at <= 0 then
|
||||||
|
return 0
|
||||||
|
end
|
||||||
|
|
||||||
local startTime = Time:getBeginningOfOneDay(self.actData.activated_at // 1000)
|
local startTime = Time:getBeginningOfOneDay(self.actData.activated_at // 1000)
|
||||||
local endTime = startTime + ACT_DAYS * 24 * 60 * 60
|
local endTime = startTime + ACT_DAYS * 24 * 60 * 60
|
||||||
return math.floor(endTime) - Time:getServerTime()
|
return math.floor(endTime) - Time:getServerTime()
|
||||||
@ -89,7 +81,7 @@ end
|
|||||||
|
|
||||||
-- 当前为活动第几天
|
-- 当前为活动第几天
|
||||||
function ActivityData:getActDay()
|
function ActivityData:getActDay()
|
||||||
if self.actData == nil then
|
if self.actData == nil or self.actData.activated_at == nil or self.actData.activated_at <= 0 then
|
||||||
return 0
|
return 0
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -119,13 +111,15 @@ end
|
|||||||
function ActivityData:onGetActData(data)
|
function ActivityData:onGetActData(data)
|
||||||
self.actData = data
|
self.actData = data
|
||||||
|
|
||||||
-- 注册任务进度监听
|
|
||||||
if self:isInActiveTime() then
|
if self:isOpen() then
|
||||||
|
-- 注册任务进度监听
|
||||||
for id, data in ipairs(ConfigManager:getConfig("activity_bounty_task")) do
|
for id, data in ipairs(ConfigManager:getConfig("activity_bounty_task")) do
|
||||||
ModuleManager.TaskManager:registerTask("ActivityData", data.type, function(count)
|
ModuleManager.TaskManager:registerTask("ActivityData", data.type, function(count)
|
||||||
self:addTaskProgress(data.type, count)
|
self:addTaskProgress(data.type, count)
|
||||||
end)
|
end)
|
||||||
end
|
end
|
||||||
|
self:markGiftPop()
|
||||||
end
|
end
|
||||||
|
|
||||||
if EDITOR_MODE then
|
if EDITOR_MODE then
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user