Exemple #1
0
        //------------------------------------------------------------
        // Interstitial Ads.
        //------------------------------------------------------------

        public void LoadInterstitialAd(AdLocation location)
        {
            #if EM_ADMOB
            // Note: On iOS, InterstitialAd objects are one time use objects.
            // That means once an interstitial is shown, the InterstitialAd object can't be used to load another ad.
            // To request another interstitial, you'll need to create a new InterstitialAd object.
            if (interstitialAd != null && interstitialAd.IsLoaded())
            {
                return;
            }

            if (interstitialAd == null)
            {
                // Create new interstitial object.
                interstitialAd = new InterstitialAd(globalAdSettings.AdMobIds.InterstitialAdId);

                // Register for interstitial ad events.
                interstitialAd.OnAdLoaded             += HandleAdMobInterstitialLoaded;
                interstitialAd.OnAdFailedToLoad       += HandleAdMobInterstitialFailedToLoad;
                interstitialAd.OnAdOpening            += HandleAdMobInterstitialOpened;
                interstitialAd.OnAdClosed             += HandleAdMobInterstitialClosed;
                interstitialAd.OnAdLeavingApplication += HandleAdMobInterstitialLeftApplication;
            }

            // By this time interstitialAd either holds the existing, unloaded, unused ad object, or the newly created one.
            interstitialAd.LoadAd(CreateAdMobAdRequest());
            #else
            Debug.LogError(NO_SDK_MESSAGE);
            #endif
        }
 public void DisplayInterstitialAD()
 {
     if (interstitialAd.IsLoaded())
     {
         interstitialAd.Show();
     }
 }
    internal void ShowInterstitial()
    {
        if (ShowAdEvery <= 1)
        {
            if (interstitial.IsLoaded())
            {
                interstitial.Show();
                RequestInterstitial();

                //Reset the ad counter
                ShowAdEvery = c;
            }
            else
            {
                RequestInterstitial();
            }
        }

        else if (ShowAdEvery > 1)
        {
            ShowAdEvery -= 1;

            if (!interstitial.IsLoaded())
            {
                RequestInterstitial();
            }
        }
    }
Exemple #4
0
    public void ShowInterstitial()
    {
// #if GOOGLE_MOBILE_ADS
        while (tryingToShowInterstitial < 10)
        {
            // interstitial.Show();
            if (interstitial.IsLoaded())
            {
                interstitial.Show();
                tryingToShowInterstitial = 10;
            }
            else
            {
                RequestInterstitial();
                // tryingToShowInterstitial++;
                if (interstitial.IsLoaded())
                {
                    interstitial.Show();
                    tryingToShowInterstitial = 10;
                }
            }
            tryingToShowInterstitial++;
        }

        if (tryingToShowInterstitial >= 10)
        {
            SceneController.Instance.GoToScene(goToSceneWithAdName);
        }

        tryingToShowInterstitial = 0;
// #endif
    }
Exemple #5
0
    void Update()
    {
        foreach (AdNetwork network in Enum.GetValues(typeof(AdNetwork)))
        {
            if (allNetworks.Contains(network))
            {
                DebugPanel.Log(network.ToString(), "Ads", IsReady(network));
            }
        }

        if (!Chartboost.hasInterstitial(CBLocation.Default) && !CBdownloading)
        {
            CBdownloading = true;
            Chartboost.cacheInterstitial(CBLocation.Default);
        }

        if (!AdMob_Interstitial.IsLoaded() && !AdMob_loading)
        {
            AdMob_loading      = true;
            AdMob_Interstitial = new InterstitialAd(GetAdMobIDs());
            AdMob_Interstitial.LoadAd(new AdRequest.Builder().Build());
        }
        else if (AdMob_Interstitial.IsLoaded())
        {
            AdMob_loading = false;
        }
    }
 public void Display_Interstitial()
 {
     if (interstitialView.IsLoaded())
     {
         interstitialView.Show();
     }
 }
Exemple #7
0
 public static void ShowBillboard()
 {
     if (interstitial.IsLoaded())
     {
         interstitial.Show();
     }
 }
