mirror of
https://github.com/ppy/osu.git
synced 2025-01-15 08:12:56 +08:00
Better limit bindable exposure of data class
This commit is contained in:
parent
6bce587b59
commit
a01bb3d5a3
@ -31,7 +31,7 @@ namespace osu.Game.Screens.Play.HUD
|
||||
/// </summary>
|
||||
/// <param name="currentScore">The bindable current score of the player.</param>
|
||||
/// <param name="user">The player.</param>
|
||||
public void AddPlayer([NotNull] BindableDouble currentScore, [NotNull] User user)
|
||||
public void AddPlayer([NotNull] IBindableNumber<double> currentScore, [NotNull] User user)
|
||||
{
|
||||
var scoreItem = addScore(currentScore.Value, user);
|
||||
currentScore.ValueChanged += s => scoreItem.TotalScore = s.NewValue;
|
||||
|
@ -96,11 +96,17 @@ namespace osu.Game.Screens.Play.HUD
|
||||
|
||||
private class TrackedUserData
|
||||
{
|
||||
public readonly BindableDouble Score = new BindableDouble();
|
||||
public IBindableNumber<double> Score => score;
|
||||
|
||||
public readonly BindableDouble Accuracy = new BindableDouble();
|
||||
private readonly BindableDouble score = new BindableDouble();
|
||||
|
||||
public readonly BindableInt CurrentCombo = new BindableInt();
|
||||
public IBindableNumber<double> Accuracy => accuracy;
|
||||
|
||||
private readonly BindableDouble accuracy = new BindableDouble();
|
||||
|
||||
public IBindableNumber<int> CurrentCombo => currentCombo;
|
||||
|
||||
private readonly BindableInt currentCombo = new BindableInt();
|
||||
|
||||
[CanBeNull]
|
||||
public FrameHeader LastHeader;
|
||||
@ -110,9 +116,9 @@ namespace osu.Game.Screens.Play.HUD
|
||||
if (LastHeader == null)
|
||||
return;
|
||||
|
||||
(Score.Value, Accuracy.Value) = processor.GetScoreAndAccuracy(mode, LastHeader.MaxCombo, LastHeader.Statistics);
|
||||
(score.Value, accuracy.Value) = processor.GetScoreAndAccuracy(mode, LastHeader.MaxCombo, LastHeader.Statistics);
|
||||
|
||||
CurrentCombo.Value = LastHeader.Combo;
|
||||
currentCombo.Value = LastHeader.Combo;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user