private void BakeVarSize(SyncableVariable var, Action <SyncableVariable, NetworkWriter> registerMethod)
        {
            dummyWriter.Reset();
            registerMethod.Invoke(var, dummyWriter);

            _varSizes[var.GetIndex()] = dummyWriter.Length;
        }
Example #2
0
        public void TearDown()
        {
            TearDownTestObjects();

            ownerWriter.Reset();
            observersWriter.Reset();
            reader.Dispose();
        }
Example #3
0
        private void SyncValuesWithClient()
        {
            ownerWriter.Reset();
            observersWriter.Reset();

            netIdServer.OnSerializeAll(true, ownerWriter, observersWriter);

            // apply all the data from the server object

            reader.Reset(ownerWriter.ToArraySegment());
            netIdClient.OnDeserializeAll(reader, true);
        }
Example #4
0
        public static void SerializeAllTo <T>(T fromList, T toList) where T : ISyncObject
        {
            writer.Reset();
            fromList.OnSerializeAll(writer);

            reader.Reset(writer.ToArray());
            toList.OnDeserializeAll(reader);

            var writeLength = writer.ByteLength;
            var readLength  = reader.BytePosition;

            Assert.That(writeLength == readLength, $"OnSerializeAll and OnDeserializeAll calls write the same amount of data\n    writeLength={writeLength}\n    readLength={readLength}");
        }
Example #5
0
 public void TearDown()
 {
     // we have to clear these each time so that capactity doesn't effect other tests
     writer.Reset();
     writer = null;
     reader.Dispose();
     reader = null;
 }
Example #6
0
        public void TestResetSetsPotionAndLength()
        {
            writer.WriteString("I saw");
            writer.WriteInt64(0xA_FADED_DEAD_EEL);
            writer.WriteString("and ate it");
            writer.Reset();

            Assert.That(writer.Position, Is.EqualTo(0));
            Assert.That(writer.Length, Is.EqualTo(0));

            byte[] data = writer.ToArray();
            Assert.That(data, Is.Empty);
        }
 public void TearDown()
 {
     writer.Reset();
     reader.Dispose();
 }
Example #8
0
 public void TearDown()
 {
     reader.Dispose();
     writer.Reset();
     TearDownTestObjects();
 }
Example #9
0
 public void TearDown()
 {
     ownerWriter.Reset();
     observersWriter.Reset();
     reader.Dispose();
 }