Fixed serialization item converter to have MUCH nicer output for serializing SDV items. Also removed unnecessary TileLocation field from BasicItemInformation.cs
This commit is contained in:
parent
c51ffa84b6
commit
0cbae77d28
|
@ -26,19 +26,19 @@ namespace Revitalize.Framework.Factories.Objects
|
|||
/// <summary>
|
||||
/// The path to the chairs data on disk.
|
||||
/// </summary>
|
||||
public static string ChairFolder = Path.Combine("Data", "Furniture", "Chairs");
|
||||
public static string ChairFolder = Path.Combine("Data","Objects" ,"Furniture", "Chairs");
|
||||
/// <summary>
|
||||
/// The path to the tables data on disk.
|
||||
/// </summary>
|
||||
public static string TablesFolder = Path.Combine("Data", "Furniture", "Tables");
|
||||
public static string TablesFolder = Path.Combine("Data","Objects","Furniture", "Tables");
|
||||
/// <summary>
|
||||
/// The path to the lamps data on disk.
|
||||
/// </summary>
|
||||
public static string LampsFolder = Path.Combine("Data", "Furniture", "Lamps");
|
||||
public static string LampsFolder = Path.Combine("Data","Objects","Furniture", "Lamps");
|
||||
/// <summary>
|
||||
/// The path to the storage data on disk.
|
||||
/// </summary>
|
||||
public static string StorageFolder = Path.Combine("Data", "Furniture", "Storage");
|
||||
public static string StorageFolder = Path.Combine("Data","Objects" ,"Furniture", "Storage");
|
||||
|
||||
/// <summary>
|
||||
/// Loads all furniture files.
|
||||
|
@ -92,14 +92,14 @@ namespace Revitalize.Framework.Factories.Objects
|
|||
/// </summary>
|
||||
private static void SerializeLamps()
|
||||
{
|
||||
LampTileComponent lampTop = new LampTileComponent(PyTKHelper.CreateOBJData("Omegasis.Revitalize.Furniture.Lamps.OakLamp", TextureManager.GetTexture(ModCore.Manifest, "Furniture", "Oak Lamp"), typeof(LampTileComponent), Color.White), new BasicItemInformation("Oak Lamp", "Omegasis.Revitalize.Furniture.Lamps.OakLamp", "A basic wooden light.", "Lamps", Color.Brown, -300, 0, true, 100, Vector2.Zero, true, true, TextureManager.GetTexture(ModCore.Manifest, "Furniture", "Oak Lamp"), new AnimationManager(TextureManager.GetExtendedTexture(ModCore.Manifest, "Furniture", "Oak Lamp"), new Animation(new Rectangle(0, 0, 16, 16))), Color.White,true, new InventoryManager(), new LightManager()));
|
||||
LampTileComponent lampTop = new LampTileComponent(PyTKHelper.CreateOBJData("Omegasis.Revitalize.Furniture.Lamps.OakLamp", TextureManager.GetTexture(ModCore.Manifest, "Furniture", "Oak Lamp"), typeof(LampTileComponent), Color.White), new BasicItemInformation("Oak Lamp", "Omegasis.Revitalize.Furniture.Lamps.OakLamp", "A basic wooden light.", "Lamps", Color.Brown, -300, 0, true, 100, true, true, TextureManager.GetTexture(ModCore.Manifest, "Furniture", "Oak Lamp"), new AnimationManager(TextureManager.GetExtendedTexture(ModCore.Manifest, "Furniture", "Oak Lamp"), new Animation(new Rectangle(0, 0, 16, 16))), Color.White,true, new InventoryManager(), new LightManager()));
|
||||
|
||||
LampTileComponent lampMiddle = new LampTileComponent(PyTKHelper.CreateOBJData("Omegasis.Revitalize.Furniture.Lamps.OakLamp", TextureManager.GetTexture(ModCore.Manifest, "Furniture", "Oak Lamp"), typeof(LampTileComponent), Color.White), new BasicItemInformation("Oak Lamp", "Omegasis.Revitalize.Furniture.Lamps.OakLamp", "A basic wooden light.", "Lamps", Color.Brown, -300, 0, true, 100, Vector2.Zero, true, true, TextureManager.GetTexture(ModCore.Manifest, "Furniture", "Oak Lamp"), new AnimationManager(TextureManager.GetExtendedTexture(ModCore.Manifest, "Furniture", "Oak Lamp"), new Animation(new Rectangle(0, 16, 16, 16))), Color.White, true, new InventoryManager(), new LightManager()));
|
||||
LampTileComponent lampBottom = new LampTileComponent(PyTKHelper.CreateOBJData("Omegasis.Revitalize.Furniture.Lamps.OakLamp", TextureManager.GetTexture(ModCore.Manifest, "Furniture", "Oak Lamp"), typeof(LampTileComponent), Color.White), new BasicItemInformation("Oak Lamp", "Omegasis.Revitalize.Furniture.Lamps.OakLamp", "A basic wooden light.", "Lamps", Color.Brown, -300, 0, true, 100, Vector2.Zero, true, true, TextureManager.GetTexture(ModCore.Manifest, "Furniture", "Oak Lamp"), new AnimationManager(TextureManager.GetExtendedTexture(ModCore.Manifest, "Furniture", "Oak Lamp"), new Animation(new Rectangle(0, 32, 16, 16))), Color.White, false, new InventoryManager(), new LightManager()));
|
||||
LampTileComponent lampMiddle = new LampTileComponent(PyTKHelper.CreateOBJData("Omegasis.Revitalize.Furniture.Lamps.OakLamp", TextureManager.GetTexture(ModCore.Manifest, "Furniture", "Oak Lamp"), typeof(LampTileComponent), Color.White), new BasicItemInformation("Oak Lamp", "Omegasis.Revitalize.Furniture.Lamps.OakLamp", "A basic wooden light.", "Lamps", Color.Brown, -300, 0, true, 100, true, true, TextureManager.GetTexture(ModCore.Manifest, "Furniture", "Oak Lamp"), new AnimationManager(TextureManager.GetExtendedTexture(ModCore.Manifest, "Furniture", "Oak Lamp"), new Animation(new Rectangle(0, 16, 16, 16))), Color.White, true, new InventoryManager(), new LightManager()));
|
||||
LampTileComponent lampBottom = new LampTileComponent(PyTKHelper.CreateOBJData("Omegasis.Revitalize.Furniture.Lamps.OakLamp", TextureManager.GetTexture(ModCore.Manifest, "Furniture", "Oak Lamp"), typeof(LampTileComponent), Color.White), new BasicItemInformation("Oak Lamp", "Omegasis.Revitalize.Furniture.Lamps.OakLamp", "A basic wooden light.", "Lamps", Color.Brown, -300, 0, true, 100 , true, true, TextureManager.GetTexture(ModCore.Manifest, "Furniture", "Oak Lamp"), new AnimationManager(TextureManager.GetExtendedTexture(ModCore.Manifest, "Furniture", "Oak Lamp"), new Animation(new Rectangle(0, 32, 16, 16))), Color.White, false, new InventoryManager(), new LightManager()));
|
||||
|
||||
lampMiddle.lights.addLight(new Vector2(Game1.tileSize), new LightSource(4, new Vector2(0, 0), 2.5f, Color.Orange.Invert()), lampMiddle);
|
||||
|
||||
LampMultiTiledObject lamp = new LampMultiTiledObject(PyTKHelper.CreateOBJData("Omegasis.Revitalize.Furniture.Lamps.OakLamp", TextureManager.GetTexture(ModCore.Manifest, "Furniture", "Oak Lamp"), typeof(LampMultiTiledObject), Color.White), new BasicItemInformation("Oak Lamp", "Omegasis.Revitalize.Furniture.Lamps.OakLamp", "A basic wooden light", "Lamps", Color.Brown, -300, 0, true, 300, Vector2.Zero, true, true, TextureManager.GetTexture(ModCore.Manifest, "Furniture", "Oak Lamp"), new AnimationManager(), Color.White, false, new InventoryManager(), new LightManager()));
|
||||
LampMultiTiledObject lamp = new LampMultiTiledObject(PyTKHelper.CreateOBJData("Omegasis.Revitalize.Furniture.Lamps.OakLamp", TextureManager.GetTexture(ModCore.Manifest, "Furniture", "Oak Lamp"), typeof(LampMultiTiledObject), Color.White), new BasicItemInformation("Oak Lamp", "Omegasis.Revitalize.Furniture.Lamps.OakLamp", "A basic wooden light", "Lamps", Color.Brown, -300, 0, true, 300, true, true, TextureManager.GetTexture(ModCore.Manifest, "Furniture", "Oak Lamp"), new AnimationManager(), Color.White, false, new InventoryManager(), new LightManager()));
|
||||
|
||||
lamp.addComponent(new Vector2(0, -2), lampTop);
|
||||
lamp.addComponent(new Vector2(0, -1), lampMiddle);
|
||||
|
@ -185,7 +185,7 @@ namespace Revitalize.Framework.Factories.Objects
|
|||
/// </summary>
|
||||
private static void SerializeChairs()
|
||||
{
|
||||
Framework.Objects.Furniture.ChairTileComponent chairTop = new ChairTileComponent(PyTKHelper.CreateOBJData("Omegasis.Revitalize.Furniture.Chairs.OakChair", TextureManager.GetTexture(ModCore.Manifest, "Furniture", "Oak Chair"), typeof(ChairTileComponent), Color.White), new BasicItemInformation("Oak Chair", "Omegasis.Revitalize.Furniture.Chairs.OakChair", "A basic wooden chair made out of oak.", "Chairs", Color.Brown, -300, 0, false, 250, Vector2.Zero, true, true, TextureManager.GetTexture(ModCore.Manifest, "Furniture", "Oak Chair"), new AnimationManager(TextureManager.GetExtendedTexture(ModCore.Manifest,"Furniture","Oak Chair"), new Animation(new Rectangle(0, 0, 16, 16)), new Dictionary<string, List<Animation>>() {
|
||||
Framework.Objects.Furniture.ChairTileComponent chairTop = new ChairTileComponent(PyTKHelper.CreateOBJData("Omegasis.Revitalize.Furniture.Chairs.OakChair", TextureManager.GetTexture(ModCore.Manifest, "Furniture", "Oak Chair"), typeof(ChairTileComponent), Color.White), new BasicItemInformation("Oak Chair", "Omegasis.Revitalize.Furniture.Chairs.OakChair", "A basic wooden chair made out of oak.", "Chairs", Color.Brown, -300, 0, false, 250, true, true, TextureManager.GetTexture(ModCore.Manifest, "Furniture", "Oak Chair"), new AnimationManager(TextureManager.GetExtendedTexture(ModCore.Manifest,"Furniture","Oak Chair"), new Animation(new Rectangle(0, 0, 16, 16)), new Dictionary<string, List<Animation>>() {
|
||||
{ "Default_" + (int)Framework.Enums.Direction.Down , new List<Animation>()
|
||||
{
|
||||
new Animation(new Rectangle(0,0,16,16))
|
||||
|
@ -229,7 +229,7 @@ namespace Revitalize.Framework.Factories.Objects
|
|||
}, "Default_" + (int)Framework.Enums.Direction.Down), Color.White, true, null, null),new ChairInformation(false));
|
||||
|
||||
|
||||
Framework.Objects.Furniture.ChairTileComponent chairBottom = new ChairTileComponent(PyTKHelper.CreateOBJData("Omegasis.Revitalize.Furniture.Chairs.OakChair", TextureManager.GetTexture(ModCore.Manifest, "Furniture", "Oak Chair"), typeof(ChairTileComponent), Color.White), new BasicItemInformation("Oak Chair", "Omegasis.Revitalize.Furniture.Chairs.OakChair", "A basic wooden chair.", "Chairs", Color.Brown, -300, 0, false, 250, Vector2.Zero, true, true, TextureManager.GetTexture(ModCore.Manifest, "Furniture", "Oak Chair"), new AnimationManager(TextureManager.TextureManagers[ModCore.Manifest.UniqueID]["Furniture"].getTexture("Oak Chair"), new Animation(new Rectangle(0, 16, 16, 16)), new Dictionary<string, List<Animation>>() {
|
||||
Framework.Objects.Furniture.ChairTileComponent chairBottom = new ChairTileComponent(PyTKHelper.CreateOBJData("Omegasis.Revitalize.Furniture.Chairs.OakChair", TextureManager.GetTexture(ModCore.Manifest, "Furniture", "Oak Chair"), typeof(ChairTileComponent), Color.White), new BasicItemInformation("Oak Chair", "Omegasis.Revitalize.Furniture.Chairs.OakChair", "A basic wooden chair.", "Chairs", Color.Brown, -300, 0, false, 250, true, true, TextureManager.GetTexture(ModCore.Manifest, "Furniture", "Oak Chair"), new AnimationManager(TextureManager.TextureManagers[ModCore.Manifest.UniqueID]["Furniture"].getTexture("Oak Chair"), new Animation(new Rectangle(0, 16, 16, 16)), new Dictionary<string, List<Animation>>() {
|
||||
{ "Default_" + (int)Framework.Enums.Direction.Down , new List<Animation>()
|
||||
{
|
||||
new Animation(new Rectangle(0,16,16,16))
|
||||
|
@ -272,7 +272,7 @@ namespace Revitalize.Framework.Factories.Objects
|
|||
}
|
||||
}, "Default_" + (int)Framework.Enums.Direction.Down), Color.White, false, null, null), new ChairInformation(true));
|
||||
|
||||
Framework.Objects.Furniture.ChairMultiTiledObject oakChair = new ChairMultiTiledObject(PyTKHelper.CreateOBJData("Omegasis.Revitalize.Furniture.Chairs.OakChair", TextureManager.GetTexture(ModCore.Manifest, "Furniture", "Oak Chair"), typeof(ChairMultiTiledObject), Color.White), new BasicItemInformation("Oak Chair", "Omegasis.Revitalize.Furniture.Chairs.OakChair", "A basic wooden chair.", "Chairs", Color.White, -300, 0, false, 250, Vector2.Zero, true, true, TextureManager.GetTexture(ModCore.Manifest, "Furniture", "Oak Chair"), new AnimationManager(), Color.White, false, null, null));
|
||||
Framework.Objects.Furniture.ChairMultiTiledObject oakChair = new ChairMultiTiledObject(PyTKHelper.CreateOBJData("Omegasis.Revitalize.Furniture.Chairs.OakChair", TextureManager.GetTexture(ModCore.Manifest, "Furniture", "Oak Chair"), typeof(ChairMultiTiledObject), Color.White), new BasicItemInformation("Oak Chair", "Omegasis.Revitalize.Furniture.Chairs.OakChair", "A basic wooden chair.", "Chairs", Color.White, -300, 0, false, 250, true, true, TextureManager.GetTexture(ModCore.Manifest, "Furniture", "Oak Chair"), new AnimationManager(), Color.White, false, null, null));
|
||||
|
||||
|
||||
ChairFactoryInfo top = new ChairFactoryInfo(chairTop);
|
||||
|
@ -334,14 +334,14 @@ namespace Revitalize.Framework.Factories.Objects
|
|||
/// </summary>
|
||||
private static void SerializeTableFiles()
|
||||
{
|
||||
TableTileComponent upperLeft = new TableTileComponent(PyTKHelper.CreateOBJData("Omegasis.Revitalize.Furniture.Tables.OakTable", TextureManager.GetTexture(ModCore.Manifest, "Furniture", "Oak Table"), typeof(TableTileComponent), Color.White), new BasicItemInformation("Oak Table", "Omegasis.Revitalize.Furniture.Tables.OakTable", "A simple wooden table to place objects on.", "Tables", Color.Brown, -300, 0, false, 350, Vector2.Zero, true, true, TextureManager.GetTexture(ModCore.Manifest, "Furniture", "Oak Table"), new AnimationManager(TextureManager.GetExtendedTexture(ModCore.Manifest, "Furniture", "Oak Table"), new Animation(0, 0, 16, 16)), Color.White, true, null, null), new TableInformation(true));
|
||||
TableTileComponent upperRight = new TableTileComponent(PyTKHelper.CreateOBJData("Omegasis.Revitalize.Furniture.Tables.OakTable", TextureManager.GetTexture(ModCore.Manifest, "Furniture", "Oak Table"), typeof(TableTileComponent), Color.White), new BasicItemInformation("Oak Table", "Omegasis.Revitalize.Furniture.Tables.OakTable", "A simple wooden table to place objects on.", "Tables", Color.Brown, -300, 0, false, 350, Vector2.Zero, true, true, TextureManager.GetTexture(ModCore.Manifest, "Furniture", "Oak Table"), new AnimationManager(TextureManager.GetExtendedTexture(ModCore.Manifest, "Furniture", "Oak Table"), new Animation(16, 0, 16, 16)), Color.White, true, null, null), new TableInformation(true));
|
||||
TableTileComponent centerLeft = new TableTileComponent(PyTKHelper.CreateOBJData("Omegasis.Revitalize.Furniture.Tables.OakTable", TextureManager.GetTexture(ModCore.Manifest, "Furniture", "Oak Table"), typeof(TableTileComponent), Color.White), new BasicItemInformation("Oak Table", "Omegasis.Revitalize.Furniture.Tables.OakTable", "A simple wooden table to place objects on.", "Tables", Color.Brown, -300, 0, false, 350, Vector2.Zero, true, true, TextureManager.GetTexture(ModCore.Manifest, "Furniture", "Oak Table"), new AnimationManager(TextureManager.GetExtendedTexture(ModCore.Manifest, "Furniture", "Oak Table"), new Animation(0, 16, 16, 16)), Color.White, false, null, null), new TableInformation(true));
|
||||
TableTileComponent centerRight = new TableTileComponent(PyTKHelper.CreateOBJData("Omegasis.Revitalize.Furniture.Tables.OakTable", TextureManager.GetTexture(ModCore.Manifest, "Furniture", "Oak Table"), typeof(TableTileComponent), Color.White), new BasicItemInformation("Oak Table", "Omegasis.Revitalize.Furniture.Tables.OakTable", "A simple wooden table to place objects on.", "Tables", Color.Brown, -300, 0, false, 350, Vector2.Zero, true, true, TextureManager.GetTexture(ModCore.Manifest, "Furniture", "Oak Table"), new AnimationManager(TextureManager.GetExtendedTexture(ModCore.Manifest, "Furniture", "Oak Table"), new Animation(16, 16, 16, 16)), Color.White, false, null, null), new TableInformation(true));
|
||||
TableTileComponent bottomLeft = new TableTileComponent(PyTKHelper.CreateOBJData("Omegasis.Revitalize.Furniture.Tables.OakTable", TextureManager.GetTexture(ModCore.Manifest, "Furniture", "Oak Table"), typeof(TableTileComponent), Color.White), new BasicItemInformation("Oak Table", "Omegasis.Revitalize.Furniture.Tables.OakTable", "A simple wooden table to place objects on.", "Tables", Color.Brown, -300, 0, false, 350, Vector2.Zero, true, true, TextureManager.GetTexture(ModCore.Manifest, "Furniture", "Oak Table"), new AnimationManager(TextureManager.GetExtendedTexture(ModCore.Manifest, "Furniture", "Oak Table"), new Animation(0, 32, 16, 16)), Color.White, false, null, null), new TableInformation(true));
|
||||
TableTileComponent bottomRight = new TableTileComponent(PyTKHelper.CreateOBJData("Omegasis.Revitalize.Furniture.Tables.OakTable", TextureManager.GetTexture(ModCore.Manifest, "Furniture", "Oak Table"), typeof(TableTileComponent), Color.White), new BasicItemInformation("Oak Table", "Omegasis.Revitalize.Furniture.Tables.OakTable", "A simple wooden table to place objects on.", "Tables", Color.Brown, -300, 0, false, 350, Vector2.Zero, true, true, TextureManager.GetTexture(ModCore.Manifest, "Furniture", "Oak Table"), new AnimationManager(TextureManager.GetExtendedTexture(ModCore.Manifest, "Furniture", "Oak Table"), new Animation(16, 32, 16, 16)), Color.White, false, null, null), new TableInformation(true));
|
||||
TableTileComponent upperLeft = new TableTileComponent(PyTKHelper.CreateOBJData("Omegasis.Revitalize.Furniture.Tables.OakTable", TextureManager.GetTexture(ModCore.Manifest, "Furniture", "Oak Table"), typeof(TableTileComponent), Color.White), new BasicItemInformation("Oak Table", "Omegasis.Revitalize.Furniture.Tables.OakTable", "A simple wooden table to place objects on.", "Tables", Color.Brown, -300, 0, false, 350, true, true, TextureManager.GetTexture(ModCore.Manifest, "Furniture", "Oak Table"), new AnimationManager(TextureManager.GetExtendedTexture(ModCore.Manifest, "Furniture", "Oak Table"), new Animation(0, 0, 16, 16)), Color.White, true, null, null), new TableInformation(true));
|
||||
TableTileComponent upperRight = new TableTileComponent(PyTKHelper.CreateOBJData("Omegasis.Revitalize.Furniture.Tables.OakTable", TextureManager.GetTexture(ModCore.Manifest, "Furniture", "Oak Table"), typeof(TableTileComponent), Color.White), new BasicItemInformation("Oak Table", "Omegasis.Revitalize.Furniture.Tables.OakTable", "A simple wooden table to place objects on.", "Tables", Color.Brown, -300, 0, false, 350, true, true, TextureManager.GetTexture(ModCore.Manifest, "Furniture", "Oak Table"), new AnimationManager(TextureManager.GetExtendedTexture(ModCore.Manifest, "Furniture", "Oak Table"), new Animation(16, 0, 16, 16)), Color.White, true, null, null), new TableInformation(true));
|
||||
TableTileComponent centerLeft = new TableTileComponent(PyTKHelper.CreateOBJData("Omegasis.Revitalize.Furniture.Tables.OakTable", TextureManager.GetTexture(ModCore.Manifest, "Furniture", "Oak Table"), typeof(TableTileComponent), Color.White), new BasicItemInformation("Oak Table", "Omegasis.Revitalize.Furniture.Tables.OakTable", "A simple wooden table to place objects on.", "Tables", Color.Brown, -300, 0, false, 350, true, true, TextureManager.GetTexture(ModCore.Manifest, "Furniture", "Oak Table"), new AnimationManager(TextureManager.GetExtendedTexture(ModCore.Manifest, "Furniture", "Oak Table"), new Animation(0, 16, 16, 16)), Color.White, false, null, null), new TableInformation(true));
|
||||
TableTileComponent centerRight = new TableTileComponent(PyTKHelper.CreateOBJData("Omegasis.Revitalize.Furniture.Tables.OakTable", TextureManager.GetTexture(ModCore.Manifest, "Furniture", "Oak Table"), typeof(TableTileComponent), Color.White), new BasicItemInformation("Oak Table", "Omegasis.Revitalize.Furniture.Tables.OakTable", "A simple wooden table to place objects on.", "Tables", Color.Brown, -300, 0, false, 350, true, true, TextureManager.GetTexture(ModCore.Manifest, "Furniture", "Oak Table"), new AnimationManager(TextureManager.GetExtendedTexture(ModCore.Manifest, "Furniture", "Oak Table"), new Animation(16, 16, 16, 16)), Color.White, false, null, null), new TableInformation(true));
|
||||
TableTileComponent bottomLeft = new TableTileComponent(PyTKHelper.CreateOBJData("Omegasis.Revitalize.Furniture.Tables.OakTable", TextureManager.GetTexture(ModCore.Manifest, "Furniture", "Oak Table"), typeof(TableTileComponent), Color.White), new BasicItemInformation("Oak Table", "Omegasis.Revitalize.Furniture.Tables.OakTable", "A simple wooden table to place objects on.", "Tables", Color.Brown, -300, 0, false, 350, true, true, TextureManager.GetTexture(ModCore.Manifest, "Furniture", "Oak Table"), new AnimationManager(TextureManager.GetExtendedTexture(ModCore.Manifest, "Furniture", "Oak Table"), new Animation(0, 32, 16, 16)), Color.White, false, null, null), new TableInformation(true));
|
||||
TableTileComponent bottomRight = new TableTileComponent(PyTKHelper.CreateOBJData("Omegasis.Revitalize.Furniture.Tables.OakTable", TextureManager.GetTexture(ModCore.Manifest, "Furniture", "Oak Table"), typeof(TableTileComponent), Color.White), new BasicItemInformation("Oak Table", "Omegasis.Revitalize.Furniture.Tables.OakTable", "A simple wooden table to place objects on.", "Tables", Color.Brown, -300, 0, false, 350, true, true, TextureManager.GetTexture(ModCore.Manifest, "Furniture", "Oak Table"), new AnimationManager(TextureManager.GetExtendedTexture(ModCore.Manifest, "Furniture", "Oak Table"), new Animation(16, 32, 16, 16)), Color.White, false, null, null), new TableInformation(true));
|
||||
|
||||
TableMultiTiledObject obj = new TableMultiTiledObject(PyTKHelper.CreateOBJData("Omegasis.Revitalize.Furniture.Tables.OakTable", TextureManager.GetTexture(ModCore.Manifest, "Furniture", "Oak Table"), typeof(TableMultiTiledObject), Color.White), new BasicItemInformation("Oak Table", "Omegasis.Revitalize.Furniture.Tables.OakTable", "A simple oak table to place things on.", "Tables", Color.Brown, -300, 0, false, 350, Vector2.Zero, true, true, TextureManager.GetTexture(ModCore.Manifest, "Furniture", "Oak Table"), new AnimationManager(), Color.White, false, null, null));
|
||||
TableMultiTiledObject obj = new TableMultiTiledObject(PyTKHelper.CreateOBJData("Omegasis.Revitalize.Furniture.Tables.OakTable", TextureManager.GetTexture(ModCore.Manifest, "Furniture", "Oak Table"), typeof(TableMultiTiledObject), Color.White), new BasicItemInformation("Oak Table", "Omegasis.Revitalize.Furniture.Tables.OakTable", "A simple oak table to place things on.", "Tables", Color.Brown, -300, 0, false, 350, true, true, TextureManager.GetTexture(ModCore.Manifest, "Furniture", "Oak Table"), new AnimationManager(), Color.White, false, null, null));
|
||||
|
||||
TableFactoryInfo uL = new TableFactoryInfo(upperLeft);
|
||||
TableFactoryInfo uR = new TableFactoryInfo(upperRight);
|
||||
|
@ -415,13 +415,13 @@ namespace Revitalize.Framework.Factories.Objects
|
|||
/// </summary>
|
||||
private static void SerializeFurnitureStorageFiles()
|
||||
{
|
||||
StorageFurnitureTile upperLeft = new StorageFurnitureTile(PyTKHelper.CreateOBJData("Omegasis.Revitalize.Furniture.Storage.OakCabinet", TextureManager.GetTexture(ModCore.Manifest, "Furniture", "Oak Cabinet"), typeof(StorageFurnitureTile), Color.White), new BasicItemInformation("Oak Cabinet", "Omegasis.Revitalize.Furniture.Storage.OakCabinet", "A beautiful oak cabinet to place objects inside of.", "Storage", Color.Brown, -300, 0, false, 350, Vector2.Zero, true, true, TextureManager.GetTexture(ModCore.Manifest, "Furniture", "Oak Cabinet"), new AnimationManager(TextureManager.GetExtendedTexture(ModCore.Manifest, "Furniture", "Oak Cabinet"), new Animation(0, 0, 16, 16)), Color.White, false, null, null));
|
||||
StorageFurnitureTile upperRight = new StorageFurnitureTile(PyTKHelper.CreateOBJData("Omegasis.Revitalize.Furniture.Storage.OakCabinet", TextureManager.GetTexture(ModCore.Manifest, "Furniture", "Oak Cabinet"), typeof(StorageFurnitureTile), Color.White), new BasicItemInformation("Oak Cabinet", "Omegasis.Revitalize.Furniture.Storage.OakCabinet", "A beautiful oak cabinet to place objects inside of.", "Storage", Color.Brown, -300, 0, false, 350, Vector2.Zero, true, true, TextureManager.GetTexture(ModCore.Manifest, "Furniture", "Oak Cabinet"), new AnimationManager(TextureManager.GetExtendedTexture(ModCore.Manifest, "Furniture", "Oak Cabinet"), new Animation(16, 0, 16, 16)), Color.White, false, null, null));
|
||||
StorageFurnitureTile bottomLeft = new StorageFurnitureTile(PyTKHelper.CreateOBJData("Omegasis.Revitalize.Furniture.Storage.OakCabinet", TextureManager.GetTexture(ModCore.Manifest, "Furniture", "Oak Cabinet"), typeof(StorageFurnitureTile), Color.White), new BasicItemInformation("Oak Cabinet", "Omegasis.Revitalize.Furniture.Storage.OakCabinet", "A beautiful oak cabinet to place objects inside of.", "Storage", Color.Brown, -300, 0, false, 350, Vector2.Zero, true, true, TextureManager.GetTexture(ModCore.Manifest, "Furniture", "Oak Cabinet"), new AnimationManager(TextureManager.GetExtendedTexture(ModCore.Manifest, "Furniture", "Oak Cabinet"), new Animation(0, 16, 16, 16)), Color.White, false, null, null));
|
||||
StorageFurnitureTile bottomRight = new StorageFurnitureTile(PyTKHelper.CreateOBJData("Omegasis.Revitalize.Furniture.Storage.OakCabinet", TextureManager.GetTexture(ModCore.Manifest, "Furniture", "Oak Cabinet"), typeof(StorageFurnitureTile), Color.White), new BasicItemInformation("Oak Cabinet", "Omegasis.Revitalize.Furniture.Storage.OakCabinet", "A beautiful oak cabinet to place objects inside of.", "Storage", Color.Brown, -300, 0, false, 350, Vector2.Zero, true, true, TextureManager.GetTexture(ModCore.Manifest, "Furniture", "Oak Cabinet"), new AnimationManager(TextureManager.GetExtendedTexture(ModCore.Manifest, "Furniture", "Oak Cabinet"), new Animation(16, 16, 16, 16)), Color.White, false, null, null));
|
||||
StorageFurnitureTile upperLeft = new StorageFurnitureTile(PyTKHelper.CreateOBJData("Omegasis.Revitalize.Furniture.Storage.OakCabinet", TextureManager.GetTexture(ModCore.Manifest, "Furniture", "Oak Cabinet"), typeof(StorageFurnitureTile), Color.White), new BasicItemInformation("Oak Cabinet", "Omegasis.Revitalize.Furniture.Storage.OakCabinet", "A beautiful oak cabinet to place objects inside of.", "Storage", Color.Brown, -300, 0, false, 350, true, true, TextureManager.GetTexture(ModCore.Manifest, "Furniture", "Oak Cabinet"), new AnimationManager(TextureManager.GetExtendedTexture(ModCore.Manifest, "Furniture", "Oak Cabinet"), new Animation(0, 0, 16, 16)), Color.White, false, null, null));
|
||||
StorageFurnitureTile upperRight = new StorageFurnitureTile(PyTKHelper.CreateOBJData("Omegasis.Revitalize.Furniture.Storage.OakCabinet", TextureManager.GetTexture(ModCore.Manifest, "Furniture", "Oak Cabinet"), typeof(StorageFurnitureTile), Color.White), new BasicItemInformation("Oak Cabinet", "Omegasis.Revitalize.Furniture.Storage.OakCabinet", "A beautiful oak cabinet to place objects inside of.", "Storage", Color.Brown, -300, 0, false, 350, true, true, TextureManager.GetTexture(ModCore.Manifest, "Furniture", "Oak Cabinet"), new AnimationManager(TextureManager.GetExtendedTexture(ModCore.Manifest, "Furniture", "Oak Cabinet"), new Animation(16, 0, 16, 16)), Color.White, false, null, null));
|
||||
StorageFurnitureTile bottomLeft = new StorageFurnitureTile(PyTKHelper.CreateOBJData("Omegasis.Revitalize.Furniture.Storage.OakCabinet", TextureManager.GetTexture(ModCore.Manifest, "Furniture", "Oak Cabinet"), typeof(StorageFurnitureTile), Color.White), new BasicItemInformation("Oak Cabinet", "Omegasis.Revitalize.Furniture.Storage.OakCabinet", "A beautiful oak cabinet to place objects inside of.", "Storage", Color.Brown, -300, 0, false, 350, true, true, TextureManager.GetTexture(ModCore.Manifest, "Furniture", "Oak Cabinet"), new AnimationManager(TextureManager.GetExtendedTexture(ModCore.Manifest, "Furniture", "Oak Cabinet"), new Animation(0, 16, 16, 16)), Color.White, false, null, null));
|
||||
StorageFurnitureTile bottomRight = new StorageFurnitureTile(PyTKHelper.CreateOBJData("Omegasis.Revitalize.Furniture.Storage.OakCabinet", TextureManager.GetTexture(ModCore.Manifest, "Furniture", "Oak Cabinet"), typeof(StorageFurnitureTile), Color.White), new BasicItemInformation("Oak Cabinet", "Omegasis.Revitalize.Furniture.Storage.OakCabinet", "A beautiful oak cabinet to place objects inside of.", "Storage", Color.Brown, -300, 0, false, 350, true, true, TextureManager.GetTexture(ModCore.Manifest, "Furniture", "Oak Cabinet"), new AnimationManager(TextureManager.GetExtendedTexture(ModCore.Manifest, "Furniture", "Oak Cabinet"), new Animation(16, 16, 16, 16)), Color.White, false, null, null));
|
||||
|
||||
|
||||
StorageFurnitureOBJ obj = new StorageFurnitureOBJ(PyTKHelper.CreateOBJData("Omegasis.Revitalize.Furniture.Storage.OakCabinet", TextureManager.GetTexture(ModCore.Manifest, "Furniture", "Oak Cabinet"), typeof(StorageFurnitureTile), Color.White), new BasicItemInformation("Oak Cabinet", "Omegasis.Revitalize.Furniture.Storage.OakCabinet", "A beautiful oak cabinet to place objects inside of.", "Storage", Color.Brown, -300, 0, false, 350, Vector2.Zero, true, true, TextureManager.GetTexture(ModCore.Manifest, "Furniture", "Oak Cabinet"), new AnimationManager(TextureManager.GetExtendedTexture(ModCore.Manifest, "Furniture", "Oak Cabinet"), new Animation(16, 16, 16, 16)), Color.White, false, new InventoryManager(9), null));
|
||||
StorageFurnitureOBJ obj = new StorageFurnitureOBJ(PyTKHelper.CreateOBJData("Omegasis.Revitalize.Furniture.Storage.OakCabinet", TextureManager.GetTexture(ModCore.Manifest, "Furniture", "Oak Cabinet"), typeof(StorageFurnitureTile), Color.White), new BasicItemInformation("Oak Cabinet", "Omegasis.Revitalize.Furniture.Storage.OakCabinet", "A beautiful oak cabinet to place objects inside of.", "Storage", Color.Brown, -300, 0, false, 350, true, true, TextureManager.GetTexture(ModCore.Manifest, "Furniture", "Oak Cabinet"), new AnimationManager(TextureManager.GetExtendedTexture(ModCore.Manifest, "Furniture", "Oak Cabinet"), new Animation(16, 16, 16, 16)), Color.White, false, new InventoryManager(9), null));
|
||||
|
||||
FactoryInfo uL = new FactoryInfo(upperLeft);
|
||||
FactoryInfo uR = new FactoryInfo(upperRight);
|
||||
|
|
|
@ -0,0 +1,62 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Newtonsoft.Json;
|
||||
using Revitalize.Framework.Factories.Objects.Furniture;
|
||||
using Revitalize.Framework.Objects;
|
||||
using Revitalize.Framework.Objects.InformationFiles;
|
||||
using Revitalize.Framework.Objects.Resources.OreVeins;
|
||||
|
||||
namespace Revitalize.Framework.Factories.Objects.Resources
|
||||
{
|
||||
/// <summary>
|
||||
/// Handles serialization of ore veins.
|
||||
/// </summary>
|
||||
public class OreFactoryInfo:FactoryInfo
|
||||
{
|
||||
/// <summary>
|
||||
/// The resource info for ore spawning.
|
||||
/// </summary>
|
||||
|
||||
public OreResourceInformation OreSpawnInfo;
|
||||
/// <summary>
|
||||
/// Extra information that holds drop chances on extra drops.
|
||||
/// </summary>
|
||||
public List<ResourceInformaton> ExtraDrops;
|
||||
/// <summary>
|
||||
/// The health of the ore vein.
|
||||
/// </summary>
|
||||
public int Health;
|
||||
|
||||
/// <summary>
|
||||
/// Empty constructor.
|
||||
/// </summary>
|
||||
public OreFactoryInfo():base()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Constructor.
|
||||
/// </summary>
|
||||
/// <param name="obj"></param>
|
||||
public OreFactoryInfo(OreVeinObj obj):base(obj)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Constructor.
|
||||
/// </summary>
|
||||
/// <param name="tile"></param>
|
||||
public OreFactoryInfo(OreVeinTile tile) : base(tile)
|
||||
{
|
||||
this.OreSpawnInfo = tile.resourceInfo;
|
||||
this.ExtraDrops = tile.extraDrops;
|
||||
this.Health = tile.healthValue;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
|
@ -63,7 +63,7 @@ namespace Revitalize.Framework.Objects
|
|||
|
||||
}
|
||||
|
||||
public BasicItemInformation(string name, string id, string description, string categoryName, Color categoryColor,int edibility, int fragility, bool isLamp, int price, Vector2 TileLocation, bool canBeSetOutdoors, bool canBeSetIndoors, Texture2D texture, AnimationManager animationManager, Color drawColor, bool ignoreBoundingBox, InventoryManager Inventory, LightManager Lights)
|
||||
public BasicItemInformation(string name, string id, string description, string categoryName, Color categoryColor,int edibility, int fragility, bool isLamp, int price, bool canBeSetOutdoors, bool canBeSetIndoors, Texture2D texture, AnimationManager animationManager, Color drawColor, bool ignoreBoundingBox, InventoryManager Inventory, LightManager Lights)
|
||||
{
|
||||
this.name = name;
|
||||
this.id = id;
|
||||
|
@ -104,6 +104,14 @@ namespace Revitalize.Framework.Objects
|
|||
return (this.shakeTimer > 0 ? Game1.random.Next(-1, 2) : 0);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns a copy of this object.
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public BasicItemInformation Copy()
|
||||
{
|
||||
return new BasicItemInformation(this.name, this.id,this.description, this.categoryName, this.categoryColor, this.edibility, this.fragility, this.isLamp, this.price, this.canBeSetOutdoors, this.canBeSetIndoors, this.animationManager.getTexture(), this.animationManager, this.drawColor, this.ignoreBoundingBox, this.inventory, this.lightManager);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,6 +3,7 @@ using System.Collections.Generic;
|
|||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Newtonsoft.Json;
|
||||
using Revitalize.Framework.Utilities;
|
||||
using StardewValley;
|
||||
|
||||
|
@ -20,7 +21,9 @@ namespace Revitalize.Framework.Objects.InformationFiles
|
|||
/// <summary>
|
||||
/// A function that compares whether or not the resource can be spawned on this floor. Used in conjecture with floorsToSpawnOn
|
||||
/// </summary>
|
||||
[JsonIgnore]
|
||||
public Func<int, bool> canSpawnOnThisFloor;
|
||||
[JsonIgnore]
|
||||
public Func<int, bool> excludeSpawnOnThisFloor;
|
||||
|
||||
/// <summary>
|
||||
|
@ -40,7 +43,10 @@ namespace Revitalize.Framework.Objects.InformationFiles
|
|||
/// <summary>
|
||||
/// A function that compares whether or not the resource can be spawned on this floor in skull cave. Used in conjecture with floorsToSpawnOn
|
||||
/// </summary>
|
||||
///
|
||||
[JsonIgnore]
|
||||
public Func<int, bool> canSpawnOnThisFloorSkullCave;
|
||||
[JsonIgnore]
|
||||
public Func<int, bool> excludeSpawnOnThisFloorSkullCave;
|
||||
|
||||
/// <summary>
|
||||
|
|
|
@ -1,9 +1,11 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Revitalize.Framework.Factories.Objects.Resources;
|
||||
using Revitalize.Framework.Objects.InformationFiles;
|
||||
using Revitalize.Framework.Objects.Resources.OreVeins;
|
||||
using Revitalize.Framework.Utilities;
|
||||
|
@ -15,6 +17,9 @@ namespace Revitalize.Framework.Objects
|
|||
{
|
||||
public class ResourceManager
|
||||
{
|
||||
|
||||
private string oreResourceDataPath= Path.Combine("Data", "Objects", "Resources","Ore");
|
||||
|
||||
/// <summary>
|
||||
/// A static reference to the resource manager for quicker access.
|
||||
/// </summary>
|
||||
|
@ -24,6 +29,8 @@ namespace Revitalize.Framework.Objects
|
|||
/// A list of all of the ores held by the resource manager.
|
||||
/// </summary>
|
||||
public Dictionary<string, OreVeinObj> ores;
|
||||
public Dictionary<string, OreResourceInformation> oreResourceInformationTable;
|
||||
|
||||
/// <summary>
|
||||
/// A list of all visited floors on the current visit to the mines.
|
||||
/// </summary>
|
||||
|
@ -36,7 +43,10 @@ namespace Revitalize.Framework.Objects
|
|||
{
|
||||
self = this;
|
||||
this.ores = new Dictionary<string, OreVeinObj>();
|
||||
this.oreResourceInformationTable = new Dictionary<string, OreResourceInformation>();
|
||||
this.visitedFloors = new List<int>();
|
||||
|
||||
this.serializeOre();
|
||||
this.loadOreVeins();
|
||||
}
|
||||
|
||||
|
@ -47,7 +57,7 @@ namespace Revitalize.Framework.Objects
|
|||
{
|
||||
//The pancake ore.
|
||||
|
||||
|
||||
/*
|
||||
OreVeinObj testOre = new OreVeinObj(PyTKHelper.CreateOBJData("Omegasis.Revitalize.Resources.Ore.Test", TextureManager.GetTexture(ModCore.Manifest, "Resources.Ore", "Test"), typeof(OreVeinTile), Color.White), new BasicItemInformation("Test Ore Vein", "Omegasis.Revitalize.Resources.Ore.Test", "A ore vein that is used for testing purposes.", "Revitalize.Ore", Color.Black, -300, 0, false, 350, Vector2.Zero, true, true, TextureManager.GetTexture(ModCore.Manifest, "Resources.Ore", "Test"), new AnimationManager(TextureManager.GetExtendedTexture(ModCore.Manifest, "Resources.Ore", "Test"), new Animation(0, 0, 16, 16)), Color.White, false, null, null));
|
||||
testOre.addComponent(new Vector2(0, 0), new OreVeinTile(PyTKHelper.CreateOBJData("Omegasis.Revitalize.Resources.Ore.Test", TextureManager.GetTexture(ModCore.Manifest, "Resources.Ore", "Test"), typeof(OreVeinTile), Color.White), new BasicItemInformation("Test Ore Vein", "Omegasis.Revitalize.Resources.Ore.Test", "A ore vein that is used for testing purposes.", "Revitalize.Ore", Color.Black, -300, 0, false, 350, Vector2.Zero, true, true, TextureManager.GetTexture(ModCore.Manifest, "Resources.Ore", "Test"), new AnimationManager(TextureManager.GetExtendedTexture(ModCore.Manifest, "Resources.Ore", "Test"), new Animation(0, 0, 16, 16)), Color.White, false, null, null),
|
||||
new InformationFiles.OreResourceInformation(new StardewValley.Object(211, 1), true, true, true, false, new List<IntRange>()
|
||||
|
@ -62,7 +72,74 @@ namespace Revitalize.Framework.Objects
|
|||
}, (i => i == -1), (i => i == -1), 1d, 1.0d, 0.10d, 1d, 1d, 0, 0, 0, 0), new List<ResourceInformaton>(),4));
|
||||
|
||||
this.ores.Add("Omegasis.Revitalize.Resources.Ore.Test", testOre);
|
||||
*/
|
||||
|
||||
if (!Directory.Exists(Path.Combine(ModCore.ModHelper.DirectoryPath, "Content", this.oreResourceDataPath))) Directory.CreateDirectory(Path.Combine(ModCore.ModHelper.DirectoryPath, "Content", this.oreResourceDataPath));
|
||||
List<string> directories = Directory.GetDirectories(Path.Combine(ModCore.ModHelper.DirectoryPath, "Content", this.oreResourceDataPath)).ToList();
|
||||
directories.Add(Path.Combine(ModCore.ModHelper.DirectoryPath, "Content", this.oreResourceDataPath));
|
||||
foreach (string directory in directories)
|
||||
{
|
||||
string[] files = Directory.GetFiles(directory);
|
||||
|
||||
Dictionary<string, OreVeinObj> objs = new Dictionary<string, OreVeinObj>();
|
||||
|
||||
//Deserialize container.
|
||||
foreach (string file in files)
|
||||
{
|
||||
if ((Path.GetFileName(file)).Contains("_") == true) continue;
|
||||
else
|
||||
{
|
||||
OreFactoryInfo factoryInfo = ModCore.Serializer.DeserializeContentFile<OreFactoryInfo>(file);
|
||||
objs.Add(Path.GetFileNameWithoutExtension(file), new OreVeinObj(factoryInfo.PyTkData, factoryInfo.info));
|
||||
}
|
||||
}
|
||||
//Deseralize components
|
||||
foreach (string file in files)
|
||||
{
|
||||
if ((Path.GetFileName(file)).Contains("_") == false) continue;
|
||||
else
|
||||
{
|
||||
|
||||
string[] splits = Path.GetFileNameWithoutExtension(file).Split('_');
|
||||
string name = splits[0];
|
||||
Vector2 offset = new Vector2(Convert.ToInt32(splits[1]), Convert.ToInt32(splits[2]));
|
||||
OreFactoryInfo info = ModCore.Serializer.DeserializeContentFile<OreFactoryInfo>(file);
|
||||
|
||||
OreVeinTile orePiece = new OreVeinTile(info.PyTkData, info.info,info.OreSpawnInfo,info.ExtraDrops,info.Health);
|
||||
objs[name].addComponent(offset, orePiece);
|
||||
}
|
||||
}
|
||||
foreach (var v in objs)
|
||||
{
|
||||
this.ores.Add(v.Value.info.id, v.Value);
|
||||
//ModCore.ObjectManager.lamps.Add(v.Value.info.id, v.Value);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Serializes an example ore to eb
|
||||
/// </summary>
|
||||
private void serializeOre() {
|
||||
OreVeinObj testOre = new OreVeinObj(PyTKHelper.CreateOBJData("Omegasis.Revitalize.Resources.Ore.Test", TextureManager.GetTexture(ModCore.Manifest, "Resources.Ore", "Test"), typeof(OreVeinTile), Color.White), new BasicItemInformation("Test Ore Vein", "Omegasis.Revitalize.Resources.Ore.Test", "A ore vein that is used for testing purposes.", "Revitalize.Ore", Color.Black, -300, 0, false, 350, true, true, TextureManager.GetTexture(ModCore.Manifest, "Resources.Ore", "Test"), new AnimationManager(TextureManager.GetExtendedTexture(ModCore.Manifest, "Resources.Ore", "Test"), new Animation(0, 0, 16, 16)), Color.White, false, null, null));
|
||||
OreVeinTile testOre_0_0= new OreVeinTile(PyTKHelper.CreateOBJData("Omegasis.Revitalize.Resources.Ore.Test", TextureManager.GetTexture(ModCore.Manifest, "Resources.Ore", "Test"), typeof(OreVeinTile), Color.White), new BasicItemInformation("Test Ore Vein", "Omegasis.Revitalize.Resources.Ore.Test", "A ore vein that is used for testing purposes.", "Revitalize.Ore", Color.Black, -300, 0, false, 350, true, true, TextureManager.GetTexture(ModCore.Manifest, "Resources.Ore", "Test"), new AnimationManager(TextureManager.GetExtendedTexture(ModCore.Manifest, "Resources.Ore", "Test"), new Animation(0, 0, 16, 16)), Color.White, false, null, null),
|
||||
new InformationFiles.OreResourceInformation(new StardewValley.Object(211, 1), true, true, true, false, new List<IntRange>()
|
||||
{
|
||||
new IntRange(1,9)
|
||||
}, new List<IntRange>(), (i => i == 1), (i => i % 10 == 0), 1, 5, 1, 10, new IntRange(1, 3), new IntRange(1, 3), new IntRange(0, 0), new List<IntRange>()
|
||||
{
|
||||
new IntRange(0,0)
|
||||
}, new List<IntRange>()
|
||||
{
|
||||
new IntRange(0,9999)
|
||||
}, null,null, 1d, 1.0d, 0.10d, 1d, 1d, 0, 0, 0, 0), new List<ResourceInformaton>(), 4);
|
||||
|
||||
OreFactoryInfo testOre_0_0_file = new OreFactoryInfo(testOre_0_0);
|
||||
OreFactoryInfo testOre_file = new OreFactoryInfo(testOre);
|
||||
|
||||
ModCore.Serializer.SerializeContentFile("TestOre_0_0", testOre_0_0_file, this.oreResourceDataPath);
|
||||
ModCore.Serializer.SerializeContentFile("TestOre", testOre_file, this.oreResourceDataPath);
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -18,7 +18,7 @@ namespace Revitalize.Framework.Objects.Resources.OreVeins
|
|||
/// <summary>
|
||||
/// Deals with information tied to the resource itself.
|
||||
/// </summary>
|
||||
public ResourceInformaton resourceInfo;
|
||||
public OreResourceInformation resourceInfo;
|
||||
public List<ResourceInformaton> extraDrops;
|
||||
public int healthValue;
|
||||
|
||||
|
@ -28,7 +28,7 @@ namespace Revitalize.Framework.Objects.Resources.OreVeins
|
|||
|
||||
}
|
||||
|
||||
public OreVeinTile(CustomObjectData PyTKData, BasicItemInformation Info,ResourceInformaton Resource,List<ResourceInformaton> ExtraDrops,int Health) : base(PyTKData, Info)
|
||||
public OreVeinTile(CustomObjectData PyTKData, BasicItemInformation Info, OreResourceInformation Resource,List<ResourceInformaton> ExtraDrops,int Health) : base(PyTKData, Info)
|
||||
{
|
||||
this.healthValue = Health;
|
||||
this.resourceInfo = Resource;
|
||||
|
@ -36,7 +36,7 @@ namespace Revitalize.Framework.Objects.Resources.OreVeins
|
|||
this.setHealth(this.healthValue);
|
||||
}
|
||||
|
||||
public OreVeinTile(CustomObjectData PyTKData, BasicItemInformation Info, Vector2 TileLocation,ResourceInformaton Resource, List<ResourceInformaton> ExtraDrops,int Health) : base(PyTKData, Info, TileLocation)
|
||||
public OreVeinTile(CustomObjectData PyTKData, BasicItemInformation Info, Vector2 TileLocation, OreResourceInformation Resource, List<ResourceInformaton> ExtraDrops,int Health) : base(PyTKData, Info, TileLocation)
|
||||
{
|
||||
|
||||
this.healthValue = Health;
|
||||
|
|
|
@ -23,7 +23,8 @@ namespace Revitalize.Framework.Utilities.Serialization.Converters
|
|||
Converters = new List<JsonConverter>()
|
||||
{
|
||||
new Framework.Utilities.Serialization.Converters.RectangleConverter(),
|
||||
new Framework.Utilities.Serialization.Converters.Texture2DConverter()
|
||||
new Framework.Utilities.Serialization.Converters.Texture2DConverter(),
|
||||
new Vector2Converter()
|
||||
},
|
||||
Formatting = Formatting.Indented,
|
||||
ReferenceLoopHandling = ReferenceLoopHandling.Ignore,
|
||||
|
@ -39,8 +40,30 @@ namespace Revitalize.Framework.Utilities.Serialization.Converters
|
|||
writer.WriteStartObject();
|
||||
writer.WritePropertyName("Type");
|
||||
serializer.Serialize(writer, value.GetType().FullName.ToString());
|
||||
|
||||
List<PropertyInfo> properties=value.GetType().GetProperties().ToList();
|
||||
List<FieldInfo> fields=value.GetType().GetFields().ToList();
|
||||
|
||||
writer.WritePropertyName("Item");
|
||||
serializer.Serialize(writer, convertedString);
|
||||
writer.WriteStartObject();
|
||||
|
||||
for(int i = 0; i < properties.Count; i++) {
|
||||
PropertyInfo p = properties[i];
|
||||
writer.WritePropertyName(p.Name);
|
||||
serializer.Serialize(writer, p.GetValue(value)!=null? p.GetValue(value).ToString():null);
|
||||
}
|
||||
|
||||
|
||||
foreach (FieldInfo f in fields)
|
||||
{
|
||||
writer.WritePropertyName(f.Name);
|
||||
serializer.Serialize(writer, f.GetValue(value) != null ? f.GetValue(value).ToString() : null);
|
||||
}
|
||||
writer.WriteEndObject();
|
||||
|
||||
//writer.WritePropertyName("Item");
|
||||
|
||||
//serializer.Serialize(writer, convertedString);
|
||||
|
||||
writer.WriteEndObject();
|
||||
}
|
||||
|
|
|
@ -25,11 +25,13 @@ namespace Revitalize.Framework.Utilities.Serialization.Converters
|
|||
|
||||
|
||||
//string str = reader.ReadAsString();
|
||||
str = str.Replace("{", "");
|
||||
str = str.Replace("}", "");
|
||||
str = str.Replace(",", "");
|
||||
|
||||
string[] values = str.Split(' ');
|
||||
double x = Convert.ToDouble(values[0]);
|
||||
double y = Convert.ToDouble(values[1]);
|
||||
double x = Convert.ToDouble(values[0].Split(':')[1]);
|
||||
double y = Convert.ToDouble(values[1].Split(':')[1]);
|
||||
|
||||
|
||||
return new Vector2((float)x, (float)y);
|
||||
|
|
|
@ -182,7 +182,8 @@ namespace Revitalize.Framework.Utilities
|
|||
using (StreamReader sw = new StreamReader(p))
|
||||
using (JsonReader reader = new JsonTextReader(sw))
|
||||
{
|
||||
var obj = this.serializer.Deserialize<T>(reader);
|
||||
|
||||
var obj = this.serializer.Deserialize<T>(reader);
|
||||
return obj;
|
||||
}
|
||||
}
|
||||
|
@ -315,6 +316,12 @@ namespace Revitalize.Framework.Utilities
|
|||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Serializes a content file if it doesn't already exist. If it does exist this does nothing as to not override the content file.
|
||||
/// </summary>
|
||||
/// <param name="fileName">The name to name the file. So a file named MyFile would be a MyFile.json</param>
|
||||
/// <param name="obj">The actual to serialize.</param>
|
||||
/// <param name="extensionFolder">The sub folder path inside of the Content folder for this mod.</param>
|
||||
public void SerializeContentFile(string fileName, object obj,string extensionFolder)
|
||||
{
|
||||
string path = Path.Combine(Revitalize.ModCore.ModHelper.DirectoryPath, "Content", extensionFolder,fileName+ ".json");
|
||||
|
|
|
@ -197,6 +197,7 @@ namespace Revitalize
|
|||
|
||||
this.createDirectories();
|
||||
this.initailizeComponents();
|
||||
Serializer = new Serializer();
|
||||
|
||||
|
||||
playerInfo = new PlayerInfo();
|
||||
|
@ -222,7 +223,7 @@ namespace Revitalize
|
|||
ObjectGroups = new Dictionary<string, MultiTiledObject>();
|
||||
ObjectManager = new ObjectManager(Manifest);
|
||||
|
||||
Serializer = new Serializer();
|
||||
|
||||
ObjectsToDraw = new Dictionary<GameLocation, MultiTiledObject>();
|
||||
|
||||
ModHelper.Events.GameLoop.SaveLoaded += this.GameLoop_SaveLoaded;
|
||||
|
@ -265,14 +266,14 @@ namespace Revitalize
|
|||
private void loadContent()
|
||||
{
|
||||
|
||||
MultiTiledComponent obj = new MultiTiledComponent(PyTKHelper.CreateOBJData("Omegasis.Revitalize.MultiTiledComponent.Test", TextureManager.GetTexture(Manifest, "Furniture", "Oak Chair"), typeof(MultiTiledComponent), Color.White), new BasicItemInformation("CoreObjectTest", "Omegasis.TEST1", "YAY FUN!", "Omegasis.Revitalize.MultiTiledComponent.Test", Color.White, -300, 0, false, 300, Vector2.Zero, true, true, TextureManager.GetTexture(Manifest, "Furniture", "Oak Chair"), new AnimationManager(TextureManager.GetExtendedTexture(Manifest, "Furniture", "Oak Chair"), new Animation(new Rectangle(0, 0, 16, 16))), Color.White, false, null, null));
|
||||
MultiTiledComponent obj2 = new MultiTiledComponent(PyTKHelper.CreateOBJData("Omegasis.Revitalize.MultiTiledComponent.Test", TextureManager.GetTexture(Manifest, "Furniture", "Oak Chair"), typeof(MultiTiledComponent), Color.White), new BasicItemInformation("CoreObjectTest2", "Omegasis.TEST2", "Some fun!", "Omegasis.Revitalize.MultiTiledComponent.Test", Color.White, -300, 0, false, 300, Vector2.Zero, true, true, TextureManager.GetTexture(Manifest, "Furniture", "Oak Chair"), new AnimationManager(TextureManager.GetExtendedTexture(Manifest, "Furniture", "Oak Chair"), new Animation(new Rectangle(0, 16, 16, 16))), Color.White, false, null, null));
|
||||
MultiTiledComponent obj3 = new MultiTiledComponent(PyTKHelper.CreateOBJData("Omegasis.Revitalize.MultiTiledComponent.Test", TextureManager.GetTexture(Manifest, "Furniture", "Oak Chair"), typeof(MultiTiledComponent), Color.White), new BasicItemInformation("CoreObjectTest3", "Omegasis.TEST3", "NoFun", "Omegasis.Revitalize.MultiTiledComponent.Test", Color.White, -300, 0, false, 100, Vector2.Zero, true, true, TextureManager.GetTexture(Manifest, "Furniture", "Oak Chair"), new AnimationManager(TextureManager.GetExtendedTexture(Manifest, "Furniture", "Oak Chair"), new Animation(new Rectangle(0, 32, 16, 16))), Color.Red, false, null, null));
|
||||
MultiTiledComponent obj = new MultiTiledComponent(PyTKHelper.CreateOBJData("Omegasis.Revitalize.MultiTiledComponent.Test", TextureManager.GetTexture(Manifest, "Furniture", "Oak Chair"), typeof(MultiTiledComponent), Color.White), new BasicItemInformation("CoreObjectTest", "Omegasis.TEST1", "YAY FUN!", "Omegasis.Revitalize.MultiTiledComponent.Test", Color.White, -300, 0, false, 300, true, true, TextureManager.GetTexture(Manifest, "Furniture", "Oak Chair"), new AnimationManager(TextureManager.GetExtendedTexture(Manifest, "Furniture", "Oak Chair"), new Animation(new Rectangle(0, 0, 16, 16))), Color.White, false, null, null));
|
||||
MultiTiledComponent obj2 = new MultiTiledComponent(PyTKHelper.CreateOBJData("Omegasis.Revitalize.MultiTiledComponent.Test", TextureManager.GetTexture(Manifest, "Furniture", "Oak Chair"), typeof(MultiTiledComponent), Color.White), new BasicItemInformation("CoreObjectTest2", "Omegasis.TEST2", "Some fun!", "Omegasis.Revitalize.MultiTiledComponent.Test", Color.White, -300, 0, false, 300, true, true, TextureManager.GetTexture(Manifest, "Furniture", "Oak Chair"), new AnimationManager(TextureManager.GetExtendedTexture(Manifest, "Furniture", "Oak Chair"), new Animation(new Rectangle(0, 16, 16, 16))), Color.White, false, null, null));
|
||||
MultiTiledComponent obj3 = new MultiTiledComponent(PyTKHelper.CreateOBJData("Omegasis.Revitalize.MultiTiledComponent.Test", TextureManager.GetTexture(Manifest, "Furniture", "Oak Chair"), typeof(MultiTiledComponent), Color.White), new BasicItemInformation("CoreObjectTest3", "Omegasis.TEST3", "NoFun", "Omegasis.Revitalize.MultiTiledComponent.Test", Color.White, -300, 0, false, 100, true, true, TextureManager.GetTexture(Manifest, "Furniture", "Oak Chair"), new AnimationManager(TextureManager.GetExtendedTexture(Manifest, "Furniture", "Oak Chair"), new Animation(new Rectangle(0, 32, 16, 16))), Color.Red, false, null, null));
|
||||
|
||||
|
||||
obj3.info.lightManager.addLight(new Vector2(Game1.tileSize), new LightSource(4, new Vector2(0, 0), 2.5f, Color.Orange.Invert()), obj3);
|
||||
|
||||
MultiTiledObject bigObject = new MultiTiledObject(PyTKHelper.CreateOBJData("Omegasis.Revitalize.MultiTiledComponent.Test", TextureManager.GetTexture(Manifest, "Furniture", "Oak Chair"), typeof(MultiTiledObject), Color.White), new BasicItemInformation("MultiTest", "Omegasis.BigTiledTest", "A really big object", "Omegasis.Revitalize.MultiTiledObject", Color.Blue, -300, 0, false, 500, Vector2.Zero, true, true, TextureManager.GetTexture(Manifest, "Furniture", "Oak Chair"), new AnimationManager(), Color.White, false, null, null));
|
||||
MultiTiledObject bigObject = new MultiTiledObject(PyTKHelper.CreateOBJData("Omegasis.Revitalize.MultiTiledComponent.Test", TextureManager.GetTexture(Manifest, "Furniture", "Oak Chair"), typeof(MultiTiledObject), Color.White), new BasicItemInformation("MultiTest", "Omegasis.BigTiledTest", "A really big object", "Omegasis.Revitalize.MultiTiledObject", Color.Blue, -300, 0, false, 500, true, true, TextureManager.GetTexture(Manifest, "Furniture", "Oak Chair"), new AnimationManager(), Color.White, false, null, null));
|
||||
|
||||
bigObject.addComponent(new Vector2(0, 0), obj);
|
||||
bigObject.addComponent(new Vector2(1, 0), obj2);
|
||||
|
@ -286,9 +287,9 @@ namespace Revitalize
|
|||
ObjectManager.miscellaneous.Add("Omegasis.BigTiledTest", bigObject);
|
||||
|
||||
|
||||
Framework.Objects.Furniture.RugTileComponent rug1 = new RugTileComponent(PyTKHelper.CreateOBJData("Omegasis.Revitalize.Furniture.Basic.Rugs.TestRug", TextureManager.GetTexture(Manifest, "Furniture", "Oak Chair"), typeof(RugTileComponent), Color.White), new BasicItemInformation("Rug Tile", "Omegasis.Revitalize.Furniture.Basic.Rugs.TestRug", "A rug tile", "Rug", Color.Brown, -300, 0, false, 100, Vector2.Zero, true, true, TextureManager.GetTexture(Manifest, "Furniture", "Oak Chair"), new AnimationManager(TextureManager.GetExtendedTexture(Manifest, "Furniture", "Oak Chair"), new Animation(new Rectangle(0, 0, 16, 16))), Color.White, true, null, null));
|
||||
Framework.Objects.Furniture.RugTileComponent rug1 = new RugTileComponent(PyTKHelper.CreateOBJData("Omegasis.Revitalize.Furniture.Basic.Rugs.TestRug", TextureManager.GetTexture(Manifest, "Furniture", "Oak Chair"), typeof(RugTileComponent), Color.White), new BasicItemInformation("Rug Tile", "Omegasis.Revitalize.Furniture.Basic.Rugs.TestRug", "A rug tile", "Rug", Color.Brown, -300, 0, false, 100, true, true, TextureManager.GetTexture(Manifest, "Furniture", "Oak Chair"), new AnimationManager(TextureManager.GetExtendedTexture(Manifest, "Furniture", "Oak Chair"), new Animation(new Rectangle(0, 0, 16, 16))), Color.White, true, null, null));
|
||||
|
||||
Framework.Objects.Furniture.RugMultiTiledObject rug = new RugMultiTiledObject(PyTKHelper.CreateOBJData("Omegasis.Revitalize.Furniture.Basic.Rugs.TestRug", TextureManager.GetTexture(Manifest, "Furniture", "Oak Chair"), typeof(RugMultiTiledObject), Color.White, false), new BasicItemInformation("Simple Rug Test", "Omegasis.Revitalize.Furniture.Basic.Rugs.TestRug", "A simple rug for testing", "Rugs", Color.Brown, -300, 0, false, 500, Vector2.Zero, true, true, TextureManager.GetTexture(Manifest, "Furniture", "Oak Chair"), new AnimationManager(), Color.White, true, null, null));
|
||||
Framework.Objects.Furniture.RugMultiTiledObject rug = new RugMultiTiledObject(PyTKHelper.CreateOBJData("Omegasis.Revitalize.Furniture.Basic.Rugs.TestRug", TextureManager.GetTexture(Manifest, "Furniture", "Oak Chair"), typeof(RugMultiTiledObject), Color.White, false), new BasicItemInformation("Simple Rug Test", "Omegasis.Revitalize.Furniture.Basic.Rugs.TestRug", "A simple rug for testing", "Rugs", Color.Brown, -300, 0, false, 500, true, true, TextureManager.GetTexture(Manifest, "Furniture", "Oak Chair"), new AnimationManager(), Color.White, true, null, null));
|
||||
|
||||
rug.addComponent(new Vector2(0, 0), rug1);
|
||||
|
||||
|
@ -299,7 +300,7 @@ namespace Revitalize
|
|||
FurnitureFactory.LoadFurnitureFiles();
|
||||
|
||||
SeasideScramble sscGame = new SeasideScramble();
|
||||
ArcadeCabinetTile ssc1 = new ArcadeCabinetTile(PyTKHelper.CreateOBJData("Omegasis.Revitalize.Furniture.Arcade.SeasideScramble", TextureManager.GetTexture(Manifest, "Furniture", "SeasideScrambleArcade"), typeof(ArcadeCabinetTile), Color.White), new BasicItemInformation("Seaside Scramble Arcade Game", "Omegasis.Revitalize.Furniture.Arcade.SeasideScramble", "A arcade to play Seaside Scramble!", "Arcades", Color.LimeGreen, -300, 0, false, 100, Vector2.Zero, true, true, TextureManager.GetTexture(Manifest, "Furniture", "SeasideScrambleArcade"), new AnimationManager(TextureManager.GetExtendedTexture(Manifest, "Furniture", "SeasideScrambleArcade"), new Animation(new Rectangle(0, 0, 16, 16)), new Dictionary<string, List<Animation>>()
|
||||
ArcadeCabinetTile ssc1 = new ArcadeCabinetTile(PyTKHelper.CreateOBJData("Omegasis.Revitalize.Furniture.Arcade.SeasideScramble", TextureManager.GetTexture(Manifest, "Furniture", "SeasideScrambleArcade"), typeof(ArcadeCabinetTile), Color.White), new BasicItemInformation("Seaside Scramble Arcade Game", "Omegasis.Revitalize.Furniture.Arcade.SeasideScramble", "A arcade to play Seaside Scramble!", "Arcades", Color.LimeGreen, -300, 0, false, 100, true, true, TextureManager.GetTexture(Manifest, "Furniture", "SeasideScrambleArcade"), new AnimationManager(TextureManager.GetExtendedTexture(Manifest, "Furniture", "SeasideScrambleArcade"), new Animation(new Rectangle(0, 0, 16, 16)), new Dictionary<string, List<Animation>>()
|
||||
{
|
||||
{"Animated",new List<Animation>()
|
||||
{
|
||||
|
@ -309,7 +310,7 @@ namespace Revitalize
|
|||
}
|
||||
|
||||
}, "Animated"), Color.White, false, null, null), new Framework.Objects.InformationFiles.Furniture.ArcadeCabinetInformation(sscGame, false));
|
||||
ArcadeCabinetTile ssc2 = new ArcadeCabinetTile(PyTKHelper.CreateOBJData("Omegasis.Revitalize.Furniture.Arcade.SeasideScramble", TextureManager.GetTexture(Manifest, "Furniture", "SeasideScrambleArcade"), typeof(ArcadeCabinetTile), Color.White), new BasicItemInformation("Seaside Scramble Arcade Game", "Omegasis.Revitalize.Furniture.Arcade.SeasideScramble", "A arcade to play Seaside Scramble!", "Arcades", Color.LimeGreen, -300, 0, false, 100, Vector2.Zero, true, true, TextureManager.GetTexture(Manifest, "Furniture", "SeasideScrambleArcade"), new AnimationManager(TextureManager.GetExtendedTexture(Manifest, "Furniture", "SeasideScrambleArcade"), new Animation(new Rectangle(0, 16, 16, 16)), new Dictionary<string, List<Animation>>()
|
||||
ArcadeCabinetTile ssc2 = new ArcadeCabinetTile(PyTKHelper.CreateOBJData("Omegasis.Revitalize.Furniture.Arcade.SeasideScramble", TextureManager.GetTexture(Manifest, "Furniture", "SeasideScrambleArcade"), typeof(ArcadeCabinetTile), Color.White), new BasicItemInformation("Seaside Scramble Arcade Game", "Omegasis.Revitalize.Furniture.Arcade.SeasideScramble", "A arcade to play Seaside Scramble!", "Arcades", Color.LimeGreen, -300, 0, false, 100, true, true, TextureManager.GetTexture(Manifest, "Furniture", "SeasideScrambleArcade"), new AnimationManager(TextureManager.GetExtendedTexture(Manifest, "Furniture", "SeasideScrambleArcade"), new Animation(new Rectangle(0, 16, 16, 16)), new Dictionary<string, List<Animation>>()
|
||||
{
|
||||
{"Animated",new List<Animation>()
|
||||
{
|
||||
|
@ -320,7 +321,7 @@ namespace Revitalize
|
|||
|
||||
}, "Animated"), Color.White, false, null, null), new Framework.Objects.InformationFiles.Furniture.ArcadeCabinetInformation(sscGame, false));
|
||||
|
||||
ArcadeCabinetOBJ sscCabinet = new ArcadeCabinetOBJ(PyTKHelper.CreateOBJData("Omegasis.Revitalize.Furniture.Arcade.SeasideScramble", TextureManager.GetTexture(Manifest, "Furniture", "SeasideScrambleArcade"), typeof(ArcadeCabinetOBJ), Color.White, true), new BasicItemInformation("Seaside Scramble Arcade Game", "Omegasis.Revitalize.Furniture.Arcade.SeasideScramble", "A arcade to play Seaside Scramble!", "Arcades", Color.LimeGreen, -300, 0, false, 500, Vector2.Zero, true, true, TextureManager.GetTexture(Manifest, "Furniture", "SeasideScrambleArcade"), new AnimationManager(), Color.White, true, null, null));
|
||||
ArcadeCabinetOBJ sscCabinet = new ArcadeCabinetOBJ(PyTKHelper.CreateOBJData("Omegasis.Revitalize.Furniture.Arcade.SeasideScramble", TextureManager.GetTexture(Manifest, "Furniture", "SeasideScrambleArcade"), typeof(ArcadeCabinetOBJ), Color.White, true), new BasicItemInformation("Seaside Scramble Arcade Game", "Omegasis.Revitalize.Furniture.Arcade.SeasideScramble", "A arcade to play Seaside Scramble!", "Arcades", Color.LimeGreen, -300, 0, false, 500, true, true, TextureManager.GetTexture(Manifest, "Furniture", "SeasideScrambleArcade"), new AnimationManager(), Color.White, true, null, null));
|
||||
sscCabinet.addComponent(new Vector2(0, 0), ssc1);
|
||||
sscCabinet.addComponent(new Vector2(0, 1), ssc2);
|
||||
|
||||
|
|
|
@ -62,6 +62,7 @@
|
|||
<Compile Include="Framework\Factories\Objects\Furniture\ChairFactoryInfo.cs" />
|
||||
<Compile Include="Framework\Factories\Objects\FactoryInfo.cs" />
|
||||
<Compile Include="Framework\Factories\Objects\Furniture\TableFactoryInfo.cs" />
|
||||
<Compile Include="Framework\Factories\Objects\Resources\OreFactoryInfo.cs" />
|
||||
<Compile Include="Framework\Illuminate\ColorExtensions.cs" />
|
||||
<Compile Include="Framework\Illuminate\FakeLightSource.cs" />
|
||||
<Compile Include="Framework\Illuminate\LightManager.cs" />
|
||||
|
|
Loading…
Reference in New Issue