Got the base working for the FurnitureFactory which makes adding in new furniture objects 100000000x easier.
This commit is contained in:
parent
e4c734a1d7
commit
c2f5657ef0
|
@ -0,0 +1,35 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Revitalize.Framework.Objects;
|
||||
using Revitalize.Framework.Objects.Furniture;
|
||||
using Revitalize.Framework.Objects.InformationFiles.Furniture;
|
||||
|
||||
namespace Revitalize.Framework.Factories.Objects.Furniture
|
||||
{
|
||||
public class ChairFactoryInfo
|
||||
{
|
||||
public ChairInformation chairInfo;
|
||||
public BasicItemInformation itemInfo;
|
||||
|
||||
public ChairFactoryInfo()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public ChairFactoryInfo(ChairMultiTiledObject chair)
|
||||
{
|
||||
this.chairInfo = null;
|
||||
this.itemInfo = chair.info;
|
||||
}
|
||||
|
||||
public ChairFactoryInfo(ChairTileComponent chair)
|
||||
{
|
||||
this.chairInfo = chair.furnitureInfo;
|
||||
this.itemInfo = chair.info;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
|
@ -0,0 +1,170 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Revitalize.Framework.Factories.Objects.Furniture;
|
||||
using Revitalize.Framework.Graphics;
|
||||
using Revitalize.Framework.Graphics.Animations;
|
||||
using Revitalize.Framework.Illuminate;
|
||||
using Revitalize.Framework.Objects;
|
||||
using Revitalize.Framework.Objects.Furniture;
|
||||
|
||||
namespace Revitalize.Framework.Factories.Objects
|
||||
{
|
||||
public class FurnitureFactory
|
||||
{
|
||||
public static string ChairFolder = Path.Combine("Objects", "Furniture", "Chairs");
|
||||
|
||||
|
||||
public static void LoadChairFiles()
|
||||
{
|
||||
SerializeChairs();
|
||||
DeserializeChairs();
|
||||
}
|
||||
public 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", Framework.Graphics.TextureManager.TextureManagers["Furniture"].getTexture("Oak Chair").texture, Color.White, 0, true, typeof(Framework.Objects.Furniture.ChairTileComponent), null, new AnimationManager(TextureManager.TextureManagers["Furniture"].getTexture("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))
|
||||
}
|
||||
},
|
||||
{ "Sitting_" + (int)Framework.Enums.Direction.Down , new List<Animation>()
|
||||
{
|
||||
new Animation(new Rectangle(0,0,16,16))
|
||||
}
|
||||
},
|
||||
{ "Default_" + (int)Framework.Enums.Direction.Right , new List<Animation>()
|
||||
{
|
||||
new Animation(new Rectangle(16,0,16,16))
|
||||
}
|
||||
},
|
||||
{ "Sitting_" + (int)Framework.Enums.Direction.Right , new List<Animation>()
|
||||
{
|
||||
new Animation(new Rectangle(16,0,16,16))
|
||||
}
|
||||
},
|
||||
{ "Default_" + (int)Framework.Enums.Direction.Up , new List<Animation>()
|
||||
{
|
||||
new Animation(new Rectangle(32,0,16,16))
|
||||
}
|
||||
},
|
||||
{ "Sitting_" + (int)Framework.Enums.Direction.Up , new List<Animation>()
|
||||
{
|
||||
new Animation(new Rectangle(32,32,16,32))
|
||||
}
|
||||
},
|
||||
{ "Default_" + (int)Framework.Enums.Direction.Left , new List<Animation>()
|
||||
{
|
||||
new Animation(new Rectangle(48,0,16,16))
|
||||
}
|
||||
},
|
||||
{ "Sitting_" + (int)Framework.Enums.Direction.Left , new List<Animation>()
|
||||
{
|
||||
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["Furniture"].getTexture("Oak Chair").texture, Color.White, 0, true, typeof(Framework.Objects.Furniture.ChairTileComponent), null, new AnimationManager(TextureManager.TextureManagers["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))
|
||||
}
|
||||
},
|
||||
{ "Sitting_" + (int)Framework.Enums.Direction.Down , new List<Animation>()
|
||||
{
|
||||
new Animation(new Rectangle(0,16,16,16))
|
||||
}
|
||||
},
|
||||
{ "Default_" + (int)Framework.Enums.Direction.Right , new List<Animation>()
|
||||
{
|
||||
new Animation(new Rectangle(16,16,16,16))
|
||||
}
|
||||
},
|
||||
{ "Sitting_" + (int)Framework.Enums.Direction.Right , new List<Animation>()
|
||||
{
|
||||
new Animation(new Rectangle(16,16,16,16))
|
||||
}
|
||||
},
|
||||
{ "Default_" + (int)Framework.Enums.Direction.Up , new List<Animation>()
|
||||
{
|
||||
new Animation(new Rectangle(32,16,16,16))
|
||||
}
|
||||
},
|
||||
{ "Sitting_" + (int)Framework.Enums.Direction.Up , new List<Animation>()
|
||||
{
|
||||
new Animation(new Rectangle(48,32,16,32))
|
||||
}
|
||||
},
|
||||
{ "Default_" + (int)Framework.Enums.Direction.Left , new List<Animation>()
|
||||
{
|
||||
new Animation(new Rectangle(48,16,16,16))
|
||||
}
|
||||
},
|
||||
{ "Sitting" + (int)Framework.Enums.Direction.Left , new List<Animation>()
|
||||
{
|
||||
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["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()));
|
||||
|
||||
ChairFactoryInfo top = new ChairFactoryInfo(chairTop);
|
||||
ChairFactoryInfo bottom = new ChairFactoryInfo(chairBottom);
|
||||
ChairFactoryInfo obj = new ChairFactoryInfo(oakChair);
|
||||
|
||||
|
||||
ModCore.Serializer.SerializeContentFile("OakChair_0_-1", top, ChairFolder);
|
||||
ModCore.Serializer.SerializeContentFile("OakChair_0_0", bottom, ChairFolder);
|
||||
ModCore.Serializer.SerializeContentFile("OakChair", obj, ChairFolder);
|
||||
}
|
||||
public static void DeserializeChairs()
|
||||
{
|
||||
if (!Directory.Exists(Path.Combine(ModCore.ModHelper.DirectoryPath, "Content", ChairFolder))) Directory.CreateDirectory(Path.Combine(ModCore.ModHelper.DirectoryPath, "Content", ChairFolder));
|
||||
string[] files = Directory.GetFiles(Path.Combine(ModCore.ModHelper.DirectoryPath, "Content", ChairFolder));
|
||||
|
||||
Dictionary<string, ChairMultiTiledObject> chairObjects = new Dictionary<string, ChairMultiTiledObject>();
|
||||
|
||||
//Deserialize container.
|
||||
foreach (string file in files)
|
||||
{
|
||||
if ((Path.GetFileName(file)).Contains("_")==true) continue;
|
||||
else
|
||||
{
|
||||
chairObjects.Add(Path.GetFileNameWithoutExtension(file), new ChairMultiTiledObject(ModCore.Serializer.DeserializeContentFile<ChairFactoryInfo>(file).itemInfo));
|
||||
}
|
||||
}
|
||||
//Deseralize components
|
||||
foreach (string file in files)
|
||||
{
|
||||
if ((Path.GetFileName(file)).Contains("_")==false) continue;
|
||||
else
|
||||
{
|
||||
|
||||
string[] splits = Path.GetFileNameWithoutExtension(file).Split('_');
|
||||
string name = splits[0];
|
||||
Vector2 offset = new Vector2(Convert.ToInt32(splits[1]), Convert.ToInt32(splits[2]));
|
||||
ChairFactoryInfo info = ModCore.Serializer.DeserializeContentFile<ChairFactoryInfo>(file);
|
||||
chairObjects[name].addComponent(offset, new ChairTileComponent(info.itemInfo, info.chairInfo));
|
||||
}
|
||||
}
|
||||
foreach (var v in chairObjects)
|
||||
{
|
||||
ModCore.customObjects.Add(v.Value.info.id, v.Value);
|
||||
}
|
||||
}
|
||||
|
||||
public static ChairMultiTiledObject GetChair(string name)
|
||||
{
|
||||
|
||||
return (ChairMultiTiledObject)ModCore.GetObjectFromPool(name);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
|
@ -19,7 +19,13 @@ namespace Revitalize.Framework.Objects
|
|||
/// <summary>A custom object template.</summary>
|
||||
public class CustomObject : PySObject
|
||||
{
|
||||
public string id;
|
||||
public string id
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.info.id;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public BasicItemInformation info;
|
||||
|
|
|
@ -142,7 +142,7 @@ namespace Revitalize.Framework.Utilities.Serialization.Converters
|
|||
|
||||
public override bool CanConvert(Type objectType)
|
||||
{
|
||||
return IsSameOrSubclass(typeof(StardewValley.Item),objectType);
|
||||
return this.IsSameOrSubclass(typeof(StardewValley.Item),objectType);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
|
@ -47,7 +47,7 @@ namespace Revitalize.Framework.Utilities
|
|||
//this.addConverter(new Framework.Utilities.Serialization.Converters.NetFieldConverter());
|
||||
//this.addConverter(new Framework.Utilities.Serialization.Converters.Vector2Converter());
|
||||
|
||||
gatherAllFilesForCleanup();
|
||||
this.gatherAllFilesForCleanup();
|
||||
|
||||
this.settings = new JsonSerializerSettings();
|
||||
foreach(JsonConverter converter in this.serializer.Converters)
|
||||
|
@ -65,6 +65,7 @@ namespace Revitalize.Framework.Utilities
|
|||
/// </summary>
|
||||
private void gatherAllFilesForCleanup()
|
||||
{
|
||||
if (!Directory.Exists(Path.Combine(Revitalize.ModCore.ModHelper.DirectoryPath, "SaveData"))) Directory.CreateDirectory(Path.Combine(Revitalize.ModCore.ModHelper.DirectoryPath, "SaveData"));
|
||||
this.filesToDelete.Clear();
|
||||
string[] directories = Directory.GetDirectories(Path.Combine(Revitalize.ModCore.ModHelper.DirectoryPath, "SaveData"));
|
||||
foreach (string playerData in directories)
|
||||
|
@ -95,19 +96,19 @@ namespace Revitalize.Framework.Utilities
|
|||
/// </summary>
|
||||
public void afterLoad()
|
||||
{
|
||||
deleteAllUnusedFiles();
|
||||
removeNullObjects();
|
||||
this.deleteAllUnusedFiles();
|
||||
this.removeNullObjects();
|
||||
}
|
||||
|
||||
public void returnToTitle()
|
||||
{
|
||||
gatherAllFilesForCleanup();
|
||||
this.gatherAllFilesForCleanup();
|
||||
}
|
||||
|
||||
private void removeNullObjects()
|
||||
{
|
||||
List<Item> removalList = new List<Item>();
|
||||
foreach(Item I in Game1.player.items)
|
||||
foreach(Item I in Game1.player.Items)
|
||||
{
|
||||
if (I == null) continue;
|
||||
if (I.DisplayName.Contains("Revitalize.Framework") && (I is Chest))
|
||||
|
@ -118,7 +119,7 @@ namespace Revitalize.Framework.Utilities
|
|||
}
|
||||
foreach(Item I in removalList)
|
||||
{
|
||||
Game1.player.items.Remove(I);
|
||||
Game1.player.Items.Remove(I);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -228,9 +229,9 @@ namespace Revitalize.Framework.Utilities
|
|||
/// <param name="obj"></param>
|
||||
public void SerializeGUID(string fileName,object obj)
|
||||
{
|
||||
string path = Path.Combine(Revitalize.ModCore.ModHelper.DirectoryPath, "SaveData", Game1.player.name + "_" + Game1.player.uniqueMultiplayerID, "SavedObjectInformation", fileName + ".json");
|
||||
string path = Path.Combine(Revitalize.ModCore.ModHelper.DirectoryPath, "SaveData", Game1.player.Name + "_" + Game1.player.UniqueMultiplayerID, "SavedObjectInformation", fileName + ".json");
|
||||
Directory.CreateDirectory(Path.GetDirectoryName(path));
|
||||
Serialize(path, obj);
|
||||
this.Serialize(path, obj);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -241,9 +242,9 @@ namespace Revitalize.Framework.Utilities
|
|||
/// <returns>A data structure object deserialize from a json string in a file.</returns>
|
||||
public object DeserializeGUID(string fileName,Type T)
|
||||
{
|
||||
string path=Path.Combine(Revitalize.ModCore.ModHelper.DirectoryPath, "SaveData", Game1.player.name + "_" + Game1.player.uniqueMultiplayerID, "SavedObjectInformation", fileName + ".json");
|
||||
removeFileFromDeletion((Game1.player.name + "_" + Game1.player.uniqueMultiplayerID), path);
|
||||
return Deserialize(path, T);
|
||||
string path=Path.Combine(Revitalize.ModCore.ModHelper.DirectoryPath, "SaveData", Game1.player.Name + "_" + Game1.player.UniqueMultiplayerID, "SavedObjectInformation", fileName + ".json");
|
||||
this.removeFileFromDeletion((Game1.player.Name + "_" + Game1.player.UniqueMultiplayerID), path);
|
||||
return this.Deserialize(path, T);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -254,12 +255,12 @@ namespace Revitalize.Framework.Utilities
|
|||
/// <returns>A data structure object deserialize from a json string in a file.</returns>
|
||||
public T DeserializeGUID<T>(string fileName)
|
||||
{
|
||||
string path = Path.Combine(Revitalize.ModCore.ModHelper.DirectoryPath, "SaveData", Game1.player.name + "_" + Game1.player.uniqueMultiplayerID, "SavedObjectInformation", fileName + ".json");
|
||||
removeFileFromDeletion((Game1.player.name + "_" + Game1.player.uniqueMultiplayerID),path);
|
||||
string path = Path.Combine(Revitalize.ModCore.ModHelper.DirectoryPath, "SaveData", Game1.player.Name + "_" + Game1.player.UniqueMultiplayerID, "SavedObjectInformation", fileName + ".json");
|
||||
this.removeFileFromDeletion((Game1.player.Name + "_" + Game1.player.UniqueMultiplayerID),path);
|
||||
if (File.Exists(path))
|
||||
{
|
||||
|
||||
return Deserialize<T>(path);
|
||||
return this.Deserialize<T>(path);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -299,5 +300,28 @@ namespace Revitalize.Framework.Utilities
|
|||
return JsonConvert.DeserializeObject(info, T, this.settings);
|
||||
}
|
||||
|
||||
|
||||
|
||||
public T DeserializeContentFile<T>(string pathToFile)
|
||||
{
|
||||
if (File.Exists(pathToFile))
|
||||
{
|
||||
|
||||
return this.Deserialize<T>(pathToFile);
|
||||
}
|
||||
else
|
||||
{
|
||||
return default(T);
|
||||
}
|
||||
}
|
||||
|
||||
public void SerializeContentFile(string fileName, object obj,string extensionFolder)
|
||||
{
|
||||
string path = Path.Combine(Revitalize.ModCore.ModHelper.DirectoryPath, "Content", extensionFolder,fileName+ ".json");
|
||||
Directory.CreateDirectory(Path.GetDirectoryName(path));
|
||||
if (File.Exists(path)) return;
|
||||
this.Serialize(path, obj);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7,6 +7,7 @@ using PyTK.Types;
|
|||
using Revitalize.Framework;
|
||||
using Revitalize.Framework.Crafting;
|
||||
using Revitalize.Framework.Environment;
|
||||
using Revitalize.Framework.Factories.Objects;
|
||||
using Revitalize.Framework.Graphics;
|
||||
using Revitalize.Framework.Graphics.Animations;
|
||||
using Revitalize.Framework.Illuminate;
|
||||
|
@ -37,6 +38,12 @@ namespace Revitalize
|
|||
// -Furnace
|
||||
// -Seed Maker
|
||||
// -Stone Quarry
|
||||
// -Mayo Maker
|
||||
// -Cheese Maker
|
||||
// -Auto fisher
|
||||
// -Auto Preserves
|
||||
// -Auto Keg
|
||||
// -Auto Cask
|
||||
// -Materials
|
||||
// -Tin/Bronze/Alluminum/Silver?Platinum/Etc
|
||||
// -Crafting Menu
|
||||
|
@ -128,10 +135,12 @@ namespace Revitalize
|
|||
customObjects = new Dictionary<string, CustomObject>();
|
||||
ObjectGroups = new Dictionary<string, MultiTiledObject>();
|
||||
|
||||
this.loadContent();
|
||||
|
||||
Serializer = new Serializer();
|
||||
ObjectsToDraw = new Dictionary<GameLocation, MultiTiledObject>();
|
||||
|
||||
this.loadContent();
|
||||
|
||||
|
||||
}
|
||||
|
||||
private void GameLoop_ReturnedToTitle(object sender, StardewModdingAPI.Events.ReturnedToTitleEventArgs e)
|
||||
|
@ -158,107 +167,16 @@ namespace Revitalize
|
|||
[bigObject] = 1
|
||||
}, new KeyValuePair<Item, int>(new Furniture(3, Vector2.Zero), 1), new StatCost(100, 50, 0, 0));
|
||||
|
||||
|
||||
|
||||
|
||||
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.Basic.OakChair", "2048/0/-300/Crafting -9/Play '2048 by Platonymous' at home!/true/true/0/2048", Framework.Graphics.TextureManager.TextureManagers["Furniture"].getTexture("Oak Chair").texture, Color.White, 0, false, typeof(Framework.Objects.Furniture.ChairTileComponent), null, new AnimationManager(TextureManager.TextureManagers["Furniture"].getTexture("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))
|
||||
}
|
||||
},
|
||||
{ "Sitting_" + (int)Framework.Enums.Direction.Down , new List<Animation>()
|
||||
{
|
||||
new Animation(new Rectangle(0,0,16,16))
|
||||
}
|
||||
},
|
||||
{ "Default_" + (int)Framework.Enums.Direction.Right , new List<Animation>()
|
||||
{
|
||||
new Animation(new Rectangle(16,0,16,16))
|
||||
}
|
||||
},
|
||||
{ "Sitting_" + (int)Framework.Enums.Direction.Right , new List<Animation>()
|
||||
{
|
||||
new Animation(new Rectangle(16,0,16,16))
|
||||
}
|
||||
},
|
||||
{ "Default_" + (int)Framework.Enums.Direction.Up , new List<Animation>()
|
||||
{
|
||||
new Animation(new Rectangle(32,0,16,16))
|
||||
}
|
||||
},
|
||||
{ "Sitting_" + (int)Framework.Enums.Direction.Up , new List<Animation>()
|
||||
{
|
||||
new Animation(new Rectangle(32,32,16,32))
|
||||
}
|
||||
},
|
||||
{ "Default_" + (int)Framework.Enums.Direction.Left , new List<Animation>()
|
||||
{
|
||||
new Animation(new Rectangle(48,0,16,16))
|
||||
}
|
||||
},
|
||||
{ "Sitting_" + (int)Framework.Enums.Direction.Left , new List<Animation>()
|
||||
{
|
||||
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.Basic.OakChair", "2048/0/-300/Crafting -9/Play '2048 by Platonymous' at home!/true/true/0/2048", Framework.Graphics.TextureManager.TextureManagers["Furniture"].getTexture("Oak Chair").texture, Color.White, 0, false, typeof(Framework.Objects.Furniture.ChairTileComponent), null, new AnimationManager(TextureManager.TextureManagers["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))
|
||||
}
|
||||
},
|
||||
{ "Sitting_" + (int)Framework.Enums.Direction.Down , new List<Animation>()
|
||||
{
|
||||
new Animation(new Rectangle(0,16,16,16))
|
||||
}
|
||||
},
|
||||
{ "Default_" + (int)Framework.Enums.Direction.Right , new List<Animation>()
|
||||
{
|
||||
new Animation(new Rectangle(16,16,16,16))
|
||||
}
|
||||
},
|
||||
{ "Sitting_" + (int)Framework.Enums.Direction.Right , new List<Animation>()
|
||||
{
|
||||
new Animation(new Rectangle(16,16,16,16))
|
||||
}
|
||||
},
|
||||
{ "Default_" + (int)Framework.Enums.Direction.Up , new List<Animation>()
|
||||
{
|
||||
new Animation(new Rectangle(32,16,16,16))
|
||||
}
|
||||
},
|
||||
{ "Sitting_" + (int)Framework.Enums.Direction.Up , new List<Animation>()
|
||||
{
|
||||
new Animation(new Rectangle(48,32,16,32))
|
||||
}
|
||||
},
|
||||
{ "Default_" + (int)Framework.Enums.Direction.Left , new List<Animation>()
|
||||
{
|
||||
new Animation(new Rectangle(48,16,16,16))
|
||||
}
|
||||
},
|
||||
{ "Sitting" + (int)Framework.Enums.Direction.Left , new List<Animation>()
|
||||
{
|
||||
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.OakChair", "2048/0/-300/Crafting -9/Play '2048 by Platonymous' at home!/true/true/0/2048", TextureManager.TextureManagers["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()));
|
||||
oakChair.addComponent(new Vector2(0, -1), chairTop);
|
||||
oakChair.addComponent(new Vector2(0, 0), chairBottom);
|
||||
|
||||
customObjects.Add("Omegasis.BigTiledTest", bigObject);
|
||||
customObjects.Add("Omegasis.Revitalize.Furniture.Chairs.OakChair",oakChair);
|
||||
|
||||
|
||||
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["Furniture"].getTexture("Oak Chair").texture, Color.White, 0,true, typeof(Framework.Objects.Furniture.RugTileComponent), null, new AnimationManager(TextureManager.TextureManagers["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["Furniture"].getTexture("Oak Chair").texture, Color.White, 0, true, typeof(Framework.Objects.Furniture.RugMultiTiledObject), null, new AnimationManager(), Color.White, true, null, null));
|
||||
rug.addComponent(new Vector2(0, 0), rug1);
|
||||
|
||||
customObjects.Add("Omegasis.Revitalize.Furniture.Rugs.RugTest", rug);
|
||||
|
||||
FurnitureFactory.LoadChairFiles();
|
||||
}
|
||||
|
||||
private void createDirectories()
|
||||
|
@ -289,6 +207,9 @@ namespace Revitalize
|
|||
|
||||
private void GameLoop_SaveLoaded(object sender, StardewModdingAPI.Events.SaveLoadedEventArgs e)
|
||||
{
|
||||
|
||||
|
||||
|
||||
Serializer.afterLoad();
|
||||
|
||||
if (Game1.IsServer || Game1.IsMultiplayer || Game1.IsClient)
|
||||
|
@ -296,8 +217,8 @@ namespace Revitalize
|
|||
throw new Exception("Can't run Revitalize in multiplayer due to lack of current support!");
|
||||
}
|
||||
//Game1.player.addItemToInventory(customObjects["Omegasis.BigTiledTest"].getOne());
|
||||
Game1.player.addItemToInventory(this.getObjectFromPool("Omegasis.Revitalize.Furniture.Chairs.OakChair"));
|
||||
Game1.player.addItemToInventory(this.getObjectFromPool("Omegasis.Revitalize.Furniture.Rugs.RugTest"));
|
||||
Game1.player.addItemToInventory(GetObjectFromPool("Omegasis.Revitalize.Furniture.Chairs.OakChair"));
|
||||
Game1.player.addItemToInventory(GetObjectFromPool("Omegasis.Revitalize.Furniture.Rugs.RugTest"));
|
||||
|
||||
/*
|
||||
StardewValley.Tools.Axe axe = new StardewValley.Tools.Axe();
|
||||
|
@ -308,7 +229,7 @@ namespace Revitalize
|
|||
|
||||
}
|
||||
|
||||
public Item getObjectFromPool(string objName)
|
||||
public static Item GetObjectFromPool(string objName)
|
||||
{
|
||||
if (customObjects.ContainsKey(objName))
|
||||
{
|
||||
|
|
|
@ -54,6 +54,8 @@
|
|||
<Compile Include="Framework\Enums\Enums.cs" />
|
||||
<Compile Include="Framework\Environment\DarkerNight.cs" />
|
||||
<Compile Include="Framework\Environment\DarkerNightConfig.cs" />
|
||||
<Compile Include="Framework\Factories\Objects\FurnitureFactory.cs" />
|
||||
<Compile Include="Framework\Factories\Objects\Furniture\ChairFactoryInfo.cs" />
|
||||
<Compile Include="Framework\Graphics\Animations\Animation.cs" />
|
||||
<Compile Include="Framework\Graphics\Animations\AnimationManager.cs" />
|
||||
<Compile Include="Framework\Graphics\Texture2DExtended.cs" />
|
||||
|
@ -92,5 +94,6 @@
|
|||
<ItemGroup>
|
||||
<None Include="manifest.json" />
|
||||
</ItemGroup>
|
||||
<ItemGroup />
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
</Project>
|
Loading…
Reference in New Issue