2021-04-09 16:31:14 +08:00
|
|
|
// 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.
|
|
|
|
|
|
|
|
using System;
|
|
|
|
using osu.Framework.Timing;
|
2021-08-06 19:06:57 +08:00
|
|
|
using osu.Game.Online.Multiplayer;
|
2021-04-09 16:31:14 +08:00
|
|
|
using osu.Game.Screens.Play.HUD;
|
|
|
|
|
|
|
|
namespace osu.Game.Screens.OnlinePlay.Multiplayer.Spectate
|
|
|
|
{
|
2021-04-22 22:39:02 +08:00
|
|
|
public class MultiSpectatorLeaderboard : MultiplayerGameplayLeaderboard
|
2021-04-09 16:31:14 +08:00
|
|
|
{
|
2022-05-30 18:18:38 +08:00
|
|
|
public MultiSpectatorLeaderboard(MultiplayerRoomUser[] users)
|
|
|
|
: base(users)
|
2021-04-09 16:31:14 +08:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2021-04-12 21:00:27 +08:00
|
|
|
public void AddClock(int userId, IClock clock)
|
|
|
|
{
|
|
|
|
if (!UserScores.TryGetValue(userId, out var data))
|
2021-07-06 13:56:00 +08:00
|
|
|
throw new ArgumentException(@"Provided user is not tracked by this leaderboard", nameof(userId));
|
2021-04-09 16:31:14 +08:00
|
|
|
|
2022-06-02 13:48:55 +08:00
|
|
|
data.ScoreProcessor.ProcessCustomClock = false;
|
2022-05-30 18:18:38 +08:00
|
|
|
data.ScoreProcessor.Clock = new FramedClock(clock);
|
2021-04-12 21:00:27 +08:00
|
|
|
}
|
2021-04-09 16:31:14 +08:00
|
|
|
|
|
|
|
protected override void Update()
|
|
|
|
{
|
|
|
|
base.Update();
|
|
|
|
|
2021-04-12 21:00:27 +08:00
|
|
|
foreach (var (_, data) in UserScores)
|
2022-05-30 18:18:38 +08:00
|
|
|
data.ScoreProcessor.UpdateScore();
|
2021-04-09 16:31:14 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|