Remove watched users on stop watching

This commit is contained in:
smoogipoo 2021-05-12 12:19:36 +09:00
parent 21fc0ba43b
commit ad11818868
2 changed files with 9 additions and 3 deletions

View File

@ -230,7 +230,7 @@ public virtual void WatchUser(int userId)
connection.SendAsync(nameof(ISpectatorServer.StartWatchingUser), userId);
}
public void StopWatchingUser(int userId)
public virtual void StopWatchingUser(int userId)
{
lock (userLock)
{

View File

@ -38,7 +38,8 @@ public void EndPlay(int userId, int beatmapId)
RulesetID = 0,
});
userSentStateDictionary[userId] = false;
userBeatmapDictionary.Remove(userId);
userSentStateDictionary.Remove(userId);
}
public void SendFrames(int userId, int index, int count)
@ -66,10 +67,15 @@ public override void WatchUser(int userId)
sendState(userId, userBeatmapDictionary[userId]);
base.WatchUser(userId);
watchingUsers.Add(userId);
}
public override void StopWatchingUser(int userId)
{
base.StopWatchingUser(userId);
watchingUsers.Remove(userId);
}
private void sendState(int userId, int beatmapId)
{
((ISpectatorClient)this).UserBeganPlaying(userId, new SpectatorState