1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-15 14:12:54 +08:00

Merge branch 'master' into switch-centre-profile-info

This commit is contained in:
Joseph Madamba 2019-05-03 11:27:52 -07:00 committed by GitHub
commit 53accbfce1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 9 additions and 2 deletions

View File

@ -8,5 +8,7 @@ namespace osu.Game.Online.API.Requests.Responses
public class APIMod : IMod
{
public string Acronym { get; set; }
public bool Equals(IMod other) => Acronym == other?.Acronym;
}
}

View File

@ -1,11 +1,12 @@
// 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.
using System;
using Newtonsoft.Json;
namespace osu.Game.Rulesets.Mods
{
public interface IMod
public interface IMod : IEquatable<IMod>
{
/// <summary>
/// The shortened name of this mod.

View File

@ -70,5 +70,7 @@ namespace osu.Game.Rulesets.Mods
/// Creates a copy of this <see cref="Mod"/> initialised to a default state.
/// </summary>
public virtual Mod CreateCopy() => (Mod)Activator.CreateInstance(GetType());
public bool Equals(IMod other) => GetType() == other?.GetType();
}
}

View File

@ -177,6 +177,8 @@ namespace osu.Game.Scoring
protected class DeserializedMod : IMod
{
public string Acronym { get; set; }
public bool Equals(IMod other) => Acronym == other?.Acronym;
}
public override string ToString() => $"{User} playing {Beatmap}";

View File

@ -56,7 +56,7 @@ namespace osu.Game.Screens.Multi.Play
if (ruleset.Value.ID != playlistItem.Ruleset.ID)
throw new InvalidOperationException("Current Ruleset does not match PlaylistItem's Ruleset");
if (!playlistItem.RequiredMods.All(m => Mods.Value.Contains(m)))
if (!playlistItem.RequiredMods.All(m => Mods.Value.Any(m.Equals)))
throw new InvalidOperationException("Current Mods do not match PlaylistItem's RequiredMods");
var req = new CreateRoomScoreRequest(roomId.Value ?? 0, playlistItem.ID);