mirror of
https://github.com/ppy/osu.git
synced 2024-11-11 17:07:38 +08:00
Introduce IsPlayable(...)
and obsolete UserPlayable
This commit is contained in:
parent
b0d04a78f7
commit
51e5dd7d0e
@ -63,7 +63,7 @@ namespace osu.Game.Overlays.BeatmapSet
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
modsContainer.Add(new ModButton(new ModNoMod()));
|
modsContainer.Add(new ModButton(new ModNoMod()));
|
||||||
modsContainer.AddRange(rulesetInstance.AllMods.Where(m => m.UserPlayable).Select(m => new ModButton(m)));
|
modsContainer.AddRange(rulesetInstance.AllMods.Where(m => m.IsPlayable(ModUsage.Solo)).Select(m => new ModButton(m)));
|
||||||
|
|
||||||
modsContainer.ForEach(button =>
|
modsContainer.ForEach(button =>
|
||||||
{
|
{
|
||||||
|
@ -33,24 +33,26 @@ namespace osu.Game.Rulesets.Mods
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
IconUsage? Icon { get; }
|
IconUsage? Icon { get; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Whether this mod is playable for the given usage.
|
||||||
|
/// </summary>
|
||||||
|
/// <remarks>
|
||||||
|
/// <list type="bullet">
|
||||||
|
/// <item>Should be always <c>false</c> for cases where the user is not interacting with the game.</item>
|
||||||
|
/// <item>Should be <c>false</c> in <see cref="ModUsage.MultiplayerRequired"/> for mods that make gameplay duration dependent on user input (e.g. <see cref="ModAdaptiveSpeed"/>).</item>
|
||||||
|
/// <item>Should be <c>false</c> in <see cref="ModUsage.MultiplayerFree"/> for mods that affect the gameplay duration (e.g. <see cref="ModRateAdjust"/> and <see cref="ModTimeRamp"/>).</item>
|
||||||
|
/// </list>
|
||||||
|
/// </remarks>
|
||||||
|
/// <param name="usage">The mod usage.</param>
|
||||||
|
bool IsPlayable(ModUsage usage);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Whether this mod is playable by an end user.
|
/// Whether this mod is playable by an end user.
|
||||||
/// Should be <c>false</c> for cases where the user is not interacting with the game (so it can be excluded from multiplayer selection, for example).
|
/// Should be <c>false</c> for cases where the user is not interacting with the game (so it can be excluded from multiplayer selection, for example).
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
[Obsolete("Override IsPlayable instead.")] // Can be removed 20220918
|
||||||
bool UserPlayable { get; }
|
bool UserPlayable { get; }
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Whether this mod is playable in a multiplayer match.
|
|
||||||
/// Should be <c>false</c> for mods that make gameplay duration dependent on user input (e.g. <see cref="ModAdaptiveSpeed"/>).
|
|
||||||
/// </summary>
|
|
||||||
bool PlayableInMultiplayer { get; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Whether this mod is valid to be a "free mod" in a multiplayer match.
|
|
||||||
/// Should be <c>false</c> for mods that affect the gameplay duration (e.g. <see cref="ModRateAdjust"/> and <see cref="ModTimeRamp"/>).
|
|
||||||
/// </summary>
|
|
||||||
bool ValidFreeModInMultiplayer { get; }
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Create a fresh <see cref="Mod"/> instance based on this mod.
|
/// Create a fresh <see cref="Mod"/> instance based on this mod.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -91,16 +91,13 @@ namespace osu.Game.Rulesets.Mods
|
|||||||
[JsonIgnore]
|
[JsonIgnore]
|
||||||
public virtual bool HasImplementation => this is IApplicableMod;
|
public virtual bool HasImplementation => this is IApplicableMod;
|
||||||
|
|
||||||
|
public virtual bool IsPlayable(ModUsage usage) => true;
|
||||||
|
|
||||||
[JsonIgnore]
|
[JsonIgnore]
|
||||||
|
[Obsolete("Override IsPlayable instead.")] // Can be removed 20220918
|
||||||
public virtual bool UserPlayable => true;
|
public virtual bool UserPlayable => true;
|
||||||
|
|
||||||
[JsonIgnore]
|
[Obsolete("Going forward, the concept of \"ranked\" doesn't exist. The only exceptions are automation mods, which should now override IsPlayable to false.")] // Can be removed 20211009
|
||||||
public virtual bool PlayableInMultiplayer => UserPlayable;
|
|
||||||
|
|
||||||
[JsonIgnore]
|
|
||||||
public virtual bool ValidFreeModInMultiplayer => PlayableInMultiplayer;
|
|
||||||
|
|
||||||
[Obsolete("Going forward, the concept of \"ranked\" doesn't exist. The only exceptions are automation mods, which should now override and set UserPlayable to false.")] // Can be removed 20211009
|
|
||||||
public virtual bool Ranked => false;
|
public virtual bool Ranked => false;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
26
osu.Game/Rulesets/Mods/ModUsage.cs
Normal file
26
osu.Game/Rulesets/Mods/ModUsage.cs
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
// 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.
|
||||||
|
|
||||||
|
namespace osu.Game.Rulesets.Mods
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// The usage of this mod to determine its playability.
|
||||||
|
/// </summary>
|
||||||
|
public enum ModUsage
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// In a solo gameplay session.
|
||||||
|
/// </summary>
|
||||||
|
Solo,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// In a multiplayer match, as a required mod.
|
||||||
|
/// </summary>
|
||||||
|
MultiplayerRequired,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// In a multiplayer match, as a "free" mod.
|
||||||
|
/// </summary>
|
||||||
|
MultiplayerFree,
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user