Beispiel #1
0
    private void initDebug()
    {
        p_DebugLabel = (UILabel)addUI(new UILabel(this));
        p_DebugLabel.TextAlignment = TextAlign.Right;
        p_DebugLabel.ForeBrush     = Brushes.White;
        p_DebugLabel.Font          = new Font("Arial", 12, FontStyle.Bold);
        p_DebugLabel.Disable();

        p_DebugTextBox         = (UITextBox)addUI(new UITextBox(this));
        p_DebugTextBox.Visible = false;
        p_DebugTextBox.Text    = "";
        p_DebugTextBox.Font    = new Font("Arial", 20, FontStyle.Regular);
        p_DebugTextBox.Width   = 400;

        p_DebugTextBox.KeyDown += delegate(Game game, KeyEventArgs e) {
            if (e.KeyCode != Keys.Enter)
            {
                return;
            }

            p_DebugPrompt          = false;
            p_DebugTextBox.Visible = false;
            p_DebugTextBox.RemoveFocus();
            try { cmd(p_DebugTextBox.Text); }
            catch (Exception ex) {
                if (ex.Message == "Debug crash")
                {
                    throw ex;
                }
            }
            return;
        };
    }