2021-12-28 14:50:43 +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.
|
|
|
|
|
|
|
|
using System;
|
|
|
|
using osu.Framework.Audio.Track;
|
|
|
|
using osu.Framework.Graphics;
|
|
|
|
using osu.Game.Beatmaps.ControlPoints;
|
|
|
|
using osu.Game.Graphics.Containers;
|
2023-01-11 09:25:24 +00:00
|
|
|
using osuTK.Graphics;
|
2021-12-28 14:50:43 +00:00
|
|
|
|
2022-10-18 21:40:43 +00:00
|
|
|
namespace osu.Game.Skinning
|
2021-12-28 14:50:43 +00:00
|
|
|
{
|
2022-10-18 21:40:43 +00:00
|
|
|
public partial class LegacyKiaiFlashingDrawable : BeatSyncedContainer
|
2021-12-28 14:50:43 +00:00
|
|
|
{
|
2023-01-11 09:25:24 +00:00
|
|
|
public Color4 KiaiGlowColour
|
|
|
|
{
|
|
|
|
get => flashingDrawable.Colour;
|
|
|
|
set => flashingDrawable.Colour = value;
|
|
|
|
}
|
|
|
|
|
2021-12-28 14:50:43 +00:00
|
|
|
private readonly Drawable flashingDrawable;
|
|
|
|
|
2023-01-10 11:15:20 +00:00
|
|
|
private const float flash_opacity = 0.3f;
|
2021-12-28 14:50:43 +00:00
|
|
|
|
2022-10-18 21:40:43 +00:00
|
|
|
public LegacyKiaiFlashingDrawable(Func<Drawable?> creationFunc)
|
2021-12-28 14:50:43 +00:00
|
|
|
{
|
|
|
|
AutoSizeAxes = Axes.Both;
|
|
|
|
|
|
|
|
Children = new[]
|
|
|
|
{
|
2021-12-30 13:21:37 +00:00
|
|
|
(creationFunc.Invoke() ?? Empty()).With(d =>
|
2021-12-28 14:50:43 +00:00
|
|
|
{
|
|
|
|
d.Anchor = Anchor.Centre;
|
|
|
|
d.Origin = Anchor.Centre;
|
|
|
|
}),
|
2021-12-30 13:21:37 +00:00
|
|
|
flashingDrawable = (creationFunc.Invoke() ?? Empty()).With(d =>
|
2021-12-28 14:50:43 +00:00
|
|
|
{
|
|
|
|
d.Anchor = Anchor.Centre;
|
|
|
|
d.Origin = Anchor.Centre;
|
|
|
|
d.Alpha = 0;
|
|
|
|
d.Blending = BlendingParameters.Additive;
|
|
|
|
})
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
protected override void OnNewBeat(int beatIndex, TimingControlPoint timingPoint, EffectControlPoint effectPoint, ChannelAmplitudes amplitudes)
|
|
|
|
{
|
|
|
|
if (!effectPoint.KiaiMode)
|
|
|
|
return;
|
|
|
|
|
|
|
|
flashingDrawable
|
|
|
|
.FadeTo(flash_opacity)
|
|
|
|
.Then()
|
2022-10-18 22:51:44 +00:00
|
|
|
.FadeOut(Math.Max(80, timingPoint.BeatLength - 80), Easing.OutSine);
|
2021-12-28 14:50:43 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|