public void PostAwake() { MainMenuConsole.cs = this; this.tBlack = TEX.GetTextureByName("black"); this.OnResize(); }
private void OnGUI() { if (!this.show) { return; } GUI.depth = -1; GUI.color = new Color(1f, 1f, 1f, 0.8f); if (this.tBlack) { GUI.DrawTexture(this.rBlack, this.tBlack); } GUI.color = Color.white; float num = (float)Screen.height / 2f - 46f; for (int i = MainMenuConsole.log.Count - 1; i >= 0; i--) { GUIM.DrawText(new Rect(4f, num, (float)(Screen.width - 8), 24f), MainMenuConsole.log[i], TextAnchor.MiddleLeft, BaseColor.Gray, 0, 12, false); num -= 14f; } GUIM.DrawText(new Rect(0f, 0f, (float)(Screen.width - 4), 24f), "[MENU CONSOLE]", TextAnchor.MiddleRight, BaseColor.White, 0, 16, true); GUIM.DrawEdit(new Rect(4f, (float)Screen.height / 2f - 28f, (float)(Screen.width - 8), 24f), ref MainMenuConsole.command, TextAnchor.MiddleLeft, BaseColor.White, 0, 16, true); char character = Event.current.character; if ((character < 'a' || character > 'z') && (character < 'A' || character > 'Z') && (character < '0' || character > '9') && character != ' ' && character != '_' && character != '.') { Event.current.character = '\0'; } if (Event.current.isKey) { KeyCode keyCode = Event.current.keyCode; switch (keyCode) { case KeyCode.KeypadEnter: goto IL_1FB; case KeyCode.KeypadEquals: IL_1B8: if (keyCode == KeyCode.Return) { goto IL_1FB; } if (keyCode != KeyCode.BackQuote && keyCode != KeyCode.F10) { return; } MainMenuConsole.command = string.Empty; this.SetActive(false); Event.current.Use(); return; case KeyCode.UpArrow: { MainMenuConsole.command = MainMenuConsole.inputstore; TextEditor textEditor = (TextEditor)GUIUtility.GetStateObject(typeof(TextEditor), GUIUtility.keyboardControl); textEditor.selectIndex = MainMenuConsole.command.Length + 1; textEditor.cursorIndex = MainMenuConsole.command.Length + 1; return; } } goto IL_1B8; IL_1FB: MainMenuConsole.ParsingCommand(MainMenuConsole.command); MainMenuConsole.command = string.Empty; Event.current.Use(); } }
public static void Command(string cmd) { MainMenuConsole.ParsingCommand(cmd); }