IEnumerator Start() { string zoneName = string.IsNullOrEmpty(zoneID) ? "the default ad placement zone" : zoneID; _startTime = Time.timeSinceLevelLoad; while (!UnityAdsHelper.isInitialized) { if (Time.timeSinceLevelLoad - _startTime > timeout) { Debug.LogWarning("Unity Ads failed to initialize in a timely manner. Ad will not be shown on load."); yield break; } yield return(new WaitForSeconds(_yieldTime)); } _startTime = Time.timeSinceLevelLoad; while (!UnityAdsHelper.isReady(zoneID)) { if (Time.timeSinceLevelLoad - _startTime > timeout) { Debug.LogWarning(string.Format("The process of showing ads on load for {0} has timed out. Ad was not shown.", zoneName)); yield break; } yield return(new WaitForSeconds(_yieldTime)); } Debug.Log(string.Format("Ads for {0} are available and ready. Showing ad now...", zoneName)); UnityAdsHelper.ShowAd(zoneID, !disablePause); }
public void OnClickAdsBtn() { if (!UnityAdsHelper.isSupported) { return; } if (!UnityAdsHelper.isInitialized) { return; } if (UnityAdsHelper.isShowing) { return; } UnityAdsHelper.ShowAd(null, () => { GameCore.Instance.MeInfo.Integration += 1; UserManager.SyncIntegration2Server(); AddTip("积分+1"); MMUI.ShowUserInfo(); }); AdsBtn.gameObject.SetActive(false); }
public void BtnOnContinue() { isContinueAvailable = false; myGameOverAnimator.SetBool("GameOver", false); soundManager.GetComponent <SoundManager>().StopBGM(); StartCoroutine(soundManager.GetComponent <SoundManager>().Continue()); optionBtn.GetComponent <Button>().interactable = true; skullFX.SetActive(false); //광고시스템 추가 Time.timeScale = 0; unityAdsHelper.ShowAd(); leftEnemyArm.Idle(); rightEnemyArm.Idle(); StartCoroutine(GameContinue()); //주변 블럭 날리기 player.GetComponent <PlayerController>().ContinueShockwave(); if (player.GetComponent <Animator>() == null) { player.GetComponentInChildren <Animator>().Play("Idle"); } else { player.GetComponent <Animator>().Play("Idle"); } player.GetComponent <PlayerController>().Restart(); }
public static void Down() { if (UnityAdsHelper.isReady()) { UnityAdsHelper.ShowAd(); } }
public void ShowAd() { if (onFinished != null) { UnityAdsHelper.onFinished = delegate { if (cooldownTime > 0) { SetCooldownTime(DateTime.UtcNow.AddSeconds(cooldownTime)); Debug.Log(string.Format("Cooldown timer set. " + "Next ad available in {0} seconds.", cooldownTime)); } onFinished.Invoke(); } } ; if (onSkipped != null) { UnityAdsHelper.onSkipped = delegate { onSkipped.Invoke(); } } ; if (onFailed != null) { UnityAdsHelper.onFailed = delegate { onFailed.Invoke(); } } ; UnityAdsHelper.ShowAd(placementId, rewarded); }
public void OnMouseDown() { if (UnityAdsHelper.isReady()) { UnityAdsHelper.ShowAd(); } Time.timeScale = 1f; LedEffect.t = 2f; Application.LoadLevel("Menu"); }
void OnMouseUpAsButton() { if (UnityAdsHelper.isReady(zoneID)) { UnityAdsHelper.ShowAd(zoneID, !disablePause); } else { Debug.LogWarning("Unable to show ad. Zone is not yet ready."); } }
// A return type of IEnumerator allows for the use of yield statements. // For more info, see: http://docs.unity3d.com/ScriptReference/YieldInstruction.html IEnumerator Start() { // Zone name used in debug messages. string zoneName = string.IsNullOrEmpty(zoneID) ? "the default ad placement zone" : zoneID; // Set a start time for the timeout. _startTime = Time.timeSinceLevelLoad; // Check to see if Unity Ads is initialized. // If not, wait a second before trying again. while (!UnityAdsHelper.isInitialized) { if (useTimeout && Time.timeSinceLevelLoad - _startTime > timeoutDuration) { Debug.LogWarning(string.Format("Unity Ads failed to initialize in a timely manner. " + "An ad for {0} will not be shown on load.", zoneName)); // Break out of both this loop and the Start method; Unity Ads will not // be shown on load since the wait time exceeded the time limit. yield break; } yield return(new WaitForSeconds(yieldTime)); } Debug.Log("Unity Ads has finished initializing. Waiting for ads to be ready..."); // Set a start time for the timeout. _startTime = Time.timeSinceLevelLoad; // Check to see if ads are available and ready to be shown. // If ads are not available, wait before trying again. while (!UnityAdsHelper.IsReady(zoneID)) { if (useTimeout && Time.timeSinceLevelLoad - _startTime > timeoutDuration) { Debug.LogWarning(string.Format("Unity Ads failed to be ready in a timely manner. " + "An ad for {0} will not be shown on load.", zoneName)); // Break out of both this loop and the Start method; Unity Ads will not // be shown on load since the wait time exceeded the time limit. yield break; } yield return(new WaitForSeconds(yieldTime)); } Debug.Log(string.Format("Ads for {0} are available and ready. Showing ad now...", zoneName)); // Now that ads are ready, show an ad campaign. UnityAdsHelper.ShowAd(zoneID); }
public void Continue() { string zoneID = null; if (showInterstitialAds && UnityAdsHelper.IsReady(zoneID)) { UnityAdsHelper.ShowAd(zoneID, null, null, null, DoContinue); } else { DoContinue(); } }
// A return type of IEnumerator allows for the use of yield statements. // For more info, see: http://docs.unity3d.com/ScriptReference/YieldInstruction.html IEnumerator Start() { // Zone name used in debug messages. string zoneName = string.IsNullOrEmpty(zoneID) ? "the default ad placement zone" : zoneID; // Set a start time for the timeout. _startTime = Time.timeSinceLevelLoad; // Check to see if Unity Ads is initialized. // If not, wait a second before trying again. while (!UnityAdsHelper.isInitialized) { if (Time.timeSinceLevelLoad - _startTime > timeout) { Debug.LogWarning("Unity Ads failed to initialize in a timely manner. Ad will not be shown on load."); // Break out of both this loop and the Start method; Unity Ads will not // be shown on load since the wait time exceeded the time limit. yield break; } yield return(new WaitForSeconds(_yieldTime)); } Debug.Log("Unity Ads has finished initializing. Waiting for ads to be ready..."); // Set a start time for the timeout. _startTime = Time.timeSinceLevelLoad; // Check to see if Unity Ads are available and ready to be shown. // If not, wait a second before trying again. while (!UnityAdsHelper.isReady(zoneID)) { if (Time.timeSinceLevelLoad - _startTime > timeout) { Debug.LogWarning(string.Format("The process of showing ads on load for {0} has timed out. Ad was not shown.", zoneName)); // Break out of both this loop and the Start method; Unity Ads will not // be shown on load since the wait time exceeded the time limit. yield break; } yield return(new WaitForSeconds(_yieldTime)); } Debug.Log(string.Format("Ads for {0} are available and ready. Showing ad now...", zoneName)); // Show ad after Unity Ads finishes initializing and ads are ready to show. UnityAdsHelper.ShowAd(zoneID, !disablePause); }
private void ShowAd() { if (!UnityAdsHelper.isSupported) { return; } if (!UnityAdsHelper.isInitialized) { return; } if (UnityAdsHelper.isShowing) { return; } UnityAdsHelper.ShowAd(null, ShowAdFinish); }
IEnumerator Start() { if (!UnityAdsHelper.isSupported) { yield break; } else if (!UnityAdsHelper.isInitialized) { UnityAdsHelper.Initialize(); } string placementName = string.IsNullOrEmpty(placementId) ? "the default ad placement" : placementId; _startTime = Time.timeSinceLevelLoad; while (!UnityAdsHelper.isInitialized) { if (initTimeout > 0 && Time.timeSinceLevelLoad - _startTime > initTimeout) { Debug.LogWarning(string.Format("Unity Ads failed to initialize in a timely manner. " + "An ad for {0} will not be shown on load.", placementName)); yield break; } yield return(new WaitForSeconds(_yieldTime)); } Debug.Log("Unity Ads has finished initializing. Waiting for ads to be ready..."); _startTime = Time.timeSinceLevelLoad; while (!UnityAdsHelper.IsReady(placementId)) { if (showTimeout > 0 && Time.timeSinceLevelLoad - _startTime > showTimeout) { Debug.LogWarning(string.Format("Unity Ads failed to be ready in a timely manner. " + "An ad for {0} will not be shown on load.", placementName)); yield break; } yield return(new WaitForSeconds(_yieldTime)); } Debug.Log(string.Format("Ads for {0} are available and ready.", placementName)); UnityAdsHelper.ShowAd(placementId); }
public void Continue() { #if UNITY_IOS || UNITY_ANDROID string zoneID = null; if (showInterstitialAds && UnityAdsHelper.IsReady(zoneID)) { UnityAdsHelper.ShowAd(zoneID, DoContinue); } else { DoContinue(); } #else DoContinue(); #endif }
public void ShowAutoAd() { if (!UnityAdsHelper.isSupported) { return; } if (!UnityAdsHelper.isInitialized) { return; } if (UnityAdsHelper.isShowing) { return; } UnityAdsHelper.ShowAd(null, null); }
void OnGUI() { bool isReady = UnityAdsHelper.isReady(zoneID); bool pause = !disablePause; GUI.enabled = isReady; if (GUI.Button(new Rect(10, 10, 150, 50), isReady ? "Show Ad" : "Waiting...")) { Debug.Log(string.Format("Ad Placement zone with ID of {0} is {1}.", string.IsNullOrEmpty(zoneID) ? "null" : zoneID, isReady ? "ready" : "not ready")); if (isReady) { UnityAdsHelper.ShowAd(zoneID, pause); } } GUI.enabled = true; }
public void ShowAd() { UnityAdsHelper.ShowAd(zoneID, RewardUser); GoogleAnalyticsV3.getInstance().LogEvent("Count", "WatchAD", "", 0); }
public void ShowAd() { UnityAdsHelper.ShowAd(zoneID, null, RewardUserAndUpdateCooldownTime); }
public void ShowAd() { UnityAdsHelper.onFinished = OnFinished; UnityAdsHelper.ShowAd(zoneId); }