Use newly exposed UpdateState

This commit is contained in:
David Zhao 2019-08-06 14:21:34 +09:00
parent 28825d4077
commit ac0abe0692
1 changed files with 3 additions and 10 deletions

View File

@ -55,15 +55,6 @@ private void load(AudioManager audio)
samplePopOut = audio.Samples.Get(@"UI/overlay-pop-out");
}
protected override void LoadComplete()
{
base.LoadComplete();
// This must be added after the base LoadComplete, since onStateChanged contains logic that
// must be run after other state change logic has been completed.
State.ValueChanged += onStateChanged;
}
/// <summary>
/// Whether mouse input should be blocked screen-wide while this overlay is visible.
/// Performing mouse actions outside of the valid extents will hide the overlay.
@ -101,8 +92,10 @@ public virtual bool OnPressed(GlobalAction action)
public bool OnReleased(GlobalAction action) => false;
private void onStateChanged(ValueChangedEvent<Visibility> state)
protected override void UpdateState(ValueChangedEvent<Visibility> state)
{
base.UpdateState(state);
switch (state.NewValue)
{
case Visibility.Visible: