Skip to content

Commit

Permalink
Merge pull request #1097 from andy840119/remove-tricky-logic-to-acces…
Browse files Browse the repository at this point in the history
…s-the-editor

Use the better way for able to access editor in test scene.
  • Loading branch information
andy840119 authored Feb 5, 2022
2 parents 202fb9e + cdc0e2e commit a24a901
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 26 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,6 @@ public class TestKaraokeBeatmap : Beatmap
{
public TestKaraokeBeatmap(RulesetInfo ruleset)
{
// It's a tricky way not to trigger change handler throw exception.
// not a good solution, but seems ok because there's no other ruleset in the test case.
ruleset.OnlineID = 1;

var baseBeatmap = createTestBeatmap();

BeatmapInfo = baseBeatmap.BeatmapInfo;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@ private void load()
Dependencies.Cache(lyricCheckerManager);

Dependencies.Cache(new EditorClock());
Dependencies.CacheAs<IEditorChangeHandler>(new EditorChangeHandler(editorBeatmap));
}
}
}
21 changes: 0 additions & 21 deletions osu.Game.Rulesets.Karaoke/Edit/ImportLyric/LyricImporter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ public class LyricImporter : ScreenWithBeatmapBackground, IImportStateResolver
private readonly BindableBeatDivisor beatDivisor = new();

private EditorBeatmap editorBeatmap;
private ImportLyricEditorChangeHandler changeHandler;

private ImportLyricManager importManager;

Expand Down Expand Up @@ -96,8 +95,6 @@ private void load()
};
AddInternal(editorBeatmap = new EditorBeatmap(playableBeatmap));
dependencies.CacheAs(editorBeatmap);
changeHandler = new ImportLyricEditorChangeHandler(editorBeatmap);
dependencies.CacheAs<IEditorChangeHandler>(changeHandler);

AddInternal(importManager = new ImportLyricManager());
dependencies.Cache(importManager);
Expand Down Expand Up @@ -131,23 +128,5 @@ public LyricImporterWaveContainer()
FourthWaveColour = Color4Extensions.FromHex(@"392850");
}
}

/// <summary>
/// Use this class as temp class until <see cref="EditorChangeHandler"/> support customized beatmap.
/// </summary>
private class ImportLyricEditorChangeHandler : TransactionalCommitComponent, IEditorChangeHandler
{
public event Action OnStateChange;

public ImportLyricEditorChangeHandler(EditorBeatmap editorBeatmap)
{
}

protected override void UpdateState()
{
// do nothing.
OnStateChange?.Invoke();
}
}
}
}

0 comments on commit a24a901

Please sign in to comment.