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

---
 System/OpenServerActivity/FlashSaleItemCell.cs |   48 +++++++++++++++++++++++++++++++++++++++++++-----
 1 files changed, 43 insertions(+), 5 deletions(-)

diff --git a/System/OpenServerActivity/FlashSaleItemCell.cs b/System/OpenServerActivity/FlashSaleItemCell.cs
index 18f6236..14ec735 100644
--- a/System/OpenServerActivity/FlashSaleItemCell.cs
+++ b/System/OpenServerActivity/FlashSaleItemCell.cs
@@ -15,7 +15,9 @@
         [SerializeField] Image presentMoneyIcon;
         [SerializeField] Image stateImg;
         [SerializeField] Button flashSaleBtn;
+        [SerializeField] Image btnBgImg;
         [SerializeField] Text btnStateText;
+        [SerializeField] Text cdText;
         [SerializeField] Text fullServerRemainNum;
 
         public const int RefreshFullServerBuyType = 8;
@@ -27,6 +29,7 @@
 
         OperationFlashRushToBuy.FlashSaleItem saleItem;
         int buyState = -1;
+        float cdTime = 10;
         private void OnEnable()
         {
             battleModel.RefreshGameRecInfoAct += UpdateFullServerBuy;
@@ -98,27 +101,62 @@
             buyState = operation.GetBuyTimeState(TimeUtility.ServerNow,rushToBuyModel.presentFlashShop.dayIndex,
                 rushToBuyModel.presentFlashShop.timeIndex,out seconds);
 
-            switch(buyState)
+            btnBgImg.SetSprite("SecondBtn1");
+            btnStateText.gameObject.SetActive(true);
+            cdText.gameObject.SetActive(false);
+            switch (buyState)
             {
                 case -1:
                     if(saleItem.isAppointment == 0)
                     {
-                        btnStateText.text = "棰勭害";
+                        cdTime = 10;
+                        btnStateText.text = Language.Get("FlashRushToBuy101");
                         flashSaleBtn.AddListener(() => { rushToBuyModel.SendFlashSaleAppointment(saleItem.shopGuid, 1); });
                     }
                     else
                     {
-                        btnStateText.text = "鍙栨秷棰勭害";
-                        flashSaleBtn.AddListener(() => { rushToBuyModel.SendFlashSaleAppointment(saleItem.shopGuid, 0); });
+                        btnStateText.gameObject.SetActive(false);
+                        cdText.gameObject.SetActive(true);
+                        btnBgImg.SetSprite("BlackBtn");
+                        RefreshCD(cdTime);
+                        TimeDownMgr.Instance.Begin(TimeDownMgr.CoolTimeType.FlashRushToBuyAppointment,cdTime, RefreshCD);
+                        flashSaleBtn.AddListener(CancelAppointment);
                     }
                     break;
                 case 0:
-                    btnStateText.text = "绉掓潃";
+                    cdTime = 10;
+                    btnStateText.text = Language.Get("FlashRushToBuy102");
                     flashSaleBtn.AddListener(() => { storeModel.SendBuyShopItem(storeConfig,saleItem.itemCount); });
                     break;
             }
         }
 
+        private void RefreshCD(float time)
+        {
+            cdTime = time;
+            if (cdTime <= 0)
+            {
+                cdText.text = Language.Get("FlashRushToBuy103");
+            }
+            else
+            {
+                cdText.text = Language.Get("FlashRushToBuy104",time);
+            }
+        }
+
+        private void CancelAppointment()
+        {
+            if(cdTime == 0)
+            {
+                rushToBuyModel.SendFlashSaleAppointment(saleItem.shopGuid, 0);
+            }
+            else 
+            {
+                MessageWin.Inst.ShowFixedTip("绯荤粺绻佸繖");
+            }
+         
+        }
+
         private void UpdateSaleItemSellState()
         {
             int fullSeverRemain = 0;

--
Gitblit v1.8.0