Exemplo n.º 1
0
        public void StateChanged(object sender, ModelStateEventArgs args)
        {
            switch (args.State)
            {
                case ModelState.NoRayExplored:
                    {
                        flyMessageControl1.AddMessage(
                            AppResources.NoRayExploredPromptText,
                            FlyMessageType.Prompt
                            );
                        gameBoardView.Accelerate();
                    }
                    break;

                case ModelState.MaxRaysExceed:
                    {
                        flyMessageControl1.AddMessage(
                            AppResources.MaxRaysExceedPromptText,
                            FlyMessageType.Prompt
                            );
                    }
                    break;

                case ModelState.LightBoxActivated:
                    {
                        App.SoundManager.Play(SoundType.LightboxActivated);
                    }
                    break;

                case ModelState.MaxMirrorsExceed: // fall through
                case ModelState.BlackBoxActivated: // fall through
                    break;

                case ModelState.GuessAdded:
                    {
                        App.SoundManager.Play(SoundType.GuessAdded);
                    }
                    break;

                case ModelState.GuessRemoved:
                    {
                        App.SoundManager.Play(SoundType.GuessRemoved);
                        guess.IsEnabled = false;
                    }
                    break;

                case ModelState.GuessCompleted:
                    {
                        guess.IsEnabled = true;
                    }
                    break;

                case ModelState.GuessTransferred:
                    {
                        App.SoundManager.Play(SoundType.GuessTransferred);
                    }
                    break;

                case ModelState.GuessSuccess:
                    {
                        ShowGuessSuccessMessage();
                        App.VibrateManager.Vibrate(VibrateManager.VibrateType.ShortVibrate);
                        App.SoundManager.Play(SoundType.GuessSuccess);
                    }
                    break;

                case ModelState.GuessFailed:
                    {
                        ShowGuessFailedMessage();
                        App.VibrateManager.Vibrate(VibrateManager.VibrateType.ShortVibrate);
                        App.SoundManager.Play(SoundType.GuessFailed);
                    }
                    break;

                case ModelState.RaysCreated:
                    {
                        limitedRaysControl1.CurrentRays += 1;
                    }
                    break;

                case ModelState.GameOver:
                    {
                        ShowGameOverMessage();
                        App.VibrateManager.Vibrate(VibrateManager.VibrateType.LongVibrate);
                        App.SoundManager.Play(SoundType.GameOver);
                        gameBoardView.Debunk();
                        debunk.IsEnabled = false;
                    }
                    break;

                default:
                    break;
            }
        }
Exemplo n.º 2
0
        public void StateChanged(object sender, ModelStateEventArgs args)
        {
            switch (args.State)
            {
            case ModelState.NoRayExplored:
            {
                flyMessageControl1.AddMessage(
                    "您需要先发射一束激光!", FlyMessageType.Prompt);

                gameBoardView.Accelerate();
            }
            break;

            case ModelState.MaxRaysExceed:
            {
            }
            break;

            case ModelState.LightBoxActivated:
            {
                App.SoundManager.Play(SoundType.LightboxActivated);
            }
            break;

            case ModelState.MaxMirrorsExceed:     // fall through
            case ModelState.BlackBoxActivated:    // fall through
                break;

            case ModelState.GuessAdded:
            {
                App.SoundManager.Play(SoundType.GuessAdded);
            }
            break;

            case ModelState.GuessRemoved:
            {
                App.SoundManager.Play(SoundType.GuessRemoved);
                guess.IsEnabled = false;
            }
            break;

            case ModelState.GuessCompleted:
            {
                guess.IsEnabled = true;
            }
            break;

            case ModelState.GuessTransferred:
            {
                App.SoundManager.Play(SoundType.GuessTransferred);
            }
            break;

            case ModelState.GuessSuccess:
            {
                App.VibrateManager.Vibrate(VibrateManager.VibrateType.ShortVibrate);
                App.SoundManager.Play(SoundType.GuessSuccess);
            }
            break;

            case ModelState.GuessFailed:
            {
                App.VibrateManager.Vibrate(VibrateManager.VibrateType.ShortVibrate);
                App.SoundManager.Play(SoundType.GuessFailed);
                if (App.Settings.GuessType == GuessType.AllAtOnce)
                {
                    flyMessageControl1.AddMessage(
                        string.Format("You guessed {0} mirrors.", args.Message),
                        FlyMessageType.Prompt
                        );
                }
            }
            break;

            case ModelState.RaysCreated:
            {
                limitedRaysControl1.CurrentRays += 1;
            }
            break;

            case ModelState.GameOver:
            {
                App.VibrateManager.Vibrate(VibrateManager.VibrateType.LongVibrate);
                App.SoundManager.Play(SoundType.GameOver);
                gameBoardView.Debunk();
                debunk.IsEnabled = false;
            }
            break;

            default:
                break;
            }
        }