Exemple #1
0
        void txtMain_FocusGained(object sender, EventArgs e)
        {
            ConsoleChannel ch = channels[cmbMain.Text];

            if (ch != null)
            {
                txtMain.TextColor = ch.Color;
            }
        }
Exemple #2
0
        void ClientArea_Draw(object sender, DrawEventArgs e)
        {
            SpriteFont font = Skin.Layers[0].Text.Font.Resource;
            Rectangle  r    = new Rectangle(e.Rectangle.Left, e.Rectangle.Top, e.Rectangle.Width, e.Rectangle.Height);
            int        pos  = 0;

            if (buffer.Count > 0)
            {
                EventedList <ConsoleMessage> b = GetFilteredBuffer(filter);
                int c = b.Count;
                int s = (sbVert.Value + sbVert.PageSize);
                int f = s - sbVert.PageSize;

                if (b.Count > 0)
                {
                    for (int i = s - 1; i >= f; i--)
                    {
                        {
                            int x = 4;
                            int y = r.Bottom - (pos + 1) * ((int)font.LineSpacing + 0);

                            string         msg = ((ConsoleMessage)b[i]).Text;
                            string         pre = "";
                            ConsoleChannel ch  = (channels[((ConsoleMessage)b[i]).Channel] as ConsoleChannel);

                            if ((messageFormat & EConsoleMessageFormats.ChannelName) == EConsoleMessageFormats.ChannelName)
                            {
                                pre += string.Format("[{0}]", channels[((ConsoleMessage)b[i]).Channel].Name);
                            }
                            if ((messageFormat & EConsoleMessageFormats.TimeStamp) == EConsoleMessageFormats.TimeStamp)
                            {
                                pre = string.Format("[{0}]", ((ConsoleMessage)b[i]).Time.ToLongTimeString()) + pre;
                            }

                            if (pre != "")
                            {
                                msg = pre + ": " + msg;
                            }

                            e.Renderer.DrawString(font,
                                                  msg,
                                                  x, y,
                                                  ch.Color);
                            pos += 1;
                        }
                    }
                }
            }
        }
Exemple #3
0
        private void SendMessage(EventArgs x)
        {
            if (Manager.UseGuide && Guide.IsVisible)
            {
                return;
            }

            KeyEventArgs     k = new KeyEventArgs();
            GamePadEventArgs g = new GamePadEventArgs(PlayerIndex.One);

            if (x is KeyEventArgs)
            {
                k = x as KeyEventArgs;
            }
            else if (x is GamePadEventArgs)
            {
                g = x as GamePadEventArgs;
            }

            ConsoleChannel ch = channels[cmbMain.Text];

            if (ch != null)
            {
                txtMain.TextColor = ch.Color;

                string message = txtMain.Text;
                if ((k.Key == Microsoft.Xna.Framework.Input.Keys.Enter || g.Button == GamePadActions.Press) && message != null && message != "")
                {
                    x.Handled = true;

                    ConsoleMessageEventArgs me = new ConsoleMessageEventArgs(new ConsoleMessage(message, ch.Index));
                    OnMessageSent(me);

                    buffer.Add(new ConsoleMessage(me.Message.Text, me.Message.Channel));

                    txtMain.Text = "";
                    ClientArea.Invalidate();

                    CalcScrolling();
                }
            }
        }