перенос общих файлов из папки White в _White

This commit is contained in:
Remuchi
2024-01-28 18:37:24 +07:00
parent 1e4ad59270
commit 3a08b81d53
370 changed files with 805 additions and 812 deletions

View 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);
}
}

View 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;
}
}

View 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;
}
}

View 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;
}
}

View 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;
}
}
}

View 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;
}