1 using System.Collections;
2 using System.Collections.Generic;
13 public Color backgroundColor =
new Color(0.1f, 0.1f, 0.1f, 1.0f);
14 public Color textBackgroundColor =
new Color(0.07f, 0.07f, 0.07f, 1.0f);
15 public Vector2 position =
new Vector2(0, 0);
16 public Vector2 size =
new Vector2(820, 420);
24 private bool active =
false;
25 private int history = -1;
28 background =
new Texture2D(1, 1, TextureFormat.RGBAFloat,
false);
29 background.SetPixel(0, 0, backgroundColor);
32 textBackground =
new Texture2D(1, 1, TextureFormat.RGBAFloat,
false);
33 textBackground.SetPixel(0, 0, textBackgroundColor);
34 textBackground.Apply();
36 toggleKey = AVR.Core.AVR_Settings.get_key(
"/settings/core/devConsole/toggleConsoleKey");
37 offKey = AVR.Core.AVR_Settings.get_key(
"/settings/core/devConsole/disableConsoleKey");
38 submitKey = AVR.Core.AVR_Settings.get_key(
"/settings/core/devConsole/submitConsoleKey");
42 AVR.Core.AVR_DevConsole.command(cmd);
44 scrollPosition =
new Vector2(0,
float.PositiveInfinity);
50 if (Event.current.type == EventType.KeyDown && (Event.current.keyCode == toggleKey || Event.current.keyCode == offKey))
52 active = !active && Event.current.keyCode != offKey;
57 if (Event.current.type == EventType.KeyDown && Event.current.keyCode == submitKey) {
60 if(Event.current.type==EventType.KeyDown && Event.current.keyCode == KeyCode.UpArrow) {
62 cmd = AVR.Core.AVR_DevConsole.history(history);
65 GUI.FocusControl(
"BasicDevConsoleUI_input");
68 style.normal.background = background;
69 GUI.Box(
new Rect(position.x, position.y, size.x, size.y),
"", style);
72 GUILayout.BeginArea(
new Rect(position.x+10, position.y+10, size.x-20, size.y-20), style);
75 style.normal.background = textBackground;
76 scrollPosition = GUILayout.BeginScrollView(scrollPosition, style);
77 GUILayout.TextArea(AVR.Core.AVR_DevConsole.get_text(), style);
78 style.normal.background = background;
79 GUILayout.EndScrollView();
82 GUILayout.BeginHorizontal(style);
83 GUI.SetNextControlName(
"BasicDevConsoleUI_input");
84 cmd = GUILayout.TextField(cmd, style);
85 if(GUILayout.Button(
"Run", style, GUILayout.Width(50))) {
88 GUILayout.EndHorizontal();
Monobehaviour but with an added URL button to a documentation page.
Sets the documentation html file inside of Packages/com.avr.core/Documentation/html of a given class...
A rudimentary UI version of the AVR_DevConsole. If you wish to implement a better one...