refactor: allow set roomId from client, added base room parameters

This commit is contained in:
2022-07-30 16:02:53 +04:00
parent 16b8d3a062
commit 85336f998e
5 changed files with 97 additions and 21 deletions
@@ -0,0 +1,25 @@
using NetStack.Serialization;
namespace Ragon.Common
{
public class RagonRoomParameters: IRagonSerializable
{
public string Map { get; set; }
public int Min { get; set; }
public int Max { get; set; }
public void Serialize(BitBuffer buffer)
{
buffer.AddString(Map);
buffer.AddInt(Min);
buffer.AddInt(Max);
}
public void Deserialize(BitBuffer buffer)
{
Map = buffer.ReadString();
Min = buffer.ReadInt();
Max = buffer.ReadInt();
}
}
}
+18
View File
@@ -38,6 +38,24 @@ namespace Ragon.Common
return value;
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void WriteBool(bool value)
{
ResizeIfNeed(1);
_data[_offset] = value ? (byte) 1 : (byte) 0;
_offset += 1;
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public bool ReadBool()
{
var value = _data[_offset];
_offset += 1;
return value == 1;
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void WriteInt(int value)
{