1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-16 14:22:55 +08:00
osu-lazer/osu.Game/Online/Multiplayer/MultiplayerRoom.cs

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

71 lines
2.1 KiB
C#
Raw Normal View History

// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using System;
2020-12-07 17:50:02 +08:00
using System.Collections.Generic;
using MessagePack;
using Newtonsoft.Json;
using osu.Game.Online.Rooms;
2020-12-25 12:38:11 +08:00
namespace osu.Game.Online.Multiplayer
{
/// <summary>
/// A multiplayer room.
/// </summary>
[Serializable]
[MessagePackObject]
public class MultiplayerRoom
{
2020-12-08 14:54:52 +08:00
/// <summary>
/// The ID of the room, used for database persistence.
/// </summary>
[Key(0)]
public readonly long RoomID;
2020-12-08 14:54:52 +08:00
/// <summary>
/// The current state of the room (ie. whether it is in progress or otherwise).
/// </summary>
[Key(1)]
public MultiplayerRoomState State { get; set; }
2020-12-07 17:50:02 +08:00
2020-12-08 14:54:52 +08:00
/// <summary>
/// All currently enforced game settings for this room.
/// </summary>
[Key(2)]
public MultiplayerRoomSettings Settings { get; set; } = new MultiplayerRoomSettings();
2020-12-08 14:54:52 +08:00
/// <summary>
/// All users currently in this room.
2020-12-08 14:54:52 +08:00
/// </summary>
[Key(3)]
public IList<MultiplayerRoomUser> Users { get; set; } = new List<MultiplayerRoomUser>();
/// <summary>
/// The host of this room, in control of changing room settings.
/// </summary>
[Key(4)]
public MultiplayerRoomUser? Host { get; set; }
[Key(5)]
public MatchRoomState? MatchState { get; set; }
[Key(6)]
public IList<MultiplayerPlaylistItem> Playlist { get; set; } = new List<MultiplayerPlaylistItem>();
/// <summary>
/// The currently-running countdown.
/// </summary>
[Key(7)]
public MultiplayerCountdown? Countdown { 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}]";
}
}