From e95c5f16624be17dc1ac96b2c28c7996928c5d8d Mon Sep 17 00:00:00 2001
From: Client_PangDeRong <593317293@qq.com>
Date: 星期四, 11 十月 2018 16:22:21 +0800
Subject: [PATCH] 4074  【前端】限时抢购开发

---
 Core/NetworkPackage/ServerPack/HAA_SaleActivity/HAA17_tagMCFlashSaleInfo.cs                               |   81 +++++++++
 Core/NetworkPackage/DTCFile/ClientPack.meta                                                               |    9 +
 Core/NetworkPackage/DTCFile/ServerPack/HAA_SaleActivity/DTCAA18_tagMCFlashSaleAppointmentInfo.cs.meta     |   12 +
 Core/NetworkPackage/ServerPack/HAA_SaleActivity/HAA17_tagMCFlashSaleInfo.cs.meta                          |   12 +
 Core/NetworkPackage/DTCFile/ClientPack/ClientToMapServer.meta                                             |    9 +
 Core/NetworkPackage/DTCFile/ServerPack/HAA_SaleActivity/DTCAA17_tagMCFlashSaleInfo.cs                     |   20 ++
 Core/NetworkPackage/DTCFile/ServerPack/HAA_SaleActivity/DTCAA18_tagMCFlashSaleAppointmentInfo.cs          |   11 +
 Core/NetworkPackage/ServerPack/HAA_SaleActivity/HAA18_tagMCFlashSaleAppointmentInfo.cs                    |   29 +++
 System/OpenServerActivity/FlashSaleItemCell.cs                                                            |    6 
 System/OpenServerActivity/OperationFlashRushToBuy.cs                                                      |   81 ++++----
 System/Welfare/OperationTimeHepler.cs                                                                     |    2 
 Core/NetworkPackage/ClientPack/ClientToMapServer/CAA SaleActivity/CAA05_tagCMFlashSaleAppointment.cs      |   18 ++
 Core/NetworkPackage/ClientPack/ClientToMapServer/CAA SaleActivity/CAA05_tagCMFlashSaleAppointment.cs.meta |   12 +
 System/OpenServerActivity/FlashRushToBuyModel.cs                                                          |   74 +++++++-
 System/OpenServerActivity/FlashRushToBuyWin.cs                                                            |  118 ++++--------
 System/OpenServerActivity/FlashSaleTimeCell.cs                                                            |    7 
 Core/NetworkPackage/DTCFile/ServerPack/HAA_SaleActivity/DTCAA17_tagMCFlashSaleInfo.cs.meta                |   12 +
 Core/NetworkPackage/ServerPack/HAA_SaleActivity/HAA18_tagMCFlashSaleAppointmentInfo.cs.meta               |   12 +
 18 files changed, 394 insertions(+), 131 deletions(-)

diff --git a/Core/NetworkPackage/ClientPack/ClientToMapServer/CAA SaleActivity/CAA05_tagCMFlashSaleAppointment.cs b/Core/NetworkPackage/ClientPack/ClientToMapServer/CAA SaleActivity/CAA05_tagCMFlashSaleAppointment.cs
new file mode 100644
index 0000000..fb651cd
--- /dev/null
+++ b/Core/NetworkPackage/ClientPack/ClientToMapServer/CAA SaleActivity/CAA05_tagCMFlashSaleAppointment.cs
@@ -0,0 +1,18 @@
+using UnityEngine;
+using System.Collections;
+
+// AA 05 限时抢购预约 #tagCMFlashSaleAppointment

+

+public class CAA05_tagCMFlashSaleAppointment : GameNetPackBasic {

+    public uint GoodsID;    // 商城表的商品ID

+

+    public CAA05_tagCMFlashSaleAppointment () {

+        combineCmd = (ushort)0x03FE;

+        _cmd = (ushort)0xAA05;

+    }

+

+    public override void WriteToBytes () {

+        WriteBytes (GoodsID, NetDataType.DWORD);

+    }

+

+}

