Exemplo n.º 1
0
        public void PropertyCanReadStructVectorValueTest2()
        {
            var pf1 = new PackageReader();

            pf1.Read("D:\\la2\\system\\lineageeffect.u");
            var    header1        = new Header(pf1.Bytes);
            var    ExportTable1   = new ExportTable(header1, pf1.Bytes);
            var    ImportTable1   = new ImportTable(header1, pf1.Bytes);
            var    NameTable1     = new NameTable(header1, pf1.Bytes);
            string name           = "MeshEmitter0";
            Export Exp            = ExportTable1[1939];
            int    PropertyOffset = 0xA + Exp.SerialOffset + 28;
            //Act
            Property Prop = new Property(pf1.Bytes, PropertyOffset);

            Prop.SetStructType(StructType.Vector);
            //Assert
            string Str = NameTable1[Prop.NameTableRef];

            Assert.AreEqual(Str, "Acceleration");
            Assert.IsTrue(Prop.Value is DataStructures.UVector);
            Assert.AreEqual(Prop.Size, 15);
            DataStructures.UVector uv = Prop.Value as DataStructures.UVector;
            Assert.AreEqual(Prop.Type, PropertyType.StructProperty);
            Assert.AreEqual(uv.X, -13.00f);
            Assert.AreEqual(uv.Y, 0.0f);
            Assert.AreEqual(uv.Z, -50.0f);
        }
Exemplo n.º 2
0
        public void PropertyCanReadStructVectorValueTest()
        {
            string name           = "SpriteEmitter544";
            Export Exp            = ExportTable.FindAll(n => n.NameTableRef == NameTable.IndexOf(name))?.First();
            int    PropertyOffset = 0x97 + Exp.SerialOffset + 28;
            //Act
            Property Prop = new Property(pf.Bytes, PropertyOffset);

            Prop.SetStructType(StructType.Vector);
            //Assert
            string Str = NameTable[Prop.NameTableRef];

            Assert.AreEqual(Str, "SpinCCWorCW");
            Assert.IsTrue(Prop.Value is DataStructures.UVector);
            Assert.AreEqual(Prop.Size, 16);
            DataStructures.UVector uv = Prop.Value as DataStructures.UVector;
            Assert.AreEqual(Prop.Type, PropertyType.StructProperty);
            Assert.AreEqual(uv.X, 1.00f);
            Assert.AreEqual(uv.Y, 0.50f);
            Assert.AreEqual(uv.Z, 0.50f);
        }