VR Development Framework
v 1.0.0
 All Classes Namespaces Functions Variables Enumerations Enumerator Properties Events Pages
void AVR.Core.AVR_BasicDevConsoleUI.OnGUI ( )
inlineprivate

Definition at line 48 of file AVR_BasicDevConsoleUI.cs.

49  {
50  if (Event.current.type == EventType.KeyDown && (Event.current.keyCode == toggleKey || Event.current.keyCode == offKey))
51  {
52  active = !active && Event.current.keyCode != offKey;
53  history = -1;
54  }
55  if(active) {
56  // We need check for submitKey *before* running FocusControl, or it wont work.
57  if (Event.current.type == EventType.KeyDown && Event.current.keyCode == submitKey) {
58  runCommand();
59  }
60  if(Event.current.type==EventType.KeyDown && Event.current.keyCode == KeyCode.UpArrow) {
61  history += 1;
62  cmd = AVR.Core.AVR_DevConsole.history(history);
63  }
64 
65  GUI.FocusControl("BasicDevConsoleUI_input");
66 
67  // Background box
68  style.normal.background = background;
69  GUI.Box(new Rect(position.x, position.y, size.x, size.y), "", style);
70 
71  // Content area
72  GUILayout.BeginArea(new Rect(position.x+10, position.y+10, size.x-20, size.y-20), style);
73 
74  // Console Output
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();
80 
81  // Command input and run button
82  GUILayout.BeginHorizontal(style);
83  GUI.SetNextControlName("BasicDevConsoleUI_input");
84  cmd = GUILayout.TextField(cmd, style);
85  if(GUILayout.Button("Run", style, GUILayout.Width(50))) {
86  runCommand();
87  }
88  GUILayout.EndHorizontal();
89 
90  GUILayout.EndArea();
91  }
92  }