Hide TTS selectors if CVar disabled

This commit is contained in:
Morb0 2024-05-13 17:42:32 +03:00
parent 2256ab983c
commit 7742fbbd86
6 changed files with 20 additions and 6 deletions

View file

@ -9,7 +9,7 @@ namespace Content.Client.Preferences.UI;
public sealed partial class HumanoidProfileEditor
{
private ISharedSponsorsManager? _sponsorsMgr;
private List<TTSVoicePrototype> _voiceList = default!;
private List<TTSVoicePrototype> _voiceList = new();
private void InitializeVoice()
{

View file

@ -94,7 +94,7 @@
<OptionButton Name="CSpawnPriorityButton" HorizontalAlignment="Right" />
</BoxContainer>
<!-- Corvax-TTS-Start -->
<BoxContainer HorizontalExpand="True">
<BoxContainer HorizontalExpand="True" Visible="False" Name="TTSContainer">
<Label Text="{Loc 'humanoid-profile-editor-voice-label'}" />
<Control HorizontalExpand="True"/>
<OptionButton Name="CVoiceButton" HorizontalAlignment="Right" />

View file

@ -10,6 +10,7 @@ using Content.Client.UserInterface.Controls;
using Content.Client.UserInterface.Systems.Guidebook;
using Content.Shared.CCVar;
using Content.Shared.Clothing;
using Content.Shared.Corvax.CCCVars;
using Content.Shared.GameTicking;
using Content.Shared.Humanoid;
using Content.Shared.Humanoid.Markings;
@ -152,7 +153,11 @@ namespace Content.Client.Preferences.UI
// Corvax-TTS-Start
#region Voice
InitializeVoice();
if (configurationManager.GetCVar(CCCVars.TTSEnabled))
{
TTSContainer.Visible = true;
InitializeVoice();
}
#endregion
// Corvax-TTS-End

View file

@ -13,7 +13,7 @@
<OptionButton Name="SpeechVerbSelector" /> <!-- Populated in LoadVerbs -->
</BoxContainer>
<!-- Corvax-TTS-Start -->
<BoxContainer Orientation="Horizontal" Margin="5">
<BoxContainer Orientation="Horizontal" Margin="5" Visible="False" Name="TTSContainer">
<Label Text="{Loc 'voice-mask-voice-change-info'}" />
<OptionButton Name="VoiceSelector" /> <!-- Populated in LoadVerbs -->
</BoxContainer>

View file

@ -1,9 +1,11 @@
using System.Linq;
using Content.Shared.Corvax.TTS;
using Content.Client.UserInterface.Controls;
using Content.Shared.Corvax.CCCVars;
using Content.Shared.Speech;
using Robust.Client.AutoGenerated;
using Robust.Client.UserInterface.XAML;
using Robust.Shared.Configuration;
using Robust.Shared.Prototypes;
namespace Content.Client.VoiceMask;
@ -36,7 +38,14 @@ public sealed partial class VoiceMaskNameChangeWindow : FancyWindow
};
ReloadVerbs(proto);
ReloadVoices(proto); // Corvax-TTS
// Corvax-TTS-Start
if (IoCManager.Resolve<IConfigurationManager>().GetCVar(CCCVars.TTSEnabled))
{
TTSContainer.Visible = true;
ReloadVoices(proto);
}
// Corvax-TTS-End
AddVerbs();
}

View file

@ -23,7 +23,7 @@ public sealed class CCCVars
/// URL of the TTS server API.
/// </summary>
public static readonly CVarDef<bool> TTSEnabled =
CVarDef.Create("tts.enabled", false, CVar.SERVERONLY | CVar.ARCHIVE);
CVarDef.Create("tts.enabled", false, CVar.SERVER | CVar.REPLICATED | CVar.ARCHIVE);
/// <summary>
/// URL of the TTS server API.