예제 #1
0
 public void Init(ScreensManager screensManager, int id)
 {
     screenWidth         = Screen.width + 100;
     this.screensManager = screensManager;
     this.id             = id;
     gameObject.SetActive(false);
 }
예제 #2
0
        public override void Update(GameTime gameTime)
        {
            base.Update(gameTime);

            if (InputManager.KeyPressed(Keys.Enter))
            {
                ExitScreen();
            }

            if (InputManager.KeyPressed(Keys.M))
            {
                MainMenu mainMenu = new MainMenu(Game, m_TransitionionScreen, m_GameScreen);
                ScreensManager.SetCurrentScreen(mainMenu);
            }

            if (InputManager.KeyPressed(Keys.Escape))
            {
                this.Game.Exit();
            }

            if (this.TransitionPosition != 1 && this.TransitionPosition != 0)
            {
                m_Background.Alpha     = this.TransitionPosition;
                m_WelcomeMessage.Alpha = this.TransitionPosition;
            }
        }
예제 #3
0
        public override void Update(GameTime i_GameTime)
        {
            base.Update(i_GameTime);

            if (InputManager.KeyPressed(Keys.Enter))
            {
                r_Game.MenuMoveSound.Play();
                ExitScreen();
                ScreensManager.SetCurrentScreen(new PlayScreen(Game, 1));;
                ScreensManager.SetCurrentScreen(new LevelTransitionScreen(Game, 1));
            }

            if (InputManager.KeyPressed(Keys.Escape))
            {
                r_Game.MenuMoveSound.Play();
                this.Game.Exit();
            }

            if (InputManager.KeyPressed(Keys.M))
            {
                r_Game.MenuMoveSound.Play();
                ExitScreen();
                ScreensManager.SetCurrentScreen(new MainMenu(r_Game));
            }
        }
        private void toggleFullScreen(int i_PreferredHeight, int i_PreferredWidth)
        {
            ScreensManager screensManager = ScreensManager as ScreensManager;

            if (screensManager != null)
            {
                screensManager.GraphicsDeviceManager.ToggleFullScreen();
                if (m_IsFullScreen)
                {
                    screensManager.GraphicsDeviceManager.PreferredBackBufferHeight =
                        GraphicsAdapter.DefaultAdapter.CurrentDisplayMode.Height;
                    screensManager.GraphicsDeviceManager.PreferredBackBufferWidth =
                        GraphicsAdapter.DefaultAdapter.CurrentDisplayMode.Width;
                }
                else
                {
                    screensManager.GraphicsDeviceManager.PreferredBackBufferHeight =
                        i_PreferredHeight;
                    screensManager.GraphicsDeviceManager.PreferredBackBufferWidth =
                        i_PreferredWidth;
                }

                screensManager.GraphicsDeviceManager.IsFullScreen = m_IsFullScreen;
                screensManager.GraphicsDeviceManager.ApplyChanges();
            }
        }
예제 #5
0
        public override void Update(GameTime i_GameTime)
        {
            if (WasPlaySelected)
            {
                WasPlaySelected = false;
                ExitScreen();
            }

            if (InputManager != null)
            {
                if (InputManager.KeyboardState.IsKeyDown(Keys.Enter))
                {
                    ExitScreen();
                }

                if (InputManager.KeyboardState.IsKeyDown(Keys.Escape))
                {
                    Game.Exit();
                }

                InputManager inputManager = InputManager as InputManager;
                if (inputManager != null)
                {
                    if (InputManager.KeyboardState.IsKeyDown(Keys.M))
                    {
                        inputManager.Update(i_GameTime);
                        ScreensManager.SetCurrentScreen(new MainMenuScreen(Game));
                    }
                }

                base.Update(i_GameTime);
            }
        }
예제 #6
0
 /// <summary>
 /// StageScreen stage 1 constructor.
 /// </summary>
 /// <param name="i_ScreensManager">Screen manager.</param>
 /// <param name="i_AmountOfSpaceships">Amount of spaceships.</param>
 private StageScreen(ScreensManager i_ScreensManager, int i_AmountOfSpaceships)
     : this(i_ScreensManager, 1, new Spaceship[i_AmountOfSpaceships])
 {
     Enemy.ResetScores();
     Spaceship.ResetSpaceshipIDs();
     s_killedSpaceships = 0;
 }
