/// <summary> /// Show Admob rewarded video /// </summary> /// <param name="CompleteMethod">callback called when user closes the rewarded video -> if true video was not skipped</param> public void ShowRewardVideo(UnityAction <bool> CompleteMethod) { if (IsRewardVideoAvailable()) { OnCompleteMethod = CompleteMethod; triggerCompleteMethod = true; triggerRewardedVideoCallback = true; rewardedVideo.Show(); } }
public void Show(Action <bool> onAdResult) { Debug.Log("[ " + this.rewardedAdId + " ] Called Show()"); this.onAdResult = onAdResult; if (rewardedAd.IsLoaded()) { rewardedAd.Show(); } else { LoadAd(() => rewardedAd.Show()); } }
// Start is called before the first frame update void Start() { MobileAds.Initialize(initStatus => { }); //this.RequestBanner(); //this.RequestInterstitialAd(); this.RequestRewardedAd(); rewardedAd.OnAdLoaded += handleOnAdLoaded; rewardedAd.OnAdClosed += handleOnAdClosed; rewardedAd.OnAdFailedToLoad += handleOnAdFailedToLoad; rewardedAd.OnAdFailedToShow += handleOnAdFailedToShow; rewardedAd.OnAdOpening += handleOnAdOpening; rewardedAd.OnUserEarnedReward += handleOnUserEarnedReward; if (rewardedAd.IsLoaded()) { rewardedAd.Show(); } else { Debug.Log("Rewarded ad not loaded"); } }
public void ShowRewardedAd() { ScoreManager.instance.Loading(true); StartCoroutine(CheckInternetConnection((isConnected) => { if (isConnected && rewardedAd != null && rewardedAd.IsLoaded()) { Debug.Log("Showing Ad"); ScoreManager.instance.Loading(false); rewardedAd.Show(); rewardedAd = null; SetupRewardedAds(); } else { ScoreManager.instance.Loading(false); if (MainGameManager.instance != null) { MainGameManager.instance.UnableToLoadVideo(); } rewardedAd = null; SetupRewardedAds(); } })); }
public void PlayAD() { //广告已经准备就绪,直接播放 //如果因为延迟没有准备就绪,重新加载 if (rewardedAd != null) { if (rewardedAd.IsLoaded()) { rewardedAd.Show(); autoplay = false; } } else { if (autoplay == false) { CreateAndLoadAD(); autoplay = true; Debug.Log("广告对象没有生成"); } else { Debug.Log("广告加载多次失败"); } } }
private void HandleRewardedAdLoaded(object sender, EventArgs args) { if (_rewardedAd.IsLoaded()) { _rewardedAd.Show(); } }
public void ShowTimeUpRewardAds(string adsId) { if (_timeUpRewardAd.IsLoaded()) { _timeUpRewardAd.Show(); } }
public void ShowDieRewardAds(string adsId) { if (_dieRewardAd.IsLoaded()) { _dieRewardAd.Show(); } }
public void ShowRewardedVideo() { if (!CrossAdMob.Current.IsEnabled) { return; } var adUnit = AdUnitId_RewardedVideo; if (IsInTestMode || String.IsNullOrWhiteSpace(adUnit)) { adUnit = GoogleSamplesAdUnitIds.AndroidSampleAdUnitId_RewardedVideo; } if (_rewardedVideoAds != null && _rewardedVideoAds.IsLoaded) { var rewardedCallback = new AdMobRewardedCallback(adUnit); rewardedCallback.AdOpened += RewardedCallback_AdOpened; rewardedCallback.AdClosed += RewardedCallback_AdClosed; rewardedCallback.AdFailedToShow += RewardedCallback_AdFailedToShow; rewardedCallback.UserEarnedReward += RewardedCallback_UserEarnedReward; _rewardedVideoAds.Show(Xamarin.Essentials.Platform.CurrentActivity, rewardedCallback); } else { Console.WriteLine("Rewarded Video not loaded"); } }
private void Update() { if (interactableButtons == false) { buttonResurrect.interactable = false; buttonResurrectClose.interactable = false; } if (Input.GetKeyDown(KeyCode.Escape) && openAds.activeSelf == true) { rewardedAd.OnAdLoaded -= HandleRewardedAdLoaded; DontWaitAds(); } else if (Input.GetKeyDown(KeyCode.Escape) && openAds.activeSelf == false) { ButtonResurrectClose(); } if (showReward) { if (rewardedAd.IsLoaded()) { rewardedAd.Show(); rewardedAd = new RewardedAd(inGameRewarded); rewardedAd.OnAdClosed += HandleRewardedAdClosed; rewardedAd.OnUserEarnedReward += HandleUserEarnedReward; rewardedAd.OnAdLoaded += HandleRewardedAdLoaded; request = null; request = new AdRequest.Builder().Build(); rewardedAd.LoadAd(request); showReward = false; } } }
private void Update() { if (game.ads) { if (Input.GetKeyDown(KeyCode.Escape)) { rewardedAd.OnAdLoaded -= HandleRewardedAdLoaded; DontWaitAds(); } if (showReward) { if (rewardedAd.IsLoaded()) { rewardedAd.Show(); rewardedAd = new RewardedAd(inGameRewarded); rewardedAd.OnAdClosed += HandleRewardedAdClosed; rewardedAd.OnUserEarnedReward += HandleUserEarnedReward; rewardedAd.OnAdLoaded += HandleRewardedAdLoaded; request = null; request = new AdRequest.Builder().Build(); rewardedAd.LoadAd(request); showReward = false; } } } }
IEnumerator WaitForRecovery() { yield return(new WaitUntil(() => AdReady != null)); if (AdReady == true) { rewardedAd.Show(); yield return(new WaitUntil(() => RecoveryEarned != null)); if (RecoveryEarned == true) { DrivingPlayManager.Current.PlayerCarManager.Recover(); } else { Main.Instance.PopupMsg("You must watch the whole advert"); } } else { Main.Instance.PopupMsg("Sorry no Advert available"); } LoadAd(); //Load the next ad yield return(0); }
public void ShowRewardAd() { if (AdReward.IsLoaded()) { AdReward.Show(); } }
//attach to a button that plays ad if ready public void ShowRewardedAd() { if (rewardedAd.IsLoaded()) { rewardedAd.Show(); } }
public void DisplayRewardVideo() { if (rewardAd.IsLoaded()) { rewardAd.Show(); } }
private void DisplayAd() { switch (activeAdType) { case AdsConfiguration.AdType.Banner: bannerView[bannerView.Count - 1].view.Show(); break; case AdsConfiguration.AdType.Fullscreen: if (this.interstitialAd.IsLoaded()) { this.interstitialAd.Show(); } else { Debug.LogWarning("Fullscreen ad is not loaded"); } break; case AdsConfiguration.AdType.Rewarded: rewardedAd.Show(); break; case AdsConfiguration.AdType.Native: Debug.Log("Native ad has not been implemented yet"); break; } }
private void ShowInterstitial() { //Debug.Log("current interstitial = " + currentInterstitial); switch (currentInterstitial) { case InterstitialType.Default: if (interstitialReg.IsLoaded()) { interstitialReg.Show(); } break; case InterstitialType.Video: if (interstitialVideo.IsLoaded()) { interstitialVideo.Show(); } break; case InterstitialType.Reward: if (interstitialReward.IsLoaded()) { interstitialReward.Show(); } break; } }
/// <summary> /// Method of show ad as revenue video /// </summary> public void ShowRevenueVideo() { if (rewardedVideoAd != null) { rewardedVideoAd.Show(); } }
public void TryPlayRewardedAd() { if (CheckInternetConnection()) { return; } string adId; var isDebugBuild = Debug.isDebugBuild; if (isDebugBuild) { adId = Constants.AdMob.TestAd; } else { adId = Constants.AdMob.Reward; } RewardedAd rewardedAd = new RewardedAd(adId); var adRequest = new AdRequest.Builder().Build(); rewardedAd.LoadAd(adRequest); rewardedAd.Show(); rewardedAd.OnAdClosed += OnAdClosed; }
public static void DisplayRewardAD() { if (reward.IsLoaded() && PlayerPrefs.GetInt("Ads", 0) == 0) { reward.Show(); } }
public void ShowContinueAd() { if (IsContinueAdLoaded()) { continueAd.Show(); } }
public void Show() { if (_rewardedAd.IsLoaded()) { _rewardedAd.Show(); } }
public void ShowRewardedAd(RewardedAdType type) { switch (type) { case RewardedAdType.EXTRA_ATTEMPT: if (extraAttempt == null) { break; } if (extraAttempt.IsLoaded()) { extraAttempt.Show(); } break; case RewardedAdType.TIMED_REWARD: if (timedReward == null) { break; } if (timedReward.IsLoaded()) { timedReward.Show(); } break; } }
// Показываем рекламу public void ShowRewardedAd() { // Вознаграждение if (rewardedAd.IsLoaded()) { rewardedAd.Show(); } }
public void ShowAd(string forWhat) { AdsForWhat = forWhat; loadingAd.SetActive(true); if (rewardedAd.IsLoaded()) { rewardedAd.Show(); loadingAd.SetActive(false); } else { Retry(); } }
public void Display_Reward() { if (rewardedAd.IsLoaded()) { rewardedAd.Show(); Debug.Log("已展示激励广告"); } }
public void ShowAd() { if (rewardedAd.IsLoaded()) { rewardedAd.Show(); adNotReady.SetActive(true); } }
private IEnumerator ShowRewardAd() { while (!rewardAd.IsLoaded()) { yield return(null); } rewardAd.Show(); }
public IEnumerator ShowRewardedAd() { if (videoAd.IsLoaded()) { videoAd.Show(); } yield return(null); }
/// <summary> /// ロックボタン押下 /// </summary> public void OnClick_RewardButton(RewardButton rewardButton) { _rewardAction = _rewardActionDic[rewardButton]; // 広告を表示して受取る報酬についての説明処理 if (_rewardAnnounce) { if (_rewardedAd.IsLoaded()) { _rewardedAd.Show(); } } else { rewardMessagebox.SetActive(true); } }