public AdLoaderClient(AdLoader unityAdLoader)
        {
            IntPtr adLoaderClientPtr = (IntPtr)GCHandle.Alloc(this);

            this.customNativeTemplateCallbacks = unityAdLoader.CustomNativeTemplateClickHandlers;
            string[] templateIdsArray = new string[unityAdLoader.TemplateIds.Count];
            unityAdLoader.TemplateIds.CopyTo(templateIdsArray);

            NativeAdTypes adTypes = new NativeAdTypes();
            if (unityAdLoader.AdTypes.Contains(NativeAdType.CustomTemplate))
            {
                adTypes.CustomTemplateAd = true;
            }

            this.AdLoaderPtr = Externs.GADUCreateAdLoader(
                adLoaderClientPtr,
                unityAdLoader.AdUnitId,
                templateIdsArray,
                templateIdsArray.Length,
                ref adTypes);

            Externs.GADUSetAdLoaderCallbacks(
                this.AdLoaderPtr,
                AdLoaderDidReceiveNativeCustomTemplateAdCallback,
                AdLoaderDidFailToReceiveAdWithErrorCallback);
        }
 internal static extern IntPtr GADUCreateAdLoader(
     IntPtr adLoader,
     string adUnitId,
     string[] templateIds,
     int templateIdsCount,
     ref NativeAdTypes types,
     bool returnUrlsForImageAssets);
        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);
        }
Exemple #4
0
        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);
        }
 internal static extern IntPtr GADUCreateAdLoader(
     IntPtr adLoader, string adUnitId, string[] templateIds, int templateIdsCount,
     ref NativeAdTypes types);
Exemple #6
0
 internal static extern IntPtr GADUCreateAdLoader(
     IntPtr adLoader, string adUnitId, string[] templateIds, int templateIdsCount,
     ref NativeAdTypes types);