miduo_client/Assets/ManagedResources/~Lua/Modules/Operating/OperatingManager.lua

821 lines
26 KiB
Lua
Raw Normal View History

2020-08-25 15:46:38 +08:00
--[[
2020-05-09 13:31:21 +08:00
* @ClassName OperatingManager
* @Description
* @Date 2019/6/6 10:29
* @Author MagicianJoker, fengliudianshao@outlook.com
* @Copyright Copyright (c) 2019, MagicianJoker
--]]
OperatingManager = {}
local this = OperatingManager
2020-08-14 13:01:12 +08:00
--后端数据 以RechargeCommodityConfig表Type为键
2020-05-09 13:31:21 +08:00
local giftGoodsInfoList = {}
--- 新的数据列表按照ID存取
local newGoodsList = {}
local hadBuyGoodsList = {}
local rechargeConfig = ConfigManager.GetConfig(ConfigName.RechargeCommodityConfig)
local luxuryConfig = ConfigManager.GetConfig(ConfigName.LuxuryFundConfig)
2020-08-14 13:01:12 +08:00
--后端数据 goodsId;//商品id buyTimes; //购买次数 startTime;//开始时间 endTime; //结束时间 dynamicBuyTimes; //可购买次数
local giftGoodsInfo
2020-05-09 13:31:21 +08:00
2020-08-19 22:03:47 +08:00
this.upGradePackagePanelType = 1
this.upGradePackagePanelIndex = 1
2020-08-22 19:40:14 +08:00
this.IsShowFiveStarPatch = true
2020-05-09 13:31:21 +08:00
--初始化
function this.Initialize()
Game.GlobalEvent:AddEvent(GameEvent.Player.OnLevelChange, function()
RedpotManager.CheckRedPointStatus(RedPointType.GrowthGift)
end)
Game.GlobalEvent:AddEvent(GameEvent.PatFace.PatFaceHaveGrowGift, this.NewHeroGift)
end
---------------------------局限性----------------------------
2020-08-14 13:01:12 +08:00
function this.SetBasicValues(giftGoodsList)
2020-05-25 19:16:23 +08:00
giftGoodsInfo = giftGoodsList
2020-05-09 13:31:21 +08:00
for _, v in pairs(GoodsTypeDef) do
giftGoodsInfoList[v] = {}
end
for _, giftGoodsInfo in ipairs(giftGoodsList) do
local rechargeConfig = ConfigManager.GetConfigData(ConfigName.RechargeCommodityConfig, giftGoodsInfo.goodsId)
2020-08-25 16:23:41 +08:00
LogGreen("------充值活动-----------礼包类型:".. rechargeConfig.Type .." 礼包ID".. giftGoodsInfo.goodsId .." 已购:"
..giftGoodsInfo.buyTimes.." 开始:"..giftGoodsInfo.startTime.." 结束:"
..giftGoodsInfo.endTime .. " 可购(没卵用)" .. giftGoodsInfo.dynamicBuyTimes)
2020-05-09 13:31:21 +08:00
if giftGoodsInfoList[rechargeConfig.Type] then
table.insert(giftGoodsInfoList[rechargeConfig.Type], giftGoodsInfo)
end
end
Game.GlobalEvent:DispatchEvent(GameEvent.FindFairy.RefreshBuyOpenState)
end
2020-05-25 19:16:23 +08:00
--判断商品是否可购买(成长礼)
function this.IsGrowthGiftGoodsAvailable(goodsType)
for _, v in ipairs(giftGoodsInfo)do
local rechargeConfig = ConfigManager.GetConfigData(ConfigName.RechargeCommodityConfig, v.goodsId)
if(rechargeConfig.Type == goodsType and v.dynamicBuyTimes == 1 and v.buyTimes ~= v.dynamicBuyTimes)then
return v
end
end
return nil
end
2020-05-09 13:31:21 +08:00
-- 判断商品数据是否在可用时间范围内
local function _IsGiftGoodsAvailable(gift)
-- body
if not gift then return false end
if gift.startTime == 0 and gift.endTime == 0 then return true end
local curTime = GetTimeStamp()
local isAvailable = curTime > gift.startTime and curTime <= gift.endTime
return isAvailable
end
function this.RemoveGiftInfoList(goodsType)
giftGoodsInfoList[goodsType] = nil
end
--- 删除某一类型的某一条商品数据
function this.RemoveItemInfoByType(type, goodsId)
if not giftGoodsInfoList[type] then
2020-06-23 18:36:24 +08:00
Log(Language[11482])
2020-05-09 13:31:21 +08:00
return
end
for k,v in pairs(giftGoodsInfoList[type]) do
if v then
if v.goodsId == goodsId then
table.remove(giftGoodsInfoList[type], k)
end
end
end
2020-06-18 20:39:29 +08:00
Game.GlobalEvent:DispatchEvent(GameEvent.FindFairy.RefreshBuyOpenState)
2020-05-09 13:31:21 +08:00
end
function this.IsRechargeable(goodsType)
return giftGoodsInfoList[goodsType]
end
--- 获取激活后的商品数据
function this.GetGiftGoodsInfo(goodsType, Id)
if not giftGoodsInfoList[goodsType] then
return nil
end
for _, giftGoodsInfo in pairs(giftGoodsInfoList[goodsType]) do
if Id then
if giftGoodsInfo.goodsId == Id then
return giftGoodsInfo
end
else
-- 判断是否可用
if _IsGiftGoodsAvailable(giftGoodsInfo) then
return giftGoodsInfo
end
end
end
return nil
end
function this.GetGiftGoodsInfoList(type)
return giftGoodsInfoList[type] and giftGoodsInfoList[type] or {}
end
function this.RefreshGiftGoodsBuyTimes(goodsType, goodsId, buyTimes)
2020-05-25 19:16:23 +08:00
-- if not giftGoodsInfoList[goodsType] then
-- return
-- end
-- for _, giftGoodsInfo in ipairs(giftGoodsInfoList[goodsType]) do
-- if giftGoodsInfo.goodsId == goodsId then
-- giftGoodsInfo.buyTimes = giftGoodsInfo.buyTimes + (buyTimes and buyTimes or 1)
-- end
-- end
2020-05-09 13:31:21 +08:00
end
--- 获取商品的剩余购买次数
--- 0 不可买 1: 剩余1次-1不限次数
function this.GetLeftBuyTime(type, goodsId)
if not giftGoodsInfoList[type] then
2020-06-23 18:36:24 +08:00
Log(Language[11483] .. goodsId)
2020-05-09 13:31:21 +08:00
return
end
--- 此类商品的购买次数限制
local limitTime = rechargeConfig[goodsId].Limit
if limitTime == 0 then --- 不限购
return -1
else
local boughtTime = this.GetGoodsBuyTime(type, goodsId)
return limitTime - boughtTime
end
end
--- 获取商品已经购买次数
function this.GetGoodsBuyTime(type, goodsId)
if not giftGoodsInfoList[type] then
2020-08-13 15:38:20 +08:00
--王振兴添加 防止没有查询到数据报错
return 0
2020-05-09 13:31:21 +08:00
end
for k,v in pairs(giftGoodsInfoList[type]) do
if v.goodsId == goodsId then
return v.buyTimes
end
end
2020-08-13 15:38:20 +08:00
--王振兴添加 防止没有查询到数据报错
return 0
2020-05-09 13:31:21 +08:00
end
--------------------------------------------------------------
function this.SetHadBuyGoodsId(BuyGoodsList)
for i = 1, #BuyGoodsList do
table.insert(hadBuyGoodsList, BuyGoodsList[i])
end
end
function this.GetHadBuyGoodsTypeId(type)
2020-05-25 19:16:23 +08:00
local Id
2020-05-09 13:31:21 +08:00
for _, goodsId in ipairs(hadBuyGoodsList) do
if rechargeConfig[goodsId].Type == type then
2020-05-25 19:16:23 +08:00
Id = goodsId
2020-05-09 13:31:21 +08:00
end
end
2020-05-25 19:16:23 +08:00
return Id
2020-05-09 13:31:21 +08:00
end
function this.GetGrowthRedPointState()
local redPoint = false
2020-05-25 19:16:23 +08:00
local giftGoodsInfo = OperatingManager.IsGrowthGiftGoodsAvailable(GoodsTypeDef.GrowthReward)
if giftGoodsInfo then return false end
local openId = ActivityGiftManager.IsActivityTypeOpen(ActivityTypeDef.GrowthReward)
if openId then
2020-05-09 13:31:21 +08:00
local actRewardConfig = ConfigManager.GetConfig(ConfigName.ActivityRewardConfig)
for _, configInfo in ConfigPairs(actRewardConfig) do
2020-05-25 19:16:23 +08:00
if configInfo.ActivityId == openId then
local activityInfo = ActivityGiftManager.GetActivityInfo(openId, configInfo.Id)
2020-06-03 19:09:01 +08:00
if activityInfo and activityInfo.state == 0 and PlayerManager.level >= configInfo.Values[1][2] then
2020-05-25 19:16:23 +08:00
redPoint = true
2020-05-09 13:31:21 +08:00
end
end
end
end
return redPoint
end
-- 商品时间数据
local _GoodsDurationData = {}
function this.SetGoodsDurationData(dataList)
if not dataList then
return
end
for _, data in ipairs(dataList) do
-- 这里协议字段为goodsType其实数据为ID
_GoodsDurationData[data.goodsType] = data.endTime
--Log("商品类型 = "..data.goodsType..", 剩余时间 = "..data.endTime)
end
end
-- 根据类型判断相应的物品是否开启并返回相应的ID
function this.GetActiveGoodsIDByType(goodsType)
for goodsId, endTime in pairs(_GoodsDurationData) do
if rechargeConfig[goodsId].Type == goodsType and endTime > GetTimeStamp() then
return goodsId, endTime
end
end
end
function this.GetGoodsEndTime(goodsType)
local goodsId, endTime = this.GetActiveGoodsIDByType(goodsType)
return endTime
end
function this.RemoveEndTime(goodsId)
_GoodsDurationData[goodsId] = nil
end
function this.SetGoodsEndTime(goodsId, endTime)
_GoodsDurationData[goodsId] = endTime
end
-- 直购活动是否还在
function this.IsGoodsExit(type, id)
local isOpen = false
local data = this.GetGiftGoodsInfo(type, id)
if data then
-- 有数据,但是活动结束
local time = data.endTime - PlayerManager.serverTime
isOpen = time > 0
else
isOpen = false
end
return isOpen
end
-- 五星成长礼红点
function this.GetRedState()
local isRed = false
local redValue = PlayerPrefs.GetInt(PlayerManager.uid .. "BlaBlaBla")
local openState = this.IsGoodsExit(GoodsTypeDef.DirectPurchaseGift, 21)
if openState and redValue == 0 then
isRed = true
else
isRed = false
end
return isRed
end
---------------------------------------累计签到--------------------------------
local _SignInData
function this.SetSignInData(signIn)
_SignInData = signIn
CheckRedPointStatus(RedPointType.CumulativeSignIn)
end
function this.GetSignInData()
return _SignInData
end
--红点检测方法
function this.GetSignInRedPointStatus()
local receiveNum=PrivilegeManager.GetPrivilegeRemainValue(PRIVILEGE_TYPE.DAY_SIGN_IN)--本地标记可领取次数
local rechargeNum=PrivilegeManager.GetPrivilegeNumber(PRIVILEGE_TYPE.DAY_SIGN_IN)--充值标记 1未充值 2已充值
return _SignInData.state == 0 or receiveNum>0--(_SignInData.state==1 and ((receiveNum==0 and rechargeNum==1) or (receiveNum==1 and rechargeNum==2)))
end
---------------------------------- 什么什么什么新鸡成长礼包 ------------------------------------------
--- 新增一个礼包
function this.NewHeroGift()
this.SetHeroRedState(1)
CheckRedPointStatus(RedPointType.HERO_STAR_GIFT)
end
--- 获取那个的显示数据
function this.GetStarGiftData()
local data = {}
for k, v in ConfigPairs(rechargeConfig) do
if v.ShowType == 8 then
local t = {}
t.data = v -- 数据结构
t.Id = v.Id -- 商品ID
data[#data + 1] = t
end
end
return data
end
function this.IsHeroGiftActive()
2020-07-26 16:44:31 +08:00
-- 关闭星级成长礼显示
return false
2020-07-26 17:28:44 +08:00
-- local activeNum = 0
-- if not giftGoodsInfoList[GoodsTypeDef.DirectPurchaseGift] then
-- return false
-- else
-- for i = 1, #giftGoodsInfoList[GoodsTypeDef.DirectPurchaseGift] do
-- local data =giftGoodsInfoList[GoodsTypeDef.DirectPurchaseGift][i]
-- if data then
-- local id = data.goodsId
-- if rechargeConfig[id].ShowType == 8 then --- 只有前端显示的商品类型
-- activeNum = activeNum + 1
-- end
-- end
-- end
-- end
2020-05-09 13:31:21 +08:00
2020-07-26 17:28:44 +08:00
-- return activeNum > 0
2020-05-09 13:31:21 +08:00
end
--- 获取礼包的显示数据
function this.GetGiftShowData()
local staticData = this.GetStarGiftData()
local newData = {}
for i = 1, #staticData do
local goodsId = staticData[i].Id
local data = {}
data.rewardData = staticData[i].data.RewardShow
data.price = staticData[i].data.Price
data.id = goodsId
data.name = staticData[i].data.Name
local serData = this.GetGiftGoodsInfo(GoodsTypeDef.DirectPurchaseGift, goodsId)
if serData and serData.endTime > 0 then --- 商品激活可购买
data.endTime = serData.endTime
data.startTime = serData.startTime
data.leftBuyTime = serData.dynamicBuyTimes
data.isActive = 1
else --- 未激活只是显示而已
data.endTime = 0
data.startTime = 0
data.leftBuyTime = 0
data.isActive = 0
end
newData[#newData + 1] = data
end
---排序
if #newData > 1 then
table.sort(newData, function(a, b)
if a.isActive == b.isActive then
return a.id > b.id
else
return a.isActive > b.isActive
end
end)
end
return newData
end
--- 礼包红点
function this.IsHeroStarGiftActive()
local clickedState = this.GetHeroRedState()
local isActive = this.IsHeroGiftActive()
local hasRed = clickedState == 1 and isActive
return hasRed
end
function this.SetHeroRedState(value)
PlayerPrefs.SetInt(PlayerManager.uid .. "hero_star_gift", value)
end
function this.GetHeroRedState()
return PlayerPrefs.GetInt(PlayerManager.uid .. "hero_star_gift")
end
----------------------------------------------------------------------------------------------
--- 获取鸡精面版的显示信息
--- 传进来的参数值是 33或者是34基金类型
2020-05-25 19:16:23 +08:00
function this.GetPanelShowReward(type, isAll,isOverlay)
2020-05-09 13:31:21 +08:00
local data = {}
for k, v in ConfigPairs(luxuryConfig) do
if not isAll then
if v.Type == type and v.ShowReward == 1 then
data[#data + 1] = v
end
else
if v.Type == type then
data[#data + 1] = v
end
end
end
2020-05-25 19:16:23 +08:00
if isOverlay then
local endData = {}
for i = 1, #data do
if endData[data[i].reward[1][1]] then
endData[data[i].reward[1][1]] = endData[data[i].reward[1][1]] + data[i].reward[1][2]
else
endData[data[i].reward[1][1]] = data[i].reward[1][2]
end
end
local endData2 = {}
for i, v in pairs(endData) do
table.insert(endData2,{i,v})
end
return endData2
else
return data
end
2020-05-09 13:31:21 +08:00
end
--- 某一个鸡精活动是否开启
function this.IsBaseOpen(type, id)
local isOpen = false
local data = this.GetGiftGoodsInfo(type, id)
if data then
--- 常驻
if tonumber(data.endTime) == 0 then
isOpen = true
else
local time = data.endTime - PlayerManager.serverTime
local isBuy = this.IsBaseBuy(type)
isOpen = time > 0
-- 如果购买了结束也没有用
if isBuy then
isOpen = true
end
end
else
isOpen = false
-- 如果购买了结束也没有用
if this.IsBaseBuy(type) then
isOpen = true
end
end
return isOpen
end
--- 判断某一个鸡精是否购买
function this.IsBaseBuy(type)
local leftTime = this.GetGoodsEndTime(type)
local isBuy = false
if not leftTime then
isBuy = false
else
if leftTime <= 0 then
isBuy = false
else
isBuy = true
end
end
return isBuy
end
---- 界面打开时设置一下服务器数据
function this.SetSerData(goodsType)
local endTime = this.GetGoodsEndTime(goodsType)
if not endTime then return end
local startTime = endTime - 24 * 30 * 60 * 60
local passSecond = GetTimeStamp() - startTime
-- Log("结束时间" .. os.date("%Y年%m月%d", endTime))
-- Log("起点时间" .. os.date("%Y年%m月%d", startTime))
-- Log("服务器时间".. os.date("%Y年%m月%d", GetTimeStamp()))
-- Log("经历时间 --- " .. PlayerManager.serverTime)
this.SetSignRewarDay(goodsType, passSecond)
end
local getDay = {}
local oneDaySeconds = 24 * 60 * 60
-- 累计领取天数
function this.GetRewardDay(goodType)
-- Log("天数 " .. getDay[goodType])
-- 未激活时没有天数
if not this.IsBaseBuy(goodType) then return 0 end
return getDay[goodType]
end
--- 设置累计天数
function this.SetSignRewarDay(goodType, second)
if not getDay[goodType] then getDay[goodType] = {} end
-- 小于24小时按一天
if second <= oneDaySeconds * 1 then
getDay[goodType] = 1
elseif second >= oneDaySeconds * 30 then
getDay[goodType] = 30
else
local hour = math.ceil(math.ceil(second / 60) / 60)
getDay[goodType] = math.ceil(hour / 24)
-- Log("累计" .. hour .. "小时")
getDay[goodType] = getDay[goodType] >= 30 and 30 or getDay[goodType]
end
end
-- 显示数据
function this.GetShowTime(endTime)
local duration = 30 * 24 * 60 * 60
2020-06-23 18:36:24 +08:00
local endStr = os.date(Language[11484], endTime)
local startStr = os.date(Language[11484], endTime - duration + 1)
2020-05-09 13:31:21 +08:00
return startStr, endStr
end
--月卡开始
--初始化月卡数据
local monthSaveAmt = 0--月卡累计总额
local smonthSaveAmt = 0--豪华月卡累计总额
local monthCardData = {}
function this.InitMonthCardData(data)
monthCardData = {}
--LogError("月卡信息初始化 "..#data)
for i = 1, #data do
--LogError("月卡信息初始化 "..data[i].id.." "..data[i].endingTime.." "..data[i].state)
local singleMonthCard = {}
singleMonthCard.id = data[i].id
singleMonthCard.endingTime = data[i].endingTime
singleMonthCard.state = data[i].state
if i == MONTH_CARD_TYPE.MONTHCARD then
--LogError("月卡信息初始化 月卡累计充值 "..data[i].totleAmt)
monthSaveAmt = data[i].totleAmt
elseif i == MONTH_CARD_TYPE.LUXURYMONTHCARD then
--LogError("月卡信息初始化 豪华月卡累计充值 "..data[i].totleAmt)
smonthSaveAmt = data[i].totleAmt
end
table.insert(monthCardData,singleMonthCard)
end
CheckRedPointStatus(RedPointType.MonthCard)
end
--推送更新月卡数据
function this.UpdateMonthCardData(msg)
--LogError("月卡信息推送 "..#msg.monthinfos)
--当我数据没有 后端推过来的有数据 此时需要弹窗
local showStr = ""
for i = 1, #msg.monthinfos do
if monthCardData[i].endingTime <= 0 then
2020-06-23 18:36:24 +08:00
showStr = Language[11485]
2020-05-09 13:31:21 +08:00
end
end
monthCardData = {}
2020-08-22 15:31:14 +08:00
local curActiveMONTHCARD = false
local curActiveLUXURYMONTHCARD = false
2020-05-09 13:31:21 +08:00
for i = 1, #msg.monthinfos do
--LogError("月卡信息推送 "..msg.monthinfos[i].id.." "..msg.monthinfos[i].endingTime.." "..msg.monthinfos[i].state)
local singleMonthCard = {}
singleMonthCard.id = msg.monthinfos[i].id
singleMonthCard.endingTime = msg.monthinfos[i].endingTime
singleMonthCard.state = msg.monthinfos[i].state--0 未领取 1 已领取
if i == MONTH_CARD_TYPE.MONTHCARD then
monthSaveAmt = msg.monthinfos[i].totleAmt
2020-08-22 15:31:14 +08:00
curActiveMONTHCARD = true
2020-05-09 13:31:21 +08:00
elseif i == MONTH_CARD_TYPE.LUXURYMONTHCARD then
smonthSaveAmt = msg.monthinfos[i].totleAmt
2020-08-22 15:31:14 +08:00
curActiveLUXURYMONTHCARD = true
2020-05-09 13:31:21 +08:00
end
table.insert(monthCardData,singleMonthCard)
end
CheckRedPointStatus(RedPointType.MonthCard)
if showStr ~= "" then
if ActTimeCtrlManager.SingleFuncState(JumpType.Welfare) then
2020-08-22 15:31:14 +08:00
if curActiveMONTHCARD then
--发送埋点数据
CustomEventManager.SendCustomEvents(FBSDKCustomEventType.FirstBuyMonthCard,0)
end
if curActiveLUXURYMONTHCARD then
--发送埋点数据
CustomEventManager.SendCustomEvents(FBSDKCustomEventType.FirstBuyHeightMonthCard,0)
end
2020-05-25 19:16:23 +08:00
MsgPanel.ShowTwo(showStr, function()
2020-05-09 13:31:21 +08:00
JumpManager.GoJump(36004)
2020-05-25 19:16:23 +08:00
end,
function()
UIManager.ClosePanel()
2020-06-23 18:36:24 +08:00
end,Language[10549],Language[11486])
2020-05-09 13:31:21 +08:00
end
end
end
function this.RefreshMonthCardChargeMoney(msg)
--LogError("月卡金额信息推送 "..msg.monthSaveAmt.." "..msg.smonthSaveAmt)
monthSaveAmt = msg.monthSaveAmt--月卡累计总额
smonthSaveAmt = msg.smonthSaveAmt--豪华月卡累计总额
end
-- 月卡累计总额
function this.GetmonthSaveAmt()
return monthSaveAmt
end
-- 豪华月卡累计总额
function this.GetsmonthSaveAmt()
return smonthSaveAmt
end
--前端设置月卡领取状态数据
function this.SetMonthCardGetStateData(type,state)
if monthCardData[type] then
monthCardData[type].state = state--0 未领取 1 已领取
end
CheckRedPointStatus(RedPointType.MonthCard)
end
--后端设置月卡领取状态数据 datas已领取的月卡id 五点刷新
function this.BackSetMonthCardGetStateData(datas)
for i = 1, #monthCardData do
if monthCardData[i] then--0 未领取 1 已领取
if datas[i] then
monthCardData[i].state = 1
else
monthCardData[i].state = 0
end
end
end
--事件
CheckRedPointStatus(RedPointType.MonthCard)
Game.GlobalEvent:DispatchEvent(GameEvent.MonthCard.OnMonthCardUpdate)
end
--获取月卡数据
function this.GetMonthCardData()
if monthCardData then
return monthCardData
else
return nil
end
end
--月卡到期
local addTimeNum = 30 * 24 * 60 * 60
function this.RefreshMonthCardEnd()
for i = 1, #monthCardData do
if monthCardData[i] and monthCardData[i].endingTime > 0 then--0 未领取 1 已领取
local dayLuxuryNum = math.floor((monthCardData[i].endingTime + addTimeNum - GetTimeStamp()) / (24 * 3600))
if dayLuxuryNum < 0 then
monthCardData[i].endingTime = 0
monthCardData[i].state = 0--0 未领取 1 已领取
if i == MONTH_CARD_TYPE.MONTHCARD then
monthSaveAmt = 0--月卡累计总额
else
smonthSaveAmt = 0--豪华月卡累计总额
end
end
end
end
CheckRedPointStatus(RedPointType.MonthCard)
end
--单种月卡红点检测
function this.RefreshMonthCardRedPoint(type)
if monthCardData[type] then
if monthCardData[type].endingTime ~= 0 and monthCardData[type].state == 0 then
return true
end
end
return false
end
--所有月卡红点检测
function this.AllRefreshMonthCardRedPoint()
for i = 1, #monthCardData do
if monthCardData[i].endingTime ~= 0 and monthCardData[i].state == 0 then
return true
end
end
return false
end
--所有月卡激活状态
function this.GetMonthCardIsOpen(type)
if monthCardData[type] then
if monthCardData[type].endingTime ~= 0 then
return true
end
end
return false
end
--月卡结束
2020-06-03 19:09:01 +08:00
--礼包抢购是否开启
function this.IsGiftBuyActive()
local activeNum = 0
local GiftBuyData = ConfigManager.GetAllConfigsDataByDoubleKey(ConfigName.RechargeCommodityConfig, "ShowType", 20, "Type", GoodsTypeDef.DirectPurchaseGift)
if GiftBuyData then
for i = 1, #GiftBuyData do
local curgoodData = OperatingManager.GetGiftGoodsInfo(GoodsTypeDef.DirectPurchaseGift, GiftBuyData[i].Id)
if curgoodData then
if curgoodData.endTime - GetTimeStamp() > 0 then
activeNum = activeNum + 1
end
end
end
end
return activeNum > 0
end
2020-06-28 17:52:29 +08:00
function this.GetTimeLimitRedPointStatus()
local lotterySetting=ConfigManager.GetConfig(ConfigName.LotterySetting)
local freeTimesId=lotterySetting[RecruitType.TimeLimitSingle].FreeTimes
local freeTime= 0
if freeTimesId>0 then
freeTime= PrivilegeManager.GetPrivilegeRemainValue(freeTimesId)
RecruitManager.freeUseTimeList[freeTimesId]=freeTime
return freeTime and freeTime >= 1
end
end
2020-07-17 18:20:31 +08:00
function this.GetQiankunBoxRedPointStatus()
local lotterySetting=ConfigManager.GetConfig(ConfigName.LotterySetting)
local freeTimesId=lotterySetting[RecruitType.QianKunBoxSingle].FreeTimes
local freeTime= 0
if freeTimesId>0 then
freeTime= PrivilegeManager.GetPrivilegeRemainValue(freeTimesId)
RecruitManager.freeUseTimeList[freeTimesId]=freeTime
return freeTime and freeTime >= 1
end
end
2020-07-09 10:04:20 +08:00
this.TimeLimitedTimes = 0
2020-08-20 17:36:19 +08:00
this.allData = {}
function this.InitPoZhenZhuXianData()
local id = ActivityGiftManager.GetActivityIdByType(ActivityTypeDef.pozhenzhuxian_task)
2020-08-28 11:31:38 +08:00
if (not id) or id == 0 then
return nil
end
if not ActivityGiftManager.IsActivityTypeOpen(ActivityTypeDef.pozhenzhuxian_task) then
2020-08-20 17:36:19 +08:00
return nil
end
this.allData = {}
local allListData = ConfigManager.GetAllConfigsDataByKey(ConfigName.ThemeActivityTaskConfig, "ActivityId", id)
2020-08-28 16:36:08 +08:00
local allMissionData = TaskManager.GetTypeTaskList(TaskTypeDef.PoZhenZhuXianTask)
2020-08-20 17:36:19 +08:00
for i=1,#allListData do
for j=1,#allMissionData do
if allListData[i].Id == allMissionData[j].missionId then
local data = {}
data.id = allMissionData[j].missionId
data.progress = allMissionData[j].progress
data.state = allMissionData[j].state
data.type = allListData[i].Type
local strs = string.split(allListData[i].Show,"#")
data.title = strs[1]
data.content = strs[2]
data.value = allListData[i].TaskValue[2][1]
data.reward = {allListData[i].Integral[1][1],allListData[i].Integral[1][2]}
data.jump = allListData[i].Jump[1]
table.insert(this.allData,data)
end
end
end
return this.allData
end
function this.CheckPoZhenZhuXianTaskRed()
this.InitPoZhenZhuXianData()
if not this.allData then
return false
end
for i=1,#this.allData do
2020-08-21 18:56:00 +08:00
if this.allData[i].state == 1 then
2020-08-20 17:36:19 +08:00
return true
end
end
return false
end
2020-08-21 16:39:30 +08:00
function this.InitLeiJiChongZhiData()
local id = ActivityGiftManager.GetActivityIdByType(ActivityTypeDef.pozhenzhuxian_recharge)
if (not id) or id == 0 then
return nil
end
if not ActivityGiftManager.IsActivityTypeOpen(ActivityTypeDef.pozhenzhuxian_recharge) then
return nil
end
2020-08-21 18:30:44 +08:00
this.LeiJiChongZhiData = {}
2020-08-21 16:39:30 +08:00
local allListData = ConfigManager.GetAllConfigsDataByKey(ConfigName.ActivityRewardConfig, "ActivityId", id)
2020-08-21 18:30:44 +08:00
local allMissionData = ActivityGiftManager.GetActivityTypeInfo(ActivityTypeDef.pozhenzhuxian_recharge)
2020-08-21 16:39:30 +08:00
for i=1,#allListData do
2020-08-21 18:30:44 +08:00
for j=1,#allMissionData.mission do
if allListData[i].Id == allMissionData.mission[j].missionId then
2020-08-21 16:39:30 +08:00
local data = {}
2020-08-21 18:30:44 +08:00
data.id = allMissionData.mission[j].missionId
data.progress = allMissionData.value
2020-08-21 16:39:30 +08:00
data.value = allListData[i].Values[1][1]
2020-08-21 18:30:44 +08:00
data.state = allMissionData.mission[j].state == 1 and allMissionData.mission[j].state or (data.progress>= data.value and 2 or 0) -- 0 前往 1已领奖 2领奖
2020-08-21 16:39:30 +08:00
data.reward = allListData[i].Reward
data.jump = allListData[i].Jump[1]
2020-08-21 18:30:44 +08:00
table.insert(this.LeiJiChongZhiData,data)
2020-08-21 16:39:30 +08:00
end
end
end
2020-08-21 18:30:44 +08:00
return this.LeiJiChongZhiData
end
function this.CheckLeiJiChongZhiRedData()
local mission = this.InitLeiJiChongZhiData()
if not mission or #mission < 1 then
return false
end
for j = 1,#mission do
if mission.state == 2 then
return true
end
end
return false
2020-08-21 16:39:30 +08:00
end
2020-06-23 18:36:24 +08:00
return this