Mark user as quit visually on the leaderboard

This commit is contained in:
Dean Herbert 2020-12-26 11:43:10 +09:00
parent 116acc2b5e
commit 71dcbeaf7c
3 changed files with 25 additions and 2 deletions

View File

@ -34,6 +34,7 @@ namespace osu.Game.Screens.Play.HUD
public BindableDouble TotalScore { get; } = new BindableDouble();
public BindableDouble Accuracy { get; } = new BindableDouble(1);
public BindableInt Combo { get; } = new BindableInt();
public BindableBool HasQuit { get; } = new BindableBool();
private int? scorePosition;
@ -230,6 +231,15 @@ namespace osu.Game.Screens.Play.HUD
TotalScore.BindValueChanged(v => scoreText.Text = v.NewValue.ToString("N0"), true);
Accuracy.BindValueChanged(v => accuracyText.Text = v.NewValue.FormatAccuracy(), true);
Combo.BindValueChanged(v => comboText.Text = $"{v.NewValue}x", true);
HasQuit.BindValueChanged(v =>
{
if (v.NewValue)
{
// we will probably want to display this in a better way once we have a design.
// and also show states other than quit.
panelColour = Color4.Gray;
}
}, true);
}
protected override void LoadComplete()
@ -244,6 +254,9 @@ namespace osu.Game.Screens.Play.HUD
private void updateColour()
{
if (HasQuit.Value)
return;
if (scorePosition == 1)
{
mainFillContainer.ResizeWidthTo(EXTENDED_WIDTH, panel_transition_duration, Easing.OutElastic);

View File

@ -10,5 +10,7 @@ namespace osu.Game.Screens.Play.HUD
BindableDouble TotalScore { get; }
BindableDouble Accuracy { get; }
BindableInt Combo { get; }
BindableBool HasQuit { get; }
}
}

View File

@ -71,6 +71,7 @@ namespace osu.Game.Screens.Play.HUD
((IBindable<double>)leaderboardScore.Accuracy).BindTo(trackedUser.Accuracy);
((IBindable<double>)leaderboardScore.TotalScore).BindTo(trackedUser.Score);
((IBindable<int>)leaderboardScore.Combo).BindTo(trackedUser.CurrentCombo);
((IBindable<bool>)leaderboardScore.HasQuit).BindTo(trackedUser.UserQuit);
}
scoringMode = config.GetBindable<ScoringMode>(OsuSetting.ScoreDisplayMode);
@ -81,8 +82,15 @@ namespace osu.Game.Screens.Play.HUD
{
base.LoadComplete();
playingUsers.BindCollectionChanged(usersChanged);
// BindableList handles binding in a really bad way (Clear then AddRange) so we need to do this manually..
foreach (int userId in playingUsers)
{
if (!multiplayerClient.PlayingUsers.Contains(userId))
usersChanged(this, new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Remove, new[] { userId }));
}
playingUsers.BindTo(multiplayerClient.PlayingUsers);
playingUsers.BindCollectionChanged(usersChanged);
}
private void usersChanged(object sender, NotifyCollectionChangedEventArgs e)
@ -157,7 +165,7 @@ namespace osu.Game.Screens.Play.HUD
public void UpdateScore(ScoreProcessor processor, ScoringMode mode)
{
Debug.Assert(UserQuit.Value);
Debug.Assert(!UserQuit.Value);
if (LastHeader == null)
return;