Procházet zdrojové kódy

服装店马蹄金不足购买弹窗

zhangyuqian před 1 rokem
rodič
revize
3ef182a976

+ 3 - 0
GameClient/Assets/Game/HotUpdate/Constant/ConstMessage.cs

@@ -201,5 +201,8 @@ namespace GFGGame
 
         // 服装合成成功事件
         public const string CLOTHING_SYNTHETIC_SUCCESS = "CLOTHING_SYNTHETIC_SUCCESS";
+
+        // 关闭购买弹窗事件
+        public const string CLOSE_SHOPPING_TIP = "CLOSE_SHOPPING_TIP";
     }
 }

+ 1 - 0
GameClient/Assets/Game/HotUpdate/Utils/ItemUtil.cs

@@ -69,6 +69,7 @@ namespace GFGGame
         {
             //ViewManager.Show<RechargeStoreView>();
             ViewManager.Show<StoreView>(new object[] { ConstStoreTabId.STORE_CHARGE, ConstStoreSubId.STORE_CHARGE });
+            EventAgent.DispatchEvent(ConstMessage.CLOSE_SHOPPING_TIP);
         }
 
         //红钻(鲛绡)

+ 23 - 5
GameClient/Assets/Game/HotUpdate/Views/CommonGame/BuyCountView.cs

@@ -86,7 +86,18 @@ namespace GFGGame
             _ui.m_btnCancel.onClick.Add(OnClickBtnCancel);
             _ui.m_txtCount.onFocusOut.Add(OnChangedTxtCount);
         }
-        
+
+        protected override void AddEventListener()
+        {
+            base.AddEventListener();
+            EventAgent.AddEventListener(ConstMessage.CLOSE_SHOPPING_TIP, CloseShoppingTip);
+        }
+
+        protected override void RemoveEventListener()
+        {
+            base.RemoveEventListener();
+            EventAgent.RemoveEventListener(ConstMessage.CLOSE_SHOPPING_TIP, CloseShoppingTip);
+        }
         /// <summary>
         /// 
         /// </summary>
@@ -216,7 +227,6 @@ namespace GFGGame
         {
             int count = int.Parse(_ui.m_txtCount.text.Trim());
             int price = int.Parse(_ui.m_txtPrice.text.Trim());
-
             if (_count > 0)
             {
                 long hasCount = ItemDataManager.GetItemNum(_costId);
@@ -227,8 +237,10 @@ namespace GFGGame
                         ItemCfg costCfg = ItemCfgArray.Instance.GetCfg(_costId);
                         PromptController.Instance.ShowFloatTextPrompt(string.Format("{0}不足", costCfg.name));
                     }
-                    else
-                        this.Hide();
+                    //else
+                    //{
+                    //    this.Hide();
+                    //}
                     return;
                 }
                 else
@@ -276,7 +288,7 @@ namespace GFGGame
             {
                 sender.text = _minBuyCount.ToString();
             }
-            
+
             _count = Math.Min(_maxCanBuy, Convert.ToInt32(sender.text));
             UpdateCost();
         }
@@ -371,6 +383,12 @@ namespace GFGGame
                 _ui.m_txtBuyTips.visible = value;
             }
         }
+
+        public void CloseShoppingTip()
+        {
+            this.Hide();
+        }
+
         private void CheckGuide(object param)
         {
             if (GuideDataManager.IsGuideFinish(ConstGuideId.BUY_CLOTHING) <= 0)