C# Class kOS.Screen.TermWindow

Inheritance: UnityEngine.MonoBehaviour
Afficher le fichier Open project: KSP-KOS/KOS Class Usage Examples

Méthodes publiques

Méthode Description
Awake ( ) : void
ClearScreen ( ) : void
Close ( ) : void
DetachAllTelnets ( ) : void
GetFocus ( ) : void
GetRect ( ) : Rect
GetSoundMaker ( ) : kOS.Safe.Sound.ISoundMaker
LoadTexture ( String relativePath, Texture2D &targetTexture ) : void
LoseFocus ( ) : void
NumTelnets ( ) : int
OnDestroy ( ) : void
Open ( ) : void
OpenPopupEditor ( kOS.Persistence.Volume v, GlobalPath path ) : void
Print ( string str ) : void
ProcessOneInputChar ( char ch, TelnetSingletonServer whichTelnet, bool doQueuing = true ) : void

Respond to one single input character in Unicode, using the pretend virtual Unicode terminal keycodes described in the UnicodeCommand enum. To keep things simple, all key input is coerced into single Unicode chars even if the actual keypress takes multiple characters to express in its native form (i.e. ESC [ A means left-arrow on a VT100 terminal. If a telnet is talking via VT100 codes, that ESC [ A will get converted into a single UnicdeCommand.LEFTCURSORONE character before being sent here.)
This method is public because it is also how other mods should send input to the terminal if they want some other source to send simulated keystrokes.

TermWindow ( ) : System
Toggle ( ) : void

Méthodes protégées

Méthode Description
AdjustColor ( Color baseColor, float brightness ) : Color
CheckResizeDrag ( ) : void
DrawTelnetStatus ( ) : void

Draw a little status line at the bottom as a reminder that you are sharing the terminal with a telnet session:

Private Methods

Méthode Description
AttachTelnet ( TelnetSingletonServer server ) : void
AttachTo ( SharedObjects sharedObj ) : void
Beep ( ) : bool

Attempts to make Unity start a playthrough of the beep audio clip. The playthrough will continue on its own in the background while the rest of the code continues on. It will do nothing if the previous beep is still being played. (We only gave ourselves one audio beep source per GUI terminal so we can't play beeps simultaneously.)
Addendum: It will redirect into a visual beep if that is called for instead.

BuildPanelSkin ( ) : GUISkin
CalcualteTitle ( ) : string
ChangeTitle ( string newTitle ) : void
DetachTelnet ( TelnetSingletonServer server ) : void
GetNewestBuffer ( ) : void

Get the newest copy of the screen buffer once, for use in all calculations for a while. This was added when telnet clients were added. The execution cost of obtaining a buffer snapshot from the ScreenBuffer class is non-trivial, and therefore shouldn't be done over and over for each telnet client that needs it within the span of a short time. This gets it once for all of them to borrow. All calls will re-use this copy for a while, until the next terminal refresh (1/20th of a second, at the moment).

HowManyColumnsFit ( ) : int
HowManyRowsFit ( ) : int
LoadAudio ( ) : void
LoadFontArray ( ) : void
Lock ( ) : void
NotifyOfScreenResize ( IScreenBuffer sb ) : int
OnGUI ( ) : void
OnHideUI ( ) : void
OnShowUI ( ) : void
ProcessKeyEvents ( ) : void

Process the GUI event handler key events that are being seen the by GUI terminal, by translating them into values from the UnicodeCommand enum first if need be, and then passing them through to ProcessOneInputChar().

ProcessTelnetInput ( ) : void

Read all pending input from all telnet clients attached and process it all. Hopefully this won't bog down anything, as we don't expect to get lots of chars at once from keyboard input in a single update. The amount of characters pending in the queues should be very small since this is flushing it out every update. It could potentially be large if someone does a big cut-n-paste into their terminal window and their telnet client therefore sends a wall of text within the span of one Update(). Premature optimization is bad, so we'll wait to see if that is a problem later.

ProcessUnconsumedInput ( ) : void

When the input queue is not empty and the program or command is done such that the input cursor is now all the way back to the interpreter awaiting new input, send that queue out to the interpreter. This allows you to type the next command blindly while waiting for the previous one to finish. This is how people used to terminals would expect things to work.

RepaintTelnet ( TelnetSingletonServer telnet, bool fullSync ) : void

Do the repaint of the telnet session.

RepaintTelnetFull ( TelnetSingletonServer telnet ) : void

Cover the case where the whole screen needs to be repainted from scratch.

ResizeAndRepaintTelnet ( TelnetSingletonServer telnet, int width, int height, bool unconditional ) : void

Tell the telnet session to resize itself

SendTitleToTelnet ( TelnetSingletonServer telnet ) : void
ShowCharacterByAscii ( char ch, int x, int y, bool reversingScreen, int charWidth, int charHeight, float brightness ) : void
SpecialKey ( char key, bool doQueuing = true ) : void
TelnetOutputUpdate ( ) : void
TerminalGui ( int windowId ) : void
Type ( char ch, bool doQueuing = true ) : void
Unlock ( ) : void
Update ( ) : void
UpdateGUIBeeps ( ) : void

Method Details

AdjustColor() protected méthode

protected AdjustColor ( Color baseColor, float brightness ) : Color
baseColor Color
brightness float
Résultat Color

Awake() public méthode

public Awake ( ) : void
Résultat void

CheckResizeDrag() protected méthode

protected CheckResizeDrag ( ) : void
Résultat void

ClearScreen() public méthode

public ClearScreen ( ) : void
Résultat void

Close() public méthode

public Close ( ) : void
Résultat void

DetachAllTelnets() public méthode

public DetachAllTelnets ( ) : void
Résultat void

DrawTelnetStatus() protected méthode

Draw a little status line at the bottom as a reminder that you are sharing the terminal with a telnet session:
protected DrawTelnetStatus ( ) : void
Résultat void

GetFocus() public méthode

public GetFocus ( ) : void
Résultat void

GetRect() public méthode

public GetRect ( ) : Rect
Résultat UnityEngine.Rect

GetSoundMaker() public méthode

public GetSoundMaker ( ) : kOS.Safe.Sound.ISoundMaker
Résultat kOS.Safe.Sound.ISoundMaker

LoadTexture() public méthode

public LoadTexture ( String relativePath, Texture2D &targetTexture ) : void
relativePath String
targetTexture UnityEngine.Texture2D
Résultat void

LoseFocus() public méthode

public LoseFocus ( ) : void
Résultat void

NumTelnets() public méthode

public NumTelnets ( ) : int
Résultat int

OnDestroy() public méthode

public OnDestroy ( ) : void
Résultat void

Open() public méthode

public Open ( ) : void
Résultat void

OpenPopupEditor() public méthode

public OpenPopupEditor ( kOS.Persistence.Volume v, GlobalPath path ) : void
v kOS.Persistence.Volume
path GlobalPath
Résultat void

Print() public méthode

public Print ( string str ) : void
str string
Résultat void

ProcessOneInputChar() public méthode

Respond to one single input character in Unicode, using the pretend virtual Unicode terminal keycodes described in the UnicodeCommand enum. To keep things simple, all key input is coerced into single Unicode chars even if the actual keypress takes multiple characters to express in its native form (i.e. ESC [ A means left-arrow on a VT100 terminal. If a telnet is talking via VT100 codes, that ESC [ A will get converted into a single UnicdeCommand.LEFTCURSORONE character before being sent here.)
This method is public because it is also how other mods should send input to the terminal if they want some other source to send simulated keystrokes.
public ProcessOneInputChar ( char ch, TelnetSingletonServer whichTelnet, bool doQueuing = true ) : void
ch char The character, which might be a UnicodeCommand char
whichTelnet TelnetSingletonServer If this came from a telnet session, which one did it come from? /// Set to null in order to say it wasn't from a telnet but was from the interactive GUI
doQueuing bool true if the keypress should get queued if we're not ready for it /// right now. If false, then the keypress will be ignored if we're not ready for it.
Résultat void

TermWindow() public méthode

public TermWindow ( ) : System
Résultat System

Toggle() public méthode

public Toggle ( ) : void
Résultat void