コード例 #1
0
		private async void init(InterstitialAdDesc desc, InterstitialAdCreatedCallbackMethod createdCallback)
		{
			bool pass = true;
			try
			{
				eventCallback = desc.EventCallback;
				unitID = desc.WP8_AdDuplex_UnitID;
				testing = desc.Testing;
			}
			catch (Exception e)
			{
				Debug.LogError(e.Message);
				pass = false;
			}

			if (!initialized && pass)
			{
				initialized = true;
				await WinRTPlugin.CoreWindow.Dispatcher.RunAsync(CoreDispatcherPriority.Normal, delegate()
				{
					AdDuplexClient.Initialize(desc.WP8_AdDuplex_ApplicationKey);
					UnityEngine.WSA.Application.InvokeOnAppThread(()=>
					{
						if (createdCallback != null) createdCallback(pass);
					}, false);
				});
			}
			else
			{
				if (createdCallback != null) createdCallback(pass);
			}
		}
コード例 #2
0
        /// <summary>
        /// Use to create multiple Ads.
        /// </summary>
        /// <param name="descs">Your AdDesc settings.</param>
        /// <param name="createdCallback">The callback that fires when done.</param>
        /// <returns>Returns array of Ad objects</returns>
        public static InterstitialAd[] CreateAd(InterstitialAdDesc[] descs, InterstitialAdCreatedCallbackMethod createdCallback)
        {
            if (creatingAds)
            {
                Debug.LogError("You must wait for the last interstitial ads to finish being created!");
                if (createdCallback != null)
                {
                    createdCallback(false);
                }
                return(null);
            }
            creatingAds = true;
            InterstitialAdManager.createdCallback = createdCallback;

            int startLength = plugins.Count;

            for (int i = 0; i != descs.Length; ++i)
            {
                plugins.Add(InterstitialAdPluginAPI.New(descs[i], async_CreatedCallback));
            }

            var ads = new InterstitialAd[descs.Length];

            for (int i = 0, i2 = startLength; i != descs.Length; ++i, ++i2)
            {
                ads[i] = new InterstitialAd(plugins[i2]);
            }
            return(ads);
        }
コード例 #3
0
		public InterstitialAdPlugin(InterstitialAdDesc desc, InterstitialAdCreatedCallbackMethod callback)
		{
			bool pass = true;
			try
			{
				eventCallback = desc.EventCallback;
				this.desc = desc;

				if (!desc.UseClassicGUI)
				{
					// Create Ad Canvas
					adCanvas = new GameObject("Editor Interstitial Ad");
					GameObject.DontDestroyOnLoad(adCanvas);
					adCanvas.AddComponent<RectTransform>();
					var canvas = adCanvas.AddComponent<Canvas>();
					canvas.renderMode = RenderMode.ScreenSpaceOverlay;
					canvas.sortingOrder = desc.UnityUI_SortIndex;
					adCanvas.AddComponent<CanvasScaler>();
					adCanvas.AddComponent<GraphicRaycaster>();
					adCanvas.SetActive(false);

					// Create ad
					var ad = new GameObject("AdButtonImage");
					ad.transform.parent = adCanvas.transform;
					adRect = ad.AddComponent<RectTransform>();
					var image = ad.AddComponent<Image>();
					image.sprite = Resources.Load<Sprite>("Reign/Ads/DemoInterstitialAd");
					image.preserveAspect = false;
					var button = ad.AddComponent<Button>();
					button.onClick.AddListener(adClicked);

					adRect.anchorMin = new Vector2(.1f, .1f);
					adRect.anchorMax = new Vector2(.9f, .9f);
					adRect.offsetMin = Vector2.zero;
					adRect.offsetMax = Vector2.zero;

					// close box
					var closeBox = new GameObject("AdButtonImage");
					closeBox.transform.parent = ad.transform;
					adRect = closeBox.AddComponent<RectTransform>();
					image = closeBox.AddComponent<Image>();
					image.sprite = Resources.Load<Sprite>("Reign/Ads/CloseBox");
					image.preserveAspect = false;
					button = closeBox.AddComponent<Button>();
					button.onClick.AddListener(adClosed);

					adRect.anchorMin = new Vector2(.9f, .9f);
					adRect.anchorMax = new Vector2(1, 1);
					adRect.offsetMin = Vector2.zero;
					adRect.offsetMax = Vector2.zero;
				}
			}
			catch (Exception e)
			{
				Debug.LogError(e.Message);
				pass = false;
			}
			
			if (callback != null) callback(pass);
		}
