private void userSentFrames(int userId, FrameDataBundle bundle) { if (userId != score.ScoreInfo.User.Id) { return; } if (!LoadedBeatmapSuccessfully) { return; } if (!this.IsCurrentScreen()) { return; } bool isFirstBundle = score.Replay.Frames.Count == 0; foreach (var frame in bundle.Frames) { IConvertibleReplayFrame convertibleFrame = GameplayRuleset.CreateConvertibleReplayFrame(); convertibleFrame.FromLegacy(frame, GameplayBeatmap.PlayableBeatmap); var convertedFrame = (ReplayFrame)convertibleFrame; convertedFrame.Time = frame.Time; score.Replay.Frames.Add(convertedFrame); } if (isFirstBundle && score.Replay.Frames.Count > 0) { NonFrameStableSeek(score.Replay.Frames[0].Time); } }
private void userSentFrames(int userId, FrameDataBundle bundle) { lock (stateLock) { if (!userMap.ContainsKey(userId)) { return; } if (!gameplayStates.TryGetValue(userId, out var gameplayState)) { return; } // The ruleset instance should be guaranteed to be in sync with the score via ScoreLock. Debug.Assert(gameplayState.Ruleset != null && gameplayState.Ruleset.RulesetInfo.Equals(gameplayState.Score.ScoreInfo.Ruleset)); foreach (var frame in bundle.Frames) { IConvertibleReplayFrame convertibleFrame = gameplayState.Ruleset.CreateConvertibleReplayFrame(); convertibleFrame.FromLegacy(frame, gameplayState.Beatmap.Beatmap); var convertedFrame = (ReplayFrame)convertibleFrame; convertedFrame.Time = frame.Time; gameplayState.Score.Replay.Frames.Add(convertedFrame); } } }
private void userSentFrames(int userId, FrameDataBundle data) { // this is not scheduled as it handles propagation of frames even when in a child screen (at which point we are not alive). // probably not the safest way to handle this. if (userId != targetUser.Id) { return; } lock (scoreLock) { // this should never happen as the server sends the user's state on watching, // but is here as a safety measure. if (score == null) { return; } // rulesetInstance should be guaranteed to be in sync with the score via scoreLock. Debug.Assert(rulesetInstance != null && rulesetInstance.RulesetInfo.Equals(score.ScoreInfo.Ruleset)); foreach (var frame in data.Frames) { IConvertibleReplayFrame convertibleFrame = rulesetInstance.CreateConvertibleReplayFrame(); convertibleFrame.FromLegacy(frame, beatmap.Value.Beatmap); var convertedFrame = (ReplayFrame)convertibleFrame; convertedFrame.Time = frame.Time; score.Replay.Frames.Add(convertedFrame); } } }
private void userSentFrames(int userId, FrameDataBundle data) { if (userId != targetUser.Id) { return; } // this should never happen as the server sends the user's state on watching, // but is here as a safety measure. if (replay == null) { return; } foreach (var frame in data.Frames) { IConvertibleReplayFrame convertibleFrame = rulesetInstance.CreateConvertibleReplayFrame(); convertibleFrame.FromLegacy(frame, beatmap.Value.Beatmap); var convertedFrame = (ReplayFrame)convertibleFrame; convertedFrame.Time = frame.Time; replay.Frames.Add(convertedFrame); } }