Exemplo n.º 1
0
        private void load()
        {
            Container leaderboardContainer;

            masterClockContainer = new MasterGameplayClockContainer(Beatmap.Value, 0);

            InternalChildren = new[]
            {
                (Drawable)(syncManager = new CatchUpSyncManager(masterClockContainer)),
                masterClockContainer.WithChild(new GridContainer
                {
                    RelativeSizeAxes = Axes.Both,
                    ColumnDimensions = new[]
                    {
                        new Dimension(GridSizeMode.AutoSize)
                    },
                    Content = new[]
                    {
                        new Drawable[]
                        {
                            leaderboardContainer = new Container
                            {
                                RelativeSizeAxes = Axes.Y,
                                AutoSizeAxes     = Axes.X
                            },
                            grid = new PlayerGrid {
                                RelativeSizeAxes = Axes.Both
                            }
                        }
                    }
                })
            };

            for (int i = 0; i < UserIds.Count; i++)
            {
                grid.Add(instances[i] = new PlayerArea(UserIds[i], masterClockContainer.GameplayClock));
                syncManager.AddPlayerClock(instances[i].GameplayClock);
            }

            // Todo: This is not quite correct - it should be per-user to adjust for other mod combinations.
            var playableBeatmap = Beatmap.Value.GetPlayableBeatmap(Ruleset.Value);
            var scoreProcessor  = Ruleset.Value.CreateInstance().CreateScoreProcessor();

            scoreProcessor.ApplyBeatmap(playableBeatmap);

            LoadComponentAsync(leaderboard = new MultiSpectatorLeaderboard(scoreProcessor, UserIds.ToArray())
            {
                Expanded = { Value = true },
                Anchor   = Anchor.CentreLeft,
                Origin   = Anchor.CentreLeft,
            }, leaderboardContainer.Add);
        }