Beispiel #1
0
    public void LoadAndShowAd()
    {
        if (DataManager.isLocalTestMode)
        {
            HandleUserEarnedReward();
            HandleAdClosed();
            return;
        }

        if (adInProcces)
        {
            return;
        }

        adInProcces     = true;
        statusText.text = "Loading ad...";
        isNeedToShow    = false;
        statusPanel.SetActive(true);

        if (RewardedAdManager.isLoaded)
        {
            RewardedAdManager.ShowAd();
        }
        else if (RewardedAdManager.isLoading)
        {
            isNeedToShow = true;
        }
        else
        {
            isNeedToShow = true;
            RewardedAdManager.CreateAndRequestAd();
        }
    }
Beispiel #2
0
    public void LoadAndShowAd(float delay)
    {
        if (DataManager.isLocalTestMode)
        {
            HandleUserEarnedReward();
            HandleAdClosed();
            return;
        }

        if (adInProcces)
        {
            return;
        }

        adInProcces     = true;
        statusText.text = "Loading ad...";
        isNeedToShow    = false;
        statusPanel.SetActive(true);

        if (!RewardedAdManager.isLoaded && !RewardedAdManager.isLoading)
        {
            RewardedAdManager.CreateAndRequestAd();
        }

        StartCoroutine(LoadAndShowWithDelay(delay));
    }
Beispiel #3
0
    private IEnumerator LoadAndShowWithDelay(float delay)
    {
        yield return(new WaitForSeconds(delay));

        if (RewardedAdManager.isLoaded)
        {
            RewardedAdManager.ShowAd();
        }
        else if (RewardedAdManager.isLoading)
        {
            isNeedToShow = true;
        }
        else
        {
            isNeedToShow = true;
            RewardedAdManager.CreateAndRequestAd();
        }
    }
Beispiel #4
0
    private void InitializeServices()
    {
        GPGSManager.Initialize(false);

        FirestoreManager.Initialize();

        IAPManager.Initialize((status) => purchasesIsReady = true);

        MobileAds.Initialize((status) =>
        {
            RequestConfiguration requestConfiguration = new RequestConfiguration.Builder().SetMaxAdContentRating(_maxAdContentRating).build();
            MobileAds.SetRequestConfiguration(requestConfiguration);

            RewardedAdManager.CreateAndRequestAd();
            InterstitialAdManager.CreateAndRequestAd();

            adsIsReady = true;
        });
    }