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()); }
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())); }
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); }
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; }
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); } }
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; }
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; }
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); }
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")); }
public override void SetAdConfig(TDAdConfig config) { base.SetAdConfig(config); MoPub.LoadBannerPluginsForAdUnits(new string[] { m_Config.unitID }); }
static void CompleteRowAdd(TDAdConfig tdData) { }