mirror of
https://github.com/osukey/osukey.git
synced 2025-08-05 15:44:04 +09:00
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:
12
osu.Game/Overlays/OverlayActivation.cs
Normal file
12
osu.Game/Overlays/OverlayActivation.cs
Normal file
@ -0,0 +1,12 @@
|
||||
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
|
||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||
|
||||
namespace osu.Game.Overlays
|
||||
{
|
||||
public enum OverlayActivation
|
||||
{
|
||||
Disabled,
|
||||
//UserTriggered, // currently there is no way to discern user action
|
||||
All
|
||||
}
|
||||
}
|
@ -10,6 +10,8 @@ using osu.Framework.Input;
|
||||
using osu.Game.Graphics;
|
||||
using OpenTK;
|
||||
using osu.Framework.Graphics.Shapes;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Configuration;
|
||||
|
||||
namespace osu.Game.Overlays.Toolbar
|
||||
{
|
||||
@ -29,6 +31,11 @@ namespace osu.Game.Overlays.Toolbar
|
||||
private const float alpha_hovering = 0.8f;
|
||||
private const float alpha_normal = 0.6f;
|
||||
|
||||
/// <summary>
|
||||
/// Defaults to <see cref="OverlayActivation.All"/> so that the overlay works even if BDL couldn't pass an <see cref="OsuGame"/>.
|
||||
/// </summary>
|
||||
private readonly Bindable<OverlayActivation> allowOverlays = new Bindable<OverlayActivation>(OverlayActivation.All);
|
||||
|
||||
public Toolbar()
|
||||
{
|
||||
Children = new Drawable[]
|
||||
@ -76,6 +83,19 @@ namespace osu.Game.Overlays.Toolbar
|
||||
Size = new Vector2(1, HEIGHT);
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader(true)]
|
||||
private void load(OsuGame osuGame)
|
||||
{
|
||||
if (osuGame != null)
|
||||
allowOverlays.BindTo(osuGame.AllowOverlays);
|
||||
|
||||
StateChanged += visibility =>
|
||||
{
|
||||
if (allowOverlays == OverlayActivation.Disabled)
|
||||
State = Visibility.Hidden;
|
||||
};
|
||||
}
|
||||
|
||||
public class ToolbarBackground : Container
|
||||
{
|
||||
private readonly Box solidBackground;
|
||||
|
Reference in New Issue
Block a user