Example #1
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 Ad CreateAd(AdDesc desc, AdCreatedCallbackMethod createdCallback)
        {
            if (creatingAds)
            {
                Debug.LogError("You must wait for the last ad to finish being created!");
                if (createdCallback != null)
                {
                    createdCallback(false);
                }
                return(null);
            }
            creatingAds = true;
            AdManager.createdCallback = createdCallback;
            plugins.Add(AdPluginAPI.New(desc, async_CreatedCallback));

            return(new Ad(plugins[plugins.Count - 1]));
        }
 private static void init_AdMob_AdPlugin(AdMob_AdPlugin_WP8 plugin, AdDesc desc, AdCreatedCallbackMethod createdCallback)
 {
     plugin.Native = new AdMob_AdPlugin_Native(desc, createdCallback);
 }
 private static void init_MicrosoftAdvertising_AdPlugin(MicrosoftAdvertising_AdPlugin_WinRT plugin, AdDesc desc, AdCreatedCallbackMethod createdCallback)
 {
     plugin.Native = new MicrosoftAdvertising_AdPlugin_Native(desc, createdCallback);
 }
Example #4
0
	// -----------------------------------------------
	// NOTE: You can set up multiple platforms at once and the API will use the correct desc data for each
	// -----------------------------------------------
	void Start()
	{
		singleton = this;

		// bind button events
		RefreshButton.Select();
		RefreshButton.onClick.AddListener(refreshClicked);
		VisibilityButton.onClick.AddListener(visibilityClicked);
		BackButton.onClick.AddListener(backClicked);

		// make sure we don't init the same Ad twice
		if (created)
		{
			if (ad != null) ad.Visible = true;
			return;
		}
		created = true;

		// Ads - NOTE: You can pass in multiple "AdDesc" objects if you want more then one ad.
		var desc = new AdDesc();

		// global settings
		desc.Testing = true;// NOTE: To test ads on iOS, you must enable them in iTunes Connect.
		desc.Visible = true;
		desc.EventCallback = eventCallback;
		desc.UseClassicGUI = false;
		desc.GUIOverrideEnabled = false;
		desc.UnityUI_SortIndex = 1000;

		// Editor
		desc.Editor_AdAPI = AdAPIs.EditorTestAd;
		desc.Editor_AdGravity = AdGravity.BottomCenter;
		desc.Editor_AdScale = 1.5f;
		//desc.Editor_FixedWidthOverride = 250;
		//desc.Editor_FixedHeightOverride = 64;

		desc.Editor_MillennialMediaAdvertising_APID = "";
		desc.Editor_MillennialMediaAdvertising_AdGravity = AdGravity.BottomCenter;
		//desc.Editor_MillennialMediaAdvertising_RefreshRate = 120,

		// WinRT settings (Windows 8.0 & 8.1)
		desc.WinRT_AdAPI = AdAPIs.MicrosoftAdvertising;// NOTE: If building for WP 8.1 or Universal targets this value is used. All other WinRT values or used for Win8
		desc.WinRT_MicrosoftAdvertising_ApplicationID = "";
		desc.WinRT_MicrosoftAdvertising_UnitID = "";
		desc.WinRT_MicrosoftAdvertising_AdGravity = AdGravity.BottomCenter;
		desc.WinRT_MicrosoftAdvertising_AdSize = WinRT_MicrosoftAdvertising_AdSize.Wide_728x90;
		//desc.WinRT_MicrosoftAdvertising_UseBuiltInRefresh = false;
		//desc.WinRT_MicrosoftAdvertising_RefreshRate = 120;

		desc.WinRT_AdDuplex_ApplicationKey = "";
		desc.WinRT_AdDuplex_UnitID = "";
		desc.WinRT_AdDuplex_AdGravity = AdGravity.BottomCenter;
		desc.WinRT_AdDuplex_AdSize = WinRT_AdDuplex_AdSize.Wide_728x90;
		//desc.WinRT_AdDuplex_RefreshRate = 120;
			
		// WP8 settings (Windows Phone 8.0 & 8.1)
		desc.WP8_AdAPI = AdAPIs.MicrosoftAdvertising;// 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_MicrosoftAdvertising_ApplicationID = "";
		desc.WP8_MicrosoftAdvertising_UnitID = "";
		desc.WP8_MicrosoftAdvertising_AdGravity = AdGravity.BottomCenter;
		desc.WP8_MicrosoftAdvertising_AdSize = WP8_MicrosoftAdvertising_AdSize.Wide_480x80;
		//desc.WP8_MicrosoftAdvertising_UseBuiltInRefresh = false;
		//desc.WP8_MicrosoftAdvertising_RefreshRate = 120;

		desc.WP8_AdDuplex_ApplicationKey = "";
		desc.WP8_AdDuplex_UnitID = "";
		desc.WP8_AdDuplex_AdGravity = AdGravity.BottomCenter;
		//desc.WP8_AdDuplex_RefreshRate = 120;
			
		desc.WP8_AdMob_UnitID = "";// NOTE: You MUST have this even for Testing!
		desc.WP8_AdMob_AdGravity = AdGravity.BottomCenter;
		desc.WP8_AdMob_AdSize = Reign.WP8_AdMob_AdSize.Banner;
			
		// BB10 settings
		desc.BB10_AdAPI = AdAPIs.MillennialMediaAdvertising;
		desc.BB10_BlackBerryAdvertising_ZoneID = "";
		desc.BB10_BlackBerryAdvertising_AdGravity = AdGravity.BottomCenter;
		desc.BB10_BlackBerryAdvertising_AdSize = BB10_BlackBerryAdvertising_AdSize.Wide_320x53;

		desc.BB10_MillennialMediaAdvertising_APID = "";
		desc.BB10_MillennialMediaAdvertising_AdGravity = AdGravity.BottomCenter;
		//desc.BB10_MillennialMediaAdvertising_RefreshRate = 120;
		desc.BB10_AdScale = 1.5f;
			
		// iOS settings
		desc.iOS_AdAPI = AdAPIs.iAd;
		desc.iOS_iAd_AdGravity = AdGravity.BottomCenter;
			
		desc.iOS_AdMob_AdGravity = AdGravity.BottomCenter;
		desc.iOS_AdMob_UnitID = "";// NOTE: You can use legacy (PublisherID) too, You MUST have this even for Testing!
		desc.iOS_AdMob_AdSize = iOS_AdMob_AdSize.Banner_320x50;
			
		// Android settings
		#if AMAZON
		desc.Android_AdAPI = AdAPIs.Amazon;// Choose between AdMob or Amazon
		#else
		desc.Android_AdAPI = AdAPIs.AdMob;// Choose between AdMob or Amazon
		#endif
			
		desc.Android_AdMob_UnitID = "";// NOTE: You MUST have this even for Testing!
		desc.Android_AdMob_AdGravity = AdGravity.BottomCenter;
		desc.Android_AdMob_AdSize = Android_AdMob_AdSize.Banner_320x50;
			
		desc.Android_AmazonAds_ApplicationKey = "";
		desc.Android_AmazonAds_AdSize = Android_AmazonAds_AdSize.Wide_320x50;
		desc.Android_AmazonAds_AdGravity = AdGravity.BottomCenter;
		//desc.Android_AmazonAds_RefreshRate = 120;

		// create ad
		ad = AdManager.CreateAd(desc, adCreatedCallback);
	}
