private void BakeVarSize(SyncableVariable var, Action <SyncableVariable, NetworkWriter> registerMethod) { dummyWriter.Reset(); registerMethod.Invoke(var, dummyWriter); _varSizes[var.GetIndex()] = dummyWriter.Length; }
public void TearDown() { TearDownTestObjects(); ownerWriter.Reset(); observersWriter.Reset(); reader.Dispose(); }
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); }
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}"); }
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; }
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(); }
public void TearDown() { reader.Dispose(); writer.Reset(); TearDownTestObjects(); }
public void TearDown() { ownerWriter.Reset(); observersWriter.Reset(); reader.Dispose(); }