Example #1
0
        public override bool HandleInput(KeyEvent KeyEvent)
        {
            if (KeyEvent.KeyPressed && !Char.IsControl(KeyEvent.Unicode))
            {
            }
            else
            {
                switch (KeyEvent.Key)
                {
                case Keys.Escape:
                case Keys.Back:
                    CGraphics.FadeTo(EScreens.ScreenMain);
                    break;

                case Keys.Enter:
                    CGraphics.FadeTo(EScreens.ScreenMain);
                    break;

                case Keys.F:
                    FadeAndPause();
                    break;

                case Keys.S:
                    PlayFile();
                    break;

                case Keys.P:
                    PauseFile();
                    break;
                }
            }

            return(true);
        }
Example #2
0
 private static void _CloseProgram()
 {
     // Unloading in reverse order
     try
     {
         CController.Close();
         CVocaluxeServer.Close();
         CGraphics.Close();
         CThemes.Close();
         CCover.Close();
         CFonts.Close();
         CBackgroundMusic.Close();
         CWebcam.Close();
         CDataBase.Close();
         CVideo.Close();
         CRecord.Close();
         CSound.Close();
         CDraw.Close();
     }
     catch (Exception e)
     {
         CLog.LogError("Error during shutdown!", false, false, e);
     }
     GC.Collect(); // Do a GC run here before we close logs to have finalizers run
     try
     {
         CLog.Close(); // Do this last, so we get all log entries!
     }
     catch (Exception) {}
     Environment.Exit(Environment.ExitCode);
 }
Example #3
0
        private void StartSong()
        {
            for (int i = 0; i < CGame.NumPlayer; i++)
            {
                if (CGame.Player[i].ProfileID < 0)
                {
                    CGame.Player[i].Name       = "Player " + (i + 1).ToString();
                    CGame.Player[i].Difficulty = EGameDifficulty.TR_CONFIG_EASY;
                    CGame.Player[i].ProfileID  = -1;
                }
                else
                {
                    //Just a work-around for not crashing the game
                    if (CGame.Player[i].Name == null)
                    {
                        CGame.Player[i].Name = "";
                    }
                }
                if (CGame.GetNumSongs() == 1 && CGame.GetSong(1).IsDuet)
                {
                    CGame.Player[i].LineNr = SelectSlides[htSelectSlides(SelectSlideDuetPlayer[i])].Selection;
                }
            }

            CGraphics.FadeTo(EScreens.ScreenSing);
        }
Example #4
0
        public override bool HandleMouse(MouseEvent MouseEvent)
        {
            base.HandleMouse(MouseEvent);

            if ((MouseEvent.RB) && (CSongs.Category < 0))
            {
                CGraphics.FadeTo(EScreens.ScreenMain);
            }

            if (MouseEvent.MB && CSongs.Category != -1)
            {
                Console.WriteLine("MB pressed");
                SongMenus[htSongMenus(SongMenu)].SetSelectedSong(CSongs.GetRandomSong());
            }
            else
            {
                SongMenus[htSongMenus(SongMenu)].HandleMouse(ref MouseEvent);
            }

            if (MouseEvent.LB && CSongs.NumVisibleSongs > 0 && SongMenus[htSongMenus(SongMenu)].GetActualSelection() != -1)
            {
                StartSong(SongMenus[htSongMenus(SongMenu)].GetSelectedSong());
            }

            return(true);
        }
Example #5
0
        public override bool HandleMouse(SMouseEvent mouseEvent)
        {
            base.HandleMouse(mouseEvent);

            if (mouseEvent.RB)
            {
                _SaveMicConfig();
                CGraphics.FadeTo(EScreen.Options);
            }

            if (mouseEvent.LB && _IsMouseOverCurSelection(mouseEvent))
            {
                _SelectSlideAction();

                if (_Buttons[_ButtonExit].Selected)
                {
                    _SaveMicConfig();
                    CGraphics.FadeTo(EScreen.Options);
                }

                if (_Buttons[_ButtonDelayTest].Selected)
                {
                    _TestDelay();
                }
            }
            return(true);
        }
