mirror of
https://github.com/ppy/osu.git
synced 2024-11-15 15:17:44 +08:00
Merge pull request #30109 from bdach/editor/setup-screen-better-background-selector
Move setup screen background preview to appropriate form control
This commit is contained in:
commit
24227b4d02
@ -68,6 +68,8 @@ namespace osu.Game.Graphics.UserInterfaceV2
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public LocalisableString PlaceholderText { get; init; }
|
public LocalisableString PlaceholderText { get; init; }
|
||||||
|
|
||||||
|
public Container PreviewContainer { get; private set; } = null!;
|
||||||
|
|
||||||
private Box background = null!;
|
private Box background = null!;
|
||||||
|
|
||||||
private FormFieldCaption caption = null!;
|
private FormFieldCaption caption = null!;
|
||||||
@ -89,7 +91,7 @@ namespace osu.Game.Graphics.UserInterfaceV2
|
|||||||
private void load()
|
private void load()
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.X;
|
RelativeSizeAxes = Axes.X;
|
||||||
Height = 50;
|
AutoSizeAxes = Axes.Y;
|
||||||
|
|
||||||
Masking = true;
|
Masking = true;
|
||||||
CornerRadius = 5;
|
CornerRadius = 5;
|
||||||
@ -101,9 +103,23 @@ namespace osu.Game.Graphics.UserInterfaceV2
|
|||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.Both,
|
||||||
Colour = colourProvider.Background5,
|
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
|
new Container
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.X,
|
||||||
|
Height = 50,
|
||||||
|
Anchor = Anchor.BottomLeft,
|
||||||
|
Origin = Anchor.BottomLeft,
|
||||||
Padding = new MarginPadding(9),
|
Padding = new MarginPadding(9),
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
|
@ -35,12 +35,17 @@ namespace osu.Game.Screens.Edit.Setup
|
|||||||
[Resolved]
|
[Resolved]
|
||||||
private Editor? editor { get; set; }
|
private Editor? editor { get; set; }
|
||||||
|
|
||||||
[Resolved]
|
private SetupScreenHeaderBackground headerBackground = null!;
|
||||||
private SetupScreenHeaderBackground headerBackground { get; set; } = null!;
|
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load()
|
private void load()
|
||||||
{
|
{
|
||||||
|
headerBackground = new SetupScreenHeaderBackground
|
||||||
|
{
|
||||||
|
RelativeSizeAxes = Axes.X,
|
||||||
|
Height = 110,
|
||||||
|
};
|
||||||
|
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
backgroundChooser = new FormFileSelector(".jpg", ".jpeg", ".png")
|
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))
|
if (!string.IsNullOrEmpty(working.Value.Metadata.BackgroundFile))
|
||||||
backgroundChooser.Current.Value = new FileInfo(working.Value.Metadata.BackgroundFile);
|
backgroundChooser.Current.Value = new FileInfo(working.Value.Metadata.BackgroundFile);
|
||||||
|
|
||||||
|
@ -24,9 +24,6 @@ namespace osu.Game.Screens.Edit.Setup
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
[Cached]
|
|
||||||
private SetupScreenHeaderBackground background = new SetupScreenHeaderBackground { RelativeSizeAxes = Axes.Both, };
|
|
||||||
|
|
||||||
private OsuScrollContainer scroll = null!;
|
private OsuScrollContainer scroll = null!;
|
||||||
private FillFlowContainer flow = null!;
|
private FillFlowContainer flow = null!;
|
||||||
|
|
||||||
@ -42,43 +39,24 @@ namespace osu.Game.Screens.Edit.Setup
|
|||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.Both,
|
||||||
Colour = colourProvider.Background3,
|
Colour = colourProvider.Background3,
|
||||||
},
|
},
|
||||||
new GridContainer
|
scroll = new OsuScrollContainer
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.Both,
|
||||||
RowDimensions =
|
Padding = new MarginPadding(15),
|
||||||
[
|
Child = flow = new FillFlowContainer
|
||||||
new Dimension(GridSizeMode.Absolute, 110),
|
|
||||||
new Dimension()
|
|
||||||
],
|
|
||||||
Content = new[]
|
|
||||||
{
|
{
|
||||||
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,
|
s.Width = 450;
|
||||||
},
|
s.Anchor = Anchor.TopCentre;
|
||||||
new Drawable[]
|
s.Origin = Anchor.TopCentre;
|
||||||
{
|
})),
|
||||||
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;
|
|
||||||
})),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -29,7 +29,8 @@ namespace osu.Game.Screens.Edit.Setup
|
|||||||
InternalChild = content = new Container
|
InternalChild = content = new Container
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.Both,
|
||||||
Masking = true
|
Masking = true,
|
||||||
|
CornerRadius = 3.5f,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user