2019-10-08 13:23:13 +08:00
|
|
|
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
|
|
|
|
// See the LICENCE file in the repository root for full licence text.
|
|
|
|
|
|
2020-09-08 18:28:20 +08:00
|
|
|
|
using System.Linq;
|
2020-09-07 18:21:35 +08:00
|
|
|
|
using osu.Framework.Allocation;
|
|
|
|
|
using osu.Framework.Graphics;
|
|
|
|
|
using osu.Framework.Graphics.Containers;
|
|
|
|
|
using osu.Framework.Graphics.Shapes;
|
2020-09-08 18:28:20 +08:00
|
|
|
|
using osu.Framework.Graphics.UserInterface;
|
2020-09-07 18:21:35 +08:00
|
|
|
|
using osu.Game.Beatmaps.Drawables;
|
|
|
|
|
using osu.Game.Graphics;
|
|
|
|
|
using osu.Game.Graphics.Containers;
|
|
|
|
|
using osu.Game.Graphics.Sprites;
|
|
|
|
|
using osu.Game.Graphics.UserInterfaceV2;
|
|
|
|
|
using osuTK;
|
|
|
|
|
|
2019-10-08 13:23:13 +08:00
|
|
|
|
namespace osu.Game.Screens.Edit.Setup
|
|
|
|
|
{
|
|
|
|
|
public class SetupScreen : EditorScreen
|
|
|
|
|
{
|
2020-09-08 18:28:20 +08:00
|
|
|
|
private FillFlowContainer flow;
|
|
|
|
|
private LabelledTextBox artistTextBox;
|
|
|
|
|
private LabelledTextBox titleTextBox;
|
|
|
|
|
private LabelledTextBox creatorTextBox;
|
|
|
|
|
private LabelledTextBox difficultyTextBox;
|
|
|
|
|
|
2020-09-07 18:21:35 +08:00
|
|
|
|
[BackgroundDependencyLoader]
|
|
|
|
|
private void load(OsuColour colours)
|
2019-10-08 13:23:13 +08:00
|
|
|
|
{
|
2020-09-08 18:50:44 +08:00
|
|
|
|
Child = new Container
|
2020-09-07 18:21:35 +08:00
|
|
|
|
{
|
2020-09-08 18:50:44 +08:00
|
|
|
|
RelativeSizeAxes = Axes.Both,
|
|
|
|
|
Padding = new MarginPadding(50),
|
|
|
|
|
Child = new Container
|
2020-09-07 18:21:35 +08:00
|
|
|
|
{
|
|
|
|
|
RelativeSizeAxes = Axes.Both,
|
2020-09-08 18:50:44 +08:00
|
|
|
|
Masking = true,
|
|
|
|
|
CornerRadius = 10,
|
|
|
|
|
Children = new Drawable[]
|
2020-09-07 18:21:35 +08:00
|
|
|
|
{
|
2020-09-08 18:50:44 +08:00
|
|
|
|
new Box
|
2020-09-07 18:21:35 +08:00
|
|
|
|
{
|
2020-09-08 18:50:44 +08:00
|
|
|
|
Colour = colours.GreySeafoamDark,
|
|
|
|
|
RelativeSizeAxes = Axes.Both,
|
|
|
|
|
},
|
|
|
|
|
new OsuScrollContainer
|
|
|
|
|
{
|
|
|
|
|
RelativeSizeAxes = Axes.Both,
|
|
|
|
|
Padding = new MarginPadding(10),
|
|
|
|
|
Child = flow = new FillFlowContainer
|
2020-09-07 18:21:35 +08:00
|
|
|
|
{
|
|
|
|
|
RelativeSizeAxes = Axes.X,
|
2020-09-08 18:50:44 +08:00
|
|
|
|
AutoSizeAxes = Axes.Y,
|
|
|
|
|
Spacing = new Vector2(20),
|
|
|
|
|
Direction = FillDirection.Vertical,
|
|
|
|
|
Children = new Drawable[]
|
2020-09-07 18:21:35 +08:00
|
|
|
|
{
|
2020-09-08 18:50:44 +08:00
|
|
|
|
new Container
|
|
|
|
|
{
|
|
|
|
|
RelativeSizeAxes = Axes.X,
|
|
|
|
|
Height = 250,
|
|
|
|
|
Masking = true,
|
|
|
|
|
CornerRadius = 10,
|
|
|
|
|
Child = new BeatmapBackgroundSprite(Beatmap.Value)
|
|
|
|
|
{
|
|
|
|
|
RelativeSizeAxes = Axes.Both,
|
|
|
|
|
Anchor = Anchor.Centre,
|
|
|
|
|
Origin = Anchor.Centre,
|
|
|
|
|
FillMode = FillMode.Fill,
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
new OsuSpriteText
|
|
|
|
|
{
|
|
|
|
|
Text = "Beatmap metadata"
|
|
|
|
|
},
|
|
|
|
|
artistTextBox = new LabelledTextBox
|
|
|
|
|
{
|
|
|
|
|
Label = "Artist",
|
2020-09-08 18:51:31 +08:00
|
|
|
|
Current = { Value = Beatmap.Value.Metadata.Artist },
|
|
|
|
|
TabbableContentContainer = this
|
2020-09-08 18:50:44 +08:00
|
|
|
|
},
|
|
|
|
|
titleTextBox = new LabelledTextBox
|
|
|
|
|
{
|
|
|
|
|
Label = "Title",
|
2020-09-08 18:51:31 +08:00
|
|
|
|
Current = { Value = Beatmap.Value.Metadata.Title },
|
|
|
|
|
TabbableContentContainer = this
|
2020-09-08 18:50:44 +08:00
|
|
|
|
},
|
|
|
|
|
creatorTextBox = new LabelledTextBox
|
|
|
|
|
{
|
|
|
|
|
Label = "Creator",
|
2020-09-08 18:51:31 +08:00
|
|
|
|
Current = { Value = Beatmap.Value.Metadata.AuthorString },
|
|
|
|
|
TabbableContentContainer = this
|
2020-09-08 18:50:44 +08:00
|
|
|
|
},
|
|
|
|
|
difficultyTextBox = new LabelledTextBox
|
|
|
|
|
{
|
|
|
|
|
Label = "Difficulty Name",
|
2020-09-08 18:51:31 +08:00
|
|
|
|
Current = { Value = Beatmap.Value.BeatmapInfo.Version },
|
|
|
|
|
TabbableContentContainer = this
|
2020-09-08 18:50:44 +08:00
|
|
|
|
},
|
|
|
|
|
}
|
2020-09-07 18:21:35 +08:00
|
|
|
|
},
|
2020-09-08 18:50:44 +08:00
|
|
|
|
},
|
|
|
|
|
}
|
|
|
|
|
}
|
2020-09-07 18:21:35 +08:00
|
|
|
|
};
|
2020-09-08 18:28:20 +08:00
|
|
|
|
|
|
|
|
|
foreach (var item in flow.OfType<LabelledTextBox>())
|
|
|
|
|
item.OnCommit += onCommit;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void onCommit(TextBox sender, bool newText)
|
|
|
|
|
{
|
|
|
|
|
if (!newText) return;
|
|
|
|
|
|
|
|
|
|
// for now, update these on commit rather than making BeatmapMetadata bindables.
|
|
|
|
|
// after switching database engines we can reconsider if switching to bindables is a good direction.
|
|
|
|
|
Beatmap.Value.Metadata.Artist = artistTextBox.Current.Value;
|
|
|
|
|
Beatmap.Value.Metadata.Title = titleTextBox.Current.Value;
|
|
|
|
|
Beatmap.Value.Metadata.AuthorString = creatorTextBox.Current.Value;
|
|
|
|
|
Beatmap.Value.BeatmapInfo.Version = difficultyTextBox.Current.Value;
|
2019-10-08 13:23:13 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|