public Table RecreateTable() { var table = CreateTable(); Restore(sounds, table.Sounds, d => new Sound(d)); // restore textures Logger.Info("Restoring textures..."); foreach (var textureData in textures) { var texture = new Texture(textureData); if (textureData.Binary != null && textureData.Binary.Size > 0) { textureData.Binary.Data = File.ReadAllBytes(texture.GetUnityFilename(textureFolder)); textureData.Bitmap = null; } else if (textureData.Bitmap != null && textureData.Bitmap.Width > 0) { textureData.Bitmap.Data = File.ReadAllBytes(texture.GetUnityFilename(textureFolder)); textureData.Binary = null; } table.Textures[texture.Name] = texture; } Logger.Info("Table restored."); return(table); }
public Engine.VPT.Table.Table RecreateTable() { var table = CreateTable(); Restore(_sidecar.sounds, table.Sounds, d => new Sound(d)); // restore textures Logger.Info("Restoring textures..."); foreach (var textureData in _sidecar.textures) { var texture = new Texture(textureData); table.Textures[texture.Name.ToLower()] = texture; } Logger.Info("Table restored."); return(table); }
public Texture2D LoadTexture(Texture texture, bool asNormalMap) { return(AssetDatabase.LoadAssetAtPath <Texture2D>(texture.GetUnityFilename(TextureFolder))); }
public void HandleTextureData(Texture texture) { var path = texture.GetUnityFilename(TextureFolder); File.WriteAllBytes(path, texture.FileContent); }
public Table RecreateTable() { Logger.Info("Restoring table..."); // restore table data var table = new Table(data); // restore table info Logger.Info("Restoring table info..."); foreach (var k in tableInfo.Keys) { table.TableInfo[k] = tableInfo[k]; } // restore custom info tags table.CustomInfoTags = customInfoTags; // restore game items with no game object (yet!) table.Decals.Clear(); table.Decals.AddRange(decals.Select(d => new Decal(d))); Restore(collections, table.Collections, d => new Collection(d)); Restore(dispReels, table.DispReels, d => new DispReel(d)); Restore(flashers, table.Flashers, d => new Flasher(d)); Restore(lightSeqs, table.LightSeqs, d => new LightSeq(d)); Restore(plungers, table.Plungers, d => new Plunger(d)); Restore(sounds, table.Sounds, d => new Sound(d)); Restore(textBoxes, table.TextBoxes, d => new TextBox(d)); Restore(timers, table.Timers, d => new Timer(d)); // restore game items Logger.Info("Restoring game items..."); Restore <VisualPinballBumper, Bumper, BumperData>(table.Bumpers); Restore <VisualPinballFlipper, Flipper, FlipperData>(table.Flippers); Restore <VisualPinballGate, Gate, GateData>(table.Gates); Restore <VisualPinballHitTarget, HitTarget, HitTargetData>(table.HitTargets); Restore <VisualPinballKicker, Kicker, KickerData>(table.Kickers); Restore <VisualPinballLight, Light, LightData>(table.Lights); Restore <VisualPinballPrimitive, Primitive, PrimitiveData>(table.Primitives); Restore <VisualPinballRamp, Ramp, RampData>(table.Ramps); Restore <VisualPinballRubber, Rubber, RubberData>(table.Rubbers); Restore <VisualPinballSpinner, Spinner, SpinnerData>(table.Spinners); Restore <VisualPinballSurface, Surface, SurfaceData>(table.Surfaces); Restore <VisualPinballTrigger, Trigger, TriggerData>(table.Triggers); // restore textures Logger.Info("Restoring textures..."); foreach (var textureData in textures) { var texture = new Texture(textureData); if (textureData.Binary != null) { textureData.Binary.Data = File.ReadAllBytes(texture.GetUnityFilename(textureFolder)); } if (textureData.Bitmap != null) { textureData.Bitmap.Data = File.ReadAllBytes(texture.GetUnityFilename(textureFolder)); } table.Textures[texture.Name] = texture; } Logger.Info("Table restored."); return(table); }
public Texture2D LoadTexture(Texture texture, bool asNormalMap) { return(asNormalMap ? NormalMap(Textures[texture.Name]) : Textures[texture.Name]); }
public void HandleTextureData(Texture texture) { // nothing to do }