mirror of
https://github.com/ppy/osu.git
synced 2025-01-12 17:23:22 +08:00
Merge pull request #23767 from peppy/fix-playfield-border-animation-in-editor
Fix gameplay playfield border being affected by beatmap track time
This commit is contained in:
commit
244e6cc008
@ -11,6 +11,7 @@ using osu.Framework.Graphics.Pooling;
|
||||
using osu.Framework.Input.Bindings;
|
||||
using osu.Framework.Input.Events;
|
||||
using osu.Framework.Platform;
|
||||
using osu.Game.Extensions;
|
||||
using osu.Game.Rulesets.Judgements;
|
||||
using osu.Game.Rulesets.Mania.Objects;
|
||||
using osu.Game.Rulesets.Mania.Objects.Drawables;
|
||||
@ -97,8 +98,8 @@ namespace osu.Game.Rulesets.Mania.UI
|
||||
new ColumnTouchInputArea(this)
|
||||
};
|
||||
|
||||
applyGameWideClock(background);
|
||||
applyGameWideClock(keyArea);
|
||||
background.ApplyGameWideClock(host);
|
||||
keyArea.ApplyGameWideClock(host);
|
||||
|
||||
TopLevelContainer.Add(HitObjectArea.Explosions.CreateProxy());
|
||||
|
||||
@ -107,18 +108,6 @@ namespace osu.Game.Rulesets.Mania.UI
|
||||
RegisterPool<HeadNote, DrawableHoldNoteHead>(10, 50);
|
||||
RegisterPool<TailNote, DrawableHoldNoteTail>(10, 50);
|
||||
RegisterPool<HoldNoteTick, DrawableHoldNoteTick>(50, 250);
|
||||
|
||||
// Some elements don't handle rewind correctly and fixing them is non-trivial.
|
||||
// In the future we need a better solution to this, but as a temporary work-around, give these components the game-wide
|
||||
// clock so they don't need to worry about rewind.
|
||||
// This only works because they handle OnPressed/OnReleased which results in a correct state while rewinding.
|
||||
//
|
||||
// This is kinda dodgy (and will cause weirdness when pausing gameplay) but is better than completely broken rewind.
|
||||
void applyGameWideClock(Drawable drawable)
|
||||
{
|
||||
drawable.Clock = host.UpdateThread.Clock;
|
||||
drawable.ProcessCustomClock = false;
|
||||
}
|
||||
}
|
||||
|
||||
private void onSourceChanged()
|
||||
|
@ -2,6 +2,7 @@
|
||||
// See the LICENCE file in the repository root for full licence text.
|
||||
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Platform;
|
||||
using osuTK;
|
||||
|
||||
namespace osu.Game.Extensions
|
||||
@ -43,5 +44,20 @@ namespace osu.Game.Extensions
|
||||
/// <returns>The delta vector in Parent's coordinates.</returns>
|
||||
public static Vector2 ScreenSpaceDeltaToParentSpace(this Drawable drawable, Vector2 delta) =>
|
||||
drawable.Parent.ToLocalSpace(drawable.Parent.ToScreenSpace(Vector2.Zero) + delta);
|
||||
|
||||
/// <summary>
|
||||
/// Some elements don't handle rewind correctly and fixing them is non-trivial.
|
||||
/// In the future we need a better solution to this, but as a temporary work-around, give these components the game-wide
|
||||
/// clock so they don't need to worry about rewind.
|
||||
///
|
||||
/// This only works if input handling components handle OnPressed/OnReleased which results in a correct state while rewinding.
|
||||
///
|
||||
/// This is kinda dodgy (and will cause weirdness when pausing gameplay) but is better than completely broken rewind.
|
||||
/// </summary>
|
||||
public static void ApplyGameWideClock(this Drawable drawable, GameHost host)
|
||||
{
|
||||
drawable.Clock = host.UpdateThread.Clock;
|
||||
drawable.ProcessCustomClock = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -4,10 +4,13 @@
|
||||
#nullable disable
|
||||
|
||||
using System.Linq;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Bindables;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Graphics.Shapes;
|
||||
using osu.Framework.Platform;
|
||||
using osu.Game.Extensions;
|
||||
using osuTK;
|
||||
using osuTK.Graphics;
|
||||
|
||||
@ -74,6 +77,12 @@ namespace osu.Game.Rulesets.UI
|
||||
};
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(GameHost host)
|
||||
{
|
||||
this.ApplyGameWideClock(host);
|
||||
}
|
||||
|
||||
protected override void LoadComplete()
|
||||
{
|
||||
base.LoadComplete();
|
||||
|
Loading…
Reference in New Issue
Block a user