Example #1
0
        public static GKTurnBasedMatchOutcome ToGKTurnBasedMatchOutcome(this MatchOutcome matchOutcome, string participantId)
        {
            var gkMatchOutcome = new GKTurnBasedMatchOutcome();
            var result         = matchOutcome.GetParticipantResult(participantId);
            var placement      = matchOutcome.GetParticipantPlacement(participantId);

            switch (result)
            {
            case ParticipantResult.CustomPlacement:
                gkMatchOutcome.outcome       = GKTurnBasedMatchOutcome.Outcome.Custom;
                gkMatchOutcome.customOutcome = placement;
                break;

            case ParticipantResult.Lost:
                gkMatchOutcome.outcome = GKTurnBasedMatchOutcome.Outcome.Lost;
                break;

            case ParticipantResult.None:
                gkMatchOutcome.outcome = GKTurnBasedMatchOutcome.Outcome.None;
                break;

            case ParticipantResult.Tied:
                gkMatchOutcome.outcome = GKTurnBasedMatchOutcome.Outcome.Tied;
                break;

            case ParticipantResult.Won:
                gkMatchOutcome.outcome = GKTurnBasedMatchOutcome.Outcome.Won;
                break;

            default:
                gkMatchOutcome.outcome = GKTurnBasedMatchOutcome.Outcome.None;
                break;
            }

            return(gkMatchOutcome);
        }