From df0a31bf2aad29e74d76190ded0ffdca853803ed Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Mon, 11 Sep 2017 17:53:27 +0900 Subject: [PATCH] Add judgement text displays to osu!mania --- .../Judgements/ManiaJudgement.cs | 5 ++- .../UI/DrawableManiaJudgement.cs | 38 +++++++++++++++++++ osu.Game.Rulesets.Mania/UI/ManiaPlayfield.cs | 23 ++++++++++- .../osu.Game.Rulesets.Mania.csproj | 1 + 4 files changed, 64 insertions(+), 3 deletions(-) create mode 100644 osu.Game.Rulesets.Mania/UI/DrawableManiaJudgement.cs diff --git a/osu.Game.Rulesets.Mania/Judgements/ManiaJudgement.cs b/osu.Game.Rulesets.Mania/Judgements/ManiaJudgement.cs index 33083ca0f5..f8602ac42a 100644 --- a/osu.Game.Rulesets.Mania/Judgements/ManiaJudgement.cs +++ b/osu.Game.Rulesets.Mania/Judgements/ManiaJudgement.cs @@ -1,6 +1,7 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE +using osu.Framework.Extensions; using osu.Game.Rulesets.Judgements; using osu.Game.Rulesets.Objects.Drawables; @@ -33,9 +34,9 @@ public class ManiaJudgement : Judgement /// public int MaxResultValueForAccuracy => NumericResultForAccuracy(MAX_HIT_RESULT); - public override string ResultString => string.Empty; + public override string ResultString => ManiaResult.GetDescription(); - public override string MaxResultString => string.Empty; + public override string MaxResultString => MAX_HIT_RESULT.GetDescription(); /// /// The hit result. diff --git a/osu.Game.Rulesets.Mania/UI/DrawableManiaJudgement.cs b/osu.Game.Rulesets.Mania/UI/DrawableManiaJudgement.cs new file mode 100644 index 0000000000..8efc2262e1 --- /dev/null +++ b/osu.Game.Rulesets.Mania/UI/DrawableManiaJudgement.cs @@ -0,0 +1,38 @@ +// Copyright (c) 2007-2017 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu-framework/master/LICENCE + +using osu.Framework.Graphics; +using osu.Game.Rulesets.Judgements; +using osu.Game.Rulesets.Mania.Judgements; +using osu.Game.Rulesets.Objects.Drawables; + +namespace osu.Game.Rulesets.Mania.UI +{ + internal class DrawableManiaJudgement : DrawableJudgement + { + public DrawableManiaJudgement(ManiaJudgement judgement) + : base(judgement) + { + JudgementText.TextSize = 25; + } + + protected override void LoadComplete() + { + base.LoadComplete(); + + this.FadeInFromZero(50, Easing.OutQuint); + + switch (Judgement.Result) + { + case HitResult.Hit: + this.ScaleTo(0.8f); + this.ScaleTo(1, 250, Easing.OutElastic); + + this.Delay(50).FadeOut(200).ScaleTo(0.75f, 250); + break; + } + + Expire(); + } + } +} diff --git a/osu.Game.Rulesets.Mania/UI/ManiaPlayfield.cs b/osu.Game.Rulesets.Mania/UI/ManiaPlayfield.cs index 5697da537e..b333dfe1d5 100644 --- a/osu.Game.Rulesets.Mania/UI/ManiaPlayfield.cs +++ b/osu.Game.Rulesets.Mania/UI/ManiaPlayfield.cs @@ -53,6 +53,8 @@ public SpecialColumnPosition SpecialColumnPosition private List normalColumnColours = new List(); private Color4 specialColumnColour; + private readonly Container judgements; + private readonly int columnCount; public ManiaPlayfield(int columnCount) @@ -120,6 +122,14 @@ public ManiaPlayfield(int columnCount) Padding = new MarginPadding { Top = HIT_TARGET_POSITION } } }, + judgements = new Container + { + Anchor = Anchor.TopCentre, + Origin = Anchor.Centre, + AutoSizeAxes = Axes.Both, + Y = HIT_TARGET_POSITION + 150, + BypassAutoSizeAxes = Axes.Both + }, topLevelContainer = new Container { RelativeSizeAxes = Axes.Both } } } @@ -147,6 +157,7 @@ public ManiaPlayfield(int columnCount) private void invertedChanged(bool newValue) { Scale = new Vector2(1, newValue ? -1 : 1); + judgements.Scale = Scale; } [BackgroundDependencyLoader] @@ -181,7 +192,17 @@ private void load(OsuColour colours) } } - public override void OnJudgement(DrawableHitObject judgedObject) => columns[judgedObject.HitObject.Column].OnJudgement(judgedObject); + public override void OnJudgement(DrawableHitObject judgedObject) + { + columns[judgedObject.HitObject.Column].OnJudgement(judgedObject); + + judgements.Clear(); + judgements.Add(new DrawableManiaJudgement(judgedObject.Judgement) + { + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + }); + } /// /// Whether the column index is a special column for this playfield. diff --git a/osu.Game.Rulesets.Mania/osu.Game.Rulesets.Mania.csproj b/osu.Game.Rulesets.Mania/osu.Game.Rulesets.Mania.csproj index f9d8f6b358..ef098a023d 100644 --- a/osu.Game.Rulesets.Mania/osu.Game.Rulesets.Mania.csproj +++ b/osu.Game.Rulesets.Mania/osu.Game.Rulesets.Mania.csproj @@ -83,6 +83,7 @@ +