From c0c0c8f93e7c15ccb40b3bd2d8ac1a48212f8948 Mon Sep 17 00:00:00 2001 From: xiekaidong Date: Thu, 13 Jul 2023 16:52:38 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E7=AB=A0=E8=8A=82=E7=A4=BC?= =?UTF-8?q?=E5=8C=85=E5=BC=B9=E5=87=BA=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lua/app/common/data_manager.lua | 1 + lua/app/module/chapter/chapter_manager.lua | 4 ++++ lua/app/userdata/shop/shop_data.lua | 18 ++++++++++++++++++ 3 files changed, 23 insertions(+) diff --git a/lua/app/common/data_manager.lua b/lua/app/common/data_manager.lua index 1f906855..243f3be7 100644 --- a/lua/app/common/data_manager.lua +++ b/lua/app/common/data_manager.lua @@ -154,6 +154,7 @@ function DataManager:initWithServerData(data) self.ShopData:initIntroductGift(data.act_introductory_gift) -- 入门礼包 -- 商店礼包都初始化完了后检查一下每日红点 self.ShopData:checkShopDiscountRedPoint() + self.ShopData:checkLoginPopInfo() -- 需要写在shopdata所有初始化之后 self.SummonData:init(data.summon, true) self.AIHelperData:init(nil, true) -- 成长基金要在ShopData和PlayerDataBagData还有之后初始化,依赖这些数据 diff --git a/lua/app/module/chapter/chapter_manager.lua b/lua/app/module/chapter/chapter_manager.lua index ad7af255..b78ace71 100644 --- a/lua/app/module/chapter/chapter_manager.lua +++ b/lua/app/module/chapter/chapter_manager.lua @@ -160,6 +160,10 @@ function ChapterManager:endFightFinish(result) DataManager.ShopData:onTriggerIntroductGift() end + if not reqData.win then + DataManager.ShopData:markPopLastChapterActGift() + end + ModuleManager.TaskManager:addFightTaskProgress(reqData.task_stat) end end diff --git a/lua/app/userdata/shop/shop_data.lua b/lua/app/userdata/shop/shop_data.lua index f2694323..3417c063 100644 --- a/lua/app/userdata/shop/shop_data.lua +++ b/lua/app/userdata/shop/shop_data.lua @@ -895,4 +895,22 @@ function ShopData:markShopDiscountRedPoint() LocalData:setShopDiscountRedPointTime(today) 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 \ No newline at end of file