-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1845 from andy840119/implement-items-section
Implement items editor for the section.
- Loading branch information
Showing
9 changed files
with
457 additions
and
306 deletions.
There are no files selected for viewing
44 changes: 44 additions & 0 deletions
44
osu.Game.Rulesets.Karaoke/Screens/Edit/Beatmaps/Lyrics/Settings/LyricPropertiesSection.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
// 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.Bindables; | ||
using osu.Game.Rulesets.Karaoke.Objects; | ||
|
||
namespace osu.Game.Rulesets.Karaoke.Screens.Edit.Beatmaps.Lyrics.Settings; | ||
|
||
public abstract partial class LyricPropertiesSection<TModel> : LyricPropertySection where TModel : class | ||
{ | ||
private readonly LyricPropertiesEditor itemsEditor; | ||
|
||
protected LyricPropertiesSection() | ||
{ | ||
Add(itemsEditor = CreateLyricPropertiesEditor()); | ||
} | ||
|
||
protected sealed override void OnLyricChanged(Lyric? lyric) | ||
{ | ||
itemsEditor.OnLyricChanged(lyric); | ||
} | ||
|
||
protected abstract LyricPropertiesEditor CreateLyricPropertiesEditor(); | ||
|
||
protected abstract partial class LyricPropertiesEditor : SectionItemsEditor<TModel> | ||
{ | ||
private Lyric? currentLyric; | ||
|
||
protected Lyric CurrentLyric => currentLyric ?? throw new InvalidOperationException(); | ||
|
||
public void OnLyricChanged(Lyric? lyric) | ||
{ | ||
currentLyric = lyric; | ||
|
||
Items.UnbindBindings(); | ||
|
||
if (lyric != null) | ||
Items.BindTo(GetItems(lyric)); | ||
} | ||
|
||
protected abstract IBindableList<TModel> GetItems(Lyric lyric); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.