From 75fad082a71c09da282ae25df7d5ac5fd577c852 Mon Sep 17 00:00:00 2001
From: Client_PangDeRong <593317293@qq.com>
Date: 星期一, 15 十月 2018 11:10:09 +0800
Subject: [PATCH] 4074  【前端】限时抢购开发

---
 System/SystemSetting/ActivitiesPushMgr.cs                                                        |   32 +++
 System/OpenServerActivity/OpenServerActivityNotifyBase.cs.meta                                   |   12 +
 Core/NetworkPackage/DTCFile/ServerPack/HAA_SaleActivity/DTCAA18_tagMCFlashSaleAppointmentInfo.cs |    6 
 System/GMCommand/GMInputWin.cs                                                                   |   12 -
 System/OpenServerActivity/OpenServerActivityNotifyModel.cs.meta                                  |   12 +
 Core/NetworkPackage/ServerPack/HAA_SaleActivity/HAA18_tagMCFlashSaleAppointmentInfo.cs           |   16 +
 System/OpenServerActivity/FlashSaleItemCell.cs                                                   |   36 ++
 System/OpenServerActivity/OperationFlashRushToBuy.cs                                             |   27 ++
 System/OpenServerActivity/OpenServerActivityNotifyBase.cs                                        |   34 +++
 System/OpenServerActivity/OpenServerActivityNotifyWin.cs                                         |   54 +++++
 System/OpenServerActivity/FlashRushToBuyCoolDown.cs                                              |    3 
 System/OpenServerActivity/FlashRushToBuyModel.cs                                                 |   99 ++++++++-
 System/OpenServerActivity/FlashRushToBuyWin.cs                                                   |    3 
 System/OpenServerActivity/OpenServerActivityNotifyModel.cs                                       |  179 +++++++++++++++++
 System/OpenServerActivity/FlashRushToBuyNotify.cs                                                |   35 +++
 System/OpenServerActivity/FlashRushToBuyNotify.cs.meta                                           |   12 +
 System/OpenServerActivity/OpenServerActivityNotifyWin.cs.meta                                    |   12 +
 17 files changed, 539 insertions(+), 45 deletions(-)

diff --git a/Core/NetworkPackage/DTCFile/ServerPack/HAA_SaleActivity/DTCAA18_tagMCFlashSaleAppointmentInfo.cs b/Core/NetworkPackage/DTCFile/ServerPack/HAA_SaleActivity/DTCAA18_tagMCFlashSaleAppointmentInfo.cs
index d198a86..9ac5dc1 100644
--- a/Core/NetworkPackage/DTCFile/ServerPack/HAA_SaleActivity/DTCAA18_tagMCFlashSaleAppointmentInfo.cs
+++ b/Core/NetworkPackage/DTCFile/ServerPack/HAA_SaleActivity/DTCAA18_tagMCFlashSaleAppointmentInfo.cs
@@ -5,10 +5,12 @@
 
 
 
