fix: ТТС снова выдает правильные голоса
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
using Lidgren.Network;
|
||||
using Robust.Shared.Network;
|
||||
using Robust.Shared.Prototypes;
|
||||
using Robust.Shared.Serialization;
|
||||
|
||||
namespace Content.Shared._White.TTS;
|
||||
@@ -10,8 +11,8 @@ public sealed class MsgRequestTTS : NetMessage
|
||||
public override MsgGroups MsgGroup => MsgGroups.Command;
|
||||
|
||||
public EntityUid Uid { get; set; } = EntityUid.Invalid;
|
||||
public string Text { get; set; } = String.Empty;
|
||||
public string VoiceId { get; set; } = String.Empty;
|
||||
public string Text { get; set; } = string.Empty;
|
||||
public ProtoId<TTSVoicePrototype> VoiceId { get; set; } = string.Empty;
|
||||
|
||||
public override void ReadFromBuffer(NetIncomingMessage buffer, IRobustSerializer serializer)
|
||||
{
|
||||
|
||||
@@ -4,16 +4,11 @@ namespace Content.Shared._White.TTS;
|
||||
|
||||
[Serializable, NetSerializable]
|
||||
// ReSharper disable once InconsistentNaming
|
||||
public sealed class PlayTTSEvent : EntityEventArgs
|
||||
public sealed class PlayTTSEvent(NetEntity uid, byte[] data, bool boostVolume) : EntityEventArgs
|
||||
{
|
||||
public NetEntity Uid { get; }
|
||||
public byte[] Data { get; }
|
||||
public bool BoostVolume { get; }
|
||||
public NetEntity Uid { get; } = uid;
|
||||
|
||||
public PlayTTSEvent(NetEntity uid, byte[] data, bool boostVolume)
|
||||
{
|
||||
Uid = uid;
|
||||
Data = data;
|
||||
BoostVolume = boostVolume;
|
||||
}
|
||||
}
|
||||
public byte[] Data { get; } = data;
|
||||
|
||||
public bool BoostVolume { get; } = boostVolume;
|
||||
}
|
||||
@@ -4,12 +4,7 @@ namespace Content.Shared._White.TTS;
|
||||
|
||||
[Serializable, NetSerializable]
|
||||
// ReSharper disable once InconsistentNaming
|
||||
public sealed class RequestTTSEvent : EntityEventArgs
|
||||
public sealed class RequestTTSEvent(string text) : EntityEventArgs
|
||||
{
|
||||
public string Text { get; }
|
||||
|
||||
public RequestTTSEvent(string text)
|
||||
{
|
||||
Text = text;
|
||||
}
|
||||
}
|
||||
public string Text { get; } = text;
|
||||
}
|
||||
17
Content.Shared/_White/TTS/SharedTTSComponent.cs
Normal file
17
Content.Shared/_White/TTS/SharedTTSComponent.cs
Normal file
@@ -0,0 +1,17 @@
|
||||
using Robust.Shared.Prototypes;
|
||||
|
||||
namespace Content.Shared._White.TTS;
|
||||
|
||||
/// <summary>
|
||||
/// Apply TTS for entity chat say messages
|
||||
/// </summary>
|
||||
[RegisterComponent, AutoGenerateComponentState]
|
||||
// ReSharper disable once InconsistentNaming
|
||||
public sealed partial class SharedTTSComponent : Component
|
||||
{
|
||||
/// <summary>
|
||||
/// Prototype of used voice for TTS.
|
||||
/// </summary>
|
||||
[ViewVariables(VVAccess.ReadWrite), DataField, AutoNetworkedField]
|
||||
public ProtoId<TTSVoicePrototype> VoicePrototypeId { get; set; } = "Eugene";
|
||||
}
|
||||
@@ -3,12 +3,7 @@
|
||||
namespace Content.Shared.VoiceMask;
|
||||
|
||||
[Serializable, NetSerializable]
|
||||
public sealed class VoiceMaskChangeVoiceMessage : BoundUserInterfaceMessage
|
||||
public sealed class VoiceMaskChangeVoiceMessage(string voice) : BoundUserInterfaceMessage
|
||||
{
|
||||
public string Voice { get; }
|
||||
|
||||
public VoiceMaskChangeVoiceMessage(string voice)
|
||||
{
|
||||
Voice = voice;
|
||||
}
|
||||
}
|
||||
public string Voice { get; } = voice;
|
||||
}
|
||||
@@ -1,8 +1,8 @@
|
||||
using Content.Shared.Humanoid;
|
||||
using Content.Shared.Preferences;
|
||||
|
||||
namespace Content.Shared._White.TTS;
|
||||
|
||||
// ReSharper disable once InconsistentNaming
|
||||
public sealed class TTSPitchRateSystem : EntitySystem
|
||||
{
|
||||
|
||||
|
||||
@@ -10,28 +10,27 @@ namespace Content.Shared._White.TTS;
|
||||
// ReSharper disable once InconsistentNaming
|
||||
public sealed class TTSVoicePrototype : IPrototype
|
||||
{
|
||||
[IdDataFieldAttribute]
|
||||
[IdDataField]
|
||||
public string ID { get; } = default!;
|
||||
|
||||
[DataField("name")]
|
||||
[DataField]
|
||||
public string Name { get; } = string.Empty;
|
||||
|
||||
[DataField("sex", required: true)]
|
||||
public Sex Sex { get; } = default!;
|
||||
[DataField(required: true)]
|
||||
public Sex Sex { get; }
|
||||
|
||||
[ViewVariables(VVAccess.ReadWrite)]
|
||||
[DataField("speaker", required: true)]
|
||||
[ViewVariables(VVAccess.ReadWrite), DataField(required: true)]
|
||||
public string Speaker { get; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// Whether the species is available "at round start" (In the character editor)
|
||||
/// </summary>
|
||||
[DataField("roundStart")]
|
||||
[DataField]
|
||||
public bool RoundStart { get; } = true;
|
||||
|
||||
[DataField("sponsorOnly")]
|
||||
public bool SponsorOnly { get; } = false;
|
||||
[DataField]
|
||||
public bool SponsorOnly { get; }
|
||||
|
||||
[DataField("borgVoice")]
|
||||
public bool BorgVoice { get; } = false;
|
||||
[DataField]
|
||||
public bool BorgVoice { get; }
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user