public void ShowBannerAd(string placementID, AdSize size, AdPosition position, int x = 0, int y = 0, bool force = false) { if (m_IsNoAds && !force) { return; } #if UNITY_IOS || UNITY_IPHONE if (size.height == AdSize.SmartBanner.height) { size = AdSize.Banner; } #endif AdInterface ad = GetAdInterfaceByPlacementID(placementID, 0); if (ad == null) { return; } ad.adSize = size; ad.adPosition = position; ad.adCustomGrid = new Vector2Int(x, y); ad.ShowAd(""); }
public void BindAdInterface(string placementName) { if (m_AdPlacementName == placementName) { return; } if (m_AdInterface != null) { m_AdInterface.adEventListener = null; m_AdInterface = null; } m_AdPlacementName = placementName; TDAdPlacement data = TDAdPlacementTable.GetData(m_AdPlacementName); if (data == null) { return; } if (!string.IsNullOrEmpty(data.adInterface0)) { m_AdInterface = AdsMgr.S.GetAdInterface(data.adInterface0); if (m_AdInterface != null) { m_AdInterface.adEventListener = this; } } }
private bool CheckSecInterShow() { if (m_AdIndex > 1) { return(false); } string interfaceName = m_Builder.GetAdInterfaceName(m_AdIndex); if (string.IsNullOrEmpty(interfaceName)) { return(false); } AdInterface adInterface = AdsMgr.S.GetAdInterface(interfaceName); if (adInterface == null) { return(false); } string attr = PlayerPrefs.GetString("AppsFlyerAttr", ""); if (!attr.Trim().ToLower().Equals("non-organic")) { return(false); } return(AdsAnalysisMgr.S.IsSecInterAvaliable()); }
public AdInterface GetAdInterfaceByPlacementID(string placementID, int index) { AdPlacement placement = GetAdPlacement(placementID); if (placement == null) { Log.e("Not Find Placement:" + placementID); return(null); } if (string.IsNullOrEmpty(placement.data.adInterface0)) { Log.e("Invalid AdInterface For Ad:" + placementID); return(null); } AdInterface ad = null; if (index == 0) { ad = GetAdInterface(placement.data.adInterface0); } else { ad = GetAdInterface(placement.data.adInterface1); } if (ad == null) { Log.w("Not Find AdInterface For Ad:" + placementID); return(null); } return(ad); }
public void HideBannerAd(string placementID) { AdInterface ad = GetAdInterfaceByPlacementID(placementID, 0); if (ad == null) { return; } ad.HideAd(); }
public AdInterface GetAdInterface(string interfaceName) { AdInterface adInterface = null; if (m_AdInterfaceMap.TryGetValue(interfaceName, out adInterface)) { return(adInterface); } return(null); }
public void SetBannerPosition(string placementID, AdPosition position, int x, int y) { AdInterface ad = GetAdInterfaceByPlacementID(placementID, 0); if (ad == null) { return; } ad.adPosition = position; ad.adCustomGrid = new Vector2Int(x, y); ad.SyncAdPosition(); }
public void BindAdInterface(AdInterface ad) { if (m_AdInterface != null) { m_AdInterface.adEventListener = null; } m_AdInterface = ad; if (m_AdInterface != null) { m_AdInterface.adEventListener = this; } }
protected bool ShowFullAd(string adInterfaceName, bool wait) { AdInterface adInterface = AdsMgr.S.GetAdInterface(adInterfaceName); if (adInterface == null) { Log.e("Not Find ADInterface:" + adInterfaceName); return(false); } if (adInterface.isAdReady) { if (adInterface.adType == AdType.Interstitial) { if (m_AdIndex < 1) { m_IsRewardSuccess = true; } AdsAnalysisMgr.S.AddInterShowCount(); } if (adInterface.ShowAd(m_Builder.rewardID)) { m_IsShowSuccess = true; m_Builder.CustomAdTag(m_AdIndex.ToString()); BindAdInterface(adInterface); m_Placement.RecordShowTime(); DataAnalysisMgr.S.CustomEventWithDate(DataAnalysisDefine.AD_SHOW_COUNT, "0"); return(true); } return(false); } else { if (wait && m_Placement.data.maxWaitTime > 0) { StartWaitAdLoading(); BindAdInterface(adInterface); adInterface.PreLoadAd(); return(true); } else { return(false); } } }
protected void InitAdInterfaceMap() { m_AdInterfaceMap = new Dictionary <string, AdInterface>(); m_AdHandlerMap = new Dictionary <string, AdHandler>(); var datas = TDAdConfigTable.dataList; for (int i = 0; i < datas.Count; ++i) { var data = datas[i]; AdInterface adInterface = null; if (m_AdInterfaceMap.TryGetValue(data.adInterface, out adInterface)) { continue; } switch (data.adType) { case AdType.Banner: adInterface = new AdBannerInterface(); break; case AdType.Interstitial: adInterface = new AdFullScreenInterface(); break; case AdType.RewardedVideo: adInterface = new AdFullScreenInterface(); break; case AdType.NativeAD: break; default: break; } if (adInterface != null) { adInterface.InitAdInterface(data.adInterface, data.adType); m_AdInterfaceMap.Add(data.adInterface, adInterface); } } }
public void SetAdInterface(AdInterface adInterface) { m_AdInterface = adInterface; }