Apply proposed naming changes

This commit is contained in:
Salman Ahmed 2022-05-04 17:08:41 +03:00
parent e9ecf26b6a
commit 20e277d2e5
13 changed files with 18 additions and 18 deletions

View File

@ -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.IsPlayable(ModUsage.User)).Select(m => new ModButton(m))); modsContainer.AddRange(rulesetInstance.AllMods.Where(m => m.IsPlayable(ModUsage.SoloLocal)).Select(m => new ModButton(m)));
modsContainer.ForEach(button => modsContainer.ForEach(button =>
{ {

View File

@ -39,8 +39,8 @@ namespace osu.Game.Rulesets.Mods
/// <remarks> /// <remarks>
/// <list type="bullet"> /// <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 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.MultiplayerRoomWide"/> 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.MultiplayerGlobal"/> 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.MultiplayerPerPlayer"/> for mods that affect the gameplay duration (e.g. <see cref="ModRateAdjust"/> and <see cref="ModTimeRamp"/>).</item> /// <item>Should be <c>false</c> in <see cref="ModUsage.MultiplayerLocal"/> for mods that affect the gameplay duration (e.g. <see cref="ModRateAdjust"/> and <see cref="ModTimeRamp"/>).</item>
/// </list> /// </list>
/// </remarks> /// </remarks>
/// <param name="usage">The mod usage.</param> /// <param name="usage">The mod usage.</param>

View File

@ -31,7 +31,7 @@ namespace osu.Game.Rulesets.Mods
public override double ScoreMultiplier => 1; public override double ScoreMultiplier => 1;
public override bool IsPlayable(ModUsage usage) => usage == ModUsage.User; public override bool IsPlayable(ModUsage usage) => usage == ModUsage.SoloLocal;
public override Type[] IncompatibleMods => new[] { typeof(ModRateAdjust), typeof(ModTimeRamp) }; public override Type[] IncompatibleMods => new[] { typeof(ModRateAdjust), typeof(ModTimeRamp) };

View File

@ -11,7 +11,7 @@ namespace osu.Game.Rulesets.Mods
{ {
public abstract class ModRateAdjust : Mod, IApplicableToRate public abstract class ModRateAdjust : Mod, IApplicableToRate
{ {
public override bool IsPlayable(ModUsage usage) => usage != ModUsage.MultiplayerPerPlayer; public override bool IsPlayable(ModUsage usage) => usage != ModUsage.MultiplayerLocal;
public abstract BindableNumber<double> SpeedChange { get; } public abstract BindableNumber<double> SpeedChange { get; }

View File

@ -30,7 +30,7 @@ namespace osu.Game.Rulesets.Mods
[SettingSource("Adjust pitch", "Should pitch be adjusted with speed")] [SettingSource("Adjust pitch", "Should pitch be adjusted with speed")]
public abstract BindableBool AdjustPitch { get; } public abstract BindableBool AdjustPitch { get; }
public override bool IsPlayable(ModUsage usage) => usage != ModUsage.MultiplayerPerPlayer; public override bool IsPlayable(ModUsage usage) => usage != ModUsage.MultiplayerLocal;
public override Type[] IncompatibleMods => new[] { typeof(ModRateAdjust), typeof(ModAdaptiveSpeed) }; public override Type[] IncompatibleMods => new[] { typeof(ModRateAdjust), typeof(ModAdaptiveSpeed) };

View File

@ -11,17 +11,17 @@ namespace osu.Game.Rulesets.Mods
/// <summary> /// <summary>
/// This mod can be used for a per-user gameplay session. /// This mod can be used for a per-user gameplay session.
/// </summary> /// </summary>
User, SoloLocal,
/// <summary> /// <summary>
/// This mod can be used in multiplayer but must be applied to all users. /// This mod can be used in multiplayer but must be applied to all users.
/// This is generally the case for mods which affect the length of gameplay. /// This is generally the case for mods which affect the length of gameplay.
/// </summary> /// </summary>
MultiplayerRoomWide, MultiplayerGlobal,
/// <summary> /// <summary>
/// This mod can be used in multiplayer either at a room or per-player level (i.e. "free mod"). /// This mod can be used in multiplayer either at a room or per-player level (i.e. "free mod").
/// </summary> /// </summary>
MultiplayerPerPlayer, MultiplayerLocal,
} }
} }

View File

@ -25,7 +25,7 @@ namespace osu.Game.Screens.OnlinePlay
public new Func<Mod, bool> IsValidMod public new Func<Mod, bool> IsValidMod
{ {
get => base.IsValidMod; get => base.IsValidMod;
set => base.IsValidMod = m => m.HasImplementation && m.IsPlayable(ModUsage.User) && value(m); set => base.IsValidMod = m => m.HasImplementation && m.IsPlayable(ModUsage.SoloLocal) && value(m);
} }
public FreeModSelectOverlay() public FreeModSelectOverlay()

View File

@ -95,8 +95,8 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer
protected override BeatmapDetailArea CreateBeatmapDetailArea() => new PlayBeatmapDetailArea(); protected override BeatmapDetailArea CreateBeatmapDetailArea() => new PlayBeatmapDetailArea();
protected override bool IsValidMod(Mod mod) => base.IsValidMod(mod) && mod.IsPlayable(ModUsage.MultiplayerRoomWide); protected override bool IsValidMod(Mod mod) => base.IsValidMod(mod) && mod.IsPlayable(ModUsage.MultiplayerGlobal);
protected override bool IsValidFreeMod(Mod mod) => base.IsValidFreeMod(mod) && mod.IsPlayable(ModUsage.MultiplayerPerPlayer); protected override bool IsValidFreeMod(Mod mod) => base.IsValidFreeMod(mod) && mod.IsPlayable(ModUsage.MultiplayerLocal);
} }
} }