예제 #7
0
 /// <summary>
 /// DisplaySettingsScreen constructor.
 /// </summary>
 /// <param name="i_ScreensManager">Screen manager.</param>
 public DisplaySettingsScreen(ScreensManager i_ScreensManager)
     : base(i_ScreensManager)
 {
     m_menuCollection.GetMenuLabelAt(0).ChangeText(string.Format("Allow Window Resizing: {0}", m_gameSettings.WindowResizing));
     m_menuCollection.GetMenuLabelAt(1).ChangeText(string.Format("Full Screen Mode: {0}", m_gameSettings.FullScreen));
     m_menuCollection.GetMenuLabelAt(2).ChangeText(string.Format("Mouse Visability: {0}", m_gameSettings.MouseVisibilty));
 }
예제 #8
0
        /// <summary>
        /// Selected label were chosed.
        /// </summary>
        /// <param name="i_GameTime"></param>
        private void selectionChosed(GameTime i_GameTime)
        {
            if (ScreenMode.HasFlag(eScreenMode.Running))
            {
                switch (m_menuCollection.Selected)
                {
                case 0:
                    DisplaySettingsScreen displaySettings = new DisplaySettingsScreen(ScreensManager);
                    ScreensManager.MoveTo(displaySettings);
                    break;

                case 2:
                    SoundSettingsScreen soundSettings = new SoundSettingsScreen(ScreensManager);
                    ScreensManager.MoveTo(soundSettings);
                    break;

                case 3:
                    GameScreen startGame = StageScreen.GetStages(ScreensManager);
                    ScreensManager.MoveTo(startGame);
                    break;

                case 4:
                    Close();
                    break;
                }

                if (m_menuCollection.Selected != 1)
                {
                    playSound();
                }
            }
        }
예제 #9
0
        private void checkInput(GameTime i_GameTime)
        {
            if (InputManager != null)
            {
                if (InputManager.KeyboardState.IsKeyDown(Keys.Enter))
                {
                    startNewGame();
                }

                if (InputManager.KeyboardState.IsKeyDown(Keys.Escape))
                {
                    Game.Exit();
                }

                if (InputManager.KeyboardState.IsKeyDown(Keys.M))
                {
                    InputManager inputManager = InputManager as InputManager;
                    if (inputManager != null)
                    {
                        inputManager.Update(i_GameTime);
                        ScreensManager.SetCurrentScreen(new MainMenuScreen(Game));
                    }
                }
            }
        }
예제 #10
0
        protected void done()
        {
            GameScreen previousScreen = ScreensManager.ActiveScreen.PreviousScreen;

            ScreensManager.Remove(ScreensManager.ActiveScreen);
            ScreensManager.SetCurrentScreen(previousScreen);
        }
예제 #11
0
        public override void Update(GameTime i_GameTime)
        {
            if (!m_IsGameInitialized)
            {
                m_IsGameInitialized = true;
                initializeGameManager();
            }

            if (m_Level != m_GameManager.Level)
            {
                m_Level = m_GameManager.Level;
                m_GameManager.PresetLevel();
            }

            SoundManager.CheckIfUserWantsToToggleSound(InputManager as InputManager, Keys.M);
            Enemy.HitRightWall = false;
            Enemy.HitLeftWall  = false;
            m_GameManager.AnalyzeEnemyBounds();
            if (InputManager.KeyboardState.IsKeyDown(Keys.P))
            {
                ScreensManager.SetCurrentScreen(new PauseScreen(Game));
            }

            checkIfGameIsOver();
            checkIfLevelEnded();
            base.Update(i_GameTime);
        }
