1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-26 16:12:54 +08:00

Move PopIn/PopOut sample playback from WaveOverlayContainer to WaveContainer (so Multiplayer/Lounge plays the samples)

This commit is contained in:
Jamie Taylor 2023-08-24 18:13:23 +09:00
parent 2e27a476bb
commit 7ef5a71e91
No known key found for this signature in database
GPG Key ID: 2ACFA8B6370B8C8C
2 changed files with 25 additions and 2 deletions

View File

@ -2,6 +2,9 @@
// See the LICENCE file in the repository root for full licence text.
using System;
using osu.Framework.Allocation;
using osu.Framework.Audio;
using osu.Framework.Audio.Sample;
using osu.Framework.Extensions.Color4Extensions;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
@ -32,6 +35,13 @@ namespace osu.Game.Graphics.Containers
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
{
get => firstWave.Colour;
@ -56,6 +66,13 @@ namespace osu.Game.Graphics.Containers
set => fourthWave.Colour = value;
}
[BackgroundDependencyLoader(true)]
private void load(AudioManager audio)
{
samplePopIn = audio.Samples.Get(PopInSampleName);
samplePopOut = audio.Samples.Get(PopOutSampleName);
}
public WaveContainer()
{
Masking = true;
@ -110,6 +127,8 @@ namespace osu.Game.Graphics.Containers
w.Show();
contentContainer.MoveToY(0, APPEAR_DURATION, Easing.OutQuint);
samplePopIn?.Play();
wasShown = true;
}
protected override void PopOut()
@ -118,6 +137,9 @@ namespace osu.Game.Graphics.Containers
w.Hide();
contentContainer.MoveToY(2, DISAPPEAR_DURATION, Easing.In);
if (wasShown)
samplePopOut?.Play();
}
protected override void UpdateAfterChildren()

View File

@ -18,8 +18,9 @@ namespace osu.Game.Overlays
protected override bool StartHidden => true;
protected override string PopInSampleName => "UI/wave-pop-in";
protected override string PopOutSampleName => "UI/overlay-big-pop-out";
// `WaveContainer` plays PopIn/PopOut samples, so we disable the overlay-level one as to not double-up sample playback.
protected override string PopInSampleName => "";
protected override string PopOutSampleName => "";
public const float HORIZONTAL_PADDING = 50;