1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-20 07:32:55 +08:00
osu-lazer/osu.Game/Graphics/Containers/OsuFocusedOverlayContainer.cs

39 lines
1.2 KiB
C#
Raw Normal View History

// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
// 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)
{
2017-11-25 22:11:18 +08:00
samplePopIn = audio.Sample.Get(@"UI/overlay-pop-in");
samplePopOut = audio.Sample.Get(@"UI/overlay-pop-out");
2017-09-04 08:10:04 +08:00
StateChanged += onStateChanged;
}
2017-09-04 08:10:04 +08:00
private void onStateChanged(Visibility visibility)
{
2017-09-04 08:10:04 +08:00
switch (visibility)
{
case Visibility.Visible:
samplePopIn?.Play();
break;
case Visibility.Hidden:
samplePopOut?.Play();
break;
}
}
}
}