Exemple #1
0
    private void OnGUI()
    {
        if (global::Console.showfps)
        {
            this.DrawFPS();
        }
        if (!this.show)
        {
            return;
        }
        GUI.color = new Color(1f, 1f, 1f, 0.75f);
        if (this.tblack)
        {
            GUI.DrawTexture(this.rblack, this.tblack);
        }
        GUI.color = Color.white;
        float num = (float)Screen.height / 2f - 46f;

        for (int i = global::Console.log.Count - 1; i >= 0; i--)
        {
            GUI2.DrawText(new Rect(4f, num, (float)(Screen.width - 8), 24f), global::Console.log[i], TextAnchor.MiddleLeft, _Color.Gray, 0, 12, false);
            num -= 14f;
        }
        GUI2.DrawText(new Rect(0f, 0f, (float)(Screen.width - 4), 24f), "0.01a", TextAnchor.MiddleRight, _Color.White, 0, 16, true);
        GUI2.DrawEdit(new Rect(4f, (float)Screen.height / 2f - 28f, (float)(Screen.width - 8), 24f), ref this.command, TextAnchor.MiddleLeft, _Color.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_207;

            case KeyCode.KeypadEquals:
IL_1C3:
                if (keyCode == KeyCode.Return)
                {
                    goto IL_207;
                }
                if (keyCode != KeyCode.BackQuote && keyCode != KeyCode.F10)
                {
                    return;
                }
                this.command = string.Empty;
                this.SetActive(false);
                Event.current.Use();
                return;

            case KeyCode.UpArrow:
            {
                this.command = this.inputstore;
                TextEditor textEditor = (TextEditor)GUIUtility.GetStateObject(typeof(TextEditor), GUIUtility.keyboardControl);
                textEditor.selectIndex = this.command.Length + 1;
                textEditor.cursorIndex = this.command.Length + 1;
                return;
            }
            }
            goto IL_1C3;
IL_207:
            this.ParsingCommand(this.command);
            this.command = string.Empty;
            Event.current.Use();
        }
    }