mirror of
https://github.com/DarthAffe/CUE.NET.git
synced 2026-11-11 13:06:24 +00:00
Added even more xml-comments
This commit is contained in:
1 parent
6de1087c1f
commit
5fc7abc9db
30 files changed
+639
-17
No files matched your search
@@ -7,32 +7,61 @@ using CUE.NET.Devices.Keyboard.Keys;
|
||||
|
||||
namespace CUE.NET.Devices.Keyboard.Effects
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents a basic effect.
|
||||
/// </summary>
|
||||
public abstract class AbstractEffect : IEffect
|
||||
{
|
||||
#region Properties & Fields
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the list of keys to which the effect applies.
|
||||
/// </summary>
|
||||
public IEnumerable<CorsairKey> KeyList { get; protected set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the brush which is drawn by the effect.
|
||||
/// </summary>
|
||||
public abstract IBrush EffectBrush { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the z-index of the brush to allow ordering them before drawing. (lowest first) (default: 0)
|
||||
/// </summary>
|
||||
public int ZIndex { get; set; } = 0;
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets if this effect has finished all of his work.
|
||||
/// </summary>
|
||||
public bool IsDone { get; protected set; }
|
||||
|
||||
#endregion
|
||||
|
||||
#region Methods
|
||||
|
||||
/// <summary>
|
||||
/// Sets the list of keys to which the effect applies.
|
||||
/// </summary>
|
||||
/// <param name="keyGroup"></param>
|
||||
public void SetTarget(IKeyGroup keyGroup)
|
||||
{
|
||||
KeyList = keyGroup.Keys.ToList();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Updates the effect.
|
||||
/// </summary>
|
||||
/// <param name="deltaTime">The elapsed time (in seconds) since the last update.</param>
|
||||
public abstract void Update(float deltaTime);
|
||||
|
||||
/// <summary>
|
||||
/// Hook which is called when the effect is attached to a keyboard.
|
||||
/// </summary>
|
||||
public virtual void OnAttach()
|
||||
{ }
|
||||
|
||||
/// <summary>
|
||||
/// Hook which is called when the effect is detached from a keyboard.
|
||||
/// </summary>
|
||||
public virtual void OnDetach()
|
||||
{ }
|
||||
|
||||
|
||||
@@ -3,20 +3,37 @@
|
||||
|
||||
namespace CUE.NET.Devices.Keyboard.Effects
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents a wrapped effect with additional time information.
|
||||
/// </summary>
|
||||
internal class EffectTimeContainer
|
||||
{
|
||||
#region Properties & Fields
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the wrapped effect.
|
||||
/// </summary>
|
||||
internal IEffect Effect { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the tick-count from the last time the effect was updated.
|
||||
/// </summary>
|
||||
internal long TicksAtLastUpdate { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the z-index of the effect.
|
||||
/// </summary>
|
||||
internal int ZIndex => Effect?.ZIndex ?? 0;
|
||||
|
||||
#endregion
|
||||
|
||||
#region Constructors
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="EffectTimeContainer"/> class.
|
||||
/// </summary>
|
||||
/// <param name="effect">The wrapped effect.</param>
|
||||
/// <param name="ticksAtLastUpdate">The tick-count from the last time the effect was updated.</param>
|
||||
internal EffectTimeContainer(IEffect effect, long ticksAtLastUpdate)
|
||||
{
|
||||
this.Effect = effect;
|
||||
|
||||
@@ -7,23 +7,61 @@ using CUE.NET.Devices.Keyboard.Brushes;
|
||||
|
||||
namespace CUE.NET.Devices.Keyboard.Effects
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents an effect which allows to flash an brush by modifying his opacity.
|
||||
/// </summary>
|
||||
public class FlashEffect : AbstractEffect
|
||||
{
|
||||
#region Properties & Fields
|
||||
|
||||
/// <summary>
|
||||
/// Gets the brush which is drawn by the effect.
|
||||
/// </summary>
|
||||
public override IBrush EffectBrush { get; }
|
||||
|
||||
// Settings are close to a synthesizer envelope (sustain is different for consequent naming): https://en.wikipedia.org/wiki/Synthesizer#ADSR_envelope
|
||||
/// <summary>
|
||||
/// Gets or sets the attack-time (in seconds) of the effect. (default: 0.2f)<br />
|
||||
/// This is close to a synthesizer envelope. (See <see cref="http://en.wikipedia.org/wiki/Synthesizer#ADSR_envelope" /> as reference)
|
||||
/// </summary>
|
||||
public float Attack { get; set; } = 0.2f;
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the decay-time (in seconds) of the effect. (default: 0f)<br />
|
||||
/// This is close to a synthesizer envelope. (See <see cref="http://en.wikipedia.org/wiki/Synthesizer#ADSR_envelope" /> as reference)
|
||||
/// </summary>
|
||||
public float Decay { get; set; } = 0f;
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the sustain-time (in seconds) of the effect. (default: 0.3f)<br />
|
||||
/// This is close to a synthesizer envelope. (See <see cref="http://en.wikipedia.org/wiki/Synthesizer#ADSR_envelope" /> as reference)<br />
|
||||
/// Note that this value for naming reasons represents the time NOT the level.
|
||||
/// </summary>
|
||||
public float Sustain { get; set; } = 0.3f;
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the release-time (in seconds) of the effect. (default: 0.2f)<br />
|
||||
/// This is close to a synthesizer envelope. (See <see cref="http://en.wikipedia.org/wiki/Synthesizer#ADSR_envelope" /> as reference)
|
||||
/// </summary>
|
||||
public float Release { get; set; } = 0.2f;
|
||||
|
||||
public float SustainValue { get; set; } = 1f;
|
||||
/// <summary>
|
||||
/// Gets or sets the level to which the oppacity (percentage) should raise in the attack-cycle. (default: 1f);
|
||||
/// </summary>
|
||||
public float AttackValue { get; set; } = 1f;
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the level at which the oppacity (percentage) should stay in the sustain-cycle. (default: 1f);
|
||||
/// </summary>
|
||||
public float SustainValue { get; set; } = 1f;
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the interval (in seconds) in which the effect should repeat (if repetition is enabled). (default: 1f)
|
||||
/// </summary>
|
||||
public float Interval { get; set; } = 1f;
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the amount of repetitions the effect should do until it's finished. Zero means infinite. (default: 0f)
|
||||
/// </summary>
|
||||
public int Repetitions { get; set; } = 0;
|
||||
|
||||
private ADSRPhase _currentPhase;
|
||||
@@ -34,10 +72,18 @@ namespace CUE.NET.Devices.Keyboard.Effects
|
||||
|
||||
#region Constructors
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="FlashEffect"/> class.
|
||||
/// </summary>
|
||||
/// <param name="flashColor">The color from which a <see cref="SolidColorBrush" /> should be created and used by this effect.</param>
|
||||
public FlashEffect(Color flashColor)
|
||||
: this(new SolidColorBrush(flashColor))
|
||||
{ }
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="FlashEffect"/> class.
|
||||
/// </summary>
|
||||
/// <param name="effectBrush">The brush which should be used by this effect,</param>
|
||||
public FlashEffect(IBrush effectBrush)
|
||||
{
|
||||
this.EffectBrush = effectBrush;
|
||||
@@ -47,6 +93,10 @@ namespace CUE.NET.Devices.Keyboard.Effects
|
||||
|
||||
#region Methods
|
||||
|
||||
/// <summary>
|
||||
/// Updates the effect.
|
||||
/// </summary>
|
||||
/// <param name="deltaTime">The elapsed time (in seconds) since the last update.</param>
|
||||
public override void Update(float deltaTime)
|
||||
{
|
||||
_currentPhaseValue -= deltaTime;
|
||||
@@ -101,6 +151,9 @@ namespace CUE.NET.Devices.Keyboard.Effects
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Resets the effect.
|
||||
/// </summary>
|
||||
public override void OnAttach()
|
||||
{
|
||||
base.OnAttach();
|
||||
|
||||
@@ -4,26 +4,51 @@ using CUE.NET.Devices.Keyboard.Keys;
|
||||
|
||||
namespace CUE.NET.Devices.Keyboard.Effects
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents a basic effect.
|
||||
/// </summary>
|
||||
public interface IEffect
|
||||
{
|
||||
#region Properties & Fields
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the list of keys to which the effect applies.
|
||||
/// </summary>
|
||||
IEnumerable<CorsairKey> KeyList { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the brush which is drawn by the effect.
|
||||
/// </summary>
|
||||
IBrush EffectBrush { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the z-index of the effect to allow ordering them before drawing. (lowest first) (default: 0)
|
||||
/// </summary>
|
||||
int ZIndex { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets if this effect has finished all of his work.
|
||||
/// </summary>
|
||||
bool IsDone { get; }
|
||||
|
||||
#endregion
|
||||
|
||||
#region Methods
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Updates the effect.
|
||||
/// </summary>
|
||||
/// <param name="deltaTime">The elapsed time (in seconds) since the last update.</param>
|
||||
void Update(float deltaTime);
|
||||
|
||||
/// <summary>
|
||||
/// Hook which is called when the effect is attached to a keyboard.
|
||||
/// </summary>
|
||||
void OnAttach();
|
||||
|
||||
/// <summary>
|
||||
/// Hook which is called when the effect is detached from a keyboard.
|
||||
/// </summary>
|
||||
void OnDetach();
|
||||
|
||||
#endregion
|
||||
|
||||
Reference in new issue
Block a user