void OnGUI() { if (Event.current.isKey && Event.current.type == EventType.KeyUp) { if (StdIn != null) { StdIn.Write((byte)Event.current.keyCode); } } Vector2 sizeOfCharacter = style.CalcSize(new GUIContent("M")); Vector2 kerningCheck = style.CalcSize(new GUIContent("MM")); float charWidth = kerningCheck.x - sizeOfCharacter.x; int max = Mathf.Min(Buffer.Count, Height + ScrollY); string text = GetGUIString(max); if (DisplayOntoGui) { float x = charWidth * (CursorX - ScrollX); float y = sizeOfCharacter.y * (CursorY - ScrollY); GUI.Label(new Rect(x, y, sizeOfCharacter.x, sizeOfCharacter.y), "<color=white>|</color>", style); GUI.Label(new Rect(0, 0, Screen.width, Screen.height), text, style); } else if (textMesh != null) { textMesh.text = text; } }
private void InputRun() { while (Running) { int input = InputStream.ReadByte(); if (input == '\r' || input == '\n') { string temp = InputBuffer + input; InputBuffer = ""; //if (StdIn.EchoStream) { UnityEngine.Debug.Log("Echoing input: " + temp); StdOut.Write(temp); } StdIn.Write(temp); } else if (input != '\0') { InputBuffer += input; } PushEvent(new InputEvent(KeyboardDown, input)); } }