add OverlayActivation enum

+ fix Toolbar being toggleable when it shouldn't be able to
+ allow opening overlays in MenuState.Initial again
This commit is contained in:
Aergwyn
2018-05-28 13:43:47 +02:00
parent 1572635fc8
commit 2b3a630270
9 changed files with 89 additions and 44 deletions

View File

@ -20,6 +20,7 @@ using osu.Game.Input.Bindings;
using OpenTK;
using OpenTK.Graphics;
using OpenTK.Input;
using osu.Game.Overlays;
namespace osu.Game.Screens.Menu
{
@ -27,8 +28,7 @@ namespace osu.Game.Screens.Menu
{
public event Action<MenuState> StateChanged;
private readonly BindableBool hideOverlaysOnEnter = new BindableBool();
private readonly BindableBool allowOpeningOverlays = new BindableBool();
private readonly Bindable<OverlayActivation> allowOverlays = new Bindable<OverlayActivation>();
public Action OnEdit;
public Action OnExit;
@ -137,10 +137,7 @@ namespace osu.Game.Screens.Menu
private void load(AudioManager audio, OsuGame game)
{
if (game != null)
{
hideOverlaysOnEnter.BindTo(game.HideOverlaysOnEnter);
allowOpeningOverlays.BindTo(game.AllowOpeningOverlays);
}
allowOverlays.BindTo(game.AllowOverlays);
sampleBack = audio.Sample.Get(@"Menu/button-back-select");
}
@ -332,19 +329,19 @@ namespace osu.Game.Screens.Menu
case MenuState.Exit:
case MenuState.Initial:
logoTracking = false;
allowOverlays.Value = OverlayActivation.Disabled;
logoDelayedAction = Scheduler.AddDelayed(() =>
{
hideOverlaysOnEnter.Value = true;
allowOpeningOverlays.Value = false;
logo.ClearTransforms(targetMember: nameof(Position));
logo.RelativePositionAxes = Axes.Both;
logo.MoveTo(new Vector2(0.5f), 800, Easing.OutExpo);
logo.ScaleTo(1, 800, Easing.OutExpo);
}, 150);
if(state != MenuState.Exit)
allowOverlays.Value = OverlayActivation.All;
}, 150);
break;
case MenuState.TopLevel:
case MenuState.Play:
@ -365,9 +362,6 @@ namespace osu.Game.Screens.Menu
logoTracking = true;
logo.Impact();
hideOverlaysOnEnter.Value = false;
allowOpeningOverlays.Value = true;
}, 200);
break;
default:

View File

@ -9,6 +9,7 @@ using osu.Game.Graphics;
using osu.Game.Graphics.Sprites;
using OpenTK;
using OpenTK.Graphics;
using osu.Game.Overlays;
namespace osu.Game.Screens.Menu
{
@ -19,7 +20,6 @@ namespace osu.Game.Screens.Menu
private Color4 iconColour;
protected override bool HideOverlaysOnEnter => true;
protected override bool AllowOpeningOverlays => false;
public override bool CursorVisible => false;
@ -93,6 +93,8 @@ namespace osu.Game.Screens.Menu
LoadComponentAsync(intro = new Intro());
iconColour = colours.Yellow;
AllowOverlays.Value = OverlayActivation.Disabled;
}
protected override void OnEntering(Screen last)

View File

@ -15,6 +15,7 @@ using osu.Game.IO.Archives;
using osu.Game.Screens.Backgrounds;
using OpenTK;
using OpenTK.Graphics;
using osu.Game.Overlays;
namespace osu.Game.Screens.Menu
{
@ -32,7 +33,6 @@ namespace osu.Game.Screens.Menu
private SampleChannel seeya;
protected override bool HideOverlaysOnEnter => true;
protected override bool AllowOpeningOverlays => false;
public override bool CursorVisible => false;
@ -77,6 +77,8 @@ namespace osu.Game.Screens.Menu
welcome = audio.Sample.Get(@"welcome");
seeya = audio.Sample.Get(@"seeya");
AllowOverlays.Value = OverlayActivation.Disabled;
}
protected override void OnEntering(Screen last)

View File

@ -10,6 +10,7 @@ using osu.Framework.Input;
using osu.Framework.Screens;
using osu.Game.Beatmaps;
using osu.Game.Graphics.Containers;
using osu.Game.Overlays;
using osu.Game.Screens.Backgrounds;
using osu.Game.Screens.Charts;
using osu.Game.Screens.Direct;
@ -25,7 +26,6 @@ namespace osu.Game.Screens.Menu
private readonly ButtonSystem buttons;
protected override bool HideOverlaysOnEnter => buttons.State == MenuState.Initial;
protected override bool AllowOpeningOverlays => buttons.State != MenuState.Initial;
protected override bool AllowBackButton => buttons.State != MenuState.Initial;
@ -64,6 +64,8 @@ namespace osu.Game.Screens.Menu
},
sideFlashes = new MenuSideFlashes(),
};
buttons.StateChanged += state => UpdateOverlayStates?.Invoke();
}
[BackgroundDependencyLoader(true)]
@ -78,6 +80,8 @@ namespace osu.Game.Screens.Menu
}
preloadSongSelect();
AllowOverlays.Value = OverlayActivation.Disabled;
}
private void preloadSongSelect()