1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-14 00:42:55 +08:00

Basic kiai flash implementation

This commit is contained in:
mcendu 2019-12-21 20:47:34 +08:00
parent cc808a9eb1
commit 7bb984eb8d
No known key found for this signature in database
GPG Key ID: FBCD5D45163D6364
3 changed files with 56 additions and 0 deletions

View File

@ -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,

View File

@ -0,0 +1,40 @@
// 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.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);
}
}
}
}

View File

@ -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),