From 0615f375e1b206a55eb36fe0f396127cb0a10be2 Mon Sep 17 00:00:00 2001 From: EVAST9919 Date: Sat, 23 Sep 2017 19:52:44 +0300 Subject: [PATCH] Show current grade --- osu.Game/Rulesets/Scoring/ScoreProcessor.cs | 4 ++-- osu.Game/Screens/Play/BreaksOverlay/BreakOverlay.cs | 1 + osu.Game/Screens/Play/BreaksOverlay/InfoContainer.cs | 5 ++--- osu.Game/Screens/Play/BreaksOverlay/InfoLine.cs | 10 ++++++++++ 4 files changed, 15 insertions(+), 5 deletions(-) diff --git a/osu.Game/Rulesets/Scoring/ScoreProcessor.cs b/osu.Game/Rulesets/Scoring/ScoreProcessor.cs index deb87e92d8..e8dd87a6a6 100644 --- a/osu.Game/Rulesets/Scoring/ScoreProcessor.cs +++ b/osu.Game/Rulesets/Scoring/ScoreProcessor.cs @@ -76,7 +76,7 @@ namespace osu.Game.Rulesets.Scoring Combo.ValueChanged += delegate { HighestCombo.Value = Math.Max(HighestCombo.Value, Combo.Value); }; } - private ScoreRank rankFrom(double acc) + public static ScoreRank RankFrom(double acc) { if (acc == 1) return ScoreRank.X; @@ -142,7 +142,7 @@ namespace osu.Game.Rulesets.Scoring score.Combo = Combo; score.MaxCombo = HighestCombo; score.Accuracy = Accuracy; - score.Rank = rankFrom(Accuracy); + score.Rank = RankFrom(Accuracy); score.Date = DateTimeOffset.Now; score.Health = Health; } diff --git a/osu.Game/Screens/Play/BreaksOverlay/BreakOverlay.cs b/osu.Game/Screens/Play/BreaksOverlay/BreakOverlay.cs index e9dd112557..33fcebf3bb 100644 --- a/osu.Game/Screens/Play/BreaksOverlay/BreakOverlay.cs +++ b/osu.Game/Screens/Play/BreaksOverlay/BreakOverlay.cs @@ -124,6 +124,7 @@ namespace osu.Game.Screens.Play.BreaksOverlay public void BindProcessor(ScoreProcessor processor) { info.AccuracyDisplay.Current.BindTo(processor.Accuracy); + info.GradeDisplay.Current.BindTo(processor.Accuracy); } } } diff --git a/osu.Game/Screens/Play/BreaksOverlay/InfoContainer.cs b/osu.Game/Screens/Play/BreaksOverlay/InfoContainer.cs index f6c47d757f..4cff9372a3 100644 --- a/osu.Game/Screens/Play/BreaksOverlay/InfoContainer.cs +++ b/osu.Game/Screens/Play/BreaksOverlay/InfoContainer.cs @@ -5,7 +5,6 @@ using OpenTK; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Game.Graphics.Sprites; -using osu.Game.Rulesets.Scoring; namespace osu.Game.Screens.Play.BreaksOverlay { @@ -13,7 +12,7 @@ namespace osu.Game.Screens.Play.BreaksOverlay { public PercentageInfoLine AccuracyDisplay; public InfoLine RankDisplay; - public InfoLine GradeDisplay; + public GradeInfoLine GradeDisplay; public InfoContainer() { @@ -41,7 +40,7 @@ namespace osu.Game.Screens.Play.BreaksOverlay { AccuracyDisplay = new PercentageInfoLine(@"Accuracy"), RankDisplay = new InfoLine(@"Rank", @"#"), - GradeDisplay = new InfoLine(@"Grade"), + GradeDisplay = new GradeInfoLine(@"Grade"), }, } }; diff --git a/osu.Game/Screens/Play/BreaksOverlay/InfoLine.cs b/osu.Game/Screens/Play/BreaksOverlay/InfoLine.cs index 089dad6c38..bf486e2480 100644 --- a/osu.Game/Screens/Play/BreaksOverlay/InfoLine.cs +++ b/osu.Game/Screens/Play/BreaksOverlay/InfoLine.cs @@ -7,6 +7,7 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Game.Graphics; using osu.Game.Graphics.Sprites; +using osu.Game.Rulesets.Scoring; namespace osu.Game.Screens.Play.BreaksOverlay { @@ -74,4 +75,13 @@ namespace osu.Game.Screens.Play.BreaksOverlay protected override string Format(double count) => $@"{count:P2}"; } + + public class GradeInfoLine : InfoLine + { + public GradeInfoLine(string name, string prefix = "") : base(name, prefix) + { + } + + protected override string Format(double count) => $@"{ScoreProcessor.RankFrom(count)}"; + } }