1
0
mirror of https://github.com/ppy/osu.git synced 2025-02-15 00:53:10 +08:00

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.
This commit is contained in:
ProgrammaticNajel 2019-01-24 16:11:24 +08:00
parent d53386cf4b
commit 7ac20c3545
5 changed files with 28 additions and 5 deletions

View File

@ -28,6 +28,12 @@ namespace osu.Game.Overlays.SearchableList
protected abstract T DefaultTab { get; } protected abstract T DefaultTab { get; }
protected virtual Drawable CreateSupplementaryControls() => null; protected virtual Drawable CreateSupplementaryControls() => null;
/// <summary>
/// Add padding to internal components of the control.
/// This does not affect the background and the tab strip.
/// </summary>
protected virtual float InternalPadding => 0;
protected SearchableListFilterControl() protected SearchableListFilterControl()
{ {
if (!typeof(T).IsEnum) if (!typeof(T).IsEnum)
@ -62,7 +68,11 @@ namespace osu.Game.Overlays.SearchableList
{ {
RelativeSizeAxes = Axes.X, RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y, 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[] Children = new Drawable[]
{ {
Search = new FilterSearchTextBox Search = new FilterSearchTextBox

View File

@ -37,7 +37,7 @@ namespace osu.Game.Screens.Multi
new Container new Container
{ {
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,
Padding = new MarginPadding { Horizontal = SearchableListOverlay.WIDTH_PADDING }, Padding = new MarginPadding { Horizontal = SearchableListOverlay.WIDTH_PADDING + Multiplayer.OVERFLOW_PADDING },
Children = new Drawable[] Children = new Drawable[]
{ {
new FillFlowContainer new FillFlowContainer

View File

@ -13,6 +13,8 @@ namespace osu.Game.Screens.Multi.Lounge.Components
protected override Color4 BackgroundColour => OsuColour.FromHex(@"362e42"); protected override Color4 BackgroundColour => OsuColour.FromHex(@"362e42");
protected override PrimaryFilter DefaultTab => PrimaryFilter.Open; protected override PrimaryFilter DefaultTab => PrimaryFilter.Open;
protected override float InternalPadding => Multiplayer.OVERFLOW_PADDING;
public FilterControl() public FilterControl()
{ {
DisplayStyleControl.Hide(); DisplayStyleControl.Hide();

View File

@ -91,8 +91,8 @@ namespace osu.Game.Screens.Multi.Lounge
content.Padding = new MarginPadding content.Padding = new MarginPadding
{ {
Top = Filter.DrawHeight, Top = Filter.DrawHeight,
Left = SearchableListOverlay.WIDTH_PADDING - DrawableRoom.SELECTION_BORDER_WIDTH, Left = SearchableListOverlay.WIDTH_PADDING - DrawableRoom.SELECTION_BORDER_WIDTH + Multiplayer.OVERFLOW_PADDING,
Right = SearchableListOverlay.WIDTH_PADDING, Right = SearchableListOverlay.WIDTH_PADDING + Multiplayer.OVERFLOW_PADDING,
}; };
} }

View File

@ -26,6 +26,11 @@ namespace osu.Game.Screens.Multi
[Cached] [Cached]
public class Multiplayer : OsuScreen, IOnlineComponent public class Multiplayer : OsuScreen, IOnlineComponent
{ {
/// <summary>
///How much this container should overflow the sides of the screen to account for parallax shifting.
/// </summary>
public const float OVERFLOW_PADDING = 50;
private readonly MultiplayerWaveContainer waves; private readonly MultiplayerWaveContainer waves;
public override bool AllowBeatmapRulesetChange => currentSubScreen?.AllowBeatmapRulesetChange ?? base.AllowBeatmapRulesetChange; public override bool AllowBeatmapRulesetChange => currentSubScreen?.AllowBeatmapRulesetChange ?? base.AllowBeatmapRulesetChange;
@ -48,6 +53,12 @@ namespace osu.Game.Screens.Multi
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,
}; };
Padding = new MarginPadding
{
Left = -OVERFLOW_PADDING,
Right = -OVERFLOW_PADDING
};
waves.AddRange(new Drawable[] waves.AddRange(new Drawable[]
{ {
new Container new Container
@ -86,7 +97,7 @@ namespace osu.Game.Screens.Multi
Margin = new MarginPadding Margin = new MarginPadding
{ {
Top = 10, Top = 10,
Right = 10, Right = 10 + OVERFLOW_PADDING,
}, },
Text = "Create room", Text = "Create room",
Action = () => loungeSubScreen.Push(new Room Action = () => loungeSubScreen.Push(new Room