| | |
| | | {
|
| | | public const int WholePeopleRankStart = 2091000; //全民冲榜开始
|
| | | public const int WholePeopleRankEnd = 20910000; //全民冲榜截止
|
| | |
|
| | | public const int FlashRushToBuy = 209014; //限时抢购
|
| | | ImpactRankModel impactRank { get { return ModelCenter.Instance.GetModel<ImpactRankModel>(); } }
|
| | | FlashRushToBuyModel rushToBuyModel { get { return ModelCenter.Instance.GetModel<FlashRushToBuyModel>(); } }
|
| | |
|
| | | private List<int> rankTypelist = new List<int>();
|
| | |
|
| | | public override void Init()
|
| | |
| | |
|
| | | public void OnBeforePlayerDataInitialize()
|
| | | {
|
| | |
|
| | | rushToBuyModel.UpdateAppointmentEvent -= UpdateAppointment;
|
| | | GlobalTimeEvent.Instance.minuteEvent -= RefreshMinuteTime;
|
| | | OpenServerActivityCenter.Instance.openServerActivityStateChange -= RefreshOpenServerState;
|
| | | }
|
| | |
|
| | | public void OnAfterPlayerDataInitialize()
|
| | |
| | | {
|
| | | SetRankStartPushInfo();
|
| | | SetRankEndPushInfo();
|
| | | GlobalTimeEvent.Instance.minuteEvent -= RefreshMinuteTime;
|
| | | SetFlashRushToBuyAppointmentInfo();
|
| | | GlobalTimeEvent.Instance.minuteEvent += RefreshMinuteTime;
|
| | | OpenServerActivityCenter.Instance.openServerActivityStateChange -= RefreshOpenServerState;
|
| | | OpenServerActivityCenter.Instance.openServerActivityStateChange += RefreshOpenServerState;
|
| | | rushToBuyModel.UpdateAppointmentEvent += UpdateAppointment;
|
| | | }
|
| | |
|
| | | public override void UnInit()
|
| | |
| | | {
|
| | | RemovePushByTime(PushInfoType.RankStart,11);
|
| | | RemovePushByTime(PushInfoType.RankEnd,23);
|
| | | RemoveFlashRushToBuyAppointmentByTime();
|
| | | }
|
| | |
|
| | | private void RefreshOpenServerState()
|
| | |
| | | SetRankEndPushInfo();
|
| | | RemovePushByActiveClose(PushInfoType.RankStart);
|
| | | RemovePushByActiveClose(PushInfoType.RankEnd);
|
| | | SetFlashRushToBuyAppointmentInfo();
|
| | | }
|
| | |
|
| | | #region 开服活动冲榜推送
|
| | | private void SetRankStartPushInfo()
|
| | | {
|
| | | for(int i = 0; i <rankTypelist.Count; i++)
|
| | |
| | | }
|
| | | }
|
| | |
|
| | | private void RemovePushByTime(PushInfoType type,int time)
|
| | | private void RemovePushByTime(PushInfoType type, int time)
|
| | | {
|
| | | int remainHour = time - TimeUtility.ServerNow.Hour;
|
| | | int remainMinute = 0 - TimeUtility.ServerNow.Minute;
|
| | |
| | | break;
|
| | | }
|
| | | }
|
| | | #endregion
|
| | |
|
| | | #region 限时抢购推送
|
| | | private void UpdateAppointment()
|
| | | {
|
| | | SetFlashRushToBuyAppointmentInfo();
|
| | | }
|
| | |
|
| | | private void SetFlashRushToBuyAppointmentInfo()
|
| | | {
|
| | | if (!rushToBuyModel.IsOpen) return;
|
| | |
|
| | | var operation = rushToBuyModel.GetOperationFlashRushToBuy();
|
| | | for(int i = 0; i < operation.flashShops.Count; i++)
|
| | | {
|
| | | var flashShop = operation.flashShops[i];
|
| | | int seconds = 0;
|
| | | int buyState = operation.GetBuyTimeState(TimeUtility.ServerNow, flashShop.dayIndex,flashShop.timeIndex,out seconds);
|
| | | var saleItems = operation.flashShops[i].items;
|
| | | for (int j = 0; j < saleItems.Length; j++)
|
| | | {
|
| | | int pushId = FlashRushToBuy * 10 + saleItems[j].shopGuid;
|
| | | if (buyState == -1 && seconds > 800 && saleItems[j].isAppointment == 1)
|
| | | {
|
| | | int remainSecond = seconds - 600;
|
| | | SendPushInfo(GetPushJsonData(pushId, remainSecond, "限时抢购", "亲爱的道友,您预约的限时抢购商品即将开抢,请尽快进入游戏秒杀!"));
|
| | | }
|
| | | else
|
| | | {
|
| | | RemovePushInfo(pushId);
|
| | | }
|
| | | }
|
| | | }
|
| | | }
|
| | |
|
| | | private void RemoveFlashRushToBuyAppointmentByTime()
|
| | | {
|
| | | if (!rushToBuyModel.IsOpen) return;
|
| | |
|
| | | var operation = rushToBuyModel.GetOperationFlashRushToBuy();
|
| | | for (int i = 0; i < operation.flashShops.Count; i++)
|
| | | {
|
| | | var flashShop = operation.flashShops[i];
|
| | | int seconds = 0;
|
| | | int buyState = operation.GetBuyTimeState(TimeUtility.ServerNow, flashShop.dayIndex, flashShop.timeIndex, out seconds);
|
| | | var saleItems = operation.flashShops[i].items;
|
| | | for (int j = 0; j < saleItems.Length; j++)
|
| | | {
|
| | | int pushId = FlashRushToBuy * 10 + saleItems[j].shopGuid;
|
| | | if (buyState != -1)
|
| | | {
|
| | | RemovePushInfo(pushId);
|
| | | }
|
| | | else
|
| | | {
|
| | | if(seconds <= 180)
|
| | | {
|
| | | RemovePushInfo(pushId);
|
| | | }
|
| | | }
|
| | | }
|
| | | }
|
| | | }
|
| | | #endregion
|
| | | public void RemovePushInfo(int pushId)
|
| | | {
|
| | | SDKUtility.Instance.GeTui_RemoveLocalMessage(pushId.ToString());
|