Example #6
0
        public override bool HandleInput(SKeyEvent keyEvent)
        {
            base.HandleInput(keyEvent);

            if (keyEvent.KeyPressed)
            {
            }
            else
            {
                switch (keyEvent.Key)
                {
                case Keys.Escape:
                case Keys.Back:
                    _SaveConfig();
                    CGraphics.FadeTo(EScreen.OptionsVideo);
                    break;

                case Keys.S:
                    CParty.SetNormalGameMode();
                    _SaveConfig();
                    CGraphics.FadeTo(EScreen.Song);
                    break;

                case Keys.Enter:
                    if (_Buttons[_ButtonExit].Selected)
                    {
                        _SaveConfig();
                        CGraphics.FadeTo(EScreen.OptionsVideo);
                    }
                    break;
                }
            }
            return(true);
        }
Example #7
0
        public override bool UpdateGame()
        {
            _CheckStartIntroVideos();

            bool next = CConfig.Config.Theme.CoverLoading != ECoverLoading.TR_CONFIG_COVERLOADING_ATSTART || CSongs.CoverLoaded;

            if ((_IntroOutPlayed || _SkipIntro) && next && CSettings.ProgramState == EProgramState.Start && CSongs.SongsLoaded)
            {
                CSettings.ProgramState = EProgramState.Normal;
                CGraphics.FadeTo(EScreen.Main);
            }

            _Texts[_TextStatus].Text =
                CLanguage.Translate("TR_SCREENLOAD_TOTAL") + ": " + CSongs.NumAllSongs + " " +
                CLanguage.Translate("TR_SCREENLOAD_SONGS") + " (" + CSongs.NumSongsWithCoverLoaded + " " +
                CLanguage.Translate("TR_SCREENLOAD_LOADED") + ")";

            if (CSongs.SongsLoaded && !CBackgroundMusic.OwnSongsAvailable)
            {
                CBackgroundMusic.OwnSongsAvailable = true;

                if (CConfig.Config.Video.VideoBackgrounds == EOffOn.TR_CONFIG_ON || CConfig.Config.Video.VideosToBackground == EOffOn.TR_CONFIG_ON)
                {
                    CBackgroundMusic.VideoEnabled = true;
                }

                CBackgroundMusic.Play();
            }

            return(true);
        }
Example #8
0
        private void Stop()
        {
            CGame.NextRound();

            CGraphics.FadeTo(EScreens.ScreenScore);
            _FadeOut = true;
        }
Example #9
0
        public override bool HandleMouse(MouseEvent MouseEvent)
        {
            if (MouseEvent.LB && IsMouseOver(MouseEvent))
            {
            }

            if (MouseEvent.LB)
            {
                CGraphics.FadeTo(EScreens.ScreenSong);
            }

            if (MouseEvent.RB)
            {
                CGraphics.FadeTo(EScreens.ScreenSong);
            }

            if (MouseEvent.MB)
            {
                int LastRound = _Round;
                ChangeRound(1);
                if (LastRound == _Round)
                {
                    _Round = 0;
                    UpdateRound();
                }
            }

            ChangePos(MouseEvent.Wheel);
            return(true);
        }
Example #10
0
        private void StartRandomVisibleSongs()
        {
            CGame.Reset();
            CGame.ClearSongs();

            List <int> IDs = new List <int>();

            for (int i = 0; i < CSongs.VisibleSongs.Length; i++)
            {
                IDs.Add(CSongs.VisibleSongs[i].ID);
            }

            while (IDs.Count > 0)
            {
                int SongNr = IDs[CGame.Rand.Next(IDs.Count)];

                EGameMode gm = EGameMode.TR_GAMEMODE_NORMAL;
                if (CSongs.AllSongs[SongNr].IsDuet)
                {
                    gm = EGameMode.TR_GAMEMODE_DUET;
                }

                CGame.AddSong(SongNr, gm);

                IDs.Remove(SongNr);
            }

            if (CGame.GetNumSongs() > 0)
            {
                CGraphics.FadeTo(EScreens.ScreenNames);
            }
        }
