mirror of
https://github.com/ppy/osu.git
synced 2024-11-11 20:47:51 +08:00
Merge pull request #28738 from frenzibyte/fix-editor-difficulty-switch
Fix editor not updating ruleset when switching difficulty
This commit is contained in:
commit
244c4d7c20
@ -12,7 +12,9 @@ using osu.Framework.Testing;
|
|||||||
using osu.Game.Beatmaps;
|
using osu.Game.Beatmaps;
|
||||||
using osu.Game.Overlays.Dialog;
|
using osu.Game.Overlays.Dialog;
|
||||||
using osu.Game.Rulesets;
|
using osu.Game.Rulesets;
|
||||||
|
using osu.Game.Rulesets.Catch;
|
||||||
using osu.Game.Rulesets.Osu;
|
using osu.Game.Rulesets.Osu;
|
||||||
|
using osu.Game.Rulesets.Taiko;
|
||||||
using osu.Game.Rulesets.UI;
|
using osu.Game.Rulesets.UI;
|
||||||
using osu.Game.Screens.Edit;
|
using osu.Game.Screens.Edit;
|
||||||
using osu.Game.Storyboards;
|
using osu.Game.Storyboards;
|
||||||
@ -169,6 +171,24 @@ namespace osu.Game.Tests.Visual.Editing
|
|||||||
AddAssert("stack empty", () => Stack.CurrentScreen == null);
|
AddAssert("stack empty", () => Stack.CurrentScreen == null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void TestSwitchToDifficultyOfAnotherRuleset()
|
||||||
|
{
|
||||||
|
BeatmapInfo targetDifficulty = null;
|
||||||
|
|
||||||
|
AddAssert("ruleset is catch", () => Ruleset.Value.CreateInstance() is CatchRuleset);
|
||||||
|
|
||||||
|
AddStep("set taiko difficulty", () => targetDifficulty = importedBeatmapSet.Beatmaps.First(b => b.Ruleset.OnlineID == 1));
|
||||||
|
switchToDifficulty(() => targetDifficulty);
|
||||||
|
confirmEditingBeatmap(() => targetDifficulty);
|
||||||
|
|
||||||
|
AddAssert("ruleset switched to taiko", () => Ruleset.Value.CreateInstance() is TaikoRuleset);
|
||||||
|
|
||||||
|
AddStep("exit editor forcefully", () => Stack.Exit());
|
||||||
|
// ensure editor loader didn't resume.
|
||||||
|
AddAssert("stack empty", () => Stack.CurrentScreen == null);
|
||||||
|
}
|
||||||
|
|
||||||
private void switchToDifficulty(Func<BeatmapInfo> difficulty) => AddStep("switch to difficulty", () => Editor.SwitchToDifficulty(difficulty.Invoke()));
|
private void switchToDifficulty(Func<BeatmapInfo> difficulty) => AddStep("switch to difficulty", () => Editor.SwitchToDifficulty(difficulty.Invoke()));
|
||||||
|
|
||||||
private void confirmEditingBeatmap(Func<BeatmapInfo> targetDifficulty)
|
private void confirmEditingBeatmap(Func<BeatmapInfo> targetDifficulty)
|
||||||
|
@ -121,7 +121,11 @@ namespace osu.Game.Screens.Edit
|
|||||||
|
|
||||||
scheduledDifficultySwitch = Schedule(() =>
|
scheduledDifficultySwitch = Schedule(() =>
|
||||||
{
|
{
|
||||||
Beatmap.Value = nextBeatmap.Invoke();
|
var workingBeatmap = nextBeatmap.Invoke();
|
||||||
|
|
||||||
|
Ruleset.Value = workingBeatmap.BeatmapInfo.Ruleset;
|
||||||
|
Beatmap.Value = workingBeatmap;
|
||||||
|
|
||||||
state = editorState;
|
state = editorState;
|
||||||
|
|
||||||
// This screen is a weird exception to the rule that nothing after song select changes the global beatmap.
|
// This screen is a weird exception to the rule that nothing after song select changes the global beatmap.
|
||||||
|
Loading…
Reference in New Issue
Block a user