1
0
mirror of https://github.com/ppy/osu.git synced 2024-09-22 03:27:24 +08:00

Split common method for metadata textbox creation

This commit is contained in:
Bartłomiej Dach 2021-06-10 13:55:34 +02:00
parent 35d5632355
commit 5a2e710095

View File

@ -24,40 +24,24 @@ namespace osu.Game.Screens.Edit.Setup
{
Children = new Drawable[]
{
artistTextBox = new LabelledTextBox
{
Label = "Artist",
FixedLabelWidth = LABEL_WIDTH,
Current = { Value = Beatmap.Metadata.Artist },
TabbableContentContainer = this
},
titleTextBox = new LabelledTextBox
{
Label = "Title",
FixedLabelWidth = LABEL_WIDTH,
Current = { Value = Beatmap.Metadata.Title },
TabbableContentContainer = this
},
creatorTextBox = new LabelledTextBox
{
Label = "Creator",
FixedLabelWidth = LABEL_WIDTH,
Current = { Value = Beatmap.Metadata.AuthorString },
TabbableContentContainer = this
},
difficultyTextBox = new LabelledTextBox
{
Label = "Difficulty Name",
FixedLabelWidth = LABEL_WIDTH,
Current = { Value = Beatmap.BeatmapInfo.Version },
TabbableContentContainer = this
},
artistTextBox = createTextBox("Artist", Beatmap.Metadata.Artist),
titleTextBox = createTextBox("Title", Beatmap.Metadata.Title),
creatorTextBox = createTextBox("Creator", Beatmap.Metadata.AuthorString),
difficultyTextBox = createTextBox("Difficulty Name", Beatmap.BeatmapInfo.Version)
};
foreach (var item in Children.OfType<LabelledTextBox>())
item.OnCommit += onCommit;
}
private LabelledTextBox createTextBox(string label, string initialValue) => new LabelledTextBox
{
Label = label,
FixedLabelWidth = LABEL_WIDTH,
Current = { Value = initialValue },
TabbableContentContainer = this
};
protected override void LoadComplete()
{
base.LoadComplete();