1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-15 15:17:44 +08:00

Rename enum to non-plural now that it won't conflict

This commit is contained in:
Dean Herbert 2024-10-01 19:55:46 +09:00
parent 8dba4cf760
commit 8773c34fdd
No known key found for this signature in database
13 changed files with 35 additions and 35 deletions

View File

@ -25,7 +25,7 @@ namespace osu.Desktop.Updater
[Resolved] [Resolved]
private ILocalUserPlayInfo? localUserInfo { get; set; } private ILocalUserPlayInfo? localUserInfo { get; set; }
private bool isInGameplay => localUserInfo?.PlayingState.Value != LocalUserPlayingStates.NotPlaying; private bool isInGameplay => localUserInfo?.PlayingState.Value != LocalUserPlayingState.NotPlaying;
private UpdateInfo? pendingUpdate; private UpdateInfo? pendingUpdate;

View File

@ -13,7 +13,7 @@ namespace osu.Desktop.Windows
public partial class GameplayWinKeyBlocker : Component public partial class GameplayWinKeyBlocker : Component
{ {
private Bindable<bool> disableWinKey = null!; private Bindable<bool> disableWinKey = null!;
private IBindable<LocalUserPlayingStates> localUserPlaying = null!; private IBindable<LocalUserPlayingState> localUserPlaying = null!;
private IBindable<bool> isActive = null!; private IBindable<bool> isActive = null!;
[Resolved] [Resolved]
@ -34,7 +34,7 @@ namespace osu.Desktop.Windows
private void updateBlocking() private void updateBlocking()
{ {
bool shouldDisable = isActive.Value && disableWinKey.Value && localUserPlaying.Value == LocalUserPlayingStates.Playing; bool shouldDisable = isActive.Value && disableWinKey.Value && localUserPlaying.Value == LocalUserPlayingState.Playing;
if (shouldDisable) if (shouldDisable)
host.InputThread.Scheduler.Add(WindowsKey.Disable); host.InputThread.Scheduler.Add(WindowsKey.Disable);

View File

@ -22,9 +22,9 @@ namespace osu.Game.Tests.Database
[HeadlessTest] [HeadlessTest]
public partial class BackgroundDataStoreProcessorTests : OsuTestScene, ILocalUserPlayInfo public partial class BackgroundDataStoreProcessorTests : OsuTestScene, ILocalUserPlayInfo
{ {
public IBindable<LocalUserPlayingStates> PlayingState => isPlaying; public IBindable<LocalUserPlayingState> PlayingState => isPlaying;
private readonly Bindable<LocalUserPlayingStates> isPlaying = new Bindable<LocalUserPlayingStates>(); private readonly Bindable<LocalUserPlayingState> isPlaying = new Bindable<LocalUserPlayingState>();
private BeatmapSetInfo importedSet = null!; private BeatmapSetInfo importedSet = null!;
@ -37,7 +37,7 @@ namespace osu.Game.Tests.Database
[SetUpSteps] [SetUpSteps]
public void SetUpSteps() public void SetUpSteps()
{ {
AddStep("Set not playing", () => isPlaying.Value = LocalUserPlayingStates.NotPlaying); AddStep("Set not playing", () => isPlaying.Value = LocalUserPlayingState.NotPlaying);
} }
[Test] [Test]
@ -89,7 +89,7 @@ namespace osu.Game.Tests.Database
}); });
}); });
AddStep("Set playing", () => isPlaying.Value = LocalUserPlayingStates.Playing); AddStep("Set playing", () => isPlaying.Value = LocalUserPlayingState.Playing);
AddStep("Reset difficulty", () => AddStep("Reset difficulty", () =>
{ {
@ -117,7 +117,7 @@ namespace osu.Game.Tests.Database
}); });
}); });
AddStep("Set not playing", () => isPlaying.Value = LocalUserPlayingStates.NotPlaying); AddStep("Set not playing", () => isPlaying.Value = LocalUserPlayingState.NotPlaying);
AddUntilStep("wait for difficulties repopulated", () => AddUntilStep("wait for difficulties repopulated", () =>
{ {

View File

@ -17,7 +17,7 @@ namespace osu.Game.Tests.Input
[HeadlessTest] [HeadlessTest]
public partial class ConfineMouseTrackerTest : OsuGameTestScene public partial class ConfineMouseTrackerTest : OsuGameTestScene
{ {
private readonly Bindable<LocalUserPlayingStates> playingState = new Bindable<LocalUserPlayingStates>(); private readonly Bindable<LocalUserPlayingState> playingState = new Bindable<LocalUserPlayingState>();
[Resolved] [Resolved]
private FrameworkConfigManager frameworkConfigManager { get; set; } = null!; private FrameworkConfigManager frameworkConfigManager { get; set; } = null!;
@ -28,7 +28,7 @@ namespace osu.Game.Tests.Input
base.SetUpSteps(); base.SetUpSteps();
// a bit dodgy. // a bit dodgy.
AddStep("bind playing state", () => ((IBindable<LocalUserPlayingStates>)playingState).BindTo(((ILocalUserPlayInfo)Game).PlayingState)); AddStep("bind playing state", () => ((IBindable<LocalUserPlayingState>)playingState).BindTo(((ILocalUserPlayInfo)Game).PlayingState));
} }
[TestCase(WindowMode.Windowed)] [TestCase(WindowMode.Windowed)]
@ -101,7 +101,7 @@ namespace osu.Game.Tests.Input
=> AddStep($"set {mode} game-side", () => Game.LocalConfig.SetValue(OsuSetting.ConfineMouseMode, mode)); => AddStep($"set {mode} game-side", () => Game.LocalConfig.SetValue(OsuSetting.ConfineMouseMode, mode));
private void setLocalUserPlayingTo(bool playing) private void setLocalUserPlayingTo(bool playing)
=> AddStep($"local user {(playing ? "playing" : "not playing")}", () => playingState.Value = playing ? LocalUserPlayingStates.Playing : LocalUserPlayingStates.NotPlaying); => AddStep($"local user {(playing ? "playing" : "not playing")}", () => playingState.Value = playing ? LocalUserPlayingState.Playing : LocalUserPlayingState.NotPlaying);
private void gameSideModeIs(OsuConfineMouseMode mode) private void gameSideModeIs(OsuConfineMouseMode mode)
=> AddAssert($"mode is {mode} game-side", () => Game.LocalConfig.Get<OsuConfineMouseMode>(OsuSetting.ConfineMouseMode) == mode); => AddAssert($"mode is {mode} game-side", () => Game.LocalConfig.Get<OsuConfineMouseMode>(OsuSetting.ConfineMouseMode) == mode);

View File

@ -25,7 +25,7 @@ namespace osu.Game.Tests.Visual.Multiplayer
[Cached(typeof(ILocalUserPlayInfo))] [Cached(typeof(ILocalUserPlayInfo))]
private ILocalUserPlayInfo localUserInfo; private ILocalUserPlayInfo localUserInfo;
private readonly Bindable<LocalUserPlayingStates> playingState = new Bindable<LocalUserPlayingStates>(); private readonly Bindable<LocalUserPlayingState> playingState = new Bindable<LocalUserPlayingState>();
private TextBox textBox => chatDisplay.ChildrenOfType<TextBox>().First(); private TextBox textBox => chatDisplay.ChildrenOfType<TextBox>().First();
@ -124,6 +124,6 @@ namespace osu.Game.Tests.Visual.Multiplayer
AddAssert($"chat {(isFocused ? "focused" : "not focused")}", () => textBox.HasFocus == isFocused); AddAssert($"chat {(isFocused ? "focused" : "not focused")}", () => textBox.HasFocus == isFocused);
private void setLocalUserPlaying(bool playing) => private void setLocalUserPlaying(bool playing) =>
AddStep($"local user {(playing ? "playing" : "not playing")}", () => playingState.Value = playing ? LocalUserPlayingStates.Playing : LocalUserPlayingStates.NotPlaying); AddStep($"local user {(playing ? "playing" : "not playing")}", () => playingState.Value = playing ? LocalUserPlayingState.Playing : LocalUserPlayingState.NotPlaying);
} }
} }

