1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-26 16:12:54 +08:00

Add intermediary screen to avoid going back to menus

This commit is contained in:
Bartłomiej Dach 2021-09-05 16:59:28 +02:00
parent 7befd030df
commit fe2520c599
No known key found for this signature in database
GPG Key ID: BCECCD4FA41F6497
4 changed files with 44 additions and 8 deletions

View File

@ -5,6 +5,7 @@ using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using JetBrains.Annotations;
using osu.Framework;
using osu.Framework.Allocation;
using osu.Framework.Bindables;
@ -35,9 +36,7 @@ using osu.Game.Screens.Edit.Design;
using osu.Game.Screens.Edit.Setup;
using osu.Game.Screens.Edit.Timing;
using osu.Game.Screens.Edit.Verify;
using osu.Game.Screens.Menu;
using osu.Game.Screens.Play;
using osu.Game.Screens.Select;
using osu.Game.Users;
using osuTK.Graphics;
using osuTK.Input;
@ -77,6 +76,9 @@ namespace osu.Game.Screens.Edit
private Container<EditorScreen> screenContainer;
[CanBeNull]
private readonly EditorLoader loader;
private EditorScreen currentScreen;
private readonly BindableBeatDivisor beatDivisor = new BindableBeatDivisor();
@ -106,6 +108,11 @@ namespace osu.Game.Screens.Edit
[Resolved(CanBeNull = true)]
private OsuGame game { get; set; }
public Editor(EditorLoader loader = null)
{
this.loader = loader;
}
[BackgroundDependencyLoader]
private void load(OsuColour colours, OsuConfigManager config)
{
@ -730,12 +737,14 @@ namespace osu.Game.Screens.Edit
{
menuItem.Action.Value = () =>
{
if (loader != null)
loader.ValidForResume = true;
game?.PerformFromScreen(screen =>
{
var osuScreen = (OsuScreen)screen;
osuScreen.Beatmap.Value = beatmapManager.GetWorkingBeatmap(b);
screen.Push(new Editor());
}, new[] { typeof(MainMenu), typeof(SongSelect) });
if (screen != null && screen == loader)
loader.PushEditor();
}, new[] { typeof(EditorLoader) });
};
}

View File

@ -0,0 +1,27 @@
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using osu.Framework.Screens;
using osu.Game.Screens.Play;
namespace osu.Game.Screens.Edit
{
/// <summary>
/// Transition screen for the editor.
/// Used to avoid backing out to main menu/song select when switching difficulties from within the editor.
/// </summary>
public class EditorLoader : ScreenWithBeatmapBackground
{
public override void OnEntering(IScreen last)
{
base.OnEntering(last);
PushEditor();
}
public void PushEditor()
{
this.Push(new Editor(this));
ValidForResume = false;
}
}
}

View File

@ -103,7 +103,7 @@ namespace osu.Game.Screens.Menu
OnEdit = delegate
{
Beatmap.SetDefault();
this.Push(new Editor());
this.Push(new EditorLoader());
},
OnSolo = loadSoloSongSelect,
OnMultiplayer = () => this.Push(new Multiplayer()),

View File

@ -349,7 +349,7 @@ namespace osu.Game.Screens.Select
throw new InvalidOperationException($"Attempted to edit when {nameof(AllowEditing)} is disabled");
Beatmap.Value = beatmaps.GetWorkingBeatmap(beatmap ?? beatmapNoDebounce);
this.Push(new Editor());
this.Push(new EditorLoader());
}
/// <summary>