diff --git a/Ragon.Client/Ragon.Client.csproj b/Ragon.Client/Ragon.Client.csproj index 8bc8504..0bfeac8 100644 --- a/Ragon.Client/Ragon.Client.csproj +++ b/Ragon.Client/Ragon.Client.csproj @@ -12,11 +12,11 @@ true none - /Users/edmand46/UnityProjects/itd-client/Assets/Ragon/Runtime/Plugins/ + - /Users/edmand46/RagonProjects/ragon-oss-examples/Assets/Ragon/Plugins/ + diff --git a/Ragon.Protocol/Sources/RagonBuffer.cs b/Ragon.Protocol/Sources/RagonBuffer.cs index c4be53f..6b3e431 100644 --- a/Ragon.Protocol/Sources/RagonBuffer.cs +++ b/Ragon.Protocol/Sources/RagonBuffer.cs @@ -1,5 +1,5 @@ /* - * Copyright 2023 Eduard Kargin + * Copyright 2023-2024 Eduard Kargin * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -121,6 +121,21 @@ namespace Ragon.Protocol return (RagonOperation)Read(8); } + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public void WriteFloat(float value) + { + var bytes = BitConverter.GetBytes(value); + WriteBytes(bytes); + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public float ReadFloat() + { + var bytes = ReadBytes(4); + var value = BitConverter.ToSingle(bytes, 0); + return value; + } + [MethodImpl(MethodImplOptions.AggressiveInlining)] public void WriteFloat(float value, float min, float max, float precision) { @@ -147,6 +162,23 @@ namespace Ragon.Protocol return adjusted; } + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public void WriteInt(int value) + { + var bytes = BitConverter.GetBytes(value); + + WriteBytes(bytes); + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public int ReadInt() + { + var bytes = ReadBytes(4); + var value = BitConverter.ToInt32(bytes, 0); + + return value; + } + [MethodImpl(MethodImplOptions.AggressiveInlining)] public void WriteInt(int value, int min, int max) { @@ -281,10 +313,10 @@ namespace Ragon.Protocol [MethodImpl(MethodImplOptions.AggressiveInlining)] [Obsolete("Do not use this method, will be removed")] - public byte[] ReadBytes(int lenght) + public byte[] ReadBytes(int len) { - var data = new byte[lenght]; - for (int i = 0; i < lenght; i++) + var data = new byte[len]; + for (int i = 0; i < len; i++) data[i] = (byte)Read(8); return data; diff --git a/Ragon.Relay/Ragon.Relay.csproj b/Ragon.Relay/Ragon.Relay.csproj index d03597f..0d2ae79 100644 --- a/Ragon.Relay/Ragon.Relay.csproj +++ b/Ragon.Relay/Ragon.Relay.csproj @@ -3,7 +3,7 @@ Exe Ragon.Relay - net7.0 + net7.0;net8.0