示例#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);
 }
示例#2
0
        public void UnityAdsBannerDidLoad(string placementId, BannerLoadOptions bannerOptions)
        {
            var loadCallback = bannerOptions?.loadCallback;

            if (loadCallback != null)
            {
                UnityLifecycleManager?.Post(() => {
                    bannerOptions.loadCallback();
                });
            }
        }
示例#3
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();
 }