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."); } }); }
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)); } }
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);
/// <summary> /// Sets the Native Ad type. /// </summary> public Builder SetNativeAdType(AdSlotType type) { return(this); }
/// <summary> /// Sets the Native Ad type. /// </summary> public Builder SetNativeAdType(AdSlotType type) { this.slot.type = type; return(this); }
/// <summary> /// Sets the Native Ad type. /// </summary> public Builder SetNativeAdType(AdSlotType type) { this.builder.Call <AndroidJavaObject>( "setNativeAdType", type.ToAndroid()); return(this); }
/// <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) { }
public void ShowNativeAd(AdSlotType type, float x, float y) { UnionPlatform_NativeAd_ShowNativeAd(this.nativeAd, slotType, x, y); }
internal NativeAd(IntPtr nativeAd, AdSlotType slotType) { this.nativeAd = nativeAd; this.slotType = slotType; }
private static extern void UnionPlatform_NativeAd_ShowNativeAd( IntPtr nativeAd, AdSlotType slotType, float x, float y);
public void ShowNativeAd(AdSlotType slotType) { Debug.Log("-----------hello yanlin"); UnionPlatform_NativeAd_ShowNativeAd(this.nativeAd, slotType); }
public void ShowNativeAd(AdSlotType type) { }