mirror of
https://github.com/ppy/osu.git
synced 2024-11-11 16:27:26 +08:00
Add nullable equality comparers
This commit is contained in:
parent
29d0d5badf
commit
00f0321f25
@ -29,12 +29,17 @@ namespace osu.Game.Online.Multiplayer
|
|||||||
[Key(4)]
|
[Key(4)]
|
||||||
public QueueMode QueueMode { get; set; } = QueueMode.HostOnly;
|
public QueueMode QueueMode { get; set; } = QueueMode.HostOnly;
|
||||||
|
|
||||||
public bool Equals(MultiplayerRoomSettings other)
|
public bool Equals(MultiplayerRoomSettings? other)
|
||||||
=> Password.Equals(other.Password, StringComparison.Ordinal)
|
{
|
||||||
&& Name.Equals(other.Name, StringComparison.Ordinal)
|
if (ReferenceEquals(this, other)) return true;
|
||||||
&& PlaylistItemId == other.PlaylistItemId
|
if (other == null) return false;
|
||||||
&& MatchType == other.MatchType
|
|
||||||
&& QueueMode == other.QueueMode;
|
return 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}"
|
public override string ToString() => $"Name:{Name}"
|
||||||
+ $" Password:{(string.IsNullOrEmpty(Password) ? "no" : "yes")}"
|
+ $" Password:{(string.IsNullOrEmpty(Password) ? "no" : "yes")}"
|
||||||
|
@ -48,9 +48,10 @@ namespace osu.Game.Online.Multiplayer
|
|||||||
UserID = userId;
|
UserID = userId;
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool Equals(MultiplayerRoomUser other)
|
public bool Equals(MultiplayerRoomUser? other)
|
||||||
{
|
{
|
||||||
if (ReferenceEquals(this, other)) return true;
|
if (ReferenceEquals(this, other)) return true;
|
||||||
|
if (other == null) return false;
|
||||||
|
|
||||||
return UserID == other.UserID;
|
return UserID == other.UserID;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user