Beispiel #1
0
        void restart()
        {
            youLoseSound.Play();
            deterministicGame.currentLevel.gameRestart = false;

            graphics.PreferredBackBufferHeight = 600;
            graphics.PreferredBackBufferWidth = 800;
            graphics.ApplyChanges();


            musicControl.Restart();


            // Make the game object.  The game is currently called 'DuckSlaughterGame'
            deterministicGame = new DuckSlaughterGame();
            deterministicGame.ResetGame(playerIdentifiers, playerIdentifiers[0]);
            deterministicGame.LoadContent(Content);
            deterministicGame.Initialize();

            // Debugging setup
            lastPressedKeys = new List<Keys>();
            activePlayer = playerIdentifiers[0];
            paused = false;
            gameStarted = false;


            //Added
            isHost = false;
            chatText = "";

            reader.Close();
            writer.Close();

            networkSession.Dispose();

            networkSession = null;

            reader = new PacketReader();
            writer = new PacketWriter();
            chatlines = 0;
            isChatting = false;
            mouseChange = false;
            buttonPressed = false;
            others = new player[4];
            update = true;
            gameStarted = false;

            inMenu = true;
            startS.Show();
            helpS.Hide();
            activeS = startS;
            releasedKeys = new List<Keys>();
        }
Beispiel #2
0
 /**
  * Start Screen input 
  */
 private void SSInput()
 {
     if (releasedKeys.Contains(Keys.Enter))
     {
         switch (startS.selectIndex)
         {
             case 0:
                 inMenu = false;
                 CreateGame();
                 beginGame();
                 break;
             case 1:
                 inMenu = false;
                 activeS.Hide();
                 //activeS.Show();
                 break;
             case 2:
                 activeS.Hide();
                 activeS = helpS;
                 activeS.Show();
                 break;
             case 3:
                 Exit();
                 break;
         }
     }
 }
Beispiel #3
0
 private void HSInput()
 {
     if (releasedKeys.Contains(Keys.Space) || releasedKeys.Contains(Keys.Enter) || releasedKeys.Contains(Keys.Escape))
     {
         activeS.Hide();
         activeS = startS;
         activeS.Show();
     }
 }
Beispiel #4
0
        /// <summary>
        /// LoadContent will be called once per game and is the place to load
        /// all of your content.
        /// </summary>
        protected override void LoadContent()
        {

            // Create a new SpriteBatch, which can be used to draw textures.

            spriteBatch = new SpriteBatch(GraphicsDevice);

            //Menu
            Services.AddService(typeof(SpriteBatch), spriteBatch);
            normalF = Content.Load<SpriteFont>("normal");
            titleF = Content.Load<SpriteFont>("title");

            back = Content.Load<Texture2D>("d1");
            startS = new Start(this, titleF, back, normalF);
            Components.Add(startS);

            back = Content.Load<Texture2D>("d4");
            helpS = new Help(this, back, titleF, normalF);
            Components.Add(helpS);

            youLoseSound = Content.Load<SoundEffect>("ds_lost");


            startS.Show();
            helpS.Hide();
            activeS = startS;



            //Background
            mainFrame = new Rectangle(0, 0, GraphicsDevice.Viewport.Width, GraphicsDevice.Viewport.Height);


            // Let the game load its content.

            background_lobby = Content.Load<Texture2D>("d3");

            font = Content.Load<SpriteFont>("InstructionFont");
            lobbyFont = Content.Load<SpriteFont>("Georgia");

            deterministicGame.LoadContent(Content);
        }