优化章节礼包弹出逻辑

This commit is contained in:
xiekaidong 2023-07-13 16:52:38 +08:00
parent 99a26d953d
commit c0c0c8f93e
3 changed files with 23 additions and 0 deletions

View File

@ -154,6 +154,7 @@ function DataManager:initWithServerData(data)
self.ShopData:initIntroductGift(data.act_introductory_gift) -- 入门礼包 self.ShopData:initIntroductGift(data.act_introductory_gift) -- 入门礼包
-- 商店礼包都初始化完了后检查一下每日红点 -- 商店礼包都初始化完了后检查一下每日红点
self.ShopData:checkShopDiscountRedPoint() self.ShopData:checkShopDiscountRedPoint()
self.ShopData:checkLoginPopInfo() -- 需要写在shopdata所有初始化之后
self.SummonData:init(data.summon, true) self.SummonData:init(data.summon, true)
self.AIHelperData:init(nil, true) self.AIHelperData:init(nil, true)
-- 成长基金要在ShopData和PlayerDataBagData还有之后初始化依赖这些数据 -- 成长基金要在ShopData和PlayerDataBagData还有之后初始化依赖这些数据

View File

@ -160,6 +160,10 @@ function ChapterManager:endFightFinish(result)
DataManager.ShopData:onTriggerIntroductGift() DataManager.ShopData:onTriggerIntroductGift()
end end
if not reqData.win then
DataManager.ShopData:markPopLastChapterActGift()
end
ModuleManager.TaskManager:addFightTaskProgress(reqData.task_stat) ModuleManager.TaskManager:addFightTaskProgress(reqData.task_stat)
end end
end end

View File

@ -895,4 +895,22 @@ function ShopData:markShopDiscountRedPoint()
LocalData:setShopDiscountRedPointTime(today) LocalData:setShopDiscountRedPointTime(today)
end end
function ShopData:checkLoginPopInfo()
-- 初始化礼包弹出逻辑
local actPopUpGifts = self:getPopUpGiftByType(PayManager.PURCHARSE_TYPE.ACT_GIFT)
if not actPopUpGifts or #actPopUpGifts <= 0 then
self:markPopLastChapterActGift()
end
end
function ShopData:markPopLastChapterActGift()
local chapterPopUpGifts = self:getPopUpGiftByType(PayManager.PURCHARSE_TYPE.CHAPTER_GIFT)
if not chapterPopUpGifts or #chapterPopUpGifts <= 0 then
local list = self:getActChapterStoreCanBuyActIds()
if list and list[1] then
self:markPopUpGift(PayManager.PURCHARSE_TYPE.CHAPTER_GIFT, list[#list])
end
end
end
return ShopData return ShopData