Merge branch 'master' into fix-background-screen-crash

This commit is contained in:
Dan Balasescu
2018-07-02 15:01:59 +09:00
committed by GitHub
94 changed files with 1316 additions and 529 deletions

View File

@ -8,7 +8,6 @@ using osu.Framework.Audio;
using osu.Framework.Audio.Sample;
using osu.Framework.Configuration;
using osu.Framework.Graphics;
using osu.Framework.Input;
using osu.Framework.Input.Bindings;
using osu.Framework.Screens;
using osu.Game.Beatmaps;
@ -17,7 +16,6 @@ using osu.Game.Input.Bindings;
using osu.Game.Rulesets;
using osu.Game.Screens.Menu;
using OpenTK;
using OpenTK.Input;
using osu.Game.Overlays;
using osu.Framework.Graphics.Containers;
@ -82,22 +80,24 @@ namespace osu.Game.Screens
private SampleChannel sampleExit;
[BackgroundDependencyLoader(true)]
private void load(BindableBeatmap beatmap, OsuGame osuGame, AudioManager audio)
private void load(BindableBeatmap beatmap, OsuGame osu, AudioManager audio, Bindable<RulesetInfo> ruleset)
{
if (beatmap != null)
Beatmap.BindTo(beatmap);
if (osuGame != null)
if (ruleset != null)
Ruleset.BindTo(ruleset);
if (osu != null)
{
Ruleset.BindTo(osuGame.Ruleset);
OverlayActivationMode.BindTo(osuGame.OverlayActivationMode);
OverlayActivationMode.BindTo(osu.OverlayActivationMode);
updateOverlayStates = () =>
{
if (HideOverlaysOnEnter)
osuGame.CloseAllOverlays();
osu.CloseAllOverlays();
else
osuGame.Toolbar.State = Visibility.Visible;
osu.Toolbar.State = Visibility.Visible;
};
}
@ -106,6 +106,8 @@ namespace osu.Game.Screens
public bool OnPressed(GlobalAction action)
{
if (!IsCurrentScreen) return false;
if (action == GlobalAction.Back && AllowBackButton)
{
Exit();
@ -117,20 +119,6 @@ namespace osu.Game.Screens
public bool OnReleased(GlobalAction action) => action == GlobalAction.Back && AllowBackButton;
protected override bool OnKeyDown(InputState state, KeyDownEventArgs args)
{
if (args.Repeat || !IsCurrentScreen) return false;
switch (args.Key)
{
case Key.Escape:
Exit();
return true;
}
return base.OnKeyDown(state, args);
}
protected override void OnResuming(Screen last)
{
sampleExit?.Play();