예제 #1
0
        public void Draw(RTSWorld world, GameContext context, XnaGraphics graphics)
        {
            this.Update(world, context);

            graphics.DrawStringLeft(0, 0, world.ActiveLevel.GetType().Name);
            graphics.DrawStringLeft(0, 32, this.m_Tick.ToString());

            if (this.m_LastMousePoint.HasValue && this.m_CurrentMousePoint.HasValue)
            {
                graphics.DrawRectangle(this.m_LastMousePoint.Value, this.m_CurrentMousePoint.Value, Color.LimeGreen);
            }

            foreach (Unit u in this.Selected)
            {
                Rectangle bb = new Rectangle((int)u.X, (int)u.Y - 1, u.Width + 1, u.Height + 1);
                if (u.Team != null)
                {
                    graphics.DrawRectangle(bb, u.Team.Color);
                }
                else
                {
                    graphics.DrawRectangle(bb, Color.LimeGreen);
                }
            }

            // Draw chat.
            int a = 16;

            for (int i = this.m_ChatMessages.Count - 1; i >= Math.Max(this.m_ChatMessages.Count - 11, 0); i--)
            {
                if (i < this.m_ChatMessages.Count)
                {
                    graphics.DrawStringLeft(0, context.Graphics.GraphicsDevice.Viewport.Height - a, this.m_ChatMessages[i]);
                }
                a += 16;
            }

            // Draw graph.
            if (this.m_GraphFrames.Count > 1)
            {
                for (int i = 1; i < this.m_GraphFrames.Count; i++)
                {
                    graphics.DrawLine(i - 1, (float)this.m_GraphFrames[i - 1], i, (float)this.m_GraphFrames[i], 1, Color.Lime);
                }
            }

            // Add frame information.
            if (this.m_GraphFrames.Count > 200)
            {
                this.m_GraphFrames.RemoveAt(0);
            }
            this.m_GraphFrames.Add(context.GameTime.ElapsedGameTime.TotalMilliseconds);

            this.m_Tick++;
        }
예제 #2
0
        public static void Draw(GameContext context, RPGWorld world)
        {
            XnaGraphics g = new XnaGraphics(context);

            g.FillRectangle(new Rectangle(0, 0, 300, 200), Color.Black);
            g.DrawRectangle(new Rectangle(0, 0, 300, 200), Color.Gray);
            g.DrawStringLeft(20, 20, "Render targets used: " + RenderTargetFactory.RenderTargetsUsed);
            g.DrawStringLeft(20, 20 + 16, "Render targets memory: " + RenderTargetFactory.RenderTargetMemory / (1 * 1024 * 1024) + "MB");
            if (world != null)
            {
                TimeSpan ts = new TimeSpan((long)((RPGWorld.AUTOSAVE_LIMIT - world.m_AutoSave) / 60.0 * 10000000.0));
                g.DrawStringLeft(20, 20 + 32, "Autosave counter: " + ts.Minutes + "m" + ts.Seconds + "s");
            }
        }
예제 #3
0
        public override void DrawAbove(GameContext context)
        {
            // Are we waiting for players?
#if MULTIPLAYER
            if (this.m_GlobalSession.Waiting || (this.m_GlobalSession.LoadingInitialData && !LocalNode.Singleton.IsServer))
#else
            if (this.m_GlobalSession.Waiting)
#endif
            {
                XnaGraphics graphics = new XnaGraphics(context);
                graphics.FillRectangle(new Rectangle(0, 0, context.Graphics.GraphicsDevice.Viewport.Width, context.Graphics.GraphicsDevice.Viewport.Height), Color.Black);
                int dialogX = context.Graphics.GraphicsDevice.Viewport.X + context.Graphics.GraphicsDevice.Viewport.Width / 2 - 300;
                int dialogY = context.Graphics.GraphicsDevice.Viewport.Y + context.Graphics.GraphicsDevice.Viewport.Height / 2 - 200;
                graphics.FillRectangle(new Rectangle(dialogX, dialogY, 600, 400), Color.DarkSlateGray);
                graphics.DrawStringCentered(dialogX + 300, dialogY + 8, this.m_GlobalSession.LobbyMessage, "BigArial");
                graphics.DrawStringCentered(dialogX + 300, dialogY + 32, "Press enter to toggle ready status.");
                int a = 0;
                for (int i = 0; i < this.m_GlobalSession.Players.Count; i++)
                {
                    Player p = this.m_GlobalSession.Players[i];
                    if (p.Ready)
                    {
                        graphics.DrawStringLeft(dialogX + 8, dialogY + 48 + a * 16, "Player " + a + " (" + p.PlayerID + ") ready.");
                    }
                    else
                    {
                        graphics.DrawStringLeft(dialogX + 8, dialogY + 48 + a * 16, "Player " + a + " (" + p.PlayerID + ") not ready.");
                    }
                    a++;
                }
                return;
            }

            // Handle game normally.
            if (this.m_ActiveLevel != null)
            {
                this.m_ActiveLevel.DrawAbove(context);
            }
            this.m_UiManager.Draw(this, context, new XnaGraphics(context));
        }
예제 #4
0
        public override void DrawAbove(GameContext context)
        {
            XnaGraphics xna = new XnaGraphics(context);

            xna.DrawStringLeft(8, 8, "FPS: " + context.FPS, "Arial");

            // Draw UI.
            xna.DrawSprite(context.Camera.Width / 2 - xna.SpriteWidth("ui.frame") / 2,
                           context.Camera.Height - xna.SpriteHeight("ui.frame"),
                           "ui.frame");

            // Draw debug information.
            DebugTracker.Draw(context, this);
        }