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

Fix second hit displaying two judgements, move hitobjects above playfield when hit.

This commit is contained in:
smoogipooo 2017-04-03 10:20:20 +09:00
parent 0e52bead75
commit 1a66755694
2 changed files with 38 additions and 9 deletions

View File

@ -18,12 +18,21 @@ namespace osu.Game.Modes.Taiko.UI
/// </summary> /// </summary>
internal class HitExplosion : CircularContainer internal class HitExplosion : CircularContainer
{ {
private readonly TaikoJudgement judgement; /// <summary>
/// The size of a hit explosion if a hit object has been hit with the second key.
/// </summary>
private const float secondhit_scale = 1.5f;
/// <summary>
/// The judgement this hit explosion visualises.
/// </summary>
public readonly TaikoJudgement Judgement;
private readonly Box innerFill; private readonly Box innerFill;
public HitExplosion(TaikoJudgement judgement) public HitExplosion(TaikoJudgement judgement)
{ {
this.judgement = judgement; Judgement = judgement;
Size = new Vector2(TaikoHitObject.CIRCLE_RADIUS * 2); Size = new Vector2(TaikoHitObject.CIRCLE_RADIUS * 2);
@ -50,10 +59,7 @@ namespace osu.Game.Modes.Taiko.UI
[BackgroundDependencyLoader] [BackgroundDependencyLoader]
private void load(OsuColour colours) private void load(OsuColour colours)
{ {
if (judgement.SecondHit) switch (Judgement.TaikoResult)
Size *= 1.5f;
switch (judgement.TaikoResult)
{ {
case TaikoHitResult.Good: case TaikoHitResult.Good:
innerFill.Colour = colours.Green; innerFill.Colour = colours.Green;
@ -73,5 +79,13 @@ namespace osu.Game.Modes.Taiko.UI
Expire(); Expire();
} }
/// <summary>
/// Transforms this hit explosion to visualise a secondary hit.
/// </summary>
public void VisualiseSecondHit()
{
ResizeTo(Size * secondhit_scale, 50);
}
} }
} }

View File

@ -15,6 +15,7 @@ using osu.Framework.Graphics.Containers;
using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Extensions.Color4Extensions;
using osu.Framework.Graphics.Primitives; using osu.Framework.Graphics.Primitives;
using osu.Game.Modes.Taiko.Objects.Drawable; using osu.Game.Modes.Taiko.Objects.Drawable;
using System.Linq;
namespace osu.Game.Modes.Taiko.UI namespace osu.Game.Modes.Taiko.UI
{ {
@ -176,9 +177,7 @@ namespace osu.Game.Modes.Taiko.UI
public override void OnJudgement(DrawableHitObject<TaikoHitObject, TaikoJudgement> judgedObject) public override void OnJudgement(DrawableHitObject<TaikoHitObject, TaikoJudgement> judgedObject)
{ {
bool wasHit = judgedObject.Judgement.Result == HitResult.Hit; bool wasHit = judgedObject.Judgement.Result == HitResult.Hit;
bool secondHit = judgedObject.Judgement.SecondHit;
if (wasHit)
hitExplosionContainer.Add(new HitExplosion(judgedObject.Judgement));
judgementContainer.Add(new DrawableTaikoJudgement(judgedObject.Judgement) judgementContainer.Add(new DrawableTaikoJudgement(judgedObject.Judgement)
{ {
@ -187,6 +186,22 @@ namespace osu.Game.Modes.Taiko.UI
RelativePositionAxes = Axes.X, RelativePositionAxes = Axes.X,
X = wasHit ? judgedObject.Position.X : 0, X = wasHit ? judgedObject.Position.X : 0,
}); });
if (!wasHit)
return;
if (!secondHit)
{
if (judgedObject.X >= -0.05f && !(judgedObject is DrawableSwell))
{
// If we're far enough away from the left stage, we should bring outselves in front of it
topLevelHitContainer.Add(judgedObject.CreateProxy());
}
hitExplosionContainer.Add(new HitExplosion(judgedObject.Judgement));
}
else
hitExplosionContainer.Children.FirstOrDefault(e => e.Judgement == judgedObject.Judgement)?.VisualiseSecondHit();
} }
} }
} }