mirror of
https://github.com/osukey/osukey.git
synced 2025-08-06 16:13:57 +09:00
Fix gameplay leaderboard not being sorted correctly in tie situations
This commit is contained in:
@ -88,6 +88,7 @@ namespace osu.Game.Screens.Play.HUD
|
|||||||
|
|
||||||
Flow.Add(drawable);
|
Flow.Add(drawable);
|
||||||
drawable.TotalScore.BindValueChanged(_ => sorting.Invalidate(), true);
|
drawable.TotalScore.BindValueChanged(_ => sorting.Invalidate(), true);
|
||||||
|
drawable.DisplayOrder.BindValueChanged(_ => sorting.Invalidate(), true);
|
||||||
|
|
||||||
int displayCount = Math.Min(Flow.Count, max_panels);
|
int displayCount = Math.Min(Flow.Count, max_panels);
|
||||||
Height = displayCount * (GameplayLeaderboardScore.PANEL_HEIGHT + Flow.Spacing.Y);
|
Height = displayCount * (GameplayLeaderboardScore.PANEL_HEIGHT + Flow.Spacing.Y);
|
||||||
@ -160,7 +161,10 @@ namespace osu.Game.Screens.Play.HUD
|
|||||||
if (sorting.IsValid)
|
if (sorting.IsValid)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
var orderedByScore = Flow.OrderByDescending(i => i.TotalScore.Value).ToList();
|
var orderedByScore = Flow
|
||||||
|
.OrderByDescending(i => i.TotalScore.Value)
|
||||||
|
.ThenBy(i => i.DisplayOrder.Value)
|
||||||
|
.ToList();
|
||||||
|
|
||||||
for (int i = 0; i < Flow.Count; i++)
|
for (int i = 0; i < Flow.Count; i++)
|
||||||
{
|
{
|
||||||
|
@ -55,6 +55,7 @@ namespace osu.Game.Screens.Play.HUD
|
|||||||
public BindableDouble Accuracy { get; } = new BindableDouble(1);
|
public BindableDouble Accuracy { get; } = new BindableDouble(1);
|
||||||
public BindableInt Combo { get; } = new BindableInt();
|
public BindableInt Combo { get; } = new BindableInt();
|
||||||
public BindableBool HasQuit { get; } = new BindableBool();
|
public BindableBool HasQuit { get; } = new BindableBool();
|
||||||
|
public Bindable<long> DisplayOrder { get; } = new Bindable<long>();
|
||||||
|
|
||||||
public Color4? BackgroundColour { get; set; }
|
public Color4? BackgroundColour { get; set; }
|
||||||
|
|
||||||
|
@ -14,5 +14,11 @@ namespace osu.Game.Screens.Play.HUD
|
|||||||
BindableInt Combo { get; }
|
BindableInt Combo { get; }
|
||||||
|
|
||||||
BindableBool HasQuit { get; }
|
BindableBool HasQuit { get; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// An optional value to guarantee stable ordering.
|
||||||
|
/// Lower numbers will appear higher in cases of <see cref="TotalScore"/> ties.
|
||||||
|
/// </summary>
|
||||||
|
Bindable<long> DisplayOrder { get; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -55,6 +55,9 @@ namespace osu.Game.Screens.Play.HUD
|
|||||||
local.Accuracy.BindTarget = scoreProcessor.Accuracy;
|
local.Accuracy.BindTarget = scoreProcessor.Accuracy;
|
||||||
local.Combo.BindTarget = scoreProcessor.Combo;
|
local.Combo.BindTarget = scoreProcessor.Combo;
|
||||||
|
|
||||||
|
// Local score should always show lower than any existing scores in cases of ties.
|
||||||
|
local.DisplayOrder.Value = long.MaxValue;
|
||||||
|
|
||||||
foreach (var s in scores)
|
foreach (var s in scores)
|
||||||
{
|
{
|
||||||
var score = Add(s.User, false);
|
var score = Add(s.User, false);
|
||||||
@ -67,6 +70,7 @@ namespace osu.Game.Screens.Play.HUD
|
|||||||
|
|
||||||
score.Accuracy.Value = s.Accuracy;
|
score.Accuracy.Value = s.Accuracy;
|
||||||
score.Combo.Value = s.MaxCombo;
|
score.Combo.Value = s.MaxCombo;
|
||||||
|
score.DisplayOrder.Value = s.OnlineID > 0 ? s.OnlineID : s.Date.ToUnixTimeSeconds();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user