Example #11
0
        private void StartSong(int SongNr)
        {
            if ((CSongs.Category >= 0) && (SongNr >= 0))
            {
                EGameMode gm;
                if (_AvailableGameModes.Count >= SelectSlides[htSelectSlides(SelectSlideOptionsMode)].Selection)
                {
                    gm = _AvailableGameModes[SelectSlides[htSelectSlides(SelectSlideOptionsMode)].Selection];
                }
                else
                {
                    if (CSongs.VisibleSongs[SongNr].IsDuet)
                    {
                        gm = GameModes.EGameMode.TR_GAMEMODE_DUET;
                    }
                    else
                    {
                        gm = GameModes.EGameMode.TR_GAMEMODE_NORMAL;
                    }
                }

                CGame.Reset();
                CGame.ClearSongs();

                CGame.AddVisibleSong(SongNr, gm);

                CGraphics.FadeTo(EScreens.ScreenNames);
            }
        }
Example #12
0
        public override bool HandleMouse(SMouseEvent mouseEvent)
        {
            base.HandleMouse(mouseEvent);

            if (mouseEvent.LB && _IsMouseOverCurSelection(mouseEvent))
            {
                if (_Buttons[_ButtonSing].Selected)
                {
                    CParty.SetNormalGameMode();
                    CGraphics.FadeTo(EScreen.Song);
                }

                if (_Buttons[_ButtonParty].Selected)
                {
                    CGraphics.FadeTo(EScreen.Party);
                }

                if (_Buttons[_ButtonOptions].Selected)
                {
                    CGraphics.FadeTo(EScreen.Options);
                }

                if (_Buttons[_ButtonProfiles].Selected)
                {
                    CGraphics.FadeTo(EScreen.Profiles);
                }

                if (_Buttons[_ButtonExit].Selected)
                {
                    return(false);
                }
            }

            return(true);
        }
Example #13
0
        private void StartRandomVisibleSongs()
        {
            CGame.Reset();
            CGame.ClearSongs();
            CGame.SetGameMode(GameModes.EGameMode.Normal);

            List <int> IDs = new List <int>();

            for (int i = 0; i < CSongs.VisibleSongs.Length; i++)
            {
                IDs.Add(CSongs.VisibleSongs[i].ID);
            }

            while (IDs.Count > 0)
            {
                int SongNr = IDs[CGame.Rand.Next(IDs.Count)];

                if (!CSongs.AllSongs[SongNr].IsDuet)
                {
                    CGame.AddSong(SongNr);
                }
                IDs.Remove(SongNr);
            }

            if (CGame.GetNumSongs() > 0)
            {
                CGraphics.FadeTo(EScreens.ScreenNames);
            }
        }
Example #14
0
        public override bool HandleInput(KeyEvent KeyEvent)
        {
            if (KeyEvent.KeyPressed)
            {
            }
            else
            {
                switch (KeyEvent.Key)
                {
                case Keys.Escape:
                case Keys.Back:
                    CGraphics.FadeTo(EScreens.ScreenHighscore);
                    break;

                case Keys.Enter:
                    CGraphics.FadeTo(EScreens.ScreenHighscore);
                    break;

                case Keys.Left:
                    ChangeRound(-1);
                    break;

                case Keys.Right:
                    ChangeRound(1);
                    break;
                }
            }
            return(true);
        }
Example #15
0
        public override bool HandleMouse(MouseEvent MouseEvent)
        {
            base.HandleMouse(MouseEvent);

            if (MouseEvent.RB)
            {
                SaveConfig();
                CGraphics.FadeTo(EScreens.ScreenOptions);
            }

            if (MouseEvent.LB && IsMouseOver(MouseEvent))
            {
                if (SelectSlides[htSelectSlides(SelectSlideWebcamDevices)].Selected)
                {
                    OnDeviceEvent();
                }
                if (SelectSlides[htSelectSlides(SelectSlideWebcamCapabilities)].Selected)
                {
                    OnCapabilitiesEvent();
                }
                SaveConfig();
                if (Buttons[htButtons(ButtonExit)].Selected)
                {
                    CGraphics.FadeTo(EScreens.ScreenOptions);
                }
            }
            return(true);
        }
Example #16
0
        public override bool HandleMouse(SMouseEvent mouseEvent)
        {
            base.HandleMouse(mouseEvent);

            if (mouseEvent.LB && _IsMouseOverCurSelection(mouseEvent))
            {
                if (_Buttons[_ButtonStart].Selected)
                {
                    _StartPartyMode();
                }

                if (_Buttons[_ButtonExit].Selected)
                {
                    CGraphics.FadeTo(EScreen.Main);
                }

                if (_SelectSlides[_SelectSlideModes].Selected)
                {
                    _UpdateSelection();
                }
            }

            if (mouseEvent.RB)
            {
                CGraphics.FadeTo(EScreen.Main);
            }

            return(true);
        }