コード例 #4
0
 /// <summary>
 /// Dumy constructor.
 /// </summary>
 /// <param name="desc"></param>
 /// <param name="createdCallback"></param>
 public Dumy_InterstitialAdPlugin(InterstitialAdDesc desc, InterstitialAdCreatedCallbackMethod createdCallback)
 {
     eventCallback = desc.EventCallback;
     if (createdCallback != null)
     {
         createdCallback(true);
     }
 }
コード例 #5
0
        public Amazon_InterstitialAdPlugin_Android(InterstitialAdDesc desc, InterstitialAdCreatedCallbackMethod createdCallback)
		{
			this.createdCallback = createdCallback;
			try
			{
				eventCallback = desc.EventCallback;
				native = new AndroidJavaClass("com.reignstudios.reignnativeamazon.Amazon_InterstitialAdNative");
				id = Guid.NewGuid().ToString();
				native.CallStatic("CreateAd", desc.Android_Amazon_ApplicationKey, desc.Testing, id);
			}
			catch (Exception e)
			{
				Debug.LogError(e.Message);
				if (createdCallback != null) createdCallback(false);
			}
		}
コード例 #6
0
		public AdMob_InterstitialAdPlugin_Native(InterstitialAdDesc desc, InterstitialAdCreatedCallbackMethod createdCallback)
		{
			bool pass = true;
			try
			{
				eventCallback = desc.EventCallback;
				unitID = desc.WP8_AdMob_UnitID;
				testing = desc.Testing;
			}
			catch (Exception e)
			{
				Debug.LogError(e.Message);
				pass = false;
			}

			if (createdCallback != null) createdCallback(pass);
		}
コード例 #7
0
        /// <summary>
        /// Use to create a single Ad.
        /// </summary>
        /// <param name="desc">Your AdDesc settings.</param>
        /// <param name="createdCallback">The callback that fires when done.</param>
        /// <returns>Returns Ad object</returns>
        public static InterstitialAd CreateAd(InterstitialAdDesc desc, InterstitialAdCreatedCallbackMethod createdCallback)
        {
            if (creatingAds)
            {
                Debug.LogError("You must wait for the last interstitial ad to finish being created!");
                if (createdCallback != null)
                {
                    createdCallback(false);
                }
                return(null);
            }
            creatingAds = true;
            InterstitialAdManager.createdCallback = createdCallback;
            plugins.Add(InterstitialAdPluginAPI.New(desc, async_CreatedCallback));

            return(new InterstitialAd(plugins[plugins.Count - 1]));
        }
コード例 #8
0
		public DFP_InterstitialAdPlugin_iOS (InterstitialAdDesc desc, InterstitialAdCreatedCallbackMethod callback)
		{
			bool pass = true;
			try
			{
				eventCallback = desc.EventCallback;
				native = DFP_Interstitial_InitAd(desc.Testing);

				DFP_Interstitial_CreateAd(native, desc.iOS_DFP_UnitID);
			}
			catch (Exception e)
			{
				Debug.LogError(e.Message);
				pass = false;
			}

			if (callback != null) callback(pass);
		}
コード例 #9
0
 public Amazon_InterstitialAdPlugin_Android(InterstitialAdDesc desc, InterstitialAdCreatedCallbackMethod createdCallback)
 {
     this.createdCallback = createdCallback;
     try
     {
         eventCallback = desc.EventCallback;
         native        = new AndroidJavaClass("com.reignstudios.reignnative.Amazon_InterstitialAdNative");
         id            = Guid.NewGuid().ToString();
         native.CallStatic("CreateAd", desc.Android_Amazon_ApplicationKey, desc.Testing, id);
     }
     catch (Exception e)
     {
         Debug.LogError(e.Message);
         if (createdCallback != null)
         {
             createdCallback(false);
         }
     }
 }
コード例 #10
0
        private async void init(InterstitialAdDesc desc, InterstitialAdCreatedCallbackMethod createdCallback)
        {
            bool pass = true;

            try
            {
                eventCallback = desc.EventCallback;
                unitID        = desc.WP8_AdDuplex_UnitID;
                testing       = desc.Testing;
            }
            catch (Exception e)
            {
                Debug.LogError(e.Message);
                pass = false;
            }

            if (!initialized && pass)
            {
                initialized = true;
                await WinRTPlugin.CoreWindow.Dispatcher.RunAsync(CoreDispatcherPriority.Normal, delegate()
                {
                    AdDuplexClient.Initialize(desc.WP8_AdDuplex_ApplicationKey);
                    ReignServices.InvokeOnUnityThread(delegate
                    {
                        if (createdCallback != null)
                        {
                            createdCallback(pass);
                        }
                    });
                });
            }
            else
            {
                ReignServices.InvokeOnUnityThread(delegate
                {
                    if (createdCallback != null)
                    {
                        createdCallback(pass);
                    }
                });
            }
        }
