| | |
| | |
|
| | | public void OnBeforePlayerDataInitialize()
|
| | | {
|
| | | rushToBuyModel.UpdateAllAppointmentEvent -= UpdateAllAppointment;
|
| | | rushToBuyModel.UpdateAppointmentEvent -= UpdateAppointment;
|
| | | GlobalTimeEvent.Instance.minuteEvent -= RefreshMinuteTime;
|
| | | OpenServerActivityCenter.Instance.openServerActivityStateChange -= RefreshOpenServerState;
|
| | |
| | | SetFlashRushToBuyAppointmentInfo();
|
| | | GlobalTimeEvent.Instance.minuteEvent += RefreshMinuteTime;
|
| | | OpenServerActivityCenter.Instance.openServerActivityStateChange += RefreshOpenServerState;
|
| | | rushToBuyModel.UpdateAllAppointmentEvent += UpdateAllAppointment;
|
| | | rushToBuyModel.UpdateAppointmentEvent += UpdateAppointment;
|
| | | }
|
| | |
|
| | |
| | | #endregion
|
| | |
|
| | | #region 限时抢购推送
|
| | | private void UpdateAppointment()
|
| | | private void UpdateAllAppointment()
|
| | | {
|
| | | SetFlashRushToBuyAppointmentInfo();
|
| | | }
|
| | |
|
| | | private void UpdateAppointment(int shopGuid)
|
| | | {
|
| | | if (!rushToBuyModel.IsOpen) return;
|
| | |
|
| | | var operation = rushToBuyModel.GetOperationFlashRushToBuy();
|
| | | int pushId = FlashRushToBuy * 10 + shopGuid;
|
| | | OperationFlashRushToBuy.FlashSaleItem saleItem;
|
| | | OperationFlashRushToBuy.FlashSaleShop saleShop;
|
| | | bool isSaleItem = operation.TryGetFlashItem(shopGuid,out saleShop,out saleItem);
|
| | | if(isSaleItem)
|
| | | {
|
| | | if(saleItem.isAppointment != 1)
|
| | | {
|
| | | RemovePushInfo(pushId);
|
| | | }
|
| | | else
|
| | | {
|
| | | int seconds = 0;
|
| | | int buyState = operation.GetBuyTimeState(TimeUtility.ServerNow, saleShop.dayIndex, saleShop.timeIndex, out seconds);
|
| | | if(seconds > 800)
|
| | | {
|
| | | int remainSecond = seconds - 600;
|
| | | SendPushInfo(GetPushJsonData(pushId, remainSecond, "限时抢购", "亲爱的道友,您预约的限时抢购商品即将开抢,请尽快进入游戏秒杀!"));
|
| | | }
|
| | | }
|
| | | }
|
| | | }
|
| | |
|
| | | private void SetFlashRushToBuyAppointmentInfo()
|
| | | {
|
| | | if (!rushToBuyModel.IsOpen) return;
|