Exemple #8
0
 private void ShowInterstitial()
 {
     if (interstitial.IsLoaded())
     {
         interstitial.Show();
     }
 }
Exemple #9
0
        public static void Show(params AdType  [] types)
        {
            types.ToList().ForEach(type => {
                switch (type)
                {
                case AdType.BANNER_TOP:
                    ShowBanner(ref bannerTopAd);
                    break;

                case AdType.BANNER_BOTTOM:
                    ShowBanner(ref bannerBottomAd);
                    break;

                case AdType.INTERSTITIAL:
                    if (interstitialAd != null && interstitialAd.IsLoaded())
                    {
                        interstitialAd.Show();
                        if (EaAd.eaDebug)
                        {
                            Debug.Log("SHOW INTERSTITIAL".color("FF0000"));
                        }
                    }
                    else
                    if (EaAd.eaDebug)
                    {
                        Debug.Log("INTERSTITIAL wasn't loaded.");
                    }
                    break;
                }
            });
        }
Exemple #10
0
 public void ShowInterstitialAd(object sender, System.EventArgs args)
 {
     if (interstitial.IsLoaded())
     {
         interstitial.Show();
     }
 }
Exemple #11
0
    IEnumerator WaitForInterestitial()
    {
        float t = 0f;

        if (interstialAd.IsLoaded())
        {
            interstialAd.Show();
        }
        else
        {
            while (!interstialAd.IsLoaded() && (t < maxWaitForInterestitial))
            {
                t += Time.deltaTime;
                //timeText.text = t.ToString();
                yield return(new WaitForEndOfFrame());
            }

            if (interstialAd.IsLoaded())
            {
                interstialAd.Show();
            }
            else
            {
                OnInterestitialFailed_AdMob.Invoke();
            }
        }
    }
        public bool IsReadyInterstitial()
        {
            bool isOK = false;

            if (interstitial == null)
            {
                Debug.LogWarning("Interstitial == null");
            }
            else
            {
                isOK = interstitial.IsLoaded();

                if (isOK)
                {
                    Debug.LogWarning("AAAdmob - IsReadyInterstitial - Interstitial != null - is loaded");
                }
                else
                {
                    Debug.LogWarning("AAAdmob - IsReadyInterstitial - Interstitial != null - is NOT loaded");
                }
            }


            if (!isOK)
            {
                Debug.LogWarning("AAAdmob - IsReadyInterstitial - cache interstitial");

                CacheInterstitial();
            }

            return(isOK);
        }
 public static void CallBigBanner()
 {
     if (interstitial.IsLoaded())
     {
         interstitial.Show();
     }
 }
Exemple #14
0
    public IEnumerator ShowInterstitialAds(string placement, Action <AdFactory.RewardResult> callback)
    {
        string id = _defaultIterstitialPlacement;

        AdFactory.RewardResult result = AdFactory.RewardResult.Error;

        isInterstitialAdClose = false;
        int try_preload_times = 0;

        //等一秒,騙使用者很忙
        yield return(new WaitForSecondsRealtime(1f));

        //沒有讀到的情況
        if (loadState_interstitialAds != AdFactory.AdsLoadState.Loaded)
        {
            while (try_preload_times < 2)
            {
                PreloadInterstitial(id);

                float wait = 0;
                while (wait < 2)
                {
                    wait += Time.deltaTime;
                    if (loadState_interstitialAds == AdFactory.AdsLoadState.Loaded)
                    {
                        goto SHOW;
                    }
                    yield return(null);
                }
                try_preload_times++;
                Debug.Log("Try load times : " + try_preload_times);
            }
            result = AdFactory.RewardResult.Faild;
            goto FINISH;
        }

SHOW:
        if (interstitial != null)
        {
            if (interstitial.IsLoaded())
            {
                result = AdFactory.RewardResult.Success;
                _ShowInterstitialAds();
            }
        }

        while (!isInterstitialAdClose)
        {
            yield return(null);
        }

FINISH:
        PreloadInterstitial(id);

        if (callback != null)
        {
            callback(result);
        }
    }
