2020-04-27 21:22:32 +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.Graphics;
|
|
|
|
using osu.Framework.Graphics.Containers;
|
|
|
|
using osu.Framework.Graphics.Shapes;
|
|
|
|
using osu.Game.Graphics;
|
|
|
|
using osu.Game.Rulesets.Objects.Drawables;
|
|
|
|
using osu.Game.Rulesets.Scoring;
|
|
|
|
using osu.Game.Rulesets.Taiko.Objects;
|
2022-11-02 16:04:45 +08:00
|
|
|
using osu.Game.Rulesets.Taiko.UI;
|
2022-11-07 15:17:43 +08:00
|
|
|
using osuTK;
|
2020-04-27 21:22:32 +08:00
|
|
|
using osuTK.Graphics;
|
|
|
|
|
2022-11-02 16:04:45 +08:00
|
|
|
namespace osu.Game.Rulesets.Taiko.Skinning.Default
|
2020-04-27 21:22:32 +08:00
|
|
|
{
|
2021-03-16 03:38:11 +08:00
|
|
|
internal partial class DefaultHitExplosion : CircularContainer, IAnimatableHitExplosion
|
2020-04-27 21:22:32 +08:00
|
|
|
{
|
2020-09-25 18:25:58 +08:00
|
|
|
private readonly HitResult result;
|
|
|
|
|
2022-11-02 16:04:45 +08:00
|
|
|
private Box? body;
|
2021-03-14 22:51:38 +08:00
|
|
|
|
|
|
|
[Resolved]
|
2022-11-02 16:04:45 +08:00
|
|
|
private OsuColour colours { get; set; } = null!;
|
2021-03-14 22:51:38 +08:00
|
|
|
|
|
|
|
public DefaultHitExplosion(HitResult result)
|
2020-09-25 18:25:58 +08:00
|
|
|
{
|
|
|
|
this.result = result;
|
|
|
|
}
|
2020-04-27 21:22:32 +08:00
|
|
|
|
|
|
|
[BackgroundDependencyLoader]
|
2021-03-14 22:51:38 +08:00
|
|
|
private void load()
|
2020-04-27 21:22:32 +08:00
|
|
|
{
|
|
|
|
RelativeSizeAxes = Axes.Both;
|
|
|
|
|
|
|
|
BorderColour = Color4.White;
|
|
|
|
BorderThickness = 1;
|
|
|
|
|
2020-04-30 08:57:14 +08:00
|
|
|
Blending = BlendingParameters.Additive;
|
|
|
|
|
2020-04-27 21:22:32 +08:00
|
|
|
Alpha = 0.15f;
|
|
|
|
Masking = true;
|
|
|
|
|
2020-10-03 04:57:49 +08:00
|
|
|
if (!result.IsHit())
|
2020-04-27 21:22:32 +08:00
|
|
|
return;
|
|
|
|
|
|
|
|
InternalChildren = new[]
|
|
|
|
{
|
2021-03-14 22:51:38 +08:00
|
|
|
body = new Box
|
2020-04-27 21:22:32 +08:00
|
|
|
{
|
|
|
|
RelativeSizeAxes = Axes.Both,
|
|
|
|
}
|
|
|
|
};
|
2021-03-14 22:51:38 +08:00
|
|
|
|
|
|
|
updateColour();
|
2020-04-27 21:22:32 +08:00
|
|
|
}
|
|
|
|
|
2022-11-02 16:04:45 +08:00
|
|
|
private void updateColour(DrawableHitObject? judgedObject = null)
|
2020-04-27 21:22:32 +08:00
|
|
|
{
|
2021-03-14 22:51:38 +08:00
|
|
|
if (body == null)
|
|
|
|
return;
|
|
|
|
|
|
|
|
bool isRim = (judgedObject?.HitObject as Hit)?.Type == HitType.Rim;
|
|
|
|
body.Colour = isRim ? colours.BlueDarker : colours.PinkDarker;
|
|
|
|
}
|
|
|
|
|
|
|
|
public void Animate(DrawableHitObject drawableHitObject)
|
|
|
|
{
|
|
|
|
updateColour(drawableHitObject);
|
2020-04-27 21:22:32 +08:00
|
|
|
|
|
|
|
this.ScaleTo(3f, 1000, Easing.OutQuint);
|
2020-04-29 16:53:25 +08:00
|
|
|
this.FadeOut(500);
|
2020-04-27 21:22:32 +08:00
|
|
|
}
|
2021-03-14 22:51:38 +08:00
|
|
|
|
|
|
|
public void AnimateSecondHit()
|
|
|
|
{
|
2022-11-07 15:17:43 +08:00
|
|
|
this.ResizeTo(new Vector2(TaikoStrongableHitObject.STRONG_SCALE), 50);
|
2021-03-14 22:51:38 +08:00
|
|
|
}
|
2020-04-27 21:22:32 +08:00
|
|
|
}
|
|
|
|
}
|