From 2dc2ac5c3768d37ecf48943edda74a7448c539a5 Mon Sep 17 00:00:00 2001 From: Flamefire Date: Thu, 18 Apr 2013 12:15:30 +0200 Subject: [PATCH 01/27] Fixed scaling --- Vocaluxe/Lib/Draw/CDirect3D.cs | 36 ++++++++++++++++++++-------------- 1 file changed, 21 insertions(+), 15 deletions(-) diff --git a/Vocaluxe/Lib/Draw/CDirect3D.cs b/Vocaluxe/Lib/Draw/CDirect3D.cs index 057f1ff7..c27c7e76 100644 --- a/Vocaluxe/Lib/Draw/CDirect3D.cs +++ b/Vocaluxe/Lib/Draw/CDirect3D.cs @@ -919,29 +919,35 @@ namespace Vocaluxe.Lib.Draw int w = bmp.Width; int h = bmp.Height; + float ratio = (float)w / h; + int newW = w; + int newH = h; if (w > maxSize && w > h) - { - h = (int)Math.Round((float)maxSize / bmp.Width * bmp.Height); - w = maxSize; - } - - if (h > maxSize) - { - w = (int)Math.Round((float)maxSize / bmp.Height * bmp.Width); - h = maxSize; - } - - //Older graphics card can only handle textures with sizes being powers of two - w = (int)_CheckForNextPowerOf2(w); - h = (int)_CheckForNextPowerOf2(h); + newW = maxSize; + else if (h > maxSize) + newH = maxSize; + else if (w > h) + newW = (int)_CheckForNextPowerOf2(w); + else + newH = (int)_CheckForNextPowerOf2(h); Bitmap bmp2 = null; byte[] data; try { - if (w != bmp.Width || h != bmp.Height) + if (w != newW || h != newH) { + if (w != newW) + { + w = newW; + h = (int)Math.Round(w / ratio); + } + else + { + h = newH; + w = (int)Math.Round(h * ratio); + } //Create a new Bitmap with the new sizes bmp2 = new Bitmap(w, h); //Scale the texture From 3a12df643b25b21716af34c11b5211c1be0f1f84 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20K=C3=BCpper?= Date: Thu, 18 Apr 2013 13:11:25 +0200 Subject: [PATCH 02/27] Improve handling of profile-delete-action. --- Vocaluxe/Base/CConfig.cs | 12 ++++++------ Vocaluxe/Base/CProfiles.cs | 17 +++++++++++++++++ Vocaluxe/Screens/CScreenNames.cs | 15 ++++++++------- 3 files changed, 31 insertions(+), 13 deletions(-) diff --git a/Vocaluxe/Base/CConfig.cs b/Vocaluxe/Base/CConfig.cs index 9ee47abf..31c9f8d6 100644 --- a/Vocaluxe/Base/CConfig.cs +++ b/Vocaluxe/Base/CConfig.cs @@ -804,12 +804,12 @@ namespace Vocaluxe.Base /// Use saved players from config now for games /// public static void UsePlayers() - { - for (int i = 0; i < CProfiles.Profiles.Length; i++) + { + for (int j = 0; j < CSettings.MaxNumPlayer; j++) { - for (int j = 0; j < CSettings.MaxNumPlayer; j++) + if (Players[j].Length > 0) { - if (Players[j].Length > 0) + for (int i = 0; i < CProfiles.Profiles.Length; i++) { if (Path.GetFileName(CProfiles.Profiles[i].ProfileFile) == Players[j] && CProfiles.Profiles[i].Active == EOffOn.TR_CONFIG_ON) { @@ -819,9 +819,9 @@ namespace Vocaluxe.Base CGame.Player[j].ProfileID = i; } } - else - CGame.Player[j].ProfileID = -1; } + else + CGame.Player[j].ProfileID = -1; } } } diff --git a/Vocaluxe/Base/CProfiles.cs b/Vocaluxe/Base/CProfiles.cs index 176807e1..fe80eafa 100644 --- a/Vocaluxe/Base/CProfiles.cs +++ b/Vocaluxe/Base/CProfiles.cs @@ -251,8 +251,25 @@ namespace Vocaluxe.Base { try { + //Check if profile saved in config + for (int i = 0; i < CConfig.Players.Length; i++) + { + if (CConfig.Players[i] == _Profiles[profileID].ProfileFile) + { + CConfig.Players[i] = string.Empty; + CConfig.SaveConfig(); + } + } File.Delete(_Profiles[profileID].ProfileFile); _Profiles.RemoveAt(profileID); + //Check if profile is selected in game + for (int i = 0; i < CGame.Player.Length; i++) + { + if (CGame.Player[i].ProfileID > profileID) + CGame.Player[i].ProfileID--; + else if (CGame.Player[i].ProfileID == profileID) + CGame.Player[i].ProfileID = -1; + } } catch (Exception) { diff --git a/Vocaluxe/Screens/CScreenNames.cs b/Vocaluxe/Screens/CScreenNames.cs index 064c9b7d..ea94f0e6 100644 --- a/Vocaluxe/Screens/CScreenNames.cs +++ b/Vocaluxe/Screens/CScreenNames.cs @@ -577,14 +577,15 @@ namespace Vocaluxe.Screens for (int i = 0; i < CSettings.MaxNumPlayer; i++) { - //Update texture and name - if (CConfig.Players[i].Length > 0) + if (CGame.Player[i].ProfileID > -1 && CProfiles.NumProfiles > CGame.Player[i].ProfileID) { - if (CGame.Player[i].ProfileID > -1 && CProfiles.NumProfiles > CGame.Player[i].ProfileID) - { - Statics[_StaticPlayerAvatar[i]].Texture = CProfiles.Profiles[CGame.Player[i].ProfileID].Avatar.Texture; - Texts[_TextPlayer[i]].Text = CProfiles.Profiles[CGame.Player[i].ProfileID].PlayerName; - } + Statics[_StaticPlayerAvatar[i]].Texture = CProfiles.Profiles[CGame.Player[i].ProfileID].Avatar.Texture; + Texts[_TextPlayer[i]].Text = CProfiles.Profiles[CGame.Player[i].ProfileID].PlayerName; + } + else + { + Statics[_StaticPlayerAvatar[i]].Texture = _OriginalPlayerAvatarTextures[i]; + Texts[_TextPlayer[i]].Text = CLanguage.Translate("TR_SCREENNAMES_PLAYER") + " " + (i + 1).ToString(); } if (CGame.GetNumSongs() == 1 && CGame.GetSong(1).IsDuet) { From aeaa38cf2293cde436df3de27458fd3d56e7b6eb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20K=C3=BCpper?= Date: Thu, 18 Apr 2013 13:22:10 +0200 Subject: [PATCH 03/27] Improved handling of adding new profiles. --- Vocaluxe/Base/CProfiles.cs | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/Vocaluxe/Base/CProfiles.cs b/Vocaluxe/Base/CProfiles.cs index fe80eafa..93623d5f 100644 --- a/Vocaluxe/Base/CProfiles.cs +++ b/Vocaluxe/Base/CProfiles.cs @@ -79,6 +79,9 @@ namespace Vocaluxe.Base public static void LoadProfiles() { + List _OldProfiles = null; + if (_Profiles != null) + _OldProfiles = _Profiles; _Profiles = new List(); List files = new List(); files.AddRange(CHelper.ListFiles(CSettings.FolderProfiles, "*.xml", true, true)); @@ -87,6 +90,28 @@ namespace Vocaluxe.Base _LoadProfile(file); _SortProfilesByName(); + + //Find profile-id if new profile is created + if (_OldProfiles != null) + { + int _NewProfileId = -1; + for (int i = 0; i < _OldProfiles.Count; i++) + { + if (_Profiles[i].ProfileFile != _OldProfiles[i].ProfileFile) + { + _NewProfileId = i; + break; + } + } + if (_NewProfileId != -1) + { + for (int i = 0; i < CGame.Player.Length; i++) + { + if (CGame.Player[i].ProfileID >= _NewProfileId) + CGame.Player[i].ProfileID++; + } + } + } } public static void LoadAvatars() From 74396eda2f5ecf8856474dce81ce409fee8059ad Mon Sep 17 00:00:00 2001 From: Flamefire Date: Thu, 18 Apr 2013 15:09:21 +0200 Subject: [PATCH 04/27] Auto cleanup --- .../PartyModeChallenge/CChallengeRounds.cs | 21 +++++++- .../PartyModeChallenge/CPartyModeChallenge.cs | 19 ++++++++ .../CPartyScreenChallengeConfig.cs | 19 ++++++++ .../CPartyScreenChallengeMain.cs | 29 +++++++++-- .../CPartyScreenChallengeNames.cs | 25 +++++++++- .../PartyModeChallenge/GlobalSuppressions.cs | Bin 1478 -> 1822 bytes .../CChallengeRounds.cs | 21 +++++++- .../CPartyModeChallengeMedley.cs | 19 ++++++++ .../CPartyScreenChallengeMedleyConfig.cs | 19 ++++++++ .../CPartyScreenChallengeMedleyMain.cs | 29 +++++++++-- .../CPartyScreenChallengeMedleyNames.cs | 25 +++++++++- .../GlobalSuppressions.cs | Bin 1478 -> 1822 bytes .../PartyModeTicTacToe/CPartyModeTicTacToe.cs | 19 ++++++++ .../CPartyScreenTicTacToeConfig.cs | 24 +++++++++- .../CPartyScreenTicTacToeMain.cs | 26 ++++++++-- .../CPartyScreenTicTacToeNames.cs | 27 +++++++++-- .../PartyModeTicTacToe/GlobalSuppressions.cs | Bin 1478 -> 1822 bytes Vocaluxe/Base/CBackgroundMusic.cs | 21 +++++++- Vocaluxe/Base/CConfig.cs | 21 +++++++- Vocaluxe/Base/CCover.cs | 21 +++++++- Vocaluxe/Base/CDataBase.cs | 21 +++++++- Vocaluxe/Base/CDraw.cs | 21 +++++++- Vocaluxe/Base/CFont.cs | 21 +++++++- Vocaluxe/Base/CGame.cs | 21 +++++++- Vocaluxe/Base/CGraphics.cs | 21 +++++++- Vocaluxe/Base/CInput.cs | 21 +++++++- Vocaluxe/Base/CLanguage.cs | 21 +++++++- Vocaluxe/Base/CLog.cs | 21 +++++++- Vocaluxe/Base/CMain.cs | 21 +++++++- Vocaluxe/Base/CObservable.cs | 21 +++++++- Vocaluxe/Base/CParty.cs | 21 +++++++- Vocaluxe/Base/CPlaylists.cs | 21 +++++++- Vocaluxe/Base/CProfiles.cs | 21 +++++++- Vocaluxe/Base/CSettings.cs | 25 ++++++++-- Vocaluxe/Base/CSongCategorizer.cs | 21 +++++++- Vocaluxe/Base/CSongFilter.cs | 21 +++++++- Vocaluxe/Base/CSongSorter.cs | 21 +++++++- Vocaluxe/Base/CSongs.cs | 28 +++++++++-- Vocaluxe/Base/CSound.cs | 21 +++++++- Vocaluxe/Base/CTheme.cs | 21 +++++++- Vocaluxe/Base/CUtility.cs | 27 +++++++++-- Vocaluxe/Base/CVideo.cs | 21 +++++++- Vocaluxe/Base/CWebcam.cs | 21 +++++++- Vocaluxe/CSplashScreen.cs | 21 +++++++- Vocaluxe/GameModes/CGameMode.cs | 21 +++++++- Vocaluxe/GameModes/CGameModeNormal.cs | 21 +++++++- Vocaluxe/GameModes/IGameMode.cs | 21 +++++++- Vocaluxe/GlobalSuppressions.cs | 28 +++++++---- Vocaluxe/Lib/Draw/CDrawWinForm.cs | 23 ++++++++- Vocaluxe/Lib/Draw/COpenGL.cs | 21 +++++++- Vocaluxe/Lib/Draw/IDraw.cs | 21 +++++++- Vocaluxe/Lib/Input/CHIDAPI.cs | 21 +++++++- Vocaluxe/Lib/Input/IInput.cs | 21 +++++++- Vocaluxe/Lib/Input/WiiMote/CWiiMote.cs | 21 +++++++- Vocaluxe/Lib/Input/WiiMote/WiiMoteLib.cs | 33 ++++++++++--- Vocaluxe/Lib/Playlist/CPlaylistFile.cs | 21 +++++++- Vocaluxe/Lib/Sound/CDirectSoundRecord.cs | 29 +++++++++-- Vocaluxe/Lib/Sound/CGstreamerAudio.cs | 22 ++++++++- Vocaluxe/Lib/Sound/COpenALPlay.cs | 23 ++++++++- Vocaluxe/Lib/Sound/COpenALRecord.cs | 21 +++++++- Vocaluxe/Lib/Sound/CPortAudioPlay.cs | 22 ++++++++- Vocaluxe/Lib/Sound/CPortAudioRecord.cs | 21 +++++++- Vocaluxe/Lib/Sound/Decoder/CAudioDecoder.cs | 21 +++++++- .../Lib/Sound/Decoder/CAudioDecoderFFmpeg.cs | 27 +++++++++-- Vocaluxe/Lib/Sound/Decoder/IAudioDecoder.cs | 21 +++++++- .../Sound/Gstreamer/CGstreamerAudioWrapper.cs | 23 ++++++++- Vocaluxe/Lib/Sound/IPlayback.cs | 21 +++++++- Vocaluxe/Lib/Sound/IRecord.cs | 21 +++++++- Vocaluxe/Lib/Sound/Portaudio/PortAudio.cs | 41 ++++++++-------- Vocaluxe/Lib/Sound/Portaudio/PortAudioASIO.cs | 40 ++++++++-------- Vocaluxe/Lib/Video/Acinerella/CAcinerella.cs | 22 ++++++++- Vocaluxe/Lib/Video/CVideoDecoder.cs | 21 +++++++- Vocaluxe/Lib/Video/CVideoDecoderFFmpeg.cs | 25 ++++++++-- Vocaluxe/Lib/Video/CVideoDecoderGstreamer.cs | 21 +++++++- .../Video/Gstreamer/CGstreamerVideoWrapper.cs | 21 +++++++- Vocaluxe/Lib/Video/IVideoDecoder.cs | 21 +++++++- Vocaluxe/Lib/Webcam/CAForgeNet.cs | 21 +++++++- Vocaluxe/Lib/Webcam/IWebcam.cs | 21 +++++++- Vocaluxe/Program.cs | 5 +- Vocaluxe/Properties/AssemblyInfo.cs | 25 +++++++++- Vocaluxe/Screens/CPopupScreenPlayerControl.cs | 21 +++++++- Vocaluxe/Screens/CPopupScreenVolumeControl.cs | 21 +++++++- Vocaluxe/Screens/CScreenCredits.cs | 21 +++++++- Vocaluxe/Screens/CScreenHighscore.cs | 21 +++++++- Vocaluxe/Screens/CScreenLoad.cs | 25 ++++++++-- Vocaluxe/Screens/CScreenMain.cs | 21 +++++++- Vocaluxe/Screens/CScreenNames.cs | 21 +++++++- Vocaluxe/Screens/CScreenOptions.cs | 21 +++++++- Vocaluxe/Screens/CScreenOptionsGame.cs | 21 +++++++- Vocaluxe/Screens/CScreenOptionsLyrics.cs | 21 +++++++- Vocaluxe/Screens/CScreenOptionsRecord.cs | 21 +++++++- Vocaluxe/Screens/CScreenOptionsSound.cs | 21 +++++++- Vocaluxe/Screens/CScreenOptionsTheme.cs | 21 +++++++- Vocaluxe/Screens/CScreenOptionsVideo.cs | 26 ++++++++-- Vocaluxe/Screens/CScreenParty.cs | 21 +++++++- Vocaluxe/Screens/CScreenProfiles.cs | 21 +++++++- Vocaluxe/Screens/CScreenScore.cs | 41 +++++++++++----- Vocaluxe/Screens/CScreenSing.cs | 33 ++++++++++--- Vocaluxe/Screens/CScreenSong.cs | 21 +++++++- Vocaluxe/Screens/CScreenTest.cs | 21 +++++++- VocaluxeLib/GlobalSuppressions.cs | 27 +++++++---- VocaluxeLib/Menu/CBackground.cs | 21 +++++++- VocaluxeLib/Menu/CBasic.cs | 21 +++++++- VocaluxeLib/Menu/CButton.cs | 21 +++++++- VocaluxeLib/Menu/CEqualizer.cs | 21 +++++++- VocaluxeLib/Menu/CHelper.cs | 21 +++++++- VocaluxeLib/Menu/CInteraction.cs | 21 +++++++- VocaluxeLib/Menu/CLyric.cs | 21 +++++++- VocaluxeLib/Menu/CMenu.cs | 21 +++++++- VocaluxeLib/Menu/CMenuParty.cs | 21 +++++++- VocaluxeLib/Menu/CNameSelection.cs | 21 +++++++- VocaluxeLib/Menu/CObjectInteractions.cs | 21 +++++++- VocaluxeLib/Menu/COrderedDictionaryLite.cs | 21 +++++++- VocaluxeLib/Menu/CParticle.cs | 31 +++++++++--- VocaluxeLib/Menu/CPlaylist.cs | 23 ++++++++- VocaluxeLib/Menu/CPoints.cs | 25 ++++++++-- VocaluxeLib/Menu/CScreenSetting.cs | 21 +++++++- VocaluxeLib/Menu/CSelectSlide.cs | 21 +++++++- VocaluxeLib/Menu/CStatic.cs | 21 +++++++- VocaluxeLib/Menu/CText.cs | 21 +++++++- VocaluxeLib/Menu/CXMLReader.cs | 21 +++++++- VocaluxeLib/Menu/Enums.cs | 22 ++++++++- VocaluxeLib/Menu/IMenu.cs | 21 +++++++- VocaluxeLib/Menu/IMenuElement.cs | 21 +++++++- VocaluxeLib/Menu/SingNotes/CNotes.cs | 45 +++++++++++++----- VocaluxeLib/Menu/SingNotes/CSingNotes.cs | 21 +++++++- .../Menu/SingNotes/CSingNotesClassic.cs | 21 +++++++- VocaluxeLib/Menu/SingNotes/ISingNotes.cs | 21 +++++++- VocaluxeLib/Menu/SongMenu/CSong.cs | 21 +++++++- VocaluxeLib/Menu/SongMenu/CSongMenu.cs | 21 +++++++- VocaluxeLib/Menu/SongMenu/CSongMenuBook.cs | 21 +++++++- VocaluxeLib/Menu/SongMenu/CSongMenuDreidel.cs | 22 ++++++++- .../Menu/SongMenu/CSongMenuFramework.cs | 21 +++++++- VocaluxeLib/Menu/SongMenu/CSongMenuList.cs | 21 +++++++- .../Menu/SongMenu/CSongMenuTileBoard.cs | 21 +++++++- VocaluxeLib/Menu/SongMenu/ISongMenu.cs | 21 +++++++- VocaluxeLib/Menu/Structs.cs | 23 ++++++++- VocaluxeLib/PartyModes/CPartyMode.cs | 21 +++++++- VocaluxeLib/PartyModes/CPartyModeNone.cs | 21 +++++++- VocaluxeLib/PartyModes/CScreenPartyDummy.cs | 21 +++++++- VocaluxeLib/PartyModes/IPartyMode.cs | 21 +++++++- VocaluxeLib/Properties/AssemblyInfo.cs | 25 +++++++++- 142 files changed, 2859 insertions(+), 273 deletions(-) diff --git a/PartyModes/PartyModeChallenge/CChallengeRounds.cs b/PartyModes/PartyModeChallenge/CChallengeRounds.cs index 080084c4..bc99aa57 100644 --- a/PartyModes/PartyModeChallenge/CChallengeRounds.cs +++ b/PartyModes/PartyModeChallenge/CChallengeRounds.cs @@ -1,4 +1,23 @@ -using System; +#region license +// /* +// This file is part of Vocaluxe. +// +// Vocaluxe is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Vocaluxe is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with Vocaluxe. If not, see . +// */ +#endregion + +using System; using System.Collections.Generic; namespace VocaluxeLib.PartyModes.Challenge diff --git a/PartyModes/PartyModeChallenge/CPartyModeChallenge.cs b/PartyModes/PartyModeChallenge/CPartyModeChallenge.cs index 5cf89c15..173dcc53 100644 --- a/PartyModes/PartyModeChallenge/CPartyModeChallenge.cs +++ b/PartyModes/PartyModeChallenge/CPartyModeChallenge.cs @@ -1,3 +1,22 @@ +#region license +// /* +// This file is part of Vocaluxe. +// +// Vocaluxe is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Vocaluxe is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with Vocaluxe. If not, see . +// */ +#endregion + using System; using System.Collections.Generic; using System.Runtime.InteropServices; diff --git a/PartyModes/PartyModeChallenge/CPartyScreenChallengeConfig.cs b/PartyModes/PartyModeChallenge/CPartyScreenChallengeConfig.cs index 2351bd79..29f18def 100644 --- a/PartyModes/PartyModeChallenge/CPartyScreenChallengeConfig.cs +++ b/PartyModes/PartyModeChallenge/CPartyScreenChallengeConfig.cs @@ -1,3 +1,22 @@ +#region license +// /* +// This file is part of Vocaluxe. +// +// Vocaluxe is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Vocaluxe is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with Vocaluxe. If not, see . +// */ +#endregion + using System; using System.Windows.Forms; using VocaluxeLib.Menu; diff --git a/PartyModes/PartyModeChallenge/CPartyScreenChallengeMain.cs b/PartyModes/PartyModeChallenge/CPartyScreenChallengeMain.cs index 26d04c1d..d7da6606 100644 --- a/PartyModes/PartyModeChallenge/CPartyScreenChallengeMain.cs +++ b/PartyModes/PartyModeChallenge/CPartyScreenChallengeMain.cs @@ -1,3 +1,22 @@ +#region license +// /* +// This file is part of Vocaluxe. +// +// Vocaluxe is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Vocaluxe is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with Vocaluxe. If not, see . +// */ +#endregion + using System; using System.Collections.Generic; using System.Windows.Forms; @@ -87,11 +106,15 @@ namespace VocaluxeLib.PartyModes.Challenge _ThemeTexts = new string[] { - _TextPosition, _TextPlayerName, _TextNumPlayed, _TextWon, _TextSingPoints, _TextGamePoints, _TextNextPlayer, _TextPopupReallyExit, _TextRoundNumber, _TextRoundPlayer, + _TextPosition, _TextPlayerName, _TextNumPlayed, _TextWon, _TextSingPoints, _TextGamePoints, _TextNextPlayer, _TextPopupReallyExit, _TextRoundNumber, + _TextRoundPlayer, _TextRoundScore, _TextFinishMessage, _TextFinishPlayerWin, _TextNextPlayerMessage }; _ThemeButtons = new string[] - {_ButtonNextRound, _ButtonBack, _ButtonExit, _ButtonPopupYes, _ButtonPopupNo, _ButtonPlayerScrollDown, _ButtonPlayerScrollUp, _ButtonRoundsScrollDown, _ButtonRoundsScrollUp}; + { + _ButtonNextRound, _ButtonBack, _ButtonExit, _ButtonPopupYes, _ButtonPopupNo, _ButtonPlayerScrollDown, _ButtonPlayerScrollUp, _ButtonRoundsScrollDown, + _ButtonRoundsScrollUp + }; _ThemeStatics = new string[] {_StaticPopupBG, _StaticNextPlayer}; } @@ -454,7 +477,7 @@ namespace VocaluxeLib.PartyModes.Challenge { //Player float x = numberX + 15 + (CBase.Settings.GetRenderW() - Texts[_TextRoundNumber].X - 20) / numPlayerInThisRow * (column - row * numPlayerInOneRow) + - ((CBase.Settings.GetRenderW() - Texts[_TextRoundNumber].X - 20) / numPlayerInThisRow) / 2; + ((CBase.Settings.GetRenderW() - Texts[_TextRoundNumber].X - 20) / numPlayerInThisRow) / 2; float maxw = ((CBase.Settings.GetRenderW() - Texts[_TextRoundNumber].X - 20) / numPlayerInThisRow) / 2 - 5; _RoundsTable[round].TextPlayer[column].X = x; _RoundsTable[round].TextPlayer[column].Y = numberY; diff --git a/PartyModes/PartyModeChallenge/CPartyScreenChallengeNames.cs b/PartyModes/PartyModeChallenge/CPartyScreenChallengeNames.cs index 573f5430..4900cb28 100644 --- a/PartyModes/PartyModeChallenge/CPartyScreenChallengeNames.cs +++ b/PartyModes/PartyModeChallenge/CPartyScreenChallengeNames.cs @@ -1,3 +1,22 @@ +#region license +// /* +// This file is part of Vocaluxe. +// +// Vocaluxe is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Vocaluxe is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with Vocaluxe. If not, see . +// */ +#endregion + using System; using System.Collections.Generic; using System.Windows.Forms; @@ -341,8 +360,10 @@ namespace VocaluxeLib.PartyModes.Challenge { _PlayerChooseButtons[i].ProfileID = _PlayerChooseButtonsVisibleProfiles[i + offset * numButtonPlayerChoose]; _PlayerChooseButtons[i].Button.Text.Text = CBase.Profiles.GetProfiles()[_PlayerChooseButtonsVisibleProfiles[i + offset * numButtonPlayerChoose]].PlayerName; - _PlayerChooseButtons[i].Button.Texture = CBase.Profiles.GetProfiles()[_PlayerChooseButtonsVisibleProfiles[i + offset * numButtonPlayerChoose]].Avatar.Texture; - _PlayerChooseButtons[i].Button.SelTexture = CBase.Profiles.GetProfiles()[_PlayerChooseButtonsVisibleProfiles[i + offset * numButtonPlayerChoose]].Avatar.Texture; + _PlayerChooseButtons[i].Button.Texture = + CBase.Profiles.GetProfiles()[_PlayerChooseButtonsVisibleProfiles[i + offset * numButtonPlayerChoose]].Avatar.Texture; + _PlayerChooseButtons[i].Button.SelTexture = + CBase.Profiles.GetProfiles()[_PlayerChooseButtonsVisibleProfiles[i + offset * numButtonPlayerChoose]].Avatar.Texture; _PlayerChooseButtons[i].Button.Color = new SColorF(1, 1, 1, 0.6f); _PlayerChooseButtons[i].Button.SelColor = new SColorF(1, 1, 1, 1); _PlayerChooseButtons[i].Button.Enabled = true; diff --git a/PartyModes/PartyModeChallenge/GlobalSuppressions.cs b/PartyModes/PartyModeChallenge/GlobalSuppressions.cs index 21fb9bcda16b8601352f60cb2b1ed3d89ecb570f..a29227bed6ce1942cf867ce73543ef7054ea8d13 100644 GIT binary patch literal 1822 zcmbW2UvE-D5XI-&#P6`7FRf`nW8#A~CWul^plyWOG{y)1T*{3IgnJSB^6Kx*-djLO zOvvW4yR)-1XU@zHe}13X!V-J1)MhrdU=vmYBvZ@yeQHmv#t3}RwsrxDM%TvZXRJod z6K;fJKery1bM`aNf_-5gAe-3IexX<0vbOP3+Wl9%v^sLM@{+mT+*a-ADgIzL;OG}j2W#PT!?;k%()>{;b3a35{e#F#Z%t4nj9?wdvEe3I6G_D0 z18>arIhqOUcwY?sbc|VX9_%Hu-H3Lv%7VDtXX}(G#Bj`rY|n_O^nAu%+^?A@t{EBK z^?zK29Ll%2OYx^%#hi^DPt4x9z#22WLUZC->N}T9vXM{|OJwHCCsW#;q9W)Ad;5vB)vs?gIv{!xKZuTk|Jh(Cd)p64a|Pv5wAPSqVEyAx+m8CGq@j-a=e`d-ZT_y*jXKeD>1 zl4By+=Rt2?z4ZZ4W#$j{!vN>%lvA{GYE4l@hTjlP&Y08X)Qwj@s#u&-K~?k@tZQB` zn@*A;dAq|`poiDIYEH1M-nZTRg!zNL&bK%gwu zxus}zNB;^JZcjG9BF`AIqt3VXe%-;>oFNoCZ5OkABz9^QB=WJqe%bGZLfWb0s5nm* q5Y+93J?DFc&fNL?=fqAdvkz8TX+baJ!a9vAjqmhrZLZNTyR}CDxprFp-)qje&}v~f zcHdiXZ0-9qt+w*B*8Y!?-Bc?pJ*{kmp0oa6=u~M(I{Dn52@|L$vhQ@VvP)Tk2^_?~ z)3@>XoxO7J;Lj9uZHw)ke1c}5WN~XhHCxIHr@&P1cp+CjlT%~IBNU%CCpLSnJ=m4J z#H=_u#N3Ti3N!nlx>m$E%Y3c#Sc%D{)++b(RsT|4W<9s?Jg@-*Jl!}NA}6~bK10-22KDkA61es?9`J=d0 z-2YXGuiP16ms`4ziR5>{o7+d(9O6I7W9kI?Nbxbh58Ip$sZH*Ychuwdt({dWeZT%u z%cp7}Rv*eyA9Rq(=Dc2dtmm3OWq+jH-=rTd?LNP(X9Yo`#QZ57&du^wB-^erd*GjX=PR!VeXR_>6tGj#m_C;P> M_e(#{?WKLUf2w^74FCWD diff --git a/PartyModes/PartyModeChallengeMedley/CChallengeRounds.cs b/PartyModes/PartyModeChallengeMedley/CChallengeRounds.cs index 37ff59f5..1305ea98 100644 --- a/PartyModes/PartyModeChallengeMedley/CChallengeRounds.cs +++ b/PartyModes/PartyModeChallengeMedley/CChallengeRounds.cs @@ -1,4 +1,23 @@ -using System; +#region license +// /* +// This file is part of Vocaluxe. +// +// Vocaluxe is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Vocaluxe is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with Vocaluxe. If not, see . +// */ +#endregion + +using System; using System.Collections.Generic; namespace VocaluxeLib.PartyModes.ChallengeMedley diff --git a/PartyModes/PartyModeChallengeMedley/CPartyModeChallengeMedley.cs b/PartyModes/PartyModeChallengeMedley/CPartyModeChallengeMedley.cs index 5bfb505e..96e0e952 100644 --- a/PartyModes/PartyModeChallengeMedley/CPartyModeChallengeMedley.cs +++ b/PartyModes/PartyModeChallengeMedley/CPartyModeChallengeMedley.cs @@ -1,3 +1,22 @@ +#region license +// /* +// This file is part of Vocaluxe. +// +// Vocaluxe is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Vocaluxe is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with Vocaluxe. If not, see . +// */ +#endregion + using System; using System.Collections.Generic; using System.Runtime.InteropServices; diff --git a/PartyModes/PartyModeChallengeMedley/CPartyScreenChallengeMedleyConfig.cs b/PartyModes/PartyModeChallengeMedley/CPartyScreenChallengeMedleyConfig.cs index 111049b5..b7a9578b 100644 --- a/PartyModes/PartyModeChallengeMedley/CPartyScreenChallengeMedleyConfig.cs +++ b/PartyModes/PartyModeChallengeMedley/CPartyScreenChallengeMedleyConfig.cs @@ -1,3 +1,22 @@ +#region license +// /* +// This file is part of Vocaluxe. +// +// Vocaluxe is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Vocaluxe is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with Vocaluxe. If not, see . +// */ +#endregion + using System; using System.Windows.Forms; using VocaluxeLib.Menu; diff --git a/PartyModes/PartyModeChallengeMedley/CPartyScreenChallengeMedleyMain.cs b/PartyModes/PartyModeChallengeMedley/CPartyScreenChallengeMedleyMain.cs index 4a0dd98f..dc61bbec 100644 --- a/PartyModes/PartyModeChallengeMedley/CPartyScreenChallengeMedleyMain.cs +++ b/PartyModes/PartyModeChallengeMedley/CPartyScreenChallengeMedleyMain.cs @@ -1,3 +1,22 @@ +#region license +// /* +// This file is part of Vocaluxe. +// +// Vocaluxe is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Vocaluxe is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with Vocaluxe. If not, see . +// */ +#endregion + using System; using System.Collections.Generic; using System.Windows.Forms; @@ -87,11 +106,15 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley _ThemeTexts = new string[] { - _TextPosition, _TextPlayerName, _TextNumPlayed, _TextWon, _TextSingPoints, _TextGamePoints, _TextNextPlayer, _TextPopupReallyExit, _TextRoundNumber, _TextRoundPlayer, + _TextPosition, _TextPlayerName, _TextNumPlayed, _TextWon, _TextSingPoints, _TextGamePoints, _TextNextPlayer, _TextPopupReallyExit, _TextRoundNumber, + _TextRoundPlayer, _TextRoundScore, _TextFinishMessage, _TextFinishPlayerWin, _TextNextPlayerMessage }; _ThemeButtons = new string[] - {_ButtonNextRound, _ButtonBack, _ButtonExit, _ButtonPopupYes, _ButtonPopupNo, _ButtonPlayerScrollDown, _ButtonPlayerScrollUp, _ButtonRoundsScrollDown, _ButtonRoundsScrollUp}; + { + _ButtonNextRound, _ButtonBack, _ButtonExit, _ButtonPopupYes, _ButtonPopupNo, _ButtonPlayerScrollDown, _ButtonPlayerScrollUp, _ButtonRoundsScrollDown, + _ButtonRoundsScrollUp + }; _ThemeStatics = new string[] {_StaticPopupBG, _StaticNextPlayer}; } @@ -454,7 +477,7 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley { //Player float x = numberX + 15 + (CBase.Settings.GetRenderW() - Texts[_TextRoundNumber].X - 20) / numPlayerInThisRow * (column - row * numPlayerInOneRow) + - ((CBase.Settings.GetRenderW() - Texts[_TextRoundNumber].X - 20) / numPlayerInThisRow) / 2; + ((CBase.Settings.GetRenderW() - Texts[_TextRoundNumber].X - 20) / numPlayerInThisRow) / 2; float maxw = ((CBase.Settings.GetRenderW() - Texts[_TextRoundNumber].X - 20) / numPlayerInThisRow) / 2 - 5; _RoundsTable[round].TextPlayer[column].X = x; _RoundsTable[round].TextPlayer[column].Y = numberY; diff --git a/PartyModes/PartyModeChallengeMedley/CPartyScreenChallengeMedleyNames.cs b/PartyModes/PartyModeChallengeMedley/CPartyScreenChallengeMedleyNames.cs index 45626757..4b10b5ca 100644 --- a/PartyModes/PartyModeChallengeMedley/CPartyScreenChallengeMedleyNames.cs +++ b/PartyModes/PartyModeChallengeMedley/CPartyScreenChallengeMedleyNames.cs @@ -1,3 +1,22 @@ +#region license +// /* +// This file is part of Vocaluxe. +// +// Vocaluxe is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Vocaluxe is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with Vocaluxe. If not, see . +// */ +#endregion + using System; using System.Collections.Generic; using System.Windows.Forms; @@ -341,8 +360,10 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley { _PlayerChooseButtons[i].ProfileID = _PlayerChooseButtonsVisibleProfiles[i + offset * numButtonPlayerChoose]; _PlayerChooseButtons[i].Button.Text.Text = CBase.Profiles.GetProfiles()[_PlayerChooseButtonsVisibleProfiles[i + offset * numButtonPlayerChoose]].PlayerName; - _PlayerChooseButtons[i].Button.Texture = CBase.Profiles.GetProfiles()[_PlayerChooseButtonsVisibleProfiles[i + offset * numButtonPlayerChoose]].Avatar.Texture; - _PlayerChooseButtons[i].Button.SelTexture = CBase.Profiles.GetProfiles()[_PlayerChooseButtonsVisibleProfiles[i + offset * numButtonPlayerChoose]].Avatar.Texture; + _PlayerChooseButtons[i].Button.Texture = + CBase.Profiles.GetProfiles()[_PlayerChooseButtonsVisibleProfiles[i + offset * numButtonPlayerChoose]].Avatar.Texture; + _PlayerChooseButtons[i].Button.SelTexture = + CBase.Profiles.GetProfiles()[_PlayerChooseButtonsVisibleProfiles[i + offset * numButtonPlayerChoose]].Avatar.Texture; _PlayerChooseButtons[i].Button.Color = new SColorF(1, 1, 1, 0.6f); _PlayerChooseButtons[i].Button.SelColor = new SColorF(1, 1, 1, 1); _PlayerChooseButtons[i].Button.Enabled = true; diff --git a/PartyModes/PartyModeChallengeMedley/GlobalSuppressions.cs b/PartyModes/PartyModeChallengeMedley/GlobalSuppressions.cs index 21fb9bcda16b8601352f60cb2b1ed3d89ecb570f..a29227bed6ce1942cf867ce73543ef7054ea8d13 100644 GIT binary patch literal 1822 zcmbW2UvE-D5XI-&#P6`7FRf`nW8#A~CWul^plyWOG{y)1T*{3IgnJSB^6Kx*-djLO zOvvW4yR)-1XU@zHe}13X!V-J1)MhrdU=vmYBvZ@yeQHmv#t3}RwsrxDM%TvZXRJod z6K;fJKery1bM`aNf_-5gAe-3IexX<0vbOP3+Wl9%v^sLM@{+mT+*a-ADgIzL;OG}j2W#PT!?;k%()>{;b3a35{e#F#Z%t4nj9?wdvEe3I6G_D0 z18>arIhqOUcwY?sbc|VX9_%Hu-H3Lv%7VDtXX}(G#Bj`rY|n_O^nAu%+^?A@t{EBK z^?zK29Ll%2OYx^%#hi^DPt4x9z#22WLUZC->N}T9vXM{|OJwHCCsW#;q9W)Ad;5vB)vs?gIv{!xKZuTk|Jh(Cd)p64a|Pv5wAPSqVEyAx+m8CGq@j-a=e`d-ZT_y*jXKeD>1 zl4By+=Rt2?z4ZZ4W#$j{!vN>%lvA{GYE4l@hTjlP&Y08X)Qwj@s#u&-K~?k@tZQB` zn@*A;dAq|`poiDIYEH1M-nZTRg!zNL&bK%gwu zxus}zNB;^JZcjG9BF`AIqt3VXe%-;>oFNoCZ5OkABz9^QB=WJqe%bGZLfWb0s5nm* q5Y+93J?DFc&fNL?=fqAdvkz8TX+baJ!a9vAjqmhrZLZNTyR}CDxprFp-)qje&}v~f zcHdiXZ0-9qt+w*B*8Y!?-Bc?pJ*{kmp0oa6=u~M(I{Dn52@|L$vhQ@VvP)Tk2^_?~ z)3@>XoxO7J;Lj9uZHw)ke1c}5WN~XhHCxIHr@&P1cp+CjlT%~IBNU%CCpLSnJ=m4J z#H=_u#N3Ti3N!nlx>m$E%Y3c#Sc%D{)++b(RsT|4W<9s?Jg@-*Jl!}NA}6~bK10-22KDkA61es?9`J=d0 z-2YXGuiP16ms`4ziR5>{o7+d(9O6I7W9kI?Nbxbh58Ip$sZH*Ychuwdt({dWeZT%u z%cp7}Rv*eyA9Rq(=Dc2dtmm3OWq+jH-=rTd?LNP(X9Yo`#QZ57&du^wB-^erd*GjX=PR!VeXR_>6tGj#m_C;P> M_e(#{?WKLUf2w^74FCWD diff --git a/PartyModes/PartyModeTicTacToe/CPartyModeTicTacToe.cs b/PartyModes/PartyModeTicTacToe/CPartyModeTicTacToe.cs index 9adddc16..12b79aad 100644 --- a/PartyModes/PartyModeTicTacToe/CPartyModeTicTacToe.cs +++ b/PartyModes/PartyModeTicTacToe/CPartyModeTicTacToe.cs @@ -1,3 +1,22 @@ +#region license +// /* +// This file is part of Vocaluxe. +// +// Vocaluxe is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Vocaluxe is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with Vocaluxe. If not, see . +// */ +#endregion + using System; using System.Collections.Generic; using System.Runtime.InteropServices; diff --git a/PartyModes/PartyModeTicTacToe/CPartyScreenTicTacToeConfig.cs b/PartyModes/PartyModeTicTacToe/CPartyScreenTicTacToeConfig.cs index a1af9b1b..b2cf7f3f 100644 --- a/PartyModes/PartyModeTicTacToe/CPartyScreenTicTacToeConfig.cs +++ b/PartyModes/PartyModeTicTacToe/CPartyScreenTicTacToeConfig.cs @@ -1,3 +1,22 @@ +#region license +// /* +// This file is part of Vocaluxe. +// +// Vocaluxe is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Vocaluxe is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with Vocaluxe. If not, see . +// */ +#endregion + using System; using System.Windows.Forms; using VocaluxeLib.Menu; @@ -31,7 +50,10 @@ namespace VocaluxeLib.PartyModes.TicTacToe base.Init(); _ThemeSelectSlides = new string[] - {_SelectSlideNumPlayerTeam1, _SelectSlideNumPlayerTeam2, _SelectSlideNumFields, _SelectSlideSongSource, _SelectSlidePlaylist, _SelectSlideCategory, _SelectSlideGameMode}; + { + _SelectSlideNumPlayerTeam1, _SelectSlideNumPlayerTeam2, _SelectSlideNumFields, _SelectSlideSongSource, _SelectSlidePlaylist, _SelectSlideCategory, + _SelectSlideGameMode + }; _ThemeButtons = new string[] {_ButtonNext, _ButtonBack}; _Data = new SDataFromScreen(); diff --git a/PartyModes/PartyModeTicTacToe/CPartyScreenTicTacToeMain.cs b/PartyModes/PartyModeTicTacToe/CPartyScreenTicTacToeMain.cs index 3e2fe436..4bf57314 100644 --- a/PartyModes/PartyModeTicTacToe/CPartyScreenTicTacToeMain.cs +++ b/PartyModes/PartyModeTicTacToe/CPartyScreenTicTacToeMain.cs @@ -1,3 +1,22 @@ +#region license +// /* +// This file is part of Vocaluxe. +// +// Vocaluxe is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Vocaluxe is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with Vocaluxe. If not, see . +// */ +#endregion + using System; using System.Collections.Generic; using System.Windows.Forms; @@ -74,7 +93,8 @@ namespace VocaluxeLib.PartyModes.TicTacToe { base.Init(); - _ThemeTexts = new string[] {_TextPopupReallyExit, _TextTeamChoosing, _TextFinishMessage, _TextNextPlayerT1, _TextNextPlayerT2, _TextNextPlayerNameT1, _TextNextPlayerNameT2}; + _ThemeTexts = new string[] + {_TextPopupReallyExit, _TextTeamChoosing, _TextFinishMessage, _TextNextPlayerT1, _TextNextPlayerT2, _TextNextPlayerNameT1, _TextNextPlayerNameT2}; _ThemeButtons = new string[] { _ButtonNextRound, _ButtonBack, _ButtonExit, _ButtonPopupYes, _ButtonPopupNo, _ButtonField, _ButtonJokerRandomT1, _ButtonJokerRandomT2, _ButtonJokerRetryT1, @@ -335,7 +355,7 @@ namespace VocaluxeLib.PartyModes.TicTacToe { Texts[_TextFinishMessage].Color = CBase.Theme.GetPlayerColor(winner); Texts[_TextFinishMessage].Text = CBase.Language.Translate("TR_SCREENMAIN_WINNER", _PartyModeID) + " " + CBase.Language.Translate("TR_TEAM", _PartyModeID) + " " + - winner; + winner; } else { @@ -592,7 +612,7 @@ namespace VocaluxeLib.PartyModes.TicTacToe { Texts[_TextTeamChoosing].Color = CBase.Theme.GetPlayerColor(_GameData.Team + 1); Texts[_TextTeamChoosing].Text = CBase.Language.Translate("TR_TEAM", _PartyModeID) + " " + (_GameData.Team + 1) + "! " + - CBase.Language.Translate("TR_SCREENMAIN_TEAM_CHOOSE", _PartyModeID); + CBase.Language.Translate("TR_SCREENMAIN_TEAM_CHOOSE", _PartyModeID); if (_Status == EStatus.JokerRetry || _Status == EStatus.FieldChoosing) Texts[_TextTeamChoosing].Visible = true; else diff --git a/PartyModes/PartyModeTicTacToe/CPartyScreenTicTacToeNames.cs b/PartyModes/PartyModeTicTacToe/CPartyScreenTicTacToeNames.cs index 05d5eb5b..e07a5248 100644 --- a/PartyModes/PartyModeTicTacToe/CPartyScreenTicTacToeNames.cs +++ b/PartyModes/PartyModeTicTacToe/CPartyScreenTicTacToeNames.cs @@ -1,3 +1,22 @@ +#region license +// /* +// This file is part of Vocaluxe. +// +// Vocaluxe is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Vocaluxe is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with Vocaluxe. If not, see . +// */ +#endregion + using System; using System.Collections.Generic; using System.Windows.Forms; @@ -387,7 +406,7 @@ namespace VocaluxeLib.PartyModes.TicTacToe _UpdateButtonPlayerChoose(_PlayerChooseButtonsOffset); Buttons[_ButtonPlayerChooseScrollUp].Enabled = _PlayerChooseButtonsOffset > 0; Buttons[_ButtonPlayerChooseScrollDown].Enabled = _PlayerChooseButtonsVisibleProfiles.Count > - _PlayerChooseButtons.Count + _PlayerChooseButtonsOffset * _PlayerChooseButtonsNumH; + _PlayerChooseButtons.Count + _PlayerChooseButtonsOffset * _PlayerChooseButtonsNumH; } private void _UpdateButtonPlayerChoose(int offset) @@ -404,8 +423,10 @@ namespace VocaluxeLib.PartyModes.TicTacToe { _PlayerChooseButtons[i].ProfileID = _PlayerChooseButtonsVisibleProfiles[i + offset * numButtonPlayerChoose]; _PlayerChooseButtons[i].Button.Text.Text = CBase.Profiles.GetProfiles()[_PlayerChooseButtonsVisibleProfiles[i + offset * numButtonPlayerChoose]].PlayerName; - _PlayerChooseButtons[i].Button.Texture = CBase.Profiles.GetProfiles()[_PlayerChooseButtonsVisibleProfiles[i + offset * numButtonPlayerChoose]].Avatar.Texture; - _PlayerChooseButtons[i].Button.SelTexture = CBase.Profiles.GetProfiles()[_PlayerChooseButtonsVisibleProfiles[i + offset * numButtonPlayerChoose]].Avatar.Texture; + _PlayerChooseButtons[i].Button.Texture = + CBase.Profiles.GetProfiles()[_PlayerChooseButtonsVisibleProfiles[i + offset * numButtonPlayerChoose]].Avatar.Texture; + _PlayerChooseButtons[i].Button.SelTexture = + CBase.Profiles.GetProfiles()[_PlayerChooseButtonsVisibleProfiles[i + offset * numButtonPlayerChoose]].Avatar.Texture; _PlayerChooseButtons[i].Button.Color = new SColorF(1, 1, 1, 0.6f); _PlayerChooseButtons[i].Button.SelColor = new SColorF(1, 1, 1, 1); _PlayerChooseButtons[i].Button.Enabled = true; diff --git a/PartyModes/PartyModeTicTacToe/GlobalSuppressions.cs b/PartyModes/PartyModeTicTacToe/GlobalSuppressions.cs index 21fb9bcda16b8601352f60cb2b1ed3d89ecb570f..a29227bed6ce1942cf867ce73543ef7054ea8d13 100644 GIT binary patch literal 1822 zcmbW2UvE-D5XI-&#P6`7FRf`nW8#A~CWul^plyWOG{y)1T*{3IgnJSB^6Kx*-djLO zOvvW4yR)-1XU@zHe}13X!V-J1)MhrdU=vmYBvZ@yeQHmv#t3}RwsrxDM%TvZXRJod z6K;fJKery1bM`aNf_-5gAe-3IexX<0vbOP3+Wl9%v^sLM@{+mT+*a-ADgIzL;OG}j2W#PT!?;k%()>{;b3a35{e#F#Z%t4nj9?wdvEe3I6G_D0 z18>arIhqOUcwY?sbc|VX9_%Hu-H3Lv%7VDtXX}(G#Bj`rY|n_O^nAu%+^?A@t{EBK z^?zK29Ll%2OYx^%#hi^DPt4x9z#22WLUZC->N}T9vXM{|OJwHCCsW#;q9W)Ad;5vB)vs?gIv{!xKZuTk|Jh(Cd)p64a|Pv5wAPSqVEyAx+m8CGq@j-a=e`d-ZT_y*jXKeD>1 zl4By+=Rt2?z4ZZ4W#$j{!vN>%lvA{GYE4l@hTjlP&Y08X)Qwj@s#u&-K~?k@tZQB` zn@*A;dAq|`poiDIYEH1M-nZTRg!zNL&bK%gwu zxus}zNB;^JZcjG9BF`AIqt3VXe%-;>oFNoCZ5OkABz9^QB=WJqe%bGZLfWb0s5nm* q5Y+93J?DFc&fNL?=fqAdvkz8TX+baJ!a9vAjqmhrZLZNTyR}CDxprFp-)qje&}v~f zcHdiXZ0-9qt+w*B*8Y!?-Bc?pJ*{kmp0oa6=u~M(I{Dn52@|L$vhQ@VvP)Tk2^_?~ z)3@>XoxO7J;Lj9uZHw)ke1c}5WN~XhHCxIHr@&P1cp+CjlT%~IBNU%CCpLSnJ=m4J z#H=_u#N3Ti3N!nlx>m$E%Y3c#Sc%D{)++b(RsT|4W<9s?Jg@-*Jl!}NA}6~bK10-22KDkA61es?9`J=d0 z-2YXGuiP16ms`4ziR5>{o7+d(9O6I7W9kI?Nbxbh58Ip$sZH*Ychuwdt({dWeZT%u z%cp7}Rv*eyA9Rq(=Dc2dtmm3OWq+jH-=rTd?LNP(X9Yo`#QZ57&du^wB-^erd*GjX=PR!VeXR_>6tGj#m_C;P> M_e(#{?WKLUf2w^74FCWD diff --git a/Vocaluxe/Base/CBackgroundMusic.cs b/Vocaluxe/Base/CBackgroundMusic.cs index ece1cd16..d8a6239a 100644 --- a/Vocaluxe/Base/CBackgroundMusic.cs +++ b/Vocaluxe/Base/CBackgroundMusic.cs @@ -1,4 +1,23 @@ -using System; +#region license +// /* +// This file is part of Vocaluxe. +// +// Vocaluxe is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Vocaluxe is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with Vocaluxe. If not, see . +// */ +#endregion + +using System; using System.Collections.Generic; using System.Diagnostics; using System.IO; diff --git a/Vocaluxe/Base/CConfig.cs b/Vocaluxe/Base/CConfig.cs index 9ee47abf..5dcc3480 100644 --- a/Vocaluxe/Base/CConfig.cs +++ b/Vocaluxe/Base/CConfig.cs @@ -1,4 +1,23 @@ -using System; +#region license +// /* +// This file is part of Vocaluxe. +// +// Vocaluxe is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Vocaluxe is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with Vocaluxe. If not, see . +// */ +#endregion + +using System; using System.Collections.Generic; using System.IO; using System.Text; diff --git a/Vocaluxe/Base/CCover.cs b/Vocaluxe/Base/CCover.cs index 962815ae..e06c35da 100644 --- a/Vocaluxe/Base/CCover.cs +++ b/Vocaluxe/Base/CCover.cs @@ -1,4 +1,23 @@ -using System; +#region license +// /* +// This file is part of Vocaluxe. +// +// Vocaluxe is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Vocaluxe is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with Vocaluxe. If not, see . +// */ +#endregion + +using System; using System.Collections.Generic; using System.IO; using System.Text; diff --git a/Vocaluxe/Base/CDataBase.cs b/Vocaluxe/Base/CDataBase.cs index 9df5747c..555d5526 100644 --- a/Vocaluxe/Base/CDataBase.cs +++ b/Vocaluxe/Base/CDataBase.cs @@ -1,4 +1,23 @@ -using System; +#region license +// /* +// This file is part of Vocaluxe. +// +// Vocaluxe is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Vocaluxe is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with Vocaluxe. If not, see . +// */ +#endregion + +using System; using System.Collections.Generic; using System.Data; using System.Drawing; diff --git a/Vocaluxe/Base/CDraw.cs b/Vocaluxe/Base/CDraw.cs index feb52eae..65926ca4 100644 --- a/Vocaluxe/Base/CDraw.cs +++ b/Vocaluxe/Base/CDraw.cs @@ -1,4 +1,23 @@ -using System; +#region license +// /* +// This file is part of Vocaluxe. +// +// Vocaluxe is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Vocaluxe is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with Vocaluxe. If not, see . +// */ +#endregion + +using System; using System.Drawing; using System.IO; using System.Windows.Forms; diff --git a/Vocaluxe/Base/CFont.cs b/Vocaluxe/Base/CFont.cs index 3cc030d6..b2b423ad 100644 --- a/Vocaluxe/Base/CFont.cs +++ b/Vocaluxe/Base/CFont.cs @@ -1,4 +1,23 @@ -using System; +#region license +// /* +// This file is part of Vocaluxe. +// +// Vocaluxe is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Vocaluxe is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with Vocaluxe. If not, see . +// */ +#endregion + +using System; using System.Collections.Generic; using System.Drawing; using System.Drawing.Drawing2D; diff --git a/Vocaluxe/Base/CGame.cs b/Vocaluxe/Base/CGame.cs index c741659d..3a0dc567 100644 --- a/Vocaluxe/Base/CGame.cs +++ b/Vocaluxe/Base/CGame.cs @@ -1,4 +1,23 @@ -using System; +#region license +// /* +// This file is part of Vocaluxe. +// +// Vocaluxe is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Vocaluxe is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with Vocaluxe. If not, see . +// */ +#endregion + +using System; using System.Collections.Generic; using Vocaluxe.GameModes; using VocaluxeLib.Menu; diff --git a/Vocaluxe/Base/CGraphics.cs b/Vocaluxe/Base/CGraphics.cs index 860fbf15..626c0b02 100644 --- a/Vocaluxe/Base/CGraphics.cs +++ b/Vocaluxe/Base/CGraphics.cs @@ -1,4 +1,23 @@ -using System; +#region license +// /* +// This file is part of Vocaluxe. +// +// Vocaluxe is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Vocaluxe is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with Vocaluxe. If not, see . +// */ +#endregion + +using System; using System.Collections.Generic; using System.Diagnostics; using System.Drawing; diff --git a/Vocaluxe/Base/CInput.cs b/Vocaluxe/Base/CInput.cs index 8ba98ba9..606b89d5 100644 --- a/Vocaluxe/Base/CInput.cs +++ b/Vocaluxe/Base/CInput.cs @@ -1,4 +1,23 @@ -using Vocaluxe.Lib.Input; +#region license +// /* +// This file is part of Vocaluxe. +// +// Vocaluxe is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Vocaluxe is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with Vocaluxe. If not, see . +// */ +#endregion + +using Vocaluxe.Lib.Input; using Vocaluxe.Lib.Input.WiiMote; using VocaluxeLib.Menu; diff --git a/Vocaluxe/Base/CLanguage.cs b/Vocaluxe/Base/CLanguage.cs index a4d30909..66398f17 100644 --- a/Vocaluxe/Base/CLanguage.cs +++ b/Vocaluxe/Base/CLanguage.cs @@ -1,4 +1,23 @@ -using System; +#region license +// /* +// This file is part of Vocaluxe. +// +// Vocaluxe is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Vocaluxe is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with Vocaluxe. If not, see . +// */ +#endregion + +using System; using System.Collections.Generic; using System.IO; using System.Text; diff --git a/Vocaluxe/Base/CLog.cs b/Vocaluxe/Base/CLog.cs index c72f6a86..fbb08230 100644 --- a/Vocaluxe/Base/CLog.cs +++ b/Vocaluxe/Base/CLog.cs @@ -1,4 +1,23 @@ -using System; +#region license +// /* +// This file is part of Vocaluxe. +// +// Vocaluxe is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Vocaluxe is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with Vocaluxe. If not, see . +// */ +#endregion + +using System; using System.Diagnostics; using System.IO; using System.Text; diff --git a/Vocaluxe/Base/CMain.cs b/Vocaluxe/Base/CMain.cs index 1f0bc168..a42589b9 100644 --- a/Vocaluxe/Base/CMain.cs +++ b/Vocaluxe/Base/CMain.cs @@ -1,4 +1,23 @@ -using System; +#region license +// /* +// This file is part of Vocaluxe. +// +// Vocaluxe is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Vocaluxe is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with Vocaluxe. If not, see . +// */ +#endregion + +using System; using System.Collections.Generic; using System.Drawing; using VocaluxeLib.Menu; diff --git a/Vocaluxe/Base/CObservable.cs b/Vocaluxe/Base/CObservable.cs index 5308ab84..7d4497ae 100644 --- a/Vocaluxe/Base/CObservable.cs +++ b/Vocaluxe/Base/CObservable.cs @@ -1,4 +1,23 @@ -using System; +#region license +// /* +// This file is part of Vocaluxe. +// +// Vocaluxe is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Vocaluxe is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with Vocaluxe. If not, see . +// */ +#endregion + +using System; namespace Vocaluxe.Base { diff --git a/Vocaluxe/Base/CParty.cs b/Vocaluxe/Base/CParty.cs index 8328f42c..4a242d75 100644 --- a/Vocaluxe/Base/CParty.cs +++ b/Vocaluxe/Base/CParty.cs @@ -1,4 +1,23 @@ -using System; +#region license +// /* +// This file is part of Vocaluxe. +// +// Vocaluxe is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Vocaluxe is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with Vocaluxe. If not, see . +// */ +#endregion + +using System; using System.CodeDom.Compiler; using System.Collections.Generic; using System.IO; diff --git a/Vocaluxe/Base/CPlaylists.cs b/Vocaluxe/Base/CPlaylists.cs index 03532e71..ea485cac 100644 --- a/Vocaluxe/Base/CPlaylists.cs +++ b/Vocaluxe/Base/CPlaylists.cs @@ -1,4 +1,23 @@ -using System; +#region license +// /* +// This file is part of Vocaluxe. +// +// Vocaluxe is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Vocaluxe is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with Vocaluxe. If not, see . +// */ +#endregion + +using System; using System.Collections.Generic; using System.IO; using System.Text; diff --git a/Vocaluxe/Base/CProfiles.cs b/Vocaluxe/Base/CProfiles.cs index 176807e1..68edf944 100644 --- a/Vocaluxe/Base/CProfiles.cs +++ b/Vocaluxe/Base/CProfiles.cs @@ -1,4 +1,23 @@ -using System; +#region license +// /* +// This file is part of Vocaluxe. +// +// Vocaluxe is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Vocaluxe is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with Vocaluxe. If not, see . +// */ +#endregion + +using System; using System.Collections.Generic; using System.IO; using System.Text; diff --git a/Vocaluxe/Base/CSettings.cs b/Vocaluxe/Base/CSettings.cs index ff6e92fe..b2ffaf30 100644 --- a/Vocaluxe/Base/CSettings.cs +++ b/Vocaluxe/Base/CSettings.cs @@ -1,4 +1,23 @@ -using System; +#region license +// /* +// This file is part of Vocaluxe. +// +// Vocaluxe is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Vocaluxe is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with Vocaluxe. If not, see . +// */ +#endregion + +using System; using System.Collections.Generic; using System.IO; using VocaluxeLib.Menu; @@ -124,8 +143,8 @@ namespace Vocaluxe.Base public static string GetVersionText() { string version = "v" + VersionMajor.ToString() + "." + - VersionMinor.ToString() + "." + - VersionSub.ToString() + " (" + Arch + ")"; + VersionMinor.ToString() + "." + + VersionSub.ToString() + " (" + Arch + ")"; if (VersionRevision != ERevision.Release) version += " " + GetVersionStatus() + String.Format(" ({0:0000)}", Build); diff --git a/Vocaluxe/Base/CSongCategorizer.cs b/Vocaluxe/Base/CSongCategorizer.cs index c51ab696..425adf78 100644 --- a/Vocaluxe/Base/CSongCategorizer.cs +++ b/Vocaluxe/Base/CSongCategorizer.cs @@ -1,4 +1,23 @@ -using System; +#region license +// /* +// This file is part of Vocaluxe. +// +// Vocaluxe is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Vocaluxe is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with Vocaluxe. If not, see . +// */ +#endregion + +using System; using System.Collections.Generic; using System.Text; using VocaluxeLib.Menu; diff --git a/Vocaluxe/Base/CSongFilter.cs b/Vocaluxe/Base/CSongFilter.cs index 6c9ec90e..c5e6fd9f 100644 --- a/Vocaluxe/Base/CSongFilter.cs +++ b/Vocaluxe/Base/CSongFilter.cs @@ -1,4 +1,23 @@ -using System; +#region license +// /* +// This file is part of Vocaluxe. +// +// Vocaluxe is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Vocaluxe is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with Vocaluxe. If not, see . +// */ +#endregion + +using System; using System.Collections.Generic; using VocaluxeLib.Menu; using VocaluxeLib.Menu.SongMenu; diff --git a/Vocaluxe/Base/CSongSorter.cs b/Vocaluxe/Base/CSongSorter.cs index ec5a486b..5928cd58 100644 --- a/Vocaluxe/Base/CSongSorter.cs +++ b/Vocaluxe/Base/CSongSorter.cs @@ -1,4 +1,23 @@ -using System; +#region license +// /* +// This file is part of Vocaluxe. +// +// Vocaluxe is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Vocaluxe is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with Vocaluxe. If not, see . +// */ +#endregion + +using System; using System.Collections.Generic; using System.Reflection; using VocaluxeLib.Menu; diff --git a/Vocaluxe/Base/CSongs.cs b/Vocaluxe/Base/CSongs.cs index 8aa56dd6..d21de91a 100644 --- a/Vocaluxe/Base/CSongs.cs +++ b/Vocaluxe/Base/CSongs.cs @@ -1,8 +1,26 @@ -using System; +#region license +// /* +// This file is part of Vocaluxe. +// +// Vocaluxe is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Vocaluxe is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with Vocaluxe. If not, see . +// */ +#endregion + +using System; using System.Collections.Generic; using System.Diagnostics; using System.Threading; - using VocaluxeLib.Menu; using VocaluxeLib.Menu.SongMenu; @@ -44,7 +62,7 @@ namespace Vocaluxe.Base public static CSongSorter Sorter = new CSongSorter(); public static CSongCategorizer Categorizer = new CSongCategorizer(); - private static Thread _CoverLoaderThread = null; + private static Thread _CoverLoaderThread; public static List Songs { @@ -394,7 +412,7 @@ namespace Vocaluxe.Base if (song != null) { song.ID = _Songs.Count; - if(song.ReadNotes()) + if (song.ReadNotes()) _Songs.Add(song); } } @@ -429,7 +447,7 @@ namespace Vocaluxe.Base if (_CoverLoaderThread == null) { - _CoverLoaderThread = new Thread(new ThreadStart(_LoadCover)); + _CoverLoaderThread = new Thread(_LoadCover); _CoverLoaderThread.Name = "CoverLoader"; _CoverLoaderThread.Priority = ThreadPriority.BelowNormal; _CoverLoaderThread.IsBackground = true; diff --git a/Vocaluxe/Base/CSound.cs b/Vocaluxe/Base/CSound.cs index 2f5bf1cb..6cb30fc7 100644 --- a/Vocaluxe/Base/CSound.cs +++ b/Vocaluxe/Base/CSound.cs @@ -1,4 +1,23 @@ -using System; +#region license +// /* +// This file is part of Vocaluxe. +// +// Vocaluxe is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Vocaluxe is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with Vocaluxe. If not, see . +// */ +#endregion + +using System; using System.Diagnostics; using System.IO; using Vocaluxe.Lib.Sound; diff --git a/Vocaluxe/Base/CTheme.cs b/Vocaluxe/Base/CTheme.cs index bd4ec83f..e1969bfd 100644 --- a/Vocaluxe/Base/CTheme.cs +++ b/Vocaluxe/Base/CTheme.cs @@ -1,4 +1,23 @@ -using System; +#region license +// /* +// This file is part of Vocaluxe. +// +// Vocaluxe is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Vocaluxe is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with Vocaluxe. If not, see . +// */ +#endregion + +using System; using System.Collections.Generic; using System.IO; using System.Text; diff --git a/Vocaluxe/Base/CUtility.cs b/Vocaluxe/Base/CUtility.cs index 2bda8739..4a2f105e 100644 --- a/Vocaluxe/Base/CUtility.cs +++ b/Vocaluxe/Base/CUtility.cs @@ -1,4 +1,23 @@ -using System; +#region license +// /* +// This file is part of Vocaluxe. +// +// Vocaluxe is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Vocaluxe is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with Vocaluxe. If not, see . +// */ +#endregion + +using System; using System.Collections.Generic; using System.Diagnostics; using System.Windows.Forms; @@ -261,14 +280,14 @@ namespace Vocaluxe.Base { _CheckModifiers(); _Add(_ModAlt, _ModShift, _ModCtrl, e.X, e.Y, false, false, false, e.Delta, e.Button == MouseButtons.Left, e.Button == MouseButtons.Right, - false, e.Button == MouseButtons.Middle); + false, e.Button == MouseButtons.Middle); } public void MouseWheel(MouseEventArgs e) { _CheckModifiers(); _Add(_ModAlt, _ModShift, _ModCtrl, e.X, e.Y, false, false, false, e.Delta, e.Button == MouseButtons.Left, e.Button == MouseButtons.Right, - false, e.Button == MouseButtons.Middle); + false, e.Button == MouseButtons.Middle); } public void MouseDown(MouseEventArgs e) @@ -294,7 +313,7 @@ namespace Vocaluxe.Base _Timer.Reset(); _Add(_ModAlt, _ModShift, _ModCtrl, e.X, e.Y, lb, ld, e.Button == MouseButtons.Right, e.Delta, false, false, - e.Button == MouseButtons.Middle, false); + e.Button == MouseButtons.Middle, false); } public void MouseUp(MouseEventArgs e) diff --git a/Vocaluxe/Base/CVideo.cs b/Vocaluxe/Base/CVideo.cs index bd4e136a..ee8185a8 100644 --- a/Vocaluxe/Base/CVideo.cs +++ b/Vocaluxe/Base/CVideo.cs @@ -1,4 +1,23 @@ -using System.Diagnostics; +#region license +// /* +// This file is part of Vocaluxe. +// +// Vocaluxe is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Vocaluxe is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with Vocaluxe. If not, see . +// */ +#endregion + +using System.Diagnostics; using System.Drawing; using Vocaluxe.Lib.Video; using VocaluxeLib.Menu; diff --git a/Vocaluxe/Base/CWebcam.cs b/Vocaluxe/Base/CWebcam.cs index 8d481d65..74995990 100644 --- a/Vocaluxe/Base/CWebcam.cs +++ b/Vocaluxe/Base/CWebcam.cs @@ -1,4 +1,23 @@ -using System.Drawing; +#region license +// /* +// This file is part of Vocaluxe. +// +// Vocaluxe is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Vocaluxe is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with Vocaluxe. If not, see . +// */ +#endregion + +using System.Drawing; using Vocaluxe.Lib.Webcam; using VocaluxeLib.Menu; diff --git a/Vocaluxe/CSplashScreen.cs b/Vocaluxe/CSplashScreen.cs index e6206794..69bc6e20 100644 --- a/Vocaluxe/CSplashScreen.cs +++ b/Vocaluxe/CSplashScreen.cs @@ -1,4 +1,23 @@ -using System; +#region license +// /* +// This file is part of Vocaluxe. +// +// Vocaluxe is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Vocaluxe is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with Vocaluxe. If not, see . +// */ +#endregion + +using System; using System.Drawing; using System.IO; using System.Windows.Forms; diff --git a/Vocaluxe/GameModes/CGameMode.cs b/Vocaluxe/GameModes/CGameMode.cs index b4e2ca55..6ec72aa3 100644 --- a/Vocaluxe/GameModes/CGameMode.cs +++ b/Vocaluxe/GameModes/CGameMode.cs @@ -1,4 +1,23 @@ -using System.Collections.Generic; +#region license +// /* +// This file is part of Vocaluxe. +// +// Vocaluxe is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Vocaluxe is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with Vocaluxe. If not, see . +// */ +#endregion + +using System.Collections.Generic; using Vocaluxe.Base; using VocaluxeLib.Menu; using VocaluxeLib.Menu.SongMenu; diff --git a/Vocaluxe/GameModes/CGameModeNormal.cs b/Vocaluxe/GameModes/CGameModeNormal.cs index 0178569b..4c600306 100644 --- a/Vocaluxe/GameModes/CGameModeNormal.cs +++ b/Vocaluxe/GameModes/CGameModeNormal.cs @@ -1,4 +1,23 @@ -namespace Vocaluxe.GameModes +#region license +// /* +// This file is part of Vocaluxe. +// +// Vocaluxe is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Vocaluxe is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with Vocaluxe. If not, see . +// */ +#endregion + +namespace Vocaluxe.GameModes { // Nomal singing class CGameModeNormal : CGameMode diff --git a/Vocaluxe/GameModes/IGameMode.cs b/Vocaluxe/GameModes/IGameMode.cs index 16db3898..b9732b15 100644 --- a/Vocaluxe/GameModes/IGameMode.cs +++ b/Vocaluxe/GameModes/IGameMode.cs @@ -1,4 +1,23 @@ -using VocaluxeLib.Menu; +#region license +// /* +// This file is part of Vocaluxe. +// +// Vocaluxe is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Vocaluxe is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with Vocaluxe. If not, see . +// */ +#endregion + +using VocaluxeLib.Menu; using VocaluxeLib.Menu.SongMenu; namespace Vocaluxe.GameModes diff --git a/Vocaluxe/GlobalSuppressions.cs b/Vocaluxe/GlobalSuppressions.cs index b6e8fd45..ed290a90 100644 --- a/Vocaluxe/GlobalSuppressions.cs +++ b/Vocaluxe/GlobalSuppressions.cs @@ -1,12 +1,22 @@ -// Diese Datei wird von der Codeanalyse zur Wartung der SuppressMessage- -// Attribute verwendet, die auf dieses Projekt angewendet werden. -// Unterdrückungen auf Projektebene haben entweder kein Ziel oder -// erhalten ein spezifisches Ziel mit Namespace-, Typ-, Memberbereich usw. -// -// Wenn Sie dieser Datei eine Unterdrückung hinzufügen möchten, klicken Sie mit der -// rechten Maustaste auf die Meldung in der Fehlerliste, zeigen Sie auf -// "Meldung(en) unterdrücken", und klicken Sie auf "In Projektunterdrückungsdatei". -// Sie müssen dieser Datei nicht manuell Unterdrückungen hinzufügen. +#region license +// /* +// This file is part of Vocaluxe. +// +// Vocaluxe is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Vocaluxe is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with Vocaluxe. If not, see . +// */ +#endregion + using System.Diagnostics.CodeAnalysis; [assembly: diff --git a/Vocaluxe/Lib/Draw/CDrawWinForm.cs b/Vocaluxe/Lib/Draw/CDrawWinForm.cs index 2c0741b3..7271298b 100644 --- a/Vocaluxe/Lib/Draw/CDrawWinForm.cs +++ b/Vocaluxe/Lib/Draw/CDrawWinForm.cs @@ -1,4 +1,23 @@ -using System; +#region license +// /* +// This file is part of Vocaluxe. +// +// Vocaluxe is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Vocaluxe is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with Vocaluxe. If not, see . +// */ +#endregion + +using System; using System.Collections.Generic; using System.ComponentModel; using System.Drawing; @@ -437,7 +456,7 @@ namespace Vocaluxe.Lib.Draw if ((texture.Index >= 0) && (_Textures.Count > 0) && (_Bitmaps.Count > texture.Index)) { BitmapData bmpData = _Bitmaps[texture.Index].LockBits(new Rectangle(0, 0, _Bitmaps[texture.Index].Width, _Bitmaps[texture.Index].Height), - ImageLockMode.ReadWrite, PixelFormat.Format32bppArgb); + ImageLockMode.ReadWrite, PixelFormat.Format32bppArgb); Marshal.Copy(data, 0, bmpData.Scan0, data.Length); _Bitmaps[texture.Index].UnlockBits(bmpData); } diff --git a/Vocaluxe/Lib/Draw/COpenGL.cs b/Vocaluxe/Lib/Draw/COpenGL.cs index 1de47f3d..145c0f6c 100644 --- a/Vocaluxe/Lib/Draw/COpenGL.cs +++ b/Vocaluxe/Lib/Draw/COpenGL.cs @@ -1,4 +1,23 @@ -using System.Drawing.Drawing2D; +#region license +// /* +// This file is part of Vocaluxe. +// +// Vocaluxe is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Vocaluxe is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with Vocaluxe. If not, see . +// */ +#endregion + +using System.Drawing.Drawing2D; using System.Threading; using OpenTK; using OpenTK.Graphics; diff --git a/Vocaluxe/Lib/Draw/IDraw.cs b/Vocaluxe/Lib/Draw/IDraw.cs index 6b55cbb1..79c60e28 100644 --- a/Vocaluxe/Lib/Draw/IDraw.cs +++ b/Vocaluxe/Lib/Draw/IDraw.cs @@ -1,4 +1,23 @@ -using System; +#region license +// /* +// This file is part of Vocaluxe. +// +// Vocaluxe is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Vocaluxe is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with Vocaluxe. If not, see . +// */ +#endregion + +using System; using System.Drawing; using VocaluxeLib.Menu; diff --git a/Vocaluxe/Lib/Input/CHIDAPI.cs b/Vocaluxe/Lib/Input/CHIDAPI.cs index 12caadf1..4c122ea8 100644 --- a/Vocaluxe/Lib/Input/CHIDAPI.cs +++ b/Vocaluxe/Lib/Input/CHIDAPI.cs @@ -1,4 +1,23 @@ -using System; +#region license +// /* +// This file is part of Vocaluxe. +// +// Vocaluxe is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Vocaluxe is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with Vocaluxe. If not, see . +// */ +#endregion + +using System; using System.Runtime.InteropServices; using Vocaluxe.Base; diff --git a/Vocaluxe/Lib/Input/IInput.cs b/Vocaluxe/Lib/Input/IInput.cs index e81c0509..e3d0162c 100644 --- a/Vocaluxe/Lib/Input/IInput.cs +++ b/Vocaluxe/Lib/Input/IInput.cs @@ -1,4 +1,23 @@ -using System; +#region license +// /* +// This file is part of Vocaluxe. +// +// Vocaluxe is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Vocaluxe is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with Vocaluxe. If not, see . +// */ +#endregion + +using System; using System.Diagnostics; using System.Drawing; using VocaluxeLib.Menu; diff --git a/Vocaluxe/Lib/Input/WiiMote/CWiiMote.cs b/Vocaluxe/Lib/Input/WiiMote/CWiiMote.cs index f93b0c46..0f8fa347 100644 --- a/Vocaluxe/Lib/Input/WiiMote/CWiiMote.cs +++ b/Vocaluxe/Lib/Input/WiiMote/CWiiMote.cs @@ -1,4 +1,23 @@ -using System; +#region license +// /* +// This file is part of Vocaluxe. +// +// Vocaluxe is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Vocaluxe is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with Vocaluxe. If not, see . +// */ +#endregion + +using System; using System.Collections.Generic; using System.Drawing; using System.Threading; diff --git a/Vocaluxe/Lib/Input/WiiMote/WiiMoteLib.cs b/Vocaluxe/Lib/Input/WiiMote/WiiMoteLib.cs index 9ac7d4d6..1119da98 100644 --- a/Vocaluxe/Lib/Input/WiiMote/WiiMoteLib.cs +++ b/Vocaluxe/Lib/Input/WiiMote/WiiMoteLib.cs @@ -1,4 +1,23 @@ -using System; +#region license +// /* +// This file is part of Vocaluxe. +// +// Vocaluxe is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Vocaluxe is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with Vocaluxe. If not, see . +// */ +#endregion + +using System; using System.Drawing; using System.Threading; using Vocaluxe.Base; @@ -116,9 +135,9 @@ namespace Vocaluxe.Lib.Input.WiiMote public class CWiiMoteLib : IDisposable { -// ReSharper disable InconsistentNaming + // ReSharper disable InconsistentNaming private const ushort _VID = 0x057e; -// ReSharper restore InconsistentNaming + // ReSharper restore InconsistentNaming private const ushort _PID = 0x0306; //Wiimotion private const ushort _PIDPlus = 0x0330; //Wiimotion Plus @@ -133,9 +152,9 @@ namespace Vocaluxe.Lib.Input.WiiMote // output commands private enum EOutputReport : byte { -// ReSharper disable InconsistentNaming + // ReSharper disable InconsistentNaming LEDs = 0x11, -// ReSharper restore InconsistentNaming + // ReSharper restore InconsistentNaming Type = 0x12, IR = 0x13, Status = 0x15, @@ -667,9 +686,9 @@ namespace Vocaluxe.Lib.Input.WiiMote GC.SuppressFinalize(this); } -// ReSharper disable InconsistentNaming + // ReSharper disable InconsistentNaming protected virtual void Dispose(bool disposing) -// ReSharper restore InconsistentNaming + // ReSharper restore InconsistentNaming { if (disposing) { diff --git a/Vocaluxe/Lib/Playlist/CPlaylistFile.cs b/Vocaluxe/Lib/Playlist/CPlaylistFile.cs index 6959db3b..b73f2883 100644 --- a/Vocaluxe/Lib/Playlist/CPlaylistFile.cs +++ b/Vocaluxe/Lib/Playlist/CPlaylistFile.cs @@ -1,4 +1,23 @@ -using System; +#region license +// /* +// This file is part of Vocaluxe. +// +// Vocaluxe is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Vocaluxe is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with Vocaluxe. If not, see . +// */ +#endregion + +using System; using System.Collections.Generic; using System.IO; using System.Text; diff --git a/Vocaluxe/Lib/Sound/CDirectSoundRecord.cs b/Vocaluxe/Lib/Sound/CDirectSoundRecord.cs index 6ef21510..55ee2f89 100644 --- a/Vocaluxe/Lib/Sound/CDirectSoundRecord.cs +++ b/Vocaluxe/Lib/Sound/CDirectSoundRecord.cs @@ -1,4 +1,23 @@ -using SlimDX.DirectSound; +#region license +// /* +// This file is part of Vocaluxe. +// +// Vocaluxe is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Vocaluxe is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with Vocaluxe. If not, see . +// */ +#endregion + +using SlimDX.DirectSound; using SlimDX.Multimedia; using System; using System.Collections.Generic; @@ -265,8 +284,8 @@ namespace Vocaluxe.Lib.Sound public CSoundCardSource(Guid guid, short channels) { - this._Guid = guid; - this._Channels = channels; + _Guid = guid; + _Channels = channels; _WaveFormat = new WaveFormat(); SampleRateKhz = 44.1; _BufferSize = 2048; @@ -400,9 +419,9 @@ namespace Vocaluxe.Lib.Sound GC.SuppressFinalize(this); } -// ReSharper disable InconsistentNaming + // ReSharper disable InconsistentNaming protected virtual void Dispose(bool disposing) -// ReSharper restore InconsistentNaming + // ReSharper restore InconsistentNaming { if (disposing) { diff --git a/Vocaluxe/Lib/Sound/CGstreamerAudio.cs b/Vocaluxe/Lib/Sound/CGstreamerAudio.cs index e2b180a0..4adc2bbc 100644 --- a/Vocaluxe/Lib/Sound/CGstreamerAudio.cs +++ b/Vocaluxe/Lib/Sound/CGstreamerAudio.cs @@ -1,4 +1,23 @@ -using System; +#region license +// /* +// This file is part of Vocaluxe. +// +// Vocaluxe is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Vocaluxe is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with Vocaluxe. If not, see . +// */ +#endregion + +using System; using Vocaluxe.Base; using Vocaluxe.Lib.Sound.Gstreamer; @@ -7,6 +26,7 @@ namespace Vocaluxe.Lib.Sound class CGstreamerAudio : IPlayback { //static float LastPosition; + #region log public CGstreamerAudioWrapper.LogCallback Log; diff --git a/Vocaluxe/Lib/Sound/COpenALPlay.cs b/Vocaluxe/Lib/Sound/COpenALPlay.cs index 18518cac..9f21a4f7 100644 --- a/Vocaluxe/Lib/Sound/COpenALPlay.cs +++ b/Vocaluxe/Lib/Sound/COpenALPlay.cs @@ -1,4 +1,23 @@ -using OpenTK.Audio; +#region license +// /* +// This file is part of Vocaluxe. +// +// Vocaluxe is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Vocaluxe is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with Vocaluxe. If not, see . +// */ +#endregion + +using OpenTK.Audio; using System; using System.Collections.Generic; using System.Diagnostics; @@ -422,7 +441,7 @@ namespace Vocaluxe.Lib.Sound _Closeproc = closeProc; _StreamID = streamID; _Terminated = true; - this._CloseMutex = closeMutex; + _CloseMutex = closeMutex; } public float Length diff --git a/Vocaluxe/Lib/Sound/COpenALRecord.cs b/Vocaluxe/Lib/Sound/COpenALRecord.cs index 16afc859..92766765 100644 --- a/Vocaluxe/Lib/Sound/COpenALRecord.cs +++ b/Vocaluxe/Lib/Sound/COpenALRecord.cs @@ -1,4 +1,23 @@ -namespace Vocaluxe.Lib.Sound +#region license +// /* +// This file is part of Vocaluxe. +// +// Vocaluxe is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Vocaluxe is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with Vocaluxe. If not, see . +// */ +#endregion + +namespace Vocaluxe.Lib.Sound { class COpenALRecord {} } \ No newline at end of file diff --git a/Vocaluxe/Lib/Sound/CPortAudioPlay.cs b/Vocaluxe/Lib/Sound/CPortAudioPlay.cs index 1c498b0a..26fdf3eb 100644 --- a/Vocaluxe/Lib/Sound/CPortAudioPlay.cs +++ b/Vocaluxe/Lib/Sound/CPortAudioPlay.cs @@ -1,4 +1,23 @@ -using PortAudioSharp; +#region license +// /* +// This file is part of Vocaluxe. +// +// Vocaluxe is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Vocaluxe is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with Vocaluxe. If not, see . +// */ +#endregion + +using PortAudioSharp; using System; using System.Collections.Generic; using System.Diagnostics; @@ -354,7 +373,6 @@ namespace Vocaluxe.Lib.Sound private static CPortAudio.SPaDeviceInfo _OutputDeviceInfo; private IntPtr _Ptr = new IntPtr(0); - private Closeproc _Closeproc; private CPortAudio.PaStreamCallbackDelegate _PaStreamCallback; private int _StreamID; diff --git a/Vocaluxe/Lib/Sound/CPortAudioRecord.cs b/Vocaluxe/Lib/Sound/CPortAudioRecord.cs index 03a1063f..cbdc04c0 100644 --- a/Vocaluxe/Lib/Sound/CPortAudioRecord.cs +++ b/Vocaluxe/Lib/Sound/CPortAudioRecord.cs @@ -1,4 +1,23 @@ -using System.Threading; +#region license +// /* +// This file is part of Vocaluxe. +// +// Vocaluxe is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Vocaluxe is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with Vocaluxe. If not, see . +// */ +#endregion + +using System.Threading; using PortAudioSharp; using System; using System.Collections.Generic; diff --git a/Vocaluxe/Lib/Sound/Decoder/CAudioDecoder.cs b/Vocaluxe/Lib/Sound/Decoder/CAudioDecoder.cs index 695337cd..128d7ed2 100644 --- a/Vocaluxe/Lib/Sound/Decoder/CAudioDecoder.cs +++ b/Vocaluxe/Lib/Sound/Decoder/CAudioDecoder.cs @@ -1,4 +1,23 @@ -namespace Vocaluxe.Lib.Sound.Decoder +#region license +// /* +// This file is part of Vocaluxe. +// +// Vocaluxe is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Vocaluxe is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with Vocaluxe. If not, see . +// */ +#endregion + +namespace Vocaluxe.Lib.Sound.Decoder { abstract class CAudioDecoder : IAudioDecoder { diff --git a/Vocaluxe/Lib/Sound/Decoder/CAudioDecoderFFmpeg.cs b/Vocaluxe/Lib/Sound/Decoder/CAudioDecoderFFmpeg.cs index 7a77af27..566c9677 100644 --- a/Vocaluxe/Lib/Sound/Decoder/CAudioDecoderFFmpeg.cs +++ b/Vocaluxe/Lib/Sound/Decoder/CAudioDecoderFFmpeg.cs @@ -1,4 +1,23 @@ -using System; +#region license +// /* +// This file is part of Vocaluxe. +// +// Vocaluxe is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Vocaluxe is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with Vocaluxe. If not, see . +// */ +#endregion + +using System; using System.IO; using System.Runtime.InteropServices; using Vocaluxe.Base; @@ -42,7 +61,7 @@ namespace Vocaluxe.Lib.Sound.Decoder CLog.LogError("Error opening audio file: " + _FileName); return; } - + if (!_Instance.Opened) { @@ -186,8 +205,6 @@ namespace Vocaluxe.Lib.Sound.Decoder timeStamp = 0f; } - public void Dispose() - { - } + public void Dispose() {} } } \ No newline at end of file diff --git a/Vocaluxe/Lib/Sound/Decoder/IAudioDecoder.cs b/Vocaluxe/Lib/Sound/Decoder/IAudioDecoder.cs index b2db7363..4a58afc3 100644 --- a/Vocaluxe/Lib/Sound/Decoder/IAudioDecoder.cs +++ b/Vocaluxe/Lib/Sound/Decoder/IAudioDecoder.cs @@ -1,4 +1,23 @@ -namespace Vocaluxe.Lib.Sound.Decoder +#region license +// /* +// This file is part of Vocaluxe. +// +// Vocaluxe is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Vocaluxe is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with Vocaluxe. If not, see . +// */ +#endregion + +namespace Vocaluxe.Lib.Sound.Decoder { struct SFormatInfo { diff --git a/Vocaluxe/Lib/Sound/Gstreamer/CGstreamerAudioWrapper.cs b/Vocaluxe/Lib/Sound/Gstreamer/CGstreamerAudioWrapper.cs index fc4e80f9..0793da9f 100644 --- a/Vocaluxe/Lib/Sound/Gstreamer/CGstreamerAudioWrapper.cs +++ b/Vocaluxe/Lib/Sound/Gstreamer/CGstreamerAudioWrapper.cs @@ -1,4 +1,23 @@ -using System.Runtime.InteropServices; +#region license +// /* +// This file is part of Vocaluxe. +// +// Vocaluxe is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Vocaluxe is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with Vocaluxe. If not, see . +// */ +#endregion + +using System.Runtime.InteropServices; namespace Vocaluxe.Lib.Sound.Gstreamer { @@ -21,7 +40,7 @@ namespace Vocaluxe.Lib.Sound.Gstreamer [UnmanagedFunctionPointer(CallingConvention.StdCall)] public delegate void LogCallback(string message); - [DllImport(_Dll, CallingConvention=CallingConvention.Cdecl)] + [DllImport(_Dll, CallingConvention = CallingConvention.Cdecl)] public static extern void SetLogCallback(LogCallback c); [DllImport(_Dll, CallingConvention = CallingConvention.Cdecl)] diff --git a/Vocaluxe/Lib/Sound/IPlayback.cs b/Vocaluxe/Lib/Sound/IPlayback.cs index a3062906..c83a0fbd 100644 --- a/Vocaluxe/Lib/Sound/IPlayback.cs +++ b/Vocaluxe/Lib/Sound/IPlayback.cs @@ -1,4 +1,23 @@ -using System; +#region license +// /* +// This file is part of Vocaluxe. +// +// Vocaluxe is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Vocaluxe is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with Vocaluxe. If not, see . +// */ +#endregion + +using System; namespace Vocaluxe.Lib.Sound { diff --git a/Vocaluxe/Lib/Sound/IRecord.cs b/Vocaluxe/Lib/Sound/IRecord.cs index 30df7caf..978fe81d 100644 --- a/Vocaluxe/Lib/Sound/IRecord.cs +++ b/Vocaluxe/Lib/Sound/IRecord.cs @@ -1,4 +1,23 @@ -using System; +#region license +// /* +// This file is part of Vocaluxe. +// +// Vocaluxe is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Vocaluxe is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with Vocaluxe. If not, see . +// */ +#endregion + +using System; using System.Collections.Generic; namespace Vocaluxe.Lib.Sound diff --git a/Vocaluxe/Lib/Sound/Portaudio/PortAudio.cs b/Vocaluxe/Lib/Sound/Portaudio/PortAudio.cs index fc7966b8..f3f1df18 100644 --- a/Vocaluxe/Lib/Sound/Portaudio/PortAudio.cs +++ b/Vocaluxe/Lib/Sound/Portaudio/PortAudio.cs @@ -1,24 +1,22 @@ -/* - * PortAudioSharp - PortAudio bindings for .NET - * Copyright 2006-2011 Riccardo Gerosa and individual contributors as indicated - * by the @authors tag. See the copyright.txt in the distribution for a - * full listing of individual contributors. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy of this software - * and associated documentation files (the "Software"), to deal in the Software without restriction, - * including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, - * subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all copies or substantial - * portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT - * NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. - * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, - * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ +#region license +// /* +// This file is part of Vocaluxe. +// +// Vocaluxe is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Vocaluxe is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with Vocaluxe. If not, see . +// */ +#endregion + using System; using System.Runtime.InteropServices; @@ -29,6 +27,7 @@ namespace PortAudioSharp PortAudio v.19 bindings for .NET */ + public partial class CPortAudio { #region **** PORTAUDIO CALLBACKS **** diff --git a/Vocaluxe/Lib/Sound/Portaudio/PortAudioASIO.cs b/Vocaluxe/Lib/Sound/Portaudio/PortAudioASIO.cs index 081ce0b0..09e7858c 100644 --- a/Vocaluxe/Lib/Sound/Portaudio/PortAudioASIO.cs +++ b/Vocaluxe/Lib/Sound/Portaudio/PortAudioASIO.cs @@ -1,24 +1,22 @@ -/* - * PortAudioSharp - PortAudio bindings for .NET - * Copyright 2006-2011 Riccardo Gerosa and individual contributors as indicated - * by the @authors tag. See the copyright.txt in the distribution for a - * full listing of individual contributors. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy of this software - * and associated documentation files (the "Software"), to deal in the Software without restriction, - * including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, - * subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all copies or substantial - * portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT - * NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. - * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, - * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ +#region license +// /* +// This file is part of Vocaluxe. +// +// Vocaluxe is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Vocaluxe is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with Vocaluxe. If not, see . +// */ +#endregion + using System; using System.Runtime.InteropServices; diff --git a/Vocaluxe/Lib/Video/Acinerella/CAcinerella.cs b/Vocaluxe/Lib/Video/Acinerella/CAcinerella.cs index 0ad3e00b..4127ae01 100644 --- a/Vocaluxe/Lib/Video/Acinerella/CAcinerella.cs +++ b/Vocaluxe/Lib/Video/Acinerella/CAcinerella.cs @@ -1,4 +1,23 @@ -using System; +#region license +// /* +// This file is part of Vocaluxe. +// +// Vocaluxe is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Vocaluxe is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with Vocaluxe. If not, see . +// */ +#endregion + +using System; using System.Runtime.InteropServices; namespace Vocaluxe.Lib.Video.Acinerella @@ -314,7 +333,6 @@ namespace Vocaluxe.Lib.Video.Acinerella [DllImport(_AcDll, EntryPoint = "ac_free_package", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Auto)] public static extern void ac_free_package(IntPtr pAcPackage); - [DllImport(_AcDll, EntryPoint = "ac_create_video_decoder", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Auto)] private static extern IntPtr _ac_create_video_decoder(IntPtr pAcInstance); diff --git a/Vocaluxe/Lib/Video/CVideoDecoder.cs b/Vocaluxe/Lib/Video/CVideoDecoder.cs index 9956ee48..7f32cd13 100644 --- a/Vocaluxe/Lib/Video/CVideoDecoder.cs +++ b/Vocaluxe/Lib/Video/CVideoDecoder.cs @@ -1,4 +1,23 @@ -using System.Collections.Generic; +#region license +// /* +// This file is part of Vocaluxe. +// +// Vocaluxe is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Vocaluxe is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with Vocaluxe. If not, see . +// */ +#endregion + +using System.Collections.Generic; using VocaluxeLib.Menu; namespace Vocaluxe.Lib.Video diff --git a/Vocaluxe/Lib/Video/CVideoDecoderFFmpeg.cs b/Vocaluxe/Lib/Video/CVideoDecoderFFmpeg.cs index faf7fa14..4c9c09fb 100644 --- a/Vocaluxe/Lib/Video/CVideoDecoderFFmpeg.cs +++ b/Vocaluxe/Lib/Video/CVideoDecoderFFmpeg.cs @@ -1,4 +1,23 @@ -using System; +#region license +// /* +// This file is part of Vocaluxe. +// +// Vocaluxe is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Vocaluxe is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with Vocaluxe. If not, see . +// */ +#endregion + +using System; using System.Collections.Generic; using System.Diagnostics; using System.IO; @@ -725,8 +744,6 @@ namespace Vocaluxe.Lib.Video } #endregion Threading - public void Dispose() - { - } + public void Dispose() {} } } \ No newline at end of file diff --git a/Vocaluxe/Lib/Video/CVideoDecoderGstreamer.cs b/Vocaluxe/Lib/Video/CVideoDecoderGstreamer.cs index 079229d5..93f424cb 100644 --- a/Vocaluxe/Lib/Video/CVideoDecoderGstreamer.cs +++ b/Vocaluxe/Lib/Video/CVideoDecoderGstreamer.cs @@ -1,4 +1,23 @@ -using System; +#region license +// /* +// This file is part of Vocaluxe. +// +// Vocaluxe is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Vocaluxe is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with Vocaluxe. If not, see . +// */ +#endregion + +using System; using Vocaluxe.Base; using Vocaluxe.Lib.Video.Gstreamer; using VocaluxeLib.Menu; diff --git a/Vocaluxe/Lib/Video/Gstreamer/CGstreamerVideoWrapper.cs b/Vocaluxe/Lib/Video/Gstreamer/CGstreamerVideoWrapper.cs index d58f4fa6..544a28d2 100644 --- a/Vocaluxe/Lib/Video/Gstreamer/CGstreamerVideoWrapper.cs +++ b/Vocaluxe/Lib/Video/Gstreamer/CGstreamerVideoWrapper.cs @@ -1,4 +1,23 @@ -using System; +#region license +// /* +// This file is part of Vocaluxe. +// +// Vocaluxe is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Vocaluxe is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with Vocaluxe. If not, see . +// */ +#endregion + +using System; using System.Runtime.InteropServices; namespace Vocaluxe.Lib.Video.Gstreamer diff --git a/Vocaluxe/Lib/Video/IVideoDecoder.cs b/Vocaluxe/Lib/Video/IVideoDecoder.cs index d81dce74..161f479e 100644 --- a/Vocaluxe/Lib/Video/IVideoDecoder.cs +++ b/Vocaluxe/Lib/Video/IVideoDecoder.cs @@ -1,4 +1,23 @@ -using System; +#region license +// /* +// This file is part of Vocaluxe. +// +// Vocaluxe is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Vocaluxe is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with Vocaluxe. If not, see . +// */ +#endregion + +using System; using VocaluxeLib.Menu; namespace Vocaluxe.Lib.Video diff --git a/Vocaluxe/Lib/Webcam/CAForgeNet.cs b/Vocaluxe/Lib/Webcam/CAForgeNet.cs index 72712685..1bc7ff7d 100644 --- a/Vocaluxe/Lib/Webcam/CAForgeNet.cs +++ b/Vocaluxe/Lib/Webcam/CAForgeNet.cs @@ -1,4 +1,23 @@ -using AForge.Video; +#region license +// /* +// This file is part of Vocaluxe. +// +// Vocaluxe is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Vocaluxe is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with Vocaluxe. If not, see . +// */ +#endregion + +using AForge.Video; using AForge.Video.DirectShow; using System.Collections.Generic; using System.Drawing; diff --git a/Vocaluxe/Lib/Webcam/IWebcam.cs b/Vocaluxe/Lib/Webcam/IWebcam.cs index 8b0ecc1c..7e138b79 100644 --- a/Vocaluxe/Lib/Webcam/IWebcam.cs +++ b/Vocaluxe/Lib/Webcam/IWebcam.cs @@ -1,4 +1,23 @@ -using System.Collections.Generic; +#region license +// /* +// This file is part of Vocaluxe. +// +// Vocaluxe is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Vocaluxe is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with Vocaluxe. If not, see . +// */ +#endregion + +using System.Collections.Generic; using System.Drawing; using VocaluxeLib.Menu; diff --git a/Vocaluxe/Program.cs b/Vocaluxe/Program.cs index bb715000..dfd3fea0 100644 --- a/Vocaluxe/Program.cs +++ b/Vocaluxe/Program.cs @@ -252,9 +252,8 @@ namespace Vocaluxe string[] arr = args.Name.Split(new char[] {','}); if (arr.Length > 0) { - #if ARCH_X86 - string path="x86"; + string path = "x86"; #endif #if ARCH_X64 @@ -277,7 +276,7 @@ namespace Vocaluxe } catch (Exception e) { - CLog.LogError("Cannot load assembly "+args.Name+" from "+path+": "+e); + CLog.LogError("Cannot load assembly " + args.Name + " from " + path + ": " + e); } } return null; diff --git a/Vocaluxe/Properties/AssemblyInfo.cs b/Vocaluxe/Properties/AssemblyInfo.cs index 8b5da9e1..f51f6afd 100644 --- a/Vocaluxe/Properties/AssemblyInfo.cs +++ b/Vocaluxe/Properties/AssemblyInfo.cs @@ -1,9 +1,29 @@ -using System.Reflection; +#region license +// /* +// This file is part of Vocaluxe. +// +// Vocaluxe is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Vocaluxe is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with Vocaluxe. If not, see . +// */ +#endregion + +using System.Reflection; using System.Runtime.InteropServices; // Allgemeine Informationen über eine Assembly werden über die folgenden // Attribute gesteuert. Ändern Sie diese Attributwerte, um die Informationen zu ändern, // die mit einer Assembly verknüpft sind. + [assembly: AssemblyTitle("Vocaluxe")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] @@ -16,9 +36,11 @@ using System.Runtime.InteropServices; // Durch Festlegen von ComVisible auf "false" werden die Typen in dieser Assembly unsichtbar // für COM-Komponenten. Wenn Sie auf einen Typ in dieser Assembly von // COM zugreifen müssen, legen Sie das ComVisible-Attribut für diesen Typ auf "true" fest. + [assembly: ComVisible(false)] // Die folgende GUID bestimmt die ID der Typbibliothek, wenn dieses Projekt für COM verfügbar gemacht wird + [assembly: Guid("da631594-f891-4994-9869-c37e626e44f9")] // Versionsinformationen für eine Assembly bestehen aus den folgenden vier Werten: @@ -28,5 +50,6 @@ using System.Runtime.InteropServices; // Buildnummer // Revision // + [assembly: AssemblyVersion("0.3.0.0")] [assembly: AssemblyFileVersion("1.0.0.0")] \ No newline at end of file diff --git a/Vocaluxe/Screens/CPopupScreenPlayerControl.cs b/Vocaluxe/Screens/CPopupScreenPlayerControl.cs index dbdae6c9..06d0b0d0 100644 --- a/Vocaluxe/Screens/CPopupScreenPlayerControl.cs +++ b/Vocaluxe/Screens/CPopupScreenPlayerControl.cs @@ -1,4 +1,23 @@ -using System; +#region license +// /* +// This file is part of Vocaluxe. +// +// Vocaluxe is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Vocaluxe is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with Vocaluxe. If not, see . +// */ +#endregion + +using System; using System.Collections.Generic; using System.Windows.Forms; using Vocaluxe.Base; diff --git a/Vocaluxe/Screens/CPopupScreenVolumeControl.cs b/Vocaluxe/Screens/CPopupScreenVolumeControl.cs index d1f477ea..b7ba7128 100644 --- a/Vocaluxe/Screens/CPopupScreenVolumeControl.cs +++ b/Vocaluxe/Screens/CPopupScreenVolumeControl.cs @@ -1,4 +1,23 @@ -using Vocaluxe.Base; +#region license +// /* +// This file is part of Vocaluxe. +// +// Vocaluxe is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Vocaluxe is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with Vocaluxe. If not, see . +// */ +#endregion + +using Vocaluxe.Base; using VocaluxeLib.Menu; namespace Vocaluxe.Screens diff --git a/Vocaluxe/Screens/CScreenCredits.cs b/Vocaluxe/Screens/CScreenCredits.cs index 10342170..6ebd1819 100644 --- a/Vocaluxe/Screens/CScreenCredits.cs +++ b/Vocaluxe/Screens/CScreenCredits.cs @@ -1,4 +1,23 @@ -using System; +#region license +// /* +// This file is part of Vocaluxe. +// +// Vocaluxe is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Vocaluxe is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with Vocaluxe. If not, see . +// */ +#endregion + +using System; using System.Collections.Generic; using System.Diagnostics; using System.Windows.Forms; diff --git a/Vocaluxe/Screens/CScreenHighscore.cs b/Vocaluxe/Screens/CScreenHighscore.cs index a568d68a..6baa32d4 100644 --- a/Vocaluxe/Screens/CScreenHighscore.cs +++ b/Vocaluxe/Screens/CScreenHighscore.cs @@ -1,4 +1,23 @@ -using System; +#region license +// /* +// This file is part of Vocaluxe. +// +// Vocaluxe is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Vocaluxe is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with Vocaluxe. If not, see . +// */ +#endregion + +using System; using System.Collections.Generic; using System.Windows.Forms; using Vocaluxe.Base; diff --git a/Vocaluxe/Screens/CScreenLoad.cs b/Vocaluxe/Screens/CScreenLoad.cs index 3e81c722..a0d83515 100644 --- a/Vocaluxe/Screens/CScreenLoad.cs +++ b/Vocaluxe/Screens/CScreenLoad.cs @@ -1,4 +1,23 @@ -using System.Diagnostics; +#region license +// /* +// This file is part of Vocaluxe. +// +// Vocaluxe is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Vocaluxe is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with Vocaluxe. If not, see . +// */ +#endregion + +using System.Diagnostics; using System.Threading; using System.Windows.Forms; using Vocaluxe.Base; @@ -88,8 +107,8 @@ namespace Vocaluxe.Screens _SongLoaderThread.Name = "SongLoader"; Texts[_TextStatus].Text = CLanguage.Translate("TR_SCREENLOAD_TOTAL") + ": 0 " + - CLanguage.Translate("TR_SCREENLOAD_SONGS") + " (0 " + - CLanguage.Translate("TR_SCREENLOAD_LOADED") + ")"; + CLanguage.Translate("TR_SCREENLOAD_SONGS") + " (0 " + + CLanguage.Translate("TR_SCREENLOAD_LOADED") + ")"; _SkipIntro = false; _CurrentIntroVideoNr = -1; diff --git a/Vocaluxe/Screens/CScreenMain.cs b/Vocaluxe/Screens/CScreenMain.cs index e9a4ac57..e4825cc5 100644 --- a/Vocaluxe/Screens/CScreenMain.cs +++ b/Vocaluxe/Screens/CScreenMain.cs @@ -1,4 +1,23 @@ -using System.Windows.Forms; +#region license +// /* +// This file is part of Vocaluxe. +// +// Vocaluxe is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Vocaluxe is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with Vocaluxe. If not, see . +// */ +#endregion + +using System.Windows.Forms; using Vocaluxe.Base; using VocaluxeLib.Menu; diff --git a/Vocaluxe/Screens/CScreenNames.cs b/Vocaluxe/Screens/CScreenNames.cs index 064c9b7d..2df5079d 100644 --- a/Vocaluxe/Screens/CScreenNames.cs +++ b/Vocaluxe/Screens/CScreenNames.cs @@ -1,4 +1,23 @@ -using System; +#region license +// /* +// This file is part of Vocaluxe. +// +// Vocaluxe is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Vocaluxe is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with Vocaluxe. If not, see . +// */ +#endregion + +using System; using System.Collections.Generic; using System.Windows.Forms; using Vocaluxe.Base; diff --git a/Vocaluxe/Screens/CScreenOptions.cs b/Vocaluxe/Screens/CScreenOptions.cs index 4d324f53..5c31b77b 100644 --- a/Vocaluxe/Screens/CScreenOptions.cs +++ b/Vocaluxe/Screens/CScreenOptions.cs @@ -1,4 +1,23 @@ -using System.Windows.Forms; +#region license +// /* +// This file is part of Vocaluxe. +// +// Vocaluxe is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Vocaluxe is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with Vocaluxe. If not, see . +// */ +#endregion + +using System.Windows.Forms; using Vocaluxe.Base; using VocaluxeLib.Menu; diff --git a/Vocaluxe/Screens/CScreenOptionsGame.cs b/Vocaluxe/Screens/CScreenOptionsGame.cs index 02371d0c..d510f3be 100644 --- a/Vocaluxe/Screens/CScreenOptionsGame.cs +++ b/Vocaluxe/Screens/CScreenOptionsGame.cs @@ -1,4 +1,23 @@ -using System.Windows.Forms; +#region license +// /* +// This file is part of Vocaluxe. +// +// Vocaluxe is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Vocaluxe is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with Vocaluxe. If not, see . +// */ +#endregion + +using System.Windows.Forms; using Vocaluxe.Base; using VocaluxeLib.Menu; diff --git a/Vocaluxe/Screens/CScreenOptionsLyrics.cs b/Vocaluxe/Screens/CScreenOptionsLyrics.cs index 60fc0208..0fc760bd 100644 --- a/Vocaluxe/Screens/CScreenOptionsLyrics.cs +++ b/Vocaluxe/Screens/CScreenOptionsLyrics.cs @@ -1,4 +1,23 @@ -using System.Windows.Forms; +#region license +// /* +// This file is part of Vocaluxe. +// +// Vocaluxe is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Vocaluxe is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with Vocaluxe. If not, see . +// */ +#endregion + +using System.Windows.Forms; using Vocaluxe.Base; using VocaluxeLib.Menu; diff --git a/Vocaluxe/Screens/CScreenOptionsRecord.cs b/Vocaluxe/Screens/CScreenOptionsRecord.cs index a44017b7..c8c5d5dc 100644 --- a/Vocaluxe/Screens/CScreenOptionsRecord.cs +++ b/Vocaluxe/Screens/CScreenOptionsRecord.cs @@ -1,4 +1,23 @@ -using System.Collections.Generic; +#region license +// /* +// This file is part of Vocaluxe. +// +// Vocaluxe is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Vocaluxe is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with Vocaluxe. If not, see . +// */ +#endregion + +using System.Collections.Generic; using System.Diagnostics; using System.Windows.Forms; using Vocaluxe.Base; diff --git a/Vocaluxe/Screens/CScreenOptionsSound.cs b/Vocaluxe/Screens/CScreenOptionsSound.cs index 49886ea5..ce5f8bc5 100644 --- a/Vocaluxe/Screens/CScreenOptionsSound.cs +++ b/Vocaluxe/Screens/CScreenOptionsSound.cs @@ -1,4 +1,23 @@ -using System.Windows.Forms; +#region license +// /* +// This file is part of Vocaluxe. +// +// Vocaluxe is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Vocaluxe is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with Vocaluxe. If not, see . +// */ +#endregion + +using System.Windows.Forms; using Vocaluxe.Base; using VocaluxeLib.Menu; diff --git a/Vocaluxe/Screens/CScreenOptionsTheme.cs b/Vocaluxe/Screens/CScreenOptionsTheme.cs index b2b28262..44e98e21 100644 --- a/Vocaluxe/Screens/CScreenOptionsTheme.cs +++ b/Vocaluxe/Screens/CScreenOptionsTheme.cs @@ -1,4 +1,23 @@ -using System; +#region license +// /* +// This file is part of Vocaluxe. +// +// Vocaluxe is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Vocaluxe is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with Vocaluxe. If not, see . +// */ +#endregion + +using System; using System.Windows.Forms; using Vocaluxe.Base; using VocaluxeLib.Menu; diff --git a/Vocaluxe/Screens/CScreenOptionsVideo.cs b/Vocaluxe/Screens/CScreenOptionsVideo.cs index 0b91cd2a..1d972957 100644 --- a/Vocaluxe/Screens/CScreenOptionsVideo.cs +++ b/Vocaluxe/Screens/CScreenOptionsVideo.cs @@ -1,4 +1,23 @@ -using System; +#region license +// /* +// This file is part of Vocaluxe. +// +// Vocaluxe is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Vocaluxe is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with Vocaluxe. If not, see . +// */ +#endregion + +using System; using System.Windows.Forms; using Vocaluxe.Base; using Vocaluxe.Lib.Webcam; @@ -175,7 +194,8 @@ namespace Vocaluxe.Screens _Config.MonikerString = devices[SelectSlides[_SelectSlideWebcamDevices].Selection].MonikerString; _Config.Width = devices[SelectSlides[_SelectSlideWebcamDevices].Selection].Capabilities[SelectSlides[_SelectSlideWebcamCapabilities].Selection].Width; _Config.Height = devices[SelectSlides[_SelectSlideWebcamDevices].Selection].Capabilities[SelectSlides[_SelectSlideWebcamCapabilities].Selection].Height; - _Config.Framerate = devices[SelectSlides[_SelectSlideWebcamDevices].Selection].Capabilities[SelectSlides[_SelectSlideWebcamCapabilities].Selection].Framerate; + _Config.Framerate = + devices[SelectSlides[_SelectSlideWebcamDevices].Selection].Capabilities[SelectSlides[_SelectSlideWebcamCapabilities].Selection].Framerate; CWebcam.Close(); CWebcam.Select(CConfig.WebcamConfig); CWebcam.Start(); @@ -218,7 +238,7 @@ namespace Vocaluxe.Screens for (int i = 0; i < d[SelectSlides[_SelectSlideWebcamDevices].Selection].Capabilities.Count; i++) { SelectSlides[_SelectSlideWebcamCapabilities].AddValue(d[_DeviceNr].Capabilities[i].Width.ToString() + " x " + d[_DeviceNr].Capabilities[i].Height.ToString() + - " @ " + d[_DeviceNr].Capabilities[i].Framerate.ToString() + "FPS"); + " @ " + d[_DeviceNr].Capabilities[i].Framerate.ToString() + "FPS"); } SelectSlides[_SelectSlideWebcamCapabilities].Selection = 0; diff --git a/Vocaluxe/Screens/CScreenParty.cs b/Vocaluxe/Screens/CScreenParty.cs index 0d3892e1..3b86540d 100644 --- a/Vocaluxe/Screens/CScreenParty.cs +++ b/Vocaluxe/Screens/CScreenParty.cs @@ -1,4 +1,23 @@ -using System.Collections.Generic; +#region license +// /* +// This file is part of Vocaluxe. +// +// Vocaluxe is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Vocaluxe is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with Vocaluxe. If not, see . +// */ +#endregion + +using System.Collections.Generic; using System.Windows.Forms; using Vocaluxe.Base; using VocaluxeLib.Menu; diff --git a/Vocaluxe/Screens/CScreenProfiles.cs b/Vocaluxe/Screens/CScreenProfiles.cs index cdf9b8ec..863185c5 100644 --- a/Vocaluxe/Screens/CScreenProfiles.cs +++ b/Vocaluxe/Screens/CScreenProfiles.cs @@ -1,4 +1,23 @@ -using System; +#region license +// /* +// This file is part of Vocaluxe. +// +// Vocaluxe is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Vocaluxe is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with Vocaluxe. If not, see . +// */ +#endregion + +using System; using System.Drawing; using System.Drawing.Imaging; using System.IO; diff --git a/Vocaluxe/Screens/CScreenScore.cs b/Vocaluxe/Screens/CScreenScore.cs index 9083e554..2944a4f5 100644 --- a/Vocaluxe/Screens/CScreenScore.cs +++ b/Vocaluxe/Screens/CScreenScore.cs @@ -1,4 +1,23 @@ -using System; +#region license +// /* +// This file is part of Vocaluxe. +// +// Vocaluxe is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Vocaluxe is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with Vocaluxe. If not, see . +// */ +#endregion + +using System; using System.Collections.Generic; using System.Diagnostics; using System.Windows.Forms; @@ -141,15 +160,15 @@ namespace Vocaluxe.Screens if (direction.ToLower() == "vertical") { Statics[_StaticPointsBar[p, CGame.NumPlayer - 1]].Rect.W = ((float)_StaticPointsBarDrawnPoints[p]) * - (Statics[_StaticPointsBarBG[p, CGame.NumPlayer - 1]].Rect.W / 10000); + (Statics[_StaticPointsBarBG[p, CGame.NumPlayer - 1]].Rect.W / 10000); } else { Statics[_StaticPointsBar[p, CGame.NumPlayer - 1]].Rect.H = ((float)_StaticPointsBarDrawnPoints[p]) * - (Statics[_StaticPointsBarBG[p, CGame.NumPlayer - 1]].Rect.H / 10000); + (Statics[_StaticPointsBarBG[p, CGame.NumPlayer - 1]].Rect.H / 10000); Statics[_StaticPointsBar[p, CGame.NumPlayer - 1]].Rect.Y = Statics[_StaticPointsBarBG[p, CGame.NumPlayer - 1]].Rect.H + - Statics[_StaticPointsBarBG[p, CGame.NumPlayer - 1]].Rect.Y - - Statics[_StaticPointsBar[p, CGame.NumPlayer - 1]].Rect.H; + Statics[_StaticPointsBarBG[p, CGame.NumPlayer - 1]].Rect.Y - + Statics[_StaticPointsBar[p, CGame.NumPlayer - 1]].Rect.H; } } } @@ -302,14 +321,14 @@ namespace Vocaluxe.Screens if (CGame.NumPlayer < (int)ScreenSettings[_ScreenSettingShortDifficulty].GetValue()) { Texts[_TextDifficulty[p, CGame.NumPlayer - 1]].Text = CLanguage.Translate("TR_SCREENSCORE_GAMEDIFFICULTY") + ": " + - CLanguage.Translate(player[p].Difficulty.ToString()); + CLanguage.Translate(player[p].Difficulty.ToString()); } else Texts[_TextDifficulty[p, CGame.NumPlayer - 1]].Text = CLanguage.Translate(player[p].Difficulty.ToString()); if (CGame.NumPlayer < (int)ScreenSettings[_ScreenSettingShortRating].GetValue()) { Texts[_TextRatings[p, CGame.NumPlayer - 1]].Text = CLanguage.Translate("TR_SCREENSCORE_RATING") + ": " + - CLanguage.Translate(GetRating((int)Math.Round(player[p].Points))); + CLanguage.Translate(GetRating((int)Math.Round(player[p].Points))); } else Texts[_TextRatings[p, CGame.NumPlayer - 1]].Text = CLanguage.Translate(GetRating((int)Math.Round(player[p].Points))); @@ -322,8 +341,8 @@ namespace Vocaluxe.Screens { Statics[_StaticPointsBar[p, CGame.NumPlayer - 1]].Rect.H = 0; Statics[_StaticPointsBar[p, CGame.NumPlayer - 1]].Rect.Y = Statics[_StaticPointsBarBG[p, CGame.NumPlayer - 1]].Rect.H + - Statics[_StaticPointsBarBG[p, CGame.NumPlayer - 1]].Rect.Y - - Statics[_StaticPointsBar[p, CGame.NumPlayer - 1]].Rect.H; + Statics[_StaticPointsBarBG[p, CGame.NumPlayer - 1]].Rect.Y - + Statics[_StaticPointsBar[p, CGame.NumPlayer - 1]].Rect.H; } if (player[p].ProfileID >= 0 && player[p].ProfileID < CProfiles.NumProfiles) Statics[_StaticAvatar[p, CGame.NumPlayer - 1]].Texture = CProfiles.Profiles[player[p].ProfileID].Avatar.Texture; @@ -335,8 +354,8 @@ namespace Vocaluxe.Screens { Statics[_StaticPointsBar[p, CGame.NumPlayer - 1]].Rect.H = ((float)player[p].Points) * (Statics[_StaticPointsBarBG[p, CGame.NumPlayer - 1]].Rect.H / 10000); Statics[_StaticPointsBar[p, CGame.NumPlayer - 1]].Rect.Y = Statics[_StaticPointsBarBG[p, CGame.NumPlayer - 1]].Rect.H + - Statics[_StaticPointsBarBG[p, CGame.NumPlayer - 1]].Rect.Y - - Statics[_StaticPointsBar[p, CGame.NumPlayer - 1]].Rect.H; + Statics[_StaticPointsBarBG[p, CGame.NumPlayer - 1]].Rect.Y - + Statics[_StaticPointsBar[p, CGame.NumPlayer - 1]].Rect.H; _StaticPointsBarDrawnPoints[p] = player[p].Points; } } diff --git a/Vocaluxe/Screens/CScreenSing.cs b/Vocaluxe/Screens/CScreenSing.cs index e9769d91..ce8615d0 100644 --- a/Vocaluxe/Screens/CScreenSing.cs +++ b/Vocaluxe/Screens/CScreenSing.cs @@ -1,4 +1,23 @@ -using System; +#region license +// /* +// This file is part of Vocaluxe. +// +// Vocaluxe is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Vocaluxe is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with Vocaluxe. If not, see . +// */ +#endregion + +using System; using System.Collections.Generic; using System.Diagnostics; using System.Drawing; @@ -905,14 +924,14 @@ namespace Vocaluxe.Screens { Texts[_TextScores[player, numplayer]].Visible = numplayer + 1 == CGame.NumPlayer; Texts[_TextNames[player, numplayer]].Visible = (numplayer + 1 == CGame.NumPlayer) - && - (CConfig.PlayerInfo == EPlayerInfo.TR_CONFIG_PLAYERINFO_BOTH || - CConfig.PlayerInfo == EPlayerInfo.TR_CONFIG_PLAYERINFO_NAME); + && + (CConfig.PlayerInfo == EPlayerInfo.TR_CONFIG_PLAYERINFO_BOTH || + CConfig.PlayerInfo == EPlayerInfo.TR_CONFIG_PLAYERINFO_NAME); Statics[_StaticScores[player, numplayer]].Visible = numplayer + 1 == CGame.NumPlayer; Statics[_StaticAvatars[player, numplayer]].Visible = (numplayer + 1 == CGame.NumPlayer) - && - (CConfig.PlayerInfo == EPlayerInfo.TR_CONFIG_PLAYERINFO_BOTH || - CConfig.PlayerInfo == EPlayerInfo.TR_CONFIG_PLAYERINFO_AVATAR); + && + (CConfig.PlayerInfo == EPlayerInfo.TR_CONFIG_PLAYERINFO_BOTH || + CConfig.PlayerInfo == EPlayerInfo.TR_CONFIG_PLAYERINFO_AVATAR); } } } diff --git a/Vocaluxe/Screens/CScreenSong.cs b/Vocaluxe/Screens/CScreenSong.cs index b4c973af..8501000e 100644 --- a/Vocaluxe/Screens/CScreenSong.cs +++ b/Vocaluxe/Screens/CScreenSong.cs @@ -1,4 +1,23 @@ -using System; +#region license +// /* +// This file is part of Vocaluxe. +// +// Vocaluxe is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Vocaluxe is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with Vocaluxe. If not, see . +// */ +#endregion + +using System; using System.Collections.Generic; using System.Windows.Forms; using Vocaluxe.Base; diff --git a/Vocaluxe/Screens/CScreenTest.cs b/Vocaluxe/Screens/CScreenTest.cs index febd8ccf..b97849c6 100644 --- a/Vocaluxe/Screens/CScreenTest.cs +++ b/Vocaluxe/Screens/CScreenTest.cs @@ -1,4 +1,23 @@ -using System; +#region license +// /* +// This file is part of Vocaluxe. +// +// Vocaluxe is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Vocaluxe is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with Vocaluxe. If not, see . +// */ +#endregion + +using System; using System.IO; using System.Windows.Forms; using Vocaluxe.Base; diff --git a/VocaluxeLib/GlobalSuppressions.cs b/VocaluxeLib/GlobalSuppressions.cs index f43b3e9e..c5b4da19 100644 --- a/VocaluxeLib/GlobalSuppressions.cs +++ b/VocaluxeLib/GlobalSuppressions.cs @@ -1,11 +1,22 @@ -// Diese Datei wird von der Codeanalyse zur Wartung der SuppressMessage- -// Attribute verwendet, die auf dieses Projekt angewendet werden. -// Unterdrückungen auf Projektebene haben entweder kein Ziel oder -// erhalten ein spezifisches Ziel mit Namespace-, Typ-, Memberbereich usw. -// Wenn Sie dieser Datei eine Unterdrückung hinzufügen möchten, klicken Sie mit der -// rechten Maustaste auf die Meldung in der Fehlerliste, zeigen Sie auf -// "Meldung(en) unterdrücken", und klicken Sie auf "In Projektunterdrückungsdatei". -// Sie müssen dieser Datei nicht manuell Unterdrückungen hinzufügen. +#region license +// /* +// This file is part of Vocaluxe. +// +// Vocaluxe is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Vocaluxe is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with Vocaluxe. If not, see . +// */ +#endregion + using System.Diagnostics.CodeAnalysis; [assembly: diff --git a/VocaluxeLib/Menu/CBackground.cs b/VocaluxeLib/Menu/CBackground.cs index a936bbb5..9428179a 100644 --- a/VocaluxeLib/Menu/CBackground.cs +++ b/VocaluxeLib/Menu/CBackground.cs @@ -1,4 +1,23 @@ -using System; +#region license +// /* +// This file is part of Vocaluxe. +// +// Vocaluxe is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Vocaluxe is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with Vocaluxe. If not, see . +// */ +#endregion + +using System; using System.Drawing; using System.Xml; diff --git a/VocaluxeLib/Menu/CBasic.cs b/VocaluxeLib/Menu/CBasic.cs index 85021d45..15162057 100644 --- a/VocaluxeLib/Menu/CBasic.cs +++ b/VocaluxeLib/Menu/CBasic.cs @@ -1,4 +1,23 @@ -namespace VocaluxeLib.Menu +#region license +// /* +// This file is part of Vocaluxe. +// +// Vocaluxe is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Vocaluxe is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with Vocaluxe. If not, see . +// */ +#endregion + +namespace VocaluxeLib.Menu { public static class CBase { diff --git a/VocaluxeLib/Menu/CButton.cs b/VocaluxeLib/Menu/CButton.cs index 27761750..ac39abfd 100644 --- a/VocaluxeLib/Menu/CButton.cs +++ b/VocaluxeLib/Menu/CButton.cs @@ -1,4 +1,23 @@ -using System; +#region license +// /* +// This file is part of Vocaluxe. +// +// Vocaluxe is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Vocaluxe is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with Vocaluxe. If not, see . +// */ +#endregion + +using System; using System.Xml; namespace VocaluxeLib.Menu diff --git a/VocaluxeLib/Menu/CEqualizer.cs b/VocaluxeLib/Menu/CEqualizer.cs index a496deb9..37135cd2 100644 --- a/VocaluxeLib/Menu/CEqualizer.cs +++ b/VocaluxeLib/Menu/CEqualizer.cs @@ -1,4 +1,23 @@ -using System; +#region license +// /* +// This file is part of Vocaluxe. +// +// Vocaluxe is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Vocaluxe is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with Vocaluxe. If not, see . +// */ +#endregion + +using System; using System.Xml; namespace VocaluxeLib.Menu diff --git a/VocaluxeLib/Menu/CHelper.cs b/VocaluxeLib/Menu/CHelper.cs index 29297b0f..03613827 100644 --- a/VocaluxeLib/Menu/CHelper.cs +++ b/VocaluxeLib/Menu/CHelper.cs @@ -1,4 +1,23 @@ -using System; +#region license +// /* +// This file is part of Vocaluxe. +// +// Vocaluxe is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Vocaluxe is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with Vocaluxe. If not, see . +// */ +#endregion + +using System; using System.Collections.Generic; using System.Drawing; using System.Globalization; diff --git a/VocaluxeLib/Menu/CInteraction.cs b/VocaluxeLib/Menu/CInteraction.cs index 586efc60..b84e3892 100644 --- a/VocaluxeLib/Menu/CInteraction.cs +++ b/VocaluxeLib/Menu/CInteraction.cs @@ -1,4 +1,23 @@ -namespace VocaluxeLib.Menu +#region license +// /* +// This file is part of Vocaluxe. +// +// Vocaluxe is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Vocaluxe is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with Vocaluxe. If not, see . +// */ +#endregion + +namespace VocaluxeLib.Menu { public enum EType { diff --git a/VocaluxeLib/Menu/CLyric.cs b/VocaluxeLib/Menu/CLyric.cs index e858284d..092e12dd 100644 --- a/VocaluxeLib/Menu/CLyric.cs +++ b/VocaluxeLib/Menu/CLyric.cs @@ -1,4 +1,23 @@ -using System; +#region license +// /* +// This file is part of Vocaluxe. +// +// Vocaluxe is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Vocaluxe is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with Vocaluxe. If not, see . +// */ +#endregion + +using System; using System.Collections.Generic; using System.Drawing; using System.Xml; diff --git a/VocaluxeLib/Menu/CMenu.cs b/VocaluxeLib/Menu/CMenu.cs index 8f00d04a..20d28e9e 100644 --- a/VocaluxeLib/Menu/CMenu.cs +++ b/VocaluxeLib/Menu/CMenu.cs @@ -1,4 +1,23 @@ -using System; +#region license +// /* +// This file is part of Vocaluxe. +// +// Vocaluxe is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Vocaluxe is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with Vocaluxe. If not, see . +// */ +#endregion + +using System; using System.Collections.Generic; using System.Drawing; using System.IO; diff --git a/VocaluxeLib/Menu/CMenuParty.cs b/VocaluxeLib/Menu/CMenuParty.cs index 5a2e491f..dd537744 100644 --- a/VocaluxeLib/Menu/CMenuParty.cs +++ b/VocaluxeLib/Menu/CMenuParty.cs @@ -1,4 +1,23 @@ -using System; +#region license +// /* +// This file is part of Vocaluxe. +// +// Vocaluxe is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Vocaluxe is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with Vocaluxe. If not, see . +// */ +#endregion + +using System; using VocaluxeLib.PartyModes; namespace VocaluxeLib.Menu diff --git a/VocaluxeLib/Menu/CNameSelection.cs b/VocaluxeLib/Menu/CNameSelection.cs index a55d8994..19231a71 100644 --- a/VocaluxeLib/Menu/CNameSelection.cs +++ b/VocaluxeLib/Menu/CNameSelection.cs @@ -1,4 +1,23 @@ -using System; +#region license +// /* +// This file is part of Vocaluxe. +// +// Vocaluxe is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Vocaluxe is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with Vocaluxe. If not, see . +// */ +#endregion + +using System; using System.Collections.Generic; using System.Windows.Forms; using System.Xml; diff --git a/VocaluxeLib/Menu/CObjectInteractions.cs b/VocaluxeLib/Menu/CObjectInteractions.cs index a5d9e722..3ce558d5 100644 --- a/VocaluxeLib/Menu/CObjectInteractions.cs +++ b/VocaluxeLib/Menu/CObjectInteractions.cs @@ -1,4 +1,23 @@ -using System; +#region license +// /* +// This file is part of Vocaluxe. +// +// Vocaluxe is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Vocaluxe is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with Vocaluxe. If not, see . +// */ +#endregion + +using System; using System.Collections.Generic; using System.Drawing; using System.Windows.Forms; diff --git a/VocaluxeLib/Menu/COrderedDictionaryLite.cs b/VocaluxeLib/Menu/COrderedDictionaryLite.cs index 025b76c9..da0563b8 100644 --- a/VocaluxeLib/Menu/COrderedDictionaryLite.cs +++ b/VocaluxeLib/Menu/COrderedDictionaryLite.cs @@ -1,4 +1,23 @@ -using System; +#region license +// /* +// This file is part of Vocaluxe. +// +// Vocaluxe is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Vocaluxe is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with Vocaluxe. If not, see . +// */ +#endregion + +using System; using System.Collections; using System.Collections.Generic; diff --git a/VocaluxeLib/Menu/CParticle.cs b/VocaluxeLib/Menu/CParticle.cs index 31ba6d42..97f77ed0 100644 --- a/VocaluxeLib/Menu/CParticle.cs +++ b/VocaluxeLib/Menu/CParticle.cs @@ -1,4 +1,23 @@ -using System; +#region license +// /* +// This file is part of Vocaluxe. +// +// Vocaluxe is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Vocaluxe is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with Vocaluxe. If not, see . +// */ +#endregion + +using System; using System.Collections.Generic; using System.Diagnostics; using System.Xml; @@ -332,8 +351,8 @@ namespace VocaluxeLib.Menu _PartyModeID = partyModeID; _Theme = new SThemeParticleEffect(); _Stars = new List(); - this.Rect = rect; - this.Color = color; + Rect = rect; + Color = color; _Theme.TextureName = textureName; Texture = new STexture(-1); _MaxNumber = maxNumber; @@ -349,10 +368,10 @@ namespace VocaluxeLib.Menu _PartyModeID = partyModeID; _Theme = new SThemeParticleEffect(); _Stars = new List(); - this.Rect = rect; - this.Color = color; + Rect = rect; + Color = color; _Theme.TextureName = String.Empty; - this.Texture = texture; + Texture = texture; _MaxNumber = maxNumber; _Size = size; _Type = type; diff --git a/VocaluxeLib/Menu/CPlaylist.cs b/VocaluxeLib/Menu/CPlaylist.cs index cf9f32e7..12652139 100644 --- a/VocaluxeLib/Menu/CPlaylist.cs +++ b/VocaluxeLib/Menu/CPlaylist.cs @@ -1,4 +1,23 @@ -using System; +#region license +// /* +// This file is part of Vocaluxe. +// +// Vocaluxe is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Vocaluxe is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with Vocaluxe. If not, see . +// */ +#endregion + +using System; using System.Collections.Generic; using System.Windows.Forms; using System.Xml; @@ -20,7 +39,7 @@ namespace VocaluxeLib.Menu public CPlaylistSong(int songID, EGameMode gm) { - this.SongID = songID; + SongID = songID; GameMode = gm; } diff --git a/VocaluxeLib/Menu/CPoints.cs b/VocaluxeLib/Menu/CPoints.cs index 1ac00827..e024f0db 100644 --- a/VocaluxeLib/Menu/CPoints.cs +++ b/VocaluxeLib/Menu/CPoints.cs @@ -1,4 +1,23 @@ -using System; +#region license +// /* +// This file is part of Vocaluxe. +// +// Vocaluxe is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Vocaluxe is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with Vocaluxe. If not, see . +// */ +#endregion + +using System; using System.Collections.Generic; using System.Text; @@ -10,7 +29,7 @@ namespace VocaluxeLib.Menu public CPoints(int numRounds, SPlayer[] players) { - _Rounds = new SPlayer[numRounds, players.Length]; + _Rounds = new SPlayer[numRounds,players.Length]; for (int round = 0; round < numRounds; round++) { @@ -86,4 +105,4 @@ namespace VocaluxeLib.Menu return player; } } -} +} \ No newline at end of file diff --git a/VocaluxeLib/Menu/CScreenSetting.cs b/VocaluxeLib/Menu/CScreenSetting.cs index abda8752..40361ec8 100644 --- a/VocaluxeLib/Menu/CScreenSetting.cs +++ b/VocaluxeLib/Menu/CScreenSetting.cs @@ -1,4 +1,23 @@ -using System; +#region license +// /* +// This file is part of Vocaluxe. +// +// Vocaluxe is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Vocaluxe is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with Vocaluxe. If not, see . +// */ +#endregion + +using System; using System.Xml; namespace VocaluxeLib.Menu diff --git a/VocaluxeLib/Menu/CSelectSlide.cs b/VocaluxeLib/Menu/CSelectSlide.cs index ed049e8e..b220a763 100644 --- a/VocaluxeLib/Menu/CSelectSlide.cs +++ b/VocaluxeLib/Menu/CSelectSlide.cs @@ -1,4 +1,23 @@ -using System; +#region license +// /* +// This file is part of Vocaluxe. +// +// Vocaluxe is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Vocaluxe is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with Vocaluxe. If not, see . +// */ +#endregion + +using System; using System.Collections.Generic; using System.Drawing; using System.Xml; diff --git a/VocaluxeLib/Menu/CStatic.cs b/VocaluxeLib/Menu/CStatic.cs index 20c900c0..f5dc147d 100644 --- a/VocaluxeLib/Menu/CStatic.cs +++ b/VocaluxeLib/Menu/CStatic.cs @@ -1,4 +1,23 @@ -using System; +#region license +// /* +// This file is part of Vocaluxe. +// +// Vocaluxe is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Vocaluxe is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with Vocaluxe. If not, see . +// */ +#endregion + +using System; using System.Drawing; using System.Xml; diff --git a/VocaluxeLib/Menu/CText.cs b/VocaluxeLib/Menu/CText.cs index 667119ab..da42158d 100644 --- a/VocaluxeLib/Menu/CText.cs +++ b/VocaluxeLib/Menu/CText.cs @@ -1,4 +1,23 @@ -using System; +#region license +// /* +// This file is part of Vocaluxe. +// +// Vocaluxe is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Vocaluxe is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with Vocaluxe. If not, see . +// */ +#endregion + +using System; using System.Drawing; using System.Xml; diff --git a/VocaluxeLib/Menu/CXMLReader.cs b/VocaluxeLib/Menu/CXMLReader.cs index 6ef54d0c..78a53dbe 100644 --- a/VocaluxeLib/Menu/CXMLReader.cs +++ b/VocaluxeLib/Menu/CXMLReader.cs @@ -1,4 +1,23 @@ -using System; +#region license +// /* +// This file is part of Vocaluxe. +// +// Vocaluxe is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Vocaluxe is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with Vocaluxe. If not, see . +// */ +#endregion + +using System; using System.Collections.Generic; using System.Xml.XPath; diff --git a/VocaluxeLib/Menu/Enums.cs b/VocaluxeLib/Menu/Enums.cs index 4387d4b2..ee8484c6 100644 --- a/VocaluxeLib/Menu/Enums.cs +++ b/VocaluxeLib/Menu/Enums.cs @@ -1,7 +1,27 @@ -using System; +#region license +// /* +// This file is part of Vocaluxe. +// +// Vocaluxe is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Vocaluxe is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with Vocaluxe. If not, see . +// */ +#endregion + +using System; namespace VocaluxeLib.Menu { + #region Inputs [Flags] public enum EModifier diff --git a/VocaluxeLib/Menu/IMenu.cs b/VocaluxeLib/Menu/IMenu.cs index 39287afc..76952879 100644 --- a/VocaluxeLib/Menu/IMenu.cs +++ b/VocaluxeLib/Menu/IMenu.cs @@ -1,4 +1,23 @@ -using System; +#region license +// /* +// This file is part of Vocaluxe. +// +// Vocaluxe is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Vocaluxe is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with Vocaluxe. If not, see . +// */ +#endregion + +using System; using System.Collections.Generic; using System.Drawing; using System.Windows.Forms; diff --git a/VocaluxeLib/Menu/IMenuElement.cs b/VocaluxeLib/Menu/IMenuElement.cs index 73bbcb3e..7222b2ca 100644 --- a/VocaluxeLib/Menu/IMenuElement.cs +++ b/VocaluxeLib/Menu/IMenuElement.cs @@ -1,4 +1,23 @@ -using System.Xml; +#region license +// /* +// This file is part of Vocaluxe. +// +// Vocaluxe is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Vocaluxe is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with Vocaluxe. If not, see . +// */ +#endregion + +using System.Xml; namespace VocaluxeLib.Menu { diff --git a/VocaluxeLib/Menu/SingNotes/CNotes.cs b/VocaluxeLib/Menu/SingNotes/CNotes.cs index 6730b9c8..1943d323 100644 --- a/VocaluxeLib/Menu/SingNotes/CNotes.cs +++ b/VocaluxeLib/Menu/SingNotes/CNotes.cs @@ -1,4 +1,23 @@ -using System; +#region license +// /* +// This file is part of Vocaluxe. +// +// Vocaluxe is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Vocaluxe is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with Vocaluxe. If not, see . +// */ +#endregion + +using System; using System.Collections.Generic; namespace VocaluxeLib.Menu.SingNotes @@ -111,35 +130,35 @@ namespace VocaluxeLib.Menu.SingNotes public CNote(int startBeat, int duration, int tone, string text) : this() { - this.StartBeat = startBeat; - this.Duration = duration; - this.Tone = tone; + StartBeat = startBeat; + Duration = duration; + Tone = tone; NoteType = ENoteType.Normal; - this.Text = text; + Text = text; } public CNote(int startBeat, int duration, int tone, string text, bool hit) : this() { - this.StartBeat = startBeat; - this.Duration = duration; - this.Tone = tone; + StartBeat = startBeat; + Duration = duration; + Tone = tone; NoteType = ENoteType.Normal; - this.Text = text; - this.Hit = hit; + Text = text; + Hit = hit; } public CNote(int startBeat, int duration, int tone, string text, ENoteType noteType) : this(startBeat, duration, tone, text) { - this.NoteType = noteType; + NoteType = noteType; } public CNote(int startBeat, int duration, int tone, string text, bool hit, ENoteType noteType) : this(startBeat, duration, tone, text) { - this.NoteType = noteType; - this.Hit = hit; + NoteType = noteType; + Hit = hit; } #endregion Constructors diff --git a/VocaluxeLib/Menu/SingNotes/CSingNotes.cs b/VocaluxeLib/Menu/SingNotes/CSingNotes.cs index 0df5b15c..526daadd 100644 --- a/VocaluxeLib/Menu/SingNotes/CSingNotes.cs +++ b/VocaluxeLib/Menu/SingNotes/CSingNotes.cs @@ -1,4 +1,23 @@ -using System; +#region license +// /* +// This file is part of Vocaluxe. +// +// Vocaluxe is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Vocaluxe is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with Vocaluxe. If not, see . +// */ +#endregion + +using System; using System.Collections.Generic; using System.Diagnostics; using System.Xml; diff --git a/VocaluxeLib/Menu/SingNotes/CSingNotesClassic.cs b/VocaluxeLib/Menu/SingNotes/CSingNotesClassic.cs index 53cc55fa..b13a8b59 100644 --- a/VocaluxeLib/Menu/SingNotes/CSingNotesClassic.cs +++ b/VocaluxeLib/Menu/SingNotes/CSingNotesClassic.cs @@ -1,4 +1,23 @@ -namespace VocaluxeLib.Menu.SingNotes +#region license +// /* +// This file is part of Vocaluxe. +// +// Vocaluxe is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Vocaluxe is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with Vocaluxe. If not, see . +// */ +#endregion + +namespace VocaluxeLib.Menu.SingNotes { class CSingNotesClassic : CSingNotes { diff --git a/VocaluxeLib/Menu/SingNotes/ISingNotes.cs b/VocaluxeLib/Menu/SingNotes/ISingNotes.cs index 0a814f4b..d5db470b 100644 --- a/VocaluxeLib/Menu/SingNotes/ISingNotes.cs +++ b/VocaluxeLib/Menu/SingNotes/ISingNotes.cs @@ -1,4 +1,23 @@ -using System.Collections.Generic; +#region license +// /* +// This file is part of Vocaluxe. +// +// Vocaluxe is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Vocaluxe is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with Vocaluxe. If not, see . +// */ +#endregion + +using System.Collections.Generic; namespace VocaluxeLib.Menu.SingNotes { diff --git a/VocaluxeLib/Menu/SongMenu/CSong.cs b/VocaluxeLib/Menu/SongMenu/CSong.cs index 3e2ac247..c74b7591 100644 --- a/VocaluxeLib/Menu/SongMenu/CSong.cs +++ b/VocaluxeLib/Menu/SongMenu/CSong.cs @@ -1,4 +1,23 @@ -using System; +#region license +// /* +// This file is part of Vocaluxe. +// +// Vocaluxe is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Vocaluxe is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with Vocaluxe. If not, see . +// */ +#endregion + +using System; using System.Collections.Generic; using System.IO; using System.Text; diff --git a/VocaluxeLib/Menu/SongMenu/CSongMenu.cs b/VocaluxeLib/Menu/SongMenu/CSongMenu.cs index 4c46093b..d70f4393 100644 --- a/VocaluxeLib/Menu/SongMenu/CSongMenu.cs +++ b/VocaluxeLib/Menu/SongMenu/CSongMenu.cs @@ -1,4 +1,23 @@ -using System.Xml; +#region license +// /* +// This file is part of Vocaluxe. +// +// Vocaluxe is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Vocaluxe is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with Vocaluxe. If not, see . +// */ +#endregion + +using System.Xml; using VocaluxeLib.PartyModes; namespace VocaluxeLib.Menu.SongMenu diff --git a/VocaluxeLib/Menu/SongMenu/CSongMenuBook.cs b/VocaluxeLib/Menu/SongMenu/CSongMenuBook.cs index e8503b9b..5bb8bb93 100644 --- a/VocaluxeLib/Menu/SongMenu/CSongMenuBook.cs +++ b/VocaluxeLib/Menu/SongMenu/CSongMenuBook.cs @@ -1,4 +1,23 @@ -namespace VocaluxeLib.Menu.SongMenu +#region license +// /* +// This file is part of Vocaluxe. +// +// Vocaluxe is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Vocaluxe is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with Vocaluxe. If not, see . +// */ +#endregion + +namespace VocaluxeLib.Menu.SongMenu { class CSongMenuBook : CSongMenuFramework { diff --git a/VocaluxeLib/Menu/SongMenu/CSongMenuDreidel.cs b/VocaluxeLib/Menu/SongMenu/CSongMenuDreidel.cs index b38a53fd..532c4043 100644 --- a/VocaluxeLib/Menu/SongMenu/CSongMenuDreidel.cs +++ b/VocaluxeLib/Menu/SongMenu/CSongMenuDreidel.cs @@ -1,4 +1,23 @@ -namespace VocaluxeLib.Menu.SongMenu +#region license +// /* +// This file is part of Vocaluxe. +// +// Vocaluxe is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Vocaluxe is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with Vocaluxe. If not, see . +// */ +#endregion + +namespace VocaluxeLib.Menu.SongMenu { class CSongMenuDreidel : CSongMenuFramework { @@ -21,6 +40,7 @@ return _actualSelection; } */ + public CSongMenuDreidel(int partyModeID) : base(partyModeID) {} diff --git a/VocaluxeLib/Menu/SongMenu/CSongMenuFramework.cs b/VocaluxeLib/Menu/SongMenu/CSongMenuFramework.cs index 3ada6f36..65822e8a 100644 --- a/VocaluxeLib/Menu/SongMenu/CSongMenuFramework.cs +++ b/VocaluxeLib/Menu/SongMenu/CSongMenuFramework.cs @@ -1,4 +1,23 @@ -using System; +#region license +// /* +// This file is part of Vocaluxe. +// +// Vocaluxe is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Vocaluxe is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with Vocaluxe. If not, see . +// */ +#endregion + +using System; using System.Collections.Generic; using System.Diagnostics; using System.IO; diff --git a/VocaluxeLib/Menu/SongMenu/CSongMenuList.cs b/VocaluxeLib/Menu/SongMenu/CSongMenuList.cs index 3111472a..ea8b83a5 100644 --- a/VocaluxeLib/Menu/SongMenu/CSongMenuList.cs +++ b/VocaluxeLib/Menu/SongMenu/CSongMenuList.cs @@ -1,4 +1,23 @@ -namespace VocaluxeLib.Menu.SongMenu +#region license +// /* +// This file is part of Vocaluxe. +// +// Vocaluxe is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Vocaluxe is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with Vocaluxe. If not, see . +// */ +#endregion + +namespace VocaluxeLib.Menu.SongMenu { class CSongMenuList : CSongMenuFramework { diff --git a/VocaluxeLib/Menu/SongMenu/CSongMenuTileBoard.cs b/VocaluxeLib/Menu/SongMenu/CSongMenuTileBoard.cs index ec382871..36307bef 100644 --- a/VocaluxeLib/Menu/SongMenu/CSongMenuTileBoard.cs +++ b/VocaluxeLib/Menu/SongMenu/CSongMenuTileBoard.cs @@ -1,4 +1,23 @@ -using System; +#region license +// /* +// This file is part of Vocaluxe. +// +// Vocaluxe is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Vocaluxe is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with Vocaluxe. If not, see . +// */ +#endregion + +using System; using System.Collections.Generic; using System.Drawing; using System.Windows.Forms; diff --git a/VocaluxeLib/Menu/SongMenu/ISongMenu.cs b/VocaluxeLib/Menu/SongMenu/ISongMenu.cs index c24c8d51..060a8cf4 100644 --- a/VocaluxeLib/Menu/SongMenu/ISongMenu.cs +++ b/VocaluxeLib/Menu/SongMenu/ISongMenu.cs @@ -1,4 +1,23 @@ -using VocaluxeLib.PartyModes; +#region license +// /* +// This file is part of Vocaluxe. +// +// Vocaluxe is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Vocaluxe is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with Vocaluxe. If not, see . +// */ +#endregion + +using VocaluxeLib.PartyModes; namespace VocaluxeLib.Menu.SongMenu { diff --git a/VocaluxeLib/Menu/Structs.cs b/VocaluxeLib/Menu/Structs.cs index fc792831..38a334e6 100644 --- a/VocaluxeLib/Menu/Structs.cs +++ b/VocaluxeLib/Menu/Structs.cs @@ -1,11 +1,30 @@ -using System; +#region license +// /* +// This file is part of Vocaluxe. +// +// Vocaluxe is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Vocaluxe is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with Vocaluxe. If not, see . +// */ +#endregion + +using System; using System.Collections.Generic; using System.Windows.Forms; - using VocaluxeLib.Menu.SingNotes; namespace VocaluxeLib.Menu { + #region Drawing public struct SColorF { diff --git a/VocaluxeLib/PartyModes/CPartyMode.cs b/VocaluxeLib/PartyModes/CPartyMode.cs index 32c425f9..c78b9565 100644 --- a/VocaluxeLib/PartyModes/CPartyMode.cs +++ b/VocaluxeLib/PartyModes/CPartyMode.cs @@ -1,4 +1,23 @@ -using System; +#region license +// /* +// This file is part of Vocaluxe. +// +// Vocaluxe is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Vocaluxe is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with Vocaluxe. If not, see . +// */ +#endregion + +using System; using System.Collections.Generic; using VocaluxeLib.Menu; diff --git a/VocaluxeLib/PartyModes/CPartyModeNone.cs b/VocaluxeLib/PartyModes/CPartyModeNone.cs index 00422ab8..bb75b0b0 100644 --- a/VocaluxeLib/PartyModes/CPartyModeNone.cs +++ b/VocaluxeLib/PartyModes/CPartyModeNone.cs @@ -1,4 +1,23 @@ -using System; +#region license +// /* +// This file is part of Vocaluxe. +// +// Vocaluxe is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Vocaluxe is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with Vocaluxe. If not, see . +// */ +#endregion + +using System; using VocaluxeLib.Menu; namespace VocaluxeLib.PartyModes diff --git a/VocaluxeLib/PartyModes/CScreenPartyDummy.cs b/VocaluxeLib/PartyModes/CScreenPartyDummy.cs index b67deb71..555e97e8 100644 --- a/VocaluxeLib/PartyModes/CScreenPartyDummy.cs +++ b/VocaluxeLib/PartyModes/CScreenPartyDummy.cs @@ -1,4 +1,23 @@ -using System.Windows.Forms; +#region license +// /* +// This file is part of Vocaluxe. +// +// Vocaluxe is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Vocaluxe is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with Vocaluxe. If not, see . +// */ +#endregion + +using System.Windows.Forms; using VocaluxeLib.Menu; namespace VocaluxeLib.PartyModes diff --git a/VocaluxeLib/PartyModes/IPartyMode.cs b/VocaluxeLib/PartyModes/IPartyMode.cs index 5d2fa8bb..a747638d 100644 --- a/VocaluxeLib/PartyModes/IPartyMode.cs +++ b/VocaluxeLib/PartyModes/IPartyMode.cs @@ -1,4 +1,23 @@ -using System; +#region license +// /* +// This file is part of Vocaluxe. +// +// Vocaluxe is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Vocaluxe is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with Vocaluxe. If not, see . +// */ +#endregion + +using System; using VocaluxeLib.Menu; namespace VocaluxeLib.PartyModes diff --git a/VocaluxeLib/Properties/AssemblyInfo.cs b/VocaluxeLib/Properties/AssemblyInfo.cs index 48dc08f0..0820e156 100644 --- a/VocaluxeLib/Properties/AssemblyInfo.cs +++ b/VocaluxeLib/Properties/AssemblyInfo.cs @@ -1,9 +1,29 @@ -using System.Reflection; +#region license +// /* +// This file is part of Vocaluxe. +// +// Vocaluxe is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Vocaluxe is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with Vocaluxe. If not, see . +// */ +#endregion + +using System.Reflection; using System.Runtime.InteropServices; // Allgemeine Informationen über eine Assembly werden über die folgenden // Attribute gesteuert. Ändern Sie diese Attributwerte, um die Informationen zu ändern, // die mit einer Assembly verknüpft sind. + [assembly: AssemblyTitle("VocaluxeLib")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] @@ -16,9 +36,11 @@ using System.Runtime.InteropServices; // Durch Festlegen von ComVisible auf "false" werden die Typen in dieser Assembly unsichtbar // für COM-Komponenten. Wenn Sie auf einen Typ in dieser Assembly von // COM zugreifen müssen, legen Sie das ComVisible-Attribut für diesen Typ auf "true" fest. + [assembly: ComVisible(false)] // Die folgende GUID bestimmt die ID der Typbibliothek, wenn dieses Projekt für COM verfügbar gemacht wird + [assembly: Guid("3fb7cd34-186d-4f89-beb5-8830b8e5593b")] // Versionsinformationen für eine Assembly bestehen aus den folgenden vier Werten: @@ -31,5 +53,6 @@ using System.Runtime.InteropServices; // Sie können alle Werte angeben oder die standardmäßigen Build- und Revisionsnummern // übernehmen, indem Sie "*" eingeben: // [assembly: AssemblyVersion("1.0.*")] + [assembly: AssemblyVersion("1.0.0.0")] [assembly: AssemblyFileVersion("1.0.0.0")] \ No newline at end of file From 9aa81b7ba24b47088dc7b10683f397da5fefd0f0 Mon Sep 17 00:00:00 2001 From: Flamefire Date: Thu, 18 Apr 2013 21:46:46 +0200 Subject: [PATCH 05/27] Fixed some Re# warnings --- Vocaluxe/Base/CConfig.cs | 40 +-- Vocaluxe/Lib/Draw/CDirect3D.cs | 562 ++++++++++++++---------------- Vocaluxe/Lib/Draw/CDrawWinForm.cs | 8 +- Vocaluxe/Lib/Draw/COpenGL.cs | 7 +- Vocaluxe/Lib/Draw/IDraw.cs | 2 +- 5 files changed, 273 insertions(+), 346 deletions(-) diff --git a/Vocaluxe/Base/CConfig.cs b/Vocaluxe/Base/CConfig.cs index 5dcc3480..dff34be2 100644 --- a/Vocaluxe/Base/CConfig.cs +++ b/Vocaluxe/Base/CConfig.cs @@ -20,6 +20,7 @@ using System; using System.Collections.Generic; using System.IO; +using System.Linq; using System.Text; using System.Text.RegularExpressions; using System.Windows.Forms; @@ -75,7 +76,7 @@ namespace Vocaluxe.Base public static EPlaybackLib PlayBackLib = EPlaybackLib.Gstreamer; public static ERecordLib RecordLib = ERecordLib.PortAudio; public static EBufferSize AudioBufferSize = EBufferSize.B2048; - public static int AudioLatency = 0; + public static int AudioLatency; public static int BackgroundMusicVolume = 30; public static EOffOn BackgroundMusic = EOffOn.TR_CONFIG_ON; public static EBackgroundMusicSource BackgroundMusicSource = EBackgroundMusicSource.TR_CONFIG_NO_OWN_MUSIC; @@ -84,7 +85,7 @@ namespace Vocaluxe.Base public static int GameMusicVolume = 80; // Game - public static List SongFolder = new List(); + public static readonly List SongFolder = new List(); public static ESongMenu SongMenu = ESongMenu.TR_CONFIG_TILE_BOARD; public static ESongSorting SongSorting = ESongSorting.TR_CONFIG_ARTIST; public static EOffOn IgnoreArticles = EOffOn.TR_CONFIG_ON; @@ -94,7 +95,7 @@ namespace Vocaluxe.Base public static EOffOn Tabs = EOffOn.TR_CONFIG_OFF; public static string Language = "English"; public static EOffOn LyricsOnTop = EOffOn.TR_CONFIG_OFF; - public static string[] Players = new string[CSettings.MaxNumPlayer]; + public static readonly string[] Players = new string[CSettings.MaxNumPlayer]; public static float MinLineBreakTime = 0.1f; //Minimum time to show the text before it is (to be) sung (if possible) @@ -132,17 +133,14 @@ namespace Vocaluxe.Base if (!File.Exists(CSettings.FileConfig)) SaveConfig(); - LoadConfig(); + _LoadConfig(); } - public static bool LoadConfig() + private static void _LoadConfig() { CXMLReader xmlReader = CXMLReader.OpenFile(CSettings.FileConfig); if (xmlReader == null) - return false; - - string value = string.Empty; - + return; xmlReader.TryGetEnumValue("//root/Debug/DebugLevel", ref DebugLevel); @@ -191,7 +189,7 @@ namespace Vocaluxe.Base #region Game // Songfolder - value = string.Empty; + string value = string.Empty; int i = 1; while (xmlReader.GetValue("//root/Game/SongFolder" + i.ToString(), ref value, value)) { @@ -251,7 +249,6 @@ namespace Vocaluxe.Base #region Record MicConfig = new SMicConfig[CSettings.MaxNumPlayer]; - value = string.Empty; for (int p = 1; p <= CSettings.MaxNumPlayer; p++) { MicConfig[p - 1] = new SMicConfig(0); @@ -264,8 +261,6 @@ namespace Vocaluxe.Base xmlReader.TryGetIntValueRange("//root/Record/MicDelay", ref MicDelay, 0, 500); MicDelay = (int)(20 * Math.Round(MicDelay / 20.0)); #endregion Record - - return true; } public static bool SaveConfig() @@ -585,8 +580,6 @@ namespace Vocaluxe.Base if (devices == null) return false; - if (devices != null) - { for (int dev = 0; dev < devices.Length; dev++) { for (int inp = 0; inp < devices[dev].Inputs.Count; inp++) @@ -596,8 +589,6 @@ namespace Vocaluxe.Base } } return false; - } - return false; } /// @@ -683,9 +674,7 @@ namespace Vocaluxe.Base Regex spliterParam = new Regex(@"ReplacedStr:::0:::", RegexOptions.IgnoreCase); //Complete argument string - string arguments = string.Empty; - foreach (string arg in args) - arguments += arg + " "; + string arguments = args.Aggregate(string.Empty, (current, arg) => current + (arg + " ")); args = spliterParam.Split(arguments); @@ -693,11 +682,8 @@ namespace Vocaluxe.Base { Regex spliterVal = new Regex(@"ReplacedStr:::2:::", RegexOptions.IgnoreCase); - //Array for parts of an arg - string[] parts; - //split arg with Spilter-Regex and save in parts - parts = spliterVal.Split(text, 2); + string[] parts = spliterVal.Split(text, 2); switch (parts.Length) { @@ -812,11 +798,7 @@ namespace Vocaluxe.Base if (value.Contains(chars[i].ToString())) return false; } - if (Path.GetFileName(value).Length == 0) - return false; - if (!Path.HasExtension(value)) - return false; - return true; + return !String.IsNullOrEmpty(Path.GetFileName(value)) && Path.HasExtension(value); } /// diff --git a/Vocaluxe/Lib/Draw/CDirect3D.cs b/Vocaluxe/Lib/Draw/CDirect3D.cs index c27c7e76..e79e1473 100644 --- a/Vocaluxe/Lib/Draw/CDirect3D.cs +++ b/Vocaluxe/Lib/Draw/CDirect3D.cs @@ -126,19 +126,21 @@ namespace Vocaluxe.Lib.Draw ClientSize = new Size(CConfig.ScreenW, CConfig.ScreenH); _SizeBeforeMinimize = ClientSize; - _PresentParameters = new PresentParameters(); - _PresentParameters.Windowed = true; - _PresentParameters.SwapEffect = SwapEffect.Discard; - _PresentParameters.BackBufferHeight = CConfig.ScreenH; - _PresentParameters.BackBufferWidth = CConfig.ScreenW; - _PresentParameters.BackBufferFormat = _D3D.Adapters.DefaultAdapter.CurrentDisplayMode.Format; - _PresentParameters.Multisample = MultisampleType.None; - _PresentParameters.MultisampleQuality = 0; + _PresentParameters = new PresentParameters + { + Windowed = true, + SwapEffect = SwapEffect.Discard, + BackBufferHeight = CConfig.ScreenH, + BackBufferWidth = CConfig.ScreenW, + BackBufferFormat = _D3D.Adapters.DefaultAdapter.CurrentDisplayMode.Format, + Multisample = MultisampleType.None, + MultisampleQuality = 0 + }; //Apply antialiasing and check if antialiasing mode is supported #region Antialiasing - int quality = 1; + int quality; MultisampleType msType; switch (CConfig.AAMode) { @@ -174,18 +176,11 @@ namespace Vocaluxe.Lib.Draw #endregion Antialiasing //Apply the VSync configuration - if (CConfig.VSync == EOffOn.TR_CONFIG_ON) - _PresentParameters.PresentationInterval = PresentInterval.Default; - else - _PresentParameters.PresentationInterval = PresentInterval.Immediate; + _PresentParameters.PresentationInterval = CConfig.VSync == EOffOn.TR_CONFIG_ON ? PresentInterval.Default : PresentInterval.Immediate; //GMA 950 graphics devices can only process vertices in software mode Capabilities caps = _D3D.GetDeviceCaps(_D3D.Adapters.DefaultAdapter.Adapter, DeviceType.Hardware); - CreateFlags flags = CreateFlags.None; - if ((caps.DeviceCaps & DeviceCaps.HWTransformAndLight) != 0) - flags = CreateFlags.HardwareVertexProcessing; - else - flags = CreateFlags.SoftwareVertexProcessing; + CreateFlags flags = (caps.DeviceCaps & DeviceCaps.HWTransformAndLight) != 0 ? CreateFlags.HardwareVertexProcessing : CreateFlags.SoftwareVertexProcessing; //Check if Pow2 textures are needed _NonPowerOf2TextureSupported = true; @@ -290,7 +285,7 @@ namespace Vocaluxe.Lib.Draw _PresentParameters.BackBufferHeight = ClientSize.Height; ClearScreen(); //To set new PresentParameters the device has to be resetted - Reset(); + _Reset(); //All configurations got flushed due to Reset(), so apply them again Init(); @@ -417,82 +412,80 @@ namespace Vocaluxe.Lib.Draw /// True if it succeeded else false public bool Init() { - if (!_Device.Disposed) - { - Text = CSettings.GetFullVersionText(); - SlimDX.Matrix translate = SlimDX.Matrix.Translation(new Vector3(-CSettings.RenderW / 2, CSettings.RenderH / 2, 0)); - SlimDX.Matrix projection = SlimDX.Matrix.OrthoOffCenterLH(-CSettings.RenderW / 2, CSettings.RenderW / 2, -CSettings.RenderH / 2, CSettings.RenderH / 2, - CSettings.ZNear, CSettings.ZFar); - _VertexBuffer = new VertexBuffer(_Device, CSettings.VertexBufferElements * (4 * Marshal.SizeOf(typeof(STexturedColoredVertex))), Usage.WriteOnly | Usage.Dynamic, - VertexFormat.Position | VertexFormat.Texture1 | VertexFormat.Diffuse, Pool.Default); - - if (_Device.SetStreamSource(0, _VertexBuffer, 0, Marshal.SizeOf(typeof(STexturedColoredVertex))).IsFailure) - CLog.LogError("Failed to set stream source"); - _Device.VertexDeclaration = STexturedColoredVertex.GetDeclaration(_Device); - if (_Device.SetTransform(TransformState.Projection, projection).IsFailure) - CLog.LogError("Failed to set orthogonal matrix"); - if (_Device.SetTransform(TransformState.World, translate).IsFailure) - CLog.LogError("Failed to set translation matrix"); - if (_Device.SetRenderState(RenderState.CullMode, Cull.None).IsFailure) - CLog.LogError("Failed to set cull mode"); - if (_Device.SetRenderState(RenderState.AlphaBlendEnable, true).IsFailure) - CLog.LogError("Failed to enable alpha blending"); - if (_Device.SetRenderState(RenderState.Lighting, false).IsFailure) - CLog.LogError("Failed to disable lighting"); - if (_Device.SetRenderState(RenderState.DestinationBlend, SlimDX.Direct3D9.Blend.InverseSourceAlpha).IsFailure) - CLog.LogError("Failed to set destination blend"); - if (_Device.SetRenderState(RenderState.SourceBlend, SlimDX.Direct3D9.Blend.SourceAlpha).IsFailure) - CLog.LogError("Failed to set source blend"); - if (_PresentParameters.Multisample != MultisampleType.None) - { - if (_Device.SetRenderState(RenderState.MultisampleAntialias, true).IsFailure) - CLog.LogError("Failed to set antialiasing"); - } - if (_Device.SetSamplerState(0, SamplerState.MinFilter, TextureFilter.Linear).IsFailure) - CLog.LogError("Failed to set min filter"); - if (_Device.SetSamplerState(0, SamplerState.MagFilter, TextureFilter.Linear).IsFailure) - CLog.LogError("Failed to set mag filter"); - if (_Device.SetSamplerState(0, SamplerState.MipFilter, TextureFilter.Linear).IsFailure) - CLog.LogError("Failed to set mip filter"); - if (_Device.SetSamplerState(0, SamplerState.AddressU, TextureAddress.Clamp).IsFailure) - CLog.LogError("Failed to set clamping on u"); - if (_Device.SetSamplerState(0, SamplerState.AddressV, TextureAddress.Clamp).IsFailure) - CLog.LogError("Failed to set claming on v"); - if (_Device.SetTextureStageState(0, TextureStage.AlphaArg1, TextureArgument.Texture).IsFailure) - CLog.LogError("Failed to set alpha argument 1"); - if (_Device.SetTextureStageState(0, TextureStage.AlphaArg2, TextureArgument.Diffuse).IsFailure) - CLog.LogError("Failed to set alpha argument 2"); - if (_Device.SetTextureStageState(0, TextureStage.AlphaOperation, TextureOperation.Modulate).IsFailure) - CLog.LogError("Failed to set alpha operation"); - - Int16[] indices = new Int16[6]; - indices[0] = 0; - indices[1] = 1; - indices[2] = 2; - indices[3] = 0; - indices[4] = 2; - indices[5] = 3; - - _IndexBuffer = new IndexBuffer(_Device, 6 * sizeof(Int16), Usage.WriteOnly, Pool.Managed, true); - - DataStream stream = _IndexBuffer.Lock(0, 0, LockFlags.Discard); - stream.WriteRange(indices); - _IndexBuffer.Unlock(); - _Device.Indices = _IndexBuffer; - - //This creates a new white texture and adds it to the texture pool - //This texture is used for the DrawRect method - using (Bitmap blankMap = new Bitmap(1, 1)) - { - Graphics g = Graphics.FromImage(blankMap); - g.Clear(Color.White); - g.Dispose(); - _BlankTexture = AddTexture(blankMap); - } - return true; - } - else + if (_Device.Disposed) return false; + Text = CSettings.GetFullVersionText(); + SlimDX.Matrix translate = SlimDX.Matrix.Translation(new Vector3(-(float)CSettings.RenderW / 2, (float)CSettings.RenderH / 2, 0)); + SlimDX.Matrix projection = SlimDX.Matrix.OrthoOffCenterLH(-(float)CSettings.RenderW / 2, (float)CSettings.RenderW / 2, -(float)CSettings.RenderH / 2, + (float)CSettings.RenderH / 2, + CSettings.ZNear, CSettings.ZFar); + _VertexBuffer = new VertexBuffer(_Device, CSettings.VertexBufferElements * (4 * Marshal.SizeOf(typeof(STexturedColoredVertex))), Usage.WriteOnly | Usage.Dynamic, + VertexFormat.Position | VertexFormat.Texture1 | VertexFormat.Diffuse, Pool.Default); + + if (_Device.SetStreamSource(0, _VertexBuffer, 0, Marshal.SizeOf(typeof(STexturedColoredVertex))).IsFailure) + CLog.LogError("Failed to set stream source"); + _Device.VertexDeclaration = STexturedColoredVertex.GetDeclaration(_Device); + if (_Device.SetTransform(TransformState.Projection, projection).IsFailure) + CLog.LogError("Failed to set orthogonal matrix"); + if (_Device.SetTransform(TransformState.World, translate).IsFailure) + CLog.LogError("Failed to set translation matrix"); + if (_Device.SetRenderState(RenderState.CullMode, Cull.None).IsFailure) + CLog.LogError("Failed to set cull mode"); + if (_Device.SetRenderState(RenderState.AlphaBlendEnable, true).IsFailure) + CLog.LogError("Failed to enable alpha blending"); + if (_Device.SetRenderState(RenderState.Lighting, false).IsFailure) + CLog.LogError("Failed to disable lighting"); + if (_Device.SetRenderState(RenderState.DestinationBlend, SlimDX.Direct3D9.Blend.InverseSourceAlpha).IsFailure) + CLog.LogError("Failed to set destination blend"); + if (_Device.SetRenderState(RenderState.SourceBlend, SlimDX.Direct3D9.Blend.SourceAlpha).IsFailure) + CLog.LogError("Failed to set source blend"); + if (_PresentParameters.Multisample != MultisampleType.None) + { + if (_Device.SetRenderState(RenderState.MultisampleAntialias, true).IsFailure) + CLog.LogError("Failed to set antialiasing"); + } + if (_Device.SetSamplerState(0, SamplerState.MinFilter, TextureFilter.Linear).IsFailure) + CLog.LogError("Failed to set min filter"); + if (_Device.SetSamplerState(0, SamplerState.MagFilter, TextureFilter.Linear).IsFailure) + CLog.LogError("Failed to set mag filter"); + if (_Device.SetSamplerState(0, SamplerState.MipFilter, TextureFilter.Linear).IsFailure) + CLog.LogError("Failed to set mip filter"); + if (_Device.SetSamplerState(0, SamplerState.AddressU, TextureAddress.Clamp).IsFailure) + CLog.LogError("Failed to set clamping on u"); + if (_Device.SetSamplerState(0, SamplerState.AddressV, TextureAddress.Clamp).IsFailure) + CLog.LogError("Failed to set claming on v"); + if (_Device.SetTextureStageState(0, TextureStage.AlphaArg1, TextureArgument.Texture).IsFailure) + CLog.LogError("Failed to set alpha argument 1"); + if (_Device.SetTextureStageState(0, TextureStage.AlphaArg2, TextureArgument.Diffuse).IsFailure) + CLog.LogError("Failed to set alpha argument 2"); + if (_Device.SetTextureStageState(0, TextureStage.AlphaOperation, TextureOperation.Modulate).IsFailure) + CLog.LogError("Failed to set alpha operation"); + + Int16[] indices = new Int16[6]; + indices[0] = 0; + indices[1] = 1; + indices[2] = 2; + indices[3] = 0; + indices[4] = 2; + indices[5] = 3; + + _IndexBuffer = new IndexBuffer(_Device, 6 * sizeof(Int16), Usage.WriteOnly, Pool.Managed, true); + + DataStream stream = _IndexBuffer.Lock(0, 0, LockFlags.Discard); + stream.WriteRange(indices); + _IndexBuffer.Unlock(); + _Device.Indices = _IndexBuffer; + + //This creates a new white texture and adds it to the texture pool + //This texture is used for the DrawRect method + using (Bitmap blankMap = new Bitmap(1, 1)) + { + Graphics g = Graphics.FromImage(blankMap); + g.Clear(Color.White); + g.Dispose(); + _BlankTexture = AddTexture(blankMap); + } + return true; } /// @@ -511,61 +504,57 @@ namespace Vocaluxe.Lib.Draw } //Resize window if aspect ratio is incorrect - if (_W / (float)_H != CSettings.GetRenderAspect()) + if (Math.Abs(_W / (float)_H - CSettings.GetRenderAspect()) > 0.01) _DoResize(); while (_Run) { Application.DoEvents(); - - if (_Run) + //Clear the previous Frame + ClearScreen(); + //We want to begin drawing + if (_Device.BeginScene().IsFailure) + CLog.LogError("Failed to begin scene"); + _CheckQueque(); + _Run = _Run && CGraphics.Draw(); + _RenderVertexBuffer(); + //We finished drawing the frame + if (_Device.EndScene().IsFailure) + CLog.LogError("Failed to end scene"); + _Run = CGraphics.UpdateGameLogic(_Keys, _Mouse); + try { - //Clear the previous Frame - ClearScreen(); - //We want to begin drawing - if (_Device.BeginScene().IsFailure) - CLog.LogError("Failed to begin scene"); - _CheckQueque(); - _Run = _Run && CGraphics.Draw(); - _RenderVertexBuffer(); - //We finished drawing the frame - if (_Device.EndScene().IsFailure) - CLog.LogError("Failed to end scene"); - _Run = CGraphics.UpdateGameLogic(_Keys, _Mouse); - try - { - //Now push the frame to the Viewport - _Device.Present(); - } - catch (Direct3D9Exception) - { - //In Direct3D devices can get lost. - //This happens for example when opening the Task Manager in Vista/Windows 7 or if a UAC message is opening - //We need to reset the device to get it to workable state again - //After a reset Init() needs to be called because all data in the Direct3D default pool are lost and need to be recreated - if (_Device.TestCooperativeLevel() == ResultCode.DeviceNotReset) - { - Reset(); - Init(); - } - } - //Apply fullscreen mode - if (CSettings.IsFullScreen != _Fullscreen) - { - if (!_Fullscreen) - _EnterFullScreen(); - else - _LeaveFullScreen(); - } - if (CTime.IsRunning()) - delay = (int)Math.Floor(CConfig.CalcCycleTime() - CTime.GetMilliseconds()); - - if (delay >= 1 && CConfig.VSync == EOffOn.TR_CONFIG_OFF) - Thread.Sleep(delay); - //Calculate the FPS Rate and restart the timer after a frame - CTime.CalculateFPS(); - CTime.Restart(); + //Now push the frame to the Viewport + _Device.Present(); } + catch (Direct3D9Exception) + { + //In Direct3D devices can get lost. + //This happens for example when opening the Task Manager in Vista/Windows 7 or if a UAC message is opening + //We need to reset the device to get it to workable state again + //After a reset Init() needs to be called because all data in the Direct3D default pool are lost and need to be recreated + if (_Device.TestCooperativeLevel() == ResultCode.DeviceNotReset) + { + _Reset(); + Init(); + } + } + //Apply fullscreen mode + if (CSettings.IsFullScreen != _Fullscreen) + { + if (!_Fullscreen) + _EnterFullScreen(); + else + _LeaveFullScreen(); + } + if (CTime.IsRunning()) + delay = (int)Math.Floor(CConfig.CalcCycleTime() - CTime.GetMilliseconds()); + + if (delay >= 1 && CConfig.VSync == EOffOn.TR_CONFIG_OFF) + Thread.Sleep(delay); + //Calculate the FPS Rate and restart the timer after a frame + CTime.CalculateFPS(); + CTime.Restart(); } Close(); } @@ -573,7 +562,7 @@ namespace Vocaluxe.Lib.Draw /// /// Resets the device, all objects in the Direct3D default pool get flushed and need to be recreated /// - public void Reset() + private void _Reset() { //Dispose all objects in the default pool, those need to be recreated STexturedColoredVertex.GetDeclaration(_Device).Dispose(); @@ -670,31 +659,30 @@ namespace Vocaluxe.Lib.Draw /// private void _RenderVertexBuffer() { - if (_Vertices.Count > 0) - { - //The vertex buffer locks are slow actions, its better to lock once per frame and write all vertices to the buffer at once - DataStream stream = _VertexBuffer.Lock(0, _Vertices.Count * Marshal.SizeOf(typeof(STexturedColoredVertex)), LockFlags.Discard); - stream.WriteRange(_Vertices.ToArray()); - _VertexBuffer.Unlock(); - stream.Dispose(); + if (_Vertices.Count <= 0) + return; + //The vertex buffer locks are slow actions, its better to lock once per frame and write all vertices to the buffer at once + DataStream stream = _VertexBuffer.Lock(0, _Vertices.Count * Marshal.SizeOf(typeof(STexturedColoredVertex)), LockFlags.Discard); + stream.WriteRange(_Vertices.ToArray()); + _VertexBuffer.Unlock(); + stream.Dispose(); - for (int i = 0; i < _Vertices.Count; i += 4) - { - //Apply rotation - if (_Device.SetTransform(TransformState.World, _VerticesRotationMatrices.Dequeue()).IsFailure) - CLog.LogError("Failed to set world transformation"); - //Apply texture - if (_Device.SetTexture(0, _VerticesTextures.Dequeue()).IsFailure) - CLog.LogError("Failed to set texture"); - //Draw 2 triangles from vertexbuffer - if (_Device.DrawIndexedPrimitives(PrimitiveType.TriangleList, i, 0, 4, 0, 2).IsFailure) - CLog.LogError("Failed to draw quad"); - } - //Clear the queues for the next frame - _Vertices.Clear(); - _VerticesTextures.Clear(); - _VerticesRotationMatrices.Clear(); + for (int i = 0; i < _Vertices.Count; i += 4) + { + //Apply rotation + if (_Device.SetTransform(TransformState.World, _VerticesRotationMatrices.Dequeue()).IsFailure) + CLog.LogError("Failed to set world transformation"); + //Apply texture + if (_Device.SetTexture(0, _VerticesTextures.Dequeue()).IsFailure) + CLog.LogError("Failed to set texture"); + //Draw 2 triangles from vertexbuffer + if (_Device.DrawIndexedPrimitives(PrimitiveType.TriangleList, i, 0, 4, 0, 2).IsFailure) + CLog.LogError("Failed to draw quad"); } + //Clear the queues for the next frame + _Vertices.Clear(); + _VerticesTextures.Clear(); + _VerticesRotationMatrices.Clear(); } #endregion main stuff @@ -744,7 +732,7 @@ namespace Vocaluxe.Lib.Draw /// The texture in which the frame is copied to public void CopyScreen(ref STexture texture) { - if (!_TextureExists(ref texture) || (texture.Width != GetScreenWidth()) || (texture.Height != GetScreenHeight())) + if (!_TextureExists(ref texture) || (Math.Abs(texture.Width - GetScreenWidth()) > float.Epsilon) || (Math.Abs(texture.Height - GetScreenHeight()) > float.Epsilon)) { RemoveTexture(ref texture); texture = CopyScreen(); @@ -762,7 +750,7 @@ namespace Vocaluxe.Lib.Draw /// public void MakeScreenShot() { - string file = "Screenshot_"; + const string file = "Screenshot_"; string path = Path.Combine(Environment.CurrentDirectory, CSettings.FolderScreenshots); int i = 0; @@ -794,7 +782,7 @@ namespace Vocaluxe.Lib.Draw /// The end y-value public void DrawLine(int a, int r, int g, int b, int w, int x1, int y1, int x2, int y2) { - SColorF color = new SColorF(a / 255, g / 255, b / 255, a / 255); + SColorF color = new SColorF((float)a / 255, (float)g / 255, (float)b / 255, (float)a / 255); DrawTexture(_BlankTexture, new SRectF(x1, y1, x2, y2, 1), color); } @@ -805,20 +793,8 @@ namespace Vocaluxe.Lib.Draw /// The text's x-position /// The text's y-position /// The text's height - public void DrawText(string text, int x, int y, int h) - { - DrawText(text, x, y, h, 0f); - } - - /// - /// Draws a text string - /// - /// The text to be drawn - /// The text's x-position - /// The text's y-position - /// The text's height - /// The text's x-position - public void DrawText(string text, int x, int y, float h, float z) + /// The text's z-position + public void DrawText(string text, int x, int y, int h, int z = 0) { CFonts.DrawText(text, h, x, y, z, new SColorF(1f, 1f, 1f, 1f)); } @@ -871,7 +847,7 @@ namespace Vocaluxe.Lib.Draw STexture s; try { - s = AddTexture(bmp, texturePath); + s = AddTexture(bmp); } finally { @@ -887,9 +863,8 @@ namespace Vocaluxe.Lib.Draw /// Adds a texture and stores it in the Vram /// /// The Bitmap of which the texure will be created from - /// The path to the texture /// A STexture object containing the added texture - public STexture AddTexture(Bitmap bmp, string texturePath) + public STexture AddTexture(Bitmap bmp) { if (bmp.Height == 0 || bmp.Width == 0) return new STexture(-1); @@ -971,22 +946,9 @@ namespace Vocaluxe.Lib.Draw bmp2.Dispose(); } - if (data == null) - return new STexture(-1); - return AddTexture(w, h, ref data); } - /// - /// Adds a texture and stores it in the Vram - /// - /// The Bitmap of which the texure will be created from - /// A STexture object containing the added texture - public STexture AddTexture(Bitmap bmp) - { - return AddTexture(bmp, String.Empty); - } - public STexture AddTexture(int w, int h, IntPtr data) { byte[] pointerData = new Byte[4 * w * h]; @@ -1051,11 +1013,8 @@ namespace Vocaluxe.Lib.Draw public STexture QuequeTexture(int w, int h, ref byte[] data) { STexture texture = new STexture(-1); - STextureQueque queque = new STextureQueque(); + STextureQueque queque = new STextureQueque {Data = data, Height = h, Width = w}; - queque.Data = data; - queque.Height = h; - queque.Width = w; texture.Height = h; texture.Width = w; @@ -1131,8 +1090,7 @@ namespace Vocaluxe.Lib.Draw s.UnlockRectangle(); return true; */ } - else - return false; + return false; } #endregion updating @@ -1331,36 +1289,35 @@ namespace Vocaluxe.Lib.Draw /// A Value ranging from 0 to 1 containing the ending of the texture public void DrawTexture(STexture texture, SRectF rect, SColorF color, float begin, float end) { - if (_TextureExists(ref texture)) - { - if (_D3DTextures[texture.Index] == null) - return; + if (!_TextureExists(ref texture)) + return; + if (_D3DTextures[texture.Index] == null) + return; - float x1 = 0f + begin * texture.WidthRatio; - float x2 = texture.WidthRatio * end; - float y1 = 0f; - float y2 = texture.HeightRatio; + float x1 = 0f + begin * texture.WidthRatio; + float x2 = texture.WidthRatio * end; + const float y1 = 0f; + float y2 = texture.HeightRatio; - float rx1 = rect.X + begin * rect.W; - float rx2 = rect.X + end * rect.W; - float ry1 = rect.Y; - float ry2 = rect.Y + rect.H; + float rx1 = rect.X + begin * rect.W; + float rx2 = rect.X + end * rect.W; + float ry1 = rect.Y; + float ry2 = rect.Y + rect.H; - //Align the pixels because Direct3D expects the pixels to be the left top corner - rx1 -= 0.5f; - ry1 -= 0.5f; - rx2 -= 0.5f; - ry2 -= 0.5f; + //Align the pixels because Direct3D expects the pixels to be the left top corner + rx1 -= 0.5f; + ry1 -= 0.5f; + rx2 -= 0.5f; + ry2 -= 0.5f; - Color c = Color.FromArgb((int)(color.A * 255 * CGraphics.GlobalAlpha), (int)(color.R * 255), (int)(color.G * 255), (int)(color.B * 255)); + Color c = Color.FromArgb((int)(color.A * 255 * CGraphics.GlobalAlpha), (int)(color.R * 255), (int)(color.G * 255), (int)(color.B * 255)); - STexturedColoredVertex[] vert = new STexturedColoredVertex[4]; - vert[0] = new STexturedColoredVertex(new Vector3(rx1, -ry1, rect.Z + CGraphics.ZOffset), new Vector2(x1, y1), c.ToArgb()); - vert[1] = new STexturedColoredVertex(new Vector3(rx1, -ry2, rect.Z + CGraphics.ZOffset), new Vector2(x1, y2), c.ToArgb()); - vert[2] = new STexturedColoredVertex(new Vector3(rx2, -ry2, rect.Z + CGraphics.ZOffset), new Vector2(x2, y2), c.ToArgb()); - vert[3] = new STexturedColoredVertex(new Vector3(rx2, -ry1, rect.Z + CGraphics.ZOffset), new Vector2(x2, y1), c.ToArgb()); - _AddToVertexBuffer(vert, _D3DTextures[texture.Index], _CalculateRotationMatrix(rect.Rotation, rx1, rx2, ry1, ry2)); - } + STexturedColoredVertex[] vert = new STexturedColoredVertex[4]; + vert[0] = new STexturedColoredVertex(new Vector3(rx1, -ry1, rect.Z + CGraphics.ZOffset), new Vector2(x1, y1), c.ToArgb()); + vert[1] = new STexturedColoredVertex(new Vector3(rx1, -ry2, rect.Z + CGraphics.ZOffset), new Vector2(x1, y2), c.ToArgb()); + vert[2] = new STexturedColoredVertex(new Vector3(rx2, -ry2, rect.Z + CGraphics.ZOffset), new Vector2(x2, y2), c.ToArgb()); + vert[3] = new STexturedColoredVertex(new Vector3(rx2, -ry1, rect.Z + CGraphics.ZOffset), new Vector2(x2, y1), c.ToArgb()); + _AddToVertexBuffer(vert, _D3DTextures[texture.Index], _CalculateRotationMatrix(rect.Rotation, rx1, rx2, ry1, ry2)); } /// @@ -1374,76 +1331,76 @@ namespace Vocaluxe.Lib.Draw /// The height of the reflection public void DrawTextureReflection(STexture texture, SRectF rect, SColorF color, SRectF bounds, float space, float height) { + if (!_TextureExists(ref texture)) + return; + if (_D3DTextures[texture.Index] == null) + return; + + if (Math.Abs(rect.W) < float.Epsilon || Math.Abs(rect.H) < float.Epsilon || Math.Abs(bounds.H) < float.Epsilon || Math.Abs(bounds.W) < float.Epsilon || + Math.Abs(color.A) < float.Epsilon || height <= 0f) + return; + + if (bounds.X > rect.X + rect.W || bounds.X + bounds.W < rect.X) + return; + + if (bounds.Y > rect.Y + rect.H || bounds.Y + bounds.H < rect.Y) + return; + + if (height > bounds.H) + height = bounds.H; + if (_TextureExists(ref texture)) { - if (_D3DTextures[texture.Index] == null) - return; + float x1 = (bounds.X - rect.X) / rect.W * texture.WidthRatio; + float x2 = (bounds.X + bounds.W - rect.X) / rect.W * texture.WidthRatio; + float y1 = (bounds.Y - rect.Y + rect.H - height) / rect.H * texture.HeightRatio; + float y2 = (bounds.Y + bounds.H - rect.Y) / rect.H * texture.HeightRatio; - if (rect.W == 0f || rect.H == 0f || bounds.H == 0f || bounds.W == 0f || color.A == 0f || height <= 0f) - return; + if (x1 < 0) + x1 = 0f; - if (bounds.X > rect.X + rect.W || bounds.X + bounds.W < rect.X) - return; + if (x2 > texture.WidthRatio) + x2 = texture.WidthRatio; - if (bounds.Y > rect.Y + rect.H || bounds.Y + bounds.H < rect.Y) - return; + if (y1 < 0) + y1 = 0f; - if (height > bounds.H) - height = bounds.H; - - if (_TextureExists(ref texture)) - { - float x1 = (bounds.X - rect.X) / rect.W * texture.WidthRatio; - float x2 = (bounds.X + bounds.W - rect.X) / rect.W * texture.WidthRatio; - float y1 = (bounds.Y - rect.Y + rect.H - height) / rect.H * texture.HeightRatio; - float y2 = (bounds.Y + bounds.H - rect.Y) / rect.H * texture.HeightRatio; - - if (x1 < 0) - x1 = 0f; - - if (x2 > texture.WidthRatio) - x2 = texture.WidthRatio; - - if (y1 < 0) - y1 = 0f; - - if (y2 > texture.HeightRatio) - y2 = texture.HeightRatio; + if (y2 > texture.HeightRatio) + y2 = texture.HeightRatio; - float rx1 = rect.X; - float rx2 = rect.X + rect.W; - float ry1 = rect.Y + rect.H + space; - float ry2 = rect.Y + rect.H + space + height; + float rx1 = rect.X; + float rx2 = rect.X + rect.W; + float ry1 = rect.Y + rect.H + space; + float ry2 = rect.Y + rect.H + space + height; - if (rx1 < bounds.X) - rx1 = bounds.X; + if (rx1 < bounds.X) + rx1 = bounds.X; - if (rx2 > bounds.X + bounds.W) - rx2 = bounds.X + bounds.W; + if (rx2 > bounds.X + bounds.W) + rx2 = bounds.X + bounds.W; - if (ry1 < bounds.Y + space) - ry1 = bounds.Y + space; + if (ry1 < bounds.Y + space) + ry1 = bounds.Y + space; - if (ry2 > bounds.Y + bounds.H + space + height) - ry2 = bounds.Y + bounds.H + space + height; + if (ry2 > bounds.Y + bounds.H + space + height) + ry2 = bounds.Y + bounds.H + space + height; - //Align the pixels because Direct3D expects the pixels to be the left top corner - rx1 -= 0.5f; - ry1 -= 0.5f; - rx2 -= 0.5f; - ry2 -= 0.5f; + //Align the pixels because Direct3D expects the pixels to be the left top corner + rx1 -= 0.5f; + ry1 -= 0.5f; + rx2 -= 0.5f; + ry2 -= 0.5f; - Color c = Color.FromArgb((int)(color.A * 255 * CGraphics.GlobalAlpha), (int)(color.R * 255), (int)(color.G * 255), (int)(color.B * 255)); - Color transparent = Color.FromArgb(0, (int)(color.R * 255), (int)(color.G * 255), (int)(color.B * 255)); + Color c = Color.FromArgb((int)(color.A * 255 * CGraphics.GlobalAlpha), (int)(color.R * 255), (int)(color.G * 255), (int)(color.B * 255)); + Color transparent = Color.FromArgb(0, (int)(color.R * 255), (int)(color.G * 255), (int)(color.B * 255)); - STexturedColoredVertex[] vert = new STexturedColoredVertex[4]; - vert[0] = new STexturedColoredVertex(new Vector3(rx1, -ry1, rect.Z + CGraphics.ZOffset), new Vector2(x1, y2), c.ToArgb()); - vert[1] = new STexturedColoredVertex(new Vector3(rx1, -ry2, rect.Z + CGraphics.ZOffset), new Vector2(x1, y1), transparent.ToArgb()); - vert[2] = new STexturedColoredVertex(new Vector3(rx2, -ry2, rect.Z + CGraphics.ZOffset), new Vector2(x2, y1), transparent.ToArgb()); - vert[3] = new STexturedColoredVertex(new Vector3(rx2, -ry1, rect.Z + CGraphics.ZOffset), new Vector2(x2, y2), c.ToArgb()); - _AddToVertexBuffer(vert, _D3DTextures[texture.Index], _CalculateRotationMatrix(rect.Rotation, rx1, rx2, ry1, ry2)); - } + STexturedColoredVertex[] vert = new STexturedColoredVertex[4]; + vert[0] = new STexturedColoredVertex(new Vector3(rx1, -ry1, rect.Z + CGraphics.ZOffset), new Vector2(x1, y2), c.ToArgb()); + vert[1] = new STexturedColoredVertex(new Vector3(rx1, -ry2, rect.Z + CGraphics.ZOffset), new Vector2(x1, y1), transparent.ToArgb()); + vert[2] = new STexturedColoredVertex(new Vector3(rx2, -ry2, rect.Z + CGraphics.ZOffset), new Vector2(x2, y1), transparent.ToArgb()); + vert[3] = new STexturedColoredVertex(new Vector3(rx2, -ry1, rect.Z + CGraphics.ZOffset), new Vector2(x2, y2), c.ToArgb()); + _AddToVertexBuffer(vert, _D3DTextures[texture.Index], _CalculateRotationMatrix(rect.Rotation, rx1, rx2, ry1, ry2)); } } #endregion drawing @@ -1490,20 +1447,17 @@ namespace Vocaluxe.Lib.Draw /// The next power of two private float _CheckForNextPowerOf2(float n) { - if (!_NonPowerOf2TextureSupported) - { - if (n < 0) - throw new ArgumentOutOfRangeException("n", "Must be positive."); - return (float)Math.Pow(2, Math.Ceiling(Math.Log(n, 2))); - } - else + if (_NonPowerOf2TextureSupported) return n; + if (n < 0) + throw new ArgumentOutOfRangeException("n", "Must be positive."); + return (float)Math.Pow(2, Math.Ceiling(Math.Log(n, 2))); } private SlimDX.Matrix _CalculateRotationMatrix(float rot, float rx1, float rx2, float ry1, float ry2) { - SlimDX.Matrix originTranslation = SlimDX.Matrix.Translation(new Vector3(-CSettings.RenderW / 2, CSettings.RenderH / 2, 0)); - if (rot != 0) + SlimDX.Matrix originTranslation = SlimDX.Matrix.Translation(new Vector3(-(float)CSettings.RenderW / 2, (float)CSettings.RenderH / 2, 0)); + if (Math.Abs(rot) > float.Epsilon) { float rotation = rot * (float)Math.PI / 180; float centerX = (rx1 + rx2) / 2f; @@ -1525,10 +1479,10 @@ namespace Vocaluxe.Lib.Draw #endregion utility #region TexturedColoredVertex - public struct STexturedColoredVertex + private struct STexturedColoredVertex { private static VertexDeclaration _Declaration; - public static VertexElement[] Elements = + private static readonly VertexElement[] _Elements = { new VertexElement(0, 0, DeclarationType.Float3, DeclarationMethod.Default, DeclarationUsage.Position, 0), new VertexElement(0, sizeof(float) * 3, DeclarationType.Float2, DeclarationMethod.Default, DeclarationUsage.TextureCoordinate, 0), @@ -1536,21 +1490,23 @@ namespace Vocaluxe.Lib.Draw VertexElement.VertexDeclarationEnd }; - public Vector3 Position; - public Vector2 Texture; - public int Color; + // ReSharper disable NotAccessedField.Local + private Vector3 _Position; + private Vector2 _Texture; + private int _Color; + // ReSharper restore NotAccessedField.Local public STexturedColoredVertex(Vector3 position, Vector2 texture, int color) { - Position = position; - Texture = texture; - Color = color; + _Position = position; + _Texture = texture; + _Color = color; } public static VertexDeclaration GetDeclaration(Device device) { if (_Declaration == null || _Declaration.Disposed) - _Declaration = new VertexDeclaration(device, Elements); + _Declaration = new VertexDeclaration(device, _Elements); return _Declaration; } diff --git a/Vocaluxe/Lib/Draw/CDrawWinForm.cs b/Vocaluxe/Lib/Draw/CDrawWinForm.cs index 7271298b..7aa33fca 100644 --- a/Vocaluxe/Lib/Draw/CDrawWinForm.cs +++ b/Vocaluxe/Lib/Draw/CDrawWinForm.cs @@ -346,13 +346,7 @@ namespace Vocaluxe.Lib.Draw } // Draw Basic Text - public void DrawText(string text, int x, int y, int h) - { - DrawText(text, x, y, h, 0f); - } - - // Draw Basic Text - public void DrawText(string text, int x, int y, float h, float z) + public void DrawText(string text, int x, int y, int h, int z=0) { CFonts.DrawText(text, h, x, y, z, new SColorF(1, 1, 1, 1)); } diff --git a/Vocaluxe/Lib/Draw/COpenGL.cs b/Vocaluxe/Lib/Draw/COpenGL.cs index 145c0f6c..f46fa43c 100644 --- a/Vocaluxe/Lib/Draw/COpenGL.cs +++ b/Vocaluxe/Lib/Draw/COpenGL.cs @@ -633,12 +633,7 @@ namespace Vocaluxe.Lib.Draw public void DrawLine(int a, int r, int g, int b, int w, int x1, int y1, int x2, int y2) {} // Draw Basic Text (must be deleted later) - public void DrawText(string text, int x, int y, int h) - { - DrawText(text, x, y, h, 0f); - } - - public void DrawText(string text, int x, int y, float h, float z) + public void DrawText(string text, int x, int y, int h, int z=0) { CFonts.DrawText(text, h, x, y, z, new SColorF(1, 1, 1, 1)); } diff --git a/Vocaluxe/Lib/Draw/IDraw.cs b/Vocaluxe/Lib/Draw/IDraw.cs index 79c60e28..728c4ea9 100644 --- a/Vocaluxe/Lib/Draw/IDraw.cs +++ b/Vocaluxe/Lib/Draw/IDraw.cs @@ -46,7 +46,7 @@ namespace Vocaluxe.Lib.Draw void MakeScreenShot(); // Draw Basic Text (must be deleted later) - void DrawText(string text, int x, int y, int h); + void DrawText(string text, int x, int y, int h, int z=0); STexture AddTexture(string texturePath); STexture AddTexture(Bitmap bitmap); From dcbbc5caf3562209ea64ef04ccd86998217cf161 Mon Sep 17 00:00:00 2001 From: Flamefire Date: Sat, 20 Apr 2013 02:19:56 +0200 Subject: [PATCH 06/27] Many cleanups according to ReSharper suggestions (Mostly redundant code) Minor Bug fixes --- Output/Languages/English.xml | 1 + Output/Languages/German.xml | 1 + .../PartyModeChallenge/CPartyModeChallenge.cs | 9 +- .../CPartyScreenChallengeConfig.cs | 38 +- .../CPartyScreenChallengeMain.cs | 168 ++++--- .../CPartyScreenChallengeNames.cs | 145 +++--- .../CPartyModeChallengeMedley.cs | 9 +- .../CPartyScreenChallengeMedleyConfig.cs | 38 +- .../CPartyScreenChallengeMedleyMain.cs | 168 ++++--- .../CPartyScreenChallengeMedleyNames.cs | 57 +-- .../PartyModeTicTacToe/CPartyModeTicTacToe.cs | 182 +++---- .../CPartyScreenTicTacToeConfig.cs | 88 ++-- .../CPartyScreenTicTacToeMain.cs | 204 ++++---- .../CPartyScreenTicTacToeNames.cs | 79 ++- Vocaluxe/Base/CBackgroundMusic.cs | 5 +- Vocaluxe/Base/CConfig.cs | 42 +- Vocaluxe/Base/CCover.cs | 111 ++--- Vocaluxe/Base/CDataBase.cs | 21 +- Vocaluxe/Base/CDraw.cs | 2 +- Vocaluxe/Base/CFont.cs | 52 +- Vocaluxe/Base/CGame.cs | 281 +++++------ Vocaluxe/Base/CGraphics.cs | 152 ++---- Vocaluxe/Base/CLanguage.cs | 31 +- Vocaluxe/Base/CMain.cs | 4 +- Vocaluxe/Base/CParty.cs | 20 +- Vocaluxe/Base/CPlaylists.cs | 48 +- Vocaluxe/Base/CProfiles.cs | 5 +- Vocaluxe/Base/CSettings.cs | 18 +- Vocaluxe/Base/CSongSorter.cs | 10 +- Vocaluxe/Base/CSongs.cs | 12 +- Vocaluxe/Base/CTheme.cs | 42 +- Vocaluxe/Base/CUtility.cs | 32 +- Vocaluxe/Base/CVideo.cs | 12 +- Vocaluxe/GameModes/CGameMode.cs | 13 +- Vocaluxe/GameModes/CGameModeNormal.cs | 9 +- Vocaluxe/Lib/Draw/COpenGL.cs | 184 ++----- Vocaluxe/Lib/Input/CHIDAPI.cs | 18 +- Vocaluxe/Lib/Input/WiiMote/CWiiMote.cs | 27 +- Vocaluxe/Lib/Input/WiiMote/WiiMoteLib.cs | 107 ++-- Vocaluxe/Lib/Playlist/CPlaylistFile.cs | 45 +- Vocaluxe/Lib/Sound/COpenALPlay.cs | 14 +- Vocaluxe/Lib/Sound/CPortAudioPlay.cs | 2 +- Vocaluxe/Lib/Sound/CPortAudioRecord.cs | 7 +- .../Lib/Sound/Decoder/CAudioDecoderFFmpeg.cs | 5 +- Vocaluxe/Lib/Sound/Portaudio/PortAudio.cs | 9 +- Vocaluxe/Lib/Sound/Portaudio/PortAudioASIO.cs | 4 +- Vocaluxe/Lib/Video/CVideoDecoder.cs | 7 +- Vocaluxe/Lib/Video/CVideoDecoderFFmpeg.cs | 17 +- Vocaluxe/Lib/Video/CVideoDecoderGstreamer.cs | 2 +- Vocaluxe/Lib/Video/IVideoDecoder.cs | 2 +- Vocaluxe/Screens/CPopupScreenPlayerControl.cs | 93 ++-- Vocaluxe/Screens/CPopupScreenVolumeControl.cs | 44 +- Vocaluxe/Screens/CScreenCredits.cs | 1 - Vocaluxe/Screens/CScreenHighscore.cs | 60 +-- Vocaluxe/Screens/CScreenLoad.cs | 26 +- Vocaluxe/Screens/CScreenMain.cs | 32 +- Vocaluxe/Screens/CScreenNames.cs | 234 +++++---- Vocaluxe/Screens/CScreenOptions.cs | 26 +- Vocaluxe/Screens/CScreenOptionsGame.cs | 32 +- Vocaluxe/Screens/CScreenOptionsLyrics.cs | 14 +- Vocaluxe/Screens/CScreenOptionsRecord.cs | 158 +++--- Vocaluxe/Screens/CScreenOptionsSound.cs | 40 +- Vocaluxe/Screens/CScreenOptionsTheme.cs | 63 ++- Vocaluxe/Screens/CScreenOptionsVideo.cs | 96 ++-- Vocaluxe/Screens/CScreenParty.cs | 60 +-- Vocaluxe/Screens/CScreenProfiles.cs | 192 ++++---- Vocaluxe/Screens/CScreenScore.cs | 121 +++-- Vocaluxe/Screens/CScreenSing.cs | 431 ++++++++--------- Vocaluxe/Screens/CScreenSong.cs | 432 ++++++++--------- Vocaluxe/Screens/CScreenTest.cs | 2 +- Vocaluxe/Vocaluxe.csproj | 4 +- VocaluxeLib/Menu/CBackground.cs | 12 +- VocaluxeLib/Menu/CButton.cs | 10 +- VocaluxeLib/Menu/CEqualizer.cs | 6 +- VocaluxeLib/Menu/CHelper.cs | 22 +- VocaluxeLib/Menu/CLyric.cs | 174 +++---- VocaluxeLib/Menu/CMenu.cs | 414 +++++----------- VocaluxeLib/Menu/CNameSelection.cs | 20 +- VocaluxeLib/Menu/CObjectInteractions.cs | 4 +- VocaluxeLib/Menu/CParticle.cs | 4 +- VocaluxeLib/Menu/CPlaylist.cs | 12 +- VocaluxeLib/Menu/CPoints.cs | 2 - VocaluxeLib/Menu/CScreenSetting.cs | 2 +- VocaluxeLib/Menu/CSelectSlide.cs | 34 +- VocaluxeLib/Menu/CStatic.cs | 8 +- VocaluxeLib/Menu/CText.cs | 12 +- VocaluxeLib/Menu/CXMLReader.cs | 32 +- VocaluxeLib/Menu/Enums.cs | 4 +- VocaluxeLib/Menu/IMenu.cs | 4 +- VocaluxeLib/Menu/SingNotes/CNotes.cs | 5 +- VocaluxeLib/Menu/SingNotes/CSingNotes.cs | 22 +- VocaluxeLib/Menu/SongMenu/CSong.cs | 455 +++++++++--------- VocaluxeLib/Menu/SongMenu/CSongMenuDreidel.cs | 2 + .../Menu/SongMenu/CSongMenuFramework.cs | 38 +- .../Menu/SongMenu/CSongMenuTileBoard.cs | 2 +- VocaluxeLib/PartyModes/CScreenPartyDummy.cs | 4 +- 96 files changed, 2702 insertions(+), 3322 deletions(-) diff --git a/Output/Languages/English.xml b/Output/Languages/English.xml index 42460ca7..c8eacb20 100644 --- a/Output/Languages/English.xml +++ b/Output/Languages/English.xml @@ -13,6 +13,7 @@ Max Volume Loaded songs Mouse + Memory usage Normal Duet Medley diff --git a/Output/Languages/German.xml b/Output/Languages/German.xml index 7fe3cf73..e19f5319 100644 --- a/Output/Languages/German.xml +++ b/Output/Languages/German.xml @@ -13,6 +13,7 @@ Max. Volume Geladene Songs Maus + Speicherverbrauch Normal Duett Medley diff --git a/PartyModes/PartyModeChallenge/CPartyModeChallenge.cs b/PartyModes/PartyModeChallenge/CPartyModeChallenge.cs index 173dcc53..722713e6 100644 --- a/PartyModes/PartyModeChallenge/CPartyModeChallenge.cs +++ b/PartyModes/PartyModeChallenge/CPartyModeChallenge.cs @@ -211,7 +211,7 @@ namespace VocaluxeLib.PartyModes.Challenge public override void DataFromScreen(string screenName, Object data) { - SDataFromScreen dataFrom = new SDataFromScreen(); + SDataFromScreen dataFrom; switch (screenName) { case "PartyScreenChallengeConfig": @@ -371,10 +371,11 @@ namespace VocaluxeLib.PartyModes.Challenge return _ScreenSongOptions; } +// ReSharper disable RedundantAssignment public override void OnSongChange(int songIndex, ref SScreenSongOptions screenSongOptions) +// ReSharper restore RedundantAssignment { - if (_ScreenSongOptions.Selection.SongIndex != -1) - _ScreenSongOptions.Selection.SongIndex = -1; + _ScreenSongOptions.Selection.SongIndex = -1; if (_ScreenSongOptions.Selection.SelectNextRandomSong && songIndex != -1) { @@ -391,7 +392,9 @@ namespace VocaluxeLib.PartyModes.Challenge screenSongOptions = _ScreenSongOptions; } +// ReSharper disable RedundantAssignment public override void OnCategoryChange(int categoryIndex, ref SScreenSongOptions screenSongOptions) +// ReSharper restore RedundantAssignment { if (_GameData.CatSongIndices != null && categoryIndex != -1) { diff --git a/PartyModes/PartyModeChallenge/CPartyScreenChallengeConfig.cs b/PartyModes/PartyModeChallenge/CPartyScreenChallengeConfig.cs index 29f18def..27e36fa9 100644 --- a/PartyModes/PartyModeChallenge/CPartyScreenChallengeConfig.cs +++ b/PartyModes/PartyModeChallenge/CPartyScreenChallengeConfig.cs @@ -60,11 +60,9 @@ namespace VocaluxeLib.PartyModes.Challenge public override void DataToScreen(object receivedData) { - SDataToScreenConfig config = new SDataToScreenConfig(); - try { - config = (SDataToScreenConfig)receivedData; + SDataToScreenConfig config = (SDataToScreenConfig)receivedData; _Data.ScreenConfig.NumPlayer = config.NumPlayer; _Data.ScreenConfig.NumPlayerAtOnce = config.NumPlayerAtOnce; _Data.ScreenConfig.NumRounds = config.NumRounds; @@ -92,10 +90,10 @@ namespace VocaluxeLib.PartyModes.Challenge case Keys.Enter: _UpdateSlides(); - if (Buttons[_ButtonBack].Selected) + if (_Buttons[_ButtonBack].Selected) _Back(); - if (Buttons[_ButtonNext].Selected) + if (_Buttons[_ButtonNext].Selected) _Next(); break; @@ -115,13 +113,13 @@ namespace VocaluxeLib.PartyModes.Challenge { base.HandleMouse(mouseEvent); - if (mouseEvent.LB && IsMouseOver(mouseEvent)) + if (mouseEvent.LB && _IsMouseOver(mouseEvent)) { _UpdateSlides(); - if (Buttons[_ButtonBack].Selected) + if (_Buttons[_ButtonBack].Selected) _Back(); - if (Buttons[_ButtonNext].Selected) + if (_Buttons[_ButtonNext].Selected) _Next(); } @@ -158,10 +156,10 @@ namespace VocaluxeLib.PartyModes.Challenge private void _RebuildSlides() { // build num player slide (min player ... max player); - SelectSlides[_SelectSlideNumPlayers].Clear(); + _SelectSlides[_SelectSlideNumPlayers].Clear(); for (int i = _PartyMode.GetMinPlayer(); i <= _PartyMode.GetMaxPlayer(); i++) - SelectSlides[_SelectSlideNumPlayers].AddValue(i.ToString()); - SelectSlides[_SelectSlideNumPlayers].Selection = _Data.ScreenConfig.NumPlayer - _PartyMode.GetMinPlayer(); + _SelectSlides[_SelectSlideNumPlayers].AddValue(i.ToString()); + _SelectSlides[_SelectSlideNumPlayers].Selection = _Data.ScreenConfig.NumPlayer - _PartyMode.GetMinPlayer(); _UpdateMicsAtOnce(); _SetRoundSteps(); @@ -172,9 +170,9 @@ namespace VocaluxeLib.PartyModes.Challenge { int player = _Data.ScreenConfig.NumPlayer; int mics = _Data.ScreenConfig.NumPlayerAtOnce; - _Data.ScreenConfig.NumPlayer = SelectSlides[_SelectSlideNumPlayers].Selection + _PartyMode.GetMinPlayer(); - _Data.ScreenConfig.NumPlayerAtOnce = SelectSlides[_SelectSlideNumMics].Selection + _PartyMode.GetMinPlayer(); - _Data.ScreenConfig.NumRounds = (SelectSlides[_SelectSlideNumRounds].Selection + 1) * _RoundSteps; + _Data.ScreenConfig.NumPlayer = _SelectSlides[_SelectSlideNumPlayers].Selection + _PartyMode.GetMinPlayer(); + _Data.ScreenConfig.NumPlayerAtOnce = _SelectSlides[_SelectSlideNumMics].Selection + _PartyMode.GetMinPlayer(); + _Data.ScreenConfig.NumRounds = (_SelectSlides[_SelectSlideNumRounds].Selection + 1) * _RoundSteps; _UpdateMicsAtOnce(); _SetRoundSteps(); @@ -201,19 +199,19 @@ namespace VocaluxeLib.PartyModes.Challenge _Data.ScreenConfig.NumPlayerAtOnce = maxNum; // build mics at once slide - SelectSlides[_SelectSlideNumMics].Clear(); + _SelectSlides[_SelectSlideNumMics].Clear(); for (int i = 1; i <= maxNum; i++) - SelectSlides[_SelectSlideNumMics].AddValue(i.ToString()); - SelectSlides[_SelectSlideNumMics].Selection = _Data.ScreenConfig.NumPlayerAtOnce - _PartyMode.GetMinPlayer(); + _SelectSlides[_SelectSlideNumMics].AddValue(i.ToString()); + _SelectSlides[_SelectSlideNumMics].Selection = _Data.ScreenConfig.NumPlayerAtOnce - _PartyMode.GetMinPlayer(); } private void _UpdateSlideRounds() { // build num rounds slide - SelectSlides[_SelectSlideNumRounds].Clear(); + _SelectSlides[_SelectSlideNumRounds].Clear(); for (int i = _RoundSteps; i <= _MaxNumRounds; i += _RoundSteps) - SelectSlides[_SelectSlideNumRounds].AddValue(i.ToString()); - SelectSlides[_SelectSlideNumRounds].Selection = _Data.ScreenConfig.NumRounds / _RoundSteps - 1; + _SelectSlides[_SelectSlideNumRounds].AddValue(i.ToString()); + _SelectSlides[_SelectSlideNumRounds].Selection = _Data.ScreenConfig.NumRounds / _RoundSteps - 1; } private void _SetRoundSteps() diff --git a/PartyModes/PartyModeChallenge/CPartyScreenChallengeMain.cs b/PartyModes/PartyModeChallenge/CPartyScreenChallengeMain.cs index d7da6606..aacf1a83 100644 --- a/PartyModes/PartyModeChallenge/CPartyScreenChallengeMain.cs +++ b/PartyModes/PartyModeChallenge/CPartyScreenChallengeMain.cs @@ -130,20 +130,18 @@ namespace VocaluxeLib.PartyModes.Challenge for (int i = 0; i < _PartyMode.GetMaxPlayer(); i++) { - _NextPlayerTexts.Add(GetNewText(Texts[_TextNextPlayer])); - AddText(_NextPlayerTexts[_NextPlayerTexts.Count - 1]); - _NextPlayerStatics.Add(GetNewStatic(Statics[_StaticNextPlayer])); - AddStatic(_NextPlayerStatics[_NextPlayerStatics.Count - 1]); + _NextPlayerTexts.Add(GetNewText(_Texts[_TextNextPlayer])); + _AddText(_NextPlayerTexts[_NextPlayerTexts.Count - 1]); + _NextPlayerStatics.Add(GetNewStatic(_Statics[_StaticNextPlayer])); + _AddStatic(_NextPlayerStatics[_NextPlayerStatics.Count - 1]); } } public override void DataToScreen(object receivedData) { - SDataToScreenMain data = new SDataToScreenMain(); - try { - data = (SDataToScreenMain)receivedData; + SDataToScreenMain data = (SDataToScreenMain)receivedData; _GameState = data; } catch (Exception e) @@ -177,26 +175,26 @@ namespace VocaluxeLib.PartyModes.Challenge case Keys.Enter: if (!_ExitPopupVisible) { - if (Buttons[_ButtonNextRound].Selected) + if (_Buttons[_ButtonNextRound].Selected) _NextRound(); - if (Buttons[_ButtonBack].Selected && _GameState.CurrentRoundNr == 1) + if (_Buttons[_ButtonBack].Selected && _GameState.CurrentRoundNr == 1) _Back(); - if (Buttons[_ButtonExit].Selected && _GameState.CurrentRoundNr > 1) + if (_Buttons[_ButtonExit].Selected && _GameState.CurrentRoundNr > 1) _ShowPopup(true); - if (Buttons[_ButtonPlayerScrollUp].Selected) + if (_Buttons[_ButtonPlayerScrollUp].Selected) _ScrollPlayerTable(-1); - if (Buttons[_ButtonPlayerScrollDown].Selected) + if (_Buttons[_ButtonPlayerScrollDown].Selected) _ScrollPlayerTable(1); - if (Buttons[_ButtonRoundsScrollUp].Selected) + if (_Buttons[_ButtonRoundsScrollUp].Selected) _ScrollRoundsTable(-1); - if (Buttons[_ButtonRoundsScrollDown].Selected) + if (_Buttons[_ButtonRoundsScrollDown].Selected) _ScrollRoundsTable(1); } else { - if (Buttons[_ButtonPopupYes].Selected) + if (_Buttons[_ButtonPopupYes].Selected) _EndParty(); - if (Buttons[_ButtonPopupNo].Selected) + if (_Buttons[_ButtonPopupNo].Selected) _ShowPopup(false); } break; @@ -209,30 +207,30 @@ namespace VocaluxeLib.PartyModes.Challenge { base.HandleMouse(mouseEvent); - if (mouseEvent.LB && IsMouseOver(mouseEvent)) + if (mouseEvent.LB && _IsMouseOver(mouseEvent)) { if (!_ExitPopupVisible) { - if (Buttons[_ButtonNextRound].Selected) + if (_Buttons[_ButtonNextRound].Selected) _NextRound(); - if (Buttons[_ButtonBack].Selected && _GameState.CurrentRoundNr == 1) + if (_Buttons[_ButtonBack].Selected && _GameState.CurrentRoundNr == 1) _Back(); - if (Buttons[_ButtonExit].Selected && _GameState.CurrentRoundNr > 1) + if (_Buttons[_ButtonExit].Selected && _GameState.CurrentRoundNr > 1) _ShowPopup(true); - if (Buttons[_ButtonPlayerScrollUp].Selected) + if (_Buttons[_ButtonPlayerScrollUp].Selected) _ScrollPlayerTable(-1); - if (Buttons[_ButtonPlayerScrollDown].Selected) + if (_Buttons[_ButtonPlayerScrollDown].Selected) _ScrollPlayerTable(1); - if (Buttons[_ButtonRoundsScrollUp].Selected) + if (_Buttons[_ButtonRoundsScrollUp].Selected) _ScrollRoundsTable(-1); - if (Buttons[_ButtonRoundsScrollDown].Selected) + if (_Buttons[_ButtonRoundsScrollDown].Selected) _ScrollRoundsTable(1); } else { - if (Buttons[_ButtonPopupYes].Selected) + if (_Buttons[_ButtonPopupYes].Selected) _EndParty(); - if (Buttons[_ButtonPopupNo].Selected) + if (_Buttons[_ButtonPopupNo].Selected) _ShowPopup(false); } } @@ -279,29 +277,29 @@ namespace VocaluxeLib.PartyModes.Challenge if (_GameState.CurrentRoundNr == 1) { - Buttons[_ButtonBack].Visible = true; - Buttons[_ButtonExit].Visible = false; + _Buttons[_ButtonBack].Visible = true; + _Buttons[_ButtonExit].Visible = false; } else { - Buttons[_ButtonBack].Visible = false; - Buttons[_ButtonExit].Visible = true; + _Buttons[_ButtonBack].Visible = false; + _Buttons[_ButtonExit].Visible = true; } if (_GameState.CurrentRoundNr <= _GameState.Combs.Count) { - Buttons[_ButtonNextRound].Visible = true; - Texts[_TextFinishMessage].Visible = false; - Texts[_TextFinishPlayerWin].Visible = false; - SetInteractionToButton(Buttons[_ButtonNextRound]); + _Buttons[_ButtonNextRound].Visible = true; + _Texts[_TextFinishMessage].Visible = false; + _Texts[_TextFinishPlayerWin].Visible = false; + _SetInteractionToButton(_Buttons[_ButtonNextRound]); } else { - Buttons[_ButtonNextRound].Visible = false; - Texts[_TextFinishMessage].Visible = true; - Texts[_TextFinishPlayerWin].Visible = true; - Texts[_TextFinishPlayerWin].Text = _GetPlayerWinString(); - SetInteractionToButton(Buttons[_ButtonExit]); + _Buttons[_ButtonNextRound].Visible = false; + _Texts[_TextFinishMessage].Visible = true; + _Texts[_TextFinishPlayerWin].Visible = true; + _Texts[_TextFinishPlayerWin].Text = _GetPlayerWinString(); + _SetInteractionToButton(_Buttons[_ButtonExit]); } _ShowPopup(false); @@ -334,13 +332,13 @@ namespace VocaluxeLib.PartyModes.Challenge { _ExitPopupVisible = visible; - Statics[_StaticPopupBG].Visible = _ExitPopupVisible; - Texts[_TextPopupReallyExit].Visible = _ExitPopupVisible; - Buttons[_ButtonPopupYes].Visible = _ExitPopupVisible; - Buttons[_ButtonPopupNo].Visible = _ExitPopupVisible; + _Statics[_StaticPopupBG].Visible = _ExitPopupVisible; + _Texts[_TextPopupReallyExit].Visible = _ExitPopupVisible; + _Buttons[_ButtonPopupYes].Visible = _ExitPopupVisible; + _Buttons[_ButtonPopupNo].Visible = _ExitPopupVisible; if (_ExitPopupVisible) - SetInteractionToButton(Buttons[_ButtonPopupNo]); + _SetInteractionToButton(_Buttons[_ButtonPopupNo]); } private void _Back() @@ -352,7 +350,7 @@ namespace VocaluxeLib.PartyModes.Challenge private void _UpdateNextPlayerPositions() { - float x = CBase.Settings.GetRenderW() / 2 - ((_GameState.NumPlayerAtOnce * Statics[_StaticNextPlayer].Rect.W) + ((_GameState.NumPlayerAtOnce - 1) * 15)) / 2; + float x = CBase.Settings.GetRenderW() / 2 - ((_GameState.NumPlayerAtOnce * _Statics[_StaticNextPlayer].Rect.W) + ((_GameState.NumPlayerAtOnce - 1) * 15)) / 2; float staticY = 590; float textY = 550; for (int i = 0; i < _GameState.NumPlayerAtOnce; i++) @@ -362,11 +360,11 @@ namespace VocaluxeLib.PartyModes.Challenge _NextPlayerStatics[i].Rect.Y = staticY; _NextPlayerStatics[i].Visible = true; //text - _NextPlayerTexts[i].X = x + Statics[_StaticNextPlayer].Rect.W / 2; + _NextPlayerTexts[i].X = x + _Statics[_StaticNextPlayer].Rect.W / 2; _NextPlayerTexts[i].Y = textY; _NextPlayerTexts[i].Visible = true; - x += Statics[_StaticNextPlayer].Rect.W + 15; + x += _Statics[_StaticNextPlayer].Rect.W + 15; } for (int i = _GameState.NumPlayerAtOnce; i < _PartyMode.GetMaxPlayer(); i++) { @@ -379,7 +377,7 @@ namespace VocaluxeLib.PartyModes.Challenge { if (_GameState.CurrentRoundNr <= _GameState.Combs.Count) { - Texts[_TextNextPlayerMessage].Visible = true; + _Texts[_TextNextPlayerMessage].Visible = true; SProfile[] profiles = CBase.Profiles.GetProfiles(); for (int i = 0; i < _GameState.NumPlayerAtOnce; i++) { @@ -391,7 +389,7 @@ namespace VocaluxeLib.PartyModes.Challenge } else { - Texts[_TextNextPlayerMessage].Visible = false; + _Texts[_TextNextPlayerMessage].Visible = false; for (int i = 0; i < _GameState.NumPlayerAtOnce; i++) { _NextPlayerStatics[i].Visible = false; @@ -415,20 +413,20 @@ namespace VocaluxeLib.PartyModes.Challenge for (int round = 0; round < _RoundsTable.Count; round++) { //Round-number - CText text = GetNewText(Texts[_TextRoundNumber]); - AddText(text); + CText text = GetNewText(_Texts[_TextRoundNumber]); + _AddText(text); _RoundsTable[round].Number = text; for (int row = 0; row < 2; row++) { for (int column = 0; column < 3; column++) { //Player - text = GetNewText(Texts[_TextRoundPlayer]); - AddText(text); + text = GetNewText(_Texts[_TextRoundPlayer]); + _AddText(text); _RoundsTable[round].TextPlayer.Add(text); //Score - text = GetNewText(Texts[_TextRoundScore]); - AddText(text); + text = GetNewText(_Texts[_TextRoundScore]); + _AddText(text); _RoundsTable[round].TextScores.Add(text); } } @@ -448,14 +446,14 @@ namespace VocaluxeLib.PartyModes.Challenge if (_NumRoundsVisible > _GameState.Combs.Count) _NumRoundsVisible = _GameState.Combs.Count; - float numberX = Texts[_TextRoundNumber].X; - float numberY = Texts[_TextRoundNumber].Y; + float numberX = _Texts[_TextRoundNumber].X; + float numberY = _Texts[_TextRoundNumber].Y; _RoundsTableScrollArea.X = numberX; _RoundsTableScrollArea.Y = numberY; - _RoundsTableScrollArea.W = CBase.Settings.GetRenderW() - Texts[_TextRoundNumber].X - 20; + _RoundsTableScrollArea.W = CBase.Settings.GetRenderW() - _Texts[_TextRoundNumber].X - 20; - float delta = Texts[_TextRoundNumber].Height; + float delta = _Texts[_TextRoundNumber].Height; //Update statics and texts for rounds for (int round = 0; round < _RoundsTable.Count; round++) @@ -476,9 +474,9 @@ namespace VocaluxeLib.PartyModes.Challenge for (int column = row * numPlayerInOneRow; column < num; column++) { //Player - float x = numberX + 15 + (CBase.Settings.GetRenderW() - Texts[_TextRoundNumber].X - 20) / numPlayerInThisRow * (column - row * numPlayerInOneRow) + - ((CBase.Settings.GetRenderW() - Texts[_TextRoundNumber].X - 20) / numPlayerInThisRow) / 2; - float maxw = ((CBase.Settings.GetRenderW() - Texts[_TextRoundNumber].X - 20) / numPlayerInThisRow) / 2 - 5; + float x = numberX + 15 + (CBase.Settings.GetRenderW() - _Texts[_TextRoundNumber].X - 20) / numPlayerInThisRow * (column - row * numPlayerInOneRow) + + ((CBase.Settings.GetRenderW() - _Texts[_TextRoundNumber].X - 20) / numPlayerInThisRow) / 2; + float maxw = ((CBase.Settings.GetRenderW() - _Texts[_TextRoundNumber].X - 20) / numPlayerInThisRow) / 2 - 5; _RoundsTable[round].TextPlayer[column].X = x; _RoundsTable[round].TextPlayer[column].Y = numberY; _RoundsTable[round].TextPlayer[column].MaxWidth = maxw; @@ -507,7 +505,7 @@ namespace VocaluxeLib.PartyModes.Challenge _RoundsTable[i].Number.Visible = true; _RoundsTable[i].TextPlayer[p].Visible = true; _RoundsTable[i].TextScores[p].Visible = true; - _RoundsTable[i].Number.Text = (i + 1 + _RoundsTableOffset).ToString() + ")"; + _RoundsTable[i].Number.Text = (i + 1 + _RoundsTableOffset) + ")"; int pID = _GameState.ProfileIDs[_GameState.Combs[i + _RoundsTableOffset].Player[p]]; _RoundsTable[i].TextPlayer[p].Text = profile[pID].PlayerName; if ((_GameState.CurrentRoundNr - 1) > i + _RoundsTableOffset) @@ -532,19 +530,19 @@ namespace VocaluxeLib.PartyModes.Challenge } } - Buttons[_ButtonRoundsScrollUp].Visible = _RoundsTableOffset > 0; - Buttons[_ButtonRoundsScrollDown].Visible = _GameState.Combs.Count - _NumRoundsVisible - _RoundsTableOffset > 0; + _Buttons[_ButtonRoundsScrollUp].Visible = _RoundsTableOffset > 0; + _Buttons[_ButtonRoundsScrollDown].Visible = _GameState.Combs.Count - _NumRoundsVisible - _RoundsTableOffset > 0; } private void _BuildPlayerTable() { _PlayerTableScrollArea = new SRectF(); - _PlayerTableScrollArea.X = Texts[_TextPosition].X; - _PlayerTableScrollArea.Y = Texts[_TextPosition].Y; - _PlayerTableScrollArea.W = Texts[_TextGamePoints].X - Texts[_TextPosition].X; + _PlayerTableScrollArea.X = _Texts[_TextPosition].X; + _PlayerTableScrollArea.Y = _Texts[_TextPosition].Y; + _PlayerTableScrollArea.W = _Texts[_TextGamePoints].X - _Texts[_TextPosition].X; _PlayerTable = new List(); - float delta = Texts[_TextPosition].Height * 1.2f; + float delta = _Texts[_TextPosition].Height * 1.2f; float h = 0; @@ -552,12 +550,12 @@ namespace VocaluxeLib.PartyModes.Challenge { STableRow row = new STableRow(); - row.Pos = GetNewText(Texts[_TextPosition]); - row.Name = GetNewText(Texts[_TextPlayerName]); - row.Rounds = GetNewText(Texts[_TextNumPlayed]); - row.Won = GetNewText(Texts[_TextWon]); - row.SingPoints = GetNewText(Texts[_TextSingPoints]); - row.GamePoints = GetNewText(Texts[_TextGamePoints]); + row.Pos = GetNewText(_Texts[_TextPosition]); + row.Name = GetNewText(_Texts[_TextPlayerName]); + row.Rounds = GetNewText(_Texts[_TextNumPlayed]); + row.Won = GetNewText(_Texts[_TextWon]); + row.SingPoints = GetNewText(_Texts[_TextSingPoints]); + row.GamePoints = GetNewText(_Texts[_TextGamePoints]); row.Pos.Y += delta * (i + 1); row.Name.Y += delta * (i + 1); @@ -566,7 +564,7 @@ namespace VocaluxeLib.PartyModes.Challenge row.SingPoints.Y += delta * (i + 1); row.GamePoints.Y += delta * (i + 1); - row.Pos.Text = (i + 1).ToString() + "."; + row.Pos.Text = (i + 1) + "."; row.Pos.Visible = false; row.Name.Visible = false; @@ -575,12 +573,12 @@ namespace VocaluxeLib.PartyModes.Challenge row.SingPoints.Visible = false; row.GamePoints.Visible = false; - AddText(row.Pos); - AddText(row.Name); - AddText(row.Rounds); - AddText(row.Won); - AddText(row.SingPoints); - AddText(row.GamePoints); + _AddText(row.Pos); + _AddText(row.Name); + _AddText(row.Rounds); + _AddText(row.Won); + _AddText(row.SingPoints); + _AddText(row.GamePoints); _PlayerTable.Add(row); @@ -606,7 +604,7 @@ namespace VocaluxeLib.PartyModes.Challenge row.SingPoints.Visible = true; row.GamePoints.Visible = true; - row.Pos.Text = _GameState.ResultTable[i + _PlayerTableOffset].Position.ToString() + "."; + row.Pos.Text = _GameState.ResultTable[i + _PlayerTableOffset].Position + "."; row.Name.Text = profiles[_GameState.ResultTable[i + _PlayerTableOffset].PlayerID].PlayerName; row.Rounds.Text = _GameState.ResultTable[i + _PlayerTableOffset].NumRounds.ToString(); row.Won.Text = _GameState.ResultTable[i + _PlayerTableOffset].NumWon.ToString(); @@ -624,8 +622,8 @@ namespace VocaluxeLib.PartyModes.Challenge } } - Buttons[_ButtonPlayerScrollUp].Visible = _PlayerTableOffset > 0; - Buttons[_ButtonPlayerScrollDown].Visible = _GameState.ProfileIDs.Count - _NumPlayerVisible - _PlayerTableOffset > 0; + _Buttons[_ButtonPlayerScrollUp].Visible = _PlayerTableOffset > 0; + _Buttons[_ButtonPlayerScrollDown].Visible = _GameState.ProfileIDs.Count - _NumPlayerVisible - _PlayerTableOffset > 0; } private void _ScrollPlayerTable(int offset) diff --git a/PartyModes/PartyModeChallenge/CPartyScreenChallengeNames.cs b/PartyModes/PartyModeChallenge/CPartyScreenChallengeNames.cs index 4900cb28..9da4b884 100644 --- a/PartyModes/PartyModeChallenge/CPartyScreenChallengeNames.cs +++ b/PartyModes/PartyModeChallenge/CPartyScreenChallengeNames.cs @@ -19,12 +19,15 @@ using System; using System.Collections.Generic; +using System.Linq; using System.Windows.Forms; using VocaluxeLib.Menu; namespace VocaluxeLib.PartyModes.Challenge { +// ReSharper disable UnusedMember.Global public class CPartyScreenChallengeNames : CMenuParty +// ReSharper restore UnusedMember.Global { // Version number for theme files. Increment it, if you've changed something on the theme files! protected override int _ScreenVersion @@ -41,7 +44,6 @@ namespace VocaluxeLib.PartyModes.Challenge private List _PlayerDestinationButtons; //PlayerDestinationButtons-Option private const int _PlayerDestinationButtonsNumH = 3; - private const int _PlayerDestinationButtonsNumW = 4; private const int _PlayerDestinationButtonsFirstX = 900; private const int _PlayerDestinationButtonsFirstY = 105; private const int _PlayerDestinationButtonsSpaceH = 15; @@ -54,7 +56,7 @@ namespace VocaluxeLib.PartyModes.Challenge private const int _PlayerChooseButtonsFirstY = 105; private const int _PlayerChooseButtonsSpaceH = 15; private const int _PlayerChooseButtonsSpaceW = 25; - private int _PlayerChooseButtonsOffset = 0; + private const int _PlayerChooseButtonsOffset = 0; private CStatic _ChooseAvatarStatic; private bool _SelectingMouseActive; @@ -84,27 +86,19 @@ namespace VocaluxeLib.PartyModes.Challenge _Data.ScreenNames.ProfileIDs = new List(); - List buttons = new List(); _ThemeButtons = new string[] {_ButtonBack, _ButtonNext, _ButtonPlayerDestination, _ButtonPlayerChoose}; _Data = new SDataFromScreen(); - SFromScreenNames names = new SFromScreenNames(); - names.FadeToConfig = false; - names.FadeToMain = false; - names.ProfileIDs = new List(); + SFromScreenNames names = new SFromScreenNames {FadeToConfig = false, FadeToMain = false, ProfileIDs = new List()}; _Data.ScreenNames = names; } public override void DataToScreen(object receivedData) { - SDataToScreenNames config = new SDataToScreenNames(); - try { - config = (SDataToScreenNames)receivedData; - _Data.ScreenNames.ProfileIDs = config.ProfileIDs; - if (_Data.ScreenNames.ProfileIDs == null) - _Data.ScreenNames.ProfileIDs = new List(); + SDataToScreenNames config = (SDataToScreenNames)receivedData; + _Data.ScreenNames.ProfileIDs = config.ProfileIDs ?? new List(); _NumPlayer = config.NumPlayer; @@ -132,10 +126,10 @@ namespace VocaluxeLib.PartyModes.Challenge break; case Keys.Enter: - if (Buttons[_ButtonBack].Selected) + if (_Buttons[_ButtonBack].Selected) _Back(); - if (Buttons[_ButtonNext].Selected) + if (_Buttons[_ButtonNext].Selected) _Next(); if (!_OnAdd()) @@ -237,12 +231,12 @@ namespace VocaluxeLib.PartyModes.Challenge _ChooseAvatarStatic.Visible = false; } - if (mouseEvent.LB && IsMouseOver(mouseEvent)) + if (mouseEvent.LB && _IsMouseOver(mouseEvent)) { - if (Buttons[_ButtonBack].Selected) + if (_Buttons[_ButtonBack].Selected) _Back(); - if (Buttons[_ButtonNext].Selected) + if (_Buttons[_ButtonNext].Selected) _Next(); if (!_OnAdd()) @@ -287,13 +281,13 @@ namespace VocaluxeLib.PartyModes.Challenge private void _AddButtonPlayerDestination() { - Buttons[_ButtonPlayerDestination].Visible = false; + _Buttons[_ButtonPlayerDestination].Visible = false; _PlayerDestinationButtons = new List(); int row = 0; int column = 0; for (int i = 1; i <= _PartyMode.GetMaxPlayer(); i++) { - CButton b = GetNewButton(Buttons[_ButtonPlayerDestination]); + CButton b = GetNewButton(_Buttons[_ButtonPlayerDestination]); b.Rect.X = _PlayerDestinationButtonsFirstX + column * (b.Rect.W + _PlayerDestinationButtonsSpaceH); b.Rect.Y = _PlayerDestinationButtonsFirstY + row * (b.Rect.H + _PlayerDestinationButtonsSpaceW); _PlayerDestinationButtons.Add(b); @@ -305,24 +299,22 @@ namespace VocaluxeLib.PartyModes.Challenge } b.Visible = true; b.Enabled = false; - AddButton(b); + _AddButton(b); } } private void _AddButtonPlayerChoose() { - Buttons[_ButtonPlayerChoose].Visible = false; + _Buttons[_ButtonPlayerChoose].Visible = false; _PlayerChooseButtons = new List(); int row = 0; int column = 0; for (int i = 1; i <= _PlayerChooseButtonsNumH * _PlayerChooseButtonsNumW; i++) { - CButton b = GetNewButton(Buttons[_ButtonPlayerChoose]); + CButton b = GetNewButton(_Buttons[_ButtonPlayerChoose]); b.Rect.X = _PlayerChooseButtonsFirstX + column * (b.Rect.W + _PlayerChooseButtonsSpaceH); b.Rect.Y = _PlayerChooseButtonsFirstY + row * (b.Rect.H + _PlayerChooseButtonsSpaceW); - CPlayerChooseButton pcb = new CPlayerChooseButton(); - pcb.Button = b; - pcb.ProfileID = -1; + CPlayerChooseButton pcb = new CPlayerChooseButton {Button = b, ProfileID = -1}; _PlayerChooseButtons.Add(pcb); column++; if (column >= _PlayerChooseButtonsNumH) @@ -332,7 +324,7 @@ namespace VocaluxeLib.PartyModes.Challenge } b.Visible = true; b.Enabled = false; - AddButton(b); + _AddButton(b); } } @@ -348,7 +340,7 @@ namespace VocaluxeLib.PartyModes.Challenge private void _UpdateButtonPlayerChoose(int offset) { - int numButtonPlayerChoose = _PlayerChooseButtonsNumW * _PlayerChooseButtonsNumH; + const int numButtonPlayerChoose = _PlayerChooseButtonsNumW * _PlayerChooseButtonsNumH; if (offset < 0) offset = 0; @@ -372,10 +364,10 @@ namespace VocaluxeLib.PartyModes.Challenge { _PlayerChooseButtons[i].ProfileID = -1; _PlayerChooseButtons[i].Button.Text.Text = String.Empty; - _PlayerChooseButtons[i].Button.Texture = Buttons[_ButtonPlayerChoose].Texture; - _PlayerChooseButtons[i].Button.SelTexture = Buttons[_ButtonPlayerChoose].SelTexture; - _PlayerChooseButtons[i].Button.Color = Buttons[_ButtonPlayerChoose].Color; - _PlayerChooseButtons[i].Button.SelColor = Buttons[_ButtonPlayerChoose].SelColor; + _PlayerChooseButtons[i].Button.Texture = _Buttons[_ButtonPlayerChoose].Texture; + _PlayerChooseButtons[i].Button.SelTexture = _Buttons[_ButtonPlayerChoose].SelTexture; + _PlayerChooseButtons[i].Button.Color = _Buttons[_ButtonPlayerChoose].Color; + _PlayerChooseButtons[i].Button.SelColor = _Buttons[_ButtonPlayerChoose].SelColor; _PlayerChooseButtons[i].Button.Enabled = false; } } @@ -391,17 +383,7 @@ namespace VocaluxeLib.PartyModes.Challenge //Show profile only if active if (CBase.Profiles.GetProfiles()[i].Active == EOffOn.TR_CONFIG_ON) { - visible = true; - - for (int p = 0; p < _Data.ScreenNames.ProfileIDs.Count; p++) - { - //Don't show profile if is selected - if (_Data.ScreenNames.ProfileIDs[p] == i) - { - visible = false; - break; - } - } + visible = _Data.ScreenNames.ProfileIDs.All(profileID => profileID != i); } if (visible) _PlayerChooseButtonsVisibleProfiles.Add(i); @@ -439,10 +421,10 @@ namespace VocaluxeLib.PartyModes.Challenge } else { - _PlayerDestinationButtons[i].Color = Buttons[_ButtonPlayerDestination].Color; - _PlayerDestinationButtons[i].SelColor = Buttons[_ButtonPlayerDestination].SelColor; - _PlayerDestinationButtons[i].Texture = Buttons[_ButtonPlayerDestination].Texture; - _PlayerDestinationButtons[i].SelTexture = Buttons[_ButtonPlayerDestination].SelTexture; + _PlayerDestinationButtons[i].Color = _Buttons[_ButtonPlayerDestination].Color; + _PlayerDestinationButtons[i].SelColor = _Buttons[_ButtonPlayerDestination].SelColor; + _PlayerDestinationButtons[i].Texture = _Buttons[_ButtonPlayerDestination].Texture; + _PlayerDestinationButtons[i].SelTexture = _Buttons[_ButtonPlayerDestination].SelTexture; _PlayerDestinationButtons[i].Text.Text = String.Empty; _PlayerDestinationButtons[i].Enabled = false; } @@ -453,59 +435,52 @@ namespace VocaluxeLib.PartyModes.Challenge { if (_Data.ScreenNames.ProfileIDs.Count == _NumPlayer) { - Buttons[_ButtonNext].Visible = true; - SetInteractionToButton(Buttons[_ButtonNext]); + _Buttons[_ButtonNext].Visible = true; + _SetInteractionToButton(_Buttons[_ButtonNext]); } else - Buttons[_ButtonNext].Visible = false; + _Buttons[_ButtonNext].Visible = false; } private bool _OnAdd() { - for (int i = 0; i < _PlayerChooseButtons.Count; i++) + foreach (CPlayerChooseButton button in _PlayerChooseButtons) { - if (_PlayerChooseButtons[i].Button.Selected && _PlayerChooseButtons[i].ProfileID != -1) - { - if (_Data.ScreenNames.ProfileIDs.Count < _NumPlayer) - { - _Data.ScreenNames.ProfileIDs.Add(_PlayerChooseButtons[i].ProfileID); - int added = _Data.ScreenNames.ProfileIDs.Count - 1; - _UpdateButtonNext(); - //Update texture and name - _PlayerDestinationButtons[added].Color = new SColorF(1, 1, 1, 0.6f); - _PlayerDestinationButtons[added].SelColor = new SColorF(1, 1, 1, 1); - _PlayerDestinationButtons[added].Texture = CBase.Profiles.GetProfiles()[_PlayerChooseButtons[i].ProfileID].Avatar.Texture; - _PlayerDestinationButtons[added].SelTexture = CBase.Profiles.GetProfiles()[_PlayerChooseButtons[i].ProfileID].Avatar.Texture; - _PlayerDestinationButtons[added].Text.Text = CBase.Profiles.GetProfiles()[_PlayerChooseButtons[i].ProfileID].PlayerName; - _PlayerDestinationButtons[added].Enabled = true; - //Update Tiles-List - _UpdateButtonPlayerChoose(); - CheckInteraction(); - return true; - } - } + if (!button.Button.Selected || button.ProfileID == -1 || _Data.ScreenNames.ProfileIDs.Count >= _NumPlayer) + continue; + _Data.ScreenNames.ProfileIDs.Add(button.ProfileID); + int added = _Data.ScreenNames.ProfileIDs.Count - 1; + _UpdateButtonNext(); + //Update texture and name + _PlayerDestinationButtons[added].Color = new SColorF(1, 1, 1, 0.6f); + _PlayerDestinationButtons[added].SelColor = new SColorF(1, 1, 1, 1); + _PlayerDestinationButtons[added].Texture = CBase.Profiles.GetProfiles()[button.ProfileID].Avatar.Texture; + _PlayerDestinationButtons[added].SelTexture = CBase.Profiles.GetProfiles()[button.ProfileID].Avatar.Texture; + _PlayerDestinationButtons[added].Text.Text = CBase.Profiles.GetProfiles()[button.ProfileID].PlayerName; + _PlayerDestinationButtons[added].Enabled = true; + //Update Tiles-List + _UpdateButtonPlayerChoose(); + _CheckInteraction(); + return true; } return false; } - private bool _OnRemove() + private void _OnRemove() { for (int i = 0; i < _PlayerDestinationButtons.Count; i++) { - if (_PlayerDestinationButtons[i].Selected) - { - if ((i + 1) <= _Data.ScreenNames.ProfileIDs.Count) - { - _Data.ScreenNames.ProfileIDs.RemoveAt(i); - _UpdateButtonNext(); - _UpdateButtonPlayerDestination(); - _UpdateButtonPlayerChoose(); - CheckInteraction(); - return true; - } - } + if (!_PlayerDestinationButtons[i].Selected) + continue; + if ((i + 1) > _Data.ScreenNames.ProfileIDs.Count) + continue; + _Data.ScreenNames.ProfileIDs.RemoveAt(i); + _UpdateButtonNext(); + _UpdateButtonPlayerDestination(); + _UpdateButtonPlayerChoose(); + _CheckInteraction(); + return; } - return false; } private void _Back() diff --git a/PartyModes/PartyModeChallengeMedley/CPartyModeChallengeMedley.cs b/PartyModes/PartyModeChallengeMedley/CPartyModeChallengeMedley.cs index 96e0e952..eee61868 100644 --- a/PartyModes/PartyModeChallengeMedley/CPartyModeChallengeMedley.cs +++ b/PartyModes/PartyModeChallengeMedley/CPartyModeChallengeMedley.cs @@ -216,7 +216,7 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley public override void DataFromScreen(string screenName, Object data) { - SDataFromScreen dataFrom = new SDataFromScreen(); + SDataFromScreen dataFrom; switch (screenName) { case "PartyScreenChallengeMedleyConfig": @@ -376,10 +376,11 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley return _ScreenSongOptions; } +// ReSharper disable RedundantAssignment public override void OnSongChange(int songIndex, ref SScreenSongOptions screenSongOptions) +// ReSharper restore RedundantAssignment { - if (_ScreenSongOptions.Selection.SongIndex != -1) - _ScreenSongOptions.Selection.SongIndex = -1; + _ScreenSongOptions.Selection.SongIndex = -1; if (_ScreenSongOptions.Selection.SelectNextRandomSong && songIndex != -1) { @@ -396,7 +397,9 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley screenSongOptions = _ScreenSongOptions; } +// ReSharper disable RedundantAssignment public override void OnCategoryChange(int categoryIndex, ref SScreenSongOptions screenSongOptions) +// ReSharper restore RedundantAssignment { if (_GameData.CatSongIndices != null && categoryIndex != -1) { diff --git a/PartyModes/PartyModeChallengeMedley/CPartyScreenChallengeMedleyConfig.cs b/PartyModes/PartyModeChallengeMedley/CPartyScreenChallengeMedleyConfig.cs index b7a9578b..956954db 100644 --- a/PartyModes/PartyModeChallengeMedley/CPartyScreenChallengeMedleyConfig.cs +++ b/PartyModes/PartyModeChallengeMedley/CPartyScreenChallengeMedleyConfig.cs @@ -60,11 +60,9 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley public override void DataToScreen(object receivedData) { - SDataToScreenConfig config = new SDataToScreenConfig(); - try { - config = (SDataToScreenConfig)receivedData; + SDataToScreenConfig config = (SDataToScreenConfig)receivedData; _Data.ScreenConfig.NumPlayer = config.NumPlayer; _Data.ScreenConfig.NumPlayerAtOnce = config.NumPlayerAtOnce; _Data.ScreenConfig.NumRounds = config.NumRounds; @@ -92,10 +90,10 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley case Keys.Enter: _UpdateSlides(); - if (Buttons[_ButtonBack].Selected) + if (_Buttons[_ButtonBack].Selected) _Back(); - if (Buttons[_ButtonNext].Selected) + if (_Buttons[_ButtonNext].Selected) _Next(); break; @@ -115,13 +113,13 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley { base.HandleMouse(mouseEvent); - if (mouseEvent.LB && IsMouseOver(mouseEvent)) + if (mouseEvent.LB && _IsMouseOver(mouseEvent)) { _UpdateSlides(); - if (Buttons[_ButtonBack].Selected) + if (_Buttons[_ButtonBack].Selected) _Back(); - if (Buttons[_ButtonNext].Selected) + if (_Buttons[_ButtonNext].Selected) _Next(); } @@ -158,10 +156,10 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley private void _RebuildSlides() { // build num player slide (min player ... max player); - SelectSlides[_SelectSlideNumPlayers].Clear(); + _SelectSlides[_SelectSlideNumPlayers].Clear(); for (int i = _PartyMode.GetMinPlayer(); i <= _PartyMode.GetMaxPlayer(); i++) - SelectSlides[_SelectSlideNumPlayers].AddValue(i.ToString()); - SelectSlides[_SelectSlideNumPlayers].Selection = _Data.ScreenConfig.NumPlayer - _PartyMode.GetMinPlayer(); + _SelectSlides[_SelectSlideNumPlayers].AddValue(i.ToString()); + _SelectSlides[_SelectSlideNumPlayers].Selection = _Data.ScreenConfig.NumPlayer - _PartyMode.GetMinPlayer(); _UpdateMicsAtOnce(); _SetRoundSteps(); @@ -172,9 +170,9 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley { int player = _Data.ScreenConfig.NumPlayer; int mics = _Data.ScreenConfig.NumPlayerAtOnce; - _Data.ScreenConfig.NumPlayer = SelectSlides[_SelectSlideNumPlayers].Selection + _PartyMode.GetMinPlayer(); - _Data.ScreenConfig.NumPlayerAtOnce = SelectSlides[_SelectSlideNumMics].Selection + _PartyMode.GetMinPlayer(); - _Data.ScreenConfig.NumRounds = (SelectSlides[_SelectSlideNumRounds].Selection + 1) * _RoundSteps; + _Data.ScreenConfig.NumPlayer = _SelectSlides[_SelectSlideNumPlayers].Selection + _PartyMode.GetMinPlayer(); + _Data.ScreenConfig.NumPlayerAtOnce = _SelectSlides[_SelectSlideNumMics].Selection + _PartyMode.GetMinPlayer(); + _Data.ScreenConfig.NumRounds = (_SelectSlides[_SelectSlideNumRounds].Selection + 1) * _RoundSteps; _UpdateMicsAtOnce(); _SetRoundSteps(); @@ -201,19 +199,19 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley _Data.ScreenConfig.NumPlayerAtOnce = maxNum; // build mics at once slide - SelectSlides[_SelectSlideNumMics].Clear(); + _SelectSlides[_SelectSlideNumMics].Clear(); for (int i = 1; i <= maxNum; i++) - SelectSlides[_SelectSlideNumMics].AddValue(i.ToString()); - SelectSlides[_SelectSlideNumMics].Selection = _Data.ScreenConfig.NumPlayerAtOnce - _PartyMode.GetMinPlayer(); + _SelectSlides[_SelectSlideNumMics].AddValue(i.ToString()); + _SelectSlides[_SelectSlideNumMics].Selection = _Data.ScreenConfig.NumPlayerAtOnce - _PartyMode.GetMinPlayer(); } private void _UpdateSlideRounds() { // build num rounds slide - SelectSlides[_SelectSlideNumRounds].Clear(); + _SelectSlides[_SelectSlideNumRounds].Clear(); for (int i = _RoundSteps; i <= _MaxNumRounds; i += _RoundSteps) - SelectSlides[_SelectSlideNumRounds].AddValue(i.ToString()); - SelectSlides[_SelectSlideNumRounds].Selection = _Data.ScreenConfig.NumRounds / _RoundSteps - 1; + _SelectSlides[_SelectSlideNumRounds].AddValue(i.ToString()); + _SelectSlides[_SelectSlideNumRounds].Selection = _Data.ScreenConfig.NumRounds / _RoundSteps - 1; } private void _SetRoundSteps() diff --git a/PartyModes/PartyModeChallengeMedley/CPartyScreenChallengeMedleyMain.cs b/PartyModes/PartyModeChallengeMedley/CPartyScreenChallengeMedleyMain.cs index dc61bbec..d4729c2f 100644 --- a/PartyModes/PartyModeChallengeMedley/CPartyScreenChallengeMedleyMain.cs +++ b/PartyModes/PartyModeChallengeMedley/CPartyScreenChallengeMedleyMain.cs @@ -130,20 +130,18 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley for (int i = 0; i < _PartyMode.GetMaxPlayer(); i++) { - _NextPlayerTexts.Add(GetNewText(Texts[_TextNextPlayer])); - AddText(_NextPlayerTexts[_NextPlayerTexts.Count - 1]); - _NextPlayerStatics.Add(GetNewStatic(Statics[_StaticNextPlayer])); - AddStatic(_NextPlayerStatics[_NextPlayerStatics.Count - 1]); + _NextPlayerTexts.Add(GetNewText(_Texts[_TextNextPlayer])); + _AddText(_NextPlayerTexts[_NextPlayerTexts.Count - 1]); + _NextPlayerStatics.Add(GetNewStatic(_Statics[_StaticNextPlayer])); + _AddStatic(_NextPlayerStatics[_NextPlayerStatics.Count - 1]); } } public override void DataToScreen(object receivedData) { - SDataToScreenMain data = new SDataToScreenMain(); - try { - data = (SDataToScreenMain)receivedData; + SDataToScreenMain data = (SDataToScreenMain)receivedData; _GameState = data; } catch (Exception e) @@ -177,26 +175,26 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley case Keys.Enter: if (!_ExitPopupVisible) { - if (Buttons[_ButtonNextRound].Selected) + if (_Buttons[_ButtonNextRound].Selected) _NextRound(); - if (Buttons[_ButtonBack].Selected && _GameState.CurrentRoundNr == 1) + if (_Buttons[_ButtonBack].Selected && _GameState.CurrentRoundNr == 1) _Back(); - if (Buttons[_ButtonExit].Selected && _GameState.CurrentRoundNr > 1) + if (_Buttons[_ButtonExit].Selected && _GameState.CurrentRoundNr > 1) _ShowPopup(true); - if (Buttons[_ButtonPlayerScrollUp].Selected) + if (_Buttons[_ButtonPlayerScrollUp].Selected) _ScrollPlayerTable(-1); - if (Buttons[_ButtonPlayerScrollDown].Selected) + if (_Buttons[_ButtonPlayerScrollDown].Selected) _ScrollPlayerTable(1); - if (Buttons[_ButtonRoundsScrollUp].Selected) + if (_Buttons[_ButtonRoundsScrollUp].Selected) _ScrollRoundsTable(-1); - if (Buttons[_ButtonRoundsScrollDown].Selected) + if (_Buttons[_ButtonRoundsScrollDown].Selected) _ScrollRoundsTable(1); } else { - if (Buttons[_ButtonPopupYes].Selected) + if (_Buttons[_ButtonPopupYes].Selected) _EndParty(); - if (Buttons[_ButtonPopupNo].Selected) + if (_Buttons[_ButtonPopupNo].Selected) _ShowPopup(false); } break; @@ -209,30 +207,30 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley { base.HandleMouse(mouseEvent); - if (mouseEvent.LB && IsMouseOver(mouseEvent)) + if (mouseEvent.LB && _IsMouseOver(mouseEvent)) { if (!_ExitPopupVisible) { - if (Buttons[_ButtonNextRound].Selected) + if (_Buttons[_ButtonNextRound].Selected) _NextRound(); - if (Buttons[_ButtonBack].Selected && _GameState.CurrentRoundNr == 1) + if (_Buttons[_ButtonBack].Selected && _GameState.CurrentRoundNr == 1) _Back(); - if (Buttons[_ButtonExit].Selected && _GameState.CurrentRoundNr > 1) + if (_Buttons[_ButtonExit].Selected && _GameState.CurrentRoundNr > 1) _ShowPopup(true); - if (Buttons[_ButtonPlayerScrollUp].Selected) + if (_Buttons[_ButtonPlayerScrollUp].Selected) _ScrollPlayerTable(-1); - if (Buttons[_ButtonPlayerScrollDown].Selected) + if (_Buttons[_ButtonPlayerScrollDown].Selected) _ScrollPlayerTable(1); - if (Buttons[_ButtonRoundsScrollUp].Selected) + if (_Buttons[_ButtonRoundsScrollUp].Selected) _ScrollRoundsTable(-1); - if (Buttons[_ButtonRoundsScrollDown].Selected) + if (_Buttons[_ButtonRoundsScrollDown].Selected) _ScrollRoundsTable(1); } else { - if (Buttons[_ButtonPopupYes].Selected) + if (_Buttons[_ButtonPopupYes].Selected) _EndParty(); - if (Buttons[_ButtonPopupNo].Selected) + if (_Buttons[_ButtonPopupNo].Selected) _ShowPopup(false); } } @@ -279,29 +277,29 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley if (_GameState.CurrentRoundNr == 1) { - Buttons[_ButtonBack].Visible = true; - Buttons[_ButtonExit].Visible = false; + _Buttons[_ButtonBack].Visible = true; + _Buttons[_ButtonExit].Visible = false; } else { - Buttons[_ButtonBack].Visible = false; - Buttons[_ButtonExit].Visible = true; + _Buttons[_ButtonBack].Visible = false; + _Buttons[_ButtonExit].Visible = true; } if (_GameState.CurrentRoundNr <= _GameState.Combs.Count) { - Buttons[_ButtonNextRound].Visible = true; - Texts[_TextFinishMessage].Visible = false; - Texts[_TextFinishPlayerWin].Visible = false; - SetInteractionToButton(Buttons[_ButtonNextRound]); + _Buttons[_ButtonNextRound].Visible = true; + _Texts[_TextFinishMessage].Visible = false; + _Texts[_TextFinishPlayerWin].Visible = false; + _SetInteractionToButton(_Buttons[_ButtonNextRound]); } else { - Buttons[_ButtonNextRound].Visible = false; - Texts[_TextFinishMessage].Visible = true; - Texts[_TextFinishPlayerWin].Visible = true; - Texts[_TextFinishPlayerWin].Text = _GetPlayerWinString(); - SetInteractionToButton(Buttons[_ButtonExit]); + _Buttons[_ButtonNextRound].Visible = false; + _Texts[_TextFinishMessage].Visible = true; + _Texts[_TextFinishPlayerWin].Visible = true; + _Texts[_TextFinishPlayerWin].Text = _GetPlayerWinString(); + _SetInteractionToButton(_Buttons[_ButtonExit]); } _ShowPopup(false); @@ -334,13 +332,13 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley { _ExitPopupVisible = visible; - Statics[_StaticPopupBG].Visible = _ExitPopupVisible; - Texts[_TextPopupReallyExit].Visible = _ExitPopupVisible; - Buttons[_ButtonPopupYes].Visible = _ExitPopupVisible; - Buttons[_ButtonPopupNo].Visible = _ExitPopupVisible; + _Statics[_StaticPopupBG].Visible = _ExitPopupVisible; + _Texts[_TextPopupReallyExit].Visible = _ExitPopupVisible; + _Buttons[_ButtonPopupYes].Visible = _ExitPopupVisible; + _Buttons[_ButtonPopupNo].Visible = _ExitPopupVisible; if (_ExitPopupVisible) - SetInteractionToButton(Buttons[_ButtonPopupNo]); + _SetInteractionToButton(_Buttons[_ButtonPopupNo]); } private void _Back() @@ -352,7 +350,7 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley private void _UpdateNextPlayerPositions() { - float x = CBase.Settings.GetRenderW() / 2 - ((_GameState.NumPlayerAtOnce * Statics[_StaticNextPlayer].Rect.W) + ((_GameState.NumPlayerAtOnce - 1) * 15)) / 2; + float x = CBase.Settings.GetRenderW() / 2 - ((_GameState.NumPlayerAtOnce * _Statics[_StaticNextPlayer].Rect.W) + ((_GameState.NumPlayerAtOnce - 1) * 15)) / 2; float staticY = 590; float textY = 550; for (int i = 0; i < _GameState.NumPlayerAtOnce; i++) @@ -362,11 +360,11 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley _NextPlayerStatics[i].Rect.Y = staticY; _NextPlayerStatics[i].Visible = true; //text - _NextPlayerTexts[i].X = x + Statics[_StaticNextPlayer].Rect.W / 2; + _NextPlayerTexts[i].X = x + _Statics[_StaticNextPlayer].Rect.W / 2; _NextPlayerTexts[i].Y = textY; _NextPlayerTexts[i].Visible = true; - x += Statics[_StaticNextPlayer].Rect.W + 15; + x += _Statics[_StaticNextPlayer].Rect.W + 15; } for (int i = _GameState.NumPlayerAtOnce; i < _PartyMode.GetMaxPlayer(); i++) { @@ -379,7 +377,7 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley { if (_GameState.CurrentRoundNr <= _GameState.Combs.Count) { - Texts[_TextNextPlayerMessage].Visible = true; + _Texts[_TextNextPlayerMessage].Visible = true; SProfile[] profiles = CBase.Profiles.GetProfiles(); for (int i = 0; i < _GameState.NumPlayerAtOnce; i++) { @@ -391,7 +389,7 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley } else { - Texts[_TextNextPlayerMessage].Visible = false; + _Texts[_TextNextPlayerMessage].Visible = false; for (int i = 0; i < _GameState.NumPlayerAtOnce; i++) { _NextPlayerStatics[i].Visible = false; @@ -415,20 +413,20 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley for (int round = 0; round < _RoundsTable.Count; round++) { //Round-number - CText text = GetNewText(Texts[_TextRoundNumber]); - AddText(text); + CText text = GetNewText(_Texts[_TextRoundNumber]); + _AddText(text); _RoundsTable[round].Number = text; for (int row = 0; row < 2; row++) { for (int column = 0; column < 3; column++) { //Player - text = GetNewText(Texts[_TextRoundPlayer]); - AddText(text); + text = GetNewText(_Texts[_TextRoundPlayer]); + _AddText(text); _RoundsTable[round].TextPlayer.Add(text); //Score - text = GetNewText(Texts[_TextRoundScore]); - AddText(text); + text = GetNewText(_Texts[_TextRoundScore]); + _AddText(text); _RoundsTable[round].TextScores.Add(text); } } @@ -448,14 +446,14 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley if (_NumRoundsVisible > _GameState.Combs.Count) _NumRoundsVisible = _GameState.Combs.Count; - float numberX = Texts[_TextRoundNumber].X; - float numberY = Texts[_TextRoundNumber].Y; + float numberX = _Texts[_TextRoundNumber].X; + float numberY = _Texts[_TextRoundNumber].Y; _RoundsTableScrollArea.X = numberX; _RoundsTableScrollArea.Y = numberY; - _RoundsTableScrollArea.W = CBase.Settings.GetRenderW() - Texts[_TextRoundNumber].X - 20; + _RoundsTableScrollArea.W = CBase.Settings.GetRenderW() - _Texts[_TextRoundNumber].X - 20; - float delta = Texts[_TextRoundNumber].Height; + float delta = _Texts[_TextRoundNumber].Height; //Update statics and texts for rounds for (int round = 0; round < _RoundsTable.Count; round++) @@ -476,9 +474,9 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley for (int column = row * numPlayerInOneRow; column < num; column++) { //Player - float x = numberX + 15 + (CBase.Settings.GetRenderW() - Texts[_TextRoundNumber].X - 20) / numPlayerInThisRow * (column - row * numPlayerInOneRow) + - ((CBase.Settings.GetRenderW() - Texts[_TextRoundNumber].X - 20) / numPlayerInThisRow) / 2; - float maxw = ((CBase.Settings.GetRenderW() - Texts[_TextRoundNumber].X - 20) / numPlayerInThisRow) / 2 - 5; + float x = numberX + 15 + (CBase.Settings.GetRenderW() - _Texts[_TextRoundNumber].X - 20) / numPlayerInThisRow * (column - row * numPlayerInOneRow) + + ((CBase.Settings.GetRenderW() - _Texts[_TextRoundNumber].X - 20) / numPlayerInThisRow) / 2; + float maxw = ((CBase.Settings.GetRenderW() - _Texts[_TextRoundNumber].X - 20) / numPlayerInThisRow) / 2 - 5; _RoundsTable[round].TextPlayer[column].X = x; _RoundsTable[round].TextPlayer[column].Y = numberY; _RoundsTable[round].TextPlayer[column].MaxWidth = maxw; @@ -507,7 +505,7 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley _RoundsTable[i].Number.Visible = true; _RoundsTable[i].TextPlayer[p].Visible = true; _RoundsTable[i].TextScores[p].Visible = true; - _RoundsTable[i].Number.Text = (i + 1 + _RoundsTableOffset).ToString() + ")"; + _RoundsTable[i].Number.Text = (i + 1 + _RoundsTableOffset) + ")"; int pID = _GameState.ProfileIDs[_GameState.Combs[i + _RoundsTableOffset].Player[p]]; _RoundsTable[i].TextPlayer[p].Text = profile[pID].PlayerName; if ((_GameState.CurrentRoundNr - 1) > i + _RoundsTableOffset) @@ -532,19 +530,19 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley } } - Buttons[_ButtonRoundsScrollUp].Visible = _RoundsTableOffset > 0; - Buttons[_ButtonRoundsScrollDown].Visible = _GameState.Combs.Count - _NumRoundsVisible - _RoundsTableOffset > 0; + _Buttons[_ButtonRoundsScrollUp].Visible = _RoundsTableOffset > 0; + _Buttons[_ButtonRoundsScrollDown].Visible = _GameState.Combs.Count - _NumRoundsVisible - _RoundsTableOffset > 0; } private void _BuildPlayerTable() { _PlayerTableScrollArea = new SRectF(); - _PlayerTableScrollArea.X = Texts[_TextPosition].X; - _PlayerTableScrollArea.Y = Texts[_TextPosition].Y; - _PlayerTableScrollArea.W = Texts[_TextGamePoints].X - Texts[_TextPosition].X; + _PlayerTableScrollArea.X = _Texts[_TextPosition].X; + _PlayerTableScrollArea.Y = _Texts[_TextPosition].Y; + _PlayerTableScrollArea.W = _Texts[_TextGamePoints].X - _Texts[_TextPosition].X; _PlayerTable = new List(); - float delta = Texts[_TextPosition].Height * 1.2f; + float delta = _Texts[_TextPosition].Height * 1.2f; float h = 0; @@ -552,12 +550,12 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley { STableRow row = new STableRow(); - row.Pos = GetNewText(Texts[_TextPosition]); - row.Name = GetNewText(Texts[_TextPlayerName]); - row.Rounds = GetNewText(Texts[_TextNumPlayed]); - row.Won = GetNewText(Texts[_TextWon]); - row.SingPoints = GetNewText(Texts[_TextSingPoints]); - row.GamePoints = GetNewText(Texts[_TextGamePoints]); + row.Pos = GetNewText(_Texts[_TextPosition]); + row.Name = GetNewText(_Texts[_TextPlayerName]); + row.Rounds = GetNewText(_Texts[_TextNumPlayed]); + row.Won = GetNewText(_Texts[_TextWon]); + row.SingPoints = GetNewText(_Texts[_TextSingPoints]); + row.GamePoints = GetNewText(_Texts[_TextGamePoints]); row.Pos.Y += delta * (i + 1); row.Name.Y += delta * (i + 1); @@ -566,7 +564,7 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley row.SingPoints.Y += delta * (i + 1); row.GamePoints.Y += delta * (i + 1); - row.Pos.Text = (i + 1).ToString() + "."; + row.Pos.Text = (i + 1) + "."; row.Pos.Visible = false; row.Name.Visible = false; @@ -575,12 +573,12 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley row.SingPoints.Visible = false; row.GamePoints.Visible = false; - AddText(row.Pos); - AddText(row.Name); - AddText(row.Rounds); - AddText(row.Won); - AddText(row.SingPoints); - AddText(row.GamePoints); + _AddText(row.Pos); + _AddText(row.Name); + _AddText(row.Rounds); + _AddText(row.Won); + _AddText(row.SingPoints); + _AddText(row.GamePoints); _PlayerTable.Add(row); @@ -606,7 +604,7 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley row.SingPoints.Visible = true; row.GamePoints.Visible = true; - row.Pos.Text = _GameState.ResultTable[i + _PlayerTableOffset].Position.ToString() + "."; + row.Pos.Text = _GameState.ResultTable[i + _PlayerTableOffset].Position + "."; row.Name.Text = profiles[_GameState.ResultTable[i + _PlayerTableOffset].PlayerID].PlayerName; row.Rounds.Text = _GameState.ResultTable[i + _PlayerTableOffset].NumRounds.ToString(); row.Won.Text = _GameState.ResultTable[i + _PlayerTableOffset].NumWon.ToString(); @@ -624,8 +622,8 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley } } - Buttons[_ButtonPlayerScrollUp].Visible = _PlayerTableOffset > 0; - Buttons[_ButtonPlayerScrollDown].Visible = _GameState.ProfileIDs.Count - _NumPlayerVisible - _PlayerTableOffset > 0; + _Buttons[_ButtonPlayerScrollUp].Visible = _PlayerTableOffset > 0; + _Buttons[_ButtonPlayerScrollDown].Visible = _GameState.ProfileIDs.Count - _NumPlayerVisible - _PlayerTableOffset > 0; } private void _ScrollPlayerTable(int offset) diff --git a/PartyModes/PartyModeChallengeMedley/CPartyScreenChallengeMedleyNames.cs b/PartyModes/PartyModeChallengeMedley/CPartyScreenChallengeMedleyNames.cs index 4b10b5ca..a7a259f3 100644 --- a/PartyModes/PartyModeChallengeMedley/CPartyScreenChallengeMedleyNames.cs +++ b/PartyModes/PartyModeChallengeMedley/CPartyScreenChallengeMedleyNames.cs @@ -41,7 +41,6 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley private List _PlayerDestinationButtons; //PlayerDestinationButtons-Option private const int _PlayerDestinationButtonsNumH = 3; - private const int _PlayerDestinationButtonsNumW = 4; private const int _PlayerDestinationButtonsFirstX = 900; private const int _PlayerDestinationButtonsFirstY = 105; private const int _PlayerDestinationButtonsSpaceH = 15; @@ -97,14 +96,10 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley public override void DataToScreen(object receivedData) { - SDataToScreenNames config = new SDataToScreenNames(); - try { - config = (SDataToScreenNames)receivedData; - _Data.ScreenNames.ProfileIDs = config.ProfileIDs; - if (_Data.ScreenNames.ProfileIDs == null) - _Data.ScreenNames.ProfileIDs = new List(); + SDataToScreenNames config = (SDataToScreenNames)receivedData; + _Data.ScreenNames.ProfileIDs = config.ProfileIDs ?? new List(); _NumPlayer = config.NumPlayer; @@ -132,10 +127,10 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley break; case Keys.Enter: - if (Buttons[_ButtonBack].Selected) + if (_Buttons[_ButtonBack].Selected) _Back(); - if (Buttons[_ButtonNext].Selected) + if (_Buttons[_ButtonNext].Selected) _Next(); if (!_OnAdd()) @@ -237,12 +232,12 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley _ChooseAvatarStatic.Visible = false; } - if (mouseEvent.LB && IsMouseOver(mouseEvent)) + if (mouseEvent.LB && _IsMouseOver(mouseEvent)) { - if (Buttons[_ButtonBack].Selected) + if (_Buttons[_ButtonBack].Selected) _Back(); - if (Buttons[_ButtonNext].Selected) + if (_Buttons[_ButtonNext].Selected) _Next(); if (!_OnAdd()) @@ -287,13 +282,13 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley private void _AddButtonPlayerDestination() { - Buttons[_ButtonPlayerDestination].Visible = false; + _Buttons[_ButtonPlayerDestination].Visible = false; _PlayerDestinationButtons = new List(); int row = 0; int column = 0; for (int i = 1; i <= _PartyMode.GetMaxPlayer(); i++) { - CButton b = GetNewButton(Buttons[_ButtonPlayerDestination]); + CButton b = GetNewButton(_Buttons[_ButtonPlayerDestination]); b.Rect.X = _PlayerDestinationButtonsFirstX + column * (b.Rect.W + _PlayerDestinationButtonsSpaceH); b.Rect.Y = _PlayerDestinationButtonsFirstY + row * (b.Rect.H + _PlayerDestinationButtonsSpaceW); _PlayerDestinationButtons.Add(b); @@ -305,19 +300,19 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley } b.Visible = true; b.Enabled = false; - AddButton(b); + _AddButton(b); } } private void _AddButtonPlayerChoose() { - Buttons[_ButtonPlayerChoose].Visible = false; + _Buttons[_ButtonPlayerChoose].Visible = false; _PlayerChooseButtons = new List(); int row = 0; int column = 0; for (int i = 1; i <= _PlayerChooseButtonsNumH * _PlayerChooseButtonsNumW; i++) { - CButton b = GetNewButton(Buttons[_ButtonPlayerChoose]); + CButton b = GetNewButton(_Buttons[_ButtonPlayerChoose]); b.Rect.X = _PlayerChooseButtonsFirstX + column * (b.Rect.W + _PlayerChooseButtonsSpaceH); b.Rect.Y = _PlayerChooseButtonsFirstY + row * (b.Rect.H + _PlayerChooseButtonsSpaceW); CPlayerChooseButton pcb = new CPlayerChooseButton(); @@ -332,7 +327,7 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley } b.Visible = true; b.Enabled = false; - AddButton(b); + _AddButton(b); } } @@ -372,10 +367,10 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley { _PlayerChooseButtons[i].ProfileID = -1; _PlayerChooseButtons[i].Button.Text.Text = String.Empty; - _PlayerChooseButtons[i].Button.Texture = Buttons[_ButtonPlayerChoose].Texture; - _PlayerChooseButtons[i].Button.SelTexture = Buttons[_ButtonPlayerChoose].SelTexture; - _PlayerChooseButtons[i].Button.Color = Buttons[_ButtonPlayerChoose].Color; - _PlayerChooseButtons[i].Button.SelColor = Buttons[_ButtonPlayerChoose].SelColor; + _PlayerChooseButtons[i].Button.Texture = _Buttons[_ButtonPlayerChoose].Texture; + _PlayerChooseButtons[i].Button.SelTexture = _Buttons[_ButtonPlayerChoose].SelTexture; + _PlayerChooseButtons[i].Button.Color = _Buttons[_ButtonPlayerChoose].Color; + _PlayerChooseButtons[i].Button.SelColor = _Buttons[_ButtonPlayerChoose].SelColor; _PlayerChooseButtons[i].Button.Enabled = false; } } @@ -439,10 +434,10 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley } else { - _PlayerDestinationButtons[i].Color = Buttons[_ButtonPlayerDestination].Color; - _PlayerDestinationButtons[i].SelColor = Buttons[_ButtonPlayerDestination].SelColor; - _PlayerDestinationButtons[i].Texture = Buttons[_ButtonPlayerDestination].Texture; - _PlayerDestinationButtons[i].SelTexture = Buttons[_ButtonPlayerDestination].SelTexture; + _PlayerDestinationButtons[i].Color = _Buttons[_ButtonPlayerDestination].Color; + _PlayerDestinationButtons[i].SelColor = _Buttons[_ButtonPlayerDestination].SelColor; + _PlayerDestinationButtons[i].Texture = _Buttons[_ButtonPlayerDestination].Texture; + _PlayerDestinationButtons[i].SelTexture = _Buttons[_ButtonPlayerDestination].SelTexture; _PlayerDestinationButtons[i].Text.Text = String.Empty; _PlayerDestinationButtons[i].Enabled = false; } @@ -453,11 +448,11 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley { if (_Data.ScreenNames.ProfileIDs.Count == _NumPlayer) { - Buttons[_ButtonNext].Visible = true; - SetInteractionToButton(Buttons[_ButtonNext]); + _Buttons[_ButtonNext].Visible = true; + _SetInteractionToButton(_Buttons[_ButtonNext]); } else - Buttons[_ButtonNext].Visible = false; + _Buttons[_ButtonNext].Visible = false; } private bool _OnAdd() @@ -480,7 +475,7 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley _PlayerDestinationButtons[added].Enabled = true; //Update Tiles-List _UpdateButtonPlayerChoose(); - CheckInteraction(); + _CheckInteraction(); return true; } } @@ -500,7 +495,7 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley _UpdateButtonNext(); _UpdateButtonPlayerDestination(); _UpdateButtonPlayerChoose(); - CheckInteraction(); + _CheckInteraction(); return true; } } diff --git a/PartyModes/PartyModeTicTacToe/CPartyModeTicTacToe.cs b/PartyModes/PartyModeTicTacToe/CPartyModeTicTacToe.cs index 12b79aad..0e012ee3 100644 --- a/PartyModes/PartyModeTicTacToe/CPartyModeTicTacToe.cs +++ b/PartyModes/PartyModeTicTacToe/CPartyModeTicTacToe.cs @@ -52,7 +52,7 @@ namespace VocaluxeLib.PartyModes.TicTacToe public int PointsTeam1; public int PointsTeam2; public int Winner; - public bool Finished = false; + public bool Finished; } #region Communication @@ -456,12 +456,16 @@ namespace VocaluxeLib.PartyModes.TicTacToe return _ScreenSongOptions; } +// ReSharper disable RedundantAssignment public override void OnSongChange(int songIndex, ref SScreenSongOptions screenSongOptions) +// ReSharper restore RedundantAssignment { screenSongOptions = _ScreenSongOptions; } +// ReSharper disable RedundantAssignment public override void OnCategoryChange(int categoryIndex, ref SScreenSongOptions screenSongOptions) +// ReSharper restore RedundantAssignment { screenSongOptions = _ScreenSongOptions; } @@ -541,99 +545,101 @@ namespace VocaluxeLib.PartyModes.TicTacToe private void _PreparePlayerList(int team) { - if (team == 0) + switch (team) { - _GameData.PlayerTeam1 = new List(); - _GameData.PlayerTeam2 = new List(); + case 0: + { + _GameData.PlayerTeam1 = new List(); + _GameData.PlayerTeam2 = new List(); - //Prepare Player-IDs - List iDs1 = new List(); - List iDs2 = new List(); - int num = 0; - int random = 0; - //Add IDs to team-list - while (_GameData.PlayerTeam1.Count < _GameData.NumFields + _GameData.NumJokerRetry[0] && iDs1.Count == 0 && - _GameData.PlayerTeam2.Count < _GameData.NumFields + _GameData.NumJokerRetry[1] && iDs2.Count == 0) - { - if (iDs1.Count == 0) - { - for (int i = 0; i < _GameData.NumPlayerTeam1; i++) - iDs1.Add(i); + //Prepare Player-IDs + List ids1 = new List(); + List ids2 = new List(); + //Add IDs to team-list + while (_GameData.PlayerTeam1.Count < _GameData.NumFields + _GameData.NumJokerRetry[0] && ids1.Count == 0 && + _GameData.PlayerTeam2.Count < _GameData.NumFields + _GameData.NumJokerRetry[1] && ids2.Count == 0) + { + if (ids1.Count == 0) + { + for (int i = 0; i < _GameData.NumPlayerTeam1; i++) + ids1.Add(i); + } + if (ids2.Count == 0) + { + for (int i = 0; i < _GameData.NumPlayerTeam2; i++) + ids2.Add(i); + } + int num; + int random; + if (_GameData.PlayerTeam1.Count < _GameData.NumFields + _GameData.NumJokerRetry[0]) + { + random = CBase.Game.GetRandom((ids1.Count - 1) * 10); + num = (int)Math.Round((double)random / 10); + if (num >= ids1.Count) + num = ids1.Count - 1; + _GameData.PlayerTeam1.Add(ids1[num]); + ids1.RemoveAt(num); + } + if (_GameData.PlayerTeam2.Count < _GameData.NumFields + _GameData.NumJokerRetry[1]) + { + random = CBase.Game.GetRandom((ids2.Count - 1) * 20); + num = (int)Math.Round((double)random / 20); + if (num >= ids2.Count) + num = ids2.Count - 1; + _GameData.PlayerTeam2.Add(ids2[num]); + ids2.RemoveAt(num); + } + } } - if (iDs2.Count == 0) + break; + case 1: { - for (int i = 0; i < _GameData.NumPlayerTeam2; i++) - iDs2.Add(i); + //Prepare Player-IDs + List iDs = new List(); + //Add IDs to team-list + while (_GameData.PlayerTeam1.Count < _GameData.NumFields + _GameData.NumJokerRetry[0] && iDs.Count == 0) + { + if (iDs.Count == 0) + { + for (int i = 0; i < _GameData.NumPlayerTeam1; i++) + iDs.Add(i); + } + if (_GameData.PlayerTeam1.Count < _GameData.NumFields + _GameData.NumJokerRetry[0]) + { + int random = CBase.Game.GetRandom((iDs.Count - 1) * 10); + int num = (int)Math.Round((double)random / 10); + if (num >= iDs.Count) + num = iDs.Count - 1; + _GameData.PlayerTeam1.Add(iDs[num]); + iDs.RemoveAt(num); + } + } } - if (_GameData.PlayerTeam1.Count < _GameData.NumFields + _GameData.NumJokerRetry[0]) + break; + case 2: { - random = CBase.Game.GetRandom((iDs1.Count - 1) * 10); - num = (int)Math.Round((double)random / 10); - if (num >= iDs1.Count) - num = iDs1.Count - 1; - _GameData.PlayerTeam1.Add(iDs1[num]); - iDs1.RemoveAt(num); + //Prepare Player-IDs + List ids = new List(); + //Add IDs to team-list + while (_GameData.PlayerTeam2.Count < _GameData.NumFields + _GameData.NumJokerRetry[1] && ids.Count == 0) + { + if (ids.Count == 0) + { + for (int i = 0; i < _GameData.NumPlayerTeam2; i++) + ids.Add(i); + } + if (_GameData.PlayerTeam2.Count < _GameData.NumFields + _GameData.NumJokerRetry[1]) + { + int random = CBase.Game.GetRandom((ids.Count - 1) * 20); + int num = (int)Math.Round((double)random / 20); + if (num >= ids.Count) + num = ids.Count - 1; + _GameData.PlayerTeam2.Add(ids[num]); + ids.RemoveAt(num); + } + } } - if (_GameData.PlayerTeam2.Count < _GameData.NumFields + _GameData.NumJokerRetry[1]) - { - random = CBase.Game.GetRandom((iDs2.Count - 1) * 20); - num = (int)Math.Round((double)random / 20); - if (num >= iDs2.Count) - num = iDs2.Count - 1; - _GameData.PlayerTeam2.Add(iDs2[num]); - iDs2.RemoveAt(num); - } - } - } - else if (team == 1) - { - //Prepare Player-IDs - List iDs = new List(); - int num = 0; - int random = 0; - //Add IDs to team-list - while (_GameData.PlayerTeam1.Count < _GameData.NumFields + _GameData.NumJokerRetry[0] && iDs.Count == 0) - { - if (iDs.Count == 0) - { - for (int i = 0; i < _GameData.NumPlayerTeam1; i++) - iDs.Add(i); - } - if (_GameData.PlayerTeam1.Count < _GameData.NumFields + _GameData.NumJokerRetry[0]) - { - random = CBase.Game.GetRandom((iDs.Count - 1) * 10); - num = (int)Math.Round((double)random / 10); - if (num >= iDs.Count) - num = iDs.Count - 1; - _GameData.PlayerTeam1.Add(iDs[num]); - iDs.RemoveAt(num); - } - } - } - else if (team == 2) - { - //Prepare Player-IDs - List iDs = new List(); - int num = 0; - int random = 0; - //Add IDs to team-list - while (_GameData.PlayerTeam2.Count < _GameData.NumFields + _GameData.NumJokerRetry[1] && iDs.Count == 0) - { - if (iDs.Count == 0) - { - for (int i = 0; i < _GameData.NumPlayerTeam2; i++) - iDs.Add(i); - } - if (_GameData.PlayerTeam2.Count < _GameData.NumFields + _GameData.NumJokerRetry[1]) - { - random = CBase.Game.GetRandom((iDs.Count - 1) * 20); - num = (int)Math.Round((double)random / 20); - if (num >= iDs.Count) - num = iDs.Count - 1; - _GameData.PlayerTeam2.Add(iDs[num]); - iDs.RemoveAt(num); - } - } + break; } } @@ -766,8 +772,6 @@ namespace VocaluxeLib.PartyModes.TicTacToe } SongSelected(r.SongID); } - else - return; } private void _SetNumJokers() diff --git a/PartyModes/PartyModeTicTacToe/CPartyScreenTicTacToeConfig.cs b/PartyModes/PartyModeTicTacToe/CPartyScreenTicTacToeConfig.cs index b2cf7f3f..e8a4b41a 100644 --- a/PartyModes/PartyModeTicTacToe/CPartyScreenTicTacToeConfig.cs +++ b/PartyModes/PartyModeTicTacToe/CPartyScreenTicTacToeConfig.cs @@ -70,11 +70,9 @@ namespace VocaluxeLib.PartyModes.TicTacToe public override void DataToScreen(object receivedData) { - SDataToScreenConfig config = new SDataToScreenConfig(); - try { - config = (SDataToScreenConfig)receivedData; + SDataToScreenConfig config = (SDataToScreenConfig)receivedData; _Data.ScreenConfig.NumFields = config.NumFields; _Data.ScreenConfig.NumPlayerTeam1 = config.NumPlayerTeam1; _Data.ScreenConfig.NumPlayerTeam2 = config.NumPlayerTeam2; @@ -106,10 +104,10 @@ namespace VocaluxeLib.PartyModes.TicTacToe case Keys.Enter: _UpdateSlides(); - if (Buttons[_ButtonBack].Selected) + if (_Buttons[_ButtonBack].Selected) _Back(); - if (Buttons[_ButtonNext].Selected) + if (_Buttons[_ButtonNext].Selected) _Next(); break; @@ -129,13 +127,13 @@ namespace VocaluxeLib.PartyModes.TicTacToe { base.HandleMouse(mouseEvent); - if (mouseEvent.LB && IsMouseOver(mouseEvent)) + if (mouseEvent.LB && _IsMouseOver(mouseEvent)) { _UpdateSlides(); - if (Buttons[_ButtonBack].Selected) + if (_Buttons[_ButtonBack].Selected) _Back(); - if (Buttons[_ButtonNext].Selected) + if (_Buttons[_ButtonNext].Selected) _Next(); } @@ -158,7 +156,7 @@ namespace VocaluxeLib.PartyModes.TicTacToe public override bool UpdateGame() { - Buttons[_ButtonNext].Visible = _ConfigOk; + _Buttons[_ButtonNext].Visible = _ConfigOk; return true; } @@ -171,72 +169,72 @@ namespace VocaluxeLib.PartyModes.TicTacToe private void _FillSlides() { // build num player slide (min player ... max player); - SelectSlides[_SelectSlideNumPlayerTeam1].Clear(); + _SelectSlides[_SelectSlideNumPlayerTeam1].Clear(); for (int i = _PartyMode.GetMinPlayer() / 2; i <= _PartyMode.GetMaxPlayer() / 2; i++) - SelectSlides[_SelectSlideNumPlayerTeam1].AddValue(i.ToString()); - SelectSlides[_SelectSlideNumPlayerTeam1].Selection = _Data.ScreenConfig.NumPlayerTeam1 - (_PartyMode.GetMinPlayer() / 2); + _SelectSlides[_SelectSlideNumPlayerTeam1].AddValue(i.ToString()); + _SelectSlides[_SelectSlideNumPlayerTeam1].Selection = _Data.ScreenConfig.NumPlayerTeam1 - (_PartyMode.GetMinPlayer() / 2); - SelectSlides[_SelectSlideNumPlayerTeam2].Clear(); + _SelectSlides[_SelectSlideNumPlayerTeam2].Clear(); for (int i = _PartyMode.GetMinPlayer() / 2; i <= _PartyMode.GetMaxPlayer() / 2; i++) - SelectSlides[_SelectSlideNumPlayerTeam2].AddValue(i.ToString()); - SelectSlides[_SelectSlideNumPlayerTeam2].Selection = _Data.ScreenConfig.NumPlayerTeam2 - (_PartyMode.GetMinPlayer() / 2); + _SelectSlides[_SelectSlideNumPlayerTeam2].AddValue(i.ToString()); + _SelectSlides[_SelectSlideNumPlayerTeam2].Selection = _Data.ScreenConfig.NumPlayerTeam2 - (_PartyMode.GetMinPlayer() / 2); - SelectSlides[_SelectSlideNumFields].Clear(); - SelectSlides[_SelectSlideNumFields].AddValue("9"); - SelectSlides[_SelectSlideNumFields].AddValue("16"); - SelectSlides[_SelectSlideNumFields].AddValue("25"); + _SelectSlides[_SelectSlideNumFields].Clear(); + _SelectSlides[_SelectSlideNumFields].AddValue("9"); + _SelectSlides[_SelectSlideNumFields].AddValue("16"); + _SelectSlides[_SelectSlideNumFields].AddValue("25"); if (_Data.ScreenConfig.NumFields == 9) - SelectSlides[_SelectSlideNumFields].Selection = 0; + _SelectSlides[_SelectSlideNumFields].Selection = 0; else if (_Data.ScreenConfig.NumFields == 16) - SelectSlides[_SelectSlideNumFields].Selection = 1; + _SelectSlides[_SelectSlideNumFields].Selection = 1; else if (_Data.ScreenConfig.NumFields == 25) - SelectSlides[_SelectSlideNumFields].Selection = 2; + _SelectSlides[_SelectSlideNumFields].Selection = 2; - SelectSlides[_SelectSlideSongSource].Clear(); - SelectSlides[_SelectSlideSongSource].SetValues((int)_Data.ScreenConfig.SongSource); + _SelectSlides[_SelectSlideSongSource].Clear(); + _SelectSlides[_SelectSlideSongSource].SetValues((int)_Data.ScreenConfig.SongSource); string[] playlists = CBase.Playlist.GetPlaylistNames(); - SelectSlides[_SelectSlidePlaylist].Clear(); + _SelectSlides[_SelectSlidePlaylist].Clear(); for (int i = 0; i < playlists.Length; i++) { string value = playlists[i] + " (" + CBase.Playlist.GetPlaylistSongCount(i) + " " + CBase.Language.Translate("TR_SONGS", _PartyModeID) + ")"; - SelectSlides[_SelectSlidePlaylist].AddValue(value); + _SelectSlides[_SelectSlidePlaylist].AddValue(value); } - SelectSlides[_SelectSlidePlaylist].Selection = _Data.ScreenConfig.PlaylistID; - SelectSlides[_SelectSlidePlaylist].Visible = _Data.ScreenConfig.SongSource == ESongSource.TR_PLAYLIST; + _SelectSlides[_SelectSlidePlaylist].Selection = _Data.ScreenConfig.PlaylistID; + _SelectSlides[_SelectSlidePlaylist].Visible = _Data.ScreenConfig.SongSource == ESongSource.TR_PLAYLIST; string[] categories = new string[CBase.Songs.GetNumCategories()]; for (int i = 0; i < CBase.Songs.GetNumCategories(); i++) categories[i] = CBase.Songs.GetCategory(i).Name; - SelectSlides[_SelectSlideCategory].Clear(); + _SelectSlides[_SelectSlideCategory].Clear(); for (int i = 0; i < categories.Length; i++) { string value = categories[i] + " (" + CBase.Songs.NumSongsInCategory(i) + " " + CBase.Language.Translate("TR_SONGS", _PartyModeID) + ")"; - SelectSlides[_SelectSlideCategory].AddValue(value); + _SelectSlides[_SelectSlideCategory].AddValue(value); } - SelectSlides[_SelectSlideCategory].Selection = _Data.ScreenConfig.CategoryID; - SelectSlides[_SelectSlideCategory].Visible = _Data.ScreenConfig.SongSource == ESongSource.TR_CATEGORY; + _SelectSlides[_SelectSlideCategory].Selection = _Data.ScreenConfig.CategoryID; + _SelectSlides[_SelectSlideCategory].Visible = _Data.ScreenConfig.SongSource == ESongSource.TR_CATEGORY; - SelectSlides[_SelectSlideGameMode].Visible = true; - SelectSlides[_SelectSlideGameMode].SetValues((int)_Data.ScreenConfig.GameMode); + _SelectSlides[_SelectSlideGameMode].Visible = true; + _SelectSlides[_SelectSlideGameMode].SetValues((int)_Data.ScreenConfig.GameMode); } private void _UpdateSlides() { - _Data.ScreenConfig.NumPlayerTeam1 = SelectSlides[_SelectSlideNumPlayerTeam1].Selection + (_PartyMode.GetMinPlayer() / 2); - _Data.ScreenConfig.NumPlayerTeam2 = SelectSlides[_SelectSlideNumPlayerTeam2].Selection + (_PartyMode.GetMinPlayer() / 2); + _Data.ScreenConfig.NumPlayerTeam1 = _SelectSlides[_SelectSlideNumPlayerTeam1].Selection + (_PartyMode.GetMinPlayer() / 2); + _Data.ScreenConfig.NumPlayerTeam2 = _SelectSlides[_SelectSlideNumPlayerTeam2].Selection + (_PartyMode.GetMinPlayer() / 2); - if (SelectSlides[_SelectSlideNumFields].Selection == 0) + if (_SelectSlides[_SelectSlideNumFields].Selection == 0) _Data.ScreenConfig.NumFields = 9; - else if (SelectSlides[_SelectSlideNumFields].Selection == 1) + else if (_SelectSlides[_SelectSlideNumFields].Selection == 1) _Data.ScreenConfig.NumFields = 16; - else if (SelectSlides[_SelectSlideNumFields].Selection == 2) + else if (_SelectSlides[_SelectSlideNumFields].Selection == 2) _Data.ScreenConfig.NumFields = 25; - _Data.ScreenConfig.SongSource = (ESongSource)SelectSlides[_SelectSlideSongSource].Selection; - _Data.ScreenConfig.PlaylistID = SelectSlides[_SelectSlidePlaylist].Selection; - _Data.ScreenConfig.CategoryID = SelectSlides[_SelectSlideCategory].Selection; - _Data.ScreenConfig.GameMode = (EPartyGameMode)SelectSlides[_SelectSlideGameMode].Selection; + _Data.ScreenConfig.SongSource = (ESongSource)_SelectSlides[_SelectSlideSongSource].Selection; + _Data.ScreenConfig.PlaylistID = _SelectSlides[_SelectSlidePlaylist].Selection; + _Data.ScreenConfig.CategoryID = _SelectSlides[_SelectSlideCategory].Selection; + _Data.ScreenConfig.GameMode = (EPartyGameMode)_SelectSlides[_SelectSlideGameMode].Selection; EGameMode gm = EGameMode.TR_GAMEMODE_NORMAL; @@ -333,8 +331,8 @@ namespace VocaluxeLib.PartyModes.TicTacToe else _ConfigOk = false; } - SelectSlides[_SelectSlideCategory].Visible = _Data.ScreenConfig.SongSource == ESongSource.TR_CATEGORY; - SelectSlides[_SelectSlidePlaylist].Visible = _Data.ScreenConfig.SongSource == ESongSource.TR_PLAYLIST; + _SelectSlides[_SelectSlideCategory].Visible = _Data.ScreenConfig.SongSource == ESongSource.TR_CATEGORY; + _SelectSlides[_SelectSlidePlaylist].Visible = _Data.ScreenConfig.SongSource == ESongSource.TR_PLAYLIST; } private void _Back() diff --git a/PartyModes/PartyModeTicTacToe/CPartyScreenTicTacToeMain.cs b/PartyModes/PartyModeTicTacToe/CPartyScreenTicTacToeMain.cs index 4bf57314..fbd05c8d 100644 --- a/PartyModes/PartyModeTicTacToe/CPartyScreenTicTacToeMain.cs +++ b/PartyModes/PartyModeTicTacToe/CPartyScreenTicTacToeMain.cs @@ -122,16 +122,14 @@ namespace VocaluxeLib.PartyModes.TicTacToe base.LoadTheme(xmlPath); _CreateFields(); - Buttons[_ButtonField].Visible = false; + _Buttons[_ButtonField].Visible = false; } public override void DataToScreen(object receivedData) { - SDataToScreenMain config = new SDataToScreenMain(); - try { - config = (SDataToScreenMain)receivedData; + SDataToScreenMain config = (SDataToScreenMain)receivedData; _GameData = config; } catch (Exception e) @@ -167,11 +165,11 @@ namespace VocaluxeLib.PartyModes.TicTacToe case Keys.Enter: if (!_ExitPopupVisible) { - if (Buttons[_ButtonNextRound].Selected) + if (_Buttons[_ButtonNextRound].Selected) _NextRound(); - if (Buttons[_ButtonBack].Selected && _GameData.CurrentRoundNr == 1 && _Status != EStatus.FieldSelected) + if (_Buttons[_ButtonBack].Selected && _GameData.CurrentRoundNr == 1 && _Status != EStatus.FieldSelected) _Back(); - if (Buttons[_ButtonExit].Selected && (_GameData.CurrentRoundNr > 1 || _Status == EStatus.FieldSelected) && _Status != EStatus.None) + if (_Buttons[_ButtonExit].Selected && (_GameData.CurrentRoundNr > 1 || _Status == EStatus.FieldSelected) && _Status != EStatus.None) _ShowPopup(true); else if (_Status == EStatus.None) _EndParty(); @@ -198,21 +196,21 @@ namespace VocaluxeLib.PartyModes.TicTacToe } if (_Status == EStatus.FieldSelected) { - if (Buttons[_ButtonJokerRandomT1].Selected) + if (_Buttons[_ButtonJokerRandomT1].Selected) _UseJoker(0, 0); - if (Buttons[_ButtonJokerRandomT2].Selected) + if (_Buttons[_ButtonJokerRandomT2].Selected) _UseJoker(1, 0); - if (Buttons[_ButtonJokerRetryT1].Selected) + if (_Buttons[_ButtonJokerRetryT1].Selected) _UseJoker(0, 1); - if (Buttons[_ButtonJokerRetryT2].Selected) + if (_Buttons[_ButtonJokerRetryT2].Selected) _UseJoker(1, 1); } } else { - if (Buttons[_ButtonPopupYes].Selected) + if (_Buttons[_ButtonPopupYes].Selected) _EndParty(); - if (Buttons[_ButtonPopupNo].Selected) + if (_Buttons[_ButtonPopupNo].Selected) _ShowPopup(false); } break; @@ -225,15 +223,15 @@ namespace VocaluxeLib.PartyModes.TicTacToe { base.HandleMouse(mouseEvent); - if (mouseEvent.LB && IsMouseOver(mouseEvent)) + if (mouseEvent.LB && _IsMouseOver(mouseEvent)) { if (!_ExitPopupVisible) { - if (Buttons[_ButtonNextRound].Selected) + if (_Buttons[_ButtonNextRound].Selected) _NextRound(); - if (Buttons[_ButtonBack].Selected) + if (_Buttons[_ButtonBack].Selected) _Back(); - if (Buttons[_ButtonExit].Selected) + if (_Buttons[_ButtonExit].Selected) { if (_Status == EStatus.None) _EndParty(); @@ -263,21 +261,21 @@ namespace VocaluxeLib.PartyModes.TicTacToe } if (_Status == EStatus.FieldSelected) { - if (Buttons[_ButtonJokerRandomT1].Selected) + if (_Buttons[_ButtonJokerRandomT1].Selected) _UseJoker(0, 0); - if (Buttons[_ButtonJokerRandomT2].Selected) + if (_Buttons[_ButtonJokerRandomT2].Selected) _UseJoker(1, 0); - if (Buttons[_ButtonJokerRetryT1].Selected) + if (_Buttons[_ButtonJokerRetryT1].Selected) _UseJoker(0, 1); - if (Buttons[_ButtonJokerRetryT2].Selected) + if (_Buttons[_ButtonJokerRetryT2].Selected) _UseJoker(1, 1); } } else { - if (Buttons[_ButtonPopupYes].Selected) + if (_Buttons[_ButtonPopupYes].Selected) _EndParty(); - if (Buttons[_ButtonPopupNo].Selected) + if (_Buttons[_ButtonPopupNo].Selected) _ShowPopup(false); } } @@ -312,15 +310,15 @@ namespace VocaluxeLib.PartyModes.TicTacToe { _BuildWinnerPossibilities(); _SelectedField = -1; - Buttons[_ButtonBack].Visible = true; - Buttons[_ButtonExit].Visible = false; - SetInteractionToButton(Buttons[_ButtonBack]); + _Buttons[_ButtonBack].Visible = true; + _Buttons[_ButtonExit].Visible = false; + _SetInteractionToButton(_Buttons[_ButtonBack]); } else { - Buttons[_ButtonBack].Visible = false; - Buttons[_ButtonExit].Visible = true; - SetInteractionToButton(Buttons[_ButtonExit]); + _Buttons[_ButtonBack].Visible = false; + _Buttons[_ButtonExit].Visible = true; + _SetInteractionToButton(_Buttons[_ButtonExit]); } _Status = EStatus.FieldChoosing; @@ -332,37 +330,37 @@ namespace VocaluxeLib.PartyModes.TicTacToe if (_GameData.CurrentRoundNr <= _GameData.NumFields && winner == 0) { _UpdateTeamChoosingMessage(); - Texts[_TextNextPlayerT1].Visible = false; - Texts[_TextNextPlayerT2].Visible = false; - Texts[_TextNextPlayerNameT1].Visible = false; - Texts[_TextNextPlayerNameT2].Visible = false; - Statics[_StaticAvatarT1].Visible = false; - Statics[_StaticAvatarT2].Visible = false; - Buttons[_ButtonJokerRandomT1].Visible = false; - Buttons[_ButtonJokerRandomT2].Visible = false; - Buttons[_ButtonJokerRetryT1].Visible = false; - Buttons[_ButtonJokerRetryT2].Visible = false; - Buttons[_ButtonNextRound].Visible = false; - Texts[_TextFinishMessage].Visible = false; + _Texts[_TextNextPlayerT1].Visible = false; + _Texts[_TextNextPlayerT2].Visible = false; + _Texts[_TextNextPlayerNameT1].Visible = false; + _Texts[_TextNextPlayerNameT2].Visible = false; + _Statics[_StaticAvatarT1].Visible = false; + _Statics[_StaticAvatarT2].Visible = false; + _Buttons[_ButtonJokerRandomT1].Visible = false; + _Buttons[_ButtonJokerRandomT2].Visible = false; + _Buttons[_ButtonJokerRetryT1].Visible = false; + _Buttons[_ButtonJokerRetryT2].Visible = false; + _Buttons[_ButtonNextRound].Visible = false; + _Texts[_TextFinishMessage].Visible = false; } else { _Status = EStatus.None; - Buttons[_ButtonNextRound].Visible = false; - Texts[_TextFinishMessage].Visible = true; - Texts[_TextTeamChoosing].Visible = false; + _Buttons[_ButtonNextRound].Visible = false; + _Texts[_TextFinishMessage].Visible = true; + _Texts[_TextTeamChoosing].Visible = false; if (winner > 0) { - Texts[_TextFinishMessage].Color = CBase.Theme.GetPlayerColor(winner); - Texts[_TextFinishMessage].Text = CBase.Language.Translate("TR_SCREENMAIN_WINNER", _PartyModeID) + " " + CBase.Language.Translate("TR_TEAM", _PartyModeID) + " " + + _Texts[_TextFinishMessage].Color = CBase.Theme.GetPlayerColor(winner); + _Texts[_TextFinishMessage].Text = CBase.Language.Translate("TR_SCREENMAIN_WINNER", _PartyModeID) + " " + CBase.Language.Translate("TR_TEAM", _PartyModeID) + " " + winner; } else { - Texts[_TextFinishMessage].Color = new SColorF(1, 1, 1, 1); - Texts[_TextFinishMessage].Text = CBase.Language.Translate("TR_SCREENMAIN_NOWINNER", _PartyModeID); + _Texts[_TextFinishMessage].Color = new SColorF(1, 1, 1, 1); + _Texts[_TextFinishMessage].Text = CBase.Language.Translate("TR_SCREENMAIN_NOWINNER", _PartyModeID); } - SetInteractionToButton(Buttons[_ButtonExit]); + _SetInteractionToButton(_Buttons[_ButtonExit]); } _ShowPopup(false); @@ -391,10 +389,10 @@ namespace VocaluxeLib.PartyModes.TicTacToe for (int i = 0; i < 25; i++) { CField f = new CField(); - f.Button = GetNewButton(Buttons[_ButtonField]); + f.Button = GetNewButton(_Buttons[_ButtonField]); f.Button.Visible = false; f.Content = new CRound(); - AddButton(f.Button); + _AddButton(f.Button); _Fields.Add(f); } } @@ -448,9 +446,9 @@ namespace VocaluxeLib.PartyModes.TicTacToe for (int i = 0; i < _GameData.Rounds.Count; i++) { _Fields[i].Button.Enabled = true; - _Fields[i].Button.Texture = Buttons[_ButtonField].Texture; - _Fields[i].Button.Color = Buttons[_ButtonField].Color; - _Fields[i].Button.SelColor = Buttons[_ButtonField].SelColor; + _Fields[i].Button.Texture = _Buttons[_ButtonField].Texture; + _Fields[i].Button.Color = _Buttons[_ButtonField].Color; + _Fields[i].Button.SelColor = _Buttons[_ButtonField].SelColor; _Fields[i].Content = _GameData.Rounds[i]; if (_Fields[i].Content.Finished) { @@ -515,25 +513,25 @@ namespace VocaluxeLib.PartyModes.TicTacToe _GameData.Rounds[_SelectedField].SingerTeam2 = singerTeam2; _UpdateFieldContents(); - Texts[_TextNextPlayerT1].Visible = true; - Texts[_TextNextPlayerT2].Visible = true; - Texts[_TextNextPlayerNameT1].Visible = true; - Texts[_TextNextPlayerNameT2].Visible = true; + _Texts[_TextNextPlayerT1].Visible = true; + _Texts[_TextNextPlayerT2].Visible = true; + _Texts[_TextNextPlayerNameT1].Visible = true; + _Texts[_TextNextPlayerNameT2].Visible = true; SProfile[] profiles = CBase.Profiles.GetProfiles(); - Texts[_TextNextPlayerNameT1].Text = profiles[_GameData.ProfileIDsTeam1[_GameData.Rounds[_SelectedField].SingerTeam1]].PlayerName; - Texts[_TextNextPlayerNameT2].Text = profiles[_GameData.ProfileIDsTeam2[_GameData.Rounds[_SelectedField].SingerTeam2]].PlayerName; - Statics[_StaticAvatarT1].Visible = true; - Statics[_StaticAvatarT2].Visible = true; - Statics[_StaticAvatarT1].Texture = profiles[_GameData.ProfileIDsTeam1[_GameData.Rounds[_SelectedField].SingerTeam1]].Avatar.Texture; - Statics[_StaticAvatarT2].Texture = profiles[_GameData.ProfileIDsTeam2[_GameData.Rounds[_SelectedField].SingerTeam2]].Avatar.Texture; + _Texts[_TextNextPlayerNameT1].Text = profiles[_GameData.ProfileIDsTeam1[_GameData.Rounds[_SelectedField].SingerTeam1]].PlayerName; + _Texts[_TextNextPlayerNameT2].Text = profiles[_GameData.ProfileIDsTeam2[_GameData.Rounds[_SelectedField].SingerTeam2]].PlayerName; + _Statics[_StaticAvatarT1].Visible = true; + _Statics[_StaticAvatarT2].Visible = true; + _Statics[_StaticAvatarT1].Texture = profiles[_GameData.ProfileIDsTeam1[_GameData.Rounds[_SelectedField].SingerTeam1]].Avatar.Texture; + _Statics[_StaticAvatarT2].Texture = profiles[_GameData.ProfileIDsTeam2[_GameData.Rounds[_SelectedField].SingerTeam2]].Avatar.Texture; _UpdateJokerButtons(); - Buttons[_ButtonNextRound].Visible = true; - Buttons[_ButtonExit].Visible = true; - Buttons[_ButtonBack].Visible = false; + _Buttons[_ButtonNextRound].Visible = true; + _Buttons[_ButtonExit].Visible = true; + _Buttons[_ButtonBack].Visible = false; - SetInteractionToButton(Buttons[_ButtonNextRound]); + _SetInteractionToButton(_Buttons[_ButtonNextRound]); } private void _FieldSelectedAgain() @@ -554,25 +552,25 @@ namespace VocaluxeLib.PartyModes.TicTacToe _GameData.Rounds[_SelectedField].SingerTeam2 = _GameData.Rounds[_OldSelectedField].SingerTeam2; _UpdateFieldContents(); - Texts[_TextNextPlayerT1].Visible = true; - Texts[_TextNextPlayerT2].Visible = true; - Texts[_TextNextPlayerNameT1].Visible = true; - Texts[_TextNextPlayerNameT2].Visible = true; + _Texts[_TextNextPlayerT1].Visible = true; + _Texts[_TextNextPlayerT2].Visible = true; + _Texts[_TextNextPlayerNameT1].Visible = true; + _Texts[_TextNextPlayerNameT2].Visible = true; SProfile[] profiles = CBase.Profiles.GetProfiles(); - Texts[_TextNextPlayerNameT1].Text = profiles[_GameData.ProfileIDsTeam1[_GameData.Rounds[_SelectedField].SingerTeam1]].PlayerName; - Texts[_TextNextPlayerNameT2].Text = profiles[_GameData.ProfileIDsTeam2[_GameData.Rounds[_SelectedField].SingerTeam2]].PlayerName; - Statics[_StaticAvatarT1].Visible = true; - Statics[_StaticAvatarT2].Visible = true; - Statics[_StaticAvatarT1].Texture = profiles[_GameData.ProfileIDsTeam1[_GameData.Rounds[_SelectedField].SingerTeam1]].Avatar.Texture; - Statics[_StaticAvatarT2].Texture = profiles[_GameData.ProfileIDsTeam2[_GameData.Rounds[_SelectedField].SingerTeam2]].Avatar.Texture; + _Texts[_TextNextPlayerNameT1].Text = profiles[_GameData.ProfileIDsTeam1[_GameData.Rounds[_SelectedField].SingerTeam1]].PlayerName; + _Texts[_TextNextPlayerNameT2].Text = profiles[_GameData.ProfileIDsTeam2[_GameData.Rounds[_SelectedField].SingerTeam2]].PlayerName; + _Statics[_StaticAvatarT1].Visible = true; + _Statics[_StaticAvatarT2].Visible = true; + _Statics[_StaticAvatarT1].Texture = profiles[_GameData.ProfileIDsTeam1[_GameData.Rounds[_SelectedField].SingerTeam1]].Avatar.Texture; + _Statics[_StaticAvatarT2].Texture = profiles[_GameData.ProfileIDsTeam2[_GameData.Rounds[_SelectedField].SingerTeam2]].Avatar.Texture; _UpdateJokerButtons(); - Buttons[_ButtonNextRound].Visible = true; - Buttons[_ButtonExit].Visible = true; - Buttons[_ButtonBack].Visible = false; + _Buttons[_ButtonNextRound].Visible = true; + _Buttons[_ButtonExit].Visible = true; + _Buttons[_ButtonBack].Visible = false; - SetInteractionToButton(Buttons[_ButtonNextRound]); + _SetInteractionToButton(_Buttons[_ButtonNextRound]); } private void _UseJoker(int teamNr, int jokerNum) @@ -610,29 +608,29 @@ namespace VocaluxeLib.PartyModes.TicTacToe private void _UpdateTeamChoosingMessage() { - Texts[_TextTeamChoosing].Color = CBase.Theme.GetPlayerColor(_GameData.Team + 1); - Texts[_TextTeamChoosing].Text = CBase.Language.Translate("TR_TEAM", _PartyModeID) + " " + (_GameData.Team + 1) + "! " + + _Texts[_TextTeamChoosing].Color = CBase.Theme.GetPlayerColor(_GameData.Team + 1); + _Texts[_TextTeamChoosing].Text = CBase.Language.Translate("TR_TEAM", _PartyModeID) + " " + (_GameData.Team + 1) + "! " + CBase.Language.Translate("TR_SCREENMAIN_TEAM_CHOOSE", _PartyModeID); if (_Status == EStatus.JokerRetry || _Status == EStatus.FieldChoosing) - Texts[_TextTeamChoosing].Visible = true; + _Texts[_TextTeamChoosing].Visible = true; else - Texts[_TextTeamChoosing].Visible = false; + _Texts[_TextTeamChoosing].Visible = false; } private void _UpdateJokerButtons() { - Buttons[_ButtonJokerRandomT1].Visible = true; - Buttons[_ButtonJokerRandomT2].Visible = true; - Buttons[_ButtonJokerRandomT1].Text.Text = _GameData.NumJokerRandom[0].ToString(); - Buttons[_ButtonJokerRandomT2].Text.Text = _GameData.NumJokerRandom[1].ToString(); - Buttons[_ButtonJokerRandomT1].Enabled = _GameData.NumJokerRandom[0] > 0; - Buttons[_ButtonJokerRandomT2].Enabled = _GameData.NumJokerRandom[1] > 0; - Buttons[_ButtonJokerRetryT1].Visible = true; - Buttons[_ButtonJokerRetryT2].Visible = true; - Buttons[_ButtonJokerRetryT1].Text.Text = _GameData.NumJokerRetry[0].ToString(); - Buttons[_ButtonJokerRetryT2].Text.Text = _GameData.NumJokerRetry[1].ToString(); - Buttons[_ButtonJokerRetryT1].Enabled = _GameData.NumJokerRetry[0] > 0; - Buttons[_ButtonJokerRetryT2].Enabled = _GameData.NumJokerRetry[1] > 0; + _Buttons[_ButtonJokerRandomT1].Visible = true; + _Buttons[_ButtonJokerRandomT2].Visible = true; + _Buttons[_ButtonJokerRandomT1].Text.Text = _GameData.NumJokerRandom[0].ToString(); + _Buttons[_ButtonJokerRandomT2].Text.Text = _GameData.NumJokerRandom[1].ToString(); + _Buttons[_ButtonJokerRandomT1].Enabled = _GameData.NumJokerRandom[0] > 0; + _Buttons[_ButtonJokerRandomT2].Enabled = _GameData.NumJokerRandom[1] > 0; + _Buttons[_ButtonJokerRetryT1].Visible = true; + _Buttons[_ButtonJokerRetryT2].Visible = true; + _Buttons[_ButtonJokerRetryT1].Text.Text = _GameData.NumJokerRetry[0].ToString(); + _Buttons[_ButtonJokerRetryT2].Text.Text = _GameData.NumJokerRetry[1].ToString(); + _Buttons[_ButtonJokerRetryT1].Enabled = _GameData.NumJokerRetry[0] > 0; + _Buttons[_ButtonJokerRetryT2].Enabled = _GameData.NumJokerRetry[1] > 0; } private void _NextRound() @@ -658,13 +656,13 @@ namespace VocaluxeLib.PartyModes.TicTacToe { _ExitPopupVisible = visible; - Statics[_StaticPopupBG].Visible = _ExitPopupVisible; - Texts[_TextPopupReallyExit].Visible = _ExitPopupVisible; - Buttons[_ButtonPopupYes].Visible = _ExitPopupVisible; - Buttons[_ButtonPopupNo].Visible = _ExitPopupVisible; + _Statics[_StaticPopupBG].Visible = _ExitPopupVisible; + _Texts[_TextPopupReallyExit].Visible = _ExitPopupVisible; + _Buttons[_ButtonPopupYes].Visible = _ExitPopupVisible; + _Buttons[_ButtonPopupNo].Visible = _ExitPopupVisible; if (_ExitPopupVisible) - SetInteractionToButton(Buttons[_ButtonPopupNo]); + _SetInteractionToButton(_Buttons[_ButtonPopupNo]); } private void _Back() diff --git a/PartyModes/PartyModeTicTacToe/CPartyScreenTicTacToeNames.cs b/PartyModes/PartyModeTicTacToe/CPartyScreenTicTacToeNames.cs index e07a5248..6d5aae88 100644 --- a/PartyModes/PartyModeTicTacToe/CPartyScreenTicTacToeNames.cs +++ b/PartyModes/PartyModeTicTacToe/CPartyScreenTicTacToeNames.cs @@ -43,7 +43,6 @@ namespace VocaluxeLib.PartyModes.TicTacToe private List _PlayerDestinationButtons; //PlayerDestinationButtons-Option private const int _PlayerDestinationButtonsNumH = 10; - private const int _PlayerDestinationButtonsNumW = 2; private const int _PlayerDestinationButtonsFirstX = 58; private const int _PlayerDestinationButtonsFirstY = 380; private const int _PlayerDestinationButtonsSpaceH = 15; @@ -102,11 +101,9 @@ namespace VocaluxeLib.PartyModes.TicTacToe public override void DataToScreen(object receivedData) { - SDataToScreenNames config = new SDataToScreenNames(); - try { - config = (SDataToScreenNames)receivedData; + SDataToScreenNames config = (SDataToScreenNames)receivedData; _Data.ScreenNames.ProfileIDsTeam1 = config.ProfileIDsTeam1; _Data.ScreenNames.ProfileIDsTeam2 = config.ProfileIDsTeam2; if (_Data.ScreenNames.ProfileIDsTeam1 == null) @@ -143,16 +140,16 @@ namespace VocaluxeLib.PartyModes.TicTacToe break; case Keys.Enter: - if (Buttons[_ButtonBack].Selected) + if (_Buttons[_ButtonBack].Selected) _Back(); - if (Buttons[_ButtonNext].Selected) + if (_Buttons[_ButtonNext].Selected) _Next(); - if (Buttons[_ButtonPlayerChooseScrollUp].Selected) + if (_Buttons[_ButtonPlayerChooseScrollUp].Selected) _Scroll(-1); - if (Buttons[_ButtonPlayerChooseScrollDown].Selected) + if (_Buttons[_ButtonPlayerChooseScrollDown].Selected) _Scroll(1); if (!_OnAdd()) @@ -274,22 +271,22 @@ namespace VocaluxeLib.PartyModes.TicTacToe return true; } - if (mouseEvent.LB && IsMouseOver(mouseEvent)) + if (mouseEvent.LB && _IsMouseOver(mouseEvent)) { - if (Buttons[_ButtonBack].Selected) + if (_Buttons[_ButtonBack].Selected) _Back(); - if (Buttons[_ButtonNext].Selected) + if (_Buttons[_ButtonNext].Selected) _Next(); - if (Buttons[_ButtonPlayerChooseScrollUp].Selected) + if (_Buttons[_ButtonPlayerChooseScrollUp].Selected) _Scroll(-1); - if (Buttons[_ButtonPlayerChooseScrollDown].Selected) + if (_Buttons[_ButtonPlayerChooseScrollDown].Selected) _Scroll(1); } - if (mouseEvent.LD && IsMouseOver(mouseEvent)) + if (mouseEvent.LD && _IsMouseOver(mouseEvent)) { if (!_OnAdd()) _OnRemove(); @@ -347,13 +344,13 @@ namespace VocaluxeLib.PartyModes.TicTacToe private void _AddButtonPlayerDestination() { - Buttons[_ButtonPlayerDestination].Visible = false; + _Buttons[_ButtonPlayerDestination].Visible = false; _PlayerDestinationButtons = new List(); int row = 0; int column = 0; for (int i = 1; i <= _PartyMode.GetMaxPlayer(); i++) { - CButton b = GetNewButton(Buttons[_ButtonPlayerDestination]); + CButton b = GetNewButton(_Buttons[_ButtonPlayerDestination]); b.Rect.X = _PlayerDestinationButtonsFirstX + column * (b.Rect.W + _PlayerDestinationButtonsSpaceH); b.Rect.Y = _PlayerDestinationButtonsFirstY + row * (b.Rect.H + _PlayerDestinationButtonsSpaceW); _PlayerDestinationButtons.Add(b); @@ -365,19 +362,19 @@ namespace VocaluxeLib.PartyModes.TicTacToe } b.Visible = true; b.Enabled = false; - AddButton(b); + _AddButton(b); } } private void _AddButtonPlayerChoose() { - Buttons[_ButtonPlayerChoose].Visible = false; + _Buttons[_ButtonPlayerChoose].Visible = false; _PlayerChooseButtons = new List(); int row = 0; int column = 0; for (int i = 1; i <= _PlayerChooseButtonsNumH * _PlayerChooseButtonsNumW; i++) { - CButton b = GetNewButton(Buttons[_ButtonPlayerChoose]); + CButton b = GetNewButton(_Buttons[_ButtonPlayerChoose]); b.Rect.X = _PlayerChooseButtonsFirstX + column * (b.Rect.W + _PlayerChooseButtonsSpaceH); b.Rect.Y = _PlayerChooseButtonsFirstY + row * (b.Rect.H + _PlayerChooseButtonsSpaceW); CPlayerChooseButton pcb = new CPlayerChooseButton(); @@ -392,7 +389,7 @@ namespace VocaluxeLib.PartyModes.TicTacToe } b.Visible = true; b.Enabled = false; - AddButton(b); + _AddButton(b); } } @@ -404,8 +401,8 @@ namespace VocaluxeLib.PartyModes.TicTacToe _UpdateButtonPlayerChoose(_PlayerChooseButtonsOffset - 1); else _UpdateButtonPlayerChoose(_PlayerChooseButtonsOffset); - Buttons[_ButtonPlayerChooseScrollUp].Enabled = _PlayerChooseButtonsOffset > 0; - Buttons[_ButtonPlayerChooseScrollDown].Enabled = _PlayerChooseButtonsVisibleProfiles.Count > + _Buttons[_ButtonPlayerChooseScrollUp].Enabled = _PlayerChooseButtonsOffset > 0; + _Buttons[_ButtonPlayerChooseScrollDown].Enabled = _PlayerChooseButtonsVisibleProfiles.Count > _PlayerChooseButtons.Count + _PlayerChooseButtonsOffset * _PlayerChooseButtonsNumH; } @@ -435,10 +432,10 @@ namespace VocaluxeLib.PartyModes.TicTacToe { _PlayerChooseButtons[i].ProfileID = -1; _PlayerChooseButtons[i].Button.Text.Text = String.Empty; - _PlayerChooseButtons[i].Button.Texture = Buttons[_ButtonPlayerChoose].Texture; - _PlayerChooseButtons[i].Button.SelTexture = Buttons[_ButtonPlayerChoose].SelTexture; - _PlayerChooseButtons[i].Button.Color = Buttons[_ButtonPlayerChoose].Color; - _PlayerChooseButtons[i].Button.SelColor = Buttons[_ButtonPlayerChoose].SelColor; + _PlayerChooseButtons[i].Button.Texture = _Buttons[_ButtonPlayerChoose].Texture; + _PlayerChooseButtons[i].Button.SelTexture = _Buttons[_ButtonPlayerChoose].SelTexture; + _PlayerChooseButtons[i].Button.Color = _Buttons[_ButtonPlayerChoose].Color; + _PlayerChooseButtons[i].Button.SelColor = _Buttons[_ButtonPlayerChoose].SelColor; _PlayerChooseButtons[i].Button.Enabled = false; } } @@ -525,10 +522,10 @@ namespace VocaluxeLib.PartyModes.TicTacToe } else { - _PlayerDestinationButtons[i].Color = Buttons[_ButtonPlayerDestination].Color; - _PlayerDestinationButtons[i].SelColor = Buttons[_ButtonPlayerDestination].SelColor; - _PlayerDestinationButtons[i].Texture = Buttons[_ButtonPlayerDestination].Texture; - _PlayerDestinationButtons[i].SelTexture = Buttons[_ButtonPlayerDestination].SelTexture; + _PlayerDestinationButtons[i].Color = _Buttons[_ButtonPlayerDestination].Color; + _PlayerDestinationButtons[i].SelColor = _Buttons[_ButtonPlayerDestination].SelColor; + _PlayerDestinationButtons[i].Texture = _Buttons[_ButtonPlayerDestination].Texture; + _PlayerDestinationButtons[i].SelTexture = _Buttons[_ButtonPlayerDestination].SelTexture; _PlayerDestinationButtons[i].Text.Text = String.Empty; _PlayerDestinationButtons[i].Enabled = false; } @@ -549,10 +546,10 @@ namespace VocaluxeLib.PartyModes.TicTacToe } else { - _PlayerDestinationButtons[i + _PlayerDestinationButtonsNumH].Color = Buttons[_ButtonPlayerDestination].Color; - _PlayerDestinationButtons[i + _PlayerDestinationButtonsNumH].SelColor = Buttons[_ButtonPlayerDestination].SelColor; - _PlayerDestinationButtons[i + _PlayerDestinationButtonsNumH].Texture = Buttons[_ButtonPlayerDestination].Texture; - _PlayerDestinationButtons[i + _PlayerDestinationButtonsNumH].SelTexture = Buttons[_ButtonPlayerDestination].SelTexture; + _PlayerDestinationButtons[i + _PlayerDestinationButtonsNumH].Color = _Buttons[_ButtonPlayerDestination].Color; + _PlayerDestinationButtons[i + _PlayerDestinationButtonsNumH].SelColor = _Buttons[_ButtonPlayerDestination].SelColor; + _PlayerDestinationButtons[i + _PlayerDestinationButtonsNumH].Texture = _Buttons[_ButtonPlayerDestination].Texture; + _PlayerDestinationButtons[i + _PlayerDestinationButtonsNumH].SelTexture = _Buttons[_ButtonPlayerDestination].SelTexture; _PlayerDestinationButtons[i + _PlayerDestinationButtonsNumH].Text.Text = String.Empty; _PlayerDestinationButtons[i + _PlayerDestinationButtonsNumH].Enabled = false; } @@ -563,11 +560,11 @@ namespace VocaluxeLib.PartyModes.TicTacToe { if (_Data.ScreenNames.ProfileIDsTeam1.Count == _NumPlayerTeam1 && _Data.ScreenNames.ProfileIDsTeam2.Count == _NumPlayerTeam2) { - Buttons[_ButtonNext].Visible = true; - SetInteractionToButton(Buttons[_ButtonNext]); + _Buttons[_ButtonNext].Visible = true; + _SetInteractionToButton(_Buttons[_ButtonNext]); } else - Buttons[_ButtonNext].Visible = false; + _Buttons[_ButtonNext].Visible = false; } private bool _OnAdd() @@ -590,7 +587,7 @@ namespace VocaluxeLib.PartyModes.TicTacToe _PlayerDestinationButtons[added].Enabled = true; //Update Tiles-List _UpdateButtonPlayerChoose(); - CheckInteraction(); + _CheckInteraction(); return true; } else if (_Data.ScreenNames.ProfileIDsTeam2.Count < _NumPlayerTeam2) @@ -607,7 +604,7 @@ namespace VocaluxeLib.PartyModes.TicTacToe _PlayerDestinationButtons[added].Enabled = true; //Update Tiles-List _UpdateButtonPlayerChoose(); - CheckInteraction(); + _CheckInteraction(); return true; } } @@ -627,7 +624,7 @@ namespace VocaluxeLib.PartyModes.TicTacToe _UpdateButtonNext(); _UpdateButtonPlayerDestination(); _UpdateButtonPlayerChoose(); - CheckInteraction(); + _CheckInteraction(); return true; } } @@ -642,7 +639,7 @@ namespace VocaluxeLib.PartyModes.TicTacToe _UpdateButtonNext(); _UpdateButtonPlayerDestination(); _UpdateButtonPlayerChoose(); - CheckInteraction(); + _CheckInteraction(); return true; } } diff --git a/Vocaluxe/Base/CBackgroundMusic.cs b/Vocaluxe/Base/CBackgroundMusic.cs index d8a6239a..e5eeff57 100644 --- a/Vocaluxe/Base/CBackgroundMusic.cs +++ b/Vocaluxe/Base/CBackgroundMusic.cs @@ -460,7 +460,6 @@ namespace Vocaluxe.Base CVideo.VdClose(_Video); CDraw.RemoveTexture(ref _CurrentVideoTexture); _Video = -1; - return; } } else @@ -471,8 +470,8 @@ namespace Vocaluxe.Base { if (_Video != -1) { - float vtime = 0f; - CVideo.VdGetFrame(_Video, ref _CurrentVideoTexture, CSound.GetPosition(_CurrentMusicStream), ref vtime); + float vtime; + CVideo.VdGetFrame(_Video, ref _CurrentVideoTexture, CSound.GetPosition(_CurrentMusicStream), out vtime); if (_FadeTimer.ElapsedMilliseconds <= 3000L) _CurrentVideoTexture.Color.A = _FadeTimer.ElapsedMilliseconds / 3000f; else diff --git a/Vocaluxe/Base/CConfig.cs b/Vocaluxe/Base/CConfig.cs index dff34be2..fa60513a 100644 --- a/Vocaluxe/Base/CConfig.cs +++ b/Vocaluxe/Base/CConfig.cs @@ -52,7 +52,7 @@ namespace Vocaluxe.Base public static int ScreenH = 576; public static EAntiAliasingModes AAMode = EAntiAliasingModes.X0; - public static EColorDeep Colors = EColorDeep.Bit32; + public static EColorDepth ColorDepth = EColorDepth.Bit32; public static EOffOn VSync = EOffOn.TR_CONFIG_ON; public static EOffOn FullScreen = EOffOn.TR_CONFIG_ON; @@ -152,7 +152,7 @@ namespace Vocaluxe.Base xmlReader.TryGetIntValue("//root/Graphics/ScreenW", ref ScreenW); xmlReader.TryGetIntValue("//root/Graphics/ScreenH", ref ScreenH); xmlReader.TryGetEnumValue("//root/Graphics/AAMode", ref AAMode); - xmlReader.TryGetEnumValue("//root/Graphics/Colors", ref Colors); + xmlReader.TryGetEnumValue("//root/Graphics/Colors", ref ColorDepth); xmlReader.TryGetFloatValue("//root/Graphics/MaxFPS", ref MaxFPS); xmlReader.TryGetEnumValue("//root/Graphics/VSync", ref VSync); xmlReader.TryGetEnumValue("//root/Graphics/FullScreen", ref FullScreen); @@ -160,9 +160,9 @@ namespace Vocaluxe.Base #endregion Graphics #region Theme - xmlReader.GetValue("//root/Theme/Name", ref Theme, Theme); - xmlReader.GetValue("//root/Theme/Skin", ref Skin, Skin); - xmlReader.GetValue("//root/Theme/Cover", ref CoverTheme, CoverTheme); + xmlReader.GetValue("//root/Theme/Name", out Theme, Theme); + xmlReader.GetValue("//root/Theme/Skin", out Skin, Skin); + xmlReader.GetValue("//root/Theme/Cover", out CoverTheme, CoverTheme); xmlReader.TryGetEnumValue("//root/Theme/DrawNoteLines", ref DrawNoteLines); xmlReader.TryGetEnumValue("//root/Theme/DrawToneHelper", ref DrawToneHelper); xmlReader.TryGetEnumValue("//root/Theme/TimerLook", ref TimerLook); @@ -191,7 +191,7 @@ namespace Vocaluxe.Base // Songfolder string value = string.Empty; int i = 1; - while (xmlReader.GetValue("//root/Game/SongFolder" + i.ToString(), ref value, value)) + while (xmlReader.GetValue("//root/Game/SongFolder" + i, out value, value)) { if (i == 1) SongFolder.Clear(); @@ -208,7 +208,7 @@ namespace Vocaluxe.Base xmlReader.TryGetEnumValue("//root/Game/TimerMode", ref TimerMode); xmlReader.TryGetIntValue("//root/Game/NumPlayer", ref NumPlayer); xmlReader.TryGetEnumValue("//root/Game/Tabs", ref Tabs); - xmlReader.GetValue("//root/Game/Language", ref Language, Language); + xmlReader.GetValue("//root/Game/Language", out Language, Language); xmlReader.TryGetEnumValue("//root/Game/LyricsOnTop", ref LyricsOnTop); xmlReader.TryGetFloatValue("//root/Game/MinLineBreakTime", ref MinLineBreakTime); @@ -229,7 +229,7 @@ namespace Vocaluxe.Base //Read players from config for (i = 1; i <= CSettings.MaxNumPlayer; i++) - xmlReader.GetValue("//root/Game/Players/Player" + i.ToString(), ref Players[i - 1], string.Empty); + xmlReader.GetValue("//root/Game/Players/Player" + i, out Players[i - 1], string.Empty); #endregion Game #region Video @@ -241,7 +241,7 @@ namespace Vocaluxe.Base xmlReader.TryGetEnumValue("//root/Video/WebcamLib", ref WebcamLib); WebcamConfig = new SWebcamConfig(); - xmlReader.GetValue("//root/Video/WebcamConfig/MonikerString", ref WebcamConfig.MonikerString, String.Empty); + xmlReader.GetValue("//root/Video/WebcamConfig/MonikerString", out WebcamConfig.MonikerString, String.Empty); xmlReader.TryGetIntValue("//root/Video/WebcamConfig/Framerate", ref WebcamConfig.Framerate); xmlReader.TryGetIntValue("//root/Video/WebcamConfig/Width", ref WebcamConfig.Width); xmlReader.TryGetIntValue("//root/Video/WebcamConfig/Height", ref WebcamConfig.Height); @@ -252,10 +252,10 @@ namespace Vocaluxe.Base for (int p = 1; p <= CSettings.MaxNumPlayer; p++) { MicConfig[p - 1] = new SMicConfig(0); - xmlReader.GetValue("//root/Record/MicConfig" + p.ToString() + "/DeviceName", ref MicConfig[p - 1].DeviceName, String.Empty); - xmlReader.GetValue("//root/Record/MicConfig" + p.ToString() + "/DeviceDriver", ref MicConfig[p - 1].DeviceDriver, String.Empty); - xmlReader.GetValue("//root/Record/MicConfig" + p.ToString() + "/InputName", ref MicConfig[p - 1].InputName, String.Empty); - xmlReader.TryGetIntValue("//root/Record/MicConfig" + p.ToString() + "/Channel", ref MicConfig[p - 1].Channel); + xmlReader.GetValue("//root/Record/MicConfig" + p + "/DeviceName", out MicConfig[p - 1].DeviceName, String.Empty); + xmlReader.GetValue("//root/Record/MicConfig" + p + "/DeviceDriver", out MicConfig[p - 1].DeviceDriver, String.Empty); + xmlReader.GetValue("//root/Record/MicConfig" + p + "/InputName", out MicConfig[p - 1].InputName, String.Empty); + xmlReader.TryGetIntValue("//root/Record/MicConfig" + p + "/Channel", ref MicConfig[p - 1].Channel); } xmlReader.TryGetIntValueRange("//root/Record/MicDelay", ref MicDelay, 0, 500); @@ -316,8 +316,8 @@ namespace Vocaluxe.Base writer.WriteComment("AAMode: " + CHelper.ListStrings(Enum.GetNames(typeof(EAntiAliasingModes)))); writer.WriteElementString("AAMode", Enum.GetName(typeof(EAntiAliasingModes), AAMode)); - writer.WriteComment("Colors: " + CHelper.ListStrings(Enum.GetNames(typeof(EColorDeep)))); - writer.WriteElementString("Colors", Enum.GetName(typeof(EColorDeep), Colors)); + writer.WriteComment("Colors: " + CHelper.ListStrings(Enum.GetNames(typeof(EColorDepth)))); + writer.WriteElementString("Colors", Enum.GetName(typeof(EColorDepth), ColorDepth)); writer.WriteComment("MaxFPS should be between 1..200"); writer.WriteElementString("MaxFPS", MaxFPS.ToString("#")); @@ -421,14 +421,14 @@ namespace Vocaluxe.Base //Write "old" song-folders to config. writer.WriteComment("SongFolder: SongFolder1, SongFolder2, SongFolder3, ..."); for (int i = 0; i < _SongFolderOld.Count; i++) - writer.WriteElementString("SongFolder" + (i + 1).ToString(), _SongFolderOld[i]); + writer.WriteElementString("SongFolder" + (i + 1), _SongFolderOld[i]); } else { //Write "normal" song-folders to config. writer.WriteComment("SongFolder: SongFolder1, SongFolder2, SongFolder3, ..."); for (int i = 0; i < SongFolder.Count; i++) - writer.WriteElementString("SongFolder" + (i + 1).ToString(), SongFolder[i]); + writer.WriteElementString("SongFolder" + (i + 1), SongFolder[i]); } writer.WriteComment("SongMenu: " + CHelper.ListStrings(Enum.GetNames(typeof(ESongMenu)))); @@ -446,7 +446,7 @@ namespace Vocaluxe.Base writer.WriteComment("TimerMode: " + CHelper.ListStrings(Enum.GetNames(typeof(ETimerMode)))); writer.WriteElementString("TimerMode", Enum.GetName(typeof(ETimerMode), TimerMode)); - writer.WriteComment("NumPlayer: 1.." + CSettings.MaxNumPlayer.ToString()); + writer.WriteComment("NumPlayer: 1.." + CSettings.MaxNumPlayer); writer.WriteElementString("NumPlayer", NumPlayer.ToString()); writer.WriteComment("Order songs in tabs: " + CHelper.ListStrings(Enum.GetNames(typeof(EOffOn)))); @@ -458,10 +458,10 @@ namespace Vocaluxe.Base writer.WriteComment("MinLineBreakTime: Value >= 0 in s. Minimum time the text is shown before it is to be sung"); writer.WriteElementString("MinLineBreakTime", MinLineBreakTime.ToString()); - writer.WriteComment("Default profile for players 1..." + CSettings.MaxNumPlayer.ToString() + ":"); + writer.WriteComment("Default profile for players 1..." + CSettings.MaxNumPlayer + ":"); writer.WriteStartElement("Players"); for (int i = 1; i <= CSettings.MaxNumPlayer; i++) - writer.WriteElementString("Player" + i.ToString(), Path.GetFileName(Players[i - 1])); + writer.WriteElementString("Player" + i, Path.GetFileName(Players[i - 1])); writer.WriteEndElement(); writer.WriteEndElement(); @@ -507,7 +507,7 @@ namespace Vocaluxe.Base { if (MicConfig[p - 1].DeviceName.Length > 0 && MicConfig[p - 1].InputName.Length > 0 && MicConfig[p - 1].Channel > 0) { - writer.WriteStartElement("MicConfig" + p.ToString()); + writer.WriteStartElement("MicConfig" + p); writer.WriteElementString("DeviceName", MicConfig[p - 1].DeviceName); writer.WriteElementString("DeviceDriver", MicConfig[p - 1].DeviceDriver); diff --git a/Vocaluxe/Base/CCover.cs b/Vocaluxe/Base/CCover.cs index e06c35da..f508e73f 100644 --- a/Vocaluxe/Base/CCover.cs +++ b/Vocaluxe/Base/CCover.cs @@ -20,6 +20,7 @@ using System; using System.Collections.Generic; using System.IO; +using System.Linq; using System.Text; using System.Xml; using VocaluxeLib.Menu; @@ -116,18 +117,12 @@ namespace Vocaluxe.Base /// /// Returns true if a cover with the given name exists. /// - public static bool CoverExists(string name) + private static bool _CoverExists(string name) { - STexture cov = _NoCover; lock (_MutexCover) { - foreach (SCover cover in _Cover) - { - if (cover.Name == name) - return true; - } + return _Cover.Any(cover => cover.Name == name); } - return false; } /// @@ -168,7 +163,7 @@ namespace Vocaluxe.Base { _CoverThemes.Clear(); - string path = CSettings.FolderCover; + const string path = CSettings.FolderCover; List files = CHelper.ListFiles(path, "*.xml", false); foreach (string file in files) @@ -179,8 +174,8 @@ namespace Vocaluxe.Base { SCoverTheme coverTheme = new SCoverTheme(); - xmlReader.GetValue("//root/Info/Name", ref coverTheme.Name, String.Empty); - xmlReader.GetValue("//root/Info/Folder", ref coverTheme.Folder, String.Empty); + xmlReader.GetValue("//root/Info/Name", out coverTheme.Name, String.Empty); + xmlReader.GetValue("//root/Info/Folder", out coverTheme.Folder, String.Empty); if (coverTheme.Folder.Length > 0 && coverTheme.Name.Length > 0) { @@ -197,69 +192,61 @@ namespace Vocaluxe.Base /// private static void _LoadCover(string coverThemeName) { - SCoverTheme coverTheme = new SCoverTheme(); + SCoverTheme coverTheme = _CoverTheme(coverThemeName); - coverTheme = _CoverTheme(coverThemeName); + if (coverTheme.Name == "") + return; + CXMLReader xmlReader = CXMLReader.OpenFile(Path.Combine(CSettings.FolderCover, coverTheme.File)); - if (coverTheme.Name.Length > 0) + if (xmlReader != null) { - CXMLReader xmlReader = CXMLReader.OpenFile(Path.Combine(CSettings.FolderCover, coverTheme.File)); - - if (xmlReader != null) + lock (_MutexCover) { - lock (_MutexCover) - { - _Cover.Clear(); - List cover = xmlReader.GetValues("Cover"); - for (int i = 0; i < cover.Count; i++) - { - SCover sk = new SCover(); - string name = String.Empty; - string value = String.Empty; - xmlReader.GetValue("//root/Cover/" + cover[i] + "/Name", ref name, String.Empty); - xmlReader.GetValue("//root/Cover/" + cover[i] + "/Path", ref value, String.Empty); - sk.Name = name; - sk.Value = Path.Combine(coverTheme.Folder, value); - if (File.Exists(Path.Combine(CSettings.FolderCover, Path.Combine(coverTheme.Folder, value)))) - sk.Texture = CDraw.AddTexture(Path.Combine(CSettings.FolderCover, Path.Combine(coverTheme.Folder, value))); - else - sk.Texture = _NoCover; - - _Cover.Add(sk); - - if (sk.Name == "NoCover") - _NoCover = sk.Texture; - } - } - } - - List files = new List(); - - files.AddRange(CHelper.ListFiles(Path.Combine(CSettings.FolderCover, coverTheme.Folder), "*.png", true, true)); - files.AddRange(CHelper.ListFiles(Path.Combine(CSettings.FolderCover, coverTheme.Folder), "*.jpg", true, true)); - files.AddRange(CHelper.ListFiles(Path.Combine(CSettings.FolderCover, coverTheme.Folder), "*.jpeg", true, true)); - files.AddRange(CHelper.ListFiles(Path.Combine(CSettings.FolderCover, coverTheme.Folder), "*.bmp", true, true)); - - - foreach (string file in files) - { - string name = Path.GetFileNameWithoutExtension(file); - - if (!CoverExists(name)) + _Cover.Clear(); + List cover = xmlReader.GetValues("Cover"); + foreach (string coverName in cover) { SCover sk = new SCover(); - - string value = String.Empty; - + string name; + string value; + xmlReader.GetValue("//root/Cover/" + coverName + "/Name", out name, String.Empty); + xmlReader.GetValue("//root/Cover/" + coverName + "/Path", out value, String.Empty); sk.Name = name; - sk.Value = Path.Combine(coverTheme.Folder, Path.GetFileName(file)); - - sk.Texture = CDraw.AddTexture(Path.Combine(CSettings.FolderCover, sk.Value)); + sk.Value = Path.Combine(coverTheme.Folder, value); + sk.Texture = File.Exists(Path.Combine(CSettings.FolderCover, sk.Value)) + ? CDraw.AddTexture(Path.Combine(CSettings.FolderCover, Path.Combine(coverTheme.Folder, value))) : _NoCover; _Cover.Add(sk); + + if (sk.Name == "NoCover") + _NoCover = sk.Texture; } } } + + List files = new List(); + + string path = Path.Combine(CSettings.FolderCover, coverTheme.Folder); + files.AddRange(CHelper.ListFiles(path, "*.png", true, true)); + files.AddRange(CHelper.ListFiles(path, "*.jpg", true, true)); + files.AddRange(CHelper.ListFiles(path, "*.jpeg", true, true)); + files.AddRange(CHelper.ListFiles(path, "*.bmp", true, true)); + + + foreach (string file in files) + { + string name = Path.GetFileNameWithoutExtension(file); + + if (_CoverExists(name)) + continue; +// ReSharper disable AssignNullToNotNullAttribute + SCover sk = new SCover {Name = name, Value = Path.Combine(coverTheme.Folder, Path.GetFileName(file))}; +// ReSharper restore AssignNullToNotNullAttribute + + sk.Texture = CDraw.AddTexture(Path.Combine(CSettings.FolderCover, sk.Value)); + + _Cover.Add(sk); + } } } } \ No newline at end of file diff --git a/Vocaluxe/Base/CDataBase.cs b/Vocaluxe/Base/CDataBase.cs index 555d5526..8f2e1b89 100644 --- a/Vocaluxe/Base/CDataBase.cs +++ b/Vocaluxe/Base/CDataBase.cs @@ -176,7 +176,6 @@ namespace Vocaluxe.Base if (reader != null) { reader.Dispose(); - reader = null; } command.CommandText = "INSERT INTO Scores (SongID, PlayerName, Score, LineNr, Date, Medley, Duet, ShortSong, Difficulty) " + @@ -208,7 +207,7 @@ namespace Vocaluxe.Base return lastInsertID; } - public static void LoadScore(ref List scores, SPlayer player) + public static void LoadScore(out List scores, SPlayer player) { using (SQLiteConnection connection = new SQLiteConnection()) { @@ -344,9 +343,6 @@ namespace Vocaluxe.Base } } - if (reader != null) - reader.Dispose(); - return -1; } @@ -374,7 +370,7 @@ namespace Vocaluxe.Base command.CommandText = "SELECT Artist, Title, NumPlayed FROM Songs WHERE [id] = @id"; command.Parameters.Add("@id", DbType.String, 0).Value = songID; - SQLiteDataReader reader = null; + SQLiteDataReader reader; try { reader = command.ExecuteReader(); @@ -516,11 +512,10 @@ namespace Vocaluxe.Base return false; } - SQLiteDataReader reader = null; using (SQLiteCommand command = new SQLiteCommand(connection)) { command.CommandText = "PRAGMA user_version"; - reader = command.ExecuteReader(); + SQLiteDataReader reader = command.ExecuteReader(); reader.Read(); int version = reader.GetInt32(0); @@ -636,16 +631,8 @@ namespace Vocaluxe.Base List scores = new List(); List songs = new List(); - SQLiteDataReader reader = null; command.CommandText = "SELECT id, PlayerName, Date FROM Scores"; - try - { - reader = command.ExecuteReader(); - } - catch (Exception) - { - throw; - } + SQLiteDataReader reader = command.ExecuteReader(); if (reader != null && reader.HasRows) { diff --git a/Vocaluxe/Base/CDraw.cs b/Vocaluxe/Base/CDraw.cs index 65926ca4..bc843f7f 100644 --- a/Vocaluxe/Base/CDraw.cs +++ b/Vocaluxe/Base/CDraw.cs @@ -274,7 +274,7 @@ namespace Vocaluxe.Base if (rect.Height <= 0f) return; - CHelper.SetRect(bounds, ref rect, rect.Width / rect.Height, aspect); + CHelper.SetRect(bounds, out rect, rect.Width / rect.Height, aspect); DrawTexture(texture, new SRectF(rect.X, rect.Y, rect.Width, rect.Height, staticBounds.Rect.Z), texture.Color, new SRectF(bounds.X, bounds.Y, bounds.Width, bounds.Height, 0f), false); } diff --git a/Vocaluxe/Base/CFont.cs b/Vocaluxe/Base/CFont.cs index b2b423ad..f5274c6f 100644 --- a/Vocaluxe/Base/CFont.cs +++ b/Vocaluxe/Base/CFont.cs @@ -341,37 +341,19 @@ namespace Vocaluxe.Base public static float Height { get { return _Height; } - set - { - if (value < 0f) - _Height = 0f; - else - _Height = value; + set { + _Height = value < 0f ? 0f : value; } } public static float Outline { get { return _Fonts[_CurrentFont].Outline; } - set - { - SFont font = _Fonts[_CurrentFont]; - font.Outline = value; - if (font.Outline < 0f) - font.Outline = 0f; - if (font.Outline > 1f) - font.Outline = 1f; - } } public static SColorF OutlineColor { get { return _Fonts[_CurrentFont].OutlineColor; } - set - { - SFont font = _Fonts[_CurrentFont]; - font.OutlineColor = value; - } } public static void Init() @@ -525,7 +507,7 @@ namespace Vocaluxe.Base public static void SetFont(string fontName) { - int index = -1; + int index; if (PartyModeID != -1) { @@ -595,7 +577,7 @@ namespace Vocaluxe.Base { string value = string.Empty; int i = 1; - while (xmlReader.GetValue("//root/Fonts/Font" + i.ToString() + "/Folder", ref value, value)) + while (xmlReader.GetValue("//root/Fonts/Font" + i + "/Folder", out value, value)) { SFont sf = new SFont(); sf.Folder = value; @@ -605,42 +587,42 @@ namespace Vocaluxe.Base bool ok = true; - string name = String.Empty; - ok &= xmlReader.GetValue("//root/Fonts/Font" + i.ToString() + "/Name", ref name, value); + string name; + ok &= xmlReader.GetValue("//root/Fonts/Font" + i + "/Name", out name, value); sf.Name = name; - ok &= xmlReader.GetValue("//root/Fonts/Font" + i.ToString() + "/FileNormal", ref value, value); + ok &= xmlReader.GetValue("//root/Fonts/Font" + i + "/FileNormal", out value, value); sf.FileNormal = value; value = Path.Combine(fontFolder, Path.Combine(sf.Folder, value)); CFont f = new CFont(value); sf.Normal = f; - ok &= xmlReader.GetValue("//root/Fonts/Font" + i.ToString() + "/FileItalic", ref value, value); + ok &= xmlReader.GetValue("//root/Fonts/Font" + i + "/FileItalic", out value, value); sf.FileItalic = value; value = Path.Combine(fontFolder, Path.Combine(sf.Folder, value)); f = new CFont(value); sf.Italic = f; - ok &= xmlReader.GetValue("//root/Fonts/Font" + i.ToString() + "/FileBold", ref value, value); + ok &= xmlReader.GetValue("//root/Fonts/Font" + i + "/FileBold", out value, value); sf.FileBold = value; value = Path.Combine(fontFolder, Path.Combine(sf.Folder, value)); f = new CFont(value); sf.Bold = f; - ok &= xmlReader.GetValue("//root/Fonts/Font" + i.ToString() + "/FileBoldItalic", ref value, value); + ok &= xmlReader.GetValue("//root/Fonts/Font" + i + "/FileBoldItalic", out value, value); sf.FileBoldItalic = value; value = Path.Combine(fontFolder, Path.Combine(sf.Folder, value)); f = new CFont(value); sf.BoldItalic = f; sf.Outline = 0f; - ok &= xmlReader.TryGetFloatValue("//root/Fonts/Font" + i.ToString() + "/Outline", ref sf.Outline); + ok &= xmlReader.TryGetFloatValue("//root/Fonts/Font" + i + "/Outline", ref sf.Outline); sf.OutlineColor = new SColorF(0f, 0f, 0f, 1f); - ok &= xmlReader.TryGetFloatValue("//root/Fonts/Font" + i.ToString() + "/OutlineColorR", ref sf.OutlineColor.R); - ok &= xmlReader.TryGetFloatValue("//root/Fonts/Font" + i.ToString() + "/OutlineColorG", ref sf.OutlineColor.G); - ok &= xmlReader.TryGetFloatValue("//root/Fonts/Font" + i.ToString() + "/OutlineColorB", ref sf.OutlineColor.B); - ok &= xmlReader.TryGetFloatValue("//root/Fonts/Font" + i.ToString() + "/OutlineColorA", ref sf.OutlineColor.A); + ok &= xmlReader.TryGetFloatValue("//root/Fonts/Font" + i + "/OutlineColorR", ref sf.OutlineColor.R); + ok &= xmlReader.TryGetFloatValue("//root/Fonts/Font" + i + "/OutlineColorG", ref sf.OutlineColor.G); + ok &= xmlReader.TryGetFloatValue("//root/Fonts/Font" + i + "/OutlineColorB", ref sf.OutlineColor.B); + ok &= xmlReader.TryGetFloatValue("//root/Fonts/Font" + i + "/OutlineColorA", ref sf.OutlineColor.A); if (ok) _Fonts.Add(sf); @@ -653,7 +635,7 @@ namespace Vocaluxe.Base fontTypes = "theme fonts for theme \"" + themeName + "\""; else fontTypes = "basic fonts"; - CLog.LogError("Error loading " + fontTypes + ": Error in Font" + i.ToString()); + CLog.LogError("Error loading " + fontTypes + ": Error in Font" + i); } i++; } @@ -715,7 +697,7 @@ namespace Vocaluxe.Base setStart = true; } - writer.WriteStartElement("Font" + fontNr.ToString()); + writer.WriteStartElement("Font" + fontNr); writer.WriteElementString("Name", _Fonts[index].Name); writer.WriteElementString("Folder", _Fonts[index].Folder); diff --git a/Vocaluxe/Base/CGame.cs b/Vocaluxe/Base/CGame.cs index 3a0dc567..6e83dbed 100644 --- a/Vocaluxe/Base/CGame.cs +++ b/Vocaluxe/Base/CGame.cs @@ -29,14 +29,8 @@ namespace Vocaluxe.Base static class CGame { private static IGameMode _GameMode; - private static SPlayer[] _Player; private static int _NumPlayer = CConfig.NumPlayer; - private static float _Beat; - private static int _CurrentBeat; - - private static float _MidBeatD; - private static int _CurrentBeatD; private static int _OldBeatD; private static readonly Random _Rand = new Random(); @@ -58,36 +52,21 @@ namespace Vocaluxe.Base return 0f; } - public static int CurrentBeat - { - get { return _CurrentBeat; } - } + public static int CurrentBeat { get; private set; } - public static float Beat - { - get { return _Beat; } - } + public static float Beat { get; private set; } - public static float MidBeatD - { - get { return _MidBeatD; } - } + public static float MidBeatD { get; private set; } - public static int ActBeatD - { - get { return _CurrentBeatD; } - } + public static int ActBeatD { get; private set; } - public static SPlayer[] Player - { - get { return _Player; } - } + public static SPlayer[] Player { get; private set; } public static void Init() { _GameMode = new CGameModeNormal(); _GameMode.Init(); - _Player = new SPlayer[CSettings.MaxNumPlayer]; + Player = new SPlayer[CSettings.MaxNumPlayer]; ResetPlayer(); CConfig.UsePlayers(); @@ -136,12 +115,12 @@ namespace Vocaluxe.Base public static void Start() { - _GameMode.Start(_Player); + _GameMode.Start(Player); } public static void NextRound() { - _GameMode.NextRound(_Player); + _GameMode.NextRound(Player); } public static bool IsFinished() @@ -196,63 +175,61 @@ namespace Vocaluxe.Base public static void ResetPlayer() { - for (int i = 0; i < _Player.Length; i++) + for (int i = 0; i < Player.Length; i++) { - _Player[i].Points = 0f; - _Player[i].PointsLineBonus = 0f; - _Player[i].PointsGoldenNotes = 0f; - _Player[i].LineNr = 0; - _Player[i].NoteDiff = 0; - _Player[i].SingLine = new List(); - _Player[i].CurrentLine = -1; - _Player[i].CurrentNote = -1; - _Player[i].SongID = -1; - _Player[i].Medley = false; - _Player[i].Duet = false; - _Player[i].ShortSong = false; - _Player[i].DateTicks = DateTime.Now.Ticks; - _Player[i].SongFinished = false; + Player[i].Points = 0f; + Player[i].PointsLineBonus = 0f; + Player[i].PointsGoldenNotes = 0f; + Player[i].LineNr = 0; + Player[i].NoteDiff = 0; + Player[i].SingLine = new List(); + Player[i].CurrentLine = -1; + Player[i].CurrentNote = -1; + Player[i].SongID = -1; + Player[i].Medley = false; + Player[i].Duet = false; + Player[i].ShortSong = false; + Player[i].DateTicks = DateTime.Now.Ticks; + Player[i].SongFinished = false; } _OldBeatD = -100; - _Beat = -100; - _CurrentBeat = -100; - _CurrentBeatD = -100; + Beat = -100; + CurrentBeat = -100; + ActBeatD = -100; } public static void UpdatePoints(float time) { - bool debugHit = false; - CSong song = _GameMode.GetSong(); if (song == null) return; float b = GetBeatFromTime(time, song.BPM, song.Gap); - if (b <= _Beat) + if (b <= Beat) return; - _Beat = b; - _CurrentBeat = (int)Math.Floor(_Beat); + Beat = b; + CurrentBeat = (int)Math.Floor(Beat); - _MidBeatD = -0.5f + GetBeatFromTime(time, song.BPM, song.Gap + CConfig.MicDelay / 1000f); - _CurrentBeatD = (int)Math.Floor(_MidBeatD); + MidBeatD = -0.5f + GetBeatFromTime(time, song.BPM, song.Gap + CConfig.MicDelay / 1000f); + ActBeatD = (int)Math.Floor(MidBeatD); for (int p = 0; p < _NumPlayer; p++) CSound.AnalyzeBuffer(p); - if (_OldBeatD >= _CurrentBeatD) + if (_OldBeatD >= ActBeatD) return; for (int p = 0; p < _NumPlayer; p++) { - for (int beat = _OldBeatD + 1; beat <= _CurrentBeatD; beat++) + for (int beat = _OldBeatD + 1; beat <= ActBeatD; beat++) { if ((_GameMode.GetCurrentGameMode() == EGameMode.TR_GAMEMODE_MEDLEY && song.Medley.EndBeat == beat) || (_GameMode.GetCurrentGameMode() == EGameMode.TR_GAMEMODE_SHORTSONG && song.ShortEnd == beat)) - _Player[p].SongFinished = true; + Player[p].SongFinished = true; - CLine[] lines = song.Notes.GetLines(_Player[p].LineNr).Line; + CLine[] lines = song.Notes.GetLines(Player[p].LineNr).Line; int line = -1; for (int j = 0; j < lines.Length; j++) @@ -264,125 +241,121 @@ namespace Vocaluxe.Base } } - if (line >= 0) + if (line < 0) + continue; + if (line != Player[p].CurrentLine) + Player[p].CurrentNote = -1; + + Player[p].CurrentLine = line; + + while (Player[p].SingLine.Count <= line) + Player[p].SingLine.Add(new CLine()); + + CNote[] notes = lines[line].Notes; + int note = -1; + for (int j = 0; j < notes.Length; j++) { - if (line != _Player[p].CurrentLine) - _Player[p].CurrentNote = -1; - - _Player[p].CurrentLine = line; - - while (_Player[p].SingLine.Count <= line) - _Player[p].SingLine.Add(new CLine()); - - CNote[] notes = lines[line].Notes; - int note = -1; - for (int j = 0; j < notes.Length; j++) + if (beat >= notes[j].StartBeat && beat <= notes[j].EndBeat) { - if (beat >= notes[j].StartBeat && beat <= notes[j].EndBeat) + note = j; + break; + } + } + + if (note >= 0) + { + Player[p].CurrentNote = note; + + if (line == lines.Length - 1) + { + if (note == lines[line].NoteCount - 1) { - note = j; - break; + if (notes[note].EndBeat == beat) + Player[p].SongFinished = true; } } - if (note >= 0) + if (notes[note].PointsForBeat > 0 && CSound.RecordToneValid(p)) { - _Player[p].CurrentNote = note; + int tone = notes[note].Tone; + int tonePlayer = CSound.RecordGetTone(p); - if (line == lines.Length - 1) + while (tonePlayer - tone > 6) + tonePlayer -= 12; + + while (tonePlayer - tone < -6) + tonePlayer += 12; + + Player[p].NoteDiff = Math.Abs(tone - tonePlayer); + bool hit = Player[p].NoteDiff <= (2 - (int)Player[p].Difficulty); + if (hit) { - if (note == lines[line].NoteCount - 1) + // valid + //CSound.RecordSetTone(p, Tone); + double points = (CSettings.MaxScore - CSettings.LinebonusScore) * (double)notes[note].PointsForBeat / + song.Notes.GetLines(Player[p].LineNr).Points; + if (notes[note].NoteType == ENoteType.Golden) + Player[p].PointsGoldenNotes += points; + + Player[p].Points += points; + + // update player notes (sung notes) + if (Player[p].SingLine[line].NoteCount > 0) { - if (notes[note].EndBeat == beat) - _Player[p].SongFinished = true; - } - } - - if (notes[note].PointsForBeat > 0 && (CSound.RecordToneValid(p) || debugHit)) - { - int tone = notes[note].Tone; - int tonePlayer = CSound.RecordGetTone(p); - - while (tonePlayer - tone > 6) - tonePlayer -= 12; - - while (tonePlayer - tone < -6) - tonePlayer += 12; - - if (debugHit) - tonePlayer = tone; - - _Player[p].NoteDiff = Math.Abs(tone - tonePlayer); - bool hit = _Player[p].NoteDiff <= (2 - (int)_Player[p].Difficulty); - if (hit) - { - // valid - //CSound.RecordSetTone(p, Tone); - double points = (CSettings.MaxScore - CSettings.LinebonusScore) * (double)notes[note].PointsForBeat / - song.Notes.GetLines(_Player[p].LineNr).Points; - if (notes[note].NoteType == ENoteType.Golden) - _Player[p].PointsGoldenNotes += points; - - _Player[p].Points += points; - - // update player notes (sung notes) - if (_Player[p].SingLine[line].NoteCount > 0) - { - CNote nt = _Player[p].SingLine[line].LastNote; - if (notes[note].StartBeat == beat || nt.EndBeat + 1 != beat || nt.Tone != tone || !nt.Hit) - _Player[p].SingLine[line].AddNote(new CNote(beat, 1, tone, String.Empty, true, notes[note].NoteType)); - else - _Player[p].SingLine[line].IncLastNoteLength(); - } + CNote nt = Player[p].SingLine[line].LastNote; + if (notes[note].StartBeat == beat || nt.EndBeat + 1 != beat || nt.Tone != tone || !nt.Hit) + Player[p].SingLine[line].AddNote(new CNote(beat, 1, tone, String.Empty, true, notes[note].NoteType)); else - _Player[p].SingLine[line].AddNote(new CNote(beat, 1, tone, String.Empty, true, notes[note].NoteType)); - - _Player[p].SingLine[line].LastNote.IsPerfect(notes[note]); - _Player[p].SingLine[line].IsPerfect(lines[line]); + Player[p].SingLine[line].IncLastNoteLength(); } else - { - if (_Player[p].SingLine[line].NoteCount > 0) - { - CNote nt = _Player[p].SingLine[line].LastNote; - if (nt.Tone == tonePlayer && nt.EndBeat + 1 == beat && !nt.Hit) - _Player[p].SingLine[line].IncLastNoteLength(); - else - _Player[p].SingLine[line].AddNote(new CNote(beat, 1, tonePlayer, String.Empty, false, ENoteType.Freestyle)); - } - else - _Player[p].SingLine[line].AddNote(new CNote(beat, 1, tonePlayer, String.Empty, false, ENoteType.Freestyle)); - } + Player[p].SingLine[line].AddNote(new CNote(beat, 1, tone, String.Empty, true, notes[note].NoteType)); + + Player[p].SingLine[line].LastNote.IsPerfect(notes[note]); + Player[p].SingLine[line].IsPerfect(lines[line]); } - - // Line Bonus - int numLinesWithPoints = song.Notes.GetNumLinesWithPoints(_Player[p].LineNr); - if (note == lines[line].NoteCount - 1 && numLinesWithPoints > 0) + else { - if (notes[note].EndBeat == beat && lines[line].Points > 0f) + if (Player[p].SingLine[line].NoteCount > 0) { - double factor = _Player[p].SingLine[line].Points / (double)lines[line].Points; - if (factor < 0.4) - factor = 0.0; - else if (factor > 0.9) - factor = 1.0; + CNote nt = Player[p].SingLine[line].LastNote; + if (nt.Tone == tonePlayer && nt.EndBeat + 1 == beat && !nt.Hit) + Player[p].SingLine[line].IncLastNoteLength(); else - { - factor -= 0.4; - factor *= 2; - factor *= factor; - } - - double points = CSettings.LinebonusScore * factor * 1f / numLinesWithPoints; - _Player[p].Points += points; - _Player[p].PointsLineBonus += points; + Player[p].SingLine[line].AddNote(new CNote(beat, 1, tonePlayer, String.Empty, false, ENoteType.Freestyle)); } + else + Player[p].SingLine[line].AddNote(new CNote(beat, 1, tonePlayer, String.Empty, false, ENoteType.Freestyle)); + } + } + + // Line Bonus + int numLinesWithPoints = song.Notes.GetNumLinesWithPoints(Player[p].LineNr); + if (note == lines[line].NoteCount - 1 && numLinesWithPoints > 0) + { + if (notes[note].EndBeat == beat && lines[line].Points > 0f) + { + double factor = Player[p].SingLine[line].Points / (double)lines[line].Points; + if (factor < 0.4) + factor = 0.0; + else if (factor > 0.9) + factor = 1.0; + else + { + factor -= 0.4; + factor *= 2; + factor *= factor; + } + + double points = CSettings.LinebonusScore * factor * 1f / numLinesWithPoints; + Player[p].Points += points; + Player[p].PointsLineBonus += points; } } } } } - _OldBeatD = _CurrentBeatD; + _OldBeatD = ActBeatD; } } } \ No newline at end of file diff --git a/Vocaluxe/Base/CGraphics.cs b/Vocaluxe/Base/CGraphics.cs index 626c0b02..524371ad 100644 --- a/Vocaluxe/Base/CGraphics.cs +++ b/Vocaluxe/Base/CGraphics.cs @@ -518,7 +518,7 @@ namespace Vocaluxe.Base bool resume = true; - bool eventsAvailable = false; + bool eventsAvailable; bool inputEventsAvailable = CInput.PollKeyEvent(ref inputKeyEvent); while ((eventsAvailable = keys.PollEvent(ref keyEvent)) || inputEventsAvailable) @@ -746,125 +746,49 @@ namespace Vocaluxe.Base private static void _DrawDebugInfos() { - string txt = String.Empty; + if (CConfig.DebugLevel == EDebugLevel.TR_CONFIG_OFF) + return; + + List debugOutput = new List(); + debugOutput.Add(CTime.GetFPS().ToString("FPS: 000")); + + if (CConfig.DebugLevel >= EDebugLevel.TR_CONFIG_LEVEL1) + { + debugOutput.Add(CSound.GetStreamCount().ToString(CLanguage.Translate("TR_DEBUG_AUDIO_STREAMS") + ": 00")); + debugOutput.Add(CVideo.GetNumStreams().ToString(CLanguage.Translate("TR_DEBUG_VIDEO_STREAMS") + ": 00")); + debugOutput.Add(CDraw.TextureCount().ToString(CLanguage.Translate("TR_DEBUG_TEXTURES") + ": 00000")); + long memory = GC.GetTotalMemory(false); + debugOutput.Add((memory / 1000000L).ToString(CLanguage.Translate("TR_DEBUG_MEMORY") + ": 00000 MB")); + + if (CConfig.DebugLevel >= EDebugLevel.TR_CONFIG_LEVEL2) + { + debugOutput.Add(CSound.RecordGetToneAbs(0).ToString(CLanguage.Translate("TR_DEBUG_TONE_ABS") + " P1: 00")); + debugOutput.Add(CSound.RecordGetMaxVolume(0).ToString(CLanguage.Translate("TR_DEBUG_MAX_VOLUME") + " P1: 0.000")); + debugOutput.Add(CSound.RecordGetToneAbs(1).ToString(CLanguage.Translate("TR_DEBUG_TONE_ABS") + " P2: 00")); + debugOutput.Add(CSound.RecordGetMaxVolume(1).ToString(CLanguage.Translate("TR_DEBUG_MAX_VOLUME") + " P2: 0.000")); + + if (CConfig.DebugLevel >= EDebugLevel.TR_CONFIG_LEVEL3) + { + debugOutput.Add(CSongs.NumSongsWithCoverLoaded.ToString(CLanguage.Translate("TR_DEBUG_SONGS") + ": 00000")); + + if (CConfig.DebugLevel >= EDebugLevel.TR_CONFIG_LEVEL_MAX) + { + debugOutput.Add(_Cursor.X.ToString(CLanguage.Translate("TR_DEBUG_MOUSE") + " : (0000/") + _Cursor.Y.ToString("0000)")); + } + } + } + } CFonts.Style = EStyle.Normal; CFonts.SetFont("Normal"); + CFonts.Height = 30; SColorF gray = new SColorF(1f, 1f, 1f, 0.5f); - - float dy = 0; - if (CConfig.DebugLevel >= EDebugLevel.TR_CONFIG_ONLY_FPS) + float y = 0; + foreach (var txt in debugOutput) { - txt = CTime.GetFPS().ToString("FPS: 000"); - CFonts.Height = 30f; - RectangleF rect = new RectangleF(CSettings.RenderW - CFonts.GetTextWidth(txt), dy, CFonts.GetTextWidth(txt), CFonts.GetTextHeight(txt)); - + RectangleF rect = new RectangleF(CSettings.RenderW - CFonts.GetTextWidth(txt), y, CFonts.GetTextWidth(txt), CFonts.GetTextHeight(txt)); CDraw.DrawColor(gray, new SRectF(rect.X, rect.Top, rect.Width, rect.Height, CSettings.ZNear)); CFonts.DrawText(txt, rect.X, rect.Y, CSettings.ZNear); - dy += rect.Height; - } - - if (CConfig.DebugLevel >= EDebugLevel.TR_CONFIG_LEVEL1) - { - txt = CSound.GetStreamCount().ToString(CLanguage.Translate("TR_DEBUG_AUDIO_STREAMS") + ": 00"); - - RectangleF rect = new RectangleF(CSettings.RenderW - CFonts.GetTextWidth(txt), dy, CFonts.GetTextWidth(txt), CFonts.GetTextHeight(txt)); - - CDraw.DrawColor(gray, new SRectF(rect.X, rect.Top, rect.Width, rect.Height, CSettings.ZNear)); - CFonts.DrawText(txt, rect.X, rect.Y, CSettings.ZNear); - dy += rect.Height; - } - - if (CConfig.DebugLevel >= EDebugLevel.TR_CONFIG_LEVEL1) - { - txt = CVideo.GetNumStreams().ToString(CLanguage.Translate("TR_DEBUG_VIDEO_STREAMS") + ": 00"); - - RectangleF rect = new RectangleF(CSettings.RenderW - CFonts.GetTextWidth(txt), dy, CFonts.GetTextWidth(txt), CFonts.GetTextHeight(txt)); - - CDraw.DrawColor(gray, new SRectF(rect.X, rect.Top, rect.Width, rect.Height, CSettings.ZNear)); - CFonts.DrawText(txt, rect.X, rect.Y, CSettings.ZNear); - dy += rect.Height; - } - - if (CConfig.DebugLevel >= EDebugLevel.TR_CONFIG_LEVEL1) - { - txt = CDraw.TextureCount().ToString(CLanguage.Translate("TR_DEBUG_TEXTURES") + ": 00000"); - - RectangleF rect = new RectangleF(CSettings.RenderW - CFonts.GetTextWidth(txt), dy, CFonts.GetTextWidth(txt), CFonts.GetTextHeight(txt)); - - CDraw.DrawColor(gray, new SRectF(rect.X, rect.Top, rect.Width, rect.Height, CSettings.ZNear)); - CFonts.DrawText(txt, rect.X, rect.Y, CSettings.ZNear); - dy += rect.Height; - } - - if (CConfig.DebugLevel >= EDebugLevel.TR_CONFIG_LEVEL1) - { - long memory = GC.GetTotalMemory(false); - txt = (memory / 1000000L).ToString(CLanguage.Translate("TR_DEBUG_MEMORY") + ": 00000 MB"); - - RectangleF rect = new RectangleF(CSettings.RenderW - CFonts.GetTextWidth(txt), dy, CFonts.GetTextWidth(txt), CFonts.GetTextHeight(txt)); - - CDraw.DrawColor(gray, new SRectF(rect.X, rect.Top, rect.Width, rect.Height, CSettings.ZNear)); - CFonts.DrawText(txt, rect.X, rect.Y, CSettings.ZNear); - dy += rect.Height; - } - - if (CConfig.DebugLevel >= EDebugLevel.TR_CONFIG_LEVEL2) - { - txt = CSound.RecordGetToneAbs(0).ToString(CLanguage.Translate("TR_DEBUG_TONE_ABS") + " P1: 00"); - - RectangleF rect = new RectangleF(CSettings.RenderW - CFonts.GetTextWidth(txt), dy, CFonts.GetTextWidth(txt), CFonts.GetTextHeight(txt)); - - CDraw.DrawColor(gray, new SRectF(rect.X, rect.Top, rect.Width, rect.Height, CSettings.ZNear)); - CFonts.DrawText(txt, rect.X, rect.Y, CSettings.ZNear); - dy += rect.Height; - - - txt = CSound.RecordGetMaxVolume(0).ToString(CLanguage.Translate("TR_DEBUG_MAX_VOLUME") + " P1: 0.000"); - - rect = new RectangleF(CSettings.RenderW - CFonts.GetTextWidth(txt), dy, CFonts.GetTextWidth(txt), CFonts.GetTextHeight(txt)); - - CDraw.DrawColor(gray, new SRectF(rect.X, rect.Top, rect.Width, rect.Height, CSettings.ZNear)); - CFonts.DrawText(txt, rect.X, rect.Y, CSettings.ZNear); - dy += rect.Height; - - txt = CSound.RecordGetToneAbs(1).ToString(CLanguage.Translate("TR_DEBUG_TONE_ABS") + " P2: 00"); - - rect = new RectangleF(CSettings.RenderW - CFonts.GetTextWidth(txt), dy, CFonts.GetTextWidth(txt), CFonts.GetTextHeight(txt)); - - CDraw.DrawColor(gray, new SRectF(rect.X, rect.Top, rect.Width, rect.Height, CSettings.ZNear)); - CFonts.DrawText(txt, rect.X, rect.Y, CSettings.ZNear); - dy += rect.Height; - - - txt = CSound.RecordGetMaxVolume(1).ToString(CLanguage.Translate("TR_DEBUG_MAX_VOLUME") + " P2: 0.000"); - - rect = new RectangleF(CSettings.RenderW - CFonts.GetTextWidth(txt), dy, CFonts.GetTextWidth(txt), CFonts.GetTextHeight(txt)); - - CDraw.DrawColor(gray, new SRectF(rect.X, rect.Top, rect.Width, rect.Height, CSettings.ZNear)); - CFonts.DrawText(txt, rect.X, rect.Y, CSettings.ZNear); - dy += rect.Height; - } - - if (CConfig.DebugLevel >= EDebugLevel.TR_CONFIG_LEVEL3) - { - txt = CSongs.NumSongsWithCoverLoaded.ToString(CLanguage.Translate("TR_DEBUG_SONGS") + ": 00000"); - - RectangleF rect = new RectangleF(CSettings.RenderW - CFonts.GetTextWidth(txt), dy, CFonts.GetTextWidth(txt), CFonts.GetTextHeight(txt)); - - CDraw.DrawColor(gray, new SRectF(rect.X, rect.Top, rect.Width, rect.Height, CSettings.ZNear)); - CFonts.DrawText(txt, rect.X, rect.Y, CSettings.ZNear); - dy += rect.Height; - } - - if (CConfig.DebugLevel >= EDebugLevel.TR_CONFIG_LEVEL_MAX) - { - txt = _Cursor.X.ToString(CLanguage.Translate("TR_DEBUG_MOUSE") + " : (0000/") + _Cursor.Y.ToString("0000)"); - - RectangleF rect = new RectangleF(CSettings.RenderW - CFonts.GetTextWidth(txt), dy, CFonts.GetTextWidth(txt), CFonts.GetTextHeight(txt)); - - CDraw.DrawColor(gray, new SRectF(rect.X, rect.Top, rect.Width, rect.Height, CSettings.ZNear)); - CFonts.DrawText(txt, rect.X, rect.Y, CSettings.ZNear); - dy += rect.Height; + y += rect.Height; } } diff --git a/Vocaluxe/Base/CLanguage.cs b/Vocaluxe/Base/CLanguage.cs index 66398f17..21fa3796 100644 --- a/Vocaluxe/Base/CLanguage.cs +++ b/Vocaluxe/Base/CLanguage.cs @@ -181,24 +181,23 @@ namespace Vocaluxe.Base return true; } - private static bool _LoadLanguageEntries(CXMLReader xmlReader, ref Dictionary texts) + private static bool _LoadLanguageEntries(CXMLReader xmlReader, out Dictionary texts) { texts = new Dictionary(); List names = xmlReader.GetAttributes("resources", "name"); - string value = string.Empty; foreach (string name in names) { - if (xmlReader.GetValue("//resources/string[@name='" + name + "']", ref value, "")) + string value; + if (!xmlReader.GetValue("//resources/string[@name='" + name + "']", out value, "")) + continue; + try { - try - { - texts.Add(name, value); - } - catch (Exception e) - { - CLog.LogError("Error reading language file " + xmlReader.FileName + ": " + e.Message); - return false; - } + texts.Add(name, value); + } + catch (Exception e) + { + CLog.LogError("Error reading language file " + xmlReader.FileName + ": " + e.Message); + return false; } } return true; @@ -211,7 +210,7 @@ namespace Vocaluxe.Base return false; string value = string.Empty; - if (xmlReader.GetValue("//resources/string[@name='language']", ref value, value)) + if (xmlReader.GetValue("//resources/string[@name='language']", out value, value)) { int nr = GetLanguageNr(value); @@ -220,7 +219,7 @@ namespace Vocaluxe.Base SPartyLanguage lang = new SPartyLanguage(); lang.PartyModeID = partyModeID; - if (!_LoadLanguageEntries(xmlReader, ref lang.Texts)) + if (!_LoadLanguageEntries(xmlReader, out lang.Texts)) return false; _Languages[nr].PartyModeTexts.Add(lang); @@ -243,7 +242,7 @@ namespace Vocaluxe.Base return; string value = string.Empty; - if (xmlReader.GetValue("//resources/string[@name='language']", ref value, value)) + if (xmlReader.GetValue("//resources/string[@name='language']", out value, value)) { lang.Name = value; @@ -252,7 +251,7 @@ namespace Vocaluxe.Base lang.PartyModeTexts = new List(); - _LoadLanguageEntries(xmlReader, ref lang.Texts); + _LoadLanguageEntries(xmlReader, out lang.Texts); _Languages.Add(lang); } diff --git a/Vocaluxe/Base/CMain.cs b/Vocaluxe/Base/CMain.cs index a42589b9..4453d747 100644 --- a/Vocaluxe/Base/CMain.cs +++ b/Vocaluxe/Base/CMain.cs @@ -686,9 +686,9 @@ namespace Vocaluxe.Base return CVideo.VdSkip(videoStream, startPosition, videoGap); } - public bool GetFrame(int videoStream, ref STexture videoTexture, float time, ref float videoTime) + public bool GetFrame(int videoStream, ref STexture videoTexture, float time, out float videoTime) { - return CVideo.VdGetFrame(videoStream, ref videoTexture, time, ref videoTime); + return CVideo.VdGetFrame(videoStream, ref videoTexture, time, out videoTime); } public bool IsFinished(int videoStream) diff --git a/Vocaluxe/Base/CParty.cs b/Vocaluxe/Base/CParty.cs index 4a242d75..4961957e 100644 --- a/Vocaluxe/Base/CParty.cs +++ b/Vocaluxe/Base/CParty.cs @@ -107,7 +107,7 @@ namespace Vocaluxe.Base { if (usedKeys[i] != _NormalGameModeID) { - SPartyMode mode = new SPartyMode(); + SPartyMode mode; _PartyModes.TryGetValue(usedKeys[i], out mode); if (mode.PartyMode != null) @@ -144,7 +144,7 @@ namespace Vocaluxe.Base public static void SetPartyMode(int partyModeID) { if (!_PartyModes.TryGetValue(partyModeID, out _CurrentPartyMode)) - CLog.LogError("CParty: Can't find party mode ID: " + partyModeID.ToString()); + CLog.LogError("CParty: Can't find party mode ID: " + partyModeID); _CurrentPartyMode.PartyMode.Init(); } @@ -246,15 +246,15 @@ namespace Vocaluxe.Base bool loaded = true; loaded &= xmlReader.TryGetIntValue("//root/PartyModeSystemVersion", ref pm.PartyModeSystemVersion); - loaded &= xmlReader.GetValue("//root/Info/Name", ref pm.Name, "ERROR Name"); - loaded &= xmlReader.GetValue("//root/Info/Description", ref pm.Description, "ERROR Description"); - loaded &= xmlReader.GetValue("//root/Info/Author", ref pm.Author, "ERROR Author"); - loaded &= xmlReader.GetValue("//root/Info/Folder", ref pm.Folder, "ERROR Folder"); - loaded &= xmlReader.GetValue("//root/Info/PartyModeFile", ref pm.PartyModeFile, "ERROR PartyModeFile"); + loaded &= xmlReader.GetValue("//root/Info/Name", out pm.Name, "ERROR Name"); + loaded &= xmlReader.GetValue("//root/Info/Description", out pm.Description, "ERROR Description"); + loaded &= xmlReader.GetValue("//root/Info/Author", out pm.Author, "ERROR Author"); + loaded &= xmlReader.GetValue("//root/Info/Folder", out pm.Folder, "ERROR Folder"); + loaded &= xmlReader.GetValue("//root/Info/PartyModeFile", out pm.PartyModeFile, "ERROR PartyModeFile"); loaded &= xmlReader.GetInnerValues("PartyScreens", ref pm.ScreenFiles); loaded &= xmlReader.TryGetIntValue("//root/Info/PartyModeVersionMajor", ref pm.PartyModeVersionMajor); loaded &= xmlReader.TryGetIntValue("//root/Info/PartyModeVersionMinor", ref pm.PartyModeVersionMinor); - loaded &= xmlReader.GetValue("//root/Info/TargetAudience", ref pm.TargetAudience, "ERROR TargetAudience"); + loaded &= xmlReader.GetValue("//root/Info/TargetAudience", out pm.TargetAudience, "ERROR TargetAudience"); if (!loaded) { @@ -359,7 +359,7 @@ namespace Vocaluxe.Base using (CodeDomProvider cdp = CodeDomProvider.CreateProvider("CSharp")) { - CompilerResults compileResult = null; + CompilerResults compileResult; try { @@ -393,7 +393,7 @@ namespace Vocaluxe.Base return null; } - CMenuParty screen = null; + CMenuParty screen; try { screen = (CMenuParty)instance; diff --git a/Vocaluxe/Base/CPlaylists.cs b/Vocaluxe/Base/CPlaylists.cs index ea485cac..17cc5713 100644 --- a/Vocaluxe/Base/CPlaylists.cs +++ b/Vocaluxe/Base/CPlaylists.cs @@ -243,39 +243,37 @@ namespace Vocaluxe.Base { using (sr = new StreamReader(file, Encoding.Default, true)) { - int pos = -1; string line; while ((line = sr.ReadLine()) != null) { - pos = line.IndexOf(":"); - if (pos > 0) + int pos = line.IndexOf(":", StringComparison.Ordinal); + if (pos <= 0) + continue; + //Name or comment + if (line[0] == '#') { - //Name or comment - if (line[0] == '#') + string identifier = line.Substring(1, pos - 1).Trim(); + string value = line.Substring(pos + 1, line.Length - pos - 1).Trim(); + if (identifier.ToUpper() == "NAME") + pl.PlaylistName = value; + } + //Song + else + { + string artist = line.Substring(0, pos - 1).Trim(); + string title = line.Substring(pos + 1, line.Length - pos - 1).Trim(); + bool found = false; + for (int s = 0; s < allSongs.Length; s++) { - string identifier = line.Substring(1, pos - 1).Trim(); - string value = line.Substring(pos + 1, line.Length - pos - 1).Trim(); - if (identifier.ToUpper() == "NAME") - pl.PlaylistName = value; - } - //Song - else - { - string artist = line.Substring(0, pos - 1).Trim(); - string title = line.Substring(pos + 1, line.Length - pos - 1).Trim(); - bool found = false; - for (int s = 0; s < allSongs.Length; s++) + if (allSongs[s].Artist == artist && allSongs[s].Title == title) { - if (allSongs[s].Artist == artist && allSongs[s].Title == title) - { - pl.AddSong(allSongs[s].ID); - found = true; - break; - } + pl.AddSong(allSongs[s].ID); + found = true; + break; } - if (!found) - CLog.LogError("Can't find song '" + title + "' from '" + artist + "' in playlist file: " + file); } + if (!found) + CLog.LogError("Can't find song '" + title + "' from '" + artist + "' in playlist file: " + file); } } } diff --git a/Vocaluxe/Base/CProfiles.cs b/Vocaluxe/Base/CProfiles.cs index 68edf944..f4542639 100644 --- a/Vocaluxe/Base/CProfiles.cs +++ b/Vocaluxe/Base/CProfiles.cs @@ -362,7 +362,6 @@ namespace Vocaluxe.Base finally { writer.Close(); - writer = null; } } @@ -376,7 +375,7 @@ namespace Vocaluxe.Base return; string value = String.Empty; - if (xmlReader.GetValue("//root/Info/PlayerName", ref value, value)) + if (xmlReader.GetValue("//root/Info/PlayerName", out value, value)) { profile.PlayerName = value; @@ -384,7 +383,7 @@ namespace Vocaluxe.Base xmlReader.TryGetEnumValue("//root/Info/Difficulty", ref profile.Difficulty); profile.Avatar = new SAvatar(-1); - if (xmlReader.GetValue("//root/Info/Avatar", ref value, value)) + if (xmlReader.GetValue("//root/Info/Avatar", out value, value)) profile.Avatar = _GetAvatar(value); profile.GuestProfile = EOffOn.TR_CONFIG_OFF; diff --git a/Vocaluxe/Base/CSettings.cs b/Vocaluxe/Base/CSettings.cs index b2ffaf30..3af6bf90 100644 --- a/Vocaluxe/Base/CSettings.cs +++ b/Vocaluxe/Base/CSettings.cs @@ -64,7 +64,7 @@ namespace Vocaluxe.Base public const int ZNear = -100; public const int ZFar = 100; - public static bool IsFullScreen = false; + public static bool IsFullScreen; public static int VertexBufferElements = 10000; public const string Icon = "Vocaluxe.ico"; @@ -142,12 +142,14 @@ namespace Vocaluxe.Base public static string GetVersionText() { - string version = "v" + VersionMajor.ToString() + "." + - VersionMinor.ToString() + "." + - VersionSub.ToString() + " (" + Arch + ")"; + string version = "v" + VersionMajor + "." + + VersionMinor + "." + + VersionSub + " (" + Arch + ")"; +// ReSharper disable ConditionIsAlwaysTrueOrFalse if (VersionRevision != ERevision.Release) - version += " " + GetVersionStatus() + String.Format(" ({0:0000)}", Build); +// ReSharper restore ConditionIsAlwaysTrueOrFalse + version += " " + _GetVersionStatus() + String.Format(" ({0:0000)}", Build); return version; } @@ -162,11 +164,13 @@ namespace Vocaluxe.Base return version + " " + GetVersionText(); } - public static string GetVersionStatus() + private static string _GetVersionStatus() { - string result = String.Empty; + string result; +// ReSharper disable ConditionIsAlwaysTrueOrFalse if (VersionRevision != ERevision.Release) +// ReSharper restore ConditionIsAlwaysTrueOrFalse result = Enum.GetName(typeof(ERevision), VersionRevision); return result; diff --git a/Vocaluxe/Base/CSongSorter.cs b/Vocaluxe/Base/CSongSorter.cs index 5928cd58..1bd0fd11 100644 --- a/Vocaluxe/Base/CSongSorter.cs +++ b/Vocaluxe/Base/CSongSorter.cs @@ -124,15 +124,13 @@ namespace Vocaluxe.Base private List _CreateSortList(string fieldName) { - FieldInfo field = null; - bool isString = false; List sortList = new List(); if (fieldName.Length == 0) - CSongs.Filter.FilteredSongs.ForEach((song) => sortList.Add(new SSongPointer(song.ID, ""))); + CSongs.Filter.FilteredSongs.ForEach(song => sortList.Add(new SSongPointer(song.ID, ""))); else { - field = typeof(CSong).GetField(fieldName, BindingFlags.Instance | BindingFlags.DeclaredOnly | BindingFlags.Public); - isString = field.FieldType == typeof(string); + FieldInfo field = typeof(CSong).GetField(fieldName, BindingFlags.Instance | BindingFlags.DeclaredOnly | BindingFlags.Public); + bool isString = field.FieldType == typeof(string); if (!isString && field.FieldType != typeof(List)) throw new Exception("Unkown sort field type"); foreach (CSong song in CSongs.Filter.FilteredSongs) @@ -147,7 +145,7 @@ namespace Vocaluxe.Base sortList.Add(new SSongPointer(song.ID, "")); else { - foreach (String sortString in (List)value) + foreach (String sortString in values) sortList.Add(new SSongPointer(song.ID, sortString)); } } diff --git a/Vocaluxe/Base/CSongs.cs b/Vocaluxe/Base/CSongs.cs index d21de91a..68f46f4c 100644 --- a/Vocaluxe/Base/CSongs.cs +++ b/Vocaluxe/Base/CSongs.cs @@ -445,14 +445,10 @@ namespace Vocaluxe.Base if (!SongsLoaded || CoverLoaded) return; - if (_CoverLoaderThread == null) - { - _CoverLoaderThread = new Thread(_LoadCover); - _CoverLoaderThread.Name = "CoverLoader"; - _CoverLoaderThread.Priority = ThreadPriority.BelowNormal; - _CoverLoaderThread.IsBackground = true; - _CoverLoaderThread.Start(); - } + if (_CoverLoaderThread != null) + return; + _CoverLoaderThread = new Thread(_LoadCover) {Name = "CoverLoader", Priority = ThreadPriority.BelowNormal, IsBackground = true}; + _CoverLoaderThread.Start(); /* if (_CoverLoadTimer.ElapsedMilliseconds >= WaitTime) diff --git a/Vocaluxe/Base/CTheme.cs b/Vocaluxe/Base/CTheme.cs index e1969bfd..81fe6739 100644 --- a/Vocaluxe/Base/CTheme.cs +++ b/Vocaluxe/Base/CTheme.cs @@ -134,7 +134,7 @@ namespace Vocaluxe.Base } } - public static SCursor Cursor = new SCursor(); + public static SCursor Cursor; #endregion Vars #region Theme and Skin loading and writing @@ -166,7 +166,7 @@ namespace Vocaluxe.Base if (xmlReader == null) return false; - string value = String.Empty; + string value; // load skins/textures @@ -176,7 +176,7 @@ namespace Vocaluxe.Base { try { - xmlReader.GetValue("//root/Skins/" + name, ref value, String.Empty); + xmlReader.GetValue("//root/Skins/" + name, out value, String.Empty); SSkinElement sk = _Skins[skinIndex].SkinList[name]; sk.Value = value; sk.VideoIndex = -1; @@ -196,7 +196,7 @@ namespace Vocaluxe.Base { try { - xmlReader.GetValue("//root/Videos/" + _Skins[skinIndex].VideoList[i].Name, ref value, String.Empty); + xmlReader.GetValue("//root/Videos/" + _Skins[skinIndex].VideoList[i].Name, out value, String.Empty); SSkinElement sk = new SSkinElement(); sk.Name = _Skins[skinIndex].VideoList[i].Name; sk.Value = value; @@ -267,7 +267,7 @@ namespace Vocaluxe.Base { if (themeIndex < 0 || themeIndex >= _Themes.Count) { - CLog.LogError("Can't find Theme Index " + themeIndex.ToString()); + CLog.LogError("Can't find Theme Index " + themeIndex); return false; } @@ -425,11 +425,11 @@ namespace Vocaluxe.Base if (version == _ThemeSystemVersion) { - xmlReader.GetValue("//root/Info/Name", ref theme.Name, String.Empty); + xmlReader.GetValue("//root/Info/Name", out theme.Name, String.Empty); if (theme.Name.Length > 0) { - xmlReader.GetValue("//root/Info/Author", ref theme.Author, String.Empty); - xmlReader.GetValue("//root/Info/SkinFolder", ref theme.SkinFolder, String.Empty); + xmlReader.GetValue("//root/Info/Author", out theme.Author, String.Empty); + xmlReader.GetValue("//root/Info/SkinFolder", out theme.SkinFolder, String.Empty); xmlReader.TryGetIntValue("//root/Info/ThemeVersionMajor", ref theme.ThemeVersionMajor); xmlReader.TryGetIntValue("//root/Info/ThemeVersionMinor", ref theme.ThemeVersionMinor); theme.Path = Path.GetDirectoryName(filePath); @@ -447,7 +447,7 @@ namespace Vocaluxe.Base else msg += "the file is for newer program versions! "; - msg += "Current ThemeSystemVersion is " + _ThemeSystemVersion.ToString() + " but found " + version; + msg += "Current ThemeSystemVersion is " + _ThemeSystemVersion + " but found " + version; CLog.LogError(msg); } return true; @@ -470,7 +470,7 @@ namespace Vocaluxe.Base { if (themeIndex < 0 || themeIndex >= _Themes.Count) { - CLog.LogError("Error List Skins. Can't find Theme index: " + themeIndex.ToString()); + CLog.LogError("Error List Skins. Can't find Theme index: " + themeIndex); return; } @@ -492,10 +492,10 @@ namespace Vocaluxe.Base if (version == _SkinSystemVersion) { - xmlReader.GetValue("//root/Info/Name", ref skin.Name, String.Empty); + xmlReader.GetValue("//root/Info/Name", out skin.Name, String.Empty); if (skin.Name.Length > 0) { - xmlReader.GetValue("//root/Info/Author", ref skin.Author, String.Empty); + xmlReader.GetValue("//root/Info/Author", out skin.Author, String.Empty); xmlReader.TryGetIntValue("//root/Info/SkinVersionMajor", ref skin.SkinVersionMajor); xmlReader.TryGetIntValue("//root/Info/SkinVersionMinor", ref skin.SkinVersionMinor); @@ -534,7 +534,7 @@ namespace Vocaluxe.Base else msg += "the file is for newer program versions! "; - msg += "Current SkinSystemVersion is " + _SkinSystemVersion.ToString(); + msg += "Current SkinSystemVersion is " + _SkinSystemVersion; CLog.LogError(msg); } } @@ -635,7 +635,7 @@ namespace Vocaluxe.Base sk.VideoIndex = CVideo.VdLoad(GetVideoFilePath(sk.Name, partyModeID)); CVideo.VdSetLoop(sk.VideoIndex, true); } - CVideo.VdGetFrame(sk.VideoIndex, ref sk.Texture, time, ref time); + CVideo.VdGetFrame(sk.VideoIndex, ref sk.Texture, time, out time); _Skins[skinIndex].VideoList[i] = sk; return sk.Texture; } @@ -729,14 +729,14 @@ namespace Vocaluxe.Base float value = 0f; int i = 1; - while (xmlReader.TryGetFloatValue("//root/Colors/Player" + i.ToString() + "/R", ref value)) + while (xmlReader.TryGetFloatValue("//root/Colors/Player" + i + "/R", ref value)) { SColorF color = new SColorF(); color.R = value; - xmlReader.TryGetFloatValue("//root/Colors/Player" + i.ToString() + "/G", ref color.G); - xmlReader.TryGetFloatValue("//root/Colors/Player" + i.ToString() + "/B", ref color.B); - xmlReader.TryGetFloatValue("//root/Colors/Player" + i.ToString() + "/A", ref color.A); + xmlReader.TryGetFloatValue("//root/Colors/Player" + i + "/G", ref color.G); + xmlReader.TryGetFloatValue("//root/Colors/Player" + i + "/B", ref color.B); + xmlReader.TryGetFloatValue("//root/Colors/Player" + i + "/A", ref color.A); playerColors.Add(color); i++; @@ -766,12 +766,12 @@ namespace Vocaluxe.Base private static void _LoadCursor(CXMLReader xmlReader, int skinIndex) { string value = String.Empty; - xmlReader.GetValue("//root/Cursor/Skin", ref Cursor.SkinName, value); + xmlReader.GetValue("//root/Cursor/Skin", out Cursor.SkinName, value); xmlReader.TryGetFloatValue("//root/Cursor/W", ref Cursor.W); xmlReader.TryGetFloatValue("//root/Cursor/H", ref Cursor.H); - if (xmlReader.GetValue("//root/Cursor/Color", ref value, value)) + if (xmlReader.GetValue("//root/Cursor/Color", out value, value)) { SColorF color = GetColor(value, _Skins[skinIndex].PartyModeID); Cursor.R = color.R; @@ -799,7 +799,7 @@ namespace Vocaluxe.Base writer.WriteStartElement("Colors"); for (int i = 0; i < _Skins[skinIndex].ThemeColors.Player.Length; i++) { - writer.WriteStartElement("Player" + (i + 1).ToString()); + writer.WriteStartElement("Player" + (i + 1)); writer.WriteElementString("R", _Skins[skinIndex].ThemeColors.Player[i].R.ToString("#0.000")); writer.WriteElementString("G", _Skins[skinIndex].ThemeColors.Player[i].G.ToString("#0.000")); diff --git a/Vocaluxe/Base/CUtility.cs b/Vocaluxe/Base/CUtility.cs index 4a2f105e..8ff7f225 100644 --- a/Vocaluxe/Base/CUtility.cs +++ b/Vocaluxe/Base/CUtility.cs @@ -155,9 +155,7 @@ namespace Vocaluxe.Base { _CheckModifiers(); - bool repeat = false; - if (_Keys == e.KeyCode) - repeat = true; + bool repeat = _Keys == e.KeyCode; if (!_Timer.IsRunning || (_Timer.ElapsedMilliseconds > 75) || !repeat) { @@ -212,9 +210,6 @@ namespace Vocaluxe.Base private readonly List _EventsPool; private readonly List _CurrentPool; - private int _X; - private int _Y; - private readonly Object _CopyLock = new Object(); private bool _ModAlt; @@ -223,17 +218,7 @@ namespace Vocaluxe.Base private readonly Stopwatch _Timer; - public int X - { - get { return _X; } - } - - public int Y - { - get { return _Y; } - } - - public bool Visible = false; + public bool Visible; public CMouse() { @@ -258,8 +243,6 @@ namespace Vocaluxe.Base { _EventsPool.Add(pool); } - _X = x; - _Y = y; } private void _Del(int index) @@ -324,14 +307,11 @@ namespace Vocaluxe.Base public bool PollEvent(ref SMouseEvent mouseEvent) { - if (_CurrentPool.Count > 0) - { - mouseEvent = _CurrentPool[0]; - _Del(0); - return true; - } - else + if (_CurrentPool.Count <= 0) return false; + mouseEvent = _CurrentPool[0]; + _Del(0); + return true; } public void CopyEvents() diff --git a/Vocaluxe/Base/CVideo.cs b/Vocaluxe/Base/CVideo.cs index ee8185a8..9f7d9098 100644 --- a/Vocaluxe/Base/CVideo.cs +++ b/Vocaluxe/Base/CVideo.cs @@ -80,9 +80,9 @@ namespace Vocaluxe.Base return _VideoDecoder.GetLength(streamID); } - public static bool VdGetFrame(int streamID, ref STexture frame, float time, ref float videoTime) + public static bool VdGetFrame(int streamID, ref STexture frame, float time, out float videoTime) { - return _VideoDecoder.GetFrame(streamID, ref frame, time, ref videoTime); + return _VideoDecoder.GetFrame(streamID, ref frame, time, out videoTime); } public static bool VdSkip(int streamID, float start, float gap) @@ -178,7 +178,7 @@ namespace Vocaluxe.Base STexture tex = new STexture(-1); tex.Height = 0f; - CVideo.VdGetFrame(_VideoStream, ref tex, videoTime, ref videoTime); + CVideo.VdGetFrame(_VideoStream, ref tex, videoTime, out videoTime); if (tex.Height > 0) { @@ -188,7 +188,7 @@ namespace Vocaluxe.Base } RectangleF bounds = new RectangleF(0f, 0f, CSettings.RenderW, CSettings.RenderH); RectangleF rect = new RectangleF(0f, 0f, _VideoTexture.Width, _VideoTexture.Height); - CHelper.SetRect(bounds, ref rect, rect.Width / rect.Height, EAspect.Crop); + CHelper.SetRect(bounds, out rect, rect.Width / rect.Height, EAspect.Crop); CDraw.DrawTexture(_VideoTexture, new SRectF(rect.X, rect.Y, rect.Width, rect.Height, CSettings.ZFar / 4)); } @@ -198,8 +198,8 @@ namespace Vocaluxe.Base float videoTime = 0f; while (_VideoTexture.Index == -1 && videoTime < 1f) { - float dummy = 0f; - CVideo.VdGetFrame(_VideoStream, ref _VideoTexture, 0, ref dummy); + float dummy; + CVideo.VdGetFrame(_VideoStream, ref _VideoTexture, 0, out dummy); videoTime += 0.05f; } } diff --git a/Vocaluxe/GameModes/CGameMode.cs b/Vocaluxe/GameModes/CGameMode.cs index 6ec72aa3..e020e815 100644 --- a/Vocaluxe/GameModes/CGameMode.cs +++ b/Vocaluxe/GameModes/CGameMode.cs @@ -26,8 +26,8 @@ namespace Vocaluxe.GameModes { struct SSongQueque { - public int SongID; - public EGameMode GameMode; + public readonly int SongID; + public readonly EGameMode GameMode; public SSongQueque(int songID, EGameMode gameMode) { @@ -38,10 +38,9 @@ namespace Vocaluxe.GameModes abstract class CGameMode : IGameMode { - protected bool _Initialized = false; - protected List _SongQueque; - protected int _CurrentSong; - protected CPoints _Points; + private List _SongQueque; + private int _CurrentSong; + private CPoints _Points; #region Implementation public virtual void Init() @@ -235,7 +234,5 @@ namespace Vocaluxe.GameModes return _Points; } #endregion Implementation - - protected virtual void _SongManipulation(int songIndex) {} } } \ No newline at end of file diff --git a/Vocaluxe/GameModes/CGameModeNormal.cs b/Vocaluxe/GameModes/CGameModeNormal.cs index 4c600306..31375949 100644 --- a/Vocaluxe/GameModes/CGameModeNormal.cs +++ b/Vocaluxe/GameModes/CGameModeNormal.cs @@ -21,12 +21,5 @@ namespace Vocaluxe.GameModes { // Nomal singing class CGameModeNormal : CGameMode - { - public override void Init() - { - base.Init(); - - _Initialized = true; - } - } + {} } \ No newline at end of file diff --git a/Vocaluxe/Lib/Draw/COpenGL.cs b/Vocaluxe/Lib/Draw/COpenGL.cs index f46fa43c..4ef1bc67 100644 --- a/Vocaluxe/Lib/Draw/COpenGL.cs +++ b/Vocaluxe/Lib/Draw/COpenGL.cs @@ -21,7 +21,6 @@ using System.Drawing.Drawing2D; using System.Threading; using OpenTK; using OpenTK.Graphics; -using OpenTK.Graphics.OpenGL; using System; using System.Collections.Generic; using System.ComponentModel; @@ -89,14 +88,12 @@ namespace Vocaluxe.Lib.Draw //Check AA Mode CConfig.AAMode = (EAntiAliasingModes)_CheckAntiAliasingMode((int)CConfig.AAMode); - - ColorFormat cf = new ColorFormat(32); - GraphicsMode gm; + CConfig.ColorDepth = (EColorDepth)_CheckColorDepth((int)CConfig.ColorDepth); bool ok = false; try { - gm = new GraphicsMode(cf, 24, 0, (int)CConfig.AAMode); + GraphicsMode gm = new GraphicsMode((int)CConfig.ColorDepth, 24, 0, (int)CConfig.AAMode); _Control = new GLControl(gm, 2, 1, GraphicsContextFlags.Default); if (_Control.GraphicsMode != null) ok = true; @@ -140,127 +137,60 @@ namespace Vocaluxe.Lib.Draw #region Helpers private int _CheckAntiAliasingMode(int setValue) { - int result = 0; - GraphicsMode mode = null; - bool done = false; + int samples = 0; - while (!done && (result <= 32)) + if (setValue > 32) + setValue = 32; + + while (samples<=setValue) { + GraphicsMode mode; try { - mode = new GraphicsMode(16, 0, 0, result); + mode = new GraphicsMode(16, 0, 0, samples); } catch (Exception) { - done = true; - result /= 2; - if (result == 1) - result = 0; + break; } - if (mode != null) - { - try - { - if (mode.Samples == result) - { - if (result == 0) - result = 2; - else - result *= 2; - } - else - { - done = true; - result /= 2; - if (result == 1) - result = 0; - } - } - catch (Exception) - { - done = true; - result /= 2; - if (result == 1) - result = 0; - } - } + if (mode.Samples != samples) + break; + if (samples == 0) + samples = 2; else - { - done = true; - result /= 2; - if (result == 1) - result = 0; - } + samples *= 2; } - if (result > 64) - result = 32; - - if (setValue < result) - return setValue; - else - return result; + if (samples == 2) + return 0; + return samples / 2; } - private int _CheckColorDeep(int setValue) + private int _CheckColorDepth(int setValue) { - int result = 8; - GraphicsMode mode = null; - bool done = false; + int result = 16; - while (!done && (result <= 32)) + if (setValue > 32) + setValue = 32; + + while (result <= setValue) { + GraphicsMode mode; try { mode = new GraphicsMode(result, 0, 0, 0); } catch (Exception) { - done = true; - result -= 8; - if (result == 0) - result = 8; - } - - if (mode != null) - { - try - { - if (mode.ColorFormat == result) - result += 8; - else - { - done = true; - result -= 8; - if (result == 0) - result = 8; - } - } - catch (Exception) - { - done = true; - result -= 8; - if (result == 0) - result = 8; - } - } - else - { - done = true; - result -= 8; - if (result == 0) - result = 8; + break; } + if (mode.ColorFormat != result) + break; + result += 8; } - if (result > 32) - result = 32; - - if (setValue < result) - return setValue; - else - return result; + return result - 8; } private void _ToggleFullScreen() @@ -590,7 +520,7 @@ namespace Vocaluxe.Lib.Draw public void CopyScreen(ref STexture texture) { - if (!_TextureExists(ref texture) || (texture.Width != GetScreenWidth()) || (texture.Height != GetScreenHeight())) + if (!_TextureExists(ref texture) || Math.Abs(texture.Width - GetScreenWidth()) > 1 || Math.Abs(texture.Height - GetScreenHeight()) > 1) { RemoveTexture(ref texture); texture = CopyScreen(); @@ -608,7 +538,7 @@ namespace Vocaluxe.Lib.Draw public void MakeScreenShot() { - string file = "Screenshot_"; + const string file = "Screenshot_"; string path = Path.Combine(Environment.CurrentDirectory, CSettings.FolderScreenshots); int i = 0; @@ -678,7 +608,7 @@ namespace Vocaluxe.Lib.Draw OpenTK.Graphics.OpenGL.GL.Enable(OpenTK.Graphics.OpenGL.EnableCap.Blend); - if (rect.Rotation != 0f) + if (Math.Abs(rect.Rotation) > 0.001) { OpenTK.Graphics.OpenGL.GL.Translate(0.5f, 0.5f, 0); OpenTK.Graphics.OpenGL.GL.Rotate(-rect.Rotation, 0f, 0f, 1f); @@ -724,7 +654,7 @@ namespace Vocaluxe.Lib.Draw } try { - return AddTexture(bmp, texturePath); + return AddTexture(bmp); } finally { @@ -736,11 +666,6 @@ namespace Vocaluxe.Lib.Draw } public STexture AddTexture(Bitmap bmp) - { - return AddTexture(bmp, String.Empty); - } - - public STexture AddTexture(Bitmap bmp, string texturePath) { STexture texture = new STexture(-1); @@ -985,11 +910,8 @@ namespace Vocaluxe.Lib.Draw public STexture QuequeTexture(int w, int h, ref byte[] data) { STexture texture = new STexture(-1); - STextureQueque queque = new STextureQueque(); + STextureQueque queque = new STextureQueque {Data = data, Height = h, Width = w}; - queque.Data = data; - queque.Height = h; - queque.Width = w; texture.Height = h; texture.Width = w; @@ -1071,29 +993,21 @@ namespace Vocaluxe.Lib.Draw { if (_UsePBO) { - try - { - OpenTK.Graphics.OpenGL.GL.BindBuffer(OpenTK.Graphics.OpenGL.BufferTarget.PixelUnpackBuffer, texture.PBO); + OpenTK.Graphics.OpenGL.GL.BindBuffer(OpenTK.Graphics.OpenGL.BufferTarget.PixelUnpackBuffer, texture.PBO); - IntPtr buffer = OpenTK.Graphics.OpenGL.GL.MapBuffer(OpenTK.Graphics.OpenGL.BufferTarget.PixelUnpackBuffer, OpenTK.Graphics.OpenGL.BufferAccess.WriteOnly); - Marshal.Copy(data, 0, buffer, data.Length); + IntPtr buffer = OpenTK.Graphics.OpenGL.GL.MapBuffer(OpenTK.Graphics.OpenGL.BufferTarget.PixelUnpackBuffer, OpenTK.Graphics.OpenGL.BufferAccess.WriteOnly); + Marshal.Copy(data, 0, buffer, data.Length); - OpenTK.Graphics.OpenGL.GL.UnmapBuffer(OpenTK.Graphics.OpenGL.BufferTarget.PixelUnpackBuffer); + OpenTK.Graphics.OpenGL.GL.UnmapBuffer(OpenTK.Graphics.OpenGL.BufferTarget.PixelUnpackBuffer); - OpenTK.Graphics.OpenGL.GL.BindTexture(OpenTK.Graphics.OpenGL.TextureTarget.Texture2D, texture.ID); - OpenTK.Graphics.OpenGL.GL.TexSubImage2D(OpenTK.Graphics.OpenGL.TextureTarget.Texture2D, 0, 0, 0, (int)texture.Width, (int)texture.Height, - OpenTK.Graphics.OpenGL.PixelFormat.Bgra, OpenTK.Graphics.OpenGL.PixelType.UnsignedByte, IntPtr.Zero); + OpenTK.Graphics.OpenGL.GL.BindTexture(OpenTK.Graphics.OpenGL.TextureTarget.Texture2D, texture.ID); + OpenTK.Graphics.OpenGL.GL.TexSubImage2D(OpenTK.Graphics.OpenGL.TextureTarget.Texture2D, 0, 0, 0, (int)texture.Width, (int)texture.Height, + OpenTK.Graphics.OpenGL.PixelFormat.Bgra, OpenTK.Graphics.OpenGL.PixelType.UnsignedByte, IntPtr.Zero); - OpenTK.Graphics.OpenGL.GL.BindTexture(OpenTK.Graphics.OpenGL.TextureTarget.Texture2D, 0); - OpenTK.Graphics.OpenGL.GL.BindBuffer(OpenTK.Graphics.OpenGL.BufferTarget.PixelUnpackBuffer, 0); + OpenTK.Graphics.OpenGL.GL.BindTexture(OpenTK.Graphics.OpenGL.TextureTarget.Texture2D, 0); + OpenTK.Graphics.OpenGL.GL.BindBuffer(OpenTK.Graphics.OpenGL.BufferTarget.PixelUnpackBuffer, 0); - return true; - } - catch (Exception) - { - throw; - //_UsePBO = false; - } + return true; } OpenTK.Graphics.OpenGL.GL.BindTexture(OpenTK.Graphics.OpenGL.TextureTarget.Texture2D, texture.ID); @@ -1180,7 +1094,7 @@ namespace Vocaluxe.Lib.Draw public void DrawTexture(STexture texture, SRectF rect, SColorF color, SRectF bounds, bool mirrored) { - if (rect.W == 0f || rect.H == 0f || bounds.H == 0f || bounds.W == 0f || color.A == 0f) + if (Math.Abs(rect.W) < float.Epsilon || Math.Abs(rect.H) < float.Epsilon || Math.Abs(bounds.H) < float.Epsilon || Math.Abs(bounds.W) < float.Epsilon || Math.Abs(color.A) < float.Epsilon) return; if (bounds.X > rect.X + rect.W || bounds.X + bounds.W < rect.X) @@ -1234,7 +1148,7 @@ namespace Vocaluxe.Lib.Draw OpenTK.Graphics.OpenGL.GL.MatrixMode(OpenTK.Graphics.OpenGL.MatrixMode.Texture); OpenTK.Graphics.OpenGL.GL.PushMatrix(); - if (rect.Rotation != 0f) + if (Math.Abs(rect.Rotation) > float.Epsilon) { OpenTK.Graphics.OpenGL.GL.Translate(0.5f, 0.5f, 0); OpenTK.Graphics.OpenGL.GL.Rotate(-rect.Rotation, 0f, 0f, 1f); @@ -1319,7 +1233,7 @@ namespace Vocaluxe.Lib.Draw public void DrawTextureReflection(STexture texture, SRectF rect, SColorF color, SRectF bounds, float space, float height) { - if (rect.W == 0f || rect.H == 0f || bounds.H == 0f || bounds.W == 0f || color.A == 0f || height <= 0f) + if (Math.Abs(rect.W) < float.Epsilon || Math.Abs(rect.H) < float.Epsilon || Math.Abs(bounds.H) < float.Epsilon || Math.Abs(bounds.W) < float.Epsilon || Math.Abs(color.A) < float.Epsilon || height <= float.Epsilon) return; if (bounds.X > rect.X + rect.W || bounds.X + bounds.W < rect.X) @@ -1375,7 +1289,7 @@ namespace Vocaluxe.Lib.Draw OpenTK.Graphics.OpenGL.GL.MatrixMode(OpenTK.Graphics.OpenGL.MatrixMode.Texture); OpenTK.Graphics.OpenGL.GL.PushMatrix(); - if (rect.Rotation != 0f) + if (Math.Abs(rect.Rotation) > float.Epsilon) { OpenTK.Graphics.OpenGL.GL.Translate(0.5f, 0.5f, 0); OpenTK.Graphics.OpenGL.GL.Rotate(-rect.Rotation, 0f, 0f, 1f); diff --git a/Vocaluxe/Lib/Input/CHIDAPI.cs b/Vocaluxe/Lib/Input/CHIDAPI.cs index 4c122ea8..106994f7 100644 --- a/Vocaluxe/Lib/Input/CHIDAPI.cs +++ b/Vocaluxe/Lib/Input/CHIDAPI.cs @@ -66,7 +66,7 @@ namespace Vocaluxe.Lib.Input public static bool Init() { - int result = -1; + int result; try { result = hid_init(); @@ -77,10 +77,7 @@ namespace Vocaluxe.Lib.Input return false; } - if (result == 0) - return true; - - return false; + return result == 0; } [DllImport(_HIDApiDll, ExactSpelling = false, CallingConvention = CallingConvention.Cdecl, EntryPoint = "hid_exit", CharSet = CharSet.Unicode)] @@ -88,7 +85,7 @@ namespace Vocaluxe.Lib.Input public static bool Exit() { - int result = -1; + int result; try { result = hid_exit(); @@ -99,10 +96,7 @@ namespace Vocaluxe.Lib.Input return false; } - if (result == 0) - return true; - - return false; + return result == 0; } [DllImport(_HIDApiDll, ExactSpelling = false, CallingConvention = CallingConvention.Cdecl, EntryPoint = "hid_enumerate", CharSet = CharSet.Ansi)] @@ -169,7 +163,7 @@ namespace Vocaluxe.Lib.Input data = new byte[length]; IntPtr dataPtr = Marshal.AllocHGlobal(length); - int result = -1; + int result; try { result = hid_read_timeout(device, dataPtr, length, milliseconds); @@ -197,7 +191,7 @@ namespace Vocaluxe.Lib.Input data = new byte[length]; IntPtr dataPtr = Marshal.AllocHGlobal(length); - int result = -1; + int result; try { result = hid_read(device, dataPtr, length); diff --git a/Vocaluxe/Lib/Input/WiiMote/CWiiMote.cs b/Vocaluxe/Lib/Input/WiiMote/CWiiMote.cs index 0f8fa347..4e419c32 100644 --- a/Vocaluxe/Lib/Input/WiiMote/CWiiMote.cs +++ b/Vocaluxe/Lib/Input/WiiMote/CWiiMote.cs @@ -153,8 +153,8 @@ namespace Vocaluxe.Lib.Input.WiiMote } else { - bool startRumble = false; - bool stopRumble = false; + bool startRumble; + bool stopRumble; lock (_Sync) { startRumble = _RumbleTimer.ShouldStart; @@ -211,13 +211,6 @@ namespace Vocaluxe.Lib.Input.WiiMote Point p = ws.IRState.Position; p.X = 1023 - p.X; - //key events - bool alt = false; - bool shift = false; - bool ctrl = false; - bool pressed = false; - char unicode = char.MinValue; - EGesture gesture = _Gesture.GetGesture(p); bool lb = false; bool rb = gesture == EGesture.Back; @@ -262,9 +255,9 @@ namespace Vocaluxe.Lib.Input.WiiMote _ButtonStates[10] = ws.ButtonState.Two; - if (alt || shift || ctrl || pressed || unicode != char.MinValue || key != Keys.None) + if (key != Keys.None) { - SKeyEvent pool = new SKeyEvent(ESender.WiiMote, alt, shift, ctrl, pressed, unicode, key); + SKeyEvent pool = new SKeyEvent(ESender.WiiMote, false, false, false, false, char.MinValue, key); lock (_KeyCopyLock) { @@ -273,8 +266,8 @@ namespace Vocaluxe.Lib.Input.WiiMote } //mouse events - float reducing = 0.15f; - float factor = 1f / (1f - reducing * 2f); + const float reducing = 0.15f; + const float factor = 1f / (1f - reducing * 2f); float rx = ((p.X / 1024f) - reducing) * factor; float ry = ((p.Y / 768f) - reducing) * factor; @@ -282,11 +275,7 @@ namespace Vocaluxe.Lib.Input.WiiMote int y = (int)(ry * CSettings.RenderH); - bool ld = false; bool lbh = !lb && ws.ButtonState.A; - bool rbh = false; - bool mb = false; - bool mbh = false; int wheel = 0; if (gesture == EGesture.ScrollUp) @@ -299,12 +288,12 @@ namespace Vocaluxe.Lib.Input.WiiMote if (!lb && !rb && (p.X != _OldPosition.X || p.Y != _OldPosition.Y)) { - mpool = new SMouseEvent(ESender.WiiMote, alt, shift, ctrl, x, y, false, false, false, wheel, lbh, rbh, false, mbh); + mpool = new SMouseEvent(ESender.WiiMote, false, false, false, x, y, false, false, false, wheel, lbh, false, false, false); trigger = true; } else if (lb || rb) { - mpool = new SMouseEvent(ESender.WiiMote, alt, shift, ctrl, x, y, lb, ld, rb, wheel, false, false, mb, false); + mpool = new SMouseEvent(ESender.WiiMote, false, false, false, x, y, lb, false, rb, wheel, false, false, false, false); trigger = true; } diff --git a/Vocaluxe/Lib/Input/WiiMote/WiiMoteLib.cs b/Vocaluxe/Lib/Input/WiiMote/WiiMoteLib.cs index 1119da98..622f7f17 100644 --- a/Vocaluxe/Lib/Input/WiiMote/WiiMoteLib.cs +++ b/Vocaluxe/Lib/Input/WiiMote/WiiMoteLib.cs @@ -29,15 +29,17 @@ namespace Vocaluxe.Lib.Input.WiiMote #region DataTypes public class CWiiMoteStatus { - public SAccelCalibrationInfo AccelCalibrationInfo = new SAccelCalibrationInfo(); + public SAccelCalibrationInfo AccelCalibrationInfo; - public SAccelStatus AccelState = new SAccelStatus(); + public SAccelStatus AccelState; - public SButtons ButtonState = new SButtons(); + public SButtons ButtonState; - public SIRState IRState = new SIRState(); + public SIRState IRState; + // ReSharper disable NotAccessedField.Global public byte Battery; + // ReSharper restore NotAccessedField.Global public bool Rumble; @@ -68,7 +70,9 @@ namespace Vocaluxe.Lib.Input.WiiMote { public bool Active; public Point Position; // X: 0-1023; Y: 0-767 + // ReSharper disable NotAccessedField.Global public int Width; // 0-15 + // ReSharper restore NotAccessedField.Global } public struct SIRState @@ -82,7 +86,9 @@ namespace Vocaluxe.Lib.Input.WiiMote public struct SAccelStatus { public SPoint3 RawValues; //0-255 + // ReSharper disable NotAccessedField.Global public SPoint3F Values; //0-3 + // ReSharper restore NotAccessedField.Global } public struct SAccelCalibrationInfo @@ -124,7 +130,7 @@ namespace Vocaluxe.Lib.Input.WiiMote #region Events public class CWiiMoteChangedEventArgs : EventArgs { - public CWiiMoteStatus WiiMoteState; + public readonly CWiiMoteStatus WiiMoteState; public CWiiMoteChangedEventArgs(CWiiMoteStatus ws) { @@ -133,7 +139,7 @@ namespace Vocaluxe.Lib.Input.WiiMote } #endregion Events - public class CWiiMoteLib : IDisposable + public sealed class CWiiMoteLib : IDisposable { // ReSharper disable InconsistentNaming private const ushort _VID = 0x057e; @@ -152,6 +158,7 @@ namespace Vocaluxe.Lib.Input.WiiMote // output commands private enum EOutputReport : byte { + // ReSharper disable UnusedMember.Local // ReSharper disable InconsistentNaming LEDs = 0x11, // ReSharper restore InconsistentNaming @@ -163,6 +170,7 @@ namespace Vocaluxe.Lib.Input.WiiMote SpeakerData = 0x18, SpeakerMute = 0x19, IR2 = 0x1a, + // ReSharper restore UnusedMember.Local }; // data handling @@ -176,11 +184,7 @@ namespace Vocaluxe.Lib.Input.WiiMote private bool _Active; private bool _Error; - private bool _Connected; - public bool Connected - { - get { return _Connected; } - } + public bool Connected { get; private set; } private readonly CWiiMoteStatus _WiiMoteState = new CWiiMoteStatus(); private readonly AutoResetEvent _ReadDone = new AutoResetEvent(false); @@ -189,13 +193,18 @@ namespace Vocaluxe.Lib.Input.WiiMote #region Interface public CWiiMoteLib() { - _Connected = false; + Connected = false; _Active = true; _Error = false; _Reader = new Thread(_ReaderLoop); _Reader.Start(); } + ~CWiiMoteLib() + { + Dispose(false); + } + private bool _TryConnect(ushort pid) { bool connected = CHIDApi.Open(_VID, pid, out _Handle); @@ -210,7 +219,7 @@ namespace Vocaluxe.Lib.Input.WiiMote public bool Connect() { - _Connected = false; + Connected = false; if (_Error) return false; @@ -220,7 +229,7 @@ namespace Vocaluxe.Lib.Input.WiiMote if (!CHIDApi.Init()) { CLog.LogError("WiiMoteLib: Can't initialize HID API"); - string msg = "Please install the Visual C++ Redistributable Packages 2008!"; + const string msg = "Please install the Visual C++ Redistributable Packages 2008!"; CLog.LogError(msg); _Active = false; @@ -229,25 +238,25 @@ namespace Vocaluxe.Lib.Input.WiiMote } //Try WiiMotion - _Connected = _TryConnect(_PID); + Connected = _TryConnect(_PID); //Try WiiMotion Plus - if (!_Connected) - _Connected = _TryConnect(_PIDPlus); + if (!Connected) + Connected = _TryConnect(_PIDPlus); - return _Connected; + return Connected; } public void Disconnect() { - _Connected = false; + Connected = false; _Active = false; CHIDApi.Exit(); } public void SetReportType(EInputReport type, EIRSensitivity irSensitivity, bool continuous) { - if (!_Connected) + if (!Connected) return; switch (type) @@ -275,18 +284,17 @@ namespace Vocaluxe.Lib.Input.WiiMote _WiiMoteState.LEDState.LED3 = led3; _WiiMoteState.LEDState.LED4 = led4; - if (!_Connected) + if (!Connected) return; _ClearReport(); _Buff[0] = (byte)EOutputReport.LEDs; - _Buff[1] = (byte)( - (led1 ? 0x10 : 0x00) | - (led2 ? 0x20 : 0x00) | - (led3 ? 0x40 : 0x00) | - (led4 ? 0x80 : 0x00) | - _RumbleBit); + _Buff[1] = (byte)((led1 ? 0x10 : 0x00) | + (led2 ? 0x20 : 0x00) | + (led3 ? 0x40 : 0x00) | + (led4 ? 0x80 : 0x00) | + _RumbleBit); CHIDApi.Write(_Handle, _Buff); } @@ -301,11 +309,6 @@ namespace Vocaluxe.Lib.Input.WiiMote _WiiMoteState.LEDState.LED3, _WiiMoteState.LEDState.LED4); } - - public CWiiMoteStatus WiiMoteState - { - get { return _WiiMoteState; } - } #endregion Interface #region Private stuff @@ -315,7 +318,7 @@ namespace Vocaluxe.Lib.Input.WiiMote { Thread.Sleep(5); - if (_Handle != IntPtr.Zero && _Connected) + if (_Handle != IntPtr.Zero && Connected) { byte[] buff = new byte[_ReportLength]; @@ -341,7 +344,7 @@ namespace Vocaluxe.Lib.Input.WiiMote { if (buff == null) { - _Connected = false; + Connected = false; return false; } @@ -408,6 +411,7 @@ namespace Vocaluxe.Lib.Input.WiiMote return true; } + /* private byte[] _DecryptBuffer(byte[] buff) { for (int i = 0; i < buff.Length; i++) @@ -415,6 +419,7 @@ namespace Vocaluxe.Lib.Input.WiiMote return buff; } +*/ private void _ParseButtons(byte[] buff) { @@ -450,14 +455,15 @@ namespace Vocaluxe.Lib.Input.WiiMote switch (_WiiMoteState.IRState.Mode) { case EIRMode.Basic: - if (_WiiMoteState.IRState.Sensors[0].Active = !(buff[6] == 0xff && buff[7] == 0xff)) + _WiiMoteState.IRState.Sensors[0].Active = !(buff[6] == 0xff && buff[7] == 0xff); + if (_WiiMoteState.IRState.Sensors[0].Active) { _WiiMoteState.IRState.Sensors[0].Position.X = buff[6] | ((buff[8] >> 4) & 0x03) << 8; _WiiMoteState.IRState.Sensors[0].Position.Y = buff[7] | ((buff[8] >> 6) & 0x03) << 8; _WiiMoteState.IRState.Sensors[0].Width = 0; } - - if (_WiiMoteState.IRState.Sensors[1].Active = !(buff[9] == 0xff && buff[10] == 0xff)) + _WiiMoteState.IRState.Sensors[1].Active = !(buff[9] == 0xff && buff[10] == 0xff); + if (_WiiMoteState.IRState.Sensors[1].Active) { _WiiMoteState.IRState.Sensors[1].Position.X = buff[9] | ((buff[8] >> 0) & 0x03) << 8; _WiiMoteState.IRState.Sensors[1].Position.Y = buff[10] | ((buff[8] >> 2) & 0x03) << 8; @@ -467,12 +473,12 @@ namespace Vocaluxe.Lib.Input.WiiMote case EIRMode.Extended: for (int i = 0; i < 4; i++) { - if (_WiiMoteState.IRState.Sensors[i].Active = !(buff[6 + i * 3] == 0xff && buff[7 + i * 3] == 0xff && buff[8 + i * 3] == 0xff)) - { - _WiiMoteState.IRState.Sensors[i].Position.X = buff[6 + i * 3] | ((buff[8 + i * 3] >> 4) & 0x03) << 8; - _WiiMoteState.IRState.Sensors[i].Position.Y = buff[7 + i * 3] | ((buff[8 + i * 3] >> 6) & 0x03) << 8; - _WiiMoteState.IRState.Sensors[i].Width = buff[8 + i * 3] & 0x0f; - } + _WiiMoteState.IRState.Sensors[i].Active = !(buff[6 + i * 3] == 0xff && buff[7 + i * 3] == 0xff && buff[8 + i * 3] == 0xff); + if (!_WiiMoteState.IRState.Sensors[i].Active) + continue; + _WiiMoteState.IRState.Sensors[i].Position.X = buff[6 + i * 3] | ((buff[8 + i * 3] >> 4) & 0x03) << 8; + _WiiMoteState.IRState.Sensors[i].Position.Y = buff[7 + i * 3] | ((buff[8 + i * 3] >> 6) & 0x03) << 8; + _WiiMoteState.IRState.Sensors[i].Width = buff[8 + i * 3] & 0x0f; } break; } @@ -504,13 +510,13 @@ namespace Vocaluxe.Lib.Input.WiiMote if ((buff[3] & 0x08) != 0) { CLog.LogError("Error reading data from WiiMote: Bytes do not exist"); - _Connected = false; + Connected = false; } if ((buff[3] & 0x07) != 0) { CLog.LogError("Error reading data from WiiMote: Attempt to read from write-only registers."); - _Connected = false; + Connected = false; } int size = (buff[3] >> 4) + 1; @@ -524,12 +530,7 @@ namespace Vocaluxe.Lib.Input.WiiMote private byte _RumbleBit { - get - { - if (_WiiMoteState.Rumble) - return 0x1; - return 0x0; - } + get { return (byte)(_WiiMoteState.Rumble ? 1 : 0); } } private bool _ReadCalibration() @@ -649,7 +650,7 @@ namespace Vocaluxe.Lib.Input.WiiMote if (!_ReadDone.WaitOne(1000, false)) { - _Connected = false; + Connected = false; return null; } @@ -687,7 +688,7 @@ namespace Vocaluxe.Lib.Input.WiiMote } // ReSharper disable InconsistentNaming - protected virtual void Dispose(bool disposing) + private void Dispose(bool disposing) // ReSharper restore InconsistentNaming { if (disposing) diff --git a/Vocaluxe/Lib/Playlist/CPlaylistFile.cs b/Vocaluxe/Lib/Playlist/CPlaylistFile.cs index b73f2883..c1273112 100644 --- a/Vocaluxe/Lib/Playlist/CPlaylistFile.cs +++ b/Vocaluxe/Lib/Playlist/CPlaylistFile.cs @@ -93,12 +93,6 @@ namespace Vocaluxe.Lib.Playlist return; } - if (writer == null) - { - CLog.LogError("Error creating/opening Playlist File " + PlaylistFile); - return; - } - try { writer.WriteStartDocument(); @@ -114,7 +108,7 @@ namespace Vocaluxe.Lib.Playlist CSong song = CSongs.GetSong(Songs[i].SongID); if (song != null) { - writer.WriteStartElement("Song" + (i + 1).ToString()); + writer.WriteStartElement("Song" + (i + 1)); writer.WriteElementString("Artist", song.Artist); writer.WriteElementString("Title", song.Title); writer.WriteElementString("GameMode", Enum.GetName(typeof(EGameMode), Songs[i].GameMode)); @@ -143,40 +137,37 @@ namespace Vocaluxe.Lib.Playlist return; string value = String.Empty; - if (xmlReader.GetValue("//root/Info/PlaylistName", ref value, value)) + if (xmlReader.GetValue("//root/Info/PlaylistName", out value, value)) { PlaylistName = value; Songs = new List(); List songs = xmlReader.GetValues("Songs"); - string artist = String.Empty; - string title = String.Empty; EGameMode gm = EGameMode.TR_GAMEMODE_NORMAL; - for (int i = 0; i < songs.Count; i++) - { - xmlReader.GetValue("//root/Songs/" + songs[i] + "/Artist", ref artist, String.Empty); - xmlReader.GetValue("//root/Songs/" + songs[i] + "/Title", ref title, String.Empty); - xmlReader.TryGetEnumValue("//root/Songs/" + songs[i] + "/GameMode", ref gm); + foreach (string song in songs) { + string artist; + string title; + xmlReader.GetValue("//root/Songs/" + song + "/Artist", out artist, String.Empty); + xmlReader.GetValue("//root/Songs/" + song + "/Title", out title, String.Empty); + xmlReader.TryGetEnumValue("//root/Songs/" + song + "/GameMode", ref gm); - CPlaylistSong song = new CPlaylistSong(); - song.SongID = -1; + CPlaylistSong playlistSong = new CPlaylistSong(); + playlistSong.SongID = -1; CSong[] allSongs = CSongs.AllSongs; - for (int s = 0; s < allSongs.Length; s++) - { - if (allSongs[s].Artist == artist && allSongs[s].Title == title) - { - song.SongID = allSongs[s].ID; - break; - } + foreach (CSong curSong in allSongs) { + if (curSong.Artist != artist || curSong.Title != title) + continue; + playlistSong.SongID = curSong.ID; + break; } - if (song.SongID != -1) + if (playlistSong.SongID != -1) { - song.GameMode = gm; - Songs.Add(song); + playlistSong.GameMode = gm; + Songs.Add(playlistSong); } else CLog.LogError("Can't find song '" + title + "' from '" + artist + "' in playlist file: " + PlaylistFile); diff --git a/Vocaluxe/Lib/Sound/COpenALPlay.cs b/Vocaluxe/Lib/Sound/COpenALPlay.cs index 9f21a4f7..43a2832c 100644 --- a/Vocaluxe/Lib/Sound/COpenALPlay.cs +++ b/Vocaluxe/Lib/Sound/COpenALPlay.cs @@ -792,7 +792,7 @@ namespace Vocaluxe.Lib.Sound if (_Paused) return; - int queuedCount = 0; + int queuedCount; bool doit = true; AL.GetSource(_Source, ALGetSourcei.BuffersQueued, out queuedCount); @@ -801,7 +801,7 @@ namespace Vocaluxe.Lib.Sound { AL.GetSource(_Source, ALGetSourcei.BuffersProcessed, out processedCount); doit = false; - Console.WriteLine("Buffers Processed on Stream " + _Source.ToString() + " = " + processedCount.ToString()); + Console.WriteLine("Buffers Processed on Stream " + _Source + " = " + processedCount); if (processedCount < 1) return; } @@ -839,7 +839,7 @@ namespace Vocaluxe.Lib.Sound } - int buffer = 0; + int buffer; if (!doit) buffer = AL.SourceUnqueueBuffer(_Source); else @@ -850,11 +850,9 @@ namespace Vocaluxe.Lib.Sound if (buffer != 0) { - if (_Format.ChannelCount == 2) - AL.BufferData(buffer, ALFormat.Stereo16, buf, buf.Length, _Format.SamplesPerSecond); - else - AL.BufferData(buffer, ALFormat.Mono16, buf, buf.Length, _Format.SamplesPerSecond); - Console.WriteLine("Write to Buffer: " + buffer.ToString()); + ALFormat alFormat = (_Format.ChannelCount == 2)?ALFormat.Stereo16:ALFormat.Mono16; + AL.BufferData(buffer, alFormat, buf, buf.Length, _Format.SamplesPerSecond); + Console.WriteLine("Write to Buffer: " + buffer); AL.SourceQueueBuffer(_Source, buffer); } } diff --git a/Vocaluxe/Lib/Sound/CPortAudioPlay.cs b/Vocaluxe/Lib/Sound/CPortAudioPlay.cs index 26fdf3eb..a6c904d3 100644 --- a/Vocaluxe/Lib/Sound/CPortAudioPlay.cs +++ b/Vocaluxe/Lib/Sound/CPortAudioPlay.cs @@ -17,7 +17,6 @@ // */ #endregion -using PortAudioSharp; using System; using System.Collections.Generic; using System.Diagnostics; @@ -26,6 +25,7 @@ using System.Runtime.InteropServices; using System.Threading; using Vocaluxe.Base; using Vocaluxe.Lib.Sound.Decoder; +using Vocaluxe.Lib.Sound.PortAudio; namespace Vocaluxe.Lib.Sound { diff --git a/Vocaluxe/Lib/Sound/CPortAudioRecord.cs b/Vocaluxe/Lib/Sound/CPortAudioRecord.cs index cbdc04c0..b39c3eee 100644 --- a/Vocaluxe/Lib/Sound/CPortAudioRecord.cs +++ b/Vocaluxe/Lib/Sound/CPortAudioRecord.cs @@ -18,11 +18,11 @@ #endregion using System.Threading; -using PortAudioSharp; using System; using System.Collections.Generic; using System.Runtime.InteropServices; using Vocaluxe.Base; +using Vocaluxe.Lib.Sound.PortAudio; namespace Vocaluxe.Lib.Sound { @@ -77,7 +77,7 @@ namespace Vocaluxe.Lib.Sound dev.ID = i; dev.Name = info.Name; - dev.Driver = info.Name + i.ToString(); + dev.Driver = info.Name + i; dev.Inputs = new List(); SInput inp = new SInput(); @@ -155,7 +155,6 @@ namespace Vocaluxe.Lib.Sound } } - bool result = true; for (int i = 0; i < _RecHandle.Length; i++) { if (active[i]) @@ -181,7 +180,7 @@ namespace Vocaluxe.Lib.Sound return false; } } - return result; + return true; } /// diff --git a/Vocaluxe/Lib/Sound/Decoder/CAudioDecoderFFmpeg.cs b/Vocaluxe/Lib/Sound/Decoder/CAudioDecoderFFmpeg.cs index 566c9677..eb0a01d1 100644 --- a/Vocaluxe/Lib/Sound/Decoder/CAudioDecoderFFmpeg.cs +++ b/Vocaluxe/Lib/Sound/Decoder/CAudioDecoderFFmpeg.cs @@ -18,7 +18,6 @@ #endregion using System; -using System.IO; using System.Runtime.InteropServices; using Vocaluxe.Base; using Vocaluxe.Lib.Video.Acinerella; @@ -69,7 +68,7 @@ namespace Vocaluxe.Lib.Sound.Decoder return; } - int audioStreamIndex = -1; + int audioStreamIndex; SACDecoder audiodecoder; try { @@ -176,7 +175,7 @@ namespace Vocaluxe.Lib.Sound.Decoder return; } - int frameFinished = 0; + int frameFinished; try { frameFinished = CAcinerella.AcGetAudioFrame(_InstancePtr, _Audiodecoder); diff --git a/Vocaluxe/Lib/Sound/Portaudio/PortAudio.cs b/Vocaluxe/Lib/Sound/Portaudio/PortAudio.cs index f3f1df18..7adfb7c1 100644 --- a/Vocaluxe/Lib/Sound/Portaudio/PortAudio.cs +++ b/Vocaluxe/Lib/Sound/Portaudio/PortAudio.cs @@ -20,7 +20,7 @@ using System; using System.Runtime.InteropServices; -namespace PortAudioSharp +namespace Vocaluxe.Lib.Sound.PortAudio { /** @@ -28,7 +28,7 @@ namespace PortAudioSharp */ - public partial class CPortAudio + public static partial class CPortAudio { #region **** PORTAUDIO CALLBACKS **** [UnmanagedFunctionPointer(CallingConvention.Cdecl)] @@ -549,10 +549,5 @@ namespace PortAudioSharp [DllImport(_PaDll, CallingConvention = CallingConvention.Cdecl)] public static extern void Pa_Sleep(int msec); #endregion - - private CPortAudio() - { - // This is a static class - } } } \ No newline at end of file diff --git a/Vocaluxe/Lib/Sound/Portaudio/PortAudioASIO.cs b/Vocaluxe/Lib/Sound/Portaudio/PortAudioASIO.cs index 09e7858c..4bdd1091 100644 --- a/Vocaluxe/Lib/Sound/Portaudio/PortAudioASIO.cs +++ b/Vocaluxe/Lib/Sound/Portaudio/PortAudioASIO.cs @@ -20,10 +20,10 @@ using System; using System.Runtime.InteropServices; -namespace PortAudioSharp +namespace Vocaluxe.Lib.Sound.PortAudio { /// PortAudio v.19 bindings for .NET - ASIO bindings - public partial class CPortAudio + public static partial class CPortAudio { #region **** PORTAUDIO DATA STRUCTURES **** [StructLayout(LayoutKind.Sequential)] diff --git a/Vocaluxe/Lib/Video/CVideoDecoder.cs b/Vocaluxe/Lib/Video/CVideoDecoder.cs index 7f32cd13..2a23df81 100644 --- a/Vocaluxe/Lib/Video/CVideoDecoder.cs +++ b/Vocaluxe/Lib/Video/CVideoDecoder.cs @@ -25,7 +25,7 @@ namespace Vocaluxe.Lib.Video abstract class CVideoDecoder : IVideoDecoder { protected List _Streams = new List(); - protected bool _Initialized = false; + protected bool _Initialized; public virtual bool Init() { @@ -57,10 +57,7 @@ namespace Vocaluxe.Lib.Video return 0f; } - public virtual bool GetFrame(int streamID, ref STexture frame, float time, ref float videoTime) - { - return true; - } + public abstract bool GetFrame(int streamID, ref STexture frame, float time, out float videoTime); public virtual bool Skip(int streamID, float start, float gap) { diff --git a/Vocaluxe/Lib/Video/CVideoDecoderFFmpeg.cs b/Vocaluxe/Lib/Video/CVideoDecoderFFmpeg.cs index 4c9c09fb..9c33c6f5 100644 --- a/Vocaluxe/Lib/Video/CVideoDecoderFFmpeg.cs +++ b/Vocaluxe/Lib/Video/CVideoDecoderFFmpeg.cs @@ -91,14 +91,15 @@ namespace Vocaluxe.Lib.Video return false; } - public override bool GetFrame(int streamID, ref STexture frame, float time, ref float videoTime) + public override bool GetFrame(int streamID, ref STexture frame, float time, out float videoTime) { + videoTime = 0; if (_Initialized) { lock (_MutexDecoder) { if (_AlreadyAdded(streamID)) - return _Decoder[_GetStreamIndex(streamID)].GetFrame(ref frame, time, ref videoTime); + return _Decoder[_GetStreamIndex(streamID)].GetFrame(ref frame, time, out videoTime); } } return false; @@ -315,8 +316,9 @@ namespace Vocaluxe.Lib.Video return true; } - public bool GetFrame(ref STexture frame, float time, ref float videoTime) + public bool GetFrame(ref STexture frame, float time, out float videoTime) { + videoTime = 0; if (!_FileOpened) return false; @@ -461,7 +463,7 @@ namespace Vocaluxe.Lib.Video private void _DoOpen() { - bool ok = false; + bool ok; SACInstance instance = new SACInstance(); try { @@ -486,7 +488,7 @@ namespace Vocaluxe.Lib.Video _Duration = instance.Info.Duration / 1000f; - int videoStreamIndex = -1; + int videoStreamIndex; SACDecoder videodecoder; try { @@ -541,9 +543,7 @@ namespace Vocaluxe.Lib.Video float myTime = _Time + _VideoSkipTime; float timeDifference = myTime - _VideoDecoderTime; - bool dropFrame = false; - if (timeDifference >= (framedropcount - 1) * _VideoTimeBase) - dropFrame = true; + bool dropFrame = timeDifference >= (framedropcount - 1) * _VideoTimeBase; if (_Terminated) return; @@ -610,7 +610,6 @@ namespace Vocaluxe.Lib.Video } else _NoMoreFrames = true; - return; } else { diff --git a/Vocaluxe/Lib/Video/CVideoDecoderGstreamer.cs b/Vocaluxe/Lib/Video/CVideoDecoderGstreamer.cs index 93f424cb..e073a74c 100644 --- a/Vocaluxe/Lib/Video/CVideoDecoderGstreamer.cs +++ b/Vocaluxe/Lib/Video/CVideoDecoderGstreamer.cs @@ -78,7 +78,7 @@ namespace Vocaluxe.Lib.Video return CGstreamerVideoWrapper.GetVideoLength(streamID); } - public bool GetFrame(int streamID, ref STexture frame, float time, ref float videoTime) + public bool GetFrame(int streamID, ref STexture frame, float time, out float videoTime) { SManagedFrame managedFrame = CGstreamerVideoWrapper.GetFrame(streamID, time); videoTime = managedFrame.Videotime; diff --git a/Vocaluxe/Lib/Video/IVideoDecoder.cs b/Vocaluxe/Lib/Video/IVideoDecoder.cs index 161f479e..dfdd3312 100644 --- a/Vocaluxe/Lib/Video/IVideoDecoder.cs +++ b/Vocaluxe/Lib/Video/IVideoDecoder.cs @@ -44,7 +44,7 @@ namespace Vocaluxe.Lib.Video int GetNumStreams(); float GetLength(int streamID); - bool GetFrame(int streamID, ref STexture frame, float time, ref float videoTime); + bool GetFrame(int streamID, ref STexture frame, float time, out float videoTime); bool Skip(int streamID, float start, float gap); void SetLoop(int streamID, bool loop); void Pause(int streamID); diff --git a/Vocaluxe/Screens/CPopupScreenPlayerControl.cs b/Vocaluxe/Screens/CPopupScreenPlayerControl.cs index 06d0b0d0..4f56232b 100644 --- a/Vocaluxe/Screens/CPopupScreenPlayerControl.cs +++ b/Vocaluxe/Screens/CPopupScreenPlayerControl.cs @@ -18,7 +18,6 @@ #endregion using System; -using System.Collections.Generic; using System.Windows.Forms; using Vocaluxe.Base; using VocaluxeLib.Menu; @@ -91,23 +90,14 @@ namespace Vocaluxe.Screens _ThemeStatics = new string[] {_StaticBG, _StaticCover}; _ThemeTexts = new string[] {_TextCurrentSong}; - List buttons = new List(); - buttons.Add(_ButtonPlay); - buttons.Add(_ButtonPause); - buttons.Add(_ButtonPrevious); - buttons.Add(_ButtonNext); - buttons.Add(_ButtonRepeat); - buttons.Add(_ButtonShowVideo); - buttons.Add(_ButtonSing); - buttons.Add(_ButtonToBackgroundVideo); - _ThemeButtons = buttons.ToArray(); + _ThemeButtons = new string[]{_ButtonPlay,_ButtonPause,_ButtonPrevious,_ButtonNext,_ButtonRepeat,_ButtonShowVideo,_ButtonSing,_ButtonToBackgroundVideo}; } public override void LoadTheme(string xmlPath) { base.LoadTheme(xmlPath); - _ScreenArea = Statics[_StaticBG].Rect; + _ScreenArea = _Statics[_StaticBG].Rect; } public override bool HandleInput(SKeyEvent keyEvent) @@ -124,21 +114,21 @@ namespace Vocaluxe.Screens return false; case Keys.Enter: - if (Buttons[_ButtonNext].Selected) + if (_Buttons[_ButtonNext].Selected) CBackgroundMusic.Next(); - if (Buttons[_ButtonPrevious].Selected) + if (_Buttons[_ButtonPrevious].Selected) CBackgroundMusic.Previous(); - if (Buttons[_ButtonPlay].Selected) + if (_Buttons[_ButtonPlay].Selected) CBackgroundMusic.Play(); - if (Buttons[_ButtonPause].Selected) + if (_Buttons[_ButtonPause].Selected) CBackgroundMusic.Pause(); - if (Buttons[_ButtonRepeat].Selected) + if (_Buttons[_ButtonRepeat].Selected) CBackgroundMusic.RepeatSong = !CBackgroundMusic.RepeatSong; - if (Buttons[_ButtonShowVideo].Selected) + if (_Buttons[_ButtonShowVideo].Selected) _VideoPreview = !_VideoPreview; - if (Buttons[_ButtonSing].Selected) - _StartSong(CBackgroundMusic.SongID, CBackgroundMusic.Duet); - if (Buttons[_ButtonToBackgroundVideo].Selected) + if (_Buttons[_ButtonSing].Selected) + _StartSong(CBackgroundMusic.SongID); + if (_Buttons[_ButtonToBackgroundVideo].Selected) _VideoBackground = !_VideoBackground; break; } @@ -150,23 +140,23 @@ namespace Vocaluxe.Screens public override bool HandleMouse(SMouseEvent mouseEvent) { base.HandleMouse(mouseEvent); - if (mouseEvent.LB && IsMouseOver(mouseEvent)) + if (mouseEvent.LB && _IsMouseOver(mouseEvent)) { - if (Buttons[_ButtonNext].Selected) + if (_Buttons[_ButtonNext].Selected) CBackgroundMusic.Next(); - if (Buttons[_ButtonPrevious].Selected) + if (_Buttons[_ButtonPrevious].Selected) CBackgroundMusic.Previous(); - if (Buttons[_ButtonPlay].Selected) + if (_Buttons[_ButtonPlay].Selected) CBackgroundMusic.Play(); - if (Buttons[_ButtonPause].Selected) + if (_Buttons[_ButtonPause].Selected) CBackgroundMusic.Pause(); - if (Buttons[_ButtonRepeat].Selected) + if (_Buttons[_ButtonRepeat].Selected) CBackgroundMusic.RepeatSong = !CBackgroundMusic.RepeatSong; - if (Buttons[_ButtonShowVideo].Selected) + if (_Buttons[_ButtonShowVideo].Selected) _VideoPreview = !_VideoPreview; - if (Buttons[_ButtonSing].Selected) - _StartSong(CBackgroundMusic.SongID, CBackgroundMusic.Duet); - if (Buttons[_ButtonToBackgroundVideo].Selected) + if (_Buttons[_ButtonSing].Selected) + _StartSong(CBackgroundMusic.SongID); + if (_Buttons[_ButtonToBackgroundVideo].Selected) _VideoBackground = !_VideoBackground; } else if (mouseEvent.LB) @@ -184,11 +174,11 @@ namespace Vocaluxe.Screens public override bool UpdateGame() { - Statics[_StaticCover].Visible = !_VideoPreviewInt || !CBackgroundMusic.SongHasVideo; - Buttons[_ButtonToBackgroundVideo].Pressed = _VideoBackground; - Buttons[_ButtonShowVideo].Pressed = _VideoPreviewInt; - Buttons[_ButtonRepeat].Pressed = CBackgroundMusic.RepeatSong; - Buttons[_ButtonSing].Visible = CBackgroundMusic.CanSing && CParty.CurrentPartyModeID == -1; + _Statics[_StaticCover].Visible = !_VideoPreviewInt || !CBackgroundMusic.SongHasVideo; + _Buttons[_ButtonToBackgroundVideo].Pressed = _VideoBackground; + _Buttons[_ButtonShowVideo].Pressed = _VideoPreviewInt; + _Buttons[_ButtonRepeat].Pressed = CBackgroundMusic.RepeatSong; + _Buttons[_ButtonSing].Visible = CBackgroundMusic.CanSing && CParty.CurrentPartyModeID == -1; return true; } @@ -196,31 +186,30 @@ namespace Vocaluxe.Screens { if (!_Active) return false; - Statics[_StaticCover].Texture = CBackgroundMusic.Cover; + _Statics[_StaticCover].Texture = CBackgroundMusic.Cover; if (CBackgroundMusic.VideoEnabled && _VideoPreview && CBackgroundMusic.SongHasVideo) - CDraw.DrawTexture(Statics[_StaticCover], CBackgroundMusic.GetVideoTexture(), EAspect.Crop); - Buttons[_ButtonPause].Visible = CBackgroundMusic.Playing; - Buttons[_ButtonPlay].Visible = !CBackgroundMusic.Playing; - Texts[_TextCurrentSong].Text = CBackgroundMusic.ArtistAndTitle; + CDraw.DrawTexture(_Statics[_StaticCover], CBackgroundMusic.GetVideoTexture(), EAspect.Crop); + _Buttons[_ButtonPause].Visible = CBackgroundMusic.Playing; + _Buttons[_ButtonPlay].Visible = !CBackgroundMusic.Playing; + _Texts[_TextCurrentSong].Text = CBackgroundMusic.ArtistAndTitle; return base.Draw(); } - private void _StartSong(int songNr, bool duet) + private void _StartSong(int songNr) { - if (songNr >= 0 && CSongs.SongsLoaded) - { - CGame.Reset(); - CGame.ClearSongs(); + if (songNr < 0 || !CSongs.SongsLoaded) + return; + CGame.Reset(); + CGame.ClearSongs(); - EGameMode gm = EGameMode.TR_GAMEMODE_NORMAL; - if (CSongs.AllSongs[songNr].IsDuet) - gm = EGameMode.TR_GAMEMODE_DUET; + EGameMode gm = EGameMode.TR_GAMEMODE_NORMAL; + if (CSongs.AllSongs[songNr].IsDuet) + gm = EGameMode.TR_GAMEMODE_DUET; - CGame.AddSong(songNr, gm); + CGame.AddSong(songNr, gm); - CGraphics.FadeTo(EScreens.ScreenNames); - } + CGraphics.FadeTo(EScreens.ScreenNames); } } } \ No newline at end of file diff --git a/Vocaluxe/Screens/CPopupScreenVolumeControl.cs b/Vocaluxe/Screens/CPopupScreenVolumeControl.cs index b7ba7128..b3213950 100644 --- a/Vocaluxe/Screens/CPopupScreenVolumeControl.cs +++ b/Vocaluxe/Screens/CPopupScreenVolumeControl.cs @@ -46,8 +46,8 @@ namespace Vocaluxe.Screens { base.LoadTheme(xmlPath); - _ScreenArea = Statics[_StaticBG].Rect; - SelectSlides[_SelectSlideVolume].AddValues(new string[] + _ScreenArea = _Statics[_StaticBG].Rect; + _SelectSlides[_SelectSlideVolume].AddValues(new string[] {"0", "5", "10", "15", "20", "25", "30", "35", "40", "45", "50", "55", "60", "65", "70", "75", "80", "85", "90", "95", "100"}); } @@ -65,27 +65,25 @@ namespace Vocaluxe.Screens _SaveConfig(); return true; } - else if (mouseEvent.Wheel > 0 && CHelper.IsInBounds(_ScreenArea, mouseEvent)) + if (mouseEvent.Wheel > 0 && CHelper.IsInBounds(_ScreenArea, mouseEvent)) { - if (SelectSlides[_SelectSlideVolume].Selection - mouseEvent.Wheel >= 0) - SelectSlides[_SelectSlideVolume].Selection = SelectSlides[_SelectSlideVolume].Selection - mouseEvent.Wheel; - else if (SelectSlides[_SelectSlideVolume].Selection - mouseEvent.Wheel < 0) - SelectSlides[_SelectSlideVolume].Selection = 0; + if (_SelectSlides[_SelectSlideVolume].Selection - mouseEvent.Wheel >= 0) + _SelectSlides[_SelectSlideVolume].Selection = _SelectSlides[_SelectSlideVolume].Selection - mouseEvent.Wheel; + else if (_SelectSlides[_SelectSlideVolume].Selection - mouseEvent.Wheel < 0) + _SelectSlides[_SelectSlideVolume].Selection = 0; _SaveConfig(); return true; } - else if (mouseEvent.Wheel < 0 && CHelper.IsInBounds(_ScreenArea, mouseEvent)) + if (mouseEvent.Wheel < 0 && CHelper.IsInBounds(_ScreenArea, mouseEvent)) { - if (SelectSlides[_SelectSlideVolume].Selection - mouseEvent.Wheel < SelectSlides[_SelectSlideVolume].NumValues) - SelectSlides[_SelectSlideVolume].Selection = SelectSlides[_SelectSlideVolume].Selection - mouseEvent.Wheel; - else if (SelectSlides[_SelectSlideVolume].Selection - mouseEvent.Wheel >= SelectSlides[_SelectSlideVolume].NumValues) - SelectSlides[_SelectSlideVolume].Selection = SelectSlides[_SelectSlideVolume].NumValues - 1; + if (_SelectSlides[_SelectSlideVolume].Selection - mouseEvent.Wheel < _SelectSlides[_SelectSlideVolume].NumValues) + _SelectSlides[_SelectSlideVolume].Selection = _SelectSlides[_SelectSlideVolume].Selection - mouseEvent.Wheel; + else if (_SelectSlides[_SelectSlideVolume].Selection - mouseEvent.Wheel >= _SelectSlides[_SelectSlideVolume].NumValues) + _SelectSlides[_SelectSlideVolume].Selection = _SelectSlides[_SelectSlideVolume].NumValues - 1; _SaveConfig(); return true; } - else if (mouseEvent.RB) - return false; - return true; + return !mouseEvent.RB; } public override void OnShow() @@ -114,20 +112,20 @@ namespace Vocaluxe.Screens { case EScreens.ScreenSong: if (CSongs.IsInCategory) - CConfig.PreviewMusicVolume = SelectSlides[_SelectSlideVolume].Selection * 5; + CConfig.PreviewMusicVolume = _SelectSlides[_SelectSlideVolume].Selection * 5; else { - CConfig.BackgroundMusicVolume = SelectSlides[_SelectSlideVolume].Selection * 5; + CConfig.BackgroundMusicVolume = _SelectSlides[_SelectSlideVolume].Selection * 5; CBackgroundMusic.ApplyVolume(); } break; case EScreens.ScreenSing: - CConfig.GameMusicVolume = SelectSlides[_SelectSlideVolume].Selection * 5; + CConfig.GameMusicVolume = _SelectSlides[_SelectSlideVolume].Selection * 5; break; default: - CConfig.BackgroundMusicVolume = SelectSlides[_SelectSlideVolume].Selection * 5; + CConfig.BackgroundMusicVolume = _SelectSlides[_SelectSlideVolume].Selection * 5; CBackgroundMusic.ApplyVolume(); break; } @@ -140,17 +138,17 @@ namespace Vocaluxe.Screens { case EScreens.ScreenSong: if (CSongs.IsInCategory) - SelectSlides[_SelectSlideVolume].Selection = CConfig.PreviewMusicVolume / 5; + _SelectSlides[_SelectSlideVolume].Selection = CConfig.PreviewMusicVolume / 5; else - SelectSlides[_SelectSlideVolume].Selection = CConfig.BackgroundMusicVolume / 5; + _SelectSlides[_SelectSlideVolume].Selection = CConfig.BackgroundMusicVolume / 5; break; case EScreens.ScreenSing: - SelectSlides[_SelectSlideVolume].Selection = CConfig.GameMusicVolume / 5; + _SelectSlides[_SelectSlideVolume].Selection = CConfig.GameMusicVolume / 5; break; default: - SelectSlides[_SelectSlideVolume].Selection = CConfig.BackgroundMusicVolume / 5; + _SelectSlides[_SelectSlideVolume].Selection = CConfig.BackgroundMusicVolume / 5; break; } } diff --git a/Vocaluxe/Screens/CScreenCredits.cs b/Vocaluxe/Screens/CScreenCredits.cs index 6ebd1819..d47e1d43 100644 --- a/Vocaluxe/Screens/CScreenCredits.cs +++ b/Vocaluxe/Screens/CScreenCredits.cs @@ -451,7 +451,6 @@ namespace Vocaluxe.Screens //Start Text-Timer _TextTimer.Start(); - active = true; } } else if (_CreditNames[i].Y <= 360f) diff --git a/Vocaluxe/Screens/CScreenHighscore.cs b/Vocaluxe/Screens/CScreenHighscore.cs index 6baa32d4..bd2481ed 100644 --- a/Vocaluxe/Screens/CScreenHighscore.cs +++ b/Vocaluxe/Screens/CScreenHighscore.cs @@ -60,34 +60,34 @@ namespace Vocaluxe.Screens _TextNumber = new string[_NumEntrys]; for (int i = 0; i < _NumEntrys; i++) { - _TextNumber[i] = "TextNumber" + (i + 1).ToString(); + _TextNumber[i] = "TextNumber" + (i + 1); texts.Add(_TextNumber[i]); } _TextName = new string[_NumEntrys]; for (int i = 0; i < _NumEntrys; i++) { - _TextName[i] = "TextName" + (i + 1).ToString(); + _TextName[i] = "TextName" + (i + 1); texts.Add(_TextName[i]); } _TextScore = new string[_NumEntrys]; for (int i = 0; i < _NumEntrys; i++) { - _TextScore[i] = "TextScore" + (i + 1).ToString(); + _TextScore[i] = "TextScore" + (i + 1); texts.Add(_TextScore[i]); } _TextDate = new string[_NumEntrys]; for (int i = 0; i < _NumEntrys; i++) { - _TextDate[i] = "TextDate" + (i + 1).ToString(); + _TextDate[i] = "TextDate" + (i + 1); texts.Add(_TextDate[i]); } _ParticleEffectNew = new string[_NumEntrys]; for (int i = 0; i < _NumEntrys; i++) - _ParticleEffectNew[i] = "ParticleEffectNew" + (i + 1).ToString(); + _ParticleEffectNew[i] = "ParticleEffectNew" + (i + 1); _ThemeTexts = texts.ToArray(); _ThemeParticleEffects = _ParticleEffectNew; @@ -131,7 +131,7 @@ namespace Vocaluxe.Screens public override bool HandleMouse(SMouseEvent mouseEvent) { - if (mouseEvent.LB && IsMouseOver(mouseEvent)) {} + if (mouseEvent.LB && _IsMouseOver(mouseEvent)) {} if (mouseEvent.LB) _LeaveScreen(); @@ -160,34 +160,34 @@ namespace Vocaluxe.Screens { if (_Pos + p < _Scores[_Round].Count) { - Texts[_TextNumber[p]].Visible = true; - Texts[_TextName[p]].Visible = true; - Texts[_TextScore[p]].Visible = true; - Texts[_TextDate[p]].Visible = true; + _Texts[_TextNumber[p]].Visible = true; + _Texts[_TextName[p]].Visible = true; + _Texts[_TextScore[p]].Visible = true; + _Texts[_TextDate[p]].Visible = true; - Texts[_TextNumber[p]].Text = (_Pos + p + 1).ToString(); + _Texts[_TextNumber[p]].Text = (_Pos + p + 1).ToString(); string name = _Scores[_Round][_Pos + p].Name; name += " [" + CLanguage.Translate(Enum.GetName(typeof(EGameDifficulty), _Scores[_Round][_Pos + p].Difficulty)) + "]"; if (_IsDuet) - name += " (P" + (_Scores[_Round][_Pos + p].LineNr + 1).ToString() + ")"; - Texts[_TextName[p]].Text = name; + name += " (P" + (_Scores[_Round][_Pos + p].LineNr + 1) + ")"; + _Texts[_TextName[p]].Text = name; - Texts[_TextScore[p]].Text = _Scores[_Round][_Pos + p].Score.ToString("00000"); - Texts[_TextDate[p]].Text = _Scores[_Round][_Pos + p].Date; + _Texts[_TextScore[p]].Text = _Scores[_Round][_Pos + p].Score.ToString("00000"); + _Texts[_TextDate[p]].Text = _Scores[_Round][_Pos + p].Date; if (_IsNewEntry(_Scores[_Round][_Pos + p].ID)) - ParticleEffects[_ParticleEffectNew[p]].Visible = true; + _ParticleEffects[_ParticleEffectNew[p]].Visible = true; else - ParticleEffects[_ParticleEffectNew[p]].Visible = false; + _ParticleEffects[_ParticleEffectNew[p]].Visible = false; } else { - Texts[_TextNumber[p]].Visible = false; - Texts[_TextName[p]].Visible = false; - Texts[_TextScore[p]].Visible = false; - Texts[_TextDate[p]].Visible = false; - ParticleEffects[_ParticleEffectNew[p]].Visible = false; + _Texts[_TextNumber[p]].Visible = false; + _Texts[_TextName[p]].Visible = false; + _Texts[_TextScore[p]].Visible = false; + _Texts[_TextDate[p]].Visible = false; + _ParticleEffects[_ParticleEffectNew[p]].Visible = false; } } return true; @@ -249,7 +249,7 @@ namespace Vocaluxe.Screens for (int round = 0; round < points.NumRounds; round++) { SPlayer player = points.GetPlayer(round, CGame.NumPlayer)[0]; - CDataBase.LoadScore(ref _Scores[round], player); + CDataBase.LoadScore(out _Scores[round], player); } } @@ -262,31 +262,31 @@ namespace Vocaluxe.Screens if (song == null) return; - Texts[_TextSongName].Text = song.Artist + " - " + song.Title; + _Texts[_TextSongName].Text = song.Artist + " - " + song.Title; if (points.NumRounds > 1) - Texts[_TextSongName].Text += " (" + (_Round + 1) + "/" + points.NumRounds + ")"; + _Texts[_TextSongName].Text += " (" + (_Round + 1) + "/" + points.NumRounds + ")"; switch (CGame.GetGameMode(_Round)) { case EGameMode.TR_GAMEMODE_NORMAL: - Texts[_TextSongMode].Text = "TR_GAMEMODE_NORMAL"; + _Texts[_TextSongMode].Text = "TR_GAMEMODE_NORMAL"; break; case EGameMode.TR_GAMEMODE_MEDLEY: - Texts[_TextSongMode].Text = "TR_GAMEMODE_MEDLEY"; + _Texts[_TextSongMode].Text = "TR_GAMEMODE_MEDLEY"; break; case EGameMode.TR_GAMEMODE_DUET: - Texts[_TextSongMode].Text = "TR_GAMEMODE_DUET"; + _Texts[_TextSongMode].Text = "TR_GAMEMODE_DUET"; _IsDuet = true; break; case EGameMode.TR_GAMEMODE_SHORTSONG: - Texts[_TextSongMode].Text = "TR_GAMEMODE_SHORTSONG"; + _Texts[_TextSongMode].Text = "TR_GAMEMODE_SHORTSONG"; break; default: - Texts[_TextSongMode].Text = "TR_GAMEMODE_NORMAL"; + _Texts[_TextSongMode].Text = "TR_GAMEMODE_NORMAL"; break; } diff --git a/Vocaluxe/Screens/CScreenLoad.cs b/Vocaluxe/Screens/CScreenLoad.cs index a0d83515..61c25afb 100644 --- a/Vocaluxe/Screens/CScreenLoad.cs +++ b/Vocaluxe/Screens/CScreenLoad.cs @@ -32,7 +32,6 @@ namespace Vocaluxe.Screens { get { return 1; } } - private const float _WaitTime = 0.5f; //wait time before starting first video private const string _TextStatus = "TextStatus"; @@ -103,10 +102,9 @@ namespace Vocaluxe.Screens } } - _SongLoaderThread = new Thread(CSongs.LoadSongs); - _SongLoaderThread.Name = "SongLoader"; + _SongLoaderThread = new Thread(CSongs.LoadSongs) {Name = "SongLoader"}; - Texts[_TextStatus].Text = CLanguage.Translate("TR_SCREENLOAD_TOTAL") + ": 0 " + + _Texts[_TextStatus].Text = CLanguage.Translate("TR_SCREENLOAD_TOTAL") + ": 0 " + CLanguage.Translate("TR_SCREENLOAD_SONGS") + " (0 " + CLanguage.Translate("TR_SCREENLOAD_LOADED") + ")"; @@ -129,8 +127,8 @@ namespace Vocaluxe.Screens if (CConfig.VideoBackgrounds == EOffOn.TR_CONFIG_ON) { - for (int i = 0; i < _Intros.Length; i++) - _Intros[i].PreLoad(); + foreach (CVideoPlayer videoPlayer in _Intros) + videoPlayer.PreLoad(); } CLog.StartBenchmark(0, "Load Songs Full"); @@ -169,8 +167,8 @@ namespace Vocaluxe.Screens if (CSettings.GameState == EGameState.Normal) CGraphics.FadeTo(EScreens.ScreenMain); - Texts[_TextStatus].Text = - CLanguage.Translate("TR_SCREENLOAD_TOTAL") + ": " + CSongs.NumAllSongs.ToString() + " " + + _Texts[_TextStatus].Text = + CLanguage.Translate("TR_SCREENLOAD_TOTAL") + ": " + CSongs.NumAllSongs + " " + CLanguage.Translate("TR_SCREENLOAD_SONGS") + " (" + CSongs.NumSongsWithCoverLoaded + " " + CLanguage.Translate("TR_SCREENLOAD_LOADED") + ")"; @@ -190,12 +188,12 @@ namespace Vocaluxe.Screens public override bool Draw() { - DrawBG(); + _DrawBG(); - for (int i = 0; i < _Intros.Length; i++) - _Intros[i].Draw(); + foreach (CVideoPlayer videoPlayer in _Intros) + videoPlayer.Draw(); - DrawFG(); + _DrawFG(); return true; } @@ -205,8 +203,8 @@ namespace Vocaluxe.Screens _Timer.Stop(); _Timer.Reset(); - for (int i = 0; i < _Intros.Length; i++) - _Intros[i].Close(); + foreach (CVideoPlayer videoPlayer in _Intros) + videoPlayer.Close(); CBackgroundMusic.CanSing = true; diff --git a/Vocaluxe/Screens/CScreenMain.cs b/Vocaluxe/Screens/CScreenMain.cs index e4825cc5..e44b3950 100644 --- a/Vocaluxe/Screens/CScreenMain.cs +++ b/Vocaluxe/Screens/CScreenMain.cs @@ -72,22 +72,22 @@ namespace Vocaluxe.Screens break; case Keys.Enter: - if (Buttons[_ButtonSing].Selected) + if (_Buttons[_ButtonSing].Selected) { CParty.SetNormalGameMode(); CGraphics.FadeTo(EScreens.ScreenSong); } - if (Buttons[_ButtonParty].Selected) + if (_Buttons[_ButtonParty].Selected) CGraphics.FadeTo(EScreens.ScreenParty); - if (Buttons[_ButtonOptions].Selected) + if (_Buttons[_ButtonOptions].Selected) CGraphics.FadeTo(EScreens.ScreenOptions); - if (Buttons[_ButtonProfiles].Selected) + if (_Buttons[_ButtonProfiles].Selected) CGraphics.FadeTo(EScreens.ScreenProfiles); - if (Buttons[_ButtonExit].Selected) + if (_Buttons[_ButtonExit].Selected) return false; break; @@ -100,30 +100,31 @@ namespace Vocaluxe.Screens { base.HandleMouse(mouseEvent); - if (mouseEvent.LB && IsMouseOver(mouseEvent)) + if (mouseEvent.LB && _IsMouseOver(mouseEvent)) { - if (Buttons[_ButtonSing].Selected) + if (_Buttons[_ButtonSing].Selected) { CParty.SetNormalGameMode(); CGraphics.FadeTo(EScreens.ScreenSong); } - if (Buttons[_ButtonParty].Selected) + if (_Buttons[_ButtonParty].Selected) CGraphics.FadeTo(EScreens.ScreenParty); - if (Buttons[_ButtonOptions].Selected) + if (_Buttons[_ButtonOptions].Selected) CGraphics.FadeTo(EScreens.ScreenOptions); - if (Buttons[_ButtonProfiles].Selected) + if (_Buttons[_ButtonProfiles].Selected) CGraphics.FadeTo(EScreens.ScreenProfiles); - if (Buttons[_ButtonExit].Selected) + if (_Buttons[_ButtonExit].Selected) return false; } return true; } +// ReSharper disable RedundantOverridenMember public override void OnShow() { base.OnShow(); @@ -131,6 +132,7 @@ namespace Vocaluxe.Screens //if (Snowflakes != null) // Snowflakes.Resume(); } +// ReSharper restore RedundantOverridenMember public override bool UpdateGame() { @@ -139,16 +141,18 @@ namespace Vocaluxe.Screens public override bool Draw() { - DrawBG(); + _DrawBG(); //if (Snowflakes == null) // Snowflakes = new CParticleEffect(300, new SColorF(1, 1, 1, 1), new SRectF(0, 0, CSettings.iRenderW, 0, 0.5f), "Snowflake", 25, EParticeType.Snow); //Snowflakes.Update(); //Snowflakes.Draw(); - DrawFG(); + _DrawFG(); +// ReSharper disable ConditionIsAlwaysTrueOrFalse if (CSettings.VersionRevision != ERevision.Release) +// ReSharper restore ConditionIsAlwaysTrueOrFalse { CFonts.SetFont("Normal"); CFonts.Style = EStyle.Normal; @@ -158,6 +162,7 @@ namespace Vocaluxe.Screens return true; } +// ReSharper disable RedundantOverridenMember public override void OnClose() { base.OnClose(); @@ -165,5 +170,6 @@ namespace Vocaluxe.Screens //if (Snowflakes != null) // Snowflakes.Pause(); } +// ReSharper restore RedundantOverridenMember } } \ No newline at end of file diff --git a/Vocaluxe/Screens/CScreenNames.cs b/Vocaluxe/Screens/CScreenNames.cs index 2df5079d..12cead30 100644 --- a/Vocaluxe/Screens/CScreenNames.cs +++ b/Vocaluxe/Screens/CScreenNames.cs @@ -115,10 +115,10 @@ namespace Vocaluxe.Screens _PlayerNr[i] = i; for (int i = 0; i < CSettings.MaxNumPlayer; i++) - _OriginalPlayerAvatarTextures[i] = Statics[_StaticPlayerAvatar[i]].Texture; + _OriginalPlayerAvatarTextures[i] = _Statics[_StaticPlayerAvatar[i]].Texture; for (int i = 1; i <= CSettings.MaxNumPlayer; i++) - Equalizers["EqualizerPlayer" + i].ScreenHandles = true; + _Equalizers["EqualizerPlayer" + i].ScreenHandles = true; } public override bool HandleInput(SKeyEvent keyEvent) @@ -128,20 +128,20 @@ namespace Vocaluxe.Screens case Keys.Add: if (CConfig.NumPlayer + 1 <= CSettings.MaxNumPlayer) { - SelectSlides[_SelectSlidePlayerNumber].Selection = CConfig.NumPlayer; + _SelectSlides[_SelectSlidePlayerNumber].Selection = CConfig.NumPlayer; _UpdatePlayerNumber(); //Update Tiles-List - NameSelections[_NameSelection].UpdateList(); + _NameSelections[_NameSelection].UpdateList(); } break; case Keys.Subtract: if (CConfig.NumPlayer - 1 > 0) { - SelectSlides[_SelectSlidePlayerNumber].Selection = CConfig.NumPlayer - 2; + _SelectSlides[_SelectSlidePlayerNumber].Selection = CConfig.NumPlayer - 2; _UpdatePlayerNumber(); //Update Tiles-List - NameSelections[_NameSelection].UpdateList(); + _NameSelections[_NameSelection].UpdateList(); } break; @@ -157,7 +157,7 @@ namespace Vocaluxe.Screens _SelectingKeyboardPlayerNr++; else _SelectingKeyboardPlayerNr = 1; - NameSelections[_NameSelection].KeyboardSelection(true, _SelectingKeyboardPlayerNr); + _NameSelections[_NameSelection].KeyboardSelection(true, _SelectingKeyboardPlayerNr); } break; } @@ -165,14 +165,14 @@ namespace Vocaluxe.Screens if (_SelectingKeyboardActive) { //Handle left/right/up/down - NameSelections[_NameSelection].HandleInput(keyEvent); + _NameSelections[_NameSelection].HandleInput(keyEvent); switch (keyEvent.Key) { case Keys.Enter: //Check, if a player is selected - if (NameSelections[_NameSelection].Selection > -1) + if (_NameSelections[_NameSelection].Selection > -1) { - _SelectedPlayerNr = NameSelections[_NameSelection].Selection; + _SelectedPlayerNr = _NameSelections[_NameSelection].Selection; //Update Game-infos with new player CGame.Player[_SelectingKeyboardPlayerNr - 1].Name = CProfiles.Profiles[_SelectedPlayerNr].PlayerName; CGame.Player[_SelectingKeyboardPlayerNr - 1].Difficulty = CProfiles.Profiles[_SelectedPlayerNr].Difficulty; @@ -181,13 +181,13 @@ namespace Vocaluxe.Screens CConfig.Players[_SelectingKeyboardPlayerNr - 1] = CProfiles.Profiles[_SelectedPlayerNr].ProfileFile; CConfig.SaveConfig(); //Update texture and name - Statics[_StaticPlayerAvatar[_SelectingKeyboardPlayerNr - 1]].Texture = CProfiles.Profiles[_SelectedPlayerNr].Avatar.Texture; - Texts[_TextPlayer[_SelectingKeyboardPlayerNr - 1]].Text = CProfiles.Profiles[_SelectedPlayerNr].PlayerName; + _Statics[_StaticPlayerAvatar[_SelectingKeyboardPlayerNr - 1]].Texture = CProfiles.Profiles[_SelectedPlayerNr].Avatar.Texture; + _Texts[_TextPlayer[_SelectingKeyboardPlayerNr - 1]].Text = CProfiles.Profiles[_SelectedPlayerNr].PlayerName; //Update profile-warning _CheckPlayers(); //Update Tiles-List - NameSelections[_NameSelection].UpdateList(); - SetInteractionToButton(Buttons[_ButtonStart]); + _NameSelections[_NameSelection].UpdateList(); + _SetInteractionToButton(_Buttons[_ButtonStart]); } //Started selecting with 'P' if (_SelectingKeyboardUnendless) @@ -197,12 +197,12 @@ namespace Vocaluxe.Screens //Reset all values _SelectingKeyboardPlayerNr = 0; _SelectingKeyboardActive = false; - NameSelections[_NameSelection].KeyboardSelection(false, -1); + _NameSelections[_NameSelection].KeyboardSelection(false, -1); } else { _SelectingKeyboardPlayerNr++; - NameSelections[_NameSelection].KeyboardSelection(true, _SelectingKeyboardPlayerNr); + _NameSelections[_NameSelection].KeyboardSelection(true, _SelectingKeyboardPlayerNr); } } else @@ -210,7 +210,7 @@ namespace Vocaluxe.Screens //Reset all values _SelectingKeyboardPlayerNr = 0; _SelectingKeyboardActive = false; - NameSelections[_NameSelection].KeyboardSelection(false, -1); + _NameSelections[_NameSelection].KeyboardSelection(false, -1); } break; @@ -221,12 +221,12 @@ namespace Vocaluxe.Screens //Reset all values _SelectingKeyboardPlayerNr = 0; _SelectingKeyboardActive = false; - NameSelections[_NameSelection].KeyboardSelection(false, -1); + _NameSelections[_NameSelection].KeyboardSelection(false, -1); } else { _SelectingKeyboardPlayerNr = 1; - NameSelections[_NameSelection].KeyboardSelection(true, 1); + _NameSelections[_NameSelection].KeyboardSelection(true, 1); } _SelectingKeyboardUnendless = false; break; @@ -237,12 +237,12 @@ namespace Vocaluxe.Screens //Reset all values _SelectingKeyboardPlayerNr = 0; _SelectingKeyboardActive = false; - NameSelections[_NameSelection].KeyboardSelection(false, -1); + _NameSelections[_NameSelection].KeyboardSelection(false, -1); } else { _SelectingKeyboardPlayerNr = 2; - NameSelections[_NameSelection].KeyboardSelection(true, 2); + _NameSelections[_NameSelection].KeyboardSelection(true, 2); } _SelectingKeyboardUnendless = false; break; @@ -253,12 +253,12 @@ namespace Vocaluxe.Screens //Reset all values _SelectingKeyboardPlayerNr = 0; _SelectingKeyboardActive = false; - NameSelections[_NameSelection].KeyboardSelection(false, -1); + _NameSelections[_NameSelection].KeyboardSelection(false, -1); } else { _SelectingKeyboardPlayerNr = 3; - NameSelections[_NameSelection].KeyboardSelection(true, 3); + _NameSelections[_NameSelection].KeyboardSelection(true, 3); } _SelectingKeyboardUnendless = false; break; @@ -269,12 +269,12 @@ namespace Vocaluxe.Screens //Reset all values _SelectingKeyboardPlayerNr = 0; _SelectingKeyboardActive = false; - NameSelections[_NameSelection].KeyboardSelection(false, -1); + _NameSelections[_NameSelection].KeyboardSelection(false, -1); } else { _SelectingKeyboardPlayerNr = 4; - NameSelections[_NameSelection].KeyboardSelection(true, 4); + _NameSelections[_NameSelection].KeyboardSelection(true, 4); } _SelectingKeyboardUnendless = false; break; @@ -285,12 +285,12 @@ namespace Vocaluxe.Screens //Reset all values _SelectingKeyboardPlayerNr = 0; _SelectingKeyboardActive = false; - NameSelections[_NameSelection].KeyboardSelection(false, -1); + _NameSelections[_NameSelection].KeyboardSelection(false, -1); } else { _SelectingKeyboardPlayerNr = 5; - NameSelections[_NameSelection].KeyboardSelection(true, 5); + _NameSelections[_NameSelection].KeyboardSelection(true, 5); } _SelectingKeyboardUnendless = false; break; @@ -301,12 +301,12 @@ namespace Vocaluxe.Screens //Reset all values _SelectingKeyboardPlayerNr = 0; _SelectingKeyboardActive = false; - NameSelections[_NameSelection].KeyboardSelection(false, -1); + _NameSelections[_NameSelection].KeyboardSelection(false, -1); } else { _SelectingKeyboardPlayerNr = 6; - NameSelections[_NameSelection].KeyboardSelection(true, 6); + _NameSelections[_NameSelection].KeyboardSelection(true, 6); } _SelectingKeyboardUnendless = false; break; @@ -316,7 +316,7 @@ namespace Vocaluxe.Screens _SelectingKeyboardPlayerNr = 0; _SelectingKeyboardActive = false; _SelectingKeyboardUnendless = false; - NameSelections[_NameSelection].KeyboardSelection(false, -1); + _NameSelections[_NameSelection].KeyboardSelection(false, -1); break; case Keys.Delete: @@ -328,31 +328,31 @@ namespace Vocaluxe.Screens CConfig.Players[_SelectingKeyboardPlayerNr - 1] = String.Empty; CConfig.SaveConfig(); //Update texture and name - Statics[_StaticPlayerAvatar[_SelectingKeyboardPlayerNr - 1]].Texture = _OriginalPlayerAvatarTextures[_SelectingKeyboardPlayerNr - 1]; - Texts[_TextPlayer[_SelectingKeyboardPlayerNr - 1]].Text = CLanguage.Translate("TR_SCREENNAMES_PLAYER") + " " + _SelectingKeyboardPlayerNr.ToString(); + _Statics[_StaticPlayerAvatar[_SelectingKeyboardPlayerNr - 1]].Texture = _OriginalPlayerAvatarTextures[_SelectingKeyboardPlayerNr - 1]; + _Texts[_TextPlayer[_SelectingKeyboardPlayerNr - 1]].Text = CLanguage.Translate("TR_SCREENNAMES_PLAYER") + " " + _SelectingKeyboardPlayerNr; //Update profile-warning _CheckPlayers(); //Reset all values _SelectingKeyboardPlayerNr = 0; _SelectingKeyboardActive = false; - NameSelections[_NameSelection].KeyboardSelection(false, -1); + _NameSelections[_NameSelection].KeyboardSelection(false, -1); //Update Tiles-List - NameSelections[_NameSelection].UpdateList(); + _NameSelections[_NameSelection].UpdateList(); break; case Keys.F10: if (CGame.GetNumSongs() == 1 && CGame.GetSong(1).IsDuet) { - if (SelectSlides[_SelectSlideDuetPlayer[_SelectingKeyboardPlayerNr - 1]].Selection == 0) - SelectSlides[_SelectSlideDuetPlayer[_SelectingKeyboardPlayerNr - 1]].Selection = 1; + if (_SelectSlides[_SelectSlideDuetPlayer[_SelectingKeyboardPlayerNr - 1]].Selection == 0) + _SelectSlides[_SelectSlideDuetPlayer[_SelectingKeyboardPlayerNr - 1]].Selection = 1; else - SelectSlides[_SelectSlideDuetPlayer[_SelectingKeyboardPlayerNr - 1]].Selection = 0; + _SelectSlides[_SelectSlideDuetPlayer[_SelectingKeyboardPlayerNr - 1]].Selection = 0; //Reset all values _SelectingKeyboardPlayerNr = 0; _SelectingKeyboardActive = false; _SelectingKeyboardUnendless = false; - NameSelections[_NameSelection].KeyboardSelection(false, -1); - SetInteractionToButton(Buttons[_ButtonStart]); + _NameSelections[_NameSelection].KeyboardSelection(false, -1); + _SetInteractionToButton(_Buttons[_ButtonStart]); } break; } @@ -371,13 +371,11 @@ namespace Vocaluxe.Screens case Keys.Enter: - if (!processed && Buttons[_ButtonBack].Selected) + if (_Buttons[_ButtonBack].Selected) { processed = true; CGraphics.FadeTo(EScreens.ScreenSong); - } - - if (!processed /* && Buttons[ButtonStart].Selected */) + }else { processed = true; _StartSong(); @@ -422,7 +420,7 @@ namespace Vocaluxe.Screens if (_SelectingKeyboardPlayerNr > 0 && _SelectingKeyboardPlayerNr <= CConfig.NumPlayer) { _SelectingKeyboardActive = true; - NameSelections[_NameSelection].KeyboardSelection(true, _SelectingKeyboardPlayerNr); + _NameSelections[_NameSelection].KeyboardSelection(true, _SelectingKeyboardPlayerNr); } } @@ -440,17 +438,17 @@ namespace Vocaluxe.Screens _OldMouseX = mouseEvent.X; _OldMouseY = mouseEvent.Y; //Check if mouse if over tile - if (NameSelections[_NameSelection].IsOverTile(mouseEvent)) + if (_NameSelections[_NameSelection].IsOverTile(mouseEvent)) { //Get player-number of tile - _SelectedPlayerNr = NameSelections[_NameSelection].TilePlayerNr(mouseEvent); + _SelectedPlayerNr = _NameSelections[_NameSelection].TilePlayerNr(mouseEvent); if (_SelectedPlayerNr != -1) { //Activate mouse-selecting _SelectingMouseActive = true; //Update of Drag/Drop-Texture - CStatic selectedPlayer = NameSelections[_NameSelection].TilePlayerAvatar(mouseEvent); + CStatic selectedPlayer = _NameSelections[_NameSelection].TilePlayerAvatar(mouseEvent); _ChooseAvatarStatic.Visible = true; _ChooseAvatarStatic.Rect = selectedPlayer.Rect; _ChooseAvatarStatic.Rect.Z = CSettings.ZNear; @@ -479,10 +477,10 @@ namespace Vocaluxe.Screens for (int i = 0; i < _StaticPlayer.Length; i++) { //Check first, if area is "ReplacedStr:::1:::" - if (Statics[_StaticPlayer[i]].Visible) + if (_Statics[_StaticPlayer[i]].Visible) { //Check if Mouse is in area - if (CHelper.IsInBounds(Statics[_StaticPlayer[i]].Rect, mouseEvent)) + if (CHelper.IsInBounds(_Statics[_StaticPlayer[i]].Rect, mouseEvent)) { //Update Game-infos with new player CGame.Player[i].Name = CProfiles.Profiles[_SelectedPlayerNr].PlayerName; @@ -492,12 +490,12 @@ namespace Vocaluxe.Screens CConfig.Players[i] = CProfiles.Profiles[_SelectedPlayerNr].ProfileFile; CConfig.SaveConfig(); //Update texture and name - Statics[_StaticPlayerAvatar[i]].Texture = _ChooseAvatarStatic.Texture; - Texts[_TextPlayer[i]].Text = CProfiles.Profiles[_SelectedPlayerNr].PlayerName; + _Statics[_StaticPlayerAvatar[i]].Texture = _ChooseAvatarStatic.Texture; + _Texts[_TextPlayer[i]].Text = CProfiles.Profiles[_SelectedPlayerNr].PlayerName; //Update profile-warning _CheckPlayers(); //Update Tiles-List - NameSelections[_NameSelection].UpdateList(); + _NameSelections[_NameSelection].UpdateList(); } } } @@ -508,28 +506,20 @@ namespace Vocaluxe.Screens _ChooseAvatarStatic.Visible = false; } - if (mouseEvent.LB && IsMouseOver(mouseEvent)) {} + if (mouseEvent.LB && _IsMouseOver(mouseEvent)) {} - if (mouseEvent.LB && IsMouseOver(mouseEvent)) + if (mouseEvent.LB && _IsMouseOver(mouseEvent)) { - bool processed = false; - - if (!processed && Buttons[_ButtonBack].Selected) + if (_Buttons[_ButtonBack].Selected) { - processed = true; CGraphics.FadeTo(EScreens.ScreenSong); - } - - if (!processed && Buttons[_ButtonStart].Selected) + }else if (_Buttons[_ButtonStart].Selected) { - processed = true; _StartSong(); - } - - if (!processed) + }else _UpdatePlayerNumber(); //Update Tiles-List - NameSelections[_NameSelection].UpdateList(); + _NameSelections[_NameSelection].UpdateList(); } if (mouseEvent.RB) @@ -538,7 +528,7 @@ namespace Vocaluxe.Screens //Remove profile-selection for (int i = 0; i < CConfig.NumPlayer; i++) { - if (CHelper.IsInBounds(Statics[_StaticPlayer[i]].Rect, mouseEvent)) + if (CHelper.IsInBounds(_Statics[_StaticPlayer[i]].Rect, mouseEvent)) { CGame.Player[i].ProfileID = -1; CGame.Player[i].Name = String.Empty; @@ -547,12 +537,12 @@ namespace Vocaluxe.Screens CConfig.Players[i] = String.Empty; CConfig.SaveConfig(); //Update texture and name - Statics[_StaticPlayerAvatar[i]].Texture = _OriginalPlayerAvatarTextures[i]; - Texts[_TextPlayer[i]].Text = CLanguage.Translate("TR_SCREENNAMES_PLAYER") + " " + (i + 1).ToString(); + _Statics[_StaticPlayerAvatar[i]].Texture = _OriginalPlayerAvatarTextures[i]; + _Texts[_TextPlayer[i]].Text = CLanguage.Translate("TR_SCREENNAMES_PLAYER") + " " + (i + 1); //Update profile-warning _CheckPlayers(); //Update Tiles-List - NameSelections[_NameSelection].UpdateList(); + _NameSelections[_NameSelection].UpdateList(); exit = false; } } @@ -563,10 +553,10 @@ namespace Vocaluxe.Screens //Check mouse-wheel for scrolling if (mouseEvent.Wheel != 0) { - if (CHelper.IsInBounds(NameSelections[_NameSelection].Rect, mouseEvent)) + if (CHelper.IsInBounds(_NameSelections[_NameSelection].Rect, mouseEvent)) { - int offset = NameSelections[_NameSelection].Offset + mouseEvent.Wheel; - NameSelections[_NameSelection].UpdateList(offset); + int offset = _NameSelections[_NameSelection].Offset + mouseEvent.Wheel; + _NameSelections[_NameSelection].UpdateList(offset); } } return true; @@ -577,7 +567,7 @@ namespace Vocaluxe.Screens for (int i = 1; i <= CGame.NumPlayer; i++) { CSound.AnalyzeBuffer(i - 1); - Equalizers["EqualizerPlayer" + i].Update(CSound.ToneWeigth(i - 1)); + _Equalizers["EqualizerPlayer" + i].Update(CSound.ToneWeigth(i - 1)); } return true; } @@ -587,7 +577,7 @@ namespace Vocaluxe.Screens base.OnShow(); CSound.RecordStart(); - NameSelections[_NameSelection].Init(); + _NameSelections[_NameSelection].Init(); _UpdateSlides(); _UpdatePlayerNumber(); @@ -601,29 +591,29 @@ namespace Vocaluxe.Screens { if (CGame.Player[i].ProfileID > -1 && CProfiles.NumProfiles > CGame.Player[i].ProfileID) { - Statics[_StaticPlayerAvatar[i]].Texture = CProfiles.Profiles[CGame.Player[i].ProfileID].Avatar.Texture; - Texts[_TextPlayer[i]].Text = CProfiles.Profiles[CGame.Player[i].ProfileID].PlayerName; + _Statics[_StaticPlayerAvatar[i]].Texture = CProfiles.Profiles[CGame.Player[i].ProfileID].Avatar.Texture; + _Texts[_TextPlayer[i]].Text = CProfiles.Profiles[CGame.Player[i].ProfileID].PlayerName; } } if (CGame.GetNumSongs() == 1 && CGame.GetSong(1).IsDuet) { - SelectSlides[_SelectSlideDuetPlayer[i]].Clear(); + _SelectSlides[_SelectSlideDuetPlayer[i]].Clear(); if (i + 1 <= CGame.NumPlayer) - SelectSlides[_SelectSlideDuetPlayer[i]].Visible = true; + _SelectSlides[_SelectSlideDuetPlayer[i]].Visible = true; else - SelectSlides[_SelectSlideDuetPlayer[i]].Visible = false; - SelectSlides[_SelectSlideDuetPlayer[i]].AddValue(CGame.GetSong(1).DuetPart1); - SelectSlides[_SelectSlideDuetPlayer[i]].AddValue(CGame.GetSong(1).DuetPart2); + _SelectSlides[_SelectSlideDuetPlayer[i]].Visible = false; + _SelectSlides[_SelectSlideDuetPlayer[i]].AddValue(CGame.GetSong(1).DuetPart1); + _SelectSlides[_SelectSlideDuetPlayer[i]].AddValue(CGame.GetSong(1).DuetPart2); if ((i + 1) % 2 == 0) - SelectSlides[_SelectSlideDuetPlayer[i]].Selection = 1; + _SelectSlides[_SelectSlideDuetPlayer[i]].Selection = 1; else - SelectSlides[_SelectSlideDuetPlayer[i]].Selection = 0; + _SelectSlides[_SelectSlideDuetPlayer[i]].Selection = 0; } else - SelectSlides[_SelectSlideDuetPlayer[i]].Visible = false; + _SelectSlides[_SelectSlideDuetPlayer[i]].Visible = false; } - SetInteractionToButton(Buttons[_ButtonStart]); + _SetInteractionToButton(_Buttons[_ButtonStart]); } public override void OnClose() @@ -639,7 +629,7 @@ namespace Vocaluxe.Screens if (_ChooseAvatarStatic.Visible) _ChooseAvatarStatic.Draw(); for (int i = 1; i <= CGame.NumPlayer; i++) - Equalizers["EqualizerPlayer" + i].Draw(); + _Equalizers["EqualizerPlayer" + i].Draw(); return true; } @@ -649,7 +639,7 @@ namespace Vocaluxe.Screens { if (CGame.Player[i].ProfileID < 0) { - CGame.Player[i].Name = "Player " + (i + 1).ToString(); + CGame.Player[i].Name = "Player " + (i + 1); CGame.Player[i].Difficulty = EGameDifficulty.TR_CONFIG_EASY; CGame.Player[i].ProfileID = -1; } @@ -660,7 +650,7 @@ namespace Vocaluxe.Screens CGame.Player[i].Name = ""; } if (CGame.GetNumSongs() == 1 && CGame.GetSong(1).IsDuet) - CGame.Player[i].LineNr = SelectSlides[_SelectSlideDuetPlayer[i]].Selection; + CGame.Player[i].LineNr = _SelectSlides[_SelectSlideDuetPlayer[i]].Selection; } CGraphics.FadeTo(EScreens.ScreenSing); @@ -668,36 +658,36 @@ namespace Vocaluxe.Screens private void _UpdateSlides() { - SelectSlides[_SelectSlidePlayerNumber].Clear(); + _SelectSlides[_SelectSlidePlayerNumber].Clear(); for (int i = 1; i <= CSettings.MaxNumPlayer; i++) - SelectSlides[_SelectSlidePlayerNumber].AddValue(CLanguage.Translate("TR_SCREENNAMES_" + i + "PLAYER")); - SelectSlides[_SelectSlidePlayerNumber].Selection = CConfig.NumPlayer - 1; + _SelectSlides[_SelectSlidePlayerNumber].AddValue(CLanguage.Translate("TR_SCREENNAMES_" + i + "PLAYER")); + _SelectSlides[_SelectSlidePlayerNumber].Selection = CConfig.NumPlayer - 1; } private void _UpdatePlayerNumber() { - CConfig.NumPlayer = SelectSlides[_SelectSlidePlayerNumber].Selection + 1; - CGame.NumPlayer = SelectSlides[_SelectSlidePlayerNumber].Selection + 1; + CConfig.NumPlayer = _SelectSlides[_SelectSlidePlayerNumber].Selection + 1; + CGame.NumPlayer = _SelectSlides[_SelectSlidePlayerNumber].Selection + 1; for (int i = 1; i <= CSettings.MaxNumPlayer; i++) { if (i <= CGame.NumPlayer) { - Statics["StaticPlayer" + i].Visible = true; - Statics["StaticPlayerAvatar" + i].Visible = true; - Texts["TextPlayer" + i].Visible = true; - if (Texts["TextPlayer" + i].Text.Length == 0) - Texts["TextPlayer" + i].Text = CLanguage.Translate("TR_SCREENNAMES_PLAYER") + " " + i.ToString(); - Equalizers["EqualizerPlayer" + i].Visible = true; + _Statics["StaticPlayer" + i].Visible = true; + _Statics["StaticPlayerAvatar" + i].Visible = true; + _Texts["TextPlayer" + i].Visible = true; + if (_Texts["TextPlayer" + i].Text.Length == 0) + _Texts["TextPlayer" + i].Text = CLanguage.Translate("TR_SCREENNAMES_PLAYER") + " " + i; + _Equalizers["EqualizerPlayer" + i].Visible = true; if (CGame.GetNumSongs() == 1 && CGame.GetSong(1).IsDuet) - SelectSlides["SelectSlideDuetPlayer" + i].Visible = true; + _SelectSlides["SelectSlideDuetPlayer" + i].Visible = true; } else { - Statics["StaticPlayer" + i].Visible = false; - Statics["StaticPlayerAvatar" + i].Visible = false; - Texts["TextPlayer" + i].Visible = false; - Equalizers["EqualizerPlayer" + i].Visible = false; - SelectSlides["SelectSlideDuetPlayer" + i].Visible = false; + _Statics["StaticPlayer" + i].Visible = false; + _Statics["StaticPlayerAvatar" + i].Visible = false; + _Texts["TextPlayer" + i].Visible = false; + _Equalizers["EqualizerPlayer" + i].Visible = false; + _SelectSlides["SelectSlideDuetPlayer" + i].Visible = false; } } CConfig.SaveConfig(); @@ -715,8 +705,8 @@ namespace Vocaluxe.Screens } if (playerWithoutMicro.Count > 0) { - Statics[_StaticWarningMics].Visible = true; - Texts[_TextWarningMics].Visible = true; + _Statics[_StaticWarningMics].Visible = true; + _Texts[_TextWarningMics].Visible = true; if (playerWithoutMicro.Count > 1) { @@ -726,20 +716,20 @@ namespace Vocaluxe.Screens if (playerWithoutMicro.Count - 1 == i) playerNums += playerWithoutMicro[i].ToString(); else if (playerWithoutMicro.Count - 2 == i) - playerNums += playerWithoutMicro[i].ToString() + " " + CLanguage.Translate("TR_GENERAL_AND") + " "; + playerNums += playerWithoutMicro[i] + " " + CLanguage.Translate("TR_GENERAL_AND") + " "; else - playerNums += playerWithoutMicro[i].ToString() + ", "; + playerNums += playerWithoutMicro[i] + ", "; } - Texts[_TextWarningMics].Text = CLanguage.Translate("TR_SCREENNAMES_WARNING_MICS_PL").Replace("%v", playerNums); + _Texts[_TextWarningMics].Text = CLanguage.Translate("TR_SCREENNAMES_WARNING_MICS_PL").Replace("%v", playerNums); } else - Texts[_TextWarningMics].Text = CLanguage.Translate("TR_SCREENNAMES_WARNING_MICS_SG").Replace("%v", playerWithoutMicro[0].ToString()); + _Texts[_TextWarningMics].Text = CLanguage.Translate("TR_SCREENNAMES_WARNING_MICS_SG").Replace("%v", playerWithoutMicro[0].ToString()); } else { - Statics[_StaticWarningMics].Visible = false; - Texts[_TextWarningMics].Visible = false; + _Statics[_StaticWarningMics].Visible = false; + _Texts[_TextWarningMics].Visible = false; } } @@ -754,8 +744,8 @@ namespace Vocaluxe.Screens if (playerWithoutProfile.Count > 0) { - Statics[_StaticWarningProfiles].Visible = true; - Texts[_TextWarningProfiles].Visible = true; + _Statics[_StaticWarningProfiles].Visible = true; + _Texts[_TextWarningProfiles].Visible = true; if (playerWithoutProfile.Count > 1) { @@ -765,20 +755,20 @@ namespace Vocaluxe.Screens if (playerWithoutProfile.Count - 1 == i) playerNums += playerWithoutProfile[i].ToString(); else if (playerWithoutProfile.Count - 2 == i) - playerNums += playerWithoutProfile[i].ToString() + " " + CLanguage.Translate("TR_GENERAL_AND") + " "; + playerNums += playerWithoutProfile[i] + " " + CLanguage.Translate("TR_GENERAL_AND") + " "; else - playerNums += playerWithoutProfile[i].ToString() + ", "; + playerNums += playerWithoutProfile[i] + ", "; } - Texts[_TextWarningProfiles].Text = CLanguage.Translate("TR_SCREENNAMES_WARNING_PROFILES_PL").Replace("%v", playerNums); + _Texts[_TextWarningProfiles].Text = CLanguage.Translate("TR_SCREENNAMES_WARNING_PROFILES_PL").Replace("%v", playerNums); } else - Texts[_TextWarningProfiles].Text = CLanguage.Translate("TR_SCREENNAMES_WARNING_PROFILES_SG").Replace("%v", playerWithoutProfile[0].ToString()); + _Texts[_TextWarningProfiles].Text = CLanguage.Translate("TR_SCREENNAMES_WARNING_PROFILES_SG").Replace("%v", playerWithoutProfile[0].ToString()); } else { - Statics[_StaticWarningProfiles].Visible = false; - Texts[_TextWarningProfiles].Visible = false; + _Statics[_StaticWarningProfiles].Visible = false; + _Texts[_TextWarningProfiles].Visible = false; } } } diff --git a/Vocaluxe/Screens/CScreenOptions.cs b/Vocaluxe/Screens/CScreenOptions.cs index 5c31b77b..ece463af 100644 --- a/Vocaluxe/Screens/CScreenOptions.cs +++ b/Vocaluxe/Screens/CScreenOptions.cs @@ -65,22 +65,22 @@ namespace Vocaluxe.Screens break; case Keys.Enter: - if (Buttons[_ButtonOptionsGame].Selected) + if (_Buttons[_ButtonOptionsGame].Selected) CGraphics.FadeTo(EScreens.ScreenOptionsGame); - if (Buttons[_ButtonOptionsSound].Selected) + if (_Buttons[_ButtonOptionsSound].Selected) CGraphics.FadeTo(EScreens.ScreenOptionsSound); - if (Buttons[_ButtonOptionsRecord].Selected) + if (_Buttons[_ButtonOptionsRecord].Selected) CGraphics.FadeTo(EScreens.ScreenOptionsRecord); - if (Buttons[_ButtonOptionsVideo].Selected) + if (_Buttons[_ButtonOptionsVideo].Selected) CGraphics.FadeTo(EScreens.ScreenOptionsVideo); - if (Buttons[_ButtonOptionsLyrics].Selected) + if (_Buttons[_ButtonOptionsLyrics].Selected) CGraphics.FadeTo(EScreens.ScreenOptionsLyrics); - if (Buttons[_ButtonOptionsTheme].Selected) + if (_Buttons[_ButtonOptionsTheme].Selected) CGraphics.FadeTo(EScreens.ScreenOptionsTheme); break; @@ -93,24 +93,24 @@ namespace Vocaluxe.Screens { base.HandleMouse(mouseEvent); - if (mouseEvent.LB && IsMouseOver(mouseEvent)) + if (mouseEvent.LB && _IsMouseOver(mouseEvent)) { - if (Buttons[_ButtonOptionsGame].Selected) + if (_Buttons[_ButtonOptionsGame].Selected) CGraphics.FadeTo(EScreens.ScreenOptionsGame); - if (Buttons[_ButtonOptionsSound].Selected) + if (_Buttons[_ButtonOptionsSound].Selected) CGraphics.FadeTo(EScreens.ScreenOptionsSound); - if (Buttons[_ButtonOptionsRecord].Selected) + if (_Buttons[_ButtonOptionsRecord].Selected) CGraphics.FadeTo(EScreens.ScreenOptionsRecord); - if (Buttons[_ButtonOptionsVideo].Selected) + if (_Buttons[_ButtonOptionsVideo].Selected) CGraphics.FadeTo(EScreens.ScreenOptionsVideo); - if (Buttons[_ButtonOptionsLyrics].Selected) + if (_Buttons[_ButtonOptionsLyrics].Selected) CGraphics.FadeTo(EScreens.ScreenOptionsLyrics); - if (Buttons[_ButtonOptionsTheme].Selected) + if (_Buttons[_ButtonOptionsTheme].Selected) CGraphics.FadeTo(EScreens.ScreenOptionsTheme); } diff --git a/Vocaluxe/Screens/CScreenOptionsGame.cs b/Vocaluxe/Screens/CScreenOptionsGame.cs index d510f3be..a350026a 100644 --- a/Vocaluxe/Screens/CScreenOptionsGame.cs +++ b/Vocaluxe/Screens/CScreenOptionsGame.cs @@ -52,14 +52,14 @@ namespace Vocaluxe.Screens { base.LoadTheme(xmlPath); - SelectSlides[_SelectSlideLanguage].AddValues(CLanguage.GetLanguageNames()); - SelectSlides[_SelectSlideLanguage].Selection = CLanguage.LanguageId; + _SelectSlides[_SelectSlideLanguage].AddValues(CLanguage.GetLanguageNames()); + _SelectSlides[_SelectSlideLanguage].Selection = CLanguage.LanguageId; - SelectSlides[_SelectSlideDebugLevel].SetValues((int)CConfig.DebugLevel); - SelectSlides[_SelectSlideSongMenu].SetValues((int)CConfig.SongMenu); - SelectSlides[_SelectSlideSongSorting].SetValues((int)CConfig.SongSorting); - SelectSlides[_SelectSlideTabs].SetValues((int)CConfig.Tabs); - SelectSlides[_SelectSlideTimerMode].SetValues((int)CConfig.TimerMode); + _SelectSlides[_SelectSlideDebugLevel].SetValues((int)CConfig.DebugLevel); + _SelectSlides[_SelectSlideSongMenu].SetValues((int)CConfig.SongMenu); + _SelectSlides[_SelectSlideSongSorting].SetValues((int)CConfig.SongSorting); + _SelectSlides[_SelectSlideTabs].SetValues((int)CConfig.Tabs); + _SelectSlides[_SelectSlideTimerMode].SetValues((int)CConfig.TimerMode); } public override bool HandleInput(SKeyEvent keyEvent) @@ -82,7 +82,7 @@ namespace Vocaluxe.Screens break; case Keys.Enter: - if (Buttons[_ButtonExit].Selected) + if (_Buttons[_ButtonExit].Selected) { _SaveConfig(); CGraphics.FadeTo(EScreens.ScreenOptions); @@ -111,10 +111,10 @@ namespace Vocaluxe.Screens CGraphics.FadeTo(EScreens.ScreenOptions); } - if (mouseEvent.LB && IsMouseOver(mouseEvent)) + if (mouseEvent.LB && _IsMouseOver(mouseEvent)) { _SaveConfig(); - if (Buttons[_ButtonExit].Selected) + if (_Buttons[_ButtonExit].Selected) CGraphics.FadeTo(EScreens.ScreenOptions); } return true; @@ -133,13 +133,13 @@ namespace Vocaluxe.Screens private void _SaveConfig() { - CLanguage.LanguageId = SelectSlides[_SelectSlideLanguage].Selection; + CLanguage.LanguageId = _SelectSlides[_SelectSlideLanguage].Selection; CConfig.Language = CLanguage.GetLanguageName(CLanguage.LanguageId); - CConfig.DebugLevel = (EDebugLevel)SelectSlides[_SelectSlideDebugLevel].Selection; - CConfig.SongMenu = (ESongMenu)SelectSlides[_SelectSlideSongMenu].Selection; - CConfig.SongSorting = (ESongSorting)SelectSlides[_SelectSlideSongSorting].Selection; - CConfig.Tabs = (EOffOn)SelectSlides[_SelectSlideTabs].Selection; - CConfig.TimerMode = (ETimerMode)SelectSlides[_SelectSlideTimerMode].Selection; + CConfig.DebugLevel = (EDebugLevel)_SelectSlides[_SelectSlideDebugLevel].Selection; + CConfig.SongMenu = (ESongMenu)_SelectSlides[_SelectSlideSongMenu].Selection; + CConfig.SongSorting = (ESongSorting)_SelectSlides[_SelectSlideSongSorting].Selection; + CConfig.Tabs = (EOffOn)_SelectSlides[_SelectSlideTabs].Selection; + CConfig.TimerMode = (ETimerMode)_SelectSlides[_SelectSlideTimerMode].Selection; CConfig.SaveConfig(); diff --git a/Vocaluxe/Screens/CScreenOptionsLyrics.cs b/Vocaluxe/Screens/CScreenOptionsLyrics.cs index 0fc760bd..718b9b2d 100644 --- a/Vocaluxe/Screens/CScreenOptionsLyrics.cs +++ b/Vocaluxe/Screens/CScreenOptionsLyrics.cs @@ -47,8 +47,8 @@ namespace Vocaluxe.Screens public override void LoadTheme(string xmlPath) { base.LoadTheme(xmlPath); - SelectSlides[_SelectSlideLyricStyle].SetValues((int)CConfig.LyricStyle); - SelectSlides[_SelectSlideLyricsOnTop].SetValues((int)CConfig.LyricsOnTop); + _SelectSlides[_SelectSlideLyricStyle].SetValues((int)CConfig.LyricStyle); + _SelectSlides[_SelectSlideLyricsOnTop].SetValues((int)CConfig.LyricsOnTop); } public override bool HandleInput(SKeyEvent keyEvent) @@ -72,7 +72,7 @@ namespace Vocaluxe.Screens break; case Keys.Enter: - if (Buttons[_ButtonExit].Selected) + if (_Buttons[_ButtonExit].Selected) { _SaveConfig(); CGraphics.FadeTo(EScreens.ScreenOptions); @@ -100,10 +100,10 @@ namespace Vocaluxe.Screens _SaveConfig(); CGraphics.FadeTo(EScreens.ScreenOptions); } - if (mouseEvent.LB && IsMouseOver(mouseEvent)) + if (mouseEvent.LB && _IsMouseOver(mouseEvent)) { _SaveConfig(); - if (Buttons[_ButtonExit].Selected) + if (_Buttons[_ButtonExit].Selected) CGraphics.FadeTo(EScreens.ScreenOptions); } return true; @@ -122,8 +122,8 @@ namespace Vocaluxe.Screens private void _SaveConfig() { - CConfig.LyricsOnTop = (EOffOn)SelectSlides[_SelectSlideLyricsOnTop].Selection; - CConfig.LyricStyle = (ELyricStyle)SelectSlides[_SelectSlideLyricStyle].Selection; + CConfig.LyricsOnTop = (EOffOn)_SelectSlides[_SelectSlideLyricsOnTop].Selection; + CConfig.LyricStyle = (ELyricStyle)_SelectSlides[_SelectSlideLyricStyle].Selection; CConfig.SaveConfig(); } } diff --git a/Vocaluxe/Screens/CScreenOptionsRecord.cs b/Vocaluxe/Screens/CScreenOptionsRecord.cs index c8c5d5dc..38f12ba0 100644 --- a/Vocaluxe/Screens/CScreenOptionsRecord.cs +++ b/Vocaluxe/Screens/CScreenOptionsRecord.cs @@ -94,31 +94,31 @@ namespace Vocaluxe.Screens if (max > 7) max = 7; - SelectSlides[_SelectSlideRecordChannel1].NumVisible = max; - SelectSlides[_SelectSlideRecordChannel2].NumVisible = max; + _SelectSlides[_SelectSlideRecordChannel1].NumVisible = max; + _SelectSlides[_SelectSlideRecordChannel2].NumVisible = max; - SelectSlides[_SelectSlideRecordChannel1].AddValue(CLanguage.Translate("TR_CONFIG_OFF")); - SelectSlides[_SelectSlideRecordChannel2].AddValue(CLanguage.Translate("TR_CONFIG_OFF")); + _SelectSlides[_SelectSlideRecordChannel1].AddValue(CLanguage.Translate("TR_CONFIG_OFF")); + _SelectSlides[_SelectSlideRecordChannel2].AddValue(CLanguage.Translate("TR_CONFIG_OFF")); for (int i = 1; i <= CSettings.MaxNumPlayer; i++) { - SelectSlides[_SelectSlideRecordChannel1].AddValue(i.ToString()); - SelectSlides[_SelectSlideRecordChannel2].AddValue(i.ToString()); + _SelectSlides[_SelectSlideRecordChannel1].AddValue(i.ToString()); + _SelectSlides[_SelectSlideRecordChannel2].AddValue(i.ToString()); } for (int i = 0; i < 26; i++) - SelectSlides[_SelectSlideDelay].AddValue((i * 20).ToString() + " ms"); + _SelectSlides[_SelectSlideDelay].AddValue((i * 20) + " ms"); _ChannelEnergy = new float[_StaticEnergyChannel.Length]; for (int i = 0; i < _ChannelEnergy.Length; i++) { - Statics[_StaticEnergyChannel[i]].Visible = false; + _Statics[_StaticEnergyChannel[i]].Visible = false; _ChannelEnergy[i] = 0f; } - Equalizers[_EqualizerChannel1].ScreenHandles = true; - Equalizers[_EqualizerChannel2].ScreenHandles = true; + _Equalizers[_EqualizerChannel1].ScreenHandles = true; + _Equalizers[_EqualizerChannel2].ScreenHandles = true; } public override bool HandleInput(SKeyEvent keyEvent) @@ -142,13 +142,13 @@ namespace Vocaluxe.Screens break; case Keys.Enter: - if (Buttons[_ButtonExit].Selected) + if (_Buttons[_ButtonExit].Selected) { _SaveMicConfig(); CGraphics.FadeTo(EScreens.ScreenOptions); } - if (Buttons[_ButtonDelayTest].Selected) + if (_Buttons[_ButtonDelayTest].Selected) _TestDelay(); break; @@ -158,32 +158,32 @@ namespace Vocaluxe.Screens break; case Keys.Left: - if (SelectSlides[_SelectSlideRecordDevices].Selected) + if (_SelectSlides[_SelectSlideRecordDevices].Selected) _OnDeviceEvent(); - if (SelectSlides[_SelectSlideRecordInputs].Selected) + if (_SelectSlides[_SelectSlideRecordInputs].Selected) _OnInputEvent(); - if (SelectSlides[_SelectSlideRecordChannel1].Selected || - SelectSlides[_SelectSlideRecordChannel2].Selected) + if (_SelectSlides[_SelectSlideRecordChannel1].Selected || + _SelectSlides[_SelectSlideRecordChannel2].Selected) _SetMicConfig(); - if (SelectSlides[_SelectSlideDelay].Selected) + if (_SelectSlides[_SelectSlideDelay].Selected) _SaveDelayConfig(); break; case Keys.Right: - if (SelectSlides[_SelectSlideRecordDevices].Selected) + if (_SelectSlides[_SelectSlideRecordDevices].Selected) _OnDeviceEvent(); - if (SelectSlides[_SelectSlideRecordInputs].Selected) + if (_SelectSlides[_SelectSlideRecordInputs].Selected) _OnInputEvent(); - if (SelectSlides[_SelectSlideRecordChannel1].Selected || - SelectSlides[_SelectSlideRecordChannel2].Selected) + if (_SelectSlides[_SelectSlideRecordChannel1].Selected || + _SelectSlides[_SelectSlideRecordChannel2].Selected) _SetMicConfig(); - if (SelectSlides[_SelectSlideDelay].Selected) + if (_SelectSlides[_SelectSlideDelay].Selected) _SaveDelayConfig(); break; } @@ -201,28 +201,28 @@ namespace Vocaluxe.Screens CGraphics.FadeTo(EScreens.ScreenOptions); } - if (mouseEvent.LB && IsMouseOver(mouseEvent)) + if (mouseEvent.LB && _IsMouseOver(mouseEvent)) { - if (SelectSlides[_SelectSlideRecordDevices].Selected) + if (_SelectSlides[_SelectSlideRecordDevices].Selected) _OnDeviceEvent(); - if (SelectSlides[_SelectSlideRecordInputs].Selected) + if (_SelectSlides[_SelectSlideRecordInputs].Selected) _OnInputEvent(); - if (SelectSlides[_SelectSlideRecordChannel1].Selected || - SelectSlides[_SelectSlideRecordChannel2].Selected) + if (_SelectSlides[_SelectSlideRecordChannel1].Selected || + _SelectSlides[_SelectSlideRecordChannel2].Selected) _SetMicConfig(); - if (SelectSlides[_SelectSlideDelay].Selected) + if (_SelectSlides[_SelectSlideDelay].Selected) _SaveDelayConfig(); - if (Buttons[_ButtonExit].Selected) + if (_Buttons[_ButtonExit].Selected) { _SaveMicConfig(); CGraphics.FadeTo(EScreens.ScreenOptions); } - if (Buttons[_ButtonDelayTest].Selected) + if (_Buttons[_ButtonDelayTest].Selected) _TestDelay(); } return true; @@ -249,10 +249,10 @@ namespace Vocaluxe.Screens { int player = 0; if (i == 0) - player = SelectSlides[_SelectSlideRecordChannel1].Selection; + player = _SelectSlides[_SelectSlideRecordChannel1].Selection; if (i == 1) - player = SelectSlides[_SelectSlideRecordChannel2].Selection; + player = _SelectSlides[_SelectSlideRecordChannel2].Selection; if (_DelayTest[i].Timer.ElapsedMilliseconds > _MaxDelayTime * 1000f || player == 0) { @@ -269,39 +269,39 @@ namespace Vocaluxe.Screens } } } - Texts[_TextDelayChannel1].Text = _DelayTest[0].Delay.ToString("000") + " ms"; - Texts[_TextDelayChannel2].Text = _DelayTest[1].Delay.ToString("000") + " ms"; + _Texts[_TextDelayChannel1].Text = _DelayTest[0].Delay.ToString("000") + " ms"; + _Texts[_TextDelayChannel2].Text = _DelayTest[1].Delay.ToString("000") + " ms"; } if (_CheckMicConfig()) { _ChannelEnergy[0] = 0f; - int player = SelectSlides[_SelectSlideRecordChannel1].Selection; + int player = _SelectSlides[_SelectSlideRecordChannel1].Selection; if (player > 0) { _ChannelEnergy[0] = CSound.RecordGetMaxVolume(player - 1); - Equalizers[_EqualizerChannel1].Update(CSound.ToneWeigth(player - 1)); + _Equalizers[_EqualizerChannel1].Update(CSound.ToneWeigth(player - 1)); } else - Equalizers[_EqualizerChannel1].Reset(); + _Equalizers[_EqualizerChannel1].Reset(); _ChannelEnergy[1] = 0f; - player = SelectSlides[_SelectSlideRecordChannel2].Selection; + player = _SelectSlides[_SelectSlideRecordChannel2].Selection; if (player > 0) { _ChannelEnergy[1] = CSound.RecordGetMaxVolume(player - 1); - Equalizers[_EqualizerChannel2].Update(CSound.ToneWeigth(player - 1)); + _Equalizers[_EqualizerChannel2].Update(CSound.ToneWeigth(player - 1)); } else - Equalizers[_EqualizerChannel2].Reset(); + _Equalizers[_EqualizerChannel2].Reset(); } else { for (int i = 0; i < _ChannelEnergy.Length; i++) _ChannelEnergy[i] = 0f; - Equalizers[_EqualizerChannel1].Reset(); - Equalizers[_EqualizerChannel2].Reset(); + _Equalizers[_EqualizerChannel1].Reset(); + _Equalizers[_EqualizerChannel2].Reset(); } return true; @@ -311,8 +311,8 @@ namespace Vocaluxe.Screens { base.OnShow(); - SelectSlides[_SelectSlideRecordDevices].Clear(); - SelectSlides[_SelectSlideRecordInputs].Clear(); + _SelectSlides[_SelectSlideRecordDevices].Clear(); + _SelectSlides[_SelectSlideRecordInputs].Clear(); for (int i = 0; i < _ChannelEnergy.Length; i++) _ChannelEnergy[i] = 0f; @@ -328,20 +328,20 @@ namespace Vocaluxe.Screens _GetFirstConfiguredRecordDevice(ref _DeviceNr, ref _InputNr); for (int dev = 0; dev < _Devices.Length; dev++) - SelectSlides[_SelectSlideRecordDevices].AddValue(_Devices[dev].Name); - SelectSlides[_SelectSlideRecordDevices].Selection = _DeviceNr; + _SelectSlides[_SelectSlideRecordDevices].AddValue(_Devices[dev].Name); + _SelectSlides[_SelectSlideRecordDevices].Selection = _DeviceNr; for (int inp = 0; inp < _Devices[0].Inputs.Count; inp++) - SelectSlides[_SelectSlideRecordInputs].AddValue(_Devices[0].Inputs[inp].Name); - SelectSlides[_SelectSlideRecordInputs].Selection = _InputNr; + _SelectSlides[_SelectSlideRecordInputs].AddValue(_Devices[0].Inputs[inp].Name); + _SelectSlides[_SelectSlideRecordInputs].Selection = _InputNr; _UpdateChannels(); } - SelectSlides[_SelectSlideRecordChannel1].Visible = _Devices != null; - SelectSlides[_SelectSlideRecordChannel2].Visible = _Devices != null; + _SelectSlides[_SelectSlideRecordChannel1].Visible = _Devices != null; + _SelectSlides[_SelectSlideRecordChannel2].Visible = _Devices != null; - Statics[_StaticWarning].Visible = false; - Texts[_TextWarning].Visible = false; + _Statics[_StaticWarning].Visible = false; + _Texts[_TextWarning].Visible = false; _DelayTest = null; if (_Devices != null) @@ -354,7 +354,7 @@ namespace Vocaluxe.Screens } } - SelectSlides[_SelectSlideDelay].Selection = CConfig.MicDelay / 20; + _SelectSlides[_SelectSlideDelay].Selection = CConfig.MicDelay / 20; _DelayTestRunning = false; _DelaySound = -1; @@ -368,38 +368,38 @@ namespace Vocaluxe.Screens public override bool Draw() { - DrawBG(); + _DrawBG(); if (!_CheckMicConfig()) { - Statics[_StaticWarning].Visible = true; - Texts[_TextWarning].Visible = true; + _Statics[_StaticWarning].Visible = true; + _Texts[_TextWarning].Visible = true; } else { - Statics[_StaticWarning].Visible = false; - Texts[_TextWarning].Visible = false; + _Statics[_StaticWarning].Visible = false; + _Texts[_TextWarning].Visible = false; } for (int i = 0; i < _StaticEnergyChannel.Length; i++) { if (_ChannelEnergy[i] > 0f) { - SRectF rect = new SRectF(Statics[_StaticEnergyChannel[i]].Rect.X, - Statics[_StaticEnergyChannel[i]].Rect.Y, - Statics[_StaticEnergyChannel[i]].Rect.W * _ChannelEnergy[i], - Statics[_StaticEnergyChannel[i]].Rect.H, - Statics[_StaticEnergyChannel[i]].Rect.Z); + SRectF rect = new SRectF(_Statics[_StaticEnergyChannel[i]].Rect.X, + _Statics[_StaticEnergyChannel[i]].Rect.Y, + _Statics[_StaticEnergyChannel[i]].Rect.W * _ChannelEnergy[i], + _Statics[_StaticEnergyChannel[i]].Rect.H, + _Statics[_StaticEnergyChannel[i]].Rect.Z); - CDraw.DrawTexture(Statics[_StaticEnergyChannel[i]].Texture, Statics[_StaticEnergyChannel[i]].Rect, + CDraw.DrawTexture(_Statics[_StaticEnergyChannel[i]].Texture, _Statics[_StaticEnergyChannel[i]].Rect, new SColorF(1f, 1f, 1f, 1f), rect); } } - Equalizers[_EqualizerChannel1].Draw(); - Equalizers[_EqualizerChannel2].Draw(); + _Equalizers[_EqualizerChannel1].Draw(); + _Equalizers[_EqualizerChannel2].Draw(); - DrawFG(); + _DrawFG(); return true; } @@ -415,25 +415,25 @@ namespace Vocaluxe.Screens private void _OnDeviceEvent() { - if (SelectSlides[_SelectSlideRecordDevices].Selection != _DeviceNr) + if (_SelectSlides[_SelectSlideRecordDevices].Selection != _DeviceNr) { - SelectSlides[_SelectSlideRecordInputs].Clear(); - _DeviceNr = SelectSlides[_SelectSlideRecordDevices].Selection; + _SelectSlides[_SelectSlideRecordInputs].Clear(); + _DeviceNr = _SelectSlides[_SelectSlideRecordDevices].Selection; _InputNr = 0; for (int inp = 0; inp < _Devices[_DeviceNr].Inputs.Count; inp++) - SelectSlides[_SelectSlideRecordInputs].AddValue(_Devices[_DeviceNr].Inputs[inp].Name); + _SelectSlides[_SelectSlideRecordInputs].AddValue(_Devices[_DeviceNr].Inputs[inp].Name); _InputNr = 0; - SelectSlides[_SelectSlideRecordInputs].Selection = 0; + _SelectSlides[_SelectSlideRecordInputs].Selection = 0; _UpdateChannels(); } } private void _OnInputEvent() { - if (SelectSlides[_SelectSlideRecordInputs].Selection != _InputNr) + if (_SelectSlides[_SelectSlideRecordInputs].Selection != _InputNr) { - _InputNr = SelectSlides[_SelectSlideRecordInputs].Selection; + _InputNr = _SelectSlides[_SelectSlideRecordInputs].Selection; _UpdateChannels(); } @@ -441,7 +441,7 @@ namespace Vocaluxe.Screens private void _SaveDelayConfig() { - CConfig.MicDelay = SelectSlides[_SelectSlideDelay].Selection * 20; + CConfig.MicDelay = _SelectSlides[_SelectSlideDelay].Selection * 20; CConfig.SaveConfig(); } @@ -489,15 +489,15 @@ namespace Vocaluxe.Screens if (_DeviceNr < 0) return; SInput input = _Devices[_DeviceNr].Inputs[_InputNr]; - input.PlayerChannel1 = SelectSlides[_SelectSlideRecordChannel1].Selection; - input.PlayerChannel2 = SelectSlides[_SelectSlideRecordChannel2].Selection; + input.PlayerChannel1 = _SelectSlides[_SelectSlideRecordChannel1].Selection; + input.PlayerChannel2 = _SelectSlides[_SelectSlideRecordChannel2].Selection; _Devices[_DeviceNr].Inputs[_InputNr] = input; } private void _UpdateChannels() { - SelectSlides[_SelectSlideRecordChannel1].Selection = _Devices[_DeviceNr].Inputs[_InputNr].PlayerChannel1; - SelectSlides[_SelectSlideRecordChannel2].Selection = _Devices[_DeviceNr].Inputs[_InputNr].PlayerChannel2; + _SelectSlides[_SelectSlideRecordChannel1].Selection = _Devices[_DeviceNr].Inputs[_InputNr].PlayerChannel1; + _SelectSlides[_SelectSlideRecordChannel2].Selection = _Devices[_DeviceNr].Inputs[_InputNr].PlayerChannel2; _SaveMicConfig(); } diff --git a/Vocaluxe/Screens/CScreenOptionsSound.cs b/Vocaluxe/Screens/CScreenOptionsSound.cs index ce5f8bc5..370b0694 100644 --- a/Vocaluxe/Screens/CScreenOptionsSound.cs +++ b/Vocaluxe/Screens/CScreenOptionsSound.cs @@ -54,18 +54,18 @@ namespace Vocaluxe.Screens public override void LoadTheme(string xmlPath) { base.LoadTheme(xmlPath); - SelectSlides[_SelectSlideBackgroundMusic].SetValues((int)CConfig.BackgroundMusic); - SelectSlides[_SelectSlideBackgroundMusicVolume].AddValues(new string[] + _SelectSlides[_SelectSlideBackgroundMusic].SetValues((int)CConfig.BackgroundMusic); + _SelectSlides[_SelectSlideBackgroundMusicVolume].AddValues(new string[] {"0", "5", "10", "15", "20", "25", "30", "35", "40", "45", "50", "55", "60", "65", "70", "75", "80", "85", "90", "95", "100"}); - SelectSlides[_SelectSlideBackgroundMusicVolume].Selection = CConfig.BackgroundMusicVolume / 5; - SelectSlides[_SelectSlideBackgroundMusicSource].SetValues((int)CConfig.BackgroundMusicSource); - SelectSlides[_SelectSlideBackgroundMusicSource].Selection = (int)CConfig.BackgroundMusicSource; - SelectSlides[_SelectSlidePreviewMusicVolume].AddValues(new string[] + _SelectSlides[_SelectSlideBackgroundMusicVolume].Selection = CConfig.BackgroundMusicVolume / 5; + _SelectSlides[_SelectSlideBackgroundMusicSource].SetValues((int)CConfig.BackgroundMusicSource); + _SelectSlides[_SelectSlideBackgroundMusicSource].Selection = (int)CConfig.BackgroundMusicSource; + _SelectSlides[_SelectSlidePreviewMusicVolume].AddValues(new string[] {"0", "5", "10", "15", "20", "25", "30", "35", "40", "45", "50", "55", "60", "65", "70", "75", "80", "85", "90", "95", "100"}); - SelectSlides[_SelectSlidePreviewMusicVolume].Selection = CConfig.PreviewMusicVolume / 5; - SelectSlides[_SelectSlideGameMusicVolume].AddValues(new string[] + _SelectSlides[_SelectSlidePreviewMusicVolume].Selection = CConfig.PreviewMusicVolume / 5; + _SelectSlides[_SelectSlideGameMusicVolume].AddValues(new string[] {"0", "5", "10", "15", "20", "25", "30", "35", "40", "45", "50", "55", "60", "65", "70", "75", "80", "85", "90", "95", "100"}); - SelectSlides[_SelectSlideGameMusicVolume].Selection = CConfig.GameMusicVolume / 5; + _SelectSlides[_SelectSlideGameMusicVolume].Selection = CConfig.GameMusicVolume / 5; } public override bool HandleInput(SKeyEvent keyEvent) @@ -89,7 +89,7 @@ namespace Vocaluxe.Screens break; case Keys.Enter: - if (Buttons[_ButtonExit].Selected) + if (_Buttons[_ButtonExit].Selected) { _SaveConfig(); CGraphics.FadeTo(EScreens.ScreenOptions); @@ -117,10 +117,10 @@ namespace Vocaluxe.Screens _SaveConfig(); CGraphics.FadeTo(EScreens.ScreenOptions); } - if (mouseEvent.LB && IsMouseOver(mouseEvent)) + if (mouseEvent.LB && _IsMouseOver(mouseEvent)) { _SaveConfig(); - if (Buttons[_ButtonExit].Selected) + if (_Buttons[_ButtonExit].Selected) CGraphics.FadeTo(EScreens.ScreenOptions); } return true; @@ -129,7 +129,7 @@ namespace Vocaluxe.Screens public override bool UpdateGame() { if (_BackgroundMusicVolume != CConfig.BackgroundMusicVolume) - SelectSlides[_SelectSlideBackgroundMusicVolume].Selection = CConfig.BackgroundMusicVolume / 5; + _SelectSlides[_SelectSlideBackgroundMusicVolume].Selection = CConfig.BackgroundMusicVolume / 5; return true; } @@ -145,19 +145,19 @@ namespace Vocaluxe.Screens _BackgroundMusic = CConfig.BackgroundMusic; _BackgroundMusicVolume = CConfig.BackgroundMusicVolume; - SelectSlides[_SelectSlideGameMusicVolume].Selection = CConfig.GameMusicVolume / 5; - SelectSlides[_SelectSlidePreviewMusicVolume].Selection = CConfig.PreviewMusicVolume / 5; + _SelectSlides[_SelectSlideGameMusicVolume].Selection = CConfig.GameMusicVolume / 5; + _SelectSlides[_SelectSlidePreviewMusicVolume].Selection = CConfig.PreviewMusicVolume / 5; } private void _SaveConfig() { - CConfig.GameMusicVolume = SelectSlides[_SelectSlideGameMusicVolume].Selection * 5; - CConfig.PreviewMusicVolume = SelectSlides[_SelectSlidePreviewMusicVolume].Selection * 5; + CConfig.GameMusicVolume = _SelectSlides[_SelectSlideGameMusicVolume].Selection * 5; + CConfig.PreviewMusicVolume = _SelectSlides[_SelectSlidePreviewMusicVolume].Selection * 5; CConfig.SaveConfig(); - EOffOn newOffOn = (EOffOn)SelectSlides[_SelectSlideBackgroundMusic].Selection; - EBackgroundMusicSource newSource = (EBackgroundMusicSource)SelectSlides[_SelectSlideBackgroundMusicSource].Selection; - float newVolume = SelectSlides[_SelectSlideBackgroundMusicVolume].Selection * 5; + EOffOn newOffOn = (EOffOn)_SelectSlides[_SelectSlideBackgroundMusic].Selection; + EBackgroundMusicSource newSource = (EBackgroundMusicSource)_SelectSlides[_SelectSlideBackgroundMusicSource].Selection; + float newVolume = _SelectSlides[_SelectSlideBackgroundMusicVolume].Selection * 5; CBackgroundMusic.CheckAndApplyConfig(newOffOn, newSource, newVolume); } diff --git a/Vocaluxe/Screens/CScreenOptionsTheme.cs b/Vocaluxe/Screens/CScreenOptionsTheme.cs index 44e98e21..199170c8 100644 --- a/Vocaluxe/Screens/CScreenOptionsTheme.cs +++ b/Vocaluxe/Screens/CScreenOptionsTheme.cs @@ -71,19 +71,19 @@ namespace Vocaluxe.Screens { base.LoadTheme(xmlPath); - SelectSlides[_SelectSlideTheme].AddValues(CTheme.ThemeNames); - SelectSlides[_SelectSlideTheme].Selection = CTheme.GetThemeIndex(-1); + _SelectSlides[_SelectSlideTheme].AddValues(CTheme.ThemeNames); + _SelectSlides[_SelectSlideTheme].Selection = CTheme.GetThemeIndex(-1); - SelectSlides[_SelectSlideSkin].AddValues(CTheme.SkinNames); - SelectSlides[_SelectSlideSkin].Selection = CTheme.GetSkinIndex(-1); + _SelectSlides[_SelectSlideSkin].AddValues(CTheme.SkinNames); + _SelectSlides[_SelectSlideSkin].Selection = CTheme.GetSkinIndex(-1); - SelectSlides[_SelectSlideCover].AddValues(CCover.CoverThemes); - SelectSlides[_SelectSlideCover].Selection = CCover.GetCoverThemeIndex(); - SelectSlides[_SelectSlideNoteLines].SetValues((int)CConfig.DrawNoteLines); - SelectSlides[_SelectSlideToneHelper].SetValues((int)CConfig.DrawToneHelper); - SelectSlides[_SelectSlideTimerLook].SetValues((int)CConfig.TimerLook); - SelectSlides[_SelectSlideFadeInfo].SetValues((int)CConfig.FadePlayerInfo); - SelectSlides[_SelectSlideCoverLoading].SetValues((int)CConfig.CoverLoading); + _SelectSlides[_SelectSlideCover].AddValues(CCover.CoverThemes); + _SelectSlides[_SelectSlideCover].Selection = CCover.GetCoverThemeIndex(); + _SelectSlides[_SelectSlideNoteLines].SetValues((int)CConfig.DrawNoteLines); + _SelectSlides[_SelectSlideToneHelper].SetValues((int)CConfig.DrawToneHelper); + _SelectSlides[_SelectSlideTimerLook].SetValues((int)CConfig.TimerLook); + _SelectSlides[_SelectSlideFadeInfo].SetValues((int)CConfig.FadePlayerInfo); + _SelectSlides[_SelectSlideCoverLoading].SetValues((int)CConfig.CoverLoading); } public override bool HandleInput(SKeyEvent keyEvent) @@ -106,7 +106,7 @@ namespace Vocaluxe.Screens break; case Keys.Enter: - if (Buttons[_ButtonExit].Selected) + if (_Buttons[_ButtonExit].Selected) _Close(); break; @@ -129,9 +129,9 @@ namespace Vocaluxe.Screens if (mouseEvent.RB) _Close(); - if (mouseEvent.LB && IsMouseOver(mouseEvent)) + if (mouseEvent.LB && _IsMouseOver(mouseEvent)) { - if (Buttons[_ButtonExit].Selected) + if (_Buttons[_ButtonExit].Selected) _Close(); else _OnChange(); @@ -168,18 +168,18 @@ namespace Vocaluxe.Screens private void _SaveConfig() { - CConfig.Theme = CTheme.ThemeNames[SelectSlides[_SelectSlideTheme].Selection]; - CConfig.Skin = CTheme.SkinNames[SelectSlides[_SelectSlideSkin].Selection]; - CConfig.CoverTheme = CCover.CoverThemes[SelectSlides[_SelectSlideCover].Selection]; - CConfig.DrawNoteLines = (EOffOn)SelectSlides[_SelectSlideNoteLines].Selection; - CConfig.DrawToneHelper = (EOffOn)SelectSlides[_SelectSlideToneHelper].Selection; - CConfig.TimerLook = (ETimerLook)SelectSlides[_SelectSlideTimerLook].Selection; - CConfig.FadePlayerInfo = (EFadePlayerInfo)SelectSlides[_SelectSlideFadeInfo].Selection; - CConfig.CoverLoading = (ECoverLoading)SelectSlides[_SelectSlideCoverLoading].Selection; + CConfig.Theme = CTheme.ThemeNames[_SelectSlides[_SelectSlideTheme].Selection]; + CConfig.Skin = CTheme.SkinNames[_SelectSlides[_SelectSlideSkin].Selection]; + CConfig.CoverTheme = CCover.CoverThemes[_SelectSlides[_SelectSlideCover].Selection]; + CConfig.DrawNoteLines = (EOffOn)_SelectSlides[_SelectSlideNoteLines].Selection; + CConfig.DrawToneHelper = (EOffOn)_SelectSlides[_SelectSlideToneHelper].Selection; + CConfig.TimerLook = (ETimerLook)_SelectSlides[_SelectSlideTimerLook].Selection; + CConfig.FadePlayerInfo = (EFadePlayerInfo)_SelectSlides[_SelectSlideFadeInfo].Selection; + CConfig.CoverLoading = (ECoverLoading)_SelectSlides[_SelectSlideCoverLoading].Selection; CConfig.SaveConfig(); - if (_OldCoverTheme != SelectSlides[_SelectSlideCover].Selection) + if (_OldCoverTheme != _SelectSlides[_SelectSlideCover].Selection) { CCover.ReloadCover(); CSongs.Filter.SearchString = String.Empty; @@ -187,10 +187,10 @@ namespace Vocaluxe.Screens CSongs.Categorizer.Tabs = CConfig.Tabs; } - if (_OldTheme != SelectSlides[_SelectSlideTheme].Selection) + if (_OldTheme != _SelectSlides[_SelectSlideTheme].Selection) { - CConfig.Theme = CTheme.ThemeNames[SelectSlides[_SelectSlideTheme].Selection]; - _OldTheme = SelectSlides[_SelectSlideTheme].Selection; + CConfig.Theme = CTheme.ThemeNames[_SelectSlides[_SelectSlideTheme].Selection]; + _OldTheme = _SelectSlides[_SelectSlideTheme].Selection; CTheme.UnloadSkins(); CFonts.UnloadThemeFonts(CConfig.Theme); @@ -204,16 +204,15 @@ namespace Vocaluxe.Screens CTheme.LoadSkins(); CTheme.LoadTheme(); CGraphics.ReloadTheme(); - return; } } private void _OnChange() { - if (_OldTheme != SelectSlides[_SelectSlideTheme].Selection) + if (_OldTheme != _SelectSlides[_SelectSlideTheme].Selection) { - CConfig.Theme = CTheme.ThemeNames[SelectSlides[_SelectSlideTheme].Selection]; - _OldTheme = SelectSlides[_SelectSlideTheme].Selection; + CConfig.Theme = CTheme.ThemeNames[_SelectSlides[_SelectSlideTheme].Selection]; + _OldTheme = _SelectSlides[_SelectSlideTheme].Selection; CTheme.UnloadSkins(); CFonts.UnloadThemeFonts(CConfig.Theme); @@ -233,9 +232,9 @@ namespace Vocaluxe.Screens return; } - if (_TempSkin != SelectSlides[_SelectSlideSkin].Selection) + if (_TempSkin != _SelectSlides[_SelectSlideSkin].Selection) { - _TempSkin = SelectSlides[_SelectSlideSkin].Selection; + _TempSkin = _SelectSlides[_SelectSlideSkin].Selection; _PauseBG(); CConfig.Skin = CTheme.SkinNames[_TempSkin]; diff --git a/Vocaluxe/Screens/CScreenOptionsVideo.cs b/Vocaluxe/Screens/CScreenOptionsVideo.cs index 1d972957..7583df7b 100644 --- a/Vocaluxe/Screens/CScreenOptionsVideo.cs +++ b/Vocaluxe/Screens/CScreenOptionsVideo.cs @@ -66,10 +66,10 @@ namespace Vocaluxe.Screens { base.LoadTheme(xmlPath); - SelectSlides[_SelectSlideVideoBackgrounds].SetValues((int)CConfig.VideoBackgrounds); - SelectSlides[_SelectSlideVideoPreview].SetValues((int)CConfig.VideoPreview); - SelectSlides[_SelectSlideVideosInSongs].SetValues((int)CConfig.VideosInSongs); - SelectSlides[_SelectSlideVideosToBackground].SetValues((int)CConfig.VideosToBackground); + _SelectSlides[_SelectSlideVideoBackgrounds].SetValues((int)CConfig.VideoBackgrounds); + _SelectSlides[_SelectSlideVideoPreview].SetValues((int)CConfig.VideoPreview); + _SelectSlides[_SelectSlideVideosInSongs].SetValues((int)CConfig.VideosInSongs); + _SelectSlides[_SelectSlideVideosToBackground].SetValues((int)CConfig.VideosToBackground); } public override bool HandleInput(SKeyEvent keyEvent) @@ -93,7 +93,7 @@ namespace Vocaluxe.Screens break; case Keys.Enter: - if (Buttons[_ButtonExit].Selected) + if (_Buttons[_ButtonExit].Selected) { _SaveConfig(); CGraphics.FadeTo(EScreens.ScreenOptions); @@ -101,17 +101,17 @@ namespace Vocaluxe.Screens break; case Keys.Left: - if (SelectSlides[_SelectSlideWebcamDevices].Selected) + if (_SelectSlides[_SelectSlideWebcamDevices].Selected) _OnDeviceEvent(); - if (SelectSlides[_SelectSlideWebcamCapabilities].Selected) + if (_SelectSlides[_SelectSlideWebcamCapabilities].Selected) _OnCapabilitiesEvent(); _SaveConfig(); break; case Keys.Right: - if (SelectSlides[_SelectSlideWebcamDevices].Selected) + if (_SelectSlides[_SelectSlideWebcamDevices].Selected) _OnDeviceEvent(); - if (SelectSlides[_SelectSlideWebcamCapabilities].Selected) + if (_SelectSlides[_SelectSlideWebcamCapabilities].Selected) _OnCapabilitiesEvent(); _SaveConfig(); break; @@ -130,14 +130,14 @@ namespace Vocaluxe.Screens CGraphics.FadeTo(EScreens.ScreenOptions); } - if (mouseEvent.LB && IsMouseOver(mouseEvent)) + if (mouseEvent.LB && _IsMouseOver(mouseEvent)) { - if (SelectSlides[_SelectSlideWebcamDevices].Selected) + if (_SelectSlides[_SelectSlideWebcamDevices].Selected) _OnDeviceEvent(); - if (SelectSlides[_SelectSlideWebcamCapabilities].Selected) + if (_SelectSlides[_SelectSlideWebcamCapabilities].Selected) _OnCapabilitiesEvent(); _SaveConfig(); - if (Buttons[_ButtonExit].Selected) + if (_Buttons[_ButtonExit].Selected) CGraphics.FadeTo(EScreens.ScreenOptions); } return true; @@ -146,8 +146,8 @@ namespace Vocaluxe.Screens public override bool UpdateGame() { CWebcam.GetFrame(ref _WebcamTexture); - Statics[_StaticWebcamOutput].Texture = _WebcamTexture; - SelectSlides[_SelectSlideVideosToBackground].Selection = (int)CConfig.VideosToBackground; + _Statics[_StaticWebcamOutput].Texture = _WebcamTexture; + _SelectSlides[_SelectSlideVideosToBackground].Selection = (int)CConfig.VideosToBackground; return true; } @@ -167,8 +167,8 @@ namespace Vocaluxe.Screens public override void OnShow() { base.OnShow(); - SelectSlides[_SelectSlideWebcamDevices].Clear(); - SelectSlides[_SelectSlideWebcamCapabilities].Clear(); + _SelectSlides[_SelectSlideWebcamDevices].Clear(); + _SelectSlides[_SelectSlideWebcamCapabilities].Clear(); _DeviceNr = -1; _CapabilityNr = -1; @@ -186,16 +186,16 @@ namespace Vocaluxe.Screens _GetFirstConfiguredWebcamDevice(ref _DeviceNr, ref _CapabilityNr); foreach (SWebcamDevice d in devices) - SelectSlides[_SelectSlideWebcamDevices].AddValue(d.Name); - SelectSlides[_SelectSlideWebcamDevices].Selection = _DeviceNr; + _SelectSlides[_SelectSlideWebcamDevices].AddValue(d.Name); + _SelectSlides[_SelectSlideWebcamDevices].Selection = _DeviceNr; foreach (SCapabilities c in devices[_DeviceNr].Capabilities) - SelectSlides[_SelectSlideWebcamCapabilities].AddValue(c.Width.ToString() + " x " + c.Height.ToString() + " @ " + c.Framerate.ToString() + " FPS "); - _Config.MonikerString = devices[SelectSlides[_SelectSlideWebcamDevices].Selection].MonikerString; - _Config.Width = devices[SelectSlides[_SelectSlideWebcamDevices].Selection].Capabilities[SelectSlides[_SelectSlideWebcamCapabilities].Selection].Width; - _Config.Height = devices[SelectSlides[_SelectSlideWebcamDevices].Selection].Capabilities[SelectSlides[_SelectSlideWebcamCapabilities].Selection].Height; + _SelectSlides[_SelectSlideWebcamCapabilities].AddValue(c.Width + " x " + c.Height + " @ " + c.Framerate + " FPS "); + _Config.MonikerString = devices[_SelectSlides[_SelectSlideWebcamDevices].Selection].MonikerString; + _Config.Width = devices[_SelectSlides[_SelectSlideWebcamDevices].Selection].Capabilities[_SelectSlides[_SelectSlideWebcamCapabilities].Selection].Width; + _Config.Height = devices[_SelectSlides[_SelectSlideWebcamDevices].Selection].Capabilities[_SelectSlides[_SelectSlideWebcamCapabilities].Selection].Height; _Config.Framerate = - devices[SelectSlides[_SelectSlideWebcamDevices].Selection].Capabilities[SelectSlides[_SelectSlideWebcamCapabilities].Selection].Framerate; + devices[_SelectSlides[_SelectSlideWebcamDevices].Selection].Capabilities[_SelectSlides[_SelectSlideWebcamCapabilities].Selection].Framerate; CWebcam.Close(); CWebcam.Select(CConfig.WebcamConfig); CWebcam.Start(); @@ -208,17 +208,17 @@ namespace Vocaluxe.Screens devices = null; } - SelectSlides[_SelectSlideWebcamDevices].Visible = devices != null && devices.Length > 0; - SelectSlides[_SelectSlideWebcamCapabilities].Visible = devices != null && devices.Length > 0; - Statics[_StaticWebcamOutput].Visible = devices != null && devices.Length > 0; + _SelectSlides[_SelectSlideWebcamDevices].Visible = devices != null && devices.Length > 0; + _SelectSlides[_SelectSlideWebcamCapabilities].Visible = devices != null && devices.Length > 0; + _Statics[_StaticWebcamOutput].Visible = devices != null && devices.Length > 0; } private void _SaveConfig() { - CConfig.VideoBackgrounds = (EOffOn)SelectSlides[_SelectSlideVideoBackgrounds].Selection; - CConfig.VideoPreview = (EOffOn)SelectSlides[_SelectSlideVideoPreview].Selection; - CConfig.VideosInSongs = (EOffOn)SelectSlides[_SelectSlideVideosInSongs].Selection; - CConfig.VideosToBackground = (EOffOn)SelectSlides[_SelectSlideVideosToBackground].Selection; + CConfig.VideoBackgrounds = (EOffOn)_SelectSlides[_SelectSlideVideoBackgrounds].Selection; + CConfig.VideoPreview = (EOffOn)_SelectSlides[_SelectSlideVideoPreview].Selection; + CConfig.VideosInSongs = (EOffOn)_SelectSlides[_SelectSlideVideosInSongs].Selection; + CConfig.VideosToBackground = (EOffOn)_SelectSlides[_SelectSlideVideosToBackground].Selection; CConfig.WebcamConfig = _Config; CBackgroundMusic.VideoEnabled = true; @@ -228,24 +228,24 @@ namespace Vocaluxe.Screens private void _OnDeviceEvent() { - if (SelectSlides[_SelectSlideWebcamDevices].Selection != _DeviceNr) + if (_SelectSlides[_SelectSlideWebcamDevices].Selection != _DeviceNr) { - SelectSlides[_SelectSlideWebcamCapabilities].Clear(); - _DeviceNr = SelectSlides[_SelectSlideWebcamDevices].Selection; + _SelectSlides[_SelectSlideWebcamCapabilities].Clear(); + _DeviceNr = _SelectSlides[_SelectSlideWebcamDevices].Selection; _CapabilityNr = 0; SWebcamDevice[] d = CWebcam.GetDevices(); - for (int i = 0; i < d[SelectSlides[_SelectSlideWebcamDevices].Selection].Capabilities.Count; i++) + for (int i = 0; i < d[_SelectSlides[_SelectSlideWebcamDevices].Selection].Capabilities.Count; i++) { - SelectSlides[_SelectSlideWebcamCapabilities].AddValue(d[_DeviceNr].Capabilities[i].Width.ToString() + " x " + d[_DeviceNr].Capabilities[i].Height.ToString() + - " @ " + d[_DeviceNr].Capabilities[i].Framerate.ToString() + "FPS"); + _SelectSlides[_SelectSlideWebcamCapabilities].AddValue(d[_DeviceNr].Capabilities[i].Width + " x " + d[_DeviceNr].Capabilities[i].Height + + " @ " + d[_DeviceNr].Capabilities[i].Framerate + "FPS"); } - SelectSlides[_SelectSlideWebcamCapabilities].Selection = 0; + _SelectSlides[_SelectSlideWebcamCapabilities].Selection = 0; - _Config.MonikerString = d[SelectSlides[_SelectSlideWebcamDevices].Selection].MonikerString; - _Config.Width = d[SelectSlides[_SelectSlideWebcamDevices].Selection].Capabilities[SelectSlides[_SelectSlideWebcamCapabilities].Selection].Width; - _Config.Height = d[SelectSlides[_SelectSlideWebcamDevices].Selection].Capabilities[SelectSlides[_SelectSlideWebcamCapabilities].Selection].Height; - _Config.Framerate = d[SelectSlides[_SelectSlideWebcamDevices].Selection].Capabilities[SelectSlides[_SelectSlideWebcamCapabilities].Selection].Framerate; + _Config.MonikerString = d[_SelectSlides[_SelectSlideWebcamDevices].Selection].MonikerString; + _Config.Width = d[_SelectSlides[_SelectSlideWebcamDevices].Selection].Capabilities[_SelectSlides[_SelectSlideWebcamCapabilities].Selection].Width; + _Config.Height = d[_SelectSlides[_SelectSlideWebcamDevices].Selection].Capabilities[_SelectSlides[_SelectSlideWebcamCapabilities].Selection].Height; + _Config.Framerate = d[_SelectSlides[_SelectSlideWebcamDevices].Selection].Capabilities[_SelectSlides[_SelectSlideWebcamCapabilities].Selection].Framerate; CWebcam.Close(); CWebcam.Select(_Config); @@ -255,15 +255,15 @@ namespace Vocaluxe.Screens private void _OnCapabilitiesEvent() { - if (SelectSlides[_SelectSlideWebcamCapabilities].Selection != _CapabilityNr) + if (_SelectSlides[_SelectSlideWebcamCapabilities].Selection != _CapabilityNr) { - _CapabilityNr = SelectSlides[_SelectSlideWebcamCapabilities].Selection; + _CapabilityNr = _SelectSlides[_SelectSlideWebcamCapabilities].Selection; SWebcamDevice[] d = CWebcam.GetDevices(); - _Config.MonikerString = d[SelectSlides[_SelectSlideWebcamDevices].Selection].MonikerString; - _Config.Width = d[SelectSlides[_SelectSlideWebcamDevices].Selection].Capabilities[SelectSlides[_SelectSlideWebcamCapabilities].Selection].Width; - _Config.Height = d[SelectSlides[_SelectSlideWebcamDevices].Selection].Capabilities[SelectSlides[_SelectSlideWebcamCapabilities].Selection].Height; - _Config.Framerate = d[SelectSlides[_SelectSlideWebcamDevices].Selection].Capabilities[SelectSlides[_SelectSlideWebcamCapabilities].Selection].Framerate; + _Config.MonikerString = d[_SelectSlides[_SelectSlideWebcamDevices].Selection].MonikerString; + _Config.Width = d[_SelectSlides[_SelectSlideWebcamDevices].Selection].Capabilities[_SelectSlides[_SelectSlideWebcamCapabilities].Selection].Width; + _Config.Height = d[_SelectSlides[_SelectSlideWebcamDevices].Selection].Capabilities[_SelectSlides[_SelectSlideWebcamCapabilities].Selection].Height; + _Config.Framerate = d[_SelectSlides[_SelectSlideWebcamDevices].Selection].Capabilities[_SelectSlides[_SelectSlideWebcamCapabilities].Selection].Framerate; CWebcam.Close(); CWebcam.Select(_Config); diff --git a/Vocaluxe/Screens/CScreenParty.cs b/Vocaluxe/Screens/CScreenParty.cs index 3b86540d..b5f58a2d 100644 --- a/Vocaluxe/Screens/CScreenParty.cs +++ b/Vocaluxe/Screens/CScreenParty.cs @@ -69,16 +69,16 @@ namespace Vocaluxe.Screens break; case Keys.Enter: - if (Buttons[_ButtonStart].Selected) + if (_Buttons[_ButtonStart].Selected) _StartPartyMode(); - if (Buttons[_ButtonExit].Selected) + if (_Buttons[_ButtonExit].Selected) CGraphics.FadeTo(EScreens.ScreenMain); break; case Keys.Left: case Keys.Right: - if (SelectSlides[_SelectSlideModes].Selected) + if (_SelectSlides[_SelectSlideModes].Selected) _UpdateSelection(); break; } @@ -90,15 +90,15 @@ namespace Vocaluxe.Screens { base.HandleMouse(mouseEvent); - if (mouseEvent.LB && IsMouseOver(mouseEvent)) + if (mouseEvent.LB && _IsMouseOver(mouseEvent)) { - if (Buttons[_ButtonStart].Selected) + if (_Buttons[_ButtonStart].Selected) _StartPartyMode(); - if (Buttons[_ButtonExit].Selected) + if (_Buttons[_ButtonExit].Selected) CGraphics.FadeTo(EScreens.ScreenMain); - if (SelectSlides[_SelectSlideModes].Selected) + if (_SelectSlides[_SelectSlideModes].Selected) _UpdateSelection(); } @@ -114,13 +114,13 @@ namespace Vocaluxe.Screens _PartyModeInfos = CParty.GetPartyModeInfos(); - SelectSlides[_SelectSlideModes].Clear(); + _SelectSlides[_SelectSlideModes].Clear(); foreach (SPartyModeInfos info in _PartyModeInfos) - SelectSlides[_SelectSlideModes].AddValue(info.Name, info.PartyModeID); - SelectSlides[_SelectSlideModes].Selection = 0; + _SelectSlides[_SelectSlideModes].AddValue(info.Name, info.PartyModeID); + _SelectSlides[_SelectSlideModes].Selection = 0; _UpdateSelection(); - SetInteractionToSelectSlide(SelectSlides[_SelectSlideModes]); + _SetInteractionToSelectSlide(_SelectSlides[_SelectSlideModes]); } public override bool UpdateGame() @@ -140,49 +140,49 @@ namespace Vocaluxe.Screens if (_PartyModeInfos.Count == 0) return; - int index = SelectSlides[_SelectSlideModes].Selection; + int index = _SelectSlides[_SelectSlideModes].Selection; if (index >= _PartyModeInfos.Count) return; //Description - Texts[_TextDescription].Text = _PartyModeInfos[index].Description; - Texts[_TextDescription].TranslationID = _PartyModeInfos[index].PartyModeID; + _Texts[_TextDescription].Text = _PartyModeInfos[index].Description; + _Texts[_TextDescription].TranslationID = _PartyModeInfos[index].PartyModeID; //TargetAudience - Texts[_TextTargetAudience].TranslationID = _PartyModeInfos[index].PartyModeID; - Texts[_TextTargetAudience].Text = _PartyModeInfos[index].TargetAudience; + _Texts[_TextTargetAudience].TranslationID = _PartyModeInfos[index].PartyModeID; + _Texts[_TextTargetAudience].Text = _PartyModeInfos[index].TargetAudience; //NumTeams if (_PartyModeInfos[index].MaxTeams == 0) - Texts[_TextNumTeams].Text = "TR_SCREENPARTY_NOTEAMS"; + _Texts[_TextNumTeams].Text = "TR_SCREENPARTY_NOTEAMS"; else if (_PartyModeInfos[index].MaxTeams == _PartyModeInfos[index].MinTeams) - Texts[_TextNumTeams].Text = _PartyModeInfos[index].MaxTeams.ToString(); + _Texts[_TextNumTeams].Text = _PartyModeInfos[index].MaxTeams.ToString(); else if (_PartyModeInfos[index].MaxTeams > _PartyModeInfos[index].MinTeams) - Texts[_TextNumTeams].Text = _PartyModeInfos[index].MinTeams + " - " + _PartyModeInfos[index].MaxTeams; + _Texts[_TextNumTeams].Text = _PartyModeInfos[index].MinTeams + " - " + _PartyModeInfos[index].MaxTeams; //NumPlayers if (_PartyModeInfos[index].MaxPlayers == _PartyModeInfos[index].MinPlayers) - Texts[_TextNumPlayers].Text = _PartyModeInfos[index].MaxTeams.ToString(); + _Texts[_TextNumPlayers].Text = _PartyModeInfos[index].MaxTeams.ToString(); else if (_PartyModeInfos[index].MaxPlayers > _PartyModeInfos[index].MinPlayers) - Texts[_TextNumPlayers].Text = _PartyModeInfos[index].MinPlayers + " - " + _PartyModeInfos[index].MaxPlayers; + _Texts[_TextNumPlayers].Text = _PartyModeInfos[index].MinPlayers + " - " + _PartyModeInfos[index].MaxPlayers; //Author - Texts[_TextAuthor].Text = _PartyModeInfos[index].Author; - Texts[_TextAuthor].TranslationID = _PartyModeInfos[index].PartyModeID; + _Texts[_TextAuthor].Text = _PartyModeInfos[index].Author; + _Texts[_TextAuthor].TranslationID = _PartyModeInfos[index].PartyModeID; //Version - Texts[_TextVersion].Text = _PartyModeInfos[index].VersionMajor + "." + _PartyModeInfos[index].VersionMinor; - Texts[_TextVersion].TranslationID = _PartyModeInfos[index].PartyModeID; + _Texts[_TextVersion].Text = _PartyModeInfos[index].VersionMajor + "." + _PartyModeInfos[index].VersionMinor; + _Texts[_TextVersion].TranslationID = _PartyModeInfos[index].PartyModeID; if (!_PartyModeInfos[index].Playable) { - Buttons[_ButtonStart].Visible = false; - Texts[_TextError].Visible = true; + _Buttons[_ButtonStart].Visible = false; + _Texts[_TextError].Visible = true; } else { - Buttons[_ButtonStart].Visible = true; - Texts[_TextError].Visible = false; + _Buttons[_ButtonStart].Visible = true; + _Texts[_TextError].Visible = false; } } @@ -191,7 +191,7 @@ namespace Vocaluxe.Screens if (_PartyModeInfos.Count == 0) return; - int index = SelectSlides[_SelectSlideModes].Selection; + int index = _SelectSlides[_SelectSlideModes].Selection; if (index >= _PartyModeInfos.Count) return; diff --git a/Vocaluxe/Screens/CScreenProfiles.cs b/Vocaluxe/Screens/CScreenProfiles.cs index 863185c5..eb04d9a8 100644 --- a/Vocaluxe/Screens/CScreenProfiles.cs +++ b/Vocaluxe/Screens/CScreenProfiles.cs @@ -79,16 +79,16 @@ namespace Vocaluxe.Screens { base.LoadTheme(xmlPath); - Buttons[_ButtonSaveSnapshot].Visible = false; - Buttons[_ButtonDiscardSnapshot].Visible = false; - Buttons[_ButtonTakeSnapshot].Visible = false; + _Buttons[_ButtonSaveSnapshot].Visible = false; + _Buttons[_ButtonDiscardSnapshot].Visible = false; + _Buttons[_ButtonTakeSnapshot].Visible = false; if (CWebcam.GetDevices().Length > 0) - Buttons[_ButtonWebcam].Visible = true; + _Buttons[_ButtonWebcam].Visible = true; else - Buttons[_ButtonWebcam].Visible = false; - SelectSlides[_SelectSlideDifficulty].SetValues(0); - SelectSlides[_SelectSlideGuestProfile].SetValues(0); - SelectSlides[_SelectSlideActive].SetValues(0); + _Buttons[_ButtonWebcam].Visible = false; + _SelectSlides[_SelectSlideDifficulty].SetValues(0); + _SelectSlides[_SelectSlideGuestProfile].SetValues(0); + _SelectSlides[_SelectSlideActive].SetValues(0); } public override bool HandleInput(SKeyEvent keyEvent) @@ -103,8 +103,8 @@ namespace Vocaluxe.Screens case EEditMode.None: break; case EEditMode.PlayerName: - SelectSlides[_SelectSlideProfiles].RenameValue( - CProfiles.AddGetPlayerName(SelectSlides[_SelectSlideProfiles].Selection, keyEvent.Unicode)); + _SelectSlides[_SelectSlideProfiles].RenameValue( + CProfiles.AddGetPlayerName(_SelectSlides[_SelectSlideProfiles].Selection, keyEvent.Unicode)); break; } } @@ -117,36 +117,36 @@ namespace Vocaluxe.Screens break; case Keys.Enter: - if (Buttons[_ButtonExit].Selected) + if (_Buttons[_ButtonExit].Selected) CGraphics.FadeTo(EScreens.ScreenMain); - else if (Buttons[_ButtonSave].Selected) + else if (_Buttons[_ButtonSave].Selected) _SaveProfiles(); - else if (Buttons[_ButtonNew].Selected) + else if (_Buttons[_ButtonNew].Selected) _NewProfile(); - else if (Buttons[_ButtonPlayerName].Selected) + else if (_Buttons[_ButtonPlayerName].Selected) { if (CProfiles.NumProfiles > 0 && _EditMode != EEditMode.PlayerName) _EditMode = EEditMode.PlayerName; else _EditMode = EEditMode.None; } - else if (Buttons[_ButtonDelete].Selected) + else if (_Buttons[_ButtonDelete].Selected) _DeleteProfile(); - else if (Buttons[_ButtonWebcam].Selected && CWebcam.GetDevices().Length > 0) + else if (_Buttons[_ButtonWebcam].Selected && CWebcam.GetDevices().Length > 0) _OnWebcam(); - else if (Buttons[_ButtonSaveSnapshot].Selected && CWebcam.GetDevices().Length > 0) + else if (_Buttons[_ButtonSaveSnapshot].Selected && CWebcam.GetDevices().Length > 0) _OnSaveSnapshot(); - else if (Buttons[_ButtonDiscardSnapshot].Selected && CWebcam.GetDevices().Length > 0) + else if (_Buttons[_ButtonDiscardSnapshot].Selected && CWebcam.GetDevices().Length > 0) _OnDiscardSnapshot(); - else if (Buttons[_ButtonTakeSnapshot].Selected && CWebcam.GetDevices().Length > 0) + else if (_Buttons[_ButtonTakeSnapshot].Selected && CWebcam.GetDevices().Length > 0) _OnTakeSnapshot(); break; case Keys.Back: if (_EditMode == EEditMode.PlayerName) { - SelectSlides[_SelectSlideProfiles].RenameValue( - CProfiles.GetDeleteCharInPlayerName(SelectSlides[_SelectSlideProfiles].Selection)); + _SelectSlides[_SelectSlideProfiles].RenameValue( + CProfiles.GetDeleteCharInPlayerName(_SelectSlides[_SelectSlideProfiles].Selection)); } else CGraphics.FadeTo(EScreens.ScreenMain); @@ -156,25 +156,25 @@ namespace Vocaluxe.Screens _DeleteProfile(); break; } - if (SelectSlides[_SelectSlideDifficulty].Selected) + if (_SelectSlides[_SelectSlideDifficulty].Selected) { - CProfiles.SetDifficulty(SelectSlides[_SelectSlideProfiles].Selection, - (EGameDifficulty)SelectSlides[_SelectSlideDifficulty].Selection); + CProfiles.SetDifficulty(_SelectSlides[_SelectSlideProfiles].Selection, + (EGameDifficulty)_SelectSlides[_SelectSlideDifficulty].Selection); } - else if (SelectSlides[_SelectSlideAvatars].Selected) + else if (_SelectSlides[_SelectSlideAvatars].Selected) { - CProfiles.SetAvatar(SelectSlides[_SelectSlideProfiles].Selection, - SelectSlides[_SelectSlideAvatars].Selection); + CProfiles.SetAvatar(_SelectSlides[_SelectSlideProfiles].Selection, + _SelectSlides[_SelectSlideAvatars].Selection); } - else if (SelectSlides[_SelectSlideGuestProfile].Selected) + else if (_SelectSlides[_SelectSlideGuestProfile].Selected) { - CProfiles.SetGuestProfile(SelectSlides[_SelectSlideProfiles].Selection, - (EOffOn)SelectSlides[_SelectSlideGuestProfile].Selection); + CProfiles.SetGuestProfile(_SelectSlides[_SelectSlideProfiles].Selection, + (EOffOn)_SelectSlides[_SelectSlideGuestProfile].Selection); } - else if (SelectSlides[_SelectSlideActive].Selected) + else if (_SelectSlides[_SelectSlideActive].Selected) { - CProfiles.SetActive(SelectSlides[_SelectSlideProfiles].Selection, - (EOffOn)SelectSlides[_SelectSlideActive].Selection); + CProfiles.SetActive(_SelectSlides[_SelectSlideProfiles].Selection, + (EOffOn)_SelectSlides[_SelectSlideActive].Selection); } } @@ -186,52 +186,52 @@ namespace Vocaluxe.Screens if (_EditMode == EEditMode.None) base.HandleMouse(mouseEvent); - if (mouseEvent.LB && IsMouseOver(mouseEvent)) + if (mouseEvent.LB && _IsMouseOver(mouseEvent)) { - if (Buttons[_ButtonExit].Selected) + if (_Buttons[_ButtonExit].Selected) CGraphics.FadeTo(EScreens.ScreenMain); - else if (Buttons[_ButtonSave].Selected) + else if (_Buttons[_ButtonSave].Selected) _SaveProfiles(); - else if (Buttons[_ButtonNew].Selected) + else if (_Buttons[_ButtonNew].Selected) _NewProfile(); - else if (Buttons[_ButtonDelete].Selected) + else if (_Buttons[_ButtonDelete].Selected) _DeleteProfile(); - else if (Buttons[_ButtonPlayerName].Selected) + else if (_Buttons[_ButtonPlayerName].Selected) { if (CProfiles.NumProfiles > 0 && _EditMode != EEditMode.PlayerName) _EditMode = EEditMode.PlayerName; else _EditMode = EEditMode.None; } - else if (SelectSlides[_SelectSlideDifficulty].Selected) + else if (_SelectSlides[_SelectSlideDifficulty].Selected) { - CProfiles.SetDifficulty(SelectSlides[_SelectSlideProfiles].Selection, - (EGameDifficulty)SelectSlides[_SelectSlideDifficulty].Selection); + CProfiles.SetDifficulty(_SelectSlides[_SelectSlideProfiles].Selection, + (EGameDifficulty)_SelectSlides[_SelectSlideDifficulty].Selection); } - else if (SelectSlides[_SelectSlideAvatars].Selected) + else if (_SelectSlides[_SelectSlideAvatars].Selected) { - CProfiles.SetAvatar(SelectSlides[_SelectSlideProfiles].Selection, - SelectSlides[_SelectSlideAvatars].Selection); + CProfiles.SetAvatar(_SelectSlides[_SelectSlideProfiles].Selection, + _SelectSlides[_SelectSlideAvatars].Selection); if (CWebcam.GetDevices().Length > 0 && _WebcamTexture.Index > 0) _OnDiscardSnapshot(); } - else if (SelectSlides[_SelectSlideGuestProfile].Selected) + else if (_SelectSlides[_SelectSlideGuestProfile].Selected) { - CProfiles.SetGuestProfile(SelectSlides[_SelectSlideProfiles].Selection, - (EOffOn)SelectSlides[_SelectSlideGuestProfile].Selection); + CProfiles.SetGuestProfile(_SelectSlides[_SelectSlideProfiles].Selection, + (EOffOn)_SelectSlides[_SelectSlideGuestProfile].Selection); } - else if (SelectSlides[_SelectSlideActive].Selected) + else if (_SelectSlides[_SelectSlideActive].Selected) { - CProfiles.SetActive(SelectSlides[_SelectSlideProfiles].Selection, - (EOffOn)SelectSlides[_SelectSlideActive].Selection); + CProfiles.SetActive(_SelectSlides[_SelectSlideProfiles].Selection, + (EOffOn)_SelectSlides[_SelectSlideActive].Selection); } - else if (Buttons[_ButtonWebcam].Selected && CWebcam.GetDevices().Length > 0) + else if (_Buttons[_ButtonWebcam].Selected && CWebcam.GetDevices().Length > 0) _OnWebcam(); - else if (Buttons[_ButtonSaveSnapshot].Selected && CWebcam.GetDevices().Length > 0) + else if (_Buttons[_ButtonSaveSnapshot].Selected && CWebcam.GetDevices().Length > 0) _OnSaveSnapshot(); - else if (Buttons[_ButtonDiscardSnapshot].Selected && CWebcam.GetDevices().Length > 0) + else if (_Buttons[_ButtonDiscardSnapshot].Selected && CWebcam.GetDevices().Length > 0) _OnDiscardSnapshot(); - else if (Buttons[_ButtonTakeSnapshot].Selected && CWebcam.GetDevices().Length > 0) + else if (_Buttons[_ButtonTakeSnapshot].Selected && CWebcam.GetDevices().Length > 0) _OnTakeSnapshot(); } @@ -242,10 +242,10 @@ namespace Vocaluxe.Screens private void _OnTakeSnapshot() { - Buttons[_ButtonSaveSnapshot].Visible = true; - Buttons[_ButtonDiscardSnapshot].Visible = true; - Buttons[_ButtonWebcam].Visible = false; - Buttons[_ButtonTakeSnapshot].Visible = false; + _Buttons[_ButtonSaveSnapshot].Visible = true; + _Buttons[_ButtonDiscardSnapshot].Visible = true; + _Buttons[_ButtonWebcam].Visible = false; + _Buttons[_ButtonTakeSnapshot].Visible = false; _Snapshot = CWebcam.GetBitmap(); } @@ -254,10 +254,10 @@ namespace Vocaluxe.Screens CWebcam.Stop(); CDraw.RemoveTexture(ref _WebcamTexture); _Snapshot = null; - Buttons[_ButtonSaveSnapshot].Visible = false; - Buttons[_ButtonDiscardSnapshot].Visible = false; - Buttons[_ButtonTakeSnapshot].Visible = false; - Buttons[_ButtonWebcam].Visible = true; + _Buttons[_ButtonSaveSnapshot].Visible = false; + _Buttons[_ButtonDiscardSnapshot].Visible = false; + _Buttons[_ButtonTakeSnapshot].Visible = false; + _Buttons[_ButtonWebcam].Visible = true; } private void _OnSaveSnapshot() @@ -277,15 +277,15 @@ namespace Vocaluxe.Screens { if (CProfiles.Avatars[j].FileName == (filename + i + ".png")) { - CProfiles.SetAvatar(SelectSlides[_SelectSlideProfiles].Selection, j); + CProfiles.SetAvatar(_SelectSlides[_SelectSlideProfiles].Selection, j); break; } } - Buttons[_ButtonSaveSnapshot].Visible = false; - Buttons[_ButtonDiscardSnapshot].Visible = false; - Buttons[_ButtonTakeSnapshot].Visible = false; - Buttons[_ButtonWebcam].Visible = true; + _Buttons[_ButtonSaveSnapshot].Visible = false; + _Buttons[_ButtonDiscardSnapshot].Visible = false; + _Buttons[_ButtonTakeSnapshot].Visible = false; + _Buttons[_ButtonWebcam].Visible = true; } private void _OnWebcam() @@ -293,38 +293,38 @@ namespace Vocaluxe.Screens _Snapshot = null; CWebcam.Start(); CWebcam.GetFrame(ref _WebcamTexture); - Buttons[_ButtonSaveSnapshot].Visible = false; - Buttons[_ButtonDiscardSnapshot].Visible = false; - Buttons[_ButtonTakeSnapshot].Visible = true; - Buttons[_ButtonWebcam].Visible = false; + _Buttons[_ButtonSaveSnapshot].Visible = false; + _Buttons[_ButtonDiscardSnapshot].Visible = false; + _Buttons[_ButtonTakeSnapshot].Visible = true; + _Buttons[_ButtonWebcam].Visible = false; } public override bool UpdateGame() { - if (SelectSlides[_SelectSlideProfiles].Selection > -1) + if (_SelectSlides[_SelectSlideProfiles].Selection > -1) { - Buttons[_ButtonPlayerName].Text.Text = CProfiles.GetPlayerName(SelectSlides[_SelectSlideProfiles].Selection); + _Buttons[_ButtonPlayerName].Text.Text = CProfiles.GetPlayerName(_SelectSlides[_SelectSlideProfiles].Selection); if (_EditMode == EEditMode.PlayerName) - Buttons[_ButtonPlayerName].Text.Text += "|"; + _Buttons[_ButtonPlayerName].Text.Text += "|"; - SelectSlides[_SelectSlideDifficulty].Selection = (int)CProfiles.GetDifficulty(SelectSlides[_SelectSlideProfiles].Selection); - SelectSlides[_SelectSlideGuestProfile].Selection = (int)CProfiles.GetGuestProfile(SelectSlides[_SelectSlideProfiles].Selection); - SelectSlides[_SelectSlideActive].Selection = (int)CProfiles.GetActive(SelectSlides[_SelectSlideProfiles].Selection); + _SelectSlides[_SelectSlideDifficulty].Selection = (int)CProfiles.GetDifficulty(_SelectSlides[_SelectSlideProfiles].Selection); + _SelectSlides[_SelectSlideGuestProfile].Selection = (int)CProfiles.GetGuestProfile(_SelectSlides[_SelectSlideProfiles].Selection); + _SelectSlides[_SelectSlideActive].Selection = (int)CProfiles.GetActive(_SelectSlides[_SelectSlideProfiles].Selection); - int avatarNr = CProfiles.GetAvatarNr(SelectSlides[_SelectSlideProfiles].Selection); - SelectSlides[_SelectSlideAvatars].Selection = avatarNr; + int avatarNr = CProfiles.GetAvatarNr(_SelectSlides[_SelectSlideProfiles].Selection); + _SelectSlides[_SelectSlideAvatars].Selection = avatarNr; if (CWebcam.GetDevices().Length > 0 && _WebcamTexture.Index > 0) { if (_Snapshot == null) CWebcam.GetFrame(ref _WebcamTexture); - Statics[_StaticAvatar].Texture = _WebcamTexture; + _Statics[_StaticAvatar].Texture = _WebcamTexture; RectangleF bounds = new RectangleF(_WebcamTexture.Rect.X, _WebcamTexture.Rect.Y, _WebcamTexture.Rect.W, _WebcamTexture.Rect.H); RectangleF rect = new RectangleF(0f, 0f, _WebcamTexture.Rect.W, _WebcamTexture.Rect.H); - CHelper.SetRect(bounds, ref rect, rect.Width / rect.Height, EAspect.Crop); + CHelper.SetRect(bounds, out rect, rect.Width / rect.Height, EAspect.Crop); } else - Statics[_StaticAvatar].Texture = CProfiles.Avatars[avatarNr].Texture; + _Statics[_StaticAvatar].Texture = CProfiles.Avatars[avatarNr].Texture; } return true; @@ -357,7 +357,7 @@ namespace Vocaluxe.Screens private void _DeleteProfile() { - CProfiles.DeleteProfile(SelectSlides[_SelectSlideProfiles].Selection); + CProfiles.DeleteProfile(_SelectSlides[_SelectSlideProfiles].Selection); _LoadProfiles(); UpdateGame(); } @@ -365,25 +365,25 @@ namespace Vocaluxe.Screens private void _LoadProfiles() { _EditMode = EEditMode.None; - SelectSlides[_SelectSlideProfiles].Clear(); + _SelectSlides[_SelectSlideProfiles].Clear(); for (int i = 0; i < CProfiles.NumProfiles; i++) - SelectSlides[_SelectSlideProfiles].AddValue(CProfiles.GetPlayerName(i)); + _SelectSlides[_SelectSlideProfiles].AddValue(CProfiles.GetPlayerName(i)); if (CProfiles.NumProfiles > 0 && CProfiles.NumAvatars > 0) { - SelectSlides[_SelectSlideDifficulty].Selection = (int)CProfiles.GetDifficulty(SelectSlides[_SelectSlideProfiles].Selection); - SelectSlides[_SelectSlideGuestProfile].Selection = (int)CProfiles.GetGuestProfile(SelectSlides[_SelectSlideProfiles].Selection); - SelectSlides[_SelectSlideActive].Selection = (int)CProfiles.GetActive(SelectSlides[_SelectSlideProfiles].Selection); - SelectSlides[_SelectSlideAvatars].Selection = CProfiles.GetAvatarNr(SelectSlides[_SelectSlideProfiles].Selection); + _SelectSlides[_SelectSlideDifficulty].Selection = (int)CProfiles.GetDifficulty(_SelectSlides[_SelectSlideProfiles].Selection); + _SelectSlides[_SelectSlideGuestProfile].Selection = (int)CProfiles.GetGuestProfile(_SelectSlides[_SelectSlideProfiles].Selection); + _SelectSlides[_SelectSlideActive].Selection = (int)CProfiles.GetActive(_SelectSlides[_SelectSlideProfiles].Selection); + _SelectSlides[_SelectSlideAvatars].Selection = CProfiles.GetAvatarNr(_SelectSlides[_SelectSlideProfiles].Selection); } } private void _LoadAvatars() { - SelectSlides[_SelectSlideAvatars].Clear(); + _SelectSlides[_SelectSlideAvatars].Clear(); for (int i = 0; i < CProfiles.NumAvatars; i++) - SelectSlides[_SelectSlideAvatars].AddValue(CProfiles.Avatars[i].FileName); + _SelectSlides[_SelectSlideAvatars].AddValue(CProfiles.Avatars[i].FileName); } private void _NewProfile() @@ -391,12 +391,12 @@ namespace Vocaluxe.Screens _EditMode = EEditMode.None; CProfiles.NewProfile(); _LoadProfiles(); - SelectSlides[_SelectSlideProfiles].LastValue(); + _SelectSlides[_SelectSlideProfiles].LastValue(); - CProfiles.SetAvatar(SelectSlides[_SelectSlideProfiles].Selection, - SelectSlides[_SelectSlideAvatars].Selection); + CProfiles.SetAvatar(_SelectSlides[_SelectSlideProfiles].Selection, + _SelectSlides[_SelectSlideAvatars].Selection); - SetInteractionToButton(Buttons[_ButtonPlayerName]); + _SetInteractionToButton(_Buttons[_ButtonPlayerName]); _EditMode = EEditMode.PlayerName; } } diff --git a/Vocaluxe/Screens/CScreenScore.cs b/Vocaluxe/Screens/CScreenScore.cs index 2944a4f5..318f42c7 100644 --- a/Vocaluxe/Screens/CScreenScore.cs +++ b/Vocaluxe/Screens/CScreenScore.cs @@ -58,8 +58,7 @@ namespace Vocaluxe.Screens { base.Init(); - List texts = new List(); - texts.Add(_TextSong); + List texts = new List {_TextSong}; _BuildTextStrings(ref texts); @@ -119,10 +118,7 @@ namespace Vocaluxe.Screens public override void OnShow() { base.OnShow(); - if (CGame.NumRounds > 1) - _Round = 0; - else - _Round = 1; + _Round = CGame.NumRounds > 1 ? 0 : 1; _Points = CGame.GetPoints(); _SetVisibility(); @@ -156,19 +152,19 @@ namespace Vocaluxe.Screens if (_StaticPointsBarDrawnPoints[p] > player[p].Points) _StaticPointsBarDrawnPoints[p] = player[p].Points; - string direction = (string)ScreenSettings[_ScreenSettingAnimationDirection].GetValue(); + string direction = (string)_ScreenSettings[_ScreenSettingAnimationDirection].GetValue(); if (direction.ToLower() == "vertical") { - Statics[_StaticPointsBar[p, CGame.NumPlayer - 1]].Rect.W = ((float)_StaticPointsBarDrawnPoints[p]) * - (Statics[_StaticPointsBarBG[p, CGame.NumPlayer - 1]].Rect.W / 10000); + _Statics[_StaticPointsBar[p, CGame.NumPlayer - 1]].Rect.W = ((float)_StaticPointsBarDrawnPoints[p]) * + (_Statics[_StaticPointsBarBG[p, CGame.NumPlayer - 1]].Rect.W / 10000); } else { - Statics[_StaticPointsBar[p, CGame.NumPlayer - 1]].Rect.H = ((float)_StaticPointsBarDrawnPoints[p]) * - (Statics[_StaticPointsBarBG[p, CGame.NumPlayer - 1]].Rect.H / 10000); - Statics[_StaticPointsBar[p, CGame.NumPlayer - 1]].Rect.Y = Statics[_StaticPointsBarBG[p, CGame.NumPlayer - 1]].Rect.H + - Statics[_StaticPointsBarBG[p, CGame.NumPlayer - 1]].Rect.Y - - Statics[_StaticPointsBar[p, CGame.NumPlayer - 1]].Rect.H; + _Statics[_StaticPointsBar[p, CGame.NumPlayer - 1]].Rect.H = ((float)_StaticPointsBarDrawnPoints[p]) * + (_Statics[_StaticPointsBarBG[p, CGame.NumPlayer - 1]].Rect.H / 10000); + _Statics[_StaticPointsBar[p, CGame.NumPlayer - 1]].Rect.Y = _Statics[_StaticPointsBarBG[p, CGame.NumPlayer - 1]].Rect.H + + _Statics[_StaticPointsBarBG[p, CGame.NumPlayer - 1]].Rect.Y - + _Statics[_StaticPointsBar[p, CGame.NumPlayer - 1]].Rect.H; } } } @@ -182,7 +178,7 @@ namespace Vocaluxe.Screens return true; } - public string GetRating(double points) + private static string _GetRating(double points) { string rating = String.Empty; @@ -222,7 +218,7 @@ namespace Vocaluxe.Screens { if (player <= numplayer) { - string target = "P" + (player + 1).ToString() + "N" + (numplayer + 1).ToString(); + string target = "P" + (player + 1) + "N" + (numplayer + 1); _TextNames[player, numplayer] = "TextName" + target; _TextScores[player, numplayer] = "TextScore" + target; _TextRatings[player, numplayer] = "TextRating" + target; @@ -247,17 +243,16 @@ namespace Vocaluxe.Screens { for (int player = 0; player < CSettings.MaxNumPlayer; player++) { - if (player <= numplayer) - { - string target = "P" + (player + 1).ToString() + "N" + (numplayer + 1).ToString(); - _StaticPointsBarBG[player, numplayer] = "StaticPointsBarBG" + target; - _StaticPointsBar[player, numplayer] = "StaticPointsBar" + target; - _StaticAvatar[player, numplayer] = "StaticAvatar" + target; + if (player > numplayer) + continue; + string target = "P" + (player + 1) + "N" + (numplayer + 1); + _StaticPointsBarBG[player, numplayer] = "StaticPointsBarBG" + target; + _StaticPointsBar[player, numplayer] = "StaticPointsBar" + target; + _StaticAvatar[player, numplayer] = "StaticAvatar" + target; - statics.Add(_StaticPointsBarBG[player, numplayer]); - statics.Add(_StaticPointsBar[player, numplayer]); - statics.Add(_StaticAvatar[player, numplayer]); - } + statics.Add(_StaticPointsBarBG[player, numplayer]); + statics.Add(_StaticPointsBar[player, numplayer]); + statics.Add(_StaticAvatar[player, numplayer]); } } } @@ -272,14 +267,14 @@ namespace Vocaluxe.Screens if (song == null) return; - Texts[_TextSong].Text = song.Artist + " - " + song.Title; + _Texts[_TextSong].Text = song.Artist + " - " + song.Title; if (_Points.NumRounds > 1) - Texts[_TextSong].Text += " (" + _Round + "/" + _Points.NumRounds + ")"; + _Texts[_TextSong].Text += " (" + _Round + "/" + _Points.NumRounds + ")"; player = _Points.GetPlayer(_Round - 1, CGame.NumPlayer); } else { - Texts[_TextSong].Text = "TR_SCREENSCORE_OVERALLSCORE"; + _Texts[_TextSong].Text = "TR_SCREENSCORE_OVERALLSCORE"; for (int i = 0; i < CGame.NumRounds; i++) { SPlayer[] points = _Points.GetPlayer(i, CGame.NumPlayer); @@ -303,59 +298,59 @@ namespace Vocaluxe.Screens if (song != null) { if (!song.IsDuet) - Texts[_TextNames[p, CGame.NumPlayer - 1]].Text = player[p].Name; + _Texts[_TextNames[p, CGame.NumPlayer - 1]].Text = player[p].Name; else if (player[p].LineNr == 0 && song.DuetPart1 != "Part 1") - Texts[_TextNames[p, CGame.NumPlayer - 1]].Text = player[p].Name + " (" + song.DuetPart1 + ")"; + _Texts[_TextNames[p, CGame.NumPlayer - 1]].Text = player[p].Name + " (" + song.DuetPart1 + ")"; else if (player[p].LineNr == 1 && song.DuetPart2 != "Part 2") - Texts[_TextNames[p, CGame.NumPlayer - 1]].Text = player[p].Name + " (" + song.DuetPart2 + ")"; + _Texts[_TextNames[p, CGame.NumPlayer - 1]].Text = player[p].Name + " (" + song.DuetPart2 + ")"; else - Texts[_TextNames[p, CGame.NumPlayer - 1]].Text = player[p].Name; + _Texts[_TextNames[p, CGame.NumPlayer - 1]].Text = player[p].Name; } else - Texts[_TextNames[p, CGame.NumPlayer - 1]].Text = player[p].Name; + _Texts[_TextNames[p, CGame.NumPlayer - 1]].Text = player[p].Name; - if (CGame.NumPlayer < (int)ScreenSettings[_ScreenSettingShortScore].GetValue()) - Texts[_TextScores[p, CGame.NumPlayer - 1]].Text = ((int)Math.Round(player[p].Points)).ToString("0000") + " " + CLanguage.Translate("TR_SCREENSCORE_POINTS"); + if (CGame.NumPlayer < (int)_ScreenSettings[_ScreenSettingShortScore].GetValue()) + _Texts[_TextScores[p, CGame.NumPlayer - 1]].Text = ((int)Math.Round(player[p].Points)).ToString("0000") + " " + CLanguage.Translate("TR_SCREENSCORE_POINTS"); else - Texts[_TextScores[p, CGame.NumPlayer - 1]].Text = ((int)Math.Round(player[p].Points)).ToString("0000"); - if (CGame.NumPlayer < (int)ScreenSettings[_ScreenSettingShortDifficulty].GetValue()) + _Texts[_TextScores[p, CGame.NumPlayer - 1]].Text = ((int)Math.Round(player[p].Points)).ToString("0000"); + if (CGame.NumPlayer < (int)_ScreenSettings[_ScreenSettingShortDifficulty].GetValue()) { - Texts[_TextDifficulty[p, CGame.NumPlayer - 1]].Text = CLanguage.Translate("TR_SCREENSCORE_GAMEDIFFICULTY") + ": " + + _Texts[_TextDifficulty[p, CGame.NumPlayer - 1]].Text = CLanguage.Translate("TR_SCREENSCORE_GAMEDIFFICULTY") + ": " + CLanguage.Translate(player[p].Difficulty.ToString()); } else - Texts[_TextDifficulty[p, CGame.NumPlayer - 1]].Text = CLanguage.Translate(player[p].Difficulty.ToString()); - if (CGame.NumPlayer < (int)ScreenSettings[_ScreenSettingShortRating].GetValue()) + _Texts[_TextDifficulty[p, CGame.NumPlayer - 1]].Text = CLanguage.Translate(player[p].Difficulty.ToString()); + if (CGame.NumPlayer < (int)_ScreenSettings[_ScreenSettingShortRating].GetValue()) { - Texts[_TextRatings[p, CGame.NumPlayer - 1]].Text = CLanguage.Translate("TR_SCREENSCORE_RATING") + ": " + - CLanguage.Translate(GetRating((int)Math.Round(player[p].Points))); + _Texts[_TextRatings[p, CGame.NumPlayer - 1]].Text = CLanguage.Translate("TR_SCREENSCORE_RATING") + ": " + + CLanguage.Translate(_GetRating((int)Math.Round(player[p].Points))); } else - Texts[_TextRatings[p, CGame.NumPlayer - 1]].Text = CLanguage.Translate(GetRating((int)Math.Round(player[p].Points))); + _Texts[_TextRatings[p, CGame.NumPlayer - 1]].Text = CLanguage.Translate(_GetRating((int)Math.Round(player[p].Points))); _StaticPointsBarDrawnPoints[p] = 0.0; - string direction = (string)ScreenSettings[_ScreenSettingAnimationDirection].GetValue(); + string direction = (string)_ScreenSettings[_ScreenSettingAnimationDirection].GetValue(); if (direction.ToLower() == "vertical") - Statics[_StaticPointsBar[p, CGame.NumPlayer - 1]].Rect.W = 0; + _Statics[_StaticPointsBar[p, CGame.NumPlayer - 1]].Rect.W = 0; else { - Statics[_StaticPointsBar[p, CGame.NumPlayer - 1]].Rect.H = 0; - Statics[_StaticPointsBar[p, CGame.NumPlayer - 1]].Rect.Y = Statics[_StaticPointsBarBG[p, CGame.NumPlayer - 1]].Rect.H + - Statics[_StaticPointsBarBG[p, CGame.NumPlayer - 1]].Rect.Y - - Statics[_StaticPointsBar[p, CGame.NumPlayer - 1]].Rect.H; + _Statics[_StaticPointsBar[p, CGame.NumPlayer - 1]].Rect.H = 0; + _Statics[_StaticPointsBar[p, CGame.NumPlayer - 1]].Rect.Y = _Statics[_StaticPointsBarBG[p, CGame.NumPlayer - 1]].Rect.H + + _Statics[_StaticPointsBarBG[p, CGame.NumPlayer - 1]].Rect.Y - + _Statics[_StaticPointsBar[p, CGame.NumPlayer - 1]].Rect.H; } if (player[p].ProfileID >= 0 && player[p].ProfileID < CProfiles.NumProfiles) - Statics[_StaticAvatar[p, CGame.NumPlayer - 1]].Texture = CProfiles.Profiles[player[p].ProfileID].Avatar.Texture; + _Statics[_StaticAvatar[p, CGame.NumPlayer - 1]].Texture = CProfiles.Profiles[player[p].ProfileID].Avatar.Texture; } if (CConfig.ScoreAnimationTime < 1) { for (int p = 0; p < CGame.NumPlayer; p++) { - Statics[_StaticPointsBar[p, CGame.NumPlayer - 1]].Rect.H = ((float)player[p].Points) * (Statics[_StaticPointsBarBG[p, CGame.NumPlayer - 1]].Rect.H / 10000); - Statics[_StaticPointsBar[p, CGame.NumPlayer - 1]].Rect.Y = Statics[_StaticPointsBarBG[p, CGame.NumPlayer - 1]].Rect.H + - Statics[_StaticPointsBarBG[p, CGame.NumPlayer - 1]].Rect.Y - - Statics[_StaticPointsBar[p, CGame.NumPlayer - 1]].Rect.H; + _Statics[_StaticPointsBar[p, CGame.NumPlayer - 1]].Rect.H = ((float)player[p].Points) * (_Statics[_StaticPointsBarBG[p, CGame.NumPlayer - 1]].Rect.H / 10000); + _Statics[_StaticPointsBar[p, CGame.NumPlayer - 1]].Rect.Y = _Statics[_StaticPointsBarBG[p, CGame.NumPlayer - 1]].Rect.H + + _Statics[_StaticPointsBarBG[p, CGame.NumPlayer - 1]].Rect.Y - + _Statics[_StaticPointsBar[p, CGame.NumPlayer - 1]].Rect.H; _StaticPointsBarDrawnPoints[p] = player[p].Points; } } @@ -372,15 +367,15 @@ namespace Vocaluxe.Screens { if (player <= numplayer) { - Texts[_TextNames[player, numplayer]].Visible = numplayer + 1 == CGame.NumPlayer; - Texts[_TextScores[player, numplayer]].Visible = numplayer + 1 == CGame.NumPlayer; - Texts[_TextRatings[player, numplayer]].Visible = numplayer + 1 == CGame.NumPlayer; - Texts[_TextDifficulty[player, numplayer]].Visible = numplayer + 1 == CGame.NumPlayer; - Statics[_StaticPointsBar[player, numplayer]].Visible = numplayer + 1 == CGame.NumPlayer; - Statics[_StaticPointsBarBG[player, numplayer]].Visible = numplayer + 1 == CGame.NumPlayer; - Statics[_StaticAvatar[player, numplayer]].Visible = numplayer + 1 == CGame.NumPlayer; + _Texts[_TextNames[player, numplayer]].Visible = numplayer + 1 == CGame.NumPlayer; + _Texts[_TextScores[player, numplayer]].Visible = numplayer + 1 == CGame.NumPlayer; + _Texts[_TextRatings[player, numplayer]].Visible = numplayer + 1 == CGame.NumPlayer; + _Texts[_TextDifficulty[player, numplayer]].Visible = numplayer + 1 == CGame.NumPlayer; + _Statics[_StaticPointsBar[player, numplayer]].Visible = numplayer + 1 == CGame.NumPlayer; + _Statics[_StaticPointsBarBG[player, numplayer]].Visible = numplayer + 1 == CGame.NumPlayer; + _Statics[_StaticAvatar[player, numplayer]].Visible = numplayer + 1 == CGame.NumPlayer; - Statics[_StaticAvatar[player, numplayer]].Texture = new STexture(-1); + _Statics[_StaticAvatar[player, numplayer]].Texture = new STexture(-1); } } } diff --git a/Vocaluxe/Screens/CScreenSing.cs b/Vocaluxe/Screens/CScreenSing.cs index ce8615d0..0262c1ca 100644 --- a/Vocaluxe/Screens/CScreenSing.cs +++ b/Vocaluxe/Screens/CScreenSing.cs @@ -163,17 +163,17 @@ namespace Vocaluxe.Screens { base.LoadTheme(xmlPath); - Statics[_StaticTimeLine].Visible = false; - Statics[_StaticTimeLineExpandedNormal].Visible = false; - Statics[_StaticTimeLineExpandedHighlighted].Visible = false; - Statics[_StaticPauseBG].Visible = false; - Texts[_TextPause].Visible = false; + _Statics[_StaticTimeLine].Visible = false; + _Statics[_StaticTimeLineExpandedNormal].Visible = false; + _Statics[_StaticTimeLineExpandedHighlighted].Visible = false; + _Statics[_StaticPauseBG].Visible = false; + _Texts[_TextPause].Visible = false; - Statics[_StaticPauseBG].Visible = false; - Texts[_TextPause].Visible = false; + _Statics[_StaticPauseBG].Visible = false; + _Texts[_TextPause].Visible = false; - Buttons[_ButtonCancel].Visible = false; - Buttons[_ButtonContinue].Visible = false; + _Buttons[_ButtonCancel].Visible = false; + _Buttons[_ButtonContinue].Visible = false; } public override bool HandleInput(SKeyEvent keyEvent) @@ -191,13 +191,13 @@ namespace Vocaluxe.Screens case Keys.Escape: _TogglePause(); if (_Pause) - SetInteractionToButton(Buttons[_ButtonCancel]); + _SetInteractionToButton(_Buttons[_ButtonCancel]); break; case Keys.P: _TogglePause(); if (_Pause) - SetInteractionToButton(Buttons[_ButtonContinue]); + _SetInteractionToButton(_Buttons[_ButtonContinue]); break; case Keys.T: @@ -240,11 +240,11 @@ namespace Vocaluxe.Screens } break; case Keys.Enter: - if (Buttons[_ButtonContinue].Selected && _Pause) + if (_Buttons[_ButtonContinue].Selected && _Pause) _TogglePause(); - if (Buttons[_ButtonCancel].Selected && _Pause) + if (_Buttons[_ButtonCancel].Selected && _Pause) _Stop(); - if (Buttons[_ButtonSkip].Selected && _Pause) + if (_Buttons[_ButtonSkip].Selected && _Pause) { _LoadNextSong(); _TogglePause(); @@ -288,18 +288,18 @@ namespace Vocaluxe.Screens { _TogglePause(); if (_Pause) - SetInteractionToButton(Buttons[_ButtonContinue]); + _SetInteractionToButton(_Buttons[_ButtonContinue]); } - if (mouseEvent.LB && IsMouseOver(mouseEvent) && _Pause) + if (mouseEvent.LB && _IsMouseOver(mouseEvent) && _Pause) { - if (Buttons[_ButtonContinue].Selected && _Pause) + if (_Buttons[_ButtonContinue].Selected && _Pause) _TogglePause(); - if (Buttons[_ButtonCancel].Selected && _Pause) + if (_Buttons[_ButtonCancel].Selected && _Pause) _Stop(); - if (Buttons[_ButtonSkip].Selected && _Pause) + if (_Buttons[_ButtonSkip].Selected && _Pause) { _LoadNextSong(); _TogglePause(); @@ -339,48 +339,48 @@ namespace Vocaluxe.Screens float[] alpha = _CalcFadingAlpha(); if (alpha != null) { - Lyrics[_LyricMain].Alpha = alpha[0]; - Lyrics[_LyricSub].Alpha = alpha[1]; + _Lyrics[_LyricMain].Alpha = alpha[0]; + _Lyrics[_LyricSub].Alpha = alpha[1]; - Lyrics[_LyricMainTop].Alpha = alpha[0]; - Lyrics[_LyricSubTop].Alpha = alpha[1]; + _Lyrics[_LyricMainTop].Alpha = alpha[0]; + _Lyrics[_LyricSubTop].Alpha = alpha[1]; - Statics[_StaticLyrics].Alpha = alpha[0]; - Statics[_StaticLyricsTop].Alpha = alpha[0]; + _Statics[_StaticLyrics].Alpha = alpha[0]; + _Statics[_StaticLyricsTop].Alpha = alpha[0]; - Statics[_StaticLyricHelper].Alpha = alpha[0]; - Statics[_StaticLyricHelperTop].Alpha = alpha[0]; + _Statics[_StaticLyricHelper].Alpha = alpha[0]; + _Statics[_StaticLyricHelperTop].Alpha = alpha[0]; for (int p = 0; p < CGame.NumPlayer; p++) { - SingNotes[_SingBars].SetAlpha(_NoteLines[p], alpha[CGame.Player[p].LineNr * 2]); + _SingNotes[_SingBars].SetAlpha(_NoteLines[p], alpha[CGame.Player[p].LineNr * 2]); if (CConfig.FadePlayerInfo == EFadePlayerInfo.TR_CONFIG_FADEPLAYERINFO_INFO || CConfig.FadePlayerInfo == EFadePlayerInfo.TR_CONFIG_FADEPLAYERINFO_ALL) { - Statics[_StaticAvatars[p, CGame.NumPlayer - 1]].Alpha = alpha[CGame.Player[p].LineNr * 2]; - Texts[_TextNames[p, CGame.NumPlayer - 1]].Alpha = alpha[CGame.Player[p].LineNr * 2]; + _Statics[_StaticAvatars[p, CGame.NumPlayer - 1]].Alpha = alpha[CGame.Player[p].LineNr * 2]; + _Texts[_TextNames[p, CGame.NumPlayer - 1]].Alpha = alpha[CGame.Player[p].LineNr * 2]; } if (CConfig.FadePlayerInfo == EFadePlayerInfo.TR_CONFIG_FADEPLAYERINFO_ALL) { - Statics[_StaticScores[p, CGame.NumPlayer - 1]].Alpha = alpha[CGame.Player[p].LineNr * 2]; - Statics[_StaticAvatars[p, CGame.NumPlayer - 1]].Alpha = alpha[CGame.Player[p].LineNr * 2]; - Texts[_TextNames[p, CGame.NumPlayer - 1]].Alpha = alpha[CGame.Player[p].LineNr * 2]; - Texts[_TextScores[p, CGame.NumPlayer - 1]].Alpha = alpha[CGame.Player[p].LineNr * 2]; + _Statics[_StaticScores[p, CGame.NumPlayer - 1]].Alpha = alpha[CGame.Player[p].LineNr * 2]; + _Statics[_StaticAvatars[p, CGame.NumPlayer - 1]].Alpha = alpha[CGame.Player[p].LineNr * 2]; + _Texts[_TextNames[p, CGame.NumPlayer - 1]].Alpha = alpha[CGame.Player[p].LineNr * 2]; + _Texts[_TextScores[p, CGame.NumPlayer - 1]].Alpha = alpha[CGame.Player[p].LineNr * 2]; } } if (alpha.Length > 2) { - Lyrics[_LyricMainDuet].Alpha = alpha[0]; - Lyrics[_LyricSubDuet].Alpha = alpha[1]; + _Lyrics[_LyricMainDuet].Alpha = alpha[0]; + _Lyrics[_LyricSubDuet].Alpha = alpha[1]; - Statics[_StaticLyricsDuet].Alpha = alpha[0]; - Statics[_StaticLyricHelperDuet].Alpha = alpha[0]; + _Statics[_StaticLyricsDuet].Alpha = alpha[0]; + _Statics[_StaticLyricHelperDuet].Alpha = alpha[0]; - Lyrics[_LyricMain].Alpha = alpha[2]; - Lyrics[_LyricSub].Alpha = alpha[3]; + _Lyrics[_LyricMain].Alpha = alpha[2]; + _Lyrics[_LyricSub].Alpha = alpha[3]; - Statics[_StaticLyrics].Alpha = alpha[2]; - Statics[_StaticLyricHelper].Alpha = alpha[2]; + _Statics[_StaticLyrics].Alpha = alpha[2]; + _Statics[_StaticLyricHelper].Alpha = alpha[2]; } } @@ -388,15 +388,15 @@ namespace Vocaluxe.Screens for (int p = 0; p < CGame.NumPlayer; p++) { if (CGame.Player[p].Points < 10000) - Texts[_TextScores[p, CGame.NumPlayer - 1]].Text = CGame.Player[p].Points.ToString("0000"); + _Texts[_TextScores[p, CGame.NumPlayer - 1]].Text = CGame.Player[p].Points.ToString("0000"); else - Texts[_TextScores[p, CGame.NumPlayer - 1]].Text = CGame.Player[p].Points.ToString("00000"); + _Texts[_TextScores[p, CGame.NumPlayer - 1]].Text = CGame.Player[p].Points.ToString("00000"); } if (_CurrentVideo != -1 && !_FadeOut && CConfig.VideosInSongs == EOffOn.TR_CONFIG_ON) { - float vtime = 0f; - CVideo.VdGetFrame(_CurrentVideo, ref _CurrentVideoTexture, _CurrentTime, ref vtime); + float vtime; + CVideo.VdGetFrame(_CurrentVideo, ref _CurrentVideoTexture, _CurrentTime, out vtime); } if (_Webcam) @@ -423,15 +423,15 @@ namespace Vocaluxe.Screens _TimeRects.Clear(); - SingNotes[_SingBars].Reset(); + _SingNotes[_SingBars].Reset(); for (int i = 0; i < CSettings.MaxNumPlayer; i++) _NoteLines[i] = -1; - foreach (CLyric lyric in Lyrics) + foreach (CLyric lyric in _Lyrics) lyric.LyricStyle = CConfig.LyricStyle; for (int p = 0; p < CGame.NumPlayer; p++) - Statics[_StaticAvatars[p, CGame.NumPlayer - 1]].Aspect = EAspect.Crop; + _Statics[_StaticAvatars[p, CGame.NumPlayer - 1]].Aspect = EAspect.Crop; _SetVisibility(); _UpdateAvatars(); @@ -458,7 +458,7 @@ namespace Vocaluxe.Screens { RectangleF bounds = new RectangleF(0, 0, CSettings.RenderW, CSettings.RenderH); RectangleF rect = new RectangleF(0f, 0f, _CurrentVideoTexture.Width, _CurrentVideoTexture.Height); - CHelper.SetRect(bounds, ref rect, rect.Width / rect.Height, _VideoAspect); + CHelper.SetRect(bounds, out rect, rect.Width / rect.Height, _VideoAspect); CDraw.DrawTexture(_CurrentVideoTexture, new SRectF(rect.X, rect.Y, rect.Width, rect.Height, 0f), _CurrentVideoTexture.Color, new SRectF(bounds.X, bounds.Y, bounds.Width, bounds.Height, 0f), false); @@ -467,7 +467,7 @@ namespace Vocaluxe.Screens { RectangleF bounds = new RectangleF(0, 0, CSettings.RenderW, CSettings.RenderH); RectangleF rect = new RectangleF(0f, 0f, _CurrentWebcamFrameTexture.Width, _CurrentWebcamFrameTexture.Height); - CHelper.SetRect(bounds, ref rect, rect.Width / rect.Height, _VideoAspect); + CHelper.SetRect(bounds, out rect, rect.Width / rect.Height, _VideoAspect); CDraw.DrawTexture(_CurrentWebcamFrameTexture, new SRectF(rect.X, rect.Y, rect.Width, rect.Height, 0f), _CurrentVideoTexture.Color, new SRectF(bounds.X, bounds.Y, bounds.Width, bounds.Height, 0f), false); @@ -477,56 +477,56 @@ namespace Vocaluxe.Screens // Draw Background RectangleF bounds = new RectangleF(0, 0, CSettings.RenderW, CSettings.RenderH); RectangleF rect = new RectangleF(0f, 0f, _Background.Width, _Background.Height); - CHelper.SetRect(bounds, ref rect, rect.Width / rect.Height, EAspect.Crop); + CHelper.SetRect(bounds, out rect, rect.Width / rect.Height, EAspect.Crop); CDraw.DrawTexture(_Background, new SRectF(rect.X, rect.Y, rect.Width, rect.Height, 0f), _Background.Color, new SRectF(bounds.X, bounds.Y, bounds.Width, bounds.Height, 0f), false); } } - DrawBG(); + _DrawBG(); - foreach (CStatic stat in Statics) + foreach (CStatic stat in _Statics) stat.Draw(); - foreach (CText text in Texts) + foreach (CText text in _Texts) text.Draw(); switch (CConfig.TimerLook) { case ETimerLook.TR_CONFIG_TIMERLOOK_NORMAL: - CDraw.DrawTexture(Statics[_StaticTimeLine].Texture, Statics[_StaticTimeLine].Rect, new SColorF(1, 1, 1, 1), _TimeLineRect); + CDraw.DrawTexture(_Statics[_StaticTimeLine].Texture, _Statics[_StaticTimeLine].Rect, new SColorF(1, 1, 1, 1), _TimeLineRect); break; case ETimerLook.TR_CONFIG_TIMERLOOK_EXPANDED: for (int i = 0; i < _TimeRects.Count; i++) - CDraw.DrawTexture(_TimeRects[i].Rect.Texture, Statics[_StaticTimeLine].Rect, _TimeRects[i].Rect.Color, _TimeRects[i].Rect.Rect); + CDraw.DrawTexture(_TimeRects[i].Rect.Texture, _Statics[_StaticTimeLine].Rect, _TimeRects[i].Rect.Color, _TimeRects[i].Rect.Rect); break; } - Lyrics[_LyricSub].Draw(-100); - Lyrics[_LyricMain].Draw(CGame.Beat); + _Lyrics[_LyricSub].Draw(-100); + _Lyrics[_LyricMain].Draw(CGame.Beat); - Lyrics[_LyricSubDuet].Draw(-100); - Lyrics[_LyricMainDuet].Draw(CGame.Beat); + _Lyrics[_LyricSubDuet].Draw(-100); + _Lyrics[_LyricMainDuet].Draw(CGame.Beat); - Lyrics[_LyricSubTop].Draw(-100); - Lyrics[_LyricMainTop].Draw(CGame.Beat); + _Lyrics[_LyricSubTop].Draw(-100); + _Lyrics[_LyricMainTop].Draw(CGame.Beat); for (int i = 0; i < CGame.NumPlayer; i++) - SingNotes[_SingBars].Draw(_NoteLines[i], CGame.Player[i].SingLine, i); + _SingNotes[_SingBars].Draw(_NoteLines[i], CGame.Player[i].SingLine, i); _DrawLyricHelper(); if (_Pause) { - Statics[_StaticPauseBG].ForceDraw(); - Texts[_TextPause].ForceDraw(); + _Statics[_StaticPauseBG].ForceDraw(); + _Texts[_TextPause].ForceDraw(); - foreach (CButton button in Buttons) + foreach (CButton button in _Buttons) button.Draw(); - foreach (CSelectSlide slide in SelectSlides) + foreach (CSelectSlide slide in _SelectSlides) slide.Draw(); } @@ -557,15 +557,15 @@ namespace Vocaluxe.Screens } CDraw.RemoveTexture(ref _Background); - Lyrics[_LyricMain].Clear(); - Lyrics[_LyricSub].Clear(); - Lyrics[_LyricMainDuet].Clear(); - Lyrics[_LyricSubDuet].Clear(); - Lyrics[_LyricMainTop].Clear(); - Lyrics[_LyricSubTop].Clear(); - Texts[_TextSongName].Text = String.Empty; - Texts[_TextDuetName1].Text = String.Empty; - Texts[_TextDuetName2].Text = String.Empty; + _Lyrics[_LyricMain].Clear(); + _Lyrics[_LyricSub].Clear(); + _Lyrics[_LyricMainDuet].Clear(); + _Lyrics[_LyricSubDuet].Clear(); + _Lyrics[_LyricMainTop].Clear(); + _Lyrics[_LyricSubTop].Clear(); + _Texts[_TextSongName].Text = String.Empty; + _Texts[_TextDuetName1].Text = String.Empty; + _Texts[_TextDuetName2].Text = String.Empty; GC.Collect(); } @@ -592,8 +592,8 @@ namespace Vocaluxe.Screens string songname = song.Artist + " - " + song.Title; int rounds = CGame.GetNumSongs(); if (rounds > 1) - songname += " (" + CGame.RoundNr + "/" + rounds.ToString() + ")"; - Texts[_TextSongName].Text = songname; + songname += " (" + CGame.RoundNr + "/" + rounds + ")"; + _Texts[_TextSongName].Text = songname; _CurrentStream = CSound.Load(song.GetMP3(), true); CSound.SetStreamVolumeMax(_CurrentStream, CConfig.GameMusicVolume); @@ -625,13 +625,13 @@ namespace Vocaluxe.Screens if (song.BackgroundFileName.Length > 0) _Background = CDraw.AddTexture(Path.Combine(song.Folder, song.BackgroundFileName)); - SingNotes[_SingBars].Reset(); + _SingNotes[_SingBars].Reset(); if (song.IsDuet) { - Texts[_TextDuetName1].Text = song.DuetPart1; - Texts[_TextDuetName2].Text = song.DuetPart2; + _Texts[_TextDuetName1].Text = song.DuetPart1; + _Texts[_TextDuetName2].Text = song.DuetPart2; //More than one song: Player is not assigned to line by user //Otherwise, this is done by CScreenNames if (CGame.GetNumSongs() > 1) @@ -654,8 +654,8 @@ namespace Vocaluxe.Screens for (int p = 0; p < CGame.NumPlayer; p++) { - _NoteLines[p] = SingNotes[_SingBars].AddPlayer( - SingNotes[_SingBars].BarPos[p, CGame.NumPlayer - 1], + _NoteLines[p] = _SingNotes[_SingBars].AddPlayer( + _SingNotes[_SingBars].BarPos[p, CGame.NumPlayer - 1], CTheme.GetPlayerColor(p + 1), p); } @@ -683,22 +683,22 @@ namespace Vocaluxe.Screens private void _SetDuetLyricsVisibility(bool isDuet) { - Statics[_StaticLyricsDuet].Visible = isDuet; - Lyrics[_LyricMainDuet].Visible = isDuet; - Lyrics[_LyricSubDuet].Visible = isDuet; + _Statics[_StaticLyricsDuet].Visible = isDuet; + _Lyrics[_LyricMainDuet].Visible = isDuet; + _Lyrics[_LyricSubDuet].Visible = isDuet; if (isDuet) { - Lyrics[_LyricMainTop].Visible = false; - Lyrics[_LyricSubTop].Visible = false; - Statics[_StaticLyricsTop].Visible = false; + _Lyrics[_LyricMainTop].Visible = false; + _Lyrics[_LyricSubTop].Visible = false; + _Statics[_StaticLyricsTop].Visible = false; } else { bool lyricsOnTop = (CGame.NumPlayer != 1) && CConfig.LyricsOnTop == EOffOn.TR_CONFIG_ON; - Lyrics[_LyricMainTop].Visible = lyricsOnTop; - Lyrics[_LyricSubTop].Visible = lyricsOnTop; - Statics[_StaticLyricsTop].Visible = lyricsOnTop; + _Lyrics[_LyricMainTop].Visible = lyricsOnTop; + _Lyrics[_LyricSubTop].Visible = lyricsOnTop; + _Statics[_StaticLyricsTop].Visible = lyricsOnTop; } } @@ -781,54 +781,54 @@ namespace Vocaluxe.Screens for (int j = 0; j < CGame.NumPlayer; j++) { if (CGame.Player[j].LineNr == i) - SingNotes[_SingBars].AddLine(_NoteLines[j], line, nr, j); + _SingNotes[_SingBars].AddLine(_NoteLines[j], line, nr, j); } if (i == 0 && !song.IsDuet || i == 1 && song.IsDuet) { - Lyrics[_LyricMain].SetLine(line[nr]); - Lyrics[_LyricMainTop].SetLine(line[nr]); + _Lyrics[_LyricMain].SetLine(line[nr]); + _Lyrics[_LyricMainTop].SetLine(line[nr]); _TimeToFirstNote = CGame.GetTimeFromBeats(line[nr].FirstNoteBeat - line[nr].StartBeat, song.BPM); _RemainingTimeToFirstNote = CGame.GetTimeFromBeats(line[nr].FirstNoteBeat - CGame.GetBeatFromTime(_CurrentTime, song.BPM, song.Gap), song.BPM); if (line.Length >= nr + 2) { - Lyrics[_LyricSub].SetLine(line[nr + 1]); - Lyrics[_LyricSubTop].SetLine(line[nr + 1]); + _Lyrics[_LyricSub].SetLine(line[nr + 1]); + _Lyrics[_LyricSubTop].SetLine(line[nr + 1]); } else { - Lyrics[_LyricSub].Clear(); - Lyrics[_LyricSubTop].Clear(); + _Lyrics[_LyricSub].Clear(); + _Lyrics[_LyricSubTop].Clear(); } } if (i == 0 && song.IsDuet) { - Lyrics[_LyricMainDuet].SetLine(line[nr]); + _Lyrics[_LyricMainDuet].SetLine(line[nr]); _TimeToFirstNoteDuet = CGame.GetTimeFromBeats(line[nr].FirstNoteBeat - line[nr].StartBeat, song.BPM); _RemainingTimeToFirstNoteDuet = CGame.GetTimeFromBeats(line[nr].FirstNoteBeat - CGame.GetBeatFromTime(_CurrentTime, song.BPM, song.Gap), song.BPM); if (line.Length >= nr + 2) - Lyrics[_LyricSubDuet].SetLine(line[nr + 1]); + _Lyrics[_LyricSubDuet].SetLine(line[nr + 1]); else - Lyrics[_LyricSubDuet].Clear(); + _Lyrics[_LyricSubDuet].Clear(); } } else { if (i == 0 && !song.IsDuet || i == 1 && song.IsDuet) { - Lyrics[_LyricMain].Clear(); - Lyrics[_LyricSub].Clear(); - Lyrics[_LyricMainTop].Clear(); - Lyrics[_LyricSubTop].Clear(); + _Lyrics[_LyricMain].Clear(); + _Lyrics[_LyricSub].Clear(); + _Lyrics[_LyricMainTop].Clear(); + _Lyrics[_LyricSubTop].Clear(); _TimeToFirstNote = 0f; } if (i == 0 && song.IsDuet) { - Lyrics[_LyricMainDuet].Clear(); - Lyrics[_LyricSubDuet].Clear(); + _Lyrics[_LyricMainDuet].Clear(); + _Lyrics[_LyricSubDuet].Clear(); _TimeToFirstNoteDuet = 0f; } } @@ -840,19 +840,19 @@ namespace Vocaluxe.Screens _Pause = !_Pause; if (_Pause) { - Buttons[_ButtonCancel].Visible = true; - Buttons[_ButtonContinue].Visible = true; + _Buttons[_ButtonCancel].Visible = true; + _Buttons[_ButtonContinue].Visible = true; if (CGame.NumRounds > CGame.RoundNr && CGame.NumRounds > 1) - Buttons[_ButtonSkip].Visible = true; + _Buttons[_ButtonSkip].Visible = true; else - Buttons[_ButtonSkip].Visible = false; + _Buttons[_ButtonSkip].Visible = false; CSound.Pause(_CurrentStream); } else { - Buttons[_ButtonCancel].Visible = false; - Buttons[_ButtonContinue].Visible = false; - Buttons[_ButtonSkip].Visible = false; + _Buttons[_ButtonCancel].Visible = false; + _Buttons[_ButtonContinue].Visible = false; + _Buttons[_ButtonSkip].Visible = false; CSound.Play(_CurrentStream); CWebcam.Start(); } @@ -869,7 +869,7 @@ namespace Vocaluxe.Screens { if (player <= numplayer) { - string target = "P" + (player + 1).ToString() + "N" + (numplayer + 1).ToString(); + string target = "P" + (player + 1) + "N" + (numplayer + 1); _TextScores[player, numplayer] = "TextScore" + target; _TextNames[player, numplayer] = "TextName" + target; @@ -891,7 +891,7 @@ namespace Vocaluxe.Screens { if (player <= numplayer) { - string target = "P" + (player + 1).ToString() + "N" + (numplayer + 1).ToString(); + string target = "P" + (player + 1) + "N" + (numplayer + 1); _StaticScores[player, numplayer] = "StaticScore" + target; _StaticAvatars[player, numplayer] = "StaticAvatar" + target; @@ -904,17 +904,17 @@ namespace Vocaluxe.Screens private void _SetVisibility() { - Statics[_StaticLyricsDuet].Visible = false; - Statics[_StaticLyricHelper].Visible = false; - Statics[_StaticLyricHelperDuet].Visible = false; - Statics[_StaticLyricHelperTop].Visible = false; - Lyrics[_LyricMainDuet].Visible = false; - Lyrics[_LyricSubDuet].Visible = false; + _Statics[_StaticLyricsDuet].Visible = false; + _Statics[_StaticLyricHelper].Visible = false; + _Statics[_StaticLyricHelperDuet].Visible = false; + _Statics[_StaticLyricHelperTop].Visible = false; + _Lyrics[_LyricMainDuet].Visible = false; + _Lyrics[_LyricSubDuet].Visible = false; - Statics[_StaticSongText].Visible = false; - Texts[_TextSongName].Visible = false; - Texts[_TextDuetName1].Visible = false; - Texts[_TextDuetName2].Visible = false; + _Statics[_StaticSongText].Visible = false; + _Texts[_TextSongName].Visible = false; + _Texts[_TextDuetName1].Visible = false; + _Texts[_TextDuetName2].Visible = false; for (int numplayer = 0; numplayer < CSettings.MaxNumPlayer; numplayer++) { @@ -922,13 +922,13 @@ namespace Vocaluxe.Screens { if (player <= numplayer) { - Texts[_TextScores[player, numplayer]].Visible = numplayer + 1 == CGame.NumPlayer; - Texts[_TextNames[player, numplayer]].Visible = (numplayer + 1 == CGame.NumPlayer) + _Texts[_TextScores[player, numplayer]].Visible = numplayer + 1 == CGame.NumPlayer; + _Texts[_TextNames[player, numplayer]].Visible = (numplayer + 1 == CGame.NumPlayer) && (CConfig.PlayerInfo == EPlayerInfo.TR_CONFIG_PLAYERINFO_BOTH || CConfig.PlayerInfo == EPlayerInfo.TR_CONFIG_PLAYERINFO_NAME); - Statics[_StaticScores[player, numplayer]].Visible = numplayer + 1 == CGame.NumPlayer; - Statics[_StaticAvatars[player, numplayer]].Visible = (numplayer + 1 == CGame.NumPlayer) + _Statics[_StaticScores[player, numplayer]].Visible = numplayer + 1 == CGame.NumPlayer; + _Statics[_StaticAvatars[player, numplayer]].Visible = (numplayer + 1 == CGame.NumPlayer) && (CConfig.PlayerInfo == EPlayerInfo.TR_CONFIG_PLAYERINFO_BOTH || CConfig.PlayerInfo == EPlayerInfo.TR_CONFIG_PLAYERINFO_AVATAR); @@ -936,23 +936,23 @@ namespace Vocaluxe.Screens } } - Lyrics[_LyricMain].Alpha = 0f; - Lyrics[_LyricSub].Alpha = 0f; + _Lyrics[_LyricMain].Alpha = 0f; + _Lyrics[_LyricSub].Alpha = 0f; - Lyrics[_LyricMainTop].Alpha = 0f; - Lyrics[_LyricSubTop].Alpha = 0f; + _Lyrics[_LyricMainTop].Alpha = 0f; + _Lyrics[_LyricSubTop].Alpha = 0f; - Statics[_StaticLyrics].Alpha = 0f; - Statics[_StaticLyricsTop].Alpha = 0f; + _Statics[_StaticLyrics].Alpha = 0f; + _Statics[_StaticLyricsTop].Alpha = 0f; - Statics[_StaticLyricHelper].Alpha = 0f; - Statics[_StaticLyricHelperTop].Alpha = 0f; + _Statics[_StaticLyricHelper].Alpha = 0f; + _Statics[_StaticLyricHelperTop].Alpha = 0f; - Lyrics[_LyricMainDuet].Alpha = 0f; - Lyrics[_LyricSubDuet].Alpha = 0f; + _Lyrics[_LyricMainDuet].Alpha = 0f; + _Lyrics[_LyricSubDuet].Alpha = 0f; - Statics[_StaticLyricsDuet].Alpha = 0f; - Statics[_StaticLyricHelperDuet].Alpha = 0f; + _Statics[_StaticLyricsDuet].Alpha = 0f; + _Statics[_StaticLyricHelperDuet].Alpha = 0f; } private void _DrawLyricHelper() @@ -981,28 +981,28 @@ namespace Vocaluxe.Screens if (time > totaltime) time = totaltime; - SRectF rect = Statics[_StaticLyricHelper].Rect; + SRectF rect = _Statics[_StaticLyricHelper].Rect; SColorF color = new SColorF( - Statics[_StaticLyricHelper].Color.R, - Statics[_StaticLyricHelper].Color.G, - Statics[_StaticLyricHelper].Color.B, - Statics[_StaticLyricHelper].Color.A * Statics[_StaticLyricHelper].Alpha * alpha); + _Statics[_StaticLyricHelper].Color.R, + _Statics[_StaticLyricHelper].Color.G, + _Statics[_StaticLyricHelper].Color.B, + _Statics[_StaticLyricHelper].Color.A * _Statics[_StaticLyricHelper].Alpha * alpha); - float distance = Lyrics[_LyricMain].GetCurrentLyricPosX() - rect.X - rect.W; - CDraw.DrawTexture(Statics[_StaticLyricHelper].Texture, + float distance = _Lyrics[_LyricMain].GetCurrentLyricPosX() - rect.X - rect.W; + CDraw.DrawTexture(_Statics[_StaticLyricHelper].Texture, new SRectF(rect.X + distance * (1f - time / totaltime), rect.Y, rect.W, rect.H, rect.Z), color); - if (Statics[_StaticLyricsTop].Visible) + if (_Statics[_StaticLyricsTop].Visible) { - rect = Statics[_StaticLyricHelperTop].Rect; + rect = _Statics[_StaticLyricHelperTop].Rect; color = new SColorF( - Statics[_StaticLyricHelperTop].Color.R, - Statics[_StaticLyricHelperTop].Color.G, - Statics[_StaticLyricHelperTop].Color.B, - Statics[_StaticLyricHelperTop].Color.A * Statics[_StaticLyricHelper].Alpha * alpha); + _Statics[_StaticLyricHelperTop].Color.R, + _Statics[_StaticLyricHelperTop].Color.G, + _Statics[_StaticLyricHelperTop].Color.B, + _Statics[_StaticLyricHelperTop].Color.A * _Statics[_StaticLyricHelper].Alpha * alpha); - distance = Lyrics[_LyricMainTop].GetCurrentLyricPosX() - rect.X - rect.W; - CDraw.DrawTexture(Statics[_StaticLyricHelperTop].Texture, + distance = _Lyrics[_LyricMainTop].GetCurrentLyricPosX() - rect.X - rect.W; + CDraw.DrawTexture(_Statics[_StaticLyricHelperTop].Texture, new SRectF(rect.X + distance * (1f - time / totaltime), rect.Y, rect.W, rect.H, rect.Z), color); } } @@ -1020,16 +1020,16 @@ namespace Vocaluxe.Screens if (time > totaltime) time = totaltime; - SRectF rect = Statics[_StaticLyricHelperDuet].Rect; + SRectF rect = _Statics[_StaticLyricHelperDuet].Rect; SColorF color = new SColorF( - Statics[_StaticLyricHelperDuet].Color.R, - Statics[_StaticLyricHelperDuet].Color.G, - Statics[_StaticLyricHelperDuet].Color.B, - Statics[_StaticLyricHelperDuet].Color.A * Statics[_StaticLyricHelperDuet].Alpha * alpha); + _Statics[_StaticLyricHelperDuet].Color.R, + _Statics[_StaticLyricHelperDuet].Color.G, + _Statics[_StaticLyricHelperDuet].Color.B, + _Statics[_StaticLyricHelperDuet].Color.A * _Statics[_StaticLyricHelperDuet].Alpha * alpha); - float distance = Lyrics[_LyricMainDuet].GetCurrentLyricPosX() - rect.X - rect.W; - CDraw.DrawTexture(Statics[_StaticLyricHelperDuet].Texture, + float distance = _Lyrics[_LyricMainDuet].GetCurrentLyricPosX() - rect.X - rect.W; + CDraw.DrawTexture(_Statics[_StaticLyricHelperDuet].Texture, new SRectF(rect.X + distance * (1f - time / totaltime), rect.Y, rect.W, rect.H, rect.Z), color); } @@ -1121,8 +1121,7 @@ namespace Vocaluxe.Screens // sub if (currentLineSub < line.Length - 2) { - float diff = 0f; - diff = CGame.GetTimeFromBeats(line[currentLineSub + 1].FirstNoteBeat, song.BPM) - currentTime; + float diff = CGame.GetTimeFromBeats(line[currentLineSub + 1].FirstNoteBeat, song.BPM) - currentTime; if (diff > dt) alpha[i * 2 + 1] = 1f - (diff - dt) / rt; @@ -1140,36 +1139,36 @@ namespace Vocaluxe.Screens private void _UpdateSongText() { - if (_TimerSongText.IsRunning && !Lyrics[_LyricMainDuet].Visible && !Lyrics[_LyricMainTop].Visible) + if (_TimerSongText.IsRunning && !_Lyrics[_LyricMainDuet].Visible && !_Lyrics[_LyricMainTop].Visible) { float t = _TimerSongText.ElapsedMilliseconds / 1000f; if (t < 10f) { - Statics[_StaticSongText].Visible = true; - Texts[_TextSongName].Visible = true; + _Statics[_StaticSongText].Visible = true; + _Texts[_TextSongName].Visible = true; if (t < 7f) { - Statics[_StaticSongText].Color.A = 1f; - Texts[_TextSongName].Color.A = 1f; + _Statics[_StaticSongText].Color.A = 1f; + _Texts[_TextSongName].Color.A = 1f; } else { - Statics[_StaticSongText].Color.A = (3f - (t - 7f)) / 3f; - Texts[_TextSongName].Color.A = (3f - (t - 7f)) / 3f; + _Statics[_StaticSongText].Color.A = (3f - (t - 7f)) / 3f; + _Texts[_TextSongName].Color.A = (3f - (t - 7f)) / 3f; } } else { - Statics[_StaticSongText].Visible = false; - Texts[_TextSongName].Visible = false; + _Statics[_StaticSongText].Visible = false; + _Texts[_TextSongName].Visible = false; _TimerSongText.Stop(); } } else { - Statics[_StaticSongText].Visible = false; - Texts[_TextSongName].Visible = false; + _Statics[_StaticSongText].Visible = false; + _Texts[_TextSongName].Visible = false; } } @@ -1183,50 +1182,50 @@ namespace Vocaluxe.Screens float t = _TimerDuetText1.ElapsedMilliseconds / 1000f; if (t < 10f) { - Texts[_TextDuetName1].Visible = true; + _Texts[_TextDuetName1].Visible = true; if (t < 3f) - Texts[_TextDuetName1].Color.A = (3f - (3f - t)) / 3f; + _Texts[_TextDuetName1].Color.A = (3f - (3f - t)) / 3f; else if (t < 7f) - Texts[_TextDuetName1].Color.A = 1f; + _Texts[_TextDuetName1].Color.A = 1f; else - Texts[_TextDuetName1].Color.A = (3f - (t - 7f)) / 3f; + _Texts[_TextDuetName1].Color.A = (3f - (t - 7f)) / 3f; } else { - Texts[_TextDuetName1].Visible = false; + _Texts[_TextDuetName1].Visible = false; _TimerDuetText1.Stop(); } } - else if (!_TimerDuetText1.IsRunning && _TimerDuetText1.ElapsedMilliseconds == 0 && Lyrics[_LyricMainDuet].Alpha > 0 && CGame.GetSong().IsDuet) + else if (!_TimerDuetText1.IsRunning && _TimerDuetText1.ElapsedMilliseconds == 0 && _Lyrics[_LyricMainDuet].Alpha > 0 && CGame.GetSong().IsDuet) _TimerDuetText1.Start(); else - Texts[_TextDuetName1].Visible = false; + _Texts[_TextDuetName1].Visible = false; //Timer for second duet-part if (_TimerDuetText2.IsRunning) { float t = _TimerDuetText2.ElapsedMilliseconds / 1000f; if (t < 10f) { - Texts[_TextDuetName2].Visible = true; + _Texts[_TextDuetName2].Visible = true; if (t < 3f) - Texts[_TextDuetName2].Color.A = (3f - (3f - t)) / 3f; + _Texts[_TextDuetName2].Color.A = (3f - (3f - t)) / 3f; else if (t < 7f) - Texts[_TextDuetName2].Color.A = 1f; + _Texts[_TextDuetName2].Color.A = 1f; else - Texts[_TextDuetName2].Color.A = (3f - (t - 7f)) / 3f; + _Texts[_TextDuetName2].Color.A = (3f - (t - 7f)) / 3f; } else { - Texts[_TextDuetName2].Visible = false; + _Texts[_TextDuetName2].Visible = false; _TimerDuetText2.Stop(); } } - else if (!_TimerDuetText2.IsRunning && _TimerDuetText2.ElapsedMilliseconds == 0 && Lyrics[_LyricMain].Alpha > 0 && CGame.GetSong().IsDuet) + else if (!_TimerDuetText2.IsRunning && _TimerDuetText2.ElapsedMilliseconds == 0 && _Lyrics[_LyricMain].Alpha > 0 && CGame.GetSong().IsDuet) _TimerDuetText2.Start(); else - Texts[_TextDuetName2].Visible = false; + _Texts[_TextDuetName2].Visible = false; } } @@ -1253,19 +1252,19 @@ namespace Vocaluxe.Screens case ETimerMode.TR_CONFIG_TIMERMODE_CURRENT: int min = (int)Math.Floor(currentTime / 60f); int sec = (int)(currentTime - min * 60f); - Texts[_TextTime].Text = min.ToString("00") + ":" + sec.ToString("00"); + _Texts[_TextTime].Text = min.ToString("00") + ":" + sec.ToString("00"); break; case ETimerMode.TR_CONFIG_TIMERMODE_REMAINING: min = (int)Math.Floor(remainingTime / 60f); sec = (int)(remainingTime - min * 60f); - Texts[_TextTime].Text = "-" + min.ToString("00") + ":" + sec.ToString("00"); + _Texts[_TextTime].Text = "-" + min.ToString("00") + ":" + sec.ToString("00"); break; case ETimerMode.TR_CONFIG_TIMERMODE_TOTAL: min = (int)Math.Floor(totalTime / 60f); sec = (int)(totalTime - min * 60f); - Texts[_TextTime].Text = "#" + min.ToString("00") + ":" + sec.ToString("00"); + _Texts[_TextTime].Text = "#" + min.ToString("00") + ":" + sec.ToString("00"); break; } @@ -1273,43 +1272,43 @@ namespace Vocaluxe.Screens switch (CConfig.TimerLook) { case ETimerLook.TR_CONFIG_TIMERLOOK_NORMAL: - _TimeLineRect.W = Statics[_StaticTimeLine].Rect.W * (currentTime / totalTime); + _TimeLineRect.W = _Statics[_StaticTimeLine].Rect.W * (currentTime / totalTime); break; case ETimerLook.TR_CONFIG_TIMERLOOK_EXPANDED: - CStatic stat = Statics[_StaticTimeLine]; + CStatic stat = _Statics[_StaticTimeLine]; int currentBeat = CGame.CurrentBeat; for (int i = 0; i < _TimeRects.Count; i++) { if (currentBeat >= _TimeRects[i].StartBeat && currentBeat <= _TimeRects[i].EndBeat) { - _TimeRects[i].Rect.Texture = Statics[_StaticTimeLineExpandedHighlighted].Texture; - _TimeRects[i].Rect.Color = Statics[_StaticTimeLineExpandedHighlighted].Color; + _TimeRects[i].Rect.Texture = _Statics[_StaticTimeLineExpandedHighlighted].Texture; + _TimeRects[i].Rect.Color = _Statics[_StaticTimeLineExpandedHighlighted].Color; } else { - _TimeRects[i].Rect.Texture = Statics[_StaticTimeLineExpandedNormal].Texture; - _TimeRects[i].Rect.Color = Statics[_StaticTimeLineExpandedNormal].Color; + _TimeRects[i].Rect.Texture = _Statics[_StaticTimeLineExpandedNormal].Texture; + _TimeRects[i].Rect.Color = _Statics[_StaticTimeLineExpandedNormal].Color; } } - Statics[_StaticTimePointer].Rect.X = stat.Rect.X + stat.Rect.W * (currentTime / totalTime); + _Statics[_StaticTimePointer].Rect.X = stat.Rect.X + stat.Rect.W * (currentTime / totalTime); break; } } private void _PrepareTimeLine() { - CStatic stat = Statics[_StaticTimeLine]; + CStatic stat = _Statics[_StaticTimeLine]; switch (CConfig.TimerLook) { case ETimerLook.TR_CONFIG_TIMERLOOK_NORMAL: _TimeLineRect = new SRectF(stat.Rect.X, stat.Rect.Y, 0f, stat.Rect.H, stat.Rect.Z); - Statics[_StaticTimePointer].Visible = false; + _Statics[_StaticTimePointer].Visible = false; break; case ETimerLook.TR_CONFIG_TIMERLOOK_EXPANDED: _TimeRects.Clear(); - Statics[_StaticTimePointer].Visible = true; + _Statics[_StaticTimePointer].Visible = true; CSong song = CGame.GetSong(); @@ -1325,18 +1324,14 @@ namespace Vocaluxe.Screens if (totalTime <= 0f) return; - CLines[] lines = new CLines[song.Notes.Lines.Length]; - lines = song.Notes.Lines; - for (int i = 0; i < lines.Length; i++) - { - CLine[] line = lines[i].Line; + CLines[] partLines = song.Notes.Lines; + foreach (CLines partLine in partLines) { + CLine[] line = partLine.Line; for (int j = 0; j < line.Length; j++) { if (line[j].VisibleInTimeLine) { - STimeRect trect = new STimeRect(); - trect.StartBeat = line[j].FirstNoteBeat; - trect.EndBeat = line[j].EndBeat; + STimeRect trect = new STimeRect {StartBeat = line[j].FirstNoteBeat, EndBeat = line[j].EndBeat}; trect.Rect = GetNewStatic(new STexture(-1), new SColorF(1f, 1f, 1f, 1f), new SRectF( @@ -1359,9 +1354,9 @@ namespace Vocaluxe.Screens for (int i = 0; i < CGame.NumPlayer; i++) { if (CGame.Player[i].ProfileID > -1 && CProfiles.NumProfiles > CGame.Player[i].ProfileID) - Statics[_StaticAvatars[i, CGame.NumPlayer - 1]].Texture = CProfiles.Profiles[CGame.Player[i].ProfileID].Avatar.Texture; + _Statics[_StaticAvatars[i, CGame.NumPlayer - 1]].Texture = CProfiles.Profiles[CGame.Player[i].ProfileID].Avatar.Texture; else - Statics[_StaticAvatars[i, CGame.NumPlayer - 1]].Visible = false; + _Statics[_StaticAvatars[i, CGame.NumPlayer - 1]].Visible = false; } } @@ -1370,9 +1365,9 @@ namespace Vocaluxe.Screens for (int i = 0; i < CGame.NumPlayer; i++) { if (CGame.Player[i].ProfileID > -1 && CProfiles.NumProfiles > CGame.Player[i].ProfileID) - Texts[_TextNames[i, CGame.NumPlayer - 1]].Text = CProfiles.Profiles[CGame.Player[i].ProfileID].PlayerName; + _Texts[_TextNames[i, CGame.NumPlayer - 1]].Text = CProfiles.Profiles[CGame.Player[i].ProfileID].PlayerName; else - Texts[_TextNames[i, CGame.NumPlayer - 1]].Visible = false; + _Texts[_TextNames[i, CGame.NumPlayer - 1]].Visible = false; } } } diff --git a/Vocaluxe/Screens/CScreenSong.cs b/Vocaluxe/Screens/CScreenSong.cs index 8501000e..2db8b37a 100644 --- a/Vocaluxe/Screens/CScreenSong.cs +++ b/Vocaluxe/Screens/CScreenSong.cs @@ -140,11 +140,11 @@ namespace Vocaluxe.Screens { base.LoadTheme(xmlPath); _ToggleSongOptions(ESongOptionsView.None); - Playlists[_Playlist].Visible = false; + _Playlists[_Playlist].Visible = false; _DragAndDropCover = GetNewStatic(); - Playlists[_Playlist].Init(); + _Playlists[_Playlist].Init(); _AvailableGameModes.Clear(); @@ -159,7 +159,7 @@ namespace Vocaluxe.Screens if (_PlaylistActive) { - Playlists[_Playlist].HandleInput(keyEvent); + _Playlists[_Playlist].HandleInput(keyEvent); return true; } @@ -177,7 +177,7 @@ namespace Vocaluxe.Screens } else { - SongMenus[_SongMenu].HandleInput(ref keyEvent, _Sso); + _SongMenus[_SongMenu].HandleInput(ref keyEvent, _Sso); _UpdatePartyModeOptions(); if (keyEvent.Handled) @@ -203,19 +203,19 @@ namespace Vocaluxe.Screens { if (i < _Sso.Selection.NumJokers.Length) { - if (Buttons[_ButtonsJoker[i]].Selected) + if (_Buttons[_ButtonsJoker[i]].Selected) { _SelectNextRandom(i); return true; } } } - if (Buttons[_ButtonStart].Selected) - _HandlePartySongSelection(SongMenus[_SongMenu].GetSelectedSong()); + if (_Buttons[_ButtonStart].Selected) + _HandlePartySongSelection(_SongMenus[_SongMenu].GetSelectedSong()); } if (CSongs.NumVisibleSongs > 0 && !_Sso.Selection.PartyMode) { - if (SongMenus[_SongMenu].GetSelectedSong() != -1 && !_SongOptionsActive) + if (_SongMenus[_SongMenu].GetSelectedSong() != -1 && !_SongOptionsActive) { if (!_Sso.Selection.PartyMode) _ToggleSongOptions(ESongOptionsView.Song); @@ -224,11 +224,11 @@ namespace Vocaluxe.Screens break; case Keys.Tab: - if (Playlists[_Playlist].Visible) + if (_Playlists[_Playlist].Visible) { _PlaylistActive = !_PlaylistActive; - Playlists[_Playlist].Selected = _PlaylistActive; - SongMenus[_SongMenu].SetActive(!_PlaylistActive); + _Playlists[_Playlist].Selected = _PlaylistActive; + _SongMenus[_SongMenu].SetActive(!_PlaylistActive); } break; @@ -277,7 +277,7 @@ namespace Vocaluxe.Screens case Keys.S: if (keyEvent.Mod == EModifier.Ctrl && CSongs.NumVisibleSongs > 0 && !_Sso.Selection.PartyMode) - _StartMedleySong(SongMenus[_SongMenu].GetSelectedSong()); + _StartMedleySong(_SongMenus[_SongMenu].GetSelectedSong()); break; case Keys.D1: @@ -312,39 +312,39 @@ namespace Vocaluxe.Screens switch (keyEvent.Key) { case Keys.Enter: - if (Buttons[_ButtonOptionsClose].Selected) + if (_Buttons[_ButtonOptionsClose].Selected) _ToggleSongOptions(ESongOptionsView.None); - else if (Buttons[_ButtonOptionsSing].Selected) + else if (_Buttons[_ButtonOptionsSing].Selected) { _ToggleSongOptions(ESongOptionsView.None); - _StartSong(SongMenus[_SongMenu].GetSelectedSong()); + _StartSong(_SongMenus[_SongMenu].GetSelectedSong()); } - else if (Buttons[_ButtonOptionsPlaylist].Selected) + else if (_Buttons[_ButtonOptionsPlaylist].Selected) { _ToggleSongOptions(ESongOptionsView.None); _OpenAndAddPlaylistAction(); } - else if (Buttons[_ButtonOptionsRandom].Selected) + else if (_Buttons[_ButtonOptionsRandom].Selected) { if (CSongs.IsInCategory) - SongMenus[_SongMenu].SetSelectedSong(CSongs.GetRandomSong()); + _SongMenus[_SongMenu].SetSelectedSong(CSongs.GetRandomSong()); else - SongMenus[_SongMenu].SetSelectedCategory(CSongs.GetRandomCategory()); + _SongMenus[_SongMenu].SetSelectedCategory(CSongs.GetRandomCategory()); } - else if (Buttons[_ButtonOptionsSingAll].Selected) + else if (_Buttons[_ButtonOptionsSingAll].Selected) _StartRandomAllSongs(); - else if (Buttons[_ButtonOptionsSingAllVisible].Selected) + else if (_Buttons[_ButtonOptionsSingAllVisible].Selected) _StartRandomVisibleSongs(); - else if (Buttons[_ButtonOptionsOpenSelectedItem].Selected) + else if (_Buttons[_ButtonOptionsOpenSelectedItem].Selected) _HandleSelectButton(); - else if (SelectSlides[_SelectSlideOptionsPlaylistOpen].Selected) + else if (_SelectSlides[_SelectSlideOptionsPlaylistOpen].Selected) _OpenPlaylistAction(); - else if (Buttons[_ButtonOptionsRandomMedley].Selected) + else if (_Buttons[_ButtonOptionsRandomMedley].Selected) _ToggleSongOptions(ESongOptionsView.Medley); - else if (Buttons[_ButtonOptionsStartMedley].Selected) + else if (_Buttons[_ButtonOptionsStartMedley].Selected) { _ToggleSongOptions(ESongOptionsView.None); - _StartRandomMedley(SelectSlides[_SelectSlideOptionsNumMedleySongs].Selection + 1, !CSongs.IsInCategory); + _StartRandomMedley(_SelectSlides[_SelectSlideOptionsNumMedleySongs].Selection + 1, !CSongs.IsInCategory); } break; @@ -388,24 +388,24 @@ namespace Vocaluxe.Screens _OldMousePosX = mouseEvent.X; _OldMousePosY = mouseEvent.Y; - if (Playlists[_Playlist].Visible && Playlists[_Playlist].IsMouseOver(mouseEvent)) + if (_Playlists[_Playlist].Visible && _Playlists[_Playlist].IsMouseOver(mouseEvent)) { _PlaylistActive = true; - Playlists[_Playlist].Selected = _PlaylistActive; - SongMenus[_SongMenu].SetActive(!_PlaylistActive); + _Playlists[_Playlist].Selected = _PlaylistActive; + _SongMenus[_SongMenu].SetActive(!_PlaylistActive); _ToggleSongOptions(ESongOptionsView.None); } - else if (CHelper.IsInBounds(SongMenus[_SongMenu].Rect, mouseEvent.X, mouseEvent.Y)) + else if (CHelper.IsInBounds(_SongMenus[_SongMenu].Rect, mouseEvent.X, mouseEvent.Y)) { _PlaylistActive = false; - Playlists[_Playlist].Selected = _PlaylistActive; - SongMenus[_SongMenu].SetActive(!_PlaylistActive); + _Playlists[_Playlist].Selected = _PlaylistActive; + _SongMenus[_SongMenu].SetActive(!_PlaylistActive); } - if (Playlists[_Playlist].Visible && _PlaylistActive) + if (_Playlists[_Playlist].Visible && _PlaylistActive) { - if (Playlists[_Playlist].HandleMouse(mouseEvent)) + if (_Playlists[_Playlist].HandleMouse(mouseEvent)) return true; } @@ -440,15 +440,15 @@ namespace Vocaluxe.Screens { //TODO: Causes Bug if you select a song (e.g. with Select random song) and double click a normal button. //E.g. clicking to fast on Select random song starts the next random song. is this OK? - if (CSongs.NumVisibleSongs > 0 && SongMenus[_SongMenu].GetActualSelection() != -1) + if (CSongs.NumVisibleSongs > 0 && _SongMenus[_SongMenu].GetActualSelection() != -1) { _ToggleSongOptions(ESongOptionsView.None); - _StartVisibleSong(SongMenus[_SongMenu].GetActualSelection()); + _StartVisibleSong(_SongMenus[_SongMenu].GetActualSelection()); return true; } } - SongMenus[_SongMenu].HandleMouse(ref mouseEvent, _Sso); + _SongMenus[_SongMenu].HandleMouse(ref mouseEvent, _Sso); _UpdatePartyModeOptions(); if (mouseEvent.Handled) @@ -456,84 +456,84 @@ namespace Vocaluxe.Screens if (mouseEvent.LB) { - if (IsMouseOver(mouseEvent)) + if (_IsMouseOver(mouseEvent)) { - if (Buttons[_ButtonOpenOptions].Selected) + if (_Buttons[_ButtonOpenOptions].Selected) { _ToggleSongOptions(ESongOptionsView.General); return true; } - else if (Buttons[_ButtonOptionsClose].Selected) + else if (_Buttons[_ButtonOptionsClose].Selected) { _ToggleSongOptions(ESongOptionsView.None); return true; } - else if (Buttons[_ButtonOptionsSing].Selected) + else if (_Buttons[_ButtonOptionsSing].Selected) { _ToggleSongOptions(ESongOptionsView.None); - _StartSong(SongMenus[_SongMenu].GetSelectedSong()); + _StartSong(_SongMenus[_SongMenu].GetSelectedSong()); return true; } - else if (Buttons[_ButtonOptionsPlaylist].Selected) + else if (_Buttons[_ButtonOptionsPlaylist].Selected) { _ToggleSongOptions(ESongOptionsView.None); _OpenAndAddPlaylistAction(); return true; } - else if (Buttons[_ButtonOptionsRandom].Selected) + else if (_Buttons[_ButtonOptionsRandom].Selected) { if (CSongs.IsInCategory) { - SongMenus[_SongMenu].SetSelectedSong(CSongs.GetRandomSong()); + _SongMenus[_SongMenu].SetSelectedSong(CSongs.GetRandomSong()); return true; } } - else if (Buttons[_ButtonOptionsRandomCategory].Selected) + else if (_Buttons[_ButtonOptionsRandomCategory].Selected) { if (!CSongs.IsInCategory) { - SongMenus[_SongMenu].SetSelectedCategory(CSongs.GetRandomCategory()); + _SongMenus[_SongMenu].SetSelectedCategory(CSongs.GetRandomCategory()); return true; } } - else if (Buttons[_ButtonOptionsSingAll].Selected) + else if (_Buttons[_ButtonOptionsSingAll].Selected) { _ToggleSongOptions(ESongOptionsView.None); _StartRandomAllSongs(); return true; } - else if (Buttons[_ButtonOptionsSingAllVisible].Selected) + else if (_Buttons[_ButtonOptionsSingAllVisible].Selected) { _ToggleSongOptions(ESongOptionsView.None); _StartRandomVisibleSongs(); return true; } - else if (Buttons[_ButtonOptionsOpenSelectedItem].Selected) + else if (_Buttons[_ButtonOptionsOpenSelectedItem].Selected) { _HandleSelectButton(); return true; } - else if (SelectSlides[_SelectSlideOptionsPlaylistOpen].ValueSelected) + else if (_SelectSlides[_SelectSlideOptionsPlaylistOpen].ValueSelected) { _OpenPlaylistAction(); return true; } - else if (Buttons[_ButtonOptionsRandomMedley].Selected) + else if (_Buttons[_ButtonOptionsRandomMedley].Selected) { _ToggleSongOptions(ESongOptionsView.Medley); return true; } - else if (Buttons[_ButtonOptionsStartMedley].Selected) + else if (_Buttons[_ButtonOptionsStartMedley].Selected) { _ToggleSongOptions(ESongOptionsView.None); - _StartRandomMedley(SelectSlides[_SelectSlideOptionsNumMedleySongs].Selection + 1, !CSongs.IsInCategory); + _StartRandomMedley(_SelectSlides[_SelectSlideOptionsNumMedleySongs].Selection + 1, !CSongs.IsInCategory); return true; } else if (_Sso.Selection.RandomOnly && _Sso.Selection.NumJokers != null) { - if (Buttons[_ButtonStart].Selected) + if (_Buttons[_ButtonStart].Selected) { - _HandlePartySongSelection(SongMenus[_SongMenu].GetSelectedSong()); + _HandlePartySongSelection(_SongMenus[_SongMenu].GetSelectedSong()); return true; } @@ -541,7 +541,7 @@ namespace Vocaluxe.Screens { if (i < _Sso.Selection.NumJokers.Length) { - if (Buttons[_ButtonsJoker[i]].Selected) + if (_Buttons[_ButtonsJoker[i]].Selected) { _SelectNextRandom(i); return true; @@ -551,9 +551,9 @@ namespace Vocaluxe.Screens } } - if (CSongs.NumVisibleSongs > 0 && SongMenus[_SongMenu].GetActualSelection() != -1 && !_Sso.Selection.PartyMode) + if (CSongs.NumVisibleSongs > 0 && _SongMenus[_SongMenu].GetActualSelection() != -1 && !_Sso.Selection.PartyMode) { - if (SongMenus[_SongMenu].GetSelectedSong() != -1 && !_SongOptionsActive) + if (_SongMenus[_SongMenu].GetSelectedSong() != -1 && !_SongOptionsActive) { _ToggleSongOptions(ESongOptionsView.Song); return true; @@ -568,11 +568,11 @@ namespace Vocaluxe.Screens if (mouseEvent.LBH) { - if (!_DragAndDropActive && Playlists[_Playlist].Visible && CSongs.NumVisibleSongs > 0 && SongMenus[_SongMenu].GetActualSelection() != -1) + if (!_DragAndDropActive && _Playlists[_Playlist].Visible && CSongs.NumVisibleSongs > 0 && _SongMenus[_SongMenu].GetActualSelection() != -1) { - _DragAndDropCover = SongMenus[_SongMenu].GetSelectedSongCover(); + _DragAndDropCover = _SongMenus[_SongMenu].GetSelectedSongCover(); _DragAndDropCover.Rect.Z = CSettings.ZNear; - Playlists[_Playlist].DragAndDropSongID = CSongs.VisibleSongs[SongMenus[_SongMenu].GetActualSelection()].ID; + _Playlists[_Playlist].DragAndDropSongID = CSongs.VisibleSongs[_SongMenus[_SongMenu].GetActualSelection()].ID; _DragAndDropActive = true; return true; } @@ -582,7 +582,7 @@ namespace Vocaluxe.Screens if (!mouseEvent.LBH && _DragAndDropActive) { _DragAndDropActive = false; - Playlists[_Playlist].DragAndDropSongID = -1; + _Playlists[_Playlist].DragAndDropSongID = -1; return true; } @@ -599,7 +599,7 @@ namespace Vocaluxe.Screens else if (_Sso.Selection.CategoryChangeAllowed) { _ToggleSongOptions(ESongOptionsView.None); - SongMenus[_SongMenu].EnterCurrentCategory(); + _SongMenus[_SongMenu].EnterCurrentCategory(); } } @@ -616,7 +616,7 @@ namespace Vocaluxe.Screens _SearchText = _Sso.Sorting.SearchString; CGame.EnterNormalGame(); - SongMenus[_SongMenu].OnShow(); + _SongMenus[_SongMenu].OnShow(); if (_Sso.Selection.PartyMode) _PlaylistActive = false; @@ -624,52 +624,52 @@ namespace Vocaluxe.Screens if (_Sso.Selection.PartyMode) _ToggleSongOptions(ESongOptionsView.None); - SongMenus[_SongMenu].SetActive(!_PlaylistActive); - SongMenus[_SongMenu].SetSmallView(Playlists[_Playlist].Visible); + _SongMenus[_SongMenu].SetActive(!_PlaylistActive); + _SongMenus[_SongMenu].SetSmallView(_Playlists[_Playlist].Visible); - if (Playlists[_Playlist].ActivePlaylistID != -1) - Playlists[_Playlist].LoadPlaylist(Playlists[_Playlist].ActivePlaylistID); + if (_Playlists[_Playlist].ActivePlaylistID != -1) + _Playlists[_Playlist].LoadPlaylist(_Playlists[_Playlist].ActivePlaylistID); _DragAndDropActive = false; - Playlists[_Playlist].DragAndDropSongID = -1; + _Playlists[_Playlist].DragAndDropSongID = -1; UpdateGame(); } public override bool UpdateGame() { - if (SongMenus[_SongMenu].IsSmallView()) + if (_SongMenus[_SongMenu].IsSmallView()) CheckPlaylist(); - Texts[_TextCategory].Text = CSongs.GetCurrentCategoryName(); + _Texts[_TextCategory].Text = CSongs.GetCurrentCategoryName(); if (CSongs.Category > -1 || CConfig.Tabs == EOffOn.TR_CONFIG_OFF) CBackgroundMusic.Disabled = true; else CBackgroundMusic.Disabled = false; - int song = SongMenus[_SongMenu].GetActualSelection(); + int song = _SongMenus[_SongMenu].GetActualSelection(); if ((CSongs.Category >= 0 || CConfig.Tabs == EOffOn.TR_CONFIG_OFF) && song >= 0 && song < CSongs.VisibleSongs.Length) - Texts[_TextSelection].Text = CSongs.VisibleSongs[song].Artist + " - " + CSongs.VisibleSongs[song].Title; + _Texts[_TextSelection].Text = CSongs.VisibleSongs[song].Artist + " - " + CSongs.VisibleSongs[song].Title; else if (!CSongs.IsInCategory && song >= 0 && song < CSongs.Categories.Length) - Texts[_TextSelection].Text = CSongs.Categories[song].Name; + _Texts[_TextSelection].Text = CSongs.Categories[song].Name; else - Texts[_TextSelection].Text = String.Empty; + _Texts[_TextSelection].Text = String.Empty; - Texts[_TextSearchBar].Text = _SearchText; + _Texts[_TextSearchBar].Text = _SearchText; if (_SearchActive) { - Texts[_TextSearchBar].Text += '|'; + _Texts[_TextSearchBar].Text += '|'; - Texts[_TextSearchBar].Visible = true; - Texts[_TextSearchBarTitle].Visible = true; - Statics[_StaticSearchBar].Visible = true; + _Texts[_TextSearchBar].Visible = true; + _Texts[_TextSearchBarTitle].Visible = true; + _Statics[_StaticSearchBar].Visible = true; } else { - Texts[_TextSearchBar].Visible = false; - Texts[_TextSearchBarTitle].Visible = false; - Statics[_StaticSearchBar].Visible = false; + _Texts[_TextSearchBar].Visible = false; + _Texts[_TextSearchBarTitle].Visible = false; + _Statics[_StaticSearchBar].Visible = false; } _UpdatePartyModeOptions(); @@ -691,12 +691,12 @@ namespace Vocaluxe.Screens { base.OnClose(); CBackgroundMusic.Disabled = false; - SongMenus[_SongMenu].OnHide(); + _SongMenus[_SongMenu].OnHide(); } public override void ApplyVolume() { - SongMenus[_SongMenu].ApplyVolume(CConfig.PreviewMusicVolume); + _SongMenus[_SongMenu].ApplyVolume(CConfig.PreviewMusicVolume); } private void _HandlePartySongSelection(int songNr) @@ -723,12 +723,12 @@ namespace Vocaluxe.Screens _SelectNextRandomSong(); if (_Sso.Selection.SongIndex != -1) - SongMenus[_SongMenu].SetSelectedSong(_Sso.Selection.SongIndex); + _SongMenus[_SongMenu].SetSelectedSong(_Sso.Selection.SongIndex); } - if (_SelectedSongID != SongMenus[_SongMenu].GetSelectedSong() && CSongs.Category > -1) + if (_SelectedSongID != _SongMenus[_SongMenu].GetSelectedSong() && CSongs.Category > -1) { - _SelectedSongID = SongMenus[_SongMenu].GetSelectedSong(); + _SelectedSongID = _SongMenus[_SongMenu].GetSelectedSong(); CParty.OnSongChange(_SelectedSongID, ref _Sso); } @@ -745,55 +745,55 @@ namespace Vocaluxe.Screens _ToggleSongOptions(ESongOptionsView.None); } - SongMenus[_SongMenu].Update(_Sso); + _SongMenus[_SongMenu].Update(_Sso); if (_Sso.Selection.RandomOnly && _Sso.Selection.NumJokers != null) { - Buttons[_ButtonStart].Visible = true; + _Buttons[_ButtonStart].Visible = true; - if (!SongMenus[_SongMenu].IsSmallView()) - SongMenus[_SongMenu].SetSmallView(true); + if (!_SongMenus[_SongMenu].IsSmallView()) + _SongMenus[_SongMenu].SetSmallView(true); for (int i = 0; i < CMain.Settings.GetMaxNumPlayer(); i++) { if (i < _Sso.Selection.NumJokers.Length) { - Buttons[_ButtonsJoker[i]].Visible = true; - Buttons[_ButtonsJoker[i]].Text.Text = _Sso.Selection.NumJokers[i].ToString(); - Texts[_TextsPlayer[i]].Visible = true; + _Buttons[_ButtonsJoker[i]].Visible = true; + _Buttons[_ButtonsJoker[i]].Text.Text = _Sso.Selection.NumJokers[i].ToString(); + _Texts[_TextsPlayer[i]].Visible = true; bool nameExists = false; if (_Sso.Selection.TeamNames != null) { if (_Sso.Selection.TeamNames.Length > i) { - Texts[_TextsPlayer[i]].Text = _Sso.Selection.TeamNames[i]; + _Texts[_TextsPlayer[i]].Text = _Sso.Selection.TeamNames[i]; nameExists = true; } } if (!nameExists) - Texts[_TextsPlayer[i]].Text = i.ToString(); + _Texts[_TextsPlayer[i]].Text = i.ToString(); } else { - Buttons[_ButtonsJoker[i]].Visible = false; - Texts[_TextsPlayer[i]].Visible = false; + _Buttons[_ButtonsJoker[i]].Visible = false; + _Texts[_TextsPlayer[i]].Visible = false; } } } else { - if (_Sso.Selection.PartyMode && SongMenus[_SongMenu].IsSmallView()) - SongMenus[_SongMenu].SetSmallView(false); + if (_Sso.Selection.PartyMode && _SongMenus[_SongMenu].IsSmallView()) + _SongMenus[_SongMenu].SetSmallView(false); for (int i = 0; i < CMain.Settings.GetMaxNumPlayer(); i++) { - Buttons[_ButtonsJoker[i]].Visible = false; - Texts[_TextsPlayer[i]].Visible = false; + _Buttons[_ButtonsJoker[i]].Visible = false; + _Texts[_TextsPlayer[i]].Visible = false; } - Buttons[_ButtonStart].Visible = false; + _Buttons[_ButtonStart].Visible = false; } } @@ -802,8 +802,8 @@ namespace Vocaluxe.Screens if ((CSongs.Category >= 0) && (songNr >= 0)) { EGameMode gm; - if (_AvailableGameModes.Count >= SelectSlides[_SelectSlideOptionsMode].Selection) - gm = _AvailableGameModes[SelectSlides[_SelectSlideOptionsMode].Selection]; + if (_AvailableGameModes.Count >= _SelectSlides[_SelectSlideOptionsMode].Selection) + gm = _AvailableGameModes[_SelectSlides[_SelectSlideOptionsMode].Selection]; else { if (CSongs.VisibleSongs[songNr].IsDuet) @@ -976,7 +976,7 @@ namespace Vocaluxe.Screens if (CSongs.IsInCategory) { _ToggleSongOptions(ESongOptionsView.None); - SongMenus[_SongMenu].SetSelectedSong(CSongs.GetRandomSong()); + _SongMenus[_SongMenu].SetSelectedSong(CSongs.GetRandomSong()); return true; } return false; @@ -987,7 +987,7 @@ namespace Vocaluxe.Screens if (!CSongs.IsInCategory) { _ToggleSongOptions(ESongOptionsView.None); - SongMenus[_SongMenu].SetSelectedCategory(CSongs.GetRandomCategory()); + _SongMenus[_SongMenu].SetSelectedCategory(CSongs.GetRandomCategory()); return true; } return false; @@ -996,7 +996,7 @@ namespace Vocaluxe.Screens private void _JumpTo(char letter) { int start = 0; - int curSelected = SongMenus[_SongMenu].GetActualSelection(); + int curSelected = _SongMenus[_SongMenu].GetActualSelection(); if (CSongs.IsInCategory) { //TODO: Check and use sorting method @@ -1012,7 +1012,7 @@ namespace Vocaluxe.Screens if (visibleID < 0 && start > 1) visibleID = Array.FindIndex(songs, 0, start - 1, element => element.Artist.StartsWith(letter.ToString(), StringComparison.OrdinalIgnoreCase)); if (visibleID > -1) - SongMenus[_SongMenu].SetSelectedSong(visibleID); + _SongMenus[_SongMenu].SetSelectedSong(visibleID); } else { @@ -1024,7 +1024,7 @@ namespace Vocaluxe.Screens if (visibleID < 0 && start > 1) visibleID = Array.FindIndex(categories, 0, start - 1, element => element.Name.StartsWith(letter.ToString(), StringComparison.OrdinalIgnoreCase)); if (visibleID > -1) - SongMenus[_SongMenu].SetSelectedCategory(visibleID); + _SongMenus[_SongMenu].SetSelectedCategory(visibleID); } } @@ -1036,7 +1036,7 @@ namespace Vocaluxe.Screens bool refresh = false; _SearchText = newFilterString; - int songIndex = SongMenus[_SongMenu].GetSelectedSong(); + int songIndex = _SongMenus[_SongMenu].GetSelectedSong(); int songID = -1; if (songIndex != -1 && CSongs.NumVisibleSongs > 0 && CSongs.NumVisibleSongs > songIndex) songID = CSongs.VisibleSongs[songIndex].ID; @@ -1059,30 +1059,30 @@ namespace Vocaluxe.Screens refresh = true; if (refresh) - SongMenus[_SongMenu].OnHide(); + _SongMenus[_SongMenu].OnHide(); - SongMenus[_SongMenu].OnShow(); + _SongMenus[_SongMenu].OnShow(); } private void _ToggleSongOptions(ESongOptionsView view) { - SelectSlides[_SelectSlideOptionsMode].Visible = false; - SelectSlides[_SelectSlideOptionsPlaylistAdd].Visible = false; - SelectSlides[_SelectSlideOptionsPlaylistOpen].Visible = false; - SelectSlides[_SelectSlideOptionsNumMedleySongs].Visible = false; - Buttons[_ButtonOptionsClose].Visible = false; - Buttons[_ButtonOptionsSing].Visible = false; - Buttons[_ButtonOptionsPlaylist].Visible = false; - Buttons[_ButtonOptionsRandom].Visible = false; - Buttons[_ButtonOptionsRandomCategory].Visible = false; - Buttons[_ButtonOptionsSingAll].Visible = false; - Buttons[_ButtonOptionsSingAllVisible].Visible = false; - Buttons[_ButtonOptionsOpenSelectedItem].Visible = false; - Buttons[_ButtonOptionsRandomMedley].Visible = false; - Buttons[_ButtonOptionsStartMedley].Visible = false; - Texts[_TextOptionsTitle].Visible = false; - Statics[_StaticOptionsBG].Visible = false; - Buttons[_ButtonOpenOptions].Visible = true; + _SelectSlides[_SelectSlideOptionsMode].Visible = false; + _SelectSlides[_SelectSlideOptionsPlaylistAdd].Visible = false; + _SelectSlides[_SelectSlideOptionsPlaylistOpen].Visible = false; + _SelectSlides[_SelectSlideOptionsNumMedleySongs].Visible = false; + _Buttons[_ButtonOptionsClose].Visible = false; + _Buttons[_ButtonOptionsSing].Visible = false; + _Buttons[_ButtonOptionsPlaylist].Visible = false; + _Buttons[_ButtonOptionsRandom].Visible = false; + _Buttons[_ButtonOptionsRandomCategory].Visible = false; + _Buttons[_ButtonOptionsSingAll].Visible = false; + _Buttons[_ButtonOptionsSingAllVisible].Visible = false; + _Buttons[_ButtonOptionsOpenSelectedItem].Visible = false; + _Buttons[_ButtonOptionsRandomMedley].Visible = false; + _Buttons[_ButtonOptionsStartMedley].Visible = false; + _Texts[_TextOptionsTitle].Visible = false; + _Statics[_StaticOptionsBG].Visible = false; + _Buttons[_ButtonOpenOptions].Visible = true; _SongOptionsActive = view != ESongOptionsView.None; @@ -1091,10 +1091,10 @@ namespace Vocaluxe.Screens //Has to be done here otherwhise changed playlist names will not appear until OnShow is called! _UpdatePlaylistNames(); - Texts[_TextOptionsTitle].Visible = true; - Buttons[_ButtonOptionsClose].Visible = true; - Statics[_StaticOptionsBG].Visible = true; - Buttons[_ButtonOpenOptions].Visible = false; + _Texts[_TextOptionsTitle].Visible = true; + _Buttons[_ButtonOptionsClose].Visible = true; + _Statics[_StaticOptionsBG].Visible = true; + _Buttons[_ButtonOpenOptions].Visible = false; if (view == ESongOptionsView.Song) _ShowSongOptionsSong(); else if (view == ESongOptionsView.General) @@ -1108,88 +1108,88 @@ namespace Vocaluxe.Screens { EGameMode lastMode = EGameMode.TR_GAMEMODE_NORMAL; if (_AvailableGameModes.Count > 0) - lastMode = _AvailableGameModes[SelectSlides[_SelectSlideOptionsMode].Selection]; - SetInteractionToButton(Buttons[_ButtonOptionsSing]); + lastMode = _AvailableGameModes[_SelectSlides[_SelectSlideOptionsMode].Selection]; + _SetInteractionToButton(_Buttons[_ButtonOptionsSing]); _AvailableGameModes.Clear(); - SelectSlides[_SelectSlideOptionsMode].Clear(); - if (CSongs.VisibleSongs[SongMenus[_SongMenu].GetSelectedSong()].IsDuet) + _SelectSlides[_SelectSlideOptionsMode].Clear(); + if (CSongs.VisibleSongs[_SongMenus[_SongMenu].GetSelectedSong()].IsDuet) { - SelectSlides[_SelectSlideOptionsMode].AddValue(Enum.GetName(typeof(EGameMode), EGameMode.TR_GAMEMODE_DUET)); + _SelectSlides[_SelectSlideOptionsMode].AddValue(Enum.GetName(typeof(EGameMode), EGameMode.TR_GAMEMODE_DUET)); _AvailableGameModes.Add(EGameMode.TR_GAMEMODE_DUET); } else { - SelectSlides[_SelectSlideOptionsMode].AddValue(Enum.GetName(typeof(EGameMode), EGameMode.TR_GAMEMODE_NORMAL)); + _SelectSlides[_SelectSlideOptionsMode].AddValue(Enum.GetName(typeof(EGameMode), EGameMode.TR_GAMEMODE_NORMAL)); _AvailableGameModes.Add(EGameMode.TR_GAMEMODE_NORMAL); - SelectSlides[_SelectSlideOptionsMode].AddValue(Enum.GetName(typeof(EGameMode), EGameMode.TR_GAMEMODE_SHORTSONG)); + _SelectSlides[_SelectSlideOptionsMode].AddValue(Enum.GetName(typeof(EGameMode), EGameMode.TR_GAMEMODE_SHORTSONG)); _AvailableGameModes.Add(EGameMode.TR_GAMEMODE_SHORTSONG); } - if (CSongs.VisibleSongs[SongMenus[_SongMenu].GetSelectedSong()].Medley.Source != EMedleySource.None) + if (CSongs.VisibleSongs[_SongMenus[_SongMenu].GetSelectedSong()].Medley.Source != EMedleySource.None) { - SelectSlides[_SelectSlideOptionsMode].AddValue(Enum.GetName(typeof(EGameMode), EGameMode.TR_GAMEMODE_MEDLEY)); + _SelectSlides[_SelectSlideOptionsMode].AddValue(Enum.GetName(typeof(EGameMode), EGameMode.TR_GAMEMODE_MEDLEY)); _AvailableGameModes.Add(EGameMode.TR_GAMEMODE_MEDLEY); } //Set SelectSlide-Selection to last selected game-mode if possible for (int i = 0; i < _AvailableGameModes.Count; i++) { if (_AvailableGameModes[i] == lastMode) - SelectSlides[_SelectSlideOptionsMode].SetSelectionByValueIndex(i); + _SelectSlides[_SelectSlideOptionsMode].SetSelectionByValueIndex(i); } - SelectSlides[_SelectSlideOptionsMode].Visible = true; - SelectSlides[_SelectSlideOptionsPlaylistAdd].Visible = true; - Buttons[_ButtonOptionsSing].Visible = true; - Buttons[_ButtonOptionsPlaylist].Visible = true; - SetInteractionToButton(Buttons[_ButtonOptionsSing]); + _SelectSlides[_SelectSlideOptionsMode].Visible = true; + _SelectSlides[_SelectSlideOptionsPlaylistAdd].Visible = true; + _Buttons[_ButtonOptionsSing].Visible = true; + _Buttons[_ButtonOptionsPlaylist].Visible = true; + _SetInteractionToButton(_Buttons[_ButtonOptionsSing]); } private void _ShowSongOptionsGeneral() { if (CSongs.IsInCategory) { - Buttons[_ButtonOptionsRandom].Visible = true; - Buttons[_ButtonOptionsSingAllVisible].Visible = true; + _Buttons[_ButtonOptionsRandom].Visible = true; + _Buttons[_ButtonOptionsSingAllVisible].Visible = true; } else - Buttons[_ButtonOptionsRandomCategory].Visible = true; - Buttons[_ButtonOptionsSingAll].Visible = true; - Buttons[_ButtonOptionsRandomMedley].Visible = true; - Buttons[_ButtonOptionsOpenSelectedItem].Visible = true; + _Buttons[_ButtonOptionsRandomCategory].Visible = true; + _Buttons[_ButtonOptionsSingAll].Visible = true; + _Buttons[_ButtonOptionsRandomMedley].Visible = true; + _Buttons[_ButtonOptionsOpenSelectedItem].Visible = true; - if (SelectSlides[_SelectSlideOptionsPlaylistOpen].NumValues > 0) - SelectSlides[_SelectSlideOptionsPlaylistOpen].Visible = true; + if (_SelectSlides[_SelectSlideOptionsPlaylistOpen].NumValues > 0) + _SelectSlides[_SelectSlideOptionsPlaylistOpen].Visible = true; - if (Buttons[_ButtonOptionsRandom].Visible) - SetInteractionToButton(Buttons[_ButtonOptionsRandom]); + if (_Buttons[_ButtonOptionsRandom].Visible) + _SetInteractionToButton(_Buttons[_ButtonOptionsRandom]); else - SetInteractionToButton(Buttons[_ButtonOptionsRandomCategory]); + _SetInteractionToButton(_Buttons[_ButtonOptionsRandomCategory]); } private void _ShowSongOptionsMedley() { - Buttons[_ButtonOptionsStartMedley].Visible = true; - SelectSlides[_SelectSlideOptionsNumMedleySongs].Visible = true; - SelectSlides[_SelectSlideOptionsNumMedleySongs].Clear(); + _Buttons[_ButtonOptionsStartMedley].Visible = true; + _SelectSlides[_SelectSlideOptionsNumMedleySongs].Visible = true; + _SelectSlides[_SelectSlideOptionsNumMedleySongs].Clear(); if (CSongs.IsInCategory) { for (int i = 1; i <= CSongs.VisibleSongs.Length; i++) - SelectSlides[_SelectSlideOptionsNumMedleySongs].AddValue(i.ToString()); + _SelectSlides[_SelectSlideOptionsNumMedleySongs].AddValue(i.ToString()); } else { for (int i = 1; i <= CSongs.AllSongs.Length; i++) - SelectSlides[_SelectSlideOptionsNumMedleySongs].AddValue(i.ToString()); + _SelectSlides[_SelectSlideOptionsNumMedleySongs].AddValue(i.ToString()); } - if (SelectSlides[_SelectSlideOptionsNumMedleySongs].NumValues >= 5) - SelectSlides[_SelectSlideOptionsNumMedleySongs].SetSelectionByValueIndex(4); + if (_SelectSlides[_SelectSlideOptionsNumMedleySongs].NumValues >= 5) + _SelectSlides[_SelectSlideOptionsNumMedleySongs].SetSelectionByValueIndex(4); else - SelectSlides[_SelectSlideOptionsNumMedleySongs].SetSelectionByValueIndex(SelectSlides[_SelectSlideOptionsNumMedleySongs].NumValues - 1); - SetInteractionToButton(Buttons[_ButtonOptionsStartMedley]); + _SelectSlides[_SelectSlideOptionsNumMedleySongs].SetSelectionByValueIndex(_SelectSlides[_SelectSlideOptionsNumMedleySongs].NumValues - 1); + _SetInteractionToButton(_Buttons[_ButtonOptionsStartMedley]); } #region Playlist Actions public void CheckPlaylist() { - if (Playlists[_Playlist].ActivePlaylistID == -1 && _PlaylistActive) + if (_Playlists[_Playlist].ActivePlaylistID == -1 && _PlaylistActive) _ClosePlaylist(); } @@ -1197,100 +1197,100 @@ namespace Vocaluxe.Screens { if (CPlaylists.Playlists.Length > playlistID && playlistID > -1) { - Playlists[_Playlist].LoadPlaylist(playlistID); - SongMenus[_SongMenu].SetSmallView(true); - Playlists[_Playlist].Visible = true; + _Playlists[_Playlist].LoadPlaylist(playlistID); + _SongMenus[_SongMenu].SetSmallView(true); + _Playlists[_Playlist].Visible = true; } } private void _ClosePlaylist() { - if (Playlists[_Playlist].Visible || _PlaylistActive) + if (_Playlists[_Playlist].Visible || _PlaylistActive) { - SongMenus[_SongMenu].SetSmallView(false); + _SongMenus[_SongMenu].SetSmallView(false); _PlaylistActive = false; - Playlists[_Playlist].Selected = _PlaylistActive; - SongMenus[_SongMenu].SetActive(!_PlaylistActive); - Playlists[_Playlist].ClosePlaylist(); + _Playlists[_Playlist].Selected = _PlaylistActive; + _SongMenus[_SongMenu].SetActive(!_PlaylistActive); + _Playlists[_Playlist].ClosePlaylist(); } } private void _UpdatePlaylistNames() { - SelectSlides[_SelectSlideOptionsPlaylistAdd].Clear(); - SelectSlides[_SelectSlideOptionsPlaylistAdd].AddValue("TR_SCREENSONG_NEWPLAYLIST"); - SelectSlides[_SelectSlideOptionsPlaylistAdd].AddValues(CPlaylists.PlaylistNames); - SelectSlides[_SelectSlideOptionsPlaylistOpen].Clear(); - SelectSlides[_SelectSlideOptionsPlaylistOpen].AddValues(CPlaylists.PlaylistNames); + _SelectSlides[_SelectSlideOptionsPlaylistAdd].Clear(); + _SelectSlides[_SelectSlideOptionsPlaylistAdd].AddValue("TR_SCREENSONG_NEWPLAYLIST"); + _SelectSlides[_SelectSlideOptionsPlaylistAdd].AddValues(CPlaylists.PlaylistNames); + _SelectSlides[_SelectSlideOptionsPlaylistOpen].Clear(); + _SelectSlides[_SelectSlideOptionsPlaylistOpen].AddValues(CPlaylists.PlaylistNames); } private void _OpenPlaylistAction() { //Open a playlist - if (Playlists[_Playlist].ActivePlaylistID != SelectSlides[_SelectSlideOptionsPlaylistOpen].Selection) + if (_Playlists[_Playlist].ActivePlaylistID != _SelectSlides[_SelectSlideOptionsPlaylistOpen].Selection) { - Playlists[_Playlist].ActivePlaylistID = SelectSlides[_SelectSlideOptionsPlaylistOpen].Selection; + _Playlists[_Playlist].ActivePlaylistID = _SelectSlides[_SelectSlideOptionsPlaylistOpen].Selection; _SetSelectSlidePlaylistToCurrentPlaylist(); //Open playlist - _OpenPlaylist(Playlists[_Playlist].ActivePlaylistID); + _OpenPlaylist(_Playlists[_Playlist].ActivePlaylistID); } } private void _OpenAndAddPlaylistAction() { //Open an existing playlist and add song - if (Playlists[_Playlist].ActivePlaylistID != (SelectSlides[_SelectSlideOptionsPlaylistAdd].Selection - 1) && - (SelectSlides[_SelectSlideOptionsPlaylistAdd].Selection - 1) != -1) + if (_Playlists[_Playlist].ActivePlaylistID != (_SelectSlides[_SelectSlideOptionsPlaylistAdd].Selection - 1) && + (_SelectSlides[_SelectSlideOptionsPlaylistAdd].Selection - 1) != -1) { //Check selected game-mode EGameMode gm; - if (_AvailableGameModes.Count >= SelectSlides[_SelectSlideOptionsMode].Selection) - gm = _AvailableGameModes[SelectSlides[_SelectSlideOptionsMode].Selection]; - else if (CSongs.VisibleSongs[SongMenus[_SongMenu].GetSelectedSong()].IsDuet) + if (_AvailableGameModes.Count >= _SelectSlides[_SelectSlideOptionsMode].Selection) + gm = _AvailableGameModes[_SelectSlides[_SelectSlideOptionsMode].Selection]; + else if (CSongs.VisibleSongs[_SongMenus[_SongMenu].GetSelectedSong()].IsDuet) gm = EGameMode.TR_GAMEMODE_DUET; else gm = EGameMode.TR_GAMEMODE_NORMAL; //Check if Playlist really exists - if (SelectSlides[_SelectSlideOptionsPlaylistAdd].Selection - 1 >= 0) + if (_SelectSlides[_SelectSlideOptionsPlaylistAdd].Selection - 1 >= 0) { - Playlists[_Playlist].ActivePlaylistID = SelectSlides[_SelectSlideOptionsPlaylistAdd].Selection - 1; + _Playlists[_Playlist].ActivePlaylistID = _SelectSlides[_SelectSlideOptionsPlaylistAdd].Selection - 1; //Add song to playlist - CPlaylists.Playlists[Playlists[_Playlist].ActivePlaylistID].AddSong(CSongs.VisibleSongs[SongMenus[_SongMenu].GetSelectedSong()].ID, gm); + CPlaylists.Playlists[_Playlists[_Playlist].ActivePlaylistID].AddSong(CSongs.VisibleSongs[_SongMenus[_SongMenu].GetSelectedSong()].ID, gm); //Open playlist - _OpenPlaylist(Playlists[_Playlist].ActivePlaylistID); + _OpenPlaylist(_Playlists[_Playlist].ActivePlaylistID); _SetSelectSlidePlaylistToCurrentPlaylist(); - Playlists[_Playlist].ScrollToBottom(); + _Playlists[_Playlist].ScrollToBottom(); } } //Create a new playlist and add song - else if ((SelectSlides[_SelectSlideOptionsPlaylistAdd].Selection - 1) == -1) + else if ((_SelectSlides[_SelectSlideOptionsPlaylistAdd].Selection - 1) == -1) { //Check selected game-mode EGameMode gm; - if (_AvailableGameModes.Count >= SelectSlides[_SelectSlideOptionsMode].Selection) - gm = _AvailableGameModes[SelectSlides[_SelectSlideOptionsMode].Selection]; - else if (CSongs.VisibleSongs[SongMenus[_SongMenu].GetSelectedSong()].IsDuet) + if (_AvailableGameModes.Count >= _SelectSlides[_SelectSlideOptionsMode].Selection) + gm = _AvailableGameModes[_SelectSlides[_SelectSlideOptionsMode].Selection]; + else if (CSongs.VisibleSongs[_SongMenus[_SongMenu].GetSelectedSong()].IsDuet) gm = EGameMode.TR_GAMEMODE_DUET; else gm = EGameMode.TR_GAMEMODE_NORMAL; //Create new playlist - Playlists[_Playlist].ActivePlaylistID = CPlaylists.NewPlaylist(); + _Playlists[_Playlist].ActivePlaylistID = CPlaylists.NewPlaylist(); //Add song to playlist - CPlaylists.Playlists[Playlists[_Playlist].ActivePlaylistID].AddSong(CSongs.VisibleSongs[SongMenus[_SongMenu].GetSelectedSong()].ID, gm); + CPlaylists.Playlists[_Playlists[_Playlist].ActivePlaylistID].AddSong(CSongs.VisibleSongs[_SongMenus[_SongMenu].GetSelectedSong()].ID, gm); //Open playlist - _OpenPlaylist(Playlists[_Playlist].ActivePlaylistID); + _OpenPlaylist(_Playlists[_Playlist].ActivePlaylistID); //Add new playlist to select-slide - SelectSlides[_SelectSlideOptionsPlaylistAdd].AddValue(CPlaylists.Playlists[Playlists[_Playlist].ActivePlaylistID].PlaylistName); - SelectSlides[_SelectSlideOptionsPlaylistOpen].AddValue(CPlaylists.Playlists[Playlists[_Playlist].ActivePlaylistID].PlaylistName); + _SelectSlides[_SelectSlideOptionsPlaylistAdd].AddValue(CPlaylists.Playlists[_Playlists[_Playlist].ActivePlaylistID].PlaylistName); + _SelectSlides[_SelectSlideOptionsPlaylistOpen].AddValue(CPlaylists.Playlists[_Playlists[_Playlist].ActivePlaylistID].PlaylistName); _SetSelectSlidePlaylistToCurrentPlaylist(); } @@ -1299,24 +1299,24 @@ namespace Vocaluxe.Screens { //Check selected game-mode EGameMode gm; - if (_AvailableGameModes.Count >= SelectSlides[_SelectSlideOptionsMode].Selection) - gm = _AvailableGameModes[SelectSlides[_SelectSlideOptionsMode].Selection]; - else if (CSongs.VisibleSongs[SongMenus[_SongMenu].GetSelectedSong()].IsDuet) + if (_AvailableGameModes.Count >= _SelectSlides[_SelectSlideOptionsMode].Selection) + gm = _AvailableGameModes[_SelectSlides[_SelectSlideOptionsMode].Selection]; + else if (CSongs.VisibleSongs[_SongMenus[_SongMenu].GetSelectedSong()].IsDuet) gm = EGameMode.TR_GAMEMODE_DUET; else gm = EGameMode.TR_GAMEMODE_NORMAL; - CPlaylists.Playlists[Playlists[_Playlist].ActivePlaylistID].AddSong(CSongs.VisibleSongs[SongMenus[_SongMenu].GetSelectedSong()].ID, gm); - Playlists[_Playlist].UpdatePlaylist(); - Playlists[_Playlist].ScrollToBottom(); + CPlaylists.Playlists[_Playlists[_Playlist].ActivePlaylistID].AddSong(CSongs.VisibleSongs[_SongMenus[_SongMenu].GetSelectedSong()].ID, gm); + _Playlists[_Playlist].UpdatePlaylist(); + _Playlists[_Playlist].ScrollToBottom(); } } private void _SetSelectSlidePlaylistToCurrentPlaylist() { - if (Playlists[_Playlist].ActivePlaylistID > -1) - SelectSlides[_SelectSlideOptionsPlaylistAdd].Selection = Playlists[_Playlist].ActivePlaylistID + 1; + if (_Playlists[_Playlist].ActivePlaylistID > -1) + _SelectSlides[_SelectSlideOptionsPlaylistAdd].Selection = _Playlists[_Playlist].ActivePlaylistID + 1; else - SelectSlides[_SelectSlideOptionsPlaylistAdd].Selection = 0; + _SelectSlides[_SelectSlideOptionsPlaylistAdd].Selection = 0; } #endregion Playlist Actions } diff --git a/Vocaluxe/Screens/CScreenTest.cs b/Vocaluxe/Screens/CScreenTest.cs index b97849c6..159594ad 100644 --- a/Vocaluxe/Screens/CScreenTest.cs +++ b/Vocaluxe/Screens/CScreenTest.cs @@ -70,7 +70,7 @@ namespace Vocaluxe.Screens public override bool HandleMouse(SMouseEvent mouseEvent) { - if (mouseEvent.LB && IsMouseOver(mouseEvent)) {} + if (mouseEvent.LB && _IsMouseOver(mouseEvent)) {} if (mouseEvent.LB) CGraphics.FadeTo(EScreens.ScreenMain); diff --git a/Vocaluxe/Vocaluxe.csproj b/Vocaluxe/Vocaluxe.csproj index beac3ace..b0c8c64f 100644 --- a/Vocaluxe/Vocaluxe.csproj +++ b/Vocaluxe/Vocaluxe.csproj @@ -264,8 +264,8 @@ Designer - - + + diff --git a/VocaluxeLib/Menu/CBackground.cs b/VocaluxeLib/Menu/CBackground.cs index 9428179a..356cb116 100644 --- a/VocaluxeLib/Menu/CBackground.cs +++ b/VocaluxeLib/Menu/CBackground.cs @@ -75,11 +75,11 @@ namespace VocaluxeLib.Menu _ThemeLoaded &= xmlReader.TryGetEnumValue(item + "/Type", ref _Theme.Type); - bool vid = xmlReader.GetValue(item + "/Video", ref _Theme.VideoName, String.Empty); - bool tex = xmlReader.GetValue(item + "/Skin", ref _Theme.TextureName, String.Empty); + bool vid = xmlReader.GetValue(item + "/Video", out _Theme.VideoName, String.Empty); + bool tex = xmlReader.GetValue(item + "/Skin", out _Theme.TextureName, String.Empty); _ThemeLoaded &= vid || tex || _Theme.Type == EBackgroundTypes.None; - if (xmlReader.GetValue(item + "/Color", ref _Theme.ColorName, String.Empty)) + if (xmlReader.GetValue(item + "/Color", out _Theme.ColorName, String.Empty)) _ThemeLoaded &= CBase.Theme.GetColor(_Theme.ColorName, skinIndex, out Color); else { @@ -207,7 +207,7 @@ namespace VocaluxeLib.Menu { RectangleF bounds = new RectangleF(0f, 0f, CBase.Settings.GetRenderW(), CBase.Settings.GetRenderH()); RectangleF rect = new RectangleF(0f, 0f, texture.Width, texture.Height); - CHelper.SetRect(bounds, ref rect, rect.Width / rect.Height, EAspect.Crop); + CHelper.SetRect(bounds, out rect, rect.Width / rect.Height, EAspect.Crop); CBase.Drawing.DrawTexture(texture, new SRectF(rect.X, rect.Y, rect.Width, rect.Height, CBase.Settings.GetZFar() / 4)); return true; @@ -222,7 +222,7 @@ namespace VocaluxeLib.Menu { RectangleF bounds = new RectangleF(0f, 0f, CBase.Settings.GetRenderW(), CBase.Settings.GetRenderH()); RectangleF rect = new RectangleF(0f, 0f, videoTexture.Width, videoTexture.Height); - CHelper.SetRect(bounds, ref rect, rect.Width / rect.Height, EAspect.Crop); + CHelper.SetRect(bounds, out rect, rect.Width / rect.Height, EAspect.Crop); CBase.Drawing.DrawTexture(videoTexture, new SRectF(rect.X, rect.Y, rect.Width, rect.Height, CBase.Settings.GetZFar() / 4)); return true; @@ -237,7 +237,7 @@ namespace VocaluxeLib.Menu { RectangleF bounds = new RectangleF(0f, 0f, CBase.Settings.GetRenderW(), CBase.Settings.GetRenderH()); RectangleF rect = new RectangleF(0f, 0f, videoTexture.Width, videoTexture.Height); - CHelper.SetRect(bounds, ref rect, rect.Width / rect.Height, EAspect.Crop); + CHelper.SetRect(bounds, out rect, rect.Width / rect.Height, EAspect.Crop); CBase.Drawing.DrawTexture(videoTexture, new SRectF(rect.X, rect.Y, rect.Width, rect.Height, CBase.Settings.GetZFar() / 4)); return true; diff --git a/VocaluxeLib/Menu/CButton.cs b/VocaluxeLib/Menu/CButton.cs index ac39abfd..a7b9194e 100644 --- a/VocaluxeLib/Menu/CButton.cs +++ b/VocaluxeLib/Menu/CButton.cs @@ -152,8 +152,8 @@ namespace VocaluxeLib.Menu string item = xmlPath + "/" + elementName; _ThemeLoaded = true; - _ThemeLoaded &= xmlReader.GetValue(item + "/Skin", ref _Theme.TextureName, String.Empty); - _ThemeLoaded &= xmlReader.GetValue(item + "/SkinSelected", ref _Theme.SelTextureName, String.Empty); + _ThemeLoaded &= xmlReader.GetValue(item + "/Skin", out _Theme.TextureName, String.Empty); + _ThemeLoaded &= xmlReader.GetValue(item + "/SkinSelected", out _Theme.SelTextureName, String.Empty); _ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/X", ref Rect.X); _ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/Y", ref Rect.Y); @@ -161,7 +161,7 @@ namespace VocaluxeLib.Menu _ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/W", ref Rect.W); _ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/H", ref Rect.H); - if (xmlReader.GetValue(item + "/Color", ref _Theme.ColorName, String.Empty)) + if (xmlReader.GetValue(item + "/Color", out _Theme.ColorName, String.Empty)) _ThemeLoaded &= CBase.Theme.GetColor(_Theme.ColorName, skinIndex, out Color); else { @@ -171,7 +171,7 @@ namespace VocaluxeLib.Menu _ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/A", ref Color.A); } - if (xmlReader.GetValue(item + "/SColor", ref _Theme.SelColorName, String.Empty)) + if (xmlReader.GetValue(item + "/SColor", out _Theme.SelColorName, String.Empty)) _ThemeLoaded &= CBase.Theme.GetColor(_Theme.SelColorName, skinIndex, out SelColor); else { @@ -309,7 +309,7 @@ namespace VocaluxeLib.Menu if (!Visible && CBase.Settings.GetGameState() != EGameState.EditTheme && !forceDraw) return; - STexture texture = new STexture(-1); + STexture texture; if (!Selected && !Pressed || !Enabled) { diff --git a/VocaluxeLib/Menu/CEqualizer.cs b/VocaluxeLib/Menu/CEqualizer.cs index 37135cd2..91ac9265 100644 --- a/VocaluxeLib/Menu/CEqualizer.cs +++ b/VocaluxeLib/Menu/CEqualizer.cs @@ -91,7 +91,7 @@ namespace VocaluxeLib.Menu string item = xmlPath + "/" + elementName; _ThemeLoaded = true; - _ThemeLoaded &= xmlReader.GetValue(item + "/Skin", ref _Theme.TextureName, String.Empty); + _ThemeLoaded &= xmlReader.GetValue(item + "/Skin", out _Theme.TextureName, String.Empty); _ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/X", ref Rect.X); _ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/Y", ref Rect.Y); @@ -107,7 +107,7 @@ namespace VocaluxeLib.Menu _ThemeLoaded &= xmlReader.TryGetEnumValue(item + "/DrawNegative", ref _Theme.DrawNegative); - if (xmlReader.GetValue(item + "/Color", ref _Theme.ColorName, String.Empty)) + if (xmlReader.GetValue(item + "/Color", out _Theme.ColorName, String.Empty)) _ThemeLoaded &= CBase.Theme.GetColor(_Theme.ColorName, skinIndex, out Color); else { @@ -117,7 +117,7 @@ namespace VocaluxeLib.Menu _ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/A", ref Color.A); } - if (xmlReader.GetValue(item + "/MaxColor", ref _Theme.MaxColorName, String.Empty)) + if (xmlReader.GetValue(item + "/MaxColor", out _Theme.MaxColorName, String.Empty)) _ThemeLoaded &= CBase.Theme.GetColor(_Theme.ColorName, skinIndex, out Color); else { diff --git a/VocaluxeLib/Menu/CHelper.cs b/VocaluxeLib/Menu/CHelper.cs index 03613827..d64fb482 100644 --- a/VocaluxeLib/Menu/CHelper.cs +++ b/VocaluxeLib/Menu/CHelper.cs @@ -68,7 +68,6 @@ namespace VocaluxeLib.Menu public static int TryReadInt(StreamReader sr) { - char chr = '0'; string value = String.Empty; try @@ -77,7 +76,7 @@ namespace VocaluxeLib.Menu //Check for ' ', ?, ?, \n, \r while (tmp != 32 && tmp != 19 && tmp != 16 && tmp != 13 && tmp != 10) { - chr = (char)sr.Read(); + char chr = (char)sr.Read(); value += chr.ToString(); tmp = sr.Peek(); } @@ -86,20 +85,18 @@ namespace VocaluxeLib.Menu { return 0; } - int result = 0; - if (int.TryParse(value, out result)) - return result; - return 0; + int result; + return int.TryParse(value, out result) ? result : 0; } - public static void SetRect(RectangleF bounds, ref RectangleF rect, float rectAspect, EAspect aspect) + public static void SetRect(RectangleF bounds, out RectangleF rect, float rectAspect, EAspect aspect) { float rW = bounds.Right - bounds.Left; float rH = bounds.Bottom - bounds.Top; float rA = rW / rH; - float scaledWidth = rW; - float scaledHeight = rH; + float scaledWidth; + float scaledHeight; switch (aspect) { @@ -161,16 +158,13 @@ namespace VocaluxeLib.Menu { foreach (FileInfo file in dir.GetFiles(cast)) { - if (!fullpath) - files.Add(file.Name); - else - files.Add(file.FullName); + files.Add(!fullpath ? file.Name : file.FullName); } if (recursive) { foreach (DirectoryInfo di in dir.GetDirectories()) - files.AddRange(ListFiles(di.FullName, cast, recursive, fullpath)); + files.AddRange(ListFiles(di.FullName, cast, true, fullpath)); } } catch (Exception) {} diff --git a/VocaluxeLib/Menu/CLyric.cs b/VocaluxeLib/Menu/CLyric.cs index 092e12dd..cad0c576 100644 --- a/VocaluxeLib/Menu/CLyric.cs +++ b/VocaluxeLib/Menu/CLyric.cs @@ -58,7 +58,6 @@ namespace VocaluxeLib.Menu private float _H; private float _Width; - private ELyricStyle _Style; private float _Alpha = 1f; @@ -70,7 +69,7 @@ namespace VocaluxeLib.Menu public SRectF Rect { get { return new SRectF(_X, _Y, _MaxW, _H, _Z); } - set + private set { _X = value.X; _Y = value.Y; @@ -80,8 +79,8 @@ namespace VocaluxeLib.Menu } } - public SColorF Color; - public SColorF ColorProcessed; + private SColorF _Color; + private SColorF _ColorProcessed; public bool Selected; public bool Visible = true; @@ -96,19 +95,15 @@ namespace VocaluxeLib.Menu } } - public ELyricStyle LyricStyle - { - get { return _Style; } - set { _Style = value; } - } + public ELyricStyle LyricStyle { get; set; } public CLyric(int partyModeID) { _PartyModeID = partyModeID; _Theme = new SThemeLyrics(); _ThemeLoaded = false; - Color = new SColorF(); - ColorProcessed = new SColorF(); + _Color = new SColorF(); + _ColorProcessed = new SColorF(); _X = 0f; _Y = 0f; @@ -119,7 +114,7 @@ namespace VocaluxeLib.Menu _Notes = new List(); _Text = new CText(_PartyModeID); - _Style = ELyricStyle.Fill; + LyricStyle = ELyricStyle.Fill; } public bool LoadTheme(string xmlPath, string elementName, CXMLReader xmlReader, int skinIndex) @@ -133,31 +128,31 @@ namespace VocaluxeLib.Menu _ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/W", ref _MaxW); _ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/H", ref _H); - if (xmlReader.GetValue(item + "/Color", ref _Theme.ColorName, String.Empty)) - _ThemeLoaded &= CBase.Theme.GetColor(_Theme.ColorName, skinIndex, out Color); + if (xmlReader.GetValue(item + "/Color", out _Theme.ColorName, String.Empty)) + _ThemeLoaded &= CBase.Theme.GetColor(_Theme.ColorName, skinIndex, out _Color); else { - _ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/R", ref Color.R); - _ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/G", ref Color.G); - _ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/B", ref Color.B); - _ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/A", ref Color.A); + _ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/R", ref _Color.R); + _ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/G", ref _Color.G); + _ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/B", ref _Color.B); + _ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/A", ref _Color.A); } - if (xmlReader.GetValue(item + "/SColor", ref _Theme.SelColorName, String.Empty)) - _ThemeLoaded &= CBase.Theme.GetColor(_Theme.SelColorName, skinIndex, out ColorProcessed); + if (xmlReader.GetValue(item + "/SColor", out _Theme.SelColorName, String.Empty)) + _ThemeLoaded &= CBase.Theme.GetColor(_Theme.SelColorName, skinIndex, out _ColorProcessed); else { - _ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/SR", ref ColorProcessed.R); - _ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/SG", ref ColorProcessed.G); - _ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/SB", ref ColorProcessed.B); - _ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/SA", ref ColorProcessed.A); + _ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/SR", ref _ColorProcessed.R); + _ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/SG", ref _ColorProcessed.G); + _ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/SB", ref _ColorProcessed.B); + _ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/SA", ref _ColorProcessed.A); } if (_ThemeLoaded) { _Theme.Name = elementName; LoadTextures(); - _Text = new CText(_X, _Y, _Z, _H, _MaxW, EAlignment.Left, EStyle.Bold, "Normal", Color, String.Empty); + _Text = new CText(_X, _Y, _Z, _H, _MaxW, EAlignment.Left, EStyle.Bold, "Normal", _Color, String.Empty); } return _ThemeLoaded; } @@ -181,10 +176,10 @@ namespace VocaluxeLib.Menu writer.WriteElementString("Color", _Theme.ColorName); else { - writer.WriteElementString("R", Color.R.ToString("#0.00")); - writer.WriteElementString("G", Color.G.ToString("#0.00")); - writer.WriteElementString("B", Color.B.ToString("#0.00")); - writer.WriteElementString("A", Color.A.ToString("#0.00")); + writer.WriteElementString("R", _Color.R.ToString("#0.00")); + writer.WriteElementString("G", _Color.G.ToString("#0.00")); + writer.WriteElementString("B", _Color.B.ToString("#0.00")); + writer.WriteElementString("A", _Color.A.ToString("#0.00")); } writer.WriteComment(": Highlighted lyric color from ColorScheme (high priority)"); @@ -193,10 +188,10 @@ namespace VocaluxeLib.Menu writer.WriteElementString("SColor", _Theme.SelColorName); else { - writer.WriteElementString("SR", ColorProcessed.R.ToString("#0.00")); - writer.WriteElementString("SG", ColorProcessed.G.ToString("#0.00")); - writer.WriteElementString("SB", ColorProcessed.B.ToString("#0.00")); - writer.WriteElementString("SA", ColorProcessed.A.ToString("#0.00")); + writer.WriteElementString("SR", _ColorProcessed.R.ToString("#0.00")); + writer.WriteElementString("SG", _ColorProcessed.G.ToString("#0.00")); + writer.WriteElementString("SB", _ColorProcessed.B.ToString("#0.00")); + writer.WriteElementString("SA", _ColorProcessed.A.ToString("#0.00")); } writer.WriteEndElement(); @@ -213,13 +208,7 @@ namespace VocaluxeLib.Menu _Width = 0f; foreach (CNote note in line.Notes) { - SNote n = new SNote(); - - n.Text = note.Text; - n.StartBeat = note.StartBeat; - n.EndBeat = note.EndBeat; - n.Duration = note.Duration; - n.Type = note.NoteType; + SNote n = new SNote {Text = note.Text, StartBeat = note.StartBeat, EndBeat = note.EndBeat, Duration = note.Duration, Type = note.NoteType}; _Text.Text = note.Text; _Text.Style = EStyle.Bold; @@ -248,7 +237,7 @@ namespace VocaluxeLib.Menu { if (Visible || CBase.Settings.GetGameState() == EGameState.EditTheme) { - switch (_Style) + switch (LyricStyle) { case ELyricStyle.Fill: _DrawFill(actualBeat); @@ -287,28 +276,28 @@ namespace VocaluxeLib.Menu { if (currentBeat <= note.EndBeat) { - _Text.Color = ColorProcessed; + _Text.Color = _ColorProcessed; float diff = note.EndBeat - note.StartBeat; - if (diff == 0) + if (Math.Abs(diff) < float.Epsilon) _Text.Draw(0f, 1f); else { _Text.Draw(0f, (currentBeat - note.StartBeat) / diff); - _Text.Color = Color; + _Text.Color = _Color; _Text.Draw((currentBeat - note.StartBeat) / diff, 1f); } } else { - _Text.Color = ColorProcessed; + _Text.Color = _ColorProcessed; _Text.Draw(); } } else { - _Text.Color = Color; + _Text.Color = _Color; _Text.Draw(); } @@ -344,7 +333,6 @@ namespace VocaluxeLib.Menu if (currentBeat >= _Notes[note].StartBeat) { - bool last = note == _Notes.Count - 1; int endbeat = _Notes[note].EndBeat; if (note < _Notes.Count - 1) endbeat = _Notes[note + 1].StartBeat - 1; @@ -358,10 +346,7 @@ namespace VocaluxeLib.Menu else { // already passed - if (note == lastNote) - _Text.Color = ColorProcessed; - else - _Text.Color = Color; + _Text.Color = note == lastNote ? _ColorProcessed : _Color; _Text.Draw(); } @@ -369,7 +354,7 @@ namespace VocaluxeLib.Menu else { // not passed - _Text.Color = Color; + _Text.Color = _Color; _Text.Draw(); } @@ -383,7 +368,7 @@ namespace VocaluxeLib.Menu _Text.X = zoomx; _Text.Text = _Notes[zoomNote].Text; - _Text.Color = ColorProcessed; + _Text.Color = _ColorProcessed; _Text.Style = EStyle.Bold; if (_Notes[zoomNote].Type == ENoteType.Freestyle) @@ -437,13 +422,13 @@ namespace VocaluxeLib.Menu if (currentBeat >= note.StartBeat) { - _Text.Color = ColorProcessed; + _Text.Color = _ColorProcessed; _Text.Draw(); } else { // not passed - _Text.Color = Color; + _Text.Color = _Color; _Text.Draw(); } @@ -464,7 +449,6 @@ namespace VocaluxeLib.Menu } int jumpNote = -1; - int endBeat = -1; float jumpx = 0f; for (int note = 0; note < _Notes.Count; note++) @@ -479,24 +463,15 @@ namespace VocaluxeLib.Menu if (currentBeat >= _Notes[note].StartBeat) { - bool last = note == _Notes.Count - 1; - int endbeat = _Notes[note].EndBeat; - if (note < _Notes.Count - 1) - endbeat = _Notes[note + 1].StartBeat - 1; - if (currentBeat <= _Notes[note].EndBeat) { jumpNote = note; - endBeat = endbeat; jumpx = _Text.X; } else { // already passed - if (note == lastNote) - _Text.Color = ColorProcessed; - else - _Text.Color = Color; + _Text.Color = note == lastNote ? _ColorProcessed : _Color; _Text.Draw(); } @@ -504,45 +479,44 @@ namespace VocaluxeLib.Menu else { // not passed - _Text.Color = Color; + _Text.Color = _Color; _Text.Draw(); } x += rect.Width; } - if (jumpNote > -1) + if (jumpNote < 0) + return; + if (_Notes[jumpNote].Duration == 0) + return; + + _Text.X = jumpx; + _Text.Text = _Notes[jumpNote].Text; + _Text.Color = _ColorProcessed; + _Text.Style = EStyle.Bold; + + if (_Notes[jumpNote].Type == ENoteType.Freestyle) + _Text.Style = EStyle.BoldItalic; + + float diff = _Notes[jumpNote].EndBeat - _Notes[jumpNote].StartBeat; + if (diff <= 0f) + diff = 1f; + + float p = (currentBeat - _Notes[jumpNote].StartBeat) / diff; + if (p > 1f) + p = 1f; + + p = 1f - p; + + if (Math.Abs(diff - 1) < float.Epsilon) + _Text.Draw(); + else { - if (_Notes[jumpNote].Duration == 0) - return; - - _Text.X = jumpx; - _Text.Text = _Notes[jumpNote].Text; - _Text.Color = ColorProcessed; - _Text.Style = EStyle.Bold; - - if (_Notes[jumpNote].Type == ENoteType.Freestyle) - _Text.Style = EStyle.BoldItalic; - - float diff = _Notes[jumpNote].EndBeat - _Notes[jumpNote].StartBeat; - if (diff <= 0f) - diff = 1f; - - float p = (currentBeat - _Notes[jumpNote].StartBeat) / diff; - if (p > 1f) - p = 1f; - - p = 1f - p; - - if (diff == 1) - _Text.Draw(); - else - { - float y = _Text.Y; - _Text.Y -= _Text.Height * 0.1f * p; - _Text.Draw(); - _Text.Y = y; - } + float y = _Text.Y; + _Text.Y -= _Text.Height * 0.1f * p; + _Text.Draw(); + _Text.Y = y; } } #endregion draw @@ -552,10 +526,10 @@ namespace VocaluxeLib.Menu public void LoadTextures() { if (_Theme.ColorName.Length > 0) - Color = CBase.Theme.GetColor(_Theme.ColorName, _PartyModeID); + _Color = CBase.Theme.GetColor(_Theme.ColorName, _PartyModeID); if (_Theme.SelColorName.Length > 0) - ColorProcessed = CBase.Theme.GetColor(_Theme.SelColorName, _PartyModeID); + _ColorProcessed = CBase.Theme.GetColor(_Theme.SelColorName, _PartyModeID); } public void ReloadTextures() diff --git a/VocaluxeLib/Menu/CMenu.cs b/VocaluxeLib/Menu/CMenu.cs index 20d28e9e..5f766e26 100644 --- a/VocaluxeLib/Menu/CMenu.cs +++ b/VocaluxeLib/Menu/CMenu.cs @@ -42,35 +42,18 @@ namespace VocaluxeLib.Menu private string _ThemePath = String.Empty; protected int _PartyModeID = -1; - private COrderedDictionaryLite _Backgrounds; - private COrderedDictionaryLite _Buttons; - private COrderedDictionaryLite _Texts; - private COrderedDictionaryLite _Statics; - private COrderedDictionaryLite _SelectSlides; - private COrderedDictionaryLite _SongMenus; - private COrderedDictionaryLite _Lyrics; - private COrderedDictionaryLite _SingNotes; - private COrderedDictionaryLite _NameSelections; - private COrderedDictionaryLite _Equalizers; - private COrderedDictionaryLite _Playlists; - private COrderedDictionaryLite _ParticleEffects; - private COrderedDictionaryLite _ScreenSettings; - private int _PrevMouseX; private int _PrevMouseY; - protected int _MouseDX; - protected int _MouseDY; + private int _MouseDX; + private int _MouseDY; protected bool _Active; protected abstract int _ScreenVersion { get; } - private string _ThemeName; - public string ThemeName - { - get { return _ThemeName; } - } + public string ThemeName { get; private set; } + // ReSharper disable MemberCanBePrivate.Global protected string[] _ThemeBackgrounds; protected string[] _ThemeStatics; protected string[] _ThemeTexts; @@ -85,22 +68,32 @@ namespace VocaluxeLib.Menu protected string[] _ThemeParticleEffects; protected string[] _ThemeScreenSettings; + protected COrderedDictionaryLite _Buttons { get; private set; } + protected COrderedDictionaryLite _Texts { get; private set; } + protected COrderedDictionaryLite _Backgrounds { get; private set; } + protected COrderedDictionaryLite _Statics { get; private set; } + protected COrderedDictionaryLite _SelectSlides { get; private set; } + protected COrderedDictionaryLite _SongMenus { get; private set; } + protected COrderedDictionaryLite _Lyrics { get; private set; } + protected COrderedDictionaryLite _SingNotes { get; private set; } + protected COrderedDictionaryLite _NameSelections { get; private set; } + protected COrderedDictionaryLite _Equalizers { get; private set; } + protected COrderedDictionaryLite _Playlists { get; private set; } + protected COrderedDictionaryLite _ParticleEffects { get; private set; } + protected COrderedDictionaryLite _ScreenSettings { get; private set; } + // ReSharper restore MemberCanBePrivate.Global + protected SRectF _ScreenArea; public SRectF ScreenArea { get { return _ScreenArea; } } - public int ThemeScreenVersion - { - get { return _ScreenVersion; } - } - public virtual void Init() { - _ThemeName = GetType().Name; - if (_ThemeName[0] == 'C' && Char.IsUpper(_ThemeName[1])) - _ThemeName = _ThemeName.Remove(0, 1); + ThemeName = GetType().Name; + if (ThemeName[0] == 'C' && Char.IsUpper(ThemeName[1])) + ThemeName = ThemeName.Remove(0, 1); _Interactions = new List(); _Selection = 0; @@ -149,7 +142,7 @@ namespace VocaluxeLib.Menu } #region ThemeHandler - protected delegate void AddElementHandler(T element, String key); + private delegate void AddElementHandler(T element, String key); private void _LoadThemeElement(string[] elements, AddElementHandler addElementHandler, CXMLReader xmlReader, int skinIndex) where T : IMenuElement { @@ -174,8 +167,7 @@ namespace VocaluxeLib.Menu if (xmlReader == null) return; - bool versionCheck = false; - versionCheck = _CheckVersion(_ScreenVersion, xmlReader); + bool versionCheck = _CheckVersion(_ScreenVersion, xmlReader); int skinIndex = CBase.Theme.GetSkinIndex(_PartyModeID); @@ -184,19 +176,19 @@ namespace VocaluxeLib.Menu _ThemePath = xmlPath; _LoadThemeBasics(xmlReader, skinIndex); - _LoadThemeElement(_ThemeBackgrounds, AddBackground, xmlReader, skinIndex); - _LoadThemeElement(_ThemeStatics, AddStatic, xmlReader, skinIndex); - _LoadThemeElement(_ThemeTexts, AddText, xmlReader, skinIndex); - _LoadThemeElement(_ThemeButtons, AddButton, xmlReader, skinIndex); - _LoadThemeElement(_ThemeSelectSlides, AddSelectSlide, xmlReader, skinIndex); - _LoadThemeElement(_ThemeSongMenus, AddSongMenu, xmlReader, skinIndex); - _LoadThemeElement(_ThemeLyrics, AddLyric, xmlReader, skinIndex); - _LoadThemeElement(_ThemeSingNotes, AddSingNote, xmlReader, skinIndex); - _LoadThemeElement(_ThemeNameSelections, AddNameSelection, xmlReader, skinIndex); - _LoadThemeElement(_ThemeEqualizers, AddEqualizer, xmlReader, skinIndex); - _LoadThemeElement(_ThemePlaylists, AddPlaylist, xmlReader, skinIndex); - _LoadThemeElement(_ThemeParticleEffects, AddParticleEffect, xmlReader, skinIndex); - _LoadThemeElement(_ThemeScreenSettings, AddScreenSetting, xmlReader, skinIndex); + _LoadThemeElement(_ThemeBackgrounds, _AddBackground, xmlReader, skinIndex); + _LoadThemeElement(_ThemeStatics, _AddStatic, xmlReader, skinIndex); + _LoadThemeElement(_ThemeTexts, _AddText, xmlReader, skinIndex); + _LoadThemeElement(_ThemeButtons, _AddButton, xmlReader, skinIndex); + _LoadThemeElement(_ThemeSelectSlides, _AddSelectSlide, xmlReader, skinIndex); + _LoadThemeElement(_ThemeSongMenus, _AddSongMenu, xmlReader, skinIndex); + _LoadThemeElement(_ThemeLyrics, _AddLyric, xmlReader, skinIndex); + _LoadThemeElement(_ThemeSingNotes, _AddSingNote, xmlReader, skinIndex); + _LoadThemeElement(_ThemeNameSelections, _AddNameSelection, xmlReader, skinIndex); + _LoadThemeElement(_ThemeEqualizers, _AddEqualizer, xmlReader, skinIndex); + _LoadThemeElement(_ThemePlaylists, _AddPlaylist, xmlReader, skinIndex); + _LoadThemeElement(_ThemeParticleEffects, _AddParticleEffect, xmlReader, skinIndex); + _LoadThemeElement(_ThemeScreenSettings, _AddScreenSetting, xmlReader, skinIndex); } } @@ -205,10 +197,7 @@ namespace VocaluxeLib.Menu if (_ThemePath.Length == 0) return; - XmlWriterSettings settings = new XmlWriterSettings(); - settings.Indent = true; - settings.Encoding = Encoding.UTF8; - settings.ConformanceLevel = ConformanceLevel.Document; + XmlWriterSettings settings = new XmlWriterSettings {Indent = true, Encoding = Encoding.UTF8, ConformanceLevel = ConformanceLevel.Document}; string file = Path.Combine(_ThemePath, ThemeName + ".xml"); using (XmlWriter writer = XmlWriter.Create(file, settings)) @@ -447,12 +436,14 @@ namespace VocaluxeLib.Menu #region ElementHandler #region Create Elements +// ReSharper disable UnusedMember.Global + // ReSharper disable MemberCanBeProtected.Global public CButton GetNewButton() { return new CButton(_PartyModeID); } - public CButton GetNewButton(CButton button) + public static CButton GetNewButton(CButton button) { return new CButton(button); } @@ -462,12 +453,12 @@ namespace VocaluxeLib.Menu return new CText(_PartyModeID); } - public CText GetNewText(CText text) + public static CText GetNewText(CText text) { return new CText(text); } - public CText GetNewText(float x, float y, float z, float h, float mw, EAlignment align, EStyle style, string font, SColorF col, string text) + public static CText GetNewText(float x, float y, float z, float h, float mw, EAlignment align, EStyle style, string font, SColorF col, string text) { return new CText(x, y, z, h, mw, align, style, font, col, text); } @@ -482,7 +473,7 @@ namespace VocaluxeLib.Menu return new CStatic(_PartyModeID); } - public CStatic GetNewStatic(CStatic oldStatic) + public static CStatic GetNewStatic(CStatic oldStatic) { return new CStatic(oldStatic); } @@ -497,7 +488,7 @@ namespace VocaluxeLib.Menu return new CSelectSlide(_PartyModeID); } - public CSelectSlide GetNewSelectSlide(CSelectSlide slide) + public static CSelectSlide GetNewSelectSlide(CSelectSlide slide) { return new CSelectSlide(slide); } @@ -536,75 +527,10 @@ namespace VocaluxeLib.Menu { return new CParticleEffect(_PartyModeID, maxNumber, color, area, texture, size, type); } + // ReSharper restore MemberCanBeProtected.Global + // ReSharper restore UnusedMember.Global #endregion Create Elements - #region Get Elements - public COrderedDictionaryLite Buttons - { - get { return _Buttons; } - } - - public COrderedDictionaryLite Texts - { - get { return _Texts; } - } - - public COrderedDictionaryLite Backgrounds - { - get { return _Backgrounds; } - } - - public COrderedDictionaryLite Statics - { - get { return _Statics; } - } - - public COrderedDictionaryLite SelectSlides - { - get { return _SelectSlides; } - } - - public COrderedDictionaryLite SongMenus - { - get { return _SongMenus; } - } - - public COrderedDictionaryLite Lyrics - { - get { return _Lyrics; } - } - - public COrderedDictionaryLite SingNotes - { - get { return _SingNotes; } - } - - public COrderedDictionaryLite NameSelections - { - get { return _NameSelections; } - } - - public COrderedDictionaryLite Equalizers - { - get { return _Equalizers; } - } - - public COrderedDictionaryLite Playlists - { - get { return _Playlists; } - } - - public COrderedDictionaryLite ParticleEffects - { - get { return _ParticleEffects; } - } - - public COrderedDictionaryLite ScreenSettings - { - get { return _ScreenSettings; } - } - #endregion Get Arrays - #endregion ElementHandler #region MenuHandler @@ -826,18 +752,18 @@ namespace VocaluxeLib.Menu #region Drawing public virtual bool Draw() { - DrawBG(); - DrawFG(); + _DrawBG(); + _DrawFG(); return true; } - public void DrawBG() + protected void _DrawBG() { foreach (CBackground bg in _Backgrounds) bg.Draw(); } - public void DrawFG() + protected void _DrawFG() { if (_Interactions.Count <= 0) return; @@ -846,29 +772,20 @@ namespace VocaluxeLib.Menu for (int i = 0; i < _Interactions.Count; i++) { - if (_IsVisible(i) && ( - _Interactions[i].Type == EType.Button || - _Interactions[i].Type == EType.SelectSlide || - _Interactions[i].Type == EType.Static || - _Interactions[i].Type == EType.NameSelection || - _Interactions[i].Type == EType.Text || - _Interactions[i].Type == EType.SongMenu || - _Interactions[i].Type == EType.Equalizer || - _Interactions[i].Type == EType.Playlist || - _Interactions[i].Type == EType.ParticleEffect)) - { - SZSort zs = new SZSort(); - zs.ID = i; - zs.Z = _GetZValue(i); - items.Add(zs); - } + if (!_IsVisible(i) || + (_Interactions[i].Type != EType.Button && _Interactions[i].Type != EType.SelectSlide && _Interactions[i].Type != EType.Static && + _Interactions[i].Type != EType.NameSelection && _Interactions[i].Type != EType.Text && _Interactions[i].Type != EType.SongMenu && + _Interactions[i].Type != EType.Equalizer && _Interactions[i].Type != EType.Playlist && _Interactions[i].Type != EType.ParticleEffect)) + continue; + SZSort zs = new SZSort {ID = i, Z = _GetZValue(i)}; + items.Add(zs); } if (items.Count <= 0) return; - items.Sort(delegate(SZSort s1, SZSort s2) { return s2.Z.CompareTo(s1.Z); }); + items.Sort((s1, s2) => s2.Z.CompareTo(s1.Z)); for (int i = 0; i < items.Count; i++) _DrawInteraction(items[i].ID); @@ -876,139 +793,76 @@ namespace VocaluxeLib.Menu #endregion Drawing #region Elements - public void AddBackground(CBackground bg) - { - AddBackground(bg, null); - } - - public void AddButton(CButton button) - { - AddButton(button, null); - } - - public void AddSelectSlide(CSelectSlide slide) - { - AddSelectSlide(slide, null); - } - - public void AddStatic(CStatic stat) - { - AddStatic(stat, null); - } - - public void AddText(CText text) - { - AddText(text, null); - } - - public void AddSongMenu(CSongMenu songmenu) - { - AddSongMenu(songmenu, null); - } - - public void AddLyric(CLyric lyric) - { - AddLyric(lyric, null); - } - - public void AddSingNote(CSingNotes sn) - { - AddSingNote(sn, null); - } - - public void AddNameSelection(CNameSelection ns) - { - AddNameSelection(ns, null); - } - - public void AddEqualizer(CEqualizer eq) - { - AddEqualizer(eq, null); - } - - public void AddPlaylist(CPlaylist pls) - { - AddPlaylist(pls, null); - } - - public void AddParticleEffect(CParticleEffect pe) - { - AddParticleEffect(pe, null); - } - - public void AddScreenSetting(CScreenSetting se) - { - AddScreenSetting(se, null); - } - - public void AddBackground(CBackground bg, String key) +// ReSharper disable MemberCanBePrivate.Global + protected void _AddBackground(CBackground bg, String key = null) { _AddInteraction(_Backgrounds.Add(bg, key), EType.Background); } - public void AddButton(CButton button, String key) + protected void _AddButton(CButton button, String key = null) { _AddInteraction(_Buttons.Add(button, key), EType.Button); } - public void AddSelectSlide(CSelectSlide slide, String key) + protected void _AddSelectSlide(CSelectSlide slide, String key = null) { _AddInteraction(_SelectSlides.Add(slide, key), EType.SelectSlide); } - public void AddStatic(CStatic stat, String key) + protected void _AddStatic(CStatic stat, String key = null) { _AddInteraction(_Statics.Add(stat, key), EType.Static); } - public void AddText(CText text, String key) + protected void _AddText(CText text, String key = null) { _AddInteraction(_Texts.Add(text, key), EType.Text); } - public void AddSongMenu(CSongMenu songmenu, String key) + protected void _AddSongMenu(CSongMenu songmenu, String key = null) { _AddInteraction(_SongMenus.Add(songmenu, key), EType.SongMenu); } - public void AddLyric(CLyric lyric, String key) + protected void _AddLyric(CLyric lyric, String key = null) { _AddInteraction(_Lyrics.Add(lyric, key), EType.Lyric); } - public void AddSingNote(CSingNotes sn, String key) + protected void _AddSingNote(CSingNotes sn, String key = null) { _AddInteraction(_SingNotes.Add(sn, key), EType.SingNote); } - public void AddNameSelection(CNameSelection ns, String key) + protected void _AddNameSelection(CNameSelection ns, String key = null) { _AddInteraction(_NameSelections.Add(ns, key), EType.NameSelection); } - public void AddEqualizer(CEqualizer eq, String key) + protected void _AddEqualizer(CEqualizer eq, String key = null) { _AddInteraction(_Equalizers.Add(eq, key), EType.Equalizer); } - public void AddPlaylist(CPlaylist pls, String key) + protected void _AddPlaylist(CPlaylist pls, String key = null) { _AddInteraction(_Playlists.Add(pls, key), EType.Playlist); } - public void AddParticleEffect(CParticleEffect pe, String key) + protected void _AddParticleEffect(CParticleEffect pe, String key = null) { _AddInteraction(_ParticleEffects.Add(pe, key), EType.ParticleEffect); } - public void AddScreenSetting(CScreenSetting se, String key) + protected void _AddScreenSetting(CScreenSetting se, String key = null) { _ScreenSettings.Add(se, key); } + // ReSharper restore MemberCanBePrivate.Global #endregion Elements #region InteractionHandling - public void CheckInteraction() + protected void _CheckInteraction() { if (!_IsEnabled(_Selection) || !_IsVisible(_Selection)) PrevInteraction(); @@ -1050,26 +904,23 @@ namespace VocaluxeLib.Menu return false; } - public bool SetInteractionToButton(CButton button) + protected void _SetInteractionToButton(CButton button) { for (int i = 0; i < _Interactions.Count; i++) { - if (_Interactions[i].Type == EType.Button) - { - if (_Buttons[_Interactions[i].Num] == button) - { - _UnsetSelected(); - _UnsetHighlighted(_Selection); - _Selection = i; - _SetSelected(); - return true; - } - } + if (_Interactions[i].Type != EType.Button) + continue; + if (_Buttons[_Interactions[i].Num] != button) + continue; + _UnsetSelected(); + _UnsetHighlighted(_Selection); + _Selection = i; + _SetSelected(); + return; } - return false; } - public bool SetInteractionToSelectSlide(CSelectSlide slide) + protected void _SetInteractionToSelectSlide(CSelectSlide slide) { for (int i = 0; i < _Interactions.Count; i++) { @@ -1081,11 +932,10 @@ namespace VocaluxeLib.Menu _UnsetHighlighted(_Selection); _Selection = i; _SetSelected(); - return true; + return; } } } - return false; } public void ProcessMouseClick(int x, int y) @@ -1102,7 +952,7 @@ namespace VocaluxeLib.Menu public void ProcessMouseMove(int x, int y) { - SelectByMouse(x, y); + _SelectByMouse(x, y); if (_Selection >= _Interactions.Count || _Selection < 0) return; @@ -1114,41 +964,35 @@ namespace VocaluxeLib.Menu } } - public void SelectByMouse(int x, int y) + private void _SelectByMouse(int x, int y) { float z = CBase.Settings.GetZFar(); for (int i = 0; i < _Interactions.Count; i++) { - if ((CBase.Settings.GetGameState() == EGameState.EditTheme) || (!_Interactions[i].ThemeEditorOnly && _IsVisible(i) && _IsEnabled(i))) - { - if (_IsMouseOver(x, y, _Interactions[i])) - { - if (_GetZValue(_Interactions[i]) <= z) - { - z = _GetZValue(_Interactions[i]); - _UnsetSelected(); - _Selection = i; - _SetSelected(); - } - } - } + if ((CBase.Settings.GetGameState() != EGameState.EditTheme) && (_Interactions[i].ThemeEditorOnly || !_IsVisible(i) || !_IsEnabled(i))) + continue; + if (!_IsMouseOver(x, y, _Interactions[i])) + continue; + if (_GetZValue(_Interactions[i]) > z) + continue; + z = _GetZValue(_Interactions[i]); + _UnsetSelected(); + _Selection = i; + _SetSelected(); } } - public bool IsMouseOver(SMouseEvent mouseEvent) + protected bool _IsMouseOver(SMouseEvent mouseEvent) { - return IsMouseOver(mouseEvent.X, mouseEvent.Y); + return _IsMouseOver(mouseEvent.X, mouseEvent.Y); } - public bool IsMouseOver(int x, int y) + private bool _IsMouseOver(int x, int y) { if (_Selection >= _Interactions.Count || _Selection < 0) return false; - if (_Interactions.Count > 0) - return _IsMouseOver(x, y, _Interactions[_Selection]); - else - return false; + return _Interactions.Count > 0 && _IsMouseOver(x, y, _Interactions[_Selection]); } private bool _IsMouseOver(int x, int y, CInteraction interact) @@ -1314,7 +1158,6 @@ namespace VocaluxeLib.Menu int element = _Selection; int stage = int.MaxValue; - float distance = float.MaxValue; int direction = -1; int mute = -1; @@ -1340,7 +1183,6 @@ namespace VocaluxeLib.Menu { stage = stages[i]; element = elements[i]; - distance = distances[i]; direction = i; } } @@ -1469,10 +1311,7 @@ namespace VocaluxeLib.Menu inDirection = true; break; } - if (!inDirection) - return float.MaxValue; - else - return distance; + return !inDirection ? float.MaxValue : distance; } private float _GetDistance180(SKeyEvent key, SRectF actualRect, SRectF targetRect) @@ -1505,10 +1344,7 @@ namespace VocaluxeLib.Menu inDirection = true; break; } - if (!inDirection) - return float.MaxValue; - else - return distance; + return !inDirection ? float.MaxValue : distance; } /// @@ -1679,6 +1515,7 @@ namespace VocaluxeLib.Menu } } +// ReSharper disable UnusedMember.Local private void _ToggleHighlighted() { if (_Selection >= _Interactions.Count || _Selection < 0) @@ -1693,11 +1530,9 @@ namespace VocaluxeLib.Menu if (_Selection >= _Interactions.Count || _Selection < 0) return false; - if (_Interactions[_Selection].Type == EType.SelectSlide) - return _SelectSlides[_Interactions[_Selection].Num].Highlighted; - - return false; + return _Interactions[_Selection].Type == EType.SelectSlide && _SelectSlides[_Interactions[_Selection].Num].Highlighted; } + // ReSharper restore UnusedMember.Local private bool _IsVisible(int interaction) { @@ -1988,30 +1823,25 @@ namespace VocaluxeLib.Menu if (actualVersion == reqVersion) return true; + string msg = "Can't load screen file of screen \"" + ThemeName + "\", "; + if (actualVersion < reqVersion) + msg += "the file ist outdated! "; else - { - string msg = "Can't load screen file of screen \"" + ThemeName + "\", "; - if (actualVersion < reqVersion) - msg += "the file ist outdated! "; - else - msg += "the file is for newer program versions! "; + msg += "the file is for newer program versions! "; - msg += "Current screen version is " + reqVersion.ToString(); - CBase.Log.LogError(msg); - } + msg += "Current screen version is " + reqVersion; + CBase.Log.LogError(msg); return false; } private void _LoadThemeBasics(CXMLReader xmlReader, int skinIndex) { - string value = String.Empty; - // Backgrounds CBackground background = new CBackground(_PartyModeID); int i = 1; - while (background.LoadTheme("//root/" + ThemeName, "Background" + i.ToString(), xmlReader, skinIndex)) + while (background.LoadTheme("//root/" + ThemeName, "Background" + i, xmlReader, skinIndex)) { - AddBackground(background); + _AddBackground(background); background = new CBackground(_PartyModeID); i++; } @@ -2019,9 +1849,9 @@ namespace VocaluxeLib.Menu // Statics CStatic stat = new CStatic(_PartyModeID); i = 1; - while (stat.LoadTheme("//root/" + ThemeName, "Static" + i.ToString(), xmlReader, skinIndex)) + while (stat.LoadTheme("//root/" + ThemeName, "Static" + i, xmlReader, skinIndex)) { - AddStatic(stat); + _AddStatic(stat); stat = new CStatic(_PartyModeID); i++; } @@ -2029,9 +1859,9 @@ namespace VocaluxeLib.Menu // Texts CText text = new CText(_PartyModeID); i = 1; - while (text.LoadTheme("//root/" + ThemeName, "Text" + i.ToString(), xmlReader, skinIndex)) + while (text.LoadTheme("//root/" + ThemeName, "Text" + i, xmlReader, skinIndex)) { - AddText(text); + _AddText(text); text = new CText(_PartyModeID); i++; } @@ -2039,9 +1869,9 @@ namespace VocaluxeLib.Menu // ParticleEffects CParticleEffect partef = new CParticleEffect(_PartyModeID); i = 1; - while (partef.LoadTheme("//root/" + ThemeName, "ParticleEffect" + i.ToString(), xmlReader, skinIndex)) + while (partef.LoadTheme("//root/" + ThemeName, "ParticleEffect" + i, xmlReader, skinIndex)) { - AddParticleEffect(partef); + _AddParticleEffect(partef); partef = new CParticleEffect(_PartyModeID); i++; } diff --git a/VocaluxeLib/Menu/CNameSelection.cs b/VocaluxeLib/Menu/CNameSelection.cs index 19231a71..1b19f16a 100644 --- a/VocaluxeLib/Menu/CNameSelection.cs +++ b/VocaluxeLib/Menu/CNameSelection.cs @@ -46,8 +46,6 @@ namespace VocaluxeLib.Menu public readonly CStatic Avatar; public readonly CText Name; - public CTile() {} - public CTile(CStatic av, CText tex, int pl) { Avatar = av; @@ -65,7 +63,7 @@ namespace VocaluxeLib.Menu return _Theme.Name; } - public bool Selected = false; + public bool Selected; public bool Visible = true; public SRectF Rect; @@ -85,7 +83,7 @@ namespace VocaluxeLib.Menu private int _TileW; private int _TileH; - public int Offset = 0; + public int Offset; private int _ActualSelection = -1; public int Selection = -1; @@ -129,9 +127,9 @@ namespace VocaluxeLib.Menu _ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/W", ref Rect.W); _ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/H", ref Rect.H); - _ThemeLoaded &= xmlReader.GetValue(item + "/SkinEmptyTile", ref _Theme.TextureEmptyTileName, String.Empty); + _ThemeLoaded &= xmlReader.GetValue(item + "/SkinEmptyTile", out _Theme.TextureEmptyTileName, String.Empty); - if (xmlReader.GetValue(item + "/ColorEmptyTile", ref _Theme.ColorEmptyTileName, String.Empty)) + if (xmlReader.GetValue(item + "/ColorEmptyTile", out _Theme.ColorEmptyTileName, String.Empty)) _ThemeLoaded &= CBase.Theme.GetColor(_Theme.ColorEmptyTileName, skinIndex, out ColorEmptyTile); else { @@ -141,7 +139,7 @@ namespace VocaluxeLib.Menu _ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/A", ref ColorEmptyTile.A); } - _ThemeLoaded &= xmlReader.GetValue(item + "/SkinTileSelected", ref _Theme.TextureTileSelectedName, String.Empty); + _ThemeLoaded &= xmlReader.GetValue(item + "/SkinTileSelected", out _Theme.TextureTileSelectedName, String.Empty); _ThemeLoaded &= xmlReader.TryGetIntValue(item + "/Tiles/W", ref _TileW); _ThemeLoaded &= xmlReader.TryGetIntValue(item + "/Tiles/H", ref _TileH); @@ -151,9 +149,9 @@ namespace VocaluxeLib.Menu _ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/Tiles/SpaceH", ref _SpaceH); _ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/Tiles/Name/Space", ref _Theme.NameSpace); _ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/Tiles/Name/H", ref _Theme.NameHeight); - _ThemeLoaded &= xmlReader.GetValue(item + "/Tiles/Name/Font", ref _Theme.NameFont, "Normal"); + _ThemeLoaded &= xmlReader.GetValue(item + "/Tiles/Name/Font", out _Theme.NameFont, "Normal"); _ThemeLoaded &= xmlReader.TryGetEnumValue(item + "/Tiles/Name/Style", ref _Theme.NameStyle); - if (xmlReader.GetValue(item + "/Tiles/Name/Color", ref _Theme.NameColorName, String.Empty)) + if (xmlReader.GetValue(item + "/Tiles/Name/Color", out _Theme.NameColorName, String.Empty)) _ThemeLoaded &= CBase.Theme.GetColor(_Theme.NameColorName, skinIndex, out _Theme.NameColor); else { @@ -493,10 +491,8 @@ namespace VocaluxeLib.Menu _VisibleProfiles.Clear(); for (int i = 0; i < CBase.Profiles.GetProfiles().Length; i++) { - bool visible = false; + bool visible = CBase.Profiles.GetProfiles()[i].Active == EOffOn.TR_CONFIG_ON; //Show profile only if active - if (CBase.Profiles.GetProfiles()[i].Active == EOffOn.TR_CONFIG_ON) - visible = true; for (int p = 0; p < CBase.Game.GetNumPlayer(); p++) { //Don't show profile if is selected, but if selected and guest diff --git a/VocaluxeLib/Menu/CObjectInteractions.cs b/VocaluxeLib/Menu/CObjectInteractions.cs index 3ce558d5..5f7d6044 100644 --- a/VocaluxeLib/Menu/CObjectInteractions.cs +++ b/VocaluxeLib/Menu/CObjectInteractions.cs @@ -636,7 +636,6 @@ namespace VocaluxeLib.Menu int element = _Selection; int stage = int.MaxValue; - float distance = float.MaxValue; int direction = -1; int mute = -1; @@ -662,7 +661,6 @@ namespace VocaluxeLib.Menu { stage = stages[i]; element = elements[i]; - distance = distances[i]; direction = i; } } @@ -1039,7 +1037,7 @@ namespace VocaluxeLib.Menu private void _DrawInteraction(int interaction) { - bool sel = false; + bool sel; switch (_Interactions[interaction].Type) { case EType.Static: diff --git a/VocaluxeLib/Menu/CParticle.cs b/VocaluxeLib/Menu/CParticle.cs index 97f77ed0..f0926631 100644 --- a/VocaluxeLib/Menu/CParticle.cs +++ b/VocaluxeLib/Menu/CParticle.cs @@ -385,7 +385,7 @@ namespace VocaluxeLib.Menu string item = xmlPath + "/" + elementName; _ThemeLoaded = true; - _ThemeLoaded &= xmlReader.GetValue(item + "/Skin", ref _Theme.TextureName, String.Empty); + _ThemeLoaded &= xmlReader.GetValue(item + "/Skin", out _Theme.TextureName, String.Empty); _ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/X", ref Rect.X); _ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/Y", ref Rect.Y); @@ -393,7 +393,7 @@ namespace VocaluxeLib.Menu _ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/W", ref Rect.W); _ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/H", ref Rect.H); - if (xmlReader.GetValue(item + "/Color", ref _Theme.ColorName, String.Empty)) + if (xmlReader.GetValue(item + "/Color", out _Theme.ColorName, String.Empty)) _ThemeLoaded &= CBase.Theme.GetColor(_Theme.ColorName, skinIndex, out Color); else { diff --git a/VocaluxeLib/Menu/CPlaylist.cs b/VocaluxeLib/Menu/CPlaylist.cs index 12652139..c0386fc7 100644 --- a/VocaluxeLib/Menu/CPlaylist.cs +++ b/VocaluxeLib/Menu/CPlaylist.cs @@ -189,7 +189,7 @@ namespace VocaluxeLib.Menu public EEditMode EditMode; public int ActivePlaylistID = -1; - public int Offset = 0; + public int Offset; public int CurrentPlaylistElement = -1; private CPlaylistElement _ChangeOrderElement; @@ -249,15 +249,15 @@ namespace VocaluxeLib.Menu string item = xmlPath + "/" + elementName; _ThemeLoaded = true; - _ThemeLoaded &= xmlReader.GetValue(item + "/SkinBackground", ref _Theme.TextureBackgroundName, String.Empty); - _ThemeLoaded &= xmlReader.GetValue(item + "/SkinBackgroundSelected", ref _Theme.SelTextureBackgroundName, String.Empty); + _ThemeLoaded &= xmlReader.GetValue(item + "/SkinBackground", out _Theme.TextureBackgroundName, String.Empty); + _ThemeLoaded &= xmlReader.GetValue(item + "/SkinBackgroundSelected", out _Theme.SelTextureBackgroundName, String.Empty); _ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/X", ref Rect.X); _ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/Y", ref Rect.Y); _ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/Z", ref Rect.Z); _ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/W", ref Rect.W); _ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/H", ref Rect.H); - if (xmlReader.GetValue(item + "/ColorBackground", ref _Theme.ColorBackgroundName, String.Empty)) + if (xmlReader.GetValue(item + "/ColorBackground", out _Theme.ColorBackgroundName, String.Empty)) _ThemeLoaded &= CBase.Theme.GetColor(_Theme.ColorBackgroundName, skinIndex, out BackgroundColor); else { @@ -266,7 +266,7 @@ namespace VocaluxeLib.Menu _ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/BackgroundB", ref BackgroundColor.B); _ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/BackgroundA", ref BackgroundColor.A); } - if (xmlReader.GetValue(item + "/SColorBackground", ref _Theme.SelColorBackgroundName, String.Empty)) + if (xmlReader.GetValue(item + "/SColorBackground", out _Theme.SelColorBackgroundName, String.Empty)) _ThemeLoaded &= CBase.Theme.GetColor(_Theme.SelColorBackgroundName, skinIndex, out BackgroundSelColor); else { @@ -1227,7 +1227,7 @@ namespace VocaluxeLib.Menu CSong song = CBase.Songs.GetSongByID(pec.SongID); _PlaylistElements[i].Cover.Texture = song.CoverTextureSmall; string t1 = _Theme.Text1.Text.Replace("%a", song.Artist).Replace("%t", song.Title); - _PlaylistElements[i].Text1.Text = /*(Offset + i + 1).ToString() + ") " + */ song.Artist + " - " + song.Title; //TODO: Add text field for the number + _PlaylistElements[i].Text1.Text = /*(Offset + i + 1) + ") " + */ song.Artist + " - " + song.Title; //TODO: Add text field for the number _PlaylistElements[i].SelectSlide.Clear(); for (int g = 0; g < pec.Modes.Length; g++) { diff --git a/VocaluxeLib/Menu/CPoints.cs b/VocaluxeLib/Menu/CPoints.cs index e024f0db..84dab764 100644 --- a/VocaluxeLib/Menu/CPoints.cs +++ b/VocaluxeLib/Menu/CPoints.cs @@ -18,8 +18,6 @@ #endregion using System; -using System.Collections.Generic; -using System.Text; namespace VocaluxeLib.Menu { diff --git a/VocaluxeLib/Menu/CScreenSetting.cs b/VocaluxeLib/Menu/CScreenSetting.cs index 40361ec8..4819b4d9 100644 --- a/VocaluxeLib/Menu/CScreenSetting.cs +++ b/VocaluxeLib/Menu/CScreenSetting.cs @@ -68,7 +68,7 @@ namespace VocaluxeLib.Menu string item = xmlPath + "/" + elementName; _ThemeLoaded = true; - _ThemeLoaded &= xmlReader.GetValue(item + "/Value", ref _Theme.Value, String.Empty); + _ThemeLoaded &= xmlReader.GetValue(item + "/Value", out _Theme.Value, String.Empty); _ThemeLoaded &= xmlReader.TryGetEnumValue(item + "/Type", ref _Theme.Type); if (_ThemeLoaded) diff --git a/VocaluxeLib/Menu/CSelectSlide.cs b/VocaluxeLib/Menu/CSelectSlide.cs index b220a763..f320a084 100644 --- a/VocaluxeLib/Menu/CSelectSlide.cs +++ b/VocaluxeLib/Menu/CSelectSlide.cs @@ -103,7 +103,7 @@ namespace VocaluxeLib.Menu } public bool Visible = true; - public bool Highlighted = false; + public bool Highlighted; private bool _ArrowLeftSelected; private bool _ArrowRightSelected; @@ -115,7 +115,7 @@ namespace VocaluxeLib.Menu private readonly List _ValueBounds = new List(); - public bool WithTextures = false; + public bool WithTextures; private int _Selection = -1; public int Selection @@ -249,15 +249,15 @@ namespace VocaluxeLib.Menu string item = xmlPath + "/" + elementName; _ThemeLoaded = true; - _ThemeLoaded &= xmlReader.GetValue(item + "/Skin", ref _Theme.TextureName, String.Empty); - _ThemeLoaded &= xmlReader.GetValue(item + "/SkinArrowLeft", ref _Theme.TextureArrowLeftName, String.Empty); - _ThemeLoaded &= xmlReader.GetValue(item + "/SkinArrowRight", ref _Theme.TextureArrowRightName, String.Empty); + _ThemeLoaded &= xmlReader.GetValue(item + "/Skin", out _Theme.TextureName, String.Empty); + _ThemeLoaded &= xmlReader.GetValue(item + "/SkinArrowLeft", out _Theme.TextureArrowLeftName, String.Empty); + _ThemeLoaded &= xmlReader.GetValue(item + "/SkinArrowRight", out _Theme.TextureArrowRightName, String.Empty); - _ThemeLoaded &= xmlReader.GetValue(item + "/SkinSelected", ref _Theme.SelTextureName, String.Empty); - _ThemeLoaded &= xmlReader.GetValue(item + "/SkinArrowLeftSelected", ref _Theme.SelTextureArrowLeftName, String.Empty); - _ThemeLoaded &= xmlReader.GetValue(item + "/SkinArrowRightSelected", ref _Theme.SelTextureArrowRightName, String.Empty); + _ThemeLoaded &= xmlReader.GetValue(item + "/SkinSelected", out _Theme.SelTextureName, String.Empty); + _ThemeLoaded &= xmlReader.GetValue(item + "/SkinArrowLeftSelected", out _Theme.SelTextureArrowLeftName, String.Empty); + _ThemeLoaded &= xmlReader.GetValue(item + "/SkinArrowRightSelected", out _Theme.SelTextureArrowRightName, String.Empty); - _ThemeLoaded &= xmlReader.GetValue(item + "/SkinHighlighted", ref _Theme.HighlightTextureName, String.Empty); + _ThemeLoaded &= xmlReader.GetValue(item + "/SkinHighlighted", out _Theme.HighlightTextureName, String.Empty); _ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/X", ref Rect.X); _ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/Y", ref Rect.Y); @@ -265,7 +265,7 @@ namespace VocaluxeLib.Menu _ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/W", ref Rect.W); _ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/H", ref Rect.H); - if (xmlReader.GetValue(item + "/Color", ref _Theme.ColorName, String.Empty)) + if (xmlReader.GetValue(item + "/Color", out _Theme.ColorName, String.Empty)) _ThemeLoaded &= CBase.Theme.GetColor(_Theme.ColorName, skinIndex, out Color); else { @@ -275,7 +275,7 @@ namespace VocaluxeLib.Menu _ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/A", ref Color.A); } - if (xmlReader.GetValue(item + "/SColor", ref _Theme.SelColorName, String.Empty)) + if (xmlReader.GetValue(item + "/SColor", out _Theme.SelColorName, String.Empty)) _ThemeLoaded &= CBase.Theme.GetColor(_Theme.SelColorName, skinIndex, out SelColor); else { @@ -285,7 +285,7 @@ namespace VocaluxeLib.Menu _ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/SA", ref SelColor.A); } - if (xmlReader.GetValue(item + "/HColor", ref _Theme.HighlightColorName, String.Empty)) + if (xmlReader.GetValue(item + "/HColor", out _Theme.HighlightColorName, String.Empty)) _ThemeLoaded &= CBase.Theme.GetColor(_Theme.HighlightColorName, skinIndex, out HighlightColor); else { @@ -307,7 +307,7 @@ namespace VocaluxeLib.Menu _ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/ArrowRightW", ref RectArrowRight.W); _ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/ArrowRightH", ref RectArrowRight.H); - if (xmlReader.GetValue(item + "/ArrowColor", ref _Theme.ArrowColorName, String.Empty)) + if (xmlReader.GetValue(item + "/ArrowColor", out _Theme.ArrowColorName, String.Empty)) _ThemeLoaded &= CBase.Theme.GetColor(_Theme.ArrowColorName, skinIndex, out ColorArrow); else { @@ -317,7 +317,7 @@ namespace VocaluxeLib.Menu _ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/ArrowA", ref ColorArrow.A); } - if (xmlReader.GetValue(item + "/ArrowSColor", ref _Theme.SelArrowColorName, String.Empty)) + if (xmlReader.GetValue(item + "/ArrowSColor", out _Theme.SelArrowColorName, String.Empty)) _ThemeLoaded &= CBase.Theme.GetColor(_Theme.SelArrowColorName, skinIndex, out SelColorArrow); else { @@ -327,7 +327,7 @@ namespace VocaluxeLib.Menu _ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/ArrowSA", ref SelColorArrow.A); } - if (xmlReader.GetValue(item + "/TextColor", ref _Theme.TextColorName, String.Empty)) + if (xmlReader.GetValue(item + "/TextColor", out _Theme.TextColorName, String.Empty)) _ThemeLoaded &= CBase.Theme.GetColor(_Theme.TextColorName, skinIndex, out TextColor); else { @@ -337,7 +337,7 @@ namespace VocaluxeLib.Menu _ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/TextA", ref TextColor.A); } - if (xmlReader.GetValue(item + "/TextSColor", ref _Theme.SelTextColorName, String.Empty)) + if (xmlReader.GetValue(item + "/TextSColor", out _Theme.SelTextColorName, String.Empty)) _ThemeLoaded &= CBase.Theme.GetColor(_Theme.SelTextColorName, skinIndex, out SelTextColor); else { @@ -353,7 +353,7 @@ namespace VocaluxeLib.Menu if (xmlReader.TryGetFloatValue(item + "/TextRelativeY", ref TextRelativeY)) _ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/TextRelativeY", ref TextRelativeY); _ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/TextMaxW", ref MaxW); - _ThemeLoaded &= xmlReader.GetValue(item + "/TextFont", ref _Theme.TextFont, "Normal"); + _ThemeLoaded &= xmlReader.GetValue(item + "/TextFont", out _Theme.TextFont, "Normal"); _ThemeLoaded &= xmlReader.TryGetEnumValue(item + "/TextStyle", ref _Theme.TextStyle); _ThemeLoaded &= xmlReader.TryGetIntValue(item + "/NumVisible", ref _NumVisible); diff --git a/VocaluxeLib/Menu/CStatic.cs b/VocaluxeLib/Menu/CStatic.cs index f5dc147d..14bc216c 100644 --- a/VocaluxeLib/Menu/CStatic.cs +++ b/VocaluxeLib/Menu/CStatic.cs @@ -148,7 +148,7 @@ namespace VocaluxeLib.Menu string item = xmlPath + "/" + elementName; _ThemeLoaded = true; - _ThemeLoaded &= xmlReader.GetValue(item + "/Skin", ref _Theme.TextureName, String.Empty); + _ThemeLoaded &= xmlReader.GetValue(item + "/Skin", out _Theme.TextureName, String.Empty); _ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/X", ref Rect.X); _ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/Y", ref Rect.Y); @@ -156,7 +156,7 @@ namespace VocaluxeLib.Menu _ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/W", ref Rect.W); _ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/H", ref Rect.H); - if (xmlReader.GetValue(item + "/Color", ref _Theme.ColorName, String.Empty)) + if (xmlReader.GetValue(item + "/Color", out _Theme.ColorName, String.Empty)) _ThemeLoaded &= CBase.Theme.GetColor(_Theme.ColorName, skinIndex, out Color); else { @@ -268,8 +268,8 @@ namespace VocaluxeLib.Menu if (aspect != EAspect.Stretch) { RectangleF bounds2 = new RectangleF(bounds.X, bounds.Y, bounds.W, bounds.H); - RectangleF rect2 = new RectangleF(0f, 0f, texture.Width, texture.Height); - CHelper.SetRect(bounds2, ref rect2, texture.Width / texture.Height, aspect); + RectangleF rect2; + CHelper.SetRect(bounds2, out rect2, texture.Width / texture.Height, aspect); rect.X = rect2.X; rect.Y = rect2.Y; diff --git a/VocaluxeLib/Menu/CText.cs b/VocaluxeLib/Menu/CText.cs index da42158d..613a5000 100644 --- a/VocaluxeLib/Menu/CText.cs +++ b/VocaluxeLib/Menu/CText.cs @@ -210,7 +210,7 @@ namespace VocaluxeLib.Menu public SColorF Color; //normal Color public SColorF SelColor; //selected Color for Buttons - public bool Reflection = false; + public bool Reflection; public float ReflectionSpace; public float ReflectionHeight; @@ -249,7 +249,7 @@ namespace VocaluxeLib.Menu } } - public bool Selected = false; + public bool Selected; public bool Visible = true; private bool _EditMode; public bool EditMode @@ -461,7 +461,7 @@ namespace VocaluxeLib.Menu _ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/H", ref _Height); xmlReader.TryGetFloatValue(item + "/MaxW", ref _MaxWidth); - if (xmlReader.GetValue(item + "/Color", ref _Theme.ColorName, String.Empty)) + if (xmlReader.GetValue(item + "/Color", out _Theme.ColorName, String.Empty)) _ThemeLoaded &= CBase.Theme.GetColor(_Theme.ColorName, skinIndex, out Color); else { @@ -471,7 +471,7 @@ namespace VocaluxeLib.Menu _ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/A", ref Color.A); } - if (xmlReader.GetValue(item + "/SColor", ref _Theme.SelColorName, String.Empty)) + if (xmlReader.GetValue(item + "/SColor", out _Theme.SelColorName, String.Empty)) _ThemeLoaded &= CBase.Theme.GetColor(_Theme.SelColorName, skinIndex, out SelColor); else { @@ -486,9 +486,9 @@ namespace VocaluxeLib.Menu _ThemeLoaded &= xmlReader.TryGetEnumValue(item + "/Align", ref _Align); xmlReader.TryGetEnumValue(item + "/HAlign", ref _HAlign); _ThemeLoaded &= xmlReader.TryGetEnumValue(item + "/Style", ref _Style); - _ThemeLoaded &= xmlReader.GetValue(item + "/Font", ref _Font, "Normal"); + _ThemeLoaded &= xmlReader.GetValue(item + "/Font", out _Font, "Normal"); - _ThemeLoaded &= xmlReader.GetValue(item + "/Text", ref _Theme.Text, String.Empty); + _ThemeLoaded &= xmlReader.GetValue(item + "/Text", out _Theme.Text, String.Empty); if (xmlReader.ItemExists(item + "/Reflection") && !buttonText) { diff --git a/VocaluxeLib/Menu/CXMLReader.cs b/VocaluxeLib/Menu/CXMLReader.cs index 78a53dbe..0a21f4e7 100644 --- a/VocaluxeLib/Menu/CXMLReader.cs +++ b/VocaluxeLib/Menu/CXMLReader.cs @@ -62,8 +62,8 @@ namespace VocaluxeLib.Menu public bool TryGetEnumValue(string cast, ref T value) where T : struct { - string val = String.Empty; - if (GetValue(cast, ref val, Enum.GetName(typeof(T), value))) + string val; + if (GetValue(cast, out val, Enum.GetName(typeof(T), value))) { CHelper.TryParse(val, out value, true); return true; @@ -73,8 +73,8 @@ namespace VocaluxeLib.Menu public bool TryGetIntValue(string cast, ref int value) { - string val = String.Empty; - if (GetValue(cast, ref val, value.ToString())) + string val; + if (GetValue(cast, out val, value.ToString())) return int.TryParse(val, out value); return false; } @@ -94,37 +94,31 @@ namespace VocaluxeLib.Menu public bool TryGetFloatValue(string cast, ref float value) { - string val = String.Empty; - if (GetValue(cast, ref val, value.ToString())) - return CHelper.TryParse(val, out value); - return false; + string val; + return GetValue(cast, out val, value.ToString()) && CHelper.TryParse(val, out value); } - public bool GetValue(string cast, ref string value, string defaultValue) + public bool GetValue(string cast, out string value, string defaultValue) { - XPathNodeIterator iterator; - int results = 0; + int resultCt = 0; string val = string.Empty; _Navigator.MoveToFirstChild(); - iterator = _Navigator.Select(cast); + XPathNodeIterator iterator = _Navigator.Select(cast); while (iterator.MoveNext()) { val = iterator.Current.Value; - results++; + resultCt++; } - if ((results == 0) || (results > 1)) + if (resultCt!=1) { value = defaultValue; return false; } - else - { - value = val; - return true; - } + value = val; + return true; } public List GetValues(string cast) diff --git a/VocaluxeLib/Menu/Enums.cs b/VocaluxeLib/Menu/Enums.cs index ee8484c6..e52e1b86 100644 --- a/VocaluxeLib/Menu/Enums.cs +++ b/VocaluxeLib/Menu/Enums.cs @@ -94,7 +94,7 @@ namespace VocaluxeLib.Menu X32 = 32 } - public enum EColorDeep + public enum EColorDepth { Bit8 = 8, Bit16 = 16, @@ -136,6 +136,7 @@ namespace VocaluxeLib.Menu public enum EBufferSize { +// ReSharper disable UnusedMember.Global B0 = 0, B512 = 512, B1024 = 1024, @@ -145,6 +146,7 @@ namespace VocaluxeLib.Menu B3072 = 3072, B3584 = 3584, B4096 = 4096 + // ReSharper restore UnusedMember.Global } public enum EPlaybackLib diff --git a/VocaluxeLib/Menu/IMenu.cs b/VocaluxeLib/Menu/IMenu.cs index 76952879..411c9f53 100644 --- a/VocaluxeLib/Menu/IMenu.cs +++ b/VocaluxeLib/Menu/IMenu.cs @@ -20,8 +20,6 @@ using System; using System.Collections.Generic; using System.Drawing; -using System.Windows.Forms; -using VocaluxeLib.Menu.SingNotes; using VocaluxeLib.Menu.SongMenu; using VocaluxeLib.PartyModes; @@ -273,7 +271,7 @@ namespace VocaluxeLib.Menu { int Load(string videoFileName); bool Skip(int videoStream, float startPosition, float videoGap); - bool GetFrame(int videoStream, ref STexture videoTexture, float time, ref float videoTime); + bool GetFrame(int videoStream, ref STexture videoTexture, float time, out float videoTime); bool IsFinished(int videoStream); bool Close(int videoStream); } diff --git a/VocaluxeLib/Menu/SingNotes/CNotes.cs b/VocaluxeLib/Menu/SingNotes/CNotes.cs index 1943d323..21377ab5 100644 --- a/VocaluxeLib/Menu/SingNotes/CNotes.cs +++ b/VocaluxeLib/Menu/SingNotes/CNotes.cs @@ -258,10 +258,7 @@ namespace VocaluxeLib.Menu.SingNotes #region Methods public bool IsPerfect(CNote compareNote) { - bool result = true; - - if (!Hit) - result = false; + bool result = Hit; if (StartBeat != compareNote.StartBeat) result = false; diff --git a/VocaluxeLib/Menu/SingNotes/CSingNotes.cs b/VocaluxeLib/Menu/SingNotes/CSingNotes.cs index 526daadd..d3d3e4f6 100644 --- a/VocaluxeLib/Menu/SingNotes/CSingNotes.cs +++ b/VocaluxeLib/Menu/SingNotes/CSingNotes.cs @@ -100,17 +100,17 @@ namespace VocaluxeLib.Menu.SingNotes string item = xmlPath + "/" + elementName; _ThemeLoaded = true; - _ThemeLoaded &= xmlReader.GetValue(item + "/SkinLeft", ref _Theme.SkinLeftName, String.Empty); - _ThemeLoaded &= xmlReader.GetValue(item + "/SkinMiddle", ref _Theme.SkinMiddleName, String.Empty); - _ThemeLoaded &= xmlReader.GetValue(item + "/SkinRight", ref _Theme.SkinRightName, String.Empty); + _ThemeLoaded &= xmlReader.GetValue(item + "/SkinLeft", out _Theme.SkinLeftName, String.Empty); + _ThemeLoaded &= xmlReader.GetValue(item + "/SkinMiddle", out _Theme.SkinMiddleName, String.Empty); + _ThemeLoaded &= xmlReader.GetValue(item + "/SkinRight", out _Theme.SkinRightName, String.Empty); - _ThemeLoaded &= xmlReader.GetValue(item + "/SkinBackgroundLeft", ref _Theme.SkinBackgroundLeftName, String.Empty); - _ThemeLoaded &= xmlReader.GetValue(item + "/SkinBackgroundMiddle", ref _Theme.SkinBackgroundMiddleName, String.Empty); - _ThemeLoaded &= xmlReader.GetValue(item + "/SkinBackgroundRight", ref _Theme.SkinBackgroundRightName, String.Empty); + _ThemeLoaded &= xmlReader.GetValue(item + "/SkinBackgroundLeft", out _Theme.SkinBackgroundLeftName, String.Empty); + _ThemeLoaded &= xmlReader.GetValue(item + "/SkinBackgroundMiddle", out _Theme.SkinBackgroundMiddleName, String.Empty); + _ThemeLoaded &= xmlReader.GetValue(item + "/SkinBackgroundRight", out _Theme.SkinBackgroundRightName, String.Empty); - _ThemeLoaded &= xmlReader.GetValue(item + "/SkinGoldenStar", ref _Theme.SkinGoldenStarName, String.Empty); - _ThemeLoaded &= xmlReader.GetValue(item + "/SkinToneHelper", ref _Theme.SkinToneHelperName, String.Empty); - _ThemeLoaded &= xmlReader.GetValue(item + "/SkinPerfectNoteStar", ref _Theme.SkinPerfectNoteStarName, String.Empty); + _ThemeLoaded &= xmlReader.GetValue(item + "/SkinGoldenStar", out _Theme.SkinGoldenStarName, String.Empty); + _ThemeLoaded &= xmlReader.GetValue(item + "/SkinToneHelper", out _Theme.SkinToneHelperName, String.Empty); + _ThemeLoaded &= xmlReader.GetValue(item + "/SkinPerfectNoteStar", out _Theme.SkinPerfectNoteStarName, String.Empty); _BarPos = new SRectF[CBase.Settings.GetMaxNumPlayer(),CBase.Settings.GetMaxNumPlayer()]; for (int numplayer = 0; numplayer < CBase.Settings.GetMaxNumPlayer(); numplayer++) @@ -120,7 +120,7 @@ namespace VocaluxeLib.Menu.SingNotes if (player <= numplayer) { _BarPos[player, numplayer] = new SRectF(); - string target = "/BarPositions/P" + (player + 1).ToString() + "N" + (numplayer + 1).ToString(); + string target = "/BarPositions/P" + (player + 1) + "N" + (numplayer + 1); _ThemeLoaded &= xmlReader.TryGetFloatValue(item + target + "X", ref _BarPos[player, numplayer].X); _ThemeLoaded &= xmlReader.TryGetFloatValue(item + target + "Y", ref _BarPos[player, numplayer].Y); _ThemeLoaded &= xmlReader.TryGetFloatValue(item + target + "Z", ref _BarPos[player, numplayer].Z); @@ -182,7 +182,7 @@ namespace VocaluxeLib.Menu.SingNotes { if (player <= numplayer) { - string target = "P" + (player + 1).ToString() + "N" + (numplayer + 1).ToString(); + string target = "P" + (player + 1) + "N" + (numplayer + 1); writer.WriteElementString(target + "X", _BarPos[player, numplayer].X.ToString("#0")); writer.WriteElementString(target + "Y", _BarPos[player, numplayer].Y.ToString("#0")); diff --git a/VocaluxeLib/Menu/SongMenu/CSong.cs b/VocaluxeLib/Menu/SongMenu/CSong.cs index c74b7591..2197bdc5 100644 --- a/VocaluxeLib/Menu/SongMenu/CSong.cs +++ b/VocaluxeLib/Menu/SongMenu/CSong.cs @@ -127,9 +127,9 @@ namespace VocaluxeLib.Menu.SongMenu public SMedley Medley = new SMedley(0); public bool CalculateMedley = true; - public float PreviewStart = 0f; + public float PreviewStart; - public int ShortEnd = 0; + public int ShortEnd; public Encoding Encoding = Encoding.Default; public string Folder = String.Empty; @@ -179,8 +179,7 @@ namespace VocaluxeLib.Menu.SongMenu { if (_CoverBigLoaded) return _CoverTextureBig; - else - return _CoverTextureSmall; + return _CoverTextureSmall; } set { @@ -195,23 +194,23 @@ namespace VocaluxeLib.Menu.SongMenu public string TitleSorting = String.Empty; public string ArtistSorting = String.Empty; - public float Start = 0f; - public float Finish = 0f; + public float Start; + public float Finish; public float BPM = 1f; - public float Gap = 0f; - public float VideoGap = 0f; + public float Gap; + public float VideoGap; public string DuetPart1 = String.Empty; public string DuetPart2 = String.Empty; - public List Comment = new List(); + private readonly List _Comment = new List(); // Sorting public int ID; - public bool Visible = true; - public int CatIndex = -1; - public bool Selected = false; + private readonly bool _Visible = true; + private readonly int _CatIndex = -1; + private readonly bool _Selected; public bool IsDuet { get { return Notes.Lines.Length > 1; } @@ -297,14 +296,14 @@ namespace VocaluxeLib.Menu.SongMenu Gap = song.Gap; VideoGap = song.VideoGap; - Comment = new List(); - foreach (string value in song.Comment) - Comment.Add(value); + _Comment = new List(); + foreach (string value in song._Comment) + _Comment.Add(value); ID = song.ID; - Visible = song.Visible; - CatIndex = song.CatIndex; - Selected = song.Selected; + _Visible = song._Visible; + _CatIndex = song._CatIndex; + _Selected = song._Selected; Edition = new List(); foreach (string value in song.Edition) @@ -339,23 +338,24 @@ namespace VocaluxeLib.Menu.SongMenu return false; Folder = Path.GetDirectoryName(filePath); + if (Folder == null) + return false; foreach (string folder in CBase.Config.GetSongFolder()) { - if (Folder.Contains(folder)) + if (!Folder.Contains(folder)) + continue; + if (Folder.Length == folder.Length) + FolderName = "Songs"; + else { - if (Folder.Length == folder.Length) - FolderName = "Songs"; - else - { - FolderName = Folder.Substring(folder.Length + 1, Folder.Length - folder.Length - 1); + FolderName = Folder.Substring(folder.Length + 1, Folder.Length - folder.Length - 1); - int pos = FolderName.IndexOf("\\"); - if (pos >= 0) - FolderName = FolderName.Substring(0, pos); - } - break; + int pos = FolderName.IndexOf("\\", StringComparison.Ordinal); + if (pos >= 0) + FolderName = FolderName.Substring(0, pos); } + break; } FileName = Path.GetFileName(filePath); @@ -366,184 +366,176 @@ namespace VocaluxeLib.Menu.SongMenu { sr = new StreamReader(filePath, Encoding.Default, true); - string line; - - int pos = -1; - string identifier = String.Empty; - string value = String.Empty; - while (!sr.EndOfStream) { - line = sr.ReadLine(); + string line = sr.ReadLine(); if (line.Length == 0) continue; if (!line[0].ToString().Equals("#")) break; - pos = line.IndexOf(":"); + int pos = line.IndexOf(":", StringComparison.Ordinal); - if (pos > 0) + if (pos <= 0) + continue; + string identifier = line.Substring(1, pos - 1).Trim().ToUpper(); + string value = line.Substring(pos + 1, line.Length - pos - 1).Trim(); + + if (value.Length > 0) { - identifier = line.Substring(1, pos - 1).Trim().ToUpper(); - value = line.Substring(pos + 1, line.Length - pos - 1).Trim(); - - if (value.Length > 0) + switch (identifier) { - switch (identifier) - { - case "ENCODING": - Encoding = CEncoding.GetEncoding(value); - sr.Dispose(); - sr = null; - sr = new StreamReader(filePath, Encoding); - identifier = String.Empty; + case "ENCODING": + Encoding = CEncoding.GetEncoding(value); + sr.Dispose(); + sr = null; + sr = new StreamReader(filePath, Encoding); - //Scip everything till encoding - while (!sr.EndOfStream) + //Scip everything till encoding + while (!sr.EndOfStream) + { + line = sr.ReadLine(); + if (line.Length == 0) + continue; + if (!line[0].ToString().Equals("#")) + break; + + pos = line.IndexOf(":", StringComparison.Ordinal); + + if (pos > 0) { - line = sr.ReadLine(); - if (line.Length == 0) - continue; - if (!line[0].ToString().Equals("#")) + identifier = line.Substring(1, pos - 1).Trim().ToUpper(); + if (identifier == "ENCODING") break; - - pos = line.IndexOf(":"); - - if (pos > 0) - { - identifier = line.Substring(1, pos - 1).Trim().ToUpper(); - if (identifier == "ENCODING") - break; - } - } - break; - case "TITLE": - if (value.Length > 0) - { - Title = value; - headerFlags |= EHeaderFlags.Title; - } - break; - case "ARTIST": - if (value.Length > 0) - { - Artist = value; - headerFlags |= EHeaderFlags.Artist; - } - break; - case "TITLE-ON-SORTING": - if (value.Length > 0) - TitleSorting = value; - break; - case "ARTIST-ON-SORTING": - if (value.Length > 0) - ArtistSorting = value; - break; - case "P1": - if (value.Length > 0) - DuetPart1 = value; - break; - case "P2": - if (value.Length > 0) - DuetPart2 = value; - break; - case "MP3": - if (File.Exists(Path.Combine(Folder, value))) - { - MP3FileName = value; - headerFlags |= EHeaderFlags.MP3; } + } + break; + case "TITLE": + if (value.Length > 0) + { + Title = value; + headerFlags |= EHeaderFlags.Title; + } + break; + case "ARTIST": + if (value.Length > 0) + { + Artist = value; + headerFlags |= EHeaderFlags.Artist; + } + break; + case "TITLE-ON-SORTING": + if (value.Length > 0) + TitleSorting = value; + break; + case "ARTIST-ON-SORTING": + if (value.Length > 0) + ArtistSorting = value; + break; + case "P1": + if (value.Length > 0) + DuetPart1 = value; + break; + case "P2": + if (value.Length > 0) + DuetPart2 = value; + break; + case "MP3": + if (File.Exists(Path.Combine(Folder, value))) + { + MP3FileName = value; + headerFlags |= EHeaderFlags.MP3; + } + else + { + CBase.Log.LogError("Can't find audio file: " + Path.Combine(Folder, value)); + return false; + } + break; + case "BPM": + if (CHelper.TryParse(value, out BPM)) + { + BPM *= 4; + headerFlags |= EHeaderFlags.BPM; + } + break; + case "EDITION": + if (value.Length > 1) + Edition.Add(value); + break; + case "GENRE": + if (value.Length > 1) + Genre.Add(value); + break; + case "YEAR": + int num; + if (value.Length == 4 && int.TryParse(value, out num) && num != 0) + Year = value; + break; + case "LANGUAGE": + if (value.Length > 1) + Language.Add(value); + break; + case "COMMENT": + if (value.Length > 1) + _Comment.Add(value); + break; + case "GAP": + if (CHelper.TryParse(value, out Gap)) + Gap /= 1000f; + break; + case "COVER": + if (File.Exists(Path.Combine(Folder, value))) + CoverFileName = value; + break; + case "BACKGROUND": + if (File.Exists(Path.Combine(Folder, value))) + BackgroundFileName = value; + break; + case "VIDEO": + if (File.Exists(Path.Combine(Folder, value))) + VideoFileName = value; + else + CBase.Log.LogError("Can't find video file: " + Path.Combine(Folder, value)); + break; + case "VIDEOGAP": + CHelper.TryParse(value, out VideoGap); + break; + case "VIDEOASPECT": + CHelper.TryParse(value, out VideoAspect, true); + break; + case "START": + CHelper.TryParse(value, out Start); + break; + case "END": + if (CHelper.TryParse(value, out Finish)) + Finish /= 1000f; + break; + case "PREVIEWSTART": + if (CHelper.TryParse(value, out PreviewStart)) + { + if (PreviewStart < 0f) + PreviewStart = 0f; else - { - CBase.Log.LogError("Can't find audio file: " + Path.Combine(Folder, value)); - return false; - } - break; - case "BPM": - if (CHelper.TryParse(value, out BPM)) - { - BPM *= 4; - headerFlags |= EHeaderFlags.BPM; - } - break; - case "EDITION": - if (value.Length > 1) - Edition.Add(value); - break; - case "GENRE": - if (value.Length > 1) - Genre.Add(value); - break; - case "YEAR": - int num = 0; - if (value.Length == 4 && int.TryParse(value, out num) && num != 0) - Year = value; - break; - case "LANGUAGE": - if (value.Length > 1) - Language.Add(value); - break; - case "COMMENT": - if (value.Length > 1) - Comment.Add(value); - break; - case "GAP": - if (CHelper.TryParse(value, out Gap)) - Gap /= 1000f; - break; - case "COVER": - if (File.Exists(Path.Combine(Folder, value))) - CoverFileName = value; - break; - case "BACKGROUND": - if (File.Exists(Path.Combine(Folder, value))) - BackgroundFileName = value; - break; - case "VIDEO": - if (File.Exists(Path.Combine(Folder, value))) - VideoFileName = value; - else - CBase.Log.LogError("Can't find video file: " + Path.Combine(Folder, value)); - break; - case "VIDEOGAP": - CHelper.TryParse(value, out VideoGap); - break; - case "VIDEOASPECT": - CHelper.TryParse(value, out VideoAspect, true); - break; - case "START": - CHelper.TryParse(value, out Start); - break; - case "END": - if (CHelper.TryParse(value, out Finish)) - Finish /= 1000f; - break; - case "PREVIEWSTART": - if (CHelper.TryParse(value, out PreviewStart)) - { - if (PreviewStart < 0f) - PreviewStart = 0f; - else - headerFlags |= EHeaderFlags.PreviewStart; - } - break; - case "MEDLEYSTARTBEAT": - if (int.TryParse(value, out Medley.StartBeat)) - headerFlags |= EHeaderFlags.MedleyStartBeat; - break; - case "MEDLEYENDBEAT": - if (int.TryParse(value, out Medley.EndBeat)) - headerFlags |= EHeaderFlags.MedleyEndBeat; - break; - case "CALCMEDLEY": - if (value.ToUpper() == "OFF") - CalculateMedley = false; - break; - case "RELATIVE": - if (value.ToUpper() == "YES" && value.ToUpper() != "NO") - Relative = EOffOn.TR_CONFIG_ON; - break; - } + headerFlags |= EHeaderFlags.PreviewStart; + } + break; + case "MEDLEYSTARTBEAT": + if (int.TryParse(value, out Medley.StartBeat)) + headerFlags |= EHeaderFlags.MedleyStartBeat; + break; + case "MEDLEYENDBEAT": + if (int.TryParse(value, out Medley.EndBeat)) + headerFlags |= EHeaderFlags.MedleyEndBeat; + break; + case "CALCMEDLEY": + if (value.ToUpper() == "OFF") + CalculateMedley = false; + break; + case "RELATIVE": + if (value.ToUpper() == "YES" && value.ToUpper() != "NO") + Relative = EOffOn.TR_CONFIG_ON; + break; } } } //end of while @@ -589,15 +581,10 @@ namespace VocaluxeLib.Menu.SongMenu } } - if ((headerFlags & EHeaderFlags.PreviewStart) == 0 || PreviewStart == 0f) + if ((headerFlags & EHeaderFlags.PreviewStart) == 0 || Math.Abs(PreviewStart) < float.Epsilon) { //PreviewStart is not set or <=0 - if ((headerFlags & EHeaderFlags.MedleyStartBeat) != 0) - //fallback to MedleyStart - PreviewStart = CBase.Game.GetTimeFromBeats(Medley.StartBeat, BPM); - else - //else set to 0, it will be set in FindRefrainStart - PreviewStart = 0f; + PreviewStart = (headerFlags & EHeaderFlags.MedleyStartBeat) != 0 ? CBase.Game.GetTimeFromBeats(Medley.StartBeat, BPM) : 0f; } if ((headerFlags & EHeaderFlags.MedleyStartBeat) != 0 && (headerFlags & EHeaderFlags.MedleyEndBeat) != 0) @@ -648,14 +635,9 @@ namespace VocaluxeLib.Menu.SongMenu } char tempC = char.MinValue; - int param1 = 0; - int param2 = 0; - int param3 = 0; int currentPos = 0; - string paramS = String.Empty; bool isNewSentence = false; - string line = String.Empty; int player = 0; int fileLineNo = 0; @@ -669,7 +651,7 @@ namespace VocaluxeLib.Menu.SongMenu //Search for Note Beginning while (!sr.EndOfStream) { - line = sr.ReadLine(); + sr.ReadLine(); fileLineNo++; tempC = (char)sr.Peek(); @@ -684,16 +666,18 @@ namespace VocaluxeLib.Menu.SongMenu if (sr.EndOfStream) { - CBase.Log.LogError("Error loading song. Line No.: " + fileLineNo.ToString() + ". No lyrics/notes found: " + filePath); + CBase.Log.LogError("Error loading song. Line No.: " + fileLineNo + ". No lyrics/notes found: " + filePath); return false; } do { - char chr; + int param2; + int param1; switch (tempC) { case 'P': + char chr; while ((chr = (char)sr.Read()) == ' ') {} int.TryParse(chr.ToString(), out param1); @@ -705,7 +689,7 @@ namespace VocaluxeLib.Menu.SongMenu player = 2; else { - CBase.Log.LogError("Error loading song. Line No.: " + fileLineNo.ToString() + ". Wrong or missing number after \"P\": " + filePath); + CBase.Log.LogError("Error loading song. Line No.: " + fileLineNo + ". Wrong or missing number after \"P\": " + filePath); return false; } sr.ReadLine(); @@ -720,10 +704,10 @@ namespace VocaluxeLib.Menu.SongMenu param2 = CHelper.TryReadInt(sr); sr.Read(); - param3 = CHelper.TryReadInt(sr); + int param3 = CHelper.TryReadInt(sr); sr.Read(); - paramS = sr.ReadLine(); + string paramS = sr.ReadLine(); ENoteType noteType; @@ -751,7 +735,7 @@ namespace VocaluxeLib.Menu.SongMenu case '-': if (isNewSentence) { - CBase.Log.LogError("Error loading song. Line No.: " + fileLineNo.ToString() + ". Double sentence break: " + filePath); + CBase.Log.LogError("Error loading song. Line No.: " + fileLineNo + ". Double sentence break: " + filePath); return false; } sr.Read(); @@ -779,10 +763,10 @@ namespace VocaluxeLib.Menu.SongMenu sr.ReadLine(); break; default: - CBase.Log.LogError("Error loading song. Line No.: " + fileLineNo.ToString() + ". Unexpected or missing character (" + tempC + "): " + filePath); + CBase.Log.LogError("Error loading song. Line No.: " + fileLineNo + ". Unexpected or missing character (" + tempC + "): " + filePath); return false; } - int c = 0; + int c; do { c = sr.Read(); @@ -796,7 +780,7 @@ namespace VocaluxeLib.Menu.SongMenu } catch (Exception e) { - CBase.Log.LogError("Error loading song. Line No.: " + fileLineNo.ToString() + ". An unhandled exception occured (" + e.Message + "): " + filePath); + CBase.Log.LogError("Error loading song. Line No.: " + fileLineNo + ". An unhandled exception occured (" + e.Message + "): " + filePath); if (sr != null) sr.Dispose(); return false; @@ -919,29 +903,26 @@ namespace VocaluxeLib.Menu.SongMenu { for (int j = i + 1; j < lines.LineCount; j++) { - if (sentences[i] == sentences[j] && sentences[i].Length > 0) + if (sentences[i] != sentences[j] || sentences[i] == "") + continue; + SSeries tempSeries = new SSeries {Start = i, End = i}; + + int max; + if (j + j - i > lines.LineCount) + max = lines.LineCount - 1 - j; + else + max = j - i - 1; + + for (int k = 1; k <= max; k++) { - SSeries tempSeries = new SSeries(); - tempSeries.Start = i; - tempSeries.End = i; - - int max = 0; - if (j + j - i - 1 > lines.LineCount - 1) - max = lines.LineCount - 1 - j; + if (sentences[i + k] == sentences[j + k] && sentences[i + k]!="") + tempSeries.End = i + k; else - max = j - i - 1; - - for (int k = 1; k <= max; k++) - { - if (sentences[i + k] == sentences[j + k] && sentences[i + k].Length > 0) - tempSeries.End = i + k; - else - break; - } - - tempSeries.Length = tempSeries.End - tempSeries.Start + 1; - series.Add(tempSeries); + break; } + + tempSeries.Length = tempSeries.End - tempSeries.Start + 1; + series.Add(tempSeries); } } return series; @@ -981,12 +962,10 @@ namespace VocaluxeLib.Menu.SongMenu Medley.StartBeat = lines.Line[series[longest].Start].FirstNoteBeat; Medley.EndBeat = lines.Line[series[longest].End].LastNoteBeat; - bool foundEnd = false; + bool foundEnd = CBase.Game.GetTimeFromBeats(Medley.StartBeat, BPM) + CBase.Settings.GetMedleyMinDuration() > + CBase.Game.GetTimeFromBeats(Medley.EndBeat, BPM); // set end if duration > MedleyMinDuration - if (CBase.Game.GetTimeFromBeats(Medley.StartBeat, BPM) + CBase.Settings.GetMedleyMinDuration() > - CBase.Game.GetTimeFromBeats(Medley.EndBeat, BPM)) - foundEnd = true; if (!foundEnd) { diff --git a/VocaluxeLib/Menu/SongMenu/CSongMenuDreidel.cs b/VocaluxeLib/Menu/SongMenu/CSongMenuDreidel.cs index 532c4043..10d9c0e7 100644 --- a/VocaluxeLib/Menu/SongMenu/CSongMenuDreidel.cs +++ b/VocaluxeLib/Menu/SongMenu/CSongMenuDreidel.cs @@ -44,6 +44,7 @@ namespace VocaluxeLib.Menu.SongMenu public CSongMenuDreidel(int partyModeID) : base(partyModeID) {} +// ReSharper disable RedundantOverridenMember public override void Init() { base.Init(); @@ -58,5 +59,6 @@ namespace VocaluxeLib.Menu.SongMenu _SongLength = _Theme.songMenuDreidel.TextSongLength; **/ } +// ReSharper restore RedundantOverridenMember } } \ No newline at end of file diff --git a/VocaluxeLib/Menu/SongMenu/CSongMenuFramework.cs b/VocaluxeLib/Menu/SongMenu/CSongMenuFramework.cs index 65822e8a..81fe451c 100644 --- a/VocaluxeLib/Menu/SongMenu/CSongMenuFramework.cs +++ b/VocaluxeLib/Menu/SongMenu/CSongMenuFramework.cs @@ -112,19 +112,19 @@ namespace VocaluxeLib.Menu.SongMenu private int _Actsongstream = -1; protected STexture _Vidtex = new STexture(-1); - protected bool _Initialized = false; - protected int _LastKnownNumSongs = 0; + protected bool _Initialized; + protected int _LastKnownNumSongs; protected int _LastKnownCategory = -1; - protected SRectF _Rect = new SRectF(); - protected SColorF _Color = new SColorF(); + protected SRectF _Rect; + protected SColorF _Color; private int _SelectedInternal = -1; private int _SelectedPending = -1; protected long _PendingTime = 500L; private int _LockedInternal = -1; - protected bool _Active = false; + protected bool _Active; protected float _MaxVolume = 100f; @@ -269,14 +269,14 @@ namespace VocaluxeLib.Menu.SongMenu string item = xmlPath + "/" + elementName; _ThemeLoaded = true; - _ThemeLoaded &= xmlReader.GetValue(item + "/CoverBackground", ref _Theme.CoverBackgroundName, String.Empty); - _ThemeLoaded &= xmlReader.GetValue(item + "/CoverBigBackground", ref _Theme.CoverBigBackgroundName, String.Empty); - _ThemeLoaded &= xmlReader.GetValue(item + "/DuetIcon", ref _Theme.DuetIconName, String.Empty); - _ThemeLoaded &= xmlReader.GetValue(item + "/VideoIcon", ref _Theme.VideoIconName, String.Empty); - _ThemeLoaded &= xmlReader.GetValue(item + "/MedleyCalcIcon", ref _Theme.MedleyCalcIcon, String.Empty); - _ThemeLoaded &= xmlReader.GetValue(item + "/MedleyTagIcon", ref _Theme.MedleyTagIcon, String.Empty); + _ThemeLoaded &= xmlReader.GetValue(item + "/CoverBackground", out _Theme.CoverBackgroundName, String.Empty); + _ThemeLoaded &= xmlReader.GetValue(item + "/CoverBigBackground", out _Theme.CoverBigBackgroundName, String.Empty); + _ThemeLoaded &= xmlReader.GetValue(item + "/DuetIcon", out _Theme.DuetIconName, String.Empty); + _ThemeLoaded &= xmlReader.GetValue(item + "/VideoIcon", out _Theme.VideoIconName, String.Empty); + _ThemeLoaded &= xmlReader.GetValue(item + "/MedleyCalcIcon", out _Theme.MedleyCalcIcon, String.Empty); + _ThemeLoaded &= xmlReader.GetValue(item + "/MedleyTagIcon", out _Theme.MedleyTagIcon, String.Empty); - if (xmlReader.GetValue(item + "/Color", ref _Theme.ColorName, String.Empty)) + if (xmlReader.GetValue(item + "/Color", out _Theme.ColorName, String.Empty)) _ThemeLoaded &= CBase.Theme.GetColor(_Theme.ColorName, skinIndex, out _Color); else { @@ -453,8 +453,8 @@ namespace VocaluxeLib.Menu.SongMenu float time = CBase.Sound.GetPosition(_Actsongstream); - float vtime = 0f; - CBase.Video.GetFrame(_Video, ref _Vidtex, time, ref vtime); + float vtime; + CBase.Video.GetFrame(_Video, ref _Vidtex, time, out vtime); if (_VideoFadeTimer.ElapsedMilliseconds <= 3000L) _Vidtex.Color.A = _VideoFadeTimer.ElapsedMilliseconds / 3000f; else @@ -489,14 +489,10 @@ namespace VocaluxeLib.Menu.SongMenu public virtual void HandleInput(ref SKeyEvent keyEvent, SScreenSongOptions songOptions) { - if (!_Initialized) - return; } public virtual void HandleMouse(ref SMouseEvent mouseEvent, SScreenSongOptions songOptions) { - if (!_Initialized) - return; } public virtual void Draw() @@ -543,20 +539,14 @@ namespace VocaluxeLib.Menu.SongMenu public virtual void SetSelectedSong(int visibleSongNr) { - if (!_Initialized) - return; } public virtual void SetSelectedCategory(int categoryNr) { - if (!_Initialized) - return; } public virtual void SetSmallView(bool smallView) { - if (!_Initialized) - return; } public virtual bool IsSmallView() diff --git a/VocaluxeLib/Menu/SongMenu/CSongMenuTileBoard.cs b/VocaluxeLib/Menu/SongMenu/CSongMenuTileBoard.cs index 36307bef..6e38429c 100644 --- a/VocaluxeLib/Menu/SongMenu/CSongMenuTileBoard.cs +++ b/VocaluxeLib/Menu/SongMenu/CSongMenuTileBoard.cs @@ -463,7 +463,7 @@ namespace VocaluxeLib.Menu.SongMenu _CoverBig.Draw(1f, EAspect.Crop); RectangleF bounds = new RectangleF(_CoverBig.Rect.X, _CoverBig.Rect.Y, _CoverBig.Rect.W, _CoverBig.Rect.H); RectangleF rect = new RectangleF(0f, 0f, _Vidtex.Width, _Vidtex.Height); - CHelper.SetRect(bounds, ref rect, rect.Width / rect.Height, EAspect.Crop); + CHelper.SetRect(bounds, out rect, rect.Width / rect.Height, EAspect.Crop); SRectF vidRect = new SRectF(rect.X, rect.Y, rect.Width, rect.Height, _CoverBig.Rect.Z); SRectF vidRectBounds = new SRectF(bounds.X, bounds.Y, bounds.Width, bounds.Height, 0f); diff --git a/VocaluxeLib/PartyModes/CScreenPartyDummy.cs b/VocaluxeLib/PartyModes/CScreenPartyDummy.cs index 555e97e8..e27fa1ce 100644 --- a/VocaluxeLib/PartyModes/CScreenPartyDummy.cs +++ b/VocaluxeLib/PartyModes/CScreenPartyDummy.cs @@ -42,7 +42,7 @@ namespace VocaluxeLib.PartyModes _Warning.Color = new SColorF(1f, 0f, 0f, 1f); _Warning.SelColor = new SColorF(1f, 0f, 0f, 1f); _Warning.Text = "SOMETHING WENT WRONG!"; - AddText(_Warning); + _AddText(_Warning); } public override void ReloadTheme(string xmlPath) {} @@ -75,7 +75,7 @@ namespace VocaluxeLib.PartyModes { base.HandleMouse(mouseEvent); - if (mouseEvent.LB && IsMouseOver(mouseEvent)) {} + if (mouseEvent.LB && _IsMouseOver(mouseEvent)) {} if (mouseEvent.RB) _FadeTo(EScreens.ScreenParty); From 1540be9120793c59ba376dc3fd12af1c3839ce98 Mon Sep 17 00:00:00 2001 From: Flamefire Date: Tue, 23 Apr 2013 14:22:42 +0200 Subject: [PATCH 07/27] More refactoring and small fixes --- .../PartyModeChallenge/CChallengeRounds.cs | 54 +++------- .../PartyModeChallenge/CPartyModeChallenge.cs | 37 +++---- .../CPartyScreenChallengeConfig.cs | 2 + .../CPartyScreenChallengeMain.cs | 10 +- .../CPartyScreenChallengeNames.cs | 8 +- .../CPartyModeChallengeMedley.cs | 5 +- .../CPartyScreenChallengeMedleyConfig.cs | 2 + .../CPartyScreenChallengeMedleyMain.cs | 8 +- .../CPartyScreenChallengeMedleyNames.cs | 2 + .../CPartyScreenTicTacToeConfig.cs | 48 +++------ .../CPartyScreenTicTacToeMain.cs | 11 +-- .../CPartyScreenTicTacToeNames.cs | 2 + ...gs.DotSettings => Vocaluxe.sln.DotSettings | 0 Vocaluxe/Base/CInput.cs | 8 +- Vocaluxe/Base/CLog.cs | 28 +++--- Vocaluxe/Base/CMain.cs | 5 +- Vocaluxe/Base/CSettings.cs | 2 + Vocaluxe/Base/CSongSorter.cs | 5 + Vocaluxe/CSplashScreen.cs | 12 +++ Vocaluxe/Lib/Input/IInput.cs | 6 +- Vocaluxe/Lib/Input/WiiMote/CWiiMote.cs | 31 ++---- Vocaluxe/Lib/Sound/COpenALPlay.cs | 14 +-- Vocaluxe/Lib/Sound/COpenALRecord.cs | 23 ----- Vocaluxe/Lib/Sound/CPortAudioPlay.cs | 6 +- Vocaluxe/Lib/Sound/Decoder/CAudioDecoder.cs | 60 ------------ .../Lib/Sound/Decoder/CAudioDecoderFFmpeg.cs | 52 ++++------ Vocaluxe/Lib/Sound/Decoder/IAudioDecoder.cs | 3 +- Vocaluxe/Lib/Sound/IPlayback.cs | 2 - Vocaluxe/Lib/Sound/Portaudio/PortAudioASIO.cs | 98 ------------------- Vocaluxe/Lib/Video/Acinerella/CAcinerella.cs | 48 +++++---- Vocaluxe/Lib/Video/CVideoDecoderFFmpeg.cs | 34 ++----- .../Video/Gstreamer/CGstreamerVideoWrapper.cs | 2 + Vocaluxe/Lib/Video/IVideoDecoder.cs | 2 - Vocaluxe/Lib/Webcam/CAForgeNet.cs | 20 ++-- Vocaluxe/Program.cs | 1 + Vocaluxe/Vocaluxe.csproj | 3 - VocaluxeLib/Menu/CBasic.cs | 4 +- VocaluxeLib/Menu/CEqualizer.cs | 2 +- VocaluxeLib/Menu/CMenu.cs | 2 +- VocaluxeLib/Menu/COrderedDictionaryLite.cs | 7 -- VocaluxeLib/Menu/CScreenSetting.cs | 10 +- VocaluxeLib/Menu/IMenu.cs | 2 - VocaluxeLib/Menu/SingNotes/CSingNotes.cs | 2 +- VocaluxeLib/Menu/SingNotes/ISingNotes.cs | 41 -------- .../Menu/SongMenu/CSongMenuFramework.cs | 6 -- VocaluxeLib/VocaluxeLib.csproj | 1 - 46 files changed, 205 insertions(+), 526 deletions(-) rename Re#Settings.DotSettings => Vocaluxe.sln.DotSettings (100%) delete mode 100644 Vocaluxe/Lib/Sound/COpenALRecord.cs delete mode 100644 Vocaluxe/Lib/Sound/Decoder/CAudioDecoder.cs delete mode 100644 Vocaluxe/Lib/Sound/Portaudio/PortAudioASIO.cs delete mode 100644 VocaluxeLib/Menu/SingNotes/ISingNotes.cs diff --git a/PartyModes/PartyModeChallenge/CChallengeRounds.cs b/PartyModes/PartyModeChallenge/CChallengeRounds.cs index bc99aa57..1ad4fe25 100644 --- a/PartyModes/PartyModeChallenge/CChallengeRounds.cs +++ b/PartyModes/PartyModeChallenge/CChallengeRounds.cs @@ -19,6 +19,7 @@ using System; using System.Collections.Generic; +using System.Linq; namespace VocaluxeLib.PartyModes.Challenge { @@ -27,7 +28,7 @@ namespace VocaluxeLib.PartyModes.Challenge private readonly Random _Rand; private readonly int _NumPlayer; - public List Rounds; + public readonly List Rounds; public CChallengeRounds(int numRounds, int numPlayer, int numPlayerAtOnce) { @@ -60,7 +61,7 @@ namespace VocaluxeLib.PartyModes.Challenge Rounds.Add(combinations.GetNextCombination(_GetPlayerDemand(i))); } - private List _GetPlayerDemand(int roundIndex) + private IEnumerable _GetPlayerDemand(int roundIndex) { List numPlayed = new List(_NumPlayer); for (int i = 0; i < _NumPlayer; i++) @@ -72,12 +73,7 @@ namespace VocaluxeLib.PartyModes.Challenge numPlayed[playerIndex]++; } - int max = 0; - foreach (int p in numPlayed) - { - if (p > max) - max = p; - } + int max = numPlayed.Max(); int num = Rounds[0].Player.Count; List result = new List(); @@ -150,13 +146,11 @@ namespace VocaluxeLib.PartyModes.Challenge _Rand = rand; } - public CCombination GetNextCombination(List playerNrDemand) + public CCombination GetNextCombination(IEnumerable playerNrDemand) { if (_Combs.Count == 0) _Create(); - CCombination combs = new CCombination(); - if (_NumPlayer == _NumMics) return _Combs[0]; @@ -164,28 +158,19 @@ namespace VocaluxeLib.PartyModes.Challenge List combsFiltered = new List(); if (playerNrDemand != null) { - for (int i = 0; i < _Combs.Count; i++) - { - if (_Combs[i].IsAvailableAll(playerNrDemand)) - combsFiltered.Add(_Combs[i]); - } + combsFiltered.AddRange(_Combs.Where(t => t.IsAvailableAll(playerNrDemand))); } //1st fallback if (playerNrDemand != null && combsFiltered.Count == 0) { - for (int i = 0; i < _Combs.Count; i++) - { - if (_Combs[i].IsAvailableSomeone(playerNrDemand)) - combsFiltered.Add(_Combs[i]); - } + combsFiltered.AddRange(_Combs.Where(t => t.IsAvailableSomeone(playerNrDemand))); } //2nd fallback if (combsFiltered.Count == 0) { - for (int i = 0; i < _Combs.Count; i++) - combsFiltered.Add(_Combs[i]); + combsFiltered.AddRange(_Combs); } int num = combsFiltered.Count; @@ -222,7 +207,7 @@ namespace VocaluxeLib.PartyModes.Challenge public class CCombination { - public List Player; + public readonly List Player; public CCombination() { @@ -231,28 +216,17 @@ namespace VocaluxeLib.PartyModes.Challenge public bool IsAvailable(int playerIndex) { - foreach (int p in Player) - { - if (p == playerIndex) - return true; - } - return false; + return Player.Any(p => p == playerIndex); } - public bool IsAvailableAll(List playerIndices) + public bool IsAvailableAll(IEnumerable playerIndices) { - bool result = true; - foreach (int p in playerIndices) - result &= IsAvailable(p); - return result; + return playerIndices.All(IsAvailable); } - public bool IsAvailableSomeone(List playerIndices) + public bool IsAvailableSomeone(IEnumerable playerIndices) { - bool result = false; - foreach (int p in playerIndices) - result |= IsAvailable(p); - return result; + return playerIndices.Any(IsAvailable); } } } \ No newline at end of file diff --git a/PartyModes/PartyModeChallenge/CPartyModeChallenge.cs b/PartyModes/PartyModeChallenge/CPartyModeChallenge.cs index 722713e6..b3e860af 100644 --- a/PartyModes/PartyModeChallenge/CPartyModeChallenge.cs +++ b/PartyModes/PartyModeChallenge/CPartyModeChallenge.cs @@ -58,17 +58,15 @@ namespace VocaluxeLib.PartyModes.Challenge public int Position; public int PlayerID; public int NumPlayed; - public int NumRounds; public int NumWon; public int NumSingPoints; public int NumGamePoints; public int CompareTo(object obj) { - if (obj is CResultTableRow) + CResultTableRow row = obj as CResultTableRow; + if (row != null) { - CResultTableRow row = (CResultTableRow)obj; - int res = row.NumGamePoints.CompareTo(NumGamePoints); if (res == 0) { @@ -101,8 +99,7 @@ namespace VocaluxeLib.PartyModes.Challenge public struct SFromScreenNames { - public bool FadeToConfig; - public bool FadeToMain; + public bool FadeBack; public List ProfileIDs; } @@ -236,7 +233,7 @@ namespace VocaluxeLib.PartyModes.Challenge try { dataFrom = (SDataFromScreen)data; - if (dataFrom.ScreenNames.FadeToConfig) + if (dataFrom.ScreenNames.FadeBack) _Stage = EStage.NotStarted; else { @@ -590,13 +587,7 @@ namespace VocaluxeLib.PartyModes.Challenge { for (int i = 0; i < _GameData.NumPlayer; i++) { - CResultTableRow row = new CResultTableRow(); - row.PlayerID = _GameData.ProfileIDs[i]; - row.NumPlayed = 0; - row.NumRounds = 0; - row.NumWon = 0; - row.NumSingPoints = 0; - row.NumGamePoints = 0; + CResultTableRow row = new CResultTableRow {PlayerID = _GameData.ProfileIDs[i], NumPlayed = 0, NumWon = 0, NumSingPoints = 0, NumGamePoints = 0}; _GameData.ResultTable.Add(row); } @@ -633,18 +624,16 @@ namespace VocaluxeLib.PartyModes.Challenge } } - if (index != -1) - { - CResultTableRow row = _GameData.ResultTable[index]; + if (index == -1) + continue; + CResultTableRow row = _GameData.ResultTable[index]; - row.NumPlayed++; - row.NumWon += points[i].Won; - row.NumRounds += 1; - row.NumSingPoints += points[i].SingPoints; - row.NumGamePoints += points[i].GamePoints; + row.NumPlayed++; + row.NumWon += points[i].Won; + row.NumSingPoints += points[i].SingPoints; + row.NumGamePoints += points[i].GamePoints; - _GameData.ResultTable[index] = row; - } + _GameData.ResultTable[index] = row; } } diff --git a/PartyModes/PartyModeChallenge/CPartyScreenChallengeConfig.cs b/PartyModes/PartyModeChallenge/CPartyScreenChallengeConfig.cs index 27e36fa9..df3678be 100644 --- a/PartyModes/PartyModeChallenge/CPartyScreenChallengeConfig.cs +++ b/PartyModes/PartyModeChallenge/CPartyScreenChallengeConfig.cs @@ -23,7 +23,9 @@ using VocaluxeLib.Menu; namespace VocaluxeLib.PartyModes.Challenge { +// ReSharper disable UnusedMember.Global public class CPartyScreenChallengeConfig : CMenuParty +// ReSharper restore UnusedMember.Global { // Version number for theme files. Increment it, if you've changed something on the theme files! protected override int _ScreenVersion diff --git a/PartyModes/PartyModeChallenge/CPartyScreenChallengeMain.cs b/PartyModes/PartyModeChallenge/CPartyScreenChallengeMain.cs index aacf1a83..43e6443c 100644 --- a/PartyModes/PartyModeChallenge/CPartyScreenChallengeMain.cs +++ b/PartyModes/PartyModeChallenge/CPartyScreenChallengeMain.cs @@ -41,7 +41,9 @@ namespace VocaluxeLib.PartyModes.Challenge public List TextScores; } +// ReSharper disable UnusedMember.Global public class CPartyScreenChallengeMain : CMenuParty +// ReSharper restore UnusedMember.Global { // Version number for theme files. Increment it, if you've changed something on the theme files! protected override int _ScreenVersion @@ -350,9 +352,9 @@ namespace VocaluxeLib.PartyModes.Challenge private void _UpdateNextPlayerPositions() { - float x = CBase.Settings.GetRenderW() / 2 - ((_GameState.NumPlayerAtOnce * _Statics[_StaticNextPlayer].Rect.W) + ((_GameState.NumPlayerAtOnce - 1) * 15)) / 2; - float staticY = 590; - float textY = 550; + float x = (float) CBase.Settings.GetRenderW() / 2 - ((_GameState.NumPlayerAtOnce * _Statics[_StaticNextPlayer].Rect.W) + ((_GameState.NumPlayerAtOnce - 1) * 15)) / 2; + const float staticY = 590; + const float textY = 550; for (int i = 0; i < _GameState.NumPlayerAtOnce; i++) { //static @@ -606,7 +608,7 @@ namespace VocaluxeLib.PartyModes.Challenge row.Pos.Text = _GameState.ResultTable[i + _PlayerTableOffset].Position + "."; row.Name.Text = profiles[_GameState.ResultTable[i + _PlayerTableOffset].PlayerID].PlayerName; - row.Rounds.Text = _GameState.ResultTable[i + _PlayerTableOffset].NumRounds.ToString(); + row.Rounds.Text = _GameState.ResultTable[i + _PlayerTableOffset].NumPlayed.ToString(); row.Won.Text = _GameState.ResultTable[i + _PlayerTableOffset].NumWon.ToString(); row.SingPoints.Text = _GameState.ResultTable[i + _PlayerTableOffset].NumSingPoints.ToString(); row.GamePoints.Text = _GameState.ResultTable[i + _PlayerTableOffset].NumGamePoints.ToString(); diff --git a/PartyModes/PartyModeChallenge/CPartyScreenChallengeNames.cs b/PartyModes/PartyModeChallenge/CPartyScreenChallengeNames.cs index 9da4b884..eadf2a62 100644 --- a/PartyModes/PartyModeChallenge/CPartyScreenChallengeNames.cs +++ b/PartyModes/PartyModeChallenge/CPartyScreenChallengeNames.cs @@ -89,7 +89,7 @@ namespace VocaluxeLib.PartyModes.Challenge _ThemeButtons = new string[] {_ButtonBack, _ButtonNext, _ButtonPlayerDestination, _ButtonPlayerChoose}; _Data = new SDataFromScreen(); - SFromScreenNames names = new SFromScreenNames {FadeToConfig = false, FadeToMain = false, ProfileIDs = new List()}; + SFromScreenNames names = new SFromScreenNames {FadeBack = false, ProfileIDs = new List()}; _Data.ScreenNames = names; } @@ -485,15 +485,13 @@ namespace VocaluxeLib.PartyModes.Challenge private void _Back() { - _Data.ScreenNames.FadeToConfig = true; - _Data.ScreenNames.FadeToMain = false; + _Data.ScreenNames.FadeBack = true; _PartyMode.DataFromScreen(ThemeName, _Data); } private void _Next() { - _Data.ScreenNames.FadeToConfig = false; - _Data.ScreenNames.FadeToMain = true; + _Data.ScreenNames.FadeBack = false; _PartyMode.DataFromScreen(ThemeName, _Data); } } diff --git a/PartyModes/PartyModeChallengeMedley/CPartyModeChallengeMedley.cs b/PartyModes/PartyModeChallengeMedley/CPartyModeChallengeMedley.cs index eee61868..e82ac72b 100644 --- a/PartyModes/PartyModeChallengeMedley/CPartyModeChallengeMedley.cs +++ b/PartyModes/PartyModeChallengeMedley/CPartyModeChallengeMedley.cs @@ -66,10 +66,9 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley public int CompareTo(object obj) { - if (obj is CResultTableRow) + CResultTableRow row = obj as CResultTableRow; + if (row != null) { - CResultTableRow row = (CResultTableRow)obj; - int res = row.NumGamePoints.CompareTo(NumGamePoints); if (res == 0) { diff --git a/PartyModes/PartyModeChallengeMedley/CPartyScreenChallengeMedleyConfig.cs b/PartyModes/PartyModeChallengeMedley/CPartyScreenChallengeMedleyConfig.cs index 956954db..658c93fb 100644 --- a/PartyModes/PartyModeChallengeMedley/CPartyScreenChallengeMedleyConfig.cs +++ b/PartyModes/PartyModeChallengeMedley/CPartyScreenChallengeMedleyConfig.cs @@ -23,7 +23,9 @@ using VocaluxeLib.Menu; namespace VocaluxeLib.PartyModes.ChallengeMedley { +// ReSharper disable UnusedMember.Global public class CPartyScreenChallengeMedleyConfig : CMenuParty +// ReSharper restore UnusedMember.Global { // Version number for theme files. Increment it, if you've changed something on the theme files! protected override int _ScreenVersion diff --git a/PartyModes/PartyModeChallengeMedley/CPartyScreenChallengeMedleyMain.cs b/PartyModes/PartyModeChallengeMedley/CPartyScreenChallengeMedleyMain.cs index d4729c2f..1150dff4 100644 --- a/PartyModes/PartyModeChallengeMedley/CPartyScreenChallengeMedleyMain.cs +++ b/PartyModes/PartyModeChallengeMedley/CPartyScreenChallengeMedleyMain.cs @@ -41,7 +41,9 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley public List TextScores; } +// ReSharper disable UnusedMember.Global public class CPartyScreenChallengeMedleyMain : CMenuParty +// ReSharper restore UnusedMember.Global { // Version number for theme files. Increment it, if you've changed something on the theme files! protected override int _ScreenVersion @@ -350,9 +352,9 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley private void _UpdateNextPlayerPositions() { - float x = CBase.Settings.GetRenderW() / 2 - ((_GameState.NumPlayerAtOnce * _Statics[_StaticNextPlayer].Rect.W) + ((_GameState.NumPlayerAtOnce - 1) * 15)) / 2; - float staticY = 590; - float textY = 550; + float x = (float) CBase.Settings.GetRenderW() / 2 - ((_GameState.NumPlayerAtOnce * _Statics[_StaticNextPlayer].Rect.W) + ((_GameState.NumPlayerAtOnce - 1) * 15)) / 2; + const float staticY = 590; + const float textY = 550; for (int i = 0; i < _GameState.NumPlayerAtOnce; i++) { //static diff --git a/PartyModes/PartyModeChallengeMedley/CPartyScreenChallengeMedleyNames.cs b/PartyModes/PartyModeChallengeMedley/CPartyScreenChallengeMedleyNames.cs index a7a259f3..cfbf84c6 100644 --- a/PartyModes/PartyModeChallengeMedley/CPartyScreenChallengeMedleyNames.cs +++ b/PartyModes/PartyModeChallengeMedley/CPartyScreenChallengeMedleyNames.cs @@ -24,7 +24,9 @@ using VocaluxeLib.Menu; namespace VocaluxeLib.PartyModes.ChallengeMedley { +// ReSharper disable UnusedMember.Global public class CPartyScreenChallengeMedleyNames : CMenuParty +// ReSharper restore UnusedMember.Global { // Version number for theme files. Increment it, if you've changed something on the theme files! protected override int _ScreenVersion diff --git a/PartyModes/PartyModeTicTacToe/CPartyScreenTicTacToeConfig.cs b/PartyModes/PartyModeTicTacToe/CPartyScreenTicTacToeConfig.cs index e8a4b41a..516efd76 100644 --- a/PartyModes/PartyModeTicTacToe/CPartyScreenTicTacToeConfig.cs +++ b/PartyModes/PartyModeTicTacToe/CPartyScreenTicTacToeConfig.cs @@ -18,12 +18,15 @@ #endregion using System; +using System.Linq; using System.Windows.Forms; using VocaluxeLib.Menu; namespace VocaluxeLib.PartyModes.TicTacToe { +// ReSharper disable UnusedMember.Global public class CPartyScreenTicTacToeConfig : CMenuParty +// ReSharper restore UnusedMember.Global { // Version number for theme files. Increment it, if you've changed something on the theme files! protected override int _ScreenVersion @@ -57,14 +60,16 @@ namespace VocaluxeLib.PartyModes.TicTacToe _ThemeButtons = new string[] {_ButtonNext, _ButtonBack}; _Data = new SDataFromScreen(); - SFromScreenConfig config = new SFromScreenConfig(); - config.PlaylistID = 0; - config.NumFields = 9; - config.NumPlayerTeam1 = 2; - config.NumPlayerTeam2 = 2; - config.GameMode = EPartyGameMode.TR_GAMEMODE_NORMAL; - config.CategoryID = 0; - config.SongSource = ESongSource.TR_ALLSONGS; + SFromScreenConfig config = new SFromScreenConfig + { + PlaylistID = 0, + NumFields = 9, + NumPlayerTeam1 = 2, + NumPlayerTeam2 = 2, + GameMode = EPartyGameMode.TR_GAMEMODE_NORMAL, + CategoryID = 0, + SongSource = ESongSource.TR_ALLSONGS + }; _Data.ScreenConfig = config; } @@ -263,14 +268,7 @@ namespace VocaluxeLib.PartyModes.TicTacToe for (int i = 0; i < CBase.Playlist.GetPlaylistSongCount(_Data.ScreenConfig.PlaylistID); i++) { int id = CBase.Playlist.GetPlaylistSong(_Data.ScreenConfig.PlaylistID, i).SongID; - foreach (EGameMode mode in CBase.Songs.GetSongByID(id).AvailableGameModes) - { - if (mode == gm) - { - _ConfigOk = true; - break; - } - } + _ConfigOk = CBase.Songs.GetSongByID(id).AvailableGameModes.Any(mode => mode == gm); if (_ConfigOk) break; } @@ -291,14 +289,7 @@ namespace VocaluxeLib.PartyModes.TicTacToe _ConfigOk = false; for (int i = 0; i < CBase.Songs.NumSongsInCategory(_Data.ScreenConfig.CategoryID); i++) { - foreach (EGameMode mode in CBase.Songs.GetVisibleSong(i).AvailableGameModes) - { - if (mode == gm) - { - _ConfigOk = true; - break; - } - } + _ConfigOk=CBase.Songs.GetVisibleSong(i).AvailableGameModes.Any(mode => mode == gm); if (_ConfigOk) break; } @@ -316,14 +307,7 @@ namespace VocaluxeLib.PartyModes.TicTacToe { for (int i = 0; i < CBase.Songs.GetNumSongs(); i++) { - foreach (EGameMode mode in CBase.Songs.GetSongByID(i).AvailableGameModes) - { - if (mode == gm) - { - _ConfigOk = true; - break; - } - } + _ConfigOk = CBase.Songs.GetSongByID(i).AvailableGameModes.Any(mode => mode == gm); if (_ConfigOk) break; } diff --git a/PartyModes/PartyModeTicTacToe/CPartyScreenTicTacToeMain.cs b/PartyModes/PartyModeTicTacToe/CPartyScreenTicTacToeMain.cs index fbd05c8d..886a9779 100644 --- a/PartyModes/PartyModeTicTacToe/CPartyScreenTicTacToeMain.cs +++ b/PartyModes/PartyModeTicTacToe/CPartyScreenTicTacToeMain.cs @@ -400,13 +400,10 @@ namespace VocaluxeLib.PartyModes.TicTacToe private void _UpdateFields() { int numOneRow = (int)Math.Sqrt(_GameData.NumFields); - float fieldSizeY = (CBase.Settings.GetRenderH() - 150 - numOneRow * _FieldSpace) / numOneRow; - float fieldSizeX = (CBase.Settings.GetRenderW() - 300 - numOneRow * _FieldSpace) / numOneRow; - if (fieldSizeX < fieldSizeY) - _FieldSize = fieldSizeX; - else - _FieldSize = fieldSizeY; - _FieldFirstX = CBase.Settings.GetRenderW() / 2 - (numOneRow * _FieldSize + (numOneRow - 1) * _FieldSpace) / 2; + float fieldSizeY = ((float)CBase.Settings.GetRenderH() - 150 - numOneRow * _FieldSpace) / numOneRow; + float fieldSizeX = ((float)CBase.Settings.GetRenderW() - 300 - numOneRow * _FieldSpace) / numOneRow; + _FieldSize = Math.Min(fieldSizeX, fieldSizeY); + _FieldFirstX = (float)CBase.Settings.GetRenderW() / 2 - (numOneRow * _FieldSize + (numOneRow - 1) * _FieldSpace) / 2; _FieldFirstY = 140 + (CBase.Settings.GetRenderH() - 140) / 2 - (numOneRow * _FieldSize + numOneRow * _FieldSpace) / 2; int row = 0; int column = 0; diff --git a/PartyModes/PartyModeTicTacToe/CPartyScreenTicTacToeNames.cs b/PartyModes/PartyModeTicTacToe/CPartyScreenTicTacToeNames.cs index 6d5aae88..6ef12c28 100644 --- a/PartyModes/PartyModeTicTacToe/CPartyScreenTicTacToeNames.cs +++ b/PartyModes/PartyModeTicTacToe/CPartyScreenTicTacToeNames.cs @@ -24,7 +24,9 @@ using VocaluxeLib.Menu; namespace VocaluxeLib.PartyModes.TicTacToe { +// ReSharper disable UnusedMember.Global public class CPartyScreenTicTacToeNames : CMenuParty +// ReSharper restore UnusedMember.Global { // Version number for theme files. Increment it, if you've changed something on the theme files! protected override int _ScreenVersion diff --git a/Re#Settings.DotSettings b/Vocaluxe.sln.DotSettings similarity index 100% rename from Re#Settings.DotSettings rename to Vocaluxe.sln.DotSettings diff --git a/Vocaluxe/Base/CInput.cs b/Vocaluxe/Base/CInput.cs index 606b89d5..84632970 100644 --- a/Vocaluxe/Base/CInput.cs +++ b/Vocaluxe/Base/CInput.cs @@ -40,14 +40,14 @@ namespace Vocaluxe.Base _Input = null; } - public static bool Connect() + public static void Connect() { - return _Input.Connect(); + _Input.Connect(); } - public static bool Disconnect() + public static void Disconnect() { - return _Input.Disconnect(); + _Input.Disconnect(); } public static bool IsConnected() diff --git a/Vocaluxe/Base/CLog.cs b/Vocaluxe/Base/CLog.cs index fbb08230..b97b8d46 100644 --- a/Vocaluxe/Base/CLog.cs +++ b/Vocaluxe/Base/CLog.cs @@ -36,6 +36,15 @@ namespace Vocaluxe.Base _LogFileName = fileName; } + private void _Open() + { + _LogFile = new StreamWriter(Path.Combine(Environment.CurrentDirectory, _LogFileName), false, Encoding.UTF8); + + _LogFile.WriteLine(_LogName + " " + CSettings.GetFullVersionText() + " " + DateTime.Now); + _LogFile.WriteLine("----------------------------------------"); + _LogFile.WriteLine(); + } + public void Close() { if (_LogFile == null) @@ -53,21 +62,10 @@ namespace Vocaluxe.Base if (_LogFile == null) _Open(); - try - { - _LogFile.WriteLine(text); - _LogFile.Flush(); - } - catch (Exception) {} - } - - private void _Open() - { - _LogFile = new StreamWriter(Path.Combine(Environment.CurrentDirectory, _LogFileName), false, Encoding.UTF8); - - _LogFile.WriteLine(_LogName + " " + CSettings.GetFullVersionText() + " " + DateTime.Now); - _LogFile.WriteLine("----------------------------------------"); - _LogFile.WriteLine(); +// ReSharper disable PossibleNullReferenceException + _LogFile.WriteLine(text); +// ReSharper restore PossibleNullReferenceException + _LogFile.Flush(); } public void Dispose() diff --git a/Vocaluxe/Base/CMain.cs b/Vocaluxe/Base/CMain.cs index 4453d747..0b77a945 100644 --- a/Vocaluxe/Base/CMain.cs +++ b/Vocaluxe/Base/CMain.cs @@ -30,7 +30,6 @@ namespace Vocaluxe.Base public static IConfig Config = new CBconfig(); public static ISettings Settings = new CBsettings(); public static ITheme Theme = new CBtheme(); - public static IHelper Helper = new CBhelper(); public static IBackgroundMusic BackgroundMusic = new CBbackgroundMusic(); public static IDrawing Draw = new CBdraw(); public static IGraphics Graphics = new CBGraphics(); @@ -50,7 +49,7 @@ namespace Vocaluxe.Base public static void Init() { - CBase.Assign(Config, Settings, Theme, Helper, Log, BackgroundMusic, Draw, Graphics, Fonts, Language, + CBase.Assign(Config, Settings, Theme, Log, BackgroundMusic, Draw, Graphics, Fonts, Language, Game, Profiles, Record, Songs, Video, Sound, Cover, DataBase, Input, Playlist); } } @@ -294,8 +293,6 @@ namespace Vocaluxe.Base } } - class CBhelper : IHelper {} - class CBbackgroundMusic : IBackgroundMusic { public bool IsDisabled() diff --git a/Vocaluxe/Base/CSettings.cs b/Vocaluxe/Base/CSettings.cs index 3af6bf90..cbf890e2 100644 --- a/Vocaluxe/Base/CSettings.cs +++ b/Vocaluxe/Base/CSettings.cs @@ -26,10 +26,12 @@ namespace Vocaluxe.Base { enum ERevision { + // ReSharper disable UnusedMember.Global Alpha, Beta, RC, Release + // ReSharper restore UnusedMember.Global } static class CSettings diff --git a/Vocaluxe/Base/CSongSorter.cs b/Vocaluxe/Base/CSongSorter.cs index 1bd0fd11..1a4d569e 100644 --- a/Vocaluxe/Base/CSongSorter.cs +++ b/Vocaluxe/Base/CSongSorter.cs @@ -130,6 +130,11 @@ namespace Vocaluxe.Base else { FieldInfo field = typeof(CSong).GetField(fieldName, BindingFlags.Instance | BindingFlags.DeclaredOnly | BindingFlags.Public); + if (field == null) + { + CLog.LogError("Unknow sorting field: "+fieldName); + return _CreateSortList(""); + } bool isString = field.FieldType == typeof(string); if (!isString && field.FieldType != typeof(List)) throw new Exception("Unkown sort field type"); diff --git a/Vocaluxe/CSplashScreen.cs b/Vocaluxe/CSplashScreen.cs index 69bc6e20..938588e4 100644 --- a/Vocaluxe/CSplashScreen.cs +++ b/Vocaluxe/CSplashScreen.cs @@ -71,6 +71,18 @@ namespace Vocaluxe Show(); } + public override sealed string Text + { + get { return base.Text; } + set { base.Text = value; } + } + + public override sealed Color BackColor + { + get { return base.BackColor; } + set { base.BackColor = value; } + } + protected override void OnPaint(PaintEventArgs e) {} protected override void OnPaintBackground(PaintEventArgs e) diff --git a/Vocaluxe/Lib/Input/IInput.cs b/Vocaluxe/Lib/Input/IInput.cs index e3d0162c..aef32f7e 100644 --- a/Vocaluxe/Lib/Input/IInput.cs +++ b/Vocaluxe/Lib/Input/IInput.cs @@ -34,10 +34,10 @@ namespace Vocaluxe.Lib.Input interface IInput { - bool Init(); + void Init(); void Close(); - bool Connect(); - bool Disconnect(); + void Connect(); + void Disconnect(); bool IsConnected(); void Update(); diff --git a/Vocaluxe/Lib/Input/WiiMote/CWiiMote.cs b/Vocaluxe/Lib/Input/WiiMote/CWiiMote.cs index 4e419c32..98cef67b 100644 --- a/Vocaluxe/Lib/Input/WiiMote/CWiiMote.cs +++ b/Vocaluxe/Lib/Input/WiiMote/CWiiMote.cs @@ -50,15 +50,13 @@ namespace Vocaluxe.Lib.Input.WiiMote private CGesture _Gesture; - public bool Init() + public void Init() { _Sync = new Object(); _RumbleTimer = new CRumbleTimer(); _Gesture = new CGesture(); - _Active = true; - _HandlerThread = new Thread(_MainLoop); - _HandlerThread.Priority = ThreadPriority.BelowNormal; + _HandlerThread = new Thread(_MainLoop) {Priority = ThreadPriority.BelowNormal}; _KeysPool = new List(); _CurrentKeysPool = new List(); @@ -68,10 +66,6 @@ namespace Vocaluxe.Lib.Input.WiiMote _ButtonStates = new bool[11]; _OldPosition = new Point(); - - _HandlerThread.Start(); - - return true; } public void Close() @@ -79,20 +73,17 @@ namespace Vocaluxe.Lib.Input.WiiMote _Active = false; } - public bool Connect() + public void Connect() { - if (!_Active) - { - _Active = true; - _HandlerThread.Start(); - } - return true; + if (_Active) + return; + _Active = true; + _HandlerThread.Start(); } - public bool Disconnect() + public void Disconnect() { _Active = false; - return true; } public bool IsConnected() @@ -113,8 +104,7 @@ namespace Vocaluxe.Lib.Input.WiiMote _CurrentKeysPool.RemoveAt(0); return true; } - else - return false; + return false; } public bool PollMouseEvent(ref SMouseEvent mouseEvent) @@ -125,8 +115,7 @@ namespace Vocaluxe.Lib.Input.WiiMote _CurrentMousePool.RemoveAt(0); return true; } - else - return false; + return false; } public void SetRumble(float duration) diff --git a/Vocaluxe/Lib/Sound/COpenALPlay.cs b/Vocaluxe/Lib/Sound/COpenALPlay.cs index 43a2832c..775b6ca5 100644 --- a/Vocaluxe/Lib/Sound/COpenALPlay.cs +++ b/Vocaluxe/Lib/Sound/COpenALPlay.cs @@ -119,7 +119,6 @@ namespace Vocaluxe.Lib.Sound { _Decoder.Add(decoder); stream.Handle = _Count++; - stream.File = media; _Streams.Add(stream); return stream.Handle; } @@ -399,7 +398,6 @@ namespace Vocaluxe.Lib.Sound private Closeproc _Closeproc; private int _StreamID; - private string _FileName; private IAudioDecoder _Decoder; private float _BytesPerSecond; private bool _NoMoreData; @@ -506,7 +504,7 @@ namespace Vocaluxe.Lib.Sound { if (Finished) _Timer.Stop(); - + //TODO: Why not use Decoder.GetPosition()? return _CurrentTime + _Timer.ElapsedMilliseconds / 1000f; } } @@ -586,9 +584,6 @@ namespace Vocaluxe.Lib.Sound if (!File.Exists(fileName)) return -1; - if (_FileOpened) - return -1; - _Decoder = new CAudioDecoderFFmpeg(); _Decoder.Init(); @@ -609,7 +604,6 @@ namespace Vocaluxe.Lib.Sound return -1; } - _FileName = fileName; _Decoder.Open(fileName); _Duration = _Decoder.GetLength(); @@ -619,9 +613,7 @@ namespace Vocaluxe.Lib.Sound _CurrentTime = 0f; _Timer.Reset(); - SAudioStreams stream = new SAudioStreams(0); - - stream.Handle = _Buffers[0]; + SAudioStreams stream = new SAudioStreams(0) {Handle = _Buffers[0]}; if (stream.Handle != 0) { @@ -634,6 +626,7 @@ namespace Vocaluxe.Lib.Sound return stream.Handle; } + _Initialized = true; return -1; } @@ -758,6 +751,7 @@ namespace Vocaluxe.Lib.Sound AL.DeleteSource(_Source); AL.DeleteBuffers(_Buffers); } + _Decoder.Close(); } _Closeproc(_StreamID); diff --git a/Vocaluxe/Lib/Sound/COpenALRecord.cs b/Vocaluxe/Lib/Sound/COpenALRecord.cs deleted file mode 100644 index 92766765..00000000 --- a/Vocaluxe/Lib/Sound/COpenALRecord.cs +++ /dev/null @@ -1,23 +0,0 @@ -#region license -// /* -// This file is part of Vocaluxe. -// -// Vocaluxe is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// Vocaluxe is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with Vocaluxe. If not, see . -// */ -#endregion - -namespace Vocaluxe.Lib.Sound -{ - class COpenALRecord {} -} \ No newline at end of file diff --git a/Vocaluxe/Lib/Sound/CPortAudioPlay.cs b/Vocaluxe/Lib/Sound/CPortAudioPlay.cs index a6c904d3..e5a92632 100644 --- a/Vocaluxe/Lib/Sound/CPortAudioPlay.cs +++ b/Vocaluxe/Lib/Sound/CPortAudioPlay.cs @@ -104,7 +104,6 @@ namespace Vocaluxe.Lib.Sound { _Decoder.Add(decoder); stream.Handle = _Count++; - stream.File = media; _Streams.Add(stream); return stream.Handle; } @@ -376,7 +375,6 @@ namespace Vocaluxe.Lib.Sound private Closeproc _Closeproc; private CPortAudio.PaStreamCallbackDelegate _PaStreamCallback; private int _StreamID; - private string _FileName; private IAudioDecoder _Decoder; private float _BytesPerSecond; private bool _NoMoreData; @@ -489,7 +487,7 @@ namespace Vocaluxe.Lib.Sound { if (Finished) _SyncTimer.Pause(); - + //TODO: Why not use Decoder.GetPosition()? return _SyncTimer.Time; } } @@ -607,7 +605,6 @@ namespace Vocaluxe.Lib.Sound return -1; } - _FileName = fileName; _Decoder.Open(fileName); _Duration = _Decoder.GetLength(); @@ -800,6 +797,7 @@ namespace Vocaluxe.Lib.Sound _Initialized = false; } } + _Decoder.Close(); } _Closeproc(_StreamID); diff --git a/Vocaluxe/Lib/Sound/Decoder/CAudioDecoder.cs b/Vocaluxe/Lib/Sound/Decoder/CAudioDecoder.cs deleted file mode 100644 index 128d7ed2..00000000 --- a/Vocaluxe/Lib/Sound/Decoder/CAudioDecoder.cs +++ /dev/null @@ -1,60 +0,0 @@ -#region license -// /* -// This file is part of Vocaluxe. -// -// Vocaluxe is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// Vocaluxe is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with Vocaluxe. If not, see . -// */ -#endregion - -namespace Vocaluxe.Lib.Sound.Decoder -{ - abstract class CAudioDecoder : IAudioDecoder - { - protected bool _Initialized; - - public virtual void Init() {} - - public virtual void Close() {} - - public void Open(string fileName) - { - Open(fileName, false); - } - - public virtual void Open(string fileName, bool loop) {} - - public virtual SFormatInfo GetFormatInfo() - { - return new SFormatInfo(); - } - - public virtual float GetLength() - { - return 0f; - } - - public virtual void SetPosition(float time) {} - - public virtual float GetPosition() - { - return 0f; - } - - public virtual void Decode(out byte[] buffer, out float timeStamp) - { - buffer = null; - timeStamp = 0f; - } - } -} \ No newline at end of file diff --git a/Vocaluxe/Lib/Sound/Decoder/CAudioDecoderFFmpeg.cs b/Vocaluxe/Lib/Sound/Decoder/CAudioDecoderFFmpeg.cs index eb0a01d1..3bdd388c 100644 --- a/Vocaluxe/Lib/Sound/Decoder/CAudioDecoderFFmpeg.cs +++ b/Vocaluxe/Lib/Sound/Decoder/CAudioDecoderFFmpeg.cs @@ -24,7 +24,7 @@ using Vocaluxe.Lib.Video.Acinerella; namespace Vocaluxe.Lib.Sound.Decoder { - class CAudioDecoderFFmpeg : CAudioDecoder, IDisposable + class CAudioDecoderFFmpeg : IAudioDecoder, IDisposable { private IntPtr _InstancePtr = IntPtr.Zero; private IntPtr _Audiodecoder = IntPtr.Zero; @@ -36,17 +36,12 @@ namespace Vocaluxe.Lib.Sound.Decoder private string _FileName; private bool _FileOpened; - public override void Init() + public void Init() { - _FileOpened = false; - _Initialized = true; } - public override void Open(string fileName, bool loop) + public void Open(string fileName, bool loop) { - if (!_Initialized) - return; - _FileName = fileName; try @@ -88,11 +83,12 @@ namespace Vocaluxe.Lib.Sound.Decoder return; } - _FormatInfo = new SFormatInfo(); - - _FormatInfo.SamplesPerSecond = audiodecoder.StreamInfo.AudioInfo.SamplesPerSecond; - _FormatInfo.BitDepth = audiodecoder.StreamInfo.AudioInfo.BitDepth; - _FormatInfo.ChannelCount = audiodecoder.StreamInfo.AudioInfo.ChannelCount; + _FormatInfo = new SFormatInfo + { + SamplesPerSecond = audiodecoder.StreamInfo.AudioInfo.SamplesPerSecond, + BitDepth = audiodecoder.StreamInfo.AudioInfo.BitDepth, + ChannelCount = audiodecoder.StreamInfo.AudioInfo.ChannelCount + }; _CurrentTime = 0f; @@ -104,13 +100,8 @@ namespace Vocaluxe.Lib.Sound.Decoder _FileOpened = true; } - public override void Close() + public void Close() { - if (!_Initialized) - return; - - _Initialized = false; - if (!_FileOpened) return; @@ -126,25 +117,25 @@ namespace Vocaluxe.Lib.Sound.Decoder _FileOpened = false; } - public override SFormatInfo GetFormatInfo() + public SFormatInfo GetFormatInfo() { - if (!_Initialized && !_FileOpened) + if (!_FileOpened) return new SFormatInfo(); return _FormatInfo; } - public override float GetLength() + public float GetLength() { - if (!_Initialized && !_FileOpened) + if (!_FileOpened) return 0f; return _Instance.Info.Duration / 1000f; } - public override void SetPosition(float time) + public void SetPosition(float time) { - if (!_Initialized && !_FileOpened) + if (!_FileOpened) return; try @@ -158,17 +149,14 @@ namespace Vocaluxe.Lib.Sound.Decoder } } - public override float GetPosition() + public float GetPosition() { - if (!_Initialized && !_FileOpened) - return 0f; - - return _CurrentTime; + return !_FileOpened ? 0f : _CurrentTime; } - public override void Decode(out byte[] buffer, out float timeStamp) + public void Decode(out byte[] buffer, out float timeStamp) { - if (!_Initialized && !_FileOpened) + if (!_FileOpened) { buffer = null; timeStamp = 0f; diff --git a/Vocaluxe/Lib/Sound/Decoder/IAudioDecoder.cs b/Vocaluxe/Lib/Sound/Decoder/IAudioDecoder.cs index 4a58afc3..c98b66ec 100644 --- a/Vocaluxe/Lib/Sound/Decoder/IAudioDecoder.cs +++ b/Vocaluxe/Lib/Sound/Decoder/IAudioDecoder.cs @@ -31,8 +31,7 @@ namespace Vocaluxe.Lib.Sound.Decoder void Init(); void Close(); - void Open(string fileName); - void Open(string fileName, bool loop); + void Open(string fileName, bool loop=false); SFormatInfo GetFormatInfo(); float GetLength(); diff --git a/Vocaluxe/Lib/Sound/IPlayback.cs b/Vocaluxe/Lib/Sound/IPlayback.cs index c83a0fbd..69058546 100644 --- a/Vocaluxe/Lib/Sound/IPlayback.cs +++ b/Vocaluxe/Lib/Sound/IPlayback.cs @@ -24,12 +24,10 @@ namespace Vocaluxe.Lib.Sound struct SAudioStreams { public int Handle; - public string File; public SAudioStreams(int stream) { Handle = stream; - File = String.Empty; } } diff --git a/Vocaluxe/Lib/Sound/Portaudio/PortAudioASIO.cs b/Vocaluxe/Lib/Sound/Portaudio/PortAudioASIO.cs deleted file mode 100644 index 4bdd1091..00000000 --- a/Vocaluxe/Lib/Sound/Portaudio/PortAudioASIO.cs +++ /dev/null @@ -1,98 +0,0 @@ -#region license -// /* -// This file is part of Vocaluxe. -// -// Vocaluxe is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// Vocaluxe is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with Vocaluxe. If not, see . -// */ -#endregion - -using System; -using System.Runtime.InteropServices; - -namespace Vocaluxe.Lib.Sound.PortAudio -{ - /// PortAudio v.19 bindings for .NET - ASIO bindings - public static partial class CPortAudio - { - #region **** PORTAUDIO DATA STRUCTURES **** - [StructLayout(LayoutKind.Sequential)] - public struct SPaAsioStreamInfo - { - public ulong Size; /**< sizeof(PaAsioStreamInfo) */ - public int HostApiType; /**< paASIO */ - public ulong Version; /**< 1 */ - public ulong Flags; - - /// Support for opening only specific channels of an ASIO device. - /// If the paAsioUseChannelSelectors flag is set, channelSelectors is a - /// pointer to an array of integers specifying the device channels to use. - /// When used, the length of the channelSelectors array must match the - /// corresponding channelCount parameter to Pa_OpenStream() otherwise a - /// crash may result. - /// The values in the selectors array must specify channels within the - /// range of supported channels for the device or paInvalidChannelCount will - /// result. - private readonly IntPtr _ChannelSelectors; - } - #endregion - - #region **** PORTAUDIO DEFINES **** - public const int PaAsioUseChannelSelectors = 0x01; - #endregion - - #region **** PORTAUDIO FUNCTIONS **** - // /// Retrieve legal latency settings for the specificed device, in samples. - // /// The global index of the device about which the query is being made. - // /// A pointer to the location which will recieve the minimum latency value. - // /// A pointer to the location which will recieve the maximum latency value. - // /// A pointer to the location which will recieve the preferred latency value. - // /// A pointer to the location which will recieve the granularity. This value - // /// determines which values between minLatency and maxLatency are available. ie the step size, - // /// if granularity is -1 then available latency settings are powers of two. - // /// See ASIOGetBufferSize in the ASIO SDK. - // PaError PaAsio_GetAvailableLatencyValues( PaDeviceIndex device, long *minLatency, long *maxLatency, - // long *preferredLatency, long *granularity ); - - /// Display the ASIO control panel for the specified device. - /// The global index of the device whose control panel is to be displayed. - /// - /// On Windows, the calling application's main window handle, - /// on Macintosh this value should be zero. - /// - [DllImport("PortAudio.dll", CallingConvention = CallingConvention.Cdecl)] - public static extern EPaError PaAsio_ShowControlPanel(int device, IntPtr systemSpecific); - - // /// Retrieve a pointer to a string containing the name of the specified input channel. - // /// The string is valid until Pa_Terminate is called. - // /// The string will be no longer than 32 characters including the null terminator. - // PaError PaAsio_GetInputChannelName(PaDeviceIndex device, int channelIndex, const char** channelName ); - - // /// Retrieve a pointer to a string containing the name of the specified input channel. - // /// The string is valid until Pa_Terminate is called. - // /// The string will be no longer than 32 characters including the null terminator. - // PaError PaAsio_GetOutputChannelName( PaDeviceIndex device, int channelIndex, const char** channelName ); - - /// Set the sample rate of an open paASIO stream. - /// - /// The stream to operate on. - /// - /// The new sample rate. - /// Note that this function may fail if the stream is alredy running and the - /// ASIO driver does not support switching the sample rate of a running stream. - /// paIncompatibleStreamHostApi if stream is not a paASIO stream. - [DllImport("PortAudio.dll", CallingConvention = CallingConvention.Cdecl)] - public static extern EPaError PaAsio_SetStreamSampleRate(IntPtr stream, double sampleRate); - #endregion - } -} \ No newline at end of file diff --git a/Vocaluxe/Lib/Video/Acinerella/CAcinerella.cs b/Vocaluxe/Lib/Video/Acinerella/CAcinerella.cs index 4127ae01..32eafb4f 100644 --- a/Vocaluxe/Lib/Video/Acinerella/CAcinerella.cs +++ b/Vocaluxe/Lib/Video/Acinerella/CAcinerella.cs @@ -22,6 +22,7 @@ using System.Runtime.InteropServices; namespace Vocaluxe.Lib.Video.Acinerella { + // ReSharper disable UnusedMember.Global public enum EACStreamType : sbyte { /*The type of the media stream is not known. This kind of stream can not be @@ -51,12 +52,14 @@ namespace Vocaluxe.Lib.Video.Acinerella ACOutputBGra32 = 3 } + // ReSharper disable MemberCanBePrivate.Global + // Contains information about the whole file/stream that has been opened. Default // values are "" for strings and -1 for integer values. [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi)] public struct SACFileInfo { - public Int64 Duration; + public readonly Int64 Duration; } // TAc_instance represents an Acinerella instance. Each instance can open and @@ -66,12 +69,12 @@ namespace Vocaluxe.Lib.Video.Acinerella public struct SACInstance { //If true, the instance currently opened a media file - public bool Opened; + public readonly bool Opened; //Contains the count of streams the media file has. This value is available //after calling the ac_open function. - public Int32 StreamCount; + public readonly Int32 StreamCount; //Set this value to change the image output format - public EACOutputFormat OutputFormat; + public readonly EACOutputFormat OutputFormat; //Contains information about the opened stream/file public SACFileInfo Info; } @@ -81,11 +84,11 @@ namespace Vocaluxe.Lib.Video.Acinerella public struct SACAudioStreamInfo { //Samples per second. Default values are 44100 or 48000. - public Int32 SamplesPerSecond; + public readonly Int32 SamplesPerSecond; //Bits per sample. Can be 8 or 16 Bit. - public Int32 BitDepth; + public readonly Int32 BitDepth; //Count of channels in the audio stream. - public Int32 ChannelCount; + public readonly Int32 ChannelCount; } // Contains information about an Acinerella video stream. @@ -93,13 +96,13 @@ namespace Vocaluxe.Lib.Video.Acinerella public struct SACVideoStreamInfo { //The width of one frame. - public Int32 FrameWidth; + public readonly Int32 FrameWidth; //The height of one frame. - public Int32 FrameHeight; + public readonly Int32 FrameHeight; //The width of one pixel. 1.07 for 4:3 format, 1,42 for the 16:9 format - public float PixelAspect; + public readonly float PixelAspect; //Frames per second that should be played. - public double FramesPerSecond; + public readonly double FramesPerSecond; } // Contains information about an Acinerella stream. @@ -107,7 +110,8 @@ namespace Vocaluxe.Lib.Video.Acinerella public struct SACStreamInfo { //Contains the type of the stream. - public EACStreamType StreamType; + public readonly EACStreamType StreamType; + //Additional info about the stream public SACAudioStreamInfo AudioInfo; public SACVideoStreamInfo VideoInfo; @@ -120,32 +124,33 @@ namespace Vocaluxe.Lib.Video.Acinerella //Pointer on the Acinerella instance private readonly IntPtr _ACInstancePtr; //Contains the type of the decoder. - public EACDecoderType DecType; + public readonly EACDecoderType DecType; //The timecode of the currently decoded picture in seconds. - public double Timecode; + public readonly double Timecode; - public double VideoClock; + public readonly double VideoClock; //Contains information about the stream the decoder is attached to. public SACStreamInfo StreamInfo; //The index of the stream the decoder is attached to. - public Int32 StreamIndex; + public readonly Int32 StreamIndex; //Pointer to the buffer which contains the data. internal IntPtr Buffer; //Size of the data in the buffer. - public Int32 BufferSize; + public readonly Int32 BufferSize; } - // Contains information about an Acinerella package. [StructLayout(LayoutKind.Sequential)] public struct SACPackage { //The stream the package belongs to. - public Int32 StreamIndex; + public readonly Int32 StreamIndex; } + // ReSharper restore MemberCanBePrivate.Global + // Callback function used to ask the application to read data. Should return // the number of bytes read or an value smaller than zero if an error occured. //TAc_read_callback = function(sender: Pointer; byte[] buf, int size): integer; cdecl; @@ -273,7 +278,9 @@ namespace Vocaluxe.Lib.Video.Acinerella string filename ); +// ReSharper disable UnusedMethodReturnValue.Global public static Int32 AcOpen2( +// ReSharper restore UnusedMethodReturnValue.Global IntPtr pAcInstance, string filename ) @@ -423,7 +430,9 @@ namespace Vocaluxe.Lib.Video.Acinerella [DllImport(_AcDll, EntryPoint = "ac_seek", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Auto)] private static extern Int32 _ac_seek(IntPtr pAcDecoder, Int32 dir, Int64 targetPos); +// ReSharper disable UnusedMethodReturnValue.Global public static Int32 AcSeek(IntPtr pAcDecoder, Int32 dir, Int64 targetPos) +// ReSharper restore UnusedMethodReturnValue.Global { lock (_Lock) { @@ -441,4 +450,5 @@ namespace Vocaluxe.Lib.Video.Acinerella out Int32 scoreMax ); } + // ReSharper restore UnusedMember.Global } \ No newline at end of file diff --git a/Vocaluxe/Lib/Video/CVideoDecoderFFmpeg.cs b/Vocaluxe/Lib/Video/CVideoDecoderFFmpeg.cs index 9c33c6f5..aa998ad0 100644 --- a/Vocaluxe/Lib/Video/CVideoDecoderFFmpeg.cs +++ b/Vocaluxe/Lib/Video/CVideoDecoderFFmpeg.cs @@ -67,7 +67,6 @@ namespace Vocaluxe.Lib.Video { _Decoder.Add(decoder); stream.Handle = _Count++; - stream.File = videoFileName; _Streams.Add(stream); return stream.Handle; } @@ -232,7 +231,6 @@ namespace Vocaluxe.Lib.Video private bool _Paused; private bool _NoMoreFrames; - private bool _Finished; private bool _BeforeLoop; private int _Width; @@ -240,7 +238,6 @@ namespace Vocaluxe.Lib.Video private float _SetTime; private float _SetGap; private float _SetStart; - private bool _SetLoop; private bool _SetSkip; private bool _Terminated; @@ -267,16 +264,12 @@ namespace Vocaluxe.Lib.Video { get { - if (_FileOpened) - return _Duration; - - return 0f; + return _FileOpened ? _Duration : 0f; } } public bool Paused { - get { return _Paused; } set { lock (_MutexSyncSignals) @@ -290,16 +283,9 @@ namespace Vocaluxe.Lib.Video } } - public bool Loop - { - get { return _SetLoop; } - set { _SetLoop = value; } - } + public bool Loop { private get; set; } - public bool Finished - { - get { return _Finished; } - } + public bool Finished { get; private set; } public bool Open(string fileName) { @@ -325,7 +311,7 @@ namespace Vocaluxe.Lib.Video if (_Paused) return false; - if (_SetLoop) + if (Loop) { lock (_MutexSyncSignals) { @@ -343,7 +329,7 @@ namespace Vocaluxe.Lib.Video return true; } - if (_SetTime != time) + if (Math.Abs(_SetTime - time) > float.Epsilon) { lock (_MutexSyncSignals) { @@ -365,7 +351,7 @@ namespace Vocaluxe.Lib.Video _SetGap = gap; _SetSkip = true; _NoMoreFrames = false; - _Finished = false; + Finished = false; } //EventDecode.Set(); return true; @@ -443,7 +429,7 @@ namespace Vocaluxe.Lib.Video _SetSkip = false; _Gap = _SetGap; _Start = _SetStart; - _Loop = _SetLoop; + _Loop = Loop; } if (_Skip) @@ -678,7 +664,7 @@ namespace Vocaluxe.Lib.Video if (num >= 0) { - if (frame.Index == -1 || _Width != frame.Width || _Height != frame.Height) + if (frame.Index == -1 || Math.Abs(_Width - frame.Width) > float.Epsilon || Math.Abs(_Height - frame.Height) > float.Epsilon) { CDraw.RemoveTexture(ref frame); frame = CDraw.AddTexture(_Width, _Height, ref _FrameBuffer[num].Data); @@ -690,12 +676,12 @@ namespace Vocaluxe.Lib.Video { _CurrentVideoTime = _FrameBuffer[num].Time; } - _Finished = false; + Finished = false; } else { if (_NoMoreFrames) - _Finished = true; + Finished = true; } } } diff --git a/Vocaluxe/Lib/Video/Gstreamer/CGstreamerVideoWrapper.cs b/Vocaluxe/Lib/Video/Gstreamer/CGstreamerVideoWrapper.cs index 544a28d2..5a863adc 100644 --- a/Vocaluxe/Lib/Video/Gstreamer/CGstreamerVideoWrapper.cs +++ b/Vocaluxe/Lib/Video/Gstreamer/CGstreamerVideoWrapper.cs @@ -24,11 +24,13 @@ namespace Vocaluxe.Lib.Video.Gstreamer { public struct SNativeFrame { +// ReSharper disable UnassignedField.Global internal IntPtr Buffer; public int Size; public int Width; public int Height; public float Videotime; + // ReSharper restore UnassignedField.Global } public struct SManagedFrame diff --git a/Vocaluxe/Lib/Video/IVideoDecoder.cs b/Vocaluxe/Lib/Video/IVideoDecoder.cs index dfdd3312..da0db810 100644 --- a/Vocaluxe/Lib/Video/IVideoDecoder.cs +++ b/Vocaluxe/Lib/Video/IVideoDecoder.cs @@ -25,12 +25,10 @@ namespace Vocaluxe.Lib.Video struct SVideoStreams { public int Handle; - public string File; public SVideoStreams(int stream) { Handle = stream; - File = String.Empty; } } diff --git a/Vocaluxe/Lib/Webcam/CAForgeNet.cs b/Vocaluxe/Lib/Webcam/CAForgeNet.cs index 1bc7ff7d..20d25328 100644 --- a/Vocaluxe/Lib/Webcam/CAForgeNet.cs +++ b/Vocaluxe/Lib/Webcam/CAForgeNet.cs @@ -17,6 +17,7 @@ // */ #endregion +using System; using AForge.Video; using AForge.Video.DirectShow; using System.Collections.Generic; @@ -56,7 +57,7 @@ namespace Vocaluxe.Lib.Webcam { lock (_MutexData) { - if (frame.Index == -1 || _Width != frame.Width || _Height != frame.Height) + if (frame.Index == -1 || Math.Abs(_Width - frame.Width) > float.Epsilon || Math.Abs(_Height - frame.Height) > float.Epsilon) { CDraw.RemoveTexture(ref frame); frame = CDraw.AddTexture(_Width, _Height, ref _Data); @@ -81,8 +82,7 @@ namespace Vocaluxe.Lib.Webcam return bmp; } } - else - return null; + return null; } public bool Init() @@ -101,13 +101,12 @@ namespace Vocaluxe.Lib.Webcam num++; VideoCaptureDevice tmpdev = new VideoCaptureDevice(info.MonikerString); - for (int i = 0; i < tmpdev.VideoCapabilities.Length; i++) - { + foreach (VideoCapabilities capabilities in tmpdev.VideoCapabilities) { SCapabilities item = new SCapabilities { - Framerate = tmpdev.VideoCapabilities[i].FrameRate, - Height = tmpdev.VideoCapabilities[i].FrameSize.Height, - Width = tmpdev.VideoCapabilities[i].FrameSize.Width + Framerate = capabilities.FrameRate, + Height = capabilities.FrameSize.Height, + Width = capabilities.FrameSize.Width }; device.Capabilities.Add(item); } @@ -174,10 +173,7 @@ namespace Vocaluxe.Lib.Webcam return false; //No MonikerString found, try first webcam - if (config.MonikerString.Length == 0) - _Webcam = new VideoCaptureDevice(_WebcamDevices[0].MonikerString); - else //Found MonikerString - _Webcam = new VideoCaptureDevice(config.MonikerString); + _Webcam = config.MonikerString == "" ? new VideoCaptureDevice(_WebcamDevices[0].MonikerString) : new VideoCaptureDevice(config.MonikerString); if (_Webcam == null) return false; diff --git a/Vocaluxe/Program.cs b/Vocaluxe/Program.cs index dfd3fea0..689bf2c5 100644 --- a/Vocaluxe/Program.cs +++ b/Vocaluxe/Program.cs @@ -185,6 +185,7 @@ namespace Vocaluxe // Init Input CLog.StartBenchmark(0, "Init Input"); CInput.Init(); + CInput.Connect(); CLog.StopBenchmark(0, "Init Input"); // Init Game; diff --git a/Vocaluxe/Vocaluxe.csproj b/Vocaluxe/Vocaluxe.csproj index b0c8c64f..58fa7a40 100644 --- a/Vocaluxe/Vocaluxe.csproj +++ b/Vocaluxe/Vocaluxe.csproj @@ -220,11 +220,9 @@ - - @@ -265,7 +263,6 @@ Designer - diff --git a/VocaluxeLib/Menu/CBasic.cs b/VocaluxeLib/Menu/CBasic.cs index 15162057..db31f26b 100644 --- a/VocaluxeLib/Menu/CBasic.cs +++ b/VocaluxeLib/Menu/CBasic.cs @@ -24,7 +24,6 @@ namespace VocaluxeLib.Menu public static IConfig Config; public static ISettings Settings; public static ITheme Theme; - public static IHelper Helper; public static ILog Log; public static IBackgroundMusic BackgroundMusic; public static IDrawing Drawing; @@ -42,14 +41,13 @@ namespace VocaluxeLib.Menu public static IInputs Input; public static IPlaylist Playlist; - public static void Assign(IConfig config, ISettings settings, ITheme theme, IHelper helper, ILog log, IBackgroundMusic backgroundMusic, + public static void Assign(IConfig config, ISettings settings, ITheme theme, ILog log, IBackgroundMusic backgroundMusic, IDrawing draw, IGraphics graphics, IFonts fonts, ILanguage language, IGame game, IProfiles profiles, IRecording record, ISongs songs, IVideo video, ISound sound, ICover cover, IDataBase dataBase, IInputs input, IPlaylist playlist) { Config = config; Settings = settings; Theme = theme; - Helper = helper; Log = log; BackgroundMusic = backgroundMusic; Drawing = draw; diff --git a/VocaluxeLib/Menu/CEqualizer.cs b/VocaluxeLib/Menu/CEqualizer.cs index 91ac9265..a1d7fc89 100644 --- a/VocaluxeLib/Menu/CEqualizer.cs +++ b/VocaluxeLib/Menu/CEqualizer.cs @@ -241,7 +241,7 @@ namespace VocaluxeLib.Menu public void Draw() { - if (_Bars == null) + if (_Bars == null || _Theme.Style!=EEqualizerStyle.Collums) return; float dx = Rect.W / _Bars.Length; diff --git a/VocaluxeLib/Menu/CMenu.cs b/VocaluxeLib/Menu/CMenu.cs index 5f766e26..6b10e51d 100644 --- a/VocaluxeLib/Menu/CMenu.cs +++ b/VocaluxeLib/Menu/CMenu.cs @@ -144,7 +144,7 @@ namespace VocaluxeLib.Menu #region ThemeHandler private delegate void AddElementHandler(T element, String key); - private void _LoadThemeElement(string[] elements, AddElementHandler addElementHandler, CXMLReader xmlReader, int skinIndex) where T : IMenuElement + private void _LoadThemeElement(IEnumerable elements, AddElementHandler addElementHandler, CXMLReader xmlReader, int skinIndex) where T : IMenuElement { if (elements != null) { diff --git a/VocaluxeLib/Menu/COrderedDictionaryLite.cs b/VocaluxeLib/Menu/COrderedDictionaryLite.cs index da0563b8..76ef3a88 100644 --- a/VocaluxeLib/Menu/COrderedDictionaryLite.cs +++ b/VocaluxeLib/Menu/COrderedDictionaryLite.cs @@ -36,13 +36,6 @@ namespace VocaluxeLib.Menu _Parent = parent; } - public COrderedDictionaryLite(COrderedDictionaryLite dict) - { - _Items = new List(dict._Items); - _HtIndex = new Dictionary(dict._HtIndex); - _Parent = dict._Parent; - } - public T this[int index] { get { return _Items[index]; } diff --git a/VocaluxeLib/Menu/CScreenSetting.cs b/VocaluxeLib/Menu/CScreenSetting.cs index 4819b4d9..25063735 100644 --- a/VocaluxeLib/Menu/CScreenSetting.cs +++ b/VocaluxeLib/Menu/CScreenSetting.cs @@ -37,7 +37,10 @@ namespace VocaluxeLib.Menu public ESettingType Type; } +// ReSharper disable ClassNeverInstantiated.Global + //Instantiated by reflection public class CScreenSetting : IMenuElement +// ReSharper restore ClassNeverInstantiated.Global { private readonly int _PartyModeID; @@ -56,13 +59,6 @@ namespace VocaluxeLib.Menu _ThemeLoaded = false; } - public CScreenSetting(CScreenSetting ts) - { - _PartyModeID = ts._PartyModeID; - _Theme = ts._Theme; - _ThemeLoaded = ts._ThemeLoaded; - } - public bool LoadTheme(string xmlPath, string elementName, CXMLReader xmlReader, int skinIndex) { string item = xmlPath + "/" + elementName; diff --git a/VocaluxeLib/Menu/IMenu.cs b/VocaluxeLib/Menu/IMenu.cs index 411c9f53..70813cfc 100644 --- a/VocaluxeLib/Menu/IMenu.cs +++ b/VocaluxeLib/Menu/IMenu.cs @@ -138,8 +138,6 @@ namespace VocaluxeLib.Menu void LoadTheme(); } - public interface IHelper {} - public interface IBackgroundMusic { bool IsDisabled(); diff --git a/VocaluxeLib/Menu/SingNotes/CSingNotes.cs b/VocaluxeLib/Menu/SingNotes/CSingNotes.cs index d3d3e4f6..3cadcdbc 100644 --- a/VocaluxeLib/Menu/SingNotes/CSingNotes.cs +++ b/VocaluxeLib/Menu/SingNotes/CSingNotes.cs @@ -57,7 +57,7 @@ namespace VocaluxeLib.Menu.SingNotes public string SkinPerfectNoteStarName; } - public abstract class CSingNotes : ISingNotes, IMenuElement + public abstract class CSingNotes : IMenuElement { protected int _PartyModeID; private SThemeSingBar _Theme; diff --git a/VocaluxeLib/Menu/SingNotes/ISingNotes.cs b/VocaluxeLib/Menu/SingNotes/ISingNotes.cs deleted file mode 100644 index d5db470b..00000000 --- a/VocaluxeLib/Menu/SingNotes/ISingNotes.cs +++ /dev/null @@ -1,41 +0,0 @@ -#region license -// /* -// This file is part of Vocaluxe. -// -// Vocaluxe is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// Vocaluxe is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with Vocaluxe. If not, see . -// */ -#endregion - -using System.Collections.Generic; - -namespace VocaluxeLib.Menu.SingNotes -{ - public interface ISingNotes - { - void Reset(); - int AddPlayer(SRectF rect, SColorF color, int playerNr); - void RemovePlayer(int iD); - - void AddLine(int iD, CLine[] line, int lineNr, int player); - void RemoveLine(int iD); - - void AddNote(int iD, CNote note); - - void SetAlpha(int iD, float alpha); - float GetAlpha(int iD); - - void Draw(int iD, int player); - void Draw(int iD, List singLine, int player); - } -} \ No newline at end of file diff --git a/VocaluxeLib/Menu/SongMenu/CSongMenuFramework.cs b/VocaluxeLib/Menu/SongMenu/CSongMenuFramework.cs index 81fe451c..42c2b03f 100644 --- a/VocaluxeLib/Menu/SongMenu/CSongMenuFramework.cs +++ b/VocaluxeLib/Menu/SongMenu/CSongMenuFramework.cs @@ -46,12 +46,6 @@ namespace VocaluxeLib.Menu.SongMenu public SThemeSongMenuTileBoard SongMenuTileBoard; } - struct SThemeSongMenuBook {} - - struct SThemeSongMenuDreidel {} - - struct SThemeSongMenuList {} - struct SThemeSongMenuTileBoard { /// diff --git a/VocaluxeLib/VocaluxeLib.csproj b/VocaluxeLib/VocaluxeLib.csproj index 038db9ed..e9d4bd1e 100644 --- a/VocaluxeLib/VocaluxeLib.csproj +++ b/VocaluxeLib/VocaluxeLib.csproj @@ -137,7 +137,6 @@ - From cf39a4b107b9326558f7e32fcc9a9476ba2c4cc7 Mon Sep 17 00:00:00 2001 From: Flamefire Date: Tue, 23 Apr 2013 14:52:51 +0200 Subject: [PATCH 08/27] Changed string comparisons to easier != "" syntax --- .../PartyModeChallenge/CChallengeRounds.cs | 6 -- .../PartyModeChallenge/CPartyModeChallenge.cs | 8 +- .../CPartyScreenChallengeConfig.cs | 4 +- .../CPartyScreenChallengeMain.cs | 6 +- .../CPartyScreenChallengeNames.cs | 6 +- .../CPartyModeChallengeMedley.cs | 8 +- .../CPartyScreenChallengeMedleyConfig.cs | 4 +- .../CPartyScreenChallengeMedleyMain.cs | 6 +- .../CPartyScreenChallengeMedleyNames.cs | 4 +- .../PartyModeTicTacToe/CPartyModeTicTacToe.cs | 8 +- .../CPartyScreenTicTacToeConfig.cs | 6 +- .../CPartyScreenTicTacToeMain.cs | 4 +- .../CPartyScreenTicTacToeNames.cs | 6 +- Vocaluxe/Base/CBackgroundMusic.cs | 2 +- Vocaluxe/Base/CConfig.cs | 22 ++--- Vocaluxe/Base/CCover.cs | 6 +- Vocaluxe/Base/CDataBase.cs | 2 - Vocaluxe/Base/CFont.cs | 18 ++-- Vocaluxe/Base/CGraphics.cs | 6 +- Vocaluxe/Base/CLog.cs | 4 +- Vocaluxe/Base/CParty.cs | 5 +- Vocaluxe/Base/CPlaylists.cs | 2 +- Vocaluxe/Base/CProfiles.cs | 10 +-- Vocaluxe/Base/CSettings.cs | 10 +-- Vocaluxe/Base/CSongCategorizer.cs | 4 +- Vocaluxe/Base/CSongFilter.cs | 2 +- Vocaluxe/Base/CSongSorter.cs | 4 +- Vocaluxe/Base/CSound.cs | 2 +- Vocaluxe/Base/CTheme.cs | 6 +- Vocaluxe/Base/CWebcam.cs | 5 ++ Vocaluxe/GameModes/CGameModeNormal.cs | 3 +- Vocaluxe/Lib/Draw/CDrawWinForm.cs | 2 +- Vocaluxe/Lib/Draw/COpenGL.cs | 10 ++- Vocaluxe/Lib/Draw/IDraw.cs | 2 +- Vocaluxe/Lib/Playlist/CPlaylistFile.cs | 10 ++- Vocaluxe/Lib/Sound/COpenALPlay.cs | 2 +- Vocaluxe/Lib/Sound/CPortAudioRecord.cs | 13 ++- .../Lib/Sound/Decoder/CAudioDecoderFFmpeg.cs | 4 +- Vocaluxe/Lib/Sound/Decoder/IAudioDecoder.cs | 2 +- Vocaluxe/Lib/Sound/Portaudio/PortAudio.cs | 2 +- Vocaluxe/Lib/Video/Acinerella/CAcinerella.cs | 10 ++- Vocaluxe/Lib/Video/CVideoDecoderFFmpeg.cs | 5 +- .../Video/Gstreamer/CGstreamerVideoWrapper.cs | 2 +- Vocaluxe/Lib/Webcam/CAForgeNet.cs | 8 +- Vocaluxe/Lib/Webcam/IWebcam.cs | 1 + Vocaluxe/Screens/CPopupScreenPlayerControl.cs | 2 +- Vocaluxe/Screens/CScreenLoad.cs | 4 +- Vocaluxe/Screens/CScreenMain.cs | 14 +-- Vocaluxe/Screens/CScreenNames.cs | 13 ++- Vocaluxe/Screens/CScreenOptionsVideo.cs | 89 +++++++++---------- Vocaluxe/Screens/CScreenProfiles.cs | 25 +++--- Vocaluxe/Screens/CScreenScore.cs | 20 ++--- Vocaluxe/Screens/CScreenSing.cs | 21 ++--- Vocaluxe/Screens/CScreenSong.cs | 6 +- VocaluxeLib/Menu/CBackground.cs | 10 +-- VocaluxeLib/Menu/CButton.cs | 8 +- VocaluxeLib/Menu/CEqualizer.cs | 10 +-- VocaluxeLib/Menu/CHelper.cs | 2 - VocaluxeLib/Menu/CLyric.cs | 8 +- VocaluxeLib/Menu/CMenu.cs | 13 +-- VocaluxeLib/Menu/CNameSelection.cs | 8 +- VocaluxeLib/Menu/CParticle.cs | 10 +-- VocaluxeLib/Menu/CPlaylist.cs | 10 +-- VocaluxeLib/Menu/CScreenSetting.cs | 4 +- VocaluxeLib/Menu/CSelectSlide.cs | 28 +++--- VocaluxeLib/Menu/CStatic.cs | 4 +- VocaluxeLib/Menu/CText.cs | 10 +-- VocaluxeLib/Menu/CXMLReader.cs | 2 +- VocaluxeLib/Menu/Enums.cs | 2 +- VocaluxeLib/Menu/SingNotes/CSingNotes.cs | 2 +- VocaluxeLib/Menu/SongMenu/CSong.cs | 34 +++---- VocaluxeLib/Menu/SongMenu/CSongMenuDreidel.cs | 5 +- .../Menu/SongMenu/CSongMenuFramework.cs | 26 ++---- .../Menu/SongMenu/CSongMenuTileBoard.cs | 4 +- 74 files changed, 318 insertions(+), 338 deletions(-) diff --git a/PartyModes/PartyModeChallenge/CChallengeRounds.cs b/PartyModes/PartyModeChallenge/CChallengeRounds.cs index 1ad4fe25..ed122395 100644 --- a/PartyModes/PartyModeChallenge/CChallengeRounds.cs +++ b/PartyModes/PartyModeChallenge/CChallengeRounds.cs @@ -157,21 +157,15 @@ namespace VocaluxeLib.PartyModes.Challenge //filter against PlayerNrDemand List combsFiltered = new List(); if (playerNrDemand != null) - { combsFiltered.AddRange(_Combs.Where(t => t.IsAvailableAll(playerNrDemand))); - } //1st fallback if (playerNrDemand != null && combsFiltered.Count == 0) - { combsFiltered.AddRange(_Combs.Where(t => t.IsAvailableSomeone(playerNrDemand))); - } //2nd fallback if (combsFiltered.Count == 0) - { combsFiltered.AddRange(_Combs); - } int num = combsFiltered.Count; int rand = _Rand.Next(num); diff --git a/PartyModes/PartyModeChallenge/CPartyModeChallenge.cs b/PartyModes/PartyModeChallenge/CPartyModeChallenge.cs index b3e860af..fcdd4b98 100644 --- a/PartyModes/PartyModeChallenge/CPartyModeChallenge.cs +++ b/PartyModes/PartyModeChallenge/CPartyModeChallenge.cs @@ -368,9 +368,9 @@ namespace VocaluxeLib.PartyModes.Challenge return _ScreenSongOptions; } -// ReSharper disable RedundantAssignment + // ReSharper disable RedundantAssignment public override void OnSongChange(int songIndex, ref SScreenSongOptions screenSongOptions) -// ReSharper restore RedundantAssignment + // ReSharper restore RedundantAssignment { _ScreenSongOptions.Selection.SongIndex = -1; @@ -389,9 +389,9 @@ namespace VocaluxeLib.PartyModes.Challenge screenSongOptions = _ScreenSongOptions; } -// ReSharper disable RedundantAssignment + // ReSharper disable RedundantAssignment public override void OnCategoryChange(int categoryIndex, ref SScreenSongOptions screenSongOptions) -// ReSharper restore RedundantAssignment + // ReSharper restore RedundantAssignment { if (_GameData.CatSongIndices != null && categoryIndex != -1) { diff --git a/PartyModes/PartyModeChallenge/CPartyScreenChallengeConfig.cs b/PartyModes/PartyModeChallenge/CPartyScreenChallengeConfig.cs index df3678be..bbbd930f 100644 --- a/PartyModes/PartyModeChallenge/CPartyScreenChallengeConfig.cs +++ b/PartyModes/PartyModeChallenge/CPartyScreenChallengeConfig.cs @@ -23,9 +23,9 @@ using VocaluxeLib.Menu; namespace VocaluxeLib.PartyModes.Challenge { -// ReSharper disable UnusedMember.Global + // ReSharper disable UnusedMember.Global public class CPartyScreenChallengeConfig : CMenuParty -// ReSharper restore UnusedMember.Global + // ReSharper restore UnusedMember.Global { // Version number for theme files. Increment it, if you've changed something on the theme files! protected override int _ScreenVersion diff --git a/PartyModes/PartyModeChallenge/CPartyScreenChallengeMain.cs b/PartyModes/PartyModeChallenge/CPartyScreenChallengeMain.cs index 43e6443c..82db58c1 100644 --- a/PartyModes/PartyModeChallenge/CPartyScreenChallengeMain.cs +++ b/PartyModes/PartyModeChallenge/CPartyScreenChallengeMain.cs @@ -41,9 +41,9 @@ namespace VocaluxeLib.PartyModes.Challenge public List TextScores; } -// ReSharper disable UnusedMember.Global + // ReSharper disable UnusedMember.Global public class CPartyScreenChallengeMain : CMenuParty -// ReSharper restore UnusedMember.Global + // ReSharper restore UnusedMember.Global { // Version number for theme files. Increment it, if you've changed something on the theme files! protected override int _ScreenVersion @@ -352,7 +352,7 @@ namespace VocaluxeLib.PartyModes.Challenge private void _UpdateNextPlayerPositions() { - float x = (float) CBase.Settings.GetRenderW() / 2 - ((_GameState.NumPlayerAtOnce * _Statics[_StaticNextPlayer].Rect.W) + ((_GameState.NumPlayerAtOnce - 1) * 15)) / 2; + float x = (float)CBase.Settings.GetRenderW() / 2 - ((_GameState.NumPlayerAtOnce * _Statics[_StaticNextPlayer].Rect.W) + ((_GameState.NumPlayerAtOnce - 1) * 15)) / 2; const float staticY = 590; const float textY = 550; for (int i = 0; i < _GameState.NumPlayerAtOnce; i++) diff --git a/PartyModes/PartyModeChallenge/CPartyScreenChallengeNames.cs b/PartyModes/PartyModeChallenge/CPartyScreenChallengeNames.cs index eadf2a62..08bf3f0d 100644 --- a/PartyModes/PartyModeChallenge/CPartyScreenChallengeNames.cs +++ b/PartyModes/PartyModeChallenge/CPartyScreenChallengeNames.cs @@ -25,9 +25,9 @@ using VocaluxeLib.Menu; namespace VocaluxeLib.PartyModes.Challenge { -// ReSharper disable UnusedMember.Global + // ReSharper disable UnusedMember.Global public class CPartyScreenChallengeNames : CMenuParty -// ReSharper restore UnusedMember.Global + // ReSharper restore UnusedMember.Global { // Version number for theme files. Increment it, if you've changed something on the theme files! protected override int _ScreenVersion @@ -382,9 +382,7 @@ namespace VocaluxeLib.PartyModes.Challenge bool visible = false; //Show profile only if active if (CBase.Profiles.GetProfiles()[i].Active == EOffOn.TR_CONFIG_ON) - { visible = _Data.ScreenNames.ProfileIDs.All(profileID => profileID != i); - } if (visible) _PlayerChooseButtonsVisibleProfiles.Add(i); } diff --git a/PartyModes/PartyModeChallengeMedley/CPartyModeChallengeMedley.cs b/PartyModes/PartyModeChallengeMedley/CPartyModeChallengeMedley.cs index e82ac72b..7028f104 100644 --- a/PartyModes/PartyModeChallengeMedley/CPartyModeChallengeMedley.cs +++ b/PartyModes/PartyModeChallengeMedley/CPartyModeChallengeMedley.cs @@ -375,9 +375,9 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley return _ScreenSongOptions; } -// ReSharper disable RedundantAssignment + // ReSharper disable RedundantAssignment public override void OnSongChange(int songIndex, ref SScreenSongOptions screenSongOptions) -// ReSharper restore RedundantAssignment + // ReSharper restore RedundantAssignment { _ScreenSongOptions.Selection.SongIndex = -1; @@ -396,9 +396,9 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley screenSongOptions = _ScreenSongOptions; } -// ReSharper disable RedundantAssignment + // ReSharper disable RedundantAssignment public override void OnCategoryChange(int categoryIndex, ref SScreenSongOptions screenSongOptions) -// ReSharper restore RedundantAssignment + // ReSharper restore RedundantAssignment { if (_GameData.CatSongIndices != null && categoryIndex != -1) { diff --git a/PartyModes/PartyModeChallengeMedley/CPartyScreenChallengeMedleyConfig.cs b/PartyModes/PartyModeChallengeMedley/CPartyScreenChallengeMedleyConfig.cs index 658c93fb..03222db4 100644 --- a/PartyModes/PartyModeChallengeMedley/CPartyScreenChallengeMedleyConfig.cs +++ b/PartyModes/PartyModeChallengeMedley/CPartyScreenChallengeMedleyConfig.cs @@ -23,9 +23,9 @@ using VocaluxeLib.Menu; namespace VocaluxeLib.PartyModes.ChallengeMedley { -// ReSharper disable UnusedMember.Global + // ReSharper disable UnusedMember.Global public class CPartyScreenChallengeMedleyConfig : CMenuParty -// ReSharper restore UnusedMember.Global + // ReSharper restore UnusedMember.Global { // Version number for theme files. Increment it, if you've changed something on the theme files! protected override int _ScreenVersion diff --git a/PartyModes/PartyModeChallengeMedley/CPartyScreenChallengeMedleyMain.cs b/PartyModes/PartyModeChallengeMedley/CPartyScreenChallengeMedleyMain.cs index 1150dff4..ba0d258d 100644 --- a/PartyModes/PartyModeChallengeMedley/CPartyScreenChallengeMedleyMain.cs +++ b/PartyModes/PartyModeChallengeMedley/CPartyScreenChallengeMedleyMain.cs @@ -41,9 +41,9 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley public List TextScores; } -// ReSharper disable UnusedMember.Global + // ReSharper disable UnusedMember.Global public class CPartyScreenChallengeMedleyMain : CMenuParty -// ReSharper restore UnusedMember.Global + // ReSharper restore UnusedMember.Global { // Version number for theme files. Increment it, if you've changed something on the theme files! protected override int _ScreenVersion @@ -352,7 +352,7 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley private void _UpdateNextPlayerPositions() { - float x = (float) CBase.Settings.GetRenderW() / 2 - ((_GameState.NumPlayerAtOnce * _Statics[_StaticNextPlayer].Rect.W) + ((_GameState.NumPlayerAtOnce - 1) * 15)) / 2; + float x = (float)CBase.Settings.GetRenderW() / 2 - ((_GameState.NumPlayerAtOnce * _Statics[_StaticNextPlayer].Rect.W) + ((_GameState.NumPlayerAtOnce - 1) * 15)) / 2; const float staticY = 590; const float textY = 550; for (int i = 0; i < _GameState.NumPlayerAtOnce; i++) diff --git a/PartyModes/PartyModeChallengeMedley/CPartyScreenChallengeMedleyNames.cs b/PartyModes/PartyModeChallengeMedley/CPartyScreenChallengeMedleyNames.cs index cfbf84c6..af6cbc13 100644 --- a/PartyModes/PartyModeChallengeMedley/CPartyScreenChallengeMedleyNames.cs +++ b/PartyModes/PartyModeChallengeMedley/CPartyScreenChallengeMedleyNames.cs @@ -24,9 +24,9 @@ using VocaluxeLib.Menu; namespace VocaluxeLib.PartyModes.ChallengeMedley { -// ReSharper disable UnusedMember.Global + // ReSharper disable UnusedMember.Global public class CPartyScreenChallengeMedleyNames : CMenuParty -// ReSharper restore UnusedMember.Global + // ReSharper restore UnusedMember.Global { // Version number for theme files. Increment it, if you've changed something on the theme files! protected override int _ScreenVersion diff --git a/PartyModes/PartyModeTicTacToe/CPartyModeTicTacToe.cs b/PartyModes/PartyModeTicTacToe/CPartyModeTicTacToe.cs index 0e012ee3..69d7c33f 100644 --- a/PartyModes/PartyModeTicTacToe/CPartyModeTicTacToe.cs +++ b/PartyModes/PartyModeTicTacToe/CPartyModeTicTacToe.cs @@ -456,16 +456,16 @@ namespace VocaluxeLib.PartyModes.TicTacToe return _ScreenSongOptions; } -// ReSharper disable RedundantAssignment + // ReSharper disable RedundantAssignment public override void OnSongChange(int songIndex, ref SScreenSongOptions screenSongOptions) -// ReSharper restore RedundantAssignment + // ReSharper restore RedundantAssignment { screenSongOptions = _ScreenSongOptions; } -// ReSharper disable RedundantAssignment + // ReSharper disable RedundantAssignment public override void OnCategoryChange(int categoryIndex, ref SScreenSongOptions screenSongOptions) -// ReSharper restore RedundantAssignment + // ReSharper restore RedundantAssignment { screenSongOptions = _ScreenSongOptions; } diff --git a/PartyModes/PartyModeTicTacToe/CPartyScreenTicTacToeConfig.cs b/PartyModes/PartyModeTicTacToe/CPartyScreenTicTacToeConfig.cs index 516efd76..c563ee48 100644 --- a/PartyModes/PartyModeTicTacToe/CPartyScreenTicTacToeConfig.cs +++ b/PartyModes/PartyModeTicTacToe/CPartyScreenTicTacToeConfig.cs @@ -24,9 +24,9 @@ using VocaluxeLib.Menu; namespace VocaluxeLib.PartyModes.TicTacToe { -// ReSharper disable UnusedMember.Global + // ReSharper disable UnusedMember.Global public class CPartyScreenTicTacToeConfig : CMenuParty -// ReSharper restore UnusedMember.Global + // ReSharper restore UnusedMember.Global { // Version number for theme files. Increment it, if you've changed something on the theme files! protected override int _ScreenVersion @@ -289,7 +289,7 @@ namespace VocaluxeLib.PartyModes.TicTacToe _ConfigOk = false; for (int i = 0; i < CBase.Songs.NumSongsInCategory(_Data.ScreenConfig.CategoryID); i++) { - _ConfigOk=CBase.Songs.GetVisibleSong(i).AvailableGameModes.Any(mode => mode == gm); + _ConfigOk = CBase.Songs.GetVisibleSong(i).AvailableGameModes.Any(mode => mode == gm); if (_ConfigOk) break; } diff --git a/PartyModes/PartyModeTicTacToe/CPartyScreenTicTacToeMain.cs b/PartyModes/PartyModeTicTacToe/CPartyScreenTicTacToeMain.cs index 886a9779..6d1065ed 100644 --- a/PartyModes/PartyModeTicTacToe/CPartyScreenTicTacToeMain.cs +++ b/PartyModes/PartyModeTicTacToe/CPartyScreenTicTacToeMain.cs @@ -353,7 +353,7 @@ namespace VocaluxeLib.PartyModes.TicTacToe { _Texts[_TextFinishMessage].Color = CBase.Theme.GetPlayerColor(winner); _Texts[_TextFinishMessage].Text = CBase.Language.Translate("TR_SCREENMAIN_WINNER", _PartyModeID) + " " + CBase.Language.Translate("TR_TEAM", _PartyModeID) + " " + - winner; + winner; } else { @@ -607,7 +607,7 @@ namespace VocaluxeLib.PartyModes.TicTacToe { _Texts[_TextTeamChoosing].Color = CBase.Theme.GetPlayerColor(_GameData.Team + 1); _Texts[_TextTeamChoosing].Text = CBase.Language.Translate("TR_TEAM", _PartyModeID) + " " + (_GameData.Team + 1) + "! " + - CBase.Language.Translate("TR_SCREENMAIN_TEAM_CHOOSE", _PartyModeID); + CBase.Language.Translate("TR_SCREENMAIN_TEAM_CHOOSE", _PartyModeID); if (_Status == EStatus.JokerRetry || _Status == EStatus.FieldChoosing) _Texts[_TextTeamChoosing].Visible = true; else diff --git a/PartyModes/PartyModeTicTacToe/CPartyScreenTicTacToeNames.cs b/PartyModes/PartyModeTicTacToe/CPartyScreenTicTacToeNames.cs index 6ef12c28..c8e79710 100644 --- a/PartyModes/PartyModeTicTacToe/CPartyScreenTicTacToeNames.cs +++ b/PartyModes/PartyModeTicTacToe/CPartyScreenTicTacToeNames.cs @@ -24,9 +24,9 @@ using VocaluxeLib.Menu; namespace VocaluxeLib.PartyModes.TicTacToe { -// ReSharper disable UnusedMember.Global + // ReSharper disable UnusedMember.Global public class CPartyScreenTicTacToeNames : CMenuParty -// ReSharper restore UnusedMember.Global + // ReSharper restore UnusedMember.Global { // Version number for theme files. Increment it, if you've changed something on the theme files! protected override int _ScreenVersion @@ -405,7 +405,7 @@ namespace VocaluxeLib.PartyModes.TicTacToe _UpdateButtonPlayerChoose(_PlayerChooseButtonsOffset); _Buttons[_ButtonPlayerChooseScrollUp].Enabled = _PlayerChooseButtonsOffset > 0; _Buttons[_ButtonPlayerChooseScrollDown].Enabled = _PlayerChooseButtonsVisibleProfiles.Count > - _PlayerChooseButtons.Count + _PlayerChooseButtonsOffset * _PlayerChooseButtonsNumH; + _PlayerChooseButtons.Count + _PlayerChooseButtonsOffset * _PlayerChooseButtonsNumH; } private void _UpdateButtonPlayerChoose(int offset) diff --git a/Vocaluxe/Base/CBackgroundMusic.cs b/Vocaluxe/Base/CBackgroundMusic.cs index e5eeff57..c968dadf 100644 --- a/Vocaluxe/Base/CBackgroundMusic.cs +++ b/Vocaluxe/Base/CBackgroundMusic.cs @@ -116,7 +116,7 @@ namespace Vocaluxe.Base { get { - if (_CurrentPlaylistElement.Artist.Length > 0 && _CurrentPlaylistElement.Title.Length > 0) + if (_CurrentPlaylistElement.Artist != "" && _CurrentPlaylistElement.Title != "") return _CurrentPlaylistElement.Artist + " - " + _CurrentPlaylistElement.Title; else return Path.GetFileNameWithoutExtension(_CurrentPlaylistElement.MusicFilePath); diff --git a/Vocaluxe/Base/CConfig.cs b/Vocaluxe/Base/CConfig.cs index fa60513a..ed3287be 100644 --- a/Vocaluxe/Base/CConfig.cs +++ b/Vocaluxe/Base/CConfig.cs @@ -505,7 +505,7 @@ namespace Vocaluxe.Base for (int p = 1; p <= CSettings.MaxNumPlayer; p++) { - if (MicConfig[p - 1].DeviceName.Length > 0 && MicConfig[p - 1].InputName.Length > 0 && MicConfig[p - 1].Channel > 0) + if (MicConfig[p - 1].DeviceName != "" && MicConfig[p - 1].InputName != "" && MicConfig[p - 1].Channel > 0) { writer.WriteStartElement("MicConfig" + p); @@ -580,15 +580,15 @@ namespace Vocaluxe.Base if (devices == null) return false; - for (int dev = 0; dev < devices.Length; dev++) + for (int dev = 0; dev < devices.Length; dev++) + { + for (int inp = 0; inp < devices[dev].Inputs.Count; inp++) { - for (int inp = 0; inp < devices[dev].Inputs.Count; inp++) - { - if (devices[dev].Inputs[inp].PlayerChannel1 == player || devices[dev].Inputs[inp].PlayerChannel2 == player) - return true; - } + if (devices[dev].Inputs[inp].PlayerChannel1 == player || devices[dev].Inputs[inp].PlayerChannel2 == player) + return true; } - return false; + } + return false; } /// @@ -689,7 +689,7 @@ namespace Vocaluxe.Base { //Only found a parameter case 1: - if (!Regex.IsMatch(parts[0], @"ReplacedStr:::3:::") && parts[0].Length > 0) + if (!Regex.IsMatch(parts[0], @"ReplacedStr:::3:::") && parts[0] != "") { //Add parameter _Params.Add(parts[0]); @@ -702,7 +702,7 @@ namespace Vocaluxe.Base //Found parameter and value case 2: - if (!Regex.IsMatch(parts[0], @"ReplacedStr:::5:::") && parts[0].Length > 0) + if (!Regex.IsMatch(parts[0], @"ReplacedStr:::5:::") && parts[0] != "") { //Add parameter _Params.Add(parts[0]); @@ -810,7 +810,7 @@ namespace Vocaluxe.Base { for (int j = 0; j < CSettings.MaxNumPlayer; j++) { - if (Players[j].Length > 0) + if (Players[j] != "") { if (Path.GetFileName(CProfiles.Profiles[i].ProfileFile) == Players[j] && CProfiles.Profiles[i].Active == EOffOn.TR_CONFIG_ON) { diff --git a/Vocaluxe/Base/CCover.cs b/Vocaluxe/Base/CCover.cs index f508e73f..d6089808 100644 --- a/Vocaluxe/Base/CCover.cs +++ b/Vocaluxe/Base/CCover.cs @@ -177,7 +177,7 @@ namespace Vocaluxe.Base xmlReader.GetValue("//root/Info/Name", out coverTheme.Name, String.Empty); xmlReader.GetValue("//root/Info/Folder", out coverTheme.Folder, String.Empty); - if (coverTheme.Folder.Length > 0 && coverTheme.Name.Length > 0) + if (coverTheme.Folder != "" && coverTheme.Name != "") { coverTheme.File = file; @@ -239,9 +239,9 @@ namespace Vocaluxe.Base if (_CoverExists(name)) continue; -// ReSharper disable AssignNullToNotNullAttribute + // ReSharper disable AssignNullToNotNullAttribute SCover sk = new SCover {Name = name, Value = Path.Combine(coverTheme.Folder, Path.GetFileName(file))}; -// ReSharper restore AssignNullToNotNullAttribute + // ReSharper restore AssignNullToNotNullAttribute sk.Texture = CDraw.AddTexture(Path.Combine(CSettings.FolderCover, sk.Value)); diff --git a/Vocaluxe/Base/CDataBase.cs b/Vocaluxe/Base/CDataBase.cs index 8f2e1b89..6a41e5fb 100644 --- a/Vocaluxe/Base/CDataBase.cs +++ b/Vocaluxe/Base/CDataBase.cs @@ -174,9 +174,7 @@ namespace Vocaluxe.Base } if (reader != null) - { reader.Dispose(); - } command.CommandText = "INSERT INTO Scores (SongID, PlayerName, Score, LineNr, Date, Medley, Duet, ShortSong, Difficulty) " + "VALUES (@SongID, @PlayerName, @Score, @LineNr, @Date, @Medley, @Duet, @ShortSong, @Difficulty)"; diff --git a/Vocaluxe/Base/CFont.cs b/Vocaluxe/Base/CFont.cs index f5274c6f..10b8f7d0 100644 --- a/Vocaluxe/Base/CFont.cs +++ b/Vocaluxe/Base/CFont.cs @@ -341,9 +341,7 @@ namespace Vocaluxe.Base public static float Height { get { return _Height; } - set { - _Height = value < 0f ? 0f : value; - } + set { _Height = value < 0f ? 0f : value; } } public static float Outline @@ -413,7 +411,7 @@ namespace Vocaluxe.Base if (h <= 0f) return; - if (text.Length == 0) + if (text == "") return; Height = h; @@ -432,7 +430,7 @@ namespace Vocaluxe.Base if (h <= 0f) return; - if (text.Length == 0) + if (text == "") return; Height = h; @@ -451,7 +449,7 @@ namespace Vocaluxe.Base if (h <= 0f) return; - if (text.Length == 0) + if (text == "") return; Height = h; @@ -581,7 +579,7 @@ namespace Vocaluxe.Base { SFont sf = new SFont(); sf.Folder = value; - sf.IsThemeFont = themeName.Length > 0; + sf.IsThemeFont = themeName != ""; sf.ThemeName = themeName; sf.PartyModeID = partyModeId; @@ -631,7 +629,7 @@ namespace Vocaluxe.Base string fontTypes; if (partyModeId >= 0) fontTypes = "theme fonts for party mode"; - else if (themeName.Length > 0) + else if (themeName != "") fontTypes = "theme fonts for theme \"" + themeName + "\""; else fontTypes = "basic fonts"; @@ -747,7 +745,7 @@ namespace Vocaluxe.Base private static int _GetFontIndex(string themeName, string fontName) { - if (themeName.Length == 0 || fontName.Length == 0) + if (themeName == "" || fontName == "") return -1; for (int i = 0; i < _Fonts.Count; i++) @@ -761,7 +759,7 @@ namespace Vocaluxe.Base private static int _GetFontIndexParty(int partyModeID, string fontName) { - if (partyModeID == -1 || fontName.Length == 0) + if (partyModeID == -1 || fontName == "") return -1; for (int i = 0; i < _Fonts.Count; i++) diff --git a/Vocaluxe/Base/CGraphics.cs b/Vocaluxe/Base/CGraphics.cs index 524371ad..88f603cf 100644 --- a/Vocaluxe/Base/CGraphics.cs +++ b/Vocaluxe/Base/CGraphics.cs @@ -772,9 +772,7 @@ namespace Vocaluxe.Base debugOutput.Add(CSongs.NumSongsWithCoverLoaded.ToString(CLanguage.Translate("TR_DEBUG_SONGS") + ": 00000")); if (CConfig.DebugLevel >= EDebugLevel.TR_CONFIG_LEVEL_MAX) - { debugOutput.Add(_Cursor.X.ToString(CLanguage.Translate("TR_DEBUG_MOUSE") + " : (0000/") + _Cursor.Y.ToString("0000)")); - } } } } @@ -783,7 +781,7 @@ namespace Vocaluxe.Base CFonts.Height = 30; SColorF gray = new SColorF(1f, 1f, 1f, 0.5f); float y = 0; - foreach (var txt in debugOutput) + foreach (string txt in debugOutput) { RectangleF rect = new RectangleF(CSettings.RenderW - CFonts.GetTextWidth(txt), y, CFonts.GetTextWidth(txt), CFonts.GetTextHeight(txt)); CDraw.DrawColor(gray, new SRectF(rect.X, rect.Top, rect.Width, rect.Height, CSettings.ZNear)); @@ -796,7 +794,7 @@ namespace Vocaluxe.Base { _Cursor.UnloadTextures(); - if (CTheme.Cursor.Color.Length > 0) + if (CTheme.Cursor.Color != "") { SColorF color; color = CTheme.GetColor(CTheme.Cursor.Color, -1); diff --git a/Vocaluxe/Base/CLog.cs b/Vocaluxe/Base/CLog.cs index b97b8d46..9243d516 100644 --- a/Vocaluxe/Base/CLog.cs +++ b/Vocaluxe/Base/CLog.cs @@ -62,9 +62,9 @@ namespace Vocaluxe.Base if (_LogFile == null) _Open(); -// ReSharper disable PossibleNullReferenceException + // ReSharper disable PossibleNullReferenceException _LogFile.WriteLine(text); -// ReSharper restore PossibleNullReferenceException + // ReSharper restore PossibleNullReferenceException _LogFile.Flush(); } diff --git a/Vocaluxe/Base/CParty.cs b/Vocaluxe/Base/CParty.cs index 4961957e..62c97b72 100644 --- a/Vocaluxe/Base/CParty.cs +++ b/Vocaluxe/Base/CParty.cs @@ -343,10 +343,7 @@ namespace Vocaluxe.Base private static Assembly _CompileFiles(string[] files) { - if (files == null) - return null; - - if (files.Length == 0) + if (files == null || files.Length == 0) return null; CompilerParameters compilerParams = new CompilerParameters(); diff --git a/Vocaluxe/Base/CPlaylists.cs b/Vocaluxe/Base/CPlaylists.cs index 17cc5713..0b6903b7 100644 --- a/Vocaluxe/Base/CPlaylists.cs +++ b/Vocaluxe/Base/CPlaylists.cs @@ -116,7 +116,7 @@ namespace Vocaluxe.Base { if (playlistID < 0 || playlistID >= _Playlists.Count) return; - if (_Playlists[playlistID].PlaylistFile.Length > 0) + if (_Playlists[playlistID].PlaylistFile != "") { try { diff --git a/Vocaluxe/Base/CProfiles.cs b/Vocaluxe/Base/CProfiles.cs index f4542639..3538024a 100644 --- a/Vocaluxe/Base/CProfiles.cs +++ b/Vocaluxe/Base/CProfiles.cs @@ -77,7 +77,7 @@ namespace Vocaluxe.Base profile.GuestProfile = EOffOn.TR_CONFIG_OFF; profile.Active = EOffOn.TR_CONFIG_ON; - if (fileName.Length > 0) + if (fileName != "") profile.ProfileFile = Path.Combine(CSettings.FolderProfiles, fileName); else profile.ProfileFile = String.Empty; @@ -163,7 +163,7 @@ namespace Vocaluxe.Base return String.Empty; SProfile profile = _Profiles[profileNr]; - if (profile.PlayerName.Length > 0) + if (profile.PlayerName != "") profile.PlayerName = profile.PlayerName.Remove(profile.PlayerName.Length - 1); _Profiles[profileNr] = profile; @@ -266,7 +266,7 @@ namespace Vocaluxe.Base { if (profileID < 0 || profileID >= _Profiles.Count) return; - if (_Profiles[profileID].ProfileFile.Length > 0) + if (_Profiles[profileID].ProfileFile != "") { try { @@ -306,7 +306,7 @@ namespace Vocaluxe.Base if (profileID < 0 || profileID >= _Profiles.Count) return; - if (_Profiles[profileID].ProfileFile.Length == 0) + if (_Profiles[profileID].ProfileFile == "") { string filename = string.Empty; foreach (char chr in _Profiles[profileID].PlayerName) @@ -315,7 +315,7 @@ namespace Vocaluxe.Base filename += chr.ToString(); } - if (filename.Length == 0) + if (filename == "") filename = "1"; int i = 0; diff --git a/Vocaluxe/Base/CSettings.cs b/Vocaluxe/Base/CSettings.cs index cbf890e2..f69c922b 100644 --- a/Vocaluxe/Base/CSettings.cs +++ b/Vocaluxe/Base/CSettings.cs @@ -148,9 +148,9 @@ namespace Vocaluxe.Base VersionMinor + "." + VersionSub + " (" + Arch + ")"; -// ReSharper disable ConditionIsAlwaysTrueOrFalse + // ReSharper disable ConditionIsAlwaysTrueOrFalse if (VersionRevision != ERevision.Release) -// ReSharper restore ConditionIsAlwaysTrueOrFalse + // ReSharper restore ConditionIsAlwaysTrueOrFalse version += " " + _GetVersionStatus() + String.Format(" ({0:0000)}", Build); return version; @@ -160,7 +160,7 @@ namespace Vocaluxe.Base { string version = ProgramName; - if (ProgramCodeName.Length > 0) + if (ProgramCodeName != "") version += " \"" + ProgramCodeName + "\""; return version + " " + GetVersionText(); @@ -170,9 +170,9 @@ namespace Vocaluxe.Base { string result; -// ReSharper disable ConditionIsAlwaysTrueOrFalse + // ReSharper disable ConditionIsAlwaysTrueOrFalse if (VersionRevision != ERevision.Release) -// ReSharper restore ConditionIsAlwaysTrueOrFalse + // ReSharper restore ConditionIsAlwaysTrueOrFalse result = Enum.GetName(typeof(ERevision), VersionRevision); return result; diff --git a/Vocaluxe/Base/CSongCategorizer.cs b/Vocaluxe/Base/CSongCategorizer.cs index 425adf78..a9aedb6b 100644 --- a/Vocaluxe/Base/CSongCategorizer.cs +++ b/Vocaluxe/Base/CSongCategorizer.cs @@ -98,7 +98,7 @@ namespace Vocaluxe.Base int noCategoryIndex = -1; for (int i = 0; i < CSongs.Sorter.SortedSongs.Length; i++) { - if (CSongs.Sorter.SortedSongs[i].SortString.Length > 0) + if (CSongs.Sorter.SortedSongs[i].SortString != "") { if (CSongs.Sorter.SortedSongs[i].SortString != category) { @@ -154,7 +154,7 @@ namespace Vocaluxe.Base for (int i = 0; i < CSongs.Sorter.SortedSongs.Length; i++) { string year = CSongs.Sorter.SortedSongs[i].SortString; - if (year.Length > 0) + if (year != "") { year = year.Substring(0, 3); CSongs.Sorter.SortedSongs[i].SortString = year + "0 - " + year + "9"; diff --git a/Vocaluxe/Base/CSongFilter.cs b/Vocaluxe/Base/CSongFilter.cs index c5e6fd9f..c031695a 100644 --- a/Vocaluxe/Base/CSongFilter.cs +++ b/Vocaluxe/Base/CSongFilter.cs @@ -84,7 +84,7 @@ namespace Vocaluxe.Base _FilteredSongs.Clear(); string[] searchStrings = null; - if (_SearchString.Length > 0) + if (_SearchString != "") searchStrings = _SearchString.ToUpper().Split(new char[] {' '}); foreach (CSong song in CSongs.Songs) diff --git a/Vocaluxe/Base/CSongSorter.cs b/Vocaluxe/Base/CSongSorter.cs index 1a4d569e..7e589b2a 100644 --- a/Vocaluxe/Base/CSongSorter.cs +++ b/Vocaluxe/Base/CSongSorter.cs @@ -125,14 +125,14 @@ namespace Vocaluxe.Base private List _CreateSortList(string fieldName) { List sortList = new List(); - if (fieldName.Length == 0) + if (fieldName == "") CSongs.Filter.FilteredSongs.ForEach(song => sortList.Add(new SSongPointer(song.ID, ""))); else { FieldInfo field = typeof(CSong).GetField(fieldName, BindingFlags.Instance | BindingFlags.DeclaredOnly | BindingFlags.Public); if (field == null) { - CLog.LogError("Unknow sorting field: "+fieldName); + CLog.LogError("Unknow sorting field: " + fieldName); return _CreateSortList(""); } bool isString = field.FieldType == typeof(string); diff --git a/Vocaluxe/Base/CSound.cs b/Vocaluxe/Base/CSound.cs index 6cb30fc7..6b09af30 100644 --- a/Vocaluxe/Base/CSound.cs +++ b/Vocaluxe/Base/CSound.cs @@ -183,7 +183,7 @@ namespace Vocaluxe.Base break; } - if (file.Length == 0) + if (file == "") return -1; int stream = Load(file); diff --git a/Vocaluxe/Base/CTheme.cs b/Vocaluxe/Base/CTheme.cs index 81fe6739..c61499f3 100644 --- a/Vocaluxe/Base/CTheme.cs +++ b/Vocaluxe/Base/CTheme.cs @@ -426,7 +426,7 @@ namespace Vocaluxe.Base if (version == _ThemeSystemVersion) { xmlReader.GetValue("//root/Info/Name", out theme.Name, String.Empty); - if (theme.Name.Length > 0) + if (theme.Name != "") { xmlReader.GetValue("//root/Info/Author", out theme.Author, String.Empty); xmlReader.GetValue("//root/Info/SkinFolder", out theme.SkinFolder, String.Empty); @@ -493,7 +493,7 @@ namespace Vocaluxe.Base if (version == _SkinSystemVersion) { xmlReader.GetValue("//root/Info/Name", out skin.Name, String.Empty); - if (skin.Name.Length > 0) + if (skin.Name != "") { xmlReader.GetValue("//root/Info/Author", out skin.Author, String.Empty); xmlReader.TryGetIntValue("//root/Info/SkinVersionMajor", ref skin.SkinVersionMajor); @@ -835,7 +835,7 @@ namespace Vocaluxe.Base writer.WriteElementString("W", Cursor.W.ToString("#0.000")); writer.WriteElementString("H", Cursor.H.ToString("#0.000")); - if (Cursor.Color.Length > 0) + if (Cursor.Color != "") writer.WriteElementString("Color", Cursor.Color); else { diff --git a/Vocaluxe/Base/CWebcam.cs b/Vocaluxe/Base/CWebcam.cs index 74995990..0a361c68 100644 --- a/Vocaluxe/Base/CWebcam.cs +++ b/Vocaluxe/Base/CWebcam.cs @@ -86,5 +86,10 @@ namespace Vocaluxe.Base { return _Webcam.GetDevices(); } + + public static bool IsDeviceAvailable() + { + return _Webcam.IsDeviceAvailable(); + } } } \ No newline at end of file diff --git a/Vocaluxe/GameModes/CGameModeNormal.cs b/Vocaluxe/GameModes/CGameModeNormal.cs index 31375949..e728a923 100644 --- a/Vocaluxe/GameModes/CGameModeNormal.cs +++ b/Vocaluxe/GameModes/CGameModeNormal.cs @@ -20,6 +20,5 @@ namespace Vocaluxe.GameModes { // Nomal singing - class CGameModeNormal : CGameMode - {} + class CGameModeNormal : CGameMode {} } \ No newline at end of file diff --git a/Vocaluxe/Lib/Draw/CDrawWinForm.cs b/Vocaluxe/Lib/Draw/CDrawWinForm.cs index 7aa33fca..bd2756c4 100644 --- a/Vocaluxe/Lib/Draw/CDrawWinForm.cs +++ b/Vocaluxe/Lib/Draw/CDrawWinForm.cs @@ -346,7 +346,7 @@ namespace Vocaluxe.Lib.Draw } // Draw Basic Text - public void DrawText(string text, int x, int y, int h, int z=0) + public void DrawText(string text, int x, int y, int h, int z = 0) { CFonts.DrawText(text, h, x, y, z, new SColorF(1, 1, 1, 1)); } diff --git a/Vocaluxe/Lib/Draw/COpenGL.cs b/Vocaluxe/Lib/Draw/COpenGL.cs index 4ef1bc67..54056001 100644 --- a/Vocaluxe/Lib/Draw/COpenGL.cs +++ b/Vocaluxe/Lib/Draw/COpenGL.cs @@ -142,7 +142,7 @@ namespace Vocaluxe.Lib.Draw if (setValue > 32) setValue = 32; - while (samples<=setValue) + while (samples <= setValue) { GraphicsMode mode; try @@ -563,7 +563,7 @@ namespace Vocaluxe.Lib.Draw public void DrawLine(int a, int r, int g, int b, int w, int x1, int y1, int x2, int y2) {} // Draw Basic Text (must be deleted later) - public void DrawText(string text, int x, int y, int h, int z=0) + public void DrawText(string text, int x, int y, int h, int z = 0) { CFonts.DrawText(text, h, x, y, z, new SColorF(1, 1, 1, 1)); } @@ -1094,7 +1094,8 @@ namespace Vocaluxe.Lib.Draw public void DrawTexture(STexture texture, SRectF rect, SColorF color, SRectF bounds, bool mirrored) { - if (Math.Abs(rect.W) < float.Epsilon || Math.Abs(rect.H) < float.Epsilon || Math.Abs(bounds.H) < float.Epsilon || Math.Abs(bounds.W) < float.Epsilon || Math.Abs(color.A) < float.Epsilon) + if (Math.Abs(rect.W) < float.Epsilon || Math.Abs(rect.H) < float.Epsilon || Math.Abs(bounds.H) < float.Epsilon || Math.Abs(bounds.W) < float.Epsilon || + Math.Abs(color.A) < float.Epsilon) return; if (bounds.X > rect.X + rect.W || bounds.X + bounds.W < rect.X) @@ -1233,7 +1234,8 @@ namespace Vocaluxe.Lib.Draw public void DrawTextureReflection(STexture texture, SRectF rect, SColorF color, SRectF bounds, float space, float height) { - if (Math.Abs(rect.W) < float.Epsilon || Math.Abs(rect.H) < float.Epsilon || Math.Abs(bounds.H) < float.Epsilon || Math.Abs(bounds.W) < float.Epsilon || Math.Abs(color.A) < float.Epsilon || height <= float.Epsilon) + if (Math.Abs(rect.W) < float.Epsilon || Math.Abs(rect.H) < float.Epsilon || Math.Abs(bounds.H) < float.Epsilon || Math.Abs(bounds.W) < float.Epsilon || + Math.Abs(color.A) < float.Epsilon || height <= float.Epsilon) return; if (bounds.X > rect.X + rect.W || bounds.X + bounds.W < rect.X) diff --git a/Vocaluxe/Lib/Draw/IDraw.cs b/Vocaluxe/Lib/Draw/IDraw.cs index 728c4ea9..6da270b0 100644 --- a/Vocaluxe/Lib/Draw/IDraw.cs +++ b/Vocaluxe/Lib/Draw/IDraw.cs @@ -46,7 +46,7 @@ namespace Vocaluxe.Lib.Draw void MakeScreenShot(); // Draw Basic Text (must be deleted later) - void DrawText(string text, int x, int y, int h, int z=0); + void DrawText(string text, int x, int y, int h, int z = 0); STexture AddTexture(string texturePath); STexture AddTexture(Bitmap bitmap); diff --git a/Vocaluxe/Lib/Playlist/CPlaylistFile.cs b/Vocaluxe/Lib/Playlist/CPlaylistFile.cs index c1273112..58d57c00 100644 --- a/Vocaluxe/Lib/Playlist/CPlaylistFile.cs +++ b/Vocaluxe/Lib/Playlist/CPlaylistFile.cs @@ -59,7 +59,7 @@ namespace Vocaluxe.Lib.Playlist public void SavePlaylist() { - if (PlaylistFile.Length == 0) + if (PlaylistFile == "") { string filename = string.Empty; foreach (char chr in PlaylistName) @@ -68,7 +68,7 @@ namespace Vocaluxe.Lib.Playlist filename += chr.ToString(); } - if (filename.Length == 0) + if (filename == "") filename = "1"; int i = 0; @@ -146,7 +146,8 @@ namespace Vocaluxe.Lib.Playlist List songs = xmlReader.GetValues("Songs"); EGameMode gm = EGameMode.TR_GAMEMODE_NORMAL; - foreach (string song in songs) { + foreach (string song in songs) + { string artist; string title; xmlReader.GetValue("//root/Songs/" + song + "/Artist", out artist, String.Empty); @@ -157,7 +158,8 @@ namespace Vocaluxe.Lib.Playlist playlistSong.SongID = -1; CSong[] allSongs = CSongs.AllSongs; - foreach (CSong curSong in allSongs) { + foreach (CSong curSong in allSongs) + { if (curSong.Artist != artist || curSong.Title != title) continue; playlistSong.SongID = curSong.ID; diff --git a/Vocaluxe/Lib/Sound/COpenALPlay.cs b/Vocaluxe/Lib/Sound/COpenALPlay.cs index 775b6ca5..f9616987 100644 --- a/Vocaluxe/Lib/Sound/COpenALPlay.cs +++ b/Vocaluxe/Lib/Sound/COpenALPlay.cs @@ -844,7 +844,7 @@ namespace Vocaluxe.Lib.Sound if (buffer != 0) { - ALFormat alFormat = (_Format.ChannelCount == 2)?ALFormat.Stereo16:ALFormat.Mono16; + ALFormat alFormat = (_Format.ChannelCount == 2) ? ALFormat.Stereo16 : ALFormat.Mono16; AL.BufferData(buffer, alFormat, buf, buf.Length, _Format.SamplesPerSecond); Console.WriteLine("Write to Buffer: " + buffer); AL.SourceQueueBuffer(_Source, buffer); diff --git a/Vocaluxe/Lib/Sound/CPortAudioRecord.cs b/Vocaluxe/Lib/Sound/CPortAudioRecord.cs index b39c3eee..fab75e12 100644 --- a/Vocaluxe/Lib/Sound/CPortAudioRecord.cs +++ b/Vocaluxe/Lib/Sound/CPortAudioRecord.cs @@ -120,19 +120,16 @@ namespace Vocaluxe.Lib.Sound if (deviceConfig == null) return false; - if (_RecHandle == null) + if (_RecHandle == null || _RecHandle.Length == 0) return false; - if (_RecHandle.Length == 0) - return false; + foreach (CBuffer buffer in _Buffer) + buffer.Reset(); - for (int i = 0; i < _Buffer.Length; i++) - _Buffer[i].Reset(); - - for (int i = 0; i < _RecHandle.Length; i++) + foreach (IntPtr handle in _RecHandle) { int waitcount = 0; - while (waitcount < 5 && CPortAudio.Pa_IsStreamStopped(_RecHandle[i]) == CPortAudio.EPaError.PaStreamIsNotStopped) + while (waitcount < 5 && CPortAudio.Pa_IsStreamStopped(handle) == CPortAudio.EPaError.PaStreamIsNotStopped) { Thread.Sleep(1); waitcount++; diff --git a/Vocaluxe/Lib/Sound/Decoder/CAudioDecoderFFmpeg.cs b/Vocaluxe/Lib/Sound/Decoder/CAudioDecoderFFmpeg.cs index 3bdd388c..6f40c539 100644 --- a/Vocaluxe/Lib/Sound/Decoder/CAudioDecoderFFmpeg.cs +++ b/Vocaluxe/Lib/Sound/Decoder/CAudioDecoderFFmpeg.cs @@ -36,9 +36,7 @@ namespace Vocaluxe.Lib.Sound.Decoder private string _FileName; private bool _FileOpened; - public void Init() - { - } + public void Init() {} public void Open(string fileName, bool loop) { diff --git a/Vocaluxe/Lib/Sound/Decoder/IAudioDecoder.cs b/Vocaluxe/Lib/Sound/Decoder/IAudioDecoder.cs index c98b66ec..55c21761 100644 --- a/Vocaluxe/Lib/Sound/Decoder/IAudioDecoder.cs +++ b/Vocaluxe/Lib/Sound/Decoder/IAudioDecoder.cs @@ -31,7 +31,7 @@ namespace Vocaluxe.Lib.Sound.Decoder void Init(); void Close(); - void Open(string fileName, bool loop=false); + void Open(string fileName, bool loop = false); SFormatInfo GetFormatInfo(); float GetLength(); diff --git a/Vocaluxe/Lib/Sound/Portaudio/PortAudio.cs b/Vocaluxe/Lib/Sound/Portaudio/PortAudio.cs index 7adfb7c1..d80d4cac 100644 --- a/Vocaluxe/Lib/Sound/Portaudio/PortAudio.cs +++ b/Vocaluxe/Lib/Sound/Portaudio/PortAudio.cs @@ -28,7 +28,7 @@ namespace Vocaluxe.Lib.Sound.PortAudio */ - public static partial class CPortAudio + public static class CPortAudio { #region **** PORTAUDIO CALLBACKS **** [UnmanagedFunctionPointer(CallingConvention.Cdecl)] diff --git a/Vocaluxe/Lib/Video/Acinerella/CAcinerella.cs b/Vocaluxe/Lib/Video/Acinerella/CAcinerella.cs index 32eafb4f..3851b485 100644 --- a/Vocaluxe/Lib/Video/Acinerella/CAcinerella.cs +++ b/Vocaluxe/Lib/Video/Acinerella/CAcinerella.cs @@ -141,6 +141,7 @@ namespace Vocaluxe.Lib.Video.Acinerella //Size of the data in the buffer. public readonly Int32 BufferSize; } + // Contains information about an Acinerella package. [StructLayout(LayoutKind.Sequential)] public struct SACPackage @@ -278,9 +279,9 @@ namespace Vocaluxe.Lib.Video.Acinerella string filename ); -// ReSharper disable UnusedMethodReturnValue.Global + // ReSharper disable UnusedMethodReturnValue.Global public static Int32 AcOpen2( -// ReSharper restore UnusedMethodReturnValue.Global + // ReSharper restore UnusedMethodReturnValue.Global IntPtr pAcInstance, string filename ) @@ -430,9 +431,9 @@ namespace Vocaluxe.Lib.Video.Acinerella [DllImport(_AcDll, EntryPoint = "ac_seek", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Auto)] private static extern Int32 _ac_seek(IntPtr pAcDecoder, Int32 dir, Int64 targetPos); -// ReSharper disable UnusedMethodReturnValue.Global + // ReSharper disable UnusedMethodReturnValue.Global public static Int32 AcSeek(IntPtr pAcDecoder, Int32 dir, Int64 targetPos) -// ReSharper restore UnusedMethodReturnValue.Global + // ReSharper restore UnusedMethodReturnValue.Global { lock (_Lock) { @@ -450,5 +451,6 @@ namespace Vocaluxe.Lib.Video.Acinerella out Int32 scoreMax ); } + // ReSharper restore UnusedMember.Global } \ No newline at end of file diff --git a/Vocaluxe/Lib/Video/CVideoDecoderFFmpeg.cs b/Vocaluxe/Lib/Video/CVideoDecoderFFmpeg.cs index aa998ad0..38c57cce 100644 --- a/Vocaluxe/Lib/Video/CVideoDecoderFFmpeg.cs +++ b/Vocaluxe/Lib/Video/CVideoDecoderFFmpeg.cs @@ -262,10 +262,7 @@ namespace Vocaluxe.Lib.Video public float Length { - get - { - return _FileOpened ? _Duration : 0f; - } + get { return _FileOpened ? _Duration : 0f; } } public bool Paused diff --git a/Vocaluxe/Lib/Video/Gstreamer/CGstreamerVideoWrapper.cs b/Vocaluxe/Lib/Video/Gstreamer/CGstreamerVideoWrapper.cs index 5a863adc..c5cb5020 100644 --- a/Vocaluxe/Lib/Video/Gstreamer/CGstreamerVideoWrapper.cs +++ b/Vocaluxe/Lib/Video/Gstreamer/CGstreamerVideoWrapper.cs @@ -24,7 +24,7 @@ namespace Vocaluxe.Lib.Video.Gstreamer { public struct SNativeFrame { -// ReSharper disable UnassignedField.Global + // ReSharper disable UnassignedField.Global internal IntPtr Buffer; public int Size; public int Width; diff --git a/Vocaluxe/Lib/Webcam/CAForgeNet.cs b/Vocaluxe/Lib/Webcam/CAForgeNet.cs index 20d25328..35926e50 100644 --- a/Vocaluxe/Lib/Webcam/CAForgeNet.cs +++ b/Vocaluxe/Lib/Webcam/CAForgeNet.cs @@ -101,7 +101,8 @@ namespace Vocaluxe.Lib.Webcam num++; VideoCaptureDevice tmpdev = new VideoCaptureDevice(info.MonikerString); - foreach (VideoCapabilities capabilities in tmpdev.VideoCapabilities) { + foreach (VideoCapabilities capabilities in tmpdev.VideoCapabilities) + { SCapabilities item = new SCapabilities { Framerate = capabilities.FrameRate, @@ -162,6 +163,11 @@ namespace Vocaluxe.Lib.Webcam return _Devices.ToArray(); } + public bool IsDeviceAvailable() + { + return _Devices.Count > 0; + } + public bool Select(SWebcamConfig config) { //Close old camera connection diff --git a/Vocaluxe/Lib/Webcam/IWebcam.cs b/Vocaluxe/Lib/Webcam/IWebcam.cs index 7e138b79..15dd403d 100644 --- a/Vocaluxe/Lib/Webcam/IWebcam.cs +++ b/Vocaluxe/Lib/Webcam/IWebcam.cs @@ -59,6 +59,7 @@ namespace Vocaluxe.Lib.Webcam Bitmap GetBitmap(); SWebcamConfig GetConfig(); SWebcamDevice[] GetDevices(); + bool IsDeviceAvailable(); bool Select(SWebcamConfig webcamConfig); } diff --git a/Vocaluxe/Screens/CPopupScreenPlayerControl.cs b/Vocaluxe/Screens/CPopupScreenPlayerControl.cs index 4f56232b..fd38ee1a 100644 --- a/Vocaluxe/Screens/CPopupScreenPlayerControl.cs +++ b/Vocaluxe/Screens/CPopupScreenPlayerControl.cs @@ -90,7 +90,7 @@ namespace Vocaluxe.Screens _ThemeStatics = new string[] {_StaticBG, _StaticCover}; _ThemeTexts = new string[] {_TextCurrentSong}; - _ThemeButtons = new string[]{_ButtonPlay,_ButtonPause,_ButtonPrevious,_ButtonNext,_ButtonRepeat,_ButtonShowVideo,_ButtonSing,_ButtonToBackgroundVideo}; + _ThemeButtons = new string[] {_ButtonPlay, _ButtonPause, _ButtonPrevious, _ButtonNext, _ButtonRepeat, _ButtonShowVideo, _ButtonSing, _ButtonToBackgroundVideo}; } public override void LoadTheme(string xmlPath) diff --git a/Vocaluxe/Screens/CScreenLoad.cs b/Vocaluxe/Screens/CScreenLoad.cs index 61c25afb..4d7dec77 100644 --- a/Vocaluxe/Screens/CScreenLoad.cs +++ b/Vocaluxe/Screens/CScreenLoad.cs @@ -105,8 +105,8 @@ namespace Vocaluxe.Screens _SongLoaderThread = new Thread(CSongs.LoadSongs) {Name = "SongLoader"}; _Texts[_TextStatus].Text = CLanguage.Translate("TR_SCREENLOAD_TOTAL") + ": 0 " + - CLanguage.Translate("TR_SCREENLOAD_SONGS") + " (0 " + - CLanguage.Translate("TR_SCREENLOAD_LOADED") + ")"; + CLanguage.Translate("TR_SCREENLOAD_SONGS") + " (0 " + + CLanguage.Translate("TR_SCREENLOAD_LOADED") + ")"; _SkipIntro = false; _CurrentIntroVideoNr = -1; diff --git a/Vocaluxe/Screens/CScreenMain.cs b/Vocaluxe/Screens/CScreenMain.cs index e44b3950..807ec508 100644 --- a/Vocaluxe/Screens/CScreenMain.cs +++ b/Vocaluxe/Screens/CScreenMain.cs @@ -124,7 +124,7 @@ namespace Vocaluxe.Screens return true; } -// ReSharper disable RedundantOverridenMember + // ReSharper disable RedundantOverridenMember public override void OnShow() { base.OnShow(); @@ -132,7 +132,8 @@ namespace Vocaluxe.Screens //if (Snowflakes != null) // Snowflakes.Resume(); } -// ReSharper restore RedundantOverridenMember + + // ReSharper restore RedundantOverridenMember public override bool UpdateGame() { @@ -150,9 +151,9 @@ namespace Vocaluxe.Screens //Snowflakes.Draw(); _DrawFG(); -// ReSharper disable ConditionIsAlwaysTrueOrFalse + // ReSharper disable ConditionIsAlwaysTrueOrFalse if (CSettings.VersionRevision != ERevision.Release) -// ReSharper restore ConditionIsAlwaysTrueOrFalse + // ReSharper restore ConditionIsAlwaysTrueOrFalse { CFonts.SetFont("Normal"); CFonts.Style = EStyle.Normal; @@ -162,7 +163,7 @@ namespace Vocaluxe.Screens return true; } -// ReSharper disable RedundantOverridenMember + // ReSharper disable RedundantOverridenMember public override void OnClose() { base.OnClose(); @@ -170,6 +171,7 @@ namespace Vocaluxe.Screens //if (Snowflakes != null) // Snowflakes.Pause(); } -// ReSharper restore RedundantOverridenMember + + // ReSharper restore RedundantOverridenMember } } \ No newline at end of file diff --git a/Vocaluxe/Screens/CScreenNames.cs b/Vocaluxe/Screens/CScreenNames.cs index 12cead30..70cfaa8d 100644 --- a/Vocaluxe/Screens/CScreenNames.cs +++ b/Vocaluxe/Screens/CScreenNames.cs @@ -375,7 +375,8 @@ namespace Vocaluxe.Screens { processed = true; CGraphics.FadeTo(EScreens.ScreenSong); - }else + } + else { processed = true; _StartSong(); @@ -511,12 +512,10 @@ namespace Vocaluxe.Screens if (mouseEvent.LB && _IsMouseOver(mouseEvent)) { if (_Buttons[_ButtonBack].Selected) - { CGraphics.FadeTo(EScreens.ScreenSong); - }else if (_Buttons[_ButtonStart].Selected) - { + else if (_Buttons[_ButtonStart].Selected) _StartSong(); - }else + else _UpdatePlayerNumber(); //Update Tiles-List _NameSelections[_NameSelection].UpdateList(); @@ -587,7 +586,7 @@ namespace Vocaluxe.Screens for (int i = 0; i < CSettings.MaxNumPlayer; i++) { //Update texture and name - if (CConfig.Players[i].Length > 0) + if (CConfig.Players[i] != "") { if (CGame.Player[i].ProfileID > -1 && CProfiles.NumProfiles > CGame.Player[i].ProfileID) { @@ -675,7 +674,7 @@ namespace Vocaluxe.Screens _Statics["StaticPlayer" + i].Visible = true; _Statics["StaticPlayerAvatar" + i].Visible = true; _Texts["TextPlayer" + i].Visible = true; - if (_Texts["TextPlayer" + i].Text.Length == 0) + if (_Texts["TextPlayer" + i].Text == "") _Texts["TextPlayer" + i].Text = CLanguage.Translate("TR_SCREENNAMES_PLAYER") + " " + i; _Equalizers["EqualizerPlayer" + i].Visible = true; if (CGame.GetNumSongs() == 1 && CGame.GetSong(1).IsDuet) diff --git a/Vocaluxe/Screens/CScreenOptionsVideo.cs b/Vocaluxe/Screens/CScreenOptionsVideo.cs index 7583df7b..3367edc2 100644 --- a/Vocaluxe/Screens/CScreenOptionsVideo.cs +++ b/Vocaluxe/Screens/CScreenOptionsVideo.cs @@ -175,42 +175,40 @@ namespace Vocaluxe.Screens SWebcamDevice[] devices = CWebcam.GetDevices(); + bool ssVisible = false; try { - if (devices != null) + if (devices != null && devices.Length > 0) { - if (devices.Length > 0) - { - _DeviceNr = 0; - _CapabilityNr = 0; - _GetFirstConfiguredWebcamDevice(ref _DeviceNr, ref _CapabilityNr); + _DeviceNr = 0; + _CapabilityNr = 0; + _GetFirstConfiguredWebcamDevice(ref _DeviceNr, ref _CapabilityNr); - foreach (SWebcamDevice d in devices) - _SelectSlides[_SelectSlideWebcamDevices].AddValue(d.Name); - _SelectSlides[_SelectSlideWebcamDevices].Selection = _DeviceNr; + foreach (SWebcamDevice d in devices) + _SelectSlides[_SelectSlideWebcamDevices].AddValue(d.Name); + _SelectSlides[_SelectSlideWebcamDevices].Selection = _DeviceNr; - foreach (SCapabilities c in devices[_DeviceNr].Capabilities) - _SelectSlides[_SelectSlideWebcamCapabilities].AddValue(c.Width + " x " + c.Height + " @ " + c.Framerate + " FPS "); - _Config.MonikerString = devices[_SelectSlides[_SelectSlideWebcamDevices].Selection].MonikerString; - _Config.Width = devices[_SelectSlides[_SelectSlideWebcamDevices].Selection].Capabilities[_SelectSlides[_SelectSlideWebcamCapabilities].Selection].Width; - _Config.Height = devices[_SelectSlides[_SelectSlideWebcamDevices].Selection].Capabilities[_SelectSlides[_SelectSlideWebcamCapabilities].Selection].Height; - _Config.Framerate = - devices[_SelectSlides[_SelectSlideWebcamDevices].Selection].Capabilities[_SelectSlides[_SelectSlideWebcamCapabilities].Selection].Framerate; - CWebcam.Close(); - CWebcam.Select(CConfig.WebcamConfig); - CWebcam.Start(); - } + foreach (SCapabilities c in devices[_DeviceNr].Capabilities) + _SelectSlides[_SelectSlideWebcamCapabilities].AddValue(c.Width + " x " + c.Height + " @ " + c.Framerate + " FPS "); + _Config.MonikerString = devices[_SelectSlides[_SelectSlideWebcamDevices].Selection].MonikerString; + _Config.Width = devices[_SelectSlides[_SelectSlideWebcamDevices].Selection].Capabilities[_SelectSlides[_SelectSlideWebcamCapabilities].Selection].Width; + _Config.Height = devices[_SelectSlides[_SelectSlideWebcamDevices].Selection].Capabilities[_SelectSlides[_SelectSlideWebcamCapabilities].Selection].Height; + _Config.Framerate = + devices[_SelectSlides[_SelectSlideWebcamDevices].Selection].Capabilities[_SelectSlides[_SelectSlideWebcamCapabilities].Selection].Framerate; + CWebcam.Close(); + CWebcam.Select(CConfig.WebcamConfig); + CWebcam.Start(); + ssVisible = true; } } catch (Exception e) { CLog.LogError("Error on listing webcam capabilities: " + e.Message); - devices = null; } - _SelectSlides[_SelectSlideWebcamDevices].Visible = devices != null && devices.Length > 0; - _SelectSlides[_SelectSlideWebcamCapabilities].Visible = devices != null && devices.Length > 0; - _Statics[_StaticWebcamOutput].Visible = devices != null && devices.Length > 0; + _SelectSlides[_SelectSlideWebcamDevices].Visible = ssVisible; + _SelectSlides[_SelectSlideWebcamCapabilities].Visible = ssVisible; + _Statics[_StaticWebcamOutput].Visible = ssVisible; } private void _SaveConfig() @@ -234,18 +232,18 @@ namespace Vocaluxe.Screens _DeviceNr = _SelectSlides[_SelectSlideWebcamDevices].Selection; _CapabilityNr = 0; - SWebcamDevice[] d = CWebcam.GetDevices(); - for (int i = 0; i < d[_SelectSlides[_SelectSlideWebcamDevices].Selection].Capabilities.Count; i++) + SWebcamDevice d = CWebcam.GetDevices()[_DeviceNr]; + for (int i = 0; i < d.Capabilities.Count; i++) { - _SelectSlides[_SelectSlideWebcamCapabilities].AddValue(d[_DeviceNr].Capabilities[i].Width + " x " + d[_DeviceNr].Capabilities[i].Height + - " @ " + d[_DeviceNr].Capabilities[i].Framerate + "FPS"); + _SelectSlides[_SelectSlideWebcamCapabilities].AddValue(d.Capabilities[i].Width + " x " + d.Capabilities[i].Height + + " @ " + d.Capabilities[i].Framerate + "FPS"); } _SelectSlides[_SelectSlideWebcamCapabilities].Selection = 0; - _Config.MonikerString = d[_SelectSlides[_SelectSlideWebcamDevices].Selection].MonikerString; - _Config.Width = d[_SelectSlides[_SelectSlideWebcamDevices].Selection].Capabilities[_SelectSlides[_SelectSlideWebcamCapabilities].Selection].Width; - _Config.Height = d[_SelectSlides[_SelectSlideWebcamDevices].Selection].Capabilities[_SelectSlides[_SelectSlideWebcamCapabilities].Selection].Height; - _Config.Framerate = d[_SelectSlides[_SelectSlideWebcamDevices].Selection].Capabilities[_SelectSlides[_SelectSlideWebcamCapabilities].Selection].Framerate; + _Config.MonikerString = d.MonikerString; + _Config.Width = d.Capabilities[_SelectSlides[_SelectSlideWebcamCapabilities].Selection].Width; + _Config.Height = d.Capabilities[_SelectSlides[_SelectSlideWebcamCapabilities].Selection].Height; + _Config.Framerate = d.Capabilities[_SelectSlides[_SelectSlideWebcamCapabilities].Selection].Framerate; CWebcam.Close(); CWebcam.Select(_Config); @@ -259,11 +257,11 @@ namespace Vocaluxe.Screens { _CapabilityNr = _SelectSlides[_SelectSlideWebcamCapabilities].Selection; - SWebcamDevice[] d = CWebcam.GetDevices(); - _Config.MonikerString = d[_SelectSlides[_SelectSlideWebcamDevices].Selection].MonikerString; - _Config.Width = d[_SelectSlides[_SelectSlideWebcamDevices].Selection].Capabilities[_SelectSlides[_SelectSlideWebcamCapabilities].Selection].Width; - _Config.Height = d[_SelectSlides[_SelectSlideWebcamDevices].Selection].Capabilities[_SelectSlides[_SelectSlideWebcamCapabilities].Selection].Height; - _Config.Framerate = d[_SelectSlides[_SelectSlideWebcamDevices].Selection].Capabilities[_SelectSlides[_SelectSlideWebcamCapabilities].Selection].Framerate; + SWebcamDevice d = CWebcam.GetDevices()[_SelectSlides[_SelectSlideWebcamDevices].Selection]; + _Config.MonikerString = d.MonikerString; + _Config.Width = d.Capabilities[_SelectSlides[_SelectSlideWebcamCapabilities].Selection].Width; + _Config.Height = d.Capabilities[_SelectSlides[_SelectSlideWebcamCapabilities].Selection].Height; + _Config.Framerate = d.Capabilities[_SelectSlides[_SelectSlideWebcamCapabilities].Selection].Framerate; CWebcam.Close(); CWebcam.Select(_Config); @@ -280,17 +278,16 @@ namespace Vocaluxe.Screens for (int i = 0; i < devices.Length; i++) { - if (devices[i].MonikerString == CConfig.WebcamConfig.MonikerString) + if (devices[i].MonikerString != CConfig.WebcamConfig.MonikerString) + continue; + for (int j = 0; j < devices[i].Capabilities.Count; j++) { - for (int j = 0; j < devices[i].Capabilities.Count; j++) + if (devices[i].Capabilities[j].Framerate == CConfig.WebcamConfig.Framerate && devices[i].Capabilities[j].Width == CConfig.WebcamConfig.Width && + devices[i].Capabilities[j].Height == CConfig.WebcamConfig.Height) { - if (devices[i].Capabilities[j].Framerate == CConfig.WebcamConfig.Framerate && devices[i].Capabilities[j].Width == CConfig.WebcamConfig.Width && - devices[i].Capabilities[j].Height == CConfig.WebcamConfig.Height) - { - device = i; - capabilities = j; - return; - } + device = i; + capabilities = j; + return; } } } diff --git a/Vocaluxe/Screens/CScreenProfiles.cs b/Vocaluxe/Screens/CScreenProfiles.cs index eb04d9a8..7f8647ad 100644 --- a/Vocaluxe/Screens/CScreenProfiles.cs +++ b/Vocaluxe/Screens/CScreenProfiles.cs @@ -82,10 +82,7 @@ namespace Vocaluxe.Screens _Buttons[_ButtonSaveSnapshot].Visible = false; _Buttons[_ButtonDiscardSnapshot].Visible = false; _Buttons[_ButtonTakeSnapshot].Visible = false; - if (CWebcam.GetDevices().Length > 0) - _Buttons[_ButtonWebcam].Visible = true; - else - _Buttons[_ButtonWebcam].Visible = false; + _Buttons[_ButtonWebcam].Visible = CWebcam.IsDeviceAvailable(); _SelectSlides[_SelectSlideDifficulty].SetValues(0); _SelectSlides[_SelectSlideGuestProfile].SetValues(0); _SelectSlides[_SelectSlideActive].SetValues(0); @@ -132,13 +129,13 @@ namespace Vocaluxe.Screens } else if (_Buttons[_ButtonDelete].Selected) _DeleteProfile(); - else if (_Buttons[_ButtonWebcam].Selected && CWebcam.GetDevices().Length > 0) + else if (_Buttons[_ButtonWebcam].Selected && CWebcam.IsDeviceAvailable()) _OnWebcam(); - else if (_Buttons[_ButtonSaveSnapshot].Selected && CWebcam.GetDevices().Length > 0) + else if (_Buttons[_ButtonSaveSnapshot].Selected && CWebcam.IsDeviceAvailable()) _OnSaveSnapshot(); - else if (_Buttons[_ButtonDiscardSnapshot].Selected && CWebcam.GetDevices().Length > 0) + else if (_Buttons[_ButtonDiscardSnapshot].Selected && CWebcam.IsDeviceAvailable()) _OnDiscardSnapshot(); - else if (_Buttons[_ButtonTakeSnapshot].Selected && CWebcam.GetDevices().Length > 0) + else if (_Buttons[_ButtonTakeSnapshot].Selected && CWebcam.IsDeviceAvailable()) _OnTakeSnapshot(); break; @@ -212,7 +209,7 @@ namespace Vocaluxe.Screens { CProfiles.SetAvatar(_SelectSlides[_SelectSlideProfiles].Selection, _SelectSlides[_SelectSlideAvatars].Selection); - if (CWebcam.GetDevices().Length > 0 && _WebcamTexture.Index > 0) + if (CWebcam.IsDeviceAvailable() && _WebcamTexture.Index > 0) _OnDiscardSnapshot(); } else if (_SelectSlides[_SelectSlideGuestProfile].Selected) @@ -225,13 +222,13 @@ namespace Vocaluxe.Screens CProfiles.SetActive(_SelectSlides[_SelectSlideProfiles].Selection, (EOffOn)_SelectSlides[_SelectSlideActive].Selection); } - else if (_Buttons[_ButtonWebcam].Selected && CWebcam.GetDevices().Length > 0) + else if (_Buttons[_ButtonWebcam].Selected && CWebcam.IsDeviceAvailable()) _OnWebcam(); - else if (_Buttons[_ButtonSaveSnapshot].Selected && CWebcam.GetDevices().Length > 0) + else if (_Buttons[_ButtonSaveSnapshot].Selected && CWebcam.IsDeviceAvailable()) _OnSaveSnapshot(); - else if (_Buttons[_ButtonDiscardSnapshot].Selected && CWebcam.GetDevices().Length > 0) + else if (_Buttons[_ButtonDiscardSnapshot].Selected && CWebcam.IsDeviceAvailable()) _OnDiscardSnapshot(); - else if (_Buttons[_ButtonTakeSnapshot].Selected && CWebcam.GetDevices().Length > 0) + else if (_Buttons[_ButtonTakeSnapshot].Selected && CWebcam.IsDeviceAvailable()) _OnTakeSnapshot(); } @@ -313,7 +310,7 @@ namespace Vocaluxe.Screens int avatarNr = CProfiles.GetAvatarNr(_SelectSlides[_SelectSlideProfiles].Selection); _SelectSlides[_SelectSlideAvatars].Selection = avatarNr; - if (CWebcam.GetDevices().Length > 0 && _WebcamTexture.Index > 0) + if (CWebcam.IsDeviceAvailable() && _WebcamTexture.Index > 0) { if (_Snapshot == null) CWebcam.GetFrame(ref _WebcamTexture); diff --git a/Vocaluxe/Screens/CScreenScore.cs b/Vocaluxe/Screens/CScreenScore.cs index 318f42c7..b15df9b5 100644 --- a/Vocaluxe/Screens/CScreenScore.cs +++ b/Vocaluxe/Screens/CScreenScore.cs @@ -156,15 +156,15 @@ namespace Vocaluxe.Screens if (direction.ToLower() == "vertical") { _Statics[_StaticPointsBar[p, CGame.NumPlayer - 1]].Rect.W = ((float)_StaticPointsBarDrawnPoints[p]) * - (_Statics[_StaticPointsBarBG[p, CGame.NumPlayer - 1]].Rect.W / 10000); + (_Statics[_StaticPointsBarBG[p, CGame.NumPlayer - 1]].Rect.W / 10000); } else { _Statics[_StaticPointsBar[p, CGame.NumPlayer - 1]].Rect.H = ((float)_StaticPointsBarDrawnPoints[p]) * - (_Statics[_StaticPointsBarBG[p, CGame.NumPlayer - 1]].Rect.H / 10000); + (_Statics[_StaticPointsBarBG[p, CGame.NumPlayer - 1]].Rect.H / 10000); _Statics[_StaticPointsBar[p, CGame.NumPlayer - 1]].Rect.Y = _Statics[_StaticPointsBarBG[p, CGame.NumPlayer - 1]].Rect.H + - _Statics[_StaticPointsBarBG[p, CGame.NumPlayer - 1]].Rect.Y - - _Statics[_StaticPointsBar[p, CGame.NumPlayer - 1]].Rect.H; + _Statics[_StaticPointsBarBG[p, CGame.NumPlayer - 1]].Rect.Y - + _Statics[_StaticPointsBar[p, CGame.NumPlayer - 1]].Rect.H; } } } @@ -316,14 +316,14 @@ namespace Vocaluxe.Screens if (CGame.NumPlayer < (int)_ScreenSettings[_ScreenSettingShortDifficulty].GetValue()) { _Texts[_TextDifficulty[p, CGame.NumPlayer - 1]].Text = CLanguage.Translate("TR_SCREENSCORE_GAMEDIFFICULTY") + ": " + - CLanguage.Translate(player[p].Difficulty.ToString()); + CLanguage.Translate(player[p].Difficulty.ToString()); } else _Texts[_TextDifficulty[p, CGame.NumPlayer - 1]].Text = CLanguage.Translate(player[p].Difficulty.ToString()); if (CGame.NumPlayer < (int)_ScreenSettings[_ScreenSettingShortRating].GetValue()) { _Texts[_TextRatings[p, CGame.NumPlayer - 1]].Text = CLanguage.Translate("TR_SCREENSCORE_RATING") + ": " + - CLanguage.Translate(_GetRating((int)Math.Round(player[p].Points))); + CLanguage.Translate(_GetRating((int)Math.Round(player[p].Points))); } else _Texts[_TextRatings[p, CGame.NumPlayer - 1]].Text = CLanguage.Translate(_GetRating((int)Math.Round(player[p].Points))); @@ -336,8 +336,8 @@ namespace Vocaluxe.Screens { _Statics[_StaticPointsBar[p, CGame.NumPlayer - 1]].Rect.H = 0; _Statics[_StaticPointsBar[p, CGame.NumPlayer - 1]].Rect.Y = _Statics[_StaticPointsBarBG[p, CGame.NumPlayer - 1]].Rect.H + - _Statics[_StaticPointsBarBG[p, CGame.NumPlayer - 1]].Rect.Y - - _Statics[_StaticPointsBar[p, CGame.NumPlayer - 1]].Rect.H; + _Statics[_StaticPointsBarBG[p, CGame.NumPlayer - 1]].Rect.Y - + _Statics[_StaticPointsBar[p, CGame.NumPlayer - 1]].Rect.H; } if (player[p].ProfileID >= 0 && player[p].ProfileID < CProfiles.NumProfiles) _Statics[_StaticAvatar[p, CGame.NumPlayer - 1]].Texture = CProfiles.Profiles[player[p].ProfileID].Avatar.Texture; @@ -349,8 +349,8 @@ namespace Vocaluxe.Screens { _Statics[_StaticPointsBar[p, CGame.NumPlayer - 1]].Rect.H = ((float)player[p].Points) * (_Statics[_StaticPointsBarBG[p, CGame.NumPlayer - 1]].Rect.H / 10000); _Statics[_StaticPointsBar[p, CGame.NumPlayer - 1]].Rect.Y = _Statics[_StaticPointsBarBG[p, CGame.NumPlayer - 1]].Rect.H + - _Statics[_StaticPointsBarBG[p, CGame.NumPlayer - 1]].Rect.Y - - _Statics[_StaticPointsBar[p, CGame.NumPlayer - 1]].Rect.H; + _Statics[_StaticPointsBarBG[p, CGame.NumPlayer - 1]].Rect.Y - + _Statics[_StaticPointsBar[p, CGame.NumPlayer - 1]].Rect.H; _StaticPointsBarDrawnPoints[p] = player[p].Points; } } diff --git a/Vocaluxe/Screens/CScreenSing.cs b/Vocaluxe/Screens/CScreenSing.cs index 0262c1ca..1df67e38 100644 --- a/Vocaluxe/Screens/CScreenSing.cs +++ b/Vocaluxe/Screens/CScreenSing.cs @@ -230,7 +230,7 @@ namespace Vocaluxe.Screens } break; case Keys.W: - if (CWebcam.GetDevices().Length > 0) + if (CWebcam.IsDeviceAvailable()) { _Webcam = !_Webcam; if (_Webcam) @@ -614,7 +614,7 @@ namespace Vocaluxe.Screens CDraw.RemoveTexture(ref _CurrentVideoTexture); - if (song.VideoFileName.Length > 0) + if (song.VideoFileName != "") { _CurrentVideo = CVideo.VdLoad(Path.Combine(song.Folder, song.VideoFileName)); CVideo.VdSkip(_CurrentVideo, song.Start, song.VideoGap); @@ -622,7 +622,7 @@ namespace Vocaluxe.Screens } CDraw.RemoveTexture(ref _Background); - if (song.BackgroundFileName.Length > 0) + if (song.BackgroundFileName != "") _Background = CDraw.AddTexture(Path.Combine(song.Folder, song.BackgroundFileName)); _SingNotes[_SingBars].Reset(); @@ -924,14 +924,14 @@ namespace Vocaluxe.Screens { _Texts[_TextScores[player, numplayer]].Visible = numplayer + 1 == CGame.NumPlayer; _Texts[_TextNames[player, numplayer]].Visible = (numplayer + 1 == CGame.NumPlayer) - && - (CConfig.PlayerInfo == EPlayerInfo.TR_CONFIG_PLAYERINFO_BOTH || - CConfig.PlayerInfo == EPlayerInfo.TR_CONFIG_PLAYERINFO_NAME); + && + (CConfig.PlayerInfo == EPlayerInfo.TR_CONFIG_PLAYERINFO_BOTH || + CConfig.PlayerInfo == EPlayerInfo.TR_CONFIG_PLAYERINFO_NAME); _Statics[_StaticScores[player, numplayer]].Visible = numplayer + 1 == CGame.NumPlayer; _Statics[_StaticAvatars[player, numplayer]].Visible = (numplayer + 1 == CGame.NumPlayer) - && - (CConfig.PlayerInfo == EPlayerInfo.TR_CONFIG_PLAYERINFO_BOTH || - CConfig.PlayerInfo == EPlayerInfo.TR_CONFIG_PLAYERINFO_AVATAR); + && + (CConfig.PlayerInfo == EPlayerInfo.TR_CONFIG_PLAYERINFO_BOTH || + CConfig.PlayerInfo == EPlayerInfo.TR_CONFIG_PLAYERINFO_AVATAR); } } } @@ -1325,7 +1325,8 @@ namespace Vocaluxe.Screens return; CLines[] partLines = song.Notes.Lines; - foreach (CLines partLine in partLines) { + foreach (CLines partLine in partLines) + { CLine[] line = partLine.Line; for (int j = 0; j < line.Length; j++) { diff --git a/Vocaluxe/Screens/CScreenSong.cs b/Vocaluxe/Screens/CScreenSong.cs index 2db8b37a..8e9dcde9 100644 --- a/Vocaluxe/Screens/CScreenSong.cs +++ b/Vocaluxe/Screens/CScreenSong.cs @@ -233,7 +233,7 @@ namespace Vocaluxe.Screens break; case Keys.Back: - if (_SearchActive && _SearchText.Length > 0) + if (_SearchActive && _SearchText != "") _ApplyNewSearchFilter(_SearchText.Remove(_SearchText.Length - 1)); if ((CSongs.Category < 0 || _Sso.Sorting.Tabs == EOffOn.TR_CONFIG_OFF) && !_Sso.Selection.PartyMode && !_SearchActive) @@ -1041,13 +1041,13 @@ namespace Vocaluxe.Screens if (songIndex != -1 && CSongs.NumVisibleSongs > 0 && CSongs.NumVisibleSongs > songIndex) songID = CSongs.VisibleSongs[songIndex].ID; - if (newFilterString.Length == 0 && _Sso.Sorting.Tabs == EOffOn.TR_CONFIG_ON) + if (newFilterString == "" && _Sso.Sorting.Tabs == EOffOn.TR_CONFIG_ON) { CSongs.Category = -1; refresh = true; } - if (newFilterString.Length > 0 && CSongs.Category != 0) + if (newFilterString != "" && CSongs.Category != 0) { CSongs.Category = 0; refresh = true; diff --git a/VocaluxeLib/Menu/CBackground.cs b/VocaluxeLib/Menu/CBackground.cs index 356cb116..11cf7124 100644 --- a/VocaluxeLib/Menu/CBackground.cs +++ b/VocaluxeLib/Menu/CBackground.cs @@ -118,7 +118,7 @@ namespace VocaluxeLib.Menu writer.WriteComment(": Background color for type \"Color\" from ColorScheme (high priority)"); writer.WriteComment("or , , , (lower priority)"); - if (_Theme.ColorName.Length > 0) + if (_Theme.ColorName != "") writer.WriteElementString("Color", _Theme.ColorName); else { @@ -139,13 +139,13 @@ namespace VocaluxeLib.Menu public void Resume() { - if (_Theme.Type == EBackgroundTypes.Video && _Theme.VideoName.Length > 0 && CBase.Config.GetVideoBackgrounds() == EOffOn.TR_CONFIG_ON) + if (_Theme.Type == EBackgroundTypes.Video && _Theme.VideoName != "" && CBase.Config.GetVideoBackgrounds() == EOffOn.TR_CONFIG_ON) CBase.Theme.SkinVideoResume(_Theme.VideoName, _PartyModeID); } public void Pause() { - if (_Theme.VideoName.Length > 0) + if (_Theme.VideoName != "") CBase.Theme.SkinVideoPause(_Theme.VideoName, _PartyModeID); } @@ -165,7 +165,7 @@ namespace VocaluxeLib.Menu ok = _DrawVideo(); } - if (_Theme.TextureName.Length > 0 && + if (_Theme.TextureName != "" && (_Theme.Type == EBackgroundTypes.Texture || (_Theme.Type == EBackgroundTypes.Video && (CBase.Config.GetVideoBackgrounds() == EOffOn.TR_CONFIG_OFF || !ok)))) ok = _DrawTexture(); @@ -181,7 +181,7 @@ namespace VocaluxeLib.Menu public void LoadTextures() { - if (_Theme.ColorName.Length > 0) + if (_Theme.ColorName != "") Color = CBase.Theme.GetColor(_Theme.ColorName, _PartyModeID); } diff --git a/VocaluxeLib/Menu/CButton.cs b/VocaluxeLib/Menu/CButton.cs index a7b9194e..9c74f8e1 100644 --- a/VocaluxeLib/Menu/CButton.cs +++ b/VocaluxeLib/Menu/CButton.cs @@ -239,7 +239,7 @@ namespace VocaluxeLib.Menu writer.WriteComment(": Button color from ColorScheme (high priority)"); writer.WriteComment("or , , , (lower priority)"); - if (_Theme.ColorName.Length > 0) + if (_Theme.ColorName != "") writer.WriteElementString("Color", _Theme.ColorName); else { @@ -251,7 +251,7 @@ namespace VocaluxeLib.Menu writer.WriteComment(": Selected button color from ColorScheme (high priority)"); writer.WriteComment("or , , , (lower priority)"); - if (_Theme.SelColorName.Length > 0) + if (_Theme.SelColorName != "") writer.WriteElementString("SColor", _Theme.SelColorName); else { @@ -378,10 +378,10 @@ namespace VocaluxeLib.Menu { Text.LoadTextures(); - if (_Theme.ColorName.Length > 0) + if (_Theme.ColorName != "") Color = CBase.Theme.GetColor(_Theme.ColorName, _PartyModeID); - if (_Theme.SelColorName.Length > 0) + if (_Theme.SelColorName != "") SelColor = CBase.Theme.GetColor(_Theme.SelColorName, _PartyModeID); } diff --git a/VocaluxeLib/Menu/CEqualizer.cs b/VocaluxeLib/Menu/CEqualizer.cs index a1d7fc89..5c258229 100644 --- a/VocaluxeLib/Menu/CEqualizer.cs +++ b/VocaluxeLib/Menu/CEqualizer.cs @@ -175,7 +175,7 @@ namespace VocaluxeLib.Menu writer.WriteComment(": Equalizer color from ColorScheme (high priority)"); writer.WriteComment("or , , , (lower priority)"); - if (_Theme.ColorName.Length > 0) + if (_Theme.ColorName != "") writer.WriteElementString("Color", _Theme.ColorName); else { @@ -186,7 +186,7 @@ namespace VocaluxeLib.Menu } writer.WriteComment(": Equalizer color for maximal volume from ColorScheme (high priority)"); writer.WriteComment("or , , , (lower priority)"); - if (_Theme.ColorName.Length > 0) + if (_Theme.ColorName != "") writer.WriteElementString("MaxColor", _Theme.ColorName); else { @@ -241,7 +241,7 @@ namespace VocaluxeLib.Menu public void Draw() { - if (_Bars == null || _Theme.Style!=EEqualizerStyle.Collums) + if (_Bars == null || _Theme.Style != EEqualizerStyle.Collums) return; float dx = Rect.W / _Bars.Length; @@ -274,10 +274,10 @@ namespace VocaluxeLib.Menu public void LoadTextures() { - if (_Theme.ColorName.Length > 0) + if (_Theme.ColorName != "") Color = CBase.Theme.GetColor(_Theme.ColorName, _PartyModeID); - if (_Theme.MaxColorName.Length > 0) + if (_Theme.MaxColorName != "") MaxColor = CBase.Theme.GetColor(_Theme.MaxColorName, _PartyModeID); } diff --git a/VocaluxeLib/Menu/CHelper.cs b/VocaluxeLib/Menu/CHelper.cs index d64fb482..95048f07 100644 --- a/VocaluxeLib/Menu/CHelper.cs +++ b/VocaluxeLib/Menu/CHelper.cs @@ -157,9 +157,7 @@ namespace VocaluxeLib.Menu try { foreach (FileInfo file in dir.GetFiles(cast)) - { files.Add(!fullpath ? file.Name : file.FullName); - } if (recursive) { diff --git a/VocaluxeLib/Menu/CLyric.cs b/VocaluxeLib/Menu/CLyric.cs index cad0c576..a0c9471a 100644 --- a/VocaluxeLib/Menu/CLyric.cs +++ b/VocaluxeLib/Menu/CLyric.cs @@ -172,7 +172,7 @@ namespace VocaluxeLib.Menu writer.WriteComment(": Lyric text color from ColorScheme (high priority)"); writer.WriteComment("or , , , (lower priority)"); - if (_Theme.ColorName.Length > 0) + if (_Theme.ColorName != "") writer.WriteElementString("Color", _Theme.ColorName); else { @@ -184,7 +184,7 @@ namespace VocaluxeLib.Menu writer.WriteComment(": Highlighted lyric color from ColorScheme (high priority)"); writer.WriteComment("or , , , (lower priority)"); - if (_Theme.SelColorName.Length > 0) + if (_Theme.SelColorName != "") writer.WriteElementString("SColor", _Theme.SelColorName); else { @@ -525,10 +525,10 @@ namespace VocaluxeLib.Menu public void LoadTextures() { - if (_Theme.ColorName.Length > 0) + if (_Theme.ColorName != "") _Color = CBase.Theme.GetColor(_Theme.ColorName, _PartyModeID); - if (_Theme.SelColorName.Length > 0) + if (_Theme.SelColorName != "") _ColorProcessed = CBase.Theme.GetColor(_Theme.SelColorName, _PartyModeID); } diff --git a/VocaluxeLib/Menu/CMenu.cs b/VocaluxeLib/Menu/CMenu.cs index 6b10e51d..e17e6aec 100644 --- a/VocaluxeLib/Menu/CMenu.cs +++ b/VocaluxeLib/Menu/CMenu.cs @@ -194,7 +194,7 @@ namespace VocaluxeLib.Menu public virtual void SaveTheme() { - if (_ThemePath.Length == 0) + if (_ThemePath == "") return; XmlWriterSettings settings = new XmlWriterSettings {Indent = true, Encoding = Encoding.UTF8, ConformanceLevel = ConformanceLevel.Document}; @@ -357,7 +357,7 @@ namespace VocaluxeLib.Menu public virtual void ReloadTheme(string xmlPath) { - if (_ThemePath.Length == 0) + if (_ThemePath == "") return; UnloadTextures(); @@ -436,7 +436,7 @@ namespace VocaluxeLib.Menu #region ElementHandler #region Create Elements -// ReSharper disable UnusedMember.Global + // ReSharper disable UnusedMember.Global // ReSharper disable MemberCanBeProtected.Global public CButton GetNewButton() { @@ -527,6 +527,7 @@ namespace VocaluxeLib.Menu { return new CParticleEffect(_PartyModeID, maxNumber, color, area, texture, size, type); } + // ReSharper restore MemberCanBeProtected.Global // ReSharper restore UnusedMember.Global #endregion Create Elements @@ -793,7 +794,7 @@ namespace VocaluxeLib.Menu #endregion Drawing #region Elements -// ReSharper disable MemberCanBePrivate.Global + // ReSharper disable MemberCanBePrivate.Global protected void _AddBackground(CBackground bg, String key = null) { _AddInteraction(_Backgrounds.Add(bg, key), EType.Background); @@ -858,6 +859,7 @@ namespace VocaluxeLib.Menu { _ScreenSettings.Add(se, key); } + // ReSharper restore MemberCanBePrivate.Global #endregion Elements @@ -1515,7 +1517,7 @@ namespace VocaluxeLib.Menu } } -// ReSharper disable UnusedMember.Local + // ReSharper disable UnusedMember.Local private void _ToggleHighlighted() { if (_Selection >= _Interactions.Count || _Selection < 0) @@ -1532,6 +1534,7 @@ namespace VocaluxeLib.Menu return _Interactions[_Selection].Type == EType.SelectSlide && _SelectSlides[_Interactions[_Selection].Num].Highlighted; } + // ReSharper restore UnusedMember.Local private bool _IsVisible(int interaction) diff --git a/VocaluxeLib/Menu/CNameSelection.cs b/VocaluxeLib/Menu/CNameSelection.cs index 1b19f16a..c09387f9 100644 --- a/VocaluxeLib/Menu/CNameSelection.cs +++ b/VocaluxeLib/Menu/CNameSelection.cs @@ -190,7 +190,7 @@ namespace VocaluxeLib.Menu writer.WriteComment(": Static color from ColorScheme (high priority)"); writer.WriteComment("or , , , (lower priority)"); - if (_Theme.ColorEmptyTileName.Length > 0) + if (_Theme.ColorEmptyTileName != "") writer.WriteElementString("ColorEmptyTile", _Theme.ColorEmptyTileName); else { @@ -221,7 +221,7 @@ namespace VocaluxeLib.Menu writer.WriteComment(": Text font name"); writer.WriteElementString("Font", _Theme.NameFont); writer.WriteComment(": Text color from ColorScheme (high priority)"); - if (_Theme.NameColorName.Length > 0) + if (_Theme.NameColorName != "") writer.WriteElementString("Color", _Theme.NameColorName); else { @@ -455,10 +455,10 @@ namespace VocaluxeLib.Menu _TextureEmptyTile = CBase.Theme.GetSkinTexture(_Theme.TextureEmptyTileName, _PartyModeID); _TextureTileSelected = CBase.Theme.GetSkinTexture(_Theme.TextureTileSelectedName, _PartyModeID); - if (_Theme.ColorEmptyTileName.Length > 0) + if (_Theme.ColorEmptyTileName != "") ColorEmptyTile = CBase.Theme.GetColor(_Theme.ColorEmptyTileName, _PartyModeID); - if (_Theme.NameColorName.Length > 0) + if (_Theme.NameColorName != "") _Theme.NameColor = CBase.Theme.GetColor(_Theme.NameColorName, _PartyModeID); } diff --git a/VocaluxeLib/Menu/CParticle.cs b/VocaluxeLib/Menu/CParticle.cs index f0926631..8aecbd89 100644 --- a/VocaluxeLib/Menu/CParticle.cs +++ b/VocaluxeLib/Menu/CParticle.cs @@ -297,7 +297,7 @@ namespace VocaluxeLib.Menu public void Draw() { - if (_TextureName.Length > 0) + if (_TextureName != "") CBase.Drawing.DrawTexture(CBase.Theme.GetSkinTexture(_TextureName, _PartyModeID), _Rect, new SColorF(_Color.R, _Color.G, _Color.B, _Color.A * Alpha2 * _Alpha)); else CBase.Drawing.DrawTexture(_Texture, _Rect, new SColorF(_Color.R, _Color.G, _Color.B, _Color.A * Alpha2 * _Alpha)); @@ -433,7 +433,7 @@ namespace VocaluxeLib.Menu writer.WriteComment(": ParticleEffect color from ColorScheme (high priority)"); writer.WriteComment("or , , , (lower priority)"); - if (_Theme.ColorName.Length > 0) + if (_Theme.ColorName != "") writer.WriteElementString("Color", _Theme.ColorName); else { @@ -544,7 +544,7 @@ namespace VocaluxeLib.Menu h = 0; CParticle star; - if (_Theme.TextureName.Length > 0) + if (_Theme.TextureName != "") { star = new CParticle(_PartyModeID, _Theme.TextureName, Color, CBase.Game.GetRandom(w) + Rect.X - size / 4f, @@ -605,9 +605,9 @@ namespace VocaluxeLib.Menu public void LoadTextures() { - if (_Theme.ColorName.Length > 0) + if (_Theme.ColorName != "") Color = CBase.Theme.GetColor(_Theme.ColorName, _PartyModeID); - if (_Theme.TextureName.Length > 0) + if (_Theme.TextureName != "") Texture = CBase.Theme.GetSkinTexture(_Theme.TextureName, _PartyModeID); } diff --git a/VocaluxeLib/Menu/CPlaylist.cs b/VocaluxeLib/Menu/CPlaylist.cs index c0386fc7..b748048d 100644 --- a/VocaluxeLib/Menu/CPlaylist.cs +++ b/VocaluxeLib/Menu/CPlaylist.cs @@ -370,7 +370,7 @@ namespace VocaluxeLib.Menu writer.WriteComment(": Button color from ColorScheme (high priority)"); writer.WriteComment("or , , , (lower priority)"); - if (_Theme.ColorBackgroundName.Length > 0) + if (_Theme.ColorBackgroundName != "") writer.WriteElementString("ColorBackground", _Theme.ColorBackgroundName); else { @@ -382,7 +382,7 @@ namespace VocaluxeLib.Menu writer.WriteComment(": Selected paylist-entry color from ColorScheme (high priority)"); writer.WriteComment("or , , , (lower priority)"); - if (_Theme.SelColorBackgroundName.Length > 0) + if (_Theme.SelColorBackgroundName != "") writer.WriteElementString("SColorBackground", _Theme.SelColorBackgroundName); else { @@ -471,10 +471,10 @@ namespace VocaluxeLib.Menu public void LoadTextures() { - if (_Theme.ColorBackgroundName.Length > 0) + if (_Theme.ColorBackgroundName != "") BackgroundColor = CBase.Theme.GetColor(_Theme.ColorBackgroundName, _PartyModeID); - if (_Theme.SelColorBackgroundName.Length > 0) + if (_Theme.SelColorBackgroundName != "") BackgroundSelColor = CBase.Theme.GetColor(_Theme.SelColorBackgroundName, _PartyModeID); _Theme.Text1.LoadTextures(); @@ -523,7 +523,7 @@ namespace VocaluxeLib.Menu } else if (keyEvent.Key == Keys.Back || keyEvent.Key == Keys.Delete) { - if (_Theme.ButtonPlaylistName.Text.Text.Length > 0) + if (_Theme.ButtonPlaylistName.Text.Text != "") _Theme.ButtonPlaylistName.Text.Text = _Theme.ButtonPlaylistName.Text.Text.Remove(_Theme.ButtonPlaylistName.Text.Text.Length - 1); } } diff --git a/VocaluxeLib/Menu/CScreenSetting.cs b/VocaluxeLib/Menu/CScreenSetting.cs index 25063735..691074f9 100644 --- a/VocaluxeLib/Menu/CScreenSetting.cs +++ b/VocaluxeLib/Menu/CScreenSetting.cs @@ -37,10 +37,10 @@ namespace VocaluxeLib.Menu public ESettingType Type; } -// ReSharper disable ClassNeverInstantiated.Global + // ReSharper disable ClassNeverInstantiated.Global //Instantiated by reflection public class CScreenSetting : IMenuElement -// ReSharper restore ClassNeverInstantiated.Global + // ReSharper restore ClassNeverInstantiated.Global { private readonly int _PartyModeID; diff --git a/VocaluxeLib/Menu/CSelectSlide.cs b/VocaluxeLib/Menu/CSelectSlide.cs index f320a084..16fab82a 100644 --- a/VocaluxeLib/Menu/CSelectSlide.cs +++ b/VocaluxeLib/Menu/CSelectSlide.cs @@ -417,7 +417,7 @@ namespace VocaluxeLib.Menu writer.WriteComment(": SelectSlide color from ColorScheme (high priority)"); writer.WriteComment("or , , , (lower priority)"); - if (_Theme.ColorName.Length > 0) + if (_Theme.ColorName != "") writer.WriteElementString("Color", _Theme.ColorName); else { @@ -429,7 +429,7 @@ namespace VocaluxeLib.Menu writer.WriteComment(": Selected SelectSlide color from ColorScheme (high priority)"); writer.WriteComment("or , , , (lower priority)"); - if (_Theme.SelColorName.Length > 0) + if (_Theme.SelColorName != "") writer.WriteElementString("SColor", _Theme.SelColorName); else { @@ -441,7 +441,7 @@ namespace VocaluxeLib.Menu writer.WriteComment(": Highlighted SelectSlide color from ColorScheme (high priority)"); writer.WriteComment("or
, , , (lower priority)"); - if (_Theme.HighlightColorName.Length > 0) + if (_Theme.HighlightColorName != "") writer.WriteElementString("HColor", _Theme.HighlightColorName); else { @@ -453,7 +453,7 @@ namespace VocaluxeLib.Menu writer.WriteComment(": Arrow color from ColorScheme (high priority)"); writer.WriteComment("or , , , (lower priority)"); - if (_Theme.ArrowColorName.Length > 0) + if (_Theme.ArrowColorName != "") writer.WriteElementString("ArrowColor", _Theme.ArrowColorName); else { @@ -465,7 +465,7 @@ namespace VocaluxeLib.Menu writer.WriteComment(": Selected arrow color from ColorScheme (high priority)"); writer.WriteComment("or , , , (lower priority)"); - if (_Theme.SelArrowColorName.Length > 0) + if (_Theme.SelArrowColorName != "") writer.WriteElementString("ArrowSColor", _Theme.SelArrowColorName); else { @@ -477,7 +477,7 @@ namespace VocaluxeLib.Menu writer.WriteComment(": Text color from ColorScheme (high priority)"); writer.WriteComment("or , , , (lower priority)"); - if (_Theme.TextColorName.Length > 0) + if (_Theme.TextColorName != "") writer.WriteElementString("TextColor", _Theme.TextColorName); else { @@ -489,7 +489,7 @@ namespace VocaluxeLib.Menu writer.WriteComment(": Selected text color from ColorScheme (high priority)"); writer.WriteComment("or , , , (lower priority)"); - if (_Theme.SelTextColorName.Length > 0) + if (_Theme.SelTextColorName != "") writer.WriteElementString("TextSColor", _Theme.SelTextColorName); else { @@ -797,25 +797,25 @@ namespace VocaluxeLib.Menu public void LoadTextures() { - if (_Theme.ColorName.Length > 0) + if (_Theme.ColorName != "") Color = CBase.Theme.GetColor(_Theme.ColorName, _PartyModeID); - if (_Theme.SelColorName.Length > 0) + if (_Theme.SelColorName != "") SelColor = CBase.Theme.GetColor(_Theme.SelColorName, _PartyModeID); - if (_Theme.HighlightColorName.Length > 0) + if (_Theme.HighlightColorName != "") HighlightColor = CBase.Theme.GetColor(_Theme.HighlightColorName, _PartyModeID); - if (_Theme.ArrowColorName.Length > 0) + if (_Theme.ArrowColorName != "") ColorArrow = CBase.Theme.GetColor(_Theme.ArrowColorName, _PartyModeID); - if (_Theme.SelArrowColorName.Length > 0) + if (_Theme.SelArrowColorName != "") SelColorArrow = CBase.Theme.GetColor(_Theme.SelArrowColorName, _PartyModeID); - if (_Theme.TextColorName.Length > 0) + if (_Theme.TextColorName != "") TextColor = CBase.Theme.GetColor(_Theme.TextColorName, _PartyModeID); - if (_Theme.SelColorName.Length > 0) + if (_Theme.SelColorName != "") SelTextColor = CBase.Theme.GetColor(_Theme.SelTextColorName, _PartyModeID); } diff --git a/VocaluxeLib/Menu/CStatic.cs b/VocaluxeLib/Menu/CStatic.cs index 14bc216c..50bf7278 100644 --- a/VocaluxeLib/Menu/CStatic.cs +++ b/VocaluxeLib/Menu/CStatic.cs @@ -201,7 +201,7 @@ namespace VocaluxeLib.Menu writer.WriteComment(": Static color from ColorScheme (high priority)"); writer.WriteComment("or , , ,
(lower priority)"); - if (_Theme.ColorName.Length > 0) + if (_Theme.ColorName != "") writer.WriteElementString("Color", _Theme.ColorName); else { @@ -293,7 +293,7 @@ namespace VocaluxeLib.Menu public void LoadTextures() { - if (_Theme.ColorName.Length > 0) + if (_Theme.ColorName != "") Color = CBase.Theme.GetColor(_Theme.ColorName, _PartyModeID); } diff --git a/VocaluxeLib/Menu/CText.cs b/VocaluxeLib/Menu/CText.cs index 613a5000..b09737b9 100644 --- a/VocaluxeLib/Menu/CText.cs +++ b/VocaluxeLib/Menu/CText.cs @@ -541,7 +541,7 @@ namespace VocaluxeLib.Menu writer.WriteComment(": Text color from ColorScheme (high priority)"); writer.WriteComment("or , , , (lower priority)"); - if (_Theme.ColorName.Length > 0) + if (_Theme.ColorName != "") writer.WriteElementString("Color", _Theme.ColorName); else { @@ -553,7 +553,7 @@ namespace VocaluxeLib.Menu writer.WriteComment(": Selected Text color from ColorScheme (high priority)"); writer.WriteComment("or , , , (lower priority)"); - if (_Theme.SelColorName.Length > 0) + if (_Theme.SelColorName != "") writer.WriteElementString("SColor", _Theme.SelColorName); else { @@ -776,10 +776,10 @@ namespace VocaluxeLib.Menu public void LoadTextures() { - if (_Theme.ColorName.Length > 0) + if (_Theme.ColorName != "") Color = CBase.Theme.GetColor(_Theme.ColorName, _PartyModeID); - if (_Theme.SelColorName.Length > 0) + if (_Theme.SelColorName != "") SelColor = CBase.Theme.GetColor(_Theme.SelColorName, _PartyModeID); } @@ -806,7 +806,7 @@ namespace VocaluxeLib.Menu private void _UpdateTextPosition() { - if (_Text.Length == 0) + if (_Text == "") return; CBase.Fonts.SetFont(Font); diff --git a/VocaluxeLib/Menu/CXMLReader.cs b/VocaluxeLib/Menu/CXMLReader.cs index 0a21f4e7..55944771 100644 --- a/VocaluxeLib/Menu/CXMLReader.cs +++ b/VocaluxeLib/Menu/CXMLReader.cs @@ -112,7 +112,7 @@ namespace VocaluxeLib.Menu resultCt++; } - if (resultCt!=1) + if (resultCt != 1) { value = defaultValue; return false; diff --git a/VocaluxeLib/Menu/Enums.cs b/VocaluxeLib/Menu/Enums.cs index e52e1b86..5c40785a 100644 --- a/VocaluxeLib/Menu/Enums.cs +++ b/VocaluxeLib/Menu/Enums.cs @@ -136,7 +136,7 @@ namespace VocaluxeLib.Menu public enum EBufferSize { -// ReSharper disable UnusedMember.Global + // ReSharper disable UnusedMember.Global B0 = 0, B512 = 512, B1024 = 1024, diff --git a/VocaluxeLib/Menu/SingNotes/CSingNotes.cs b/VocaluxeLib/Menu/SingNotes/CSingNotes.cs index 3cadcdbc..3243261d 100644 --- a/VocaluxeLib/Menu/SingNotes/CSingNotes.cs +++ b/VocaluxeLib/Menu/SingNotes/CSingNotes.cs @@ -245,7 +245,7 @@ namespace VocaluxeLib.Menu.SingNotes SPlayerNotes notes = _PlayerNotes[n]; - if (line.Length == 0 || line.Length <= lineNr) + if (line.Length <= lineNr) return; notes.Lines = line; diff --git a/VocaluxeLib/Menu/SongMenu/CSong.cs b/VocaluxeLib/Menu/SongMenu/CSong.cs index 2197bdc5..06babb1b 100644 --- a/VocaluxeLib/Menu/SongMenu/CSong.cs +++ b/VocaluxeLib/Menu/SongMenu/CSong.cs @@ -369,7 +369,7 @@ namespace VocaluxeLib.Menu.SongMenu while (!sr.EndOfStream) { string line = sr.ReadLine(); - if (line.Length == 0) + if (line == "") continue; if (!line[0].ToString().Equals("#")) break; @@ -381,7 +381,7 @@ namespace VocaluxeLib.Menu.SongMenu string identifier = line.Substring(1, pos - 1).Trim().ToUpper(); string value = line.Substring(pos + 1, line.Length - pos - 1).Trim(); - if (value.Length > 0) + if (value != "") { switch (identifier) { @@ -395,7 +395,7 @@ namespace VocaluxeLib.Menu.SongMenu while (!sr.EndOfStream) { line = sr.ReadLine(); - if (line.Length == 0) + if (line == "") continue; if (!line[0].ToString().Equals("#")) break; @@ -411,33 +411,33 @@ namespace VocaluxeLib.Menu.SongMenu } break; case "TITLE": - if (value.Length > 0) + if (value != "") { Title = value; headerFlags |= EHeaderFlags.Title; } break; case "ARTIST": - if (value.Length > 0) + if (value != "") { Artist = value; headerFlags |= EHeaderFlags.Artist; } break; case "TITLE-ON-SORTING": - if (value.Length > 0) + if (value != "") TitleSorting = value; break; case "ARTIST-ON-SORTING": - if (value.Length > 0) + if (value != "") ArtistSorting = value; break; case "P1": - if (value.Length > 0) + if (value != "") DuetPart1 = value; break; case "P2": - if (value.Length > 0) + if (value != "") DuetPart2 = value; break; case "MP3": @@ -608,10 +608,10 @@ namespace VocaluxeLib.Menu.SongMenu _CheckFiles(); //Before saving this tags to .txt: Check, if ArtistSorting and Artist are equal, then don't save this tag. - if (ArtistSorting.Length == 0) + if (ArtistSorting == "") ArtistSorting = Artist; - if (TitleSorting.Length == 0) + if (TitleSorting == "") TitleSorting = Title; return true; @@ -821,7 +821,7 @@ namespace VocaluxeLib.Menu.SongMenu { if (_CoverSmallLoaded) return; - if (CoverFileName.Length > 0) + if (CoverFileName != "") { if (!CBase.DataBase.GetCover(Path.Combine(Folder, CoverFileName), ref _CoverTextureSmall, CBase.Config.GetCoverSize())) _CoverTextureSmall = CBase.Cover.GetNoCover(); @@ -834,7 +834,7 @@ namespace VocaluxeLib.Menu.SongMenu private void _CheckFiles() { - if (CoverFileName.Length == 0) + if (CoverFileName == "") { List files = CHelper.ListFiles(Folder, "*.jpg", false); files.AddRange(CHelper.ListFiles(Folder, "*.png", false)); @@ -846,7 +846,7 @@ namespace VocaluxeLib.Menu.SongMenu } } - if (BackgroundFileName.Length == 0) + if (BackgroundFileName == "") { List files = CHelper.ListFiles(Folder, "*.jpg", false); files.AddRange(CHelper.ListFiles(Folder, "*.png", false)); @@ -861,12 +861,12 @@ namespace VocaluxeLib.Menu.SongMenu private void _CheckDuet() { - if (DuetPart1.Length == 0) + if (DuetPart1 == "") { DuetPart1 = "Part 1"; CBase.Log.LogError("Warning: Can't find #P1-tag for duets in \"" + Artist + " - " + Title + "\"."); } - if (DuetPart2.Length == 0) + if (DuetPart2 == "") { DuetPart2 = "Part 2"; CBase.Log.LogError("Warning: Can't find #P2-tag for duets in \"" + Artist + " - " + Title + "\"."); @@ -915,7 +915,7 @@ namespace VocaluxeLib.Menu.SongMenu for (int k = 1; k <= max; k++) { - if (sentences[i + k] == sentences[j + k] && sentences[i + k]!="") + if (sentences[i + k] == sentences[j + k] && sentences[i + k] != "") tempSeries.End = i + k; else break; diff --git a/VocaluxeLib/Menu/SongMenu/CSongMenuDreidel.cs b/VocaluxeLib/Menu/SongMenu/CSongMenuDreidel.cs index 10d9c0e7..bfbad2a0 100644 --- a/VocaluxeLib/Menu/SongMenu/CSongMenuDreidel.cs +++ b/VocaluxeLib/Menu/SongMenu/CSongMenuDreidel.cs @@ -44,7 +44,7 @@ namespace VocaluxeLib.Menu.SongMenu public CSongMenuDreidel(int partyModeID) : base(partyModeID) {} -// ReSharper disable RedundantOverridenMember + // ReSharper disable RedundantOverridenMember public override void Init() { base.Init(); @@ -59,6 +59,7 @@ namespace VocaluxeLib.Menu.SongMenu _SongLength = _Theme.songMenuDreidel.TextSongLength; **/ } -// ReSharper restore RedundantOverridenMember + + // ReSharper restore RedundantOverridenMember } } \ No newline at end of file diff --git a/VocaluxeLib/Menu/SongMenu/CSongMenuFramework.cs b/VocaluxeLib/Menu/SongMenu/CSongMenuFramework.cs index 42c2b03f..ef2d530c 100644 --- a/VocaluxeLib/Menu/SongMenu/CSongMenuFramework.cs +++ b/VocaluxeLib/Menu/SongMenu/CSongMenuFramework.cs @@ -349,7 +349,7 @@ namespace VocaluxeLib.Menu.SongMenu writer.WriteComment(": Tile color from ColorScheme (high priority)"); writer.WriteComment("or , , , (lower priority)"); - if (_Theme.ColorName.Length > 0) + if (_Theme.ColorName != "") writer.WriteElementString("Color", _Theme.ColorName); else { @@ -481,13 +481,9 @@ namespace VocaluxeLib.Menu.SongMenu _SelectedInternal = _SelectedPending; } - public virtual void HandleInput(ref SKeyEvent keyEvent, SScreenSongOptions songOptions) - { - } + public virtual void HandleInput(ref SKeyEvent keyEvent, SScreenSongOptions songOptions) {} - public virtual void HandleMouse(ref SMouseEvent mouseEvent, SScreenSongOptions songOptions) - { - } + public virtual void HandleMouse(ref SMouseEvent mouseEvent, SScreenSongOptions songOptions) {} public virtual void Draw() { @@ -531,17 +527,11 @@ namespace VocaluxeLib.Menu.SongMenu return -1; } - public virtual void SetSelectedSong(int visibleSongNr) - { - } + public virtual void SetSelectedSong(int visibleSongNr) {} - public virtual void SetSelectedCategory(int categoryNr) - { - } + public virtual void SetSelectedCategory(int categoryNr) {} - public virtual void SetSmallView(bool smallView) - { - } + public virtual void SetSmallView(bool smallView) {} public virtual bool IsSmallView() { @@ -554,7 +544,7 @@ namespace VocaluxeLib.Menu.SongMenu { Init(); - if (_Theme.ColorName.Length > 0) + if (_Theme.ColorName != "") _Color = CBase.Theme.GetColor(_Theme.ColorName, _PartyModeID); } @@ -635,7 +625,7 @@ namespace VocaluxeLib.Menu.SongMenu _Streams.Add(stream); _Actsongstream = stream; - if (CBase.Songs.GetVisibleSong(_Actsong).VideoFileName.Length > 0 && CBase.Config.GetVideoPreview() == EOffOn.TR_CONFIG_ON) + if (CBase.Songs.GetVisibleSong(_Actsong).VideoFileName != "" && CBase.Config.GetVideoPreview() == EOffOn.TR_CONFIG_ON) { _Video = CBase.Video.Load(Path.Combine(CBase.Songs.GetVisibleSong(_Actsong).Folder, CBase.Songs.GetVisibleSong(_Actsong).VideoFileName)); if (_Video == -1) diff --git a/VocaluxeLib/Menu/SongMenu/CSongMenuTileBoard.cs b/VocaluxeLib/Menu/SongMenu/CSongMenuTileBoard.cs index 6e38429c..2f3ee5fd 100644 --- a/VocaluxeLib/Menu/SongMenu/CSongMenuTileBoard.cs +++ b/VocaluxeLib/Menu/SongMenu/CSongMenuTileBoard.cs @@ -154,7 +154,7 @@ namespace VocaluxeLib.Menu.SongMenu _MedleyTagIcon.Visible = false; } - if (CBase.Songs.GetNumVisibleSongs() == 0 && CBase.Songs.GetSearchFilter().Length > 0) + if (CBase.Songs.GetNumVisibleSongs() == 0 && CBase.Songs.GetSearchFilter() != "") { _CoverBig.Texture = _CoverBigTexture; _Artist.Text = String.Empty; @@ -418,7 +418,7 @@ namespace VocaluxeLib.Menu.SongMenu _Artist.Text = song.Artist; _Title.Text = song.Title; _DuetIcon.Visible = song.IsDuet; - _VideoIcon.Visible = song.VideoFileName.Length > 0; + _VideoIcon.Visible = song.VideoFileName != ""; _MedleyCalcIcon.Visible = song.Medley.Source == EMedleySource.Calculated; _MedleyTagIcon.Visible = song.Medley.Source == EMedleySource.Tag; From 9d481cabc150ff56ba26e253483c45e1ab3a476f Mon Sep 17 00:00:00 2001 From: Flamefire Date: Tue, 23 Apr 2013 15:14:47 +0200 Subject: [PATCH 09/27] Fixed wrong float.epsilon comparisons --- Vocaluxe/Lib/Draw/CDirect3D.cs | 2 +- Vocaluxe/Lib/Video/CVideoDecoderFFmpeg.cs | 2 +- Vocaluxe/Lib/Video/CVideoDecoderGstreamer.cs | 4 ++-- Vocaluxe/Lib/Webcam/CAForgeNet.cs | 2 +- VocaluxeLib/Menu/CLyric.cs | 14 +++++--------- 5 files changed, 10 insertions(+), 14 deletions(-) diff --git a/Vocaluxe/Lib/Draw/CDirect3D.cs b/Vocaluxe/Lib/Draw/CDirect3D.cs index e79e1473..53cca0ac 100644 --- a/Vocaluxe/Lib/Draw/CDirect3D.cs +++ b/Vocaluxe/Lib/Draw/CDirect3D.cs @@ -732,7 +732,7 @@ namespace Vocaluxe.Lib.Draw /// The texture in which the frame is copied to public void CopyScreen(ref STexture texture) { - if (!_TextureExists(ref texture) || (Math.Abs(texture.Width - GetScreenWidth()) > float.Epsilon) || (Math.Abs(texture.Height - GetScreenHeight()) > float.Epsilon)) + if (!_TextureExists(ref texture) || (int)texture.Width != GetScreenWidth() || (int)texture.Height != GetScreenHeight()) { RemoveTexture(ref texture); texture = CopyScreen(); diff --git a/Vocaluxe/Lib/Video/CVideoDecoderFFmpeg.cs b/Vocaluxe/Lib/Video/CVideoDecoderFFmpeg.cs index 38c57cce..6aae01ae 100644 --- a/Vocaluxe/Lib/Video/CVideoDecoderFFmpeg.cs +++ b/Vocaluxe/Lib/Video/CVideoDecoderFFmpeg.cs @@ -661,7 +661,7 @@ namespace Vocaluxe.Lib.Video if (num >= 0) { - if (frame.Index == -1 || Math.Abs(_Width - frame.Width) > float.Epsilon || Math.Abs(_Height - frame.Height) > float.Epsilon) + if (frame.Index == -1 || _Width != (int) frame.Width || _Height != (int) frame.Height) { CDraw.RemoveTexture(ref frame); frame = CDraw.AddTexture(_Width, _Height, ref _FrameBuffer[num].Data); diff --git a/Vocaluxe/Lib/Video/CVideoDecoderGstreamer.cs b/Vocaluxe/Lib/Video/CVideoDecoderGstreamer.cs index e073a74c..2295e8b4 100644 --- a/Vocaluxe/Lib/Video/CVideoDecoderGstreamer.cs +++ b/Vocaluxe/Lib/Video/CVideoDecoderGstreamer.cs @@ -27,7 +27,7 @@ namespace Vocaluxe.Lib.Video class CVideoDecoderGstreamer : IVideoDecoder { #region log - public CGstreamerVideoWrapper.LogCallback Log; + private CGstreamerVideoWrapper.LogCallback Log; private void _LogHandler(string text) { @@ -121,7 +121,7 @@ namespace Vocaluxe.Lib.Video { if (data != null) { - if (frame.Index == -1 || width != frame.Width || height != frame.Height || data.Length == 0) + if (frame.Index == -1 || width != (int)frame.Width || height != (int)frame.Height || data.Length == 0) { CDraw.RemoveTexture(ref frame); frame = CDraw.AddTexture(width, height, ref data); diff --git a/Vocaluxe/Lib/Webcam/CAForgeNet.cs b/Vocaluxe/Lib/Webcam/CAForgeNet.cs index 35926e50..6ba3577f 100644 --- a/Vocaluxe/Lib/Webcam/CAForgeNet.cs +++ b/Vocaluxe/Lib/Webcam/CAForgeNet.cs @@ -57,7 +57,7 @@ namespace Vocaluxe.Lib.Webcam { lock (_MutexData) { - if (frame.Index == -1 || Math.Abs(_Width - frame.Width) > float.Epsilon || Math.Abs(_Height - frame.Height) > float.Epsilon) + if (frame.Index == -1 || _Width != (int) frame.Width || _Height != (int)frame.Height) { CDraw.RemoveTexture(ref frame); frame = CDraw.AddTexture(_Width, _Height, ref _Data); diff --git a/VocaluxeLib/Menu/CLyric.cs b/VocaluxeLib/Menu/CLyric.cs index a0c9471a..6e928c4a 100644 --- a/VocaluxeLib/Menu/CLyric.cs +++ b/VocaluxeLib/Menu/CLyric.cs @@ -499,17 +499,13 @@ namespace VocaluxeLib.Menu if (_Notes[jumpNote].Type == ENoteType.Freestyle) _Text.Style = EStyle.BoldItalic; - float diff = _Notes[jumpNote].EndBeat - _Notes[jumpNote].StartBeat; - if (diff <= 0f) - diff = 1f; + int diff = _Notes[jumpNote].EndBeat - _Notes[jumpNote].StartBeat; + if (diff <= 0) + diff = 1; - float p = (currentBeat - _Notes[jumpNote].StartBeat) / diff; - if (p > 1f) - p = 1f; + float p = 1f-(currentBeat - _Notes[jumpNote].StartBeat) / diff; - p = 1f - p; - - if (Math.Abs(diff - 1) < float.Epsilon) + if (Math.Abs(p) < float.Epsilon) _Text.Draw(); else { From 5cd47f053796c18ff621d7ce49a484bb9f6cbc87 Mon Sep 17 00:00:00 2001 From: Flamefire Date: Tue, 23 Apr 2013 15:42:32 +0200 Subject: [PATCH 10/27] Fixed floating point comparisons --- Vocaluxe/Base/CBackgroundMusic.cs | 20 +++++++++---------- Vocaluxe/Base/CGraphics.cs | 2 +- Vocaluxe/Base/CLog.cs | 2 +- Vocaluxe/Lib/Draw/CDrawWinForm.cs | 2 +- Vocaluxe/Lib/Input/IInput.cs | 2 +- Vocaluxe/Screens/CScreenSing.cs | 6 +++--- VocaluxeLib/Menu/CParticle.cs | 8 ++++---- VocaluxeLib/Menu/CSelectSlide.cs | 4 ++-- VocaluxeLib/Menu/CText.cs | 10 +++++----- VocaluxeLib/Menu/SingNotes/CSingNotes.cs | 2 +- VocaluxeLib/Menu/SongMenu/CSong.cs | 2 +- .../Menu/SongMenu/CSongMenuFramework.cs | 2 +- .../Menu/SongMenu/CSongMenuTileBoard.cs | 2 +- 13 files changed, 32 insertions(+), 32 deletions(-) diff --git a/Vocaluxe/Base/CBackgroundMusic.cs b/Vocaluxe/Base/CBackgroundMusic.cs index c968dadf..5f81b346 100644 --- a/Vocaluxe/Base/CBackgroundMusic.cs +++ b/Vocaluxe/Base/CBackgroundMusic.cs @@ -211,7 +211,7 @@ namespace Vocaluxe.Base if (_AllFileNames.Count > 0 && _CurrentMusicStream != -1) { float timeToPlay; - if (_CurrentPlaylistElement.Finish == 0f) //No End-Tag defined + if (Math.Abs(_CurrentPlaylistElement.Finish) < 0.001) //No End-Tag defined timeToPlay = CSound.GetLength(_CurrentMusicStream) - CSound.GetPosition(_CurrentMusicStream); else //End-Tag found timeToPlay = _CurrentPlaylistElement.Finish - CSound.GetPosition(_CurrentMusicStream); @@ -222,13 +222,13 @@ namespace Vocaluxe.Base if (_RepeatSong) { //Seek to #Start-Tag, if found - if (_CurrentPlaylistElement.Start != 0f && CConfig.BackgroundMusicUseStart == EOffOn.TR_CONFIG_ON) + if (_CurrentPlaylistElement.Start > 0.001 && CConfig.BackgroundMusicUseStart == EOffOn.TR_CONFIG_ON) CSound.SetPosition(_CurrentMusicStream, _CurrentPlaylistElement.Start); else CSound.SetPosition(_CurrentMusicStream, 0); if (_VideoEnabled && _Video != -1) { - if (_CurrentPlaylistElement.Start != 0f && CConfig.BackgroundMusicUseStart == EOffOn.TR_CONFIG_ON) + if (_CurrentPlaylistElement.Start >0.001 && CConfig.BackgroundMusicUseStart == EOffOn.TR_CONFIG_ON) CVideo.VdSkip(_Video, _CurrentPlaylistElement.Start, _CurrentPlaylistElement.VideoGap); else CVideo.VdSkip(_Video, 0f, _CurrentPlaylistElement.VideoGap); @@ -269,7 +269,7 @@ namespace Vocaluxe.Base CSound.SetStreamVolumeMax(_CurrentMusicStream, CConfig.BackgroundMusicVolume); //Seek to #Start-Tag, if found - if (_CurrentPlaylistElement.Start != 0f && CConfig.BackgroundMusicUseStart == EOffOn.TR_CONFIG_ON) + if (_CurrentPlaylistElement.Start >0.001 && CConfig.BackgroundMusicUseStart == EOffOn.TR_CONFIG_ON) CSound.SetPosition(_CurrentMusicStream, _CurrentPlaylistElement.Start); if (_VideoEnabled) @@ -289,13 +289,13 @@ namespace Vocaluxe.Base if (CSound.GetPosition(_CurrentMusicStream) >= 1.5f) { //Seek to #Start-Tag, if found - if (_CurrentPlaylistElement.Start != 0f && CConfig.BackgroundMusicUseStart == EOffOn.TR_CONFIG_ON) + if (_CurrentPlaylistElement.Start >0.001 && CConfig.BackgroundMusicUseStart == EOffOn.TR_CONFIG_ON) CSound.SetPosition(_CurrentMusicStream, _CurrentPlaylistElement.Start); else CSound.SetPosition(_CurrentMusicStream, 0); if (_VideoEnabled && _Video != -1) { - if (_CurrentPlaylistElement.Start != 0f && CConfig.BackgroundMusicUseStart == EOffOn.TR_CONFIG_ON) + if (_CurrentPlaylistElement.Start >0.001 && CConfig.BackgroundMusicUseStart == EOffOn.TR_CONFIG_ON) CVideo.VdSkip(_Video, _CurrentPlaylistElement.Start, _CurrentPlaylistElement.VideoGap); else CVideo.VdSkip(_Video, 0f, _CurrentPlaylistElement.VideoGap); @@ -321,13 +321,13 @@ namespace Vocaluxe.Base else if (_CurrentMusicStream != -1) { //Seek to #Start-Tag, if found - if (_CurrentPlaylistElement.Start != 0f && CConfig.BackgroundMusicUseStart == EOffOn.TR_CONFIG_ON) + if (_CurrentPlaylistElement.Start >0.001 && CConfig.BackgroundMusicUseStart == EOffOn.TR_CONFIG_ON) CSound.SetPosition(_CurrentMusicStream, _CurrentPlaylistElement.Start); else CSound.SetPosition(_CurrentMusicStream, 0); if (_VideoEnabled && _Video != -1) { - if (_CurrentPlaylistElement.Start != 0f && CConfig.BackgroundMusicUseStart == EOffOn.TR_CONFIG_ON) + if (_CurrentPlaylistElement.Start > 0.001 && CConfig.BackgroundMusicUseStart == EOffOn.TR_CONFIG_ON) CVideo.VdSkip(_Video, _CurrentPlaylistElement.Start, _CurrentPlaylistElement.VideoGap); else CVideo.VdSkip(_Video, 0f, _CurrentPlaylistElement.VideoGap); @@ -434,7 +434,7 @@ namespace Vocaluxe.Base Pause(); } - if (CConfig.BackgroundMusicVolume != newVolume) + if (Math.Abs(CConfig.BackgroundMusicVolume - newVolume) > 0.01) { CConfig.BackgroundMusicVolume = (int)newVolume; ApplyVolume(); @@ -499,7 +499,7 @@ namespace Vocaluxe.Base if (_Video == -1) { _Video = CVideo.VdLoad(_CurrentPlaylistElement.VideoFilePath); - if (_CurrentPlaylistElement.Start != 0f && CConfig.BackgroundMusicUseStart == EOffOn.TR_CONFIG_ON) + if (_CurrentPlaylistElement.Start >0.001 && CConfig.BackgroundMusicUseStart == EOffOn.TR_CONFIG_ON) CVideo.VdSkip(_Video, _CurrentPlaylistElement.Start, _CurrentPlaylistElement.VideoGap); else CVideo.VdSkip(_Video, 0f, _CurrentPlaylistElement.VideoGap); diff --git a/Vocaluxe/Base/CGraphics.cs b/Vocaluxe/Base/CGraphics.cs index 88f603cf..b3d62cdb 100644 --- a/Vocaluxe/Base/CGraphics.cs +++ b/Vocaluxe/Base/CGraphics.cs @@ -122,7 +122,7 @@ namespace Vocaluxe.Base if (Math.Abs(_Cursor.Rect.X - x) > CSettings.MouseMoveDiffMin || Math.Abs(_Cursor.Rect.Y - y) > CSettings.MouseMoveDiffMin) { - if (_CursorTargetAlpha == 0f) + if (_CursorTargetAlpha < 0.01) _Fade(1f, 0.2f); _Movetimer.Reset(); diff --git a/Vocaluxe/Base/CLog.cs b/Vocaluxe/Base/CLog.cs index 9243d516..7e9bc0c8 100644 --- a/Vocaluxe/Base/CLog.cs +++ b/Vocaluxe/Base/CLog.cs @@ -156,7 +156,7 @@ namespace Vocaluxe.Base space += " "; float ms; - if (Stopwatch.IsHighResolution && _NanosecPerTick != 0.0) + if (Stopwatch.IsHighResolution && _NanosecPerTick > 0) ms = (float)((_NanosecPerTick * _BenchmarkTimer[benchmarkNr].ElapsedTicks) / (1000.0 * 1000.0)); else ms = _BenchmarkTimer[benchmarkNr].ElapsedMilliseconds; diff --git a/Vocaluxe/Lib/Draw/CDrawWinForm.cs b/Vocaluxe/Lib/Draw/CDrawWinForm.cs index bd2756c4..9f0c1006 100644 --- a/Vocaluxe/Lib/Draw/CDrawWinForm.cs +++ b/Vocaluxe/Lib/Draw/CDrawWinForm.cs @@ -319,7 +319,7 @@ namespace Vocaluxe.Lib.Draw public void CopyScreen(ref STexture texture) { - if ((texture.Index == 0) || (texture.Width != GetScreenWidth()) || (texture.Height != GetScreenHeight())) + if (texture.Index == 0 || (int)texture.Width != GetScreenWidth() || (int)texture.Height != GetScreenHeight()) { RemoveTexture(ref texture); texture = CopyScreen(); diff --git a/Vocaluxe/Lib/Input/IInput.cs b/Vocaluxe/Lib/Input/IInput.cs index aef32f7e..a78a5018 100644 --- a/Vocaluxe/Lib/Input/IInput.cs +++ b/Vocaluxe/Lib/Input/IInput.cs @@ -57,7 +57,7 @@ namespace Vocaluxe.Lib.Input { get { - if (!_Timer.IsRunning && _Duration != 0f) + if (!_Timer.IsRunning && Math.Abs(_Duration) > float.Epsilon) { _Timer.Start(); return true; diff --git a/Vocaluxe/Screens/CScreenSing.cs b/Vocaluxe/Screens/CScreenSing.cs index 1df67e38..62b9dbdf 100644 --- a/Vocaluxe/Screens/CScreenSing.cs +++ b/Vocaluxe/Screens/CScreenSing.cs @@ -317,7 +317,7 @@ namespace Vocaluxe.Screens { _CurrentTime = CSound.GetPosition(_CurrentStream); - if (_FinishTime != 0 && _CurrentTime >= _FinishTime) + if (_FinishTime >0.001 && _CurrentTime >= _FinishTime) finish = true; } else @@ -1237,7 +1237,7 @@ namespace Vocaluxe.Screens return; float totalTime = CSound.GetLength(_CurrentStream); - if (song.Finish != 0) + if (Math.Abs(song.Finish) > 0.001) totalTime = song.Finish; float remainingTime = totalTime - _CurrentTime; @@ -1316,7 +1316,7 @@ namespace Vocaluxe.Screens return; float totalTime = CSound.GetLength(_CurrentStream); - if (song.Finish != 0) + if (Math.Abs(song.Finish) > 0.001) totalTime = song.Finish; totalTime -= song.Start; diff --git a/VocaluxeLib/Menu/CParticle.cs b/VocaluxeLib/Menu/CParticle.cs index 8aecbd89..d33001f0 100644 --- a/VocaluxeLib/Menu/CParticle.cs +++ b/VocaluxeLib/Menu/CParticle.cs @@ -105,7 +105,7 @@ namespace VocaluxeLib.Menu public bool IsAlive { - get { return _Age < _MaxAge || _MaxAge == 0f; } + get { return _Age < _MaxAge || Math.Abs(_MaxAge) < float.Epsilon; } } #endregion public vars @@ -218,7 +218,7 @@ namespace VocaluxeLib.Menu if (Math.Round(Y) < maxy) { float vdx = 0f; - if (_Vx != 0) + if (Math.Abs(_Vx) > float.Epsilon) vdx = (float)Math.Sin(currentTime / _Vx * Math.PI); X += _Vx * timediff * (0.5f + vdx); @@ -242,7 +242,7 @@ namespace VocaluxeLib.Menu // update size - if (_Vsize != 0f) + if (Math.Abs(_Vsize) > float.Epsilon) { float size = _Size; switch (_Type) @@ -275,7 +275,7 @@ namespace VocaluxeLib.Menu } // update rotation - if (_Vr != 0f) + if (Math.Abs(_Vr) > 0.01) { float r = currentTime * _Vr / 60f; _Angle = _Rotation + 360f * (r - (float)Math.Floor(r)); diff --git a/VocaluxeLib/Menu/CSelectSlide.cs b/VocaluxeLib/Menu/CSelectSlide.cs index 16fab82a..4886658a 100644 --- a/VocaluxeLib/Menu/CSelectSlide.cs +++ b/VocaluxeLib/Menu/CSelectSlide.cs @@ -503,11 +503,11 @@ namespace VocaluxeLib.Menu writer.WriteElementString("TextH", TextH.ToString("#0.00")); writer.WriteComment(": Text relative x-position"); - if (TextRelativeX != 0) + if (Math.Abs(TextRelativeX) > 0.01) writer.WriteElementString("TextRelativeX", TextRelativeX.ToString("#0.00")); writer.WriteComment(": Text relative y-position"); - if (TextRelativeY != 0) + if (Math.Abs(TextRelativeY) > 0.01) writer.WriteElementString("TextRelativeY", TextRelativeY.ToString("#0.00")); writer.WriteComment(": Maximum text width (if exists)"); diff --git a/VocaluxeLib/Menu/CText.cs b/VocaluxeLib/Menu/CText.cs index b09737b9..c193ed8d 100644 --- a/VocaluxeLib/Menu/CText.cs +++ b/VocaluxeLib/Menu/CText.cs @@ -74,7 +74,7 @@ namespace VocaluxeLib.Menu get { return _X; } set { - if (_X != value) + if (Math.Abs(_X - value) > 0.01) { _X = value; _PositionNeedsUpdate = true; @@ -89,7 +89,7 @@ namespace VocaluxeLib.Menu get { return _Y; } set { - if (_Y != value) + if (Math.Abs(_Y - value) > 0.01) { _Y = value; _PositionNeedsUpdate = true; @@ -110,7 +110,7 @@ namespace VocaluxeLib.Menu get { return _Height; } set { - if (_Height != value) + if (Math.Abs(_Height - value) > 0.01) { _Height = value; _PositionNeedsUpdate = true; @@ -124,7 +124,7 @@ namespace VocaluxeLib.Menu get { return _MaxWidth; } set { - if (_MaxWidth != value) + if (Math.Abs(_MaxWidth - value) > 0.01) { _MaxWidth = value; if (_MaxWidth > 0) @@ -143,7 +143,7 @@ namespace VocaluxeLib.Menu get { return _Bounds; } set { - if (_Bounds.X != value.X || _Bounds.Y != value.Y || _Bounds.W != value.W || _Bounds.H != value.H || _Bounds.Z != value.Z) + if (Math.Abs(_Bounds.X - value.X) > 0.01 || Math.Abs(_Bounds.Y - value.Y) > 0.01 || Math.Abs(_Bounds.W - value.W) > 0.01 || Math.Abs(_Bounds.H - value.H) > 0.01 || Math.Abs(_Bounds.Z - value.Z) > 0.01) { _Bounds = value; _PositionNeedsUpdate = true; diff --git a/VocaluxeLib/Menu/SingNotes/CSingNotes.cs b/VocaluxeLib/Menu/SingNotes/CSingNotes.cs index 3243261d..474ac07a 100644 --- a/VocaluxeLib/Menu/SingNotes/CSingNotes.cs +++ b/VocaluxeLib/Menu/SingNotes/CSingNotes.cs @@ -316,7 +316,7 @@ namespace VocaluxeLib.Menu.SingNotes float beats = line.LastNoteBeat - line.FirstNoteBeat + 1; - if (beats == 0) + if (beats < 1) return; SColorF color = new SColorF( diff --git a/VocaluxeLib/Menu/SongMenu/CSong.cs b/VocaluxeLib/Menu/SongMenu/CSong.cs index 06babb1b..c77e46da 100644 --- a/VocaluxeLib/Menu/SongMenu/CSong.cs +++ b/VocaluxeLib/Menu/SongMenu/CSong.cs @@ -988,7 +988,7 @@ namespace VocaluxeLib.Menu.SongMenu } } - if (PreviewStart == 0f) + if (Math.Abs(PreviewStart) < 0.001) { if (Medley.Source == EMedleySource.Calculated) PreviewStart = CBase.Game.GetTimeFromBeats(Medley.StartBeat, BPM); diff --git a/VocaluxeLib/Menu/SongMenu/CSongMenuFramework.cs b/VocaluxeLib/Menu/SongMenu/CSongMenuFramework.cs index ef2d530c..59a22604 100644 --- a/VocaluxeLib/Menu/SongMenu/CSongMenuFramework.cs +++ b/VocaluxeLib/Menu/SongMenu/CSongMenuFramework.cs @@ -616,7 +616,7 @@ namespace VocaluxeLib.Menu.SongMenu float startposition = CBase.Songs.GetVisibleSong(_Actsong).PreviewStart; - if (startposition == 0f) + if (Math.Abs(startposition) < 0.001) startposition = CBase.Sound.GetLength(stream) / 4f; CBase.Sound.SetPosition(stream, startposition); diff --git a/VocaluxeLib/Menu/SongMenu/CSongMenuTileBoard.cs b/VocaluxeLib/Menu/SongMenu/CSongMenuTileBoard.cs index 2f3ee5fd..56ee0519 100644 --- a/VocaluxeLib/Menu/SongMenu/CSongMenuTileBoard.cs +++ b/VocaluxeLib/Menu/SongMenu/CSongMenuTileBoard.cs @@ -423,7 +423,7 @@ namespace VocaluxeLib.Menu.SongMenu _MedleyTagIcon.Visible = song.Medley.Source == EMedleySource.Tag; float time = CBase.Sound.GetLength(_SongStream); - if (song.Finish != 0) + if (Math.Abs(song.Finish) > 0.001) time = song.Finish; time -= song.Start; From ec766aa7b5455fc05789c6dda26057b544f94988 Mon Sep 17 00:00:00 2001 From: Flamefire Date: Tue, 23 Apr 2013 16:55:57 +0200 Subject: [PATCH 11/27] Removed code redundancies --- .../CPartyScreenTicTacToeMain.cs | 15 ++-- .../CPartyScreenTicTacToeNames.cs | 74 +++++++++---------- Vocaluxe/Base/CBackgroundMusic.cs | 37 ++++------ Vocaluxe/Base/CDataBase.cs | 45 ++++++----- Vocaluxe/Base/CLanguage.cs | 7 +- Vocaluxe/Base/CSettings.cs | 2 + Vocaluxe/Base/CSongSorter.cs | 54 +++++--------- Vocaluxe/Base/CSongs.cs | 3 +- Vocaluxe/Base/CTheme.cs | 32 ++------ Vocaluxe/Base/CUtility.cs | 9 +-- Vocaluxe/Lib/Sound/IPlayback.cs | 2 - Vocaluxe/Lib/Video/CVideoDecoderFFmpeg.cs | 2 +- Vocaluxe/Lib/Video/IVideoDecoder.cs | 1 - Vocaluxe/Lib/Webcam/CAForgeNet.cs | 3 +- Vocaluxe/Screens/CScreenSing.cs | 10 +-- Vocaluxe/Screens/CScreenSong.cs | 15 ++-- VocaluxeLib/Menu/CLyric.cs | 2 +- VocaluxeLib/Menu/CObjectInteractions.cs | 15 +--- VocaluxeLib/Menu/CPlaylist.cs | 13 ++-- VocaluxeLib/Menu/CSelectSlide.cs | 3 +- VocaluxeLib/Menu/CStatic.cs | 8 +- VocaluxeLib/Menu/CText.cs | 3 +- VocaluxeLib/Menu/SingNotes/CNotes.cs | 16 +--- VocaluxeLib/Menu/SongMenu/CSong.cs | 15 +--- .../Menu/SongMenu/CSongMenuTileBoard.cs | 2 +- 25 files changed, 145 insertions(+), 243 deletions(-) diff --git a/PartyModes/PartyModeTicTacToe/CPartyScreenTicTacToeMain.cs b/PartyModes/PartyModeTicTacToe/CPartyScreenTicTacToeMain.cs index 6d1065ed..5044030d 100644 --- a/PartyModes/PartyModeTicTacToe/CPartyScreenTicTacToeMain.cs +++ b/PartyModes/PartyModeTicTacToe/CPartyScreenTicTacToeMain.cs @@ -711,14 +711,13 @@ namespace VocaluxeLib.PartyModes.TicTacToe if (_Fields[_Possibilities[i, j]].Content.Winner > 0) check.Add(_Fields[_Possibilities[i, j]].Content.Winner); } - if (check.Count == _Possibilities.GetLength(1)) - { - //Check for winner - if (check.Contains(1) && !check.Contains(2)) - return 1; - else if (check.Contains(2) && !check.Contains(1)) - return 2; - } + if (check.Count != _Possibilities.GetLength(1)) + continue; + //Check for winner + if (check.Contains(1) && !check.Contains(2)) + return 1; + if (check.Contains(2) && !check.Contains(1)) + return 2; } return 0; } diff --git a/PartyModes/PartyModeTicTacToe/CPartyScreenTicTacToeNames.cs b/PartyModes/PartyModeTicTacToe/CPartyScreenTicTacToeNames.cs index c8e79710..fb355443 100644 --- a/PartyModes/PartyModeTicTacToe/CPartyScreenTicTacToeNames.cs +++ b/PartyModes/PartyModeTicTacToe/CPartyScreenTicTacToeNames.cs @@ -19,6 +19,7 @@ using System; using System.Collections.Generic; +using System.Linq; using System.Windows.Forms; using VocaluxeLib.Menu; @@ -209,8 +210,8 @@ namespace VocaluxeLib.PartyModes.TicTacToe return true; } - // LeftButton isn't hold anymore, but Selec-Mode is still active -> "Drop" of Avatar - else if (_SelectingMouseActive) + // LeftButton isn't hold anymore, but Selec-Mode is still active -> "Drop" of Avatar + if (_SelectingMouseActive) { //Check if really a player was selected if (_SelectedPlayerNr != -1) @@ -571,44 +572,41 @@ namespace VocaluxeLib.PartyModes.TicTacToe private bool _OnAdd() { - for (int i = 0; i < _PlayerChooseButtons.Count; i++) + foreach (CPlayerChooseButton chooseButton in _PlayerChooseButtons.Where(chooseButton => chooseButton.Button.Selected && chooseButton.ProfileID != -1)) { - if (_PlayerChooseButtons[i].Button.Selected && _PlayerChooseButtons[i].ProfileID != -1) + if (_Data.ScreenNames.ProfileIDsTeam1.Count < _NumPlayerTeam1) { - if (_Data.ScreenNames.ProfileIDsTeam1.Count < _NumPlayerTeam1) - { - _Data.ScreenNames.ProfileIDsTeam1.Add(_PlayerChooseButtons[i].ProfileID); - int added = _Data.ScreenNames.ProfileIDsTeam1.Count - 1; - _UpdateButtonNext(); - //Update texture and name - _PlayerDestinationButtons[added].Color = new SColorF(1, 1, 1, 0.6f); - _PlayerDestinationButtons[added].SelColor = new SColorF(1, 1, 1, 1); - _PlayerDestinationButtons[added].Texture = CBase.Profiles.GetProfiles()[_PlayerChooseButtons[i].ProfileID].Avatar.Texture; - _PlayerDestinationButtons[added].SelTexture = CBase.Profiles.GetProfiles()[_PlayerChooseButtons[i].ProfileID].Avatar.Texture; - _PlayerDestinationButtons[added].Text.Text = CBase.Profiles.GetProfiles()[_PlayerChooseButtons[i].ProfileID].PlayerName; - _PlayerDestinationButtons[added].Enabled = true; - //Update Tiles-List - _UpdateButtonPlayerChoose(); - _CheckInteraction(); - return true; - } - else if (_Data.ScreenNames.ProfileIDsTeam2.Count < _NumPlayerTeam2) - { - _Data.ScreenNames.ProfileIDsTeam2.Add(_PlayerChooseButtons[i].ProfileID); - int added = (_Data.ScreenNames.ProfileIDsTeam2.Count - 1) + _PlayerDestinationButtonsNumH; - _UpdateButtonNext(); - //Update texture and name - _PlayerDestinationButtons[added].Color = new SColorF(1, 1, 1, 0.6f); - _PlayerDestinationButtons[added].SelColor = new SColorF(1, 1, 1, 1); - _PlayerDestinationButtons[added].Texture = CBase.Profiles.GetProfiles()[_PlayerChooseButtons[i].ProfileID].Avatar.Texture; - _PlayerDestinationButtons[added].SelTexture = CBase.Profiles.GetProfiles()[_PlayerChooseButtons[i].ProfileID].Avatar.Texture; - _PlayerDestinationButtons[added].Text.Text = CBase.Profiles.GetProfiles()[_PlayerChooseButtons[i].ProfileID].PlayerName; - _PlayerDestinationButtons[added].Enabled = true; - //Update Tiles-List - _UpdateButtonPlayerChoose(); - _CheckInteraction(); - return true; - } + _Data.ScreenNames.ProfileIDsTeam1.Add(chooseButton.ProfileID); + int added = _Data.ScreenNames.ProfileIDsTeam1.Count - 1; + _UpdateButtonNext(); + //Update texture and name + _PlayerDestinationButtons[added].Color = new SColorF(1, 1, 1, 0.6f); + _PlayerDestinationButtons[added].SelColor = new SColorF(1, 1, 1, 1); + _PlayerDestinationButtons[added].Texture = CBase.Profiles.GetProfiles()[chooseButton.ProfileID].Avatar.Texture; + _PlayerDestinationButtons[added].SelTexture = CBase.Profiles.GetProfiles()[chooseButton.ProfileID].Avatar.Texture; + _PlayerDestinationButtons[added].Text.Text = CBase.Profiles.GetProfiles()[chooseButton.ProfileID].PlayerName; + _PlayerDestinationButtons[added].Enabled = true; + //Update Tiles-List + _UpdateButtonPlayerChoose(); + _CheckInteraction(); + return true; + } + if (_Data.ScreenNames.ProfileIDsTeam2.Count < _NumPlayerTeam2) + { + _Data.ScreenNames.ProfileIDsTeam2.Add(chooseButton.ProfileID); + int added = (_Data.ScreenNames.ProfileIDsTeam2.Count - 1) + _PlayerDestinationButtonsNumH; + _UpdateButtonNext(); + //Update texture and name + _PlayerDestinationButtons[added].Color = new SColorF(1, 1, 1, 0.6f); + _PlayerDestinationButtons[added].SelColor = new SColorF(1, 1, 1, 1); + _PlayerDestinationButtons[added].Texture = CBase.Profiles.GetProfiles()[chooseButton.ProfileID].Avatar.Texture; + _PlayerDestinationButtons[added].SelTexture = CBase.Profiles.GetProfiles()[chooseButton.ProfileID].Avatar.Texture; + _PlayerDestinationButtons[added].Text.Text = CBase.Profiles.GetProfiles()[chooseButton.ProfileID].PlayerName; + _PlayerDestinationButtons[added].Enabled = true; + //Update Tiles-List + _UpdateButtonPlayerChoose(); + _CheckInteraction(); + return true; } } return false; diff --git a/Vocaluxe/Base/CBackgroundMusic.cs b/Vocaluxe/Base/CBackgroundMusic.cs index 5f81b346..bfd73230 100644 --- a/Vocaluxe/Base/CBackgroundMusic.cs +++ b/Vocaluxe/Base/CBackgroundMusic.cs @@ -45,7 +45,6 @@ namespace Vocaluxe.Base private static bool _OwnMusicAdded; private static bool _BackgroundMusicAdded; - private static bool _Playing; private static bool _Disabled; private static bool _CanSing; private static bool _RepeatSong; @@ -107,10 +106,7 @@ namespace Vocaluxe.Base get { return File.Exists(_CurrentPlaylistElement.VideoFilePath); } } - public static bool Playing - { - get { return _Playing; } - } + public static bool Playing { get; private set; } public static string ArtistAndTitle { @@ -118,8 +114,7 @@ namespace Vocaluxe.Base { if (_CurrentPlaylistElement.Artist != "" && _CurrentPlaylistElement.Title != "") return _CurrentPlaylistElement.Artist + " - " + _CurrentPlaylistElement.Title; - else - return Path.GetFileNameWithoutExtension(_CurrentPlaylistElement.MusicFilePath); + return Path.GetFileNameWithoutExtension(_CurrentPlaylistElement.MusicFilePath); } } @@ -143,12 +138,12 @@ namespace Vocaluxe.Base if (CConfig.VideoBackgrounds == EOffOn.TR_CONFIG_ON) _VideoEnabled = true; - _Playing = false; + Playing = false; } public static void Play() { - if (_Playing) + if (Playing) return; if (CConfig.BackgroundMusic == EOffOn.TR_CONFIG_ON) @@ -161,7 +156,7 @@ namespace Vocaluxe.Base CSound.Play(_CurrentMusicStream); if (_VideoEnabled && _Video != -1) CVideo.VdResume(_Video); - _Playing = true; + Playing = true; } else Next(); @@ -176,7 +171,7 @@ namespace Vocaluxe.Base public static void Stop() { - if (!_Playing) + if (!Playing) return; if (_VideoEnabled && _Video != -1) @@ -189,12 +184,12 @@ namespace Vocaluxe.Base _CurrentMusicStream = -1; _CurrentPlaylistElement = new CPlaylistElement(); - _Playing = false; + Playing = false; } public static void Pause() { - if (!_Playing) + if (!Playing) return; if (_VideoEnabled && _Video != -1) @@ -203,7 +198,7 @@ namespace Vocaluxe.Base CVideo.VdSkip(_Video, CSound.GetPosition(_CurrentMusicStream) + CSettings.BackgroundMusicFadeTime, _CurrentPlaylistElement.VideoGap); } CSound.FadeAndPause(_CurrentMusicStream, 0f, CSettings.BackgroundMusicFadeTime); - _Playing = false; + Playing = false; } public static void Update() @@ -217,7 +212,7 @@ namespace Vocaluxe.Base timeToPlay = _CurrentPlaylistElement.Finish - CSound.GetPosition(_CurrentMusicStream); bool finished = CSound.IsFinished(_CurrentMusicStream); - if (_Playing && (timeToPlay <= CSettings.BackgroundMusicFadeTime || finished)) + if (Playing && (timeToPlay <= CSettings.BackgroundMusicFadeTime || finished)) { if (_RepeatSong) { @@ -228,7 +223,7 @@ namespace Vocaluxe.Base CSound.SetPosition(_CurrentMusicStream, 0); if (_VideoEnabled && _Video != -1) { - if (_CurrentPlaylistElement.Start >0.001 && CConfig.BackgroundMusicUseStart == EOffOn.TR_CONFIG_ON) + if (_CurrentPlaylistElement.Start > 0.001 && CConfig.BackgroundMusicUseStart == EOffOn.TR_CONFIG_ON) CVideo.VdSkip(_Video, _CurrentPlaylistElement.Start, _CurrentPlaylistElement.VideoGap); else CVideo.VdSkip(_Video, 0f, _CurrentPlaylistElement.VideoGap); @@ -269,7 +264,7 @@ namespace Vocaluxe.Base CSound.SetStreamVolumeMax(_CurrentMusicStream, CConfig.BackgroundMusicVolume); //Seek to #Start-Tag, if found - if (_CurrentPlaylistElement.Start >0.001 && CConfig.BackgroundMusicUseStart == EOffOn.TR_CONFIG_ON) + if (_CurrentPlaylistElement.Start > 0.001 && CConfig.BackgroundMusicUseStart == EOffOn.TR_CONFIG_ON) CSound.SetPosition(_CurrentMusicStream, _CurrentPlaylistElement.Start); if (_VideoEnabled) @@ -289,13 +284,13 @@ namespace Vocaluxe.Base if (CSound.GetPosition(_CurrentMusicStream) >= 1.5f) { //Seek to #Start-Tag, if found - if (_CurrentPlaylistElement.Start >0.001 && CConfig.BackgroundMusicUseStart == EOffOn.TR_CONFIG_ON) + if (_CurrentPlaylistElement.Start > 0.001 && CConfig.BackgroundMusicUseStart == EOffOn.TR_CONFIG_ON) CSound.SetPosition(_CurrentMusicStream, _CurrentPlaylistElement.Start); else CSound.SetPosition(_CurrentMusicStream, 0); if (_VideoEnabled && _Video != -1) { - if (_CurrentPlaylistElement.Start >0.001 && CConfig.BackgroundMusicUseStart == EOffOn.TR_CONFIG_ON) + if (_CurrentPlaylistElement.Start > 0.001 && CConfig.BackgroundMusicUseStart == EOffOn.TR_CONFIG_ON) CVideo.VdSkip(_Video, _CurrentPlaylistElement.Start, _CurrentPlaylistElement.VideoGap); else CVideo.VdSkip(_Video, 0f, _CurrentPlaylistElement.VideoGap); @@ -321,7 +316,7 @@ namespace Vocaluxe.Base else if (_CurrentMusicStream != -1) { //Seek to #Start-Tag, if found - if (_CurrentPlaylistElement.Start >0.001 && CConfig.BackgroundMusicUseStart == EOffOn.TR_CONFIG_ON) + if (_CurrentPlaylistElement.Start > 0.001 && CConfig.BackgroundMusicUseStart == EOffOn.TR_CONFIG_ON) CSound.SetPosition(_CurrentMusicStream, _CurrentPlaylistElement.Start); else CSound.SetPosition(_CurrentMusicStream, 0); @@ -499,7 +494,7 @@ namespace Vocaluxe.Base if (_Video == -1) { _Video = CVideo.VdLoad(_CurrentPlaylistElement.VideoFilePath); - if (_CurrentPlaylistElement.Start >0.001 && CConfig.BackgroundMusicUseStart == EOffOn.TR_CONFIG_ON) + if (_CurrentPlaylistElement.Start > 0.001 && CConfig.BackgroundMusicUseStart == EOffOn.TR_CONFIG_ON) CVideo.VdSkip(_Video, _CurrentPlaylistElement.Start, _CurrentPlaylistElement.VideoGap); else CVideo.VdSkip(_Video, 0f, _CurrentPlaylistElement.VideoGap); diff --git a/Vocaluxe/Base/CDataBase.cs b/Vocaluxe/Base/CDataBase.cs index 6a41e5fb..fa0ee5cf 100644 --- a/Vocaluxe/Base/CDataBase.cs +++ b/Vocaluxe/Base/CDataBase.cs @@ -314,31 +314,28 @@ namespace Vocaluxe.Base reader.Dispose(); return id; } - else + if (reader != null) + reader.Close(); + + command.CommandText = "INSERT INTO Songs (Title, Artist, NumPlayed) " + + "VALUES (@title, @artist, @numplayed)"; + command.Parameters.Add("@title", DbType.String, 0).Value = title; + command.Parameters.Add("@artist", DbType.String, 0).Value = artist; + command.Parameters.Add("@numplayed", DbType.Int32, 0).Value = defNumPlayed; + command.ExecuteNonQuery(); + + command.CommandText = "SELECT id FROM Songs WHERE [Title] = @title AND [Artist] = @artist"; + command.Parameters.Add("@title", DbType.String, 0).Value = title; + command.Parameters.Add("@artist", DbType.String, 0).Value = artist; + + reader = command.ExecuteReader(); + + if (reader != null) { - if (reader != null) - reader.Close(); - - command.CommandText = "INSERT INTO Songs (Title, Artist, NumPlayed) " + - "VALUES (@title, @artist, @numplayed)"; - command.Parameters.Add("@title", DbType.String, 0).Value = title; - command.Parameters.Add("@artist", DbType.String, 0).Value = artist; - command.Parameters.Add("@numplayed", DbType.Int32, 0).Value = defNumPlayed; - command.ExecuteNonQuery(); - - command.CommandText = "SELECT id FROM Songs WHERE [Title] = @title AND [Artist] = @artist"; - command.Parameters.Add("@title", DbType.String, 0).Value = title; - command.Parameters.Add("@artist", DbType.String, 0).Value = artist; - - reader = command.ExecuteReader(); - - if (reader != null) - { - reader.Read(); - int id = reader.GetInt32(0); - reader.Dispose(); - return id; - } + reader.Read(); + int id = reader.GetInt32(0); + reader.Dispose(); + return id; } return -1; diff --git a/Vocaluxe/Base/CLanguage.cs b/Vocaluxe/Base/CLanguage.cs index 21fa3796..9b7da582 100644 --- a/Vocaluxe/Base/CLanguage.cs +++ b/Vocaluxe/Base/CLanguage.cs @@ -225,11 +225,8 @@ namespace Vocaluxe.Base _Languages[nr].PartyModeTexts.Add(lang); return true; } - else - { - CLog.LogError("Error reading Party Language File " + file); - return false; - } + CLog.LogError("Error reading Party Language File " + file); + return false; } private static void _LoadLanguageFile(string fileName) diff --git a/Vocaluxe/Base/CSettings.cs b/Vocaluxe/Base/CSettings.cs index f69c922b..ee116549 100644 --- a/Vocaluxe/Base/CSettings.cs +++ b/Vocaluxe/Base/CSettings.cs @@ -160,7 +160,9 @@ namespace Vocaluxe.Base { string version = ProgramName; + // ReSharper disable ConditionIsAlwaysTrueOrFalse if (ProgramCodeName != "") + // ReSharper restore ConditionIsAlwaysTrueOrFalse version += " \"" + ProgramCodeName + "\""; return version + " " + GetVersionText(); diff --git a/Vocaluxe/Base/CSongSorter.cs b/Vocaluxe/Base/CSongSorter.cs index 7e589b2a..96e39b3d 100644 --- a/Vocaluxe/Base/CSongSorter.cs +++ b/Vocaluxe/Base/CSongSorter.cs @@ -50,11 +50,10 @@ namespace Vocaluxe.Base get { return _IgnoreArticles; } set { - if (value != _IgnoreArticles) - { - _IgnoreArticles = value; - _SetChanged(); - } + if (value == _IgnoreArticles) + return; + _IgnoreArticles = value; + _SetChanged(); } } @@ -63,11 +62,10 @@ namespace Vocaluxe.Base get { return _SongSorting; } set { - if (value != _SongSorting) - { - _SongSorting = value; - _SetChanged(); - } + if (value == _SongSorting) + return; + _SongSorting = value; + _SetChanged(); } } @@ -88,36 +86,28 @@ namespace Vocaluxe.Base private int _SortByFieldArtistTitle(SSongPointer s1, SSongPointer s2) { - int res = s1.SortString.ToUpper().CompareTo(s2.SortString.ToUpper()); + int res = String.Compare(s1.SortString, s2.SortString, StringComparison.OrdinalIgnoreCase); if (res == 0) { if (_IgnoreArticles == EOffOn.TR_CONFIG_ON) { - res = CSongs.Songs[s1.SongID].ArtistSorting.ToUpper().CompareTo(CSongs.Songs[s2.SongID].ArtistSorting.ToUpper()); - if (res == 0) - return CSongs.Songs[s1.SongID].TitleSorting.ToUpper().CompareTo(CSongs.Songs[s2.SongID].TitleSorting.ToUpper()); - return res; - } - else - { - res = CSongs.Songs[s1.SongID].Artist.ToUpper().CompareTo(CSongs.Songs[s2.SongID].Artist.ToUpper()); - if (res == 0) - return CSongs.Songs[s1.SongID].Title.ToUpper().CompareTo(CSongs.Songs[s2.SongID].Title.ToUpper()); - return res; + res = String.Compare(CSongs.Songs[s1.SongID].ArtistSorting, CSongs.Songs[s2.SongID].ArtistSorting, StringComparison.OrdinalIgnoreCase); + return res != 0 ? res: String.Compare(CSongs.Songs[s1.SongID].TitleSorting, CSongs.Songs[s2.SongID].TitleSorting, StringComparison.OrdinalIgnoreCase); } + res = String.Compare(CSongs.Songs[s1.SongID].Artist, CSongs.Songs[s2.SongID].Artist, StringComparison.OrdinalIgnoreCase); + return res != 0 ? res : String.Compare(CSongs.Songs[s1.SongID].Title, CSongs.Songs[s2.SongID].Title, StringComparison.OrdinalIgnoreCase); } return res; } private int _SortByFieldTitle(SSongPointer s1, SSongPointer s2) { - int res = s1.SortString.ToUpper().CompareTo(s2.SortString.ToUpper()); + int res = String.Compare(s1.SortString, s2.SortString, StringComparison.OrdinalIgnoreCase); if (res == 0) { - if (_IgnoreArticles == EOffOn.TR_CONFIG_ON) - return CSongs.Songs[s1.SongID].TitleSorting.ToUpper().CompareTo(CSongs.Songs[s2.SongID].TitleSorting.ToUpper()); - else - return CSongs.Songs[s1.SongID].Title.ToUpper().CompareTo(CSongs.Songs[s2.SongID].Title.ToUpper()); + return _IgnoreArticles == EOffOn.TR_CONFIG_ON + ? String.Compare(CSongs.Songs[s1.SongID].TitleSorting, CSongs.Songs[s2.SongID].TitleSorting, StringComparison.OrdinalIgnoreCase) : + String.Compare(CSongs.Songs[s1.SongID].Title, CSongs.Songs[s2.SongID].Title, StringComparison.OrdinalIgnoreCase); } return res; } @@ -177,16 +167,10 @@ namespace Vocaluxe.Base break; case ESongSorting.TR_CONFIG_ARTIST_LETTER: case ESongSorting.TR_CONFIG_ARTIST: - if (_IgnoreArticles == EOffOn.TR_CONFIG_ON) - fieldName = "ArtistSorting"; - else - fieldName = "Artist"; + fieldName = _IgnoreArticles == EOffOn.TR_CONFIG_ON ? "ArtistSorting" : "Artist"; break; case ESongSorting.TR_CONFIG_TITLE_LETTER: - if (_IgnoreArticles == EOffOn.TR_CONFIG_ON) - fieldName = "TitleSorting"; - else - fieldName = "Title"; + fieldName = _IgnoreArticles == EOffOn.TR_CONFIG_ON ? "TitleSorting" : "Title"; break; case ESongSorting.TR_CONFIG_YEAR: case ESongSorting.TR_CONFIG_DECADE: diff --git a/Vocaluxe/Base/CSongs.cs b/Vocaluxe/Base/CSongs.cs index 68f46f4c..6a2ecea7 100644 --- a/Vocaluxe/Base/CSongs.cs +++ b/Vocaluxe/Base/CSongs.cs @@ -205,8 +205,7 @@ namespace Vocaluxe.Base { if ((Categorizer.Categories.Count > 0) && (_CatIndex >= 0) && (Categorizer.Categories.Count > _CatIndex)) return Categorizer.Categories[_CatIndex].Name; - else - return String.Empty; + return String.Empty; } public static CSong GetSong(int songID) diff --git a/Vocaluxe/Base/CTheme.cs b/Vocaluxe/Base/CTheme.cs index c61499f3..be7fd8f9 100644 --- a/Vocaluxe/Base/CTheme.cs +++ b/Vocaluxe/Base/CTheme.cs @@ -548,7 +548,7 @@ namespace Vocaluxe.Base { if (partyModeID != -1 && _Skins[i].PartyModeID == partyModeID) return i; - else if (partyModeID == -1 && _Skins[i].Name == CConfig.Skin) + if (partyModeID == -1 && _Skins[i].Name == CConfig.Skin) return i; } @@ -561,7 +561,7 @@ namespace Vocaluxe.Base { if (partyModeID != -1 && _Themes[i].PartyModeID == partyModeID) return i; - else if (partyModeID == -1 && _Themes[i].Name == CConfig.Theme) + if (partyModeID == -1 && _Themes[i].Name == CConfig.Theme) return i; } @@ -597,22 +597,12 @@ namespace Vocaluxe.Base return _GetSkinFileName(skinName, GetSkinIndex(partyModeID), true); } - private static string _GetSkinFileName(string skinName, int skinIndex) - { - return _GetSkinFileName(skinName, skinIndex, false); - } - - private static string _GetSkinFileName(string skinName, int skinIndex, bool returnPath) + private static string _GetSkinFileName(string skinName, int skinIndex, bool returnPath = false) { foreach (SSkinElement sk in _Skins[skinIndex].SkinList.Values) { if (sk.Name == skinName) - { - if (!returnPath) - return sk.Value; - else - return Path.Combine(_Skins[skinIndex].Path, sk.Value); - } + return !returnPath ? sk.Value : Path.Combine(_Skins[skinIndex].Path, sk.Value); } CLog.LogError("Can't find Skin Element \"" + skinName); @@ -695,22 +685,12 @@ namespace Vocaluxe.Base return _GetVideoFileName(videoName, GetSkinIndex(partyModeID), true); } - private static string _GetVideoFileName(string videoName, int skinIndex) - { - return _GetVideoFileName(videoName, skinIndex, false); - } - - private static string _GetVideoFileName(string videoName, int skinIndex, bool returnPath) + private static string _GetVideoFileName(string videoName, int skinIndex, bool returnPath = false) { foreach (SSkinElement sk in _Skins[skinIndex].VideoList) { if (sk.Name == videoName) - { - if (!returnPath) - return sk.Value; - else - return Path.Combine(_Skins[skinIndex].Path, sk.Value); - } + return !returnPath ? sk.Value : Path.Combine(_Skins[skinIndex].Path, sk.Value); } CLog.LogError("Can't find Video Element \"" + videoName); diff --git a/Vocaluxe/Base/CUtility.cs b/Vocaluxe/Base/CUtility.cs index 8ff7f225..ce357ea9 100644 --- a/Vocaluxe/Base/CUtility.cs +++ b/Vocaluxe/Base/CUtility.cs @@ -59,11 +59,9 @@ namespace Vocaluxe.Base long ticks = _Stopwatch.ElapsedTicks; if (Stopwatch.IsHighResolution && ticks != 0) return (float)((_NanosecPerTick * ticks) / (1000.0 * 1000.0)); - else - return _Stopwatch.ElapsedMilliseconds; + return _Stopwatch.ElapsedMilliseconds; } - else - return 0f; + return 0f; } public static float CalculateFPS() @@ -190,8 +188,7 @@ namespace Vocaluxe.Base _Del(0); return true; } - else - return false; + return false; } public void CopyEvents() diff --git a/Vocaluxe/Lib/Sound/IPlayback.cs b/Vocaluxe/Lib/Sound/IPlayback.cs index 69058546..d6f6d563 100644 --- a/Vocaluxe/Lib/Sound/IPlayback.cs +++ b/Vocaluxe/Lib/Sound/IPlayback.cs @@ -17,8 +17,6 @@ // */ #endregion -using System; - namespace Vocaluxe.Lib.Sound { struct SAudioStreams diff --git a/Vocaluxe/Lib/Video/CVideoDecoderFFmpeg.cs b/Vocaluxe/Lib/Video/CVideoDecoderFFmpeg.cs index 6aae01ae..135d3129 100644 --- a/Vocaluxe/Lib/Video/CVideoDecoderFFmpeg.cs +++ b/Vocaluxe/Lib/Video/CVideoDecoderFFmpeg.cs @@ -661,7 +661,7 @@ namespace Vocaluxe.Lib.Video if (num >= 0) { - if (frame.Index == -1 || _Width != (int) frame.Width || _Height != (int) frame.Height) + if (frame.Index == -1 || _Width != (int)frame.Width || _Height != (int)frame.Height) { CDraw.RemoveTexture(ref frame); frame = CDraw.AddTexture(_Width, _Height, ref _FrameBuffer[num].Data); diff --git a/Vocaluxe/Lib/Video/IVideoDecoder.cs b/Vocaluxe/Lib/Video/IVideoDecoder.cs index da0db810..4dc3905a 100644 --- a/Vocaluxe/Lib/Video/IVideoDecoder.cs +++ b/Vocaluxe/Lib/Video/IVideoDecoder.cs @@ -17,7 +17,6 @@ // */ #endregion -using System; using VocaluxeLib.Menu; namespace Vocaluxe.Lib.Video diff --git a/Vocaluxe/Lib/Webcam/CAForgeNet.cs b/Vocaluxe/Lib/Webcam/CAForgeNet.cs index 6ba3577f..446cf681 100644 --- a/Vocaluxe/Lib/Webcam/CAForgeNet.cs +++ b/Vocaluxe/Lib/Webcam/CAForgeNet.cs @@ -17,7 +17,6 @@ // */ #endregion -using System; using AForge.Video; using AForge.Video.DirectShow; using System.Collections.Generic; @@ -57,7 +56,7 @@ namespace Vocaluxe.Lib.Webcam { lock (_MutexData) { - if (frame.Index == -1 || _Width != (int) frame.Width || _Height != (int)frame.Height) + if (frame.Index == -1 || _Width != (int)frame.Width || _Height != (int)frame.Height) { CDraw.RemoveTexture(ref frame); frame = CDraw.AddTexture(_Width, _Height, ref _Data); diff --git a/Vocaluxe/Screens/CScreenSing.cs b/Vocaluxe/Screens/CScreenSing.cs index 62b9dbdf..361c5f6d 100644 --- a/Vocaluxe/Screens/CScreenSing.cs +++ b/Vocaluxe/Screens/CScreenSing.cs @@ -317,7 +317,7 @@ namespace Vocaluxe.Screens { _CurrentTime = CSound.GetPosition(_CurrentStream); - if (_FinishTime >0.001 && _CurrentTime >= _FinishTime) + if (_FinishTime > 0.001 && _CurrentTime >= _FinishTime) finish = true; } else @@ -1038,13 +1038,11 @@ namespace Vocaluxe.Screens private float[] _CalcFadingAlpha() { - float dt = 4f; - float rt = dt * 0.8f; + const float dt = 4f; + const float rt = dt * 0.8f; CSong song = CGame.GetSong(); - if (song == null) - return null; - else if (!song.NotesLoaded) + if (song == null || !song.NotesLoaded) return null; float[] alpha = new float[song.Notes.Lines.Length * 2]; diff --git a/Vocaluxe/Screens/CScreenSong.cs b/Vocaluxe/Screens/CScreenSong.cs index 8e9dcde9..9db36407 100644 --- a/Vocaluxe/Screens/CScreenSong.cs +++ b/Vocaluxe/Screens/CScreenSong.cs @@ -463,24 +463,24 @@ namespace Vocaluxe.Screens _ToggleSongOptions(ESongOptionsView.General); return true; } - else if (_Buttons[_ButtonOptionsClose].Selected) + if (_Buttons[_ButtonOptionsClose].Selected) { _ToggleSongOptions(ESongOptionsView.None); return true; } - else if (_Buttons[_ButtonOptionsSing].Selected) + if (_Buttons[_ButtonOptionsSing].Selected) { _ToggleSongOptions(ESongOptionsView.None); _StartSong(_SongMenus[_SongMenu].GetSelectedSong()); return true; } - else if (_Buttons[_ButtonOptionsPlaylist].Selected) + if (_Buttons[_ButtonOptionsPlaylist].Selected) { _ToggleSongOptions(ESongOptionsView.None); _OpenAndAddPlaylistAction(); return true; } - else if (_Buttons[_ButtonOptionsRandom].Selected) + if (_Buttons[_ButtonOptionsRandom].Selected) { if (CSongs.IsInCategory) { @@ -558,11 +558,8 @@ namespace Vocaluxe.Screens _ToggleSongOptions(ESongOptionsView.Song); return true; } - else - { - _ToggleSongOptions(ESongOptionsView.None); - return true; - } + _ToggleSongOptions(ESongOptionsView.None); + return true; } } diff --git a/VocaluxeLib/Menu/CLyric.cs b/VocaluxeLib/Menu/CLyric.cs index 6e928c4a..2d18e6ec 100644 --- a/VocaluxeLib/Menu/CLyric.cs +++ b/VocaluxeLib/Menu/CLyric.cs @@ -503,7 +503,7 @@ namespace VocaluxeLib.Menu if (diff <= 0) diff = 1; - float p = 1f-(currentBeat - _Notes[jumpNote].StartBeat) / diff; + float p = 1f - (currentBeat - _Notes[jumpNote].StartBeat) / diff; if (Math.Abs(p) < float.Epsilon) _Text.Draw(); diff --git a/VocaluxeLib/Menu/CObjectInteractions.cs b/VocaluxeLib/Menu/CObjectInteractions.cs index 5f7d6044..1dd503ef 100644 --- a/VocaluxeLib/Menu/CObjectInteractions.cs +++ b/VocaluxeLib/Menu/CObjectInteractions.cs @@ -500,10 +500,7 @@ namespace VocaluxeLib.Menu if (_Selection >= _Interactions.Count || _Selection < 0) return false; - if (_Interactions.Count > 0) - return _IsMouseOver(x, y, _Interactions[_Selection]); - else - return false; + return _Interactions.Count > 0 && _IsMouseOver(x, y, _Interactions[_Selection]); } private bool _IsMouseOver(int x, int y, CInteraction interact) @@ -789,10 +786,7 @@ namespace VocaluxeLib.Menu inDirection = true; break; } - if (!inDirection) - return float.MaxValue; - else - return distance; + return !inDirection ? float.MaxValue : distance; } private float _GetDistance180(SKeyEvent key, SRectF actualRect, SRectF targetRect) @@ -825,10 +819,7 @@ namespace VocaluxeLib.Menu inDirection = true; break; } - if (!inDirection) - return float.MaxValue; - else - return distance; + return !inDirection ? float.MaxValue : distance; } /// diff --git a/VocaluxeLib/Menu/CPlaylist.cs b/VocaluxeLib/Menu/CPlaylist.cs index b748048d..ed2bff99 100644 --- a/VocaluxeLib/Menu/CPlaylist.cs +++ b/VocaluxeLib/Menu/CPlaylist.cs @@ -873,7 +873,7 @@ namespace VocaluxeLib.Menu } return true; } - else if (mouseEvent.Wheel < 0) + if (mouseEvent.Wheel < 0) { if (Offset + mouseEvent.Wheel >= 0) { @@ -925,23 +925,23 @@ namespace VocaluxeLib.Menu ClosePlaylist(); return true; } - else if (_Theme.ButtonPlaylistSing.Selected) + if (_Theme.ButtonPlaylistSing.Selected) { _StartPlaylistSongs(); return true; } - else if (_Theme.ButtonPlaylistSave.Selected) + if (_Theme.ButtonPlaylistSave.Selected) { CBase.Playlist.SavePlaylist(ActivePlaylistID); return true; } - else if (_Theme.ButtonPlaylistDelete.Selected) + if (_Theme.ButtonPlaylistDelete.Selected) { CBase.Playlist.DeletePlaylist(ActivePlaylistID); ClosePlaylist(); return true; } - else if (_Theme.ButtonPlaylistName.Selected) + if (_Theme.ButtonPlaylistName.Selected) { EditMode = EEditMode.PlaylistName; _Theme.ButtonPlaylistName.EditMode = true; @@ -1159,8 +1159,7 @@ namespace VocaluxeLib.Menu Update(); return true; } - else - return false; + return false; } public void UpdatePlaylist() diff --git a/VocaluxeLib/Menu/CSelectSlide.cs b/VocaluxeLib/Menu/CSelectSlide.cs index 4886658a..792fdc25 100644 --- a/VocaluxeLib/Menu/CSelectSlide.cs +++ b/VocaluxeLib/Menu/CSelectSlide.cs @@ -134,8 +134,7 @@ namespace VocaluxeLib.Menu { if (_Selection >= 0 && _ValueIndexes.Count > _Selection) return _ValueIndexes[_Selection]; - else - return -1; + return -1; } } diff --git a/VocaluxeLib/Menu/CStatic.cs b/VocaluxeLib/Menu/CStatic.cs index 50bf7278..39ed21d7 100644 --- a/VocaluxeLib/Menu/CStatic.cs +++ b/VocaluxeLib/Menu/CStatic.cs @@ -45,13 +45,7 @@ namespace VocaluxeLib.Menu private STexture _Texture; public STexture Texture { - get - { - if (_Texture.Index != -1) - return _Texture; - else - return CBase.Theme.GetSkinTexture(_Theme.TextureName, _PartyModeID); - } + get { return _Texture.Index != -1 ? _Texture : CBase.Theme.GetSkinTexture(_Theme.TextureName, _PartyModeID); } set { _Texture = value; } } diff --git a/VocaluxeLib/Menu/CText.cs b/VocaluxeLib/Menu/CText.cs index c193ed8d..e148d062 100644 --- a/VocaluxeLib/Menu/CText.cs +++ b/VocaluxeLib/Menu/CText.cs @@ -143,7 +143,8 @@ namespace VocaluxeLib.Menu get { return _Bounds; } set { - if (Math.Abs(_Bounds.X - value.X) > 0.01 || Math.Abs(_Bounds.Y - value.Y) > 0.01 || Math.Abs(_Bounds.W - value.W) > 0.01 || Math.Abs(_Bounds.H - value.H) > 0.01 || Math.Abs(_Bounds.Z - value.Z) > 0.01) + if (Math.Abs(_Bounds.X - value.X) > 0.01 || Math.Abs(_Bounds.Y - value.Y) > 0.01 || Math.Abs(_Bounds.W - value.W) > 0.01 || Math.Abs(_Bounds.H - value.H) > 0.01 || + Math.Abs(_Bounds.Z - value.Z) > 0.01) { _Bounds = value; _PositionNeedsUpdate = true; diff --git a/VocaluxeLib/Menu/SingNotes/CNotes.cs b/VocaluxeLib/Menu/SingNotes/CNotes.cs index 21377ab5..f2308693 100644 --- a/VocaluxeLib/Menu/SingNotes/CNotes.cs +++ b/VocaluxeLib/Menu/SingNotes/CNotes.cs @@ -379,24 +379,12 @@ namespace VocaluxeLib.Menu.SingNotes public CNote FirstNote { - get - { - if (_Notes.Count > 0) - return _Notes[0]; - else - return null; - } + get { return _Notes.Count > 0 ? _Notes[0] : null; } } public CNote LastNote { - get - { - if (_Notes.Count > 0) - return _Notes[_Notes.Count - 1]; - else - return null; - } + get { return _Notes.Count > 0 ? _Notes[_Notes.Count - 1] : null; } } public int BaseLine diff --git a/VocaluxeLib/Menu/SongMenu/CSong.cs b/VocaluxeLib/Menu/SongMenu/CSong.cs index c77e46da..38f5dc4a 100644 --- a/VocaluxeLib/Menu/SongMenu/CSong.cs +++ b/VocaluxeLib/Menu/SongMenu/CSong.cs @@ -66,13 +66,7 @@ namespace VocaluxeLib.Menu.SongMenu public STexture CoverTextureBig { - get - { - if (_CoverBigLoaded) - return _CoverTextureBig; - else - return _CoverTextureSmall; - } + get { return _CoverBigLoaded ? _CoverTextureBig : _CoverTextureSmall; } set { if (value.Index != -1) @@ -1016,11 +1010,8 @@ namespace VocaluxeLib.Menu.SongMenu ShortEnd = lines.Line[series[i].Start - 1].LastNote.EndBeat; return; } - else - { - ShortEnd = lines.Line[series[i].End].LastNote.EndBeat; - return; - } + ShortEnd = lines.Line[series[i].End].LastNote.EndBeat; + return; } } diff --git a/VocaluxeLib/Menu/SongMenu/CSongMenuTileBoard.cs b/VocaluxeLib/Menu/SongMenu/CSongMenuTileBoard.cs index 56ee0519..7ed861c6 100644 --- a/VocaluxeLib/Menu/SongMenu/CSongMenuTileBoard.cs +++ b/VocaluxeLib/Menu/SongMenu/CSongMenuTileBoard.cs @@ -367,7 +367,7 @@ namespace VocaluxeLib.Menu.SongMenu mouseEvent.Handled = true; return; } - else if (mouseEvent.RB && CBase.Songs.GetTabs() == EOffOn.TR_CONFIG_OFF && !songOptions.Selection.PartyMode) + if (mouseEvent.RB && CBase.Songs.GetTabs() == EOffOn.TR_CONFIG_OFF && !songOptions.Selection.PartyMode) CBase.Graphics.FadeTo(EScreens.ScreenMain); else if (_PreviewSelected != -1 && mouseEvent.LB && CBase.Songs.GetCurrentCategoryIndex() != -1 && !songOptions.Selection.PartyMode) { From 477b0235201062c14e7b7b2795d9c40663c4d614 Mon Sep 17 00:00:00 2001 From: Flamefire Date: Tue, 23 Apr 2013 21:47:46 +0200 Subject: [PATCH 12/27] More refactoring (unused stuff removed) --- Output/Themes/Ambient/Screens/ScreenSong.xml | 2 +- .../PartyModeChallenge/CPartyModeChallenge.cs | 11 +- .../CPartyScreenChallengeMain.cs | 30 ++-- .../CChallengeRounds.cs | 2 - .../CPartyModeChallengeMedley.cs | 11 +- .../CPartyScreenChallengeMedleyMain.cs | 30 ++-- .../CPartyScreenChallengeMedleyNames.cs | 14 +- .../CPartyScreenTicTacToeNames.cs | 10 +- Vocaluxe/Base/CBackgroundMusic.cs | 1 - Vocaluxe/Base/CDataBase.cs | 12 +- Vocaluxe/Base/CGraphics.cs | 35 +++-- Vocaluxe/Base/CLanguage.cs | 7 +- Vocaluxe/Base/CParty.cs | 42 +++--- Vocaluxe/Base/CPlaylists.cs | 7 +- Vocaluxe/Base/CSongs.cs | 4 +- Vocaluxe/Base/CSound.cs | 6 +- Vocaluxe/Lib/Sound/CDirectSoundRecord.cs | 10 +- Vocaluxe/Lib/Sound/CGstreamerAudio.cs | 7 +- Vocaluxe/Lib/Sound/COpenALPlay.cs | 14 -- Vocaluxe/Lib/Sound/CPortAudioPlay.cs | 22 +-- Vocaluxe/Lib/Sound/CPortAudioRecord.cs | 4 +- .../Lib/Sound/Decoder/CAudioDecoderFFmpeg.cs | 2 +- Vocaluxe/Lib/Sound/Decoder/IAudioDecoder.cs | 2 +- Vocaluxe/Lib/Sound/Portaudio/PortAudio.cs | 3 + Vocaluxe/Lib/Video/CVideoDecoderGstreamer.cs | 6 +- Vocaluxe/Program.cs | 2 +- Vocaluxe/Screens/CScreenCredits.cs | 52 ++++--- Vocaluxe/Screens/CScreenHighscore.cs | 1 - Vocaluxe/Screens/CScreenSing.cs | 5 +- VocaluxeLib/Menu/CButton.cs | 12 +- VocaluxeLib/Menu/CHelper.cs | 12 +- VocaluxeLib/Menu/CMenuParty.cs | 5 - VocaluxeLib/Menu/CNameSelection.cs | 10 -- VocaluxeLib/Menu/CPlaylist.cs | 14 +- VocaluxeLib/Menu/CText.cs | 7 +- VocaluxeLib/Menu/Enums.cs | 11 +- VocaluxeLib/Menu/SingNotes/CSingNotes.cs | 137 +++++++----------- VocaluxeLib/Menu/SongMenu/CSong.cs | 5 - 38 files changed, 217 insertions(+), 350 deletions(-) diff --git a/Output/Themes/Ambient/Screens/ScreenSong.xml b/Output/Themes/Ambient/Screens/ScreenSong.xml index e279174b..29173a81 100644 --- a/Output/Themes/Ambient/Screens/ScreenSong.xml +++ b/Output/Themes/Ambient/Screens/ScreenSong.xml @@ -1844,7 +1844,7 @@ Outline - + %a - %t diff --git a/PartyModes/PartyModeChallenge/CPartyModeChallenge.cs b/PartyModes/PartyModeChallenge/CPartyModeChallenge.cs index fcdd4b98..e15974b2 100644 --- a/PartyModes/PartyModeChallenge/CPartyModeChallenge.cs +++ b/PartyModes/PartyModeChallenge/CPartyModeChallenge.cs @@ -643,13 +643,12 @@ namespace VocaluxeLib.PartyModes.Challenge int pos = 1; int lastPoints = 0; int lastSingPoints = 0; - for (int i = 0; i < _GameData.ResultTable.Count; i++) - { - if (lastPoints > _GameData.ResultTable[i].NumGamePoints || lastSingPoints > _GameData.ResultTable[i].NumSingPoints) + foreach (CResultTableRow resultRow in _GameData.ResultTable) { + if (lastPoints > resultRow.NumGamePoints || lastSingPoints > resultRow.NumSingPoints) pos++; - _GameData.ResultTable[i].Position = pos; - lastPoints = _GameData.ResultTable[i].NumGamePoints; - lastSingPoints = _GameData.ResultTable[i].NumSingPoints; + resultRow.Position = pos; + lastPoints = resultRow.NumGamePoints; + lastSingPoints = resultRow.NumSingPoints; } } diff --git a/PartyModes/PartyModeChallenge/CPartyScreenChallengeMain.cs b/PartyModes/PartyModeChallenge/CPartyScreenChallengeMain.cs index 82db58c1..87d6704a 100644 --- a/PartyModes/PartyModeChallenge/CPartyScreenChallengeMain.cs +++ b/PartyModes/PartyModeChallenge/CPartyScreenChallengeMain.cs @@ -412,12 +412,11 @@ namespace VocaluxeLib.PartyModes.Challenge _RoundsTable.Add(rtr); } //Create statics and texts for rounds - for (int round = 0; round < _RoundsTable.Count; round++) - { + foreach (CRoundsTableRow roundRow in _RoundsTable) { //Round-number CText text = GetNewText(_Texts[_TextRoundNumber]); _AddText(text); - _RoundsTable[round].Number = text; + roundRow.Number = text; for (int row = 0; row < 2; row++) { for (int column = 0; column < 3; column++) @@ -425,11 +424,11 @@ namespace VocaluxeLib.PartyModes.Challenge //Player text = GetNewText(_Texts[_TextRoundPlayer]); _AddText(text); - _RoundsTable[round].TextPlayer.Add(text); + roundRow.TextPlayer.Add(text); //Score text = GetNewText(_Texts[_TextRoundScore]); _AddText(text); - _RoundsTable[round].TextScores.Add(text); + roundRow.TextScores.Add(text); } } } @@ -458,11 +457,10 @@ namespace VocaluxeLib.PartyModes.Challenge float delta = _Texts[_TextRoundNumber].Height; //Update statics and texts for rounds - for (int round = 0; round < _RoundsTable.Count; round++) - { + foreach (CRoundsTableRow roundRow in _RoundsTable) { //Round-number - _RoundsTable[round].Number.X = numberX; - _RoundsTable[round].Number.Y = numberY; + roundRow.Number.X = numberX; + roundRow.Number.Y = numberY; int numInnerRows = (int)Math.Ceiling(_GameState.NumPlayerAtOnce / ((double)numPlayerInOneRow)); for (int row = 0; row < numInnerRows; row++) { @@ -479,14 +477,14 @@ namespace VocaluxeLib.PartyModes.Challenge float x = numberX + 15 + (CBase.Settings.GetRenderW() - _Texts[_TextRoundNumber].X - 20) / numPlayerInThisRow * (column - row * numPlayerInOneRow) + ((CBase.Settings.GetRenderW() - _Texts[_TextRoundNumber].X - 20) / numPlayerInThisRow) / 2; float maxw = ((CBase.Settings.GetRenderW() - _Texts[_TextRoundNumber].X - 20) / numPlayerInThisRow) / 2 - 5; - _RoundsTable[round].TextPlayer[column].X = x; - _RoundsTable[round].TextPlayer[column].Y = numberY; - _RoundsTable[round].TextPlayer[column].MaxWidth = maxw; + roundRow.TextPlayer[column].X = x; + roundRow.TextPlayer[column].Y = numberY; + roundRow.TextPlayer[column].MaxWidth = maxw; //Score - _RoundsTable[round].TextScores[column] = _RoundsTable[round].TextScores[column]; - _RoundsTable[round].TextScores[column].X = x; - _RoundsTable[round].TextScores[column].Y = numberY + delta; - _RoundsTable[round].TextScores[column].MaxWidth = maxw; + roundRow.TextScores[column] = roundRow.TextScores[column]; + roundRow.TextScores[column].X = x; + roundRow.TextScores[column].Y = numberY + delta; + roundRow.TextScores[column].MaxWidth = maxw; } numberY = numberY + delta + delta; } diff --git a/PartyModes/PartyModeChallengeMedley/CChallengeRounds.cs b/PartyModes/PartyModeChallengeMedley/CChallengeRounds.cs index 1305ea98..ea149cdc 100644 --- a/PartyModes/PartyModeChallengeMedley/CChallengeRounds.cs +++ b/PartyModes/PartyModeChallengeMedley/CChallengeRounds.cs @@ -155,8 +155,6 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley if (_Combs.Count == 0) _Create(); - CCombination combs = new CCombination(); - if (_NumPlayer == _NumMics) return _Combs[0]; diff --git a/PartyModes/PartyModeChallengeMedley/CPartyModeChallengeMedley.cs b/PartyModes/PartyModeChallengeMedley/CPartyModeChallengeMedley.cs index 7028f104..a9f76d23 100644 --- a/PartyModes/PartyModeChallengeMedley/CPartyModeChallengeMedley.cs +++ b/PartyModes/PartyModeChallengeMedley/CPartyModeChallengeMedley.cs @@ -718,13 +718,12 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley int pos = 1; int lastPoints = 0; int lastSingPoints = 0; - for (int i = 0; i < _GameData.ResultTable.Count; i++) - { - if (lastPoints > _GameData.ResultTable[i].NumGamePoints || lastSingPoints > _GameData.ResultTable[i].NumSingPoints) + foreach (CResultTableRow resultRow in _GameData.ResultTable) { + if (lastPoints > resultRow.NumGamePoints || lastSingPoints > resultRow.NumSingPoints) pos++; - _GameData.ResultTable[i].Position = pos; - lastPoints = _GameData.ResultTable[i].NumGamePoints; - lastSingPoints = _GameData.ResultTable[i].NumSingPoints; + resultRow.Position = pos; + lastPoints = resultRow.NumGamePoints; + lastSingPoints = resultRow.NumSingPoints; } } diff --git a/PartyModes/PartyModeChallengeMedley/CPartyScreenChallengeMedleyMain.cs b/PartyModes/PartyModeChallengeMedley/CPartyScreenChallengeMedleyMain.cs index ba0d258d..3ac5fc60 100644 --- a/PartyModes/PartyModeChallengeMedley/CPartyScreenChallengeMedleyMain.cs +++ b/PartyModes/PartyModeChallengeMedley/CPartyScreenChallengeMedleyMain.cs @@ -412,12 +412,11 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley _RoundsTable.Add(rtr); } //Create statics and texts for rounds - for (int round = 0; round < _RoundsTable.Count; round++) - { + foreach (CRoundsTableRow roundRow in _RoundsTable) { //Round-number CText text = GetNewText(_Texts[_TextRoundNumber]); _AddText(text); - _RoundsTable[round].Number = text; + roundRow.Number = text; for (int row = 0; row < 2; row++) { for (int column = 0; column < 3; column++) @@ -425,11 +424,11 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley //Player text = GetNewText(_Texts[_TextRoundPlayer]); _AddText(text); - _RoundsTable[round].TextPlayer.Add(text); + roundRow.TextPlayer.Add(text); //Score text = GetNewText(_Texts[_TextRoundScore]); _AddText(text); - _RoundsTable[round].TextScores.Add(text); + roundRow.TextScores.Add(text); } } } @@ -458,11 +457,10 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley float delta = _Texts[_TextRoundNumber].Height; //Update statics and texts for rounds - for (int round = 0; round < _RoundsTable.Count; round++) - { + foreach (CRoundsTableRow roundRow in _RoundsTable) { //Round-number - _RoundsTable[round].Number.X = numberX; - _RoundsTable[round].Number.Y = numberY; + roundRow.Number.X = numberX; + roundRow.Number.Y = numberY; int numInnerRows = (int)Math.Ceiling(_GameState.NumPlayerAtOnce / ((double)numPlayerInOneRow)); for (int row = 0; row < numInnerRows; row++) { @@ -479,14 +477,14 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley float x = numberX + 15 + (CBase.Settings.GetRenderW() - _Texts[_TextRoundNumber].X - 20) / numPlayerInThisRow * (column - row * numPlayerInOneRow) + ((CBase.Settings.GetRenderW() - _Texts[_TextRoundNumber].X - 20) / numPlayerInThisRow) / 2; float maxw = ((CBase.Settings.GetRenderW() - _Texts[_TextRoundNumber].X - 20) / numPlayerInThisRow) / 2 - 5; - _RoundsTable[round].TextPlayer[column].X = x; - _RoundsTable[round].TextPlayer[column].Y = numberY; - _RoundsTable[round].TextPlayer[column].MaxWidth = maxw; + roundRow.TextPlayer[column].X = x; + roundRow.TextPlayer[column].Y = numberY; + roundRow.TextPlayer[column].MaxWidth = maxw; //Score - _RoundsTable[round].TextScores[column] = _RoundsTable[round].TextScores[column]; - _RoundsTable[round].TextScores[column].X = x; - _RoundsTable[round].TextScores[column].Y = numberY + delta; - _RoundsTable[round].TextScores[column].MaxWidth = maxw; + roundRow.TextScores[column] = roundRow.TextScores[column]; + roundRow.TextScores[column].X = x; + roundRow.TextScores[column].Y = numberY + delta; + roundRow.TextScores[column].MaxWidth = maxw; } numberY = numberY + delta + delta; } diff --git a/PartyModes/PartyModeChallengeMedley/CPartyScreenChallengeMedleyNames.cs b/PartyModes/PartyModeChallengeMedley/CPartyScreenChallengeMedleyNames.cs index af6cbc13..959dc7ec 100644 --- a/PartyModes/PartyModeChallengeMedley/CPartyScreenChallengeMedleyNames.cs +++ b/PartyModes/PartyModeChallengeMedley/CPartyScreenChallengeMedleyNames.cs @@ -85,7 +85,6 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley _Data.ScreenNames.ProfileIDs = new List(); - List buttons = new List(); _ThemeButtons = new string[] {_ButtonBack, _ButtonNext, _ButtonPlayerDestination, _ButtonPlayerChoose}; _Data = new SDataFromScreen(); @@ -459,21 +458,20 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley private bool _OnAdd() { - for (int i = 0; i < _PlayerChooseButtons.Count; i++) - { - if (_PlayerChooseButtons[i].Button.Selected && _PlayerChooseButtons[i].ProfileID != -1) + foreach (CPlayerChooseButton chooseButton in _PlayerChooseButtons) { + if (chooseButton.Button.Selected && chooseButton.ProfileID != -1) { if (_Data.ScreenNames.ProfileIDs.Count < _NumPlayer) { - _Data.ScreenNames.ProfileIDs.Add(_PlayerChooseButtons[i].ProfileID); + _Data.ScreenNames.ProfileIDs.Add(chooseButton.ProfileID); int added = _Data.ScreenNames.ProfileIDs.Count - 1; _UpdateButtonNext(); //Update texture and name _PlayerDestinationButtons[added].Color = new SColorF(1, 1, 1, 0.6f); _PlayerDestinationButtons[added].SelColor = new SColorF(1, 1, 1, 1); - _PlayerDestinationButtons[added].Texture = CBase.Profiles.GetProfiles()[_PlayerChooseButtons[i].ProfileID].Avatar.Texture; - _PlayerDestinationButtons[added].SelTexture = CBase.Profiles.GetProfiles()[_PlayerChooseButtons[i].ProfileID].Avatar.Texture; - _PlayerDestinationButtons[added].Text.Text = CBase.Profiles.GetProfiles()[_PlayerChooseButtons[i].ProfileID].PlayerName; + _PlayerDestinationButtons[added].Texture = CBase.Profiles.GetProfiles()[chooseButton.ProfileID].Avatar.Texture; + _PlayerDestinationButtons[added].SelTexture = CBase.Profiles.GetProfiles()[chooseButton.ProfileID].Avatar.Texture; + _PlayerDestinationButtons[added].Text.Text = CBase.Profiles.GetProfiles()[chooseButton.ProfileID].PlayerName; _PlayerDestinationButtons[added].Enabled = true; //Update Tiles-List _UpdateButtonPlayerChoose(); diff --git a/PartyModes/PartyModeTicTacToe/CPartyScreenTicTacToeNames.cs b/PartyModes/PartyModeTicTacToe/CPartyScreenTicTacToeNames.cs index fb355443..eabff2aa 100644 --- a/PartyModes/PartyModeTicTacToe/CPartyScreenTicTacToeNames.cs +++ b/PartyModes/PartyModeTicTacToe/CPartyScreenTicTacToeNames.cs @@ -90,7 +90,6 @@ namespace VocaluxeLib.PartyModes.TicTacToe _Data.ScreenNames.ProfileIDsTeam1 = new List(); _Data.ScreenNames.ProfileIDsTeam2 = new List(); - List buttons = new List(); _ThemeButtons = new string[] {_ButtonBack, _ButtonNext, _ButtonPlayerDestination, _ButtonPlayerChoose, _ButtonPlayerChooseScrollUp, _ButtonPlayerChooseScrollDown}; _Data = new SDataFromScreen(); @@ -178,18 +177,17 @@ namespace VocaluxeLib.PartyModes.TicTacToe _OldMouseX = mouseEvent.X; _OldMouseY = mouseEvent.Y; //Check if mouse if over tile - for (int i = 0; i < _PlayerChooseButtons.Count; i++) - { - if (_PlayerChooseButtons[i].Button.Selected) + foreach (CPlayerChooseButton chooseButton in _PlayerChooseButtons) { + if (chooseButton.Button.Selected) { - _SelectedPlayerNr = _PlayerChooseButtons[i].ProfileID; + _SelectedPlayerNr = chooseButton.ProfileID; if (_SelectedPlayerNr != -1) { //Activate mouse-selecting _SelectingMouseActive = true; //Update of Drag/Drop-Texture _ChooseAvatarStatic.Visible = true; - _ChooseAvatarStatic.Rect = _PlayerChooseButtons[i].Button.Rect; + _ChooseAvatarStatic.Rect = chooseButton.Button.Rect; _ChooseAvatarStatic.Rect.Z = -100; _ChooseAvatarStatic.Color = new SColorF(1, 1, 1, 1); _ChooseAvatarStatic.Texture = CBase.Profiles.GetProfiles()[_SelectedPlayerNr].Avatar.Texture; diff --git a/Vocaluxe/Base/CBackgroundMusic.cs b/Vocaluxe/Base/CBackgroundMusic.cs index bfd73230..5c645411 100644 --- a/Vocaluxe/Base/CBackgroundMusic.cs +++ b/Vocaluxe/Base/CBackgroundMusic.cs @@ -280,7 +280,6 @@ namespace Vocaluxe.Base { if (_PreviousFileNames.Count > 0 && _PreviousMusicIndex >= 0) { - float pos = CSound.GetPosition(_CurrentMusicStream); if (CSound.GetPosition(_CurrentMusicStream) >= 1.5f) { //Seek to #Start-Tag, if found diff --git a/Vocaluxe/Base/CDataBase.cs b/Vocaluxe/Base/CDataBase.cs index fa0ee5cf..9a2f899f 100644 --- a/Vocaluxe/Base/CDataBase.cs +++ b/Vocaluxe/Base/CDataBase.cs @@ -401,7 +401,7 @@ namespace Vocaluxe.Base { _CreateOrConvert(oldDBFilePath); _CreateOrConvert(_HighscoreFilePath); - _ImportData(oldDBFilePath, _HighscoreFilePath); + _ImportData(oldDBFilePath); File.Delete(oldDBFilePath); } @@ -916,7 +916,7 @@ namespace Vocaluxe.Base return true; } - private static bool _ImportData(string sourceDBPath, string destinationDBPath) + private static bool _ImportData(string sourceDBPath) { #region open db using (SQLiteConnection connSource = new SQLiteConnection()) @@ -936,11 +936,9 @@ namespace Vocaluxe.Base using (SQLiteCommand cmdSource = new SQLiteCommand(connSource)) { - SQLiteDataReader source; - #region import table scores cmdSource.CommandText = "SELECT SongID, PlayerName, Score, LineNr, Date, Medley, Duet, ShortSong, Difficulty FROM Scores"; - source = cmdSource.ExecuteReader(); + SQLiteDataReader source = cmdSource.ExecuteReader(); if (source == null) return false; @@ -1260,6 +1258,7 @@ namespace Vocaluxe.Base } //If you want to add an image to db, call this method! +/* private static bool _AddImageToCreditsDB(String imagePath) { bool result = false; @@ -1333,6 +1332,7 @@ namespace Vocaluxe.Base return result; } +*/ private static bool _InitCreditsRessourcesDB() { @@ -1388,6 +1388,7 @@ namespace Vocaluxe.Base return true; } +/* private static void _CreateCreditsRessourcesDB() { using (SQLiteConnection connection = new SQLiteConnection()) @@ -1422,6 +1423,7 @@ namespace Vocaluxe.Base } } } +*/ #endregion CreditsRessources private static byte[] _GetBytes(SQLiteDataReader reader) diff --git a/Vocaluxe/Base/CGraphics.cs b/Vocaluxe/Base/CGraphics.cs index b3d62cdb..fb544ad4 100644 --- a/Vocaluxe/Base/CGraphics.cs +++ b/Vocaluxe/Base/CGraphics.cs @@ -273,41 +273,40 @@ namespace Vocaluxe.Base CLog.StopBenchmark(1, "Load Theme " + Enum.GetNames(typeof(EScreens))[i]); } - for (int i = 0; i < _PopupScreens.Count; i++) - { - _PopupScreens[i].Init(); - _PopupScreens[i].LoadTheme(CTheme.GetThemeScreensPath(-1)); + foreach (IMenu popup in _PopupScreens) { + popup.Init(); + popup.LoadTheme(CTheme.GetThemeScreensPath(-1)); } } public static void ReloadTheme() { _ReloadCursor(); - for (int i = 0; i < _Screens.Count; i++) - _Screens[i].ReloadTheme(CTheme.GetThemeScreensPath(-1)); + foreach (IMenu screen in _Screens) + screen.ReloadTheme(CTheme.GetThemeScreensPath(-1)); - for (int i = 0; i < _PopupScreens.Count; i++) - _PopupScreens[i].ReloadTheme(CTheme.GetThemeScreensPath(-1)); + foreach (IMenu popup in _PopupScreens) + popup.ReloadTheme(CTheme.GetThemeScreensPath(-1)); } public static void ReloadSkin() { _ReloadCursor(); - for (int i = 0; i < _Screens.Count; i++) - _Screens[i].ReloadTextures(); + foreach (IMenu menu in _Screens) + menu.ReloadTextures(); - for (int i = 0; i < _PopupScreens.Count; i++) - _PopupScreens[i].ReloadTextures(); + foreach (IMenu menu in _PopupScreens) + menu.ReloadTextures(); } public static void SaveTheme() { CTheme.SaveTheme(); - for (int i = 0; i < _Screens.Count; i++) - _Screens[i].SaveTheme(); + foreach (IMenu screen in _Screens) + screen.SaveTheme(); - for (int i = 0; i < _PopupScreens.Count; i++) - _PopupScreens[i].SaveTheme(); + foreach (IMenu popup in _PopupScreens) + popup.SaveTheme(); } public static void InitFirstScreen() @@ -444,8 +443,8 @@ namespace Vocaluxe.Base _OldScreen = _Screens[(int)_CurrentScreen]; } - for (int i = 0; i < _PopupScreens.Count; i++) - _PopupScreens[i].Draw(); + foreach (IMenu popup in _PopupScreens) + popup.Draw(); _Cursor.Draw(); _DrawDebugInfos(); diff --git a/Vocaluxe/Base/CLanguage.cs b/Vocaluxe/Base/CLanguage.cs index 9b7da582..1e7ec559 100644 --- a/Vocaluxe/Base/CLanguage.cs +++ b/Vocaluxe/Base/CLanguage.cs @@ -108,12 +108,7 @@ namespace Vocaluxe.Base return -1; } - public static string Translate(string keyWord) - { - return Translate(keyWord, -1); - } - - public static string Translate(string keyWord, int partyModeID) + public static string Translate(string keyWord, int partyModeID = -1) { if (keyWord == null) return "Error"; diff --git a/Vocaluxe/Base/CParty.cs b/Vocaluxe/Base/CParty.cs index 62c97b72..372046d2 100644 --- a/Vocaluxe/Base/CParty.cs +++ b/Vocaluxe/Base/CParty.cs @@ -100,33 +100,32 @@ namespace Vocaluxe.Base { List infos = new List(); - int[] usedKeys = new int[_PartyModes.Count]; - _PartyModes.Keys.CopyTo(usedKeys, 0); + int[] pmIDs = new int[_PartyModes.Count]; + _PartyModes.Keys.CopyTo(pmIDs, 0); - for (int i = 0; i < usedKeys.Length; i++) - { - if (usedKeys[i] != _NormalGameModeID) + foreach (int pmID in pmIDs) { + if (pmID != _NormalGameModeID) { SPartyMode mode; - _PartyModes.TryGetValue(usedKeys[i], out mode); + _PartyModes.TryGetValue(pmID, out mode); if (mode.PartyMode != null) { - SPartyModeInfos info = new SPartyModeInfos(); - - info.Author = mode.Author; - info.Description = mode.Description; - info.Name = mode.Name; - info.PartyModeID = mode.PartyModeID; - info.Playable = mode.NoErrors; - info.VersionMajor = mode.PartyModeVersionMajor; - info.VersionMinor = mode.PartyModeVersionMinor; - - info.TargetAudience = mode.TargetAudience; - info.MaxPlayers = mode.PartyMode.GetMaxPlayer(); - info.MinPlayers = mode.PartyMode.GetMinPlayer(); - info.MaxTeams = mode.PartyMode.GetMaxTeams(); - info.MinTeams = mode.PartyMode.GetMinTeams(); + SPartyModeInfos info = new SPartyModeInfos + { + Author = mode.Author, + Description = mode.Description, + Name = mode.Name, + PartyModeID = mode.PartyModeID, + Playable = mode.NoErrors, + VersionMajor = mode.PartyModeVersionMajor, + VersionMinor = mode.PartyModeVersionMinor, + TargetAudience = mode.TargetAudience, + MaxPlayers = mode.PartyMode.GetMaxPlayer(), + MinPlayers = mode.PartyMode.GetMinPlayer(), + MaxTeams = mode.PartyMode.GetMaxTeams(), + MinTeams = mode.PartyMode.GetMinTeams() + }; infos.Add(info); } @@ -348,6 +347,7 @@ namespace Vocaluxe.Base CompilerParameters compilerParams = new CompilerParameters(); compilerParams.ReferencedAssemblies.Add("System.Windows.Forms.dll"); + compilerParams.ReferencedAssemblies.Add("System.Core.dll"); compilerParams.ReferencedAssemblies.Add("VocaluxeLib.dll"); compilerParams.GenerateInMemory = true; #if DEBUG diff --git a/Vocaluxe/Base/CPlaylists.cs b/Vocaluxe/Base/CPlaylists.cs index 0b6903b7..1b547267 100644 --- a/Vocaluxe/Base/CPlaylists.cs +++ b/Vocaluxe/Base/CPlaylists.cs @@ -263,11 +263,10 @@ namespace Vocaluxe.Base string artist = line.Substring(0, pos - 1).Trim(); string title = line.Substring(pos + 1, line.Length - pos - 1).Trim(); bool found = false; - for (int s = 0; s < allSongs.Length; s++) - { - if (allSongs[s].Artist == artist && allSongs[s].Title == title) + foreach (CSong song in allSongs) { + if (song.Artist == artist && song.Title == title) { - pl.AddSong(allSongs[s].ID); + pl.AddSong(song.ID); found = true; break; } diff --git a/Vocaluxe/Base/CSongs.cs b/Vocaluxe/Base/CSongs.cs index 6a2ecea7..39ae8467 100644 --- a/Vocaluxe/Base/CSongs.cs +++ b/Vocaluxe/Base/CSongs.cs @@ -35,9 +35,9 @@ namespace Vocaluxe.Base public bool Visible; public bool PartyHidden; - public SSongPointer(int iD, string sortString) + public SSongPointer(int id, string sortString) { - SongID = iD; + SongID = id; SortString = sortString; CatIndex = -1; Visible = false; diff --git a/Vocaluxe/Base/CSound.cs b/Vocaluxe/Base/CSound.cs index 6b09af30..61a664b3 100644 --- a/Vocaluxe/Base/CSound.cs +++ b/Vocaluxe/Base/CSound.cs @@ -35,7 +35,7 @@ namespace Vocaluxe.Base #region Playback private static IPlayback _Playback; - public static bool PlaybackInit() + public static bool Init() { switch (CConfig.PlayBackLib) { @@ -55,7 +55,7 @@ namespace Vocaluxe.Base _Playback = new CPortAudioPlay(); break; } - return true; + return _Playback.Init(); } public static void SetGlobalVolume(float volume) @@ -613,7 +613,7 @@ namespace Vocaluxe.Base float dt = Time; - float diff = _ExternTime.Time - dt; + float diff = et - dt; if (Math.Abs(diff) > 0.05f) { _Timer.Reset(); diff --git a/Vocaluxe/Lib/Sound/CDirectSoundRecord.cs b/Vocaluxe/Lib/Sound/CDirectSoundRecord.cs index 55ee2f89..cc38e414 100644 --- a/Vocaluxe/Lib/Sound/CDirectSoundRecord.cs +++ b/Vocaluxe/Lib/Sound/CDirectSoundRecord.cs @@ -96,8 +96,8 @@ namespace Vocaluxe.Lib.Sound if (!_Initialized) return false; - for (int i = 0; i < _Buffer.Length; i++) - _Buffer[i].Reset(); + foreach (CBuffer buffer in _Buffer) + buffer.Reset(); _DeviceConfig = deviceConfig; bool[] active = new bool[deviceConfig.Length]; @@ -373,8 +373,8 @@ namespace Vocaluxe.Lib.Sound if (_Notifications != null) { - for (int i = 0; i < _Notifications.Count; i++) - _Notifications[i].Event.Close(); + foreach (NotificationPosition notification in _Notifications) + notification.Event.Close(); _Notifications.Clear(); _Notifications = null; @@ -420,7 +420,7 @@ namespace Vocaluxe.Lib.Sound } // ReSharper disable InconsistentNaming - protected virtual void Dispose(bool disposing) + protected void Dispose(bool disposing) // ReSharper restore InconsistentNaming { if (disposing) diff --git a/Vocaluxe/Lib/Sound/CGstreamerAudio.cs b/Vocaluxe/Lib/Sound/CGstreamerAudio.cs index 4adc2bbc..0d033842 100644 --- a/Vocaluxe/Lib/Sound/CGstreamerAudio.cs +++ b/Vocaluxe/Lib/Sound/CGstreamerAudio.cs @@ -28,9 +28,8 @@ namespace Vocaluxe.Lib.Sound //static float LastPosition; #region log - public CGstreamerAudioWrapper.LogCallback Log; - private void _LogHandler(string text) + private static void _LogHandler(string text) { CLog.LogError(text); } @@ -38,11 +37,9 @@ namespace Vocaluxe.Lib.Sound public CGstreamerAudio() { - Init(); - Log = _LogHandler; //Is this really needed? CodaAnalyzer complains about it... //GC.SuppressFinalize(Log); - CGstreamerAudioWrapper.SetLogCallback(Log); + CGstreamerAudioWrapper.SetLogCallback(_LogHandler); } public bool Init() diff --git a/Vocaluxe/Lib/Sound/COpenALPlay.cs b/Vocaluxe/Lib/Sound/COpenALPlay.cs index f9616987..fffbd644 100644 --- a/Vocaluxe/Lib/Sound/COpenALPlay.cs +++ b/Vocaluxe/Lib/Sound/COpenALPlay.cs @@ -40,11 +40,6 @@ namespace Vocaluxe.Lib.Sound private List _Streams; - public COpenALPlay() - { - Init(); - } - public bool Init() { if (_Initialized) @@ -335,15 +330,6 @@ namespace Vocaluxe.Lib.Sound return -1; } - private void _EndSync(int handle, int stream, int data, IntPtr user) - { - if (_Initialized) - { - if (_AlreadyAdded(stream)) - Close(stream); - } - } - private void _CloseProc(int streamID) { if (_Initialized) diff --git a/Vocaluxe/Lib/Sound/CPortAudioPlay.cs b/Vocaluxe/Lib/Sound/CPortAudioPlay.cs index e5a92632..ab6ae222 100644 --- a/Vocaluxe/Lib/Sound/CPortAudioPlay.cs +++ b/Vocaluxe/Lib/Sound/CPortAudioPlay.cs @@ -21,6 +21,7 @@ using System; using System.Collections.Generic; using System.Diagnostics; using System.IO; +using System.Linq; using System.Runtime.InteropServices; using System.Threading; using Vocaluxe.Base; @@ -40,11 +41,6 @@ namespace Vocaluxe.Lib.Sound private List _Streams; - public CPortAudioPlay() - { - Init(); - } - public bool Init() { if (_Initialized) @@ -302,12 +298,7 @@ namespace Vocaluxe.Lib.Sound private bool _AlreadyAdded(int stream) { - foreach (SAudioStreams st in _Streams) - { - if (st.Handle == stream) - return true; - } - return false; + return _Streams.Any(st => st.Handle == stream); } private int _GetStreamIndex(int stream) @@ -320,15 +311,6 @@ namespace Vocaluxe.Lib.Sound return -1; } - private void _EndSync(int handle, int stream, int data, IntPtr user) - { - if (_Initialized) - { - if (_AlreadyAdded(stream)) - Close(stream); - } - } - private void _CloseProc(int streamID) { if (_Initialized) diff --git a/Vocaluxe/Lib/Sound/CPortAudioRecord.cs b/Vocaluxe/Lib/Sound/CPortAudioRecord.cs index fab75e12..612081a8 100644 --- a/Vocaluxe/Lib/Sound/CPortAudioRecord.cs +++ b/Vocaluxe/Lib/Sound/CPortAudioRecord.cs @@ -189,8 +189,8 @@ namespace Vocaluxe.Lib.Sound if (!_Initialized) return false; - for (int i = 0; i < _RecHandle.Length; i++) - CPortAudio.Pa_StopStream(_RecHandle[i]); + foreach (IntPtr handle in _RecHandle) + CPortAudio.Pa_StopStream(handle); return true; } diff --git a/Vocaluxe/Lib/Sound/Decoder/CAudioDecoderFFmpeg.cs b/Vocaluxe/Lib/Sound/Decoder/CAudioDecoderFFmpeg.cs index 6f40c539..bfe4fedf 100644 --- a/Vocaluxe/Lib/Sound/Decoder/CAudioDecoderFFmpeg.cs +++ b/Vocaluxe/Lib/Sound/Decoder/CAudioDecoderFFmpeg.cs @@ -38,7 +38,7 @@ namespace Vocaluxe.Lib.Sound.Decoder public void Init() {} - public void Open(string fileName, bool loop) + public void Open(string fileName) { _FileName = fileName; diff --git a/Vocaluxe/Lib/Sound/Decoder/IAudioDecoder.cs b/Vocaluxe/Lib/Sound/Decoder/IAudioDecoder.cs index 55c21761..5ebcda20 100644 --- a/Vocaluxe/Lib/Sound/Decoder/IAudioDecoder.cs +++ b/Vocaluxe/Lib/Sound/Decoder/IAudioDecoder.cs @@ -31,7 +31,7 @@ namespace Vocaluxe.Lib.Sound.Decoder void Init(); void Close(); - void Open(string fileName, bool loop = false); + void Open(string fileName); SFormatInfo GetFormatInfo(); float GetLength(); diff --git a/Vocaluxe/Lib/Sound/Portaudio/PortAudio.cs b/Vocaluxe/Lib/Sound/Portaudio/PortAudio.cs index d80d4cac..e8329a1a 100644 --- a/Vocaluxe/Lib/Sound/Portaudio/PortAudio.cs +++ b/Vocaluxe/Lib/Sound/Portaudio/PortAudio.cs @@ -27,6 +27,7 @@ namespace Vocaluxe.Lib.Sound.PortAudio PortAudio v.19 bindings for .NET */ + // ReSharper disable UnusedMember.Global public static class CPortAudio { @@ -550,4 +551,6 @@ namespace Vocaluxe.Lib.Sound.PortAudio public static extern void Pa_Sleep(int msec); #endregion } + // ReSharper restore UnusedMember.Global + } \ No newline at end of file diff --git a/Vocaluxe/Lib/Video/CVideoDecoderGstreamer.cs b/Vocaluxe/Lib/Video/CVideoDecoderGstreamer.cs index 2295e8b4..ac5b15cf 100644 --- a/Vocaluxe/Lib/Video/CVideoDecoderGstreamer.cs +++ b/Vocaluxe/Lib/Video/CVideoDecoderGstreamer.cs @@ -27,7 +27,7 @@ namespace Vocaluxe.Lib.Video class CVideoDecoderGstreamer : IVideoDecoder { #region log - private CGstreamerVideoWrapper.LogCallback Log; + private CGstreamerVideoWrapper.LogCallback _Log; private void _LogHandler(string text) { @@ -38,10 +38,10 @@ namespace Vocaluxe.Lib.Video public bool Init() { bool retval = CGstreamerVideoWrapper.InitVideo(); - Log = _LogHandler; + _Log = _LogHandler; //Really needed? CodeAnalysis complains //GC.SuppressFinalize(Log); - CGstreamerVideoWrapper.SetVideoLogCallback(Log); + CGstreamerVideoWrapper.SetVideoLogCallback(_Log); return retval; } diff --git a/Vocaluxe/Program.cs b/Vocaluxe/Program.cs index 689bf2c5..539c2b3d 100644 --- a/Vocaluxe/Program.cs +++ b/Vocaluxe/Program.cs @@ -114,7 +114,7 @@ namespace Vocaluxe // Init Playback CLog.StartBenchmark(0, "Init Playback"); - CSound.PlaybackInit(); + CSound.Init(); CLog.StopBenchmark(0, "Init Playback"); Application.DoEvents(); diff --git a/Vocaluxe/Screens/CScreenCredits.cs b/Vocaluxe/Screens/CScreenCredits.cs index d47e1d43..4ef03bbb 100644 --- a/Vocaluxe/Screens/CScreenCredits.cs +++ b/Vocaluxe/Screens/CScreenCredits.cs @@ -204,35 +204,33 @@ namespace Vocaluxe.Screens //Prepare Text int lastY = 280; - for (int i = 0; i < _Paragraphs.Count; i++) - { + foreach (string[] paragraph in _Paragraphs) { string line = ""; - for (int e = 0; e < _Paragraphs[i].Length; e++) + for (int e = 0; e < paragraph.Length; e++) { - if (_Paragraphs[i][e] != null) + if (paragraph[e] == null) + continue; + string newLine = " " + paragraph[e]; + CText text = GetNewText(75, lastY, -2, 30, -1, EAlignment.Left, EStyle.Bold, "Outline", new SColorF(1, 1, 1, 1), line); + if (CDraw.GetTextBounds(text).Width < (CSettings.RenderW - 220)) { - string newline = line + " " + _Paragraphs[i][e]; - CText text = GetNewText(75, lastY, -2, 30, -1, EAlignment.Left, EStyle.Bold, "Outline", new SColorF(1, 1, 1, 1), line); - if (CDraw.GetTextBounds(text).Width < (CSettings.RenderW - 220)) - { - line = line + " " + _Paragraphs[i][e]; + line += newLine; - //Check if all words are used - if ((e + 1) == _Paragraphs[i].Length) - { - text.Text = line; - _ParagraphTexts.Add(text); - line = ""; - lastY += 40; - } - } - else + //Check if all words are used + if ((e + 1) == paragraph.Length) { + text.Text = line; _ParagraphTexts.Add(text); - line = " " + _Paragraphs[i][e]; - lastY += 27; + line = ""; + lastY += 40; } } + else + { + _ParagraphTexts.Add(text); + line = newLine; + lastY += 27; + } } } } @@ -276,7 +274,7 @@ namespace Vocaluxe.Screens return true; } - public CParticleEffect GetStarParticles(int numStars, bool isRed, SRectF rect, bool bigParticles) + private CParticleEffect _GetStarParticles(int numStars, bool isRed, SRectF rect, bool bigParticles) { SColorF partColor = isRed ? new SColorF(1, 0, 0, 1) : new SColorF(0.149f, 0.415f, 0.819f, 1); int partSize = bigParticles ? 35 : 25; @@ -296,7 +294,7 @@ namespace Vocaluxe.Screens SRectF imgDotRect = new SRectF(particleRect); imgDotRect.Z = -5; CStatic imgDot = GetNewStatic(texDot, new SColorF(1, 1, 1, 1), imgDotRect); - CParticleEffect particle = GetStarParticles(partCount, isRight, particleRect, bigParticles); + CParticleEffect particle = _GetStarParticles(partCount, isRight, particleRect, bigParticles); CCreditName credit = new CCreditName(image, imgDot, particle, particleOffsetX, particleOffsetY); @@ -324,8 +322,8 @@ namespace Vocaluxe.Screens //Little stars for logo int numstars = (int)(_Logo.Rect.W * 0.25f / 2f); SRectF partRect = new SRectF(_Logo.Rect.X, _Logo.Rect.Y, _Logo.Rect.W, _Logo.Rect.H, -1); - _StarsRed = GetStarParticles(numstars, true, partRect, true); - _StarsBlue = GetStarParticles(numstars, false, partRect, true); + _StarsRed = _GetStarParticles(numstars, true, partRect, true); + _StarsBlue = _GetStarParticles(numstars, false, partRect, true); //Credit names _CreditNames = new List(); @@ -371,8 +369,8 @@ namespace Vocaluxe.Screens //Draw Text if (_TextTimer.IsRunning) { - for (int i = 0; i < _ParagraphTexts.Count; i++) - _ParagraphTexts[i].Draw(); + foreach (CText text in _ParagraphTexts) + text.Draw(); } return true; } diff --git a/Vocaluxe/Screens/CScreenHighscore.cs b/Vocaluxe/Screens/CScreenHighscore.cs index bd2481ed..95421bda 100644 --- a/Vocaluxe/Screens/CScreenHighscore.cs +++ b/Vocaluxe/Screens/CScreenHighscore.cs @@ -257,7 +257,6 @@ namespace Vocaluxe.Screens { _IsDuet = false; CPoints points = CGame.GetPoints(); - SPlayer player = points.GetPlayer(_Round, CGame.NumPlayer)[0]; CSong song = CGame.GetSong(_Round + 1); if (song == null) return; diff --git a/Vocaluxe/Screens/CScreenSing.cs b/Vocaluxe/Screens/CScreenSing.cs index 361c5f6d..e6434090 100644 --- a/Vocaluxe/Screens/CScreenSing.cs +++ b/Vocaluxe/Screens/CScreenSing.cs @@ -654,10 +654,7 @@ namespace Vocaluxe.Screens for (int p = 0; p < CGame.NumPlayer; p++) { - _NoteLines[p] = _SingNotes[_SingBars].AddPlayer( - _SingNotes[_SingBars].BarPos[p, CGame.NumPlayer - 1], - CTheme.GetPlayerColor(p + 1), - p); + _NoteLines[p] = _SingNotes[_SingBars].AddPlayer(_SingNotes[_SingBars].BarPos[p, CGame.NumPlayer - 1],CTheme.GetPlayerColor(p + 1),p); } /* diff --git a/VocaluxeLib/Menu/CButton.cs b/VocaluxeLib/Menu/CButton.cs index 9c74f8e1..8a46c185 100644 --- a/VocaluxeLib/Menu/CButton.cs +++ b/VocaluxeLib/Menu/CButton.cs @@ -294,17 +294,7 @@ namespace VocaluxeLib.Menu return false; } - public void Draw() - { - Draw(false); - } - - public void ForceDraw() - { - Draw(true); - } - - public void Draw(bool forceDraw) + public void Draw(bool forceDraw = false) { if (!Visible && CBase.Settings.GetGameState() != EGameState.EditTheme && !forceDraw) return; diff --git a/VocaluxeLib/Menu/CHelper.cs b/VocaluxeLib/Menu/CHelper.cs index 95048f07..bdf1a007 100644 --- a/VocaluxeLib/Menu/CHelper.cs +++ b/VocaluxeLib/Menu/CHelper.cs @@ -139,17 +139,7 @@ namespace VocaluxeLib.Menu rect = new RectangleF(left, upper, rigth - left, lower - upper); } - public static List ListFiles(string path, string cast) - { - return ListFiles(path, cast, false, false); - } - - public static List ListFiles(string path, string cast, bool recursive) - { - return ListFiles(path, cast, recursive, false); - } - - public static List ListFiles(string path, string cast, bool recursive, bool fullpath) + public static List ListFiles(string path, string cast, bool recursive = false, bool fullpath = false) { List files = new List(); DirectoryInfo dir = new DirectoryInfo(path); diff --git a/VocaluxeLib/Menu/CMenuParty.cs b/VocaluxeLib/Menu/CMenuParty.cs index dd537744..2cd1fa5c 100644 --- a/VocaluxeLib/Menu/CMenuParty.cs +++ b/VocaluxeLib/Menu/CMenuParty.cs @@ -36,11 +36,6 @@ namespace VocaluxeLib.Menu _PartyModeID = partyModeID; } - public int GetPartyModeID() - { - return _PartyModeID; - } - public void AssingPartyMode(IPartyMode partyMode) { _PartyMode = partyMode; diff --git a/VocaluxeLib/Menu/CNameSelection.cs b/VocaluxeLib/Menu/CNameSelection.cs index c09387f9..f3b34313 100644 --- a/VocaluxeLib/Menu/CNameSelection.cs +++ b/VocaluxeLib/Menu/CNameSelection.cs @@ -244,16 +244,6 @@ namespace VocaluxeLib.Menu } public void Draw() - { - Draw(false); - } - - public void ForceDraw() - { - Draw(true); - } - - public void Draw(bool forceDraw) { int i = 0; foreach (CTile tile in _Tiles) diff --git a/VocaluxeLib/Menu/CPlaylist.cs b/VocaluxeLib/Menu/CPlaylist.cs index ed2bff99..367f9ec9 100644 --- a/VocaluxeLib/Menu/CPlaylist.cs +++ b/VocaluxeLib/Menu/CPlaylist.cs @@ -412,17 +412,7 @@ namespace VocaluxeLib.Menu return false; } - public void Draw() - { - Draw(false); - } - - public void ForceDraw() - { - Draw(true); - } - - public void Draw(bool forceDraw) + public void Draw(bool forceDraw = false) { if (_PlaylistElements.Count <= 0) LoadPlaylist(0); @@ -1226,7 +1216,7 @@ namespace VocaluxeLib.Menu CSong song = CBase.Songs.GetSongByID(pec.SongID); _PlaylistElements[i].Cover.Texture = song.CoverTextureSmall; string t1 = _Theme.Text1.Text.Replace("%a", song.Artist).Replace("%t", song.Title); - _PlaylistElements[i].Text1.Text = /*(Offset + i + 1) + ") " + */ song.Artist + " - " + song.Title; //TODO: Add text field for the number + _PlaylistElements[i].Text1.Text = /*(Offset + i + 1) + ") " + */ t1; //TODO: Add text field for the number _PlaylistElements[i].SelectSlide.Clear(); for (int g = 0; g < pec.Modes.Length; g++) { diff --git a/VocaluxeLib/Menu/CText.cs b/VocaluxeLib/Menu/CText.cs index e148d062..0edc1510 100644 --- a/VocaluxeLib/Menu/CText.cs +++ b/VocaluxeLib/Menu/CText.cs @@ -693,17 +693,12 @@ namespace VocaluxeLib.Menu CBase.Drawing.DrawColor(new SColorF(0.5f, 1f, 0.5f, 0.5f), new SRectF(x, Y, bounds.Width, bounds.Height, Z)); } - public void DrawRelative(float x, float y) - { - DrawRelative(x, y, false, 0f, 0f, 0f); - } - public void DrawRelative(float x, float y, float reflectionSpace, float reflectionHeigth, float rectHeight) { DrawRelative(x, y, true, reflectionSpace, reflectionHeigth, rectHeight); } - public void DrawRelative(float rx, float ry, bool reflection, float reflectionSpace, float reflectionHeight, float rectHeight) + public void DrawRelative(float rx, float ry, bool reflection = false, float reflectionSpace = 0f, float reflectionHeight = 0f, float rectHeight = 0f) { // Update Text Text = Text; diff --git a/VocaluxeLib/Menu/Enums.cs b/VocaluxeLib/Menu/Enums.cs index 5c40785a..b42b9ec1 100644 --- a/VocaluxeLib/Menu/Enums.cs +++ b/VocaluxeLib/Menu/Enums.cs @@ -36,8 +36,7 @@ namespace VocaluxeLib.Menu { Mouse, Keyboard, - WiiMote, - Gamepad + WiiMote } #endregion Inputs @@ -126,7 +125,9 @@ namespace VocaluxeLib.Menu // ReSharper disable InconsistentNaming // don't change the order! TR_CONFIG_OFF, //no debug infos +// ReSharper disable UnusedMember.Global TR_CONFIG_ONLY_FPS, +// ReSharper restore UnusedMember.Global TR_CONFIG_LEVEL1, TR_CONFIG_LEVEL2, TR_CONFIG_LEVEL3, @@ -213,7 +214,9 @@ namespace VocaluxeLib.Menu public enum ECoverLoading { // ReSharper disable InconsistentNaming +// ReSharper disable UnusedMember.Global TR_CONFIG_COVERLOADING_ONDEMAND, +// ReSharper restore UnusedMember.Global TR_CONFIG_COVERLOADING_ATSTART, TR_CONFIG_COVERLOADING_DYNAMIC // ReSharper restore InconsistentNaming @@ -222,9 +225,11 @@ namespace VocaluxeLib.Menu public enum EGameDifficulty { // ReSharper disable InconsistentNaming + // ReSharper disable UnusedMember.Global TR_CONFIG_EASY, TR_CONFIG_NORMAL, TR_CONFIG_HARD +// ReSharper restore UnusedMember.Global // ReSharper restore InconsistentNaming } @@ -260,7 +265,9 @@ namespace VocaluxeLib.Menu TR_CONFIG_PLAYERINFO_BOTH, TR_CONFIG_PLAYERINFO_NAME, TR_CONFIG_PLAYERINFO_AVATAR, +// ReSharper disable UnusedMember.Global TR_CONFIG_PLAYERINFO_OFF +// ReSharper restore UnusedMember.Global // ReSharper restore InconsistentNaming } diff --git a/VocaluxeLib/Menu/SingNotes/CSingNotes.cs b/VocaluxeLib/Menu/SingNotes/CSingNotes.cs index 474ac07a..79a8d87a 100644 --- a/VocaluxeLib/Menu/SingNotes/CSingNotes.cs +++ b/VocaluxeLib/Menu/SingNotes/CSingNotes.cs @@ -59,26 +59,20 @@ namespace VocaluxeLib.Menu.SingNotes public abstract class CSingNotes : IMenuElement { - protected int _PartyModeID; + protected readonly int _PartyModeID; private SThemeSingBar _Theme; private bool _ThemeLoaded; private readonly List _PlayerNotes; private int _ActID; - private SRectF[,] _BarPos; - /// /// Player bar positions /// /// /// first index = player number; second index = num players seen on screen /// - public SRectF[,] BarPos - { - get { return _BarPos; } - set { _BarPos = value; } - } + public SRectF[,] BarPos { get; set; } public CSingNotes(int partyModeID) { @@ -112,20 +106,20 @@ namespace VocaluxeLib.Menu.SingNotes _ThemeLoaded &= xmlReader.GetValue(item + "/SkinToneHelper", out _Theme.SkinToneHelperName, String.Empty); _ThemeLoaded &= xmlReader.GetValue(item + "/SkinPerfectNoteStar", out _Theme.SkinPerfectNoteStarName, String.Empty); - _BarPos = new SRectF[CBase.Settings.GetMaxNumPlayer(),CBase.Settings.GetMaxNumPlayer()]; + BarPos = new SRectF[CBase.Settings.GetMaxNumPlayer(),CBase.Settings.GetMaxNumPlayer()]; for (int numplayer = 0; numplayer < CBase.Settings.GetMaxNumPlayer(); numplayer++) { for (int player = 0; player < CBase.Settings.GetMaxNumPlayer(); player++) { if (player <= numplayer) { - _BarPos[player, numplayer] = new SRectF(); + BarPos[player, numplayer] = new SRectF(); string target = "/BarPositions/P" + (player + 1) + "N" + (numplayer + 1); - _ThemeLoaded &= xmlReader.TryGetFloatValue(item + target + "X", ref _BarPos[player, numplayer].X); - _ThemeLoaded &= xmlReader.TryGetFloatValue(item + target + "Y", ref _BarPos[player, numplayer].Y); - _ThemeLoaded &= xmlReader.TryGetFloatValue(item + target + "Z", ref _BarPos[player, numplayer].Z); - _ThemeLoaded &= xmlReader.TryGetFloatValue(item + target + "W", ref _BarPos[player, numplayer].W); - _ThemeLoaded &= xmlReader.TryGetFloatValue(item + target + "H", ref _BarPos[player, numplayer].H); + _ThemeLoaded &= xmlReader.TryGetFloatValue(item + target + "X", ref BarPos[player, numplayer].X); + _ThemeLoaded &= xmlReader.TryGetFloatValue(item + target + "Y", ref BarPos[player, numplayer].Y); + _ThemeLoaded &= xmlReader.TryGetFloatValue(item + target + "Z", ref BarPos[player, numplayer].Z); + _ThemeLoaded &= xmlReader.TryGetFloatValue(item + target + "W", ref BarPos[player, numplayer].W); + _ThemeLoaded &= xmlReader.TryGetFloatValue(item + target + "H", ref BarPos[player, numplayer].H); } } } @@ -180,16 +174,15 @@ namespace VocaluxeLib.Menu.SingNotes { for (int player = 0; player < CBase.Settings.GetMaxNumPlayer(); player++) { - if (player <= numplayer) - { - string target = "P" + (player + 1) + "N" + (numplayer + 1); + if (player > numplayer) + continue; + string target = "P" + (player + 1) + "N" + (numplayer + 1); - writer.WriteElementString(target + "X", _BarPos[player, numplayer].X.ToString("#0")); - writer.WriteElementString(target + "Y", _BarPos[player, numplayer].Y.ToString("#0")); - writer.WriteElementString(target + "Z", _BarPos[player, numplayer].Z.ToString("#0.00")); - writer.WriteElementString(target + "W", _BarPos[player, numplayer].W.ToString("#0")); - writer.WriteElementString(target + "H", _BarPos[player, numplayer].H.ToString("#0")); - } + writer.WriteElementString(target + "X", BarPos[player, numplayer].X.ToString("#0")); + writer.WriteElementString(target + "Y", BarPos[player, numplayer].Y.ToString("#0")); + writer.WriteElementString(target + "Z", BarPos[player, numplayer].Z.ToString("#0.00")); + writer.WriteElementString(target + "W", BarPos[player, numplayer].W.ToString("#0")); + writer.WriteElementString(target + "H", BarPos[player, numplayer].H.ToString("#0")); } } writer.WriteEndElement(); //BarPositions @@ -210,33 +203,35 @@ namespace VocaluxeLib.Menu.SingNotes public virtual int AddPlayer(SRectF rect, SColorF color, int playerNr) { - SPlayerNotes notes = new SPlayerNotes(); + SPlayerNotes notes = new SPlayerNotes + { + Rect = rect, + Color = color, + Alpha = 1f, + ID = ++_ActID, + Lines = null, + LineNr = -1, + PlayerNr = playerNr, + Timer = new Stopwatch(), + GoldenStars = new List(), + Flares = new List(), + PerfectNoteEffect = new List(), + PerfectLineTwinkle = new List() + }; - notes.Rect = rect; - notes.Color = color; - notes.Alpha = 1f; - notes.ID = ++_ActID; - notes.Lines = null; - notes.LineNr = -1; - notes.PlayerNr = playerNr; - notes.Timer = new Stopwatch(); - notes.GoldenStars = new List(); - notes.Flares = new List(); - notes.PerfectNoteEffect = new List(); - notes.PerfectLineTwinkle = new List(); _PlayerNotes.Add(notes); return notes.ID; } - public virtual void RemovePlayer(int iD) {} + public virtual void RemovePlayer(int id) {} - public virtual void AddLine(int iD, CLine[] line, int lineNr, int player) + public virtual void AddLine(int id, CLine[] line, int lineNr, int player) { if (line == null) return; - int n = _FindPlayerLine(iD); + int n = _FindPlayerLine(id); if (n == -1) return; @@ -258,13 +253,13 @@ namespace VocaluxeLib.Menu.SingNotes _PlayerNotes.Add(notes); } - public virtual void RemoveLine(int iD) {} + public virtual void RemoveLine(int id) {} - public virtual void AddNote(int iD, CNote note) {} + public virtual void AddNote(int id, CNote note) {} - public virtual void SetAlpha(int iD, float alpha) + public virtual void SetAlpha(int id, float alpha) { - int n = _FindPlayerLine(iD); + int n = _FindPlayerLine(id); if (n == -1) return; @@ -273,23 +268,23 @@ namespace VocaluxeLib.Menu.SingNotes _PlayerNotes[n] = pn; } - public virtual float GetAlpha(int iD) + public virtual float GetAlpha(int id) { - int n = _FindPlayerLine(iD); + int n = _FindPlayerLine(id); if (n == -1) return 0f; return _PlayerNotes[n].Alpha; } - public virtual void Draw(int iD, int player) + public virtual void Draw(int id, int player) { - Draw(iD, null, player); + Draw(id, null, player); } - public virtual void Draw(int iD, List singLine, int player) + public virtual void Draw(int id, List singLine, int player) { - int n = _FindPlayerLine(iD); + int n = _FindPlayerLine(id); if (n == -1) return; @@ -467,30 +462,21 @@ namespace VocaluxeLib.Menu.SingNotes LoadTextures(); } - private int _FindPlayerLine(int iD) + private int _FindPlayerLine(int id) { - if (iD < 0 || iD > _PlayerNotes.Count) + if (id < 0 || id > _PlayerNotes.Count) return -1; - int n = -1; for (int i = 0; i < _PlayerNotes.Count; i++) { - if (_PlayerNotes[i].ID == iD) - { - n = i; - break; - } + if (_PlayerNotes[i].ID == id) + return i; } - return n; + return -1; } - private void _DrawNote(SRectF rect, SColorF color) - { - _DrawNote(rect, color, 1f); - } - - private void _DrawNote(SRectF rect, SColorF color, float factor) + private void _DrawNote(SRectF rect, SColorF color, float factor = 1f) { const int spacing = 0; @@ -584,12 +570,7 @@ namespace VocaluxeLib.Menu.SingNotes } } - private void _AddGoldenNote(SRectF rect, int n, int nr) - { - _AddGoldenNote(rect, n, nr, 1f); - } - - private void _AddGoldenNote(SRectF rect, int n, int nr, float factor) + private void _AddGoldenNote(SRectF rect, int n, int nr, float factor = 1f) { const int spacing = 0; @@ -615,12 +596,7 @@ namespace VocaluxeLib.Menu.SingNotes } } - private void _AddFlare(SRectF rect, int n) - { - _AddFlare(rect, n, 1f); - } - - private void _AddFlare(SRectF rect, int n, float factor) + private void _AddFlare(SRectF rect, int n, float factor = 1f) { const int spacing = 0; @@ -642,12 +618,7 @@ namespace VocaluxeLib.Menu.SingNotes _PlayerNotes[n].Flares.Add(flares); } - private void _AddPerfectNote(SRectF rect, int n) - { - _AddPerfectNote(rect, n, 1f); - } - - private void _AddPerfectNote(SRectF rect, int n, float factor) + private void _AddPerfectNote(SRectF rect, int n, float factor = 1f) { const int spacing = 0; diff --git a/VocaluxeLib/Menu/SongMenu/CSong.cs b/VocaluxeLib/Menu/SongMenu/CSong.cs index 38f5dc4a..d7931f16 100644 --- a/VocaluxeLib/Menu/SongMenu/CSong.cs +++ b/VocaluxeLib/Menu/SongMenu/CSong.cs @@ -1027,10 +1027,5 @@ namespace VocaluxeLib.Menu.SongMenu ShortEnd = stop; } - - public object Clone() - { - return MemberwiseClone(); - } } } \ No newline at end of file From b8fe3341533bf258669659d6e4f0a41aa12c6eee Mon Sep 17 00:00:00 2001 From: Flamefire Date: Tue, 23 Apr 2013 22:11:32 +0200 Subject: [PATCH 13/27] Used object initializers --- .../PartyModeChallenge/CPartyModeChallenge.cs | 17 +---- .../CPartyScreenChallengeConfig.cs | 10 +-- .../CPartyScreenChallengeMain.cs | 36 ++++------ .../CPartyModeChallengeMedley.cs | 25 ++----- .../CPartyScreenChallengeMedleyConfig.cs | 10 +-- .../CPartyScreenChallengeMedleyMain.cs | 36 ++++------ .../CPartyScreenChallengeMedleyNames.cs | 9 +-- .../PartyModeTicTacToe/CPartyModeTicTacToe.cs | 53 ++++++-------- .../CPartyScreenTicTacToeMain.cs | 3 +- .../CPartyScreenTicTacToeNames.cs | 10 +-- Vocaluxe/Base/CBackgroundMusic.cs | 5 +- Vocaluxe/Base/CCover.cs | 2 +- Vocaluxe/Base/CDataBase.cs | 71 ++++++++----------- Vocaluxe/Base/CFont.cs | 6 +- Vocaluxe/Base/CGraphics.cs | 3 +- Vocaluxe/Base/CLanguage.cs | 6 +- Vocaluxe/Base/CParty.cs | 9 +-- Vocaluxe/Base/CPlaylists.cs | 3 +- Vocaluxe/Base/CProfiles.cs | 28 +++----- Vocaluxe/Base/CSettings.cs | 11 +-- Vocaluxe/Base/CSound.cs | 13 ++-- Vocaluxe/Base/CTheme.cs | 22 ++---- Vocaluxe/Base/CUtility.cs | 5 +- Vocaluxe/Base/CVideo.cs | 3 +- Vocaluxe/Lib/Draw/CDrawWinForm.cs | 15 +--- Vocaluxe/Lib/Playlist/CPlaylistFile.cs | 14 +--- Vocaluxe/Lib/Sound/CDirectSoundRecord.cs | 20 ++---- Vocaluxe/Lib/Sound/CPortAudioPlay.cs | 12 ++-- Vocaluxe/Lib/Sound/CPortAudioRecord.cs | 23 +++--- Vocaluxe/Screens/CScreenCredits.cs | 3 +- Vocaluxe/Screens/CScreenHighscore.cs | 9 +-- Vocaluxe/Screens/CScreenNames.cs | 13 +--- Vocaluxe/Screens/CScreenOptionsRecord.cs | 3 +- Vocaluxe/Screens/CScreenSing.cs | 47 +++++------- Vocaluxe/Screens/CScreenSong.cs | 10 +-- VocaluxeLib/Menu/CButton.cs | 27 +++---- VocaluxeLib/Menu/CNameSelection.cs | 8 +-- VocaluxeLib/Menu/CObjectInteractions.cs | 6 +- VocaluxeLib/Menu/CPlaylist.cs | 64 ++++++++--------- VocaluxeLib/Menu/CSelectSlide.cs | 41 +++++------ VocaluxeLib/Menu/CStatic.cs | 9 +-- VocaluxeLib/Menu/CText.cs | 5 +- VocaluxeLib/Menu/SingNotes/CNotes.cs | 3 +- VocaluxeLib/Menu/SingNotes/CSingNotes.cs | 3 +- VocaluxeLib/Menu/SongMenu/CSong.cs | 38 +++++----- .../Menu/SongMenu/CSongMenuFramework.cs | 27 +++---- VocaluxeLib/PartyModes/CPartyMode.cs | 8 +-- 47 files changed, 289 insertions(+), 515 deletions(-) diff --git a/PartyModes/PartyModeChallenge/CPartyModeChallenge.cs b/PartyModes/PartyModeChallenge/CPartyModeChallenge.cs index e15974b2..e94d81b3 100644 --- a/PartyModes/PartyModeChallenge/CPartyModeChallenge.cs +++ b/PartyModes/PartyModeChallenge/CPartyModeChallenge.cs @@ -178,14 +178,7 @@ namespace VocaluxeLib.PartyModes.Challenge _ToScreenNames = new SDataToScreenNames(); _ToScreenMain = new SDataToScreenMain(); - _GameData = new SData(); - _GameData.NumPlayer = 4; - _GameData.NumPlayerAtOnce = 2; - _GameData.NumRounds = 2; - _GameData.CurrentRoundNr = 1; - _GameData.ProfileIDs = new List(); - _GameData.CatSongIndices = null; - _GameData.Results = null; + _GameData = new SData {NumPlayer = 4, NumPlayerAtOnce = 2, NumRounds = 2, CurrentRoundNr = 1, ProfileIDs = new List(), CatSongIndices = null, Results = null}; } public override bool Init() @@ -657,15 +650,11 @@ namespace VocaluxeLib.PartyModes.Challenge List result = new List(); for (int i = 0; i < _GameData.NumPlayerAtOnce; i++) { - SStats stat = new SStats(); - stat.ProfileID = results[i].ProfileID; - stat.SingPoints = (int)Math.Round(results[i].Points); - stat.Won = 0; - stat.GamePoints = 0; + SStats stat = new SStats {ProfileID = results[i].ProfileID, SingPoints = (int)Math.Round(results[i].Points), Won = 0, GamePoints = 0}; result.Add(stat); } - result.Sort(delegate(SStats s1, SStats s2) { return s1.SingPoints.CompareTo(s2.SingPoints); }); + result.Sort((s1, s2) => s1.SingPoints.CompareTo(s2.SingPoints)); int current = result[result.Count - 1].SingPoints; int points = result.Count; diff --git a/PartyModes/PartyModeChallenge/CPartyScreenChallengeConfig.cs b/PartyModes/PartyModeChallenge/CPartyScreenChallengeConfig.cs index bbbd930f..7e856321 100644 --- a/PartyModes/PartyModeChallenge/CPartyScreenChallengeConfig.cs +++ b/PartyModes/PartyModeChallenge/CPartyScreenChallengeConfig.cs @@ -53,10 +53,7 @@ namespace VocaluxeLib.PartyModes.Challenge _ThemeButtons = new string[] {_ButtonNext, _ButtonBack}; _Data = new SDataFromScreen(); - SFromScreenConfig config = new SFromScreenConfig(); - config.NumPlayer = 4; - config.NumPlayerAtOnce = 2; - config.NumRounds = 12; + SFromScreenConfig config = new SFromScreenConfig {NumPlayer = 4, NumPlayerAtOnce = 2, NumRounds = 12}; _Data.ScreenConfig = config; } @@ -227,10 +224,7 @@ namespace VocaluxeLib.PartyModes.Challenge int res = _Data.ScreenConfig.NumPlayer / _Data.ScreenConfig.NumPlayerAtOnce; int mod = _Data.ScreenConfig.NumPlayer % _Data.ScreenConfig.NumPlayerAtOnce; - if (mod == 0) - _RoundSteps = res; - else - _RoundSteps = _Data.ScreenConfig.NumPlayer; + _RoundSteps = mod == 0 ? res : _Data.ScreenConfig.NumPlayer; } private void _Back() diff --git a/PartyModes/PartyModeChallenge/CPartyScreenChallengeMain.cs b/PartyModes/PartyModeChallenge/CPartyScreenChallengeMain.cs index 87d6704a..b0cf21bd 100644 --- a/PartyModes/PartyModeChallenge/CPartyScreenChallengeMain.cs +++ b/PartyModes/PartyModeChallenge/CPartyScreenChallengeMain.cs @@ -98,8 +98,7 @@ namespace VocaluxeLib.PartyModes.Challenge public CPartyScreenChallengeMain() { - _Data = new SDataFromScreen(); - _Data.ScreenMain = new SFromScreenMain(); + _Data = new SDataFromScreen {ScreenMain = new SFromScreenMain()}; } public override void Init() @@ -406,9 +405,7 @@ namespace VocaluxeLib.PartyModes.Challenge _RoundsTable = new List(); for (int i = 0; i < 5; i++) { - CRoundsTableRow rtr = new CRoundsTableRow(); - rtr.TextPlayer = new List(); - rtr.TextScores = new List(); + CRoundsTableRow rtr = new CRoundsTableRow {TextPlayer = new List(), TextScores = new List()}; _RoundsTable.Add(rtr); } //Create statics and texts for rounds @@ -438,11 +435,8 @@ namespace VocaluxeLib.PartyModes.Challenge { _RoundsTableScrollArea = new SRectF(); - int numPlayerInOneRow = 3; - if (_GameState.NumPlayerAtOnce <= numPlayerInOneRow) - _NumRoundsVisible = 5; - else - _NumRoundsVisible = 3; + const int numPlayerInOneRow = 3; + _NumRoundsVisible = _GameState.NumPlayerAtOnce <= numPlayerInOneRow ? 5 : 3; if (_NumRoundsVisible > _GameState.Combs.Count) _NumRoundsVisible = _GameState.Combs.Count; @@ -536,10 +530,7 @@ namespace VocaluxeLib.PartyModes.Challenge private void _BuildPlayerTable() { - _PlayerTableScrollArea = new SRectF(); - _PlayerTableScrollArea.X = _Texts[_TextPosition].X; - _PlayerTableScrollArea.Y = _Texts[_TextPosition].Y; - _PlayerTableScrollArea.W = _Texts[_TextGamePoints].X - _Texts[_TextPosition].X; + _PlayerTableScrollArea = new SRectF {X = _Texts[_TextPosition].X, Y = _Texts[_TextPosition].Y, W = _Texts[_TextGamePoints].X - _Texts[_TextPosition].X}; _PlayerTable = new List(); float delta = _Texts[_TextPosition].Height * 1.2f; @@ -548,14 +539,15 @@ namespace VocaluxeLib.PartyModes.Challenge for (int i = 0; i < 10; i++) { - STableRow row = new STableRow(); - - row.Pos = GetNewText(_Texts[_TextPosition]); - row.Name = GetNewText(_Texts[_TextPlayerName]); - row.Rounds = GetNewText(_Texts[_TextNumPlayed]); - row.Won = GetNewText(_Texts[_TextWon]); - row.SingPoints = GetNewText(_Texts[_TextSingPoints]); - row.GamePoints = GetNewText(_Texts[_TextGamePoints]); + STableRow row = new STableRow + { + Pos = GetNewText(_Texts[_TextPosition]), + Name = GetNewText(_Texts[_TextPlayerName]), + Rounds = GetNewText(_Texts[_TextNumPlayed]), + Won = GetNewText(_Texts[_TextWon]), + SingPoints = GetNewText(_Texts[_TextSingPoints]), + GamePoints = GetNewText(_Texts[_TextGamePoints]) + }; row.Pos.Y += delta * (i + 1); row.Name.Y += delta * (i + 1); diff --git a/PartyModes/PartyModeChallengeMedley/CPartyModeChallengeMedley.cs b/PartyModes/PartyModeChallengeMedley/CPartyModeChallengeMedley.cs index a9f76d23..4b549c4e 100644 --- a/PartyModes/PartyModeChallengeMedley/CPartyModeChallengeMedley.cs +++ b/PartyModes/PartyModeChallengeMedley/CPartyModeChallengeMedley.cs @@ -182,14 +182,7 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley _ToScreenNames = new SDataToScreenNames(); _ToScreenMain = new SDataToScreenMain(); - _GameData = new SData(); - _GameData.NumPlayer = 4; - _GameData.NumPlayerAtOnce = 2; - _GameData.NumRounds = 2; - _GameData.CurrentRoundNr = 1; - _GameData.ProfileIDs = new List(); - _GameData.CatSongIndices = null; - _GameData.Results = null; + _GameData = new SData {NumPlayer = 4, NumPlayerAtOnce = 2, NumRounds = 2, CurrentRoundNr = 1, ProfileIDs = new List(), CatSongIndices = null, Results = null}; } public override bool Init() @@ -637,13 +630,7 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley { for (int i = 0; i < _GameData.NumPlayer; i++) { - CResultTableRow row = new CResultTableRow(); - row.PlayerID = _GameData.ProfileIDs[i]; - row.NumPlayed = 0; - row.NumRounds = 0; - row.NumWon = 0; - row.NumSingPoints = 0; - row.NumGamePoints = 0; + CResultTableRow row = new CResultTableRow {PlayerID = _GameData.ProfileIDs[i], NumPlayed = 0, NumRounds = 0, NumWon = 0, NumSingPoints = 0, NumGamePoints = 0}; _GameData.ResultTable.Add(row); } @@ -732,15 +719,11 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley List result = new List(); for (int i = 0; i < _GameData.NumPlayerAtOnce; i++) { - SStats stat = new SStats(); - stat.ProfileID = results[i].ProfileID; - stat.SingPoints = (int)Math.Round(results[i].Points); - stat.Won = 0; - stat.GamePoints = 0; + SStats stat = new SStats {ProfileID = results[i].ProfileID, SingPoints = (int)Math.Round(results[i].Points), Won = 0, GamePoints = 0}; result.Add(stat); } - result.Sort(delegate(SStats s1, SStats s2) { return s1.SingPoints.CompareTo(s2.SingPoints); }); + result.Sort((s1, s2) => s1.SingPoints.CompareTo(s2.SingPoints)); int current = result[result.Count - 1].SingPoints; int points = result.Count; diff --git a/PartyModes/PartyModeChallengeMedley/CPartyScreenChallengeMedleyConfig.cs b/PartyModes/PartyModeChallengeMedley/CPartyScreenChallengeMedleyConfig.cs index 03222db4..ab99973c 100644 --- a/PartyModes/PartyModeChallengeMedley/CPartyScreenChallengeMedleyConfig.cs +++ b/PartyModes/PartyModeChallengeMedley/CPartyScreenChallengeMedleyConfig.cs @@ -53,10 +53,7 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley _ThemeButtons = new string[] {_ButtonNext, _ButtonBack}; _Data = new SDataFromScreen(); - SFromScreenConfig config = new SFromScreenConfig(); - config.NumPlayer = 4; - config.NumPlayerAtOnce = 2; - config.NumRounds = 12; + SFromScreenConfig config = new SFromScreenConfig {NumPlayer = 4, NumPlayerAtOnce = 2, NumRounds = 12}; _Data.ScreenConfig = config; } @@ -227,10 +224,7 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley int res = _Data.ScreenConfig.NumPlayer / _Data.ScreenConfig.NumPlayerAtOnce; int mod = _Data.ScreenConfig.NumPlayer % _Data.ScreenConfig.NumPlayerAtOnce; - if (mod == 0) - _RoundSteps = res; - else - _RoundSteps = _Data.ScreenConfig.NumPlayer; + _RoundSteps = mod == 0 ? res : _Data.ScreenConfig.NumPlayer; } private void _Back() diff --git a/PartyModes/PartyModeChallengeMedley/CPartyScreenChallengeMedleyMain.cs b/PartyModes/PartyModeChallengeMedley/CPartyScreenChallengeMedleyMain.cs index 3ac5fc60..7b465fb1 100644 --- a/PartyModes/PartyModeChallengeMedley/CPartyScreenChallengeMedleyMain.cs +++ b/PartyModes/PartyModeChallengeMedley/CPartyScreenChallengeMedleyMain.cs @@ -98,8 +98,7 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley public CPartyScreenChallengeMedleyMain() { - _Data = new SDataFromScreen(); - _Data.ScreenMain = new SFromScreenMain(); + _Data = new SDataFromScreen {ScreenMain = new SFromScreenMain()}; } public override void Init() @@ -406,9 +405,7 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley _RoundsTable = new List(); for (int i = 0; i < 5; i++) { - CRoundsTableRow rtr = new CRoundsTableRow(); - rtr.TextPlayer = new List(); - rtr.TextScores = new List(); + CRoundsTableRow rtr = new CRoundsTableRow {TextPlayer = new List(), TextScores = new List()}; _RoundsTable.Add(rtr); } //Create statics and texts for rounds @@ -438,11 +435,8 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley { _RoundsTableScrollArea = new SRectF(); - int numPlayerInOneRow = 3; - if (_GameState.NumPlayerAtOnce <= numPlayerInOneRow) - _NumRoundsVisible = 5; - else - _NumRoundsVisible = 3; + const int numPlayerInOneRow = 3; + _NumRoundsVisible = _GameState.NumPlayerAtOnce <= numPlayerInOneRow ? 5 : 3; if (_NumRoundsVisible > _GameState.Combs.Count) _NumRoundsVisible = _GameState.Combs.Count; @@ -536,10 +530,7 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley private void _BuildPlayerTable() { - _PlayerTableScrollArea = new SRectF(); - _PlayerTableScrollArea.X = _Texts[_TextPosition].X; - _PlayerTableScrollArea.Y = _Texts[_TextPosition].Y; - _PlayerTableScrollArea.W = _Texts[_TextGamePoints].X - _Texts[_TextPosition].X; + _PlayerTableScrollArea = new SRectF {X = _Texts[_TextPosition].X, Y = _Texts[_TextPosition].Y, W = _Texts[_TextGamePoints].X - _Texts[_TextPosition].X}; _PlayerTable = new List(); float delta = _Texts[_TextPosition].Height * 1.2f; @@ -548,14 +539,15 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley for (int i = 0; i < 10; i++) { - STableRow row = new STableRow(); - - row.Pos = GetNewText(_Texts[_TextPosition]); - row.Name = GetNewText(_Texts[_TextPlayerName]); - row.Rounds = GetNewText(_Texts[_TextNumPlayed]); - row.Won = GetNewText(_Texts[_TextWon]); - row.SingPoints = GetNewText(_Texts[_TextSingPoints]); - row.GamePoints = GetNewText(_Texts[_TextGamePoints]); + STableRow row = new STableRow + { + Pos = GetNewText(_Texts[_TextPosition]), + Name = GetNewText(_Texts[_TextPlayerName]), + Rounds = GetNewText(_Texts[_TextNumPlayed]), + Won = GetNewText(_Texts[_TextWon]), + SingPoints = GetNewText(_Texts[_TextSingPoints]), + GamePoints = GetNewText(_Texts[_TextGamePoints]) + }; row.Pos.Y += delta * (i + 1); row.Name.Y += delta * (i + 1); diff --git a/PartyModes/PartyModeChallengeMedley/CPartyScreenChallengeMedleyNames.cs b/PartyModes/PartyModeChallengeMedley/CPartyScreenChallengeMedleyNames.cs index 959dc7ec..9617fa42 100644 --- a/PartyModes/PartyModeChallengeMedley/CPartyScreenChallengeMedleyNames.cs +++ b/PartyModes/PartyModeChallengeMedley/CPartyScreenChallengeMedleyNames.cs @@ -88,10 +88,7 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley _ThemeButtons = new string[] {_ButtonBack, _ButtonNext, _ButtonPlayerDestination, _ButtonPlayerChoose}; _Data = new SDataFromScreen(); - SFromScreenNames names = new SFromScreenNames(); - names.FadeToConfig = false; - names.FadeToMain = false; - names.ProfileIDs = new List(); + SFromScreenNames names = new SFromScreenNames {FadeToConfig = false, FadeToMain = false, ProfileIDs = new List()}; _Data.ScreenNames = names; } @@ -316,9 +313,7 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley CButton b = GetNewButton(_Buttons[_ButtonPlayerChoose]); b.Rect.X = _PlayerChooseButtonsFirstX + column * (b.Rect.W + _PlayerChooseButtonsSpaceH); b.Rect.Y = _PlayerChooseButtonsFirstY + row * (b.Rect.H + _PlayerChooseButtonsSpaceW); - CPlayerChooseButton pcb = new CPlayerChooseButton(); - pcb.Button = b; - pcb.ProfileID = -1; + CPlayerChooseButton pcb = new CPlayerChooseButton {Button = b, ProfileID = -1}; _PlayerChooseButtons.Add(pcb); column++; if (column >= _PlayerChooseButtonsNumH) diff --git a/PartyModes/PartyModeTicTacToe/CPartyModeTicTacToe.cs b/PartyModes/PartyModeTicTacToe/CPartyModeTicTacToe.cs index 69d7c33f..750e1357 100644 --- a/PartyModes/PartyModeTicTacToe/CPartyModeTicTacToe.cs +++ b/PartyModes/PartyModeTicTacToe/CPartyModeTicTacToe.cs @@ -203,24 +203,26 @@ namespace VocaluxeLib.PartyModes.TicTacToe _ToScreenNames = new SDataToScreenNames(); _ToScreenMain = new SDataToScreenMain(); - _GameData = new SData(); - _GameData.NumFields = 9; - _GameData.NumPlayerTeam1 = 2; - _GameData.NumPlayerTeam2 = 2; - _GameData.ProfileIDsTeam1 = new List(); - _GameData.ProfileIDsTeam2 = new List(); - _GameData.PlayerTeam1 = new List(); - _GameData.PlayerTeam2 = new List(); - _GameData.CurrentRoundNr = 0; - _GameData.SingRoundNr = 0; - _GameData.SongSource = ESongSource.TR_ALLSONGS; - _GameData.PlaylistID = 0; - _GameData.CategoryID = 0; - _GameData.GameMode = EPartyGameMode.TR_GAMEMODE_NORMAL; - _GameData.Rounds = new List(); - _GameData.Songs = new List(); - _GameData.NumJokerRandom = new int[2]; - _GameData.NumJokerRetry = new int[2]; + _GameData = new SData + { + NumFields = 9, + NumPlayerTeam1 = 2, + NumPlayerTeam2 = 2, + ProfileIDsTeam1 = new List(), + ProfileIDsTeam2 = new List(), + PlayerTeam1 = new List(), + PlayerTeam2 = new List(), + CurrentRoundNr = 0, + SingRoundNr = 0, + SongSource = ESongSource.TR_ALLSONGS, + PlaylistID = 0, + CategoryID = 0, + GameMode = EPartyGameMode.TR_GAMEMODE_NORMAL, + Rounds = new List(), + Songs = new List(), + NumJokerRandom = new int[2], + NumJokerRetry = new int[2] + }; } public override bool Init() @@ -281,10 +283,7 @@ namespace VocaluxeLib.PartyModes.TicTacToe _Stage = EStage.NotStarted; else { - if (CBase.Game.GetRandom(100) < 50) - _GameData.Team = 0; - else - _GameData.Team = 1; + _GameData.Team = CBase.Game.GetRandom(100) < 50 ? 0 : 1; _GameData.ProfileIDsTeam1 = dataFrom.ScreenNames.ProfileIDsTeam1; _GameData.ProfileIDsTeam2 = dataFrom.ScreenNames.ProfileIDsTeam2; _Stage = EStage.Names; @@ -377,10 +376,7 @@ namespace VocaluxeLib.PartyModes.TicTacToe _Screens.TryGetValue("CPartyScreenTicTacToeMain", out screen); if (screen != null) { - if (_GameData.Team == 1) - _GameData.Team = 0; - else - _GameData.Team = 1; + _GameData.Team = _GameData.Team == 1 ? 0 : 1; CBase.Songs.ResetPartySongSung(); _GameData.CurrentRoundNr = 1; _ToScreenMain.CurrentRoundNr = 1; @@ -410,10 +406,7 @@ namespace VocaluxeLib.PartyModes.TicTacToe _Screens.TryGetValue("CPartyScreenTicTacToeMain", out screen); if (screen != null) { - if (_GameData.Team == 1) - _GameData.Team = 0; - else - _GameData.Team = 1; + _GameData.Team = _GameData.Team == 1 ? 0 : 1; _UpdateSongList(); _UpdatePlayerList(); _ToScreenMain.CurrentRoundNr = _GameData.CurrentRoundNr; diff --git a/PartyModes/PartyModeTicTacToe/CPartyScreenTicTacToeMain.cs b/PartyModes/PartyModeTicTacToe/CPartyScreenTicTacToeMain.cs index 5044030d..dd069796 100644 --- a/PartyModes/PartyModeTicTacToe/CPartyScreenTicTacToeMain.cs +++ b/PartyModes/PartyModeTicTacToe/CPartyScreenTicTacToeMain.cs @@ -388,8 +388,7 @@ namespace VocaluxeLib.PartyModes.TicTacToe { for (int i = 0; i < 25; i++) { - CField f = new CField(); - f.Button = GetNewButton(_Buttons[_ButtonField]); + CField f = new CField {Button = GetNewButton(_Buttons[_ButtonField])}; f.Button.Visible = false; f.Content = new CRound(); _AddButton(f.Button); diff --git a/PartyModes/PartyModeTicTacToe/CPartyScreenTicTacToeNames.cs b/PartyModes/PartyModeTicTacToe/CPartyScreenTicTacToeNames.cs index eabff2aa..2025cdf7 100644 --- a/PartyModes/PartyModeTicTacToe/CPartyScreenTicTacToeNames.cs +++ b/PartyModes/PartyModeTicTacToe/CPartyScreenTicTacToeNames.cs @@ -93,11 +93,7 @@ namespace VocaluxeLib.PartyModes.TicTacToe _ThemeButtons = new string[] {_ButtonBack, _ButtonNext, _ButtonPlayerDestination, _ButtonPlayerChoose, _ButtonPlayerChooseScrollUp, _ButtonPlayerChooseScrollDown}; _Data = new SDataFromScreen(); - SFromScreenNames names = new SFromScreenNames(); - names.FadeToConfig = false; - names.FadeToMain = false; - names.ProfileIDsTeam1 = new List(); - names.ProfileIDsTeam2 = new List(); + SFromScreenNames names = new SFromScreenNames {FadeToConfig = false, FadeToMain = false, ProfileIDsTeam1 = new List(), ProfileIDsTeam2 = new List()}; _Data.ScreenNames = names; } @@ -378,9 +374,7 @@ namespace VocaluxeLib.PartyModes.TicTacToe CButton b = GetNewButton(_Buttons[_ButtonPlayerChoose]); b.Rect.X = _PlayerChooseButtonsFirstX + column * (b.Rect.W + _PlayerChooseButtonsSpaceH); b.Rect.Y = _PlayerChooseButtonsFirstY + row * (b.Rect.H + _PlayerChooseButtonsSpaceW); - CPlayerChooseButton pcb = new CPlayerChooseButton(); - pcb.Button = b; - pcb.ProfileID = -1; + CPlayerChooseButton pcb = new CPlayerChooseButton {Button = b, ProfileID = -1}; _PlayerChooseButtons.Add(pcb); column++; if (column >= _PlayerChooseButtonsNumH) diff --git a/Vocaluxe/Base/CBackgroundMusic.cs b/Vocaluxe/Base/CBackgroundMusic.cs index 5c645411..de114f20 100644 --- a/Vocaluxe/Base/CBackgroundMusic.cs +++ b/Vocaluxe/Base/CBackgroundMusic.cs @@ -161,10 +161,7 @@ namespace Vocaluxe.Base else Next(); - if (!_IsBackgroundFile(_CurrentPlaylistElement)) - _CanSing = true; - else - _CanSing = false; + _CanSing = !_IsBackgroundFile(_CurrentPlaylistElement); } } } diff --git a/Vocaluxe/Base/CCover.cs b/Vocaluxe/Base/CCover.cs index d6089808..24f80d64 100644 --- a/Vocaluxe/Base/CCover.cs +++ b/Vocaluxe/Base/CCover.cs @@ -164,7 +164,7 @@ namespace Vocaluxe.Base _CoverThemes.Clear(); const string path = CSettings.FolderCover; - List files = CHelper.ListFiles(path, "*.xml", false); + List files = CHelper.ListFiles(path, "*.xml"); foreach (string file in files) { diff --git a/Vocaluxe/Base/CDataBase.cs b/Vocaluxe/Base/CDataBase.cs index 9a2f899f..b130d5e4 100644 --- a/Vocaluxe/Base/CDataBase.cs +++ b/Vocaluxe/Base/CDataBase.cs @@ -73,15 +73,17 @@ namespace Vocaluxe.Base public static int AddScore(string playerName, int score, int lineNr, long date, int medley, int duet, int shortSong, int diff, string artist, string title, int numPlayed, string filePath) { - SPlayer player = new SPlayer(); - player.Name = playerName; - player.Points = score; - player.LineNr = lineNr; - player.DateTicks = date; - player.Medley = medley == 1; - player.Duet = duet == 1; - player.ShortSong = shortSong == 1; - player.Difficulty = (EGameDifficulty)diff; + SPlayer player = new SPlayer + { + Name = playerName, + Points = score, + LineNr = lineNr, + DateTicks = date, + Medley = medley == 1, + Duet = duet == 1, + ShortSong = shortSong == 1, + Difficulty = (EGameDifficulty)diff + }; using (SQLiteConnection connection = new SQLiteConnection()) { @@ -252,13 +254,15 @@ namespace Vocaluxe.Base { while (reader.Read()) { - SScores score = new SScores(); - score.Name = reader.GetString(0); - score.Score = reader.GetInt32(1); - score.Date = new DateTime(reader.GetInt64(2)).ToString("dd/MM/yyyy"); - score.Difficulty = (EGameDifficulty)reader.GetInt32(3); - score.LineNr = reader.GetInt32(4); - score.ID = reader.GetInt32(5); + SScores score = new SScores + { + Name = reader.GetString(0), + Score = reader.GetInt32(1), + Date = new DateTime(reader.GetInt64(2)).ToString("dd/MM/yyyy"), + Difficulty = (EGameDifficulty)reader.GetInt32(3), + LineNr = reader.GetInt32(4), + ID = reader.GetInt32(5) + }; scores.Add(score); } @@ -633,9 +637,7 @@ namespace Vocaluxe.Base { while (reader.Read()) { - SData data = new SData(); - data.Id = reader.GetInt32(0); - data.Str1 = reader.GetString(1); + SData data = new SData {Id = reader.GetInt32(0), Str1 = reader.GetString(1)}; Int64 ticks = 0; try @@ -659,10 +661,7 @@ namespace Vocaluxe.Base { while (reader.Read()) { - SData data = new SData(); - data.Id = reader.GetInt32(0); - data.Str1 = reader.GetString(1); - data.Str2 = reader.GetString(2); + SData data = new SData {Id = reader.GetInt32(0), Str1 = reader.GetString(1), Str2 = reader.GetString(2)}; songs.Add(data); } } @@ -793,21 +792,13 @@ namespace Vocaluxe.Base while (Sqlite3.sqlite3_step(stmt) == Sqlite3.SQLITE_ROW) { - SData data = new SData(); - - data.Id = Sqlite3.sqlite3_column_int(stmt, 0); + SData data = new SData {Id = Sqlite3.sqlite3_column_int(stmt, 0)}; byte[] bytes = Sqlite3.sqlite3_column_rawbytes(stmt, 1); - if (bytes != null) - data.Str1 = utf8.GetString(Encoding.Convert(cp1252, utf8, bytes)); - else - data.Str1 = "Someone"; + data.Str1 = bytes != null ? utf8.GetString(Encoding.Convert(cp1252, utf8, bytes)) : "Someone"; bytes = Sqlite3.sqlite3_column_rawbytes(stmt, 2); - if (bytes != null) - data.Str2 = utf8.GetString(Encoding.Convert(cp1252, utf8, bytes)); - else - data.Str2 = "Someone"; + data.Str2 = bytes != null ? utf8.GetString(Encoding.Convert(cp1252, utf8, bytes)) : "Someone"; songs.Add(data); } @@ -831,15 +822,10 @@ namespace Vocaluxe.Base while (Sqlite3.sqlite3_step(stmt) == Sqlite3.SQLITE_ROW) { - SData data = new SData(); - - data.Id = Sqlite3.sqlite3_column_int(stmt, 0); + SData data = new SData {Id = Sqlite3.sqlite3_column_int(stmt, 0)}; byte[] bytes = Sqlite3.sqlite3_column_rawbytes(stmt, 1); - if (bytes != null) - data.Str1 = utf8.GetString(Encoding.Convert(cp1252, utf8, bytes)); - else - data.Str1 = "Someone"; + data.Str1 = bytes != null ? utf8.GetString(Encoding.Convert(cp1252, utf8, bytes)) : "Someone"; if (dateExists) data.Ticks = _UnixTimeToTicks(Sqlite3.sqlite3_column_int(stmt, 2)); @@ -986,8 +972,7 @@ namespace Vocaluxe.Base if (_ConnectionCover == null) { - _ConnectionCover = new SQLiteConnection(); - _ConnectionCover.ConnectionString = "Data Source=" + _CoverFilePath; + _ConnectionCover = new SQLiteConnection {ConnectionString = "Data Source=" + _CoverFilePath}; _ConnectionCover.Open(); } diff --git a/Vocaluxe/Base/CFont.cs b/Vocaluxe/Base/CFont.cs index 10b8f7d0..f7b45b25 100644 --- a/Vocaluxe/Base/CFont.cs +++ b/Vocaluxe/Base/CFont.cs @@ -577,11 +577,7 @@ namespace Vocaluxe.Base int i = 1; while (xmlReader.GetValue("//root/Fonts/Font" + i + "/Folder", out value, value)) { - SFont sf = new SFont(); - sf.Folder = value; - sf.IsThemeFont = themeName != ""; - sf.ThemeName = themeName; - sf.PartyModeID = partyModeId; + SFont sf = new SFont {Folder = value, IsThemeFont = themeName != "", ThemeName = themeName, PartyModeID = partyModeId}; bool ok = true; diff --git a/Vocaluxe/Base/CGraphics.cs b/Vocaluxe/Base/CGraphics.cs index fb544ad4..5f9f3078 100644 --- a/Vocaluxe/Base/CGraphics.cs +++ b/Vocaluxe/Base/CGraphics.cs @@ -748,8 +748,7 @@ namespace Vocaluxe.Base if (CConfig.DebugLevel == EDebugLevel.TR_CONFIG_OFF) return; - List debugOutput = new List(); - debugOutput.Add(CTime.GetFPS().ToString("FPS: 000")); + List debugOutput = new List {CTime.GetFPS().ToString("FPS: 000")}; if (CConfig.DebugLevel >= EDebugLevel.TR_CONFIG_LEVEL1) { diff --git a/Vocaluxe/Base/CLanguage.cs b/Vocaluxe/Base/CLanguage.cs index 1e7ec559..00b2d6e5 100644 --- a/Vocaluxe/Base/CLanguage.cs +++ b/Vocaluxe/Base/CLanguage.cs @@ -212,8 +212,7 @@ namespace Vocaluxe.Base if (nr == -1) return true; - SPartyLanguage lang = new SPartyLanguage(); - lang.PartyModeID = partyModeID; + SPartyLanguage lang = new SPartyLanguage {PartyModeID = partyModeID}; if (!_LoadLanguageEntries(xmlReader, out lang.Texts)) return false; @@ -226,8 +225,7 @@ namespace Vocaluxe.Base private static void _LoadLanguageFile(string fileName) { - SLanguage lang = new SLanguage(); - lang.LanguageFilePath = Path.Combine(CSettings.FolderLanguages, fileName); + SLanguage lang = new SLanguage {LanguageFilePath = Path.Combine(CSettings.FolderLanguages, fileName)}; CXMLReader xmlReader = CXMLReader.OpenFile(lang.LanguageFilePath); if (xmlReader == null) diff --git a/Vocaluxe/Base/CParty.cs b/Vocaluxe/Base/CParty.cs index 372046d2..9d9baee4 100644 --- a/Vocaluxe/Base/CParty.cs +++ b/Vocaluxe/Base/CParty.cs @@ -67,9 +67,7 @@ namespace Vocaluxe.Base _IDs.Enqueue(i); //add dummy normal game mode and set it as default - SPartyMode pm = new SPartyMode(); - pm.PartyMode = new CPartyModeNone(); - pm.ScreenFiles = new List(); + SPartyMode pm = new SPartyMode {PartyMode = new CPartyModeNone(), ScreenFiles = new List()}; pm.PartyMode.Initialize(); pm.PartyModeID = _IDs.Dequeue(); _NormalGameModeID = pm.PartyModeID; @@ -231,10 +229,7 @@ namespace Vocaluxe.Base private static SPartyMode _LoadPartyMode(string file) { - SPartyMode pm = new SPartyMode(); - pm.PartyModeID = _IDs.Dequeue(); - pm.ScreenFiles = new List(); - pm.NoErrors = false; + SPartyMode pm = new SPartyMode {PartyModeID = _IDs.Dequeue(), ScreenFiles = new List(), NoErrors = false}; CXMLReader xmlReader = CXMLReader.OpenFile(file); diff --git a/Vocaluxe/Base/CPlaylists.cs b/Vocaluxe/Base/CPlaylists.cs index 1b547267..9fad3f43 100644 --- a/Vocaluxe/Base/CPlaylists.cs +++ b/Vocaluxe/Base/CPlaylists.cs @@ -139,8 +139,7 @@ namespace Vocaluxe.Base public static int NewPlaylist() { - CPlaylistFile pl = new CPlaylistFile(); - pl.PlaylistName = "New Playlist"; + CPlaylistFile pl = new CPlaylistFile {PlaylistName = "New Playlist"}; _Playlists.Add(pl); return _Playlists.Count - 1; } diff --git a/Vocaluxe/Base/CProfiles.cs b/Vocaluxe/Base/CProfiles.cs index 3538024a..76e910d8 100644 --- a/Vocaluxe/Base/CProfiles.cs +++ b/Vocaluxe/Base/CProfiles.cs @@ -69,18 +69,15 @@ namespace Vocaluxe.Base public static int NewProfile(string fileName) { - SProfile profile = new SProfile(); - - profile.PlayerName = String.Empty; - profile.Difficulty = EGameDifficulty.TR_CONFIG_EASY; - profile.Avatar = new SAvatar(-1); - profile.GuestProfile = EOffOn.TR_CONFIG_OFF; - profile.Active = EOffOn.TR_CONFIG_ON; - - if (fileName != "") - profile.ProfileFile = Path.Combine(CSettings.FolderProfiles, fileName); - else - profile.ProfileFile = String.Empty; + SProfile profile = new SProfile + { + PlayerName = String.Empty, + Difficulty = EGameDifficulty.TR_CONFIG_EASY, + Avatar = new SAvatar(-1), + GuestProfile = EOffOn.TR_CONFIG_OFF, + Active = EOffOn.TR_CONFIG_ON, + ProfileFile = fileName != "" ? Path.Combine(CSettings.FolderProfiles, fileName) : String.Empty + }; if (File.Exists(profile.ProfileFile)) return -1; @@ -129,9 +126,7 @@ namespace Vocaluxe.Base if (tex.Index != -1) { - SAvatar avatar = new SAvatar(); - avatar.Texture = tex; - avatar.FileName = Path.GetFileName(file); + SAvatar avatar = new SAvatar {Texture = tex, FileName = Path.GetFileName(file)}; _Avatars.Add(avatar); } } @@ -367,8 +362,7 @@ namespace Vocaluxe.Base private static void _LoadProfile(string fileName) { - SProfile profile = new SProfile(); - profile.ProfileFile = Path.Combine(CSettings.FolderProfiles, fileName); + SProfile profile = new SProfile {ProfileFile = Path.Combine(CSettings.FolderProfiles, fileName)}; CXMLReader xmlReader = CXMLReader.OpenFile(profile.ProfileFile); if (xmlReader == null) diff --git a/Vocaluxe/Base/CSettings.cs b/Vocaluxe/Base/CSettings.cs index ee116549..cfb7c39f 100644 --- a/Vocaluxe/Base/CSettings.cs +++ b/Vocaluxe/Base/CSettings.cs @@ -197,16 +197,7 @@ namespace Vocaluxe.Base public static void CreateFolders() { - List folders = new List(); - - folders.Add(FolderCover); - folders.Add(FolderFonts); - folders.Add(FolderProfiles); - folders.Add(FolderSongs); - folders.Add(FolderScreenshots); - folders.Add(FolderBackgroundMusic); - folders.Add(FolderSounds); - folders.Add(FolderPlaylists); + List folders = new List {FolderCover, FolderFonts, FolderProfiles, FolderSongs, FolderScreenshots, FolderBackgroundMusic, FolderSounds, FolderPlaylists}; foreach (string folder in folders) { diff --git a/Vocaluxe/Base/CSound.cs b/Vocaluxe/Base/CSound.cs index 61a664b3..70b0e598 100644 --- a/Vocaluxe/Base/CSound.cs +++ b/Vocaluxe/Base/CSound.cs @@ -486,16 +486,19 @@ namespace Vocaluxe.Base _MaxVolume = volume; } - if (_MaxVolume >= 0.02f) - _AnalyzeByAutocorrelation(true); - else - _AnalyzeByAutocorrelation(false); + _AnalyzeByAutocorrelation(_MaxVolume >= 0.02f); } catch (Exception) {} } private void _AnalyzeByAutocorrelation(bool valid) { + if (!valid) + { + _ToneValid = false; + return; + } + const double halftoneBase = 1.05946309436; // 2^(1/12) -> HalftoneBase^12 = 2 (one octave) // prepare to analyze @@ -525,7 +528,7 @@ namespace Vocaluxe.Base weigth[toneIndex] = (float)curWeight; } - if (valid && maxWeight - minWeight > 0.01) + if (maxWeight - minWeight > 0.01) { for (int i = 0; i < weigth.Length; i++) _ToneWeigth[i] = weigth[i]; diff --git a/Vocaluxe/Base/CTheme.cs b/Vocaluxe/Base/CTheme.cs index be7fd8f9..c730d1d4 100644 --- a/Vocaluxe/Base/CTheme.cs +++ b/Vocaluxe/Base/CTheme.cs @@ -197,9 +197,7 @@ namespace Vocaluxe.Base try { xmlReader.GetValue("//root/Videos/" + _Skins[skinIndex].VideoList[i].Name, out value, String.Empty); - SSkinElement sk = new SSkinElement(); - sk.Name = _Skins[skinIndex].VideoList[i].Name; - sk.Value = value; + SSkinElement sk = new SSkinElement {Name = _Skins[skinIndex].VideoList[i].Name, Value = value}; sk.VideoIndex = CVideo.VdLoad(Path.Combine(_Skins[skinIndex].Path, sk.Value)); CVideo.VdSetLoop(sk.VideoIndex, true); CVideo.VdPause(sk.VideoIndex); @@ -406,7 +404,7 @@ namespace Vocaluxe.Base _Themes.Clear(); string path = Path.Combine(Directory.GetCurrentDirectory(), CSettings.FolderThemes); - List files = CHelper.ListFiles(path, "*.xml", false); + List files = CHelper.ListFiles(path, "*.xml"); foreach (string file in files) AddTheme(Path.Combine(path, file), -1); @@ -477,7 +475,7 @@ namespace Vocaluxe.Base STheme theme = _Themes[themeIndex]; string path = Path.Combine(theme.Path, theme.SkinFolder); - List files = CHelper.ListFiles(path, "*.xml", false); + List files = CHelper.ListFiles(path, "*.xml"); foreach (string file in files) { @@ -508,9 +506,7 @@ namespace Vocaluxe.Base List names = xmlReader.GetValues("Skins"); foreach (string str in names) { - SSkinElement sk = new SSkinElement(); - sk.Name = str; - sk.Value = String.Empty; + SSkinElement sk = new SSkinElement {Name = str, Value = String.Empty}; skin.SkinList[str] = sk; } @@ -518,9 +514,7 @@ namespace Vocaluxe.Base names = xmlReader.GetValues("Videos"); foreach (string str in names) { - SSkinElement sk = new SSkinElement(); - sk.Name = str; - sk.Value = String.Empty; + SSkinElement sk = new SSkinElement {Name = str, Value = String.Empty}; skin.VideoList.Add(sk); } _Skins.Add(skin); @@ -711,9 +705,8 @@ namespace Vocaluxe.Base int i = 1; while (xmlReader.TryGetFloatValue("//root/Colors/Player" + i + "/R", ref value)) { - SColorF color = new SColorF(); + SColorF color = new SColorF {R = value}; - color.R = value; xmlReader.TryGetFloatValue("//root/Colors/Player" + i + "/G", ref color.G); xmlReader.TryGetFloatValue("//root/Colors/Player" + i + "/B", ref color.B); xmlReader.TryGetFloatValue("//root/Colors/Player" + i + "/A", ref color.A); @@ -728,8 +721,7 @@ namespace Vocaluxe.Base List names = xmlReader.GetValues("ColorSchemes"); foreach (string str in names) { - SColorScheme scheme = new SColorScheme(); - scheme.Name = str; + SColorScheme scheme = new SColorScheme {Name = str}; xmlReader.TryGetFloatValue("//root/ColorSchemes/" + str + "/R", ref scheme.Color.R); xmlReader.TryGetFloatValue("//root/ColorSchemes/" + str + "/G", ref scheme.Color.G); diff --git a/Vocaluxe/Base/CUtility.cs b/Vocaluxe/Base/CUtility.cs index ce357ea9..9dbce203 100644 --- a/Vocaluxe/Base/CUtility.cs +++ b/Vocaluxe/Base/CUtility.cs @@ -158,10 +158,7 @@ namespace Vocaluxe.Base if (!_Timer.IsRunning || (_Timer.ElapsedMilliseconds > 75) || !repeat) { _Keys = e.KeyCode; - if (repeat) - _Add(_ModAlt, _ModShift, _ModCtrl, _KeyPressed, _Char, _Keys); - else - _Add(_ModAlt, _ModShift, _ModCtrl, _KeyPressed, Char.MinValue, _Keys); + _Add(_ModAlt, _ModShift, _ModCtrl, _KeyPressed, repeat ? _Char : Char.MinValue, _Keys); } } diff --git a/Vocaluxe/Base/CVideo.cs b/Vocaluxe/Base/CVideo.cs index 9f7d9098..db7390fb 100644 --- a/Vocaluxe/Base/CVideo.cs +++ b/Vocaluxe/Base/CVideo.cs @@ -176,8 +176,7 @@ namespace Vocaluxe.Base float videoTime = _VideoTimer.ElapsedMilliseconds / 1000f; _Finished = CVideo.VdFinished(_VideoStream); - STexture tex = new STexture(-1); - tex.Height = 0f; + STexture tex = new STexture(-1) {Height = 0f}; CVideo.VdGetFrame(_VideoStream, ref tex, videoTime, out videoTime); if (tex.Height > 0) diff --git a/Vocaluxe/Lib/Draw/CDrawWinForm.cs b/Vocaluxe/Lib/Draw/CDrawWinForm.cs index 9f0c1006..7c9b83bb 100644 --- a/Vocaluxe/Lib/Draw/CDrawWinForm.cs +++ b/Vocaluxe/Lib/Draw/CDrawWinForm.cs @@ -359,15 +359,9 @@ namespace Vocaluxe.Lib.Draw { Bitmap bmp2 = new Bitmap(bmp); _Bitmaps.Add(bmp2); - STexture texture = new STexture(); - - texture.Index = _Bitmaps.Count - 1; - - texture.Width = bmp.Width; - texture.Height = bmp.Height; + STexture texture = new STexture {Index = _Bitmaps.Count - 1, Width = bmp.Width, Height = bmp.Height, Color = new SColorF(1f, 1f, 1f, 1f)}; // Add to Texture List - texture.Color = new SColorF(1f, 1f, 1f, 1f); texture.Rect = new SRectF(0f, 0f, texture.Width, texture.Height, 0f); texture.TexturePath = String.Empty; @@ -512,12 +506,7 @@ namespace Vocaluxe.Lib.Draw using (Graphics g = Graphics.FromImage(newBitmap)) { - ColorMatrix cm = new ColorMatrix(); - cm.Matrix33 = color.A; - cm.Matrix00 = color.R; - cm.Matrix11 = color.G; - cm.Matrix22 = color.B; - cm.Matrix44 = 1; + ColorMatrix cm = new ColorMatrix {Matrix33 = color.A, Matrix00 = color.R, Matrix11 = color.G, Matrix22 = color.B, Matrix44 = 1}; using (ImageAttributes ia = new ImageAttributes()) { diff --git a/Vocaluxe/Lib/Playlist/CPlaylistFile.cs b/Vocaluxe/Lib/Playlist/CPlaylistFile.cs index 58d57c00..08593a50 100644 --- a/Vocaluxe/Lib/Playlist/CPlaylistFile.cs +++ b/Vocaluxe/Lib/Playlist/CPlaylistFile.cs @@ -154,8 +154,7 @@ namespace Vocaluxe.Lib.Playlist xmlReader.GetValue("//root/Songs/" + song + "/Title", out title, String.Empty); xmlReader.TryGetEnumValue("//root/Songs/" + song + "/GameMode", ref gm); - CPlaylistSong playlistSong = new CPlaylistSong(); - playlistSong.SongID = -1; + CPlaylistSong playlistSong = new CPlaylistSong {SongID = -1}; CSong[] allSongs = CSongs.AllSongs; foreach (CSong curSong in allSongs) @@ -181,21 +180,14 @@ namespace Vocaluxe.Lib.Playlist public void AddSong(int songID) { - CPlaylistSong song = new CPlaylistSong(); - song.SongID = songID; - if (CSongs.GetSong(songID).IsDuet) - song.GameMode = EGameMode.TR_GAMEMODE_DUET; - else - song.GameMode = EGameMode.TR_GAMEMODE_NORMAL; + CPlaylistSong song = new CPlaylistSong {SongID = songID, GameMode = CSongs.GetSong(songID).IsDuet ? EGameMode.TR_GAMEMODE_DUET : EGameMode.TR_GAMEMODE_NORMAL}; Songs.Add(song); } public void AddSong(int songID, EGameMode gm) { - CPlaylistSong song = new CPlaylistSong(); - song.SongID = songID; - song.GameMode = gm; + CPlaylistSong song = new CPlaylistSong {SongID = songID, GameMode = gm}; Songs.Add(song); } diff --git a/Vocaluxe/Lib/Sound/CDirectSoundRecord.cs b/Vocaluxe/Lib/Sound/CDirectSoundRecord.cs index cc38e414..a26c9003 100644 --- a/Vocaluxe/Lib/Sound/CDirectSoundRecord.cs +++ b/Vocaluxe/Lib/Sound/CDirectSoundRecord.cs @@ -55,15 +55,9 @@ namespace Vocaluxe.Lib.Sound { using (DirectSoundCapture ds = new DirectSoundCapture(dev.DriverGuid)) { - SRecordDevice device = new SRecordDevice(); - device.Driver = dev.DriverGuid.ToString(); - device.ID = id; - device.Name = dev.Description; - device.Inputs = new List(); + SRecordDevice device = new SRecordDevice {Driver = dev.DriverGuid.ToString(), ID = id, Name = dev.Description, Inputs = new List()}; - SInput inp = new SInput(); - inp.Name = "Default"; - inp.Channels = ds.Capabilities.Channels; + SInput inp = new SInput {Name = "Default", Channels = ds.Capabilities.Channels}; if (inp.Channels > 2) inp.Channels = 2; //more are not supported in vocaluxe @@ -120,8 +114,7 @@ namespace Vocaluxe.Lib.Sound { if (active[i]) { - CSoundCardSource source = new CSoundCardSource(guid[i], channels[i]); - source.SampleRateKhz = 44.1; + CSoundCardSource source = new CSoundCardSource(guid[i], channels[i]) {SampleRateKhz = 44.1}; source.SampleDataReady += _OnDataReady; source.Start(); @@ -336,9 +329,7 @@ namespace Vocaluxe.Lib.Sound for (int i = 0; i < _BufferPortionCount; i++) { - NotificationPosition notification = new NotificationPosition(); - notification.Offset = _BufferPortionCount - 1 + (_BufferPortionSize * i); - notification.Event = new AutoResetEvent(false); + NotificationPosition notification = new NotificationPosition {Offset = _BufferPortionCount - 1 + (_BufferPortionSize * i), Event = new AutoResetEvent(false)}; _Notifications.Add(notification); } @@ -348,8 +339,7 @@ namespace Vocaluxe.Lib.Sound for (int i = 0; i < _Notifications.Count; i++) _WaitHandles[i] = _Notifications[i].Event; - _CaptureThread = new Thread(_DoCapture); - _CaptureThread.IsBackground = true; + _CaptureThread = new Thread(_DoCapture) {IsBackground = true}; _Running = true; _CaptureThread.Start(); diff --git a/Vocaluxe/Lib/Sound/CPortAudioPlay.cs b/Vocaluxe/Lib/Sound/CPortAudioPlay.cs index ab6ae222..54ab8263 100644 --- a/Vocaluxe/Lib/Sound/CPortAudioPlay.cs +++ b/Vocaluxe/Lib/Sound/CPortAudioPlay.cs @@ -603,11 +603,13 @@ namespace Vocaluxe.Lib.Sound IntPtr data = new IntPtr(0); - CPortAudio.SPaStreamParameters outputParams = new CPortAudio.SPaStreamParameters(); - outputParams.ChannelCount = format.ChannelCount; - outputParams.Device = _ApiInfo.DefaultOutputDevice; - outputParams.SampleFormat = CPortAudio.EPaSampleFormat.PaInt16; - outputParams.SuggestedLatency = _OutputDeviceInfo.DefaultLowOutputLatency; + CPortAudio.SPaStreamParameters outputParams = new CPortAudio.SPaStreamParameters + { + ChannelCount = format.ChannelCount, + Device = _ApiInfo.DefaultOutputDevice, + SampleFormat = CPortAudio.EPaSampleFormat.PaInt16, + SuggestedLatency = _OutputDeviceInfo.DefaultLowOutputLatency + }; uint bufsize = (uint)CConfig.AudioBufferSize; lock (_Mutex) diff --git a/Vocaluxe/Lib/Sound/CPortAudioRecord.cs b/Vocaluxe/Lib/Sound/CPortAudioRecord.cs index 612081a8..5508dfce 100644 --- a/Vocaluxe/Lib/Sound/CPortAudioRecord.cs +++ b/Vocaluxe/Lib/Sound/CPortAudioRecord.cs @@ -73,17 +73,10 @@ namespace Vocaluxe.Lib.Sound CPortAudio.SPaDeviceInfo info = CPortAudio.PaGetDeviceInfo(i); if (info.HostApi == hostAPI && info.MaxInputChannels > 0) { - SRecordDevice dev = new SRecordDevice(); + SRecordDevice dev = new SRecordDevice {ID = i, Name = info.Name, Driver = info.Name + i, Inputs = new List()}; - dev.ID = i; - dev.Name = info.Name; - dev.Driver = info.Name + i; - dev.Inputs = new List(); + SInput inp = new SInput {Name = "Default", Channels = info.MaxInputChannels}; - SInput inp = new SInput(); - inp.Name = "Default"; - - inp.Channels = info.MaxInputChannels; if (inp.Channels > 2) inp.Channels = 2; //more are not supported in vocaluxe @@ -156,11 +149,13 @@ namespace Vocaluxe.Lib.Sound { if (active[i]) { - CPortAudio.SPaStreamParameters inputParams = new CPortAudio.SPaStreamParameters(); - inputParams.ChannelCount = _DeviceConfig[i].Inputs[0].Channels; - inputParams.Device = _DeviceConfig[i].ID; - inputParams.SampleFormat = CPortAudio.EPaSampleFormat.PaInt16; - inputParams.SuggestedLatency = CPortAudio.PaGetDeviceInfo(_DeviceConfig[i].ID).DefaultLowInputLatency; + CPortAudio.SPaStreamParameters inputParams = new CPortAudio.SPaStreamParameters + { + ChannelCount = _DeviceConfig[i].Inputs[0].Channels, + Device = _DeviceConfig[i].ID, + SampleFormat = CPortAudio.EPaSampleFormat.PaInt16, + SuggestedLatency = CPortAudio.PaGetDeviceInfo(_DeviceConfig[i].ID).DefaultLowInputLatency + }; if (_ErrorCheck("OpenStream (rec)", CPortAudio.Pa_OpenStream( out _RecHandle[i], diff --git a/Vocaluxe/Screens/CScreenCredits.cs b/Vocaluxe/Screens/CScreenCredits.cs index 4ef03bbb..c9df9ec0 100644 --- a/Vocaluxe/Screens/CScreenCredits.cs +++ b/Vocaluxe/Screens/CScreenCredits.cs @@ -291,8 +291,7 @@ namespace Vocaluxe.Screens CStatic image = GetNewStatic(texture, new SColorF(1, 1, 1, 1), new SRectF(-1, -1, 400, 120, -4)); SRectF particleRect = new SRectF(-1, -1, partRectSize, partRectSize, -6); - SRectF imgDotRect = new SRectF(particleRect); - imgDotRect.Z = -5; + SRectF imgDotRect = new SRectF(particleRect) {Z = -5}; CStatic imgDot = GetNewStatic(texDot, new SColorF(1, 1, 1, 1), imgDotRect); CParticleEffect particle = _GetStarParticles(partCount, isRight, particleRect, bigParticles); diff --git a/Vocaluxe/Screens/CScreenHighscore.cs b/Vocaluxe/Screens/CScreenHighscore.cs index 95421bda..83bfe915 100644 --- a/Vocaluxe/Screens/CScreenHighscore.cs +++ b/Vocaluxe/Screens/CScreenHighscore.cs @@ -53,9 +53,7 @@ namespace Vocaluxe.Screens { base.Init(); - List texts = new List(); - texts.Add(_TextSongName); - texts.Add(_TextSongMode); + List texts = new List {_TextSongName, _TextSongMode}; _TextNumber = new string[_NumEntrys]; for (int i = 0; i < _NumEntrys; i++) @@ -176,10 +174,7 @@ namespace Vocaluxe.Screens _Texts[_TextScore[p]].Text = _Scores[_Round][_Pos + p].Score.ToString("00000"); _Texts[_TextDate[p]].Text = _Scores[_Round][_Pos + p].Date; - if (_IsNewEntry(_Scores[_Round][_Pos + p].ID)) - _ParticleEffects[_ParticleEffectNew[p]].Visible = true; - else - _ParticleEffects[_ParticleEffectNew[p]].Visible = false; + _ParticleEffects[_ParticleEffectNew[p]].Visible = _IsNewEntry(_Scores[_Round][_Pos + p].ID); } else { diff --git a/Vocaluxe/Screens/CScreenNames.cs b/Vocaluxe/Screens/CScreenNames.cs index 70cfaa8d..c34fdae3 100644 --- a/Vocaluxe/Screens/CScreenNames.cs +++ b/Vocaluxe/Screens/CScreenNames.cs @@ -76,8 +76,7 @@ namespace Vocaluxe.Screens statics.Add(_StaticWarningProfiles); _ThemeStatics = statics.ToArray(); - List texts = new List(); - texts.Add(_SelectSlidePlayerNumber); + List texts = new List {_SelectSlidePlayerNumber}; texts.AddRange(_SelectSlideDuetPlayer); _ThemeSelectSlides = texts.ToArray(); @@ -597,16 +596,10 @@ namespace Vocaluxe.Screens if (CGame.GetNumSongs() == 1 && CGame.GetSong(1).IsDuet) { _SelectSlides[_SelectSlideDuetPlayer[i]].Clear(); - if (i + 1 <= CGame.NumPlayer) - _SelectSlides[_SelectSlideDuetPlayer[i]].Visible = true; - else - _SelectSlides[_SelectSlideDuetPlayer[i]].Visible = false; + _SelectSlides[_SelectSlideDuetPlayer[i]].Visible = i + 1 <= CGame.NumPlayer; _SelectSlides[_SelectSlideDuetPlayer[i]].AddValue(CGame.GetSong(1).DuetPart1); _SelectSlides[_SelectSlideDuetPlayer[i]].AddValue(CGame.GetSong(1).DuetPart2); - if ((i + 1) % 2 == 0) - _SelectSlides[_SelectSlideDuetPlayer[i]].Selection = 1; - else - _SelectSlides[_SelectSlideDuetPlayer[i]].Selection = 0; + _SelectSlides[_SelectSlideDuetPlayer[i]].Selection = i % 2; } else _SelectSlides[_SelectSlideDuetPlayer[i]].Visible = false; diff --git a/Vocaluxe/Screens/CScreenOptionsRecord.cs b/Vocaluxe/Screens/CScreenOptionsRecord.cs index 38f12ba0..a1ced44f 100644 --- a/Vocaluxe/Screens/CScreenOptionsRecord.cs +++ b/Vocaluxe/Screens/CScreenOptionsRecord.cs @@ -75,8 +75,7 @@ namespace Vocaluxe.Screens { base.Init(); - List values = new List(); - values.Add(_StaticWarning); + List values = new List {_StaticWarning}; values.AddRange(_StaticEnergyChannel); _ThemeStatics = values.ToArray(); diff --git a/Vocaluxe/Screens/CScreenSing.cs b/Vocaluxe/Screens/CScreenSing.cs index e6434090..f8530b27 100644 --- a/Vocaluxe/Screens/CScreenSing.cs +++ b/Vocaluxe/Screens/CScreenSing.cs @@ -118,36 +118,30 @@ namespace Vocaluxe.Screens { base.Init(); - List texts = new List(); - texts.Add(_TextSongName); - texts.Add(_TextTime); - texts.Add(_TextPause); - texts.Add(_TextDuetName1); - texts.Add(_TextDuetName2); + List texts = new List {_TextSongName, _TextTime, _TextPause, _TextDuetName1, _TextDuetName2}; _BuildTextStrings(ref texts); _ThemeTexts = texts.ToArray(); - List statics = new List(); - statics.Add(_StaticSongText); - statics.Add(_StaticLyrics); - statics.Add(_StaticLyricsDuet); - statics.Add(_StaticLyricsTop); - statics.Add(_StaticTimeBar); - statics.Add(_StaticTimeLine); - statics.Add(_StaticTimeLineExpandedNormal); - statics.Add(_StaticTimeLineExpandedHighlighted); - statics.Add(_StaticTimePointer); - statics.Add(_StaticLyricHelper); - statics.Add(_StaticLyricHelperDuet); - statics.Add(_StaticLyricHelperTop); - statics.Add(_StaticPauseBG); + List statics = new List + { + _StaticSongText, + _StaticLyrics, + _StaticLyricsDuet, + _StaticLyricsTop, + _StaticTimeBar, + _StaticTimeLine, + _StaticTimeLineExpandedNormal, + _StaticTimeLineExpandedHighlighted, + _StaticTimePointer, + _StaticLyricHelper, + _StaticLyricHelperDuet, + _StaticLyricHelperTop, + _StaticPauseBG + }; _BuildStaticStrings(ref statics); _ThemeStatics = statics.ToArray(); - List buttons = new List(); - buttons.Add(_ButtonCancel); - buttons.Add(_ButtonContinue); - buttons.Add(_ButtonSkip); + List buttons = new List {_ButtonCancel, _ButtonContinue, _ButtonSkip}; _ThemeButtons = buttons.ToArray(); _ThemeLyrics = new string[] {_LyricMain, _LyricSub, _LyricMainDuet, _LyricSubDuet, _LyricMainTop, _LyricSubTop}; @@ -638,10 +632,7 @@ namespace Vocaluxe.Screens { for (int i = 0; i < CGame.NumPlayer; i++) { - if ((i % 2) == 0) - CGame.Player[i].LineNr = 1; - else - CGame.Player[i].LineNr = 0; + CGame.Player[i].LineNr = (i+1) % 2; } } else diff --git a/Vocaluxe/Screens/CScreenSong.cs b/Vocaluxe/Screens/CScreenSong.cs index 9db36407..6108ade4 100644 --- a/Vocaluxe/Screens/CScreenSong.cs +++ b/Vocaluxe/Screens/CScreenSong.cs @@ -803,10 +803,7 @@ namespace Vocaluxe.Screens gm = _AvailableGameModes[_SelectSlides[_SelectSlideOptionsMode].Selection]; else { - if (CSongs.VisibleSongs[songNr].IsDuet) - gm = EGameMode.TR_GAMEMODE_DUET; - else - gm = EGameMode.TR_GAMEMODE_NORMAL; + gm = CSongs.VisibleSongs[songNr].IsDuet ? EGameMode.TR_GAMEMODE_DUET : EGameMode.TR_GAMEMODE_NORMAL; } CGame.Reset(); @@ -823,10 +820,7 @@ namespace Vocaluxe.Screens if (CSongs.Category >= 0 && songNr >= 0 && CSongs.NumVisibleSongs > songNr) { EGameMode gm; - if (CSongs.VisibleSongs[songNr].IsDuet) - gm = EGameMode.TR_GAMEMODE_DUET; - else - gm = EGameMode.TR_GAMEMODE_NORMAL; + gm = CSongs.VisibleSongs[songNr].IsDuet ? EGameMode.TR_GAMEMODE_DUET : EGameMode.TR_GAMEMODE_NORMAL; CGame.Reset(); CGame.ClearSongs(); diff --git a/VocaluxeLib/Menu/CButton.cs b/VocaluxeLib/Menu/CButton.cs index 8a46c185..a363dc1a 100644 --- a/VocaluxeLib/Menu/CButton.cs +++ b/VocaluxeLib/Menu/CButton.cs @@ -117,11 +117,13 @@ namespace VocaluxeLib.Menu public CButton(CButton button) { _PartyModeID = button._PartyModeID; - _Theme = new SThemeButton(); - _Theme.ColorName = button._Theme.ColorName; - _Theme.SelColorName = button._Theme.SelColorName; - _Theme.TextureName = button._Theme.TextureName; - _Theme.SelTextureName = button._Theme.SelTextureName; + _Theme = new SThemeButton + { + ColorName = button._Theme.ColorName, + SelColorName = button._Theme.SelColorName, + TextureName = button._Theme.TextureName, + SelTextureName = button._Theme.SelTextureName + }; Rect = new SRectF(button.Rect); Color = new SColorF(button.Color); @@ -303,10 +305,7 @@ namespace VocaluxeLib.Menu if (!Selected && !Pressed || !Enabled) { - if (Texture.Index != -1) - texture = Texture; - else - texture = CBase.Theme.GetSkinTexture(_Theme.TextureName, _PartyModeID); + texture = Texture.Index != -1 ? Texture : CBase.Theme.GetSkinTexture(_Theme.TextureName, _PartyModeID); CBase.Drawing.DrawTexture(texture, Rect, Color); @@ -320,10 +319,7 @@ namespace VocaluxeLib.Menu } else if (!IsSelText) { - if (Texture.Index != -1) - texture = Texture; - else - texture = CBase.Theme.GetSkinTexture(_Theme.SelTextureName, _PartyModeID); + texture = Texture.Index != -1 ? Texture : CBase.Theme.GetSkinTexture(_Theme.SelTextureName, _PartyModeID); CBase.Drawing.DrawTexture(texture, Rect, SelColor); @@ -337,10 +333,7 @@ namespace VocaluxeLib.Menu } else if (IsSelText) { - if (SelTexture.Index != -1) - texture = SelTexture; - else - texture = CBase.Theme.GetSkinTexture(_Theme.SelTextureName, _PartyModeID); + texture = SelTexture.Index != -1 ? SelTexture : CBase.Theme.GetSkinTexture(_Theme.SelTextureName, _PartyModeID); CBase.Drawing.DrawTexture(texture, Rect, SelColor); diff --git a/VocaluxeLib/Menu/CNameSelection.cs b/VocaluxeLib/Menu/CNameSelection.cs index f3b34313..5ed4a934 100644 --- a/VocaluxeLib/Menu/CNameSelection.cs +++ b/VocaluxeLib/Menu/CNameSelection.cs @@ -106,10 +106,10 @@ namespace VocaluxeLib.Menu { _PrepareTiles(); - _PlayerSelector = new CStatic(_PartyModeID); - _PlayerSelector.Texture = _TextureTileSelected; - _PlayerSelector.Rect = new SRectF(0, 0, _TileW + 6, _TileH + 6, Rect.Z - 0.5f); - _PlayerSelector.Visible = false; + _PlayerSelector = new CStatic(_PartyModeID) { + Texture = _TextureTileSelected, + Rect = new SRectF(0, 0, _TileW + 6, _TileH + 6, Rect.Z - 0.5f), + Visible = false}; _UpdateVisibleProfiles(); diff --git a/VocaluxeLib/Menu/CObjectInteractions.cs b/VocaluxeLib/Menu/CObjectInteractions.cs index 1dd503ef..1aafbb94 100644 --- a/VocaluxeLib/Menu/CObjectInteractions.cs +++ b/VocaluxeLib/Menu/CObjectInteractions.cs @@ -320,9 +320,7 @@ namespace VocaluxeLib.Menu _Interactions[i].Type == EType.SongMenu || _Interactions[i].Type == EType.Equalizer)) { - SZSort zs = new SZSort(); - zs.ID = i; - zs.Z = _GetZValue(i); + SZSort zs = new SZSort {ID = i, Z = _GetZValue(i)}; items.Add(zs); } } @@ -331,7 +329,7 @@ namespace VocaluxeLib.Menu return; - items.Sort(delegate(SZSort s1, SZSort s2) { return s2.Z.CompareTo(s1.Z); }); + items.Sort((s1, s2) => s2.Z.CompareTo(s1.Z)); for (int i = 0; i < items.Count; i++) _DrawInteraction(items[i].ID); diff --git a/VocaluxeLib/Menu/CPlaylist.cs b/VocaluxeLib/Menu/CPlaylist.cs index 367f9ec9..73063abf 100644 --- a/VocaluxeLib/Menu/CPlaylist.cs +++ b/VocaluxeLib/Menu/CPlaylist.cs @@ -203,17 +203,19 @@ namespace VocaluxeLib.Menu public CPlaylist(int partyModeID) { _PartyModeID = partyModeID; - _Theme = new SThemePlaylist(); - _Theme.Text1 = new CText(_PartyModeID); - _Theme.StaticCover = new CStatic(_PartyModeID); - _Theme.StaticPlaylistFooter = new CStatic(_PartyModeID); - _Theme.StaticPlaylistHeader = new CStatic(_PartyModeID); - _Theme.ButtonPlaylistName = new CButton(_PartyModeID); - _Theme.ButtonPlaylistClose = new CButton(_PartyModeID); - _Theme.ButtonPlaylistDelete = new CButton(_PartyModeID); - _Theme.ButtonPlaylistSave = new CButton(_PartyModeID); - _Theme.ButtonPlaylistSing = new CButton(_PartyModeID); - _Theme.SelectSlideGameMode = new CSelectSlide(_PartyModeID); + _Theme = new SThemePlaylist + { + Text1 = new CText(_PartyModeID), + StaticCover = new CStatic(_PartyModeID), + StaticPlaylistFooter = new CStatic(_PartyModeID), + StaticPlaylistHeader = new CStatic(_PartyModeID), + ButtonPlaylistName = new CButton(_PartyModeID), + ButtonPlaylistClose = new CButton(_PartyModeID), + ButtonPlaylistDelete = new CButton(_PartyModeID), + ButtonPlaylistSave = new CButton(_PartyModeID), + ButtonPlaylistSing = new CButton(_PartyModeID), + SelectSlideGameMode = new CSelectSlide(_PartyModeID) + }; CompleteRect = new SRectF(); Rect = new SRectF(); @@ -626,8 +628,7 @@ namespace VocaluxeLib.Menu CBase.Playlist.MovePlaylistSongUp(ActivePlaylistID, CurrentPlaylistElement + Offset); UpdatePlaylist(); - SKeyEvent key = new SKeyEvent(); - key.Key = Keys.Up; + SKeyEvent key = new SKeyEvent {Key = Keys.Up}; if (CurrentPlaylistElement > scrollLimit) { @@ -656,8 +657,7 @@ namespace VocaluxeLib.Menu CBase.Playlist.MovePlaylistSongDown(ActivePlaylistID, CurrentPlaylistElement + Offset); UpdatePlaylist(); - SKeyEvent key = new SKeyEvent(); - key.Key = Keys.Down; + SKeyEvent key = new SKeyEvent {Key = Keys.Down}; if (CurrentPlaylistElement >= scrollLimit) { @@ -795,10 +795,7 @@ namespace VocaluxeLib.Menu return; int off = _PlaylistElementContents.Count - _PlaylistElements.Count; - if (off >= 0) - Offset = off; - else - Offset = 0; + Offset = off >= 0 ? off : 0; Update(); @@ -839,10 +836,7 @@ namespace VocaluxeLib.Menu return; int off = _PlaylistElementContents.Count - _PlaylistElements.Count; - if (off >= 0) - Offset = off; - else - Offset = 0; + Offset = off >= 0 ? off : 0; Update(); } @@ -1100,12 +1094,13 @@ namespace VocaluxeLib.Menu for (int i = 0; i < Math.Floor(Rect.H / _Theme.EntryHeight); i++) { - CPlaylistElement en = new CPlaylistElement(); + CPlaylistElement en = new CPlaylistElement + { + Background = new CStatic(_PartyModeID, _Theme.TextureBackgroundName, BackgroundColor, + new SRectF(Rect.X, Rect.Y + (i * _Theme.EntryHeight), Rect.W, _Theme.EntryHeight, Rect.Z)), + Cover = new CStatic(_Theme.StaticCover) + }; - en.Background = new CStatic(_PartyModeID, _Theme.TextureBackgroundName, BackgroundColor, - new SRectF(Rect.X, Rect.Y + (i * _Theme.EntryHeight), Rect.W, _Theme.EntryHeight, Rect.Z)); - - en.Cover = new CStatic(_Theme.StaticCover); en.Cover.Rect.Y += Rect.Y + (i * _Theme.EntryHeight); en.Cover.Rect.X += Rect.X; @@ -1140,10 +1135,12 @@ namespace VocaluxeLib.Menu _PlaylistElementContents.Clear(); for (int i = 0; i < CBase.Playlist.GetPlaylistSongCount(ActivePlaylistID); i++) { - CPlaylistElementContent pec = new CPlaylistElementContent(); - pec.SongID = CBase.Playlist.GetPlaylistSong(ActivePlaylistID, i).SongID; - pec.Modes = CBase.Songs.GetSongByID(CBase.Playlist.GetPlaylistSong(ActivePlaylistID, i).SongID).AvailableGameModes; - pec.Mode = CBase.Playlist.GetPlaylistSong(ActivePlaylistID, i).GameMode; + CPlaylistElementContent pec = new CPlaylistElementContent + { + SongID = CBase.Playlist.GetPlaylistSong(ActivePlaylistID, i).SongID, + Modes = CBase.Songs.GetSongByID(CBase.Playlist.GetPlaylistSong(ActivePlaylistID, i).SongID).AvailableGameModes, + Mode = CBase.Playlist.GetPlaylistSong(ActivePlaylistID, i).GameMode + }; _PlaylistElementContents.Add(pec); } Update(); @@ -1157,8 +1154,7 @@ namespace VocaluxeLib.Menu _PlaylistElementContents.Clear(); for (int i = 0; i < CBase.Playlist.GetPlaylistSongCount(ActivePlaylistID); i++) { - CPlaylistElementContent pec = new CPlaylistElementContent(); - pec.SongID = CBase.Playlist.GetPlaylistSong(ActivePlaylistID, i).SongID; + CPlaylistElementContent pec = new CPlaylistElementContent {SongID = CBase.Playlist.GetPlaylistSong(ActivePlaylistID, i).SongID}; pec.Modes = CBase.Songs.GetSongByID(pec.SongID).AvailableGameModes; pec.Mode = CBase.Playlist.GetPlaylistSong(ActivePlaylistID, i).GameMode; _PlaylistElementContents.Add(pec); diff --git a/VocaluxeLib/Menu/CSelectSlide.cs b/VocaluxeLib/Menu/CSelectSlide.cs index 792fdc25..a79d9e93 100644 --- a/VocaluxeLib/Menu/CSelectSlide.cs +++ b/VocaluxeLib/Menu/CSelectSlide.cs @@ -187,29 +187,24 @@ namespace VocaluxeLib.Menu public CSelectSlide(CSelectSlide slide) { _PartyModeID = slide._PartyModeID; - _Theme = new SThemeSelectSlide(); - - _Theme.TextureArrowLeftName = slide._Theme.TextureArrowLeftName; - _Theme.TextureArrowRightName = slide._Theme.TextureArrowRightName; - - _Theme.SelTextureName = slide._Theme.SelTextureName; - _Theme.SelTextureArrowLeftName = slide._Theme.SelTextureArrowLeftName; - _Theme.SelTextureArrowRightName = slide._Theme.SelTextureArrowRightName; - - _Theme.HighlightTextureName = slide._Theme.HighlightTextureName; - - _Theme.ColorName = slide._Theme.ColorName; - _Theme.SelColorName = slide._Theme.SelColorName; - _Theme.HighlightColorName = slide._Theme.HighlightColorName; - - _Theme.ArrowColorName = slide._Theme.ArrowColorName; - _Theme.SelArrowColorName = slide._Theme.SelArrowColorName; - - _Theme.TextColorName = slide._Theme.TextColorName; - _Theme.SelTextColorName = slide._Theme.SelTextColorName; - - _Theme.TextFont = slide._Theme.TextFont; - _Theme.TextStyle = slide._Theme.TextStyle; + _Theme = new SThemeSelectSlide + { + TextureArrowLeftName = slide._Theme.TextureArrowLeftName, + TextureArrowRightName = slide._Theme.TextureArrowRightName, + SelTextureName = slide._Theme.SelTextureName, + SelTextureArrowLeftName = slide._Theme.SelTextureArrowLeftName, + SelTextureArrowRightName = slide._Theme.SelTextureArrowRightName, + HighlightTextureName = slide._Theme.HighlightTextureName, + ColorName = slide._Theme.ColorName, + SelColorName = slide._Theme.SelColorName, + HighlightColorName = slide._Theme.HighlightColorName, + ArrowColorName = slide._Theme.ArrowColorName, + SelArrowColorName = slide._Theme.SelArrowColorName, + TextColorName = slide._Theme.TextColorName, + SelTextColorName = slide._Theme.SelTextColorName, + TextFont = slide._Theme.TextFont, + TextStyle = slide._Theme.TextStyle + }; _ThemeLoaded = false; diff --git a/VocaluxeLib/Menu/CStatic.cs b/VocaluxeLib/Menu/CStatic.cs index 39ed21d7..78827930 100644 --- a/VocaluxeLib/Menu/CStatic.cs +++ b/VocaluxeLib/Menu/CStatic.cs @@ -121,8 +121,7 @@ namespace VocaluxeLib.Menu public CStatic(int partyModeID, string textureSkinName, SColorF color, SRectF rect) { _PartyModeID = partyModeID; - _Theme = new SThemeStatic(); - _Theme.TextureName = textureSkinName; + _Theme = new SThemeStatic {TextureName = textureSkinName}; _ThemeLoaded = false; _Texture = new STexture(-1); @@ -244,11 +243,7 @@ namespace VocaluxeLib.Menu public void Draw(float scale, float z, EAspect aspect, bool forceDraw) { - STexture texture; - if (_Texture.Index != -1) - texture = _Texture; - else - texture = CBase.Theme.GetSkinTexture(_Theme.TextureName, _PartyModeID); + STexture texture = _Texture.Index != -1 ? _Texture : CBase.Theme.GetSkinTexture(_Theme.TextureName, _PartyModeID); SRectF bounds = new SRectF( Rect.X - Rect.W * (scale - 1f), diff --git a/VocaluxeLib/Menu/CText.cs b/VocaluxeLib/Menu/CText.cs index 0edc1510..bddbede2 100644 --- a/VocaluxeLib/Menu/CText.cs +++ b/VocaluxeLib/Menu/CText.cs @@ -577,10 +577,7 @@ namespace VocaluxeLib.Menu writer.WriteElementString("Font", Font); writer.WriteComment(": Nothing or translation tag"); - if (CBase.Language.TranslationExists(_Theme.Text)) - writer.WriteElementString("Text", _Theme.Text); - else - writer.WriteElementString("Text", string.Empty); + writer.WriteElementString("Text", CBase.Language.TranslationExists(_Theme.Text) ? _Theme.Text : string.Empty); if (!_ButtonText) { diff --git a/VocaluxeLib/Menu/SingNotes/CNotes.cs b/VocaluxeLib/Menu/SingNotes/CNotes.cs index f2308693..7c7413ba 100644 --- a/VocaluxeLib/Menu/SingNotes/CNotes.cs +++ b/VocaluxeLib/Menu/SingNotes/CNotes.cs @@ -678,8 +678,7 @@ namespace VocaluxeLib.Menu.SingNotes if (lineIndex < 0) { //Note is before ALL lines - CLine line = new CLine(); - line.StartBeat = note.StartBeat; + CLine line = new CLine {StartBeat = note.StartBeat}; line.AddNote(note); _Lines.Insert(0, line); } diff --git a/VocaluxeLib/Menu/SingNotes/CSingNotes.cs b/VocaluxeLib/Menu/SingNotes/CSingNotes.cs index 79a8d87a..9e254aee 100644 --- a/VocaluxeLib/Menu/SingNotes/CSingNotes.cs +++ b/VocaluxeLib/Menu/SingNotes/CSingNotes.cs @@ -397,8 +397,7 @@ namespace VocaluxeLib.Menu.SingNotes if (note.EndBeat >= CBase.Game.GetCurrentBeatD() && note.Hit && note.NoteType == ENoteType.Golden) { - SRectF re = new SRectF(rect); - re.W = (CBase.Game.GetMidBeatD() - note.StartBeat) / beats * w; + SRectF re = new SRectF(rect) {W = (CBase.Game.GetMidBeatD() - note.StartBeat) / beats * w}; _AddFlare(re, n); } diff --git a/VocaluxeLib/Menu/SongMenu/CSong.cs b/VocaluxeLib/Menu/SongMenu/CSong.cs index d7931f16..f0e14732 100644 --- a/VocaluxeLib/Menu/SongMenu/CSong.cs +++ b/VocaluxeLib/Menu/SongMenu/CSong.cs @@ -217,17 +217,13 @@ namespace VocaluxeLib.Menu.SongMenu public List Language = new List(); // Notes - public CNotes Notes = new CNotes(); + public readonly CNotes Notes = new CNotes(); public EGameMode[] AvailableGameModes { get { - List gms = new List(); - if (IsDuet) - gms.Add(EGameMode.TR_GAMEMODE_DUET); - else - gms.Add(EGameMode.TR_GAMEMODE_NORMAL); + List gms = new List {IsDuet ? EGameMode.TR_GAMEMODE_DUET : EGameMode.TR_GAMEMODE_NORMAL}; if (Medley.Source != EMedleySource.None) gms.Add(EGameMode.TR_GAMEMODE_MEDLEY); gms.Add(EGameMode.TR_GAMEMODE_SHORTSONG); @@ -250,12 +246,14 @@ namespace VocaluxeLib.Menu.SongMenu _CoverTextureSmall = song._CoverTextureSmall; _CoverTextureBig = song._CoverTextureBig; - Medley = new SMedley(); - Medley.Source = song.Medley.Source; - Medley.StartBeat = song.Medley.StartBeat; - Medley.EndBeat = song.Medley.EndBeat; - Medley.FadeInTime = song.Medley.FadeInTime; - Medley.FadeOutTime = song.Medley.FadeOutTime; + Medley = new SMedley + { + Source = song.Medley.Source, + StartBeat = song.Medley.StartBeat, + EndBeat = song.Medley.EndBeat, + FadeInTime = song.Medley.FadeInTime, + FadeOutTime = song.Medley.FadeOutTime + }; CalculateMedley = song.CalculateMedley; PreviewStart = song.PreviewStart; @@ -806,8 +804,7 @@ namespace VocaluxeLib.Menu.SongMenu private void _NewSentence(int player, int start) { CLines lines = Notes.GetLines(player); - CLine line = new CLine(); - line.StartBeat = start; + CLine line = new CLine {StartBeat = start}; lines.AddLine(line); } @@ -830,8 +827,8 @@ namespace VocaluxeLib.Menu.SongMenu { if (CoverFileName == "") { - List files = CHelper.ListFiles(Folder, "*.jpg", false); - files.AddRange(CHelper.ListFiles(Folder, "*.png", false)); + List files = CHelper.ListFiles(Folder, "*.jpg"); + files.AddRange(CHelper.ListFiles(Folder, "*.png")); foreach (String file in files) { if (Regex.IsMatch(file, @".[CO].", RegexOptions.IgnoreCase) && @@ -842,8 +839,8 @@ namespace VocaluxeLib.Menu.SongMenu if (BackgroundFileName == "") { - List files = CHelper.ListFiles(Folder, "*.jpg", false); - files.AddRange(CHelper.ListFiles(Folder, "*.png", false)); + List files = CHelper.ListFiles(Folder, "*.jpg"); + files.AddRange(CHelper.ListFiles(Folder, "*.png")); foreach (String file in files) { if (Regex.IsMatch(file, @".[BG].", RegexOptions.IgnoreCase) && @@ -885,10 +882,7 @@ namespace VocaluxeLib.Menu.SongMenu List sentences = new List(); foreach (CLine line in lines.Line) { - if (line.Points != 0) - sentences.Add(line.Lyrics); - else - sentences.Add(String.Empty); + sentences.Add(line.Points != 0 ? line.Lyrics : String.Empty); } // find equal sentences series diff --git a/VocaluxeLib/Menu/SongMenu/CSongMenuFramework.cs b/VocaluxeLib/Menu/SongMenu/CSongMenuFramework.cs index 59a22604..2fa3ed64 100644 --- a/VocaluxeLib/Menu/SongMenu/CSongMenuFramework.cs +++ b/VocaluxeLib/Menu/SongMenu/CSongMenuFramework.cs @@ -237,18 +237,21 @@ namespace VocaluxeLib.Menu.SongMenu public CSongMenuFramework(int partyModeID) { _PartyModeID = partyModeID; - _Theme = new SThemeSongMenu(); - - _Theme.SongMenuTileBoard.TextArtist = new CText(_PartyModeID); - _Theme.SongMenuTileBoard.TextTitle = new CText(_PartyModeID); - _Theme.SongMenuTileBoard.TextSongLength = new CText(_PartyModeID); - - _Theme.SongMenuTileBoard.StaticCoverBig = new CStatic(_PartyModeID); - _Theme.SongMenuTileBoard.StaticTextBG = new CStatic(_PartyModeID); - _Theme.SongMenuTileBoard.StaticDuetIcon = new CStatic(_PartyModeID); - _Theme.SongMenuTileBoard.StaticVideoIcon = new CStatic(_PartyModeID); - _Theme.SongMenuTileBoard.StaticMedleyCalcIcon = new CStatic(_PartyModeID); - _Theme.SongMenuTileBoard.StaticMedleyTagIcon = new CStatic(_PartyModeID); + _Theme = new SThemeSongMenu + { + SongMenuTileBoard = + { + TextArtist = new CText(_PartyModeID), + TextTitle = new CText(_PartyModeID), + TextSongLength = new CText(_PartyModeID), + StaticCoverBig = new CStatic(_PartyModeID), + StaticTextBG = new CStatic(_PartyModeID), + StaticDuetIcon = new CStatic(_PartyModeID), + StaticVideoIcon = new CStatic(_PartyModeID), + StaticMedleyCalcIcon = new CStatic(_PartyModeID), + StaticMedleyTagIcon = new CStatic(_PartyModeID) + } + }; _ThemeLoaded = false; } diff --git a/VocaluxeLib/PartyModes/CPartyMode.cs b/VocaluxeLib/PartyModes/CPartyMode.cs index c78b9565..de9c9b7a 100644 --- a/VocaluxeLib/PartyModes/CPartyMode.cs +++ b/VocaluxeLib/PartyModes/CPartyMode.cs @@ -26,16 +26,12 @@ namespace VocaluxeLib.PartyModes public abstract class CPartyMode : IPartyMode { protected SScreenSongOptions _ScreenSongOptions; - protected Dictionary _Screens; - protected string _Folder; + protected readonly Dictionary _Screens; public CPartyMode() { _Screens = new Dictionary(); - _Folder = String.Empty; - _ScreenSongOptions = new SScreenSongOptions(); - _ScreenSongOptions.Selection = new SSelectionOptions(); - _ScreenSongOptions.Sorting = new SSortingOptions(); + _ScreenSongOptions = new SScreenSongOptions {Selection = new SSelectionOptions(), Sorting = new SSortingOptions()}; } #region Implementation From f53e08607ba71b20e070b24e91ff56d7d0b88511 Mon Sep 17 00:00:00 2001 From: Flamefire Date: Tue, 23 Apr 2013 22:14:53 +0200 Subject: [PATCH 14/27] Small cleanup (join declarations) --- .../PartyModeChallengeMedley/CChallengeRounds.cs | 4 ++-- Vocaluxe/Base/CDataBase.cs | 2 +- Vocaluxe/Base/CGraphics.cs | 3 +-- Vocaluxe/Base/CLanguage.cs | 4 ++-- Vocaluxe/Base/CMain.cs | 12 ++++++------ Vocaluxe/Base/CPlaylists.cs | 6 +++--- Vocaluxe/Base/CProfiles.cs | 2 +- Vocaluxe/Lib/Sound/CDirectSoundRecord.cs | 3 +-- Vocaluxe/Screens/CScreenCredits.cs | 11 ++++------- Vocaluxe/Screens/CScreenSong.cs | 3 +-- VocaluxeLib/Menu/CMenuParty.cs | 2 +- VocaluxeLib/Menu/CSelectSlide.cs | 2 +- VocaluxeLib/Menu/CXMLReader.cs | 5 ++--- VocaluxeLib/Menu/IMenu.cs | 2 +- VocaluxeLib/Menu/SingNotes/CNotes.cs | 6 +++--- VocaluxeLib/Menu/SingNotes/CSingNotes.cs | 2 +- VocaluxeLib/Menu/SongMenu/CSongMenuFramework.cs | 2 +- VocaluxeLib/PartyModes/CPartyMode.cs | 2 +- 18 files changed, 33 insertions(+), 40 deletions(-) diff --git a/PartyModes/PartyModeChallengeMedley/CChallengeRounds.cs b/PartyModes/PartyModeChallengeMedley/CChallengeRounds.cs index ea149cdc..7b6310c1 100644 --- a/PartyModes/PartyModeChallengeMedley/CChallengeRounds.cs +++ b/PartyModes/PartyModeChallengeMedley/CChallengeRounds.cs @@ -237,7 +237,7 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley return false; } - public bool IsAvailableAll(List playerIndices) + public bool IsAvailableAll(IEnumerable playerIndices) { bool result = true; foreach (int p in playerIndices) @@ -245,7 +245,7 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley return result; } - public bool IsAvailableSomeone(List playerIndices) + public bool IsAvailableSomeone(IEnumerable playerIndices) { bool result = false; foreach (int p in playerIndices) diff --git a/Vocaluxe/Base/CDataBase.cs b/Vocaluxe/Base/CDataBase.cs index b130d5e4..d44dce78 100644 --- a/Vocaluxe/Base/CDataBase.cs +++ b/Vocaluxe/Base/CDataBase.cs @@ -1415,10 +1415,10 @@ namespace Vocaluxe.Base { const int chunkSize = 2 * 1024; byte[] buffer = new byte[chunkSize]; - long bytesRead; long fieldOffset = 0; using (MemoryStream stream = new MemoryStream()) { + long bytesRead; while ((bytesRead = reader.GetBytes(0, fieldOffset, buffer, 0, buffer.Length)) > 0) { byte[] actualRead = new byte[bytesRead]; diff --git a/Vocaluxe/Base/CGraphics.cs b/Vocaluxe/Base/CGraphics.cs index 5f9f3078..eff9e0c4 100644 --- a/Vocaluxe/Base/CGraphics.cs +++ b/Vocaluxe/Base/CGraphics.cs @@ -794,8 +794,7 @@ namespace Vocaluxe.Base if (CTheme.Cursor.Color != "") { - SColorF color; - color = CTheme.GetColor(CTheme.Cursor.Color, -1); + SColorF color = CTheme.GetColor(CTheme.Cursor.Color, -1); CTheme.Cursor.R = color.R; CTheme.Cursor.G = color.G; CTheme.Cursor.B = color.B; diff --git a/Vocaluxe/Base/CLanguage.cs b/Vocaluxe/Base/CLanguage.cs index 00b2d6e5..c9024d67 100644 --- a/Vocaluxe/Base/CLanguage.cs +++ b/Vocaluxe/Base/CLanguage.cs @@ -63,7 +63,7 @@ namespace Vocaluxe.Base return _Languages[lang].Name; } - public static string[] GetLanguageNames() + public static IEnumerable GetLanguageNames() { string[] languages = new string[_Languages.Count]; @@ -179,7 +179,7 @@ namespace Vocaluxe.Base private static bool _LoadLanguageEntries(CXMLReader xmlReader, out Dictionary texts) { texts = new Dictionary(); - List names = xmlReader.GetAttributes("resources", "name"); + IEnumerable names = xmlReader.GetAttributes("resources", "name"); foreach (string name in names) { string value; diff --git a/Vocaluxe/Base/CMain.cs b/Vocaluxe/Base/CMain.cs index 0b77a945..64cbbb9c 100644 --- a/Vocaluxe/Base/CMain.cs +++ b/Vocaluxe/Base/CMain.cs @@ -27,11 +27,11 @@ namespace Vocaluxe.Base { static class CMain { - public static IConfig Config = new CBconfig(); - public static ISettings Settings = new CBsettings(); - public static ITheme Theme = new CBtheme(); - public static IBackgroundMusic BackgroundMusic = new CBbackgroundMusic(); - public static IDrawing Draw = new CBdraw(); + public static readonly IConfig Config = new CBconfig(); + public static readonly ISettings Settings = new CBsettings(); + public static readonly ITheme Theme = new CBtheme(); + public static readonly IBackgroundMusic BackgroundMusic = new CBbackgroundMusic(); + public static readonly IDrawing Draw = new CBdraw(); public static IGraphics Graphics = new CBGraphics(); public static ILog Log = new CBlog(); public static IFonts Fonts = new CBfonts(); @@ -113,7 +113,7 @@ namespace Vocaluxe.Base return CConfig.CoverSize; } - public List GetSongFolder() + public IEnumerable GetSongFolder() { return CConfig.SongFolder; } diff --git a/Vocaluxe/Base/CPlaylists.cs b/Vocaluxe/Base/CPlaylists.cs index 9fad3f43..d71bcda5 100644 --- a/Vocaluxe/Base/CPlaylists.cs +++ b/Vocaluxe/Base/CPlaylists.cs @@ -36,7 +36,7 @@ namespace Vocaluxe.Base get { return _Playlists.ToArray(); } } - public static string[] PlaylistNames + public static IEnumerable PlaylistNames { get { @@ -227,7 +227,7 @@ namespace Vocaluxe.Base private static int _CompareByPlaylistName(CPlaylistFile a, CPlaylistFile b) { - return String.Compare(a.PlaylistName, b.PlaylistName); + return System.String.CompareOrdinal(a.PlaylistName, b.PlaylistName); } private static CPlaylistFile _ConvertUSDXPlaylist(string file) @@ -237,9 +237,9 @@ namespace Vocaluxe.Base if (!File.Exists(file)) return null; - StreamReader sr; try { + StreamReader sr; using (sr = new StreamReader(file, Encoding.Default, true)) { string line; diff --git a/Vocaluxe/Base/CProfiles.cs b/Vocaluxe/Base/CProfiles.cs index 76e910d8..d69effda 100644 --- a/Vocaluxe/Base/CProfiles.cs +++ b/Vocaluxe/Base/CProfiles.cs @@ -282,7 +282,7 @@ namespace Vocaluxe.Base private static int _CompareByPlayerName(SProfile a, SProfile b) { - return String.Compare(a.PlayerName, b.PlayerName); + return System.String.CompareOrdinal(a.PlayerName, b.PlayerName); } #region private methods diff --git a/Vocaluxe/Lib/Sound/CDirectSoundRecord.cs b/Vocaluxe/Lib/Sound/CDirectSoundRecord.cs index a26c9003..746e4bca 100644 --- a/Vocaluxe/Lib/Sound/CDirectSoundRecord.cs +++ b/Vocaluxe/Lib/Sound/CDirectSoundRecord.cs @@ -383,13 +383,12 @@ namespace Vocaluxe.Lib.Sound // Buffer type must match this.waveFormat.FormatTag and this.waveFormat.BitsPerSample byte[] bufferPortion = new byte[bufferPortionSamples]; - int bufferPortionIndex; _CaptureBuffer.Start(true); while (_Running) { - bufferPortionIndex = WaitHandle.WaitAny(_WaitHandles); + int bufferPortionIndex = WaitHandle.WaitAny(_WaitHandles); _CaptureBuffer.Read( bufferPortion, diff --git a/Vocaluxe/Screens/CScreenCredits.cs b/Vocaluxe/Screens/CScreenCredits.cs index c9df9ec0..d8a17f78 100644 --- a/Vocaluxe/Screens/CScreenCredits.cs +++ b/Vocaluxe/Screens/CScreenCredits.cs @@ -152,13 +152,10 @@ namespace Vocaluxe.Screens _ParagraphTexts = new List(); _Paragraphs = new List(); - string paragraph; - string[] words; - - paragraph = "Inspired by the achievements of UltraStar Deluxe and its variants and pursuing the goal of making " + - "a good thing even better, we ended up rewriting the game from scratch. And a new implementation in a new " + - "programming language called for a new name - and VOCALUXE [ˈvoʊˈkəˈlʌks] it is!"; - words = paragraph.Split(new char[] {' '}); + string paragraph = "Inspired by the achievements of UltraStar Deluxe and its variants and pursuing the goal of making " + + "a good thing even better, we ended up rewriting the game from scratch. And a new implementation in a new " + + "programming language called for a new name - and VOCALUXE [ˈvoʊˈkəˈlʌks] it is!"; + string[] words = paragraph.Split(new char[] {' '}); _Paragraphs.Add(words); paragraph = "This first public version has already implemented many of the original features and it is fully " + diff --git a/Vocaluxe/Screens/CScreenSong.cs b/Vocaluxe/Screens/CScreenSong.cs index 6108ade4..85551067 100644 --- a/Vocaluxe/Screens/CScreenSong.cs +++ b/Vocaluxe/Screens/CScreenSong.cs @@ -819,8 +819,7 @@ namespace Vocaluxe.Screens { if (CSongs.Category >= 0 && songNr >= 0 && CSongs.NumVisibleSongs > songNr) { - EGameMode gm; - gm = CSongs.VisibleSongs[songNr].IsDuet ? EGameMode.TR_GAMEMODE_DUET : EGameMode.TR_GAMEMODE_NORMAL; + EGameMode gm = CSongs.VisibleSongs[songNr].IsDuet ? EGameMode.TR_GAMEMODE_DUET : EGameMode.TR_GAMEMODE_NORMAL; CGame.Reset(); CGame.ClearSongs(); diff --git a/VocaluxeLib/Menu/CMenuParty.cs b/VocaluxeLib/Menu/CMenuParty.cs index 2cd1fa5c..965f6175 100644 --- a/VocaluxeLib/Menu/CMenuParty.cs +++ b/VocaluxeLib/Menu/CMenuParty.cs @@ -26,7 +26,7 @@ namespace VocaluxeLib.Menu { protected IPartyMode _PartyMode; - public CMenuParty() + protected CMenuParty() { _PartyMode = new CPartyModeNone(); } diff --git a/VocaluxeLib/Menu/CSelectSlide.cs b/VocaluxeLib/Menu/CSelectSlide.cs index a79d9e93..66ad5b95 100644 --- a/VocaluxeLib/Menu/CSelectSlide.cs +++ b/VocaluxeLib/Menu/CSelectSlide.cs @@ -556,7 +556,7 @@ namespace VocaluxeLib.Menu _ValueBounds.Clear(); } - public void AddValues(string[] values) + public void AddValues(IEnumerable values) { foreach (string value in values) _AddValue(value, new STexture(-1), _PartyModeID); diff --git a/VocaluxeLib/Menu/CXMLReader.cs b/VocaluxeLib/Menu/CXMLReader.cs index 55944771..6173699b 100644 --- a/VocaluxeLib/Menu/CXMLReader.cs +++ b/VocaluxeLib/Menu/CXMLReader.cs @@ -141,7 +141,7 @@ namespace VocaluxeLib.Menu return values; } - public List GetAttributes(string cast, string attribute) + public IEnumerable GetAttributes(string cast, string attribute) { List values = new List(); @@ -180,11 +180,10 @@ namespace VocaluxeLib.Menu public bool ItemExists(string cast) { - XPathNodeIterator iterator; int results = 0; _Navigator.MoveToFirstChild(); - iterator = _Navigator.Select(cast); + XPathNodeIterator iterator = _Navigator.Select(cast); while (iterator.MoveNext()) results++; diff --git a/VocaluxeLib/Menu/IMenu.cs b/VocaluxeLib/Menu/IMenu.cs index 70813cfc..28b278f7 100644 --- a/VocaluxeLib/Menu/IMenu.cs +++ b/VocaluxeLib/Menu/IMenu.cs @@ -86,7 +86,7 @@ namespace VocaluxeLib.Menu int GetCoverSize(); - List GetSongFolder(); + IEnumerable GetSongFolder(); ESongSorting GetSongSorting(); EOffOn GetTabs(); EOffOn GetIgnoreArticles(); diff --git a/VocaluxeLib/Menu/SingNotes/CNotes.cs b/VocaluxeLib/Menu/SingNotes/CNotes.cs index 7c7413ba..1794834c 100644 --- a/VocaluxeLib/Menu/SingNotes/CNotes.cs +++ b/VocaluxeLib/Menu/SingNotes/CNotes.cs @@ -707,7 +707,6 @@ namespace VocaluxeLib.Menu.SingNotes public void UpdateTimings() { CNote lastNote; - int min, max, s; if (_Lines.Count > 0) _Lines[0].StartBeat = -10000; @@ -719,9 +718,10 @@ namespace VocaluxeLib.Menu.SingNotes if ((lastNote != null) && (firstNote != null)) { - min = lastNote.EndBeat; - max = firstNote.StartBeat; + int min = lastNote.EndBeat; + int max = firstNote.StartBeat; + int s; switch (max - min) { case 0: diff --git a/VocaluxeLib/Menu/SingNotes/CSingNotes.cs b/VocaluxeLib/Menu/SingNotes/CSingNotes.cs index 9e254aee..06c227e8 100644 --- a/VocaluxeLib/Menu/SingNotes/CSingNotes.cs +++ b/VocaluxeLib/Menu/SingNotes/CSingNotes.cs @@ -74,7 +74,7 @@ namespace VocaluxeLib.Menu.SingNotes /// public SRectF[,] BarPos { get; set; } - public CSingNotes(int partyModeID) + protected CSingNotes(int partyModeID) { _PartyModeID = partyModeID; _Theme = new SThemeSingBar(); diff --git a/VocaluxeLib/Menu/SongMenu/CSongMenuFramework.cs b/VocaluxeLib/Menu/SongMenu/CSongMenuFramework.cs index 2fa3ed64..e4cc0766 100644 --- a/VocaluxeLib/Menu/SongMenu/CSongMenuFramework.cs +++ b/VocaluxeLib/Menu/SongMenu/CSongMenuFramework.cs @@ -234,7 +234,7 @@ namespace VocaluxeLib.Menu.SongMenu _Visible = visible; } - public CSongMenuFramework(int partyModeID) + protected CSongMenuFramework(int partyModeID) { _PartyModeID = partyModeID; _Theme = new SThemeSongMenu diff --git a/VocaluxeLib/PartyModes/CPartyMode.cs b/VocaluxeLib/PartyModes/CPartyMode.cs index de9c9b7a..cbc74a52 100644 --- a/VocaluxeLib/PartyModes/CPartyMode.cs +++ b/VocaluxeLib/PartyModes/CPartyMode.cs @@ -28,7 +28,7 @@ namespace VocaluxeLib.PartyModes protected SScreenSongOptions _ScreenSongOptions; protected readonly Dictionary _Screens; - public CPartyMode() + protected CPartyMode() { _Screens = new Dictionary(); _ScreenSongOptions = new SScreenSongOptions {Selection = new SSelectionOptions(), Sorting = new SSortingOptions()}; From 7663b84f71f6ebea1dfe12611661c6b413df3216 Mon Sep 17 00:00:00 2001 From: Flamefire Date: Tue, 23 Apr 2013 22:23:12 +0200 Subject: [PATCH 15/27] Encapsulated CMain Classes --- Vocaluxe/Base/CBackgroundMusic.cs | 22 +++---- Vocaluxe/Base/CConfig.cs | 30 ++++++++- Vocaluxe/Base/CGraphics.cs | 14 ++--- Vocaluxe/Base/CMain.cs | 63 +++++++------------ Vocaluxe/Base/CPlaylists.cs | 2 +- Vocaluxe/Base/CProfiles.cs | 2 +- Vocaluxe/Screens/CPopupScreenPlayerControl.cs | 4 +- Vocaluxe/Screens/CScreenLoad.cs | 4 +- Vocaluxe/Screens/CScreenParty.cs | 2 +- Vocaluxe/Screens/CScreenSong.cs | 8 +-- 10 files changed, 81 insertions(+), 70 deletions(-) diff --git a/Vocaluxe/Base/CBackgroundMusic.cs b/Vocaluxe/Base/CBackgroundMusic.cs index de114f20..d4679b96 100644 --- a/Vocaluxe/Base/CBackgroundMusic.cs +++ b/Vocaluxe/Base/CBackgroundMusic.cs @@ -106,7 +106,7 @@ namespace Vocaluxe.Base get { return File.Exists(_CurrentPlaylistElement.VideoFilePath); } } - public static bool Playing { get; private set; } + public static bool IsPlaying { get; private set; } public static string ArtistAndTitle { @@ -138,12 +138,12 @@ namespace Vocaluxe.Base if (CConfig.VideoBackgrounds == EOffOn.TR_CONFIG_ON) _VideoEnabled = true; - Playing = false; + IsPlaying = false; } public static void Play() { - if (Playing) + if (IsPlaying) return; if (CConfig.BackgroundMusic == EOffOn.TR_CONFIG_ON) @@ -156,7 +156,7 @@ namespace Vocaluxe.Base CSound.Play(_CurrentMusicStream); if (_VideoEnabled && _Video != -1) CVideo.VdResume(_Video); - Playing = true; + IsPlaying = true; } else Next(); @@ -168,7 +168,7 @@ namespace Vocaluxe.Base public static void Stop() { - if (!Playing) + if (!IsPlaying) return; if (_VideoEnabled && _Video != -1) @@ -181,12 +181,12 @@ namespace Vocaluxe.Base _CurrentMusicStream = -1; _CurrentPlaylistElement = new CPlaylistElement(); - Playing = false; + IsPlaying = false; } public static void Pause() { - if (!Playing) + if (!IsPlaying) return; if (_VideoEnabled && _Video != -1) @@ -195,7 +195,7 @@ namespace Vocaluxe.Base CVideo.VdSkip(_Video, CSound.GetPosition(_CurrentMusicStream) + CSettings.BackgroundMusicFadeTime, _CurrentPlaylistElement.VideoGap); } CSound.FadeAndPause(_CurrentMusicStream, 0f, CSettings.BackgroundMusicFadeTime); - Playing = false; + IsPlaying = false; } public static void Update() @@ -209,7 +209,7 @@ namespace Vocaluxe.Base timeToPlay = _CurrentPlaylistElement.Finish - CSound.GetPosition(_CurrentMusicStream); bool finished = CSound.IsFinished(_CurrentMusicStream); - if (Playing && (timeToPlay <= CSettings.BackgroundMusicFadeTime || finished)) + if (IsPlaying && (timeToPlay <= CSettings.BackgroundMusicFadeTime || finished)) { if (_RepeatSong) { @@ -355,7 +355,7 @@ namespace Vocaluxe.Base _NotPlayedFileNames.AddRange(_BGMusicFileNames); } - if (Playing && !_IsBackgroundFile(_CurrentPlaylistElement) || _AllFileNames.Count == 0) + if (IsPlaying && !_IsBackgroundFile(_CurrentPlaylistElement) || _AllFileNames.Count == 0) Next(); _OwnMusicAdded = false; @@ -380,7 +380,7 @@ namespace Vocaluxe.Base AddOwnMusic(); _BackgroundMusicAdded = false; - if (Playing && _IsBackgroundFile(_CurrentPlaylistElement) || _AllFileNames.Count == 0) + if (IsPlaying && _IsBackgroundFile(_CurrentPlaylistElement) || _AllFileNames.Count == 0) Next(); } } diff --git a/Vocaluxe/Base/CConfig.cs b/Vocaluxe/Base/CConfig.cs index ed3287be..32f00ea8 100644 --- a/Vocaluxe/Base/CConfig.cs +++ b/Vocaluxe/Base/CConfig.cs @@ -77,7 +77,7 @@ namespace Vocaluxe.Base public static ERecordLib RecordLib = ERecordLib.PortAudio; public static EBufferSize AudioBufferSize = EBufferSize.B2048; public static int AudioLatency; - public static int BackgroundMusicVolume = 30; + private static int _BackgroundMusicVolume = 30; public static EOffOn BackgroundMusic = EOffOn.TR_CONFIG_ON; public static EBackgroundMusicSource BackgroundMusicSource = EBackgroundMusicSource.TR_CONFIG_NO_OWN_MUSIC; public static EOffOn BackgroundMusicUseStart = EOffOn.TR_CONFIG_ON; @@ -118,6 +118,19 @@ namespace Vocaluxe.Base //Variables to save old values for commandline-parameters private static readonly List _SongFolderOld = new List(); + public static int BackgroundMusicVolume + { + get { return _BackgroundMusicVolume; } + set { + if (value < 0) + _BackgroundMusicVolume = 0; + else if (value > 100) + _BackgroundMusicVolume = 100; + else + _BackgroundMusicVolume = value; + SaveConfig(); + } + } public static void Init() { @@ -180,7 +193,7 @@ namespace Vocaluxe.Base xmlReader.TryGetIntValueRange("//root/Sound/AudioLatency", ref AudioLatency, -500, 500); xmlReader.TryGetEnumValue("//root/Sound/BackgroundMusic", ref BackgroundMusic); - xmlReader.TryGetIntValueRange("//root/Sound/BackgroundMusicVolume", ref BackgroundMusicVolume); + xmlReader.TryGetIntValueRange("//root/Sound/BackgroundMusicVolume", ref _BackgroundMusicVolume); xmlReader.TryGetEnumValue("//root/Sound/BackgroundMusicSource", ref BackgroundMusicSource); xmlReader.TryGetEnumValue("//root/Sound/BackgroundMusicUseStart", ref BackgroundMusicUseStart); xmlReader.TryGetIntValueRange("//root/Sound/PreviewMusicVolume", ref PreviewMusicVolume); @@ -591,6 +604,19 @@ namespace Vocaluxe.Base return false; } + public static int GetMaxNumMics() + { + int max = 0; + for (int i = 0; i < CSettings.MaxNumPlayer; i++) + { + if (IsMicConfig(i + 1)) + max = i + 1; + else + break; + } + return max; + } + /// /// Try to assign automatically player 1 and 2 to usb-mics. /// diff --git a/Vocaluxe/Base/CGraphics.cs b/Vocaluxe/Base/CGraphics.cs index eff9e0c4..84f51c5a 100644 --- a/Vocaluxe/Base/CGraphics.cs +++ b/Vocaluxe/Base/CGraphics.cs @@ -411,7 +411,7 @@ namespace Vocaluxe.Base GC.Collect(); _CurrentScreen = _NextScreen; _NextScreen = EScreens.ScreenNull; - if (CBackgroundMusic.Playing) + if (CBackgroundMusic.IsPlaying) CBackgroundMusic.Play(); _Screens[(int)_CurrentScreen].OnShowFinish(); _Screens[(int)_CurrentScreen].ProcessMouseMove(_Cursor.X, _Cursor.Y); @@ -542,15 +542,15 @@ namespace Vocaluxe.Base if (popupPlayerControlAllowed && CConfig.BackgroundMusic == EOffOn.TR_CONFIG_ON) { if (keyEvent.Key == Keys.MediaNextTrack) - CMain.BackgroundMusic.Next(); + CBackgroundMusic.Next(); else if (keyEvent.Key == Keys.MediaPreviousTrack) - CMain.BackgroundMusic.Previous(); + CBackgroundMusic.Previous(); else if (keyEvent.Key == Keys.MediaPlayPause) { - if (CMain.BackgroundMusic.IsPlaying()) - CMain.BackgroundMusic.Pause(); + if (CBackgroundMusic.IsPlaying) + CBackgroundMusic.Pause(); else - CMain.BackgroundMusic.Play(); + CBackgroundMusic.Play(); } } @@ -600,7 +600,7 @@ namespace Vocaluxe.Base _VolumePopupTimer.Start(); } - CMain.BackgroundMusic.ApplyVolume(); + CBackgroundMusic.ApplyVolume(); } if (keyEvent.ModShift && (keyEvent.Key == Keys.F1)) diff --git a/Vocaluxe/Base/CMain.cs b/Vocaluxe/Base/CMain.cs index 64cbbb9c..59e7d962 100644 --- a/Vocaluxe/Base/CMain.cs +++ b/Vocaluxe/Base/CMain.cs @@ -27,30 +27,30 @@ namespace Vocaluxe.Base { static class CMain { - public static readonly IConfig Config = new CBconfig(); - public static readonly ISettings Settings = new CBsettings(); - public static readonly ITheme Theme = new CBtheme(); - public static readonly IBackgroundMusic BackgroundMusic = new CBbackgroundMusic(); - public static readonly IDrawing Draw = new CBdraw(); - public static IGraphics Graphics = new CBGraphics(); - public static ILog Log = new CBlog(); - public static IFonts Fonts = new CBfonts(); - public static ILanguage Language = new CBlanguage(); - public static IGame Game = new CBGame(); - public static IProfiles Profiles = new CBprofiles(); - public static IRecording Record = new CBrecord(); - public static ISongs Songs = new CBsongs(); - public static IVideo Video = new CBvideo(); - public static ISound Sound = new CBsound(); - public static ICover Cover = new CBcover(); - public static IDataBase DataBase = new CBdataBase(); - public static IInputs Input = new CBinputs(); - public static IPlaylist Playlist = new CBplaylist(); + private static readonly IConfig _Config = new CBconfig(); + private static readonly ISettings _Settings = new CBsettings(); + private static readonly ITheme _Theme = new CBtheme(); + private static readonly IBackgroundMusic _BackgroundMusic = new CBbackgroundMusic(); + private static readonly IDrawing _Draw = new CBdraw(); + private static readonly IGraphics _Graphics = new CBGraphics(); + private static readonly ILog _Log = new CBlog(); + private static readonly IFonts _Fonts = new CBfonts(); + private static readonly ILanguage _Language = new CBlanguage(); + private static readonly IGame _Game = new CBGame(); + private static readonly IProfiles _Profiles = new CBprofiles(); + private static readonly IRecording _Record = new CBrecord(); + private static readonly ISongs _Songs = new CBsongs(); + private static readonly IVideo _Video = new CBvideo(); + private static readonly ISound _Sound = new CBsound(); + private static readonly ICover _Cover = new CBcover(); + private static readonly IDataBase _DataBase = new CBdataBase(); + private static readonly IInputs _Input = new CBinputs(); + private static readonly IPlaylist _Playlist = new CBplaylist(); public static void Init() { - CBase.Assign(Config, Settings, Theme, Log, BackgroundMusic, Draw, Graphics, Fonts, Language, - Game, Profiles, Record, Songs, Video, Sound, Cover, DataBase, Input, Playlist); + CBase.Assign(_Config, _Settings, _Theme, _Log, _BackgroundMusic, _Draw, _Graphics, _Fonts, _Language, + _Game, _Profiles, _Record, _Songs, _Video, _Sound, _Cover, _DataBase, _Input, _Playlist); } } @@ -58,14 +58,7 @@ namespace Vocaluxe.Base { public void SetBackgroundMusicVolume(int newVolume) { - if (newVolume < 0) - CConfig.BackgroundMusicVolume = 0; - else if (newVolume > 100) - CConfig.BackgroundMusicVolume = 100; - else - CConfig.BackgroundMusicVolume = newVolume; - - CConfig.SaveConfig(); + CConfig.BackgroundMusicVolume = newVolume; } public int GetBackgroundMusicVolume() @@ -140,15 +133,7 @@ namespace Vocaluxe.Base public int GetMaxNumMics() { - int max = 0; - for (int i = 0; i < CSettings.MaxNumPlayer; i++) - { - if (CConfig.IsMicConfig(i + 1)) - max = i + 1; - else - break; - } - return max; + return CConfig.GetMaxNumMics(); } } @@ -302,7 +287,7 @@ namespace Vocaluxe.Base public bool IsPlaying() { - return CBackgroundMusic.Playing; + return CBackgroundMusic.IsPlaying; } public bool SongHasVideo() diff --git a/Vocaluxe/Base/CPlaylists.cs b/Vocaluxe/Base/CPlaylists.cs index d71bcda5..7611d242 100644 --- a/Vocaluxe/Base/CPlaylists.cs +++ b/Vocaluxe/Base/CPlaylists.cs @@ -227,7 +227,7 @@ namespace Vocaluxe.Base private static int _CompareByPlaylistName(CPlaylistFile a, CPlaylistFile b) { - return System.String.CompareOrdinal(a.PlaylistName, b.PlaylistName); + return String.CompareOrdinal(a.PlaylistName, b.PlaylistName); } private static CPlaylistFile _ConvertUSDXPlaylist(string file) diff --git a/Vocaluxe/Base/CProfiles.cs b/Vocaluxe/Base/CProfiles.cs index d69effda..655cf08c 100644 --- a/Vocaluxe/Base/CProfiles.cs +++ b/Vocaluxe/Base/CProfiles.cs @@ -282,7 +282,7 @@ namespace Vocaluxe.Base private static int _CompareByPlayerName(SProfile a, SProfile b) { - return System.String.CompareOrdinal(a.PlayerName, b.PlayerName); + return String.CompareOrdinal(a.PlayerName, b.PlayerName); } #region private methods diff --git a/Vocaluxe/Screens/CPopupScreenPlayerControl.cs b/Vocaluxe/Screens/CPopupScreenPlayerControl.cs index fd38ee1a..023ee4e2 100644 --- a/Vocaluxe/Screens/CPopupScreenPlayerControl.cs +++ b/Vocaluxe/Screens/CPopupScreenPlayerControl.cs @@ -189,8 +189,8 @@ namespace Vocaluxe.Screens _Statics[_StaticCover].Texture = CBackgroundMusic.Cover; if (CBackgroundMusic.VideoEnabled && _VideoPreview && CBackgroundMusic.SongHasVideo) CDraw.DrawTexture(_Statics[_StaticCover], CBackgroundMusic.GetVideoTexture(), EAspect.Crop); - _Buttons[_ButtonPause].Visible = CBackgroundMusic.Playing; - _Buttons[_ButtonPlay].Visible = !CBackgroundMusic.Playing; + _Buttons[_ButtonPause].Visible = CBackgroundMusic.IsPlaying; + _Buttons[_ButtonPlay].Visible = !CBackgroundMusic.IsPlaying; _Texts[_TextCurrentSong].Text = CBackgroundMusic.ArtistAndTitle; return base.Draw(); diff --git a/Vocaluxe/Screens/CScreenLoad.cs b/Vocaluxe/Screens/CScreenLoad.cs index 4d7dec77..1f25f6d1 100644 --- a/Vocaluxe/Screens/CScreenLoad.cs +++ b/Vocaluxe/Screens/CScreenLoad.cs @@ -141,7 +141,7 @@ namespace Vocaluxe.Screens { CBackgroundMusic.AddOwnMusic(); - if (!CBackgroundMusic.Playing) + if (!CBackgroundMusic.IsPlaying) CBackgroundMusic.Next(); _BGMusicStartet = true; @@ -177,7 +177,7 @@ namespace Vocaluxe.Screens { CBackgroundMusic.AddOwnMusic(); - if (!CBackgroundMusic.Playing) + if (!CBackgroundMusic.IsPlaying) CBackgroundMusic.Next(); _BGMusicStartet = true; diff --git a/Vocaluxe/Screens/CScreenParty.cs b/Vocaluxe/Screens/CScreenParty.cs index b5f58a2d..46df559b 100644 --- a/Vocaluxe/Screens/CScreenParty.cs +++ b/Vocaluxe/Screens/CScreenParty.cs @@ -195,7 +195,7 @@ namespace Vocaluxe.Screens if (index >= _PartyModeInfos.Count) return; - if (CMain.Config.GetMaxNumMics() == 0) + if (CConfig.GetMaxNumMics() == 0) return; //TODO: Add message! if (_PartyModeInfos[index].Playable) diff --git a/Vocaluxe/Screens/CScreenSong.cs b/Vocaluxe/Screens/CScreenSong.cs index 85551067..f9b69d1d 100644 --- a/Vocaluxe/Screens/CScreenSong.cs +++ b/Vocaluxe/Screens/CScreenSong.cs @@ -100,7 +100,7 @@ namespace Vocaluxe.Screens base.Init(); _ButtonsJoker.Clear(); - for (int i = 0; i < CMain.Settings.GetMaxNumPlayer(); i++) + for (int i = 0; i < CSettings.MaxNumPlayer; i++) _ButtonsJoker.Add("ButtonJoker" + (i + 1)); List blist = new List(); blist.AddRange(_ButtonsJoker); @@ -118,7 +118,7 @@ namespace Vocaluxe.Screens blist.Add(_ButtonOptionsStartMedley); _TextsPlayer.Clear(); - for (int i = 0; i < CMain.Settings.GetMaxNumPlayer(); i++) + for (int i = 0; i < CSettings.MaxNumPlayer; i++) _TextsPlayer.Add("TextPlayer" + (i + 1)); List tlist = new List(); tlist.AddRange(_TextsPlayer); @@ -751,7 +751,7 @@ namespace Vocaluxe.Screens if (!_SongMenus[_SongMenu].IsSmallView()) _SongMenus[_SongMenu].SetSmallView(true); - for (int i = 0; i < CMain.Settings.GetMaxNumPlayer(); i++) + for (int i = 0; i < CSettings.MaxNumPlayer; i++) { if (i < _Sso.Selection.NumJokers.Length) { @@ -784,7 +784,7 @@ namespace Vocaluxe.Screens if (_Sso.Selection.PartyMode && _SongMenus[_SongMenu].IsSmallView()) _SongMenus[_SongMenu].SetSmallView(false); - for (int i = 0; i < CMain.Settings.GetMaxNumPlayer(); i++) + for (int i = 0; i < CSettings.MaxNumPlayer; i++) { _Buttons[_ButtonsJoker[i]].Visible = false; _Texts[_TextsPlayer[i]].Visible = false; From 181490fa87bdd85a1ead380e785f216d36bf446d Mon Sep 17 00:00:00 2001 From: Flamefire Date: Tue, 23 Apr 2013 23:18:47 +0200 Subject: [PATCH 16/27] Use assembly version for displayed stuff. This is better, as the version is displayed in the file properties dialog --- Vocaluxe/Base/CFont.cs | 2 +- Vocaluxe/Base/CSettings.cs | 63 +++++++++++++++++------------ Vocaluxe/Properties/AssemblyInfo.cs | 4 +- 3 files changed, 41 insertions(+), 28 deletions(-) diff --git a/Vocaluxe/Base/CFont.cs b/Vocaluxe/Base/CFont.cs index f7b45b25..2495eb4f 100644 --- a/Vocaluxe/Base/CFont.cs +++ b/Vocaluxe/Base/CFont.cs @@ -47,7 +47,7 @@ namespace Vocaluxe.Base _Sizeh = maxHigh; float outline = CFonts.Outline; - TextFormatFlags flags = TextFormatFlags.NoPadding | TextFormatFlags.NoPrefix; + const TextFormatFlags flags = TextFormatFlags.NoPadding | TextFormatFlags.NoPrefix; float factor = _GetFactor(chr, flags); CFonts.Height = Sizeh * factor; diff --git a/Vocaluxe/Base/CSettings.cs b/Vocaluxe/Base/CSettings.cs index cfb7c39f..9ac6659c 100644 --- a/Vocaluxe/Base/CSettings.cs +++ b/Vocaluxe/Base/CSettings.cs @@ -20,6 +20,7 @@ using System; using System.Collections.Generic; using System.IO; +using System.Reflection; using VocaluxeLib.Menu; namespace Vocaluxe.Base @@ -37,44 +38,41 @@ namespace Vocaluxe.Base static class CSettings { #if ARCH_X86 - public const String Arch = "x86"; + private const String _Arch = "x86"; #endif #if ARCH_X64 - public const String Arch = "x64"; + private const String _Arch = "x64"; #endif public static EGameState GameState = EGameState.Start; - public const string ProgramName = "Vocaluxe"; - public const string ProgramCodeName = "Shining Heaven"; - public const int VersionMajor = 0; - public const int VersionMinor = 3; // milestones - public const int VersionSub = 0; // patches + //Adjusting of programName and version now in the assembly config. + //I'd use the major and minor for Main releases, build number for every public release and revision for every bugfix version without any features + //As it is different than before, this is open for discussion. + //TODO: Remove this when this is decided + private const string _ProgramCodeName = "Shining Heaven"; + public const ERevision VersionRevision = ERevision.Alpha; - public const int Build = 78; // Increase on every published version! Never Reset! - public const int DatabaseHighscoreVersion = 2; public const int DatabaseCoverVersion = 1; public const int DatabaseCreditsRessourcesVersion = 1; - public static int RenderW = 1280; - public static int RenderH = 720; + public const int RenderW = 1280; + public const int RenderH = 720; public const int ZNear = -100; public const int ZFar = 100; public static bool IsFullScreen; - public static int VertexBufferElements = 10000; + public const int VertexBufferElements = 10000; public const string Icon = "Vocaluxe.ico"; public const string Logo = "Logo.png"; public const string FallbackLanguage = "English"; - public const string BassRegistration = "Registration.xml"; public static string FileConfig = "Config.xml"; - public const string FileCover = "Cover.xml"; public const string FileFonts = "Fonts.xml"; public const string FileOldHighscoreDB = "Ultrastar.db"; @@ -91,7 +89,6 @@ namespace Vocaluxe.Base public const string FolderGraphics = "Graphics"; public const string FolderFonts = "Fonts"; public const string FolderThemes = "Themes"; - public const string FolderSkins = "Skins"; public const string FolderThemeFonts = "Fonts"; public const string FolderScreens = "Screens"; public static string FolderProfiles = "Profiles"; @@ -130,11 +127,11 @@ namespace Vocaluxe.Base public const int MedleyMinSeriesLength = 3; public const float MedleyMinDuration = 40f; - public static bool TabNavigation = false; + public const bool TabNavigation = false; public const float BackgroundMusicFadeTime = 0.5f; - public static List MusicFileTypes = new List + public static readonly List MusicFileTypes = new List { "*.mp3", "*.wma", @@ -142,16 +139,32 @@ namespace Vocaluxe.Base "*.wav" }; - public static string GetVersionText() + private static AssemblyName _Assembly { - string version = "v" + VersionMajor + "." + - VersionMinor + "." + - VersionSub + " (" + Arch + ")"; + get { return Assembly.GetExecutingAssembly().GetName(); } + } + + public static string ProgramName + { + get { return _Assembly.Name; } + } + private static string _Version + { + get + { + Version v = _Assembly.Version; + return "v" + v.Major + "." + v.Minor + "." + v.Build; + } + } + + private static string _GetVersionText() + { + string version = _Version + " (" + _Arch + ")"; // ReSharper disable ConditionIsAlwaysTrueOrFalse if (VersionRevision != ERevision.Release) // ReSharper restore ConditionIsAlwaysTrueOrFalse - version += " " + _GetVersionStatus() + String.Format(" ({0:0000)}", Build); + version += " " + _GetVersionStatus() + String.Format(" ({0:0000)}", _Assembly.Version.Revision); return version; } @@ -161,11 +174,11 @@ namespace Vocaluxe.Base string version = ProgramName; // ReSharper disable ConditionIsAlwaysTrueOrFalse - if (ProgramCodeName != "") + if (_ProgramCodeName != "") // ReSharper restore ConditionIsAlwaysTrueOrFalse - version += " \"" + ProgramCodeName + "\""; + version += " \"" + _ProgramCodeName + "\""; - return version + " " + GetVersionText(); + return version + " " + _GetVersionText(); } private static string _GetVersionStatus() diff --git a/Vocaluxe/Properties/AssemblyInfo.cs b/Vocaluxe/Properties/AssemblyInfo.cs index f51f6afd..7f74a4d8 100644 --- a/Vocaluxe/Properties/AssemblyInfo.cs +++ b/Vocaluxe/Properties/AssemblyInfo.cs @@ -51,5 +51,5 @@ using System.Runtime.InteropServices; // Revision // -[assembly: AssemblyVersion("0.3.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] \ No newline at end of file +[assembly: AssemblyVersion("0.3.0.78")] +[assembly: AssemblyFileVersion("0.3.0.78")] \ No newline at end of file From b1e28ae7bc8696ce76f71156551598d7728ebf13 Mon Sep 17 00:00:00 2001 From: Flamefire Date: Wed, 24 Apr 2013 00:41:08 +0200 Subject: [PATCH 17/27] More refactoring (mainly LINQ) --- .../PartyModeChallenge/CPartyModeChallenge.cs | 2 +- .../CPartyScreenChallengeMain.cs | 2 +- .../CChallengeRounds.cs | 44 +- .../CPartyModeChallengeMedley.cs | 19 +- .../CPartyScreenChallengeMedleyMain.cs | 4 +- .../CPartyScreenChallengeMedleyNames.cs | 8 +- .../PartyModeTicTacToe/CPartyModeTicTacToe.cs | 25 +- .../CPartyScreenTicTacToeMain.cs | 2 +- .../CPartyScreenTicTacToeNames.cs | 28 +- Vocaluxe/Base/CBackgroundMusic.cs | 8 +- Vocaluxe/Base/CDataBase.cs | 20 - Vocaluxe/Base/CFont.cs | 23 +- Vocaluxe/Base/CGraphics.cs | 8 - Vocaluxe/Base/CSongs.cs | 27 +- Vocaluxe/Base/CUtility.cs | 39 +- Vocaluxe/Lib/Draw/CDrawWinForm.cs | 2 +- Vocaluxe/Lib/Input/CHIDAPI.cs | 22 +- Vocaluxe/Lib/Input/WiiMote/CWiiMote.cs | 4 +- Vocaluxe/Lib/Sound/COpenALPlay.cs | 8 +- Vocaluxe/Lib/Sound/IRecord.cs | 2 + Vocaluxe/Lib/Sound/Portaudio/PortAudio.cs | 9 +- Vocaluxe/Lib/Video/CVideoDecoder.cs | 8 +- .../Video/Gstreamer/CGstreamerVideoWrapper.cs | 2 - Vocaluxe/Lib/Webcam/CAForgeNet.cs | 3 - Vocaluxe/Lib/Webcam/IWebcam.cs | 1 - Vocaluxe/Screens/CScreenHighscore.cs | 9 +- Vocaluxe/Screens/CScreenOptionsSound.cs | 2 - Vocaluxe/Screens/CScreenOptionsTheme.cs | 5 - Vocaluxe/Screens/CScreenProfiles.cs | 2 +- Vocaluxe/Screens/CScreenSing.cs | 4 +- Vocaluxe/Screens/CScreenSong.cs | 32 +- Vocaluxe/Screens/CScreenTest.cs | 35 +- VocaluxeLib/Menu/CButton.cs | 114 ++--- VocaluxeLib/Menu/CPlaylist.cs | 445 +++++++++--------- VocaluxeLib/Menu/CSelectSlide.cs | 2 +- VocaluxeLib/Menu/CText.cs | 12 +- VocaluxeLib/Menu/Enums.cs | 10 + VocaluxeLib/Menu/SingNotes/CNotes.cs | 24 +- VocaluxeLib/Menu/SingNotes/CSingNotes.cs | 27 +- VocaluxeLib/Menu/SongMenu/CSong.cs | 10 +- .../Menu/SongMenu/CSongMenuFramework.cs | 6 +- .../Menu/SongMenu/CSongMenuTileBoard.cs | 21 +- VocaluxeLib/Menu/Structs.cs | 70 +-- 43 files changed, 488 insertions(+), 662 deletions(-) diff --git a/PartyModes/PartyModeChallenge/CPartyModeChallenge.cs b/PartyModes/PartyModeChallenge/CPartyModeChallenge.cs index e94d81b3..500c3551 100644 --- a/PartyModes/PartyModeChallenge/CPartyModeChallenge.cs +++ b/PartyModes/PartyModeChallenge/CPartyModeChallenge.cs @@ -452,7 +452,7 @@ namespace VocaluxeLib.PartyModes.Challenge public override void SongSelected(int songID) { - EGameMode gm = EGameMode.TR_GAMEMODE_NORMAL; + const EGameMode gm = EGameMode.TR_GAMEMODE_NORMAL; CBase.Game.Reset(); CBase.Game.ClearSongs(); diff --git a/PartyModes/PartyModeChallenge/CPartyScreenChallengeMain.cs b/PartyModes/PartyModeChallenge/CPartyScreenChallengeMain.cs index b0cf21bd..edd15420 100644 --- a/PartyModes/PartyModeChallenge/CPartyScreenChallengeMain.cs +++ b/PartyModes/PartyModeChallenge/CPartyScreenChallengeMain.cs @@ -93,7 +93,7 @@ namespace VocaluxeLib.PartyModes.Challenge private SRectF _PlayerTableScrollArea; private int _RoundsTableOffset; private int _PlayerTableOffset; - private int _NumPlayerVisible = 10; + private const int _NumPlayerVisible = 10; private int _NumRoundsVisible = 3; public CPartyScreenChallengeMain() diff --git a/PartyModes/PartyModeChallengeMedley/CChallengeRounds.cs b/PartyModes/PartyModeChallengeMedley/CChallengeRounds.cs index 7b6310c1..2a3bc286 100644 --- a/PartyModes/PartyModeChallengeMedley/CChallengeRounds.cs +++ b/PartyModes/PartyModeChallengeMedley/CChallengeRounds.cs @@ -19,6 +19,7 @@ using System; using System.Collections.Generic; +using System.Linq; namespace VocaluxeLib.PartyModes.ChallengeMedley { @@ -27,7 +28,7 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley private readonly Random _Rand; private readonly int _NumPlayer; - public List Rounds; + public readonly List Rounds; public CChallengeRounds(int numRounds, int numPlayer, int numPlayerAtOnce) { @@ -72,12 +73,7 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley numPlayed[playerIndex]++; } - int max = 0; - foreach (int p in numPlayed) - { - if (p > max) - max = p; - } + int max = numPlayed.Max(); int num = Rounds[0].Player.Count; List result = new List(); @@ -162,28 +158,19 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley List combsFiltered = new List(); if (playerNrDemand != null) { - for (int i = 0; i < _Combs.Count; i++) - { - if (_Combs[i].IsAvailableAll(playerNrDemand)) - combsFiltered.Add(_Combs[i]); - } + combsFiltered.AddRange(_Combs.Where(t => t.IsAvailableAll(playerNrDemand))); } //1st fallback if (playerNrDemand != null && combsFiltered.Count == 0) { - for (int i = 0; i < _Combs.Count; i++) - { - if (_Combs[i].IsAvailableSomeone(playerNrDemand)) - combsFiltered.Add(_Combs[i]); - } + combsFiltered.AddRange(_Combs.Where(t => t.IsAvailableSomeone(playerNrDemand))); } //2nd fallback if (combsFiltered.Count == 0) { - for (int i = 0; i < _Combs.Count; i++) - combsFiltered.Add(_Combs[i]); + combsFiltered.AddRange(_Combs); } int num = combsFiltered.Count; @@ -220,7 +207,7 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley public class CCombination { - public List Player; + public readonly List Player; public CCombination() { @@ -229,28 +216,17 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley public bool IsAvailable(int playerIndex) { - foreach (int p in Player) - { - if (p == playerIndex) - return true; - } - return false; + return Player.Any(p => p == playerIndex); } public bool IsAvailableAll(IEnumerable playerIndices) { - bool result = true; - foreach (int p in playerIndices) - result &= IsAvailable(p); - return result; + return playerIndices.All(IsAvailable); } public bool IsAvailableSomeone(IEnumerable playerIndices) { - bool result = false; - foreach (int p in playerIndices) - result |= IsAvailable(p); - return result; + return playerIndices.Any(IsAvailable); } } } \ No newline at end of file diff --git a/PartyModes/PartyModeChallengeMedley/CPartyModeChallengeMedley.cs b/PartyModes/PartyModeChallengeMedley/CPartyModeChallengeMedley.cs index 4b549c4e..76d3fd64 100644 --- a/PartyModes/PartyModeChallengeMedley/CPartyModeChallengeMedley.cs +++ b/PartyModes/PartyModeChallengeMedley/CPartyModeChallengeMedley.cs @@ -59,7 +59,6 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley public int Position; public int PlayerID; public int NumPlayed; - public int NumRounds; public int NumWon; public int NumSingPoints; public int NumGamePoints; @@ -102,7 +101,6 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley public struct SFromScreenNames { public bool FadeToConfig; - public bool FadeToMain; public List ProfileIDs; } @@ -518,8 +516,8 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley if (CBase.Songs.GetNumVisibleSongs() < _NumSongs) CBase.Songs.ResetPartySongSung(); - EGameMode gm = EGameMode.TR_GAMEMODE_MEDLEY; - List iDs = new List(); + const EGameMode gm = EGameMode.TR_GAMEMODE_MEDLEY; + List ids = new List(); CSong[] visSongs = CBase.Songs.GetSongsNotSung(); if (visSongs == null) @@ -534,11 +532,11 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley foreach (EGameMode mode in visSongs[i].AvailableGameModes) { if (mode == EGameMode.TR_GAMEMODE_MEDLEY) - iDs.Add(visSongs[i].ID); + ids.Add(visSongs[i].ID); } } - if (iDs.Count == 0) + if (ids.Count == 0) { CBase.Log.LogError("CPartyChallengeMedleyMode Error: There are no medley songs!"); CBase.Graphics.FadeTo(EScreens.ScreenParty); @@ -546,12 +544,12 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley } int s = 0; - while (s < _NumSongs && iDs.Count > 0) + while (s < _NumSongs && ids.Count > 0) { - int songID = iDs[CBase.Game.GetRandom(iDs.Count)]; + int songID = ids[CBase.Game.GetRandom(ids.Count)]; CBase.Game.AddSong(songID, gm); CBase.Songs.AddPartySongSung(songID); - iDs.Remove(songID); + ids.Remove(songID); s++; } return true; @@ -630,7 +628,7 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley { for (int i = 0; i < _GameData.NumPlayer; i++) { - CResultTableRow row = new CResultTableRow {PlayerID = _GameData.ProfileIDs[i], NumPlayed = 0, NumRounds = 0, NumWon = 0, NumSingPoints = 0, NumGamePoints = 0}; + CResultTableRow row = new CResultTableRow {PlayerID = _GameData.ProfileIDs[i], NumPlayed = 0, NumWon = 0, NumSingPoints = 0, NumGamePoints = 0}; _GameData.ResultTable.Add(row); } @@ -690,7 +688,6 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley row.NumPlayed++; row.NumWon += points[i].Won; - row.NumRounds += 1; row.NumSingPoints += points[i].SingPoints; row.NumGamePoints += points[i].GamePoints; diff --git a/PartyModes/PartyModeChallengeMedley/CPartyScreenChallengeMedleyMain.cs b/PartyModes/PartyModeChallengeMedley/CPartyScreenChallengeMedleyMain.cs index 7b465fb1..aa5b60a8 100644 --- a/PartyModes/PartyModeChallengeMedley/CPartyScreenChallengeMedleyMain.cs +++ b/PartyModes/PartyModeChallengeMedley/CPartyScreenChallengeMedleyMain.cs @@ -93,7 +93,7 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley private SRectF _PlayerTableScrollArea; private int _RoundsTableOffset; private int _PlayerTableOffset; - private int _NumPlayerVisible = 10; + private const int _NumPlayerVisible = 10; private int _NumRoundsVisible = 3; public CPartyScreenChallengeMedleyMain() @@ -598,7 +598,7 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley row.Pos.Text = _GameState.ResultTable[i + _PlayerTableOffset].Position + "."; row.Name.Text = profiles[_GameState.ResultTable[i + _PlayerTableOffset].PlayerID].PlayerName; - row.Rounds.Text = _GameState.ResultTable[i + _PlayerTableOffset].NumRounds.ToString(); + row.Rounds.Text = _GameState.ResultTable[i + _PlayerTableOffset].NumPlayed.ToString(); row.Won.Text = _GameState.ResultTable[i + _PlayerTableOffset].NumWon.ToString(); row.SingPoints.Text = _GameState.ResultTable[i + _PlayerTableOffset].NumSingPoints.ToString(); row.GamePoints.Text = _GameState.ResultTable[i + _PlayerTableOffset].NumGamePoints.ToString(); diff --git a/PartyModes/PartyModeChallengeMedley/CPartyScreenChallengeMedleyNames.cs b/PartyModes/PartyModeChallengeMedley/CPartyScreenChallengeMedleyNames.cs index 9617fa42..8ca5bfec 100644 --- a/PartyModes/PartyModeChallengeMedley/CPartyScreenChallengeMedleyNames.cs +++ b/PartyModes/PartyModeChallengeMedley/CPartyScreenChallengeMedleyNames.cs @@ -55,7 +55,7 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley private const int _PlayerChooseButtonsFirstY = 105; private const int _PlayerChooseButtonsSpaceH = 15; private const int _PlayerChooseButtonsSpaceW = 25; - private int _PlayerChooseButtonsOffset = 0; + private const int _PlayerChooseButtonsOffset = 0; private CStatic _ChooseAvatarStatic; private bool _SelectingMouseActive; @@ -88,7 +88,7 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley _ThemeButtons = new string[] {_ButtonBack, _ButtonNext, _ButtonPlayerDestination, _ButtonPlayerChoose}; _Data = new SDataFromScreen(); - SFromScreenNames names = new SFromScreenNames {FadeToConfig = false, FadeToMain = false, ProfileIDs = new List()}; + SFromScreenNames names = new SFromScreenNames {FadeToConfig = false, ProfileIDs = new List()}; _Data.ScreenNames = names; } @@ -339,7 +339,7 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley private void _UpdateButtonPlayerChoose(int offset) { - int numButtonPlayerChoose = _PlayerChooseButtonsNumW * _PlayerChooseButtonsNumH; + const int numButtonPlayerChoose = _PlayerChooseButtonsNumW * _PlayerChooseButtonsNumH; if (offset < 0) offset = 0; @@ -501,14 +501,12 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley private void _Back() { _Data.ScreenNames.FadeToConfig = true; - _Data.ScreenNames.FadeToMain = false; _PartyMode.DataFromScreen(ThemeName, _Data); } private void _Next() { _Data.ScreenNames.FadeToConfig = false; - _Data.ScreenNames.FadeToMain = true; _PartyMode.DataFromScreen(ThemeName, _Data); } } diff --git a/PartyModes/PartyModeTicTacToe/CPartyModeTicTacToe.cs b/PartyModes/PartyModeTicTacToe/CPartyModeTicTacToe.cs index 750e1357..d403d7cb 100644 --- a/PartyModes/PartyModeTicTacToe/CPartyModeTicTacToe.cs +++ b/PartyModes/PartyModeTicTacToe/CPartyModeTicTacToe.cs @@ -81,8 +81,6 @@ namespace VocaluxeLib.PartyModes.TicTacToe { public int CurrentRoundNr; public int Team; - public int NumPlayerTeam1; - public int NumPlayerTeam2; public int NumFields; public List Rounds; public List Songs; @@ -115,7 +113,6 @@ namespace VocaluxeLib.PartyModes.TicTacToe public struct SFromScreenNames { public bool FadeToConfig; - public bool FadeToMain; public List ProfileIDsTeam1; public List ProfileIDsTeam2; } @@ -380,8 +377,6 @@ namespace VocaluxeLib.PartyModes.TicTacToe CBase.Songs.ResetPartySongSung(); _GameData.CurrentRoundNr = 1; _ToScreenMain.CurrentRoundNr = 1; - _ToScreenMain.NumPlayerTeam1 = _GameData.NumPlayerTeam1; - _ToScreenMain.NumPlayerTeam2 = _GameData.NumPlayerTeam2; _ToScreenMain.NumFields = _GameData.NumFields; _ToScreenMain.ProfileIDsTeam1 = _GameData.ProfileIDsTeam1; _ToScreenMain.ProfileIDsTeam2 = _GameData.ProfileIDsTeam2; @@ -410,8 +405,6 @@ namespace VocaluxeLib.PartyModes.TicTacToe _UpdateSongList(); _UpdatePlayerList(); _ToScreenMain.CurrentRoundNr = _GameData.CurrentRoundNr; - _ToScreenMain.NumPlayerTeam1 = _GameData.NumPlayerTeam1; - _ToScreenMain.NumPlayerTeam2 = _GameData.NumPlayerTeam2; _ToScreenMain.NumFields = _GameData.NumFields; _ToScreenMain.ProfileIDsTeam1 = _GameData.ProfileIDsTeam1; _ToScreenMain.ProfileIDsTeam2 = _GameData.ProfileIDsTeam2; @@ -588,23 +581,23 @@ namespace VocaluxeLib.PartyModes.TicTacToe case 1: { //Prepare Player-IDs - List iDs = new List(); + List ids = new List(); //Add IDs to team-list - while (_GameData.PlayerTeam1.Count < _GameData.NumFields + _GameData.NumJokerRetry[0] && iDs.Count == 0) + while (_GameData.PlayerTeam1.Count < _GameData.NumFields + _GameData.NumJokerRetry[0] && ids.Count == 0) { - if (iDs.Count == 0) + if (ids.Count == 0) { for (int i = 0; i < _GameData.NumPlayerTeam1; i++) - iDs.Add(i); + ids.Add(i); } if (_GameData.PlayerTeam1.Count < _GameData.NumFields + _GameData.NumJokerRetry[0]) { - int random = CBase.Game.GetRandom((iDs.Count - 1) * 10); + int random = CBase.Game.GetRandom((ids.Count - 1) * 10); int num = (int)Math.Round((double)random / 10); - if (num >= iDs.Count) - num = iDs.Count - 1; - _GameData.PlayerTeam1.Add(iDs[num]); - iDs.RemoveAt(num); + if (num >= ids.Count) + num = ids.Count - 1; + _GameData.PlayerTeam1.Add(ids[num]); + ids.RemoveAt(num); } } } diff --git a/PartyModes/PartyModeTicTacToe/CPartyScreenTicTacToeMain.cs b/PartyModes/PartyModeTicTacToe/CPartyScreenTicTacToeMain.cs index dd069796..a7dbf8e1 100644 --- a/PartyModes/PartyModeTicTacToe/CPartyScreenTicTacToeMain.cs +++ b/PartyModes/PartyModeTicTacToe/CPartyScreenTicTacToeMain.cs @@ -79,7 +79,7 @@ namespace VocaluxeLib.PartyModes.TicTacToe private List _Fields; private float _FieldFirstX = 25; private float _FieldFirstY = 25; - private int _FieldSpace = 10; + private const int _FieldSpace = 10; private float _FieldSize = 100; private int _PreviewStream = -1; diff --git a/PartyModes/PartyModeTicTacToe/CPartyScreenTicTacToeNames.cs b/PartyModes/PartyModeTicTacToe/CPartyScreenTicTacToeNames.cs index 2025cdf7..588cc22f 100644 --- a/PartyModes/PartyModeTicTacToe/CPartyScreenTicTacToeNames.cs +++ b/PartyModes/PartyModeTicTacToe/CPartyScreenTicTacToeNames.cs @@ -93,7 +93,7 @@ namespace VocaluxeLib.PartyModes.TicTacToe _ThemeButtons = new string[] {_ButtonBack, _ButtonNext, _ButtonPlayerDestination, _ButtonPlayerChoose, _ButtonPlayerChooseScrollUp, _ButtonPlayerChooseScrollDown}; _Data = new SDataFromScreen(); - SFromScreenNames names = new SFromScreenNames {FadeToConfig = false, FadeToMain = false, ProfileIDsTeam1 = new List(), ProfileIDsTeam2 = new List()}; + SFromScreenNames names = new SFromScreenNames {FadeToConfig = false, ProfileIDsTeam1 = new List(), ProfileIDsTeam2 = new List()}; _Data.ScreenNames = names; } @@ -403,7 +403,7 @@ namespace VocaluxeLib.PartyModes.TicTacToe private void _UpdateButtonPlayerChoose(int offset) { - int numButtonPlayerChoose = _PlayerChooseButtonsNumW * _PlayerChooseButtonsNumH; + const int numButtonPlayerChoose = _PlayerChooseButtonsNumW * _PlayerChooseButtonsNumH; if (offset < 0) offset = 0; @@ -446,27 +446,7 @@ namespace VocaluxeLib.PartyModes.TicTacToe //Show profile only if active if (CBase.Profiles.GetProfiles()[i].Active == EOffOn.TR_CONFIG_ON) { - visible = true; - - for (int p = 0; p < _Data.ScreenNames.ProfileIDsTeam1.Count; p++) - { - //Don't show profile if is selected - if (_Data.ScreenNames.ProfileIDsTeam1[p] == i) - { - visible = false; - break; - } - } - - for (int p = 0; p < _Data.ScreenNames.ProfileIDsTeam2.Count; p++) - { - //Don't show profile if is selected - if (_Data.ScreenNames.ProfileIDsTeam2[p] == i) - { - visible = false; - break; - } - } + visible = _Data.ScreenNames.ProfileIDsTeam1.All(t => t != i) && _Data.ScreenNames.ProfileIDsTeam2.All(t => t != i); } if (visible) _PlayerChooseButtonsVisibleProfiles.Add(i); @@ -642,14 +622,12 @@ namespace VocaluxeLib.PartyModes.TicTacToe private void _Back() { _Data.ScreenNames.FadeToConfig = true; - _Data.ScreenNames.FadeToMain = false; _PartyMode.DataFromScreen(ThemeName, _Data); } private void _Next() { _Data.ScreenNames.FadeToConfig = false; - _Data.ScreenNames.FadeToMain = true; _PartyMode.DataFromScreen(ThemeName, _Data); } } diff --git a/Vocaluxe/Base/CBackgroundMusic.cs b/Vocaluxe/Base/CBackgroundMusic.cs index d4679b96..0aa110b2 100644 --- a/Vocaluxe/Base/CBackgroundMusic.cs +++ b/Vocaluxe/Base/CBackgroundMusic.cs @@ -21,6 +21,7 @@ using System; using System.Collections.Generic; using System.Diagnostics; using System.IO; +using System.Linq; using Vocaluxe.Base; using VocaluxeLib.Menu; using VocaluxeLib.Menu.SongMenu; @@ -477,12 +478,7 @@ namespace Vocaluxe.Base private static bool _IsBackgroundFile(CPlaylistElement element) { - foreach (CPlaylistElement elements in _BGMusicFileNames) - { - if (elements.MusicFilePath == element.MusicFilePath) - return true; - } - return false; + return _BGMusicFileNames.Any(elements => elements.MusicFilePath == element.MusicFilePath); } private static void _LoadVideo() diff --git a/Vocaluxe/Base/CDataBase.cs b/Vocaluxe/Base/CDataBase.cs index d44dce78..25bd8251 100644 --- a/Vocaluxe/Base/CDataBase.cs +++ b/Vocaluxe/Base/CDataBase.cs @@ -283,26 +283,6 @@ namespace Vocaluxe.Base return _GetDataBaseSongID(song.Artist, song.Title, 0, command); } - private static int _GetDataBaseSongID(string artist, string title, string filePath, int defNumPlayed) - { - using (SQLiteConnection connection = new SQLiteConnection()) - { - connection.ConnectionString = "Data Source=" + filePath; - - try - { - connection.Open(); - } - catch (Exception) - { - return -1; - } - - using (SQLiteCommand command = new SQLiteCommand(connection)) - return _GetDataBaseSongID(artist, title, defNumPlayed, command); - } - } - private static int _GetDataBaseSongID(string artist, string title, int defNumPlayed, SQLiteCommand command) { command.CommandText = "SELECT id FROM Songs WHERE [Title] = @title AND [Artist] = @artist"; diff --git a/Vocaluxe/Base/CFont.cs b/Vocaluxe/Base/CFont.cs index 2495eb4f..68a8b44d 100644 --- a/Vocaluxe/Base/CFont.cs +++ b/Vocaluxe/Base/CFont.cs @@ -23,6 +23,7 @@ using System.Drawing; using System.Drawing.Drawing2D; using System.Drawing.Text; using System.IO; +using System.Linq; using System.Text; using System.Windows.Forms; using System.Xml; @@ -39,8 +40,7 @@ namespace Vocaluxe.Base } public STexture Texture; - public char Chr; - public int Width; + public readonly int Width; public CGlyph(char chr, float maxHigh) { @@ -110,7 +110,6 @@ namespace Vocaluxe.Base * */ Texture = CDraw.AddTexture(bmp); //bmp.Save("test.png", ImageFormat.Png); - Chr = chr; Width = (int)((1f + outline / 2f) * sizeB.Width * Texture.Width / factor / bmp.Width); g.Dispose(); } @@ -158,7 +157,7 @@ namespace Vocaluxe.Base private FontFamily _Family; private readonly float _Sizeh; - public string FilePath; + public readonly string FilePath; public CFont(string file) { @@ -550,25 +549,15 @@ namespace Vocaluxe.Base public static float GetTextWidth(string text) { - float dx = 0; CFont font = _GetCurrentFont(); - foreach (char chr in text) - dx += font.GetWidth(chr); - return dx; + return text.Sum(chr => font.GetWidth(chr)); } public static float GetTextHeight(string text) { //return TextRenderer.MeasureText(text, GetFont()).Height; - float h = 0f; CFont font = _GetCurrentFont(); - foreach (char chr in text) - { - float hh = font.GetHeight(chr); - if (hh > h) - h = hh; - } - return h; + return text==""?0:text.Select(font.GetHeight).Max(); } private static void _LoadFontFiles(CXMLReader xmlReader, string fontFolder, string themeName = "", int partyModeId = -1) @@ -769,7 +758,7 @@ namespace Vocaluxe.Base private static void _BuildGlyphs() { - string text = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPGRSTUVWGXZ1234567890"; + const string text = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPGRSTUVWGXZ1234567890"; for (int i = 0; i < _Fonts.Count; i++) { diff --git a/Vocaluxe/Base/CGraphics.cs b/Vocaluxe/Base/CGraphics.cs index 84f51c5a..a6743486 100644 --- a/Vocaluxe/Base/CGraphics.cs +++ b/Vocaluxe/Base/CGraphics.cs @@ -28,14 +28,6 @@ using VocaluxeLib.PartyModes; namespace Vocaluxe.Base { - enum EPopupScreens - { - PopupPlayerControl = 0, - PopupVolumeControl = 1, - - NoPopup = -1 - } - class CCursor { private readonly Stopwatch _CursorFadingTimer; diff --git a/Vocaluxe/Base/CSongs.cs b/Vocaluxe/Base/CSongs.cs index 39ae8467..bdde132d 100644 --- a/Vocaluxe/Base/CSongs.cs +++ b/Vocaluxe/Base/CSongs.cs @@ -19,7 +19,7 @@ using System; using System.Collections.Generic; -using System.Diagnostics; +using System.Linq; using System.Threading; using VocaluxeLib.Menu; using VocaluxeLib.Menu.SongMenu; @@ -28,7 +28,7 @@ namespace Vocaluxe.Base { public struct SSongPointer { - public int SongID; + public readonly int SongID; public string SortString; public int CatIndex; @@ -56,11 +56,9 @@ namespace Vocaluxe.Base private static int _CatIndex = -1; private static readonly List _CategoriesForRandom = new List(); - private static readonly Stopwatch _CoverLoadTimer = new Stopwatch(); - - public static CSongFilter Filter = new CSongFilter(); - public static CSongSorter Sorter = new CSongSorter(); - public static CSongCategorizer Categorizer = new CSongCategorizer(); + public static readonly CSongFilter Filter = new CSongFilter(); + public static readonly CSongSorter Sorter = new CSongSorter(); + public static readonly CSongCategorizer Categorizer = new CSongCategorizer(); private static Thread _CoverLoaderThread; @@ -93,13 +91,7 @@ namespace Vocaluxe.Base { get { - int result = 0; - foreach (SSongPointer sp in Sorter.SortedSongs) - { - if (sp.Visible) - result++; - } - return result; + return Sorter.SortedSongs.Count(sp => sp.Visible); } } @@ -210,12 +202,7 @@ namespace Vocaluxe.Base public static CSong GetSong(int songID) { - foreach (CSong song in _Songs) - { - if (song.ID == songID) - return song; - } - return null; + return _Songs.FirstOrDefault(song => song.ID == songID); } public static void AddPartySongSung(int songID) diff --git a/Vocaluxe/Base/CUtility.cs b/Vocaluxe/Base/CUtility.cs index 9dbce203..d811eee6 100644 --- a/Vocaluxe/Base/CUtility.cs +++ b/Vocaluxe/Base/CUtility.cs @@ -171,7 +171,9 @@ namespace Vocaluxe.Base _KeyPressed = true; } +// ReSharper disable UnusedParameter.Global public void KeyUp(KeyEventArgs e) +// ReSharper restore UnusedParameter.Global { _CheckModifiers(); _KeyPressed = false; @@ -206,9 +208,7 @@ namespace Vocaluxe.Base private readonly Object _CopyLock = new Object(); - private bool _ModAlt; - private bool _ModCtrl; - private bool _ModShift; + private EModifier _Mod; private readonly Stopwatch _Timer; @@ -216,22 +216,19 @@ namespace Vocaluxe.Base public CMouse() { - _ModAlt = false; - _ModCtrl = false; - _ModShift = false; - _EventsPool = new List(); _CurrentPool = new List(); _Timer = new Stopwatch(); } - private void _Add(bool alt, bool shift, bool ctrl, int x, int y, bool lb, bool ld, bool rb, int wheel, bool lbh, bool rbh, bool mb, bool mbh) + private void _Add(int x, int y, bool lb, bool ld, bool rb, int wheel, bool lbh, bool rbh, bool mb, bool mbh) { + _CheckModifiers(); x = (int)(x * (float)CSettings.RenderW / CDraw.GetScreenWidth()); y = (int)(y * (float)CSettings.RenderH / CDraw.GetScreenHeight()); - SMouseEvent pool = new SMouseEvent(ESender.Mouse, alt, shift, ctrl, x, y, lb, ld, rb, -wheel / 120, lbh, rbh, mb, mbh); + SMouseEvent pool = new SMouseEvent(ESender.Mouse, _Mod, x, y, lb, ld, rb, -wheel / 120, lbh, rbh, mb, mbh); lock (_CopyLock) { @@ -247,30 +244,28 @@ namespace Vocaluxe.Base private void _CheckModifiers() { Keys keys = Control.ModifierKeys; + _Mod = EModifier.None; - _ModShift = (keys & Keys.Shift) == Keys.Shift; - _ModAlt = (keys & Keys.Alt) == Keys.Alt; - _ModCtrl = (keys & Keys.Control) == Keys.Control; + if ((keys & Keys.Shift) != 0) + _Mod |= EModifier.Shift; + if ((keys & Keys.Alt) != 0) + _Mod |= EModifier.Alt; + if ((keys & Keys.Control) != 0) + _Mod |= EModifier.Ctrl; } public void MouseMove(MouseEventArgs e) { - _CheckModifiers(); - _Add(_ModAlt, _ModShift, _ModCtrl, e.X, e.Y, false, false, false, e.Delta, e.Button == MouseButtons.Left, e.Button == MouseButtons.Right, - false, e.Button == MouseButtons.Middle); + _Add(e.X, e.Y, false, false, false, 0, e.Button == MouseButtons.Left, e.Button == MouseButtons.Right, false, e.Button == MouseButtons.Middle); } public void MouseWheel(MouseEventArgs e) { - _CheckModifiers(); - _Add(_ModAlt, _ModShift, _ModCtrl, e.X, e.Y, false, false, false, e.Delta, e.Button == MouseButtons.Left, e.Button == MouseButtons.Right, - false, e.Button == MouseButtons.Middle); + _Add(e.X, e.Y, false, false, false, e.Delta, false, false, false, false); } public void MouseDown(MouseEventArgs e) { - _CheckModifiers(); - bool lb = e.Button == MouseButtons.Left; bool ld = false; if (lb) @@ -289,11 +284,13 @@ namespace Vocaluxe.Base else _Timer.Reset(); - _Add(_ModAlt, _ModShift, _ModCtrl, e.X, e.Y, lb, ld, e.Button == MouseButtons.Right, e.Delta, false, false, + _Add(e.X, e.Y, lb, ld, e.Button == MouseButtons.Right, e.Delta, false, false, e.Button == MouseButtons.Middle, false); } +// ReSharper disable UnusedParameter.Global public void MouseUp(MouseEventArgs e) +// ReSharper restore UnusedParameter.Global { //CheckModifiers(); //Add(_ModALT, _ModSHIFT, _ModCTRL, e.X, e.Y, e.Button == MouseButtons.Left, e.Button == MouseButtons.Right, e.Delta); diff --git a/Vocaluxe/Lib/Draw/CDrawWinForm.cs b/Vocaluxe/Lib/Draw/CDrawWinForm.cs index 7c9b83bb..78203ff0 100644 --- a/Vocaluxe/Lib/Draw/CDrawWinForm.cs +++ b/Vocaluxe/Lib/Draw/CDrawWinForm.cs @@ -330,7 +330,7 @@ namespace Vocaluxe.Lib.Draw public void MakeScreenShot() { - string file = "Screenshot_"; + const string file = "Screenshot_"; string path = Path.Combine(Environment.CurrentDirectory, CSettings.FolderScreenshots); int i = 0; diff --git a/Vocaluxe/Lib/Input/CHIDAPI.cs b/Vocaluxe/Lib/Input/CHIDAPI.cs index 106994f7..cfdc847b 100644 --- a/Vocaluxe/Lib/Input/CHIDAPI.cs +++ b/Vocaluxe/Lib/Input/CHIDAPI.cs @@ -26,17 +26,19 @@ namespace Vocaluxe.Lib.Input [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)] public struct SHIDDeviceInfo { - [MarshalAs(UnmanagedType.LPTStr)] public String Path; - public ushort VendorString; - public ushort ProductID; - public String SerialNumber; - public ushort ReleaseNumber; - public String ManufacturerString; - public String ProductString; - public ushort UsagePage; - public ushort Usage; - public int InterfaceNumber; +// ReSharper disable MemberCanBePrivate.Global + [MarshalAs(UnmanagedType.LPTStr)] public readonly String Path; + public readonly ushort VendorString; + public readonly ushort ProductID; + public readonly String SerialNumber; + public readonly ushort ReleaseNumber; + public readonly String ManufacturerString; + public readonly String ProductString; + public readonly ushort UsagePage; + public readonly ushort Usage; + public readonly int InterfaceNumber; internal IntPtr Next; + // ReSharper restore MemberCanBePrivate.Global } public static class CHIDApi diff --git a/Vocaluxe/Lib/Input/WiiMote/CWiiMote.cs b/Vocaluxe/Lib/Input/WiiMote/CWiiMote.cs index 98cef67b..867458d6 100644 --- a/Vocaluxe/Lib/Input/WiiMote/CWiiMote.cs +++ b/Vocaluxe/Lib/Input/WiiMote/CWiiMote.cs @@ -277,12 +277,12 @@ namespace Vocaluxe.Lib.Input.WiiMote if (!lb && !rb && (p.X != _OldPosition.X || p.Y != _OldPosition.Y)) { - mpool = new SMouseEvent(ESender.WiiMote, false, false, false, x, y, false, false, false, wheel, lbh, false, false, false); + mpool = new SMouseEvent(ESender.WiiMote, EModifier.None, x, y, false, false, false, wheel, lbh, false, false, false); trigger = true; } else if (lb || rb) { - mpool = new SMouseEvent(ESender.WiiMote, false, false, false, x, y, lb, false, rb, wheel, false, false, false, false); + mpool = new SMouseEvent(ESender.WiiMote, EModifier.None, x, y, lb, false, rb, wheel, false, false, false, false); trigger = true; } diff --git a/Vocaluxe/Lib/Sound/COpenALPlay.cs b/Vocaluxe/Lib/Sound/COpenALPlay.cs index fffbd644..f1fe898b 100644 --- a/Vocaluxe/Lib/Sound/COpenALPlay.cs +++ b/Vocaluxe/Lib/Sound/COpenALPlay.cs @@ -17,6 +17,7 @@ // */ #endregion +using System.Linq; using OpenTK.Audio; using System; using System.Collections.Generic; @@ -312,12 +313,7 @@ namespace Vocaluxe.Lib.Sound private bool _AlreadyAdded(int stream) { - foreach (SAudioStreams st in _Streams) - { - if (st.Handle == stream) - return true; - } - return false; + return _Streams.Any(st => st.Handle == stream); } private int _GetStreamIndex(int stream) diff --git a/Vocaluxe/Lib/Sound/IRecord.cs b/Vocaluxe/Lib/Sound/IRecord.cs index 978fe81d..6d618901 100644 --- a/Vocaluxe/Lib/Sound/IRecord.cs +++ b/Vocaluxe/Lib/Sound/IRecord.cs @@ -46,7 +46,9 @@ namespace Vocaluxe.Lib.Sound public string InputName; public int Channel; +// ReSharper disable UnusedParameter.Local public SMicConfig(int dummy) +// ReSharper restore UnusedParameter.Local { DeviceName = String.Empty; DeviceDriver = String.Empty; diff --git a/Vocaluxe/Lib/Sound/Portaudio/PortAudio.cs b/Vocaluxe/Lib/Sound/Portaudio/PortAudio.cs index e8329a1a..a69b6a18 100644 --- a/Vocaluxe/Lib/Sound/Portaudio/PortAudio.cs +++ b/Vocaluxe/Lib/Sound/Portaudio/PortAudio.cs @@ -28,7 +28,9 @@ namespace Vocaluxe.Lib.Sound.PortAudio
*/ // ReSharper disable UnusedMember.Global - + // ReSharper disable FieldCanBeMadeReadOnly.Global +// ReSharper disable MemberCanBePrivate.Global + public static class CPortAudio { #region **** PORTAUDIO CALLBACKS **** @@ -50,7 +52,8 @@ namespace Vocaluxe.Lib.Sound.PortAudio public struct SPaDeviceInfo { public int StructVersion; - [MarshalAs(UnmanagedType.LPStr)] public string Name; + [MarshalAs(UnmanagedType.LPStr)] + public string Name; public int HostApi; public int MaxInputChannels; public int MaxOutputChannels; @@ -552,5 +555,7 @@ namespace Vocaluxe.Lib.Sound.PortAudio #endregion } // ReSharper restore UnusedMember.Global + // ReSharper restore FieldCanBeMadeReadOnly.Global + // ReSharper restore MemberCanBePrivate.Global } \ No newline at end of file diff --git a/Vocaluxe/Lib/Video/CVideoDecoder.cs b/Vocaluxe/Lib/Video/CVideoDecoder.cs index 2a23df81..53d96bef 100644 --- a/Vocaluxe/Lib/Video/CVideoDecoder.cs +++ b/Vocaluxe/Lib/Video/CVideoDecoder.cs @@ -18,6 +18,7 @@ #endregion using System.Collections.Generic; +using System.Linq; using VocaluxeLib.Menu; namespace Vocaluxe.Lib.Video @@ -79,12 +80,7 @@ namespace Vocaluxe.Lib.Video protected bool _AlreadyAdded(int streamID) { - foreach (SVideoStreams st in _Streams) - { - if (st.Handle == streamID) - return true; - } - return false; + return _Streams.Any(st => st.Handle == streamID); } protected int _GetStreamIndex(int streamID) diff --git a/Vocaluxe/Lib/Video/Gstreamer/CGstreamerVideoWrapper.cs b/Vocaluxe/Lib/Video/Gstreamer/CGstreamerVideoWrapper.cs index c5cb5020..88c634d3 100644 --- a/Vocaluxe/Lib/Video/Gstreamer/CGstreamerVideoWrapper.cs +++ b/Vocaluxe/Lib/Video/Gstreamer/CGstreamerVideoWrapper.cs @@ -36,7 +36,6 @@ namespace Vocaluxe.Lib.Video.Gstreamer public struct SManagedFrame { public byte[] Buffer; - public int Size; public int Width; public int Height; public float Videotime; @@ -102,7 +101,6 @@ namespace Vocaluxe.Lib.Video.Gstreamer SManagedFrame m; m.Buffer = buffer; m.Height = f.Height; - m.Size = f.Size; m.Videotime = f.Videotime; m.Width = f.Width; return m; diff --git a/Vocaluxe/Lib/Webcam/CAForgeNet.cs b/Vocaluxe/Lib/Webcam/CAForgeNet.cs index 446cf681..c53b16c6 100644 --- a/Vocaluxe/Lib/Webcam/CAForgeNet.cs +++ b/Vocaluxe/Lib/Webcam/CAForgeNet.cs @@ -87,17 +87,14 @@ namespace Vocaluxe.Lib.Webcam public bool Init() { _WebcamDevices = new FilterInfoCollection(FilterCategory.VideoInputDevice); - int num = 0; foreach (FilterInfo info in _WebcamDevices) { SWebcamDevice device = new SWebcamDevice { - ID = num, Name = info.Name, MonikerString = info.MonikerString, Capabilities = new List() }; - num++; VideoCaptureDevice tmpdev = new VideoCaptureDevice(info.MonikerString); foreach (VideoCapabilities capabilities in tmpdev.VideoCapabilities) diff --git a/Vocaluxe/Lib/Webcam/IWebcam.cs b/Vocaluxe/Lib/Webcam/IWebcam.cs index 15dd403d..32804bfc 100644 --- a/Vocaluxe/Lib/Webcam/IWebcam.cs +++ b/Vocaluxe/Lib/Webcam/IWebcam.cs @@ -25,7 +25,6 @@ namespace Vocaluxe.Lib.Webcam { struct SWebcamDevice { - public int ID; public string Name; public string MonikerString; public List Capabilities; diff --git a/Vocaluxe/Screens/CScreenHighscore.cs b/Vocaluxe/Screens/CScreenHighscore.cs index 83bfe915..b8eb3d14 100644 --- a/Vocaluxe/Screens/CScreenHighscore.cs +++ b/Vocaluxe/Screens/CScreenHighscore.cs @@ -19,6 +19,7 @@ using System; using System.Collections.Generic; +using System.Linq; using System.Windows.Forms; using Vocaluxe.Base; using VocaluxeLib.Menu; @@ -207,13 +208,7 @@ namespace Vocaluxe.Screens private bool _IsNewEntry(int id) { - for (int i = 0; i < _NewEntryIDs.Count; i++) - { - if (_NewEntryIDs[i] == id) - return true; - } - - return false; + return _NewEntryIDs.Any(t => t == id); } private void _AddScoresToDB() diff --git a/Vocaluxe/Screens/CScreenOptionsSound.cs b/Vocaluxe/Screens/CScreenOptionsSound.cs index 370b0694..8d6ddfa0 100644 --- a/Vocaluxe/Screens/CScreenOptionsSound.cs +++ b/Vocaluxe/Screens/CScreenOptionsSound.cs @@ -40,7 +40,6 @@ namespace Vocaluxe.Screens private const string _ButtonExit = "ButtonExit"; private int _BackgroundMusicVolume; - private EOffOn _BackgroundMusic; public override void Init() { @@ -142,7 +141,6 @@ namespace Vocaluxe.Screens public override void OnShow() { base.OnShow(); - _BackgroundMusic = CConfig.BackgroundMusic; _BackgroundMusicVolume = CConfig.BackgroundMusicVolume; _SelectSlides[_SelectSlideGameMusicVolume].Selection = CConfig.GameMusicVolume / 5; diff --git a/Vocaluxe/Screens/CScreenOptionsTheme.cs b/Vocaluxe/Screens/CScreenOptionsTheme.cs index 199170c8..5beca6e7 100644 --- a/Vocaluxe/Screens/CScreenOptionsTheme.cs +++ b/Vocaluxe/Screens/CScreenOptionsTheme.cs @@ -242,10 +242,5 @@ namespace Vocaluxe.Screens _ResumeBG(); } } - - private void _AfterSkinReload() - { - _Active = true; - } } } \ No newline at end of file diff --git a/Vocaluxe/Screens/CScreenProfiles.cs b/Vocaluxe/Screens/CScreenProfiles.cs index 7f8647ad..87ff1d71 100644 --- a/Vocaluxe/Screens/CScreenProfiles.cs +++ b/Vocaluxe/Screens/CScreenProfiles.cs @@ -259,7 +259,7 @@ namespace Vocaluxe.Screens private void _OnSaveSnapshot() { - string filename = "snapshot"; + const string filename = "snapshot"; int i = 0; while (File.Exists(Path.Combine(CSettings.FolderProfiles, filename + i + ".png"))) i++; diff --git a/Vocaluxe/Screens/CScreenSing.cs b/Vocaluxe/Screens/CScreenSing.cs index f8530b27..6b297c31 100644 --- a/Vocaluxe/Screens/CScreenSing.cs +++ b/Vocaluxe/Screens/CScreenSing.cs @@ -90,7 +90,7 @@ namespace Vocaluxe.Screens private int _CurrentBeat; private int _CurrentStream = -1; //private int _NextStream = -1; - private float _Volume = 100f; + private const float _Volume = 100f; private int _CurrentVideo = -1; private EAspect _VideoAspect = EAspect.Crop; private STexture _CurrentVideoTexture = new STexture(-1); @@ -769,7 +769,7 @@ namespace Vocaluxe.Screens for (int j = 0; j < CGame.NumPlayer; j++) { if (CGame.Player[j].LineNr == i) - _SingNotes[_SingBars].AddLine(_NoteLines[j], line, nr, j); + _SingNotes[_SingBars].AddLine(_NoteLines[j], line, nr); } if (i == 0 && !song.IsDuet || i == 1 && song.IsDuet) diff --git a/Vocaluxe/Screens/CScreenSong.cs b/Vocaluxe/Screens/CScreenSong.cs index f9b69d1d..b626d906 100644 --- a/Vocaluxe/Screens/CScreenSong.cs +++ b/Vocaluxe/Screens/CScreenSong.cs @@ -853,13 +853,13 @@ namespace Vocaluxe.Screens CGame.Reset(); CGame.ClearSongs(); - List iDs = new List(); + List ids = new List(); for (int i = 0; i < CSongs.AllSongs.Length; i++) - iDs.Add(i); + ids.Add(i); - while (iDs.Count > 0) + while (ids.Count > 0) { - int songNr = iDs[CGame.Rand.Next(iDs.Count)]; + int songNr = ids[CGame.Rand.Next(ids.Count)]; EGameMode gm = EGameMode.TR_GAMEMODE_NORMAL; if (CSongs.AllSongs[songNr].IsDuet) @@ -867,7 +867,7 @@ namespace Vocaluxe.Screens CGame.AddSong(songNr, gm); - iDs.Remove(songNr); + ids.Remove(songNr); } if (CGame.GetNumSongs() > 0) @@ -879,13 +879,13 @@ namespace Vocaluxe.Screens CGame.Reset(); CGame.ClearSongs(); - List iDs = new List(); + List ids = new List(); for (int i = 0; i < CSongs.VisibleSongs.Length; i++) - iDs.Add(CSongs.VisibleSongs[i].ID); + ids.Add(CSongs.VisibleSongs[i].ID); - while (iDs.Count > 0) + while (ids.Count > 0) { - int songNr = iDs[CGame.Rand.Next(iDs.Count)]; + int songNr = ids[CGame.Rand.Next(ids.Count)]; EGameMode gm = EGameMode.TR_GAMEMODE_NORMAL; if (CSongs.AllSongs[songNr].IsDuet) @@ -893,7 +893,7 @@ namespace Vocaluxe.Screens CGame.AddSong(songNr, gm); - iDs.Remove(songNr); + ids.Remove(songNr); } if (CGame.GetNumSongs() > 0) @@ -905,21 +905,21 @@ namespace Vocaluxe.Screens CGame.Reset(); CGame.ClearSongs(); - List iDs = new List(); + List ids = new List(); if (allSongs) { for (int i = 0; i < CSongs.AllSongs.Length; i++) - iDs.Add(i); + ids.Add(i); } else { for (int i = 0; i < CSongs.VisibleSongs.Length; i++) - iDs.Add(CSongs.VisibleSongs[i].ID); + ids.Add(CSongs.VisibleSongs[i].ID); } int s = 0; - while (s < numSongs && iDs.Count > 0) + while (s < numSongs && ids.Count > 0) { - int songNr = iDs[CGame.Rand.Next(iDs.Count)]; + int songNr = ids[CGame.Rand.Next(ids.Count)]; foreach (EGameMode gm in CSongs.AllSongs[songNr].AvailableGameModes) { @@ -931,7 +931,7 @@ namespace Vocaluxe.Screens } } - iDs.Remove(songNr); + ids.Remove(songNr); } if (CGame.GetNumSongs() > 0) diff --git a/Vocaluxe/Screens/CScreenTest.cs b/Vocaluxe/Screens/CScreenTest.cs index 159594ad..fbc91fbb 100644 --- a/Vocaluxe/Screens/CScreenTest.cs +++ b/Vocaluxe/Screens/CScreenTest.cs @@ -18,7 +18,6 @@ #endregion using System; -using System.IO; using System.Windows.Forms; using Vocaluxe.Base; using VocaluxeLib.Menu; @@ -33,7 +32,9 @@ namespace Vocaluxe.Screens get { return 1; } } +/* private int _TestMusic = -1; +*/ public override bool HandleInput(SKeyEvent keyEvent) { @@ -85,23 +86,25 @@ namespace Vocaluxe.Screens return true; } - private void _PlayFile() - { - if (_TestMusic == -1) - _TestMusic = CSound.Load(Path.Combine(Environment.CurrentDirectory, "Test.mp3")); + /* + private void _PlayFile() + { + if (_TestMusic == -1) + _TestMusic = CSound.Load(Path.Combine(Environment.CurrentDirectory, "Test.mp3")); - CSound.Play(_TestMusic); - CSound.Fade(_TestMusic, 100f, 2f); - } + CSound.Play(_TestMusic); + CSound.Fade(_TestMusic, 100f, 2f); + } - private void _PauseFile() - { - CSound.Pause(_TestMusic); - } - private void _FadeAndPause() - { - CSound.FadeAndPause(_TestMusic, 0f, 2f); - } + private void _PauseFile() + { + CSound.Pause(_TestMusic); + } + + private void _FadeAndPause() + { + CSound.FadeAndPause(_TestMusic, 0f, 2f); + }*/ } } \ No newline at end of file diff --git a/VocaluxeLib/Menu/CButton.cs b/VocaluxeLib/Menu/CButton.cs index a363dc1a..b3a69d15 100644 --- a/VocaluxeLib/Menu/CButton.cs +++ b/VocaluxeLib/Menu/CButton.cs @@ -45,17 +45,17 @@ namespace VocaluxeLib.Menu public SColorF Color; public SColorF SelColor; - public bool IsSelText; - public CText Text; - public CText SelText; + private bool _IsSelText; + public readonly CText Text; + private readonly CText _SelText; - public bool Reflection; - public float ReflectionSpace; - public float ReflectionHeight; + private bool _Reflection; + private float _ReflectionSpace; + private float _ReflectionHeight; - public bool SelReflection; - public float SelReflectionSpace; - public float SelReflectionHeight; + private bool _SelReflection; + private float _SelReflectionSpace; + private float _SelReflectionHeight; public bool Pressed; @@ -65,7 +65,7 @@ namespace VocaluxeLib.Menu set { Text.EditMode = value; - SelText.EditMode = value; + _SelText.EditMode = value; } } @@ -97,21 +97,21 @@ namespace VocaluxeLib.Menu Texture = new STexture(-1); SelTexture = new STexture(-1); - IsSelText = false; + _IsSelText = false; Text = new CText(_PartyModeID); - SelText = new CText(_PartyModeID); + _SelText = new CText(_PartyModeID); Selected = false; Visible = true; EditMode = false; Enabled = true; - Reflection = false; - ReflectionSpace = 0f; - ReflectionHeight = 0f; + _Reflection = false; + _ReflectionSpace = 0f; + _ReflectionHeight = 0f; - SelReflection = false; - SelReflectionSpace = 0f; - SelReflectionHeight = 0f; + _SelReflection = false; + _SelReflectionSpace = 0f; + _SelReflectionHeight = 0f; } public CButton(CButton button) @@ -131,22 +131,22 @@ namespace VocaluxeLib.Menu Texture = button.Texture; SelTexture = button.SelTexture; - IsSelText = false; + _IsSelText = false; Text = new CText(button.Text); - SelText = new CText(button.SelText); + _SelText = new CText(button._SelText); Selected = false; Visible = true; EditMode = false; _ThemeLoaded = false; Enabled = button.Enabled; - Reflection = button.Reflection; - ReflectionHeight = button.ReflectionHeight; - ReflectionSpace = button.ReflectionSpace; + _Reflection = button._Reflection; + _ReflectionHeight = button._ReflectionHeight; + _ReflectionSpace = button._ReflectionSpace; - SelReflection = button.SelReflection; - SelReflectionHeight = button.SelReflectionHeight; - SelReflectionSpace = button.SelReflectionSpace; + _SelReflection = button._SelReflection; + _SelReflectionHeight = button._SelReflectionHeight; + _SelReflectionSpace = button._SelReflectionSpace; } public bool LoadTheme(string xmlPath, string elementName, CXMLReader xmlReader, int skinIndex) @@ -187,30 +187,30 @@ namespace VocaluxeLib.Menu Text.Z = Rect.Z; if (xmlReader.ItemExists(item + "/SText")) { - IsSelText = true; - _ThemeLoaded &= SelText.LoadTheme(item, "SText", xmlReader, skinIndex, true); - SelText.Z = Rect.Z; + _IsSelText = true; + _ThemeLoaded &= _SelText.LoadTheme(item, "SText", xmlReader, skinIndex, true); + _SelText.Z = Rect.Z; } //Reflections if (xmlReader.ItemExists(item + "/Reflection")) { - Reflection = true; - _ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/Reflection/Space", ref ReflectionSpace); - _ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/Reflection/Height", ref ReflectionHeight); + _Reflection = true; + _ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/Reflection/Space", ref _ReflectionSpace); + _ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/Reflection/Height", ref _ReflectionHeight); } else - Reflection = false; + _Reflection = false; if (xmlReader.ItemExists(item + "/SReflection")) { - SelReflection = true; - _ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/SReflection/Space", ref SelReflectionSpace); - _ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/SReflection/Height", ref SelReflectionHeight); + _SelReflection = true; + _ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/SReflection/Space", ref _SelReflectionSpace); + _ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/SReflection/Height", ref _SelReflectionHeight); } else - SelReflection = false; + _SelReflection = false; if (_ThemeLoaded) { @@ -264,28 +264,28 @@ namespace VocaluxeLib.Menu } Text.SaveTheme(writer); - if (IsSelText) - SelText.SaveTheme(writer); + if (_IsSelText) + _SelText.SaveTheme(writer); writer.WriteComment(" If exists:"); writer.WriteComment(" : Reflection Space"); writer.WriteComment(" : Reflection Height"); - if (Reflection) + if (_Reflection) { writer.WriteStartElement("Reflection"); - writer.WriteElementString("Space", ReflectionSpace.ToString("#0")); - writer.WriteElementString("Height", ReflectionHeight.ToString("#0")); + writer.WriteElementString("Space", _ReflectionSpace.ToString("#0")); + writer.WriteElementString("Height", _ReflectionHeight.ToString("#0")); writer.WriteEndElement(); } writer.WriteComment(" If exists:"); writer.WriteComment(" : Reflection Space of selected button"); writer.WriteComment(" : Reflection Height of selected button"); - if (SelReflection) + if (_SelReflection) { writer.WriteStartElement("SReflection"); - writer.WriteElementString("Space", ReflectionSpace.ToString("#0")); - writer.WriteElementString("Height", ReflectionHeight.ToString("#0")); + writer.WriteElementString("Space", _ReflectionSpace.ToString("#0")); + writer.WriteElementString("Height", _ReflectionHeight.ToString("#0")); writer.WriteEndElement(); } @@ -309,41 +309,41 @@ namespace VocaluxeLib.Menu CBase.Drawing.DrawTexture(texture, Rect, Color); - if (Reflection) + if (_Reflection) { - CBase.Drawing.DrawTextureReflection(texture, Rect, Color, Rect, ReflectionSpace, ReflectionHeight); - Text.DrawRelative(Rect.X, Rect.Y, ReflectionSpace, ReflectionHeight, Rect.H); + CBase.Drawing.DrawTextureReflection(texture, Rect, Color, Rect, _ReflectionSpace, _ReflectionHeight); + Text.DrawRelative(Rect.X, Rect.Y, _ReflectionSpace, _ReflectionHeight, Rect.H); } else Text.DrawRelative(Rect.X, Rect.Y); } - else if (!IsSelText) + else if (!_IsSelText) { texture = Texture.Index != -1 ? Texture : CBase.Theme.GetSkinTexture(_Theme.SelTextureName, _PartyModeID); CBase.Drawing.DrawTexture(texture, Rect, SelColor); - if (Reflection) + if (_Reflection) { - CBase.Drawing.DrawTextureReflection(texture, Rect, SelColor, Rect, ReflectionSpace, ReflectionHeight); - Text.DrawRelative(Rect.X, Rect.Y, ReflectionSpace, ReflectionHeight, Rect.H); + CBase.Drawing.DrawTextureReflection(texture, Rect, SelColor, Rect, _ReflectionSpace, _ReflectionHeight); + Text.DrawRelative(Rect.X, Rect.Y, _ReflectionSpace, _ReflectionHeight, Rect.H); } else Text.DrawRelative(Rect.X, Rect.Y); } - else if (IsSelText) + else if (_IsSelText) { texture = SelTexture.Index != -1 ? SelTexture : CBase.Theme.GetSkinTexture(_Theme.SelTextureName, _PartyModeID); CBase.Drawing.DrawTexture(texture, Rect, SelColor); - if (Reflection) + if (_Reflection) { - CBase.Drawing.DrawTextureReflection(texture, Rect, SelColor, Rect, ReflectionSpace, ReflectionHeight); - SelText.DrawRelative(Rect.X, Rect.Y, ReflectionSpace, ReflectionHeight, Rect.H); + CBase.Drawing.DrawTextureReflection(texture, Rect, SelColor, Rect, _ReflectionSpace, _ReflectionHeight); + _SelText.DrawRelative(Rect.X, Rect.Y, _ReflectionSpace, _ReflectionHeight, Rect.H); } else - SelText.DrawRelative(Rect.X, Rect.Y); + _SelText.DrawRelative(Rect.X, Rect.Y); } } diff --git a/VocaluxeLib/Menu/CPlaylist.cs b/VocaluxeLib/Menu/CPlaylist.cs index 73063abf..b1a4184e 100644 --- a/VocaluxeLib/Menu/CPlaylist.cs +++ b/VocaluxeLib/Menu/CPlaylist.cs @@ -500,56 +500,141 @@ namespace VocaluxeLib.Menu { if (keyEvent.KeyPressed && !Char.IsControl(keyEvent.Unicode)) _Theme.ButtonPlaylistName.Text.Text = _Theme.ButtonPlaylistName.Text.Text + keyEvent.Unicode; - else if (keyEvent.Key == Keys.Enter) + else switch (keyEvent.Key) { - CBase.Playlist.SetPlaylistName(ActivePlaylistID, _Theme.ButtonPlaylistName.Text.Text); - CBase.Playlist.SavePlaylist(ActivePlaylistID); - EditMode = EEditMode.None; - _Theme.ButtonPlaylistName.EditMode = false; - } - else if (keyEvent.Key == Keys.Escape) - { - _Theme.ButtonPlaylistName.Text.Text = CBase.Playlist.GetPlaylistName(ActivePlaylistID); - EditMode = EEditMode.None; - _Theme.ButtonPlaylistName.EditMode = false; - } - else if (keyEvent.Key == Keys.Back || keyEvent.Key == Keys.Delete) - { - if (_Theme.ButtonPlaylistName.Text.Text != "") - _Theme.ButtonPlaylistName.Text.Text = _Theme.ButtonPlaylistName.Text.Text.Remove(_Theme.ButtonPlaylistName.Text.Text.Length - 1); + case Keys.Enter: + CBase.Playlist.SetPlaylistName(ActivePlaylistID, _Theme.ButtonPlaylistName.Text.Text); + CBase.Playlist.SavePlaylist(ActivePlaylistID); + EditMode = EEditMode.None; + _Theme.ButtonPlaylistName.EditMode = false; + break; + case Keys.Escape: + _Theme.ButtonPlaylistName.Text.Text = CBase.Playlist.GetPlaylistName(ActivePlaylistID); + EditMode = EEditMode.None; + _Theme.ButtonPlaylistName.EditMode = false; + break; + case Keys.Delete: + case Keys.Back: + if (_Theme.ButtonPlaylistName.Text.Text != "") + _Theme.ButtonPlaylistName.Text.Text = _Theme.ButtonPlaylistName.Text.Text.Remove(_Theme.ButtonPlaylistName.Text.Text.Length - 1); + break; } + return true; } - else + if (CurrentPlaylistElement == -1 || _PlaylistElementContents.Count == 0) { - if (CurrentPlaylistElement == -1 || _PlaylistElementContents.Count == 0) - { - //no song is selected - _Interactions.HandleInput(keyEvent); - CurrentPlaylistElement = _GetSelectedSelectionNr(); + //no song is selected + _Interactions.HandleInput(keyEvent); + CurrentPlaylistElement = _GetSelectedSelectionNr(); - if (CurrentPlaylistElement != -1) - return true; - } - else if (CurrentPlaylistElement != -1) - { - //a song is selected - int scrollLimit = _PlaylistElements.Count / 2; + if (CurrentPlaylistElement != -1) + return true; + } + else if (CurrentPlaylistElement != -1) + { + //a song is selected + int scrollLimit = _PlaylistElements.Count / 2; - //special actions if a song is selected - switch (keyEvent.Key) - { - case Keys.Up: - if (keyEvent.ModShift) + //special actions if a song is selected + switch (keyEvent.Key) + { + case Keys.Up: + if (keyEvent.ModShift) + { + _Interactions.SetInteractionToSelectSlide(_PlaylistElements[0].SelectSlide); + _Interactions.HandleInput(keyEvent); + CurrentPlaylistElement = _GetSelectedSelectionNr(); + } + else if (CurrentPlaylistElement > scrollLimit || _PlaylistElementContents.Count == 0) + { + _Interactions.HandleInput(keyEvent); + CurrentPlaylistElement = _GetSelectedSelectionNr(); + } + else if (CurrentPlaylistElement <= scrollLimit) + { + if (Offset > 0) + { + Offset--; + Update(); + } + else { - _Interactions.SetInteractionToSelectSlide(_PlaylistElements[0].SelectSlide); _Interactions.HandleInput(keyEvent); CurrentPlaylistElement = _GetSelectedSelectionNr(); } - else if (CurrentPlaylistElement > scrollLimit || _PlaylistElementContents.Count == 0) + } + break; + + case Keys.Down: + if (keyEvent.ModShift) + { + for (int i = _PlaylistElements.Count - 1; i >= 0; i--) + { + if (_PlaylistElements[i].SelectSlide.Visible) + { + _Interactions.SetInteractionToSelectSlide(_PlaylistElements[0].SelectSlide); + _Interactions.HandleInput(keyEvent); + CurrentPlaylistElement = _GetSelectedSelectionNr(); + } + } + } + else if (CurrentPlaylistElement >= scrollLimit) + { + if (Offset < _PlaylistElementContents.Count - _PlaylistElements.Count) + { + Offset++; + Update(); + } + else { _Interactions.HandleInput(keyEvent); CurrentPlaylistElement = _GetSelectedSelectionNr(); } + } + else if (CurrentPlaylistElement < scrollLimit) + { + _Interactions.HandleInput(keyEvent); + CurrentPlaylistElement = _GetSelectedSelectionNr(); + } + break; + + case Keys.Delete: + CBase.Playlist.DeletePlaylistSong(ActivePlaylistID, _PlaylistElements[CurrentPlaylistElement].Content); + UpdatePlaylist(); + + if (Offset > 0) + Offset--; + + Update(); + + if (_PlaylistElementContents.Count - 1 < CurrentPlaylistElement) + CurrentPlaylistElement = _PlaylistElementContents.Count - 1; + + if (CurrentPlaylistElement != -1) + _Interactions.SetInteractionToSelectSlide(_PlaylistElements[CurrentPlaylistElement].SelectSlide); + break; + + case Keys.Back: + ClosePlaylist(); //really? or better global? + break; + + case Keys.Enter: + _StartPlaylistSong(CurrentPlaylistElement); + break; + + case Keys.Add: //move the selected song up + if (_PlaylistElementContents.Count > 1 && (CurrentPlaylistElement > 0 || Offset > 0)) + { + CBase.Playlist.MovePlaylistSongUp(ActivePlaylistID, CurrentPlaylistElement + Offset); + UpdatePlaylist(); + + SKeyEvent key = new SKeyEvent {Key = Keys.Up}; + + if (CurrentPlaylistElement > scrollLimit) + { + _Interactions.HandleInput(key); + CurrentPlaylistElement = _GetSelectedSelectionNr(); + } else if (CurrentPlaylistElement <= scrollLimit) { if (Offset > 0) @@ -559,26 +644,22 @@ namespace VocaluxeLib.Menu } else { - _Interactions.HandleInput(keyEvent); + _Interactions.HandleInput(key); CurrentPlaylistElement = _GetSelectedSelectionNr(); } } - break; + } + break; - case Keys.Down: - if (keyEvent.ModShift) - { - for (int i = _PlaylistElements.Count - 1; i >= 0; i--) - { - if (_PlaylistElements[i].SelectSlide.Visible) - { - _Interactions.SetInteractionToSelectSlide(_PlaylistElements[0].SelectSlide); - _Interactions.HandleInput(keyEvent); - CurrentPlaylistElement = _GetSelectedSelectionNr(); - } - } - } - else if (CurrentPlaylistElement >= scrollLimit) + case Keys.Subtract: //move the selected song down + if (_PlaylistElementContents.Count > 1 && CurrentPlaylistElement + Offset < _PlaylistElementContents.Count - 1) + { + CBase.Playlist.MovePlaylistSongDown(ActivePlaylistID, CurrentPlaylistElement + Offset); + UpdatePlaylist(); + + SKeyEvent key = new SKeyEvent {Key = Keys.Down}; + + if (CurrentPlaylistElement >= scrollLimit) { if (Offset < _PlaylistElementContents.Count - _PlaylistElements.Count) { @@ -587,203 +668,127 @@ namespace VocaluxeLib.Menu } else { - _Interactions.HandleInput(keyEvent); + _Interactions.HandleInput(key); CurrentPlaylistElement = _GetSelectedSelectionNr(); } } else if (CurrentPlaylistElement < scrollLimit) { - _Interactions.HandleInput(keyEvent); + _Interactions.HandleInput(key); CurrentPlaylistElement = _GetSelectedSelectionNr(); } - break; + } + break; - case Keys.Delete: - CBase.Playlist.DeletePlaylistSong(ActivePlaylistID, _PlaylistElements[CurrentPlaylistElement].Content); - UpdatePlaylist(); + case Keys.PageUp: //scroll up + if (_PlaylistElementContents.Count > 0) + { + Offset -= _PlaylistElements.Count; - if (Offset > 0) - Offset--; + if (Offset < 0) + Offset = 0; + + Update(); + CurrentPlaylistElement = 0; + } + break; + + case Keys.PageDown: //scroll down + if (_PlaylistElementContents.Count > 0) + { + Offset += _PlaylistElements.Count; + + if (Offset > _PlaylistElementContents.Count - _PlaylistElements.Count) + Offset = _PlaylistElementContents.Count - _PlaylistElements.Count; + + if (Offset < 0) + Offset = 0; Update(); - if (_PlaylistElementContents.Count - 1 < CurrentPlaylistElement) - CurrentPlaylistElement = _PlaylistElementContents.Count - 1; - - if (CurrentPlaylistElement != -1) - _Interactions.SetInteractionToSelectSlide(_PlaylistElements[CurrentPlaylistElement].SelectSlide); - break; - - case Keys.Back: - ClosePlaylist(); //really? or better global? - break; - - case Keys.Enter: - _StartPlaylistSong(CurrentPlaylistElement); - break; - - case Keys.Add: //move the selected song up - if (_PlaylistElementContents.Count > 1 && (CurrentPlaylistElement > 0 || Offset > 0)) + for (int i = _PlaylistElements.Count - 1; i >= 0; i--) { - CBase.Playlist.MovePlaylistSongUp(ActivePlaylistID, CurrentPlaylistElement + Offset); - UpdatePlaylist(); - - SKeyEvent key = new SKeyEvent {Key = Keys.Up}; - - if (CurrentPlaylistElement > scrollLimit) + if (_PlaylistElements[i].SelectSlide.Visible) { - _Interactions.HandleInput(key); - CurrentPlaylistElement = _GetSelectedSelectionNr(); - } - else if (CurrentPlaylistElement <= scrollLimit) - { - if (Offset > 0) - { - Offset--; - Update(); - } - else - { - _Interactions.HandleInput(key); - CurrentPlaylistElement = _GetSelectedSelectionNr(); - } + CurrentPlaylistElement = i; + break; } } - break; + } + break; - case Keys.Subtract: //move the selected song down - if (_PlaylistElementContents.Count > 1 && CurrentPlaylistElement + Offset < _PlaylistElementContents.Count - 1) - { - CBase.Playlist.MovePlaylistSongDown(ActivePlaylistID, CurrentPlaylistElement + Offset); - UpdatePlaylist(); + case Keys.Left: + _Interactions.HandleInput(keyEvent); + CurrentPlaylistElement = _GetSelectedSelectionNr(); - SKeyEvent key = new SKeyEvent {Key = Keys.Down}; + if (CurrentPlaylistElement != -1) + { + CBase.Playlist.GetPlaylistSong(ActivePlaylistID, CurrentPlaylistElement + Offset).GameMode = + _PlaylistElementContents[CurrentPlaylistElement + Offset].Modes[_PlaylistElements[CurrentPlaylistElement].SelectSlide.Selection]; + UpdatePlaylist(); + } + break; - if (CurrentPlaylistElement >= scrollLimit) - { - if (Offset < _PlaylistElementContents.Count - _PlaylistElements.Count) - { - Offset++; - Update(); - } - else - { - _Interactions.HandleInput(key); - CurrentPlaylistElement = _GetSelectedSelectionNr(); - } - } - else if (CurrentPlaylistElement < scrollLimit) - { - _Interactions.HandleInput(key); - CurrentPlaylistElement = _GetSelectedSelectionNr(); - } - } - break; + case Keys.Right: + _Interactions.HandleInput(keyEvent); + CurrentPlaylistElement = _GetSelectedSelectionNr(); - case Keys.PageUp: //scroll up - if (_PlaylistElementContents.Count > 0) - { - Offset -= _PlaylistElements.Count; - - if (Offset < 0) - Offset = 0; - - Update(); - CurrentPlaylistElement = 0; - } - break; - - case Keys.PageDown: //scroll down - if (_PlaylistElementContents.Count > 0) - { - Offset += _PlaylistElements.Count; - - if (Offset > _PlaylistElementContents.Count - _PlaylistElements.Count) - Offset = _PlaylistElementContents.Count - _PlaylistElements.Count; - - if (Offset < 0) - Offset = 0; - - Update(); - - for (int i = _PlaylistElements.Count - 1; i >= 0; i--) - { - if (_PlaylistElements[i].SelectSlide.Visible) - { - CurrentPlaylistElement = i; - break; - } - } - } - break; - - case Keys.Left: - _Interactions.HandleInput(keyEvent); - CurrentPlaylistElement = _GetSelectedSelectionNr(); - - if (CurrentPlaylistElement != -1) - { - CBase.Playlist.GetPlaylistSong(ActivePlaylistID, CurrentPlaylistElement + Offset).GameMode = - _PlaylistElementContents[CurrentPlaylistElement + Offset].Modes[_PlaylistElements[CurrentPlaylistElement].SelectSlide.Selection]; - UpdatePlaylist(); - } - break; - - case Keys.Right: - _Interactions.HandleInput(keyEvent); - CurrentPlaylistElement = _GetSelectedSelectionNr(); - - if (CurrentPlaylistElement != -1) - { - CBase.Playlist.GetPlaylistSong(ActivePlaylistID, CurrentPlaylistElement + Offset).GameMode = - _PlaylistElementContents[CurrentPlaylistElement + Offset].Modes[_PlaylistElements[CurrentPlaylistElement].SelectSlide.Selection]; - UpdatePlaylist(); - } - break; - } - return true; + if (CurrentPlaylistElement != -1) + { + CBase.Playlist.GetPlaylistSong(ActivePlaylistID, CurrentPlaylistElement + Offset).GameMode = + _PlaylistElementContents[CurrentPlaylistElement + Offset].Modes[_PlaylistElements[CurrentPlaylistElement].SelectSlide.Selection]; + UpdatePlaylist(); + } + break; } + return true; + } - //default actions - switch (keyEvent.Key) - { - case Keys.Back: - if (_Theme.ButtonPlaylistName.Selected) + //default actions + switch (keyEvent.Key) + { + case Keys.Back: + if (_Theme.ButtonPlaylistName.Selected) + { + EditMode = EEditMode.PlaylistName; + _Theme.ButtonPlaylistName.EditMode = true; + } + else + ClosePlaylist(); + break; + + case Keys.Enter: + if (_Theme.ButtonPlaylistClose.Selected) + ClosePlaylist(); + else if (_Theme.ButtonPlaylistSing.Selected) + _StartPlaylistSongs(); + else if (_Theme.ButtonPlaylistSave.Selected) + CBase.Playlist.SavePlaylist(ActivePlaylistID); + else if (_Theme.ButtonPlaylistDelete.Selected) + { + CBase.Playlist.DeletePlaylist(ActivePlaylistID); + ClosePlaylist(); + } + else if (_Theme.ButtonPlaylistName.Selected) + { + if (EditMode != EEditMode.PlaylistName) { EditMode = EEditMode.PlaylistName; _Theme.ButtonPlaylistName.EditMode = true; } else - ClosePlaylist(); - break; - - case Keys.Enter: - if (_Theme.ButtonPlaylistClose.Selected) - ClosePlaylist(); - else if (_Theme.ButtonPlaylistSing.Selected) - _StartPlaylistSongs(); - else if (_Theme.ButtonPlaylistSave.Selected) - CBase.Playlist.SavePlaylist(ActivePlaylistID); - else if (_Theme.ButtonPlaylistDelete.Selected) { - CBase.Playlist.DeletePlaylist(ActivePlaylistID); - ClosePlaylist(); + EditMode = EEditMode.None; + _Theme.ButtonPlaylistName.EditMode = false; } - else if (_Theme.ButtonPlaylistName.Selected) - { - if (EditMode != EEditMode.PlaylistName) - { - EditMode = EEditMode.PlaylistName; - _Theme.ButtonPlaylistName.EditMode = true; - } - else - { - EditMode = EEditMode.None; - _Theme.ButtonPlaylistName.EditMode = false; - } - } - break; - } + } + break; + case Keys.PageDown: + _SetSelectionToLastEntry(); + break; + case Keys.PageUp: + _SetSelectionToFirstEntry(); + break; } } return true; diff --git a/VocaluxeLib/Menu/CSelectSlide.cs b/VocaluxeLib/Menu/CSelectSlide.cs index 66ad5b95..7216166c 100644 --- a/VocaluxeLib/Menu/CSelectSlide.cs +++ b/VocaluxeLib/Menu/CSelectSlide.cs @@ -115,7 +115,7 @@ namespace VocaluxeLib.Menu private readonly List _ValueBounds = new List(); - public bool WithTextures; + public readonly bool WithTextures; private int _Selection = -1; public int Selection diff --git a/VocaluxeLib/Menu/CText.cs b/VocaluxeLib/Menu/CText.cs index bddbede2..ea864d79 100644 --- a/VocaluxeLib/Menu/CText.cs +++ b/VocaluxeLib/Menu/CText.cs @@ -40,13 +40,13 @@ namespace VocaluxeLib.Menu public float Width; public float Height; - public STextPosition(int dummy) + public STextPosition(float initVal) { - X = 0f; - Y = 0f; - TextHeight = 0f; - Width = 0f; - Height = 0f; + X = initVal; + Y = initVal; + TextHeight = initVal; + Width = initVal; + Height = initVal; } } diff --git a/VocaluxeLib/Menu/Enums.cs b/VocaluxeLib/Menu/Enums.cs index b42b9ec1..adb7e4a7 100644 --- a/VocaluxeLib/Menu/Enums.cs +++ b/VocaluxeLib/Menu/Enums.cs @@ -95,10 +95,12 @@ namespace VocaluxeLib.Menu public enum EColorDepth { +// ReSharper disable UnusedMember.Global Bit8 = 8, Bit16 = 16, Bit24 = 24, Bit32 = 32 + // ReSharper restore UnusedMember.Global } public enum ETextureQuality @@ -339,4 +341,12 @@ namespace VocaluxeLib.Menu ScreenNull = -1 } + + public enum EPopupScreens + { + PopupPlayerControl = 0, + PopupVolumeControl = 1, + + NoPopup = -1 + } } \ No newline at end of file diff --git a/VocaluxeLib/Menu/SingNotes/CNotes.cs b/VocaluxeLib/Menu/SingNotes/CNotes.cs index 1794834c..3dd5a648 100644 --- a/VocaluxeLib/Menu/SingNotes/CNotes.cs +++ b/VocaluxeLib/Menu/SingNotes/CNotes.cs @@ -19,6 +19,7 @@ using System; using System.Collections.Generic; +using System.Linq; namespace VocaluxeLib.Menu.SingNotes { @@ -572,19 +573,8 @@ namespace VocaluxeLib.Menu.SingNotes if (_Lines.Count == 0) return 0; - int startbeat = int.MaxValue; - for (int i = 0; i < _Lines.Count; i++) - { - if (_Lines[i].FirstNoteBeat < startbeat) - startbeat = _Lines[i].FirstNoteBeat; - } - - int endbeat = int.MinValue; - for (int i = 0; i < _Lines.Count; i++) - { - if (_Lines[i].LastNoteBeat < endbeat) - endbeat = _Lines[i].LastNoteBeat; - } + int startbeat = _Lines.Max(line => line.FirstNoteBeat); + int endbeat = _Lines.Min(line => line.LastNoteBeat); int result = endbeat - startbeat; if (result > 0) @@ -609,13 +599,7 @@ namespace VocaluxeLib.Menu.SingNotes { get { - int num = 0; - foreach (CLine line in _Lines) - { - if (line.Points > 0f) - num++; - } - return num; + return _Lines.Count(line => line.Points > 0f); } } diff --git a/VocaluxeLib/Menu/SingNotes/CSingNotes.cs b/VocaluxeLib/Menu/SingNotes/CSingNotes.cs index 06c227e8..573e11b8 100644 --- a/VocaluxeLib/Menu/SingNotes/CSingNotes.cs +++ b/VocaluxeLib/Menu/SingNotes/CSingNotes.cs @@ -195,13 +195,13 @@ namespace VocaluxeLib.Menu.SingNotes return false; } - public virtual void Reset() + public void Reset() { _PlayerNotes.Clear(); _ActID = 0; } - public virtual int AddPlayer(SRectF rect, SColorF color, int playerNr) + public int AddPlayer(SRectF rect, SColorF color, int playerNr) { SPlayerNotes notes = new SPlayerNotes { @@ -224,9 +224,7 @@ namespace VocaluxeLib.Menu.SingNotes return notes.ID; } - public virtual void RemovePlayer(int id) {} - - public virtual void AddLine(int id, CLine[] line, int lineNr, int player) + public void AddLine(int id, CLine[] line, int lineNr) { if (line == null) return; @@ -238,11 +236,11 @@ namespace VocaluxeLib.Menu.SingNotes if (lineNr == _PlayerNotes[n].LineNr) return; - SPlayerNotes notes = _PlayerNotes[n]; - if (line.Length <= lineNr) return; + SPlayerNotes notes = _PlayerNotes[n]; + notes.Lines = line; notes.LineNr = lineNr; notes.GoldenStars.Clear(); @@ -253,11 +251,7 @@ namespace VocaluxeLib.Menu.SingNotes _PlayerNotes.Add(notes); } - public virtual void RemoveLine(int id) {} - - public virtual void AddNote(int id, CNote note) {} - - public virtual void SetAlpha(int id, float alpha) + public void SetAlpha(int id, float alpha) { int n = _FindPlayerLine(id); if (n == -1) @@ -268,7 +262,7 @@ namespace VocaluxeLib.Menu.SingNotes _PlayerNotes[n] = pn; } - public virtual float GetAlpha(int id) + public float GetAlpha(int id) { int n = _FindPlayerLine(id); if (n == -1) @@ -277,12 +271,12 @@ namespace VocaluxeLib.Menu.SingNotes return _PlayerNotes[n].Alpha; } - public virtual void Draw(int id, int player) + public void Draw(int id, int player) { Draw(id, null, player); } - public virtual void Draw(int id, List singLine, int player) + public void Draw(int id, List singLine, int player) { int n = _FindPlayerLine(id); if (n == -1) @@ -463,9 +457,6 @@ namespace VocaluxeLib.Menu.SingNotes private int _FindPlayerLine(int id) { - if (id < 0 || id > _PlayerNotes.Count) - return -1; - for (int i = 0; i < _PlayerNotes.Count; i++) { if (_PlayerNotes[i].ID == id) diff --git a/VocaluxeLib/Menu/SongMenu/CSong.cs b/VocaluxeLib/Menu/SongMenu/CSong.cs index f0e14732..fdfb37cf 100644 --- a/VocaluxeLib/Menu/SongMenu/CSong.cs +++ b/VocaluxeLib/Menu/SongMenu/CSong.cs @@ -47,7 +47,7 @@ namespace VocaluxeLib.Menu.SongMenu public class CCategory { - public string Name = String.Empty; + public readonly string Name; private STexture _CoverTextureSmall = new STexture(-1); private STexture _CoverTextureBig = new STexture(-1); private bool _CoverBigLoaded; @@ -100,7 +100,9 @@ namespace VocaluxeLib.Menu.SongMenu public float FadeInTime; public float FadeOutTime; +// ReSharper disable UnusedParameter.Local public SMedley(int dummy) +// ReSharper restore UnusedParameter.Local { Source = EMedleySource.None; StartBeat = 0; @@ -210,11 +212,11 @@ namespace VocaluxeLib.Menu.SongMenu get { return Notes.Lines.Length > 1; } } - public List Edition = new List(); - public List Genre = new List(); + public readonly List Edition = new List(); + public readonly List Genre = new List(); public string Year = ""; - public List Language = new List(); + public readonly List Language = new List(); // Notes public readonly CNotes Notes = new CNotes(); diff --git a/VocaluxeLib/Menu/SongMenu/CSongMenuFramework.cs b/VocaluxeLib/Menu/SongMenu/CSongMenuFramework.cs index e4cc0766..77d3f50b 100644 --- a/VocaluxeLib/Menu/SongMenu/CSongMenuFramework.cs +++ b/VocaluxeLib/Menu/SongMenu/CSongMenuFramework.cs @@ -95,7 +95,7 @@ namespace VocaluxeLib.Menu.SongMenu abstract class CSongMenuFramework : ISongMenu { - protected int _PartyModeID; + protected readonly int _PartyModeID; protected SThemeSongMenu _Theme; private bool _ThemeLoaded; @@ -164,7 +164,7 @@ namespace VocaluxeLib.Menu.SongMenu } } - protected virtual void _SetSelectedNow() + protected void _SetSelectedNow() { _Timer.Stop(); _Timer.Reset(); @@ -425,7 +425,7 @@ namespace VocaluxeLib.Menu.SongMenu _Initialized = true; } - public virtual void UpdateRect(SRectF rect) + public void UpdateRect(SRectF rect) { _Rect = rect; Init(); diff --git a/VocaluxeLib/Menu/SongMenu/CSongMenuTileBoard.cs b/VocaluxeLib/Menu/SongMenu/CSongMenuTileBoard.cs index 7ed861c6..6a81f68e 100644 --- a/VocaluxeLib/Menu/SongMenu/CSongMenuTileBoard.cs +++ b/VocaluxeLib/Menu/SongMenu/CSongMenuTileBoard.cs @@ -20,6 +20,7 @@ using System; using System.Collections.Generic; using System.Drawing; +using System.Linq; using System.Windows.Forms; using VocaluxeLib.PartyModes; @@ -180,15 +181,7 @@ namespace VocaluxeLib.Menu.SongMenu keyEvent.Key == Keys.PageDown || keyEvent.Key == Keys.PageUp)) return; - bool sel = false; - foreach (CStatic tile in _Tiles) - { - if (tile.Selected) - { - sel = true; - break; - } - } + bool sel = _Tiles.Any(tile => tile.Selected); if ((_Locked == -1 || !sel) && (keyEvent.Key != Keys.Escape && keyEvent.Key != Keys.Back && keyEvent.Key != Keys.PageUp && keyEvent.Key != Keys.PageDown)) @@ -500,15 +493,7 @@ namespace VocaluxeLib.Menu.SongMenu protected void _SetSelectedTile(int itemNr) { - bool sel = false; - foreach (CStatic tile in _Tiles) - { - if (tile.Selected) - { - sel = true; - break; - } - } + bool sel = _Tiles.Any(tile => tile.Selected); if (_Locked == -1 || !sel) { diff --git a/VocaluxeLib/Menu/Structs.cs b/VocaluxeLib/Menu/Structs.cs index 38a334e6..daaf1eed 100644 --- a/VocaluxeLib/Menu/Structs.cs +++ b/VocaluxeLib/Menu/Structs.cs @@ -137,15 +137,15 @@ namespace VocaluxeLib.Menu #region Inputs public struct SKeyEvent { - public ESender Sender; - public bool ModAlt; - public bool ModShift; - public bool ModCtrl; - public bool KeyPressed; + public readonly ESender Sender; + public readonly bool ModAlt; + public readonly bool ModShift; + public readonly bool ModCtrl; + public readonly bool KeyPressed; public bool Handled; public Keys Key; - public Char Unicode; - public EModifier Mod; + public readonly Char Unicode; + public readonly EModifier Mod; public SKeyEvent(ESender sender, bool alt, bool shift, bool ctrl, bool pressed, char unicode, Keys key) { @@ -171,27 +171,25 @@ namespace VocaluxeLib.Menu public struct SMouseEvent { - public ESender Sender; + public readonly ESender Sender; public bool Handled; - public int X; - public int Y; - public bool LB; //left button click - public bool LD; //left button double click - public bool RB; //right button click - public bool MB; //middle button click + public readonly int X; + public readonly int Y; + public readonly bool LB; //left button click + public readonly bool LD; //left button double click + public readonly bool RB; //right button click + public readonly bool MB; //middle button click - public bool LBH; //left button hold (when moving) - public bool RBH; //right button hold (when moving) - public bool MBH; //middle button hold (when moving) + public readonly bool LBH; //left button hold (when moving) +// ReSharper disable MemberCanBePrivate.Global + public readonly bool RBH; //right button hold (when moving) + public readonly bool MBH; //middle button hold (when moving) + // ReSharper restore MemberCanBePrivate.Global - public bool ModAlt; - public bool ModShift; - public bool ModCtrl; + public readonly EModifier Mod; + public readonly int Wheel; - public EModifier Mod; - public int Wheel; - - public SMouseEvent(ESender sender, bool alt, bool shift, bool ctrl, int x, int y, bool lb, bool ld, bool rb, int wheel, bool lbh, bool rbh, bool mb, bool mbh) + public SMouseEvent(ESender sender, EModifier mod, int x, int y, bool lb, bool ld, bool rb, int wheel, bool lbh, bool rbh, bool mb, bool mbh) { Sender = sender; Handled = false; @@ -206,27 +204,7 @@ namespace VocaluxeLib.Menu RBH = rbh; MBH = mbh; - ModAlt = alt; - ModShift = shift; - ModCtrl = ctrl; - - EModifier mAlt = EModifier.None; - EModifier mShift = EModifier.None; - EModifier mCtrl = EModifier.None; - - if (alt) - mAlt = EModifier.Alt; - - if (shift) - mShift = EModifier.Shift; - - if (ctrl) - mCtrl = EModifier.Ctrl; - - if (!alt && !shift && !ctrl) - Mod = EModifier.None; - else - Mod = mAlt | mShift | mCtrl; + Mod = mod; Wheel = wheel; } @@ -250,7 +228,9 @@ namespace VocaluxeLib.Menu public string FileName; public STexture Texture; +// ReSharper disable UnusedParameter.Local public SAvatar(int dummy) +// ReSharper restore UnusedParameter.Local { FileName = String.Empty; Texture = new STexture(-1); From 69d8af4e87e7744620ef0f13254647903fce9cd4 Mon Sep 17 00:00:00 2001 From: Flamefire Date: Wed, 24 Apr 2013 01:26:36 +0200 Subject: [PATCH 18/27] Automatic cleanup/formating --- .../PartyModeChallenge/CPartyModeChallenge.cs | 3 +- .../CPartyScreenChallengeMain.cs | 6 ++- .../CChallengeRounds.cs | 6 --- .../CPartyModeChallengeMedley.cs | 3 +- .../CPartyScreenChallengeMedleyMain.cs | 6 ++- .../CPartyScreenChallengeMedleyNames.cs | 3 +- .../CPartyScreenTicTacToeNames.cs | 5 +-- Vocaluxe/Base/CConfig.cs | 15 +++---- Vocaluxe/Base/CDataBase.cs | 4 +- Vocaluxe/Base/CFont.cs | 2 +- Vocaluxe/Base/CGraphics.cs | 3 +- Vocaluxe/Base/CMain.cs | 2 +- Vocaluxe/Base/CParty.cs | 3 +- Vocaluxe/Base/CPlaylists.cs | 3 +- Vocaluxe/Base/CSettings.cs | 1 - Vocaluxe/Base/CSongSorter.cs | 2 +- Vocaluxe/Base/CSongs.cs | 5 +-- Vocaluxe/Base/CUtility.cs | 8 ++-- Vocaluxe/Lib/Input/CHIDAPI.cs | 2 +- Vocaluxe/Lib/Sound/CGstreamerAudio.cs | 1 - Vocaluxe/Lib/Sound/IRecord.cs | 4 +- Vocaluxe/Lib/Sound/Portaudio/PortAudio.cs | 9 ++--- Vocaluxe/Screens/CScreenCredits.cs | 3 +- Vocaluxe/Screens/CScreenSing.cs | 8 +--- Vocaluxe/Screens/CScreenSong.cs | 2 - Vocaluxe/Screens/CScreenTest.cs | 2 +- VocaluxeLib/Menu/CNameSelection.cs | 10 +++-- VocaluxeLib/Menu/CPlaylist.cs | 39 ++++++++++--------- VocaluxeLib/Menu/Enums.cs | 16 ++++---- VocaluxeLib/Menu/SingNotes/CNotes.cs | 5 +-- VocaluxeLib/Menu/SongMenu/CSong.cs | 6 +-- VocaluxeLib/Menu/Structs.cs | 6 +-- 32 files changed, 93 insertions(+), 100 deletions(-) diff --git a/PartyModes/PartyModeChallenge/CPartyModeChallenge.cs b/PartyModes/PartyModeChallenge/CPartyModeChallenge.cs index 500c3551..e1e74466 100644 --- a/PartyModes/PartyModeChallenge/CPartyModeChallenge.cs +++ b/PartyModes/PartyModeChallenge/CPartyModeChallenge.cs @@ -636,7 +636,8 @@ namespace VocaluxeLib.PartyModes.Challenge int pos = 1; int lastPoints = 0; int lastSingPoints = 0; - foreach (CResultTableRow resultRow in _GameData.ResultTable) { + foreach (CResultTableRow resultRow in _GameData.ResultTable) + { if (lastPoints > resultRow.NumGamePoints || lastSingPoints > resultRow.NumSingPoints) pos++; resultRow.Position = pos; diff --git a/PartyModes/PartyModeChallenge/CPartyScreenChallengeMain.cs b/PartyModes/PartyModeChallenge/CPartyScreenChallengeMain.cs index edd15420..85730d80 100644 --- a/PartyModes/PartyModeChallenge/CPartyScreenChallengeMain.cs +++ b/PartyModes/PartyModeChallenge/CPartyScreenChallengeMain.cs @@ -409,7 +409,8 @@ namespace VocaluxeLib.PartyModes.Challenge _RoundsTable.Add(rtr); } //Create statics and texts for rounds - foreach (CRoundsTableRow roundRow in _RoundsTable) { + foreach (CRoundsTableRow roundRow in _RoundsTable) + { //Round-number CText text = GetNewText(_Texts[_TextRoundNumber]); _AddText(text); @@ -451,7 +452,8 @@ namespace VocaluxeLib.PartyModes.Challenge float delta = _Texts[_TextRoundNumber].Height; //Update statics and texts for rounds - foreach (CRoundsTableRow roundRow in _RoundsTable) { + foreach (CRoundsTableRow roundRow in _RoundsTable) + { //Round-number roundRow.Number.X = numberX; roundRow.Number.Y = numberY; diff --git a/PartyModes/PartyModeChallengeMedley/CChallengeRounds.cs b/PartyModes/PartyModeChallengeMedley/CChallengeRounds.cs index 2a3bc286..4114320b 100644 --- a/PartyModes/PartyModeChallengeMedley/CChallengeRounds.cs +++ b/PartyModes/PartyModeChallengeMedley/CChallengeRounds.cs @@ -157,21 +157,15 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley //filter against PlayerNrDemand List combsFiltered = new List(); if (playerNrDemand != null) - { combsFiltered.AddRange(_Combs.Where(t => t.IsAvailableAll(playerNrDemand))); - } //1st fallback if (playerNrDemand != null && combsFiltered.Count == 0) - { combsFiltered.AddRange(_Combs.Where(t => t.IsAvailableSomeone(playerNrDemand))); - } //2nd fallback if (combsFiltered.Count == 0) - { combsFiltered.AddRange(_Combs); - } int num = combsFiltered.Count; int rand = _Rand.Next(num); diff --git a/PartyModes/PartyModeChallengeMedley/CPartyModeChallengeMedley.cs b/PartyModes/PartyModeChallengeMedley/CPartyModeChallengeMedley.cs index 76d3fd64..409ee742 100644 --- a/PartyModes/PartyModeChallengeMedley/CPartyModeChallengeMedley.cs +++ b/PartyModes/PartyModeChallengeMedley/CPartyModeChallengeMedley.cs @@ -702,7 +702,8 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley int pos = 1; int lastPoints = 0; int lastSingPoints = 0; - foreach (CResultTableRow resultRow in _GameData.ResultTable) { + foreach (CResultTableRow resultRow in _GameData.ResultTable) + { if (lastPoints > resultRow.NumGamePoints || lastSingPoints > resultRow.NumSingPoints) pos++; resultRow.Position = pos; diff --git a/PartyModes/PartyModeChallengeMedley/CPartyScreenChallengeMedleyMain.cs b/PartyModes/PartyModeChallengeMedley/CPartyScreenChallengeMedleyMain.cs index aa5b60a8..02343aa0 100644 --- a/PartyModes/PartyModeChallengeMedley/CPartyScreenChallengeMedleyMain.cs +++ b/PartyModes/PartyModeChallengeMedley/CPartyScreenChallengeMedleyMain.cs @@ -409,7 +409,8 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley _RoundsTable.Add(rtr); } //Create statics and texts for rounds - foreach (CRoundsTableRow roundRow in _RoundsTable) { + foreach (CRoundsTableRow roundRow in _RoundsTable) + { //Round-number CText text = GetNewText(_Texts[_TextRoundNumber]); _AddText(text); @@ -451,7 +452,8 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley float delta = _Texts[_TextRoundNumber].Height; //Update statics and texts for rounds - foreach (CRoundsTableRow roundRow in _RoundsTable) { + foreach (CRoundsTableRow roundRow in _RoundsTable) + { //Round-number roundRow.Number.X = numberX; roundRow.Number.Y = numberY; diff --git a/PartyModes/PartyModeChallengeMedley/CPartyScreenChallengeMedleyNames.cs b/PartyModes/PartyModeChallengeMedley/CPartyScreenChallengeMedleyNames.cs index 8ca5bfec..e073f362 100644 --- a/PartyModes/PartyModeChallengeMedley/CPartyScreenChallengeMedleyNames.cs +++ b/PartyModes/PartyModeChallengeMedley/CPartyScreenChallengeMedleyNames.cs @@ -453,7 +453,8 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley private bool _OnAdd() { - foreach (CPlayerChooseButton chooseButton in _PlayerChooseButtons) { + foreach (CPlayerChooseButton chooseButton in _PlayerChooseButtons) + { if (chooseButton.Button.Selected && chooseButton.ProfileID != -1) { if (_Data.ScreenNames.ProfileIDs.Count < _NumPlayer) diff --git a/PartyModes/PartyModeTicTacToe/CPartyScreenTicTacToeNames.cs b/PartyModes/PartyModeTicTacToe/CPartyScreenTicTacToeNames.cs index 588cc22f..9e29b916 100644 --- a/PartyModes/PartyModeTicTacToe/CPartyScreenTicTacToeNames.cs +++ b/PartyModes/PartyModeTicTacToe/CPartyScreenTicTacToeNames.cs @@ -173,7 +173,8 @@ namespace VocaluxeLib.PartyModes.TicTacToe _OldMouseX = mouseEvent.X; _OldMouseY = mouseEvent.Y; //Check if mouse if over tile - foreach (CPlayerChooseButton chooseButton in _PlayerChooseButtons) { + foreach (CPlayerChooseButton chooseButton in _PlayerChooseButtons) + { if (chooseButton.Button.Selected) { _SelectedPlayerNr = chooseButton.ProfileID; @@ -445,9 +446,7 @@ namespace VocaluxeLib.PartyModes.TicTacToe bool visible = false; //Show profile only if active if (CBase.Profiles.GetProfiles()[i].Active == EOffOn.TR_CONFIG_ON) - { visible = _Data.ScreenNames.ProfileIDsTeam1.All(t => t != i) && _Data.ScreenNames.ProfileIDsTeam2.All(t => t != i); - } if (visible) _PlayerChooseButtonsVisibleProfiles.Add(i); } diff --git a/Vocaluxe/Base/CConfig.cs b/Vocaluxe/Base/CConfig.cs index 32f00ea8..bb43c7a2 100644 --- a/Vocaluxe/Base/CConfig.cs +++ b/Vocaluxe/Base/CConfig.cs @@ -121,13 +121,14 @@ namespace Vocaluxe.Base public static int BackgroundMusicVolume { get { return _BackgroundMusicVolume; } - set { - if (value < 0) - _BackgroundMusicVolume = 0; - else if (value > 100) - _BackgroundMusicVolume = 100; - else - _BackgroundMusicVolume = value; + set + { + if (value < 0) + _BackgroundMusicVolume = 0; + else if (value > 100) + _BackgroundMusicVolume = 100; + else + _BackgroundMusicVolume = value; SaveConfig(); } } diff --git a/Vocaluxe/Base/CDataBase.cs b/Vocaluxe/Base/CDataBase.cs index 25bd8251..a06ea759 100644 --- a/Vocaluxe/Base/CDataBase.cs +++ b/Vocaluxe/Base/CDataBase.cs @@ -1223,7 +1223,7 @@ namespace Vocaluxe.Base } //If you want to add an image to db, call this method! -/* + /* private static bool _AddImageToCreditsDB(String imagePath) { bool result = false; @@ -1353,7 +1353,7 @@ namespace Vocaluxe.Base return true; } -/* + /* private static void _CreateCreditsRessourcesDB() { using (SQLiteConnection connection = new SQLiteConnection()) diff --git a/Vocaluxe/Base/CFont.cs b/Vocaluxe/Base/CFont.cs index 68a8b44d..7b9b8cf0 100644 --- a/Vocaluxe/Base/CFont.cs +++ b/Vocaluxe/Base/CFont.cs @@ -557,7 +557,7 @@ namespace Vocaluxe.Base { //return TextRenderer.MeasureText(text, GetFont()).Height; CFont font = _GetCurrentFont(); - return text==""?0:text.Select(font.GetHeight).Max(); + return text == "" ? 0 : text.Select(font.GetHeight).Max(); } private static void _LoadFontFiles(CXMLReader xmlReader, string fontFolder, string themeName = "", int partyModeId = -1) diff --git a/Vocaluxe/Base/CGraphics.cs b/Vocaluxe/Base/CGraphics.cs index a6743486..b228a042 100644 --- a/Vocaluxe/Base/CGraphics.cs +++ b/Vocaluxe/Base/CGraphics.cs @@ -265,7 +265,8 @@ namespace Vocaluxe.Base CLog.StopBenchmark(1, "Load Theme " + Enum.GetNames(typeof(EScreens))[i]); } - foreach (IMenu popup in _PopupScreens) { + foreach (IMenu popup in _PopupScreens) + { popup.Init(); popup.LoadTheme(CTheme.GetThemeScreensPath(-1)); } diff --git a/Vocaluxe/Base/CMain.cs b/Vocaluxe/Base/CMain.cs index 59e7d962..47d6c0f3 100644 --- a/Vocaluxe/Base/CMain.cs +++ b/Vocaluxe/Base/CMain.cs @@ -58,7 +58,7 @@ namespace Vocaluxe.Base { public void SetBackgroundMusicVolume(int newVolume) { - CConfig.BackgroundMusicVolume = newVolume; + CConfig.BackgroundMusicVolume = newVolume; } public int GetBackgroundMusicVolume() diff --git a/Vocaluxe/Base/CParty.cs b/Vocaluxe/Base/CParty.cs index 9d9baee4..1cbd1485 100644 --- a/Vocaluxe/Base/CParty.cs +++ b/Vocaluxe/Base/CParty.cs @@ -101,7 +101,8 @@ namespace Vocaluxe.Base int[] pmIDs = new int[_PartyModes.Count]; _PartyModes.Keys.CopyTo(pmIDs, 0); - foreach (int pmID in pmIDs) { + foreach (int pmID in pmIDs) + { if (pmID != _NormalGameModeID) { SPartyMode mode; diff --git a/Vocaluxe/Base/CPlaylists.cs b/Vocaluxe/Base/CPlaylists.cs index 7611d242..78d4343f 100644 --- a/Vocaluxe/Base/CPlaylists.cs +++ b/Vocaluxe/Base/CPlaylists.cs @@ -262,7 +262,8 @@ namespace Vocaluxe.Base string artist = line.Substring(0, pos - 1).Trim(); string title = line.Substring(pos + 1, line.Length - pos - 1).Trim(); bool found = false; - foreach (CSong song in allSongs) { + foreach (CSong song in allSongs) + { if (song.Artist == artist && song.Title == title) { pl.AddSong(song.ID); diff --git a/Vocaluxe/Base/CSettings.cs b/Vocaluxe/Base/CSettings.cs index 9ac6659c..5fa38628 100644 --- a/Vocaluxe/Base/CSettings.cs +++ b/Vocaluxe/Base/CSettings.cs @@ -47,7 +47,6 @@ namespace Vocaluxe.Base public static EGameState GameState = EGameState.Start; - //Adjusting of programName and version now in the assembly config. //I'd use the major and minor for Main releases, build number for every public release and revision for every bugfix version without any features //As it is different than before, this is open for discussion. diff --git a/Vocaluxe/Base/CSongSorter.cs b/Vocaluxe/Base/CSongSorter.cs index 96e39b3d..6d10957b 100644 --- a/Vocaluxe/Base/CSongSorter.cs +++ b/Vocaluxe/Base/CSongSorter.cs @@ -92,7 +92,7 @@ namespace Vocaluxe.Base if (_IgnoreArticles == EOffOn.TR_CONFIG_ON) { res = String.Compare(CSongs.Songs[s1.SongID].ArtistSorting, CSongs.Songs[s2.SongID].ArtistSorting, StringComparison.OrdinalIgnoreCase); - return res != 0 ? res: String.Compare(CSongs.Songs[s1.SongID].TitleSorting, CSongs.Songs[s2.SongID].TitleSorting, StringComparison.OrdinalIgnoreCase); + return res != 0 ? res : String.Compare(CSongs.Songs[s1.SongID].TitleSorting, CSongs.Songs[s2.SongID].TitleSorting, StringComparison.OrdinalIgnoreCase); } res = String.Compare(CSongs.Songs[s1.SongID].Artist, CSongs.Songs[s2.SongID].Artist, StringComparison.OrdinalIgnoreCase); return res != 0 ? res : String.Compare(CSongs.Songs[s1.SongID].Title, CSongs.Songs[s2.SongID].Title, StringComparison.OrdinalIgnoreCase); diff --git a/Vocaluxe/Base/CSongs.cs b/Vocaluxe/Base/CSongs.cs index bdde132d..b2780e53 100644 --- a/Vocaluxe/Base/CSongs.cs +++ b/Vocaluxe/Base/CSongs.cs @@ -89,10 +89,7 @@ namespace Vocaluxe.Base public static int NumVisibleSongs { - get - { - return Sorter.SortedSongs.Count(sp => sp.Visible); - } + get { return Sorter.SortedSongs.Count(sp => sp.Visible); } } public static int NumCategories diff --git a/Vocaluxe/Base/CUtility.cs b/Vocaluxe/Base/CUtility.cs index d811eee6..5751a797 100644 --- a/Vocaluxe/Base/CUtility.cs +++ b/Vocaluxe/Base/CUtility.cs @@ -171,9 +171,9 @@ namespace Vocaluxe.Base _KeyPressed = true; } -// ReSharper disable UnusedParameter.Global + // ReSharper disable UnusedParameter.Global public void KeyUp(KeyEventArgs e) -// ReSharper restore UnusedParameter.Global + // ReSharper restore UnusedParameter.Global { _CheckModifiers(); _KeyPressed = false; @@ -288,9 +288,9 @@ namespace Vocaluxe.Base e.Button == MouseButtons.Middle, false); } -// ReSharper disable UnusedParameter.Global + // ReSharper disable UnusedParameter.Global public void MouseUp(MouseEventArgs e) -// ReSharper restore UnusedParameter.Global + // ReSharper restore UnusedParameter.Global { //CheckModifiers(); //Add(_ModALT, _ModSHIFT, _ModCTRL, e.X, e.Y, e.Button == MouseButtons.Left, e.Button == MouseButtons.Right, e.Delta); diff --git a/Vocaluxe/Lib/Input/CHIDAPI.cs b/Vocaluxe/Lib/Input/CHIDAPI.cs index cfdc847b..d90e50d7 100644 --- a/Vocaluxe/Lib/Input/CHIDAPI.cs +++ b/Vocaluxe/Lib/Input/CHIDAPI.cs @@ -26,7 +26,7 @@ namespace Vocaluxe.Lib.Input [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)] public struct SHIDDeviceInfo { -// ReSharper disable MemberCanBePrivate.Global + // ReSharper disable MemberCanBePrivate.Global [MarshalAs(UnmanagedType.LPTStr)] public readonly String Path; public readonly ushort VendorString; public readonly ushort ProductID; diff --git a/Vocaluxe/Lib/Sound/CGstreamerAudio.cs b/Vocaluxe/Lib/Sound/CGstreamerAudio.cs index 0d033842..cc207e3e 100644 --- a/Vocaluxe/Lib/Sound/CGstreamerAudio.cs +++ b/Vocaluxe/Lib/Sound/CGstreamerAudio.cs @@ -28,7 +28,6 @@ namespace Vocaluxe.Lib.Sound //static float LastPosition; #region log - private static void _LogHandler(string text) { CLog.LogError(text); diff --git a/Vocaluxe/Lib/Sound/IRecord.cs b/Vocaluxe/Lib/Sound/IRecord.cs index 6d618901..2246f3e3 100644 --- a/Vocaluxe/Lib/Sound/IRecord.cs +++ b/Vocaluxe/Lib/Sound/IRecord.cs @@ -46,9 +46,9 @@ namespace Vocaluxe.Lib.Sound public string InputName; public int Channel; -// ReSharper disable UnusedParameter.Local + // ReSharper disable UnusedParameter.Local public SMicConfig(int dummy) -// ReSharper restore UnusedParameter.Local + // ReSharper restore UnusedParameter.Local { DeviceName = String.Empty; DeviceDriver = String.Empty; diff --git a/Vocaluxe/Lib/Sound/Portaudio/PortAudio.cs b/Vocaluxe/Lib/Sound/Portaudio/PortAudio.cs index a69b6a18..8b357690 100644 --- a/Vocaluxe/Lib/Sound/Portaudio/PortAudio.cs +++ b/Vocaluxe/Lib/Sound/Portaudio/PortAudio.cs @@ -29,8 +29,8 @@ namespace Vocaluxe.Lib.Sound.PortAudio */ // ReSharper disable UnusedMember.Global // ReSharper disable FieldCanBeMadeReadOnly.Global -// ReSharper disable MemberCanBePrivate.Global - + // ReSharper disable MemberCanBePrivate.Global + public static class CPortAudio { #region **** PORTAUDIO CALLBACKS **** @@ -52,8 +52,7 @@ namespace Vocaluxe.Lib.Sound.PortAudio public struct SPaDeviceInfo { public int StructVersion; - [MarshalAs(UnmanagedType.LPStr)] - public string Name; + [MarshalAs(UnmanagedType.LPStr)] public string Name; public int HostApi; public int MaxInputChannels; public int MaxOutputChannels; @@ -554,8 +553,8 @@ namespace Vocaluxe.Lib.Sound.PortAudio public static extern void Pa_Sleep(int msec); #endregion } + // ReSharper restore UnusedMember.Global // ReSharper restore FieldCanBeMadeReadOnly.Global // ReSharper restore MemberCanBePrivate.Global - } \ No newline at end of file diff --git a/Vocaluxe/Screens/CScreenCredits.cs b/Vocaluxe/Screens/CScreenCredits.cs index d8a17f78..2105392e 100644 --- a/Vocaluxe/Screens/CScreenCredits.cs +++ b/Vocaluxe/Screens/CScreenCredits.cs @@ -201,7 +201,8 @@ namespace Vocaluxe.Screens //Prepare Text int lastY = 280; - foreach (string[] paragraph in _Paragraphs) { + foreach (string[] paragraph in _Paragraphs) + { string line = ""; for (int e = 0; e < paragraph.Length; e++) { diff --git a/Vocaluxe/Screens/CScreenSing.cs b/Vocaluxe/Screens/CScreenSing.cs index 6b297c31..d507ab2f 100644 --- a/Vocaluxe/Screens/CScreenSing.cs +++ b/Vocaluxe/Screens/CScreenSing.cs @@ -631,9 +631,7 @@ namespace Vocaluxe.Screens if (CGame.GetNumSongs() > 1) { for (int i = 0; i < CGame.NumPlayer; i++) - { - CGame.Player[i].LineNr = (i+1) % 2; - } + CGame.Player[i].LineNr = (i + 1) % 2; } else { @@ -644,9 +642,7 @@ namespace Vocaluxe.Screens _SetDuetLyricsVisibility(song.IsDuet); for (int p = 0; p < CGame.NumPlayer; p++) - { - _NoteLines[p] = _SingNotes[_SingBars].AddPlayer(_SingNotes[_SingBars].BarPos[p, CGame.NumPlayer - 1],CTheme.GetPlayerColor(p + 1),p); - } + _NoteLines[p] = _SingNotes[_SingBars].AddPlayer(_SingNotes[_SingBars].BarPos[p, CGame.NumPlayer - 1], CTheme.GetPlayerColor(p + 1), p); /* case 4: diff --git a/Vocaluxe/Screens/CScreenSong.cs b/Vocaluxe/Screens/CScreenSong.cs index b626d906..054fddf3 100644 --- a/Vocaluxe/Screens/CScreenSong.cs +++ b/Vocaluxe/Screens/CScreenSong.cs @@ -802,9 +802,7 @@ namespace Vocaluxe.Screens if (_AvailableGameModes.Count >= _SelectSlides[_SelectSlideOptionsMode].Selection) gm = _AvailableGameModes[_SelectSlides[_SelectSlideOptionsMode].Selection]; else - { gm = CSongs.VisibleSongs[songNr].IsDuet ? EGameMode.TR_GAMEMODE_DUET : EGameMode.TR_GAMEMODE_NORMAL; - } CGame.Reset(); CGame.ClearSongs(); diff --git a/Vocaluxe/Screens/CScreenTest.cs b/Vocaluxe/Screens/CScreenTest.cs index fbc91fbb..3fa3f2e4 100644 --- a/Vocaluxe/Screens/CScreenTest.cs +++ b/Vocaluxe/Screens/CScreenTest.cs @@ -32,7 +32,7 @@ namespace Vocaluxe.Screens get { return 1; } } -/* + /* private int _TestMusic = -1; */ diff --git a/VocaluxeLib/Menu/CNameSelection.cs b/VocaluxeLib/Menu/CNameSelection.cs index 5ed4a934..29a2e73e 100644 --- a/VocaluxeLib/Menu/CNameSelection.cs +++ b/VocaluxeLib/Menu/CNameSelection.cs @@ -106,10 +106,12 @@ namespace VocaluxeLib.Menu { _PrepareTiles(); - _PlayerSelector = new CStatic(_PartyModeID) { - Texture = _TextureTileSelected, - Rect = new SRectF(0, 0, _TileW + 6, _TileH + 6, Rect.Z - 0.5f), - Visible = false}; + _PlayerSelector = new CStatic(_PartyModeID) + { + Texture = _TextureTileSelected, + Rect = new SRectF(0, 0, _TileW + 6, _TileH + 6, Rect.Z - 0.5f), + Visible = false + }; _UpdateVisibleProfiles(); diff --git a/VocaluxeLib/Menu/CPlaylist.cs b/VocaluxeLib/Menu/CPlaylist.cs index b1a4184e..95f02019 100644 --- a/VocaluxeLib/Menu/CPlaylist.cs +++ b/VocaluxeLib/Menu/CPlaylist.cs @@ -500,24 +500,27 @@ namespace VocaluxeLib.Menu { if (keyEvent.KeyPressed && !Char.IsControl(keyEvent.Unicode)) _Theme.ButtonPlaylistName.Text.Text = _Theme.ButtonPlaylistName.Text.Text + keyEvent.Unicode; - else switch (keyEvent.Key) + else { - case Keys.Enter: - CBase.Playlist.SetPlaylistName(ActivePlaylistID, _Theme.ButtonPlaylistName.Text.Text); - CBase.Playlist.SavePlaylist(ActivePlaylistID); - EditMode = EEditMode.None; - _Theme.ButtonPlaylistName.EditMode = false; - break; - case Keys.Escape: - _Theme.ButtonPlaylistName.Text.Text = CBase.Playlist.GetPlaylistName(ActivePlaylistID); - EditMode = EEditMode.None; - _Theme.ButtonPlaylistName.EditMode = false; - break; - case Keys.Delete: - case Keys.Back: - if (_Theme.ButtonPlaylistName.Text.Text != "") - _Theme.ButtonPlaylistName.Text.Text = _Theme.ButtonPlaylistName.Text.Text.Remove(_Theme.ButtonPlaylistName.Text.Text.Length - 1); - break; + switch (keyEvent.Key) + { + case Keys.Enter: + CBase.Playlist.SetPlaylistName(ActivePlaylistID, _Theme.ButtonPlaylistName.Text.Text); + CBase.Playlist.SavePlaylist(ActivePlaylistID); + EditMode = EEditMode.None; + _Theme.ButtonPlaylistName.EditMode = false; + break; + case Keys.Escape: + _Theme.ButtonPlaylistName.Text.Text = CBase.Playlist.GetPlaylistName(ActivePlaylistID); + EditMode = EEditMode.None; + _Theme.ButtonPlaylistName.EditMode = false; + break; + case Keys.Delete: + case Keys.Back: + if (_Theme.ButtonPlaylistName.Text.Text != "") + _Theme.ButtonPlaylistName.Text.Text = _Theme.ButtonPlaylistName.Text.Text.Remove(_Theme.ButtonPlaylistName.Text.Text.Length - 1); + break; + } } return true; } @@ -786,7 +789,7 @@ namespace VocaluxeLib.Menu case Keys.PageDown: _SetSelectionToLastEntry(); break; - case Keys.PageUp: + case Keys.PageUp: _SetSelectionToFirstEntry(); break; } diff --git a/VocaluxeLib/Menu/Enums.cs b/VocaluxeLib/Menu/Enums.cs index adb7e4a7..469b2084 100644 --- a/VocaluxeLib/Menu/Enums.cs +++ b/VocaluxeLib/Menu/Enums.cs @@ -95,7 +95,7 @@ namespace VocaluxeLib.Menu public enum EColorDepth { -// ReSharper disable UnusedMember.Global + // ReSharper disable UnusedMember.Global Bit8 = 8, Bit16 = 16, Bit24 = 24, @@ -127,9 +127,9 @@ namespace VocaluxeLib.Menu // ReSharper disable InconsistentNaming // don't change the order! TR_CONFIG_OFF, //no debug infos -// ReSharper disable UnusedMember.Global + // ReSharper disable UnusedMember.Global TR_CONFIG_ONLY_FPS, -// ReSharper restore UnusedMember.Global + // ReSharper restore UnusedMember.Global TR_CONFIG_LEVEL1, TR_CONFIG_LEVEL2, TR_CONFIG_LEVEL3, @@ -216,9 +216,9 @@ namespace VocaluxeLib.Menu public enum ECoverLoading { // ReSharper disable InconsistentNaming -// ReSharper disable UnusedMember.Global + // ReSharper disable UnusedMember.Global TR_CONFIG_COVERLOADING_ONDEMAND, -// ReSharper restore UnusedMember.Global + // ReSharper restore UnusedMember.Global TR_CONFIG_COVERLOADING_ATSTART, TR_CONFIG_COVERLOADING_DYNAMIC // ReSharper restore InconsistentNaming @@ -231,7 +231,7 @@ namespace VocaluxeLib.Menu TR_CONFIG_EASY, TR_CONFIG_NORMAL, TR_CONFIG_HARD -// ReSharper restore UnusedMember.Global + // ReSharper restore UnusedMember.Global // ReSharper restore InconsistentNaming } @@ -267,9 +267,9 @@ namespace VocaluxeLib.Menu TR_CONFIG_PLAYERINFO_BOTH, TR_CONFIG_PLAYERINFO_NAME, TR_CONFIG_PLAYERINFO_AVATAR, -// ReSharper disable UnusedMember.Global + // ReSharper disable UnusedMember.Global TR_CONFIG_PLAYERINFO_OFF -// ReSharper restore UnusedMember.Global + // ReSharper restore UnusedMember.Global // ReSharper restore InconsistentNaming } diff --git a/VocaluxeLib/Menu/SingNotes/CNotes.cs b/VocaluxeLib/Menu/SingNotes/CNotes.cs index 3dd5a648..db10fa90 100644 --- a/VocaluxeLib/Menu/SingNotes/CNotes.cs +++ b/VocaluxeLib/Menu/SingNotes/CNotes.cs @@ -597,10 +597,7 @@ namespace VocaluxeLib.Menu.SingNotes public int NumLinesWithPoints { - get - { - return _Lines.Count(line => line.Points > 0f); - } + get { return _Lines.Count(line => line.Points > 0f); } } #region Methods diff --git a/VocaluxeLib/Menu/SongMenu/CSong.cs b/VocaluxeLib/Menu/SongMenu/CSong.cs index fdfb37cf..c30535c5 100644 --- a/VocaluxeLib/Menu/SongMenu/CSong.cs +++ b/VocaluxeLib/Menu/SongMenu/CSong.cs @@ -100,9 +100,9 @@ namespace VocaluxeLib.Menu.SongMenu public float FadeInTime; public float FadeOutTime; -// ReSharper disable UnusedParameter.Local + // ReSharper disable UnusedParameter.Local public SMedley(int dummy) -// ReSharper restore UnusedParameter.Local + // ReSharper restore UnusedParameter.Local { Source = EMedleySource.None; StartBeat = 0; @@ -883,9 +883,7 @@ namespace VocaluxeLib.Menu.SongMenu // build sentences list List sentences = new List(); foreach (CLine line in lines.Line) - { sentences.Add(line.Points != 0 ? line.Lyrics : String.Empty); - } // find equal sentences series List series = new List(); diff --git a/VocaluxeLib/Menu/Structs.cs b/VocaluxeLib/Menu/Structs.cs index daaf1eed..6d0fefbe 100644 --- a/VocaluxeLib/Menu/Structs.cs +++ b/VocaluxeLib/Menu/Structs.cs @@ -181,7 +181,7 @@ namespace VocaluxeLib.Menu public readonly bool MB; //middle button click public readonly bool LBH; //left button hold (when moving) -// ReSharper disable MemberCanBePrivate.Global + // ReSharper disable MemberCanBePrivate.Global public readonly bool RBH; //right button hold (when moving) public readonly bool MBH; //middle button hold (when moving) // ReSharper restore MemberCanBePrivate.Global @@ -228,9 +228,9 @@ namespace VocaluxeLib.Menu public string FileName; public STexture Texture; -// ReSharper disable UnusedParameter.Local + // ReSharper disable UnusedParameter.Local public SAvatar(int dummy) -// ReSharper restore UnusedParameter.Local + // ReSharper restore UnusedParameter.Local { FileName = String.Empty; Texture = new STexture(-1); From c44c4de339ee1508d8323a2994c94d022c8f6f3a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20K=C3=BCpper?= Date: Thu, 25 Apr 2013 12:43:49 +0200 Subject: [PATCH 19/27] Added medley-countdown, ref #3 TODO: Fix ugly big numbers... --- Output/Themes/Ambient/Screens/ScreenSing.xml | 34 ++++++++++++++++- .../Themes/Changelog/Changelog_ScreenSing.txt | 6 +++ Vocaluxe/Screens/CScreenSing.cs | 37 ++++++++++++++++++- 3 files changed, 74 insertions(+), 3 deletions(-) diff --git a/Output/Themes/Ambient/Screens/ScreenSing.xml b/Output/Themes/Ambient/Screens/ScreenSing.xml index e5c7c0bf..f42d5a99 100644 --- a/Output/Themes/Ambient/Screens/ScreenSing.xml +++ b/Output/Themes/Ambient/Screens/ScreenSing.xml @@ -1,7 +1,7 @@  - 6 + 7 None @@ -988,6 +988,36 @@ + + + 640 + 18 + + -1,00 + + 32 + + + + + TextColor + + + TextSColor + + Left + + Center + + + + Outline + + + + + + 1214 @@ -2771,4 +2801,4 @@ - \ No newline at end of file + diff --git a/Output/Themes/Changelog/Changelog_ScreenSing.txt b/Output/Themes/Changelog/Changelog_ScreenSing.txt index 85b859da..51b97fd8 100644 --- a/Output/Themes/Changelog/Changelog_ScreenSing.txt +++ b/Output/Themes/Changelog/Changelog_ScreenSing.txt @@ -1,5 +1,11 @@ ScreenSing ++++++++++ +Version 7 + +Add: + !text-position and size will be overwritten by vocaluxe! + +++++++++ Version 6 diff --git a/Vocaluxe/Screens/CScreenSing.cs b/Vocaluxe/Screens/CScreenSing.cs index e9769d91..89e3cf21 100644 --- a/Vocaluxe/Screens/CScreenSing.cs +++ b/Vocaluxe/Screens/CScreenSing.cs @@ -16,7 +16,7 @@ namespace Vocaluxe.Screens // Version number for theme files. Increment it, if you've changed something on the theme files! protected override int _ScreenVersion { - get { return 6; } + get { return 7; } } private struct STimeRect @@ -31,6 +31,7 @@ namespace Vocaluxe.Screens private const string _TextPause = "TextPause"; private const string _TextDuetName1 = "TextDuetName1"; private const string _TextDuetName2 = "TextDuetName2"; + private const string _TextMedleyCountdown = "TextMedleyCountdown"; private string[,] _TextScores; private string[,] _TextNames; @@ -105,6 +106,7 @@ namespace Vocaluxe.Screens texts.Add(_TextPause); texts.Add(_TextDuetName1); texts.Add(_TextDuetName2); + texts.Add(_TextMedleyCountdown); _BuildTextStrings(ref texts); _ThemeTexts = texts.ToArray(); @@ -435,6 +437,8 @@ namespace Vocaluxe.Screens { if (_Active) { + _UpdateMedleyCountdown(); + if (_CurrentVideo != -1 && CConfig.VideosInSongs == EOffOn.TR_CONFIG_ON && !_Webcam) { RectangleF bounds = new RectangleF(0, 0, CSettings.RenderW, CSettings.RenderH); @@ -499,6 +503,9 @@ namespace Vocaluxe.Screens _DrawLyricHelper(); + if (CGame.GameMode == EGameMode.TR_GAMEMODE_MEDLEY) + Texts[_TextMedleyCountdown].Draw(); + if (_Pause) { Statics[_StaticPauseBG].ForceDraw(); @@ -936,6 +943,34 @@ namespace Vocaluxe.Screens Statics[_StaticLyricHelperDuet].Alpha = 0f; } + private void _UpdateMedleyCountdown() + { + if (CGame.GetSong() != null) + { + CSong song = CGame.GetSong(); + float currentTime = _CurrentTime - song.Start; + float timeToFirstMedleyNote = (CGame.GetTimeFromBeats(song.Medley.StartBeat, song.BPM) + song.Gap - song.Start); + if (currentTime < timeToFirstMedleyNote && CGame.GameMode == EGameMode.TR_GAMEMODE_MEDLEY) + { + Texts[_TextMedleyCountdown].Visible = true; + float timeDiff = timeToFirstMedleyNote - currentTime + 1; + double t = timeDiff - Math.Truncate(timeDiff); + float h = (float)(t * CSettings.RenderH); + float w = CFonts.GetTextBounds(Texts[_TextMedleyCountdown], h).Width; + float x = CSettings.RenderW / 2 - w / 2; + float y = CSettings.RenderH / 2 - h / 2 ; + Texts[_TextMedleyCountdown].X = x; + Texts[_TextMedleyCountdown].Y = y; + Texts[_TextMedleyCountdown].Height = h; + Texts[_TextMedleyCountdown].Text = Math.Round((decimal)(timeDiff - t)).ToString(); + } + else + { + Texts[_TextMedleyCountdown].Visible = false; + } + } + } + private void _DrawLyricHelper() { if (_FadeOut) From c86f2b2f0a8ddb25be59a3c3e4dadae6c95eb2cf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20K=C3=BCpper?= Date: Thu, 25 Apr 2013 14:22:55 +0200 Subject: [PATCH 20/27] Added Flamefire to credits. --- Output/CreditsRessourcesDB.sqlite | Bin 5701632 -> 6193152 bytes Vocaluxe/Screens/CScreenCredits.cs | 3 +++ 2 files changed, 3 insertions(+) diff --git a/Output/CreditsRessourcesDB.sqlite b/Output/CreditsRessourcesDB.sqlite index 3f960232776480f5bd4ffddbc3a2326c0ecdab78..5701709f31b8cc96984c3087fd5e53fc057d979d 100644 GIT binary patch delta 91372 zcmb@v30%~5{y)AbFdt-S1{h+Hff?dHbVfN;u7LyuL1$1zOAE}a@&L2jYN)8(YQrvG zmF{BOVP%DFwOHEXc9-sA$97pkrt$ED<`TWd$jQaNd?eDky|2%xbFrUxoeZ1bU z`}KOiZEO2#=ykt~+$yXFU)0 zOguiKXJgOAz5nS?ha+-TsQJwNkl&>b8@6!C+@%W^UUbQV(XGoC4eS2h`kq6lf($`t z4EOBASbo>-Iqo^^+4uiXuid&~=jPsW*fR_;91si$0fYi{00j^R7y$?e=m8OcGXMsF z5fBN80z?B$fEYRKIWsCW^jZ5^GwcJXSQU7ckU?43jJNsQ|m6x`i`>Rdu+S8J+6IZdwjd4J)u3Z z-P&$zPijA_J-I!lJ+(cpJ-t1nJ+nQlJ^Q&FrR@yE0qcJIKIfpz+w^10k-z{ks4s(i zf(CPZhVUoWct&Ah@Aq6Ys^^(EM-A$F98VdCE1iQm!OCd=jnO~9b~ISuiZ|^38}?t^ zxCu8L{u_>=H-aAMInk99W(->wnj7-Fpso5`88aa?qbFr`&PRs!QSGDK?d^{CG3{g9 zbKCRU^VFK<7)ePVk>du4l7`=s{j_L}y|?X~T7 z?Ni#Pw!7Nh?e*=`+NZZSw9ja7yywi|;-J=`-{Id&psg){&43pHF90?HdIG@D{Eqkd z44-`|F!=wB_JP~0hlQ`bK06<%*mOff{!mneY()Fd{8#MZt)zZ6<-G#*ENqp*NnkM|8FVi;TgYM692 zT5_bxXit%@CqnbY8Wm?0-v=o<;yhZO(bKoHV!k@=0kMBK!6w!@7Mt|$j?EDJl{tFp zxMzBCkKv!=KMH0$HgR5ZrDmI&?rNXkET|Ycr zx<1MnebhO z*(Ck^h6|RazA3E37j~Q(oa?Y-=5Q*;9^QJt;=K$iVY`?^w*@t(j^TUp6q?@?Nnb_KF6x zbe&VENQ=Ryh~cE7m;Tlqlk{C(n%Co7oI5^%v;J=tEVDG)#GYrz0G@SVxFMBzFRjij z{mZ8VqjpOfNBU&2cwW)xh-(pM?HOg!OW*SaK<2A@y%=`mJMRp$Q97o^E8=?$810@5 z{M)1XaF#`#D+tU!vou4T(K>Wst29dY>oc$j{h>z5y($?<$pU(A>5s}0ds?Egr{$*f zH;1jqw1=^0%&#CfMS9yBP14ebPVKM9V3O}d8KtQt&L$mmfdW@drCxgHVdA&F9b*({ zNv>Yj+*@yy-rI7GJsmZ9ZNrGijegE>Evsu4*Zh&iV!zgfXSk@njle_q*>Q?kO;|v~ zH#J7tc7CZzy0(?;C3{nhqsQ8jH(sUA_F>{(SZETv)lv*3hbq#0MWJ4FPv|4ZyC+Rt z>Z&?>+0?4DTc%c)w-TmQlr8_?fcFzdnro%(RBf!d_SB|Gk15M2JLeTT)_cD#A1>bU zNpqxWW}VyrqoXha)NxlR)**t6F&<;=wqVHi8}dTrNmov|c$)1Yvhnd4omhjg7~b>E z3P{zWMA*-D*Up_YZA#Pm4X!!T{7J?nuJB{Q{^@ijm71mL>kNyyt{I0prRGL>^6WX& z&vn;bwRG;Bu4`K_+Hw6QOFmt7)g?Z{h6mUFKf|5v*Q)RG{kBUMe|AmFh3{T=;RP=) zZaVkRjZ>nvFy^LzzWM4)-`?-PlXnVqH97d8e(}+J@2WTX5PQ;4MKmoqw*hoq zuuzKU7sQM25>U8(GkC)FU4~7(@pU;I#in7DiD0HxrE{d^nb1|z@=c0G`ag~V$KC`^ z-}YKn*hDll2H1a?%@3UrKfm~Fw>kulQ3H;3C>+?gPwGQ;2{MqU)5)`++rTO>KxVl* z^~Rq5vl1XTR3_<~1o^Y;_B?Y+8kR8|U~IYv2gAaH($|ukTd11*(6YLm5r$2 z7cXz#btL-_`w_G0p>c1tM zMPH_im5w!bMO;s2Wb{}EBi9B?(>G9t9j)WcVqK^QnLk~vh-Y+hn4xrh-VD%5H%9~n z1{TPg(8@ulsCXq#dHdRyi{5FT;a-KsC<5dI95VRlJP4uj(``L{50-Bah`GM<+zRpR zPl4F^LVut5N}=+bq9C$8WephC>llG&QCx@tE!Y65p!Q}^ksL3Z;0ih={qs`IvhA!9 z&=fUsP|bC^I#TKUz%*RfLDKHrRbrHt2TCHtFImv^X9@|RUG^2>&HisAD`oK8$UOcq zNt8X?W+EMuMoAZ~^Ur@cJ1wO~+EU8W#gIRJBkhlzVbUE3b<=So!zf;JB9z5Xp^%YZ zgcghUJ$<`)-Ur+G{#t;kd{C^H#cx5%cU{*AWbO%7^r@If7DWW-VLuuo*-pc=w|8E`7B)|hHEBU#M2$Wmg?Oc^c>Bk zaCJRk4(`Z}kk;Q9DW~T`me@5X;UZZ*PuD6N=OmaEikcf%Ed4}mOXB0D=_(p@uVffW zq0d2%a$TM8XT?cdxGr1lr)r@WpN?52{b%URQft5u&pDWqZzK$k?u)_j9qCvE*Nikp z7JpV_3@(Ovl|6G3rbzQ;Iz?TEtCudM?><%Bn@1#zVOXQ7r}y*7`+~(6RS#^$noP3Z zszm6B{GkKBh6C0sq!cPGX}vZ+R%YKY!`$P`p8yK!yBOlo`AAHpvV8ve7lBsa6vvG* zdu833I-~5c=z@bUI&ao;S@&puyzDxZ7-699B_7r5)G4uEW3Ey7#nnp|ekfb*aq-e| zWctRa-HW!&xcfT3V(HS@tHzBS|Bo-xGJbF3ZT# zLDFsq{-{YZrETL_vuqse4wmN7oM7EG%PxG6Z}=(_>eZ=0;D01rmzE^Uo*TwmdOEsC z-xEy9fK|Q*CaT?7s_4hUF1U_rhOFv3D{6`i-mH6Ap>)4$@q#yGuzp&y^c~fi0>kqz zH^HiSAtO!)8TvGr==1>9K0V79|3fmSHzez6!c<`$-$Yx|ksJjfH8VvS&R4w8!)SMH z(zTJ&a^Rwk2?z1~69#)z0?5esO#v+3i)|q~8Y7&NYeQzLw7xWTlNgUg>P;t(A3u#q z>d$F46*oy;XnMMIEltEow?u9kCeBKDH}>0N5_FJ8_fqkB*XXX59rx+3?7SgCQAc}S z>&1OCaBW$vnPyf2fa;(eP`zl*%*XhWwbNX$(%sy~`e)@DZ@9gu|HCns;UtIlAnBc& z2{WVyL+`jD2C^u!Qg6y%+;q-;Ly6)92%`5sU5&W^HPs}|U+Wywys<_vs~*r*%aXM^ zMWHOY>5A4vGLT;zFTD>yaC_!XQ*8;*1g2sX!*wwxJtaaW6y<&DeEO#zl6A#ViXKSy zU4GF#y7nb9@bbu5={nk=S0*o-)A%@_G~5l6zy}|c-t#i>Hh8c5`6`gy=F!lo9dDJH zEO=o)e4M+FC+lrKK7%qAH+hLgIxdbl1697){PD>M^e#P-OO zpA@A_Q)Ho0W6KvH=R0~66LiZLG(EtP_%`XLNZYfz$Hdlyd2>vVoe#^padENoMuE+! z)GeId_(b5*nxCKYkNn1w_8w0+2W>c!3paMat%!F;cx3pzS=0XzK)HB|Mpw$$15=IB zq!J1_4v>TbLI+#xlA@`c_yzkXt#i89@5ve|Cm$))$^2(^Ip*U-h>YAiIy3ze;CG6w zdrX(y)AYe4Sm1p(B-&)Y1$Q ztJp|I$%HnlS3F*CJUUP)U~m1txwR=$iiIsN~NqF?$S4L zc3gRm4$Qg-ZT!PIKL4q#)a12j=X!t#a4ldZ;Oe0;eyn}%*+t_XhD-1_jQvB;@{0$l zgNK@$u+h*a6Kz13=!?nJDC{ZH}tFt}F%xApM~lUQFI zp_dIilfrb%E;#Q`Dq`Nl!VmOe;oZ+BD0=wWc z03wA5xeTxZ&??QZXT?gEHPlX8gV!1Wlg0Rb7S=ni(LxgjEZlM<#IAE}fg=6QlOuGqrcS;FsFs#3 z36(PNl6j-Jo507!3dtW$Op%SYe5-WLFALFW)S^D!T9K#M1xTi+`@=DHswip;68mfM z@NpiUia0~&2*d%-iVD*~Jv~ip5^t7E+xASog*f3t*PiWU^zZio;^P{?<+AQon33UY z_4=H7_rz??l`*gu6Cr_PHM~H8S z;^Ag=MrOGZuv~1fIW7EaI$+um;NM)|8Gu=Ua{zMyO@Ipk3jxH|QowSo+B%TVKggb3 zFXCkAb^OE$-_c{od`I!Ue@uRM20Olj_hsV1G_!;+m<&hihcHu*Cp3Md8puJMA~_0i zwULm#MYR*1m#Qdih1@CYGe0TDk1`cA=@BNppdA;W8gMqiDFcbwu_06Nu|amcYi`iv z)AL-$DreCHvg4Ua^N38iC*U?X)z_s*=;(7|3Q~JaH$iNN;a6;#lBd^Gf=-`Y#gX1D zriiq3*yd2%9S_zj9*Ve00jR<6S^)cW1Bk*#08w`ypcz0Cxd^cItVGKV(6cX*bm*&b zk%nF;hgeYL#^Qop5-z96{%CSQiA!m`KDsC2vbqr}zTPLkGIf*BF1?JH>RJx@Iq)G^ z&Y|GqJiz2P%8tZrtMt7#IYvJEq{b{post*Io5ck^*L^lRD40g}n*#d>X7ALP7#;m_ z`UhyQ+<4;T33Z$ljZn{D%aXBaR@u|u06x68Rxjx#jmEIzz!1yCJ<}0eLu`4aryG0#0toP)cjc zORnIooiPgZ(g5gVW1ONG)mayhC+ANEOzJ#;OspKgU`&|I+6_N-Rc;|%eWMbrKCR*i zs9xRE_V}1uRoq+?BrUtA!G`=3#oCq;A-YQ!&D~7f?zTD3RB^Oc#zh}Ke0u3fVLv)s+5Qc7=?zPv&Hstb?lg#`088$8SH$7370~QKS#6e`Cfvb=@n(bxTQxQU(-UNfa2Ig;@9|mt*J;Z-PyX%`QJ3 zP|nKQYvChgHx|QuLZj2@!|eK^CP7vYCgiA(s#H-@AX8^4kC0oMhl}so%vS?eS}6i< zhNB}9oLr-X83OW0Ma0pgN5nIjkZ(G2#E%&Yg!app9Yr@cNLy`MvdAh#(l-~B)%evpYtUY$e zi2H&#yrU%FS;R=DuDY!FDk7vQrvcNtp>mz<_|80D2F?l)MrCQ?b?g98(V0;YD=XI& zhehJAdQjaLq&{9pWchwG1Pb2LF!FiLq`B-T#UE<6_oR&HpSz_udfY7O_2fD! z@Vh6Oav3kqw-YwP6NZ)OymcgE&>xy3be6bS7iJ;HFV9O7TcTnU+rdo5NHcBO1#>>Z zILPzM#dv0Xw!F8p00j6GZP&O&gnJth$(CCRGGbKug9TkiyLeJrG386Kynn7USr+{X z!O89gBUY)oA+hT6+Qs>1MP3g^Qye7y@0zkh#b%G^eNOZxsy~Xx9{n*oz}7q`NS} z?ayv?%(YbW&n^D!lt*fF#QSc-lj6xQ&iGkfU}EJKO`4LQ5a<3o#&J1-3anY&rxL9p zXW^q&+U^7mYzRV>%D%2Z2}{J6Ho#djm|GSrhCK`ijm^=AkwOWj;{H>)RSch38^!u$ zDnj(PmRAth4bq$LsuOEzQk(QmL$ta-GTy@Bm5FzWn(HPU-&eTpgU-&_B2aY|pB58^r zFWo22dD3*kJYVeBhh9orL{cOkLa*Nx(JJ=AnEBG%S(78(^(o*JChF{og&#>r$0Wp( z>%$@p^UrCxj~a^CiBl)V8yZ)xV>jc*j27?4B1B)0rRYO!7@9?zpN@%@Yz3I`Zi+%o z;S@AN*Ov$#BB#Sl6_O~{Z;{jSHZ>Y0eoeVi-g6-OXIO*;jq~h8i?n=>SY1m~-7LYt zvC<*o7Ym6CBcatN?SJ zf|Q;2$B_dL7~h~iF1Yi4SFnYsBf{Vsv|(bjikkre zoBvZd-qy@4tZ*vA82#TPE7`RMi9Y98aEwEEw8UiKiAMg)ehuHmm2z-V}(5EzLm~t5k8u=mk`>d?K-4rX% zKBQAWY>120X+p8~^~y@wdeIPhD9z;~ili^h3ikO5`JL`da>q;8*urY@7VyU#5TM{< z{3s~Qla9xukV#*P2)f}DMDn|H@*Mu>`VJs6Z@4@Xsg%vx$ki7lrHJ=M7}wT{niR4A z7;~jR!|we&2I;KY5=7+pCge#=6qd539t7u#imPLi5_y*8Wnj^7tYN3)a2Pdwj+i)D zj`NjZ{Sa+`nQYyrKtT3dq2u3)){DK@h1k)Q=?Jh|BcKa^OhEgG5)cn-Kn}AzA5reU zSM)~dn_MSC24{e(o7P9o68qydP!GF6JZhBy z<^Z|61UdGOe2|{&Nkng46&5tGJO^(eH&23clb|xdG)koCd!mYG9Y5~(=*apFldE=s zK<)$F1t1~a1ZV@0fT%p^OVdxJ2Si0ewR<68Q2_Xva8c(-C061`D*AFV5g%U`0Dk6o zivfI{P8IFqW&mwLI$qP_&WxEw-v^(a(q^r`{|(vbTAt(lDe#lG)1(>-@qVRE@Na*^Pv6OJ1ab=?nT6ybc{a zAcmf(d^0|%U+@NEoc+KB;}#2KU3@t5C)Xkzuq_^u)eVg~m|;Ce*&9=b=xsFwjb|=? zG<^@6@|}&l*~^g9?>z^pITVxNM|z=6Jh5@D(9m{NP+0k6XF-6HnqG&6=i87AD|LH~ z1q4`*@`tiQi%f4V1;!qpj^@*nY=WAL?Ib63`Bx=XK3buaN!izx{;1fDy6Ww+drdLY z+OHtae*DN-V+1`RTKp==oOC5!R@xMk-2GsTDab9K_S@oR((j=ji_REpG#BE@vjMg6 z3pS8EdBK^M{?xciRTr0x%N4__c&LOki{Kk|RvE>f1@`EON2a5DHUfylCsq-iw`z zI4iJLeN$Lal7;dX`-ut|NZD95!yl2y?cGv{8%g-H{{lqD87ziGfxW1dm<|VAts#Vf z49`_*MbhyelT7jOw_5&znw^$Ch&uPai(Gj4W5|W~8$ok@5vaKEv|zzohGk*2&N?h^ zV5Sg>^?A547fw@OIB;Wq0rrdQ87zUfCkiYQXF*IZx)60Le?U=&R?veop2V6AvAV!9 z&ZUrGm=#)C!4eBY9$wq5-|8m}>pLI}+ZPGJvg97H+`7?m85Ww%ytt%@VZ4PUz7=pi z;A*kWg2|aaGTbN|)Dystnf&9)?g?cTv7s275%@I z(~fG8t>?`Y+Vu0|yP&xW&U zHNkS;R_ewqJ|7zPuqV$TO-(c|?j3=?`io5B`x0rV zep4l|{{>b~HS^a`MB&42myCe8hy!hQlwnHU4$6^hVet2c)PZ%@I}{oBK|1inHSC@5 zLOwGrH3wmLr0V+LLLb&m^)Lty1HJM(bd=|!Dwvl>bktIa$}M|6=-=4^k0JNsQZU=w zc*C0nifM@gF}tRs@^AJGD0*ieQnt>w$-D}DjJ{IHG_SF;T6&G(e&+#mF~Yg98LTB} zwCNLwcIyEoemw@*8%^)%p$EA zOIV{5V`Tg6#PPCakINs~4bari$B+VXu4x5~Q41Uu#;xNd!B zu#0O8#CTT)Q}6|NWVRuxSUdx;r0g$4c<+1&{ziuxo~&mVgspFQ(pFO0C~+r+DKdUR zVwvd6;}kUqi%8d(pa;f>FO#yB$ar0`&jfk#2ns^HDPbUi#V`##aA|;?OssDUqW)`K zibZZ49Emc3Xqt5KiID#en^8@ZBH8HA)Aj#JsTA7}=3GBPb^H+xc^jcXT{EUao^m0) zGjd?JEh%gj&ty!dV-=9&Jtq&A?p~}Z(2xG_YjnuY1_;{z_bK!h1V&uvfIQ+q0P1|n zkoSFyQMc(-FbGs4>g7lQ$ju%ON;77fq*+QQuPwuQdj}(!t^qXLUE_(Vg<7D zP5pBuxD4qpniMe{GZW9la6H={R}?eVI*9HIAoOYg&FcjK6ftg$PL`Fgz<%wYfwWKW z93@Zej3$6R!F#j7TJfX6RqIzlx7we|00mr@7$y!=L$D!0aw-y`4*cDf-I-#C_6x(% zLcx;G)LIPfio#LFtkV3ysp!-yJ=JGX1qwIu0@=98oQx1bgIU&4Z1jifU>jN>l|Uzu zKnt-Jv-d#7`YfsAC3_bL!EnW7C{ZsYfOTSAgg6GHl$84FiX~csDT_>h4Qe%o?FoIX zc)kUnSRF_N*%LryE6p|(#Et=_dEWuj*WZOwk@dd^rKzQ&tq+t2r?ArV-?cBsq?}mk z{t+^w;|dU0?_sb@_v3UFJ_mtx1!p)&{m|lP!^HGvgCks%A!(fNje%meBt}>es;%M- zP+D;J>2ga{qA|0Js+@w6aTmSA$~3}~=GhNI;oR#lk&To7tKrA?>Knn+8K5Tn6cokv zzYTHd9gzvfS&E>2(-$CR>r+sA{U6!n*a;8RN;X5YOD3aa-fV6o|XlVU0c zk|+Iw`4Ft^-3VS^y}}+Z_U*-}(;rNL&2yv#bFGJXH!Oz+=x@eYts^aAo{7cd=aTqI zLYxySmR{pLNk+dFS>gKszW@_!T03l)?GM3S&}3QnJ&II3Q(ZaIas{NR^CHL?`?(;3 zme;C5>zS!wf~?d`W3n~D2@8G!vfcAge|3$l?naua<5`IRmDj;c+FTnK(O|R0SFlDH zX|oNi_hDTlyZ?7XW=xpRF~!1Ra)?Z;C&tIsNOMCeDCl)?Uds)QkTI4rI8VE3jWfmq z{RQmuf|=89VwIUz)XnDpU6&eGi0RW^}IwPGA!nGSop z6wX3!s{YG)5izzN1< z$NWl_H}dVH9uoKXl6aYS34&y^%Vl*a(p&in^$qh-g`DIYMeGSY( zuf-f@EY2TW!$Md%=8KU`a*Aye0^q&HaB^GjgIUzQI~q1}C!|;RXCN4RJnCtE55S@D zP65O8e-#y{N9=OeX|geP!j^fmpfa4|2Ub;9YGfJA$jgDszaoLQ>)(-!N+v)#>eXLC zcKwftV_hh=iPI5+dkl7D%NbBjeHI98>nVEL&&3!s#%Uy}(Fbwz>!rfVs7vKwPE1=a zE)_vrD$*z9#*3(D`F+C3xXHkNu{4j&iI=XM5p+QfH{6ZwNMN;umZdNRcaL8NIj4?@ zF)+=mCEUC}{wRhU6DL#*dcEqpvByB%hx-O-6U+wG1Gvs*06M>806BnkKr+AvNR+lO zYhuB^3c?=~8sO(2hXdE`g0S0J36Me{|Fs!p9*Pi zI0^@%?_OAv_Uqu$^*@szl1siPj)`mHT-!%L$wIVfD5B%WNs#1Gm0oY-AN+DC{z&Sl zi_6`AbHvIm4qC7iVIg+4f);%bDKI7O1vUAehwY=vAnZSYky;27plfcUQj(XH5I>Qs zh01~zN!;)sLGX37u(}=h{aq$K42U*IRyv;)UWb2=0{i= z#PKsKgA(>pHWn}N3r>a)@IeYHjS$4~RTP%sZW^jDAtYm6lMf24iBmGTT6Tactk72_ zY7K59A+iY$jloSK4gHK!D|&_^jRKU?iT!l0o|-JZUWB%qUdhez%Op=d0#Mt^D&t~F z;}l2Q6xeJai<2Zfs&yg3%yi1~`}2}fVyX)^lN9+7r^9YY*EIP$vr2P8LhvN~fq2sF;cMe0$C#xXXkD1DOo| zHjCq%bgOK*5meU8LSxsDu)JGxL2rF0VCJp=Fv>VZO*-OX=9|g@<(e7F-_#3Kl@OPk zs9(6`njqJNKIg;Fs<0}f^)c@TSajtR3*tEs%0^aCw+7wLysV?)=kSh7=V zOrvfrkaX{j8hvI#?yTS1<-yGqDslXJ(NL58cUT6Vw6kmzqDelqeN96ju=QHkGmd5zm?HIX?#ae@?XmDOv+sbV z(s3zF#J+Y2`)!5ch|awP581N}(tX3>Oo%!wDB{Q?sqi;jQWZ-US|ESXHma&BExMM( z!0RZ4PK&;%WH?gQ$Ra1e%cab*7ZmH|p}%K9PTdd}W<|Pb8IbV^OW8R$zD=ehegov3 zD(k*8E8!i5} z#=i^Zr{@JY$JWr2$XT!`$0Jv`2m`na>~Jr{)piy^-+blr1EdUXK-!?Rfl)GWQGR`q z#mMT?T&={5cXfGKbYZSz4(ey0VpCi{%*&r>ZQY$2EXHMV!SP&{Ux0sNu=$TmRL}vvDj$Kf5H2qHtqLtxQW3XyKFn65V# zpqf}Hmr2_oTTVAd2A0GHU&vVZ!2<_;`+>WCP=wwee(?PW_+ihU)9~Zoz3O*^KmMpb zb722|^&P&;54TXT%>bMaSXh)d<{piL(KIP|f|-5r;*Gq~*^lEvMzpV#wi!r- zwRFNFntnlnY5r*$W{ERT87jwEEXkdMemLhL?EUE`nQEYkA^v738j#=!oFJ)yJWX_} z6@0Lw==G(DaV6rP-C;1qnkvGTiWq!p2E?PzVJ3uFJILW4B%z)md6Uny-n3pc(@5(@ zBN>Iq78tqCQU+d2D#K!Nw*Y3tt>h(2W)6%Uc@Jd9I5i?7VUUPO zC?p~h&MycF-;u!h3<-{ehj*oSQfds670`$r6p55p9+blxbjuYi6n8etiPt{@)5LW* zBThG^qg3#l;tc7SiE|YKvbF2aiIu}o`c8>wvje$@ZxBgu>Qm#cV-c&l19W!Vl?;j9 z1vAY$9)%0tX>e&g5#ZGL&5lT2Kvs&k3u@H%$HZWB_|m?x$?}mDY$$fEU1IsqfI?L%stC_WSnl-{%|j5--4sJeX88QFhFptmOTG zzr8>Hpx!@p=%D%zrl9eX`dgDW8dhZ8=kS?3`rwOr8d2TWGzaqEx`088)o_e^ciF5hS9}3XfFS=#H-+}%6q~*)J1ZlgVI41X3I6U@~zbHq0i@g#DBy~-6O4;Lu$zo4O zn5lav^07^I2wC_V5z)HsvBJnCO=42w{#vi7)0S(^MbpLcaH5hz6dVosdRmv%J48Lj z3Eb2hWpzwxwph0z#@zQ$?#JoI;`QB_73PEy^^nH?q$F$|_$O^4+P2(-M8g3p<{yxv ze`#uP_n=HO$cefHS*za%`DeMA5CW2v9duis{IFsKvz@NwL=p3MZ?3iH#h2S zaiFVs^xMg1{}=g|DO)d${v}27Y1SHx@l=#K0ruP9?qW2o}d1sP8rW5ynSvJQR?#0@kmul{Kc%Z*~G$_U++cp!QKc!ugUL8_-^nPf?1v^n>u<9=?YIKW;UPMkhDjUQI3yTV6= zHNa$4?KzSsF6pVyf@?j?og`E0vUCoLqr(9f;eAaYfYhqfzQre_&XZ(OCR1KaryvCXf9mw0ii13^dVs_r54 zTKY@@p&~n{WsT{Kimn#-)p5Zo)C|-T+I%@svKetsDGWbmx(qyDoh%>aJXe!mAJPetNO3bSA&Y5n-N&!3c=Frc45G^FAwTR&KN^*K=;W3r9 zNZZ6I7o5W;j!6KV#@@Yqe0%qN@7n`*(WXPXm9qOF6FNq~@!YV=sn=75T5q{>`F@TS z%N`f4s!hmJw$7FzTg7UKjx&T07jS{$hcZ`hEj1udGlcA-aPRzibq$)$uB5BTsCETGy|Nc$v zUxC%)z_$8jj5ru(Z9hx{8VC|TuI&QR=qP8cs&xV;} zQh-O|l4crdg0x|f)o)bBnp2VL>Lk*%i-s4BFzJ6j5nBhJPDBy*U|w(v?X-P^m}bDR z=HsM3zowq^7+Nfob%SH$WzC1kX?oYWU=Cf7idg@+@GvW?iN{hdYZom+#?@#6?%lIT zx;7?`k=wfy6+6*ZKB0i2pz{EXu$_yH#a+}&)Cy!x?K*hypsd-5VYbe#iaYoF?^WXw zUuySNaZL7rso0H%C>Evy>HxI>1_uds(B>OBynuK({XPv)43WdbMyR<}77NW&Di7_V zz-JGLa6Kk^haP)c79fw-r64n9{hpb(5=5vCT^S)(?9?yj2?Bham>YTl7pD>KuxYsd zX^5S|C88$Au`2Ci^TeQbi^3wq?p&!zLkpXTxH$AWX2RIl&nrOMayWnL=NIxOk2vg^WX zLB$_x3MZM2`V-=7}Sd2tPjL045O>b7yNuQs4So3iuy z#Cp=WLmbZ~23t7Qq4dq6@ikaScgpGu(sPk&gNM|N1h%_OL@46T^MaL79O-jXS=DjISZNwlO z&QCXokZ%*j{c$!n?{77Q=(MfKo6m}_6h}(*rBZf&)`*dQjv!|cVH7&p!AD24NZL9f zP#50?>Cx4K0+uzC&}G+hWCpyq#D(bEFK_u4vP!biUNU)-7b%U~fAKzb=_2@~>ggn) zS?N9}Yf5KQ^!SN%-$*sQ*fDKcg#NbRg>wP30E|2~VmHuDu+_Km{!rFMXX1Ruewhr+ z$ug?Nx~jZnRr28Pu_LJaO&s#lv=(IqhS>;MfQw-Lcf>>*7>YxKn*y>xeCKCP5qC0_ zn4jV@kfveV1wxHK^ql>%`}2o23xnG=+2aWZSdetB^=dmux|d}>64Q4Iiz zmV`m4ltipXLGaz)@4rV0XI5n@AJ9BjcCP^+R+$I)f0VzcR7DRb@nn4i)3|22I|v1cjZSIcp?sZ+Zb3C@%7m6m*%P>rL(3; zF;b@a#ro{W(c{_TzNH)*iRY&DUXcFe|0I3aTQov9#|00EO)b8+Q&7718Pr^_f<#ic z(VQbq9W@TI-ie5{_kM&X4X^29bd#J#D=DyQw+(&U`;V{`iTxw8L*q;tMwxkGT7-@P zK2l%Nxj@X;w`oQ5hx=N$$wD)N=7n~VXR!_U`P3vU&Mz7VRoWfOkpI(+V^;tR-A0rY zIPbtFa(GZ%Arbt|y5rK6RN@q;32cWcbt}pSUi&rG{s_DMdzm|}sMbG%wuT}^1h*$D z>PivskYrndGZs)^fOyFBzm_^jjvki2ZOrR%1{>c*nb+w?^qd39k)E#%z6KxOwV)Vm zuo!hr-V+E}b?+!aavNR!I#3Ys zK$sLOksa5;15xYy`fiI+lx!xbPdBBGhx5;5NP|`rjN~8j9t+JcfxZ9s&?ybUK3-I0 zbz_lU4S3^gKm4*HN)(@TK`|ozE5v1cMe%@L@4&iiU@Cj4A^kt#Y%9S%+ zF=gOOJ8rJgEJ9eer~8P`#^hA#$`K&uFaW!1$1ku7q9ZkZzkAo|w|+G!T`tEn2u9K_ zq8Gu7&1mcuQvXmjK}Q+S|8I?jo7vbtgqL{nManHGue-!{bZUyU1;<58cNgP)RJhKU zCa1rNCqqvkD9F=gV*(M-*9 zUc3&%UD2rHSBUxF|BPnun5VXYs?oKsp(@tF95Zc%vjB`s@Hb-L@}G^qN4Q48|x4VNzcUIrIKR5g7J0p)xd(*5q? z@g_?yqrvQcsLl27@Ju4snfG9>nn>69j}|%%p%Sau6=sD}>#@0ELg*6iyfX&%$kxOW zNoV-Oyy}Fhox3byB}O`myf_pTpQG+N$(<|RcfzT1dZ$+-nu0=e^(=>eUs}>>rPP0B zev+(?2lE;4uYxtUJIpN4UILrMdNU1^zov!^2i9b9d>BrSu!KRB^9Npl3|Z?Aw)_Cg z;W*M?yr@Muek=;*N1=Q=e+Jyldnn7d6zlbjB#mKJ7UiPavAeS>BVKc4NISm}gK*AV zg=v+6ejjirr0ph$|ENZVi7>uF`$)S~UGUv^sLu-<@>Vq7+J`0NMPg>KLk6z5AvQ4` zr$gD#W1Qy))V23}5IXAq+oX`_-{2kb2<+Zppdi??=ezGzA3|%I$j2!n%Q4ZjJI_O; ze%{=CxU%;&gy;|vX$Q^W{0JcY=VpHO35eBqo|zx4=XnwwEFz#^h$DS$tlU-(O}O~R z=mFZ|w|3G%heJ!(sCxG--cCR#!%+ z#(w*)YVb0*povms39jjsYQ$vfQ686lS6rllg`dPBFA$a(s-sK9wmeJG9m2-z6Y$b% zFU>+k<4gPPGB7bZIGmKpgEw%=xG(JI$zXXjf(n;s1snMWFA5#F84rr%LO8beYE<6) zmLlcr^}=d1M8Rrv-Ue5o<6!h}&>*%0H?6P2uF>-7Yh-YLVz61m92XD~x?X+w2)g~) zMliAw=k}$H3^{#HPRF0CYWU`M{;;U8>uHNn!!Z~x?$036`#(Zmq<7IY9N>j^3TaHx zaO}Ggxq7^Za~p2J(QjNRt}l>>U5>y3Zq=!`RFk~1uKGR{k73hl@6*Vgc_-T78}31b z#Mfd{%(*jaCtbp~e*f632qVV-bY@T>-49>J0 zLQ8#rX-E>s+%#0mKUHN8N|AwQN@7t?Ql*%!zzFq_9X{-N)aASoS(Dxu8)nFk7aMTE z;Gi?F^Dhm-MsGkIT2Z3oN}T#nYHXnjH%C|JLl4=TLtQEH)f!Q%08`7); zVVAReQzx)fBR@{IR)jgme1~PD**!Rj+zAlNu`+DO917vsPk~@K?(vx) zWa-se*;3Y$mXbo>m_~>u&EW{$#<2jLfbjr$(S=p9`T~3`V(AvCs%10y2(#IX3V}5L z$$dEQ>|;4`m%}PWSET9H3L=trKA?ozH)4(#OmXo{48ulj;MKrTKa-#8b@I4>Ry$s- zs#9<4IW+2NRCVo@!S7S7YP>5+);$s*ub;pSZ@}ycAQ|Y$-Tm!1YUY5M1U5}{5Cs}K zh#G$9&pk2R_&rV}&&urFT9skc9A1tV>gLa~t}79Bp;wlwO8A#j(|ZFftbvUPhwy0x zB=5#tS%1|ipVqsRrH7mLYE$bF%;#2O=MOO%()T?!YCF3#FqFroh1aSW*1gh~t>t!FsCsfF(5` zTdz@I_I-d2mA!|vVc}Si4var(H-yc7Cg2H*ijd}4QV4T^fwE zMQNQ}GcQ_6AxarrL)Yg3Xf#j|6a(@AqX3!Gd}B0>{F*9-M#Q7ET{kNZ95%VNAuJ8< zDkBTOzK978E5Hycf7~&{RbI)>kCC$Tq8(h)kZ2gTToxh`RX=<5BSuUYTO_EhMM*#W?^EMw-AOH0$^7jEZ zBJ3{~<*899=ANbOQmDGVd(*KGa3gA?`c909WD@cbO+b<|&?qN|EKQs>cqT{2$QIGT zi?l*Iq}NCSrgIK&XCLCVUlMqP6~E&>KEr18tkU8`QATONl2Gq+DXpKn-x1(omYe|Ee&(*6>2A0yxzJgLX|@>IJ2hL8;M=n@ z`0Q#U$Ipuj4?6Zw@@e06tV>EYEZlqIBckEt{eh;THcqUB9|JpX$_kstR08NgyEq{> zq)na^)+SFx44php3~~!EB9Md!ga#&$RWvdJ&xH zN?(B~QDZ8@wg#x)`_l4Mi-d==fU+)@jSuC=%I4eQKGn`grB~C<*c;}Z7>+G}ee{!0 zB9V{(1EWkjYEu2;Uv&rAGgOrr9!RUh{~Up;GtDxAH*-8LBok#1f7c8w%GGba{>ryI zVDeJO?Wc|da*j*=mQ<_UQsy@ZRfe4NrD3!1c5uwMP+Xh~`{($N(p-_h zABu{Wfp;2$qxm;&MBWd~**|LZZ!-Sy<6dG-T`+jc56VDUQM_#K#^wU==LztZ9)Zi$ zpPY#xP)}xv821+kMN(-fzVK^7}p?vuT6+df^5YKyfgz)D+5zYVuLbd>;2KDaBSh7%BmBndFg%^9u*f@ zR&Q@GsuiA;l$p=t_T5I$DC+)F-56kBURCKtS`TS ze*6kL={q${I<%Tfn-XOxdmjp#0isQxzv(dsM&$cOk`7j({Nx&}%~n^wGLbkNdeK^B zBSRbIXMV?f+Qrx~?Qb=|G6nwK!1ZC{#aNfGsAoq6=2|a~sc`;py9?)vc#m5x#=@aa z(7t_Mq6ix^IGoj=6a|~L;c#wTBB-*LfuNhE?8iz+JgO^Jp_=h^-q8f={{7%u7|xz| zP!Y~i@(W&EWmJ*gLX^wKyfLxr={Dp(C(A1NC@(nw(szB>gR=VLqTq@AmUyRKt^#dH zP(LH-6k}WudR!EW^n573S^3JKH^1jdFr{)86AEVmllCpS=T=y0i@vHfndp;E9-2!E z^#7FXxGO8z%mO3wAl)TAIU6tyFiCdQ%t)5aPo;-NqCVg+ToGO;k?v8KbeuYT3%WlY zRVRXoDCEE2iiwW8OUCQtP`R=qS|5KUnp_F+AY7#$3`_3db?C4>eOK05()?kO&B*!j zqFg}k<`HSWqYCBbbvQ$-_ZA!@;ERTDjhN;ydEZb7i_U#B7Svs6RaE_oY<3rVyHp0x z!jW~ijhX>nx;+CMjpiU^xh6IY3OX5Q<#eq@{l9B}EpoUn)H3wP^0?e%&}7}s2oH2j zw#KPut8Xt7#DiPXqOs2l$1~)1j8y~nkO|L}DCJp!atC$f{Go9RQKm8eO_#SEresEZ z_wS&m7qwH_csjLg{Vc91>uPKfyS>0MdL0jOgtzbs`JR@TMmAh162sT>V5zl;6INuP z&>Czybl4x!rC`CN8vxbPdf_BkjH4$RWnR$8NHKlTkkNT#bdES24rTUf?-`?I^Tanr ze!wRB0tW9p9LCR3`!Z~$FK92Z7aCnu{~CL;=9S?x(6RLWP=vtkScgq^FPQaPpu~`%!y{rLCi1{7wu`A6MRU5z$ik00`zjd+|(?NkvnKf8-z=x3V z3~5^xj-bdir{16K?+Ar0)&Iz(5CcrL2e>4G3;(&!tCZY z<>h0QRR*pG$IXkCr`lT?(rhjZR{xs?N*~ENe}=Wk*HC;CD ziwYjjp>~gTz_K8zZ0t?*AKk*jY>-H^tiG`bCTqUKqNj+!$vEl(TsZc}S|dhZRgSdX zfB?flM19Dlfay4N`2O(d_o|E{@+iZ;!jQlEV!-$1K)(u%GSTxS^5Cw#Dm!L@9m921 zuyjx4DJF)!=m8f(V%$Ii#D(1@a9+2Lb>x^id#*PxHh}_$Pr*1($fu^bWbs*1u+Z`G zNTY>m{i{&Ze>b8p|KQ^BqA5sJf*vQx;MO#p-A4lvl8!#GtiCQC|0Tv-aclplJn8)x zjn-|G_3B}k`F2TkDWigl#pb{Pk1aeA#_;@fiiaF*f4Cf?Drm+!@3T4C zaZ`A_xPnmnv1XnlJbdXMVuYoKU&+2(qN^{)JCq1qUAD!GsORFa9~53aM~fDHdjey) z8ow#tuLuA?^Sf&RZSY-{2O* zJH;gidTo4(*Y_~uJ!`{|KAU0)eqC~-yt1{!`=m$HN3c#l)d(> z^mTZ-4R95Jp2$+bB5A$4EOsozXoNX{Ccu2ag@9!MN`sY<1lu%|g+)m!b&r$QTcVLJ z3Uoyrfq$;Y{~ZG_H2ggtZ8Bq;da!lt&r)HwmOjPczW(w{-@xae|Hr_14=?tN(`wd> zyE8g=DZ^@1+BDNyLtKrypNIdzZN<=ygW6|qAk+ZJzK-!r0yjr98^nFh5Vd~mQF1P#fx#Q|7Mbds2Xg#J1QkmX6m?N zT6|m_rj-at2I(yT#rGmWbO(<>!8t4l={$RWQGr1r#-z=H-F0qP` zB}@^2bnC#rD8C%0vyT56Wvk(gh}%VfqB7n?W+af~I7W)Z%K&87YwcMXf5dKy_h`In ztF{XPN#a23>%aN^!w+ZrBZH*bvkS-Fgic+63fX!V65+R%*Wx%jb9l^5hSD`jcL?#y z|8xLE@Loiqc|oj5pRvjoG+PFZRk?E)qvK0(6hasE40Q=^dI@%bSh)S#`RnAJqT_M3S4EubpU)WLD2^>**t^&bt3Q^C86kBy)s9y&e>(U6M= zVfgm{8lW-XghjWN?gQ<47yvJExAfRiSx-StZX6kV=K6rOr^c246GY*i7UwP9{2j@`4j;hvWiU z23#;M;I9`;TU2tjCUy8Ct>?oC)Sd`zb|=~byV1DC4tm2BUQSSv6&;h0B(fy;-caR8UTbT0Q|p6Bg2!=q*%QMO6oOjWogu7`~O#IMe0lk z$JYDvt~3mx<6o2|^Bg$wX*N=HeIaSe8Fg5U?V4Tstt{`(ikE>JM@9-wT?XTM@n!!1 zV>pldMRcf{yH`osUr<)qJE1H@2A<2(NyoAxMJC;A$O2y&~)G zjn-!nbCifk+`NkReh;_-K(B@5(+Z$RbD^}|SgRJbkdUbVNmSG<)F|{RuI1E;V_y3Y z?EC+C`x3Y)%PsED1esw5XOtmUo#Bdrf&%UeI8X{GCZM9F7NnKkw6N96x?uagdPD2R zxvhA!#d3j6GjoC5&1Kv-RM1RKO(9Tdv-}}E5w=9uR)QufD4^Nf>}U}uP5R0a}px9YY3F#+3&)AL)C`U zrdk3^)f_2~%F2_438 zEe?_f{|H-O*tVah`wNjfZ$fpM4~x%2W}YEA;;;1gv;IEKQ^<0M)bW3wB}2r<%JiNE znWeN7@WY)(`1wj)@EQh1>gO>2ia{Od35+rf3JX-V2qt0)1qFhQz~%o`75O)QN1=ki zC;f6GxWTh9=J0&rhib>BOX29_@HQ;y+&-P1rUkH>3@4dtN*jVLMg!P6!G>F?vC&A+ z59yPHLlY9@&^qw_^;8zQ%s$E8{z1zYmksnDCS4;HM6*2zr4Xv7c zJ{zw337KYF3TE3IV*o}b6MI2~qAfye)9Ts5a6rrn_ERPUx|a9|Za=E7%*W+_l8inX zkus?-atK%6fXbrI>xLSm@dY>VW(*?T-3Zcon{(lZ(F7;t;~&HO5}p05`2Iu2Iq|_N zvZQ$92oyHIc?9YOo)3RU8au*$@9U9htfI>QU96u!^$+D}Lyw3)0mTNsLZzxFmn9&5 zb4xyAR`(X5Zh49)y2HL4x6Yny_xK>dH4s1%foe<_PdXAMVd`jj*zZSDwPiOOpf1XcS`YBqY$W&obA_!UpzEf{uG|oMH2d_ zw+qmXKShHJU`t&L{#kqxAxAVo^Fv~Q?6DWY-<2|VB)H4-ZzF}IYijv|diJ#URcEjjgKgLxt zZ;yL(8wObgFMF7Zoi5SQ(2>+B4YpYgAsc)FB#-yx$TlP&d}@viv&Q3&WQ_jciZA0X z$^8a#a%DZUV`6AgN_i$t_HyRkWt%1dUfNv`>$}vd$q}@j`NY7M}cn%XfRGTJY+=4ODXYhBv z?RE@`s=VIUgv3pFMw*rw(Sht1yAR4 zd>z;iiuCj`!X42y5T2oaW)+v!!jbTTB@Q9y{&D_oVZx*Xk}ekzuhcBb>L5FpWcdY= zl=)ZMWY5a3s9?MQnKP%{A)LVu9;ciH&7ddn3|`F-m&9}pnYu3ziDP2{L+5;$q_<9k zm!awjR8;pG3SGNE`g8AwtS~(RzW?tghNDLM0#psln~|C*HQym{Irk3(V0@gB8ZS>f z3xgs71R^VeeLrd|yh|YQL-R^icaUMj>7o86xCq=dkAS=C#i&@9@D%t--n)prNcd}3 z5a{3CuC?^1QPCA!;LgQeevYOu8`W*d{XB)|&&Hs0ODB}OWcJx!q4M2};HtUZQ2DX) zVuT@#_82dEgYaBD8Ymw)2W2Dn%@pTvg2R&33j4(;k{lWv+Kxy{avy^+5@WbLG8{~1 z(yk1vjjVZUKtP*Escw+)7zJF}lVm?R+0RVxr-$^HNJchNMzsD2RNMMhu+5O}G4Dyq zBk&hC6%|DHJbFYK)v3pDURd{DJpXYFav~m_BqEY1=R%Urk=Z@7oMtYm1Z3i9v|v4 z1{UTcSQN48jamU>T8|b4$-ysIxje; z9bZ2JV>se#ry!YF-#llcR`A<*?mGZ=UzP*<+V zwIf6z!l6eHbp6EuTKkAv`2>WKt%%rJaifI(y< zi4(zedQcBN1xIxG^kjsEZ|Lf0rq9pIaWW>N^i5S21f8O9m`Jt)?`S*3ag9O1-k|)W;7xH^V`uE09JtX5QSb9n(_A$gv zR_If@jp6)x1o`tFT&`-=3^`$m=juE$%t4FZnytvgnOp-$am_1e;!s%|>~FypB%%8u zx4uTg1x^5DKprK+0iX+IYA-`*D|i;tlaU6VITU5tf9xF4DpwBvHP~+DQ9Df+uW?pN zX=FsYnuJ@tW^d%3Wd&&!4!d6vOl+zvBdzNSH=Gq8cQps=5Fvs?NZXG9RGGIRc)YYe zn`@H=*`usi_rYt@A!AR_*Q@>fBOZ}CEjiW7@GX7_Zuoze$oW7!LV4N!p{_hNOfE0a zHR9~;VT$0s7GqG3xEC&MP^gZmcv4?0c>z6W)FUBV?m+3?z~#+may<}7>kKMOj*puq z#j_wy@aUuIT56k6Z41?c%>IFRfl=m~a!_kR_m36D;jXf$?Ql27#3e}T4X8xyn$P&r zy9XOyu&2XI-vR!#x)1xrNc}_DpPE#}nz|lJMo`>JP~qj7smScUA>U?G8>UMG%uhUC ze@rT4;|9pSKik{OcUz%yH!io~Kz-g6X|HU~|7?3vaR@Z(YHb}ys&B%JXPFivbqKnJTOsX+3f=vpM}dt0M;knp(U zL30nnL{3wfV}JlxQS!9CcbM<97_pBFIe`LcSW*~j?2aG1amdb5aHC8+n_@NG$?yhJ zjDjl>L4~{1<$){9Fs8}Qo`sP?)SG!+UV{PB>X#bo&tHeiY&b^DQ+;X2KE0qD0b*59 z^|p?#JQ&Te?Xfyvt*$kGWjn? zMj$O|4NC5pFU5hF)DKEc(X+jvWW8T#h~oNsV)Vzzgjc1SnkqjGc5qK>T7lKfeW!2& zGX6@;DR^w?_yiX(RWQH=;OjO9 zsUF<{B}<1OO)c+%oIy-ZMWawX0;bf*H`Q?TsCMMgq5rSrmj4$oWaKhGWF4vmTXH&j zI+s2SgYNQZoYT&|@K{k-_Ij*%$M2a5tikkH#mj<~@c!hn4UKC&4!=AN5<%l;xXMa) zqo0MnQ$#Y`k050JB;@dO9|v1Yeb1d@Y^>s*5Jc9H>iPK;mek)fH^#m5LsIY{4rMM< zNg518cf69{L8|@{X&mpVtEMhyNc!)2DRGGb_T(P)`b*P(XgcIu{iG=ofzFXUe3D*D zwcbjZbP}VQbh7xp3#P9P>7Giar}F^MpDxAa$WePa7lLKvohEauuHrb7W*7TmV^A@T zNSr6g;I$e1a~*21aKpLdXb@k7i0Z&@nmOBW=06@0>9 zNZIHCaDMkdNX}N~px2y*z_;9B4&p(2n{N@^-$P}-Gz~Rq9-iGo-IB84uAxCdXvJnJ z(DahBhx&w;X5z=e7`Yg_d{>O0@6aU_2I3$6je9`&`Jx+~(;wj3WX_~9yjR8^4-OIg zW+YxrKMr!wZ9ZT$<8k%HSnwDJhOWq3WcHcF5@n2Rx>`30)OBM-j} zm0>w(K3X#gtwf7H!J$}wRWvGI&W31&q;+#?S6suBi{3AS^;%D>L4`ZN=cpjOs63P0 zVISUsXFrKS<;_QVmf@LMMydL~BQg`-N<}Y?Pv8~FTM^uTD7ww+tdWn>Ve#Mm&+SG! zid2Q5G)Z0(nl_;` zXGsZ+3$JVrR`%B@LDB;<;(J5jw1mT6l9vNzFY-8Y^768JLJPdxiT)WkBPuN0iQ<~K)goPibS+7cA>Jd`y%g3qfk zWHu_Gw1WKCAD-}{!9b>} z%t(XkL_jl5vEGRQJD16gRzbjYIpE9trTST9m?}xEaV}~A)C8cMTTv&Jpl|Jn2)8gS zmj?*#xyO#wiMBB~(<@%)U4~iTau#CY^tWTphM_1P^Z`&`v{&te<(Un^X4Rq;G2`;` z1{4chcN4P;&J2N+y&mSft)FLiu)sStL)Ufz7^(jj$sPogLs!nImUoHy1GU}9G1R8x z|J!7?z0i*SMAgTDVz<;3qUg-dG$rWLB6L@Oba1ASUHUrE3b1o{onm|-*z9z%eg<=h z{ST?XGtZZ6zja`O)JL&!hYJzX z&du;xS}u14INCbsd*-Quu{S(mf^yw2okYJw(2g)?SfHO@*imI)X4sE z_I24ni{wayVLZ}Sg!9ckg!y_WLqw6Xuc1Ge=k$Px_)=<60Q8|vRJ!W(p}?LW9_P+& zqjg3GH$yTxp^^4wGk2Wb~r zF3yGaObc~+GI4TZkh&-=Z%l(Xsa#-}o_;wv#Oo2N*#`$3=9p-0fFjDMS`rKGc9Ql0 zY_#wH1a36*2?)*$l2QMloE@a{%Hg7_iE`MiI)};dXilOYmmd(AXuE(gJY8eLEdPq} zxMZ9`>a@!b@jIn?ko8NyMva)fQJ~jP(_(E=g}8bf4~Op=B}O(|u?`TD*i!5J4t7#!s485mTsx&KAFDoqb_-N6G=KLf6T zCR3oFA`Q6MSK+EDD2I;<2_+BaqmAiW5NG{A5My1n01ZuxR>269G�S+i3d(x}k}g zBvqzB7&Xyv>XBNcQ(%A9 zC6(eLAw>|wc|GD+sHuDzTr1Y_z+Nr?u}SsGu5K%P)CPW z5Ljlm2gD-y;p(kt>mK0=B56eK?e7J^>ml z`YGI>AbS8&GUXs;iSU0!_OVu5f80TXuGbn1+o&}DBdxa--&x>Y zccM%P&iidprs}tMfgEvz38~o5I6spIGf;%(8~3B8#s(s|WD?x_L=D7tz9#vWkqD>B z29lq99pYrt1myZ@7g2`F`B<#2?F|gsqFI$*d9+^Y8kj0`4-}w|8Z5UwSv{0ijG2#; z*_+`8D@sf^2Egd@22~*}7m+c$?S7?n^YcUPrmfjri5rw>90@8<)9}qGFIH9~(}d*v z#Gv&4Wwg%0d-*VxPc&wFfQC&D=s#ts&@zv2!FUt?^0yc@Mt?jb#}MvPMQ0Tc5a?Me zAj29~;}2WNDV*JKnsM`$x}#IAH1r&RD1%*KTM5zeHmi3#nEyjs1uD32Q&JDNRf_9l z&_8TCgo#fdfpk;33A$!pXRxQLIr%{W2=Y5XvINGd8~p+qkx4>N>mxS}v2}sX+!h{? zmwoM@DK#hkDQI5-lsI_Ntk#39Q+1gKBbAx;iT zhFr-4UHRSqI-ko=n$Bm6HuRO(tYSgTU7|QTl#sbAtN1VHIZ&LphyK5LN$b? zqnJ6y6OIf;AC!@~SNec(AkK?jqbqvjq{165=-Uhvw`(xepWI-Sx2+6EN$>aDI@+1M z)-KeJa()D%CiyG4c1bL>x?%@zm*RD(q%(6dyh*5g0UO9uklO1FLxW`Yj1g8c^^rRE z6kR~=I_tsYM1RgCRgRwuzFLx=48xsoz$rKJRvL1?fRyQKWeoBX{EwH>Jn9G30&Hq1 zfOqhK-OW3cE>=4pXTi!F@y4Wn2?oQp_~T|OW3KLi{M1jfJD2X;ORow-cFuaip@W6g ztApe}{hzFcyZ)aJ6ECEtjMP(FS8$DVyA&Lt$d1%1)jg1mSNS}S)X=9Kuw|v#VPYV= zz=V(?33Ccj$G21zMd3oJ9sy_G)<2^c!hw6ydd1Y$VI-)Bd-hA*sCO_KbyO||`>FTQ zLL$XO5E*9~0V>myUWmo|Dl_J`*hKQb0H6Y?wLN`;VW&nSV+mn6%X*yzm%n!wr~hiZRxp!^nfF{@iYS2&{uXwK;swZ)Hn6VP~^zF6^fAZ;|D|N4?yYwM{~2ZJ@Ae=?<@Y#T8~3Ng$n;qOu$4@v_WnJp__-EB_(|G{KE8Rc z;%}wjqZW{*BF-4#tqk~CL2o-&xnlp`J(};RJA6p{3@X9b5Rm|{M_a;cb_ql!FY@Q# zX1B}b6huyxOaSLFhld^){Suja4Bbo!BTB z$L&K1Ia~y9{pqOSvk0w{R_R&seA*any8 z#&+V0b(g)b*x!O3a={4`$hSS5(N6yYf7~-_k@ueBk%fL{mQd0$9tEvvH+(qO5Y`v7 zp%zK)Acq{0A5`;Dz?9nlxrWFi*h+?de0CDGL9nGNuoOSTZYP!iTesE?^+&}SU`sLa zO6Y*v0ncVM&la-KUtVZ}6r1-DCcEz1c$iv~aL$*TqMP}>#oyL)fwO6)2$gZ;a~$&c zrQqfUvP6dFhbx?)-6_spEBp^wNk@z*&mem8Z#0~64``t9_We>gka3mGA{PfhHm__C zSGsd6K&d?ZsckSt%K#LPFMq8Kx+!m_-{NyPOG>}A2TAp)1V1C01f&A(pxnJM&iO)h zf;sq~!0EO&zL3eE2kWet0`$0wUr8Y2{VWu;Gm4}mTy5b#iz4XweT29hoF?ZAqmzT%R!H(v3Ws}Y)X$a?H7%#J+u-W z@)Np;G`c4Ntm4~&H!}I|h`Xg>0@kTPw0dP%nnjAvfh{RXaPq8tSU(?6Gng~5dwTsC zQLu4LgMWz!kD{HX38aWKND9$b+M~U+Q$HTcLiK&Pk}CwCoh`KmaDBP{K-1hMJ81M} zLo=zV%cp+r8-PB04s^qHbYksh@Oj#$RlEs3Hfo6Gn(_qwI z_zSrB>0kp|YkIm@0f;`6QP|sXeMhHkEkMN=?RlHGmnYUYM3sF=?;}6oV+fa;m%_tj zOnJJsxtor6M_QH0s(B;OAE+KK&hl|cJ<2oL98%J1giWd%I|P|@>PASH)Hjfq6a{XU z;ven)CQn8LMG;VGq$Ir_nNL0pE2tjbquZ;?uS!UlzW<` zFy95u;4<5$z*Yc(u_nbV(^f!gthr;fL-PEij0t-GYKn8P2q>Av{hH=~zeFAlP+q=! zC<0klE~xU%EA$|b)C|rJlV((N`l6b9+5QRU0R8HcX)$TyOu|I+4z`c>dMGMGz{KVT zB)DxL*tp@>8~V%3@7m*0RM_O-^1A8(hry`VCo40Wi%7{L0zy!>+5h%Vf#uoe>nCiR!Tw}RcdqHGaY z?kjR~d?rtwQ)Kqu1zQF?qxu3sNbJSC{?*`&^udY4z;uHoKh`m> zl_xaRTac~3y#pB$_0aT+?nl@r48>-N8#BZzPaC4Tb<(a4#McSl;qh3 zp;1IYZZ`)5H!?7?;K!d$lbcqDhz87mo3$RN2s0n}uFL^_pOWGmJJ^G4xY&Xb#39Ky zpb8SPQWMFIDn#IFe3@ZT9G)AE!NWdMlJ7-~ zW((9*dsRF%H@MY}GJ9E8Uo>b6z@gR`HDHsvN4K-k2E!Ti18?H;s)qvoTPb|A9zAjx zjLO|=OyzTy4GwWiWl{UTwaBV-c1VG1c9E@2QPh-%b zPUF)f7!P4g!=QKdKF^?0ibMaM|MPow4T|Jdz&`c@?Mu`YxU1AR;7$s8hNeBH&Cy&( z^BoLRW5qf*5}_I&u-r9nX(_(vdPOwy=4V#pnWFYe!H0o4AMEmX` zr1{xb<%HPTM+>@Em5$UpLTkuoMtm~bgQP5yCW&x|itrG|glW|tEltrZpdX3Hjq9Ck zbr*KhMP3EF;^!j#10j0oJhd66tIRM7CnW|pd!}5$2`KK^Ha*dc1ouXJ_?Tr+Y^1+C zWk_8$JKB*LreiW@;$^G&8CGIowwdy7wx^V?xV}ShuJ!4_y>3j#`NVysg|cG%2zy8{ zu5F8<5ZUu{dzpGZBEo;ne7weeKk>kFr0$T)kmmt}LIYCXDXyQ)9DfC`RcqflrzJki z%1?3r;I@>%;eZ?r0Ilcp0Ca z8!4Oqm=PuiPQyrF`Xj`Hs;8kRHs`aU$wQDgJeM>5Ju5wdxajgia97nHIB7Tn9F!~3 z(g?$uYh`B$CvQMmcYYTcRLZW&6i4)ERFck5fHqv-+P+;owLPvKziTf4W*x=<^M?~n zn1!p;>w^2x0dMOf)b%R@f#-Xhg#BKW+OyL|byMnN;|57d``j1-6`DpV5?B0(TIRo5 z{XhNQ7gs4*lZ{LZ!MW(1mmE3afAbE`k3smq!h}%Zw0~}BDP3^%OJ$Q|^D=&j7{7H{ z|J{A1zn#|qyBGbF_w@V^m<^RvstP=L5Ro<+`4b)Oa&PZcTPrvF9n}oE--8f@It|0z zh2lcF=?FqWyfR3kC#&K2qV$zmM|Do;_-1)~N)Kzk&gm5@{4e-aWj9;AxJI`hBuOXG zFr;)$`*x-DK9NiFa}@TP|H*Ft2b<}6PwD^f7hdtcuKxrdu>#*6LN&0*5CPSrFMAq3 zqK-?w^V$#Jf1~Z&y;CYXrw>-HPEXG4EE$!Ng`mVg<-+A_rZp}I2F0XwoJXf`Pl%V7 ziw7f$C>>@2lL02A7RQsfpH)df{NUEd8;-R+Vi4o zz0`(dK;*-7q*esYY3OO~)S>W5KEgOjDZ1op0m-;Tr{uYm5rs?ZT zGQkp11m)^n$ghi7nha>#3QrP6mN*~ zVT;A!frS{?VGPE|km{F$L#;W!Y?1H5&4{w{T~_k~4Q7}i2?gcbk=ms2I7#Z0hT!B= z9c?oGe1s*anNxTk*568ip@NHt>=_cZDAq^$_{DzvF7%hwYtX4zynE>SCTxnE@+?P; z?JV@D>x};Jp#%SVML|?SesC8I(gsVbZ%rR4EYx-5ymXowCKUS1>iH1?!${FRQM3U7 zq`dVg26YDd%qU(>z_=0PdW=yRjDZ=BL7+3pEZ1kCuENK5sQaJi!e##@Of1@b^p>p| zfgsAN`5_Kyj|eDUUV}JLRV=`_gH}<7ZLpNRgt#0#@!%$(2X*3Ic{+DD3&bLODLHUZ*65o z!TOGf3p@ouF>xqV4T3{f(T3S-dM)~WT5y70bg|nuKm>=MiAOPDTJ$oYByktaxn+NJssd^7K zx%?rRGZ7D&ly6CGT2`q44FJ?g$v*}ktt)f1zZ6gCW0J%uh3`Il%Yft#1Q&n0zj4j#l5|-I;ovN za2KwDyE-96@^etz#?dXo&&tvp9&wk7Ej-W^jsJeM$ z;i?7hHRDv(5=N>3S~{N`;0Ww5jWuxW)zl#ip?p&N4qgOQ7pG6gR+bWIF8iMijSAlVSubF=fiXlleZNbjaRJQNu5*TP*2sQKXPO7$@GD5hl z7-pHet5=6M9+PZk@A$z1M8h8ubX@-^QcSd7aIe;MK=RMTL!;1It6Nw9P}*F4ar+V~ zrtI0ZQ<6INK{u&C>V2x;pfUuE=vZ6afD@q61V9z^ADrZ}~$oRyszeC%UcR{~p`b4aNDO&Z&`o z{6Y^N*r$DpC7y%7tBFa^5aa1`wmcW#E$BNG2>2dG3Buzi1k4UkkR!)dnxzOj$uD-q%g*VZh(6X!12FEDjF*uY zny?3`B6)BS&b$XAtu`M-ko4qegwNK)8eTHd0IPH%+rBE#WVVQeXAY9UdD9O_6;p}rh;qVWJ72liS{w*Z6U9KHc(ydSWm>t`; z@)zyE{=M2UXo;kPFLA;5a4=COCdPA92}qt$)FAb6A5U9>6Lc5QbwC#auVrbyqAq>Z zvK>}X8zkm4%8ajCSWH=*maen4X6QJc$c0}jCjJ*>fhX56wryOOKG6gu3W))bze*Qy zdc9@{_mV_qS)u2S{F%A#0wJDM&|-kUP_BmvV)H!#6s@b1?`EKi^`i{GT$04bwKZPk zW~dn9@EZn;tM(tp1Xo7L{)=&x;W{+`V$?CghY1J_w*zH;OnN6PM>bI*8ocyMP=z;4 zh%AplhE07yfah>&xp=oX0!*ReR(oy>8q;?mrUh7)kJPJFw~BtD%w$t;YlUxWuh5*Z zxS84lbjMob3Pec}-$!!e8yb!Qy|#J5r=!tt03YLWB`G$$Pwu~mAffvU2r|}~rABoK zf>=hQa1dGu*Z&-i)A?9CWz9{r>a?qULrU4cP3rdqriU>$hM^yvI?{Vy1`5&mdW#f~ zMO8TGs%$jMdME?AHL(z>U8j)LkQWZ8b@@mHJ>-T*fu1d$qonFi$N)v}p;Xw`=)iUX zUW@c0h#p5KJKP5*Yf4JfonUE^Z?!kK3X@e69FAbBsyaXW5w#E@pNQ)Y2P&yecK8)h zTA?4AM-%INv6n6NaNa?pWg!#d98-cI@GW4-H-d8hf+f(NOg*Oz;|YvEV?2u@URy}a z{OrYnS#vnhlRh~rpXKJ0#WD|iA&)m*zw-sxRY&XOu8ojw^+T?+S1pF+R?Qty?cdfH zs=5hLm*?E%+(P-?w|f_NqrVM5s4xvqQ739Sa(ir?Ro5xJ#Ek3VTe{QXH;i!|gvE#< zgZCo0a~J$TD`|6J$sZIlp3h2NENaP&6K*l1zM1o&d_{<-R{kQy#;N!?^OI>~#L^?% zA$B_g{<5c;vDq)vxUdj`m?clbpXqu53QG1GG-V)R`e@GjGGI<|ZNOq2KI7QoEkSs|%tActr^=uk_Qzh!p&Q3D% zGc!#>NeJ}%7D89$E2HBj=|`mHEMK1zZenmHKl^Zu{QxTbFGA!F zdXT5Z*dD}l=%So~@f51eZ3Mm|pB9TNzQ++G$lAY}%I5yMN*JxF>6P!w$bcGG6B`tZ6MxQBsoMA}yr6SCf3KESOv?4h%D6!Ll z&7oV{bM)9^*E5A`HHlV$S7Y`k&q%PBkHs%Nd$~-%5hlC(CRS&>4-qNB6A?(*I4R5j zpUlO3Qc2ldyGM8Tl?iol#8lM&6R)2+EE@BS#rTC@R9}O`$$Ce8PnnitDE6@^`Py<3 zS0I*qApq3YX87Bo&Jj8&cf1Erq})bSWSYWEj3+DR1$Sz7tDOI9+H@mvG7BS9(jGJS zL>H-%v!wDf_;u`K=JvpTS$QEa z-RAomX0PD!W2I?O4^-)TXD|$w<_NPb8TJ3u8I{RA8h&=~+#%Z3_}(#Fw`|f}+qWvU z|MPQayvWXo5TtglLZ7QAWNT)jk&dXTvg_u9CBtFxMhihlg zxxvb)VRvQs>>A`Y=k>(uN@vA+H75H#5bkU52jYjm(%vH)Hg>Xg_QrAGg3Pup*68s= z{S(CJ45C`hprxiXOsd~Ux?kkr1f#`sI4g)K1)?c1GjZ3BZQ2fKo>%}y4s}WK*D>pQVrYrK3ei%Jvd=ZlB${!w*#=xapnyE!U`7T^It8Lx9 zQS8sBr^_tV@>5(}&u!`?jaf)C8n-3{bW(}LsH6uHWLxztY>1(i%GK`1ikwYlJUitD+L(F*mPAf4_D+X|oFeYQ%jqxC`rk2D|_X@Pz z*?)(TM6q8lC7{Pal$pV5x*UogcbxU}>G3jqcA-T!6$eJichANl;gc4G7WANB8l#}4 zYe~v8`%fss4U*^6QE3}<$yRe|rV0J59fbLCPCNo=ykYDww=n}F8)LX06G;Q%mW}J( zJ2rJrp`Y#O(K^L9kf?VNR|>|nvamC%D2#izD=L?a%APH)C*?ViY*73b@)+zBJ2o3b zTF%Z}zvCCw;9Ymc-_!j~sKd$AT}5l<|Bx2iE)Fl{sh}d9@PDMtozf$;nKn$%!(gR= zt7rqlNH=dvF(Ofj0-1@QY}%k50z088;nNzG7<^ zq^D1uJ#$jqEH}TFW3PBE$I+JDfq2MOA^~&94}-$R-VsG)Uha!P>!Liort*14Q2c-b z23q8B)J2RN014?}OgxINQ)XRhGx-RlJGOlyMQ`S$E9R^}nB*bVb5N{e+*PsW7&{i@ zz=*-I@ zi6ii!kr=F_L7VqY7`I?h)|*OQh4{!1m=b5$--@Yfr%r#SPUYs~14IL>X&SLL*d+d1c`G+w}K^38r$*LCuzB2lG0dj@TeUO7W6XT zX5jU=x^V8DJ^#7dPaNk9WNx}4^w%N>xhk&*um07X!MZ7Ph26raOS{d$6qGw~jk z4fnyHaJmsyBpP3gZ8uV<;qwquH*Z+?o8QCtk=nk#^o=i{n2anz*KkLhF&-)Y_r8WZ zc^2g5J*5y+oGOjR9$l{Y81xmyehpFXK=0h`w0`&<8~ zf^Y&9Oa}n#7y}cY!61e_fI-=iav|CJ^%yc{ayE(yg)))jX7rM+*=-*rxn`K(E?C``U2hlH3V0hU6Kzpa`a^*K6trx4pPI_WubX&0|E~A&T|}9q$Brns05b)! zCRz~7Fs8}WNytyF3P5>s*M~#F6<48#MfsSKV3MsygCSmSQ%otpS2J^Ny%*6xB|k@G zT3tBQ&w1#9IYkv8Wp$FubYu^fv>T8n+VKu3;Jc>-l8Y=bqLQup2rpC+>i=d-Z|nOM zoY~Ljq<4@`-Ql3LC&&9+9>4#tGdx+fpDt;e*01F)y<^BLD6)P5_Rbo=zgDPGY7={- z^;n$~YQ>yXn{^^%#!0#S?AW@6PeSW)@dO?yp`;~yGU@CIVw@CJAmF6>1=yTWaw^#^ zh-jZg#OgkgaroZ4ed}hWX3~}dJ@iFERvyx^-U4uSPd7xJ0jVKAQpitA)bUP6ReMeMHd%ZXZqgiy-0o2BEYAMFn zfTsJ3X^a^RW6LGf z1*@mV=}bn3Yxy1Uv$-aqE;>Yx-g4%h!YJAK3W5dazMtY}K6CbTGmD47l*FQa2u;6+ zMx48bT`wiK(N8cU8KOdcK&Z!cb9o^wYWhRmML>AkV@e2Bcc6e#c28T71wr)_bnE27 zeY>S<546;|u5`aJ>@4CiK2;JF%-m~nkEC(ZxeIpxqBCi2bd%PplgGvNx-GL}F{++JfAZLA zfYUK%U57=pxD!$`zc5^ycBgj^+PqO&76WS(@1MVix--WZnd&nQ z9%4K55X9olwpnc%m~gho2&pKM8bXZ=I<@0;hQ9@GU>pkH!1mFS{~VmOdhKqc1$~OP zH|2ZMpp%Uq=n$!7<)Me$hy2P6ESn*f)*~#=BYQ~syI7*a*SxEPz0T^!6HwBzYsgyG z0jH3*Iu%GN5WzRSGC<9@bbn4+QG` zIUd^P9*D?Au|vR9(|i8iZ40gW*4RNFoNvoOjY6BBB3B0Vc%>BR(st2?WFz*df16=$ z#4Y(Dz?TXApm=NJniO|Prw4JzOYu~|zjO$K{HqWPWA4Z1wgf0X(s($%f5ykFS8BU< zZdWlFVAbDaF_a`ojXE2;89!5s$iv9S$i$!`)e9q8cJ>_&Kip4nxfIPv4hmqRG;ukv zZ6v^T%-76v1umC7i&7b$0%B5b#pPVR>|EUfoy&tzLb0S>vsdQiiF$4AnpNU@%htaw zw}Q@24@O^zuysSIC+q*YVtL=wk& z;JUpY$1VP(<5S}Y}JkWg#ckcC2> zpCEwN^{vt0f-|^*R%pf}tgBrkT(Bh8r5kLY!(>cEM3<3|uu6p!k{p_g1|2sWY?9h@ zC_00_3bfBN!U>07?sA*$ieamDvPT6EjoTyb1jE)6PcAqa}ab z#n6fGzG>1v29DG(w)M8H#lG#wy7uka$p%IHaL*HBoq^huTkk?V^3x9@)H&~Op#25Y z3WKDnwcRg3FK~GIYG7s4mR~UBbtr))MGJxR3qFc#Cu!l4p4HSYV@a5AjfrmgLLqPC zB3pDo{n10(nw2Y{v!-M!!=qZR9w!NHx>qw&e1@Z%v*)$$NaJRM28}jDFcb||97LS! z(fN6iL4pTmw;SwlYV(cq+Lu96tNJPlp+$G&!lak8!!3YWCH3ob z&^9+hlyrtiqAwn?D1WiduOAk!lt_9^$hqNPejcEr1(+<1b}pTTW#DI>g(X#FB510z zZU|!EGEMLTo=wY;)KAS0Dcu?}+Xrdicmz$Tc3#MdX-k>>2ta)W+X*9ozFmrv;+kV8 zXFiIoKim}G7E9BP172>nE;kLZhfCfcU^RMrfITQkH{>3zJD{zSln23&aF;_t`f%Mr z^(uNYVY|gluci zLF)1RY#Vw*bIuGTs3iH4(E4NzV^x_JUhoY)S;U3oaWLpx8EGwtV}FKe4OuJ>7b zJg4IqwtB^K^~G^W72JF9gN;}tYOD4s>?9X|Lgj<{I*NrupvaDUGy4_Xqsa>$;EED7}-WBxHlW zE+6Ki(v9{-A?$q3S3 zg55CTX;52a|E@-h2VoU3U;yJI`dfXcs#}~xQE0ljgCi0pL}QJTu`#aY@&c$Re}4XR zuMG(n%15HRctLRG@^=)Y;~64rM<%(sA(|{U<_G?Wss`RZFeNUfp4EDm)^0sY?+sIKm5614iA9~rW-hz~SV7RMU z^%0-WbsKD)8L@%fjtBsX*dXTJDY;VK3J$NljkaVd?}9?tuJlo`m>dPER^^x!t4$Q= z-;G9z-wI(kc{9Ypxle#dJ=h99gLDP5*vbe*cGiCv+{WzDT)zG4f>tB#&ZVTP+rlW; z9)>LCzB7LrKu*tKfz0;nfqJ5s3W5RYWbV`8l6aTHq2J^|THZu;obE#vBOp;3 zg^{f~%j}zQHm!{8XtvSn&ZC%Yca+X{y$`g2{Xz8Dqh zFKsCfqe=@xL|w-bRO{>t=Wx|tGaSK?cBM2u0TEh0NL+se$cR~&Z?k0@jsP>205Nq# z2VVgq>27<6Fx?AR2M~U=?0xOS_utbnuaz?QY)YD!6<2OYn#=*zuvM(M3ob~(Xu*o} z&ci&h^B6*1PcM(Sh2{x3G1>;gyL*3kKNF7Czj4c(n$Ao8lR$>1$bnr#mo6bO!+f_9 zusNad7y+PbrFsmc{L(y-Z21YSyJ{)aJ4;adgHkdaP6&m^dN6cnsoiNCB#ukIB5v8y z?hD)olA0G{|DZFT^PhjFtprdSQzHl3fi)Dwuf$!fit5)u$#}tLx2E|PFNQoO_C2=# z4o-RBzTMg;oE`8Nt;h9`U=W3A5FRJ9qQE^THz69xa%V?lDE>x282w`mJsQnw`C#Z` z*#m3X>JLBA_8{|a`_@ggGS{M9S6Zax^@c98AQyiB1u5w$v=hb6@=IA&^b7tP_LF|L!TvG918Z-QwtPxTs! zgpi zd4y3R^=6dje?BZdSt<{}dR9{x0_Ofr3d-=zKq!1^N)*(bQv?6*4mh^&!d`|Q1x8o5 z?qLYnw60dQJ8-=Rp$l9&N3_`m-MnYckwg2n53!l{qmbr#gMl|Fwdauvgjv((|PNRAQsU6BwaO+Te1swEP&1oWb{#+h<10)QrevN#0**2>S%Q=+v3d z)IK7$zy%8g-2kXy`qL2P<*kSLA}$b_3ND8u2FFx!1Y*E$4s%}iR-9r21lnTvInGs2cQ+rT;2x;aU?AcoWpLthJ~BS2Kmu%QELyN9)ALMWIZ;+ zA(rWZL8f23*w1?9dKoIJklgL_Z@qOhB0d)O36ZkLM#kH&yc+W^k|`6R0k{?+Xdm@9 z+6BY#{SeiM?=O9=v>hzN3ty|_eZYqFxdD9R5ZEm3t>pPI;=CVd1SVyCfuOg^!=Vdl z;Rx5PNlG6i^(#V*HdGbLnp`yYVc3HfKQ(RYNr2>;imn~e&*jHdMCUw<;DO5>o6jBJ zt+is085p4*Jh;zI1P#x-O&d4}UbJ^<&7)RF9zP3?D{Uu2C)R(wnzdNPwHonZGX*li z$N>fIEV|$K0*-ewL+_1V$k%LvWNk@7WmN4+bO9_yM^)ZT4F0UG zgBjug63A%sA{cQ-FGa=MNm6`Q?@)hozTVOlj<`xd<~mzkr|5ntt2qTJE&l+j9e^Y8 zVX3|Zo|D(vsK_I}I1@2`CAxc~X4MMqy@l`muCZd-5@j^qxNeOiF8h4rpGaKY6>$~o z4!Q$-cWTS37yU0^rN~isM#IuDU4xObXhEUz7GD}%{n7H@{JtfN-i1Q7OxufjlX=}V zDvzQTqcf&R?aF*RdRM_j=<40od^=^UTnrvq<08XC@1Y8)!+7O~OMmku2r$Y%`}gl6 zrb>MzL~v~>tdivuA)?hhn&UqX?`%Q-zh}`pE_}RZB~&|Py)&Sz{37_eR)|Jcma9X8 z#^{{m_rB*>@TMO!7Qo+OuMWyzTeIpngN@6$;_)9y^3FKe0MB<0E2ZMVEgKH4^*xH< z2M_LrCh&o_WbuOE^-djp{GZSIU`Z9Y@e0l5+KN=j3(C4R|T=F!x56m*uN1&22DoB!z*Y7|1r|qPLcA7gESM-(N2bkTOAdPW9)KnG!DHn z^CLQr_Jq*v+p|MkTD9;uujERkD}M)GIhY;X+;KQ@!*`+o?au_tHmDni>v)jK&*$Pg zqf)7@;|S06k3clxHUI5%eXrN?7p(U_M7528H1cpkJFzb7qXK;`>R{!FH^ z?7hV>2|+tSbjTOy&nO*_XBuRsC0#oIq17FdoR6?o%gv}(aV{O=R8eYrXKFtKxb3h4 zmLs2TDcJXE-bI5F{kC-7kn%A58!9H{p&Q`3t}3>BJf)s)-t!z*MdTltGUdokk%oW` zYjI{3=EG5+vJf6}6xgXBZ1WZb$h#2^7hVUyl)6rrZ$?V(Hps?R&lN%;a&`4@QHO9f z1RJ~|U7bFe%JW9wzPV&IOBT^jKtq4ds0HhwIq|#7&O749n8aMPPlR^x-j_)JyeO*x*v(| z;fenM--2{?y&>8Q9Cgu6k%PT(DVlB1M}Itfh)jJEJ^g6ns`UN7{yu2Yx#yrER(=Ne z?&NNcpkUH1mrFvV35*hB`8%fTWOh+x`-na2?_3nGflp=|;6E1u5cf#_gi(-;1~@t= z!1;6=vYGA$8$jm%*w^XQVh{~);U@ETib8mWxOxSI$@3YVqY%#wTT77@fdW)GOu9pF zw`-e}EHtHCmMmJJ;t@TNllp_mXi{`ry4~2ty*TV!TMAv9VMRS~V6TS&qtUDa9@WbC z@K60u9sMiHZT`9&QXz?Xd?dQgJZdaP4=iM2mYhsLT!p7xyrCU4Xepq;eLz`8tCktx z+Onnk9k^`(6k`JZwzhUPwse=;YA%l~4J$ZKvlU|vu(ho8GE{1_()$gf(V50OAjw~R z0Ys^o0HT{fXNF4V_4$WSMk&E-#Cj|TUE?Z{J&5e_CrBoceQ|=Rblbcpq%bExI4~Y4 znF;SwW1*j6-N&m)Egwk67Nhb}B3j)c&PQx*^?-~$JGYDT9AYharvvD!Z3Attt99Rp z`4?djy>l>}GWWSchb1EP>XF=7en>m6a|lAg{f?-`@6HFOtJXFFiw-~*<;ji zXf2ovL(6~u`H~_B?mDF^Vga$Aq9x<-n6=FT!^fLG;|;b@#1Xn%4K#bp z;;sjrofS;A%a^oMCypVRcAK^ia>xqkkK7~%=WoggLOB*PA~9oB>Tb7%o^`+0;nDL_tbLNNmhomBDwu$wDt z(RH)vD=504Pxw`SvU%f!TA-tK6(pF$2yQ2`1-G-JRC%FslGF_E0_ABF2)4X+j8Ue% zJ;Y$aK{JQQcJAD10$H}6bE8ADlqF^wOBcSYEnoVc!XXzRz-n7Oeh4ap?Mm>oMCq@A zA6xN;FZdy~e9e3LWPjltv6*_sC+YCcU{d&br9xNbzj(`RN5|tPFKG> zpI4{Hybr{qLiX{R6^ao6{JsR8f#3Vd-17yIHdk)7HSoSH0jJ zZIS0Sjzw?3Np7N0l0d~HY5k=^pPC4It3K2u!{7G>P0w@4JBlx)w zdnNrY7I*=lqSV2HZIHv%s+1AK2aX@e+>5DwrKo#vXa@W2(H7)ROyIuq1GB)d+(Z*n zbsXy1m#>MnhLJyxMD5YlTW5fb99MR`t%?8llXIP|VrA zdk1p;@7RHExaI^&3I%7LY>hP3ePZ7R4tr zzF^NDmzT-`k5L%t&S=j8Zcl_M8ci<)b-TGQnp#N@40j(pEjF6vUOIVF0JX$|v2%{E~%H^-M1K9V~a^oJ;$bc0eyssTRykDGu=z*otfLeYV z5Nr9OIIDFK+Pci)Lm5}S^u0x#bY{Ru%a>}0j~pbyrlA!9@?&aV=nc8>qh28vPqAq2 zhi|^r-mg|SKrDnJO0)9XnvWCXsm?imMt4}cq-Dh zOVu|BLa|SRZLO|1tgE|R3fu%!1>UOxLVU~(r3>Dg$6vIn1@jfic&x01 zQKe?}N6?QpBVfy=eR{l3`}|Zxi*fq1V>p1(_XD9aJK-SUwr$ynVmVm+hp;zMKje!z z&BgD&t=_?Rz5C|tzC&tunf$HX<_+s>vCW@o5E<4<@vHzel$;5vzGRcZfCBopvA#skiD;n-X7B^96ahQXGlV$NcZz<7s=dNueWpS>DgXjHG2#Zeo zzN3)>k8XQcYtT_oGWMF>m39X9mEob0_aiD5*7A}UVeodo``VNLrlhHU1PJkW6 zzpV&c=c+xRMY;IhCcjC1y>4juPvCmyRK0c@$H}J+hrMv!x_PbAS9Q1o(-d5}XWTo$ zm1_;LV)9xo&QY>!?D$S;_)7?~dmn)}YwJt#e;3QA!`;WQ5+LnYhYYcj)A1l&zjh66 zx;3JQrK^4la7i(VzrG}}oi`_R>xQ-BdXzDFBYPOk2*H;(#UeLs1k_a?X*A+o zwRO=x` zqNKQ>ho78@3NZ&Q_MB)7-+DuPS6YRK^tDo^Al25c`Vav~V_%o^e?;lS(hhjj%XbDM z$hI}&iW{G|hgZZ5i{eA$xnR4L-(Wy_@ok9XtiLJ{alxnU9lT70CVqe>-NN^f(p_MZ zB#voYZOKv82x#r#9#V=LLg|H{EgMj!9y?zV6=G=ft~%P>q*1yPLDi*Sq@zC9ts%yW z;}M2%+&3KJ%+nOCPMtok)ZQhF7itTnV04dh|KZ{liW!Jv)W0SFnxWuu6?v~TBeHu* zIK|#yyikhHn=-8nArO2FIPcoET_GmhTO}Y)sC$_QmkW&Tq&TL#q4i1x%kIjjcq%xRw>MDAhn=$${1XZFA*BHQuLmicp zH*D&JxdNX*ZK%_LNxU}QS_J|px)OgBx;kcbkCW0Tp{OX~kjU+Z;^l7@74WV^LXidm zAM#diHEe4ZMj8hFYF#lp$*P6O6-gL^V1&w-B8?%GXh@&*ickQi?4Xu=Kq2!Mi0^CH ze8hNwH)QT78J(mAEs|tREQE;i)~E_$_X`YfjU`^O)`h6XT9pN?;CjA zEBCa4>^8DPXX*Ep!wjk(`WmVF7fVfunmDyvsT~_IkIoi^Qhyi_ zC5_|k?cCu0;Ty%DuJWa>jPMhaZYS1kFHdknJ@ z`xw}^W5*|ML@)cA{n&CKZ&dZngi+!uhrbE_r8N|8Hmpa{g)Sjq$lN)RZ2~t!hF*X= zM}y`{3w#Um$|pJsadrX3;r$2pN@;Su2i>$&I1rF_v4k@G@uLUD^2Z*THqyd+_zBm5 zGcv{i^Sx25pJ7&cM$AcKR* zBnUF#k|@+5pdko@<^s74Dybzkw78VjP}*we3`g6}sm@rbw+cGAo1%kD;*Lu$sW~pC zE#_FJW?Ey*sdL_}`G2nmhOE=)(|KS2@88eo8G(78=f3aj{@vGpU$-m%JsDz%;Q%J3 zXW2q2Uh}M~J=29;hq0Za)W~VzUPGD9mJz46kICq3XdGUH;ktcCE~#miJrl0to%NOa zSbagT%G(p2P5qR90vT-12kDiw<4}_COZpok#f#F!J5}wNj1oLECcR!;+u2z!tBR$7 z(YdT6$=&bjdQrfv2PXd!5FI$nG2N~{DN)y#1Q*W-=vDR5L6$Fz#}$7}RZSq_qkcYsp-VU?=t&ciw=*Pff6 z6)ZAoMK@Ep6W;c}(BPdkI+RP8jbL7U(~{gP870DWB*RSpztPEuEDXs$=|l40 zL|K)7wo^(_SlGd}cJ2?Jcm8iT@CWa2+c4K+)XG+a`pxSl0I>#Y+|Ee{)Yx?Y9h1d9 z`L^(pLFMR^k52?d@c+Tc{_uP3a7lAh5xrmwwo)=qeAzG``vG(8oqZb5_QbL}tjW7; zX{-kBD5{g#N5p8hsmsd~*=_p}DJ+@@tGuTpDN+mDMwW_`OYAxS7iTrGb1kj@b{VMC z`&+aLO@XpWD)x&wA{?9HB~HtrP{H63u2JY`+k_=azMiCB2$h#q&-+74UQ0K5_Wv&i zSEGu>Bv9o=|M-i=5U@@G`HA!a(4Tlz-d8USS7`25Tn;I@Cqpgi9ds<_VNv!c+G?eW+0UCh%%rwIN=XL&bIE;Uc>N!BaJ9^8>AsoV+n&O>(mUbu~BOKPs2kE?zs&sp8prA zuX9bg>a;T>Bu31OJ*Y+x-*e|~1|d%1L1MFZPy>hG5N@Q5@K#aNPM$axcmor|myO-} za-ONRT6jap^sAU_UieYnTyw>*-k$`{9nwAk9H6h1XU9kOv)Mo`UX zqu^&$&2FTWn%v9O?^gtp)IL?c4bB#!*yG+hmXb{4%KAr|2x`@9Yz@O(s9A%aw^)6$ zIDT&fl_eS^MvOp`a(?Bie3C9zP5q8dn7O^8Nk!{s(l^Hmq75rbtiU5jyxOXQ3g3+yYZk12smHGu^Dcs$NX6b46-lxJt`0mFSmM zR|bA{XsV`Q^;Nb9QrQW-ItP>D4pI?)k0%)t1VS3Gro!c$4QuGQX8ei46mK=XqZv$Z zPgU@=ZnN^-$}Wk(EKWcbyF~zi7*)>x&~QohT+KEV)Mzv;+t~u;@Vf%` zggxB0LOHv0PRfMuaQnvJ#kPvi{+iJ@cCoukbCZeFQl6n#4StN%2dOy~s3o1-*U^M_ z`Cf}~Q~Sh(I~!ujpKI=&nq`Xs*O37xmny4?4^b7%;zL@CqiOZZH<+A7fu#%FfrWGD zaITxFdxCUNoS6IHrYY(G)0Bkj8)6XCthpUxG~FqPrz1G?cwV0Et+M-@jH-1VnRM3S zDWq^V33*E`34iquhle-eP!bdvl{}XhwPgN0&A%h-u7M)Pkrz%I$L$)JARj}^+&0KWc`+c2@YLuq$)U@XD|!#1fw#Y;vCve{)_m= zq!*23*s3b}nnHBqi92$X0*_~@jNzQ5<8;DPoCm*l0(iF?+D7Sf8WZ}}kFR9l9K$au z=GA=lT7c@WlT|@{bY>Gu$rfCz*GKiD>4gG_A1+hW2EVFCxzYh9W3$mS?;%8Nmrwzb zLGoh{6@<&?>~Zu|YeALw!$1(E$-WhJ`HdSgmE~C-j`8Cyunj)25rO25qwfTEk+&*7R+%#I0MqU$8MuVJMLcWpys;noIrzv}fXm=Seg z)vj2kEVr6^CoHI%qseDU^u?gN?k*IGAh3aFm9Aan)JYFt zkZ|)(A|6^pRuYrotiMo5otmA|PFZ&J#jJmdJvd;QO$qaKaYm@ON8G_5zU$TaGL*^F zo{stDX>AcoB5{$b_>hHR$H}catc(YaeJEe&Srr#4hK`j>Qs%`Fx}8jv^fp{{uq+>C7M$BS-8Z|j6{3^hYi=mlKvR)^se4Y-@sYSMLs-D|&xdoSSPJEBT*oMd z99+*4NgBx6>powaICl7;7V#A;UBCb+n#P-L5SN;W9!*6n??;}g|ALM=-+(mn9>W@O zKFz5!F4q7WnM-}kVCe&D3XCF<%7U&jo&ytSSsppsBW;H@NHc%hU`rkq7^^w8Vvh*_htKgQTSK{_NiN|a(YFzVW=!+7ZsSH4R31{%O8ab0*V}o~~ zEhUkhcO&J!H?v@Zs|KTSiY~IL2l$x-3+Gj8J^1$*oem|YvG;84h? zm(ZCD3L|dNc9#fr#QV3ap2SXwvV|mL8M{cr`4H{*$f*%FCTc;|?7*A2are-Lrym-7 zTvZQbo1wh`e_CMeKsE(B@nNl4kpW!Y833SP?{Wdae~~&W46KP}Q3!&--o3j5OWm^r zee-%&sDedZQdRwQM1gk|AD(+t;+oL-(fdb#gGQP8pc0}zUNZ+DYwka9;PJ`DhM1d} zw;sQ09l>)|>qOdut!t;yr4OJ4iT5t5vrpKC)YF!p{Va7OjosMT@Ak50yo)-8t6m?+ z8{3cSmzVQ0p2H&&mzK;}!J;Nm|CoTk1-?puDyf62e_U50E2xk|J$j}@^`O>GwJ??s zPaF{l;}yjTDpRv=^(rkAsL}rLCv@8SQXWU)P0>9oB`LHLU+jKuXDl9Y%R>#6_Xn0k zdEU@3MFVOhH-JFGM`YWEJ z+!qbaJx3{5ndyF2ewQgE6-Y``8kg9M-X{9q?7zPtrH~K6S3VZ5FDdqm(1QG>ru+yZ znoH)*(u`!bNpp(vEv-kyHKBY5X~zs%8@npI8&Nc|AIV1Eo|H(0d$Z;$DslwJ-Ve}+8YSc>LQXkM6Xp`QsiD;hW3`@qBI$RDT_P&IU<^6&Me|~vJoX*z2&%+{ne5EM! zQ8jEuTf)+y%H^Nc|K%3$Ee}^ zEp2saN=|Ldlz64J|3O3}fC208ThLYB1Oja7~9XoAA0+$!YrioT1d5t63&2kUr zlIldriW;{)AY#9QsgXS4ryW*!eb;YNS!VvQQRL(5-7|9t7BUD zbmfj6(Zz__H&5{X{=0_)i{NbT`%tdaCzwJEqPt0of@CVG%cf3^+ftp6AZVO>IVw?7 zjs@sHd~*@gaK1ds`BD!6m$h@)Ciy~(Og67OB)jcH!sV%}@(c;ZcN7n-58I185&cDIXdSJI0$HA@4;vp<1nNTTqIvU^qfeHbNp3F4B* zdnSomy^WyZ<_&8lh_jd*MS6)9A)eS9)%F%9vmraE9&X*ZP8x0ObesNUdvcOpM>XJx zV0;Rk$NzIC@B_gS!DldHlzW1yj}ew2{o9LB){qr7ErPOSTZrHu_z)2fN@7}e4_3F^ zw(-q?TfKUp$*S>^Up<(#TF-;KbE4GV>+*T?Vpw2b&99m*!@675-e)2+lDSL}2FBvoNG*))z`=d2i9M3JQm?iz zj_aVD>>N_g7uW+hZj6cYol_G3eS&@COhwJ%8_N7Rsm<N1$>&E(7Hr&w5H450u`zn%~sg;Wyq_8P?MHMCg3DZFq|yl>YIR`uiADf9;TNjx32Y{-(NnW5 zuymn2h_GL%Vn_nCnuW3lU(QjoNn{>*m86OnaP?59_3^l=AEK997BJ;Gu+^s|#_1%N z3x1}2J5g6<8HynP0DD2x_6m%)q?tctMJQK`P8AK?$z8`%WA!(c+}eM#rbiDEXlqTTSht}32#FsS4O znOek~vfXZ=qRXC)WcAa#@%kK=(HkVSh^@GhemPj(%We$_s%$vnWELR0J zM`j66{o=wIb@6RpQuZDueANDo*qAjKGV=H_#E=*)+@3dcD%y_iG0EyV7#FTi-(M19 z46c&Ro7TgQmniGQa1+MZT5W!bF$Nwd-@_=Qb?-xhnEf3RqEbr+4j3ncl7Ac4uT}MX zGm7+L+lt+<%Ff`iuoX~3+S3uC5K*0hGp1W1>cP60(5Ciw5fEOve5tZcGWFA*o&4~) zca_Y8x_sKg7MZn47_F~z4vg!o_}FyuFbv}o$3_{s;*}Cxmp<%%t3GfLH$y#9U?Hw3 zJ4+VKQ}(wr2CIsZ6fG#f-Jnlng=sWjwy;`;sihNbVu=&W)YQ6th(V!b@18v-HI2X! zDc)y2R~VO0m4}uj>3)TXgXJc@ZW-1w?j_~(x5^T41kQ{za8u_PQ)mBzX(z;IZeC2(P3#h`6b^|BD4a^0i>NoTBi;c6tClSw0NH=4 zy8O2ktE!J4O4?fl>X-AYctdCcuWGMqw-1aF{iKLXv-9}hjs-O*NUR+MJ>*@I*CWId zNBQR#B$m9vTjv_XqN07QEyh`JX%3SN4&&~h_NoHoDDyig~%CNV2E+fR@!g!SNT@r zKDcrry^pU4wfZd;m4|4scg4kM`-W3^JzEEA zTNJwm*@}?t>X-aae{Lkba?DC8Q1z)ud+&La6}vMhvhY z)r{A*XXdFH0r#w#0?FP1@sb5GxeT9?WcPURoVsU%KVP!4?9W{|rzK9y_M(~ZWA?hT5P$W5!&=q6 z2HtAoHIBWgL@&LV7=9JYx}Z(WwM?u$dlU!TXXhyq&cYIRk&3D&+F&bbjf#DUs<9Ef z1{lgxak9+T_&)MfoIKass=VV2g=^)VC?G0O#~E3!Gx22&_KNM#MKQ`afs+5`!V!q& zs)7XPJ#t8eY+4XiUvRa5{~nD4Y~Qv8pXnM2Pia%F;fjD%kYNcn1XqHU{}#4*Mljic zt3I=|7ha7k;f@04bp%d@W9~p<5THx#E#Y}97P*@?-AU0oRUVStSy>m5(WjLIa{nVa zPEYZpC$ud7Y1ivYLQpo>P(U?>4e|qZR2z_NDBqk|6yxGpc**!1Le=TB~p-p!bhl#>BdZ;?(q1Yh25zXfSj%QELcA+8I zJIm!Y#rlSu22D|E#|tdVcqbaA|B*OOc^!rMcJmfAL(9g(NM{Fg;$$i}t>pHzLGHE- z2Z{tBL>>tMf^-!63DXg6Pk}7X>7>XO;tknn#@w6mB(tNj4bKrGob_W-QW?ND%cWPE=io4b0 z$IN}7=(?@N@K$Qj&ZLqMIQ3dJZJePE$B1XK)W(OyZQ}5f1P)~+Xh~jOu7+r_ULHv4 z*nWsAUkVZ&1C?gd5kEsdeWd>v>gg;z` z;9saIjmZ?s){716*fRl)XT9=5K$Z&I`SuDmDV07(qh`e-idmU=Sz=Yh_}7j52AN)h)2K6rb&M-JQ@mw4 zV%Rc}!Zc=gN|f_1YLWg$@`q#?;scjqZG3YzcF0ETE>WX6D+Pn^>P!A6--)wB?p?lU zo@OqKvV{3_jCh3}tQN}9Wm0Cu235D^Ym5!1B%Y=rKsU??e5t3@U za>)?@as_`EP;kGzOkN~exMEO=H7>pitoYevL--ev8+puUYo)3$cGIaJ&y$O7d^?H4 zN#{6Yew-(zOc(-6$))%tXfe6WY!SwI`&Z4>c&}H)|6s9HMT`s(+iz#zSI1 zMkH*MQ#_&jL^>wK5t>WJhIAU2;+Y(?vd+xOQvOKFMIK9JTZrvkMuBqvjHf!cf{F0X z#*JyMB{7uqJ<%A-QV~^sZf2+Qy}ct1yhQ|%#3}DkRcFc7f8rdPRq%0s$`Z9aO`P?w zF%PbmxIzzP;5o9j$qQA6_j^SUFJVPZ+)&7>*+&&d_qhys^WMbLCgwsNz()*vr{wU9 zV@@QWxVnY*V&q6%b~INRmqvTMri@!^yX3bo@Qq z?||dW9PB1&B6A{h(?I)MAwCoK76$(=Y|-B?q{Vp0Wg*FgHy+Tt33qOlfPsz$X)kym zrcPfsJYG%ST$lh$PMR+D*WfdmMDP7m4B6pwkAUe;_3S?~I6vcVXy$&_z}}TFtkaYy z4geqfGJ<@n`-?(VO#+^d^noZ++m9s~HS4ETUD|{Td6$E?p5K^~peEm(OgWYJatvx} zTv|*s@_1h97C-nNPELMG4yBM{s6sC!?@79@om>5T|Km~K#aUjP2&v4Iv-{}c!(0=% z#;em$P^mg1Ccl^y0?VeP(rrI!74}&aj`=nvEk!Oecc^`P3U5($hdU+_$$%BuhJz?iX^u&a znuEDgd^$rH-kTe>g-O2h@XqSYE2%M|;*-cyQAs`64q6sRgnXe1B<{uqdCWG#q`rIJ z6qCy|{aKcZEE&;oWc8qMF=dahoa!D5_BeO}upykcu#L{!+P5@`395r@^DurD$ZbulA3>_y#h zsLPuzUuPt#i${|BD$miv7ggW`o^|Go2vyUTfr`TG^Ua)%VbT|fIJzHp@mP=+GUtt0 zICV80* zgQqLi0CuNPYxvuEeVj~UUoLTD2ns|vNC2!@o$j2*9*8PVuJF7>ZE5St!j27YF91sJ$s{uFoAF z)k^$(!b=38!Y0d9`W!>&a1rk!QpTwCe`K_Y6HYGzOYW9FN#BGM6{#vSRP^*1u2;Lv zoJC>15sq4U63MdSQaV{+xA4=0;xIC1?=D1sL=}@1n9&XeL=Q1vmyo2IU%?eH?r33&@^u3e?p@H$nM1qoF`dGN zB})*#7grx;*aai-?@CEm#;qXF^65aB`S)V+e#@^mSC0gBES#c@mLr9IyKUtW2iGGk zZaD>dhMZ?BS8}`f=lHwG5V=Ha7dc+8s*ePq(lwsbd=N{)uo#d_H)*_heE+ zsK|yPs-lv^*%xNr#^B0(z~EO)WswaG$$KHyq@s2w>6ClG2=<{KqEEivFf88{%;MCC zKy+?4LATu1JR7L#42y`sYW2*3M1kWhe*cfa+IxkM`e{=1_augT5gl}Lch63eT zXn02Ivyn8h9ufq;1gPFb7-aleGz`lb+<4l}{?8%CM~B#qW;P|TydMHX*1Lg}b0oap zKLA)b1~BIiS8siI9-ZmKg$C7k*Jp%Y{qP-Ua#>UJQu}DoXg8BI>%a3T+eb0m}fO1D%-`bRIhY0PmU`nUFW^v z-uoC~8CwyP?>ov+JvU*TRjwh^$+MU=BJEl87sxwpDqSZFvs8Qy-0j%O!e`YJ-_w_m zCIVsmHr)2kvyjgC_b{~ca=L-SmZI!Sy6c-2sG3Uy&Ec{ja=3b^vMRJ5$Ik%Ed`bML zD;X>T2;J}oPGEK)PJt_ZSeW$dCpZxzx*vJ7C!}i4ohU{=M|W1W0jk;;5Nf)($i#3) z#g{AJIX%0pJ3ejhSpNAN znK^Gcz<12x<{y{x0=tdY0&RKB-YI;VWEnw^ce`=~&wxau`sieep;_|q*o{43+|ZAbma-xJt;0Bmd!4tyZ1Sia$BD?viP#|V?qnS$}KAW0ZAh1 z4%u>h=8sYrrNnzg9$;||$4+r4f*s?Ch?g7OY!HTDA17@%;_e|(@pIWF(vs@iuy?*)0`A-(8JEm)rnivnBEI0B+ z>Sxr8an6QMILF0>s>@|VjLPvH_gM#(fV&GRrONBO74Kmm#I|p+jmHua5FzanKwHPm z6g4p>7Hi>kR=uk=eevw0Zl~=^B5QAx0niWOG4BO@_LiyS5qc+4QQO!h5r#Cm121h> zl&wChLFi8Y7lXEaS6HaLnf+*^H7IvI%4ul!?v=*LyoAWGmYZv|;`xtgmwY zKsejii@a$64h$aSeum<>!W>w>fhQQ#nQ=!CM4#)n*lgw7&?9DstLQ=e$RcC*(lg^4 zIEn2H4rZ4f@;E5st40>*->2-iS$I<%lEpay-=DLujgL!3s9$XcA=a({Ioo3}IJ$x~ zOwGh3`GWc%j=ty-{9G#im-Kk6wPouBh?+75oYuc66`0uo%qK`t(F*EGEn3+RL9gBvnpM_;9M=nE-p9O#|x0Ctp>KBJl{SZeTY>WBA zl(uJ46ktBnU~icSsPBXUxp$BiPM6R#Uf~v3%YKaRZ`O{=z8ntWT;GFwzM;u*dVMmk z_r)XFT+xkX?JkAd19JhFQ%~)GqZLu%XdVBobd6`PhX8FpVb`;HHma9nFapBa9Ef^H z=NBmNtZuPt#qDVwmA{!JOGR}`LkP8aSy(FTTJ%tF@616|)=PkR=L{Q!zr#6i8q`Y# z{=|rk8$pBhJ!t0X#k%x;%un7fP(LsdoDH<6!tI~xz>M4i?>72Ged@|`@#VtW>ILcU zEK$dDMM*q{s!2n=l(#jf5BdBsdh6G~(|RJT5f_0ZTN;UY(7=4XNbK?X?7w~92I-!` zBC{T+&-U&KWX`-xW|;eZEDJ{qAXcA>+_UFd;A&myO215?JT9Mi9$+;GT62e4k7Z*1 zC%TD~!zhtbh;Peb(%*eExfv30b6qsw_8!FR{scSl9HzIPcWB4uXCw85Q90>ytk;uG z%`&P%kk683L9~ox5x+15J=vAdv(7e&*~)(^YG>G9$ja zLM7vuOul_sCS>`L)-3b+HDKZk%jZ3z|A{cPjsK$KwzGqov0lOen!&M8$l(*_Oz3Lv zM|{Q+%@XiO0vFHzXdy-dTxAW`xaCE>W}f$1lIEB$eWhLA*QN_=dM$AA91JU_xB*Zz zS8)c}#a@UYONXKgWx3FkDYBBOVf>*BfOs^&SnB07i;tlvaNHRj=^>`v)s+=%ZiS}q zPQqX?4o2IyT!LWENmRmfUZ0$emXikP6rveIRH#7v5?1zVA+}>U3~v%jzv}~`%aBYh z>{Qy+IDP4z3DcU@Di+}ZQXIqj)1irQGw&Y!*wz!R0bOHX;Diy(KGVoV^+~8kai@}v z@l#WZGWQn@mcfPtvomWNUhh98Q(FnK{pMtVczb3crLyUoXCI11y$*I52#Ewap?vt` znGc@ZD| z)b%w33=}44>RBV{tlN4(p$rCNPa}KV@#p+OC?FIqv8E1U2K&KPjSGh_6DE)?eaTji z3sA#+$<#{@3w>GD_h*3y?f`4vaNuoODZ;NcIHmX8X0 z%JWk!?6hYWEi;?dBd^!q=UpBR7nsI)wZGNR4|_}5tA?j5#}d6-|D>2XC`T14^qBlWH-a9z>FJ$iuF@$ma2aUjm_%6X_nkQO5Rx3_^!z; z0`u6gL0T(UJ>gygB5iFVSy|Asj`y9uuFm>q{*%q>SReZ98pi9&0iNC&nd|D((_20B mdw+cSI%z1OjwVZ**YRVG_W7-@uD0%$OD+BzpR}+i?EeD4t}E{V delta 548 zcmZ|J%TE(g6bA6QGwm?b4ovH#img&wgtktlI=&DE>Ai;&kgs|2oSQ6BrhY(_1xcJ?ioO|-+^SmFb=Y3MAqW(EW zQC=0|ojhb0n;(sqN5x}ma|5bYFY>oXZjMd30ii|Bp|N`tx5n?(^0_rxRcMJmkfi7I zlpfG9<;kTOnUmFWIQceKjwfIK`(!LxT@$vjR9fK#uRA8~gO%y+~jOcA_4;5Je2Tu?G!^qY()t(S*HdMhj9%BZGZ!9K)-- zD~8oUt;?75H~g}fIq0)(PV25;5$`Rx$URarRdGJr^6MAJ49Rb^&Tm^*-Z^SWexKpl z$a05y`7pcQxl$u@rI2P6D>IJIa5jD%4qdiIAF|kwR^)I12jSun4&w-p;uzX+9PK!P pljuMvx^N2J=s_>~a2jWD7I~aQKh9$S7jO}SxP;5Nf~&ZOp+Avs%+>$^ diff --git a/Vocaluxe/Screens/CScreenCredits.cs b/Vocaluxe/Screens/CScreenCredits.cs index 10342170..0f1b484d 100644 --- a/Vocaluxe/Screens/CScreenCredits.cs +++ b/Vocaluxe/Screens/CScreenCredits.cs @@ -115,6 +115,7 @@ namespace Vocaluxe.Screens private STexture _TexNameBrunzel; private STexture _TexNameDarkice; private STexture _TexNameFlokuep; + private STexture _TexNameFlamefire; private STexture _TexNameMesand; private STexture _TexNameBohning; private STexture _TexNameBabene03; @@ -177,6 +178,7 @@ namespace Vocaluxe.Screens CDataBase.GetCreditsRessource("brunzel.png", ref _TexNameBrunzel); CDataBase.GetCreditsRessource("Darkice.png", ref _TexNameDarkice); CDataBase.GetCreditsRessource("flokuep.png", ref _TexNameFlokuep); + CDataBase.GetCreditsRessource("flamefire.png", ref _TexNameFlamefire); CDataBase.GetCreditsRessource("bohning.png", ref _TexNameBohning); CDataBase.GetCreditsRessource("mesand.png", ref _TexNameMesand); CDataBase.GetCreditsRessource("babene03.png", ref _TexNameBabene03); @@ -314,6 +316,7 @@ namespace Vocaluxe.Screens _AddNewCreditName(_TexNameBrunzel, 502, 29, true); _AddNewCreditName(_TexNameDarkice, 360, 55, true); _AddNewCreditName(_TexNameFlokuep, 214, 14, true); + _AddNewCreditName(_TexNameFlamefire, 496, 46, true); _AddNewCreditName(_TexNameBohning, 383, 54, false); _AddNewCreditName(_TexNameMesand, 525, 13, false); _AddNewCreditName(_TexNameBabene03, 33, 26, false); From dfc705aea484d637ca9e931a39f4c1fde81888ae Mon Sep 17 00:00:00 2001 From: Flamefire Date: Thu, 25 Apr 2013 17:04:14 +0200 Subject: [PATCH 21/27] Fixed some missing strings --- Vocaluxe/Base/CConfig.cs | 20 +++++++++---------- .../Lib/Sound/Decoder/CAudioDecoderFFmpeg.cs | 2 +- Vocaluxe/Screens/CScreenNames.cs | 4 ++-- 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/Vocaluxe/Base/CConfig.cs b/Vocaluxe/Base/CConfig.cs index bb43c7a2..6e8484f4 100644 --- a/Vocaluxe/Base/CConfig.cs +++ b/Vocaluxe/Base/CConfig.cs @@ -608,10 +608,10 @@ namespace Vocaluxe.Base public static int GetMaxNumMics() { int max = 0; - for (int i = 0; i < CSettings.MaxNumPlayer; i++) + for (int i = 1; i <= CSettings.MaxNumPlayer; i++) { - if (IsMicConfig(i + 1)) - max = i + 1; + if (IsMicConfig(i)) + max = i; else break; } @@ -632,7 +632,7 @@ namespace Vocaluxe.Base for (int dev = 0; dev < devices.Length; dev++) { //Has Device some signal-names in name -> This could be a (usb-)mic - if (Regex.IsMatch(devices[dev].Name, @"ReplacedStr:::0:::", RegexOptions.IgnoreCase)) + if (Regex.IsMatch(devices[dev].Name, "Usb|Wireless", RegexOptions.IgnoreCase)) { //Check if there are inputs. if (devices[dev].Inputs.Count >= 1) @@ -656,11 +656,11 @@ namespace Vocaluxe.Base } } } - //If no usb-mics found -> Look for Devices with "ReplacedStr:::1:::" or "ReplacedStr:::2:::" + //If no usb-mics found -> Look for Devices with "mic" or "mik" for (int dev = 0; dev < devices.Length; dev++) { //Has Device some signal-names in name -> This could be a mic - if (Regex.IsMatch(devices[dev].Name, @"ReplacedStr:::3:::", RegexOptions.IgnoreCase)) + if (Regex.IsMatch(devices[dev].Name, "Mic|Mik", RegexOptions.IgnoreCase)) { //Check if there are inputs. if (devices[dev].Inputs.Count >= 1) @@ -698,7 +698,7 @@ namespace Vocaluxe.Base /// Parameters public static void LoadCommandLineParams(string[] args) { - Regex spliterParam = new Regex(@"ReplacedStr:::0:::", RegexOptions.IgnoreCase); + Regex spliterParam = new Regex(@"-{1,2}|\/", RegexOptions.IgnoreCase); //Complete argument string string arguments = args.Aggregate(string.Empty, (current, arg) => current + (arg + " ")); @@ -707,7 +707,7 @@ namespace Vocaluxe.Base foreach (string text in args) { - Regex spliterVal = new Regex(@"ReplacedStr:::2:::", RegexOptions.IgnoreCase); + Regex spliterVal = new Regex(@"\s", RegexOptions.IgnoreCase); //split arg with Spilter-Regex and save in parts string[] parts = spliterVal.Split(text, 2); @@ -716,7 +716,7 @@ namespace Vocaluxe.Base { //Only found a parameter case 1: - if (!Regex.IsMatch(parts[0], @"ReplacedStr:::3:::") && parts[0] != "") + if (parts[0] != "") { //Add parameter _Params.Add(parts[0]); @@ -729,7 +729,7 @@ namespace Vocaluxe.Base //Found parameter and value case 2: - if (!Regex.IsMatch(parts[0], @"ReplacedStr:::5:::") && parts[0] != "") + if (parts[0] != "") { //Add parameter _Params.Add(parts[0]); diff --git a/Vocaluxe/Lib/Sound/Decoder/CAudioDecoderFFmpeg.cs b/Vocaluxe/Lib/Sound/Decoder/CAudioDecoderFFmpeg.cs index bfe4fedf..22787416 100644 --- a/Vocaluxe/Lib/Sound/Decoder/CAudioDecoderFFmpeg.cs +++ b/Vocaluxe/Lib/Sound/Decoder/CAudioDecoderFFmpeg.cs @@ -177,7 +177,7 @@ namespace Vocaluxe.Lib.Sound.Decoder timeStamp = (float)decoder.Timecode; _CurrentTime = timeStamp; - //Console.WriteLine(_CurrentTime.ToString("ReplacedStr:::0:::") + "ReplacedStr:::1:::" + Decoder.buffer_size.ToString()); + //Console.WriteLine(_CurrentTime.ToString("#0.000") + " Buffer size: " + Decoder.buffer_size.ToString()); buffer = new byte[decoder.BufferSize]; if (decoder.BufferSize > 0) diff --git a/Vocaluxe/Screens/CScreenNames.cs b/Vocaluxe/Screens/CScreenNames.cs index c34fdae3..68e1b218 100644 --- a/Vocaluxe/Screens/CScreenNames.cs +++ b/Vocaluxe/Screens/CScreenNames.cs @@ -467,7 +467,7 @@ namespace Vocaluxe.Screens _OldMouseX = mouseEvent.X; _OldMouseY = mouseEvent.Y; } - // LeftButton isn't hold anymore, but Selec-Mode is still active -> "ReplacedStr:::0:::" of Avatar + // LeftButton isn't hold anymore, but Selec-Mode is still active -> "Drop" of Avatar else if (_SelectingMouseActive) { //Check if really a player was selected @@ -476,7 +476,7 @@ namespace Vocaluxe.Screens //Foreach Drop-Area for (int i = 0; i < _StaticPlayer.Length; i++) { - //Check first, if area is "ReplacedStr:::1:::" + //Check first, if area is "Active" if (_Statics[_StaticPlayer[i]].Visible) { //Check if Mouse is in area From bdca0554e4be408e7a49c3a290c79f473044653b Mon Sep 17 00:00:00 2001 From: Flamefire Date: Thu, 25 Apr 2013 18:27:59 +0200 Subject: [PATCH 22/27] Changed players->Profile handling (no redundant entries) --- .../PartyModeChallenge/CPartyModeChallenge.cs | 21 +-- .../CPartyModeChallengeMedley.cs | 19 +-- .../PartyModeTicTacToe/CPartyModeTicTacToe.cs | 10 +- Vocaluxe/Base/CConfig.cs | 6 +- Vocaluxe/Base/CDataBase.cs | 56 +++----- Vocaluxe/Base/CGame.cs | 98 ++++++------- Vocaluxe/Base/CMain.cs | 14 +- Vocaluxe/Base/CProfiles.cs | 129 +++++++++--------- Vocaluxe/Program.cs | 2 +- Vocaluxe/Screens/CScreenNames.cs | 92 +++++-------- Vocaluxe/Screens/CScreenParty.cs | 8 +- Vocaluxe/Screens/CScreenScore.cs | 26 ++-- Vocaluxe/Screens/CScreenSing.cs | 38 +++--- VocaluxeLib/Menu/CNameSelection.cs | 13 +- VocaluxeLib/Menu/CPoints.cs | 4 - VocaluxeLib/Menu/IMenu.cs | 4 +- VocaluxeLib/Menu/SingNotes/CSingNotes.cs | 13 +- VocaluxeLib/Menu/Structs.cs | 2 - 18 files changed, 232 insertions(+), 323 deletions(-) diff --git a/PartyModes/PartyModeChallenge/CPartyModeChallenge.cs b/PartyModes/PartyModeChallenge/CPartyModeChallenge.cs index e1e74466..5782df18 100644 --- a/PartyModes/PartyModeChallenge/CPartyModeChallenge.cs +++ b/PartyModes/PartyModeChallenge/CPartyModeChallenge.cs @@ -459,33 +459,22 @@ namespace VocaluxeLib.PartyModes.Challenge CBase.Game.AddSong(songID, gm); CBase.Game.SetNumPlayer(_GameData.NumPlayerAtOnce); - SPlayer[] player = CBase.Game.GetPlayer(); + SPlayer[] player = CBase.Game.GetPlayers(); if (player == null) return; if (player.Length < _GameData.NumPlayerAtOnce) return; - SProfile[] profiles = CBase.Profiles.GetProfiles(); CCombination c = _GameData.Rounds.GetRound(_GameData.CurrentRoundNr - 1); for (int i = 0; i < _GameData.NumPlayerAtOnce; i++) { - //default values - player[i].Name = "foobar"; - player[i].Difficulty = EGameDifficulty.TR_CONFIG_EASY; - player[i].ProfileID = -1; - //try to fill with the right data if (c != null) - { - if (_GameData.ProfileIDs[c.Player[i]] < profiles.Length) - { - player[i].Name = profiles[_GameData.ProfileIDs[c.Player[i]]].PlayerName; - player[i].Difficulty = profiles[_GameData.ProfileIDs[c.Player[i]]].Difficulty; - player[i].ProfileID = _GameData.ProfileIDs[c.Player[i]]; - } - } + player[i].ProfileID = _GameData.ProfileIDs[c.Player[i]]; + else + player[i].ProfileID = -1; } CBase.Songs.AddPartySongSung(songID); @@ -593,7 +582,7 @@ namespace VocaluxeLib.PartyModes.Challenge } else { - SPlayer[] results = CBase.Game.GetPlayer(); + SPlayer[] results = CBase.Game.GetPlayers(); if (results == null) return; diff --git a/PartyModes/PartyModeChallengeMedley/CPartyModeChallengeMedley.cs b/PartyModes/PartyModeChallengeMedley/CPartyModeChallengeMedley.cs index 409ee742..e733ddb3 100644 --- a/PartyModes/PartyModeChallengeMedley/CPartyModeChallengeMedley.cs +++ b/PartyModes/PartyModeChallengeMedley/CPartyModeChallengeMedley.cs @@ -482,33 +482,22 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley #region PlayerNames CBase.Game.SetNumPlayer(_GameData.NumPlayerAtOnce); - SPlayer[] player = CBase.Game.GetPlayer(); + SPlayer[] player = CBase.Game.GetPlayers(); if (player == null) return false; if (player.Length < _GameData.NumPlayerAtOnce) return false; - SProfile[] profiles = CBase.Profiles.GetProfiles(); CCombination c = _GameData.Rounds.GetRound(_GameData.CurrentRoundNr - 1); for (int i = 0; i < _GameData.NumPlayerAtOnce; i++) { - //default values - player[i].Name = "foobar"; - player[i].Difficulty = EGameDifficulty.TR_CONFIG_EASY; - player[i].ProfileID = -1; - //try to fill with the right data if (c != null) - { - if (_GameData.ProfileIDs[c.Player[i]] < profiles.Length) - { - player[i].Name = profiles[_GameData.ProfileIDs[c.Player[i]]].PlayerName; - player[i].Difficulty = profiles[_GameData.ProfileIDs[c.Player[i]]].Difficulty; - player[i].ProfileID = _GameData.ProfileIDs[c.Player[i]]; - } - } + player[i].ProfileID = _GameData.ProfileIDs[c.Player[i]]; + else + player[i].ProfileID = -1; } #endregion PlayerNames diff --git a/PartyModes/PartyModeTicTacToe/CPartyModeTicTacToe.cs b/PartyModes/PartyModeTicTacToe/CPartyModeTicTacToe.cs index d403d7cb..4dc7e99f 100644 --- a/PartyModes/PartyModeTicTacToe/CPartyModeTicTacToe.cs +++ b/PartyModes/PartyModeTicTacToe/CPartyModeTicTacToe.cs @@ -718,7 +718,7 @@ namespace VocaluxeLib.PartyModes.TicTacToe CBase.Game.SetNumPlayer(2); - SPlayer[] player = CBase.Game.GetPlayer(); + SPlayer[] player = CBase.Game.GetPlayers(); if (player == null) return; @@ -732,8 +732,6 @@ namespace VocaluxeLib.PartyModes.TicTacToe for (int i = 0; i < 2; i++) { //default values - player[i].Name = "foobar"; - player[i].Difficulty = EGameDifficulty.TR_CONFIG_EASY; player[i].ProfileID = -1; } @@ -742,16 +740,12 @@ namespace VocaluxeLib.PartyModes.TicTacToe { if (_GameData.ProfileIDsTeam1[r.SingerTeam1] < profiles.Length) { - player[0].Name = profiles[_GameData.ProfileIDsTeam1[r.SingerTeam1]].PlayerName; - player[0].Difficulty = profiles[_GameData.ProfileIDsTeam1[r.SingerTeam1]].Difficulty; player[0].ProfileID = _GameData.ProfileIDsTeam1[r.SingerTeam1]; if (isDuet) player[0].LineNr = 0; } if (_GameData.ProfileIDsTeam2[r.SingerTeam2] < profiles.Length) { - player[1].Name = profiles[_GameData.ProfileIDsTeam2[r.SingerTeam2]].PlayerName; - player[1].Difficulty = profiles[_GameData.ProfileIDsTeam2[r.SingerTeam2]].Difficulty; player[1].ProfileID = _GameData.ProfileIDsTeam2[r.SingerTeam2]; if (isDuet) player[1].LineNr = 1; @@ -792,7 +786,7 @@ namespace VocaluxeLib.PartyModes.TicTacToe if (!_GameData.Rounds[_GameData.SingRoundNr].Finished) _GameData.CurrentRoundNr++; - SPlayer[] results = CBase.Game.GetPlayer(); + SPlayer[] results = CBase.Game.GetPlayers(); if (results == null) return; diff --git a/Vocaluxe/Base/CConfig.cs b/Vocaluxe/Base/CConfig.cs index 6e8484f4..5e72062f 100644 --- a/Vocaluxe/Base/CConfig.cs +++ b/Vocaluxe/Base/CConfig.cs @@ -842,13 +842,11 @@ namespace Vocaluxe.Base if (Path.GetFileName(CProfiles.Profiles[i].ProfileFile) == Players[j] && CProfiles.Profiles[i].Active == EOffOn.TR_CONFIG_ON) { //Update Game-infos with player - CGame.Player[j].Name = CProfiles.Profiles[i].PlayerName; - CGame.Player[j].Difficulty = CProfiles.Profiles[i].Difficulty; - CGame.Player[j].ProfileID = i; + CGame.Players[j].ProfileID = i; } } else - CGame.Player[j].ProfileID = -1; + CGame.Players[j].ProfileID = -1; } } } diff --git a/Vocaluxe/Base/CDataBase.cs b/Vocaluxe/Base/CDataBase.cs index a06ea759..3cd2d400 100644 --- a/Vocaluxe/Base/CDataBase.cs +++ b/Vocaluxe/Base/CDataBase.cs @@ -70,21 +70,9 @@ namespace Vocaluxe.Base } #region Highscores - public static int AddScore(string playerName, int score, int lineNr, long date, int medley, int duet, int shortSong, int diff, + public static int AddScore(string playerName, int score, int lineNr, long date, int medley, int duet, int shortSong, int difficulty, string artist, string title, int numPlayed, string filePath) { - SPlayer player = new SPlayer - { - Name = playerName, - Points = score, - LineNr = lineNr, - DateTicks = date, - Medley = medley == 1, - Duet = duet == 1, - ShortSong = shortSong == 1, - Difficulty = (EGameDifficulty)diff - }; - using (SQLiteConnection connection = new SQLiteConnection()) { connection.ConnectionString = "Data Source=" + filePath; @@ -101,7 +89,7 @@ namespace Vocaluxe.Base using (SQLiteCommand command = new SQLiteCommand(connection)) { int dataBaseSongID = _GetDataBaseSongID(artist, title, numPlayed, command); - int result = _AddScore(player, command, dataBaseSongID); + int result = _AddScore(playerName, score, lineNr, date, medley, duet, shortSong, difficulty, dataBaseSongID, command); return result; } } @@ -125,42 +113,30 @@ namespace Vocaluxe.Base using (SQLiteCommand command = new SQLiteCommand(connection)) { int dataBaseSongID = _GetDataBaseSongID(player, command); - int result = _AddScore(player, command, dataBaseSongID); - - return result; + return _AddScore(CProfiles.GetPlayerName(player.ProfileID), (int)Math.Round(player.Points), player.LineNr, player.DateTicks, player.Medley ? 1 : 0, + player.Duet ? 1 : 0, player.ShortSong ? 1 : 0, (int)CProfiles.GetDifficulty(player.ProfileID), dataBaseSongID, command); } } } - private static int _AddScore(SPlayer player, SQLiteCommand command, int dataBaseSongID) + private static int _AddScore(string playerName, int score, int lineNr, long date, int medley, int duet, int shortSong, int difficulty, + int dataBaseSongID, SQLiteCommand command) { int lastInsertID = -1; if (dataBaseSongID >= 0) { - int medley = 0; - if (player.Medley) - medley = 1; - - int duet = 0; - if (player.Duet) - duet = 1; - - int shortSong = 0; - if (player.ShortSong) - shortSong = 1; - command.CommandText = "SELECT id FROM Scores WHERE SongID = @SongID AND PlayerName = @PlayerName AND Score = @Score AND " + "LineNr = @LineNr AND Date = @Date AND Medley = @Medley AND Duet = @Duet AND ShortSong = @ShortSong AND Difficulty = @Difficulty"; command.Parameters.Add("@SongID", DbType.Int32, 0).Value = dataBaseSongID; - command.Parameters.Add("@PlayerName", DbType.String, 0).Value = player.Name; - command.Parameters.Add("@Score", DbType.Int32, 0).Value = (int)Math.Round(player.Points); - command.Parameters.Add("@LineNr", DbType.Int32, 0).Value = player.LineNr; - command.Parameters.Add("@Date", DbType.Int64, 0).Value = player.DateTicks; + command.Parameters.Add("@PlayerName", DbType.String, 0).Value = playerName; + command.Parameters.Add("@Score", DbType.Int32, 0).Value = score; + command.Parameters.Add("@LineNr", DbType.Int32, 0).Value = lineNr; + command.Parameters.Add("@Date", DbType.Int64, 0).Value = date; command.Parameters.Add("@Medley", DbType.Int32, 0).Value = medley; command.Parameters.Add("@Duet", DbType.Int32, 0).Value = duet; command.Parameters.Add("@ShortSong", DbType.Int32, 0).Value = shortSong; - command.Parameters.Add("@Difficulty", DbType.Int32, 0).Value = (int)player.Difficulty; + command.Parameters.Add("@Difficulty", DbType.Int32, 0).Value = difficulty; SQLiteDataReader reader = null; try @@ -181,14 +157,14 @@ namespace Vocaluxe.Base command.CommandText = "INSERT INTO Scores (SongID, PlayerName, Score, LineNr, Date, Medley, Duet, ShortSong, Difficulty) " + "VALUES (@SongID, @PlayerName, @Score, @LineNr, @Date, @Medley, @Duet, @ShortSong, @Difficulty)"; command.Parameters.Add("@SongID", DbType.Int32, 0).Value = dataBaseSongID; - command.Parameters.Add("@PlayerName", DbType.String, 0).Value = player.Name; - command.Parameters.Add("@Score", DbType.Int32, 0).Value = (int)Math.Round(player.Points); - command.Parameters.Add("@LineNr", DbType.Int32, 0).Value = player.LineNr; - command.Parameters.Add("@Date", DbType.Int64, 0).Value = player.DateTicks; + command.Parameters.Add("@PlayerName", DbType.String, 0).Value = playerName; + command.Parameters.Add("@Score", DbType.Int32, 0).Value = score; + command.Parameters.Add("@LineNr", DbType.Int32, 0).Value = lineNr; + command.Parameters.Add("@Date", DbType.Int64, 0).Value = date; command.Parameters.Add("@Medley", DbType.Int32, 0).Value = medley; command.Parameters.Add("@Duet", DbType.Int32, 0).Value = duet; command.Parameters.Add("@ShortSong", DbType.Int32, 0).Value = shortSong; - command.Parameters.Add("@Difficulty", DbType.Int32, 0).Value = (int)player.Difficulty; + command.Parameters.Add("@Difficulty", DbType.Int32, 0).Value = difficulty; command.ExecuteNonQuery(); //Read last insert line diff --git a/Vocaluxe/Base/CGame.cs b/Vocaluxe/Base/CGame.cs index 6e83dbed..5c9fb87a 100644 --- a/Vocaluxe/Base/CGame.cs +++ b/Vocaluxe/Base/CGame.cs @@ -60,13 +60,13 @@ namespace Vocaluxe.Base public static int ActBeatD { get; private set; } - public static SPlayer[] Player { get; private set; } + public static SPlayer[] Players { get; private set; } public static void Init() { _GameMode = new CGameModeNormal(); _GameMode.Init(); - Player = new SPlayer[CSettings.MaxNumPlayer]; + Players = new SPlayer[CSettings.MaxNumPlayer]; ResetPlayer(); CConfig.UsePlayers(); @@ -115,12 +115,12 @@ namespace Vocaluxe.Base public static void Start() { - _GameMode.Start(Player); + _GameMode.Start(Players); } public static void NextRound() { - _GameMode.NextRound(Player); + _GameMode.NextRound(Players); } public static bool IsFinished() @@ -175,22 +175,22 @@ namespace Vocaluxe.Base public static void ResetPlayer() { - for (int i = 0; i < Player.Length; i++) + for (int i = 0; i < Players.Length; i++) { - Player[i].Points = 0f; - Player[i].PointsLineBonus = 0f; - Player[i].PointsGoldenNotes = 0f; - Player[i].LineNr = 0; - Player[i].NoteDiff = 0; - Player[i].SingLine = new List(); - Player[i].CurrentLine = -1; - Player[i].CurrentNote = -1; - Player[i].SongID = -1; - Player[i].Medley = false; - Player[i].Duet = false; - Player[i].ShortSong = false; - Player[i].DateTicks = DateTime.Now.Ticks; - Player[i].SongFinished = false; + Players[i].Points = 0f; + Players[i].PointsLineBonus = 0f; + Players[i].PointsGoldenNotes = 0f; + Players[i].LineNr = 0; + Players[i].NoteDiff = 0; + Players[i].SingLine = new List(); + Players[i].CurrentLine = -1; + Players[i].CurrentNote = -1; + Players[i].SongID = -1; + Players[i].Medley = false; + Players[i].Duet = false; + Players[i].ShortSong = false; + Players[i].DateTicks = DateTime.Now.Ticks; + Players[i].SongFinished = false; } _OldBeatD = -100; Beat = -100; @@ -227,9 +227,9 @@ namespace Vocaluxe.Base { if ((_GameMode.GetCurrentGameMode() == EGameMode.TR_GAMEMODE_MEDLEY && song.Medley.EndBeat == beat) || (_GameMode.GetCurrentGameMode() == EGameMode.TR_GAMEMODE_SHORTSONG && song.ShortEnd == beat)) - Player[p].SongFinished = true; + Players[p].SongFinished = true; - CLine[] lines = song.Notes.GetLines(Player[p].LineNr).Line; + CLine[] lines = song.Notes.GetLines(Players[p].LineNr).Line; int line = -1; for (int j = 0; j < lines.Length; j++) @@ -243,13 +243,13 @@ namespace Vocaluxe.Base if (line < 0) continue; - if (line != Player[p].CurrentLine) - Player[p].CurrentNote = -1; + if (line != Players[p].CurrentLine) + Players[p].CurrentNote = -1; - Player[p].CurrentLine = line; + Players[p].CurrentLine = line; - while (Player[p].SingLine.Count <= line) - Player[p].SingLine.Add(new CLine()); + while (Players[p].SingLine.Count <= line) + Players[p].SingLine.Add(new CLine()); CNote[] notes = lines[line].Notes; int note = -1; @@ -264,14 +264,14 @@ namespace Vocaluxe.Base if (note >= 0) { - Player[p].CurrentNote = note; + Players[p].CurrentNote = note; if (line == lines.Length - 1) { if (note == lines[line].NoteCount - 1) { if (notes[note].EndBeat == beat) - Player[p].SongFinished = true; + Players[p].SongFinished = true; } } @@ -286,56 +286,56 @@ namespace Vocaluxe.Base while (tonePlayer - tone < -6) tonePlayer += 12; - Player[p].NoteDiff = Math.Abs(tone - tonePlayer); - bool hit = Player[p].NoteDiff <= (2 - (int)Player[p].Difficulty); + Players[p].NoteDiff = Math.Abs(tone - tonePlayer); + bool hit = Players[p].NoteDiff <= (2 - (int)CProfiles.GetDifficulty(Players[p].ProfileID)); if (hit) { // valid //CSound.RecordSetTone(p, Tone); double points = (CSettings.MaxScore - CSettings.LinebonusScore) * (double)notes[note].PointsForBeat / - song.Notes.GetLines(Player[p].LineNr).Points; + song.Notes.GetLines(Players[p].LineNr).Points; if (notes[note].NoteType == ENoteType.Golden) - Player[p].PointsGoldenNotes += points; + Players[p].PointsGoldenNotes += points; - Player[p].Points += points; + Players[p].Points += points; // update player notes (sung notes) - if (Player[p].SingLine[line].NoteCount > 0) + if (Players[p].SingLine[line].NoteCount > 0) { - CNote nt = Player[p].SingLine[line].LastNote; + CNote nt = Players[p].SingLine[line].LastNote; if (notes[note].StartBeat == beat || nt.EndBeat + 1 != beat || nt.Tone != tone || !nt.Hit) - Player[p].SingLine[line].AddNote(new CNote(beat, 1, tone, String.Empty, true, notes[note].NoteType)); + Players[p].SingLine[line].AddNote(new CNote(beat, 1, tone, String.Empty, true, notes[note].NoteType)); else - Player[p].SingLine[line].IncLastNoteLength(); + Players[p].SingLine[line].IncLastNoteLength(); } else - Player[p].SingLine[line].AddNote(new CNote(beat, 1, tone, String.Empty, true, notes[note].NoteType)); + Players[p].SingLine[line].AddNote(new CNote(beat, 1, tone, String.Empty, true, notes[note].NoteType)); - Player[p].SingLine[line].LastNote.IsPerfect(notes[note]); - Player[p].SingLine[line].IsPerfect(lines[line]); + Players[p].SingLine[line].LastNote.IsPerfect(notes[note]); + Players[p].SingLine[line].IsPerfect(lines[line]); } else { - if (Player[p].SingLine[line].NoteCount > 0) + if (Players[p].SingLine[line].NoteCount > 0) { - CNote nt = Player[p].SingLine[line].LastNote; + CNote nt = Players[p].SingLine[line].LastNote; if (nt.Tone == tonePlayer && nt.EndBeat + 1 == beat && !nt.Hit) - Player[p].SingLine[line].IncLastNoteLength(); + Players[p].SingLine[line].IncLastNoteLength(); else - Player[p].SingLine[line].AddNote(new CNote(beat, 1, tonePlayer, String.Empty, false, ENoteType.Freestyle)); + Players[p].SingLine[line].AddNote(new CNote(beat, 1, tonePlayer, String.Empty, false, ENoteType.Freestyle)); } else - Player[p].SingLine[line].AddNote(new CNote(beat, 1, tonePlayer, String.Empty, false, ENoteType.Freestyle)); + Players[p].SingLine[line].AddNote(new CNote(beat, 1, tonePlayer, String.Empty, false, ENoteType.Freestyle)); } } // Line Bonus - int numLinesWithPoints = song.Notes.GetNumLinesWithPoints(Player[p].LineNr); + int numLinesWithPoints = song.Notes.GetNumLinesWithPoints(Players[p].LineNr); if (note == lines[line].NoteCount - 1 && numLinesWithPoints > 0) { if (notes[note].EndBeat == beat && lines[line].Points > 0f) { - double factor = Player[p].SingLine[line].Points / (double)lines[line].Points; + double factor = Players[p].SingLine[line].Points / (double)lines[line].Points; if (factor < 0.4) factor = 0.0; else if (factor > 0.9) @@ -348,8 +348,8 @@ namespace Vocaluxe.Base } double points = CSettings.LinebonusScore * factor * 1f / numLinesWithPoints; - Player[p].Points += points; - Player[p].PointsLineBonus += points; + Players[p].Points += points; + Players[p].PointsLineBonus += points; } } } diff --git a/Vocaluxe/Base/CMain.cs b/Vocaluxe/Base/CMain.cs index 47d6c0f3..014d439c 100644 --- a/Vocaluxe/Base/CMain.cs +++ b/Vocaluxe/Base/CMain.cs @@ -478,9 +478,9 @@ namespace Vocaluxe.Base CGame.NumPlayer = numPlayer; } - public SPlayer[] GetPlayer() + public SPlayer[] GetPlayers() { - return CGame.Player; + return CGame.Players; } public CPoints GetPoints() @@ -540,6 +540,16 @@ namespace Vocaluxe.Base { return CProfiles.Profiles; } + + public EGameDifficulty GetDifficulty(int profileID) + { + return CProfiles.GetDifficulty(profileID); + } + + public string GetPlayerName(int profileID, int playerNum = 0) + { + return CProfiles.GetPlayerName(profileID, playerNum); + } } class CBrecord : IRecording diff --git a/Vocaluxe/Base/CProfiles.cs b/Vocaluxe/Base/CProfiles.cs index 655cf08c..71bcedd9 100644 --- a/Vocaluxe/Base/CProfiles.cs +++ b/Vocaluxe/Base/CProfiles.cs @@ -62,12 +62,14 @@ namespace Vocaluxe.Base LoadProfiles(); } - public static int NewProfile() + public static string GetPlayerName(int profileID, int playerNum = 0) { - return NewProfile(String.Empty); + if (IsProfileIDValid(profileID)) + return _Profiles[profileID].PlayerName; + return (playerNum > 0) ? "Player " + playerNum : "Player"; } - public static int NewProfile(string fileName) + public static int NewProfile(string fileName = "") { SProfile profile = new SProfile { @@ -132,125 +134,119 @@ namespace Vocaluxe.Base } } - public static string AddGetPlayerName(int profileNr, char chr) + public static string AddGetPlayerName(int profileID, char chr) { - if (profileNr < 0 || profileNr >= _Profiles.Count) + if (IsProfileIDValid(profileID)) return String.Empty; - SProfile profile = _Profiles[profileNr]; + SProfile profile = _Profiles[profileID]; profile.PlayerName += chr; - _Profiles[profileNr] = profile; + _Profiles[profileID] = profile; return profile.PlayerName; } - public static string GetPlayerName(int profileNr) + public static string GetDeleteCharInPlayerName(int profileID) { - if (profileNr < 0 || profileNr >= _Profiles.Count) + if (IsProfileIDValid(profileID)) return String.Empty; - return _Profiles[profileNr].PlayerName; - } - - public static string GetDeleteCharInPlayerName(int profileNr) - { - if (profileNr < 0 || profileNr >= _Profiles.Count) - return String.Empty; - - SProfile profile = _Profiles[profileNr]; + SProfile profile = _Profiles[profileID]; if (profile.PlayerName != "") profile.PlayerName = profile.PlayerName.Remove(profile.PlayerName.Length - 1); - _Profiles[profileNr] = profile; + _Profiles[profileID] = profile; return profile.PlayerName; } - public static EGameDifficulty GetDifficulty(int profileNr) + public static bool IsProfileIDValid(int profileID) { - if (profileNr < 0 || profileNr >= _Profiles.Count) - return EGameDifficulty.TR_CONFIG_NORMAL; - - return _Profiles[profileNr].Difficulty; + return profileID < 0 || profileID >= _Profiles.Count; } - public static void SetDifficulty(int profileNr, EGameDifficulty difficulty) + public static EGameDifficulty GetDifficulty(int profileID) { - if (profileNr < 0 || profileNr >= _Profiles.Count) + return IsProfileIDValid(profileID) ? EGameDifficulty.TR_CONFIG_NORMAL : _Profiles[profileID].Difficulty; + } + + public static void SetDifficulty(int profileID, EGameDifficulty difficulty) + { + if (IsProfileIDValid(profileID)) return; - SProfile profile = _Profiles[profileNr]; + SProfile profile = _Profiles[profileID]; profile.Difficulty = difficulty; - _Profiles[profileNr] = profile; + _Profiles[profileID] = profile; } - public static EOffOn GetGuestProfile(int profileNr) + public static EOffOn GetGuestProfile(int profileID) { - if (profileNr < 0 || profileNr >= _Profiles.Count) + if (IsProfileIDValid(profileID)) return EOffOn.TR_CONFIG_OFF; - return _Profiles[profileNr].GuestProfile; + return _Profiles[profileID].GuestProfile; } - public static EOffOn GetActive(int profileNr) + public static EOffOn GetActive(int profileID) { - if (profileNr < 0 || profileNr >= _Profiles.Count) + if (IsProfileIDValid(profileID)) return EOffOn.TR_CONFIG_OFF; - return _Profiles[profileNr].Active; + return _Profiles[profileID].Active; } - public static void SetGuestProfile(int profileNr, EOffOn option) + public static void SetGuestProfile(int profileID, EOffOn option) { - if (profileNr < 0 || profileNr >= _Profiles.Count) + if (IsProfileIDValid(profileID)) return; - SProfile profile = _Profiles[profileNr]; + SProfile profile = _Profiles[profileID]; profile.GuestProfile = option; - _Profiles[profileNr] = profile; + _Profiles[profileID] = profile; } - public static void SetActive(int profileNr, EOffOn option) + public static void SetActive(int profileID, EOffOn option) { - if (profileNr < 0 || profileNr >= _Profiles.Count) + if (IsProfileIDValid(profileID)) return; - SProfile profile = _Profiles[profileNr]; + SProfile profile = _Profiles[profileID]; profile.Active = option; - _Profiles[profileNr] = profile; + _Profiles[profileID] = profile; } - public static bool IsGuestProfile(int profileNr) + public static bool IsGuestProfile(int profileID) { - if (profileNr < 0 || profileNr >= _Profiles.Count) + if (IsProfileIDValid(profileID)) return true; // this will prevent from saving dummy profiles to highscore db - return _Profiles[profileNr].GuestProfile == EOffOn.TR_CONFIG_ON; + return _Profiles[profileID].GuestProfile == EOffOn.TR_CONFIG_ON; } - public static bool IsActive(int profileNr) + public static bool IsActive(int profileID) { - if (profileNr < 0 || profileNr >= _Profiles.Count) + if (IsProfileIDValid(profileID)) return false; - return _Profiles[profileNr].Active == EOffOn.TR_CONFIG_ON; + return _Profiles[profileID].Active == EOffOn.TR_CONFIG_ON; } - public static void SetAvatar(int profileNr, int avatarNr) + public static void SetAvatar(int profileID, int avatarNr) { - if (profileNr < 0 || profileNr >= _Profiles.Count || avatarNr < 0 || avatarNr >= _Avatars.Count) + if (IsProfileIDValid(profileID) || avatarNr < 0 || avatarNr >= _Avatars.Count) return; - SProfile profile = _Profiles[profileNr]; + SProfile profile = _Profiles[profileID]; profile.Avatar = _Avatars[avatarNr]; - _Profiles[profileNr] = profile; + _Profiles[profileID] = profile; } - public static int GetAvatarNr(int profileNr) + public static int GetAvatarNr(int profileID) { - if (profileNr < 0 || profileNr >= _Profiles.Count) + if (IsProfileIDValid(profileID)) return 0; for (int i = 0; i < _Avatars.Count; i++) { - if (_Profiles[profileNr].Avatar.FileName == _Avatars[i].FileName) + if (_Profiles[profileID].Avatar.FileName == _Avatars[i].FileName) return i; } @@ -259,19 +255,18 @@ namespace Vocaluxe.Base public static void DeleteProfile(int profileID) { - if (profileID < 0 || profileID >= _Profiles.Count) + if (IsProfileIDValid(profileID)) return; - if (_Profiles[profileID].ProfileFile != "") + if (_Profiles[profileID].ProfileFile == "") + return; + try { - try - { - File.Delete(_Profiles[profileID].ProfileFile); - _Profiles.RemoveAt(profileID); - } - catch (Exception) - { - CLog.LogError("Can't delete Profile File " + _Profiles[profileID].ProfileFile + ".xml"); - } + File.Delete(_Profiles[profileID].ProfileFile); + _Profiles.RemoveAt(profileID); + } + catch (Exception) + { + CLog.LogError("Can't delete Profile File " + _Profiles[profileID].ProfileFile + ".xml"); } } @@ -298,7 +293,7 @@ namespace Vocaluxe.Base private static void _SaveProfile(int profileID) { - if (profileID < 0 || profileID >= _Profiles.Count) + if (IsProfileIDValid(profileID)) return; if (_Profiles[profileID].ProfileFile == "") diff --git a/Vocaluxe/Program.cs b/Vocaluxe/Program.cs index 539c2b3d..34c5f627 100644 --- a/Vocaluxe/Program.cs +++ b/Vocaluxe/Program.cs @@ -258,7 +258,7 @@ namespace Vocaluxe #endif #if ARCH_X64 - string path="x64"; + string path = "x64"; #endif path = Path.Combine(path, arr[0] + ".dll"); try diff --git a/Vocaluxe/Screens/CScreenNames.cs b/Vocaluxe/Screens/CScreenNames.cs index 68e1b218..22e54dca 100644 --- a/Vocaluxe/Screens/CScreenNames.cs +++ b/Vocaluxe/Screens/CScreenNames.cs @@ -55,7 +55,6 @@ namespace Vocaluxe.Screens {"SelectSlideDuetPlayer1", "SelectSlideDuetPlayer2", "SelectSlideDuetPlayer3", "SelectSlideDuetPlayer4", "SelectSlideDuetPlayer5", "SelectSlideDuetPlayer6"}; private readonly STexture[] _OriginalPlayerAvatarTextures = new STexture[CSettings.MaxNumPlayer]; - private bool _SelectingMouseActive; private bool _SelectingKeyboardActive; private bool _SelectingKeyboardUnendless; private int _SelectingKeyboardPlayerNr; @@ -173,9 +172,7 @@ namespace Vocaluxe.Screens { _SelectedPlayerNr = _NameSelections[_NameSelection].Selection; //Update Game-infos with new player - CGame.Player[_SelectingKeyboardPlayerNr - 1].Name = CProfiles.Profiles[_SelectedPlayerNr].PlayerName; - CGame.Player[_SelectingKeyboardPlayerNr - 1].Difficulty = CProfiles.Profiles[_SelectedPlayerNr].Difficulty; - CGame.Player[_SelectingKeyboardPlayerNr - 1].ProfileID = _SelectedPlayerNr; + CGame.Players[_SelectingKeyboardPlayerNr - 1].ProfileID = _SelectedPlayerNr; //Update config for default players. CConfig.Players[_SelectingKeyboardPlayerNr - 1] = CProfiles.Profiles[_SelectedPlayerNr].ProfileFile; CConfig.SaveConfig(); @@ -320,9 +317,7 @@ namespace Vocaluxe.Screens case Keys.Delete: //Delete profile-selection - CGame.Player[_SelectingKeyboardPlayerNr - 1].ProfileID = -1; - CGame.Player[_SelectingKeyboardPlayerNr - 1].Name = String.Empty; - CGame.Player[_SelectingKeyboardPlayerNr - 1].Difficulty = EGameDifficulty.TR_CONFIG_EASY; + CGame.Players[_SelectingKeyboardPlayerNr - 1].ProfileID = -1; //Update config for default players. CConfig.Players[_SelectingKeyboardPlayerNr - 1] = String.Empty; CConfig.SaveConfig(); @@ -432,7 +427,7 @@ namespace Vocaluxe.Screens base.HandleMouse(mouseEvent); //Check if LeftButton is hold and Select-Mode inactive - if (mouseEvent.LBH && !_SelectingMouseActive) + if (mouseEvent.LBH && _SelectedPlayerNr < 0) { //Save mouse-coords _OldMouseX = mouseEvent.X; @@ -444,9 +439,6 @@ namespace Vocaluxe.Screens _SelectedPlayerNr = _NameSelections[_NameSelection].TilePlayerNr(mouseEvent); if (_SelectedPlayerNr != -1) { - //Activate mouse-selecting - _SelectingMouseActive = true; - //Update of Drag/Drop-Texture CStatic selectedPlayer = _NameSelections[_NameSelection].TilePlayerAvatar(mouseEvent); _ChooseAvatarStatic.Visible = true; @@ -459,7 +451,7 @@ namespace Vocaluxe.Screens } //Check if LeftButton is hold and Select-Mode active - if (mouseEvent.LBH && _SelectingMouseActive) + if (mouseEvent.LBH && _SelectedPlayerNr >= 0) { //Update coords for Drag/Drop-Texture _ChooseAvatarStatic.Rect.X += mouseEvent.X - _OldMouseX; @@ -468,41 +460,33 @@ namespace Vocaluxe.Screens _OldMouseY = mouseEvent.Y; } // LeftButton isn't hold anymore, but Selec-Mode is still active -> "Drop" of Avatar - else if (_SelectingMouseActive) + else if (_SelectedPlayerNr >= 0) { - //Check if really a player was selected - if (_SelectedPlayerNr != -1) + //Foreach Drop-Area + for (int i = 0; i < _StaticPlayer.Length; i++) { - //Foreach Drop-Area - for (int i = 0; i < _StaticPlayer.Length; i++) + //Check first, if area is "Active" + if (!_Statics[_StaticPlayer[i]].Visible) + continue; + //Check if Mouse is in area + if (CHelper.IsInBounds(_Statics[_StaticPlayer[i]].Rect, mouseEvent)) { - //Check first, if area is "Active" - if (_Statics[_StaticPlayer[i]].Visible) - { - //Check if Mouse is in area - if (CHelper.IsInBounds(_Statics[_StaticPlayer[i]].Rect, mouseEvent)) - { - //Update Game-infos with new player - CGame.Player[i].Name = CProfiles.Profiles[_SelectedPlayerNr].PlayerName; - CGame.Player[i].Difficulty = CProfiles.Profiles[_SelectedPlayerNr].Difficulty; - CGame.Player[i].ProfileID = _SelectedPlayerNr; - //Update config for default players. - CConfig.Players[i] = CProfiles.Profiles[_SelectedPlayerNr].ProfileFile; - CConfig.SaveConfig(); - //Update texture and name - _Statics[_StaticPlayerAvatar[i]].Texture = _ChooseAvatarStatic.Texture; - _Texts[_TextPlayer[i]].Text = CProfiles.Profiles[_SelectedPlayerNr].PlayerName; - //Update profile-warning - _CheckPlayers(); - //Update Tiles-List - _NameSelections[_NameSelection].UpdateList(); - } - } + //Update Game-infos with new player + CGame.Players[i].ProfileID = _SelectedPlayerNr; + //Update config for default players. + CConfig.Players[i] = CProfiles.Profiles[_SelectedPlayerNr].ProfileFile; + CConfig.SaveConfig(); + //Update texture and name + _Statics[_StaticPlayerAvatar[i]].Texture = _ChooseAvatarStatic.Texture; + _Texts[_TextPlayer[i]].Text = CProfiles.Profiles[_SelectedPlayerNr].PlayerName; + //Update profile-warning + _CheckPlayers(); + //Update Tiles-List + _NameSelections[_NameSelection].UpdateList(); } - _SelectedPlayerNr = -1; } + _SelectedPlayerNr = -1; //Reset variables - _SelectingMouseActive = false; _ChooseAvatarStatic.Visible = false; } @@ -528,9 +512,7 @@ namespace Vocaluxe.Screens { if (CHelper.IsInBounds(_Statics[_StaticPlayer[i]].Rect, mouseEvent)) { - CGame.Player[i].ProfileID = -1; - CGame.Player[i].Name = String.Empty; - CGame.Player[i].Difficulty = EGameDifficulty.TR_CONFIG_EASY; + CGame.Players[i].ProfileID = -1; //Update config for default players. CConfig.Players[i] = String.Empty; CConfig.SaveConfig(); @@ -587,10 +569,10 @@ namespace Vocaluxe.Screens //Update texture and name if (CConfig.Players[i] != "") { - if (CGame.Player[i].ProfileID > -1 && CProfiles.NumProfiles > CGame.Player[i].ProfileID) + if (CProfiles.IsProfileIDValid(CGame.Players[i].ProfileID)) { - _Statics[_StaticPlayerAvatar[i]].Texture = CProfiles.Profiles[CGame.Player[i].ProfileID].Avatar.Texture; - _Texts[_TextPlayer[i]].Text = CProfiles.Profiles[CGame.Player[i].ProfileID].PlayerName; + _Statics[_StaticPlayerAvatar[i]].Texture = CProfiles.Profiles[CGame.Players[i].ProfileID].Avatar.Texture; + _Texts[_TextPlayer[i]].Text = CProfiles.GetPlayerName(CGame.Players[i].ProfileID); } } if (CGame.GetNumSongs() == 1 && CGame.GetSong(1).IsDuet) @@ -629,20 +611,8 @@ namespace Vocaluxe.Screens { for (int i = 0; i < CGame.NumPlayer; i++) { - if (CGame.Player[i].ProfileID < 0) - { - CGame.Player[i].Name = "Player " + (i + 1); - 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[_SelectSlideDuetPlayer[i]].Selection; + CGame.Players[i].LineNr = _SelectSlides[_SelectSlideDuetPlayer[i]].Selection; } CGraphics.FadeTo(EScreens.ScreenSing); @@ -730,7 +700,7 @@ namespace Vocaluxe.Screens List playerWithoutProfile = new List(); for (int player = 0; player < CConfig.NumPlayer; player++) { - if (CGame.Player[player].ProfileID < 0) + if (CGame.Players[player].ProfileID < 0) playerWithoutProfile.Add(player + 1); } diff --git a/Vocaluxe/Screens/CScreenParty.cs b/Vocaluxe/Screens/CScreenParty.cs index 46df559b..f6e37116 100644 --- a/Vocaluxe/Screens/CScreenParty.cs +++ b/Vocaluxe/Screens/CScreenParty.cs @@ -198,12 +198,8 @@ namespace Vocaluxe.Screens if (CConfig.GetMaxNumMics() == 0) return; //TODO: Add message! - if (_PartyModeInfos[index].Playable) - { - CParty.SetPartyMode(_PartyModeInfos[index].PartyModeID); - CGraphics.FadeTo(EScreens.ScreenPartyDummy); - } - //TODO: else Message! + CParty.SetPartyMode(_PartyModeInfos[index].PartyModeID); + CGraphics.FadeTo(EScreens.ScreenPartyDummy); } } } \ No newline at end of file diff --git a/Vocaluxe/Screens/CScreenScore.cs b/Vocaluxe/Screens/CScreenScore.cs index b15df9b5..e02f912c 100644 --- a/Vocaluxe/Screens/CScreenScore.cs +++ b/Vocaluxe/Screens/CScreenScore.cs @@ -281,11 +281,7 @@ namespace Vocaluxe.Screens for (int p = 0; p < player.Length; p++) { if (i < 1) - { player[p].ProfileID = points[p].ProfileID; - player[p].Name = points[p].Name; - player[p].Difficulty = points[p].Difficulty; - } player[p].Points += points[p].Points; } } @@ -295,19 +291,15 @@ namespace Vocaluxe.Screens for (int p = 0; p < player.Length; p++) { - if (song != null) + string name = CProfiles.GetPlayerName(player[p].ProfileID, p); + if (song != null && song.IsDuet) { - if (!song.IsDuet) - _Texts[_TextNames[p, CGame.NumPlayer - 1]].Text = player[p].Name; - else if (player[p].LineNr == 0 && song.DuetPart1 != "Part 1") - _Texts[_TextNames[p, CGame.NumPlayer - 1]].Text = player[p].Name + " (" + song.DuetPart1 + ")"; + if (player[p].LineNr == 0 && song.DuetPart1 != "Part 1") + name += " (" + song.DuetPart1 + ")"; else if (player[p].LineNr == 1 && song.DuetPart2 != "Part 2") - _Texts[_TextNames[p, CGame.NumPlayer - 1]].Text = player[p].Name + " (" + song.DuetPart2 + ")"; - else - _Texts[_TextNames[p, CGame.NumPlayer - 1]].Text = player[p].Name; + name += " (" + song.DuetPart2 + ")"; } - else - _Texts[_TextNames[p, CGame.NumPlayer - 1]].Text = player[p].Name; + _Texts[_TextNames[p, CGame.NumPlayer - 1]].Text = name; if (CGame.NumPlayer < (int)_ScreenSettings[_ScreenSettingShortScore].GetValue()) _Texts[_TextScores[p, CGame.NumPlayer - 1]].Text = ((int)Math.Round(player[p].Points)).ToString("0000") + " " + CLanguage.Translate("TR_SCREENSCORE_POINTS"); @@ -316,10 +308,10 @@ namespace Vocaluxe.Screens if (CGame.NumPlayer < (int)_ScreenSettings[_ScreenSettingShortDifficulty].GetValue()) { _Texts[_TextDifficulty[p, CGame.NumPlayer - 1]].Text = CLanguage.Translate("TR_SCREENSCORE_GAMEDIFFICULTY") + ": " + - CLanguage.Translate(player[p].Difficulty.ToString()); + CLanguage.Translate(CProfiles.GetDifficulty(player[p].ProfileID).ToString()); } else - _Texts[_TextDifficulty[p, CGame.NumPlayer - 1]].Text = CLanguage.Translate(player[p].Difficulty.ToString()); + _Texts[_TextDifficulty[p, CGame.NumPlayer - 1]].Text = CLanguage.Translate(CProfiles.GetDifficulty(player[p].ProfileID).ToString()); if (CGame.NumPlayer < (int)_ScreenSettings[_ScreenSettingShortRating].GetValue()) { _Texts[_TextRatings[p, CGame.NumPlayer - 1]].Text = CLanguage.Translate("TR_SCREENSCORE_RATING") + ": " + @@ -339,7 +331,7 @@ namespace Vocaluxe.Screens _Statics[_StaticPointsBarBG[p, CGame.NumPlayer - 1]].Rect.Y - _Statics[_StaticPointsBar[p, CGame.NumPlayer - 1]].Rect.H; } - if (player[p].ProfileID >= 0 && player[p].ProfileID < CProfiles.NumProfiles) + if (CProfiles.IsProfileIDValid(player[p].ProfileID)) _Statics[_StaticAvatar[p, CGame.NumPlayer - 1]].Texture = CProfiles.Profiles[player[p].ProfileID].Avatar.Texture; } diff --git a/Vocaluxe/Screens/CScreenSing.cs b/Vocaluxe/Screens/CScreenSing.cs index d507ab2f..92a1665b 100644 --- a/Vocaluxe/Screens/CScreenSing.cs +++ b/Vocaluxe/Screens/CScreenSing.cs @@ -347,18 +347,18 @@ namespace Vocaluxe.Screens for (int p = 0; p < CGame.NumPlayer; p++) { - _SingNotes[_SingBars].SetAlpha(_NoteLines[p], alpha[CGame.Player[p].LineNr * 2]); + _SingNotes[_SingBars].SetAlpha(_NoteLines[p], alpha[CGame.Players[p].LineNr * 2]); if (CConfig.FadePlayerInfo == EFadePlayerInfo.TR_CONFIG_FADEPLAYERINFO_INFO || CConfig.FadePlayerInfo == EFadePlayerInfo.TR_CONFIG_FADEPLAYERINFO_ALL) { - _Statics[_StaticAvatars[p, CGame.NumPlayer - 1]].Alpha = alpha[CGame.Player[p].LineNr * 2]; - _Texts[_TextNames[p, CGame.NumPlayer - 1]].Alpha = alpha[CGame.Player[p].LineNr * 2]; + _Statics[_StaticAvatars[p, CGame.NumPlayer - 1]].Alpha = alpha[CGame.Players[p].LineNr * 2]; + _Texts[_TextNames[p, CGame.NumPlayer - 1]].Alpha = alpha[CGame.Players[p].LineNr * 2]; } if (CConfig.FadePlayerInfo == EFadePlayerInfo.TR_CONFIG_FADEPLAYERINFO_ALL) { - _Statics[_StaticScores[p, CGame.NumPlayer - 1]].Alpha = alpha[CGame.Player[p].LineNr * 2]; - _Statics[_StaticAvatars[p, CGame.NumPlayer - 1]].Alpha = alpha[CGame.Player[p].LineNr * 2]; - _Texts[_TextNames[p, CGame.NumPlayer - 1]].Alpha = alpha[CGame.Player[p].LineNr * 2]; - _Texts[_TextScores[p, CGame.NumPlayer - 1]].Alpha = alpha[CGame.Player[p].LineNr * 2]; + _Statics[_StaticScores[p, CGame.NumPlayer - 1]].Alpha = alpha[CGame.Players[p].LineNr * 2]; + _Statics[_StaticAvatars[p, CGame.NumPlayer - 1]].Alpha = alpha[CGame.Players[p].LineNr * 2]; + _Texts[_TextNames[p, CGame.NumPlayer - 1]].Alpha = alpha[CGame.Players[p].LineNr * 2]; + _Texts[_TextScores[p, CGame.NumPlayer - 1]].Alpha = alpha[CGame.Players[p].LineNr * 2]; } } @@ -381,10 +381,10 @@ namespace Vocaluxe.Screens for (int p = 0; p < CGame.NumPlayer; p++) { - if (CGame.Player[p].Points < 10000) - _Texts[_TextScores[p, CGame.NumPlayer - 1]].Text = CGame.Player[p].Points.ToString("0000"); + if (CGame.Players[p].Points < 10000) + _Texts[_TextScores[p, CGame.NumPlayer - 1]].Text = CGame.Players[p].Points.ToString("0000"); else - _Texts[_TextScores[p, CGame.NumPlayer - 1]].Text = CGame.Player[p].Points.ToString("00000"); + _Texts[_TextScores[p, CGame.NumPlayer - 1]].Text = CGame.Players[p].Points.ToString("00000"); } if (_CurrentVideo != -1 && !_FadeOut && CConfig.VideosInSongs == EOffOn.TR_CONFIG_ON) @@ -508,7 +508,7 @@ namespace Vocaluxe.Screens for (int i = 0; i < CGame.NumPlayer; i++) - _SingNotes[_SingBars].Draw(_NoteLines[i], CGame.Player[i].SingLine, i); + _SingNotes[_SingBars].Draw(_NoteLines[i], CGame.Players[i].SingLine, i); _DrawLyricHelper(); @@ -602,7 +602,7 @@ namespace Vocaluxe.Screens { //Save duet-assignment before resetting for (int i = 0; i < duetPlayer.Length; i++) - duetPlayer[i] = CGame.Player[i].LineNr; + duetPlayer[i] = CGame.Players[i].LineNr; } CGame.ResetPlayer(); @@ -631,12 +631,12 @@ namespace Vocaluxe.Screens if (CGame.GetNumSongs() > 1) { for (int i = 0; i < CGame.NumPlayer; i++) - CGame.Player[i].LineNr = (i + 1) % 2; + CGame.Players[i].LineNr = (i + 1) % 2; } else { for (int i = 0; i < CGame.NumPlayer; i++) - CGame.Player[i].LineNr = duetPlayer[i]; + CGame.Players[i].LineNr = duetPlayer[i]; } } _SetDuetLyricsVisibility(song.IsDuet); @@ -764,7 +764,7 @@ namespace Vocaluxe.Screens { for (int j = 0; j < CGame.NumPlayer; j++) { - if (CGame.Player[j].LineNr == i) + if (CGame.Players[j].LineNr == i) _SingNotes[_SingBars].AddLine(_NoteLines[j], line, nr); } @@ -1336,8 +1336,8 @@ namespace Vocaluxe.Screens { for (int i = 0; i < CGame.NumPlayer; i++) { - if (CGame.Player[i].ProfileID > -1 && CProfiles.NumProfiles > CGame.Player[i].ProfileID) - _Statics[_StaticAvatars[i, CGame.NumPlayer - 1]].Texture = CProfiles.Profiles[CGame.Player[i].ProfileID].Avatar.Texture; + if (CProfiles.IsProfileIDValid(CGame.Players[i].ProfileID)) + _Statics[_StaticAvatars[i, CGame.NumPlayer - 1]].Texture = CProfiles.Profiles[CGame.Players[i].ProfileID].Avatar.Texture; else _Statics[_StaticAvatars[i, CGame.NumPlayer - 1]].Visible = false; } @@ -1347,8 +1347,8 @@ namespace Vocaluxe.Screens { for (int i = 0; i < CGame.NumPlayer; i++) { - if (CGame.Player[i].ProfileID > -1 && CProfiles.NumProfiles > CGame.Player[i].ProfileID) - _Texts[_TextNames[i, CGame.NumPlayer - 1]].Text = CProfiles.Profiles[CGame.Player[i].ProfileID].PlayerName; + if (CProfiles.IsProfileIDValid(CGame.Players[i].ProfileID)) + _Texts[_TextNames[i, CGame.NumPlayer - 1]].Text = CProfiles.Profiles[CGame.Players[i].ProfileID].PlayerName; else _Texts[_TextNames[i, CGame.NumPlayer - 1]].Visible = false; } diff --git a/VocaluxeLib/Menu/CNameSelection.cs b/VocaluxeLib/Menu/CNameSelection.cs index 29a2e73e..589cb3d5 100644 --- a/VocaluxeLib/Menu/CNameSelection.cs +++ b/VocaluxeLib/Menu/CNameSelection.cs @@ -484,12 +484,15 @@ namespace VocaluxeLib.Menu for (int i = 0; i < CBase.Profiles.GetProfiles().Length; i++) { bool visible = CBase.Profiles.GetProfiles()[i].Active == EOffOn.TR_CONFIG_ON; - //Show profile only if active - for (int p = 0; p < CBase.Game.GetNumPlayer(); p++) + if (visible) { - //Don't show profile if is selected, but if selected and guest - if (CBase.Game.GetPlayer()[p].ProfileID == i && CBase.Profiles.GetProfiles()[i].GuestProfile == EOffOn.TR_CONFIG_OFF) - visible = false; + //Show profile only if active + for (int p = 0; p < CBase.Game.GetNumPlayer(); p++) + { + //Don't show profile if is selected, but if selected and guest + if (CBase.Game.GetPlayers()[p].ProfileID == i) + visible = false; + } } if (visible) _VisibleProfiles.Add(i); diff --git a/VocaluxeLib/Menu/CPoints.cs b/VocaluxeLib/Menu/CPoints.cs index 84dab764..b9ff4b41 100644 --- a/VocaluxeLib/Menu/CPoints.cs +++ b/VocaluxeLib/Menu/CPoints.cs @@ -34,8 +34,6 @@ namespace VocaluxeLib.Menu for (int player = 0; player < players.Length; player++) { _Rounds[round, player].ProfileID = players[player].ProfileID; - _Rounds[round, player].Name = players[player].Name; - _Rounds[round, player].Difficulty = players[player].Difficulty; _Rounds[round, player].Points = 0f; _Rounds[round, player].PointsGoldenNotes = 0f; _Rounds[round, player].PointsLineBonus = 0f; @@ -86,13 +84,11 @@ namespace VocaluxeLib.Menu for (int p = 0; p < player.Length; p++) { - player[p].Name = _Rounds[round, p].Name; player[p].Points = _Rounds[round, p].Points; player[p].PointsGoldenNotes = _Rounds[round, p].PointsGoldenNotes; player[p].PointsLineBonus = _Rounds[round, p].PointsLineBonus; player[p].SongID = _Rounds[round, p].SongID; player[p].LineNr = _Rounds[round, p].LineNr; - player[p].Difficulty = _Rounds[round, p].Difficulty; player[p].Medley = _Rounds[round, p].Medley; player[p].Duet = _Rounds[round, p].Duet; player[p].ShortSong = _Rounds[round, p].ShortSong; diff --git a/VocaluxeLib/Menu/IMenu.cs b/VocaluxeLib/Menu/IMenu.cs index 28b278f7..31c3d287 100644 --- a/VocaluxeLib/Menu/IMenu.cs +++ b/VocaluxeLib/Menu/IMenu.cs @@ -209,7 +209,7 @@ namespace VocaluxeLib.Menu { int GetNumPlayer(); void SetNumPlayer(int numPlayer); - SPlayer[] GetPlayer(); + SPlayer[] GetPlayers(); CPoints GetPoints(); float GetMidBeatD(); int GetCurrentBeatD(); @@ -233,6 +233,8 @@ namespace VocaluxeLib.Menu public interface IProfiles { SProfile[] GetProfiles(); + EGameDifficulty GetDifficulty(int profileID); + string GetPlayerName(int profileID, int playerNum = 0); } public interface ISongs diff --git a/VocaluxeLib/Menu/SingNotes/CSingNotes.cs b/VocaluxeLib/Menu/SingNotes/CSingNotes.cs index 573e11b8..03b1a249 100644 --- a/VocaluxeLib/Menu/SingNotes/CSingNotes.cs +++ b/VocaluxeLib/Menu/SingNotes/CSingNotes.cs @@ -301,7 +301,8 @@ namespace VocaluxeLib.Menu.SingNotes float w = _PlayerNotes[n].Rect.W; float h = _PlayerNotes[n].Rect.H; - float dh = h / CBase.Settings.GetNumNoteLines() * (2f - (int)CBase.Game.GetPlayer()[_PlayerNotes[n].PlayerNr].Difficulty) / 4f; + int profileID = CBase.Game.GetPlayers()[_PlayerNotes[n].PlayerNr].ProfileID; + float dh = h / CBase.Settings.GetNumNoteLines() * (2f - (int)CBase.Profiles.GetDifficulty(profileID)) / 4f; float beats = line.LastNoteBeat - line.FirstNoteBeat + 1; @@ -356,7 +357,7 @@ namespace VocaluxeLib.Menu.SingNotes foreach (CParticleEffect perfline in _PlayerNotes[n].PerfectLineTwinkle) perfline.Draw(); - if (singLine == null || singLine.Count == 0 || CBase.Game.GetPlayer()[player].CurrentLine == -1 || singLine.Count <= CBase.Game.GetPlayer()[player].CurrentLine) + if (singLine == null || singLine.Count == 0 || CBase.Game.GetPlayers()[player].CurrentLine == -1 || singLine.Count <= CBase.Game.GetPlayers()[player].CurrentLine) { foreach (CParticleEffect stars in _PlayerNotes[n].GoldenStars) { @@ -366,7 +367,7 @@ namespace VocaluxeLib.Menu.SingNotes return; } - foreach (CNote note in singLine[CBase.Game.GetPlayer()[player].CurrentLine].Notes) + foreach (CNote note in singLine[CBase.Game.GetPlayers()[player].CurrentLine].Notes) { if (note.StartBeat >= line.FirstNoteBeat && note.EndBeat <= line.LastNoteBeat) { @@ -403,13 +404,13 @@ namespace VocaluxeLib.Menu.SingNotes } } - int currentLine = CBase.Game.GetPlayer()[player].SingLine.Count - 1; + int currentLine = CBase.Game.GetPlayers()[player].SingLine.Count - 1; if (currentLine > 0) { - if (CBase.Game.GetPlayer()[player].SingLine[currentLine - 1].PerfectLine) + if (CBase.Game.GetPlayers()[player].SingLine[currentLine - 1].PerfectLine) { _AddPerfectLine(n); - CBase.Game.GetPlayer()[player].SingLine[currentLine - 1].PerfectLine = false; + CBase.Game.GetPlayers()[player].SingLine[currentLine - 1].PerfectLine = false; } } diff --git a/VocaluxeLib/Menu/Structs.cs b/VocaluxeLib/Menu/Structs.cs index 6d0fefbe..76dbc466 100644 --- a/VocaluxeLib/Menu/Structs.cs +++ b/VocaluxeLib/Menu/Structs.cs @@ -242,8 +242,6 @@ namespace VocaluxeLib.Menu public struct SPlayer { public int ProfileID; - public string Name; - public EGameDifficulty Difficulty; public double Points; public double PointsLineBonus; public double PointsGoldenNotes; From ff58f76dc0a9587dbb2c4f23d1c38ee820336fbb Mon Sep 17 00:00:00 2001 From: Flamefire Date: Thu, 25 Apr 2013 19:01:26 +0200 Subject: [PATCH 23/27] Updated UsePlayers --- Vocaluxe/Base/CConfig.cs | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/Vocaluxe/Base/CConfig.cs b/Vocaluxe/Base/CConfig.cs index 5e72062f..7e58adfa 100644 --- a/Vocaluxe/Base/CConfig.cs +++ b/Vocaluxe/Base/CConfig.cs @@ -833,21 +833,17 @@ namespace Vocaluxe.Base ///
public static void UsePlayers() { - for (int i = 0; i < CProfiles.Profiles.Length; i++) + for (int j = 0; j < CSettings.MaxNumPlayer; j++) { - for (int j = 0; j < CSettings.MaxNumPlayer; j++) - { - if (Players[j] != "") + CGame.Players[j].ProfileID = -1; + if (Players[j] == "") + continue; + for (int i = 0; i < CProfiles.Profiles.Length; i++) + if (Path.GetFileName(CProfiles.Profiles[i].ProfileFile) == Players[j] && CProfiles.Profiles[i].Active == EOffOn.TR_CONFIG_ON) { - if (Path.GetFileName(CProfiles.Profiles[i].ProfileFile) == Players[j] && CProfiles.Profiles[i].Active == EOffOn.TR_CONFIG_ON) - { - //Update Game-infos with player - CGame.Players[j].ProfileID = i; - } + //Update Game-infos with player + CGame.Players[j].ProfileID = i; } - else - CGame.Players[j].ProfileID = -1; - } } } } From 1d628fc09cdd682b8611d60791a01f6152f0735b Mon Sep 17 00:00:00 2001 From: Flamefire Date: Thu, 25 Apr 2013 19:17:05 +0200 Subject: [PATCH 24/27] Bugfix for CProfiles --- Vocaluxe/Base/CProfiles.cs | 36 +++++++++++++----------------- Vocaluxe/Screens/CScreenNames.cs | 2 -- VocaluxeLib/Menu/CNameSelection.cs | 2 +- 3 files changed, 16 insertions(+), 24 deletions(-) diff --git a/Vocaluxe/Base/CProfiles.cs b/Vocaluxe/Base/CProfiles.cs index 71bcedd9..e45190a2 100644 --- a/Vocaluxe/Base/CProfiles.cs +++ b/Vocaluxe/Base/CProfiles.cs @@ -136,7 +136,7 @@ namespace Vocaluxe.Base public static string AddGetPlayerName(int profileID, char chr) { - if (IsProfileIDValid(profileID)) + if (!IsProfileIDValid(profileID)) return String.Empty; SProfile profile = _Profiles[profileID]; @@ -148,7 +148,7 @@ namespace Vocaluxe.Base public static string GetDeleteCharInPlayerName(int profileID) { - if (IsProfileIDValid(profileID)) + if (!IsProfileIDValid(profileID)) return String.Empty; SProfile profile = _Profiles[profileID]; @@ -161,17 +161,17 @@ namespace Vocaluxe.Base public static bool IsProfileIDValid(int profileID) { - return profileID < 0 || profileID >= _Profiles.Count; + return profileID >= 0 && profileID < _Profiles.Count; } public static EGameDifficulty GetDifficulty(int profileID) { - return IsProfileIDValid(profileID) ? EGameDifficulty.TR_CONFIG_NORMAL : _Profiles[profileID].Difficulty; + return IsProfileIDValid(profileID) ? _Profiles[profileID].Difficulty : EGameDifficulty.TR_CONFIG_NORMAL; } public static void SetDifficulty(int profileID, EGameDifficulty difficulty) { - if (IsProfileIDValid(profileID)) + if (!IsProfileIDValid(profileID)) return; SProfile profile = _Profiles[profileID]; @@ -181,23 +181,17 @@ namespace Vocaluxe.Base public static EOffOn GetGuestProfile(int profileID) { - if (IsProfileIDValid(profileID)) - return EOffOn.TR_CONFIG_OFF; - - return _Profiles[profileID].GuestProfile; + return IsProfileIDValid(profileID) ? _Profiles[profileID].GuestProfile : EOffOn.TR_CONFIG_OFF; } public static EOffOn GetActive(int profileID) { - if (IsProfileIDValid(profileID)) - return EOffOn.TR_CONFIG_OFF; - - return _Profiles[profileID].Active; + return IsProfileIDValid(profileID) ? _Profiles[profileID].Active : EOffOn.TR_CONFIG_OFF; } public static void SetGuestProfile(int profileID, EOffOn option) { - if (IsProfileIDValid(profileID)) + if (!IsProfileIDValid(profileID)) return; SProfile profile = _Profiles[profileID]; @@ -207,7 +201,7 @@ namespace Vocaluxe.Base public static void SetActive(int profileID, EOffOn option) { - if (IsProfileIDValid(profileID)) + if (!IsProfileIDValid(profileID)) return; SProfile profile = _Profiles[profileID]; profile.Active = option; @@ -216,7 +210,7 @@ namespace Vocaluxe.Base public static bool IsGuestProfile(int profileID) { - if (IsProfileIDValid(profileID)) + if (!IsProfileIDValid(profileID)) return true; // this will prevent from saving dummy profiles to highscore db return _Profiles[profileID].GuestProfile == EOffOn.TR_CONFIG_ON; @@ -224,14 +218,14 @@ namespace Vocaluxe.Base public static bool IsActive(int profileID) { - if (IsProfileIDValid(profileID)) + if (!IsProfileIDValid(profileID)) return false; return _Profiles[profileID].Active == EOffOn.TR_CONFIG_ON; } public static void SetAvatar(int profileID, int avatarNr) { - if (IsProfileIDValid(profileID) || avatarNr < 0 || avatarNr >= _Avatars.Count) + if (!IsProfileIDValid(profileID) || avatarNr < 0 || avatarNr >= _Avatars.Count) return; SProfile profile = _Profiles[profileID]; @@ -241,7 +235,7 @@ namespace Vocaluxe.Base public static int GetAvatarNr(int profileID) { - if (IsProfileIDValid(profileID)) + if (!IsProfileIDValid(profileID)) return 0; for (int i = 0; i < _Avatars.Count; i++) @@ -255,7 +249,7 @@ namespace Vocaluxe.Base public static void DeleteProfile(int profileID) { - if (IsProfileIDValid(profileID)) + if (!IsProfileIDValid(profileID)) return; if (_Profiles[profileID].ProfileFile == "") return; @@ -293,7 +287,7 @@ namespace Vocaluxe.Base private static void _SaveProfile(int profileID) { - if (IsProfileIDValid(profileID)) + if (!IsProfileIDValid(profileID)) return; if (_Profiles[profileID].ProfileFile == "") diff --git a/Vocaluxe/Screens/CScreenNames.cs b/Vocaluxe/Screens/CScreenNames.cs index 22e54dca..ea580d15 100644 --- a/Vocaluxe/Screens/CScreenNames.cs +++ b/Vocaluxe/Screens/CScreenNames.cs @@ -490,8 +490,6 @@ namespace Vocaluxe.Screens _ChooseAvatarStatic.Visible = false; } - if (mouseEvent.LB && _IsMouseOver(mouseEvent)) {} - if (mouseEvent.LB && _IsMouseOver(mouseEvent)) { if (_Buttons[_ButtonBack].Selected) diff --git a/VocaluxeLib/Menu/CNameSelection.cs b/VocaluxeLib/Menu/CNameSelection.cs index 589cb3d5..db08a110 100644 --- a/VocaluxeLib/Menu/CNameSelection.cs +++ b/VocaluxeLib/Menu/CNameSelection.cs @@ -490,7 +490,7 @@ namespace VocaluxeLib.Menu for (int p = 0; p < CBase.Game.GetNumPlayer(); p++) { //Don't show profile if is selected, but if selected and guest - if (CBase.Game.GetPlayers()[p].ProfileID == i) + if (CBase.Game.GetPlayers()[p].ProfileID == i && CBase.Profiles.GetProfiles()[i].GuestProfile==EOffOn.TR_CONFIG_OFF) visible = false; } } From 7cbae3d2dbe047a522a12cf4b8ae389baef7b458 Mon Sep 17 00:00:00 2001 From: Flamefire Date: Fri, 26 Apr 2013 13:19:22 +0200 Subject: [PATCH 25/27] Better player handling with bugfix (selecting not available player number) --- Vocaluxe/Base/CConfig.cs | 2 + Vocaluxe/Base/CProfiles.cs | 57 +++++----- Vocaluxe/Screens/CScreenNames.cs | 175 +++++++---------------------- Vocaluxe/Screens/CScreenSing.cs | 4 +- VocaluxeLib/Menu/CNameSelection.cs | 2 +- 5 files changed, 76 insertions(+), 164 deletions(-) diff --git a/Vocaluxe/Base/CConfig.cs b/Vocaluxe/Base/CConfig.cs index 7e58adfa..bf7964e7 100644 --- a/Vocaluxe/Base/CConfig.cs +++ b/Vocaluxe/Base/CConfig.cs @@ -839,11 +839,13 @@ namespace Vocaluxe.Base if (Players[j] == "") continue; for (int i = 0; i < CProfiles.Profiles.Length; i++) + { if (Path.GetFileName(CProfiles.Profiles[i].ProfileFile) == Players[j] && CProfiles.Profiles[i].Active == EOffOn.TR_CONFIG_ON) { //Update Game-infos with player CGame.Players[j].ProfileID = i; } + } } } } diff --git a/Vocaluxe/Base/CProfiles.cs b/Vocaluxe/Base/CProfiles.cs index 5641f23e..2944b0e7 100644 --- a/Vocaluxe/Base/CProfiles.cs +++ b/Vocaluxe/Base/CProfiles.cs @@ -66,7 +66,10 @@ namespace Vocaluxe.Base { if (IsProfileIDValid(profileID)) return _Profiles[profileID].PlayerName; - return (playerNum > 0) ? "Player " + playerNum : "Player"; + string playerName = CLanguage.Translate("TR_SCREENNAMES_PLAYER"); + if (playerNum > 0) + playerName += " " + playerNum; + return playerName; } public static int NewProfile(string fileName = "") @@ -253,32 +256,32 @@ namespace Vocaluxe.Base return; if (_Profiles[profileID].ProfileFile == "") return; - try - { - //Check if profile saved in config - for (int i = 0; i < CConfig.Players.Length; i++) - { - if (CConfig.Players[i] == _Profiles[profileID].ProfileFile) - { - CConfig.Players[i] = string.Empty; - CConfig.SaveConfig(); - } - } - File.Delete(_Profiles[profileID].ProfileFile); - _Profiles.RemoveAt(profileID); - //Check if profile is selected in game - for (int i = 0; i < CGame.Players.Length; i++) - { - if (CGame.Players[i].ProfileID > profileID) - CGame.Players[i].ProfileID--; - else if (CGame.Players[i].ProfileID == profileID) - CGame.Players[i].ProfileID = -1; - } - } - catch (Exception) - { - CLog.LogError("Can't delete Profile File " + _Profiles[profileID].ProfileFile + ".xml"); - } + try + { + //Check if profile saved in config + for (int i = 0; i < CConfig.Players.Length; i++) + { + if (CConfig.Players[i] == _Profiles[profileID].ProfileFile) + { + CConfig.Players[i] = string.Empty; + CConfig.SaveConfig(); + } + } + File.Delete(_Profiles[profileID].ProfileFile); + _Profiles.RemoveAt(profileID); + //Check if profile is selected in game + for (int i = 0; i < CGame.Players.Length; i++) + { + if (CGame.Players[i].ProfileID > profileID) + CGame.Players[i].ProfileID--; + else if (CGame.Players[i].ProfileID == profileID) + CGame.Players[i].ProfileID = -1; + } + } + catch (Exception) + { + CLog.LogError("Can't delete Profile File " + _Profiles[profileID].ProfileFile + ".xml"); + } } private static void _SortProfilesByName() diff --git a/Vocaluxe/Screens/CScreenNames.cs b/Vocaluxe/Screens/CScreenNames.cs index 133885ab..9f7fc909 100644 --- a/Vocaluxe/Screens/CScreenNames.cs +++ b/Vocaluxe/Screens/CScreenNames.cs @@ -60,17 +60,13 @@ namespace Vocaluxe.Screens private int _SelectingKeyboardPlayerNr; private int _SelectedPlayerNr; - private int[] _PlayerNr; - public override void Init() { base.Init(); List statics = new List(); - foreach (string text in _StaticPlayer) - statics.Add(text); - foreach (string text in _StaticPlayerAvatar) - statics.Add(text); + statics.AddRange(_StaticPlayerAvatar); + statics.AddRange(_StaticPlayer); statics.Add(_StaticWarningMics); statics.Add(_StaticWarningProfiles); _ThemeStatics = statics.ToArray(); @@ -82,8 +78,7 @@ namespace Vocaluxe.Screens texts.Clear(); texts.Add(_TextWarningMics); texts.Add(_TextWarningProfiles); - foreach (string text in _TextPlayer) - texts.Add(text); + texts.AddRange(_TextPlayer); _ThemeTexts = texts.ToArray(); texts.Clear(); @@ -108,10 +103,6 @@ namespace Vocaluxe.Screens { base.LoadTheme(xmlPath); - _PlayerNr = new int[CSettings.MaxNumPlayer]; - for (int i = 0; i < _PlayerNr.Length; i++) - _PlayerNr[i] = i; - for (int i = 0; i < CSettings.MaxNumPlayer; i++) _OriginalPlayerAvatarTextures[i] = _Statics[_StaticPlayerAvatar[i]].Texture; @@ -164,6 +155,8 @@ namespace Vocaluxe.Screens { //Handle left/right/up/down _NameSelections[_NameSelection].HandleInput(keyEvent); + int numberPressed = -1; + bool resetSelection = false; switch (keyEvent.Key) { case Keys.Enter: @@ -189,12 +182,7 @@ namespace Vocaluxe.Screens if (_SelectingKeyboardUnendless) { if (_SelectingKeyboardPlayerNr == CGame.NumPlayer) - { - //Reset all values - _SelectingKeyboardPlayerNr = 0; - _SelectingKeyboardActive = false; - _NameSelections[_NameSelection].KeyboardSelection(false, -1); - } + resetSelection = true; else { _SelectingKeyboardPlayerNr++; @@ -202,117 +190,36 @@ namespace Vocaluxe.Screens } } else - { - //Reset all values - _SelectingKeyboardPlayerNr = 0; - _SelectingKeyboardActive = false; - _NameSelections[_NameSelection].KeyboardSelection(false, -1); - } + resetSelection = true; break; case Keys.D1: case Keys.NumPad1: - if (_SelectingKeyboardPlayerNr == 1) - { - //Reset all values - _SelectingKeyboardPlayerNr = 0; - _SelectingKeyboardActive = false; - _NameSelections[_NameSelection].KeyboardSelection(false, -1); - } - else - { - _SelectingKeyboardPlayerNr = 1; - _NameSelections[_NameSelection].KeyboardSelection(true, 1); - } - _SelectingKeyboardUnendless = false; + numberPressed = 1; break; case Keys.D2: case Keys.NumPad2: - if (_SelectingKeyboardPlayerNr == 2) - { - //Reset all values - _SelectingKeyboardPlayerNr = 0; - _SelectingKeyboardActive = false; - _NameSelections[_NameSelection].KeyboardSelection(false, -1); - } - else - { - _SelectingKeyboardPlayerNr = 2; - _NameSelections[_NameSelection].KeyboardSelection(true, 2); - } - _SelectingKeyboardUnendless = false; + numberPressed = 2; break; case Keys.D3: case Keys.NumPad3: - if (_SelectingKeyboardPlayerNr == 3) - { - //Reset all values - _SelectingKeyboardPlayerNr = 0; - _SelectingKeyboardActive = false; - _NameSelections[_NameSelection].KeyboardSelection(false, -1); - } - else - { - _SelectingKeyboardPlayerNr = 3; - _NameSelections[_NameSelection].KeyboardSelection(true, 3); - } - _SelectingKeyboardUnendless = false; + numberPressed = 3; break; case Keys.D4: case Keys.NumPad4: - if (_SelectingKeyboardPlayerNr == 4) - { - //Reset all values - _SelectingKeyboardPlayerNr = 0; - _SelectingKeyboardActive = false; - _NameSelections[_NameSelection].KeyboardSelection(false, -1); - } - else - { - _SelectingKeyboardPlayerNr = 4; - _NameSelections[_NameSelection].KeyboardSelection(true, 4); - } - _SelectingKeyboardUnendless = false; + numberPressed = 4; break; case Keys.D5: case Keys.NumPad5: - if (_SelectingKeyboardPlayerNr == 5) - { - //Reset all values - _SelectingKeyboardPlayerNr = 0; - _SelectingKeyboardActive = false; - _NameSelections[_NameSelection].KeyboardSelection(false, -1); - } - else - { - _SelectingKeyboardPlayerNr = 5; - _NameSelections[_NameSelection].KeyboardSelection(true, 5); - } - _SelectingKeyboardUnendless = false; + numberPressed = 5; break; case Keys.D6: case Keys.NumPad6: - if (_SelectingKeyboardPlayerNr == 6) - { - //Reset all values - _SelectingKeyboardPlayerNr = 0; - _SelectingKeyboardActive = false; - _NameSelections[_NameSelection].KeyboardSelection(false, -1); - } - else - { - _SelectingKeyboardPlayerNr = 6; - _NameSelections[_NameSelection].KeyboardSelection(true, 6); - } - _SelectingKeyboardUnendless = false; + numberPressed = 6; break; case Keys.Escape: - //Reset all values - _SelectingKeyboardPlayerNr = 0; - _SelectingKeyboardActive = false; - _SelectingKeyboardUnendless = false; - _NameSelections[_NameSelection].KeyboardSelection(false, -1); + resetSelection = true; break; case Keys.Delete: @@ -323,7 +230,7 @@ namespace Vocaluxe.Screens CConfig.SaveConfig(); //Update texture and name _Statics[_StaticPlayerAvatar[_SelectingKeyboardPlayerNr - 1]].Texture = _OriginalPlayerAvatarTextures[_SelectingKeyboardPlayerNr - 1]; - _Texts[_TextPlayer[_SelectingKeyboardPlayerNr - 1]].Text = CLanguage.Translate("TR_SCREENNAMES_PLAYER") + " " + _SelectingKeyboardPlayerNr; + _Texts[_TextPlayer[_SelectingKeyboardPlayerNr - 1]].Text = CProfiles.GetPlayerName(-1, _SelectingKeyboardPlayerNr); //Update profile-warning _CheckPlayers(); //Reset all values @@ -337,10 +244,8 @@ namespace Vocaluxe.Screens case Keys.F10: if (CGame.GetNumSongs() == 1 && CGame.GetSong(1).IsDuet) { - if (_SelectSlides[_SelectSlideDuetPlayer[_SelectingKeyboardPlayerNr - 1]].Selection == 0) - _SelectSlides[_SelectSlideDuetPlayer[_SelectingKeyboardPlayerNr - 1]].Selection = 1; - else - _SelectSlides[_SelectSlideDuetPlayer[_SelectingKeyboardPlayerNr - 1]].Selection = 0; + CSelectSlide selectSlideDuetPart = _SelectSlides[_SelectSlideDuetPlayer[_SelectingKeyboardPlayerNr - 1]]; + selectSlideDuetPart.Selection = (selectSlideDuetPart.Selection + 1) % 2; //Reset all values _SelectingKeyboardPlayerNr = 0; _SelectingKeyboardActive = false; @@ -350,12 +255,27 @@ namespace Vocaluxe.Screens } break; } + if (numberPressed > 0 || resetSelection) + { + if (numberPressed == _SelectingKeyboardPlayerNr || resetSelection) + { + //Reset all values + _SelectingKeyboardPlayerNr = 0; + _SelectingKeyboardActive = false; + _NameSelections[_NameSelection].KeyboardSelection(false, -1); + } + else if (numberPressed <= CConfig.NumPlayer) + { + _SelectingKeyboardPlayerNr = numberPressed; + _NameSelections[_NameSelection].KeyboardSelection(true, numberPressed); + } + _SelectingKeyboardUnendless = false; + } } //Normal Keyboard handling else { base.HandleInput(keyEvent); - bool processed = false; switch (keyEvent.Key) { case Keys.Escape: @@ -366,15 +286,9 @@ namespace Vocaluxe.Screens case Keys.Enter: if (_Buttons[_ButtonBack].Selected) - { - processed = true; CGraphics.FadeTo(EScreens.ScreenSong); - } else - { - processed = true; _StartSong(); - } break; @@ -407,10 +321,11 @@ namespace Vocaluxe.Screens case Keys.NumPad6: _SelectingKeyboardPlayerNr = 6; break; + default: + _UpdatePlayerNumber(); + break; } - if (!processed) - _UpdatePlayerNumber(); if (_SelectingKeyboardPlayerNr > 0 && _SelectingKeyboardPlayerNr <= CConfig.NumPlayer) { @@ -516,7 +431,7 @@ namespace Vocaluxe.Screens CConfig.SaveConfig(); //Update texture and name _Statics[_StaticPlayerAvatar[i]].Texture = _OriginalPlayerAvatarTextures[i]; - _Texts[_TextPlayer[i]].Text = CLanguage.Translate("TR_SCREENNAMES_PLAYER") + " " + (i + 1); + _Texts[_TextPlayer[i]].Text = CProfiles.GetPlayerName(-1, i + 1); //Update profile-warning _CheckPlayers(); //Update Tiles-List @@ -564,16 +479,10 @@ namespace Vocaluxe.Screens for (int i = 0; i < CSettings.MaxNumPlayer; i++) { - if (CProfiles.IsProfileIDValid(CGame.Players[i].ProfileID)) - { - _Statics[_StaticPlayerAvatar[i]].Texture = CProfiles.Profiles[CGame.Players[i].ProfileID].Avatar.Texture; - _Texts[_TextPlayer[i]].Text = CProfiles.GetPlayerName(CGame.Players[i].ProfileID); - } - else - { - _Statics[_StaticPlayerAvatar[i]].Texture = _OriginalPlayerAvatarTextures[i]; - _Texts[_TextPlayer[i]].Text = CLanguage.Translate("TR_SCREENNAMES_PLAYER") + " " + (i + 1).ToString(); - } + _Statics[_StaticPlayerAvatar[i]].Texture = CProfiles.IsProfileIDValid(CGame.Players[i].ProfileID) ? + CProfiles.Profiles[CGame.Players[i].ProfileID].Avatar.Texture : + _OriginalPlayerAvatarTextures[i]; + _Texts[_TextPlayer[i]].Text = CProfiles.GetPlayerName(CGame.Players[i].ProfileID, i + 1); if (CGame.GetNumSongs() == 1 && CGame.GetSong(1).IsDuet) { _SelectSlides[_SelectSlideDuetPlayer[i]].Clear(); @@ -637,7 +546,7 @@ namespace Vocaluxe.Screens _Statics["StaticPlayerAvatar" + i].Visible = true; _Texts["TextPlayer" + i].Visible = true; if (_Texts["TextPlayer" + i].Text == "") - _Texts["TextPlayer" + i].Text = CLanguage.Translate("TR_SCREENNAMES_PLAYER") + " " + i; + _Texts["TextPlayer" + i].Text = CProfiles.GetPlayerName(-1, i); _Equalizers["EqualizerPlayer" + i].Visible = true; if (CGame.GetNumSongs() == 1 && CGame.GetSong(1).IsDuet) _SelectSlides["SelectSlideDuetPlayer" + i].Visible = true; diff --git a/Vocaluxe/Screens/CScreenSing.cs b/Vocaluxe/Screens/CScreenSing.cs index a7bad433..739677f3 100644 --- a/Vocaluxe/Screens/CScreenSing.cs +++ b/Vocaluxe/Screens/CScreenSing.cs @@ -961,15 +961,13 @@ namespace Vocaluxe.Screens float h = (float)(t * CSettings.RenderH); float w = CFonts.GetTextBounds(_Texts[_TextMedleyCountdown], h).Width; float x = CSettings.RenderW / 2 - w / 2; - float y = CSettings.RenderH / 2 - h / 2 ; + float y = CSettings.RenderH / 2 - h / 2; _Texts[_TextMedleyCountdown].X = x; _Texts[_TextMedleyCountdown].Y = y; _Texts[_TextMedleyCountdown].Height = h; } else - { _Texts[_TextMedleyCountdown].Visible = false; - } } } diff --git a/VocaluxeLib/Menu/CNameSelection.cs b/VocaluxeLib/Menu/CNameSelection.cs index db08a110..aeea2e33 100644 --- a/VocaluxeLib/Menu/CNameSelection.cs +++ b/VocaluxeLib/Menu/CNameSelection.cs @@ -490,7 +490,7 @@ namespace VocaluxeLib.Menu for (int p = 0; p < CBase.Game.GetNumPlayer(); p++) { //Don't show profile if is selected, but if selected and guest - if (CBase.Game.GetPlayers()[p].ProfileID == i && CBase.Profiles.GetProfiles()[i].GuestProfile==EOffOn.TR_CONFIG_OFF) + if (CBase.Game.GetPlayers()[p].ProfileID == i && CBase.Profiles.GetProfiles()[i].GuestProfile == EOffOn.TR_CONFIG_OFF) visible = false; } } From 63c0688886cc5c041449375969f3f2aebbac0227 Mon Sep 17 00:00:00 2001 From: Flamefire Date: Fri, 26 Apr 2013 16:00:50 +0200 Subject: [PATCH 26/27] Added possibility to extract credit image --- Vocaluxe/Base/CDataBase.cs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/Vocaluxe/Base/CDataBase.cs b/Vocaluxe/Base/CDataBase.cs index 3cd2d400..cbb4ca48 100644 --- a/Vocaluxe/Base/CDataBase.cs +++ b/Vocaluxe/Base/CDataBase.cs @@ -1187,6 +1187,14 @@ namespace Vocaluxe.Base reader.Read(); byte[] data = _GetBytes(reader); tex = CDraw.AddTexture(w, h, ref data); + /*using (Bitmap bmp = new Bitmap(w, h)) + { + BitmapData bmpData = bmp.LockBits(new Rectangle(0, 0, bmp.Width, bmp.Height), ImageLockMode.WriteOnly, PixelFormat.Format32bppArgb); + Marshal.Copy(data, 0, bmpData.Scan0, w * h * 4); + bmp.UnlockBits(bmpData); + bmp.Save(fileName); + }*/ + } } From f43817efd014110bf69a1349e5e8a70d9584827f Mon Sep 17 00:00:00 2001 From: Flamefire Date: Fri, 26 Apr 2013 17:46:53 +0200 Subject: [PATCH 27/27] Renamed ambiguous Notes classes --- .../CPartyScreenTicTacToeConfig.cs | 5 +- Vocaluxe/Base/CDataBase.cs | 1 - Vocaluxe/Base/CGame.cs | 12 +- Vocaluxe/Base/CMain.cs | 4 +- Vocaluxe/Base/CObservable.cs | 2 +- Vocaluxe/Base/CPlaylists.cs | 14 +-- Vocaluxe/Base/CSongFilter.cs | 7 +- Vocaluxe/Base/CUtility.cs | 4 +- Vocaluxe/GameModes/CGameMode.cs | 2 +- Vocaluxe/Screens/CScreenSing.cs | 108 +++++++++--------- VocaluxeLib/Menu/IMenu.cs | 2 +- VocaluxeLib/Menu/SingNotes/CNotes.cs | 69 +++++------ VocaluxeLib/Menu/SingNotes/CSingNotes.cs | 24 ++-- VocaluxeLib/Menu/SongMenu/CSong.cs | 58 +++++----- 14 files changed, 142 insertions(+), 170 deletions(-) diff --git a/PartyModes/PartyModeTicTacToe/CPartyScreenTicTacToeConfig.cs b/PartyModes/PartyModeTicTacToe/CPartyScreenTicTacToeConfig.cs index c563ee48..a03c839d 100644 --- a/PartyModes/PartyModeTicTacToe/CPartyScreenTicTacToeConfig.cs +++ b/PartyModes/PartyModeTicTacToe/CPartyScreenTicTacToeConfig.cs @@ -18,6 +18,7 @@ #endregion using System; +using System.Collections.Generic; using System.Linq; using System.Windows.Forms; using VocaluxeLib.Menu; @@ -198,9 +199,9 @@ namespace VocaluxeLib.PartyModes.TicTacToe _SelectSlides[_SelectSlideSongSource].Clear(); _SelectSlides[_SelectSlideSongSource].SetValues((int)_Data.ScreenConfig.SongSource); - string[] playlists = CBase.Playlist.GetPlaylistNames(); + List playlists = CBase.Playlist.GetPlaylistNames(); _SelectSlides[_SelectSlidePlaylist].Clear(); - for (int i = 0; i < playlists.Length; i++) + for (int i = 0; i < playlists.Count; i++) { string value = playlists[i] + " (" + CBase.Playlist.GetPlaylistSongCount(i) + " " + CBase.Language.Translate("TR_SONGS", _PartyModeID) + ")"; _SelectSlides[_SelectSlidePlaylist].AddValue(value); diff --git a/Vocaluxe/Base/CDataBase.cs b/Vocaluxe/Base/CDataBase.cs index cbb4ca48..da72c5b6 100644 --- a/Vocaluxe/Base/CDataBase.cs +++ b/Vocaluxe/Base/CDataBase.cs @@ -1194,7 +1194,6 @@ namespace Vocaluxe.Base bmp.UnlockBits(bmpData); bmp.Save(fileName); }*/ - } } diff --git a/Vocaluxe/Base/CGame.cs b/Vocaluxe/Base/CGame.cs index 5c9fb87a..ae909a92 100644 --- a/Vocaluxe/Base/CGame.cs +++ b/Vocaluxe/Base/CGame.cs @@ -229,7 +229,7 @@ namespace Vocaluxe.Base (_GameMode.GetCurrentGameMode() == EGameMode.TR_GAMEMODE_SHORTSONG && song.ShortEnd == beat)) Players[p].SongFinished = true; - CLine[] lines = song.Notes.GetLines(Players[p].LineNr).Line; + CLine[] lines = song.Notes.GetVoice(Players[p].LineNr).Lines; int line = -1; for (int j = 0; j < lines.Length; j++) @@ -293,7 +293,7 @@ namespace Vocaluxe.Base // valid //CSound.RecordSetTone(p, Tone); double points = (CSettings.MaxScore - CSettings.LinebonusScore) * (double)notes[note].PointsForBeat / - song.Notes.GetLines(Players[p].LineNr).Points; + song.Notes.GetVoice(Players[p].LineNr).Points; if (notes[note].NoteType == ENoteType.Golden) Players[p].PointsGoldenNotes += points; @@ -302,8 +302,8 @@ namespace Vocaluxe.Base // update player notes (sung notes) if (Players[p].SingLine[line].NoteCount > 0) { - CNote nt = Players[p].SingLine[line].LastNote; - if (notes[note].StartBeat == beat || nt.EndBeat + 1 != beat || nt.Tone != tone || !nt.Hit) + CNote lastNote = Players[p].SingLine[line].LastNote; + if (notes[note].StartBeat == beat || lastNote.EndBeat + 1 != beat || lastNote.Tone != tone || !lastNote.Hit) Players[p].SingLine[line].AddNote(new CNote(beat, 1, tone, String.Empty, true, notes[note].NoteType)); else Players[p].SingLine[line].IncLastNoteLength(); @@ -318,8 +318,8 @@ namespace Vocaluxe.Base { if (Players[p].SingLine[line].NoteCount > 0) { - CNote nt = Players[p].SingLine[line].LastNote; - if (nt.Tone == tonePlayer && nt.EndBeat + 1 == beat && !nt.Hit) + CNote lastNote = Players[p].SingLine[line].LastNote; + if (lastNote.Tone == tonePlayer && lastNote.EndBeat + 1 == beat && !lastNote.Hit) Players[p].SingLine[line].IncLastNoteLength(); else Players[p].SingLine[line].AddNote(new CNote(beat, 1, tonePlayer, String.Empty, false, ENoteType.Freestyle)); diff --git a/Vocaluxe/Base/CMain.cs b/Vocaluxe/Base/CMain.cs index 014d439c..4e9b3521 100644 --- a/Vocaluxe/Base/CMain.cs +++ b/Vocaluxe/Base/CMain.cs @@ -778,9 +778,9 @@ namespace Vocaluxe.Base CPlaylists.SetPlaylistName(playlistID, name); } - public string[] GetPlaylistNames() + public List GetPlaylistNames() { - return CPlaylists.GetPlaylistNames(); + return CPlaylists.PlaylistNames; } public string GetPlaylistName(int playlistID) diff --git a/Vocaluxe/Base/CObservable.cs b/Vocaluxe/Base/CObservable.cs index 7d4497ae..239e15dc 100644 --- a/Vocaluxe/Base/CObservable.cs +++ b/Vocaluxe/Base/CObservable.cs @@ -26,7 +26,7 @@ namespace Vocaluxe.Base public event EventHandler ObjectChanged = delegate { }; protected bool _Changed = true; - protected void _NotifyObservers() + private void _NotifyObservers() { ObjectChanged.Invoke(this, null); } diff --git a/Vocaluxe/Base/CPlaylists.cs b/Vocaluxe/Base/CPlaylists.cs index 78d4343f..a740bc97 100644 --- a/Vocaluxe/Base/CPlaylists.cs +++ b/Vocaluxe/Base/CPlaylists.cs @@ -36,14 +36,14 @@ namespace Vocaluxe.Base get { return _Playlists.ToArray(); } } - public static IEnumerable PlaylistNames + public static List PlaylistNames { get { List names = new List(); for (int i = 0; i < _Playlists.Count; i++) names.Add(_Playlists[i].PlaylistName); - return names.ToArray(); + return names; } } @@ -94,16 +94,6 @@ namespace Vocaluxe.Base return _Playlists[playlistID].PlaylistName; } - public static string[] GetPlaylistNames() - { - List result = new List(); - - foreach (CPlaylistFile playlist in _Playlists) - result.Add(playlist.PlaylistName); - - return result.ToArray(); - } - public static void SetPlaylistName(int playlistID, string name) { if (playlistID >= _Playlists.Count || playlistID < 0) diff --git a/Vocaluxe/Base/CSongFilter.cs b/Vocaluxe/Base/CSongFilter.cs index c031695a..03744ab0 100644 --- a/Vocaluxe/Base/CSongFilter.cs +++ b/Vocaluxe/Base/CSongFilter.cs @@ -19,6 +19,7 @@ using System; using System.Collections.Generic; +using System.Linq; using VocaluxeLib.Menu; using VocaluxeLib.Menu.SongMenu; @@ -97,11 +98,7 @@ namespace Vocaluxe.Base { string search = song.Title.ToUpper() + " " + song.Artist.ToUpper() + " " + song.FolderName.ToUpper() + " " + song.FileName.ToUpper(); - bool contains = true; - - foreach (string str in searchStrings) - contains &= search.Contains(str); - if (contains) + if (searchStrings.All(search.Contains)) _FilteredSongs.Add(song); } } diff --git a/Vocaluxe/Base/CUtility.cs b/Vocaluxe/Base/CUtility.cs index 5751a797..17dfae81 100644 --- a/Vocaluxe/Base/CUtility.cs +++ b/Vocaluxe/Base/CUtility.cs @@ -64,14 +64,12 @@ namespace Vocaluxe.Base return 0f; } - public static float CalculateFPS() + public static void CalculateFPS() { float ms = GetMilliseconds(); if (ms > 0) _Fps = 1 / ms; - - return _Fps * 1000f; } public static double GetFPS() diff --git a/Vocaluxe/GameModes/CGameMode.cs b/Vocaluxe/GameModes/CGameMode.cs index e020e815..2d6f2527 100644 --- a/Vocaluxe/GameModes/CGameMode.cs +++ b/Vocaluxe/GameModes/CGameMode.cs @@ -199,7 +199,7 @@ namespace Vocaluxe.GameModes song.Finish = CGame.GetTimeFromBeats(song.ShortEnd, song.BPM) + CSettings.DefaultMedleyFadeOutTime + song.Gap; // set lines to medley mode - song.Notes.SetMedley(song.Notes.GetLines(0).Line[0].FirstNoteBeat, song.ShortEnd); + song.Notes.SetMedley(song.Notes.GetVoice(0).Lines[0].FirstNoteBeat, song.ShortEnd); break; } diff --git a/Vocaluxe/Screens/CScreenSing.cs b/Vocaluxe/Screens/CScreenSing.cs index 739677f3..119e5406 100644 --- a/Vocaluxe/Screens/CScreenSing.cs +++ b/Vocaluxe/Screens/CScreenSing.cs @@ -22,6 +22,7 @@ using System.Collections.Generic; using System.Diagnostics; using System.Drawing; using System.IO; +using System.Linq; using System.Windows.Forms; using Vocaluxe.Base; using VocaluxeLib.Menu; @@ -665,7 +666,7 @@ namespace Vocaluxe.Screens _TimerDuetText2.Stop(); _TimerDuetText2.Reset(); - if (song.Notes.Lines.Length != 2) + if (song.Notes.Voices.Length != 2) _TimerSongText.Start(); _StartSong(); @@ -719,21 +720,21 @@ namespace Vocaluxe.Screens CWebcam.Close(); } - private int _FindCurrentLine(CLines lines, CLine[] line, CSong song) + private int _FindCurrentLine(CVoice voice, CLine[] lines, CSong song) { float currentTime = _CurrentTime - song.Gap; //We are only interested in the last matching line, so either do not check further after line[j].StartBeat > _CurrentBeat or go backwards! - int j = lines.FindPreviousLine(_CurrentBeat); + int j = voice.FindPreviousLine(_CurrentBeat); for (; j >= 0; j--) { - float firstNoteTime = CGame.GetTimeFromBeats(line[j].FirstNoteBeat, song.BPM); + float firstNoteTime = CGame.GetTimeFromBeats(lines[j].FirstNoteBeat, song.BPM); //Earlist possible line break is 10s before first note if (firstNoteTime <= currentTime + 10f) { //First line has no predecessor or line has to be shown if (j == 0 || firstNoteTime - CConfig.MinLineBreakTime <= currentTime) return j; - float lastNoteTime = CGame.GetTimeFromBeats(line[j - 1].LastNoteBeat, song.BPM); + float lastNoteTime = CGame.GetTimeFromBeats(lines[j - 1].LastNoteBeat, song.BPM); //No line break if last line is not fully evaluated (with 50% tolerance -> tested so notes are drawn) if (lastNoteTime + CConfig.MicDelay / 1000f * 1.5f >= currentTime) return j - 1; @@ -760,31 +761,31 @@ namespace Vocaluxe.Screens if (i > 1) break; // for later - CLines lines = song.Notes.GetLines(i); - CLine[] line = lines.Line; + CVoice voice = song.Notes.GetVoice(i); + CLine[] lines = voice.Lines; // find current line - int nr = _FindCurrentLine(lines, line, song); + int nr = _FindCurrentLine(voice, lines, song); if (nr != -1) { for (int j = 0; j < CGame.NumPlayer; j++) { if (CGame.Players[j].LineNr == i) - _SingNotes[_SingBars].AddLine(_NoteLines[j], line, nr); + _SingNotes[_SingBars].SetLines(_NoteLines[j], lines, nr); } if (i == 0 && !song.IsDuet || i == 1 && song.IsDuet) { - _Lyrics[_LyricMain].SetLine(line[nr]); - _Lyrics[_LyricMainTop].SetLine(line[nr]); - _TimeToFirstNote = CGame.GetTimeFromBeats(line[nr].FirstNoteBeat - line[nr].StartBeat, song.BPM); - _RemainingTimeToFirstNote = CGame.GetTimeFromBeats(line[nr].FirstNoteBeat - CGame.GetBeatFromTime(_CurrentTime, song.BPM, song.Gap), song.BPM); + _Lyrics[_LyricMain].SetLine(lines[nr]); + _Lyrics[_LyricMainTop].SetLine(lines[nr]); + _TimeToFirstNote = CGame.GetTimeFromBeats(lines[nr].FirstNoteBeat - lines[nr].StartBeat, song.BPM); + _RemainingTimeToFirstNote = CGame.GetTimeFromBeats(lines[nr].FirstNoteBeat - CGame.GetBeatFromTime(_CurrentTime, song.BPM, song.Gap), song.BPM); - if (line.Length >= nr + 2) + if (lines.Length >= nr + 2) { - _Lyrics[_LyricSub].SetLine(line[nr + 1]); - _Lyrics[_LyricSubTop].SetLine(line[nr + 1]); + _Lyrics[_LyricSub].SetLine(lines[nr + 1]); + _Lyrics[_LyricSubTop].SetLine(lines[nr + 1]); } else { @@ -794,12 +795,12 @@ namespace Vocaluxe.Screens } if (i == 0 && song.IsDuet) { - _Lyrics[_LyricMainDuet].SetLine(line[nr]); - _TimeToFirstNoteDuet = CGame.GetTimeFromBeats(line[nr].FirstNoteBeat - line[nr].StartBeat, song.BPM); - _RemainingTimeToFirstNoteDuet = CGame.GetTimeFromBeats(line[nr].FirstNoteBeat - CGame.GetBeatFromTime(_CurrentTime, song.BPM, song.Gap), song.BPM); + _Lyrics[_LyricMainDuet].SetLine(lines[nr]); + _TimeToFirstNoteDuet = CGame.GetTimeFromBeats(lines[nr].FirstNoteBeat - lines[nr].StartBeat, song.BPM); + _RemainingTimeToFirstNoteDuet = CGame.GetTimeFromBeats(lines[nr].FirstNoteBeat - CGame.GetBeatFromTime(_CurrentTime, song.BPM, song.Gap), song.BPM); - if (line.Length >= nr + 2) - _Lyrics[_LyricSubDuet].SetLine(line[nr + 1]); + if (lines.Length >= nr + 2) + _Lyrics[_LyricSubDuet].SetLine(lines[nr + 1]); else _Lyrics[_LyricSubDuet].Clear(); } @@ -1061,22 +1062,22 @@ namespace Vocaluxe.Screens if (song == null || !song.NotesLoaded) return null; - float[] alpha = new float[song.Notes.Lines.Length * 2]; + float[] alpha = new float[song.Notes.Voices.Length * 2]; float currentTime = _CurrentTime - song.Gap; for (int i = 0; i < song.Notes.LinesCount; i++) { - CLines lines = song.Notes.GetLines(i); - CLine[] line = lines.Line; + CVoice voice = song.Notes.GetVoice(i); + CLine[] lines = voice.Lines; // find current line for lyric sub fading - int currentLineSub = _FindCurrentLine(lines, line, song); + int currentLineSub = _FindCurrentLine(voice, lines, song); // find current line for lyric main fading int currentLine = 0; - for (int j = 0; j < line.Length; j++) + for (int j = 0; j < lines.Length; j++) { - if (line[j].FirstNoteBeat <= _CurrentBeat) + if (lines[j].FirstNoteBeat <= _CurrentBeat) currentLine = j; } @@ -1085,31 +1086,31 @@ namespace Vocaluxe.Screens alpha[i * 2 + 1] = 1f; // main line alpha - if (currentLine == 0 && currentTime < CGame.GetTimeFromBeats(line[currentLine].FirstNoteBeat, song.BPM)) + if (currentLine == 0 && currentTime < CGame.GetTimeFromBeats(lines[currentLine].FirstNoteBeat, song.BPM)) { // first main line and fist note is not reached // => fade in - float diff = CGame.GetTimeFromBeats(line[currentLine].FirstNoteBeat, song.BPM) - currentTime; + float diff = CGame.GetTimeFromBeats(lines[currentLine].FirstNoteBeat, song.BPM) - currentTime; if (diff > dt) alpha[i * 2] = 1f - (diff - dt) / rt; } - else if (currentLine < line.Length - 1 && CGame.GetTimeFromBeats(line[currentLine].LastNoteBeat, song.BPM) < currentTime && - CGame.GetTimeFromBeats(line[currentLine + 1].FirstNoteBeat, song.BPM) > currentTime) + else if (currentLine < lines.Length - 1 && CGame.GetTimeFromBeats(lines[currentLine].LastNoteBeat, song.BPM) < currentTime && + CGame.GetTimeFromBeats(lines[currentLine + 1].FirstNoteBeat, song.BPM) > currentTime) { // current position is between two lines // time between the to lines - float diff = CGame.GetTimeFromBeats(line[currentLine + 1].FirstNoteBeat, song.BPM) - - CGame.GetTimeFromBeats(line[currentLine].LastNoteBeat, song.BPM); + float diff = CGame.GetTimeFromBeats(lines[currentLine + 1].FirstNoteBeat, song.BPM) - + CGame.GetTimeFromBeats(lines[currentLine].LastNoteBeat, song.BPM); // fade only if there is enough time for fading if (diff > 3.3f * dt) { // time elapsed since last line - float last = currentTime - CGame.GetTimeFromBeats(line[currentLine].LastNoteBeat, song.BPM); + float last = currentTime - CGame.GetTimeFromBeats(lines[currentLine].LastNoteBeat, song.BPM); // time to next line - float next = CGame.GetTimeFromBeats(line[currentLine + 1].FirstNoteBeat, song.BPM) - currentTime; + float next = CGame.GetTimeFromBeats(lines[currentLine + 1].FirstNoteBeat, song.BPM) - currentTime; if (last < next) { @@ -1124,18 +1125,18 @@ namespace Vocaluxe.Screens } } } - else if (currentLine == line.Length - 1 && CGame.GetTimeFromBeats(line[currentLine].LastNoteBeat, song.BPM) < currentTime) + else if (currentLine == lines.Length - 1 && CGame.GetTimeFromBeats(lines[currentLine].LastNoteBeat, song.BPM) < currentTime) { // last main line and last note was reached // => fade out - float diff = currentTime - CGame.GetTimeFromBeats(line[currentLine].LastNoteBeat, song.BPM); + float diff = currentTime - CGame.GetTimeFromBeats(lines[currentLine].LastNoteBeat, song.BPM); alpha[i * 2] = 1f - diff / rt; } // sub - if (currentLineSub < line.Length - 2) + if (currentLineSub < lines.Length - 2) { - float diff = CGame.GetTimeFromBeats(line[currentLineSub + 1].FirstNoteBeat, song.BPM) - currentTime; + float diff = CGame.GetTimeFromBeats(lines[currentLineSub + 1].FirstNoteBeat, song.BPM) - currentTime; if (diff > dt) alpha[i * 2 + 1] = 1f - (diff - dt) / rt; @@ -1338,26 +1339,21 @@ namespace Vocaluxe.Screens if (totalTime <= 0f) return; - CLines[] partLines = song.Notes.Lines; - foreach (CLines partLine in partLines) + foreach (CVoice voice in song.Notes.Voices) { - CLine[] line = partLine.Line; - for (int j = 0; j < line.Length; j++) + foreach (CLine line in voice.Lines.Where(line => line.VisibleInTimeLine)) { - if (line[j].VisibleInTimeLine) - { - STimeRect trect = new STimeRect {StartBeat = line[j].FirstNoteBeat, EndBeat = line[j].EndBeat}; - trect.Rect = GetNewStatic(new STexture(-1), - new SColorF(1f, 1f, 1f, 1f), - new SRectF( - stat.Rect.X + stat.Rect.W * ((CGame.GetTimeFromBeats(trect.StartBeat, song.BPM) + song.Gap - song.Start) / totalTime), - stat.Rect.Y, - stat.Rect.W * (CGame.GetTimeFromBeats(trect.EndBeat - trect.StartBeat, song.BPM) / totalTime), - stat.Rect.H, - stat.Rect.Z)); + STimeRect trect = new STimeRect {StartBeat = line.FirstNoteBeat, EndBeat = line.EndBeat}; + trect.Rect = GetNewStatic(new STexture(-1), + new SColorF(1f, 1f, 1f, 1f), + new SRectF( + stat.Rect.X + stat.Rect.W * ((CGame.GetTimeFromBeats(trect.StartBeat, song.BPM) + song.Gap - song.Start) / totalTime), + stat.Rect.Y, + stat.Rect.W * (CGame.GetTimeFromBeats(trect.EndBeat - trect.StartBeat, song.BPM) / totalTime), + stat.Rect.H, + stat.Rect.Z)); - _TimeRects.Add(trect); - } + _TimeRects.Add(trect); } } break; diff --git a/VocaluxeLib/Menu/IMenu.cs b/VocaluxeLib/Menu/IMenu.cs index 31c3d287..38af4ff1 100644 --- a/VocaluxeLib/Menu/IMenu.cs +++ b/VocaluxeLib/Menu/IMenu.cs @@ -310,7 +310,7 @@ namespace VocaluxeLib.Menu public interface IPlaylist { string GetPlaylistName(int playlistID); - string[] GetPlaylistNames(); + List GetPlaylistNames(); void SetPlaylistName(int playlistID, string name); void DeletePlaylist(int playlistID); diff --git a/VocaluxeLib/Menu/SingNotes/CNotes.cs b/VocaluxeLib/Menu/SingNotes/CNotes.cs index db10fa90..0ba6dfb6 100644 --- a/VocaluxeLib/Menu/SingNotes/CNotes.cs +++ b/VocaluxeLib/Menu/SingNotes/CNotes.cs @@ -25,73 +25,73 @@ namespace VocaluxeLib.Menu.SingNotes { public class CNotes { - private readonly List _Lines = new List(); + private readonly List _Voices = new List(); - public CLines[] Lines + public CVoice[] Voices { - get { return _Lines.ToArray(); } + get { return _Voices.ToArray(); } } public CNotes() {} public int LinesCount { - get { return _Lines.Count; } + get { return _Voices.Count; } } public CNotes(CNotes notes) { - foreach (CLines lines in notes._Lines) - _Lines.Add(new CLines(lines)); + foreach (CVoice voice in notes._Voices) + _Voices.Add(new CVoice(voice)); } - public CLines GetLines(int index) + public CVoice GetVoice(int index) { - while (index >= _Lines.Count) - _Lines.Add(new CLines()); + while (index >= _Voices.Count) + _Voices.Add(new CVoice()); - return _Lines[index]; + return _Voices[index]; } public int GetPoints(int index) { - if (index >= _Lines.Count) + if (index >= _Voices.Count) return 0; - return _Lines[index].Points; + return _Voices[index].Points; } public int GetNumLinesWithPoints(int index) { - if (index >= _Lines.Count) + if (index >= _Voices.Count) return 0; - return _Lines[index].NumLinesWithPoints; + return _Voices[index].NumLinesWithPoints; } - public void AddLines(CLines lines) + public void AddVoice(CVoice voice) { - _Lines.Add(lines); + _Voices.Add(voice); } - public bool ReplaceLinesAt(int index, CLines lines) + public bool ReplaceVoiceAt(int index, CVoice voice) { - if (index >= _Lines.Count) + if (index >= _Voices.Count) return false; - _Lines[index] = lines; + _Voices[index] = voice; return true; } public void Reset() { - _Lines.Clear(); + _Voices.Clear(); } public void SetMedley(int startBeat, int endBeat) { - foreach (CLines lines in _Lines) - lines.SetMedley(startBeat, endBeat); + foreach (CVoice voice in _Voices) + voice.SetMedley(startBeat, endBeat); } } @@ -542,23 +542,23 @@ namespace VocaluxeLib.Menu.SingNotes #endregion Methods } - public class CLines + public class CVoice { private readonly List _Lines = new List(); - public CLines() {} + public CVoice() {} - public CLines(CLines lines) + public CVoice(CVoice voice) { - foreach (CLine line in lines._Lines) + foreach (CLine line in voice._Lines) _Lines.Add(new CLine(line)); } - public CLine[] Line + public CLine[] Lines { get { return _Lines.ToArray(); } } - public int LineCount + public int NumLines { get { return _Lines.Count; } } @@ -577,22 +577,13 @@ namespace VocaluxeLib.Menu.SingNotes int endbeat = _Lines.Min(line => line.LastNoteBeat); int result = endbeat - startbeat; - if (result > 0) - return result; - - return 0; + return result > 0 ? result : 0; } } public int Points { - get - { - int points = 0; - foreach (CLine line in _Lines) - points += line.Points; - return points; - } + get { return _Lines.Sum(line => line.Points); } } public int NumLinesWithPoints diff --git a/VocaluxeLib/Menu/SingNotes/CSingNotes.cs b/VocaluxeLib/Menu/SingNotes/CSingNotes.cs index 03b1a249..457fb7fc 100644 --- a/VocaluxeLib/Menu/SingNotes/CSingNotes.cs +++ b/VocaluxeLib/Menu/SingNotes/CSingNotes.cs @@ -224,24 +224,24 @@ namespace VocaluxeLib.Menu.SingNotes return notes.ID; } - public void AddLine(int id, CLine[] line, int lineNr) + public void SetLines(int id, CLine[] lines, int lineNr) { - if (line == null) + if (lines == null) return; - int n = _FindPlayerLine(id); + int n = _FindPlayerNotes(id); if (n == -1) return; if (lineNr == _PlayerNotes[n].LineNr) return; - if (line.Length <= lineNr) + if (lines.Length <= lineNr) return; SPlayerNotes notes = _PlayerNotes[n]; - notes.Lines = line; + notes.Lines = lines; notes.LineNr = lineNr; notes.GoldenStars.Clear(); notes.Flares.Clear(); @@ -253,7 +253,7 @@ namespace VocaluxeLib.Menu.SingNotes public void SetAlpha(int id, float alpha) { - int n = _FindPlayerLine(id); + int n = _FindPlayerNotes(id); if (n == -1) return; @@ -264,7 +264,7 @@ namespace VocaluxeLib.Menu.SingNotes public float GetAlpha(int id) { - int n = _FindPlayerLine(id); + int n = _FindPlayerNotes(id); if (n == -1) return 0f; @@ -276,9 +276,9 @@ namespace VocaluxeLib.Menu.SingNotes Draw(id, null, player); } - public void Draw(int id, List singLine, int player) + public void Draw(int id, List singLines, int player) { - int n = _FindPlayerLine(id); + int n = _FindPlayerNotes(id); if (n == -1) return; @@ -357,7 +357,7 @@ namespace VocaluxeLib.Menu.SingNotes foreach (CParticleEffect perfline in _PlayerNotes[n].PerfectLineTwinkle) perfline.Draw(); - if (singLine == null || singLine.Count == 0 || CBase.Game.GetPlayers()[player].CurrentLine == -1 || singLine.Count <= CBase.Game.GetPlayers()[player].CurrentLine) + if (singLines == null || singLines.Count == 0 || CBase.Game.GetPlayers()[player].CurrentLine == -1 || singLines.Count <= CBase.Game.GetPlayers()[player].CurrentLine) { foreach (CParticleEffect stars in _PlayerNotes[n].GoldenStars) { @@ -367,7 +367,7 @@ namespace VocaluxeLib.Menu.SingNotes return; } - foreach (CNote note in singLine[CBase.Game.GetPlayers()[player].CurrentLine].Notes) + foreach (CNote note in singLines[CBase.Game.GetPlayers()[player].CurrentLine].Notes) { if (note.StartBeat >= line.FirstNoteBeat && note.EndBeat <= line.LastNoteBeat) { @@ -456,7 +456,7 @@ namespace VocaluxeLib.Menu.SingNotes LoadTextures(); } - private int _FindPlayerLine(int id) + private int _FindPlayerNotes(int id) { for (int i = 0; i < _PlayerNotes.Count; i++) { diff --git a/VocaluxeLib/Menu/SongMenu/CSong.cs b/VocaluxeLib/Menu/SongMenu/CSong.cs index c30535c5..126a53c7 100644 --- a/VocaluxeLib/Menu/SongMenu/CSong.cs +++ b/VocaluxeLib/Menu/SongMenu/CSong.cs @@ -209,7 +209,7 @@ namespace VocaluxeLib.Menu.SongMenu private readonly bool _Selected; public bool IsDuet { - get { return Notes.Lines.Length > 1; } + get { return Notes.Voices.Length > 1; } } public readonly List Edition = new List(); @@ -769,8 +769,8 @@ namespace VocaluxeLib.Menu.SongMenu fileLineNo++; } while (!sr.EndOfStream && (tempC != 'E')); - foreach (CLines lines in Notes.Lines) - lines.UpdateTimings(); + foreach (CVoice voice in Notes.Voices) + voice.UpdateTimings(); } catch (Exception e) { @@ -799,15 +799,15 @@ namespace VocaluxeLib.Menu.SongMenu private bool _ParseNote(int player, ENoteType noteType, int start, int length, int tone, string text) { CNote note = new CNote(start, length, tone, text, noteType); - CLines lines = Notes.GetLines(player); - return lines.AddNote(note); + CVoice voice = Notes.GetVoice(player); + return voice.AddNote(note); } private void _NewSentence(int player, int start) { - CLines lines = Notes.GetLines(player); + CVoice voice = Notes.GetVoice(player); CLine line = new CLine {StartBeat = start}; - lines.AddLine(line); + voice.AddLine(line); } public void LoadSmallCover() @@ -875,29 +875,29 @@ namespace VocaluxeLib.Menu.SongMenu private List _GetSeries() { - CLines lines = Notes.GetLines(0); + CVoice voice = Notes.GetVoice(0); - if (lines.LineCount == 0) + if (voice.NumLines == 0) return null; // build sentences list List sentences = new List(); - foreach (CLine line in lines.Line) + foreach (CLine line in voice.Lines) sentences.Add(line.Points != 0 ? line.Lyrics : String.Empty); // find equal sentences series List series = new List(); - for (int i = 0; i < lines.LineCount - 1; i++) + for (int i = 0; i < voice.NumLines - 1; i++) { - for (int j = i + 1; j < lines.LineCount; j++) + for (int j = i + 1; j < voice.NumLines; j++) { if (sentences[i] != sentences[j] || sentences[i] == "") continue; SSeries tempSeries = new SSeries {Start = i, End = i}; int max; - if (j + j - i > lines.LineCount) - max = lines.LineCount - 1 - j; + if (j + j - i > voice.NumLines) + max = voice.NumLines - 1 - j; else max = j - i - 1; @@ -942,13 +942,13 @@ namespace VocaluxeLib.Menu.SongMenu longest = i; } - CLines lines = Notes.GetLines(0); + CVoice voice = Notes.GetVoice(0); // set medley vars if (series.Count > 0 && series[longest].Length > CBase.Settings.GetMedleyMinSeriesLength()) { - Medley.StartBeat = lines.Line[series[longest].Start].FirstNoteBeat; - Medley.EndBeat = lines.Line[series[longest].End].LastNoteBeat; + Medley.StartBeat = voice.Lines[series[longest].Start].FirstNoteBeat; + Medley.EndBeat = voice.Lines[series[longest].End].LastNoteBeat; bool foundEnd = CBase.Game.GetTimeFromBeats(Medley.StartBeat, BPM) + CBase.Settings.GetMedleyMinDuration() > CBase.Game.GetTimeFromBeats(Medley.EndBeat, BPM); @@ -957,13 +957,13 @@ namespace VocaluxeLib.Menu.SongMenu if (!foundEnd) { - for (int i = series[longest].Start + 1; i < lines.LineCount - 1; i++) + for (int i = series[longest].Start + 1; i < voice.NumLines - 1; i++) { if (CBase.Game.GetTimeFromBeats(Medley.StartBeat, BPM) + CBase.Settings.GetMedleyMinDuration() > - CBase.Game.GetTimeFromBeats(lines.Line[i].LastNoteBeat, BPM)) + CBase.Game.GetTimeFromBeats(voice.Lines[i].LastNoteBeat, BPM)) { foundEnd = true; - Medley.EndBeat = lines.Line[i].LastNoteBeat; + Medley.EndBeat = voice.Lines[i].LastNoteBeat; } } } @@ -989,32 +989,32 @@ namespace VocaluxeLib.Menu.SongMenu if (series == null) return; - CLines lines = Notes.GetLines(0); + CVoice voice = Notes.GetVoice(0); //Calculate length of singing - int stop = (lines.Line[lines.Line.Length - 1].LastNoteBeat - lines.Line[0].FirstNote.StartBeat) / 2 + lines.Line[0].FirstNote.StartBeat; + int stop = (voice.Lines[voice.Lines.Length - 1].LastNoteBeat - voice.Lines[0].FirstNote.StartBeat) / 2 + voice.Lines[0].FirstNote.StartBeat; //Check if stop is in series for (int i = 0; i < series.Count; i++) { - if (lines.Line[series[i].Start].FirstNoteBeat < stop && lines.Line[series[i].End].LastNoteBeat > stop) + if (voice.Lines[series[i].Start].FirstNoteBeat < stop && voice.Lines[series[i].End].LastNoteBeat > stop) { - if (stop < (lines.Line[series[i].Start].FirstNoteBeat + ((lines.Line[series[i].End].LastNoteBeat - lines.Line[series[i].Start].FirstNoteBeat) / 2))) + if (stop < (voice.Lines[series[i].Start].FirstNoteBeat + ((voice.Lines[series[i].End].LastNoteBeat - voice.Lines[series[i].Start].FirstNoteBeat) / 2))) { - ShortEnd = lines.Line[series[i].Start - 1].LastNote.EndBeat; + ShortEnd = voice.Lines[series[i].Start - 1].LastNote.EndBeat; return; } - ShortEnd = lines.Line[series[i].End].LastNote.EndBeat; + ShortEnd = voice.Lines[series[i].End].LastNote.EndBeat; return; } } //Check if stop is in line - for (int i = 0; i < lines.Line.Length; i++) + foreach (CLine line in voice.Lines) { - if (lines.Line[i].FirstNoteBeat < stop && lines.Line[i].LastNoteBeat > stop) + if (line.FirstNoteBeat < stop && line.LastNoteBeat > stop) { - ShortEnd = lines.Line[i].LastNoteBeat; + ShortEnd = line.LastNoteBeat; return; } }