Пример #1
0
 /// <summary>
 /// Writes as many events as possible up to maxSize and returns the number
 /// of events written in the batch. Also increments the total counter.
 /// </summary>
 private void EncodeEvents(
     RailBitBuffer buffer,
     int maxSize)
 {
     this.eventsWritten +=
         buffer.PackToSize(
             maxSize,
             RailConfig.MAXSIZE_EVENT,
             this.GetNextEvents(),
             (evnt) => evnt.Encode(buffer, this.senderTick),
             (evnt) => evnt.RegisterSent());
 }
Пример #2
0
 public void Encode(
     RailBitBuffer buffer,
     int maxTotalSize,
     int maxIndividualSize,
     Action <T> encode)
 {
     buffer.PackToSize(
         maxTotalSize,
         maxIndividualSize,
         this.pending,
         encode,
         (val) => this.sent.Add(val));
 }
Пример #3
0
        protected void EncodeView(RailBitBuffer buffer, int reservedBytes)
        {
            buffer.PackToSize(
                RailConfig.PACKCAP_MESSAGE_TOTAL - reservedBytes,
                int.MaxValue,
                this.view.GetOrdered(),
                (pair) =>
            {
                buffer.WriteEntityId(pair.Key);        // Write: [EntityId]
                buffer.WriteTick(pair.Value.Tick);     // Write: [Tick]
                buffer.WriteBool(pair.Value.IsFrozen); // Write: [IsFrozen]
            });
#endif
        }