mirror of
https://github.com/osukey/osukey.git
synced 2025-07-02 16:59:53 +09:00
Merge remote-tracking branch 'upstream/master' into tournament-tools
This commit is contained in:
@ -4,7 +4,9 @@
|
||||
using osuTK;
|
||||
using osuTK.Graphics;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Bindables;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Platform;
|
||||
using osu.Framework.Screens;
|
||||
using osu.Game.Beatmaps;
|
||||
using osu.Game.Graphics;
|
||||
@ -20,28 +22,31 @@ namespace osu.Game.Screens.Menu
|
||||
{
|
||||
public class MainMenu : OsuScreen
|
||||
{
|
||||
private readonly ButtonSystem buttons;
|
||||
private ButtonSystem buttons;
|
||||
|
||||
public override bool HideOverlaysOnEnter => buttons.State == ButtonSystemState.Initial;
|
||||
|
||||
protected override bool AllowBackButton => buttons.State != ButtonSystemState.Initial;
|
||||
protected override bool AllowBackButton => buttons.State != ButtonSystemState.Initial && host.CanExit;
|
||||
|
||||
public override bool AllowExternalScreenChange => true;
|
||||
|
||||
private Screen songSelect;
|
||||
|
||||
private readonly MenuSideFlashes sideFlashes;
|
||||
private MenuSideFlashes sideFlashes;
|
||||
|
||||
[Resolved]
|
||||
private GameHost host { get; set; }
|
||||
|
||||
protected override BackgroundScreen CreateBackground() => new BackgroundScreenDefault();
|
||||
|
||||
public MainMenu()
|
||||
[BackgroundDependencyLoader(true)]
|
||||
private void load(OsuGame game = null)
|
||||
{
|
||||
InternalChildren = new Drawable[]
|
||||
if (host.CanExit)
|
||||
AddInternal(new ExitConfirmOverlay { Action = this.Exit });
|
||||
|
||||
AddRangeInternal(new Drawable[]
|
||||
{
|
||||
new ExitConfirmOverlay
|
||||
{
|
||||
Action = this.Exit,
|
||||
},
|
||||
new ParallaxContainer
|
||||
{
|
||||
ParallaxAmount = 0.01f,
|
||||
@ -50,16 +55,16 @@ namespace osu.Game.Screens.Menu
|
||||
buttons = new ButtonSystem
|
||||
{
|
||||
OnChart = delegate { this.Push(new ChartListing()); },
|
||||
OnDirect = delegate {this.Push(new OnlineListing()); },
|
||||
OnEdit = delegate {this.Push(new Editor()); },
|
||||
OnDirect = delegate { this.Push(new OnlineListing()); },
|
||||
OnEdit = delegate { this.Push(new Editor()); },
|
||||
OnSolo = onSolo,
|
||||
OnMulti = delegate {this.Push(new Multiplayer()); },
|
||||
OnMulti = delegate { this.Push(new Multiplayer()); },
|
||||
OnExit = this.Exit,
|
||||
}
|
||||
}
|
||||
},
|
||||
sideFlashes = new MenuSideFlashes(),
|
||||
};
|
||||
});
|
||||
|
||||
buttons.StateChanged += state =>
|
||||
{
|
||||
@ -74,11 +79,7 @@ namespace osu.Game.Screens.Menu
|
||||
break;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader(true)]
|
||||
private void load(OsuGame game = null)
|
||||
{
|
||||
if (game != null)
|
||||
{
|
||||
buttons.OnSettings = game.ToggleSettings;
|
||||
@ -96,7 +97,7 @@ namespace osu.Game.Screens.Menu
|
||||
|
||||
public void LoadToSolo() => Schedule(onSolo);
|
||||
|
||||
private void onSolo() =>this.Push(consumeSongSelect());
|
||||
private void onSolo() => this.Push(consumeSongSelect());
|
||||
|
||||
private Screen consumeSongSelect()
|
||||
{
|
||||
@ -154,7 +155,7 @@ namespace osu.Game.Screens.Menu
|
||||
.OnComplete(l => buttons.SetOsuLogo(null));
|
||||
}
|
||||
|
||||
private void beatmap_ValueChanged(WorkingBeatmap newValue)
|
||||
private void beatmap_ValueChanged(ValueChangedEvent<WorkingBeatmap> e)
|
||||
{
|
||||
if (!this.IsCurrentScreen())
|
||||
return;
|
||||
@ -180,7 +181,7 @@ namespace osu.Game.Screens.Menu
|
||||
{
|
||||
base.OnResuming(last);
|
||||
|
||||
((BackgroundScreenDefault)Background).Next();
|
||||
(Background as BackgroundScreenDefault)?.Next();
|
||||
|
||||
//we may have consumed our preloaded instance, so let's make another.
|
||||
preloadSongSelect();
|
||||
|
Reference in New Issue
Block a user