protected override void InternalLoadRewardedAd(AdPlacement placement) { #if EM_MOPUB string id = placement == AdPlacement.Default ? mAdSettings.DefaultRewardedAdId.Id : FindIdForPlacement(mAdSettings.CustomRewardedAdIds, placement); if (string.IsNullOrEmpty(id)) { Debug.LogFormat("Attempting to load {0} rewarded ad with an undefined ID at placement {1}", Network.ToString(), AdPlacement.GetPrintableName(placement)); return; } if (placement.Equals(AdPlacement.Default)) // Default rewarded ad... { MoPub.RequestRewardedVideo(id); } else // Custom rewarded ad... { if (!mCustomRewardedVideoAds.Contains(placement)) { mCustomRewardedVideoAds.Add(placement); } MoPub.RequestRewardedVideo(id); } #endif }
//关闭激励视频回调 private void OnRewardedVideoClosedEvent(string adUnitId) { LDebug.Log("关闭激励视频回调,id:" + adUnitId); MoPub.RequestRewardedVideo(_rewardedVideoAdUnits[0]); if (RewardCloseEventHandler != null) { RewardCloseEventHandler(false); } }
/// <summary> /// Loads a MoPub rewarded video /// </summary> private void LoadRewardedVideo() { if (debug) { Debug.Log(this + "Start Loading Rewarded Video"); ScreenWriter.Write(this + "Start Loading Rewarded Video"); } MoPub.RequestRewardedVideo(rewardedVideoAdUnit); }
public void loadVideo() { if (rewardLoadState) { return; } Debug.Log("loadVideo"); MoPub.RequestRewardedVideo(strVideoKey); rewardLoadState = true; }
private void CreateRewardedVideosSection() { GUILayout.Space(_sectionMarginSize); GUILayout.Label("Rewarded Videos"); if (!IsAdUnitArrayNullOrEmpty(_rewardedVideoAdUnits)) { CreateCustomDataField("rvCustomDataField", ref _rvCustomData); foreach (var rewardedVideoAdUnit in _rewardedVideoAdUnits) { GUILayout.BeginHorizontal(); GUI.enabled = !_adUnitToLoadedMapping[rewardedVideoAdUnit]; if (GUILayout.Button(CreateRequestButtonLabel(rewardedVideoAdUnit))) { Debug.Log("requesting rewarded video with AdUnit: " + rewardedVideoAdUnit); UpdateStatusLabel("Requesting " + rewardedVideoAdUnit); MoPub.RequestRewardedVideo( adUnitId: rewardedVideoAdUnit, keywords: "rewarded, video, mopub", latitude: 37.7833, longitude: 122.4167, customerId: "customer101"); } GUI.enabled = _adUnitToLoadedMapping[rewardedVideoAdUnit]; if (GUILayout.Button("Show")) { ClearStatusLabel(); MoPub.ShowRewardedVideo(rewardedVideoAdUnit, GetCustomData(_rvCustomData)); } GUI.enabled = true; GUILayout.EndHorizontal(); // Display rewards if there's a rewarded video loaded and there are multiple rewards available if (!MoPub.HasRewardedVideo(rewardedVideoAdUnit) || !_adUnitToRewardsMapping.ContainsKey(rewardedVideoAdUnit) || _adUnitToRewardsMapping[rewardedVideoAdUnit].Count <= 1) continue; GUILayout.BeginVertical(); GUILayout.Space(_sectionMarginSize); GUILayout.Label("Select a reward:"); foreach (var reward in _adUnitToRewardsMapping[rewardedVideoAdUnit]) { if (GUILayout.Button(reward.ToString())) { MoPub.SelectReward(rewardedVideoAdUnit, reward); } } GUILayout.Space(_sectionMarginSize); GUILayout.EndVertical(); } } else { GUILayout.Label("No rewarded video AdUnits available", _smallerFont, null); } }
/// <summary> /// 开始缓冲激励视频 /// </summary> public void FetchRewardVideoAd() { currentRewardedVideoAdUnits = GetRVId(); //if (tempListener != null) //{ // tempListener.FetchRVAd(currentRewardedVideoAdUnits); //} //else //{ // MoPub.RequestRewardedVideo(currentRewardedVideoAdUnits); //} MoPub.RequestRewardedVideo(currentRewardedVideoAdUnits); }
protected override bool DoPreLoadAd() { if (string.IsNullOrEmpty(m_Config.unitID)) { return(false); } MoPub.RequestRewardedVideo(m_Config.unitID); if (!m_IsUnitIdInit) { m_IsUnitIdInit = true; } return(true); }
private void DoPreLoadAD() { //https://developers.mopub.com/publishers/reference/unity/RewardedVideos/ //有可选参数 MoPub.RequestRewardedVideo(m_ADParams.adUnitId); }
public void LoadMoPubRV() { MoPub.RequestRewardedVideo(mopubRvAdUnitID); }
/// <summary> /// Handle MoPub Menu Load Rewarded Video Ad Button Pressed event /// <param name="pAdUnitId">The Ad Unit ID assocated with this ad.</param> /// </summary> public void OnLoadRewardedVideoAd(int pAdUnitIndex) { MoPub.RequestRewardedVideo(_rewardedAdUnits[pAdUnitIndex]); }
public override void CreateRewarded() { #if MOPUB MoPub.RequestRewardedVideo(_rewardedVideoAdUnits[0]); #endif }
//申请视频过期 private void OnRewardedVideoExpiredEvent(string adUnitId) { //重新申请 MoPub.RequestRewardedVideo(_rewardedVideoAdUnits[0]); LDebug.Log("激励视频申请视频过期,id:" + adUnitId); }
public void LoadRewarded() { Debug.Log("Button load"); MoPub.RequestRewardedVideo("b0f2446ffd564322bd5830ec23a4aed1"); }
public void MoPubRequestRewardedAd() { Debug.Log("MoPubSDK Requesting Ad"); MoPub.RequestRewardedVideo(_rewardedAdUnits[0]); }
void OnGUI() { GUI.backgroundColor = Color.green; GUILayoutOption[] option = new GUILayoutOption[] { GUILayout.Height(80) }; Texture2D texture = new Texture2D(128, 128); GUIStyle style = new GUIStyle(GUI.skin.button); style.normal.background = texture; Destroy(texture); style.normal.textColor = Color.yellow; style.fontSize = 48; style.active.textColor = Color.blue; GUILayout.BeginArea(new Rect(0, 0, Screen.width, Screen.height)); GUILayout.BeginVertical(); GUILayout.Space(20); GUIStyle lableStyle = new GUIStyle(); lableStyle.fontSize = 56; lableStyle.alignment = TextAnchor.MiddleCenter; GUILayout.Label("Mopub + Vungle", lableStyle); if (GUILayout.Button("Init", style, option)) { initMediation(); } GUILayout.Space(20); GUILayout.BeginHorizontal(); if (GUILayout.Button("Load Interstitial", style, option)) { MoPub.RequestInterstitialAd(interstitialAdUnitId); } if (GUILayout.Button("Play Interstitial", style, option)) { MoPub.ShowInterstitialAd(interstitialAdUnitId); } GUILayout.EndHorizontal(); GUILayout.Space(20); GUILayout.BeginHorizontal(); if (GUILayout.Button("Load Reward", style, option)) { MoPub.RequestRewardedVideo(rewardAdUnitId); } if (GUILayout.Button("Play Reward", style, option)) { MoPub.ShowRewardedVideo(rewardAdUnitId); } GUILayout.EndHorizontal(); GUILayout.Space(20); GUILayout.BeginHorizontal(); if (GUILayout.Button("Load Banner", style, option)) { loadBanner(); } if (GUILayout.Button("Play Banner", style, option)) { playBanner(); } if (GUILayout.Button("Destroy Banner", style, option)) { MoPub.DestroyBanner(bannerAdUnitId); } GUILayout.EndHorizontal(); GUILayout.Space(20); GUILayout.BeginHorizontal(); if (GUILayout.Button("Load MREC", style, option)) { loadMREC(); } if (GUILayout.Button("Play MREC", style, option)) { playMREC(); } if (GUILayout.Button("Destroy MREC", style, option)) { MoPub.DestroyBanner(mrecAdUnitId); } GUILayout.EndHorizontal(); GUILayout.EndVertical(); GUILayout.EndArea(); }
private void RequestRewardedVideo() { MoPub.RequestRewardedVideo(adUnitId: _rewardedVideoAdUnits[0], keywords: "", latitude: 0.0, longitude: 0.0, customerId: ""); }