示例#1
0
 public void ShowAd()
 {
     if (Advertisement.IsReady("rewardedVideo"))
     {
         var options = new ShowOptions {
             resultCallback = HandleShowResult
         };
         Advertisement.Show("rewardedVideo", options);
     }
     else
     {
         error.Show();
         thanks.Hide();
     }
 }
示例#2
0
    private void HandleShowResult(ShowResult result)
    {
        switch (result)
        {
        case ShowResult.Finished:
            Debug.Log("The ad was successfully shown.");
            thanks.Show();
            error.Hide();
            break;

        case ShowResult.Skipped:
            Debug.Log("The ad was skipped before reaching the end.");
            break;

        case ShowResult.Failed:
            Debug.LogError("The ad failed to be shown.");
            break;
        }
    }