Ejemplo n.º 1
0
        bool ShouldShowAd()
        {
            bool isFirstAdEver = lifetimeStatistics.AdsDisplayedCount == 0;

            switch ((GameGroups.GameGroupGameType)GameGroups.GameCtrl.instance.SelectGameNumber)
            {
            case GameGroups.GameGroupGameType.Cat:
                Configs.Cat.InterstitialAdsConfig config     = configService.GetConfig <Configs.Cat.InterstitialAdsConfig>();
                InterstitialShowParameters        showConfig = isFirstAdEver ? config.FirstAdShowParameters : config.NextAdsShowParameters;
                return(ShouldShowAd(showConfig));

            case GameGroups.GameGroupGameType.Gun:
                Configs.Gun.InterstitialAdsConfig config2     = configService.GetConfig <Configs.Gun.InterstitialAdsConfig>();
                InterstitialShowParameters        showConfig2 = isFirstAdEver ? config2.FirstAdShowParameters : config2.NextAdsShowParameters;
                return(ShouldShowAd(showConfig2));

            case GameGroups.GameGroupGameType.Orbit:
                Configs.Orbit.InterstitialAdsConfig config3     = configService.GetConfig <Configs.Orbit.InterstitialAdsConfig>();
                InterstitialShowParameters          showConfig3 = isFirstAdEver ? config3.FirstAdShowParameters : config3.NextAdsShowParameters;
                return(ShouldShowAd(showConfig3));

            case GameGroups.GameGroupGameType.Slame:
                Configs.Slame.InterstitialAdsConfig config4     = configService.GetConfig <Configs.Slame.InterstitialAdsConfig>();
                InterstitialShowParameters          showConfig4 = isFirstAdEver ? config4.FirstAdShowParameters : config4.NextAdsShowParameters;
                return(ShouldShowAd(showConfig4));
            }
            return(false);
        }
Ejemplo n.º 2
0
        bool ShouldShowAd(InterstitialShowParameters showParameters)
        {
            float secondsFromLastAd      = GetSecondsFromLastAdViewed();
            bool  isTimeConditionMet     = secondsFromLastAd > showParameters.TimeBeforeAdShown;
            int   deathsFromLastAdViewed = GetDeathsFromLastAdViewed();
            bool  isDeathsConditionMet   = deathsFromLastAdViewed >= showParameters.DeathsAndLevelsBeforeAdShown;

            return(isTimeConditionMet && isDeathsConditionMet);
        }