mirror of
https://github.com/osukey/osukey.git
synced 2025-06-25 05:07:59 +09:00
Fix incorrect null handling in GameplayLeaderboard
This commit is contained in:
parent
545dcac4ec
commit
447a55ce11
@ -1,6 +1,7 @@
|
|||||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
||||||
// See the LICENCE file in the repository root for full licence text.
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
|
using JetBrains.Annotations;
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
using osu.Framework.Bindables;
|
using osu.Framework.Bindables;
|
||||||
using osu.Framework.Extensions.Color4Extensions;
|
using osu.Framework.Extensions.Color4Extensions;
|
||||||
@ -56,6 +57,7 @@ namespace osu.Game.Screens.Play.HUD
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[CanBeNull]
|
||||||
public User User { get; }
|
public User User { get; }
|
||||||
|
|
||||||
private readonly bool trackedPlayer;
|
private readonly bool trackedPlayer;
|
||||||
@ -68,7 +70,7 @@ namespace osu.Game.Screens.Play.HUD
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="user">The score's player.</param>
|
/// <param name="user">The score's player.</param>
|
||||||
/// <param name="trackedPlayer">Whether the player is the local user or a replay player.</param>
|
/// <param name="trackedPlayer">Whether the player is the local user or a replay player.</param>
|
||||||
public GameplayLeaderboardScore(User user, bool trackedPlayer)
|
public GameplayLeaderboardScore([CanBeNull] User user, bool trackedPlayer)
|
||||||
{
|
{
|
||||||
User = user;
|
User = user;
|
||||||
this.trackedPlayer = trackedPlayer;
|
this.trackedPlayer = trackedPlayer;
|
||||||
@ -180,7 +182,7 @@ namespace osu.Game.Screens.Play.HUD
|
|||||||
Origin = Anchor.CentreLeft,
|
Origin = Anchor.CentreLeft,
|
||||||
Colour = Color4.White,
|
Colour = Color4.White,
|
||||||
Font = OsuFont.Torus.With(size: 14, weight: FontWeight.SemiBold),
|
Font = OsuFont.Torus.With(size: 14, weight: FontWeight.SemiBold),
|
||||||
Text = User.Username,
|
Text = User?.Username,
|
||||||
Truncate = true,
|
Truncate = true,
|
||||||
Shadow = false,
|
Shadow = false,
|
||||||
}
|
}
|
||||||
|
@ -65,7 +65,7 @@ namespace osu.Game.Screens.Play.HUD
|
|||||||
var trackedUser = new TrackedUserData();
|
var trackedUser = new TrackedUserData();
|
||||||
|
|
||||||
userScores[userId] = trackedUser;
|
userScores[userId] = trackedUser;
|
||||||
var leaderboardScore = AddPlayer(resolvedUser, resolvedUser.Id == api.LocalUser.Value.Id);
|
var leaderboardScore = AddPlayer(resolvedUser, resolvedUser?.Id == api.LocalUser.Value.Id);
|
||||||
|
|
||||||
((IBindable<double>)leaderboardScore.Accuracy).BindTo(trackedUser.Accuracy);
|
((IBindable<double>)leaderboardScore.Accuracy).BindTo(trackedUser.Accuracy);
|
||||||
((IBindable<double>)leaderboardScore.TotalScore).BindTo(trackedUser.Score);
|
((IBindable<double>)leaderboardScore.TotalScore).BindTo(trackedUser.Score);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user