助力礼包
This commit is contained in:
parent
eb531423dd
commit
5888ee766f
@ -76,7 +76,9 @@ BIReport.ITEM_GET_TYPE = {
|
|||||||
MALL_DAILY = "MallDaily", -- 每日特惠
|
MALL_DAILY = "MallDaily", -- 每日特惠
|
||||||
MALL_DAILY_RESET = "MallDailyReset",
|
MALL_DAILY_RESET = "MallDailyReset",
|
||||||
FIRST_RECHARGE = "FirstRecharge",
|
FIRST_RECHARGE = "FirstRecharge",
|
||||||
|
COIN_GIFT = "CoinGift",
|
||||||
BEGINNER_GIFT = "BeginnerGift",
|
BEGINNER_GIFT = "BeginnerGift",
|
||||||
|
LEVEL_UP_GIFT = "LevelUpGift",
|
||||||
ACT_CHAPTER_STORE = "ActChapterStore", -- 章节礼包
|
ACT_CHAPTER_STORE = "ActChapterStore", -- 章节礼包
|
||||||
SUMMON = "Summon",
|
SUMMON = "Summon",
|
||||||
PLAYER_LV_UP = "PlayerLvUp",
|
PLAYER_LV_UP = "PlayerLvUp",
|
||||||
@ -124,7 +126,9 @@ BIReport.BATTLE_TYPE = {
|
|||||||
|
|
||||||
BIReport.GIFT_TYPE = {
|
BIReport.GIFT_TYPE = {
|
||||||
FIRST_RECHARGE = "FirstRecharge",
|
FIRST_RECHARGE = "FirstRecharge",
|
||||||
|
COIN_GIFT = "CoinGift",
|
||||||
BEGINNER_GIFT = "BeginnerGift",
|
BEGINNER_GIFT = "BeginnerGift",
|
||||||
|
LEVEL_UP_GIFT = "LevelUpGift",
|
||||||
BOUNTY = "Bounty",
|
BOUNTY = "Bounty",
|
||||||
GOLD_PIG = "GoldPig",
|
GOLD_PIG = "GoldPig",
|
||||||
MALL_TREASURE = "MallTreasure",
|
MALL_TREASURE = "MallTreasure",
|
||||||
|
|||||||
@ -12,7 +12,9 @@ PayManager.PURCHARSE_TYPE = {
|
|||||||
|
|
||||||
PayManager.PURCHARSE_ACT_TYPE = {
|
PayManager.PURCHARSE_ACT_TYPE = {
|
||||||
FIRST_RECHARGE = 1,
|
FIRST_RECHARGE = 1,
|
||||||
|
COIN_GIFT = 2,
|
||||||
BEGINNER_GIFT = 4,
|
BEGINNER_GIFT = 4,
|
||||||
|
LEVEL_UP_GIFT = 5,
|
||||||
BOUNTY = 7,
|
BOUNTY = 7,
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -26,7 +28,9 @@ PayManager.PURCHARSE_TYPE_CONFIG = {
|
|||||||
PayManager.BI_ITEM_GET_TYPE = {
|
PayManager.BI_ITEM_GET_TYPE = {
|
||||||
[PayManager.PURCHARSE_TYPE.ACT_GIFT] = {
|
[PayManager.PURCHARSE_TYPE.ACT_GIFT] = {
|
||||||
[PayManager.PURCHARSE_ACT_TYPE.FIRST_RECHARGE] = BIReport.ITEM_GET_TYPE.FIRST_RECHARGE,
|
[PayManager.PURCHARSE_ACT_TYPE.FIRST_RECHARGE] = BIReport.ITEM_GET_TYPE.FIRST_RECHARGE,
|
||||||
|
[PayManager.PURCHARSE_ACT_TYPE.COIN_GIFT] = BIReport.ITEM_GET_TYPE.COIN_GIFT,
|
||||||
[PayManager.PURCHARSE_ACT_TYPE.BEGINNER_GIFT] = BIReport.ITEM_GET_TYPE.BEGINNER_GIFT,
|
[PayManager.PURCHARSE_ACT_TYPE.BEGINNER_GIFT] = BIReport.ITEM_GET_TYPE.BEGINNER_GIFT,
|
||||||
|
[PayManager.PURCHARSE_ACT_TYPE.LEVEL_UP_GIFT] = BIReport.ITEM_GET_TYPE.LEVEL_UP_GIFT,
|
||||||
[PayManager.PURCHARSE_ACT_TYPE.BOUNTY] = BIReport.ITEM_GET_TYPE.BOUNTY,
|
[PayManager.PURCHARSE_ACT_TYPE.BOUNTY] = BIReport.ITEM_GET_TYPE.BOUNTY,
|
||||||
},
|
},
|
||||||
[PayManager.PURCHARSE_TYPE.ACT_GOLD_PIG] = BIReport.ITEM_GET_TYPE.GOLD_PIG,
|
[PayManager.PURCHARSE_TYPE.ACT_GOLD_PIG] = BIReport.ITEM_GET_TYPE.GOLD_PIG,
|
||||||
@ -37,7 +41,9 @@ PayManager.BI_ITEM_GET_TYPE = {
|
|||||||
PayManager.BI_GIFT_TYPE = {
|
PayManager.BI_GIFT_TYPE = {
|
||||||
[PayManager.PURCHARSE_TYPE.ACT_GIFT] = {
|
[PayManager.PURCHARSE_TYPE.ACT_GIFT] = {
|
||||||
[PayManager.PURCHARSE_ACT_TYPE.FIRST_RECHARGE] = BIReport.GIFT_TYPE.FIRST_RECHARGE,
|
[PayManager.PURCHARSE_ACT_TYPE.FIRST_RECHARGE] = BIReport.GIFT_TYPE.FIRST_RECHARGE,
|
||||||
|
[PayManager.PURCHARSE_ACT_TYPE.COIN_GIFT] = BIReport.GIFT_TYPE.COIN_GIFT,
|
||||||
[PayManager.PURCHARSE_ACT_TYPE.BEGINNER_GIFT] = BIReport.GIFT_TYPE.BEGINNER_GIFT,
|
[PayManager.PURCHARSE_ACT_TYPE.BEGINNER_GIFT] = BIReport.GIFT_TYPE.BEGINNER_GIFT,
|
||||||
|
[PayManager.PURCHARSE_ACT_TYPE.LEVEL_UP_GIFT] = BIReport.GIFT_TYPE.LEVEL_UP_GIFT,
|
||||||
[PayManager.PURCHARSE_ACT_TYPE.BOUNTY] = BIReport.GIFT_TYPE.BOUNTY,
|
[PayManager.PURCHARSE_ACT_TYPE.BOUNTY] = BIReport.GIFT_TYPE.BOUNTY,
|
||||||
},
|
},
|
||||||
[PayManager.PURCHARSE_TYPE.ACT_GOLD_PIG] = BIReport.GIFT_TYPE.GOLD_PIG,
|
[PayManager.PURCHARSE_TYPE.ACT_GOLD_PIG] = BIReport.GIFT_TYPE.GOLD_PIG,
|
||||||
|
|||||||
@ -16,7 +16,8 @@ function ServerPushManager:initWhenLogin()
|
|||||||
self:addServerPushListener(ProtoMsgType.FromMsgEnum.BountyBoughtNtf, ModuleManager.BountyManager, ModuleManager.BountyManager.onBoughtBountyFinish)
|
self:addServerPushListener(ProtoMsgType.FromMsgEnum.BountyBoughtNtf, ModuleManager.BountyManager, ModuleManager.BountyManager.onBoughtBountyFinish)
|
||||||
self:addServerPushListener(ProtoMsgType.FromMsgEnum.NewMailNtf, ModuleManager.MailManager, ModuleManager.MailManager.needUpdateMail)
|
self:addServerPushListener(ProtoMsgType.FromMsgEnum.NewMailNtf, ModuleManager.MailManager, ModuleManager.MailManager.needUpdateMail)
|
||||||
self:addServerPushListener(ProtoMsgType.FromMsgEnum.PigLevelUpNtf, ModuleManager.ActivityManager, ModuleManager.ActivityManager.onBoughtGoldPigFinish)
|
self:addServerPushListener(ProtoMsgType.FromMsgEnum.PigLevelUpNtf, ModuleManager.ActivityManager, ModuleManager.ActivityManager.onBoughtGoldPigFinish)
|
||||||
self:addServerPushListener(ProtoMsgType.FromMsgEnum.MallDailyResetNtf, ModuleManager.ShopManager, ModuleManager.MailManager.onMallDailyReset)
|
self:addServerPushListener(ProtoMsgType.FromMsgEnum.TriggerLevelUpGiftNtf, ModuleManager.ShopManager, ModuleManager.ShopManager.triggerLevelUpGift)
|
||||||
|
self:addServerPushListener(ProtoMsgType.FromMsgEnum.MallDailyResetNtf, ModuleManager.ShopManager, ModuleManager.ShopManager.onMallDailyReset)
|
||||||
end
|
end
|
||||||
|
|
||||||
---- 移除全局推送监听
|
---- 移除全局推送监听
|
||||||
|
|||||||
@ -129,4 +129,9 @@ function ShopManager:buyMallIdleCoinFinish(result)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- 推送助力礼包
|
||||||
|
function ShopManager:triggerLevelUpGift(result)
|
||||||
|
DataManager.ShopData:triggerLevelUpGift(result.current_level_up_gift)
|
||||||
|
end
|
||||||
|
|
||||||
return ShopManager
|
return ShopManager
|
||||||
@ -23,13 +23,12 @@ function LevelSellCell:init()
|
|||||||
end
|
end
|
||||||
|
|
||||||
function LevelSellCell:refresh()
|
function LevelSellCell:refresh()
|
||||||
-- 暂无数据部分 测试用 TODOJ
|
local actIds = #DataManager.ShopData:getLevelUpGiftActIds()
|
||||||
local tmpIds = {50102, 50402}
|
|
||||||
self.actGiftCfg = {}
|
self.actGiftCfg = {}
|
||||||
local actGiftCfg = ConfigManager:getConfig("act_gift")
|
local actGiftCfg = ConfigManager:getConfig("act_gift")
|
||||||
for i = 1, #tmpIds do
|
for i = 1, #actIds do
|
||||||
local cfgInfo = clone(actGiftCfg[tmpIds[i]])
|
local cfgInfo = clone(actGiftCfg[actIds[i]])
|
||||||
cfgInfo.id = tmpIds[i]
|
cfgInfo.id = actIds[i]
|
||||||
table.insert(self.actGiftCfg, cfgInfo)
|
table.insert(self.actGiftCfg, cfgInfo)
|
||||||
end
|
end
|
||||||
self.scrollRect:refillCells(#self.actGiftCfg)
|
self.scrollRect:refillCells(#self.actGiftCfg)
|
||||||
@ -44,7 +43,7 @@ function LevelSellCell:getCellHeight()
|
|||||||
end
|
end
|
||||||
|
|
||||||
function LevelSellCell:getIsOpen()
|
function LevelSellCell:getIsOpen()
|
||||||
return true -- TOODJ
|
return #DataManager.ShopData:getLevelUpGiftActIds() > 0
|
||||||
end
|
end
|
||||||
|
|
||||||
function LevelSellCell:setVisible(visible)
|
function LevelSellCell:setVisible(visible)
|
||||||
|
|||||||
@ -53,6 +53,10 @@ function ShopData:initActGift(act)
|
|||||||
self:setDirty()
|
self:setDirty()
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function ShopData:getActGiftConfig()
|
||||||
|
return ConfigManager:getConfig("act_gift")
|
||||||
|
end
|
||||||
|
|
||||||
-- 已购买的礼包
|
-- 已购买的礼包
|
||||||
function ShopData:getActGiftMap()
|
function ShopData:getActGiftMap()
|
||||||
return self.giftMap
|
return self.giftMap
|
||||||
@ -124,6 +128,41 @@ function ShopData:getPopUpGift()
|
|||||||
return self.needPopUpGift
|
return self.needPopUpGift
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- 获取下一个需要弹出的礼包数据
|
||||||
|
function ShopData:getNextPopGiftData()
|
||||||
|
local popUpGift = self:getPopUpGift()
|
||||||
|
if popUpGift then
|
||||||
|
for actType, actIdList in pairs(popUpGift) do
|
||||||
|
-- 弹窗顺序待处理 TODOJ
|
||||||
|
for _, actId in ipairs(actIdList) do
|
||||||
|
return actType, actId
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
-- 上次支付的时间
|
||||||
|
function ShopData:getLastPayTime()
|
||||||
|
-- TODOJ
|
||||||
|
end
|
||||||
|
|
||||||
|
-- 包含了降档规则的支付总额(目前影响助力和金币礼包)
|
||||||
|
function ShopData:getTotalPayAmountWithTime()
|
||||||
|
local total = DataManager.PlayerData:getTotalPayAmount()
|
||||||
|
local lastPayTime = self:getLastPayTime()
|
||||||
|
if lastPayTime then
|
||||||
|
diffTime = Time:getServerTime() - lastPayTime // 1000
|
||||||
|
local dTime = GFunc.getConstIntValue("act_gift_downshift_time") or 72 -- 每X小时
|
||||||
|
local dValue = GFunc.getConstIntValue("act_gift_downshift_number") or 15 -- 降低X金额
|
||||||
|
local dCount = diffTime // (dTime * 3600)
|
||||||
|
total = total - dCount * dValue
|
||||||
|
if total < 0 then
|
||||||
|
total = 0
|
||||||
|
end
|
||||||
|
end
|
||||||
|
return total
|
||||||
|
end
|
||||||
|
|
||||||
-- 通用礼包结束 ----------------------------------------------------------------------------------------------
|
-- 通用礼包结束 ----------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
-- 每日特惠部分 **********************************************************************************************
|
-- 每日特惠部分 **********************************************************************************************
|
||||||
@ -330,19 +369,6 @@ function ShopData:markPopUpGiftForActChapterStore(chapterId)
|
|||||||
self:markPopUpGift(PayManager.PURCHARSE_TYPE.CHAPTER_GIFT, actId)
|
self:markPopUpGift(PayManager.PURCHARSE_TYPE.CHAPTER_GIFT, actId)
|
||||||
end
|
end
|
||||||
|
|
||||||
-- 获取下一个需要弹出的礼包数据
|
|
||||||
function ShopData:getNextPopGiftData()
|
|
||||||
local popUpGift = self:getPopUpGift()
|
|
||||||
if popUpGift then
|
|
||||||
for actType, actIdList in pairs(popUpGift) do
|
|
||||||
-- 弹窗顺序待处理 TODOJ
|
|
||||||
for _, actId in ipairs(actIdList) do
|
|
||||||
return actType, actId
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
-- 章节礼包结束 ----------------------------------------------------------------------------------------------
|
-- 章节礼包结束 ----------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
-- 新手礼包 **********************************************************************************************
|
-- 新手礼包 **********************************************************************************************
|
||||||
@ -360,12 +386,52 @@ end
|
|||||||
|
|
||||||
-- 新手礼包结束 ----------------------------------------------------------------------------------------------
|
-- 新手礼包结束 ----------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
-- 助力礼包(等级 act_gift) **********************************************************************************************
|
||||||
|
|
||||||
|
-- 初始化助力礼包
|
||||||
|
function ShopData:initLevelUpGift(levelUpGift)
|
||||||
|
self.levelUpGifts = levelUpGift or {} -- [{trigger_level,current_level_up_gift,trigger_at}]
|
||||||
|
|
||||||
|
self:setDirty()
|
||||||
|
end
|
||||||
|
|
||||||
|
function ShopData:getLevelUpGift()
|
||||||
|
return self.levelUpGifts
|
||||||
|
end
|
||||||
|
|
||||||
|
function ShopData:triggerLevelUpGift(gift)
|
||||||
|
table.insert(self.levelUpGifts, gift)
|
||||||
|
-- 标记弹窗
|
||||||
|
self:markPopUpGift(PayManager.PURCHARSE_TYPE.ACT_GIFT, gift.current_level_up_gift)
|
||||||
|
end
|
||||||
|
|
||||||
|
function ShopData:removeLevelUpGift(actId)
|
||||||
|
for index, gift in ipairs(self.levelUpGifts) do
|
||||||
|
if gift.current_level_up_gift == actId then
|
||||||
|
table.remove(self.levelUpGifts, index)
|
||||||
|
break
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
-- 获得可购买的助力礼包Ids
|
||||||
|
function ShopData:getLevelUpGiftActIds()
|
||||||
|
local list = {}
|
||||||
|
for index, gift in ipairs(self.levelUpGifts) do
|
||||||
|
table.insert(list, gift.current_level_up_gift)
|
||||||
|
end
|
||||||
|
table.sort(list)
|
||||||
|
return list
|
||||||
|
end
|
||||||
|
|
||||||
|
-- 助力礼包结束 ----------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
-- 成长礼包 **********************************************************************************************
|
||||||
|
|
||||||
-- 初始化成长礼包
|
-- 初始化成长礼包
|
||||||
function ShopData:initGrowUpGift(growUpGift)
|
function ShopData:initGrowUpGift(growUpGift)
|
||||||
end
|
end
|
||||||
|
|
||||||
-- 初始化助力礼包
|
-- 成长礼包结束 ----------------------------------------------------------------------------------------------
|
||||||
function ShopData:initLevelUpGift(levelUpGift)
|
|
||||||
end
|
|
||||||
|
|
||||||
return ShopData
|
return ShopData
|
||||||
Loading…
x
Reference in New Issue
Block a user