2019-01-24 16:43:03 +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.
|
2018-04-13 17:19:50 +08:00
|
|
|
|
2018-11-20 15:51:59 +08:00
|
|
|
using osuTK.Graphics;
|
2018-04-13 17:19:50 +08:00
|
|
|
using osu.Framework.Graphics;
|
|
|
|
using osu.Framework.Graphics.Containers;
|
2019-04-02 13:51:28 +08:00
|
|
|
using osu.Framework.Graphics.Effects;
|
2018-04-13 17:19:50 +08:00
|
|
|
using osu.Framework.Graphics.Shapes;
|
2018-06-07 13:27:59 +08:00
|
|
|
using osu.Framework.MathUtils;
|
2018-04-13 17:19:50 +08:00
|
|
|
using osu.Game.Rulesets.Mania.Objects.Drawables;
|
2018-06-07 13:27:59 +08:00
|
|
|
using osu.Game.Rulesets.Mania.Objects.Drawables.Pieces;
|
2018-04-13 17:19:50 +08:00
|
|
|
using osu.Game.Rulesets.Objects.Drawables;
|
2018-11-20 15:51:59 +08:00
|
|
|
using osuTK;
|
2018-04-13 17:19:50 +08:00
|
|
|
|
|
|
|
namespace osu.Game.Rulesets.Mania.UI
|
|
|
|
{
|
|
|
|
internal class HitExplosion : CompositeDrawable
|
|
|
|
{
|
2018-06-12 11:53:53 +08:00
|
|
|
public override bool RemoveWhenNotAlive => true;
|
|
|
|
|
2018-06-07 13:27:59 +08:00
|
|
|
private readonly CircularContainer circle;
|
2018-04-13 17:19:50 +08:00
|
|
|
|
|
|
|
public HitExplosion(DrawableHitObject judgedObject)
|
|
|
|
{
|
|
|
|
bool isTick = judgedObject is DrawableHoldNoteTick;
|
|
|
|
|
|
|
|
Origin = Anchor.Centre;
|
|
|
|
|
2018-06-07 13:27:59 +08:00
|
|
|
RelativeSizeAxes = Axes.X;
|
|
|
|
Y = NotePiece.NOTE_HEIGHT / 2;
|
|
|
|
Height = NotePiece.NOTE_HEIGHT;
|
2018-04-13 17:19:50 +08:00
|
|
|
|
2018-06-07 13:27:59 +08:00
|
|
|
// scale roughly in-line with visual appearance of notes
|
|
|
|
Scale = new Vector2(isTick ? 0.4f : 0.8f);
|
2018-04-13 17:19:50 +08:00
|
|
|
|
2018-06-07 13:27:59 +08:00
|
|
|
InternalChild = circle = new CircularContainer
|
2018-04-13 17:19:50 +08:00
|
|
|
{
|
2018-06-07 13:27:59 +08:00
|
|
|
Anchor = Anchor.Centre,
|
|
|
|
Origin = Anchor.Centre,
|
2018-04-13 17:19:50 +08:00
|
|
|
RelativeSizeAxes = Axes.Both,
|
|
|
|
Masking = true,
|
2018-06-07 13:27:59 +08:00
|
|
|
// we want our size to be very small so the glow dominates it.
|
|
|
|
Size = new Vector2(0.1f),
|
2018-04-13 17:19:50 +08:00
|
|
|
EdgeEffect = new EdgeEffectParameters
|
|
|
|
{
|
|
|
|
Type = EdgeEffectType.Glow,
|
2018-06-07 13:27:59 +08:00
|
|
|
Colour = Interpolation.ValueAt(0.1f, judgedObject.AccentColour, Color4.White, 0, 1),
|
|
|
|
Radius = 100,
|
2018-04-13 17:19:50 +08:00
|
|
|
},
|
2018-06-07 13:27:59 +08:00
|
|
|
Child = new Box
|
2018-04-13 17:19:50 +08:00
|
|
|
{
|
2018-06-07 13:27:59 +08:00
|
|
|
Alpha = 0,
|
2018-04-13 17:19:50 +08:00
|
|
|
RelativeSizeAxes = Axes.Both,
|
2018-06-07 13:27:59 +08:00
|
|
|
AlwaysPresent = true
|
2018-04-13 17:19:50 +08:00
|
|
|
}
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
protected override void LoadComplete()
|
|
|
|
{
|
|
|
|
base.LoadComplete();
|
|
|
|
|
2018-06-07 13:27:59 +08:00
|
|
|
circle.ResizeTo(circle.Size * new Vector2(4, 20), 1000, Easing.OutQuint);
|
|
|
|
this.FadeIn(16).Then().FadeOut(500, Easing.OutQuint);
|
2018-04-13 17:19:50 +08:00
|
|
|
|
|
|
|
Expire(true);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|