mirror of
https://github.com/ppy/osu.git
synced 2025-02-21 03:02:54 +08:00
Merge pull request #29925 from nekupaw/skip-overlay-beat-synced-animation
Implement beat-synchronized animation in skip overlay
This commit is contained in:
commit
cd61aecad1
@ -9,6 +9,7 @@ using osu.Framework;
|
|||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
using osu.Framework.Audio;
|
using osu.Framework.Audio;
|
||||||
using osu.Framework.Audio.Sample;
|
using osu.Framework.Audio.Sample;
|
||||||
|
using osu.Framework.Audio.Track;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
using osu.Framework.Graphics.Shapes;
|
using osu.Framework.Graphics.Shapes;
|
||||||
@ -16,6 +17,7 @@ using osu.Framework.Graphics.Sprites;
|
|||||||
using osu.Framework.Input.Bindings;
|
using osu.Framework.Input.Bindings;
|
||||||
using osu.Framework.Input.Events;
|
using osu.Framework.Input.Events;
|
||||||
using osu.Framework.Utils;
|
using osu.Framework.Utils;
|
||||||
|
using osu.Game.Beatmaps.ControlPoints;
|
||||||
using osu.Game.Graphics;
|
using osu.Game.Graphics;
|
||||||
using osu.Game.Graphics.Containers;
|
using osu.Game.Graphics.Containers;
|
||||||
using osu.Game.Graphics.Sprites;
|
using osu.Game.Graphics.Sprites;
|
||||||
@ -26,7 +28,7 @@ using osuTK.Graphics;
|
|||||||
|
|
||||||
namespace osu.Game.Screens.Play
|
namespace osu.Game.Screens.Play
|
||||||
{
|
{
|
||||||
public partial class SkipOverlay : CompositeDrawable, IKeyBindingHandler<GlobalAction>
|
public partial class SkipOverlay : BeatSyncedContainer, IKeyBindingHandler<GlobalAction>
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The total number of successful skips performed by this overlay.
|
/// The total number of successful skips performed by this overlay.
|
||||||
@ -36,10 +38,9 @@ namespace osu.Game.Screens.Play
|
|||||||
private readonly double startTime;
|
private readonly double startTime;
|
||||||
|
|
||||||
public Action RequestSkip;
|
public Action RequestSkip;
|
||||||
|
|
||||||
private Button button;
|
private Button button;
|
||||||
private ButtonContainer buttonContainer;
|
private ButtonContainer buttonContainer;
|
||||||
private Box remainingTimeBox;
|
private Circle remainingTimeBox;
|
||||||
|
|
||||||
private FadeContainer fadeContainer;
|
private FadeContainer fadeContainer;
|
||||||
private double displayTime;
|
private double displayTime;
|
||||||
@ -51,7 +52,6 @@ namespace osu.Game.Screens.Play
|
|||||||
private IGameplayClock gameplayClock { get; set; }
|
private IGameplayClock gameplayClock { get; set; }
|
||||||
|
|
||||||
internal bool IsButtonVisible => fadeContainer.State == Visibility.Visible && buttonContainer.State.Value == Visibility.Visible;
|
internal bool IsButtonVisible => fadeContainer.State == Visibility.Visible && buttonContainer.State.Value == Visibility.Visible;
|
||||||
|
|
||||||
public override bool ReceivePositionalInputAt(Vector2 screenSpacePos) => true;
|
public override bool ReceivePositionalInputAt(Vector2 screenSpacePos) => true;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -87,13 +87,13 @@ namespace osu.Game.Screens.Play
|
|||||||
Anchor = Anchor.Centre,
|
Anchor = Anchor.Centre,
|
||||||
Origin = Anchor.Centre,
|
Origin = Anchor.Centre,
|
||||||
},
|
},
|
||||||
remainingTimeBox = new Box
|
remainingTimeBox = new Circle
|
||||||
{
|
{
|
||||||
Height = 5,
|
Height = 5,
|
||||||
RelativeSizeAxes = Axes.X,
|
|
||||||
Colour = colours.Yellow,
|
|
||||||
Anchor = Anchor.BottomCentre,
|
Anchor = Anchor.BottomCentre,
|
||||||
Origin = Anchor.BottomCentre,
|
Origin = Anchor.BottomCentre,
|
||||||
|
Colour = colours.Yellow,
|
||||||
|
RelativeSizeAxes = Axes.X
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -210,6 +210,18 @@ namespace osu.Game.Screens.Play
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected override void OnNewBeat(int beatIndex, TimingControlPoint timingPoint, EffectControlPoint effectPoint, ChannelAmplitudes amplitudes)
|
||||||
|
{
|
||||||
|
base.OnNewBeat(beatIndex, timingPoint, effectPoint, amplitudes);
|
||||||
|
|
||||||
|
if (fadeOutBeginTime <= gameplayClock.CurrentTime)
|
||||||
|
return;
|
||||||
|
|
||||||
|
float progress = (float)(gameplayClock.CurrentTime - displayTime) / (float)(fadeOutBeginTime - displayTime);
|
||||||
|
float newWidth = 1 - Math.Clamp(progress, 0, 1);
|
||||||
|
remainingTimeBox.ResizeWidthTo(newWidth, timingPoint.BeatLength * 2, Easing.OutQuint);
|
||||||
|
}
|
||||||
|
|
||||||
public partial class FadeContainer : Container, IStateful<Visibility>
|
public partial class FadeContainer : Container, IStateful<Visibility>
|
||||||
{
|
{
|
||||||
[CanBeNull]
|
[CanBeNull]
|
||||||
|
Loading…
Reference in New Issue
Block a user