예제 #1
0
        public void TestWriteReadValuesAndUpdateExtensive()
        {
            var writer = new BitStream(2048);
            var src = new DE();
            _dynamicEntityFactoryBase.Write(writer, src);
            var buffer = writer.GetBuffer();

            var reader = new BitStream(buffer);
            var dest = (DE)_dynamicEntityFactoryBase.Read(reader);

            Assert.AreEqual(src.Position, dest.Position);
            Assert.AreEqual(src.Size, dest.Size);
            Assert.AreEqual(src.Velocity, dest.Velocity);
            Assert.AreEqual(src.Weight, dest.Weight);
            Assert.AreEqual(src.MapEntityIndex, dest.MapEntityIndex);
            Assert.AreEqual(src.Center, dest.Center);

            Assert.AreEqual(src.A, dest.A);
            Assert.AreEqual(src.B, dest.B);
            Assert.AreEqual(src.C, dest.C);
            Assert.AreEqual(src.D, dest.D);
            Assert.AreEqual(src.E, dest.E);
            Assert.AreEqual(src.F, dest.F);
            Assert.AreEqual(src.G, dest.G);
            Assert.AreEqual(src.H, dest.H);
            Assert.AreEqual(src.I, dest.I);
            Assert.AreEqual(src.J, dest.J);
            Assert.AreEqual(src.K, dest.K);
            Assert.AreEqual(src.L, dest.L);
            Assert.AreEqual(src.M, dest.M);
            Assert.AreEqual(src.N, dest.N);
            Assert.AreEqual(src.O, dest.O);
            Assert.AreEqual(src.P, dest.P);
            Assert.AreEqual(src.Q, dest.Q);
            Assert.AreEqual(src.R, dest.R);

            src.A = false;
            src.D = 100;
            src.K = 5123;
            src.N = "asfdoiuweroijsadf";
            src.P = Alignment.Left;
            src.M = new GrhIndex(10091);
            src.L = new Vector2(213, 123);

            writer = new BitStream(2048);
            src.Serialize(writer);

            buffer = writer.GetBuffer();

            reader = new BitStream(buffer);
            dest.Deserialize(reader);

            Assert.AreEqual(src.Position, dest.Position);
            Assert.AreEqual(src.Size, dest.Size);
            Assert.AreEqual(src.Velocity, dest.Velocity);
            Assert.AreEqual(src.Weight, dest.Weight);
            Assert.AreEqual(src.MapEntityIndex, dest.MapEntityIndex);
            Assert.AreEqual(src.Center, dest.Center);

            Assert.AreEqual(src.A, dest.A);
            Assert.AreEqual(src.B, dest.B);
            Assert.AreEqual(src.C, dest.C);
            Assert.AreEqual(src.D, dest.D);
            Assert.AreEqual(src.E, dest.E);
            Assert.AreEqual(src.F, dest.F);
            Assert.AreEqual(src.G, dest.G);
            Assert.AreEqual(src.H, dest.H);
            Assert.AreEqual(src.I, dest.I);
            Assert.AreEqual(src.J, dest.J);
            Assert.AreEqual(src.K, dest.K);
            Assert.AreEqual(src.L, dest.L);
            Assert.AreEqual(src.M, dest.M);
            Assert.AreEqual(src.N, dest.N);
            Assert.AreEqual(src.O, dest.O);
            Assert.AreEqual(src.P, dest.P);
            Assert.AreEqual(src.Q, dest.Q);
            Assert.AreEqual(src.R, dest.R);
        }
