mirror of
https://github.com/WWhiteDreamProject/wwdpublic.git
synced 2026-04-23 16:48:10 +03:00
* Add option to disable bwoink sound. * Now it's working only with active admin status. * No bwoink, only "notification sound" * Moar changes * Another one (cherry picked from commit 4809ee25ff5e8e51d4dccf113e2b81488a9c0d7c)
133 lines
4.6 KiB
C#
133 lines
4.6 KiB
C#
using Content.Client.Administration.Managers;
|
|
using Content.Client.Audio;
|
|
using Content.Shared._White.Bark;
|
|
using Content.Shared._White.CCVar;
|
|
using Content.Shared.CCVar;
|
|
using Robust.Client.Audio;
|
|
using Robust.Client.AutoGenerated;
|
|
using Robust.Client.UserInterface;
|
|
using Robust.Client.UserInterface.XAML;
|
|
using Robust.Shared;
|
|
using Robust.Shared.Configuration;
|
|
|
|
namespace Content.Client.Options.UI.Tabs;
|
|
|
|
[GenerateTypedNameReferences]
|
|
public sealed partial class AudioTab : Control
|
|
{
|
|
[Dependency] private readonly IAudioManager _audio = default!;
|
|
[Dependency] private readonly IClientAdminManager _admin = default!;
|
|
[Dependency] private readonly IConfigurationManager _cfg = default!;
|
|
|
|
public AudioTab()
|
|
{
|
|
RobustXamlLoader.Load(this);
|
|
IoCManager.InjectDependencies(this);
|
|
|
|
var masterVolume = Control.AddOptionPercentSlider(
|
|
CVars.AudioMasterVolume,
|
|
SliderVolumeMaster,
|
|
scale: ContentAudioSystem.MasterVolumeMultiplier);
|
|
masterVolume.ImmediateValueChanged += OnMasterVolumeSliderChanged;
|
|
|
|
Control.AddOptionPercentSlider(
|
|
CVars.MidiVolume,
|
|
SliderVolumeMidi,
|
|
scale: ContentAudioSystem.MidiVolumeMultiplier);
|
|
|
|
Control.AddOptionPercentSlider(
|
|
CCVars.AmbientMusicVolume,
|
|
SliderVolumeAmbientMusic,
|
|
scale: ContentAudioSystem.AmbientMusicMultiplier);
|
|
|
|
Control.AddOptionPercentSlider(
|
|
CCVars.AmbienceVolume,
|
|
SliderVolumeAmbience,
|
|
scale: ContentAudioSystem.AmbienceMultiplier);
|
|
|
|
Control.AddOptionPercentSlider(
|
|
CCVars.LobbyMusicVolume,
|
|
SliderVolumeLobby,
|
|
scale: ContentAudioSystem.LobbyMultiplier);
|
|
|
|
Control.AddOptionPercentSlider(
|
|
CCVars.InterfaceVolume,
|
|
SliderVolumeInterface,
|
|
scale: ContentAudioSystem.InterfaceMultiplier);
|
|
|
|
Control.AddOptionPercentSlider(
|
|
CCVars.AnnouncerVolume,
|
|
SliderVolumeAnnouncer,
|
|
scale: ContentAudioSystem.AnnouncerMultiplier);
|
|
|
|
// WD EDIT START
|
|
Control.AddOptionPercentSlider(
|
|
WhiteCVars.TTSVolume,
|
|
SliderVolumeTts,
|
|
scale: ContentAudioSystem.TTSMultiplier);
|
|
|
|
Control.AddOptionPercentSlider(
|
|
WhiteCVars.BarkVolume,
|
|
SliderVolumeBark);
|
|
|
|
Control.AddOptionSlider(
|
|
WhiteCVars.BarkLimit,
|
|
SliderLimitBark,
|
|
0,
|
|
128);
|
|
// WD EDIT END
|
|
|
|
Control.AddOptionSlider(
|
|
CCVars.MaxAmbientSources,
|
|
SliderMaxAmbienceSounds,
|
|
_cfg.GetCVar(CCVars.MinMaxAmbientSourcesConfigured),
|
|
_cfg.GetCVar(CCVars.MaxMaxAmbientSourcesConfigured));
|
|
|
|
Control.AddOptionCheckBox(CCVars.LobbyMusicEnabled, LobbyMusicCheckBox);
|
|
Control.AddOptionCheckBox(CCVars.RestartSoundsEnabled, RestartSoundsCheckBox);
|
|
Control.AddOptionCheckBox(CCVars.EventMusicEnabled, EventMusicCheckBox);
|
|
Control.AddOptionCheckBox(CCVars.AnnouncerDisableMultipleEnabled, AnnouncerDisableMultipleSoundsCheckBox);
|
|
Control.AddOptionCheckBox(CCVars.AdminSoundsEnabled, AdminSoundsCheckBox);
|
|
Control.AddOptionCheckBox(CCVars.BwoinkSoundEnabled, BwoinkSoundCheckBox);
|
|
Control.AddOptionCheckBox(WhiteCVars.CombatModeSoundEnabled, CombatModeSoundCheckBox); // WD EDIT
|
|
|
|
// WD EDIT START
|
|
Control.AddOptionDropDown(
|
|
WhiteCVars.VoiceType,
|
|
DropDownVoiceType,
|
|
[
|
|
new (CharacterVoiceType.None, Loc.GetString("char-voice-none")),
|
|
new (CharacterVoiceType.Bark, Loc.GetString("char-voice-bark")),
|
|
new (CharacterVoiceType.TTS, Loc.GetString("char-voice-tts")),
|
|
]);
|
|
// WD EDIT END
|
|
Control.Initialize();
|
|
}
|
|
|
|
protected override void EnteredTree()
|
|
{
|
|
base.EnteredTree();
|
|
_admin.AdminStatusUpdated += UpdateAdminButtonsVisibility;
|
|
UpdateAdminButtonsVisibility();
|
|
}
|
|
|
|
protected override void ExitedTree()
|
|
{
|
|
base.ExitedTree();
|
|
_admin.AdminStatusUpdated -= UpdateAdminButtonsVisibility;
|
|
}
|
|
|
|
|
|
private void UpdateAdminButtonsVisibility()
|
|
{
|
|
BwoinkSoundCheckBox.Visible = _admin.IsActive();
|
|
}
|
|
|
|
private void OnMasterVolumeSliderChanged(float value)
|
|
{
|
|
// TODO: I was thinking of giving OptionsTabControlRow a flag to "set CVar immediately", but I'm deferring that
|
|
// until there's a proper system for enforcing people don't close the window with pending changes.
|
|
_audio.SetMasterGain(value);
|
|
}
|
|
}
|