Exemplo n.º 1
0
        public void TestTeamDisplay()
        {
            AddStep("start players", () =>
            {
                var player1 = OnlinePlayDependencies.Client.AddUser(new User {
                    Id = PLAYER_1_ID
                }, true);
                player1.MatchState = new TeamVersusUserState
                {
                    TeamID = 0,
                };

                var player2 = OnlinePlayDependencies.Client.AddUser(new User {
                    Id = PLAYER_2_ID
                }, true);
                player2.MatchState = new TeamVersusUserState
                {
                    TeamID = 1,
                };

                SpectatorClient.StartPlay(player1.UserID, importedBeatmapId);
                SpectatorClient.StartPlay(player2.UserID, importedBeatmapId);

                playingUsers.Add(player1);
                playingUsers.Add(player2);
            });

            loadSpectateScreen();

            sendFrames(PLAYER_1_ID, 1000);
            sendFrames(PLAYER_2_ID, 1000);

            AddWaitStep("wait a bit", 20);
        }
Exemplo n.º 2
0
        public void TestDelayedStart()
        {
            AddStep("start players silently", () =>
            {
                OnlinePlayDependencies.Client.AddUser(new User {
                    Id = PLAYER_1_ID
                }, true);
                OnlinePlayDependencies.Client.AddUser(new User {
                    Id = PLAYER_2_ID
                }, true);

                playingUsers.Add(new MultiplayerRoomUser(PLAYER_1_ID));
                playingUsers.Add(new MultiplayerRoomUser(PLAYER_2_ID));
            });

            loadSpectateScreen(false);

            AddWaitStep("wait a bit", 10);
            AddStep("load player first_player_id", () => SpectatorClient.StartPlay(PLAYER_1_ID, importedBeatmapId));
            AddUntilStep("one player added", () => spectatorScreen.ChildrenOfType <Player>().Count() == 1);

            AddWaitStep("wait a bit", 10);
            AddStep("load player second_player_id", () => SpectatorClient.StartPlay(PLAYER_2_ID, importedBeatmapId));
            AddUntilStep("two players added", () => spectatorScreen.ChildrenOfType <Player>().Count() == 2);
        }
Exemplo n.º 3
0
 private void start(int[] userIds, int?beatmapId = null)
 {
     AddStep("start play", () =>
     {
         foreach (int id in userIds)
         {
             Client.CurrentMatchPlayingUserIds.Add(id);
             SpectatorClient.StartPlay(id, beatmapId ?? importedBeatmapId);
             playingUserIds.Add(id);
         }
     });
 }
Exemplo n.º 4
0
        private void start(int[] userIds, int?beatmapId = null)
        {
            AddStep("start play", () =>
            {
                foreach (int id in userIds)
                {
                    OnlinePlayDependencies.Client.AddUser(new User {
                        Id = id
                    }, true);

                    SpectatorClient.StartPlay(id, beatmapId ?? importedBeatmapId);
                    playingUsers.Add(new MultiplayerRoomUser(id));
                }
            });
        }
Exemplo n.º 5
0
        public new void SetUpSteps()
        {
            AddStep("reset", () =>
            {
                Clear();

                clocks = new Dictionary <int, ManualClock>
                {
                    { PLAYER_1_ID, new ManualClock() },
                    { PLAYER_2_ID, new ManualClock() }
                };

                foreach (var(userId, _) in clocks)
                {
                    SpectatorClient.StartPlay(userId, 0);
                }
            });
        public new void SetUpSteps()
        {
            AddStep("reset", () =>
            {
                Clear();

                clocks = new Dictionary <int, ManualClock>
                {
                    { PLAYER_1_ID, new ManualClock() },
                    { PLAYER_2_ID, new ManualClock() }
                };

                foreach ((int userId, var _) in clocks)
                {
                    SpectatorClient.StartPlay(userId, 0);
                    OnlinePlayDependencies.Client.AddUser(new APIUser {
                        Id = userId
                    });
                }
            });

            AddStep("create leaderboard", () =>
            {
                Beatmap.Value      = CreateWorkingBeatmap(Ruleset.Value);
                var playable       = Beatmap.Value.GetPlayableBeatmap(Ruleset.Value);
                var scoreProcessor = new OsuScoreProcessor();
                scoreProcessor.ApplyBeatmap(playable);

                LoadComponentAsync(leaderboard = new MultiSpectatorLeaderboard(scoreProcessor, clocks.Keys.Select(id => new MultiplayerRoomUser(id)).ToArray())
                {
                    Expanded = { Value = true }
                }, Add);
            });

            AddUntilStep("wait for load", () => leaderboard.IsLoaded);
            AddUntilStep("wait for user population", () => leaderboard.ChildrenOfType <GameplayLeaderboardScore>().Count() == 2);

            AddStep("add clock sources", () =>
            {
                foreach ((int userId, var clock) in clocks)
                {
                    leaderboard.AddClock(userId, clock);
                }
            });
        }
Exemplo n.º 7
0
        public void TestDelayedStart()
        {
            AddStep("start players silently", () =>
            {
                Client.CurrentMatchPlayingUserIds.Add(PLAYER_1_ID);
                Client.CurrentMatchPlayingUserIds.Add(PLAYER_2_ID);
                playingUserIds.Add(PLAYER_1_ID);
                playingUserIds.Add(PLAYER_2_ID);
            });

            loadSpectateScreen(false);

            AddWaitStep("wait a bit", 10);
            AddStep("load player first_player_id", () => SpectatorClient.StartPlay(PLAYER_1_ID, importedBeatmapId));
            AddUntilStep("one player added", () => spectatorScreen.ChildrenOfType <Player>().Count() == 1);

            AddWaitStep("wait a bit", 10);
            AddStep("load player second_player_id", () => SpectatorClient.StartPlay(PLAYER_2_ID, importedBeatmapId));
            AddUntilStep("two players added", () => spectatorScreen.ChildrenOfType <Player>().Count() == 2);
        }