Beispiel #1
0
        public void RegisterNativeDataForInteraction(YumiNativeData yumiNaitveData, Dictionary <NativeElemetType, Transform> elements)
        {
            Logger.Log("RegisterGameObjectsForInteraction");

            Camera camera = Camera.main;

            RectTransform panelRectTransform        = elements[NativeElemetType.PANEL] as RectTransform;
            RectTransform titleRectTransform        = elements[NativeElemetType.TITLE] as RectTransform;
            RectTransform iconRectTransform         = elements[NativeElemetType.ICON] as RectTransform;
            RectTransform coverImageRectTransform   = elements[NativeElemetType.COVER_IMAGE] as RectTransform;
            RectTransform callToActionRectTransform = elements[NativeElemetType.CALL_TO_ACTION] as RectTransform;

            if (panelRectTransform == null || titleRectTransform == null || iconRectTransform == null || coverImageRectTransform == null || callToActionRectTransform == null)
            {
                Logger.Log("Yumi Native Ad requires the following transforms: panel, title, icon, coverImage, callToAction.");
                return;
            }
            RectTransform descriptionRectTransform = elements[NativeElemetType.DESCRIPTION] as RectTransform;

            if (descriptionRectTransform == null)
            {
                descriptionRectTransform = new RectTransform();
            }

            Rect adViewRect = getGameObjectRect(panelRectTransform, camera);

            Rect mediaViewRect = getGameObjectRect(coverImageRectTransform, camera);
            Rect iconViewRect  = getGameObjectRect(iconRectTransform, camera);
            Rect ctaViewRect   = getGameObjectRect(callToActionRectTransform, camera);
            Rect titleRect     = getGameObjectRect(titleRectTransform, camera);
            Rect descRect      = getGameObjectRect(descriptionRectTransform, camera);

            RegisterAssetObjectsForInteraction(yumiNaitveData, adViewRect, mediaViewRect, iconViewRect, ctaViewRect, titleRect, descRect);
        }
        private YumiNativeData getNativeData(string uniqueId)
        {
            string title           = nativeAd.Call <string>("getTitle", uniqueId);
            string description     = nativeAd.Call <string>("getDescription", uniqueId);
            string iconUrl         = nativeAd.Call <string>("getIconURL", uniqueId);
            string coverImageUrl   = nativeAd.Call <string>("getCoverImageURL", uniqueId);
            string callToAction    = nativeAd.Call <string>("getCallToAction", uniqueId);
            string price           = nativeAd.Call <string>("getPrice", uniqueId);
            string starRating      = nativeAd.Call <string>("getStarRating", uniqueId);
            string other           = nativeAd.Call <string>("getOther", uniqueId);
            bool   isExpressAdView = nativeAd.Call <bool>("isExpressAdView", uniqueId);

            YumiNativeData e = new YumiNativeData
            {
                uniqueId        = uniqueId,
                title           = title,
                desc            = description,
                iconURL         = iconUrl,
                coverImageURL   = coverImageUrl,
                callToAction    = callToAction,
                price           = price,
                starRating      = starRating,
                other           = other,
                isExpressAdView = isExpressAdView
            };

            return(e);
        }
        private List <YumiNativeData> getNativeDatas(string uniqueIds)
        {
            List <YumiNativeData> result = new List <YumiNativeData>();

            string[] uIds = uniqueIds.Split(',');
            foreach (string uId in uIds)
            {
                string title           = nativeAd.Call <string>("getTitle", uId);
                string description     = nativeAd.Call <string>("getDescription", uId);
                string iconUrl         = nativeAd.Call <string>("getIconURL", uId);
                string coverImageUrl   = nativeAd.Call <string>("getCoverImageURL", uId);
                string callToAction    = nativeAd.Call <string>("getCallToAction", uId);
                string price           = nativeAd.Call <string>("getPrice", uId);
                string starRating      = nativeAd.Call <string>("getStarRating", uId);
                string other           = nativeAd.Call <string>("getOther", uId);
                bool   isExpressAdView = nativeAd.Call <bool>("isExpressAdView", uId);

                YumiNativeData e = new YumiNativeData
                {
                    uniqueId        = uId,
                    title           = title,
                    desc            = description,
                    iconURL         = iconUrl,
                    coverImageURL   = coverImageUrl,
                    callToAction    = callToAction,
                    price           = price,
                    starRating      = starRating,
                    other           = other,
                    isExpressAdView = isExpressAdView
                };

                result.Add(e);
            }
            return(result);
        }
        public void RegisterNativeDataForInteraction(YumiNativeData yumiNaitveData, Dictionary <NativeElemetType, Transform> elements)
        {
            Logger.Log("YumiNativeClient: RegisterGameObjectsForInteraction " + yumiNaitveData.uniqueId);
            Camera        camera       = Camera.main;
            RectTransform panel        = elements[NativeElemetType.PANEL] as RectTransform;
            RectTransform titile       = elements[NativeElemetType.TITLE] as RectTransform;
            RectTransform icon         = elements[NativeElemetType.ICON] as RectTransform;
            RectTransform coverImage   = elements[NativeElemetType.COVER_IMAGE] as RectTransform;
            RectTransform callToAction = elements[NativeElemetType.CALL_TO_ACTION] as RectTransform;

            if (panel == null || titile == null || icon == null || coverImage == null || callToAction == null)
            {
                Logger.Log("Yumi Native Ad requires the following transforms: panel, titile, icon, coverImage, callToAction.");
                return;
            }
            RectTransform description = elements[NativeElemetType.DESCRIPTION] as RectTransform;

            if (description == null)
            {
                description = new RectTransform();
            }

            Rect panelRect        = getGameObjectRect(panel, camera);
            Rect titileRect       = getGameObjectRect(titile, camera);
            Rect iconRect         = getGameObjectRect(icon, camera);
            Rect coverImageRect   = getGameObjectRect(coverImage, camera);
            Rect callToActionRect = getGameObjectRect(callToAction, camera);
            Rect descriptionRect  = getGameObjectRect(description, camera);

            nativeAd.Call("fillViews", yumiNaitveData.uniqueId,
                          (int)panelRect.x, (int)panelRect.y, (int)panelRect.width, (int)panelRect.height,
                          (int)titileRect.x, (int)titileRect.y, (int)titileRect.width, (int)titileRect.height,
                          (int)iconRect.x, (int)iconRect.y, (int)iconRect.width, (int)iconRect.height,
                          (int)coverImageRect.x, (int)coverImageRect.y, (int)coverImageRect.width, (int)coverImageRect.height,
                          (int)callToActionRect.x, (int)callToActionRect.y, (int)callToActionRect.width, (int)callToActionRect.height,
                          (int)descriptionRect.x, (int)descriptionRect.y, (int)descriptionRect.width, (int)descriptionRect.height);
        }
Beispiel #5
0
 public void HideView(YumiNativeData nativeData)
 {
     YumiExterns.HideView(this.NativeAdPtr, nativeData.uniqueId);
 }
Beispiel #6
0
 public bool IsAdInvalidated(YumiNativeData nativeData)
 {
     return(YumiExterns.IsAdInvalidated(this.NativeAdPtr, nativeData.uniqueId));
 }
 public void UnregisterView(YumiNativeData nativeData)
 {
     nativeAd.Call("removeView", nativeData.uniqueId);
 }
 public void HideView(YumiNativeData nativeData)
 {
     nativeAd.Call("hideView", nativeData.uniqueId);
 }
 public void ShowView(YumiNativeData nativeData)
 {
     nativeAd.Call("showView", nativeData.uniqueId);
 }
 public bool IsAdInvalidated(YumiNativeData nativeData)
 {
     return(nativeAd.Call <bool>("isAdInvalidated", nativeData.uniqueId));
 }