| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081 | 
							- using System;
 
- using System.Collections.Generic;
 
- using UI.CommonGame;
 
- namespace GFGGame
 
- {
 
-     public class BuyTipsView : BaseWindow
 
-     {
 
-         private UI_BuyTipsUI _ui;
 
-         private int _itemId;
 
-         private int _costId;
 
-         private int _count;
 
-         private int _costCount;
 
-         private Action _onSuccess;
 
-         public override void Dispose()
 
-         {
 
-             base.Dispose();
 
-         }
 
-         protected override void OnInit()
 
-         {
 
-             base.OnInit();
 
-             _ui = UI_BuyTipsUI.Create();
 
-             this.viewCom = _ui.target;
 
-             this.viewCom.Center();
 
-             this.modal = true;
 
-             viewAnimationType = EnumViewAnimationType.ZOOM_CENTER;
 
-             _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 = null)
 
-         {
 
-             _itemId = itemId;
 
-             _count = count;
 
-             _costId = costId;
 
-             _costCount = costCount;
 
-             _onSuccess = onSuccess;
 
-         }
 
-         protected override void OnShown()
 
-         {
 
-             base.OnShown();
 
-             UpdateView();
 
-         }
 
-         private void UpdateView()
 
-         {
 
-             ItemCfg itemCfg = ItemCfgArray.Instance.GetCfg(_itemId);
 
-             _ui.m_txtNeed.text = string.Format("还需要购买{0}个", _count);
 
-             _ui.m_loaNeed.url = ResPathUtil.GetCommonGameResPath(itemCfg.res);
 
-             ItemCfg costCfg = ItemCfgArray.Instance.GetCfg(_costId);
 
-             _ui.m_txtCost.text = string.Format("是否花费{0}{1}购买?", _costCount, costCfg.name);
 
-         }
 
-         private void OnClickBtnSure()
 
-         {
 
-             ExchangeCfg currencyRatioCfg = ItemUtil.GetCurrencyRatioCfgById(_itemId);
 
-             int count = ItemUtil.GetItemExChangeCount(_itemId, _costCount);
 
-             ItemUtil.AddItemUseCost(_itemId, count, _costId, _costCount);
 
-             if (_onSuccess != null)
 
-             {
 
-                 _onSuccess();
 
-             }
 
-             ItemData itemData = new ItemData();
 
-             itemData.id = _itemId;
 
-             itemData.num = count;
 
-             ViewManager.Show<RewardView>(new List<ItemData> { itemData });
 
-             this.Hide();
 
-         }
 
-         private void OnClickBtnCancel()
 
-         {
 
-             this.Hide();
 
-         }
 
-     }
 
- }
 
 
  |