2018-02-24 17:04:35 +08:00
|
|
|
|
using Microsoft.Xna.Framework.Graphics;
|
|
|
|
|
using StardewValley;
|
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Text;
|
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
|
|
|
|
|
namespace CustomNPCFramework.Framework.ModularNPCS
|
|
|
|
|
{
|
2018-03-20 14:01:43 +08:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// Used as a wrapper for the AnimatedSprite class.
|
|
|
|
|
/// </summary>
|
2018-02-24 17:04:35 +08:00
|
|
|
|
public class AnimatedSpriteExtended
|
|
|
|
|
{
|
2018-03-20 14:01:43 +08:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// The actual sprite of the object.
|
|
|
|
|
/// </summary>
|
2018-02-24 17:04:35 +08:00
|
|
|
|
public AnimatedSprite sprite;
|
2018-03-20 14:01:43 +08:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// The path to the texture to load the sprite from.
|
|
|
|
|
/// </summary>
|
2018-02-24 17:04:35 +08:00
|
|
|
|
public string path;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Constructor.
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="path">Full path to asset.</param>
|
|
|
|
|
/// <param name="currentFrame">Starting animation frame.</param>
|
|
|
|
|
/// <param name="spriteWidth">Sprite width.</param>
|
|
|
|
|
/// <param name="spriteHeight">Sprite height</param>
|
|
|
|
|
public AnimatedSpriteExtended(string path,int currentFrame,int spriteWidth, int spriteHeight)
|
|
|
|
|
{
|
|
|
|
|
this.path = Class1.getRelativeDirectory(path);
|
|
|
|
|
this.sprite=new AnimatedSprite(Class1.ModHelper.Content.Load<Texture2D>(this.path),currentFrame,spriteWidth,spriteHeight);
|
|
|
|
|
}
|
|
|
|
|
|
2018-03-04 23:53:55 +08:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// Constructor.
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="texture">The texture for the sprite.</param>
|
2018-03-17 19:04:04 +08:00
|
|
|
|
/// <param name="texture">Path used for retaining texture location on disk.</param>
|
2018-03-04 23:53:55 +08:00
|
|
|
|
/// <param name="currentFrame">Starting animation frame.</param>
|
|
|
|
|
/// <param name="spriteWidth">Sprite width.</param>
|
|
|
|
|
/// <param name="spriteHeight">Sprite height</param>
|
2018-03-17 19:04:04 +08:00
|
|
|
|
public AnimatedSpriteExtended(Texture2D texture,string path ,int currentFrame, int spriteWidth, int spriteHeight)
|
2018-03-04 23:53:55 +08:00
|
|
|
|
{
|
|
|
|
|
this.path = Class1.getRelativeDirectory(path);
|
|
|
|
|
this.sprite = new AnimatedSprite(texture, currentFrame, spriteWidth, spriteHeight);
|
|
|
|
|
}
|
|
|
|
|
|
2018-02-24 17:04:35 +08:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// Reloads the asset from disk.
|
|
|
|
|
/// </summary>
|
|
|
|
|
public void reload()
|
|
|
|
|
{
|
|
|
|
|
this.sprite.Texture = Class1.ModHelper.Content.Load<Texture2D>(this.path);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|