Ejemplo n.º 1
0
        public void InitializeAdUnits()
        {
            string videoAdUnitId = this.GetVideoAdUnitId();

            MCAdsBinding.ReportApplicationOpen("847985808");
            string[] adUnits = new string[]
            {
                videoAdUnitId
            };
            MCAdsBinding.SetLogLevel(MCAdsLogging.LogLevel.Error);
            MCAdsLogging.SetLogLevel(MCAdsLogging.LogLevel.Error);
            string guestPreferredLanguage = Service.Lang.ExtractLanguageFromLocale();

            MCAdsBinding.SetGuestPreferredLanguage(guestPreferredLanguage);
            uint lastPaymentTime = Service.CurrentPlayer.LastPaymentTime;

            MCAdsBinding.SetGuestIsPayer(lastPaymentTime > 0u);
            MCAdsBinding.SetGuestAge(99);
            MCAdsBinding.InitializeRewardedVideo(adUnits);
            EventManager eventManager = Service.EventManager;

            eventManager.RegisterObserver(this, EventId.ApplicationPauseToggled);
            eventManager.RegisterObserver(this, EventId.InAppPurchaseMade);
            MCAdsManager.rewardedVideoAdDidAppearEvent     += new Action <string>(this.VideoAdAppeared);
            MCAdsManager.rewardedVideoAdDidDisappearEvent  += new Action <string>(this.VideoAdDisappeared);
            MCAdsManager.rewardedVideoAdShouldRewardEvent  += new Action <string>(this.ShouldRewardVideoAd);
            MCAdsManager.rewardedVideoAdDidFailToPlayEvent += new Action <string>(this.VideoAdFailToPlay);
        }
Ejemplo n.º 2
0
 public void HandleApplicationPause(bool isPaused)
 {
     if (isPaused)
     {
         MCAdsBinding.PauseRewardedVideo();
     }
     else
     {
         MCAdsBinding.ResumeRewardedVideo();
     }
 }
Ejemplo n.º 3
0
        public void ShowRewardedVideoAd()
        {
            if (!this.IsMobileConnectorAdAvailable())
            {
                Service.Logger.Warn("Not Available Yet");
                return;
            }
            ProcessingScreen.Show();
            this.HandleBackgrounding();
            string videoAdUnitId = this.GetVideoAdUnitId();

            this.BILogEvent("video_ad", "start", videoAdUnitId);
            MCAdsBinding.ShowRewardedVideo(videoAdUnitId);
        }
Ejemplo n.º 4
0
 public EatResponse OnEvent(EventId id, object cookie)
 {
     if (id != EventId.ApplicationPauseToggled)
     {
         if (id == EventId.InAppPurchaseMade)
         {
             MCAdsBinding.SetGuestIsPayer(true);
         }
     }
     else
     {
         this.HandleApplicationPause((bool)cookie);
     }
     return(EatResponse.NotEaten);
 }
Ejemplo n.º 5
0
        public bool IsMobileConnectorAdAvailable()
        {
            if (!this.CanInitialize())
            {
                return(false);
            }
            string value = "a";

            if (string.IsNullOrEmpty(value))
            {
                return(false);
            }
            string videoAdUnitId = this.GetVideoAdUnitId();

            return(MCAdsBinding.IsRewardedVideoReady(videoAdUnitId));
        }