mirror of
https://github.com/osukey/osukey.git
synced 2025-08-05 07:33:55 +09:00
Add taiko hit explosion skinning support
This commit is contained in:
54
osu.Game.Rulesets.Taiko/UI/DefaultHitExplosion.cs
Normal file
54
osu.Game.Rulesets.Taiko/UI/DefaultHitExplosion.cs
Normal file
@ -0,0 +1,54 @@
|
||||
// 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;
|
||||
using osuTK.Graphics;
|
||||
|
||||
namespace osu.Game.Rulesets.Taiko.UI
|
||||
{
|
||||
internal class DefaultHitExplosion : CircularContainer
|
||||
{
|
||||
[Resolved]
|
||||
private DrawableHitObject judgedObject { get; set; }
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(OsuColour colours)
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both;
|
||||
|
||||
BorderColour = Color4.White;
|
||||
BorderThickness = 1;
|
||||
|
||||
Alpha = 0.15f;
|
||||
Masking = true;
|
||||
|
||||
if (judgedObject.Result.Type == HitResult.Miss)
|
||||
return;
|
||||
|
||||
bool isRim = (judgedObject.HitObject as Hit)?.Type == HitType.Rim;
|
||||
|
||||
InternalChildren = new[]
|
||||
{
|
||||
new Box
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Colour = isRim ? colours.BlueDarker : colours.PinkDarker,
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
protected override void LoadComplete()
|
||||
{
|
||||
base.LoadComplete();
|
||||
|
||||
this.ScaleTo(3f, 1000, Easing.OutQuint);
|
||||
}
|
||||
}
|
||||
}
|
@ -1,15 +1,15 @@
|
||||
// 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 System;
|
||||
using osuTK;
|
||||
using osuTK.Graphics;
|
||||
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;
|
||||
using osu.Game.Skinning;
|
||||
|
||||
namespace osu.Game.Rulesets.Taiko.UI
|
||||
{
|
||||
@ -20,15 +20,12 @@ namespace osu.Game.Rulesets.Taiko.UI
|
||||
{
|
||||
public override bool RemoveWhenNotAlive => true;
|
||||
|
||||
[Cached(typeof(DrawableHitObject))]
|
||||
public readonly DrawableHitObject JudgedObject;
|
||||
private readonly HitType type;
|
||||
|
||||
private readonly Box innerFill;
|
||||
|
||||
public HitExplosion(DrawableHitObject judgedObject, HitType type)
|
||||
public HitExplosion(DrawableHitObject judgedObject)
|
||||
{
|
||||
JudgedObject = judgedObject;
|
||||
this.type = type;
|
||||
|
||||
Anchor = Anchor.Centre;
|
||||
Origin = Anchor.Centre;
|
||||
@ -37,35 +34,36 @@ namespace osu.Game.Rulesets.Taiko.UI
|
||||
Size = new Vector2(TaikoHitObject.DEFAULT_SIZE);
|
||||
|
||||
RelativePositionAxes = Axes.Both;
|
||||
|
||||
BorderColour = Color4.White;
|
||||
BorderThickness = 1;
|
||||
|
||||
Alpha = 0.15f;
|
||||
Masking = true;
|
||||
|
||||
Children = new[]
|
||||
{
|
||||
innerFill = new Box
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(OsuColour colours)
|
||||
private void load()
|
||||
{
|
||||
innerFill.Colour = type == HitType.Rim ? colours.BlueDarker : colours.PinkDarker;
|
||||
Child = new SkinnableDrawable(new TaikoSkinComponent(getComponentName(JudgedObject.Result?.Type ?? HitResult.Great)), _ => new DefaultHitExplosion());
|
||||
}
|
||||
|
||||
private TaikoSkinComponents getComponentName(HitResult resultType)
|
||||
{
|
||||
switch (resultType)
|
||||
{
|
||||
case HitResult.Miss:
|
||||
return TaikoSkinComponents.TaikoExplosionMiss;
|
||||
|
||||
case HitResult.Good:
|
||||
return TaikoSkinComponents.TaikoExplosionGood;
|
||||
|
||||
case HitResult.Great:
|
||||
return TaikoSkinComponents.TaikoExplosionGreat;
|
||||
}
|
||||
|
||||
throw new ArgumentException("Invalid result type", nameof(resultType));
|
||||
}
|
||||
|
||||
protected override void LoadComplete()
|
||||
{
|
||||
base.LoadComplete();
|
||||
|
||||
this.ScaleTo(3f, 1000, Easing.OutQuint);
|
||||
this.FadeOut(500);
|
||||
|
||||
Expire(true);
|
||||
}
|
||||
|
||||
|
@ -185,7 +185,6 @@ namespace osu.Game.Rulesets.Taiko.UI
|
||||
var drawableTick = (DrawableDrumRollTick)judgedObject;
|
||||
|
||||
addDrumRollHit(drawableTick);
|
||||
addExplosion(drawableTick, drawableTick.JudgementType);
|
||||
break;
|
||||
|
||||
default:
|
||||
@ -200,7 +199,9 @@ namespace osu.Game.Rulesets.Taiko.UI
|
||||
if (!result.IsHit)
|
||||
break;
|
||||
|
||||
addExplosion(judgedObject, (judgedObject.HitObject as Hit)?.Type ?? HitType.Centre);
|
||||
var type = (judgedObject.HitObject as Hit)?.Type ?? HitType.Centre;
|
||||
|
||||
addExplosion(judgedObject, type);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -210,7 +211,7 @@ namespace osu.Game.Rulesets.Taiko.UI
|
||||
|
||||
private void addExplosion(DrawableHitObject drawableObject, HitType type)
|
||||
{
|
||||
hitExplosionContainer.Add(new HitExplosion(drawableObject, type));
|
||||
hitExplosionContainer.Add(new HitExplosion(drawableObject));
|
||||
if (drawableObject.HitObject.Kiai)
|
||||
kiaiExplosionContainer.Add(new KiaiHitExplosion(drawableObject, type));
|
||||
}
|
||||
|
Reference in New Issue
Block a user