Make Introduce bindable property OverlayActivationMode in OsuScreen

This commit is contained in:
Lucas A 2020-08-27 19:29:18 +02:00
parent 66fb5d4174
commit 5949a281fc
3 changed files with 11 additions and 4 deletions

View File

@ -972,9 +972,12 @@ namespace osu.Game
break;
}
if (current is IOsuScreen currentOsuScreen)
OverlayActivationMode.UnbindFrom(currentOsuScreen.OverlayActivationMode);
if (newScreen is IOsuScreen newOsuScreen)
{
OverlayActivationMode.Value = newOsuScreen.InitialOverlayActivationMode;
OverlayActivationMode.BindTo(newOsuScreen.OverlayActivationMode);
MusicController.AllowRateAdjustments = newOsuScreen.AllowRateAdjustments;

View File

@ -39,9 +39,9 @@ namespace osu.Game.Screens
bool HideOverlaysOnEnter { get; }
/// <summary>
/// Whether overlays should be able to be opened once this screen is entered or resumed.
/// Whether overlays should be able to be opened when this screen is current.
/// </summary>
OverlayActivation InitialOverlayActivationMode { get; }
public Bindable<OverlayActivation> OverlayActivationMode { get; }
/// <summary>
/// The amount of parallax to be applied while this screen is displayed.

View File

@ -44,10 +44,12 @@ namespace osu.Game.Screens
public virtual bool HideOverlaysOnEnter => false;
/// <summary>
/// Whether overlays should be able to be opened once this screen is entered or resumed.
/// The initial initial overlay activation mode to use when this screen is entered for the first time.
/// </summary>
public virtual OverlayActivation InitialOverlayActivationMode => OverlayActivation.All;
public Bindable<OverlayActivation> OverlayActivationMode { get; }
public virtual bool CursorVisible => true;
protected new OsuGameBase Game => base.Game as OsuGameBase;
@ -138,6 +140,8 @@ namespace osu.Game.Screens
{
Anchor = Anchor.Centre;
Origin = Anchor.Centre;
OverlayActivationMode = new Bindable<OverlayActivation>(InitialOverlayActivationMode);
}
[BackgroundDependencyLoader(true)]