Esempio n. 1
0
        // Creates a native ad
        public void CreateNativeAd(string placementId, string channelId, string versionId, GameObject gameObject, YumiNativeAdOptions option)
        {
            this.nativeClientPtr   = (IntPtr)GCHandle.Alloc(this);
            this.currentGameObject = gameObject;
            Camera camera              = Camera.main;
            int    expressAdViewWidth  = 0;
            int    expressAdViewHeight = 0;

            if (option.expressAdViewTransform != null)
            {
                Rect adViewRect = getGameObjectRect(option.expressAdViewTransform as RectTransform, camera);
                expressAdViewWidth  = (int)adViewRect.width;
                expressAdViewHeight = (int)adViewRect.height;
            }


            this.NativeAdPtr = YumiExterns.InitYumiNativeAd(this.nativeClientPtr, placementId, channelId, versionId, (int)option.adChoiseViewPosition,
                                                            (int)option.adAttribution.AdOptionsPosition, option.adAttribution.text, option.adAttribution.textColor,
                                                            option.adAttribution.backgroundColor, option.adAttribution.textSize, option.adAttribution.hide, expressAdViewWidth, expressAdViewHeight);
            adOptions = option;
            YumiExterns.SetNativeCallbacks(
                this.NativeAdPtr,
                NativeDidReceiveAdCallback,
                NativeDidFailToReceiveAdWithErrorCallback,
                NativeDidClickCallback,
                NativeExpressAdDidRenderSuccessCallback,
                NativeExpressAdDidRenderFailCallback,
                NativeExpressAdDidClickCloseButtonCallback
                );
        }