Beispiel #1
0
        private void Quit_OnSelected(object sender, EventArgs e)
        {
            var mbox = new MessageBoxScreen("Quit", "Are you sure you want to quit?", MessageBoxButtons.YesNo);

            mbox.OnYes += mbox_OnAccept;
            XnaDartsGame.ScreenManager.AddScreen(mbox);
        }
        /// <summary>
        /// Event handler for when the asynchronous find network sessions
        /// operation has completed.
        /// </summary>
        void FindSessionsOperationCompleted(object sender,
                                            OperationCompletedEventArgs e)
        {
            GameScreen nextScreen;

            try                     {
                // End the asynchronous find network sessions operation.
                AvailableNetworkSessionCollection availableSessions =
                    NetworkSession.EndFind(e.AsyncResult);

                if (availableSessions.Count == 0)
                {
                    // If we didn't find any sessions, display an error.
                    availableSessions.Dispose();

                    nextScreen = new MessageBoxScreen(Resources.NoSessionsFound, false);
                }
                else
                {
                    // If we did find some sessions, proceed to the JoinSessionScreen.
                    nextScreen = new JoinSessionScreen(availableSessions);
                }
            } catch (Exception exception) {
                nextScreen = new NetworkErrorScreen(exception);
            }

            ScreenManager.AddScreen(nextScreen, ControllingPlayer);
        }
Beispiel #3
0
        public override void CancelScreen()
        {
            var confirm = new MessageBoxScreen("Quit", "Are you sure you want to quit?", MessageBoxButtons.YesNo);

            confirm.OnYes += confirmQuit;
            XnaDartsGame.ScreenManager.AddScreen(confirm);
        }
Beispiel #4
0
        public void OpenPort()
        {
            if (_serialPort.IsOpen)
            {
                ClosePort();
            }

            try
            {
                _serialPort.Open();
            }
            catch (Exception ex)
            {
                var sb = new StringBuilder();

                sb.AppendLine("Could not establish a connection with the dart board:");
                sb.AppendLine("\"" + ex.Message + "\"");
                sb.AppendLine();
                sb.AppendLine("Please make sure that the dart board is connected and");
                sb.AppendLine("that the correct settings have been configured in the options.");

                var mb = new MessageBoxScreen("Error", sb.ToString(), MessageBoxButtons.Ok);

                var messageBoxTitle = ((TextBlock)mb.StackPanel.Items[0]);
                messageBoxTitle.Color = Color.Red;

                XnaDartsGame.ScreenManager.AddScreen(mb);
            }
        }
        /// <summary>
        /// Public method called when the user wants to leave the network session.
        /// Displays a confirmation message box, then disposes the session, removes
        /// the NetworkSessionComponent, and returns them to the main menu screen.
        /// </summary>
        public static void LeaveSession(ScreenManager screenManager,
                                        PlayerIndex playerIndex)
        {
            NetworkSessionComponent self = FindSessionComponent(screenManager.Game);

            if (self != null)
            {
                // Display a message box to confirm the user really wants to leave.
                string message;

                if (self.networkSession.IsHost)
                {
                    message = Resources.ConfirmEndSession;
                }
                else
                {
                    message = Resources.ConfirmLeaveSession;
                }

                MessageBoxScreen confirmMessageBox = new MessageBoxScreen(message);

                // Hook the messge box ok event to actually leave the session.
                confirmMessageBox.Accepted += delegate
                {
                    self.LeaveSession();
                };

                screenManager.AddScreen(confirmMessageBox, playerIndex);
            }
        }
Beispiel #6
0
        public override void HandleInput(InputState input)
        {
            if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed)
            {
                ScreenState = ScreenState.Pause;
                MessageBoxScreen alert = new MessageBoxScreen("ALERT");
                alert.ok.Selected += alertOk;
                ScreenManager.AddScreen(alert, null);
            }
            else
            {
                foreach (GestureSample gesture in input.Gestures)
                {
                    switch (gesture.GestureType)
                    {
                    case GestureType.Tap:
                    {
                        OnTouchUpEven(gesture);
                        System.Diagnostics.Debug.WriteLine("**点击事件:坐标为'{0},{1}'.", gesture.Position.X, gesture.Position.Y);
                    }
                    break;

                    //case :
                    //    break;
                    //case :
                    //    break;
                    default:
                        break;
                    }
                }
            }
        }
