/// <summary> /// Hide the banner is visible. Do nothing if there are no actived banner /// </summary> public static void HideBanner() { if (instance == null) { return; } StopShowBannerTask(); if (activedBannerUnit == null) { return; } // Looking for banner to hide var providerIds = GetProfileByType(AdType.Banner); foreach (ProviderID id in providerIds) { //CLog.Log("Checking provider " + id); var provider = FindActiveAdProvider(id); if (provider == null) { continue; } if (provider.HideBanner(activedBannerUnit)) { activedBannerUnit = null; //CLog.Log("Hided banner " + id.ToString()); break; } } }
/// <summary> /// Looking for banner by key and show it up. If key has been not set, the first banner will show up. /// Other banners will be hidden if they are visible. It will do nothing if the matched banner is shown ready. /// Note: Recommend only use key NULL if you have single banner unit /// </summary> /// <param name="key">key of banner unit</param> /// <returns>Return true if any banner has shown up.</returns> public static bool ShowBannerIfLoaded(string key = null) { // Not support platform if (instance == null) { return(false); } // Already to show up if (IsActivedBannerUnit(key)) { //CLog.Log("ShowBanner", "Banner is ready for key " + key); return(false); } // Hide the actived banner if (activedBannerUnit != null) { HideBanner(); } // Looking for matched banner and show it up var providerIds = GetProfileByType(AdType.Banner); for (int i = 0; i < providerIds.Count; i++) { ProviderID id = providerIds[i]; var provider = FindActiveAdProvider(id); if (provider == null || !provider.IsSupport(AdType.Banner)) { continue; } activedBannerUnit = provider.ShowBanner(key); // Did showing banner up if (activedBannerUnit != null) { if (config.bannerProfileMode == ProfileMode.Sequence) { MoveItemToEndOfList(i, providerIds); } else if (config.bannerProfileMode == ProfileMode.Random) { ShuffleProviders(providerIds); } return(true); } } return(false); }
public bool HideBanner(BannerAdUnit adUnit) { //CLog.Log(this, "try to hide banner " + adUnit.key); Loader loader = FindLoaderByKey(adUnit.key); if (loader != null && loader.IsVisible) { //CLog.Log(this, "Will hide banner " + adUnit.key); if (loader.Hide()) { // banner has been destroyed loaderDict.Remove(loader.AdUnit.key); // Create new banner for ad Unit InstantiateLoader(loader.AdUnit); //CLog.Log(this, "Hidden " + adUnit.key); } return true; } else { return false; } }
/// <summary> /// Return true if found the active banner and hide it /// </summary> /// <returns></returns> public virtual bool HideBanner(BannerAdUnit activedBanner) { return(false); }
public override bool HideBanner(BannerAdUnit activedBanner) { return(bannerManager.HideBanner(activedBanner)); }