diff --git a/Core/NetworkPackage/ClientPack/ClientToMapServer/CAA SaleActivity/CAA05_tagCMFlashSaleAppointment.cs.meta b/Core/NetworkPackage/ClientPack/ClientToMapServer/CAA SaleActivity/CAA05_tagCMFlashSaleAppointment.cs.meta
new file mode 100644
index 0000000..8749196
--- /dev/null
+++ b/Core/NetworkPackage/ClientPack/ClientToMapServer/CAA SaleActivity/CAA05_tagCMFlashSaleAppointment.cs.meta
@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: 0bd4980ed38baa24e8d85722181ec836
+timeCreated: 1539228128
+licenseType: Pro
+MonoImporter:
+  serializedVersion: 2
+  defaultReferences: []
+  executionOrder: 0
+  icon: {instanceID: 0}
+  userData: 
+  assetBundleName: 
+  assetBundleVariant: 
diff --git a/Core/NetworkPackage/DTCFile/ClientPack.meta b/Core/NetworkPackage/DTCFile/ClientPack.meta
new file mode 100644
index 0000000..a5a6f03
--- /dev/null
+++ b/Core/NetworkPackage/DTCFile/ClientPack.meta
@@ -0,0 +1,9 @@
+fileFormatVersion: 2
+guid: 722e5e3d30096674e811f5bd191246a0
+folderAsset: yes
+timeCreated: 1539228128
+licenseType: Pro
+DefaultImporter:
+  userData: 
+  assetBundleName: 
+  assetBundleVariant: 
diff --git a/Core/NetworkPackage/DTCFile/ClientPack/ClientToMapServer.meta b/Core/NetworkPackage/DTCFile/ClientPack/ClientToMapServer.meta
new file mode 100644
index 0000000..5651f96
--- /dev/null
+++ b/Core/NetworkPackage/DTCFile/ClientPack/ClientToMapServer.meta
@@ -0,0 +1,9 @@
+fileFormatVersion: 2
+guid: a75d33f87d2bafb4191666d4978b2e08
+folderAsset: yes
+timeCreated: 1539228128
+licenseType: Pro
+DefaultImporter:
+  userData: 
+  assetBundleName: 
+  assetBundleVariant: 
diff --git a/Core/NetworkPackage/DTCFile/ServerPack/HAA_SaleActivity/DTCAA17_tagMCFlashSaleInfo.cs b/Core/NetworkPackage/DTCFile/ServerPack/HAA_SaleActivity/DTCAA17_tagMCFlashSaleInfo.cs
new file mode 100644
index 0000000..80724f4
--- /dev/null
+++ b/Core/NetworkPackage/DTCFile/ServerPack/HAA_SaleActivity/DTCAA17_tagMCFlashSaleInfo.cs
@@ -0,0 +1,20 @@
+using UnityEngine;
+using System.Collections;
+using Snxxz.UI;
+
+// AA 17 限时抢购活动信息 #tagMCFlashSaleInfo
+
+
+
+public class DTCAA17_tagMCFlashSaleInfo : DtcBasic {
+
+    public override void Done(GameNetPackBasic vNetPack) {
+
+        base.Done(vNetPack);
+
+        HAA17_tagMCFlashSaleInfo vNetData = vNetPack as HAA17_tagMCFlashSaleInfo;
+        OperationTimeHepler.Instance.UpdateFlashRushToBuy(vNetData);
+    }
+
+}
+
diff --git a/Core/NetworkPackage/DTCFile/ServerPack/HAA_SaleActivity/DTCAA17_tagMCFlashSaleInfo.cs.meta b/Core/NetworkPackage/DTCFile/ServerPack/HAA_SaleActivity/DTCAA17_tagMCFlashSaleInfo.cs.meta
new file mode 100644
index 0000000..9450023
--- /dev/null
+++ b/Core/NetworkPackage/DTCFile/ServerPack/HAA_SaleActivity/DTCAA17_tagMCFlashSaleInfo.cs.meta
@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: d00087bdecd7d4947a5c1f5e6d0e98a3
+timeCreated: 1539228128
+licenseType: Pro
+MonoImporter:
+  serializedVersion: 2
+  defaultReferences: []
+  executionOrder: 0
+  icon: {instanceID: 0}
+  userData: 
+  assetBundleName: 
+  assetBundleVariant: 
diff --git a/Core/NetworkPackage/DTCFile/ServerPack/HAA_SaleActivity/DTCAA18_tagMCFlashSaleAppointmentInfo.cs b/Core/NetworkPackage/DTCFile/ServerPack/HAA_SaleActivity/DTCAA18_tagMCFlashSaleAppointmentInfo.cs
new file mode 100644
index 0000000..7948cbc
--- /dev/null
+++ b/Core/NetworkPackage/DTCFile/ServerPack/HAA_SaleActivity/DTCAA18_tagMCFlashSaleAppointmentInfo.cs
@@ -0,0 +1,11 @@
+using UnityEngine;
+using System.Collections;
+
+// AA 18 限时抢购活动玩家预约信息 #tagMCFlashSaleAppointmentInfo

+

+public class DTCAA18_tagMCFlashSaleAppointmentInfo : DtcBasic {

+    public override void Done(GameNetPackBasic vNetPack) {

+        base.Done(vNetPack);

+        HAA18_tagMCFlashSaleAppointmentInfo vNetData = vNetPack as HAA18_tagMCFlashSaleAppointmentInfo;

+    }

+}