예제 #2
0
        public void TestWriteReadValuesAndUpdateExtensive()
        {
            var writer = new BitStream(2048);
            var src    = new DE();

            _dynamicEntityFactoryBase.Write(writer, src);
            var buffer = writer.GetBuffer();

            var reader = new BitStream(buffer);
            var dest   = (DE)_dynamicEntityFactoryBase.Read(reader);

            Assert.AreEqual(src.Position, dest.Position);
            Assert.AreEqual(src.Size, dest.Size);
            Assert.AreEqual(src.Velocity, dest.Velocity);
            Assert.AreEqual(src.Weight, dest.Weight);
            Assert.AreEqual(src.MapEntityIndex, dest.MapEntityIndex);
            Assert.AreEqual(src.Center, dest.Center);

            Assert.AreEqual(src.A, dest.A);
            Assert.AreEqual(src.B, dest.B);
            Assert.AreEqual(src.C, dest.C);
            Assert.AreEqual(src.D, dest.D);
            Assert.AreEqual(src.E, dest.E);
            Assert.AreEqual(src.F, dest.F);
            Assert.AreEqual(src.G, dest.G);
            Assert.AreEqual(src.H, dest.H);
            Assert.AreEqual(src.I, dest.I);
            Assert.AreEqual(src.J, dest.J);
            Assert.AreEqual(src.K, dest.K);
            Assert.AreEqual(src.L, dest.L);
            Assert.AreEqual(src.M, dest.M);
            Assert.AreEqual(src.N, dest.N);
            Assert.AreEqual(src.O, dest.O);
            Assert.AreEqual(src.P, dest.P);
            Assert.AreEqual(src.Q, dest.Q);
            Assert.AreEqual(src.R, dest.R);

            src.A = false;
            src.D = 100;
            src.K = 5123;
            src.N = "asfdoiuweroijsadf";
            src.P = Alignment.Left;
            src.M = new GrhIndex(10091);
            src.L = new Vector2(213, 123);

            writer = new BitStream(2048);
            src.Serialize(writer);

            buffer = writer.GetBuffer();

            reader = new BitStream(buffer);
            dest.Deserialize(reader);

            Assert.AreEqual(src.Position, dest.Position);
            Assert.AreEqual(src.Size, dest.Size);
            Assert.AreEqual(src.Velocity, dest.Velocity);
            Assert.AreEqual(src.Weight, dest.Weight);
            Assert.AreEqual(src.MapEntityIndex, dest.MapEntityIndex);
            Assert.AreEqual(src.Center, dest.Center);

            Assert.AreEqual(src.A, dest.A);
            Assert.AreEqual(src.B, dest.B);
            Assert.AreEqual(src.C, dest.C);
            Assert.AreEqual(src.D, dest.D);
            Assert.AreEqual(src.E, dest.E);
            Assert.AreEqual(src.F, dest.F);
            Assert.AreEqual(src.G, dest.G);
            Assert.AreEqual(src.H, dest.H);
            Assert.AreEqual(src.I, dest.I);
            Assert.AreEqual(src.J, dest.J);
            Assert.AreEqual(src.K, dest.K);
            Assert.AreEqual(src.L, dest.L);
            Assert.AreEqual(src.M, dest.M);
            Assert.AreEqual(src.N, dest.N);
            Assert.AreEqual(src.O, dest.O);
            Assert.AreEqual(src.P, dest.P);
            Assert.AreEqual(src.Q, dest.Q);
            Assert.AreEqual(src.R, dest.R);
        }
예제 #3
0
        public void TestSkipNonSyncNetworkValues()
        {
            var writer = new BitStream(2048);
            var src = new DE { SkipA = 1, SkipB = 2, SkipC = 3 };
            _dynamicEntityFactoryBase.Write(writer, src);
            var buffer = writer.GetBuffer();

            var reader = new BitStream(buffer);
            var dest = (DE)_dynamicEntityFactoryBase.Read(reader);

            Assert.AreEqual(src.Position, dest.Position);
            Assert.AreEqual(src.Size, dest.Size);
            Assert.AreEqual(src.Velocity, dest.Velocity);
            Assert.AreEqual(src.Weight, dest.Weight);
            Assert.AreEqual(src.MapEntityIndex, dest.MapEntityIndex);
            Assert.AreEqual(src.Center, dest.Center);

            Assert.AreEqual(src.A, dest.A);
            Assert.AreEqual(src.B, dest.B);
            Assert.AreEqual(src.C, dest.C);
            Assert.AreEqual(src.D, dest.D);
            Assert.AreEqual(src.E, dest.E);
            Assert.AreEqual(src.F, dest.F);
            Assert.AreEqual(src.G, dest.G);
            Assert.AreEqual(src.H, dest.H);
            Assert.AreEqual(src.I, dest.I);
            Assert.AreEqual(src.J, dest.J);
            Assert.AreEqual(src.K, dest.K);
            Assert.AreEqual(src.L, dest.L);
            Assert.AreEqual(src.M, dest.M);
            Assert.AreEqual(src.N, dest.N);
            Assert.AreEqual(src.O, dest.O);
            Assert.AreEqual(src.P, dest.P);
            Assert.AreEqual(src.Q, dest.Q);
            Assert.AreEqual(src.R, dest.R);

            Assert.AreNotEqual(src.SkipA, dest.SkipA);
            Assert.AreNotEqual(src.SkipB, dest.SkipB);
            Assert.AreEqual(src.SkipC, dest.SkipC);

            src.A = false;
            src.D = 100;
            src.K = 5123;
            src.N = "asfdoiuweroijsadf";
            src.P = Alignment.Left;
            src.M = new GrhIndex(10091);
            src.L = new Vector2(213, 123);
            src.Q = new Vector3(123, 412, 1931);
            src.R = new Vector4(109, 12, 190, 51);

            writer = new BitStream(2048);
            src.Serialize(writer);

            buffer = writer.GetBuffer();

            reader = new BitStream(buffer);
            dest.Deserialize(reader);

            Assert.AreEqual(src.Position, dest.Position);
            Assert.AreEqual(src.Size, dest.Size);
            Assert.AreEqual(src.Velocity, dest.Velocity);
            Assert.AreEqual(src.Weight, dest.Weight);
            Assert.AreEqual(src.MapEntityIndex, dest.MapEntityIndex);
            Assert.AreEqual(src.Center, dest.Center);

            Assert.AreEqual(src.A, dest.A);
            Assert.AreEqual(src.B, dest.B);
            Assert.AreEqual(src.C, dest.C);
            Assert.AreEqual(src.D, dest.D);
            Assert.AreEqual(src.E, dest.E);
            Assert.AreEqual(src.F, dest.F);
            Assert.AreEqual(src.G, dest.G);
            Assert.AreEqual(src.H, dest.H);
            Assert.AreEqual(src.I, dest.I);
            Assert.AreEqual(src.J, dest.J);
            Assert.AreEqual(src.K, dest.K);
            Assert.AreEqual(src.L, dest.L);
            Assert.AreEqual(src.M, dest.M);
            Assert.AreEqual(src.N, dest.N);
            Assert.AreEqual(src.O, dest.O);
            Assert.AreEqual(src.P, dest.P);
            Assert.AreEqual(src.Q, dest.Q);
            Assert.AreEqual(src.R, dest.R);

            Assert.AreNotEqual(src.SkipA, dest.SkipA);
            Assert.AreNotEqual(src.SkipB, dest.SkipB);
            Assert.AreEqual(src.SkipC, dest.SkipC);
        }
