public void Finish(TurnBasedMatch match, byte[] data, MatchOutcome outcome, Action <bool> callback) { callback = Callbacks.AsOnGameThreadCallback(callback); FindEqualVersionMatch(match, callback, foundMatch => { ParticipantResults results = foundMatch.Results(); foreach (string participantId in outcome.ParticipantIds) { Types.MatchResult matchResult = ResultToMatchResult(outcome.GetResultFor(participantId)); uint placing = outcome.GetPlacementFor(participantId); if (results.HasResultsForParticipant(participantId)) { // If the match already has results for this participant, make sure that they're // consistent with what's already there. var existingResults = results.ResultsForParticipant(participantId); var existingPlacing = results.PlacingForParticipant(participantId); if (matchResult != existingResults || placing != existingPlacing) { Logger.e(string.Format("Attempted to override existing results for " + "participant {0}: Placing {1}, Result {2}", participantId, existingPlacing, existingResults)); callback(false); return; } } else { // Otherwise, get updated results and dispose of the old ones. var oldResults = results; results = oldResults.WithResult(participantId, placing, matchResult); oldResults.Dispose(); } } mTurnBasedManager.FinishMatchDuringMyTurn(foundMatch, data, results, response => callback(response.RequestSucceeded())); }); }
internal void FinishMatchDuringMyTurn(NativeTurnBasedMatch match, byte[] data, ParticipantResults results, Action<TurnBasedMatchResponse> callback) { TurnBasedMultiplayerManager.TurnBasedMultiplayerManager_FinishMatchDuringMyTurn( mGameServices.AsHandle(), match.AsPointer(), data, new UIntPtr((uint)data.Length), results.AsPointer(), InternalTurnBasedMatchCallback, ToCallbackPointer(callback) ); }