mirror of
https://github.com/ppy/osu.git
synced 2024-12-14 14:32:55 +08:00
add new accuracy counter display
This commit is contained in:
parent
b4e748d97f
commit
3c32a50c12
@ -39,6 +39,16 @@ namespace osu.Game.Rulesets.Scoring
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public readonly BindableDouble Accuracy = new BindableDouble(1) { MinValue = 0, MaxValue = 1 };
|
public readonly BindableDouble Accuracy = new BindableDouble(1) { MinValue = 0, MaxValue = 1 };
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The accuracy which increase from 0%.
|
||||||
|
/// </summary>
|
||||||
|
public readonly BindableDouble IncreaseAccuracy = new BindableDouble(0) { MinValue = 0, MaxValue = 1 };
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The accuracy which Decrease from 100%.
|
||||||
|
/// </summary>
|
||||||
|
public readonly BindableDouble DecreaseAccuracy = new BindableDouble(0) { MinValue = 0, MaxValue = 1 };
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The current combo.
|
/// The current combo.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -264,6 +274,10 @@ namespace osu.Game.Rulesets.Scoring
|
|||||||
private void updateScore()
|
private void updateScore()
|
||||||
{
|
{
|
||||||
Accuracy.Value = currentMaximumScoringValues.BaseScore > 0 ? (double)currentScoringValues.BaseScore / currentMaximumScoringValues.BaseScore : 1;
|
Accuracy.Value = currentMaximumScoringValues.BaseScore > 0 ? (double)currentScoringValues.BaseScore / currentMaximumScoringValues.BaseScore : 1;
|
||||||
|
IncreaseAccuracy.Value = maximumScoringValues.BaseScore > 0 ? (double)currentScoringValues.BaseScore / maximumScoringValues.BaseScore : 0;
|
||||||
|
DecreaseAccuracy.Value = maximumScoringValues.BaseScore > 0
|
||||||
|
? (double)(maximumScoringValues.BaseScore - (currentMaximumScoringValues.BaseScore - currentScoringValues.BaseScore)) / maximumScoringValues.BaseScore
|
||||||
|
: 1;
|
||||||
TotalScore.Value = computeScore(Mode.Value, currentScoringValues, maximumScoringValues);
|
TotalScore.Value = computeScore(Mode.Value, currentScoringValues, maximumScoringValues);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4,6 +4,8 @@
|
|||||||
#nullable disable
|
#nullable disable
|
||||||
|
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
|
using osu.Framework.Bindables;
|
||||||
|
using osu.Game.Configuration;
|
||||||
using osu.Game.Graphics.UserInterface;
|
using osu.Game.Graphics.UserInterface;
|
||||||
using osu.Game.Rulesets.Scoring;
|
using osu.Game.Rulesets.Scoring;
|
||||||
|
|
||||||
@ -11,10 +13,38 @@ namespace osu.Game.Screens.Play.HUD
|
|||||||
{
|
{
|
||||||
public abstract partial class GameplayAccuracyCounter : PercentageCounter
|
public abstract partial class GameplayAccuracyCounter : PercentageCounter
|
||||||
{
|
{
|
||||||
|
[SettingSource("Accuracy Display Mode")]
|
||||||
|
public Bindable<AccuracyType> AccType { get; } = new Bindable<AccuracyType>();
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load(ScoreProcessor scoreProcessor)
|
private void load(ScoreProcessor scoreProcessor)
|
||||||
{
|
{
|
||||||
Current.BindTo(scoreProcessor.Accuracy);
|
AccType.BindValueChanged(mod =>
|
||||||
|
{
|
||||||
|
Current.UnbindBindings();
|
||||||
|
|
||||||
|
switch (mod.NewValue)
|
||||||
|
{
|
||||||
|
case AccuracyType.Current:
|
||||||
|
Current.BindTo(scoreProcessor.Accuracy);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case AccuracyType.Increase:
|
||||||
|
Current.BindTo(scoreProcessor.IncreaseAccuracy);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case AccuracyType.Decrease:
|
||||||
|
Current.BindTo(scoreProcessor.DecreaseAccuracy);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
public enum AccuracyType
|
||||||
|
{
|
||||||
|
Current,
|
||||||
|
Increase,
|
||||||
|
Decrease
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user