コード例 #1
0
ファイル: AdsMgr.cs プロジェクト: moto2002/Fish
        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("");
        }
コード例 #2
0
        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;
                }
            }
        }
コード例 #3
0
        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());
        }
コード例 #4
0
ファイル: AdsMgr.cs プロジェクト: moto2002/Fish
        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);
        }
コード例 #5
0
ファイル: AdsMgr.cs プロジェクト: moto2002/Fish
        public void HideBannerAd(string placementID)
        {
            AdInterface ad = GetAdInterfaceByPlacementID(placementID, 0);

            if (ad == null)
            {
                return;
            }

            ad.HideAd();
        }
コード例 #6
0
ファイル: AdsMgr.cs プロジェクト: moto2002/Fish
        public AdInterface GetAdInterface(string interfaceName)
        {
            AdInterface adInterface = null;

            if (m_AdInterfaceMap.TryGetValue(interfaceName, out adInterface))
            {
                return(adInterface);
            }

            return(null);
        }
コード例 #7
0
ファイル: AdsMgr.cs プロジェクト: moto2002/Fish
        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();
        }
コード例 #8
0
        public void BindAdInterface(AdInterface ad)
        {
            if (m_AdInterface != null)
            {
                m_AdInterface.adEventListener = null;
            }

            m_AdInterface = ad;

            if (m_AdInterface != null)
            {
                m_AdInterface.adEventListener = this;
            }
        }
コード例 #9
0
        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);
                }
            }
        }
コード例 #10
0
ファイル: AdsMgr.cs プロジェクト: moto2002/Fish
        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);
                }
            }
        }
コード例 #11
0
ファイル: AdHandler.cs プロジェクト: moto2002/Fish
 public void SetAdInterface(AdInterface adInterface)
 {
     m_AdInterface = adInterface;
 }