void Start() { singleton = this; // bind button events CacheAdButton.Select(); CacheAdButton.onClick.AddListener(cacheAdClicked); ShowAdButton.onClick.AddListener(showAdClicked); BackButton.onClick.AddListener(backClicked); // make sure we don't init the same Ad twice if (created) return; created = true; // create add var desc = new InterstitialAdDesc(); // Global desc.Testing = true; desc.EventCallback = eventCallback; desc.UseClassicGUI = false; desc.GUIOverrideEnabled = false; desc.UnityUI_SortIndex = 1001; // WinRT (Windows 8.1) desc.WinRT_AdAPI = InterstitialAdAPIs.AdDuplex;// NOTE: If building for WP 8.1 or Universal targets this value is used. All other WinRT values or used for Win8 // NOTE: Currently no Win8 interstisial API are supported. // WP8 (Windows Phone 8.1) desc.WP8_AdAPI = InterstitialAdAPIs.AdDuplex;// NOTE: If building for WP 8.1 or Universal targets this value is NOT used (Use the WinRT value instead). All other WP8 values are still used for WP 8.0, 8.1 and Universal. desc.WP8_AdMob_UnitID = "";// NOTE: Must set event for testing desc.WP8_AdDuplex_ApplicationKey = "";// NOTE: Must set event for testing desc.WP8_AdDuplex_UnitID = "";// NOTE: Must set event for testing // iOS desc.iOS_AdAPI = InterstitialAdAPIs.AdMob; desc.iOS_AdMob_UnitID = "";// NOTE: Must set event for testing // Android #if AMAZON desc.Android_AdAPI = InterstitialAdAPIs.Amazon; #else desc.Android_AdAPI = InterstitialAdAPIs.AdMob; #endif desc.Android_AdMob_UnitID = "";// NOTE: Must set event for testing desc.Android_Amazon_ApplicationKey = "";// NOTE: Must set event for testing // create ad ad = InterstitialAdManager.CreateAd(desc, createdCallback); }
/// <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])); }
private static void init_AdMob_InterstitialAdPlugin(AdMob_InterstitialAdPlugin_WP8 plugin, InterstitialAdDesc desc, InterstitialAdCreatedCallbackMethod createdCallback) { plugin.Native = new AdMob_InterstitialAdPlugin_Native(desc, createdCallback); }
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 }
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 }
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 }
/// <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; }
/// <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]); }