1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-14 04:02:59 +08:00

Show current grade

This commit is contained in:
EVAST9919 2017-09-23 19:52:44 +03:00
parent a69bef8ec0
commit 0615f375e1
4 changed files with 15 additions and 5 deletions

View File

@ -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;
}

View File

@ -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);
}
}
}

View File

@ -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<int> RankDisplay;
public InfoLine<ScoreRank> GradeDisplay;
public GradeInfoLine GradeDisplay;
public InfoContainer()
{
@ -41,7 +40,7 @@ namespace osu.Game.Screens.Play.BreaksOverlay
{
AccuracyDisplay = new PercentageInfoLine(@"Accuracy"),
RankDisplay = new InfoLine<int>(@"Rank", @"#"),
GradeDisplay = new InfoLine<ScoreRank>(@"Grade"),
GradeDisplay = new GradeInfoLine(@"Grade"),
},
}
};

View File

@ -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<double>
{
public GradeInfoLine(string name, string prefix = "") : base(name, prefix)
{
}
protected override string Format(double count) => $@"{ScoreProcessor.RankFrom(count)}";
}
}