コード例 #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();
        }
    }
コード例 #2
0
 public void HandleAdLoaded()
 {
     if (isNeedToShow)
     {
         RewardedAdManager.ShowAd();
         isNeedToShow = false;
     }
 }
コード例 #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();
        }
    }