From df0a31bf2aad29e74d76190ded0ffdca853803ed Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Mon, 11 Sep 2017 17:53:27 +0900 Subject: [PATCH 1/2] 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 @@ namespace osu.Game.Rulesets.Mania.Judgements /// 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 @@ namespace osu.Game.Rulesets.Mania.UI private List normalColumnColours = new List(); private Color4 specialColumnColour; + private readonly Container judgements; + private readonly int columnCount; public ManiaPlayfield(int columnCount) @@ -120,6 +122,14 @@ namespace osu.Game.Rulesets.Mania.UI 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 @@ namespace osu.Game.Rulesets.Mania.UI private void invertedChanged(bool newValue) { Scale = new Vector2(1, newValue ? -1 : 1); + judgements.Scale = Scale; } [BackgroundDependencyLoader] @@ -181,7 +192,17 @@ namespace osu.Game.Rulesets.Mania.UI } } - 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 @@ + From d66fb307dc0f8b0fa0cb2f546dfb96663a320174 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 11 Sep 2017 19:14:37 +0900 Subject: [PATCH 2/2] Fix wrong licence header --- osu.Game.Rulesets.Mania/UI/DrawableManiaJudgement.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game.Rulesets.Mania/UI/DrawableManiaJudgement.cs b/osu.Game.Rulesets.Mania/UI/DrawableManiaJudgement.cs index 8efc2262e1..55b9883918 100644 --- a/osu.Game.Rulesets.Mania/UI/DrawableManiaJudgement.cs +++ b/osu.Game.Rulesets.Mania/UI/DrawableManiaJudgement.cs @@ -1,5 +1,5 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . -// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu-framework/master/LICENCE +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using osu.Framework.Graphics; using osu.Game.Rulesets.Judgements;