礼包
This commit is contained in:
parent
b784b7aeda
commit
4fa2d67de2
@ -399,15 +399,6 @@ if NOT_PUBLISH then
|
|||||||
Logger.printTable(map)
|
Logger.printTable(map)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
if Input.GetKeyDown(KeyCode.Q) then
|
|
||||||
-- 标记可弹出新手礼包
|
|
||||||
DataManager.ShopData:markPopUpGiftForBeginnerGift()
|
|
||||||
end
|
|
||||||
if Input.GetKeyDown(KeyCode.W) then
|
|
||||||
-- 章节通关 标记可弹出章节礼包
|
|
||||||
DataManager.ShopData:markPopUpGiftForActChapterStore(4)
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
Game._releaseOnApplicationFocus = Game.onApplicationFocus
|
Game._releaseOnApplicationFocus = Game.onApplicationFocus
|
||||||
|
|||||||
@ -98,9 +98,8 @@ function ChapterManager:endFightFinish(result)
|
|||||||
local data = {}
|
local data = {}
|
||||||
data.max_chapter = newMaxChapter
|
data.max_chapter = newMaxChapter
|
||||||
CS.ThinkingAnalytics.ThinkingAnalyticsAPI.UserSet(data)
|
CS.ThinkingAnalytics.ThinkingAnalyticsAPI.UserSet(data)
|
||||||
|
|
||||||
-- 标记可弹出新手礼包
|
-- 标记可弹出新手礼包
|
||||||
if newMaxChapter == 1 then
|
if newMaxChapter == 2 then
|
||||||
DataManager.ShopData:markPopUpGiftForBeginnerGift()
|
DataManager.ShopData:markPopUpGiftForBeginnerGift()
|
||||||
end
|
end
|
||||||
-- 章节通关 标记可弹出章节礼包
|
-- 章节通关 标记可弹出章节礼包
|
||||||
|
|||||||
@ -21,11 +21,16 @@ function ShopManager:showBoxLevelUpUI(params)
|
|||||||
UIManager:showUI("app/ui/shop/box_level_up_ui", params)
|
UIManager:showUI("app/ui/shop/box_level_up_ui", params)
|
||||||
end
|
end
|
||||||
|
|
||||||
-- 弹窗礼包
|
-- 触发弹窗礼包
|
||||||
function ShopManager:showGiftPopUI(params)
|
function ShopManager:triggerGiftPopUI(actType, actId)
|
||||||
UIManager:showUI("app/ui/shop/gift_pop_ui", params)
|
UIManager:showUI("app/ui/shop/gift_pop_ui", {type = actType, id = actId})
|
||||||
|
DataManager.ShopData:removePopUpGift(actType, actId)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- 触发金币弹窗礼包
|
||||||
|
function ShopManager:triggerCoinGiftPopUI(actId)
|
||||||
|
self:triggerGiftPopUI(PayManager.PURCHARSE_TYPE.ACT_GIFT, actId)
|
||||||
|
end
|
||||||
|
|
||||||
-- 购买每日特惠商品
|
-- 购买每日特惠商品
|
||||||
function ShopManager:buyMallDailyGift(id, isAd)
|
function ShopManager:buyMallDailyGift(id, isAd)
|
||||||
@ -154,6 +159,8 @@ end
|
|||||||
function ShopManager:tryTriggerCoinGiftFinish(result)
|
function ShopManager:tryTriggerCoinGiftFinish(result)
|
||||||
if result.status == 0 then
|
if result.status == 0 then
|
||||||
DataManager.ShopData:onTriggerCoinGift(result.reqData.gold_gift_id)
|
DataManager.ShopData:onTriggerCoinGift(result.reqData.gold_gift_id)
|
||||||
|
-- 立即触发金币弹窗
|
||||||
|
self:triggerCoinGiftPopUI(result.reqData.gold_gift_id)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@ -117,6 +117,10 @@ function MainCityUI:_addListeners()
|
|||||||
ModuleManager.MailManager:getTriggeredTimeMail()
|
ModuleManager.MailManager:getTriggeredTimeMail()
|
||||||
end, time)
|
end, time)
|
||||||
end)
|
end)
|
||||||
|
self:addEventListener(EventManager.CUSTOM_EVENT.TUTORIAL_TASK_STOP, function()
|
||||||
|
-- 引导完成时 检测主界面的弹窗是否要触发
|
||||||
|
self:checkGift()
|
||||||
|
end)
|
||||||
DataManager.MailData:checkNewMail()
|
DataManager.MailData:checkNewMail()
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -775,16 +779,46 @@ end
|
|||||||
|
|
||||||
-- 检查礼包
|
-- 检查礼包
|
||||||
function MainCityUI:checkGift()
|
function MainCityUI:checkGift()
|
||||||
|
-- 引导其间不处理
|
||||||
if DataManager.TutorialData:getIsHaveTutorial() then
|
if DataManager.TutorialData:getIsHaveTutorial() then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
-- 章节礼包
|
||||||
|
local popUpGift = DataManager.ShopData:getPopUpGiftByType(PayManager.PURCHARSE_TYPE.CHAPTER_GIFT)
|
||||||
|
if popUpGift and #popUpGift > 0 then
|
||||||
|
ModuleManager.ShopManager:triggerGiftPopUI(PayManager.PURCHARSE_TYPE.CHAPTER_GIFT, popUpGift[1])
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
-- 通用礼包
|
||||||
|
local popUpGift = DataManager.ShopData:getPopUpGiftByType(PayManager.PURCHARSE_TYPE.ACT_GIFT)
|
||||||
|
if popUpGift and #popUpGift > 0 then
|
||||||
|
-- 先遍历找出符合弹出的类型
|
||||||
|
local beginnerGiftIds = {}
|
||||||
|
local levelUpGiftIds = {}
|
||||||
|
for _, actId in ipairs(popUpGift) do
|
||||||
|
local cfgInfo = DataManager.ShopData:getActGiftConfig()[actId]
|
||||||
|
if cfgInfo then
|
||||||
|
-- 新手礼包
|
||||||
|
if cfgInfo.type == PayManager.PURCHARSE_ACT_TYPE.BEGINNER_GIFT then
|
||||||
|
table.insert(beginnerGiftIds, actId)
|
||||||
|
end
|
||||||
|
-- 助力礼包
|
||||||
|
if cfgInfo.type == PayManager.PURCHARSE_ACT_TYPE.LEVEL_UP_GIFT then
|
||||||
|
table.insert(levelUpGiftIds, actId)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
-- 新手礼包
|
||||||
|
if #beginnerGiftIds > 0 then
|
||||||
|
ModuleManager.ShopManager:triggerGiftPopUI(PayManager.PURCHARSE_TYPE.CHAPTER_GIFT, beginnerGiftIds[1])
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
-- 助力礼包
|
||||||
|
if #levelUpGiftIds then
|
||||||
|
ModuleManager.ShopManager:triggerGiftPopUI(PayManager.PURCHARSE_TYPE.CHAPTER_GIFT, levelUpGiftIds[1])
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
|
||||||
local actType, actId = DataManager.ShopData:getNextPopGiftData()
|
|
||||||
if actType and actId then
|
|
||||||
-- 触发弹窗
|
|
||||||
ModuleManager.ShopManager:showGiftPopUI({type = actType, id = actId})
|
|
||||||
-- 移除
|
|
||||||
DataManager.ShopData:removePopUpGift(actType, actId)
|
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@ -16,10 +16,14 @@ local GIFT_TITLE_TEXT = {
|
|||||||
local MAX_ITEM_NUM = 4
|
local MAX_ITEM_NUM = 4
|
||||||
|
|
||||||
function GiftPopUI:ctor(params)
|
function GiftPopUI:ctor(params)
|
||||||
|
|
||||||
|
Logger.logHighlight("GiftPopUI -- ctor type:%s id:%s", params.type, params.id)
|
||||||
|
|
||||||
params = params or {}
|
params = params or {}
|
||||||
|
|
||||||
self.actType = params.type
|
self.actType = params.type
|
||||||
self.actId = params.id
|
self.actId = params.id
|
||||||
|
self.buyCount = DataManager.ShopData:getGiftBoughtNum(self.actType, self.actId) -- 触发时该礼包的购买数量
|
||||||
end
|
end
|
||||||
|
|
||||||
function GiftPopUI:isFullScreen()
|
function GiftPopUI:isFullScreen()
|
||||||
@ -86,12 +90,14 @@ function GiftPopUI:refresh(needCheck)
|
|||||||
if needCheck then
|
if needCheck then
|
||||||
-- 如果已经购买过了 则切为下一个或关闭UI 目前都是唯一礼包
|
-- 如果已经购买过了 则切为下一个或关闭UI 目前都是唯一礼包
|
||||||
local bought = DataManager.ShopData:getGiftBoughtNum(self.actType, self.actId)
|
local bought = DataManager.ShopData:getGiftBoughtNum(self.actType, self.actId)
|
||||||
if bought > 0 then
|
if bought ~= self.buyCount then
|
||||||
self:checkNextPopGiftOrClose()
|
self:checkNextPopGiftOrClose()
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Logger.logHighlight("refresh -- type:%s id:%s", self.actType, self.actId)
|
||||||
|
|
||||||
if self.actType == PayManager.PURCHARSE_TYPE.ACT_GIFT then
|
if self.actType == PayManager.PURCHARSE_TYPE.ACT_GIFT then
|
||||||
local type = PayManager:getGiftConfigInfo(self.actType, self.actId).type
|
local type = PayManager:getGiftConfigInfo(self.actType, self.actId).type
|
||||||
self.titleTx:setText(GIFT_TITLE_TEXT[self.actType][type])
|
self.titleTx:setText(GIFT_TITLE_TEXT[self.actType][type])
|
||||||
@ -150,15 +156,14 @@ function GiftPopUI:onClickGift()
|
|||||||
end
|
end
|
||||||
|
|
||||||
function GiftPopUI:checkNextPopGiftOrClose()
|
function GiftPopUI:checkNextPopGiftOrClose()
|
||||||
local actType, actId = DataManager.ShopData:getNextPopGiftData()
|
local actId = DataManager.ShopData:getNextPopGiftData(self.actType)
|
||||||
if actType and actId then
|
if actId then
|
||||||
-- 更新数据
|
-- 更新数据
|
||||||
self.actType = actType
|
|
||||||
self.actId = actId
|
self.actId = actId
|
||||||
|
|
||||||
self:refresh()
|
self:refresh()
|
||||||
-- 移除弹窗列表
|
-- 移除弹窗列表
|
||||||
DataManager.ShopData:removePopUpGift(actType, actId)
|
DataManager.ShopData:removePopUpGift(self.actType, actId)
|
||||||
else
|
else
|
||||||
self:closeUI()
|
self:closeUI()
|
||||||
end
|
end
|
||||||
|
|||||||
@ -101,15 +101,16 @@ end
|
|||||||
|
|
||||||
-- 标记一个礼包需要弹出 在条件允许时会弹出
|
-- 标记一个礼包需要弹出 在条件允许时会弹出
|
||||||
function ShopData:markPopUpGift(actType, actId)
|
function ShopData:markPopUpGift(actType, actId)
|
||||||
-- 与预期的逻辑不一致 暂时屏蔽弹窗礼包
|
if not self.needPopUpGift then
|
||||||
-- TODOJ
|
self.needPopUpGift = {}
|
||||||
-- if not self.needPopUpGift then
|
end
|
||||||
-- self.needPopUpGift = {}
|
if not self.needPopUpGift[actType] then
|
||||||
-- end
|
self.needPopUpGift[actType] = {}
|
||||||
-- if not self.needPopUpGift[actType] then
|
end
|
||||||
-- self.needPopUpGift[actType] = {}
|
|
||||||
-- end
|
Logger.logHighlight("markPopUpGift -- actType:%s actId:%s",actType, actId)
|
||||||
-- table.insert(self.needPopUpGift[actType], actId)
|
|
||||||
|
table.insert(self.needPopUpGift[actType], actId)
|
||||||
end
|
end
|
||||||
|
|
||||||
function ShopData:removePopUpGift(actType, actId)
|
function ShopData:removePopUpGift(actType, actId)
|
||||||
@ -117,6 +118,9 @@ function ShopData:removePopUpGift(actType, actId)
|
|||||||
if self.needPopUpGift[actType] then
|
if self.needPopUpGift[actType] then
|
||||||
for index, id in ipairs(self.needPopUpGift[actType]) do
|
for index, id in ipairs(self.needPopUpGift[actType]) do
|
||||||
if id == actId then
|
if id == actId then
|
||||||
|
|
||||||
|
Logger.logHighlight("removePopUpGift -- actType:%s actId:%s",actType, actId)
|
||||||
|
|
||||||
table.remove(self.needPopUpGift[actType], index)
|
table.remove(self.needPopUpGift[actType], index)
|
||||||
break
|
break
|
||||||
end
|
end
|
||||||
@ -130,15 +134,16 @@ function ShopData:getPopUpGift()
|
|||||||
return self.needPopUpGift
|
return self.needPopUpGift
|
||||||
end
|
end
|
||||||
|
|
||||||
-- 获取下一个需要弹出的礼包数据
|
function ShopData:getPopUpGiftByType(actType)
|
||||||
function ShopData:getNextPopGiftData()
|
return self.needPopUpGift and self.needPopUpGift[actType]
|
||||||
local popUpGift = self:getPopUpGift()
|
end
|
||||||
if popUpGift then
|
|
||||||
for actType, actIdList in pairs(popUpGift) do
|
-- 获取下一个需要弹出的同类型礼包数据
|
||||||
-- 弹窗顺序待处理 TODOJ
|
function ShopData:getNextPopGiftData(actType)
|
||||||
for _, actId in ipairs(actIdList) do
|
local popUpGift = self:getPopUpGiftByType(actType)
|
||||||
return actType, actId
|
if popUpGift and #popUpGift > 0 then
|
||||||
end
|
for _, actId in ipairs(popUpGift) do
|
||||||
|
return actId
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -480,9 +485,6 @@ function ShopData:_getCoinGiftPayConditionList()
|
|||||||
if cfgInfo.type == PayManager.PURCHARSE_ACT_TYPE.COIN_GIFT then
|
if cfgInfo.type == PayManager.PURCHARSE_ACT_TYPE.COIN_GIFT then
|
||||||
local tmpCfgInfo = clone(cfgInfo)
|
local tmpCfgInfo = clone(cfgInfo)
|
||||||
tmpCfgInfo.id = id
|
tmpCfgInfo.id = id
|
||||||
|
|
||||||
Logger.logHighlight("set id:%s", id)
|
|
||||||
|
|
||||||
table.insert(self.coinGiftPayConditionList, tmpCfgInfo)
|
table.insert(self.coinGiftPayConditionList, tmpCfgInfo)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user