diff --git a/Core/NetworkPackage/DTCFile/ServerPack/HAA_SaleActivity/DTCAA18_tagMCFlashSaleAppointmentInfo.cs.meta b/Core/NetworkPackage/DTCFile/ServerPack/HAA_SaleActivity/DTCAA18_tagMCFlashSaleAppointmentInfo.cs.meta
new file mode 100644
index 0000000..70d45e6
--- /dev/null
+++ b/Core/NetworkPackage/DTCFile/ServerPack/HAA_SaleActivity/DTCAA18_tagMCFlashSaleAppointmentInfo.cs.meta
@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: 32d6f801e94f8b84086c12c4672b5dcf
+timeCreated: 1539228128
+licenseType: Pro
+MonoImporter:
+  serializedVersion: 2
+  defaultReferences: []
+  executionOrder: 0
+  icon: {instanceID: 0}
+  userData: 
+  assetBundleName: 
+  assetBundleVariant: 
diff --git a/Core/NetworkPackage/ServerPack/HAA_SaleActivity/HAA17_tagMCFlashSaleInfo.cs b/Core/NetworkPackage/ServerPack/HAA_SaleActivity/HAA17_tagMCFlashSaleInfo.cs
new file mode 100644
index 0000000..09cbb37
--- /dev/null
+++ b/Core/NetworkPackage/ServerPack/HAA_SaleActivity/HAA17_tagMCFlashSaleInfo.cs
@@ -0,0 +1,81 @@
+using UnityEngine;
+using System.Collections;
+
+// AA 17 限时抢购活动信息 #tagMCFlashSaleInfo

+

+public class HAA17_tagMCFlashSaleInfo : GameNetPackBasic {

+    public string StartDate;    // 开始日期 y-m-d

+    public string EndtDate;    // 结束日期 y-m-d

+    public ushort AdvanceMinutes;    // 提前显示分钟

+    public byte ActivityTimeCount;

+    public  tagMCFlashSaleTime[] ActivityTime;    //活动时间

+    public byte IsDayReset;    //是否每天重置

+    public ushort LimitLV;    // 限制等级

+    public byte ShopCount;    // 商店数

+    public  tagMCFlashSaleShop[] ShopInfo;    // 商店信息, 当有多个商店且有多个活动时间段时则每个时间段对应一个商店;

+

+    public HAA17_tagMCFlashSaleInfo () {

+        _cmd = (ushort)0xAA17;

+    }

+

+    public override void ReadFromBytes (byte[] vBytes) {

+        TransBytes (out StartDate, vBytes, NetDataType.Chars, 10);

+        TransBytes (out EndtDate, vBytes, NetDataType.Chars, 10);

+        TransBytes (out AdvanceMinutes, vBytes, NetDataType.WORD);

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

+        ActivityTime = new tagMCFlashSaleTime[ActivityTimeCount];

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

+            ActivityTime[i] = new tagMCFlashSaleTime();

+            TransBytes (out ActivityTime[i].StartTime, vBytes, NetDataType.Chars, 5);

+            TransBytes (out ActivityTime[i].EndtTime, vBytes, NetDataType.Chars, 5);

+        }

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

+        TransBytes (out LimitLV, vBytes, NetDataType.WORD);

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

+        ShopInfo = new tagMCFlashSaleShop[ShopCount];

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

+            ShopInfo[i] = new tagMCFlashSaleShop();

+            TransBytes (out ShopInfo[i].DayIndex, vBytes, NetDataType.BYTE);

+            TransBytes (out ShopInfo[i].TimeIndex, vBytes, NetDataType.BYTE);

+            TransBytes (out ShopInfo[i].GiftbagCount, vBytes, NetDataType.BYTE);

+            ShopInfo[i].GiftbagInfo = new tagMCFlashSaleGiftbag[ShopInfo[i].GiftbagCount];

+            for (int j = 0; j < ShopInfo[i].GiftbagCount; j ++) {

+                ShopInfo[i].GiftbagInfo[j] = new tagMCFlashSaleGiftbag();

+                TransBytes (out ShopInfo[i].GiftbagInfo[j].GiftID, vBytes, NetDataType.DWORD);

+                TransBytes (out ShopInfo[i].GiftbagInfo[j].BuyCountLimit, vBytes, NetDataType.BYTE);

+                TransBytes (out ShopInfo[i].GiftbagInfo[j].ServerBuyCountLimit, vBytes, NetDataType.WORD);

+                TransBytes (out ShopInfo[i].GiftbagInfo[j].MoneyType, vBytes, NetDataType.BYTE);

+                TransBytes (out ShopInfo[i].GiftbagInfo[j].MoneyNumber, vBytes, NetDataType.DWORD);

+                TransBytes (out ShopInfo[i].GiftbagInfo[j].MoneyOriginal, vBytes, NetDataType.DWORD);

+                TransBytes (out ShopInfo[i].GiftbagInfo[j].ItemID, vBytes, NetDataType.DWORD);

+                TransBytes (out ShopInfo[i].GiftbagInfo[j].ItemCount, vBytes, NetDataType.WORD);

+                TransBytes (out ShopInfo[i].GiftbagInfo[j].IsBind, vBytes, NetDataType.BYTE);

+            }

+        }

