2021-12-24 21:39:32 -08:00
|
|
|
|
using QSB.Messaging;
|
|
|
|
|
using QSB.Tools.TranslatorTool.TranslationSync.WorldObjects;
|
|
|
|
|
using QSB.WorldSync;
|
2020-12-31 12:10:55 +00:00
|
|
|
|
using QuantumUNET.Transport;
|
|
|
|
|
|
2021-12-23 16:26:31 -08:00
|
|
|
|
namespace QSB.Tools.TranslatorTool.TranslationSync.Messages
|
2020-12-31 12:10:55 +00:00
|
|
|
|
{
|
2021-12-25 16:58:41 -08:00
|
|
|
|
internal abstract class SetAsTranslatedMessage<T> : QSBWorldObjectMessage<T> where T : IWorldObject
|
2020-12-31 12:10:55 +00:00
|
|
|
|
{
|
2021-12-24 21:39:32 -08:00
|
|
|
|
protected int TextId;
|
2020-12-31 12:10:55 +00:00
|
|
|
|
|
|
|
|
|
public override void Serialize(QNetworkWriter writer)
|
|
|
|
|
{
|
|
|
|
|
base.Serialize(writer);
|
|
|
|
|
writer.Write(TextId);
|
|
|
|
|
}
|
2021-12-25 18:57:20 -08:00
|
|
|
|
|
|
|
|
|
public override void Deserialize(QNetworkReader reader)
|
|
|
|
|
{
|
|
|
|
|
base.Deserialize(reader);
|
|
|
|
|
TextId = reader.ReadInt32();
|
|
|
|
|
}
|
2020-12-31 12:10:55 +00:00
|
|
|
|
}
|
2021-12-24 21:39:32 -08:00
|
|
|
|
|
|
|
|
|
internal class WallTextTranslatedMessage : SetAsTranslatedMessage<QSBWallText>
|
|
|
|
|
{
|
|
|
|
|
public WallTextTranslatedMessage(int textId) => TextId = textId;
|
|
|
|
|
public override void OnReceiveRemote() => WorldObject.HandleSetAsTranslated(TextId);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
internal class ComputerTranslatedMessage : SetAsTranslatedMessage<QSBComputer>
|
|
|
|
|
{
|
|
|
|
|
public ComputerTranslatedMessage(int textId) => TextId = textId;
|
|
|
|
|
public override void OnReceiveRemote() => WorldObject.HandleSetAsTranslated(TextId);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
internal class VesselComputerTranslatedMessage : SetAsTranslatedMessage<QSBVesselComputer>
|
|
|
|
|
{
|
|
|
|
|
public VesselComputerTranslatedMessage(int textId) => TextId = textId;
|
|
|
|
|
public override void OnReceiveRemote() => WorldObject.HandleSetAsTranslated(TextId);
|
|
|
|
|
}
|
|
|
|
|
}
|