2 using System.Collections.Generic;
14 protected void Write(
IWriteMessage msg, List<NetEntityEvent> eventsToSync, out List<NetEntityEvent> sentEvents,
Client recipient =
null)
19 sentEvents =
new List<NetEntityEvent>();
30 catch (Exception exception)
32 DebugConsole.ThrowError(
"Failed to write an event for the entity \"" + e.
Entity +
"\"", exception);
33 GameAnalyticsManager.AddErrorEventOnce(
"NetEntityEventManager.Write:WriteFailed" + e.
Entity.ToString(),
34 GameAnalyticsManager.ErrorSeverity.Error,
35 "Failed to write an event for the entity \"" + e.
Entity +
"\"\n" + exception.StackTrace.CleanupStackTrace());
53 tempBuffer.WriteVariableUInt32((uint)tempEventBuffer.
LengthBytes);
63 msg.WriteUInt16(eventsToSync[0].ID);
64 msg.WriteByte((
byte)eventCount);
65 msg.WriteBytes(tempBuffer.Buffer, 0, tempBuffer.LengthBytes);
71 void error(
string reason)
72 => DebugConsole.ThrowError($
"Can't create an entity event for {entity} - {reason}.\n{Environment.StackTrace.CleanupStackTrace()}");
74 if (entity is
Entity { Removed: var removed, IdFreed: var idFreed })
78 error(
"the entity has been removed");
83 error(
"the ID of the entity has been freed");
89 error($
"input is not of type {nameof(Entity)}");
const ushort NullEntityID
abstract void WriteEvent(IWriteMessage buffer, NetEntityEvent entityEvent, Client recipient=null)
const int MaxEventBufferLength
void Write(IWriteMessage msg, List< NetEntityEvent > eventsToSync, out List< NetEntityEvent > sentEvents, Client recipient=null)
Write the events to the outgoing message. The recipient parameter is only needed for ServerEntityEven...
static bool ValidateEntity(INetSerializable entity)