コード例 #1
0
        /// <summary>
        /// calling when exit key pressed.
        /// </summary>
        public override void OnExit(int inputIndex)
        {
            MessageBoxScreen messageBox =
                new MessageBoxScreen("Are you sure you want to exit?");

            //  Register message box handle method
            messageBox.Accepted += ReturnToTitleAccepted;

            GameScreenManager.AddScreen(messageBox, true);


            //  Play the open menu sound
            GameSound.Play(SoundTrack.MenuClose);
        }
コード例 #2
0
        /// <summary>
        /// Moves to selected menu.
        /// </summary>
        /// <param name="inputIndex">an index of the input</param>
        /// <param name="verticalEntryIndex">
        /// a vertical index of selected entry
        /// </param>
        /// <param name="horizontalEntryIndex">
        /// a horizontal index of selected entry
        /// </param>
        public override void OnSelectedEntry(int inputIndex,
                                             int verticalEntryIndex,
                                             int horizontalEntryIndex)
        {
            //  It prevents more than one input.
            if (inputIndex != 0)
            {
                return;
            }

            if (ScreenState == ScreenState.Active)
            {
                //  If selected a start button, jump to the first stage screen
                if (verticalEntryIndex == 0)
                {
                    NextScreen            = new LoadingScreen();
                    NextScreen.NextScreen = new FirstStageScreen();

                    TransitionOffTime = TimeSpan.FromSeconds(1.0f);
                    ExitScreen();
                }
                //  If selected a versus button, jump to the versus ready screen
                else if (verticalEntryIndex == 1)
                {
                    NextScreen = new VersusReadyScreen();

                    TransitionOffTime = TimeSpan.FromSeconds(1.0f);
                    ExitScreen();
                }
                //  If selected a exit button, exit the program
                else if (verticalEntryIndex == 2)
                {
                    // Allows the default game to exit on Xbox 360 and Windows
                    MessageBoxScreen messageBox =
                        new MessageBoxScreen("Are you sure you want to exit?");

                    //  Register message box handle method
                    messageBox.Accepted += RobotGameGame.ExitAccepted;

                    GameScreenManager.AddScreen(messageBox, true);
                }

                //  Play the select sound
                GameSound.Play(SoundTrack.MenuClose);
            }
        }
コード例 #3
0
        /// <summary>
        /// is called when the exit button is pressed.
        /// </summary>
        public override void OnExit(int inputIndex)
        {
            if (!this.IsActive)
            {
                return;
            }

            MessageBoxScreen messageBox =
                new MessageBoxScreen("Are you sure you want to exit?");

            //  Set to message box handle method
            messageBox.Accepted += RobotGameGame.ExitAccepted;

            GameScreenManager.AddScreen(messageBox, true);

            //  Play the select sound
            GameSound.Play(SoundTrack.MenuClose);
        }
コード例 #4
0
ファイル: MainMenuScreen.cs プロジェクト: GodLesZ/svn-dump
        /// <summary>
        /// is called when the exit button is pressed.
        /// </summary>
        public override void OnExit(int inputIndex)
        {
            if (!this.IsActive) return;

            MessageBoxScreen messageBox = 
                new MessageBoxScreen("Are you sure you want to exit?");

            //  Set to message box handle method
            messageBox.Accepted += RobotGameGame.ExitAccepted;

            GameScreenManager.AddScreen(messageBox, true);

            //  Play the select sound
            GameSound.Play(SoundTrack.MenuClose);
        }
コード例 #5
0
ファイル: MainMenuScreen.cs プロジェクト: GodLesZ/svn-dump
        /// <summary>
        /// Moves to selected menu.
        /// </summary>
        /// <param name="inputIndex">an index of the input</param>
        /// <param name="verticalEntryIndex">
        /// a vertical index of selected entry
        /// </param>
        /// <param name="horizontalEntryIndex">
        /// a horizontal index of selected entry
        /// </param>
        public override void OnSelectedEntry(int inputIndex, 
                                             int verticalEntryIndex, 
                                             int horizontalEntryIndex)
        {
            //  It prevents more than one input.
            if (inputIndex != 0) return;

            if (ScreenState == ScreenState.Active)
            {
                //  If selected a start button, jump to the first stage screen
                if (verticalEntryIndex == 0)
                {
                    NextScreen = new LoadingScreen();
                    NextScreen.NextScreen = new FirstStageScreen();

                    TransitionOffTime = TimeSpan.FromSeconds(1.0f);
                    ExitScreen();
                }
                //  If selected a versus button, jump to the versus ready screen
                else if (verticalEntryIndex == 1)
                {
                    NextScreen = new VersusReadyScreen();

                    TransitionOffTime = TimeSpan.FromSeconds(1.0f);
                    ExitScreen();
                }
                //  If selected a exit button, exit the program
                else if (verticalEntryIndex == 2)
                {
                    // Allows the default game to exit on Xbox 360 and Windows
                    MessageBoxScreen messageBox = 
                        new MessageBoxScreen("Are you sure you want to exit?");

                    //  Register message box handle method
                    messageBox.Accepted += RobotGameGame.ExitAccepted;

                    GameScreenManager.AddScreen(messageBox, true);
                }

                //  Play the select sound
                GameSound.Play(SoundTrack.MenuClose);
            }
        }
