Add basic argon hits

This commit is contained in:
Dean Herbert 2022-11-02 16:52:09 +09:00
parent baf8db8de4
commit bc0e9375af
5 changed files with 202 additions and 1 deletions

View File

@ -0,0 +1,21 @@
// 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.Graphics.Colour;
using osuTK.Graphics;
namespace osu.Game.Rulesets.Taiko.Skinning.Argon
{
public class ArgonCentreCirclePiece : ArgonCirclePiece
{
[BackgroundDependencyLoader]
private void load()
{
AccentColour = ColourInfo.GradientVertical(
new Color4(241, 0, 0, 255),
new Color4(167, 0, 0, 255)
);
}
}
}

View File

@ -0,0 +1,116 @@
// 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.Containers;
using osu.Framework.Graphics.Shapes;
using osu.Framework.Graphics.Sprites;
using osu.Game.Beatmaps.ControlPoints;
using osu.Game.Graphics.Containers;
using osu.Game.Rulesets.Objects.Drawables;
using osuTK;
using osuTK.Graphics;
namespace osu.Game.Rulesets.Taiko.Skinning.Argon
{
public abstract class ArgonCirclePiece : BeatSyncedContainer
{
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;
ring.Colour = AccentColour.MultiplyAlpha(0.5f);
ring2.Colour = AccentColour;
}
}
/// <summary>
/// Whether Kiai mode effects are enabled for this circle piece.
/// </summary>
public bool KiaiMode { get; set; }
public Box FlashBox;
private readonly RingPiece ring;
private readonly RingPiece ring2;
protected ArgonCirclePiece()
{
RelativeSizeAxes = Axes.Both;
EarlyActivationMilliseconds = pre_beat_transition_time;
AddRangeInternal(new Drawable[]
{
new Circle
{
RelativeSizeAxes = Axes.Both,
Colour = new Color4(0, 22, 30, 190)
},
ring = new RingPiece(20 / 70f),
ring2 = new RingPiece(5 / 70f),
new CircularContainer
{
Name = "Flash layer",
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
RelativeSizeAxes = Axes.Both,
Masking = true,
Children = new[]
{
FlashBox = new Box
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
RelativeSizeAxes = Axes.Both,
Colour = Color4.White,
Blending = BlendingParameters.Additive,
Alpha = 0,
AlwaysPresent = true
}
},
},
new SpriteIcon
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
RelativeSizeAxes = Axes.Both,
Icon = FontAwesome.Solid.AngleLeft,
Size = new Vector2(20 / 70f),
Scale = new Vector2(0.8f, 1)
}
});
}
[Resolved]
private DrawableHitObject drawableHitObject { get; set; } = null!;
protected override void OnNewBeat(int beatIndex, TimingControlPoint timingPoint, EffectControlPoint effectPoint, ChannelAmplitudes amplitudes)
{
if (!effectPoint.KiaiMode)
return;
if (drawableHitObject.State.Value == ArmedState.Idle)
{
FlashBox
.FadeTo(flash_opacity)
.Then()
.FadeOut(timingPoint.BeatLength * 0.75, Easing.OutSine);
}
}
}
}

View File

@ -0,0 +1,21 @@
// 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.Graphics.Colour;
using osuTK.Graphics;
namespace osu.Game.Rulesets.Taiko.Skinning.Argon
{
public class ArgonRimCirclePiece : ArgonCirclePiece
{
[BackgroundDependencyLoader]
private void load()
{
AccentColour = ColourInfo.GradientVertical(
new Color4(0, 161, 241, 255),
new Color4(0, 111, 167, 255)
);
}
}
}

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.Containers;
using osu.Framework.Graphics.Shapes;
using osuTK.Graphics;
namespace osu.Game.Rulesets.Taiko.Skinning.Argon
{
public class RingPiece : CircularContainer
{
private readonly float relativeBorderThickness;
public RingPiece(float relativeBorderThickness)
{
this.relativeBorderThickness = relativeBorderThickness;
RelativeSizeAxes = Axes.Both;
Anchor = Anchor.Centre;
Origin = Anchor.Centre;
Masking = true;
BorderColour = Color4.White;
Child = new Box
{
AlwaysPresent = true,
Alpha = 0,
RelativeSizeAxes = Axes.Both
};
}
protected override void Update()
{
base.Update();
BorderThickness = relativeBorderThickness * DrawSize.X;
}
}
}

View File

@ -22,7 +22,10 @@ public TaikoArgonSkinTransformer(ISkin skin)
switch (catchComponent.Component)
{
case TaikoSkinComponents.CentreHit:
return Drawable.Empty();
return new ArgonCentreCirclePiece();
case TaikoSkinComponents.RimHit:
return new ArgonRimCirclePiece();
}
break;