コード例 #11
0
		public AdMob_InterstitialAdPlugin_iOS (InterstitialAdDesc desc, InterstitialAdCreatedCallbackMethod callback)
		{
			#if !IOS_DISABLE_GOOGLE_ADS
			bool pass = true;
			try
			{
				eventCallback = desc.EventCallback;
				native = AdMob_Interstitial_InitAd(desc.Testing);
				
				AdMob_Interstitial_CreateAd(native, desc.iOS_AdMob_UnitID);
			}
			catch (Exception e)
			{
				Debug.LogError(e.Message);
				pass = false;
			}
			
			if (callback != null) callback(pass);
			#endif
		}
コード例 #12
0
        public AdMob_InterstitialAdPlugin_Native(InterstitialAdDesc desc, InterstitialAdCreatedCallbackMethod createdCallback)
        {
            bool pass = true;

            try
            {
                eventCallback = desc.EventCallback;
                unitID        = desc.WP8_AdMob_UnitID;
                testing       = desc.Testing;
            }
            catch (Exception e)
            {
                Debug.LogError(e.Message);
                pass = false;
            }

            if (createdCallback != null)
            {
                createdCallback(pass);
            }
        }
コード例 #13
0
        public DFP_InterstitialAdPlugin_iOS(InterstitialAdDesc desc, InterstitialAdCreatedCallbackMethod callback)
        {
            bool pass = true;

            try
            {
                eventCallback = desc.EventCallback;
                native        = DFP_Interstitial_InitAd(desc.Testing);

                DFP_Interstitial_CreateAd(native, desc.iOS_DFP_UnitID);
            }
            catch (Exception e)
            {
                Debug.LogError(e.Message);
                pass = false;
            }

            if (callback != null)
            {
                callback(pass);
            }
        }
コード例 #14
0
        public AdMob_InterstitialAdPlugin_iOS(InterstitialAdDesc desc, InterstitialAdCreatedCallbackMethod callback)
        {
                        #if !IOS_DISABLE_GOOGLE_ADS
            bool pass = true;
            try
            {
                eventCallback = desc.EventCallback;
                native        = AdMob_Interstitial_InitAd(desc.Testing);

                AdMob_Interstitial_CreateAd(native, desc.iOS_AdMob_UnitID);
            }
            catch (Exception e)
            {
                Debug.LogError(e.Message);
                pass = false;
            }

            if (callback != null)
            {
                callback(pass);
            }
                        #endif
        }
コード例 #15
0
        public InterstitialAdPlugin(InterstitialAdDesc desc, InterstitialAdCreatedCallbackMethod callback)
        {
            bool pass = true;

            try
            {
                eventCallback = desc.EventCallback;
                this.desc     = desc;

                if (!desc.UseClassicGUI)
                {
                    // Create Ad Canvas
                    adCanvas = new GameObject("Editor Interstitial Ad");
                    GameObject.DontDestroyOnLoad(adCanvas);
                    adCanvas.AddComponent <RectTransform>();
                    var canvas = adCanvas.AddComponent <Canvas>();
                    canvas.renderMode   = RenderMode.ScreenSpaceOverlay;
                    canvas.sortingOrder = desc.UnityUI_SortIndex;
                    adCanvas.AddComponent <CanvasScaler>();
                    adCanvas.AddComponent <GraphicRaycaster>();
                    adCanvas.SetActive(false);

                    // Create ad
                    var ad = new GameObject("AdButtonImage");
                    ad.transform.parent = adCanvas.transform;
                    adRect = ad.AddComponent <RectTransform>();
                    var image = ad.AddComponent <Image>();
                    image.sprite         = Resources.Load <Sprite>("Reign/Ads/DemoInterstitialAd");
                    image.preserveAspect = false;
                    var button = ad.AddComponent <Button>();
                    button.onClick.AddListener(adClicked);

                    adRect.anchorMin = new Vector2(.1f, .1f);
                    adRect.anchorMax = new Vector2(.9f, .9f);
                    adRect.offsetMin = Vector2.zero;
                    adRect.offsetMax = Vector2.zero;

                    // close box
                    var closeBox = new GameObject("AdButtonImage");
                    closeBox.transform.parent = ad.transform;
                    adRect               = closeBox.AddComponent <RectTransform>();
                    image                = closeBox.AddComponent <Image>();
                    image.sprite         = Resources.Load <Sprite>("Reign/Ads/CloseBox");
                    image.preserveAspect = false;
                    button               = closeBox.AddComponent <Button>();
                    button.onClick.AddListener(adClosed);

                    adRect.anchorMin = new Vector2(.9f, .9f);
                    adRect.anchorMax = new Vector2(1, 1);
                    adRect.offsetMin = Vector2.zero;
                    adRect.offsetMax = Vector2.zero;
                }
            }
            catch (Exception e)
            {
                Debug.LogError(e.Message);
                pass = false;
            }

            if (callback != null)
            {
                callback(pass);
            }
        }
