public AdLoaderClient(AdLoader unityAdLoader) { this.adLoaderClientPtr = (IntPtr)GCHandle.Alloc(this); this.customNativeTemplateCallbacks = unityAdLoader.CustomNativeTemplateClickHandlers; string[] templateIdsArray = new string[unityAdLoader.TemplateIds.Count]; unityAdLoader.TemplateIds.CopyTo(templateIdsArray); this.adTypes = new NativeAdTypes(); if (unityAdLoader.AdTypes.Contains(NativeAdType.CustomTemplate)) { adTypes.CustomTemplateAd = 1; } this.AdLoaderPtr = Externs.GADUCreateAdLoader( this.adLoaderClientPtr, unityAdLoader.AdUnitId, templateIdsArray, templateIdsArray.Length, ref adTypes); Externs.GADUSetAdLoaderCallbacks( this.AdLoaderPtr, AdLoaderDidReceiveNativeCustomTemplateAdCallback, AdLoaderDidFailToReceiveAdWithErrorCallback); }
public AdLoaderClient(AdLoaderClientArgs clientArgs) { this.adLoaderClientPtr = (IntPtr)GCHandle.Alloc(this); this.TemplateIds = clientArgs.TemplateIds; string[] templateIdsArray = new string[TemplateIds.Keys.Count]; TemplateIds.Keys.ToList().CopyTo(templateIdsArray); this.adTypes = new NativeAdTypes(); bool configureReturnUrlsForImageAssets = false; if (clientArgs.AdTypes.Contains(NativeAdType.CustomTemplate)) { configureReturnUrlsForImageAssets = false; adTypes.CustomTemplateAd = 1; } this.AdLoaderPtr = Externs.GADUCreateAdLoader( this.adLoaderClientPtr, clientArgs.AdUnitId, templateIdsArray, templateIdsArray.Length, ref adTypes, configureReturnUrlsForImageAssets); Externs.GADUSetAdLoaderCallbacks( this.AdLoaderPtr, AdLoaderDidReceiveNativeCustomTemplateAdCallback, AdLoaderDidFailToReceiveAdWithErrorCallback); }