竞技场宝箱弹出规则优化、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)
|
||||
end
|
||||
|
||||
-- 标记ad宝箱
|
||||
function ArenaManager:markAdBox(isWin)
|
||||
self.willShowAdBoxState = isWin
|
||||
end
|
||||
|
||||
-- 获取ad宝箱弹出状态
|
||||
function ArenaManager:getAdBoxState()
|
||||
return self.willShowAdBoxState
|
||||
end
|
||||
|
||||
-- 匹配
|
||||
function ArenaManager:reqMatch()
|
||||
self:sendMessage(ProtoMsgType.FromMsgEnum.MatchReq, {}, {}, self.rspMatch, nil)
|
||||
@ -220,6 +230,7 @@ end
|
||||
|
||||
function ArenaManager:rspAdBoxReward(result)
|
||||
if result.err_code == GConst.ERROR_STR.SUCCESS then
|
||||
self.willShowAdBoxState = nil
|
||||
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})
|
||||
EventManager:dispatchEvent(EventManager.CUSTOM_EVENT.ARENA_AD_BOX_SUCCESS)
|
||||
|
||||
@ -92,6 +92,11 @@ function MainComp:refreshModule(selectModule)
|
||||
end
|
||||
ModuleManager.ArenaManager:showGiftPopUI(showType)
|
||||
end
|
||||
local adBoxState = ModuleManager.ArenaManager:getAdBoxState()
|
||||
if adBoxState ~= nil then
|
||||
ModuleManager.ShopManager:showArenaAdBoxUI(adBoxState)
|
||||
ModuleManager.ArenaManager:markAdBox(nil)
|
||||
end
|
||||
-- 是否是否有英雄解锁弹窗
|
||||
if DataManager.HeroData:getIfCanShowHeroUnlock() then
|
||||
local list = DataManager.HeroData:getHeroChapterUnlockList()
|
||||
|
||||
@ -12,7 +12,6 @@ function ActivityData:init()
|
||||
self.actData = {}
|
||||
|
||||
ModuleManager.ActivityManager:reqSummerData()
|
||||
self:markGiftPop()
|
||||
end
|
||||
|
||||
function ActivityData:setDirty()
|
||||
@ -23,7 +22,7 @@ function ActivityData:isOpen()
|
||||
if not ModuleManager:getIsOpen(ModuleManager.MODULE_KEY.ACTIVITY, true) then
|
||||
return false
|
||||
end
|
||||
if #self:getActiveIdList() <= 0 then
|
||||
if not self:isInActiveTime() then
|
||||
return false
|
||||
end
|
||||
return true
|
||||
@ -52,20 +51,9 @@ function ActivityData:getBountyCfg()
|
||||
return self.bountyCfg
|
||||
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()
|
||||
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
|
||||
end
|
||||
|
||||
@ -82,6 +70,10 @@ end
|
||||
|
||||
-- 获取活动结束剩余时间(秒)
|
||||
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 endTime = startTime + ACT_DAYS * 24 * 60 * 60
|
||||
return math.floor(endTime) - Time:getServerTime()
|
||||
@ -89,7 +81,7 @@ end
|
||||
|
||||
-- 当前为活动第几天
|
||||
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
|
||||
end
|
||||
|
||||
@ -119,13 +111,15 @@ end
|
||||
function ActivityData:onGetActData(data)
|
||||
self.actData = data
|
||||
|
||||
-- 注册任务进度监听
|
||||
if self:isInActiveTime() then
|
||||
|
||||
if self:isOpen() then
|
||||
-- 注册任务进度监听
|
||||
for id, data in ipairs(ConfigManager:getConfig("activity_bounty_task")) do
|
||||
ModuleManager.TaskManager:registerTask("ActivityData", data.type, function(count)
|
||||
self:addTaskProgress(data.type, count)
|
||||
end)
|
||||
end
|
||||
self:markGiftPop()
|
||||
end
|
||||
|
||||
if EDITOR_MODE then
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user