public new void Setup() => Schedule(() => { AvailabilityTracker.SelectedItem.BindTo(selectedItem); importedSet = beatmaps.GetAllUsableBeatmapSets().First(); Beatmap.Value = beatmaps.GetWorkingBeatmap(importedSet.Beatmaps.First()); selectedItem.Value = new PlaylistItem { Beatmap = { Value = Beatmap.Value.BeatmapInfo }, RulesetID = Beatmap.Value.BeatmapInfo.Ruleset.OnlineID, }; Child = new FillFlowContainer { AutoSizeAxes = Axes.Both, Direction = FillDirection.Vertical, Children = new Drawable[] { spectateButton = new MultiplayerSpectateButton { Anchor = Anchor.Centre, Origin = Anchor.Centre, Size = new Vector2(200, 50), OnSpectateClick = () => { readyClickOperation = OngoingOperationTracker.BeginOperation(); Task.Run(async() => { await MultiplayerClient.ToggleSpectate(); readyClickOperation.Dispose(); }); } }, readyButton = new MultiplayerReadyButton { Anchor = Anchor.Centre, Origin = Anchor.Centre, Size = new Vector2(200, 50), OnReadyClick = () => { readyClickOperation = OngoingOperationTracker.BeginOperation(); Task.Run(async() => { if (MultiplayerClient.IsHost && MultiplayerClient.LocalUser?.State == MultiplayerUserState.Ready) { await MultiplayerClient.StartMatch(); return; } await MultiplayerClient.ToggleReady(); readyClickOperation.Dispose(); }); } } } }; });
public new void Setup() => Schedule(() => { AvailabilityTracker.SelectedItem.BindTo(selectedItem); beatmaps.Import(TestResources.GetQuickTestBeatmapForImport()).WaitSafely(); importedSet = beatmaps.GetAllUsableBeatmapSets().First(); Beatmap.Value = beatmaps.GetWorkingBeatmap(importedSet.Beatmaps.First()); selectedItem.Value = new PlaylistItem(Beatmap.Value.BeatmapInfo) { RulesetID = Beatmap.Value.BeatmapInfo.Ruleset.OnlineID }; 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 (MultiplayerClient.IsHost && MultiplayerClient.LocalUser?.State == MultiplayerUserState.Ready) { await MultiplayerClient.StartMatch(); return; } await MultiplayerClient.ToggleReady(); readyClickOperation.Dispose(); }); } }); });