mirror of
https://github.com/osukey/osukey.git
synced 2025-08-05 15:44:04 +09:00
Merge branch 'master' into right-click-circle-delete
This commit is contained in:
@ -11,7 +11,6 @@ using osu.Game.Rulesets.Mods;
|
|||||||
using osu.Game.Rulesets.Osu.Objects;
|
using osu.Game.Rulesets.Osu.Objects;
|
||||||
using osu.Game.Rulesets.Osu.Replays;
|
using osu.Game.Rulesets.Osu.Replays;
|
||||||
using osu.Game.Rulesets.UI;
|
using osu.Game.Rulesets.UI;
|
||||||
using osu.Game.Screens.Play;
|
|
||||||
|
|
||||||
namespace osu.Game.Rulesets.Osu.Mods
|
namespace osu.Game.Rulesets.Osu.Mods
|
||||||
{
|
{
|
||||||
@ -31,7 +30,7 @@ namespace osu.Game.Rulesets.Osu.Mods
|
|||||||
|
|
||||||
private OsuInputManager inputManager;
|
private OsuInputManager inputManager;
|
||||||
|
|
||||||
private GameplayClock gameplayClock;
|
private IFrameStableClock gameplayClock;
|
||||||
|
|
||||||
private List<OsuReplayFrame> replayFrames;
|
private List<OsuReplayFrame> replayFrames;
|
||||||
|
|
||||||
|
@ -9,7 +9,6 @@ using osu.Framework.Testing;
|
|||||||
using osu.Game.Rulesets;
|
using osu.Game.Rulesets;
|
||||||
using osu.Game.Rulesets.Osu;
|
using osu.Game.Rulesets.Osu;
|
||||||
using osu.Game.Rulesets.Osu.Objects.Drawables;
|
using osu.Game.Rulesets.Osu.Objects.Drawables;
|
||||||
using osu.Game.Rulesets.UI;
|
|
||||||
using osu.Game.Screens.Play;
|
using osu.Game.Screens.Play;
|
||||||
using osu.Game.Skinning;
|
using osu.Game.Skinning;
|
||||||
|
|
||||||
@ -22,11 +21,11 @@ namespace osu.Game.Tests.Visual.Gameplay
|
|||||||
{
|
{
|
||||||
DrawableSlider slider = null;
|
DrawableSlider slider = null;
|
||||||
DrawableSample[] samples = null;
|
DrawableSample[] samples = null;
|
||||||
ISamplePlaybackDisabler gameplayClock = null;
|
ISamplePlaybackDisabler sampleDisabler = null;
|
||||||
|
|
||||||
AddStep("get variables", () =>
|
AddStep("get variables", () =>
|
||||||
{
|
{
|
||||||
gameplayClock = Player.ChildrenOfType<FrameStabilityContainer>().First();
|
sampleDisabler = Player;
|
||||||
slider = Player.ChildrenOfType<DrawableSlider>().OrderBy(s => s.HitObject.StartTime).First();
|
slider = Player.ChildrenOfType<DrawableSlider>().OrderBy(s => s.HitObject.StartTime).First();
|
||||||
samples = slider.ChildrenOfType<DrawableSample>().ToArray();
|
samples = slider.ChildrenOfType<DrawableSample>().ToArray();
|
||||||
});
|
});
|
||||||
@ -43,16 +42,16 @@ namespace osu.Game.Tests.Visual.Gameplay
|
|||||||
return true;
|
return true;
|
||||||
});
|
});
|
||||||
|
|
||||||
AddAssert("sample playback disabled", () => gameplayClock.SamplePlaybackDisabled.Value);
|
AddAssert("sample playback disabled", () => sampleDisabler.SamplePlaybackDisabled.Value);
|
||||||
|
|
||||||
// because we are in frame stable context, it's quite likely that not all samples are "played" at this point.
|
// because we are in frame stable context, it's quite likely that not all samples are "played" at this point.
|
||||||
// the important thing is that at least one started, and that sample has since stopped.
|
// the important thing is that at least one started, and that sample has since stopped.
|
||||||
AddAssert("all looping samples stopped immediately", () => allStopped(allLoopingSounds));
|
AddAssert("all looping samples stopped immediately", () => allStopped(allLoopingSounds));
|
||||||
AddUntilStep("all samples stopped eventually", () => allStopped(allSounds));
|
AddUntilStep("all samples stopped eventually", () => allStopped(allSounds));
|
||||||
|
|
||||||
AddAssert("sample playback still disabled", () => gameplayClock.SamplePlaybackDisabled.Value);
|
AddAssert("sample playback still disabled", () => sampleDisabler.SamplePlaybackDisabled.Value);
|
||||||
|
|
||||||
AddUntilStep("seek finished, sample playback enabled", () => !gameplayClock.SamplePlaybackDisabled.Value);
|
AddUntilStep("seek finished, sample playback enabled", () => !sampleDisabler.SamplePlaybackDisabled.Value);
|
||||||
AddUntilStep("any sample is playing", () => Player.ChildrenOfType<PausableSkinnableSound>().Any(s => s.IsPlaying));
|
AddUntilStep("any sample is playing", () => Player.ChildrenOfType<PausableSkinnableSound>().Any(s => s.IsPlaying));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -65,7 +65,7 @@ namespace osu.Game.Rulesets.UI
|
|||||||
|
|
||||||
public override Container FrameStableComponents { get; } = new Container { RelativeSizeAxes = Axes.Both };
|
public override Container FrameStableComponents { get; } = new Container { RelativeSizeAxes = Axes.Both };
|
||||||
|
|
||||||
public override GameplayClock FrameStableClock => frameStabilityContainer.GameplayClock;
|
public override IFrameStableClock FrameStableClock => frameStabilityContainer.FrameStableClock;
|
||||||
|
|
||||||
private bool frameStablePlayback = true;
|
private bool frameStablePlayback = true;
|
||||||
|
|
||||||
@ -404,7 +404,7 @@ namespace osu.Game.Rulesets.UI
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// The frame-stable clock which is being used for playfield display.
|
/// The frame-stable clock which is being used for playfield display.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public abstract GameplayClock FrameStableClock { get; }
|
public abstract IFrameStableClock FrameStableClock { get; }
|
||||||
|
|
||||||
/// <summary>~
|
/// <summary>~
|
||||||
/// The associated ruleset.
|
/// The associated ruleset.
|
||||||
|
@ -18,11 +18,8 @@ namespace osu.Game.Rulesets.UI
|
|||||||
/// A container which consumes a parent gameplay clock and standardises frame counts for children.
|
/// A container which consumes a parent gameplay clock and standardises frame counts for children.
|
||||||
/// Will ensure a minimum of 50 frames per clock second is maintained, regardless of any system lag or seeks.
|
/// Will ensure a minimum of 50 frames per clock second is maintained, regardless of any system lag or seeks.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[Cached(typeof(ISamplePlaybackDisabler))]
|
public class FrameStabilityContainer : Container, IHasReplayHandler
|
||||||
public class FrameStabilityContainer : Container, IHasReplayHandler, ISamplePlaybackDisabler
|
|
||||||
{
|
{
|
||||||
private readonly Bindable<bool> samplePlaybackDisabled = new Bindable<bool>();
|
|
||||||
|
|
||||||
private readonly double gameplayStartTime;
|
private readonly double gameplayStartTime;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -35,16 +32,16 @@ namespace osu.Game.Rulesets.UI
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
internal bool FrameStablePlayback = true;
|
internal bool FrameStablePlayback = true;
|
||||||
|
|
||||||
public GameplayClock GameplayClock => stabilityGameplayClock;
|
public IFrameStableClock FrameStableClock => frameStableClock;
|
||||||
|
|
||||||
[Cached(typeof(GameplayClock))]
|
[Cached(typeof(GameplayClock))]
|
||||||
private readonly StabilityGameplayClock stabilityGameplayClock;
|
private readonly FrameStabilityClock frameStableClock;
|
||||||
|
|
||||||
public FrameStabilityContainer(double gameplayStartTime = double.MinValue)
|
public FrameStabilityContainer(double gameplayStartTime = double.MinValue)
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.Both;
|
RelativeSizeAxes = Axes.Both;
|
||||||
|
|
||||||
stabilityGameplayClock = new StabilityGameplayClock(framedClock = new FramedClock(manualClock = new ManualClock()));
|
frameStableClock = new FrameStabilityClock(framedClock = new FramedClock(manualClock = new ManualClock()));
|
||||||
|
|
||||||
this.gameplayStartTime = gameplayStartTime;
|
this.gameplayStartTime = gameplayStartTime;
|
||||||
}
|
}
|
||||||
@ -65,12 +62,9 @@ namespace osu.Game.Rulesets.UI
|
|||||||
{
|
{
|
||||||
if (clock != null)
|
if (clock != null)
|
||||||
{
|
{
|
||||||
parentGameplayClock = stabilityGameplayClock.ParentGameplayClock = clock;
|
parentGameplayClock = frameStableClock.ParentGameplayClock = clock;
|
||||||
GameplayClock.IsPaused.BindTo(clock.IsPaused);
|
frameStableClock.IsPaused.BindTo(clock.IsPaused);
|
||||||
}
|
}
|
||||||
|
|
||||||
// this is a bit temporary. should really be done inside of GameplayClock (but requires large structural changes).
|
|
||||||
stabilityGameplayClock.ParentSampleDisabler = sampleDisabler;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void LoadComplete()
|
protected override void LoadComplete()
|
||||||
@ -102,9 +96,7 @@ namespace osu.Game.Rulesets.UI
|
|||||||
public override bool UpdateSubTree()
|
public override bool UpdateSubTree()
|
||||||
{
|
{
|
||||||
requireMoreUpdateLoops = true;
|
requireMoreUpdateLoops = true;
|
||||||
validState = !GameplayClock.IsPaused.Value;
|
validState = !frameStableClock.IsPaused.Value;
|
||||||
|
|
||||||
samplePlaybackDisabled.Value = stabilityGameplayClock.ShouldDisableSamplePlayback;
|
|
||||||
|
|
||||||
int loops = 0;
|
int loops = 0;
|
||||||
|
|
||||||
@ -205,7 +197,11 @@ namespace osu.Game.Rulesets.UI
|
|||||||
manualClock.Rate = Math.Abs(parentGameplayClock.Rate) * direction;
|
manualClock.Rate = Math.Abs(parentGameplayClock.Rate) * direction;
|
||||||
manualClock.IsRunning = parentGameplayClock.IsRunning;
|
manualClock.IsRunning = parentGameplayClock.IsRunning;
|
||||||
|
|
||||||
requireMoreUpdateLoops |= manualClock.CurrentTime != parentGameplayClock.CurrentTime;
|
double timeBehind = Math.Abs(manualClock.CurrentTime - parentGameplayClock.CurrentTime);
|
||||||
|
|
||||||
|
requireMoreUpdateLoops |= timeBehind != 0;
|
||||||
|
|
||||||
|
frameStableClock.IsCatchingUp.Value = timeBehind > 200;
|
||||||
|
|
||||||
// The manual clock time has changed in the above code. The framed clock now needs to be updated
|
// The manual clock time has changed in the above code. The framed clock now needs to be updated
|
||||||
// to ensure that the its time is valid for our children before input is processed
|
// to ensure that the its time is valid for our children before input is processed
|
||||||
@ -222,32 +218,26 @@ namespace osu.Game.Rulesets.UI
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Clock = GameplayClock;
|
Clock = frameStableClock;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public ReplayInputHandler ReplayInputHandler { get; set; }
|
public ReplayInputHandler ReplayInputHandler { get; set; }
|
||||||
|
|
||||||
IBindable<bool> ISamplePlaybackDisabler.SamplePlaybackDisabled => samplePlaybackDisabled;
|
private class FrameStabilityClock : GameplayClock, IFrameStableClock
|
||||||
|
|
||||||
private class StabilityGameplayClock : GameplayClock
|
|
||||||
{
|
{
|
||||||
public GameplayClock ParentGameplayClock;
|
public GameplayClock ParentGameplayClock;
|
||||||
|
|
||||||
public ISamplePlaybackDisabler ParentSampleDisabler;
|
public readonly Bindable<bool> IsCatchingUp = new Bindable<bool>();
|
||||||
|
|
||||||
public override IEnumerable<Bindable<double>> NonGameplayAdjustments => ParentGameplayClock?.NonGameplayAdjustments ?? Enumerable.Empty<Bindable<double>>();
|
public override IEnumerable<Bindable<double>> NonGameplayAdjustments => ParentGameplayClock?.NonGameplayAdjustments ?? Enumerable.Empty<Bindable<double>>();
|
||||||
|
|
||||||
public StabilityGameplayClock(FramedClock underlyingClock)
|
public FrameStabilityClock(FramedClock underlyingClock)
|
||||||
: base(underlyingClock)
|
: base(underlyingClock)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
public override bool ShouldDisableSamplePlayback =>
|
IBindable<bool> IFrameStableClock.IsCatchingUp => IsCatchingUp;
|
||||||
// handle the case where playback is catching up to real-time.
|
|
||||||
base.ShouldDisableSamplePlayback
|
|
||||||
|| ParentSampleDisabler?.SamplePlaybackDisabled.Value == true
|
|
||||||
|| (ParentGameplayClock != null && Math.Abs(CurrentTime - ParentGameplayClock.CurrentTime) > 200);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
13
osu.Game/Rulesets/UI/IFrameStableClock.cs
Normal file
13
osu.Game/Rulesets/UI/IFrameStableClock.cs
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
||||||
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
|
using osu.Framework.Bindables;
|
||||||
|
using osu.Framework.Timing;
|
||||||
|
|
||||||
|
namespace osu.Game.Rulesets.UI
|
||||||
|
{
|
||||||
|
public interface IFrameStableClock : IFrameBasedClock
|
||||||
|
{
|
||||||
|
IBindable<bool> IsCatchingUp { get; }
|
||||||
|
}
|
||||||
|
}
|
@ -43,8 +43,9 @@ using osuTK.Input;
|
|||||||
namespace osu.Game.Screens.Edit
|
namespace osu.Game.Screens.Edit
|
||||||
{
|
{
|
||||||
[Cached(typeof(IBeatSnapProvider))]
|
[Cached(typeof(IBeatSnapProvider))]
|
||||||
|
[Cached(typeof(ISamplePlaybackDisabler))]
|
||||||
[Cached]
|
[Cached]
|
||||||
public class Editor : ScreenWithBeatmapBackground, IKeyBindingHandler<GlobalAction>, IKeyBindingHandler<PlatformAction>, IBeatSnapProvider
|
public class Editor : ScreenWithBeatmapBackground, IKeyBindingHandler<GlobalAction>, IKeyBindingHandler<PlatformAction>, IBeatSnapProvider, ISamplePlaybackDisabler
|
||||||
{
|
{
|
||||||
public override float BackgroundParallaxAmount => 0.1f;
|
public override float BackgroundParallaxAmount => 0.1f;
|
||||||
|
|
||||||
@ -64,6 +65,10 @@ namespace osu.Game.Screens.Edit
|
|||||||
[Resolved(canBeNull: true)]
|
[Resolved(canBeNull: true)]
|
||||||
private DialogOverlay dialogOverlay { get; set; }
|
private DialogOverlay dialogOverlay { get; set; }
|
||||||
|
|
||||||
|
public IBindable<bool> SamplePlaybackDisabled => samplePlaybackDisabled;
|
||||||
|
|
||||||
|
private readonly Bindable<bool> samplePlaybackDisabled = new Bindable<bool>();
|
||||||
|
|
||||||
private bool exitConfirmed;
|
private bool exitConfirmed;
|
||||||
|
|
||||||
private string lastSavedHash;
|
private string lastSavedHash;
|
||||||
@ -109,9 +114,10 @@ namespace osu.Game.Screens.Edit
|
|||||||
UpdateClockSource();
|
UpdateClockSource();
|
||||||
|
|
||||||
dependencies.CacheAs(clock);
|
dependencies.CacheAs(clock);
|
||||||
dependencies.CacheAs<ISamplePlaybackDisabler>(clock);
|
|
||||||
AddInternal(clock);
|
AddInternal(clock);
|
||||||
|
|
||||||
|
clock.SeekingOrStopped.BindValueChanged(_ => updateSampleDisabledState());
|
||||||
|
|
||||||
// todo: remove caching of this and consume via editorBeatmap?
|
// todo: remove caching of this and consume via editorBeatmap?
|
||||||
dependencies.Cache(beatDivisor);
|
dependencies.Cache(beatDivisor);
|
||||||
|
|
||||||
@ -557,40 +563,52 @@ namespace osu.Game.Screens.Edit
|
|||||||
.ScaleTo(0.98f, 200, Easing.OutQuint)
|
.ScaleTo(0.98f, 200, Easing.OutQuint)
|
||||||
.FadeOut(200, Easing.OutQuint);
|
.FadeOut(200, Easing.OutQuint);
|
||||||
|
|
||||||
if ((currentScreen = screenContainer.SingleOrDefault(s => s.Type == e.NewValue)) != null)
|
try
|
||||||
{
|
{
|
||||||
screenContainer.ChangeChildDepth(currentScreen, lastScreen?.Depth + 1 ?? 0);
|
if ((currentScreen = screenContainer.SingleOrDefault(s => s.Type == e.NewValue)) != null)
|
||||||
|
{
|
||||||
|
screenContainer.ChangeChildDepth(currentScreen, lastScreen?.Depth + 1 ?? 0);
|
||||||
|
|
||||||
currentScreen
|
currentScreen
|
||||||
.ScaleTo(1, 200, Easing.OutQuint)
|
.ScaleTo(1, 200, Easing.OutQuint)
|
||||||
.FadeIn(200, Easing.OutQuint);
|
.FadeIn(200, Easing.OutQuint);
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
switch (e.NewValue)
|
||||||
|
{
|
||||||
|
case EditorScreenMode.SongSetup:
|
||||||
|
currentScreen = new SetupScreen();
|
||||||
|
break;
|
||||||
|
|
||||||
|
case EditorScreenMode.Compose:
|
||||||
|
currentScreen = new ComposeScreen();
|
||||||
|
break;
|
||||||
|
|
||||||
|
case EditorScreenMode.Design:
|
||||||
|
currentScreen = new DesignScreen();
|
||||||
|
break;
|
||||||
|
|
||||||
|
case EditorScreenMode.Timing:
|
||||||
|
currentScreen = new TimingScreen();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
LoadComponentAsync(currentScreen, newScreen =>
|
||||||
|
{
|
||||||
|
if (newScreen == currentScreen)
|
||||||
|
screenContainer.Add(newScreen);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
finally
|
||||||
switch (e.NewValue)
|
|
||||||
{
|
{
|
||||||
case EditorScreenMode.SongSetup:
|
updateSampleDisabledState();
|
||||||
currentScreen = new SetupScreen();
|
|
||||||
break;
|
|
||||||
|
|
||||||
case EditorScreenMode.Compose:
|
|
||||||
currentScreen = new ComposeScreen();
|
|
||||||
break;
|
|
||||||
|
|
||||||
case EditorScreenMode.Design:
|
|
||||||
currentScreen = new DesignScreen();
|
|
||||||
break;
|
|
||||||
|
|
||||||
case EditorScreenMode.Timing:
|
|
||||||
currentScreen = new TimingScreen();
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
LoadComponentAsync(currentScreen, newScreen =>
|
private void updateSampleDisabledState()
|
||||||
{
|
{
|
||||||
if (newScreen == currentScreen)
|
samplePlaybackDisabled.Value = clock.SeekingOrStopped.Value || !(currentScreen is ComposeScreen);
|
||||||
screenContainer.Add(newScreen);
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void seek(UIEvent e, int direction)
|
private void seek(UIEvent e, int direction)
|
||||||
|
@ -11,14 +11,13 @@ using osu.Framework.Timing;
|
|||||||
using osu.Framework.Utils;
|
using osu.Framework.Utils;
|
||||||
using osu.Game.Beatmaps;
|
using osu.Game.Beatmaps;
|
||||||
using osu.Game.Beatmaps.ControlPoints;
|
using osu.Game.Beatmaps.ControlPoints;
|
||||||
using osu.Game.Screens.Play;
|
|
||||||
|
|
||||||
namespace osu.Game.Screens.Edit
|
namespace osu.Game.Screens.Edit
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// A decoupled clock which adds editor-specific functionality, such as snapping to a user-defined beat divisor.
|
/// A decoupled clock which adds editor-specific functionality, such as snapping to a user-defined beat divisor.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class EditorClock : Component, IFrameBasedClock, IAdjustableClock, ISourceChangeableClock, ISamplePlaybackDisabler
|
public class EditorClock : Component, IFrameBasedClock, IAdjustableClock, ISourceChangeableClock
|
||||||
{
|
{
|
||||||
public IBindable<Track> Track => track;
|
public IBindable<Track> Track => track;
|
||||||
|
|
||||||
@ -32,9 +31,9 @@ namespace osu.Game.Screens.Edit
|
|||||||
|
|
||||||
private readonly DecoupleableInterpolatingFramedClock underlyingClock;
|
private readonly DecoupleableInterpolatingFramedClock underlyingClock;
|
||||||
|
|
||||||
public IBindable<bool> SamplePlaybackDisabled => samplePlaybackDisabled;
|
public IBindable<bool> SeekingOrStopped => seekingOrStopped;
|
||||||
|
|
||||||
private readonly Bindable<bool> samplePlaybackDisabled = new Bindable<bool>();
|
private readonly Bindable<bool> seekingOrStopped = new Bindable<bool>(true);
|
||||||
|
|
||||||
public EditorClock(WorkingBeatmap beatmap, BindableBeatDivisor beatDivisor)
|
public EditorClock(WorkingBeatmap beatmap, BindableBeatDivisor beatDivisor)
|
||||||
: this(beatmap.Beatmap.ControlPointInfo, beatmap.Track.Length, beatDivisor)
|
: this(beatmap.Beatmap.ControlPointInfo, beatmap.Track.Length, beatDivisor)
|
||||||
@ -171,13 +170,13 @@ namespace osu.Game.Screens.Edit
|
|||||||
|
|
||||||
public void Stop()
|
public void Stop()
|
||||||
{
|
{
|
||||||
samplePlaybackDisabled.Value = true;
|
seekingOrStopped.Value = true;
|
||||||
underlyingClock.Stop();
|
underlyingClock.Stop();
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool Seek(double position)
|
public bool Seek(double position)
|
||||||
{
|
{
|
||||||
samplePlaybackDisabled.Value = true;
|
seekingOrStopped.Value = true;
|
||||||
|
|
||||||
ClearTransforms();
|
ClearTransforms();
|
||||||
return underlyingClock.Seek(position);
|
return underlyingClock.Seek(position);
|
||||||
@ -228,7 +227,7 @@ namespace osu.Game.Screens.Edit
|
|||||||
|
|
||||||
private void updateSeekingState()
|
private void updateSeekingState()
|
||||||
{
|
{
|
||||||
if (samplePlaybackDisabled.Value)
|
if (seekingOrStopped.Value)
|
||||||
{
|
{
|
||||||
if (track.Value?.IsRunning != true)
|
if (track.Value?.IsRunning != true)
|
||||||
{
|
{
|
||||||
@ -240,13 +239,13 @@ namespace osu.Game.Screens.Edit
|
|||||||
// we are either running a seek tween or doing an immediate seek.
|
// we are either running a seek tween or doing an immediate seek.
|
||||||
// in the case of an immediate seek the seeking bool will be set to false after one update.
|
// in the case of an immediate seek the seeking bool will be set to false after one update.
|
||||||
// this allows for silencing hit sounds and the likes.
|
// this allows for silencing hit sounds and the likes.
|
||||||
samplePlaybackDisabled.Value = Transforms.Any();
|
seekingOrStopped.Value = Transforms.Any();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SeekTo(double seekDestination)
|
public void SeekTo(double seekDestination)
|
||||||
{
|
{
|
||||||
samplePlaybackDisabled.Value = true;
|
seekingOrStopped.Value = true;
|
||||||
|
|
||||||
if (IsRunning)
|
if (IsRunning)
|
||||||
Seek(seekDestination);
|
Seek(seekDestination);
|
||||||
|
@ -177,6 +177,9 @@ namespace osu.Game.Screens.Edit.Timing
|
|||||||
|
|
||||||
private readonly Box hoveredBackground;
|
private readonly Box hoveredBackground;
|
||||||
|
|
||||||
|
[Resolved]
|
||||||
|
private EditorClock clock { get; set; }
|
||||||
|
|
||||||
[Resolved]
|
[Resolved]
|
||||||
private Bindable<ControlPointGroup> selectedGroup { get; set; }
|
private Bindable<ControlPointGroup> selectedGroup { get; set; }
|
||||||
|
|
||||||
@ -200,7 +203,11 @@ namespace osu.Game.Screens.Edit.Timing
|
|||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
Action = () => selectedGroup.Value = controlGroup;
|
Action = () =>
|
||||||
|
{
|
||||||
|
selectedGroup.Value = controlGroup;
|
||||||
|
clock.SeekTo(controlGroup.Time);
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
private Color4 colourHover;
|
private Color4 colourHover;
|
||||||
|
@ -22,9 +22,6 @@ namespace osu.Game.Screens.Edit.Timing
|
|||||||
[Cached]
|
[Cached]
|
||||||
private Bindable<ControlPointGroup> selectedGroup = new Bindable<ControlPointGroup>();
|
private Bindable<ControlPointGroup> selectedGroup = new Bindable<ControlPointGroup>();
|
||||||
|
|
||||||
[Resolved]
|
|
||||||
private EditorClock clock { get; set; }
|
|
||||||
|
|
||||||
public TimingScreen()
|
public TimingScreen()
|
||||||
: base(EditorScreenMode.Timing)
|
: base(EditorScreenMode.Timing)
|
||||||
{
|
{
|
||||||
@ -48,17 +45,6 @@ namespace osu.Game.Screens.Edit.Timing
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
protected override void LoadComplete()
|
|
||||||
{
|
|
||||||
base.LoadComplete();
|
|
||||||
|
|
||||||
selectedGroup.BindValueChanged(selected =>
|
|
||||||
{
|
|
||||||
if (selected.NewValue != null)
|
|
||||||
clock.SeekTo(selected.NewValue.Time);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override void OnTimelineLoaded(TimelineArea timelineArea)
|
protected override void OnTimelineLoaded(TimelineArea timelineArea)
|
||||||
{
|
{
|
||||||
base.OnTimelineLoaded(timelineArea);
|
base.OnTimelineLoaded(timelineArea);
|
||||||
|
@ -61,11 +61,6 @@ namespace osu.Game.Screens.Play
|
|||||||
|
|
||||||
public bool IsRunning => underlyingClock.IsRunning;
|
public bool IsRunning => underlyingClock.IsRunning;
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Whether nested samples supporting the <see cref="ISamplePlaybackDisabler"/> interface should be paused.
|
|
||||||
/// </summary>
|
|
||||||
public virtual bool ShouldDisableSamplePlayback => IsPaused.Value;
|
|
||||||
|
|
||||||
public void ProcessFrame()
|
public void ProcessFrame()
|
||||||
{
|
{
|
||||||
// intentionally not updating the underlying clock (handled externally).
|
// intentionally not updating the underlying clock (handled externally).
|
||||||
|
@ -241,8 +241,11 @@ namespace osu.Game.Screens.Play
|
|||||||
DrawableRuleset.IsPaused.BindValueChanged(paused =>
|
DrawableRuleset.IsPaused.BindValueChanged(paused =>
|
||||||
{
|
{
|
||||||
updateGameplayState();
|
updateGameplayState();
|
||||||
samplePlaybackDisabled.Value = paused.NewValue;
|
updateSampleDisabledState();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
DrawableRuleset.FrameStableClock.IsCatchingUp.BindValueChanged(_ => updateSampleDisabledState());
|
||||||
|
|
||||||
DrawableRuleset.HasReplayLoaded.BindValueChanged(_ => updateGameplayState());
|
DrawableRuleset.HasReplayLoaded.BindValueChanged(_ => updateGameplayState());
|
||||||
|
|
||||||
DrawableRuleset.HasReplayLoaded.BindValueChanged(_ => updatePauseOnFocusLostState(), true);
|
DrawableRuleset.HasReplayLoaded.BindValueChanged(_ => updatePauseOnFocusLostState(), true);
|
||||||
@ -384,6 +387,11 @@ namespace osu.Game.Screens.Play
|
|||||||
LocalUserPlaying.Value = inGameplay;
|
LocalUserPlaying.Value = inGameplay;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void updateSampleDisabledState()
|
||||||
|
{
|
||||||
|
samplePlaybackDisabled.Value = DrawableRuleset.FrameStableClock.IsCatchingUp.Value || GameplayClockContainer.GameplayClock.IsPaused.Value;
|
||||||
|
}
|
||||||
|
|
||||||
private void updatePauseOnFocusLostState() =>
|
private void updatePauseOnFocusLostState() =>
|
||||||
HUDOverlay.HoldToQuit.PauseOnFocusLost = PauseOnFocusLost
|
HUDOverlay.HoldToQuit.PauseOnFocusLost = PauseOnFocusLost
|
||||||
&& !DrawableRuleset.HasReplayLoaded.Value
|
&& !DrawableRuleset.HasReplayLoaded.Value
|
||||||
|
Reference in New Issue
Block a user