Beispiel #1
0
 /// <summary>
 /// Loads the banner ad with a specified <a href="../manual/MonetizationPlacements.html">Placement</a>, but fires the <c>loadCallback</c> callback on successful load, and the <c>errorCallback</c> callback on failure to load.
 /// </summary>
 /// <param name="placementId">The unique identifier for a specific Placement, found on the <a href="https://operate.dashboard.unity3d.com/">developer dashboard</a>.</param>
 /// <param name="options">A collection of options that notify the SDK of events when loading the banner.</param>
 public static void Load(string placementId, BannerLoadOptions options)
 {
     if (options != null)
     {
         if (options.loadCallback != null)
         {
             EventHandler <EventArgs> handler = null;
             handler = (object sender, EventArgs args) =>
             {
                 s_Platform.Banner.OnLoad -= handler;
                 options.loadCallback();
             };
             s_Platform.Banner.OnLoad += handler;
         }
         if (options.errorCallback != null)
         {
             EventHandler <ErrorEventArgs> handler = null;
             handler = (object sender, ErrorEventArgs args) =>
             {
                 s_Platform.Banner.OnError -= handler;
                 options.errorCallback(args.message);
             };
             s_Platform.Banner.OnError += handler;
         }
     }
     s_Platform.Banner.Load(placementId);
 }
Beispiel #2
0
        public void UnityAdsBannerDidError(string message, BannerLoadOptions bannerOptions)
        {
            var errorCallback = bannerOptions?.errorCallback;

            if (errorCallback != null)
            {
                UnityLifecycleManager?.Post(() => {
                    bannerOptions.errorCallback(message ?? "");
                });
            }
        }
Beispiel #3
0
        public void UnityAdsBannerDidLoad(string placementId, BannerLoadOptions bannerOptions)
        {
            var loadCallback = bannerOptions?.loadCallback;

            if (loadCallback != null)
            {
                UnityLifecycleManager?.Post(() => {
                    bannerOptions.loadCallback();
                });
            }
        }
Beispiel #4
0
 public void ShowBanner()
 {
     if (bannerShown)
     {
         UnityEngine.Advertisements.Advertisement.Banner.Hide(true);
     }
     else
     {
         UnityEngine.Advertisements.BannerLoadOptions options = new UnityEngine.Advertisements.BannerLoadOptions();
         options.loadCallback  = BannerLoadCallback;
         options.errorCallback = BannerErrorCallback;
         UnityEngine.Advertisements.Advertisement.Banner.Load(bannerPlacementID, options);
     }
 }
        public void Load(string id, Action <SA_Result> callback)
        {
#if SA_UNITY_ADS_INSTALLED
            m_advertisementId = id;
            if (UADS.Advertisement.IsReady(id))
            {
                callback.Invoke(new SA_Result());
                return;
            }

            m_loadCallback = callback;
            UADS.BannerLoadOptions loadOptions = new UADS.BannerLoadOptions();
            loadOptions.errorCallback += LoadErrorCallback;
            loadOptions.loadCallback  += LoadCallback;
            UADS.Advertisement.Banner.Load(id, loadOptions);
#endif
        }
Beispiel #6
0
 /// <summary>
 /// Loads the banner ad with the default <a href="../manual/MonetizationPlacements.html">Placement</a>, but fires the <c>loadCallback</c> callback on successful load, and the <c>errorCallback</c> callback on failure to load.
 /// </summary>
 /// <param name="options">A collection of options that notify the SDK of events when loading the banner.</param>
 public static void Load(BannerLoadOptions options)
 {
     Load(null, options);
 }
Beispiel #7
0
 /// <summary>
 /// Loads the banner ad with a specified <a href="../manual/MonetizationPlacements.html">Placement</a>, but fires the <c>loadCallback</c> callback on successful load, and the <c>errorCallback</c> callback on failure to load.
 /// </summary>
 /// <param name="placementId">The unique identifier for a specific Placement, found on the <a href="https://operate.dashboard.unity3d.com/">developer dashboard</a>.</param>
 /// <param name="options">A collection of options that notify the SDK of events when loading the banner.</param>
 public static void Load(string placementId, BannerLoadOptions options)
 {
     s_Platform.Banner.Load(placementId, options);
 }
 public void Load(string placementId, BannerLoadOptions loadOptions)
 {
 }
Beispiel #9
0
 public void Load(string placementId, BannerLoadOptions loadOptions)
 {
     m_NativeBanner.Load(placementId, loadOptions);
 }
Beispiel #10
0
 /// <summary>
 /// Loads the banner ad with a specified <a href="../manual/MonetizationPlacements.html">Placement</a>, and no callbacks.
 /// </summary>
 /// <param name="placementId">The unique identifier for a specific Placement, found on the <a href="https://operate.dashboard.unity3d.com/">developer dashboard</a>.</param>
 public void Load(string placementId, BannerLoadOptions loadOptions)
 {
     loaded = true;
     currentBannerPosition = bannerPosition;
     loadOptions?.loadCallback();
 }