mirror of
https://github.com/ppy/osu.git
synced 2025-01-28 03:22:54 +08:00
Move PopIn/PopOut sample playback from WaveOverlayContainer
to WaveContainer
(so Multiplayer/Lounge plays the samples)
This commit is contained in:
parent
2e27a476bb
commit
7ef5a71e91
@ -2,6 +2,9 @@
|
|||||||
// See the LICENCE file in the repository root for full licence text.
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
|
using osu.Framework.Allocation;
|
||||||
|
using osu.Framework.Audio;
|
||||||
|
using osu.Framework.Audio.Sample;
|
||||||
using osu.Framework.Extensions.Color4Extensions;
|
using osu.Framework.Extensions.Color4Extensions;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
@ -32,6 +35,13 @@ namespace osu.Game.Graphics.Containers
|
|||||||
|
|
||||||
protected override bool StartHidden => true;
|
protected override bool StartHidden => true;
|
||||||
|
|
||||||
|
private Sample? samplePopIn;
|
||||||
|
private Sample? samplePopOut;
|
||||||
|
protected virtual string PopInSampleName => "UI/wave-pop-in";
|
||||||
|
protected virtual string PopOutSampleName => "UI/overlay-big-pop-out";
|
||||||
|
|
||||||
|
private bool wasShown = false;
|
||||||
|
|
||||||
public Color4 FirstWaveColour
|
public Color4 FirstWaveColour
|
||||||
{
|
{
|
||||||
get => firstWave.Colour;
|
get => firstWave.Colour;
|
||||||
@ -56,6 +66,13 @@ namespace osu.Game.Graphics.Containers
|
|||||||
set => fourthWave.Colour = value;
|
set => fourthWave.Colour = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[BackgroundDependencyLoader(true)]
|
||||||
|
private void load(AudioManager audio)
|
||||||
|
{
|
||||||
|
samplePopIn = audio.Samples.Get(PopInSampleName);
|
||||||
|
samplePopOut = audio.Samples.Get(PopOutSampleName);
|
||||||
|
}
|
||||||
|
|
||||||
public WaveContainer()
|
public WaveContainer()
|
||||||
{
|
{
|
||||||
Masking = true;
|
Masking = true;
|
||||||
@ -110,6 +127,8 @@ namespace osu.Game.Graphics.Containers
|
|||||||
w.Show();
|
w.Show();
|
||||||
|
|
||||||
contentContainer.MoveToY(0, APPEAR_DURATION, Easing.OutQuint);
|
contentContainer.MoveToY(0, APPEAR_DURATION, Easing.OutQuint);
|
||||||
|
samplePopIn?.Play();
|
||||||
|
wasShown = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void PopOut()
|
protected override void PopOut()
|
||||||
@ -118,6 +137,9 @@ namespace osu.Game.Graphics.Containers
|
|||||||
w.Hide();
|
w.Hide();
|
||||||
|
|
||||||
contentContainer.MoveToY(2, DISAPPEAR_DURATION, Easing.In);
|
contentContainer.MoveToY(2, DISAPPEAR_DURATION, Easing.In);
|
||||||
|
|
||||||
|
if (wasShown)
|
||||||
|
samplePopOut?.Play();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void UpdateAfterChildren()
|
protected override void UpdateAfterChildren()
|
||||||
|
@ -18,8 +18,9 @@ namespace osu.Game.Overlays
|
|||||||
|
|
||||||
protected override bool StartHidden => true;
|
protected override bool StartHidden => true;
|
||||||
|
|
||||||
protected override string PopInSampleName => "UI/wave-pop-in";
|
// `WaveContainer` plays PopIn/PopOut samples, so we disable the overlay-level one as to not double-up sample playback.
|
||||||
protected override string PopOutSampleName => "UI/overlay-big-pop-out";
|
protected override string PopInSampleName => "";
|
||||||
|
protected override string PopOutSampleName => "";
|
||||||
|
|
||||||
public const float HORIZONTAL_PADDING = 50;
|
public const float HORIZONTAL_PADDING = 50;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user