private static IEnumerator ShowAd(AdType type) { while (!Monetization.isInitialized) { yield return(new WaitForSeconds(.2f)); } while (!Monetization.IsReady(type.ToString())) { yield return(new WaitForSeconds(.2f)); } var ad = Monetization.GetPlacementContent(type.ToString()); if (ad == null) { Debug.LogError("Ad retrieved was null."); yield break; } while (!ad.ready) { yield return(new WaitForSeconds(.2f)); } yield return((ad as ShowAdPlacementContent).Show()); Debug.LogError("Passed show ad"); yield return(null); }
public void ShowAd() { ShowAdPlacementContent ad; ad = Monetization.GetPlacementContent(__placement_id) as ShowAdPlacementContent; ad.Show(); }
public void ShowAd() { if (PlayerPrefs.HasKey("AdCount")) { if (PlayerPrefs.GetInt("AdCount") == 2) { if (Monetization.IsReady(video_ad)) { ShowAdPlacementContent ad = null; ad = Monetization.GetPlacementContent(video_ad) as ShowAdPlacementContent; if (ad != null) { ad.Show(); } } PlayerPrefs.SetInt("AdCount", 0); } else { PlayerPrefs.SetInt("AdCount", PlayerPrefs.GetInt("AdCount") + 1); } } else { PlayerPrefs.SetInt("AdCount", 0); } }
private async void WaitForAds() { SetBtGetMoreInteractable(false); while (true) { //if (this.rewardedAd.IsLoaded() || Monetization.IsReady(placementId)) break; if (Monetization.IsReady(placementId)) { break; } await Task.Delay(100); } //if (this.rewardedAd.IsLoaded()) //{ // SetBtGetMoreInteractable(true); //} if (Monetization.IsReady(placementId)) { ad = Monetization.GetPlacementContent(placementId) as ShowAdPlacementContent; if (ad != null) { SetBtGetMoreInteractable(true); } } }
IEnumerator WaitForAd(bool rewarded = false) { string selectPlacementID = rewarded? placementId_Rewarded: placementId_No; while (!Monetization.IsReady(selectPlacementID)) { yield return(null); } ShowAdPlacementContent ad = null; ad = Monetization.GetPlacementContent(selectPlacementID) as ShowAdPlacementContent; if (ad != null) { if (rewarded) { ad.Show(AdFinished); } else { ad.Show(AdFinished_No); } } }
public void ShowAd() { //Get Content for a placement PlacementContent placementContent = Monetization.GetPlacementContent(placementName); //Convert to ShowAdPlacementContent to show the ad //This works for most ad types (Video, Playable, Display, Promo, AR, etc.) //IAP Promo does require additional configuration. (See: PromoExample) ShowAdPlacementContent showAd = (ShowAdPlacementContent)placementContent; //We can check if this is a rewarded placement from the placement content if (showAd.rewarded == true) { ShowAdCallbacks callbacks = new ShowAdCallbacks { finishCallback = HandleReward }; Debug.Log("Showing Rewarded Ad - Placement: " + placementContent.placementId); showAd.Show(callbacks); } else { Debug.Log("Showing Non-rewarded Ad - Placement: " + placementContent.placementId); showAd.Show(); } }
private IEnumerator ShowAdBuffered() { hasAdStarted = false; float timer = 0; LoadingGUI.SetActive(true); while (!hasAdStarted && timer < 10) { timer += Time.deltaTime; if (Monetization.IsReady(reward_ad)) { ad = null; ad = Monetization.GetPlacementContent(reward_ad) as ShowAdPlacementContent; if (ad != null) { rewardedForCurrentAd = false; ad.Show(); isAdShowing = true; Debug.Log(ad.placementId); hasAdStarted = true; } } yield return(null); } LoadingGUI.SetActive(false); }
// Update is called once per frame void Update() { if (Input.GetButton("Fire1")) { if (Monetization.IsReady("video")) { ShowAdPlacementContent ad = null; ad = Monetization.GetPlacementContent("video") as ShowAdPlacementContent; if (ad != null) { ad.Show(); } } } if (Input.GetKeyDown(KeyCode.S)) { if (Monetization.IsReady("rewardedVideo")) { ShowAdPlacementContent ad = null; ad = Monetization.GetPlacementContent("rewardedVideo") as ShowAdPlacementContent; if (ad != null) { ad.Show(); } } } }
public IEnumerator WaitAndDisplayRewardedAd() { yield return(new WaitUntil(() => Monetization.IsReady(placementID_Rewarded))); ShowAdPlacementContent adContent = Monetization.GetPlacementContent(placementID_Rewarded) as ShowAdPlacementContent; adContent.gamerSid = "[CALLBACK SERVER ID HERE]"; ShowAdCallbacks callbackOptions = new ShowAdCallbacks(); callbackOptions.finishCallback += RewardCallback; if (adContent != null) { adContent.Show(callbackOptions); } else { Debug.LogWarning("Placement content returned null."); } customEventParams.Add("ar_content", false); AnalyticsResult eventResult = AnalyticsEvent.adStart(true, null, placementID_Rewarded, customEventParams); Debug.LogFormat("Event result", eventResult); }
IEnumerator WaitForAd(bool reward = false) { string placementId = reward? placementId_rewardedVideo : placementId_video; while (!Monetization.IsReady(placementId)) { yield return(null); } ShowAdPlacementContent ad = null; ad = Monetization.GetPlacementContent(placementId) as ShowAdPlacementContent; if (ad != null) { if (reward) { ad.Show(AdFinished); } else { ad.Show(); } } }
public void ShowAd() { ShowAdCallbacks options = new ShowAdCallbacks(); options.finishCallback = HandleShowResult; ShowAdPlacementContent ad = Monetization.GetPlacementContent("rewardedVideo") as ShowAdPlacementContent; ad.Show(options); }
public void showInterstitialAd() { try { currentAdDisplayTime = Time.time; float num = currentAdDisplayTime - Global.lastAdDisplayTime; if (interstitial != null && interstitial.IsLoaded()) { interstitial.Show(); Global.lastAdDisplayTime = currentAdDisplayTime; } else if (isLoaded) { interstitialAd.Show(); Global.lastAdDisplayTime = currentAdDisplayTime; } else if (num > Global.backFillAdGap && Monetization.IsReady(video_ad)) { ShowAdPlacementContent showAdPlacementContent = null; (Monetization.GetPlacementContent(video_ad) as ShowAdPlacementContent)?.Show(HandleShowResult); } else if (num > Global.backFillAdGap && IronSource.Agent.isInterstitialReady()) { ShowIronAd(); Global.lastAdDisplayTime = currentAdDisplayTime; } else if (num > Global.backFillAdGap && interstitial2 != null && interstitial2.IsLoaded()) { interstitial2.Show(); Global.lastAdDisplayTime = currentAdDisplayTime; } else if (Monetization.IsReady(rewarded_Video) || rewardLoaded) { Global.isRewardVidAvail = true; gm.retry.SetActive(value: true); gm.menu.SetActive(value: true); if (gm.gameFailed.activeSelf) { gm.failMenu.SetActive(value: true); gm.failRetry.SetActive(value: true); } } else { gm.retry.SetActive(value: true); gm.menu.SetActive(value: true); if (gm.gameFailed.activeSelf) { gm.failMenu.SetActive(value: true); gm.failRetry.SetActive(value: true); } } } catch (Exception) { } }
void ShowAd() { ShowAdCallbacks options = new ShowAdCallbacks(); options.finishCallback = HandleShowResult; ShowAdPlacementContent ad = Monetization.GetPlacementContent(placementId) as ShowAdPlacementContent; ad.Show(options); }
public void ShowPromo() { if (Monetization.IsReady(placementName) == false) { Debug.Log("Placement Not Ready: " + placementName); return; } //Get Content for a placement PlacementContent placementContent = Monetization.GetPlacementContent(placementName); if (placementContent == null) { Debug.LogError("Placement Content Empty for Placement ID: " + placementContent.placementId); return; } //Convert to ShowAdPlacementContent to show the ad //This works for most ad types (Video, Playable, Display, Promo, AR, etc.) //IAP Promo requires that the Purcahsing Adapter is set, otherwise placement will never be Ready ShowAdPlacementContent showAd = (ShowAdPlacementContent)placementContent; if (showAd == null) { Debug.LogError("Show Ad Placement Content Empty for Placement ID: " + showAd.placementId); return; } //Since this is a Personalized Placement, it can be an Ad or an IAP Promo. And we can check which if needed. if (showAd.GetType() == typeof(ShowAdPlacementContent)) { Debug.Log("Showing Ad - Placement: " + showAd.placementId); } if (showAd.GetType() == typeof(PromoAdPlacementContent)) { Debug.Log("Showing Promo - Placement: " + showAd.placementId); } //We can check if this is a rewarded placement from the placement content if (showAd.rewarded == true) { ShowAdCallbacks callbacks = new ShowAdCallbacks { finishCallback = HandleReward }; Debug.Log("Showing Rewarded Ad - Placement: " + placementContent.placementId); showAd.Show(callbacks); } else { Debug.Log("Showing Non-rewarded Ad - Placement: " + placementContent.placementId); showAd.Show(); } }
// Start is called before the first frame update public void OnTriggerEnter2D(Collider2D collision) { if (collision.tag == "Player") { if (Monetization.isInitialized) { PlayerPrefs.SetInt("Die", PlayerPrefs.GetInt("Die") + 1); } if (mod == 1) { SceneManager.LoadScene("Balance"); Time.timeScale = 1; if (time1.sec > 40) { if (Monetization.IsReady("video")) { ShowAdPlacementContent ad = Monetization.GetPlacementContent("video") as ShowAdPlacementContent; if (ad != null) { ad.Show(); } } } } if (mod == 2) { SceneManager.LoadScene("BalanceMod"); Time.timeScale = 1; if (wood.BalanceValueNow > 20) { if (Monetization.IsReady("video")) { ShowAdPlacementContent ad = Monetization.GetPlacementContent("video") as ShowAdPlacementContent; if (ad != null) { ad.Show(); } } } } if (PlayerPrefs.GetInt("Die") >= 10) { if (Monetization.IsReady("video")) { ShowAdCallbacks options = new ShowAdCallbacks(); options.finishCallback = HandleShowResult; ShowAdPlacementContent ad = Monetization.GetPlacementContent("video") as ShowAdPlacementContent; ad.Show(options); } } } else { Destroy(collision.gameObject); } }
public void ShowEnterActionPhaseFromMainMenuAd() { ShowAdCallbacks options = new ShowAdCallbacks(); options.finishCallback = HandleLoadGame; ShowAdPlacementContent ad = Monetization.GetPlacementContent(enterActionPhaseFromMainMenuAd) as ShowAdPlacementContent; ad.Show(options); }
public void ShowEnterActionPhaseAfterRestartAd() { ShowAdCallbacks options = new ShowAdCallbacks(); options.finishCallback = HandleLoadMenu; ShowAdPlacementContent ad = Monetization.GetPlacementContent(enterActionPhaseAfterRestartAd) as ShowAdPlacementContent; ad.Show(options); }
public override void ShowAd(string placement) { ShowAdCallbacks options = new ShowAdCallbacks { finishCallback = HandleShowResult }; ShowAdPlacementContent ad = Monetization.GetPlacementContent(placement) as ShowAdPlacementContent; ad.Show(options); }
void ShowAd() { ShowAdCallbacks options = new ShowAdCallbacks(); options.finishCallback = HandleShowResult; ShowAdPlacementContent ad = Monetization.GetPlacementContent(placementId) as ShowAdPlacementContent; secLife.GetComponent <Animator>().enabled = false; ad.Show(options); }
/* public void rewardedvideoclick(){ * if (Monetization.IsReady(rewarded_ad)){ * ShowAdPlacementContent ad = null; * ad= Monetization.GetPlacementContent(rewarded_ad) as ShowAdPlacementContent; * * if(ad != null){ * ad.Show(); * } * } * } * * void Update(){ * * if(Input.GetKeyDown(KeyCode.R)) * { * if (Monetization.IsReady(rewarded_ad)) * { * ShowAdPlacementContent ad = null; * ad= Monetization.GetPlacementContent(rewarded_ad) as ShowAdPlacementContent; * * if(ad != null) * ad.Show(); * } * } * }*/ public void ShowAdrewarded() { if (networkon == true) { ShowAdCallbacks options = new ShowAdCallbacks(); options.finishCallback = HandleShowResult; ShowAdPlacementContent ad = Monetization.GetPlacementContent(rewarded_ad) as ShowAdPlacementContent; ad.Show(options); } }
public bool IsReady(string placement) { PlacementContent placementContent = Monetization.GetPlacementContent(placement); if (placementContent == null) { return(false); } return(placementContent.ready); }
public void ShowAd() { // Loading.SetActive(true); ShowAdCallbacks options = new ShowAdCallbacks(); options.finishCallback = HandleShowResult; ShowAdPlacementContent ad = Monetization.GetPlacementContent(placementId) as ShowAdPlacementContent; ad.Show(options); }
private void ShowAd() { SoundManager.Instance.MenuTouch(); ShowAdCallbacks options = new ShowAdCallbacks(); options.finishCallback = HandleShowResult; ShowAdPlacementContent ad = Monetization.GetPlacementContent(placementId) as ShowAdPlacementContent; ad.Show(options); }
public void PlayVideo() { if (Monetization.IsReady(video_ad)) { ShowAdPlacementContent ad = Monetization.GetPlacementContent(video_ad) as ShowAdPlacementContent; if (ad != null) { ad.Show(); } } }
public void ShowMoreBallsReviveAd() { ShowAdCallbacks options = new ShowAdCallbacks(); options.finishCallback = HandleMoreBalls; ShowAdPlacementContent ad = Monetization.GetPlacementContent(moreBallsAd) as ShowAdPlacementContent; ad.Show(options); AnalyticsController.Instance.LogIncentivizedAdWatchedEvent("More Balls AD"); }
private void ShowAd() { // 广告回调函数 ShowAdCallbacks options = new ShowAdCallbacks(); options.finishCallback = HandleResult; // 广告对象 ShowAdPlacementContent ad = Monetization.GetPlacementContent(placementId) as ShowAdPlacementContent; ad.Show(options); }
//rewardedVideo public void ShowAds() { if (Monetization.IsReady("rewardedVideo")) { Time.timeScale = 0; ShowAdCallbacks options = new ShowAdCallbacks(); options.finishCallback = HandleShowResult; ShowAdPlacementContent ad = Monetization.GetPlacementContent("rewardedVideo") as ShowAdPlacementContent; ad.Show(options); } }
public void ShowAd() { if (!Monetization.IsReady(placementId)) { return; } ShowAdPlacementContent pc = (ShowAdPlacementContent)Monetization.GetPlacementContent(placementId); pc.Show(_showAdCallbacks); }
public void PlayRewardedVideo() { if (Monetization.IsReady(rewardedVideo_Ad)) { ShowAdPlacementContent ad = Monetization.GetPlacementContent(rewardedVideo_Ad) as ShowAdPlacementContent; if (ad != null) { ad.Show(); } } }
/* void Update(){ * * if(Input.GetKeyDown(KeyCode.V)) * { * if (Monetization.IsReady(interstitial_ad)) * { * ShowAdPlacementContent ad = null; * ad= Monetization.GetPlacementContent(interstitial_ad) as ShowAdPlacementContent; * * if(ad != null) * ad.Show(); * } * } * }*/ public void showuinterstitialad() { ShowAdPlacementContent ad = null; ad = Monetization.GetPlacementContent(interstitial_ad) as ShowAdPlacementContent; if (ad != null) { ad.Show(); } }