From 49bb4deaba2e9f861d994422027b74a6243bf4c5 Mon Sep 17 00:00:00 2001 From: Morb0 <14136326+Morb0@users.noreply.github.com> Date: Wed, 15 May 2024 19:36:04 +0300 Subject: [PATCH 01/84] Fix upstream --- .../Corvax/TTS/HumanoidProfileEditor.TTS.cs | 28 +++++++++++++------ .../Corvax/TTS/LobbyUIController.TTS.cs | 18 ------------ Content.Client/IoC/ClientContentIoC.cs | 1 - .../Lobby/UI/HumanoidProfileEditor.xaml | 4 +-- .../Lobby/UI/HumanoidProfileEditor.xaml.cs | 13 +++++++++ .../Loadouts/Effects/SponsorLoadoutEffect.cs | 3 +- .../SharedHumanoidAppearanceSystem.cs | 6 +++- .../Loadouts/Effects/SpeciesLoadoutEffect.cs | 2 +- 8 files changed, 42 insertions(+), 33 deletions(-) delete mode 100644 Content.Client/Corvax/TTS/LobbyUIController.TTS.cs diff --git a/Content.Client/Corvax/TTS/HumanoidProfileEditor.TTS.cs b/Content.Client/Corvax/TTS/HumanoidProfileEditor.TTS.cs index b00997a16a7..bb61102c41f 100644 --- a/Content.Client/Corvax/TTS/HumanoidProfileEditor.TTS.cs +++ b/Content.Client/Corvax/TTS/HumanoidProfileEditor.TTS.cs @@ -1,10 +1,11 @@ using System.Linq; +using Content.Client.Corvax.TTS; using Content.Client.Lobby; using Content.Corvax.Interfaces.Shared; using Content.Shared.Corvax.TTS; using Content.Shared.Preferences; -namespace Content.Client.Preferences.UI; +namespace Content.Client.Lobby.UI; public sealed partial class HumanoidProfileEditor { @@ -19,13 +20,14 @@ private void InitializeVoice() .OrderBy(o => Loc.GetString(o.Name)) .ToList(); - _voiceButton.OnItemSelected += args => + VoiceButton.OnItemSelected += args => { - _voiceButton.SelectId(args.Id); + VoiceButton.SelectId(args.Id); SetVoice(_voiceList[args.Id].ID); }; - _voicePlayButton.OnPressed += _ => { UserInterfaceManager.GetUIController().PlayTTS(); }; + VoicePlayButton.OnPressed += _ => PlayPreviewTTS(); + IoCManager.Instance!.TryResolveType(out _sponsorsMgr); } @@ -34,7 +36,7 @@ private void UpdateTTSVoicesControls() if (Profile is null) return; - _voiceButton.Clear(); + VoiceButton.Clear(); var firstVoiceChoiceId = 1; for (var i = 0; i < _voiceList.Count; i++) @@ -44,7 +46,7 @@ private void UpdateTTSVoicesControls() continue; var name = Loc.GetString(voice.Name); - _voiceButton.AddItem(name, i); + VoiceButton.AddItem(name, i); if (firstVoiceChoiceId == 1) firstVoiceChoiceId = i; @@ -54,15 +56,23 @@ private void UpdateTTSVoicesControls() if (voice.SponsorOnly && _sponsorsMgr != null && !_sponsorsMgr.GetClientPrototypes().Contains(voice.ID)) { - _voiceButton.SetItemDisabled(_voiceButton.GetIdx(i), true); + VoiceButton.SetItemDisabled(VoiceButton.GetIdx(i), true); } } var voiceChoiceId = _voiceList.FindIndex(x => x.ID == Profile.Voice); - if (!_voiceButton.TrySelectId(voiceChoiceId) && - _voiceButton.TrySelectId(firstVoiceChoiceId)) + if (!VoiceButton.TrySelectId(voiceChoiceId) && + VoiceButton.TrySelectId(firstVoiceChoiceId)) { SetVoice(_voiceList[firstVoiceChoiceId].ID); } } + + private void PlayPreviewTTS() + { + if (Profile is null) + return; + + _entManager.System().RequestPreviewTTS(Profile.Voice); + } } diff --git a/Content.Client/Corvax/TTS/LobbyUIController.TTS.cs b/Content.Client/Corvax/TTS/LobbyUIController.TTS.cs deleted file mode 100644 index 3612a45ab88..00000000000 --- a/Content.Client/Corvax/TTS/LobbyUIController.TTS.cs +++ /dev/null @@ -1,18 +0,0 @@ -using Content.Client.Corvax.TTS; -using Robust.Client.UserInterface; - -namespace Content.Client.Lobby; - -public sealed partial class LobbyUIController -{ - [UISystemDependency] private readonly TTSSystem _tts = default!; - - public void PlayTTS() - { - // Test moment - if (_profile == null || _stateManager.CurrentState is not LobbyState) - return; - - _tts.RequestPreviewTTS(_profile.Voice); - } -} diff --git a/Content.Client/IoC/ClientContentIoC.cs b/Content.Client/IoC/ClientContentIoC.cs index 75febdbab80..fd07228f98a 100644 --- a/Content.Client/IoC/ClientContentIoC.cs +++ b/Content.Client/IoC/ClientContentIoC.cs @@ -17,7 +17,6 @@ using Content.Shared.Administration.Logs; using Content.Client.Guidebook; using Content.Client.Lobby; -using Content.Client.Preferences; using Content.Client.Replay; using Content.Shared.Administration.Managers; using Content.Shared.Players.PlayTimeTracking; diff --git a/Content.Client/Lobby/UI/HumanoidProfileEditor.xaml b/Content.Client/Lobby/UI/HumanoidProfileEditor.xaml index 6e1f96f6ab5..534f084ea58 100644 --- a/Content.Client/Lobby/UI/HumanoidProfileEditor.xaml +++ b/Content.Client/Lobby/UI/HumanoidProfileEditor.xaml @@ -93,8 +93,8 @@