2021-09-05 22:59:28 +08:00
|
|
|
// 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.
|
|
|
|
|
2021-09-05 23:26:09 +08:00
|
|
|
using JetBrains.Annotations;
|
|
|
|
using osu.Framework.Allocation;
|
2021-09-06 02:24:07 +08:00
|
|
|
using osu.Framework.Graphics;
|
2021-09-05 22:59:28 +08:00
|
|
|
using osu.Framework.Screens;
|
2021-09-06 01:11:46 +08:00
|
|
|
using osu.Framework.Threading;
|
2021-09-05 23:26:09 +08:00
|
|
|
using osu.Game.Beatmaps;
|
2021-09-06 02:24:07 +08:00
|
|
|
using osu.Game.Screens.Menu;
|
2021-09-05 22:59:28 +08:00
|
|
|
|
|
|
|
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>
|
2021-09-06 02:24:07 +08:00
|
|
|
public class EditorLoader : OsuScreen
|
2021-09-05 22:59:28 +08:00
|
|
|
{
|
2021-09-06 02:24:07 +08:00
|
|
|
public override float BackgroundParallaxAmount => 0.1f;
|
|
|
|
|
|
|
|
public override bool AllowBackButton => false;
|
|
|
|
|
|
|
|
public override bool HideOverlaysOnEnter => true;
|
|
|
|
|
|
|
|
public override bool DisallowExternalBeatmapRulesetChanges => true;
|
|
|
|
|
2021-09-05 23:26:09 +08:00
|
|
|
[Resolved]
|
|
|
|
private BeatmapManager beatmapManager { get; set; }
|
|
|
|
|
2021-09-06 01:11:46 +08:00
|
|
|
[CanBeNull]
|
|
|
|
private ScheduledDelegate scheduledDifficultySwitch;
|
|
|
|
|
2021-09-06 02:24:07 +08:00
|
|
|
protected override void LogoArriving(OsuLogo logo, bool resuming)
|
2021-09-05 22:59:28 +08:00
|
|
|
{
|
2021-09-06 02:24:07 +08:00
|
|
|
base.LogoArriving(logo, resuming);
|
|
|
|
// 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);
|
2021-09-05 22:59:28 +08:00
|
|
|
}
|
|
|
|
|
2021-09-06 01:11:46 +08:00
|
|
|
private void pushEditor()
|
2021-09-05 22:59:28 +08:00
|
|
|
{
|
|
|
|
this.Push(new Editor(this));
|
|
|
|
ValidForResume = false;
|
2021-09-06 01:11:46 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
public void ScheduleDifficultySwitch(BeatmapInfo beatmapInfo)
|
|
|
|
{
|
|
|
|
CancelDifficultySwitch();
|
|
|
|
scheduledDifficultySwitch = Schedule(() =>
|
|
|
|
{
|
|
|
|
Beatmap.Value = beatmapManager.GetWorkingBeatmap(beatmapInfo);
|
|
|
|
pushEditor();
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
public void CancelDifficultySwitch() => scheduledDifficultySwitch?.Cancel();
|
2021-09-05 22:59:28 +08:00
|
|
|
}
|
|
|
|
}
|