Пример #1
0
 public void PostAwake()
 {
     MainMenuConsole.cs = this;
     this.tBlack        = TEX.GetTextureByName("black");
     this.OnResize();
 }
Пример #2
0
    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();
        }
    }
Пример #3
0
 public static void Command(string cmd)
 {
     MainMenuConsole.ParsingCommand(cmd);
 }