View File

@ -606,7 +606,7 @@ namespace osu.Game.Database
{ {
// Importantly, also sleep if high performance session is active. // Importantly, also sleep if high performance session is active.
// If we don't do this, memory usage can become runaway due to GC running in a more lenient mode. // If we don't do this, memory usage can become runaway due to GC running in a more lenient mode.
while (localUserPlayInfo?.PlayingState.Value != LocalUserPlayingStates.NotPlaying || highPerformanceSessionManager?.IsSessionActive == true) while (localUserPlayInfo?.PlayingState.Value != LocalUserPlayingState.NotPlaying || highPerformanceSessionManager?.IsSessionActive == true)
{ {
Logger.Log("Background processing sleeping due to active gameplay..."); Logger.Log("Background processing sleeping due to active gameplay...");
Thread.Sleep(TimeToSleepDuringGameplay); Thread.Sleep(TimeToSleepDuringGameplay);

View File

@ -25,7 +25,7 @@ namespace osu.Game.Input
private Bindable<bool> frameworkMinimiseOnFocusLossInFullscreen; private Bindable<bool> frameworkMinimiseOnFocusLossInFullscreen;
private Bindable<OsuConfineMouseMode> osuConfineMode; private Bindable<OsuConfineMouseMode> osuConfineMode;
private IBindable<LocalUserPlayingStates> localUserPlaying; private IBindable<LocalUserPlayingState> localUserPlaying;
[BackgroundDependencyLoader] [BackgroundDependencyLoader]
private void load(ILocalUserPlayInfo localUserInfo, FrameworkConfigManager frameworkConfigManager, OsuConfigManager osuConfigManager) private void load(ILocalUserPlayInfo localUserInfo, FrameworkConfigManager frameworkConfigManager, OsuConfigManager osuConfigManager)
@ -63,7 +63,7 @@ namespace osu.Game.Input
break; break;
case OsuConfineMouseMode.DuringGameplay: case OsuConfineMouseMode.DuringGameplay:
frameworkConfineMode.Value = localUserPlaying.Value == LocalUserPlayingStates.Playing ? ConfineMouseMode.Always : ConfineMouseMode.Never; frameworkConfineMode.Value = localUserPlaying.Value == LocalUserPlayingState.Playing ? ConfineMouseMode.Always : ConfineMouseMode.Never;
break; break;
case OsuConfineMouseMode.Always: case OsuConfineMouseMode.Always:

View File

@ -10,9 +10,9 @@ namespace osu.Game.Input
{ {
public partial class OsuUserInputManager : UserInputManager public partial class OsuUserInputManager : UserInputManager
{ {
protected override bool AllowRightClickFromLongTouch => PlayingState.Value == LocalUserPlayingStates.NotPlaying; protected override bool AllowRightClickFromLongTouch => PlayingState.Value == LocalUserPlayingState.NotPlaying;
public readonly Bindable<LocalUserPlayingStates> PlayingState = new Bindable<LocalUserPlayingStates>(); public readonly Bindable<LocalUserPlayingState> PlayingState = new Bindable<LocalUserPlayingState>();
internal OsuUserInputManager() internal OsuUserInputManager()
{ {

View File

@ -175,9 +175,9 @@ namespace osu.Game
/// </summary> /// </summary>
public readonly IBindable<OverlayActivation> OverlayActivationMode = new Bindable<OverlayActivation>(); public readonly IBindable<OverlayActivation> OverlayActivationMode = new Bindable<OverlayActivation>();
IBindable<LocalUserPlayingStates> ILocalUserPlayInfo.PlayingState => playingState; IBindable<LocalUserPlayingState> ILocalUserPlayInfo.PlayingState => playingState;
private readonly Bindable<LocalUserPlayingStates> playingState = new Bindable<LocalUserPlayingStates>(); private readonly Bindable<LocalUserPlayingState> playingState = new Bindable<LocalUserPlayingState>();
protected OsuScreenStack ScreenStack; protected OsuScreenStack ScreenStack;
@ -388,9 +388,9 @@ namespace osu.Game
playingState.BindValueChanged(p => playingState.BindValueChanged(p =>
{ {
BeatmapManager.PauseImports = p.NewValue != LocalUserPlayingStates.NotPlaying; BeatmapManager.PauseImports = p.NewValue != LocalUserPlayingState.NotPlaying;
SkinManager.PauseImports = p.NewValue != LocalUserPlayingStates.NotPlaying; SkinManager.PauseImports = p.NewValue != LocalUserPlayingState.NotPlaying;
ScoreManager.PauseImports = p.NewValue != LocalUserPlayingStates.NotPlaying; ScoreManager.PauseImports = p.NewValue != LocalUserPlayingState.NotPlaying;
}, true); }, true);
IsActive.BindValueChanged(active => updateActiveState(active.NewValue), true); IsActive.BindValueChanged(active => updateActiveState(active.NewValue), true);
@ -1549,7 +1549,7 @@ namespace osu.Game
}); });
// reset on screen change for sanity. // reset on screen change for sanity.
playingState.Value = LocalUserPlayingStates.NotPlaying; playingState.Value = LocalUserPlayingState.NotPlaying;
if (current is Player oldPlayer) if (current is Player oldPlayer)
oldPlayer.PlayingState.UnbindFrom(playingState); oldPlayer.PlayingState.UnbindFrom(playingState);

View File

@ -23,9 +23,9 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer
[CanBeNull] [CanBeNull]
private ILocalUserPlayInfo localUserInfo { get; set; } private ILocalUserPlayInfo localUserInfo { get; set; }
private readonly IBindable<LocalUserPlayingStates> localUserPlaying = new Bindable<LocalUserPlayingStates>(); private readonly IBindable<LocalUserPlayingState> localUserPlaying = new Bindable<LocalUserPlayingState>();
public override bool PropagatePositionalInputSubTree => localUserPlaying.Value != LocalUserPlayingStates.Playing; public override bool PropagatePositionalInputSubTree => localUserPlaying.Value != LocalUserPlayingState.Playing;
public Bindable<bool> Expanded = new Bindable<bool>(); public Bindable<bool> Expanded = new Bindable<bool>();
@ -67,7 +67,7 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer
TextBox.HoldFocus = false; TextBox.HoldFocus = false;
// only hold focus (after sending a message) during breaks // only hold focus (after sending a message) during breaks
TextBox.ReleaseFocusOnCommit = playing.NewValue == LocalUserPlayingStates.Playing; TextBox.ReleaseFocusOnCommit = playing.NewValue == LocalUserPlayingState.Playing;
}, true); }, true);
Expanded.BindValueChanged(_ => updateExpandedState(), true); Expanded.BindValueChanged(_ => updateExpandedState(), true);

View File

@ -12,6 +12,6 @@ namespace osu.Game.Screens.Play
/// <summary> /// <summary>
/// Whether the local user is currently interacting (playing) with the game in a way that should not be interrupted. /// Whether the local user is currently interacting (playing) with the game in a way that should not be interrupted.
/// </summary> /// </summary>
IBindable<LocalUserPlayingStates> PlayingState { get; } IBindable<LocalUserPlayingState> PlayingState { get; }
} }
} }