コード例 #6
0
ファイル: BaseStageScreen.cs プロジェクト: GodLesZ/svn-dump
        /// <summary>
        /// checks the mission objective during game play and updates the player input 
        /// and  Hud information.
        /// </summary>
        /// <param name="gameTime"></param>
        /// <param name="otherScreenHasFocus"></param>
        /// <param name="coveredByOtherScreen"></param>
        public override void Update(GameTime gameTime, bool otherScreenHasFocus,
                                                       bool coveredByOtherScreen)
        {
            base.Update(gameTime, otherScreenHasFocus, false);

            bool updateScene = (IsActive || IsMissionClear || IsMissionFailed ||
                                IsFinishedVersus);

            bool playerInput = true;

            if (updateScene)
            {
                //  check current mission game state
                CheckMission(gameTime);

                //  If game is active, resume all sounds
                if (GameSound.IsPauseAll())
                    GameSound.ResumeAll();

                //  Updates tracer bullets
                if (tracerBulletManager != null)
                    tracerBulletManager.Update(gameTime);
            }
            else
            {
                //  If game is deactive, pause all sounds
                if (!GameSound.IsPauseAll())
                    GameSound.PauseAll();
            }

            //  Active ?
            if (IsActive)
            {
                FrameworkCore.GameEventManager.Enable = true;

                //  The camera follows to the player
                if (FrameworkCore.CurrentCamera.FirstCamera is FollowCamera)
                {
                    ViewCamera viewCamera = FrameworkCore.CurrentCamera;

                    for (int i = 0; i < viewCamera.Count; i++)
                    {
                        FollowCamera followCamera =
                                        viewCamera.GetCamera(i) as FollowCamera;

                        GamePlayer player = GameLevel.GetPlayerInLevel(i);

                        //  follows to player transform
                        followCamera.SetFollow(player.WorldTransform);
                    }
                }

                //  If completed this mission, player stop
                if (IsMissionClear || IsMissionFailed || IsFinishedVersus)
                    playerInput = false;

                //  The sky follows to current camera position
                if (RobotGameGame.CurrentGameLevel.GameSky != null)
                {
                    if (RobotGameGame.CurrentGameLevel.GameSky.FollowOwner)
                    {
                        RobotGameGame.CurrentGameLevel.GameSky.SetBasisPosition(
                            FrameworkCore.CurrentCamera.FirstCamera.Position);
                    }
                }
            }
            else
            {
                playerInput = false;

                FrameworkCore.GameEventManager.Enable = false;
            }

            //  input handle the player
            for (int i = 0; i < gameLevel.PlayerCountInLevel; i++)
            {
                GamePlayer player = GameLevel.GetPlayerInLevel(i);
                player.EnableHandleInput = playerInput;
            }

            //  Update 3D scene ?
            if (this.refScene3DRoot != null)
                this.refScene3DRoot.Enabled = updateScene;

            //  Update Hud scene ?
            if (this.refSceneHudRoot != null)
                this.refSceneHudRoot.Enabled = updateScene;

            //  Update Hud Information
            if (updateScene && GameLevel.SinglePlayer != null)
            {
                UpdateHud(gameTime);
            }

            if (ScreenState == ScreenState.Finished)
            {
                GameScreenManager.AddScreen(NextScreen, true);
            }

            // Allows the default game to exit on Xbox 360 and Windows
            if (IsActive && FrameworkCore.ScreenManager.SingleInput.PauseGame)
            {
                MessageBoxScreen messageBox = 
                    new MessageBoxScreen("Are you sure you want to exit?");

                //  Register message box handle method
                messageBox.Accepted += ReturnToTitleAccepted;

                GameScreenManager.AddScreen(messageBox, true);
            }

#if DEBUG
            camPosition.Text = string.Format("CAM : {0}", 
                FrameworkCore.CurrentCamera.FirstCamera.Position.ToString());
#endif
        }