コード例 #16
0
		/// <summary>
		/// Used by the Reign plugin.
		/// </summary>
		/// <param name="desc">The Ad desc.</param>
		/// <param name="callback">The callback fired when done.</param>
		/// <returns>Returns Ad plugin interface</returns>
		public static IInterstitialAdPlugin New(InterstitialAdDesc desc, InterstitialAdCreatedCallbackMethod callback)
		{
			#if DISABLE_REIGN
			return new Dumy_InterstitialAdPlugin(desc, callback);
			#elif UNITY_EDITOR
			return new InterstitialAdPlugin(desc, callback);
			#elif UNITY_WP8
			if (desc.WP8_AdAPI == InterstitialAdAPIs.None) return new Dumy_InterstitialAdPlugin(desc, callback);
			else if (desc.WP8_AdAPI == InterstitialAdAPIs.AdMob) return new AdMob_InterstitialAdPlugin_WP8(desc, callback);
			else throw new Exception("Unsuported WP8_AdAPI: " + desc.WP8_AdAPI);
			#elif UNITY_METRO
			if (desc.WinRT_AdAPI == InterstitialAdAPIs.AdDuplex) return new AdDuplex_InterstitialAdPlugin_WinRT(desc, callback);
			else throw new Exception("Unsuported WinRT_AdAPI: " + desc.WinRT_AdAPI);
			#elif UNITY_IOS
			if (desc.iOS_AdAPI == InterstitialAdAPIs.None) return new Dumy_InterstitialAdPlugin(desc, callback);
			else if (desc.iOS_AdAPI == InterstitialAdAPIs.AdMob) return new AdMob_InterstitialAdPlugin_iOS(desc, callback);
			else if (desc.iOS_AdAPI == InterstitialAdAPIs.DFP) return new DFP_InterstitialAdPlugin_iOS(desc, callback);
			else throw new Exception("Unsuported iOS_AdAPI: " + desc.iOS_AdAPI);
			#elif UNITY_ANDROID
			if (desc.Android_AdAPI == InterstitialAdAPIs.None) return new Dumy_InterstitialAdPlugin(desc, callback);
			else if (desc.Android_AdAPI == InterstitialAdAPIs.AdMob) return new AdMob_InterstitialAdPlugin_Android(desc, callback);
			else if (desc.Android_AdAPI == InterstitialAdAPIs.DFP) return new DFP_InterstitialAdPlugin_Android(desc, callback);
			else if (desc.Android_AdAPI == InterstitialAdAPIs.Amazon) return new Amazon_InterstitialAdPlugin_Android(desc, callback);
			else throw new Exception("Unsuported Android_AdAPI: " + desc.Android_AdAPI);
			#else
			return new Dumy_InterstitialAdPlugin(desc, callback);
			#endif
		}
コード例 #17
0
		/// <summary>
		/// Dumy constructor.
		/// </summary>
		/// <param name="desc"></param>
		/// <param name="createdCallback"></param>
		public Dumy_InterstitialAdPlugin(InterstitialAdDesc desc, InterstitialAdCreatedCallbackMethod createdCallback)
		{
			eventCallback = desc.EventCallback;
			if (createdCallback != null) createdCallback(true);
		}
コード例 #18
0
 public AdMob_InterstitialAdPlugin_WP8(InterstitialAdDesc desc, InterstitialAdCreatedCallbackMethod createdCallback)
 {
     InitNative(this, desc, createdCallback);
 }
