1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-06 12:17:46 +08:00

Add sound for team swaps

This commit is contained in:
Jamie Taylor 2021-09-08 13:45:05 +09:00
parent 2c6ee0ebf7
commit 217ca754ae
No known key found for this signature in database
GPG Key ID: 2ACFA8B6370B8C8C

View File

@ -3,6 +3,8 @@
using System.Linq; using System.Linq;
using osu.Framework.Allocation; using osu.Framework.Allocation;
using osu.Framework.Audio;
using osu.Framework.Audio.Sample;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Framework.Graphics.Colour; using osu.Framework.Graphics.Colour;
using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Containers;
@ -22,6 +24,8 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer.Participants
private Drawable box; private Drawable box;
private Sample sampleTeamSwap;
[Resolved] [Resolved]
private OsuColour colours { get; set; } private OsuColour colours { get; set; }
@ -39,7 +43,7 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer.Participants
} }
[BackgroundDependencyLoader] [BackgroundDependencyLoader]
private void load() private void load(AudioManager audio)
{ {
box = new Container box = new Container
{ {
@ -72,6 +76,8 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer.Participants
{ {
InternalChild = box; InternalChild = box;
} }
sampleTeamSwap = audio.Samples.Get(@"Multiplayer/team-swap");
} }
private void changeTeam() private void changeTeam()
@ -99,6 +105,9 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer.Participants
if (newTeam == displayedTeam) if (newTeam == displayedTeam)
return; return;
if (newTeam != null && displayedTeam != null)
sampleTeamSwap?.Play();
displayedTeam = newTeam; displayedTeam = newTeam;
if (displayedTeam != null) if (displayedTeam != null)