public void HideBanner() { if (registeredBanners.ContainsKey(sceneBannerId)) { iAdBanner banner = registeredBanners[sceneBannerId]; if (banner.IsLoaded) { if (banner.IsOnScreen) { banner.Hide(); } } else { banner.ShowOnLoad = false; } } }
//-------------------------------------- // PUBLIC METHODS //-------------------------------------- void OnGUI() { float StartY = 20; float StartX = 10; GUI.Label(new Rect(StartX, StartY, Screen.width, 40), "Interstisal Example", style); StartY += 40; if (GUI.Button(new Rect(StartX, StartY, 150, 50), "Start Interstitial Ad")) { iAdBannerController.instance.StartInterstitialAd(); } StartX += 170; if (GUI.Button(new Rect(StartX, StartY, 150, 50), "Load Interstitial Ad")) { iAdBannerController.instance.LoadInterstitialAd(); } StartX += 170; GUI.enabled = IsInterstisialsAdReady; if (GUI.Button(new Rect(StartX, StartY, 150, 50), "Show Interstitial Ad")) { iAdBannerController.instance.ShowInterstitialAd(); } GUI.enabled = true; StartY += 80; StartX = 10; GUI.Label(new Rect(StartX, StartY, Screen.width, 40), "Banners Example", style); GUI.enabled = false; if (banner1 == null) { GUI.enabled = true; } StartY += 40; if (GUI.Button(new Rect(StartX, StartY, 150, 50), "Banner Custom Pos")) { banner1 = iAdBannerController.instance.CreateAdBanner(300, 100); } StartY += 80; StartX = 10; if (GUI.Button(new Rect(StartX, StartY, 150, 50), "Banner Top Left")) { banner1 = iAdBannerController.instance.CreateAdBanner(TextAnchor.UpperLeft); } StartX += 170; if (GUI.Button(new Rect(StartX, StartY, 150, 50), "Banner Top Center")) { banner1 = iAdBannerController.instance.CreateAdBanner(TextAnchor.UpperCenter); } StartX += 170; if (GUI.Button(new Rect(StartX, StartY, 150, 50), "Banner Top Right")) { banner1 = iAdBannerController.instance.CreateAdBanner(TextAnchor.UpperRight); } StartY += 80; StartX = 10; if (GUI.Button(new Rect(StartX, StartY, 150, 50), "Banner Bottom Left")) { banner1 = iAdBannerController.instance.CreateAdBanner(TextAnchor.LowerLeft); } StartX += 170; if (GUI.Button(new Rect(StartX, StartY, 150, 50), "Banner Bottom Center")) { banner1 = iAdBannerController.instance.CreateAdBanner(TextAnchor.LowerCenter); } StartX += 170; if (GUI.Button(new Rect(StartX, StartY, 150, 50), "Banner Bottom Right")) { banner1 = iAdBannerController.instance.CreateAdBanner(TextAnchor.LowerRight); } StartY += 80; StartX = 10; GUI.enabled = false; if (banner1 != null) { if (banner1.IsLoaded && banner1.IsOnScreen) { GUI.enabled = true; } } if (GUI.Button(new Rect(StartX, StartY, 150, 50), "Hide")) { banner1.Hide(); } GUI.enabled = false; if (banner1 != null) { if (banner1.IsLoaded && !banner1.IsOnScreen) { GUI.enabled = true; } } StartX += 170; if (GUI.Button(new Rect(StartX, StartY, 150, 50), "Show")) { banner1.Show(); } GUI.enabled = false; if (banner1 != null) { GUI.enabled = true; } StartX += 170; if (GUI.Button(new Rect(StartX, StartY, 150, 50), "Destroy")) { iAdBannerController.instance.DestroyBanner(banner1.id); banner1 = null; } GUI.enabled = true; }
public void HideBanner() { banner1.Hide(); }