コード例 #19
0
		private static void init_AdMob_InterstitialAdPlugin(AdMob_InterstitialAdPlugin_WP8 plugin, InterstitialAdDesc desc, InterstitialAdCreatedCallbackMethod createdCallback)
		{
			plugin.Native = new AdMob_InterstitialAdPlugin_Native(desc, createdCallback);
		}
コード例 #20
0
		private static void init_AdDuplex_InterstitialAdPlugin(AdDuplex_InterstitialAdPlugin_WinRT plugin, InterstitialAdDesc desc, InterstitialAdCreatedCallbackMethod createdCallback)
		{
			#if UNITY_WP_8_1 && !WINRT_DISABLE_ADDUPLEX_ADS
			plugin.Native = new AdDuplex_InterstitialAdPlugin_Native(desc, createdCallback);
			#else
			plugin.Native = new Dumy_InterstitialAdPlugin(desc, createdCallback);
			#endif
		}
コード例 #21
0
 private static void init_AdMob_InterstitialAdPlugin(AdMob_InterstitialAdPlugin_WP8 plugin, InterstitialAdDesc desc, InterstitialAdCreatedCallbackMethod createdCallback)
 {
                 #if !WINRT_DISABLE_GOOGLE_ADS
     plugin.Native = new AdMob_InterstitialAdPlugin_Native(desc, createdCallback);
                 #endif
 }
コード例 #22
0
		public AdDuplex_InterstitialAdPlugin_Native(InterstitialAdDesc desc, InterstitialAdCreatedCallbackMethod createdCallback)
		{
			init(desc, createdCallback);
		}
コード例 #23
0
		private static void init_AdMob_InterstitialAdPlugin(AdMob_InterstitialAdPlugin_WP8 plugin, InterstitialAdDesc desc, InterstitialAdCreatedCallbackMethod createdCallback)
		{
			#if !WINRT_DISABLE_GOOGLE_ADS
			plugin.Native = new AdMob_InterstitialAdPlugin_Native(desc, createdCallback);
			#endif
		}
コード例 #24
0
		public AdDuplex_InterstitialAdPlugin_WinRT(InterstitialAdDesc desc, InterstitialAdCreatedCallbackMethod createdCallback)
		{
			InitNative(this, desc, createdCallback);
		}
コード例 #25
0
 public AdDuplex_InterstitialAdPlugin_Native(InterstitialAdDesc desc, InterstitialAdCreatedCallbackMethod createdCallback)
 {
     init(desc, createdCallback);
 }
コード例 #26
0
		/// <summary>
		/// Use to create multiple Ads.
		/// </summary>
		/// <param name="descs">Your AdDesc settings.</param>
		/// <param name="createdCallback">The callback that fires when done.</param>
		/// <returns>Returns array of Ad objects</returns>
		public static InterstitialAd[] CreateAd(InterstitialAdDesc[] descs, InterstitialAdCreatedCallbackMethod createdCallback)
		{
			if (creatingAds)
			{
				Debug.LogError("You must wait for the last interstitial ads to finish being created!");
				if (createdCallback != null) createdCallback(false);
				return null;
			}
			creatingAds = true;
			InterstitialAdManager.createdCallback = createdCallback;

			int startLength = plugins.Count;
			for (int i = 0; i != descs.Length; ++i) plugins.Add(InterstitialAdPluginAPI.New(descs[i], async_CreatedCallback));
			
			var ads = new InterstitialAd[descs.Length];
			for (int i = 0, i2 = startLength; i != descs.Length; ++i, ++i2) ads[i] = new InterstitialAd(plugins[i2]);
			return ads;
		}
コード例 #27
0
 private static void init_AdDuplex_InterstitialAdPlugin(AdDuplex_InterstitialAdPlugin_WinRT plugin, InterstitialAdDesc desc, InterstitialAdCreatedCallbackMethod createdCallback)
 {
                 #if UNITY_WP_8_1
     plugin.Native = new AdDuplex_InterstitialAdPlugin_Native(desc, createdCallback);
                 #else
     plugin.Native = new Dumy_InterstitialAdPlugin(desc, createdCallback);
                 #endif
 }
コード例 #28
0
 public AdDuplex_InterstitialAdPlugin_WinRT(InterstitialAdDesc desc, InterstitialAdCreatedCallbackMethod createdCallback)
 {
     InitNative(this, desc, createdCallback);
 }
