Exemple #1
0
 public static void LoadNativeAdvertForAdType(TDNativeAdType nativeType)
 {
                 #if UNITY_IPHONE
     _LoadNativeAdvertForAdType(nativeType.ToString());
                 #elif UNITY_ANDROID
     CallAndroidStaticMethod("LoadNativeAd", nativeType.ToString());
                 #endif
 }
Exemple #2
0
 public static void LoadNativeAdvertForTag(string tag, TDNativeAdType nativeType)
 {
                 #if UNITY_IPHONE
     _LoadNativeAdvertForPlacementTag(tag, nativeType.ToString());
                 #elif UNITY_ANDROID
     CallAndroidStaticMethod("LoadNativeAd", nativeType.ToString(), tag);
                 #endif
 }
        public static TDAdType GetAdTypeFromNativeType(TDNativeAdType nativeType)
        {
            var nativeString = nativeType.ToString();

            var typeString = nativeString.Replace("TDNativeAdType", "TDAdType");

            return(GetEnumFromString <TDAdType>(typeString));
        }
Exemple #4
0
        public static bool IsNativeAdReady(TDNativeAdType adType, string tag)
        {
            bool ready = false;

                        #if UNITY_ANDROID
            ready = GetAndroidStatic <bool>("IsNativeAdReady", adType.ToString(), tag);
                        #endif
            return(ready);
        }
Exemple #5
0
        public static TDNativeAd GetNativeAd(TDNativeAdType adType, string tag)
        {
            var nativeAdJson = "{}";

                        #if UNITY_IPHONE
            nativeAdJson = Marshal.PtrToStringAnsi(_GetNativeAdWithTag(tag, adType.ToString()));
                        #elif UNITY_ANDROID
            nativeAdJson = GetAndroidStatic <string>("GetNativeAdWithTag", adType.ToString(), tag);
                        #else
            return(null);
                        #endif

            return(TDNativeAd.CreateNativeAd(nativeAdJson));
        }
        public static Vector2 ToVector2(this TDNativeAdType adType)
        {
            switch (adType)
            {
            case TDNativeAdType.TDNativeAdType1x1Large:
                return(new Vector2(750, 750));

            case TDNativeAdType.TDNativeAdType1x1Medium:
                return(new Vector2(375, 375));

            case TDNativeAdType.TDNativeAdType1x1Small:
                return(new Vector2(150, 150));


            case TDNativeAdType.TDNativeAdType1x2Large:
                return(new Vector2(900, 1800));

            case TDNativeAdType.TDNativeAdType1x2Medium:
                return(new Vector2(450, 900));

            case TDNativeAdType.TDNativeAdType1x2Small:
                return(new Vector2(180, 360));


            case TDNativeAdType.TDNativeAdType2x1Large:
                return(new Vector2(1800, 900));

            case TDNativeAdType.TDNativeAdType2x1Medium:
                return(new Vector2(900, 450));

            case TDNativeAdType.TDNativeAdType2x1Small:
                return(new Vector2(360, 180));


            case TDNativeAdType.TDNativeAdType2x3Large:
                return(new Vector2(960, 1440));

            case TDNativeAdType.TDNativeAdType2x3Medium:
                return(new Vector2(480, 720));

            case TDNativeAdType.TDNativeAdType2x3Small:
                return(new Vector2(192, 288));


            case TDNativeAdType.TDNativeAdType3x2Large:
                return(new Vector2(1440, 960));

            case TDNativeAdType.TDNativeAdType3x2Medium:
                return(new Vector2(720, 480));

            case TDNativeAdType.TDNativeAdType3x2Small:
                return(new Vector2(288, 192));


            case TDNativeAdType.TDNativeAdType1x5Large:
                return(new Vector2(360, 1800));

            case TDNativeAdType.TDNativeAdType1x5Medium:
                return(new Vector2(180, 900));

            case TDNativeAdType.TDNativeAdType1x5Small:
                return(new Vector2(72, 360));


            case TDNativeAdType.TDNativeAdType5x1Large:
                return(new Vector2(1800, 360));

            case TDNativeAdType.TDNativeAdType5x1Medium:
                return(new Vector2(900, 180));

            case TDNativeAdType.TDNativeAdType5x1Small:
                return(new Vector2(360, 72));


            default:
                return(Vector2.zero);
            }
        }