fix: added missing types for new primitives
This commit is contained in:
@@ -0,0 +1,26 @@
|
||||
using LiteNetLib.Utils;
|
||||
|
||||
using Engine.Core;
|
||||
|
||||
namespace Engine.Systems.Network;
|
||||
|
||||
internal static class ColorHSVANetPacker
|
||||
{
|
||||
internal static void Write(NetDataWriter writer, ColorHSVA data)
|
||||
{
|
||||
writer.Put(data.Hue);
|
||||
writer.Put(data.Saturation);
|
||||
writer.Put(data.Value);
|
||||
writer.Put(data.Alpha);
|
||||
}
|
||||
|
||||
internal static ColorHSVA Read(NetDataReader reader)
|
||||
{
|
||||
float hue = reader.GetFloat();
|
||||
float saturation = reader.GetFloat();
|
||||
float value = reader.GetFloat();
|
||||
float alpha = reader.GetFloat();
|
||||
|
||||
return new ColorHSVA(hue, saturation, value, alpha);
|
||||
}
|
||||
}
|
@@ -0,0 +1,22 @@
|
||||
using LiteNetLib.Utils;
|
||||
|
||||
using Engine.Core;
|
||||
|
||||
namespace Engine.Systems.Network;
|
||||
|
||||
internal static class Line3DNetPacker
|
||||
{
|
||||
internal static void Write(NetDataWriter writer, Line3D data)
|
||||
{
|
||||
Vector3DNetPacker.Write(writer, data.From);
|
||||
Vector3DNetPacker.Write(writer, data.To);
|
||||
}
|
||||
|
||||
internal static Line3D Read(NetDataReader reader)
|
||||
{
|
||||
Vector3D from = Vector3DNetPacker.Read(reader);
|
||||
Vector3D to = Vector3DNetPacker.Read(reader);
|
||||
|
||||
return new Line3D(from, to);
|
||||
}
|
||||
}
|
@@ -0,0 +1,22 @@
|
||||
using LiteNetLib.Utils;
|
||||
|
||||
using Engine.Core;
|
||||
|
||||
namespace Engine.Systems.Network;
|
||||
|
||||
internal static class Ray2DNetPacker
|
||||
{
|
||||
internal static void Write(NetDataWriter writer, Ray2D data)
|
||||
{
|
||||
Vector2DNetPacker.Write(writer, data.Origin);
|
||||
Vector2DNetPacker.Write(writer, data.Direction);
|
||||
}
|
||||
|
||||
internal static Ray2D Read(NetDataReader reader)
|
||||
{
|
||||
Vector2D from = Vector2DNetPacker.Read(reader);
|
||||
Vector2D direction = Vector2DNetPacker.Read(reader);
|
||||
|
||||
return new Ray2D(from, direction);
|
||||
}
|
||||
}
|
@@ -0,0 +1,22 @@
|
||||
using LiteNetLib.Utils;
|
||||
|
||||
using Engine.Core;
|
||||
|
||||
namespace Engine.Systems.Network;
|
||||
|
||||
internal static class Ray3DNetPacker
|
||||
{
|
||||
internal static void Write(NetDataWriter writer, Ray3D data)
|
||||
{
|
||||
Vector3DNetPacker.Write(writer, data.Origin);
|
||||
Vector3DNetPacker.Write(writer, data.Direction);
|
||||
}
|
||||
|
||||
internal static Ray3D Read(NetDataReader reader)
|
||||
{
|
||||
Vector3D from = Vector3DNetPacker.Read(reader);
|
||||
Vector3D direction = Vector3DNetPacker.Read(reader);
|
||||
|
||||
return new Ray3D(from, direction);
|
||||
}
|
||||
}
|
@@ -0,0 +1,22 @@
|
||||
using LiteNetLib.Utils;
|
||||
|
||||
using Engine.Core;
|
||||
|
||||
namespace Engine.Systems.Network;
|
||||
|
||||
internal static class Vector2DIntNetPacker
|
||||
{
|
||||
internal static void Write(NetDataWriter writer, Vector2DInt data)
|
||||
{
|
||||
writer.Put(data.X);
|
||||
writer.Put(data.Y);
|
||||
}
|
||||
|
||||
internal static Vector2DInt Read(NetDataReader reader)
|
||||
{
|
||||
int x = reader.GetInt();
|
||||
int y = reader.GetInt();
|
||||
|
||||
return new Vector2DInt(x, y);
|
||||
}
|
||||
}
|
@@ -0,0 +1,24 @@
|
||||
using LiteNetLib.Utils;
|
||||
|
||||
using Engine.Core;
|
||||
|
||||
namespace Engine.Systems.Network;
|
||||
|
||||
internal static class Vector3DIntNetPacker
|
||||
{
|
||||
internal static void Write(NetDataWriter writer, Vector3DInt data)
|
||||
{
|
||||
writer.Put(data.X);
|
||||
writer.Put(data.Y);
|
||||
writer.Put(data.Z);
|
||||
}
|
||||
|
||||
internal static Vector3DInt Read(NetDataReader reader)
|
||||
{
|
||||
int x = reader.GetInt();
|
||||
int y = reader.GetInt();
|
||||
int z = reader.GetInt();
|
||||
|
||||
return new Vector3DInt(x, y, z);
|
||||
}
|
||||
}
|
@@ -0,0 +1,26 @@
|
||||
using LiteNetLib.Utils;
|
||||
|
||||
using Engine.Core;
|
||||
|
||||
namespace Engine.Systems.Network;
|
||||
|
||||
internal static class Vector4DNetPacker
|
||||
{
|
||||
internal static void Write(NetDataWriter writer, Vector4D data)
|
||||
{
|
||||
writer.Put(data.X);
|
||||
writer.Put(data.Y);
|
||||
writer.Put(data.Z);
|
||||
writer.Put(data.W);
|
||||
}
|
||||
|
||||
internal static Vector4D Read(NetDataReader reader)
|
||||
{
|
||||
float x = reader.GetFloat();
|
||||
float y = reader.GetFloat();
|
||||
float z = reader.GetFloat();
|
||||
float w = reader.GetFloat();
|
||||
|
||||
return new Vector4D(x, y, z, w);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user