mirror of
https://github.com/ppy/osu.git
synced 2024-12-14 23:12:56 +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;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.Diagnostics;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using osu.Framework.Bindables;
|
using osu.Framework.Bindables;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
@ -54,7 +55,11 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer.Spectate
|
|||||||
MasterClock = master;
|
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);
|
public void RemovePlayerClock(ISpectatorPlayerClock clock) => playerClocks.Remove(clock);
|
||||||
|
|
||||||
|
@ -101,7 +101,13 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer.Spectate
|
|||||||
Expanded = { Value = true },
|
Expanded = { Value = true },
|
||||||
Anchor = Anchor.CentreLeft,
|
Anchor = Anchor.CentreLeft,
|
||||||
Origin = 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.ReadyToStart += onReadyToStart;
|
||||||
syncManager.MasterState.BindValueChanged(onMasterStateChanged, true);
|
syncManager.MasterState.BindValueChanged(onMasterStateChanged, true);
|
||||||
@ -166,14 +172,7 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer.Spectate
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected override void StartGameplay(int userId, GameplayState gameplayState)
|
protected override void StartGameplay(int userId, GameplayState gameplayState)
|
||||||
{
|
=> instances.Single(i => i.UserId == userId).LoadScore(gameplayState.Score);
|
||||||
var instance = instances.Single(i => i.UserId == userId);
|
|
||||||
|
|
||||||
instance.LoadScore(gameplayState.Score);
|
|
||||||
|
|
||||||
syncManager.AddPlayerClock(instance.GameplayClock);
|
|
||||||
leaderboard.AddClock(instance.UserId, instance.GameplayClock);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override void EndGameplay(int userId)
|
protected override void EndGameplay(int userId)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user