mirror of
https://github.com/ppy/osu.git
synced 2024-11-13 21:27:54 +08:00
Add Rank as a property to the Score Processor
This commit is contained in:
parent
5ce2723719
commit
c2f487aa3e
@ -51,6 +51,11 @@ namespace osu.Game.Rulesets.Scoring
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public readonly BindableInt Combo = new BindableInt();
|
public readonly BindableInt Combo = new BindableInt();
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The current rank.
|
||||||
|
/// </summary>
|
||||||
|
public readonly Bindable<ScoreRank> Rank = new Bindable<ScoreRank>(ScoreRank.X);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// THe highest combo achieved by this score.
|
/// THe highest combo achieved by this score.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -74,9 +79,10 @@ namespace osu.Game.Rulesets.Scoring
|
|||||||
protected ScoreProcessor()
|
protected ScoreProcessor()
|
||||||
{
|
{
|
||||||
Combo.ValueChanged += delegate { HighestCombo.Value = Math.Max(HighestCombo.Value, Combo.Value); };
|
Combo.ValueChanged += delegate { HighestCombo.Value = Math.Max(HighestCombo.Value, Combo.Value); };
|
||||||
|
Accuracy.ValueChanged += delegate { Rank.Value = rankFrom(Accuracy.Value); };
|
||||||
}
|
}
|
||||||
|
|
||||||
public static ScoreRank RankFrom(double acc)
|
private ScoreRank rankFrom(double acc)
|
||||||
{
|
{
|
||||||
if (acc == 1)
|
if (acc == 1)
|
||||||
return ScoreRank.X;
|
return ScoreRank.X;
|
||||||
@ -101,6 +107,7 @@ namespace osu.Game.Rulesets.Scoring
|
|||||||
Accuracy.Value = 1;
|
Accuracy.Value = 1;
|
||||||
Health.Value = 1;
|
Health.Value = 1;
|
||||||
Combo.Value = 0;
|
Combo.Value = 0;
|
||||||
|
Rank.Value = ScoreRank.X;
|
||||||
HighestCombo.Value = 0;
|
HighestCombo.Value = 0;
|
||||||
|
|
||||||
alreadyFailed = false;
|
alreadyFailed = false;
|
||||||
@ -142,7 +149,7 @@ namespace osu.Game.Rulesets.Scoring
|
|||||||
score.Combo = Combo;
|
score.Combo = Combo;
|
||||||
score.MaxCombo = HighestCombo;
|
score.MaxCombo = HighestCombo;
|
||||||
score.Accuracy = Accuracy;
|
score.Accuracy = Accuracy;
|
||||||
score.Rank = RankFrom(Accuracy);
|
score.Rank = Rank;
|
||||||
score.Date = DateTimeOffset.Now;
|
score.Date = DateTimeOffset.Now;
|
||||||
score.Health = Health;
|
score.Health = Health;
|
||||||
}
|
}
|
||||||
|
@ -147,7 +147,7 @@ namespace osu.Game.Screens.Play.BreaksOverlay
|
|||||||
public void BindProcessor(ScoreProcessor processor)
|
public void BindProcessor(ScoreProcessor processor)
|
||||||
{
|
{
|
||||||
info.AccuracyDisplay.Current.BindTo(processor.Accuracy);
|
info.AccuracyDisplay.Current.BindTo(processor.Accuracy);
|
||||||
info.GradeDisplay.Current.BindTo(processor.Accuracy);
|
info.GradeDisplay.Current.BindTo(processor.Rank);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -5,6 +5,7 @@ using OpenTK;
|
|||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
using osu.Game.Graphics.Sprites;
|
using osu.Game.Graphics.Sprites;
|
||||||
|
using osu.Game.Rulesets.Scoring;
|
||||||
|
|
||||||
namespace osu.Game.Screens.Play.BreaksOverlay
|
namespace osu.Game.Screens.Play.BreaksOverlay
|
||||||
{
|
{
|
||||||
@ -12,7 +13,7 @@ namespace osu.Game.Screens.Play.BreaksOverlay
|
|||||||
{
|
{
|
||||||
public PercentageInfoLine AccuracyDisplay;
|
public PercentageInfoLine AccuracyDisplay;
|
||||||
public InfoLine<int> RankDisplay;
|
public InfoLine<int> RankDisplay;
|
||||||
public GradeInfoLine GradeDisplay;
|
public InfoLine<ScoreRank> GradeDisplay;
|
||||||
|
|
||||||
public InfoContainer()
|
public InfoContainer()
|
||||||
{
|
{
|
||||||
@ -40,7 +41,7 @@ namespace osu.Game.Screens.Play.BreaksOverlay
|
|||||||
{
|
{
|
||||||
AccuracyDisplay = new PercentageInfoLine("Accuracy"),
|
AccuracyDisplay = new PercentageInfoLine("Accuracy"),
|
||||||
RankDisplay = new InfoLine<int>("Rank", @"#"),
|
RankDisplay = new InfoLine<int>("Rank", @"#"),
|
||||||
GradeDisplay = new GradeInfoLine("Grade"),
|
GradeDisplay = new InfoLine<ScoreRank>("Grade"),
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -7,7 +7,6 @@ using osu.Framework.Graphics;
|
|||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
using osu.Game.Graphics;
|
using osu.Game.Graphics;
|
||||||
using osu.Game.Graphics.Sprites;
|
using osu.Game.Graphics.Sprites;
|
||||||
using osu.Game.Rulesets.Scoring;
|
|
||||||
|
|
||||||
namespace osu.Game.Screens.Play.BreaksOverlay
|
namespace osu.Game.Screens.Play.BreaksOverlay
|
||||||
{
|
{
|
||||||
@ -80,13 +79,4 @@ namespace osu.Game.Screens.Play.BreaksOverlay
|
|||||||
|
|
||||||
protected override string Format(double count) => $@"{count:P2}";
|
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)}";
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user