Beispiel #1
0
 public override void DecodePayload(
     IRailCommandConstruction commandCreator,
     IRailStateConstruction stateCreator,
     RailBitBuffer buffer)
 {
     // Read: [Deltas]
     DecodeDeltas(stateCreator, buffer);
 }
Beispiel #2
0
        public static RailCommandUpdate Create(
            IRailCommandConstruction commandCreator,
            RailEntityClient entity,
            IEnumerable <RailCommand> commands)
        {
            RailCommandUpdate update = commandCreator.CreateCommandUpdate();

            update.Initialize(entity.Id, commands);
            update.Entity = entity;
            return(update);
        }
Beispiel #3
0
        public override void DecodePayload(
            IRailCommandConstruction commandCreator,
            IRailStateConstruction stateCreator,
            RailBitBuffer buffer)
        {
            // Read: [Commands]
            DecodeCommands(commandCreator, buffer);

            // Read: [View]
            DecodeView(buffer);
        }
Beispiel #4
0
        public static RailCommand Decode(
            IRailCommandConstruction commandCreator,
            RailBitBuffer buffer)
        {
            RailCommand command = commandCreator.CreateCommand();

            // Read: [SenderTick]
            command.ClientTick = buffer.ReadTick();

            // Read: [Command Data]
            command.DataSerializer.DecodeData(buffer);

            return(command);
        }
Beispiel #5
0
        public static void Decode(
            this RailPacketIncoming packet,
            IRailCommandConstruction commandCreator,
            IRailStateConstruction stateCreator,
            IRailEventConstruction eventCreator,
            RailBitBuffer buffer)
        {
            // Read: [Header]
            DecodeHeader(packet, buffer);

            // Read: [Events] (Early Pack)
            DecodeEvents(packet, eventCreator, buffer);

            // Read: [Payload]
            packet.DecodePayload(commandCreator, stateCreator, buffer);

            // Read: [Events] (Fill Pack)
            DecodeEvents(packet, eventCreator, buffer);
        }
Beispiel #6
0
        public static RailCommandUpdate Decode(
            IRailCommandConstruction commandCreator,
            RailBitBuffer buffer)
        {
            RailCommandUpdate update = commandCreator.CreateCommandUpdate();

            // Read: [EntityId]
            update.EntityId = buffer.ReadEntityId();

            // Read: [Count]
            int count = (int)buffer.Read(BUFFER_COUNT_BITS);

            // Read: [Commands]
            for (int i = 0; i < count; i++)
            {
                update.commands.Store(RailCommand.Decode(commandCreator, buffer));
            }

            return(update);
        }
Beispiel #7
0
 private void DecodeCommands(IRailCommandConstruction commandCreator, RailBitBuffer buffer)
 {
     commandUpdates.Decode(buffer, buf => RailCommandUpdate.Decode(commandCreator, buf));
 }
Beispiel #8
0
 public abstract void DecodePayload(
     IRailCommandConstruction commandCreator,
     IRailStateConstruction stateCreator,
     RailBitBuffer buffer);