public static void DestroyBanner(int id) { if (!_IsInited) { Debug.LogWarning("DestroyCurrentBanner shoudl be called only after Init function. Call ignored"); return; } switch (Application.platform) { case RuntimePlatform.IPhonePlayer: if (UltimateMobileSettings.Instance.IOSAdEdngine == UM_IOSAdEngineOprions.GoogleMobileAd) { GoogleMobileAd.DestroyBanner(id); } else { iAdBannerController.instance.DestroyBanner(id); } break; case RuntimePlatform.Android: GoogleMobileAd.DestroyBanner(id); break; case RuntimePlatform.WP8Player: GoogleMobileAd.DestroyBanner(id); break; } }
public static void DestroyBanner(int id) { if (!_IsInited) { Debug.LogWarning("DestroyCurrentBanner shoudl be called only after Init function. Call ignored"); return; } switch (Application.platform) { case RuntimePlatform.IPhonePlayer: if (UltimateMobileSettings.Instance.IOSAdEdngine == UM_IOSAdEngineOprions.GoogleMobileAd) { GoogleMobileAd.DestroyBanner(id); } else { //iAdBannerController.instance.DestroyBanner(id); } break; case RuntimePlatform.Android: if (UltimateMobileSettings.Instance.PlatformEngine == UM_PlatformDependencies.Amazon) { SA_AmazonAdsManager.Instance.DestroyBanner(id); } else { GoogleMobileAd.DestroyBanner(id); } break; #if UNITY_4_6 || UNITY_4_7 || UNITY_5_0 || UNITY_5_1 || UNITY_5_2 case RuntimePlatform.WP8Player: #else case RuntimePlatform.WSAPlayerARM: case RuntimePlatform.WSAPlayerX64: case RuntimePlatform.WSAPlayerX86: #endif GoogleMobileAd.DestroyBanner(id); break; } }
//-------------------------------------- // 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")) { GoogleMobileAd.StartInterstitialAd(); } StartX += 170; if (GUI.Button(new Rect(StartX, StartY, 150, 50), "Load Interstitial Ad")) { GoogleMobileAd.LoadInterstitialAd(); } StartX += 170; GUI.enabled = IsInterstisialsAdReady; if (GUI.Button(new Rect(StartX, StartY, 150, 50), "Show Interstitial Ad")) { GoogleMobileAd.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 = GoogleMobileAd.CreateAdBanner(300, 100, GADBannerSize.BANNER); } StartX += 170; if (GUI.Button(new Rect(StartX, StartY, 150, 50), "Banner Top Left")) { banner1 = GoogleMobileAd.CreateAdBanner(TextAnchor.UpperLeft, GADBannerSize.BANNER); } StartX += 170; if (GUI.Button(new Rect(StartX, StartY, 150, 50), "Banner Top Center")) { banner1 = GoogleMobileAd.CreateAdBanner(TextAnchor.UpperCenter, GADBannerSize.BANNER); } StartX += 170; if (GUI.Button(new Rect(StartX, StartY, 150, 50), "Banner Top Right")) { banner1 = GoogleMobileAd.CreateAdBanner(TextAnchor.UpperRight, GADBannerSize.BANNER); } StartX += 170; if (GUI.Button(new Rect(StartX, StartY, 150, 50), "Banner Bottom Left")) { banner1 = GoogleMobileAd.CreateAdBanner(TextAnchor.LowerLeft, GADBannerSize.BANNER); } StartX += 170; if (GUI.Button(new Rect(StartX, StartY, 150, 50), "Banner Bottom Center")) { banner1 = GoogleMobileAd.CreateAdBanner(TextAnchor.LowerCenter, GADBannerSize.BANNER); } StartX += 170; if (GUI.Button(new Rect(StartX, StartY, 150, 50), "Banner Bottom Right")) { banner1 = GoogleMobileAd.CreateAdBanner(TextAnchor.LowerRight, GADBannerSize.BANNER); } GUI.enabled = false; if (banner1 != null) { if (banner1.IsLoaded) { GUI.enabled = true; } } StartY += 80; StartX = 10; if (GUI.Button(new Rect(StartX, StartY, 150, 50), "Refresh")) { banner1.Refresh(); } StartX += 170; if (GUI.Button(new Rect(StartX, StartY, 150, 50), "Move To Center")) { banner1.SetBannerPosition(TextAnchor.MiddleCenter); } StartX += 170; if (GUI.Button(new Rect(StartX, StartY, 150, 50), "To Radom Coords")) { banner1.SetBannerPosition(Random.Range(0, Screen.width), Random.Range(0, Screen.height)); } 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), "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")) { GoogleMobileAd.DestroyBanner(banner1.id); banner1 = null; } GUI.enabled = true; StartY += 80; StartX = 10; GUI.Label(new Rect(StartX, StartY, Screen.width, 40), "Banner 2", style); GUI.enabled = false; if (banner2 == null) { GUI.enabled = true; } StartY += 40; if (GUI.Button(new Rect(StartX, StartY, 150, 50), "Smart Banner")) { banner2 = GoogleMobileAd.CreateAdBanner(TextAnchor.LowerLeft, GADBannerSize.SMART_BANNER); } GUI.enabled = false; if (banner2 != null) { if (banner2.IsLoaded) { GUI.enabled = true; } } StartX += 170; if (GUI.Button(new Rect(StartX, StartY, 150, 50), "Refresh")) { banner2.Refresh(); } GUI.enabled = false; if (banner2 != null) { if (banner2.IsLoaded && banner2.IsOnScreen) { GUI.enabled = true; } } StartX += 170; if (GUI.Button(new Rect(StartX, StartY, 150, 50), "Hide")) { banner2.Hide(); } GUI.enabled = false; if (banner2 != null) { if (banner2.IsLoaded && !banner2.IsOnScreen) { GUI.enabled = true; } } StartX += 170; if (GUI.Button(new Rect(StartX, StartY, 150, 50), "Show")) { banner2.Show(); } GUI.enabled = false; if (banner2 != null) { GUI.enabled = true; } StartX += 170; if (GUI.Button(new Rect(StartX, StartY, 150, 50), "Destroy")) { GoogleMobileAd.DestroyBanner(banner2.id); banner2 = null; } GUI.enabled = true; }
//-------------------------------------- // 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")) { GoogleMobileAd.StartInterstitialAd(); } StartX += 170; if (GUI.Button(new Rect(StartX, StartY, 150, 50), "Load Interstitial Ad")) { GoogleMobileAd.LoadInterstitialAd(); } StartX += 170; GUI.enabled = IsInterstisialsAdReady; if (GUI.Button(new Rect(StartX, StartY, 150, 50), "Show Interstitial Ad")) { GoogleMobileAd.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 = GoogleMobileAd.CreateAdBanner(300, 100, GADBannerSize.BANNER); } StartX += 170; if (GUI.Button(new Rect(StartX, StartY, 150, 50), "Banner Top Left")) { banner1 = GoogleMobileAd.CreateAdBanner(TextAnchor.UpperLeft, GADBannerSize.BANNER); } StartX += 170; if (GUI.Button(new Rect(StartX, StartY, 150, 50), "Banner Top Center")) { banner1 = GoogleMobileAd.CreateAdBanner(TextAnchor.UpperCenter, GADBannerSize.BANNER); } StartX += 170; if (GUI.Button(new Rect(StartX, StartY, 150, 50), "Banner Top Right")) { banner1 = GoogleMobileAd.CreateAdBanner(TextAnchor.UpperRight, GADBannerSize.BANNER); } StartX += 170; if (GUI.Button(new Rect(StartX, StartY, 150, 50), "Banner Bottom Left")) { banner1 = GoogleMobileAd.CreateAdBanner(TextAnchor.LowerLeft, GADBannerSize.BANNER); } StartX += 170; if (GUI.Button(new Rect(StartX, StartY, 150, 50), "Banner Bottom Center")) { banner1 = GoogleMobileAd.CreateAdBanner(TextAnchor.LowerCenter, GADBannerSize.BANNER); } StartX += 170; if (GUI.Button(new Rect(StartX, StartY, 150, 50), "Banner Bottom Right")) { banner1 = GoogleMobileAd.CreateAdBanner(TextAnchor.LowerRight, GADBannerSize.BANNER); } GUI.enabled = false; if (banner1 != null) { if (banner1.IsLoaded) { GUI.enabled = true; } } StartY += 80; StartX = 10; if (GUI.Button(new Rect(StartX, StartY, 150, 50), "Refresh")) { banner1.Refresh(); } StartX += 170; if (GUI.Button(new Rect(StartX, StartY, 150, 50), "Move To Center")) { banner1.SetBannerPosition(TextAnchor.MiddleCenter); } StartX += 170; if (GUI.Button(new Rect(StartX, StartY, 150, 50), "To Radom Coords")) { banner1.SetBannerPosition(Random.Range(0, Screen.width), Random.Range(0, Screen.height)); } 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), "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")) { GoogleMobileAd.DestroyBanner(banner1.id); banner1 = null; } GUI.enabled = true; StartY += 80; StartX = 10; GUI.Label(new Rect(StartX, StartY, Screen.width, 40), "Banner 2", style); GUI.enabled = false; if (banner2 == null) { GUI.enabled = true; } StartY += 40; if (GUI.Button(new Rect(StartX, StartY, 150, 50), "Smart Banner")) { banner2 = GoogleMobileAd.CreateAdBanner(TextAnchor.LowerLeft, GADBannerSize.SMART_BANNER); //listening for banner to load example using C# actions: banner2.OnLoadedAction += OnBannerLoadedAction; //By setting this flsg to fals we will prevent banner to show when it's loaded //e will listner for OnLoadedAction event and show it by our selfs instead banner2.ShowOnLoad = false; } GUI.enabled = false; if (banner2 != null) { if (banner2.IsLoaded) { GUI.enabled = true; } } StartX += 170; if (GUI.Button(new Rect(StartX, StartY, 150, 50), "Refresh")) { banner2.Refresh(); } GUI.enabled = false; if (banner2 != null) { if (banner2.IsLoaded && banner2.IsOnScreen) { GUI.enabled = true; } } StartX += 170; if (GUI.Button(new Rect(StartX, StartY, 150, 50), "Hide")) { banner2.Hide(); } GUI.enabled = false; if (banner2 != null) { if (banner2.IsLoaded && !banner2.IsOnScreen) { GUI.enabled = true; } } StartX += 170; if (GUI.Button(new Rect(StartX, StartY, 150, 50), "Show")) { banner2.Show(); } GUI.enabled = false; if (banner2 != null) { GUI.enabled = true; } StartX += 170; if (GUI.Button(new Rect(StartX, StartY, 150, 50), "Destroy")) { GoogleMobileAd.DestroyBanner(banner2.id); banner2 = null; } GUI.enabled = true; }
public void Destroy2() { GoogleMobileAd.DestroyBanner(banner2.id); banner2 = null; }
public void Destroy1() { GoogleMobileAd.DestroyBanner(banner1.id); banner1 = null; }
public void SmartBannerDestroy() { GoogleMobileAd.DestroyBanner(SmartBanner.id); SmartBanner = null; }
public void BannerDestroy() { GoogleMobileAd.DestroyBanner(Banner.id); Banner = null; }