перенос общих файлов из папки White в _White
This commit is contained in:
29
Content.Shared/_White/TTS/MsgRequestTTS.cs
Normal file
29
Content.Shared/_White/TTS/MsgRequestTTS.cs
Normal file
@@ -0,0 +1,29 @@
|
||||
using Lidgren.Network;
|
||||
using Robust.Shared.Network;
|
||||
using Robust.Shared.Serialization;
|
||||
|
||||
namespace Content.Shared._White.TTS;
|
||||
|
||||
// ReSharper disable once InconsistentNaming
|
||||
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 override void ReadFromBuffer(NetIncomingMessage buffer, IRobustSerializer serializer)
|
||||
{
|
||||
Uid = new EntityUid(buffer.ReadInt32());
|
||||
Text = buffer.ReadString();
|
||||
VoiceId = buffer.ReadString();
|
||||
}
|
||||
|
||||
public override void WriteToBuffer(NetOutgoingMessage buffer, IRobustSerializer serializer)
|
||||
{
|
||||
buffer.Write((int)Uid);
|
||||
buffer.Write(Text);
|
||||
buffer.Write(VoiceId);
|
||||
}
|
||||
}
|
||||
19
Content.Shared/_White/TTS/PlayTTSEvent.cs
Normal file
19
Content.Shared/_White/TTS/PlayTTSEvent.cs
Normal file
@@ -0,0 +1,19 @@
|
||||
using Robust.Shared.Serialization;
|
||||
|
||||
namespace Content.Shared._White.TTS;
|
||||
|
||||
[Serializable, NetSerializable]
|
||||
// ReSharper disable once InconsistentNaming
|
||||
public sealed class PlayTTSEvent : EntityEventArgs
|
||||
{
|
||||
public NetEntity Uid { get; }
|
||||
public byte[] Data { get; }
|
||||
public bool BoostVolume { get; }
|
||||
|
||||
public PlayTTSEvent(NetEntity uid, byte[] data, bool boostVolume)
|
||||
{
|
||||
Uid = uid;
|
||||
Data = data;
|
||||
BoostVolume = boostVolume;
|
||||
}
|
||||
}
|
||||
15
Content.Shared/_White/TTS/RequestTTSEvent.cs
Normal file
15
Content.Shared/_White/TTS/RequestTTSEvent.cs
Normal file
@@ -0,0 +1,15 @@
|
||||
using Robust.Shared.Serialization;
|
||||
|
||||
namespace Content.Shared._White.TTS;
|
||||
|
||||
[Serializable, NetSerializable]
|
||||
// ReSharper disable once InconsistentNaming
|
||||
public sealed class RequestTTSEvent : EntityEventArgs
|
||||
{
|
||||
public string Text { get; }
|
||||
|
||||
public RequestTTSEvent(string text)
|
||||
{
|
||||
Text = text;
|
||||
}
|
||||
}
|
||||
14
Content.Shared/_White/TTS/SharedVoiceMaskSystem.cs
Normal file
14
Content.Shared/_White/TTS/SharedVoiceMaskSystem.cs
Normal file
@@ -0,0 +1,14 @@
|
||||
using Robust.Shared.Serialization;
|
||||
|
||||
namespace Content.Shared.VoiceMask;
|
||||
|
||||
[Serializable, NetSerializable]
|
||||
public sealed class VoiceMaskChangeVoiceMessage : BoundUserInterfaceMessage
|
||||
{
|
||||
public string Voice { get; }
|
||||
|
||||
public VoiceMaskChangeVoiceMessage(string voice)
|
||||
{
|
||||
Voice = voice;
|
||||
}
|
||||
}
|
||||
71
Content.Shared/_White/TTS/TTSPitchRateSystem.cs
Normal file
71
Content.Shared/_White/TTS/TTSPitchRateSystem.cs
Normal file
@@ -0,0 +1,71 @@
|
||||
using Content.Shared.Humanoid;
|
||||
using Content.Shared.Preferences;
|
||||
|
||||
namespace Content.Shared._White.TTS;
|
||||
|
||||
public sealed class TTSPitchRateSystem : EntitySystem
|
||||
{
|
||||
|
||||
public bool TryGetPitchRate(EntityUid uid, out List<string> pitchRate)
|
||||
{
|
||||
if (!TryComp<HumanoidAppearanceComponent>(uid, out var humanoid))
|
||||
{
|
||||
pitchRate = new List<string>();
|
||||
return false;
|
||||
}
|
||||
|
||||
pitchRate = new List<string> {"medium", "medium"};
|
||||
|
||||
GetPitchRateForSpecies(uid, humanoid, ref pitchRate);
|
||||
return true;
|
||||
}
|
||||
|
||||
private void GetPitchRateForSpecies(EntityUid uid, HumanoidAppearanceComponent humanoid, ref List<string> pitchRate)
|
||||
{
|
||||
switch (humanoid.Species)
|
||||
{
|
||||
case "SlimePerson":
|
||||
pitchRate[0] = "high";
|
||||
pitchRate[1] = "medium";
|
||||
break;
|
||||
case "Arachnid":
|
||||
pitchRate[0] = "x-high";
|
||||
pitchRate[1] = "x-fast";
|
||||
break;
|
||||
case "Human":
|
||||
var meta = MetaData(uid);
|
||||
if (meta.EntityPrototype != null && meta.EntityPrototype.ToString() == "MobDwarf") //Dwarfs
|
||||
{
|
||||
pitchRate[0] = "high";
|
||||
pitchRate[1] = "slow";
|
||||
}
|
||||
else if (humanoid.SkinColor.R >= 0.6)
|
||||
{
|
||||
pitchRate[0] = "x-low";
|
||||
pitchRate[1] = "medium";
|
||||
}
|
||||
else
|
||||
{
|
||||
pitchRate[0] = "medium";
|
||||
pitchRate[1] = "medium";
|
||||
}
|
||||
break;
|
||||
case "Diona":
|
||||
pitchRate[0] = "x-low";
|
||||
pitchRate[1] = "x-slow";
|
||||
break;
|
||||
case "Reptilian":
|
||||
pitchRate[0] = "low";
|
||||
pitchRate[1] = "slow";
|
||||
break;
|
||||
case "Skrell":
|
||||
pitchRate[0] = "medium";
|
||||
pitchRate[1] = "medium";
|
||||
break;
|
||||
case "Skeleton":
|
||||
pitchRate[0] = "medium";
|
||||
pitchRate[1] = "medium";
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
37
Content.Shared/_White/TTS/TTSVoicePrototype.cs
Normal file
37
Content.Shared/_White/TTS/TTSVoicePrototype.cs
Normal file
@@ -0,0 +1,37 @@
|
||||
using Content.Shared.Humanoid;
|
||||
using Robust.Shared.Prototypes;
|
||||
|
||||
namespace Content.Shared._White.TTS;
|
||||
|
||||
/// <summary>
|
||||
/// Prototype represent available TTS voices
|
||||
/// </summary>
|
||||
[Prototype("ttsVoice")]
|
||||
// ReSharper disable once InconsistentNaming
|
||||
public sealed class TTSVoicePrototype : IPrototype
|
||||
{
|
||||
[IdDataFieldAttribute]
|
||||
public string ID { get; } = default!;
|
||||
|
||||
[DataField("name")]
|
||||
public string Name { get; } = string.Empty;
|
||||
|
||||
[DataField("sex", required: true)]
|
||||
public Sex Sex { get; } = default!;
|
||||
|
||||
[ViewVariables(VVAccess.ReadWrite)]
|
||||
[DataField("speaker", required: true)]
|
||||
public string Speaker { get; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// Whether the species is available "at round start" (In the character editor)
|
||||
/// </summary>
|
||||
[DataField("roundStart")]
|
||||
public bool RoundStart { get; } = true;
|
||||
|
||||
[DataField("sponsorOnly")]
|
||||
public bool SponsorOnly { get; } = false;
|
||||
|
||||
[DataField("borgVoice")]
|
||||
public bool BorgVoice { get; } = false;
|
||||
}
|
||||
Reference in New Issue
Block a user