mirror of
https://github.com/ppy/osu.git
synced 2026-05-18 02:49:53 +08:00
c231571f06
This is a prerequisite for supporting skinning of leaderboards. - New `IGameplayLeaderboardProvider` and `IGameplayLeaderboardScore` interfaces are introduced. They are strictly concerned with supplying leaderboard data. - Logic of managing display, which was previously jammed into the inheritance hierarchy of `GameplayLeaderboard`, is now moved into `IGameplayLeaderboardProvider` implementations. Solo play, multiplayer, and multiplayer spectator get their own implementation of the interface. - The inheritance hierarchy of `GameplayLeaderboard` and per-player overriding of the implementation of the gameplay leaderboard is gone. Only one drawable class (renamed to `DrawableGameplayLeaderboard`) is allowed to display the leaderboards, across all modes of play.
34 lines
1008 B
C#
34 lines
1008 B
C#
// 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;
|
|
using osu.Game.Online.Multiplayer;
|
|
|
|
namespace osu.Game.Screens.Select.Leaderboards
|
|
{
|
|
public partial class MultiSpectatorLeaderboardProvider : MultiplayerLeaderboardProvider
|
|
{
|
|
public MultiSpectatorLeaderboardProvider(MultiplayerRoomUser[] users)
|
|
: base(users)
|
|
{
|
|
}
|
|
|
|
public void AddClock(int userId, IClock clock)
|
|
{
|
|
if (!UserScores.TryGetValue(userId, out var data))
|
|
throw new ArgumentException(@"Provided user is not tracked by this leaderboard", nameof(userId));
|
|
|
|
data.ScoreProcessor.ReferenceClock = clock;
|
|
}
|
|
|
|
protected override void Update()
|
|
{
|
|
base.Update();
|
|
|
|
foreach (var (_, data) in UserScores)
|
|
data.ScoreProcessor.UpdateScore();
|
|
}
|
|
}
|
|
}
|