Beispiel #7
0
        public override void HandleInput(InputState input)
        {
            if (!IsActive)
            {
                return;
            }

            PlayerIndex playerIndex;

            if (input.IsNewButtonPress(Buttons.B, null, out playerIndex))
            {
                const string     message = "Are you sure you want to exit this game?";
                MessageBoxScreen confirmExitMessageBox = new MessageBoxScreen(message);
                confirmExitMessageBox.Accepted += ConfirmExitMessageBox_Accepted;
                ScreenManager.AddScreen(confirmExitMessageBox, playerIndex);
            }
            else if (input.IsNewButtonPress(Buttons.A, null, out playerIndex))
            {
                LoadingScreen.Load(
                    ScreenManager,
                    false,
                    playerIndex,
                    new SelectionScreen());
            }
        }
        public void ShowConfirmationWithText()
        {
            messageBoxScreen = MainScreen.ClickMessageBoxWithMessage();

            Assert.That(messageBoxScreen.Caption, Is.EqualTo(" "));
            Assert.That(messageBoxScreen.IsOKButtonVisible, Is.True);
            Assert.That(messageBoxScreen.IsCancelButtonVisible, Is.False);
        }
Beispiel #9
0
        private void clear_OnSelected(object sender, EventArgs e)
        {
            var mb = new MessageBoxScreen("Confirm", "Are you sure you want to clear all bindings?",
                                          MessageBoxButtons.YesNo);

            mb.OnYes += mbClear_OnYes;
            XnaDartsGame.ScreenManager.AddScreen(mb);
        }
        public void ShowConfirmationWithTextCaptionIconAndDefaultChoice()
        {
            messageBoxScreen = MainScreen.ClickMessageBoxWithDefaultResult();

            Assert.That(messageBoxScreen.Caption, Is.EqualTo("This Is The Caption"));
            Assert.That(messageBoxScreen.IsOKButtonVisible, Is.True);
            Assert.That(messageBoxScreen.IsCancelButtonVisible, Is.True);
        }
        public void ShowConfirmationWithTextCaptionAndOptionToCancel()
        {
            messageBoxScreen = MainScreen.ClickMessageBoxWithButtons();

            Assert.That(messageBoxScreen.Caption, Is.EqualTo("This Is The Caption"));
            Assert.That(messageBoxScreen.IsOKButtonVisible, Is.True);
            Assert.That(messageBoxScreen.IsCancelButtonVisible, Is.True);
        }
Beispiel #12
0
        void QuitMenuSelected(object?sender, PlayerIndexEventArgs e)
        {
            const string     message = "Are you sure you want to quit?\n\n";
            MessageBoxScreen dialog  = new MessageBoxScreen(ScreenManager, message);

            dialog.Accepted += new System.EventHandler <PlayerIndexEventArgs>((object?sender, PlayerIndexEventArgs e) => { Game.Exit(); });
            ScreenManager.AddScreen(dialog, null);
        }
Beispiel #13
0
        protected void OnExit(object sender, ClickEventArgs e)
        {
            const string message = "Are you sure you want to exit?";
            var          confirmExitMessageBox = new MessageBoxScreen(message);

            confirmExitMessageBox.OnSelect += ConfirmExitMessageBoxAccepted;
            ScreenManager.AddScreen(confirmExitMessageBox, e.PlayerIndex);
        }
Beispiel #14
0
        private void Unthrow_OnSelected(object sender, EventArgs e)
        {
            var confirm = new MessageBoxScreen("Confirm", "Are you sure you want to remove\nthe last thrown dart?",
                                               MessageBoxButtons.YesNo);

            confirm.OnYes += ConfirmUnthrow_OnAccept;
            XnaDartsGame.ScreenManager.AddScreen(confirm);
        }
