public void ShouldReadTimerData()
        {
            var table = FileTableContainer.Load(VpxPath.Timer);

            ValidateTimerData1(table.Timer("Timer1").Data);
            ValidateTimerData2(table.Timer("Timer2").Data);
        }
Esempio n. 2
0
        public void ShouldReadPlungerData()
        {
            var table = FileTableContainer.Load(VpxPath.Plunger);

            ValidatePlungerData1(table.Plunger("Plunger1").Data);
            ValidatePlungerData2(table.Plunger("Plunger2").Data);
        }
Esempio n. 3
0
        public void ShouldReadDispReelData()
        {
            var table = FileTableContainer.Load(VpxPath.DispReel);

            ValidateDispReel1(table.DispReel("Reel1").Data);
            ValidateDispReel2(table.DispReel("Reel2").Data);
        }
Esempio n. 4
0
        public void ShouldReadLayerDataVPX1070()
        {
            var table = FileTableContainer.Load(VpxPath.BumperVPX1070);
            var data  = table.Bumper("Bumper1").Data;

            ValidateTableDataVPX1070(data);
        }
Esempio n. 5
0
        public void ShouldReadBumperData()
        {
            var th   = FileTableContainer.Load(VpxPath.Bumper);
            var data = th.Bumper("Bumper1").Data;

            ValidateTableData(data);
        }
        public static GameObject ImportIntoScene(FileTableContainer tableContainer, string filename = "", GameObject parent = null, bool applyPatch = true, string tableName = null, Stopwatch sw = null, ConvertOptions options = null)
        {
            sw ??= Stopwatch.StartNew();
            if (tableName == null && !string.IsNullOrEmpty(filename))
            {
                tableName = Path.GetFileNameWithoutExtension(filename);
            }

            // load table
            var loadedIn        = sw.ElapsedMilliseconds;
            var converter       = new VpxSceneConverter(tableContainer, filename, options);
            var tableGameObject = converter.Convert(applyPatch, tableName);
            var convertedIn     = sw.ElapsedMilliseconds;

            // if an object was selected in the editor, make it its parent
            if (parent != null)
            {
                GameObjectUtility.SetParentAndAlign(tableGameObject, parent);
            }

            // register undo system
            Undo.RegisterCreatedObjectUndo(tableGameObject, "Import VPX table file");

            // select imported object
            Selection.activeObject = tableGameObject;

            Logger.Info($"Imported {filename} in {convertedIn}ms (loaded after {loadedIn}ms).");

            return(tableGameObject);
        }
Esempio n. 7
0
        public void ShouldReadCustomInfoTags()
        {
            var table = FileTableContainer.Load(VpxPath.Table);

            table.CustomInfoTags.TagNames[0].Should().Be("customdata1");
            table.CustomInfoTags.TagNames[1].Should().Be("foo");
        }
        public void ShouldReadDecalData()
        {
            var th = FileTableContainer.Load(VpxPath.Decal);

            ValidateDecal0(th.Decal(0).Data);
            ValidateDecal1(th.Decal(1).Data);
        }
Esempio n. 9
0
        public void ShouldReadCollectionData()
        {
            var tableContainer = FileTableContainer.Load(VpxPath.Collection);
            var data           = tableContainer.Collections.First(c => c.Name == "Flippers");

            ValidateTableData(data);
        }
Esempio n. 10
0
        public void ShouldReadRubberData()
        {
            var table = FileTableContainer.Load(VpxPath.Rubber);

            ValidateRubberData1(table.Rubber("Rubber1").Data);
            ValidateRubberData2(table.Rubber("Rubber2").Data);
        }
Esempio n. 11
0
        public void ShouldReadMetalWireGuideData()
        {
            var table = FileTableContainer.Load(VpxPath.MetalWireGuide);

            ValidateMetalWireGuideData1(table.MetalWireGuide("MetalWireGuide1").Data);
            ValidateMetalWireGuideData2(table.MetalWireGuide("MetalWireGuide2").Data);
        }
 /// <summary>
 /// Creates a new converter for a new table
 /// </summary>
 /// <param name="sourceContainer">Source table container</param>
 /// <param name="fileName">File name of the file being imported</param>
 /// <param name="options">Optional convert options</param>
 public VpxSceneConverter(FileTableContainer sourceContainer, string fileName = "", ConvertOptions options = null)
 {
     _sourceContainer = sourceContainer;
     _sourceTable     = sourceContainer.Table;
     _patcher         = PatcherManager.GetPatcher();
     _patcher?.Set(sourceContainer, fileName, this, this);
     _options = options ?? new ConvertOptions();
 }
