//--------------------------------------------------------------------------------------------------------------------------------------------------- // // Copyright (C)2007 DarkWynter Studios. All rights reserved. // //--------------------------------------------------------------------------------------------------------------------------------------------------- // {Contact : darkwynter.com for licensing information //--------------------------------------------------------------------------------------------------------------------------------------------------- namespace DarkWynter.Engine.Menus.GameScreens { #region Using Statements using System; using System.Collections.Generic; using System.Diagnostics; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Audio; using Microsoft.Xna.Framework.Content; using Microsoft.Xna.Framework.Graphics; using Microsoft.Xna.Framework.Input; using Microsoft.Xna.Framework.Storage; using System.Threading; using System.Xml; #endregion using DarkWynter.Stream; using DarkWynter.Engine; using DarkWynter.Engine.Controllers; using DarkWynter.Engine.Globals; using DarkWynter.Engine.ObjectLib; using DarkWynter.Engine.Menus; /// /// The Game Setup screen. /// public class GameSetup : GameScreen { private Texture2D storyModeTexture; private Texture2D deathMatchTexture; private Texture2D survivalTexture; private Texture2D lastmanTexture; /// /// Menu that allows the user to select from multiple game types. /// public GameSetup(Enums_Engine.EngineState GameEngineState) : base(GameEngineState) { // Instantiate the GameMenu menu = new GameMenu("Game Setup", 50, 100); menu.SetDrawMenuTitle(false); menu.AddLabel("Controls", Color.WhiteSmoke); menu.AddLabel(""); menu.AddLabel("Movement Keys", Color.IndianRed); menu.AddLabel("W - Walk forward", Color.IndianRed); menu.AddLabel("A - Walk left", Color.IndianRed); menu.AddLabel("S - Walk backwards", Color.IndianRed); menu.AddLabel("D - Walk right", Color.IndianRed); // menu.AddLabel("Space - Jump", Color.IndianRed); menu.AddLabel("Mouse - Camera", Color.IndianRed); menu.AddLabel(""); menu.AddLabel(""); menu.AddLabel("Press Enter to start the game", Color.LightGreen); deathMatchTexture = Statics_Engine.SystemSettings.content.Load("Content/_textures/WickedFlyGames"); SetBackground(deathMatchTexture, 0.5f ); } /// /// Check for updates to Game Setup menu. /// /// Current ObjectLibrary. public override void Update(ObjectLibrary objectLibrary) { base.Update(objectLibrary); } public override void Draw(SpriteBatch spriteBatch) { //base.Draw(spriteBatch); // First draw the background texture if it is not null if (backgroundTexture != null) { Vector2 backgroundLocation = new Vector2( Statics_Stream.RenderSettings.GAME_WINDOW_WIDTH / 2, Statics_Stream.RenderSettings.GAME_WINDOW_HEIGHT / 2); Vector2 backgroundOrigin = new Vector2(backgroundTexture.Width / 2, backgroundTexture.Height / 2); spriteBatch.Draw(backgroundTexture, backgroundLocation, null, Color.White, 0.0f, backgroundOrigin, new Vector2(1.0f, 1.0f), SpriteEffects.None, 1); } //now draw the menu elements menu.Draw(spriteBatch); } /// /// Method invoked when the start menu button has been pressed /// /// Object Library public override void MenuStart(ObjectLibrary objectLibrary) { GameSetupCommit(); base.MenuStart(objectLibrary); } /// /// Commit user selections. /// public void GameSetupCommit() { GameMenuOption option; // Text Option GameMenuValueInput value; // Numeric Option // Number of players Statics_Engine.GameSettings.numberOfHumansActive = 1; // Game Type Statics_Engine.GameSettings.gameType = Enums_Engine.GameType.DEATHMATCH; // Max number of kills to win Statics_Engine.GameSettings.maxNumberOfKills = 4; // Number of AI Bots Statics_Engine.GameSettings.botCount = 5; // Bot intelligence (1= dumb, 10= super smart) Statics_Engine.AISettings.AI_INTELLIGENCE = 8; } } }