Exemplo n.º 1
0
        public void ShowTestUI(bool useClickCounter)
        {
            if (useClickCounter)
            {
                if (Time.realtimeSinceStartup - _testUILastClickTime <= 0.5f)
                {
                    _testUIClicks++;
                }
                else
                {
                    _testUIClicks = 0;
                }

                _testUILastClickTime = Time.realtimeSinceStartup;

                if (_testUIClicks >= 5)
                {
                    _testUIClicks = 0;
                    ShowTestUI(false);
                }
            }
            else
            {
                IAdsWrapperInterface wrapper = Wrapper;
                if (wrapper != null)
                {
                    wrapper.ShowTestUI();
                }
            }
        }
Exemplo n.º 2
0
        public void ShowRewardedVideo(string tag, Action callback, Action <int> rewardCallback, int productID)
        {
            IAdsWrapperInterface wrapper = Wrapper;
            bool adStarted = false;

            if (wrapper != null)
            {
                adStarted = true;
                _interstitialClosedCallback = callback;
                _rewardCallback             = rewardCallback;
                _rewardProductID            = productID;

                LogRewardAnalytics("start", tag);

                EventManager.SendEvent(IDs.Events.DisableMusicDuringAd);
                                #if UNITY_EDITOR
                DelayedCall.Create(OnGrantReward, 2f);
                                #else
                wrapper.ShowRewardedVideo(tag);
                                #endif
            }

            if (!adStarted && callback != null)
            {
                callback();
            }

            callback       = null;
            rewardCallback = null;
        }
Exemplo n.º 3
0
        private void ShowIntersitital(string tag, Action callback, bool useBetweenLevelCounter, bool usePromoCounter, GameObject adBlockObject)
        {
            IAdsWrapperInterface wrapper = Wrapper;
            bool adStarted = false;

            if (Enabled && wrapper != null)
            {
                if (useBetweenLevelCounter)
                {
                    Manager.State.IncreaseInterstitialCounter();
                }

                bool allowed = true;

                if (useBetweenLevelCounter)
                {
                    allowed = CanDisplayBetweenLevelAd;

                    if (allowed)
                    {
                        Manager.State.ResetInterstitialCounter();
                    }
                }

                if (usePromoCounter)
                {
                    allowed = CanDisplayPromo;

                    if (allowed)
                    {
                        Manager.State.RegisterPromoDisplay();
                    }
                }

                if (allowed)
                {
                    if (adBlockObject != null)
                    {
                        _adBlockObject = adBlockObject;
                        _adBlockObject.SetActive(true);
                    }

                    adStarted = true;
                    _interstitialClosedCallback = callback;
                    EventManager.SendEvent(IDs.Events.DisableMusicDuringAd);
                                        #if UNITY_EDITOR
                    DelayedCall.Create(OnInterstitialClosed, 2f);
                                        #else
                    wrapper.ShowIntersitital(tag);
                                        #endif
                }
            }

            if (!adStarted && callback != null)
            {
                callback();
            }

            callback = null;
        }
Exemplo n.º 4
0
        public void ShowBanner(string tag)
        {
            IAdsWrapperInterface wrapper = Wrapper;

            if (Enabled && wrapper != null)
            {
                wrapper.ShowBanner(tag);
            }
        }
Exemplo n.º 5
0
        public void HideBanner()
        {
            IAdsWrapperInterface wrapper = Wrapper;

            if (wrapper != null)
            {
                wrapper.HideBanner();
            }
        }
Exemplo n.º 6
0
        public bool IsBannerVisible()
        {
            IAdsWrapperInterface wrapper = Wrapper;

            if (Enabled && wrapper != null)
            {
                return(wrapper.IsBannerVisible());
            }
            else
            {
                return(false);
            }
        }
Exemplo n.º 7
0
        public float GetBannerHeight()
        {
            IAdsWrapperInterface wrapper = Wrapper;

            if (Enabled && wrapper != null)
            {
                return(wrapper.GetBannerHeight());
            }
            else
            {
                return(0f);
            }
        }
Exemplo n.º 8
0
        public void CacheRewardVideos(string tag, bool force, params string[] otherTags)
        {
            if (_rewardVideosCached && !force)
            {
                return;
            }

            IAdsWrapperInterface wrapper = Wrapper;

            if (wrapper != null)
            {
                wrapper.CacheRewardedVideo(tag);
                foreach (string otherTag in otherTags)
                {
                    wrapper.CacheRewardedVideo(otherTag);
                }
            }

            _rewardVideosCached = true;
        }
Exemplo n.º 9
0
        public void CacheIntersitials(string tag, params string[] otherTags)
        {
            if (_interstitialsCached)
            {
                return;
            }

            IAdsWrapperInterface wrapper = Wrapper;

            if (Enabled && wrapper != null)
            {
                wrapper.CacheInterstitial(tag);
                foreach (string otherTag in otherTags)
                {
                    wrapper.CacheInterstitial(otherTag);
                }
            }

            _interstitialsCached = true;
        }