1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-27 03:23:03 +08:00

Update usage of FlowContainer and its subclasses

This commit is contained in:
default0 2017-02-26 21:32:43 +01:00
parent 1b92519a86
commit 8d91519d59
34 changed files with 58 additions and 69 deletions

View File

@ -60,16 +60,15 @@ namespace osu.Desktop.Overlays
new FlowContainer
{
AutoSizeAxes = Axes.Both,
Direction = FlowDirections.Vertical,
FlowStrategy = FlowStrategies.GetVerticalFlow(),
Children = new Drawable[]
{
new FlowContainer
{
AutoSizeAxes = Axes.Both,
Direction = FlowDirections.Horizontal,
FlowStrategy = FlowStrategies.GetHorizontalFlow(new Vector2(5)),
Anchor = Anchor.TopCentre,
Origin = Anchor.TopCentre,
Spacing = new Vector2(5),
Children = new Drawable[]
{
new OsuSpriteText
@ -95,6 +94,8 @@ namespace osu.Desktop.Overlays
},
new Sprite
{
Anchor = Anchor.TopCentre,
Origin = Anchor.TopCentre,
Texture = textures.Get(@"Menu/dev-build-footer"),
},
}

View File

@ -25,8 +25,7 @@ namespace osu.Game.Modes.Osu.Objects.Drawables
AutoSizeAxes = Axes.Both;
Origin = Anchor.Centre;
Direction = FlowDirections.Vertical;
Spacing = new Vector2(0, 2);
FlowStrategy = FlowStrategies.GetVerticalFlow(new Vector2(0, 2));
Position = (h?.StackedEndPosition ?? Vector2.Zero) + judgement.PositionOffset;
Children = new Drawable[]

View File

@ -86,7 +86,7 @@ namespace osu.Game.Beatmaps.Drawables
new FlowContainer
{
Padding = new MarginPadding(5),
Direction = FlowDirections.Horizontal,
FlowStrategy = FlowStrategies.GetHorizontalFlow(),
AutoSizeAxes = Axes.Both,
Anchor = Anchor.CentreLeft,
Origin = Anchor.CentreLeft,
@ -101,15 +101,14 @@ namespace osu.Game.Beatmaps.Drawables
new FlowContainer
{
Padding = new MarginPadding { Left = 5 },
Direction = FlowDirections.Vertical,
FlowStrategy = FlowStrategies.GetVerticalFlow(),
AutoSizeAxes = Axes.Both,
Children = new Drawable[]
{
new FlowContainer
{
Direction = FlowDirections.Horizontal,
FlowStrategy = FlowStrategies.GetHorizontalFlow(new Vector2(4, 0)),
AutoSizeAxes = Axes.Both,
Spacing = new Vector2(4, 0),
Children = new[]
{
new OsuSpriteText

View File

@ -38,7 +38,7 @@ namespace osu.Game.Beatmaps.Drawables
},
new FlowContainer
{
Direction = FlowDirections.Vertical,
FlowStrategy = FlowStrategies.GetVerticalFlow(),
Padding = new MarginPadding { Top = 5, Left = 18, Right = 10, Bottom = 10 },
AutoSizeAxes = Axes.Both,
Children = new[]
@ -112,7 +112,7 @@ namespace osu.Game.Beatmaps.Drawables
new FlowContainer
{
Depth = -1,
Direction = FlowDirections.Horizontal,
FlowStrategy = FlowStrategies.GetHorizontalFlow(),
RelativeSizeAxes = Axes.Both,
// This makes the gradient not be perfectly horizontal, but diagonal at a ~40° angle
Shear = new Vector2(0.8f, 0),

View File

@ -21,7 +21,7 @@ namespace osu.Game.Graphics.UserInterface
{
new FlowContainer
{
Direction = FlowDirections.Horizontal,
FlowStrategy = FlowStrategies.GetHorizontalFlow(),
RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y,
Children = new Drawable[]

View File

@ -73,8 +73,7 @@ namespace osu.Game.Graphics.UserInterface
stars = new FlowContainer<Star>
{
AutoSizeAxes = Axes.Both,
Direction = FlowDirections.Horizontal,
Spacing = new Vector2(star_spacing),
FlowStrategy = FlowStrategies.GetHorizontalFlow(new Vector2(star_spacing)),
}
};

View File

@ -39,7 +39,7 @@ namespace osu.Game.Graphics.UserInterface.Volume
Anchor = Anchor.BottomRight,
Origin = Anchor.BottomRight,
Margin = new MarginPadding { Left = 10, Right = 10, Top = 30, Bottom = 30 },
Spacing = new Vector2(15, 0),
FlowStrategy = FlowStrategies.GetFillFlow(new Vector2(15, 0)),
Children = new Drawable[]
{
volumeMeterMaster = new VolumeMeter("Master"),

View File

@ -41,7 +41,7 @@ namespace osu.Game.Online.Chat.Drawables
{
flow = new FlowContainer
{
Direction = FlowDirections.Vertical,
FlowStrategy = FlowStrategies.GetVerticalFlow(),
RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y,
Padding = new MarginPadding { Left = 20, Right = 20 }

View File

@ -46,7 +46,7 @@ namespace osu.Game.Overlays
{
sections = new FlowContainer<NotificationSection>
{
Direction = FlowDirections.Vertical,
FlowStrategy = FlowStrategies.GetVerticalFlow(),
AutoSizeAxes = Axes.Y,
RelativeSizeAxes = Axes.X,
Children = new []

View File

@ -60,7 +60,7 @@ namespace osu.Game.Overlays.Notifications
{
RelativeSizeAxes = Axes.X;
AutoSizeAxes = Axes.Y;
Direction = FlowDirections.Vertical;
FlowStrategy = FlowStrategies.GetVerticalFlow();
Padding = new MarginPadding
{
@ -91,7 +91,7 @@ namespace osu.Game.Overlays.Notifications
{
Bottom = 5
},
Spacing = new Vector2(5, 0),
FlowStrategy = FlowStrategies.GetFillFlow(new Vector2(5, 0)),
AutoSizeAxes = Axes.Both,
Children = new Drawable[]
{
@ -116,7 +116,7 @@ namespace osu.Game.Overlays.Notifications
RelativeSizeAxes = Axes.X,
LayoutDuration = 150,
LayoutEasing = EasingTypes.OutQuart,
Spacing = new Vector2(3),
FlowStrategy = FlowStrategies.GetFillFlow(new Vector2(3)),
}
});
}

View File

@ -89,7 +89,7 @@ namespace osu.Game.Overlays.Options
{
Items = new KeyValuePair<string, T>[0];
Direction = FlowDirections.Vertical;
FlowStrategy = FlowStrategies.GetVerticalFlow();
RelativeSizeAxes = Axes.X;
AutoSizeAxes = Axes.Y;
Children = new Drawable[]

View File

@ -40,7 +40,7 @@ namespace osu.Game.Overlays.Options
public OptionSlider()
{
Direction = FlowDirections.Vertical;
FlowStrategy = FlowStrategies.GetFillFlow();
RelativeSizeAxes = Axes.X;
AutoSizeAxes = Axes.Y;
Padding = new MarginPadding { Right = 5 };

View File

@ -61,8 +61,7 @@ namespace osu.Game.Overlays.Options
FlowContent = new FlowContainer
{
Margin = new MarginPadding { Top = header_size + header_margin },
Direction = FlowDirections.Vertical,
Spacing = new Vector2(0, 30),
FlowStrategy = FlowStrategies.GetVerticalFlow(new Vector2(0, 30)),
AutoSizeAxes = Axes.Y,
RelativeSizeAxes = Axes.X,
},

View File

@ -20,7 +20,7 @@ namespace osu.Game.Overlays.Options
{
RelativeSizeAxes = Axes.X;
AutoSizeAxes = Axes.Y;
Direction = FlowDirections.Vertical;
FlowStrategy = FlowStrategies.GetVerticalFlow();
AddInternal(new Drawable[]
{
new OsuSpriteText
@ -31,10 +31,9 @@ namespace osu.Game.Overlays.Options
},
content = new FlowContainer
{
Direction = FlowDirections.Vertical,
FlowStrategy = FlowStrategies.GetVerticalFlow(new Vector2(0, 5)),
RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y,
Spacing = new Vector2(0, 5),
},
});
}

View File

@ -7,6 +7,7 @@ using osu.Game.Configuration;
using osu.Game.Graphics;
using osu.Game.Graphics.UserInterface;
using OpenTK;
using osu.Framework.Graphics.Containers;
namespace osu.Game.Overlays.Options.Sections
{
@ -18,7 +19,7 @@ namespace osu.Game.Overlays.Options.Sections
[BackgroundDependencyLoader]
private void load(OsuConfigManager config)
{
FlowContent.Spacing = new Vector2(0, 5);
FlowContent.FlowStrategy = FlowStrategies.GetFillFlow(new Vector2(0, 5));
Children = new Drawable[]
{
new OsuCheckbox

View File

@ -100,10 +100,9 @@ namespace osu.Game.Overlays.Options.Sections.General
private void load(APIAccess api, OsuConfigManager config)
{
this.api = api;
Direction = FlowDirections.Vertical;
FlowStrategy = FlowStrategies.GetVerticalFlow(new Vector2(0, 5));
AutoSizeAxes = Axes.Y;
RelativeSizeAxes = Axes.X;
Spacing = new Vector2(0, 5);
Children = new Drawable[]
{
username = new OsuTextBox

View File

@ -5,6 +5,7 @@ using osu.Framework.Graphics;
using osu.Game.Graphics;
using osu.Game.Graphics.UserInterface;
using OpenTK;
using osu.Framework.Graphics.Containers;
namespace osu.Game.Overlays.Options.Sections
{
@ -15,7 +16,7 @@ namespace osu.Game.Overlays.Options.Sections
public MaintenanceSection()
{
FlowContent.Spacing = new Vector2(0, 5);
FlowContent.FlowStrategy = FlowStrategies.GetFillFlow(new Vector2(0, 5));
Children = new Drawable[]
{
new OsuButton

View File

@ -8,6 +8,7 @@ using osu.Game.Configuration;
using osu.Game.Graphics;
using osu.Game.Graphics.UserInterface;
using OpenTK;
using osu.Framework.Graphics.Containers;
namespace osu.Game.Overlays.Options.Sections
{
@ -19,7 +20,7 @@ namespace osu.Game.Overlays.Options.Sections
[BackgroundDependencyLoader]
private void load(OsuConfigManager config)
{
FlowContent.Spacing = new Vector2(0, 5);
FlowContent.FlowStrategy = FlowStrategies.GetFillFlow(new Vector2(0, 5));
Children = new Drawable[]
{
new OptionLabel { Text = "TODO: Skin preview textures" },

View File

@ -40,7 +40,7 @@ namespace osu.Game.Overlays.Options
Anchor = Anchor.CentreLeft,
AutoSizeAxes = Axes.Y,
RelativeSizeAxes = Axes.X,
Direction = FlowDirections.Vertical
FlowStrategy = FlowStrategies.GetVerticalFlow(),
}
}
},

View File

@ -77,7 +77,7 @@ namespace osu.Game.Overlays
{
AutoSizeAxes = Axes.Y,
RelativeSizeAxes = Axes.X,
Direction = FlowDirections.Vertical,
FlowStrategy = FlowStrategies.GetVerticalFlow(),
Children = new Drawable[]
{
@ -98,7 +98,7 @@ namespace osu.Game.Overlays
{
AutoSizeAxes = Axes.Y,
RelativeSizeAxes = Axes.X,
Direction = FlowDirections.Vertical,
FlowStrategy = FlowStrategies.GetVerticalFlow(),
Children = sections,
}
}

View File

@ -104,8 +104,7 @@ namespace osu.Game.Overlays.Pause
{
RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y,
Direction = FlowDirections.Vertical,
Spacing = new Vector2(0f, 50f),
FlowStrategy = FlowStrategies.GetVerticalFlow(new Vector2(0, 50)),
Origin = Anchor.Centre,
Anchor = Anchor.Centre,
Children = new Drawable[]
@ -113,8 +112,7 @@ namespace osu.Game.Overlays.Pause
new FlowContainer
{
AutoSizeAxes = Axes.Both,
Direction = FlowDirections.Vertical,
Spacing = new Vector2(0f, 20f),
FlowStrategy = FlowStrategies.GetVerticalFlow(new Vector2(0, 20)),
Origin = Anchor.TopCentre,
Anchor = Anchor.TopCentre,
Children = new Drawable[]

View File

@ -43,7 +43,7 @@ namespace osu.Game.Overlays.Toolbar
new ToolbarBackground(),
new FlowContainer
{
Direction = FlowDirections.Horizontal,
FlowStrategy = FlowStrategies.GetHorizontalFlow(),
RelativeSizeAxes = Axes.Y,
AutoSizeAxes = Axes.X,
Children = new Drawable[]
@ -63,7 +63,7 @@ namespace osu.Game.Overlays.Toolbar
{
Anchor = Anchor.TopRight,
Origin = Anchor.TopRight,
Direction = FlowDirections.Horizontal,
FlowStrategy = FlowStrategies.GetHorizontalFlow(),
RelativeSizeAxes = Axes.Y,
AutoSizeAxes = Axes.X,
Children = new Drawable[]

View File

@ -84,19 +84,18 @@ namespace osu.Game.Overlays.Toolbar
},
Flow = new FlowContainer
{
Direction = FlowDirections.Horizontal,
FlowStrategy = FlowStrategies.GetHorizontalFlow(new Vector2(5)),
Anchor = Anchor.TopCentre,
Origin = Anchor.TopCentre,
Padding = new MarginPadding { Left = Toolbar.HEIGHT / 2, Right = Toolbar.HEIGHT / 2 },
Spacing = new Vector2(5),
RelativeSizeAxes = Axes.Y,
AutoSizeAxes = Axes.X,
Children = new Drawable[]
{
DrawableIcon = new TextAwesome
{
Anchor = Anchor.CentreLeft,
Origin = Anchor.CentreLeft,
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
},
DrawableText = new OsuSpriteText
{
@ -107,7 +106,7 @@ namespace osu.Game.Overlays.Toolbar
},
tooltipContainer = new FlowContainer
{
Direction = FlowDirections.Vertical,
FlowStrategy = FlowStrategies.GetVerticalFlow(),
RelativeSizeAxes = Axes.Both, //stops us being considered in parent's autosize
Anchor = (TooltipAnchor & Anchor.x0) > 0 ? Anchor.BottomLeft : Anchor.BottomRight,
Origin = TooltipAnchor,

View File

@ -36,7 +36,7 @@ namespace osu.Game.Overlays.Toolbar
{
RelativeSizeAxes = Axes.Y,
AutoSizeAxes = Axes.X,
Direction = FlowDirections.Horizontal,
FlowStrategy = FlowStrategies.GetHorizontalFlow(),
Anchor = Anchor.TopCentre,
Origin = Anchor.TopCentre,
Padding = new MarginPadding { Left = padding, Right = padding },

View File

@ -126,7 +126,7 @@ namespace osu.Game.Screens
},
childModeButtons = new FlowContainer
{
Direction = FlowDirections.Vertical,
FlowStrategy = FlowStrategies.GetVerticalFlow(),
Anchor = Anchor.TopRight,
Origin = Anchor.TopRight,
RelativeSizeAxes = Axes.Both,

View File

@ -114,7 +114,7 @@ namespace osu.Game.Screens.Menu
new OsuSpriteText
{
Shadow = true,
Direction = FlowDirections.Horizontal,
AllowMultiline = false,
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
TextSize = 16,

View File

@ -78,16 +78,15 @@ namespace osu.Game.Screens.Menu
},
buttonFlow = new FlowContainerWithOrigin
{
Direction = FlowDirections.Horizontal,
FlowStrategy = FlowStrategies.GetHorizontalFlow(new Vector2(-WEDGE_WIDTH, 0)),
Anchor = Anchor.Centre,
AutoSizeAxes = Axes.Both,
Spacing = new Vector2(-WEDGE_WIDTH, 0),
Children = new[]
{
settingsButton = new Button(@"settings", @"options", FontAwesome.fa_gear, new Color4(85, 85, 85, 255), () => OnSettings?.Invoke(), -WEDGE_WIDTH, Key.O),
backButton = new Button(@"back", @"back", FontAwesome.fa_osu_left_o, new Color4(51, 58, 94, 255), onBack, -WEDGE_WIDTH),
iconFacade = new Container //need a container to make the osu! icon flow properly.
{
{
Size = new Vector2(0, BUTTON_AREA_HEIGHT)
}
},

View File

@ -32,8 +32,7 @@ namespace osu.Game.Screens.Menu
AutoSizeAxes = Axes.Both,
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
Direction = FlowDirections.Vertical,
Spacing = new Vector2(0, 2),
FlowStrategy = FlowStrategies.GetVerticalFlow(new Vector2(0, 2)),
Children = new Drawable[]
{
icon = new TextAwesome

View File

@ -12,7 +12,7 @@ namespace osu.Game.Screens.Play
{
public KeyCounterCollection()
{
Direction = FlowDirections.Horizontal;
FlowStrategy = FlowStrategies.GetHorizontalFlow();
AutoSizeAxes = Axes.Both;
}

View File

@ -139,7 +139,7 @@ namespace osu.Game.Screens.Play
AutoSizeAxes = Axes.Both,
Origin = Anchor.TopCentre,
Anchor = Anchor.TopCentre,
Direction = FlowDirections.Vertical,
FlowStrategy = FlowStrategies.GetVerticalFlow(),
Children = new Drawable[]
{
new OsuSpriteText

View File

@ -68,7 +68,7 @@ namespace osu.Game.Screens.Ranking
new FlowContainer
{
AutoSizeAxes = Axes.Both,
Direction = FlowDirections.Vertical,
FlowStrategy = FlowStrategies.GetVerticalFlow(),
Children = new Drawable[]
{
new OsuSpriteText

View File

@ -125,7 +125,7 @@ namespace osu.Game.Screens.Select
{
Anchor = Anchor.BottomLeft,
Origin = Anchor.BottomLeft,
Direction = FlowDirections.Vertical,
FlowStrategy = FlowStrategies.GetVerticalFlow(),
Margin = new MarginPadding { Top = 10, Left = 25, Right = 10, Bottom = 20 },
AutoSizeAxes = Axes.Both,
Children = new Drawable[]
@ -147,7 +147,7 @@ namespace osu.Game.Screens.Select
new FlowContainer
{
Margin = new MarginPadding { Top = 10 },
Direction = FlowDirections.Horizontal,
FlowStrategy = FlowStrategies.GetHorizontalFlow(),
AutoSizeAxes = Axes.Both,
Children = new []
{
@ -170,7 +170,7 @@ namespace osu.Game.Screens.Select
new FlowContainer
{
Margin = new MarginPadding { Top = 20 },
Spacing = new Vector2(40,0),
FlowStrategy = FlowStrategies.GetFillFlow(new Vector2(40, 0)),
AutoSizeAxes = Axes.Both,
Children = labels
},

View File

@ -44,7 +44,7 @@ namespace osu.Game.Screens.Select
Anchor = Anchor.TopRight,
Origin = Anchor.TopRight,
Width = 0.4f, // TODO: InnerWidth property or something
Direction = FlowDirections.Vertical,
FlowStrategy = FlowStrategies.GetVerticalFlow(),
Children = new Drawable[]
{
searchTextBox = new SearchTextBox {
@ -177,8 +177,7 @@ namespace osu.Game.Screens.Select
new FlowContainer
{
AutoSizeAxes = Axes.Both,
Direction = FlowDirections.Horizontal,
Spacing = new Vector2(10, 0),
FlowStrategy = FlowStrategies.GetHorizontalFlow(new Vector2(10, 0)),
Children = new Drawable[]
{
new TabItem
@ -209,8 +208,7 @@ namespace osu.Game.Screens.Select
new FlowContainer
{
AutoSizeAxes = Axes.Both,
Direction = FlowDirections.Horizontal,
Spacing = new Vector2(10, 0),
FlowStrategy = FlowStrategies.GetHorizontalFlow(new Vector2(10, 0)),
Origin = Anchor.TopRight,
Anchor = Anchor.TopRight,
Children = new Drawable[]

View File

@ -98,15 +98,13 @@ namespace osu.Game.Screens.Select
Position = new Vector2(BackButton.SIZE_EXTENDED.X + padding, 0),
RelativeSizeAxes = Axes.Y,
AutoSizeAxes = Axes.X,
Direction = FlowDirections.Horizontal,
Spacing = new Vector2(padding, 0),
FlowStrategy = FlowStrategies.GetHorizontalFlow(new Vector2(padding, 0)),
Children = new Drawable[]
{
buttons = new FlowContainer
{
Direction = FlowDirections.Horizontal,
Spacing = new Vector2(0.2f, 0),
FlowStrategy = FlowStrategies.GetHorizontalFlow(new Vector2(0.2f, 0)),
AutoSizeAxes = Axes.Both,
}
}