예제 #1
0
 private void UpdateUI()
 {
     GameIdInput.interactable          = !adsInitialized;
     InitializeButton.interactable     = !adsInitialized;
     TestModeToggle.interactable       = !adsInitialized;
     ShowDefaultAdButton.interactable  = adsInitialized && Ads.DefaultAdPlacementReady();
     ShowRewardedAdButton.interactable = adsInitialized && (Ads.RewardedAdPlacementReady(RewardedAdPlacementIdInput.text) != null);
 }
예제 #2
0
    void Update()
    {
        if (Input.GetKeyDown(KeyCode.Escape))
        {
            // use back button on Android to close config
            if (ConfigPanel.activeSelf)
            {
                HideConfigButtonClicked();
            }
        }

        deltaTime += (Time.deltaTime - deltaTime) * 0.1f;

        if (!adsInitialized && Ads.DefaultAdPlacementReady())
        {
            adsInitialized = true; // has ads been available at some point? used to see if we managed to initialize correctly
            Log(string.Format("Ads initialized after {0:n1} seconds", (Time.time - adsInitializeTime)));
        }

        UpdateUI();
    }
예제 #3
0
    void Update()
    {
        if (Input.GetKeyDown(KeyCode.Escape))
        {
            // use back button on Android to close config
            if (ConfigPanel.activeSelf)
            {
                HideConfigButtonClicked();
            }
        }

        deltaTime += (Time.deltaTime - deltaTime) * 0.1f;

        #if UNITY_ADS_PACKAGE
        if (!adsInitialized && Ads.DefaultAdPlacementReady())
        {
            adsInitialized = true; // has ads been available at some point? used to see if we managed to initialize correctly
        }
        #endif

        UpdateUI();
    }
예제 #4
0
    internal IEnumerator ShowAdCouroutine()
    {
        float startTime = Time.time;

        if (!Ads.IsInitialized)
        {
            Log("Initializing ads from coroutine...");
            Ads.InitializeAds(GameIdInput.text, TestModeToggle.isOn);
        }

        while (!Ads.DefaultAdPlacementReady())
        {
            float time = Time.time - startTime;
            yield return(new WaitForSeconds(0.5f));

            if (time > 30.0f)
            {
                Log("Failed to initialize ads, please verify that you entered correct game id");
                yield break;
            }
        }

        Ads.ShowAd();
    }