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 @@ private void onRulesetChanged(ValueChangedEvent<IRulesetInfo> ruleset)
return;
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 =>
{

View File

@ -39,8 +39,8 @@ public interface IMod : IEquatable<IMod>
/// <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.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.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.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.MultiplayerLocal"/> 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>

View File

@ -31,7 +31,7 @@ public class ModAdaptiveSpeed : Mod, IApplicableToRate, IApplicableToDrawableHit
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) };

View File

@ -11,7 +11,7 @@ namespace osu.Game.Rulesets.Mods
{
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; }

View File

@ -30,7 +30,7 @@ public abstract class ModTimeRamp : Mod, IUpdatableByPlayfield, IApplicableToBea
[SettingSource("Adjust pitch", "Should pitch be adjusted with speed")]
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) };

View File

@ -11,17 +11,17 @@ public enum ModUsage
/// <summary>
/// This mod can be used for a per-user gameplay session.
/// </summary>
User,
SoloLocal,
/// <summary>
/// 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.
/// </summary>
MultiplayerRoomWide,
MultiplayerGlobal,
/// <summary>
/// This mod can be used in multiplayer either at a room or per-player level (i.e. "free mod").
/// </summary>
MultiplayerPerPlayer,
MultiplayerLocal,
}
}

View File

@ -25,7 +25,7 @@ public class FreeModSelectOverlay : ModSelectOverlay
public new Func<Mod, bool> 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()

View File

@ -95,8 +95,8 @@ protected override void SelectItem(PlaylistItem item)
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 @@ public override bool OnExiting(ScreenExitEvent e)
/// </summary>
/// <param name="mod">The <see cref="Mod"/> to check.</param>
/// <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>
/// Checks whether a given <see cref="Mod"/> is valid for per-player free-mod selection.

View File

@ -188,7 +188,7 @@ private void scoreChanged(ValueChangedEvent<ScoreInfo> score)
if (score.NewValue == null)
return;
if (score.NewValue.Mods.Any(m => !m.IsPlayable(ModUsage.User)))
if (score.NewValue.Mods.Any(m => !m.IsPlayable(ModUsage.SoloLocal)))
return;
var hitEvents = score.NewValue.HitEvents;

View File

@ -48,7 +48,7 @@ private bool handleTokenRetrieval()
// 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>();
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."));
return false;

View File

@ -146,7 +146,7 @@ private void load()
if (Score != null)
{
// 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);
}

View File

@ -121,7 +121,7 @@ public static bool CheckValidForGameplay(IEnumerable<Mod> mods, [NotNullWhen(fal
/// <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>
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>
/// Checks that all <see cref="Mod"/>s in a combination are valid as "free mods" in a multiplayer match session.
@ -130,7 +130,7 @@ public static bool CheckValidRequiredModsForMultiplayer(IEnumerable<Mod> mods, [
/// <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>
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)
{