Class DecodeEffect
Resolves a region out of scrambled characters, the way decryption is shown in films: each cell cycles through random glyphs before settling on the character it is meant to hold.
Inherited Members
Namespace: Scylla.TextMode
Assembly: ScyllaTextMode.dll
Syntax
public sealed class DecodeEffect : TextEffectBase, ITextEffect, IDisposable
Remarks
The region is captured when the effect starts, and that capture is what the cells settle onto. Draw the content first and then play the effect over it, or set Text and let the effect write it before capturing.
Every cell holding text is scrambled from the moment the effect starts, and stays scrambled until its own turn to resolve arrives, so the text is never legible before it decodes. Whitespace is never scrambled: filling the gaps between words with noise would read as a block of static rather than as encrypted writing.
Whitespace is still hidden, though, because a blank cell is not necessarily an invisible one. A space carrying Inverse, which is how a title bar is drawn, renders as a solid block. Blanks therefore lose their attributes for as long as the region is encrypted and get them back as they settle, in step with the characters around them.
Scrambling glyphs are re-rolled a fixed number of times per second rather than every frame. Every frame looks frantic rather than fast, and it costs a cell write per cell per frame for no visual gain.
Properties
ScrambleRate
Gets or sets how many times a second the scrambling glyphs are re-rolled at the start of the effect. ScrambleRateFalloff decides what becomes of that rate later.
Declaration
public float ScrambleRate { get; set; }
Property Value
| Type | Description |
|---|---|
| float |
ScrambleRateFalloff
Gets or sets the fraction of ScrambleRate the glyphs are still re-rolled at by the end of the effect. One, the default, keeps the rate constant throughout.
Declaration
public float ScrambleRateFalloff { get; set; }
Property Value
| Type | Description |
|---|---|
| float |
Remarks
Below one the churn slows as the effect runs, so characters still unresolved late on change more slowly than the ones that resolved early. It reads as the decryption closing in on an answer rather than thrashing at the same pace until it stops. A value of 0.15 against the default rate takes the churn from twenty re-rolls a second down to three.
The rate falls against linear progress rather than against the eased progress that orders the cells. Those are different clocks on purpose: an ease-out like the one the Decode(in CellRect) preset uses is most of the way to one early in the run, so driving the churn from it would drop the rate to its floor almost immediately instead of winding down across the whole effect.
ScrambleSet
Gets or sets the characters cells cycle through before settling.
Declaration
public string ScrambleSet { get; set; }
Property Value
| Type | Description |
|---|---|
| string |
Remarks
Characters the font cannot draw are dropped when the effect starts, with one warning naming the first of them. Only the primary atlas page is bound at render time, so a set reaching outside it would otherwise show the wrong glyphs. The check is skipped entirely when no font has been loaded, since then every character would be reported.
Text
Gets or sets text the effect writes into the region before capturing it. Leave this null to decode whatever the region already holds.
Declaration
public string Text { get; set; }
Property Value
| Type | Description |
|---|---|
| string |
Methods
OnEffectFinish(bool)
Called when the effect finishes, whether it completed, was skipped or was stopped.
Declaration
protected override void OnEffectFinish(bool completed)
Parameters
| Type | Name | Description |
|---|---|---|
| bool | completed | True when the effect reached its final state. |
Overrides
Remarks
The default implementation does nothing. Override it to restore state an effect borrowed, which is what a corrupting effect needs so the grid is not left damaged.
OnEffectRelease()
Called when the effect is disposed. Return anything rented from the context here.
Declaration
protected override void OnEffectRelease()
Overrides
OnEffectStart()
Called when the effect starts, after the region is resolved and before any tick. Capture whatever the effect needs from the grid here.
Declaration
protected override void OnEffectStart()
Overrides
OnEffectTick(float, float)
Called once per tick to draw the effect at the given progress.
Declaration
protected override void OnEffectTick(float progress, float easedProgress)
Parameters
| Type | Name | Description |
|---|---|---|
| float | progress | Linear progress from 0 to 1. |
| float | easedProgress | Progress with the easing curve applied. |
Overrides
SetScrambleColor(Color32)
Draws scrambling characters in their own color, so the noise reads differently from the text that has settled.
Declaration
public DecodeEffect SetScrambleColor(Color32 color)
Parameters
| Type | Name | Description |
|---|---|---|
| Color32 | color | Color for scrambling characters. |
Returns
| Type | Description |
|---|---|
| DecodeEffect | This effect, for chaining. |
SetScrambleRate(float)
Sets how many times a second the scrambling glyphs are re-rolled.
Declaration
public DecodeEffect SetScrambleRate(float scrambleRate)
Parameters
| Type | Name | Description |
|---|---|---|
| float | scrambleRate | Re-rolls per second. |
Returns
| Type | Description |
|---|---|
| DecodeEffect | This effect, for chaining. |
SetScrambleRateFalloff(float)
Sets how far the re-roll rate winds down by the end of the effect.
Declaration
public DecodeEffect SetScrambleRateFalloff(float falloff)
Parameters
| Type | Name | Description |
|---|---|---|
| float | falloff | Fraction of the starting rate still in use at the end, or 1 to keep it constant. |
Returns
| Type | Description |
|---|---|
| DecodeEffect | This effect, for chaining. |
Remarks
See ScrambleRateFalloff for what the fraction means and why it runs on linear progress.
SetScrambleSet(string)
Sets the characters cells cycle through before settling.
Declaration
public DecodeEffect SetScrambleSet(string scrambleSet)
Parameters
| Type | Name | Description |
|---|---|---|
| string | scrambleSet | The characters to cycle through. |
Returns
| Type | Description |
|---|---|
| DecodeEffect | This effect, for chaining. |
SetText(string, Color32, Color32)
Sets text the effect writes into the region before capturing it.
Declaration
public DecodeEffect SetText(string text, Color32 foreground, Color32 background)
Parameters
| Type | Name | Description |
|---|---|---|
| string | text | The text to decode onto. |
| Color32 | foreground | Foreground color for the text. |
| Color32 | background | Background color for the text. |
Returns
| Type | Description |
|---|---|
| DecodeEffect | This effect, for chaining. |