예제 #12
0
        public override void Update(GameTime gameTime)
        {
            base.Update(gameTime);

            if (InputManager.KeyPressed(Keys.Escape))
            {
                this.Game.Exit();
            }
            if (InputManager.KeyPressed(Keys.Home))
            {
                ExitScreen();
                ScreensManager.SetCurrentScreen(new DummyGameScreen(Game));;
                ScreensManager.SetCurrentScreen(new PlayScreen(Game, 1));;
                ScreensManager.SetCurrentScreen(new LevelTransitionScreen(Game, 1));
                //r_Game.Components.Remove(this);
                //(r_Game as GameWithScreens).setScreenStackOnGameOver((r_Game as GameWithScreens).ScreensManager);
            }
            if (InputManager.KeyPressed(Keys.M))
            {
                ExitScreen();
                ScreensManager.SetCurrentScreen(new MainMenu(r_Game as GameWithScreens));

                //r_Game.Components.Remove(this);
                //(r_Game as GameWithScreens).setMainMenuStackOnGameOver((r_Game as GameWithScreens).ScreensManager);
            }
        }
		public void SetUp()
		{
			GameInfo gameInfo = new GameInfo();
			gameInfo.Mock();
			this.Manager = new ScreensManager(gameInfo);

			this.Screen1 = new Mock<Screen>("Screen1", ScreenType.Fullscreen);
			this.Screen1.Setup(s => s.OnInit());
			this.Screen1.Setup(s => s.OnDeinit());

			this.Screen2 = new Mock<Screen>("Screen2", ScreenType.Popup);
			this.Screen2.Setup(s => s.OnInit());
			this.Screen2.Setup(s => s.OnDeinit());

			this.Screen3 = new Mock<Screen>("Screen3", ScreenType.Normal);
			this.Screen3.Setup(s => s.OnInit());
			this.Screen3.Setup(s => s.OnDeinit());

			this.Screen4 = new Mock<Screen>("Screen4", ScreenType.Normal);
			this.Screen4.Setup(s => s.OnInit());
			this.Screen4.Setup(s => s.OnDeinit());

			this.Manager.Add(this.Screen1.Object);
			this.Manager.Add(this.Screen2.Object);
			this.Manager.Add(this.Screen3.Object);
			this.Manager.Add(this.Screen4.Object);

			this.ScreensList = new IScreen[]
			{
				this.Screen1.Object,
				this.Screen2.Object,
				this.Screen3.Object,
				this.Screen4.Object
			};
		}
예제 #14
0
 private void resetToMainMenu()
 {
     RemoveScores();
     SettingsManager.IsGoToMainMenu = true;
     ScreensManager.Push(new SpaceInvadersGameScreen(Game as GameStructure));
     ScreensManager.SetCurrentScreen(new WelcomeScreen(Game as GameStructure));
 }
        public override void Update(GameTime gameTime)
        {
            base.Update(gameTime);

            //if (InputManager.KeyPressed(Keys.Escape))
            //{
            //    m_Game.ExitGame();
            //}

            //if(InputManager.KeyPressed(Keys.H))
            //{
            //    ScreensManager.SetCurrentScreen(new MainMenuScreen(m_Game));
            //    Dispose();
            //    ExitScreen();
            //}
            TouchCollection touchCol = TouchPanel.GetState();

            foreach (var touch in touchCol)
            {
                if (InputManager.KeyPressed(Keys.R) || touch.State == TouchLocationState.Pressed)
                {
                    ScreensManager.SetCurrentScreen(new LevelTransitionScreen(m_Game));
                    Dispose();
                    ExitScreen();
                }
            }
        }
예제 #16
0
        /// <summary>
        /// Starting the game from the given stage screen.
        /// </summary>
        /// <param name="i_GameTime">Game Time.</param>
        private void startGame(GameTime i_GameTime)
        {
            ScreensManager.RootScreen = new MainMenuScreen(ScreensManager);
            KeyboardManager keyboardManager = ScreensManager.KeyboardManager;
            GameScreen      startTimer      = StageScreen.GetStages(ScreensManager);

            ScreensManager.MoveTo(startTimer);
        }
예제 #17
0
        private void onGameOver(object sender, EventArgs e)
        {
            string scoreText = sender as string;

            ScreensManager.SetCurrentScreen(new GameOverScreen(m_Game, scoreText));
            Dispose();
            ScreensManager.Remove(this);
        }
예제 #18
0
 private void onLevelCompleted()
 {
     m_LevelCompletedSoundEffect.Play();
     ExitScreen();
     m_GameSettings.GoToNextLevel();
     ScreensManager.SetCurrentScreen(new PlayScreen(Game, m_GameState));
     ScreensManager.SetCurrentScreen(new LevelTransitionScreen(Game, m_GameSettings.CurrentLevel));
 }
예제 #19
0
        /// <summary>
        /// Stages sequence creator.
        /// </summary>
        /// <param name="i_ScreensManager">Screen manager.</param>
        /// <param name="i_PlayersAmount">Players amount.</param>
        /// <returns></returns>
        public static GameScreen GetStages(ScreensManager i_ScreensManager)
        {
            StageScreen stage       = new StageScreen(i_ScreensManager, (int)i_ScreensManager.GameSettings.PlayersAmount);
            string      stageString = "Stage: 1";
            TimerScreen timerScreen = new TimerScreen(stage, 3, stageString);

            return(timerScreen);
        }
