Ejemplo n.º 1
0
    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);
    }
Ejemplo n.º 2
0
    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);
    }
Ejemplo n.º 3
0
    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();
    }
Ejemplo n.º 4
0
 public static void Down()
 {
     if (UnityAdsHelper.isReady())
     {
         UnityAdsHelper.ShowAd();
     }
 }
Ejemplo n.º 5
0
    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);
    }
Ejemplo n.º 6
0
 public void OnMouseDown()
 {
     if (UnityAdsHelper.isReady())
     {
         UnityAdsHelper.ShowAd();
     }
     Time.timeScale = 1f;
     LedEffect.t    = 2f;
     Application.LoadLevel("Menu");
 }
Ejemplo n.º 7
0
 void OnMouseUpAsButton()
 {
     if (UnityAdsHelper.isReady(zoneID))
     {
         UnityAdsHelper.ShowAd(zoneID, !disablePause);
     }
     else
     {
         Debug.LogWarning("Unable to show ad. Zone is not yet ready.");
     }
 }
Ejemplo n.º 8
0
    // 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);
    }
Ejemplo n.º 9
0
    public void Continue()
    {
        string zoneID = null;

        if (showInterstitialAds && UnityAdsHelper.IsReady(zoneID))
        {
            UnityAdsHelper.ShowAd(zoneID, null, null, null, DoContinue);
        }
        else
        {
            DoContinue();
        }
    }
Ejemplo n.º 10
0
    // 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);
    }
Ejemplo n.º 11
0
 private void ShowAd()
 {
     if (!UnityAdsHelper.isSupported)
     {
         return;
     }
     if (!UnityAdsHelper.isInitialized)
     {
         return;
     }
     if (UnityAdsHelper.isShowing)
     {
         return;
     }
     UnityAdsHelper.ShowAd(null, ShowAdFinish);
 }
Ejemplo n.º 12
0
    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);
    }
Ejemplo n.º 13
0
    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
    }
Ejemplo n.º 14
0
    public void ShowAutoAd()
    {
        if (!UnityAdsHelper.isSupported)
        {
            return;
        }
        if (!UnityAdsHelper.isInitialized)
        {
            return;
        }
        if (UnityAdsHelper.isShowing)
        {
            return;
        }

        UnityAdsHelper.ShowAd(null, null);
    }
Ejemplo n.º 15
0
    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;
    }
Ejemplo n.º 16
0
 public void ShowAd()
 {
     UnityAdsHelper.ShowAd(zoneID, RewardUser);
     GoogleAnalyticsV3.getInstance().LogEvent("Count", "WatchAD", "", 0);
 }
Ejemplo n.º 17
0
 public void ShowAd()
 {
     UnityAdsHelper.ShowAd(zoneID, null, RewardUserAndUpdateCooldownTime);
 }
 public void ShowAd()
 {
     UnityAdsHelper.onFinished = OnFinished;
     UnityAdsHelper.ShowAd(zoneId);
 }