mirror of
https://github.com/osukey/osukey.git
synced 2025-06-03 20:07:18 +09:00
now uses SkinnableSample instead of Drawable sample
Still does not support switching skins after Pause overlay loading, there will be no sound for the first pause (works fine the the nexts) Also, the pause loop seems to play for approximately 1 second when exiting the screens via restart or quit finally, since SkinnableSound does not play a sound if its aggregate volume is at 0, i had turn up the volume a bit before playing the loop
This commit is contained in:
parent
9e5cc1b7a2
commit
7d2d6a52c9
@ -3,8 +3,11 @@
|
||||
|
||||
using System;
|
||||
using System.Linq;
|
||||
using Humanizer;
|
||||
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.Audio;
|
||||
@ -21,40 +24,40 @@ 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;
|
||||
private SkinnableSound pauseLoop;
|
||||
|
||||
protected override Action BackAction => () => InternalButtons.Children.First().Click();
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(OsuColour colours, AudioManager audio, SkinManager skins)
|
||||
private void load(OsuColour colours)
|
||||
{
|
||||
AddButton("Continue", colours.Green, () => OnResume?.Invoke());
|
||||
AddButton("Retry", colours.YellowDark, () => OnRetry?.Invoke());
|
||||
AddButton("Quit", new Color4(170, 27, 39, 255), () => OnQuit?.Invoke());
|
||||
|
||||
var sampleChannel = skins.GetSample(new SampleInfo("pause-loop")) ?? audio.Samples.Get(@"Gameplay/pause-loop");
|
||||
|
||||
if (sampleChannel != null)
|
||||
AddInternal(pauseLoop = new SkinnableSound(new SampleInfo("pause-loop"))
|
||||
{
|
||||
AddInternal(pauseLoop = new DrawableSample(sampleChannel)
|
||||
{
|
||||
Looping = true,
|
||||
});
|
||||
}
|
||||
Looping = true,
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
protected override void PopIn()
|
||||
{
|
||||
base.PopIn();
|
||||
|
||||
//SkinnableSound only plays a sound if its aggregate volume is > 0, so the volume must be turned up before playing it
|
||||
pauseLoop?.TransformBindableTo(pauseLoop.Volume, 0.00001);
|
||||
pauseLoop?.TransformBindableTo(pauseLoop.Volume, 1.0f, 400, Easing.InQuint);
|
||||
pauseLoop?.Play();
|
||||
pauseLoop?.VolumeTo(1.0f, 400, Easing.InQuint);
|
||||
}
|
||||
|
||||
protected override void PopOut()
|
||||
{
|
||||
base.PopOut();
|
||||
pauseLoop?.VolumeTo(0.0f);
|
||||
pauseLoop?.Stop();
|
||||
pauseLoop?.Stop();
|
||||
pauseLoop?.TransformBindableTo(pauseLoop.Volume, 0.0f);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user