diff --git a/osu.Game.Rulesets.Karaoke/Edit/Setup/KaraokeNoteSection.cs b/osu.Game.Rulesets.Karaoke/Edit/Setup/KaraokeNoteSection.cs new file mode 100644 index 000000000..d3e65f593 --- /dev/null +++ b/osu.Game.Rulesets.Karaoke/Edit/Setup/KaraokeNoteSection.cs @@ -0,0 +1,43 @@ +// Copyright (c) andy840119 . Licensed under the GPL Licence. +// See the LICENCE file in the repository root for full licence text. + +using System; +using osu.Framework.Allocation; +using osu.Framework.Graphics; +using osu.Framework.Localisation; +using osu.Game.Graphics.UserInterfaceV2; +using osu.Game.Rulesets.Karaoke.Beatmaps; +using osu.Game.Screens.Edit.Setup; + +namespace osu.Game.Rulesets.Karaoke.Edit.Setup; + +public partial class KaraokeNoteSection : SetupSection +{ + public override LocalisableString Title => "Note"; + + private LabelledSwitchButton scorable = null!; + + [BackgroundDependencyLoader] + private void load() + { + Children = new Drawable[] + { + scorable = new LabelledSwitchButton + { + Label = "Scorable", + Description = "Will not show score playfield if the option is unchecked.", + Current = { Value = true }, + }, + }; + + scorable.Current.BindValueChanged(_ => updateValues()); + } + + private void updateValues() + { + if (Beatmap.PlayableBeatmap is not KaraokeBeatmap karaokeBeatmap) + throw new InvalidOperationException(); + + karaokeBeatmap.Scorable = scorable.Current.Value; + } +} diff --git a/osu.Game.Rulesets.Karaoke/Edit/Setup/KaraokeSetupSection.cs b/osu.Game.Rulesets.Karaoke/Edit/Setup/KaraokeSetupSection.cs deleted file mode 100644 index 8a210e066..000000000 --- a/osu.Game.Rulesets.Karaoke/Edit/Setup/KaraokeSetupSection.cs +++ /dev/null @@ -1,59 +0,0 @@ -// Copyright (c) andy840119 . Licensed under the GPL Licence. -// See the LICENCE file in the repository root for full licence text. - -using osu.Framework.Allocation; -using osu.Framework.Graphics; -using osu.Game.Graphics.UserInterfaceV2; -using osu.Game.Rulesets.Karaoke.Beatmaps; -using osu.Game.Rulesets.Karaoke.Edit.Setup.Components; -using osu.Game.Rulesets.Karaoke.Edit.Utils; -using osu.Game.Screens.Edit.Setup; - -namespace osu.Game.Rulesets.Karaoke.Edit.Setup; - -public partial class KaraokeSetupSection : RulesetSetupSection -{ - private KaraokeBeatmap karaokeBeatmap => EditorBeatmapUtils.GetPlayableBeatmap(Beatmap); - - private LabelledSwitchButton scorable = null!; - private LabelledSingerList singerList = null!; - - public KaraokeSetupSection() - : base(new KaraokeRuleset().RulesetInfo) - { - } - - [BackgroundDependencyLoader] - private void load() - { - Children = new Drawable[] - { - scorable = new LabelledSwitchButton - { - Label = "Scorable", - Description = "Will not show score playfield if the option is unchecked.", - Current = { Value = true }, - }, - singerList = new LabelledSingerList - { - Label = "Singer list", - Description = "All the singers in beatmap.", - FixedLabelWidth = LABEL_WIDTH, - SingerNamePrefix = "#", - }, - }; - } - - protected override void LoadComplete() - { - base.LoadComplete(); - - scorable.Current.BindValueChanged(_ => updateBeatmap()); - } - - private void updateBeatmap() - { - // todo: update the value. - // karaokeBeatmap.Scorable = scorable.Current.Value; - } -} diff --git a/osu.Game.Rulesets.Karaoke/Edit/Setup/KaraokeSingerSection.cs b/osu.Game.Rulesets.Karaoke/Edit/Setup/KaraokeSingerSection.cs new file mode 100644 index 000000000..1d8008940 --- /dev/null +++ b/osu.Game.Rulesets.Karaoke/Edit/Setup/KaraokeSingerSection.cs @@ -0,0 +1,32 @@ +// Copyright (c) andy840119 . Licensed under the GPL Licence. +// See the LICENCE file in the repository root for full licence text. + +using osu.Framework.Allocation; +using osu.Framework.Graphics; +using osu.Framework.Localisation; +using osu.Game.Rulesets.Karaoke.Edit.Setup.Components; +using osu.Game.Screens.Edit.Setup; + +namespace osu.Game.Rulesets.Karaoke.Edit.Setup; + +public partial class KaraokeSingerSection : SetupSection +{ + public override LocalisableString Title => "Singers"; + + private LabelledSingerList singerList = null!; + + [BackgroundDependencyLoader] + private void load() + { + Children = new Drawable[] + { + singerList = new LabelledSingerList + { + Label = "Singer list", + Description = "All the singers in beatmap.", + FixedLabelWidth = LABEL_WIDTH, + SingerNamePrefix = "#", + }, + }; + } +} diff --git a/osu.Game.Rulesets.Karaoke/KaraokeRuleset.cs b/osu.Game.Rulesets.Karaoke/KaraokeRuleset.cs index 7c1df53cd..424c6843c 100644 --- a/osu.Game.Rulesets.Karaoke/KaraokeRuleset.cs +++ b/osu.Game.Rulesets.Karaoke/KaraokeRuleset.cs @@ -280,7 +280,11 @@ public override StatisticItem[] CreateStatisticsForScore(ScoreInfo score, IBeatm return statistic.ToArray(); } - public override RulesetSetupSection CreateEditorSetupSection() => new KaraokeSetupSection(); + public override IEnumerable CreateEditorSetupSections() => new SetupSection[] + { + new KaraokeSingerSection(), + new KaraokeNoteSection(), + }; public KaraokeRuleset() {