mirror of
https://github.com/ppy/osu.git
synced 2024-11-11 15:07:44 +08:00
Add multiplayer lobby countdown SFX
This commit is contained in:
parent
9d93cffbb2
commit
0f4b75ab15
@ -5,6 +5,8 @@ using System;
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using JetBrains.Annotations;
|
using JetBrains.Annotations;
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
|
using osu.Framework.Audio;
|
||||||
|
using osu.Framework.Audio.Sample;
|
||||||
using osu.Framework.Localisation;
|
using osu.Framework.Localisation;
|
||||||
using osu.Framework.Threading;
|
using osu.Framework.Threading;
|
||||||
using osu.Game.Graphics;
|
using osu.Game.Graphics;
|
||||||
@ -27,6 +29,17 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer.Match
|
|||||||
[CanBeNull]
|
[CanBeNull]
|
||||||
private MultiplayerRoom room => multiplayerClient.Room;
|
private MultiplayerRoom room => multiplayerClient.Room;
|
||||||
|
|
||||||
|
private Sample countdownTickSample;
|
||||||
|
private Sample countdownTickFinalSample;
|
||||||
|
private int? lastTickPlayed;
|
||||||
|
|
||||||
|
[BackgroundDependencyLoader]
|
||||||
|
private void load(AudioManager audio)
|
||||||
|
{
|
||||||
|
countdownTickSample = audio.Samples.Get(@"Multiplayer/countdown-tick");
|
||||||
|
countdownTickFinalSample = audio.Samples.Get(@"Multiplayer/countdown-tick-final");
|
||||||
|
}
|
||||||
|
|
||||||
protected override void LoadComplete()
|
protected override void LoadComplete()
|
||||||
{
|
{
|
||||||
base.LoadComplete();
|
base.LoadComplete();
|
||||||
@ -83,6 +96,16 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer.Match
|
|||||||
else
|
else
|
||||||
countdownRemaining = countdown.TimeRemaining - timeElapsed;
|
countdownRemaining = countdown.TimeRemaining - timeElapsed;
|
||||||
|
|
||||||
|
if (countdownRemaining.Seconds <= 10 && (lastTickPlayed == null || lastTickPlayed != countdownRemaining.Seconds))
|
||||||
|
{
|
||||||
|
countdownTickSample?.Play();
|
||||||
|
|
||||||
|
if (countdownRemaining.Seconds <= 3)
|
||||||
|
countdownTickFinalSample?.Play();
|
||||||
|
|
||||||
|
lastTickPlayed = countdownRemaining.Seconds;
|
||||||
|
}
|
||||||
|
|
||||||
string countdownText = $"Starting in {countdownRemaining:mm\\:ss}";
|
string countdownText = $"Starting in {countdownRemaining:mm\\:ss}";
|
||||||
|
|
||||||
switch (localUser?.State)
|
switch (localUser?.State)
|
||||||
|
Loading…
Reference in New Issue
Block a user