wip
This commit is contained in:
@@ -60,7 +60,7 @@ namespace Ragon.Client
|
||||
_sceneId = sceneId;
|
||||
}
|
||||
|
||||
internal void Attach(RagonClient client, ushort entityId, ushort entityType, bool hasAuthority, RagonPlayer owner, RagonPayload payload)
|
||||
internal void Attach(RagonClient client, ushort entityId, ushort entityType, bool hasAuthority, RagonPlayer owner)
|
||||
{
|
||||
Type = entityType;
|
||||
Id = entityId;
|
||||
@@ -70,7 +70,6 @@ namespace Ragon.Client
|
||||
HasAuthority = hasAuthority;
|
||||
|
||||
_client = client;
|
||||
_spawnPayload = payload;
|
||||
|
||||
Attached?.Invoke(this);
|
||||
}
|
||||
@@ -96,15 +95,9 @@ namespace Ragon.Client
|
||||
return payload;
|
||||
}
|
||||
|
||||
public void AttachPayload(IRagonPayload? payload)
|
||||
public void AttachPayload(RagonPayload payload)
|
||||
{
|
||||
if (payload == null) return;
|
||||
|
||||
var buffer = new RagonBuffer();
|
||||
payload.Serialize(buffer);
|
||||
|
||||
_spawnPayload = new RagonPayload();
|
||||
_spawnPayload.Read(buffer);
|
||||
_spawnPayload = payload;
|
||||
}
|
||||
|
||||
public T GetAttachPayload<T>() where T : IRagonPayload, new()
|
||||
|
||||
@@ -19,7 +19,7 @@ using Ragon.Protocol;
|
||||
|
||||
namespace Ragon.Client;
|
||||
|
||||
public struct RagonPayload
|
||||
public class RagonPayload
|
||||
{
|
||||
private readonly uint[] _data = new uint[128];
|
||||
private readonly int _size = 0;
|
||||
@@ -32,16 +32,12 @@ public struct RagonPayload
|
||||
|
||||
public void Read(RagonBuffer buffer)
|
||||
{
|
||||
var readOnlySpan = _data.AsSpan();
|
||||
|
||||
buffer.ReadSpan(ref readOnlySpan, _size);
|
||||
buffer.ReadArray(_data, _size);
|
||||
}
|
||||
|
||||
public void Write(RagonBuffer buffer)
|
||||
{
|
||||
ReadOnlySpan<uint> readOnlySpan = _data.AsSpan();
|
||||
|
||||
buffer.WriteSpan(ref readOnlySpan, _size);
|
||||
buffer.WriteArray(_data, _size);
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
|
||||
Reference in New Issue
Block a user