public static void RewardAdActivity(RewardAdActivityRequest request, Action <RewardAdActivityResponse> resultCallback, Action <PlayFab.PlayFabError> errorCallback, object customData = null) { if (!PlayFabHttp.IsClientLoggedIn()) { throw new Exception("Must be logged in to call this method"); } PlayFabHttp.MakeApiCall("/Client/RewardAdActivity", request, AuthType.LoginSession, resultCallback, errorCallback, customData); }
public static void RewardAdActivity(RewardAdActivityRequest request, Action <RewardAdActivityResponse> resultCallback, Action <PlayFab.PlayFabError> errorCallback, object customData = null, Dictionary <string, string> extraHeaders = null) { // var context = (request == null ? null : request.AuthenticationContext) ?? PlayFab.PlayFabSettings.staticPlayer; if (!PlayFab.PlayFabClientAPI.IsClientLoggedIn()) { throw new PlayFab.PlayFabException(PlayFab.PlayFabExceptionCode.NotLoggedIn, "Must be logged in to call this method"); } PlayFabHttp.MakeApiCall("/Client/RewardAdActivity", request, AuthType.LoginSession, resultCallback, errorCallback, customData, extraHeaders); }
/// <summary> /// 報酬の付与 /// </summary> public async void RewardAdActivityAsync() { var request = new RewardAdActivityRequest { PlacementId = PlacementId, RewardId = RewardId }; var result = await PlayFabClientAPI.RewardAdActivityAsync(request); if (result.Error != null) { if (result.Error.Error == PlayFabErrorCode.AllAdPlacementViewsAlreadyConsumed) { Debug.Log("You have exceeded the viewing limit for video ads."); } Debug.Log(result.Error.GenerateErrorReport()); } else { Debug.Log("GrantedVirtualCurrencies:" + result.Result.RewardResults.GrantedVirtualCurrencies["MS"]); OnRewardFinished?.Invoke(); } }