2020-12-08 13:33:38 +08:00
|
|
|
// 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.
|
|
|
|
|
2020-12-08 15:15:51 +08:00
|
|
|
#nullable enable
|
|
|
|
|
2020-12-08 13:33:38 +08:00
|
|
|
using System;
|
2021-01-26 15:26:03 +08:00
|
|
|
using MessagePack;
|
2021-08-03 14:09:03 +08:00
|
|
|
using osu.Game.Online.Rooms;
|
2020-12-08 13:33:38 +08:00
|
|
|
|
2020-12-25 12:38:11 +08:00
|
|
|
namespace osu.Game.Online.Multiplayer
|
2020-12-08 13:33:38 +08:00
|
|
|
{
|
2020-12-08 15:15:51 +08:00
|
|
|
[Serializable]
|
2021-01-26 15:26:03 +08:00
|
|
|
[MessagePackObject]
|
2020-12-08 13:33:38 +08:00
|
|
|
public class MultiplayerRoomSettings : IEquatable<MultiplayerRoomSettings>
|
|
|
|
{
|
2021-01-26 15:26:03 +08:00
|
|
|
[Key(0)]
|
2020-12-11 12:27:52 +08:00
|
|
|
public string Name { get; set; } = "Unnamed room";
|
|
|
|
|
2021-10-22 15:48:28 +08:00
|
|
|
[Key(1)]
|
2021-02-16 20:32:38 +08:00
|
|
|
public long PlaylistItemId { get; set; }
|
2021-02-16 17:56:13 +08:00
|
|
|
|
2021-10-22 15:48:28 +08:00
|
|
|
[Key(2)]
|
2021-07-08 23:53:10 +08:00
|
|
|
public string Password { get; set; } = string.Empty;
|
|
|
|
|
2021-10-22 15:48:28 +08:00
|
|
|
[Key(3)]
|
2021-08-06 17:56:01 +08:00
|
|
|
public MatchType MatchType { get; set; } = MatchType.HeadToHead;
|
2021-07-21 17:59:02 +08:00
|
|
|
|
2021-10-22 15:48:28 +08:00
|
|
|
[Key(4)]
|
2021-11-16 13:53:10 +08:00
|
|
|
public QueueMode QueueMode { get; set; } = QueueMode.HostOnly;
|
2021-10-14 22:24:01 +08:00
|
|
|
|
2022-03-18 21:00:39 +08:00
|
|
|
[Key(5)]
|
|
|
|
public TimeSpan AutoStartDuration { get; set; }
|
|
|
|
|
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
|
2022-03-18 21:00:39 +08:00
|
|
|
&& QueueMode == other.QueueMode
|
|
|
|
&& AutoStartDuration == other.AutoStartDuration;
|
2021-11-16 14:44:47 +08:00
|
|
|
}
|
2020-12-08 13:33:38 +08:00
|
|
|
|
2021-01-27 21:25:14 +08:00
|
|
|
public override string ToString() => $"Name:{Name}"
|
2021-07-08 23:53:10 +08:00
|
|
|
+ $" Password:{(string.IsNullOrEmpty(Password) ? "no" : "yes")}"
|
2021-08-03 14:43:04 +08:00
|
|
|
+ $" Type:{MatchType}"
|
2021-10-14 22:24:01 +08:00
|
|
|
+ $" Item:{PlaylistItemId}"
|
2022-03-18 21:00:39 +08:00
|
|
|
+ $" Queue:{QueueMode}"
|
|
|
|
+ $" Start:{AutoStartDuration}";
|
2020-12-08 13:33:38 +08:00
|
|
|
}
|
|
|
|
}
|