Files
Main/Assets/GameAssets/Resources/Lua/Logic/DailyActivity/DailyActivitySystem.lua
2025-01-25 04:38:09 +08:00

730 lines
24 KiB
Lua

------------------------------------------------
-- 作者: _SqL_
-- 日期: 2019-04-23
-- 文件: DailyActivitySystem.lua
-- 模块: DailyActivitySystem
-- 描述: 日常系统
------------------------------------------------
local DailyActivityData = require "Logic.DailyActivity.DailyActivityData"
local ServerMatchInfo = require "Logic.DailyActivity.ServerMatchInfo"
local RedPointCustomCondition = CS.Thousandto.Code.Logic.RedPointCustomCondition;
local DailyActivitySystem = {
-- 当前获取的活跃值 所有活动的获取的叠加
CurrActive = 0,
-- 可获取的最大活跃值 所有活动的叠加
MaxActive = 0,
-- 活跃宝箱的数量
GiftCount = 0,
-- 使用活跃宝箱的数量
UseItemCount = 0,
-- 已增加的活跃度
AddActive = 0,
-- 已领取过的宝箱ID
ReceiveGiftIDList = List:New(),
-- 日常活动
DailyActivitylist = List:New(),
-- 限时活动
LimitActivityList = List:New(),
-- 跨服活动
CrossServerActivityList = List:New(),
-- 所有活动
AllActivityIdList = List:New(),
-- 打开推送的活动
OpenPushActivityList = List:New(),
-- 活动准备时间
ReadyTimeContainer = Dictionary:New(),
-- 服务器阶级信息
ServerMatchInfoLvDic = Dictionary:New(),
-- 所有活动
AllActivityDic = Dictionary:New(),
-- 是否参与了周常Vip
IsJoinWeekVip = false,
-- 日常功能所有活动的等级表
ActivityLevelDic = nil,
--自动进入的日常id
AutoEnterDailyId = nil,
--自动进入的日常参数
AutoEnterDailyParam = nil,
--地图对应的日常id
MapOwnerDaily = nil,
}
function DailyActivitySystem:Initialize()
GameCenter.RegFixEventHandle(LogicEventDefine.EVENT_COIN_CHANGE_UPDATE, self.CoinChange, self)
GameCenter.RegFixEventHandle(LogicEventDefine.EID_EVENT_FIRSTENTERMAP, self.OnFirstEnterMap, self)
GameCenter.RegFixEventHandle(LogicEventDefine.EID_EVENT_PLAYER_LEVEL_CHANGED, self.OnLevelChanged, self)
self.MapOwnerDaily = Dictionary:New()
DataConfig.DataDaily:Foreach(function(k, v)
if v.IfOpen ~= 0 then
local _cloneIds = Utils.SplitNumber(v.CloneID, '_')
for i = 1, #_cloneIds do
local _dcCfg = DataConfig.DataCloneMap[_cloneIds[i]]
if _dcCfg ~= nil then
self.MapOwnerDaily[_dcCfg.Mapid] = k
end
end
end
end)
end
function DailyActivitySystem:UnInitialize()
self.IsJoinWeekVip = false;
self.ReceiveGiftIDList:Clear()
self.DailyActivitylist:Clear()
self.LimitActivityList:Clear()
self.CrossServerActivityList:Clear()
self.OpenPushActivityList:Clear()
self.ReadyTimeContainer:Clear()
self.ServerMatchInfoLvDic:Clear()
GameCenter.UnRegFixEventHandle(LogicEventDefine.EVENT_COIN_CHANGE_UPDATE, self.CoinChange, self)
GameCenter.UnRegFixEventHandle(LogicEventDefine.EID_EVENT_FIRSTENTERMAP, self.OnFirstEnterMap, self)
GameCenter.UnRegFixEventHandle(LogicEventDefine.EID_EVENT_PLAYER_LEVEL_CHANGED, self.OnLevelChanged, self)
end
--进入场景处理
function DailyActivitySystem:OnEnterScene()
if self.AutoEnterDailyId ~= nil then
self:ReqJoinActivity(self.AutoEnterDailyId, self.AutoEnterDailyParam)
end
self.AutoEnterDailyId = nil
self.AutoEnterDailyParam = nil
end
function DailyActivitySystem:Update(dt)
if self.ReadyTimeContainer:Count() > 0 then
for k, v in pairs(self.ReadyTimeContainer) do
if v > 0 then
self.ReadyTimeContainer[k] = v - dt
else
self.ReadyTimeContainer:Remove(k)
end
end
end
end
function DailyActivitySystem:GetActivityInfo(id)
if not self.AllActivityIdList:Contains(id) then
return nil
end
for i = 1, self.DailyActivitylist:Count() do
if self.DailyActivitylist[i].ID == id then
return self.DailyActivitylist[i]
end
end
for i = 1, self.LimitActivityList:Count() do
if self.LimitActivityList[i].ID == id then
return self.LimitActivityList[i]
end
end
return nil
end
function DailyActivitySystem:CheckDailyListContains(id)
for i = 1, #self.DailyActivitylist do
if self.DailyActivitylist[i].ID == id then
return true
end
end
return false
end
function DailyActivitySystem:CheckLimitListContains(id)
for i = 1, #self.LimitActivityList do
if self.LimitActivityList[i].ID == id then
return true
end
end
return false
end
function DailyActivitySystem:SortActivityList(noSortLimit)
if not noSortLimit then
table.sort(self.LimitActivityList, function(a, b)
if a.ShowSort == b.ShowSort then
return a.Sort < b.Sort
else
return a.ShowSort < b.ShowSort
end
end)
end
table.sort(self.DailyActivitylist, function(a, b)
if a.ShowSort == b.ShowSort then
return a.Sort < b.Sort
else
return a.ShowSort < b.ShowSort
end
end)
end
-- 寻路
function DailyActivitySystem:Navigate(npcID)
local _p = GameCenter.GameSceneSystem:GetLocalPlayer()
if _p ~= nil then
local _strs = Utils.SplitStr(npcID, ";")
for i = 1, _strs:Count() do
local _npcID = Utils.SplitStr(_strs[i])[3]
if _npcID then
GameCenter.PathSearchSystem:SearchPathToNpcTalk(_npcID)
end
end
end
end
-- 获取活动开启时间
function DailyActivitySystem:GetActivityOpenTime(id)
local _cfg = DataConfig.DataDaily[id]
if not _cfg then
return ""
end
-- 周活动
if tonumber(_cfg.OpenTime) ~= 0 and _cfg.SpecialOpen ~= Time.GetOpenSeverDay() then
return _cfg.OpenTimeDes
else
local _timeStr = Utils.SplitStrBySeps(_cfg.Time, {';', '_'})
local _t = Time.GetNowTable();
local _hour = _t.hour;
local _minute = _t.min;
for i = 1, #_timeStr do
local _startHour = math.floor(_timeStr[i][1] // 60)
local _stattMinute = math.floor(_timeStr[i][1] % 60)
if _startHour > _hour then
return UIUtils.CSFormat(DataConfig.DataMessageString.Get("DailyActivtyOpenTips"), _startHour,
_stattMinute)
elseif _startHour == _hour and _stattMinute > _minute then
return UIUtils.CSFormat(DataConfig.DataMessageString.Get("DailyActivtyOpenTips"), _startHour,
_stattMinute)
end
end
if id == 2 then
return DataConfig.DataMessageString.Get("ActiveValueNotEnough")
end
if tonumber(_cfg.OpenTime) ~= 0 and _cfg.SpecialOpen == Time.GetOpenSeverDay() then
return _cfg.OpenTimeDes
else
return DataConfig.DataMessageString.Get("TomorrowOpen")
end
end
end
-- 获取准备时间
function DailyActivitySystem:GetActivityReadyTime(id)
if self.ReadyTimeContainer:ContainsKey(id) then
return self.ReadyTimeContainer[id]
end
return 0
end
-- 货币改变
function DailyActivitySystem:CoinChange(obj, sender)
if obj > 0 and obj == ItemTypeCode.ActivePoint then
for i = 1, #self.DailyActivitylist do
if self.DailyActivitylist[i].ID == 2 then
local _active = GameCenter.ItemContianerSystem:GetEconomyWithType(ItemTypeCode.ActivePoint)
self.DailyActivitylist[i].IsOpen = _active > 0
break
end
end
self:SortActivityList(true)
GameCenter.PushFixEvent(LogicEventDefine.EID_EVENT_REFRESH_DAILYPANEL)
end
end
-- 获取当前这个活动的结束时间,如果当前活动没有打开返回空
function DailyActivitySystem:DailyIsShowRedPoint()
local _showRed = false
for i = 1, #self.DailyActivitylist do
local _d = self.DailyActivitylist[i]
if _d.IsOpen and _d.Open and _d.RemindCount ~= 0 then
_showRed = true
break
end
end
return _showRed
end
-- 显示活动是否显示红点
function DailyActivitySystem:LimitIsShowRedPoint()
local _showRed = false
for i = 1, #self.LimitActivityList do
local _d = self.LimitActivityList[i]
if _d.IsOpen and _d.Open and _d.RemindCount ~= 0 then
_showRed = true
break
end
end
return _showRed
end
-- 获取某个限时活动是否有红点
function DailyActivitySystem:GetLimitActiveRedByID(id)
local _showRed = false
for i = 1, #self.LimitActivityList do
local _d = self.LimitActivityList[i]
if _d.ID == id then
if _d.IsOpen and _d.Open then
_showRed = true
end
break
end
end
return _showRed
end
-- 活跃奖励是否显示红点
function DailyActivitySystem:ActiveIsShowRedPoint()
local _showRed = false
DataConfig.DataDailyReward:Foreach(function(k, v)
if not self.ReceiveGiftIDList:Contains(k) and v.QNeedintegral <= self.CurrActive then
_showRed = true
end
end)
return _showRed
end
-- 活跃度红点检测
function DailyActivitySystem:ActiveRedPointCheck()
GameCenter.RedPointSystem:RemoveFuncCondition(FunctionStartIdCode.DailyActivity, 3)
local _activeRed = self:ActiveIsShowRedPoint()
if _activeRed then
local _conditions3 = List:New()
_conditions3:Add(RedPointCustomCondition(true))
GameCenter.RedPointSystem:LuaAddFuncCondition(FunctionStartIdCode.DailyActivity, 3, _conditions3)
end
end
-- 红点检测
function DailyActivitySystem:CheckIsShowRedPoint()
GameCenter.MainFunctionSystem:SetAlertFlag(FunctionStartIdCode.DailyActivity, self:DailyIsShowRedPoint())
GameCenter.MainFunctionSystem:SetAlertFlag(FunctionStartIdCode.LimitActivity, self:LimitIsShowRedPoint())
self:ActiveRedPointCheck()
end
-- 参加活动
function DailyActivitySystem:JoinActivity(id)
local _cfg = DataConfig.DataDaily[id]
if not _cfg then
return
end
if id == 18 then
self.IsJoinWeekVip = true;
end
-- BI埋点
if id == 1 then
GameCenter.BISystem:ReqClickEvent(BiIdCode.WYJDailyEnter);
elseif id == 2 then
GameCenter.BISystem:ReqClickEvent(BiIdCode.ZMCDDailyEnter);
elseif id == 4 then
GameCenter.BISystem:ReqClickEvent(BiIdCode.WJXYDailyEnter);
elseif id == 5 then
GameCenter.BISystem:ReqClickEvent(BiIdCode.ArenaDailyEnter);
elseif id == 6 then
GameCenter.BISystem:ReqClickEvent(BiIdCode.TJZMDailyEnter);
elseif id == 7 then
-- GameCenter.BISystem:ReqClickEvent(BiIdCode.DNYFDailyEnter);
elseif id == 8 then
GameCenter.BISystem:ReqClickEvent(BiIdCode.LYYTDailyEnter);
elseif id == 9 then
GameCenter.BISystem:ReqClickEvent(BiIdCode.XMHJDailyEnter);
elseif id == 10 then
GameCenter.BISystem:ReqClickEvent(BiIdCode.SLTDailyEnter);
elseif id == 17 then
GameCenter.BISystem:ReqClickEvent(BiIdCode.XMTaskDailyEnter);
elseif id == 207 then
GameCenter.BISystem:ReqClickEvent(BiIdCode.FDBossDailyEnter);
elseif id == 11 then
GameCenter.BISystem:ReqClickEvent(BiIdCode.JJSYDailyEnter);
elseif id == 14 then
GameCenter.BISystem:ReqClickEvent(BiIdCode.NSFYDailyEnter);
elseif id == 109 then
GameCenter.BISystem:ReqClickEvent(BiIdCode.HDMJDailyEnter);
elseif id == 102 then
GameCenter.BISystem:ReqClickEvent(BiIdCode.TMGCEnter);
elseif id == 103 then
GameCenter.BISystem:ReqClickEvent(BiIdCode.TDMJEnter);
end
if _cfg.OpenType == 1 then
local _uiCfg = Utils.SplitStr(_cfg.OpenUI, "_")
if #_uiCfg == 1 then
GameCenter.MainFunctionSystem:DoFunctionCallBack(tonumber(_uiCfg[1]), id)
elseif #_uiCfg == 2 then
GameCenter.MainFunctionSystem:DoFunctionCallBack(tonumber(_uiCfg[1]), tonumber(_uiCfg[2]))
end
elseif _cfg.OpenType == 2 then
if _cfg.NpcID then
self:Navigate(_cfg.NpcID)
end
elseif _cfg.OpenType == 3 then
self:ReqJoinActivity(_cfg.Id)
elseif _cfg.OpenType == 4 then
GameCenter.BossSystem:EnterSuitBossCopy();
elseif _cfg.OpenType == 5 then
local _task = GameCenter.LuaTaskManager:GetDailyTask()
if _task == nil then
GameCenter.MainFunctionSystem:DoFunctionCallBack(FunctionStartIdCode.TaskDaily)
else
if _task.Data.IsAccess then
GameCenter.MainFunctionSystem:DoFunctionCallBack(FunctionStartIdCode.TaskDaily)
else
local _uiCfg = Utils.SplitNumber(_cfg.OpenUI, "_")
GameCenter.TaskController:RunDaiyTask(_uiCfg[1], false, true);
GameCenter.PushFixEvent(UIEventDefine.UIDailyActivityForm_CLOSE)
end
end
end
end
-- 更新活动信息
function DailyActivitySystem:UpdateActivityInfo(list, info)
for i = 1, #list do
if list[i].ID == info.activeId then
list[i]:UpdateInfo(info)
end
end
end
-- 请求打开日常界面
function DailyActivitySystem:ReqActivePanel()
GameCenter.Network.Send("MSG_Dailyactive.ReqDailyActivePanel", {})
end
-- 领取活跃宝箱
function DailyActivitySystem:ReqGetActiveReward(giftID)
local _req = {}
_req.id = giftID
GameCenter.Network.Send("MSG_Dailyactive.ReqGetActiveReward", _req)
end
-- 请求打开推送的活动
function DailyActivitySystem:ReqDailyPushIds(idList)
local _req = {}
local _temp = {}
if idList ~= nil and idList:Count() > 1 then
for i = 1, idList:Count() do
table.insert(_temp, idList[i])
end
end
_req.activeIdList = _temp
GameCenter.Network.Send("MSG_Dailyactive.ReqDailyPushIds", _req)
end
--日常间是否可以互相跳
function DailyActivitySystem:CanEnterEachOther(dailyId)
if dailyId == 4 then --无极墟域
return true
elseif dailyId == 20 then --无限层
return true
elseif dailyId == 12 then --晶甲和域
return true
elseif dailyId == 19 then --精英狩猎
return true
elseif dailyId == 20 then --无限首领
return true
elseif dailyId == 207 then --仙盟福地
return true
elseif dailyId == 101 then --vip首领
return true
end
return false
end
--不同日常之间是否可以互相跳
function DailyActivitySystem:CanEnterOtherDaily(curDailyId, dailyId)
if curDailyId == 101 and dailyId == 20 then
return false
end
if (curDailyId == 4 or curDailyId == 101 or curDailyId == 20) and
(dailyId == 4 or dailyId == 101 or dailyId == 20) then
return true
end
return false
end
-- 参加活动 (目前仅限副本)
function DailyActivitySystem:ReqJoinActivity(id, param)
local _mapCfg = GameCenter.MapLogicSystem.MapCfg
if _mapCfg == nil then
return
end
local _dailyCfg = DataConfig.DataDaily[id]
if _dailyCfg == nil then
return
end
local _curMapId = _mapCfg.MapId
local _cloneCfg = DataConfig.DataCloneMap[param]
if _cloneCfg ~= nil and _curMapId == _cloneCfg.Mapid then
--正在当前副本地图中
Utils.ShowPromptByEnum("C_ALREADY_COPYMAP", _dailyCfg.Name)
return
else
local _inSameDaily = false
local _cloneIds = Utils.SplitNumber(_dailyCfg.CloneID, '_')
for i = 1, #_cloneIds do
local _dcCfg = DataConfig.DataCloneMap[_cloneIds[i]]
if _dcCfg ~= nil then
if _dcCfg.Mapid == _curMapId then
--正在当前副本地图中
_inSameDaily = true
break
end
else
Debug.LogError("当前副本ID = ".._cloneIds[i].."不存在")
end
end
if _inSameDaily then
if self:CanEnterEachOther(id) then
--发送进入消息
local _req = {}
_req.dailyId = id
_req.param = param
GameCenter.Network.Send("MSG_Dailyactive.ReqJoinDaily", _req)
return
end
else
local _curDailyId = self.MapOwnerDaily[_curMapId]
if self:CanEnterOtherDaily(_curDailyId, id) then
--发送进入消息
local _req = {}
_req.dailyId = id
_req.param = param
GameCenter.Network.Send("MSG_Dailyactive.ReqJoinDaily", _req)
return
end
end
end
if _mapCfg.ReceiveType == 0 then
Utils.ShowPromptByEnum("C_PLEASE_LEAVE_CURCOPY")
return
end
if _mapCfg.ReceiveType == 1 then
--弹出退出副本提示
Utils.ShowMsgBox(function(code)
if code == MsgBoxResultCode.Button2 then
self.AutoEnterDailyId = id
self.AutoEnterDailyParam = param
GameCenter.MapLogicSystem:SendLeaveMapMsg(false)
end
end, "C_AUTOENTER_EXIT_ASK", _dailyCfg.Name)
return
end
--发送进入消息
local _req = {}
_req.dailyId = id
_req.param = param
GameCenter.Network.Send("MSG_Dailyactive.ReqJoinDaily", _req)
end
-- 游戏服 请求公共服 服务器分组数据
function DailyActivitySystem:ReqCrossServerMatch()
GameCenter.Network.Send("MSG_Dailyactive.ReqCrossServerMatch", {})
end
-- 日常界面打开返回
function DailyActivitySystem:GS2U_ResActivePenel(msg)
if not msg.dailyInfoList then
return
end
self.CurrActive = msg.value
self.MaxActive = msg.activeMax
self.AddActive = msg.activeAdded
self.UseItemCount = msg.useItemCount
self.ReceiveGiftIDList:Clear()
if msg.drawList then
for i = 1, #msg.drawList do
self.ReceiveGiftIDList:Add(msg.drawList[i])
end
end
self.AllActivityIdList:Clear()
self.DailyActivitylist:Clear()
self.LimitActivityList:Clear()
self.AllActivityDic:Clear()
self.CrossServerActivityList:Clear()
for i = 1, #msg.dailyInfoList do
if msg.dailyInfoList[i].activeId == 207 then
GameCenter.FuDiSystem:CheckFunction(msg.dailyInfoList[i].open)
end
local _id = msg.dailyInfoList[i].activeId
local _cfg = DataConfig.DataDaily[_id]
if not _cfg then
return
end
if _cfg.Canshow == 1 then
local _activityType = _cfg.Fbtype
local _data = DailyActivityData:New(msg.dailyInfoList[i], _cfg);
if _activityType == ActivityTypeEnum.Daily then
self.DailyActivitylist:Add(_data)
elseif _activityType == ActivityTypeEnum.Limit then
self.LimitActivityList:Add(_data)
end
self.AllActivityDic:Add(_id, _data)
-- 跨服活动
if _cfg.Ifcross == 1 then
self.CrossServerActivityList:Add(_id)
end
self.AllActivityIdList:Add(_id)
end
end
self:SortActivityList()
self:CheckIsShowRedPoint()
GameCenter.PushFixEvent(LogicEventDefine.EID_EVENT_REFRESH_DAILYPANEL)
GameCenter.PushFixEvent(LogicLuaEventDefine.EID_EVENT_REFRESH_CHUANDAOTIPS)
end
-- 日常活动信息变更
function DailyActivitySystem:GS2U_ResUpdateDailyActiveInfo(msg)
self.CurrActive = msg.value
self.MaxActive = msg.activeMax
self.AddActive = msg.activeAdded
self.UseItemCount = msg.useItemCount
if msg.info then
local _cfg = DataConfig.DataDaily[msg.info.activeId]
if not _cfg then
return
end
if _cfg.Canshow == 1 then
if _cfg.Fbtype == ActivityTypeEnum.Daily then
self:UpdateActivityInfo(self.DailyActivitylist, msg.info)
elseif _cfg.Fbtype == ActivityTypeEnum.Limit then
self:UpdateActivityInfo(self.LimitActivityList, msg.info)
end
end
end
self:SortActivityList()
self:CheckIsShowRedPoint()
GameCenter.PushFixEvent(LogicEventDefine.EID_EVENT_REFRESH_DAILYPANEL)
GameCenter.PushFixEvent(LogicLuaEventDefine.EID_EVENT_REFRESH_ACTIVEPANEL)
end
-- 请求领取活跃返回
function DailyActivitySystem:GS2U_ResGetActiveReward(msg)
if msg.result == 0 then
GameCenter.DailyActivitySystem.ReceiveGiftIDList:Clear()
for i = 1, #msg.drawIdList do
GameCenter.DailyActivitySystem.ReceiveGiftIDList:Add(msg.drawIdList[i])
end
end
self:ActiveRedPointCheck()
GameCenter.PushFixEvent(LogicLuaEventDefine.EID_EVENT_REFRESH_ACTIVEPANEL)
end
-- 日常推送返回
function DailyActivitySystem:GS2U_ResDailyPushResult(msg)
if msg.activeIdList ~= nil then
self.OpenPushActivityList:Clear()
for i = 1, #msg.activeIdList do
self.OpenPushActivityList:Add(msg.activeIdList[i])
end
end
end
function DailyActivitySystem:GS2U_ResDailyActivityOpenStatus(msg)
-- 特殊处理福地
if msg.dailyId == 207 then
GameCenter.FuDiSystem:CheckFunction(msg.open)
end
local _cfg = DataConfig.DataDaily[msg.dailyId]
if not _cfg then
return
end
if _cfg.Fbtype == ActivityTypeEnum.Limit then
for i = 1, self.LimitActivityList:Count() do
if self.LimitActivityList[i].ID == msg.dailyId then
self.LimitActivityList[i]:SetActivityOpen(msg.open)
end
end
GameCenter.PushFixEvent(LogicEventDefine.EID_EVENT_REFRESH_ACTIVITYLIST, ActivityTypeEnum.Limit, nil)
end
end
-- 各个阶段所匹配的服务器信息
function DailyActivitySystem:GS2U_ResCrossServerMatch(msg)
if msg then
if msg.serverMatch_2 and #msg.serverMatch_2 > 0 then
self.ServerMatchInfoLvDic[2] = ServerMatchInfo:New(msg.serverMatch_2)
end
if msg.serverMatch_4 and #msg.serverMatch_4 > 0 then
self.ServerMatchInfoLvDic[4] = ServerMatchInfo:New(msg.serverMatch_4)
end
if msg.serverMatch_8 and #msg.serverMatch_8 > 0 then
self.ServerMatchInfoLvDic[8] = ServerMatchInfo:New(msg.serverMatch_8)
end
if msg.serverMatch_16 and #msg.serverMatch_16 > 0 then
self.ServerMatchInfoLvDic[16] = ServerMatchInfo:New(msg.serverMatch_16)
end
if msg.serverMatch_32 and #msg.serverMatch_32 > 0 then
self.ServerMatchInfoLvDic[32] = ServerMatchInfo:New(msg.serverMatch_32)
end
GameCenter.BaJiZhenSystem:SetJinDuData(msg)
end
end
function DailyActivitySystem:OnFirstEnterMap()
GameCenter.MainFunctionSystem:SetAlertFlag(FunctionStartIdCode.Calendar, true)
-- -- 功能预告
-- local _funcInfo = GameCenter.MainFunctionSystem:GetFunctionInfo(FunctionStartIdCode.ActivityNotice);
-- if _funcInfo.IsVisible then
-- local _id = GameCenter.GameSceneSystem:GetLocalPlayerID();
-- local _t = Time.GetNowTable();
-- local _curTime = _t.year * 10000 + _t.month * 100 + _t.day;
-- local _key = string.format("ActiveNotice_%s", _id);
-- if PlayerPrefs.HasKey(_key) then
-- if PlayerPrefs.GetInt(_key) ~= _curTime then
-- GameCenter.PushFixEvent(UILuaEventDefine.UIActivityNoticeForm_OPEN)
-- PlayerPrefs.SetInt(_key, _curTime);
-- end
-- else
-- GameCenter.PushFixEvent(UILuaEventDefine.UIActivityNoticeForm_OPEN)
-- PlayerPrefs.SetInt(_key, _curTime);
-- end
-- end
-- 在这里加一个上线的防沉迷的弹窗 丁华强 2020-08-04
if GameCenter.MainFunctionSystem:FunctionIsVisible(FunctionStartIdCode.Certification) then
GameCenter.PushFixEvent(UILuaEventDefine.UIFcmForm_OPEN)
end
end
-- 获取活动状态
function DailyActivitySystem:GetActiveityState(id)
local _data = self.AllActivityDic[id];
if _data then
return _data:GetState()
end
end
-- 是否能参加
function DailyActivitySystem:CanJoinDaily(id)
if id == 17 or id == 110 or id == 111 then
local _haveGuild = false
local _lp = GameCenter.GameSceneSystem:GetLocalPlayer()
if _lp ~= nil then
_haveGuild = _lp.GuildID > 0
end
if not _haveGuild then
return false;
end
end
return self:GetActiveityState(id) == ActivityState.CanJoin
end
-- 获取活动状态
function DailyActivitySystem:OnLevelChanged()
local _curLevel = GameCenter.GameSceneSystem:GetLocalPlayerLevel();
if not self.ActivityLevelDic then
self.ActivityLevelDic = {}
DataConfig.DataDaily:Foreach(function(k, v)
self.ActivityLevelDic[v.OpenLevel] = true
end);
end
if self.ActivityLevelDic[_curLevel] then
self:ReqActivePanel();
end
end
return DailyActivitySystem