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

23 lines
420 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-12-02 21:23:01 +00:00
public class EnumMessage<T> : PlayerMessage
{
public T Value;
2020-11-01 12:11:36 +00:00
2020-12-02 21:23:01 +00:00
public override void Deserialize(NetworkReader reader)
{
base.Deserialize(reader);
Value = (T)(object)reader.ReadInt32();
}
2020-11-01 12:11:36 +00:00
2020-12-02 21:23:01 +00:00
public override void Serialize(NetworkWriter writer)
{
base.Serialize(writer);
writer.Write((int)(object)Value);
}
}
2020-11-10 09:05:27 +00:00
}