2020-10-06 14:17:15 +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.
|
|
|
|
|
|
|
|
using System.Linq;
|
|
|
|
using osu.Framework.Allocation;
|
|
|
|
using osu.Framework.Graphics;
|
|
|
|
using osu.Framework.Graphics.UserInterface;
|
|
|
|
using osu.Game.Graphics.Sprites;
|
|
|
|
using osu.Game.Graphics.UserInterfaceV2;
|
|
|
|
|
|
|
|
namespace osu.Game.Screens.Edit.Setup
|
|
|
|
{
|
|
|
|
internal class MetadataSection : SetupSection
|
|
|
|
{
|
|
|
|
private LabelledTextBox artistTextBox;
|
|
|
|
private LabelledTextBox titleTextBox;
|
|
|
|
private LabelledTextBox creatorTextBox;
|
|
|
|
private LabelledTextBox difficultyTextBox;
|
|
|
|
|
|
|
|
[BackgroundDependencyLoader]
|
|
|
|
private void load()
|
|
|
|
{
|
2020-10-06 18:26:57 +08:00
|
|
|
Children = new Drawable[]
|
2020-10-06 14:17:15 +08:00
|
|
|
{
|
|
|
|
new OsuSpriteText
|
|
|
|
{
|
|
|
|
Text = "Beatmap metadata"
|
|
|
|
},
|
|
|
|
artistTextBox = new LabelledTextBox
|
|
|
|
{
|
|
|
|
Label = "Artist",
|
2021-01-04 15:47:08 +08:00
|
|
|
Current = { Value = Beatmap.Metadata.Artist },
|
2020-10-06 14:17:15 +08:00
|
|
|
TabbableContentContainer = this
|
|
|
|
},
|
|
|
|
titleTextBox = new LabelledTextBox
|
|
|
|
{
|
|
|
|
Label = "Title",
|
2021-01-04 15:47:08 +08:00
|
|
|
Current = { Value = Beatmap.Metadata.Title },
|
2020-10-06 14:17:15 +08:00
|
|
|
TabbableContentContainer = this
|
|
|
|
},
|
|
|
|
creatorTextBox = new LabelledTextBox
|
|
|
|
{
|
|
|
|
Label = "Creator",
|
2021-01-04 15:47:08 +08:00
|
|
|
Current = { Value = Beatmap.Metadata.AuthorString },
|
2020-10-06 14:17:15 +08:00
|
|
|
TabbableContentContainer = this
|
|
|
|
},
|
|
|
|
difficultyTextBox = new LabelledTextBox
|
|
|
|
{
|
|
|
|
Label = "Difficulty Name",
|
2021-01-04 15:47:08 +08:00
|
|
|
Current = { Value = Beatmap.BeatmapInfo.Version },
|
2020-10-06 14:17:15 +08:00
|
|
|
TabbableContentContainer = this
|
|
|
|
},
|
|
|
|
};
|
|
|
|
|
2020-10-06 18:26:57 +08:00
|
|
|
foreach (var item in Children.OfType<LabelledTextBox>())
|
2020-10-06 14:17:15 +08:00
|
|
|
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.
|
2021-01-04 15:47:08 +08:00
|
|
|
Beatmap.Metadata.Artist = artistTextBox.Current.Value;
|
|
|
|
Beatmap.Metadata.Title = titleTextBox.Current.Value;
|
|
|
|
Beatmap.Metadata.AuthorString = creatorTextBox.Current.Value;
|
|
|
|
Beatmap.BeatmapInfo.Version = difficultyTextBox.Current.Value;
|
2020-10-06 14:17:15 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|