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

Add support for hit explosions

This commit is contained in:
smoogipoo 2020-04-27 12:23:53 +09:00
parent 81df22d2a7
commit 7dc090cc24
4 changed files with 31 additions and 30 deletions

View File

@ -13,10 +13,9 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables
public class DrawableDrumRollTick : DrawableTaikoHitObject<DrumRollTick> public class DrawableDrumRollTick : DrawableTaikoHitObject<DrumRollTick>
{ {
/// <summary> /// <summary>
/// The action type that the user took which caused this tick to /// The hit type corresponding to the <see cref="TaikoAction"/> that the user pressed to hit this <see cref="DrawableDrumRollTick"/>.
/// have been judged as "hit"
/// </summary> /// </summary>
public TaikoAction JudgedAction; public HitType JudgementType;
public DrawableDrumRollTick(DrumRollTick tick) public DrawableDrumRollTick(DrumRollTick tick)
: base(tick) : base(tick)
@ -57,7 +56,7 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables
public override bool OnPressed(TaikoAction action) public override bool OnPressed(TaikoAction action)
{ {
JudgedAction = action; JudgementType = action == TaikoAction.LeftRim || action == TaikoAction.RightRim ? HitType.Rim : HitType.Centre;
return UpdateResult(true); return UpdateResult(true);
} }

View File

@ -21,16 +21,14 @@ namespace osu.Game.Rulesets.Taiko.UI
public override bool RemoveWhenNotAlive => true; public override bool RemoveWhenNotAlive => true;
public readonly DrawableHitObject JudgedObject; public readonly DrawableHitObject JudgedObject;
private readonly HitType type;
private readonly Box innerFill; private readonly Box innerFill;
private readonly bool isRim; public HitExplosion(DrawableHitObject judgedObject, HitType type)
public HitExplosion(DrawableHitObject judgedObject, bool isRim)
{ {
this.isRim = isRim;
JudgedObject = judgedObject; JudgedObject = judgedObject;
this.type = type;
Anchor = Anchor.Centre; Anchor = Anchor.Centre;
Origin = Anchor.Centre; Origin = Anchor.Centre;
@ -58,7 +56,7 @@ namespace osu.Game.Rulesets.Taiko.UI
[BackgroundDependencyLoader] [BackgroundDependencyLoader]
private void load(OsuColour colours) private void load(OsuColour colours)
{ {
innerFill.Colour = isRim ? colours.BlueDarker : colours.PinkDarker; innerFill.Colour = type == HitType.Rim ? colours.BlueDarker : colours.PinkDarker;
} }
protected override void LoadComplete() protected override void LoadComplete()

View File

@ -18,14 +18,12 @@ namespace osu.Game.Rulesets.Taiko.UI
public override bool RemoveWhenNotAlive => true; public override bool RemoveWhenNotAlive => true;
public readonly DrawableHitObject JudgedObject; public readonly DrawableHitObject JudgedObject;
private readonly HitType type;
private readonly bool isRim; public KiaiHitExplosion(DrawableHitObject judgedObject, HitType type)
public KiaiHitExplosion(DrawableHitObject judgedObject, bool isRim)
{ {
this.isRim = isRim;
JudgedObject = judgedObject; JudgedObject = judgedObject;
this.type = type;
Anchor = Anchor.CentreLeft; Anchor = Anchor.CentreLeft;
Origin = Anchor.Centre; Origin = Anchor.Centre;
@ -53,7 +51,7 @@ namespace osu.Game.Rulesets.Taiko.UI
EdgeEffect = new EdgeEffectParameters EdgeEffect = new EdgeEffectParameters
{ {
Type = EdgeEffectType.Glow, Type = EdgeEffectType.Glow,
Colour = isRim ? colours.BlueDarker : colours.PinkDarker, Colour = type == HitType.Rim ? colours.BlueDarker : colours.PinkDarker,
Radius = 60, Radius = 60,
}; };
} }

View File

@ -10,7 +10,6 @@ using osu.Game.Graphics;
using osu.Game.Rulesets.Objects.Drawables; using osu.Game.Rulesets.Objects.Drawables;
using osu.Game.Rulesets.Judgements; using osu.Game.Rulesets.Judgements;
using osu.Game.Rulesets.Objects; using osu.Game.Rulesets.Objects;
using osu.Game.Rulesets.Scoring;
using osu.Game.Rulesets.UI; using osu.Game.Rulesets.UI;
using osu.Game.Rulesets.UI.Scrolling; using osu.Game.Rulesets.UI.Scrolling;
using osu.Game.Rulesets.Taiko.Objects.Drawables; using osu.Game.Rulesets.Taiko.Objects.Drawables;
@ -197,8 +196,13 @@ namespace osu.Game.Rulesets.Taiko.UI
break; break;
case TaikoDrumRollTickJudgement _: case TaikoDrumRollTickJudgement _:
if (result.IsHit) if (!result.IsHit)
playDrumrollHit((DrawableDrumRollTick)judgedObject); return;
var drawableTick = (DrawableDrumRollTick)judgedObject;
addDrumRollHit(drawableTick);
addExplosion(drawableTick, drawableTick.JudgementType);
break; break;
default: default:
@ -213,25 +217,19 @@ namespace osu.Game.Rulesets.Taiko.UI
if (!result.IsHit) if (!result.IsHit)
break; break;
bool isRim = (judgedObject.HitObject as Hit)?.Type == HitType.Rim; addExplosion(judgedObject, (judgedObject.HitObject as Hit)?.Type ?? HitType.Centre);
hitExplosionContainer.Add(new HitExplosion(judgedObject, isRim));
if (judgedObject.HitObject.Kiai)
kiaiExplosionContainer.Add(new KiaiHitExplosion(judgedObject, isRim));
break; break;
} }
} }
private void playDrumrollHit(DrawableDrumRollTick drumrollTick) private void addDrumRollHit(DrawableDrumRollTick drawableTick)
{ {
TaikoAction action = drumrollTick.JudgedAction; bool isStrong = drawableTick.HitObject.IsStrong;
bool isStrong = drumrollTick.HitObject.IsStrong; double time = drawableTick.HitObject.GetEndTime();
double time = drumrollTick.HitObject.GetEndTime();
DrawableHit drawableHit; DrawableHit drawableHit;
if (action == TaikoAction.LeftRim || action == TaikoAction.RightRim) if (drawableTick.JudgementType == HitType.Rim)
drawableHit = new DrawableFlyingRimHit(time, isStrong); drawableHit = new DrawableFlyingRimHit(time, isStrong);
else else
drawableHit = new DrawableFlyingCentreHit(time, isStrong); drawableHit = new DrawableFlyingCentreHit(time, isStrong);
@ -239,6 +237,14 @@ namespace osu.Game.Rulesets.Taiko.UI
drumRollHitContainer.Add(drawableHit); drumRollHitContainer.Add(drawableHit);
} }
private void addExplosion(DrawableHitObject drawableObject, HitType type)
{
hitExplosionContainer.Add(new HitExplosion(drawableObject, type));
if (drawableObject.HitObject.Kiai)
kiaiExplosionContainer.Add(new KiaiHitExplosion(drawableObject, type));
}
private class ProxyContainer : LifetimeManagementContainer private class ProxyContainer : LifetimeManagementContainer
{ {
public new MarginPadding Padding public new MarginPadding Padding