View File

@ -170,7 +170,7 @@ namespace osu.Game.Screens.OnlinePlay
/// </summary> /// </summary>
/// <param name="mod">The <see cref="Mod"/> to check.</param> /// <param name="mod">The <see cref="Mod"/> to check.</param>
/// <returns>Whether <paramref name="mod"/> is a valid mod for online play.</returns> /// <returns>Whether <paramref name="mod"/> is a valid mod for online play.</returns>
protected virtual bool IsValidMod(Mod mod) => mod.HasImplementation && ModUtils.FlattenMod(mod).All(m => m.IsPlayable(ModUsage.User)); protected virtual bool IsValidMod(Mod mod) => mod.HasImplementation && ModUtils.FlattenMod(mod).All(m => m.IsPlayable(ModUsage.SoloLocal));
/// <summary> /// <summary>
/// Checks whether a given <see cref="Mod"/> is valid for per-player free-mod selection. /// Checks whether a given <see cref="Mod"/> is valid for per-player free-mod selection.

View File

@ -188,7 +188,7 @@ namespace osu.Game.Screens.Play.PlayerSettings
if (score.NewValue == null) if (score.NewValue == null)
return; return;
if (score.NewValue.Mods.Any(m => !m.IsPlayable(ModUsage.User))) if (score.NewValue.Mods.Any(m => !m.IsPlayable(ModUsage.SoloLocal)))
return; return;
var hitEvents = score.NewValue.HitEvents; var hitEvents = score.NewValue.HitEvents;

View File

@ -48,7 +48,7 @@ namespace osu.Game.Screens.Play
// Token request construction should happen post-load to allow derived classes to potentially prepare DI backings that are used to create the request. // Token request construction should happen post-load to allow derived classes to potentially prepare DI backings that are used to create the request.
var tcs = new TaskCompletionSource<bool>(); var tcs = new TaskCompletionSource<bool>();
if (Mods.Value.Any(m => !m.IsPlayable(ModUsage.User))) if (Mods.Value.Any(m => !m.IsPlayable(ModUsage.SoloLocal)))
{ {
handleTokenFailure(new InvalidOperationException("Non-user playable mod selected.")); handleTokenFailure(new InvalidOperationException("Non-user playable mod selected."));
return false; return false;

View File

@ -146,7 +146,7 @@ namespace osu.Game.Screens.Ranking
if (Score != null) if (Score != null)
{ {
// only show flair / animation when arriving after watching a play that isn't autoplay. // only show flair / animation when arriving after watching a play that isn't autoplay.
bool shouldFlair = player != null && Score.Mods.All(m => m.IsPlayable(ModUsage.User)); bool shouldFlair = player != null && Score.Mods.All(m => m.IsPlayable(ModUsage.SoloLocal));
ScorePanelList.AddScore(Score, shouldFlair); ScorePanelList.AddScore(Score, shouldFlair);
} }

View File

@ -121,7 +121,7 @@ namespace osu.Game.Utils
/// <param name="invalidMods">Invalid mods, if any were found. Will be null if all mods were valid.</param> /// <param name="invalidMods">Invalid mods, if any were found. Will be null if all mods were valid.</param>
/// <returns>Whether the input mods were all valid. If false, <paramref name="invalidMods"/> will contain all invalid entries.</returns> /// <returns>Whether the input mods were all valid. If false, <paramref name="invalidMods"/> will contain all invalid entries.</returns>
public static bool CheckValidRequiredModsForMultiplayer(IEnumerable<Mod> mods, [NotNullWhen(false)] out List<Mod>? invalidMods) public static bool CheckValidRequiredModsForMultiplayer(IEnumerable<Mod> mods, [NotNullWhen(false)] out List<Mod>? invalidMods)
=> checkValid(mods, m => m.IsPlayable(ModUsage.MultiplayerRoomWide), out invalidMods); => checkValid(mods, m => m.IsPlayable(ModUsage.MultiplayerGlobal), out invalidMods);
/// <summary> /// <summary>
/// Checks that all <see cref="Mod"/>s in a combination are valid as "free mods" in a multiplayer match session. /// Checks that all <see cref="Mod"/>s in a combination are valid as "free mods" in a multiplayer match session.
@ -130,7 +130,7 @@ namespace osu.Game.Utils
/// <param name="invalidMods">Invalid mods, if any were found. Will be null if all mods were valid.</param> /// <param name="invalidMods">Invalid mods, if any were found. Will be null if all mods were valid.</param>
/// <returns>Whether the input mods were all valid. If false, <paramref name="invalidMods"/> will contain all invalid entries.</returns> /// <returns>Whether the input mods were all valid. If false, <paramref name="invalidMods"/> will contain all invalid entries.</returns>
public static bool CheckValidFreeModsForMultiplayer(IEnumerable<Mod> mods, [NotNullWhen(false)] out List<Mod>? invalidMods) public static bool CheckValidFreeModsForMultiplayer(IEnumerable<Mod> mods, [NotNullWhen(false)] out List<Mod>? invalidMods)
=> checkValid(mods, m => m.IsPlayable(ModUsage.MultiplayerPerPlayer), out invalidMods); => checkValid(mods, m => m.IsPlayable(ModUsage.MultiplayerLocal), out invalidMods);
private static bool checkValid(IEnumerable<Mod> mods, Predicate<Mod> valid, [NotNullWhen(false)] out List<Mod>? invalidMods) private static bool checkValid(IEnumerable<Mod> mods, Predicate<Mod> valid, [NotNullWhen(false)] out List<Mod>? invalidMods)
{ {