MASSIVE rework of Revitalize. Seperated PyTK obj data from Revitalize data, added dependency to Stardust Core and swapped to Stardust's Tetxure2DExtended and TextureManagers.
This commit is contained in:
parent
251cf49114
commit
d8e7fa3ddb
Binary file not shown.
After Width: | Height: | Size: 1.1 KiB |
Binary file not shown.
After Width: | Height: | Size: 470 B |
Binary file not shown.
After Width: | Height: | Size: 450 B |
|
@ -3,13 +3,18 @@ using System.Collections.Generic;
|
|||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using PyTK.CustomElementHandler;
|
||||
using Revitalize.Framework.Objects;
|
||||
|
||||
namespace Revitalize.Framework.Factories.Objects.Furniture
|
||||
{
|
||||
public class FactoryInfo
|
||||
{
|
||||
/// <summary>
|
||||
/// Revitalize's extra info tacked on.
|
||||
/// </summary>
|
||||
public BasicItemInformation info;
|
||||
public CustomObjectData PyTkData;
|
||||
|
||||
public FactoryInfo()
|
||||
{
|
||||
|
@ -19,11 +24,13 @@ namespace Revitalize.Framework.Factories.Objects.Furniture
|
|||
public FactoryInfo(MultiTiledObject obj)
|
||||
{
|
||||
this.info = obj.info;
|
||||
this.PyTkData = obj.data;
|
||||
}
|
||||
|
||||
public FactoryInfo(MultiTiledComponent component)
|
||||
{
|
||||
this.info = component.info;
|
||||
this.PyTkData = component.data;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -18,16 +18,14 @@ namespace Revitalize.Framework.Factories.Objects.Furniture
|
|||
|
||||
}
|
||||
|
||||
public ChairFactoryInfo(ChairMultiTiledObject chair)
|
||||
public ChairFactoryInfo(ChairMultiTiledObject chair): base(chair)
|
||||
{
|
||||
this.chairInfo = null;
|
||||
this.info = chair.info;
|
||||
}
|
||||
|
||||
public ChairFactoryInfo(ChairTileComponent chair)
|
||||
public ChairFactoryInfo(ChairTileComponent chair):base(chair)
|
||||
{
|
||||
this.chairInfo = chair.furnitureInfo;
|
||||
this.info = chair.info;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -11,15 +11,22 @@ using Revitalize.Framework.Graphics.Animations;
|
|||
using Revitalize.Framework.Illuminate;
|
||||
using Revitalize.Framework.Objects;
|
||||
using Revitalize.Framework.Objects.Furniture;
|
||||
using Revitalize.Framework.Objects.InformationFiles.Furniture;
|
||||
using Revitalize.Framework.Utilities;
|
||||
using StardewValley;
|
||||
using StardustCore.UIUtilities;
|
||||
|
||||
namespace Revitalize.Framework.Factories.Objects
|
||||
{
|
||||
//TODO: Add Rugs
|
||||
//Add Benches
|
||||
//Add dressers for storage/appearance change (create this)
|
||||
//Create portable beds???
|
||||
public class FurnitureFactory
|
||||
{
|
||||
public static string ChairFolder = Path.Combine("Objects", "Furniture", "Chairs");
|
||||
public static string TablesFolder = Path.Combine("Objects", "Furniture", "Tables");
|
||||
public static string LampsFolder = Path.Combine("Objects", "Furniture", "Lamps");
|
||||
public static string ChairFolder = Path.Combine("Data", "Furniture", "Chairs");
|
||||
public static string TablesFolder = Path.Combine("Data", "Furniture", "Tables");
|
||||
public static string LampsFolder = Path.Combine("Data", "Furniture", "Lamps");
|
||||
|
||||
public static void LoadFurnitureFiles()
|
||||
{
|
||||
|
@ -45,16 +52,20 @@ namespace Revitalize.Framework.Factories.Objects
|
|||
SerializeLamps();
|
||||
DeserializeLamps();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Serialize a lamp to a .json file for easier creation of like objects.
|
||||
/// </summary>
|
||||
private static void SerializeLamps()
|
||||
{
|
||||
LampTileComponent lampTop = new LampTileComponent(new BasicItemInformation("Oak Lamp", "A basic wooden light", "Lamps", Color.Brown, -300, 0, false, 100, Vector2.Zero, true, true, "Omegasis.Revitalize.Furniture.Lamps.OakLamp", "2048/0/-300/Crafting -9/Play '2048 by Platonymous' at home!/true/true/0/2048", TextureManager.TextureManagers[ModCore.Manifest.UniqueID]["Furniture"].getTexture("Oak Lamp").texture, Color.White, 0, true, typeof(Framework.Objects.Furniture.LampTileComponent), null, new AnimationManager(TextureManager.TextureManagers[ModCore.Manifest.UniqueID]["Furniture"].getTexture("Oak Lamp"), new Animation(new Rectangle(0, 0, 16, 16))), Color.White, true, new Framework.Utilities.InventoryManager(), new LightManager()));
|
||||
LampTileComponent lampMiddle = new LampTileComponent(new BasicItemInformation("Oak Lamp", "A basic wooden light", "Lamps", Color.Brown, -300, 0, false, 100, Vector2.Zero, true, true, "Omegasis.Revitalize.Furniture.Lamps.OakLamp", "2048/0/-300/Crafting -9/Play '2048 by Platonymous' at home!/true/true/0/2048", TextureManager.TextureManagers[ModCore.Manifest.UniqueID]["Furniture"].getTexture("Oak Lamp").texture, Color.White, 0, true, typeof(Framework.Objects.Furniture.LampTileComponent), null, new AnimationManager(TextureManager.TextureManagers[ModCore.Manifest.UniqueID]["Furniture"].getTexture("Oak Lamp"), new Animation(new Rectangle(0, 16, 16, 16))), Color.White, false, new Framework.Utilities.InventoryManager(), new LightManager()));
|
||||
LampTileComponent lampBottom = new LampTileComponent(new BasicItemInformation("Oak Lamp", "A basic wooden light", "Lamps", Color.Brown, -300, 0, false, 100, Vector2.Zero, true, true, "Omegasis.Revitalize.Furniture.Lamps.OakLamp", "2048/0/-300/Crafting -9/Play '2048 by Platonymous' at home!/true/true/0/2048", TextureManager.TextureManagers[ModCore.Manifest.UniqueID]["Furniture"].getTexture("Oak Lamp").texture, Color.White, 0, true, typeof(Framework.Objects.Furniture.LampTileComponent), null, new AnimationManager(TextureManager.TextureManagers[ModCore.Manifest.UniqueID]["Furniture"].getTexture("Oak Lamp"), new Animation(new Rectangle(0, 32, 16, 16))), Color.White, false, new Framework.Utilities.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, 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 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()));
|
||||
|
||||
lampMiddle.lights.addLight(new Vector2(Game1.tileSize), new LightSource(4, new Vector2(0, 0), 2.5f, Color.Orange.Invert()), lampMiddle);
|
||||
|
||||
LampMultiTiledObject lamp = new LampMultiTiledObject(new BasicItemInformation("Oak Lamp", "A basic wooden light", "Lamps", Color.Brown, -300, 0, false, 100, Vector2.Zero, true, true, "Omegasis.Revitalize.Furniture.Lamps.OakLamp", "2048/0/-300/Crafting -9/Play '2048 by Platonymous' at home!/true/true/0/2048", TextureManager.TextureManagers[ModCore.Manifest.UniqueID]["Furniture"].getTexture("Oak Lamp").texture, Color.White, 0, true, typeof(Framework.Objects.Furniture.LampTileComponent), null, new AnimationManager(TextureManager.TextureManagers[ModCore.Manifest.UniqueID]["Furniture"].getTexture("Oak Lamp"), new Animation(new Rectangle(0, 0, 16, 16))), Color.White, true, new Framework.Utilities.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, Vector2.Zero, 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);
|
||||
lamp.addComponent(new Vector2(0, 0), lampBottom);
|
||||
|
@ -90,7 +101,8 @@ namespace Revitalize.Framework.Factories.Objects
|
|||
if ((Path.GetFileName(file)).Contains("_") == true) continue;
|
||||
else
|
||||
{
|
||||
objs.Add(Path.GetFileNameWithoutExtension(file), new LampMultiTiledObject(ModCore.Serializer.DeserializeContentFile<FactoryInfo>(file).info));
|
||||
FactoryInfo factoryInfo = ModCore.Serializer.DeserializeContentFile<FactoryInfo>(file);
|
||||
objs.Add(Path.GetFileNameWithoutExtension(file), new LampMultiTiledObject(factoryInfo.PyTkData,factoryInfo.info));
|
||||
}
|
||||
}
|
||||
//Deseralize components
|
||||
|
@ -105,7 +117,7 @@ namespace Revitalize.Framework.Factories.Objects
|
|||
Vector2 offset = new Vector2(Convert.ToInt32(splits[1]), Convert.ToInt32(splits[2]));
|
||||
FactoryInfo info = ModCore.Serializer.DeserializeContentFile<FactoryInfo>(file);
|
||||
|
||||
LampTileComponent lampPiece = new LampTileComponent(info.info);
|
||||
LampTileComponent lampPiece = new LampTileComponent(info.PyTkData,info.info);
|
||||
//Recreate the lights info.
|
||||
if (lampPiece.lights != null)
|
||||
{
|
||||
|
@ -130,12 +142,12 @@ namespace Revitalize.Framework.Factories.Objects
|
|||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Serialize all chair basic information to a file to have as a reference for making other like objects.
|
||||
/// </summary>
|
||||
private static void SerializeChairs()
|
||||
{
|
||||
Framework.Objects.Furniture.ChairTileComponent chairTop = new Framework.Objects.Furniture.ChairTileComponent(new BasicItemInformation("Oak Chair", "A basic wooden chair", "Chairs", Color.Brown, -300, 0, false, 100, Vector2.Zero, true, true, "Omegasis.Revitalize.Furniture.Chairs.OakChair", "2048/0/-300/Crafting -9/Play '2048 by Platonymous' at home!/true/true/0/2048", TextureManager.TextureManagers[ModCore.Manifest.UniqueID]["Furniture"].getTexture("Oak Chair").texture, Color.White, 0, true, typeof(Framework.Objects.Furniture.ChairTileComponent), null, new AnimationManager(TextureManager.TextureManagers[ModCore.Manifest.UniqueID]["Furniture"].getTexture("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, 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>>() {
|
||||
{ "Default_" + (int)Framework.Enums.Direction.Down , new List<Animation>()
|
||||
{
|
||||
new Animation(new Rectangle(0,0,16,16))
|
||||
|
@ -176,8 +188,10 @@ namespace Revitalize.Framework.Factories.Objects
|
|||
new Animation(new Rectangle(48,0,16,16))
|
||||
}
|
||||
}
|
||||
}, "Default_" + (int)Framework.Enums.Direction.Down), Color.White, true, new Framework.Utilities.InventoryManager(), new LightManager()), new Framework.Objects.InformationFiles.Furniture.ChairInformation(false));
|
||||
Framework.Objects.Furniture.ChairTileComponent chairBottom = new Framework.Objects.Furniture.ChairTileComponent(new BasicItemInformation("Oak Chair", "A basic wooden chair", "Chairs", Color.Brown, -300, 0, false, 100, Vector2.Zero, true, true, "Omegasis.Revitalize.Furniture.Chairs.OakChair", "2048/0/-300/Crafting -9/Play '2048 by Platonymous' at home!/true/true/0/2048", Framework.Graphics.TextureManager.TextureManagers[ModCore.Manifest.UniqueID]["Furniture"].getTexture("Oak Chair").texture, Color.White, 0, true, typeof(Framework.Objects.Furniture.ChairTileComponent), null, 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), 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>>() {
|
||||
{ "Default_" + (int)Framework.Enums.Direction.Down , new List<Animation>()
|
||||
{
|
||||
new Animation(new Rectangle(0,16,16,16))
|
||||
|
@ -218,8 +232,10 @@ namespace Revitalize.Framework.Factories.Objects
|
|||
new Animation(new Rectangle(48,16,16,16))
|
||||
}
|
||||
}
|
||||
}, "Default_" + (int)Framework.Enums.Direction.Down), Color.White, false, new Framework.Utilities.InventoryManager(), new LightManager()), new Framework.Objects.InformationFiles.Furniture.ChairInformation(true));
|
||||
Framework.Objects.Furniture.ChairMultiTiledObject oakChair = new Framework.Objects.Furniture.ChairMultiTiledObject(new BasicItemInformation("Oak Chair", "A wood chair you can place anywhere.", "Chair", Color.White, -300, 0, true, 100, Vector2.Zero, true, true, "Omegasis.Revitalize.Furniture.Chairs.OakChair", "2048/0/-300/Crafting -9/Play '2048 by Platonymous' at home!/true/true/0/2048", TextureManager.TextureManagers[ModCore.Manifest.UniqueID]["Furniture"].getTexture("Oak Chair").texture, Color.White, 0, true, typeof(Revitalize.Framework.Objects.Furniture.ChairMultiTiledObject), null, new AnimationManager(), Color.White, false, new Framework.Utilities.InventoryManager(), new LightManager()));
|
||||
}, "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));
|
||||
|
||||
|
||||
ChairFactoryInfo top = new ChairFactoryInfo(chairTop);
|
||||
ChairFactoryInfo bottom = new ChairFactoryInfo(chairBottom);
|
||||
|
@ -247,7 +263,8 @@ namespace Revitalize.Framework.Factories.Objects
|
|||
if ((Path.GetFileName(file)).Contains("_") == true) continue;
|
||||
else
|
||||
{
|
||||
chairObjects.Add(Path.GetFileNameWithoutExtension(file), new ChairMultiTiledObject(ModCore.Serializer.DeserializeContentFile<ChairFactoryInfo>(file).info));
|
||||
ChairFactoryInfo factoryInfo = ModCore.Serializer.DeserializeContentFile<ChairFactoryInfo>(file);
|
||||
chairObjects.Add(Path.GetFileNameWithoutExtension(file), new ChairMultiTiledObject(factoryInfo.PyTkData,factoryInfo.info));
|
||||
}
|
||||
}
|
||||
//Deseralize components
|
||||
|
@ -261,7 +278,7 @@ namespace Revitalize.Framework.Factories.Objects
|
|||
string name = splits[0];
|
||||
Vector2 offset = new Vector2(Convert.ToInt32(splits[1]), Convert.ToInt32(splits[2]));
|
||||
ChairFactoryInfo info = ModCore.Serializer.DeserializeContentFile<ChairFactoryInfo>(file);
|
||||
chairObjects[name].addComponent(offset, new ChairTileComponent(info.info, info.chairInfo));
|
||||
chairObjects[name].addComponent(offset, new ChairTileComponent(info.PyTkData,info.info, info.chairInfo));
|
||||
}
|
||||
}
|
||||
foreach (var v in chairObjects)
|
||||
|
@ -273,14 +290,14 @@ namespace Revitalize.Framework.Factories.Objects
|
|||
|
||||
private static void SerializeTableFiles()
|
||||
{
|
||||
TableTileComponent upperLeft = new TableTileComponent(new BasicItemInformation("Oak Table", "A simple oak table to hold things.", "Tables", Color.White, -300, 0, false, 100, Vector2.Zero, true, true, "Omegasis.Revitalize.Furniture.Tables.OakTable", "2048/0/-300/Crafting -9/Play '2048 by Platonymous' at home!/true/true/0/2048", TextureManager.TextureManagers[ModCore.Manifest.UniqueID]["Furniture"].getTexture("Oak Table").texture, Color.White, 0, true, typeof(TableTileComponent), null, new AnimationManager(TextureManager.TextureManagers[ModCore.Manifest.UniqueID]["Furniture"].getTexture("Oak Table"), new Animation(new Rectangle(0, 0, 16, 16), -1)), Color.White, true, new Utilities.InventoryManager(), new LightManager()), new Framework.Objects.InformationFiles.Furniture.TableInformation(true));
|
||||
TableTileComponent upperRight = new TableTileComponent(new BasicItemInformation("Oak Table", "A simple oak table to hold things.", "Tables", Color.White, -300, 0, false, 100, Vector2.Zero, true, true, "Omegasis.Revitalize.Furniture.Tables.OakTable", "2048/0/-300/Crafting -9/Play '2048 by Platonymous' at home!/true/true/0/2048", TextureManager.TextureManagers[ModCore.Manifest.UniqueID]["Furniture"].getTexture("Oak Table").texture, Color.White, 0, true, typeof(TableTileComponent), null, new AnimationManager(TextureManager.TextureManagers[ModCore.Manifest.UniqueID]["Furniture"].getTexture("Oak Table"), new Animation(new Rectangle(16, 0, 16, 16), -1)), Color.White, true, new Utilities.InventoryManager(), new LightManager()), new Framework.Objects.InformationFiles.Furniture.TableInformation(true));
|
||||
TableTileComponent centerLeft = new TableTileComponent(new BasicItemInformation("Oak Table", "A simple oak table to hold things.", "Tables", Color.White, -300, 0, false, 100, Vector2.Zero, true, true, "Omegasis.Revitalize.Furniture.Tables.OakTable", "2048/0/-300/Crafting -9/Play '2048 by Platonymous' at home!/true/true/0/2048", TextureManager.TextureManagers[ModCore.Manifest.UniqueID]["Furniture"].getTexture("Oak Table").texture, Color.White, 0, true, typeof(TableTileComponent), null, new AnimationManager(TextureManager.TextureManagers[ModCore.Manifest.UniqueID]["Furniture"].getTexture("Oak Table"), new Animation(new Rectangle(0, 16, 16, 16), -1)), Color.White, false, new Utilities.InventoryManager(), new LightManager()), new Framework.Objects.InformationFiles.Furniture.TableInformation(true));
|
||||
TableTileComponent centerRight = new TableTileComponent(new BasicItemInformation("Oak Table", "A simple oak table to hold things.", "Tables", Color.White, -300, 0, false, 100, Vector2.Zero, true, true, "Omegasis.Revitalize.Furniture.Tables.OakTable", "2048/0/-300/Crafting -9/Play '2048 by Platonymous' at home!/true/true/0/2048", TextureManager.TextureManagers[ModCore.Manifest.UniqueID]["Furniture"].getTexture("Oak Table").texture, Color.White, 0, true, typeof(TableTileComponent), null, new AnimationManager(TextureManager.TextureManagers[ModCore.Manifest.UniqueID]["Furniture"].getTexture("Oak Table"), new Animation(new Rectangle(16, 16, 16, 16), -1)), Color.White, false, new Utilities.InventoryManager(), new LightManager()), new Framework.Objects.InformationFiles.Furniture.TableInformation(true));
|
||||
TableTileComponent bottomLeft = new TableTileComponent(new BasicItemInformation("Oak Table", "A simple oak table to hold things.", "Tables", Color.White, -300, 0, false, 100, Vector2.Zero, true, true, "Omegasis.Revitalize.Furniture.Tables.OakTable", "2048/0/-300/Crafting -9/Play '2048 by Platonymous' at home!/true/true/0/2048", TextureManager.TextureManagers[ModCore.Manifest.UniqueID]["Furniture"].getTexture("Oak Table").texture, Color.White, 0, true, typeof(TableTileComponent), null, new AnimationManager(TextureManager.TextureManagers[ModCore.Manifest.UniqueID]["Furniture"].getTexture("Oak Table"), new Animation(new Rectangle(0, 32, 16, 16), -1)), Color.White, false, new Utilities.InventoryManager(), new LightManager()), new Framework.Objects.InformationFiles.Furniture.TableInformation(true));
|
||||
TableTileComponent bottomRight = new TableTileComponent(new BasicItemInformation("Oak Table", "A simple oak table to hold things.", "Tables", Color.White, -300, 0, false, 100, Vector2.Zero, true, true, "Omegasis.Revitalize.Furniture.Tables.OakTable", "2048/0/-300/Crafting -9/Play '2048 by Platonymous' at home!/true/true/0/2048", TextureManager.TextureManagers[ModCore.Manifest.UniqueID]["Furniture"].getTexture("Oak Table").texture, Color.White, 0, true, typeof(TableTileComponent), null, new AnimationManager(TextureManager.TextureManagers[ModCore.Manifest.UniqueID]["Furniture"].getTexture("Oak Table"), new Animation(new Rectangle(16, 32, 16, 16), -1)), Color.White, false, new Utilities.InventoryManager(), new LightManager()), new Framework.Objects.InformationFiles.Furniture.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, 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));
|
||||
|
||||
TableMultiTiledObject obj = new TableMultiTiledObject(new BasicItemInformation("Oak Table", "A simple oak table to hold things.", "Tables", Color.White, -300, 0, false, 350, Vector2.Zero, true, true, "Omegasis.Revitalize.Furniture.Tables.OakTable", "2048/0/-300/Crafting -9/Play '2048 by Platonymous' at home!/true/true/0/2048", TextureManager.TextureManagers[ModCore.Manifest.UniqueID]["Furniture"].getTexture("Oak Table").texture, Color.White, 0, true, typeof(TableMultiTiledObject), null, new AnimationManager(), Color.White, false, new Utilities.InventoryManager(), new LightManager()));
|
||||
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));
|
||||
|
||||
TableFactoryInfo uL = new TableFactoryInfo(upperLeft);
|
||||
TableFactoryInfo uR = new TableFactoryInfo(upperRight);
|
||||
|
@ -321,7 +338,8 @@ namespace Revitalize.Framework.Factories.Objects
|
|||
if ((Path.GetFileName(file)).Contains("_") == true) continue;
|
||||
else
|
||||
{
|
||||
chairObjects.Add(Path.GetFileNameWithoutExtension(file), new TableMultiTiledObject(ModCore.Serializer.DeserializeContentFile<TableFactoryInfo>(file).info));
|
||||
TableFactoryInfo factoryInfo = ModCore.Serializer.DeserializeContentFile<TableFactoryInfo>(file);
|
||||
chairObjects.Add(Path.GetFileNameWithoutExtension(file), new TableMultiTiledObject(factoryInfo.PyTkData,factoryInfo.info));
|
||||
}
|
||||
}
|
||||
//Deseralize components
|
||||
|
@ -335,7 +353,7 @@ namespace Revitalize.Framework.Factories.Objects
|
|||
string name = splits[0];
|
||||
Vector2 offset = new Vector2(Convert.ToInt32(splits[1]), Convert.ToInt32(splits[2]));
|
||||
TableFactoryInfo info = ModCore.Serializer.DeserializeContentFile<TableFactoryInfo>(file);
|
||||
chairObjects[name].addComponent(offset, new TableTileComponent(info.info, info.tableInfo));
|
||||
chairObjects[name].addComponent(offset, new TableTileComponent(info.PyTkData,info.info, info.tableInfo));
|
||||
}
|
||||
}
|
||||
foreach (var v in chairObjects)
|
||||
|
@ -354,6 +372,10 @@ namespace Revitalize.Framework.Factories.Objects
|
|||
{
|
||||
return (TableMultiTiledObject)ModCore.GetObjectFromPool(name);
|
||||
}
|
||||
public static LampMultiTiledObject GetLamp(string name)
|
||||
{
|
||||
return (LampMultiTiledObject)ModCore.GetObjectFromPool(name);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -19,15 +19,13 @@ namespace Revitalize.Framework.Factories.Objects.Furniture
|
|||
|
||||
}
|
||||
|
||||
public TableFactoryInfo(TableTileComponent table)
|
||||
public TableFactoryInfo(TableTileComponent table):base(table)
|
||||
{
|
||||
this.info= table.info;
|
||||
this.tableInfo = table.furnitureInfo;
|
||||
}
|
||||
|
||||
public TableFactoryInfo(TableMultiTiledObject table)
|
||||
public TableFactoryInfo(TableMultiTiledObject table):base(table)
|
||||
{
|
||||
this.info = table.info;
|
||||
this.tableInfo = null;
|
||||
}
|
||||
|
||||
|
|
|
@ -26,6 +26,13 @@ namespace Revitalize.Framework.Graphics.Animations
|
|||
this.frameDuration = -1;
|
||||
}
|
||||
|
||||
public Animation(int xPos, int yPos, int width, int height)
|
||||
{
|
||||
this.sourceRectangle = new Rectangle(xPos, yPos, width, height);
|
||||
this.frameCountUntilNextAnimation = -1;
|
||||
this.frameDuration = -1;
|
||||
}
|
||||
|
||||
/// <summary>Constructor that causes the animation frame count to be set to -1; This forces it to never change.</summary>
|
||||
/// <param name="SourceRectangle">The draw source for this animation.</param>
|
||||
public Animation(Rectangle SourceRectangle)
|
||||
|
|
|
@ -3,6 +3,7 @@ using System.Collections.Generic;
|
|||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using StardewValley;
|
||||
using StardustCore.UIUtilities;
|
||||
|
||||
namespace Revitalize.Framework.Graphics.Animations
|
||||
{
|
||||
|
|
|
@ -1,112 +0,0 @@
|
|||
using System.IO;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using StardewModdingAPI;
|
||||
using StardewValley;
|
||||
|
||||
namespace Revitalize.Framework.Graphics
|
||||
{
|
||||
public class Texture2DExtended
|
||||
{
|
||||
public string Name;
|
||||
public Texture2D texture;
|
||||
public string path;
|
||||
public string modID;
|
||||
public ContentSource source;
|
||||
private readonly IModHelper helper;
|
||||
private readonly IContentPack content;
|
||||
|
||||
/// <summary>Empty/null constructor.</summary>
|
||||
public Texture2DExtended()
|
||||
{
|
||||
this.Name = "";
|
||||
this.texture = null;
|
||||
this.path = "";
|
||||
this.helper = null;
|
||||
this.modID = "";
|
||||
}
|
||||
|
||||
|
||||
/// <summary>Construct an instance.</summary>
|
||||
/// <param name="path">The relative path to file on disk. See StardustCore.Utilities.getRelativePath(modname,path);
|
||||
public Texture2DExtended(IModHelper helper, IManifest manifest, string path, ContentSource contentSource = ContentSource.ModFolder)
|
||||
{
|
||||
this.Name = Path.GetFileNameWithoutExtension(path);
|
||||
this.path = path;
|
||||
this.texture = helper.Content.Load<Texture2D>(path, contentSource);
|
||||
this.helper = helper;
|
||||
this.modID = manifest.UniqueID;
|
||||
this.source = contentSource;
|
||||
}
|
||||
|
||||
public Texture2DExtended(IModHelper helper, string modID, string path, ContentSource contentSource = ContentSource.ModFolder)
|
||||
{
|
||||
this.Name = Path.GetFileNameWithoutExtension(path);
|
||||
this.path = path;
|
||||
this.texture = helper.Content.Load<Texture2D>(path, contentSource);
|
||||
this.helper = helper;
|
||||
this.modID = modID;
|
||||
this.source = contentSource;
|
||||
}
|
||||
|
||||
public Texture2DExtended(IContentPack ContentPack, IManifest manifest, string path)
|
||||
{
|
||||
this.Name = Path.GetFileNameWithoutExtension(path);
|
||||
this.path = path;
|
||||
this.texture = ContentPack.LoadAsset<Texture2D>(path);
|
||||
this.helper = null;
|
||||
this.modID = manifest.UniqueID;
|
||||
this.source = ContentSource.ModFolder;
|
||||
}
|
||||
public Texture2DExtended(IContentPack ContentPack, string modID, string path)
|
||||
{
|
||||
this.Name = Path.GetFileNameWithoutExtension(path);
|
||||
this.path = path;
|
||||
this.texture = ContentPack.LoadAsset<Texture2D>(path);
|
||||
this.helper = null;
|
||||
this.modID = modID;
|
||||
this.source = ContentSource.ModFolder;
|
||||
}
|
||||
|
||||
public Texture2DExtended(IContentPack content, string path)
|
||||
{
|
||||
this.Name = Path.GetFileNameWithoutExtension(path);
|
||||
this.path = path;
|
||||
this.content = content;
|
||||
this.texture = content.LoadAsset<Texture2D>(path);
|
||||
this.helper = null;
|
||||
this.modID = content.Manifest.UniqueID;
|
||||
}
|
||||
|
||||
public Texture2DExtended Copy()
|
||||
{
|
||||
if (this.helper != null)
|
||||
{
|
||||
return new Texture2DExtended(this.helper, this.modID, this.path);
|
||||
}
|
||||
else if (this.content != null)
|
||||
{
|
||||
return new Texture2DExtended(this.content, this.path);
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new System.Exception("Trying to copy a texture that isn't from a mod or a content pack!!!");
|
||||
}
|
||||
}
|
||||
|
||||
public IModHelper getHelper()
|
||||
{
|
||||
return this.helper;
|
||||
}
|
||||
|
||||
/// <summary>Returns the actual 2D texture held by this wrapper class.</summary>
|
||||
public Texture2D getTexture()
|
||||
{
|
||||
return this.texture;
|
||||
}
|
||||
|
||||
public void setTexure(Texture2D text)
|
||||
{
|
||||
this.texture = text;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,195 +0,0 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using StardewModdingAPI;
|
||||
using StardewValley;
|
||||
|
||||
namespace Revitalize.Framework.Graphics
|
||||
{
|
||||
public class TextureManager
|
||||
{
|
||||
public static Dictionary<string, Dictionary<string,TextureManager>> TextureManagers = new Dictionary<string,Dictionary<string,TextureManager>>();
|
||||
|
||||
|
||||
public Dictionary<string, Texture2DExtended> textures;
|
||||
|
||||
public string name;
|
||||
|
||||
public TextureManager(string Name)
|
||||
{
|
||||
this.name = Name;
|
||||
this.textures = new Dictionary<string, Texture2DExtended>();
|
||||
}
|
||||
|
||||
|
||||
public TextureManager(string Name,IContentPack ContentPack)
|
||||
{
|
||||
this.name = Name;
|
||||
this.textures = new Dictionary<string, Texture2DExtended>();
|
||||
}
|
||||
|
||||
public void addTexture(string name, Texture2DExtended texture)
|
||||
{
|
||||
this.textures.Add(name, texture);
|
||||
}
|
||||
|
||||
/// <summary>Returns a Texture2DExtended held by the manager.</summary>
|
||||
public Texture2DExtended getTexture(string name)
|
||||
{
|
||||
foreach (var v in this.textures)
|
||||
{
|
||||
if (v.Key == name)
|
||||
return v.Value.Copy();
|
||||
}
|
||||
throw new Exception("Error, texture name not found!!!");
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Content pack search.
|
||||
/// </summary>
|
||||
public void searchForTextures(IContentPack content,string RelativePath)
|
||||
{
|
||||
if (string.IsNullOrEmpty(RelativePath))
|
||||
{
|
||||
string path = content.DirectoryPath;
|
||||
this.searchDirectories(path, "", content);
|
||||
}
|
||||
else
|
||||
{
|
||||
string path =Path.Combine(content.DirectoryPath,RelativePath);
|
||||
this.searchDirectories(path, RelativePath, content);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Non-Content pack search.
|
||||
/// </summary>
|
||||
public void searchForTextures(string RelativePath="")
|
||||
{
|
||||
if (string.IsNullOrEmpty(RelativePath))
|
||||
{
|
||||
string path = ModCore.ModHelper.DirectoryPath;
|
||||
this.searchDirectories(path, "", ModCore.Manifest);
|
||||
}
|
||||
else
|
||||
{
|
||||
string path = Path.Combine(ModCore.ModHelper.DirectoryPath,RelativePath);
|
||||
this.searchDirectories(path, RelativePath, ModCore.Manifest);
|
||||
}
|
||||
}
|
||||
|
||||
private void searchDirectories(string path, string relativePath, IManifest manifest)
|
||||
{
|
||||
string[] dirs = Directory.GetDirectories(path);
|
||||
string[] files = Directory.GetFiles(path);
|
||||
|
||||
string[] extensions = new string[2]
|
||||
{
|
||||
".png",
|
||||
".jpg"
|
||||
};
|
||||
|
||||
foreach (string directory in dirs)
|
||||
{
|
||||
string combo = string.IsNullOrEmpty(relativePath) ? Path.GetFileName(directory) : Path.Combine(relativePath, Path.GetFileName(directory));
|
||||
this.searchDirectories(directory, combo, manifest);
|
||||
}
|
||||
|
||||
foreach (string file in files)
|
||||
{
|
||||
if (extensions.Contains(Path.GetExtension(file)))
|
||||
{
|
||||
this.processFoundTexture(file, relativePath);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
private void searchDirectories(string path, string relativePath, IContentPack ContentPack)
|
||||
{
|
||||
string[] dirs = Directory.GetDirectories(path);
|
||||
string[] files = Directory.GetFiles(path);
|
||||
|
||||
string[] extensions = new string[2]
|
||||
{
|
||||
".png",
|
||||
".jpg"
|
||||
};
|
||||
|
||||
foreach (string directory in dirs)
|
||||
{
|
||||
string combo = string.IsNullOrEmpty(relativePath) ? Path.GetFileName(directory) : Path.Combine(relativePath, Path.GetFileName(directory));
|
||||
this.searchDirectories(directory, combo, ContentPack);
|
||||
}
|
||||
|
||||
foreach (string file in files)
|
||||
{
|
||||
if (extensions.Contains(Path.GetExtension(file)))
|
||||
{
|
||||
this.processFoundTexture(file, relativePath, ContentPack);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void processFoundTexture(string file, string relativePath)
|
||||
{
|
||||
Texture2DExtended textureExtended = new Texture2DExtended(ModCore.ModHelper, ModCore.Manifest, Path.Combine(relativePath, Path.GetFileName(file)));
|
||||
|
||||
ModCore.log("Found texture: " + textureExtended.Name);
|
||||
|
||||
textureExtended.texture.Name = ModCore.Manifest.UniqueID+"_"+this.name + "_" + textureExtended.Name;
|
||||
|
||||
this.addTexture(textureExtended.Name, textureExtended);
|
||||
}
|
||||
|
||||
private void processFoundTexture(string file, string relativePath, IContentPack ContentPack)
|
||||
{
|
||||
Texture2DExtended textureExtended = new Texture2DExtended(ContentPack, Path.Combine(relativePath, Path.GetFileName(file)));
|
||||
|
||||
textureExtended.texture.Name = ContentPack.Manifest.UniqueID + "_" + this.name + "_" + textureExtended.Name;
|
||||
ModCore.log("Found texture: " + textureExtended.Name);
|
||||
|
||||
//this.addTexture(textureExtended.Name, textureExtended);
|
||||
}
|
||||
|
||||
|
||||
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~//
|
||||
// Static Functions //
|
||||
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~//
|
||||
|
||||
public static void addTexture(IManifest ModManifest,string managerName, string textureName, Texture2DExtended Texture)
|
||||
{
|
||||
Texture.texture.Name = managerName + "." + textureName;
|
||||
TextureManagers[ModManifest.UniqueID][managerName].addTexture(textureName, Texture);
|
||||
}
|
||||
|
||||
public static void AddTextureManager(IManifest ModManifest,string Name)
|
||||
{
|
||||
if (TextureManager.TextureManagers.ContainsKey(ModManifest.UniqueID)){
|
||||
TextureManagers[ModManifest.UniqueID].Add(Name, new TextureManager(Name));
|
||||
}
|
||||
else
|
||||
{
|
||||
TextureManager.TextureManagers.Add(ModManifest.UniqueID, new Dictionary<string, TextureManager>());
|
||||
TextureManagers[ModManifest.UniqueID].Add(Name, new TextureManager(Name));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static TextureManager GetTextureManager(IManifest Manifest,string Name)
|
||||
{
|
||||
return TextureManagers[Manifest.UniqueID][Name];
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
|
@ -0,0 +1,51 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using StardewValley;
|
||||
|
||||
namespace Revitalize.Framework.Menus
|
||||
{
|
||||
public class SimpleItemGrabMenu: StardustCore.UIUtilities.IClickableMenuExtended
|
||||
{
|
||||
public List<Item> stroageInventory;
|
||||
public List<Item> receivingInventory;
|
||||
public List<StardustCore.UIUtilities.MenuComponents.Button> clickableItems;
|
||||
public SimpleItemGrabMenu(int xPos,int yPos,int width, int height,bool showCloseButton,List<Item> StorageInventory,List<Item>ReceivingInventory) : base(xPos, yPos, width, height, showCloseButton)
|
||||
{
|
||||
this.stroageInventory = StorageInventory;
|
||||
this.receivingInventory = ReceivingInventory;
|
||||
this.clickableItems = new List<StardustCore.UIUtilities.MenuComponents.Button>();
|
||||
}
|
||||
|
||||
public override void performHoverAction(int x, int y)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public override void receiveLeftClick(int x, int y, bool playSound = true)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public override void receiveRightClick(int x, int y, bool playSound = true)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public override void update(GameTime time)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public override void draw(SpriteBatch b)
|
||||
{
|
||||
this.drawDialogueBoxBackground();
|
||||
this.drawMouse(b);
|
||||
//base.draw(b);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -6,12 +6,14 @@ using Revitalize.Framework.Graphics.Animations;
|
|||
using Revitalize.Framework.Illuminate;
|
||||
using Revitalize.Framework.Utilities;
|
||||
using StardewValley;
|
||||
using StardustCore.UIUtilities;
|
||||
|
||||
namespace Revitalize.Framework.Objects
|
||||
{
|
||||
public class BasicItemInformation : CustomObjectData
|
||||
public class BasicItemInformation
|
||||
{
|
||||
public string name;
|
||||
public string id;
|
||||
public string description;
|
||||
public string categoryName;
|
||||
public Color categoryColor;
|
||||
|
@ -56,12 +58,14 @@ namespace Revitalize.Framework.Objects
|
|||
this.lightManager = new LightManager();
|
||||
|
||||
this.facingDirection = Enums.Direction.Down;
|
||||
this.id = "";
|
||||
|
||||
}
|
||||
|
||||
public BasicItemInformation(string name, string description, string categoryName, Color categoryColor,int edibility, int fragility, bool isLamp, int price, Vector2 TileLocation, bool canBeSetOutdoors, bool canBeSetIndoors, string id, string data, Texture2D texture, Color color, int tileIndex, bool bigCraftable, Type type, CraftingData craftingData, AnimationManager animationManager, Color drawColor, bool ignoreBoundingBox, InventoryManager Inventory, LightManager Lights) : base(id, data, texture, color, tileIndex, bigCraftable, type, craftingData)
|
||||
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)
|
||||
{
|
||||
this.name = name;
|
||||
this.id = id;
|
||||
this.description = description;
|
||||
this.categoryName = categoryName;
|
||||
this.categoryColor = categoryColor;
|
||||
|
@ -77,27 +81,19 @@ namespace Revitalize.Framework.Objects
|
|||
this.animationManager = animationManager;
|
||||
if (this.animationManager.IsNull)
|
||||
{
|
||||
this.animationManager = new AnimationManager(new Graphics.Texture2DExtended(), new Animation(new Rectangle(0, 0, 16, 16)), false);
|
||||
this.animationManager = new AnimationManager(new Texture2DExtended(), new Animation(new Rectangle(0, 0, 16, 16)), false);
|
||||
this.animationManager.getExtendedTexture().texture = texture;
|
||||
}
|
||||
else
|
||||
this.texture = texture;
|
||||
|
||||
this.drawPosition = Vector2.Zero;
|
||||
this.drawColor = drawColor;
|
||||
this.ignoreBoundingBox = ignoreBoundingBox;
|
||||
this.recreateDataString();
|
||||
this.inventory = Inventory ?? new InventoryManager();
|
||||
this.lightManager = Lights ?? new LightManager();
|
||||
this.facingDirection = Enums.Direction.Down;
|
||||
|
||||
}
|
||||
|
||||
public void recreateDataString()
|
||||
{
|
||||
this.data = $"{this.name}/{this.price}/{this.edibility}/Crafting -9/{this.description}/{this.canBeSetOutdoors}/{this.canBeSetIndoors}/{this.fragility}/{this.isLamp}/{this.name}";
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -64,8 +64,8 @@ namespace Revitalize.Framework.Objects
|
|||
}
|
||||
|
||||
/// <summary>Construct an instance.</summary>
|
||||
public CustomObject(BasicItemInformation info)
|
||||
: base(info, Vector2.Zero)
|
||||
public CustomObject(CustomObjectData PyTKData, BasicItemInformation info)
|
||||
: base(PyTKData, Vector2.Zero)
|
||||
{
|
||||
this.info = info;
|
||||
this.initializeBasics();
|
||||
|
@ -74,8 +74,8 @@ namespace Revitalize.Framework.Objects
|
|||
}
|
||||
|
||||
/// <summary>Construct an instance.</summary>
|
||||
public CustomObject(BasicItemInformation info, Vector2 TileLocation)
|
||||
: base(info, TileLocation)
|
||||
public CustomObject(CustomObjectData PyTKData, BasicItemInformation info, Vector2 TileLocation)
|
||||
: base(PyTKData, TileLocation)
|
||||
{
|
||||
this.info = info;
|
||||
this.initializeBasics();
|
||||
|
@ -94,7 +94,7 @@ namespace Revitalize.Framework.Objects
|
|||
this.setOutdoors.Value = true;
|
||||
this.setIndoors.Value = true;
|
||||
this.isLamp.Value = false;
|
||||
this.fragility.Value = 0;
|
||||
this.Fragility = 0;
|
||||
|
||||
this.updateDrawPosition(0, 0);
|
||||
|
||||
|
@ -148,8 +148,15 @@ namespace Revitalize.Framework.Objects
|
|||
|
||||
public override ICustomObject recreate(Dictionary<string, string> additionalSaveData, object replacement)
|
||||
{
|
||||
BasicItemInformation data = (BasicItemInformation)CustomObjectData.collection[additionalSaveData["id"]];
|
||||
return new CustomObject(data, (replacement as Chest).TileLocation);
|
||||
CustomObjectData data = CustomObjectData.collection[additionalSaveData["id"]];
|
||||
BasicItemInformation info = Revitalize.ModCore.Serializer.DeserializeFromJSONString<BasicItemInformation>(additionalSaveData["ItemInfo"]);
|
||||
return new CustomObject(data,info,(replacement as Chest).TileLocation);
|
||||
}
|
||||
public override Dictionary<string, string> getAdditionalSaveData()
|
||||
{
|
||||
Dictionary<string, string> serializedInfo = new Dictionary<string, string>();
|
||||
serializedInfo.Add("ItemInfo", Revitalize.ModCore.Serializer.ToJSONString(this.info));
|
||||
return serializedInfo;
|
||||
}
|
||||
|
||||
/// <summary>What happens when the player right clicks the object.</summary>
|
||||
|
@ -295,7 +302,7 @@ namespace Revitalize.Framework.Objects
|
|||
/// <summary>Gets a clone of the game object.</summary>
|
||||
public override Item getOne()
|
||||
{
|
||||
return new CustomObject((BasicItemInformation)this.data);
|
||||
return new CustomObject(this.data,this.info);
|
||||
}
|
||||
|
||||
/// <summary>What happens when the object is drawn at a tile location.</summary>
|
||||
|
@ -435,6 +442,10 @@ namespace Revitalize.Framework.Objects
|
|||
this.info = Revitalize.ModCore.Serializer.DeserializeFromJSONString<BasicItemInformation>(syncData["BasicItemInfo"]);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public string getDisplayNameFromStringsFile(string objectID)
|
||||
{
|
||||
//Load in a file that has all object names referenced here or something.
|
||||
|
|
|
@ -18,13 +18,13 @@ namespace Revitalize.Framework.Objects.Furniture
|
|||
|
||||
public List<long> playersSittingHere = new List<long>();
|
||||
|
||||
public Bench(BasicItemInformation info, Vector2 TilePosition) : base(info, TilePosition)
|
||||
public Bench(CustomObjectData PyTKData, BasicItemInformation info, Vector2 TilePosition) : base(PyTKData,info, TilePosition)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
public Bench(BasicItemInformation info,Vector2 TilePosition, Dictionary<Vector2,MultiTiledComponent> Objects) : base(info, TilePosition, Objects)
|
||||
public Bench(CustomObjectData PyTKData, BasicItemInformation info,Vector2 TilePosition, Dictionary<Vector2,MultiTiledComponent> Objects) : base(PyTKData,info, TilePosition, Objects)
|
||||
{
|
||||
|
||||
}
|
||||
|
@ -62,7 +62,7 @@ namespace Revitalize.Framework.Objects.Furniture
|
|||
objs.Add(pair.Key, (MultiTiledComponent)pair.Value);
|
||||
}
|
||||
|
||||
return new Bench(this.info, this.TileLocation, objs);
|
||||
return new Bench(this.data,this.info, this.TileLocation, objs);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -22,17 +22,17 @@ namespace Revitalize.Framework.Objects.Furniture
|
|||
|
||||
}
|
||||
|
||||
public ChairMultiTiledObject(BasicItemInformation Info) : base(Info)
|
||||
public ChairMultiTiledObject(CustomObjectData PyTKData, BasicItemInformation Info) : base(PyTKData,Info)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public ChairMultiTiledObject(BasicItemInformation Info, Vector2 TilePosition) : base(Info, TilePosition)
|
||||
public ChairMultiTiledObject(CustomObjectData PyTKData,BasicItemInformation Info, Vector2 TilePosition) : base(PyTKData,Info, TilePosition)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public ChairMultiTiledObject(BasicItemInformation Info,Vector2 TilePosition,Dictionary<Vector2, MultiTiledComponent> Objects) : base(Info, TilePosition, Objects) {
|
||||
public ChairMultiTiledObject(CustomObjectData PyTKData, BasicItemInformation Info,Vector2 TilePosition,Dictionary<Vector2, MultiTiledComponent> Objects) : base(PyTKData,Info, TilePosition, Objects) {
|
||||
|
||||
|
||||
}
|
||||
|
@ -63,7 +63,7 @@ namespace Revitalize.Framework.Objects.Furniture
|
|||
}
|
||||
|
||||
|
||||
return new ChairMultiTiledObject(this.info, this.TileLocation, objs);
|
||||
return new ChairMultiTiledObject(this.data,this.info, this.TileLocation, objs);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -35,12 +35,12 @@ namespace Revitalize.Framework.Objects.Furniture
|
|||
|
||||
}
|
||||
|
||||
public ChairTileComponent(BasicItemInformation Info,ChairInformation FurnitureInfo) : base(Info)
|
||||
public ChairTileComponent(CustomObjectData PyTKData,BasicItemInformation Info,ChairInformation FurnitureInfo) : base(PyTKData,Info)
|
||||
{
|
||||
this.furnitureInfo = FurnitureInfo;
|
||||
}
|
||||
|
||||
public ChairTileComponent(BasicItemInformation Info,Vector2 TileLocation, ChairInformation FurnitureInfo) : base(Info, TileLocation)
|
||||
public ChairTileComponent(CustomObjectData PyTKData,BasicItemInformation Info,Vector2 TileLocation, ChairInformation FurnitureInfo) : base(PyTKData,Info, TileLocation)
|
||||
{
|
||||
this.furnitureInfo = FurnitureInfo;
|
||||
}
|
||||
|
@ -88,7 +88,7 @@ namespace Revitalize.Framework.Objects.Furniture
|
|||
|
||||
public override Item getOne()
|
||||
{
|
||||
ChairTileComponent component = new ChairTileComponent(this.info, (ChairInformation)this.furnitureInfo);
|
||||
ChairTileComponent component = new ChairTileComponent(this.data,this.info, (ChairInformation)this.furnitureInfo);
|
||||
component.containerObject = this.containerObject;
|
||||
component.offsetKey = this.offsetKey;
|
||||
return component;
|
||||
|
|
|
@ -4,6 +4,7 @@ using System.Linq;
|
|||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.Xna.Framework;
|
||||
using PyTK.CustomElementHandler;
|
||||
using Revitalize.Framework.Objects.InformationFiles.Furniture;
|
||||
|
||||
namespace Revitalize.Framework.Objects.Furniture
|
||||
|
@ -18,12 +19,12 @@ namespace Revitalize.Framework.Objects.Furniture
|
|||
|
||||
}
|
||||
|
||||
public CustomFurniture(BasicItemInformation itemInfo, FurnitureInformation furnitureInfo) : base(itemInfo)
|
||||
public CustomFurniture(CustomObjectData PyTKData,BasicItemInformation itemInfo, FurnitureInformation furnitureInfo) : base(PyTKData,itemInfo)
|
||||
{
|
||||
this.furnitureInfo = furnitureInfo;
|
||||
}
|
||||
|
||||
public CustomFurniture(BasicItemInformation itemInfo, Vector2 TileLocation, FurnitureInformation furnitureInfo) : base(itemInfo, TileLocation)
|
||||
public CustomFurniture(CustomObjectData PyTKData, BasicItemInformation itemInfo, Vector2 TileLocation, FurnitureInformation furnitureInfo) : base(PyTKData,itemInfo, TileLocation)
|
||||
{
|
||||
this.furnitureInfo = furnitureInfo;
|
||||
}
|
||||
|
|
|
@ -4,6 +4,7 @@ using System.Linq;
|
|||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.Xna.Framework;
|
||||
using PyTK.CustomElementHandler;
|
||||
using Revitalize.Framework.Objects.InformationFiles;
|
||||
using Revitalize.Framework.Objects.InformationFiles.Furniture;
|
||||
|
||||
|
@ -18,11 +19,11 @@ namespace Revitalize.Framework.Objects.Furniture
|
|||
|
||||
}
|
||||
|
||||
public FurnitureTileComponent(BasicItemInformation itemInfo):base(itemInfo)
|
||||
public FurnitureTileComponent(CustomObjectData PyTKData,BasicItemInformation itemInfo):base(PyTKData,itemInfo)
|
||||
{
|
||||
}
|
||||
|
||||
public FurnitureTileComponent(BasicItemInformation itemInfo,Vector2 TileLocation) : base(itemInfo,TileLocation)
|
||||
public FurnitureTileComponent(CustomObjectData PyTKData, BasicItemInformation itemInfo,Vector2 TileLocation) : base(PyTKData,itemInfo,TileLocation)
|
||||
{
|
||||
|
||||
}
|
||||
|
|
|
@ -17,17 +17,17 @@ namespace Revitalize.Framework.Objects.Furniture
|
|||
|
||||
}
|
||||
|
||||
public LampMultiTiledObject(BasicItemInformation Info) : base(Info)
|
||||
public LampMultiTiledObject(CustomObjectData PyTKData, BasicItemInformation Info) : base(PyTKData,Info)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public LampMultiTiledObject(BasicItemInformation Info, Vector2 TilePosition) : base(Info, TilePosition)
|
||||
public LampMultiTiledObject(CustomObjectData PyTKData, BasicItemInformation Info, Vector2 TilePosition) : base(PyTKData,Info, TilePosition)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public LampMultiTiledObject(BasicItemInformation Info, Vector2 TilePosition, Dictionary<Vector2, MultiTiledComponent> Objects) : base(Info, TilePosition, Objects)
|
||||
public LampMultiTiledObject(CustomObjectData PyTKData, BasicItemInformation Info, Vector2 TilePosition, Dictionary<Vector2, MultiTiledComponent> Objects) : base(PyTKData,Info, TilePosition, Objects)
|
||||
{
|
||||
|
||||
|
||||
|
@ -47,7 +47,7 @@ namespace Revitalize.Framework.Objects.Furniture
|
|||
}
|
||||
|
||||
|
||||
return new LampMultiTiledObject(this.info, this.TileLocation, objs);
|
||||
return new LampMultiTiledObject(this.data,this.info, this.TileLocation, objs);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -37,12 +37,12 @@ namespace Revitalize.Framework.Objects.Furniture
|
|||
|
||||
}
|
||||
|
||||
public LampTileComponent(BasicItemInformation Info) : base(Info)
|
||||
public LampTileComponent(CustomObjectData PyTKData,BasicItemInformation Info) : base(PyTKData,Info)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public LampTileComponent(BasicItemInformation Info, Vector2 TileLocation) : base(Info, TileLocation)
|
||||
public LampTileComponent(CustomObjectData PyTKData,BasicItemInformation Info, Vector2 TileLocation) : base(PyTKData,Info, TileLocation)
|
||||
{
|
||||
|
||||
}
|
||||
|
@ -124,7 +124,7 @@ namespace Revitalize.Framework.Objects.Furniture
|
|||
|
||||
public override Item getOne()
|
||||
{
|
||||
LampTileComponent component = new LampTileComponent(this.info);
|
||||
LampTileComponent component = new LampTileComponent(this.data,this.info);
|
||||
component.containerObject = this.containerObject;
|
||||
component.offsetKey = this.offsetKey;
|
||||
return component;
|
||||
|
|
|
@ -16,17 +16,17 @@ namespace Revitalize.Framework.Objects.Furniture
|
|||
|
||||
}
|
||||
|
||||
public RugMultiTiledObject(BasicItemInformation Info) : base(Info)
|
||||
public RugMultiTiledObject(CustomObjectData PyTKData, BasicItemInformation Info) : base(PyTKData,Info)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public RugMultiTiledObject(BasicItemInformation Info, Vector2 TilePosition) : base(Info, TilePosition)
|
||||
public RugMultiTiledObject(CustomObjectData PyTKData, BasicItemInformation Info, Vector2 TilePosition) : base(PyTKData,Info, TilePosition)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public RugMultiTiledObject(BasicItemInformation Info, Vector2 TilePosition, Dictionary<Vector2, MultiTiledComponent> Objects) : base(Info, TilePosition, Objects)
|
||||
public RugMultiTiledObject(CustomObjectData PyTKData, BasicItemInformation Info, Vector2 TilePosition, Dictionary<Vector2, MultiTiledComponent> Objects) : base(PyTKData,Info, TilePosition, Objects)
|
||||
{
|
||||
|
||||
|
||||
|
@ -49,7 +49,7 @@ namespace Revitalize.Framework.Objects.Furniture
|
|||
}
|
||||
|
||||
|
||||
return new RugMultiTiledObject(this.info, this.TileLocation, objs);
|
||||
return new RugMultiTiledObject(this.data,this.info, this.TileLocation, objs);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -18,12 +18,12 @@ namespace Revitalize.Framework.Objects.Furniture
|
|||
|
||||
}
|
||||
|
||||
public RugTileComponent(BasicItemInformation Info) : base(Info)
|
||||
public RugTileComponent(CustomObjectData PyTKData,BasicItemInformation Info) : base(PyTKData,Info)
|
||||
{
|
||||
this.info.ignoreBoundingBox = true;
|
||||
}
|
||||
|
||||
public RugTileComponent(BasicItemInformation Info, Vector2 TileLocation) : base(Info, TileLocation)
|
||||
public RugTileComponent(CustomObjectData PyTKData,BasicItemInformation Info, Vector2 TileLocation) : base(PyTKData,Info, TileLocation)
|
||||
{
|
||||
this.info.ignoreBoundingBox = true;
|
||||
}
|
||||
|
@ -44,7 +44,7 @@ namespace Revitalize.Framework.Objects.Furniture
|
|||
|
||||
public override Item getOne()
|
||||
{
|
||||
RugTileComponent component = new RugTileComponent(this.info);
|
||||
RugTileComponent component = new RugTileComponent(this.data,this.info);
|
||||
component.containerObject = this.containerObject;
|
||||
component.offsetKey = this.offsetKey;
|
||||
return component;
|
||||
|
|
|
@ -17,17 +17,17 @@ namespace Revitalize.Framework.Objects.Furniture
|
|||
|
||||
}
|
||||
|
||||
public TableMultiTiledObject(BasicItemInformation Info) : base(Info)
|
||||
public TableMultiTiledObject(CustomObjectData PyTKData, BasicItemInformation Info) : base(PyTKData,Info)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public TableMultiTiledObject(BasicItemInformation Info, Vector2 TilePosition) : base(Info, TilePosition)
|
||||
public TableMultiTiledObject(CustomObjectData PyTKData, BasicItemInformation Info, Vector2 TilePosition) : base(PyTKData,Info, TilePosition)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public TableMultiTiledObject(BasicItemInformation Info, Vector2 TilePosition, Dictionary<Vector2, MultiTiledComponent> Objects) : base(Info, TilePosition, Objects)
|
||||
public TableMultiTiledObject(CustomObjectData PyTKData, BasicItemInformation Info, Vector2 TilePosition, Dictionary<Vector2, MultiTiledComponent> Objects) : base(PyTKData,Info, TilePosition, Objects)
|
||||
{
|
||||
|
||||
|
||||
|
@ -48,7 +48,7 @@ namespace Revitalize.Framework.Objects.Furniture
|
|||
}
|
||||
|
||||
|
||||
return new TableMultiTiledObject(this.info, this.TileLocation,objs);
|
||||
return new TableMultiTiledObject(this.data,this.info, this.TileLocation,objs);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -38,12 +38,12 @@ namespace Revitalize.Framework.Objects.Furniture
|
|||
|
||||
}
|
||||
|
||||
public TableTileComponent(BasicItemInformation Info, TableInformation FurnitureInfo) : base(Info)
|
||||
public TableTileComponent(CustomObjectData PyTKData,BasicItemInformation Info, TableInformation FurnitureInfo) : base(PyTKData,Info)
|
||||
{
|
||||
this.furnitureInfo = FurnitureInfo;
|
||||
}
|
||||
|
||||
public TableTileComponent(BasicItemInformation Info, Vector2 TileLocation, TableInformation FurnitureInfo) : base(Info, TileLocation)
|
||||
public TableTileComponent(CustomObjectData PyTKData,BasicItemInformation Info, Vector2 TileLocation, TableInformation FurnitureInfo) : base(PyTKData,Info, TileLocation)
|
||||
{
|
||||
this.furnitureInfo = FurnitureInfo;
|
||||
}
|
||||
|
@ -180,7 +180,7 @@ namespace Revitalize.Framework.Objects.Furniture
|
|||
|
||||
public override Item getOne()
|
||||
{
|
||||
TableTileComponent component = new TableTileComponent(this.info, (TableInformation)this.furnitureInfo);
|
||||
TableTileComponent component = new TableTileComponent(this.data,this.info, (TableInformation)this.furnitureInfo);
|
||||
component.containerObject = this.containerObject;
|
||||
component.offsetKey = this.offsetKey;
|
||||
return component;
|
||||
|
|
|
@ -18,13 +18,13 @@ namespace Revitalize.Framework.Objects
|
|||
|
||||
public MultiTiledComponent() { }
|
||||
|
||||
public MultiTiledComponent(BasicItemInformation info) : base(info) { }
|
||||
public MultiTiledComponent(CustomObjectData PyTKData,BasicItemInformation info) : base(PyTKData,info) { }
|
||||
|
||||
public MultiTiledComponent(BasicItemInformation info, Vector2 TileLocation,MultiTiledObject obj=null) : base(info, TileLocation) {
|
||||
public MultiTiledComponent(CustomObjectData PyTKData, BasicItemInformation info, Vector2 TileLocation,MultiTiledObject obj=null) : base(PyTKData,info, TileLocation) {
|
||||
this.containerObject = obj;
|
||||
}
|
||||
|
||||
public MultiTiledComponent(BasicItemInformation info, Vector2 TileLocation,Vector2 offsetKey ,MultiTiledObject obj = null) : base(info, TileLocation) {
|
||||
public MultiTiledComponent(CustomObjectData PyTKData, BasicItemInformation info, Vector2 TileLocation,Vector2 offsetKey ,MultiTiledObject obj = null) : base(PyTKData,info, TileLocation) {
|
||||
this.offsetKey = offsetKey;
|
||||
this.containerObject = obj;
|
||||
}
|
||||
|
@ -113,7 +113,7 @@ namespace Revitalize.Framework.Objects
|
|||
|
||||
public override Item getOne()
|
||||
{
|
||||
MultiTiledComponent component = new MultiTiledComponent(this.info, this.TileLocation,this.offsetKey,this.containerObject);
|
||||
MultiTiledComponent component = new MultiTiledComponent(this.data,this.info, this.TileLocation,this.offsetKey,this.containerObject);
|
||||
return component;
|
||||
}
|
||||
|
||||
|
|
|
@ -42,24 +42,24 @@ namespace Revitalize.Framework.Objects
|
|||
|
||||
}
|
||||
|
||||
public MultiTiledObject(BasicItemInformation info)
|
||||
: base(info)
|
||||
public MultiTiledObject(CustomObjectData PyTKData,BasicItemInformation info)
|
||||
: base(PyTKData,info)
|
||||
{
|
||||
this.objects = new Dictionary<Vector2, StardewValley.Object>();
|
||||
this.childrenGuids = new Dictionary<Vector2, Guid>();
|
||||
|
||||
}
|
||||
|
||||
public MultiTiledObject(BasicItemInformation info, Vector2 TileLocation)
|
||||
: base(info, TileLocation)
|
||||
public MultiTiledObject(CustomObjectData PyTKData, BasicItemInformation info, Vector2 TileLocation)
|
||||
: base(PyTKData,info, TileLocation)
|
||||
{
|
||||
this.objects = new Dictionary<Vector2, StardewValley.Object>();
|
||||
this.childrenGuids = new Dictionary<Vector2, Guid>();
|
||||
|
||||
}
|
||||
|
||||
public MultiTiledObject(BasicItemInformation info, Vector2 TileLocation, Dictionary<Vector2, MultiTiledComponent> ObjectsList)
|
||||
: base(info, TileLocation)
|
||||
public MultiTiledObject(CustomObjectData PyTKData, BasicItemInformation info, Vector2 TileLocation, Dictionary<Vector2, MultiTiledComponent> ObjectsList)
|
||||
: base(PyTKData,info, TileLocation)
|
||||
{
|
||||
this.objects = new Dictionary<Vector2, StardewValley.Object>();
|
||||
this.childrenGuids = new Dictionary<Vector2, Guid>();
|
||||
|
@ -268,7 +268,7 @@ namespace Revitalize.Framework.Objects
|
|||
{
|
||||
objs.Add(pair.Key, (MultiTiledComponent)pair.Value);
|
||||
}
|
||||
return new MultiTiledObject(this.info, this.TileLocation, objs);
|
||||
return new MultiTiledObject(this.data,this.info, this.TileLocation, objs);
|
||||
}
|
||||
|
||||
public override ICustomObject recreate(Dictionary<string, string> additionalSaveData, object replacement)
|
||||
|
|
|
@ -0,0 +1,21 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using PyTK.CustomElementHandler;
|
||||
|
||||
namespace Revitalize.Framework.Utilities
|
||||
{
|
||||
public class PyTKHelper
|
||||
{
|
||||
|
||||
public static CustomObjectData CreateOBJData(string id, Texture2D Texture, Type type, Color color, bool bigCraftable = true)
|
||||
{
|
||||
return new PyTK.CustomElementHandler.CustomObjectData(id, "2048/0/-300/Crafting -9/Play '2048 by Platonymous' at home!/true/true/0/2048", Texture, color, 0, bigCraftable, type, null);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
|
@ -8,6 +8,7 @@ using Microsoft.Xna.Framework.Graphics;
|
|||
using Newtonsoft.Json;
|
||||
using Revitalize.Framework.Graphics;
|
||||
using StardewValley;
|
||||
using StardustCore.UIUtilities;
|
||||
|
||||
namespace Revitalize.Framework.Utilities.Serialization.Converters
|
||||
{
|
||||
|
@ -30,7 +31,7 @@ namespace Revitalize.Framework.Utilities.Serialization.Converters
|
|||
if (names.Length == 0) return null;
|
||||
|
||||
if (!TextureManager.TextureManagers.ContainsKey(names[0])) return null;
|
||||
return textureName == null ? null : Revitalize.Framework.Graphics.TextureManager.TextureManagers[names[0]][names[1]].getTexture(names[2]).texture;
|
||||
return textureName == null ? null : TextureManager.TextureManagers[names[0]][names[1]].getTexture(names[2]).texture;
|
||||
}
|
||||
|
||||
public override bool CanConvert(Type objectType)
|
||||
|
|
|
@ -18,6 +18,7 @@ using Revitalize.Framework.Utilities;
|
|||
using StardewModdingAPI;
|
||||
using StardewValley;
|
||||
using StardewValley.Objects;
|
||||
using StardustCore.UIUtilities;
|
||||
|
||||
namespace Revitalize
|
||||
{
|
||||
|
@ -26,7 +27,12 @@ namespace Revitalize
|
|||
// -Chair tops cut off objects
|
||||
// -load content MUST be enabled for the table to be placed?????? WTF
|
||||
// TODO:
|
||||
//
|
||||
/*
|
||||
*
|
||||
*Menus:
|
||||
* -Simple Item Grab Menu (to transfer items from one inventory to another)
|
||||
* -Need to make this.
|
||||
*
|
||||
// -Add in object pool class to handle the multitudes of objects I'll be making. (WIP)
|
||||
// -Make this mod able to load content packs for easier future modding
|
||||
//
|
||||
|
@ -43,6 +49,7 @@ namespace Revitalize
|
|||
// -More crafting tables
|
||||
// -Machines
|
||||
// !=Energy
|
||||
// -solar
|
||||
// -Furnace
|
||||
// -Seed Maker
|
||||
// -Stone Quarry
|
||||
|
@ -52,8 +59,18 @@ namespace Revitalize
|
|||
// -Auto Preserves
|
||||
// -Auto Keg
|
||||
// -Auto Cask
|
||||
// -Calcinator (oil+stone)
|
||||
// -Materials
|
||||
// -Tin/Bronze/Alluminum/Silver?Platinum/Etc
|
||||
-titanium
|
||||
-Alloys!
|
||||
-Brass
|
||||
-Electrum
|
||||
-Liquids
|
||||
-oil
|
||||
-water
|
||||
-coal
|
||||
-juice???
|
||||
// -Crafting Menu
|
||||
// -Item Grab Menu (Extendable)
|
||||
// -Yes/No Dialogue Box
|
||||
|
@ -69,7 +86,8 @@ namespace Revitalize
|
|||
// -Connected chests much like Project EE2 from MC
|
||||
//
|
||||
//
|
||||
// -Food?
|
||||
// -Food?
|
||||
-multi flavored sodas
|
||||
// -Bigger chests
|
||||
//
|
||||
// Festivals
|
||||
|
@ -108,7 +126,7 @@ namespace Revitalize
|
|||
// -boss fights
|
||||
//
|
||||
// More dungeons??
|
||||
|
||||
*/
|
||||
|
||||
public class ModCore : Mod
|
||||
{
|
||||
|
@ -120,9 +138,6 @@ namespace Revitalize
|
|||
|
||||
public static Dictionary<string, MultiTiledObject>ObjectGroups;
|
||||
|
||||
|
||||
|
||||
|
||||
public static PlayerInfo playerInfo;
|
||||
|
||||
public static Serializer Serializer;
|
||||
|
@ -144,8 +159,8 @@ namespace Revitalize
|
|||
ModHelper.Events.GameLoop.ReturnedToTitle += this.GameLoop_ReturnedToTitle;
|
||||
playerInfo = new PlayerInfo();
|
||||
|
||||
Framework.Graphics.TextureManager.AddTextureManager(Manifest,"Furniture");
|
||||
TextureManager.GetTextureManager(Manifest,"Furniture").searchForTextures(Path.Combine("Content", "Graphics", "Furniture"));
|
||||
TextureManager.AddTextureManager(Manifest,"Furniture");
|
||||
TextureManager.GetTextureManager(Manifest,"Furniture").searchForTextures(ModHelper,this.ModManifest,Path.Combine("Content", "Graphics", "Furniture"));
|
||||
|
||||
//TextureManager.addTexture("Furniture","Oak Chair", new Texture2DExtended(this.Helper, this.ModManifest, Path.Combine("Content","Graphics","Furniture", "Chairs", "Oak Chair.png")));
|
||||
|
||||
|
@ -177,15 +192,16 @@ namespace Revitalize
|
|||
/// </summary>
|
||||
private void loadContent()
|
||||
{
|
||||
|
||||
MultiTiledComponent obj = new MultiTiledComponent(new BasicItemInformation("CoreObjectTest", "YAY FUN!", "Omegasis.Revitalize.MultiTiledComponent", Color.White, -300, 0, false, 100, Vector2.Zero, true, true, "Omegasis.TEST1", "2048/0/-300/Crafting -9/Play '2048 by Platonymous' at home!/true/true/0/2048", TextureManager.TextureManagers[Manifest.UniqueID]["Furniture"].getTexture("Oak Chair").texture, Color.White, 0, true, typeof(MultiTiledComponent), null, new AnimationManager(TextureManager.TextureManagers[Manifest.UniqueID]["Furniture"].getTexture("Oak Chair"), new Animation(new Rectangle(0, 0, 16, 16))), Color.Red, true, null, null));
|
||||
MultiTiledComponent obj2 = new MultiTiledComponent(new BasicItemInformation("CoreObjectTest2", "SomeFun", "Omegasis.Revitalize.MultiTiledComponent", Color.White, -300, 0, false, 100, Vector2.Zero, true, true, "Omegasis.TEST1", "2048/0/-300/Crafting -9/Play '2048 by Platonymous' at home!/true/true/0/2048", TextureManager.TextureManagers[Manifest.UniqueID]["Furniture"].getTexture("Oak Chair").texture, Color.White, 0, true, typeof(MultiTiledComponent), null, new AnimationManager(TextureManager.TextureManagers[Manifest.UniqueID]["Furniture"].getTexture("Oak Chair"), new Animation(new Rectangle(0, 16, 16, 16))), Color.Red, false, null, null));
|
||||
MultiTiledComponent obj3 = new MultiTiledComponent(new BasicItemInformation("CoreObjectTest3", "NoFun", "Omegasis.Revitalize.MultiTiledComponent", Color.White, -300, 0, false, 100, Vector2.Zero, true, true, "Omegasis.TEST1", "2048/0/-300/Crafting -9/Play '2048 by Platonymous' at home!/true/true/0/2048", TextureManager.TextureManagers[Manifest.UniqueID]["Furniture"].getTexture("Oak Chair").texture, Color.White, 0, true, typeof(MultiTiledComponent), null, new AnimationManager(TextureManager.TextureManagers[Manifest.UniqueID]["Furniture"].getTexture("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, 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));
|
||||
|
||||
|
||||
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(new BasicItemInformation("MultiTest", "A really big object", "Omegasis.Revitalize.MultiTiledObject", Color.Blue, -300, 0, false, 100, Vector2.Zero, true, true, "Omegasis.BigTiledTest", "2048/0/-300/Crafting -9/Play '2048 by Platonymous' at home!/true/true/0/2048", TextureManager.TextureManagers[Manifest.UniqueID]["Furniture"].getTexture("Oak Chair").texture, Color.White, 0, true, typeof(MultiTiledObject), null, 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, Vector2.Zero, 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);
|
||||
bigObject.addComponent(new Vector2(2, 0), obj3);
|
||||
|
@ -198,8 +214,10 @@ namespace Revitalize
|
|||
customObjects.Add("Omegasis.BigTiledTest", bigObject);
|
||||
|
||||
|
||||
Framework.Objects.Furniture.RugTileComponent rug1 = new Framework.Objects.Furniture.RugTileComponent(new BasicItemInformation("BasicRugTile", "A basic rug", "Rug", Color.Brown, -300, 0, false, 100, new Vector2(0, 0), true, true, "Omegasis.Revitalize.Furniture.Basic.Rugs.TestRug", generatePlaceholderString(), TextureManager.TextureManagers[Manifest.UniqueID]["Furniture"].getTexture("Oak Chair").texture, Color.White, 0,true, typeof(Framework.Objects.Furniture.RugTileComponent), null, new AnimationManager(TextureManager.TextureManagers[Manifest.UniqueID]["Furniture"].getTexture("Oak Chair"), new Animation(new Rectangle(0, 0, 16, 16))), Color.White, true, null, null));
|
||||
Framework.Objects.Furniture.RugMultiTiledObject rug = new Framework.Objects.Furniture.RugMultiTiledObject(new BasicItemInformation("BasicRugTile", "A basic rug", "Rug", Color.Brown, -300, 0, false, 100, new Vector2(0, 0), true, true, "Omegasis.Revitalize.Furniture.Basic.Rugs.TestRug", generatePlaceholderString(), TextureManager.TextureManagers[Manifest.UniqueID]["Furniture"].getTexture("Oak Chair").texture, Color.White, 0, true, typeof(Framework.Objects.Furniture.RugMultiTiledObject), null, new AnimationManager(), 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, 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.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));
|
||||
|
||||
rug.addComponent(new Vector2(0, 0), rug1);
|
||||
|
||||
customObjects.Add("Omegasis.Revitalize.Furniture.Rugs.RugTest", rug);
|
||||
|
|
|
@ -39,6 +39,9 @@
|
|||
<Reference Include="PyTK">
|
||||
<HintPath>$(GamePath)\Mods\PyTK\PyTK.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="StardustCore">
|
||||
<HintPath>$(GamePath)\Mods\StardustCore\StardustCore.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
|
@ -60,11 +63,10 @@
|
|||
<Compile Include="Framework\Factories\Objects\Furniture\TableFactoryInfo.cs" />
|
||||
<Compile Include="Framework\Graphics\Animations\Animation.cs" />
|
||||
<Compile Include="Framework\Graphics\Animations\AnimationManager.cs" />
|
||||
<Compile Include="Framework\Graphics\Texture2DExtended.cs" />
|
||||
<Compile Include="Framework\Graphics\TextureManager.cs" />
|
||||
<Compile Include="Framework\Illuminate\ColorExtensions.cs" />
|
||||
<Compile Include="Framework\Illuminate\FakeLightSource.cs" />
|
||||
<Compile Include="Framework\Illuminate\LightManager.cs" />
|
||||
<Compile Include="Framework\Menus\SimpleItemGrabMenu.cs" />
|
||||
<Compile Include="Framework\Objects\BasicItemInformation.cs" />
|
||||
<Compile Include="Framework\Objects\CustomObject.cs" />
|
||||
<Compile Include="Framework\Objects\Furniture\Bench.cs" />
|
||||
|
@ -90,6 +92,7 @@
|
|||
<Compile Include="Framework\Player\PlayerInfo.cs" />
|
||||
<Compile Include="Framework\Utilities\BoundingBoxInfo.cs" />
|
||||
<Compile Include="Framework\Utilities\InventoryManager.cs" />
|
||||
<Compile Include="Framework\Utilities\PyTKHelper.cs" />
|
||||
<Compile Include="Framework\Utilities\Serialization\ContractResolvers\NetFieldContract.cs" />
|
||||
<Compile Include="Framework\Utilities\Serialization\Converters\ItemCoverter.cs" />
|
||||
<Compile Include="Framework\Utilities\Serialization\Converters\NetFieldConverter.cs" />
|
||||
|
@ -104,6 +107,16 @@
|
|||
<ItemGroup>
|
||||
<None Include="manifest.json" />
|
||||
</ItemGroup>
|
||||
<ItemGroup />
|
||||
<ItemGroup>
|
||||
<Content Include="Content\Graphics\Furniture\Chairs\Oak Chair.png">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="Content\Graphics\Furniture\Lamps\Oak Lamp.png">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="Content\Graphics\Furniture\Tables\Oak Table.png">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
</Project>
|
|
@ -6,5 +6,8 @@
|
|||
"UniqueID": "Omegasis.Revitalize",
|
||||
"EntryDll": "Revitalize.dll",
|
||||
"MinimumApiVersion": "2.10.1",
|
||||
"UpdateKeys": []
|
||||
"UpdateKeys": [],
|
||||
"Dependencies": [
|
||||
{ "UniqueID": "Omegasis.StardustCore" }
|
||||
]
|
||||
}
|
||||
|
|
|
@ -76,6 +76,9 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Vocalization", "Vocalizatio
|
|||
EndProjectSection
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Revitalize", "Revitalize\Revitalize.csproj", "{44EF6CEC-FBF1-4B45-8135-81D4EBE84DDD}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
{0756D36A-95C8-480D-8EA6-4584C03010C6} = {0756D36A-95C8-480D-8EA6-4584C03010C6}
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MapExampleRF1", "MapExampleRF1\MapExampleRF1.csproj", "{696CDAA9-295F-49F0-97F9-334F626EA137}"
|
||||
EndProject
|
||||
|
|
|
@ -108,11 +108,6 @@ namespace StardewSymphonyRemastered.Framework.V2
|
|||
|
||||
//Clear out directory so that changes can be reflected.
|
||||
DirectoryInfo dataFolder = new DirectoryInfo(Path.Combine(this.ContentPack.DirectoryPath, this.DataFolderName));
|
||||
StardewSymphony.ModMonitor.Log(dataFolder.FullName);
|
||||
foreach (FileInfo file in dataFolder.GetFiles())
|
||||
{
|
||||
file.Delete();
|
||||
}
|
||||
|
||||
foreach (var list in this.SongInformation.songs)
|
||||
{
|
||||
|
@ -155,8 +150,7 @@ namespace StardewSymphonyRemastered.Framework.V2
|
|||
{
|
||||
try
|
||||
{
|
||||
Texture2D texture = this.ContentPack.LoadAsset<Texture2D>("icon.png");
|
||||
return new Texture2DExtended(texture);
|
||||
return new Texture2DExtended(this.ContentPack,"icon.png");
|
||||
}
|
||||
catch (Exception err)
|
||||
{
|
||||
|
|
|
@ -51,11 +51,9 @@ namespace StardewSymphonyRemastered
|
|||
|
||||
helper.Events.Display.MenuChanged += this.OnMenuChanged;
|
||||
|
||||
helper.Events.GameLoop.GameLaunched += this.OnGameLaunched;
|
||||
|
||||
|
||||
musicManager = new MusicManagerV2();
|
||||
textureManager = new TextureManager();
|
||||
textureManager = new TextureManager("StardewSymphony");
|
||||
this.LoadTextures();
|
||||
|
||||
menuChangedMusic = false;
|
||||
|
@ -95,16 +93,6 @@ namespace StardewSymphonyRemastered
|
|||
musicManager.selectMusic(SongSpecificsV2.getCurrentConditionalString(), true);
|
||||
}
|
||||
|
||||
/// <summary>Raised after the game is launched, right before the first update tick. This happens once per game session (unrelated to loading saves). All mods are loaded and initialised at this point, so this is a good time to set up mod integrations.</summary>
|
||||
/// <param name="sender">The event sender.</param>
|
||||
/// <param name="e">The event arguments.</param>
|
||||
private void OnGameLaunched(object sender, GameLaunchedEventArgs e)
|
||||
{
|
||||
// Ran once all of the entry methods are ran. This will ensure that all custom music from other mods has been properly loaded in.
|
||||
|
||||
|
||||
}
|
||||
|
||||
/// <summary>Raised after the player loads a save slot and the world is initialised.</summary>
|
||||
/// <param name="sender">The event sender.</param>
|
||||
/// <param name="e">The event arguments.</param>
|
||||
|
@ -222,7 +210,7 @@ namespace StardewSymphonyRemastered
|
|||
{
|
||||
Texture2DExtended LoadTexture(string name)
|
||||
{
|
||||
return new Texture2DExtended(this.Helper.Content.Load<Texture2D>($"assets/{name}"));
|
||||
return new Texture2DExtended(this.Helper, this.ModManifest, $"assets/{name}");
|
||||
}
|
||||
|
||||
textureManager.addTexture("SaveIcon", LoadTexture("SaveIcon.png"));
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"Name": "Stardew Symphony Remastered",
|
||||
"Author": "Alpha_Omegasis",
|
||||
"Version": "3.0.0",
|
||||
"Version": "3.0.1",
|
||||
"Description": "Adding more music to the game one beep at a time. Now with streaming!",
|
||||
"UniqueID": "Omegasis.StardewSymphonyRemastered",
|
||||
"EntryDll": "StardewSymphonyRemastered.dll",
|
||||
|
|
|
@ -32,13 +32,18 @@ namespace StardustCore
|
|||
SpriteFonts.initialize();
|
||||
|
||||
TextureManagers = new Dictionary<string, TextureManager>();
|
||||
TextureManager = new TextureManager();
|
||||
TextureManager.addTexture("Test1", new Texture2DExtended(ModCore.ModHelper, Path.Combine("Content", "Graphics", "MultiTest", "Test1.png")));
|
||||
TextureManager.addTexture("Test2", new Texture2DExtended(ModCore.ModHelper, Path.Combine("Content", "Graphics", "MultiTest", "Test2.png")));
|
||||
TextureManager.addTexture("Test3", new Texture2DExtended(ModCore.ModHelper, Path.Combine("Content", "Graphics", "MultiTest", "Test3.png")));
|
||||
TextureManager = new TextureManager("StardustCore");
|
||||
TextureManager.addTexture("Test1", new Texture2DExtended(ModCore.ModHelper,Manifest,Path.Combine("Content", "Graphics", "MultiTest", "Test1.png")));
|
||||
TextureManager.addTexture("Test2", new Texture2DExtended(ModCore.ModHelper,Manifest, Path.Combine("Content", "Graphics", "MultiTest", "Test2.png")));
|
||||
TextureManager.addTexture("Test3", new Texture2DExtended(ModCore.ModHelper, Manifest,Path.Combine("Content", "Graphics", "MultiTest", "Test3.png")));
|
||||
TextureManagers.Add(this.ModManifest.UniqueID, TextureManager);
|
||||
|
||||
this.config = ModHelper.ReadConfig<ModConfig>();
|
||||
}
|
||||
|
||||
public static void log(string message)
|
||||
{
|
||||
ModMonitor.Log(message);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7,53 +7,120 @@ namespace StardustCore.UIUtilities
|
|||
{
|
||||
public class Texture2DExtended
|
||||
{
|
||||
/*********
|
||||
** Accessors
|
||||
*********/
|
||||
/// <summary>The underlying texture.</summary>
|
||||
public Texture2D Texture { get; }
|
||||
public string Name;
|
||||
public Texture2D texture;
|
||||
public string path;
|
||||
public string modID;
|
||||
public ContentSource source;
|
||||
private readonly IModHelper helper;
|
||||
private readonly IContentPack content;
|
||||
public int Width
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.texture.Width;
|
||||
}
|
||||
}
|
||||
public int Height
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.texture.Height;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>The texture width.</summary>
|
||||
public int Width => this.Texture.Width;
|
||||
|
||||
/// <summary>The texture height.</summary>
|
||||
public int Height => this.Texture.Height;
|
||||
|
||||
|
||||
/*********
|
||||
** Public methods
|
||||
*********/
|
||||
/// <summary>Empty/null constructor.</summary>
|
||||
public Texture2DExtended()
|
||||
{
|
||||
this.Texture = null;
|
||||
this.Name = "";
|
||||
this.texture = null;
|
||||
this.path = "";
|
||||
this.helper = null;
|
||||
this.modID = "";
|
||||
}
|
||||
|
||||
|
||||
/// <summary>Construct an instance.</summary>
|
||||
public Texture2DExtended(Texture2D texture)
|
||||
/// <param name="path">The relative path to file on disk. See StardustCore.Utilities.getRelativePath(modname,path);
|
||||
public Texture2DExtended(IModHelper helper, IManifest manifest, string path, ContentSource contentSource = ContentSource.ModFolder)
|
||||
{
|
||||
this.Texture = texture;
|
||||
this.Name = Path.GetFileNameWithoutExtension(path);
|
||||
this.path = path;
|
||||
this.texture = helper.Content.Load<Texture2D>(path, contentSource);
|
||||
this.helper = helper;
|
||||
this.modID = manifest.UniqueID;
|
||||
this.source = contentSource;
|
||||
}
|
||||
|
||||
public Texture2DExtended(IModHelper helper, string path, ContentSource contentSource = ContentSource.ModFolder)
|
||||
public Texture2DExtended(IModHelper helper, string modID, string path, ContentSource contentSource = ContentSource.ModFolder)
|
||||
{
|
||||
this.Texture = helper.Content.Load<Texture2D>(path, contentSource);
|
||||
this.Name = Path.GetFileNameWithoutExtension(path);
|
||||
this.path = path;
|
||||
this.texture = helper.Content.Load<Texture2D>(path, contentSource);
|
||||
this.helper = helper;
|
||||
this.modID = modID;
|
||||
this.source = contentSource;
|
||||
}
|
||||
|
||||
public Texture2DExtended(IContentPack ContentPack, IManifest manifest, string path)
|
||||
{
|
||||
this.Name = Path.GetFileNameWithoutExtension(path);
|
||||
this.path = path;
|
||||
this.texture = ContentPack.LoadAsset<Texture2D>(path);
|
||||
this.helper = null;
|
||||
this.modID = manifest.UniqueID;
|
||||
this.source = ContentSource.ModFolder;
|
||||
}
|
||||
public Texture2DExtended(IContentPack ContentPack, string modID, string path)
|
||||
{
|
||||
this.Name = Path.GetFileNameWithoutExtension(path);
|
||||
this.path = path;
|
||||
this.texture = ContentPack.LoadAsset<Texture2D>(path);
|
||||
this.helper = null;
|
||||
this.modID = modID;
|
||||
this.source = ContentSource.ModFolder;
|
||||
}
|
||||
|
||||
public Texture2DExtended(IContentPack content, string path)
|
||||
{
|
||||
this.Name = Path.GetFileNameWithoutExtension(path);
|
||||
this.path = path;
|
||||
this.content = content;
|
||||
this.texture = content.LoadAsset<Texture2D>(path);
|
||||
this.helper = null;
|
||||
this.modID = content.Manifest.UniqueID;
|
||||
}
|
||||
|
||||
public Texture2DExtended Copy()
|
||||
{
|
||||
Texture2D clone = new Texture2D(this.Texture.GraphicsDevice, this.Texture.Width, this.Texture.Height);
|
||||
Color[] data = new Color[clone.Width * clone.Height];
|
||||
this.Texture.GetData(data);
|
||||
clone.SetData(data);
|
||||
if (this.helper != null)
|
||||
{
|
||||
return new Texture2DExtended(this.helper, this.modID, this.path);
|
||||
}
|
||||
else if (this.content != null)
|
||||
{
|
||||
return new Texture2DExtended(this.content, this.path);
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new System.Exception("Trying to copy a texture that isn't from a mod or a content pack!!!");
|
||||
}
|
||||
}
|
||||
|
||||
return new Texture2DExtended(clone);
|
||||
public IModHelper getHelper()
|
||||
{
|
||||
return this.helper;
|
||||
}
|
||||
|
||||
/// <summary>Returns the actual 2D texture held by this wrapper class.</summary>
|
||||
public Texture2D getTexture()
|
||||
{
|
||||
return this.Texture;
|
||||
return this.texture;
|
||||
}
|
||||
|
||||
public void setTexure(Texture2D text)
|
||||
{
|
||||
this.texture = text;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,14 +1,31 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using StardewModdingAPI;
|
||||
|
||||
namespace StardustCore.UIUtilities
|
||||
{
|
||||
public class TextureManager
|
||||
{
|
||||
public static Dictionary<string, Dictionary<string, TextureManager>> TextureManagers = new Dictionary<string, Dictionary<string, TextureManager>>();
|
||||
|
||||
|
||||
public Dictionary<string, Texture2DExtended> textures;
|
||||
|
||||
public TextureManager()
|
||||
public string name;
|
||||
|
||||
public TextureManager(string Name)
|
||||
{
|
||||
this.name = Name;
|
||||
this.textures = new Dictionary<string, Texture2DExtended>();
|
||||
}
|
||||
|
||||
|
||||
public TextureManager(string Name, IContentPack ContentPack)
|
||||
{
|
||||
this.name = Name;
|
||||
this.textures = new Dictionary<string, Texture2DExtended>();
|
||||
}
|
||||
|
||||
|
@ -25,7 +42,240 @@ namespace StardustCore.UIUtilities
|
|||
if (v.Key == name)
|
||||
return v.Value.Copy();
|
||||
}
|
||||
throw new Exception("Error, texture name not found!!! Name: "+name);
|
||||
throw new Exception("Error, texture name not found!!!");
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Content pack search.
|
||||
/// </summary>
|
||||
public void searchForTextures(IContentPack content, string RelativePath)
|
||||
{
|
||||
if (string.IsNullOrEmpty(RelativePath))
|
||||
{
|
||||
string path = content.DirectoryPath;
|
||||
this.searchDirectories(path, "", content);
|
||||
}
|
||||
else
|
||||
{
|
||||
string path = Path.Combine(content.DirectoryPath, RelativePath);
|
||||
this.searchDirectories(path, RelativePath, content);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Non-Content pack search.
|
||||
/// </summary>
|
||||
public void searchForTextures(string RelativePath = "")
|
||||
{
|
||||
if (string.IsNullOrEmpty(RelativePath))
|
||||
{
|
||||
string path = ModCore.ModHelper.DirectoryPath;
|
||||
this.searchDirectories(path, "", ModCore.Manifest);
|
||||
}
|
||||
else
|
||||
{
|
||||
string path = Path.Combine(ModCore.ModHelper.DirectoryPath, RelativePath);
|
||||
this.searchDirectories(path, RelativePath, ModCore.Manifest);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Searches for textures in the given path. Used to search for textures in extended mods.
|
||||
/// </summary>
|
||||
/// <param name="ABSPath">The absolute starting path to start looking</param>
|
||||
/// <param name="RelativePath"></param>
|
||||
public void searchForTextures(string ABSPath,IModHelper helper,IManifest manifest,string RelativePath = "")
|
||||
{
|
||||
if (string.IsNullOrEmpty(RelativePath))
|
||||
{
|
||||
string path = ABSPath;
|
||||
this.searchDirectories(path, "", manifest);
|
||||
}
|
||||
else
|
||||
{
|
||||
string path = Path.Combine(ABSPath, RelativePath);
|
||||
this.searchDirectories(path, RelativePath, manifest);
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// Used to search through a mod's directories for textures.
|
||||
/// </summary>
|
||||
/// <param name="helper">The mod's SMAPI helper object.</param>
|
||||
/// <param name="manifest">The mod's SMAPI manifest object.</param>
|
||||
/// <param name="RelativePath">The relative starting path.</param>
|
||||
public void searchForTextures(IModHelper helper, IManifest manifest, string RelativePath = "")
|
||||
{
|
||||
if (string.IsNullOrEmpty(RelativePath))
|
||||
{
|
||||
string path = helper.DirectoryPath;
|
||||
this.searchDirectories(path, "",helper,manifest);
|
||||
}
|
||||
else
|
||||
{
|
||||
string path = Path.Combine(helper.DirectoryPath, RelativePath);
|
||||
this.searchDirectories(path, RelativePath,helper ,manifest);
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// Used to search the directories of a mod that has been extended from Stardust Core.
|
||||
/// </summary>
|
||||
/// <param name="path">The path to the manifest's directory path</param>
|
||||
/// <param name="relativePath"></param>
|
||||
/// <param name="helper"></param>
|
||||
/// <param name="manifest"></param>
|
||||
private void searchDirectories(string path, string relativePath, IModHelper helper,IManifest manifest)
|
||||
{
|
||||
string[] dirs = Directory.GetDirectories(path);
|
||||
string[] files = Directory.GetFiles(path);
|
||||
|
||||
string[] extensions = new string[2]
|
||||
{
|
||||
".png",
|
||||
".jpg"
|
||||
};
|
||||
|
||||
foreach (string directory in dirs)
|
||||
{
|
||||
string combo = string.IsNullOrEmpty(relativePath) ? Path.GetFileName(directory) : Path.Combine(relativePath, Path.GetFileName(directory));
|
||||
this.searchDirectories(directory, combo, helper,manifest);
|
||||
}
|
||||
|
||||
foreach (string file in files)
|
||||
{
|
||||
if (extensions.Contains(Path.GetExtension(file)))
|
||||
{
|
||||
this.processFoundTexture(file, relativePath,helper,manifest);
|
||||
//StardustCore.ModCore.ModMonitor.Log("Found a texture!: "+Path.GetFileNameWithoutExtension(file));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void searchDirectories(string path, string relativePath, IManifest manifest)
|
||||
{
|
||||
string[] dirs = Directory.GetDirectories(path);
|
||||
string[] files = Directory.GetFiles(path);
|
||||
|
||||
string[] extensions = new string[2]
|
||||
{
|
||||
".png",
|
||||
".jpg"
|
||||
};
|
||||
|
||||
foreach (string directory in dirs)
|
||||
{
|
||||
string combo = string.IsNullOrEmpty(relativePath) ? Path.GetFileName(directory) : Path.Combine(relativePath, Path.GetFileName(directory));
|
||||
this.searchDirectories(directory, combo, manifest);
|
||||
}
|
||||
|
||||
foreach (string file in files)
|
||||
{
|
||||
if (extensions.Contains(Path.GetExtension(file)))
|
||||
{
|
||||
this.processFoundTexture(file, relativePath);
|
||||
//StardustCore.ModCore.ModMonitor.Log("Found a texture!: "+Path.GetFileNameWithoutExtension(file));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
private void searchDirectories(string path, string relativePath, IContentPack ContentPack)
|
||||
{
|
||||
string[] dirs = Directory.GetDirectories(path);
|
||||
string[] files = Directory.GetFiles(path);
|
||||
|
||||
string[] extensions = new string[2]
|
||||
{
|
||||
".png",
|
||||
".jpg"
|
||||
};
|
||||
|
||||
foreach (string directory in dirs)
|
||||
{
|
||||
string combo = string.IsNullOrEmpty(relativePath) ? Path.GetFileName(directory) : Path.Combine(relativePath, Path.GetFileName(directory));
|
||||
this.searchDirectories(directory, combo, ContentPack);
|
||||
}
|
||||
|
||||
foreach (string file in files)
|
||||
{
|
||||
if (extensions.Contains(Path.GetExtension(file)))
|
||||
{
|
||||
this.processFoundTexture(file, relativePath, ContentPack);
|
||||
//StardustCore.ModCore.ModMonitor.Log("Found a texture!: " + Path.GetFileNameWithoutExtension(file));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void processFoundTexture(string file, string relativePath)
|
||||
{
|
||||
Texture2DExtended textureExtended = new Texture2DExtended(ModCore.ModHelper, ModCore.Manifest, Path.Combine(relativePath, Path.GetFileName(file)));
|
||||
|
||||
ModCore.log("Found texture: " + textureExtended.Name);
|
||||
|
||||
textureExtended.texture.Name = ModCore.Manifest.UniqueID + "_" + this.name + "_" + textureExtended.Name;
|
||||
|
||||
this.addTexture(textureExtended.Name, textureExtended);
|
||||
}
|
||||
|
||||
private void processFoundTexture(string file,string relativePath ,IModHelper Helper, IManifest Manifest)
|
||||
{
|
||||
Texture2DExtended textureExtended = new Texture2DExtended(Helper, Manifest, Path.Combine(relativePath, Path.GetFileName(file)));
|
||||
|
||||
ModCore.log("Found texture: " + textureExtended.Name);
|
||||
|
||||
textureExtended.texture.Name = Manifest.UniqueID + "_" + this.name + "_" + textureExtended.Name;
|
||||
|
||||
this.addTexture(textureExtended.Name, textureExtended);
|
||||
}
|
||||
|
||||
private void processFoundTexture(string file, string relativePath, IContentPack ContentPack)
|
||||
{
|
||||
Texture2DExtended textureExtended = new Texture2DExtended(ContentPack, Path.Combine(relativePath, Path.GetFileName(file)));
|
||||
|
||||
textureExtended.texture.Name = ContentPack.Manifest.UniqueID + "_" + this.name + "_" + textureExtended.Name;
|
||||
ModCore.log("Found texture: " + textureExtended.Name);
|
||||
|
||||
//this.addTexture(textureExtended.Name, textureExtended);
|
||||
}
|
||||
|
||||
|
||||
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~//
|
||||
// Static Functions //
|
||||
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~//
|
||||
|
||||
public static void addTexture(IManifest ModManifest, string managerName, string textureName, Texture2DExtended Texture)
|
||||
{
|
||||
Texture.texture.Name = managerName + "." + textureName;
|
||||
TextureManagers[ModManifest.UniqueID][managerName].addTexture(textureName, Texture);
|
||||
}
|
||||
|
||||
public static void AddTextureManager(IManifest ModManifest, string Name)
|
||||
{
|
||||
if (TextureManager.TextureManagers.ContainsKey(ModManifest.UniqueID))
|
||||
{
|
||||
TextureManagers[ModManifest.UniqueID].Add(Name, new TextureManager(Name));
|
||||
}
|
||||
else
|
||||
{
|
||||
TextureManager.TextureManagers.Add(ModManifest.UniqueID, new Dictionary<string, TextureManager>());
|
||||
TextureManagers[ModManifest.UniqueID].Add(Name, new TextureManager(Name));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static TextureManager GetTextureManager(IManifest Manifest, string Name)
|
||||
{
|
||||
return TextureManagers[Manifest.UniqueID][Name];
|
||||
}
|
||||
|
||||
public static Texture2D GetTexture(IManifest Manifest, string ManagerName, string TextureName)
|
||||
{
|
||||
return GetTextureManager(Manifest, ManagerName).getTexture(TextureName).texture;
|
||||
}
|
||||
public static Texture2DExtended GetExtendedTexture(IManifest Manifest, string ManagerName, string TextureName)
|
||||
{
|
||||
return GetTextureManager(Manifest, ManagerName).getTexture(TextureName);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"Name": "StardustCore",
|
||||
"Author": "Alpha_Omegasis",
|
||||
"Version": "2.2.0",
|
||||
"Version": "2.2.1",
|
||||
"Description": "A core mod that allows for other mods of mine to be run.",
|
||||
"UniqueID": "Omegasis.StardustCore",
|
||||
"EntryDll": "StardustCore.dll",
|
||||
|
|
Loading…
Reference in New Issue