Beispiel #15
0
        private void QuitGameMenuEntrySelected(object sender, PlayerIndexEventArgs e)
        {
            const string message = "Are you sure you want to quit this game?";
            var          confirmQuitMessageBox = new MessageBoxScreen(message);

            confirmQuitMessageBox.Accepted += ConfirmQuitMessageBoxAccepted;

            ScreenManager.AddScreen(confirmQuitMessageBox, ControllingPlayer);
        }
Beispiel #16
0
        protected override void OnCancel(PlayerIndex playerIndex)
        {
            const string message = "Are you sure you want to exit this sample?";
            var          confirmExitMessageBox = new MessageBoxScreen(message);

            confirmExitMessageBox.Accepted += ConfirmExitMessageBoxAccepted;

            ScreenManager.AddScreen(confirmExitMessageBox, playerIndex);
        }
        protected override void OnCancel(PlayerIndex playerIndex)
        {
            const string message = "Çýkmak istediðinize emin misiniz?";

            MessageBoxScreen confirmExitMessageBox = new MessageBoxScreen(message);

            confirmExitMessageBox.Accepted += ConfirmExitMessageBoxAccepted;

            ScreenManager.AddScreen(confirmExitMessageBox, playerIndex);
        }
        /// <summary>
        /// Event handler for when the Quit Game menu entry is selected.
        /// </summary>
        private void QuitGameMenuEntrySelected(object sender, PlayerIndexEventArgs e)
        {
            const string MESSAGE = "Are you sure you want to quit this game?";

            MessageBoxScreen confirmQuitMessageBox = new MessageBoxScreen(MESSAGE);

            confirmQuitMessageBox.Accepted += this.ConfirmQuitMessageBoxAccepted;

            this.ScreenManager.AddScreen(confirmQuitMessageBox, this.ControllingPlayer);
        }
Beispiel #19
0
        /// <summary>
        /// When the user cancels the main menu, ask if they want to exit the sample.
        /// </summary>
        protected override void OnCancel(PlayerIndex playerIndex)
        {
            const string message = "Do you want to quit this game ?";

            var confirmExitMessageBox = new MessageBoxScreen(message);

            confirmExitMessageBox.Accepted += ConfirmExitMessageBoxAccepted;

            ScreenManager.AddScreen(confirmExitMessageBox, playerIndex);
        }
Beispiel #20
0
        public void ShowConfirmationWithTextAndCaption()
        {
            messageBoxScreen = MainScreen.ClickMessageBoxWithCaption();

            Assert.That(messageBoxScreen.Caption, Is.EqualTo("This Is The Caption"));
            Assert.That(messageBoxScreen.Message, Is.EqualTo("This is the text."));
            Assert.That(messageBoxScreen.IsIconVisible, Is.False);
            Assert.That(messageBoxScreen.IsOKButtonVisible, Is.True);
            Assert.That(messageBoxScreen.IsCancelButtonVisible, Is.False);
        }
Beispiel #21
0
        /// <summary>
        /// When the user cancels the main menu, ask if they want to exit the sample.
        /// </summary>
        protected override void OnCancel(object sender, EventArgs e)
        {
            const string message = "Are you sure you want to exit this sample?";

            MessageBoxScreen confirmExitMessageBox = new MessageBoxScreen(message);

            confirmExitMessageBox.Accepted += ConfirmExitMessageBoxAccepted;

            ScreenManager.AddScreen(confirmExitMessageBox, PlayerIndex.One);
        }
Beispiel #22
0
        /// <summary>
        /// Event handler for when the Quit Game menu entry is selected.
        /// </summary>
        void QuitGameMenuEntrySelected(object sender, PlayerIndexEventArgs e)
        {
            const string message = "You are about to exit the game\n" + "     ...are you sure?";

            MessageBoxScreen confirmQuitMessageBox = new MessageBoxScreen(message);

            confirmQuitMessageBox.Accepted += ConfirmQuitMessageBoxAccepted;

            ScreenManager.AddScreen(confirmQuitMessageBox, ControllingPlayer);
        }
