quantum-space-buddies/QSB/MessagesCore/EnumMessage.cs

23 lines
507 B
C#
Raw Normal View History

2020-11-01 12:11:36 +00:00
using QSB.Messaging;
using UnityEngine.Networking;
2020-11-10 09:05:27 +00:00
namespace QSB.MessagesCore
2020-11-01 12:11:36 +00:00
{
2020-11-10 09:05:27 +00:00
public class EnumMessage<T> : PlayerMessage
2020-11-01 12:11:36 +00:00
{
2020-11-10 09:05:27 +00:00
public T Value;
2020-11-01 12:11:36 +00:00
public override void Deserialize(NetworkReader reader)
{
base.Deserialize(reader);
2020-11-10 09:05:27 +00:00
Value = (T)(object)reader.ReadInt32();
2020-11-01 12:11:36 +00:00
}
public override void Serialize(NetworkWriter writer)
{
base.Serialize(writer);
2020-11-10 09:05:27 +00:00
writer.Write((int)(object)Value);
2020-11-01 12:11:36 +00:00
}
}
2020-11-10 09:05:27 +00:00
}