Exemplo n.º 1
0
    public void ShowRewardedAd(RewardedAdType type)
    {
        switch (type)
        {
        case RewardedAdType.EXTRA_ATTEMPT:
            if (extraAttempt == null)
            {
                break;
            }

            if (extraAttempt.IsLoaded())
            {
                extraAttempt.Show();
            }
            break;

        case RewardedAdType.TIMED_REWARD:
            if (timedReward == null)
            {
                break;
            }

            if (timedReward.IsLoaded())
            {
                timedReward.Show();
            }
            break;
        }
    }
Exemplo n.º 2
0
 /// <summary>
 /// Determines whether rewarded video ad is ready.
 /// </summary>
 /// <returns></returns>
 public bool IsRewardedVideoAdReady()
 {
     for (int i = 0; i < listRewardedAdType.Count; i++)
     {
         if (listRewardedAdType[i] == RewardedAdType.UNITY && UnityAdController.Instance.IsRewardedVideoReady())
         {
             readyAdType = RewardedAdType.UNITY;
             return(true);
         }
         else if (listRewardedAdType[i] == RewardedAdType.ADMOB && AdmobController.Instance.IsRewardedVideoReady())
         {
             readyAdType = RewardedAdType.ADMOB;
             return(true);
         }
     }
     return(false);
 }
Exemplo n.º 3
0
    public bool IsRewardedAdLoaded(RewardedAdType type)
    {
        switch (type)
        {
        case RewardedAdType.EXTRA_ATTEMPT:
            if (extraAttempt == null)
            {
                return(false);
            }
            return(extraAttempt.IsLoaded());

        case RewardedAdType.TIMED_REWARD:
            if (timedReward == null)
            {
                return(false);
            }
            return(timedReward.IsLoaded());
        }
        return(false);
    }
Exemplo n.º 4
0
    private void LoadAd(RewardedAdType type)
    {
        AdRequest request;

        switch (type)
        {
        case RewardedAdType.EXTRA_ATTEMPT:
            extraAttempt = new RewardedAd(extraAttemptID);
            request      = new AdRequest.Builder().AddTestDevice("59F1657632AC57BAC87BEE49D98DFD57").Build();
            extraAttempt.LoadAd(request);
            extraAttempt.OnUserEarnedReward += HandleUserEarnedReward;
            break;

        case RewardedAdType.TIMED_REWARD:
            timedReward = new RewardedAd(timedRewardID);
            request     = new AdRequest.Builder().AddTestDevice("59F1657632AC57BAC87BEE49D98DFD57").Build();
            timedReward.LoadAd(request);
            timedReward.OnUserEarnedReward += HandleUserEarnedReward;
            break;
        }
    }
Exemplo n.º 5
0
 public void ShowFreeHintAd()
 {
     rewardedAdType = RewardedAdType.FREE_HINT;
     ShowRewardedAd();
 }
Exemplo n.º 6
0
 public void ShowDoubleRewardAd()
 {
     rewardedAdType = RewardedAdType.DOUBLE_REWARD;
     ShowRewardedAd();
 }