Example #17
0
        public override bool HandleMouse(MouseEvent MouseEvent)
        {
            base.HandleMouse(MouseEvent);

            if (MouseEvent.LB && IsMouseOver(MouseEvent))
            {
                if (Buttons[htButtons(ButtonSing)].Selected)
                {
                    CGraphics.FadeTo(EScreens.ScreenSong);
                }

                if (Buttons[htButtons(ButtonOptions)].Selected)
                {
                    CGraphics.FadeTo(EScreens.ScreenOptions);
                }

                if (Buttons[htButtons(ButtonProfiles)].Selected)
                {
                    CGraphics.FadeTo(EScreens.ScreenProfiles);
                }

                if (Buttons[htButtons(ButtonExit)].Selected)
                {
                    return(false);
                }
            }

            return(true);
        }
Example #18
0
        public override bool HandleMouse(SMouseEvent mouseEvent)
        {
            base.HandleMouse(mouseEvent);

            if (mouseEvent.RB)
            {
                _SaveConfig();
                CGraphics.FadeTo(EScreen.Options);
            }

            if (mouseEvent.LB && _IsMouseOverCurSelection(mouseEvent))
            {
                if (_SelectSlides[_SelectSlideWebcamDevices].Selected)
                {
                    _OnDeviceEvent();
                }
                if (_SelectSlides[_SelectSlideWebcamCapabilities].Selected)
                {
                    _OnCapabilitiesEvent();
                }
                _SaveConfig();
                if (_Buttons[_ButtonExit].Selected)
                {
                    CGraphics.FadeTo(EScreen.Options);
                }
                if (_Buttons[_ButtonScreenAdjustments].Selected)
                {
                    CGraphics.FadeTo(EScreen.OptionsVideoAdjustments);
                }
            }
            return(true);
        }
Example #19
0
        private void OnChange()
        {
            if (_OldTheme != SelectSlides[htSelectSlides(SelectSlideTheme)].Selection)
            {
                CConfig.Theme = CTheme.ThemeNames[SelectSlides[htSelectSlides(SelectSlideTheme)].Selection];
                _OldTheme     = SelectSlides[htSelectSlides(SelectSlideTheme)].Selection;

                CTheme.UnloadSkins();
                CFonts.UnloadThemeFonts(CConfig.Theme);
                CTheme.ListSkins();
                CConfig.Skin = CTheme.SkinNames[0];
                _OldSkin     = 0;
                _TempSkin    = _OldSkin;

                CConfig.SaveConfig();

                CTheme.LoadSkins();
                CTheme.LoadTheme();
                CGraphics.ReloadTheme();

                OnShow();
                OnShowFinish();
                return;
            }

            if (_TempSkin != SelectSlides[htSelectSlides(SelectSlideSkin)].Selection)
            {
                _TempSkin = SelectSlides[htSelectSlides(SelectSlideSkin)].Selection;

                PauseBG();
                CConfig.Skin = CTheme.SkinNames[_TempSkin];
                CGraphics.ReloadSkin();
                ResumeBG();
            }
        }
Example #20
0
 public override bool UpdateGame()
 {
     if (!animation())
     {
         CGraphics.FadeTo(EScreens.ScreenMain);
     }
     return(true);
 }
Example #21
0
 public override bool HandleMouse(SMouseEvent mouseEvent)
 {
     if (mouseEvent.LB || mouseEvent.RB)
     {
         CGraphics.FadeTo(EScreen.Main);
     }
     return(true);
 }
Example #22
0
 public override bool UpdateGame()
 {
     if (!_Animation() && CGraphics.NextScreen != CGraphics.GetScreen(EScreen.Main))
     {
         CGraphics.FadeTo(EScreen.Main);
     }
     return(true);
 }
Example #23
0
 public override bool HandleMouse(SMouseEvent mouseEvent)
 {
     if (mouseEvent.LB || mouseEvent.RB)
     {
         CGraphics.HidePopup(EPopupScreens.PopupServerQR);
         return(true);
     }
     return(false);
 }
