Exemplo n.º 1
0
        private static void NativeAd_OnNativeAdLoadMethod(IntPtr nativeAd, int context, int slotType)
        {
            UnityDispatcher.PostTask(() =>
            {
                INativeAdListener listener;
                if (loadListeners.TryGetValue(context, out listener))
                {
                    loadListeners.Remove(context);

                    /**
                     * BUAdSlotAdTypeBanner        = 1,       // banner ads
                     * BUAdSlotAdTypeInterstitial  = 2,       // interstitial ads
                     */
                    AdSlotType adType = AdSlotType.Banner;
                    if (slotType == 1)
                    {
                        adType = AdSlotType.Banner;
                    }
                    else if (slotType == 2)
                    {
                        adType = AdSlotType.InteractionAd;
                    }
                    else if (slotType == 5)
                    {
                        adType = AdSlotType.Feed;
                    }
                    listener.OnNativeAdLoad(null, new NativeAd(nativeAd, adType));
                }
                else
                {
                    Debug.LogError(
                        "The NativeAd_OnNativeAdLoad can not find the context.");
                }
            });
        }
Exemplo n.º 2
0
        public static int ToAndroid(this AdSlotType type)
        {
            switch (type)
            {
            case AdSlotType.Banner:
                return(1);

            case AdSlotType.InteractionAd:
                return(2);

            case AdSlotType.Splash:
                return(3);

            case AdSlotType.CachedSplash:
                return(4);

            case AdSlotType.Feed:
                return(5);

            case AdSlotType.RewardVideo:
                return(7);

            case AdSlotType.FullScreenVideo:
                return(8);

            case AdSlotType.DrawFeed:
                return(9);

            default:
                throw new NotSupportedException(string.Format("Unknown AdSlotType: {0}", type));
            }
        }
Exemplo n.º 3
0
 private static extern void UnionPlatform_NativeAd_Load(
     string slotID,
     int adCount,
     AdSlotType nativeAdType,
     int width,
     int height,
     NativeAd_OnError onError,
     NativeAd_OnNativeAdLoad onNativeAdLoad,
     int context);
Exemplo n.º 4
0
 /// <summary>
 /// Sets the Native Ad type.
 /// </summary>
 public Builder SetNativeAdType(AdSlotType type)
 {
     return(this);
 }
Exemplo n.º 5
0
 /// <summary>
 /// Sets the Native Ad type.
 /// </summary>
 public Builder SetNativeAdType(AdSlotType type)
 {
     this.slot.type = type;
     return(this);
 }
Exemplo n.º 6
0
 /// <summary>
 /// Sets the Native Ad type.
 /// </summary>
 public Builder SetNativeAdType(AdSlotType type)
 {
     this.builder.Call <AndroidJavaObject>(
         "setNativeAdType", type.ToAndroid());
     return(this);
 }
Exemplo n.º 7
0
 /// <summary>
 /// show the  express Ad
 /// <param name="type">the type of ad</param>
 /// <param name="x">the origin x of th ad</param>
 /// <param name="y">the origin y of th ad</param>
 /// </summary>
 public void ShowNativeAd(AdSlotType type, float x, float y)
 {
 }
Exemplo n.º 8
0
 public void ShowNativeAd(AdSlotType type, float x, float y)
 {
     UnionPlatform_NativeAd_ShowNativeAd(this.nativeAd, slotType, x, y);
 }
Exemplo n.º 9
0
 internal NativeAd(IntPtr nativeAd, AdSlotType slotType)
 {
     this.nativeAd = nativeAd;
     this.slotType = slotType;
 }
Exemplo n.º 10
0
 private static extern void UnionPlatform_NativeAd_ShowNativeAd(
     IntPtr nativeAd,
     AdSlotType slotType,
     float x,
     float y);
Exemplo n.º 11
0
 public void ShowNativeAd(AdSlotType slotType)
 {
     Debug.Log("-----------hello yanlin");
     UnionPlatform_NativeAd_ShowNativeAd(this.nativeAd, slotType);
 }
Exemplo n.º 12
0
 public void ShowNativeAd(AdSlotType type)
 {
 }