예제 #4
0
        public void TestSkipNonSyncNetworkValues()
        {
            var writer = new BitStream(2048);
            var src    = new DE {
                SkipA = 1, SkipB = 2, SkipC = 3
            };

            _dynamicEntityFactoryBase.Write(writer, src);
            var buffer = writer.GetBuffer();

            var reader = new BitStream(buffer);
            var dest   = (DE)_dynamicEntityFactoryBase.Read(reader);

            Assert.AreEqual(src.Position, dest.Position);
            Assert.AreEqual(src.Size, dest.Size);
            Assert.AreEqual(src.Velocity, dest.Velocity);
            Assert.AreEqual(src.Weight, dest.Weight);
            Assert.AreEqual(src.MapEntityIndex, dest.MapEntityIndex);
            Assert.AreEqual(src.Center, dest.Center);

            Assert.AreEqual(src.A, dest.A);
            Assert.AreEqual(src.B, dest.B);
            Assert.AreEqual(src.C, dest.C);
            Assert.AreEqual(src.D, dest.D);
            Assert.AreEqual(src.E, dest.E);
            Assert.AreEqual(src.F, dest.F);
            Assert.AreEqual(src.G, dest.G);
            Assert.AreEqual(src.H, dest.H);
            Assert.AreEqual(src.I, dest.I);
            Assert.AreEqual(src.J, dest.J);
            Assert.AreEqual(src.K, dest.K);
            Assert.AreEqual(src.L, dest.L);
            Assert.AreEqual(src.M, dest.M);
            Assert.AreEqual(src.N, dest.N);
            Assert.AreEqual(src.O, dest.O);
            Assert.AreEqual(src.P, dest.P);
            Assert.AreEqual(src.Q, dest.Q);
            Assert.AreEqual(src.R, dest.R);

            Assert.AreNotEqual(src.SkipA, dest.SkipA);
            Assert.AreNotEqual(src.SkipB, dest.SkipB);
            Assert.AreEqual(src.SkipC, dest.SkipC);

            src.A = false;
            src.D = 100;
            src.K = 5123;
            src.N = "asfdoiuweroijsadf";
            src.P = Alignment.Left;
            src.M = new GrhIndex(10091);
            src.L = new Vector2(213, 123);
            src.Q = new Vector3(123, 412, 1931);
            src.R = new Vector4(109, 12, 190, 51);

            writer = new BitStream(2048);
            src.Serialize(writer);

            buffer = writer.GetBuffer();

            reader = new BitStream(buffer);
            dest.Deserialize(reader);

            Assert.AreEqual(src.Position, dest.Position);
            Assert.AreEqual(src.Size, dest.Size);
            Assert.AreEqual(src.Velocity, dest.Velocity);
            Assert.AreEqual(src.Weight, dest.Weight);
            Assert.AreEqual(src.MapEntityIndex, dest.MapEntityIndex);
            Assert.AreEqual(src.Center, dest.Center);

            Assert.AreEqual(src.A, dest.A);
            Assert.AreEqual(src.B, dest.B);
            Assert.AreEqual(src.C, dest.C);
            Assert.AreEqual(src.D, dest.D);
            Assert.AreEqual(src.E, dest.E);
            Assert.AreEqual(src.F, dest.F);
            Assert.AreEqual(src.G, dest.G);
            Assert.AreEqual(src.H, dest.H);
            Assert.AreEqual(src.I, dest.I);
            Assert.AreEqual(src.J, dest.J);
            Assert.AreEqual(src.K, dest.K);
            Assert.AreEqual(src.L, dest.L);
            Assert.AreEqual(src.M, dest.M);
            Assert.AreEqual(src.N, dest.N);
            Assert.AreEqual(src.O, dest.O);
            Assert.AreEqual(src.P, dest.P);
            Assert.AreEqual(src.Q, dest.Q);
            Assert.AreEqual(src.R, dest.R);

            Assert.AreNotEqual(src.SkipA, dest.SkipA);
            Assert.AreNotEqual(src.SkipB, dest.SkipB);
            Assert.AreEqual(src.SkipC, dest.SkipC);
        }