| | |
| | | using System.Collections.Generic;
|
| | | using System.Linq;
|
| | | using System.Text;
|
| | | using TableConfig;
|
| | |
|
| | | namespace Snxxz.UI
|
| | | {
|
| | | public class ActivitiesPushMgr : Model,IBeforePlayerDataInitialize,IAfterPlayerDataInitialize,IPlayerLoginOk
|
| | | {
|
| | | public const int WholePeopleMountRank = 2090001; //全民冲榜坐骑榜
|
| | | public const int WholePeopleMountRankEnd = 2090002; //全民冲榜坐骑榜截止
|
| | | public const int WholePeopleRankStart = 2091000; //全民冲榜开始
|
| | | public const int WholePeopleRankEnd = 20910000; //全民冲榜截止
|
| | |
|
| | | ImpactRankModel impactRank { get { return ModelCenter.Instance.GetModel<ImpactRankModel>(); } }
|
| | | private List<int> rankTypelist = new List<int>();
|
| | |
|
| | | public override void Init()
|
| | | {
|
| | | |
| | | List<OSCBillRankAwardConfig> configs = ConfigManager.Instance.GetAllValues<OSCBillRankAwardConfig>();
|
| | | for(int i = 0; i < configs.Count; i++)
|
| | | {
|
| | | if(!rankTypelist.Contains(configs[i].RangListType))
|
| | | {
|
| | | rankTypelist.Add(configs[i].RangListType);
|
| | | }
|
| | | }
|
| | | }
|
| | |
|
| | | public void OnBeforePlayerDataInitialize()
|
| | |
| | |
|
| | | public void OnPlayerLoginOk()
|
| | | {
|
| | | SetMountRankPushInfo();
|
| | | SetMountRankEndPushInfo();
|
| | | SetRankStartPushInfo();
|
| | | SetRankEndPushInfo();
|
| | | GlobalTimeEvent.Instance.minuteEvent -= RefreshMinuteTime;
|
| | | GlobalTimeEvent.Instance.minuteEvent += RefreshMinuteTime;
|
| | | OpenServerActivityCenter.Instance.openServerActivityStateChange -= RefreshOpenServerState;
|
| | |
| | |
|
| | | private void RefreshMinuteTime()
|
| | | {
|
| | | RemovePushByTime(PushInfoType.MountRankStart,11);
|
| | | RemovePushByTime(PushInfoType.MountRankEnd,23);
|
| | | RemovePushByTime(PushInfoType.RankStart,11);
|
| | | RemovePushByTime(PushInfoType.RankEnd,23);
|
| | | }
|
| | |
|
| | | private void RefreshOpenServerState()
|
| | | {
|
| | | SetMountRankPushInfo();
|
| | | SetMountRankEndPushInfo();
|
| | | SetRankStartPushInfo();
|
| | | SetRankEndPushInfo();
|
| | | }
|
| | |
|
| | | private void SetMountRankPushInfo()
|
| | | private void SetRankStartPushInfo()
|
| | | {
|
| | | if(impactRank.IsActivityClose(2))
|
| | | for(int i = 0; i <rankTypelist.Count; i++)
|
| | | {
|
| | | RemovePushInfo(WholePeopleMountRank);
|
| | | return;
|
| | | }
|
| | |
|
| | | int day = impactRank.GetOpenDay(2);
|
| | | int remainHour = 11 - TimeUtility.ServerNow.Hour;
|
| | | int remainMinute = 0 - TimeUtility.ServerNow.Minute;
|
| | | int remainSecond = day * 24 * 60 * 60 + remainHour * 60 * 60 + remainMinute * 60;
|
| | | if(remainSecond > 0)
|
| | | {
|
| | | GetPushJsonData(WholePeopleMountRank, remainSecond,Language.Get("SetUpPrivate106"),Language.Get("SetUpPrivate107"));
|
| | | int rankStartId = WholePeopleRankStart + rankTypelist[i];
|
| | | if (impactRank.IsActivityClose(rankTypelist[i]))
|
| | | {
|
| | | RemovePushInfo(rankStartId);
|
| | | }
|
| | | else
|
| | | {
|
| | | int day = impactRank.GetOpenDay(rankTypelist[i]);
|
| | | int remainHour = 11 - TimeUtility.ServerNow.Hour;
|
| | | int remainMinute = 0 - TimeUtility.ServerNow.Minute;
|
| | | int remainSecond = day * 24 * 60 * 60 + remainHour * 60 * 60 + remainMinute * 60;
|
| | | if (remainSecond > 0)
|
| | | {
|
| | | PlayerRankData.RankType rankType = impactRank.GetRankType(rankTypelist[i]);
|
| | | string rankName = StringUtility.Contact("OSCBillRankTitle_", rankType);
|
| | | GetPushJsonData(rankStartId, remainSecond, Language.Get("SetUpPrivate106"), Language.Get("SetUpPrivate107",rankName));
|
| | | }
|
| | | }
|
| | | }
|
| | | }
|
| | |
|
| | | private void SetMountRankEndPushInfo()
|
| | | private void SetRankEndPushInfo()
|
| | | {
|
| | | if (impactRank.IsActivityClose(2))
|
| | | for(int i = 0; i < rankTypelist.Count; i++)
|
| | | {
|
| | | RemovePushInfo(WholePeopleMountRankEnd);
|
| | | return;
|
| | | }
|
| | |
|
| | | int day = impactRank.GetSurplusDay(2);
|
| | | int remainHour = 23 - TimeUtility.ServerNow.Hour;
|
| | | int remainMinute = 0 - TimeUtility.ServerNow.Minute;
|
| | | int remainSecond = (day - 1) * 24 * 60 * 60 + remainHour * 60 * 60 + remainMinute * 60;
|
| | | if (remainSecond > 0)
|
| | | {
|
| | | GetPushJsonData(WholePeopleMountRankEnd, remainSecond, Language.Get("SetUpPrivate106"), Language.Get("SetUpPrivate108"));
|
| | | int rankEndId = WholePeopleRankEnd + rankTypelist[i];
|
| | | if (impactRank.IsActivityClose(rankTypelist[i]))
|
| | | {
|
| | | RemovePushInfo(rankEndId);
|
| | | }
|
| | | else
|
| | | {
|
| | | int day = impactRank.GetSurplusDay(rankTypelist[i]);
|
| | | int remainHour = 23 - TimeUtility.ServerNow.Hour;
|
| | | int remainMinute = 0 - TimeUtility.ServerNow.Minute;
|
| | | int remainSecond = (day - 1) * 24 * 60 * 60 + remainHour * 60 * 60 + remainMinute * 60;
|
| | | if (remainSecond > 0)
|
| | | {
|
| | | PlayerRankData.RankType rankType = impactRank.GetRankType(rankTypelist[i]);
|
| | | string rankName = StringUtility.Contact("OSCBillRankTitle_", rankType);
|
| | | GetPushJsonData(rankEndId, remainSecond, Language.Get("SetUpPrivate106"), Language.Get("SetUpPrivate108",rankName));
|
| | | }
|
| | | }
|
| | | }
|
| | | }
|
| | |
|
| | |
| | | int remainSecond = remainHour * 60 * 60 + remainMinute * 60;
|
| | | switch (type)
|
| | | {
|
| | | case PushInfoType.MountRankStart:
|
| | | if (impactRank.IsActivityClose(2))
|
| | | case PushInfoType.RankStart:
|
| | | for (int i = 0; i < rankTypelist.Count; i++)
|
| | | {
|
| | | RemovePushInfo(WholePeopleMountRank);
|
| | | }
|
| | | else
|
| | | {
|
| | | int day = impactRank.GetOpenDay(2);
|
| | | if(day <= 0 && remainSecond <= 120)
|
| | | int rankStartId = WholePeopleRankStart + rankTypelist[i];
|
| | | if (impactRank.IsActivityClose(rankTypelist[i]))
|
| | | {
|
| | | RemovePushInfo(WholePeopleMountRank);
|
| | | RemovePushInfo(rankStartId);
|
| | | }
|
| | | else
|
| | | {
|
| | | int day = impactRank.GetOpenDay(rankTypelist[i]);
|
| | | if (day <= 0 && remainSecond <= 120)
|
| | | {
|
| | | RemovePushInfo(rankStartId);
|
| | | }
|
| | | }
|
| | | }
|
| | | break;
|
| | | case PushInfoType.MountRankEnd:
|
| | | if (impactRank.IsActivityClose(2))
|
| | | case PushInfoType.RankEnd:
|
| | | for (int i = 0; i < rankTypelist.Count; i++)
|
| | | {
|
| | | RemovePushInfo(WholePeopleMountRankEnd);
|
| | | }
|
| | | else
|
| | | {
|
| | | int day = impactRank.GetSurplusDay(2);
|
| | | if (day <= 1 && remainSecond <= 120)
|
| | | int rankEndId = WholePeopleRankEnd + rankTypelist[i];
|
| | | if (impactRank.IsActivityClose(rankTypelist[i]))
|
| | | {
|
| | | RemovePushInfo(WholePeopleMountRankEnd);
|
| | | RemovePushInfo(rankEndId);
|
| | | }
|
| | | else
|
| | | {
|
| | | int day = impactRank.GetSurplusDay(rankTypelist[i]);
|
| | | if (day <= 1 && remainSecond <= 120)
|
| | | {
|
| | | RemovePushInfo(rankEndId);
|
| | | }
|
| | | }
|
| | | }
|
| | | break;
|
| | |
| | |
|
| | | public enum PushInfoType
|
| | | {
|
| | | MountRankStart,
|
| | | MountRankEnd,
|
| | | RankStart,
|
| | | RankEnd,
|
| | | }
|
| | | }
|
| | | }
|