mirror of
https://github.com/ppy/osu.git
synced 2025-01-28 08:02:55 +08:00
Add new fail animation to better match new sound effects
This commit is contained in:
parent
a59ee9ec1f
commit
66f3370a19
@ -12,6 +12,7 @@ using osu.Framework.Audio.Sample;
|
||||
using osu.Framework.Audio.Track;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Graphics.Shapes;
|
||||
using osu.Framework.Utils;
|
||||
using osu.Game.Audio.Effects;
|
||||
using osu.Game.Beatmaps;
|
||||
@ -25,14 +26,15 @@ namespace osu.Game.Screens.Play
|
||||
/// Manage the animation to be applied when a player fails.
|
||||
/// Single use and automatically disposed after use.
|
||||
/// </summary>
|
||||
public class FailAnimation : CompositeDrawable
|
||||
public class FailAnimation : Container
|
||||
{
|
||||
public Action OnComplete;
|
||||
|
||||
private readonly DrawableRuleset drawableRuleset;
|
||||
|
||||
private readonly BindableDouble trackFreq = new BindableDouble(1);
|
||||
|
||||
private Box failFlash;
|
||||
|
||||
private Track track;
|
||||
|
||||
private AudioFilter failLowPassFilter;
|
||||
@ -42,9 +44,18 @@ namespace osu.Game.Screens.Play
|
||||
|
||||
private Sample failSample;
|
||||
|
||||
protected override Container<Drawable> Content { get; } = new Container
|
||||
{
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
};
|
||||
|
||||
public FailAnimation(DrawableRuleset drawableRuleset)
|
||||
{
|
||||
this.drawableRuleset = drawableRuleset;
|
||||
|
||||
RelativeSizeAxes = Axes.Both;
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
@ -53,8 +64,20 @@ namespace osu.Game.Screens.Play
|
||||
track = beatmap.Value.Track;
|
||||
failSample = audio.Samples.Get(@"Gameplay/failsound");
|
||||
|
||||
AddInternal(failLowPassFilter = new AudioFilter(audio.TrackMixer));
|
||||
AddInternal(failHighPassFilter = new AudioFilter(audio.TrackMixer, BQFType.HighPass));
|
||||
AddRangeInternal(new Drawable[]
|
||||
{
|
||||
failLowPassFilter = new AudioFilter(audio.TrackMixer),
|
||||
failHighPassFilter = new AudioFilter(audio.TrackMixer, BQFType.HighPass),
|
||||
Content,
|
||||
failFlash = new Box
|
||||
{
|
||||
Colour = Color4.Red,
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Blending = BlendingParameters.Additive,
|
||||
Depth = float.MinValue,
|
||||
Alpha = 0
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
private bool started;
|
||||
@ -81,8 +104,21 @@ namespace osu.Game.Screens.Play
|
||||
track.AddAdjustment(AdjustableProperty.Frequency, trackFreq);
|
||||
|
||||
applyToPlayfield(drawableRuleset.Playfield);
|
||||
drawableRuleset.Playfield.HitObjectContainer.FlashColour(Color4.Red, 500);
|
||||
drawableRuleset.Playfield.HitObjectContainer.FadeOut(duration / 2);
|
||||
|
||||
failFlash.FadeOutFromOne(1000);
|
||||
|
||||
Content.Masking = true;
|
||||
|
||||
Content.Add(new Box
|
||||
{
|
||||
Colour = Color4.Black,
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Depth = float.MaxValue
|
||||
});
|
||||
|
||||
Content.ScaleTo(0.85f, duration, Easing.OutQuint);
|
||||
Content.RotateTo(1, duration, Easing.OutQuint);
|
||||
}
|
||||
|
||||
protected override void Update()
|
||||
|
@ -339,54 +339,8 @@ namespace osu.Game.Screens.Play
|
||||
var container = new Container
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Children = new[]
|
||||
Children = new Drawable[]
|
||||
{
|
||||
DimmableStoryboard.OverlayLayerContainer.CreateProxy(),
|
||||
BreakOverlay = new BreakOverlay(working.Beatmap.BeatmapInfo.LetterboxInBreaks, ScoreProcessor)
|
||||
{
|
||||
Clock = DrawableRuleset.FrameStableClock,
|
||||
ProcessCustomClock = false,
|
||||
Breaks = working.Beatmap.Breaks
|
||||
},
|
||||
// display the cursor above some HUD elements.
|
||||
DrawableRuleset.Cursor?.CreateProxy() ?? new Container(),
|
||||
DrawableRuleset.ResumeOverlay?.CreateProxy() ?? new Container(),
|
||||
HUDOverlay = new HUDOverlay(DrawableRuleset, GameplayState.Mods)
|
||||
{
|
||||
HoldToQuit =
|
||||
{
|
||||
Action = () => PerformExit(true),
|
||||
IsPaused = { BindTarget = GameplayClockContainer.IsPaused }
|
||||
},
|
||||
KeyCounter =
|
||||
{
|
||||
AlwaysVisible = { BindTarget = DrawableRuleset.HasReplayLoaded },
|
||||
IsCounting = false
|
||||
},
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre
|
||||
},
|
||||
skipIntroOverlay = new SkipOverlay(DrawableRuleset.GameplayStartTime)
|
||||
{
|
||||
RequestSkip = performUserRequestedSkip
|
||||
},
|
||||
skipOutroOverlay = new SkipOverlay(Beatmap.Value.Storyboard.LatestEventTime ?? 0)
|
||||
{
|
||||
RequestSkip = () => progressToResults(false),
|
||||
Alpha = 0
|
||||
},
|
||||
FailOverlay = new FailOverlay
|
||||
{
|
||||
OnRetry = Restart,
|
||||
OnQuit = () => PerformExit(true),
|
||||
},
|
||||
PauseOverlay = new PauseOverlay
|
||||
{
|
||||
OnResume = Resume,
|
||||
Retries = RestartCount,
|
||||
OnRetry = Restart,
|
||||
OnQuit = () => PerformExit(true),
|
||||
},
|
||||
new HotkeyExitOverlay
|
||||
{
|
||||
Action = () =>
|
||||
@ -397,7 +351,59 @@ namespace osu.Game.Screens.Play
|
||||
PerformExit(false);
|
||||
},
|
||||
},
|
||||
failAnimation = new FailAnimation(DrawableRuleset) { OnComplete = onFailComplete, },
|
||||
failAnimation = new FailAnimation(DrawableRuleset)
|
||||
{
|
||||
OnComplete = onFailComplete,
|
||||
Children = new[]
|
||||
{
|
||||
DimmableStoryboard.OverlayLayerContainer.CreateProxy(),
|
||||
BreakOverlay = new BreakOverlay(working.Beatmap.BeatmapInfo.LetterboxInBreaks, ScoreProcessor)
|
||||
{
|
||||
Clock = DrawableRuleset.FrameStableClock,
|
||||
ProcessCustomClock = false,
|
||||
Breaks = working.Beatmap.Breaks
|
||||
},
|
||||
// display the cursor above some HUD elements.
|
||||
DrawableRuleset.Cursor?.CreateProxy() ?? new Container(),
|
||||
DrawableRuleset.ResumeOverlay?.CreateProxy() ?? new Container(),
|
||||
HUDOverlay = new HUDOverlay(DrawableRuleset, GameplayState.Mods)
|
||||
{
|
||||
HoldToQuit =
|
||||
{
|
||||
Action = () => PerformExit(true),
|
||||
IsPaused = { BindTarget = GameplayClockContainer.IsPaused }
|
||||
},
|
||||
KeyCounter =
|
||||
{
|
||||
AlwaysVisible = { BindTarget = DrawableRuleset.HasReplayLoaded },
|
||||
IsCounting = false
|
||||
},
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre
|
||||
},
|
||||
skipIntroOverlay = new SkipOverlay(DrawableRuleset.GameplayStartTime)
|
||||
{
|
||||
RequestSkip = performUserRequestedSkip
|
||||
},
|
||||
skipOutroOverlay = new SkipOverlay(Beatmap.Value.Storyboard.LatestEventTime ?? 0)
|
||||
{
|
||||
RequestSkip = () => progressToResults(false),
|
||||
Alpha = 0
|
||||
},
|
||||
PauseOverlay = new PauseOverlay
|
||||
{
|
||||
OnResume = Resume,
|
||||
Retries = RestartCount,
|
||||
OnRetry = Restart,
|
||||
OnQuit = () => PerformExit(true),
|
||||
},
|
||||
}
|
||||
},
|
||||
FailOverlay = new FailOverlay
|
||||
{
|
||||
OnRetry = Restart,
|
||||
OnQuit = () => PerformExit(true),
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user