Example #24
0
        public override bool HandleInput(SKeyEvent keyEvent)
        {
            base.HandleInput(keyEvent);

            if (keyEvent.KeyPressed)
            {
            }
            else
            {
                switch (keyEvent.Key)
                {
                case Keys.Escape:
                case Keys.Back:
                    CGraphics.FadeTo(EScreen.Main);
                    break;

                case Keys.S:
                    CParty.SetNormalGameMode();
                    CGraphics.FadeTo(EScreen.Song);
                    break;

                case Keys.Enter:
                    if (_Buttons[_ButtonOptionsGame].Selected)
                    {
                        CGraphics.FadeTo(EScreen.OptionsGame);
                    }

                    if (_Buttons[_ButtonOptionsSound].Selected)
                    {
                        CGraphics.FadeTo(EScreen.OptionsSound);
                    }

                    if (_Buttons[_ButtonOptionsRecord].Selected)
                    {
                        CGraphics.FadeTo(EScreen.OptionsRecord);
                    }

                    if (_Buttons[_ButtonOptionsVideo].Selected)
                    {
                        CGraphics.FadeTo(EScreen.OptionsVideo);
                    }

                    if (_Buttons[_ButtonOptionsLyrics].Selected)
                    {
                        CGraphics.FadeTo(EScreen.OptionsLyrics);
                    }

                    if (_Buttons[_ButtonOptionsTheme].Selected)
                    {
                        CGraphics.FadeTo(EScreen.OptionsTheme);
                    }

                    break;
                }
            }
            return(true);
        }
Example #25
0
        public override bool HandleInput(KeyEvent KeyEvent)
        {
            base.HandleInput(KeyEvent);

            if (KeyEvent.KeyPressed)
            {
            }
            else
            {
                switch (KeyEvent.Key)
                {
                case Keys.Escape:
                case Keys.Back:
                    CGraphics.FadeTo(EScreens.ScreenMain);
                    break;

                case Keys.S:
                    CGraphics.FadeTo(EScreens.ScreenSong);
                    break;

                case Keys.Enter:
                    if (Buttons[htButtons(ButtonOptionsGame)].Selected)
                    {
                        CGraphics.FadeTo(EScreens.ScreenOptionsGame);
                    }

                    if (Buttons[htButtons(ButtonOptionsSound)].Selected)
                    {
                        CGraphics.FadeTo(EScreens.ScreenOptionsSound);
                    }

                    if (Buttons[htButtons(ButtonOptionsRecord)].Selected)
                    {
                        CGraphics.FadeTo(EScreens.ScreenOptionsRecord);
                    }

                    if (Buttons[htButtons(ButtonOptionsVideo)].Selected)
                    {
                        CGraphics.FadeTo(EScreens.ScreenOptionsVideo);
                    }

                    if (Buttons[htButtons(ButtonOptionsLyrics)].Selected)
                    {
                        CGraphics.FadeTo(EScreens.ScreenOptionsLyrics);
                    }

                    if (Buttons[htButtons(ButtonOptionsTheme)].Selected)
                    {
                        CGraphics.FadeTo(EScreens.ScreenOptionsTheme);
                    }

                    break;
                }
            }
            return(true);
        }
