Пример #1
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);
     }
 }
Пример #2
0
 private void CreateRewardedVideosSection()
 {
     GUILayout.Space((float)this._sectionMarginSize);
     GUILayout.Label("Rewarded Videos", Array.Empty <GUILayoutOption>());
     if (!IsAdUnitArrayNullOrEmpty(this._rewardedVideoAdUnits))
     {
         CreateCustomDataField("rvCustomDataField", ref this._rvCustomData);
         foreach (string str in this._rewardedVideoAdUnits)
         {
             GUILayout.BeginHorizontal(Array.Empty <GUILayoutOption>());
             GUI.set_enabled(!this._adUnitToLoadedMapping[str]);
             if (GUILayout.Button(CreateRequestButtonLabel(str), Array.Empty <GUILayoutOption>()))
             {
                 Debug.Log("requesting rewarded video with AdUnit: " + str);
                 this.UpdateStatusLabel("Requesting " + str);
                 MoPubAndroid.RequestRewardedVideo(str, null, "rewarded, video, mopub", null, 37.7833, 122.4167, "customer101");
             }
             GUI.set_enabled(this._adUnitToLoadedMapping[str]);
             if (GUILayout.Button("Show", Array.Empty <GUILayoutOption>()))
             {
                 this.ClearStatusLabel();
                 MoPubAndroid.ShowRewardedVideo(str, GetCustomData(this._rvCustomData));
             }
             GUI.set_enabled(true);
             GUILayout.EndHorizontal();
             if ((MoPubAndroid.HasRewardedVideo(str) && this._adUnitToRewardsMapping.ContainsKey(str)) && (this._adUnitToRewardsMapping[str].Count > 1))
             {
                 GUILayout.BeginVertical(Array.Empty <GUILayoutOption>());
                 GUILayout.Space((float)this._sectionMarginSize);
                 GUILayout.Label("Select a reward:", Array.Empty <GUILayoutOption>());
                 foreach (MoPubBase.Reward reward in this._adUnitToRewardsMapping[str])
                 {
                     if (GUILayout.Button(reward.ToString(), Array.Empty <GUILayoutOption>()))
                     {
                         MoPubAndroid.SelectReward(str, reward);
                     }
                 }
                 GUILayout.Space((float)this._sectionMarginSize);
                 GUILayout.EndVertical();
             }
         }
     }
     else
     {
         GUILayout.Label("No rewarded video AdUnits available", this._smallerFont, null);
     }
 }