expose two Bindables with split logic instead of one with mixed logic

This commit is contained in:
Aergwyn
2018-05-21 15:53:50 +02:00
parent 1482bca147
commit b7e3ea348b
12 changed files with 43 additions and 26 deletions

View File

@ -32,12 +32,19 @@ namespace osu.Game.Screens
/// </summary>
protected virtual BackgroundScreen CreateBackground() => null;
protected BindableBool AllowOverlays = new BindableBool();
private readonly BindableBool hideOverlaysOnEnter = new BindableBool();
/// <summary>
/// Whether overlays should be hidden when this screen is entered or resumed.
/// </summary>
public virtual bool HideOverlaysOnEnter => false;
protected virtual bool HideOverlaysOnEnter => hideOverlaysOnEnter;
private readonly BindableBool allowOpeningOverlays = new BindableBool();
/// <summary>
/// Whether overlays should be able to be opened while this screen is active.
/// </summary>
protected virtual bool AllowOpeningOverlays => allowOpeningOverlays;
/// <summary>
/// Whether this <see cref="OsuScreen"/> allows the cursor to be displayed.
@ -88,7 +95,8 @@ namespace osu.Game.Screens
if (osuGame != null)
{
Ruleset.BindTo(osuGame.Ruleset);
AllowOverlays.BindTo(osuGame.AllowOverlays);
hideOverlaysOnEnter.BindTo(osuGame.HideOverlaysOnEnter);
allowOpeningOverlays.BindTo(osuGame.AllowOpeningOverlays);
}
sampleExit = audio.Sample.Get(@"UI/screen-back");
@ -220,7 +228,8 @@ namespace osu.Game.Screens
if (backgroundParallaxContainer != null)
backgroundParallaxContainer.ParallaxAmount = ParallaxContainer.DEFAULT_PARALLAX_AMOUNT * BackgroundParallaxAmount;
AllowOverlays.Value = !HideOverlaysOnEnter;
hideOverlaysOnEnter.Value = HideOverlaysOnEnter;
allowOpeningOverlays.Value = AllowOpeningOverlays;
}
private void onExitingLogo()