refactors and added forgotten semicolon :/
This commit is contained in:
35
RecrownedAthenaeum/Data/NinePatchData.cs
Normal file
35
RecrownedAthenaeum/Data/NinePatchData.cs
Normal file
@@ -0,0 +1,35 @@
|
||||
namespace RecrownedAthenaeum.Data
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents a data structure for 9patches.
|
||||
/// </summary>
|
||||
public class NinePatchData
|
||||
{
|
||||
/// <summary>
|
||||
/// Name of texture associated with patch. May be null in the case of being apart of a <see cref="TextureAtlasData"/>
|
||||
/// </summary>
|
||||
public string textureName;
|
||||
|
||||
/// <summary>
|
||||
/// the boundaries of the patch.
|
||||
/// </summary>
|
||||
public int left, right, bottom, top;
|
||||
|
||||
/// <summary>
|
||||
/// Constructs patch.
|
||||
/// </summary>
|
||||
/// <param name="textureName">Name of the texture. May be null.</param>
|
||||
/// <param name="left">Left bound.</param>
|
||||
/// <param name="right">Right bound.</param>
|
||||
/// <param name="bottom">Bottom bound.</param>
|
||||
/// <param name="Top">Top bound.</param>
|
||||
public NinePatchData(string textureName, int left, int right, int bottom, int Top)
|
||||
{
|
||||
this.textureName = textureName;
|
||||
this.left = left;
|
||||
this.right = right;
|
||||
this.bottom = bottom;
|
||||
this.top = Top;
|
||||
}
|
||||
}
|
||||
}
|
87
RecrownedAthenaeum/Data/SkinData.cs
Normal file
87
RecrownedAthenaeum/Data/SkinData.cs
Normal file
@@ -0,0 +1,87 @@
|
||||
using RecrownedAthenaeum.UI.Skin.Definitions;
|
||||
|
||||
namespace RecrownedAthenaeum.Data
|
||||
{
|
||||
/// <summary>
|
||||
/// Data transfer object for game skins.
|
||||
/// </summary>
|
||||
public class SkinData
|
||||
{
|
||||
/// <summary>
|
||||
/// Holds metadata.
|
||||
/// </summary>
|
||||
public class Metadata
|
||||
{
|
||||
/// <summary>
|
||||
/// Author name.
|
||||
/// </summary>
|
||||
public string author;
|
||||
|
||||
/// <summary>
|
||||
/// Description of skin.
|
||||
/// </summary>
|
||||
public string description;
|
||||
|
||||
/// <summary>
|
||||
/// Name of skin.
|
||||
/// </summary>
|
||||
public string skinName;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The metadata for the skin file.
|
||||
/// </summary>
|
||||
public Metadata metadata;
|
||||
|
||||
/// <summary>
|
||||
/// The name of the atlas with extension.
|
||||
/// </summary>
|
||||
public string nameOfTextureAtlas;
|
||||
|
||||
/// <summary>
|
||||
/// Name of the region or file designating the cursor. If there is an extension, will check for file first then texture atlas. Otherwise, will just check region.
|
||||
/// </summary>
|
||||
public string cursorTextureName;
|
||||
|
||||
/// <summary>
|
||||
/// The color data containing the name of the color, and red, green, and blue values for the color.
|
||||
/// </summary>
|
||||
public ColorData[] colors;
|
||||
|
||||
/// <summary>
|
||||
/// The skin definitions containing a name for the definition, and the definition itself.
|
||||
/// </summary>
|
||||
public DefinitionData[] definitions;
|
||||
|
||||
/// <summary>
|
||||
/// Color data for data transfer.
|
||||
/// </summary>
|
||||
public struct ColorData
|
||||
{
|
||||
/// <summary>
|
||||
/// Name of color to be referenced by.
|
||||
/// </summary>
|
||||
public string name;
|
||||
|
||||
/// <summary>
|
||||
/// RGBA data of this color.
|
||||
/// </summary>
|
||||
public int r, g, b, a;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Definition data for data transfer.
|
||||
/// </summary>
|
||||
public struct DefinitionData
|
||||
{
|
||||
/// <summary>
|
||||
/// Name of definition to be referenced by.
|
||||
/// </summary>
|
||||
public string name;
|
||||
/// <summary>
|
||||
/// The skin definition data.
|
||||
/// </summary>
|
||||
public ISkinDefinitionData skin;
|
||||
}
|
||||
}
|
||||
}
|
84
RecrownedAthenaeum/Data/TextureAtlasData.cs
Normal file
84
RecrownedAthenaeum/Data/TextureAtlasData.cs
Normal file
@@ -0,0 +1,84 @@
|
||||
using Microsoft.Xna.Framework;
|
||||
|
||||
namespace RecrownedAthenaeum.Data
|
||||
{
|
||||
/// <summary>
|
||||
/// Data transfer object for a texture atlas.
|
||||
/// </summary>
|
||||
public class TextureAtlasData
|
||||
{
|
||||
/// <summary>
|
||||
/// Contains the regions of the texture atlas.
|
||||
/// </summary>
|
||||
public AtlasRegionData[] regions;
|
||||
/// <summary>
|
||||
/// The name of the file.
|
||||
/// </summary>
|
||||
public string textureName;
|
||||
|
||||
/// <summary>
|
||||
/// Creates the atlas given the regions and the file name of the texture file to be used.
|
||||
/// </summary>
|
||||
/// <param name="textureName"></param>
|
||||
/// <param name="regions"></param>
|
||||
public TextureAtlasData(string textureName, AtlasRegionData[] regions)
|
||||
{
|
||||
this.regions = regions;
|
||||
this.textureName = textureName;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Data object that contains information about the region ninepatch situation of a given region in an atlas.
|
||||
/// </summary>
|
||||
public class AtlasRegionData
|
||||
{
|
||||
/// <summary>
|
||||
/// Name of the region for referencial purposes.
|
||||
/// </summary>
|
||||
public string name;
|
||||
/// <summary>
|
||||
/// The location of the patch is designated by this rectangle.
|
||||
/// </summary>
|
||||
public Rectangle location;
|
||||
/// <summary>
|
||||
/// The ninepatch information.
|
||||
/// </summary>
|
||||
public NinePatchData ninePatchData;
|
||||
|
||||
/// <summary>
|
||||
/// Sets position in atlas for convenience.
|
||||
/// </summary>
|
||||
/// <param name="x">X coordinate of the position in the patch.</param>
|
||||
/// <param name="y">Y coordinate of the position in the patch.</param>
|
||||
public void SetPosition(int x, int y)
|
||||
{
|
||||
location.X = x;
|
||||
location.Y = y;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sets the dimensions of the region on the atlas for convenience.
|
||||
/// </summary>
|
||||
/// <param name="width">Width of the region.</param>
|
||||
/// <param name="height">Height of the region.</param>
|
||||
public void SetSize(int width, int height)
|
||||
{
|
||||
location.Width = width;
|
||||
location.Height = height;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sets both the coordinates and dimensions of the region on the atlas for convenience.
|
||||
/// </summary>
|
||||
/// <param name="x">X coordinate of the position in the patch.</param>
|
||||
/// <param name="y">Y coordinate of the position in the patch.</param>
|
||||
/// <param name="width">Width of the region.</param>
|
||||
/// <param name="height">Height of the region.</param>
|
||||
public void SetBounds(int x, int y, int width, int height)
|
||||
{
|
||||
SetPosition(x, y);
|
||||
SetSize(width, height);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user