コード例 #1
0
		public void Restore(InAppPurchaseRestoreCallbackMethod restoreCallback)
		{
			if (restoreCallback == null) return;
			
			this.restoreCallback = restoreCallback;
			native.CallStatic("Restore");
		}
コード例 #2
0
 private async void restoreAsync(InAppPurchaseRestoreCallbackMethod restoreCallback)
         #endif
 {
                 #if WINDOWS_PHONE
     WinRTPlugin.Dispatcher.BeginInvoke(delegate()
                 #else
     await WinRTPlugin.CoreWindow.Dispatcher.RunAsync(CoreDispatcherPriority.Normal, delegate()
                 #endif
     {
         foreach (var inAppID in InAppIDs)
         {
                                 #if WINDOWS_PHONE
             if (testing)
             {
                 var testProductID = wp8TestListingInformation.ProductListings[inAppID.ID].ProductId;
                 restoreCallback(inAppID.ID, wp8TestLicenseInformation.ProductLicenses[testProductID].IsActive && !wp8TestLicenseInformation.ProductLicenses[testProductID].IsConsumable);
             }
             else
             {
                 restoreCallback(inAppID.ID, licenseInformation.ProductLicenses[inAppID.ID].IsActive && !licenseInformation.ProductLicenses[inAppID.ID].IsConsumable);
             }
                                 #else
             restoreCallback(inAppID.ID, licenseInformation.ProductLicenses[inAppID.ID].IsActive && inAppID.Type != InAppPurchaseTypes.Consumable);
                                 #endif
         }
     });
 }
コード例 #3
0
 public void Restore(InAppPurchaseRestoreCallbackMethod restoreCallback)
 {
     if (restoreCallback == null)
     {
         return;
     }
     restoreAsync(restoreCallback);
 }
コード例 #4
0
		public void Restore(InAppPurchaseRestoreCallbackMethod restoreCallback)
		{
			if (restoreCallback == null) return;
			
			foreach (var inAppID in InAppIDs)
			{
				restoreCallback(inAppID.ID, true);
			}
		}
コード例 #5
0
        public void Restore(InAppPurchaseRestoreCallbackMethod restoreCallback)
        {
            if (restoreCallback == null)
            {
                return;
            }

            this.restoreCallback = restoreCallback;
            native.CallStatic("Restore");
        }
コード例 #6
0
        public void Restore(InAppPurchaseRestoreCallbackMethod restoreCallback)
        {
            if (restoreCallback == null)
            {
                return;
            }

            this.restoreCallback = restoreCallback;
            RestoreInAppPurchase(native);
        }
コード例 #7
0
        public void Restore(InAppPurchaseRestoreCallbackMethod restoreCallback)
        {
            if (restoreCallback == null)
            {
                return;
            }

            foreach (var inAppID in InAppIDs)
            {
                restoreCallback(inAppID.ID, true);
            }
        }
コード例 #8
0
        public void Restore(InAppPurchaseRestoreCallbackMethod restoreCallback)
        {
                        #if !IOS_DISABLE_APPLE_IAP
            if (restoreCallback == null)
            {
                return;
            }

            this.restoreCallback = restoreCallback;
            RestoreInAppPurchase(native);
                        #endif
        }
コード例 #9
0
 /// <summary>
 /// Use to restore purchased items.
 /// NOTE: This will check the IAP server for existing items owned by the user.
 /// </summary>
 /// <param name="restoreCallback">The callback that fires when done.</param>
 public void Restore(InAppPurchaseRestoreCallbackMethod restoreCallback)
 {
     if (restoringProducts || buyingProduct)
     {
         Debug.LogError("You must wait for the last restore, buy or consume to finish!");
         if (restoreCallback != null)
         {
             restoreCallback(null, false);
         }
         return;
     }
     restoringProducts    = true;
     this.restoreCallback = restoreCallback;
     plugin.Restore(async_RestoreCallback);
 }
コード例 #10
0
		public void Restore(InAppPurchaseRestoreCallbackMethod restoreCallback)
		{
			if (restoreCallback == null) return;
			restoreAsync(restoreCallback);
		}
コード例 #11
0
 private void restoreAsync(InAppPurchaseRestoreCallbackMethod restoreCallback)
コード例 #12
0
		/// <summary>
		/// Use to restore purchased items.
		/// NOTE: This will check the IAP server for existing items owned by the user.
		/// </summary>
		/// <param name="restoreCallback">The callback that fires when done.</param>
		public void Restore(InAppPurchaseRestoreCallbackMethod restoreCallback)
		{
			if (restoringProducts || buyingProduct)
			{
				Debug.LogError("You must wait for the last restore, buy or consume to finish!");
				if (restoreCallback != null) restoreCallback(null, false);
				return;
			}
			restoringProducts = true;
			this.restoreCallback = restoreCallback;
			plugin.Restore(async_RestoreCallback);
		}
コード例 #13
0
		public void Restore(InAppPurchaseRestoreCallbackMethod restoreCallback)
		{
			if (restoreCallback == null) return;
			
			this.restoreCallback = restoreCallback;
			RestoreInAppPurchase(native);
		}
コード例 #14
0
		public void Restore(InAppPurchaseRestoreCallbackMethod restoreCallback)
		{
			Native.Restore(restoreCallback);
		}
コード例 #15
0
		private async void restoreAsync(InAppPurchaseRestoreCallbackMethod restoreCallback)
		#endif
		{
			#if WINDOWS_PHONE
			WinRTPlugin.Dispatcher.BeginInvoke(delegate()
			#else
			await WinRTPlugin.CoreWindow.Dispatcher.RunAsync(CoreDispatcherPriority.Normal, delegate()
			#endif
			{
				foreach (var inAppID in InAppIDs)
				{
					#if WINDOWS_PHONE
					if (testing)
					{
						var testProductID = wp8TestListingInformation.ProductListings[inAppID.ID].ProductId;
						ReignServices.InvokeOnUnityThread(delegate
						{
							restoreCallback(inAppID.ID, wp8TestLicenseInformation.ProductLicenses[testProductID].IsActive && !wp8TestLicenseInformation.ProductLicenses[testProductID].IsConsumable);
						});
					}
					else
					{
						ReignServices.InvokeOnUnityThread(delegate
						{
							restoreCallback(inAppID.ID, licenseInformation.ProductLicenses[inAppID.ID].IsActive && !licenseInformation.ProductLicenses[inAppID.ID].IsConsumable);
						});
					}
					#else
					ReignServices.InvokeOnUnityThread(delegate
					{
						restoreCallback(inAppID.ID, licenseInformation.ProductLicenses[inAppID.ID].IsActive && inAppID.Type != InAppPurchaseTypes.Consumable);
					});
					#endif
				}
			});
		}
コード例 #16
0
		public void Restore(InAppPurchaseRestoreCallbackMethod restoreCallback)
		{
			if (restoreCallback == null) return;
			
			int id = Common.getpid();
			string windowGroup = id.ToString();
			uint reqID = 0;
			if (paymentservice_get_existing_purchases_request(!testing, windowGroup, ref reqID) != 0)
			{
				foreach (var inAppID in InAppIDs)
				{
					restoreCallback(inAppID.ID, false);
				}
				
				return;
			}

			// wait for event
			var recoveredApps = new List<string>();
			while (true)
			{
				IntPtr _event = IntPtr.Zero;
				Common.bps_get_event(ref _event, -1);// wait here for next event
				if (_event != IntPtr.Zero)
				{
					if (paymentservice_get_domain() == Common.bps_event_get_domain(_event))
					{
						if (paymentservice_event_get_response_code(_event) == 0)
						{
							for (int i = 0; i != InAppIDs.Length; ++i)
							{
								IntPtr inAppIDPtr = paymentservice_event_get_digital_good_sku(_event, (uint)i);
								string inAppID = Marshal.PtrToStringAnsi(inAppIDPtr);
								if (Common.bps_event_get_code(_event) == 0)
								{
									// purchased
									recoveredApps.Add(inAppID);
								}
								else
								{
									// already purchased
									recoveredApps.Add(inAppID);
								}
							}
						}
						else
						{
							IntPtr errorPtr = paymentservice_event_get_error_text(_event);
							Debug.LogError(Marshal.PtrToStringAnsi(errorPtr));
							foreach (var inAppID in InAppIDs)
							{
								restoreCallback(inAppID.ID, false);
							}
							return;
						}
						
						foreach (var inAppID in InAppIDs)
						{
							bool found = false;
							foreach (var app2 in recoveredApps)
							{
								if (inAppID.ID == app2)
								{
									found = true;
									break;
								}
							}
							
							restoreCallback(inAppID.ID, found && inAppID.Type != InAppPurchaseTypes.Consumable);
						}
						
						return;
					}
				}
			}
		}
コード例 #17
0
 public void Restore(InAppPurchaseRestoreCallbackMethod restoreCallback)
 {
     Native.Restore(restoreCallback);
 }
コード例 #18
0
        public void Restore(InAppPurchaseRestoreCallbackMethod restoreCallback)
        {
            if (restoreCallback == null)
            {
                return;
            }

            int    id          = Common.getpid();
            string windowGroup = id.ToString();
            uint   reqID       = 0;

            if (paymentservice_get_existing_purchases_request(!testing, windowGroup, ref reqID) != 0)
            {
                foreach (var inAppID in InAppIDs)
                {
                    restoreCallback(inAppID.ID, false);
                }

                return;
            }

            // wait for event
            var recoveredApps = new List <string>();

            while (true)
            {
                IntPtr _event = IntPtr.Zero;
                Common.bps_get_event(ref _event, -1);                // wait here for next event
                if (_event != IntPtr.Zero)
                {
                    if (paymentservice_get_domain() == Common.bps_event_get_domain(_event))
                    {
                        if (paymentservice_event_get_response_code(_event) == 0)
                        {
                            for (int i = 0; i != InAppIDs.Length; ++i)
                            {
                                IntPtr inAppIDPtr = paymentservice_event_get_digital_good_sku(_event, (uint)i);
                                string inAppID    = Marshal.PtrToStringAnsi(inAppIDPtr);
                                if (Common.bps_event_get_code(_event) == 0)
                                {
                                    // purchased
                                    recoveredApps.Add(inAppID);
                                }
                                else
                                {
                                    // already purchased
                                    recoveredApps.Add(inAppID);
                                }
                            }
                        }
                        else
                        {
                            IntPtr errorPtr = paymentservice_event_get_error_text(_event);
                            Debug.LogError(Marshal.PtrToStringAnsi(errorPtr));
                            foreach (var inAppID in InAppIDs)
                            {
                                restoreCallback(inAppID.ID, false);
                            }
                            return;
                        }

                        foreach (var inAppID in InAppIDs)
                        {
                            bool found = false;
                            foreach (var app2 in recoveredApps)
                            {
                                if (inAppID.ID == app2)
                                {
                                    found = true;
                                    break;
                                }
                            }

                            restoreCallback(inAppID.ID, found && inAppID.Type != InAppPurchaseTypes.Consumable);
                        }

                        return;
                    }
                }
            }
        }
コード例 #19
0
 /// <summary>
 /// Dumy method.
 /// </summary>
 /// <param name="restoreCallback"></param>
 public void Restore(InAppPurchaseRestoreCallbackMethod restoreCallback)
 {
     // do nothing...
 }
コード例 #20
0
		/// <summary>
		/// Dumy method.
		/// </summary>
		/// <param name="restoreCallback"></param>
		public void Restore(InAppPurchaseRestoreCallbackMethod restoreCallback)
		{
			// do nothing...
		}
コード例 #21
0
		private void restoreAsync(InAppPurchaseRestoreCallbackMethod restoreCallback)
コード例 #22
0
		public void Restore(InAppPurchaseRestoreCallbackMethod restoreCallback)
		{
			#if !IOS_DISABLE_APPLE_IAP
			if (restoreCallback == null) return;
			
			this.restoreCallback = restoreCallback;
			RestoreInAppPurchase(native);
			#endif
		}