コード例 #1
0
        public static AdRequest BuildRequest(TDAdConfig data)
        {
            var builder = new AdRequest.Builder();

            if (m_Config.isDebugMode)
            {
                builder.AddTestDevice("54A21F94407E31BD8A20879613096F8B");
            }

            if (!string.IsNullOrEmpty(data.keyword))
            {
                builder.AddKeyword(data.keyword);
            }
            builder.SetGender((Gender)data.gender);
            if (data.isBirthDayConfiged)
            {
                builder.SetBirthday(data.GetBirthDayTime());
            }

            if (data.forFamilies)
            {
                builder.AddExtra("is_designed_for_families", "true");
            }

            if (data.forChild)
            {
                builder.TagForChildDirectedTreatment(true);
            }

            return(builder.Build());
        }
コード例 #2
0
ファイル: AdHandler.cs プロジェクト: moto2002/Fish
        public virtual void SetAdConfig(TDAdConfig config)
        {
            m_Config = config;
            m_PlatformAdHandlerState = PlatformAdHandlerState.GetAdHandlerState(config);

            m_AfDataDic.Add(DataAnalysisDefine.AF_PID, m_Config.unitID.ToString());
            m_AfDataDic.Add(DataAnalysisDefine.AF_SDK_NAME, AdsMgr.S.GetAfPlatformName(m_Config.adPlatform.ToString()));
        }
コード例 #3
0
ファイル: AdsMgr.cs プロジェクト: moto2002/Fish
        public AdHandler CreateAdHandler(TDAdConfig data)
        {
            if (string.IsNullOrEmpty(data.unitID))
            {
                return(null);
            }

            if (data.ecpm <= -100000)
            {
                return(null);
            }

            if (m_AdHandlerMap.ContainsKey(data.id))
            {
                return(null);
            }

            IAdAdapter adAdapter = GetAdAdapter(data.adPlatform);

            if (adAdapter == null)
            {
                Log.e("Not Find AdAdapter For Ad:" + data.id);
                return(null);
            }

            AdHandler result = null;

            switch (data.adType)
            {
            case AdType.Banner:
                result = adAdapter.CreateBannerHandler();
                break;

            case AdType.Interstitial:
                result = adAdapter.CreateInterstitialHandler();
                break;

            case AdType.NativeAD:
                result = adAdapter.CreateNativeAdHandler();
                break;

            case AdType.RewardedVideo:
                result = adAdapter.CreateRewardVideoHandler();
                break;

            default:
                break;
            }

            if (result != null)
            {
                result.SetAdConfig(data);
            }

            m_AdHandlerMap.Add(data.id, result);

            return(result);
        }
コード例 #4
0
        public override void SetAdConfig(TDAdConfig config)
        {
            base.SetAdConfig(config);
            MoPub.LoadInterstitialPluginsForAdUnits(new string[] { m_Config.unitID });

            MoPubManager.OnInterstitialLoadedEvent    += OnInterstitialLoadedEvent;
            MoPubManager.OnInterstitialFailedEvent    += OnInterstitialFailedEvent;
            MoPubManager.OnInterstitialShownEvent     += OnInterstitialShownEvent;
            MoPubManager.OnInterstitialClickedEvent   += OnInterstitialClickedEvent;
            MoPubManager.OnInterstitialDismissedEvent += OnInterstitialDismissedEvent;
            MoPubManager.OnInterstitialExpiredEvent   += OnInterstitialExpiredEvent;
        }
コード例 #5
0
ファイル: TDAdConfigTable.cs プロジェクト: anningwithv/Fish
 private static void OnAddRow(TDAdConfig memberInstance)
 {
     string key = memberInstance.id;
     if (m_DataCache.ContainsKey(key))
     {
         Log.e(string.Format("Invaild,  TDConfigTable Id already exists {0}", key));
     }
     else
     {
         m_DataCache.Add(key, memberInstance);
         m_DataList.Add(memberInstance);
     }
 }    