Example #26
0
        public override bool HandleInput(KeyEvent KeyEvent)
        {
            base.HandleInput(KeyEvent);

            if (KeyEvent.KeyPressed)
            {
            }
            else
            {
                switch (KeyEvent.Key)
                {
                case Keys.Escape:
                case Keys.Back:
                    SaveConfig();
                    CGraphics.FadeTo(EScreens.ScreenOptions);
                    break;

                case Keys.S:
                    CGraphics.FadeTo(EScreens.ScreenSong);
                    break;

                case Keys.Enter:
                    if (Buttons[htButtons(ButtonExit)].Selected)
                    {
                        SaveConfig();
                        CGraphics.FadeTo(EScreens.ScreenOptions);
                    }
                    break;

                case Keys.Left:
                    if (SelectSlides[htSelectSlides(SelectSlideWebcamDevices)].Selected)
                    {
                        OnDeviceEvent();
                    }
                    if (SelectSlides[htSelectSlides(SelectSlideWebcamCapabilities)].Selected)
                    {
                        OnCapabilitiesEvent();
                    }
                    SaveConfig();
                    break;

                case Keys.Right:
                    if (SelectSlides[htSelectSlides(SelectSlideWebcamDevices)].Selected)
                    {
                        OnDeviceEvent();
                    }
                    if (SelectSlides[htSelectSlides(SelectSlideWebcamCapabilities)].Selected)
                    {
                        OnCapabilitiesEvent();
                    }
                    SaveConfig();
                    break;
                }
            }
            return(true);
        }
        public override bool HandleInput(KeyEvent KeyEvent)
        {
            base.HandleInput(KeyEvent);
            if (KeyEvent.KeyPressed && !Char.IsControl(KeyEvent.Unicode))
            {
            }
            else
            {
                switch (KeyEvent.Key)
                {
                case Keys.Escape:
                case Keys.Back:
                    CGraphics.HidePopup(EPopupScreens.PopupPlayerControl);
                    return(false);

                case Keys.Enter:
                    if (Buttons[htButtons(ButtonNext)].Selected)
                    {
                        CBackgroundMusic.Next();
                    }
                    if (Buttons[htButtons(ButtonPrevious)].Selected)
                    {
                        CBackgroundMusic.Previous();
                    }
                    if (Buttons[htButtons(ButtonPlay)].Selected)
                    {
                        CBackgroundMusic.Play();
                    }
                    if (Buttons[htButtons(ButtonPause)].Selected)
                    {
                        CBackgroundMusic.Pause();
                    }
                    if (Buttons[htButtons(ButtonRepeat)].Selected)
                    {
                        CBackgroundMusic.RepeatSong = !CBackgroundMusic.RepeatSong;
                    }
                    if (Buttons[htButtons(ButtonShowVideo)].Selected)
                    {
                        VideoPreview = !VideoPreview;
                    }
                    if (Buttons[htButtons(ButtonSing)].Selected)
                    {
                        StartSong(CBackgroundMusic.SongID, CBackgroundMusic.Duet);
                    }
                    if (Buttons[htButtons(ButtonToBackgroundVideo)].Selected)
                    {
                        VideoBackground = !VideoBackground;
                    }
                    break;
                }
            }

            return(true);
        }
Example #28
0
        public override bool HandleMouse(MouseEvent MouseEvent)
        {
            base.HandleMouse(MouseEvent);

            if (MouseEvent.LB && IsMouseOver(MouseEvent))
            {
            }

            if (MouseEvent.LB && IsMouseOver(MouseEvent))
            {
                bool processed = false;
                for (int i = 0; i < ButtonPlayer.Length; i++)
                {
                    if (Buttons[htButtons(ButtonPlayer[i])].Selected)
                    {
                        processed       = true;
                        CGame.NumPlayer = i + 1;

                        UpdateSelection();
                        UpdateVisibility();

                        CConfig.NumPlayer = CGame.NumPlayer;
                        CConfig.SaveConfig();

                        CheckMics();

                        break;
                    }
                }

                if (!processed && Buttons[htButtons(ButtonBack)].Selected)
                {
                    processed = true;
                    CGraphics.FadeTo(EScreens.ScreenSong);
                }

                if (!processed && Buttons[htButtons(ButtonStart)].Selected)
                {
                    processed = true;
                    StartSong();
                }

                if (!processed)
                {
                    UpdateSelection();
                }
            }

            if (MouseEvent.RB)
            {
                CGraphics.FadeTo(EScreens.ScreenSong);
            }
            return(true);
        }
Example #29
0
        private void _ClosePopup()
        {
            string _NewProfileName = CProfiles.GetPlayerName(_NewProfileID);

            if (_NewProfileName.Length < 1)
            {
                _DeleteProfile();
            }

            CGraphics.HidePopup(EPopupScreens.PopupNewPlayer);
        }
Example #30
0
 private void _StartSong()
 {
     if (CGame.GetNumSongs() == 1 && CGame.GetSong(0).IsDuet)
     {
         for (int i = 0; i < CGame.NumPlayers; i++)
         {
             CGame.Players[i].VoiceNr = _SelectSlides[_PlayerSelectSlideDuet[i]].Selection;
         }
     }
     CGraphics.FadeTo(EScreen.Sing);
 }