Skip to content

Commit

Permalink
Let the singer section able to edit the singer in the beatmap.
Browse files Browse the repository at this point in the history
  • Loading branch information
andy840119 committed Sep 25, 2024
1 parent 65ecf43 commit b4f24b1
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,6 @@ private void updateSingers()

singers.Add(new AddSingerButton
{
// todo : use better way to create singer with right id.
Action = () => Singers.Add(new Singer
{
Name = "New singer",
Expand Down
12 changes: 12 additions & 0 deletions osu.Game.Rulesets.Karaoke/Edit/Setup/KaraokeSingerSection.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Framework.Localisation;
using osu.Game.Rulesets.Karaoke.Beatmaps;
using osu.Game.Rulesets.Karaoke.Edit.ChangeHandlers.Beatmaps;
using osu.Game.Rulesets.Karaoke.Edit.Setup.Components;
using osu.Game.Screens.Edit.Setup;

Expand All @@ -13,11 +15,18 @@ public partial class KaraokeSingerSection : SetupSection
{
public override LocalisableString Title => "Singers";

[Cached(typeof(IKaraokeBeatmapResourcesProvider))]
private KaraokeBeatmapResourcesProvider karaokeBeatmapResourcesProvider = new();

private readonly IBeatmapSingersChangeHandler changeHandler = new BeatmapSingersChangeHandler();

private LabelledSingerList singerList = null!;

[BackgroundDependencyLoader]
private void load()
{
AddInternal(karaokeBeatmapResourcesProvider);

Children = new Drawable[]
{
singerList = new LabelledSingerList
Expand All @@ -28,5 +37,8 @@ private void load()
SingerNamePrefix = "#",
},
};

if (Beatmap.BeatmapSkin != null)
singerList.Singers.BindTo(changeHandler.Singers);
}
}

0 comments on commit b4f24b1

Please sign in to comment.