コード例 #6
0
        public override void SetAdConfig(TDAdConfig config)
        {
            base.SetAdConfig(config);
            MoPub.LoadRewardedVideoPluginsForAdUnits(new string[] { m_Config.unitID });

            MoPubManager.OnRewardedVideoLoadedEvent             += OnRewardedVideoLoadedEvent;
            MoPubManager.OnRewardedVideoFailedEvent             += OnRewardedVideoFailedEvent;
            MoPubManager.OnRewardedVideoExpiredEvent            += OnRewardedVideoExpiredEvent;
            MoPubManager.OnRewardedVideoShownEvent              += OnRewardedVideoShownEvent;
            MoPubManager.OnRewardedVideoClickedEvent            += OnRewardedVideoClickedEvent;
            MoPubManager.OnRewardedVideoFailedToPlayEvent       += OnRewardedVideoFailedToPlayEvent;
            MoPubManager.OnRewardedVideoReceivedRewardEvent     += OnRewardedVideoReceivedRewardEvent;
            MoPubManager.OnRewardedVideoClosedEvent             += OnRewardedVideoClosedEvent;
            MoPubManager.OnRewardedVideoLeavingApplicationEvent += OnRewardedVideoLeavingApplicationEvent;
        }
コード例 #7
0
        protected override void LoadAdInner()
        {
#if UNITY_EDITOR
            return;
#endif

            TDAdConfig data = TDAdConfigTable.GetData(m_AdName);
            if (data == null)
            {
                return;
            }

            m_AdUnitID = data.unitID;

            m_NativeAd = new AudienceNetwork.NativeAd(m_AdUnitID);

            m_NativeAd.RegisterGameObjectForImpression(gameObject, null);

            m_NativeAd.NativeAdDidLoad = (delegate()
            {
                if (On_AdTextLoadFinish != null)
                {
                    OnTextLoadFinish();
                }

                StartCoroutine(LoadIconImage());
                StartCoroutine(LoadCoverImage());
            });

            m_NativeAd.NativeAdDidFailWithError = (delegate(string error)
            {
                Log.w("Native ad failed to load with error: ");
            });

            m_NativeAd.NativeAdWillLogImpression = (delegate()
            {
                Log.i("Native ad logged impression.");
            });

            m_NativeAd.NativeAdDidClick = (delegate()
            {
                Log.i("Native ad clicked.");
            });

            m_NativeAd.LoadAd();
            return;
        }
コード例 #8
0
ファイル: AdHandler.cs プロジェクト: moto2002/Fish
            public static PlatformAdHandlerState GetAdHandlerState(TDAdConfig config)
            {
                string key = string.Format("{0}-{1}", config.adPlatform, config.adType);

                if (m_StateMap == null)
                {
                    m_StateMap = new Dictionary <string, PlatformAdHandlerState>();
                }

                PlatformAdHandlerState result = null;

                if (!m_StateMap.TryGetValue(key, out result))
                {
                    result = new PlatformAdHandlerState(key);
                    m_StateMap.Add(key, result);
                }

                return(result);
            }
コード例 #9
0
ファイル: TDAdConfigTable.cs プロジェクト: anningwithv/Fish
     public static void Parse(byte[] fileData)
     {
         m_DataCache.Clear();
         m_DataList.Clear();
         DataStreamReader dataR = new DataStreamReader(fileData);
         int rowCount = dataR.GetRowCount();
         int[] fieldIndex = dataR.GetFieldIndex(TDAdConfig.GetFieldHeadIndex());
 #if (UNITY_STANDALONE_WIN) || UNITY_EDITOR || UNITY_STANDALONE_OSX
         dataR.CheckFieldMatch(TDAdConfig.GetFieldHeadIndex(), "AdConfigTable");
 #endif
         for (int i = 0; i < rowCount; ++i)
         {
             TDAdConfig memberInstance = new TDAdConfig();
             memberInstance.ReadRow(dataR, fieldIndex);
             OnAddRow(memberInstance);
             memberInstance.Reset();
             CompleteRowAdd(memberInstance);
         }
         Log.i(string.Format("Parse Success TDAdConfig"));
     }
コード例 #10
0
ファイル: MoPubBannerHandler.cs プロジェクト: moto2002/Fish
 public override void SetAdConfig(TDAdConfig config)
 {
     base.SetAdConfig(config);
     MoPub.LoadBannerPluginsForAdUnits(new string[] { m_Config.unitID });
 }
コード例 #11
0
 static void CompleteRowAdd(TDAdConfig tdData)
 {
 }