Skip to content

Commit

Permalink
Re-write the edit section.
Browse files Browse the repository at this point in the history
  • Loading branch information
andy840119 committed Jul 20, 2024
1 parent d9f052e commit 7969515
Show file tree
Hide file tree
Showing 4 changed files with 80 additions and 60 deletions.
43 changes: 43 additions & 0 deletions osu.Game.Rulesets.Karaoke/Edit/Setup/KaraokeNoteSection.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
// Copyright (c) andy840119 <[email protected]>. 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;
}
}
59 changes: 0 additions & 59 deletions osu.Game.Rulesets.Karaoke/Edit/Setup/KaraokeSetupSection.cs

This file was deleted.

32 changes: 32 additions & 0 deletions osu.Game.Rulesets.Karaoke/Edit/Setup/KaraokeSingerSection.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
// Copyright (c) andy840119 <[email protected]>. 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 = "#",
},
};
}
}
6 changes: 5 additions & 1 deletion osu.Game.Rulesets.Karaoke/KaraokeRuleset.cs
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,11 @@ public override StatisticItem[] CreateStatisticsForScore(ScoreInfo score, IBeatm
return statistic.ToArray();
}

public override RulesetSetupSection CreateEditorSetupSection() => new KaraokeSetupSection();
public override IEnumerable<SetupSection> CreateEditorSetupSections() => new SetupSection[]
{
new KaraokeSingerSection(),
new KaraokeNoteSection(),
};

public KaraokeRuleset()
{
Expand Down

0 comments on commit 7969515

Please sign in to comment.