2019-12-21 12:47:34 +00:00
|
|
|
// 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.
|
|
|
|
|
2022-06-17 07:37:17 +00:00
|
|
|
#nullable disable
|
|
|
|
|
2022-03-07 18:36:09 +00:00
|
|
|
using System;
|
2021-06-04 04:50:12 +00:00
|
|
|
using osu.Framework.Audio.Track;
|
2019-12-21 12:47:34 +00:00
|
|
|
using osu.Framework.Graphics;
|
|
|
|
using osu.Framework.Graphics.Shapes;
|
2021-06-04 04:50:12 +00:00
|
|
|
using osu.Game.Beatmaps.ControlPoints;
|
2019-12-21 12:47:34 +00:00
|
|
|
using osu.Game.Graphics.Containers;
|
2019-12-22 12:01:58 +00:00
|
|
|
using osuTK.Graphics;
|
2019-12-21 12:47:34 +00:00
|
|
|
|
2021-06-04 04:50:12 +00:00
|
|
|
namespace osu.Game.Rulesets.Osu.Skinning.Default
|
2019-12-21 12:47:34 +00:00
|
|
|
{
|
|
|
|
public class KiaiFlash : BeatSyncedContainer
|
|
|
|
{
|
2021-06-04 05:06:08 +00:00
|
|
|
private const double fade_length = 80;
|
|
|
|
|
|
|
|
private const float flash_opacity = 0.25f;
|
2019-12-21 12:53:02 +00:00
|
|
|
|
2019-12-21 12:47:34 +00:00
|
|
|
public KiaiFlash()
|
|
|
|
{
|
2019-12-21 14:44:52 +00:00
|
|
|
EarlyActivationMilliseconds = 80;
|
2019-12-21 12:47:34 +00:00
|
|
|
Blending = BlendingParameters.Additive;
|
2019-12-22 12:01:58 +00:00
|
|
|
|
|
|
|
Child = new Box
|
|
|
|
{
|
|
|
|
RelativeSizeAxes = Axes.Both,
|
|
|
|
Colour = Color4.White,
|
|
|
|
Alpha = 0f,
|
|
|
|
};
|
2019-12-21 12:47:34 +00:00
|
|
|
}
|
|
|
|
|
2021-06-04 04:50:12 +00:00
|
|
|
protected override void OnNewBeat(int beatIndex, TimingControlPoint timingPoint, EffectControlPoint effectPoint, ChannelAmplitudes amplitudes)
|
2019-12-21 12:47:34 +00:00
|
|
|
{
|
2019-12-22 12:01:58 +00:00
|
|
|
if (!effectPoint.KiaiMode)
|
|
|
|
return;
|
|
|
|
|
|
|
|
Child
|
2021-06-04 05:06:08 +00:00
|
|
|
.FadeTo(flash_opacity, EarlyActivationMilliseconds, Easing.OutQuint)
|
2019-12-22 12:01:58 +00:00
|
|
|
.Then()
|
2022-03-10 07:47:02 +00:00
|
|
|
.FadeOut(Math.Max(fade_length, timingPoint.BeatLength - fade_length), Easing.OutSine);
|
2019-12-21 12:47:34 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|