public override void SetUpSteps() { AddStep("create leaderboard", () => { leaderboard?.Expire(); OsuScoreProcessor scoreProcessor; Beatmap.Value = CreateWorkingBeatmap(Ruleset.Value); var playable = Beatmap.Value.GetPlayableBeatmap(Ruleset.Value); streamingClient.Start(Beatmap.Value.BeatmapInfo.OnlineBeatmapID ?? 0); Client.CurrentMatchPlayingUserIds.Clear(); Client.CurrentMatchPlayingUserIds.AddRange(streamingClient.PlayingUsers); Children = new Drawable[] { scoreProcessor = new OsuScoreProcessor(), }; scoreProcessor.ApplyBeatmap(playable); LoadComponentAsync(leaderboard = new MultiplayerGameplayLeaderboard(scoreProcessor, streamingClient.PlayingUsers.ToArray()) { Anchor = Anchor.Centre, Origin = Anchor.Centre, }, Add); }); AddUntilStep("wait for load", () => leaderboard.IsLoaded); }
private void load() { // todo: this should be implemented via a custom HUD implementation, and correctly masked to the main content area. LoadComponentAsync(leaderboard = new MultiplayerGameplayLeaderboard(ScoreProcessor, userIds), HUDOverlay.Add); HUDOverlay.Add(loadingDisplay = new LoadingLayer(true) { Depth = float.MaxValue }); if (Token == null) { return; // Todo: Somehow handle token retrieval failure. } client.MatchStarted += onMatchStarted; client.ResultsReady += onResultsReady; ScoreProcessor.HasCompleted.BindValueChanged(completed => { // wait for server to tell us that results are ready (see SubmitScore implementation) loadingDisplay.Show(); }); isConnected = client.IsConnected.GetBoundCopy(); isConnected.BindValueChanged(connected => { if (!connected.NewValue) { // messaging to the user about this disconnect will be provided by the MultiplayerMatchSubScreen. failAndBail(); } }, true); Debug.Assert(client.Room != null); }
public virtual void SetUpSteps() { AddStep("reset counts", () => { spectatorClient.Invocations.Clear(); lastHeaders.Clear(); }); AddStep("set local user", () => ((DummyAPIAccess)API).LocalUser.Value = new APIUser { Id = 1, }); AddStep("populate users", () => { MultiplayerUsers.Clear(); for (int i = 0; i < TOTAL_USERS; i++) { var user = CreateUser(i); MultiplayerUsers.Add(user); watchedUserStates[i] = new SpectatorState { BeatmapID = 0, RulesetID = 0, Mods = user.Mods, MaximumScoringValues = new ScoringValues { BaseScore = 10000, MaxCombo = 1000, CountBasicHitObjects = 1000 } }; } }); AddStep("create leaderboard", () => { Leaderboard?.Expire(); Beatmap.Value = CreateWorkingBeatmap(Ruleset.Value); LoadComponentAsync(Leaderboard = CreateLeaderboard(), Add); }); AddUntilStep("wait for load", () => Leaderboard.IsLoaded); AddStep("check watch requests were sent", () => { foreach (var user in MultiplayerUsers) { spectatorClient.Verify(s => s.WatchUser(user.UserID), Times.Once); } }); }
private void load() { // todo: this should be implemented via a custom HUD implementation, and correctly masked to the main content area. LoadComponentAsync(leaderboard = new MultiplayerGameplayLeaderboard(ScoreProcessor, userIds), HUDOverlay.Add); HUDOverlay.Add(loadingDisplay = new LoadingLayer(true) { Depth = float.MaxValue }); }
private void load() { if (!LoadedBeatmapSuccessfully) { return; } HUDOverlay.Add(leaderboardFlow = new FillFlowContainer { AutoSizeAxes = Axes.Both, Direction = FillDirection.Vertical, Spacing = new Vector2(5) }); HUDOverlay.HoldingForHUD.BindValueChanged(_ => updateLeaderboardExpandedState()); LocalUserPlaying.BindValueChanged(_ => updateLeaderboardExpandedState(), true); // todo: this should be implemented via a custom HUD implementation, and correctly masked to the main content area. LoadComponentAsync(leaderboard = new MultiplayerGameplayLeaderboard(users), l => { if (!LoadedBeatmapSuccessfully) { return; } leaderboard.Expanded.BindTo(leaderboardExpanded); leaderboardFlow.Insert(0, l); if (leaderboard.TeamScores.Count >= 2) { LoadComponentAsync(new GameplayMatchScoreDisplay { Team1Score = { BindTarget = leaderboard.TeamScores.First().Value }, Team2Score = { BindTarget = leaderboard.TeamScores.Last().Value }, Expanded = { BindTarget = HUDOverlay.ShowHud }, }, scoreDisplay => leaderboardFlow.Insert(1, scoreDisplay)); } }); LoadComponentAsync(new GameplayChatDisplay(Room) { Expanded = { BindTarget = leaderboardExpanded }, }, chat => leaderboardFlow.Insert(2, chat)); HUDOverlay.Add(loadingDisplay = new LoadingLayer(true) { Depth = float.MaxValue }); }
public virtual void SetUpSteps() { AddStep("reset counts", () => { spectatorClient.Invocations.Clear(); lastHeaders.Clear(); }); AddStep("set local user", () => ((DummyAPIAccess)API).LocalUser.Value = new APIUser { Id = 1, }); AddStep("populate users", () => { MultiplayerUsers.Clear(); for (int i = 0; i < total_users; i++) { MultiplayerUsers.Add(CreateUser(i)); } }); AddStep("create leaderboard", () => { Leaderboard?.Expire(); Beatmap.Value = CreateWorkingBeatmap(Ruleset.Value); var playableBeatmap = Beatmap.Value.GetPlayableBeatmap(Ruleset.Value); OsuScoreProcessor scoreProcessor = new OsuScoreProcessor(); scoreProcessor.ApplyBeatmap(playableBeatmap); Child = scoreProcessor; LoadComponentAsync(Leaderboard = CreateLeaderboard(scoreProcessor), Add); }); AddUntilStep("wait for load", () => Leaderboard.IsLoaded); AddStep("check watch requests were sent", () => { foreach (var user in MultiplayerUsers) { spectatorClient.Verify(s => s.WatchUser(user.UserID), Times.Once); } }); }
public override void SetUpSteps() { base.SetUpSteps(); AddStep("set local user", () => ((DummyAPIAccess)API).LocalUser.Value = LookupCache.GetUserAsync(1).Result); AddStep("create leaderboard", () => { leaderboard?.Expire(); OsuScoreProcessor scoreProcessor; Beatmap.Value = CreateWorkingBeatmap(Ruleset.Value); var playableBeatmap = Beatmap.Value.GetPlayableBeatmap(Ruleset.Value); var multiplayerUsers = new List <MultiplayerRoomUser>(); foreach (int user in users) { SpectatorClient.StartPlay(user, Beatmap.Value.BeatmapInfo.OnlineBeatmapID ?? 0); multiplayerUsers.Add(OnlinePlayDependencies.Client.AddUser(new APIUser { Id = user }, true)); } Children = new Drawable[] { scoreProcessor = new OsuScoreProcessor(), }; scoreProcessor.ApplyBeatmap(playableBeatmap); LoadComponentAsync(leaderboard = new MultiplayerGameplayLeaderboard(scoreProcessor, multiplayerUsers.ToArray()) { Anchor = Anchor.Centre, Origin = Anchor.Centre, }, Add); }); AddUntilStep("wait for load", () => leaderboard.IsLoaded); AddUntilStep("wait for user population", () => Client.CurrentMatchPlayingUserIds.Count > 0); }
private void load() { if (!LoadedBeatmapSuccessfully) { return; } HUDOverlay.Add(leaderboardFlow = new FillFlowContainer { AutoSizeAxes = Axes.Both, Direction = FillDirection.Vertical, }); // todo: this should be implemented via a custom HUD implementation, and correctly masked to the main content area. LoadComponentAsync(leaderboard = new MultiplayerGameplayLeaderboard(ScoreProcessor, users), l => { if (!LoadedBeatmapSuccessfully) { return; } ((IBindable <bool>)leaderboard.Expanded).BindTo(HUDOverlay.ShowHud); leaderboardFlow.Add(l); if (leaderboard.TeamScores.Count >= 2) { LoadComponentAsync(new GameplayMatchScoreDisplay { Team1Score = { BindTarget = leaderboard.TeamScores.First().Value }, Team2Score = { BindTarget = leaderboard.TeamScores.Last().Value }, Expanded = { BindTarget = HUDOverlay.ShowHud }, }, leaderboardFlow.Add); } }); HUDOverlay.Add(loadingDisplay = new LoadingLayer(true) { Depth = float.MaxValue }); }
public override void SetUpSteps() { AddStep("set local user", () => ((DummyAPIAccess)API).LocalUser.Value = lookupCache.GetUserAsync(1).Result); AddStep("create leaderboard", () => { leaderboard?.Expire(); OsuScoreProcessor scoreProcessor; Beatmap.Value = CreateWorkingBeatmap(Ruleset.Value); var playable = Beatmap.Value.GetPlayableBeatmap(Ruleset.Value); for (int i = 0; i < users; i++) { spectatorClient.StartPlay(i, Beatmap.Value.BeatmapInfo.OnlineBeatmapID ?? 0); } spectatorClient.Schedule(() => { Client.CurrentMatchPlayingUserIds.Clear(); Client.CurrentMatchPlayingUserIds.AddRange(spectatorClient.PlayingUsers); }); Children = new Drawable[] { scoreProcessor = new OsuScoreProcessor(), }; scoreProcessor.ApplyBeatmap(playable); LoadComponentAsync(leaderboard = new MultiplayerGameplayLeaderboard(scoreProcessor, spectatorClient.PlayingUsers.ToArray()) { Anchor = Anchor.Centre, Origin = Anchor.Centre, }, Add); }); AddUntilStep("wait for load", () => leaderboard.IsLoaded); AddUntilStep("wait for user population", () => Client.CurrentMatchPlayingUserIds.Count > 0); }
public override void SetUpSteps() { AddStep("set local user", () => ((DummyAPIAccess)API).LocalUser.Value = LookupCache.GetUserAsync(1).Result); AddStep("create leaderboard", () => { leaderboard?.Expire(); OsuScoreProcessor scoreProcessor; Beatmap.Value = CreateWorkingBeatmap(Ruleset.Value); var playableBeatmap = Beatmap.Value.GetPlayableBeatmap(Ruleset.Value); var multiplayerUsers = new List <MultiplayerRoomUser>(); foreach (var user in users) { SpectatorClient.StartPlay(user, Beatmap.Value.BeatmapInfo.OnlineBeatmapID ?? 0); var roomUser = OnlinePlayDependencies.Client.AddUser(new User { Id = user }, true); roomUser.MatchState = new TeamVersusUserState { TeamID = RNG.Next(0, 2) }; multiplayerUsers.Add(roomUser); } Children = new Drawable[] { scoreProcessor = new OsuScoreProcessor(), }; scoreProcessor.ApplyBeatmap(playableBeatmap); LoadComponentAsync(leaderboard = new MultiplayerGameplayLeaderboard(scoreProcessor, multiplayerUsers.ToArray()) { Anchor = Anchor.Centre, Origin = Anchor.Centre, }, gameplayLeaderboard => { LoadComponentAsync(new MatchScoreDisplay { Team1Score = { BindTarget = leaderboard.TeamScores[0] }, Team2Score = { BindTarget = leaderboard.TeamScores[1] } }, Add); LoadComponentAsync(gameplayScoreDisplay = new GameplayMatchScoreDisplay { Anchor = Anchor.BottomCentre, Origin = Anchor.BottomCentre, Team1Score = { BindTarget = leaderboard.TeamScores[0] }, Team2Score = { BindTarget = leaderboard.TeamScores[1] } }, Add); Add(gameplayLeaderboard); }); }); AddUntilStep("wait for load", () => leaderboard.IsLoaded); AddUntilStep("wait for user population", () => Client.CurrentMatchPlayingUserIds.Count > 0); }