Remove beatmap/ruleset/etc from MultiplayerRoomSettings

This commit is contained in:
smoogipoo
2021-10-22 16:48:28 +09:00
parent a1c9b56083
commit db87e42d47
11 changed files with 180 additions and 108 deletions

View File

@ -4,10 +4,7 @@
#nullable enable
using System;
using System.Collections.Generic;
using System.Linq;
using MessagePack;
using osu.Game.Online.API;
using osu.Game.Online.Multiplayer.Queueing;
using osu.Game.Online.Rooms;
@ -18,53 +15,29 @@ namespace osu.Game.Online.Multiplayer
public class MultiplayerRoomSettings : IEquatable<MultiplayerRoomSettings>
{
[Key(0)]
public int BeatmapID { get; set; }
[Key(1)]
public int RulesetID { get; set; }
[Key(2)]
public string BeatmapChecksum { get; set; } = string.Empty;
[Key(3)]
public string Name { get; set; } = "Unnamed room";
[Key(4)]
public IEnumerable<APIMod> RequiredMods { get; set; } = Enumerable.Empty<APIMod>();
[Key(5)]
public IEnumerable<APIMod> AllowedMods { get; set; } = Enumerable.Empty<APIMod>();
[Key(6)]
[Key(1)]
public long PlaylistItemId { get; set; }
[Key(7)]
[Key(2)]
public string Password { get; set; } = string.Empty;
[Key(8)]
[Key(3)]
public MatchType MatchType { get; set; } = MatchType.HeadToHead;
[Key(9)]
[Key(4)]
public QueueModes QueueMode { get; set; } = QueueModes.HostOnly;
public bool Equals(MultiplayerRoomSettings other)
=> BeatmapID == other.BeatmapID
&& BeatmapChecksum == other.BeatmapChecksum
&& RequiredMods.SequenceEqual(other.RequiredMods)
&& AllowedMods.SequenceEqual(other.AllowedMods)
&& RulesetID == other.RulesetID
&& Password.Equals(other.Password, StringComparison.Ordinal)
=> 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}"
+ $" Beatmap:{BeatmapID} ({BeatmapChecksum})"
+ $" RequiredMods:{string.Join(',', RequiredMods)}"
+ $" AllowedMods:{string.Join(',', AllowedMods)}"
+ $" Password:{(string.IsNullOrEmpty(Password) ? "no" : "yes")}"
+ $" Ruleset:{RulesetID}"
+ $" Type:{MatchType}"
+ $" Item:{PlaylistItemId}"
+ $" Queue:{QueueMode}";