Exemple #15
0
 /// <summary>
 /// Check if Admob interstitial is available
 /// </summary>
 /// <returns>true if an interstitial is available</returns>
 public bool IsInterstitialAvailable()
 {
     if (interstitial != null)
     {
         return(interstitial.IsLoaded());
     }
     return(false);
 }
Exemple #16
0
 public void Yeniden()
 {
     if (gecisReklam.IsLoaded())
     {
         gecisReklam.Show();
     }
     SceneManager.LoadScene(SceneManager.GetActiveScene().buildIndex);
 }
Exemple #17
0
 public void LoadInterstitial()
 {
     if (!mInterstitial.IsLoaded())
     {
         AdRequest request = new AdRequest.Builder().Build();
         mInterstitial.LoadAd(request);
     }
 }
Exemple #18
0
 public void ShowInterstitialPauseAds()
 {
     Debug.Log("ShowInterstitialPauseAds Add Loaded : " + interstitialPause.IsLoaded());
     if (interstitialPause.IsLoaded())
     {
         interstitialPause.Show();
     }
 }
Exemple #19
0
 public void ShowInterstitialMenuAds()
 {
     Debug.Log("ShowInterstitialMenuAds  Add Loaded : " + interstitialMainMenu.IsLoaded());
     if (interstitialMainMenu.IsLoaded())
     {
         interstitialMainMenu.Show();
     }
 }
Exemple #20
0
 public void ExitGame()
 {
     if (interstitial.IsLoaded())
     {
         interstitial.Destroy();
     }
     Application.Quit();
 }
Exemple #21
0
 public void ShowInterstitial()
 {
     text.text = interstitial.IsLoaded().ToString();
     if (interstitial.IsLoaded())
     {
         interstitial.Show();
     }
 }
Exemple #22
0
 public void PlayInterstitialAd()
 {
     Debug.Log("________________INTERSTITIAL_AD_LOADED: " + interstitial.IsLoaded());
     if (interstitial.IsLoaded())
     {
         interstitial.Show();
     }
 }
        public static bool CanShowInterstitial()
        {
            if (!admobInitialized)
            {
                return(false);
            }

            return(interstitial.IsLoaded());
        }
Exemple #24
0
 public void ShowAdd()      // Burda Timer ' ile kontrol etmem gerek
 {
     if (can_show_ad && have_interstitial && interstitial.IsLoaded())
     {
         interstitial.Show();
         time_for_add = Time.time;
         can_show_ad  = false;
     }
 }
Exemple #25
0
 public void Show()
 {
     if (interstitialAd != null)
     {
         if (interstitialAd.IsLoaded())
         {
             interstitialAd.Show();
         }
     }
 }
Exemple #26
0
        public void RequestInterstitial()
        {
            if (!_interstitialAd.IsLoaded())
            {
                _interstitialAd.LoadAd(new AdRequest.Builder()
                                       .AddExtra("max_ad_content_rating", "G")
//                    .AddExtra("tag_for_under_age_of_consent", "true")
                                       .Build());
            }
        }
 public void LoadInterstitial()
 {
     if (interstitial.IsLoaded())
     {
         return;
     }
     else
     {
         RequestInterstitial();
     }
 }
Exemple #28
0
 void Update()
 {
     // Calculate simple moving average for time to render screen. 0.1 factor used as smoothing
     // value.
     deltaTime += (Time.deltaTime - deltaTime) * 0.1f;
     if (interstitial.IsLoaded() == true)
     {
         ShowInterstitial();
         Debug.Log("Not yet...");
     }
 }
Exemple #29
0
 /// <summary>
 /// Called by the app to show a preloaded interstitial
 /// </summary>
 public void ShowInterstitial()
 {
     if (interstitial != null && interstitial.IsLoaded())
     {
         interstitial.Show();
     }
     else
     {
         OnInterstitialFailed?.Invoke();
     }
 }
Exemple #30
0
 private void ShowInterstitial()
 {
     if (interstitial.IsLoaded())
     {
         interstitial.Show();
     }
     else
     {
         print("Interstitial is not ready yet.");
     }
 }