+    }

+

+    public struct tagMCFlashSaleGiftbag {

+        public uint GiftID;        //商城表的物品ID

+        public byte BuyCountLimit;        //限购数

+        public ushort ServerBuyCountLimit;        //全服限购数

+        public byte MoneyType;        //消耗货币类型

+        public uint MoneyNumber;        //消耗货币数量

+        public uint MoneyOriginal;        //原价

+        public uint ItemID;

+        public ushort ItemCount;

+        public byte IsBind;

+    }

+

+    public struct tagMCFlashSaleShop {

+        public byte DayIndex;        // 活动第几天

+        public byte TimeIndex;        // 第几个时间段

+        public byte GiftbagCount;        // 商店礼包数

+        public  tagMCFlashSaleGiftbag[] GiftbagInfo;        // 礼包信息

+    }

+

+    public struct tagMCFlashSaleTime {

+        public string StartTime;        // 开始时间 H:M

+        public string EndtTime;        // 结束时间 H:M

+    }

+

+}

diff --git a/Core/NetworkPackage/ServerPack/HAA_SaleActivity/HAA17_tagMCFlashSaleInfo.cs.meta b/Core/NetworkPackage/ServerPack/HAA_SaleActivity/HAA17_tagMCFlashSaleInfo.cs.meta
new file mode 100644
index 0000000..5859e9a
--- /dev/null
+++ b/Core/NetworkPackage/ServerPack/HAA_SaleActivity/HAA17_tagMCFlashSaleInfo.cs.meta
@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: ed9668281d90fdc4f97232ce3fcd3c9d
+timeCreated: 1539228128
+licenseType: Pro
+MonoImporter:
+  serializedVersion: 2
+  defaultReferences: []
+  executionOrder: 0
+  icon: {instanceID: 0}
+  userData: 
+  assetBundleName: 
+  assetBundleVariant: 
diff --git a/Core/NetworkPackage/ServerPack/HAA_SaleActivity/HAA18_tagMCFlashSaleAppointmentInfo.cs b/Core/NetworkPackage/ServerPack/HAA_SaleActivity/HAA18_tagMCFlashSaleAppointmentInfo.cs
new file mode 100644
index 0000000..2e0cf80
--- /dev/null
+++ b/Core/NetworkPackage/ServerPack/HAA_SaleActivity/HAA18_tagMCFlashSaleAppointmentInfo.cs
@@ -0,0 +1,29 @@
+using UnityEngine;
+using System.Collections;
+
+// AA 18 限时抢购活动玩家预约信息 #tagMCFlashSaleAppointmentInfo

+

+public class HAA18_tagMCFlashSaleAppointmentInfo : GameNetPackBasic {

+    public ushort GiftItemCount;    // 礼包数

+    public  tagMCFlashSaleItemYY[] ItemInfo;    // 物品信息

+

+    public HAA18_tagMCFlashSaleAppointmentInfo () {

+        _cmd = (ushort)0xAA18;

+    }

+

+    public override void ReadFromBytes (byte[] vBytes) {

+        TransBytes (out GiftItemCount, vBytes, NetDataType.WORD);

+        ItemInfo = new tagMCFlashSaleItemYY[GiftItemCount];

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

+            ItemInfo[i] = new tagMCFlashSaleItemYY();

+            TransBytes (out ItemInfo[i].GiftID, vBytes, NetDataType.DWORD);

+            TransBytes (out ItemInfo[i].IsAppointment, vBytes, NetDataType.BYTE);

+        }

+    }

+

+    public struct tagMCFlashSaleItemYY {

+        public uint GiftID;        //商城表的ID

+        public byte IsAppointment;        //是否预约

+    }

+

+}

diff --git a/Core/NetworkPackage/ServerPack/HAA_SaleActivity/HAA18_tagMCFlashSaleAppointmentInfo.cs.meta b/Core/NetworkPackage/ServerPack/HAA_SaleActivity/HAA18_tagMCFlashSaleAppointmentInfo.cs.meta
new file mode 100644
index 0000000..01719fc
--- /dev/null
+++ b/Core/NetworkPackage/ServerPack/HAA_SaleActivity/HAA18_tagMCFlashSaleAppointmentInfo.cs.meta
@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: 44e6594130c5e614c8411949a184b843
+timeCreated: 1539228128
+licenseType: Pro
+MonoImporter:
+  serializedVersion: 2
+  defaultReferences: []
+  executionOrder: 0
+  icon: {instanceID: 0}
+  userData: 
+  assetBundleName: 
+  assetBundleVariant: 
diff --git a/System/OpenServerActivity/FlashRushToBuyModel.cs b/System/OpenServerActivity/FlashRushToBuyModel.cs
index 05785c8..d6aa224 100644
--- a/System/OpenServerActivity/FlashRushToBuyModel.cs
+++ b/System/OpenServerActivity/FlashRushToBuyModel.cs
@@ -59,22 +59,71 @@
         }
 
 
