mirror of
https://github.com/osukey/osukey.git
synced 2025-08-04 23:24:04 +09:00
Update VisibilityContainer usage in line with framework
This commit is contained in:
@ -84,10 +84,10 @@ namespace osu.Game.Overlays.Toolbar
|
||||
}
|
||||
};
|
||||
|
||||
StateChanged += visibility =>
|
||||
State.ValueChanged += visibility =>
|
||||
{
|
||||
if (overlayActivationMode.Value == OverlayActivation.Disabled)
|
||||
State = Visibility.Hidden;
|
||||
Hide();
|
||||
};
|
||||
|
||||
if (osuGame != null)
|
||||
|
@ -1,6 +1,7 @@
|
||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
||||
// See the LICENCE file in the repository root for full licence text.
|
||||
|
||||
using osu.Framework.Bindables;
|
||||
using osu.Framework.Extensions.Color4Extensions;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
@ -15,6 +16,8 @@ namespace osu.Game.Overlays.Toolbar
|
||||
|
||||
private OverlayContainer stateContainer;
|
||||
|
||||
private readonly Bindable<Visibility> overlayState = new Bindable<Visibility>();
|
||||
|
||||
public OverlayContainer StateContainer
|
||||
{
|
||||
get => stateContainer;
|
||||
@ -22,10 +25,12 @@ namespace osu.Game.Overlays.Toolbar
|
||||
{
|
||||
stateContainer = value;
|
||||
|
||||
overlayState.UnbindBindings();
|
||||
|
||||
if (stateContainer != null)
|
||||
{
|
||||
Action = stateContainer.ToggleVisibility;
|
||||
stateContainer.StateChanged += stateChanged;
|
||||
overlayState.BindTo(stateContainer.State);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -40,18 +45,13 @@ namespace osu.Game.Overlays.Toolbar
|
||||
Depth = 2,
|
||||
Alpha = 0,
|
||||
});
|
||||
|
||||
overlayState.ValueChanged += stateChanged;
|
||||
}
|
||||
|
||||
protected override void Dispose(bool isDisposing)
|
||||
private void stateChanged(ValueChangedEvent<Visibility> state)
|
||||
{
|
||||
base.Dispose(isDisposing);
|
||||
if (stateContainer != null)
|
||||
stateContainer.StateChanged -= stateChanged;
|
||||
}
|
||||
|
||||
private void stateChanged(Visibility state)
|
||||
{
|
||||
switch (state)
|
||||
switch (state.NewValue)
|
||||
{
|
||||
case Visibility.Hidden:
|
||||
stateBackground.FadeOut(200);
|
||||
|
Reference in New Issue
Block a user