コード例 #29
0
 /// <summary>
 /// Used by the Reign plugin.
 /// </summary>
 /// <param name="desc">The Ad desc.</param>
 /// <param name="callback">The callback fired when done.</param>
 /// <returns>Returns Ad plugin interface</returns>
 public static IInterstitialAdPlugin New(InterstitialAdDesc desc, InterstitialAdCreatedCallbackMethod callback)
 {
                 #if DISABLE_REIGN
     return(new Dumy_InterstitialAdPlugin(desc, callback));
                 #elif UNITY_EDITOR
     return(new InterstitialAdPlugin(desc, callback));
                 #elif UNITY_WP8
     if (desc.WP8_AdAPI == InterstitialAdAPIs.None)
     {
         return(new Dumy_InterstitialAdPlugin(desc, callback));
     }
     else if (desc.WP8_AdAPI == InterstitialAdAPIs.AdMob)
     {
         return(new AdMob_InterstitialAdPlugin_WP8(desc, callback));
     }
     else
     {
         throw new Exception("Unsuported WP8_AdAPI: " + desc.WP8_AdAPI);
     }
                 #elif UNITY_METRO
     if (desc.WinRT_AdAPI == InterstitialAdAPIs.AdDuplex)
     {
         return(new AdDuplex_InterstitialAdPlugin_WinRT(desc, callback));
     }
     else
     {
         throw new Exception("Unsuported WinRT_AdAPI: " + desc.WinRT_AdAPI);
     }
                 #elif UNITY_IOS
     if (desc.iOS_AdAPI == InterstitialAdAPIs.None)
     {
         return(new Dumy_InterstitialAdPlugin(desc, callback));
     }
     else if (desc.iOS_AdAPI == InterstitialAdAPIs.AdMob)
     {
         return(new AdMob_InterstitialAdPlugin_iOS(desc, callback));
     }
     else if (desc.iOS_AdAPI == InterstitialAdAPIs.DFP)
     {
         return(new DFP_InterstitialAdPlugin_iOS(desc, callback));
     }
     else
     {
         throw new Exception("Unsuported iOS_AdAPI: " + desc.iOS_AdAPI);
     }
                 #elif UNITY_ANDROID
     if (desc.Android_AdAPI == InterstitialAdAPIs.None)
     {
         return(new Dumy_InterstitialAdPlugin(desc, callback));
     }
     else if (desc.Android_AdAPI == InterstitialAdAPIs.AdMob)
     {
         return(new AdMob_InterstitialAdPlugin_Android(desc, callback));
     }
     else if (desc.Android_AdAPI == InterstitialAdAPIs.DFP)
     {
         return(new DFP_InterstitialAdPlugin_Android(desc, callback));
     }
     else if (desc.Android_AdAPI == InterstitialAdAPIs.Amazon)
     {
         return(new Amazon_InterstitialAdPlugin_Android(desc, callback));
     }
     else
     {
         throw new Exception("Unsuported Android_AdAPI: " + desc.Android_AdAPI);
     }
                 #else
     return(new Dumy_InterstitialAdPlugin(desc, callback));
                 #endif
 }
コード例 #30
0
		public AdMob_InterstitialAdPlugin_WP8(InterstitialAdDesc desc, InterstitialAdCreatedCallbackMethod createdCallback)
		{
			InitNative(this, desc, createdCallback);
		}
コード例 #31
0
 private static void init_AdMob_InterstitialAdPlugin(AdMob_InterstitialAdPlugin_WP8 plugin, InterstitialAdDesc desc, InterstitialAdCreatedCallbackMethod createdCallback)
 {
     plugin.Native = new AdMob_InterstitialAdPlugin_Native(desc, createdCallback);
 }
コード例 #32
0
		/// <summary>
		/// Use to create a single Ad.
		/// </summary>
		/// <param name="desc">Your AdDesc settings.</param>
		/// <param name="createdCallback">The callback that fires when done.</param>
		/// <returns>Returns Ad object</returns>
		public static InterstitialAd CreateAd(InterstitialAdDesc desc, InterstitialAdCreatedCallbackMethod createdCallback)
		{
			if (creatingAds)
			{
				Debug.LogError("You must wait for the last interstitial ad to finish being created!");
				if (createdCallback != null) createdCallback(false);
				return null;
			}
			creatingAds = true;
			InterstitialAdManager.createdCallback = createdCallback;
			plugins.Add(InterstitialAdPluginAPI.New(desc, async_CreatedCallback));
			
			return new InterstitialAd(plugins[plugins.Count-1]);
		}