Class CodeInstruction
An instruction with a code callback.
Implements
Inherited Members
Namespace: SadConsole.Instructions
Assembly: SadConsole.dll
Syntax
public class CodeInstruction : InstructionBase, IComponent
Constructors
CodeInstruction(Func<IScreenObject, TimeSpan, bool>)
Creates a new instruction with the specified callback.
Declaration
public CodeInstruction(Func<IScreenObject, TimeSpan, bool> callback)
Parameters
Type | Name | Description |
---|---|---|
Func<IScreenObject, TimeSpan, bool> | callback | The code invoked by this instruction. Return true to set IsFinished. |
Properties
ID
Friendly ID to help track what this code instruction was created from since it cannot be fully serialized.
Declaration
public string ID { get; set; }
Property Value
Type | Description |
---|---|
string |
Methods
SetCallback(Func<IScreenObject, TimeSpan, bool>)
Sets the callback used by the instruction.
Declaration
public void SetCallback(Func<IScreenObject, TimeSpan, bool> callback)
Parameters
Type | Name | Description |
---|---|---|
Func<IScreenObject, TimeSpan, bool> | callback | The code invoked by this instruction. Return true to set IsFinished. |
Update(IScreenObject, TimeSpan)
Executes the instruction. This base class method should be called from derived classes. If the IsFinished property is set to true, will try to repeat if needed and will raise all appropriate events.
Declaration
public override void Update(IScreenObject componentHost, TimeSpan delta)
Parameters
Type | Name | Description |
---|---|---|
IScreenObject | componentHost | The object that hosts this instruction. |
TimeSpan | delta | The time that has elapsed since this method was last called. |