private void sendFrames(int[] userIds, int count = 10) { AddStep("send frames", () => { foreach (int id in userIds) { SpectatorClient.SendFrames(id, count); } }); }
public void TestLeaderboardTracksCurrentTime() { AddStep("send frames", () => { // For player 1, send frames in sets of 1. // For player 2, send frames in sets of 10. for (int i = 0; i < 100; i++) { SpectatorClient.SendFrames(PLAYER_1_ID, 1); if (i % 10 == 0) { SpectatorClient.SendFrames(PLAYER_2_ID, 10); } } }); assertCombo(PLAYER_1_ID, 1); assertCombo(PLAYER_2_ID, 10); // Advance to a point where only user player 1's frame changes. setTime(500); assertCombo(PLAYER_1_ID, 5); assertCombo(PLAYER_2_ID, 10); // Advance to a point where both user's frame changes. setTime(1100); assertCombo(PLAYER_1_ID, 11); assertCombo(PLAYER_2_ID, 20); // Advance user player 2 only to a point where its frame changes. setTime(PLAYER_2_ID, 2100); assertCombo(PLAYER_1_ID, 11); assertCombo(PLAYER_2_ID, 30); // Advance both users beyond their last frame setTime(101 * 100); assertCombo(PLAYER_1_ID, 100); assertCombo(PLAYER_2_ID, 100); }
public void TestNegativeGameplayStartTime() { start(PLAYER_1_ID); loadSpectateScreen(false, -500); // to ensure negative gameplay start time does not affect spectator, send frames exactly after StartGameplay(). // (similar to real spectating sessions in which the first frames get sent between StartGameplay() and player load complete) AddStep("send frames at gameplay start", () => getInstance(PLAYER_1_ID).OnGameplayStarted += () => SpectatorClient.SendFrames(PLAYER_1_ID, 100)); AddUntilStep("wait for player load", () => spectatorScreen.AllPlayersLoaded); AddWaitStep("wait for progression", 3); assertNotCatchingUp(PLAYER_1_ID); assertRunning(PLAYER_1_ID); }