Example #5
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 Ad[] CreateAd(AdDesc[] descs, AdCreatedCallbackMethod createdCallback)
		{
			if (creatingAds)
			{
				Debug.LogError("You must wait for the last ads to finish being created!");
				if (createdCallback != null) createdCallback(false);
				return null;
			}
			creatingAds = true;
			AdManager.createdCallback = createdCallback;

			int startLength = plugins.Count;
			for (int i = 0; i != descs.Length; ++i) plugins.Add(AdPluginAPI.New(descs[i], async_CreatedCallback));
			
			var ads = new Ad[descs.Length];
			for (int i = 0, i2 = startLength; i != descs.Length; ++i, ++i2) ads[i] = new Ad(plugins[i2]);
			return ads;
		}
		private static void init_AdMob_AdPlugin(AdMob_AdPlugin_WP8 plugin, AdDesc desc, AdCreatedCallbackMethod createdCallback)
		{
			#if !WINRT_DISABLE_GOOGLE_ADS
			plugin.Native = new AdMob_AdPlugin_Native(desc, createdCallback);
			#endif
		}
Example #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 Ad CreateAd(AdDesc desc, AdCreatedCallbackMethod createdCallback)
		{
			if (creatingAds)
			{
				Debug.LogError("You must wait for the last ad to finish being created!");
				if (createdCallback != null) createdCallback(false);
				return null;
			}
			creatingAds = true;
			AdManager.createdCallback = createdCallback;
			plugins.Add(AdPluginAPI.New(desc, async_CreatedCallback));
			
			return new Ad(plugins[plugins.Count-1]);
		}
		private static void init_MicrosoftAdvertising_AdPlugin(MicrosoftAdvertising_AdPlugin_WinRT plugin, AdDesc desc, AdCreatedCallbackMethod createdCallback)
		{
			#if !WINRT_DISABLE_MS_ADS
			plugin.Native = new MicrosoftAdvertising_AdPlugin_Native(desc, createdCallback);
			#endif
		}
		private static void init_AdDuplex_AdPlugin(AdDuplex_AdPlugin_WinRT plugin, AdDesc desc, AdCreatedCallbackMethod createdCallback)
		{
			#if !WINRT_DISABLE_ADDUPLEX_ADS
			plugin.Native = new AdDuplex_AdPlugin_Native(desc, createdCallback);
			#endif
		}
Example #10
0
 private static void init_AdMob_AdPlugin(AdMob_AdPlugin_WP8 plugin, AdDesc desc, AdCreatedCallbackMethod createdCallback)
 {
                 #if !WINRT_DISABLE_GOOGLE_ADS
     plugin.Native = new AdMob_AdPlugin_Native(desc, createdCallback);
                 #endif
 }
Example #11
0
 private static void init_AdDuplex_AdPlugin(AdDuplex_AdPlugin_WinRT plugin, AdDesc desc, AdCreatedCallbackMethod createdCallback)
 {
                 #if !WINRT_DISABLE_ADDUPLEX_ADS
     plugin.Native = new AdDuplex_AdPlugin_Native(desc, createdCallback);
                 #endif
 }
Example #12
0
 private static void init_MicrosoftAdvertising_AdPlugin(MicrosoftAdvertising_AdPlugin_WinRT plugin, AdDesc desc, AdCreatedCallbackMethod createdCallback)
 {
                 #if !WINRT_DISABLE_MS_ADS
     plugin.Native = new MicrosoftAdvertising_AdPlugin_Native(desc, createdCallback);
                 #endif
 }
		private static void init_AdMob_AdPlugin(AdMob_AdPlugin_WP8 plugin, AdDesc desc, AdCreatedCallbackMethod createdCallback)
		{
			plugin.Native = new AdMob_AdPlugin_Native(desc, createdCallback);
		}
		private static void init_MicrosoftAdvertising_AdPlugin(MicrosoftAdvertising_AdPlugin_WinRT plugin, AdDesc desc, AdCreatedCallbackMethod createdCallback)
		{
			plugin.Native = new MicrosoftAdvertising_AdPlugin_Native(desc, createdCallback);
		}