diff --git a/osu.Game.Tests/Visual/Gameplay/TestSceneSpectator.cs b/osu.Game.Tests/Visual/Gameplay/TestSceneSpectator.cs index 558778c918..df4b85b37a 100644 --- a/osu.Game.Tests/Visual/Gameplay/TestSceneSpectator.cs +++ b/osu.Game.Tests/Visual/Gameplay/TestSceneSpectator.cs @@ -229,7 +229,7 @@ namespace osu.Game.Tests.Visual.Gameplay AddUntilStep("wait for screen load", () => spectatorScreen.LoadState == LoadState.Loaded); } - internal class TestSpectatorStreamingClient : SpectatorStreamingClient + public class TestSpectatorStreamingClient : SpectatorStreamingClient { public readonly User StreamingUser = new User { Id = 1234, Username = "Test user" }; diff --git a/osu.Game/Overlays/Dashboard/CurrentlyPlayingDisplay.cs b/osu.Game/Overlays/Dashboard/CurrentlyPlayingDisplay.cs index cb88065ec6..8832cb52ea 100644 --- a/osu.Game/Overlays/Dashboard/CurrentlyPlayingDisplay.cs +++ b/osu.Game/Overlays/Dashboard/CurrentlyPlayingDisplay.cs @@ -11,6 +11,7 @@ using osu.Framework.Screens; using osu.Game.Online.API; using osu.Game.Online.API.Requests; using osu.Game.Online.Spectator; +using osu.Game.Screens.Multi.Match.Components; using osu.Game.Screens.Play; using osu.Game.Users; using osuTK; @@ -21,7 +22,7 @@ namespace osu.Game.Overlays.Dashboard { private IBindableList playingUsers; - private FillFlowContainer userFlow; + private FillFlowContainer userFlow; [Resolved] private SpectatorStreamingClient spectatorStreaming { get; set; } @@ -32,7 +33,7 @@ namespace osu.Game.Overlays.Dashboard RelativeSizeAxes = Axes.X; AutoSizeAxes = Axes.Y; - InternalChild = userFlow = new FillFlowContainer + InternalChild = userFlow = new FillFlowContainer { RelativeSizeAxes = Axes.X, AutoSizeAxes = Axes.Y, @@ -78,19 +79,53 @@ namespace osu.Game.Overlays.Dashboard }), true); } - [Resolved(canBeNull: true)] - private OsuGame game { get; set; } - - private UserPanel createUserPanel(User user) - { - return new UserGridPanel(user).With(panel => + private PlayingUserPanel createUserPanel(User user) => + new PlayingUserPanel(user).With(panel => { panel.Anchor = Anchor.TopCentre; panel.Origin = Anchor.TopCentre; - panel.Width = 290; - panel.ShowProfileOnClick = false; - panel.Action = () => game?.PerformFromScreen(s => s.Push(new Spectator(user))); }); + + private class PlayingUserPanel : CompositeDrawable + { + public readonly User User; + + [Resolved(canBeNull: true)] + private OsuGame game { get; set; } + + public PlayingUserPanel(User user) + { + User = user; + + AutoSizeAxes = Axes.Both; + + InternalChildren = new Drawable[] + { + new FillFlowContainer + { + AutoSizeAxes = Axes.Both, + Direction = FillDirection.Vertical, + Spacing = new Vector2(2), + Children = new Drawable[] + { + new UserGridPanel(user) + { + Width = 290, + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + }, + new PurpleTriangleButton + { + Width = 290, + Text = "Watch", + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + Action = () => game?.PerformFromScreen(s => s.Push(new Spectator(user))) + } + } + }, + }; + } } } } diff --git a/osu.Game/Users/UserPanel.cs b/osu.Game/Users/UserPanel.cs index e97ff4287f..0981136dba 100644 --- a/osu.Game/Users/UserPanel.cs +++ b/osu.Game/Users/UserPanel.cs @@ -20,10 +20,12 @@ namespace osu.Game.Users { public readonly User User; + /// + /// Perform an action in addition to showing the user's profile. + /// This should be used to perform auxiliary tasks and not as a primary action for clicking a user panel (to maintain a consistent UX). + /// public new Action Action; - public bool ShowProfileOnClick = true; - protected Action ViewProfile { get; private set; } protected Drawable Background { get; private set; } @@ -70,8 +72,7 @@ namespace osu.Game.Users base.Action = ViewProfile = () => { Action?.Invoke(); - if (ShowProfileOnClick) - profileOverlay?.ShowUser(User); + profileOverlay?.ShowUser(User); }; }