From 29e7adcd3b195bc466cb7c434ce493c32e3e94c5 Mon Sep 17 00:00:00 2001 From: Sheppsu <49356627+Sheppsu@users.noreply.github.com> Date: Mon, 18 Nov 2024 03:57:50 -0500 Subject: [PATCH 1/9] add player settings to multi spectator screen --- .../Spectate/MultiSpectatorScreen.cs | 3 +- .../Spectate/MultiSpectatorSettings.cs | 81 +++++++++++++++++++ 2 files changed, 83 insertions(+), 1 deletion(-) create mode 100644 osu.Game/Screens/OnlinePlay/Multiplayer/Spectate/MultiSpectatorSettings.cs diff --git a/osu.Game/Screens/OnlinePlay/Multiplayer/Spectate/MultiSpectatorScreen.cs b/osu.Game/Screens/OnlinePlay/Multiplayer/Spectate/MultiSpectatorScreen.cs index cb00763e6b..841aaf7a45 100644 --- a/osu.Game/Screens/OnlinePlay/Multiplayer/Spectate/MultiSpectatorScreen.cs +++ b/osu.Game/Screens/OnlinePlay/Multiplayer/Spectate/MultiSpectatorScreen.cs @@ -126,7 +126,8 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer.Spectate syncManager = new SpectatorSyncManager(masterClockContainer) { ReadyToStart = performInitialSeek, - } + }, + new MultiSpectatorSettings() }; for (int i = 0; i < Users.Count; i++) diff --git a/osu.Game/Screens/OnlinePlay/Multiplayer/Spectate/MultiSpectatorSettings.cs b/osu.Game/Screens/OnlinePlay/Multiplayer/Spectate/MultiSpectatorSettings.cs new file mode 100644 index 0000000000..7ed6b95110 --- /dev/null +++ b/osu.Game/Screens/OnlinePlay/Multiplayer/Spectate/MultiSpectatorSettings.cs @@ -0,0 +1,81 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +using osu.Framework.Bindables; +using osu.Framework.Graphics; +using osu.Framework.Graphics.Containers; +using osu.Framework.Graphics.Sprites; +using osu.Game.Graphics.UserInterface; +using osu.Game.Screens.Play.HUD; +using osuTK; + +namespace osu.Game.Screens.OnlinePlay.Multiplayer.Spectate +{ + public partial class MultiSpectatorSettings : CompositeDrawable + { + private const double slide_duration = 200; + + private readonly PlayerSettingsOverlay playerSettingsOverlay; + private readonly Container slidingContainer; + + private readonly BindableBool opened = new BindableBool(); + + public MultiSpectatorSettings() + { + Origin = Anchor.TopLeft; + Anchor = Anchor.TopRight; + AutoSizeAxes = Axes.Both; + + InternalChildren = new Drawable[] + { + slidingContainer = new Container + { + Origin = Anchor.TopLeft, + Anchor = Anchor.TopLeft, + AutoSizeAxes = Axes.Both, + Children = new Drawable[] + { + new IconButton + { + Icon = FontAwesome.Solid.Cog, + Origin = Anchor.TopLeft, + Anchor = Anchor.TopLeft, + Scale = new Vector2(1f), + Position = new Vector2(-30, 0), + Action = () => opened.Toggle() + }, + playerSettingsOverlay = new PlayerSettingsOverlay() + } + } + }; + + playerSettingsOverlay.Show(); + + opened.BindValueChanged(value => + { + if (value.NewValue) + open(); + else + close(); + }); + } + + private void open() + { + slidingContainer.MoveToOffset(new Vector2(-playerSettingsOverlay.Width, 0), slide_duration, Easing.Out).Then().OnComplete(c => + { + c.Origin = Anchor.TopRight; + c.Position = Vector2.Zero; + }); + } + + private void close() + { + slidingContainer.MoveToOffset(new Vector2(playerSettingsOverlay.Width, 0), slide_duration, Easing.Out).Then().OnComplete(c => + { + c.Origin = Anchor.TopLeft; + c.Position = Vector2.Zero; + }); + } + } +} From 7d4062d2adba94f38805f9b59ad047ce3822f260 Mon Sep 17 00:00:00 2001 From: Sheppsu <49356627+Sheppsu@users.noreply.github.com> Date: Mon, 18 Nov 2024 04:04:28 -0500 Subject: [PATCH 2/9] remove redundant Scale attribute --- .../OnlinePlay/Multiplayer/Spectate/MultiSpectatorSettings.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/osu.Game/Screens/OnlinePlay/Multiplayer/Spectate/MultiSpectatorSettings.cs b/osu.Game/Screens/OnlinePlay/Multiplayer/Spectate/MultiSpectatorSettings.cs index 7ed6b95110..64c798b092 100644 --- a/osu.Game/Screens/OnlinePlay/Multiplayer/Spectate/MultiSpectatorSettings.cs +++ b/osu.Game/Screens/OnlinePlay/Multiplayer/Spectate/MultiSpectatorSettings.cs @@ -40,7 +40,6 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer.Spectate Icon = FontAwesome.Solid.Cog, Origin = Anchor.TopLeft, Anchor = Anchor.TopLeft, - Scale = new Vector2(1f), Position = new Vector2(-30, 0), Action = () => opened.Toggle() }, From 3713bb48b775c00da2fbbb6d86b98fc7b8ddafa5 Mon Sep 17 00:00:00 2001 From: Sheppsu <49356627+Sheppsu@users.noreply.github.com> Date: Sat, 23 Nov 2024 01:09:58 -0500 Subject: [PATCH 3/9] expand and contract settings from hover --- .../Spectate/MultiSpectatorSettings.cs | 78 +++++++------------ 1 file changed, 29 insertions(+), 49 deletions(-) diff --git a/osu.Game/Screens/OnlinePlay/Multiplayer/Spectate/MultiSpectatorSettings.cs b/osu.Game/Screens/OnlinePlay/Multiplayer/Spectate/MultiSpectatorSettings.cs index 64c798b092..dfb26d104a 100644 --- a/osu.Game/Screens/OnlinePlay/Multiplayer/Spectate/MultiSpectatorSettings.cs +++ b/osu.Game/Screens/OnlinePlay/Multiplayer/Spectate/MultiSpectatorSettings.cs @@ -1,80 +1,60 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -using osu.Framework.Bindables; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Sprites; +using osu.Framework.Input.Events; +using osu.Game.Graphics.Containers; using osu.Game.Graphics.UserInterface; using osu.Game.Screens.Play.HUD; -using osuTK; namespace osu.Game.Screens.OnlinePlay.Multiplayer.Spectate { - public partial class MultiSpectatorSettings : CompositeDrawable + public partial class MultiSpectatorSettings : ExpandingContainer { - private const double slide_duration = 200; - - private readonly PlayerSettingsOverlay playerSettingsOverlay; - private readonly Container slidingContainer; - - private readonly BindableBool opened = new BindableBool(); + public const float CONTRACTED_WIDTH = 30; + public const int EXPANDED_WIDTH = 300; public MultiSpectatorSettings() + : base(CONTRACTED_WIDTH, EXPANDED_WIDTH) { - Origin = Anchor.TopLeft; + Origin = Anchor.TopRight; Anchor = Anchor.TopRight; - AutoSizeAxes = Axes.Both; - InternalChildren = new Drawable[] + PlayerSettingsOverlay playerSettingsOverlay; + + InternalChild = new FillFlowContainer { - slidingContainer = new Container + Origin = Anchor.TopLeft, + Anchor = Anchor.TopLeft, + Direction = FillDirection.Horizontal, + AutoSizeAxes = Axes.Both, + Children = new Drawable[] { - Origin = Anchor.TopLeft, - Anchor = Anchor.TopLeft, - AutoSizeAxes = Axes.Both, - Children = new Drawable[] + new IconButton { - new IconButton - { - Icon = FontAwesome.Solid.Cog, - Origin = Anchor.TopLeft, - Anchor = Anchor.TopLeft, - Position = new Vector2(-30, 0), - Action = () => opened.Toggle() - }, - playerSettingsOverlay = new PlayerSettingsOverlay() + Icon = FontAwesome.Solid.Cog, + Origin = Anchor.TopLeft, + Anchor = Anchor.TopLeft, + Action = () => Expanded.Toggle() + }, + playerSettingsOverlay = new PlayerSettingsOverlay + { + Anchor = Anchor.TopLeft, + Origin = Anchor.TopLeft } } }; playerSettingsOverlay.Show(); - - opened.BindValueChanged(value => - { - if (value.NewValue) - open(); - else - close(); - }); } - private void open() + protected override void OnHoverLost(HoverLostEvent e) { - slidingContainer.MoveToOffset(new Vector2(-playerSettingsOverlay.Width, 0), slide_duration, Easing.Out).Then().OnComplete(c => - { - c.Origin = Anchor.TopRight; - c.Position = Vector2.Zero; - }); - } - - private void close() - { - slidingContainer.MoveToOffset(new Vector2(playerSettingsOverlay.Width, 0), slide_duration, Easing.Out).Then().OnComplete(c => - { - c.Origin = Anchor.TopLeft; - c.Position = Vector2.Zero; - }); + // Prevent unexpanding when hovering player settings + if (!Contains(e.ScreenSpaceMousePosition)) + base.OnHoverLost(e); } } } From 9c707ed3418b5bde88dd76d5d5f790fb69decb1b Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 27 Nov 2024 16:47:54 +0900 Subject: [PATCH 4/9] Rename class and fix padding considerations --- ...ings.cs => ExpandingPlayerSettingsOverlay.cs} | 16 ++++++++++++---- .../Multiplayer/Spectate/MultiSpectatorScreen.cs | 2 +- 2 files changed, 13 insertions(+), 5 deletions(-) rename osu.Game/Screens/OnlinePlay/Multiplayer/Spectate/{MultiSpectatorSettings.cs => ExpandingPlayerSettingsOverlay.cs} (75%) diff --git a/osu.Game/Screens/OnlinePlay/Multiplayer/Spectate/MultiSpectatorSettings.cs b/osu.Game/Screens/OnlinePlay/Multiplayer/Spectate/ExpandingPlayerSettingsOverlay.cs similarity index 75% rename from osu.Game/Screens/OnlinePlay/Multiplayer/Spectate/MultiSpectatorSettings.cs rename to osu.Game/Screens/OnlinePlay/Multiplayer/Spectate/ExpandingPlayerSettingsOverlay.cs index dfb26d104a..6ad53d4aeb 100644 --- a/osu.Game/Screens/OnlinePlay/Multiplayer/Spectate/MultiSpectatorSettings.cs +++ b/osu.Game/Screens/OnlinePlay/Multiplayer/Spectate/ExpandingPlayerSettingsOverlay.cs @@ -8,15 +8,21 @@ using osu.Framework.Input.Events; using osu.Game.Graphics.Containers; using osu.Game.Graphics.UserInterface; using osu.Game.Screens.Play.HUD; +using osuTK; namespace osu.Game.Screens.OnlinePlay.Multiplayer.Spectate { - public partial class MultiSpectatorSettings : ExpandingContainer + public partial class ExpandingPlayerSettingsOverlay : ExpandingContainer { - public const float CONTRACTED_WIDTH = 30; - public const int EXPANDED_WIDTH = 300; + private const float padding = 10; - public MultiSpectatorSettings() + public const float CONTRACTED_WIDTH = button_size + padding * 2; + public const float EXPANDED_WIDTH = player_settings_width + button_size + padding * 3; + + private const float player_settings_width = 270; + private const float button_size = IconButton.DEFAULT_BUTTON_SIZE; + + public ExpandingPlayerSettingsOverlay() : base(CONTRACTED_WIDTH, EXPANDED_WIDTH) { Origin = Anchor.TopRight; @@ -30,6 +36,8 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer.Spectate Anchor = Anchor.TopLeft, Direction = FillDirection.Horizontal, AutoSizeAxes = Axes.Both, + Margin = new MarginPadding(padding), + Spacing = new Vector2(padding), Children = new Drawable[] { new IconButton diff --git a/osu.Game/Screens/OnlinePlay/Multiplayer/Spectate/MultiSpectatorScreen.cs b/osu.Game/Screens/OnlinePlay/Multiplayer/Spectate/MultiSpectatorScreen.cs index 841aaf7a45..44d26a6dd0 100644 --- a/osu.Game/Screens/OnlinePlay/Multiplayer/Spectate/MultiSpectatorScreen.cs +++ b/osu.Game/Screens/OnlinePlay/Multiplayer/Spectate/MultiSpectatorScreen.cs @@ -127,7 +127,7 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer.Spectate { ReadyToStart = performInitialSeek, }, - new MultiSpectatorSettings() + new ExpandingPlayerSettingsOverlay() }; for (int i = 0; i < Users.Count; i++) From 782ce24ca67c08525ff8c4f3d4382c5627b6af8e Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 27 Nov 2024 17:09:13 +0900 Subject: [PATCH 5/9] Move player settings out of right flow --- osu.Game/Screens/Play/HUDOverlay.cs | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/osu.Game/Screens/Play/HUDOverlay.cs b/osu.Game/Screens/Play/HUDOverlay.cs index a6c2405eb6..62d9686aad 100644 --- a/osu.Game/Screens/Play/HUDOverlay.cs +++ b/osu.Game/Screens/Play/HUDOverlay.cs @@ -146,7 +146,6 @@ namespace osu.Game.Screens.Play Children = new Drawable[] { ModDisplay = CreateModsContainer(), - PlayerSettingsOverlay = CreatePlayerSettingsOverlay(), } }, bottomRightElements = new FillFlowContainer @@ -164,6 +163,7 @@ namespace osu.Game.Screens.Play HoldToQuit = CreateHoldForMenuButton(), } }, + PlayerSettingsOverlay = new PlayerSettingsOverlay(), LeaderboardFlow = new FillFlowContainer { AutoSizeAxes = Axes.Both, @@ -173,7 +173,7 @@ namespace osu.Game.Screens.Play }, }; - hideTargets = new List { mainComponents, topRightElements }; + hideTargets = new List { mainComponents, topRightElements, PlayerSettingsOverlay }; if (rulesetComponents != null) hideTargets.Add(rulesetComponents); @@ -389,8 +389,6 @@ namespace osu.Game.Screens.Play Origin = Anchor.TopRight, }; - protected PlayerSettingsOverlay CreatePlayerSettingsOverlay() => new PlayerSettingsOverlay(); - public bool OnPressed(KeyBindingPressEvent e) { if (e.Repeat) From 7fdf13911b7500a4cc9b08259655aabc49142142 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 27 Nov 2024 17:47:27 +0900 Subject: [PATCH 6/9] Adjust the colour of non-pinned settings groups' headers to be more legible --- osu.Game/Overlays/SettingsToolboxGroup.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Overlays/SettingsToolboxGroup.cs b/osu.Game/Overlays/SettingsToolboxGroup.cs index 53849fa53c..f8cf218564 100644 --- a/osu.Game/Overlays/SettingsToolboxGroup.cs +++ b/osu.Game/Overlays/SettingsToolboxGroup.cs @@ -184,7 +184,7 @@ namespace osu.Game.Overlays content.ResizeHeightTo(0, animate ? transition_duration : 0, Easing.OutQuint); } - headerContent.FadeColour(Expanded.Value ? Color4.White : OsuColour.Gray(0.5f), 200, Easing.OutQuint); + headerContent.FadeColour(Expanded.Value ? Color4.White : OsuColour.Gray(0.7f), 200, Easing.OutQuint); } private void updateFadeState() From 0f739418084d99925a0e91691ed459122aec23d1 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 27 Nov 2024 17:47:42 +0900 Subject: [PATCH 7/9] Combine new implementation back into the old one and use everywhere --- .../ExpandingPlayerSettingsOverlay.cs | 68 -------------- .../Spectate/MultiSpectatorScreen.cs | 2 +- .../Screens/Play/HUD/PlayerSettingsOverlay.cs | 88 +++++++++++++++---- 3 files changed, 74 insertions(+), 84 deletions(-) delete mode 100644 osu.Game/Screens/OnlinePlay/Multiplayer/Spectate/ExpandingPlayerSettingsOverlay.cs diff --git a/osu.Game/Screens/OnlinePlay/Multiplayer/Spectate/ExpandingPlayerSettingsOverlay.cs b/osu.Game/Screens/OnlinePlay/Multiplayer/Spectate/ExpandingPlayerSettingsOverlay.cs deleted file mode 100644 index 6ad53d4aeb..0000000000 --- a/osu.Game/Screens/OnlinePlay/Multiplayer/Spectate/ExpandingPlayerSettingsOverlay.cs +++ /dev/null @@ -1,68 +0,0 @@ -// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. -// See the LICENCE file in the repository root for full licence text. - -using osu.Framework.Graphics; -using osu.Framework.Graphics.Containers; -using osu.Framework.Graphics.Sprites; -using osu.Framework.Input.Events; -using osu.Game.Graphics.Containers; -using osu.Game.Graphics.UserInterface; -using osu.Game.Screens.Play.HUD; -using osuTK; - -namespace osu.Game.Screens.OnlinePlay.Multiplayer.Spectate -{ - public partial class ExpandingPlayerSettingsOverlay : ExpandingContainer - { - private const float padding = 10; - - public const float CONTRACTED_WIDTH = button_size + padding * 2; - public const float EXPANDED_WIDTH = player_settings_width + button_size + padding * 3; - - private const float player_settings_width = 270; - private const float button_size = IconButton.DEFAULT_BUTTON_SIZE; - - public ExpandingPlayerSettingsOverlay() - : base(CONTRACTED_WIDTH, EXPANDED_WIDTH) - { - Origin = Anchor.TopRight; - Anchor = Anchor.TopRight; - - PlayerSettingsOverlay playerSettingsOverlay; - - InternalChild = new FillFlowContainer - { - Origin = Anchor.TopLeft, - Anchor = Anchor.TopLeft, - Direction = FillDirection.Horizontal, - AutoSizeAxes = Axes.Both, - Margin = new MarginPadding(padding), - Spacing = new Vector2(padding), - Children = new Drawable[] - { - new IconButton - { - Icon = FontAwesome.Solid.Cog, - Origin = Anchor.TopLeft, - Anchor = Anchor.TopLeft, - Action = () => Expanded.Toggle() - }, - playerSettingsOverlay = new PlayerSettingsOverlay - { - Anchor = Anchor.TopLeft, - Origin = Anchor.TopLeft - } - } - }; - - playerSettingsOverlay.Show(); - } - - protected override void OnHoverLost(HoverLostEvent e) - { - // Prevent unexpanding when hovering player settings - if (!Contains(e.ScreenSpaceMousePosition)) - base.OnHoverLost(e); - } - } -} diff --git a/osu.Game/Screens/OnlinePlay/Multiplayer/Spectate/MultiSpectatorScreen.cs b/osu.Game/Screens/OnlinePlay/Multiplayer/Spectate/MultiSpectatorScreen.cs index 44d26a6dd0..33c3c60ed3 100644 --- a/osu.Game/Screens/OnlinePlay/Multiplayer/Spectate/MultiSpectatorScreen.cs +++ b/osu.Game/Screens/OnlinePlay/Multiplayer/Spectate/MultiSpectatorScreen.cs @@ -127,7 +127,7 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer.Spectate { ReadyToStart = performInitialSeek, }, - new ExpandingPlayerSettingsOverlay() + new PlayerSettingsOverlay() }; for (int i = 0; i < Users.Count; i++) diff --git a/osu.Game/Screens/Play/HUD/PlayerSettingsOverlay.cs b/osu.Game/Screens/Play/HUD/PlayerSettingsOverlay.cs index a2b49f6302..e68ca4da7a 100644 --- a/osu.Game/Screens/Play/HUD/PlayerSettingsOverlay.cs +++ b/osu.Game/Screens/Play/HUD/PlayerSettingsOverlay.cs @@ -1,46 +1,104 @@ -// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics; +using osu.Framework.Graphics.Colour; using osu.Framework.Graphics.Containers; -using osuTK; +using osu.Framework.Graphics.Shapes; +using osu.Framework.Graphics.Sprites; +using osu.Framework.Input; +using osu.Framework.Input.Events; +using osu.Game.Graphics.Containers; +using osu.Game.Graphics.UserInterface; using osu.Game.Screens.Play.PlayerSettings; +using osuTK; +using osuTK.Graphics; namespace osu.Game.Screens.Play.HUD { - public partial class PlayerSettingsOverlay : VisibilityContainer + public partial class PlayerSettingsOverlay : ExpandingContainer { + public VisualSettings VisualSettings { get; private set; } + + private const float padding = 10; + + public const float CONTRACTED_WIDTH = button_size + padding * 2; + public const float EXPANDED_WIDTH = player_settings_width + padding * 2; + + private const float player_settings_width = 270; + private const float button_size = IconButton.DEFAULT_BUTTON_SIZE; + + public override void Show() => this.FadeIn(fade_duration); + public override void Hide() => this.FadeOut(fade_duration); + private const int fade_duration = 200; - public readonly VisualSettings VisualSettings; + // we'll handle this ourselves because we have slightly custom logic. + protected override bool ExpandOnHover => false; protected override Container Content => content; private readonly FillFlowContainer content; - public PlayerSettingsOverlay() - { - Anchor = Anchor.TopRight; - Origin = Anchor.TopRight; - AutoSizeAxes = Axes.Both; + private readonly IconButton button; - InternalChild = content = new FillFlowContainer + private InputManager inputManager = null!; + + public PlayerSettingsOverlay() + : base(0, EXPANDED_WIDTH) + { + Origin = Anchor.TopRight; + Anchor = Anchor.TopRight; + + base.Content.Add(content = new FillFlowContainer { - Anchor = Anchor.TopRight, - Origin = Anchor.TopRight, AutoSizeAxes = Axes.Both, Direction = FillDirection.Vertical, Spacing = new Vector2(0, 20), + Margin = new MarginPadding(padding), Children = new PlayerSettingsGroup[] { VisualSettings = new VisualSettings { Expanded = { Value = false } }, new AudioSettings { Expanded = { Value = false } } } - }; + }); + + AddInternal(button = new IconButton + { + Icon = FontAwesome.Solid.Cog, + Origin = Anchor.TopRight, + Anchor = Anchor.TopLeft, + Margin = new MarginPadding(5), + Action = () => Expanded.Toggle() + }); + + AddInternal(new Box + { + Colour = ColourInfo.GradientHorizontal(Color4.Black.Opacity(0), Color4.Black.Opacity(0.8f)), + Depth = float.MaxValue, + RelativeSizeAxes = Axes.Both, + }); } - protected override void PopIn() => this.FadeIn(fade_duration); - protected override void PopOut() => this.FadeOut(fade_duration); + protected override void LoadComplete() + { + base.LoadComplete(); + + inputManager = GetContainingInputManager()!; + } + + protected override void Update() + { + base.Update(); + + Expanded.Value = inputManager.CurrentState.Mouse.Position.X >= button.ScreenSpaceDrawQuad.TopLeft.X; + } + + protected override void OnHoverLost(HoverLostEvent e) + { + // handle un-expanding manually because our children do weird hover blocking stuff. + } public void AddAtStart(PlayerSettingsGroup drawable) => content.Insert(-1, drawable); } From 6afe083ec96f218fbad7638630a6069a761404c9 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sun, 1 Dec 2024 18:44:26 +0900 Subject: [PATCH 8/9] Fix settings showing up during gameplay --- osu.Game/Screens/Play/HUD/PlayerSettingsOverlay.cs | 6 ++---- osu.Game/Screens/Play/HUDOverlay.cs | 12 ++++++++++-- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/osu.Game/Screens/Play/HUD/PlayerSettingsOverlay.cs b/osu.Game/Screens/Play/HUD/PlayerSettingsOverlay.cs index e68ca4da7a..18d7f6a503 100644 --- a/osu.Game/Screens/Play/HUD/PlayerSettingsOverlay.cs +++ b/osu.Game/Screens/Play/HUD/PlayerSettingsOverlay.cs @@ -23,17 +23,15 @@ namespace osu.Game.Screens.Play.HUD private const float padding = 10; - public const float CONTRACTED_WIDTH = button_size + padding * 2; public const float EXPANDED_WIDTH = player_settings_width + padding * 2; private const float player_settings_width = 270; - private const float button_size = IconButton.DEFAULT_BUTTON_SIZE; + + private const int fade_duration = 200; public override void Show() => this.FadeIn(fade_duration); public override void Hide() => this.FadeOut(fade_duration); - private const int fade_duration = 200; - // we'll handle this ourselves because we have slightly custom logic. protected override bool ExpandOnHover => false; diff --git a/osu.Game/Screens/Play/HUDOverlay.cs b/osu.Game/Screens/Play/HUDOverlay.cs index 62d9686aad..1c5277a8d9 100644 --- a/osu.Game/Screens/Play/HUDOverlay.cs +++ b/osu.Game/Screens/Play/HUDOverlay.cs @@ -88,6 +88,7 @@ namespace osu.Game.Screens.Play private readonly FillFlowContainer bottomRightElements; private readonly FillFlowContainer topRightElements; + private readonly Container rightSettings; internal readonly IBindable IsPlaying = new Bindable(); @@ -163,7 +164,14 @@ namespace osu.Game.Screens.Play HoldToQuit = CreateHoldForMenuButton(), } }, - PlayerSettingsOverlay = new PlayerSettingsOverlay(), + rightSettings = new Container + { + RelativeSizeAxes = Axes.Both, + Children = new Drawable[] + { + PlayerSettingsOverlay = new PlayerSettingsOverlay(), + } + }, LeaderboardFlow = new FillFlowContainer { AutoSizeAxes = Axes.Both, @@ -173,7 +181,7 @@ namespace osu.Game.Screens.Play }, }; - hideTargets = new List { mainComponents, topRightElements, PlayerSettingsOverlay }; + hideTargets = new List { mainComponents, topRightElements, rightSettings }; if (rulesetComponents != null) hideTargets.Add(rulesetComponents); From 23522b02d899a1a73b2ad56452dd932d7ff6ee3e Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sun, 1 Dec 2024 19:53:57 +0900 Subject: [PATCH 9/9] Use local instead of field for local only usage --- osu.Game/Screens/Play/HUDOverlay.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/osu.Game/Screens/Play/HUDOverlay.cs b/osu.Game/Screens/Play/HUDOverlay.cs index 1c5277a8d9..fca871e42f 100644 --- a/osu.Game/Screens/Play/HUDOverlay.cs +++ b/osu.Game/Screens/Play/HUDOverlay.cs @@ -88,7 +88,6 @@ namespace osu.Game.Screens.Play private readonly FillFlowContainer bottomRightElements; private readonly FillFlowContainer topRightElements; - private readonly Container rightSettings; internal readonly IBindable IsPlaying = new Bindable(); @@ -116,6 +115,8 @@ namespace osu.Game.Screens.Play public HUDOverlay([CanBeNull] DrawableRuleset drawableRuleset, IReadOnlyList mods, bool alwaysShowLeaderboard = true) { + Container rightSettings; + this.drawableRuleset = drawableRuleset; this.mods = mods;