Clean up
This commit is contained in:
@ -5,24 +5,32 @@ namespace RageCoop.Core
|
||||
{
|
||||
internal static class PacketExtensions
|
||||
{
|
||||
internal static bool IsSyncEvent(this PacketType p)
|
||||
{
|
||||
return 30 <= (byte)p && (byte)p <= 40;
|
||||
}
|
||||
|
||||
#region MESSAGE-READ
|
||||
|
||||
public static Vector3 ReadVector3(this NetIncomingMessage m)
|
||||
{
|
||||
return new Vector3
|
||||
{
|
||||
X = m.ReadFloat(),
|
||||
Y = m.ReadFloat(),
|
||||
Z = m.ReadFloat(),
|
||||
Z = m.ReadFloat()
|
||||
};
|
||||
}
|
||||
|
||||
public static Vector2 ReadVector2(this NetIncomingMessage m)
|
||||
{
|
||||
return new Vector2
|
||||
{
|
||||
X = m.ReadFloat(),
|
||||
Y = m.ReadFloat(),
|
||||
Y = m.ReadFloat()
|
||||
};
|
||||
}
|
||||
|
||||
public static Quaternion ReadQuaternion(this NetIncomingMessage m)
|
||||
{
|
||||
return new Quaternion
|
||||
@ -30,22 +38,26 @@ namespace RageCoop.Core
|
||||
X = m.ReadFloat(),
|
||||
Y = m.ReadFloat(),
|
||||
Z = m.ReadFloat(),
|
||||
W = m.ReadFloat(),
|
||||
W = m.ReadFloat()
|
||||
};
|
||||
}
|
||||
|
||||
public static byte[] ReadByteArray(this NetIncomingMessage m)
|
||||
{
|
||||
return m.ReadBytes(m.ReadInt32());
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region MESSAGE-WRITE
|
||||
|
||||
public static void Write(this NetOutgoingMessage m, Vector3 v)
|
||||
{
|
||||
m.Write(v.X);
|
||||
m.Write(v.Y);
|
||||
m.Write(v.Z);
|
||||
}
|
||||
|
||||
public static void Write(this NetOutgoingMessage m, Quaternion q)
|
||||
{
|
||||
m.Write(q.X);
|
||||
@ -53,16 +65,13 @@ namespace RageCoop.Core
|
||||
m.Write(q.Z);
|
||||
m.Write(q.W);
|
||||
}
|
||||
|
||||
public static void WriteByteArray(this NetOutgoingMessage m, byte[] b)
|
||||
{
|
||||
m.Write(b.Length);
|
||||
m.Write(b);
|
||||
}
|
||||
#endregion
|
||||
|
||||
internal static bool IsSyncEvent(this PacketType p)
|
||||
{
|
||||
return (30 <= (byte)p) && ((byte)p <= 40);
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user