예제 #1
0
 public static void Down()
 {
     if (UnityAdsHelper.isReady())
     {
         UnityAdsHelper.ShowAd();
     }
 }
예제 #2
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);
    }
예제 #3
0
 public void OnMouseDown()
 {
     if (UnityAdsHelper.isReady())
     {
         UnityAdsHelper.ShowAd();
     }
     Time.timeScale = 1f;
     LedEffect.t    = 2f;
     Application.LoadLevel("Menu");
 }
예제 #4
0
 void OnMouseUpAsButton()
 {
     if (UnityAdsHelper.isReady(zoneID))
     {
         UnityAdsHelper.ShowAd(zoneID, !disablePause);
     }
     else
     {
         Debug.LogWarning("Unable to show ad. Zone is not yet ready.");
     }
 }
예제 #5
0
 void OnMouseDown()
 {
     if (UnityAdsHelper.isReady())
     {
         Ads.Down();
     }
     else
     {
         Bichapp.SetActive(false);
     }
 }
예제 #6
0
    void Update()
    {
        if (showAds)
        {
            if (UnityAdsHelper.isReady())
            {
                UnityAdsHelper.Show();
            }

            showAds = false;
        }
    }
예제 #7
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);
    }
예제 #8
0
    void OnGUI()
    {
        bool isReady = UnityAdsHelper.isReady(s2sRedeemZoneID);
        bool pause   = !disablePause;

        GUI.enabled = isReady;
        if (GUI.Button(new Rect(Screen.width - 310, 10, 300, 50), isReady ? "Show Ad With S2S Redeem Callback" : "Waiting..."))
        {
            Debug.Log(string.Format("Ad Placement zone with ID of {0} is {1}. This zone is using S2S Redeem Callback functionality.",
                                    string.IsNullOrEmpty(s2sRedeemZoneID) ? "null" : s2sRedeemZoneID,
                                    isReady ? "ready" : "not ready"));

            if (isReady)
            {
                UnityAdsHelperExt.ShowAd(s2sRedeemZoneID, pause);
            }
        }
        GUI.enabled = true;
    }
예제 #9
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;
    }
예제 #10
0
    void Update()
    {
        if (UnityAdsHelper.isReady(_button.zoneID))
        {
            collider.enabled = true;

            Vector3 rotation = transform.localRotation.eulerAngles;
            rotation += Vector3.up * rotationSpeed * Time.deltaTime;

            transform.localRotation = Quaternion.Euler(rotation);
            transform.localPosition = MoveTowards(_initialPos);
        }
        else
        {
            collider.enabled = false;

            transform.localPosition = MoveTowards(_disabledPos);
        }
    }