Skip to content

Class TerminalScreenBase

Shared presenter behavior: runs the session’s texture through the screen shader with this screen’s screen type, maps pointer UVs to cells through the same warp the shader uses, and turns pointer activity into mouse reports or selection. The effect pass runs only when its result would change: a new grid frame, a screen type edit, a resize, an animated screen type, or a run-time behavior in motion. Those behaviors are per screen: power, vertical hold, the signal with its cues, and panel damage. They change the display only; the session and its grid carry on underneath, and the pointer maps as on an undisturbed picture. A screen that is off takes no pointer input.

Declaration
public abstract class TerminalScreenBase : MonoBehaviour

Inheritance: System.Object -> UnityEngine.Object -> UnityEngine.Component -> UnityEngine.Behaviour -> UnityEngine.MonoBehaviour

Derived:
DarkEffekt.Terminal.Unity.TerminalScreen3D, DarkEffekt.Terminal.Unity.TerminalScreenUGUI

Declaration
public TerminalSession Session { get; set; }

How this screen shows the session. Null is a sharp flat copy.

Declaration
public TerminalScreenType ScreenType { get; set; }
Declaration
public PointerIndicator PointerIndicatorStyle { get; set; }

True when the screen is on or switching on.

Declaration
public bool IsPoweredOn { get; }

Where the screen is between on and off.

Declaration
public ScreenPowerState PowerState { get; }

False while the picture rolls, is held out of frame, or is rolling back into lock.

Declaration
public bool HasVerticalHold { get; }

How fast the picture rolls, in pictures a second; positive is upward. Zero in lock.

Declaration
public float VerticalRollSpeed { get; }

The signal this screen receives, kept until set again: its interference and scrambling. DarkEffekt.Terminal.Unity.SignalCondition.Noisy(float) and DarkEffekt.Terminal.Unity.SignalCondition.Scrambled(System.Single%2cSystem.Single) build the usual ones. Cues play over it and leave it alone.

Declaration
public SignalCondition Signal { get; set; }

The cues playing over the signal, oldest first.

Declaration
public IReadOnlyList<SignalCue> Cues { get; }

Picks this screen’s interference and crack patterns. The same seed, calls, and times draw the same frames.

Declaration
public int SignalSeed { get; set; }

True during a Glitch burst.

Declaration
public bool IsGlitching { get; }

True while the panel shows any damage.

Declaration
public bool IsDamaged { get; }

The state of the display itself: the impacts on its panel, oldest first. Save it, and give each impact back to Damage to restore the picture.

Declaration
public DisplayCondition Display { get; }

The styled image this screen shows, for materials or scripts of your own. Null until the first frame; a new texture after a resize.

Declaration
public Texture DisplayTexture { get; }

The panel’s cracks as a map over the display, for a material of your own: the lit edge in r, the shaded edge in g, and the glass normal in ba. The Terminal Screen sub graph turns it into a normal and a smoothness. Null while the panel is whole.

Declaration
public Texture CrackTexture { get; }

The panel’s damage as a map over the display: the stuck lines’ color in rgb and the dead share in a. Null while the panel is whole.

Declaration
public Texture DamageTexture { get; }

False while nothing can see this screen, which skips its effect pass.

Declaration
protected virtual bool IsShown { get; }

The width over height of the surface this screen covers. A positive value letterboxes the grid to keep its shape; zero stretches it to fill.

Declaration
protected virtual float SurfaceAspect { get; }
Declaration
[Tooltip("The session this screen shows and sends its pointer input to.")]
[SerializeField]
protected TerminalSession session
Declaration
[Tooltip("How this screen shows the session: filtering and the display effect. Empty is a sharp flat copy.")]
[SerializeField]
protected TerminalScreenType screenType
Declaration
[Tooltip("What the terminal draws at the hovered cell. None draws nothing and only routes the input, for setups where a reticle or the OS cursor is already visible.")]
[SerializeField]
protected PointerIndicator pointerIndicator

