mirror of
https://github.com/ppy/osu.git
synced 2024-12-14 08:43:01 +08:00
Fix clocks getting added a second time
This commit is contained in:
parent
8e04d73b67
commit
bfdbe3c3fe
@ -3,6 +3,7 @@
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Linq;
|
||||
using osu.Framework.Bindables;
|
||||
using osu.Framework.Graphics;
|
||||
@ -54,7 +55,11 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer.Spectate
|
||||
MasterClock = master;
|
||||
}
|
||||
|
||||
public void AddPlayerClock(ISpectatorPlayerClock clock) => playerClocks.Add(clock);
|
||||
public void AddPlayerClock(ISpectatorPlayerClock clock)
|
||||
{
|
||||
Debug.Assert(!playerClocks.Contains(clock));
|
||||
playerClocks.Add(clock);
|
||||
}
|
||||
|
||||
public void RemovePlayerClock(ISpectatorPlayerClock clock) => playerClocks.Remove(clock);
|
||||
|
||||
|
@ -101,7 +101,13 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer.Spectate
|
||||
Expanded = { Value = true },
|
||||
Anchor = Anchor.CentreLeft,
|
||||
Origin = Anchor.CentreLeft,
|
||||
}, leaderboardContainer.Add);
|
||||
}, l =>
|
||||
{
|
||||
foreach (var instance in instances)
|
||||
leaderboard.AddClock(instance.UserId, instance.GameplayClock);
|
||||
|
||||
leaderboardContainer.Add(leaderboard);
|
||||
});
|
||||
|
||||
syncManager.ReadyToStart += onReadyToStart;
|
||||
syncManager.MasterState.BindValueChanged(onMasterStateChanged, true);
|
||||
@ -166,14 +172,7 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer.Spectate
|
||||
}
|
||||
|
||||
protected override void StartGameplay(int userId, GameplayState gameplayState)
|
||||
{
|
||||
var instance = instances.Single(i => i.UserId == userId);
|
||||
|
||||
instance.LoadScore(gameplayState.Score);
|
||||
|
||||
syncManager.AddPlayerClock(instance.GameplayClock);
|
||||
leaderboard.AddClock(instance.UserId, instance.GameplayClock);
|
||||
}
|
||||
=> instances.Single(i => i.UserId == userId).LoadScore(gameplayState.Score);
|
||||
|
||||
protected override void EndGameplay(int userId)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user