Merge branch 'master' into disallow-beatmap-change

This commit is contained in:
Dan Balasescu
2018-06-06 20:26:17 +09:00
committed by GitHub
13 changed files with 140 additions and 105 deletions

View File

@ -17,6 +17,8 @@ using osu.Game.Rulesets;
using osu.Game.Screens.Menu;
using OpenTK;
using OpenTK.Input;
using osu.Game.Overlays;
using osu.Framework.Graphics.Containers;
namespace osu.Game.Screens
{
@ -39,19 +41,19 @@ namespace osu.Game.Screens
/// </summary>
protected virtual BackgroundScreen CreateBackground() => null;
private readonly BindableBool hideOverlaysOnEnter = new BindableBool();
private Action updateOverlayStates;
/// <summary>
/// Whether overlays should be hidden when this screen is entered or resumed.
/// Whether all overlays should be hidden when this screen is entered or resumed.
/// </summary>
protected virtual bool HideOverlaysOnEnter => false;
private readonly BindableBool allowOpeningOverlays = new BindableBool();
protected readonly Bindable<OverlayActivation> OverlayActivationMode = new Bindable<OverlayActivation>();
/// <summary>
/// Whether overlays should be able to be opened while this screen is active.
/// Whether overlays should be able to be opened once this screen is entered or resumed.
/// </summary>
protected virtual bool AllowOpeningOverlays => true;
protected virtual OverlayActivation InitialOverlayActivationMode => OverlayActivation.All;
/// <summary>
/// Whether this <see cref="OsuScreen"/> allows the cursor to be displayed.
@ -87,8 +89,15 @@ namespace osu.Game.Screens
if (osuGame != null)
{
Ruleset.BindTo(osuGame.Ruleset);
hideOverlaysOnEnter.BindTo(osuGame.HideOverlaysOnEnter);
allowOpeningOverlays.BindTo(osuGame.AllowOpeningOverlays);
OverlayActivationMode.BindTo(osuGame.OverlayActivationMode);
updateOverlayStates = () =>
{
if (HideOverlaysOnEnter)
osuGame.CloseAllOverlays();
else
osuGame.Toolbar.State = Visibility.Visible;
};
}
sampleExit = audio.Sample.Get(@"UI/screen-back");
@ -224,8 +233,9 @@ namespace osu.Game.Screens
if (backgroundParallaxContainer != null)
backgroundParallaxContainer.ParallaxAmount = ParallaxContainer.DEFAULT_PARALLAX_AMOUNT * BackgroundParallaxAmount;
hideOverlaysOnEnter.Value = HideOverlaysOnEnter;
allowOpeningOverlays.Value = AllowOpeningOverlays;
OverlayActivationMode.Value = InitialOverlayActivationMode;
updateOverlayStates?.Invoke();
}
private void onExitingLogo()