Пример #1
0
        //
        // Zusammenfassung:
        //     Called when the DrawableGameComponent needs to be drawn.  Override this method
        //     with component-specific drawing code.
        //
        // Parameter:
        //   gameTime:
        //     Time passed since the last call to Microsoft.Xna.Framework.DrawableGameComponent.Draw(Microsoft.Xna.Framework.GameTime).
        public override void Draw(GameTime gameTime)
        {
            if (SpriteBatch != null)
            {
                SpriteBatch.Begin();

                if (scoring && prompt != null)
                {
                    prompt.Draw(gameTime, SpriteBatch);
                }
                #region Hauptmenü
                if (Visiblity)
                {
                    //if (Action)
                    {
                        foreach (MenupartDescription i in menuXml.MenuParts)
                        {
                            if (i.Name.Equals(CurrentMenu))
                            {
                                SpriteBatch.Draw(background, new Rectangle(0, 0,
                                                                           game.Graphics.Device.Viewport.Width, game.Graphics.Device.Viewport.Height),
                                                 Color.White);
                            }
                        }
                        CurrentList.Draw(gameTime, SpriteBatch);
                    }
                    SpriteBatch.DrawString(font, "Press F2 for using 3D mouse",
                                           new Vector2(10, game.Graphics.Device.Viewport.Height - 70), Color.White);
                    if (game.HasSpaceMouse)
                    {
                        SpriteBatch.Draw(red, new Rectangle(10, game.Graphics.Device.Viewport.Height - 35,
                                                            16, 16), Color.White);
                    }
                }
                #endregion

                else if (HighscoreMenu != null && HighscoreMenu.Visiblity)
                {
                    HighscoreMenu.Draw(gameTime, SpriteBatch);
                }
                else if (OptionMenu != null && OptionMenu.Visiblity)
                {
                    OptionMenu.Draw(gameTime, SpriteBatch);
                }
                if (prompt != null)
                {
                    prompt.Draw(gameTime, SpriteBatch);
                }

                /*if (Prompts.Count != 0)
                 * {
                 *  Prompts.Draw(gameTime, SpriteBatch);
                 * }*/
                SpriteBatch.Draw(mouse, MousePosition, Color.White);
                SpriteBatch.End();
            }
        }