Esempio n. 13
0
        public void ShouldLoadWireData()
        {
            var table = FileTableContainer.Load(VpxPath.Ramp);
            var data  = table.Ramp("Wire3R").Data;

            data.RampType.Should().Be(RampType.RampType3WireRight);
            data.WireDiameter.Should().Be(2.982f);
            data.WireDistanceX.Should().Be(50.278f);
            data.WireDistanceY.Should().Be(88.381f);
        }
Esempio n. 14
0
        public void ShouldGenerateACompressedMesh()
        {
            var th  = FileTableContainer.Load(VpxPath.PrimitiveCompressed);
            var obj = LoadObjFixture(ObjPath.PrimitiveCompressed);
            var p   = th.Primitive("compressed");

            var compressedMesh = ((IRenderable)p).GetMesh(null, th.Table);

            AssertObjMesh(obj, compressedMesh, threshold: 0.00015f);
        }
 public override bool Matches(FileTableContainer tableContainer, GameObject go)
 {
     if (!go)
     {
         return(false);
     }
     return(IgnoreCase
                         ? string.Equals(go.name, _name, StringComparison.CurrentCultureIgnoreCase)
                         : go.name == _name);
 }
Esempio n. 16
0
        public void ShouldWriteCorrectBitmap()
        {
            const string tmpFileName = "ShouldWriteCorrectBitmap.vpx";

            new TableWriter(_table).WriteTable(tmpFileName);
            var writtenTable = FileTableContainer.Load(tmpFileName);

            writtenTable.GetTexture("test_pattern_bmp").Data.Bitmap.Bytes.Should().Equal(_table.GetTexture("test_pattern_bmp").Data.Bitmap.Bytes);
            File.Delete(tmpFileName);
        }
        public void ShouldWritePrimitiveData()
        {
            const string tmpFileName = "ShouldWritePrimitiveData.vpx";
            var          table       = FileTableContainer.Load(VpxPath.Primitive);

            new TableWriter(table).WriteTable(tmpFileName);
            var writtenTable = FileTableContainer.Load(tmpFileName);

            ValidatePrimitiveData(writtenTable.Primitive("Cube").Data);
        }
        public void ShouldWriteTroughData()
        {
            const string tmpFileName = "ShouldWriteTroughData.vpx";
            var          table       = FileTableContainer.Load(VpxPath.Trough);

            table.Save(tmpFileName);
            var writtenTable = FileTableContainer.Load(tmpFileName);

            ValidateTroughData(writtenTable.Trough("Trough1").Data);
            File.Delete(tmpFileName);
        }
Esempio n. 19
0
        public void ShouldWriteCollectionData()
        {
            const string tmpFileName = "ShouldWriteCollectionData.vpx";
            var          th          = FileTableContainer.Load(VpxPath.Collection);

            th.Save(tmpFileName);
            var writtenTable = FileTableContainer.Load(tmpFileName);

            ValidateTableData(writtenTable.Collections.First(c => c.Name == "Flippers"));
            File.Delete(tmpFileName);
        }
        public void ShouldWriteSurfaceData()
        {
            const string tmpFileName = "ShouldWriteSurfaceData.vpx";
            var          table       = FileTableContainer.Load(VpxPath.Surface);

            table.Save(tmpFileName);
            var writtenTable = FileTableContainer.Load(tmpFileName);

            ValidateSurfaceData(writtenTable.Surface("TopInvisible").Data);
            File.Delete(tmpFileName);
        }
        public void ShouldWriteLightData()
        {
            const string tmpFileName = "ShouldWriteLightData.vpx";
            var          table       = FileTableContainer.Load(VpxPath.Light);

            table.Save(tmpFileName);
            var writtenTable = FileTableContainer.Load(tmpFileName);

            ValidateLightData(writtenTable.Light("Light1").Data);
            File.Delete(tmpFileName);
        }
