forked from karaoke-dev/karaoke
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
It's time to collect all generators into same change handler.
means revert the change in the karaoke-dev#1958.
- Loading branch information
1 parent
3d519c8
commit aed896d
Showing
11 changed files
with
294 additions
and
227 deletions.
There are no files selected for viewing
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
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
39 changes: 0 additions & 39 deletions
39
osu.Game.Rulesets.Karaoke/Edit/ChangeHandlers/Lyrics/LyricNotesChangeHandler.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 |
---|---|---|
@@ -1,52 +1,13 @@ | ||
// Copyright (c) andy840119 <[email protected]>. Licensed under the GPL Licence. | ||
// See the LICENCE file in the repository root for full licence text. | ||
|
||
using System.Collections.Generic; | ||
using osu.Framework.Allocation; | ||
using osu.Framework.Localisation; | ||
using osu.Game.Rulesets.Karaoke.Edit.Generator.Lyrics.Notes; | ||
using osu.Game.Rulesets.Karaoke.Edit.Utils; | ||
using osu.Game.Rulesets.Karaoke.Objects; | ||
using osu.Game.Screens.Edit; | ||
|
||
namespace osu.Game.Rulesets.Karaoke.Edit.ChangeHandlers.Lyrics; | ||
|
||
public partial class LyricNotesChangeHandler : LyricPropertyChangeHandler, ILyricNotesChangeHandler | ||
{ | ||
#region Auto-Generate | ||
|
||
[Resolved] | ||
private EditorBeatmap beatmap { get; set; } = null!; | ||
|
||
public bool CanGenerate() | ||
{ | ||
var generator = GetGenerator<Note[], NoteGeneratorConfig>(); | ||
return CanGenerate(generator); | ||
} | ||
|
||
public IDictionary<Lyric, LocalisableString> GetGeneratorNotSupportedLyrics() | ||
{ | ||
var generator = GetGenerator<Note[], NoteGeneratorConfig>(); | ||
return GetInvalidMessageFromGenerator(generator); | ||
} | ||
|
||
public void AutoGenerate() | ||
{ | ||
var generator = GetGenerator<Note[], NoteGeneratorConfig>(); | ||
|
||
PerformOnSelection(lyric => | ||
{ | ||
// clear exist notes if from those | ||
var matchedNotes = EditorBeatmapUtils.GetNotesByLyric(beatmap, lyric); | ||
RemoveRange(matchedNotes); | ||
|
||
var notes = generator.Generate(lyric); | ||
AddRange(notes); | ||
}); | ||
} | ||
|
||
#endregion | ||
|
||
protected override bool IsWritePropertyLocked(Lyric lyric) | ||
=> HitObjectWritableUtils.IsCreateOrRemoveNoteLocked(lyric); | ||
} |
Oops, something went wrong.