1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-18 05:42:56 +08:00

Fix gameplay limitations for adjusting offset not actually being applied

This commit is contained in:
Dean Herbert 2025-01-16 17:23:02 +09:00
parent a4174a3644
commit 1d240eb405
No known key found for this signature in database
2 changed files with 33 additions and 14 deletions

View File

@ -322,6 +322,7 @@ namespace osu.Game.Screens.Play
}
dependencies.CacheAs(DrawableRuleset.FrameStableClock);
dependencies.CacheAs<IGameplayClock>(DrawableRuleset.FrameStableClock);
// add the overlay components as a separate step as they proxy some elements from the above underlay/gameplay components.
// also give the overlays the ruleset skin provider to allow rulesets to potentially override HUD elements (used to disable combo counters etc.)

View File

@ -274,20 +274,36 @@ namespace osu.Game.Screens.Play.PlayerSettings
beatmapOffsetSubscription?.Dispose();
}
protected override void Update()
{
base.Update();
Current.Disabled = !allowOffsetAdjust;
}
private bool allowOffsetAdjust
{
get
{
// General limitations to ensure players don't do anything too weird.
// These match stable for now.
if (player is SubmittingPlayer)
{
Debug.Assert(gameplayClock != null);
// TODO: the blocking conditions should probably display a message.
if (!player.IsBreakTime.Value && gameplayClock.CurrentTime - gameplayClock.StartTime > 10000)
return false;
if (gameplayClock.IsPaused.Value)
return false;
}
return true;
}
}
public bool OnPressed(KeyBindingPressEvent<GlobalAction> e)
{
// General limitations to ensure players don't do anything too weird.
// These match stable for now.
if (player is SubmittingPlayer)
{
// TODO: the blocking conditions should probably display a message.
if (player?.IsBreakTime.Value == false && gameplayClock?.CurrentTime - gameplayClock?.StartTime > 10000)
return false;
if (gameplayClock?.IsPaused.Value == true)
return false;
}
// To match stable, this should adjust by 5 ms, or 1 ms when holding alt.
// But that is hard to make work with global actions due to the operating mode.
// Let's use the more precise as a default for now.
@ -296,11 +312,13 @@ namespace osu.Game.Screens.Play.PlayerSettings
switch (e.Action)
{
case GlobalAction.IncreaseOffset:
Current.Value += amount;
if (!Current.Disabled)
Current.Value += amount;
return true;
case GlobalAction.DecreaseOffset:
Current.Value -= amount;
if (!Current.Disabled)
Current.Value -= amount;
return true;
}