-public class DTCAA18_tagMCFlashSaleAppointmentInfo : DtcBasic {
+public class DTCAA18_tagMCFlashSaleAppointmentInfo : DtcBasic
+{
 
     FlashRushToBuyModel rushToBuyModel { get { return ModelCenter.Instance.GetModel<FlashRushToBuyModel>(); } }
-    public override void Done(GameNetPackBasic vNetPack) {
+    public override void Done(GameNetPackBasic vNetPack)
+    {
 
         base.Done(vNetPack);
 
diff --git a/Core/NetworkPackage/ServerPack/HAA_SaleActivity/HAA18_tagMCFlashSaleAppointmentInfo.cs b/Core/NetworkPackage/ServerPack/HAA_SaleActivity/HAA18_tagMCFlashSaleAppointmentInfo.cs
index 2f49b7a..a3db259 100644
--- a/Core/NetworkPackage/ServerPack/HAA_SaleActivity/HAA18_tagMCFlashSaleAppointmentInfo.cs
+++ b/Core/NetworkPackage/ServerPack/HAA_SaleActivity/HAA18_tagMCFlashSaleAppointmentInfo.cs
@@ -4,16 +4,28 @@
 // AA 18 限时抢购活动玩家预约信息 #tagMCFlashSaleAppointmentInfo

 

 public class HAA18_tagMCFlashSaleAppointmentInfo : GameNetPackBasic {

+    public byte IsAll;    // 是否全部

     public ushort GoodsCount;    // 商品数

-    public  uint[] GoodsList;    // 预约的商品

+    public  tagMCFlashSaleAppointmentState[] GoodsList;    // 预约的商品

 

     public HAA18_tagMCFlashSaleAppointmentInfo () {

         _cmd = (ushort)0xAA18;

     }

 

     public override void ReadFromBytes (byte[] vBytes) {

+        TransBytes (out IsAll, vBytes, NetDataType.BYTE);

         TransBytes (out GoodsCount, vBytes, NetDataType.WORD);

-        TransBytes (out GoodsList, vBytes, NetDataType.DWORD, GoodsCount);

+        GoodsList = new tagMCFlashSaleAppointmentState[GoodsCount];

+        for (int i = 0; i < GoodsCount; i ++) {

+            GoodsList[i] = new tagMCFlashSaleAppointmentState();

+            TransBytes (out GoodsList[i].GoodsMark, vBytes, NetDataType.DWORD);

+            TransBytes (out GoodsList[i].State, vBytes, NetDataType.BYTE);

+        }

+    }

+

+    public struct tagMCFlashSaleAppointmentState {

+        public uint GoodsMark;        // 商品标识

+        public byte State;        // 是否预约

     }

 

 }

diff --git a/System/GMCommand/GMInputWin.cs b/System/GMCommand/GMInputWin.cs
index c72b07c..1ddd701 100644
--- a/System/GMCommand/GMInputWin.cs
+++ b/System/GMCommand/GMInputWin.cs
@@ -87,18 +87,6 @@
             {
                 OnClickSendBtn();
             }
-
-            if (Input.GetKeyDown(KeyCode.J))
-            {
-               if(ModelCenter.Instance.GetModel<FlashRushToBuyModel>().IsOpen)
-                {
-                    if (!WindowCenter.Instance.IsOpen<FlashRushToBuyWin>())
-                    {
-                        WindowCenter.Instance.Open<FlashRushToBuyWin>();
-                    }
-                }
-            }
-
         }
 
         private void CreateCmdCell()
diff --git a/System/OpenServerActivity/FlashRushToBuyCoolDown.cs b/System/OpenServerActivity/FlashRushToBuyCoolDown.cs
index 29ba8ff..97472c9 100644
--- a/System/OpenServerActivity/FlashRushToBuyCoolDown.cs
+++ b/System/OpenServerActivity/FlashRushToBuyCoolDown.cs
@@ -47,7 +47,8 @@
             if (operation == null) return;
             int seconds = 0;
             OperationTime operationTime;
-            FlashRushToBuyModel.FlashRushToBuySate flashState = rushToBuyModel.GetActivityState(out seconds,out operationTime);
+            OperationFlashRushToBuy.FlashSaleShop saleShop;
+            FlashRushToBuyModel.FlashRushToBuySate flashState = rushToBuyModel.GetActivityState(out seconds,out operationTime,out saleShop);
             isStartReplace = false;
             switch (flashState)
             {
diff --git a/System/OpenServerActivity/FlashRushToBuyModel.cs b/System/OpenServerActivity/FlashRushToBuyModel.cs
index 00d49a4..12a0265 100644
--- a/System/OpenServerActivity/FlashRushToBuyModel.cs
+++ b/System/OpenServerActivity/FlashRushToBuyModel.cs
@@ -25,6 +25,10 @@
 
         public void OnPlayerLoginOk()
         {
+            if(!WindowCenter.Instance.IsOpen<OpenServerActivityNotifyWin>())
+            {
+                WindowCenter.Instance.Open<OpenServerActivityNotifyWin>();
+            }
             //UpdateRedpoint();
         }
 
@@ -68,7 +72,7 @@
         public void SetDefaultSelectSaleTime()
         {
             OperationFlashRushToBuy operation = GetOperationFlashRushToBuy();
-            if (!presentFlashShop.Equals(default(OperationFlashRushToBuy.FlashSaleShop)))
+            if (presentFlashShop != null)
             {
                 int seconds = 0;
                 int buyState = operation.GetBuyTimeState(TimeUtility.ServerNow,presentFlashShop.dayIndex,presentFlashShop.timeIndex, out seconds);
@@ -99,7 +103,7 @@
 
         public void ResetFlashShop()
         {
-            presentFlashShop = default(OperationFlashRushToBuy.FlashSaleShop);
+            presentFlashShop = null;
         }
 
         #region 鏈湴鏁版嵁澶勭悊
@@ -107,7 +111,7 @@
         public event Action UpdateSelectSaleTimeEvent;
         public void UpdateSelectFlashSaleTime(int dayIndex,int timeIndex)
         {
-            presentFlashShop = default(OperationFlashRushToBuy.FlashSaleShop);
+            presentFlashShop = null;
             OperationFlashRushToBuy operation = GetOperationFlashRushToBuy();
             if(operation != null)
             {
@@ -134,29 +138,55 @@
         #endregion
 
         #region 鍗忚
-        public event Action UpdateAppointmentEvent;
+        public event Action UpdateAllAppointmentEvent;
+        public event Action<int> UpdateAppointmentEvent;
         public void UpdateFlashSaleAppointmentInfo(HAA18_tagMCFlashSaleAppointmentInfo appointmentInfo)
         {
             var operation = GetOperationFlashRushToBuy();
             if (operation == null) return;
-            for(int i = 0; i < appointmentInfo.GoodsCount; i++)
+
+            if (appointmentInfo.IsAll == 1)
             {
-               for(int j = 0; j < operation.flashShops.Count; j++)
+                for (int j = 0; j < operation.flashShops.Count; j++)
                 {
                     var saleItems = operation.flashShops[j].items;
                     for (int k = 0; k < saleItems.Length; k++)
                     {
-                       if(saleItems[k].shopGuid == appointmentInfo.GoodsList[i])
+                        saleItems[k].isAppointment = 0;
+                    }
+                }
+            }
+
+            for (int i = 0; i < appointmentInfo.GoodsCount; i++)
+            {
+                var saleItemInfo = appointmentInfo.GoodsList[i];
+                for (int j = 0; j < operation.flashShops.Count; j++)
+                {
+                    var saleItems = operation.flashShops[j].items;
+                    for (int k = 0; k < saleItems.Length; k++)
+                    {
+                       if (saleItems[k].shopGuid == saleItemInfo.GoodsMark)
                         {
-                            saleItems[k].isAppointment = 1;
+                            if(saleItems[k].isAppointment != saleItemInfo.State)
+                            {
+                                saleItems[k].isAppointment = saleItemInfo.State;
+                                if(UpdateAppointmentEvent != null)
+                                {
+                                    UpdateAppointmentEvent((int)saleItemInfo.GoodsMark);
+                                }
+                            }
                         }
                     }
                 }
             }
-            if(UpdateAppointmentEvent != null)
+            if(appointmentInfo.IsAll == 1)
             {
-                UpdateAppointmentEvent();
+                if (UpdateAllAppointmentEvent != null)
+                {
+                    UpdateAllAppointmentEvent();
+                }
             }
+
         }
         /// <summary>
         /// Value1  鍟嗗搧ID  Value2 鍏ㄦ湇璐拱娆℃暟
@@ -189,9 +219,10 @@
         /// </summary>
         /// <param name="seconds"></param>
         /// <returns></returns>
-        public FlashRushToBuySate GetActivityState(out int seconds,out OperationTime operationTime)
+        public FlashRushToBuySate GetActivityState(out int seconds,out OperationTime operationTime,out OperationFlashRushToBuy.FlashSaleShop saleShop)
         {
             seconds = 0;
+            saleShop = null;
             operationTime = default(OperationTime);
             var operation = GetOperationFlashRushToBuy();
             if (!IsOpen || operation == null) return FlashRushToBuySate.NoOpen;
@@ -200,11 +231,19 @@
             int endState = 0;
             int openSeconds = 0;
             int endSeconds = 0;
+            for(int i = 0; i < operation.flashShops.Count;i++)
+            {
+                OperationFlashRushToBuy.FlashSaleShop openSaleShop = operation.flashShops[i];
+                operationTime = operation.times[openSaleShop.timeIndex];
+                openState = operation.GetBuyTimeState(TimeUtility.ServerNow, openSaleShop.dayIndex, openSaleShop.timeIndex, out openSeconds);
+                if(openState != 1)
+                {
+                    saleShop = openSaleShop;
+                    break;
+                }
+            }
             if(operation.flashShops.Count > 0)
             {
-                OperationFlashRushToBuy.FlashSaleShop openSaleShop = operation.flashShops[0];
-                operationTime = operation.times[openSaleShop.timeIndex];
-                openState = operation.GetBuyTimeState(TimeUtility.ServerNow, openSaleShop.dayIndex, openSaleShop.timeIndex,out openSeconds);
                 OperationFlashRushToBuy.FlashSaleShop endSaleShop = operation.flashShops[operation.flashShops.Count - 1];
                 endState = operation.GetBuyTimeState(TimeUtility.ServerNow, endSaleShop.dayIndex, endSaleShop.timeIndex, out endSeconds);
             }
@@ -214,6 +253,8 @@
                 case -1:
                     seconds = openSeconds;
                     return FlashRushToBuySate.InAdvance;
+                case 0:
+                    return FlashRushToBuySate.Begining;
             }
 
             switch(endState)
@@ -229,6 +270,36 @@
             }
         }
 
+        public bool CheckIsPush(out OperationFlashRushToBuy.FlashSaleShop saleShop)
+        {
+            int seconds = 0;
+            OperationTime operationTime;
+            saleShop = null;
+            var buyState = GetActivityState(out seconds,out operationTime,out saleShop);
+            switch (buyState)
+            {
+                case FlashRushToBuySate.NoOpen:
+                    break;
+                case FlashRushToBuySate.InAdvance:
+                    if(saleShop != null && seconds <= 180)
+                    {
+                       for(int i = 0; i < saleShop.items.Length; i++)
+                        {
+                            if(saleShop.items[i].isAppointment == 1)
+                            {
+                                return true;
+                            }
+                        }
+                    }
+                    break;
+                case FlashRushToBuySate.Begining:
+                    return true;
+                case FlashRushToBuySate.End:
+                    break;
+            }
+            return false;
+        }
+
         private void OperationEndEvent(Operation type, int state)
         {
             if (type == Operation.FlashRushToBuy && state == 0)
diff --git a/System/OpenServerActivity/FlashRushToBuyNotify.cs b/System/OpenServerActivity/FlashRushToBuyNotify.cs
new file mode 100644
index 0000000..174cb16
--- /dev/null
+++ b/System/OpenServerActivity/FlashRushToBuyNotify.cs
@@ -0,0 +1,35 @@
+锘縩amespace Snxxz.UI
+{
+    public class FlashRushToBuyNotify : OpenServerActivityNotifyBase
+    {
+        public FlashRushToBuyModel rushToBuyModel { get { return ModelCenter.Instance.GetModel<FlashRushToBuyModel>(); } }
+        public const string iconKey = "TB_BGL_2";
+        private void OnEnable()
+        {
+            Display();
+        }
+
+        private void OnDisable()
+        {
+            
+        }
+
+        protected override void Display()
+        {
+            base.Display();
+            titleText.text = "闄愭椂鎶㈣喘";
+            activityIcon.SetSprite(iconKey);
+        }
+
+        protected override void ClickGotoBtn()
+        {
+            base.ClickGotoBtn();
+            this.gameObject.SetActive(false);
+            WindowCenter.Instance.Open<FlashRushToBuyWin>();
+        }
+        protected override void ClickCloseBtn()
+        {
+            base.ClickCloseBtn();
+        }
+    }
+}
diff --git a/System/OpenServerActivity/FlashRushToBuyNotify.cs.meta b/System/OpenServerActivity/FlashRushToBuyNotify.cs.meta
new file mode 100644
index 0000000..aff0c1c
--- /dev/null
+++ b/System/OpenServerActivity/FlashRushToBuyNotify.cs.meta
@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: f1b3cf08873bf564ea2ec5d7d71afd41
+timeCreated: 1539423553
+licenseType: Pro
+MonoImporter:
+  serializedVersion: 2
+  defaultReferences: []
+  executionOrder: 0
+  icon: {instanceID: 0}
+  userData: 
+  assetBundleName: 
+  assetBundleVariant: 
diff --git a/System/OpenServerActivity/FlashRushToBuyWin.cs b/System/OpenServerActivity/FlashRushToBuyWin.cs
index 3889e60..89c05db 100644
--- a/System/OpenServerActivity/FlashRushToBuyWin.cs
+++ b/System/OpenServerActivity/FlashRushToBuyWin.cs
@@ -64,8 +64,7 @@
 
         private void Display()
         {
-            if (rushToBuyModel.presentFlashShop.Equals(default(OperationFlashRushToBuy.FlashSaleShop))
-                || operation == null) return;
+            if (rushToBuyModel.presentFlashShop == null|| operation == null) return;
 
             opreationTimeText.text = StringUtility.Contact(Language.Get("ExpActivity_Text1"), operation.ToDisplayTime());
             if (rushToBuyModel.presentFlashShop.items.Length > 0)
diff --git a/System/OpenServerActivity/FlashSaleItemCell.cs b/System/OpenServerActivity/FlashSaleItemCell.cs
index eba4231..2abace9 100644
--- a/System/OpenServerActivity/FlashSaleItemCell.cs
+++ b/System/OpenServerActivity/FlashSaleItemCell.cs
@@ -16,6 +16,7 @@
         [SerializeField] Image stateImg;
         [SerializeField] Button flashSaleBtn;
         [SerializeField] Text btnStateText;
+        [SerializeField] Text fullServerRemainNum;
 
         public const int RefreshFullServerBuyType = 8;
 
@@ -30,6 +31,7 @@
         {
             battleModel.RefreshGameRecInfoAct += UpdateFullServerBuy;
             storeModel.RefreshBuyShopLimitEvent += RefreshBuyShopLimitEvent;
+            rushToBuyModel.UpdateAllAppointmentEvent += UpdateAllAppointmentInfo;
             rushToBuyModel.UpdateAppointmentEvent += UpdateAppointmentInfo;
         }
 
@@ -37,12 +39,13 @@
         {
             storeModel.RefreshBuyShopLimitEvent -= RefreshBuyShopLimitEvent;
             battleModel.RefreshGameRecInfoAct -= UpdateFullServerBuy;
+            rushToBuyModel.UpdateAllAppointmentEvent -= UpdateAllAppointmentInfo;
             rushToBuyModel.UpdateAppointmentEvent -= UpdateAppointmentInfo;
         }
 
         public override void Refresh(CellView cell)
         {
-            if (rushToBuyModel.presentFlashShop.Equals(default(OperationFlashRushToBuy.FlashSaleShop))) return;
+            if (rushToBuyModel.presentFlashShop == null) return;
 
             saleItem = rushToBuyModel.presentFlashShop.items[cell.index];
             ItemCellModel cellModel = new ItemCellModel(saleItem.itemId,true,(ulong)saleItem.itemCount,saleItem.isBind);
@@ -73,14 +76,20 @@
         }
 
 
-        private void UpdateAppointmentInfo()
+        private void UpdateAllAppointmentInfo()
         {
+            UpdateSaleItem();
+        }
+
+        private void UpdateAppointmentInfo(int shopGuid)
+        {
+            if (saleItem == null || shopGuid != saleItem.shopGuid) return;
             UpdateSaleItem();
         }
 
         private void UpdateSaleItem()
         {
-            if (rushToBuyModel.presentFlashShop.Equals(default(OperationFlashRushToBuy.FlashSaleShop))) return;
+            if (rushToBuyModel.presentFlashShop == null) return;
 
             StoreConfig storeConfig = Config.Instance.Get<StoreConfig>(saleItem.shopId);
             flashSaleBtn.RemoveAllListeners();
@@ -88,6 +97,7 @@
             int seconds = 0;
             int buyState = operation.GetBuyTimeState(TimeUtility.ServerNow,rushToBuyModel.presentFlashShop.dayIndex,
                 rushToBuyModel.presentFlashShop.timeIndex,out seconds);
+
             switch(buyState)
             {
                 case -1:
@@ -111,7 +121,9 @@
 
         private void UpdateSaleItemSellState()
         {
-            int sellState = GetSellSate();
+            int fullSeverRemain = 0;
+            int sellState = GetSellSate(out fullSeverRemain);
+            fullServerRemainNum.text = fullSeverRemain.ToString();
             switch (sellState)
             {
                 case 0:
@@ -133,10 +145,20 @@
         /// 0 绉掓潃 1 宸蹭拱鍒� 2 宸叉姠鍏�
         /// </summary>
         /// <returns></returns>
-        private int GetSellSate()
+        private int GetSellSate(out int fullRemainNum)
         {
             var buyInfo = storeModel.GetBuyShopLimit((uint)saleItem.shopId);
             var buyCount = 0;
+            var fullServerInfo = rushToBuyModel.GetFullServerInfo();
+            fullRemainNum = 0;
+            if (fullServerInfo != null && fullServerInfo.Value1 == saleItem.shopId)
+            {
+                fullRemainNum = saleItem.fullServerLimitNum - fullServerInfo.Value2;
+            }
+            else
+            {
+                fullRemainNum = saleItem.fullServerLimitNum;
+            }
             if (buyInfo != null)
             {
                 buyCount = buyInfo.BuyCnt;
@@ -146,9 +168,7 @@
                 return 1;
             }
 
-            var fullServerInfo = rushToBuyModel.GetFullServerInfo();
-            if(fullServerInfo != null && fullServerInfo.Value1 == saleItem.shopId
-                && fullServerInfo.Value2 >= saleItem.fullServerLimitNum)
+            if (fullRemainNum <= 0)
             {
                 return 2;
             }
diff --git a/System/OpenServerActivity/OpenServerActivityNotifyBase.cs b/System/OpenServerActivity/OpenServerActivityNotifyBase.cs
new file mode 100644
index 0000000..1d0dc9f
--- /dev/null
+++ b/System/OpenServerActivity/OpenServerActivityNotifyBase.cs
@@ -0,0 +1,34 @@
+锘縰sing UnityEngine;
+using UnityEngine.UI;
+
+namespace Snxxz.UI
+{
+     public class OpenServerActivityNotifyBase : MonoBehaviour
+    {
+        [SerializeField] protected Text titleText;
+        [SerializeField] protected Image activityIcon;
+        [SerializeField] protected Button gotoBtn;
+        [SerializeField] protected Button closeBtn;
+
+        private void Awake()
+        {
+            gotoBtn.AddListener(ClickGotoBtn);
+            closeBtn.AddListener(ClickCloseBtn);
+        }
+
+        protected virtual void Display()
+        {
+
+        }
+
+        protected virtual void ClickGotoBtn()
+        {
+
+        }
+
+        protected virtual void ClickCloseBtn()
+        {
+            this.gameObject.SetActive(false);
+        }
+    }
+}
diff --git a/System/OpenServerActivity/OpenServerActivityNotifyBase.cs.meta b/System/OpenServerActivity/OpenServerActivityNotifyBase.cs.meta
new file mode 100644
index 0000000..026d4c7
--- /dev/null
+++ b/System/OpenServerActivity/OpenServerActivityNotifyBase.cs.meta
@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: 22be8e7eacfacb343b53b11b5d22aa29
+timeCreated: 1539422752
+licenseType: Pro
+MonoImporter:
+  serializedVersion: 2
+  defaultReferences: []
+  executionOrder: 0
+  icon: {instanceID: 0}
+  userData: 
+  assetBundleName: 
+  assetBundleVariant: 
diff --git a/System/OpenServerActivity/OpenServerActivityNotifyModel.cs b/System/OpenServerActivity/OpenServerActivityNotifyModel.cs
new file mode 100644
index 0000000..1cecce4
--- /dev/null
+++ b/System/OpenServerActivity/OpenServerActivityNotifyModel.cs
@@ -0,0 +1,179 @@
+锘縰sing System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace Snxxz.UI
+{
+    public class OpenServerActivityNotifyModel : Model,IBeforePlayerDataInitialize,IPlayerLoginOk
+    {
+      
+        public override void Init()
+        {
+          
+        }
+
+        public void OnBeforePlayerDataInitialize()
+        {
+            FlashRushToBuyActivityClose();
+            GlobalTimeEvent.Instance.minuteEvent -= UpdateMinute;
+            OperationTimeHepler.Instance.operationStartEvent -= OperationStartEvent;
+            OperationTimeHepler.Instance.operationEndEvent -= OperationEndEvent;
+            OperationTimeHepler.Instance.operationTimeUpdateEvent -= OperationTimeEvent;
+            OperationTimeHepler.Instance.operationServerCloseEvent -= OperationServerCloseEvent;
+        }
+
+        public void OnPlayerLoginOk()
+        {
+            OperationTimeHepler.Instance.operationStartEvent += OperationStartEvent;
+            OperationTimeHepler.Instance.operationEndEvent += OperationEndEvent;
+            OperationTimeHepler.Instance.operationTimeUpdateEvent += OperationTimeEvent;
+            OperationTimeHepler.Instance.operationServerCloseEvent += OperationServerCloseEvent;
+            GlobalTimeEvent.Instance.minuteEvent += UpdateMinute;
+            SetFlashRushToBuyNotify();
+        }
+
+        public override void UnInit()
+        {
+          
+        }
+
+        private void UpdateMinute()
+        {
+            SetFlashRushToBuyNotify();
+        }
+
+        private void OperationTimeEvent(Operation type)
+        {
+            switch (type)
+            {
+                case Operation.MultipleExp:
+                    break;
+                case Operation.ConsumeRebate:
+                    break;
+                case Operation.FlashSale:
+                    break;
+                case Operation.BossReborn:
+                    break;
+                case Operation.GiftPackage:
+                    break;
+                case Operation.FairyCeremony:
+                    break;
+                case Operation.MultipRealmPoint:
+                    break;
+                case Operation.FlashRushToBuy:
+                    SetFlashRushToBuyNotify();
+                    break;
+                case Operation.max:
+                    break;
+            }
+        }
+
+        private void OperationStartEvent(Operation type, int state)
+        {
+            switch (type)
+            {
+                case Operation.MultipleExp:
+                    break;
+                case Operation.ConsumeRebate:
+                    break;
+                case Operation.FlashSale:
+                    break;
+                case Operation.BossReborn:
+                    break;
+                case Operation.GiftPackage:
+                    break;
+                case Operation.FairyCeremony:
+                    break;
+                case Operation.MultipRealmPoint:
+                    break;
+                case Operation.FlashRushToBuy:
+                    SetFlashRushToBuyNotify();
+                    break;
+                case Operation.max:
+                    break;
+            }
+        }
+
+
+        private void OperationServerCloseEvent(Operation type)
+        {
+            switch (type)
+            {
+                case Operation.MultipleExp:
+                    break;
+                case Operation.ConsumeRebate:
+                    break;
+                case Operation.FlashSale:
+                    break;
+                case Operation.BossReborn:
+                    break;
+                case Operation.GiftPackage:
+                    break;
+                case Operation.FairyCeremony:
+                    break;
+                case Operation.MultipRealmPoint:
+                    break;
+                case Operation.FlashRushToBuy:
+                    FlashRushToBuyActivityClose();
+                    break;
+                case Operation.max:
+                    break;
+            }
+        }
+
+        private void OperationEndEvent(Operation type, int state)
+        {
+            switch (type)
+            {
+                case Operation.MultipleExp:
+                    break;
+                case Operation.ConsumeRebate:
+                    break;
+                case Operation.FlashSale:
+                    break;
+                case Operation.BossReborn:
+                    break;
+                case Operation.GiftPackage:
+                    break;
+                case Operation.FairyCeremony:
+                    break;
+                case Operation.MultipRealmPoint:
+                    break;
+                case Operation.FlashRushToBuy:
+                    FlashRushToBuyActivityClose();
+                    break;
+                case Operation.max:
+                    break;
+            }
+        }
+        #region 闄愭椂鎶㈣喘
+        public event Action UpdateFlashRushToBuyEvent;
+        FlashRushToBuyModel rushToBuyModel { get { return ModelCenter.Instance.GetModel<FlashRushToBuyModel>(); } }
+        public List<OperationFlashRushToBuy.FlashSaleShop> flashSaleShops = new List<OperationFlashRushToBuy.FlashSaleShop>();
+        public void SetFlashRushToBuyNotify()
+        {
+            OperationFlashRushToBuy.FlashSaleShop saleShop = null;
+            bool isPush = rushToBuyModel.CheckIsPush(out saleShop);
+            if(isPush && !flashSaleShops.Contains(saleShop))
+            {
+                flashSaleShops.Add(saleShop);
+                if(UpdateFlashRushToBuyEvent != null)
+                {
+                    UpdateFlashRushToBuyEvent();
+                }
+            }
+        }
+
+        public void FlashRushToBuyActivityClose()
+        {
+            flashSaleShops.Clear();
+            if (UpdateFlashRushToBuyEvent != null)
+            {
+                UpdateFlashRushToBuyEvent();
+            }
+        }
+        #endregion
+
+    }
+}
diff --git a/System/OpenServerActivity/OpenServerActivityNotifyModel.cs.meta b/System/OpenServerActivity/OpenServerActivityNotifyModel.cs.meta
new file mode 100644
index 0000000..cac9cd0
--- /dev/null
+++ b/System/OpenServerActivity/OpenServerActivityNotifyModel.cs.meta
@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: 2a78df4065d071145b2e5877404cd6fd
+timeCreated: 1539572551
+licenseType: Pro
+MonoImporter:
+  serializedVersion: 2
+  defaultReferences: []
+  executionOrder: 0
+  icon: {instanceID: 0}
+  userData: 
+  assetBundleName: 
+  assetBundleVariant: 
diff --git a/System/OpenServerActivity/OpenServerActivityNotifyWin.cs b/System/OpenServerActivity/OpenServerActivityNotifyWin.cs
new file mode 100644
index 0000000..758d631
--- /dev/null
+++ b/System/OpenServerActivity/OpenServerActivityNotifyWin.cs
@@ -0,0 +1,54 @@
+锘縰sing System;
+using UnityEngine;
+using UnityEngine.UI;
+
+namespace Snxxz.UI
+{
+    public class OpenServerActivityNotifyWin : Window
+    {
+        [SerializeField] FlashRushToBuyNotify flashRushToBuyNotify;
+        OpenServerActivityNotifyModel activityNotifyModel { get { return ModelCenter.Instance.GetModel<OpenServerActivityNotifyModel>(); } }
+        protected override void BindController()
+        {
+
+        }
+
+        protected override void AddListeners()
+        {
+            
+        }
+
+        protected override void OnPreOpen()
+        {          
+            activityNotifyModel.UpdateFlashRushToBuyEvent += CheckFlashRushToBuy;
+            CheckFlashRushToBuy();
+        }
+
+        protected override void OnAfterOpen()
+        {
+          
+        }
+
+        protected override void OnPreClose()
+        {
+            activityNotifyModel.UpdateFlashRushToBuyEvent -= CheckFlashRushToBuy;
+        }
+
+        protected override void OnAfterClose()
+        {
+
+        }
+
+        private void CheckFlashRushToBuy()
+        {
+            if(activityNotifyModel.flashSaleShops.Count > 0)
+            {
+                flashRushToBuyNotify.gameObject.SetActive(true);
+            }
+            else
+            {
+                flashRushToBuyNotify.gameObject.SetActive(false);
+            }
+        }
+    }
+}
diff --git a/System/OpenServerActivity/OpenServerActivityNotifyWin.cs.meta b/System/OpenServerActivity/OpenServerActivityNotifyWin.cs.meta
new file mode 100644
index 0000000..3d2fa9c
--- /dev/null
+++ b/System/OpenServerActivity/OpenServerActivityNotifyWin.cs.meta
@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: aa084ec4d5a2ea446b5ec00c0e1cc687
+timeCreated: 1539422752
+licenseType: Pro
+MonoImporter:
+  serializedVersion: 2
+  defaultReferences: []
+  executionOrder: 0
+  icon: {instanceID: 0}
+  userData: 
+  assetBundleName: 
+  assetBundleVariant: 
diff --git a/System/OpenServerActivity/OperationFlashRushToBuy.cs b/System/OpenServerActivity/OperationFlashRushToBuy.cs
index c9a8cb5..947addb 100644
--- a/System/OpenServerActivity/OperationFlashRushToBuy.cs
+++ b/System/OpenServerActivity/OperationFlashRushToBuy.cs
@@ -10,7 +10,7 @@
 
         public bool TryGetFlashShop(int dayIndex,int timeIndex ,out FlashSaleShop flashSaleShop)
         {
-           flashSaleShop = default(FlashSaleShop);
+           flashSaleShop = null;
            for (int i = 0; i < flashShops.Count; i++)
             {
                 var shop = flashShops[i];
@@ -21,6 +21,27 @@
                     return true;
                 }
             }
+            return false;
+        }
+
+        public bool TryGetFlashItem(int shopGuid,out FlashSaleShop flashSaleShop, out FlashSaleItem saleItem)
+        {
+            saleItem = null;
+            flashSaleShop = null;
+            for (int i = 0; i < flashShops.Count; i++)
+            {
+                var saleItems = flashShops[i].items;
+                for (int j = 0; j < saleItems.Length; j++)
+                {
+                    if (saleItems[j].shopGuid == shopGuid)
+                    {
+                        flashSaleShop = flashShops[i];
+                        saleItem = saleItems[j];
+                        return true;
+                    }
+                }
+            }
+          
             return false;
         }
 
@@ -125,14 +146,14 @@
         }
 
      
-        public struct FlashSaleShop
+        public class FlashSaleShop
         {
             public int dayIndex; // 娲诲姩绗嚑澶�
             public int timeIndex;//绗嚑涓椂闂存
             public FlashSaleItem[] items;
         }
 
-        public struct FlashSaleItem
+        public class FlashSaleItem
         {
             public int shopId;
             public int shopGuid;
diff --git a/System/SystemSetting/ActivitiesPushMgr.cs b/System/SystemSetting/ActivitiesPushMgr.cs
index e392d0e..e3c0a36 100644
--- a/System/SystemSetting/ActivitiesPushMgr.cs
+++ b/System/SystemSetting/ActivitiesPushMgr.cs
@@ -31,6 +31,7 @@
 
         public void OnBeforePlayerDataInitialize()
         {
+            rushToBuyModel.UpdateAllAppointmentEvent -= UpdateAllAppointment;
             rushToBuyModel.UpdateAppointmentEvent -= UpdateAppointment;
             GlobalTimeEvent.Instance.minuteEvent -= RefreshMinuteTime;
             OpenServerActivityCenter.Instance.openServerActivityStateChange -= RefreshOpenServerState;
@@ -48,6 +49,7 @@
             SetFlashRushToBuyAppointmentInfo();
             GlobalTimeEvent.Instance.minuteEvent += RefreshMinuteTime;
             OpenServerActivityCenter.Instance.openServerActivityStateChange += RefreshOpenServerState;
+            rushToBuyModel.UpdateAllAppointmentEvent += UpdateAllAppointment;
             rushToBuyModel.UpdateAppointmentEvent += UpdateAppointment;
         }
 
@@ -191,11 +193,39 @@
         #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;

--
Gitblit v1.8.0