private void ShowMopubAdOnLevelEnd() { #if UNITY_ANDROID Debug.Log("----------- Show MoPub Ad State: " + MoPubAndroidManager.INTERSTITIAL_AD_STATE); if (MoPubAndroidManager.INTERSTITIAL_AD_STATE == MoPubAndroidManager.INTERSTITIAL_STATES.LOADED) { MoPubAndroid.showInterstitalAd(); Debug.Log("----------- Show MoPub Ad State: " + "SHOWN"); } #endif #if UNITY_IPHONE if (MoPubManager.INTERSTITIAL_AD_STATE == MoPubManager.INTERSTITIAL_STATES.LOADED) { MoPubBinding.showInterstitialAd(Constants.INTERSTITIAL_ID_IOS); } #endif }
IEnumerator WaitForMopubAddOnMainMenu(float wait) { Debug.Log("----------- before :: " + MoPubAndroidManager.INTERSTITIAL_AD_STATE); yield return(new WaitForSeconds(wait)); #if UNITY_ANDROID if (MoPubAndroidManager.INTERSTITIAL_AD_STATE != MoPubAndroidManager.INTERSTITIAL_STATES.DISPLAYED && GameManager.Instance.GetCurrentGameState() == GameManager.GameState.MAINMENU) { ShowMopubAdOnMainMenu(); } #endif #if UNITY_IPHONE if (MoPubManager.INTERSTITIAL_AD_STATE == MoPubManager.INTERSTITIAL_STATES.LOADED) { MoPubManager.INTERSTITIAL_AD_STATE = MoPubManager.INTERSTITIAL_STATES.NONE; MoPubBinding.showInterstitialAd(Constants.INTERSTITIAL_ID_IOS); } #endif }
private void ShowMopubAdOnMainMenuScreen() { #if UNITY_ANDROID Debug.Log("----------- Show MoPub Ad State: " + MoPubAndroidManager.INTERSTITIAL_AD_STATE); if (MoPubAndroidManager.INTERSTITIAL_AD_STATE == MoPubAndroidManager.INTERSTITIAL_STATES.LOADED) { if (GameManager.Instance.GetCurrentGameState() == GameManager.GameState.MAINMENU) { MoPubAndroid.showInterstitalAd(); } } #endif #if UNITY_IPHONE if (MoPubManager.INTERSTITIAL_AD_STATE == MoPubManager.INTERSTITIAL_STATES.LOADED) { if (GameManager.Instance.GetCurrentGameState() == GameManager.GameState.MAINMENU) { MoPubBinding.showInterstitialAd(Constants.INTERSTITIAL_ID_IOS); } } #endif }
// If an interstitial ad is loaded this will take over the screen and show the ad public static void showInterstitialAd(string adUnitId) { MP.showInterstitialAd(adUnitId); }