| 
					
				 | 
			
			
				@@ -8,9 +8,10 @@ namespace GFGGame 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         private UI_BuyConfirmUI _ui; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         private int _itemId; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        private int _costId; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        private int _count; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        private int _costCount; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        private int _count;//本次购买次数 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        private int _buyTimes;//已购次数 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         private Action _onSuccess; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         private int _times = 0; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         private int _maxTimes = 0; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -32,12 +33,11 @@ namespace GFGGame 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             _ui.m_btnSure.onClick.Add(OnClickBtnSure); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             _ui.m_btnCancel.onClick.Add(OnClickBtnCancel); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        public void SetParams(int itemId, int count, int costId, int costCount, Action onSuccess, int times = 0, int maxTimes = 0, string message = "") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        public void SetParams(int itemId, int count, int buyTimes, Action onSuccess, int times = 0, int maxTimes = 0, string message = "") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             _itemId = itemId; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             _count = count; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            _costId = costId; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            _costCount = costCount; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            _buyTimes = buyTimes; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             _times = times; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             _maxTimes = maxTimes; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             _onSuccess = onSuccess; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -51,9 +51,10 @@ namespace GFGGame 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         private void UpdateView() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            ItemExchangeCfgArray.Instance.GetMoneyIdAndNum(_itemId, _buyTimes, _buyTimes + _count, out int costId, out int coustNum, out int buyNum); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             ItemCfg itemCfg = ItemCfgArray.Instance.GetCfg(_itemId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            ItemCfg costCfg = ItemCfgArray.Instance.GetCfg(_costId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            _ui.m_txtNeed.text = string.Format("是否花费{0}{1} 购买{2}{3}", _costCount, costCfg.name, _count, itemCfg.name); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            ItemCfg costCfg = ItemCfgArray.Instance.GetCfg(costId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            _ui.m_txtNeed.text = string.Format("是否花费{0}{1} 购买{2}{3}", coustNum, costCfg.name, buyNum, itemCfg.name); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             _ui.m_txtNum.text = ""; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             if (_message != "") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             { 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -61,20 +62,22 @@ namespace GFGGame 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             else if (_maxTimes != 0) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                _ui.m_txtNum.text = string.Format("今日剩余购买次数{0}/{1}", _times, _maxTimes); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                _ui.m_txtNum.text = string.Format("今日剩余购买次数{0}/{1}", _buyTimes, _maxTimes); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        private void OnClickBtnSure() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        private async void OnClickBtnSure() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            if (_times <= 0 && _maxTimes != 0) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            if ((_buyTimes + _count) <= 0 && _maxTimes != 0) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 PromptController.Instance.ShowFloatTextPrompt("购买次数不足!"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 return; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            if (ItemDataManager.GetItemNum(_costId) < _costCount) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            ItemExchangeCfgArray.Instance.GetMoneyIdAndNum(_itemId, _buyTimes, _buyTimes + _count, out int costId, out int coustNum, out int buyNum); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            if (ItemDataManager.GetItemNum(costId) < coustNum) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                ItemCfg costCfg = ItemCfgArray.Instance.GetCfg(_costId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                ItemCfg costCfg = ItemCfgArray.Instance.GetCfg(costId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 if (_itemId == ConstItemID.GOLD) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     PromptController.Instance.ShowFloatTextPrompt("鲛绡不足,请前往商城选购"); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -85,21 +88,18 @@ namespace GFGGame 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     // PromptController.Instance.ShowFloatTextPrompt(costCfg.name + "不足!"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     Alert.Show(costCfg.name + "不足,是否前往购买?").SetLeftButton(true).SetRightButton(true, "确认", (AlertWindow.AlertCallback)((object data) => 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                        { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                           int costNeedCount = _costCount - ItemDataManager.GetItemNum(_costId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                           ItemExchangeCfg currencyRatioCfg = ItemUtil.GetCurrencyRatioCfgById(_costId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                           BuyItemConteoller.Show(_costId, (int)currencyRatioCfg.costId, (int)currencyRatioCfg.num, (int)currencyRatioCfg.costNum, costNeedCount, ConstBuyType.TYPE_ITEM, 0, null, true, true, GameConst.MAX_COUNT_TO_BUY_DIAMOND_RED); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                           int costNeedCount = coustNum - ItemDataManager.GetItemNum(costId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                           ItemExchangeCfg currencyRatioCfg = ItemUtil.GetCurrencyRatioCfgById(costId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                           BuyItemConteoller.Show(costId, (int)currencyRatioCfg.costId, (int)currencyRatioCfg.num, (int)currencyRatioCfg.costNum, costNeedCount, ConstBuyType.TYPE_ITEM, 0, null, true, true, GameConst.MAX_COUNT_TO_BUY_DIAMOND_RED); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                        })); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     OnClickBtnCancel(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 return; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            ItemExchangeCfg currencyRatioCfg = ItemUtil.GetCurrencyRatioCfgById(_itemId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            // int count = (int)Math.Ceiling((decimal)_costCount / currencyRatioCfg.costNum * currencyRatioCfg.num); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            int count = ItemUtil.GetItemExChangeCount(_itemId, _costCount); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            ItemUtil.AddItemUseCost(_itemId, count, _costId, _costCount); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            if (_onSuccess != null) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            bool result = await ItemExchangeSProxy.ItemExchange(_itemId, _buyTimes); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            if (result && _onSuccess != null) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 _onSuccess(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             } 
			 |