Inheritance: MonoBehaviour
コード例 #1
0
ファイル: StoreKit.cs プロジェクト: akisute/unity-iap-example
 public static StoreKit GetInstance()
 {
     if (instance == null) {
         GameObject obj = new GameObject("StoreKit");
         instance = obj.AddComponent<StoreKit>();
     }
     return instance;
 }
コード例 #2
0
 private void Update()
 {
     if (StoreKit.ConsumeProduct(product1))
     {
         Debug.LogFormat("Consume:{0}", product1);
     }
     else if (StoreKit.ConsumeProduct(product2))
     {
         Debug.LogFormat("Consume:{0}", product2);
     }
 }
コード例 #3
0
 private void OnGUI()
 {
     GUILayout.Label("StoreKit.isAvailable:" + StoreKit.isAvailable);
     GUILayout.Label("StoreKit.isProcessing:" + StoreKit.isProcessing);
     if (Button("Install:" + bundleID))
     {
         StoreKit.Install(bundleID);
     }
     if (Button("Buy:" + product1))
     {
         StoreKit.Buy(product1);
     }
     if (Button("Buy:" + product2))
     {
         StoreKit.Buy(product2);
     }
 }
コード例 #4
0
 public System.Threading.Tasks.Task PurchaseProduct(StoreKit.SKProduct productId)
 {
     using (_networkActivity.ActivateNetwork())
         return _inAppPurcahseService.PurchaseProduct(productId);
 }
コード例 #5
0
ファイル: PatronForm.cs プロジェクト: praeclarum/Praeclarum
		public static async Task HandlePurchaseCompletionAsync (StoreKit.SKPaymentTransaction t)
		{
			var p = prices.FirstOrDefault (x => x.Id == t.Payment.ProductIdentifier);
			if (p == null)
				return;
			await AddSubscriptionAsync (t.TransactionIdentifier, (DateTime)t.TransactionDate, p);
		}
コード例 #6
0
ファイル: PatronForm.cs プロジェクト: praeclarum/Praeclarum
		public static async Task HandlePurchaseFailAsync (StoreKit.SKPaymentTransaction t)
		{
			try {
				var m = t.Error != null ? t.Error.LocalizedDescription : "Unknown error";
				var alert = UIAlertController.Create ("Purchase Failed", m, UIAlertControllerStyle.Alert);
				alert.AddAction (UIAlertAction.Create ("OK", UIAlertActionStyle.Default, a => {}));
				var vc = UIApplication.SharedApplication.KeyWindow.RootViewController;
				while (vc.PresentedViewController != null) {
					vc = vc.PresentedViewController;
				}
				vc.PresentViewController (alert, true, null);
			} catch (Exception ex) {
				Log.Error (ex);
			}
		}