Esempio n. 1
0
 private void CreateInterstitialsSection()
 {
     GUILayout.Space((float)this._sectionMarginSize);
     GUILayout.Label("Interstitials", new GUILayoutOption[0]);
     if (!MoPubDemoGUI.IsAdUnitArrayNullOrEmpty(this._interstitialAdUnits))
     {
         foreach (string text in this._interstitialAdUnits)
         {
             GUILayout.BeginHorizontal(new GUILayoutOption[0]);
             GUI.enabled = !this._adUnitToLoadedMapping[text];
             if (GUILayout.Button(MoPubDemoGUI.CreateRequestButtonLabel(text), new GUILayoutOption[0]))
             {
                 UnityEngine.Debug.Log("requesting interstitial with AdUnit: " + text);
                 this._status = "Requesting " + text;
                 MoPubAndroid.RequestInterstitialAd(text, string.Empty, string.Empty);
             }
             GUI.enabled = this._adUnitToLoadedMapping[text];
             if (GUILayout.Button("Show", new GUILayoutOption[0]))
             {
                 this._status = string.Empty;
                 MoPubAndroid.ShowInterstitialAd(text);
             }
             GUI.enabled = true;
             GUILayout.EndHorizontal();
         }
     }
     else
     {
         GUILayout.Label("No interstitial AdUnits available", this._smallerFont, null);
     }
 }
Esempio n. 2
0
 private void CreateRewardedRichMediaSection()
 {
     GUILayout.Space((float)this._sectionMarginSize);
     GUILayout.Label("Rewarded Rich Media", new GUILayoutOption[0]);
     if (!MoPubDemoGUI.IsAdUnitArrayNullOrEmpty(this._rewardedRichMediaAdUnits))
     {
         MoPubDemoGUI.CreateCustomDataField("rrmCustomDataField", ref this._rrmCustomData);
         foreach (string text in this._rewardedRichMediaAdUnits)
         {
             GUILayout.BeginHorizontal(new GUILayoutOption[0]);
             GUI.enabled = !this._adUnitToLoadedMapping[text];
             if (GUILayout.Button(MoPubDemoGUI.CreateRequestButtonLabel(text), new GUILayoutOption[0]))
             {
                 UnityEngine.Debug.Log("requesting rewarded rich media with AdUnit: " + text);
                 this._status = "Requesting " + text;
                 MoPubAndroid.RequestRewardedVideo(text, null, "rewarded, video, mopub", null, 37.7833, 122.4167, "customer101");
             }
             GUI.enabled = this._adUnitToLoadedMapping[text];
             if (GUILayout.Button("Show", new GUILayoutOption[0]))
             {
                 this._status = string.Empty;
                 MoPubAndroid.ShowRewardedVideo(text, MoPubDemoGUI.GetCustomData(this._rrmCustomData));
             }
             GUI.enabled = true;
             GUILayout.EndHorizontal();
             if (MoPubAndroid.HasRewardedVideo(text) && this._adUnitToRewardsMapping.ContainsKey(text) && this._adUnitToRewardsMapping[text].Count > 1)
             {
                 GUILayout.BeginVertical(new GUILayoutOption[0]);
                 GUILayout.Space((float)this._sectionMarginSize);
                 GUILayout.Label("Select a reward:", new GUILayoutOption[0]);
                 foreach (MoPubBase.Reward selectedReward in this._adUnitToRewardsMapping[text])
                 {
                     if (GUILayout.Button(selectedReward.ToString(), new GUILayoutOption[0]))
                     {
                         MoPubAndroid.SelectReward(text, selectedReward);
                     }
                 }
                 GUILayout.Space((float)this._sectionMarginSize);
                 GUILayout.EndVertical();
             }
         }
     }
     else
     {
         GUILayout.Label("No rewarded rich media AdUnits available", this._smallerFont, null);
     }
 }
Esempio n. 3
0
 private void CreateBannersSection()
 {
     GUILayout.Space(102f);
     GUILayout.Label("Banners", new GUILayoutOption[0]);
     if (!MoPubDemoGUI.IsAdUnitArrayNullOrEmpty(this._bannerAdUnits))
     {
         foreach (string text in this._bannerAdUnits)
         {
             GUILayout.BeginHorizontal(new GUILayoutOption[0]);
             GUI.enabled = !this._adUnitToLoadedMapping[text];
             if (GUILayout.Button(MoPubDemoGUI.CreateRequestButtonLabel(text), new GUILayoutOption[0]))
             {
                 UnityEngine.Debug.Log("requesting banner with AdUnit: " + text);
                 this._status = "Requesting " + text;
                 MoPubAndroid.CreateBanner(text, MoPubBase.AdPosition.BottomCenter);
             }
             GUI.enabled = this._adUnitToLoadedMapping[text];
             if (GUILayout.Button("Destroy", new GUILayoutOption[0]))
             {
                 this._status = string.Empty;
                 MoPubAndroid.DestroyBanner(text);
                 this._adUnitToLoadedMapping[text] = false;
                 this._adUnitToShownMapping[text]  = false;
             }
             GUI.enabled = (this._adUnitToLoadedMapping[text] && !this._adUnitToShownMapping[text]);
             if (GUILayout.Button("Show", new GUILayoutOption[0]))
             {
                 this._status = string.Empty;
                 MoPubAndroid.ShowBanner(text, true);
                 this._adUnitToShownMapping[text] = true;
             }
             GUI.enabled = (this._adUnitToLoadedMapping[text] && this._adUnitToShownMapping[text]);
             if (GUILayout.Button("Hide", new GUILayoutOption[0]))
             {
                 this._status = string.Empty;
                 MoPubAndroid.ShowBanner(text, false);
                 this._adUnitToShownMapping[text] = false;
             }
             GUI.enabled = true;
             GUILayout.EndHorizontal();
         }
     }
     else
     {
         GUILayout.Label("No banner AdUnits available", this._smallerFont, null);
     }
 }