mirror of
https://github.com/ppy/osu.git
synced 2024-12-15 21:03:08 +08:00
Tidy up DI and binding logic
This commit is contained in:
parent
e7dcbddbeb
commit
6b30ee0950
@ -36,15 +36,10 @@ namespace osu.Game.Overlays
|
|||||||
[Resolved]
|
[Resolved]
|
||||||
private AudioManager audio { get; set; }
|
private AudioManager audio { get; set; }
|
||||||
|
|
||||||
[Resolved(canBeNull: true)]
|
private readonly IBindable<Visibility> firstRunSetupVisibility = new Bindable<Visibility>();
|
||||||
[CanBeNull]
|
|
||||||
private FirstRunSetupOverlay firstRunSetup { get; set; }
|
|
||||||
|
|
||||||
[CanBeNull]
|
[BackgroundDependencyLoader(true)]
|
||||||
private IBindable<Visibility> firstRunSetupState;
|
private void load([CanBeNull] FirstRunSetupOverlay firstRunSetup)
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
|
||||||
private void load()
|
|
||||||
{
|
{
|
||||||
X = WIDTH;
|
X = WIDTH;
|
||||||
Width = WIDTH;
|
Width = WIDTH;
|
||||||
@ -83,13 +78,16 @@ namespace osu.Game.Overlays
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
if (firstRunSetup != null)
|
||||||
|
firstRunSetupVisibility.BindTo(firstRunSetup.State);
|
||||||
}
|
}
|
||||||
|
|
||||||
private ScheduledDelegate notificationsEnabler;
|
private ScheduledDelegate notificationsEnabler;
|
||||||
|
|
||||||
private void updateProcessingMode()
|
private void updateProcessingMode()
|
||||||
{
|
{
|
||||||
bool enabled = (OverlayActivationMode.Value == OverlayActivation.All && firstRunSetupState?.Value != Visibility.Visible) || State.Value == Visibility.Visible;
|
bool enabled = (OverlayActivationMode.Value == OverlayActivation.All && firstRunSetupVisibility?.Value != Visibility.Visible) || State.Value == Visibility.Visible;
|
||||||
|
|
||||||
notificationsEnabler?.Cancel();
|
notificationsEnabler?.Cancel();
|
||||||
|
|
||||||
@ -104,13 +102,8 @@ namespace osu.Game.Overlays
|
|||||||
{
|
{
|
||||||
base.LoadComplete();
|
base.LoadComplete();
|
||||||
|
|
||||||
State.ValueChanged += _ => updateProcessingMode();
|
State.BindValueChanged(_ => updateProcessingMode());
|
||||||
|
firstRunSetupVisibility.BindValueChanged(_ => updateProcessingMode());
|
||||||
firstRunSetupState = firstRunSetup?.State.GetBoundCopy();
|
|
||||||
|
|
||||||
if (firstRunSetupState != null)
|
|
||||||
firstRunSetupState.ValueChanged += _ => updateProcessingMode();
|
|
||||||
|
|
||||||
OverlayActivationMode.BindValueChanged(_ => updateProcessingMode(), true);
|
OverlayActivationMode.BindValueChanged(_ => updateProcessingMode(), true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user