Пример #2
0
        /// <summary>
        /// Called when the DrawableGameComponent needs to be drawn.  Override this method
        /// with component-specific drawing code.
        /// </summary>
        /// <parameters>
        /// gameTime:
        ///     Time passed since the last call to
        ///     Microsoft.Xna.Framework.DrawableGameComponent.Draw(Microsoft.Xna.Framework.GameTime).
        /// </parameters>
        public override void Draw(GameTime gameTime)
        {
            if (!Menü && CurrentProfil.OnlineQuestion)
            {
                if (SpriteBatch != null)
                {
                    SpriteBatch.Begin();
                    SpriteBatch.GraphicsDevice.Clear(Color.Black);
                    SpriteBatch.End();
                }
            }
            else
            {
                if (Visible)
                {
                    if (SpriteBatch != null)
                    {
                        SpriteBatch.Begin();
                        SpriteBatch.Draw(background, new Rectangle(0, 0,
                                                                   game.Graphics.Device.Viewport.Width, game.Graphics.Device.Viewport.Height),
                                         Color.White);
                        SpriteBatch.Draw(textback, BildXml.TextbackRec, Color.White);
                        SpriteBatch.Draw(buttonback, new Rectangle(game.Graphics.Device.Viewport.Width - 40
                                                                   - BildXml.ButtonBackRec.Width, BildXml.ButtonBackRec.Y, BildXml.ButtonBackRec.Width,
                                                                   BildXml.ButtonBackRec.Height), Color.White);

                        #region Draw Bars
                        switch (CurrentButton.getButtonName())
                        {
                        case "Erstellen":
                        {
                            SpriteBatch.Draw(buttonbackbarCreate, new Rectangle(game.Graphics.Device.Viewport.Width
                                                                                - 50 - BildXml.barRec.Width, BildXml.barRec.Y, BildXml.barRec.Width,
                                                                                BildXml.barRec.Height), Color.White);
                            break;
                        }

                        case "Löschen":
                        {
                            SpriteBatch.Draw(buttonbackbarDelete, new Rectangle(game.Graphics.Device.Viewport.Width
                                                                                - 50 - BildXml.barRec.Width, BildXml.barRec.Y, BildXml.barRec.Width,
                                                                                BildXml.barRec.Height), Color.White);
                            break;
                        }

                        case "Ok":
                        {
                            SpriteBatch.Draw(buttonbackbarOk, new Rectangle(game.Graphics.Device.Viewport.Width
                                                                            - 50 - BildXml.barRec.Width, BildXml.barRec.Y, BildXml.barRec.Width,
                                                                            BildXml.barRec.Height), Color.White);
                            break;
                        }

                        default:
                            break;
                        }
                        #endregion

                        CurrentList.Draw(gameTime, SpriteBatch);

                        #region Profilnamen und Marker

                        foreach (ProfilProperties j in ProfilXml)
                        {
                            if (j.ProfilNummer == CurrentNumber)
                            {
                                SpriteBatch.Draw(marker, new Rectangle(j.ActionrecX, j.ActionrecY, j.ActionrecWidth,
                                                                       j.ActionrecHeigth), Color.White);
                            }
                            SpriteBatch.DrawString(font, j.ProfilName, new Vector2(j.PositionX, j.PositionY),
                                                   Color.Black);
                        }

                        #endregion

                        SpriteBatch.DrawString(font, "Please select: ", new Vector2(50, 104), Color.Black);

                        #region Eingabe
                        if (Writing)
                        {
                            SpriteBatch.Draw(textfield, new Rectangle(game.Graphics.Device.Viewport.Width / 2 - textfield.Width / 2,
                                                                      game.Graphics.Device.Viewport.Height / 2 - textfield.Height / 2,
                                                                      textfield.Width, textfield.Height), Color.White);
                            if (!CurrentProfil.Active)
                            {
                                if (counter == 20)
                                {
                                    SpriteBatch.DrawString(font, "Please enter profilename:\n\n" + profilname,
                                                           new Vector2(game.Graphics.Device.Viewport.Width / 2 - textfield.Width / 2 + 30,
                                                                       game.Graphics.Device.Viewport.Height / 2 - textfield.Height / 2 + 40),
                                                           Color.White);
                                }
                                else
                                {
                                    SpriteBatch.DrawString(font, "Please enter profilename:\n\n" + profilname + "_",
                                                           new Vector2(game.Graphics.Device.Viewport.Width / 2 - textfield.Width / 2 + 30,
                                                                       game.Graphics.Device.Viewport.Height / 2 - textfield.Height / 2 + 40),
                                                           Color.White);
                                }
                            }
                            else
                            {
                                SpriteBatch.DrawString(font, "No changes to a existing \nprofile \n" +
                                                       "Press any Key to return...",
                                                       new Vector2(game.Graphics.Device.Viewport.Width / 2 - textfield.Width / 2 + 30,
                                                                   game.Graphics.Device.Viewport.Height / 2 - textfield.Height / 2 + 40),
                                                       Color.White);
                            }
                        }
                        #endregion
                        else if (question)
                        {
                            SpriteBatch.Draw(textfield, new Rectangle(game.Graphics.Device.Viewport.Width / 2 - textfield.Width / 2,
                                                                      game.Graphics.Device.Viewport.Height / 2 - textfield.Height / 2,
                                                                      textfield.Width, textfield.Height), Color.White);
                            if (counter == 1)
                            {
                                SpriteBatch.DrawString(font, "Would you like to send\n" +
                                                       "your score to the Online \nHighscore? (y - yes/n - no)\n" + answer,
                                                       new Vector2(game.Graphics.Device.Viewport.Width / 2 - textfield.Width / 2 + 30,
                                                                   game.Graphics.Device.Viewport.Height / 2 - textfield.Height / 2 + 40),
                                                       Color.White);
                            }
                            else
                            {
                                SpriteBatch.DrawString(font, "Would you like to send\n" +
                                                       "your score to the Online \nHighscore? (y - yes/n - no)\n" + answer + "_",
                                                       new Vector2(game.Graphics.Device.Viewport.Width / 2 - textfield.Width / 2 + 30,
                                                                   game.Graphics.Device.Viewport.Height / 2 - textfield.Height / 2 + 40),
                                                       Color.White);
                            }
                        }
                        else if (player)
                        {
                            SpriteBatch.Draw(textfield, new Rectangle(game.Graphics.Device.Viewport.Width / 2 - textfield.Width / 2,
                                                                      game.Graphics.Device.Viewport.Height / 2 - textfield.Height / 2,
                                                                      textfield.Width, textfield.Height), Color.White);
                            if (counter == 15)
                            {
                                SpriteBatch.DrawString(font, "Please insert playername\n\n" + pname,
                                                       new Vector2(game.Graphics.Device.Viewport.Width / 2 - textfield.Width / 2 + 30,
                                                                   game.Graphics.Device.Viewport.Height / 2 - textfield.Height / 2 + 40),
                                                       Color.White);
                            }
                            else
                            {
                                SpriteBatch.DrawString(font, "Please insert playername\n\n" + pname + "_",
                                                       new Vector2(game.Graphics.Device.Viewport.Width / 2 - textfield.Width / 2 + 30,
                                                                   game.Graphics.Device.Viewport.Height / 2 - textfield.Height / 2 + 40),
                                                       Color.White);
                            }
                        }
                        else if (Wahl)
                        {
                            SpriteBatch.Draw(textfield, new Rectangle(game.Graphics.Device.Viewport.Width / 2 - textfield.Width / 2,
                                                                      game.Graphics.Device.Viewport.Height / 2 - textfield.Height / 2,
                                                                      textfield.Width, textfield.Height), Color.White);
                            SpriteBatch.DrawString(font, "Please create a profile \nor select one.\n" +
                                                   "Press any Key to return...",
                                                   new Vector2(game.Graphics.Device.Viewport.Width / 2 - textfield.Width / 2 + 30,
                                                               game.Graphics.Device.Viewport.Height / 2 - textfield.Height / 2 + 40), Color.White);
                        }
                        else
                        {
                            SpriteBatch.Draw(mouse, MousePosition, Color.White);
                        }
                        SpriteBatch.End();
                    }
                }
            }
        }