Beispiel #1
0
 private void CreateActionsSection()
 {
     GUILayout.Space((float)this._sectionMarginSize);
     GUILayout.Label("Actions", Array.Empty <GUILayoutOption>());
     if (GUILayout.Button("Report App Open", Array.Empty <GUILayoutOption>()))
     {
         this.ClearStatusLabel();
         MoPubAndroid.ReportApplicationOpen(null);
     }
     if (GUILayout.Button("Enable Location Support", Array.Empty <GUILayoutOption>()))
     {
         this.ClearStatusLabel();
         MoPubAndroid.EnableLocationSupport(true);
     }
 }
Beispiel #2
0
 private void CreateActionsSection()
 {
     GUILayout.Space((float)this._sectionMarginSize);
     GUILayout.Label("Actions", new GUILayoutOption[0]);
     if (GUILayout.Button("Report App Open", new GUILayoutOption[0]))
     {
         this._status = string.Empty;
         MoPubAndroid.ReportApplicationOpen(null);
     }
     if (!GUILayout.Button("Enable Location Support", new GUILayoutOption[0]))
     {
         return;
     }
     this._status = string.Empty;
     MoPubAndroid.EnableLocationSupport(true);
 }
 public void InitializeRewarded(string rewardAdUnit)
 {
     MoPubAndroid.EnableLocationSupport(true);
     if (!string.IsNullOrEmpty(rewardAdUnit))
     {
         try
         {
             this.rewardUnit      = rewardAdUnit;
             this.rewardedEnabled = true;
             this.InternalInit(this.rewardUnit);
             MoPubAndroid.LoadRewardedVideoPluginsForAdUnits(new string[]
             {
                 this.rewardUnit
             });
         }
         catch (Exception ex)
         {
             this.rewardUnit      = null;
             this.rewardedEnabled = false;
             FMLogger.Log("failed to init rewarded. error: " + ex.Message);
         }
     }
 }
 public void Initialize(string bAdUnit, BannerPosition bannerPos, string fsAdUnit, string rewardAdUnit)
 {
     MoPubAndroid.EnableLocationSupport(true);
     MoPubManager.OnAdLoadedEvent                        += this.onAdLoadedEvent;
     MoPubManager.OnAdFailedEvent                        += this.onAdFailedEvent;
     MoPubManager.OnAdClickedEvent                       += this.onAdClickedEvent;
     MoPubManager.OnAdExpandedEvent                      += this.onAdExpandedEvent;
     MoPubManager.OnAdCollapsedEvent                     += this.onAdCollapsedEvent;
     MoPubManager.OnInterstitialLoadedEvent              += this.onInterstitialLoadedEvent;
     MoPubManager.OnInterstitialFailedEvent              += this.onInterstitialFailedEvent;
     MoPubManager.OnInterstitialShownEvent               += this.onInterstitialShownEvent;
     MoPubManager.OnInterstitialClickedEvent             += this.onInterstitialClickedEvent;
     MoPubManager.OnInterstitialDismissedEvent           += this.onInterstitialDismissedEvent;
     MoPubManager.OnInterstitialExpiredEvent             += this.onInterstitialExpiredEvent;
     MoPubManager.OnRewardedVideoLoadedEvent             += this.onRewardedVideoLoadedEvent;
     MoPubManager.OnRewardedVideoFailedEvent             += this.onRewardedVideoFailedEvent;
     MoPubManager.OnRewardedVideoExpiredEvent            += this.onRewardedVideoExpiredEvent;
     MoPubManager.OnRewardedVideoShownEvent              += this.onRewardedVideoShownEvent;
     MoPubManager.OnRewardedVideoClickedEvent            += this.onRewardedVideoClickedEvent;
     MoPubManager.OnRewardedVideoFailedToPlayEvent       += this.onRewardedVideoFailedToPlayEvent;
     MoPubManager.OnRewardedVideoReceivedRewardEvent     += this.onRewardedVideoReceivedRewardEvent;
     MoPubManager.OnRewardedVideoClosedEvent             += this.onRewardedVideoClosedEvent;
     MoPubManager.OnRewardedVideoLeavingApplicationEvent += this.onRewardedVideoLeavingApplicationEvent;
     if (!string.IsNullOrEmpty(bAdUnit))
     {
         try
         {
             this.bannerAdUnit   = bAdUnit;
             this.bannerEnabled  = true;
             this.bannerPosition = ((bannerPos != BannerPosition.Bottom) ? MoPubBase.AdPosition.TopCenter : MoPubBase.AdPosition.BottomCenter);
             this.InternalInit(this.bannerAdUnit);
             MoPubAndroid.LoadBannerPluginsForAdUnits(new string[]
             {
                 this.bannerAdUnit
             });
         }
         catch (Exception ex)
         {
             this.bannerEnabled = false;
             FMLogger.vAds("failed to init mopab banner. error: " + ex.Message);
         }
     }
     if (!string.IsNullOrEmpty(fsAdUnit))
     {
         try
         {
             this.interstitialAdUnit = fsAdUnit;
             this.fsEnabled          = true;
             this.InternalInit(this.interstitialAdUnit);
             MoPubAndroid.LoadInterstitialPluginsForAdUnits(new string[]
             {
                 this.interstitialAdUnit
             });
         }
         catch (Exception ex2)
         {
             this.fsEnabled = false;
             FMLogger.vAds("failed to init mopab interstitial. error: " + ex2.Message);
         }
     }
     if (!string.IsNullOrEmpty(rewardAdUnit))
     {
         try
         {
             this.rewardUnit      = rewardAdUnit;
             this.rewardedEnabled = true;
             this.InternalInit(this.rewardUnit);
             MoPubAndroid.LoadRewardedVideoPluginsForAdUnits(new string[]
             {
                 this.rewardUnit
             });
         }
         catch (Exception ex3)
         {
             this.rewardUnit      = null;
             this.rewardedEnabled = false;
             FMLogger.Log("failed to init rewarded. error: " + ex3.Message);
         }
     }
     if (this.bannerEnabled || this.fsEnabled || this.rewardedEnabled)
     {
         ApplovinHelper.InitializeSdk();
     }
     this.RequestBanner();
     this.RequestInterstitial();
 }