osu/osu.Game/Online/Multiplayer/MultiplayerRoomSettings.cs

50 lines
1.6 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.
#nullable enable
using System;
using MessagePack;
2021-08-03 06:09:03 +00:00
using osu.Game.Online.Rooms;
2020-12-25 04:38:11 +00:00
namespace osu.Game.Online.Multiplayer
{
[Serializable]
[MessagePackObject]
public class MultiplayerRoomSettings : IEquatable<MultiplayerRoomSettings>
{
[Key(0)]
2020-12-11 04:27:52 +00:00
public string Name { get; set; } = "Unnamed room";
[Key(1)]
2021-02-16 12:32:38 +00:00
public long PlaylistItemId { get; set; }
[Key(2)]
public string Password { get; set; } = string.Empty;
[Key(3)]
public MatchType MatchType { get; set; } = MatchType.HeadToHead;
[Key(4)]
2021-11-16 05:53:10 +00:00
public QueueMode QueueMode { get; set; } = QueueMode.HostOnly;
2021-11-16 06:44:47 +00:00
public bool Equals(MultiplayerRoomSettings? other)
{
if (ReferenceEquals(this, other)) return true;
if (other == null) return false;
return Password.Equals(other.Password, StringComparison.Ordinal)
&& Name.Equals(other.Name, StringComparison.Ordinal)
&& PlaylistItemId == other.PlaylistItemId
&& MatchType == other.MatchType
&& QueueMode == other.QueueMode;
}
public override string ToString() => $"Name:{Name}"
+ $" Password:{(string.IsNullOrEmpty(Password) ? "no" : "yes")}"
+ $" Type:{MatchType}"
+ $" Item:{PlaylistItemId}"
2021-10-20 05:51:59 +00:00
+ $" Queue:{QueueMode}";
}
}