View File

@ -3,7 +3,7 @@
namespace osu.Game.Screens.Play namespace osu.Game.Screens.Play
{ {
public enum LocalUserPlayingStates public enum LocalUserPlayingState
{ {
/// <summary> /// <summary>
/// The local player is not current in gameplay. If watching a replay, gameplay always remains in this state. /// The local player is not current in gameplay. If watching a replay, gameplay always remains in this state.

View File

@ -94,7 +94,7 @@ namespace osu.Game.Screens.Play
public IBindable<bool> LocalUserPlaying => localUserPlaying; public IBindable<bool> LocalUserPlaying => localUserPlaying;
private readonly Bindable<bool> localUserPlaying = new Bindable<bool>(); private readonly Bindable<bool> localUserPlaying = new Bindable<bool>();
private readonly Bindable<LocalUserPlayingStates> playingState = new Bindable<LocalUserPlayingStates>(); private readonly Bindable<LocalUserPlayingState> playingState = new Bindable<LocalUserPlayingState>();
public int RestartCount; public int RestartCount;
@ -512,12 +512,12 @@ namespace osu.Game.Screens.Play
bool inBreak = breakTracker.IsBreakTime.Value || DrawableRuleset.IsPaused.Value || GameplayState.HasFailed; bool inBreak = breakTracker.IsBreakTime.Value || DrawableRuleset.IsPaused.Value || GameplayState.HasFailed;
if (inGameplay) if (inGameplay)
playingState.Value = inBreak ? LocalUserPlayingStates.Break : LocalUserPlayingStates.Playing; playingState.Value = inBreak ? LocalUserPlayingState.Break : LocalUserPlayingState.Playing;
else else
playingState.Value = LocalUserPlayingStates.NotPlaying; playingState.Value = LocalUserPlayingState.NotPlaying;
localUserPlaying.Value = playingState.Value == LocalUserPlayingStates.Playing; localUserPlaying.Value = playingState.Value == LocalUserPlayingState.Playing;
OverlayActivationMode.Value = playingState.Value == LocalUserPlayingStates.Playing ? OverlayActivation.Disabled : OverlayActivation.UserTriggered; OverlayActivationMode.Value = playingState.Value == LocalUserPlayingState.Playing ? OverlayActivation.Disabled : OverlayActivation.UserTriggered;
} }
private void updateSampleDisabledState() private void updateSampleDisabledState()
@ -1284,6 +1284,6 @@ namespace osu.Game.Screens.Play
IBindable<bool> ISamplePlaybackDisabler.SamplePlaybackDisabled => samplePlaybackDisabled; IBindable<bool> ISamplePlaybackDisabler.SamplePlaybackDisabled => samplePlaybackDisabled;
public IBindable<LocalUserPlayingStates> PlayingState => playingState; public IBindable<LocalUserPlayingState> PlayingState => playingState;
} }
} }