1
0
mirror of https://github.com/ppy/osu.git synced 2025-03-11 01:07:23 +08:00

Fix PlayerTeamFlag skinnable component not showing team details during replay

For now, let's fetch on demand.

Note that song select local leaderboard has the same issue. I feel we should be
doing a lot more cached lookups (probaly with persisting across game restarts).
Maybe even replacing the realm user storage. An issue for another day.
This commit is contained in:
Dean Herbert 2025-02-26 16:48:18 +09:00
parent b3965f0dd0
commit abc12abded
No known key found for this signature in database

View File

@ -3,8 +3,10 @@
using osu.Framework.Allocation;
using osu.Framework.Bindables;
using osu.Framework.Extensions;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Game.Database;
using osu.Game.Online.API;
using osu.Game.Online.API.Requests.Responses;
using osu.Game.Skinning;
@ -40,11 +42,20 @@ namespace osu.Game.Screens.Play.HUD
}
[BackgroundDependencyLoader]
private void load()
private void load(UserLookupCache userLookupCache)
{
if (gameplayState != null)
{
if (gameplayState.Score.ScoreInfo.User.Team != null)
flag.Team = gameplayState.Score.ScoreInfo.User.Team;
else
{
// We only store very basic information about a user to realm, so there's a high chance we don't have the team information.
userLookupCache.GetUserAsync(gameplayState.Score.ScoreInfo.User.Id)
.ContinueWith(task => Schedule(() => flag.Team = task.GetResultSafely()?.Team));
}
}
else
{
apiUser = api.LocalUser.GetBoundCopy();
apiUser.BindValueChanged(u => flag.Team = u.NewValue.Team, true);