diff --git a/osu.Desktop.VisualTests/Tests/TestCaseTaikoPlayfield.cs b/osu.Desktop.VisualTests/Tests/TestCaseTaikoPlayfield.cs index 4568685fb1..2e20c44ab7 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseTaikoPlayfield.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseTaikoPlayfield.cs @@ -35,6 +35,7 @@ namespace osu.Desktop.VisualTests.Tests playfield.OnJudgement(new DrawableTestHit(new TaikoHitObject()) { + X = RNG.NextSingle(score == TaikoScoreResult.Good ? -0.1f : -0.05f, score == TaikoScoreResult.Good ? 0.1f : 0.05f), Judgement = new TaikoJudgementInfo { Result = HitResult.Hit, diff --git a/osu.Game.Modes.Taiko/UI/JudgementText.cs b/osu.Game.Modes.Taiko/UI/JudgementText.cs new file mode 100644 index 0000000000..b35f81b2a0 --- /dev/null +++ b/osu.Game.Modes.Taiko/UI/JudgementText.cs @@ -0,0 +1,126 @@ +using osu.Framework.Graphics; +using osu.Framework.Graphics.Containers; +using osu.Framework.Graphics.Transforms; +using osu.Game.Graphics.Sprites; +using OpenTK; +using OpenTK.Graphics; +using osu.Game.Modes.Taiko.Judgements; +using osu.Game.Modes.Objects.Drawables; +using osu.Framework.Allocation; +using osu.Game.Graphics; + +namespace osu.Game.Modes.Taiko.UI +{ + public class JudgementText : Container + { + public TaikoJudgementInfo Judgement; + + private Container textContainer; + private OsuSpriteText glowText; + private OsuSpriteText normalText; + + private int movementDirection; + + public JudgementText() + { + AutoSizeAxes = Axes.Both; + + Children = new Drawable[] + { + textContainer = new Container + { + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + + AutoSizeAxes = Axes.Both, + + Children = new Drawable[] + { + new BufferedContainer + { + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + + BlurSigma = new Vector2(10), + CacheDrawnFrameBuffer = true, + + RelativeSizeAxes = Axes.Both, + Size = new Vector2(3), + + BlendingMode = BlendingMode.Additive, + + Children = new[] + { + glowText = new OsuSpriteText + { + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + + Font = "Venera", + TextSize = 22f, + } + } + }, + normalText = new OsuSpriteText + { + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + + Font = "Venera", + TextSize = 22f, + } + } + } + }; + } + + [BackgroundDependencyLoader] + private void load(OsuColour colours) + { + Color4 judgementColour = Color4.White; + string judgementText = string.Empty; + + switch (Judgement.Result) + { + case HitResult.Miss: + judgementColour = colours.Red; + judgementText = "MISS"; + movementDirection = 1; + break; + case HitResult.Hit: + switch (Judgement.Score) + { + case TaikoScoreResult.Good: + judgementColour = colours.Green; + judgementText = "GOOD"; + textContainer.Scale = new Vector2(0.45f); + break; + case TaikoScoreResult.Great: + judgementColour = colours.Blue; + judgementText = "GREAT"; + break; + } + + movementDirection = -1; + break; + } + + glowText.Colour = judgementColour; + glowText.Text = normalText.Text = judgementText; + } + + protected override void LoadComplete() + { + base.LoadComplete(); + + ScaleTo(1.5f, 250, EasingTypes.OutQuint); + MoveToY(movementDirection * 100, 500); + + Delay(250); + ScaleTo(0.75f, 250); + FadeOut(250); + + Expire(); + } + } +} \ No newline at end of file diff --git a/osu.Game.Modes.Taiko/UI/TaikoPlayfield.cs b/osu.Game.Modes.Taiko/UI/TaikoPlayfield.cs index 7aeebc0bdf..2295f498c7 100644 --- a/osu.Game.Modes.Taiko/UI/TaikoPlayfield.cs +++ b/osu.Game.Modes.Taiko/UI/TaikoPlayfield.cs @@ -49,7 +49,7 @@ namespace osu.Game.Modes.Taiko.UI private HitTarget hitTarget; private Container ringExplosionContainer; //private Container barLineContainer; - //private Container judgementContainer; + private Container judgementContainer; private Container hitObjectContainer; private Container topLevelHitContainer; @@ -126,11 +126,11 @@ namespace osu.Game.Modes.Taiko.UI { RelativeSizeAxes = Axes.Both, }, - //judgementContainer = new Container - //{ - // RelativeSizeAxes = Axes.Both, - // BlendingMode = BlendingMode.Additive - //}, + judgementContainer = new Container + { + RelativeSizeAxes = Axes.Both, + BlendingMode = BlendingMode.Additive + }, }, }, } @@ -203,6 +203,19 @@ namespace osu.Game.Modes.Taiko.UI ScoreResult = judgedObject.Judgement.Score }); } + + float judgementOffset = judgedObject.Judgement.Result == HitResult.Hit ? judgedObject.Position.X : 0; + + judgementContainer.Add(new JudgementText + { + Anchor = judgedObject.Judgement.Result == HitResult.Hit ? Anchor.TopLeft : Anchor.BottomLeft, + Origin = judgedObject.Judgement.Result == HitResult.Hit ? Anchor.BottomCentre : Anchor.TopCentre, + + RelativePositionAxes = Axes.X, + X = judgementOffset, + + Judgement = judgedObject.Judgement + }); } } } \ No newline at end of file diff --git a/osu.Game.Modes.Taiko/osu.Game.Modes.Taiko.csproj b/osu.Game.Modes.Taiko/osu.Game.Modes.Taiko.csproj index a12c2aee22..372f9ba6fd 100644 --- a/osu.Game.Modes.Taiko/osu.Game.Modes.Taiko.csproj +++ b/osu.Game.Modes.Taiko/osu.Game.Modes.Taiko.csproj @@ -58,6 +58,7 @@ +