Beispiel #23
0
        void ExitGameEntrySelected(object sender, PlayerIndexEventArgs e)
        {
            const string message = "Are you sure you want to exit this sample?";

            MessageBoxScreen confirmExitMessageBox = new MessageBoxScreen(message);

            confirmExitMessageBox.Accepted += ConfirmExitMessageBoxAccepted;

            ScreenManager.AddScreen(confirmExitMessageBox, e.PlayerIndex);
        }
Beispiel #24
0
        /// <summary>
        /// Event handler for when the Quit Game menu entry is selected.
        /// </summary>
        void QuitGameMenuEntrySelected(object sender, PlayerIndexEventArgs e)
        {
            const string message = "Paused\n\nAre you sure you want to quit this game?\n";

            MessageBoxScreen confirmQuitMessageBox = new MessageBoxScreen(message, this.Scale);

            confirmQuitMessageBox.Accepted += ConfirmQuitMessageBoxAccepted;

            ScreenManager.AddScreen(confirmQuitMessageBox, ControllingPlayer);
        }
        /// <summary>
        /// Event handler for when the Quit Game menu entry is selected.
        /// </summary>
        void QuitGameMenuEntrySelected(object sender, PlayerIndexEventArgs e)
        {
            const string message = "You are about to exit the game\n"+"     ...are you sure?";

            MessageBoxScreen confirmQuitMessageBox = new MessageBoxScreen(message);

            confirmQuitMessageBox.Accepted += ConfirmQuitMessageBoxAccepted;

            ScreenManager.AddScreen(confirmQuitMessageBox, ControllingPlayer);
        }
Beispiel #26
0
        /// <summary>
        /// When the user cancels the main menu, ask if they want to exit the sample.
        /// </summary>
        protected override void OnCancel(PlayerIndex playerIndex)
        {
            const string message = "Are you sure you want to exit this sample?";

            MessageBoxScreen confirmExitMessageBox = new MessageBoxScreen(message);

            confirmExitMessageBox.Accepted += ConfirmExitMessageBoxAccepted;

            ScreenManager.AddScreen(confirmExitMessageBox, playerIndex);
        }
        /// <summary>
        /// Event handler for when the Quit Game menu entry is selected.
        /// </summary>
        void QuitGameMenuEntrySelected(object sender, PlayerIndexEventArgs e)
        {
            const string message = "Are you sure you want to quit this game?";

            MessageBoxScreen confirmQuitMessageBox = new MessageBoxScreen(message);

            confirmQuitMessageBox.Accepted += ConfirmQuitMessageBoxAccepted;

            ScreenManager.AddScreen(confirmQuitMessageBox, ControllingPlayer);
        }
Beispiel #28
0
        // Event handler for when the Quit Game menu entry is selected.
        void QuitGameMenuEntrySelected(object sender, EventArgs e)
        {
            const string     message = "Are you sure you want to exit the demo?";
            MessageBoxScreen confirmQuitMessageBox = new MessageBoxScreen(message);

            confirmQuitMessageBox.Accepted += ConfirmQuitMessageBoxAccepted;
            ScreenManager.AddScreen(confirmQuitMessageBox);

            //playing the sound
            SoundEngine.Play2D("OkClick", Global.SpeakerVolume / 10, false);
        }
        private async void EnjoyingGame(object sender, ClickEventArgs e)
        {
            var rateMsg = new MessageBoxScreen($"How about a rating on the app store?", string.Empty)
            {
                OkText     = "Ok!",
                CancelText = "No Thanks",
            };

            rateMsg.OnSelect += OkRating;
            await ScreenManager.AddScreen(rateMsg);
        }
        private async void NotEnjoyingGame(object sender, ClickEventArgs e)
        {
            var rateMsg = new MessageBoxScreen($"Would you mind giving us some feedback?", string.Empty)
            {
                OkText     = "Ok!",
                CancelText = "No Thanks",
            };

            rateMsg.OnSelect += OkFeedback;
            await ScreenManager.AddScreen(rateMsg);
        }
