Beispiel #1
0
 private void DrawSoundButton()
 {
     if (ProgramParameters.Get_MusicEnable())
     {
         SoundButtons[0].DrawButton(SpriteBatch);
     }
     else
     {
         SoundButtons[1].DrawButton(SpriteBatch);
     }
 }
Beispiel #2
0
        private void MusicControl()
        {
            if (!ProgramParameters.Get_MusicEnable())
            {
                MediaPlayer.Stop();
            }
            else if (GameState == 0 && OldGameState == -1 || GameState != 2 && OldGameState == 2 || MediaPlayer.State == MediaState.Stopped && GameState != 2)//launch game or end screen with game
            {
                MediaPlayer.Volume = 0.4f;
                MediaPlayer.Play(MenuSong);
            }
            else if (GameState == 2 && OldGameState != 2 || MediaPlayer.State == MediaState.Stopped && GameState == 2)
            {
                MediaPlayer.Volume = 0.7f;
                MediaPlayer.Play(GameSong);
            }

            SoundButtonUpdate();
        }
Beispiel #3
0
        private void SoundButtonUpdate()
        {
            if (MouseState.LeftButton == ButtonState.Pressed && OldMouseState.LeftButton == ButtonState.Released)
            {
                if (ProgramParameters.Get_MusicEnable())
                {
                    ProgramParameters.MusicSwitch(Convert.ToBoolean(SoundButtons[0].CheckMoveInButtonPosition(MouseState.X, MouseState.Y, Convert.ToInt16(ProgramParameters.Get_MusicEnable()))));
                }
                else
                {
                    ProgramParameters.MusicSwitch(Convert.ToBoolean(SoundButtons[1].CheckMoveInButtonPosition(MouseState.X, MouseState.Y, Convert.ToInt16(ProgramParameters.Get_MusicEnable()))));
                }
            }

            if (ProgramParameters.Get_MusicEnable())
            {
                if (!SoundButtons[0].GetOnMoveState() && SoundButtons[0].CheckMoveInButtonPositionX(MouseState.X) && SoundButtons[0].CheckMoveInButtonPositionY(MouseState.Y))
                {
                    SoundButtons[0].SetOnMoveState(true);
                }
                else if (SoundButtons[0].GetOnMoveState())
                {
                    SoundButtons[0].SetOnMoveState(false);
                }
            }
            else
            {
                if (!SoundButtons[1].GetOnMoveState() && SoundButtons[1].CheckMoveInButtonPositionX(MouseState.X) && SoundButtons[1].CheckMoveInButtonPositionY(MouseState.Y))
                {
                    SoundButtons[1].SetOnMoveState(true);
                }
                else if (SoundButtons[1].GetOnMoveState())
                {
                    SoundButtons[1].SetOnMoveState(false);
                }
            }
        }