// Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using osu.Framework.Allocation; using osu.Framework.Audio; using osu.Framework.Audio.Sample; using osu.Framework.Graphics.Containers; namespace osu.Game.Graphics.Containers { public class OsuFocusedOverlayContainer : FocusedOverlayContainer { private SampleChannel samplePopIn; private SampleChannel samplePopOut; [BackgroundDependencyLoader] private void load(AudioManager audio) { samplePopIn = audio.Sample.Get(@"UI/overlay-pop-in"); samplePopOut = audio.Sample.Get(@"UI/overlay-pop-out"); StateChanged += onStateChanged; } private void onStateChanged(Visibility visibility) { switch (visibility) { case Visibility.Visible: samplePopIn?.Play(); break; case Visibility.Hidden: samplePopOut?.Play(); break; } } } }