/// <summary>
 /// Use to init a single IAP system.
 /// </summary>
 /// <param name="desc">IAP Desc.</param>
 /// <param name="createdCallback">The callback that fires when done.</param>
 /// <returns>Returns IAP API object</returns>
 public static InAppAPI Init(InAppPurchaseDesc desc, InAppPurchaseCreatedCallbackMethod createdCallback)
 {
     InAppAPIs    = new InAppAPI[1];
     InAppAPIs[0] = new InAppAPI();
     InAppAPIs[0].init(desc, createdCallback);
     return(InAppAPIs[0]);
 }
        /// <summary>
        /// Use to init the IAP system.
        /// NOTE: This method is normaly used when you don't have any IAP items and only want to check if the app is in trial mode.
        /// </summary>
        /// <param name="testTrialMode">Set true to test trial mode.</param>
        /// <param name="createdCallback">The callback that gets fired when done.</param>
        /// <returns>Returns IAP API object</returns>
        public static InAppAPI Init(bool testTrialMode, InAppPurchaseCreatedCallbackMethod createdCallback)
        {
            var desc = new InAppPurchaseDesc()
            {
                Testing       = testTrialMode,
                TestTrialMode = testTrialMode
            };

            return(Init(desc, createdCallback));
        }
		internal void init(InAppPurchaseDesc desc, InAppPurchaseCreatedCallbackMethod createdCallback)
		{
			#if DISABLE_REIGN
			pluginAPI = InAppPurchaseAPIs.None;
			#elif UNITY_WP8
			pluginAPI = desc.WP8_InAppPurchaseAPI;
			#elif UNITY_METRO
			pluginAPI = desc.WinRT_InAppPurchaseAPI;
			#elif UNITY_IOS
			pluginAPI = desc.iOS_InAppPurchaseAPI;
			#elif UNITY_ANDROID
			pluginAPI = desc.Android_InAppPurchaseAPI;
			#elif UNITY_BLACKBERRY
			pluginAPI = desc.BB10_InAppPurchaseAPI;
			#else
			pluginAPI = InAppPurchaseAPIs.None;
			#endif

			this.createdCallback = createdCallback;
			plugin = InAppPurchaseAPI.New(desc, async_CreatedCallback);
		}
        internal void init(InAppPurchaseDesc desc, InAppPurchaseCreatedCallbackMethod createdCallback)
        {
                        #if DISABLE_REIGN
            pluginAPI = InAppPurchaseAPIs.None;
                        #elif UNITY_WP8
            pluginAPI = desc.WP8_InAppPurchaseAPI;
                        #elif UNITY_METRO
            pluginAPI = desc.WinRT_InAppPurchaseAPI;
                        #elif UNITY_IOS
            pluginAPI = desc.iOS_InAppPurchaseAPI;
                        #elif UNITY_ANDROID
            pluginAPI = desc.Android_InAppPurchaseAPI;
                        #elif UNITY_BLACKBERRY
            pluginAPI = desc.BB10_InAppPurchaseAPI;
                        #else
            pluginAPI = InAppPurchaseAPIs.None;
                        #endif

            this.createdCallback = createdCallback;
            plugin = InAppPurchaseAPI.New(desc, async_CreatedCallback);
        }
Пример #5
0
 private static void init_MicrosoftStore_InAppPurchasePlugin(MicrosoftStore_InAppPurchasePlugin_WinRT plugin, InAppPurchaseDesc desc, InAppPurchaseCreatedCallbackMethod createdCallback)
 {
     plugin.Native = new MicrosoftStore_InAppPurchasePlugin_Native(desc, createdCallback);
 }
Пример #6
0
	void Start()
	{
		// bind button events
		BuyDurableButton.Select();
		BuyDurableButton.onClick.AddListener(buyDurableClicked);
		BuyConsumableButton.onClick.AddListener(buyConsumableClicked);
		RestoreButton.onClick.AddListener(restoreClicked);
		GetPriceInfoButton.onClick.AddListener(getPriceInfoClicked);
		BackButton.onClick.AddListener(backClicked);

		// make sure we don't init the same IAP items twice
		if (created) return;
		created = true;

		// InApp-Purchases - NOTE: you can set different "In App IDs" for each platform.
		var inAppIDs = new InAppPurchaseID[3];
		inAppIDs[0] = new InAppPurchaseID(item1, 1.99m, "$", InAppPurchaseTypes.NonConsumable);
		inAppIDs[1] = new InAppPurchaseID(item2, 0.99m, "$", InAppPurchaseTypes.NonConsumable);
		inAppIDs[2] = new InAppPurchaseID(item3, 2.49m, "$", InAppPurchaseTypes.Consumable);
		
		// create desc object
		var desc = new InAppPurchaseDesc();

		// Global
		desc.Testing = true;
		desc.ClearNativeCache = false;
			
		// Editor
		desc.Editor_InAppIDs = inAppIDs;
			
		// WinRT
		desc.WinRT_InAppPurchaseAPI = InAppPurchaseAPIs.MicrosoftStore;
		desc.WinRT_MicrosoftStore_InAppIDs = inAppIDs;
			
		// WP8
		desc.WP8_InAppPurchaseAPI = InAppPurchaseAPIs.MicrosoftStore;
		desc.WP8_MicrosoftStore_InAppIDs = inAppIDs;
			
		// BB10
		desc.BB10_InAppPurchaseAPI = InAppPurchaseAPIs.BlackBerryWorld;
		desc.BB10_BlackBerryWorld_InAppIDs = inAppIDs;
			
		// iOS
		desc.iOS_InAppPurchaseAPI = InAppPurchaseAPIs.AppleStore;
		desc.iOS_AppleStore_InAppIDs = inAppIDs;
		desc.iOS_AppleStore_SharedSecretKey = "";// NOTE: Must set SharedSecretKey, even for Testing!
			
		// Android
		// Choose for either GooglePlay or Amazon.
		// NOTE: Use "player settings" to define compiler directives.
		#if AMAZON
		desc.Android_InAppPurchaseAPI = InAppPurchaseAPIs.Amazon;
		#elif SAMSUNG
		desc.Android_InAppPurchaseAPI = InAppPurchaseAPIs.Samsung;
		#else
		desc.Android_InAppPurchaseAPI = InAppPurchaseAPIs.GooglePlay;
		#endif

		desc.Android_GooglePlay_InAppIDs = inAppIDs;
		desc.Android_GooglePlay_Base64Key = "";// NOTE: Must set Base64Key for GooglePlay in Apps to work, even for Testing!
		desc.Android_Amazon_InAppIDs = inAppIDs;
		desc.Android_Samsung_InAppIDs = inAppIDs;
		desc.Android_Samsung_ItemGroupID = "";

		// init
		InAppPurchaseManager.Init(desc, createdCallback);
	}
Пример #7
0
		private static void init_MicrosoftStore_InAppPurchasePlugin(MicrosoftStore_InAppPurchasePlugin_WinRT plugin, InAppPurchaseDesc desc, InAppPurchaseCreatedCallbackMethod createdCallback)
		{
			#if !WINRT_DISABLE_MS_IAP
			plugin.Native = new MicrosoftStore_InAppPurchasePlugin_Native(desc, createdCallback);
			#endif
		}
		/// <summary>
		/// Use to init a multiple IAP systems.
		/// </summary>
		/// <param name="desc">IAP Desc.</param>
		/// <param name="createdCallback">The callback that fires when done.</param>
		/// <returns>Returns array of IAP API objects</returns>
		public static InAppAPI[] Init(InAppPurchaseDesc[] descs, InAppPurchaseCreatedCallbackMethod createdCallback)
		{
			var inAppAPIs = new InAppAPI[descs.Length];
			for (int i = 0; i != descs.Length; ++i)
			{
				inAppAPIs[i] = new InAppAPI();
				inAppAPIs[i].init(descs[i], createdCallback);
			}

			return inAppAPIs;
		}
		/// <summary>
		/// Use to init a single IAP system.
		/// </summary>
		/// <param name="desc">IAP Desc.</param>
		/// <param name="createdCallback">The callback that fires when done.</param>
		/// <returns>Returns IAP API object</returns>
		public static InAppAPI Init(InAppPurchaseDesc desc, InAppPurchaseCreatedCallbackMethod createdCallback)
		{
			InAppAPIs = new InAppAPI[1];
			InAppAPIs[0] = new InAppAPI();
			InAppAPIs[0].init(desc, createdCallback);
			return InAppAPIs[0];
		}
		/// <summary>
		/// Use to init the IAP system.
		/// NOTE: This method is normaly used when you don't have any IAP items and only want to check if the app is in trial mode.
		/// </summary>
		/// <param name="testTrialMode">Set true to test trial mode.</param>
		/// <param name="createdCallback">The callback that gets fired when done.</param>
		/// <returns>Returns IAP API object</returns>
		public static InAppAPI Init(bool testTrialMode, InAppPurchaseCreatedCallbackMethod createdCallback)
		{
			var desc = new InAppPurchaseDesc()
			{
				Testing = testTrialMode,
				TestTrialMode = testTrialMode
			};
			return Init(desc, createdCallback);
		}
Пример #11
0
 private static void init_MicrosoftStore_InAppPurchasePlugin(MicrosoftStore_InAppPurchasePlugin_WinRT plugin, InAppPurchaseDesc desc, InAppPurchaseCreatedCallbackMethod createdCallback)
 {
                 #if !WINRT_DISABLE_MS_IAP
     plugin.Native = new MicrosoftStore_InAppPurchasePlugin_Native(desc, createdCallback);
                 #endif
 }
Пример #12
0
		private static void init_MicrosoftStore_InAppPurchasePlugin(MicrosoftStore_InAppPurchasePlugin_WinRT plugin, InAppPurchaseDesc desc, InAppPurchaseCreatedCallbackMethod createdCallback)
		{
			plugin.Native = new MicrosoftStore_InAppPurchasePlugin_Native(desc, createdCallback);
		}