コード例 #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
ファイル: Banner.cs プロジェクト: Alperen10/FoodEaterGame
        public void UnityAdsBannerDidError(string message, BannerLoadOptions bannerOptions)
        {
            var errorCallback = bannerOptions?.errorCallback;

            if (errorCallback != null)
            {
                UnityLifecycleManager?.Post(() => {
                    bannerOptions.errorCallback(message ?? "");
                });
            }
        }