1 using System.Collections;
2 using System.Collections.Generic;
8 namespace AVR.UEditor.Core {
11 private string cmd_string =
"Enter Command...";
13 private int refocus = 0;
14 private int history = -1;
16 [MenuItem(
"AVR/Open DevConsole",
false, 100)]
24 if(mouseOverWindow ==
this)
return;
26 scrollPos =
new Vector2(scrollPos.x,
float.PositiveInfinity);
31 AVR_DevConsole.OnPrint -= (s) => ScrollToBottom();
32 AVR_DevConsole.OnPrint += (s) => ScrollToBottom();
42 GUILayout.BeginVertical();
45 GUIStyle sb =
new GUIStyle(GUI.skin.button);
46 sb.font = AVR_EditorUtility.GetFont(
"/editor/fonts/font-awesome");
49 string cog_symbol = AVR_EditorUtility.Unicode_to_String(
"f013");
50 if (GUILayout.Button(cog_symbol, sb, GUILayout.Width(25), GUILayout.Height(25)))
52 AVR_DevConsole.print(
"Settings Button doesnt do anything! :(");
58 GUIStyle s0 =
new GUIStyle(GUI.skin.textArea);
61 s0.alignment = TextAnchor.LowerLeft;
63 s0.font = AVR_EditorUtility.GetFont(
"/editor/fonts/inconsolata");
66 GUI.contentColor =
new Color(1f, 1f, 1f, 1f);
67 GUI.backgroundColor =
new Color(0.288f, 0.296f, 0.319f, 1f);
69 scrollPos = EditorGUILayout.BeginScrollView(scrollPos,
false,
true, GUILayout.Height(Screen.height - 85), GUILayout.Width(Screen.width - 10));
70 EditorGUILayout.TextArea(AVR_DevConsole.get_text(), s0, GUILayout.ExpandHeight(
true));
71 EditorGUILayout.EndScrollView();
74 GUI.backgroundColor =
new Color(0.088f, 0.096f, 0.019f, 1f);
75 GUI.SetNextControlName(
"InputField");
76 cmd_string = EditorGUILayout.TextField(cmd_string, s0, GUILayout.Height(20), GUILayout.Width(Screen.width - 10));
78 if(Event.current.type == EventType.KeyUp && Event.current.keyCode == KeyCode.Return) {
79 AVR_DevConsole.command(cmd_string);
85 GUIUtility.keyboardControl = 0;
93 if (Event.current.type == EventType.KeyUp && Event.current.keyCode == KeyCode.UpArrow)
96 cmd_string = AVR.Core.AVR_DevConsole.history(history);
97 GUIUtility.keyboardControl = 0;
105 GUI.FocusControl(
"InputField");
110 GUILayout.EndVertical();