using UnityEngine; using UnityEngine.UI; using System.Collections; using System.Collections.Generic; using UnityEngine.Purchasing; public class BuyCoinPanel : PopUpPanel { public Transform coinContainer; public BuyCoinItem coinItemPrefab; public Transform cubeContainer; public BuyCoinItem cubeItemPrefab; public Text title; 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 (); ListHelper.FillList (coinContainer, list, coinItemPrefab); list = ShopManager.GetInstance ().GetCubeDataList (); ListHelper.FillList (cubeContainer, list, cubeItemPrefab); ShopData vipData = ShopManager.GetInstance ().GetVIPData (); vipPrice.text = vipData.price; } public void BuyVIP() { PaymentManager.GetIntance ().OnPurchaseClicked (ShopManager.GetInstance ().GetVIPData ().name); } override protected void Remove() { base.Remove (); currentPanel = null; } 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; } }