Exemple #1
0
 public void Process(XnaGraphics xna, MouseState mouse)
 {
     if (this.m_PulseValue >= 1)
     {
         this.m_PulseModeUp = false;
     }
     else if (this.m_PulseValue <= 0)
     {
         this.m_PulseModeUp = true;
     }
     this.m_PulseValue += this.m_PulseModeUp ? 0.01 : -0.01;
     if (this.m_Area.Contains(mouse.X, mouse.Y))
     {
         if (mouse.LeftButton == ButtonState.Pressed)
         {
             this.m_IsDown = true;
         }
         if (this.m_IsDown && mouse.LeftButton != ButtonState.Pressed)
         {
             this.m_OnClick();
             this.m_IsDown = false;
         }
     }
     if (this.m_Area.Contains(mouse.X, mouse.Y))
     {
         xna.FillRectangle(this.m_Area, new Color(1f, 1f, 1f, 0.25f + (float)(this.m_PulseValue / 2.0)).ToPremultiplied());
     }
     else
     {
         xna.FillRectangle(this.m_Area, new Color(1f, 1f, 1f, 0.1f + (float)(this.m_PulseValue / 32.0)).ToPremultiplied());
     }
     xna.DrawStringCentered(this.m_Area.X + this.m_Area.Width / 2, this.m_Area.Y + 4, this.m_Text, "ButtonFont");
 }
Exemple #2
0
        public override void DrawAbove(GameContext context)
        {
            XnaGraphics xna = new XnaGraphics(context);

            xna.DrawStringCentered(context.ScreenBounds.Width / 2, 50, "Tychaia", "TitleFont");

            // TODO: Draw animation of player falling here.
            xna.DrawSprite(
                context.ScreenBounds.Width / 2,
                context.ScreenBounds.Height / 2,
                "chars.player.player");

            MouseState state = Mouse.GetState();

            foreach (TitleButton b in this.m_Buttons)
            {
                b.Process(xna, state);
            }

            /*xna.DrawStringCentered(
             *  context.ScreenBounds.Width / 2,
             *  context.ScreenBounds.Height - 50,
             *  "Using static seed: " + m_StaticSeed.ToString(),
             *  "Arial");*/

            // Draw debug information.
            //DebugTracker.Draw(context, null);
        }
Exemple #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));
        }