mirror of
https://github.com/ppy/osu
synced 2024-12-15 19:36:34 +00:00
Merge pull request #10952 from peppy/replay-pausing-support
Add ability to pause/resume replay playback
This commit is contained in:
commit
5a393b153b
@ -69,6 +69,7 @@ namespace osu.Game.Input.Bindings
|
||||
new KeyBinding(new[] { InputKey.Control, InputKey.Plus }, GlobalAction.IncreaseScrollSpeed),
|
||||
new KeyBinding(new[] { InputKey.Control, InputKey.Minus }, GlobalAction.DecreaseScrollSpeed),
|
||||
new KeyBinding(InputKey.MouseMiddle, GlobalAction.PauseGameplay),
|
||||
new KeyBinding(InputKey.Space, GlobalAction.TogglePauseReplay),
|
||||
new KeyBinding(InputKey.Control, GlobalAction.HoldForHUD),
|
||||
};
|
||||
|
||||
@ -196,5 +197,8 @@ namespace osu.Game.Input.Bindings
|
||||
|
||||
[Description("Random skin")]
|
||||
RandomSkin,
|
||||
|
||||
[Description("Pause / resume replay")]
|
||||
TogglePauseReplay,
|
||||
}
|
||||
}
|
||||
|
@ -339,7 +339,11 @@ namespace osu.Game.Screens.Play
|
||||
AlwaysVisible = { BindTarget = DrawableRuleset.HasReplayLoaded },
|
||||
IsCounting = false
|
||||
},
|
||||
RequestSeek = GameplayClockContainer.Seek,
|
||||
RequestSeek = time =>
|
||||
{
|
||||
GameplayClockContainer.Seek(time);
|
||||
GameplayClockContainer.Start();
|
||||
},
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre
|
||||
},
|
||||
|
@ -1,12 +1,14 @@
|
||||
// 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.Input.Bindings;
|
||||
using osu.Game.Input.Bindings;
|
||||
using osu.Game.Scoring;
|
||||
using osu.Game.Screens.Ranking;
|
||||
|
||||
namespace osu.Game.Screens.Play
|
||||
{
|
||||
public class ReplayPlayer : Player
|
||||
public class ReplayPlayer : Player, IKeyBindingHandler<GlobalAction>
|
||||
{
|
||||
protected readonly Score Score;
|
||||
|
||||
@ -35,5 +37,24 @@ namespace osu.Game.Screens.Play
|
||||
|
||||
return Score.ScoreInfo;
|
||||
}
|
||||
|
||||
public bool OnPressed(GlobalAction action)
|
||||
{
|
||||
switch (action)
|
||||
{
|
||||
case GlobalAction.TogglePauseReplay:
|
||||
if (GameplayClockContainer.IsPaused.Value)
|
||||
GameplayClockContainer.Start();
|
||||
else
|
||||
GameplayClockContainer.Stop();
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public void OnReleased(GlobalAction action)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -133,6 +133,9 @@ namespace osu.Game.Screens.Play
|
||||
switch (action)
|
||||
{
|
||||
case GlobalAction.SkipCutscene:
|
||||
if (!button.Enabled.Value)
|
||||
return false;
|
||||
|
||||
button.Click();
|
||||
return true;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user