The most impacts a screen shows. One more replaces the oldest.

Declaration
public const int MaxImpacts = 4

Called by the concrete screens when the pointer leaves the surface.

Declaration
protected void PointerExit()

Switches the screen on, with the screen type’s power style and duration. Instant cuts straight to the picture, as does a screen with no screen type.

Declaration
public void PowerOn(bool instant = false)
Type Name
System.Boolean instant

Switches the screen off, with the screen type’s power style and duration. The screen stays dark until PowerOn, and takes no pointer input. The session keeps running and keeps the keyboard.

Declaration
public void PowerOff(bool instant = false)
Type Name
System.Boolean instant

Switches the screen off and back on: off with its transition, dark for a moment, then on with its transition. PowerChanged reports both ends. A PowerOn or PowerOff call in between replaces it.

Declaration
public void PowerCycle(float darkSeconds = 0.5)
Type Name
System.Single darkSeconds

Lets the picture roll at speed, in pictures a second, with the blanking bar between frames. Positive rolls upward, negative downward, and zero holds the picture where it is.

Declaration
public void LoseVerticalHold(float speed = 0.6)
Type Name
System.Single speed

Brings the picture back into lock. Zero seconds snaps it; more lets it roll on to the next frame and settle over that time.

Declaration
public void RecoverVerticalHold(float seconds = 0)
Type Name
System.Single seconds

Rolls the picture through one frame over seconds, then locks again.

Declaration
public void RollOnce(float seconds = 0.5, bool downward = false)
Type Name
System.Single seconds
System.Boolean downward

Plays a cue over the signal: its condition at its envelope’s level, blended as it says, until its release ends or DarkEffekt.Terminal.Unity.TerminalScreenBase.Stop(DarkEffekt.Terminal.Unity.SignalCue) starts the release early. Returns the cue.

Declaration
public SignalCue Play(SignalCue cue)

DarkEffekt.Terminal.Unity.SignalCue

Type Name
DarkEffekt.Terminal.Unity.SignalCue cue

Starts a cue’s release now. A cue that has ended, or whose release has begun, is left alone.

Declaration
public void Stop(SignalCue cue)
Type Name
DarkEffekt.Terminal.Unity.SignalCue cue

Starts every cue’s release now.

Declaration
public void StopCues()

Receives a condition in place of the signal for a number of seconds, as a cue that replaces it, then returns to the signal as set. Zero or less seconds sets the signal itself instead.

Declaration
public SignalCue Receive(SignalCondition condition, float seconds)

DarkEffekt.Terminal.Unity.SignalCue

Type Name
DarkEffekt.Terminal.Unity.SignalCondition condition
System.Single seconds

Puts the screen right at once: switched on, the picture locked, no interference, any glitch over, and the damage repaired.

Declaration
public void ResetBehaviors()

A burst of tearing, jitter, static, and color trouble for duration seconds, at a strength from 0 to 1, over the signal: a cue of DarkEffekt.Terminal.Unity.SignalCondition.Burst(float).

Declaration
public void Glitch(float duration = 0.3, float strength = 0.8)
Type Name
System.Single duration
System.Single strength

Cracks the panel at a UV on the screen, the kind UvToCell takes, with a severity from 0 to 1. The damage stays until Repair. The crack pattern comes from the position and SignalSeed; the impact returned holds everything that draws it.

Declaration
public ScreenImpact Damage(Vector2 uv, float severity = 0.5)

DarkEffekt.Terminal.Unity.ScreenImpact

Type Name
UnityEngine.Vector2 uv
System.Single severity

Adds an impact as given, such as one saved from Impacts.

Declaration
public void Damage(ScreenImpact impact)
Type Name
DarkEffekt.Terminal.Unity.ScreenImpact impact

Cracks the panel at the middle of a cell. False when the session is not ready or the cell is off the grid.

