42 lines
1.3 KiB
C#
Raw Normal View History

2021-12-24 21:39:32 -08:00
using QSB.Messaging;
using QSB.Tools.TranslatorTool.TranslationSync.WorldObjects;
using QSB.WorldSync;
using QuantumUNET.Transport;
namespace QSB.Tools.TranslatorTool.TranslationSync.Messages
{
2021-12-25 16:58:41 -08:00
internal abstract class SetAsTranslatedMessage<T> : QSBWorldObjectMessage<T> where T : IWorldObject
{
2021-12-24 21:39:32 -08:00
protected int TextId;
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();
}
}
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);
}
}