예제 #20
0
        private void onLevelWon(object sender, EventArgs e)
        {
            LevelTransitionScreen levelTransScreen = new LevelTransitionScreen(m_Game);

            ScreensManager.SetCurrentScreen(levelTransScreen);
            Dispose();
            ScreensManager.Remove(this);
        }
예제 #21
0
 public void GameWon()
 {
     this.State = eScreenState.Inactive;
     m_GameWonSound.Play();
     m_Level++;
     resetSpritesAndManagers();
     ScreensManager.SetCurrentScreen(new LevelTransitionScreeen(this.Game, m_Level));
 }
 private void ShowIntroAndStartLevel()
 {
     ScreensManager.SetCurrentScreen(new IntroToLevelScreen(Game as GameStructure)
     {
         HeadLine = string.Format("Level {0}", m_CurrentLevel), CountDown = 3
     });
     m_IsGameStarted = true;
     m_BackGroundMusic.Play();
 }
예제 #23
0
 public void ShowEndOfGameMessage(string i_GameOverMessage)
 {
     m_GameOverScreen.Message      = i_GameOverMessage;
     m_GameOverScreen.Player1Score =
         string.Format("Player 1 score is: {0}", m_Players[0].Score);
     m_GameOverScreen.Player2Score =
         string.Format("Player 2 score is: {0}", m_Players[1].Score);
     ScreensManager.SetCurrentScreen(m_GameOverScreen);
 }
예제 #24
0
 private void checkIfLevelEnded()
 {
     if (m_GameManager.LevelEnded())
     {
         killAll();
         m_GameManager.Level++;
         ScreensManager.SetCurrentScreen(new TransitionScreen(Game, m_GameManager.Level));
     }
 }
예제 #25
0
        public override void Update(GameTime gameTime)
        {
            base.Update(gameTime);

            if (InputManager.KeyPressed(k_PauseScreenKey))
            {
                ScreensManager.SetCurrentScreen(m_PauseScreen);
            }
        }
예제 #26
0
 public override void Update(GameTime i_GameTime)
 {
     base.Update(i_GameTime);
     if (InputManager.KeyPressed(Keys.R))
     {
         m_PreviousScreen.Enabled = true;
         ScreensManager.SetCurrentScreen(m_PreviousScreen);
     }
 }
예제 #27
0
        public override void Update(GameTime gameTime)
        {
            base.Update(gameTime);

            if (InputManager.KeyPressed(Keys.P) || GamePad.GetState(PlayerIndex.One).Buttons.Back ==
                ButtonState.Pressed)
            {
                ScreensManager.SetCurrentScreen(new PauseScreen(m_Game));
            }
        }
예제 #28
0
        public override void Update(GameTime i_GameTime)
        {
            base.Update(i_GameTime);

            if (InputManager.KeyPressed(Keys.P))
            {
                this.Enabled = false;
                ScreensManager.SetCurrentScreen(new PauseScreen(this.Game));
            }
        }
예제 #29
0
        public void upDataWorld()
        {
            WorldInfo world = GameManager.WorldInfo;

            GameManager.SaveProject(true, true);
            GameManager.DisposeProject();
            object[] expr_E9 = new object[2];
            expr_E9[0] = world;
            ScreensManager.SwitchScreen("GameLoading", expr_E9);
        }
예제 #30
0
 public override void Update(GameTime gameTime)
 {
     if (InputManager.KeyPressed(Keys.P))
     {
         ScreensManager.SetCurrentScreen(new PauseScreen(Game));
     }
     else
     {
         base.Update(gameTime);
     }
 }
예제 #31
0
 private void Awake()
 {
     if (instance == null)
     {
         instance = this;
     }
     else
     {
         Destroy(this);
     }
 }
예제 #32
0
 public SpaceInvaders()
 {
     m_Graphics = new GraphicsDeviceManager(this);
     m_Graphics.PreferredBackBufferWidth = k_ScreenWidth;
     m_Graphics.PreferredBackBufferHeight = k_ScreenHeight;
     m_Graphics.ApplyChanges();
     Content.RootDirectory = "Content";
     IInputManager inputManager = new InputManager(this);
     m_ScreensManager = new ScreensManager(this);
     m_ScreensManager.SetCurrentScreen(new WelcomeScreen(this));
 }