Explicitly associate setup sections with titles

This commit is contained in:
Bartłomiej Dach 2021-04-03 19:02:33 +02:00
parent bdd1072dce
commit 95d7e6c74b
4 changed files with 36 additions and 23 deletions

View File

@ -5,8 +5,8 @@ using System.Linq;
using osu.Framework.Allocation; using osu.Framework.Allocation;
using osu.Framework.Bindables; using osu.Framework.Bindables;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Framework.Localisation;
using osu.Game.Beatmaps; using osu.Game.Beatmaps;
using osu.Game.Graphics.Sprites;
using osu.Game.Graphics.UserInterfaceV2; using osu.Game.Graphics.UserInterfaceV2;
namespace osu.Game.Screens.Edit.Setup namespace osu.Game.Screens.Edit.Setup
@ -18,15 +18,13 @@ namespace osu.Game.Screens.Edit.Setup
private LabelledSliderBar<float> approachRateSlider; private LabelledSliderBar<float> approachRateSlider;
private LabelledSliderBar<float> overallDifficultySlider; private LabelledSliderBar<float> overallDifficultySlider;
public override LocalisableString Title => "Difficulty";
[BackgroundDependencyLoader] [BackgroundDependencyLoader]
private void load() private void load()
{ {
Children = new Drawable[] Children = new Drawable[]
{ {
new OsuSpriteText
{
Text = "Difficulty settings"
},
circleSizeSlider = new LabelledSliderBar<float> circleSizeSlider = new LabelledSliderBar<float>
{ {
Label = "Object Size", Label = "Object Size",

View File

@ -5,7 +5,7 @@ using System.Linq;
using osu.Framework.Allocation; using osu.Framework.Allocation;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Framework.Graphics.UserInterface; using osu.Framework.Graphics.UserInterface;
using osu.Game.Graphics.Sprites; using osu.Framework.Localisation;
using osu.Game.Graphics.UserInterfaceV2; using osu.Game.Graphics.UserInterfaceV2;
namespace osu.Game.Screens.Edit.Setup namespace osu.Game.Screens.Edit.Setup
@ -17,15 +17,13 @@ namespace osu.Game.Screens.Edit.Setup
private LabelledTextBox creatorTextBox; private LabelledTextBox creatorTextBox;
private LabelledTextBox difficultyTextBox; private LabelledTextBox difficultyTextBox;
public override LocalisableString Title => "Metadata";
[BackgroundDependencyLoader] [BackgroundDependencyLoader]
private void load() private void load()
{ {
Children = new Drawable[] Children = new Drawable[]
{ {
new OsuSpriteText
{
Text = "Beatmap metadata"
},
artistTextBox = new LabelledTextBox artistTextBox = new LabelledTextBox
{ {
Label = "Artist", Label = "Artist",

View File

@ -11,12 +11,12 @@ using osu.Framework.Bindables;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Shapes; using osu.Framework.Graphics.Shapes;
using osu.Framework.Localisation;
using osu.Game.Beatmaps; using osu.Game.Beatmaps;
using osu.Game.Beatmaps.Drawables; using osu.Game.Beatmaps.Drawables;
using osu.Game.Database; using osu.Game.Database;
using osu.Game.Graphics; using osu.Game.Graphics;
using osu.Game.Graphics.Containers; using osu.Game.Graphics.Containers;
using osu.Game.Graphics.Sprites;
using osu.Game.Graphics.UserInterfaceV2; using osu.Game.Graphics.UserInterfaceV2;
using osu.Game.Overlays; using osu.Game.Overlays;
@ -27,6 +27,8 @@ namespace osu.Game.Screens.Edit.Setup
private LabelledTextBox audioTrackTextBox; private LabelledTextBox audioTrackTextBox;
private Container backgroundSpriteContainer; private Container backgroundSpriteContainer;
public override LocalisableString Title => "Resources";
public IEnumerable<string> HandledExtensions => ImageExtensions.Concat(AudioExtensions); public IEnumerable<string> HandledExtensions => ImageExtensions.Concat(AudioExtensions);
public static string[] ImageExtensions { get; } = { ".jpg", ".jpeg", ".png" }; public static string[] ImageExtensions { get; } = { ".jpg", ".jpeg", ".png" };
@ -66,10 +68,6 @@ namespace osu.Game.Screens.Edit.Setup
Masking = true, Masking = true,
CornerRadius = 10, CornerRadius = 10,
}, },
new OsuSpriteText
{
Text = "Resources"
},
audioTrackTextBox = new FileChooserLabelledTextBox audioTrackTextBox = new FileChooserLabelledTextBox
{ {
Label = "Audio Track", Label = "Audio Track",

View File

@ -4,12 +4,14 @@
using osu.Framework.Allocation; using osu.Framework.Allocation;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Containers;
using osu.Framework.Localisation;
using osu.Game.Graphics; using osu.Game.Graphics;
using osu.Game.Graphics.Sprites;
using osuTK; using osuTK;
namespace osu.Game.Screens.Edit.Setup namespace osu.Game.Screens.Edit.Setup
{ {
internal class SetupSection : Container internal abstract class SetupSection : Container
{ {
private readonly FillFlowContainer flow; private readonly FillFlowContainer flow;
@ -21,23 +23,40 @@ namespace osu.Game.Screens.Edit.Setup
protected override Container<Drawable> Content => flow; protected override Container<Drawable> Content => flow;
public SetupSection() public abstract LocalisableString Title { get; }
protected SetupSection()
{ {
RelativeSizeAxes = Axes.X; RelativeSizeAxes = Axes.X;
AutoSizeAxes = Axes.Y; AutoSizeAxes = Axes.Y;
Padding = new MarginPadding(10); Padding = new MarginPadding
{
Vertical = 10,
Horizontal = 90
};
InternalChild = flow = new FillFlowContainer InternalChild = new FillFlowContainer
{ {
RelativeSizeAxes = Axes.X, RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y, AutoSizeAxes = Axes.Y,
Spacing = new Vector2(20), Spacing = new Vector2(20),
Padding = new MarginPadding
{
Horizontal = 90
},
Direction = FillDirection.Vertical, Direction = FillDirection.Vertical,
Children = new Drawable[]
{
new OsuSpriteText
{
Font = OsuFont.GetFont(weight: FontWeight.Bold),
Text = Title
},
flow = new FillFlowContainer
{
RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y,
Spacing = new Vector2(20),
Direction = FillDirection.Vertical,
}
}
}; };
} }
} }