mirror of
https://github.com/ppy/osu.git
synced 2025-02-15 19:33:20 +08:00
Fix issues with main menu -> editor loader transition
This commit is contained in:
parent
74a129dc27
commit
7012a1d934
@ -11,6 +11,7 @@ using osu.Game.Graphics.UserInterface;
|
|||||||
using osu.Game.Overlays.Dialog;
|
using osu.Game.Overlays.Dialog;
|
||||||
using osu.Game.Screens.Edit;
|
using osu.Game.Screens.Edit;
|
||||||
using osu.Game.Screens.Edit.Components.Menus;
|
using osu.Game.Screens.Edit.Components.Menus;
|
||||||
|
using osu.Game.Screens.Menu;
|
||||||
using osu.Game.Tests.Beatmaps.IO;
|
using osu.Game.Tests.Beatmaps.IO;
|
||||||
using osuTK.Input;
|
using osuTK.Input;
|
||||||
|
|
||||||
@ -19,15 +20,25 @@ namespace osu.Game.Tests.Visual.Editing
|
|||||||
public class TestSceneDifficultySwitching : ScreenTestScene
|
public class TestSceneDifficultySwitching : ScreenTestScene
|
||||||
{
|
{
|
||||||
private BeatmapSetInfo importedBeatmapSet;
|
private BeatmapSetInfo importedBeatmapSet;
|
||||||
|
private Editor editor;
|
||||||
|
|
||||||
|
// required for screen transitions to work properly
|
||||||
|
// (see comment in EditorLoader.LogoArriving).
|
||||||
|
[Cached]
|
||||||
|
private OsuLogo logo = new OsuLogo
|
||||||
|
{
|
||||||
|
Alpha = 0
|
||||||
|
};
|
||||||
|
|
||||||
[Resolved]
|
[Resolved]
|
||||||
private OsuGameBase game { get; set; }
|
private OsuGameBase game { get; set; }
|
||||||
|
|
||||||
private Editor editor;
|
|
||||||
|
|
||||||
[Resolved]
|
[Resolved]
|
||||||
private BeatmapManager beatmaps { get; set; }
|
private BeatmapManager beatmaps { get; set; }
|
||||||
|
|
||||||
|
[BackgroundDependencyLoader]
|
||||||
|
private void load() => Add(logo);
|
||||||
|
|
||||||
[SetUpSteps]
|
[SetUpSteps]
|
||||||
public void SetUp()
|
public void SetUp()
|
||||||
{
|
{
|
||||||
|
@ -3,10 +3,11 @@
|
|||||||
|
|
||||||
using JetBrains.Annotations;
|
using JetBrains.Annotations;
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Screens;
|
using osu.Framework.Screens;
|
||||||
using osu.Framework.Threading;
|
using osu.Framework.Threading;
|
||||||
using osu.Game.Beatmaps;
|
using osu.Game.Beatmaps;
|
||||||
using osu.Game.Screens.Play;
|
using osu.Game.Screens.Menu;
|
||||||
|
|
||||||
namespace osu.Game.Screens.Edit
|
namespace osu.Game.Screens.Edit
|
||||||
{
|
{
|
||||||
@ -14,18 +15,29 @@ namespace osu.Game.Screens.Edit
|
|||||||
/// Transition screen for the editor.
|
/// Transition screen for the editor.
|
||||||
/// Used to avoid backing out to main menu/song select when switching difficulties from within the editor.
|
/// Used to avoid backing out to main menu/song select when switching difficulties from within the editor.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class EditorLoader : ScreenWithBeatmapBackground
|
public class EditorLoader : OsuScreen
|
||||||
{
|
{
|
||||||
|
public override float BackgroundParallaxAmount => 0.1f;
|
||||||
|
|
||||||
|
public override bool AllowBackButton => false;
|
||||||
|
|
||||||
|
public override bool HideOverlaysOnEnter => true;
|
||||||
|
|
||||||
|
public override bool DisallowExternalBeatmapRulesetChanges => true;
|
||||||
|
|
||||||
[Resolved]
|
[Resolved]
|
||||||
private BeatmapManager beatmapManager { get; set; }
|
private BeatmapManager beatmapManager { get; set; }
|
||||||
|
|
||||||
[CanBeNull]
|
[CanBeNull]
|
||||||
private ScheduledDelegate scheduledDifficultySwitch;
|
private ScheduledDelegate scheduledDifficultySwitch;
|
||||||
|
|
||||||
public override void OnEntering(IScreen last)
|
protected override void LogoArriving(OsuLogo logo, bool resuming)
|
||||||
{
|
{
|
||||||
base.OnEntering(last);
|
base.LogoArriving(logo, resuming);
|
||||||
pushEditor();
|
// the push cannot happen in OnEntering() or similar (even if scheduled), because the transition from main menu will look bad.
|
||||||
|
// that is because this screen pushing the editor makes it no longer current, and OsuScreen checks if the screen is current
|
||||||
|
// before enqueueing this screen's LogoArriving onto the logo animation sequence.
|
||||||
|
logo.Delay(300).Schedule(pushEditor);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void pushEditor()
|
private void pushEditor()
|
||||||
|
Loading…
Reference in New Issue
Block a user