public void BuyProVersion() { if (StoreLoaded == true && IOSInAppPurchaseManager.Instance.IsInAppPurchasesEnabled) { PaymentManagerExample.buyItem(PaymentManagerExample.Pro_Version); } }
public void BuyRemoveAds() { if (StoreLoaded == true && IOSInAppPurchaseManager.Instance.IsInAppPurchasesEnabled) { PaymentManagerExample.buyItem(PaymentManagerExample.No_Ads); } }
/// <summary> /// 支付 /// </summary> public static void PayForProduct(string productId) { string ipaValue = string.Format(productId); PaymentManagerExample.buyItem(ipaValue); LoadingBlockCtrl.Show(); }
//-------------------------------------- // PUBLIC METHODS //-------------------------------------- void OnGUI() { UpdateToStartPos(); GUI.Label(new Rect(StartX, StartY, Screen.width, 40), "In-App Purchases", style); StartY += YLableStep; if (GUI.Button(new Rect(StartX, StartY, buttonWidth, buttonHeight), "Perfrom Buy")) { PaymentManagerExample.buyItem(PaymentManagerExample.SMALL_PACK); } StartX += XButtonStep; if (GUI.Button(new Rect(StartX, StartY, buttonWidth, buttonHeight), "Perfrom Buy2")) { PaymentManagerExample.buyItem(PaymentManagerExample.NC_PACK); } StartX += XButtonStep; if (GUI.Button(new Rect(StartX, StartY, buttonWidth, buttonHeight), "Restore Purshases")) { IOSInAppPurchaseManager.instance.restorePurchases(); } StartX = XStartPos; StartY += YButtonStep; if (GUI.Button(new Rect(StartX, StartY, buttonWidth, buttonHeight), "Verifay Last Purshase")) { IOSInAppPurchaseManager.instance.verifyLastPurchase(IOSInAppPurchaseManager.SANDBOX_VERIFICATION_SERVER); } StartX += XButtonStep; if (GUI.Button(new Rect(StartX, StartY, buttonWidth, buttonHeight), "Load Product View")) { IOSStoreProductView view = new IOSStoreProductView("333700869"); view.Load(); } }
//-------------------------------------- // PUBLIC METHODS //-------------------------------------- void OnGUI() { UpdateToStartPos(); GUI.Label(new Rect(StartX, StartY, Screen.width, 40), "In-App Purchases", style); StartY += YLableStep; if (GUI.Button(new Rect(StartX, StartY, buttonWidth, buttonHeight), "Init")) { PaymentManagerExample.init(); } if (IOSInAppPurchaseManager.Instance.IsStoreLoaded) { GUI.enabled = true; } else { GUI.enabled = false; } StartX = XStartPos; StartY += YButtonStep; if (GUI.Button(new Rect(StartX, StartY, buttonWidth, buttonHeight), "Perform Buy #1")) { PaymentManagerExample.buyItem(PaymentManagerExample.SMALL_PACK); } StartX += XButtonStep; if (GUI.Button(new Rect(StartX, StartY, buttonWidth, buttonHeight), "Perform Buy #2")) { PaymentManagerExample.buyItem(PaymentManagerExample.NC_PACK); } StartX += XButtonStep; if (GUI.Button(new Rect(StartX, StartY, buttonWidth, buttonHeight), "Restore Purchases")) { IOSInAppPurchaseManager.Instance.restorePurchases(); } StartX = XStartPos; StartY += YButtonStep; if (GUI.Button(new Rect(StartX, StartY, buttonWidth, buttonHeight), "Verify Last Purchases")) { IOSInAppPurchaseManager.Instance.VerifyLastPurchase(IOSInAppPurchaseManager.SANDBOX_VERIFICATION_SERVER); } StartX += XButtonStep; if (GUI.Button(new Rect(StartX, StartY, buttonWidth, buttonHeight), "Load Product View")) { IOSStoreProductView view = new IOSStoreProductView("333700869"); view.Disnissed += StoreProductViewDisnissed; view.Load(); } StartX += XButtonStep; if (GUI.Button(new Rect(StartX, StartY, buttonWidth, buttonHeight), "Is Payments Enabled On device")) { IOSInAppPurchaseManager.Instance.OnPurchasesStateSettingsLoaded += OnPurchasesStateSettingsLoaded; IOSInAppPurchaseManager.Instance.RequestInAppSettingState(); } StartX = XStartPos; StartY += YButtonStep; StartY += YLableStep; GUI.enabled = true; GUI.Label(new Rect(StartX, StartY, Screen.width, 40), "Local Receipt Validation", style); StartY += YLableStep; if (GUI.Button(new Rect(StartX, StartY, buttonWidth + 10, buttonHeight), "Load Receipt")) { ISN_Security.OnReceiptLoaded += OnReceiptLoaded; ISN_Security.Instance.RetrieveLocalReceipt(); } StartX += XButtonStep; if (GUI.Button(new Rect(StartX, StartY, buttonWidth, buttonHeight), "Retrive Device GUID")) { ISN_Security.OnGUIDLoaded += OnGUIDLoaded; ISN_Security.Instance.RetrieveDeviceGUID(); } }
// Use this for initialization public void Init() { Debug.Log("Init"); //IOSMessage.Create("Init", "Init"); PaymentManagerExample.init(); }
// Update is called once per frame public void Buy() { PaymentManagerExample.buyItem(PaymentManagerExample.SMALL_PACK); }
//-------------------------------------- // INITIALIZE //-------------------------------------- void Awake() { PaymentManagerExample.init(); }