// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. #nullable enable using System; using System.Collections.Generic; using MessagePack; using Newtonsoft.Json; namespace osu.Game.Online.Multiplayer { /// /// A multiplayer room. /// [Serializable] [MessagePackObject] public class MultiplayerRoom { /// /// The ID of the room, used for database persistence. /// [Key(0)] public readonly long RoomID; /// /// The current state of the room (ie. whether it is in progress or otherwise). /// [Key(1)] public MultiplayerRoomState State { get; set; } /// /// All currently enforced game settings for this room. /// [Key(2)] public MultiplayerRoomSettings Settings { get; set; } = new MultiplayerRoomSettings(); /// /// All users currently in this room. /// [Key(3)] public List Users { get; set; } = new List(); /// /// The host of this room, in control of changing room settings. /// [Key(4)] public MultiplayerRoomUser? Host { get; set; } [JsonConstructor] [SerializationConstructor] public MultiplayerRoom(long roomId) { RoomID = roomId; } public override string ToString() => $"RoomID:{RoomID} Host:{Host?.UserID} Users:{Users.Count} State:{State} Settings: [{Settings}]"; } }