1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-26 00:02:56 +08:00
osu-lazer/osu.Game.Rulesets.Osu/Skinning/Default/KiaiFlash.cs

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

45 lines
1.3 KiB
C#
Raw Normal View History

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.
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;
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;
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
{
if (!effectPoint.KiaiMode)
return;
Child
2021-06-04 13:06:08 +08:00
.FadeTo(flash_opacity, EarlyActivationMilliseconds, Easing.OutQuint)
.Then()
.FadeOut(Math.Max(fade_length, timingPoint.BeatLength - fade_length), Easing.OutSine);
2019-12-21 20:47:34 +08:00
}
}
}