mirror of
https://github.com/osukey/osukey.git
synced 2025-07-01 16:29:58 +09:00
Move main menu (song select) presentation logic to a local implementation
Reduces cross-dependencies between OsuGame and MainMenu.
This commit is contained in:
@ -361,10 +361,6 @@ namespace osu.Game
|
|||||||
|
|
||||||
PerformFromScreen(screen =>
|
PerformFromScreen(screen =>
|
||||||
{
|
{
|
||||||
// we might already be at song select, so a check is required before performing the load to solo.
|
|
||||||
if (screen is MainMenu)
|
|
||||||
menuScreen.LoadToSolo();
|
|
||||||
|
|
||||||
// we might even already be at the song
|
// we might even already be at the song
|
||||||
if (Beatmap.Value.BeatmapSetInfo.Hash == databasedSet.Hash && (difficultyCriteria?.Invoke(Beatmap.Value.BeatmapInfo) ?? true))
|
if (Beatmap.Value.BeatmapSetInfo.Hash == databasedSet.Hash && (difficultyCriteria?.Invoke(Beatmap.Value.BeatmapInfo) ?? true))
|
||||||
return;
|
return;
|
||||||
|
@ -9,12 +9,14 @@ using osu.Framework.Bindables;
|
|||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Platform;
|
using osu.Framework.Platform;
|
||||||
using osu.Framework.Screens;
|
using osu.Framework.Screens;
|
||||||
|
using osu.Game.Beatmaps;
|
||||||
using osu.Game.Configuration;
|
using osu.Game.Configuration;
|
||||||
using osu.Game.Graphics;
|
using osu.Game.Graphics;
|
||||||
using osu.Game.Graphics.Containers;
|
using osu.Game.Graphics.Containers;
|
||||||
using osu.Game.IO;
|
using osu.Game.IO;
|
||||||
using osu.Game.Online.API;
|
using osu.Game.Online.API;
|
||||||
using osu.Game.Overlays;
|
using osu.Game.Overlays;
|
||||||
|
using osu.Game.Rulesets;
|
||||||
using osu.Game.Screens.Backgrounds;
|
using osu.Game.Screens.Backgrounds;
|
||||||
using osu.Game.Screens.Edit;
|
using osu.Game.Screens.Edit;
|
||||||
using osu.Game.Screens.OnlinePlay.Multiplayer;
|
using osu.Game.Screens.OnlinePlay.Multiplayer;
|
||||||
@ -23,7 +25,7 @@ using osu.Game.Screens.Select;
|
|||||||
|
|
||||||
namespace osu.Game.Screens.Menu
|
namespace osu.Game.Screens.Menu
|
||||||
{
|
{
|
||||||
public class MainMenu : OsuScreen
|
public class MainMenu : OsuScreen, IHandlePresentBeatmap
|
||||||
{
|
{
|
||||||
public const float FADE_IN_DURATION = 300;
|
public const float FADE_IN_DURATION = 300;
|
||||||
|
|
||||||
@ -104,7 +106,7 @@ namespace osu.Game.Screens.Menu
|
|||||||
Beatmap.SetDefault();
|
Beatmap.SetDefault();
|
||||||
this.Push(new Editor());
|
this.Push(new Editor());
|
||||||
},
|
},
|
||||||
OnSolo = onSolo,
|
OnSolo = loadSoloSongSelect,
|
||||||
OnMultiplayer = () => this.Push(new Multiplayer()),
|
OnMultiplayer = () => this.Push(new Multiplayer()),
|
||||||
OnPlaylists = () => this.Push(new Playlists()),
|
OnPlaylists = () => this.Push(new Playlists()),
|
||||||
OnExit = confirmAndExit,
|
OnExit = confirmAndExit,
|
||||||
@ -160,9 +162,7 @@ namespace osu.Game.Screens.Menu
|
|||||||
LoadComponentAsync(songSelect = new PlaySongSelect());
|
LoadComponentAsync(songSelect = new PlaySongSelect());
|
||||||
}
|
}
|
||||||
|
|
||||||
public void LoadToSolo() => Schedule(onSolo);
|
private void loadSoloSongSelect() => this.Push(consumeSongSelect());
|
||||||
|
|
||||||
private void onSolo() => this.Push(consumeSongSelect());
|
|
||||||
|
|
||||||
private Screen consumeSongSelect()
|
private Screen consumeSongSelect()
|
||||||
{
|
{
|
||||||
@ -289,5 +289,13 @@ namespace osu.Game.Screens.Menu
|
|||||||
this.FadeOut(3000);
|
this.FadeOut(3000);
|
||||||
return base.OnExiting(next);
|
return base.OnExiting(next);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void PresentBeatmap(WorkingBeatmap beatmap, RulesetInfo ruleset)
|
||||||
|
{
|
||||||
|
Beatmap.Value = beatmap;
|
||||||
|
Ruleset.Value = ruleset;
|
||||||
|
|
||||||
|
Schedule(loadSoloSongSelect);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user