1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-07 18:47:26 +08:00
osu-lazer/osu.Game/Online/Multiplayer/MultiplayerRoomSettings.cs

46 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 System.Collections.Generic;
using System.Linq;
using JetBrains.Annotations;
using osu.Game.Online.API;
2020-12-25 12:38:11 +08:00
namespace osu.Game.Online.Multiplayer
{
[Serializable]
public class MultiplayerRoomSettings : IEquatable<MultiplayerRoomSettings>
{
public int BeatmapID { get; set; }
2020-12-11 17:14:33 +08:00
public int RulesetID { get; set; }
public string BeatmapChecksum { get; set; } = string.Empty;
2020-12-11 12:27:52 +08:00
public string Name { get; set; } = "Unnamed room";
[NotNull]
public IEnumerable<APIMod> Mods { get; set; } = Enumerable.Empty<APIMod>();
[NotNull]
public IEnumerable<APIMod> AllowedMods { get; set; } = Enumerable.Empty<APIMod>();
public bool Equals(MultiplayerRoomSettings other)
=> BeatmapID == other.BeatmapID
&& BeatmapChecksum == other.BeatmapChecksum
&& Mods.SequenceEqual(other.Mods)
&& AllowedMods.SequenceEqual(other.AllowedMods)
&& RulesetID == other.RulesetID
&& Name.Equals(other.Name, StringComparison.Ordinal);
public override string ToString() => $"Name:{Name}"
+ $" Beatmap:{BeatmapID} ({BeatmapChecksum})"
+ $" Mods:{string.Join(',', Mods)}"
+ $" AllowedMods:{string.Join(',', AllowedMods)}"
+ $" Ruleset:{RulesetID}";
}
}