mirror of
https://github.com/ppy/osu.git
synced 2024-11-11 12:17:26 +08:00
Merge pull request #25665 from bdach/skin-editor-breakage
Fix several edge cases in skin editor gameplay scene opening flow
This commit is contained in:
commit
f0364f01ea
@ -12,9 +12,12 @@ using osu.Framework.Graphics.UserInterface;
|
|||||||
using osu.Framework.Screens;
|
using osu.Framework.Screens;
|
||||||
using osu.Framework.Testing;
|
using osu.Framework.Testing;
|
||||||
using osu.Framework.Threading;
|
using osu.Framework.Threading;
|
||||||
|
using osu.Game.Online.API;
|
||||||
|
using osu.Game.Beatmaps;
|
||||||
using osu.Game.Overlays.Settings;
|
using osu.Game.Overlays.Settings;
|
||||||
using osu.Game.Overlays.SkinEditor;
|
using osu.Game.Overlays.SkinEditor;
|
||||||
using osu.Game.Rulesets.Mods;
|
using osu.Game.Rulesets.Mods;
|
||||||
|
using osu.Game.Rulesets.Osu;
|
||||||
using osu.Game.Rulesets.Osu.Mods;
|
using osu.Game.Rulesets.Osu.Mods;
|
||||||
using osu.Game.Screens.Edit.Components;
|
using osu.Game.Screens.Edit.Components;
|
||||||
using osu.Game.Screens.Play;
|
using osu.Game.Screens.Play;
|
||||||
@ -38,6 +41,9 @@ namespace osu.Game.Tests.Visual.Navigation
|
|||||||
advanceToSongSelect();
|
advanceToSongSelect();
|
||||||
openSkinEditor();
|
openSkinEditor();
|
||||||
|
|
||||||
|
AddStep("import beatmap", () => BeatmapImportHelper.LoadQuickOszIntoOsu(Game).WaitSafely());
|
||||||
|
AddUntilStep("wait for selected", () => !Game.Beatmap.IsDefault);
|
||||||
|
|
||||||
switchToGameplayScene();
|
switchToGameplayScene();
|
||||||
|
|
||||||
BarHitErrorMeter hitErrorMeter = null;
|
BarHitErrorMeter hitErrorMeter = null;
|
||||||
@ -98,6 +104,10 @@ namespace osu.Game.Tests.Visual.Navigation
|
|||||||
{
|
{
|
||||||
advanceToSongSelect();
|
advanceToSongSelect();
|
||||||
openSkinEditor();
|
openSkinEditor();
|
||||||
|
|
||||||
|
AddStep("import beatmap", () => BeatmapImportHelper.LoadQuickOszIntoOsu(Game).WaitSafely());
|
||||||
|
AddUntilStep("wait for selected", () => !Game.Beatmap.IsDefault);
|
||||||
|
|
||||||
switchToGameplayScene();
|
switchToGameplayScene();
|
||||||
|
|
||||||
AddUntilStep("wait for components", () => skinEditor.ChildrenOfType<SkinBlueprint>().Any());
|
AddUntilStep("wait for components", () => skinEditor.ChildrenOfType<SkinBlueprint>().Any());
|
||||||
@ -162,6 +172,9 @@ namespace osu.Game.Tests.Visual.Navigation
|
|||||||
openSkinEditor();
|
openSkinEditor();
|
||||||
AddStep("select DT", () => Game.SelectedMods.Value = new Mod[] { new OsuModDoubleTime() });
|
AddStep("select DT", () => Game.SelectedMods.Value = new Mod[] { new OsuModDoubleTime() });
|
||||||
|
|
||||||
|
AddStep("import beatmap", () => BeatmapImportHelper.LoadQuickOszIntoOsu(Game).WaitSafely());
|
||||||
|
AddUntilStep("wait for selected", () => !Game.Beatmap.IsDefault);
|
||||||
|
|
||||||
switchToGameplayScene();
|
switchToGameplayScene();
|
||||||
|
|
||||||
AddAssert("DT still selected", () => ((Player)Game.ScreenStack.CurrentScreen).Mods.Value.Single() is OsuModDoubleTime);
|
AddAssert("DT still selected", () => ((Player)Game.ScreenStack.CurrentScreen).Mods.Value.Single() is OsuModDoubleTime);
|
||||||
@ -174,6 +187,9 @@ namespace osu.Game.Tests.Visual.Navigation
|
|||||||
openSkinEditor();
|
openSkinEditor();
|
||||||
AddStep("select relax and spun out", () => Game.SelectedMods.Value = new Mod[] { new OsuModRelax(), new OsuModSpunOut() });
|
AddStep("select relax and spun out", () => Game.SelectedMods.Value = new Mod[] { new OsuModRelax(), new OsuModSpunOut() });
|
||||||
|
|
||||||
|
AddStep("import beatmap", () => BeatmapImportHelper.LoadQuickOszIntoOsu(Game).WaitSafely());
|
||||||
|
AddUntilStep("wait for selected", () => !Game.Beatmap.IsDefault);
|
||||||
|
|
||||||
switchToGameplayScene();
|
switchToGameplayScene();
|
||||||
|
|
||||||
AddAssert("no mod selected", () => !((Player)Game.ScreenStack.CurrentScreen).Mods.Value.Any());
|
AddAssert("no mod selected", () => !((Player)Game.ScreenStack.CurrentScreen).Mods.Value.Any());
|
||||||
@ -186,6 +202,9 @@ namespace osu.Game.Tests.Visual.Navigation
|
|||||||
openSkinEditor();
|
openSkinEditor();
|
||||||
AddStep("select autoplay", () => Game.SelectedMods.Value = new Mod[] { new OsuModAutoplay() });
|
AddStep("select autoplay", () => Game.SelectedMods.Value = new Mod[] { new OsuModAutoplay() });
|
||||||
|
|
||||||
|
AddStep("import beatmap", () => BeatmapImportHelper.LoadQuickOszIntoOsu(Game).WaitSafely());
|
||||||
|
AddUntilStep("wait for selected", () => !Game.Beatmap.IsDefault);
|
||||||
|
|
||||||
switchToGameplayScene();
|
switchToGameplayScene();
|
||||||
|
|
||||||
AddAssert("no mod selected", () => !((Player)Game.ScreenStack.CurrentScreen).Mods.Value.Any());
|
AddAssert("no mod selected", () => !((Player)Game.ScreenStack.CurrentScreen).Mods.Value.Any());
|
||||||
@ -198,6 +217,9 @@ namespace osu.Game.Tests.Visual.Navigation
|
|||||||
openSkinEditor();
|
openSkinEditor();
|
||||||
AddStep("select cinema", () => Game.SelectedMods.Value = new Mod[] { new OsuModCinema() });
|
AddStep("select cinema", () => Game.SelectedMods.Value = new Mod[] { new OsuModCinema() });
|
||||||
|
|
||||||
|
AddStep("import beatmap", () => BeatmapImportHelper.LoadQuickOszIntoOsu(Game).WaitSafely());
|
||||||
|
AddUntilStep("wait for selected", () => !Game.Beatmap.IsDefault);
|
||||||
|
|
||||||
switchToGameplayScene();
|
switchToGameplayScene();
|
||||||
|
|
||||||
AddAssert("no mod selected", () => !((Player)Game.ScreenStack.CurrentScreen).Mods.Value.Any());
|
AddAssert("no mod selected", () => !((Player)Game.ScreenStack.CurrentScreen).Mods.Value.Any());
|
||||||
@ -240,6 +262,43 @@ namespace osu.Game.Tests.Visual.Navigation
|
|||||||
AddAssert("editor sidebars not empty", () => skinEditor.ChildrenOfType<EditorSidebar>().SelectMany(sidebar => sidebar.Children).Count(), () => Is.GreaterThan(0));
|
AddAssert("editor sidebars not empty", () => skinEditor.ChildrenOfType<EditorSidebar>().SelectMany(sidebar => sidebar.Children).Count(), () => Is.GreaterThan(0));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void TestOpenSkinEditorGameplaySceneOnBeatmapWithNoObjects()
|
||||||
|
{
|
||||||
|
AddStep("set dummy beatmap", () => Game.Beatmap.SetDefault());
|
||||||
|
advanceToSongSelect();
|
||||||
|
|
||||||
|
AddStep("create empty beatmap", () => Game.BeatmapManager.CreateNew(new OsuRuleset().RulesetInfo, new GuestUser()));
|
||||||
|
AddUntilStep("wait for selected", () => !Game.Beatmap.IsDefault);
|
||||||
|
|
||||||
|
openSkinEditor();
|
||||||
|
switchToGameplayScene();
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void TestOpenSkinEditorGameplaySceneWhenDummyBeatmapActive()
|
||||||
|
{
|
||||||
|
AddStep("set dummy beatmap", () => Game.Beatmap.SetDefault());
|
||||||
|
|
||||||
|
openSkinEditor();
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void TestOpenSkinEditorGameplaySceneWhenDifferentRulesetActive()
|
||||||
|
{
|
||||||
|
BeatmapSetInfo beatmapSet = null!;
|
||||||
|
|
||||||
|
AddStep("import beatmap", () => beatmapSet = BeatmapImportHelper.LoadQuickOszIntoOsu(Game).GetResultSafely());
|
||||||
|
AddStep("select mania difficulty", () =>
|
||||||
|
{
|
||||||
|
var beatmap = beatmapSet.Beatmaps.First(b => b.Ruleset.OnlineID == 3);
|
||||||
|
Game.Beatmap.Value = Game.BeatmapManager.GetWorkingBeatmap(beatmap);
|
||||||
|
});
|
||||||
|
|
||||||
|
openSkinEditor();
|
||||||
|
switchToGameplayScene();
|
||||||
|
}
|
||||||
|
|
||||||
private void advanceToSongSelect()
|
private void advanceToSongSelect()
|
||||||
{
|
{
|
||||||
PushAndConfirm(() => songSelect = new TestPlaySongSelect());
|
PushAndConfirm(() => songSelect = new TestPlaySongSelect());
|
||||||
@ -266,9 +325,6 @@ namespace osu.Game.Tests.Visual.Navigation
|
|||||||
|
|
||||||
private void switchToGameplayScene()
|
private void switchToGameplayScene()
|
||||||
{
|
{
|
||||||
AddStep("import beatmap", () => BeatmapImportHelper.LoadQuickOszIntoOsu(Game).WaitSafely());
|
|
||||||
AddUntilStep("wait for selected", () => !Game.Beatmap.IsDefault);
|
|
||||||
|
|
||||||
AddStep("Click gameplay scene button", () =>
|
AddStep("Click gameplay scene button", () =>
|
||||||
{
|
{
|
||||||
InputManager.MoveMouseTo(skinEditor.ChildrenOfType<SkinEditorSceneLibrary.SceneButton>().First(b => b.Text.ToString() == "Gameplay"));
|
InputManager.MoveMouseTo(skinEditor.ChildrenOfType<SkinEditorSceneLibrary.SceneButton>().First(b => b.Text.ToString() == "Gameplay"));
|
||||||
|
@ -17,7 +17,6 @@ using osu.Game.Beatmaps;
|
|||||||
using osu.Game.Configuration;
|
using osu.Game.Configuration;
|
||||||
using osu.Game.Graphics.Containers;
|
using osu.Game.Graphics.Containers;
|
||||||
using osu.Game.Input.Bindings;
|
using osu.Game.Input.Bindings;
|
||||||
using osu.Game.Rulesets;
|
|
||||||
using osu.Game.Rulesets.Mods;
|
using osu.Game.Rulesets.Mods;
|
||||||
using osu.Game.Scoring;
|
using osu.Game.Scoring;
|
||||||
using osu.Game.Screens;
|
using osu.Game.Screens;
|
||||||
@ -26,6 +25,7 @@ using osu.Game.Screens.Edit.Components;
|
|||||||
using osu.Game.Screens.Menu;
|
using osu.Game.Screens.Menu;
|
||||||
using osu.Game.Screens.Play;
|
using osu.Game.Screens.Play;
|
||||||
using osu.Game.Screens.Select;
|
using osu.Game.Screens.Select;
|
||||||
|
using osu.Game.Users;
|
||||||
using osu.Game.Utils;
|
using osu.Game.Utils;
|
||||||
using osuTK;
|
using osuTK;
|
||||||
|
|
||||||
@ -55,9 +55,6 @@ namespace osu.Game.Overlays.SkinEditor
|
|||||||
[Resolved]
|
[Resolved]
|
||||||
private MusicController music { get; set; } = null!;
|
private MusicController music { get; set; } = null!;
|
||||||
|
|
||||||
[Resolved]
|
|
||||||
private IBindable<RulesetInfo> ruleset { get; set; } = null!;
|
|
||||||
|
|
||||||
[Resolved]
|
[Resolved]
|
||||||
private Bindable<IReadOnlyList<Mod>> mods { get; set; } = null!;
|
private Bindable<IReadOnlyList<Mod>> mods { get; set; } = null!;
|
||||||
|
|
||||||
@ -139,6 +136,12 @@ namespace osu.Game.Overlays.SkinEditor
|
|||||||
{
|
{
|
||||||
performer?.PerformFromScreen(screen =>
|
performer?.PerformFromScreen(screen =>
|
||||||
{
|
{
|
||||||
|
if (beatmap.Value is DummyWorkingBeatmap)
|
||||||
|
{
|
||||||
|
// presume we don't have anything good to play and just bail.
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// If we're playing the intro, switch away to another beatmap.
|
// If we're playing the intro, switch away to another beatmap.
|
||||||
if (beatmap.Value.BeatmapSetInfo.Protected)
|
if (beatmap.Value.BeatmapSetInfo.Protected)
|
||||||
{
|
{
|
||||||
@ -150,7 +153,7 @@ namespace osu.Game.Overlays.SkinEditor
|
|||||||
if (screen is Player)
|
if (screen is Player)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
var replayGeneratingMod = ruleset.Value.CreateInstance().GetAutoplayMod();
|
var replayGeneratingMod = beatmap.Value.BeatmapInfo.Ruleset.CreateInstance().GetAutoplayMod();
|
||||||
|
|
||||||
IReadOnlyList<Mod> usableMods = mods.Value;
|
IReadOnlyList<Mod> usableMods = mods.Value;
|
||||||
|
|
||||||
@ -285,6 +288,8 @@ namespace osu.Game.Overlays.SkinEditor
|
|||||||
|
|
||||||
private partial class EndlessPlayer : ReplayPlayer
|
private partial class EndlessPlayer : ReplayPlayer
|
||||||
{
|
{
|
||||||
|
protected override UserActivity? InitialActivity => null;
|
||||||
|
|
||||||
public EndlessPlayer(Func<IBeatmap, IReadOnlyList<Mod>, Score> createScore)
|
public EndlessPlayer(Func<IBeatmap, IReadOnlyList<Mod>, Score> createScore)
|
||||||
: base(createScore, new PlayerConfiguration
|
: base(createScore, new PlayerConfiguration
|
||||||
{
|
{
|
||||||
@ -294,10 +299,21 @@ namespace osu.Game.Overlays.SkinEditor
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected override void LoadComplete()
|
||||||
|
{
|
||||||
|
base.LoadComplete();
|
||||||
|
|
||||||
|
if (!LoadedBeatmapSuccessfully)
|
||||||
|
Scheduler.AddDelayed(this.Exit, 3000);
|
||||||
|
}
|
||||||
|
|
||||||
protected override void Update()
|
protected override void Update()
|
||||||
{
|
{
|
||||||
base.Update();
|
base.Update();
|
||||||
|
|
||||||
|
if (!LoadedBeatmapSuccessfully)
|
||||||
|
return;
|
||||||
|
|
||||||
if (GameplayState.HasPassed)
|
if (GameplayState.HasPassed)
|
||||||
GameplayClockContainer.Seek(0);
|
GameplayClockContainer.Seek(0);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user