コード例 #1
0
        private void ReceiveScriptResponse(MsgScriptResponse message)
        {
            if (!_activeConsoles.TryGetValue(message.ScriptSession, out var console))
            {
                return;
            }

            console.ReceiveResponse(message);
        }
コード例 #2
0
            public void ReceiveResponse(MsgScriptResponse response)
            {
                RunButton.Disabled = false;

                // Remove > or . at the end of the output panel.
                OutputPanel.RemoveEntry(^ 1);
                _linesEntered += 1;

                if (!response.WasComplete)
                {
                    if (_linesEntered == 1)
                    {
                        OutputPanel.AddText($"> {_lastEnteredText}");
                    }
                    else
                    {
                        OutputPanel.AddText($". {_lastEnteredText}");
                    }

                    OutputPanel.AddText(".");
                    return;
                }

                // Remove echo of partial submission from the output panel.
                for (var i = 1; i < _linesEntered; i++)
                {
                    OutputPanel.RemoveEntry(^ 1);
                }

                _linesEntered = 0;

                // Echo entered script.
                var echoMessage = new FormattedMessage();

                echoMessage.PushColor(Color.FromHex("#D4D4D4"));
                echoMessage.AddText("> ");
                echoMessage.AddMessage(response.Echo);
                OutputPanel.AddMessage(echoMessage);

                OutputPanel.AddMessage(response.Response);

                OutputPanel.AddText(">");
            }