Skip to content

Commit 38d807e

Browse files
authored
Merge pull request #32107 from peppy/fix-player-team-flag-replay
Fix `PlayerTeamFlag` skinnable component not showing team details during replay
2 parents b3965f0 + abc12ab commit 38d807e

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

osu.Game/Screens/Play/HUD/PlayerTeamFlag.cs

+13-2
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,10 @@
33

44
using osu.Framework.Allocation;
55
using osu.Framework.Bindables;
6+
using osu.Framework.Extensions;
67
using osu.Framework.Graphics;
78
using osu.Framework.Graphics.Containers;
9+
using osu.Game.Database;
810
using osu.Game.Online.API;
911
using osu.Game.Online.API.Requests.Responses;
1012
using osu.Game.Skinning;
@@ -40,10 +42,19 @@ public PlayerTeamFlag()
4042
}
4143

4244
[BackgroundDependencyLoader]
43-
private void load()
45+
private void load(UserLookupCache userLookupCache)
4446
{
4547
if (gameplayState != null)
46-
flag.Team = gameplayState.Score.ScoreInfo.User.Team;
48+
{
49+
if (gameplayState.Score.ScoreInfo.User.Team != null)
50+
flag.Team = gameplayState.Score.ScoreInfo.User.Team;
51+
else
52+
{
53+
// We only store very basic information about a user to realm, so there's a high chance we don't have the team information.
54+
userLookupCache.GetUserAsync(gameplayState.Score.ScoreInfo.User.Id)
55+
.ContinueWith(task => Schedule(() => flag.Team = task.GetResultSafely()?.Team));
56+
}
57+
}
4758
else
4859
{
4960
apiUser = api.LocalUser.GetBoundCopy();

0 commit comments

Comments
 (0)