Beispiel #31
0
        /// <summary>
        /// Event handler for when the 3D play game option is selected.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        void PlayGame3DMenuEntrySelected(object sender, PlayerIndexEventArgs e)
        {
            MessageBoxScreen dimensionWarningBox = new MessageBoxScreen("Sorry! 3D Mode coming soon!");
            dimensionWarningBox.Accepted += WarningBoxAccepted;
            ScreenManager.AddScreen(dimensionWarningBox, null);

            /*
            foreach (GameScreen screen in ScreenManager.GetScreens())
                screen.ExitScreen();
            ScreenManager.AddScreen(new GameplayScreen(3), null);
             */
        }
        public async Task AskForRating()
        {
            var rateMsg = new MessageBoxScreen($"Are you enjoying {GameName}?", string.Empty)
            {
                OkText     = "Yes!",
                CancelText = "Not Really",
            };

            rateMsg.OnSelect += EnjoyingGame;
            rateMsg.OnCancel += NotEnjoyingGame;
            await ScreenManager.AddScreen(rateMsg);
        }
        /// <summary>
        /// LIVE networking is not supported in trial mode. Rather than just giving
        /// the user an error, this function asks if they want to purchase the full
        /// game, then takes them to Marketplace where they can do that. Once the
        /// Guide is active, the user can either make the purchase, or cancel it.
        /// When the Guide closes, ProfileSignInScreen.Update will notice that
        /// Guide.IsVisible has gone back to false, at which point it will check if
        /// the game is still in trial mode, and either exit the screen or proceed
        /// forward accordingly.
        /// </summary>
        void ShowMarketplace()
        {
            MessageBoxScreen confirmMarketplaceMessageBox =
                new MessageBoxScreen("Marketplace");

            confirmMarketplaceMessageBox.Accepted += delegate
            {
                Guide.ShowMarketplace(ControllingPlayer.Value);
            };

            ScreenManager.AddScreen(confirmMarketplaceMessageBox, ControllingPlayer);
        }
Beispiel #34
0
 private void showOptionsSaveResult()
 {
     if (XnaDartsGame.Options.Save())
     {
         var mb = new MessageBoxScreen("Options saved to file: " + Options.OptionsFilename + "!", string.Empty,
                                       MessageBoxButtons.Ok);
         XnaDartsGame.ScreenManager.AddScreen(mb);
     }
     else
     {
         var mb = new MessageBoxScreen("Error", "Options could not be saved!", MessageBoxButtons.Ok);
         XnaDartsGame.ScreenManager.AddScreen(mb);
     }
 }
        public override void HandleInput(InputState input)
        {
            if (this.IsActive)
            {
                PlayerIndex playerIndex;

                if (input.IsNewButtonPress(Buttons.A, this.ControllingPlayer, out playerIndex) ||
                    input.IsNewButtonPress(Buttons.Start, this.ControllingPlayer, out playerIndex))
                {
                    if (m_uiControlManager.CurrentControl == m_actionSelector)
                    {
                        switch (m_actionSelector.SelectedValue)
                        {
                        case "Play":
                            LoadingScreen.Load(
                                this.ScreenManager,
                                true,
                                playerIndex,
                                new RacingScreen());
                            break;

                        case "Exit":
                            const string     message = "Are you sure you want to exit this game?";
                            MessageBoxScreen confirmExitMessageBox = new MessageBoxScreen(message);
                            confirmExitMessageBox.Accepted += ConfirmExitMessageBox_Accepted;
                            ScreenManager.AddScreen(confirmExitMessageBox, playerIndex);
                            break;

                        case "Credits":
                            this.ScreenManager.AddScreen(new CreditsScreen(), playerIndex);
                            break;
                        }
                    }
                    else
                    {
                        LoadingScreen.Load(
                            this.ScreenManager,
                            true,
                            playerIndex,
                            new RacingScreen());
                    }
                }
                else
                {
                    m_uiControlManager.HandleInput(input);
                }
            }

            base.HandleInput(input);
        }
        /// <summary>
        /// Evento para quando for escolhido sair do game
        /// </summary>
        void QuitGameMenuEntrySelected(object sender, PlayerIndexEventArgs e)
        {
            // Mensagem que será colocada na tela
            string message = "Confirmar a Saída?";

            // Instância de tela popup (message box)
            MessageBoxScreen confirmQuitMessageBox = new MessageBoxScreen(message, false);

            // Cria o evento para confirmar a saída
            confirmQuitMessageBox.Accepted += ConfirmQuitMessageBoxAccepted;

            // Adiciona a entrada(item) à coleção do gerenciador de telas
            this.ScreenManager.AddScreen(confirmQuitMessageBox, this.ControllingPlayer);
        }
