unsure how to continue...
This commit is contained in:
parent
c329613f09
commit
5b6d02babd
|
@ -33,5 +33,12 @@ namespace Revitalize.Framework.Graphics
|
|||
}
|
||||
throw new Exception("Error, texture name not found!!!");
|
||||
}
|
||||
|
||||
public static void addTexture(string managerName, string textureName, Texture2DExtended Texture)
|
||||
{
|
||||
Texture.texture.Name = managerName + '.' + textureName;
|
||||
TextureManagers[managerName].addTexture(textureName, Texture);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -38,7 +38,7 @@ namespace Revitalize.Framework.Illuminate
|
|||
|
||||
this.lights.TryGetValue(IdKey, out LightSource light);
|
||||
Game1.currentLightSources.Remove(light);
|
||||
location.sharedLights.Remove(light);
|
||||
location.sharedLights.Remove((int)IdKey.X * 1000000 + (int)IdKey.Y);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -61,7 +61,7 @@ namespace Revitalize.Framework.Illuminate
|
|||
|
||||
Game1.showRedMessage("TURN ON!");
|
||||
Game1.currentLightSources.Add(light);
|
||||
location.sharedLights.Add(light);
|
||||
location.sharedLights.Add((int)IdKey.X*10000+(int)IdKey.Y,light);
|
||||
this.repositionLight(light, IdKey, gameObject);
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -5,6 +5,7 @@ using PyTK.CustomElementHandler;
|
|||
using Revitalize.Framework.Graphics.Animations;
|
||||
using Revitalize.Framework.Illuminate;
|
||||
using Revitalize.Framework.Utilities;
|
||||
using StardewValley;
|
||||
|
||||
namespace Revitalize.Framework.Objects
|
||||
{
|
||||
|
@ -22,6 +23,7 @@ namespace Revitalize.Framework.Objects
|
|||
public bool canBeSetOutdoors;
|
||||
public bool isLamp;
|
||||
|
||||
|
||||
public AnimationManager animationManager;
|
||||
public Vector2 drawPosition;
|
||||
|
||||
|
@ -54,10 +56,12 @@ namespace Revitalize.Framework.Objects
|
|||
this.lightManager = new LightManager();
|
||||
|
||||
this.facingDirection = Enums.Direction.Down;
|
||||
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
|
||||
this.name = name;
|
||||
this.description = description;
|
||||
this.categoryName = categoryName;
|
||||
|
@ -93,5 +97,7 @@ namespace Revitalize.Framework.Objects
|
|||
{
|
||||
this.data = $"{this.name}/{this.price}/{this.edibility}/Crafting -9/{this.description}/{this.canBeSetOutdoors}/{this.canBeSetIndoors}/{this.fragility}/{this.isLamp}/{this.name}";
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,6 +3,7 @@ using System.Collections.Generic;
|
|||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using Microsoft.Xna.Framework.Input;
|
||||
using Newtonsoft.Json;
|
||||
using PyTK.CustomElementHandler;
|
||||
using Revitalize.Framework.Graphics.Animations;
|
||||
using StardewValley;
|
||||
|
@ -19,15 +20,21 @@ namespace Revitalize.Framework.Objects
|
|||
public class CustomObject : PySObject
|
||||
{
|
||||
public string id;
|
||||
|
||||
|
||||
public BasicItemInformation info;
|
||||
public GameLocation location;
|
||||
|
||||
|
||||
/// <summary>The animation manager.</summary>
|
||||
public AnimationManager animationManager => this.info.animationManager;
|
||||
|
||||
/// <summary>The display texture for this object.</summary>
|
||||
[JsonIgnore]
|
||||
public Texture2D displayTexture => this.animationManager.getTexture();
|
||||
|
||||
|
||||
|
||||
/// <summary>Empty constructor.</summary>
|
||||
public CustomObject() { }
|
||||
|
||||
|
|
|
@ -111,28 +111,41 @@ namespace Revitalize.Framework.Objects
|
|||
|
||||
Vector2 offsetKey = new Vector2(Convert.ToInt32(additionalSaveData["offsetKeyX"]), Convert.ToInt32(additionalSaveData["offsetKeyY"]));
|
||||
|
||||
if (offsetKey.X == 0 && offsetKey.Y == 0)
|
||||
|
||||
|
||||
|
||||
//do same container creation logic in multitiled object
|
||||
|
||||
|
||||
MultiTiledComponent self = null;
|
||||
|
||||
if (!Revitalize.ModCore.ObjectGroups.ContainsKey(additionalSaveData["GUID"]))
|
||||
{
|
||||
Revitalize.ModCore.log(recreateParentId(additionalSaveData["id"]) + ".Object");
|
||||
CustomObject obj=(CustomObject)(Revitalize.ModCore.customObjects[recreateParentId(additionalSaveData["id"])+".Object"].getOne());
|
||||
obj.Stack =Convert.ToInt32( additionalSaveData["stack"]);
|
||||
|
||||
string saveLocation = additionalSaveData["GameLocationName"];
|
||||
//Get new container
|
||||
CustomObject obj = (CustomObject)(Revitalize.ModCore.customObjects[additionalSaveData["ParentID"]].getOne());
|
||||
self = (MultiTiledComponent)(obj as MultiTiledObject).objects[offsetKey];
|
||||
Revitalize.ModCore.ObjectGroups.Add(additionalSaveData["GUID"], (MultiTiledObject)obj);
|
||||
}
|
||||
else
|
||||
{
|
||||
self =(MultiTiledComponent)Revitalize.ModCore.ObjectGroups[additionalSaveData["GUID"]].objects[offsetKey];
|
||||
self.containerObject = Revitalize.ModCore.ObjectGroups[additionalSaveData["GUID"]];
|
||||
}
|
||||
|
||||
self.TileLocation = (replacement as Chest).TileLocation;
|
||||
|
||||
Enums.Direction facingDirection = (Enums.Direction)Convert.ToInt32(additionalSaveData["Rotation"]);
|
||||
while (obj.info.facingDirection != facingDirection)
|
||||
while (self.info.facingDirection != facingDirection)
|
||||
{
|
||||
obj.rotate();
|
||||
self.rotate();
|
||||
}
|
||||
|
||||
if (!string.IsNullOrEmpty(saveLocation))
|
||||
if (!string.IsNullOrEmpty(additionalSaveData["GameLocationName"]))
|
||||
{
|
||||
obj.placementAction(Game1.getLocationFromName(saveLocation), (int)(replacement as Chest).TileLocation.X, (int)(replacement as Chest).TileLocation.Y);
|
||||
return null;
|
||||
self.location = Game1.getLocationFromName(additionalSaveData["GameLocationName"]);
|
||||
}
|
||||
|
||||
return (ICustomObject)obj;
|
||||
return (ICustomObject)self;
|
||||
BasicItemInformation data = Revitalize.ModCore.customObjects[additionalSaveData["id"]].info;
|
||||
return new MultiTiledComponent(data, (replacement as Chest).TileLocation)
|
||||
{
|
||||
|
@ -141,20 +154,17 @@ namespace Revitalize.Framework.Objects
|
|||
Stack = Convert.ToInt32(additionalSaveData["stack"])
|
||||
};
|
||||
}
|
||||
else
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public override Dictionary<string, string> getAdditionalSaveData()
|
||||
{
|
||||
Dictionary<string,string> saveData= base.getAdditionalSaveData();
|
||||
saveData.Add("ParentID", this.containerObject.info.id);
|
||||
saveData.Add("offsetKeyX", this.offsetKey.X.ToString());
|
||||
saveData.Add("offsetKeyY", this.offsetKey.Y.ToString());
|
||||
string saveLocation = "";
|
||||
if (this.location == null)
|
||||
{
|
||||
Revitalize.ModCore.log("WHY IS LOCTION NULL???");
|
||||
saveLocation = "";
|
||||
}
|
||||
else
|
||||
|
@ -165,9 +175,14 @@ namespace Revitalize.Framework.Objects
|
|||
saveLocation = this.location.Name;
|
||||
}
|
||||
}
|
||||
|
||||
Revitalize.ModCore.log("SAVE LOCATION: " + saveLocation);
|
||||
|
||||
saveData.Add("GameLocationName", saveLocation);
|
||||
saveData.Add("Rotation", ((int)this.info.facingDirection).ToString());
|
||||
|
||||
saveData.Add("GUID", this.containerObject.guid.ToString());
|
||||
|
||||
return saveData;
|
||||
|
||||
}
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using Newtonsoft.Json;
|
||||
using PyTK.CustomElementHandler;
|
||||
using StardewValley;
|
||||
using StardewValley.Objects;
|
||||
|
@ -10,8 +12,11 @@ namespace Revitalize.Framework.Objects
|
|||
public class MultiTiledObject : CustomObject
|
||||
{
|
||||
public Dictionary<Vector2, StardewValley.Object> objects;
|
||||
[JsonIgnore]
|
||||
public Dictionary<MultiTiledComponent, Vector2> offSets;
|
||||
|
||||
public Guid guid;
|
||||
|
||||
private int width;
|
||||
private int height;
|
||||
public int Width
|
||||
|
@ -33,6 +38,7 @@ namespace Revitalize.Framework.Objects
|
|||
{
|
||||
this.objects = new Dictionary<Vector2, StardewValley.Object>();
|
||||
this.offSets = new Dictionary<MultiTiledComponent, Vector2>();
|
||||
this.guid = Guid.NewGuid();
|
||||
}
|
||||
|
||||
public MultiTiledObject(BasicItemInformation info)
|
||||
|
@ -40,6 +46,7 @@ namespace Revitalize.Framework.Objects
|
|||
{
|
||||
this.objects = new Dictionary<Vector2, StardewValley.Object>();
|
||||
this.offSets = new Dictionary<MultiTiledComponent, Vector2>();
|
||||
this.guid = Guid.NewGuid();
|
||||
}
|
||||
|
||||
public MultiTiledObject(BasicItemInformation info, Vector2 TileLocation)
|
||||
|
@ -47,6 +54,7 @@ namespace Revitalize.Framework.Objects
|
|||
{
|
||||
this.objects = new Dictionary<Vector2, StardewValley.Object>();
|
||||
this.offSets = new Dictionary<MultiTiledComponent, Vector2>();
|
||||
this.guid = Guid.NewGuid();
|
||||
}
|
||||
|
||||
public MultiTiledObject(BasicItemInformation info, Vector2 TileLocation, Dictionary<Vector2, StardewValley.Object> ObjectsList)
|
||||
|
@ -59,6 +67,7 @@ namespace Revitalize.Framework.Objects
|
|||
MultiTiledComponent component = (MultiTiledComponent)v.Value.getOne();
|
||||
this.addComponent(v.Key, component);
|
||||
}
|
||||
this.guid = Guid.NewGuid();
|
||||
|
||||
}
|
||||
|
||||
|
@ -194,8 +203,29 @@ namespace Revitalize.Framework.Objects
|
|||
|
||||
public override ICustomObject recreate(Dictionary<string, string> additionalSaveData, object replacement)
|
||||
{
|
||||
BasicItemInformation data = (BasicItemInformation)CustomObjectData.collection[additionalSaveData["id"]];
|
||||
return new MultiTiledObject(data, (replacement as Chest).TileLocation, this.objects);
|
||||
|
||||
|
||||
|
||||
MultiTiledObject self=(MultiTiledObject)Revitalize.ModCore.customObjects[additionalSaveData["id"]].getOne();
|
||||
|
||||
if (!Revitalize.ModCore.ObjectGroups.ContainsKey(additionalSaveData["GUID"]))
|
||||
{
|
||||
Revitalize.ModCore.ObjectGroups.Add(additionalSaveData["GUID"], self);
|
||||
return self;
|
||||
}
|
||||
else
|
||||
{
|
||||
return Revitalize.ModCore.ObjectGroups[additionalSaveData["GUID"]];
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
public override Dictionary<string, string> getAdditionalSaveData()
|
||||
{
|
||||
Dictionary<string,string> saveData= base.getAdditionalSaveData();
|
||||
saveData.Add("GUID", this.guid.ToString());
|
||||
return saveData;
|
||||
}
|
||||
|
||||
public void setAllAnimationsToDefault()
|
||||
|
|
|
@ -3,32 +3,38 @@ using System.Collections.Generic;
|
|||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using Newtonsoft.Json;
|
||||
using Revitalize.Framework.Graphics;
|
||||
using StardewValley;
|
||||
|
||||
namespace Revitalize.Framework.Utilities.Serialization.Converters
|
||||
{
|
||||
public class Texture2DConverter : JsonConverter
|
||||
{
|
||||
|
||||
|
||||
public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer)
|
||||
{
|
||||
writer.WriteValue(" ");
|
||||
var texture = (Texture2D)value;
|
||||
writer.WriteValue(texture.Name);
|
||||
}
|
||||
|
||||
public override object ReadJson(JsonReader reader, Type objectType, object existingValue,
|
||||
JsonSerializer serializer)
|
||||
public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer)
|
||||
{
|
||||
string textureName = reader.Value as string;
|
||||
ModCore.log(textureName);
|
||||
string[] names = textureName.Split('.');
|
||||
if (names.Length == 0) return null;
|
||||
|
||||
return new Texture2D(Game1.graphics.GraphicsDevice,16,16);
|
||||
if (!TextureManager.TextureManagers.ContainsKey(names[0])) return null;
|
||||
return textureName == null ? null : Revitalize.Framework.Graphics.TextureManager.TextureManagers[names[0]].getTexture(names[1]).texture;
|
||||
}
|
||||
|
||||
public override bool CanConvert(Type objectType)
|
||||
{
|
||||
return objectType == typeof(Texture2D);
|
||||
}
|
||||
|
||||
public override bool CanRead => true;
|
||||
public override bool CanWrite => true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using Microsoft.Xna.Framework;
|
||||
|
@ -11,6 +12,7 @@ using Revitalize.Framework.Graphics.Animations;
|
|||
using Revitalize.Framework.Illuminate;
|
||||
using Revitalize.Framework.Objects;
|
||||
using Revitalize.Framework.Player;
|
||||
using Revitalize.Framework.Utilities;
|
||||
using StardewModdingAPI;
|
||||
using StardewValley;
|
||||
using StardewValley.Objects;
|
||||
|
@ -18,6 +20,8 @@ using StardewValley.Objects;
|
|||
namespace Revitalize
|
||||
{
|
||||
// TODO:
|
||||
//Make guid object list to keep track of container objects on rebuild. Container objects have guid, on getAdditionalSaveData, store it. On rebuild keep a list, get a reference to container object, clear those objects, and reset them as we are rebuilting multiTiledComponents.
|
||||
//
|
||||
// -Multiple Lights On Object
|
||||
// -Illumination Colors
|
||||
// Furniture:
|
||||
|
@ -96,8 +100,12 @@ namespace Revitalize
|
|||
|
||||
public static Dictionary<string, CustomObject> customObjects;
|
||||
|
||||
public static Dictionary<string, MultiTiledObject>ObjectGroups;
|
||||
|
||||
public static PlayerInfo playerInfo;
|
||||
|
||||
public static Serializer Serializer;
|
||||
|
||||
public override void Entry(IModHelper helper)
|
||||
{
|
||||
ModHelper = helper;
|
||||
|
@ -112,48 +120,26 @@ namespace Revitalize
|
|||
playerInfo = new PlayerInfo();
|
||||
|
||||
Framework.Graphics.TextureManager.TextureManagers.Add("Furniture", new TextureManager());
|
||||
TextureManager.TextureManagers["Furniture"].addTexture("Oak Chair", new Texture2DExtended(this.Helper, this.ModManifest, Path.Combine("Content","Graphics","Furniture", "Chairs", "OakChair.png")));
|
||||
TextureManager.addTexture("Furniture","Oak Chair", new Texture2DExtended(this.Helper, this.ModManifest, Path.Combine("Content","Graphics","Furniture", "Chairs", "OakChair.png")));
|
||||
|
||||
customObjects = new Dictionary<string, CustomObject>();
|
||||
ObjectGroups = new Dictionary<string, MultiTiledObject>();
|
||||
|
||||
loadContent();
|
||||
Serializer = new Serializer();
|
||||
|
||||
}
|
||||
|
||||
private void createDirectories()
|
||||
private void loadContent()
|
||||
{
|
||||
Directory.CreateDirectory(Path.Combine(this.Helper.DirectoryPath, "Configs"));
|
||||
|
||||
Directory.CreateDirectory(Path.Combine(this.Helper.DirectoryPath, "Content"));
|
||||
Directory.CreateDirectory(Path.Combine(this.Helper.DirectoryPath,"Content" ,"Graphics"));
|
||||
Directory.CreateDirectory(Path.Combine(this.Helper.DirectoryPath, "Content", "Graphics","Furniture"));
|
||||
Directory.CreateDirectory(Path.Combine(this.Helper.DirectoryPath, "Content", "Graphics", "Furniture","Chairs"));
|
||||
}
|
||||
|
||||
private void initailizeComponents()
|
||||
{
|
||||
DarkerNight.InitializeConfig();
|
||||
}
|
||||
|
||||
private void GameLoop_UpdateTicked(object sender, StardewModdingAPI.Events.UpdateTickedEventArgs e)
|
||||
{
|
||||
DarkerNight.SetDarkerColor();
|
||||
playerInfo.update();
|
||||
}
|
||||
|
||||
private void GameLoop_TimeChanged(object sender, StardewModdingAPI.Events.TimeChangedEventArgs e)
|
||||
{
|
||||
DarkerNight.CalculateDarkerNightColor();
|
||||
}
|
||||
|
||||
private void GameLoop_SaveLoaded(object sender, StardewModdingAPI.Events.SaveLoadedEventArgs e)
|
||||
{
|
||||
|
||||
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", Game1.objectSpriteSheet, Color.White, 0, true, typeof(MultiTiledComponent), null, new AnimationManager(new Texture2DExtended(Game1.objectSpriteSheet), 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", Game1.objectSpriteSheet, Color.White, 0, true, typeof(MultiTiledComponent), null, new AnimationManager(new Texture2DExtended(Game1.objectSpriteSheet), 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", Game1.objectSpriteSheet, Color.White, 0, true, typeof(MultiTiledComponent), null, new AnimationManager(new Texture2DExtended(Game1.objectSpriteSheet), new Animation(new Rectangle(0, 32, 16, 16))), Color.Red, false, null, null));
|
||||
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["Furniture"].getTexture("Oak Chair").texture, Color.White, 0, true, typeof(MultiTiledComponent), null, new AnimationManager(TextureManager.TextureManagers["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["Furniture"].getTexture("Oak Chair").texture, Color.White, 0, true, typeof(MultiTiledComponent), null, new AnimationManager(TextureManager.TextureManagers["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["Furniture"].getTexture("Oak Chair").texture, Color.White, 0, true, typeof(MultiTiledComponent), null, new AnimationManager(TextureManager.TextureManagers["Furniture"].getTexture("Oak Chair"), new Animation(new Rectangle(0, 32, 16, 16))), Color.Red, false, null, null));
|
||||
|
||||
|
||||
obj.info.lightManager.addLight(new Vector2(Game1.tileSize), new LightSource(4, new Vector2(0, 0), 2.5f, Color.Orange.Invert()), obj);
|
||||
|
||||
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", Game1.objectSpriteSheet, Color.White, 0, true, typeof(MultiTiledObject), null, new AnimationManager(), Color.White, false, null, null));
|
||||
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["Furniture"].getTexture("Oak Chair").texture, Color.White, 0, true, typeof(MultiTiledObject), null, 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);
|
||||
|
@ -257,16 +243,51 @@ namespace Revitalize
|
|||
oakChair.addComponent(new Vector2(0, 0), chairTop);
|
||||
oakChair.addComponent(new Vector2(0, 1), chairBottom);
|
||||
|
||||
Game1.player.addItemToInventory(oakChair);
|
||||
|
||||
new InventoryItem(bigObject, 100, 1).addToNPCShop("Gus");
|
||||
Game1.player.addItemToInventory(bigObject);
|
||||
|
||||
if (pie.PlayerCanCraft())
|
||||
{
|
||||
//pie.craft();
|
||||
customObjects.Add("Omegasis.BigTiledTest", bigObject);
|
||||
}
|
||||
|
||||
private void createDirectories()
|
||||
{
|
||||
Directory.CreateDirectory(Path.Combine(this.Helper.DirectoryPath, "Configs"));
|
||||
|
||||
Directory.CreateDirectory(Path.Combine(this.Helper.DirectoryPath, "Content"));
|
||||
Directory.CreateDirectory(Path.Combine(this.Helper.DirectoryPath,"Content" ,"Graphics"));
|
||||
Directory.CreateDirectory(Path.Combine(this.Helper.DirectoryPath, "Content", "Graphics","Furniture"));
|
||||
Directory.CreateDirectory(Path.Combine(this.Helper.DirectoryPath, "Content", "Graphics", "Furniture","Chairs"));
|
||||
}
|
||||
|
||||
private void initailizeComponents()
|
||||
{
|
||||
DarkerNight.InitializeConfig();
|
||||
}
|
||||
|
||||
private void GameLoop_UpdateTicked(object sender, StardewModdingAPI.Events.UpdateTickedEventArgs e)
|
||||
{
|
||||
DarkerNight.SetDarkerColor();
|
||||
playerInfo.update();
|
||||
}
|
||||
|
||||
private void GameLoop_TimeChanged(object sender, StardewModdingAPI.Events.TimeChangedEventArgs e)
|
||||
{
|
||||
DarkerNight.CalculateDarkerNightColor();
|
||||
}
|
||||
|
||||
private void GameLoop_SaveLoaded(object sender, StardewModdingAPI.Events.SaveLoadedEventArgs e)
|
||||
{
|
||||
|
||||
Game1.player.addItemToInventory(customObjects["Omegasis.BigTiledTest"]);
|
||||
var obj = customObjects["Omegasis.BigTiledTest"];
|
||||
Serializer.Serialize(Path.Combine(this.Helper.DirectoryPath, (obj as MultiTiledObject).guid + ".json"), obj);
|
||||
|
||||
|
||||
|
||||
|
||||
var hello=Serializer.Deserialize<MultiTiledObject>(Path.Combine(this.Helper.DirectoryPath, (obj as MultiTiledObject).guid + ".json"));
|
||||
//(hello as MultiTiledObject).info.drawColor = Color.Blue;
|
||||
customObjects["Omegasis.BigTiledTest"].info.drawColor = hello.info.drawColor;
|
||||
Game1.player.addItemToInventory(hello);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -30,6 +30,9 @@
|
|||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Newtonsoft.Json">
|
||||
<Version>12.0.1</Version>
|
||||
</PackageReference>
|
||||
<PackageReference Include="Pathoschild.Stardew.ModBuildConfig" Version="2.2.0" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
|
@ -72,6 +75,10 @@
|
|||
<Compile Include="Framework\Player\PlayerInfo.cs" />
|
||||
<Compile Include="Framework\Utilities\BoundingBoxInfo.cs" />
|
||||
<Compile Include="Framework\Utilities\InventoryManager.cs" />
|
||||
<Compile Include="Framework\Utilities\Serialization\Converters\RectangleConverter.cs" />
|
||||
<Compile Include="Framework\Utilities\Serialization\Converters\Texture2DConverter.cs" />
|
||||
<Compile Include="Framework\Utilities\Serialization\Converters\Vector2Converter.cs" />
|
||||
<Compile Include="Framework\Utilities\Serialization\Serialization.cs" />
|
||||
<Compile Include="ModCore.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
</ItemGroup>
|
||||
|
|
Loading…
Reference in New Issue