mirror of
https://github.com/ppy/osu
synced 2025-03-20 09:57:01 +00:00
Merge pull request #4534 from peppy/gameplay-paused-no-update
Don't update gameplay loop while paused
This commit is contained in:
commit
bf61f35870
@ -36,7 +36,10 @@ namespace osu.Game.Rulesets.UI
|
|||||||
private void load(GameplayClock clock)
|
private void load(GameplayClock clock)
|
||||||
{
|
{
|
||||||
if (clock != null)
|
if (clock != null)
|
||||||
|
{
|
||||||
parentGameplayClock = clock;
|
parentGameplayClock = clock;
|
||||||
|
gameplayClock.IsPaused.BindTo(clock.IsPaused);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void LoadComplete()
|
protected override void LoadComplete()
|
||||||
@ -68,7 +71,7 @@ namespace osu.Game.Rulesets.UI
|
|||||||
public override bool UpdateSubTree()
|
public override bool UpdateSubTree()
|
||||||
{
|
{
|
||||||
requireMoreUpdateLoops = true;
|
requireMoreUpdateLoops = true;
|
||||||
validState = true;
|
validState = !gameplayClock.IsPaused.Value;
|
||||||
|
|
||||||
int loops = 0;
|
int loops = 0;
|
||||||
|
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
// 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.
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
|
using osu.Framework.Bindables;
|
||||||
using osu.Framework.Timing;
|
using osu.Framework.Timing;
|
||||||
|
|
||||||
namespace osu.Game.Screens.Play
|
namespace osu.Game.Screens.Play
|
||||||
@ -17,6 +18,8 @@ namespace osu.Game.Screens.Play
|
|||||||
{
|
{
|
||||||
private readonly IFrameBasedClock underlyingClock;
|
private readonly IFrameBasedClock underlyingClock;
|
||||||
|
|
||||||
|
public readonly BindableBool IsPaused = new BindableBool();
|
||||||
|
|
||||||
public GameplayClock(IFrameBasedClock underlyingClock)
|
public GameplayClock(IFrameBasedClock underlyingClock)
|
||||||
{
|
{
|
||||||
this.underlyingClock = underlyingClock;
|
this.underlyingClock = underlyingClock;
|
||||||
|
@ -79,6 +79,8 @@ namespace osu.Game.Screens.Play
|
|||||||
|
|
||||||
// the clock to be exposed via DI to children.
|
// the clock to be exposed via DI to children.
|
||||||
GameplayClock = new GameplayClock(offsetClock);
|
GameplayClock = new GameplayClock(offsetClock);
|
||||||
|
|
||||||
|
GameplayClock.IsPaused.BindTo(IsPaused);
|
||||||
}
|
}
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
|
Loading…
Reference in New Issue
Block a user