1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-07 13:07:25 +08:00
osu-lazer/osu.Game.Rulesets.Taiko/Skinning/Argon/ArgonCirclePiece.cs

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

113 lines
3.4 KiB
C#
Raw Normal View History

2022-11-02 15:52:09 +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 osu.Framework.Allocation;
using osu.Framework.Audio.Track;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Colour;
using osu.Framework.Graphics.Shapes;
using osu.Game.Beatmaps.ControlPoints;
using osu.Game.Graphics.Containers;
using osu.Game.Rulesets.Objects.Drawables;
using osuTK.Graphics;
namespace osu.Game.Rulesets.Taiko.Skinning.Argon
{
public abstract class ArgonCirclePiece : BeatSyncedContainer
{
2022-11-07 14:39:24 +08:00
public const float ICON_SIZE = 20 / 70f;
2022-11-02 15:52:09 +08:00
private const double pre_beat_transition_time = 80;
private const float flash_opacity = 0.3f;
private ColourInfo accentColour;
/// <summary>
/// The colour of the inner circle and outer glows.
/// </summary>
public ColourInfo AccentColour
{
get => accentColour;
set
{
accentColour = value;
2022-11-08 14:21:20 +08:00
2022-11-02 15:52:09 +08:00
ring.Colour = AccentColour.MultiplyAlpha(0.5f);
ring2.Colour = AccentColour;
}
}
2022-11-08 14:21:20 +08:00
[Resolved]
private DrawableHitObject drawableHitObject { get; set; } = null!;
2022-11-02 15:52:09 +08:00
2022-11-08 14:21:20 +08:00
private readonly Drawable flash;
2022-11-02 15:52:09 +08:00
private readonly RingPiece ring;
private readonly RingPiece ring2;
protected ArgonCirclePiece()
{
RelativeSizeAxes = Axes.Both;
EarlyActivationMilliseconds = pre_beat_transition_time;
2022-11-12 01:20:19 +08:00
AddRangeInternal(new[]
2022-11-02 15:52:09 +08:00
{
new Circle
{
RelativeSizeAxes = Axes.Both,
2022-11-08 14:21:20 +08:00
Colour = new Color4(0, 0, 0, 190)
2022-11-02 15:52:09 +08:00
},
ring = new RingPiece(20 / 70f),
ring2 = new RingPiece(5 / 70f),
2022-11-08 14:21:20 +08:00
flash = new Circle
2022-11-02 15:52:09 +08:00
{
Name = "Flash layer",
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
RelativeSizeAxes = Axes.Both,
2022-11-08 14:21:20 +08:00
Blending = BlendingParameters.Additive,
Alpha = 0,
2022-11-02 15:52:09 +08:00
},
});
}
2022-11-08 14:21:20 +08:00
protected override void LoadComplete()
{
base.LoadComplete();
drawableHitObject.ApplyCustomUpdateState += updateStateTransforms;
updateStateTransforms(drawableHitObject, drawableHitObject.State.Value);
}
private void updateStateTransforms(DrawableHitObject drawableHitObject, ArmedState state)
{
switch (state)
{
case ArmedState.Hit:
using (BeginAbsoluteSequence(drawableHitObject.HitStateUpdateTime))
{
flash.FadeTo(0.9f).FadeOut(500, Easing.OutQuint);
}
break;
}
}
2022-11-02 15:52:09 +08:00
protected override void OnNewBeat(int beatIndex, TimingControlPoint timingPoint, EffectControlPoint effectPoint, ChannelAmplitudes amplitudes)
{
if (!effectPoint.KiaiMode)
return;
if (drawableHitObject.State.Value == ArmedState.Idle)
{
2022-11-08 14:21:20 +08:00
flash
2022-11-02 15:52:09 +08:00
.FadeTo(flash_opacity)
.Then()
.FadeOut(timingPoint.BeatLength * 0.75, Easing.OutSine);
}
}
}
}