2019-03-18 02:48:11 +00:00
|
|
|
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
|
|
|
|
// See the LICENCE file in the repository root for full licence text.
|
|
|
|
|
|
|
|
|
|
using System;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using osu.Framework.Allocation;
|
2020-06-22 12:02:21 +00:00
|
|
|
|
using osu.Framework.Audio;
|
|
|
|
|
using osu.Framework.Graphics;
|
|
|
|
|
using osu.Framework.Graphics.Audio;
|
2020-06-25 11:26:42 +00:00
|
|
|
|
using osu.Game.Audio;
|
2019-03-18 02:48:11 +00:00
|
|
|
|
using osu.Game.Graphics;
|
2020-06-25 11:26:42 +00:00
|
|
|
|
using osu.Game.Skinning;
|
2019-03-18 02:48:11 +00:00
|
|
|
|
using osuTK.Graphics;
|
|
|
|
|
|
|
|
|
|
namespace osu.Game.Screens.Play
|
|
|
|
|
{
|
|
|
|
|
public class PauseOverlay : GameplayMenuOverlay
|
|
|
|
|
{
|
|
|
|
|
public Action OnResume;
|
|
|
|
|
|
|
|
|
|
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?";
|
|
|
|
|
|
2020-06-22 12:02:21 +00:00
|
|
|
|
private DrawableSample pauseLoop;
|
|
|
|
|
|
2019-03-18 02:48:11 +00:00
|
|
|
|
protected override Action BackAction => () => InternalButtons.Children.First().Click();
|
|
|
|
|
|
|
|
|
|
[BackgroundDependencyLoader]
|
2020-06-25 11:26:42 +00:00
|
|
|
|
private void load(OsuColour colours, AudioManager audio, SkinManager skins)
|
2019-03-18 02:48:11 +00:00
|
|
|
|
{
|
|
|
|
|
AddButton("Continue", colours.Green, () => OnResume?.Invoke());
|
|
|
|
|
AddButton("Retry", colours.YellowDark, () => OnRetry?.Invoke());
|
|
|
|
|
AddButton("Quit", new Color4(170, 27, 39, 255), () => OnQuit?.Invoke());
|
2020-06-22 12:02:21 +00:00
|
|
|
|
|
2020-06-25 11:26:42 +00:00
|
|
|
|
var sampleChannel = skins.GetSample(new SampleInfo("pause-loop")) ?? audio.Samples.Get(@"Gameplay/pause-loop");
|
2020-06-23 11:09:24 +00:00
|
|
|
|
|
2020-06-22 12:02:21 +00:00
|
|
|
|
if (sampleChannel != null)
|
|
|
|
|
{
|
2020-06-24 12:01:13 +00:00
|
|
|
|
AddInternal(pauseLoop = new DrawableSample(sampleChannel)
|
2020-06-22 12:02:21 +00:00
|
|
|
|
{
|
|
|
|
|
Looping = true,
|
2020-06-24 12:01:13 +00:00
|
|
|
|
});
|
2020-06-22 12:02:21 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected override void PopIn()
|
|
|
|
|
{
|
|
|
|
|
base.PopIn();
|
2020-06-24 12:22:12 +00:00
|
|
|
|
pauseLoop?.Play();
|
2020-06-22 12:02:21 +00:00
|
|
|
|
pauseLoop?.VolumeTo(1.0f, 400, Easing.InQuint);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected override void PopOut()
|
|
|
|
|
{
|
|
|
|
|
base.PopOut();
|
2020-06-23 11:09:24 +00:00
|
|
|
|
pauseLoop?.VolumeTo(0.0f);
|
2020-06-24 12:22:12 +00:00
|
|
|
|
pauseLoop?.Stop();
|
2019-03-18 02:48:11 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|