diff --git a/osu.Game/Rulesets/UI/RulesetContainer.cs b/osu.Game/Rulesets/UI/RulesetContainer.cs
index 626b56ad67..bb4466208b 100644
--- a/osu.Game/Rulesets/UI/RulesetContainer.cs
+++ b/osu.Game/Rulesets/UI/RulesetContainer.cs
@@ -13,6 +13,7 @@ using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
+using osu.Framework.Configuration;
using osu.Framework.Graphics.Cursor;
using osu.Framework.Input;
using osu.Game.Rulesets.Replays;
@@ -45,9 +46,9 @@ namespace osu.Game.Rulesets.UI
public PassThroughInputManager KeyBindingInputManager;
///
- /// Whether we have a replay loaded currently.
+ /// Whether a replay is currently loaded.
///
- public bool HasReplayLoaded => ReplayInputManager?.ReplayInputHandler != null;
+ public readonly BindableBool HasReplayLoaded = new BindableBool();
public abstract IEnumerable Objects { get; }
@@ -99,6 +100,8 @@ namespace osu.Game.Rulesets.UI
Replay = replay;
ReplayInputManager.ReplayInputHandler = replay != null ? CreateReplayInputHandler(replay) : null;
+
+ HasReplayLoaded.Value = ReplayInputManager.ReplayInputHandler != null;
}
diff --git a/osu.Game/Screens/Play/HUDOverlay.cs b/osu.Game/Screens/Play/HUDOverlay.cs
index 721b5344ff..95d13cea3a 100644
--- a/osu.Game/Screens/Play/HUDOverlay.cs
+++ b/osu.Game/Screens/Play/HUDOverlay.cs
@@ -35,7 +35,7 @@ namespace osu.Game.Screens.Play
public readonly ReplaySettingsOverlay ReplaySettingsOverlay;
private Bindable showHud;
- private bool replayLoaded;
+ private readonly BindableBool replayLoaded = new BindableBool();
private static bool hasShownNotificationOnce;
@@ -59,6 +59,24 @@ namespace osu.Game.Screens.Play
ReplaySettingsOverlay = CreateReplaySettingsOverlay(),
}
});
+
+ replayLoaded.ValueChanged += replayLoadedValueChanged;
+ }
+
+ private void replayLoadedValueChanged(bool loaded)
+ {
+ ReplaySettingsOverlay.ReplayLoaded = loaded;
+
+ if (loaded)
+ {
+ ReplaySettingsOverlay.Show();
+ ModDisplay.FadeIn(200);
+ }
+ else
+ {
+ ReplaySettingsOverlay.Hide();
+ ModDisplay.Delay(2000).FadeOut(200);
+ }
}
[BackgroundDependencyLoader(true)]
@@ -95,16 +113,10 @@ namespace osu.Game.Screens.Play
{
(rulesetContainer.KeyBindingInputManager as ICanAttachKeyCounter)?.Attach(KeyCounter);
- replayLoaded = rulesetContainer.HasReplayLoaded;
+ replayLoaded.BindTo(rulesetContainer.HasReplayLoaded);
+ replayLoaded.TriggerChange();
- ReplaySettingsOverlay.ReplayLoaded = replayLoaded;
-
- // in the case a replay isn't loaded, we want some elements to only appear briefly.
- if (!replayLoaded)
- {
- ReplaySettingsOverlay.Hide();
- ModDisplay.Delay(2000).FadeOut(200);
- }
+ Progress.BindRulestContainer(rulesetContainer);
}
protected override bool OnKeyDown(InputState state, KeyDownEventArgs args)
diff --git a/osu.Game/Screens/Play/Player.cs b/osu.Game/Screens/Play/Player.cs
index 31d9fac2ad..8d26d63d41 100644
--- a/osu.Game/Screens/Play/Player.cs
+++ b/osu.Game/Screens/Play/Player.cs
@@ -52,7 +52,7 @@ namespace osu.Game.Screens.Play
public int RestartCount;
public CursorContainer Cursor => RulesetContainer.Cursor;
- public bool ProvidingUserCursor => RulesetContainer?.Cursor != null && !RulesetContainer.HasReplayLoaded;
+ public bool ProvidingUserCursor => RulesetContainer?.Cursor != null && !RulesetContainer.HasReplayLoaded.Value;
private IAdjustableClock adjustableSourceClock;
private FramedOffsetClock offsetClock;
@@ -226,7 +226,6 @@ namespace osu.Game.Screens.Play
hudOverlay.Progress.Objects = RulesetContainer.Objects;
hudOverlay.Progress.AudioClock = decoupledClock;
- hudOverlay.Progress.AllowSeeking = RulesetContainer.HasReplayLoaded;
hudOverlay.Progress.OnSeek = pos => decoupledClock.Seek(pos);
hudOverlay.ModDisplay.Current.BindTo(working.Mods);
diff --git a/osu.Game/Screens/Play/SongProgress.cs b/osu.Game/Screens/Play/SongProgress.cs
index 897fe4bba7..b367d33c6d 100644
--- a/osu.Game/Screens/Play/SongProgress.cs
+++ b/osu.Game/Screens/Play/SongProgress.cs
@@ -9,9 +9,12 @@ using System.Collections.Generic;
using osu.Game.Graphics;
using osu.Framework.Allocation;
using System.Linq;
+using osu.Framework.Configuration;
using osu.Framework.Timing;
using osu.Game.Rulesets.Objects;
using osu.Game.Rulesets.Objects.Types;
+using osu.Game.Rulesets.UI;
+
namespace osu.Game.Screens.Play
{
public class SongProgress : OverlayContainer
@@ -53,6 +56,8 @@ namespace osu.Game.Screens.Play
}
}
+ private readonly BindableBool replayLoaded = new BindableBool();
+
[BackgroundDependencyLoader]
private void load(OsuColour colours)
{
@@ -92,6 +97,8 @@ namespace osu.Game.Screens.Play
OnSeek = position => OnSeek?.Invoke(position),
},
};
+
+ replayLoaded.ValueChanged += v => AllowSeeking = v;
}
protected override void LoadComplete()
@@ -99,6 +106,12 @@ namespace osu.Game.Screens.Play
State = Visibility.Visible;
}
+ public void BindRulestContainer(RulesetContainer rulesetContainer)
+ {
+ replayLoaded.BindTo(rulesetContainer.HasReplayLoaded);
+ replayLoaded.TriggerChange();
+ }
+
private bool allowSeeking;
public bool AllowSeeking