mirror of
https://github.com/osukey/osukey.git
synced 2025-08-03 06:36:31 +09:00
Setup all multiplayer model classes for MessagePack support
This commit is contained in:
@ -5,6 +5,7 @@
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using MessagePack;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace osu.Game.Online.Multiplayer
|
||||
@ -13,35 +14,42 @@ namespace osu.Game.Online.Multiplayer
|
||||
/// A multiplayer room.
|
||||
/// </summary>
|
||||
[Serializable]
|
||||
[MessagePackObject]
|
||||
public class MultiplayerRoom
|
||||
{
|
||||
/// <summary>
|
||||
/// The ID of the room, used for database persistence.
|
||||
/// </summary>
|
||||
[Key(0)]
|
||||
public readonly long RoomID;
|
||||
|
||||
/// <summary>
|
||||
/// The current state of the room (ie. whether it is in progress or otherwise).
|
||||
/// </summary>
|
||||
[Key(1)]
|
||||
public MultiplayerRoomState State { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// All currently enforced game settings for this room.
|
||||
/// </summary>
|
||||
[Key(2)]
|
||||
public MultiplayerRoomSettings Settings { get; set; } = new MultiplayerRoomSettings();
|
||||
|
||||
/// <summary>
|
||||
/// All users currently in this room.
|
||||
/// </summary>
|
||||
[Key(3)]
|
||||
public List<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; }
|
||||
|
||||
[JsonConstructor]
|
||||
public MultiplayerRoom(in long roomId)
|
||||
[SerializationConstructor]
|
||||
public MultiplayerRoom(long roomId)
|
||||
{
|
||||
RoomID = roomId;
|
||||
}
|
||||
|
Reference in New Issue
Block a user