1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-15 12:27:26 +08:00

Move setup screen background preview to appropriate form control

See
https://discord.com/channels/188630481301012481/188630652340404224/1291361342971707463.
This commit is contained in:
Bartłomiej Dach 2024-10-04 11:09:14 +02:00
parent 2914a5b93b
commit 7cd724f342
No known key found for this signature in database
4 changed files with 43 additions and 41 deletions

View File

@ -68,6 +68,8 @@ namespace osu.Game.Graphics.UserInterfaceV2
/// </summary>
public LocalisableString PlaceholderText { get; init; }
public Container PreviewContainer { get; private set; } = null!;
private Box background = null!;
private FormFieldCaption caption = null!;
@ -89,7 +91,7 @@ namespace osu.Game.Graphics.UserInterfaceV2
private void load()
{
RelativeSizeAxes = Axes.X;
Height = 50;
AutoSizeAxes = Axes.Y;
Masking = true;
CornerRadius = 5;
@ -101,9 +103,23 @@ namespace osu.Game.Graphics.UserInterfaceV2
RelativeSizeAxes = Axes.Both,
Colour = colourProvider.Background5,
},
PreviewContainer = new Container
{
RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y,
Padding = new MarginPadding
{
Horizontal = 1.5f,
Top = 1.5f,
Bottom = 50
},
},
new Container
{
RelativeSizeAxes = Axes.Both,
RelativeSizeAxes = Axes.X,
Height = 50,
Anchor = Anchor.BottomLeft,
Origin = Anchor.BottomLeft,
Padding = new MarginPadding(9),
Children = new Drawable[]
{

View File

@ -35,12 +35,17 @@ namespace osu.Game.Screens.Edit.Setup
[Resolved]
private Editor? editor { get; set; }
[Resolved]
private SetupScreenHeaderBackground headerBackground { get; set; } = null!;
private SetupScreenHeaderBackground headerBackground = null!;
[BackgroundDependencyLoader]
private void load()
{
headerBackground = new SetupScreenHeaderBackground
{
RelativeSizeAxes = Axes.X,
Height = 110,
};
Children = new Drawable[]
{
backgroundChooser = new FormFileSelector(".jpg", ".jpeg", ".png")
@ -55,6 +60,8 @@ namespace osu.Game.Screens.Edit.Setup
},
};
backgroundChooser.PreviewContainer.Add(headerBackground);
if (!string.IsNullOrEmpty(working.Value.Metadata.BackgroundFile))
backgroundChooser.Current.Value = new FileInfo(working.Value.Metadata.BackgroundFile);

View File

@ -24,9 +24,6 @@ namespace osu.Game.Screens.Edit.Setup
{
}
[Cached]
private SetupScreenHeaderBackground background = new SetupScreenHeaderBackground { RelativeSizeAxes = Axes.Both, };
private OsuScrollContainer scroll = null!;
private FillFlowContainer flow = null!;
@ -42,43 +39,24 @@ namespace osu.Game.Screens.Edit.Setup
RelativeSizeAxes = Axes.Both,
Colour = colourProvider.Background3,
},
new GridContainer
scroll = new OsuScrollContainer
{
RelativeSizeAxes = Axes.Both,
RowDimensions =
[
new Dimension(GridSizeMode.Absolute, 110),
new Dimension()
],
Content = new[]
Padding = new MarginPadding(15),
Child = flow = new FillFlowContainer
{
new Drawable[]
RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y,
Direction = FillDirection.Full,
Anchor = Anchor.TopCentre,
Origin = Anchor.TopCentre,
Spacing = new Vector2(25),
ChildrenEnumerable = ruleset.CreateEditorSetupSections().Select(section => section.With(s =>
{
background,
},
new Drawable[]
{
scroll = new OsuScrollContainer
{
RelativeSizeAxes = Axes.Both,
Padding = new MarginPadding(15),
Child = flow = new FillFlowContainer
{
RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y,
Direction = FillDirection.Full,
Anchor = Anchor.TopCentre,
Origin = Anchor.TopCentre,
Spacing = new Vector2(25),
ChildrenEnumerable = ruleset.CreateEditorSetupSections().Select(section => section.With(s =>
{
s.Width = 450;
s.Anchor = Anchor.TopCentre;
s.Origin = Anchor.TopCentre;
})),
}
}
}
s.Width = 450;
s.Anchor = Anchor.TopCentre;
s.Origin = Anchor.TopCentre;
})),
}
}
};

View File

@ -29,7 +29,8 @@ namespace osu.Game.Screens.Edit.Setup
InternalChild = content = new Container
{
RelativeSizeAxes = Axes.Both,
Masking = true
Masking = true,
CornerRadius = 3.5f,
};
}