2018-12-30 18:00:05 +08:00
|
|
|
using Microsoft.Xna.Framework;
|
2018-02-24 11:10:56 +08:00
|
|
|
|
|
|
|
namespace CustomNPCFramework.Framework.Graphics
|
|
|
|
{
|
2018-12-30 18:00:05 +08:00
|
|
|
/// <summary>A class to be used to hold information regarding assets such as the name of the assets and the paths to the images.</summary>
|
2018-02-24 11:10:56 +08:00
|
|
|
public class AssetInfo
|
|
|
|
{
|
2018-12-30 18:00:05 +08:00
|
|
|
/// <summary>The name of the asset to be used in the main asset pool.</summary>
|
2018-03-04 23:53:55 +08:00
|
|
|
public string assetName;
|
2018-12-30 18:00:05 +08:00
|
|
|
|
|
|
|
/// <summary>The list of files to be used for the standing animation.</summary>
|
2018-03-05 05:23:40 +08:00
|
|
|
public NamePairings standingAssetPaths;
|
2018-12-30 18:00:05 +08:00
|
|
|
|
|
|
|
/// <summary>The list of files to be used for the swimming animation.</summary>
|
2018-03-05 05:23:40 +08:00
|
|
|
public NamePairings swimmingAssetPaths;
|
2018-12-30 18:00:05 +08:00
|
|
|
|
|
|
|
/// <summary>The list of files to be used with the moving animation.</summary>
|
2018-03-05 05:23:40 +08:00
|
|
|
public NamePairings movingAssetPaths;
|
2018-12-30 18:00:05 +08:00
|
|
|
|
|
|
|
/// <summary>The list of files to be used with the sitting animation.</summary>
|
2018-03-05 05:23:40 +08:00
|
|
|
public NamePairings sittingAssetPaths;
|
2018-12-30 18:00:05 +08:00
|
|
|
|
|
|
|
/// <summary>The size of the asset texture. Width and height.</summary>
|
2018-02-24 11:10:56 +08:00
|
|
|
public Vector2 assetSize;
|
2018-12-30 18:00:05 +08:00
|
|
|
|
|
|
|
/// <summary>Not really used anymore. More of a legacy feature.</summary>
|
2018-02-24 11:10:56 +08:00
|
|
|
public bool randomizeUponLoad;
|
2018-03-04 23:53:55 +08:00
|
|
|
|
2018-12-30 18:00:05 +08:00
|
|
|
/// <summary>Construct an instance.</summary>
|
|
|
|
public AssetInfo() { }
|
2018-03-04 23:53:55 +08:00
|
|
|
|
2018-12-30 18:00:05 +08:00
|
|
|
/// <summary>Construct an instance.</summary>
|
2018-03-19 18:32:00 +08:00
|
|
|
/// <param name="assetName">The name of the asset. This is the name that will be referenced in any asset manager or asset pool.</param>
|
2018-12-30 18:00:05 +08:00
|
|
|
/// <param name="standingAssetPaths">The name of the files to be used for the standing animation.</param>
|
|
|
|
/// <param name="movingAssetPaths">The name of the files to be used for the moving animation.</param>
|
|
|
|
/// <param name="swimmingAssetPaths">The name of the files to be used for the swimming animation.</param>
|
|
|
|
/// <param name="sittingAssetPaths">The name of the files to be used for the sitting animation.</param>
|
2018-03-19 18:32:00 +08:00
|
|
|
/// <param name="assetSize">The size of the asset. Width and height of the texture.</param>
|
|
|
|
/// <param name="randomizeUponLoad">Legacy, not really used anymore.</param>
|
2018-12-30 18:00:05 +08:00
|
|
|
public AssetInfo(string assetName, NamePairings standingAssetPaths, NamePairings movingAssetPaths, NamePairings swimmingAssetPaths, NamePairings sittingAssetPaths, Vector2 assetSize, bool randomizeUponLoad)
|
2018-03-04 23:53:55 +08:00
|
|
|
{
|
2018-03-05 06:32:59 +08:00
|
|
|
this.assetName = assetName;
|
2018-12-30 18:00:05 +08:00
|
|
|
this.sittingAssetPaths = sittingAssetPaths;
|
|
|
|
this.standingAssetPaths = standingAssetPaths;
|
|
|
|
this.movingAssetPaths = movingAssetPaths;
|
|
|
|
this.swimmingAssetPaths = swimmingAssetPaths;
|
2018-02-24 11:10:56 +08:00
|
|
|
this.assetSize = assetSize;
|
|
|
|
this.randomizeUponLoad = randomizeUponLoad;
|
|
|
|
}
|
|
|
|
|
2018-12-30 18:00:05 +08:00
|
|
|
/// <summary>Save the json to a certain location.</summary>
|
|
|
|
/// <param name="path">The absolute path to save.</param>
|
2018-02-24 11:10:56 +08:00
|
|
|
public void writeToJson(string path)
|
|
|
|
{
|
|
|
|
Class1.ModHelper.WriteJsonFile<AssetInfo>(path, this);
|
|
|
|
}
|
|
|
|
|
2018-12-30 18:00:05 +08:00
|
|
|
/// <summary>Read the json from a certain location.</summary>
|
|
|
|
/// <param name="path">The absolute path to save.</param>
|
2018-02-24 11:10:56 +08:00
|
|
|
public static AssetInfo readFromJson(string path)
|
|
|
|
{
|
2018-12-30 18:00:05 +08:00
|
|
|
return Class1.ModHelper.ReadJsonFile<AssetInfo>(path);
|
2018-02-24 11:10:56 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|