1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-15 15:12:57 +08:00

Avoid new bindable requirement

This commit is contained in:
Dean Herbert 2021-08-16 16:27:19 +09:00
parent 81480ac4fc
commit 838bcc51b2
2 changed files with 10 additions and 13 deletions

View File

@ -77,10 +77,6 @@ namespace osu.Game.Screens.Play
protected readonly Bindable<bool> LocalUserPlaying = new Bindable<bool>();
private readonly Bindable<bool> allowUserSeeking = new Bindable<bool>();
public IBindable<bool> AllowUserSeeking => allowUserSeeking;
public int RestartCount;
[Resolved]
@ -273,13 +269,7 @@ namespace osu.Game.Screens.Play
DrawableRuleset.FrameStableClock.IsCatchingUp.BindValueChanged(_ => updateSampleDisabledState());
DrawableRuleset.HasReplayLoaded.BindValueChanged(r =>
{
if (Configuration.AllowSeeking)
allowUserSeeking.Value = r.NewValue;
updateGameplayState();
});
DrawableRuleset.HasReplayLoaded.BindValueChanged(_ => updateGameplayState());
// bind clock into components that require it
DrawableRuleset.IsPaused.BindTo(GameplayClockContainer.IsPaused);
@ -592,7 +582,13 @@ namespace osu.Game.Screens.Play
/// Seek to a specific time in gameplay.
/// </summary>
/// <param name="time">The destination time to seek to.</param>
public void Seek(double time) => GameplayClockContainer.Seek(time);
public void Seek(double time)
{
if (!Configuration.AllowSeeking)
throw new InvalidOperationException($"Seeking has ben disabled by the current {nameof(Configuration)}.");
GameplayClockContainer.Seek(time);
}
private ScheduledDelegate frameStablePlaybackResetDelegate;

View File

@ -119,7 +119,8 @@ namespace osu.Game.Screens.Play
if (drawableRuleset != null)
{
((IBindable<bool>)AllowSeeking).BindTo(player.AllowUserSeeking);
if (player?.Configuration.AllowSeeking == true)
((IBindable<bool>)AllowSeeking).BindTo(drawableRuleset.HasReplayLoaded);
referenceClock = drawableRuleset.FrameStableClock;
Objects = drawableRuleset.Objects;