2018-02-24 11:10:56 +08:00
|
|
|
|
using Microsoft.Xna.Framework;
|
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Text;
|
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
|
|
|
|
|
namespace CustomNPCFramework.Framework.Graphics
|
|
|
|
|
{
|
2018-03-19 18:32:00 +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-03-19 18:32:00 +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-03-19 18:32:00 +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-03-19 18:32:00 +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-03-19 18:32:00 +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-03-19 18:32:00 +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-03-19 18:32:00 +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-03-19 18:32:00 +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-19 18:32:00 +08:00
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Empty constructor.
|
|
|
|
|
/// </summary>
|
2018-03-04 23:53:55 +08:00
|
|
|
|
public AssetInfo()
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
2018-03-19 18:32:00 +08:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// Constructor that assigns values to the class.
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="assetName">The name of the asset. This is the name that will be referenced in any asset manager or asset pool.</param>
|
|
|
|
|
/// <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>
|
|
|
|
|
/// <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-03-05 05:23:40 +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-03-05 05:23:40 +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;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Save the json to a certain location.
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="path"></param>
|
|
|
|
|
public void writeToJson(string path)
|
|
|
|
|
{
|
|
|
|
|
Class1.ModHelper.WriteJsonFile<AssetInfo>(path, this);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Read the json from a certain location.
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="path"></param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
public static AssetInfo readFromJson(string path)
|
|
|
|
|
{
|
|
|
|
|
return Class1.ModHelper.ReadJsonFile<AssetInfo>(path);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|