2020-12-08 05:33:38 +00: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 07:15:51 +00:00
|
|
|
#nullable enable
|
|
|
|
|
2020-12-08 05:33:38 +00:00
|
|
|
using System;
|
|
|
|
using System.Collections.Generic;
|
|
|
|
using System.Linq;
|
2021-01-26 07:26:03 +00:00
|
|
|
using MessagePack;
|
2020-12-08 05:33:38 +00:00
|
|
|
using osu.Game.Online.API;
|
2021-08-03 06:09:03 +00:00
|
|
|
using osu.Game.Online.Rooms;
|
2020-12-08 05:33:38 +00:00
|
|
|
|
2020-12-25 04:38:11 +00:00
|
|
|
namespace osu.Game.Online.Multiplayer
|
2020-12-08 05:33:38 +00:00
|
|
|
{
|
2020-12-08 07:15:51 +00:00
|
|
|
[Serializable]
|
2021-01-26 07:26:03 +00:00
|
|
|
[MessagePackObject]
|
2020-12-08 05:33:38 +00:00
|
|
|
public class MultiplayerRoomSettings : IEquatable<MultiplayerRoomSettings>
|
|
|
|
{
|
2021-01-26 07:26:03 +00:00
|
|
|
[Key(0)]
|
2020-12-11 05:11:42 +00:00
|
|
|
public int BeatmapID { get; set; }
|
2020-12-08 05:33:38 +00:00
|
|
|
|
2021-01-26 07:26:03 +00:00
|
|
|
[Key(1)]
|
2020-12-11 09:14:33 +00:00
|
|
|
public int RulesetID { get; set; }
|
2020-12-08 05:33:38 +00:00
|
|
|
|
2021-01-26 07:26:03 +00:00
|
|
|
[Key(2)]
|
2020-12-17 12:47:57 +00:00
|
|
|
public string BeatmapChecksum { get; set; } = string.Empty;
|
|
|
|
|
2021-01-26 07:26:03 +00:00
|
|
|
[Key(3)]
|
2020-12-11 04:27:52 +00:00
|
|
|
public string Name { get; set; } = "Unnamed room";
|
|
|
|
|
2021-01-26 07:26:03 +00:00
|
|
|
[Key(4)]
|
2021-02-05 03:36:25 +00:00
|
|
|
public IEnumerable<APIMod> RequiredMods { get; set; } = Enumerable.Empty<APIMod>();
|
2020-12-08 05:33:38 +00:00
|
|
|
|
2021-02-01 10:59:18 +00:00
|
|
|
[Key(5)]
|
2021-01-27 13:25:14 +00:00
|
|
|
public IEnumerable<APIMod> AllowedMods { get; set; } = Enumerable.Empty<APIMod>();
|
|
|
|
|
2021-02-16 09:56:13 +00:00
|
|
|
[Key(6)]
|
2021-02-16 12:32:38 +00:00
|
|
|
public long PlaylistItemId { get; set; }
|
2021-02-16 09:56:13 +00:00
|
|
|
|
2021-07-08 15:53:10 +00:00
|
|
|
[Key(7)]
|
|
|
|
public string Password { get; set; } = string.Empty;
|
|
|
|
|
2021-07-21 09:59:02 +00:00
|
|
|
[Key(8)]
|
2021-08-06 09:56:01 +00:00
|
|
|
public MatchType MatchType { get; set; } = MatchType.HeadToHead;
|
2021-07-21 09:59:02 +00:00
|
|
|
|
2020-12-17 12:47:57 +00:00
|
|
|
public bool Equals(MultiplayerRoomSettings other)
|
|
|
|
=> BeatmapID == other.BeatmapID
|
|
|
|
&& BeatmapChecksum == other.BeatmapChecksum
|
2021-02-05 03:36:25 +00:00
|
|
|
&& RequiredMods.SequenceEqual(other.RequiredMods)
|
2021-01-27 13:25:14 +00:00
|
|
|
&& AllowedMods.SequenceEqual(other.AllowedMods)
|
2020-12-17 12:47:57 +00:00
|
|
|
&& RulesetID == other.RulesetID
|
2021-07-08 15:53:10 +00:00
|
|
|
&& Password.Equals(other.Password, StringComparison.Ordinal)
|
2021-02-16 09:56:13 +00:00
|
|
|
&& Name.Equals(other.Name, StringComparison.Ordinal)
|
2021-07-21 09:59:02 +00:00
|
|
|
&& PlaylistItemId == other.PlaylistItemId
|
2021-08-03 06:43:04 +00:00
|
|
|
&& MatchType == other.MatchType;
|
2020-12-08 05:33:38 +00:00
|
|
|
|
2021-01-27 13:25:14 +00:00
|
|
|
public override string ToString() => $"Name:{Name}"
|
|
|
|
+ $" Beatmap:{BeatmapID} ({BeatmapChecksum})"
|
2021-02-05 03:36:25 +00:00
|
|
|
+ $" RequiredMods:{string.Join(',', RequiredMods)}"
|
2021-01-27 13:25:14 +00:00
|
|
|
+ $" AllowedMods:{string.Join(',', AllowedMods)}"
|
2021-07-08 15:53:10 +00:00
|
|
|
+ $" Password:{(string.IsNullOrEmpty(Password) ? "no" : "yes")}"
|
2021-02-16 09:56:13 +00:00
|
|
|
+ $" Ruleset:{RulesetID}"
|
2021-08-03 06:43:04 +00:00
|
|
|
+ $" Type:{MatchType}"
|
2021-02-16 09:56:13 +00:00
|
|
|
+ $" Item:{PlaylistItemId}";
|
2020-12-08 05:33:38 +00:00
|
|
|
}
|
|
|
|
}
|