1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-17 18:23:00 +08:00
osu-lazer/osu.Game/Online/Multiplayer/MultiplayerRoomSettings.cs

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

61 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;
using MessagePack;
2021-08-03 14:09:03 +08:00
using osu.Game.Online.Rooms;
2020-12-25 12:38:11 +08:00
namespace osu.Game.Online.Multiplayer
{
[Serializable]
[MessagePackObject]
public class MultiplayerRoomSettings : IEquatable<MultiplayerRoomSettings>
{
[Key(0)]
2020-12-11 12:27:52 +08:00
public string Name { get; set; } = "Unnamed room";
[Key(1)]
2021-02-16 20:32:38 +08: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 13:53:10 +08:00
public QueueMode QueueMode { get; set; } = QueueMode.HostOnly;
[Key(5)]
public TimeSpan AutoStartDuration { get; set; }
[Key(6)]
public bool AutoSkip { get; set; }
[IgnoreMember]
2022-03-25 14:41:01 +08:00
public bool AutoStartEnabled => AutoStartDuration != TimeSpan.Zero;
2021-11-16 14:44:47 +08: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
&& AutoStartDuration == other.AutoStartDuration
&& AutoSkip == other.AutoSkip;
2021-11-16 14:44:47 +08:00
}
public override string ToString() => $"Name:{Name}"
+ $" Password:{(string.IsNullOrEmpty(Password) ? "no" : "yes")}"
+ $" Type:{MatchType}"
+ $" Item:{PlaylistItemId}"
+ $" Queue:{QueueMode}"
+ $" Start:{AutoStartDuration}"
+ $" AutoSkip:{AutoSkip}";
}
}