Esempio n. 1
0
        private static void DecodeHeader(RailPacketIncoming packet, RailBitBuffer buffer)
        {
            // Read: [LocalTick]
            packet.SenderTick = buffer.ReadTick();

            // Read: [LastAckTick]
            packet.LastAckTick = buffer.ReadTick();

            // Read: [AckReliableEventId]
            packet.LastAckEventId = buffer.ReadSequenceId();
        }
Esempio n. 2
0
        /// <summary>
        ///     Note that the packetTick may not be the tick this event was created on
        ///     if we're re-trying to send this event in subsequent packets. This tick
        ///     is intended for use in tick diffs for compression.
        /// </summary>
        public static RailEvent Decode(
            IRailEventConstruction eventCreator,
            RailIntCompressor compressor,
            RailBitBuffer buffer,
            Tick packetTick)
        {
            // Read: [EventType]
            int factoryType = buffer.ReadInt(compressor);

            RailEvent evnt = eventCreator.CreateEvent(factoryType);

            // Read: [EventId]
            evnt.EventId = buffer.ReadSequenceId();

            // Read: [EventData]
            evnt.DataSerializer.ReadData(buffer, packetTick);

            return(evnt);
        }