public static void DebugBytes(string name, byte[] bytes, List <NetworkEvent> eventLookup) { var outputTxt = ""; outputTxt += $"{debugCount} {name}\n"; debugCount++; if (eventLookup == null) { outputTxt = "\tNo event lookup\n"; } else { debugBitStreamReader.Encapsulate(bytes); int index = 0; debugBitStreamReader.Serialize(ref index); if (index < 0 || index >= eventLookup.Count) { outputTxt += $"\tReceived invalid event index: {index} out of {eventLookup.Count}\n"; } else { outputTxt += eventLookup[index].GetDebugRPCString(debugBitStreamReader); } } Log.WriteLine(outputTxt); }
void ReceiveRPC(byte[] bytes, List <NetworkEvent> eventLookup, NetworkMessageInfo info) { bitStreamReader.Encapsulate(bytes); int index = 0; bitStreamReader.Serialize(ref index); if (index < 0 || index >= eventLookup.Count) { Log.WriteLine($"Received invalid event index: {index} out of {eventLookup.Count}"); } eventLookup[index].ReceiveRPC(bitStreamReader, info); }