Exemple #1
0
        private void DrawDebugInfo()
        {
            if (_debugFont == null)
            {
                _debugFont = Content.Load <SpriteFont>("Fonts/ConsoleFont");
            }

            if (_client != null)
            {
                var client  = _client;
                var session = client.Controller.Session;

                if (GraphsVisible)
                {
                    // Draw session info and netgraph.
                    var ngOffset = new Vector2(
                        GraphicsDevice.Viewport.Width - 240, GraphicsDevice.Viewport.Height - 180);
                    var sessionOffset = new Vector2(
                        GraphicsDevice.Viewport.Width - 370,
                        GraphicsDevice.Viewport.Height - 180);

                    SessionInfo.Draw("Client", session, sessionOffset, _debugFont, _spriteBatch);
                    NetGraph.Draw(session.Information, ngOffset, _debugFont, _spriteBatch);
                }
            }

            if (_server != null)
            {
                var server  = _server;
                var session = server.Controller.Session;

                if (GraphsVisible)
                {
                    // Draw session info and netgraph.
                    var ngOffset      = new Vector2(180, GraphicsDevice.Viewport.Height - 180);
                    var sessionOffset = new Vector2(60, GraphicsDevice.Viewport.Height - 180);

                    SessionInfo.Draw("Server", session, sessionOffset, _debugFont, _spriteBatch);
                    NetGraph.Draw(session.Information, ngOffset, _debugFont, _spriteBatch);
                }
            }
        }