quantum-space-buddies/QSB/ConversationSync/Messages/EnterRemoteDialogueMessage.cs
2021-12-26 18:55:54 -08:00

35 lines
951 B
C#

using QSB.ConversationSync.WorldObjects;
using QSB.Messaging;
using QuantumUNET.Transport;
namespace QSB.ConversationSync.Messages
{
internal class EnterRemoteDialogueMessage : QSBWorldObjectMessage<QSBRemoteDialogueTrigger>
{
private int ActivatedDialogueIndex;
private int ListDialoguesIndex;
public EnterRemoteDialogueMessage(int activatedIndex, int listIndex)
{
ActivatedDialogueIndex = activatedIndex;
ListDialoguesIndex = listIndex;
}
public override void Serialize(QNetworkWriter writer)
{
base.Serialize(writer);
writer.Write(ActivatedDialogueIndex);
writer.Write(ListDialoguesIndex);
}
public override void Deserialize(QNetworkReader reader)
{
base.Deserialize(reader);
ActivatedDialogueIndex = reader.ReadInt32();
ListDialoguesIndex = reader.ReadInt32();
}
public override void OnReceiveRemote()
=> WorldObject.RemoteEnterDialogue(ActivatedDialogueIndex, ListDialoguesIndex);
}
}