From 7bb984eb8da4e0390ad9671330a0bb61d2a8920f Mon Sep 17 00:00:00 2001 From: mcendu Date: Sat, 21 Dec 2019 20:47:34 +0800 Subject: [PATCH] Basic kiai flash implementation --- .../Objects/Drawables/Pieces/CirclePiece.cs | 4 ++ .../Objects/Drawables/Pieces/KiaiFlash.cs | 40 +++++++++++++++++++ .../Skinning/LegacyMainCirclePiece.cs | 12 ++++++ 3 files changed, 56 insertions(+) create mode 100644 osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/KiaiFlash.cs diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/CirclePiece.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/CirclePiece.cs index aab01f45d4..84470d7f30 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/CirclePiece.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/CirclePiece.cs @@ -35,6 +35,10 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces Origin = Anchor.Centre, Texture = textures.Get(@"Gameplay/osu/disc"), }, + new KiaiFlash + { + RelativeSizeAxes = Axes.Both, + }, new TrianglesPiece { RelativeSizeAxes = Axes.Both, diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/KiaiFlash.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/KiaiFlash.cs new file mode 100644 index 0000000000..9f9ca42d69 --- /dev/null +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/KiaiFlash.cs @@ -0,0 +1,40 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +using osu.Framework.Graphics; +using osu.Framework.Graphics.Shapes; +using osu.Game.Graphics; +using osu.Game.Graphics.Containers; + +namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces +{ + public class KiaiFlash : BeatSyncedContainer + { + public Drawable FlashComponent { get; set; } + + public KiaiFlash() + { + Blending = BlendingParameters.Additive; + + Child = FlashComponent = new Box + { + RelativeSizeAxes = Axes.Both, + Colour = OsuColour.Gray(1f), + Alpha = 0f, + }; + } + + protected new double EarlyActivationMilliseconds = 80; + + protected override void OnNewBeat(int beatIndex, Game.Beatmaps.ControlPoints.TimingControlPoint timingPoint, Game.Beatmaps.ControlPoints.EffectControlPoint effectPoint, Framework.Audio.Track.TrackAmplitudes amplitudes) + { + if (effectPoint.KiaiMode) + { + FlashComponent + .FadeTo(0.25f, EarlyActivationMilliseconds, Easing.OutQuint) + .Then() + .FadeOut(timingPoint.BeatLength - 80, Easing.OutSine); + } + } + } +} diff --git a/osu.Game.Rulesets.Osu/Skinning/LegacyMainCirclePiece.cs b/osu.Game.Rulesets.Osu/Skinning/LegacyMainCirclePiece.cs index 93ae0371df..97541d171b 100644 --- a/osu.Game.Rulesets.Osu/Skinning/LegacyMainCirclePiece.cs +++ b/osu.Game.Rulesets.Osu/Skinning/LegacyMainCirclePiece.cs @@ -10,6 +10,7 @@ using osu.Game.Graphics; using osu.Game.Graphics.Sprites; using osu.Game.Rulesets.Objects.Drawables; using osu.Game.Rulesets.Osu.Objects; +using osu.Game.Rulesets.Osu.Objects.Drawables.Pieces; using osu.Game.Skinning; using osuTK; using osuTK.Graphics; @@ -44,6 +45,17 @@ namespace osu.Game.Rulesets.Osu.Skinning Anchor = Anchor.Centre, Origin = Anchor.Centre, }, + new KiaiFlash + { + RelativeSizeAxes = Axes.Both, + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + Size = new Vector2(0.921875f), + + Masking = true, + CornerRadius = Size.X / 2, + CornerExponent = 2, + }, hitCircleText = new SkinnableSpriteText(new OsuSkinComponent(OsuSkinComponents.HitCircleText), _ => new OsuSpriteText { Font = OsuFont.Numeric.With(size: 40),