Exemplo n.º 1
0
 public static void HandleRewardedAdFailedToShow(object sender, AdErrorEventArgs args)
 {
     if (OnAdFailedToShow != null)
     {
         OnAdFailedToShow.Invoke();
     }
 }
Exemplo n.º 2
0
    private void HandleRewardedAdFailedToShow(object sender, AdErrorEventArgs args)
    {
        Debug.Log($"HandleRewardedAdFailedToShow event received with message: {args.Message}");

        commandQueueHandler.SetCommandToQueue(() => OnAdFailedToShow?.Invoke());

        commandQueueHandler.SetCommandToQueue(() => CreateNewRewardedAd());
    }
Exemplo n.º 3
0
 private IEnumerator CheckInternetConnectionAndShowAd()
 {
     yield return(connectionChecker.PingGoogleEnumerator(isInternetAvaliable =>
     {
         if (isInternetAvaliable)
         {
             ExecuteCoroutineContinuously(waitForRewardedAdAnsweringInfo, WaitForRewardedAdAnsweringEnumerator());
             rewardedAdLoader.Show();
         }
         else
         {
             Debug.Log($"Force invoke OnAdFailedToShow because internet is not avaliable.");
             OnAdFailedToShow?.Invoke();
         }
     }));
 }
Exemplo n.º 4
0
    private IEnumerator WaitForRewardedAdAnsweringEnumerator()
    {
        float timeOut = 8f;

        yield return(new WaitForDoneRealtime(timeOut, () => IsLoadAnswer));

        // Если не дождались ответа от рекламы
        if (!IsLoadAnswer)
        {
            Debug.Log($"Force invoke OnAdFailedToShow because RewardedAd is not answering.");
            OnAdFailedToShow?.Invoke();
        }

        isLoadOpen         = false;
        isLoadFailedToShow = false;
    }
 // Shows the rewarded ad on the screen.
 public void Show()
 {
     if (IsLoaded() == true)
     {
         dummyAd = AdBehaviour.ShowAd(prefabAd, new Vector3(0, 0, 1));
         AdBehaviour.PauseGame();
         CreateButtonBehavior();
         AddClickBehavior(dummyAd);
         dummyAd.AddComponent <Countdown>();
     }
     else
     {
         if (OnAdFailedToShow != null)
         {
             OnAdFailedToShow.Invoke(this, new AdErrorEventArgs()
             {
                 Message = "No Ad Loaded"
             });
         }
     }
 }