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); }
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); }