Class TextEffectExtensions
Chaining helpers for configuring text effects.
Inherited Members
Namespace: Scylla.TextMode
Assembly: ScyllaTextMode.dll
Syntax
public static class TextEffectExtensions
Remarks
Each helper returns the effect it was given, keeping its concrete type, so settings that belong to the base and settings that belong to a specific effect can be mixed in any order. Without that, a chain would have to put every shared setting last.
Every helper here is a thin wrapper over a settable property on TextEffectBase, so anything that reads better as a plain assignment can be written that way instead.
Methods
OnComplete<T>(T, Action)
Runs a callback when the effect reaches its final state.
Declaration
public static T OnComplete<T>(this T effect, Action callback) where T : TextEffectBase
Parameters
| Type | Name | Description |
|---|---|---|
| T | effect | The effect to configure. |
| Action | callback | The callback to run. |
Returns
| Type | Description |
|---|---|
| T | The effect, for chaining. |
Type Parameters
| Name | Description |
|---|---|
| T | The concrete effect type. |
OnStart<T>(T, Action)
Runs a callback when the effect begins advancing.
Declaration
public static T OnStart<T>(this T effect, Action callback) where T : TextEffectBase
Parameters
| Type | Name | Description |
|---|---|---|
| T | effect | The effect to configure. |
| Action | callback | The callback to run. |
Returns
| Type | Description |
|---|---|
| T | The effect, for chaining. |
Type Parameters
| Name | Description |
|---|---|
| T | The concrete effect type. |
OnStop<T>(T, Action)
Runs a callback when the effect is stopped before finishing.
Declaration
public static T OnStop<T>(this T effect, Action callback) where T : TextEffectBase
Parameters
| Type | Name | Description |
|---|---|---|
| T | effect | The effect to configure. |
| Action | callback | The callback to run. |
Returns
| Type | Description |
|---|---|
| T | The effect, for chaining. |
Type Parameters
| Name | Description |
|---|---|
| T | The concrete effect type. |
SetCellDuration<T>(T, float)
Sets how much of the effect's running time each individual cell takes, which controls how spread out the mask's ordering looks.
Declaration
public static T SetCellDuration<T>(this T effect, float cellDuration) where T : TextEffectBase
Parameters
| Type | Name | Description |
|---|---|---|
| T | effect | The effect to configure. |
| float | cellDuration | Fraction of the timeline each cell takes, from just above 0 to 1. |
Returns
| Type | Description |
|---|---|
| T | The effect, for chaining. |
Type Parameters
| Name | Description |
|---|---|
| T | The concrete effect type. |
SetDelay<T>(T, float)
Makes the effect wait before it starts advancing.
Declaration
public static T SetDelay<T>(this T effect, float seconds) where T : TextEffectBase
Parameters
| Type | Name | Description |
|---|---|---|
| T | effect | The effect to configure. |
| float | seconds | Seconds to wait. |
Returns
| Type | Description |
|---|---|
| T | The effect, for chaining. |
Type Parameters
| Name | Description |
|---|---|
| T | The concrete effect type. |
SetDuration<T>(T, float)
Sets how long the effect takes to play.
Declaration
public static T SetDuration<T>(this T effect, float seconds) where T : TextEffectBase
Parameters
| Type | Name | Description |
|---|---|---|
| T | effect | The effect to configure. |
| float | seconds | Playback duration in seconds. |
Returns
| Type | Description |
|---|---|
| T | The effect, for chaining. |
Type Parameters
| Name | Description |
|---|---|
| T | The concrete effect type. |
SetEase<T>(T, EaseType)
Sets the easing curve applied to the effect's progress.
Declaration
public static T SetEase<T>(this T effect, EaseType easeType) where T : TextEffectBase
Parameters
| Type | Name | Description |
|---|---|---|
| T | effect | The effect to configure. |
| EaseType | easeType | The curve to apply. |
Returns
| Type | Description |
|---|---|
| T | The effect, for chaining. |
Type Parameters
| Name | Description |
|---|---|
| T | The concrete effect type. |
SetFullGrid<T>(T)
Lets the effect cover the whole grid, which is the default.
Declaration
public static T SetFullGrid<T>(this T effect) where T : TextEffectBase
Parameters
| Type | Name | Description |
|---|---|---|
| T | effect | The effect to configure. |
Returns
| Type | Description |
|---|---|
| T | The effect, for chaining. |
Type Parameters
| Name | Description |
|---|---|
| T | The concrete effect type. |
SetLoops<T>(T, int, bool)
Repeats the effect, either a set number of extra times or until something stops it.
Declaration
public static T SetLoops<T>(this T effect, int loops, bool pingPong = false) where T : TextEffectBase
Parameters
| Type | Name | Description |
|---|---|---|
| T | effect | The effect to configure. |
| int | loops | Extra repeats. Zero plays once, negative repeats without end. |
| bool | pingPong | True to run repeats alternately forwards and backwards, which is what makes a loop seamless. |
Returns
| Type | Description |
|---|---|
| T | The effect, for chaining. |
Type Parameters
| Name | Description |
|---|---|
| T | The concrete effect type. |
SetMask<T>(T, in CellMask)
Sets the ordering the effect applies across its region, which is what turns one effect into a sweep, a scatter or a bloom.
Declaration
public static T SetMask<T>(this T effect, in CellMask mask) where T : TextEffectBase
Parameters
| Type | Name | Description |
|---|---|---|
| T | effect | The effect to configure. |
| CellMask | mask | The ordering to apply. |
Returns
| Type | Description |
|---|---|
| T | The effect, for chaining. |
Type Parameters
| Name | Description |
|---|---|
| T | The concrete effect type. |
SetName<T>(T, string)
Gives the effect a name, which appears in log messages and in the events it publishes.
Declaration
public static T SetName<T>(this T effect, string name) where T : TextEffectBase
Parameters
| Type | Name | Description |
|---|---|---|
| T | effect | The effect to configure. |
| string | name | The name to use. |
Returns
| Type | Description |
|---|---|
| T | The effect, for chaining. |
Type Parameters
| Name | Description |
|---|---|
| T | The concrete effect type. |
SetRegion<T>(T, in CellRect)
Confines the effect to a block of cells.
Declaration
public static T SetRegion<T>(this T effect, in CellRect region) where T : TextEffectBase
Parameters
| Type | Name | Description |
|---|---|---|
| T | effect | The effect to configure. |
| CellRect | region | The block of cells the effect may write to. |
Returns
| Type | Description |
|---|---|
| T | The effect, for chaining. |
Type Parameters
| Name | Description |
|---|---|
| T | The concrete effect type. |
SetRegion<T>(T, int, int, int, int)
Confines the effect to a block of cells.
Declaration
public static T SetRegion<T>(this T effect, int row, int column, int rows, int columns) where T : TextEffectBase
Parameters
| Type | Name | Description |
|---|---|---|
| T | effect | The effect to configure. |
| int | row | Row index of the top edge. |
| int | column | Column index of the left edge. |
| int | rows | Number of rows covered. |
| int | columns | Number of columns covered. |
Returns
| Type | Description |
|---|---|
| T | The effect, for chaining. |
Type Parameters
| Name | Description |
|---|---|
| T | The concrete effect type. |
SetSeed<T>(T, int)
Sets the seed used for deterministic random choices, so a run can be reproduced exactly.
Declaration
public static T SetSeed<T>(this T effect, int seed) where T : TextEffectBase
Parameters
| Type | Name | Description |
|---|---|---|
| T | effect | The effect to configure. |
| int | seed | The seed value. |
Returns
| Type | Description |
|---|---|
| T | The effect, for chaining. |
Type Parameters
| Name | Description |
|---|---|
| T | The concrete effect type. |
SetSpeed<T>(T, float)
Scales playback speed without changing the configured duration.
Declaration
public static T SetSpeed<T>(this T effect, float multiplier) where T : TextEffectBase
Parameters
| Type | Name | Description |
|---|---|---|
| T | effect | The effect to configure. |
| float | multiplier | Speed multiplier, where 2 plays twice as fast. |
Returns
| Type | Description |
|---|---|
| T | The effect, for chaining. |
Type Parameters
| Name | Description |
|---|---|
| T | The concrete effect type. |
SetTimeMode<T>(T, TextEffectTimeMode)
Chooses whether the effect honors framework pause and time scale.
Declaration
public static T SetTimeMode<T>(this T effect, TextEffectTimeMode mode) where T : TextEffectBase
Parameters
| Type | Name | Description |
|---|---|---|
| T | effect | The effect to configure. |
| TextEffectTimeMode | mode | The clock to advance on. |
Returns
| Type | Description |
|---|---|
| T | The effect, for chaining. |
Type Parameters
| Name | Description |
|---|---|
| T | The concrete effect type. |
ToCleared<T>(T, Color32, Color32)
Transitions to a blank region, which is what a fade to black wants.
Declaration
public static T ToCleared<T>(this T effect, Color32 foreground, Color32 background) where T : TransitionEffectBase
Parameters
| Type | Name | Description |
|---|---|---|
| T | effect | The effect to configure. |
| Color32 | foreground | Foreground color of the blank cells. |
| Color32 | background | Background color of the blank cells. |
Returns
| Type | Description |
|---|---|
| T | The effect, for chaining. |
Type Parameters
| Name | Description |
|---|---|
| T | The concrete effect type. |
To<T>(T, CellGrid)
Transitions to the matching region of another grid.
Declaration
public static T To<T>(this T effect, CellGrid grid) where T : TransitionEffectBase
Parameters
| Type | Name | Description |
|---|---|---|
| T | effect | The effect to configure. |
| CellGrid | grid | Grid holding the target state. |
Returns
| Type | Description |
|---|---|
| T | The effect, for chaining. |
Type Parameters
| Name | Description |
|---|---|
| T | The concrete effect type. |
To<T>(T, Action<TextModeConsole>)
Transitions to whatever the callback draws.
Declaration
public static T To<T>(this T effect, Action<TextModeConsole> draw) where T : TransitionEffectBase
Parameters
| Type | Name | Description |
|---|---|---|
| T | effect | The effect to configure. |
| Action<TextModeConsole> | draw | Callback that paints the target state. |
Returns
| Type | Description |
|---|---|
| T | The effect, for chaining. |
Type Parameters
| Name | Description |
|---|---|
| T | The concrete effect type. |
Remarks
The callback runs once when the effect starts, against a scratch grid rather than the live one, and receives full-grid coordinates. Ordinary screen-drawing code therefore works unchanged as the target of a transition.