Beispiel #37
0
 private void back_OnSelected(object sender, EventArgs e)
 {
     if (_hasMadeChanges)
     {
         var mb = new MessageBoxScreen("Confirm", "Do you want to save the changes?",
                                       MessageBoxButtons.YesNoCancel);
         mb.OnYes += mb_OnYes;
         mb.OnNo  += mb_OnNo;
         XnaDartsGame.ScreenManager.AddScreen(mb);
     }
     else
     {
         base.CancelScreen();
     }
 }
Beispiel #38
0
 /// <summary>
 /// Event handler for when the user selects ok on the "Connect to IP: " message box.
 /// </summary>
 void ConfirmConnectMessageBox( object sender, PlayerIndexEventArgs e )
 {
     if ( JoinServerGame ( ) )
     {
         LoadingScreen.Load ( ScreenManager, true, e.PlayerIndex,
                            new GamePlayScreen ( ) );
     }
     else
     {
         MessageBoxScreen failedToConnectMessageBox = new MessageBoxScreen ( "Failed to connect." );
         failedToConnectMessageBox.Accepted += new EventHandler<PlayerIndexEventArgs> ( CloseFailedToConnectMessageBox );
         failedToConnectMessageBox.Cancelled += new EventHandler<PlayerIndexEventArgs> ( CloseFailedToConnectMessageBox );
         ScreenManager.AddScreen ( failedToConnectMessageBox,e.PlayerIndex );
     }
 }
Beispiel #39
0
 private void Unthrow_OnSelected(object sender, EventArgs e)
 {
     var confirm = new MessageBoxScreen("Confirm", "Are you sure you want to remove\nthe last thrown dart?",
         MessageBoxButtons.YesNo);
     confirm.OnYes += ConfirmUnthrow_OnAccept;
     XnaDartsGame.ScreenManager.AddScreen(confirm);
 }
Beispiel #40
0
 private void Quit_OnSelected(object sender, EventArgs e)
 {
     var mbox = new MessageBoxScreen("Quit", "Are you sure you want to quit?", MessageBoxButtons.YesNo);
     mbox.OnYes += mbox_OnAccept;
     XnaDartsGame.ScreenManager.AddScreen(mbox);
 }
        /// <summary>
        /// Lets the game respond to player input. Unlike the Update method,
        /// this will only be called when the gameplay screen is active.
        /// </summary>
        public override void HandleInput(InputState input)
        {
            if (input == null)
                throw new ArgumentNullException("input");
            if (InputManager.IsActionTriggered(InputManager.Action.ExitGame))
            {
                if (!IsExiting)
                {
                    if ((world != null) && !world.GameExited)
                    {
                        if (input.PauseGame && !world.GameWon)
                        {
                            // If they pressed pause, bring up the pause menu screen.
                            const string message = "Exit the game?";
                            MessageBoxScreen messageBox = new MessageBoxScreen(message,
                                false);
                            messageBox.Accepted += ExitMessageBoxAccepted;
                            ScreenManager.AddScreen(messageBox);
                        }
                        if (input.MenuSelect && world.GameWon)
                        {
                            world.GameExited = true;
                            world = null;
                            if (!IsExiting)
                            {
                                ExitScreen();
                            }
                            networkSession = null;
                        }
                    }
                }
            }
            if (InputManager.IsActionTriggered(InputManager.Action.ZoomIn))
            {

            }
        }
