diff --git a/GeneralMods/CustomNPCFramework/Framework/Graphics/AssetInfo.cs b/GeneralMods/CustomNPCFramework/Framework/Graphics/AssetInfo.cs
index da3239ca..adc5d387 100644
--- a/GeneralMods/CustomNPCFramework/Framework/Graphics/AssetInfo.cs
+++ b/GeneralMods/CustomNPCFramework/Framework/Graphics/AssetInfo.cs
@@ -7,21 +7,58 @@ using System.Threading.Tasks;
namespace CustomNPCFramework.Framework.Graphics
{
+ ///
+ /// A class to be used to hold information regarding assets such as the name of the assets and the paths to the images.
+ ///
public class AssetInfo
{
+ ///
+ /// The name of the asset to be used in the main asset pool.
+ ///
public string assetName;
+ ///
+ /// The list of files to be used for the standing animation.
+ ///
public NamePairings standingAssetPaths;
+ ///
+ /// The list of files to be used for the swimming animation.
+ ///
public NamePairings swimmingAssetPaths;
+ ///
+ /// The list of files to be used with the moving animation.
+ ///
public NamePairings movingAssetPaths;
+ ///
+ /// The list of files to be used with the sitting animation.
+ ///
public NamePairings sittingAssetPaths;
+ ///
+ /// The size of the asset texture. Width and height.
+ ///
public Vector2 assetSize;
+ ///
+ /// Not really used anymore. More of a legacy feature.
+ ///
public bool randomizeUponLoad;
-
+
+ ///
+ /// Empty constructor.
+ ///
public AssetInfo()
{
}
+ ///
+ /// Constructor that assigns values to the class.
+ ///
+ /// The name of the asset. This is the name that will be referenced in any asset manager or asset pool.
+ /// The name of the files to be used for the standing animation.
+ /// The name of the files to be used for the moving animation.
+ /// The name of the files to be used for the swimming animation.
+ /// The name of the files to be used for the sitting animation.
+ /// The size of the asset. Width and height of the texture.
+ /// Legacy, not really used anymore.
public AssetInfo(string assetName,NamePairings StandingAssetPaths, NamePairings MovingAssetPaths, NamePairings SwimmingAssetPaths, NamePairings SittingAssetPaths, Vector2 assetSize, bool randomizeUponLoad)
{
this.assetName = assetName;
diff --git a/GeneralMods/CustomNPCFramework/Framework/Graphics/AssetManager.cs b/GeneralMods/CustomNPCFramework/Framework/Graphics/AssetManager.cs
index 0e54d56e..1cd90755 100644
--- a/GeneralMods/CustomNPCFramework/Framework/Graphics/AssetManager.cs
+++ b/GeneralMods/CustomNPCFramework/Framework/Graphics/AssetManager.cs
@@ -8,9 +8,18 @@ using System.Threading.Tasks;
namespace CustomNPCFramework.Framework.Graphics
{
+ ///
+ /// Used to hold assets from specified directories.
+ ///
public class AssetManager
{
+ ///
+ /// A list of all of the assets held by this asset manager.
+ ///
public List assets;
+ ///
+ /// A list of all of the directories managed by this asset manager.
+ ///
public Dictionary paths;
///
@@ -22,6 +31,10 @@ namespace CustomNPCFramework.Framework.Graphics
this.paths = new Dictionary();
}
+ ///
+ /// Constructor.
+ ///
+ /// A list of all directories to be managed by the asset manager. Name, path is the key pair value.
public AssetManager(Dictionary assetsPathsToLoadFrom)
{
this.assets = new List();
@@ -155,6 +168,11 @@ namespace CustomNPCFramework.Framework.Graphics
return aSheet;
}
+ ///
+ /// Get a list of all the assets of this kind of part.
+ ///
+ /// The type of part to return a list of from this asset manager.
+ ///
public List getListOfAssetsThatMatchThisCriteria(PartType type)
{
List aSheet = new List();
@@ -168,6 +186,12 @@ namespace CustomNPCFramework.Framework.Graphics
return aSheet;
}
+ ///
+ /// Get a list of assets that match the critera.
+ ///
+ /// The gender criteria for this asset, such as if this part belongs to either a female or male character.
+ /// The type of asset to return. Hair eyes, shoes, etc.
+ ///
public List getListOfAssetsThatMatchThisCriteria(Genders gender,PartType type)
{
List aSheet = new List();
@@ -225,6 +249,13 @@ namespace CustomNPCFramework.Framework.Graphics
return aSheet;
}
+ ///
+ /// Get a list of asssets that match certain critera.
+ ///
+ /// The gengder certain assets belong to, such as male or female.
+ /// The season that an asset can be displayed in. Good for seasonal assets.
+ /// The type of part to return a list of such as hair, eyes, or pants.
+ ///
public List getListOfAssetsThatMatchThisCriteria(Genders gender, Seasons season, PartType type)
{
List aSheet = new List();
diff --git a/GeneralMods/CustomNPCFramework/Framework/Graphics/AssetPool.cs b/GeneralMods/CustomNPCFramework/Framework/Graphics/AssetPool.cs
index 01a75a73..6292d001 100644
--- a/GeneralMods/CustomNPCFramework/Framework/Graphics/AssetPool.cs
+++ b/GeneralMods/CustomNPCFramework/Framework/Graphics/AssetPool.cs
@@ -16,11 +16,10 @@ using System.Threading.Tasks;
namespace CustomNPCFramework.Framework.Graphics
{
- ///
- /// Used to contain all of the asset managers.
- ///
- ///
+ ///
+ /// Used to hold a collection of strings.
+ ///
public class NamePairings
{
public string leftString;
@@ -36,37 +35,67 @@ namespace CustomNPCFramework.Framework.Graphics
}
}
+ ///
+ /// Used to contain all of the asset managers.
+ ///
public class AssetPool
{
+ ///
+ /// A dictionary holding all of the asset managers. (Name, AssetManager)
+ ///
public Dictionary assetPool;
+ ///
+ /// Constructor.
+ ///
public AssetPool()
{
this.assetPool = new Dictionary();
}
+ ///
+ /// Adds an asset manager to the asset pool.
+ ///
+ /// A key value pair with the convention being (Manager Name, Asset Manager)
public void addAssetManager(KeyValuePair pair)
{
this.assetPool.Add(pair.Key, pair.Value);
}
+ ///
+ /// Adds an asset manager to the asset pool.
+ ///
+ /// The name of the asset manager to be added.
+ /// The asset manager object to be added to the asset pool.
public void addAssetManager(string assetManagerName, AssetManager assetManager)
{
this.assetPool.Add(assetManagerName, assetManager);
}
+ ///
+ /// Get an asset manager from the asset pool from a name.
+ ///
+ /// The name of the asset manager to return.
+ ///
public AssetManager getAssetManager(string name)
{
assetPool.TryGetValue(name, out AssetManager asset);
return asset;
}
+ ///
+ /// Remove an asset manager from the asset pool.
+ ///
+ /// The name of the asset manager to remove.
public void removeAssetManager(string key)
{
assetPool.Remove(key);
}
+ ///
+ /// Go through all of the asset managers and load assets according to their respective paths.
+ ///
public void loadAllAssets()
{
foreach (KeyValuePair assetManager in this.assetPool)
@@ -88,7 +117,12 @@ namespace CustomNPCFramework.Framework.Graphics
}
-
+ ///
+ /// Generates a new AnimatedSpriteCollection object from the data held in an asset sheet.
+ ///
+ /// An asset sheet that holds the data for textures.
+ /// The type of asset to get from the sheet. Hair, eyes, shoes, etc.
+ ///
public AnimatedSpriteCollection getSpriteCollectionFromSheet(AssetSheet assetSheet, AnimationType type)
{
var left = new AnimatedSpriteExtended(assetSheet.clone().getTexture(Direction.left, type),assetSheet.path.Clone().ToString(),assetSheet.index, (int)assetSheet.assetInfo.assetSize.X, (int)assetSheet.assetInfo.assetSize.Y);
@@ -118,11 +152,29 @@ namespace CustomNPCFramework.Framework.Graphics
}
+ ///
+ /// Get an AnimatedSpriteCollection from a name pairing.
+ ///
+ /// A collection of strings that hold information on directional textures.
+ /// The direction in which the sprite should face.
+ ///
public AnimatedSpriteCollection getAnimatedSpriteCollectionFromAssets(NamePairings pair, Direction startingDirection = Direction.down)
{
return getAnimatedSpriteCollectionFromAssets(pair.leftString, pair.rightString, pair.upString, pair.downString);
}
+ ///
+ /// Get a collection of sprites to generate a collective animated sprite.
+ ///
+ /// The collection of sprites to be used for the boyd of the npc.
+ /// The collection of sprites to be used for the eye of the npc.
+ /// The collection of sprites to be used for the hair of the npc.
+ /// The collection of sprites to be used for the shirts of the npc.
+ /// The collection of sprites to be used for the pants of the npc.
+ /// The collection of sprites to be used for the shoes of the npc.
+ /// The collection of sprites to be used for the accessories of the npc.
+ /// The collection of collors to be used for chaing the color of an individual asset.
+ ///
public StandardCharacterAnimation GetStandardCharacterAnimation(NamePairings BodySprites, NamePairings EyeSprites, NamePairings HairSprites, NamePairings ShirtsSprites, NamePairings PantsSprites, NamePairings ShoesSprites,List AccessoriesSprites,StandardColorCollection DrawColors=null)
{
var body = getAnimatedSpriteCollectionFromAssets(BodySprites);
@@ -140,6 +192,14 @@ namespace CustomNPCFramework.Framework.Graphics
return new StandardCharacterAnimation(body,eyes,hair,shirts,pants,shoes,accessories,DrawColors);
}
+ ///
+ /// Get a list of parts that can apply for this criteria.
+ ///
+ /// The name of the asset manager.
+ /// The gender critera.
+ /// The season critera.
+ /// The part type critera.
+ ///
public List getListOfApplicableBodyParts(string assetManagerName,Genders gender, Seasons season, PartType type)
{
var parts = this.getAssetManager(assetManagerName).getListOfAssetsThatMatchThisCriteria(gender, season, type);
@@ -300,6 +360,18 @@ namespace CustomNPCFramework.Framework.Graphics
return npc;
}
+ ///
+ /// Creates a character renderer (a collection of textures) from a bunch of different asset sheets.
+ ///
+ /// The textures for the npc's body.
+ /// The textures for the npc's eyes.
+ /// The textures for the npc's hair.
+ /// The textures for the npc's shirt.
+ /// The textures for the npc's pants.
+ /// The textures for the npc's shoes.
+ /// The textures for the npc's accessories.
+ /// The colors for the npc's different assets.
+ ///
public virtual BasicRenderer generateBasicRenderer(AssetSheet bodySheet, AssetSheet eyesSheet, AssetSheet hairSheet, AssetSheet shirtSheet, AssetSheet pantsSheet, AssetSheet shoesSheet, List accessorySheet, StandardColorCollection DrawColors=null)
{
if (DrawColors == null) DrawColors = new StandardColorCollection();
@@ -315,6 +387,19 @@ namespace CustomNPCFramework.Framework.Graphics
return render;
}
+ ///
+ /// Generate a Standard Character Animation from some asset sheets.
+ /// (collection of textures to animations)
+ ///
+ /// The textures for the npc's body.
+ /// The textures for the npc's eyes.
+ /// The textures for the npc's hair.
+ /// The textures for the npc's shirt.
+ /// The textures for the npc's pants.
+ /// The textures for the npc's shoes.
+ /// The textures for the npc's accessories.
+ /// The colors for the npc's different assets.
+ ///
public virtual StandardCharacterAnimation generateCharacterAnimation(AssetSheet body, AssetSheet eyes, AssetSheet hair, AssetSheet shirt, AssetSheet pants, AssetSheet shoes,List accessories, AnimationType animationType, StandardColorCollection DrawColors=null)
{
var bodySprite = getSpriteCollectionFromSheet(body, animationType);
@@ -334,6 +419,11 @@ namespace CustomNPCFramework.Framework.Graphics
return standingAnimation;
}
+ ///
+ /// Get the string for the standard character sprite to be used from this asset sheet.
+ ///
+ /// The standard asset sheet to be used.
+ ///
public virtual string getDefaultSpriteImage(AssetSheet imageGraphics)
{
return Class1.getRelativeDirectory(Path.Combine(imageGraphics.path, imageGraphics.assetInfo.standingAssetPaths.downString));
diff --git a/GeneralMods/CustomNPCFramework/Framework/Graphics/AssetSheet.cs b/GeneralMods/CustomNPCFramework/Framework/Graphics/AssetSheet.cs
index b67bf0ea..6ac92683 100644
--- a/GeneralMods/CustomNPCFramework/Framework/Graphics/AssetSheet.cs
+++ b/GeneralMods/CustomNPCFramework/Framework/Graphics/AssetSheet.cs
@@ -16,15 +16,34 @@ namespace CustomNPCFramework.Framework.Graphics
///
public class AssetSheet
{
+ ///
+ /// Used to hold the textures for the AssetSheet.
+ ///
public TextureGroups.TextureGroup textures;
+ ///
+ /// Used to hold the info for the paths to these textures.
+ ///
public AssetInfo assetInfo;
+
+ ///
+ /// The path to this assetinfo.json file
+ ///
public string path;
+ ///
+ /// The soruce rectangle for the current texture to draw.
+ ///
+ public Rectangle currentAsset;
+
public int index;
- public Rectangle currentAsset;
-
+ ///
+ /// Constructor.
+ ///
+ /// The asset info file to be read in or created. Holds path information.
+ /// The path to the assetinfo file.
+ /// The direction to set the animation.
public AssetSheet(AssetInfo info,string path,Direction direction=Direction.down)
{
this.assetInfo = info;
@@ -37,9 +56,14 @@ namespace CustomNPCFramework.Framework.Graphics
{
this.path = path;
}
+
this.index = 0;
}
+ ///
+ /// Get the path to the current texture.
+ ///
+ ///
public virtual KeyValuePair getPathTexturePair()
{
return new KeyValuePair(this.path, this.textures.currentTexture.currentTexture);
@@ -55,32 +79,53 @@ namespace CustomNPCFramework.Framework.Graphics
return asset;
}
-
+ ///
+ /// Sets the textures for this sheet to face left.
+ ///
public virtual void setLeft()
{
this.textures.setLeft();
}
+ ///
+ /// Sets the textures for this sheet to face up.
+ ///
public virtual void setUp()
{
this.textures.setUp();
}
+ ///
+ /// Sets the textures for this sheet to face down.
+ ///
public virtual void setDown()
{
this.textures.setDown();
}
+ ///
+ /// Sets the textures for this sheet to face left.
+ ///
public virtual void setRight()
{
this.textures.setRight();
}
+ ///
+ /// Get the current animation texture.
+ ///
+ ///
public virtual Texture2D getCurrentSpriteTexture()
{
return this.textures.currentTexture.currentTexture;
}
+ ///
+ /// Get the specific texture depending on the direction and animation type.
+ ///
+ ///
+ ///
+ ///
public virtual Texture2D getTexture(Direction direction,AnimationType type)
{
return this.textures.getTextureFromAnimation(type).getTextureFromDirection(direction);
diff --git a/GeneralMods/CustomNPCFramework/Framework/Graphics/DirectionalTexture.cs b/GeneralMods/CustomNPCFramework/Framework/Graphics/DirectionalTexture.cs
index 8b7d0353..9f46d023 100644
--- a/GeneralMods/CustomNPCFramework/Framework/Graphics/DirectionalTexture.cs
+++ b/GeneralMods/CustomNPCFramework/Framework/Graphics/DirectionalTexture.cs
@@ -9,15 +9,42 @@ using System.Threading.Tasks;
namespace CustomNPCFramework.Framework.Graphics
{
+ ///
+ /// A class that's used to hold textures for different directions.
+ ///
public class DirectionalTexture
{
+ ///
+ /// The left texture for this group.
+ ///
public Texture2D leftTexture;
+ ///
+ /// The right texture for this group.
+ ///
public Texture2D rightTexture;
+
+ ///
+ /// The down textiure for this group.
+ ///
public Texture2D downTexture;
+ ///
+ /// The up texture for this group.
+ ///
public Texture2D upTexture;
+ ///
+ /// The current texture for this group.
+ ///
public Texture2D currentTexture;
+ ///
+ /// Constructor.
+ ///
+ /// The left texture to use.
+ /// The right texture to use.
+ /// The up texture to use.
+ /// The down texture to use.
+ /// The direction texture for the sprite to face.
public DirectionalTexture(Texture2D left, Texture2D right, Texture2D up, Texture2D down, Direction direction=Direction.down)
{
this.leftTexture = left;
@@ -33,6 +60,12 @@ namespace CustomNPCFramework.Framework.Graphics
}
+ ///
+ /// Constructor.
+ ///
+ /// A list of name pairings to hold the info for the directional texture.
+ /// The path location of the textures to load.
+ /// The direction the textures should be facing.
public DirectionalTexture(NamePairings info, string path, Direction direction = Direction.down)
{
this.leftTexture = Class1.ModHelper.Content.Load(Class1.getShortenedDirectory(Path.Combine(path, info.leftString + ".png")).Remove(0, 1));
@@ -46,26 +79,43 @@ namespace CustomNPCFramework.Framework.Graphics
if (direction == Direction.down) this.currentTexture = downTexture;
}
+ ///
+ /// Sets the direction of this current texture to left.
+ ///
public void setLeft()
{
this.currentTexture = leftTexture;
}
+ ///
+ /// Sets the direction of this current texture to up.
+ ///
public void setUp()
{
this.currentTexture = upTexture;
}
+ ///
+ /// Sets the direction of this current texture to down.
+ ///
public void setDown()
{
this.currentTexture = downTexture;
}
+ ///
+ /// Sets the direction of this current texture to right.
+ ///
public void setRight()
{
this.currentTexture = rightTexture;
}
+ ///
+ /// Gets the texture from this texture group depending on the direction.
+ ///
+ ///
+ ///
public virtual Texture2D getTextureFromDirection(Direction direction)
{
if (direction == Direction.left) return this.leftTexture;
diff --git a/GeneralMods/CustomNPCFramework/Framework/Graphics/ExtendedAssetInfo.cs b/GeneralMods/CustomNPCFramework/Framework/Graphics/ExtendedAssetInfo.cs
index 39ab9170..0590fee3 100644
--- a/GeneralMods/CustomNPCFramework/Framework/Graphics/ExtendedAssetInfo.cs
+++ b/GeneralMods/CustomNPCFramework/Framework/Graphics/ExtendedAssetInfo.cs
@@ -8,12 +8,27 @@ using System.Threading.Tasks;
namespace CustomNPCFramework.Framework.Graphics
{
+ ///
+ /// An expanded Asset info class that deals with seasons and genders.
+ ///
public class ExtendedAssetInfo :AssetInfo
{
+ ///
+ /// The genders this part is associated with. 0=Male, 1=female, 2=other.
+ ///
public Genders gender;
+ ///
+ /// A list of seasons where this part can be displayed
+ ///
public List seasons=new List();
+ ///
+ /// The part type to be used for this asset such as hair, eyes, etc.
+ ///
public PartType type;
+ ///
+ /// Constructor.
+ ///
public ExtendedAssetInfo()
{
this.seasons = new List();
diff --git a/GeneralMods/CustomNPCFramework/Framework/Graphics/TextureGroups/TextureGroup.cs b/GeneralMods/CustomNPCFramework/Framework/Graphics/TextureGroups/TextureGroup.cs
index b1da295a..9c8753fa 100644
--- a/GeneralMods/CustomNPCFramework/Framework/Graphics/TextureGroups/TextureGroup.cs
+++ b/GeneralMods/CustomNPCFramework/Framework/Graphics/TextureGroups/TextureGroup.cs
@@ -52,6 +52,13 @@ namespace CustomNPCFramework.Framework.Graphics.TextureGroups
///
private AnimationType type;
+ ///
+ /// Constructor.
+ ///
+ /// The asset info file to be stored with this texture group.
+ /// Use to locate the files on disk.
+ /// Used to determine the current direction/animation to load
+ /// The type of asset this is. Eyes, Hair, Shirts, etc
public TextureGroup(AssetInfo info, string path,Direction direction ,AnimationType animationType=AnimationType.standing)
{
this.standingTexture = new DirectionalTexture(info.standingAssetPaths, path, direction);
@@ -71,12 +78,19 @@ namespace CustomNPCFramework.Framework.Graphics.TextureGroups
}
+ ///
+ /// Gets a clone of this texture group.
+ ///
+ ///
public TextureGroup clone()
{
return new TextureGroup(this.info, this.path, this.dir, this.type);
}
+ ///
+ /// Sets all of the different animations to use their left facing sprites.
+ ///
public virtual void setLeft()
{
this.movingTexture.setLeft();
@@ -85,6 +99,9 @@ namespace CustomNPCFramework.Framework.Graphics.TextureGroups
this.swimmingTexture.setLeft();
}
+ ///
+ /// Sets all of the different animations to use their up facing sprites.
+ ///
public virtual void setUp()
{
this.movingTexture.setUp();
@@ -93,6 +110,9 @@ namespace CustomNPCFramework.Framework.Graphics.TextureGroups
this.swimmingTexture.setUp();
}
+ ///
+ /// Sets all of the different animations to use their down facing sprites.
+ ///
public virtual void setDown()
{
this.movingTexture.setDown();
@@ -101,6 +121,9 @@ namespace CustomNPCFramework.Framework.Graphics.TextureGroups
this.swimmingTexture.setDown();
}
+ ///
+ /// Sets all of the different animations to use their right facing sprites.
+ ///
public virtual void setRight()
{
this.movingTexture.setRight();
@@ -109,6 +132,11 @@ namespace CustomNPCFramework.Framework.Graphics.TextureGroups
this.swimmingTexture.setRight();
}
+ ///
+ /// Get's the appropriate animation texture based on the type of animation key passed in.
+ ///
+ ///
+ ///
public virtual DirectionalTexture getTextureFromAnimation(AnimationType type)
{
if (type == AnimationType.standing) return this.standingTexture;
diff --git a/GeneralMods/CustomNPCFramework/Framework/ModularNPCS/CharacterAnimationBases/CharacterAnimationBase.cs b/GeneralMods/CustomNPCFramework/Framework/ModularNPCS/CharacterAnimationBases/CharacterAnimationBase.cs
index 47a59d45..2eb3f08b 100644
--- a/GeneralMods/CustomNPCFramework/Framework/ModularNPCS/CharacterAnimationBases/CharacterAnimationBase.cs
+++ b/GeneralMods/CustomNPCFramework/Framework/ModularNPCS/CharacterAnimationBases/CharacterAnimationBase.cs
@@ -9,39 +9,70 @@ using System.Threading.Tasks;
namespace CustomNPCFramework.Framework.ModularNPCS
{
+ ///
+ /// Used as a base class for character animations.
+ ///
public class CharacterAnimationBase
{
+ ///
+ /// Constructor.
+ ///
public CharacterAnimationBase()
{
}
+ ///
+ /// Set the character sprites to left.
+ ///
public virtual void setLeft()
{
}
+
+ ///
+ /// Set the character sprites to right.
+ ///
public virtual void setRight()
{
}
+
+ ///
+ /// Set the character sprites to up.
+ ///
public virtual void setUp()
{
}
+ ///
+ /// Set the character sprites to down.
+ ///
public virtual void setDown()
{
}
+ ///
+ /// Used to reload the sprite textures.
+ ///
public virtual void reload()
{
}
+ ///
+ /// Animate the sprites.
+ ///
+ /// How long between animation frames in milliseconds.
public virtual void Animate(float animationInterval)
{
}
-
+ ///
+ /// Used to animate sprites.
+ ///
+ /// How long between animation frames in milliseconds.
+ /// Loop the animation.
public virtual void Animate(float animationInterval, bool loop=true)
{