mirror of https://github.com/ppy/osu
Rename IsGameplay
This commit is contained in:
parent
c8c5998af4
commit
7fff762dfc
|
@ -12,24 +12,24 @@ namespace osu.Game.Input
|
|||
{
|
||||
/// <summary>
|
||||
/// Connects <see cref="OsuSetting.ConfineMouseMode"/> with <see cref="FrameworkSetting.ConfineMouseMode"/>.
|
||||
/// If <see cref="OsuGame.IsGameplay"/> is true, we should also confine the mouse cursor if it has been
|
||||
/// If <see cref="OsuGame.LocalUserPlaying"/> is true, we should also confine the mouse cursor if it has been
|
||||
/// requested with <see cref="OsuConfineMouseMode.DuringGameplay"/>.
|
||||
/// </summary>
|
||||
public class ConfineMouseTracker : Component
|
||||
{
|
||||
private Bindable<ConfineMouseMode> frameworkConfineMode;
|
||||
private Bindable<OsuConfineMouseMode> osuConfineMode;
|
||||
private IBindable<bool> isGameplay;
|
||||
private IBindable<bool> localUserPlaying;
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(OsuGame game, FrameworkConfigManager frameworkConfigManager, OsuConfigManager osuConfigManager)
|
||||
{
|
||||
frameworkConfineMode = frameworkConfigManager.GetBindable<ConfineMouseMode>(FrameworkSetting.ConfineMouseMode);
|
||||
osuConfineMode = osuConfigManager.GetBindable<OsuConfineMouseMode>(OsuSetting.ConfineMouseMode);
|
||||
isGameplay = game.IsGameplay.GetBoundCopy();
|
||||
localUserPlaying = game.LocalUserPlaying.GetBoundCopy();
|
||||
|
||||
osuConfineMode.ValueChanged += _ => updateConfineMode();
|
||||
isGameplay.BindValueChanged(_ => updateConfineMode(), true);
|
||||
localUserPlaying.BindValueChanged(_ => updateConfineMode(), true);
|
||||
}
|
||||
|
||||
private void updateConfineMode()
|
||||
|
@ -49,7 +49,7 @@ private void updateConfineMode()
|
|||
break;
|
||||
|
||||
case OsuConfineMouseMode.DuringGameplay:
|
||||
frameworkConfineMode.Value = isGameplay.Value ? ConfineMouseMode.Always : ConfineMouseMode.Never;
|
||||
frameworkConfineMode.Value = localUserPlaying.Value ? ConfineMouseMode.Always : ConfineMouseMode.Never;
|
||||
break;
|
||||
|
||||
case OsuConfineMouseMode.Always:
|
||||
|
|
|
@ -98,9 +98,9 @@ public class OsuGame : OsuGameBase, IKeyBindingHandler<GlobalAction>
|
|||
public readonly IBindable<OverlayActivation> OverlayActivationMode = new Bindable<OverlayActivation>();
|
||||
|
||||
/// <summary>
|
||||
/// Whether gameplay is currently active.
|
||||
/// Whether the local user is currently interacting with the game in a way that should not be interrupted.
|
||||
/// </summary>
|
||||
public readonly Bindable<bool> IsGameplay = new BindableBool();
|
||||
public readonly Bindable<bool> LocalUserPlaying = new BindableBool();
|
||||
|
||||
protected OsuScreenStack ScreenStack;
|
||||
|
||||
|
|
|
@ -68,7 +68,7 @@ public class Player : ScreenWithBeatmapBackground
|
|||
|
||||
private readonly Bindable<bool> storyboardReplacesBackground = new Bindable<bool>();
|
||||
|
||||
private readonly Bindable<bool> isGameplay = new Bindable<bool>();
|
||||
private readonly Bindable<bool> localUserPlaying = new Bindable<bool>();
|
||||
|
||||
public int RestartCount;
|
||||
|
||||
|
@ -175,7 +175,7 @@ private void load(AudioManager audio, OsuConfigManager config, OsuGameBase game)
|
|||
mouseWheelDisabled = config.GetBindable<bool>(OsuSetting.MouseDisableWheel);
|
||||
|
||||
if (game is OsuGame osuGame)
|
||||
isGameplay.BindTo(osuGame.IsGameplay);
|
||||
localUserPlaying.BindTo(osuGame.LocalUserPlaying);
|
||||
|
||||
DrawableRuleset = ruleset.CreateDrawableRulesetWith(playableBeatmap, Mods.Value);
|
||||
|
||||
|
@ -362,7 +362,7 @@ private void updateGameplayState()
|
|||
{
|
||||
bool inGameplay = !DrawableRuleset.HasReplayLoaded.Value && !DrawableRuleset.IsPaused.Value && !breakTracker.IsBreakTime.Value;
|
||||
OverlayActivationMode.Value = inGameplay ? OverlayActivation.Disabled : OverlayActivation.UserTriggered;
|
||||
isGameplay.Value = inGameplay;
|
||||
localUserPlaying.Value = inGameplay;
|
||||
}
|
||||
|
||||
private void updatePauseOnFocusLostState() =>
|
||||
|
@ -695,8 +695,8 @@ public override bool OnExiting(IScreen next)
|
|||
|
||||
musicController.ResetTrackAdjustments();
|
||||
|
||||
// Ensure we reset the IsGameplay state
|
||||
isGameplay.Value = false;
|
||||
// Ensure we reset the LocalUserPlaying state
|
||||
localUserPlaying.Value = false;
|
||||
|
||||
fadeOut();
|
||||
return base.OnExiting(next);
|
||||
|
|
Loading…
Reference in New Issue