using UnityEngine; using UnityEngine.UI; using System.Collections; using System.Collections.Generic; using UnityEngine.Purchasing; public class BuyCoinPanel : PopUpPanel { public GameObject itemPrefab; public Text title; public RectTransform container; public Text vipInfo; public Text vipPrice; void Awake() { title.text = Language.GetStr ("BuyCoinPanel", "title"); vipInfo.text = Language.GetStr ("BuyCoinPanel", "vipInfo"); } // Use this for initialization void Start () { List list = ShopManager.GetInstance ().GetCoinDataList (); for(int i=0; i(itemPrefab); PopUpManager.AddToMainCanvas(itemObj, container); BuyCoinItem item = itemObj.GetComponent(); item.SetData (list[i]); } ShopData vipData = ShopManager.GetInstance ().GetVIPData (); vipPrice.text = vipData.price; } public void BuyVIP() { PaymentManager.GetIntance ().OnPurchaseClicked (ShopManager.GetInstance ().GetVIPData ().code); } public PurchaseProcessingResult ProcessPurchase (PurchaseEventArgs e) { Product product = e.purchasedProduct; return PurchaseProcessingResult.Complete; } /// /// Called when a purchase fails. /// public void OnPurchaseFailed (Product i, PurchaseFailureReason p) { } override protected void Remove() { this.gameObject.SetActive (false); PopUpManager.UpdateModal(); } private static BuyCoinPanel currentPanel; public static BuyCoinPanel Show() { if (currentPanel != null) { currentPanel.gameObject.SetActive (true); PopUpManager.AddToMainCanvas (currentPanel.gameObject); } else currentPanel = PopUpManager.AddPopUp (Resources.Load ("Prefabs/UI/Shop/BuyCoinPanel"), null, true); currentPanel.Open (); return currentPanel; } }