public new void SetUpSteps()
        {
            MultiSpectatorLeaderboard leaderboard = null;

            AddStep("reset", () =>
            {
                Clear();

                foreach (var(userId, clock) in clocks)
                {
                    spectatorClient.EndPlay(userId);
                    clock.CurrentTime = 0;
                }
            });
示例#2
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.SendStartPlay(userId, 0);
                    OnlinePlayDependencies.MultiplayerClient.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(Ruleset.Value, 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);
                }
            });
        }