礼包逻辑调整
This commit is contained in:
parent
4d6bdbed51
commit
6cbf391728
@ -103,7 +103,7 @@ function ChapterManager:endFightFinish(result)
|
|||||||
DataManager.ShopData:markPopUpGiftForBeginnerGift()
|
DataManager.ShopData:markPopUpGiftForBeginnerGift()
|
||||||
end
|
end
|
||||||
-- 章节通关 标记可弹出章节礼包
|
-- 章节通关 标记可弹出章节礼包
|
||||||
DataManager.ShopData:markPopUpGiftForActChapterStore(newMaxChapter)
|
DataManager.ShopData:markPopUpGiftForActChapterStore(newMaxChapter - 1)
|
||||||
end
|
end
|
||||||
|
|
||||||
ModuleManager.TaskManager:addFightTaskProgress(reqData)
|
ModuleManager.TaskManager:addFightTaskProgress(reqData)
|
||||||
|
|||||||
@ -1,5 +1,12 @@
|
|||||||
local ShopConst = class("ShopConst", BaseModule)
|
local ShopConst = class("ShopConst", BaseModule)
|
||||||
|
|
||||||
ShopConst.BEGINNER_GIFT_ID = 40102 -- 新手礼包ID
|
ShopConst.BEGINNER_GIFT_ID = 40102 -- 新手礼包ID
|
||||||
|
ShopConst.MAIN_UI_POP_TYPE = { -- 当触发弹窗时,相关联的类型礼包也要触发
|
||||||
|
[PayManager.PURCHARSE_TYPE.ACT_GIFT] = {
|
||||||
|
[PayManager.PURCHARSE_ACT_TYPE.BEGINNER_GIFT] = true,
|
||||||
|
[PayManager.PURCHARSE_ACT_TYPE.LEVEL_UP_GIFT] = true,
|
||||||
|
},
|
||||||
|
[PayManager.PURCHARSE_TYPE.CHAPTER_GIFT] = true
|
||||||
|
}
|
||||||
|
|
||||||
return ShopConst
|
return ShopConst
|
||||||
@ -838,12 +838,12 @@ function MainCityUI:checkGift()
|
|||||||
end
|
end
|
||||||
-- 新手礼包
|
-- 新手礼包
|
||||||
if #beginnerGiftIds > 0 then
|
if #beginnerGiftIds > 0 then
|
||||||
ModuleManager.ShopManager:triggerGiftPopUI(PayManager.PURCHARSE_TYPE.CHAPTER_GIFT, beginnerGiftIds[1])
|
ModuleManager.ShopManager:triggerGiftPopUI(PayManager.PURCHARSE_TYPE.ACT_GIFT, beginnerGiftIds[1])
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
-- 助力礼包
|
-- 助力礼包
|
||||||
if #levelUpGiftIds then
|
if #levelUpGiftIds then
|
||||||
ModuleManager.ShopManager:triggerGiftPopUI(PayManager.PURCHARSE_TYPE.CHAPTER_GIFT, levelUpGiftIds[1])
|
ModuleManager.ShopManager:triggerGiftPopUI(PayManager.PURCHARSE_TYPE.ACT_GIFT, levelUpGiftIds[1])
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@ -44,7 +44,7 @@ function GrowSellCell:getCellHeight()
|
|||||||
end
|
end
|
||||||
|
|
||||||
function GrowSellCell:getIsOpen()
|
function GrowSellCell:getIsOpen()
|
||||||
return true -- TOODJ
|
return false -- true -- TOODJ
|
||||||
end
|
end
|
||||||
|
|
||||||
function GrowSellCell:setVisible(visible)
|
function GrowSellCell:setVisible(visible)
|
||||||
|
|||||||
@ -3,12 +3,14 @@ local GiftPopUI = class("GiftPopUI", BaseUI)
|
|||||||
local GIFT_BG_NAME = {
|
local GIFT_BG_NAME = {
|
||||||
[PayManager.PURCHARSE_TYPE.ACT_GIFT] = {
|
[PayManager.PURCHARSE_TYPE.ACT_GIFT] = {
|
||||||
[PayManager.PURCHARSE_ACT_TYPE.BEGINNER_GIFT] = "assets/arts/textures/background/shop/shop_gift_banner_2_1.png", -- TODOJ
|
[PayManager.PURCHARSE_ACT_TYPE.BEGINNER_GIFT] = "assets/arts/textures/background/shop/shop_gift_banner_2_1.png", -- TODOJ
|
||||||
|
[PayManager.PURCHARSE_ACT_TYPE.COIN_GIFT] = "assets/arts/textures/background/shop/shop_gift_banner_5_1.png", -- TODOJ
|
||||||
},
|
},
|
||||||
[PayManager.PURCHARSE_TYPE.CHAPTER_GIFT] = "assets/arts/textures/background/shop/shop_gift_banner_1_1.png", -- TODOJ
|
[PayManager.PURCHARSE_TYPE.CHAPTER_GIFT] = "assets/arts/textures/background/shop/shop_gift_banner_1_1.png", -- TODOJ
|
||||||
}
|
}
|
||||||
local GIFT_TITLE_TEXT = {
|
local GIFT_TITLE_TEXT = {
|
||||||
[PayManager.PURCHARSE_TYPE.ACT_GIFT] = {
|
[PayManager.PURCHARSE_TYPE.ACT_GIFT] = {
|
||||||
[PayManager.PURCHARSE_ACT_TYPE.BEGINNER_GIFT] = "新手礼包TD", -- TODOJ
|
[PayManager.PURCHARSE_ACT_TYPE.BEGINNER_GIFT] = "新手礼包TD", -- TODOJ
|
||||||
|
[PayManager.PURCHARSE_ACT_TYPE.COIN_GIFT] = "金币礼包TD", -- TODOJ
|
||||||
},
|
},
|
||||||
[PayManager.PURCHARSE_TYPE.CHAPTER_GIFT] = "章节礼包TD", -- TODOJ
|
[PayManager.PURCHARSE_TYPE.CHAPTER_GIFT] = "章节礼包TD", -- TODOJ
|
||||||
}
|
}
|
||||||
@ -16,9 +18,6 @@ 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
|
||||||
@ -155,15 +154,17 @@ function GiftPopUI:onClickGift()
|
|||||||
PayManager:purchasePackage(self.actId, self.actType)
|
PayManager:purchasePackage(self.actId, self.actType)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- 如果还有需要显示的 则直接刷新而不是关闭本界面
|
||||||
function GiftPopUI:checkNextPopGiftOrClose()
|
function GiftPopUI:checkNextPopGiftOrClose()
|
||||||
local actId = DataManager.ShopData:getNextPopGiftData(self.actType)
|
local actType, actId = DataManager.ShopData:getNextPopGiftData(self.actType, self.actId)
|
||||||
if actId then
|
if actType and actId then
|
||||||
-- 更新数据
|
-- 更新数据
|
||||||
|
self.actType = actType
|
||||||
self.actId = actId
|
self.actId = actId
|
||||||
|
|
||||||
self:refresh()
|
self:refresh()
|
||||||
-- 移除弹窗列表
|
-- 移除弹窗列表
|
||||||
DataManager.ShopData:removePopUpGift(self.actType, actId)
|
DataManager.ShopData:removePopUpGift(self.actType, self.actId)
|
||||||
else
|
else
|
||||||
self:closeUI()
|
self:closeUI()
|
||||||
end
|
end
|
||||||
|
|||||||
@ -148,14 +148,57 @@ function ShopData:getPopUpGiftByType(actType)
|
|||||||
return self.needPopUpGift and self.needPopUpGift[actType]
|
return self.needPopUpGift and self.needPopUpGift[actType]
|
||||||
end
|
end
|
||||||
|
|
||||||
-- 获取下一个需要弹出的同类型礼包数据
|
-- 获取下一个需要弹出的同类型礼包数据,特别的,如果是主界面部分则多个不同类型的也要考虑进去
|
||||||
function ShopData:getNextPopGiftData(actType)
|
function ShopData:getNextPopGiftData(actType, actId)
|
||||||
|
if GConst.ShopConst.MAIN_UI_POP_TYPE[actType] then
|
||||||
|
-- 优先找自己类型的,如果是act类则需要找同类型的
|
||||||
local popUpGift = self:getPopUpGiftByType(actType)
|
local popUpGift = self:getPopUpGiftByType(actType)
|
||||||
if popUpGift and #popUpGift > 0 then
|
if popUpGift and #popUpGift > 0 then
|
||||||
for _, actId in ipairs(popUpGift) do
|
if actType == PayManager.PURCHARSE_TYPE.ACT_GIFT then
|
||||||
return actId
|
for _, nextActId in ipairs(popUpGift) do
|
||||||
|
if self:getActGiftConfig()[nextActId].type == self:getActGiftConfig()[actId].type then
|
||||||
|
return actType, nextActId
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
else
|
||||||
|
for _, nextActId in ipairs(popUpGift) do
|
||||||
|
return actType, nextActId
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
-- 按顺序找其他类型的
|
||||||
|
if actType ~= PayManager.PURCHARSE_TYPE.ACT_GIFT then
|
||||||
|
local popUpGift = self:getPopUpGiftByType(PayManager.PURCHARSE_TYPE.ACT_GIFT)
|
||||||
|
if popUpGift and #popUpGift > 0 then
|
||||||
|
for _, nextActId in ipairs(popUpGift) do
|
||||||
|
-- 新手礼包
|
||||||
|
if self:getActGiftConfig()[nextActId].type == PayManager.PURCHARSE_ACT_TYPE.BEGINNER_GIFT then
|
||||||
|
return PayManager.PURCHARSE_TYPE.ACT_GIFT, nextActId
|
||||||
|
end
|
||||||
|
-- 助力礼包
|
||||||
|
if self:getActGiftConfig()[nextActId].type == PayManager.PURCHARSE_ACT_TYPE.LEVEL_UP_GIFT then
|
||||||
|
return PayManager.PURCHARSE_TYPE.ACT_GIFT, nextActId
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
if actType ~= PayManager.PURCHARSE_TYPE.CHAPTER_GIFT then
|
||||||
|
local popUpGift = self:getPopUpGiftByType(PayManager.PURCHARSE_TYPE.CHAPTER_GIFT)
|
||||||
|
if popUpGift and #popUpGift > 0 then
|
||||||
|
for _, nextActId in ipairs(popUpGift) do
|
||||||
|
return PayManager.PURCHARSE_TYPE.CHAPTER_GIFT, nextActId
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
else -- 直接返回同类型的即可
|
||||||
|
local popUpGift = self:getPopUpGiftByType(actType)
|
||||||
|
if popUpGift and #popUpGift > 0 then
|
||||||
|
for _, nextActId in ipairs(popUpGift) do
|
||||||
|
return actType, nextActId
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
return nil
|
||||||
end
|
end
|
||||||
|
|
||||||
-- 通用礼包结束 ----------------------------------------------------------------------------------------------
|
-- 通用礼包结束 ----------------------------------------------------------------------------------------------
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user