Content audio (#20862)

This commit is contained in:
metalgearsloth
2023-10-29 14:58:23 +11:00
committed by GitHub
parent cd280eef6b
commit 9b1b3e03ed
326 changed files with 890 additions and 436 deletions

View File

@@ -21,7 +21,7 @@ namespace Content.Client.UserInterface.Systems.Atmos.GasTank
private readonly Control _contentContainer;
private readonly IResourceCache _resourceCache = default!;
private readonly IClientResourceCache _resourceCache = default!;
private readonly RichTextLabel _lblPressure;
private readonly FloatSpinBox _spbPressure;
private readonly RichTextLabel _lblInternals;
@@ -30,7 +30,7 @@ namespace Content.Client.UserInterface.Systems.Atmos.GasTank
public GasTankWindow(GasTankBoundUserInterface owner)
{
TextureButton btnClose;
_resourceCache = IoCManager.Resolve<IResourceCache>();
_resourceCache = IoCManager.Resolve<IClientResourceCache>();
_owner = owner;
var rootContainer = new LayoutContainer {Name = "GasTankRoot"};
AddChild(rootContainer);

View File

@@ -20,6 +20,7 @@ using Robust.Client.UserInterface.Controllers;
using Robust.Client.UserInterface.Controls;
using Robust.Client.UserInterface.CustomControls;
using Robust.Shared.Audio;
using Robust.Shared.Audio.Systems;
using Robust.Shared.Input.Binding;
using Robust.Shared.Network;
using Robust.Shared.Player;
@@ -34,6 +35,7 @@ public sealed class AHelpUIController: UIController, IOnSystemChanged<BwoinkSyst
[Dependency] private readonly IPlayerManager _playerManager = default!;
[Dependency] private readonly IClyde _clyde = default!;
[Dependency] private readonly IUserInterfaceManager _uiManager = default!;
[UISystemDependency] private readonly SharedAudioSystem _audio = default!;
private BwoinkSystem? _bwoinkSystem;
private MenuButton? GameAHelpButton => UIManager.GetActiveUIWidgetOrNull<GameTopMenuBar>()?.AHelpButton;
@@ -128,7 +130,7 @@ public sealed class AHelpUIController: UIController, IOnSystemChanged<BwoinkSyst
}
if (localPlayer.UserId != message.TrueSender)
{
SoundSystem.Play("/Audio/Effects/adminhelp.ogg", Filter.Local());
_audio.PlayGlobal("/Audio/Effects/adminhelp.ogg", Filter.Local(), false);
_clyde.RequestWindowAttention();
}

View File

@@ -20,7 +20,7 @@ public sealed class ChannelFilterButton : ContainerButton
public ChannelFilterButton()
{
_chatUIController = UserInterfaceManager.GetUIController<ChatUIController>();
var filterTexture = IoCManager.Resolve<IResourceCache>()
var filterTexture = IoCManager.Resolve<IClientResourceCache>()
.GetTexture("/Textures/Interface/Nano/filter.svg.96dpi.png");
// needed for same reason as ChannelSelectorButton

View File

@@ -1,7 +1,9 @@
using Content.Client.UserInterface.Systems.Chat.Controls;
using Content.Shared.Chat;
using Content.Shared.Input;
using Robust.Client.Audio;
using Robust.Client.AutoGenerated;
using Robust.Client.GameObjects;
using Robust.Client.UserInterface;
using Robust.Client.UserInterface.Controls;
using Robust.Client.UserInterface.XAML;
@@ -19,6 +21,7 @@ public partial class ChatBox : UIWidget
#pragma warning restore RA0003
{
private readonly ChatUIController _controller;
private readonly IEntityManager _entManager;
public bool Main { get; set; }
@@ -27,6 +30,7 @@ public partial class ChatBox : UIWidget
public ChatBox()
{
RobustXamlLoader.Load(this);
_entManager = IoCManager.Resolve<IEntityManager>();
ChatInput.Input.OnTextEntered += OnTextEntered;
ChatInput.Input.OnKeyBindDown += OnKeyBindDown;
@@ -52,8 +56,8 @@ public partial class ChatBox : UIWidget
return;
}
if (msg is { Read: false, AudioPath: not null })
SoundSystem.Play(msg.AudioPath, Filter.Local(), new AudioParams().WithVolume(msg.AudioVolume));
if (msg is { Read: false, AudioPath: { } })
_entManager.System<AudioSystem>().PlayGlobal(msg.AudioPath, Filter.Local(), false, AudioParams.Default.WithVolume(msg.AudioVolume));
msg.Read = true;