Declaration
public bool DamageCell(int col, int row, float severity = 0.5)

System.Boolean

Type Name
System.Int32 col
System.Int32 row
System.Single severity

Clears every impact.

Declaration
public void Repair()
Declaration
protected virtual void LateUpdate()

DisplayTextureSize(Texture, TerminalScreenType, int, out bool)

Section titled “DisplayTextureSize(Texture, TerminalScreenType, int, out bool)”

The size of the display texture this presenter shows, and whether it carries mipmaps. The default suits a surface seen at any distance and angle: see DarkEffekt.Terminal.Unity.TerminalScreenBase.SupersampledSize(UnityEngine.Texture%2cDarkEffekt.Terminal.Unity.TerminalScreenType%2cSystem.Int32%2cSystem.Boolean%40).

Declaration
protected virtual Vector2Int DisplayTextureSize(Texture grid, TerminalScreenType type, int cellHeight, out bool mipmaps)

UnityEngine.Vector2Int

Type Name
UnityEngine.Texture grid
DarkEffekt.Terminal.Unity.TerminalScreenType type
System.Int32 cellHeight
System.Boolean mipmaps

SupersampledSize(Texture, TerminalScreenType, int, out bool)

Section titled “SupersampledSize(Texture, TerminalScreenType, int, out bool)”

A display texture size for a surface with no fixed size on screen. A Point screen type gets the grid’s own size, texel for texel. A smooth one gets mipmaps, and when it bends the image or draws line patterns, a whole multiple of the grid large enough that a scanline covers four pixels.

Declaration
protected static Vector2Int SupersampledSize(Texture grid, TerminalScreenType type, int cellHeight, out bool mipmaps)

UnityEngine.Vector2Int

Type Name
UnityEngine.Texture grid
DarkEffekt.Terminal.Unity.TerminalScreenType type
System.Int32 cellHeight
System.Boolean mipmaps

Shows the styled display texture on the visual this presenter drives.

Declaration
protected abstract void PresentTexture(Texture texture)
Type Name
UnityEngine.Texture texture

Mirrors the barrel warp in TerminalScreen.shader, so a pointer on the curved image lands on the cell it appears to touch. A roll, interference, and damage leave the mapping alone.

Declaration
public Vector2 WarpUv(Vector2 uv)

UnityEngine.Vector2

Type Name
UnityEngine.Vector2 uv

UV (0,0 bottom left) to cell coordinates. False when off the screen, on the border around the grid, or while the screen is switched off.

Declaration
public bool UvToCell(Vector2 uv, out int col, out int row)

System.Boolean

Type Name
UnityEngine.Vector2 uv
System.Int32 col
System.Int32 row
Declaration
protected static TermModifiers KeyboardModifiers()

DarkEffekt.Terminal.TermModifiers

Declaration
protected void PointerDown(TermMouseButton button, Vector2 uv)
Type Name
DarkEffekt.Terminal.TermMouseButton button
UnityEngine.Vector2 uv
Declaration
protected void PointerUp(TermMouseButton button, Vector2 uv)
Type Name
DarkEffekt.Terminal.TermMouseButton button
UnityEngine.Vector2 uv
Declaration
protected void PointerMove(Vector2 uv)
Type Name
UnityEngine.Vector2 uv
Declaration
protected void PointerScroll(float delta, Vector2 uv)
Type Name
System.Single delta
UnityEngine.Vector2 uv
Declaration
protected virtual void OnDisable()
Declaration
protected virtual void OnDestroy()

Raised when the screen reaches on (true) or off (false), at the end of its transition.

Declaration
public event Action<bool> PowerChanged

System.Action<System.Boolean>

Raised when the picture comes back into lock, after RecoverVerticalHold or RollOnce.

Declaration
public event Action VerticalHoldRecovered

System.Action

Raised when a Glitch burst ends.

Declaration
public event Action GlitchEnded

System.Action