Exemple #1
0
 public static void Decode(
     this RailPacketIncoming packet,
     RailResource resource,
     RailBitBuffer buffer)
 {
     packet.Decode(resource, resource, resource, buffer);
 }
Exemple #2
0
        private void OnPayloadReceived(IRailNetPeer peer, ArraySegment <byte> buffer)
        {
            try
            {
                RailBitBuffer bitBuffer = interpreter.LoadData(buffer);
                reusableIncoming.Reset();
                reusableIncoming.Decode(Resource, bitBuffer);

                if (bitBuffer.IsFinished)
                {
                    ProcessPacket(reusableIncoming, LocalTick);
                }
                else
                {
                    RailDebug.LogError("Bad packet read, discarding...");
                }
            }
            catch (Exception e)
            {
                RailDebug.LogError("Error during packet read: " + e);
            }
        }