1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-28 04:42:58 +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[] Children = new Drawable[]
{ {
artistTextBox = new LabelledTextBox artistTextBox = createTextBox("Artist", Beatmap.Metadata.Artist),
{ titleTextBox = createTextBox("Title", Beatmap.Metadata.Title),
Label = "Artist", creatorTextBox = createTextBox("Creator", Beatmap.Metadata.AuthorString),
FixedLabelWidth = LABEL_WIDTH, difficultyTextBox = createTextBox("Difficulty Name", Beatmap.BeatmapInfo.Version)
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
},
}; };
foreach (var item in Children.OfType<LabelledTextBox>()) foreach (var item in Children.OfType<LabelledTextBox>())
item.OnCommit += onCommit; 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() protected override void LoadComplete()
{ {
base.LoadComplete(); base.LoadComplete();