From e734c82df5ae80a1e1786b72b6dc072e57655cfc Mon Sep 17 00:00:00 2001 From: Joshua Navarro Date: Tue, 8 Jan 2019 22:15:58 -0800 Subject: [PATCH] Got chairs properly loaded in and working when sitting and with all of the rotations. Need to find a better way to have lots of objects instead of long lines of code. --- .../Framework/Graphics/TextureManager.cs | 37 ++++++ .../Framework/Objects/CustomObject.cs | 33 ++++- .../Framework/Objects/Furniture/Chair.cs | 15 --- .../Furniture/ChairMultiTiledObject.cs | 74 +++++++++++ .../Objects/Furniture/ChairTileComponent.cs | 115 ++++++++++++++++++ .../Furniture/FurnitureTileComponent.cs | 6 +- .../Framework/Objects/MultiTiledComponent.cs | 64 +++++++++- .../Framework/Objects/MultiTiledObject.cs | 39 ++++++ .../Framework/Player/Managers/SittingInfo.cs | 5 + GeneralMods/Revitalize/ModCore.cs | 107 +++++++++++++++- GeneralMods/Revitalize/Revitalize.csproj | 4 +- 11 files changed, 477 insertions(+), 22 deletions(-) create mode 100644 GeneralMods/Revitalize/Framework/Graphics/TextureManager.cs delete mode 100644 GeneralMods/Revitalize/Framework/Objects/Furniture/Chair.cs create mode 100644 GeneralMods/Revitalize/Framework/Objects/Furniture/ChairMultiTiledObject.cs create mode 100644 GeneralMods/Revitalize/Framework/Objects/Furniture/ChairTileComponent.cs diff --git a/GeneralMods/Revitalize/Framework/Graphics/TextureManager.cs b/GeneralMods/Revitalize/Framework/Graphics/TextureManager.cs new file mode 100644 index 00000000..711e4ce9 --- /dev/null +++ b/GeneralMods/Revitalize/Framework/Graphics/TextureManager.cs @@ -0,0 +1,37 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Revitalize.Framework.Graphics +{ + public class TextureManager + { + public static Dictionary TextureManagers = new Dictionary(); + + + public Dictionary textures; + + public TextureManager() + { + this.textures = new Dictionary(); + } + + public void addTexture(string name, Texture2DExtended texture) + { + this.textures.Add(name, texture); + } + + /// Returns a Texture2DExtended held by the manager. + 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!!!"); + } + } +} diff --git a/GeneralMods/Revitalize/Framework/Objects/CustomObject.cs b/GeneralMods/Revitalize/Framework/Objects/CustomObject.cs index 30929b28..57793303 100644 --- a/GeneralMods/Revitalize/Framework/Objects/CustomObject.cs +++ b/GeneralMods/Revitalize/Framework/Objects/CustomObject.cs @@ -206,6 +206,34 @@ namespace Revitalize.Framework.Objects return base.placementAction(location, x, y, who); } + public virtual void rotate() + { + if (this.info.facingDirection == Enums.Direction.Down) this.info.facingDirection = Enums.Direction.Right; + else if (this.info.facingDirection == Enums.Direction.Right) this.info.facingDirection = Enums.Direction.Up; + else if (this.info.facingDirection == Enums.Direction.Up) this.info.facingDirection = Enums.Direction.Left; + else if (this.info.facingDirection == Enums.Direction.Left) this.info.facingDirection = Enums.Direction.Down; + + if (this.info.animationManager.animations.ContainsKey(generateRotationalAnimationKey())) + { + this.info.animationManager.setAnimation(generateRotationalAnimationKey()); + } + else + { + //Revitalize.ModCore.log("Animation does not exist...." + generateRotationalAnimationKey()); + } + } + + + public string generateRotationalAnimationKey() + { + return (this.info.animationManager.currentAnimationName.Split('_')[0]) +"_"+ (int)this.info.facingDirection; + } + + public string generateDefaultRotationalAnimationKey() + { + return ("Default" + "_" + (int)this.info.facingDirection); + } + /// Updates a visual draw position. public virtual void updateDrawPosition(int x, int y) { @@ -241,7 +269,10 @@ namespace Revitalize.Framework.Objects else { //Log.AsyncC("Animation Manager is working!"); - this.animationManager.draw(spriteBatch, this.displayTexture, Game1.GlobalToLocal(Game1.viewport, new Vector2((float)(x * Game1.tileSize), y * Game1.tileSize)), new Rectangle?(this.animationManager.currentAnimation.sourceRectangle), this.info.drawColor * alpha, 0f, Vector2.Zero, (float)Game1.pixelZoom, this.flipped ? SpriteEffects.FlipHorizontally : SpriteEffects.None, Math.Max(0f, (float)(this.TileLocation.Y * Game1.tileSize) / 10000f)); + int addedDepth = 0; + if (this.info.ignoreBoundingBox) addedDepth++; + if (Revitalize.ModCore.playerInfo.sittingInfo.SittingObject == this) addedDepth++; + this.animationManager.draw(spriteBatch, this.displayTexture, Game1.GlobalToLocal(Game1.viewport, new Vector2((float)(x * Game1.tileSize), y * Game1.tileSize)), new Rectangle?(this.animationManager.currentAnimation.sourceRectangle), this.info.drawColor * alpha, 0f, Vector2.Zero, (float)Game1.pixelZoom, this.flipped ? SpriteEffects.FlipHorizontally : SpriteEffects.None, Math.Max(0f, (float)( (this.TileLocation.Y+addedDepth) * Game1.tileSize) / 10000f)); try { this.animationManager.tickAnimation(); diff --git a/GeneralMods/Revitalize/Framework/Objects/Furniture/Chair.cs b/GeneralMods/Revitalize/Framework/Objects/Furniture/Chair.cs deleted file mode 100644 index 1146ae50..00000000 --- a/GeneralMods/Revitalize/Framework/Objects/Furniture/Chair.cs +++ /dev/null @@ -1,15 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Revitalize.Framework.Objects.Furniture -{ - /// - /// Todo: Make this and the big object that encapsulates it. - /// - class Chair:FurnitureTileComponent - { - } -} diff --git a/GeneralMods/Revitalize/Framework/Objects/Furniture/ChairMultiTiledObject.cs b/GeneralMods/Revitalize/Framework/Objects/Furniture/ChairMultiTiledObject.cs new file mode 100644 index 00000000..1636c6e2 --- /dev/null +++ b/GeneralMods/Revitalize/Framework/Objects/Furniture/ChairMultiTiledObject.cs @@ -0,0 +1,74 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Microsoft.Xna.Framework; +using PyTK.CustomElementHandler; +using StardewValley; +using StardewValley.Objects; + +namespace Revitalize.Framework.Objects.Furniture +{ + /// + /// Object which encapsulates all of the pieces that make up a chair object in-game. + /// + public class ChairMultiTiledObject:MultiTiledObject + { + + public ChairMultiTiledObject() : base() + { + + } + + public ChairMultiTiledObject(BasicItemInformation Info) : base(Info) + { + + } + + public ChairMultiTiledObject(BasicItemInformation Info, Vector2 TilePosition) : base(Info, TilePosition) + { + + } + + public ChairMultiTiledObject(BasicItemInformation Info,Vector2 TilePosition,Dictionary Objects) : base(Info, TilePosition, Objects) { + + + } + + /// + /// Rotate all chair components associated with this chair object. + /// + public override void rotate() + { + Revitalize.ModCore.log("Rotate!"); + foreach(KeyValuePair pair in this.objects) + { + pair.Value.rotate(); + } + foreach (KeyValuePair pair in this.objects) + { + (pair.Value as ChairTileComponent).checkForSpecialUpSittingAnimation(); + } + + base.rotate(); + } + + public override Item getOne() + { + return new ChairMultiTiledObject(this.info, this.TileLocation, this.objects); + } + + public override ICustomObject recreate(Dictionary additionalSaveData, object replacement) + { + BasicItemInformation data = (BasicItemInformation)CustomObjectData.collection[additionalSaveData["id"]]; + return new ChairMultiTiledObject(data, (replacement as Chest).TileLocation, this.objects); + } + + public override bool canBePlacedHere(GameLocation l, Vector2 tile) + { + return base.canBePlacedHere(l, tile); + } + + } +} diff --git a/GeneralMods/Revitalize/Framework/Objects/Furniture/ChairTileComponent.cs b/GeneralMods/Revitalize/Framework/Objects/Furniture/ChairTileComponent.cs new file mode 100644 index 00000000..5f0bdd3a --- /dev/null +++ b/GeneralMods/Revitalize/Framework/Objects/Furniture/ChairTileComponent.cs @@ -0,0 +1,115 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Microsoft.Xna.Framework; +using PyTK.CustomElementHandler; +using Revitalize.Framework.Objects.InformationFiles.Furniture; +using StardewValley; +using StardewValley.Objects; + +namespace Revitalize.Framework.Objects.Furniture +{ + /// + /// Chair "piece" which represents one of the objects in the game that takes up roughly one tile. + /// + public class ChairTileComponent:FurnitureTileComponent + { + /// + /// Checks if the player can sit "on" this component. + /// + public bool CanSitHere + { + get + { + return (this.furnitureInfo as InformationFiles.Furniture.ChairInformation).canSitHere; + } + } + + public ChairTileComponent():base() + { + + } + + public ChairTileComponent(BasicItemInformation Info,ChairInformation FurnitureInfo) : base(Info,FurnitureInfo) + { + + } + + public ChairTileComponent(BasicItemInformation Info,Vector2 TileLocation, ChairInformation FurnitureInfo) : base(Info, TileLocation,FurnitureInfo) + { + + } + + + + /// + /// When the chair is right clicked ensure that all pieces associated with it are also rotated. + /// + /// + /// + public override bool rightClicked(Farmer who) + { + this.containerObject.rotate(); //Ensure that all of the chair pieces rotate at the same time. + + checkForSpecialUpSittingAnimation(); + return true; + //return base.rightClicked(who); + } + + /// + /// Used for more object interactions. + /// When the chair is shift right clicked sit on that specific chair tile if you can sit there. + /// + /// + /// + public override bool shiftRightClicked(Farmer who) + { + if (this.CanSitHere) + { + Revitalize.ModCore.playerInfo.sittingInfo.sit(this.containerObject, this.TileLocation*Game1.tileSize); + foreach(KeyValuePairpair in this.containerObject.objects) + { + (pair.Value as ChairTileComponent).checkForSpecialUpSittingAnimation(); + } + + } + return base.shiftRightClicked(who); + } + + + public override Item getOne() + { + ChairTileComponent component = new ChairTileComponent(this.info, (ChairInformation)this.furnitureInfo); + component.containerObject = this.containerObject; + component.offsetKey = this.offsetKey; + return component; + } + + public override ICustomObject recreate(Dictionary additionalSaveData, object replacement) + { + BasicItemInformation data = (BasicItemInformation)CustomObjectData.collection[additionalSaveData["id"]]; + return new ChairTileComponent(data, (replacement as Chest).TileLocation,(ChairInformation)this.furnitureInfo) + { + containerObject = this.containerObject, + offsetKey = this.offsetKey + }; + } + + /// + ///Used to manage graphics for chairs that need to deal with special "layering" for transparent chair backs. Otherwise the player would be hidden. + /// + public void checkForSpecialUpSittingAnimation() + { + if (this.info.facingDirection == Enums.Direction.Up && Revitalize.ModCore.playerInfo.sittingInfo.SittingObject == this.containerObject) + { + string animationKey = "Sitting_" + (int)Enums.Direction.Up; + if (this.animationManager.animations.ContainsKey(animationKey)) + { + this.animationManager.setAnimation(animationKey); + } + } + } + } +} diff --git a/GeneralMods/Revitalize/Framework/Objects/Furniture/FurnitureTileComponent.cs b/GeneralMods/Revitalize/Framework/Objects/Furniture/FurnitureTileComponent.cs index f47a6406..af8c419b 100644 --- a/GeneralMods/Revitalize/Framework/Objects/Furniture/FurnitureTileComponent.cs +++ b/GeneralMods/Revitalize/Framework/Objects/Furniture/FurnitureTileComponent.cs @@ -3,6 +3,7 @@ using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; +using Microsoft.Xna.Framework; using Revitalize.Framework.Objects.InformationFiles; using Revitalize.Framework.Objects.InformationFiles.Furniture; @@ -23,7 +24,10 @@ namespace Revitalize.Framework.Objects.Furniture this.furnitureInfo = furnitureInfo; } - + public FurnitureTileComponent(BasicItemInformation itemInfo,Vector2 TileLocation ,FurnitureInformation furnitureInfo) : base(itemInfo,TileLocation) + { + this.furnitureInfo = furnitureInfo; + } } } diff --git a/GeneralMods/Revitalize/Framework/Objects/MultiTiledComponent.cs b/GeneralMods/Revitalize/Framework/Objects/MultiTiledComponent.cs index 5a1928ca..56ecab7b 100644 --- a/GeneralMods/Revitalize/Framework/Objects/MultiTiledComponent.cs +++ b/GeneralMods/Revitalize/Framework/Objects/MultiTiledComponent.cs @@ -12,12 +12,20 @@ namespace Revitalize.Framework.Objects { public MultiTiledObject containerObject; + public Vector2 offsetKey; + public MultiTiledComponent() { } public MultiTiledComponent(BasicItemInformation info) : base(info) { } public MultiTiledComponent(BasicItemInformation info, Vector2 TileLocation) : base(info, TileLocation) { } + + public override bool isPassable() + { + return this.info.ignoreBoundingBox || Revitalize.ModCore.playerInfo.sittingInfo.SittingObject == this.containerObject; + } + public override bool checkForAction(Farmer who, bool justCheckingForActivity = false) { //ModCore.log("Checking for a clicky click???"); @@ -36,9 +44,9 @@ namespace Revitalize.Framework.Objects { if (this.location == null) this.location = Game1.player.currentLocation; - this.info.lightManager.toggleLights(this.location, this); + //this.info.lightManager.toggleLights(this.location, this); - ModCore.playerInfo.sittingInfo.sit(this, Vector2.Zero); + //ModCore.playerInfo.sittingInfo.sit(this, Vector2.Zero); return true; } @@ -87,6 +95,7 @@ namespace Revitalize.Framework.Objects { MultiTiledComponent component = new MultiTiledComponent(this.info, this.TileLocation); component.containerObject = this.containerObject; + component.offsetKey = this.offsetKey; return component; } @@ -95,8 +104,57 @@ namespace Revitalize.Framework.Objects BasicItemInformation data = (BasicItemInformation)CustomObjectData.collection[additionalSaveData["id"]]; return new MultiTiledComponent(data, (replacement as Chest).TileLocation) { - containerObject = this.containerObject + containerObject = this.containerObject, + offsetKey = this.offsetKey }; } + + + /// What happens when the object is drawn at a tile location. + public override void draw(SpriteBatch spriteBatch, int x, int y, float alpha = 1f) + { + if (x <= -1) + { + spriteBatch.Draw(this.info.animationManager.getTexture(), Game1.GlobalToLocal(Game1.viewport, this.info.drawPosition), new Rectangle?(this.animationManager.currentAnimation.sourceRectangle), this.info.drawColor * alpha, 0f, Vector2.Zero, (float)Game1.pixelZoom, this.flipped ? SpriteEffects.FlipHorizontally : SpriteEffects.None, Math.Max(0f, (float)(this.TileLocation.Y * Game1.tileSize) / 10000f)); + } + else + { + //The actual planter box being drawn. + if (this.animationManager == null) + { + if (this.animationManager.getExtendedTexture() == null) + ModCore.ModMonitor.Log("Tex Extended is null???"); + + spriteBatch.Draw(this.displayTexture, Game1.GlobalToLocal(Game1.viewport, new Vector2((float)(x * Game1.tileSize), y * Game1.tileSize)), new Rectangle?(this.animationManager.currentAnimation.sourceRectangle), this.info.drawColor * alpha, 0f, Vector2.Zero, (float)Game1.pixelZoom, this.flipped ? SpriteEffects.FlipHorizontally : SpriteEffects.None, Math.Max(0f, (float)(this.TileLocation.Y * Game1.tileSize) / 10000f)); + // Log.AsyncG("ANIMATION IS NULL?!?!?!?!"); + } + + else + { + //Log.AsyncC("Animation Manager is working!"); + float addedDepth = 0; + + + if (Revitalize.ModCore.playerInfo.sittingInfo.SittingObject == this.containerObject && this.info.facingDirection == Enums.Direction.Up) + { + addedDepth += (this.containerObject.Height - 1) - ((int)(this.offsetKey.Y)); + if (this.info.ignoreBoundingBox) addedDepth+=1.5f; + } + this.animationManager.draw(spriteBatch, this.displayTexture, Game1.GlobalToLocal(Game1.viewport, new Vector2((float)(x * Game1.tileSize), y * Game1.tileSize)), new Rectangle?(this.animationManager.currentAnimation.sourceRectangle), this.info.drawColor * alpha, 0f, Vector2.Zero, (float)Game1.pixelZoom, this.flipped ? SpriteEffects.FlipHorizontally : SpriteEffects.None, Math.Max(0f, (float)((this.TileLocation.Y + addedDepth) * Game1.tileSize) / 10000f)); + try + { + this.animationManager.tickAnimation(); + // Log.AsyncC("Tick animation"); + } + catch (Exception err) + { + ModCore.ModMonitor.Log(err.ToString()); + } + } + + // spriteBatch.Draw(Game1.mouseCursors, Game1.GlobalToLocal(Game1.viewport, new Vector2((float)((double)tileLocation.X * (double)Game1.tileSize + (((double)tileLocation.X * 11.0 + (double)tileLocation.Y * 7.0) % 10.0 - 5.0)) + (float)(Game1.tileSize / 2), (float)((double)tileLocation.Y * (double)Game1.tileSize + (((double)tileLocation.Y * 11.0 + (double)tileLocation.X * 7.0) % 10.0 - 5.0)) + (float)(Game1.tileSize / 2))), new Rectangle?(new Rectangle((int)((double)tileLocation.X * 51.0 + (double)tileLocation.Y * 77.0) % 3 * 16, 128 + this.whichForageCrop * 16, 16, 16)), Color.White, 0.0f, new Vector2(8f, 8f), (float)Game1.pixelZoom, SpriteEffects.None, (float)(((double)tileLocation.Y * (double)Game1.tileSize + (double)(Game1.tileSize / 2) + (((double)tileLocation.Y * 11.0 + (double)tileLocation.X * 7.0) % 10.0 - 5.0)) / 10000.0)); + } + } + } } diff --git a/GeneralMods/Revitalize/Framework/Objects/MultiTiledObject.cs b/GeneralMods/Revitalize/Framework/Objects/MultiTiledObject.cs index 056825e6..38a6dab5 100644 --- a/GeneralMods/Revitalize/Framework/Objects/MultiTiledObject.cs +++ b/GeneralMods/Revitalize/Framework/Objects/MultiTiledObject.cs @@ -10,33 +10,56 @@ namespace Revitalize.Framework.Objects public class MultiTiledObject : CustomObject { public Dictionary objects; + public Dictionary offSets; + + private int width; + private int height; + public int Width + { + get + { + return this.width+1; + } + } + public int Height + { + get + { + return this.height+1; + } + } public MultiTiledObject() { this.objects = new Dictionary(); + this.offSets = new Dictionary(); } public MultiTiledObject(BasicItemInformation info) : base(info) { this.objects = new Dictionary(); + this.offSets = new Dictionary(); } public MultiTiledObject(BasicItemInformation info, Vector2 TileLocation) : base(info, TileLocation) { this.objects = new Dictionary(); + this.offSets = new Dictionary(); } public MultiTiledObject(BasicItemInformation info, Vector2 TileLocation, Dictionary ObjectsList) : base(info, TileLocation) { this.objects = new Dictionary(); + this.offSets = new Dictionary(); foreach (var v in ObjectsList) { MultiTiledComponent component = (MultiTiledComponent)v.Value.getOne(); this.addComponent(v.Key, component); } + } public bool addComponent(Vector2 key, MultiTiledComponent obj) @@ -45,7 +68,11 @@ namespace Revitalize.Framework.Objects return false; this.objects.Add(key, obj); + this.offSets.Add(obj, key); + if (key.X > this.width) this.width = (int)key.X; + if (key.Y > this.height) this.height = (int)key.Y; obj.containerObject = this; + obj.offsetKey = key; return true; } @@ -170,5 +197,17 @@ namespace Revitalize.Framework.Objects BasicItemInformation data = (BasicItemInformation)CustomObjectData.collection[additionalSaveData["id"]]; return new MultiTiledObject(data, (replacement as Chest).TileLocation, this.objects); } + + public void setAllAnimationsToDefault() + { + foreach(KeyValuePair pair in this.objects) + { + string animationKey = pair.Value.generateDefaultRotationalAnimationKey(); + if (pair.Value.animationManager.animations.ContainsKey(animationKey)) + { + pair.Value.animationManager.setAnimation(animationKey); + } + } + } } } diff --git a/GeneralMods/Revitalize/Framework/Player/Managers/SittingInfo.cs b/GeneralMods/Revitalize/Framework/Player/Managers/SittingInfo.cs index 760126c2..6ca981d6 100644 --- a/GeneralMods/Revitalize/Framework/Player/Managers/SittingInfo.cs +++ b/GeneralMods/Revitalize/Framework/Player/Managers/SittingInfo.cs @@ -50,6 +50,11 @@ namespace Revitalize.Framework.Player.Managers { this.isSitting = false; this.elapsedTime = 0; + if(this.sittingObject is MultiTiledObject) + { + (this.sittingObject as MultiTiledObject).setAllAnimationsToDefault(); + } + this.sittingObject = null; } if (this.isSitting && Game1.player.CanMove) diff --git a/GeneralMods/Revitalize/ModCore.cs b/GeneralMods/Revitalize/ModCore.cs index f24478ea..72e2ed43 100644 --- a/GeneralMods/Revitalize/ModCore.cs +++ b/GeneralMods/Revitalize/ModCore.cs @@ -109,11 +109,21 @@ namespace Revitalize ModHelper.Events.GameLoop.TimeChanged += this.GameLoop_TimeChanged; ModHelper.Events.GameLoop.UpdateTicked += this.GameLoop_UpdateTicked; 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"))); + + } 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() @@ -152,12 +162,107 @@ namespace Revitalize }, new KeyValuePair(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>() { + { "Default_" + (int)Framework.Enums.Direction.Down , new List() + { + new Animation(new Rectangle(0,0,16,16)) + } + }, + { "Sitting_" + (int)Framework.Enums.Direction.Down , new List() + { + new Animation(new Rectangle(0,0,16,16)) + } + }, + { "Default_" + (int)Framework.Enums.Direction.Right , new List() + { + new Animation(new Rectangle(16,0,16,16)) + } + }, + { "Sitting_" + (int)Framework.Enums.Direction.Right , new List() + { + new Animation(new Rectangle(16,0,16,16)) + } + }, + { "Default_" + (int)Framework.Enums.Direction.Up , new List() + { + new Animation(new Rectangle(32,0,16,16)) + } + }, + { "Sitting_" + (int)Framework.Enums.Direction.Up , new List() + { + new Animation(new Rectangle(32,32,16,32)) + } + }, + { "Default_" + (int)Framework.Enums.Direction.Left , new List() + { + new Animation(new Rectangle(48,0,16,16)) + } + }, + { "Sitting_" + (int)Framework.Enums.Direction.Left , new List() + { + 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>() { + { "Default_" + (int)Framework.Enums.Direction.Down , new List() + { + new Animation(new Rectangle(0,16,16,16)) + } + }, + { "Sitting_" + (int)Framework.Enums.Direction.Down , new List() + { + new Animation(new Rectangle(0,16,16,16)) + } + }, + { "Default_" + (int)Framework.Enums.Direction.Right , new List() + { + new Animation(new Rectangle(16,16,16,16)) + } + }, + { "Sitting_" + (int)Framework.Enums.Direction.Right , new List() + { + new Animation(new Rectangle(16,16,16,16)) + } + }, + { "Default_" + (int)Framework.Enums.Direction.Up , new List() + { + new Animation(new Rectangle(32,16,16,16)) + } + }, + { "Sitting_" + (int)Framework.Enums.Direction.Up , new List() + { + new Animation(new Rectangle(48,32,16,32)) + } + }, + { "Default_" + (int)Framework.Enums.Direction.Left , new List() + { + new Animation(new Rectangle(48,16,16,16)) + } + }, + { "Sitting" + (int)Framework.Enums.Direction.Left , new List() + { + 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, 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(); + //pie.craft(); } } diff --git a/GeneralMods/Revitalize/Revitalize.csproj b/GeneralMods/Revitalize/Revitalize.csproj index 94c75140..04a97ab0 100644 --- a/GeneralMods/Revitalize/Revitalize.csproj +++ b/GeneralMods/Revitalize/Revitalize.csproj @@ -54,11 +54,13 @@ + - + +