Beispiel #42
0
 public override void HandleInput(InputState input)
 {
     if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed)
     {
         ScreenState = ScreenState.Pause;
         MessageBoxScreen alert = new MessageBoxScreen("ALERT");
         alert.ok.Selected += alertOk;
         ScreenManager.AddScreen(alert, null);
     }
     else
     {
         foreach (GestureSample gesture in input.Gestures)
         {
             switch (gesture.GestureType)
             {
                 case GestureType.Tap:
                     {
                         OnTouchUpEven(gesture);
                         System.Diagnostics.Debug.WriteLine("**点击事件:坐标为'{0},{1}'.", gesture.Position.X, gesture.Position.Y);
                     }
                     break;
                 //case :
                 //    break;
                 //case :
                 //    break;
                 default:
                     break;
             }
         }
     }
 }
Beispiel #43
0
        /// <summary>
        ///   When the user cancels the main menu, ask if they want to exit the sample.
        /// </summary>
        protected override void OnCancel(PlayerIndex playerIndex)
        {
            var confirmExitMessageBox = new MessageBoxScreen(LR.ConfirmExit);

            confirmExitMessageBox.Accepted += ConfirmExitMessageBoxAccepted;

            ScreenManager.AddScreen(confirmExitMessageBox, playerIndex);
        }
Beispiel #44
0
 public override void CancelScreen()
 {
     var confirm = new MessageBoxScreen("Quit", "Are you sure you want to quit?", MessageBoxButtons.YesNo);
     confirm.OnYes += confirmQuit;
     XnaDartsGame.ScreenManager.AddScreen(confirm);
 }
Beispiel #45
0
        protected virtual void HandleGameOver()
        {
            XnaDartsGame.SoundManager.PlaySound(SoundCue.Won);

            var leaders = Mode.GetLeaders();

            var text = "Winner";

            if (leaders.Count > 1)
            {
                text = "Draw";
            }

            leaders.ForEach(p => text += " " + p.Name);

            var gameOverScreen = new MessageBoxScreen("Game Over", text, MessageBoxButtons.Ok);
            gameOverScreen.OnOk += delegate { pause(); };
            XnaDartsGame.ScreenManager.AddScreen(gameOverScreen);
        }
Beispiel #46
0
 private void back_OnSelected(object sender, EventArgs e)
 {
     if (_hasMadeChanges)
     {
         var mb = new MessageBoxScreen("Confirm", "Do you want to save the changes?",
             MessageBoxButtons.YesNoCancel);
         mb.OnYes += mb_OnYes;
         mb.OnNo += mb_OnNo;
         XnaDartsGame.ScreenManager.AddScreen(mb);
     }
     else
     {
         base.CancelScreen();
     }
 }
Beispiel #47
0
        /// <summary>
        /// Event handler for when the Play Game menu entry is selected.
        /// </summary>
        void PlayGameMenuEntrySelected(object sender, PlayerIndexEventArgs e)
        {
            StringBuilder sb = new StringBuilder();
            sb.Append("Connect to IP: ");
            sb.Append(Settings.Default.ServerIP);

            MessageBoxScreen confirmConnectMessageBox = new MessageBoxScreen ( sb.ToString() );

            confirmConnectMessageBox.Accepted += ConfirmConnectMessageBox;

            ScreenManager.AddScreen ( confirmConnectMessageBox, e.PlayerIndex );
        }
Beispiel #48
0
        void HowToPlayMenuEntrySelected(object sender, PlayerIndexEventArgs e)
        {
            const string msg2 = "Game Controls\n\n" +
                "Left Stick: Move\n" +
                "Right Stick: Aim\n" +
                "Y: Swap weapon\n" +
                "Right Trigger: Fire\n" +
                "Left Bumper: Reload\n" +
                "DPad Left: Buy weapons\n" +
                "DPad Right: Mod current weapon";
            MessageBoxScreen controlsMessageBox = new MessageBoxScreen(msg2, false);

            ScreenManager.AddScreen(controlsMessageBox, e.PlayerIndex);
        }
        void quitMenuEntry_Selected(object sender, PlayerIndexEventArgs e)
        {
            const string message = "Are you sure you want to exit?";

            var confirmExitMessageBox = new MessageBoxScreen(message);

            confirmExitMessageBox.Accepted += confirmExitMessageBox_Accepted;
            ScreenManager.AddScreen(confirmExitMessageBox, e.PlayerIndex);

        }
