Пример #1
0
        public static void OnNativeBannerFilled(TapsellNativeBannerAd result)
        {
#if UNITY_ANDROID && !UNITY_EDITOR
            string zoneId = result.zoneId;
            if (result != null)
            {
                if (mMonoBehaviour != null && mMonoBehaviour.isActiveAndEnabled)
                {
                    mMonoBehaviour.StartCoroutine(LoadNativeBannerAdImages(result));
                }
                else
                {
                    if (errorPool.ContainsKey(zoneId))
                    {
                        TapsellError error = new TapsellError();
                        error.zoneId  = zoneId;
                        error.message = "Invalid MonoBehaviour Object";
                        errorPool[zoneId] (error);
                    }
                }
            }
            else
            {
                if (errorPool.ContainsKey(zoneId))
                {
                    TapsellError error = new TapsellError();
                    error.zoneId  = zoneId;
                    error.message = "Invalid Result";
                    errorPool[zoneId] (error);
                }
            }
#endif
        }
Пример #2
0
        static IEnumerator LoadNativeBannerAdImages(TapsellNativeBannerAd result)
        {
            if (result.iconUrl != null && !result.iconUrl.Equals(""))
            {
                UnityWebRequest wwwIcon = UnityWebRequestTexture.GetTexture(result.iconUrl);
                yield return(wwwIcon.SendWebRequest());

                if (wwwIcon.isNetworkError || wwwIcon.isHttpError)
                {
                    Debug.Log(wwwIcon.error);
                }
                else
                {
                    result.iconImage = ((DownloadHandlerTexture)wwwIcon.downloadHandler).texture;
                }
            }

            if (result.portraitStaticImageUrl != null && !result.portraitStaticImageUrl.Equals(""))
            {
                UnityWebRequest wwwPortrait = UnityWebRequestTexture.GetTexture(result.portraitStaticImageUrl);
                yield return(wwwPortrait.SendWebRequest());

                if (wwwPortrait.isNetworkError || wwwPortrait.isHttpError)
                {
                    Debug.Log(wwwPortrait.error);
                }
                else
                {
                    result.portraitBannerImage = ((DownloadHandlerTexture)wwwPortrait.downloadHandler).texture;
                }
            }

            if (result.landscapeStaticImageUrl != null && !result.landscapeStaticImageUrl.Equals(""))
            {
                UnityWebRequest wwwLandscape = UnityWebRequestTexture.GetTexture(result.landscapeStaticImageUrl);
                yield return(wwwLandscape.SendWebRequest());

                if (wwwLandscape.isNetworkError || wwwLandscape.isHttpError)
                {
                    Debug.Log(wwwLandscape.error);
                }
                else
                {
                    result.landscapeBannerImage = ((DownloadHandlerTexture)wwwLandscape.downloadHandler).texture;
                }
            }

            if (nativeBannerFilledPool.ContainsKey(result.zoneId))
            {
                nativeBannerFilledPool[result.zoneId] (result);
            }
        }
Пример #3
0
        static IEnumerator loadNativeBannerAdImages(TapsellNativeBannerAd result)
        {
            if (result.iconUrl != null && !result.iconUrl.Equals(""))
            {
                WWW wwwIcon = new WWW(result.iconUrl);
                yield return(wwwIcon);

                if (wwwIcon.texture != null)
                {
                    result.iconImage = wwwIcon.texture;
                }
            }
            if (result.portraitStaticImageUrl != null && !result.portraitStaticImageUrl.Equals(""))
            {
                WWW wwwPortrait = new WWW(result.portraitStaticImageUrl);
                yield return(wwwPortrait);

                if (wwwPortrait.texture != null)
                {
                    result.portraitBannerImage = wwwPortrait.texture;
                }
            }
            if (result.landscapeStaticImageUrl != null && !result.landscapeStaticImageUrl.Equals(""))
            {
                WWW wwwLandscape = new WWW(result.landscapeStaticImageUrl);
                yield return(wwwLandscape);

                if (wwwLandscape.texture != null)
                {
                    result.landscapeBannerImage = wwwLandscape.texture;
                }
            }
            string zone = result.zoneId;

            if (requestNativeBannerFilledPool.ContainsKey(zone))
            {
                requestNativeBannerFilledPool [zone](result);
            }
        }