Always create realtime-specific player elements regardless of token

This commit is contained in:
Bartłomiej Dach 2020-12-24 14:32:30 +01:00
parent 21a4e6a3f9
commit 76a7aabfe8
1 changed files with 5 additions and 10 deletions

View File

@ -4,7 +4,6 @@
using System;
using System.Diagnostics;
using System.Threading.Tasks;
using JetBrains.Annotations;
using osu.Framework.Allocation;
using osu.Framework.Bindables;
using osu.Framework.Logging;
@ -35,7 +34,6 @@ public class RealtimePlayer : TimeshiftPlayer
private readonly TaskCompletionSource<bool> resultsReady = new TaskCompletionSource<bool>();
[CanBeNull]
private MultiplayerGameplayLeaderboard leaderboard;
private readonly int[] userIds;
@ -61,6 +59,11 @@ public RealtimePlayer(PlaylistItem playlistItem, int[] userIds)
[BackgroundDependencyLoader]
private void load()
{
// todo: this should be implemented via a custom HUD implementation, and correctly masked to the main content area.
LoadComponentAsync(leaderboard = new MultiplayerGameplayLeaderboard(ScoreProcessor, userIds), HUDOverlay.Add);
HUDOverlay.Add(loadingDisplay = new LoadingLayer(DrawableRuleset) { Depth = float.MaxValue });
if (Token == null)
return; // Todo: Somehow handle token retrieval failure.
@ -84,11 +87,6 @@ private void load()
}, true);
Debug.Assert(client.Room != null);
// todo: this should be implemented via a custom HUD implementation, and correctly masked to the main content area.
LoadComponentAsync(leaderboard = new MultiplayerGameplayLeaderboard(ScoreProcessor, userIds), HUDOverlay.Add);
HUDOverlay.Add(loadingDisplay = new LoadingLayer(DrawableRuleset) { Depth = float.MaxValue });
}
protected override void StartGameplay()
@ -115,9 +113,6 @@ protected override void Update()
private void adjustLeaderboardPosition()
{
if (leaderboard == null)
return;
const float padding = 44; // enough margin to avoid the hit error display.
leaderboard.Position = new Vector2(