2021-04-20 13:58:00 +08:00
|
|
|
|
ActivityGiftManager = {};
|
2020-05-09 13:31:21 +08:00
|
|
|
|
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
|
|
|
|
|
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--今天是否打开过周卡
|
2021-04-17 21:04:09 +08:00
|
|
|
|
this.mission = {}
|
2021-03-29 14:37:15 +08:00
|
|
|
|
|
|
|
|
|
-- 每次登录显示兑换红点
|
|
|
|
|
this.SetExchangeRedStatus(true)
|
|
|
|
|
|
2020-06-03 19:09:01 +08:00
|
|
|
|
Game.GlobalEvent:AddEvent(GameEvent.Player.OnLevelChange, function()
|
|
|
|
|
CheckRedPointStatus(RedPointType.Expert_UpLv)
|
|
|
|
|
end)
|
2020-05-09 13:31:21 +08:00
|
|
|
|
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
|
|
|
|
|
--获取七日礼包数据
|
2020-06-18 20:39:29 +08:00
|
|
|
|
if (v.ActivityId == ActivityTypeDef.EightDayGift) then
|
2020-05-09 13:31:21 +08:00
|
|
|
|
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)
|
2020-06-03 19:09:01 +08:00
|
|
|
|
table.sort(this.onlineData, function(a, b)
|
|
|
|
|
return a.Id < b.Id
|
|
|
|
|
end)
|
2020-05-09 13:31:21 +08:00
|
|
|
|
Game.GlobalEvent:DispatchEvent(GameEvent.Activity.GetRewardRefresh, this.onlineData)
|
2020-06-18 20:39:29 +08:00
|
|
|
|
elseif (type == ActivityTypeDef.EightDayGift) then
|
2020-05-09 13:31:21 +08:00
|
|
|
|
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
|
|
|
|
|
-- 获取服务器活动领取进度数据
|
2020-05-25 19:16:23 +08:00
|
|
|
|
function this.InitActivityServerData(msg, isUpdate)
|
|
|
|
|
if not isUpdate then
|
|
|
|
|
this.mission = {}
|
|
|
|
|
end
|
2020-05-09 13:31:21 +08:00
|
|
|
|
for i, v in ipairs(msg.activityInfo) do
|
2020-08-22 15:31:14 +08:00
|
|
|
|
|
|
|
|
|
this.CheckMoneyProgress(v)
|
2020-05-09 13:31:21 +08:00
|
|
|
|
this.mission[v.activityId] = v
|
2021-05-28 10:36:55 +08:00
|
|
|
|
LogYellow("刷新活动数据activityId:" .. v.activityId .. " value:" .. v.value)
|
2020-05-09 13:31:21 +08:00
|
|
|
|
for n, m in ipairs(v.mission) do
|
2021-05-28 10:36:55 +08:00
|
|
|
|
LogGreen(" 刷新活动数据missionId:" .. m.missionId .. " state:" .. m.state .. " progress:" .. m.progress)
|
2020-05-09 13:31:21 +08:00
|
|
|
|
if (v.activityId == ActivityTypeDef.OnlineGift) then
|
|
|
|
|
this.onlineOpen = true
|
|
|
|
|
this.onlineGetRewardState[m.missionId] = m.state
|
|
|
|
|
this.haveOnlineTime = m.progress
|
|
|
|
|
this.onlineTime= m.progress
|
2020-06-03 19:09:01 +08:00
|
|
|
|
--LogError("------------------------------------后端刷新在线时长2 "..m.progress.." "..TimeToHMS(m.progress))
|
2020-05-09 13:31:21 +08:00
|
|
|
|
this.cuOnLineTimestamp = GetTimeStamp() - m.progress
|
|
|
|
|
--this.StartOnlineUpdate()
|
2020-06-18 20:39:29 +08:00
|
|
|
|
elseif (v.activityId == ActivityTypeDef.EightDayGift) then
|
2020-05-09 13:31:21 +08:00
|
|
|
|
this.sevenDayOpen = true
|
|
|
|
|
this.sevenDayGetRewardState[n] = m.state
|
|
|
|
|
this.canRewardDay = m.progress
|
|
|
|
|
elseif (v.activityId == ActivityTypeDef.ChapterAward) then
|
|
|
|
|
this.chapterOpen = true
|
2020-06-28 17:48:49 +08:00
|
|
|
|
this.chapterGetRewardState[m.missionId] = m.state
|
2021-04-12 20:02:56 +08:00
|
|
|
|
end
|
|
|
|
|
if GlobalActivity[v.activityId].Type == ActivityTypeDef.FifteenDayGift then
|
2021-04-12 19:29:05 +08:00
|
|
|
|
Game.GlobalEvent:DispatchEvent(GameEvent.EightDay.FifteenDayGift)
|
2020-05-09 13:31:21 +08:00
|
|
|
|
end
|
|
|
|
|
end
|
2020-06-18 20:39:29 +08:00
|
|
|
|
if (v.activityId == ActivityTypeDef.EightDayGift) then
|
2020-05-09 13:31:21 +08:00
|
|
|
|
this.sevenDayTime = v.endTime - GetTimeStamp()
|
|
|
|
|
this.dayTime = GetTimeStamp() - v.startTime
|
|
|
|
|
end
|
2021-05-28 10:36:55 +08:00
|
|
|
|
if v.choiceRewardId then
|
|
|
|
|
this.choiceId=v.choiceRewardId
|
|
|
|
|
end
|
2020-05-09 13:31:21 +08:00
|
|
|
|
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
|
|
|
|
|
this.CheckActiveIsOpen(v)
|
|
|
|
|
end
|
|
|
|
|
TreasureOfSomebodyManagerV2.SetTreasureLocalData()
|
|
|
|
|
this.OnlineStartCountDown()
|
|
|
|
|
FindFairyManager.SetActivityData()
|
2021-03-29 14:37:15 +08:00
|
|
|
|
|
2020-05-09 13:31:21 +08:00
|
|
|
|
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.CheckActiveIsOpen(data)
|
|
|
|
|
local globalActivityData = GlobalActivity[data.activityId]
|
|
|
|
|
if globalActivityData then
|
|
|
|
|
if globalActivityData.Type == ActivityTypeDef.Pray then
|
|
|
|
|
--云梦活动开启 请求数据
|
|
|
|
|
NetManager.InitPrayDataRequest()
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
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
|
2020-07-08 16:19:46 +08:00
|
|
|
|
|
2020-08-19 10:05:01 +08:00
|
|
|
|
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
|
|
|
|
|
--LogError("actConfigInfo.Id "..actConfigInfo.Id)
|
|
|
|
|
id = actConfigInfo.Id
|
|
|
|
|
end
|
|
|
|
|
end)
|
|
|
|
|
return id
|
|
|
|
|
end
|
|
|
|
|
|
2020-07-08 16:19:46 +08:00
|
|
|
|
function this.GetActivityValueInfo(type, Id)
|
|
|
|
|
if this.mission[type] then
|
2020-07-14 11:34:40 +08:00
|
|
|
|
-- LogBlue("this.mission[type].value:"..this.mission[type].value)
|
2020-07-08 16:19:46 +08:00
|
|
|
|
return this.mission[type].value
|
|
|
|
|
end
|
|
|
|
|
end
|
2020-05-09 13:31:21 +08:00
|
|
|
|
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
|
2021-03-02 15:59:29 +08:00
|
|
|
|
Log(string.format("没有ActivityTypeDef为%s任务Id为%s的数据", type, Id))
|
2020-07-08 16:19:46 +08:00
|
|
|
|
return nil,0
|
2020-05-09 13:31:21 +08:00
|
|
|
|
end
|
|
|
|
|
end
|
2020-08-19 10:05:01 +08:00
|
|
|
|
|
|
|
|
|
function this.GetActivityInfoByType(type)
|
|
|
|
|
if this.mission[type] then
|
|
|
|
|
return this.mission[type]
|
|
|
|
|
end
|
|
|
|
|
end
|
2020-05-09 13:31:21 +08:00
|
|
|
|
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
|
2021-05-28 10:36:55 +08:00
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
function this.SetActivityInfoProgress(type, Id,state)
|
|
|
|
|
for _, missInfo in pairs(this.mission[type].mission) do
|
|
|
|
|
if missInfo.missionId == Id then
|
|
|
|
|
missInfo.state = state
|
|
|
|
|
break
|
|
|
|
|
end
|
2020-05-09 13:31:21 +08:00
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
function this.GetActivityOpenStatus(type)
|
2020-08-22 16:43:39 +08:00
|
|
|
|
local id = this.GetActivityIdByType(type)
|
|
|
|
|
if this.mission[id] then
|
|
|
|
|
return this.mission[id].reallyOpen == 1
|
2020-05-09 13:31:21 +08:00
|
|
|
|
else
|
2021-03-02 15:59:29 +08:00
|
|
|
|
-- Log(string.format("没有ActivityTypeDef为%s任务", type))
|
2020-05-09 13:31:21 +08:00
|
|
|
|
return false
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
function this.SetActivityOpenStatus(type)
|
|
|
|
|
if this.mission[type] then
|
|
|
|
|
this.mission[type].reallyOpen = 1
|
|
|
|
|
else
|
2021-03-02 15:59:29 +08:00
|
|
|
|
Log(string.format("没有ActivityTypeDef为%s任务", type))
|
2020-05-09 13:31:21 +08:00
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
-- 红点检测监听方法
|
|
|
|
|
function this.CheckRedFunc(redType)
|
|
|
|
|
if redType == RedPointType.CourtesyDress_SevenDay then
|
2020-06-18 20:39:29 +08:00
|
|
|
|
if this.mission[ActivityTypeDef.EightDayGift] then
|
2020-05-09 13:31:21 +08:00
|
|
|
|
local number = 0
|
|
|
|
|
for i, v in pairs(this.sevenDayGetRewardState) do
|
|
|
|
|
if (v == 1) then
|
|
|
|
|
number = number + 1
|
|
|
|
|
end
|
|
|
|
|
end
|
2021-01-04 14:27:18 +08:00
|
|
|
|
local curDay = math.ceil((CalculateSecondsNowTo_N_OClock(0) + GetTimeStamp() - PlayerManager.userCreateTime)/86400)
|
2020-06-23 18:36:24 +08:00
|
|
|
|
if (number < curDay) then
|
2020-05-09 13:31:21 +08:00
|
|
|
|
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
|
2021-03-02 15:59:29 +08:00
|
|
|
|
Log("活动关闭 " .. respond.closeActivityId[i])
|
2020-05-09 13:31:21 +08:00
|
|
|
|
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
|
2021-03-02 15:59:29 +08:00
|
|
|
|
Log("活动开启 " .. respond.activityInfo[i].activityId)
|
2020-05-09 13:31:21 +08:00
|
|
|
|
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
|
|
|
|
|
this.CheckActiveIsOpen(respond.activityInfo[i])
|
|
|
|
|
Game.GlobalEvent:DispatchEvent(GameEvent.Activity.OnActivityOpenOrClose, {
|
|
|
|
|
type = this.GetActivityTypeFromId(respond.activityInfo[i].activityId),
|
|
|
|
|
status = 1 --开启
|
|
|
|
|
})
|
|
|
|
|
end
|
|
|
|
|
end
|
2020-05-25 19:16:23 +08:00
|
|
|
|
this.InitActivityServerData(respond, true)
|
2020-05-09 13:31:21 +08:00
|
|
|
|
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.GetAllConfigsDataByKey(ConfigName.GlobalActivity, "Type", type)
|
|
|
|
|
local activityId = nil
|
|
|
|
|
table.walk(globalActConfigs, function(actConfigInfo)
|
2021-01-08 17:35:12 +08:00
|
|
|
|
if this.mission and this.mission[actConfigInfo.Id] then
|
|
|
|
|
activityId = actConfigInfo.Id
|
2020-05-09 13:31:21 +08:00
|
|
|
|
end
|
|
|
|
|
end)
|
|
|
|
|
return activityId
|
|
|
|
|
end
|
|
|
|
|
|
2020-06-28 17:48:49 +08:00
|
|
|
|
|
|
|
|
|
|
2020-05-09 13:31:21 +08:00
|
|
|
|
-------------------------------
|
|
|
|
|
--五点凌晨刷新
|
|
|
|
|
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
|
2020-08-22 15:31:14 +08:00
|
|
|
|
-- 检测活动钱数
|
|
|
|
|
this.CheckMoneyProgress(msg.activityInfo[i])
|
|
|
|
|
--
|
2020-05-09 13:31:21 +08:00
|
|
|
|
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
|
2020-08-22 15:31:14 +08:00
|
|
|
|
--
|
2020-05-09 13:31:21 +08:00
|
|
|
|
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()
|
2020-06-18 20:39:29 +08:00
|
|
|
|
elseif (v.activityId == ActivityTypeDef.EightDayGift) then
|
2020-05-09 13:31:21 +08:00
|
|
|
|
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
|
2021-04-12 20:02:56 +08:00
|
|
|
|
if GlobalActivity[v.activityId].Type == ActivityTypeDef.FifteenDayGift then
|
|
|
|
|
Game.GlobalEvent:DispatchEvent(GameEvent.EightDay.FifteenDayGift)
|
|
|
|
|
end
|
2020-05-09 13:31:21 +08:00
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
Game.GlobalEvent:DispatchEvent(GameEvent.Activity.GetRewardRefresh)
|
|
|
|
|
this.RefreshActivityRedPoint()
|
|
|
|
|
end
|
|
|
|
|
|
2020-08-22 15:31:14 +08:00
|
|
|
|
-- 检测进度
|
|
|
|
|
function this.CheckMoneyProgress(v)
|
2020-09-28 18:15:07 +08:00
|
|
|
|
local type = ConfigManager.GetConfigData(ConfigName.GlobalActivity,v.activityId).Type
|
|
|
|
|
if type == ActivityTypeDef.FirstRecharge
|
|
|
|
|
or type == ActivityTypeDef.LuckyCat
|
|
|
|
|
or type == ActivityTypeDef.DailyRecharge
|
2020-08-22 15:31:14 +08:00
|
|
|
|
-- or v.activityId == ActivityTypeDef.ContinuityRecharge
|
2020-09-28 18:15:07 +08:00
|
|
|
|
or type == ActivityTypeDef.AccumulativeRechargeExper
|
|
|
|
|
or type == ActivityTypeDef.DynamicAct_recharge
|
|
|
|
|
or type == ActivityTypeDef.FindFairyCeremony then
|
2020-08-22 15:31:14 +08:00
|
|
|
|
|
|
|
|
|
for n, m in ipairs(v.mission) do
|
|
|
|
|
m.progress = m.progress / 1000
|
|
|
|
|
end
|
2020-08-26 11:11:14 +08:00
|
|
|
|
v.value = v.value / 1000
|
2020-08-22 15:31:14 +08:00
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
2020-05-09 13:31:21 +08:00
|
|
|
|
--刷新某个活动的数据进度
|
|
|
|
|
function this.RefreshActivityProgressData(msg)
|
2020-08-22 15:31:14 +08:00
|
|
|
|
-- 检测
|
|
|
|
|
this.CheckMoneyProgress(msg.activityInfo)
|
2020-05-25 19:16:23 +08:00
|
|
|
|
--Log("刷新活动数据activityId:" .. msg.activityInfo.activityId .. "value:" .. msg.activityInfo.value)
|
2020-08-22 15:31:14 +08:00
|
|
|
|
|
2020-05-09 13:31:21 +08:00
|
|
|
|
if this.mission[msg.activityInfo.activityId] then
|
|
|
|
|
this.mission[msg.activityInfo.activityId].value = msg.activityInfo.value
|
|
|
|
|
for i = 1, #msg.activityInfo.mission do
|
|
|
|
|
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
|
2020-05-25 19:16:23 +08:00
|
|
|
|
--Log(msg.activityInfo.activityId.." 刷新活动数据missionId:" .. missionInfo.missionId .. "state:" .. missionInfo.state .. "progress:" .. missionInfo.progress)
|
2020-05-09 13:31:21 +08:00
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
this.RefreshActivityRedPoint()
|
|
|
|
|
Game.GlobalEvent:DispatchEvent(GameEvent.Activity.OnActivityProgressStateChange)
|
|
|
|
|
--断线重连时 在线奖励活动 数据刷新
|
|
|
|
|
this.CutUpLineUpdateOnLineData(msg)
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
function this.RefreshActivityRedPoint()
|
2021-02-25 12:04:31 +08:00
|
|
|
|
Game.GlobalEvent:DispatchEvent(GameEvent.MissionDaily.OnMissionDailyChanged,false,false)
|
2020-05-09 13:31:21 +08:00
|
|
|
|
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)
|
2020-09-28 18:15:07 +08:00
|
|
|
|
CheckRedPointStatus(RedPointType.DynamicActRecharge)
|
2020-05-09 13:31:21 +08:00
|
|
|
|
CheckRedPointStatus(RedPointType.CourtesyDress_SevenDay)
|
|
|
|
|
CheckRedPointStatus(RedPointType.LuckyCat_GetReward)
|
|
|
|
|
CheckRedPointStatus(RedPointType.Expert_LuckyTurn)
|
|
|
|
|
CheckRedPointStatus(RedPointType.Expert_FindTreasure)
|
|
|
|
|
CheckRedPointStatus(RedPointType.Expert_Recruit)
|
|
|
|
|
CheckRedPointStatus(RedPointType.Expert_SecretBox)
|
2020-09-23 15:49:48 +08:00
|
|
|
|
CheckRedPointStatus(RedPointType.Expert_Expedition)
|
2020-10-10 14:51:50 +08:00
|
|
|
|
CheckRedPointStatus(RedPointType.Expert_Slhj)
|
2020-05-09 13:31:21 +08:00
|
|
|
|
--战力排行
|
|
|
|
|
CheckRedPointStatus(RedPointType.WarPowerSort_Sort)
|
|
|
|
|
--东海寻仙
|
|
|
|
|
CheckRedPointStatus(RedPointType.FindFairy_OneView)
|
|
|
|
|
CheckRedPointStatus(RedPointType.FindFairy_ThreeView)
|
|
|
|
|
CheckRedPointStatus(RedPointType.FindFairy_FourView)
|
2020-09-28 18:15:07 +08:00
|
|
|
|
CheckRedPointStatus(RedPointType.DynamicActTask)
|
2020-08-20 17:36:19 +08:00
|
|
|
|
CheckRedPointStatus(RedPointType.QinglongSerectTreasure)
|
2020-05-09 13:31:21 +08:00
|
|
|
|
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
|
|
|
|
|
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
|
|
|
|
|
-- Log("activeIndex "..activeIndex)
|
|
|
|
|
--注意 红点枚举id %100 就是按钮顺序
|
|
|
|
|
activeType = numExChange[math.floor(activeIndex % 100)]
|
|
|
|
|
-- Log("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 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
|
2020-09-23 15:49:48 +08:00
|
|
|
|
or activeType == ActivityTypeDef.FindTreasureExper or activeType == ActivityTypeDef.ExpeditionExper then
|
2020-05-09 13:31:21 +08:00
|
|
|
|
--进阶因为每个都不一样 特殊判断
|
|
|
|
|
if expertRewardTabs.mission[i].progress >= value then
|
|
|
|
|
--Log("expertRewardTabs.mission[i].progress " .. expertRewardTabs.mission[i].progress)
|
|
|
|
|
--Log("限时红点 --------------- true")
|
|
|
|
|
return true
|
|
|
|
|
end
|
2020-06-03 19:09:01 +08:00
|
|
|
|
elseif activeType == ActivityTypeDef.UpLvAct then
|
|
|
|
|
if expertRewardTabs.value >= value and expertRewardTabs.mission[i].progress >= 0 then
|
|
|
|
|
return true
|
|
|
|
|
end
|
2020-08-22 20:46:06 +08:00
|
|
|
|
elseif activeType == ActivityTypeDef.FastExplore then
|
|
|
|
|
if expertRewardTabs.value >= value then
|
|
|
|
|
return true
|
|
|
|
|
end
|
2021-04-27 23:04:58 +08:00
|
|
|
|
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
|
|
|
|
|
return true
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|
2020-08-22 21:20:12 +08:00
|
|
|
|
else
|
2020-05-09 13:31:21 +08:00
|
|
|
|
if expertRewardTabs.value >= value then
|
|
|
|
|
--Log("限时红点 --------------- true")
|
|
|
|
|
return true
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
--Log("限时红点 --------------- 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)
|
2020-08-31 16:32:27 +08:00
|
|
|
|
if curConfigData and activeData.mission[i].state == 0 and activeData.value >= curConfigData.Values[2][1] and activeData.mission[i].progress>0 then
|
2020-05-09 13:31:21 +08:00
|
|
|
|
return true
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
return false
|
|
|
|
|
end
|
|
|
|
|
--检测周卡活动红点
|
|
|
|
|
function this.WeedCardActivityIsShowRedPoint()
|
|
|
|
|
local weekCardData = OperatingManager.GetGiftGoodsInfo(GoodsTypeDef.WeekCard, 12)
|
|
|
|
|
if weekCardData then
|
|
|
|
|
--Log("weekCardData.buyTimes "..weekCardData.buyTimes.." "..PatFaceManager.isFirstLog.." "..tostring(this.isOpenWeekCard))
|
|
|
|
|
if weekCardData.buyTimes <= 0 and PatFaceManager.isFirstLog == 0 and this.isOpenWeekCard == false then
|
|
|
|
|
--Log("检测周卡活动红点 --------------- true")
|
|
|
|
|
return true
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
--Log("检测周卡活动红点 --------------- false")
|
|
|
|
|
return false
|
|
|
|
|
end
|
|
|
|
|
--检测战力排行活动红点
|
|
|
|
|
function this.WarPowerSortActivityIsShowRedPoint()
|
2021-03-05 15:02:29 +08:00
|
|
|
|
-- 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
|
2020-05-09 13:31:21 +08:00
|
|
|
|
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
|
2021-01-15 22:11:38 +08:00
|
|
|
|
-- 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
|
2020-05-09 13:31:21 +08:00
|
|
|
|
--异妖直购
|
|
|
|
|
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
|
|
|
|
|
-- 七日
|
2021-01-15 22:11:38 +08:00
|
|
|
|
-- local curActiveData = not not ActivityGiftManager.IsActivityTypeOpen(ActivityTypeDef.EightDayGift)
|
|
|
|
|
-- if curActiveData then
|
|
|
|
|
-- return ExperType.SevenDay
|
|
|
|
|
-- end
|
2020-05-09 13:31:21 +08:00
|
|
|
|
--星级成长礼
|
|
|
|
|
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
|
2020-06-18 20:39:29 +08:00
|
|
|
|
sevenDay = ActivityGiftManager.IsActivityTypeOpen(ActivityTypeDef.EightDayGift)
|
2020-05-09 13:31:21 +08:00
|
|
|
|
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
|
2020-07-14 11:39:56 +08:00
|
|
|
|
local reward = ConfigManager.TryGetConfigData(ConfigName.ActivityRewardConfig,i)
|
|
|
|
|
if reward then
|
|
|
|
|
table.insert(allData, reward)
|
|
|
|
|
end
|
2020-05-09 13:31:21 +08:00
|
|
|
|
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
|
2020-07-14 11:39:56 +08:00
|
|
|
|
local reward = ConfigManager.TryGetConfigData(ConfigName.ActivityRewardConfig,i)
|
|
|
|
|
if reward then
|
|
|
|
|
table.insert(residueData, reward)
|
|
|
|
|
end
|
2020-05-09 13:31:21 +08:00
|
|
|
|
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.GetTaskData()
|
|
|
|
|
local taskList={}
|
|
|
|
|
local taskValue=0
|
|
|
|
|
|
|
|
|
|
local data= this.GetActivityTypeInfo(ActivityTypeDef.SupremeHero)
|
|
|
|
|
|
|
|
|
|
if not data then
|
|
|
|
|
return 0, taskList
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
table.sort(data.mission,function(a,b)
|
|
|
|
|
return a.missionId<b.missionId
|
|
|
|
|
end)
|
|
|
|
|
|
|
|
|
|
for i = 1, #data.mission do
|
|
|
|
|
table.insert(taskList,i, data.mission[i].state)
|
|
|
|
|
if data.mission[i].state >= 1 then
|
|
|
|
|
taskValue = taskValue + 1
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
return taskValue,taskList
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
--剑影仙踪红点检测 差一个通关完毕 符合要求的红点检测 点击领取红点未检测
|
|
|
|
|
function this.CheckSupremeHeroRedPoint()
|
|
|
|
|
if not ActivityGiftManager.IsActivityTypeOpen(ActivityTypeDef.SupremeHero) then
|
|
|
|
|
return
|
|
|
|
|
end
|
|
|
|
|
local isOpen
|
|
|
|
|
local num,list= this.GetTaskData()
|
|
|
|
|
|
|
|
|
|
local complete=0 --任务是否完成
|
|
|
|
|
local receive=0 --任务是否领取
|
|
|
|
|
for i = 1, #list do
|
|
|
|
|
if list[i]>0 then
|
|
|
|
|
complete=complete+1
|
|
|
|
|
end
|
|
|
|
|
if list[i]==2 then
|
|
|
|
|
receive=receive+1
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
if complete<3 then--任务未完成
|
|
|
|
|
isOpen=PatFaceManager.isFirstLog==0 and not this.isFirstForSupremeHero
|
|
|
|
|
else
|
|
|
|
|
isOpen=receive<3
|
|
|
|
|
end
|
|
|
|
|
|
2021-05-10 10:35:08 +08:00
|
|
|
|
--第三个任务红点检测
|
|
|
|
|
local state = false
|
|
|
|
|
local finishedNum, missionData = this.GetTaskData()
|
|
|
|
|
if missionData[3] == 3 then
|
|
|
|
|
state = true
|
|
|
|
|
end
|
|
|
|
|
return (isOpen or state)
|
2020-05-09 13:31:21 +08:00
|
|
|
|
end
|
|
|
|
|
|
2020-06-28 17:48:49 +08:00
|
|
|
|
--获取活动结束时间
|
2020-05-09 13:31:21 +08:00
|
|
|
|
function this.GetTaskEndTime(activityType)
|
|
|
|
|
local activityInfo = ActivityGiftManager.GetActivityTypeInfo(activityType)
|
|
|
|
|
local endTime = 0
|
|
|
|
|
if activityInfo then
|
|
|
|
|
endTime = activityInfo.endTime
|
|
|
|
|
end
|
|
|
|
|
return endTime
|
|
|
|
|
end
|
|
|
|
|
|
2020-06-28 17:48:49 +08:00
|
|
|
|
--获取活动开始时间
|
|
|
|
|
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)- this.GetTaskEndTime(activityType)
|
|
|
|
|
return remainTime
|
|
|
|
|
end
|
|
|
|
|
|
2020-05-09 13:31:21 +08:00
|
|
|
|
function this.GetRewardState()
|
|
|
|
|
local taskValue,missionData= this.GetTaskData()
|
|
|
|
|
local doneNum = 0
|
|
|
|
|
for i = 1, 3 do
|
|
|
|
|
if missionData[i] == 2 then
|
|
|
|
|
doneNum = doneNum + 1
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
local state = doneNum == 3 and 3 or 2
|
|
|
|
|
return state
|
|
|
|
|
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
|
|
|
|
|
--LogError("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
|
|
|
|
|
|
2020-05-15 16:52:35 +08:00
|
|
|
|
--获取活动已开启的时间
|
|
|
|
|
function this.GetCurrentDayNumber(type)
|
|
|
|
|
local DayActInfo = ActivityGiftManager.GetActivityTypeInfo(type)
|
|
|
|
|
local startTime = DayActInfo.startTime
|
|
|
|
|
local needDayNumber = math.ceil((GetTimeStamp() - startTime) / 86400)
|
|
|
|
|
return needDayNumber
|
|
|
|
|
end
|
2020-05-09 13:31:21 +08:00
|
|
|
|
|
2020-06-03 19:09:01 +08:00
|
|
|
|
--章节检测距离下次领奖还有几关
|
|
|
|
|
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
|
2020-06-08 13:57:30 +08:00
|
|
|
|
--开服福利排序
|
|
|
|
|
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
|
2020-06-28 17:48:49 +08:00
|
|
|
|
|
2020-09-22 11:58:49 +08:00
|
|
|
|
-- 玩家是否有资格开启
|
|
|
|
|
function this.IsQualifiled(type)
|
|
|
|
|
-- 相同类型活动解锁类型相同,所以只判断第一个
|
|
|
|
|
local data = ConfigManager.GetConfigDataByKey(ConfigName.GlobalActivity,"Type",type)
|
2020-11-19 14:26:57 +08:00
|
|
|
|
if not data then
|
|
|
|
|
return false
|
|
|
|
|
end
|
2021-03-17 12:02:32 +08:00
|
|
|
|
if data.IsOpen == 0 then
|
|
|
|
|
return false
|
|
|
|
|
end
|
2020-09-22 11:58:49 +08:00
|
|
|
|
-- 当前玩家等级
|
|
|
|
|
local qualifiled = false
|
|
|
|
|
local playerLv = PlayerManager.level
|
|
|
|
|
local openRule = data.OpenRules
|
2020-11-19 14:26:57 +08:00
|
|
|
|
if not data.OpenRules or #data.OpenRules < 2 then
|
|
|
|
|
return true
|
|
|
|
|
end
|
2020-09-22 11:58:49 +08:00
|
|
|
|
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 = WorkShopManager.WorkShopData.lv >= openRule[2]
|
|
|
|
|
end
|
|
|
|
|
return qualifiled
|
|
|
|
|
end
|
2020-06-28 17:48:49 +08:00
|
|
|
|
|
|
|
|
|
function this.GetTimeStartToEnd(type)
|
|
|
|
|
local info= ActivityGiftManager.GetActivityTypeInfo(type)
|
2020-07-08 16:19:46 +08:00
|
|
|
|
local startTime= this.GetTimeShow(info.startTime)
|
|
|
|
|
local endtime= this.GetTimeShow(info.endTime)
|
|
|
|
|
return startTime.."~"..endtime
|
2020-06-28 17:48:49 +08:00
|
|
|
|
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
|
|
|
|
|
|
2021-03-29 14:37:15 +08:00
|
|
|
|
-- 限时兑换红点显示逻辑
|
|
|
|
|
function this.IsExchangeRedShow()
|
|
|
|
|
if not this.isExchangeRedShow then
|
|
|
|
|
return false
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
local isOpen = ActivityGiftManager.IsActivityTypeOpen(ActivityTypeDef.LimitExchange)
|
2021-03-29 14:54:13 +08:00
|
|
|
|
if not isOpen then
|
2021-03-29 14:37:15 +08:00
|
|
|
|
return false
|
|
|
|
|
end
|
2021-04-02 10:45:11 +08:00
|
|
|
|
if GlobalActivity[isOpen].ShowArt ~= 1 then
|
|
|
|
|
return false
|
|
|
|
|
end
|
2021-03-29 14:37:15 +08:00
|
|
|
|
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
|
|
|
|
|
|
2021-04-22 10:59:32 +08:00
|
|
|
|
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
|
2021-04-29 17:42:35 +08:00
|
|
|
|
Log("云游商人红点返回:false")
|
2021-04-22 10:59:32 +08:00
|
|
|
|
return false
|
|
|
|
|
else
|
2021-04-29 17:42:35 +08:00
|
|
|
|
Log("云游商人红点返回:true")
|
2021-04-22 10:59:32 +08:00
|
|
|
|
return true
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|
2020-06-23 18:36:24 +08:00
|
|
|
|
return this
|