mirror of
https://github.com/MirrorNetworking/Mirror.git
synced 2024-11-17 18:40:33 +00:00
Vector3Half reader/writer
This commit is contained in:
parent
c36feeb0fe
commit
cb6a7812f5
@ -63,6 +63,13 @@ public static class NetworkReaderExtensions
|
|||||||
public static decimal? ReadDecimalNullable(this NetworkReader reader) => reader.ReadBlittableNullable<decimal>();
|
public static decimal? ReadDecimalNullable(this NetworkReader reader) => reader.ReadBlittableNullable<decimal>();
|
||||||
|
|
||||||
public static Half ReadHalf(this NetworkReader reader) => new Half(reader.ReadUShort());
|
public static Half ReadHalf(this NetworkReader reader) => new Half(reader.ReadUShort());
|
||||||
|
public static Vector3Half ReadVector3Half(this NetworkReader reader)
|
||||||
|
{
|
||||||
|
Half x = reader.ReadHalf();
|
||||||
|
Half y = reader.ReadHalf();
|
||||||
|
Half z = reader.ReadHalf();
|
||||||
|
return new Vector3Half(x, y, z);
|
||||||
|
}
|
||||||
|
|
||||||
/// <exception cref="T:System.ArgumentException">if an invalid utf8 string is sent</exception>
|
/// <exception cref="T:System.ArgumentException">if an invalid utf8 string is sent</exception>
|
||||||
public static string ReadString(this NetworkReader reader)
|
public static string ReadString(this NetworkReader reader)
|
||||||
|
@ -58,6 +58,12 @@ public static class NetworkWriterExtensions
|
|||||||
public static void WriteDecimalNullable(this NetworkWriter writer, decimal? value) => writer.WriteBlittableNullable(value);
|
public static void WriteDecimalNullable(this NetworkWriter writer, decimal? value) => writer.WriteBlittableNullable(value);
|
||||||
|
|
||||||
public static void WriteHalf(this NetworkWriter writer, Half value) => writer.WriteUShort(value._value);
|
public static void WriteHalf(this NetworkWriter writer, Half value) => writer.WriteUShort(value._value);
|
||||||
|
public static void WriteVector3Half(this NetworkWriter writer, Vector3Half value)
|
||||||
|
{
|
||||||
|
writer.WriteHalf(value.x);
|
||||||
|
writer.WriteHalf(value.y);
|
||||||
|
writer.WriteHalf(value.z);
|
||||||
|
}
|
||||||
|
|
||||||
public static void WriteString(this NetworkWriter writer, string value)
|
public static void WriteString(this NetworkWriter writer, string value)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user