Added own color-type to have more control over and easier manipulation of collors

This commit is contained in:
DarthAffe committed 2016-09-11 10:40:01 +02:00
1 parent 5c6dba769b
commit 381ec55349
29 files changed
+271 -93

No files matched your search

+12 -5
View File
@@ -7,7 +7,8 @@ namespace CUE.NET.Effects
/// <summary>
/// Represents a basic effect targeting an <see cref="IBrush"/>.
/// </summary>
public abstract class AbstractBrushEffect : IEffect<IBrush>
public abstract class AbstractBrushEffect<T> : IEffect<IBrush>
where T : IBrush
{
#region Properties & Fields
@@ -19,7 +20,7 @@ namespace CUE.NET.Effects
/// <summary>
/// Gets the <see cref="IBrush"/> this effect is targeting.
/// </summary>
protected IBrush Brush { get; set; }
protected T Brush { get; set; }
#endregion
@@ -38,7 +39,7 @@ namespace CUE.NET.Effects
/// <returns><c>true</c> if the effect can be attached; otherwise, <c>false</c>.</returns>
public virtual bool CanBeAppliedTo(IBrush target)
{
return true;
return target is T;
}
/// <summary>
@@ -47,7 +48,7 @@ namespace CUE.NET.Effects
/// <param name="target">The <see cref="IBrush"/> this effect is attached to.</param>
public virtual void OnAttach(IBrush target)
{
Brush = target;
Brush = (T)target;
}
/// <summary>
@@ -56,9 +57,15 @@ namespace CUE.NET.Effects
/// <param name="target">The <see cref="IBrush"/> this effect is detached from.</param>
public virtual void OnDetach(IBrush target)
{
Brush = null;
Brush = default(T);
}
#endregion
}
/// <summary>
/// Represents a basic effect targeting an <see cref="IBrush"/>.
/// </summary>
public abstract class AbstractBrushEffect : AbstractBrushEffect<IBrush>
{ }
}
+12 -5
View File
@@ -9,7 +9,8 @@ namespace CUE.NET.Effects
/// <summary>
/// Represents a basic effect targeting an <see cref="ILedGroup"/>.
/// </summary>
public abstract class AbstractLedGroupEffect : IEffect<ILedGroup>
public abstract class AbstractLedGroupEffect<T> : IEffect<ILedGroup>
where T : ILedGroup
{
#region Properties & Fields
@@ -21,7 +22,7 @@ namespace CUE.NET.Effects
/// <summary>
/// Gets the <see cref="ILedGroup"/> this effect is targeting.
/// </summary>
protected ILedGroup LedGroup { get; set; }
protected T LedGroup { get; set; }
#endregion
@@ -40,7 +41,7 @@ namespace CUE.NET.Effects
/// <returns><c>true</c> if the effect can be attached; otherwise, <c>false</c>.</returns>
public virtual bool CanBeAppliedTo(ILedGroup target)
{
return true;
return target is T;
}
/// <summary>
@@ -49,7 +50,7 @@ namespace CUE.NET.Effects
/// <param name="target">The <see cref="ILedGroup"/> this effect is attached to.</param>
public virtual void OnAttach(ILedGroup target)
{
LedGroup = target;
LedGroup = (T)target;
}
/// <summary>
@@ -58,9 +59,15 @@ namespace CUE.NET.Effects
/// <param name="target">The <see cref="ILedGroup"/> this effect is detached from.</param>
public virtual void OnDetach(ILedGroup target)
{
LedGroup = null;
LedGroup = default(T);
}
#endregion
}
/// <summary>
/// Represents a basic effect targeting an <see cref="ILedGroup"/>.
/// </summary>
public abstract class AbstractLedGroupEffect : AbstractLedGroupEffect<ILedGroup>
{ }
}