Exemple #1
0
        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("");
        }
Exemple #2
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);
                }
            }
        }