using Microsoft.Xna.Framework;
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;
/// Construct an instance.
public AssetInfo() { }
/// Construct an instance.
/// 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;
this.sittingAssetPaths = sittingAssetPaths;
this.standingAssetPaths = standingAssetPaths;
this.movingAssetPaths = movingAssetPaths;
this.swimmingAssetPaths = swimmingAssetPaths;
this.assetSize = assetSize;
this.randomizeUponLoad = randomizeUponLoad;
}
/// Save the json to a certain location.
/// The relative path to save.
public void writeToJson(string relativeFilePath)
{
Class1.ModHelper.Data.WriteJsonFile(relativeFilePath, this);
}
/// Read the json from a certain location.
/// The relative path to save.
public static AssetInfo readFromJson(string relativePath)
{
return Class1.ModHelper.Data.ReadJsonFile(relativePath);
}
}
}