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