mirror of
https://github.com/ppy/osu.git
synced 2025-01-14 00:42:55 +08:00
added pause sound with fading
This commit is contained in:
parent
a4eb6c81c5
commit
9dea96e5fd
@ -3,9 +3,18 @@
|
||||
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Runtime.CompilerServices;
|
||||
using Microsoft.CodeAnalysis.CSharp.Syntax;
|
||||
using NUnit.Framework.Internal;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Audio;
|
||||
using osu.Framework.Audio.Sample;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Audio;
|
||||
using osu.Game.Graphics;
|
||||
using osuTK.Graphics;
|
||||
using osu.Framework.Logging;
|
||||
|
||||
|
||||
namespace osu.Game.Screens.Play
|
||||
{
|
||||
@ -16,14 +25,42 @@ namespace osu.Game.Screens.Play
|
||||
public override string Header => "paused";
|
||||
public override string Description => "you're not going to do what i think you're going to do, are ya?";
|
||||
|
||||
private DrawableSample pauseLoop;
|
||||
|
||||
protected override Action BackAction => () => InternalButtons.Children.First().Click();
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(OsuColour colours)
|
||||
private void load(OsuColour colours, AudioManager audio)
|
||||
{
|
||||
AddButton("Continue", colours.Green, () => OnResume?.Invoke());
|
||||
AddButton("Retry", colours.YellowDark, () => OnRetry?.Invoke());
|
||||
AddButton("Quit", new Color4(170, 27, 39, 255), () => OnQuit?.Invoke());
|
||||
|
||||
var sampleChannel = audio.Samples.Get(@"Gameplay/pause-loop");
|
||||
if (sampleChannel != null)
|
||||
{
|
||||
AddInternal(pauseLoop = new DrawableSample(sampleChannel)
|
||||
{
|
||||
Looping = true,
|
||||
});
|
||||
pauseLoop?.VolumeTo(0.0f);
|
||||
pauseLoop?.Play();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
protected override void PopIn()
|
||||
{
|
||||
base.PopIn();
|
||||
pauseLoop?.VolumeTo(1.0f, 400, Easing.InQuint);
|
||||
}
|
||||
|
||||
protected override void PopOut()
|
||||
{
|
||||
base.PopOut();
|
||||
pauseLoop?.VolumeTo(0.0f);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user