public new void Setup() => Schedule(() =>
        {
            AvailabilityTracker.SelectedItem.BindTo(selectedItem);

            importedSet        = beatmaps.GetAllUsableBeatmapSetsEnumerable(IncludedDetails.All).First();
            Beatmap.Value      = beatmaps.GetWorkingBeatmap(importedSet.Beatmaps.First());
            selectedItem.Value = new PlaylistItem
            {
                Beatmap = { Value = Beatmap.Value.BeatmapInfo },
                Ruleset = { Value = Beatmap.Value.BeatmapInfo.Ruleset },
            };

            if (button != null)
            {
                Remove(button);
            }

            Add(button = new MultiplayerReadyButton
            {
                Anchor       = Anchor.Centre,
                Origin       = Anchor.Centre,
                Size         = new Vector2(200, 50),
                OnReadyClick = () =>
                {
                    readyClickOperation = OngoingOperationTracker.BeginOperation();

                    Task.Run(async() =>
                    {
                        if (Client.IsHost && Client.LocalUser?.State == MultiplayerUserState.Ready)
                        {
                            await Client.StartMatch();
                            return;
                        }

                        await Client.ToggleReady();

                        readyClickOperation.Dispose();
                    });
                }
            });
        });
示例#2
0
        public new void Setup() => Schedule(() =>
        {
            var beatmap = beatmaps.GetAllUsableBeatmapSetsEnumerable(IncludedDetails.All).First().Beatmaps.First();

            Beatmap.Value = beatmaps.GetWorkingBeatmap(beatmap);

            Child = button = new MultiplayerReadyButton
            {
                Anchor       = Anchor.Centre,
                Origin       = Anchor.Centre,
                Size         = new Vector2(200, 50),
                SelectedItem =
                {
                    Value       = new PlaylistItem
                    {
                        Beatmap = { Value = beatmap         },
                        Ruleset = { Value = beatmap.Ruleset }
                    }
                }
            };
        });