/// <summary> /// Get a match. /// </summary> public static void GetMatch(GetMatchRequest request, Action <GetMatchResult> resultCallback, Action <PlayFabError> errorCallback, object customData = null, Dictionary <string, string> extraHeaders = null) { var context = (request == null ? null : request.AuthenticationContext) ?? PlayFabSettings.staticPlayer; PlayFabHttp.MakeApiCall("/Match/GetMatch", request, AuthType.EntityToken, resultCallback, errorCallback, customData, extraHeaders, context); }
public async Task<MatchDto> Get([FromUri] int id) { var request = new GetMatchRequest { Id = id }; return await _mediator.ExecuteAsync(request).ConfigureAwait(false); }
public async Task <MatchDto> Get([FromUri] int id) { var request = new GetMatchRequest { Id = id }; return(await _mediator.ExecuteAsync(request).ConfigureAwait(false)); }
private void PrepareMatch(string matchId) { var request = new GetMatchRequest { MatchId = matchId, QueueName = PlayfabUtils.MATCHMAKING_NAME, }; PlayFabMultiplayerAPI.GetMatch(request, OnMatchGet, OnError); }
/// <summary> /// Get a match. /// </summary> public void GetMatch(GetMatchRequest request, Action <GetMatchResult> resultCallback, Action <PlayFabError> errorCallback, object customData = null, Dictionary <string, string> extraHeaders = null) { var context = (request == null ? null : request.AuthenticationContext) ?? authenticationContext; var callSettings = apiSettings ?? PlayFabSettings.staticSettings; if (!context.IsEntityLoggedIn()) { throw new PlayFabException(PlayFabExceptionCode.NotLoggedIn, "Must be logged in to call this method"); } PlayFabHttp.MakeApiCall("/Match/GetMatch", request, AuthType.EntityToken, resultCallback, errorCallback, customData, extraHeaders, context, callSettings, this); }
private static async Task <GetMatchResult> GetFinalMatch(Player player, string mmQueueName) { var getRequest = new GetMatchRequest { QueueName = mmQueueName, MatchId = player.mmMatchId }; PlayFabResult <GetMatchResult> ticketResult = await player.mpApi.GetMatchAsync(getRequest); GetMatchResult match = VerifyPlayFabCall(ticketResult, "Failed to get final matchmake ticket"); player.match = match; Console.WriteLine($"{player.context.PlayFabId} matched: {match.MatchId}"); return(match); }
public static async Task MatchFound( [QueueTrigger("matchfound")] string request, [SignalR(HubName = "PubSub")] IAsyncCollector <SignalRMessage> signalRMessageQueue, ILogger log) { log.LogInformation($"MatchFound: Received match_found event: {request}."); // We need to extact the matchId and queueName from the context. These are contained in the PlayStream V2 event payload and will be used to query GetMatch. var context = JsonConvert.DeserializeObject <EntityPlayStreamFunctionExecutionContext <MatchFoundPayload, object> >(request); var matchmakingPayload = context.PlayStreamEvent.Payload; // Making a call to PlayFab to get the match information from GetMatch. This uses the title auth context, matchId, and queueName provided in the request. PlayFabSettings.staticSettings.TitleId = context.TitleAuthenticationContext.Id; var getMatchRequest = new GetMatchRequest() { AuthenticationContext = new PlayFabAuthenticationContext() { EntityToken = context.TitleAuthenticationContext.EntityToken }, EscapeObject = false, MatchId = matchmakingPayload.MatchId, QueueName = matchmakingPayload.QueueName, ReturnMemberAttributes = true }; var match = await PlayFabMultiplayerAPI.GetMatchAsync(getMatchRequest); if (match.Error != null) { log.LogError($"GetMatch returned error: {match.Error.ErrorMessage}"); return; } log.LogInformation($"GetMatch response: {match}"); // We extracted the list of players from the GetMatch result. Now we iterate through them and send the match details to each. foreach (var player in match.Result.Members) { await signalRMessageQueue.AddAsync( new SignalRMessage { Target = "matchmakingComplete", Arguments = new[] { JsonConvert.SerializeObject(match.Result) }, UserId = player.Entity.Id }); } }
/// <summary> /// Get a match. /// </summary> public static void GetMatch(GetMatchRequest request, Action <GetMatchResult> resultCallback, Action <PlayFabError> errorCallback, object customData = null, Dictionary <string, string> extraHeaders = null) { PlayFabHttp.MakeApiCall("/Match/GetMatch", request, AuthType.EntityToken, resultCallback, errorCallback, customData, extraHeaders); }