diff --git a/Output/Languages/Deutsch.xml b/Output/Languages/Deutsch.xml index b286b0ad..bc03d2ed 100644 --- a/Output/Languages/Deutsch.xml +++ b/Output/Languages/Deutsch.xml @@ -23,6 +23,7 @@ Normal Duett Medley + Kurz-Version Vocal Hero Superstar @@ -118,6 +119,15 @@ Warnung: Den Spielern %v sind keine Profile zugeordnet! Songauswahl + Lied singen + Zur Playlist hinzufügen + Schließen + Zufälligen Song wählen + Alle Songs singen + Alle sichtbaren Songs singen + Playlist öffnen + Neue Playlist + Lied-Optionen Suche: Ohne Sprache Ohne Jahr @@ -130,11 +140,13 @@ Pause Lied beenden Fortfahren + Lied überspringen Auswertung Bewertung Punkte Schwierigkeit + Gesamtpunktzahl Highscore diff --git a/Output/Languages/English.xml b/Output/Languages/English.xml index 6037e02e..10b2e4fa 100644 --- a/Output/Languages/English.xml +++ b/Output/Languages/English.xml @@ -23,6 +23,7 @@ Normal Duet Medley + Short version Vocal Hero Superstar @@ -118,6 +119,15 @@ Warning: There are no profiles assigned to players %v! Song Selection + Sing + Add to playlist + Close + Select a random song + Sing all songs + Sing all visible songs + Open playlist + New Playlist + Song Options Search: No Language No Year @@ -130,11 +140,13 @@ Pause Stop singing Continue + Skip this song Scores Rating Points Difficulty + Overall score Highscore diff --git a/Output/Languages/French.xml b/Output/Languages/French.xml index f60e82a3..6da3296d 100644 --- a/Output/Languages/French.xml +++ b/Output/Languages/French.xml @@ -117,6 +117,7 @@ Rechercher: Pas de Langue Pas d'Année + TODO: New Playlist Pas de Genre Pas d'Edition Toutes les chansons diff --git a/Output/Languages/Spanish.xml b/Output/Languages/Spanish.xml index 483e30a3..2c4a8456 100644 --- a/Output/Languages/Spanish.xml +++ b/Output/Languages/Spanish.xml @@ -116,6 +116,7 @@ Selección de Canciones Buscar: Sin Idioma + TODO: New Playlist Sin Año Sin Género Sin Edición diff --git a/Output/Themes/Ambient/Close.png b/Output/Themes/Ambient/Close.png new file mode 100644 index 00000000..b8b8a994 Binary files /dev/null and b/Output/Themes/Ambient/Close.png differ diff --git a/Output/Themes/Ambient/Delete.png b/Output/Themes/Ambient/Delete.png new file mode 100644 index 00000000..46a686ad Binary files /dev/null and b/Output/Themes/Ambient/Delete.png differ diff --git a/Output/Themes/Ambient/MedleyIcon.png b/Output/Themes/Ambient/MedleyCalcIcon.png similarity index 100% rename from Output/Themes/Ambient/MedleyIcon.png rename to Output/Themes/Ambient/MedleyCalcIcon.png diff --git a/Output/Themes/Ambient/MedleyTagIcon.png b/Output/Themes/Ambient/MedleyTagIcon.png new file mode 100644 index 00000000..2cfe3f20 Binary files /dev/null and b/Output/Themes/Ambient/MedleyTagIcon.png differ diff --git a/Output/Themes/Ambient/Save.png b/Output/Themes/Ambient/Save.png new file mode 100644 index 00000000..1afc3113 Binary files /dev/null and b/Output/Themes/Ambient/Save.png differ diff --git a/Output/Themes/Ambient/Screens/PopupScreenPlayerControl.xml b/Output/Themes/Ambient/Screens/PopupScreenPlayerControl.xml index 186d42b6..b30dbca3 100644 --- a/Output/Themes/Ambient/Screens/PopupScreenPlayerControl.xml +++ b/Output/Themes/Ambient/Screens/PopupScreenPlayerControl.xml @@ -58,7 +58,7 @@ Outline - + @@ -103,7 +103,7 @@ Normal - + @@ -152,7 +152,7 @@ Normal - + @@ -201,7 +201,7 @@ Normal - + @@ -250,7 +250,7 @@ Normal - + @@ -299,7 +299,7 @@ Normal - + @@ -348,7 +348,7 @@ Normal - + @@ -397,7 +397,7 @@ Normal - + @@ -446,7 +446,7 @@ Normal - + diff --git a/Output/Themes/Ambient/Screens/ScreenHighscore.xml b/Output/Themes/Ambient/Screens/ScreenHighscore.xml index caf13c13..b036b823 100644 --- a/Output/Themes/Ambient/Screens/ScreenHighscore.xml +++ b/Output/Themes/Ambient/Screens/ScreenHighscore.xml @@ -68,7 +68,7 @@ Outline - + TR_SCREENHIGHSCORE_HIGHSCORE @@ -97,7 +97,7 @@ Outline - + @@ -126,7 +126,7 @@ Outline - + @@ -155,7 +155,7 @@ Outline - + @@ -184,7 +184,7 @@ Outline - + @@ -213,7 +213,7 @@ Outline - + @@ -242,7 +242,7 @@ Outline - + @@ -271,7 +271,7 @@ Outline - + @@ -300,7 +300,7 @@ Outline - + @@ -329,7 +329,7 @@ Outline - + @@ -358,7 +358,7 @@ Outline - + @@ -387,7 +387,7 @@ Outline - + @@ -416,7 +416,7 @@ Outline - + @@ -445,7 +445,7 @@ Outline - + @@ -474,7 +474,7 @@ Outline - + @@ -503,7 +503,7 @@ Outline - + @@ -532,7 +532,7 @@ Outline - + @@ -561,7 +561,7 @@ Outline - + @@ -590,7 +590,7 @@ Outline - + @@ -619,7 +619,7 @@ Outline - + @@ -648,7 +648,7 @@ Outline - + @@ -677,7 +677,7 @@ Outline - + @@ -706,7 +706,7 @@ Outline - + @@ -735,7 +735,7 @@ Outline - + @@ -764,7 +764,7 @@ Outline - + @@ -793,7 +793,7 @@ Outline - + @@ -822,7 +822,7 @@ Outline - + @@ -851,7 +851,7 @@ Outline - + @@ -880,7 +880,7 @@ Outline - + @@ -909,7 +909,7 @@ Outline - + @@ -938,7 +938,7 @@ Outline - + @@ -967,7 +967,7 @@ Outline - + @@ -996,7 +996,7 @@ Outline - + @@ -1025,7 +1025,7 @@ Outline - + @@ -1054,7 +1054,7 @@ Outline - + @@ -1083,7 +1083,7 @@ Outline - + @@ -1112,7 +1112,7 @@ Outline - + @@ -1141,7 +1141,7 @@ Outline - + @@ -1170,7 +1170,7 @@ Outline - + @@ -1199,7 +1199,7 @@ Outline - + @@ -1228,7 +1228,7 @@ Outline - + @@ -1257,7 +1257,7 @@ Outline - + @@ -1286,7 +1286,7 @@ Outline - + diff --git a/Output/Themes/Ambient/Screens/ScreenLoad.xml b/Output/Themes/Ambient/Screens/ScreenLoad.xml index a4030b21..6f78787d 100644 --- a/Output/Themes/Ambient/Screens/ScreenLoad.xml +++ b/Output/Themes/Ambient/Screens/ScreenLoad.xml @@ -52,7 +52,7 @@ Outline - + TR_PROGRAM_NAME @@ -81,7 +81,7 @@ Outline - + TR_SCREENLOAD_LOADING @@ -110,7 +110,7 @@ Outline - + diff --git a/Output/Themes/Ambient/Screens/ScreenMain.xml b/Output/Themes/Ambient/Screens/ScreenMain.xml index 6c195ea0..71116b93 100644 --- a/Output/Themes/Ambient/Screens/ScreenMain.xml +++ b/Output/Themes/Ambient/Screens/ScreenMain.xml @@ -68,7 +68,7 @@ Outline - + TR_SCREENMAIN_BUTTON_SING @@ -125,7 +125,7 @@ Outline - + TR_SCREENMAIN_BUTTON_OPTIONS @@ -182,7 +182,7 @@ Outline - + TR_SCREENMAIN_BUTTON_PROFILES @@ -239,7 +239,7 @@ Outline - + TR_BUTTON_EXIT diff --git a/Output/Themes/Ambient/Screens/ScreenNames.xml b/Output/Themes/Ambient/Screens/ScreenNames.xml index c35f8b0f..86d907e3 100644 --- a/Output/Themes/Ambient/Screens/ScreenNames.xml +++ b/Output/Themes/Ambient/Screens/ScreenNames.xml @@ -28,7 +28,7 @@ - + PlayerSelector @@ -276,7 +276,7 @@ Outline - + TR_SCREENNAMES_MENU @@ -306,7 +306,7 @@ Outline - + @@ -336,7 +336,7 @@ Outline - + @@ -365,7 +365,7 @@ Outline - + @@ -394,7 +394,7 @@ Outline - + @@ -423,7 +423,7 @@ Outline - + @@ -452,7 +452,7 @@ Outline - + @@ -481,7 +481,7 @@ Outline - + @@ -510,7 +510,7 @@ Outline - + @@ -555,7 +555,7 @@ Outline - + TR_BUTTON_BACK @@ -612,7 +612,7 @@ Outline - + TR_BUTTON_START @@ -1128,167 +1128,167 @@ - - - Invisible - + + + Invisible + 21 152 -4,00 108 - 60 - - 8 - - 2,00 - - - - - Player1Dim2 - - - Player1Dim - - TR_CONFIG_OFF + 60 + + 8 + + 2,00 + + + + TR_CONFIG_OFF + + + Player1Dim2 + + + Player1Dim2 - - - - Invisible - + + + + Invisible + 21 307 -4,00 108 - 60 - - 8 - - 2,00 - - - - - Player2Dim2 - - - Player2Dim - - TR_CONFIG_OFF + 60 + + 8 + + 2,00 + + + + TR_CONFIG_OFF + + + Player2Dim2 + + + Player2Dim2 - - - - Invisible - + + + + Invisible + 21 467 -4,00 108 - 60 - - 8 - - 2,00 - - - - - Player3Dim2 - - - Player3Dim - - TR_CONFIG_OFF + 60 + + 8 + + 2,00 + + + + TR_CONFIG_OFF + + + Player3Dim2 + + + Player3Dim2 - - - - Invisible - + + + + Invisible + 1153 152 -4,00 108 - 60 - - 8 - - 2,00 - - - - - Player4Dim2 - - - Player4Dim - - TR_CONFIG_OFF + 60 + + 8 + + 2,00 + + + + TR_CONFIG_OFF + + + Player4Dim2 + + + Player4Dim2 - - - - Invisible - + + + + Invisible + 1153 307 -4,00 108 - 60 - - 8 - - 2,00 - - - - - Player5Dim2 - - - Player5Dim - - TR_CONFIG_OFF + 60 + + 8 + + 2,00 + + + + TR_CONFIG_OFF + + + Player5Dim2 + + + Player5Dim2 - - - - Invisible - + + + + Invisible + 1153 467 -4,00 108 - 60 - - 8 - - 2,00 - - - - - Player6Dim2 - - - Player6Dim - - TR_CONFIG_OFF + 60 + + 8 + + 2,00 + + + + TR_CONFIG_OFF + + + Player6Dim2 + + + Player6Dim2 - + - + \ No newline at end of file diff --git a/Output/Themes/Ambient/Screens/ScreenOptions.xml b/Output/Themes/Ambient/Screens/ScreenOptions.xml index 5ce06914..808f1d29 100644 --- a/Output/Themes/Ambient/Screens/ScreenOptions.xml +++ b/Output/Themes/Ambient/Screens/ScreenOptions.xml @@ -52,7 +52,7 @@ Outline - + TR_SCREENO_OPTIONS @@ -97,7 +97,7 @@ Outline - + TR_SCREENO_BUTTON_GAME @@ -154,7 +154,7 @@ Outline - + TR_SCRENNO_BUTTON_SOUND @@ -211,7 +211,7 @@ Outline - + TR_SCREENO_BUTTON_RECORD @@ -268,7 +268,7 @@ Outline - + TR_SCREENO_BUTTON_VIDEO @@ -325,7 +325,7 @@ Outline - + TR_SCREENO_BUTTON_LYRICS @@ -382,7 +382,7 @@ Outline - + TR_SCREENO_BUTTON_THEME diff --git a/Output/Themes/Ambient/Screens/ScreenOptionsGame.xml b/Output/Themes/Ambient/Screens/ScreenOptionsGame.xml index 28e4b3d2..bdd2f750 100644 --- a/Output/Themes/Ambient/Screens/ScreenOptionsGame.xml +++ b/Output/Themes/Ambient/Screens/ScreenOptionsGame.xml @@ -148,7 +148,7 @@ Outline - + TR_SCREENOGAME_OPTIONS @@ -177,7 +177,7 @@ Outline - + TR_SCREENOGAME_LANGUAGE @@ -206,7 +206,7 @@ Outline - + TR_SCREENOGAME_DEBUGLEVEL @@ -235,7 +235,7 @@ Outline - + TR_SCREENOGAME_SONGMENU @@ -264,7 +264,7 @@ Outline - + TR_SCREENOGAME_SONGSORTING @@ -293,7 +293,7 @@ Outline - + TR_SCREENOGAME_TABS @@ -322,7 +322,7 @@ Outline - + TR_SCREENOGAME_TIMERMODE @@ -367,7 +367,7 @@ Outline - + TR_BUTTON_BACK diff --git a/Output/Themes/Ambient/Screens/ScreenOptionsLyrics.xml b/Output/Themes/Ambient/Screens/ScreenOptionsLyrics.xml index 521fd578..d544a49f 100644 --- a/Output/Themes/Ambient/Screens/ScreenOptionsLyrics.xml +++ b/Output/Themes/Ambient/Screens/ScreenOptionsLyrics.xml @@ -52,7 +52,7 @@ Outline - + TR_SCREENOLYRICS_OPTIONS @@ -81,7 +81,7 @@ Outline - + TR_SCREENOLYRICS_STYLE @@ -110,7 +110,7 @@ Outline - + TR_SCREENOLYRICS_ONTOP @@ -155,7 +155,7 @@ Outline - + TR_BUTTON_BACK diff --git a/Output/Themes/Ambient/Screens/ScreenOptionsRecord.xml b/Output/Themes/Ambient/Screens/ScreenOptionsRecord.xml index 7375fd34..2100c33e 100644 --- a/Output/Themes/Ambient/Screens/ScreenOptionsRecord.xml +++ b/Output/Themes/Ambient/Screens/ScreenOptionsRecord.xml @@ -180,7 +180,7 @@ Outline - + TR_SCREENORECORD_OPTIONS @@ -209,7 +209,7 @@ Outline - + TR_SCREENORECORD_DEVICE @@ -238,7 +238,7 @@ Outline - + TR_SCREENORECORD_INPUT @@ -267,7 +267,7 @@ Outline - + TR_SCREENORECORD_CHANNEL_1 @@ -296,7 +296,7 @@ Outline - + TR_SCREENORECORD_CHANNEL_2 @@ -325,7 +325,7 @@ Outline - + TR_SCREENORECORD_MIC_DELAY @@ -355,7 +355,7 @@ Outline - + TR_SCREENORECORD_MIC_WARNING @@ -384,7 +384,7 @@ Outline - + @@ -413,7 +413,7 @@ Outline - + @@ -458,7 +458,7 @@ Outline - + TR_BUTTON_BACK @@ -515,7 +515,7 @@ Outline - + TR_SCREENORECORD_BUTTON_DELAYTEST @@ -858,66 +858,67 @@ 5 - - - Invisible - - 50 - 400 - 230 - 150 - -1,00 - - 10 - 2,00 - - - - - ButtonColor - - - ButtonSColor - - TR_CONFIG_OFF + + + Invisible + + 50 + 400 + -1,00 + 230 + 150 + + 10 + + 2,00 + + + + TR_CONFIG_OFF + + + ButtonColor + + + ButtonColor 10 26 - - - - - Invisible - - 400 - 400 - 230 - 150 - -1,00 - - 10 - - 2,00 - - - - - ButtonColor - - - ButtonSColor - - TR_CONFIG_OFF + + + + + Invisible + + 400 + 400 + -1,00 + 230 + 150 + + 10 + + 2,00 + + + + TR_CONFIG_OFF + + + ButtonColor + + + ButtonColor 10 26 - - + + - + \ No newline at end of file diff --git a/Output/Themes/Ambient/Screens/ScreenOptionsSound.xml b/Output/Themes/Ambient/Screens/ScreenOptionsSound.xml index 597e24f4..3f23d55c 100644 --- a/Output/Themes/Ambient/Screens/ScreenOptionsSound.xml +++ b/Output/Themes/Ambient/Screens/ScreenOptionsSound.xml @@ -52,7 +52,7 @@ Outline - + TR_SCREENOSOUND_OPTIONS @@ -81,7 +81,7 @@ Outline - + TR_SCREENOSOUND_BACKGROUNDMUSIC @@ -110,7 +110,7 @@ Outline - + TR_SCREENOSOUND_BACKGROUNDMUSICVOLUME @@ -139,7 +139,7 @@ Outline - + TR_SCREENOSOUND_BACKGROUNDMUSICSOURCE @@ -184,7 +184,7 @@ Outline - + TR_BUTTON_BACK diff --git a/Output/Themes/Ambient/Screens/ScreenOptionsTheme.xml b/Output/Themes/Ambient/Screens/ScreenOptionsTheme.xml index fbb7f91c..15c6492b 100644 --- a/Output/Themes/Ambient/Screens/ScreenOptionsTheme.xml +++ b/Output/Themes/Ambient/Screens/ScreenOptionsTheme.xml @@ -180,7 +180,7 @@ Outline - + TR_SCREENOTHEME_OPTIONS @@ -209,7 +209,7 @@ Outline - + TR_SCREENOTHEME_THEME @@ -238,7 +238,7 @@ Outline - + TR_SCREENOTHEME_SKIN @@ -267,7 +267,7 @@ Outline - + TR_SCREENOTHEME_COVERTHEME @@ -296,7 +296,7 @@ Outline - + TR_SCREENOTHEME_NOTELINES @@ -325,7 +325,7 @@ Outline - + TR_SCREENOTHEME_TONEHELPER @@ -354,7 +354,7 @@ Outline - + TR_SCREENOTHEME_TIMERLOOK @@ -383,7 +383,7 @@ Outline - + TR_SCREENOTHEME_FADEINFO @@ -412,7 +412,7 @@ Outline - + TR_SCREENOTHEME_COVERLOADING @@ -457,7 +457,7 @@ Outline - + TR_BUTTON_BACK diff --git a/Output/Themes/Ambient/Screens/ScreenOptionsVideo.xml b/Output/Themes/Ambient/Screens/ScreenOptionsVideo.xml index fbdb6be8..958526c2 100644 --- a/Output/Themes/Ambient/Screens/ScreenOptionsVideo.xml +++ b/Output/Themes/Ambient/Screens/ScreenOptionsVideo.xml @@ -100,7 +100,7 @@ Outline - + TR_SCREENOVIDEO_OPTIONS @@ -129,7 +129,7 @@ Outline - + TR_SCREENOVIDEO_VIDEOBACKGROUNDS @@ -158,7 +158,7 @@ Outline - + TR_SCREENOVIDEO_VIDEOPREVIEW @@ -187,7 +187,7 @@ Outline - + TR_SCREENOVIDEO_VIDEOINSONGS @@ -216,7 +216,7 @@ Normal - + TR_SCREENO_VIDEO_VIDEOSTOBACKGROUND @@ -261,7 +261,7 @@ Outline - + TR_BUTTON_BACK diff --git a/Output/Themes/Ambient/Screens/ScreenProfiles.xml b/Output/Themes/Ambient/Screens/ScreenProfiles.xml index 128a373b..7bd59c6b 100644 --- a/Output/Themes/Ambient/Screens/ScreenProfiles.xml +++ b/Output/Themes/Ambient/Screens/ScreenProfiles.xml @@ -148,7 +148,7 @@ Outline - + TR_SCREENPROFILES_PROFILES @@ -177,7 +177,7 @@ Outline - + TR_SCREENPROFILES_PLAYERNAME @@ -206,7 +206,7 @@ Outline - + TR_SCREENPROFILES_GAMEDIFFICULTY @@ -235,7 +235,7 @@ Outline - + TR_SCREENPROFILES_AVATAR @@ -264,7 +264,7 @@ Outline - + TR_SCREENPROFILES_GUESTPROFILE @@ -293,7 +293,7 @@ Outline - + TR_SCREENPROFILES_ACTIVE @@ -338,7 +338,7 @@ Outline - + @@ -387,7 +387,7 @@ Outline - + TR_BUTTON_BACK @@ -444,7 +444,7 @@ Outline - + TR_BUTTON_SAVE @@ -501,7 +501,7 @@ Outline - + TR_SCREENPROFILES_BUTTON_NEW @@ -558,7 +558,7 @@ Outline - + TR_SCREENPROFILES_BUTTON_DELETE diff --git a/Output/Themes/Ambient/Screens/ScreenScore.xml b/Output/Themes/Ambient/Screens/ScreenScore.xml index cccaaae3..814efcfe 100644 --- a/Output/Themes/Ambient/Screens/ScreenScore.xml +++ b/Output/Themes/Ambient/Screens/ScreenScore.xml @@ -1226,7 +1226,7 @@ Outline - + TR_SCREENSCORE_SCORES @@ -1255,7 +1255,7 @@ Outline - + @@ -1284,7 +1284,7 @@ Outline - + @@ -1313,7 +1313,7 @@ Outline - + @@ -1342,7 +1342,7 @@ Outline - + @@ -1371,7 +1371,7 @@ Outline - + @@ -1400,7 +1400,7 @@ Outline - + @@ -1429,7 +1429,7 @@ Outline - + @@ -1458,7 +1458,7 @@ Outline - + @@ -1487,7 +1487,7 @@ Outline - + @@ -1516,7 +1516,7 @@ Outline - + @@ -1545,7 +1545,7 @@ Outline - + @@ -1574,7 +1574,7 @@ Outline - + @@ -1603,7 +1603,7 @@ Outline - + @@ -1632,7 +1632,7 @@ Outline - + @@ -1661,7 +1661,7 @@ Outline - + @@ -1690,7 +1690,7 @@ Outline - + @@ -1719,7 +1719,7 @@ Outline - + @@ -1748,7 +1748,7 @@ Outline - + @@ -1777,7 +1777,7 @@ Outline - + @@ -1806,7 +1806,7 @@ Outline - + @@ -1835,7 +1835,7 @@ Outline - + @@ -1864,7 +1864,7 @@ Outline - + @@ -1893,7 +1893,7 @@ Outline - + @@ -1922,7 +1922,7 @@ Outline - + @@ -1951,7 +1951,7 @@ Outline - + @@ -1980,7 +1980,7 @@ Outline - + @@ -2009,7 +2009,7 @@ Outline - + @@ -2039,7 +2039,7 @@ Outline - + @@ -2068,7 +2068,7 @@ Outline - + @@ -2097,7 +2097,7 @@ Outline - + @@ -2126,7 +2126,7 @@ Outline - + @@ -2156,7 +2156,7 @@ Outline - + @@ -2185,7 +2185,7 @@ Outline - + @@ -2214,7 +2214,7 @@ Outline - + @@ -2243,7 +2243,7 @@ Outline - + @@ -2273,7 +2273,7 @@ Outline - + @@ -2302,7 +2302,7 @@ Outline - + @@ -2331,7 +2331,7 @@ Outline - + @@ -2360,7 +2360,7 @@ Outline - + @@ -2390,7 +2390,7 @@ Outline - + @@ -2419,7 +2419,7 @@ Outline - + @@ -2449,7 +2449,7 @@ Outline - + @@ -2479,7 +2479,7 @@ Outline - + @@ -2509,7 +2509,7 @@ Outline - + @@ -2539,7 +2539,7 @@ Outline - + @@ -2569,7 +2569,7 @@ Outline - + @@ -2599,7 +2599,7 @@ Outline - + @@ -2629,7 +2629,7 @@ Outline - + @@ -2659,7 +2659,7 @@ Outline - + @@ -2689,7 +2689,7 @@ Outline - + @@ -2719,7 +2719,7 @@ Outline - + @@ -2749,7 +2749,7 @@ Outline - + @@ -2779,7 +2779,7 @@ Outline - + @@ -2809,7 +2809,7 @@ Outline - + @@ -2839,7 +2839,7 @@ Outline - + @@ -2869,7 +2869,7 @@ Outline - + @@ -2899,7 +2899,7 @@ Outline - + @@ -2929,7 +2929,7 @@ Outline - + @@ -2959,7 +2959,7 @@ Outline - + @@ -2989,7 +2989,7 @@ Outline - + @@ -3019,7 +3019,7 @@ Outline - + @@ -3049,7 +3049,7 @@ Outline - + @@ -3079,7 +3079,7 @@ Outline - + @@ -3109,7 +3109,7 @@ Outline - + @@ -3139,7 +3139,7 @@ Outline - + @@ -3169,7 +3169,7 @@ Outline - + @@ -3199,7 +3199,7 @@ Outline - + @@ -3229,7 +3229,7 @@ Outline - + @@ -3259,7 +3259,7 @@ Outline - + @@ -3289,7 +3289,7 @@ Outline - + @@ -3319,7 +3319,7 @@ Outline - + @@ -3349,7 +3349,7 @@ Outline - + @@ -3379,7 +3379,7 @@ Outline - + @@ -3409,7 +3409,7 @@ Outline - + @@ -3439,7 +3439,7 @@ Outline - + @@ -3469,7 +3469,7 @@ Outline - + @@ -3499,7 +3499,7 @@ Outline - + @@ -3529,7 +3529,7 @@ Outline - + @@ -3559,7 +3559,7 @@ Outline - + @@ -3589,7 +3589,7 @@ Outline - + @@ -3619,7 +3619,7 @@ Outline - + @@ -3649,7 +3649,7 @@ Outline - + @@ -3679,7 +3679,7 @@ Outline - + @@ -3709,7 +3709,7 @@ Outline - + @@ -3739,7 +3739,7 @@ Outline - + diff --git a/Output/Themes/Ambient/Screens/ScreenSing.xml b/Output/Themes/Ambient/Screens/ScreenSing.xml index aaeec608..21d12061 100644 --- a/Output/Themes/Ambient/Screens/ScreenSing.xml +++ b/Output/Themes/Ambient/Screens/ScreenSing.xml @@ -958,64 +958,6 @@ - - - 40 - 80 - - -1,00 - - 35 - - - - TextSColor - - - TextSColor - - Left - - Center - - - - Outline - - - - - - - - - 40 - 585 - - -1,00 - - 35 - - - - TextSColor - - - TextSColor - - Left - - Center - - - - Outline - - - - - - 640 @@ -1040,7 +982,7 @@ Normal - + @@ -1069,7 +1011,7 @@ Normal - + @@ -1098,12 +1040,70 @@ Normal - + TR_SCREENSING_PAUSE + + + 40 + 80 + + -1,00 + + 35 + + + + TextSColor + + + TextSColor + + Left + + Center + + + + Outline + + + + + + + + + 40 + 585 + + -1,00 + + 35 + + + + TextSColor + + + TextSColor + + Left + + Center + + + + Outline + + + + + + 1240 @@ -1127,7 +1127,7 @@ Normal - + @@ -1159,7 +1159,7 @@ Outline - + @@ -1188,7 +1188,7 @@ Normal - + @@ -1220,7 +1220,7 @@ Outline - + @@ -1249,7 +1249,7 @@ Normal - + @@ -1281,7 +1281,7 @@ Outline - + @@ -1310,7 +1310,7 @@ Normal - + @@ -1342,7 +1342,7 @@ Outline - + @@ -1371,7 +1371,7 @@ Normal - + @@ -1403,7 +1403,7 @@ Outline - + @@ -1432,7 +1432,7 @@ Normal - + @@ -1464,7 +1464,7 @@ Outline - + @@ -1493,7 +1493,7 @@ Normal - + @@ -1525,7 +1525,7 @@ Outline - + @@ -1554,7 +1554,7 @@ Normal - + @@ -1586,7 +1586,7 @@ Outline - + @@ -1615,7 +1615,7 @@ Normal - + @@ -1647,7 +1647,7 @@ Outline - + @@ -1676,7 +1676,7 @@ Normal - + @@ -1708,7 +1708,7 @@ Outline - + @@ -1737,7 +1737,7 @@ Normal - + @@ -1769,7 +1769,7 @@ Outline - + @@ -1798,7 +1798,7 @@ Normal - + @@ -1830,7 +1830,7 @@ Outline - + @@ -1859,7 +1859,7 @@ Normal - + @@ -1891,7 +1891,7 @@ Outline - + @@ -1920,7 +1920,7 @@ Normal - + @@ -1952,7 +1952,7 @@ Outline - + @@ -1981,7 +1981,7 @@ Normal - + @@ -2013,7 +2013,7 @@ Outline - + @@ -2042,7 +2042,7 @@ Normal - + @@ -2074,7 +2074,7 @@ Outline - + @@ -2103,7 +2103,7 @@ Normal - + @@ -2135,7 +2135,7 @@ Outline - + @@ -2164,7 +2164,7 @@ Normal - + @@ -2196,7 +2196,7 @@ Outline - + @@ -2225,7 +2225,7 @@ Normal - + @@ -2257,7 +2257,7 @@ Outline - + @@ -2286,7 +2286,7 @@ Normal - + @@ -2318,7 +2318,7 @@ Outline - + @@ -2347,7 +2347,7 @@ Normal - + @@ -2379,7 +2379,7 @@ Outline - + @@ -2391,7 +2391,7 @@ Button - 670 + 775 300 -2,11 150 @@ -2424,7 +2424,7 @@ Outline - + TR_SCREENSING_BUTTON_CANCEL @@ -2448,7 +2448,7 @@ Button - 460 + 355 300 -2,11 150 @@ -2481,7 +2481,7 @@ Outline - + TR_SCREENSING_BUTTON_CONTINUE @@ -2499,6 +2499,63 @@ 26 + + + Button + + Button + + 565 + 300 + -2,11 + 150 + 50 + + + ButtonColor + + + ButtonSColor + + + 75 + 10 + + 32 + + 142 + + + ButtonTextColor + + + ButtonTextSColor + + Center + + Center + + + + Outline + + TR_SCREENSING_BUTTON_SKIP + + + + + + 10 + 26 + + + + + + 10 + 26 + + 637 @@ -2714,4 +2771,4 @@ - + \ No newline at end of file diff --git a/Output/Themes/Ambient/Screens/ScreenSong.xml b/Output/Themes/Ambient/Screens/ScreenSong.xml index ad07bdd8..dfe2d5a7 100644 --- a/Output/Themes/Ambient/Screens/ScreenSong.xml +++ b/Output/Themes/Ambient/Screens/ScreenSong.xml @@ -1,7 +1,7 @@  - 1 + 3 Video @@ -53,6 +53,25 @@ 26 + + + SongMenuBG + + 40 + 40 + -2,10 + 360 + 360 + + + 1,00 + 1,00 + 1,00 + 1,00 + + + + 220 @@ -77,7 +96,7 @@ Outline - + @@ -111,7 +130,7 @@ Outline - + @@ -144,7 +163,7 @@ Outline - + TR_SCREENSONG_SEARCH @@ -173,12 +192,629 @@ Outline - + + + + 220 + 45 + + -2,11 + + 40 + + 350 + + + StaticColor + + + TextSColor + + Center + + Center + + + + Outline + + TR_SCREENSONG_SONGOPTIONS + + + + + + + Button + + Button + + 40 + 360 + -2,11 + 360 + 40 + + + ButtonColor + + + ButtonSColor + + + 180 + 5 + + 30 + + 350 + + + ButtonTextColor + + + ButtonTextSColor + + Center + + Center + + + + Outline + + TR_SCREENSONG_BUTTON_CANCEL + + + + + + + + + + + Button + + Button + + 40 + 235 + -2,11 + 360 + 40 + + + ButtonColor + + + ButtonSColor + + + 180 + 5 + + 30 + + 350 + + + ButtonTextColor + + + ButtonTextSColor + + Center + + Center + + + + Outline + + TR_SCREENSONG_BUTTON_PLAYLIST + + + + + + + + + + + Button + + Button + + 40 + 90 + -2,11 + 360 + 40 + + + ButtonColor + + + ButtonSColor + + + 180 + 5 + + 30 + + 350 + + + ButtonTextColor + + + ButtonTextSColor + + Center + + Center + + + + Outline + + TR_SCREENSONG_BUTTON_SING + + + + + + + + + + + Button + + Button + + 40 + 135 + -2,11 + 360 + 40 + + + ButtonColor + + + ButtonSColor + + + 180 + 5 + + 30 + + 350 + + + ButtonTextColor + + + ButtonTextSColor + + Center + + Center + + + + Outline + + TR_SCREENSONG_BUTTON_SINGALL + + + + + + + + + + + Button + + Button + + 40 + 180 + -2,11 + 360 + 40 + + + ButtonColor + + + ButtonSColor + + + 180 + 5 + + 30 + + 350 + + + ButtonTextColor + + + ButtonTextSColor + + Center + + Center + + + + Outline + + TR_SCREENSONG_BUTTON_SINGALLVISIBLE + + + + + + + + + + + Button + + Button + + 40 + 90 + -2,11 + 360 + 40 + + + ButtonColor + + + ButtonSColor + + + 180 + 5 + + 30 + + 350 + + + ButtonTextColor + + + ButtonTextSColor + + Center + + Center + + + + Outline + + TR_SCREENSONG_BUTTON_RANDOM + + + + + + + + + + + Button + + Button + + 40 + 275 + -2,11 + 360 + 40 + + + ButtonColor + + + ButtonSColor + + + 180 + 5 + + 30 + + 350 + + + ButtonTextColor + + + ButtonTextSColor + + Center + + Center + + + + Outline + + TR_SCREENSONG_BUTTON_OPENPLAYLIST + + + + + + + + + + + Invisible + + Invisible + + 40 + 40 + -1,01 + 360 + 360 + + + Invisible + + + Invisible + + + 180 + 5 + + 30 + + 350 + + + ButtonTextColor + + + ButtonTextSColor + + Center + + Center + + + + Outline + + + + + + + + + + + + + Button + + SelectSlideArrowLeft + + SelectSlideArrowRight + + SelectSlide + + SelectSlideArrowLeft + + SelectSlideArrowRight + + SelectSlide + + 40 + 135 + -2,11 + 360 + 40 + + 45 + 140 + -2,12 + 30 + 30 + + 365 + 140 + -2,12 + 30 + 30 + + + ButtonColor + + + ButtonSColor + + + SelectSlideHColor + + + ArrowColor + + + ArrowSColor + + + TextColor + + + TextSColor + + 30,00 + + 280,00 + + Outline + + Bold + + 1 + + + + Button + + SelectSlideArrowLeft + + SelectSlideArrowRight + + SelectSlide + + SelectSlideArrowLeft + + SelectSlideArrowRight + + SelectSlide + + 40 + 190 + -2,11 + 360 + 40 + + 45 + 195 + -2,12 + 30 + 30 + + 365 + 195 + -2,12 + 30 + 30 + + + ButtonColor + + + ButtonSColor + + + SelectSlideHColor + + + ArrowColor + + + ArrowSColor + + + TextColor + + + TextSColor + + 30,00 + + 280,00 + + Outline + + Bold + + 1 + + + + Button + + SelectSlideArrowLeft + + SelectSlideArrowRight + + SelectSlide + + SelectSlideArrowLeft + + SelectSlideArrowRight + + SelectSlide + + 40 + 230 + -2,11 + 360 + 40 + + 45 + 235 + -2,12 + 30 + 30 + + 365 + 235 + -2,12 + 30 + 30 + + + ButtonColor + + + ButtonSColor + + + SelectSlideHColor + + + ArrowColor + + + ArrowSColor + + + TextColor + + + TextSColor + + 30,00 + + 280,00 + + Outline + + Bold + + 1 + CoverTile @@ -188,12 +824,10 @@ DuetIcon VideoIcon - - 40 - 100 - -1,00 - 1200 - 530 + + MedleyCalcIcon + + MedleyTagIcon 1,00 @@ -210,12 +844,22 @@ 10,00 10,00 + + 4 + + 4 410 40 -1,00 830 550 + + 410 + 40 + -1,00 + 550 + 550 222 @@ -240,7 +884,7 @@ Outline - + @@ -270,7 +914,7 @@ Outline - + @@ -300,7 +944,7 @@ Outline - + @@ -370,7 +1014,448 @@ + + + MedleyCalcIcon + + 280 + 530 + -1,00 + 40 + 40 + + + StaticColor + + + + + + + MedleyTagIcon + + 280 + 530 + -1,00 + 40 + 40 + + + StaticColor + + + + + + + 970 + 80 + -0,90 + 295 + 460 + 50,00 + + CoverTile + + CoverTile + + + StaticColorAlpha + + + StaticColor + + + + + 54 + 4 + + -1,01 + + 24 + + 235 + + + StaticColor + + + TextSColor + + Left + + Top + + + + Outline + + + + + + + + + Menu + + 970 + 550 + -1,00 + 295 + 40 + + + StaticColor + + + + + + + Menu + + 970 + 40 + -1,00 + 295 + 40 + + + StaticColor + + + + + + + + + 4 + 2 + -1,00 + 46 + 46 + + + Visible + + + + + + + Button + + SelectSlideArrowLeft + + SelectSlideArrowRight + + SelectSlide + + SelectSlideArrowLeft + + SelectSlideArrowRight + + SelectSlide + + 0 + 28 + -1,01 + 343 + 24 + + 54 + 30 + -1,02 + 20 + 20 + + 235 + 30 + -1,02 + 20 + 20 + + + ButtonColor + + + ButtonSColor + + + SelectSlideHColor + + + ArrowColor + + + ArrowSColor + + + TextColor + + + TextSColor + + 24,00 + + 230,00 + + Outline + + Bold + + 1 + + + + Invisible + + Invisible + + 975 + 45 + -1,01 + 220 + 30 + + + ButtonColor + + + ButtonSColor + + + 0 + 0 + + 30 + + 220 + + + ButtonTextColor + + + ButtonTextSColor + + Left + + Center + + + + Outline + + + + + + + + + + + + + CloseIcon + + CloseIcon + + 1215 + 42 + -1,01 + 35 + 35 + + + ButtonColor + + + ButtonSColor + + + 180 + 5 + + 30 + + 350 + + + ButtonTextColor + + + ButtonTextSColor + + Center + + Center + + + + Outline + + + + + + + + + + + + + DeleteIcon + + DeleteIcon + + 1215 + 553 + -1,01 + 35 + 35 + + + ButtonColor + + + ButtonSColor + + + 180 + 5 + + 30 + + 350 + + + ButtonTextColor + + + ButtonTextSColor + + Center + + Center + + + + Outline + + + + + + + + + + + + + SaveIcon + + SaveIcon + + 1175 + 553 + -1,01 + 35 + 35 + + + ButtonColor + + + ButtonSColor + + + 180 + 5 + + 30 + + 350 + + + ButtonTextColor + + + ButtonTextSColor + + Center + + Center + + + + Outline + + + + + + + + + + + + + SingIcon + + SingIcon + + 975 + 553 + -1,01 + 35 + 35 + + + ButtonColor + + + ButtonSColor + + + 180 + 5 + + 30 + + 350 + + + ButtonTextColor + + + ButtonTextSColor + + Center + + Center + + + + Outline + + + + + + + + + + + - \ No newline at end of file + diff --git a/Output/Themes/Ambient/Sing.png b/Output/Themes/Ambient/Sing.png new file mode 100644 index 00000000..c7daf961 Binary files /dev/null and b/Output/Themes/Ambient/Sing.png differ diff --git a/Output/Themes/Ambient/Skin Blue.xml b/Output/Themes/Ambient/Skin Blue.xml index fcbdf5f7..08caa194 100644 --- a/Output/Themes/Ambient/Skin Blue.xml +++ b/Output/Themes/Ambient/Skin Blue.xml @@ -130,6 +130,12 @@ 0,969 1,000 + + 0,675 + 0,890 + 0,969 + 0,500 + 0,675 0,890 @@ -166,6 +172,12 @@ 0,969 1,000 + + 0,675 + 0,890 + 0,969 + 0,500 + 0,675 0,890 @@ -307,6 +319,8 @@ VideoIcon.png VideoIconCO.png VideoIconBG.png + MedleyCalcIcon.png + MedleyTagIcon.png Invisible.png PlayerSelector.png PreviousIcon.png @@ -314,6 +328,11 @@ PlayIcon.png PauseIcon.png RepeatIcon.png + SongMenuBG.png + Close.png + Delete.png + Save.png + Sing.png [Blue]BG_Video.mp4 diff --git a/Output/Themes/Ambient/Skin Green.xml b/Output/Themes/Ambient/Skin Green.xml index 9d4bfb55..cfbca51f 100644 --- a/Output/Themes/Ambient/Skin Green.xml +++ b/Output/Themes/Ambient/Skin Green.xml @@ -130,6 +130,12 @@ 0,674 1,000 + + 0,709 + 0,968 + 0,674 + 0,500 + 0,709 0,968 @@ -307,6 +313,8 @@ VideoIcon.png VideoIconCO.png VideoIconBG.png + MedleyCalcIcon.png + MedleyTagIcon.png Invisible.png PlayerSelector.png PreviousIcon.png @@ -314,6 +322,11 @@ PlayIcon.png PauseIcon.png RepeatIcon.png + SongMenuBG.png + Close.png + Delete.png + Save.png + Sing.png [Green]BG_Video.mp4 diff --git a/Output/Themes/Ambient/Skin Red.xml b/Output/Themes/Ambient/Skin Red.xml index aabd3303..546b21d8 100644 --- a/Output/Themes/Ambient/Skin Red.xml +++ b/Output/Themes/Ambient/Skin Red.xml @@ -130,6 +130,12 @@ 0,674 1,000 + + 0,968 + 0,674 + 0,674 + 0,500 + 0,968 0,674 @@ -307,6 +313,8 @@ VideoIcon.png VideoIconCO.png VideoIconBG.png + MedleyCalcIcon.png + MedleyTagIcon.png Invisible.png PlayerSelector.png PreviousIcon.png @@ -314,6 +322,11 @@ PlayIcon.png PauseIcon.png RepeatIcon.png + SongMenuBG.png + Close.png + Delete.png + Save.png + Sing.png [Red]BG_Video.mp4 diff --git a/Output/Themes/Ambient/Skin Yellow.xml b/Output/Themes/Ambient/Skin Yellow.xml index 7d63647d..1a023e87 100644 --- a/Output/Themes/Ambient/Skin Yellow.xml +++ b/Output/Themes/Ambient/Skin Yellow.xml @@ -130,6 +130,12 @@ 0,674 1,000 + + 0,968 + 0,956 + 0,674 + 0,500 + 0,968 0,956 @@ -307,6 +313,8 @@ VideoIcon.png VideoIconCO.png VideoIconBG.png + MedleyCalcIcon.png + MedleyTagIcon.png Invisible.png PlayerSelector.png PreviousIcon.png @@ -314,6 +322,11 @@ PlayIcon.png PauseIcon.png RepeatIcon.png + SongMenuBG.png + Close.png + Delete.png + Save.png + Sing.png [Yellow]BG_Video.mp4 diff --git a/Output/Themes/Ambient/SongMenuBG.png b/Output/Themes/Ambient/SongMenuBG.png new file mode 100644 index 00000000..a7333adb Binary files /dev/null and b/Output/Themes/Ambient/SongMenuBG.png differ diff --git a/Output/Themes/Changelog/Changelog_ScreenSing.txt b/Output/Themes/Changelog/Changelog_ScreenSing.txt index 843fb6e9..9027a30c 100644 --- a/Output/Themes/Changelog/Changelog_ScreenSing.txt +++ b/Output/Themes/Changelog/Changelog_ScreenSing.txt @@ -6,6 +6,12 @@ Version 5 Add: and (only showed when sining duet) +++++++++++ +Version 5: + +Add: + + ++++++++++ Version 4: Added Elements for 6-player-singing! diff --git a/Output/Themes/Changelog/Changelog_ScreenSong.txt b/Output/Themes/Changelog/Changelog_ScreenSong.txt new file mode 100644 index 00000000..c1402b34 --- /dev/null +++ b/Output/Themes/Changelog/Changelog_ScreenSong.txt @@ -0,0 +1,24 @@ +ScreenSong + +++++++++++ +Version 3: + +Add: + + +, , , , , , , +, , +and + as a new Screen-Element. For details, look at ScreenSong.xml + +++++++++++ +Version 2: + +Add: + and +to SongMenu + +Add: + and +to SongMenu.SongMenuTileBoard +++++++++++ \ No newline at end of file diff --git a/Vocaluxe/Base/CConfig.cs b/Vocaluxe/Base/CConfig.cs index 4589654e..60a30d7d 100644 --- a/Vocaluxe/Base/CConfig.cs +++ b/Vocaluxe/Base/CConfig.cs @@ -933,6 +933,11 @@ namespace Vocaluxe.Base CSettings.sFileHighscoreDB = value; } break; + + case "playlistfolder": + CSettings.CreateFolder(value); + CSettings.sFolderPlaylists = value; + break; } } } diff --git a/Vocaluxe/Base/CFont.cs b/Vocaluxe/Base/CFont.cs index 0e13f8e2..1349f672 100644 --- a/Vocaluxe/Base/CFont.cs +++ b/Vocaluxe/Base/CFont.cs @@ -40,13 +40,20 @@ namespace Vocaluxe.Base class CGlyph { - public readonly float SIZEh = 50f; + private float _SIZEh = 50f; + public float SIZEh + { + get { return _SIZEh; } + } + public STexture Texture; public char Chr; public int width; - public CGlyph(char chr) + public CGlyph(char chr, float MaxHigh) { + _SIZEh = MaxHigh; + float outline = CFonts.Outline; TextFormatFlags flags = TextFormatFlags.NoPadding | TextFormatFlags.NoPrefix; @@ -152,7 +159,8 @@ namespace Vocaluxe.Base private Hashtable _htGlyphs; private PrivateFontCollection fonts; private FontFamily family; - + private float SIZEh; + public string FilePath; @@ -181,6 +189,28 @@ namespace Vocaluxe.Base _Glyphs = new List(); _htGlyphs = new Hashtable(); + + switch (CConfig.TextureQuality) + { + case ETextureQuality.TR_CONFIG_TEXTURE_LOWEST: + SIZEh = 25f; + break; + case ETextureQuality.TR_CONFIG_TEXTURE_LOW: + SIZEh = 50f; + break; + case ETextureQuality.TR_CONFIG_TEXTURE_MEDIUM: + SIZEh = 100f; + break; + case ETextureQuality.TR_CONFIG_TEXTURE_HIGH: + SIZEh = 200f; + break; + case ETextureQuality.TR_CONFIG_TEXTURE_HIGHEST: + SIZEh = 400f; + break; + default: + SIZEh = 100f; + break; + } } public void DrawGlyph(char chr, float x, float y, float h, float z, SColorF color) @@ -243,7 +273,7 @@ namespace Vocaluxe.Base return; float h = CFonts.Height; - _Glyphs.Add(new CGlyph(chr)); + _Glyphs.Add(new CGlyph(chr, SIZEh)); _htGlyphs.Add(chr, _Glyphs.Count - 1); CFonts.Height = h; } diff --git a/Vocaluxe/Base/CGame.cs b/Vocaluxe/Base/CGame.cs index 7b58e227..a6323536 100644 --- a/Vocaluxe/Base/CGame.cs +++ b/Vocaluxe/Base/CGame.cs @@ -27,6 +27,7 @@ namespace Vocaluxe.Base public int SongID; public bool Medley; public bool Duet; + public bool ShortSong; public long DateTicks; public bool SongFinished; } @@ -179,6 +180,11 @@ namespace Vocaluxe.Base return _GameMode.GetSong(Num); } + public static EGameMode GetGameMode(int Num) + { + return _GameMode.GetGameMode(Num); + } + public static int GetNumSongs() { return _GameMode.GetNumSongs(); @@ -189,6 +195,11 @@ namespace Vocaluxe.Base return _GameMode.GetPoints(); } + public static int NumRounds + { + get { return _GameMode.GetNumSongs(); } + } + public static int NumPlayer { get { return _NumPlayer; } @@ -214,6 +225,7 @@ namespace Vocaluxe.Base _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; } diff --git a/Vocaluxe/Base/CPlaylists.cs b/Vocaluxe/Base/CPlaylists.cs new file mode 100644 index 00000000..c9babd16 --- /dev/null +++ b/Vocaluxe/Base/CPlaylists.cs @@ -0,0 +1,109 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Text; +using System.Xml; +using System.Xml.XPath; + +using Vocaluxe.Lib.Song; +using Vocaluxe.Lib.Playlist; + +namespace Vocaluxe.Base +{ + + static class CPlaylists + { + private static List _Playlists; + private static CHelper Helper = new CHelper(); + + public static CPlaylistFile[] Playlists + { + get { return _Playlists.ToArray(); } + } + + public static string[] PlaylistNames + { + get + { + List names = new List(); + for (int i = 0; i < _Playlists.Count; i++) + { + names.Add(_Playlists[i].PlaylistName); + } + return names.ToArray(); + } + } + + public static int NumPlaylists + { + get { return _Playlists.Count; } + } + + public static void Init() + { + LoadPlaylists(); + } + + public static void LoadPlaylists() + { + _Playlists = new List(); + List files = new List(); + files.AddRange(Helper.ListFiles(CSettings.sFolderPlaylists, "*.xml", true, true)); + + foreach (string file in files) + { + CPlaylistFile playlist = new CPlaylistFile(file); + _Playlists.Add(playlist); + } + + SortPlaylistsByName(); + } + + #region private methods + + private static void SortPlaylistsByName() + { + _Playlists.Sort(CompareByPlaylistName); + } + + private static int CompareByPlaylistName(CPlaylistFile a, CPlaylistFile b) + { + return String.Compare(a.PlaylistName, b.PlaylistName); + } + + public static void DeletePlaylist(int PlaylistID) + { + if (PlaylistID < 0 || PlaylistID >= _Playlists.Count) + return; + if (_Playlists[PlaylistID].PlaylistFile != String.Empty) + { + try + { + File.Delete(_Playlists[PlaylistID].PlaylistFile); + _Playlists.RemoveAt(PlaylistID); + } + catch (Exception) + { + CLog.LogError("Can't delete Profile File " + _Playlists[PlaylistID].PlaylistFile + ".xml"); + } + } + } + + public static void SavePlaylist(int PlaylistID) + { + if (PlaylistID < 0 || PlaylistID >= _Playlists.Count) + return; + _Playlists[PlaylistID].SavePlaylist(); + } + + public static int NewPlaylist() + { + CPlaylistFile pl = new CPlaylistFile(); + pl.PlaylistName = "New Playlist"; + _Playlists.Add(pl); + return (_Playlists.Count - 1); + } + + #endregion + } +} diff --git a/Vocaluxe/Base/CSettings.cs b/Vocaluxe/Base/CSettings.cs index 6e5cd75c..71b851c2 100644 --- a/Vocaluxe/Base/CSettings.cs +++ b/Vocaluxe/Base/CSettings.cs @@ -94,6 +94,7 @@ namespace Vocaluxe.Base public const string sFolderLanguages = "Languages"; public const string sFolderScreenshots = "Screenshots"; public const string sFolderBackgroundMusic = "BackgroundMusic"; + public static string sFolderPlaylists = "Playlists"; //public const String[] ToneStrings = new String[]{ "C", "C#", "D", "D#", "E", "F", "F#", "G", "G#", "A", "A#", "B" }; public const int ToneMin = -36; @@ -112,6 +113,11 @@ namespace Vocaluxe.Base public const float LyricHelperMoveTime = 1.5f; public const float LyricHelperMinTime = 0.2f; + public const float DefaultMedleyFadeInTime = 8f; + public const float DefaultMedleyFadeOutTime = 2f; + public const int MedleyMinSeriesLength = 3; + public const float MedleyMinDuration = 40f; + public static bool TabNavigation = false; public const float BackgroundMusicFadeTime = 0.5f; @@ -179,6 +185,7 @@ namespace Vocaluxe.Base Folders.Add(sFolderScreenshots); Folders.Add(sFolderBackgroundMusic); Folders.Add(sFolderSounds); + Folders.Add(sFolderPlaylists); foreach (string folder in Folders) { @@ -187,5 +194,11 @@ namespace Vocaluxe.Base Directory.CreateDirectory(path); } } + + public static void CreateFolder(string path) + { + if (!Directory.Exists(path)) + Directory.CreateDirectory(path); + } } } diff --git a/Vocaluxe/Doc/Roadmap.txt b/Vocaluxe/Doc/Roadmap.txt index 5cbb31b5..7a73c9ed 100644 --- a/Vocaluxe/Doc/Roadmap.txt +++ b/Vocaluxe/Doc/Roadmap.txt @@ -71,31 +71,34 @@ - PortAudio Record and Playback ------------------------------------------------------------- -+ v0.1.0: ++ v0.1.0 (reached: 07.04.2012): - Menu Background Music + - Jukebox light (bg music controls) - Theme System Update - A nicer Theme! + v0.2.0: - Medley - - WiiMote Support - - Jukebox light (bg music controls) - - Show Avatars and Player Name in Sing Screen (and perhaps some other screens) + - Sing Short Version Mode + - Show Avatars and Player Name in Sing Screen - New Lyric Effects + - More Player at once (up to 6) + - Duet (full support, choose/toggle names) + - Playlist-Support + - Spectrum Analyzer (Record Screen and Player Selection Screen) ----------------- just some ideas: + - WiiMote Support - Installer - More Song List Views - Tile Board: Show title and artist under each tile - OnScreen Keyboard? - Kinect Support? - Help System - - Party Mode: Casting Show - - More Player at once - - Mark newly added songs - - Playlist-Support + - Party Mode: Casting Show + - Mark newly added songs - Theme Editor - Jukebox - Tournament Mode @@ -103,5 +106,4 @@ just some ideas: - Party Mode: Tic, Tac, Toe - Party Mode: 4 in a row - Challenge Mode (with more than 2 player at once) - - Song Editor - - Duet (full support, choose/toggle names) \ No newline at end of file + - Song Editor \ No newline at end of file diff --git a/Vocaluxe/GameModes/CGameMode.cs b/Vocaluxe/GameModes/CGameMode.cs index 86e0a9c5..b58ca133 100644 --- a/Vocaluxe/GameModes/CGameMode.cs +++ b/Vocaluxe/GameModes/CGameMode.cs @@ -39,12 +39,13 @@ namespace Vocaluxe.GameModes _Rounds[round, player].PointsLineBonus = 0f; _Rounds[round, player].Medley = false; _Rounds[round, player].Duet = false; + _Rounds[round, player].ShortSong = false; _Rounds[round, player].SongFinished = false; } } } - public void SetPoints(int Round, int SongID, SPlayer[] Player, bool Medley, bool Duet) + public void SetPoints(int Round, int SongID, SPlayer[] Player, bool Medley, bool Duet, bool ShortSong) { long DateTicks = DateTime.Now.Ticks; for (int player = 0; player < Player.Length; player++) @@ -56,6 +57,7 @@ namespace Vocaluxe.GameModes _Rounds[Round, player].PointsLineBonus = Player[player].PointsLineBonus; _Rounds[Round, player].Medley = Medley; _Rounds[Round, player].Duet = Duet; + _Rounds[Round, player].ShortSong = ShortSong; _Rounds[Round, player].DateTicks = DateTicks; _Rounds[Round, player].SongFinished = Player[player].SongFinished; } @@ -91,6 +93,7 @@ namespace Vocaluxe.GameModes 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; player[p].DateTicks = _Rounds[Round, p].DateTicks; player[p].SongFinished = _Rounds[Round, p].SongFinished; player[p].ProfileID = _Rounds[Round, p].ProfileID; @@ -119,7 +122,7 @@ namespace Vocaluxe.GameModes { return _SongQueque[_CurrentSong].GameMode; } - return EGameMode.Normal; + return EGameMode.TR_GAMEMODE_NORMAL; } public virtual bool AddVisibleSong(int VisibleIndex, EGameMode GameMode) @@ -127,7 +130,7 @@ namespace Vocaluxe.GameModes if (CSongs.VisibleSongs.Length > VisibleIndex) { int SongID = CSongs.VisibleSongs[VisibleIndex].ID; - if (GameMode == EGameMode.Duet && !CSongs.GetSong(SongID).IsDuet) + if (GameMode == EGameMode.TR_GAMEMODE_DUET && !CSongs.GetSong(SongID).IsDuet) return false; _SongQueque.Add(new SongQueque(SongID, GameMode)); @@ -141,7 +144,7 @@ namespace Vocaluxe.GameModes if (CSongs.AllSongs.Length > AbsoluteIndex) { int SongID = CSongs.AllSongs[AbsoluteIndex].ID; - if (GameMode == EGameMode.Duet && !CSongs.GetSong(SongID).IsDuet) + if (GameMode == EGameMode.TR_GAMEMODE_DUET && !CSongs.GetSong(SongID).IsDuet) return false; _SongQueque.Add(new SongQueque(SongID, GameMode)); @@ -188,7 +191,6 @@ namespace Vocaluxe.GameModes break; } } - if (index == -1) return false; @@ -223,8 +225,9 @@ namespace Vocaluxe.GameModes _CurrentSong, _SongQueque[_CurrentSong].SongID, Player, - _SongQueque[_CurrentSong].GameMode == EGameMode.Medley, - _SongQueque[_CurrentSong].GameMode == EGameMode.Duet); + _SongQueque[_CurrentSong].GameMode == EGameMode.TR_GAMEMODE_MEDLEY, + _SongQueque[_CurrentSong].GameMode == EGameMode.TR_GAMEMODE_DUET, + _SongQueque[_CurrentSong].GameMode == EGameMode.TR_GAMEMODE_SHORTSONG); } _CurrentSong++; } @@ -244,7 +247,32 @@ namespace Vocaluxe.GameModes { if (_CurrentSong >= 0 && _CurrentSong < _SongQueque.Count) { - return CSongs.GetSong(_SongQueque[_CurrentSong].SongID); + CSong song = CSongs.GetSong(_SongQueque[_CurrentSong].SongID); + song = new CSong(song); + + switch (GetCurrentGameMode()) + { + case EGameMode.TR_GAMEMODE_MEDLEY: + // set medley mode timings + song.Start = CGame.GetTimeFromBeats(song.Medley.StartBeat, song.BPM) - song.Medley.FadeInTime + song.Gap; + if (song.Start < 0f) + song.Start = 0f; + + song.Finish = CGame.GetTimeFromBeats(song.Medley.EndBeat, song.BPM) + song.Medley.FadeOutTime + song.Gap; + + // set lines to medley mode + song.Notes.SetMedley(song.Medley.StartBeat, song.Medley.EndBeat); + break; + + case EGameMode.TR_GAMEMODE_SHORTSONG: + 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); + break; + } + + return song; } return null; } @@ -262,10 +290,22 @@ namespace Vocaluxe.GameModes return null; } + public virtual EGameMode GetGameMode(int Num) + { + if(Num - 1 < _SongQueque.Count && Num > -1) + return _SongQueque[Num].GameMode; + + return EGameMode.TR_GAMEMODE_NORMAL; + } + public virtual CPoints GetPoints() { return _Points; } #endregion Implementation + + protected virtual void SongManipulation(int SongIndex) + { + } } } diff --git a/Vocaluxe/GameModes/CGameModeNormal.cs b/Vocaluxe/GameModes/CGameModeNormal.cs index 4a66383c..5f05bd6c 100644 --- a/Vocaluxe/GameModes/CGameModeNormal.cs +++ b/Vocaluxe/GameModes/CGameModeNormal.cs @@ -10,7 +10,7 @@ namespace Vocaluxe.GameModes public override void Init() { base.Init(); - + _Initialized = true; } } diff --git a/Vocaluxe/GameModes/IGameMode.cs b/Vocaluxe/GameModes/IGameMode.cs index 6a1572f4..79a8fefc 100644 --- a/Vocaluxe/GameModes/IGameMode.cs +++ b/Vocaluxe/GameModes/IGameMode.cs @@ -9,9 +9,10 @@ namespace Vocaluxe.GameModes { public enum EGameMode { - Normal, - Medley, - Duet + TR_GAMEMODE_NORMAL, + TR_GAMEMODE_MEDLEY, + TR_GAMEMODE_DUET, + TR_GAMEMODE_SHORTSONG } interface IGameMode @@ -37,5 +38,6 @@ namespace Vocaluxe.GameModes int GetNumSongs(); CSong GetSong(); CSong GetSong(int Num); + EGameMode GetGameMode(int Num); } } diff --git a/Vocaluxe/Lib/Playlist/CPlaylistFile.cs b/Vocaluxe/Lib/Playlist/CPlaylistFile.cs new file mode 100644 index 00000000..79588ef1 --- /dev/null +++ b/Vocaluxe/Lib/Playlist/CPlaylistFile.cs @@ -0,0 +1,253 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Text; +using System.Xml; +using System.Xml.XPath; + +using Vocaluxe.Base; +using Vocaluxe.GameModes; +using Vocaluxe.Lib.Song; + + +namespace Vocaluxe.Lib.Playlist +{ + public class CPlaylistSong + { + public int SongID; + public EGameMode GameMode; + + public CPlaylistSong(int SongID, EGameMode gm) + { + this.SongID = SongID; + this.GameMode = gm; + } + + public CPlaylistSong() + { + GameMode = EGameMode.TR_GAMEMODE_NORMAL; + } + } + + public class CPlaylistFile + { + private static XmlWriterSettings _settings = new XmlWriterSettings(); + private static CHelper Helper = new CHelper(); + + public string PlaylistName; + public string PlaylistFile; + public List Songs = new List(); + + public CPlaylistFile() + { + Init(); + PlaylistName = string.Empty; + PlaylistFile = string.Empty; + } + + public CPlaylistFile(string file) + { + Init(); + PlaylistFile = file; + LoadPlaylist(); + } + + private void Init() + { + _settings.Indent = true; + _settings.Encoding = System.Text.Encoding.UTF8; + _settings.ConformanceLevel = ConformanceLevel.Document; + } + + + public void SavePlaylist() + { + if (PlaylistFile == string.Empty) + { + string filename = string.Empty; + foreach (char chr in PlaylistName) + { + if (char.IsLetter(chr)) + filename += chr.ToString(); + } + + if (filename == String.Empty) + filename = "1"; + + int i = 0; + while (File.Exists(Path.Combine(CSettings.sFolderPlaylists, filename + ".xml"))) + { + i++; + if (!File.Exists(Path.Combine(CSettings.sFolderPlaylists, filename + i + ".xml"))) + { + filename += i; + } + } + + PlaylistFile = Path.Combine(CSettings.sFolderPlaylists, filename + ".xml"); + } + + XmlWriter writer; + try + { + writer = XmlWriter.Create(PlaylistFile, _settings); + } + catch (Exception e) + { + CLog.LogError("Error creating/opening Playlist File " + PlaylistFile + ": " + e.Message); + return; + } + + if (writer == null) + { + CLog.LogError("Error creating/opening Playlist File " + PlaylistFile); + return; + } + + writer.WriteStartDocument(); + writer.WriteStartElement("root"); + + writer.WriteStartElement("Info"); + writer.WriteElementString("PlaylistName", PlaylistName); + writer.WriteEndElement(); + + writer.WriteStartElement("Songs"); + for (int i = 0; i < Songs.Count; i++) + { + CSong song = CSongs.GetSong(Songs[i].SongID); + if (song != null) + { + writer.WriteStartElement("Song" + (i + 1).ToString()); + writer.WriteElementString("Artist", song.Artist); + writer.WriteElementString("Title", song.Title); + writer.WriteElementString("GameMode", Enum.GetName(typeof(EGameMode), Songs[i].GameMode)); + writer.WriteEndElement(); + } + else + { + CLog.LogError("Playlist.SavePlaylist(): Can't find Song. This should never happen!"); + } + } + writer.WriteEndElement(); + + writer.WriteEndElement(); //end of root + writer.WriteEndDocument(); + + writer.Flush(); + writer.Close(); + } + + private void LoadPlaylist() + { + bool loaded = false; + XPathDocument xPathDoc = null; + XPathNavigator navigator = null; + + try + { + xPathDoc = new XPathDocument(PlaylistFile); + navigator = xPathDoc.CreateNavigator(); + loaded = true; + } + catch (Exception e) + { + loaded = false; + if (navigator != null) + navigator = null; + + if (xPathDoc != null) + xPathDoc = null; + + CLog.LogError("Error opening Playlist File " + PlaylistFile + ": " + e.Message); + } + + if (loaded) + { + string value = String.Empty; + if (CHelper.GetValueFromXML("//root/Info/PlaylistName", navigator, ref value, value)) + { + PlaylistName = value; + + Songs = new List(); + + List songs = CHelper.GetValuesFromXML("Songs", navigator); + string artist = String.Empty; + string title = String.Empty; + EGameMode gm = EGameMode.TR_GAMEMODE_NORMAL; + + for (int i = 0; i < songs.Count; i++) + { + CHelper.GetValueFromXML("//root/Songs/" + songs[i] + "/Artist", navigator, ref artist, String.Empty); + CHelper.GetValueFromXML("//root/Songs/" + songs[i] + "/Title", navigator, ref title, String.Empty); + CHelper.TryGetEnumValueFromXML("//root/Songs/" + songs[i] + "/GameMode", navigator, ref gm); + + CPlaylistSong song = new CPlaylistSong(); + song.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; + } + } + + if (song.SongID != -1) + { + song.GameMode = gm; + Songs.Add(song); + } + } + } + else + { + CLog.LogError("Can't find PlaylistName in Playlist File: " + PlaylistFile); + } + } + } + + 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; + + Songs.Add(song); + } + + public void AddSong(int SongID, EGameMode gm) + { + CPlaylistSong song = new CPlaylistSong(); + song.SongID = SongID; + song.GameMode = gm; + + Songs.Add(song); + } + + public void DeleteSong(int SongNr) + { + Songs.RemoveAt(SongNr); + } + + public void SongUp(int SongNr) + { + if (SongNr != 0) + { + Songs.Reverse(SongNr - 1, 2); + } + } + + public void SongDown(int SongNr) + { + if (SongNr < Songs.Count - 1) + { + Songs.Reverse(SongNr, 2); + } + } + } +} diff --git a/Vocaluxe/Lib/Song/CNotes.cs b/Vocaluxe/Lib/Song/CNotes.cs index edd3b6d3..d6203ca0 100644 --- a/Vocaluxe/Lib/Song/CNotes.cs +++ b/Vocaluxe/Lib/Song/CNotes.cs @@ -6,7 +6,7 @@ using Vocaluxe.Base; namespace Vocaluxe.Lib.Song { - class CNotes + class CNotes { private List _Lines = new List(); @@ -15,6 +15,18 @@ namespace Vocaluxe.Lib.Song get { return _Lines.ToArray(); } } + public CNotes() + { + } + + public CNotes(CNotes notes) + { + foreach (CLines lines in notes._Lines) + { + _Lines.Add(new CLines(lines)); + } + } + public CLines GetLines(int Index) { while (Index >= _Lines.Count) @@ -60,6 +72,13 @@ namespace Vocaluxe.Lib.Song _Lines.Clear(); } + public void SetMedley(int StartBeat, int EndBeat) + { + foreach (CLines lines in _Lines) + { + lines.SetMedley(StartBeat, EndBeat); + } + } } public enum ENoteType @@ -91,6 +110,17 @@ namespace Vocaluxe.Lib.Song _Perfect = false; } + public CNote(CNote note) + { + _StartBeat = note._StartBeat; + _Duration = note._Duration; + _Tone = note._Tone; + _NoteType = note._NoteType; + _Text = note._Text; + _Hit = note._Hit; + _Perfect = note._Perfect; + } + public CNote(int StartBeat, int Duration, int Tone, string Text) : this() { @@ -250,22 +280,43 @@ namespace Vocaluxe.Lib.Song private int _StartBeat; private int _EndBeat; private bool _PerfectLine; // for drawing perfect line effect + private bool _VisibleInTimeLine; private int _MinBeat = int.MaxValue; private int _MaxBeat = int.MinValue; - private List _Notes; + private List _Notes = new List(); #region Constructors public CLine() { - _Notes = new List(); StartBeat = int.MinValue; EndBeat = int.MaxValue; _PerfectLine = false; + _VisibleInTimeLine = true; + } + + public CLine(CLine line) + { + foreach (CNote note in line._Notes) + { + _Notes.Add(new CNote(note)); + } + _StartBeat = line._StartBeat; + _EndBeat = line._EndBeat; + _PerfectLine = line._PerfectLine; + _MinBeat = line._MinBeat; + _MaxBeat = line._MaxBeat; + _VisibleInTimeLine = line._VisibleInTimeLine; } #endregion Constructors #region Properties + public bool VisibleInTimeLine + { + get { return _VisibleInTimeLine; } + set { _VisibleInTimeLine = value; } + } + public int StartBeat { get { return _StartBeat; } @@ -292,7 +343,7 @@ namespace Vocaluxe.Lib.Song set { _PerfectLine = value; } } - public int FirstBeat + public int FirstNoteBeat { get { @@ -300,7 +351,7 @@ namespace Vocaluxe.Lib.Song } } - public int LastBeat + public int LastNoteBeat { get { @@ -465,6 +516,17 @@ namespace Vocaluxe.Lib.Song _MaxBeat = int.MinValue; } + public void SetMedley(int StartBeat, int EndBeat) + { + foreach (CNote note in _Notes) + { + if (note.StartBeat < StartBeat || note.EndBeat > EndBeat) + note.NoteType = ENoteType.Freestyle; + } + + _VisibleInTimeLine = _MinBeat >= StartBeat && _MaxBeat <= EndBeat; + } + private void updateMinMaxBeat(CNote Note) { if (Note.StartBeat < _MinBeat) @@ -487,16 +549,24 @@ namespace Vocaluxe.Lib.Song updateMinMaxBeat(note); } } + #endregion Methods } public class CLines { - private List _Lines; + private List _Lines = new List(); public CLines() { - _Lines = new List(); + } + + public CLines(CLines lines) + { + foreach (CLine line in lines._Lines) + { + _Lines.Add(new CLine(line)); + } } public CLine[] Line @@ -521,15 +591,15 @@ namespace Vocaluxe.Lib.Song int startbeat = int.MaxValue; for (int i = 0; i < _Lines.Count; i++) { - if (_Lines[i].FirstBeat < startbeat) - startbeat = _Lines[i].FirstBeat; + if (_Lines[i].FirstNoteBeat < startbeat) + startbeat = _Lines[i].FirstNoteBeat; } int endbeat = int.MinValue; for (int i = 0; i < _Lines.Count; i++) { - if (_Lines[i].LastBeat < endbeat) - endbeat = _Lines[i].LastBeat; + if (_Lines[i].LastNoteBeat < endbeat) + endbeat = _Lines[i].LastNoteBeat; } int result = endbeat - startbeat; @@ -688,6 +758,13 @@ namespace Vocaluxe.Lib.Song } } + public void SetMedley(int StartBeat, int EndBeat) + { + foreach (CLine line in _Lines) + { + line.SetMedley(StartBeat, EndBeat); + } + } #endregion Methods } } diff --git a/Vocaluxe/Lib/Song/CSong.cs b/Vocaluxe/Lib/Song/CSong.cs index 6e7ff885..1b874dfc 100644 --- a/Vocaluxe/Lib/Song/CSong.cs +++ b/Vocaluxe/Lib/Song/CSong.cs @@ -7,19 +7,45 @@ using System.Text.RegularExpressions; using Vocaluxe.Base; using Vocaluxe.Lib.Draw; using Vocaluxe.Menu; +using Vocaluxe.GameModes; namespace Vocaluxe.Lib.Song { [Flags] enum EHeaderFlags { - Title, - Artist, - MP3, - BPM, - PreviewStart, - MedleyStartBeat, - MedleyEndBeat + Title = 1, + Artist = 2, + MP3 = 4, + BPM = 8, + PreviewStart = 16, + MedleyStartBeat = 32, + MedleyEndBeat = 64 + } + + enum EMedleySource + { + None, + Calculated, + Tag + } + + struct SMedley + { + public EMedleySource Source; + public int StartBeat; + public int EndBeat; + public float FadeInTime; + public float FadeOutTime; + + public SMedley(int dummy) + { + Source = EMedleySource.None; + StartBeat = 0; + EndBeat = 0; + FadeInTime = 0f; + FadeOutTime = 0f; + } } class CSong @@ -29,10 +55,18 @@ namespace Vocaluxe.Lib.Song private STexture _CoverTextureSmall = new STexture(-1); private STexture _CoverTextureBig = new STexture(-1); + public SMedley Medley = new SMedley(0); + + public bool CalculateMedley = true; + public float PreviewStart = 0f; + + public int ShortEnd = 0; + public Encoding Encoding = Encoding.Default; public string Folder = String.Empty; public string FolderName = String.Empty; public string FileName = String.Empty; + public EOffOn Relative = EOffOn.TR_CONFIG_OFF; public string MP3FileName = String.Empty; public string CoverFileName = String.Empty; @@ -45,14 +79,12 @@ namespace Vocaluxe.Lib.Song { get { return _CoverLoaded; } } - public bool NotesLoaded { get { return _NotesLoaded; } } public bool CoverBigLoaded = false; - public bool BackgroundLoaded = false; public STexture CoverTextureSmall { @@ -89,8 +121,6 @@ namespace Vocaluxe.Lib.Song set { _CoverTextureBig = value; } } - public CBackground Background = new CBackground(); - public string Title = String.Empty; public string Artist = String.Empty; @@ -127,6 +157,104 @@ namespace Vocaluxe.Lib.Song // Notes public 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); + if (Medley.Source != EMedleySource.None) + gms.Add(EGameMode.TR_GAMEMODE_MEDLEY); + gms.Add(EGameMode.TR_GAMEMODE_SHORTSONG); + + return gms.ToArray(); + } + } + + public CSong() + { + } + + public CSong(CSong song) + { + this._CoverTextureSmall = song._CoverTextureSmall; + this._CoverTextureBig = song._CoverTextureBig; + + this.Medley = new SMedley(); + this.Medley.Source = song.Medley.Source; + this.Medley.StartBeat = song.Medley.StartBeat; + this.Medley.EndBeat = song.Medley.EndBeat; + this.Medley.FadeInTime = song.Medley.FadeInTime; + this.Medley.FadeOutTime = song.Medley.FadeOutTime; + + this.CalculateMedley = song.CalculateMedley; + this.PreviewStart = song.PreviewStart; + + this.ShortEnd = song.ShortEnd; + + this.Encoding = song.Encoding; + this.Folder = song.Folder; + this.FolderName = song.FolderName; + this.FileName = song.FileName; + this.Relative = song.Relative; + + this.MP3FileName = song.MP3FileName; + this.CoverFileName = song.CoverFileName; + this.BackgroundFileName = song.BackgroundFileName; + this.VideoFileName = song.VideoFileName; + + this.VideoAspect = song.VideoAspect; + this._CoverLoaded = song._CoverLoaded; + this.CoverBigLoaded = song.CoverBigLoaded; + this._NotesLoaded = song._NotesLoaded; + + this.Artist = song.Artist; + this.Title = song.Title; + + this.Start = song.Start; + this.Finish = song.Finish; + + this.BPM = song.BPM; + this.Gap = song.Gap; + this.VideoGap = song.VideoGap; + + this.Comment = new List(); + foreach (string value in song.Comment) + { + this.Comment.Add(value); + } + + this.ID = song.ID; + this.Visible = song.Visible; + this.CatIndex = song.CatIndex; + this.Selected = song.Selected; + + this.Edition = new List(); + foreach (string value in song.Edition) + { + this.Edition.Add(value); + } + + this.Genre = new List(); + foreach (string value in song.Genre) + { + this.Genre.Add(value); + } + + this.Year = song.Year; + + this.Language = new List(); + foreach (string value in song.Language) + { + this.Language.Add(value); + } + + this.Notes = new CNotes(song.Notes); + } + public string GetMP3() { return Path.Combine(Folder, MP3FileName); @@ -348,6 +476,29 @@ namespace Vocaluxe.Lib.Song if (CHelper.TryParse(Value, out this.Finish)) this.Finish /= 1000f; break; + case "PREVIEWSTART": + if (CHelper.TryParse(Value, out this.PreviewStart)) + if (this.PreviewStart < 0f) + this.PreviewStart = 0f; + else + HeaderFlags |= EHeaderFlags.PreviewStart; + break; + case "MEDLEYSTARTBEAT": + if (int.TryParse(Value, out this.Medley.StartBeat)) + HeaderFlags |= EHeaderFlags.MedleyStartBeat; + break; + case "MEDLEYENDBEAT": + if (int.TryParse(Value, out this.Medley.EndBeat)) + HeaderFlags |= EHeaderFlags.MedleyEndBeat; + break; + case "CALCMEDLEY": + if (Value.ToUpper() == "OFF") + this.CalculateMedley = false; + break; + case "RELATIVE": + if (Value.ToUpper() == "YES" && Value.ToUpper() != "NO") + this.Relative = EOffOn.TR_CONFIG_ON; + break; default: ; break; @@ -363,13 +514,70 @@ namespace Vocaluxe.Lib.Song } } //end of while - if (HeaderFlags != (EHeaderFlags.Title | EHeaderFlags.Artist | EHeaderFlags.MP3 | EHeaderFlags.BPM)) + if ((HeaderFlags & EHeaderFlags.Title) == 0) + { + CLog.LogError("Title tag missing: " + FilePath); return false; + } + + if ((HeaderFlags & EHeaderFlags.Artist) == 0) + { + CLog.LogError("Artist tag missing: " + FilePath); + return false; + } + + if ((HeaderFlags & EHeaderFlags.MP3) == 0) + { + CLog.LogError("MP3 tag missing: " + FilePath); + return false; + } + + if ((HeaderFlags & EHeaderFlags.BPM) == 0) + { + CLog.LogError("BPM tag missing: " + FilePath); + return false; + } + + if (this.Relative == EOffOn.TR_CONFIG_ON) + { + CLog.LogError("Relative songs are not supported by Vocaluxe (perhaps later)! (" + FilePath + ")"); + return false; + } + + #region check medley tags + if ((HeaderFlags & EHeaderFlags.MedleyStartBeat) != 0 && (HeaderFlags & EHeaderFlags.MedleyEndBeat) != 0) + { + if (this.Medley.StartBeat > this.Medley.EndBeat) + { + CLog.LogError("MedleyStartBeat is bigger than MedleyEndBeat in file: " + FilePath); + HeaderFlags = HeaderFlags - EHeaderFlags.MedleyStartBeat - EHeaderFlags.MedleyEndBeat; + } + } + + if ((HeaderFlags & EHeaderFlags.PreviewStart) == 0 || this.PreviewStart == 0f) + { + //PreviewStart is not set or <=0 + if ((HeaderFlags & EHeaderFlags.MedleyStartBeat) != 0) + //fallback to MedleyStart + this.PreviewStart = CGame.GetTimeFromBeats(this.Medley.StartBeat, this.BPM); + else + //else set to 0, it will be set in FindRefrainStart + this.PreviewStart = 0f; + } + + if ((HeaderFlags & EHeaderFlags.MedleyStartBeat) != 0 && (HeaderFlags & EHeaderFlags.MedleyEndBeat) != 0) + { + this.Medley.Source = EMedleySource.Tag; + this.Medley.FadeInTime = CSettings.DefaultMedleyFadeInTime; + this.Medley.FadeOutTime = CSettings.DefaultMedleyFadeOutTime; + } + #endregion check medley tags this.Encoding = sr.CurrentEncoding; } - catch (Exception) + catch (Exception e) { + CLog.LogError("Error reading txt header in file \"" + FilePath + "\": " + e.Message); return false; } @@ -502,7 +710,7 @@ namespace Vocaluxe.Lib.Song char chr = (char)sr.Read(); Param1 = CHelper.TryReadInt(sr); - + NewSentence(Player, Param1); isNewSentence = true; @@ -525,6 +733,8 @@ namespace Vocaluxe.Lib.Song CLog.LogError("Error loading song. Line No.: " + FileLineNo.ToString() + ". An unhandled exception occured (" + e.Message + "): " + FilePath); return false; } + FindRefrain(); + FindShortEnd(); _NotesLoaded = true; if(IsDuet) CheckDuet(); @@ -607,5 +817,210 @@ namespace Vocaluxe.Lib.Song CLog.LogError("Warning: Can't find #P2-tag for duets in \"" + this.Artist + " - " + this.Title + "\"."); } } + + private struct Series + { + public int start; + public int end; + public int length; + } + + private void FindRefrain() + { + if (this.IsDuet) + { + this.Medley.Source = EMedleySource.None; + return; + } + + if (this.Medley.Source == EMedleySource.Tag) + return; + + if (!this.CalculateMedley) + return; + + CLines lines = this.Notes.GetLines(0); + + if (lines.LineCount == 0) + return; + + // build sentences list + List sentences = new List(); + foreach (CLine line in lines.Line) + { + if (line.Points != 0) + sentences.Add(line.Lyrics); + else + sentences.Add(String.Empty); + } + + // find equal sentences series + List series = new List(); + for (int i = 0; i < lines.LineCount - 1; i++) + { + for (int j = i + 1; j < lines.LineCount; j++) + { + if (sentences[i] == sentences[j] && sentences[i] != String.Empty) + { + Series tempSeries = new Series(); + tempSeries.start = i; + tempSeries.end = i; + + int max = 0; + if (j + j - i - 1 > lines.LineCount - 1) + max = lines.LineCount - 1 - j; + else + max = j - i - 1; + + for (int k = 1; k <= max; k++) + { + if (sentences[i + k] == sentences[j + k] && sentences[i + k] != String.Empty) + tempSeries.end = i + k; + else + break; + } + + tempSeries.length = tempSeries.end - tempSeries.start + 1; + series.Add(tempSeries); + } + } + } + + // search for longest series + int longest = 0; + for (int i = 0; i < series.Count; i++) + { + if (series[i].length > series[longest].length) + longest = i; + } + + // set medley vars + if (series.Count > 0 && series[longest].length > CSettings.MedleyMinSeriesLength) + { + this.Medley.StartBeat = lines.Line[series[longest].start].FirstNoteBeat; + this.Medley.EndBeat = lines.Line[series[longest].end].LastNoteBeat; + + bool foundEnd = false; + + // set end if duration > MedleyMinDuration + if (CGame.GetTimeFromBeats(this.Medley.StartBeat, this.BPM) + CSettings.MedleyMinDuration > + CGame.GetTimeFromBeats(this.Medley.EndBeat, this.BPM)) + foundEnd = true; + + if (!foundEnd) + { + for (int i = series[longest].start + 1; i < lines.LineCount - 1; i++) + { + if (CGame.GetTimeFromBeats(this.Medley.StartBeat, this.BPM) + CSettings.MedleyMinDuration > + CGame.GetTimeFromBeats(lines.Line[i].LastNoteBeat, this.BPM)) + { + foundEnd = true; + this.Medley.EndBeat = lines.Line[i].LastNoteBeat; + } + } + } + + if (foundEnd) + { + this.Medley.Source = EMedleySource.Calculated; + this.Medley.FadeInTime = CSettings.DefaultMedleyFadeInTime; + this.Medley.FadeOutTime = CSettings.DefaultMedleyFadeOutTime; + } + } + + if (this.PreviewStart == 0f) + { + if (this.Medley.Source == EMedleySource.Calculated) + this.PreviewStart = CGame.GetTimeFromBeats(this.Medley.StartBeat, this.BPM); + } + } + + private void FindShortEnd(){ + CLines lines = this.Notes.GetLines(0); + + if (lines.LineCount == 0) + return; + + // build sentences list + List sentences = new List(); + foreach (CLine line in lines.Line) + { + if (line.Points != 0) + sentences.Add(line.Lyrics); + else + sentences.Add(String.Empty); + } + + // find equal sentences series + List series = new List(); + for (int i = 0; i < lines.LineCount - 1; i++) + { + for (int j = i + 1; j < lines.LineCount; j++) + { + if (sentences[i] == sentences[j] && sentences[i] != String.Empty) + { + Series tempSeries = new Series(); + tempSeries.start = i; + tempSeries.end = i; + + int max = 0; + if (j + j - i - 1 > lines.LineCount - 1) + max = lines.LineCount - 1 - j; + else + max = j - i - 1; + + for (int k = 1; k <= max; k++) + { + if (sentences[i + k] == sentences[j + k] && sentences[i + k] != String.Empty) + tempSeries.end = i + k; + else + break; + } + + tempSeries.length = tempSeries.end - tempSeries.start + 1; + series.Add(tempSeries); + } + } + } + + //Calculate length of singing + int stop = (lines.Line[lines.Line.Length - 1].LastNoteBeat - lines.Line[0].FirstNoteBeat) / 2; + + //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 (stop < (lines.Line[series[i].start].FirstNoteBeat + ((lines.Line[series[i].end].LastNoteBeat - lines.Line[series[i].start].FirstNoteBeat) / 2))) + { + this.ShortEnd = lines.Line[series[i].start-1].LastNote.EndBeat; + return; + } + else + { + this.ShortEnd = lines.Line[series[i].end].LastNote.EndBeat; + return; + } + } + } + + //Check if stop is in line + for (int i = 0; i < lines.Line.Length; i++) + { + if (lines.Line[i].FirstNoteBeat < stop && lines.Line[i].LastNoteBeat > stop) + { + this.ShortEnd = lines.Line[i].LastNoteBeat; + return; + } + } + + ShortEnd = stop; + + } + + public object Clone() + { + return base.MemberwiseClone(); + } } } diff --git a/Vocaluxe/Lib/Sound/COpenALPlay.cs b/Vocaluxe/Lib/Sound/COpenALPlay.cs index 99215d7a..85e17cd4 100644 --- a/Vocaluxe/Lib/Sound/COpenALPlay.cs +++ b/Vocaluxe/Lib/Sound/COpenALPlay.cs @@ -804,7 +804,7 @@ namespace Vocaluxe.Lib.Sound { AL.GetSource(_source, ALGetSourcei.BuffersProcessed, out processed_count); doit = false; - Console.WriteLine("Buffers Prozessed on Stream " + _source.ToString() + " = " + processed_count.ToString()); + Console.WriteLine("Buffers Processed on Stream " + _source.ToString() + " = " + processed_count.ToString()); if (processed_count < 1) return; } diff --git a/Vocaluxe/Menu/CBackground.cs b/Vocaluxe/Menu/CBackground.cs index cedc4eb5..1b6b0b83 100644 --- a/Vocaluxe/Menu/CBackground.cs +++ b/Vocaluxe/Menu/CBackground.cs @@ -38,6 +38,11 @@ namespace Vocaluxe.Menu public SColorF Color; + public string GetThemeName() + { + return _Theme.Name; + } + #region Constructors public CBackground() { diff --git a/Vocaluxe/Menu/CButton.cs b/Vocaluxe/Menu/CButton.cs index a43143fd..2e018ffa 100644 --- a/Vocaluxe/Menu/CButton.cs +++ b/Vocaluxe/Menu/CButton.cs @@ -42,8 +42,19 @@ namespace Vocaluxe.Menu public float SReflectionSpace; public float SReflectionHeight; - private bool _Selected; public bool Pressed; + + public bool EditMode + { + get { return Text.EditMode; } + set + { + Text.EditMode = value; + SText.EditMode = value; + } + } + + private bool _Selected; public bool Selected { get { return _Selected; } @@ -55,6 +66,11 @@ namespace Vocaluxe.Menu } public bool Visible; + public string GetThemeName() + { + return _Theme.Name; + } + public CButton() { _Theme = new SThemeButton(); @@ -67,6 +83,7 @@ namespace Vocaluxe.Menu SText = new CText(); Selected = false; Visible = true; + EditMode = false; Reflection = false; ReflectionSpace = 0f; @@ -284,6 +301,11 @@ namespace Vocaluxe.Menu } } + public void ProcessMouseMove(int x, int y) + { + Selected = CHelper.IsInBounds(Rect, x, y); + } + public void UnloadTextures() { Text.UnloadTextures(); diff --git a/Vocaluxe/Menu/CEqualizer.cs b/Vocaluxe/Menu/CEqualizer.cs index 8f0a8ab3..4b8c3997 100644 --- a/Vocaluxe/Menu/CEqualizer.cs +++ b/Vocaluxe/Menu/CEqualizer.cs @@ -47,6 +47,11 @@ namespace Vocaluxe.Menu public bool Visible; public bool ScreenHandles; + public string GetThemeName() + { + return _Theme.Name; + } + private float[] _Bars; public CEqualizer() diff --git a/Vocaluxe/Menu/CInteraction.cs b/Vocaluxe/Menu/CInteraction.cs index de15e592..a95e450b 100644 --- a/Vocaluxe/Menu/CInteraction.cs +++ b/Vocaluxe/Menu/CInteraction.cs @@ -15,7 +15,8 @@ namespace Vocaluxe.Menu TLyric, TSingNote, TNameSelection, - TEqualizer + TEqualizer, + TPlaylist } class CInteraction @@ -44,7 +45,8 @@ namespace Vocaluxe.Menu _Type == EType.TSongMenu || _Type == EType.TLyric || _Type == EType.TSingNote || - _Type == EType.TEqualizer); + _Type == EType.TEqualizer || + _Type == EType.TPlaylist); } } diff --git a/Vocaluxe/Menu/CLyric.cs b/Vocaluxe/Menu/CLyric.cs index bc4bbbab..21929681 100644 --- a/Vocaluxe/Menu/CLyric.cs +++ b/Vocaluxe/Menu/CLyric.cs @@ -47,6 +47,11 @@ namespace Vocaluxe.Menu private float _Alpha = 1f; + public string GetThemeName() + { + return _Theme.Name; + } + public SRectF Rect { get { return new SRectF(_X, _Y, _MaxW, _H, _Z); } diff --git a/Vocaluxe/Menu/CMenu.cs b/Vocaluxe/Menu/CMenu.cs index 3677b369..fd4aed88 100644 --- a/Vocaluxe/Menu/CMenu.cs +++ b/Vocaluxe/Menu/CMenu.cs @@ -37,6 +37,7 @@ namespace Vocaluxe.Menu private List _SingNotes; private List _NameSelections; private List _Equalizers; + private List _Playlists; private Hashtable _htBackgrounds; private Hashtable _htStatics; @@ -48,6 +49,7 @@ namespace Vocaluxe.Menu private Hashtable _htSingNotes; private Hashtable _htNameSelections; private Hashtable _htEqualizers; + private Hashtable _htPlaylists; private int _PrevMouseX; @@ -70,6 +72,7 @@ namespace Vocaluxe.Menu protected string[] _ThemeSingNotes; protected string[] _ThemeNameSelections; protected string[] _ThemeEqualizers; + protected string[] _ThemePlaylists; protected SRectF _ScreenArea; @@ -103,6 +106,7 @@ namespace Vocaluxe.Menu _SingNotes = new List(); _NameSelections = new List(); _Equalizers = new List(); + _Playlists = new List(); _htBackgrounds = new Hashtable(); _htStatics = new Hashtable(); @@ -114,6 +118,7 @@ namespace Vocaluxe.Menu _htSingNotes = new Hashtable(); _htNameSelections = new Hashtable(); _htEqualizers = new Hashtable(); + _htPlaylists = new Hashtable(); _PrevMouseX = 0; _PrevMouseY = 0; @@ -135,6 +140,7 @@ namespace Vocaluxe.Menu _ThemeSingNotes = null; _ThemeNameSelections = null; _ThemeEqualizers = null; + _ThemePlaylists = null; } #region ThemeHandler @@ -333,6 +339,22 @@ namespace Vocaluxe.Menu } } } + + if (_ThemePlaylists != null) + { + for (int i = 0; i < _ThemePlaylists.Length; i++) + { + CPlaylist pls = new CPlaylist(); + if (pls.LoadTheme("//root/" + _ThemeName, _ThemePlaylists[i], navigator, SkinIndex)) + { + _htPlaylists.Add(_ThemePlaylists[i], AddPlaylist(pls)); + } + else + { + CLog.LogError("Can't load Playlist \"" + _ThemePlaylists[i] + "\" in screen " + _ThemeName); + } + } + } } else { @@ -414,6 +436,12 @@ namespace Vocaluxe.Menu _Equalizers[i].SaveTheme(writer); } + //Playlists + for (int i = 0; i < _Playlists.Count; i++) + { + _Playlists[i].SaveTheme(writer); + } + writer.WriteEndElement(); // End of File @@ -475,6 +503,11 @@ namespace Vocaluxe.Menu { eq.ReloadTextures(); } + + foreach (CPlaylist pls in _Playlists) + { + pls.ReloadTextures(); + } } public virtual void UnloadTextures() @@ -523,6 +556,10 @@ namespace Vocaluxe.Menu { ns.UnloadTextures(); } + foreach (CPlaylist pls in _Playlists) + { + pls.UnloadTextures(); + } foreach (CEqualizer eq in _Equalizers) { @@ -589,6 +626,11 @@ namespace Vocaluxe.Menu { return _Equalizers; } + + public List GetPlaylists() + { + return _Playlists; + } #endregion GetLists #region ElementHandler @@ -672,6 +714,14 @@ namespace Vocaluxe.Menu return _Equalizers.ToArray(); } } + + public CPlaylist[] Playlists + { + get + { + return _Playlists.ToArray(); + } + } #endregion Get Arrays #region Hashtables @@ -804,6 +854,19 @@ namespace Vocaluxe.Menu throw; } } + + public int htPlaylists(string key) + { + try + { + return (int)_htPlaylists[key]; + } + catch (Exception) + { + CLog.LogError("Can't find Playlist Element \"" + key + "\" in Screen " + _ThemeName); + throw; + } + } #endregion Hashtables #endregion ElementHandler @@ -815,22 +878,22 @@ namespace Vocaluxe.Menu if (KeyEvent.Key == Keys.Left) { if (_Interactions.Count > 0 && _Interactions[_Selection].Type == EType.TSelectSlide && KeyEvent.Mod != Modifier.Shift) - PrevElement(); + KeyEvent.Handled = PrevElement(); else - _NextInteraction(KeyEvent); + KeyEvent.Handled = _NextInteraction(KeyEvent); } if (KeyEvent.Key == Keys.Right) { if (_Interactions.Count > 0 && _Interactions[_Selection].Type == EType.TSelectSlide && KeyEvent.Mod != Modifier.Shift) - NextElement(); + KeyEvent.Handled = NextElement(); else - _NextInteraction(KeyEvent); + KeyEvent.Handled = _NextInteraction(KeyEvent); } if (KeyEvent.Key == Keys.Up || KeyEvent.Key == Keys.Down) { - _NextInteraction(KeyEvent); + KeyEvent.Handled = _NextInteraction(KeyEvent); } } else @@ -1063,7 +1126,8 @@ namespace Vocaluxe.Menu _Interactions[i].Type == EType.TNameSelection || _Interactions[i].Type == EType.TText || _Interactions[i].Type == EType.TSongMenu || - _Interactions[i].Type == EType.TEqualizer)) + _Interactions[i].Type == EType.TEqualizer || + _Interactions[i].Type == EType.TPlaylist)) { ZSort zs = new ZSort(); zs.ID = i; @@ -1156,6 +1220,13 @@ namespace Vocaluxe.Menu _AddInteraction(_Equalizers.Count - 1, EType.TEqualizer); return _Equalizers.Count - 1; } + + public int AddPlaylist(CPlaylist pls) + { + _Playlists.Add(pls); + _AddInteraction(_Playlists.Count - 1, EType.TPlaylist); + return _Playlists.Count - 1; + } #endregion Elements #region InteractionHandling @@ -1171,16 +1242,28 @@ namespace Vocaluxe.Menu _PrevInteraction(); } - public void NextElement() + /// + /// Selects the next element in a menu interaction. + /// + /// True if the next element is selected. False if either there is no next element or the interaction does not provide such a method. + public bool NextElement() { if (_Interactions.Count > 0) - _NextElement(); + return _NextElement(); + + return false; } - public void PrevElement() + /// + /// Selects the previous element in a menu interaction. + /// + /// True if the previous element is selected. False if either there is no next element or the interaction does not provide such a method. + public bool PrevElement() { if (_Interactions.Count > 0) - _PrevElement(); + return _PrevElement(); + + return false; } public bool SetInteractionToButton(CButton button) @@ -1308,6 +1391,10 @@ namespace Vocaluxe.Menu if (CHelper.IsInBounds(_Equalizers[interact.Num].Rect, x, y)) return true; break; + case EType.TPlaylist: + if (CHelper.IsInBounds(_Playlists[interact.Num].Rect, x, y)) + return true; + break; } return false; } @@ -1332,6 +1419,8 @@ namespace Vocaluxe.Menu return _NameSelections[interact.Num].Rect.Z; case EType.TEqualizer: return _Equalizers[interact.Num].Rect.Z; + case EType.TPlaylist: + return _Playlists[interact.Num].Rect.Z; } return CSettings.zFar; } @@ -1363,6 +1452,9 @@ namespace Vocaluxe.Menu case EType.TEqualizer: return _Equalizers[_Interactions[interaction].Num].Rect.Z; + + case EType.TPlaylist: + return _Playlists[_Interactions[interaction].Num].Rect.Z; } return CSettings.zFar; @@ -1422,7 +1514,12 @@ namespace Vocaluxe.Menu _SetSelected(); } - private void _NextInteraction(KeyEvent Key) + /// + /// Selects the next best interaction in a menu. + /// + /// + /// + private bool _NextInteraction(KeyEvent Key) { KeyEvent[] Directions = new KeyEvent[4]; float[] Distances = new float[4]; @@ -1488,8 +1585,11 @@ namespace Vocaluxe.Menu _Selection = element; _SetSelected(); _SetHighlighted(_Selection); + + return true; } } + return false; } private int _GetNextElement(KeyEvent Key, out float Distance, out int Stage) @@ -1581,22 +1681,22 @@ namespace Vocaluxe.Menu switch (Key.Key) { case Keys.Up: - if (vector.Y < 0f && (targetRect.X + targetRect.W > actualRect.X || actualRect.X + actualRect.W > targetRect.X)) + if (vector.Y < 0f && (targetRect.X + targetRect.W > actualRect.X && actualRect.X + actualRect.W > targetRect.X)) inDirection = true; break; case Keys.Down: - if (vector.Y > 0f && (targetRect.X + targetRect.W > actualRect.X || actualRect.X + actualRect.W > targetRect.X)) + if (vector.Y > 0f && (targetRect.X + targetRect.W > actualRect.X && actualRect.X + actualRect.W > targetRect.X)) inDirection = true; break; case Keys.Left: - if (vector.X < 0f && (targetRect.Y + targetRect.H > actualRect.Y || actualRect.Y + actualRect.H > targetRect.Y)) + if (vector.X < 0f && (targetRect.Y + targetRect.H > actualRect.Y && actualRect.Y + actualRect.H > targetRect.Y)) inDirection = true; break; case Keys.Right: - if (vector.X > 0f && (targetRect.Y + targetRect.H > actualRect.Y || actualRect.Y + actualRect.H > targetRect.Y)) + if (vector.X > 0f && (targetRect.Y + targetRect.H > actualRect.Y && actualRect.Y + actualRect.H > targetRect.Y)) inDirection = true; break; @@ -1648,16 +1748,30 @@ namespace Vocaluxe.Menu return distance; } - private void _NextElement() + /// + /// Selects the next element in a menu interaction. + /// + /// True if the next element is selected. False if either there is no next element or the interaction does not provide such a method. + private bool _NextElement() { if (_Interactions[_Selection].Type == EType.TSelectSlide) - _SelectSlides[_Interactions[_Selection].Num].NextValue(); + return _SelectSlides[_Interactions[_Selection].Num].NextValue(); + + return false; } - private void _PrevElement() + /// + /// Selects the previous element in a menu interaction. + /// + /// + /// True if the previous element is selected. False if either there is no previous element or the interaction does not provide such a method. + /// + private bool _PrevElement() { if (_Interactions[_Selection].Type == EType.TSelectSlide) - _SelectSlides[_Interactions[_Selection].Num].PrevValue(); + return _SelectSlides[_Interactions[_Selection].Num].PrevValue(); + + return false; } private void _SetSelected() @@ -1688,6 +1802,9 @@ namespace Vocaluxe.Menu case EType.TEqualizer: _Equalizers[_Interactions[_Selection].Num].Selected = true; break; + case EType.TPlaylist: + _Playlists[_Interactions[_Selection].Num].Selected = true; + break; } } @@ -1719,6 +1836,9 @@ namespace Vocaluxe.Menu case EType.TEqualizer: _Equalizers[_Interactions[_Selection].Num].Selected = false; break; + case EType.TPlaylist: + _Playlists[_Interactions[_Selection].Num].Selected = false; + break; } } @@ -1750,6 +1870,9 @@ namespace Vocaluxe.Menu case EType.TNameSelection: //_NameSelections[_Interactions[selection].Num].Selected = true; break; + case EType.TPlaylist: + //_Playlists[_Interactions[_Selection].Num].Selected = true; + break; } } @@ -1781,6 +1904,9 @@ namespace Vocaluxe.Menu case EType.TNameSelection: //_NameSelections[_Interactions[selection].Num].Selected = false; break; + case EType.TPlaylist: + //_Playlists[_Interactions[_Selection].Num].Selected = true; + break; } } @@ -1833,6 +1959,9 @@ namespace Vocaluxe.Menu case EType.TEqualizer: return _Equalizers[_Interactions[interaction].Num].Visible; + + case EType.TPlaylist: + return _Playlists[_Interactions[interaction].Num].Visible; } return false; @@ -1866,6 +1995,9 @@ namespace Vocaluxe.Menu case EType.TEqualizer: return _Equalizers[_Interactions[interaction].Num].Rect; + + case EType.TPlaylist: + return _Playlists[_Interactions[interaction].Num].Rect; } return Result; @@ -1916,6 +2048,10 @@ namespace Vocaluxe.Menu //_Equalizers[_Interactions[interaction].Num].Draw(); } break; + + case EType.TPlaylist: + _Playlists[_Interactions[interaction].Num].Draw(); + break; //TODO: //case EType.TLyric: @@ -1960,6 +2096,10 @@ namespace Vocaluxe.Menu case EType.TNameSelection: _NameSelections[_Interactions[_Selection].Num].MoveElement(stepX, stepY); break; + + case EType.TPlaylist: + _Playlists[_Interactions[_Selection].Num].MoveElement(stepX, stepY); + break; } } } @@ -1997,6 +2137,10 @@ namespace Vocaluxe.Menu case EType.TNameSelection: _NameSelections[_Interactions[_Selection].Num].ResizeElement(stepW, stepH); break; + + case EType.TPlaylist: + _Playlists[_Interactions[_Selection].Num].ResizeElement(stepW, stepH); + break; } } } diff --git a/Vocaluxe/Menu/CNameSelection.cs b/Vocaluxe/Menu/CNameSelection.cs index 5a539c7c..5d426a89 100644 --- a/Vocaluxe/Menu/CNameSelection.cs +++ b/Vocaluxe/Menu/CNameSelection.cs @@ -49,6 +49,11 @@ namespace Vocaluxe.Menu private SThemeNameSelection _Theme; private bool _ThemeLoaded; + public string GetThemeName() + { + return _Theme.Name; + } + public bool Selected = false; public bool Visible = true; diff --git a/Vocaluxe/Menu/CObjectInteractions.cs b/Vocaluxe/Menu/CObjectInteractions.cs new file mode 100644 index 00000000..f6363187 --- /dev/null +++ b/Vocaluxe/Menu/CObjectInteractions.cs @@ -0,0 +1,1110 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using System.Drawing; +using System.IO; +using System.Text; +using System.Windows.Forms; +using System.Xml; +using System.Xml.XPath; + +using Vocaluxe.Base; +using Vocaluxe.Lib.Draw; +using Vocaluxe.Menu; +using Vocaluxe.Menu.SingNotes; +using Vocaluxe.Menu.SongMenu; + +namespace Vocaluxe.Menu +{ + class CObjectInteractions + { + private List _Interactions; + private int _Selection = 0; + + private List _Statics; + private List _Texts; + private List _Buttons; + private List _SelectSlides; + + private int _PrevMouseX; + private int _PrevMouseY; + + protected int _MouseDX; + protected int _MouseDY; + + public bool Active; + + protected SRectF _ScreenArea; + + public SRectF ScreenArea + { + get { return _ScreenArea; } + } + + public CObjectInteractions() + { + Init(); + } + + protected virtual void Init() + { + _Interactions = new List(); + _Selection = 0; + + _Statics = new List(); + _Texts = new List(); + _Buttons = new List(); + _SelectSlides = new List(); + + _PrevMouseX = 0; + _PrevMouseY = 0; + + _MouseDX = 0; + _MouseDY = 0; + + Active = false; + _ScreenArea = new SRectF(0f, 0f, CSettings.iRenderW, CSettings.iRenderH, 0f); + } + + public void Clear() + { + _Interactions.Clear(); + _Statics.Clear(); + _Texts.Clear(); + _Buttons.Clear(); + _SelectSlides.Clear(); + + _Selection = 0; + + _PrevMouseX = 0; + _PrevMouseY = 0; + + _MouseDX = 0; + _MouseDY = 0; + + Active = false; + } + #region GetLists + public List GetButtons() + { + return _Buttons; + } + + public List GetSelectSlides() + { + return _SelectSlides; + } + #endregion GetLists + + #region ElementHandler + #region Get Arrays + public CButton[] Buttons + { + get + { + return _Buttons.ToArray(); + } + } + + public CSelectSlide[] SelectSlides + { + get + { + return _SelectSlides.ToArray(); + } + } + #endregion Get Arrays + #endregion ElementHandler + + #region MenuHandler + public bool HandleInput(KeyEvent KeyEvent) + { + if (!CSettings.TabNavigation) + { + if (KeyEvent.Key == Keys.Left) + { + if (_Interactions.Count > 0 && _Interactions[_Selection].Type == EType.TSelectSlide && KeyEvent.Mod != Modifier.Shift) + KeyEvent.Handled = PrevElement(); + else + KeyEvent.Handled = _NextInteraction(KeyEvent); + } + + if (KeyEvent.Key == Keys.Right) + { + if (_Interactions.Count > 0 && _Interactions[_Selection].Type == EType.TSelectSlide && KeyEvent.Mod != Modifier.Shift) + KeyEvent.Handled = NextElement(); + else + KeyEvent.Handled = _NextInteraction(KeyEvent); + } + + if (KeyEvent.Key == Keys.Up || KeyEvent.Key == Keys.Down) + { + KeyEvent.Handled = _NextInteraction(KeyEvent); + } + } + else + { + if (KeyEvent.Key == Keys.Tab) + { + if (KeyEvent.Mod == Modifier.Shift) + PrevInteraction(); + else + NextInteraction(); + } + + if (KeyEvent.Key == Keys.Left) + PrevElement(); + + if (KeyEvent.Key == Keys.Right) + NextElement(); + } + + return true; + } + + public bool HandleMouse(MouseEvent MouseEvent) + { + int selection = _Selection; + ProcessMouseMove(MouseEvent.X, MouseEvent.Y); + if (selection != _Selection) + { + _UnsetHighlighted(selection); + _SetHighlighted(_Selection); + } + + if (MouseEvent.LB) + ProcessMouseClick(MouseEvent.X, MouseEvent.Y); + + _PrevMouseX = MouseEvent.X; + _PrevMouseY = MouseEvent.Y; + + return true; + } + + public bool HandleInputThemeEditor(KeyEvent KeyEvent) + { + _UnsetHighlighted(_Selection); + if (KeyEvent.KeyPressed) + { + + } + else + { + switch (KeyEvent.Key) + { + case Keys.S: + CGraphics.SaveTheme(); + break; + + case Keys.Up: + if (KeyEvent.Mod == Modifier.Ctrl) + MoveElement(0, -1); + + if (KeyEvent.Mod == Modifier.Shift) + ResizeElement(0, 1); + + break; + case Keys.Down: + if (KeyEvent.Mod == Modifier.Ctrl) + MoveElement(0, 1); + + if (KeyEvent.Mod == Modifier.Shift) + ResizeElement(0, -1); + + break; + + case Keys.Right: + if (KeyEvent.Mod == Modifier.Ctrl) + MoveElement(1, 0); + + if (KeyEvent.Mod == Modifier.Shift) + ResizeElement(1, 0); + + if (KeyEvent.Mod == Modifier.None) + NextInteraction(); + break; + case Keys.Left: + if (KeyEvent.Mod == Modifier.Ctrl) + MoveElement(-1, 0); + + if (KeyEvent.Mod == Modifier.Shift) + ResizeElement(-1, 0); + + if (KeyEvent.Mod == Modifier.None) + PrevInteraction(); + break; + } + } + return true; + } + + public bool HandleMouseThemeEditor(MouseEvent MouseEvent) + { + _UnsetHighlighted(_Selection); + _MouseDX = MouseEvent.X - _PrevMouseX; + _MouseDY = MouseEvent.Y - _PrevMouseY; + + int stepX = 0; + int stepY = 0; + + if ((MouseEvent.Mod & Modifier.Ctrl) == Modifier.Ctrl) + { + _PrevMouseX = MouseEvent.X; + _PrevMouseY = MouseEvent.Y; + } + else + { + while (Math.Abs(MouseEvent.X - _PrevMouseX) >= 5) + { + if (MouseEvent.X - _PrevMouseX >= 5) + stepX += 5; + + if (MouseEvent.X - _PrevMouseX <= -5) + stepX -= 5; + + _PrevMouseX = MouseEvent.X - (_MouseDX - stepX); + } + + while (Math.Abs(MouseEvent.Y - _PrevMouseY) >= 5) + { + if (MouseEvent.Y - _PrevMouseY >= 5) + stepY += 5; + + if (MouseEvent.Y - _PrevMouseY <= -5) + stepY -= 5; + + _PrevMouseY = MouseEvent.Y - (_MouseDY - stepY); + } + } + + if (MouseEvent.LBH) + { + //if (IsMouseOver(MouseEvent.X, _PrevMouseY)) + //{ + if (MouseEvent.Mod == Modifier.None) + MoveElement(stepX, stepY); + + if (MouseEvent.Mod == Modifier.Ctrl) + MoveElement(_MouseDX, _MouseDY); + + if (MouseEvent.Mod == Modifier.Shift) + ResizeElement(stepX, stepY); + + if (MouseEvent.Mod == (Modifier.Shift | Modifier.Ctrl)) + ResizeElement(_MouseDX, _MouseDY); + //} + } + else + ProcessMouseMove(MouseEvent.X, MouseEvent.Y); + + return true; + } + #endregion MenuHandler + + #region Drawing + public void Draw() + { + if (_Interactions.Count <= 0) + return; + + List items = new List(); + + for (int i = 0; i < _Interactions.Count; i++) + { + if (_IsVisible(i) && ( + _Interactions[i].Type == EType.TButton || + _Interactions[i].Type == EType.TSelectSlide || + _Interactions[i].Type == EType.TStatic || + _Interactions[i].Type == EType.TNameSelection || + _Interactions[i].Type == EType.TText || + _Interactions[i].Type == EType.TSongMenu || + _Interactions[i].Type == EType.TEqualizer)) + { + ZSort zs = new ZSort(); + zs.ID = i; + zs.z = _GetZValue(i); + items.Add(zs); + } + } + + if (items.Count <= 0) + return; + + + items.Sort(delegate(ZSort s1, ZSort s2) { return (s2.z.CompareTo(s1.z)); }); + + for (int i = 0; i < items.Count; i++) + { + _DrawInteraction(items[i].ID); + } + + } + #endregion Drawing + + #region Elements + public int AddStatic(CStatic stat) + { + _Statics.Add(stat); + _AddInteraction(_Statics.Count - 1, EType.TStatic); + return _Statics.Count - 1; + } + + public int AddText(CText text) + { + _Texts.Add(text); + _AddInteraction(_Texts.Count - 1, EType.TText); + return _Texts.Count - 1; + } + + public int AddButton(CButton button) + { + _Buttons.Add(button); + _AddInteraction(_Buttons.Count - 1, EType.TButton); + return _Buttons.Count - 1; + } + + public int AddSelectSlide(CSelectSlide slide) + { + _SelectSlides.Add(slide); + _AddInteraction(_SelectSlides.Count - 1, EType.TSelectSlide); + return _SelectSlides.Count - 1; + } + #endregion Elements + + #region InteractionHandling + public void NextInteraction() + { + if (_Interactions.Count > 0) + _NextInteraction(); + } + + public void PrevInteraction() + { + if (_Interactions.Count > 0) + _PrevInteraction(); + } + + /// + /// Selects the next element in a menu interaction. + /// + /// True if the next element is selected. False if either there is no next element or the interaction does not provide such a method. + public bool NextElement() + { + if (_Interactions.Count > 0) + return _NextElement(); + + return false; + } + + /// + /// Selects the previous element in a menu interaction. + /// + /// True if the previous element is selected. False if either there is no next element or the interaction does not provide such a method. + public bool PrevElement() + { + if (_Interactions.Count > 0) + return _PrevElement(); + + return false; + } + + public bool SetInteractionToButton(CButton button) + { + for (int i = 0; i < _Interactions.Count; i++) + { + if (_Interactions[i].Type == EType.TButton) + { + if (_Buttons[_Interactions[i].Num].Visible && _Buttons[_Interactions[i].Num] == button) + { + _UnsetSelected(); + _UnsetHighlighted(_Selection); + _Selection = i; + _SetSelected(); + return true; + } + } + } + return false; + } + + public bool SetInteractionToSelectSlide(CSelectSlide slide) + { + for (int i = 0; i < _Interactions.Count; i++) + { + if (_Interactions[i].Type == EType.TSelectSlide) + { + if (_SelectSlides[_Interactions[i].Num].Visible && _SelectSlides[_Interactions[i].Num] == slide) + { + _UnsetSelected(); + _UnsetHighlighted(_Selection); + _Selection = i; + _SetSelected(); + return true; + } + } + } + return false; + } + + public void ProcessMouseClick(int x, int y) + { + if (_Selection >= _Interactions.Count || _Selection < 0) + return; + + if (_Interactions[_Selection].Type == EType.TSelectSlide) + { + if (_SelectSlides[_Interactions[_Selection].Num].Visible) + { + _SelectSlides[_Interactions[_Selection].Num].ProcessMouseLBClick(x, y); + } + } + } + + public void ProcessMouseMove(int x, int y) + { + SelectByMouse(x, y); + + if (_Selection >= _Interactions.Count || _Selection < 0) + return; + + if (_Interactions[_Selection].Type == EType.TSelectSlide) + { + if (_SelectSlides[_Interactions[_Selection].Num].Visible) + { + _SelectSlides[_Interactions[_Selection].Num].ProcessMouseMove(x, y); + } + } + } + + public void SelectByMouse(int x, int y) + { + float z = CSettings.zFar; + for (int i = 0; i < _Interactions.Count; i++) + { + if ((CSettings.GameState == EGameState.EditTheme) || (!_Interactions[i].ThemeEditorOnly && _IsVisible(i))) + { + if (_IsMouseOver(x, y, _Interactions[i])) + { + if (_GetZValue(_Interactions[i]) <= z) + { + z = _GetZValue(_Interactions[i]); + _UnsetSelected(); + _Selection = i; + _SetSelected(); + } + } + } + } + } + + public bool IsMouseOver(MouseEvent MouseEvent) + { + return IsMouseOver(MouseEvent.X, MouseEvent.Y); + } + + public 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; + } + + private bool _IsMouseOver(int x, int y, CInteraction interact) + { + switch (interact.Type) + { + case EType.TButton: + if (CHelper.IsInBounds(_Buttons[interact.Num].Rect, x, y)) + return true; + break; + case EType.TSelectSlide: + if (CHelper.IsInBounds(_SelectSlides[interact.Num].Rect, x, y) || + CHelper.IsInBounds(_SelectSlides[interact.Num].RectArrowLeft, x, y) || + CHelper.IsInBounds(_SelectSlides[interact.Num].RectArrowRight, x, y)) + return true; + break; + } + return false; + } + + private float _GetZValue(CInteraction interact) + { + switch (interact.Type) + { + case EType.TStatic: + return _Statics[interact.Num].Rect.Z; + case EType.TText: + return _Texts[interact.Num].Z; + case EType.TButton: + return _Buttons[interact.Num].Rect.Z; + case EType.TSelectSlide: + return _SelectSlides[interact.Num].Rect.Z; + } + return CSettings.zFar; + } + + private float _GetZValue(int interaction) + { + switch (_Interactions[interaction].Type) + { + case EType.TStatic: + return _Statics[_Interactions[interaction].Num].Rect.Z; + case EType.TText: + return _Texts[_Interactions[interaction].Num].Z; + case EType.TButton: + return _Buttons[_Interactions[interaction].Num].Rect.Z; + case EType.TSelectSlide: + return _SelectSlides[_Interactions[interaction].Num].Rect.Z; + } + + return CSettings.zFar; + } + + private void _NextInteraction() + { + _UnsetSelected(); + if (CSettings.GameState != EGameState.EditTheme) + { + bool found = false; + int start = _Selection; + do + { + start++; + if (start > _Interactions.Count - 1) + start = 0; + + if ((start == _Selection) || (!_Interactions[start].ThemeEditorOnly && _IsVisible(start))) + found = true; + } while (!found); + _Selection = start; + } + else + { + _Selection++; + if (_Selection > _Interactions.Count - 1) + _Selection = 0; + } + _SetSelected(); + } + + private void _PrevInteraction() + { + _UnsetSelected(); + if (CSettings.GameState != EGameState.EditTheme) + { + bool found = false; + int start = _Selection; + do + { + start--; + if (start < 0) + start = _Interactions.Count - 1; + + if ((start == _Selection) || (!_Interactions[start].ThemeEditorOnly && _IsVisible(start))) + found = true; + } while (!found); + _Selection = start; + } + else + { + _Selection--; + if (_Selection < 0) + _Selection = _Interactions.Count - 1; + } + _SetSelected(); + } + + /// + /// Selects the next best interaction in a menu. + /// + /// + /// + private bool _NextInteraction(KeyEvent Key) + { + KeyEvent[] Directions = new KeyEvent[4]; + float[] Distances = new float[4]; + int[] stages = new int[4]; + int[] elements = new int[4]; + + for (int i = 0; i < 4; i++) + { + Directions[i] = new KeyEvent(); + } + + Directions[0].Key = Keys.Up; + Directions[1].Key = Keys.Right; + Directions[2].Key = Keys.Down; + Directions[3].Key = Keys.Left; + + for (int i = 0; i < 4; i++) + { + elements[i] = _GetNextElement(Directions[i], out Distances[i], out stages[i]); + } + + int element = _Selection; + int stage = int.MaxValue; + float distance = float.MaxValue; + int direction = -1; + + int mute = -1; + switch (Key.Key) + { + case Keys.Up: + mute = 2; + break; + case Keys.Right: + mute = 3; + break; + case Keys.Down: + mute = 0; + break; + case Keys.Left: + mute = 1; + break; + } + + for (int i = 0; i < 4; i++) + { + if (i != mute && elements[i] != _Selection && (stages[i] < stage || (stages[i] == stage && Directions[i].Key == Key.Key))) + { + stage = stages[i]; + element = elements[i]; + distance = Distances[i]; + direction = i; + } + } + + if (direction != -1) + { + // select the new element + if (Directions[direction].Key == Key.Key) + { + _UnsetHighlighted(_Selection); + _UnsetSelected(); + + _Selection = element; + _SetSelected(); + _SetHighlighted(_Selection); + + return true; + } + } + return false; + } + + private int _GetNextElement(KeyEvent Key, out float Distance, out int Stage) + { + Distance = float.MaxValue; + int min = _Selection; + SRectF actualRect = _GetRect(_Selection); + Stage = int.MaxValue; + + for (int i = 0; i < _Interactions.Count; i++) + { + if (i != _Selection && !_Interactions[i].ThemeEditorOnly && _IsVisible(i)) + { + SRectF targetRect = _GetRect(i); + float dist = _GetDistanceDirect(Key, actualRect, targetRect); + if (dist >= 0f && dist < Distance) + { + Distance = dist; + min = i; + Stage = 10; + } + } + } + + if (min == _Selection) + { + for (int i = 0; i < _Interactions.Count; i++) + { + if (i != _Selection && !_Interactions[i].ThemeEditorOnly && _IsVisible(i)) + { + SRectF targetRect = _GetRect(i); + float dist = _GetDistance180(Key, actualRect, targetRect); + if (dist >= 0f && dist < Distance) + { + Distance = dist; + min = i; + Stage = 20; + } + } + } + } + + if (min == _Selection) + { + switch (Key.Key) + { + case Keys.Up: + actualRect = new SRectF(actualRect.X, CSettings.iRenderH, 1, 1, actualRect.Z); + break; + case Keys.Down: + actualRect = new SRectF(actualRect.X, 0, 1, 1, actualRect.Z); + break; + case Keys.Left: + actualRect = new SRectF(CSettings.iRenderW, actualRect.Y, 1, 1, actualRect.Z); + break; + case Keys.Right: + actualRect = new SRectF(0, actualRect.Y, 1, 1, actualRect.Z); + break; + default: + break; + } + + for (int i = 0; i < _Interactions.Count; i++) + { + if (i != _Selection && !_Interactions[i].ThemeEditorOnly && _IsVisible(i)) + { + SRectF targetRect = _GetRect(i); + float dist = _GetDistance180(Key, actualRect, targetRect); + if (dist >= 0f && dist < Distance) + { + Distance = dist; + min = i; + Stage = 30; + } + } + } + } + return min; + } + + private float _GetDistanceDirect(KeyEvent Key, SRectF actualRect, SRectF targetRect) + { + PointF source = new PointF(actualRect.X + actualRect.W / 2f, actualRect.Y + actualRect.H / 2f); + PointF dest = new PointF(targetRect.X + targetRect.W / 2f, targetRect.Y + targetRect.H / 2f); + + PointF vector = new PointF(dest.X - source.X, dest.Y - source.Y); + float distance = (float)Math.Sqrt(vector.X * vector.X + vector.Y * vector.Y); + bool inDirection = false; + switch (Key.Key) + { + case Keys.Up: + if (vector.Y < 0f && (targetRect.X + targetRect.W > actualRect.X && actualRect.X + actualRect.W > targetRect.X)) + inDirection = true; + break; + + case Keys.Down: + if (vector.Y > 0f && (targetRect.X + targetRect.W > actualRect.X && actualRect.X + actualRect.W > targetRect.X)) + inDirection = true; + break; + + case Keys.Left: + if (vector.X < 0f && (targetRect.Y + targetRect.H > actualRect.Y && actualRect.Y + actualRect.H > targetRect.Y)) + inDirection = true; + break; + + case Keys.Right: + if (vector.X > 0f && (targetRect.Y + targetRect.H > actualRect.Y && actualRect.Y + actualRect.H > targetRect.Y)) + inDirection = true; + break; + + default: + break; + } + if (!inDirection) + return float.MaxValue; + else + return distance; + } + + private float _GetDistance180(KeyEvent Key, SRectF actualRect, SRectF targetRect) + { + PointF source = new PointF(actualRect.X + actualRect.W / 2f, actualRect.Y + actualRect.H / 2f); + PointF dest = new PointF(targetRect.X + targetRect.W / 2f, targetRect.Y + targetRect.H / 2f); + + PointF vector = new PointF(dest.X - source.X, dest.Y - source.Y); + float distance = (float)Math.Sqrt(vector.X * vector.X + vector.Y * vector.Y); + bool inDirection = false; + switch (Key.Key) + { + case Keys.Up: + if (vector.Y < 0f) + inDirection = true; + break; + + case Keys.Down: + if (vector.Y > 0f) + inDirection = true; + break; + + case Keys.Left: + if (vector.X < 0f) + inDirection = true; + break; + + case Keys.Right: + if (vector.X > 0f) + inDirection = true; + break; + + default: + break; + } + if (!inDirection) + return float.MaxValue; + else + return distance; + } + + /// + /// Selects the next element in a menu interaction. + /// + /// True if the next element is selected. False if either there is no next element or the interaction does not provide such a method. + private bool _NextElement() + { + if (_Interactions[_Selection].Type == EType.TSelectSlide) + return _SelectSlides[_Interactions[_Selection].Num].NextValue(); + + return false; + } + + /// + /// Selects the previous element in a menu interaction. + /// + /// + /// True if the previous element is selected. False if either there is no previous element or the interaction does not provide such a method. + /// + private bool _PrevElement() + { + if (_Interactions[_Selection].Type == EType.TSelectSlide) + return _SelectSlides[_Interactions[_Selection].Num].PrevValue(); + + return false; + } + + private void _SetSelected() + { + switch (_Interactions[_Selection].Type) + { + case EType.TButton: + _Buttons[_Interactions[_Selection].Num].Selected = true; + break; + case EType.TSelectSlide: + _SelectSlides[_Interactions[_Selection].Num].Selected = true; + break; + } + } + + private void _UnsetSelected() + { + switch (_Interactions[_Selection].Type) + { + case EType.TButton: + _Buttons[_Interactions[_Selection].Num].Selected = false; + break; + case EType.TSelectSlide: + _SelectSlides[_Interactions[_Selection].Num].Selected = false; + break; + } + } + + private void _SetHighlighted(int selection) + { + if (selection >= _Interactions.Count || selection < 0) + return; + + switch (_Interactions[selection].Type) + { + case EType.TButton: + //_Buttons[_Interactions[selection].Num].Selected = true; + break; + case EType.TSelectSlide: + _SelectSlides[_Interactions[selection].Num].Highlighted = true; + break; + case EType.TStatic: + //_Statics[_Interactions[selection].Num].Selected = true; + break; + case EType.TText: + //_Texts[_Interactions[selection].Num].Selected = true; + break; + case EType.TSongMenu: + //_SongMenus[_Interactions[selection].Num].Selected = true; + break; + case EType.TLyric: + //_Lyrics[_Interactions[selection].Num].Selected = true; + break; + case EType.TNameSelection: + //_NameSelections[_Interactions[selection].Num].Selected = true; + break; + case EType.TPlaylist: + //_Playlists[_Interactions[_Selection].Num].Selected = true; + break; + } + } + + private void _UnsetHighlighted(int selection) + { + if (selection >= _Interactions.Count || selection < 0) + return; + + switch (_Interactions[selection].Type) + { + case EType.TButton: + //_Buttons[_Interactions[selection].Num].Selected = false; + break; + case EType.TSelectSlide: + _SelectSlides[_Interactions[selection].Num].Highlighted = false; + break; + case EType.TStatic: + //_Statics[_Interactions[selection].Num].Selected = false; + break; + case EType.TText: + //_Texts[_Interactions[selection].Num].Selected = false; + break; + case EType.TSongMenu: + //_SongMenus[_Interactions[selection].Num].Selected = false; + break; + case EType.TLyric: + //_Lyrics[_Interactions[selection].Num].Selected = false; + break; + case EType.TNameSelection: + //_NameSelections[_Interactions[selection].Num].Selected = false; + break; + case EType.TPlaylist: + //_Playlists[_Interactions[_Selection].Num].Selected = true; + break; + } + } + + private void _ToggleHighlighted() + { + if (_Selection >= _Interactions.Count || _Selection < 0) + return; + + if (_Interactions[_Selection].Type == EType.TSelectSlide) + { + _SelectSlides[_Interactions[_Selection].Num].Highlighted = !_SelectSlides[_Interactions[_Selection].Num].Highlighted; + } + } + + private bool _IsHighlighted() + { + if (_Selection >= _Interactions.Count || _Selection < 0) + return false; + + if (_Interactions[_Selection].Type == EType.TSelectSlide) + return _SelectSlides[_Interactions[_Selection].Num].Highlighted; + + return false; + } + + private bool _IsVisible(int interaction) + { + switch (_Interactions[interaction].Type) + { + case EType.TStatic: + return _Statics[_Interactions[interaction].Num].Visible; + + case EType.TText: + return _Texts[_Interactions[interaction].Num].Visible; + + case EType.TButton: + return _Buttons[_Interactions[interaction].Num].Visible; + + case EType.TSelectSlide: + return _SelectSlides[_Interactions[interaction].Num].Visible; + } + + return false; + } + + private SRectF _GetRect(int interaction) + { + SRectF Result = new SRectF(); + switch (_Interactions[interaction].Type) + { + case EType.TButton: + return _Buttons[_Interactions[interaction].Num].Rect; + + case EType.TSelectSlide: + return _SelectSlides[_Interactions[interaction].Num].Rect; + } + + return Result; + } + + private void _AddInteraction(int num, EType type) + { + _Interactions.Add(new CInteraction(num, type)); + if (!_Interactions[_Selection].ThemeEditorOnly) + _SetSelected(); + else + _NextInteraction(); + } + + private void _DrawInteraction(int interaction) + { + bool sel = false; + switch (_Interactions[interaction].Type) + { + case EType.TStatic: + _Statics[_Interactions[interaction].Num].Draw(); + break; + + case EType.TText: + _Texts[_Interactions[interaction].Num].Draw(); + break; + + case EType.TButton: + sel = _Buttons[_Interactions[interaction].Num].Selected; + if (!Active) + _Buttons[_Interactions[interaction].Num].Selected = false; + _Buttons[_Interactions[interaction].Num].Draw(); + _Buttons[_Interactions[interaction].Num].Selected = sel; + break; + + case EType.TSelectSlide: + sel = _SelectSlides[_Interactions[interaction].Num].Selected; + if (!Active) + _SelectSlides[_Interactions[interaction].Num].Selected = false; + _SelectSlides[_Interactions[interaction].Num].Draw(); + _SelectSlides[_Interactions[interaction].Num].Selected = sel; + break; + } + } + + #endregion InteractionHandling + + #region Theme Handling + private void MoveElement(int stepX, int stepY) + { + if (_Interactions.Count > 0) + { + switch (_Interactions[_Selection].Type) + { + case EType.TButton: + _Buttons[_Interactions[_Selection].Num].MoveElement(stepX, stepY); + break; + + case EType.TSelectSlide: + _SelectSlides[_Interactions[_Selection].Num].MoveElement(stepX, stepY); + break; + } + } + } + + private void ResizeElement(int stepW, int stepH) + { + if (_Interactions.Count > 0) + { + switch (_Interactions[_Selection].Type) + { + case EType.TButton: + _Buttons[_Interactions[_Selection].Num].ResizeElement(stepW, stepH); + break; + + case EType.TSelectSlide: + _SelectSlides[_Interactions[_Selection].Num].ResizeElement(stepW, stepH); + break; + } + } + } + #endregion Theme Handling + } +} diff --git a/Vocaluxe/Menu/CPlaylist.cs b/Vocaluxe/Menu/CPlaylist.cs new file mode 100644 index 00000000..0e926d45 --- /dev/null +++ b/Vocaluxe/Menu/CPlaylist.cs @@ -0,0 +1,1041 @@ +using System; +using System.Drawing; +using System.Collections.Generic; +using System.Text; +using System.Xml; +using System.Xml.XPath; +using System.Windows.Forms; + +using Vocaluxe.Base; +using Vocaluxe.Lib.Draw; +using Vocaluxe.Lib.Song; +using Vocaluxe.GameModes; + +namespace Vocaluxe.Menu +{ + enum EEditMode + { + None, + PlaylistName, + ChangeOrder + } + + struct SThemePlaylist + { + public string Name; + + public string ColorBackgroundName; + public string SColorBackgroundName; + + public string TextureBackgroundName; + public string STextureBackgroundName; + + public float EntryHeight; + + public CText Text1; + + public CStatic StaticCover; + public CStatic StaticPlaylistHeader; + public CStatic StaticPlaylistFooter; + + public CButton ButtonPlaylistName; + public CButton ButtonPlaylistClose; + public CButton ButtonPlaylistSave; + public CButton ButtonPlaylistDelete; + public CButton ButtonPlaylistSing; + + public CSelectSlide SelectSlideGameMode; + } + + class CPlaylist : IMenuElement + { + class PlaylistElementContent + { + public EGameMode[] Modes; + public int SongID; + public EGameMode Mode; + } + + class PlaylistElement + { + public CStatic Cover; + public CStatic Background; + public CText Text1; + public CSelectSlide SelectSlide; + public int Content; + } + + private SThemePlaylist _Theme; + private bool _ThemeLoaded; + + public string GetThemeName() + { + return _Theme.Name; + } + + private CObjectInteractions _Interactions; + + private List PlaylistElements; + private List PlaylistElementContents; + + public SRectF CompleteRect; + public SRectF Rect; + public SColorF BackgroundColor; + public SColorF BackgroundSColor; + + public bool Visible; + + private bool _Selected; + public bool Selected + { + get { return _Selected; } + set + { + _Selected = value; + _Interactions.Active = value; + if (CurrentPlaylistElement == -1 && _Selected && PlaylistElementContents.Count > 0) + { + CurrentPlaylistElement = 0; + } + } + } + + public EEditMode _EditMode; + public int ActivePlaylistID = -1; + public int Offset = 0; + public int CurrentPlaylistElement = -1; + + public CPlaylist() + { + _Theme = new SThemePlaylist(); + _Theme.Text1 = new CText(); + _Theme.StaticCover = new CStatic(); + _Theme.StaticPlaylistFooter = new CStatic(); + _Theme.StaticPlaylistHeader = new CStatic(); + _Theme.ButtonPlaylistName = new CButton(); + _Theme.ButtonPlaylistClose = new CButton(); + _Theme.ButtonPlaylistDelete = new CButton(); + _Theme.ButtonPlaylistSave = new CButton(); + _Theme.ButtonPlaylistSing = new CButton(); + _Theme.SelectSlideGameMode = new CSelectSlide(); + + CompleteRect = new SRectF(); + Rect = new SRectF(); + BackgroundColor = new SColorF(); + BackgroundSColor = new SColorF(); + + PlaylistElements = new List(); + PlaylistElementContents = new List(); + + _Interactions = new CObjectInteractions(); + + Visible = false; + Selected = false; + } + + public void Init() + { + _Interactions.Clear(); + PrepareList(); + _Interactions.AddStatic(_Theme.StaticCover); + _Interactions.AddStatic(_Theme.StaticPlaylistFooter); + _Interactions.AddStatic(_Theme.StaticPlaylistHeader); + _Interactions.AddButton(_Theme.ButtonPlaylistName); + _Interactions.AddButton(_Theme.ButtonPlaylistClose); + _Interactions.AddButton(_Theme.ButtonPlaylistDelete); + _Interactions.AddButton(_Theme.ButtonPlaylistSave); + _Interactions.AddButton(_Theme.ButtonPlaylistSing); + } + + public bool LoadTheme(string XmlPath, string ElementName, XPathNavigator navigator, int SkinIndex) + { + string item = XmlPath + "/" + ElementName; + _ThemeLoaded = true; + + _ThemeLoaded &= CHelper.GetValueFromXML(item + "/SkinBackground", navigator, ref _Theme.TextureBackgroundName, String.Empty); + _ThemeLoaded &= CHelper.GetValueFromXML(item + "/SkinBackgroundSelected", navigator, ref _Theme.STextureBackgroundName, String.Empty); + + _ThemeLoaded &= CHelper.TryGetFloatValueFromXML(item + "/X", navigator, ref Rect.X); + _ThemeLoaded &= CHelper.TryGetFloatValueFromXML(item + "/Y", navigator, ref Rect.Y); + _ThemeLoaded &= CHelper.TryGetFloatValueFromXML(item + "/Z", navigator, ref Rect.Z); + _ThemeLoaded &= CHelper.TryGetFloatValueFromXML(item + "/W", navigator, ref Rect.W); + _ThemeLoaded &= CHelper.TryGetFloatValueFromXML(item + "/H", navigator, ref Rect.H); + if (CHelper.GetValueFromXML(item + "/ColorBackground", navigator, ref _Theme.ColorBackgroundName, String.Empty)) + { + _ThemeLoaded &= CTheme.GetColor(_Theme.ColorBackgroundName, SkinIndex, ref BackgroundColor); + } + else + { + _ThemeLoaded &= CHelper.TryGetFloatValueFromXML(item + "/BackgroundR", navigator, ref BackgroundColor.R); + _ThemeLoaded &= CHelper.TryGetFloatValueFromXML(item + "/BackgroundG", navigator, ref BackgroundColor.G); + _ThemeLoaded &= CHelper.TryGetFloatValueFromXML(item + "/BackgroundB", navigator, ref BackgroundColor.B); + _ThemeLoaded &= CHelper.TryGetFloatValueFromXML(item + "/BackgroundA", navigator, ref BackgroundColor.A); + } + if (CHelper.GetValueFromXML(item + "/SColorBackground", navigator, ref _Theme.SColorBackgroundName, String.Empty)) + { + _ThemeLoaded &= CTheme.GetColor(_Theme.SColorBackgroundName, SkinIndex, ref BackgroundSColor); + } + else + { + _ThemeLoaded &= CHelper.TryGetFloatValueFromXML(item + "/SBackgroundR", navigator, ref BackgroundSColor.R); + _ThemeLoaded &= CHelper.TryGetFloatValueFromXML(item + "/SBackgroundG", navigator, ref BackgroundSColor.G); + _ThemeLoaded &= CHelper.TryGetFloatValueFromXML(item + "/SBackgroundB", navigator, ref BackgroundSColor.B); + _ThemeLoaded &= CHelper.TryGetFloatValueFromXML(item + "/SBackgroundA", navigator, ref BackgroundSColor.A); + } + + _ThemeLoaded &= _Theme.Text1.LoadTheme(item, "TextPart1", navigator, SkinIndex); + + _ThemeLoaded &= _Theme.StaticCover.LoadTheme(item, "StaticCover", navigator, SkinIndex); + _ThemeLoaded &= _Theme.StaticPlaylistHeader.LoadTheme(item, "StaticPlaylistHeader", navigator, SkinIndex); + _ThemeLoaded &= _Theme.StaticPlaylistFooter.LoadTheme(item, "StaticPlaylistFooter", navigator, SkinIndex); + + _ThemeLoaded &= _Theme.ButtonPlaylistName.LoadTheme(item, "ButtonPlaylistName", navigator, SkinIndex); + _ThemeLoaded &= _Theme.ButtonPlaylistSing.LoadTheme(item, "ButtonPlaylistSing", navigator, SkinIndex); + _ThemeLoaded &= _Theme.ButtonPlaylistClose.LoadTheme(item, "ButtonPlaylistClose", navigator, SkinIndex); + _ThemeLoaded &= _Theme.ButtonPlaylistSave.LoadTheme(item, "ButtonPlaylistSave", navigator, SkinIndex); + _ThemeLoaded &= _Theme.ButtonPlaylistDelete.LoadTheme(item, "ButtonPlaylistDelete", navigator, SkinIndex); + + _ThemeLoaded &= _Theme.SelectSlideGameMode.LoadTheme(item, "SelectSlideGameMode", navigator, SkinIndex); + + _ThemeLoaded &= CHelper.TryGetFloatValueFromXML(item + "/EntryHeight", navigator, ref _Theme.EntryHeight); + if (_ThemeLoaded) + { + _Theme.Name = ElementName; + + //Check for highest x/y-coords + CompleteRect = Rect; + //ButtonPlaylistClose + if (_Theme.ButtonPlaylistClose.Rect.X < CompleteRect.X) + CompleteRect.X = _Theme.ButtonPlaylistClose.Rect.X; + if (_Theme.ButtonPlaylistClose.Rect.Y < CompleteRect.Y) + CompleteRect.Y = _Theme.ButtonPlaylistClose.Rect.Y; + if (_Theme.ButtonPlaylistClose.Rect.W + _Theme.ButtonPlaylistClose.Rect.X > CompleteRect.W + CompleteRect.X) + CompleteRect.W += _Theme.ButtonPlaylistClose.Rect.W + _Theme.ButtonPlaylistClose.Rect.X - CompleteRect.X; + if (_Theme.ButtonPlaylistClose.Rect.Y + _Theme.ButtonPlaylistClose.Rect.H > CompleteRect.Y + CompleteRect.H) + CompleteRect.H += _Theme.ButtonPlaylistClose.Rect.H + _Theme.ButtonPlaylistClose.Rect.Y - CompleteRect.Y; + //ButtonPlaylistName + if (_Theme.ButtonPlaylistName.Rect.X < CompleteRect.X) + CompleteRect.X = _Theme.ButtonPlaylistName.Rect.X; + if (_Theme.ButtonPlaylistName.Rect.Y < CompleteRect.Y) + CompleteRect.Y = _Theme.ButtonPlaylistName.Rect.Y; + if (_Theme.ButtonPlaylistName.Rect.W + _Theme.ButtonPlaylistName.Rect.X > CompleteRect.W + CompleteRect.X) + CompleteRect.W += _Theme.ButtonPlaylistName.Rect.W + _Theme.ButtonPlaylistName.Rect.X - CompleteRect.X; + if (_Theme.ButtonPlaylistName.Rect.Y + _Theme.ButtonPlaylistName.Rect.H > CompleteRect.Y + CompleteRect.H) + CompleteRect.H += _Theme.ButtonPlaylistName.Rect.H + _Theme.ButtonPlaylistName.Rect.Y - CompleteRect.Y; + //ButtonPlaylistSing + if (_Theme.ButtonPlaylistSing.Rect.X < CompleteRect.X) + CompleteRect.X = _Theme.ButtonPlaylistSing.Rect.X; + if (_Theme.ButtonPlaylistSing.Rect.Y < CompleteRect.Y) + CompleteRect.Y = _Theme.ButtonPlaylistSing.Rect.Y; + if (_Theme.ButtonPlaylistSing.Rect.W + _Theme.ButtonPlaylistSing.Rect.X > CompleteRect.W + CompleteRect.X) + CompleteRect.W += _Theme.ButtonPlaylistSing.Rect.W + _Theme.ButtonPlaylistSing.Rect.X - CompleteRect.X; + if (_Theme.ButtonPlaylistSing.Rect.Y + _Theme.ButtonPlaylistSing.Rect.H > CompleteRect.Y + CompleteRect.H) + CompleteRect.H += _Theme.ButtonPlaylistSing.Rect.H + _Theme.ButtonPlaylistSing.Rect.Y - CompleteRect.Y; + //ButtonPlaylistSave + if (_Theme.ButtonPlaylistSave.Rect.X < CompleteRect.X) + CompleteRect.X = _Theme.ButtonPlaylistSave.Rect.X; + if (_Theme.ButtonPlaylistSave.Rect.Y < CompleteRect.Y) + CompleteRect.Y = _Theme.ButtonPlaylistSave.Rect.Y; + if (_Theme.ButtonPlaylistSave.Rect.W + _Theme.ButtonPlaylistSave.Rect.X > CompleteRect.W + CompleteRect.X) + CompleteRect.W += _Theme.ButtonPlaylistSave.Rect.W + _Theme.ButtonPlaylistSave.Rect.X - CompleteRect.X; + if (_Theme.ButtonPlaylistSave.Rect.Y + _Theme.ButtonPlaylistSave.Rect.H > CompleteRect.Y + CompleteRect.H) + CompleteRect.H += _Theme.ButtonPlaylistSave.Rect.H + _Theme.ButtonPlaylistSave.Rect.Y - CompleteRect.Y; + //ButtonPlaylistDelete + if (_Theme.ButtonPlaylistDelete.Rect.X < CompleteRect.X) + CompleteRect.X = _Theme.ButtonPlaylistDelete.Rect.X; + if (_Theme.ButtonPlaylistDelete.Rect.Y < CompleteRect.Y) + CompleteRect.Y = _Theme.ButtonPlaylistDelete.Rect.Y; + if (_Theme.ButtonPlaylistDelete.Rect.W + _Theme.ButtonPlaylistDelete.Rect.X > CompleteRect.W + CompleteRect.X) + CompleteRect.W += _Theme.ButtonPlaylistDelete.Rect.W + _Theme.ButtonPlaylistDelete.Rect.X - CompleteRect.X; + if (_Theme.ButtonPlaylistDelete.Rect.Y + _Theme.ButtonPlaylistDelete.Rect.H > CompleteRect.Y + CompleteRect.H) + CompleteRect.H += _Theme.ButtonPlaylistDelete.Rect.H + _Theme.ButtonPlaylistDelete.Rect.Y - CompleteRect.Y; + LoadTextures(); + } + return _ThemeLoaded; + } + + public bool SaveTheme(XmlWriter writer) + { + if (_ThemeLoaded) + { + writer.WriteStartElement(_Theme.Name); + + writer.WriteComment(", , , , : Playlist position, width and height"); + writer.WriteElementString("X", Rect.X.ToString("#0")); + writer.WriteElementString("Y", Rect.Y.ToString("#0")); + writer.WriteElementString("Z", Rect.Z.ToString("#0.00")); + writer.WriteElementString("W", Rect.W.ToString("#0")); + writer.WriteElementString("H", Rect.H.ToString("#0")); + + writer.WriteElementString("EntryHeight", _Theme.EntryHeight.ToString("#0.00")); + + writer.WriteComment(": Texture name"); + writer.WriteElementString("SkinBackground", _Theme.TextureBackgroundName); + + writer.WriteComment(": Texture name for selected playlist-entry"); + writer.WriteElementString("SkinBackgroundSelected", _Theme.STextureBackgroundName); + + writer.WriteComment(": Button color from ColorScheme (high priority)"); + writer.WriteComment("or , , , (lower priority)"); + if (_Theme.ColorBackgroundName != String.Empty) + { + writer.WriteElementString("ColorBackground", _Theme.ColorBackgroundName); + } + else + { + writer.WriteElementString("BackgroundR", BackgroundColor.R.ToString("#0.00")); + writer.WriteElementString("BackgroundG", BackgroundColor.G.ToString("#0.00")); + writer.WriteElementString("BackgroundB", BackgroundColor.B.ToString("#0.00")); + writer.WriteElementString("BackgroundA", BackgroundColor.A.ToString("#0.00")); + } + + writer.WriteComment(": Selected paylist-entry color from ColorScheme (high priority)"); + writer.WriteComment("or , , , (lower priority)"); + if (_Theme.SColorBackgroundName != String.Empty) + { + writer.WriteElementString("SColorBackground", _Theme.SColorBackgroundName); + } + else + { + writer.WriteElementString("SBackgroundR", BackgroundSColor.R.ToString("#0.00")); + writer.WriteElementString("SBackgroundG", BackgroundSColor.G.ToString("#0.00")); + writer.WriteElementString("SBackgroundB", BackgroundSColor.B.ToString("#0.00")); + writer.WriteElementString("SBackgroundA", BackgroundSColor.A.ToString("#0.00")); + } + + writer.WriteComment("Positions of , , , and are relative to playlist-entry!"); + writer.WriteComment("Use placeholders for Text of , and : %t, %a, %l"); + _Theme.Text1.SaveTheme(writer); + _Theme.StaticPlaylistFooter.SaveTheme(writer); + _Theme.StaticPlaylistHeader.SaveTheme(writer); + _Theme.StaticCover.SaveTheme(writer); + _Theme.SelectSlideGameMode.SaveTheme(writer); + _Theme.ButtonPlaylistName.SaveTheme(writer); + _Theme.ButtonPlaylistClose.SaveTheme(writer); + _Theme.ButtonPlaylistDelete.SaveTheme(writer); + _Theme.ButtonPlaylistSave.SaveTheme(writer); + _Theme.ButtonPlaylistSing.SaveTheme(writer); + + writer.WriteEndElement(); + + return true; + } + return false; + } + + public void Draw() + { + Draw(false); + } + + public void ForceDraw() + { + Draw(true); + } + + public void Draw(bool ForceDraw) + { + if (PlaylistElements.Count <= 0) + { + LoadPlaylist(0); + } + if (!Visible && CSettings.GameState != EGameState.EditTheme && !ForceDraw) + return; + + for (int i = 0; i < PlaylistElements.Count; i++ ) + { + if (i == CurrentPlaylistElement && _Selected) + { + PlaylistElements[i].Background.Texture = CTheme.GetSkinTexture(_Theme.STextureBackgroundName); + PlaylistElements[i].Background.Color = BackgroundSColor; + } + else + { + PlaylistElements[i].Background.Texture = CTheme.GetSkinTexture(_Theme.TextureBackgroundName); + PlaylistElements[i].Background.Color = BackgroundColor; + } + } + + _Interactions.Draw(); + } + + public bool IsMouseOver(MouseEvent MouseEvent) + { + return CHelper.IsInBounds(Rect, MouseEvent.X, MouseEvent.Y) || _Interactions.IsMouseOver(MouseEvent); + } + + public void UnloadTextures() + { + } + + public void LoadTextures() + { + _Theme.Text1.LoadTextures(); + + if (_Theme.ColorBackgroundName != String.Empty) + BackgroundColor = CTheme.GetColor(_Theme.ColorBackgroundName); + + if (_Theme.SColorBackgroundName != String.Empty) + BackgroundSColor = CTheme.GetColor(_Theme.SColorBackgroundName); + } + + public void ReloadTextures() + { + UnloadTextures(); + LoadTextures(); + } + + public bool HandleInput(KeyEvent KeyEvent) + { + if (Selected) + { + //Active EditMode ignores other input! + if (_EditMode == EEditMode.PlaylistName) + { + if (KeyEvent.KeyPressed && !Char.IsControl(KeyEvent.Unicode)) + { + _Theme.ButtonPlaylistName.Text.Text = _Theme.ButtonPlaylistName.Text.Text + KeyEvent.Unicode; + } + else if (KeyEvent.Key == Keys.Enter) + { + CPlaylists.Playlists[ActivePlaylistID].PlaylistName = _Theme.ButtonPlaylistName.Text.Text; + CPlaylists.Playlists[ActivePlaylistID].SavePlaylist(); + _EditMode = EEditMode.None; + _Theme.ButtonPlaylistName.EditMode = false; + } + else if (KeyEvent.Key == Keys.Escape) + { + _Theme.ButtonPlaylistName.Text.Text = CPlaylists.Playlists[ActivePlaylistID].PlaylistName; + _EditMode = EEditMode.None; + _Theme.ButtonPlaylistName.EditMode = false; + } + else if (KeyEvent.Key == Keys.Back || KeyEvent.Key == Keys.Delete) + { + if (_Theme.ButtonPlaylistName.Text.Text.Length > 0) + _Theme.ButtonPlaylistName.Text.Text = _Theme.ButtonPlaylistName.Text.Text.Remove(_Theme.ButtonPlaylistName.Text.Text.Length - 1); + } + } + else + { + if (CurrentPlaylistElement == -1 || PlaylistElementContents.Count == 0 || KeyEvent.ModSHIFT) //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; + + //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.HandleInput(KeyEvent); + CurrentPlaylistElement = GetSelectedSelectionNr(); + } + } + 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: + CPlaylists.Playlists[ActivePlaylistID].DeleteSong(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: + StartPlaylistSongs(); + break; + + case Keys.Add: //move the selected song up + if (PlaylistElementContents.Count > 1 && (CurrentPlaylistElement > 0 || Offset > 0)) + { + CPlaylists.Playlists[ActivePlaylistID].SongUp(CurrentPlaylistElement + Offset); + UpdatePlaylist(); + + KeyEvent key = new KeyEvent(); + key.Key = Keys.Up; + + if (CurrentPlaylistElement > ScrollLimit) + { + _Interactions.HandleInput(key); + CurrentPlaylistElement = GetSelectedSelectionNr(); + } + else if (CurrentPlaylistElement <= ScrollLimit) + { + if (Offset > 0) + { + Offset--; + Update(); + } + else + { + _Interactions.HandleInput(key); + CurrentPlaylistElement = GetSelectedSelectionNr(); + } + } + } + break; + + case Keys.Subtract: //move the selected song down + if (PlaylistElementContents.Count > 1 && CurrentPlaylistElement + Offset < PlaylistElementContents.Count - 1) + { + CPlaylists.Playlists[ActivePlaylistID].SongDown(CurrentPlaylistElement + Offset); + UpdatePlaylist(); + + KeyEvent key = new KeyEvent(); + key.Key = Keys.Down; + + 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.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) + { + CPlaylists.Playlists[ActivePlaylistID].Songs[CurrentPlaylistElement + Offset].GameMode = PlaylistElementContents[CurrentPlaylistElement + Offset].Modes[PlaylistElements[CurrentPlaylistElement].SelectSlide.Selection]; + UpdatePlaylist(); + } + break; + + case Keys.Right: + _Interactions.HandleInput(KeyEvent); + CurrentPlaylistElement = GetSelectedSelectionNr(); + + if (CurrentPlaylistElement != -1) + { + CPlaylists.Playlists[ActivePlaylistID].Songs[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) + { + _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) + { + CPlaylists.SavePlaylist(ActivePlaylistID); + } + else if (_Theme.ButtonPlaylistDelete.Selected) + { + CPlaylists.DeletePlaylist(ActivePlaylistID); + ClosePlaylist(); + } + 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; + } + } + } + return true; + } + + private void SetSelectionToLastEntry() + { + if (PlaylistElementContents.Count == 0) + return; + + int off = PlaylistElementContents.Count - PlaylistElements.Count; + if (off >= 0) + Offset = off; + else + Offset = 0; + + Update(); + + for (int i = PlaylistElements.Count - 1; i >= 0; i--) + { + if (PlaylistElements[i].SelectSlide.Visible) + { + CurrentPlaylistElement = i; + return; + } + } + } + + private void SetSelectionToFirstEntry() + { + if (PlaylistElementContents.Count == 0) + return; + + Offset = 0; + Update(); + + CurrentPlaylistElement = 0; + } + + private int GetSelectedSelectionNr() + { + for (int i = 0; i < PlaylistElements.Count; i++) + { + if (PlaylistElements[i].SelectSlide.Selected) + return i; + } + return -1; + } + + public void ScrollToBottom() + { + if (PlaylistElementContents.Count == 0) + return; + + int off = PlaylistElementContents.Count - PlaylistElements.Count; + if (off >= 0) + Offset = off; + else + Offset = 0; + + Update(); + } + + public bool HandleMouse(MouseEvent MouseEvent) + { + _Interactions.HandleMouse(MouseEvent); + + if (CHelper.IsInBounds(CompleteRect, MouseEvent) && Visible) + { + switch (_EditMode) + { + //Normal mode + case EEditMode.None: + //Scroll + if (MouseEvent.Wheel > 0) + { + if (PlaylistElements.Count + Offset + MouseEvent.Wheel <= PlaylistElementContents.Count) + { + Offset += MouseEvent.Wheel; + Update(); + return true; + } + return true; + } + else if (MouseEvent.Wheel < 0) + { + if (Offset + MouseEvent.Wheel >= 0) + { + Offset += MouseEvent.Wheel; + Update(); + return true; + } + return true; + } + //LB actions + if (MouseEvent.LB) + { + if (CurrentPlaylistElement != -1) + { + CPlaylists.Playlists[ActivePlaylistID].Songs[CurrentPlaylistElement + Offset].GameMode = PlaylistElementContents[CurrentPlaylistElement + Offset].Modes[PlaylistElements[CurrentPlaylistElement].SelectSlide.Selection]; + UpdatePlaylist(); + } + if (_Theme.ButtonPlaylistClose.Selected) + { + ClosePlaylist(); + return true; + } + else if (_Theme.ButtonPlaylistSing.Selected) + { + StartPlaylistSongs(); + return true; + } + else if (_Theme.ButtonPlaylistSave.Selected) + { + CPlaylists.SavePlaylist(ActivePlaylistID); + return true; + } + else if (_Theme.ButtonPlaylistDelete.Selected) + { + CPlaylists.DeletePlaylist(ActivePlaylistID); + ClosePlaylist(); + return true; + } + else if (_Theme.ButtonPlaylistName.Selected) + { + _EditMode = EEditMode.PlaylistName; + _Theme.ButtonPlaylistName.EditMode = true; + return true; + } + } + //Actions according to playlist-element + bool hover_set = false; + for (int i = 0; i < PlaylistElements.Count; i++) + { + //Hover for playlist-element + if (PlaylistElementContents.Count - 1 >= i && CHelper.IsInBounds(PlaylistElements[i].Background.Rect, MouseEvent)) + { + hover_set = true; + CurrentPlaylistElement = i; + _Interactions.SetInteractionToSelectSlide(PlaylistElements[CurrentPlaylistElement].SelectSlide); + } + + //Delete Entry with RB + if (CHelper.IsInBounds(PlaylistElements[i].Background.Rect, MouseEvent) && MouseEvent.RB && PlaylistElements[i].Content != -1) + { + CPlaylists.Playlists[ActivePlaylistID].DeleteSong(PlaylistElements[i].Content); + UpdatePlaylist(); + return true; + } + } + if(!hover_set) + { + CurrentPlaylistElement = -1; + } + break; + + case EEditMode.PlaylistName: + _Interactions.SetInteractionToButton(_Theme.ButtonPlaylistName); + CurrentPlaylistElement = -1; + if (MouseEvent.LB) + { + if (_Theme.ButtonPlaylistName.Selected) + { + CPlaylists.Playlists[ActivePlaylistID].PlaylistName = _Theme.ButtonPlaylistName.Text.Text; + CPlaylists.Playlists[ActivePlaylistID].SavePlaylist(); + _EditMode = EEditMode.None; + return true; + } + } + else if (MouseEvent.RB) + { + if (_Theme.ButtonPlaylistName.Selected) + { + _Theme.ButtonPlaylistName.Text.Text = CPlaylists.Playlists[ActivePlaylistID].PlaylistName; + _EditMode = EEditMode.None; + _Theme.ButtonPlaylistName.EditMode = false; + return true; + } + } + break; + + case EEditMode.ChangeOrder: + //Actions according to playlist-element + for (int i = 0; i < PlaylistElements.Count; i++) + { + //Change order with holding LB + if (CHelper.IsInBounds(PlaylistElements[i].Background.Rect, MouseEvent) && MouseEvent.LBH && PlaylistElements[i].Content != -1 && _EditMode != EEditMode.ChangeOrder) + { + _EditMode = EEditMode.ChangeOrder; + CurrentPlaylistElement = i; + } + else if (CHelper.IsInBounds(PlaylistElements[i].Background.Rect, MouseEvent) && MouseEvent.LBH && PlaylistElements[i].Content != -1 && _EditMode == EEditMode.ChangeOrder) + { + /* + if (PlaylistElements.Count < CurrentPlaylistElement + 1) + { + } + else if (PlaylistElementContents.Count < CurrentPlaylistElement + 1 + Offset) + { + } + if (mevent.Y < PlaylistElements[CurrentPlaylistElement + 1].Background.Rect.Y) + { + } + */ + } + } + break; + } + } + return false; + } + + private void PrepareList() + { + PlaylistElements.Clear(); + for (int i = 0; i < Math.Floor(Rect.H / _Theme.EntryHeight); i++) + { + PlaylistElement en = new PlaylistElement(); + en.Background = new CStatic(_Theme.TextureBackgroundName, BackgroundColor, new SRectF(Rect.X, Rect.Y + (i * _Theme.EntryHeight), Rect.W, _Theme.EntryHeight, Rect.Z)); + en.Cover = new CStatic(new STexture(), _Theme.StaticCover.Color, new SRectF(Rect.X + _Theme.StaticCover.Rect.X, Rect.Y + _Theme.StaticCover.Rect.Y + (i * _Theme.EntryHeight), _Theme.StaticCover.Rect.W, _Theme.StaticCover.Rect.H, _Theme.StaticCover.Rect.Z)); + en.Text1 = new CText(Rect.X + _Theme.Text1.X, Rect.Y + _Theme.Text1.Y + (i * _Theme.EntryHeight), _Theme.Text1.Z, _Theme.Text1.Height, _Theme.Text1.MaxWidth, _Theme.Text1.Align, _Theme.Text1.Style, _Theme.Text1.Fon, _Theme.Text1.Color, "", _Theme.Text1.ReflectionSpace, _Theme.Text1.ReflectionHeight); + + en.SelectSlide = new CSelectSlide(_Theme.SelectSlideGameMode); + en.SelectSlide.Rect = new SRectF(Rect.X + _Theme.SelectSlideGameMode.Rect.X, Rect.Y + _Theme.SelectSlideGameMode.Rect.Y + (i * _Theme.EntryHeight), _Theme.SelectSlideGameMode.Rect.W, _Theme.SelectSlideGameMode.Rect.H, _Theme.SelectSlideGameMode.Rect.Z); + en.SelectSlide.RectArrowLeft = new SRectF(Rect.X + _Theme.SelectSlideGameMode.RectArrowLeft.X, Rect.Y + _Theme.SelectSlideGameMode.RectArrowLeft.Y + (i * _Theme.EntryHeight), _Theme.SelectSlideGameMode.RectArrowLeft.W, _Theme.SelectSlideGameMode.RectArrowLeft.H, _Theme.SelectSlideGameMode.RectArrowLeft.Z); + en.SelectSlide.RectArrowRight = new SRectF(Rect.X + _Theme.SelectSlideGameMode.RectArrowRight.X, Rect.Y + _Theme.SelectSlideGameMode.RectArrowRight.Y + (i * _Theme.EntryHeight), _Theme.SelectSlideGameMode.RectArrowRight.W, _Theme.SelectSlideGameMode.RectArrowRight.H, _Theme.SelectSlideGameMode.RectArrowRight.Z); + en.Content = -1; + PlaylistElements.Add(en); + _Interactions.AddSelectSlide(en.SelectSlide); + _Interactions.AddText(en.Text1); + _Interactions.AddStatic(en.Background); + _Interactions.AddStatic(en.Cover); + } + } + + public bool LoadPlaylist(int PlaylistID) + { + if (PlaylistID > -1 && PlaylistID < CPlaylists.NumPlaylists) + { + _Theme.ButtonPlaylistName.Text.Text = CPlaylists.Playlists[ActivePlaylistID].PlaylistName; + ActivePlaylistID = PlaylistID; + PlaylistElementContents.Clear(); + for (int i = 0; i < CPlaylists.Playlists[ActivePlaylistID].Songs.Count; i++) + { + PlaylistElementContent pec = new PlaylistElementContent(); + pec.SongID = CPlaylists.Playlists[ActivePlaylistID].Songs[i].SongID; + pec.Modes = CSongs.AllSongs[CPlaylists.Playlists[ActivePlaylistID].Songs[i].SongID].AvailableGameModes; + pec.Mode = CPlaylists.Playlists[ActivePlaylistID].Songs[i].GameMode; + PlaylistElementContents.Add(pec); + } + Update(); + return true; + } + else + return false; + } + + public void UpdatePlaylist() + { + PlaylistElementContents.Clear(); + for (int i = 0; i < CPlaylists.Playlists[ActivePlaylistID].Songs.Count; i++) + { + PlaylistElementContent pec = new PlaylistElementContent(); + pec.SongID = CPlaylists.Playlists[ActivePlaylistID].Songs[i].SongID; + pec.Modes = CSongs.AllSongs[pec.SongID].AvailableGameModes; + pec.Mode = CPlaylists.Playlists[ActivePlaylistID].Songs[i].GameMode; + PlaylistElementContents.Add(pec); + } + + Update(); + } + + private void StartPlaylistSongs() + { + CGame.Reset(); + CGame.ClearSongs(); + + if (ActivePlaylistID > -1 && ActivePlaylistID < CPlaylists.NumPlaylists) + { + for (int i = 0; i < CPlaylists.Playlists[ActivePlaylistID].Songs.Count; i++) + { + CGame.AddSong(CPlaylists.Playlists[ActivePlaylistID].Songs[i].SongID, CPlaylists.Playlists[ActivePlaylistID].Songs[i].GameMode); + } + if (CGame.GetNumSongs() > 0) + CGraphics.FadeTo(EScreens.ScreenNames); + } + } + + private void ClosePlaylist() + { + Visible = false; + Selected = false; + ActivePlaylistID = -1; + } + + public void Update() + { + if (ActivePlaylistID > -1 && ActivePlaylistID < CPlaylists.NumPlaylists) + { + for (int i = 0; i < PlaylistElements.Count; i++ ) + { + if (Offset + i < PlaylistElementContents.Count) + { + PlaylistElements[i].Content = Offset + i; + PlaylistElements[i].Background.Visible = true; + PlaylistElements[i].Cover.Visible = true; + PlaylistElements[i].SelectSlide.Visible = true; + PlaylistElements[i].Text1.Visible = true; + PlaylistElementContent pec = PlaylistElementContents[Offset + i]; + CSong song = CSongs.GetSong(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].SelectSlide.Clear(); + for (int g = 0; g < pec.Modes.Length; g++) + { + PlaylistElements[i].SelectSlide.AddValue(Enum.GetName(typeof(GameModes.EGameMode), pec.Modes[g])); + if (pec.Modes[g] == pec.Mode) + PlaylistElements[i].SelectSlide.SetSelectionByValueIndex(g); + } + } + else + { + PlaylistElements[i].Background.Visible = false; + PlaylistElements[i].Cover.Visible = false; + PlaylistElements[i].SelectSlide.Visible = false; + PlaylistElements[i].Text1.Visible = false; + PlaylistElements[i].Content = -1; + } + } + } + } + + #region ThemeEdit + public void MoveElement(int stepX, int stepY) + { + Rect.X += stepX; + Rect.Y += stepY; + } + + public void ResizeElement(int stepW, int stepH) + { + Rect.W += stepW; + if (Rect.W <= 0) + Rect.W = 1; + + Rect.H += stepH; + if (Rect.H <= 0) + Rect.H = 1; + } + #endregion ThemeEdit + } +} diff --git a/Vocaluxe/Menu/CSelectSlide.cs b/Vocaluxe/Menu/CSelectSlide.cs index 5b10c514..28fb9493 100644 --- a/Vocaluxe/Menu/CSelectSlide.cs +++ b/Vocaluxe/Menu/CSelectSlide.cs @@ -38,11 +38,16 @@ namespace Vocaluxe.Menu public EStyle TextStyle; } - class CSelectSlide : IMenuElement + class CSelectSlide : IMenuElement, ICloneable { private SThemeSelectSlide _Theme; private bool _ThemeLoaded; + public string GetThemeName() + { + return _Theme.Name; + } + public SRectF Rect; public SRectF RectArrowLeft; public SRectF RectArrowRight; @@ -112,6 +117,14 @@ namespace Vocaluxe.Menu } } + public int NumValues + { + get + { + return _ValueNames.Count; + } + } + private int _NumVisible = -1; public int NumVisible { @@ -151,6 +164,56 @@ namespace Vocaluxe.Menu _ValueNames = new List(); } + public CSelectSlide(CSelectSlide slide) + { + _Theme = new SThemeSelectSlide(); + + _Theme.TextureArrowLeftName = slide._Theme.TextureArrowLeftName; + _Theme.TextureArrowRightName = slide._Theme.TextureArrowRightName; + + _Theme.STextureName = slide._Theme.STextureName; + _Theme.STextureArrowLeftName = slide._Theme.STextureArrowLeftName; + _Theme.STextureArrowRightName = slide._Theme.STextureArrowRightName; + + _Theme.HTextureName = slide._Theme.HTextureName; + + _Theme.ColorName = slide._Theme.ColorName; + _Theme.SColorName = slide._Theme.SColorName; + _Theme.HColorName = slide._Theme.HColorName; + + _Theme.ArrowColorName = slide._Theme.ArrowColorName; + _Theme.SArrowColorName = slide._Theme.SArrowColorName; + + _Theme.TextColorName = slide._Theme.TextColorName; + _Theme.STextColorName = slide._Theme.STextColorName; + + _Theme.TextFont = slide._Theme.TextFont; + _Theme.TextStyle = slide._Theme.TextStyle; + + _ThemeLoaded = false; + + Rect = new SRectF(slide.Rect); + RectArrowLeft = new SRectF(slide.RectArrowLeft); + RectArrowRight = new SRectF(slide.RectArrowRight); + + Color = new SColorF(slide.Color); + SColor = new SColorF(slide.SColor); + + ColorArrow = new SColorF(slide.ColorArrow); + SColorArrow = new SColorF(slide.SColorArrow); + + TextColor = new SColorF(slide.TextColor); + STextColor = new SColorF(slide.STextColor); + TextH = slide.TextH; + MaxW = slide.MaxW; + + _Selected = false; + _Textures = new List(); + _ValueIndexes = new List(); + _ValueNames = new List(); + _NumVisible = slide._NumVisible; + } + public bool LoadTheme(string XmlPath, string ElementName, XPathNavigator navigator, int SkinIndex) { string item = XmlPath + "/" + ElementName; @@ -746,6 +809,11 @@ namespace Vocaluxe.Menu LoadTextures(); } + public object Clone() + { + return base.MemberwiseClone(); + } + #region ThemeEdit public void MoveElement(int stepX, int stepY) { diff --git a/Vocaluxe/Menu/CStatic.cs b/Vocaluxe/Menu/CStatic.cs index 98e4e9f4..37d29d04 100644 --- a/Vocaluxe/Menu/CStatic.cs +++ b/Vocaluxe/Menu/CStatic.cs @@ -22,6 +22,11 @@ namespace Vocaluxe.Menu private SThemeStatic _Theme; private bool _ThemeLoaded; + public string GetThemeName() + { + return _Theme.Name; + } + private STexture _Texture; public STexture Texture { diff --git a/Vocaluxe/Menu/CText.cs b/Vocaluxe/Menu/CText.cs index 012709dc..c1ccb39a 100644 --- a/Vocaluxe/Menu/CText.cs +++ b/Vocaluxe/Menu/CText.cs @@ -41,6 +41,12 @@ namespace Vocaluxe.Menu { private SThemeText _Theme; private bool _ThemeLoaded; + + public string GetThemeName() + { + return _Theme.Name; + } + private bool _ButtonText; private bool _PositionNeedsUpdate = true; @@ -211,6 +217,7 @@ namespace Vocaluxe.Menu public bool Selected; public bool Visible = true; + public bool EditMode = false; public float Alpha = 1f; @@ -538,7 +545,7 @@ namespace Vocaluxe.Menu writer.WriteComment(": Text font name"); writer.WriteElementString("Font", Fon); - writer.WriteComment(": Text or translation tag"); + writer.WriteComment(": Nothing or translation tag"); if (CLanguage.TranslationExists(_Theme.Text)) writer.WriteElementString("Text", _Theme.Text); else @@ -596,8 +603,10 @@ namespace Vocaluxe.Menu SColorF color = new SColorF(CurrentColor.R, CurrentColor.G, CurrentColor.B, CurrentColor.A * Alpha); - - CFonts.DrawText(_Text, _DrawPosition.tH, _DrawPosition.X, _DrawPosition.Y, Z, color); + if (!EditMode) + CFonts.DrawText(_Text, _DrawPosition.tH, _DrawPosition.X, _DrawPosition.Y, Z, color); + else + CFonts.DrawText(_Text + "|", _DrawPosition.tH, _DrawPosition.X, _DrawPosition.Y, Z, color); if (Reflection) { @@ -616,7 +625,10 @@ namespace Vocaluxe.Menu default: break; } - CFonts.DrawTextReflection(_Text, _DrawPosition.tH, _DrawPosition.X, _DrawPosition.Y, Z, color, ReflectionSpace + sFactor, ReflectionHeight); + if (!EditMode) + CFonts.DrawTextReflection(_Text, _DrawPosition.tH, _DrawPosition.X, _DrawPosition.Y, Z, color, ReflectionSpace + sFactor, ReflectionHeight); + else + CFonts.DrawTextReflection(_Text + "|", _DrawPosition.tH, _DrawPosition.X, _DrawPosition.Y, Z, color, ReflectionSpace + sFactor, ReflectionHeight); } if (Selected && (CSettings.GameState == EGameState.EditTheme)) @@ -653,7 +665,11 @@ namespace Vocaluxe.Menu CFonts.SetFont(Fon); CFonts.Style = Style; - CFonts.DrawText(Text, Height, x, Y, Z, color, begin, end); + + if (!EditMode) + CFonts.DrawText(Text, Height, x, Y, Z, color, begin, end); + else + CFonts.DrawText(Text + "|", Height, x, Y, Z, color, begin, end); if (Reflection) { @@ -732,13 +748,21 @@ namespace Vocaluxe.Menu CFonts.SetFont(Fon); CFonts.Style = Style; - CFonts.DrawText(_Text, h, x, y, Z, color); + + if (!EditMode) + CFonts.DrawText(_Text, h, x, y, Z, color); + else + CFonts.DrawText(_Text + "|", h, x, y, Z, color); if (reflection) { float space = (rectHeight - Y - bounds.Height) * 2f + reflectionSpace; float height = reflectionHeight - (rectHeight - Y) + bounds.Height; - CFonts.DrawTextReflection(_Text, h, x, y, Z, color, space, height); + + if (!EditMode) + CFonts.DrawTextReflection(_Text, h, x, y, Z, color, space, height); + else + CFonts.DrawTextReflection(_Text + "|", h, x, y, Z, color, space, height); } if (Selected && (CSettings.GameState == EGameState.EditTheme)) diff --git a/Vocaluxe/Menu/IMenuElement.cs b/Vocaluxe/Menu/IMenuElement.cs index 25e56c50..152e4ec1 100644 --- a/Vocaluxe/Menu/IMenuElement.cs +++ b/Vocaluxe/Menu/IMenuElement.cs @@ -8,6 +8,7 @@ namespace Vocaluxe.Menu { interface IMenuElement { + string GetThemeName(); bool LoadTheme(string XmlPath, string ElementName, XPathNavigator navigator, int SkinIndex); bool SaveTheme(XmlWriter writer); diff --git a/Vocaluxe/Menu/SingNotes/CSingNotes.cs b/Vocaluxe/Menu/SingNotes/CSingNotes.cs index 57ff23fa..244d380b 100644 --- a/Vocaluxe/Menu/SingNotes/CSingNotes.cs +++ b/Vocaluxe/Menu/SingNotes/CSingNotes.cs @@ -75,6 +75,11 @@ namespace Vocaluxe.Menu.SingNotes _ActID = 0; } + public string GetThemeName() + { + return _Theme.Name; + } + public bool LoadTheme(string XmlPath, string ElementName, XPathNavigator navigator, int SkinIndex) { string item = XmlPath + "/" + ElementName; @@ -304,7 +309,7 @@ namespace Vocaluxe.Menu.SingNotes float h = _PlayerNotes[n].Rect.H; float dh = h / CSettings.NumNoteLines * (2f - (int)CGame.Player[_PlayerNotes[n].PlayerNr].Difficulty) / 4f; - float beats = Line.LastBeat - Line.FirstBeat + 1; + float beats = Line.LastNoteBeat - Line.FirstNoteBeat + 1; if (beats == 0) return; @@ -324,7 +329,7 @@ namespace Vocaluxe.Menu.SingNotes float width = note.Duration / beats * w; SRectF rect = new SRectF( - _PlayerNotes[n].Rect.X + (note.StartBeat - Line.FirstBeat) / beats * w, + _PlayerNotes[n].Rect.X + (note.StartBeat - Line.FirstNoteBeat) / beats * w, _PlayerNotes[n].Rect.Y + (CSettings.NumNoteLines - 1 - (note.Tone - BaseLine)/2) / CSettings.NumNoteLines * h - dh, width, h / CSettings.NumNoteLines + 2 * dh, @@ -344,7 +349,7 @@ namespace Vocaluxe.Menu.SingNotes if (CConfig.DrawToneHelper == EOffOn.TR_CONFIG_ON) { - DrawToneHelper(n, (int)BaseLine, (CGame.MidBeatD - Line.FirstBeat) / beats * w); + DrawToneHelper(n, (int)BaseLine, (CGame.MidBeatD - Line.FirstNoteBeat) / beats * w); } int i = 0; @@ -377,7 +382,7 @@ namespace Vocaluxe.Menu.SingNotes foreach (CNote note in SingLine[CGame.Player[Player].CurrentLine].Notes) { - if (note.StartBeat >= Line.FirstBeat && note.EndBeat <= Line.LastBeat) + if (note.StartBeat >= Line.FirstNoteBeat && note.EndBeat <= Line.LastNoteBeat) { float width = note.Duration / beats * w; @@ -385,7 +390,7 @@ namespace Vocaluxe.Menu.SingNotes width -= (1 - (CGame.MidBeatD - CGame.ActBeatD)) / beats * w; SRectF rect = new SRectF( - _PlayerNotes[n].Rect.X + (note.StartBeat - Line.FirstBeat) / beats * w, + _PlayerNotes[n].Rect.X + (note.StartBeat - Line.FirstNoteBeat) / beats * w, _PlayerNotes[n].Rect.Y + (CSettings.NumNoteLines - 1 - (note.Tone - BaseLine)/2) / CSettings.NumNoteLines * h - dh, width, h / CSettings.NumNoteLines + 2 * dh, diff --git a/Vocaluxe/Menu/SongMenu/CSongMenu.cs b/Vocaluxe/Menu/SongMenu/CSongMenu.cs index b37e1e04..7f437ab0 100644 --- a/Vocaluxe/Menu/SongMenu/CSongMenu.cs +++ b/Vocaluxe/Menu/SongMenu/CSongMenu.cs @@ -73,6 +73,16 @@ namespace Vocaluxe.Menu.SongMenu _SongMenu.Draw(); } + public bool IsActive() + { + return _SongMenu.IsActive(); + } + + public void SetActive(bool Active) + { + _SongMenu.SetActive(Active); + } + public int GetSelectedSong() { return _SongMenu.GetSelectedSong(); @@ -118,9 +128,24 @@ namespace Vocaluxe.Menu.SongMenu return _SongMenu.GetRect(); } + public bool IsSmallView() + { + return _SongMenu.IsSmallView(); + } + + public void SetSmallView(bool SmallView) + { + _SongMenu.SetSmallView(SmallView); + } + #endregion ISongMenu #region IMenuElement + public string GetThemeName() + { + return _SongMenu.GetThemeName(); + } + public bool LoadTheme(string XmlPath, string ElementName, XPathNavigator navigator, int SkinIndex) { return _SongMenu.LoadTheme(XmlPath, ElementName, navigator, SkinIndex); diff --git a/Vocaluxe/Menu/SongMenu/CSongMenuFramework.cs b/Vocaluxe/Menu/SongMenu/CSongMenuFramework.cs index ac6bf659..5dbfe865 100644 --- a/Vocaluxe/Menu/SongMenu/CSongMenuFramework.cs +++ b/Vocaluxe/Menu/SongMenu/CSongMenuFramework.cs @@ -20,6 +20,9 @@ namespace Vocaluxe.Menu.SongMenu public string DuetIconName; public string VideoIconName; + public string MedleyCalcIcon; + public string MedleyTagIcon; + public string ColorName; //public SThemeSongMenuBook songMenuBook; @@ -52,6 +55,16 @@ namespace Vocaluxe.Menu.SongMenu /// public int numH; + /// + /// Number of tiles horizontal in small-modus + /// + public int numWsmall; + + /// + /// Number of tiles vertical in small-modus + /// + public int numHsmall; + /// /// Space between tiles horizontal /// @@ -63,6 +76,7 @@ namespace Vocaluxe.Menu.SongMenu public float spaceH; public SRectF TileRect; + public SRectF TileRectSmall; public CText TextArtist; public CText TextTitle; @@ -72,6 +86,8 @@ namespace Vocaluxe.Menu.SongMenu public CStatic StaticTextBG; public CStatic StaticDuetIcon; public CStatic StaticVideoIcon; + public CStatic StaticMedleyCalcIcon; + public CStatic StaticMedleyTagIcon; } abstract class CSongMenuFramework : ISongMenu @@ -99,6 +115,7 @@ namespace Vocaluxe.Menu.SongMenu protected long _PendingTime = 500L; private int _LockedInternal = -1; + protected bool _Active = false; protected int _PreviewSelected //for preview only { @@ -201,6 +218,7 @@ namespace Vocaluxe.Menu.SongMenu public void SetSelected(bool Selected) { _Selected = Selected; + SetActive(Selected); } public bool IsVisible() @@ -225,10 +243,17 @@ namespace Vocaluxe.Menu.SongMenu _Theme.songMenuTileBoard.StaticTextBG = new CStatic(); _Theme.songMenuTileBoard.StaticDuetIcon = new CStatic(); _Theme.songMenuTileBoard.StaticVideoIcon = new CStatic(); + _Theme.songMenuTileBoard.StaticMedleyCalcIcon = new CStatic(); + _Theme.songMenuTileBoard.StaticMedleyTagIcon = new CStatic(); _ThemeLoaded = false; } + public string GetThemeName() + { + return _Theme.Name; + } + public bool LoadTheme(string XmlPath, string ElementName, XPathNavigator navigator, int SkinIndex) { string item = XmlPath + "/" + ElementName; @@ -238,13 +263,8 @@ namespace Vocaluxe.Menu.SongMenu _ThemeLoaded &= CHelper.GetValueFromXML(item + "/CoverBigBackground", navigator, ref _Theme.CoverBigBackgroundName, String.Empty); _ThemeLoaded &= CHelper.GetValueFromXML(item + "/DuetIcon", navigator, ref _Theme.DuetIconName, String.Empty); _ThemeLoaded &= CHelper.GetValueFromXML(item + "/VideoIcon", navigator, ref _Theme.VideoIconName, String.Empty); - - - _ThemeLoaded &= CHelper.TryGetFloatValueFromXML(item + "/X", navigator, ref _Rect.X); - _ThemeLoaded &= CHelper.TryGetFloatValueFromXML(item + "/Y", navigator, ref _Rect.Y); - _ThemeLoaded &= CHelper.TryGetFloatValueFromXML(item + "/Z", navigator, ref _Rect.Z); - _ThemeLoaded &= CHelper.TryGetFloatValueFromXML(item + "/W", navigator, ref _Rect.W); - _ThemeLoaded &= CHelper.TryGetFloatValueFromXML(item + "/H", navigator, ref _Rect.H); + _ThemeLoaded &= CHelper.GetValueFromXML(item + "/MedleyCalcIcon", navigator, ref _Theme.MedleyCalcIcon, String.Empty); + _ThemeLoaded &= CHelper.GetValueFromXML(item + "/MedleyTagIcon", navigator, ref _Theme.MedleyTagIcon, String.Empty); if (CHelper.GetValueFromXML(item + "/Color", navigator, ref _Theme.ColorName, String.Empty)) { @@ -264,6 +284,9 @@ namespace Vocaluxe.Menu.SongMenu _ThemeLoaded &= CHelper.TryGetFloatValueFromXML(item + "/SongMenuTileBoard/SpaceW", navigator, ref _Theme.songMenuTileBoard.spaceW); _ThemeLoaded &= CHelper.TryGetFloatValueFromXML(item + "/SongMenuTileBoard/SpaceH", navigator, ref _Theme.songMenuTileBoard.spaceH); + _ThemeLoaded &= CHelper.TryGetIntValueFromXML(item + "/SongMenuTileBoard/NumWsmall", navigator, ref _Theme.songMenuTileBoard.numWsmall); + _ThemeLoaded &= CHelper.TryGetIntValueFromXML(item + "/SongMenuTileBoard/NumHsmall", navigator, ref _Theme.songMenuTileBoard.numHsmall); + _ThemeLoaded &= _Theme.songMenuTileBoard.TextArtist.LoadTheme(item + "/SongMenuTileBoard", "TextArtist", navigator, SkinIndex); _ThemeLoaded &= _Theme.songMenuTileBoard.TextTitle.LoadTheme(item + "/SongMenuTileBoard", "TextTitle", navigator, SkinIndex); _ThemeLoaded &= _Theme.songMenuTileBoard.TextSongLength.LoadTheme(item + "/SongMenuTileBoard", "TextSongLength", navigator, SkinIndex); @@ -272,6 +295,8 @@ namespace Vocaluxe.Menu.SongMenu _ThemeLoaded &= _Theme.songMenuTileBoard.StaticTextBG.LoadTheme(item + "/SongMenuTileBoard", "StaticTextBG", navigator, SkinIndex); _ThemeLoaded &= _Theme.songMenuTileBoard.StaticDuetIcon.LoadTheme(item + "/SongMenuTileBoard", "StaticDuetIcon", navigator, SkinIndex); _ThemeLoaded &= _Theme.songMenuTileBoard.StaticVideoIcon.LoadTheme(item + "/SongMenuTileBoard", "StaticVideoIcon", navigator, SkinIndex); + _ThemeLoaded &= _Theme.songMenuTileBoard.StaticMedleyCalcIcon.LoadTheme(item + "/SongMenuTileBoard", "StaticMedleyCalcIcon", navigator, SkinIndex); + _ThemeLoaded &= _Theme.songMenuTileBoard.StaticMedleyTagIcon.LoadTheme(item + "/SongMenuTileBoard", "StaticMedleyTagIcon", navigator, SkinIndex); _ThemeLoaded &= CHelper.TryGetFloatValueFromXML(item + "/SongMenuTileBoard/TileRectX", navigator, ref _Theme.songMenuTileBoard.TileRect.X); _ThemeLoaded &= CHelper.TryGetFloatValueFromXML(item + "/SongMenuTileBoard/TileRectY", navigator, ref _Theme.songMenuTileBoard.TileRect.Y); @@ -279,6 +304,12 @@ namespace Vocaluxe.Menu.SongMenu _ThemeLoaded &= CHelper.TryGetFloatValueFromXML(item + "/SongMenuTileBoard/TileRectW", navigator, ref _Theme.songMenuTileBoard.TileRect.W); _ThemeLoaded &= CHelper.TryGetFloatValueFromXML(item + "/SongMenuTileBoard/TileRectH", navigator, ref _Theme.songMenuTileBoard.TileRect.H); + _ThemeLoaded &= CHelper.TryGetFloatValueFromXML(item + "/SongMenuTileBoard/TileRectSmallX", navigator, ref _Theme.songMenuTileBoard.TileRectSmall.X); + _ThemeLoaded &= CHelper.TryGetFloatValueFromXML(item + "/SongMenuTileBoard/TileRectSmallY", navigator, ref _Theme.songMenuTileBoard.TileRectSmall.Y); + _ThemeLoaded &= CHelper.TryGetFloatValueFromXML(item + "/SongMenuTileBoard/TileRectSmallZ", navigator, ref _Theme.songMenuTileBoard.TileRectSmall.Z); + _ThemeLoaded &= CHelper.TryGetFloatValueFromXML(item + "/SongMenuTileBoard/TileRectSmallW", navigator, ref _Theme.songMenuTileBoard.TileRectSmall.W); + _ThemeLoaded &= CHelper.TryGetFloatValueFromXML(item + "/SongMenuTileBoard/TileRectSmallH", navigator, ref _Theme.songMenuTileBoard.TileRectSmall.H); + #endregion SongMenuTileBoard if (_ThemeLoaded) @@ -309,12 +340,11 @@ namespace Vocaluxe.Menu.SongMenu writer.WriteComment(": Texture name of video icon"); writer.WriteElementString("VideoIcon", _Theme.VideoIconName); - writer.WriteComment(", , , , : SongMenu position, width and height"); - writer.WriteElementString("X", _Rect.X.ToString("#0")); - writer.WriteElementString("Y", _Rect.Y.ToString("#0")); - writer.WriteElementString("Z", _Rect.Z.ToString("#0.00")); - writer.WriteElementString("W", _Rect.W.ToString("#0")); - writer.WriteElementString("H", _Rect.H.ToString("#0")); + writer.WriteComment(": Texture name of medley calc (calculated) icon"); + writer.WriteElementString("MedleyCalcIcon", _Theme.MedleyCalcIcon); + + writer.WriteComment(": Texture name of medley tag (manuelly set) icon"); + writer.WriteElementString("MedleyTagIcon", _Theme.MedleyTagIcon); writer.WriteComment(": Tile color from ColorScheme (high priority)"); writer.WriteComment("or , , , (lower priority)"); @@ -346,6 +376,12 @@ namespace Vocaluxe.Menu.SongMenu writer.WriteComment(": Space between tiles vertical"); writer.WriteElementString("SpaceH", _Theme.songMenuTileBoard.spaceH.ToString("#0.00")); + writer.WriteComment(": Number of tiles horizontal in small-mode"); + writer.WriteElementString("NumWsmall", _Theme.songMenuTileBoard.numWsmall.ToString()); + + writer.WriteComment(": Number of tiles vertical in small-mode"); + writer.WriteElementString("NumHsmall", _Theme.songMenuTileBoard.numHsmall.ToString()); + writer.WriteComment(", , , , : SongMenu position, width and height"); writer.WriteElementString("TileRectX", _Theme.songMenuTileBoard.TileRect.X.ToString("#0")); writer.WriteElementString("TileRectY", _Theme.songMenuTileBoard.TileRect.Y.ToString("#0")); @@ -353,6 +389,13 @@ namespace Vocaluxe.Menu.SongMenu writer.WriteElementString("TileRectW", _Theme.songMenuTileBoard.TileRect.W.ToString("#0")); writer.WriteElementString("TileRectH", _Theme.songMenuTileBoard.TileRect.H.ToString("#0")); + writer.WriteComment(", , , , : SongMenu position, width and height in small-mode"); + writer.WriteElementString("TileRectSmallX", _Theme.songMenuTileBoard.TileRectSmall.X.ToString("#0")); + writer.WriteElementString("TileRectSmallY", _Theme.songMenuTileBoard.TileRectSmall.Y.ToString("#0")); + writer.WriteElementString("TileRectSmallZ", _Theme.songMenuTileBoard.TileRectSmall.Z.ToString("#0.00")); + writer.WriteElementString("TileRectSmallW", _Theme.songMenuTileBoard.TileRectSmall.W.ToString("#0")); + writer.WriteElementString("TileRectSmallH", _Theme.songMenuTileBoard.TileRectSmall.H.ToString("#0")); + _Theme.songMenuTileBoard.TextArtist.SaveTheme(writer); _Theme.songMenuTileBoard.TextTitle.SaveTheme(writer); _Theme.songMenuTileBoard.TextSongLength.SaveTheme(writer); @@ -361,6 +404,8 @@ namespace Vocaluxe.Menu.SongMenu _Theme.songMenuTileBoard.StaticTextBG.SaveTheme(writer); _Theme.songMenuTileBoard.StaticDuetIcon.SaveTheme(writer); _Theme.songMenuTileBoard.StaticVideoIcon.SaveTheme(writer); + _Theme.songMenuTileBoard.StaticMedleyCalcIcon.SaveTheme(writer); + _Theme.songMenuTileBoard.StaticMedleyTagIcon.SaveTheme(writer); writer.WriteEndElement(); #endregion SongMenuTileBoard @@ -465,6 +510,16 @@ namespace Vocaluxe.Menu.SongMenu } + public virtual bool IsActive() + { + return _Active; + } + + public virtual void SetActive(bool Active) + { + _Active = Active; + } + public virtual int GetSelectedSong() { return -1; @@ -481,6 +536,17 @@ namespace Vocaluxe.Menu.SongMenu return; } + public virtual void SetSmallView(bool SmallView) + { + if (!_Initialized) + return; + } + + public virtual bool IsSmallView() + { + return false; + } + public virtual void UnloadTextures() { } @@ -491,14 +557,6 @@ namespace Vocaluxe.Menu.SongMenu if (_Theme.ColorName != String.Empty) _Color = CTheme.GetColor(_Theme.ColorName); - - _Theme.songMenuTileBoard.StaticCoverBig.ReloadTextures(); - _Theme.songMenuTileBoard.StaticTextBG.ReloadTextures(); - _Theme.songMenuTileBoard.StaticDuetIcon.ReloadTextures(); - _Theme.songMenuTileBoard.StaticVideoIcon.ReloadTextures(); - - _Theme.songMenuTileBoard.TextArtist.ReloadTextures(); - _Theme.songMenuTileBoard.TextTitle.ReloadTextures(); } public void ReloadTextures() @@ -551,7 +609,13 @@ namespace Vocaluxe.Menu.SongMenu int _stream = CSound.Load(Path.Combine(CSongs.VisibleSongs[_actsong].Folder, CSongs.VisibleSongs[_actsong].MP3FileName), true); CSound.SetStreamVolume(_stream, 0f); - CSound.SetPosition(_stream, CSound.GetLength(_stream) / 4f); + + float startposition = CSongs.VisibleSongs[_actsong].PreviewStart; + + if (startposition == 0f) + startposition = CSound.GetLength(_stream) / 4f; + + CSound.SetPosition(_stream, startposition); CSound.Play(_stream); CSound.Fade(_stream, 100f, 3f); _streams.Add(_stream); @@ -562,7 +626,7 @@ namespace Vocaluxe.Menu.SongMenu _video = CVideo.VdLoad(Path.Combine(CSongs.VisibleSongs[_actsong].Folder, CSongs.VisibleSongs[_actsong].VideoFileName)); if (_video == -1) return; - CVideo.VdSkip(_video, CSound.GetLength(_stream) / 4f, CSongs.VisibleSongs[_actsong].VideoGap); + CVideo.VdSkip(_video, startposition, CSongs.VisibleSongs[_actsong].VideoGap); _VideoFadeTimer.Stop(); _VideoFadeTimer.Reset(); _VideoFadeTimer.Start(); diff --git a/Vocaluxe/Menu/SongMenu/CSongMenuTileBoard.cs b/Vocaluxe/Menu/SongMenu/CSongMenuTileBoard.cs index aa300400..10a86dbb 100644 --- a/Vocaluxe/Menu/SongMenu/CSongMenuTileBoard.cs +++ b/Vocaluxe/Menu/SongMenu/CSongMenuTileBoard.cs @@ -18,6 +18,8 @@ namespace Vocaluxe.Menu.SongMenu private CStatic _TextBG; private CStatic _DuetIcon; private CStatic _VideoIcon; + private CStatic _MedleyCalcIcon; + private CStatic _MedleyTagIcon; private STexture _CoverBigTexture; private STexture _CoverTexture; @@ -38,6 +40,8 @@ namespace Vocaluxe.Menu.SongMenu private int _Offset = 0; private int _actualSelection = -1; + private bool _SmallView = false; + public override int GetActualSelection() { return _actualSelection; @@ -47,6 +51,8 @@ namespace Vocaluxe.Menu.SongMenu { base.Init(); + _Rect = _Theme.songMenuTileBoard.TileRect; + _NumW = _Theme.songMenuTileBoard.numW; _NumH = _Theme.songMenuTileBoard.numH; _SpaceW = _Theme.songMenuTileBoard.spaceW; @@ -81,6 +87,8 @@ namespace Vocaluxe.Menu.SongMenu _TextBG = _Theme.songMenuTileBoard.StaticTextBG; _DuetIcon = _Theme.songMenuTileBoard.StaticDuetIcon; _VideoIcon = _Theme.songMenuTileBoard.StaticVideoIcon; + _MedleyCalcIcon = _Theme.songMenuTileBoard.StaticMedleyCalcIcon; + _MedleyTagIcon = _Theme.songMenuTileBoard.StaticMedleyTagIcon; _Artist = _Theme.songMenuTileBoard.TextArtist; _Title = _Theme.songMenuTileBoard.TextTitle; @@ -113,6 +121,8 @@ namespace Vocaluxe.Menu.SongMenu _Locked = 0; _DuetIcon.Visible = false; _VideoIcon.Visible = false; + _MedleyCalcIcon.Visible = false; + _MedleyTagIcon.Visible = false; } if (CSongs.NumVisibleSongs == 0 && CSongs.SearchFilter != String.Empty) @@ -125,6 +135,8 @@ namespace Vocaluxe.Menu.SongMenu _Locked = -1; _DuetIcon.Visible = false; _VideoIcon.Visible = false; + _MedleyCalcIcon.Visible = false; + _MedleyTagIcon.Visible = false; } } @@ -138,6 +150,11 @@ namespace Vocaluxe.Menu.SongMenu } else { + if (!(KeyEvent.Key == Keys.Left || KeyEvent.Key == Keys.Right || KeyEvent.Key == Keys.Up || KeyEvent.Key == Keys.Down || + KeyEvent.Key == Keys.Escape || KeyEvent.Key == Keys.Back || KeyEvent.Key == Keys.Enter || + KeyEvent.Key == Keys.PageDown || KeyEvent.Key == Keys.PageUp)) + return; + bool sel = false; foreach (CStatic tile in _Tiles) { @@ -390,7 +407,7 @@ namespace Vocaluxe.Menu.SongMenu { foreach (CStatic tile in _Tiles) { - if (tile.Selected) + if (tile.Selected && _Active) tile.Draw(1.2f, tile.Rect.Z - 0.1f, true, false); else { @@ -412,14 +429,9 @@ namespace Vocaluxe.Menu.SongMenu _Artist.Text = song.Artist; _Title.Text = song.Title; _DuetIcon.Visible = song.IsDuet; - if (song.VideoFileName.Length > 0) - { - _VideoIcon.Visible = true; - } - else - { - _VideoIcon.Visible = false; - } + _VideoIcon.Visible = song.VideoFileName.Length > 0; + _MedleyCalcIcon.Visible = song.Medley.Source == EMedleySource.Calculated; + _MedleyTagIcon.Visible = song.Medley.Source == EMedleySource.Tag; float Time = CSound.GetLength(_SongStream); if (song.Finish != 0) @@ -448,6 +460,8 @@ namespace Vocaluxe.Menu.SongMenu _SongLength.Text = String.Empty; _DuetIcon.Visible = false; _VideoIcon.Visible = false; + _MedleyCalcIcon.Visible = false; + _MedleyTagIcon.Visible = false; } } @@ -475,6 +489,8 @@ namespace Vocaluxe.Menu.SongMenu _SongLength.Draw(); _DuetIcon.Draw(); _VideoIcon.Draw(); + _MedleyCalcIcon.Draw(); + _MedleyTagIcon.Draw(); } @@ -653,6 +669,74 @@ namespace Vocaluxe.Menu.SongMenu _Offset = offset; } + public override void SetSmallView(bool SmallView) + { + base.SetSmallView(SmallView); + + _SmallView = SmallView; + + if (_SmallView) + { + _NumH = _Theme.songMenuTileBoard.numHsmall; + _NumW = _Theme.songMenuTileBoard.numWsmall; + + _TileW = (int)((_Theme.songMenuTileBoard.TileRectSmall.W - _SpaceW * (_NumW - 1)) / _NumW); + _TileH = (int)((_Theme.songMenuTileBoard.TileRectSmall.H - _SpaceH * (_NumH - 1)) / _NumH); + + _CoverTexture = CTheme.GetSkinTexture(_Theme.CoverBackgroundName); + _CoverBigTexture = CTheme.GetSkinTexture(_Theme.CoverBigBackgroundName); + + _Tiles = new List(); + for (int i = 0; i < _NumH; i++) + { + for (int j = 0; j < _NumW; j++) + { + SRectF rect = new SRectF(_Theme.songMenuTileBoard.TileRectSmall.X + j * (_TileW + _SpaceW), + _Theme.songMenuTileBoard.TileRectSmall.Y + i * (_TileH + _SpaceH), _TileW, _TileH, _Rect.Z); + CStatic tile = new CStatic(_CoverTexture, Color, rect); + _Tiles.Add(tile); + } + } + + _Rect = _Theme.songMenuTileBoard.TileRectSmall; + _ScrollRect = new SRectF(0, 0, CSettings.iRenderW, CSettings.iRenderH, _Theme.songMenuTileBoard.TileRectSmall.Z); + } + else + { + _NumH = _Theme.songMenuTileBoard.numH; + _NumW = _Theme.songMenuTileBoard.numW; + + _TileW = (int)((_Theme.songMenuTileBoard.TileRect.W - _SpaceW * (_NumW - 1)) / _NumW); + _TileH = (int)((_Theme.songMenuTileBoard.TileRect.H - _SpaceH * (_NumH - 1)) / _NumH); + + _CoverTexture = CTheme.GetSkinTexture(_Theme.CoverBackgroundName); + _CoverBigTexture = CTheme.GetSkinTexture(_Theme.CoverBigBackgroundName); + + _Tiles = new List(); + for (int i = 0; i < _NumH; i++) + { + for (int j = 0; j < _NumW; j++) + { + SRectF rect = new SRectF(_Theme.songMenuTileBoard.TileRect.X + j * (_TileW + _SpaceW), + _Theme.songMenuTileBoard.TileRect.Y + i * (_TileH + _SpaceH), _TileW, _TileH, _Rect.Z); + CStatic tile = new CStatic(_CoverTexture, Color, rect); + _Tiles.Add(tile); + } + } + + _Rect = _Theme.songMenuTileBoard.TileRect; + _ScrollRect = new SRectF(0, 0, CSettings.iRenderW, CSettings.iRenderH, _Theme.songMenuTileBoard.TileRect.Z); + } + + UpdateList(_Offset); + + } + + public override bool IsSmallView() + { + return _SmallView; + } + public override void LoadTextures() { base.LoadTextures(); @@ -661,6 +745,8 @@ namespace Vocaluxe.Menu.SongMenu _Theme.songMenuTileBoard.StaticTextBG.ReloadTextures(); _Theme.songMenuTileBoard.StaticDuetIcon.ReloadTextures(); _Theme.songMenuTileBoard.StaticVideoIcon.ReloadTextures(); + _Theme.songMenuTileBoard.StaticMedleyCalcIcon.ReloadTextures(); + _Theme.songMenuTileBoard.StaticMedleyTagIcon.ReloadTextures(); _Theme.songMenuTileBoard.TextArtist.ReloadTextures(); _Theme.songMenuTileBoard.TextTitle.ReloadTextures(); diff --git a/Vocaluxe/Menu/SongMenu/ISongMenu.cs b/Vocaluxe/Menu/SongMenu/ISongMenu.cs index 7118f8ca..a859e84b 100644 --- a/Vocaluxe/Menu/SongMenu/ISongMenu.cs +++ b/Vocaluxe/Menu/SongMenu/ISongMenu.cs @@ -20,6 +20,9 @@ namespace Vocaluxe.Menu.SongMenu int GetSelectedSong(); void SetSelectedSong(int VisibleSongNr); + bool IsActive(); + void SetActive(bool Active); + int GetSelectedCategory(); int GetActualSelection(); @@ -29,6 +32,9 @@ namespace Vocaluxe.Menu.SongMenu bool IsVisible(); void SetVisible(bool Visible); + bool IsSmallView(); + void SetSmallView(bool SmallView); + SRectF GetRect(); } } diff --git a/Vocaluxe/Screens/CPopupScreenPlayerControl.cs b/Vocaluxe/Screens/CPopupScreenPlayerControl.cs index 751a7229..8e7d8ad9 100644 --- a/Vocaluxe/Screens/CPopupScreenPlayerControl.cs +++ b/Vocaluxe/Screens/CPopupScreenPlayerControl.cs @@ -217,9 +217,9 @@ namespace Vocaluxe.Screens CGame.Reset(); CGame.ClearSongs(); - EGameMode gm = EGameMode.Normal; + EGameMode gm = EGameMode.TR_GAMEMODE_NORMAL; if (CSongs.AllSongs[SongNr].IsDuet) - gm = EGameMode.Duet; + gm = EGameMode.TR_GAMEMODE_DUET; CGame.AddSong(SongNr, gm); diff --git a/Vocaluxe/Screens/CScreenHighscore.cs b/Vocaluxe/Screens/CScreenHighscore.cs index 6f499513..5704ce63 100644 --- a/Vocaluxe/Screens/CScreenHighscore.cs +++ b/Vocaluxe/Screens/CScreenHighscore.cs @@ -23,7 +23,7 @@ namespace Vocaluxe.Screens private string[] TextScore; private string[] TextDate; - private List _Scores; + private List[] _Scores; private List _NewEntryIDs; private int _Round; private int _Pos; @@ -135,6 +135,17 @@ namespace Vocaluxe.Screens CGraphics.FadeTo(EScreens.ScreenSong); } + if (MouseEvent.MB) + { + int LastRound = _Round; + ChangeRound(1); + if (LastRound == _Round) + { + _Round = 0; + UpdateRound(); + } + } + ChangePos(MouseEvent.Wheel); return true; } @@ -143,7 +154,7 @@ namespace Vocaluxe.Screens { for (int p = 0; p < NumEntrys; p++) { - if (_Pos + p < _Scores.Count) + if (_Pos + p < _Scores[_Round].Count) { Texts[htTexts(TextNumber[p])].Visible = true; Texts[htTexts(TextName[p])].Visible = true; @@ -152,16 +163,16 @@ namespace Vocaluxe.Screens Texts[htTexts(TextNumber[p])].Text = (_Pos + p + 1).ToString(); - string name = _Scores[_Pos + p].Name; - name += " [" + CLanguage.Translate(Enum.GetName(typeof(EGameDifficulty), _Scores[_Pos + p].Difficulty)) + "]"; + string name = _Scores[_Round][_Pos + p].Name; + name += " [" + CLanguage.Translate(Enum.GetName(typeof(EGameDifficulty), _Scores[_Round][_Pos + p].Difficulty)) + "]"; if (_IsDuet) - name += " (P" + (_Scores[_Pos + p].LineNr + 1).ToString() + ")"; + name += " (P" + (_Scores[_Round][_Pos + p].LineNr + 1).ToString() + ")"; Texts[htTexts(TextName[p])].Text = name; - Texts[htTexts(TextScore[p])].Text = _Scores[_Pos + p].Score.ToString("00000"); - Texts[htTexts(TextDate[p])].Text = _Scores[_Pos + p].Date; + Texts[htTexts(TextScore[p])].Text = _Scores[_Round][_Pos + p].Score.ToString("00000"); + Texts[htTexts(TextDate[p])].Text = _Scores[_Round][_Pos + p].Date; - if (isNewEntry(_Scores[_Pos + p].ID) == true) + if (isNewEntry(_Scores[_Round][_Pos + p].ID) == true) { Texts[htTexts(TextNumber[p])].Style = EStyle.BoldItalic; Texts[htTexts(TextName[p])].Style = EStyle.BoldItalic; @@ -185,10 +196,16 @@ namespace Vocaluxe.Screens base.OnShow(); _Round = 0; _Pos = 0; - _Scores = new List(); + CPoints _Points = CGame.GetPoints(); + _Scores = new List[_Points.NumRounds]; + for (int i = 0; i < _Scores.Length; i++) + { + _Scores[i] = new List(); + } _NewEntryIDs.Clear(); AddScoresToDB(); LoadScores(); + UpdateRound(); UpdateGame(); } @@ -239,35 +256,47 @@ namespace Vocaluxe.Screens for (int round = 0; round < points.NumRounds; round++) { SPlayer player = points.GetPlayer(round, CGame.NumPlayer)[0]; - CDataBase.LoadScore(ref _Scores, player); + CDataBase.LoadScore(ref _Scores[round], player); + } + } - if (round == _Round) - { - _IsDuet = false; + private void UpdateRound() + { + _IsDuet = false; + CPoints points = CGame.GetPoints(); + SPlayer player = points.GetPlayer(_Round, CGame.NumPlayer)[0]; + CSong song = CGame.GetSong(_Round+1); + if (song == null) + return; - CSong song = CSongs.GetSong(player.SongID); - Texts[htTexts(TextSongName)].Text = song.Artist + " - " + song.Title; + Texts[htTexts(TextSongName)].Text = song.Artist + " - " + song.Title; + if (points.NumRounds > 1) + { + Texts[htTexts(TextSongName)].Text += " (" + (_Round+1) + "/" + points.NumRounds + ")"; + } - switch (CGame.GameMode) - { - case EGameMode.Normal: - Texts[htTexts(TextSongMode)].Text = "TR_GAMEMODE_NORMAL"; - break; + switch (CGame.GetGameMode(_Round)) + { + case EGameMode.TR_GAMEMODE_NORMAL: + Texts[htTexts(TextSongMode)].Text = "TR_GAMEMODE_NORMAL"; + break; - case EGameMode.Medley: - Texts[htTexts(TextSongMode)].Text = "TR_GAMEMODE_MEDLEY"; - break; + case EGameMode.TR_GAMEMODE_MEDLEY: + Texts[htTexts(TextSongMode)].Text = "TR_GAMEMODE_MEDLEY"; + break; - case EGameMode.Duet: - Texts[htTexts(TextSongMode)].Text = "TR_GAMEMODE_DUET"; - _IsDuet = true; - break; + case EGameMode.TR_GAMEMODE_DUET: + Texts[htTexts(TextSongMode)].Text = "TR_GAMEMODE_DUET"; + _IsDuet = true; + break; - default: - Texts[htTexts(TextSongMode)].Text = "TR_GAMEMODE_NORMAL"; - break; - } - } + case EGameMode.TR_GAMEMODE_SHORTSONG: + Texts[htTexts(TextSongMode)].Text = "TR_GAMEMODE_SHORTSONG"; + break; + + default: + Texts[htTexts(TextSongMode)].Text = "TR_GAMEMODE_NORMAL"; + break; } } @@ -275,7 +304,7 @@ namespace Vocaluxe.Screens { if (Num > 0) { - if (_Pos + Num + NumEntrys < _Scores.Count) + if (_Pos + Num + NumEntrys < _Scores[_Round].Count) _Pos += Num; } if (Num < 0) @@ -288,27 +317,14 @@ namespace Vocaluxe.Screens private void ChangeRound(int Num) { - CPoints points = CGame.GetPoints(); - if (points.NumRounds < 2) - return; - - _Round += Num; - - if (Num > 0) - { - if (_Round >= points.NumRounds) - _Round = 0; - - LoadScores(); - } - - if (Num < 0) - { - if (_Round < 0) - _Round = points.NumRounds - 1; - - LoadScores(); - } + CPoints _Points = CGame.GetPoints(); + if (_Round + Num < _Points.NumRounds && _Round + Num > -1) + _Round += Num; + else if (_Round + Num >= _Points.NumRounds) + _Round = _Points.NumRounds - 1; + else if (_Round + Num < 0) + _Round = 0; + UpdateRound(); } } } diff --git a/Vocaluxe/Screens/CScreenLoad.cs b/Vocaluxe/Screens/CScreenLoad.cs index d20c7490..41f373b2 100644 --- a/Vocaluxe/Screens/CScreenLoad.cs +++ b/Vocaluxe/Screens/CScreenLoad.cs @@ -223,6 +223,11 @@ namespace Vocaluxe.Screens CBackgroundMusic.CanSing = true; CLog.StopBenchmark(3, "Load Cover"); + + //Init Playlists + CLog.StartBenchmark(0, "Init Playlists"); + CPlaylists.Init(); + CLog.StopBenchmark(0, "Init Playlists"); } private void CheckStartIntroVideos() diff --git a/Vocaluxe/Screens/CScreenScore.cs b/Vocaluxe/Screens/CScreenScore.cs index 6bf09ce0..5f652325 100644 --- a/Vocaluxe/Screens/CScreenScore.cs +++ b/Vocaluxe/Screens/CScreenScore.cs @@ -92,6 +92,11 @@ namespace Vocaluxe.Screens { base.HandleMouse(MouseEvent); + if (MouseEvent.Wheel != 0) + { + ChangeRound(MouseEvent.Wheel); + } + if (MouseEvent.LB) { CGraphics.FadeTo(EScreens.ScreenHighscore); @@ -117,9 +122,23 @@ namespace Vocaluxe.Screens public override bool UpdateGame() { - SPlayer[] player = new SPlayer[CGame.NumPlayer]; - player = _Points.GetPlayer(_Round - 1, CGame.NumPlayer); + if (_Round != 0) + player = _Points.GetPlayer(_Round - 1, CGame.NumPlayer); + else { + for (int i = 0; i < CGame.NumRounds; i++) + { + SPlayer[] points = _Points.GetPlayer(i, CGame.NumPlayer); + for (int p = 0; p < player.Length; p++) + { + player[p].Points += points[p].Points; + } + } + for (int p = 0; p < player.Length; p++) + { + player[p].Points = (int)(player[p].Points/CGame.NumRounds); + } + } for (int p = 0; p < player.Length; p++) { if (StaticPointsBarDrawnPoints[p] < player[p].Points) @@ -244,30 +263,61 @@ namespace Vocaluxe.Screens private void UpdateRatings() { - CSong song = CGame.GetSong(_Round); - if (song == null) - return; - - Texts[htTexts(TextSong)].Text = song.Artist + " - " + song.Title; - if (_Points.NumRounds > 1) + CSong song = null; + SPlayer[] player = new SPlayer[CGame.NumPlayer]; + if (_Round != 0) { - Texts[htTexts(TextSong)].Text += " (" + _Round + "/" + _Points.NumRounds + ")"; + song = CGame.GetSong(_Round); + if (song == null) + return; + + Texts[htTexts(TextSong)].Text = song.Artist + " - " + song.Title; + if (_Points.NumRounds > 1) + { + Texts[htTexts(TextSong)].Text += " (" + _Round + "/" + _Points.NumRounds + ")"; + } + player = _Points.GetPlayer(_Round - 1, CGame.NumPlayer); + } + else + { + Texts[htTexts(TextSong)].Text = "TR_SCREENSCORE_OVERALLSCORE"; + for (int i = 0; i < CGame.NumRounds; i++) + { + SPlayer[] points = _Points.GetPlayer(i, CGame.NumPlayer); + 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; + } + } + for (int p = 0; p < player.Length; p++) + { + player[p].Points = (int)(player[p].Points / CGame.NumRounds); + } } - SPlayer[] player = new SPlayer[CGame.NumPlayer]; - player = _Points.GetPlayer(_Round - 1, CGame.NumPlayer); for (int p = 0; p < player.Length; p++) { - if (!song.IsDuet) - Texts[htTexts(TextNames[p, CGame.NumPlayer - 1])].Text = player[p].Name; - else - if(player[p].LineNr == 0 && song.DuetPart1 != "Part 1") - Texts[htTexts(TextNames[p, CGame.NumPlayer - 1])].Text = player[p].Name + " (" + song.DuetPart1 + ")"; - else if(player[p].LineNr == 1 && song.DuetPart2 != "Part 2") - Texts[htTexts(TextNames[p, CGame.NumPlayer - 1])].Text = player[p].Name + " (" + song.DuetPart2 + ")"; - else + if (song != null) + { + if (!song.IsDuet) Texts[htTexts(TextNames[p, CGame.NumPlayer - 1])].Text = player[p].Name; - + else + if (player[p].LineNr == 0 && song.DuetPart1 != "Part 1") + Texts[htTexts(TextNames[p, CGame.NumPlayer - 1])].Text = player[p].Name + " (" + song.DuetPart1 + ")"; + else if (player[p].LineNr == 1 && song.DuetPart2 != "Part 2") + Texts[htTexts(TextNames[p, CGame.NumPlayer - 1])].Text = player[p].Name + " (" + song.DuetPart2 + ")"; + else + Texts[htTexts(TextNames[p, CGame.NumPlayer - 1])].Text = player[p].Name; + } + else + Texts[htTexts(TextNames[p, CGame.NumPlayer - 1])].Text = player[p].Name; + Texts[htTexts(TextScores[p, CGame.NumPlayer - 1])].Text = ((int)Math.Round(player[p].Points)).ToString("0000") + " " + CLanguage.Translate("TR_SCREENSCORE_POINTS"); if (CGame.NumPlayer <= 3) { @@ -324,11 +374,21 @@ namespace Vocaluxe.Screens private void ChangeRound(int Num) { - if ((_Round + Num) <= _Points.NumRounds && (_Round + Num) > 0) + if ((_Round + Num) <= _Points.NumRounds && (_Round + Num) > 0 && _Round != 0) { _Round += Num; UpdateRatings(); } + else if(Num > 0 && _Round != 0 && CGame.NumRounds > 1) + { + _Round = 0; + UpdateRatings(); + } + else if (Num < 0 && _Round == 0) + { + _Round = CGame.NumRounds; + UpdateRatings(); + } } } } \ No newline at end of file diff --git a/Vocaluxe/Screens/CScreenSing.cs b/Vocaluxe/Screens/CScreenSing.cs index 6678bd87..c75081c3 100644 --- a/Vocaluxe/Screens/CScreenSing.cs +++ b/Vocaluxe/Screens/CScreenSing.cs @@ -53,6 +53,7 @@ namespace Vocaluxe.Screens private const string ButtonCancel = "ButtonCancel"; private const string ButtonContinue = "ButtonContinue"; + private const string ButtonSkip = "ButtonSkip"; private const string LyricMain = "LyricMain"; private const string LyricSub = "LyricSub"; @@ -133,6 +134,7 @@ namespace Vocaluxe.Screens List buttons = new List(); buttons.Add(ButtonCancel); buttons.Add(ButtonContinue); + buttons.Add(ButtonSkip); _ThemeButtons = buttons.ToArray(); _ThemeLyrics = new string[] { LyricMain, LyricSub, LyricMainDuet, LyricSubDuet, LyricMainTop, LyricSubTop }; @@ -208,12 +210,22 @@ namespace Vocaluxe.Screens SetVisuability(); break; + case Keys.S: + if(CGame.NumRounds > CGame.RoundNr) + if(KeyEvent.ModCTRL) + LoadNextSong(); + break; + case Keys.Enter: if (Buttons[htButtons(ButtonContinue)].Selected && _Pause) - TogglePause(); - + TogglePause(); if (Buttons[htButtons(ButtonCancel)].Selected && _Pause) - Stop(); + Stop(); + if (Buttons[htButtons(ButtonSkip)].Selected && _Pause) + { + LoadNextSong(); + TogglePause(); + } break; } } @@ -240,6 +252,11 @@ namespace Vocaluxe.Screens if (Buttons[htButtons(ButtonCancel)].Selected && _Pause) Stop(); + if (Buttons[htButtons(ButtonSkip)].Selected && _Pause) + { + LoadNextSong(); + TogglePause(); + } } @@ -642,7 +659,9 @@ namespace Vocaluxe.Screens private void Stop() { - CGame.NextRound(); + //Need this to set other songs to points-var + while(!CGame.IsFinished()) + CGame.NextRound(); CGraphics.FadeTo(EScreens.ScreenScore); _FadeOut = true; @@ -675,7 +694,7 @@ namespace Vocaluxe.Screens { if (line[j].StartBeat <= _CurrentBeat) { - if (CGame.GetTimeFromBeats(line[j].FirstBeat, song.BPM) <= _CurrentTime - song.Gap + 10f) + if (CGame.GetTimeFromBeats(line[j].FirstNoteBeat, song.BPM) <= _CurrentTime - song.Gap + 10f) { nr = j; } @@ -694,8 +713,8 @@ namespace Vocaluxe.Screens { Lyrics[htLyrics(LyricMain)].SetLine(line[nr]); Lyrics[htLyrics(LyricMainTop)].SetLine(line[nr]); - _TimeToFirstNote = CGame.GetTimeFromBeats(line[nr].FirstBeat - line[nr].StartBeat, song.BPM); - _RemainingTimeToFirstNote = CGame.GetTimeFromBeats(line[nr].FirstBeat - CGame.GetBeatFromTime(_CurrentTime, song.BPM, song.Gap), song.BPM); + _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) { @@ -711,8 +730,8 @@ namespace Vocaluxe.Screens if (i == 0 && song.IsDuet) { Lyrics[htLyrics(LyricMainDuet)].SetLine(line[nr]); - _TimeToFirstNoteDuet = CGame.GetTimeFromBeats(line[nr].FirstBeat - line[nr].StartBeat, song.BPM); - _RemainingTimeToFirstNoteDuet = CGame.GetTimeFromBeats(line[nr].FirstBeat - CGame.GetBeatFromTime(_CurrentTime, song.BPM, song.Gap), song.BPM); + _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[htLyrics(LyricSubDuet)].SetLine(line[nr + 1]); @@ -748,11 +767,16 @@ namespace Vocaluxe.Screens { Buttons[htButtons(ButtonCancel)].Visible = true; Buttons[htButtons(ButtonContinue)].Visible = true; + if (CGame.NumRounds > CGame.RoundNr && CGame.NumRounds > 1) + Buttons[htButtons(ButtonSkip)].Visible = true; + else + Buttons[htButtons(ButtonSkip)].Visible = false; CSound.Pause(_CurrentStream); }else { Buttons[htButtons(ButtonCancel)].Visible = false; Buttons[htButtons(ButtonContinue)].Visible = false; + Buttons[htButtons(ButtonSkip)].Visible = false; CSound.Play(_CurrentStream); } } @@ -958,7 +982,7 @@ namespace Vocaluxe.Screens { if (line[j].StartBeat <= _CurrentBeat) { - if (CGame.GetTimeFromBeats(line[j].FirstBeat, Song.BPM) <= _CurrentTime - Song.Gap + 10f) + if (CGame.GetTimeFromBeats(line[j].FirstNoteBeat, Song.BPM) <= _CurrentTime - Song.Gap + 10f) { CurrentLineSub = j; } @@ -969,7 +993,7 @@ namespace Vocaluxe.Screens int CurrentLine = 0; for (int j = 0; j < line.Length; j++) { - if (line[j].FirstBeat <= _CurrentBeat) + if (line[j].FirstNoteBeat <= _CurrentBeat) { CurrentLine = j; } @@ -980,33 +1004,33 @@ namespace Vocaluxe.Screens Alpha[i * 2 + 1] = 1f; // main line alpha - if (CurrentLine == 0 && CurrentTime < CGame.GetTimeFromBeats(line[CurrentLine].FirstBeat, Song.BPM)) + if (CurrentLine == 0 && CurrentTime < CGame.GetTimeFromBeats(line[CurrentLine].FirstNoteBeat, Song.BPM)) { // first main line and fist note is not reached // => fade in - float diff = CGame.GetTimeFromBeats(line[CurrentLine].FirstBeat, Song.BPM) - CurrentTime; + float diff = CGame.GetTimeFromBeats(line[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].LastBeat, Song.BPM) < CurrentTime && - CGame.GetTimeFromBeats(line[CurrentLine + 1].FirstBeat, Song.BPM) > CurrentTime) + else if (CurrentLine < line.Length - 1 && CGame.GetTimeFromBeats(line[CurrentLine].LastNoteBeat, Song.BPM) < CurrentTime && + CGame.GetTimeFromBeats(line[CurrentLine + 1].FirstNoteBeat, Song.BPM) > CurrentTime) { // current position is between two lines // time between the to lines - float diff = CGame.GetTimeFromBeats(line[CurrentLine + 1].FirstBeat, Song.BPM) - - CGame.GetTimeFromBeats(line[CurrentLine].LastBeat, Song.BPM); + float diff = CGame.GetTimeFromBeats(line[CurrentLine + 1].FirstNoteBeat, Song.BPM) - + CGame.GetTimeFromBeats(line[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].LastBeat, Song.BPM); + float last = CurrentTime - CGame.GetTimeFromBeats(line[CurrentLine].LastNoteBeat, Song.BPM); // time to next line - float next = CGame.GetTimeFromBeats(line[CurrentLine + 1].FirstBeat, Song.BPM) - CurrentTime; + float next = CGame.GetTimeFromBeats(line[CurrentLine + 1].FirstNoteBeat, Song.BPM) - CurrentTime; if (last < next) { @@ -1021,11 +1045,11 @@ namespace Vocaluxe.Screens } } } - else if (CurrentLine == line.Length - 1 && CGame.GetTimeFromBeats(line[CurrentLine].LastBeat, Song.BPM) < CurrentTime) + else if (CurrentLine == line.Length - 1 && CGame.GetTimeFromBeats(line[CurrentLine].LastNoteBeat, Song.BPM) < CurrentTime) { // last main line and last note was reached // => fade out - float diff = CurrentTime - CGame.GetTimeFromBeats(line[CurrentLine].LastBeat, Song.BPM); + float diff = CurrentTime - CGame.GetTimeFromBeats(line[CurrentLine].LastNoteBeat, Song.BPM); Alpha[i * 2] = 1f - diff / rt; } @@ -1033,7 +1057,7 @@ namespace Vocaluxe.Screens if (CurrentLineSub < line.Length - 2) { float diff = 0f; - diff = CGame.GetTimeFromBeats(line[CurrentLineSub + 1].FirstBeat, Song.BPM) - CurrentTime; + diff = CGame.GetTimeFromBeats(line[CurrentLineSub + 1].FirstNoteBeat, Song.BPM) - CurrentTime; if (diff > dt) { @@ -1261,19 +1285,22 @@ namespace Vocaluxe.Screens { CLine[] Line = Lines[i].Line; for(int j = 0; j _AvailableGameModes; + public CScreenSong() { Init(); + + _AvailableGameModes = new List(); } protected override void Init() @@ -41,87 +71,115 @@ namespace Vocaluxe.Screens _ThemeName = "ScreenSong"; _ScreenVersion = ScreenVersion; - _ThemeStatics = new string[] { StaticSearchBar }; - _ThemeTexts = new string[] { TextCategory, TextSelection, TextSearchBarTitle, TextSearchBar }; + _ThemeStatics = new string[] { StaticSearchBar, StaticOptionsBG }; + _ThemeTexts = new string[] { TextCategory, TextSelection, TextSearchBarTitle, TextSearchBar, TextOptionsTitle }; + _ThemeButtons = new string[] { ButtonOptionsClose, ButtonOptionsPlaylist, ButtonOptionsSing, ButtonOptionsRandom, ButtonOptionsSingAll, ButtonOptionsSingAllVisible, ButtonOptionsOpenPlaylist, ButtonOpenOptions }; + _ThemeSelectSlides = new string[] { SelectSlideOptionsMode, SelectSlideOptionsPlaylistAdd, SelectSlideOptionsPlaylistOpen }; _ThemeSongMenus = new string[] { SongMenu }; + _ThemePlaylists = new string[] { Playlist }; } public override void LoadTheme() { base.LoadTheme(); + SelectSlides[htSelectSlides(SelectSlideOptionsMode)].Visible = false; + SelectSlides[htSelectSlides(SelectSlideOptionsPlaylistAdd)].Visible = false; + SelectSlides[htSelectSlides(SelectSlideOptionsPlaylistOpen)].Visible = false; + Buttons[htButtons(ButtonOptionsClose)].Visible = false; + Buttons[htButtons(ButtonOptionsSing)].Visible = false; + Buttons[htButtons(ButtonOptionsPlaylist)].Visible = false; + Buttons[htButtons(ButtonOptionsRandom)].Visible = false; + Buttons[htButtons(ButtonOptionsSingAll)].Visible = false; + Buttons[htButtons(ButtonOptionsSingAllVisible)].Visible = false; + Buttons[htButtons(ButtonOptionsOpenPlaylist)].Visible = false; + Texts[htTexts(TextOptionsTitle)].Visible = false; + Statics[htStatics(StaticOptionsBG)].Visible = false; + Playlists[htPlaylists(Playlist)].Visible = false; } public override bool HandleInput(KeyEvent KeyEvent) { base.HandleInput(KeyEvent); + if (KeyEvent.Handled) + return true; - if (KeyEvent.KeyPressed && !Char.IsControl(KeyEvent.Unicode)) + if (_PlaylistActive) { - if (_SearchActive) - ApplyNewSearchFilter(_SearchText + KeyEvent.Unicode); - /* - else if (!Char.IsControl(KeyEvent.Unicode)) + if (!KeyEvent.KeyPressed && KeyEvent.Key == Keys.Tab) { - JumpTo(KeyEvent.Unicode); + _PlaylistActive = !_PlaylistActive; + Playlists[htPlaylists(Playlist)].Selected = _PlaylistActive; + SongMenus[htSongMenus(SongMenu)].SetActive(!_PlaylistActive); return true; - } */ + } + + Playlists[htPlaylists(Playlist)].HandleInput(KeyEvent); + + if (CPlaylists.NumPlaylists != SelectSlides[htSelectSlides(SelectSlideOptionsPlaylistOpen)].NumValues) + UpdatePlaylistNames(); + + return true; } - else + + if (!_SongOptionsActive) { - SongMenus[htSongMenus(SongMenu)].HandleInput(ref KeyEvent); - - if (KeyEvent.Handled) - return true; - - switch (KeyEvent.Key) + if (KeyEvent.KeyPressed && !Char.IsControl(KeyEvent.Unicode)) { - case Keys.Escape: - if (CSongs.Category < 0 || CConfig.Tabs == EOffOn.TR_CONFIG_OFF) - CGraphics.FadeTo(EScreens.ScreenMain); - break; + if (_SearchActive) + ApplyNewSearchFilter(_SearchText + KeyEvent.Unicode); + /* + else if (!Char.IsControl(KeyEvent.Unicode)) + { + JumpTo(KeyEvent.Unicode); + return true; + } */ + } + else + { + SongMenus[htSongMenus(SongMenu)].HandleInput(ref KeyEvent); + if (KeyEvent.Handled) + return true; - case Keys.Enter: - if (CSongs.NumVisibleSongs > 0) - StartSong(SongMenus[htSongMenus(SongMenu)].GetSelectedSong()); - break; + switch (KeyEvent.Key) + { + case Keys.Escape: + if (CSongs.Category < 0 || CConfig.Tabs == EOffOn.TR_CONFIG_OFF) + CGraphics.FadeTo(EScreens.ScreenMain); + break; - case Keys.Back: - if (_SearchText.Length > 0) - { - ApplyNewSearchFilter(_SearchText.Remove(_SearchText.Length - 1)); - } + case Keys.Enter: + if (CSongs.NumVisibleSongs > 0) + { + if (SongMenus[htSongMenus(SongMenu)].GetSelectedSong() != -1 && !_SongOptionsActive) + ToggleSongOptions(ESongOptionsView.Song); + } + break; - if (!_SearchActive && CSongs.Category < 0) - CGraphics.FadeTo(EScreens.ScreenMain); + case Keys.Tab: + if (Playlists[htPlaylists(Playlist)].Visible) + { + _PlaylistActive = !_PlaylistActive; + Playlists[htPlaylists(Playlist)].Selected = _PlaylistActive; + SongMenus[htSongMenus(SongMenu)].SetActive(!_PlaylistActive); + } + break; - break; + case Keys.Back: + if (_SearchText.Length > 0) + { + ApplyNewSearchFilter(_SearchText.Remove(_SearchText.Length - 1)); + } - case Keys.F3: - if (_SearchActive) - { - _SearchActive = false; - _SearchText = String.Empty; - ApplyNewSearchFilter(_SearchText); - } - else - { - _SearchActive = true; - } - break; + if (!_SearchActive && CSongs.Category < 0) + CGraphics.FadeTo(EScreens.ScreenMain); - case Keys.A: - if (!_SearchActive && KeyEvent.Mod == Modifier.None) - { - StartRandomAllSongs(); - } - if (KeyEvent.Mod == Modifier.Ctrl) - { - StartRandomVisibleSongs(); - } - break; + break; - case Keys.F: - if (KeyEvent.Mod == Modifier.Ctrl){ + case Keys.Space: + ToggleSongOptions(ESongOptionsView.General); + break; + + case Keys.F3: if (_SearchActive) { _SearchActive = false; @@ -132,14 +190,97 @@ namespace Vocaluxe.Screens { _SearchActive = true; } + break; + + //TODO: Delete it! ??? Shouldn't we keep this as shortcut? + case Keys.A: + if (!_SearchActive && KeyEvent.Mod == Modifier.None) + { + StartRandomAllSongs(); + } + if (KeyEvent.Mod == Modifier.Ctrl) + { + StartRandomVisibleSongs(); + } + break; + + //TODO: Delete that from here and from wiki! + case Keys.F: + if (KeyEvent.Mod == Modifier.Ctrl) + { + if (_SearchActive) + { + _SearchActive = false; + _SearchText = String.Empty; + ApplyNewSearchFilter(_SearchText); + } + else + { + _SearchActive = true; + } + } + break; + + //TODO: We need another key for random! + case Keys.R: + if (CSongs.Category != -1 && KeyEvent.Mod == Modifier.Ctrl) + { + SongMenus[htSongMenus(SongMenu)].SetSelectedSong(CSongs.GetRandomSong()); + } + break; + + //TODO: Delete that! + case Keys.S: + if (CSongs.NumVisibleSongs > 0) + StartMedleySong(SongMenus[htSongMenus(SongMenu)].GetSelectedSong()); + break; + } + } + } + + else + { + switch (KeyEvent.Key) + { + case Keys.Enter: + if (Buttons[htButtons(ButtonOptionsClose)].Selected) + { + ToggleSongOptions(ESongOptionsView.None); + } + else if (Buttons[htButtons(ButtonOptionsSing)].Selected) + { + ToggleSongOptions(ESongOptionsView.None); + StartSong(SongMenus[htSongMenus(SongMenu)].GetSelectedSong()); + } + else if (Buttons[htButtons(ButtonOptionsPlaylist)].Selected) + { + OpenAndAddPlaylistAction(); + } + else if (Buttons[htButtons(ButtonOptionsRandom)].Selected) + { + if (CSongs.Category != -1) + { + SongMenus[htSongMenus(SongMenu)].SetSelectedSong(CSongs.GetRandomSong()); + } + } + else if (Buttons[htButtons(ButtonOptionsSingAll)].Selected) + { + StartRandomAllSongs(); + } + else if (Buttons[htButtons(ButtonOptionsSingAllVisible)].Selected) + { + StartRandomVisibleSongs(); + } + else if (Buttons[htButtons(ButtonOptionsOpenPlaylist)].Selected) + { + OpenPlaylistAction(); } break; - case Keys.R: - if (CSongs.Category != -1 && KeyEvent.Mod == Modifier.Ctrl) - { - SongMenus[htSongMenus(SongMenu)].SetSelectedSong(CSongs.GetRandomSong()); - } + case Keys.Escape: + case Keys.Back: + case Keys.Space: + ToggleSongOptions(ESongOptionsView.None); break; } } @@ -151,22 +292,98 @@ namespace Vocaluxe.Screens { base.HandleMouse(MouseEvent); - if ((MouseEvent.RB) && (CSongs.Category < 0)) + if (Playlists[htPlaylists(Playlist)].Visible && Playlists[htPlaylists(Playlist)].IsMouseOver(MouseEvent)) { - CGraphics.FadeTo(EScreens.ScreenMain); + _PlaylistActive = true; + Playlists[htPlaylists(Playlist)].Selected = _PlaylistActive; + SongMenus[htSongMenus(SongMenu)].SetActive(!_PlaylistActive); + } + else if (CHelper.IsInBounds(SongMenus[htSongMenus(SongMenu)].Rect, MouseEvent.X, MouseEvent.Y)) + { + _PlaylistActive = false; + Playlists[htPlaylists(Playlist)].Selected = _PlaylistActive; + SongMenus[htSongMenus(SongMenu)].SetActive(!_PlaylistActive); } - if (MouseEvent.MB && CSongs.Category != -1) + if (Playlists[htPlaylists(Playlist)].Visible && Playlists[htPlaylists(Playlist)].HandleMouse(MouseEvent)) + return true; + + if (!_SongOptionsActive) { - Console.WriteLine("MB pressed"); - SongMenus[htSongMenus(SongMenu)].SetSelectedSong(CSongs.GetRandomSong()); + + if ((MouseEvent.RB) && (CSongs.Category < 0)) + { + CGraphics.FadeTo(EScreens.ScreenMain); + } + else if (MouseEvent.RB && _SongOptionsActive) + ToggleSongOptions(ESongOptionsView.None); + + if (MouseEvent.MB && CSongs.Category != -1) + { + SongMenus[htSongMenus(SongMenu)].SetSelectedSong(CSongs.GetRandomSong()); + } + else + SongMenus[htSongMenus(SongMenu)].HandleMouse(ref MouseEvent); + + if (MouseEvent.LB && CSongs.NumVisibleSongs > 0 && SongMenus[htSongMenus(SongMenu)].GetActualSelection() != -1) + { + if (SongMenus[htSongMenus(SongMenu)].GetSelectedSong() != -1 && !_SongOptionsActive) + { + ToggleSongOptions(ESongOptionsView.Song); + } + } + else if (MouseEvent.LB && IsMouseOver(MouseEvent)) + { + if (Buttons[htButtons(ButtonOpenOptions)].Selected) + { + ToggleSongOptions(ESongOptionsView.General); + } + } } + else - SongMenus[htSongMenus(SongMenu)].HandleMouse(ref MouseEvent); - - if (MouseEvent.LB && CSongs.NumVisibleSongs > 0 && SongMenus[htSongMenus(SongMenu)].GetActualSelection() != -1) { - StartSong(SongMenus[htSongMenus(SongMenu)].GetSelectedSong()); + if (MouseEvent.LB && IsMouseOver(MouseEvent)) + { + if (Buttons[htButtons(ButtonOptionsClose)].Selected) + { + ToggleSongOptions(ESongOptionsView.None); + } + else if (Buttons[htButtons(ButtonOptionsSing)].Selected) + { + ToggleSongOptions(ESongOptionsView.None); + StartSong(SongMenus[htSongMenus(SongMenu)].GetSelectedSong()); + } + else if (Buttons[htButtons(ButtonOptionsPlaylist)].Selected) + { + OpenAndAddPlaylistAction(); + } + else if (Buttons[htButtons(ButtonOptionsRandom)].Selected) + { + if (CSongs.Category != -1) + { + SongMenus[htSongMenus(SongMenu)].SetSelectedSong(CSongs.GetRandomSong()); + } + } + else if (Buttons[htButtons(ButtonOptionsSingAll)].Selected) + { + ToggleSongOptions(ESongOptionsView.None); + StartRandomAllSongs(); + } + else if (Buttons[htButtons(ButtonOptionsSingAllVisible)].Selected) + { + ToggleSongOptions(ESongOptionsView.None); + StartRandomVisibleSongs(); + } + else if (Buttons[htButtons(ButtonOptionsOpenPlaylist)].Selected) + { + OpenPlaylistAction(); + } + } + if (MouseEvent.RB) + { + ToggleSongOptions(ESongOptionsView.None); + } } return true; @@ -177,11 +394,20 @@ namespace Vocaluxe.Screens base.OnShow(); CGame.EnterNormalGame(); SongMenus[htSongMenus(SongMenu)].OnShow(); + SongMenus[htSongMenus(SongMenu)].SetActive(!_PlaylistActive); + Playlists[htPlaylists(Playlist)].Init(); + if (Playlists[htPlaylists(Playlist)].ActivePlaylistID != -1) + Playlists[htPlaylists(Playlist)].LoadPlaylist(Playlists[htPlaylists(Playlist)].ActivePlaylistID); + UpdatePlaylistNames(); } public override bool UpdateGame() { SongMenus[htSongMenus(SongMenu)].Update(); + + if (SongMenus[htSongMenus(SongMenu)].IsSmallView()) + CheckPlaylist(); + Texts[htTexts(TextCategory)].Text = CSongs.GetActualCategoryName(); if (CSongs.Category > -1 || CConfig.Tabs == EOffOn.TR_CONFIG_OFF) @@ -223,7 +449,6 @@ namespace Vocaluxe.Screens public override bool Draw() { base.Draw(); - return true; } @@ -238,13 +463,40 @@ namespace Vocaluxe.Screens { if ((CSongs.Category >= 0) && (SongNr >= 0)) { + EGameMode gm; + if (_AvailableGameModes.Count >= SelectSlides[htSelectSlides(SelectSlideOptionsMode)].Selection) + { + gm = _AvailableGameModes[SelectSlides[htSelectSlides(SelectSlideOptionsMode)].Selection]; + } + else + { + if (CSongs.VisibleSongs[SongNr].IsDuet) + gm = GameModes.EGameMode.TR_GAMEMODE_DUET; + else + gm = GameModes.EGameMode.TR_GAMEMODE_NORMAL; + } + CGame.Reset(); CGame.ClearSongs(); - EGameMode gm = EGameMode.Normal; - if (CSongs.VisibleSongs[SongNr].IsDuet) - gm = EGameMode.Duet; + CGame.AddVisibleSong(SongNr, gm); + CGraphics.FadeTo(EScreens.ScreenNames); + } + } + + private void StartMedleySong(int SongNr) + { + if ((CSongs.Category >= 0) && (SongNr >= 0)) + { + EGameMode gm; + if (CSongs.VisibleSongs[SongNr].Medley.Source != EMedleySource.None) + gm = GameModes.EGameMode.TR_GAMEMODE_MEDLEY; + else + return; + + CGame.Reset(); + CGame.ClearSongs(); CGame.AddVisibleSong(SongNr, gm); CGraphics.FadeTo(EScreens.ScreenNames); @@ -255,7 +507,7 @@ namespace Vocaluxe.Screens { CGame.Reset(); CGame.ClearSongs(); - + List IDs = new List(); for (int i = 0; i < CSongs.AllSongs.Length; i++) { @@ -266,9 +518,9 @@ namespace Vocaluxe.Screens { int SongNr = IDs[CGame.Rand.Next(IDs.Count)]; - EGameMode gm = EGameMode.Normal; + EGameMode gm = EGameMode.TR_GAMEMODE_NORMAL; if (CSongs.AllSongs[SongNr].IsDuet) - gm = EGameMode.Duet; + gm = EGameMode.TR_GAMEMODE_DUET; CGame.AddSong(SongNr, gm); IDs.Remove(SongNr); @@ -282,7 +534,7 @@ namespace Vocaluxe.Screens { CGame.Reset(); CGame.ClearSongs(); - + List IDs = new List(); for (int i = 0; i < CSongs.VisibleSongs.Length; i++) { @@ -293,9 +545,9 @@ namespace Vocaluxe.Screens { int SongNr = IDs[CGame.Rand.Next(IDs.Count)]; - EGameMode gm = EGameMode.Normal; - if (CSongs.VisibleSongs[SongNr].IsDuet) - gm = EGameMode.Duet; + EGameMode gm = EGameMode.TR_GAMEMODE_NORMAL; + if (CSongs.AllSongs[SongNr].IsDuet) + gm = EGameMode.TR_GAMEMODE_DUET; CGame.AddSong(SongNr, gm); @@ -354,5 +606,221 @@ namespace Vocaluxe.Screens SongMenus[htSongMenus(SongMenu)].OnShow(); } + + private void ToggleSongOptions(ESongOptionsView view) + { + _SongOptionsActive = !_SongOptionsActive; + if (_SongOptionsActive) + { + if (view == ESongOptionsView.Song) + { + EGameMode LastMode = EGameMode.TR_GAMEMODE_NORMAL; + if (_AvailableGameModes.Count > 0) + LastMode = _AvailableGameModes[SelectSlides[htSelectSlides(SelectSlideOptionsMode)].Selection]; + SetInteractionToButton(Buttons[htButtons(ButtonOptionsSing)]); + _AvailableGameModes.Clear(); + SelectSlides[htSelectSlides(SelectSlideOptionsMode)].Clear(); + if (!CSongs.VisibleSongs[SongMenus[htSongMenus(SongMenu)].GetSelectedSong()].IsDuet) + { + SelectSlides[htSelectSlides(SelectSlideOptionsMode)].AddValue(Enum.GetName(typeof(GameModes.EGameMode), GameModes.EGameMode.TR_GAMEMODE_NORMAL)); + _AvailableGameModes.Add(GameModes.EGameMode.TR_GAMEMODE_NORMAL); + SelectSlides[htSelectSlides(SelectSlideOptionsMode)].AddValue(Enum.GetName(typeof(GameModes.EGameMode), GameModes.EGameMode.TR_GAMEMODE_SHORTSONG)); + _AvailableGameModes.Add(GameModes.EGameMode.TR_GAMEMODE_SHORTSONG); + } + if (CSongs.VisibleSongs[SongMenus[htSongMenus(SongMenu)].GetSelectedSong()].IsDuet) + { + SelectSlides[htSelectSlides(SelectSlideOptionsMode)].AddValue(Enum.GetName(typeof(GameModes.EGameMode), GameModes.EGameMode.TR_GAMEMODE_DUET)); + _AvailableGameModes.Add(GameModes.EGameMode.TR_GAMEMODE_DUET); + } + if (CSongs.VisibleSongs[SongMenus[htSongMenus(SongMenu)].GetSelectedSong()].Medley.Source != EMedleySource.None) + { + SelectSlides[htSelectSlides(SelectSlideOptionsMode)].AddValue(Enum.GetName(typeof(GameModes.EGameMode), GameModes.EGameMode.TR_GAMEMODE_MEDLEY)); + _AvailableGameModes.Add(GameModes.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[htSelectSlides(SelectSlideOptionsMode)].SetSelectionByValueIndex(i); + } + SelectSlides[htSelectSlides(SelectSlideOptionsMode)].Visible = true; + SelectSlides[htSelectSlides(SelectSlideOptionsPlaylistAdd)].Visible = true; + Buttons[htButtons(ButtonOptionsSing)].Visible = true; + Buttons[htButtons(ButtonOptionsPlaylist)].Visible = true; + } + else if (view == ESongOptionsView.General) + { + Buttons[htButtons(ButtonOptionsRandom)].Visible = CSongs.Category != -1; + Buttons[htButtons(ButtonOptionsSingAll)].Visible = true; + Buttons[htButtons(ButtonOptionsSingAllVisible)].Visible = CSongs.Category != -1; + + if (SelectSlides[htSelectSlides(SelectSlideOptionsPlaylistOpen)].NumValues > 0) + { + Buttons[htButtons(ButtonOptionsOpenPlaylist)].Visible = true; + SelectSlides[htSelectSlides(SelectSlideOptionsPlaylistOpen)].Visible = true; + SetInteractionToButton(Buttons[htButtons(ButtonOptionsOpenPlaylist)]); + } + else + { + Buttons[htButtons(ButtonOptionsOpenPlaylist)].Visible = false; + SelectSlides[htSelectSlides(SelectSlideOptionsPlaylistOpen)].Visible = false; + + if (Buttons[htButtons(ButtonOptionsRandom)].Visible) + SetInteractionToButton(Buttons[htButtons(ButtonOptionsRandom)]); + else + SetInteractionToButton(Buttons[htButtons(ButtonOptionsSingAll)]); + } + } + Buttons[htButtons(ButtonOptionsClose)].Visible = true; + Texts[htTexts(TextOptionsTitle)].Visible = true; + Statics[htStatics(StaticOptionsBG)].Visible = true; + Buttons[htButtons(ButtonOpenOptions)].Visible = false; + } + else + { + SelectSlides[htSelectSlides(SelectSlideOptionsMode)].Visible = false; + SelectSlides[htSelectSlides(SelectSlideOptionsPlaylistAdd)].Visible = false; + SelectSlides[htSelectSlides(SelectSlideOptionsPlaylistOpen)].Visible = false; + Buttons[htButtons(ButtonOptionsClose)].Visible = false; + Buttons[htButtons(ButtonOptionsSing)].Visible = false; + Buttons[htButtons(ButtonOptionsPlaylist)].Visible = false; + Buttons[htButtons(ButtonOptionsRandom)].Visible = false; + Buttons[htButtons(ButtonOptionsSingAll)].Visible = false; + Buttons[htButtons(ButtonOptionsSingAllVisible)].Visible = false; + Buttons[htButtons(ButtonOptionsOpenPlaylist)].Visible = false; + Buttons[htButtons(ButtonOpenOptions)].Visible = true; + Texts[htTexts(TextOptionsTitle)].Visible = false; + Statics[htStatics(StaticOptionsBG)].Visible = false; + } + } + + public void CheckPlaylist() + { + if (Playlists[htPlaylists(Playlist)].ActivePlaylistID == -1) + ClosePlaylist(); + } + + private void OpenPlaylist(int PlaylistID) + { + if (CPlaylists.Playlists.Length > PlaylistID && PlaylistID > -1) + { + Playlists[htPlaylists(Playlist)].LoadPlaylist(PlaylistID); + SongMenus[htSongMenus(SongMenu)].SetSmallView(true); + Playlists[htPlaylists(Playlist)].Visible = true; + } + } + + private void ClosePlaylist() + { + SongMenus[htSongMenus(SongMenu)].SetSmallView(false); + _PlaylistActive = false; + Playlists[htPlaylists(Playlist)].Selected = _PlaylistActive; + SongMenus[htSongMenus(SongMenu)].SetActive(!_PlaylistActive); + } + + private void UpdatePlaylistNames() + { + SelectSlides[htSelectSlides(SelectSlideOptionsPlaylistAdd)].Clear(); + SelectSlides[htSelectSlides(SelectSlideOptionsPlaylistAdd)].AddValue("TR_SCREENSONG_NEWPLAYLIST"); + SelectSlides[htSelectSlides(SelectSlideOptionsPlaylistAdd)].AddValues(CPlaylists.PlaylistNames); + SelectSlides[htSelectSlides(SelectSlideOptionsPlaylistOpen)].Clear(); + SelectSlides[htSelectSlides(SelectSlideOptionsPlaylistOpen)].AddValues(CPlaylists.PlaylistNames); + } + + private void OpenPlaylistAction() + { + //Open a playlist + if (Playlists[htPlaylists(Playlist)].ActivePlaylistID != (SelectSlides[htSelectSlides(SelectSlideOptionsPlaylistOpen)].Selection)) + { + Playlists[htPlaylists(Playlist)].ActivePlaylistID = SelectSlides[htSelectSlides(SelectSlideOptionsPlaylistOpen)].Selection; + SetSelectSlidePlaylistToCurrentPlaylist(); + + //Open playlist + OpenPlaylist(Playlists[htPlaylists(Playlist)].ActivePlaylistID); + Playlists[htPlaylists(Playlist)].ScrollToBottom(); + } + ToggleSongOptions(ESongOptionsView.None); + } + + private void OpenAndAddPlaylistAction() + { + //Open a playlist and add song + if (Playlists[htPlaylists(Playlist)].ActivePlaylistID != (SelectSlides[htSelectSlides(SelectSlideOptionsPlaylistAdd)].Selection - 1)) + { + //Check selected game-mode + EGameMode gm; + if (_AvailableGameModes.Count >= SelectSlides[htSelectSlides(SelectSlideOptionsMode)].Selection) + gm = _AvailableGameModes[SelectSlides[htSelectSlides(SelectSlideOptionsMode)].Selection]; + else + if (CSongs.VisibleSongs[SongMenus[htSongMenus(SongMenu)].GetSelectedSong()].IsDuet) + gm = GameModes.EGameMode.TR_GAMEMODE_DUET; + else + gm = GameModes.EGameMode.TR_GAMEMODE_NORMAL; + + //Check if Playlist really exists + if (SelectSlides[htSelectSlides(SelectSlideOptionsPlaylistAdd)].Selection - 1 < 0) + Playlists[htPlaylists(Playlist)].ActivePlaylistID = CPlaylists.NewPlaylist(); + else + Playlists[htPlaylists(Playlist)].ActivePlaylistID = SelectSlides[htSelectSlides(SelectSlideOptionsPlaylistAdd)].Selection - 1; + + //Add song to playlist + CPlaylists.Playlists[Playlists[htPlaylists(Playlist)].ActivePlaylistID].AddSong(CSongs.VisibleSongs[SongMenus[htSongMenus(SongMenu)].GetSelectedSong()].ID, gm); + + //Open playlist + OpenPlaylist(Playlists[htPlaylists(Playlist)].ActivePlaylistID); + + SetSelectSlidePlaylistToCurrentPlaylist(); + } + //Create a new playlist and add song + else if ((SelectSlides[htSelectSlides(SelectSlideOptionsPlaylistAdd)].Selection - 1) == -1) + { + //Check selected game-mode + EGameMode gm; + if (_AvailableGameModes.Count >= SelectSlides[htSelectSlides(SelectSlideOptionsMode)].Selection) + gm = _AvailableGameModes[SelectSlides[htSelectSlides(SelectSlideOptionsMode)].Selection]; + else + if (CSongs.VisibleSongs[SongMenus[htSongMenus(SongMenu)].GetSelectedSong()].IsDuet) + gm = GameModes.EGameMode.TR_GAMEMODE_DUET; + else + gm = GameModes.EGameMode.TR_GAMEMODE_NORMAL; + + //Create new playlist + Playlists[htPlaylists(Playlist)].ActivePlaylistID = CPlaylists.NewPlaylist(); + + //Add song to playlist + CPlaylists.Playlists[Playlists[htPlaylists(Playlist)].ActivePlaylistID].AddSong(CSongs.VisibleSongs[SongMenus[htSongMenus(SongMenu)].GetSelectedSong()].ID, gm); + + //Open playlist + OpenPlaylist(Playlists[htPlaylists(Playlist)].ActivePlaylistID); + + //Add new playlist to select-slide + SelectSlides[htSelectSlides(SelectSlideOptionsPlaylistAdd)].AddValue(CPlaylists.Playlists[Playlists[htPlaylists(Playlist)].ActivePlaylistID].PlaylistName); + + SetSelectSlidePlaylistToCurrentPlaylist(); + + } + //Add song to loaded playlist + else + { + //Check selected game-mode + EGameMode gm; + if (_AvailableGameModes.Count >= SelectSlides[htSelectSlides(SelectSlideOptionsMode)].Selection) + gm = _AvailableGameModes[SelectSlides[htSelectSlides(SelectSlideOptionsMode)].Selection]; + else + if (CSongs.VisibleSongs[SongMenus[htSongMenus(SongMenu)].GetSelectedSong()].IsDuet) + gm = GameModes.EGameMode.TR_GAMEMODE_DUET; + else + gm = GameModes.EGameMode.TR_GAMEMODE_NORMAL; + CPlaylists.Playlists[Playlists[htPlaylists(Playlist)].ActivePlaylistID].AddSong(CSongs.VisibleSongs[SongMenus[htSongMenus(SongMenu)].GetSelectedSong()].ID, gm); + Playlists[htPlaylists(Playlist)].UpdatePlaylist(); + Playlists[htPlaylists(Playlist)].ScrollToBottom(); + } + ToggleSongOptions(ESongOptionsView.Song); + } + + private void SetSelectSlidePlaylistToCurrentPlaylist() + { + SelectSlides[htSelectSlides(SelectSlideOptionsPlaylistAdd)].Selection = Playlists[htPlaylists(Playlist)].ActivePlaylistID + 1; + } } } diff --git a/Vocaluxe/Vocaluxe.csproj b/Vocaluxe/Vocaluxe.csproj index 4e715707..156dd856 100644 --- a/Vocaluxe/Vocaluxe.csproj +++ b/Vocaluxe/Vocaluxe.csproj @@ -169,6 +169,7 @@ + @@ -188,6 +189,7 @@ Form + @@ -213,6 +215,8 @@ + +