-        public OperationFlashRushToBuy.FlashSale presentFlashSale { get; private set; }
-        public void UpdateSelectFlashSaleTime(int index)
+        public OperationFlashRushToBuy.FlashSaleShop presentFlashShop { get; private set; }
+        public void UpdateSelectFlashSaleTime(int dayIndex,int timeIndex)
+        {
+            presentFlashShop = default(OperationFlashRushToBuy.FlashSaleShop);
+            OperationFlashRushToBuy operation = GetOperationFlashRushToBuy();
+            if(operation != null)
+            {
+                OperationFlashRushToBuy.FlashSaleShop flashShop;
+                operation.TryGetFlashShop(dayIndex, timeIndex, out flashShop);
+                presentFlashShop = flashShop;
+            }
+        }
+
+        public OperationFlashRushToBuy GetOperationFlashRushToBuy()
         {
             OperationBase operationBase;
             if (OperationTimeHepler.Instance.TryGetOperationTime(Operation.FlashRushToBuy, out operationBase))
             {
-                OperationFlashRushToBuy operation = operationBase as OperationFlashRushToBuy;
-                OperationFlashRushToBuy.FlashSale flashSale;
-                operation.TryGetFlashSale(TimeUtility.ServerNow, out flashSale);
-                presentFlashSale = flashSale;
+                return operationBase as OperationFlashRushToBuy;
             }
+
+            return null;
+        }
+
+        public FlashRushToBuySate GetActivityState(out int seconds)
+        {
+            OperationBase operationBase;
+            OperationTimeHepler.Instance.TryGetOperationTime(Operation.FlashRushToBuy, out operationBase);
+            seconds = 0;
+            FlashRushToBuySate rushToBuySate = FlashRushToBuySate.InAdvance;
+            var inAdvance = false;
+            if (operationBase != null)
+            {
+                if (operationBase.InAdvanceTime(TimeUtility.ServerNow))
+                {
+                    inAdvance = true;
+                    seconds = operationBase.GetSecondsBeforeStart(TimeUtility.ServerNow);
+                }
+                else
+                {
+                    OperationFlashSale operation = operationBase as OperationFlashSale;
+                    seconds = operation.GetResetSurplusTime();
+                }
+            }
+            if (seconds > 0)
+            {
+                if (inAdvance)
+                {
+                    rushToBuySate = FlashRushToBuySate.InAdvance;
+                }
+                else
+                {
+                    rushToBuySate = FlashRushToBuySate.Begining;
+                }
+            }
+            else
+            {
+                rushToBuySate = FlashRushToBuySate.End;
+            }
+            return rushToBuySate;
         }
 
         private void OperationEndEvent(Operation type, int state)
         {
-            if (type == Operation.FlashSale && state == 0)
+            if (type == Operation.FlashRushToBuy && state == 0)
             {
                 UpdateRedpoint();
                 if (onStateUpate != null)
@@ -86,7 +135,7 @@
 
         private void OperationAdvanceEvent(Operation type)
         {
-            if (type == Operation.FlashSale)
+            if (type == Operation.FlashRushToBuy)
             {
                 if (onStateUpate != null)
                 {
@@ -97,7 +146,7 @@
 
         private void OperationStartEvent(Operation type, int state)
         {
-            if (type == Operation.FlashSale && state == 0)
+            if (type == Operation.FlashRushToBuy && state == 0)
             {
                 UpdateRedpoint();
                 if (onStateUpate != null)
@@ -237,5 +286,12 @@
                 flashSaleRedpoint.state = RedPointState.Simple;
             }
         }
+
+        public enum FlashRushToBuySate
+        {
+            InAdvance,//鎻愬墠
+            Begining, //娲诲姩涓�
+            End, //缁撴潫
+        }
     }
 }
diff --git a/System/OpenServerActivity/FlashRushToBuyWin.cs b/System/OpenServerActivity/FlashRushToBuyWin.cs
index 0d49e82..e0007ba 100644
--- a/System/OpenServerActivity/FlashRushToBuyWin.cs
+++ b/System/OpenServerActivity/FlashRushToBuyWin.cs
@@ -13,7 +13,7 @@
 
         StoreModel storeModel { get { return ModelCenter.Instance.GetModel<StoreModel>(); } }
         FlashRushToBuyModel rushToBuyModel { get { return ModelCenter.Instance.GetModel<FlashRushToBuyModel>(); } }
-
+        OperationFlashRushToBuy operation = null;
         #region Built-in
         protected override void BindController()
         {
@@ -25,12 +25,11 @@
 
         protected override void OnPreOpen()
         {
-            GlobalTimeEvent.Instance.secondEvent += SecondEvent;
+            SetDisplayModel();
             TimeMgr.Instance.OnDayEvent += OnDayEvent;
             OperationTimeHepler.Instance.operationStartEvent += OperationStartEvent;
             storeModel.RefreshBuyShopLimitEvent += RefreshBuyShopLimitEvent;
             OperationTimeHepler.Instance.operationTimeUpdateEvent += OperationTimeUpdateEvent;
-            CreateOperationTimes();
             Display();
         }
 
@@ -41,7 +40,6 @@
 
         protected override void OnPreClose()
         {
-            GlobalTimeEvent.Instance.secondEvent -= SecondEvent;
             TimeMgr.Instance.OnDayEvent -= OnDayEvent;
             OperationTimeHepler.Instance.operationStartEvent -= OperationStartEvent;
             storeModel.RefreshBuyShopLimitEvent -= RefreshBuyShopLimitEvent;
@@ -53,24 +51,53 @@
         }
         #endregion
 
-        private void CreateOperationTimes()
+        private void SetDisplayModel()
         {
+            operation = null;
             OperationBase operationBase;
             if (OperationTimeHepler.Instance.TryGetOperationTime(Operation.FlashRushToBuy, out operationBase))
             {
-                OperationFlashRushToBuy operation = operationBase as OperationFlashRushToBuy;
-                saleTimeCtrl.Refresh();
-                for(int i = 0; i < operation.times.Count; i++)
-                {
-                    saleTimeCtrl.AddCell(ScrollerDataType.Header,i,CreateSaleItem);
-                }
-                saleTimeCtrl.Restart();
+               operation = operationBase as OperationFlashRushToBuy;  
             }
         }
 
-        public void CreateSaleItem(CellView cellView)
+        private void Display()
         {
-           
+            if (rushToBuyModel.presentFlashShop.Equals(default(OperationFlashRushToBuy.FlashSaleShop))
+                || operation == null) return;
+
+            opreationTimeText.text = StringUtility.Contact(Language.Get("ExpActivity_Text1"), operation.ToDisplayTime());
+            if (rushToBuyModel.presentFlashShop.items.Length > 0)
+            {
+                var moneyType = rushToBuyModel.presentFlashShop.items[0].moneyType;
+                moneyIcon.SetIconWithMoneyType(moneyType);
+                moneyNumText.text = UIHelper.GetMoneyCnt(moneyType).ToString();
+            }
+            CreateOperationTimes();
+            CreateSaleItem();
+        }
+
+        private void CreateOperationTimes()
+        {
+            if (operation == null) return;
+
+            saleTimeCtrl.Refresh();
+            for (int i = 0; i < operation.flashShops.Count; i++)
+            {
+                saleTimeCtrl.AddCell(ScrollerDataType.Header, i);
+            }
+            saleTimeCtrl.Restart();
+        }
+
+        public void CreateSaleItem()
+        {
+            saleItemCtrl.Refresh();
+            var flashItems = rushToBuyModel.presentFlashShop.items;
+            for (int i = 0; i < flashItems.Length; i++)
+            {
+                saleItemCtrl.AddCell(ScrollerDataType.Header, i);
+            }
+            saleItemCtrl.Restart();
         }
 
         private void OperationTimeUpdateEvent(Operation type)
@@ -85,26 +112,7 @@
             Display();
         }
 
-        private void Display()
-        {
-            OperationBase operationBase;
-            if (OperationTimeHepler.Instance.TryGetOperationTime(Operation.FlashRushToBuy, out operationBase))
-            {
-                OperationFlashRushToBuy operation = operationBase as OperationFlashRushToBuy;
-                opreationTimeText.text = StringUtility.Contact(Language.Get("ExpActivity_Text1"), operation.ToDisplayTime());
-                OperationFlashRushToBuy.FlashSale flashSale;
-                if (operation.TryGetFlashSale(TimeUtility.ServerNow, out flashSale))
-                {
-                    if (flashSale.gifts.Length > 0)
-                    {
-                        var moneyType = flashSale.gifts[0].moneyType;
-                        moneyIcon.SetIconWithMoneyType(moneyType);
-                        moneyNumText.text = UIHelper.GetMoneyCnt(moneyType).ToString();
-                    }
-                }
-            }
-            GetSurplusTime();
-        }
+     
 
         private void OperationStartEvent(Operation type, int state)
         {
@@ -114,51 +122,9 @@
             }
         }
 
-        private void SecondEvent()
-        {
-            GetSurplusTime();
-        }
-
         private void OnDayEvent()
         {
             Display();
         }
-
-        private string GetSurplusTime()
-        {
-            OperationBase operationBase;
-            OperationTimeHepler.Instance.TryGetOperationTime(Operation.FlashRushToBuy, out operationBase);
-            var seconds = 0;
-            var inAdvance = false;
-            if (operationBase != null)
-            {
-                if (operationBase.InAdvanceTime(TimeUtility.ServerNow))
-                {
-                    inAdvance = true;
-                    seconds = operationBase.GetSecondsBeforeStart(TimeUtility.ServerNow);
-                }
-                else
-                {
-                    OperationFlashRushToBuy operation = operationBase as OperationFlashRushToBuy;
-                    seconds = operation.GetResetSurplusTime();
-                }
-            }
-            if (seconds > 0)
-            {
-                if (inAdvance)
-                {
-                    return Language.Get("OperationAdvanceOpen", TimeUtility.SecondsToDHMSCHS(seconds));
-                }
-                else
-                {
-                    return Language.Get("LimitGift1", TimeUtility.SecondsToDHMSCHS(seconds));
-                }
-            }
-            else
-            {
-                return Language.Get("ActivityEnd");
-            }
-        }
-
     }
 }
