diff --git a/Output/PartyModes/Challenge/Themes/Default/Screens/PartyScreenChallengeConfig.xml b/Output/PartyModes/Challenge/Themes/Default/Screens/PartyScreenChallengeConfig.xml index da365e48..5dfbf453 100644 --- a/Output/PartyModes/Challenge/Themes/Default/Screens/PartyScreenChallengeConfig.xml +++ b/Output/PartyModes/Challenge/Themes/Default/Screens/PartyScreenChallengeConfig.xml @@ -194,7 +194,7 @@ 27 - 0 + 50 0 205.33 Outline @@ -236,7 +236,7 @@ 27 - 0 + 50 0 205.33 Outline @@ -278,7 +278,7 @@ 27 - 0 + 50 0 205.33 Outline diff --git a/Output/PartyModes/Challenge/Themes/Default/Screens/PartyScreenChallengeNames.xml b/Output/PartyModes/Challenge/Themes/Default/Screens/PartyScreenChallengeNames.xml index a3bd1919..5980e6d3 100644 --- a/Output/PartyModes/Challenge/Themes/Default/Screens/PartyScreenChallengeNames.xml +++ b/Output/PartyModes/Challenge/Themes/Default/Screens/PartyScreenChallengeNames.xml @@ -295,7 +295,7 @@ 27 - 0 + 50 0 205.33 Outline @@ -337,8 +337,8 @@ 27 - 0 - -5 + 50 + 5 205.33 Outline Bold diff --git a/Output/PartyModes/ChallengeMedley/Themes/Default/Screens/PartyScreenChallengeMedleyConfig.xml b/Output/PartyModes/ChallengeMedley/Themes/Default/Screens/PartyScreenChallengeMedleyConfig.xml index 02620808..dbc62be5 100644 --- a/Output/PartyModes/ChallengeMedley/Themes/Default/Screens/PartyScreenChallengeMedleyConfig.xml +++ b/Output/PartyModes/ChallengeMedley/Themes/Default/Screens/PartyScreenChallengeMedleyConfig.xml @@ -194,7 +194,7 @@ 27 - 0 + 50 0 205.33 Outline @@ -236,7 +236,7 @@ 27 - 0 + 50 0 205.33 Outline @@ -278,7 +278,7 @@ 27 - 0 + 50 0 205.33 Outline diff --git a/Output/PartyModes/ChallengeMedley/Themes/Default/Screens/PartyScreenChallengeMedleyNames.xml b/Output/PartyModes/ChallengeMedley/Themes/Default/Screens/PartyScreenChallengeMedleyNames.xml index 72512c94..2292a076 100644 --- a/Output/PartyModes/ChallengeMedley/Themes/Default/Screens/PartyScreenChallengeMedleyNames.xml +++ b/Output/PartyModes/ChallengeMedley/Themes/Default/Screens/PartyScreenChallengeMedleyNames.xml @@ -295,7 +295,7 @@ 27 - 0 + 50 0 205.33 Outline @@ -337,8 +337,8 @@ 27 - 0 - -5 + 50 + 5 205.33 Outline Bold diff --git a/Output/PartyModes/TicTacToe/Themes/Default/Screens/PartyScreenTicTacToeConfig.xml b/Output/PartyModes/TicTacToe/Themes/Default/Screens/PartyScreenTicTacToeConfig.xml index 1d02431f..bf570d8d 100644 --- a/Output/PartyModes/TicTacToe/Themes/Default/Screens/PartyScreenTicTacToeConfig.xml +++ b/Output/PartyModes/TicTacToe/Themes/Default/Screens/PartyScreenTicTacToeConfig.xml @@ -194,7 +194,7 @@ 27 - 0 + 50 0 205.33 Outline @@ -236,7 +236,7 @@ 27 - 0 + 50 0 205.33 Outline @@ -278,7 +278,7 @@ 27 - 0 + 50 0 205.33 Outline @@ -320,7 +320,7 @@ 27 - 0 + 50 0 205.33 Outline @@ -362,7 +362,7 @@ 27 - 0 + 50 0 205.33 Outline diff --git a/Output/PartyModes/TicTacToe/Themes/Default/Screens/PartyScreenTicTacToeNames.xml b/Output/PartyModes/TicTacToe/Themes/Default/Screens/PartyScreenTicTacToeNames.xml index df5bc5db..583ea0bc 100644 --- a/Output/PartyModes/TicTacToe/Themes/Default/Screens/PartyScreenTicTacToeNames.xml +++ b/Output/PartyModes/TicTacToe/Themes/Default/Screens/PartyScreenTicTacToeNames.xml @@ -295,7 +295,7 @@ 27 - 0 + 50 0 205.33 Outline @@ -337,8 +337,8 @@ 27 - 0 - -5 + 50 + 5 205.33 Outline Bold diff --git a/Output/Themes/Ambient/Screens/PopupScreenVolumeControl.xml b/Output/Themes/Ambient/Screens/PopupScreenVolumeControl.xml index 1bb2bfdd..1ec17015 100644 --- a/Output/Themes/Ambient/Screens/PopupScreenVolumeControl.xml +++ b/Output/Themes/Ambient/Screens/PopupScreenVolumeControl.xml @@ -46,22 +46,22 @@ Minus Plus - 1090 + 1070 680 200 - 50 + 30 -2 1195 - 682 + 680 30 30 -2 - 1240 - 682 + 1235 + 680 30 30 -2 @@ -73,9 +73,9 @@ 27 - -15 - -8 - 500 + 0 + 0 + 25 Outline Bold 1 diff --git a/Output/Themes/Ambient/Screens/ScreenNames.xml b/Output/Themes/Ambient/Screens/ScreenNames.xml index fe44cdc6..24cac2dd 100644 --- a/Output/Themes/Ambient/Screens/ScreenNames.xml +++ b/Output/Themes/Ambient/Screens/ScreenNames.xml @@ -418,7 +418,7 @@ 27 - 0 + 50 0 186 Outline @@ -460,7 +460,7 @@ 20 - 0 + 50 0 86 Outline @@ -502,7 +502,7 @@ 20 - 0 + 50 0 86 Outline @@ -544,7 +544,7 @@ 20 - 0 + 50 0 86 Outline @@ -586,7 +586,7 @@ 20 - 0 + 50 0 86 Outline @@ -628,7 +628,7 @@ 20 - 0 + 50 0 86 Outline @@ -670,7 +670,7 @@ 20 - 0 + 50 0 86 Outline diff --git a/Output/Themes/Ambient/Screens/ScreenOptionsGame.xml b/Output/Themes/Ambient/Screens/ScreenOptionsGame.xml index cd75ed75..5b3b6ec4 100644 --- a/Output/Themes/Ambient/Screens/ScreenOptionsGame.xml +++ b/Output/Themes/Ambient/Screens/ScreenOptionsGame.xml @@ -302,7 +302,7 @@ 27 - 0 + 50 0 205.33 Outline @@ -344,7 +344,7 @@ 27 - 0 + 50 0 205.33 Outline @@ -386,7 +386,7 @@ 27 - 0 + 50 0 205.33 Outline @@ -428,7 +428,7 @@ 27 - 0 + 50 0 205.33 Outline @@ -470,7 +470,7 @@ 27 - 0 + 50 0 308 Outline @@ -512,7 +512,7 @@ 27 - 0 + 50 0 205.33 Outline diff --git a/Output/Themes/Ambient/Screens/ScreenOptionsLyrics.xml b/Output/Themes/Ambient/Screens/ScreenOptionsLyrics.xml index 4ad2bbf6..ea8f4344 100644 --- a/Output/Themes/Ambient/Screens/ScreenOptionsLyrics.xml +++ b/Output/Themes/Ambient/Screens/ScreenOptionsLyrics.xml @@ -145,7 +145,7 @@ 27 - 0 + 50 0 205.33 Outline @@ -187,7 +187,7 @@ 27 - 0 + 50 0 205.33 Outline diff --git a/Output/Themes/Ambient/Screens/ScreenOptionsRecord.xml b/Output/Themes/Ambient/Screens/ScreenOptionsRecord.xml index f5696725..95b8464d 100644 --- a/Output/Themes/Ambient/Screens/ScreenOptionsRecord.xml +++ b/Output/Themes/Ambient/Screens/ScreenOptionsRecord.xml @@ -338,7 +338,7 @@ 27 - 0 + 50 0 616 Outline @@ -380,7 +380,7 @@ 27 - 0 + 50 0 154 Outline @@ -422,7 +422,7 @@ 27 - 0 + 50 0 154 Outline @@ -464,7 +464,7 @@ 27 - 0 + 50 0 123.2 Outline diff --git a/Output/Themes/Ambient/Screens/ScreenOptionsSound.xml b/Output/Themes/Ambient/Screens/ScreenOptionsSound.xml index ae35c3bc..9b7e88c6 100644 --- a/Output/Themes/Ambient/Screens/ScreenOptionsSound.xml +++ b/Output/Themes/Ambient/Screens/ScreenOptionsSound.xml @@ -187,7 +187,7 @@ 27 - 0 + 50 0 205.33 Outline @@ -229,7 +229,7 @@ 27 - 0 + 50 0 205.33 Outline @@ -271,7 +271,7 @@ 27 - 0 + 50 0 500 Outline @@ -313,7 +313,7 @@ 27 - 0 + 50 0 500 Outline @@ -355,7 +355,7 @@ 27 - 0 + 50 0 500 Outline diff --git a/Output/Themes/Ambient/Screens/ScreenOptionsTheme.xml b/Output/Themes/Ambient/Screens/ScreenOptionsTheme.xml index 3f0e890c..61ed39bb 100644 --- a/Output/Themes/Ambient/Screens/ScreenOptionsTheme.xml +++ b/Output/Themes/Ambient/Screens/ScreenOptionsTheme.xml @@ -317,7 +317,7 @@ 27 - 0 + 50 0 616 Outline @@ -359,7 +359,7 @@ 27 - 0 + 50 0 616 Outline @@ -401,7 +401,7 @@ 27 - 0 + 50 0 308 Outline @@ -443,7 +443,7 @@ 27 - 0 + 50 0 308 Outline @@ -485,7 +485,7 @@ 27 - 0 + 50 0 308 Outline @@ -527,7 +527,7 @@ 27 - 0 + 50 0 308 Outline @@ -569,7 +569,7 @@ 27 - 0 + 50 0 616 Outline @@ -611,7 +611,7 @@ 27 - 0 + 50 0 616 Outline diff --git a/Output/Themes/Ambient/Screens/ScreenOptionsVideo.xml b/Output/Themes/Ambient/Screens/ScreenOptionsVideo.xml index b5740cc5..06a05c7b 100644 --- a/Output/Themes/Ambient/Screens/ScreenOptionsVideo.xml +++ b/Output/Themes/Ambient/Screens/ScreenOptionsVideo.xml @@ -280,7 +280,7 @@ 27 - 0 + 50 0 205.33 Outline @@ -322,7 +322,7 @@ 27 - 0 + 50 0 205.33 Outline @@ -364,7 +364,7 @@ 27 - 0 + 50 0 205.33 Outline @@ -406,7 +406,7 @@ 27 - 0 + 50 0 205.33 Outline @@ -448,7 +448,7 @@ 27 - 0 + 50 0 205.33 Outline @@ -490,7 +490,7 @@ 27 - 0 + 50 0 150 Outline diff --git a/Output/Themes/Ambient/Screens/ScreenParty.xml b/Output/Themes/Ambient/Screens/ScreenParty.xml index de8283d4..3dec51bd 100644 --- a/Output/Themes/Ambient/Screens/ScreenParty.xml +++ b/Output/Themes/Ambient/Screens/ScreenParty.xml @@ -348,7 +348,7 @@ 27 - 0 + 50 0 600 Outline diff --git a/Output/Themes/Ambient/Screens/ScreenProfiles.xml b/Output/Themes/Ambient/Screens/ScreenProfiles.xml index ca84426b..c612e90e 100644 --- a/Output/Themes/Ambient/Screens/ScreenProfiles.xml +++ b/Output/Themes/Ambient/Screens/ScreenProfiles.xml @@ -509,7 +509,7 @@ 27 - 0 + 50 0 219.2 Outline @@ -551,7 +551,7 @@ 27 - 0 + 50 0 208.67 Outline @@ -593,7 +593,7 @@ 27 - 0 + 50 0 208.67 Outline @@ -635,7 +635,7 @@ 27 - 0 + 50 0 313 Outline @@ -677,7 +677,7 @@ 27 - 0 + 50 0 313 Outline diff --git a/Output/Themes/Ambient/Screens/ScreenSong.xml b/Output/Themes/Ambient/Screens/ScreenSong.xml index d9f45cd2..559c0d2d 100644 --- a/Output/Themes/Ambient/Screens/ScreenSong.xml +++ b/Output/Themes/Ambient/Screens/ScreenSong.xml @@ -899,7 +899,7 @@ 25 - 0 + 50 0 280 Outline @@ -941,7 +941,7 @@ 25 - 0 + 50 0 280 Outline @@ -983,7 +983,7 @@ 25 - 0 + 50 0 280 Outline @@ -1025,7 +1025,7 @@ 25 - 0 + 50 0 280 Outline diff --git a/PartyModes/PartyModeChallenge/CChallengeRounds.cs b/PartyModes/PartyModeChallenge/CChallengeRounds.cs index 6b45ea1f..7627c636 100644 --- a/PartyModes/PartyModeChallenge/CChallengeRounds.cs +++ b/PartyModes/PartyModeChallenge/CChallengeRounds.cs @@ -83,12 +83,12 @@ namespace VocaluxeLib.PartyModes.Challenge int max = numPlayed.Max(); - int num = Rounds[0].Player.Count; + int playersPerRound = Rounds[0].Player.Count; List result = new List(); List other = new List(); List last = new List(); - for (int i = 0; i < numPlayed.Count; i++) + for (int i = 0; i < _NumPlayer; i++) { if (roundIndex == 0 || numPlayed[i] < max) { @@ -111,7 +111,7 @@ namespace VocaluxeLib.PartyModes.Challenge } } - while (result.Count < num && other.Count > 0) + while (result.Count < playersPerRound && other.Count > 0) { int n = other.Count; int r = _Rand.Next(n); @@ -119,7 +119,7 @@ namespace VocaluxeLib.PartyModes.Challenge other.RemoveAt(r); } - while (result.Count < num) + while (result.Count < playersPerRound) { int n = last.Count; int r = _Rand.Next(n); @@ -127,7 +127,7 @@ namespace VocaluxeLib.PartyModes.Challenge last.RemoveAt(r); } - while (result.Count > num) + while (result.Count > playersPerRound) { int n = result.Count; int r = _Rand.Next(n); diff --git a/PartyModes/PartyModeChallenge/CPartyScreenChallengeConfig.cs b/PartyModes/PartyModeChallenge/CPartyScreenChallengeConfig.cs index e1ef8456..b9095b50 100644 --- a/PartyModes/PartyModeChallenge/CPartyScreenChallengeConfig.cs +++ b/PartyModes/PartyModeChallenge/CPartyScreenChallengeConfig.cs @@ -127,7 +127,7 @@ namespace VocaluxeLib.PartyModes.Challenge _SelectSlides[_SelectSlideNumPlayers].Clear(); for (int i = _PartyMode.GetMinPlayer(); i <= _PartyMode.GetMaxPlayer(); i++) _SelectSlides[_SelectSlideNumPlayers].AddValue(i.ToString()); - _SelectSlides[_SelectSlideNumPlayers].Selection = _PartyMode.GameData.NumPlayer - _PartyMode.GetMinPlayer(); + _SelectSlides[_SelectSlideNumPlayers].SelectedValue = _PartyMode.GameData.NumPlayer.ToString(); _UpdateMicsAtOnce(); _SetRoundSteps(); diff --git a/Vocaluxe/Screens/CScreenOptionsGame.cs b/Vocaluxe/Screens/CScreenOptionsGame.cs index ce71f532..71794199 100644 --- a/Vocaluxe/Screens/CScreenOptionsGame.cs +++ b/Vocaluxe/Screens/CScreenOptionsGame.cs @@ -134,7 +134,7 @@ namespace Vocaluxe.Screens private void _SaveConfig() { CLanguage.LanguageId = _SelectSlides[_SelectSlideLanguage].Selection; - CConfig.Config.Game.Language = _SelectSlides[_SelectSlideLanguage].Value; + CConfig.Config.Game.Language = _SelectSlides[_SelectSlideLanguage].SelectedValue; CConfig.Config.Debug.DebugLevel = (EDebugLevel)_SelectSlides[_SelectSlideDebugLevel].Selection; CConfig.Config.Game.SongMenu = (ESongMenu)_SelectSlides[_SelectSlideSongMenu].Selection; CConfig.Config.Game.SongSorting = (ESongSorting)_SelectSlides[_SelectSlideSongSorting].Selection; diff --git a/Vocaluxe/Screens/CScreenOptionsTheme.cs b/Vocaluxe/Screens/CScreenOptionsTheme.cs index e21f5087..6723a305 100644 --- a/Vocaluxe/Screens/CScreenOptionsTheme.cs +++ b/Vocaluxe/Screens/CScreenOptionsTheme.cs @@ -171,15 +171,15 @@ namespace Vocaluxe.Screens CConfig.SaveConfig(); - if (_OldCoverTheme != _SelectSlides[_SelectSlideCover].Value) + if (_OldCoverTheme != _SelectSlides[_SelectSlideCover].SelectedValue) CCover.ReloadCovers(); } private void _OnChange() { - if (CConfig.Config.Theme.Theme != _SelectSlides[_SelectSlideTheme].Value) + if (CConfig.Config.Theme.Theme != _SelectSlides[_SelectSlideTheme].SelectedValue) { - CConfig.Config.Theme.Theme = _SelectSlides[_SelectSlideTheme].Value; + CConfig.Config.Theme.Theme = _SelectSlides[_SelectSlideTheme].SelectedValue; CThemes.Reload(); CGraphics.ReloadTheme(); @@ -188,9 +188,9 @@ namespace Vocaluxe.Screens return; } - if (CConfig.Config.Theme.Skin != _SelectSlides[_SelectSlideSkin].Value) + if (CConfig.Config.Theme.Skin != _SelectSlides[_SelectSlideSkin].SelectedValue) { - CConfig.Config.Theme.Skin = _SelectSlides[_SelectSlideSkin].Value; + CConfig.Config.Theme.Skin = _SelectSlides[_SelectSlideSkin].SelectedValue; CThemes.ReloadSkin(); CGraphics.ReloadSkin(); diff --git a/Vocaluxe/Screens/CScreenProfiles.cs b/Vocaluxe/Screens/CScreenProfiles.cs index 383ff57b..44196e34 100644 --- a/Vocaluxe/Screens/CScreenProfiles.cs +++ b/Vocaluxe/Screens/CScreenProfiles.cs @@ -109,7 +109,7 @@ namespace Vocaluxe.Screens break; case EEditMode.PlayerName: _SelectSlides[_SelectSlideProfiles].RenameValue( - CProfiles.AddGetPlayerName(_SelectSlides[_SelectSlideProfiles].ValueIndex, keyEvent.Unicode)); + CProfiles.AddGetPlayerName(_SelectSlides[_SelectSlideProfiles].SelectedTag, keyEvent.Unicode)); _ProfilesChanged = true; break; } @@ -155,7 +155,7 @@ namespace Vocaluxe.Screens if (_EditMode == EEditMode.PlayerName) { _SelectSlides[_SelectSlideProfiles].RenameValue( - CProfiles.GetDeleteCharInPlayerName(_SelectSlides[_SelectSlideProfiles].ValueIndex)); + CProfiles.GetDeleteCharInPlayerName(_SelectSlides[_SelectSlideProfiles].SelectedTag)); _ProfilesChanged = true; } else @@ -168,22 +168,22 @@ namespace Vocaluxe.Screens } if (_SelectSlides[_SelectSlideDifficulty].Selected) { - CProfiles.SetDifficulty(_SelectSlides[_SelectSlideProfiles].ValueIndex, + CProfiles.SetDifficulty(_SelectSlides[_SelectSlideProfiles].SelectedTag, (EGameDifficulty)_SelectSlides[_SelectSlideDifficulty].Selection); } else if (_SelectSlides[_SelectSlideAvatars].Selected) { - CProfiles.SetAvatar(_SelectSlides[_SelectSlideProfiles].ValueIndex, - _SelectSlides[_SelectSlideAvatars].ValueIndex); + CProfiles.SetAvatar(_SelectSlides[_SelectSlideProfiles].SelectedTag, + _SelectSlides[_SelectSlideAvatars].SelectedTag); } else if (_SelectSlides[_SelectSlideUserRole].Selected) { - CProfiles.SetUserRoleProfile(_SelectSlides[_SelectSlideProfiles].ValueIndex, + CProfiles.SetUserRoleProfile(_SelectSlides[_SelectSlideProfiles].SelectedTag, (EUserRole)_SelectSlides[_SelectSlideUserRole].Selection); } else if (_SelectSlides[_SelectSlideActive].Selected) { - CProfiles.SetActive(_SelectSlides[_SelectSlideProfiles].ValueIndex, + CProfiles.SetActive(_SelectSlides[_SelectSlideProfiles].SelectedTag, (EOffOn)_SelectSlides[_SelectSlideActive].Selection); } } @@ -215,24 +215,24 @@ namespace Vocaluxe.Screens } else if (_SelectSlides[_SelectSlideDifficulty].Selected) { - CProfiles.SetDifficulty(_SelectSlides[_SelectSlideProfiles].ValueIndex, + CProfiles.SetDifficulty(_SelectSlides[_SelectSlideProfiles].SelectedTag, (EGameDifficulty)_SelectSlides[_SelectSlideDifficulty].Selection); } else if (_SelectSlides[_SelectSlideAvatars].Selected) { - CProfiles.SetAvatar(_SelectSlides[_SelectSlideProfiles].ValueIndex, - _SelectSlides[_SelectSlideAvatars].ValueIndex); + CProfiles.SetAvatar(_SelectSlides[_SelectSlideProfiles].SelectedTag, + _SelectSlides[_SelectSlideAvatars].SelectedTag); if (CWebcam.IsDeviceAvailable() && _WebcamTexture != null) _OnDiscardSnapshot(); } else if (_SelectSlides[_SelectSlideUserRole].Selected) { - CProfiles.SetUserRoleProfile(_SelectSlides[_SelectSlideProfiles].ValueIndex, + CProfiles.SetUserRoleProfile(_SelectSlides[_SelectSlideProfiles].SelectedTag, (EUserRole)_SelectSlides[_SelectSlideUserRole].Selection); } else if (_SelectSlides[_SelectSlideActive].Selected) { - CProfiles.SetActive(_SelectSlides[_SelectSlideProfiles].ValueIndex, + CProfiles.SetActive(_SelectSlides[_SelectSlideProfiles].SelectedTag, (EOffOn)_SelectSlides[_SelectSlideActive].Selection); } else if (_Buttons[_ButtonWebcam].Selected) @@ -260,16 +260,16 @@ namespace Vocaluxe.Screens if (_SelectSlides[_SelectSlideProfiles].Selection > -1) { - _Buttons[_ButtonPlayerName].Text.Text = CProfiles.GetPlayerName(_SelectSlides[_SelectSlideProfiles].ValueIndex); + _Buttons[_ButtonPlayerName].Text.Text = CProfiles.GetPlayerName(_SelectSlides[_SelectSlideProfiles].SelectedTag); if (_EditMode == EEditMode.PlayerName) _Buttons[_ButtonPlayerName].Text.Text += "|"; - _SelectSlides[_SelectSlideDifficulty].Selection = (int)CProfiles.GetDifficulty(_SelectSlides[_SelectSlideProfiles].ValueIndex); - _SelectSlides[_SelectSlideUserRole].Selection = (int)CProfiles.GetUserRoleProfile(_SelectSlides[_SelectSlideProfiles].ValueIndex); - _SelectSlides[_SelectSlideActive].Selection = (int)CProfiles.GetActive(_SelectSlides[_SelectSlideProfiles].ValueIndex); + _SelectSlides[_SelectSlideDifficulty].Selection = (int)CProfiles.GetDifficulty(_SelectSlides[_SelectSlideProfiles].SelectedTag); + _SelectSlides[_SelectSlideUserRole].Selection = (int)CProfiles.GetUserRoleProfile(_SelectSlides[_SelectSlideProfiles].SelectedTag); + _SelectSlides[_SelectSlideActive].Selection = (int)CProfiles.GetActive(_SelectSlides[_SelectSlideProfiles].SelectedTag); - int avatarID = CProfiles.GetAvatarID(_SelectSlides[_SelectSlideProfiles].ValueIndex); - _SelectSlides[_SelectSlideAvatars].SetSelectionByValueIndex(avatarID); + int avatarID = CProfiles.GetAvatarID(_SelectSlides[_SelectSlideProfiles].SelectedTag); + _SelectSlides[_SelectSlideAvatars].SelectedTag = avatarID; if (_Snapshot == null) { if (CWebcam.IsCapturing()) @@ -357,7 +357,7 @@ namespace Vocaluxe.Screens _Buttons[_ButtonWebcam].Visible = CWebcam.IsDeviceAvailable(); int id = CProfiles.NewAvatar(file); - CProfiles.SetAvatar(_SelectSlides[_SelectSlideProfiles].ValueIndex, id); + CProfiles.SetAvatar(_SelectSlides[_SelectSlideProfiles].SelectedTag, id); _LoadAvatars(false); } @@ -381,10 +381,9 @@ namespace Vocaluxe.Screens _EditMode = EEditMode.None; int id = CProfiles.NewProfile(); _LoadProfiles(false); - _SelectSlides[_SelectSlideProfiles].SetSelectionByValueIndex(id); + _SelectSlides[_SelectSlideProfiles].SelectedTag = id; - CProfiles.SetAvatar(_SelectSlides[_SelectSlideProfiles].ValueIndex, - _SelectSlides[_SelectSlideAvatars].ValueIndex); + CProfiles.SetAvatar(_SelectSlides[_SelectSlideProfiles].SelectedTag, _SelectSlides[_SelectSlideAvatars].SelectedTag); _SelectElement(_Buttons[_ButtonPlayerName]); _EditMode = EEditMode.PlayerName; @@ -400,7 +399,7 @@ namespace Vocaluxe.Screens { _EditMode = EEditMode.None; - CProfiles.DeleteProfile(_SelectSlides[_SelectSlideProfiles].ValueIndex); + CProfiles.DeleteProfile(_SelectSlides[_SelectSlideProfiles].SelectedTag); int selection = _SelectSlides[_SelectSlideProfiles].Selection; if (_SelectSlides[_SelectSlideProfiles].NumValues - 1 > selection) @@ -413,29 +412,23 @@ namespace Vocaluxe.Screens { string name = String.Empty; if (_EditMode == EEditMode.PlayerName) - name = CProfiles.GetPlayerName(_SelectSlides[_SelectSlideProfiles].ValueIndex); + name = CProfiles.GetPlayerName(_SelectSlides[_SelectSlideProfiles].SelectedTag); - int selectedProfileID = _SelectSlides[_SelectSlideProfiles].ValueIndex; + int selectedProfileID = _SelectSlides[_SelectSlideProfiles].SelectedTag; _SelectSlides[_SelectSlideProfiles].Clear(); CProfile[] profiles = CProfiles.GetProfiles(); foreach (CProfile profile in profiles) - { - _SelectSlides[_SelectSlideProfiles].AddValue( - profile.PlayerName, - null, - profile.ID, - -1); - } + _SelectSlides[_SelectSlideProfiles].AddValue(profile.PlayerName, null, profile.ID); if (CProfiles.NumProfiles > 0 && CProfiles.NumAvatars > 0) { if (selectedProfileID != -1) - _SelectSlides[_SelectSlideProfiles].SetSelectionByValueIndex(selectedProfileID); + _SelectSlides[_SelectSlideProfiles].SelectedTag = selectedProfileID; else { _SelectSlides[_SelectSlideProfiles].Selection = 0; - selectedProfileID = _SelectSlides[_SelectSlideProfiles].ValueIndex; + selectedProfileID = _SelectSlides[_SelectSlideProfiles].SelectedTag; } if (!keep) @@ -443,39 +436,33 @@ namespace Vocaluxe.Screens _SelectSlides[_SelectSlideDifficulty].Selection = (int)CProfiles.GetDifficulty(selectedProfileID); _SelectSlides[_SelectSlideUserRole].Selection = (int)CProfiles.GetUserRoleProfile(selectedProfileID); _SelectSlides[_SelectSlideActive].Selection = (int)CProfiles.GetActive(selectedProfileID); - _SelectSlides[_SelectSlideAvatars].SetSelectionByValueIndex(CProfiles.GetAvatarID(selectedProfileID)); + _SelectSlides[_SelectSlideAvatars].SelectedTag = CProfiles.GetAvatarID(selectedProfileID); } if (_EditMode == EEditMode.PlayerName) - CProfiles.SetPlayerName(_SelectSlides[_SelectSlideProfiles].ValueIndex, name); + CProfiles.SetPlayerName(_SelectSlides[_SelectSlideProfiles].SelectedTag, name); } _ProfilesChanged = false; } private void _LoadAvatars(bool keep) { - int selectedAvatarID = _SelectSlides[_SelectSlideAvatars].ValueIndex; + int selectedAvatarID = _SelectSlides[_SelectSlideAvatars].SelectedTag; _SelectSlides[_SelectSlideAvatars].Clear(); IEnumerable avatars = CProfiles.GetAvatars(); if (avatars != null) { foreach (CAvatar avatar in avatars) - { - _SelectSlides[_SelectSlideAvatars].AddValue( - avatar.GetDisplayName(), - null, - avatar.ID, - -1); - } + _SelectSlides[_SelectSlideAvatars].AddValue(avatar.GetDisplayName(), null, avatar.ID); } if (keep) { - _SelectSlides[_SelectSlideAvatars].SetSelectionByValueIndex(selectedAvatarID); - CProfiles.SetAvatar(_SelectSlides[_SelectSlideProfiles].ValueIndex, selectedAvatarID); + _SelectSlides[_SelectSlideAvatars].SelectedTag = selectedAvatarID; + CProfiles.SetAvatar(_SelectSlides[_SelectSlideProfiles].SelectedTag, selectedAvatarID); } else - _SelectSlides[_SelectSlideAvatars].SetSelectionByValueIndex(CProfiles.GetAvatarID(_SelectSlides[_SelectSlideProfiles].ValueIndex)); + _SelectSlides[_SelectSlideAvatars].SelectedTag = CProfiles.GetAvatarID(_SelectSlides[_SelectSlideProfiles].SelectedTag); _AvatarsChanged = false; } diff --git a/Vocaluxe/Screens/CScreenSong.cs b/Vocaluxe/Screens/CScreenSong.cs index 75dea6b9..950551ee 100644 --- a/Vocaluxe/Screens/CScreenSong.cs +++ b/Vocaluxe/Screens/CScreenSong.cs @@ -522,12 +522,12 @@ namespace Vocaluxe.Screens _HandleSelectButton(); return true; } - else if (_SelectSlides[_SelectSlideOptionsPlaylistOpen].ValueSelected) + else if (_SelectSlides[_SelectSlideOptionsPlaylistOpen].IsValueSelected) { _OpenPlaylist(_SelectSlides[_SelectSlideOptionsPlaylistOpen].Selection); return true; } - else if (_SelectSlides[_SelectSlideOptionsPlaylistAdd].ValueSelected) + else if (_SelectSlides[_SelectSlideOptionsPlaylistAdd].IsValueSelected) { _OpenPlaylist(_SelectSlides[_SelectSlideOptionsPlaylistAdd].Selection - 1); return true; @@ -1171,7 +1171,7 @@ namespace Vocaluxe.Screens { if (CSongs.VisibleSongs[_SongMenu.GetPreviewSongNr()].IsGameModeAvailable(gameMode)) { - _SelectSlides[_SelectSlideOptionsMode].AddValue(Enum.GetName(typeof(EGameMode), gameMode)); + _SelectSlides[_SelectSlideOptionsMode].AddValue(Enum.GetName(typeof(EGameMode), gameMode), null, (int)gameMode); _AvailableGameModes.Add(gameMode); } } @@ -1189,11 +1189,7 @@ namespace Vocaluxe.Screens _CheckAndAddGameMode(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].SelectedTag = (int)lastMode; _SelectSlides[_SelectSlideOptionsMode].Visible = true; _SelectSlides[_SelectSlideOptionsPlaylistAdd].Visible = true; _Buttons[_ButtonOptionsSing].Visible = true; @@ -1242,9 +1238,9 @@ namespace Vocaluxe.Screens _SelectSlides[_SelectSlideOptionsNumMedleySongs].AddValue(i.ToString()); } if (_SelectSlides[_SelectSlideOptionsNumMedleySongs].NumValues >= 5) - _SelectSlides[_SelectSlideOptionsNumMedleySongs].SetSelectionByValueIndex(4); + _SelectSlides[_SelectSlideOptionsNumMedleySongs].SelectedValue = "5"; else - _SelectSlides[_SelectSlideOptionsNumMedleySongs].SetSelectionByValueIndex(_SelectSlides[_SelectSlideOptionsNumMedleySongs].NumValues - 1); + _SelectSlides[_SelectSlideOptionsNumMedleySongs].SelectLastValue(); _SelectElement(_Buttons[_ButtonOptionsStartMedley]); } diff --git a/VocaluxeLib/Menu/CMenuPartyNameSelection.cs b/VocaluxeLib/Menu/CMenuPartyNameSelection.cs index 6e3d1090..e5b4da12 100644 --- a/VocaluxeLib/Menu/CMenuPartyNameSelection.cs +++ b/VocaluxeLib/Menu/CMenuPartyNameSelection.cs @@ -29,8 +29,10 @@ namespace VocaluxeLib.Menu get { for (int team = 0; team < _NumTeams; team++) + { if (_TeamList[team].Count < _NumPlayerTeams[team]) return false; + } return true; } } @@ -350,7 +352,7 @@ namespace VocaluxeLib.Menu IncreaseTeamNum(); } if (numPressed <= _SelectSlides[_SelectSlideTeams].NumValues) - _SelectSlides[_SelectSlideTeams].SetSelectionByValueIndex(numPressed - 1); + _SelectSlides[_SelectSlideTeams].SelectedTag = numPressed; } } if (_SelectingFastPlayerNr > 0 && _SelectingFastPlayerNr <= _NumPlayerTeams[_CurrentTeam]) @@ -488,7 +490,7 @@ namespace VocaluxeLib.Menu else if (mouseEvent.RB) { bool exit = true; - if (_SelectSlides[_SelectSlidePlayer].Selected && _TeamList[_CurrentTeam].Count > 0) + if (_SelectSlides[_SelectSlidePlayer].Selected && _TeamList[_CurrentTeam].Count > _SelectSlides[_SelectSlidePlayer].Selection) { int currentSelection = _SelectSlides[_SelectSlidePlayer].Selection; int id = _TeamList[_CurrentTeam][currentSelection]; @@ -539,8 +541,8 @@ namespace VocaluxeLib.Menu public override void LoadTheme(string xmlPath) { base.LoadTheme(xmlPath); - _SelectSlides[_SelectSlidePlayer].WithTextures = true; - _SelectSlides[_SelectSlidePlayer].SelectionByHover = true; + _SelectSlides[_SelectSlidePlayer].DrawTextures = true; + _SelectSlides[_SelectSlidePlayer].SelectByHovering = true; _AddStatic(_ChooseAvatarStatic); } @@ -684,7 +686,7 @@ namespace VocaluxeLib.Menu _SelectSlides[_SelectSlidePlayer].AddValue("", _NameSelections[_NameSelection].TextureEmptyTile); if (selection >= _TeamList[_CurrentTeam].Count) selection = _TeamList[_CurrentTeam].Count - 1; - _SelectSlides[_SelectSlidePlayer].SetSelectionByValueIndex(selection); + _SelectSlides[_SelectSlidePlayer].Selection = selection; } private void _UpdateTeamSlide() @@ -692,7 +694,7 @@ namespace VocaluxeLib.Menu _SelectSlides[_SelectSlideTeams].Visible = _Teams; _SelectSlides[_SelectSlideTeams].Clear(); for (int i = 1; i <= _NumTeams; i++) - _SelectSlides[_SelectSlideTeams].AddValue("Team " + i); + _SelectSlides[_SelectSlideTeams].AddValue("Team " + i, null, i); } private void _UpdateButtonVisibility() diff --git a/VocaluxeLib/Menu/CPlaylist.cs b/VocaluxeLib/Menu/CPlaylist.cs index 1280c513..4a7b28eb 100644 --- a/VocaluxeLib/Menu/CPlaylist.cs +++ b/VocaluxeLib/Menu/CPlaylist.cs @@ -1145,12 +1145,9 @@ namespace VocaluxeLib.Menu string t1 = CBase.Language.Translate(_Text1.Text).Replace("%a", song.Artist).Replace("%t", song.Title); _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.Count; g++) - { - _PlaylistElements[i].SelectSlide.AddValue(Enum.GetName(typeof(EGameMode), pec.Modes[g])); - if (pec.Modes[g] == pec.Mode) - _PlaylistElements[i].SelectSlide.SetSelectionByValueIndex(g); - } + foreach (EGameMode gm in pec.Modes) + _PlaylistElements[i].SelectSlide.AddValue(Enum.GetName(typeof(EGameMode), gm), null, (int)gm); + _PlaylistElements[i].SelectSlide.SelectedTag = (int)pec.Mode; } else { diff --git a/VocaluxeLib/Menu/CSelectSlide.cs b/VocaluxeLib/Menu/CSelectSlide.cs index f5a876b0..9c381208 100644 --- a/VocaluxeLib/Menu/CSelectSlide.cs +++ b/VocaluxeLib/Menu/CSelectSlide.cs @@ -17,6 +17,7 @@ using System; using System.Collections.Generic; +using System.Diagnostics; using System.Drawing; using System.Xml.Serialization; using VocaluxeLib.Draw; @@ -61,8 +62,23 @@ namespace VocaluxeLib.Menu public int NumVisible; } - public sealed class CSelectSlide : CMenuElementBase, IMenuElement, ICloneable, IThemeable + public sealed class CSelectSlide : CMenuElementBase, IMenuElement, IThemeable { + private struct SValue + { + public string Text; + public int TranslationId; + public int Tag; + public CTextureRef Texture; + } + + private class CElement + { + public CText Text; + public CStatic Img; + public SRectF Bounds; + } + private readonly int _PartyModeID; private SThemeSelectSlide _Theme; @@ -138,52 +154,52 @@ namespace VocaluxeLib.Menu } } } - public bool ValueSelected + public bool IsValueSelected { get { return Selected && !_ArrowLeftSelected && !_ArrowRightSelected; } } - public bool SelectionByHover; - private bool _ArrowLeftSelected; private bool _ArrowRightSelected; - private readonly List _ValueNames; - private readonly List _ValuePartyModeIDs; - private readonly List _Textures; - private readonly List _ValueIndexes; - - private readonly List _ValueBounds = new List(); - - public bool WithTextures; + public bool SelectByHovering; + public bool DrawTextures; private int _Selection = -1; public int Selection { get { return _Selection; } - set { _Selection = value.Clamp(0, _ValueNames.Count - 1, false); } - } - - public string Value - { - get { return (_Selection >= 0 && _Selection < _ValueNames.Count) ? _ValueNames[_Selection] : null; } - } - - public int ValueIndex - { - get + set { - if (_Selection >= 0 && _ValueIndexes.Count > _Selection) - return _ValueIndexes[_Selection]; - return -1; + value = value.Clamp(0, _Values.Count - 1, false); + if (value == _Selection) + return; + _Selection = value; + _Invalidate(); } } + public string SelectedValue + { + get { return _Selection >= 0 ? _Values[_Selection].Text : null; } + set { Selection = _Values.FindIndex(val => val.Text == value); } + } + + public int SelectedTag + { + get { return _Selection >= 0 ? _Values[_Selection].Tag : -1; } + set { Selection = _Values.FindIndex(val => val.Tag == value); } + } + public int NumValues { - get { return _ValueNames.Count; } + get { return _Values.Count; } } + private readonly List _Values = new List(); + private readonly List _VisibleElements = new List(); + private bool _NeedsRevalidate = true; + private int _NumVisible = -1; private CTextureRef _Texture; private CTextureRef _TextureArrowLeft; @@ -197,10 +213,11 @@ namespace VocaluxeLib.Menu get { return _NumVisible; } set { - if (value > 0) - _NumVisible = value; + if (value <= 0 || value == _NumVisible) + return; + _NumVisible = value; - _ValueBounds.Clear(); + _Invalidate(); } } @@ -210,11 +227,6 @@ namespace VocaluxeLib.Menu ThemeLoaded = false; _TextH = 1f; _MaxW = 0f; - - _Textures = new List(); - _ValueIndexes = new List(); - _ValueNames = new List(); - _ValuePartyModeIDs = new List(); } public CSelectSlide(CSelectSlide slide) @@ -241,15 +253,11 @@ namespace VocaluxeLib.Menu _TextRelativeY = slide._TextRelativeY; _MaxW = slide._MaxW; - _Textures = new List(slide._Textures); - _ValueIndexes = new List(slide._ValueIndexes); - _ValueNames = new List(slide._ValueNames); - _ValueBounds = new List(slide._ValueBounds); - _ValuePartyModeIDs = new List(slide._ValuePartyModeIDs); + _Values.AddRange(slide._Values); _Selection = slide._Selection; _NumVisible = slide._NumVisible; - WithTextures = slide.WithTextures; + DrawTextures = slide.DrawTextures; Visible = slide.Visible; } @@ -258,11 +266,6 @@ namespace VocaluxeLib.Menu _PartyModeID = partyModeID; _Theme = theme; - _Textures = new List(); - _ValueIndexes = new List(); - _ValueNames = new List(); - _ValuePartyModeIDs = new List(); - ThemeLoaded = true; } @@ -382,58 +385,53 @@ namespace VocaluxeLib.Menu return ThemeLoaded; } - public void AddValue(string value) + private void _Invalidate() { - AddValue(value, _PartyModeID); + _NeedsRevalidate = true; } - public void AddValue(string value, int partyModeID) + /// + /// Adds an entry to the slide. + /// + /// Label to show + /// Texture to show + /// User value (e.g. id of entry) + public void AddValue(string text, CTextureRef texture = null, int tag = 0) { - AddValue(value, null, _ValueIndexes.Count, partyModeID); + AddValue(text, _PartyModeID, texture, tag); } - public void AddValue(string value, CTextureRef texture) + /// + /// Adds an entry to the slide. + /// + /// Label to show + /// Translation id to use for the text + /// Texture to show + /// User value (e.g. id of entry) + public void AddValue(string text, int translationId, CTextureRef texture = null, int tag = 0) { - AddValue(value, texture, _ValueIndexes.Count, _PartyModeID); - } + SValue value = new SValue {Text = text, TranslationId = translationId, Tag = tag, Texture = texture}; - private void _AddValue(string value, CTextureRef texture, int valueIndex) - { - AddValue(value, texture, valueIndex, _PartyModeID); - } + _Values.Add(value); - public void AddValue(string value, CTextureRef texture, int valueIndex, int partyModeID) - { - _ValueNames.Add(value); - _Textures.Add(texture); - _ValueIndexes.Add(valueIndex); - _ValuePartyModeIDs.Add(partyModeID); - - if (Selection == -1) + if (Selection < 0) Selection = 0; - _ValueBounds.Clear(); + _Invalidate(); } public void AddValues(IEnumerable values) { foreach (string value in values) - _AddValue(value, null, _PartyModeID); - - _ValueBounds.Clear(); + AddValue(value); } public void AddValues(string[] values, CTextureRef[] textures) { - if (values.Length != textures.Length) - return; + Debug.Assert(values.Length == textures.Length); for (int i = 0; i < values.Length; i++) AddValue(values[i], textures[i]); - if (Selection == -1) - Selection = 0; - - _ValueBounds.Clear(); } public void SetValues(int selection) @@ -447,31 +445,20 @@ namespace VocaluxeLib.Menu RenameValue(Selection, newName); } - public void RenameValue(int selection, string newName, CTextureRef newTexture = null) + public void RenameValue(int index, string newName, CTextureRef newTexture = null) { - if (selection < 0 && selection >= _ValueNames.Count) + if (index < 0 && index >= _Values.Count) return; - _ValueNames[selection] = newName; - _Textures[selection] = newTexture; - } - - public bool SetSelectionByValueIndex(int valueIndex) - { - for (int i = 0; i < _ValueIndexes.Count; i++) - { - if (_ValueIndexes[i] == valueIndex) - { - Selection = i; - return true; - } - } - return false; + SValue value = _Values[index]; + value.Text = newName; + value.Texture = newTexture; + _Values[index] = value; } public bool SelectNextValue() { - if (Selection < _ValueNames.Count - 1) + if (Selection < _Values.Count - 1) { Selection++; return true; @@ -491,50 +478,46 @@ namespace VocaluxeLib.Menu public void SelectFirstValue() { - if (_ValueNames.Count > 0) + if (_Values.Count > 0) Selection = 0; } public void SelectLastValue() { - if (_ValueNames.Count > 0) - Selection = _ValueNames.Count - 1; + if (_Values.Count > 0) + Selection = _Values.Count - 1; } public void Clear() { + _Values.Clear(); _Selection = -1; - _ValueNames.Clear(); - _Textures.Clear(); - _ValueBounds.Clear(); - _ValueIndexes.Clear(); + _Invalidate(); + } + + private int _GetCurOffset() + { + int offset = _Selection - _NumVisible / 2; + return offset.Clamp(0, _Values.Count - _NumVisible, true); + } + + private void _SelectAtPos(int x, int y) + { + if (_NeedsRevalidate) + _Revalidate(); + int index = _VisibleElements.FindIndex(el => CHelper.IsInBounds(el.Bounds, x, y)); + if (index < 0) + return; + Selection = index + _GetCurOffset(); } public void ProcessMouseMove(int x, int y) { _ArrowLeftSelected = CHelper.IsInBounds(RectArrowLeft, x, y) && _Selection > 0; - _ArrowRightSelected = CHelper.IsInBounds(RectArrowRight, x, y) && _Selection < _ValueNames.Count - 1; + _ArrowRightSelected = CHelper.IsInBounds(RectArrowRight, x, y) && _Selection < _Values.Count - 1; - if (SelectionByHover) - { - for (int i = 0; i < _ValueBounds.Count; i++) - { - if (CHelper.IsInBounds(_ValueBounds[i], x, y)) - { - int offset = _Selection - _NumVisible / 2; - - if (_ValueNames.Count - _NumVisible - offset < 0) - offset = _ValueNames.Count - _NumVisible; - - if (offset < 0) - offset = 0; - - Selection = i + offset; - _ValueBounds.Clear(); - break; - } - } - } + if (SelectByHovering) + _SelectAtPos(x, y); } public void ProcessMouseLBClick(int x, int y) @@ -547,21 +530,78 @@ namespace VocaluxeLib.Menu if (_ArrowRightSelected) SelectNextValue(); - for (int i = 0; i < _ValueBounds.Count; i++) + _SelectAtPos(x, y); + } + + private void _Revalidate() + { + if (!_NeedsRevalidate) + return; + _NeedsRevalidate = false; + int numvis = Math.Min(_NumVisible, _Values.Count); + if (numvis != _VisibleElements.Count) { - if (CHelper.IsInBounds(_ValueBounds[i], x, y)) + _VisibleElements.Clear(); + for (int i = 0; i < numvis; i++) { - int offset = _Selection - _NumVisible / 2; + var el = new CElement + { + Text = new CText(0, 0, 0, _TextH, _MaxW, EAlignment.Center, _Theme.TextStyle, _Theme.TextFont, _TextColor, "T", _PartyModeID), + Img = new CStatic(_PartyModeID) + }; + _VisibleElements.Add(el); + } + } + if (numvis == 0) + return; - if (_ValueNames.Count - _NumVisible - offset < 0) - offset = _ValueNames.Count - _NumVisible; + float elWidth = (Rect.W - _TextRelativeX * 2) / numvis; + //Center point of the first entry + float xStart = Rect.X + _TextRelativeX + elWidth / 2f; - if (offset < 0) - offset = 0; + int offset = _GetCurOffset(); - Selection = i + offset; - _ValueBounds.Clear(); - break; + for (int i = 0; i < numvis; i++) + { + CText text = _VisibleElements[i].Text; + RectangleF textBounds; + float curX = xStart + elWidth * i; + if (String.IsNullOrEmpty(_Values[i + offset].Text)) + { + text.Visible = false; + textBounds = new RectangleF(); + } + else + { + text.Visible = true; + text.Text = _Values[i + offset].Text; + text.TranslationID = _Values[i + offset].TranslationId; + text.Color = (i + offset == Selection) ? _SelTextColor : _TextColor; + textBounds = CBase.Fonts.GetTextBounds(text); + text.X = curX; + text.Z = Rect.Z; + } + + CStatic img = _VisibleElements[i].Img; + if (!DrawTextures || _Values[i + offset].Texture == null) + { + if (text.Visible) + text.Y = Rect.Y + (Rect.H - textBounds.Height) / 2 - _TextRelativeY; + img.Visible = false; + _VisibleElements[i].Bounds = new SRectF(text.X - textBounds.Width / 2f, text.Y, textBounds.Width, textBounds.Height, Rect.Z); + } + else + { + text.Y = (int)(Rect.Y + Rect.H - textBounds.Height - _TextRelativeY); + img.Texture = _Values[i + offset].Texture; + float alpha = (i + offset == _Selection) ? 1f : 0.35f; + img.Color = new SColorF(1f, 1f, 1f, alpha); + float size = Rect.H - textBounds.Height - 2 * _TextRelativeY; + if (size > elWidth) + size = elWidth; + var imgRect = new SRectF(curX - size / 2, Rect.Y + _TextRelativeY, size, size, Rect.Z); + img.MaxRect = imgRect; + _VisibleElements[i].Bounds = imgRect; } } } @@ -584,7 +624,7 @@ namespace VocaluxeLib.Menu CBase.Drawing.DrawTexture(_TextureArrowLeft, RectArrowLeft, _ColorArrow); } - if (_Selection < _ValueNames.Count - 1 || CBase.Settings.GetProgramState() == EProgramState.EditTheme) + if (_Selection < _Values.Count - 1 || CBase.Settings.GetProgramState() == EProgramState.EditTheme) { if (_ArrowRightSelected) CBase.Drawing.DrawTexture(_SelTextureArrowRight, RectArrowRight, _SelColorArrow); @@ -592,63 +632,12 @@ namespace VocaluxeLib.Menu CBase.Drawing.DrawTexture(_TextureArrowRight, RectArrowRight, _ColorArrow); } - if (_NumVisible < 1 || _ValueNames.Count == 0) - return; - - float x = Rect.X + (Rect.W - _TextRelativeX) * 0.1f; - float dx = (Rect.W - _TextRelativeX) * 0.8f / _NumVisible; - //float y = Rect.Y + (Rect.H - TextH); - int offset = _Selection - _NumVisible / 2; - - if (_ValueNames.Count - _NumVisible - offset < 0) - offset = _ValueNames.Count - _NumVisible; - - if (offset < 0) - offset = 0; - - - int numvis = _NumVisible; - if (_ValueNames.Count < numvis) - numvis = _ValueNames.Count; - - _ValueBounds.Clear(); - for (int i = 0; i < numvis; i++) + if (_NeedsRevalidate) + _Revalidate(); + foreach (CElement element in _VisibleElements) { - var text = new CText(0, 0, 0, _TextH, _MaxW, EAlignment.Center, _Theme.TextStyle, _Theme.TextFont, _TextColor, "T", - _ValuePartyModeIDs[i + offset]); - - if (_ValueNames[i + offset] != "") - text.Text = _ValueNames[i + offset]; - else - text.Visible = false; - - var alpha = new SColorF(1f, 1f, 1f, 0.35f); - if (i + offset == _Selection) - { - text.Color = _SelTextColor; - alpha = new SColorF(1f, 1f, 1f, 1f); - } - - RectangleF bounds = CBase.Fonts.GetTextBounds(text); - text.X = (x + dx / 2f + dx * i) + _TextRelativeX; - - if (!WithTextures) - text.Y = (int)((Rect.Y + (Rect.H - bounds.Height) / 2) + _TextRelativeY); - else - text.Y = (int)((Rect.Y + (Rect.H - bounds.Height)) + _TextRelativeY); - - text.Z = Rect.Z; - text.Draw(); - - if (WithTextures) - { - float dh = text.Y - Rect.Y - Rect.H * 0.1f; - var rect = new SRectF(text.X - dh / 2, Rect.Y + Rect.H * 0.05f, dh, dh, Rect.Z); - CBase.Drawing.DrawTexture(_Textures[i + offset], rect, alpha, rect); - _ValueBounds.Add(rect); - } - else - _ValueBounds.Add(new SRectF(text.X - bounds.Width / 2f, text.Y, bounds.Width, bounds.Height, Rect.Z)); + element.Text.Draw(); + element.Img.Draw(); } } @@ -686,6 +675,7 @@ namespace VocaluxeLib.Menu _SelTexture = CBase.Themes.GetSkinTexture(_Theme.SkinSelected, _PartyModeID); _SelTextureArrowLeft = CBase.Themes.GetSkinTexture(_Theme.SkinArrowLeftSelected, _PartyModeID); _SelTextureArrowRight = CBase.Themes.GetSkinTexture(_Theme.SkinArrowRightSelected, _PartyModeID); + _Invalidate(); } public void ReloadSkin() @@ -694,11 +684,6 @@ namespace VocaluxeLib.Menu LoadSkin(); } - public object Clone() - { - return MemberwiseClone(); - } - #region ThemeEdit public void MoveElement(int stepX, int stepY) {