예제 #1
0
        public override void Initialize()
        {
            m_SoundSettings = this.Game.Services.GetService(typeof(IGameSettings)) as ISoundSettings;
            createToggleSoundMenuItem(m_SoundSettings.IsMuted());
            createBackgroundMusicVolumeMenuItem();
            createSoundEffectsVolumeMenuItem();
            CreateDoneMenuItem();

            base.Initialize();
        }
예제 #2
0
        public override void Update(GameTime gameTime)
        {
            bool doUpdate = true;

            switch (this.State)
            {
            case eScreenState.Activating:
            case eScreenState.Deactivating:
            case eScreenState.Closing:
                UpdateTransition(gameTime);
                break;

            case eScreenState.Active:
                break;

            case eScreenState.Inactive:
            case eScreenState.Closed:
                doUpdate = false;
                break;

            default:
                break;
            }

            if (doUpdate)
            {
                base.Update(gameTime);

                ISoundSettings gameSettings = (this.Game.Services.GetService(typeof(IGameSettings)) as ISoundSettings);
                if (gameSettings != null)
                {
                    if (InputManager.KeyPressed(Keys.M))
                    {
                        gameSettings.SetIsMuted(!gameSettings.IsMuted());
                    }
                }

                if (PreviousScreen != null && !this.IsModal)
                {
                    PreviousScreen.Update(gameTime);
                }

                foreach (KeyValuePair <Keys, NamedAction> keyAndAction in m_ActivationKeys)
                {
                    if (InputManager.KeyPressed(keyAndAction.Key))
                    {
                        keyAndAction.Value.Action.Invoke();
                    }
                }
            }
        }