/** * Copyright 2018 The Nakama Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ namespace Nakama { using System.Collections.Generic; using System.Runtime.Serialization; /// /// The result of a successful matchmaker operation sent to the server. /// public interface IMatchmakerMatched { /// /// The id used to join the match. /// /// /// A match ID used to join the match. /// string MatchId { get; } /// /// The ticket sent by the server when the user requested to matchmake for other players. /// string Ticket { get; } /// /// The token used to join a match. /// string Token { get; } /// /// The other users matched with this user and the parameters they sent. /// IEnumerable Users { get; } /// /// The current user who matched with opponents. /// IMatchmakerUser Self { get; } } /// /// The user with the parameters they sent to the server when asking for opponents. /// public interface IMatchmakerUser { /// /// The numeric properties which this user asked to matchmake with. /// IDictionary NumericProperties { get; } /// /// The presence of the user. /// IUserPresence Presence { get; } /// /// The string properties which this user asked to matchmake with. /// IDictionary StringProperties { get; } } /// internal class MatchmakerMatched : IMatchmakerMatched { [DataMember(Name="match_id")] public string MatchId { get; set; } [DataMember(Name="ticket")] public string Ticket { get; set; } [DataMember(Name="token")] public string Token { get; set; } public IEnumerable Users => _users ?? new List(0); [DataMember(Name="users")] public List _users { get; set; } public IMatchmakerUser Self => _self; [DataMember(Name="self")] public MatchmakerUser _self { get; set; } } /// internal class MatchmakerUser : IMatchmakerUser { public IDictionary NumericProperties => _numericProperties ?? new Dictionary(); [DataMember(Name="numeric_properties")] public Dictionary _numericProperties { get; set; } public IUserPresence Presence => _presence; [DataMember(Name="presence")] public UserPresence _presence { get; set; } public IDictionary StringProperties => _stringProperties ?? new Dictionary(); [DataMember(Name="string_properties")] public Dictionary _stringProperties { get; set; } } }