Beispiel #50
0
        public override void HandleInput(GameTime gameTime, InputState inputState)
        {
            KeyboardState keyboardState = inputState.CurrentKeyboardState;
            KeyboardState lastKeyboardState = inputState.LastKeyboardState;

            level.Update(gameTime, inputState);

            //Debug.WriteLine(level.Player.Position.X.ToString());

            if (keyboardState.IsKeyDown(Keys.Escape) && !lastKeyboardState.IsKeyDown(Keys.Escape))
            {
                MessageBoxScreen quitMsgBoxScreen = new MessageBoxScreen("Sure you want to quit?");
                quitMsgBoxScreen.Accepted += QuitAccepted;
                quitMsgBoxScreen.Cancelled += QuitCancelled;
                ScreenManager.AddScreen(quitMsgBoxScreen);
            }

            bool continuePressed = keyboardState.IsKeyDown(Keys.Space) || keyboardState.IsKeyDown(Keys.W) || keyboardState.IsKeyDown(Keys.Up)
                || inputState.IsLeftMouseButtonPressed();

            if (!wasContinuePressed && continuePressed)
            {
                if (!level.Player.IsAlive)
                    level.StartNewLife();
                else if (level.TimeRemaining == TimeSpan.Zero)
                {
                    if (level.ReachedExit)
                    {
                        ScreenManager.RemoveScreen(this);
                        MessageBoxScreen linkMsgBoxScreen = new MessageBoxScreen("If you wanna learn more about this topic:");
                        linkMsgBoxScreen.Link += LinkToWebPage;
                        ScreenManager.AddScreen(new BackgroundScreen());
                        ScreenManager.AddScreen(new MainMenuScreen());
                        ScreenManager.AddScreen(linkMsgBoxScreen);
                    }
                    else
                        ReloadCurrentLevel();
                }
            }
            wasContinuePressed = continuePressed;
        }
Beispiel #51
0
 private void clear_OnSelected(object sender, EventArgs e)
 {
     var mb = new MessageBoxScreen("Confirm", "Are you sure you want to clear all bindings?",
         MessageBoxButtons.YesNo);
     mb.OnYes += mbClear_OnYes;
     XnaDartsGame.ScreenManager.AddScreen(mb);
 }
Beispiel #52
0
        public override void HandleInput(InputState input)
        {
            if(input == null)
            {
                throw new ArgumentNullException("input");
            }

            if (input.IsPauseGame(ControllingPlayer))
            {
                MessageBoxScreen messageBox = new MessageBoxScreen("Would you like to quit?");
                messageBox.Accepted += QuitMessageBoxAccepted;
                ScreenManager.AddScreen(messageBox, ControllingPlayer);
            }

            if (input.IsSelectLeft(ControllingPlayer))
            {
                board.SelectLeft();
            }

            if (input.IsSelectRight(ControllingPlayer))
            {
                board.SelectRight();
            }

            if (input.IsSelectUp(ControllingPlayer))
            {
                board.SelectUp();
            }

            if (input.IsSelectDown(ControllingPlayer))
            {
                board.SelectDown();
            }

            if (input.IsSwapLeft(ControllingPlayer))
            {
                board.SwapLeft();

            }

            if (input.IsSwapRight(ControllingPlayer))
            {
                board.SwapRight();
                board.SwapLeft();
            }

            if (input.IsSwapUp(ControllingPlayer))
            {
                board.SwapUp();
            }

            if (input.IsSwapDown(ControllingPlayer))
            {
                board.SwapDown();
            }

            if (input.IsTurnLeft(ControllingPlayer))
            {
                camera.TurnBoard(Camera.ShiftState.Left);
            }

            if(input.IsTurnRight(ControllingPlayer) || input.IsTurnDefault(ControllingPlayer))
            {
                camera.TurnBoard(Camera.ShiftState.Right);
            }

            if (input.IsTurnUp(ControllingPlayer))
            {
                camera.TurnBoard(Camera.ShiftState.Up);
            }

            if (input.IsTurnDown(ControllingPlayer))
            {
                camera.TurnBoard(Camera.ShiftState.Down);
            }
        }