public override void Update(GameTime gameTime)
{
ControlManager.Update(gameTime, PlayerIndex.One);
if (InputHandler.PressedCancel())
StateManager.ChangeState(GameRef.TitleScreen);
if (InputHandler.PressedUp())
{
_menuIndex--;
if (_menuIndex < 0)
_menuIndex = _menuText.Length - 1;
GameRef.Select.Play();
}
if (InputHandler.PressedDown())
{
_menuIndex = (_menuIndex + 1) % _menuText.Length;
GameRef.Select.Play();
}
if (InputHandler.PressedLeft())
{
if (_menuIndex == 0 || _menuIndex == 1)
{
if (Config.PlayersController[_menuIndex] == Config.Controller.Keyboard)
{
Config.PlayersController[_menuIndex] = Config.Controller.GamePad;
Config.PlayersController[(_menuIndex + 1) % 2] = Config.Controller.Keyboard;
}
else
{
Config.PlayersController[_menuIndex] = Config.Controller.Keyboard;
Config.PlayersController[(_menuIndex + 1) % 2] = Config.Controller.GamePad;
}
}
// Sound volume
else if (_menuIndex == 2)
{
if (Config.SoundVolume > 0)
Config.SoundVolume -= 1;
SoundEffect.MasterVolume = Config.SoundVolume/100f;
}
// Music volume
else if (_menuIndex == 3)
{
if (Config.MusicVolume > 0)
Config.MusicVolume -= 1;
MediaPlayer.Volume = Config.MusicVolume/100f;
}
GameRef.Select.Play();
}
if (InputHandler.PressedRight())
{
if (_menuIndex == 0 || _menuIndex == 1)
{
if (Config.PlayersController[_menuIndex] == Config.Controller.Keyboard)
{
Config.PlayersController[_menuIndex] = Config.Controller.GamePad;
Config.PlayersController[(_menuIndex + 1) % 2] = Config.Controller.Keyboard;
}
else
{
Config.PlayersController[_menuIndex] = Config.Controller.Keyboard;
Config.PlayersController[(_menuIndex + 1) % 2] = Config.Controller.GamePad;
}
}
// Sound volume
else if (_menuIndex == 2)
{
if (Config.SoundVolume < 100)
Config.SoundVolume += 1;
SoundEffect.MasterVolume = Config.SoundVolume/100f;
}
// Music volume
else if (_menuIndex == 3)
{
if (Config.MusicVolume < 100)
Config.MusicVolume += 1;
MediaPlayer.Volume = Config.MusicVolume / 100f;
}
GameRef.Select.Play();
}
if (InputHandler.PressedAction())
{
/*
if (_menuIndex == 0 || _menuIndex == 1)
{
if (Config.PlayersController[_menuIndex] == Config.Controller.Keyboard)
StateManager.ChangeState(GameRef.KeyboardInputsScreen);
else
StateManager.ChangeState(GameRef.GamepadInputsScreen);
}
*/
}
base.Update(gameTime);
}