// Loads a new interstitial request.
        public void LoadAd(AdRequest request)
        {
            if (Screen.width > Screen.height) //Landscape
            {
                LoadAndSetPrefabAd(prefabAds[new AdSize(1024, 768)]);
            }
            else
            {
                LoadAndSetPrefabAd(prefabAds[new AdSize(768, 1024)]);
            }

            if (prefabAd != null)
            {
                if (OnAdLoaded != null)
                {
                    OnAdLoaded.Invoke(this, EventArgs.Empty);
                }
            }
            else
            {
                if (OnAdFailedToLoad != null)
                {
                    OnAdFailedToLoad.Invoke(this, new AdFailedToLoadEventArgs()
                    {
                        Message = "Prefab Ad is Null"
                    });
                }
            }
        }
        // Load a rewarding ad.
        public void LoadAd(string adUnitId, AdRequest request)
        {
            if (Screen.width > Screen.height) //Landscape
            {
                LoadAndSetPrefabAd(prefabAds[new AdSize(1024, 768)]);
            }
            else
            {
                LoadAndSetPrefabAd(prefabAds[new AdSize(768, 1024)]);
            }

            if (prefabAd != null)
            {
                if (OnAdLoaded != null)
                {
                    OnAdLoaded.Invoke(this, EventArgs.Empty);
                }
            }
            else
            {
                if (OnAdFailedToLoad != null)
                {
                    OnAdFailedToLoad.Invoke(this, new LoadAdErrorClientEventArgs()
                    {
                        LoadAdErrorClient = new LoadAdErrorClient()
                    });
                }
            }
        }
Exemple #3
0
        // Loads a new interstitial request.
        public void LoadAd(AdRequest request)
        {
            Debug.Log("Dummy " + MethodBase.GetCurrentMethod().Name);
            if (Screen.width > Screen.height) //Landscape
            {
                if (Screen.width > 800)
                {
                    LoadAndSetPrefabAd(prefabAds[new AdSize(1024, 768)]);
                }
                else
                {
                    LoadAndSetPrefabAd(prefabAds[new AdSize(480, 320)]);
                }
            }
            else
            {
                if (Screen.height < 1080)
                {
                    LoadAndSetPrefabAd(prefabAds[new AdSize(320, 480)]);
                }
                else
                {
                    LoadAndSetPrefabAd(prefabAds[new AdSize(768, 1024)]);
                }
            }

            if (OnAdLoaded != null)
            {
                OnAdLoaded.Invoke(this, EventArgs.Empty);
            }
        }
Exemple #4
0
    public static void HandleRewardedAdLoaded(object sender, EventArgs args)
    {
        isLoading = false;

        if (OnAdLoaded != null)
        {
            OnAdLoaded.Invoke();
        }
    }
Exemple #5
0
 // Requests a new ad for the banner view.
 public void LoadAd(AdRequest request)
 {
     if (prefabAd != null)
     {
         ShowBannerView();
         if (OnAdLoaded != null)
         {
             OnAdLoaded.Invoke(this, EventArgs.Empty);
         }
     }
     else
     {
         if (OnAdFailedToLoad != null)
         {
             OnAdFailedToLoad.Invoke(this, new AdFailedToLoadEventArgs()
             {
                 Message = "Prefab Ad is Null"
             });
         }
     }
 }
Exemple #6
0
 // Requests a new ad for the banner view.
 public void LoadAd(AdRequest request)
 {
     if (prefabAd != null)
     {
         ShowBannerView();
         if (OnAdLoaded != null)
         {
             OnAdLoaded.Invoke(this, EventArgs.Empty);
         }
     }
     else
     {
         if (OnAdFailedToLoad != null)
         {
             OnAdFailedToLoad.Invoke(this, new LoadAdErrorClientEventArgs()
             {
                 LoadAdErrorClient = new LoadAdErrorClient()
             });
         }
     }
 }
Exemple #7
0
 // Requests a new ad for the banner view.
 public void LoadAd(AdRequest request)
 {
     Debug.Log("Dummy " + MethodBase.GetCurrentMethod().Name);
     if (prefabAd != null)
     {
         ShowBannerView();
         if (OnAdLoaded != null)
         {
             OnAdLoaded.Invoke(this, EventArgs.Empty);
         }
     }
     else
     {
         if (OnAdFailedToLoad != null)
         {
             OnAdFailedToLoad.Invoke(this, new AdFailedToLoadEventArgs()
             {
                 Message = "Prefab Ad is Null"
             });
         }
     }
 }
        public Task LoadRewardedVideo()
        {
            return(Thread.UI.Run(async() =>
            {
                if (string.IsNullOrEmpty(UnitId))
                {
                    await OnAdFailed.Raise("The UnitId of the RewardedVideoView has not specified!");
                    return;
                }

                NativeAd = new RewardedAd(UnitId);
                var error = await NativeAd.LoadRequestAsync(Request.GetDefaultRequest());
                if (error != null)
                {
                    AdmobIOSListener.OnError(error, out var errorMessage);
                    await OnAdFailed.Raise(errorMessage);
                }
                else
                {
                    await OnAdLoaded.Raise();
                }
            }));
        }
 public AdLoadListener(OnAdLoaded onAdLoaded, OnAdError onAdError)
 {
     this.onAdLoaded = onAdLoaded;
     this.onAdError  = onAdError;
 }