Esempio n. 22
0
        public void ShouldWriteRampData()
        {
            const string tmpFileName = "ShouldWriteRampData.vpx";
            var          table       = FileTableContainer.Load(VpxPath.Ramp);

            table.Save(tmpFileName);
            var writtenTable = FileTableContainer.Load(tmpFileName);

            ValidateRampData(writtenTable.Ramp("FlatL").Data);
            File.Delete(tmpFileName);
        }
Esempio n. 23
0
        public void ShouldWriteBumperData()
        {
            const string tmpFileName = "ShouldWriteBumperData.vpx";
            var          table       = FileTableContainer.Load(VpxPath.Bumper);

            table.Save(tmpFileName);
            var writtenTable = FileTableContainer.Load(tmpFileName);

            ValidateTableData(writtenTable.Bumper("Bumper1").Data);
            File.Delete(tmpFileName);
        }
        public void ShouldWriteMaterialData()
        {
            const string tmpFileName = "ShouldWriteMaterialData.vpx";
            var          table       = FileTableContainer.Load(VpxPath.Material);

            table.Save(tmpFileName);
            var writtenTable = FileTableContainer.Load(tmpFileName);

            ValidateMaterial1(writtenTable.GetMaterial("Material1"));
            File.Delete(tmpFileName);
        }
        public void ShouldWriteDecalData()
        {
            const string tmpFileName = "ShouldWriteDecalData.vpx";
            var          table       = FileTableContainer.Load(VpxPath.Decal);

            table.Save(tmpFileName);
            var writtenTable = FileTableContainer.Load(tmpFileName);

            ValidateDecal0(writtenTable.Decal(0).Data);
            ValidateDecal1(writtenTable.Decal(1).Data);
            File.Delete(tmpFileName);
        }
Esempio n. 26
0
        public void ShouldWriteSoundData()
        {
            const string tmpFileName    = "ShouldWriteSoundData.vpx";
            var          tableContainer = FileTableContainer.Load(VpxPath.Sound);

            new TableWriter(tableContainer).WriteTable(tmpFileName);
            var writtenTable = FileTableContainer.Load(tmpFileName);

            ValidateSoundData(writtenTable.GetSound("fx_bumper3").Data);

            File.Delete(tmpFileName);
        }
Esempio n. 27
0
        public void ShouldWriteCorrectHash()
        {
            const string tmpFileName = "ShouldWriteCorrectHash.vpx";
            var          table       = FileTableContainer.Load(VpxPath.TableChecksum);

            new TableWriter(table).WriteTable(tmpFileName);
            var writtenTable = FileTableContainer.Load(tmpFileName);

            writtenTable.FileHash.Should().Equal(table.FileHash);

            File.Delete(tmpFileName);
        }
        public void ShouldWriteTextBoxData()
        {
            const string tmpFileName = "ShouldWriteTextBoxData.vpx";
            var          table       = FileTableContainer.Load(VpxPath.TextBox);

            new TableWriter(table).WriteTable(tmpFileName);
            var writtenTable = FileTableContainer.Load(tmpFileName);

            ValidateTextBoxData(writtenTable.TextBox("TextBox001").Data);

            File.Delete(tmpFileName);
        }
Esempio n. 29
0
        public void ShouldWriteDispReelData()
        {
            const string tmpFileName = "ShouldWriteDispReelData.vpx";
            var          table       = FileTableContainer.Load(VpxPath.DispReel);

            table.Save(tmpFileName);
            var writtenTable = FileTableContainer.Load(tmpFileName);

            ValidateDispReel1(writtenTable.DispReel("Reel1").Data);
            ValidateDispReel2(writtenTable.DispReel("Reel2").Data);
            File.Delete(tmpFileName);
        }
        public void ShouldLoadCorrectDragPointData()
        {
            var table      = FileTableContainer.Load(VpxPath.Light);
            var dragPoints = table.Light("PlayfieldLight").Data.DragPoints;

            dragPoints[0].IsSmooth.Should().Be(false);
            dragPoints[0].IsSlingshot.Should().Be(true);
            dragPoints[0].Center.X.Should().Be(491.6666f);
            dragPoints[0].Center.Y.Should().Be(376.882f);
            dragPoints[6].IsSmooth.Should().Be(true);
            dragPoints[7].IsSmooth.Should().Be(false);
        }