recrownedgtk/RecrownedGTK/Data/SkinData.cs

116 lines
3.4 KiB
C#
Raw Normal View History

2020-02-17 02:44:21 +00:00
using System;
using RecrownedGTK.Graphics.UI.SkinSystem.Definitions;
using OpenTK.Graphics;
using RecrownedGTK.Types;
namespace RecrownedGTK.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 byte r, g, b, a;
/// <summary>
/// Sets values for data.
/// </summary>
/// <param name="name">the name to be referenced by.</param>
/// <param name="color">The color value <paramref name="name"/> represents.</param>
public ColorData(string name, Color4 color)
{
this.name = name;
r = color.GetRedAsByte();
g = color.GetGreenAsByte();
b = color.GetBlueAsByte();
a = color.GetAlphaAsByte();
}
}
/// <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 SkinDefinitionData skin;
/// <summary>
/// Sets values for data.
/// </summary>
/// <param name="name">The name to be referenced by.</param>
/// <param name="skinDefinitionData">The skin data.</param>
public DefinitionData(string name, SkinDefinitionData skinDefinitionData)
{
this.name = name;
skin = skinDefinitionData;
}
}
}
}