Class EffectsManager
Effects manager for a text surface.
Inherited Members
Namespace: SadConsole.Effects
Assembly: SadConsole.dll
Syntax
public class EffectsManager
Constructors
EffectsManager(ICellSurface)
Creates a new effects manager associated with a text surface.
Declaration
public EffectsManager(ICellSurface surface)
Parameters
| Type | Name | Description |
|---|---|---|
| ICellSurface | surface | Text surface to manage. |
Fields
_backingSurface
The surface hosting this effects manager.
Declaration
protected ICellSurface _backingSurface
Field Value
| Type | Description |
|---|---|
| ICellSurface |
_effectCells
A dictionary of effect data keyed by the cell index.
Declaration
protected Dictionary<ColoredGlyphBase, EffectsManager.ColoredGlyphEffectData> _effectCells
Field Value
| Type | Description |
|---|---|
| Dictionary<ColoredGlyphBase, EffectsManager.ColoredGlyphEffectData> |
_effects
A dictionary of effect data keyed by the effect.
Declaration
protected Dictionary<ICellEffect, EffectsManager.ColoredGlyphEffectData> _effects
Field Value
| Type | Description |
|---|---|
| Dictionary<ICellEffect, EffectsManager.ColoredGlyphEffectData> |
Properties
Count
Gets the number of effects.
Declaration
public int Count { get; }
Property Value
| Type | Description |
|---|---|
| int |
Methods
ClearCellEffect(ColoredGlyphBase)
Clears the effect for the cell specified by index.
Declaration
protected void ClearCellEffect(ColoredGlyphBase cell)
Parameters
| Type | Name | Description |
|---|---|---|
| ColoredGlyphBase | cell | The cell index. |
DropInvalidCells()
Checks all the cells in this manager and removes any that are no longer in the parent surface.
Declaration
public void DropInvalidCells()
GetEffect(ColoredGlyphBase)
Gets the effect of the specified cell.
Declaration
public ICellEffect? GetEffect(ColoredGlyphBase cell)
Parameters
| Type | Name | Description |
|---|---|---|
| ColoredGlyphBase | cell |
Returns
| Type | Description |
|---|---|
| ICellEffect | The effect. |
GetEffects()
Gets a collection of effects associated with the manager.
Declaration
public IEnumerable<ICellEffect>? GetEffects()
Returns
| Type | Description |
|---|---|
| IEnumerable<ICellEffect> | Null if there aren't any effects. |
GetKnownEffect(ICellEffect, out ColoredGlyphEffectData)
Gets effect data from the dictionary if it exists.
Declaration
protected bool GetKnownEffect(ICellEffect effect, out EffectsManager.ColoredGlyphEffectData effectData)
Parameters
| Type | Name | Description |
|---|---|---|
| ICellEffect | effect | The effect to get. |
| EffectsManager.ColoredGlyphEffectData | effectData | The effect data ssociated with the effect. |
Returns
| Type | Description |
|---|---|
| bool |
Remove(ICellEffect)
Removes an effect and associated cells from the manager.
Declaration
public void Remove(ICellEffect effect)
Parameters
| Type | Name | Description |
|---|---|---|
| ICellEffect | effect | Effect to remove. |
RemoveAll()
Removes all effects and associated cells.
Declaration
public void RemoveAll()
SetEffect(ColoredGlyphBase, ICellEffect?)
Associates a cell effect with a cell.
Declaration
public void SetEffect(ColoredGlyphBase cell, ICellEffect? effect)
Parameters
| Type | Name | Description |
|---|---|---|
| ColoredGlyphBase | cell | Cell to set the effect for. |
| ICellEffect | effect | The effect to associate with the cell. |
SetEffect(IEnumerable<ColoredGlyphBase>, ICellEffect?)
Changes the effect of the cells provided.
Declaration
public void SetEffect(IEnumerable<ColoredGlyphBase> cells, ICellEffect? effect)
Parameters
| Type | Name | Description |
|---|---|---|
| IEnumerable<ColoredGlyphBase> | cells | A list of cell indicies to change the effect on. |
| ICellEffect | effect | The effect to associate with the cell. |
UpdateEffects(TimeSpan)
Updates all known effects and applies them to their associated cells.
Declaration
public void UpdateEffects(TimeSpan delta)
Parameters
| Type | Name | Description |
|---|---|---|
| TimeSpan | delta | The time elapased since the last update. |