miduo_client/Assets/ManagedResources/~Lua/Modules/ActivityGift/ActivityGiftManager.lua

1473 lines
58 KiB
Lua
Raw Blame History

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

ActivityGiftManager = {};
local this = ActivityGiftManager
local ActivityRewardConfig = ConfigManager.GetConfig(ConfigName.ActivityRewardConfig)
local GlobalActivity = ConfigManager.GetConfig(ConfigName.GlobalActivity)
local nowStageTime = 0
local giftData = {}
local luckyCatConfig = ConfigManager.GetConfig(ConfigName.LuckyCatConfig)
local chargeConfig = ConfigManager.GetConfig(ConfigName.RechargeCommodityConfig)
local luxuryConfig = ConfigManager.GetConfig(ConfigName.LuxuryFundConfig)
this.mainLevelConfig = ConfigManager.GetConfig(ConfigName.MainLevelConfig)
local isFirstTime = true
local JourneyWithWindAllDayConFigData = {}
local JourneyWithWindDayAmount = {}--天数,任务数量
this.isFirstForSupremeHero=false--剑影仙踪是否每日第一次登陆
function this.Initialize()
--UpdateBeat:Add(this.update, this)
this.sevenDayOpen = false
this.onlineOpen = false
this.chapterOpen = false
----新数据
--在线礼包数据
this.onlineData = {}
this.onlineDataTime = {}
this.onlineGetRewardState = {}
this.haveOnlineTime = 0
this.onlineTime=0 --已经在线时长
this.currentTimeIndex = 0--当前可领取阶段
this.cuOnLineTimestamp = 0--当前在线奖励时间戳 从什么时候开始计时
--七日礼包数据
this.sevenDayData = {}
this.sevenDayGetRewardState = {}
this.sevenDayTime = 0
this.canRewardDay = 0
--章节礼包数据
this.chapterGiftData = {}
this.chapterGetRewardState = {}
this.isOpenWeekCard = false--今天是否打开过周卡
this.mission = {}
-- 每次登录显示兑换红点
this.SetExchangeRedStatus(true)
Game.GlobalEvent:AddEvent(GameEvent.Player.OnLevelChange, function()
CheckRedPointStatus(RedPointType.Expert_UpLv)
end)
end
-- 开始在线计时
function this.StartOnlineUpdate()
-- 开始定时刷新
if not this._CountDownTimer then
this._CountDownTimer = Timer.New(this.TimeCountDown, 1, -1, true)
this._CountDownTimer:Start()
end
end
function this.TimeCountDown()
if not NetManager.IsConnect() then
--Log("断线!!!!!")
return
end
this.haveOnlineTime = this.haveOnlineTime - 1
this.onlineTime=this.onlineTime+1
if (this.haveOnlineTime <= 0 and this.currentTimeIndex < #this.onlineDataTime - 1) then
this.currentTimeIndex = this.currentTimeIndex + 1
Game.GlobalEvent:DispatchEvent(GameEvent.Activity.OnlineState, this.haveOnlineTime, this.onlineData,this.onlineTime)
this.haveOnlineTime = this.onlineDataTime[this.currentTimeIndex + 1].Values[1][1] * 60 - this.onlineDataTime[this.currentTimeIndex].Values[1][1] * 60
CheckRedPointStatus(RedPointType.CourtesyDress_Online)
--CheckRedPointStatus(RedPointType.SecretTer)
Game.GlobalEvent:DispatchEvent(GameEvent.Adventure.OnRefreshRedShow)
else
Game.GlobalEvent:DispatchEvent(GameEvent.Activity.OnlineState, this.haveOnlineTime, this.onlineData,this.onlineTime)
end
end
function this.InitActivityData()
for i, v in ConfigPairs(ActivityRewardConfig) do
--获取在线礼包数据
if (v.ActivityId == ActivityTypeDef.OnlineGift) then
table.insert(this.onlineData, v)
table.insert(this.onlineDataTime, v)
end
--获取七日礼包数据
if (v.ActivityId == ActivityTypeDef.EightDayGift) then
table.insert(this.sevenDayData, v)
end
--获取章节礼包数据
if (v.ActivityId == ActivityTypeDef.ChapterAward) then
table.insert(this.chapterGiftData, v)
end
end
end
function this.GetActivityRewardRequest(type, index)
--local rewardId=0
--向服务器发送领取在线奖励请求
NetManager.GetActivityRewardRequest(index, type, function(_drop)
UIManager.OpenPanel(UIName.RewardItemPopup, _drop, 1)
if (type == ActivityTypeDef.OnlineGift) then
this.onlineGetRewardState[index] = 1
CheckRedPointStatus(RedPointType.CourtesyDress_Online)
table.sort(this.onlineData, function(a, b)
return a.Id < b.Id
end)
Game.GlobalEvent:DispatchEvent(GameEvent.Activity.GetRewardRefresh, this.onlineData)
elseif (type == ActivityTypeDef.EightDayGift) then
this.sevenDayGetRewardState[index] = 1
CheckRedPointStatus(RedPointType.CourtesyDress_SevenDay)
table.sort(this.sevenDayData, function(a, b)
if this.sevenDayGetRewardState[a.Id] == this.sevenDayGetRewardState[b.Id] then
return a.Id < b.Id
else
return this.sevenDayGetRewardState[a.Id] < this.sevenDayGetRewardState[b.Id]
end
end)
Game.GlobalEvent:DispatchEvent(GameEvent.Activity.GetRewardRefresh, this.sevenDayData)
elseif (type == ActivityTypeDef.ChapterAward) then
this.chapterGetRewardState[index] = 1
CheckRedPointStatus(RedPointType.CourtesyDress_Chapter)
table.sort(this.chapterGiftData, function(a, b)
if this.chapterGetRewardState[a.Id] == this.chapterGetRewardState[b.Id] then
return a.Id < b.Id
else
return this.chapterGetRewardState[a.Id] < this.chapterGetRewardState[b.Id]
end
end)
Game.GlobalEvent:DispatchEvent(GameEvent.Activity.GetRewardRefresh, this.chapterGiftData)
end
--CheckRedPointStatus(RedPointType.SecretTer)
Game.GlobalEvent:DispatchEvent(GameEvent.Adventure.OnRefreshRedShow)
end)
end
-- 获取服务器活动领取进度数据
function this.InitActivityServerData(msg, isUpdate)
if not isUpdate then
this.mission = {}
end
for i, v in ipairs(msg.activityInfo) do
if GlobalActivity[v.activityId] then
this.CheckMoneyProgress(v)
this.mission[v.activityId] = v
-- LogYellow("刷新活动数据activityId" .. v.activityId .. " value" .. v.value)
-- if v.endTime and v.endTime > 0 then
-- LogYellow(" 结束日期:"..TimeStampToDateStr4(v.endTime))
-- end
for n, m in ipairs(v.mission) do
-- LogGreen(" 刷新活动数据missionId" .. m.missionId .. " state" .. m.state .. " progress" .. m.progress)
if (v.activityId == ActivityTypeDef.OnlineGift) then
this.onlineOpen = true
this.onlineGetRewardState[m.missionId] = m.state
this.haveOnlineTime = m.progress
this.onlineTime= m.progress
------LogGreen("------------------------------------后端刷新在线时长2 "..m.progress.." "..TimeToHMS(m.progress))
this.cuOnLineTimestamp = GetTimeStamp() - m.progress
--this.StartOnlineUpdate()
elseif (v.activityId == ActivityTypeDef.EightDayGift) then
this.sevenDayOpen = true
this.sevenDayGetRewardState[n] = m.state
this.canRewardDay = m.progress
elseif (v.activityId == ActivityTypeDef.ChapterAward) then
this.chapterOpen = true
this.chapterGetRewardState[m.missionId] = m.state
end
if GlobalActivity[v.activityId].Type == ActivityTypeDef.FifteenDayGift then
Game.GlobalEvent:DispatchEvent(GameEvent.EightDay.FifteenDayGift)
end
end
if (v.activityId == ActivityTypeDef.EightDayGift) then
this.sevenDayTime = v.endTime - GetTimeStamp()
this.dayTime = GetTimeStamp() - v.startTime
end
if v.choiceRewardId then
this.choiceId=v.choiceRewardId
end
for m, n in ConfigPairs(luckyCatConfig) do
--Log(v.activityId.."活动ID")
if (v.activityId == n.ActivityId) then
LuckyCatManager.isOpenLuckyCat = true
LuckyCatManager.GetRewardProgress(v.mission, v.activityId, v.value)
end
end
else
LogError("服务器发送了前端不存在的活动ID"..v.activityId)
end
end
TreasureOfSomebodyManagerV2.SetTreasureLocalData()
this.OnlineStartCountDown()
this.InitJourneyWithWindConFigData()
end
--倒计时逻辑处理
function this.OnlineStartCountDown()
nowStageTime = 0
for i, v in ipairs(this.onlineData) do
if (v.Values[1][1] >= this.haveOnlineTime / 60) then
nowStageTime = v.Values[1][1] * 60
break
end
if (this.haveOnlineTime / 60 <= this.onlineData[1].Values[1][1]) then
nowStageTime = this.onlineData[1].Values[1][1] * 60
end
end
for i, v in pairs(this.onlineData) do
if (this.haveOnlineTime / 60 >= v.Values[1][1]) then
this.currentTimeIndex = v.Sort
end
end
this.haveOnlineTime = nowStageTime - this.haveOnlineTime
end
--检测七日礼包红点
function this.CheckSevenDayRed()
local sevenDayRed = this.CheckRedFunc(RedPointType.CourtesyDress_SevenDay)
return sevenDayRed
end
--检测在线礼包红点
function this.CheckOnlineRed()
local onlineRed = this.CheckRedFunc(RedPointType.CourtesyDress_Online)
return onlineRed
end
--检测章节礼包红点
function this.CheckChapterRed()
local chapterRed = this.CheckRedFunc(RedPointType.CourtesyDress_Chapter)
return chapterRed
end
-------针对首充和累充,成长礼金-----------
function this.GetActivityTypeInfo(type)
local globalActConfigs = ConfigManager.GetAllConfigsDataByKey(ConfigName.GlobalActivity, "Type", type)
local missionData = nil
table.walk(globalActConfigs, function(actConfigInfo)
if this.mission[actConfigInfo.Id] then
missionData = this.mission[actConfigInfo.Id]
end
end)
return missionData
end
function this.GetActivityIdByType(type)
local globalActConfigs = ConfigManager.GetAllConfigsDataByKey(ConfigName.GlobalActivity, "Type", type)
local id = 0
local missionData = nil
table.walk(globalActConfigs, function(actConfigInfo)
if this.mission[actConfigInfo.Id] then
------LogGreen("actConfigInfo.Id "..actConfigInfo.Id)
id = actConfigInfo.Id
end
end)
return id
end
function this.GetActivityValueInfo(type, Id)
if this.mission[type] then
-- LogBlue("this.mission[type].value:"..this.mission[type].value)
return this.mission[type].value
end
end
function this.GetActivityInfo(type, Id)
if this.mission[type] then
for _, missInfo in pairs(this.mission[type].mission) do
if missInfo.missionId == Id then
return missInfo
end
end
else
Log(string.format("没有ActivityTypeDef为%s任务Id为%s的数据", type, Id))
return nil,0
end
end
function this.GetActivityInfoByType(type)
if this.mission[type] then
return this.mission[type]
end
end
function this.SetActivityInfo(type, Id, state)
for _, missInfo in pairs(this.mission[type].mission) do
if missInfo.missionId == Id then
missInfo.state = state
break
end
end
end
--设置限时抽卡活动up英雄id
function this.SetActivityInfoRewardId(type,Id)
if this.mission[type] then
this.mission[type].choiceRewardId=Id
end
end
function this.GetActivityOpenStatus(type)
local id = this.GetActivityIdByType(type)
if this.mission[id] then
return this.mission[id].reallyOpen == 1
else
-- Log(string.format("没有ActivityTypeDef为%s任务", type))
return false
end
end
function this.SetActivityOpenStatus(type)
if this.mission[type] then
this.mission[type].reallyOpen = 1
else
Log(string.format("没有ActivityTypeDef为%s任务", type))
end
end
-- 红点检测监听方法
function this.CheckRedFunc(redType)
if redType == RedPointType.CourtesyDress_SevenDay then
if this.mission[ActivityTypeDef.EightDayGift] then
local number = 0
for i, v in pairs(this.sevenDayGetRewardState) do
if (v == 1) then
number = number + 1
end
end
local curDay = math.ceil((CalculateSecondsNowTo_N_OClock(0) + GetTimeStamp() - PlayerManager.userCreateTime)/86400)
if (number < curDay) then
return true
else
return false
end
else
return false
end
elseif redType == RedPointType.CourtesyDress_Chapter then
local isShowRed = false
for i = 1, table.nums(this.chapterGetRewardState) do
for j, v in pairs(this.chapterGiftData) do
if (i == v.Sort) then
if FightPointPassManager.GetFightStateById(v.Values[1][1]) == FIGHT_POINT_STATE.PASS and this.chapterGetRewardState[v.Id] == 0 then
isShowRed = true
return isShowRed
end
end
end
end
return isShowRed
elseif redType == RedPointType.CourtesyDress_Online then
local number = 0
for i, v in pairs(this.onlineGetRewardState) do
if (v == 1) then
number = number + 1
end
end
--当活动未开或奖励全部领取完毕
if ActTimeCtrlManager.SingleFuncState(FUNCTION_OPEN_TYPE.Online_Reward)==false then
return false
else--当活动开启或奖励未领取完毕
local timeNum = GetTimeStamp() - this.cuOnLineTimestamp
local currentTimeIndex = 0
for i = 1, #this.onlineData do
if this.onlineGetRewardState[this.onlineData[i].Id] == 0 then
if (math.floor(timeNum)) >= (this.onlineData[i].Values[1][1]*60) then
currentTimeIndex = this.onlineData[i].Sort
end
end
end
--Log("number < this.currentTimeIndex "..number .." "..currentTimeIndex)
if (number < currentTimeIndex) then --当已领取数小于未领取数
return true
else
return false
end
end
end
end
function this.RefreshActivityData(respond)
--closed
if respond.closeActivityId then
for i = 1, #respond.closeActivityId do
if this.mission[respond.closeActivityId[i]] then
Log("活动关闭 " .. respond.closeActivityId[i])
this.mission[respond.closeActivityId[i]] = nil
local activityType = this.GetActivityTypeFromId(respond.closeActivityId[i])
if activityType == ActivityTypeDef.SevenDayCarnival then
Game.GlobalEvent:DispatchEvent(GameEvent.Activity.OnCloseSevenDayGift)
SevenDayCarnivalManager.SetSevenDayScore(0)
TaskManager.ResetTaskData(TaskTypeDef.SevenDayCarnival)
elseif activityType == ActivityTypeDef.TreasureOfSomeBody then
TreasureOfSomebodyManagerV2.ResetActivityData()
TaskManager.ResetTaskData(TaskTypeDef.TreasureOfSomeBody)
elseif activityType == ActivityTypeDef.LuckyCat then
LuckyCatManager.isOpenLuckyCat = false
end
Game.GlobalEvent:DispatchEvent(GameEvent.Activity.OnActivityOpenOrClose, {
type = activityType,
status = 0 --关闭
})
if ActivityTypePanel[activityType] then
local openStatus = UIManager.IsOpen(ActivityTypePanel[activityType])
if openStatus then
UIManager.ClosePanel(ActivityTypePanel[activityType])
end
end
end
end
end
--newOpen
if respond.activityInfo then
for i = 1, #respond.activityInfo do
-- Log("活动开启 " .. respond.activityInfo[i].activityId)
this.mission[respond.activityInfo[i].activityId] = respond.activityInfo[i]
local activityType = this.GetActivityTypeFromId(respond.activityInfo[i].activityId)
if activityType == ActivityTypeDef.LuckyCat then --招财猫
LuckyCatManager.isOpenLuckyCat = true
LuckyCatManager.GetRewardProgress(respond.activityInfo[i].mission, respond.activityInfo[i].activityId, respond.activityInfo[i].value)
elseif activityType == ActivityTypeDef.TreasureOfSomeBody then --孙龙的宝藏
TreasureOfSomebodyManagerV2.SetCurrentLevel(0)
TreasureOfSomebodyManagerV2.SetTreasureLocalData()
--CheckRedPointStatus(RedPointType.TreasureOfSl)
end
Game.GlobalEvent:DispatchEvent(GameEvent.Activity.OnActivityOpenOrClose, {
type = this.GetActivityTypeFromId(respond.activityInfo[i].activityId),
status = 1 --开启
})
end
end
this.InitActivityServerData(respond, true)
this.RefreshActivityRedPoint()
end
function this.GetActivityTypeFromId(activityId)
local globalActConfig = ConfigManager.GetConfigDataByKey(ConfigName.GlobalActivity, "Id", activityId)
return globalActConfig.Type
end
function this.IsActivityTypeOpen(type)
local globalActConfigs = ConfigManager.TryGetAllConfigsDataByKey(ConfigName.GlobalActivity, "Type", type)
if not globalActConfigs or #globalActConfigs <= 0 then
LogError("未找到活动相关配置,类型:"..tostring(type))
return
end
local activityId = nil
table.walk(globalActConfigs, function(actConfigInfo)
if this.mission and this.mission[actConfigInfo.Id] then
activityId = actConfigInfo.Id
end
end)
return activityId
end
-------------------------------
--五点凌晨刷新
function this.FiveAMRefreshActivityProgress(msg)
--Log("5AM刷新活动数据")
for i = 1, #msg.activityInfo do
if not this.mission[msg.activityInfo[i].activityId] then
Game.GlobalEvent:DispatchEvent(GameEvent.Activity.OnActivityOpenOrClose, {
type = this.GetActivityTypeFromId(msg.activityInfo[i].activityId),
status = 1 --开启
})
end
-- 检测活动钱数
this.CheckMoneyProgress(msg.activityInfo[i])
--
this.mission[msg.activityInfo[i].activityId] = msg.activityInfo[i]
--Log("刷新活动数据activityId" .. msg.activityInfo[i].activityId .. "value" .. msg.activityInfo[i].value)
end
--重新赋值活动
for i, v in ipairs(msg.activityInfo) do
for n, m in ipairs(v.mission) do
--
if (v.activityId == ActivityTypeDef.OnlineGift) then
this.onlineOpen = true
this.onlineGetRewardState[m.missionId] = m.state
this.haveOnlineTime = m.progress
--Log("------------------------------------后端刷新在线时长1 "..m.progress.." "..TimeToHMS(m.progress))
this.onlineTime= m.progress
this.cuOnLineTimestamp = GetTimeStamp() - m.progress
--this.StartOnlineUpdate()
elseif (v.activityId == ActivityTypeDef.EightDayGift) then
this.sevenDayOpen = true
this.sevenDayGetRewardState[n] = m.state
this.canRewardDay = m.progress
elseif (v.activityId == ActivityTypeDef.ChapterAward) then
this.chapterOpen = true
this.chapterGetRewardState[m.missionId] = m.state
end
if GlobalActivity[v.activityId].Type == ActivityTypeDef.FifteenDayGift then
Game.GlobalEvent:DispatchEvent(GameEvent.EightDay.FifteenDayGift)
end
end
end
Game.GlobalEvent:DispatchEvent(GameEvent.Activity.GetRewardRefresh)
this.RefreshActivityRedPoint()
end
-- 检测进度
function this.CheckMoneyProgress(v)
local act = ConfigManager.TryGetConfigData(ConfigName.GlobalActivity, v.activityId)
if act then
local type = act.Type
if type == ActivityTypeDef.FirstRecharge
or type == ActivityTypeDef.LuckyCat
or type == ActivityTypeDef.DailyRecharge
-- or v.activityId == ActivityTypeDef.ContinuityRecharge
or type == ActivityTypeDef.AccumulativeRechargeExper
or type == ActivityTypeDef.DynamicAct_recharge then
-- or type == ActivityTypeDef.FindFairyCeremony
for n, m in ipairs(v.mission) do
m.progress = m.progress / 1000
end
v.value = v.value / 1000
end
end
end
function this.ChangeLingShouBaoGeSelectId(_activityId,_selectId)
if this.mission[_activityId] then
for i = 1, #this.mission[_activityId].mission do
if this.mission[_activityId].mission[i].missionId == 0 then
this.mission[_activityId].mission[i].progress = _selectId
break
end
end
end
end
--刷新某个活动的数据进度
function this.RefreshActivityProgressData(msg)
-- 检测
this.CheckMoneyProgress(msg.activityInfo)
if this.mission[msg.activityInfo.activityId] then
this.mission[msg.activityInfo.activityId].value = msg.activityInfo.value
for i = 1, #msg.activityInfo.mission do
--LogGreen("msg.activityInfo.activityId:"..msg.activityInfo.activityId.." msg.activityInfo.mission[i].missionId:"..msg.activityInfo.mission[i].missionId.." missionInfo.state:"..msg.activityInfo.mission[i].state.." missionInfo.progress:"..msg.activityInfo.mission[i].progress)
for _, missionInfo in pairs(this.mission[msg.activityInfo.activityId].mission) do
if missionInfo.missionId == msg.activityInfo.mission[i].missionId then
missionInfo.state = msg.activityInfo.mission[i].state
missionInfo.progress = msg.activityInfo.mission[i].progress
end
end
end
this.RefreshActivityRedPoint()
Game.GlobalEvent:DispatchEvent(GameEvent.Activity.OnActivityProgressStateChange)
--断线重连时 在线奖励活动 数据刷新
this.CutUpLineUpdateOnLineData(msg)
end
end
function this.RefreshActivityRedPoint()
Game.GlobalEvent:DispatchEvent(GameEvent.MissionDaily.OnMissionDailyChanged,false,false)
CheckRedPointStatus(RedPointType.FirstRecharge)
CheckRedPointStatus(RedPointType.ContinuityRecharge)
CheckRedPointStatus(RedPointType.SevenDayCarnival)
--限时活动
CheckRedPointStatus(RedPointType.Expert_AdventureExper)
CheckRedPointStatus(RedPointType.Expert_AreaExper)
CheckRedPointStatus(RedPointType.Expert_UpStarExper)
CheckRedPointStatus(RedPointType.Expert_EquipExper)
CheckRedPointStatus(RedPointType.Expert_GoldExper)
CheckRedPointStatus(RedPointType.Expert_FightExper)
CheckRedPointStatus(RedPointType.Expert_EnergyExper)
CheckRedPointStatus(RedPointType.Expert_Talisman)
CheckRedPointStatus(RedPointType.Expert_SoulPrint)
CheckRedPointStatus(RedPointType.Expert_AccumulativeRecharge)
CheckRedPointStatus(RedPointType.DynamicActRecharge)
CheckRedPointStatus(RedPointType.CourtesyDress_SevenDay)
CheckRedPointStatus(RedPointType.LuckyCat_GetReward)
CheckRedPointStatus(RedPointType.Expert_LuckyTurn)
CheckRedPointStatus(RedPointType.Expert_FindTreasure)
CheckRedPointStatus(RedPointType.Expert_Recruit)
CheckRedPointStatus(RedPointType.Expert_SecretBox)
CheckRedPointStatus(RedPointType.Expert_Expedition)
CheckRedPointStatus(RedPointType.Expert_Slhj)
CheckRedPointStatus(RedPointType.zhognzhichengcheng)
--战力排行
CheckRedPointStatus(RedPointType.WarPowerSort_Sort)
--东海寻仙
-- CheckRedPointStatus(RedPointType.FindFairy_OneView)
-- CheckRedPointStatus(RedPointType.FindFairy_ThreeView)
-- CheckRedPointStatus(RedPointType.FindFairy_FourView)
-- CheckRedPointStatus(RedPointType.DynamicActTask)
CheckRedPointStatus(RedPointType.QinglongSerectTreasure)
CheckRedPointStatus(RedPointType.chaofanrushengRed)
CheckRedPointStatus(RedPointType.UpStarGift)
CheckRedPointStatus(RedPointType.jijin128)
CheckRedPointStatus(RedPointType.jijin328)
CheckRedPointStatus(RedPointType.SupremeHero)
CheckRedPointStatus(RedPointType.recruitTreasure_one)
CheckRedPointStatus(RedPointType.recruitTreasure_two)
CheckRedPointStatus(RedPointType.recruitTreasure_three)
CheckRedPointStatus(RedPointType.yunmenghaoli)
CheckRedPointStatus(RedPointType.FestevalRed)
CheckRedPointStatus(RedPointType.chaozhifanli6)
CheckRedPointStatus(RedPointType.chaozhifanli30)
CheckRedPointStatus(RedPointType.chaozhifanli)
end
function this.GetContinuityRechargeRedPoint()
local redPoint = false
if this.IsActivityTypeOpen(ActivityTypeDef.ContinuityRecharge) then
local continuityRechargeList = this.GetActivityTypeInfo(ActivityTypeDef.ContinuityRecharge)
for i = 1, #continuityRechargeList.mission do
local rechargeInfo = continuityRechargeList.mission[i]
redPoint = redPoint or (rechargeInfo.progress == 1 and rechargeInfo.state == 0)
end
end
-- LogGreen("积天豪礼红点:"..tostring(redPoint))
return redPoint
end
function this.GetGrowthRechargeExist()
if this.IsGetAllGrowthReward() or this.IsActivityTypeOpen(ActivityTypeDef.GrowthReward) == nil then
return false
end
return true
end
function this.IsGetAllGrowthReward()
local isGetAll = true
if this.IsActivityTypeOpen(ActivityTypeDef.GrowthReward) then
local activityInfo = this.GetActivityTypeInfo(ActivityTypeDef.GrowthReward)
for i = 1, #activityInfo.mission do
isGetAll = isGetAll and activityInfo.mission[i].state == 1
end
end
return isGetAll
end
--检测限时活动红点
function this.ExpterActivityIsShowRedPoint(activeIndex)
local activeType = 0
----LogGreen("activeIndex "..activeIndex)
--注意 红点枚举id %100 就是按钮顺序
activeType = math.floor(activeIndex % 100)
----LogGreen("activeType "..activeType)
local expertRewardTabs = this.GetActivityTypeInfo(activeType)
if expertRewardTabs then
for i = 1, #expertRewardTabs.mission do
local conFigData = ConfigManager.GetConfigData(ConfigName.ActivityRewardConfig, expertRewardTabs.mission[i].missionId)
local value = 0
--限时累计活动特殊数值读取处理
if activeType == ActivityTypeDef.AccumulativeRechargeExper or activeType == ActivityTypeDef.zhongzhichengcheng then
value = conFigData.Values[1][1]
else
value = conFigData.Values[2][1]
end
if expertRewardTabs.mission[i].state == 0 then
if activeType == ActivityTypeDef.UpStarExper or activeType == ActivityTypeDef.Talisman
or activeType == ActivityTypeDef.SoulPrint or activeType == ActivityTypeDef.EquipExper
or activeType == ActivityTypeDef.FindTreasureExper or activeType == ActivityTypeDef.ExpeditionExper then
--进阶因为每个都不一样 特殊判断
if expertRewardTabs.mission[i].progress >= value then
--Log("expertRewardTabs.mission[i].progress " .. expertRewardTabs.mission[i].progress)
----LogGreen("限时红点 --------------- true")
return true
end
elseif activeType == ActivityTypeDef.UpLvAct then
if expertRewardTabs.value >= value and expertRewardTabs.mission[i].progress >= 0 then
----LogGreen("限时红点 --------------- true")
return true
end
elseif activeType == ActivityTypeDef.FastExplore then
if expertRewardTabs.value >= value then
----LogGreen("限时红点 --------------- true")
return true
end
elseif activeType == ActivityTypeDef.AccumulativeRechargeExper then
local id = ActivityGiftManager.IsActivityTypeOpen(ActivityTypeDef.AccumulativeRechargeExper)
if id and id > 0 then
local curActiveConfig = ConfigManager.TryGetConfigData(ConfigName.GlobalActivity,id)
if curActiveConfig and curActiveConfig.ShowArt == 1 then--1类型的活动是限时活动里的累计充值
if expertRewardTabs.value >= value then
----LogGreen("限时红点 --------------- true")
return true
end
end
end
elseif activeType == ActivityTypeDef.zhongzhichengcheng then
if MyGuildManager.GetMyGuildExploreNums() >= value then
----LogGreen("限时红点 --------------- true")
return true
end
else
if expertRewardTabs.value >= value then
----LogGreen("限时红点 --------------- true")
return true
end
end
end
end
end
----LogGreen("限时红点 --------------- false")
return false
end
--检测升级限时礼包活动红点
function this.ExperyUpLvActivityIsShowRedPoint()
local activeData = ActivityGiftManager.GetActivityTypeInfo(ActivityTypeDef.UpLvAct)
if activeData and activeData.mission then
for i = 1, #activeData.mission do
local curConfigData = ConfigManager.GetConfigData(ConfigName.ActivityRewardConfig,activeData.mission[i].missionId)
if curConfigData and activeData.mission[i].state == 0 and activeData.value >= curConfigData.Values[2][1] and activeData.mission[i].progress>0 then
----LogGreen("升级豪礼: true ")
return true
end
end
end
----LogGreen("升级豪礼: false ")
return false
end
--检测周卡活动红点
function this.WeedCardActivityIsShowRedPoint()
local weekCardData = OperatingManager.GetGiftGoodsInfo(GoodsTypeDef.WeekCard, 12)
if weekCardData then
----LogGreen("weekCardData.buyTimes "..weekCardData.buyTimes.." "..PatFaceManager.isFirstLog.." "..tostring(this.isOpenWeekCard))
if weekCardData.buyTimes <= 0 and PatFaceManager.isFirstLog == 0 and this.isOpenWeekCard == false then
----LogGreen("检测周卡活动红点 --------------- true")
return true
end
end
----LogGreen("检测周卡活动红点 --------------- false")
return false
end
--检测战力排行活动红点
function this.WarPowerSortActivityIsShowRedPoint()
-- local expertRewardTabs = this.GetActivityTypeInfo(ActivityTypeDef.WarPowerReach)
-- if expertRewardTabs then
-- for i = 1, #expertRewardTabs.mission do
-- local conFigData = ConfigManager.GetConfigData(ConfigName.ActivityRewardConfig, expertRewardTabs.mission[i].missionId)
-- local value = conFigData.Values[1][1]
-- if expertRewardTabs.mission[i].state == 0 then
-- if expertRewardTabs.value >= value then
-- --Log("红点红点 ")
-- return true
-- end
-- end
-- end
-- end
return false
end
--限时活动里是否有活动开启 > 0 说明有开启的活动
function this.GetExpertActiveisOpen()
--所有达人
for i, v in pairs(numExChange) do
local curActiveData = ActivityGiftManager.GetActivityTypeInfo(v)
if curActiveData then
if curActiveData.endTime - GetTimeStamp() > 0 then
return i
end
end
end
local LimitExchange = this.GetActivityTypeInfo(ActivityTypeDef.LimitExchange)
if LimitExchange then
if LimitExchange.endTime - GetTimeStamp() > 0 then
return ActivityTypeDef.LimitExchange
end
end
local weekCardData = OperatingManager.GetGiftGoodsInfo(GoodsTypeDef.WeekCard, 12)
if weekCardData then
if weekCardData.endTime - GetTimeStamp() > 0 then
return ExperType.WeekCard
end
end
-- local patFaceAllData = nil--{ConfigManager.GetConfigData(ConfigName.LoginPosterConfig,1)}--PatFaceManager.GetPatFaceAllDataTabs()
-- if RecruitManager.isTenRecruit == 0 then
-- patFaceAllData = { ConfigManager.GetConfigData(ConfigName.LoginPosterConfig, 1) }
-- end
-- if patFaceAllData and #patFaceAllData > 0 then
-- return ExperType.PatFace
-- end
--异妖直购
for i, v in ConfigPairs(ConfigManager.GetConfig(ConfigName.LoginPosterConfig)) do
if v.Type == 2 then
--异妖直购特殊处理
if v.OpenRules[1] == 1 then
if PlayerManager.level >= v.OpenRules[2] and PlayerManager.level <= v.CloseRules[2] then
local conFigData = ConfigManager.GetConfigData(ConfigName.RechargeCommodityConfig, v.ShopId)
local shopItemData = OperatingManager.GetGiftGoodsInfo(conFigData.Type, v.ShopId)
if shopItemData then
return ExperType.DiffMonster
end
end
end
end
end
--幸运探宝
--local curActiveData = not not ActivityGiftManager.IsActivityTypeOpen(ActivityTypeDef.LuckyTurnTable_One)
--if curActiveData then
-- return 6
--end
--福星高照
local curActiveData = not not ActivityGiftManager.IsActivityTypeOpen(ActivityTypeDef.LuckyCat)
if curActiveData then
return ExperType.LuckyCat
end
-- 七日
-- local curActiveData = not not ActivityGiftManager.IsActivityTypeOpen(ActivityTypeDef.EightDayGift)
-- if curActiveData then
-- return ExperType.SevenDay
-- end
--星级成长礼
if OperatingManager.IsHeroGiftActive() then
return ExperType.StarGrowGift
end
return 0
end
--判断七日,在线,章节是否全部领取完了
function this.ActivityIsHaveGetFinally(state)
local isGetAllReward = true
for i, v in pairs(state) do
if (v == 0) then
isGetAllReward = false
end
end
return isGetAllReward
end
-- 获取所有开启的显示活动ID
function this.GetExpertActiveisAllOpenIds()
local activityIds = {}
for i, v in pairs(numExChange) do
local curActiveData = ActivityGiftManager.GetActivityTypeInfo(v)
if curActiveData then
if curActiveData.endTime - GetTimeStamp() > 0 then
--Log("开启活动id ======== " .. curActiveData.activityId)
table.insert(activityIds,curActiveData.activityId)
end
end
end
local LimitExchange = this.GetActivityTypeInfo(ActivityTypeDef.LimitExchange)
if LimitExchange then
if LimitExchange.endTime - GetTimeStamp() > 0 then
table.insert(activityIds,LimitExchange.activityId)
end
end
local patFaceAllData = nil
if RecruitManager.isTenRecruit == 0 then
patFaceAllData = { ConfigManager.GetConfigData(ConfigName.LoginPosterConfig, 1) }
end
if patFaceAllData and #patFaceAllData > 0 then
table.insert(activityIds,ActivityTypeDef.PatFace)
end
--幸运探宝
local luckyTurnTable_One = 0
luckyTurnTable_One = ActivityGiftManager.IsActivityTypeOpen(ActivityTypeDef.LuckyTurnTable_One)
local upper_Two = ActivityGiftManager.IsActivityTypeOpen(ActivityTypeDef.LuckyTurnTable_Two)
if luckyTurnTable_One then
if luckyTurnTable_One > 0 then
table.insert(activityIds, luckyTurnTable_One)
end
end
if upper_Two then
if upper_Two > 0 then
table.insert(activityIds, upper_Two)
end
end
--福星高照
local luckyCat = 0
luckyCat = ActivityGiftManager.IsActivityTypeOpen(ActivityTypeDef.LuckyCat)
if luckyCat then
if luckyCat > 0 then
table.insert(activityIds, luckyCat)
end
end
-- 七日
local sevenDay = 0
sevenDay = ActivityGiftManager.IsActivityTypeOpen(ActivityTypeDef.EightDayGift)
if sevenDay then
if sevenDay > 0 then
table.insert(activityIds, sevenDay)
end
end
return activityIds
end
--断线重连时 在线奖励活动 数据刷新
function this.CutUpLineUpdateOnLineData(msg)
if (msg.activityInfo.activityId == ActivityTypeDef.OnlineGift) then
for i = 1, #msg.activityInfo.mission do
this.onlineOpen = true
this.onlineGetRewardState[ msg.activityInfo.mission[i].missionId] = msg.activityInfo.mission[i].state
this.haveOnlineTime = msg.activityInfo.mission[i].progress
this.onlineTime= msg.activityInfo.mission[i].progress
this.cuOnLineTimestamp = GetTimeStamp() - msg.activityInfo.mission[i].progress
--Log("------------------------------------后端刷新在线时长3 "..msg.activityInfo.mission[i].progress.." "..TimeToHMS(msg.activityInfo.mission[i].progress))
end
end
end
---关卡通关豪礼相关---
--根据当前关数 获取最近下一关卡橙色角色
function this.GetNextHeroInfo()
local allData={}
local heroData={}
--Log("当前通过关卡"..FightPointPassManager.lastPassFightId)
local startIndex=5001
local mainLevelEndId=ConfigManager.TryGetConfigDataByKey(ConfigName.MainLevelConfig,"NextLevel",-1).Id--最高关卡
local endIndex=this.GetConfigForValues(ConfigName.ActivityRewardConfig,mainLevelEndId).Id
--活动表处于开始结束索引之间的全部数据
for i = startIndex, endIndex do
local reward = ConfigManager.TryGetConfigData(ConfigName.ActivityRewardConfig,i)
if reward then
table.insert(allData, reward)
end
end
--输出ActivityRewardConfig里下一关的索引
local index
for i = 1, #allData do
if ConfigManager.GetConfigData(ConfigName.MainLevelConfig,FightPointPassManager.curOpenFight).SortId-1 < ConfigManager.GetConfigData(ConfigName.MainLevelConfig,allData[i].Values[1][1]).SortId then
index= this.GetConfigForValues(ConfigName.ActivityRewardConfig,allData[i].Values[1][1]).Id
break
end
end
--剩余数据
local residueData={}
for i = index, endIndex do
local reward = ConfigManager.TryGetConfigData(ConfigName.ActivityRewardConfig,i)
if reward then
table.insert(residueData, reward)
end
end
--剩余数据中将立绘数据存入
for i = 1, #residueData do
local itemData=ConfigManager.GetConfigData(ConfigName.ItemConfig,residueData[i].Reward[1][1])
if itemData.ItemType==1 and (itemData.Quantity==5 or itemData.Quantity==4)then --and allData[i].Reward[1][2]==1
table.insert(heroData,residueData[i])
end
end
if #heroData>0 then --如果有数据
return heroData[1].Reward[1][1],heroData[1].Values[1][1] --返回目标立绘id 关卡id
else
return #heroData,#heroData--如果没数据 返回0
end
end
--根据双重key的value锁定id value为2维数组目前没有这种接口
function this.GetConfigForValues(configName,pointId)
local data={}
for _, configInfo in ConfigPairs(ConfigManager.GetConfig(configName)) do
if configInfo.ActivityId == 3 and configInfo.Values[1][1] == pointId then
data = configInfo
break
end
end
return data
end
---------------------
--- 根据活动ID获取表格中相同活动ID第一项的数据
function this.GetActivityDataById(id)
for k, v in ConfigPairs(ActivityRewardConfig) do
if v and v.ActivityId == id then
return v
end
end
end
--剑影仙踪红点检测 差一个通关完毕 符合要求的红点检测 点击领取红点未检测
function this.CheckSupremeHeroRedPoint()
local act = ActivityGiftManager.IsActivityTypeOpen(ActivityTypeDef.SupremeHero)
if not act then
return
end
local actInfo = ActivityGiftManager.GetActivityInfoByType(act)
local isGetBigReward = true
if actInfo.activityId == 42 then
for k,v in ipairs(actInfo.mission) do
if v.state == 3 then
return true
end
if ActivityRewardConfig[v.missionId].Sort == 1 and v.state ~= 1 then
isGetBigReward = false
end
end
else
isGetBigReward = false
for k,v in ipairs(actInfo.mission) do
local config = ConfigManager.GetConfigData(ConfigName.ActivityRewardConfig,v.missionId)
if v.state == 0 and v.progress >= config.Values[1][1] and v.missionId ~= 4209 then
return true
end
end
end
return isGetBigReward
end
--获取活动结束时间
function this.GetTaskEndTime(activityType)
local activityInfo = ActivityGiftManager.GetActivityTypeInfo(activityType)
local endTime = 0
if activityInfo then
endTime = activityInfo.endTime
end
return endTime
end
--获取活动开始时间
function this.GetTaskStartTime(activityType)
local activityInfo = ActivityGiftManager.GetActivityTypeInfo(activityType)
local startTime = 0
if activityInfo then
startTime = activityInfo.startTime
end
return startTime
end
--获取活动剩余时间
function this.GetTaskRemainTime(activityType)
local remainTime = 0
remainTime =this.GetTaskEndTime(activityType)- GetTimeStamp()
return remainTime
end
----------------
-- 获取下一个每日奖励的时间
function this.GetNextOnlineRewardData()
for _, data in ipairs(this.onlineData) do
local state = this.onlineGetRewardState[data.Id]
if state ~= 1 then -- 如果不是已完成状态则返回数据
if state == 0 then
local curOnlineTime = GetTimeStamp() - ActivityGiftManager.cuOnLineTimestamp
local needTime = data.Values[1][1]*60
if curOnlineTime < needTime then
state = -1
end
end
return data, state
end
end
end
--达人获取id
function this.GetOpenExpertIdByActivityType(activityType)
local activityInfo = ActivityGiftManager.GetActivityTypeInfo(activityType)
if activityInfo then
return activityInfo.activityId
end
return 0
end
--------------------------------------------
--主动刷新 置本地数据
function this.RefreshAcitvityData(acitvityIds,fun)
NetManager.RefreshAcitvityData(acitvityIds,function (msg)
for i = 1, #msg.activityInfo do
if this.mission[msg.activityInfo[i].activityId] then
this.mission[msg.activityInfo[i].activityId].value = msg.activityInfo[i].value
for j = 1, #msg.activityInfo[i].mission do
for _, missionInfo in pairs(this.mission[msg.activityInfo[i].activityId].mission) do
if missionInfo.missionId == msg.activityInfo[i].mission[j].missionId then
missionInfo.state = msg.activityInfo[i].mission[j].state
missionInfo.progress = msg.activityInfo[i].mission[j].progress
------LogGreen("msg.activityInfo[i].mission[j] "..msg.activityInfo[i].mission[j].missionId.." "..msg.activityInfo[i].mission[j].progress)
end
end
end
end
end
if fun then fun() end
CheckRedPointStatus(RedPointType.Expert_UpLv)
end)
end
--获取活动已开启的时间
function this.GetCurrentDayNumber(type)
local DayActInfo = ActivityGiftManager.GetActivityTypeInfo(type)
local startTime = DayActInfo.startTime
local needDayNumber = math.ceil((GetTimeStamp() - startTime) / 86400)
return needDayNumber
end
--章节检测距离下次领奖还有几关
function this.GetRewardNeedLevel()
for i = 1, table.nums(this.chapterGetRewardState) do
for j, v in pairs(this.chapterGiftData) do
if (i == v.Sort) then
if FightPointPassManager.GetFightStateById(v.Values[1][1]) ~= FIGHT_POINT_STATE.PASS and this.chapterGetRewardState[v.Id] == 0 then
return this.mainLevelConfig[v.Values[1][1]].SortId - this.mainLevelConfig[FightPointPassManager.curOpenFight].SortId + 1
end
end
end
end
return 0
end
--开服福利排序
local OpenSeverWelfareSortTable = {
[0] = 1,
[1] = 0,
}
function this. OpenSeverWelfareRewardTabsSort(missions)
table.sort(missions,function(a,b)
if a.state == b.state then
return a.missionId < b.missionId
else
return OpenSeverWelfareSortTable[a.state] > OpenSeverWelfareSortTable[b.state]
end
end)
end
-- 玩家是否有资格开启
function this.IsQualifiled(type)
-- 相同类型活动解锁类型相同,所以只判断第一个
local data = ConfigManager.GetConfigDataByKey(ConfigName.GlobalActivity,"Type",type)
if not data then
return false
end
if data.IsOpen == 0 then
return false
end
-- 当前玩家等级
local qualifiled = false
local playerLv = PlayerManager.level
local openRule = data.OpenRules
if not data.OpenRules or #data.OpenRules < 2 then
return true
end
if openRule[1] == 1 then -- 关卡开启
qualifiled = FightPointPassManager.IsFightPointPass(openRule[2])
elseif openRule[1] == 2 then -- 等级开启
qualifiled = playerLv >= openRule[2]
elseif openRule[1] == 3 then -- 工坊等级开启
qualifiled = HarmonyManager.GetSingleAdditions(HarmonyAddType.AddLv) >= openRule[2]
end
return qualifiled
end
function this.GetTimeStartToEnd(type)
local info= ActivityGiftManager.GetActivityTypeInfo(type)
local startTime= this.GetTimeShow(info.startTime)
local endtime= this.GetTimeShow(info.endTime)
return startTime.."~"..endtime
end
function this.GetTimeStartToEnd1(type)
local info= ActivityGiftManager.GetActivityTypeInfo(type)
local startTime= this.GetTimeShow(info.startTime)
local endtime= this.GetTimeShow(info.endTime)
return startTime.."-"..endtime
end
---时间格式化接口
function this.GetTimeShow(data)
local year = math.floor(os.date("%Y", data))
local month = math.floor(os.date("%m", data))
local day = math.floor(os.date("%d", data))
local time = year .. "-" .. month .. "-" .. day
return time
end
-- 限时兑换红点显示逻辑
function this.IsExchangeRedShow()
if not this.isExchangeRedShow then
return false
end
local isOpen = ActivityGiftManager.IsActivityTypeOpen(ActivityTypeDef.LimitExchange)
if not isOpen then
return false
end
if GlobalActivity[isOpen].ShowArt ~= 1 then
return false
end
local LimitExchange = ActivityGiftManager.GetActivityTypeInfo(ActivityTypeDef.LimitExchange)
local exChangeConFig = ConfigManager.GetConfigDataByKey(ConfigName.ExchangeActivityConfig, "ActivityId", LimitExchange.activityId)
if BagManager.GetItemCountById(exChangeConFig.ActivityItem) > 0 then
return true
end
return false
end
function this.SetExchangeRedStatus(isShow)
this.isExchangeRedShow = isShow
end
function this.CheckYunYouManRedPoint()
local id = ActivityGiftManager.IsActivityTypeOpen(ActivityTypeDef.YunYouShangRen)
if id and id > 0 then
local str = PlayerPrefs.GetInt(PlayerManager.uid.."CommonActPage"..ActivityTypeDef.YunYouShangRen)
if str == 1 then
-- LogGreen("云游商人红点返回false")
return false
else
-- LogGreen("云游商人红点返回true")
return true
end
end
end
--超凡入圣红点检查
function this.CheckRedPointChaofanRuSheng()
if not ActivityGiftManager.IsActivityTypeOpen(ActivityTypeDef.ChaoFanRuSheng) then
return false
end
local data = ActivityGiftManager.GetActivityTypeInfo(ActivityTypeDef.ChaoFanRuSheng)
if data and data.mission and #data.mission > 0 then
for i = 1, #data.mission do
if data.mission[i].state == 1 then
return true
end
end
end
return false
end
--限时升星红点检查
function this.CheckRedPointUpStarGift()
if not ActivityGiftManager.IsActivityTypeOpen(ActivityTypeDef.UpStarGift) then
return false
end
local data = ActivityGiftManager.GetActivityTypeInfo(ActivityTypeDef.UpStarGift)
if data and data.mission and #data.mission > 0 then
if not data.value or data.value == 0 then
return true
end
for i = 1, #data.mission do
if data.mission[i].state == 1 then
return true
end
end
end
return false
end
--右侧伸缩条大小检测
function this.CheckRightUpArenaSize()
local num = 0
--首充检测
local act1 = ActivityGiftManager.IsActivityTypeOpen(ActivityTypeDef.FirstRecharge)
if act1 then
num = num + 1
end
--每日豪礼检测
local act2 = ActivityGiftManager.IsActivityTypeOpen(ActivityTypeDef.DailyRecharge)
if act2 then
num = num + 1
end
--限时折扣检测
local actGroup = ConfigManager.GetConfig(ConfigName.ActivityGroups)
local shopData = actGroup[13].ShopData
local giftList = OperatingManager.GetInfoList(shopData)
if #giftList > 0 then
local time = giftList[1].endTime - GetTimeStamp()
if time > 1 then
num = num + 1
end
end
local y = 0
if num == 1 then
y = 512
elseif num == 2 then
y = 663
elseif num == 3 then
y = 814
end
return y
end
--缥缈之旅开始
--初始化数据
function this.InitJourneyWithWindConFigData()
local acitvityConFig = this.GetActivityIdByType(ActivityTypeDef.JourneyWithWind)
if not acitvityConFig then return false end
JourneyWithWindAllDayConFigData = {}
JourneyWithWindDayAmount = {}
for key, configInfo in ConfigPairs(ConfigManager.GetConfig(ConfigName.ActivityRewardConfig)) do
if configInfo.ActivityId == acitvityConFig then
table.insert(JourneyWithWindAllDayConFigData,configInfo)
end
end
for key, configInfo in ConfigPairs(ConfigManager.GetConfig(ConfigName.JourneyWithWind)) do
if configInfo.ActivityId == acitvityConFig then
if JourneyWithWindDayAmount[configInfo.DayNum] then
JourneyWithWindDayAmount[configInfo.DayNum] = JourneyWithWindDayAmount[configInfo.DayNum] + 1
else
JourneyWithWindDayAmount[configInfo.DayNum] = 1
end
end
end
end
function this.GetJourneyWithWindAllDayConFigData()
return JourneyWithWindAllDayConFigData
end
function this.GetJourneyWithWindDayAmount()
return JourneyWithWindDayAmount
end
--判断当前奖励是否可领取
function this.SingleJourneyWithWindRewardNoGet(curRewardTaskData)
if curRewardTaskData then
local dayNumConFig = ConfigManager.GetConfigData(ConfigName.ActivityRewardConfig,curRewardTaskData.missionId)
local curServerDay = math.ceil((CalculateSecondsNowTo_N_OClock(0) + GetTimeStamp() - PlayerManager.userCreateTime)/86400)
-- LogYellow(curRewardTaskData.missionId .. " curRewardTaskData.state "..curRewardTaskData.state.." curRewardTaskData.progress "..curRewardTaskData.progress.." JourneyWithWindDayAmount[dayNumConFig.Values[1][2]] "..JourneyWithWindDayAmount[dayNumConFig.Values[1][2]])
if curRewardTaskData.state == 0 and dayNumConFig and curServerDay >= dayNumConFig.Values[1][2] and curRewardTaskData.progress >= JourneyWithWindDayAmount[dayNumConFig.Values[1][2]] then
return true
end
end
return false
end
--缥缈之旅红点检测
function this.JourneyWithWindAllRedPointState()
local idJourneyWithWind = ActivityGiftManager.IsActivityTypeOpen(ActivityTypeDef.JourneyWithWind)
if idJourneyWithWind and idJourneyWithWind > 0 then
local redpointstate = this.JourneyWithWindRewardNoGet()
if redpointstate then
return true
end
if this.JourneyWithWindCurDayNoOpen() then
return true
end
end
return false
end
--1完成任务未领奖
function this.JourneyWithWindRewardNoGet()
local activityData = ActivityGiftManager.GetActivityTypeInfo(ActivityTypeDef.JourneyWithWind)
local curJourneyWithWindAllDayConFigData = this.GetJourneyWithWindAllDayConFigData()
local config = {}
for i = 1, #curJourneyWithWindAllDayConFigData do
if activityData then
local curRewardTaskData--奖励后端数据
for j = 1, #activityData.mission do
if activityData.mission[j].missionId == curJourneyWithWindAllDayConFigData[i].Id then
curRewardTaskData = activityData.mission[j]
config = curJourneyWithWindAllDayConFigData[i]
end
end
if curRewardTaskData and this.SingleJourneyWithWindRewardNoGet(curRewardTaskData) then
return true,config
end
end
end
return false
end
--2开启从未打开过
--本地存储字符串
function this.SetJourneyWithWindPlayerPrefs(dayNum,val)
PlayerPrefs.SetString(PlayerManager.uid..PlayerManager.serverInfo.server_id.."JourneyWithWind"..dayNum, val)
end
--获得本地存储字符串
function this.GetJourneyWithWindPlayerPrefs(dayNum)
if dayNum then
return PlayerPrefs.GetString(PlayerManager.uid..PlayerManager.serverInfo.server_id.."JourneyWithWind"..dayNum, 0)
end
return 1
end
function this.JourneyWithWindCurDayNoOpen()
local curDay = math.ceil((CalculateSecondsNowTo_N_OClock(0) + GetTimeStamp() - PlayerManager.userCreateTime)/86400)
local curJourneyWithWindAllDayConFigData = this.GetJourneyWithWindAllDayConFigData()
for i = 1, #curJourneyWithWindAllDayConFigData do
if curDay >= curJourneyWithWindAllDayConFigData[i].Values[1][2] then
local curRedPointState = this.GetJourneyWithWindPlayerPrefs(curJourneyWithWindAllDayConFigData[i].Values[1][2])
if tonumber(curRedPointState) == 0 then
return true
end
end
end
return false
end
function this.CheckRedpointUpperMonthCard(red)
local actType
if red == RedPointType.jijin128 then
actType = 78
elseif red == RedPointType.jijin328 then
actType = 79
end
local actInfo = ActivityGiftManager.GetActivityInfoByType(actType)
if not actInfo then
return false
end
--LogGreen("actInfo.value:"..actInfo.value)
if actInfo.value ~= 2 then
return false
end
for i = 1,#actInfo.mission do
if actInfo.mission[i].state == 0 and actInfo.mission[i].progress == 1 then
return true
end
end
return false
end
--返回 false 有未完成的任务 true 全部完成
--indexType 页签 1至尊降世 2御剑 isHaveBigReward 是否检测大奖有没有领取
function this.CheckSupremeMission(indexType,isHaveBigReward)
local activityId = ActivityGiftManager.IsActivityTypeOpen(ActivityTypeDef.SupremeHero)
local actInfo = ActivityGiftManager.GetActivityInfoByType(activityId)
local isAllGet = true
if activityId == 42 then
if indexType == 3 then
return true
elseif indexType == 1 then
for k,v in ipairs(actInfo.mission) do
if ActivityRewardConfig[v.missionId].Sort == indexType then
if isHaveBigReward then
if v.state ~= 2 then
return false
end
else
if v.state ~= 1 or v.state ~= 2 then
return false
end
end
end
end
else
for k,v in ipairs(actInfo.mission) do
if isHaveBigReward then
if ActivityRewardConfig[v.missionId].Sort ~= 1 then
if v.state ~= 1 then
return false
end
end
else
if ActivityRewardConfig[v.missionId].Sort == 2 then
if v.state ~= 1 then
return false
end
end
end
end
end
else
for k,v in ipairs(actInfo.mission) do
if ActivityRewardConfig[v.missionId].Sort == indexType then
if v.state ~= 1 then
return false
end
end
end
end
return isAllGet
end
--新百宝商会红点检测
function this.TreasureStoreSeason2RedCheck()
if ActivityGiftManager.IsActivityTypeOpen(ActivityTypeDef.TreasureStoreSeason2) then
local data = CommonActPageManager.GetData(ActivityTypeDef.TreasureStoreSeason2)
for i = 1, #data.FreelyData do
for j = 1, #data.FreelyData[i] do
local data = data.FreelyData[i][j]
if data.progress == 1 and data.Price == 0 then
return true
end
end
end
end
return false
end
function this.FestevalRedCheck()
local actData = ActivityGiftManager.GetActivityTypeInfo(ActivityTypeDef.qiandaohaoli)
if not actData then
return false
end
local curDay = math.ceil((CalculateSecondsNowTo_N_OClock(0) + GetTimeStamp() - actData.startTime)/86400)
for i = 1, #actData.mission do
local config = ActivityRewardConfig[actData.mission[i].missionId]
if actData.mission[i].state == 0 and curDay >= config.Values[1][1] then
return true
end
end
return false
end
return this