function for obtaining color will now work with nulls by setting the key to "default".
This commit is contained in:
parent
ec53e887ee
commit
8387cbc604
@ -29,10 +29,11 @@ namespace RecrownedAthenaeum.UI.SkinSystem
|
||||
|
||||
/// <summary>
|
||||
/// Returns a <see cref="Color"/> with given name of defined color;
|
||||
/// Should use value "default" if <paramref name="name"/> is null.
|
||||
/// </summary>
|
||||
/// <param name="name">Name of defined color.</param>
|
||||
/// <returns>The defined color based on the name given.</returns>
|
||||
Color GetColor(string name);
|
||||
Color GetColor(string name = null);
|
||||
|
||||
/// <summary>
|
||||
/// Returns a <see cref="TextureAtlas.Region"/> with given name of region.
|
||||
|
@ -48,7 +48,7 @@ namespace RecrownedAthenaeum.UI.SkinSystem
|
||||
/// </summary>
|
||||
/// <param name="name">Name of region.</param>
|
||||
/// <returns>The region corresponding to the name or null if the requested region doesn't exist.</returns>
|
||||
public virtual TextureAtlas.Region GetTextureAtlasRegion(string name)
|
||||
public TextureAtlas.Region GetTextureAtlasRegion(string name)
|
||||
{
|
||||
if (name == null || !textureAtlas.ContainsRegion(name)) return null;
|
||||
return textureAtlas[name];
|
||||
@ -57,10 +57,11 @@ namespace RecrownedAthenaeum.UI.SkinSystem
|
||||
/// <summary>
|
||||
/// Returns a <see cref="Color"/> with given name of defined color;
|
||||
/// </summary>
|
||||
/// <param name="name">Name of defined color.</param>
|
||||
/// <param name="name">Name of defined color. Will use "default" if null. Default value is null.</param>
|
||||
/// <returns>The defined color based on the name given.</returns>
|
||||
public virtual Color GetColor(string name)
|
||||
public Color GetColor(string name = null)
|
||||
{
|
||||
if (name == null) name = "default";
|
||||
return colors[name];
|
||||
}
|
||||
|
||||
@ -73,7 +74,7 @@ namespace RecrownedAthenaeum.UI.SkinSystem
|
||||
/// <param name="destination">The destination to draw to.</param>
|
||||
/// <param name="rotation">The rotation to use in radians.</param>
|
||||
/// <param name="origin">The origin for the rotation.</param>
|
||||
public virtual void Draw(string regionName, string color, SpriteBatch batch, Rectangle destination, float rotation = 0, Vector2 origin = default(Vector2))
|
||||
public void Draw(string regionName, string color, SpriteBatch batch, Rectangle destination, float rotation = 0, Vector2 origin = default(Vector2))
|
||||
{
|
||||
if (disposed) throw new ObjectDisposedException(GetType().Name);
|
||||
textureAtlas.Draw(regionName, batch, destination, colors[color], rotation, origin);
|
||||
@ -95,7 +96,7 @@ namespace RecrownedAthenaeum.UI.SkinSystem
|
||||
/// <typeparam name="T">Convenience to cast to the needed definition type.</typeparam>
|
||||
/// <param name="definitionName">The name of the definition.</param>
|
||||
/// <returns>The definition cast to T.</returns>
|
||||
public virtual T ObtainDefinition<T>(string definitionName = null) where T : SkinDefinitionData
|
||||
public T ObtainDefinition<T>(string definitionName = null) where T : SkinDefinitionData
|
||||
{
|
||||
return (T)ObtainDefinition(moduleTypeOfDefinition[typeof(T).FullName], definitionName);
|
||||
}
|
||||
@ -105,7 +106,7 @@ namespace RecrownedAthenaeum.UI.SkinSystem
|
||||
/// </summary>
|
||||
/// <param name="definitionName">The name of the definition. Default (if left blank) name is "default".</param>
|
||||
/// <param name="skinDefinition">The definition itself.</param>
|
||||
public virtual void AddDefinition(SkinDefinitionData skinDefinition, string definitionName = null)
|
||||
public void AddDefinition(SkinDefinitionData skinDefinition, string definitionName = null)
|
||||
{
|
||||
if (disposed) throw new ObjectDisposedException(GetType().Name);
|
||||
if (Laminated) throw new InvalidOperationException("This skin has been laminated and cannot be edited.");
|
||||
@ -124,7 +125,7 @@ namespace RecrownedAthenaeum.UI.SkinSystem
|
||||
/// </summary>
|
||||
/// <param name="name"></param>
|
||||
/// <param name="color"></param>
|
||||
public virtual void AddColor(string name, Color color)
|
||||
public void AddColor(string name, Color color)
|
||||
{
|
||||
if (Laminated) throw new InvalidOperationException("This skin has been laminated and cannot be edited.");
|
||||
colors.Add(name, color);
|
||||
|
Loading…
Reference in New Issue
Block a user