Show / Hide Table of Contents

Class CodeEffect

Effect that runs code for the apply and update actions of an effect.

Inheritance
object
CellEffectBase
CodeEffect
Implements
ICellEffect
Inherited Members
CellEffectBase._delayFinished
CellEffectBase._timeElapsed
CellEffectBase.IsFinished
CellEffectBase.CloneOnAdd
CellEffectBase.StartDelay
CellEffectBase.RemoveOnFinished
CellEffectBase.RestoreCellOnRemoved
CellEffectBase.RunEffectOnApply
object.GetType()
object.MemberwiseClone()
object.Equals(object)
object.Equals(object, object)
object.ReferenceEquals(object, object)
object.GetHashCode()
Namespace: SadConsole.Effects
Assembly: SadConsole.dll
Syntax
public class CodeEffect : CellEffectBase, ICellEffect

Constructors

CodeEffect(string, Func<CodeEffect, ColoredGlyphBase, ColoredGlyphBase, bool>, Action<CodeEffect, TimeSpan>, Action<CodeEffect>)

Creates a cell effect that runs custom code instead of hardcoded effect actions.

Declaration
public CodeEffect(string id, Func<CodeEffect, ColoredGlyphBase, ColoredGlyphBase, bool> apply, Action<CodeEffect, TimeSpan> update, Action<CodeEffect> restart)
Parameters
Type Name Description
string id

A user-definable identifier.

Func<CodeEffect, ColoredGlyphBase, ColoredGlyphBase, bool> apply

The code to run for ApplyToCell(ColoredGlyphBase, ColoredGlyphBase).

Action<CodeEffect, TimeSpan> update

The code to run for Update(TimeSpan).

Action<CodeEffect> restart

The code to run for Restart().

Properties

Duration

The amount of time this effect runs for in seconds.

Declaration
public TimeSpan Duration { get; set; }
Property Value
Type Description
TimeSpan

Id

A user defined identifier of the effect.

Declaration
public string Id { get; set; }
Property Value
Type Description
string

Tag

An object associated with this effect.

Declaration
public object? Tag { get; set; }
Property Value
Type Description
object

UseDuration

When true, uses the Duration timer to stop this effect; otherwise false.

Declaration
public bool UseDuration { get; set; }
Property Value
Type Description
bool

Methods

ApplyToCell(ColoredGlyphBase, ColoredGlyphBase)

Applies the state of the effect to a cell.

Declaration
public override bool ApplyToCell(ColoredGlyphBase cell, ColoredGlyphBase originalState)
Parameters
Type Name Description
ColoredGlyphBase cell

The surface cell using this effect.

ColoredGlyphBase originalState

The state of the cell prior to the effect being applied.

Returns
Type Description
bool

true when this method modified the cell; otherwise false.

Overrides
CellEffectBase.ApplyToCell(ColoredGlyphBase, ColoredGlyphBase)

Clone()

Not supported.

Declaration
public override ICellEffect Clone()
Returns
Type Description
ICellEffect
Overrides
CellEffectBase.Clone()

Restart()

Restarts the cell effect.

Declaration
public override void Restart()
Overrides
CellEffectBase.Restart()

ToString()

Declaration
public override string ToString()
Returns
Type Description
string
Overrides
object.ToString()

Update(TimeSpan)

Updates the state of the effect.

Declaration
public override void Update(TimeSpan delta)
Parameters
Type Name Description
TimeSpan delta

Time since the last call to this effect.

Overrides
CellEffectBase.Update(TimeSpan)

Implements

ICellEffect

Extension Methods

ExtensionsSystem.GetDebuggerDisplayValue(object)
In this article

Back to top

Back to top Generated by DocFX