mirror of
https://github.com/osukey/osukey.git
synced 2025-05-11 16:47:19 +09:00
Add rudimentary saving logic
This commit is contained in:
parent
f43f8cf6b9
commit
fe31edfa26
@ -1,10 +1,12 @@
|
|||||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
// 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.
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
|
using System.Linq;
|
||||||
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.Graphics.Shapes;
|
using osu.Framework.Graphics.Shapes;
|
||||||
|
using osu.Framework.Graphics.UserInterface;
|
||||||
using osu.Game.Beatmaps.Drawables;
|
using osu.Game.Beatmaps.Drawables;
|
||||||
using osu.Game.Graphics;
|
using osu.Game.Graphics;
|
||||||
using osu.Game.Graphics.Containers;
|
using osu.Game.Graphics.Containers;
|
||||||
@ -16,6 +18,12 @@ namespace osu.Game.Screens.Edit.Setup
|
|||||||
{
|
{
|
||||||
public class SetupScreen : EditorScreen
|
public class SetupScreen : EditorScreen
|
||||||
{
|
{
|
||||||
|
private FillFlowContainer flow;
|
||||||
|
private LabelledTextBox artistTextBox;
|
||||||
|
private LabelledTextBox titleTextBox;
|
||||||
|
private LabelledTextBox creatorTextBox;
|
||||||
|
private LabelledTextBox difficultyTextBox;
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load(OsuColour colours)
|
private void load(OsuColour colours)
|
||||||
{
|
{
|
||||||
@ -24,13 +32,14 @@ namespace osu.Game.Screens.Edit.Setup
|
|||||||
new Box
|
new Box
|
||||||
{
|
{
|
||||||
Colour = colours.Gray0,
|
Colour = colours.Gray0,
|
||||||
|
Alpha = 0.4f,
|
||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.Both,
|
||||||
},
|
},
|
||||||
new OsuScrollContainer
|
new OsuScrollContainer
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.Both,
|
||||||
Padding = new MarginPadding(50),
|
Padding = new MarginPadding(50),
|
||||||
Child = new FillFlowContainer
|
Child = flow = new FillFlowContainer
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.X,
|
RelativeSizeAxes = Axes.X,
|
||||||
AutoSizeAxes = Axes.Y,
|
AutoSizeAxes = Axes.Y,
|
||||||
@ -54,22 +63,22 @@ namespace osu.Game.Screens.Edit.Setup
|
|||||||
{
|
{
|
||||||
Text = "Beatmap metadata"
|
Text = "Beatmap metadata"
|
||||||
},
|
},
|
||||||
new LabelledTextBox
|
artistTextBox = new LabelledTextBox
|
||||||
{
|
{
|
||||||
Label = "Artist",
|
Label = "Artist",
|
||||||
Current = { Value = Beatmap.Value.Metadata.Artist }
|
Current = { Value = Beatmap.Value.Metadata.Artist }
|
||||||
},
|
},
|
||||||
new LabelledTextBox
|
titleTextBox = new LabelledTextBox
|
||||||
{
|
{
|
||||||
Label = "Title",
|
Label = "Title",
|
||||||
Current = { Value = Beatmap.Value.Metadata.Title }
|
Current = { Value = Beatmap.Value.Metadata.Title }
|
||||||
},
|
},
|
||||||
new LabelledTextBox
|
creatorTextBox = new LabelledTextBox
|
||||||
{
|
{
|
||||||
Label = "Creator",
|
Label = "Creator",
|
||||||
Current = { Value = Beatmap.Value.Metadata.AuthorString }
|
Current = { Value = Beatmap.Value.Metadata.AuthorString }
|
||||||
},
|
},
|
||||||
new LabelledTextBox
|
difficultyTextBox = new LabelledTextBox
|
||||||
{
|
{
|
||||||
Label = "Difficulty Name",
|
Label = "Difficulty Name",
|
||||||
Current = { Value = Beatmap.Value.BeatmapInfo.Version }
|
Current = { Value = Beatmap.Value.BeatmapInfo.Version }
|
||||||
@ -78,6 +87,21 @@ namespace osu.Game.Screens.Edit.Setup
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user