Merge pull request #21151 from peppy/taiko-judgement-fixes

Fix various issues surrounding hit judgements
This commit is contained in:
Dan Balasescu 2022-11-11 16:41:46 +09:00 committed by GitHub
commit fe58329478
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 51 additions and 39 deletions

View File

@ -0,0 +1,35 @@
// 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.Graphics;
using osu.Game.Rulesets.Scoring;
namespace osu.Game.Rulesets.Taiko.Skinning.Default
{
public class DefaultJudgementPiece : Rulesets.Judgements.DefaultJudgementPiece
{
public DefaultJudgementPiece(HitResult result)
: base(result)
{
RelativePositionAxes = Axes.Both;
}
public override void PlayAnimation()
{
if (Result != HitResult.Miss)
{
this
.MoveToY(-0.6f)
.MoveToY(-1.5f, 500);
JudgementText
.ScaleTo(0.9f)
.ScaleTo(1, 500, Easing.OutElastic);
this.FadeOutFromOne(800, Easing.OutQuint);
}
else
base.PlayAnimation();
}
}
}

View File

@ -4,6 +4,8 @@
using osu.Framework.Graphics;
using osu.Game.Rulesets.Judgements;
using osu.Game.Rulesets.Scoring;
using osuTK;
using DefaultJudgementPiece = osu.Game.Rulesets.Taiko.Skinning.Default.DefaultJudgementPiece;
namespace osu.Game.Rulesets.Taiko.UI
{
@ -12,31 +14,15 @@ namespace osu.Game.Rulesets.Taiko.UI
/// </summary>
public class DrawableTaikoJudgement : DrawableJudgement
{
protected override void ApplyHitAnimations()
public DrawableTaikoJudgement()
{
this.MoveToY(-100, 500);
base.ApplyHitAnimations();
Anchor = Anchor.Centre;
Origin = Anchor.Centre;
RelativeSizeAxes = Axes.Both;
Size = Vector2.One;
}
protected override Drawable CreateDefaultJudgement(HitResult result) => new TaikoJudgementPiece(result);
private class TaikoJudgementPiece : DefaultJudgementPiece
{
public TaikoJudgementPiece(HitResult result)
: base(result)
{
}
public override void PlayAnimation()
{
if (Result != HitResult.Miss)
{
JudgementText.ScaleTo(0.9f);
JudgementText.ScaleTo(1, 500, Easing.OutElastic);
}
base.PlayAnimation();
}
}
protected override Drawable CreateDefaultJudgement(HitResult result) => new DefaultJudgementPiece(result);
}
}

View File

@ -32,7 +32,7 @@ namespace osu.Game.Rulesets.Taiko.UI
JudgedObject = judgedObject;
this.hitType = hitType;
Anchor = Anchor.CentreLeft;
Anchor = Anchor.Centre;
Origin = Anchor.Centre;
RelativeSizeAxes = Axes.Both;

View File

@ -145,13 +145,16 @@ namespace osu.Game.Rulesets.Taiko.UI
kiaiExplosionContainer = new Container<KiaiHitExplosion>
{
Name = "Kiai hit explosions",
Origin = Anchor.TopCentre,
RelativeSizeAxes = Axes.Both,
FillMode = FillMode.Fit,
},
judgementContainer = new JudgementContainer<DrawableTaikoJudgement>
{
Name = "Judgements",
RelativeSizeAxes = Axes.Y,
Origin = Anchor.TopCentre,
RelativeSizeAxes = Axes.Both,
FillMode = FillMode.Fit,
},
}
},
@ -320,15 +323,7 @@ namespace osu.Game.Rulesets.Taiko.UI
if (!result.Type.IsScorable())
break;
judgementContainer.Add(judgementPools[result.Type].Get(j =>
{
j.Apply(result, judgedObject);
j.Anchor = result.IsHit ? Anchor.TopLeft : Anchor.CentreLeft;
j.Origin = result.IsHit ? Anchor.BottomCentre : Anchor.Centre;
j.RelativePositionAxes = Axes.X;
j.X = result.IsHit ? judgedObject.Position.X : 0;
}));
judgementContainer.Add(judgementPools[result.Type].Get(j => j.Apply(result, judgedObject)));
var type = (judgedObject.HitObject as Hit)?.Type ?? HitType.Centre;
addExplosion(judgedObject, result.Type, type);

View File

@ -168,11 +168,7 @@ namespace osu.Game.Rulesets.Judgements
RemoveInternal(JudgementBody, true);
AddInternal(JudgementBody = new SkinnableDrawable(new GameplaySkinComponentLookup<HitResult>(type), _ =>
CreateDefaultJudgement(type), confineMode: ConfineMode.NoScaling)
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
});
CreateDefaultJudgement(type), confineMode: ConfineMode.NoScaling));
JudgementBody.OnSkinChanged += () =>
{