mirror of
https://github.com/osukey/osukey.git
synced 2025-05-29 17:37:23 +09:00
Add hit/miss display to TestCaseSlider
This commit is contained in:
parent
27357e100a
commit
4b63d25871
@ -16,6 +16,9 @@ using OpenTK;
|
|||||||
using OpenTK.Graphics;
|
using OpenTK.Graphics;
|
||||||
using osu.Game.Rulesets.Mods;
|
using osu.Game.Rulesets.Mods;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
using osu.Game.Graphics.Sprites;
|
||||||
|
using osu.Game.Rulesets.Judgements;
|
||||||
|
using osu.Game.Rulesets.Objects.Drawables;
|
||||||
using osu.Game.Rulesets.Osu.Objects.Drawables.Pieces;
|
using osu.Game.Rulesets.Osu.Objects.Drawables.Pieces;
|
||||||
|
|
||||||
namespace osu.Game.Rulesets.Osu.Tests
|
namespace osu.Game.Rulesets.Osu.Tests
|
||||||
@ -142,7 +145,31 @@ namespace osu.Game.Rulesets.Osu.Tests
|
|||||||
foreach (var mod in Mods.OfType<IApplicableToDrawableHitObjects>())
|
foreach (var mod in Mods.OfType<IApplicableToDrawableHitObjects>())
|
||||||
mod.ApplyToDrawableHitObjects(new[] { drawable });
|
mod.ApplyToDrawableHitObjects(new[] { drawable });
|
||||||
|
|
||||||
|
drawable.OnJudgement += onJudgement;
|
||||||
|
|
||||||
Add(drawable);
|
Add(drawable);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void onJudgement(DrawableHitObject judgedObject, Judgement judgement)
|
||||||
|
{
|
||||||
|
var osuObject = judgedObject as DrawableOsuHitObject;
|
||||||
|
if (osuObject == null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
OsuSpriteText text;
|
||||||
|
Add(text = new OsuSpriteText
|
||||||
|
{
|
||||||
|
Anchor = Anchor.Centre,
|
||||||
|
Origin = Anchor.Centre,
|
||||||
|
Text = judgement.IsHit ? "Hit!" : "Miss!",
|
||||||
|
Colour = judgement.IsHit ? Color4.Green : Color4.Red,
|
||||||
|
TextSize = 30,
|
||||||
|
Position = osuObject.HitObject.StackedEndPosition - new Vector2(0, 45)
|
||||||
|
});
|
||||||
|
|
||||||
|
text.Delay(150)
|
||||||
|
.Then().FadeOut(200)
|
||||||
|
.Then().Expire();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user