From 7ac20c354530da66c50ce1ae4098ead412a3500d Mon Sep 17 00:00:00 2001 From: ProgrammaticNajel Date: Thu, 24 Jan 2019 16:11:24 +0800 Subject: [PATCH] Add overflow padding to account for parallax shifting Added overflow padding in the Multiplayer screen, and adjusting content (LoungeSubScreen, FilterControl, Header, "Create Room" button) to account for this padding. --- .../SearchableList/SearchableListFilterControl.cs | 12 +++++++++++- osu.Game/Screens/Multi/Header.cs | 2 +- .../Multi/Lounge/Components/FilterControl.cs | 2 ++ osu.Game/Screens/Multi/Lounge/LoungeSubScreen.cs | 4 ++-- osu.Game/Screens/Multi/Multiplayer.cs | 13 ++++++++++++- 5 files changed, 28 insertions(+), 5 deletions(-) diff --git a/osu.Game/Overlays/SearchableList/SearchableListFilterControl.cs b/osu.Game/Overlays/SearchableList/SearchableListFilterControl.cs index bd03ff9734..803ec2b27b 100644 --- a/osu.Game/Overlays/SearchableList/SearchableListFilterControl.cs +++ b/osu.Game/Overlays/SearchableList/SearchableListFilterControl.cs @@ -28,6 +28,12 @@ public abstract class SearchableListFilterControl : Container protected abstract T DefaultTab { get; } protected virtual Drawable CreateSupplementaryControls() => null; + /// + /// Add padding to internal components of the control. + /// This does not affect the background and the tab strip. + /// + protected virtual float InternalPadding => 0; + protected SearchableListFilterControl() { if (!typeof(T).IsEnum) @@ -62,7 +68,11 @@ protected SearchableListFilterControl() { RelativeSizeAxes = Axes.X, AutoSizeAxes = Axes.Y, - Padding = new MarginPadding { Top = padding, Horizontal = SearchableListOverlay.WIDTH_PADDING }, + Padding = new MarginPadding + { + Top = padding, + Horizontal = SearchableListOverlay.WIDTH_PADDING + InternalPadding + }, Children = new Drawable[] { Search = new FilterSearchTextBox diff --git a/osu.Game/Screens/Multi/Header.cs b/osu.Game/Screens/Multi/Header.cs index 2849fd89e0..874a58f26e 100644 --- a/osu.Game/Screens/Multi/Header.cs +++ b/osu.Game/Screens/Multi/Header.cs @@ -37,7 +37,7 @@ public Header(Screen initialScreen) new Container { RelativeSizeAxes = Axes.Both, - Padding = new MarginPadding { Horizontal = SearchableListOverlay.WIDTH_PADDING }, + Padding = new MarginPadding { Horizontal = SearchableListOverlay.WIDTH_PADDING + Multiplayer.OVERFLOW_PADDING }, Children = new Drawable[] { new FillFlowContainer diff --git a/osu.Game/Screens/Multi/Lounge/Components/FilterControl.cs b/osu.Game/Screens/Multi/Lounge/Components/FilterControl.cs index 286a4c18b0..c0a439a31a 100644 --- a/osu.Game/Screens/Multi/Lounge/Components/FilterControl.cs +++ b/osu.Game/Screens/Multi/Lounge/Components/FilterControl.cs @@ -13,6 +13,8 @@ public class FilterControl : SearchableListFilterControl OsuColour.FromHex(@"362e42"); protected override PrimaryFilter DefaultTab => PrimaryFilter.Open; + protected override float InternalPadding => Multiplayer.OVERFLOW_PADDING; + public FilterControl() { DisplayStyleControl.Hide(); diff --git a/osu.Game/Screens/Multi/Lounge/LoungeSubScreen.cs b/osu.Game/Screens/Multi/Lounge/LoungeSubScreen.cs index d9633218eb..dae556b3fb 100644 --- a/osu.Game/Screens/Multi/Lounge/LoungeSubScreen.cs +++ b/osu.Game/Screens/Multi/Lounge/LoungeSubScreen.cs @@ -91,8 +91,8 @@ protected override void UpdateAfterChildren() content.Padding = new MarginPadding { Top = Filter.DrawHeight, - Left = SearchableListOverlay.WIDTH_PADDING - DrawableRoom.SELECTION_BORDER_WIDTH, - Right = SearchableListOverlay.WIDTH_PADDING, + Left = SearchableListOverlay.WIDTH_PADDING - DrawableRoom.SELECTION_BORDER_WIDTH + Multiplayer.OVERFLOW_PADDING, + Right = SearchableListOverlay.WIDTH_PADDING + Multiplayer.OVERFLOW_PADDING, }; } diff --git a/osu.Game/Screens/Multi/Multiplayer.cs b/osu.Game/Screens/Multi/Multiplayer.cs index ce0eddbee3..5715c315f4 100644 --- a/osu.Game/Screens/Multi/Multiplayer.cs +++ b/osu.Game/Screens/Multi/Multiplayer.cs @@ -26,6 +26,11 @@ namespace osu.Game.Screens.Multi [Cached] public class Multiplayer : OsuScreen, IOnlineComponent { + /// + ///How much this container should overflow the sides of the screen to account for parallax shifting. + /// + public const float OVERFLOW_PADDING = 50; + private readonly MultiplayerWaveContainer waves; public override bool AllowBeatmapRulesetChange => currentSubScreen?.AllowBeatmapRulesetChange ?? base.AllowBeatmapRulesetChange; @@ -48,6 +53,12 @@ public Multiplayer() RelativeSizeAxes = Axes.Both, }; + Padding = new MarginPadding + { + Left = -OVERFLOW_PADDING, + Right = -OVERFLOW_PADDING + }; + waves.AddRange(new Drawable[] { new Container @@ -86,7 +97,7 @@ public Multiplayer() Margin = new MarginPadding { Top = 10, - Right = 10, + Right = 10 + OVERFLOW_PADDING, }, Text = "Create room", Action = () => loungeSubScreen.Push(new Room