diff --git a/System/OpenServerActivity/FlashSaleItemCell.cs b/System/OpenServerActivity/FlashSaleItemCell.cs
index 558a48d..0452739 100644
--- a/System/OpenServerActivity/FlashSaleItemCell.cs
+++ b/System/OpenServerActivity/FlashSaleItemCell.cs
@@ -20,15 +20,15 @@
 
         public override void Refresh(CellView cell)
         {
-            if (rushToBuyModel.presentFlashSale.Equals(default(OperationFlashRushToBuy.FlashSale))) return;
+            if (rushToBuyModel.presentFlashShop.Equals(default(OperationFlashRushToBuy.FlashSaleShop))) return;
 
-            var saleItem = rushToBuyModel.presentFlashSale.gifts[cell.index];
+            var saleItem = rushToBuyModel.presentFlashShop.items[cell.index];
             originalMoneyIcon.SetIconWithMoneyType(saleItem.moneyType);
             presentMoneyIcon.SetIconWithMoneyType(saleItem.moneyType);
             originalPrice.text = saleItem.moneyOriginal.ToString();
             presentPrice.text = saleItem.moneyNumber.ToString();
 
-            var buyInfo = storeModel.GetBuyShopLimit((uint)saleItem.id);
+            var buyInfo = storeModel.GetBuyShopLimit((uint)saleItem.shopId);
             var buyCount = 0;
             if (buyInfo != null)
             {
diff --git a/System/OpenServerActivity/FlashSaleTimeCell.cs b/System/OpenServerActivity/FlashSaleTimeCell.cs
index 9593cfe..468eebd 100644
--- a/System/OpenServerActivity/FlashSaleTimeCell.cs
+++ b/System/OpenServerActivity/FlashSaleTimeCell.cs
@@ -7,9 +7,16 @@
     public class FlashSaleTimeCell : ScrollerUI
     {
         [SerializeField] Text remainText;
+        
+        FlashRushToBuyModel rushToBuyModel { get { return ModelCenter.Instance.GetModel<FlashRushToBuyModel>(); } }
+
         public override void Refresh(CellView cell)
         {
+            var operation = rushToBuyModel.GetOperationFlashRushToBuy();
+
+            if (operation == null) return;
             
+
         }
     }
 }
diff --git a/System/OpenServerActivity/OperationFlashRushToBuy.cs b/System/OpenServerActivity/OperationFlashRushToBuy.cs
index 6960ca0..9377b94 100644
--- a/System/OpenServerActivity/OperationFlashRushToBuy.cs
+++ b/System/OpenServerActivity/OperationFlashRushToBuy.cs
@@ -6,18 +6,21 @@
 {
     public class OperationFlashRushToBuy : OperationBase
     {
-        public List<FlashSale> flashShops = new List<FlashSale>();
+        public List<FlashSaleShop> flashShops = new List<FlashSaleShop>();
 
-        public bool TryGetFlashSale(DateTime time, out FlashSale flashSale)
+        public bool TryGetFlashShop(int dayIndex,int timeIndex ,out FlashSaleShop flashSaleShop)
         {
-            flashSale = default(FlashSale);
-            var index = IndexOfTime(time, inAdvanceMinute > 0 ? -1 : 0);
-            index = Mathf.Min(index, flashShops.Count - 1);
-            if (index >= 0)
+           flashSaleShop = default(FlashSaleShop);
+           for (int i = 0; i < flashShops.Count; i++)
             {
-                flashSale = flashShops[index];
+                var shop = flashShops[i];
+                if (shop.dayIndex == dayIndex
+                    && shop.timeIndex == timeIndex)
+                {
+                    return true;
+                }
             }
-            return index >= 0;
+            return false;
         }
 
         public override bool SatisfyOpenCondition()
@@ -44,59 +47,53 @@
             return textBuilder.ToString();
         }
 
-        public void ParsePackage(HAA11_tagMCSpringSaleInfo package)
+        public void ParsePackage(HAA17_tagMCFlashSaleInfo package)
         {
             for (int i = 0; i < package.ShopCount; i++)
             {
-                var flashShop = new FlashSale();
+                var gift = new FlashSaleShop();
                 var shop = package.ShopInfo[i];
-                flashShop.gifts = new FlashSaleGift[shop.GiftbagCount];
+                gift.dayIndex = shop.DayIndex;
+                gift.timeIndex = shop.TimeIndex;
+                gift.items = new FlashSaleItem[shop.GiftbagCount];
                 for (int k = 0; k < shop.GiftbagCount; k++)
                 {
-                    var gift = new FlashSaleGift();
-                    var pakGift = shop.GiftbagInfo[k];
-                    gift.id = (int)pakGift.GiftID;
-                    gift.limitNum = pakGift.BuyCountLimit;
-                    gift.moneyNumber = (int)pakGift.MoneyNumber;
-                    gift.moneyType = pakGift.MoneyType;
-                    gift.moneyOriginal = (int)pakGift.MoneyOriginal;
-                    gift.items = new FlashSaleItem[pakGift.GiftItemCount];
-                    for (int q = 0; q < pakGift.GiftItemCount; q++)
-                    {
-                        var item = new FlashSaleItem();
-                        item.itemId = (int)pakGift.ItemInfo[q].ItemID;
-                        item.isBind = pakGift.ItemInfo[q].IsBind;
-                        item.itemCount = pakGift.ItemInfo[q].ItemCount;
-                        item.isMainItem = pakGift.ItemInfo[q].IsMainItem == 1;
-                        gift.items[q] = item;
-                    }
-                    flashShop.gifts[k] = gift;
+                    var item = new FlashSaleItem();
+                    var saleItem = shop.GiftbagInfo[k];
+                    item.shopId = (int)saleItem.GiftID;
+                    item.limitNum = saleItem.BuyCountLimit;
+                    item.fullServerLimitNum = saleItem.ServerBuyCountLimit;
+                    item.moneyType = saleItem.MoneyType;
+                    item.moneyNumber = (int)saleItem.MoneyNumber;
+                    item.moneyOriginal = (int)saleItem.MoneyOriginal;
+                    item.itemId = (int)saleItem.ItemID;
+                    item.itemCount = saleItem.ItemCount;
+                    item.isBind = saleItem.IsBind;
+                    gift.items[k] = item;
                 }
-                flashShops.Add(flashShop);
+                flashShops.Add(gift);
             }
         }
 
-        public struct FlashSale
+     
+        public struct FlashSaleShop
         {
-            public FlashSaleGift[] gifts;
-        }
-
-        public struct FlashSaleGift
-        {
-            public int id;
-            public int limitNum;
-            public int moneyType;
-            public int moneyNumber;
-            public int moneyOriginal;
+            public int dayIndex; // 娲诲姩绗嚑澶�
+            public int timeIndex;//绗嚑涓椂闂存
             public FlashSaleItem[] items;
         }
 
         public struct FlashSaleItem
         {
+            public int shopId;
+            public int limitNum;//涓汉闄愯喘鏁伴噺
+            public int fullServerLimitNum; //涓汉闄愯喘鏁伴噺
+            public int moneyType;
+            public int moneyNumber;
+            public int moneyOriginal;
             public int itemId;
             public int itemCount;
             public int isBind;
-            public bool isMainItem;
         }
     }
 }
diff --git a/System/Welfare/OperationTimeHepler.cs b/System/Welfare/OperationTimeHepler.cs
index 310ebf1..1b582a2 100644
--- a/System/Welfare/OperationTimeHepler.cs
+++ b/System/Welfare/OperationTimeHepler.cs
@@ -226,7 +226,7 @@
         /// 闄愭椂鎶㈣喘
         /// </summary>
         /// <param name="package"></param>
-        public void UpdateFlashRushToBuy(HAA11_tagMCSpringSaleInfo package)
+        public void UpdateFlashRushToBuy(HAA17_tagMCFlashSaleInfo package)
         {
             OperationBase operationBase = null;
             operationDict.TryGetValue(Operation.FlashRushToBuy, out operationBase);

--
Gitblit v1.8.0