diff --git a/.gitignore b/.gitignore index d675d82b..4b8d2072 100644 --- a/.gitignore +++ b/.gitignore @@ -51,5 +51,9 @@ Thumbs.db /Installer/setup-SetupFiles /Installer/vocaluxe-*-setup.exe /Installer/Vocaluxe*.rar +/Installer/Prerequisites/GStreamer x64/gstreamer-1.0-x86_64-1.4.1.msi +/Installer/Prerequisites/GStreamer x86/gstreamer-1.0-x86-1.4.1.msi /WebserverInitalConfig/bin -/PhoneGap/ \ No newline at end of file +/PhoneGap/ +/TestResults +/VocaluxeTests/bin diff --git a/HowToBuildWin.md b/HowToBuildWin.md new file mode 100644 index 00000000..95285b79 --- /dev/null +++ b/HowToBuildWin.md @@ -0,0 +1,58 @@ +# Build Vocaluxe - HowTo (Windows) + +* Navigate to the right repository: usually [Vocaluxe Main](https://github.com/Vocaluxe/Vocaluxe) +* Navigate to the right branch: usually [develop](https://github.com/Vocaluxe/Vocaluxe/tree/develop) (The main branch of Vocaluxe) + + ![branch](https://cloud.githubusercontent.com/assets/5115160/4995706/bc5aa536-69c2-11e4-8534-b64573624a33.PNG) + +* Copy the `URL` of the corresponding git file + + ![url](https://cloud.githubusercontent.com/assets/5115160/4995708/bc5af234-69c2-11e4-91d1-112972f35f01.PNG) + +* Make sure [Visual Studio 2012/2013(?)](http://www.visualstudio.com/downloads/download-visual-studio-vs#d-express-windows-desktop) is installed + +* Clone the repository and open it + + **Method A: Use Visual Studio (2013+)'s git client:** + * Start Visual Studio + * `VIEW`->`Team Explorer` + * Click on the `Connect to a Team Project` button inside the `Team Explorer` + * Click on `Clone` under `Local Git Repositories` + * Enter `[theCopiedGitUrl]` in the first field + * Enter a target folder in the second field + * Click clone + ![vsclone](https://cloud.githubusercontent.com/assets/5115160/4998350/de81ca76-69d7-11e4-983d-d2886aa9faa0.png) + + **Method B: Use commandline git client:** + * Make sure git is installed [git-scm](http://git-scm.com/) + * Open a `git bash` (there should be a link in the start menu) + or a normal commandline if you have added git to the `PATH` variable + * Navigate to the folder where git should create the Vocaluxe project folder + + ``` + cd [PathToYourFolder] + ``` + * Clone the repository (could take some time...) + ``` + git clone [theCopiedGitUrl] + ``` + ![clone](https://cloud.githubusercontent.com/assets/5115160/4995707/bc5aa6da-69c2-11e4-95cb-71ac7b0c3fc8.png) + + * Now you should find a Folder `Vocaluxe` in the given directory -> navigate into it + + * Open the file `Vocaluxe.sln` with Visual Studio + +* Configure the build target to `ReleaseWin` and `x86` or `x64` (if unsure -> select `x86`) +* Build the projects by clicking `"Build"->"Build solution"` or just press `Control`+`Shift`+`B` + + ![build](https://cloud.githubusercontent.com/assets/5115160/4995709/bc5b3474-69c2-11e4-9d9b-b49f8a3b315d.png) + +* Check if your build was successful + ![buildsuccess](https://cloud.githubusercontent.com/assets/5115160/4995710/bc5b4fe0-69c2-11e4-8b0f-4acaeffbc568.png) + +* YOUR build should have appeared here: + ``` + [PathToYourFolder]\Vocaluxe\Output + ``` +* Run `Vocaluxe.exe` or copy the whole folder to a location of your choice +* Have fun! diff --git a/Installer/setup.aip b/Installer/setup.aip index 853fa2ce..246b2193 100644 --- a/Installer/setup.aip +++ b/Installer/setup.aip @@ -19,7 +19,7 @@ - + @@ -35,23 +35,29 @@ + + + + - - + + + + - + @@ -61,25 +67,25 @@ - - + + + + - - + - + + - - - + + + - - @@ -87,7 +93,6 @@ - @@ -98,41 +103,46 @@ + + + + + + + + - - - - - - - - - - - - - - + + + + + + - - - + + + + + + + + + + + + - - - - @@ -149,23 +159,33 @@ - - - + + + + + + + + + + + - - - - + + + + + + @@ -177,15 +197,17 @@ - - + + + + - - - + + + @@ -193,14 +215,11 @@ - - - - - - - + + + + @@ -224,11 +243,8 @@ - - - @@ -238,460 +254,9 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + - @@ -700,52 +265,34 @@ - - - - - - - - - + + + + + - - - + + + + - - - + + + - - - - - - - - - - - - - - - @@ -755,11 +302,11 @@ - - + + - + @@ -780,78 +327,61 @@ - - - - - - - - - - + + + + + + + + + + - - - - - - - + + + + - - - - + + + - - - - - - + + + - - - + + + - - - - + + + - - - - - - - - - - - - + + + @@ -859,74 +389,57 @@ - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + - - - - - - - - - - - + + + + + + + + + - - - - - - - + + - - - - @@ -935,10 +448,8 @@ - - - - + + @@ -960,36 +471,14 @@ - - - - - - - - - - - - - - - - - - - - - - @@ -997,7 +486,6 @@ - @@ -1006,59 +494,47 @@ - - - - + + + - - - - - + + + + - - - - - - + + + + - - - - - - - - + + + + - + - - - - @@ -1069,26 +545,13 @@ - + - - - - - - - - - - - - - @@ -1096,7 +559,6 @@ - @@ -1112,489 +574,23 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + - - - - - - - - - - - - - - @@ -1603,7 +599,7 @@ - + @@ -1663,13 +659,8 @@ - - - - - @@ -1732,9 +723,6 @@ - - - @@ -1742,30 +730,10 @@ - - - - - - - - - - - - - - - - - - - - @@ -1773,7 +741,6 @@ - @@ -1789,6 +756,33 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -1798,7 +792,6 @@ - @@ -1809,17 +802,13 @@ - - - - @@ -1836,7 +825,7 @@ - + @@ -1871,7 +860,6 @@ - @@ -1891,10 +879,6 @@ - - - - @@ -1903,30 +887,10 @@ - - - - - - - - - - - - - - - - - - - - @@ -1934,7 +898,6 @@ - @@ -1949,6 +912,33 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -1957,17 +947,13 @@ - - - - @@ -2007,12 +993,14 @@ - - - - - - + + + + + + + + @@ -2021,12 +1009,11 @@ - + + + - - - diff --git a/Output/Cover/Ambient Blue.xml b/Output/Cover/Ambient Blue.xml new file mode 100644 index 00000000..f1f91328 --- /dev/null +++ b/Output/Cover/Ambient Blue.xml @@ -0,0 +1,166 @@ + + + + Ambient Blue + Ambient Blue + flokuep + + + + + + + %TEXT% + + Normal + + + + 550 + + + + + 0.675 + 0.890 + 0.969 + 0.8 + + + + 24 + + + 100 + + + 1 + 1 + 1 + 1 + + + Normal.png + + 1.0 + + True + + + + + %TEXT% + + Normal + + + + 550 + + + + + 0.675 + 0.890 + 0.969 + 0.8 + + + + -150 + + + 100 + + + 1 + 1 + 1 + 1 + + + Normal.png + + 1.0 + + True + + + + + %TEXT% + + Normal + + + + 550 + + + + + 0.675 + 0.890 + 0.969 + 0.8 + + + + 150 + + + 100 + + + 1 + 1 + 1 + 1 + + + Normal.png + + 1.0 + + True + + + + + %TEXT% + + Normal + + + + 120 + + + + + 0.675 + 0.890 + 0.969 + 0.8 + + + + -150 + + + 100 + + + 1 + 1 + 1 + 1 + + + Normal.png + + 1.0 + + True + + diff --git a/Output/Cover/Ambient Blue/No Cover.png b/Output/Cover/Ambient Blue/No Cover.png new file mode 100644 index 00000000..73a0e4b1 Binary files /dev/null and b/Output/Cover/Ambient Blue/No Cover.png differ diff --git a/Output/Cover/Ambient Blue/Normal.png b/Output/Cover/Ambient Blue/Normal.png new file mode 100644 index 00000000..73a0e4b1 Binary files /dev/null and b/Output/Cover/Ambient Blue/Normal.png differ diff --git a/Output/Cover/Ambient Blue/Resources/Normal.psd b/Output/Cover/Ambient Blue/Resources/Normal.psd new file mode 100644 index 00000000..5cc517a3 Binary files /dev/null and b/Output/Cover/Ambient Blue/Resources/Normal.psd differ diff --git a/Output/Cover/Ambient Green.xml b/Output/Cover/Ambient Green.xml new file mode 100644 index 00000000..3e652377 --- /dev/null +++ b/Output/Cover/Ambient Green.xml @@ -0,0 +1,166 @@ + + + + Ambient Green + Ambient Green + flokuep + + + + + + + %TEXT% + + Normal + + + + 550 + + + + + 0.709 + 0.968 + 0.674 + 0.9 + + + + 24 + + + 100 + + + 1 + 1 + 1 + 1 + + + Normal.png + + 1.0 + + True + + + + + %TEXT% + + Normal + + + + 550 + + + + + 0.709 + 0.968 + 0.674 + 0.9 + + + + -150 + + + 100 + + + 1 + 1 + 1 + 1 + + + Normal.png + + 1.0 + + True + + + + + %TEXT% + + Normal + + + + 550 + + + + + 0.709 + 0.968 + 0.674 + 0.9 + + + + 150 + + + 100 + + + 1 + 1 + 1 + 1 + + + Normal.png + + 1.0 + + True + + + + + %TEXT% + + Normal + + + + 120 + + + + + 0.709 + 0.968 + 0.674 + 0.9 + + + + -150 + + + 100 + + + 1 + 1 + 1 + 1 + + + Normal.png + + 1.0 + + True + + diff --git a/Output/Cover/Ambient Green/No Cover.png b/Output/Cover/Ambient Green/No Cover.png new file mode 100644 index 00000000..2a1612cb Binary files /dev/null and b/Output/Cover/Ambient Green/No Cover.png differ diff --git a/Output/Cover/Ambient Green/Normal.png b/Output/Cover/Ambient Green/Normal.png new file mode 100644 index 00000000..2a1612cb Binary files /dev/null and b/Output/Cover/Ambient Green/Normal.png differ diff --git a/Output/Cover/Ambient Green/Resources/Normal.psd b/Output/Cover/Ambient Green/Resources/Normal.psd new file mode 100644 index 00000000..8f973d02 Binary files /dev/null and b/Output/Cover/Ambient Green/Resources/Normal.psd differ diff --git a/Output/Cover/Ambient Red.xml b/Output/Cover/Ambient Red.xml new file mode 100644 index 00000000..fa65f01d --- /dev/null +++ b/Output/Cover/Ambient Red.xml @@ -0,0 +1,166 @@ + + + + Ambient Red + Ambient Red + flokuep + + + + + + + %TEXT% + + Normal + + + + 550 + + + + + 0.968 + 0.674 + 0.674 + 0.9 + + + + 24 + + + 100 + + + 1 + 1 + 1 + 1 + + + Normal.png + + 1.0 + + True + + + + + %TEXT% + + Normal + + + + 550 + + + + + 0.968 + 0.674 + 0.674 + 0.9 + + + + -150 + + + 100 + + + 1 + 1 + 1 + 1 + + + Normal.png + + 1.0 + + True + + + + + %TEXT% + + Normal + + + + 550 + + + + + 0.968 + 0.674 + 0.674 + 0.9 + + + + 150 + + + 100 + + + 1 + 1 + 1 + 1 + + + Normal.png + + 1.0 + + True + + + + + %TEXT% + + Normal + + + + 120 + + + + + 0.968 + 0.674 + 0.674 + 0.9 + + + + -150 + + + 100 + + + 1 + 1 + 1 + 1 + + + Normal.png + + 1.0 + + True + + diff --git a/Output/Cover/Ambient Red/No Cover.png b/Output/Cover/Ambient Red/No Cover.png new file mode 100644 index 00000000..1bf01057 Binary files /dev/null and b/Output/Cover/Ambient Red/No Cover.png differ diff --git a/Output/Cover/Ambient Red/Normal.png b/Output/Cover/Ambient Red/Normal.png new file mode 100644 index 00000000..1bf01057 Binary files /dev/null and b/Output/Cover/Ambient Red/Normal.png differ diff --git a/Output/Cover/Ambient Red/Resources/Normal.psd b/Output/Cover/Ambient Red/Resources/Normal.psd new file mode 100644 index 00000000..db9fb4ed Binary files /dev/null and b/Output/Cover/Ambient Red/Resources/Normal.psd differ diff --git a/Output/Cover/Ambient Yellow.xml b/Output/Cover/Ambient Yellow.xml new file mode 100644 index 00000000..7636b2fa --- /dev/null +++ b/Output/Cover/Ambient Yellow.xml @@ -0,0 +1,166 @@ + + + + Ambient Yellow + Ambient Yellow + flokuep + + + + + + + %TEXT% + + Normal + + + + 550 + + + + + 0.968 + 0.956 + 0.674 + 0.9 + + + + 24 + + + 100 + + + 1 + 1 + 1 + 1 + + + Normal.png + + 1.0 + + True + + + + + %TEXT% + + Normal + + + + 550 + + + + + 0.968 + 0.956 + 0.674 + 0.9 + + + + -150 + + + 100 + + + 1 + 1 + 1 + 1 + + + Normal.png + + 1.0 + + True + + + + + %TEXT% + + Outline + + + + 550 + + + + + 0.968 + 0.956 + 0.674 + 0.9 + + + + 150 + + + 100 + + + 1 + 1 + 1 + 1 + + + Normal.png + + 1.0 + + True + + + + + %TEXT% + + Normal + + + + 120 + + + + + 0.968 + 0.956 + 0.674 + 0.9 + + + + -150 + + + 100 + + + 1 + 1 + 1 + 1 + + + Normal.png + + 1.0 + + True + + diff --git a/Output/Cover/Ambient Yellow/No Cover.png b/Output/Cover/Ambient Yellow/No Cover.png new file mode 100644 index 00000000..e7be3e62 Binary files /dev/null and b/Output/Cover/Ambient Yellow/No Cover.png differ diff --git a/Output/Cover/Ambient Yellow/Normal.png b/Output/Cover/Ambient Yellow/Normal.png new file mode 100644 index 00000000..e7be3e62 Binary files /dev/null and b/Output/Cover/Ambient Yellow/Normal.png differ diff --git a/Output/Cover/Ambient Yellow/Resources/Normal.psd b/Output/Cover/Ambient Yellow/Resources/Normal.psd new file mode 100644 index 00000000..ebc648a0 Binary files /dev/null and b/Output/Cover/Ambient Yellow/Resources/Normal.psd differ diff --git a/Output/Cover/Blue.xml b/Output/Cover/Blue.xml deleted file mode 100644 index 9befe7d3..00000000 --- a/Output/Cover/Blue.xml +++ /dev/null @@ -1,8 +0,0 @@ - - - - Blue - Blue - flokuep - - diff --git a/Output/Cover/Blue/#.png b/Output/Cover/Blue/#.png deleted file mode 100644 index d9f726f3..00000000 Binary files a/Output/Cover/Blue/#.png and /dev/null differ diff --git a/Output/Cover/Blue/1900 - 1909.png b/Output/Cover/Blue/1900 - 1909.png deleted file mode 100644 index ee800066..00000000 Binary files a/Output/Cover/Blue/1900 - 1909.png and /dev/null differ diff --git a/Output/Cover/Blue/1910 - 1919.png b/Output/Cover/Blue/1910 - 1919.png deleted file mode 100644 index 184cf61b..00000000 Binary files a/Output/Cover/Blue/1910 - 1919.png and /dev/null differ diff --git a/Output/Cover/Blue/1920 - 1929.png b/Output/Cover/Blue/1920 - 1929.png deleted file mode 100644 index ee016622..00000000 Binary files a/Output/Cover/Blue/1920 - 1929.png and /dev/null differ diff --git a/Output/Cover/Blue/1930 - 1939.png b/Output/Cover/Blue/1930 - 1939.png deleted file mode 100644 index 8c03d86b..00000000 Binary files a/Output/Cover/Blue/1930 - 1939.png and /dev/null differ diff --git a/Output/Cover/Blue/1940 - 1949.png b/Output/Cover/Blue/1940 - 1949.png deleted file mode 100644 index 6768cac7..00000000 Binary files a/Output/Cover/Blue/1940 - 1949.png and /dev/null differ diff --git a/Output/Cover/Blue/1950 - 1959.png b/Output/Cover/Blue/1950 - 1959.png deleted file mode 100644 index 9630d5a4..00000000 Binary files a/Output/Cover/Blue/1950 - 1959.png and /dev/null differ diff --git a/Output/Cover/Blue/1960 - 1969.png b/Output/Cover/Blue/1960 - 1969.png deleted file mode 100644 index b05aa1da..00000000 Binary files a/Output/Cover/Blue/1960 - 1969.png and /dev/null differ diff --git a/Output/Cover/Blue/1970 - 1979.png b/Output/Cover/Blue/1970 - 1979.png deleted file mode 100644 index 7fe3b891..00000000 Binary files a/Output/Cover/Blue/1970 - 1979.png and /dev/null differ diff --git a/Output/Cover/Blue/1980 - 1989.png b/Output/Cover/Blue/1980 - 1989.png deleted file mode 100644 index f8d8334c..00000000 Binary files a/Output/Cover/Blue/1980 - 1989.png and /dev/null differ diff --git a/Output/Cover/Blue/1990 - 1999.png b/Output/Cover/Blue/1990 - 1999.png deleted file mode 100644 index 0baeaa1c..00000000 Binary files a/Output/Cover/Blue/1990 - 1999.png and /dev/null differ diff --git a/Output/Cover/Blue/2000 - 2009.png b/Output/Cover/Blue/2000 - 2009.png deleted file mode 100644 index c3b778b4..00000000 Binary files a/Output/Cover/Blue/2000 - 2009.png and /dev/null differ diff --git a/Output/Cover/Blue/2010 - 2019.png b/Output/Cover/Blue/2010 - 2019.png deleted file mode 100644 index 466d8ccf..00000000 Binary files a/Output/Cover/Blue/2010 - 2019.png and /dev/null differ diff --git a/Output/Cover/Blue/A.png b/Output/Cover/Blue/A.png deleted file mode 100644 index 4270b335..00000000 Binary files a/Output/Cover/Blue/A.png and /dev/null differ diff --git a/Output/Cover/Blue/All Songs.png b/Output/Cover/Blue/All Songs.png deleted file mode 100644 index ffe61d44..00000000 Binary files a/Output/Cover/Blue/All Songs.png and /dev/null differ diff --git a/Output/Cover/Blue/Alle Songs.png b/Output/Cover/Blue/Alle Songs.png deleted file mode 100644 index 3191816b..00000000 Binary files a/Output/Cover/Blue/Alle Songs.png and /dev/null differ diff --git a/Output/Cover/Blue/B.png b/Output/Cover/Blue/B.png deleted file mode 100644 index 9a3fd26a..00000000 Binary files a/Output/Cover/Blue/B.png and /dev/null differ diff --git a/Output/Cover/Blue/C.png b/Output/Cover/Blue/C.png deleted file mode 100644 index 5a4b7c7b..00000000 Binary files a/Output/Cover/Blue/C.png and /dev/null differ diff --git a/Output/Cover/Blue/D.png b/Output/Cover/Blue/D.png deleted file mode 100644 index da7174d6..00000000 Binary files a/Output/Cover/Blue/D.png and /dev/null differ diff --git a/Output/Cover/Blue/E.png b/Output/Cover/Blue/E.png deleted file mode 100644 index 26be0535..00000000 Binary files a/Output/Cover/Blue/E.png and /dev/null differ diff --git a/Output/Cover/Blue/EmptyCover.png b/Output/Cover/Blue/EmptyCover.png deleted file mode 100644 index 048a8dc0..00000000 Binary files a/Output/Cover/Blue/EmptyCover.png and /dev/null differ diff --git a/Output/Cover/Blue/English.png b/Output/Cover/Blue/English.png deleted file mode 100644 index 7a0887c6..00000000 Binary files a/Output/Cover/Blue/English.png and /dev/null differ diff --git a/Output/Cover/Blue/F.png b/Output/Cover/Blue/F.png deleted file mode 100644 index 3cd57ef2..00000000 Binary files a/Output/Cover/Blue/F.png and /dev/null differ diff --git a/Output/Cover/Blue/French.png b/Output/Cover/Blue/French.png deleted file mode 100644 index 74b32d23..00000000 Binary files a/Output/Cover/Blue/French.png and /dev/null differ diff --git a/Output/Cover/Blue/G.png b/Output/Cover/Blue/G.png deleted file mode 100644 index ed912058..00000000 Binary files a/Output/Cover/Blue/G.png and /dev/null differ diff --git a/Output/Cover/Blue/German.png b/Output/Cover/Blue/German.png deleted file mode 100644 index d2252175..00000000 Binary files a/Output/Cover/Blue/German.png and /dev/null differ diff --git a/Output/Cover/Blue/H.png b/Output/Cover/Blue/H.png deleted file mode 100644 index c49edd70..00000000 Binary files a/Output/Cover/Blue/H.png and /dev/null differ diff --git a/Output/Cover/Blue/I.png b/Output/Cover/Blue/I.png deleted file mode 100644 index 8c8996fd..00000000 Binary files a/Output/Cover/Blue/I.png and /dev/null differ diff --git a/Output/Cover/Blue/Italian.png b/Output/Cover/Blue/Italian.png deleted file mode 100644 index 3529aa80..00000000 Binary files a/Output/Cover/Blue/Italian.png and /dev/null differ diff --git a/Output/Cover/Blue/J.png b/Output/Cover/Blue/J.png deleted file mode 100644 index de1242b7..00000000 Binary files a/Output/Cover/Blue/J.png and /dev/null differ diff --git a/Output/Cover/Blue/K.png b/Output/Cover/Blue/K.png deleted file mode 100644 index 7212965a..00000000 Binary files a/Output/Cover/Blue/K.png and /dev/null differ diff --git a/Output/Cover/Blue/L.png b/Output/Cover/Blue/L.png deleted file mode 100644 index 5c5b3064..00000000 Binary files a/Output/Cover/Blue/L.png and /dev/null differ diff --git a/Output/Cover/Blue/M.png b/Output/Cover/Blue/M.png deleted file mode 100644 index 8c7cc450..00000000 Binary files a/Output/Cover/Blue/M.png and /dev/null differ diff --git a/Output/Cover/Blue/N.png b/Output/Cover/Blue/N.png deleted file mode 100644 index e35faf8c..00000000 Binary files a/Output/Cover/Blue/N.png and /dev/null differ diff --git a/Output/Cover/Blue/No Cover.png b/Output/Cover/Blue/No Cover.png deleted file mode 100644 index d57d9e73..00000000 Binary files a/Output/Cover/Blue/No Cover.png and /dev/null differ diff --git a/Output/Cover/Blue/No Edition.png b/Output/Cover/Blue/No Edition.png deleted file mode 100644 index 4904af08..00000000 Binary files a/Output/Cover/Blue/No Edition.png and /dev/null differ diff --git a/Output/Cover/Blue/No Genre.png b/Output/Cover/Blue/No Genre.png deleted file mode 100644 index 51223f63..00000000 Binary files a/Output/Cover/Blue/No Genre.png and /dev/null differ diff --git a/Output/Cover/Blue/No Language.png b/Output/Cover/Blue/No Language.png deleted file mode 100644 index fc485860..00000000 Binary files a/Output/Cover/Blue/No Language.png and /dev/null differ diff --git a/Output/Cover/Blue/No Year.png b/Output/Cover/Blue/No Year.png deleted file mode 100644 index 5d1af2c5..00000000 Binary files a/Output/Cover/Blue/No Year.png and /dev/null differ diff --git a/Output/Cover/Blue/O.png b/Output/Cover/Blue/O.png deleted file mode 100644 index a6850856..00000000 Binary files a/Output/Cover/Blue/O.png and /dev/null differ diff --git a/Output/Cover/Blue/Ohne Edition.png b/Output/Cover/Blue/Ohne Edition.png deleted file mode 100644 index b8fe90ee..00000000 Binary files a/Output/Cover/Blue/Ohne Edition.png and /dev/null differ diff --git a/Output/Cover/Blue/Ohne Genre.png b/Output/Cover/Blue/Ohne Genre.png deleted file mode 100644 index 15a93467..00000000 Binary files a/Output/Cover/Blue/Ohne Genre.png and /dev/null differ diff --git a/Output/Cover/Blue/Ohne Jahr.png b/Output/Cover/Blue/Ohne Jahr.png deleted file mode 100644 index 031a5549..00000000 Binary files a/Output/Cover/Blue/Ohne Jahr.png and /dev/null differ diff --git a/Output/Cover/Blue/Ohne Sprache.png b/Output/Cover/Blue/Ohne Sprache.png deleted file mode 100644 index c07ab84c..00000000 Binary files a/Output/Cover/Blue/Ohne Sprache.png and /dev/null differ diff --git a/Output/Cover/Blue/P.png b/Output/Cover/Blue/P.png deleted file mode 100644 index 0aaac9b0..00000000 Binary files a/Output/Cover/Blue/P.png and /dev/null differ diff --git a/Output/Cover/Blue/Polish.png b/Output/Cover/Blue/Polish.png deleted file mode 100644 index 831af907..00000000 Binary files a/Output/Cover/Blue/Polish.png and /dev/null differ diff --git a/Output/Cover/Blue/Q.png b/Output/Cover/Blue/Q.png deleted file mode 100644 index 5ef1045a..00000000 Binary files a/Output/Cover/Blue/Q.png and /dev/null differ diff --git a/Output/Cover/Blue/R.png b/Output/Cover/Blue/R.png deleted file mode 100644 index 637f6831..00000000 Binary files a/Output/Cover/Blue/R.png and /dev/null differ diff --git a/Output/Cover/Blue/Resources/decades.xcf b/Output/Cover/Blue/Resources/decades.xcf deleted file mode 100644 index 4b951b1f..00000000 Binary files a/Output/Cover/Blue/Resources/decades.xcf and /dev/null differ diff --git a/Output/Cover/Blue/Resources/language.xcf b/Output/Cover/Blue/Resources/language.xcf deleted file mode 100644 index 4c7b6a7c..00000000 Binary files a/Output/Cover/Blue/Resources/language.xcf and /dev/null differ diff --git a/Output/Cover/Blue/Resources/letter.xcf b/Output/Cover/Blue/Resources/letter.xcf deleted file mode 100644 index e58b2f5f..00000000 Binary files a/Output/Cover/Blue/Resources/letter.xcf and /dev/null differ diff --git a/Output/Cover/Blue/Resources/no_cover.xcf b/Output/Cover/Blue/Resources/no_cover.xcf deleted file mode 100644 index b1ea09eb..00000000 Binary files a/Output/Cover/Blue/Resources/no_cover.xcf and /dev/null differ diff --git a/Output/Cover/Blue/S.png b/Output/Cover/Blue/S.png deleted file mode 100644 index 0366292f..00000000 Binary files a/Output/Cover/Blue/S.png and /dev/null differ diff --git a/Output/Cover/Blue/Spanish.png b/Output/Cover/Blue/Spanish.png deleted file mode 100644 index 810b5150..00000000 Binary files a/Output/Cover/Blue/Spanish.png and /dev/null differ diff --git a/Output/Cover/Blue/T.png b/Output/Cover/Blue/T.png deleted file mode 100644 index 5f7e1816..00000000 Binary files a/Output/Cover/Blue/T.png and /dev/null differ diff --git a/Output/Cover/Blue/U.png b/Output/Cover/Blue/U.png deleted file mode 100644 index e9627049..00000000 Binary files a/Output/Cover/Blue/U.png and /dev/null differ diff --git a/Output/Cover/Blue/V.png b/Output/Cover/Blue/V.png deleted file mode 100644 index 888d3fb3..00000000 Binary files a/Output/Cover/Blue/V.png and /dev/null differ diff --git a/Output/Cover/Blue/W.png b/Output/Cover/Blue/W.png deleted file mode 100644 index dd10d126..00000000 Binary files a/Output/Cover/Blue/W.png and /dev/null differ diff --git a/Output/Cover/Blue/X.png b/Output/Cover/Blue/X.png deleted file mode 100644 index 26354523..00000000 Binary files a/Output/Cover/Blue/X.png and /dev/null differ diff --git a/Output/Cover/Blue/Y.png b/Output/Cover/Blue/Y.png deleted file mode 100644 index 10e671d7..00000000 Binary files a/Output/Cover/Blue/Y.png and /dev/null differ diff --git a/Output/Cover/Blue/Z.png b/Output/Cover/Blue/Z.png deleted file mode 100644 index 30582dba..00000000 Binary files a/Output/Cover/Blue/Z.png and /dev/null differ diff --git a/Output/CreditsRessourcesDB.sqlite b/Output/CreditsRessourcesDB.sqlite index 5701709f..d5dbafb9 100644 Binary files a/Output/CreditsRessourcesDB.sqlite and b/Output/CreditsRessourcesDB.sqlite differ diff --git a/Output/Fonts/Fonts.xml b/Output/Fonts/Fonts.xml index 2bbf61c3..9b8f2e33 100644 --- a/Output/Fonts/Fonts.xml +++ b/Output/Fonts/Fonts.xml @@ -3,11 +3,13 @@ Normal - 0,00 - 0,00 - 0,00 - 0,00 - 1,00 + 0.00 + + 0.00 + 0.00 + 0.00 + 1.00 + FreeSans FreeSans.ttf FreeSansBold.ttf @@ -16,11 +18,13 @@ Outline - 0,10 - 0,00 - 0,00 - 0,00 - 1,00 + 0.10 + + 0.00 + 0.00 + 0.00 + 1.00 + FreeSans FreeSans.ttf FreeSansBold.ttf diff --git a/Output/Languages/Czech.xml b/Output/Languages/Czech.xml index b1a67a15..89639fd6 100644 --- a/Output/Languages/Czech.xml +++ b/Output/Languages/Czech.xml @@ -76,6 +76,7 @@ Vlastní hudba a hudba na pozadí Žádná vlastní hudba Pouze vlastní hudba + Jen vybraná píseň Vše Pouze jména a zastupující obrázky Nic @@ -210,8 +211,6 @@ Kamery Rozlišení kamery Přizpůsobení obrazovky - Stiskněte Ctrl + Alt + Shift + šipky pro upravení obrazovky - Ctrl + Alt + Shift + 0 pro vrácení úprav zpět na výchozí hodnoty Nahoře vlevo Nahoře vpravo Dole vlevo diff --git a/Output/Languages/English.xml b/Output/Languages/English.xml index cd7cccae..0a2840a4 100644 --- a/Output/Languages/English.xml +++ b/Output/Languages/English.xml @@ -46,10 +46,9 @@ Level 2 Level 3 Max - List + Song List Dreidel TileBoard - Song List Book On Demand At Startup @@ -94,6 +93,7 @@ Party Options Profiles + No profiles found! Party Mode Selection Party Mode Description @@ -212,8 +212,8 @@ Webcams Webcam-Resolution Screen adjustments - Press CTR + ALT + SHIFT + Arrows to adjust screen - CTR + ALT + SHIFT + 0 to reset + Press CTR + ALT (+ SHIFT) + Arrows|\"+\" to adjust screen + CTR + ALT + 0 to reset Top left Top right Bottom left diff --git a/Output/Languages/French.xml b/Output/Languages/French.xml index 149f908c..6261dd64 100644 --- a/Output/Languages/French.xml +++ b/Output/Languages/French.xml @@ -30,7 +30,7 @@ Invité Utilisateur normal Administrateur - Clavier d\'Utilisateur + Clavier d'Utilisateur Logiciel OpenGL Direct3D @@ -57,7 +57,7 @@ Aléatoire Dossier Artiste - Initiale d\'Artiste + Initiale d'Artiste Initiale de Titre Edition Genre @@ -76,6 +76,7 @@ Musique personnelle et Musique de fond Pas de Musique personnelle Seulement la Musique personnelle + Seulement les chansons sélectionnées Tout Seulement noms et avatars Rien @@ -92,16 +93,17 @@ Mode Fête Options Profils + Aucun profil trouvé ! Sélection du mode Fête Mode Fête Description Auteur Version Impossible de charger ce mode Fête. - Aucun micro n\'est configuré ! + Aucun micro n'est configuré ! Personnes visées - Pas d\'équipes - Nombre d\'équipes + Pas d'équipes + Nombre d'équipes Nombre de joueurs Sélection des joueurs Joueur @@ -111,10 +113,10 @@ 4 joueurs 5 joueurs 6 joueurs - Attention: Aucun micro n\'est assigné au joueur %v! - Attention: Aucun micro n\'est assigné aux joueurs %v! - Attention: Aucun profil n\'est assigné au joueur %v! - Attention: Aucun profil n\'est assigné aux joueurs %v! + Attention: Aucun micro n'est assigné au joueur %v! + Attention: Aucun micro n'est assigné aux joueurs %v! + Attention: Aucun profil n'est assigné au joueur %v! + Attention: Aucun profil n'est assigné aux joueurs %v! Choix de la chanson Chanter Ajouter à la playlist @@ -131,9 +133,9 @@ Options de la chanson Rechercher: Pas de Langue - Pas d\'Année + Pas d'Année Pas de Genre - Pas d\'Edition + Pas d'Edition Toutes les chansons (%v Chansons) (%v Chanson) @@ -152,7 +154,7 @@ Nom du Joueur Difficulté du jeu Avatar - Role de l\'utilisateur + Role de l'utilisateur Actif Nouveau Supprimer @@ -176,7 +178,7 @@ Dossiers Difficulté du Jeu Mode du Minuteur - Options d\'Enregistrement + Options d'Enregistrement Appareil Entrée Canal 1 @@ -195,7 +197,7 @@ Environnement graphique Thème des Couvertures Afficher les portées - Afficher l\'aide pour la Tonalité + Afficher l'aide pour la Tonalité Apparence du Minuteur Dégradé des infos des joueurs Chargement des couvertures @@ -205,13 +207,13 @@ Options Vidéo Vidéo en arrière plan Prévisualisation des Vidéos - Vidéos pendant que l\'on chante + Vidéos pendant que l'on chante Afficher la vidéo de la musique de fond Webcams Résolution de la Webcam - Ajustements de l\'écran - Appuyer sur CTR + ALT + SHIFT + Flèches pour ajuster l\'écran - CTR + ALT + SHIFT + 0 pour réinitialiser + Ajustements de l'écran + Appuyer sur CTRL + ALT (+ Maj) + Flèches|"+" pour ajuster l'écran + CTRL + ALT + 0 pour annuler Haut gauche Haut droit Bas gauche diff --git a/Output/Languages/German.xml b/Output/Languages/German.xml index 36078c2b..39cc1c09 100644 --- a/Output/Languages/German.xml +++ b/Output/Languages/German.xml @@ -46,10 +46,9 @@ Level 2 Level 3 Maximal - Liste + Songliste Dreidel TileBoard - Songliste Book Bei Bedarf Bei Programmstart @@ -77,6 +76,7 @@ Eigene Musik und Hintergrundmusik Keine eigene Musik Nur eigene Musik + Nur bei gewähltem Song Alle Nur Namen und Avatar Keine @@ -93,6 +93,7 @@ Party Optionen Profile + Keine Profile gefunden! Party-Modus Auswahl Party-Modus Beschreibung @@ -211,8 +212,8 @@ Webcams Webcam-Auflösung Anzeigeanpassungen - STRG + ALT + SHIFT + Pfeiltasten drücken um den Bildschirm anzupassen - STRG + ALT + SHIFT + 0 um die Anpassungen zurückzusetzen + STRG + ALT (+ SHIFT) + Pfeiltasten oder "+" drücken um den Bildschirm zu justieren. + STRG + ALT + 0 um die Änderungen zurückzusetzen. Oben links Oben rechts Unten links diff --git a/Output/Languages/Italian.xml b/Output/Languages/Italian.xml index 8c899d6e..ca474c09 100644 --- a/Output/Languages/Italian.xml +++ b/Output/Languages/Italian.xml @@ -14,6 +14,7 @@ Volume massimo Canzoni caricate Mouse + Uso della Memoria Normale Duetto Medley @@ -29,6 +30,7 @@ Ospite Utente normale Amministratore + Tasti Utente Software OpenGL Direct3D @@ -46,6 +48,7 @@ Max Elenco Dreidel + Scacchiera Libro Su richiesta All\'avvio @@ -61,6 +64,7 @@ Anno Decade Lingua + Inserimento Data Facile Normale Difficile @@ -72,9 +76,13 @@ Musica personale e musica di sfondo Nessuna musica personale Solo musica personale + Solo la canzone selezionata Tutto Solo nomi e avatar Niente + Sotto + Sopra + Sopra e sotto Dinamico Caricamento Totale @@ -91,6 +99,7 @@ Autore Versione Impossibile caricare questa modalità festa. + Nessun microfono configurato! Target di riferimento Nessuna squadra Numero di squadre @@ -116,6 +125,7 @@ Canta tutte le canzoni Canta tutte le canzoni visibili Apri playlist + Selezione Canta un medley casuale Canta canzoni medley Nuova playlist @@ -188,11 +198,24 @@ Mostra note-linee Mostra Aiuto-Tono Look timer + Aumenta-Diminuisci info Giocatore + Modo di Caricamento Cover Opzioni testi Stile Posizione testi Opzioni video + Video di Sfondo Anteprima video + Video durante il canto + Mostra il video attuale sullo sfondo + Webcam + Risoluzione-Webcam + Sistemazione schermo + Sopra a sinistra + Sopra a destra + Sotto a sinistra + Sotto a destra Volume Indirizzo server + Il server non sta funzionando. Per favore controlla il file config.xml! diff --git a/Output/Languages/Swedish.xml b/Output/Languages/Swedish.xml index 2b364a94..92c72192 100644 --- a/Output/Languages/Swedish.xml +++ b/Output/Languages/Swedish.xml @@ -76,6 +76,7 @@ Egen Musik och Bakgrundsmusik Ingen egen Musik Endast egen Musik + Endast vald låt Alla Endast namn och avatarer Ingenting diff --git a/Output/PartyModes/Challenge/Languages/Italian.xml b/Output/PartyModes/Challenge/Languages/Italian.xml index 936ed185..8bb7714c 100644 --- a/Output/PartyModes/Challenge/Languages/Italian.xml +++ b/Output/PartyModes/Challenge/Languages/Italian.xml @@ -1,18 +1,30 @@ Italiano + Modalità Sfida + Gioca alcuni turni di sfida. + Per tutti quelli interessati ai duelli. Prossimo Indietro Inizia Esci Si No + Prossimo Turno + Modalità Sfida: Configurazione Numero di giocatori Numero di microfoni + Numero di turni + Modalità Sfida: Scegli il Giocatore Selezione casuale + Modalità Sfida: Panoramica Pos Nome + Turni Vittorie + Punti Canto Punteggio Vuoi davvero uscire? + Giocatore del prossimo turno: + Tutti i turni di canto completati! E il vincitore è... diff --git a/Output/PartyModes/Challenge/Screens/PartyScreenChallengeConfig.xml b/Output/PartyModes/Challenge/Screens/PartyScreenChallengeConfig.xml deleted file mode 100644 index 1623eba7..00000000 --- a/Output/PartyModes/Challenge/Screens/PartyScreenChallengeConfig.xml +++ /dev/null @@ -1,458 +0,0 @@ - - - - 1 - - - Video - - - - BG_Default - - - BackgroundColor - - - - Menu - - 40 - 40 - 0,00 - 1200 - 50 - - - StaticColor - - - - - - - 640 - 48 - - 0,00 - - 27 - - - - StaticColor - - - TextSColor - - Center - - Center - - - - Outline - - TR_SCREENCONFIG_TITLE - - - - - - - 75 - 105 - - 0,00 - - 27 - - - - StaticColor - - - TextSColor - - Left - - Center - - - - Outline - - TR_SCREENCONFIG_NUMPLAYERS - - - - - - - 75 - 165 - - 0,00 - - 27 - - - - StaticColor - - - TextSColor - - Left - - Center - - - - Outline - - TR_SCREENCONFIG_NUMMICS - - - - - - - 75 - 225 - - 0,00 - - 27 - - - - StaticColor - - - TextSColor - - Left - - Center - - - - Outline - - TR_SCREENCONFIG_NUMROUNDS - - - - - - - Button - - Button - - 985 - 600 - 0,00 - 150 - 50 - - - ButtonColor - - - ButtonSColor - - - 75 - 10 - - 27 - - 142 - - - ButtonTextColor - - - ButtonTextSColor - - Center - - Center - - - - Outline - - TR_BUTTON_NEXT - - - - - - 10 - 26 - - - - - - 10 - 26 - - - - - Button - - Button - - 145 - 600 - 0,00 - 150 - 50 - - - ButtonColor - - - ButtonSColor - - - 75 - 10 - - 27 - - 142 - - - ButtonTextColor - - - ButtonTextSColor - - Center - - Center - - - - Outline - - TR_BUTTON_BACK - - - - - - 10 - 26 - - - - - - 10 - 26 - - - - - Invisible - - SelectSlideArrowLeft - - SelectSlideArrowRight - - SelectSlide - - SelectSlideArrowLeft - - SelectSlideArrowRight - - SelectSlide - - 500 - 100 - 0,00 - 700 - 50 - - 505 - 105 - 0,00 - 40 - 40 - - 1170 - 105 - 0,00 - 40 - 40 - - - SelectSlideColor - - - SelectSlideSColor - - - SelectSlideHColor - - - ArrowColor - - - ArrowSColor - - - TextColor - - - TextSColor - - 27,00 - - 205,33 - - Outline - - Bold - - 9 - - - - Invisible - - SelectSlideArrowLeft - - SelectSlideArrowRight - - SelectSlide - - SelectSlideArrowLeft - - SelectSlideArrowRight - - SelectSlide - - 500 - 160 - 0,00 - 700 - 50 - - 505 - 165 - 0,00 - 40 - 40 - - 1170 - 165 - 0,00 - 40 - 40 - - - SelectSlideColor - - - SelectSlideSColor - - - SelectSlideHColor - - - ArrowColor - - - ArrowSColor - - - TextColor - - - TextSColor - - 27,00 - - 205,33 - - Outline - - Bold - - 2 - - - - Invisible - - SelectSlideArrowLeft - - SelectSlideArrowRight - - SelectSlide - - SelectSlideArrowLeft - - SelectSlideArrowRight - - SelectSlide - - 500 - 220 - 0,00 - 700 - 50 - - 505 - 225 - 0,00 - 40 - 40 - - 1170 - 225 - 0,00 - 40 - 40 - - - SelectSlideColor - - - SelectSlideSColor - - - SelectSlideHColor - - - ArrowColor - - - ArrowSColor - - - TextColor - - - TextSColor - - 27,00 - - 205,33 - - Outline - - Bold - - 10 - - - diff --git a/Output/PartyModes/Challenge/Screens/PartyScreenChallengeMain.xml b/Output/PartyModes/Challenge/Screens/PartyScreenChallengeMain.xml deleted file mode 100644 index 45a1eed7..00000000 --- a/Output/PartyModes/Challenge/Screens/PartyScreenChallengeMain.xml +++ /dev/null @@ -1,985 +0,0 @@ - - - - 1 - - - Video - - - - BG_Default - - - BackgroundColor - - - - Menu - - 40 - 40 - 0,00 - 1200 - 50 - - - StaticColor - - - - - - - PopupBG - - 0 - 0 - -1,00 - 1280 - 720 - - - StaticColor - - - - - - - Invisible - - 0 - 0 - 0,00 - 100 - 100 - - - StaticColor - - - - - - - 640 - 48 - - 0,00 - - 27 - - - - StaticColor - - - TextSColor - - Center - - Center - - - - Outline - - TR_SCREENMAIN_TITLE - - - - - - - 640 - 515 - - 0,00 - - 27 - - - - StaticColor - - - TextSColor - - Center - - Center - - - - Outline - - TR_SCREENMAIN_NEXT_PLAYER - - - - - - - 640 - 520 - - 0,00 - - 44 - - - - StaticColor - - - TextSColor - - Center - - Center - - - - Outline - - TR_SCREENMAIN_FINISH - - - - - - - 640 - 575 - - 0,00 - - 31 - - 770 - - - StaticColor - - - TextSColor - - Center - - Center - - - - Outline - - - - - - - - - 40 - 102 - - 0,00 - - 27 - - - - StaticColor - - - TextSColor - - Right - - Center - - - - Outline - - TR_SCREENMAIN_TABLE_POS - - - - - - - 50 - 102 - - 0,00 - - 27 - - 130 - - - StaticColor - - - TextSColor - - Left - - Center - - - - Outline - - TR_SCREENMAIN_TABLE_PLAYERNAME - - - - - - - 260 - 102 - - 0,00 - - 27 - - - - StaticColor - - - TextSColor - - Right - - Center - - - - Outline - - TR_SCREENMAIN_TABLE_NUMPLAYED - - - - - - - 340 - 102 - - 0,00 - - 27 - - - - StaticColor - - - TextSColor - - Right - - Center - - - - Outline - - TR_SCREENMAIN_TABLE_WON - - - - - - - 490 - 102 - - 0,00 - - 27 - - - - StaticColor - - - TextSColor - - Right - - Center - - - - Outline - - TR_SCREENMAIN_TABLE_SINGPOINTS - - - - - - - 590 - 102 - - 0,00 - - 27 - - - - StaticColor - - - TextSColor - - Right - - Center - - - - Outline - - TR_SCREENMAIN_TABLE_GAMEPOINTS - - - - - - - 0 - 0 - - 0,00 - - 27 - - 100 - - - StaticColor - - - TextSColor - - Center - - Center - - - - Outline - - - - - - - - - 0 - 0 - - 0,00 - - 27 - - - - StaticColor - - - TextSColor - - Center - - Center - - - - Outline - - - - - - - - - 660 - 102 - - 0,00 - - 27 - - - - StaticColor - - - TextSColor - - Right - - Center - - - - Outline - - - - - - - - - 0 - 0 - - 0,00 - - 27 - - - - StaticColor - - - TextSColor - - Center - - Center - - - - Outline - - - - - - - - - 640 - 265 - - -1,01 - - 27 - - 380 - - - StaticColor - - - TextSColor - - Center - - Center - - - - Outline - - TR_SCREENMAIN_POPUP_REALLYEXIT - - - - - - - Button - - Button - - 1030 - 600 - 0,00 - 150 - 50 - - - ButtonColor - - - ButtonSColor - - - 75 - 10 - - 27 - - 142 - - - ButtonTextColor - - - ButtonTextSColor - - Center - - Center - - - - Outline - - TR_BUTTON_NEXT_ROUND - - - - - - 10 - 26 - - - - - - 10 - 26 - - - - - Button - - Button - - 100 - 600 - 0,00 - 150 - 50 - - - ButtonColor - - - ButtonSColor - - - 75 - 10 - - 27 - - 142 - - - ButtonTextColor - - - ButtonTextSColor - - Center - - Center - - - - Outline - - TR_BUTTON_BACK - - - - - - 10 - 26 - - - - - - 10 - 26 - - - - - Button - - Button - - 100 - 600 - 0,00 - 150 - 50 - - - ButtonColor - - - ButtonSColor - - - 75 - 10 - - 27 - - 142 - - - ButtonTextColor - - - ButtonTextSColor - - Center - - Center - - - - Outline - - TR_BUTTON_EXIT - - - - - - 10 - 26 - - - - - - 10 - 26 - - - - - Button - - Button - - 665 - 360 - -1,01 - 150 - 50 - - - ButtonColor - - - ButtonSColor - - - 75 - 10 - - 27 - - 142 - - - ButtonTextColor - - - ButtonTextSColor - - Center - - Center - - - - Outline - - TR_BUTTON_YES - - - - - - 10 - 26 - - - - - - 10 - 26 - - - - - Button - - Button - - 465 - 360 - -1,01 - 150 - 50 - - - ButtonColor - - - ButtonSColor - - - 75 - 10 - - 27 - - 142 - - - ButtonTextColor - - - ButtonTextSColor - - Center - - Center - - - - Outline - - TR_BUTTON_NO - - - - - - 10 - 26 - - - - - - 10 - 26 - - - - - ScrollUp - - ScrollUp - - 281 - 94 - -0,01 - 28 - 15 - - - ButtonColor - - - ButtonSColor - - - 75 - 10 - - 27 - - 142 - - - ButtonTextColor - - - ButtonTextSColor - - Center - - Center - - - - Outline - - - - - - - - - - - - - ScrollDown - - ScrollDown - - 281 - 515 - -0,01 - 28 - 15 - - - ButtonColor - - - ButtonSColor - - - 75 - 10 - - 27 - - 142 - - - ButtonTextColor - - - ButtonTextSColor - - Center - - Center - - - - Outline - - - - - - - - - - - - - ScrollUp - - ScrollUp - - 954 - 94 - -0,01 - 28 - 15 - - - ButtonColor - - - ButtonSColor - - - 75 - 10 - - 27 - - 142 - - - ButtonTextColor - - - ButtonTextSColor - - Center - - Center - - - - Outline - - - - - - - - - - - - - ScrollDown - - ScrollDown - - 954 - 515 - -0,01 - 28 - 15 - - - ButtonColor - - - ButtonSColor - - - 75 - 10 - - 27 - - 142 - - - ButtonTextColor - - - ButtonTextSColor - - Center - - Center - - - - Outline - - - - - - - - - - - - diff --git a/Output/PartyModes/Challenge/Screens/PartyScreenChallengeNames.xml b/Output/PartyModes/Challenge/Screens/PartyScreenChallengeNames.xml deleted file mode 100644 index 1715fc94..00000000 --- a/Output/PartyModes/Challenge/Screens/PartyScreenChallengeNames.xml +++ /dev/null @@ -1,607 +0,0 @@ - - - - 1 - - - Video - - - - BG_Default - - - BackgroundColor - - - - Menu - - 40 - 40 - 0,00 - 1200 - 50 - - - StaticColor - - - - - - - 640 - 48 - - 0,00 - - 27 - - - - StaticColor - - - TextSColor - - Center - - Center - - - - Outline - - TR_SCREENNAMES_TITLE - - - - - - - Button - - Button - - 985 - 625 - 0,00 - 150 - 50 - - - ButtonColor - - - ButtonSColor - - - 75 - 10 - - 27 - - 142 - - - ButtonTextColor - - - ButtonTextSColor - - Center - - Center - - - - Outline - - TR_BUTTON_NEXT - - - - - - 10 - 26 - - - - - - 10 - 26 - - - - - Button - - Button - - 145 - 625 - 0,00 - 150 - 50 - - - ButtonColor - - - ButtonSColor - - - 75 - 10 - - 27 - - 142 - - - ButtonTextColor - - - ButtonTextSColor - - Center - - Center - - - - Outline - - TR_BUTTON_BACK - - - - - - 10 - 26 - - - - - - 10 - 26 - - - - - Button - - Button - - 565 - 625 - 0,00 - 150 - 50 - - - ButtonColor - - - ButtonSColor - - - 75 - 10 - - 27 - - 142 - - - ButtonTextColor - - - ButtonTextSColor - - Center - - Center - - - - Outline - - TR_SCREENNAMES_BUTTON_RANDOM - - - - - - 10 - 26 - - - - - - 10 - 26 - - - - - Plus - - Plus - - 145 - 1200 - 0,00 - 40 - 40 - - - ButtonColor - - - ButtonSColor - - - 75 - 10 - - 27 - - 142 - - - ButtonTextColor - - - ButtonTextSColor - - Center - - Center - - - - Outline - - - - - - - - - - - - - Minus - - Minus - - 145 - 1200 - 0,00 - 40 - 40 - - - ButtonColor - - - ButtonSColor - - - 75 - 10 - - 27 - - 142 - - - ButtonTextColor - - - ButtonTextSColor - - Center - - Center - - - - Outline - - - - - - - - - - - - - Plus - - Plus - - 145 - 1200 - 0,00 - 40 - 40 - - - ButtonColor - - - ButtonSColor - - - 75 - 10 - - 27 - - 142 - - - ButtonTextColor - - - ButtonTextSColor - - Center - - Center - - - - Outline - - - - - - - - - - - - - Minus - - Minus - - 145 - 1200 - 0,00 - 40 - 40 - - - ButtonColor - - - ButtonSColor - - - 75 - 10 - - 27 - - 142 - - - ButtonTextColor - - - ButtonTextSColor - - Center - - Center - - - - Outline - - - - - - - - - - - - - Invisible - - SelectSlideArrowLeft - - SelectSlideArrowRight - - SelectSlide - - SelectSlideArrowLeft - - SelectSlideArrowRight - - SelectSlide - - 40 - 100 - 0,00 - 1200 - 50 - - 45 - 105 - 0,00 - 40 - 40 - - 1170 - 105 - 0,00 - 40 - 40 - - - SelectSlideColor - - - SelectSlideSColor - - - SelectSlideHColor - - - ArrowColor - - - ArrowSColor - - - TextColor - - - TextSColor - - 27,00 - - - - 205,33 - - Outline - - Bold - - 2 - - - - Invisible - - SelectSlideArrowLeft - - SelectSlideArrowRight - - SelectSlidePlayer - - SelectSlideArrowLeft - - SelectSlideArrowRight - - SelectSlidePlayer - - 40 - 160 - 0,00 - 1200 - 150 - - 45 - 210 - 0,00 - 40 - 40 - - 1170 - 210 - 0,00 - 40 - 40 - - - SelectSlideColor - - - SelectSlideSColor - - - SelectSlideHColor - - - ArrowColor - - - ArrowSColor - - - TextColor - - - TextSColor - - 27,00 - - - -5,00 - - 205,33 - - Outline - - Bold - - 8 - - - - 42 - 327 - 0,00 - 1200 - 393 - - CoverTile - - - 1,00 - 1,00 - 1,00 - 0,20 - - PlayerSelector - - - - 100 - 100 - - 10 - 2 - - 20,71 - 30,00 - - - - 2,0 - - Outline - - TextColor - - - - 17 - - - - - diff --git a/Output/PartyModes/Challenge/Textures/Button.png b/Output/PartyModes/Challenge/Textures/Button.png deleted file mode 100644 index 58685b3e..00000000 Binary files a/Output/PartyModes/Challenge/Textures/Button.png and /dev/null differ diff --git a/Output/PartyModes/Challenge/Textures/CoverTile.png b/Output/PartyModes/Challenge/Textures/CoverTile.png deleted file mode 100644 index 7db093e7..00000000 Binary files a/Output/PartyModes/Challenge/Textures/CoverTile.png and /dev/null differ diff --git a/Output/PartyModes/Challenge/Textures/Invisible.png b/Output/PartyModes/Challenge/Textures/Invisible.png deleted file mode 100644 index b2ff36e9..00000000 Binary files a/Output/PartyModes/Challenge/Textures/Invisible.png and /dev/null differ diff --git a/Output/PartyModes/Challenge/Textures/Menu.png b/Output/PartyModes/Challenge/Textures/Menu.png deleted file mode 100644 index 25fc125e..00000000 Binary files a/Output/PartyModes/Challenge/Textures/Menu.png and /dev/null differ diff --git a/Output/PartyModes/Challenge/Textures/Minus.png b/Output/PartyModes/Challenge/Textures/Minus.png deleted file mode 100644 index 9bdede57..00000000 Binary files a/Output/PartyModes/Challenge/Textures/Minus.png and /dev/null differ diff --git a/Output/PartyModes/Challenge/Textures/PlayerSelector.png b/Output/PartyModes/Challenge/Textures/PlayerSelector.png deleted file mode 100644 index c57ab300..00000000 Binary files a/Output/PartyModes/Challenge/Textures/PlayerSelector.png and /dev/null differ diff --git a/Output/PartyModes/Challenge/Textures/Plus.png b/Output/PartyModes/Challenge/Textures/Plus.png deleted file mode 100644 index 5b813c53..00000000 Binary files a/Output/PartyModes/Challenge/Textures/Plus.png and /dev/null differ diff --git a/Output/PartyModes/Challenge/Textures/Popup.png b/Output/PartyModes/Challenge/Textures/Popup.png deleted file mode 100644 index 80868001..00000000 Binary files a/Output/PartyModes/Challenge/Textures/Popup.png and /dev/null differ diff --git a/Output/PartyModes/Challenge/Textures/ScrollDown.png b/Output/PartyModes/Challenge/Textures/ScrollDown.png deleted file mode 100644 index 94bd2e14..00000000 Binary files a/Output/PartyModes/Challenge/Textures/ScrollDown.png and /dev/null differ diff --git a/Output/PartyModes/Challenge/Textures/ScrollUp.png b/Output/PartyModes/Challenge/Textures/ScrollUp.png deleted file mode 100644 index c3b4c6b9..00000000 Binary files a/Output/PartyModes/Challenge/Textures/ScrollUp.png and /dev/null differ diff --git a/Output/PartyModes/Challenge/Textures/SelectSlide.png b/Output/PartyModes/Challenge/Textures/SelectSlide.png deleted file mode 100644 index 46b86a23..00000000 Binary files a/Output/PartyModes/Challenge/Textures/SelectSlide.png and /dev/null differ diff --git a/Output/PartyModes/Challenge/Textures/SelectSlideArrowLeft.png b/Output/PartyModes/Challenge/Textures/SelectSlideArrowLeft.png deleted file mode 100644 index 313fe280..00000000 Binary files a/Output/PartyModes/Challenge/Textures/SelectSlideArrowLeft.png and /dev/null differ diff --git a/Output/PartyModes/Challenge/Textures/SelectSlideArrowRight.png b/Output/PartyModes/Challenge/Textures/SelectSlideArrowRight.png deleted file mode 100644 index 7dfd68c0..00000000 Binary files a/Output/PartyModes/Challenge/Textures/SelectSlideArrowRight.png and /dev/null differ diff --git a/Output/PartyModes/Challenge/Textures/SelectSlidePlayer.png b/Output/PartyModes/Challenge/Textures/SelectSlidePlayer.png deleted file mode 100644 index 4fb9a6df..00000000 Binary files a/Output/PartyModes/Challenge/Textures/SelectSlidePlayer.png and /dev/null differ diff --git a/Output/PartyModes/Challenge/Textures/Skin.xml b/Output/PartyModes/Challenge/Textures/Skin.xml deleted file mode 100644 index b2ea588c..00000000 --- a/Output/PartyModes/Challenge/Textures/Skin.xml +++ /dev/null @@ -1,158 +0,0 @@ - - - 3 - - Blue - brunzel - 0 - 1 - - - - 0,000 - 0,000 - 0,750 - 1,000 - - - 0,675 - 0,890 - 0,969 - 1,000 - - - 0,675 - 0,890 - 0,969 - 0,500 - - - 0,675 - 0,890 - 0,969 - 1,000 - - - 0,675 - 0,890 - 0,969 - 0,300 - - - 0,675 - 0,890 - 0,969 - 1,000 - - - 0,675 - 0,890 - 0,969 - 0,500 - - - 0,675 - 0,890 - 0,969 - 1,000 - - - 0,675 - 0,890 - 0,969 - 1,000 - - - 0,675 - 0,890 - 0,969 - 0,500 - - - 0,675 - 0,890 - 0,969 - 1,000 - - - 0,675 - 0,890 - 0,969 - 0,500 - - - 0,675 - 0,890 - 0,969 - 0,300 - - - 0,675 - 0,890 - 0,969 - 1,000 - - - 0,675 - 0,890 - 0,969 - 0,500 - - - 0,675 - 0,890 - 0,969 - 1,000 - - - 1,000 - 0,000 - 0,000 - 1,000 - - - 0,000 - 0,000 - 0,000 - 1,000 - - - 0,000 - 0,000 - 0,000 - 1,000 - - - 1,000 - 1,000 - 1,000 - 1,000 - - - 1,000 - 1,000 - 1,000 - 0,000 - - - - [Blue]BG_Default.png - Menu.png - - CoverTile.png - SelectSlide.png - SelectSlidePlayer.png - SelectSlideArrowLeft.png - SelectSlideArrowRight.png - Popup.png - ScrollUp.png - ScrollDown.png - Invisible.png - PlayerSelector.png - Plus.png - Minus.png - - - [Blue]BG_Video.mp4 - - diff --git a/Output/PartyModes/Challenge/Textures/[Blue]BG_Default.png b/Output/PartyModes/Challenge/Textures/[Blue]BG_Default.png deleted file mode 100644 index 53bd3603..00000000 Binary files a/Output/PartyModes/Challenge/Textures/[Blue]BG_Default.png and /dev/null differ diff --git a/Output/PartyModes/Challenge/Textures/[Blue]BG_Video.mp4 b/Output/PartyModes/Challenge/Textures/[Blue]BG_Video.mp4 deleted file mode 100644 index c4fc7b24..00000000 Binary files a/Output/PartyModes/Challenge/Textures/[Blue]BG_Video.mp4 and /dev/null differ diff --git a/Output/PartyModes/Challenge/Theme.xml b/Output/PartyModes/Challenge/Theme.xml deleted file mode 100644 index 7a106892..00000000 --- a/Output/PartyModes/Challenge/Theme.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - 5 - - Ambient - brunzel - Textures - 0 - 1 - - \ No newline at end of file diff --git a/Output/PartyModes/Challenge/Themes/Default.xml b/Output/PartyModes/Challenge/Themes/Default.xml new file mode 100644 index 00000000..5999e8cc --- /dev/null +++ b/Output/PartyModes/Challenge/Themes/Default.xml @@ -0,0 +1,10 @@ + + + 5 + + Default + brunzel + 0 + 1 + + \ No newline at end of file diff --git a/Output/PartyModes/Challenge/Themes/Default/Default.xml b/Output/PartyModes/Challenge/Themes/Default/Default.xml new file mode 100644 index 00000000..f4299579 --- /dev/null +++ b/Output/PartyModes/Challenge/Themes/Default/Default.xml @@ -0,0 +1,16 @@ + + + 4 + + Default + brunzel + 0 + 1 + + + + + + + + diff --git a/Output/PartyModes/Challenge/Themes/Default/Screens/PartyScreenChallengeConfig.xml b/Output/PartyModes/Challenge/Themes/Default/Screens/PartyScreenChallengeConfig.xml new file mode 100644 index 00000000..da365e48 --- /dev/null +++ b/Output/PartyModes/Challenge/Themes/Default/Screens/PartyScreenChallengeConfig.xml @@ -0,0 +1,295 @@ + + + + PartyScreenChallengeConfig + 1 + + + + Video + + + BG_Default + + + + + + Menu + + + 40 + 40 + 1200 + 50 + 0 + + + + + + 640 + 48 + 0 + 27 + 0 + + + Center + Center + + Outline + TR_SCREENCONFIG_TITLE + + + 75 + 105 + 0 + 27 + 0 + + + Left + Center + + Outline + TR_SCREENCONFIG_NUMPLAYERS + + + 75 + 165 + 0 + 27 + 0 + + + Left + Center + + Outline + TR_SCREENCONFIG_NUMMICS + + + 75 + 225 + 0 + 27 + 0 + + + Left + Center + + Outline + TR_SCREENCONFIG_NUMROUNDS + + + + + + + + + + + + SelectSlideArrowLeft + SelectSlideArrowRight + SelectSlide + SelectSlideArrowLeft + SelectSlideArrowRight + + 500 + 100 + 700 + 50 + 0 + + + 505 + 105 + 40 + 40 + 0 + + + 1170 + 105 + 40 + 40 + 0 + + + + + + + + 27 + 0 + 0 + 205.33 + Outline + Bold + 9 + + + + SelectSlideArrowLeft + SelectSlideArrowRight + SelectSlide + SelectSlideArrowLeft + SelectSlideArrowRight + + 500 + 160 + 700 + 50 + 0 + + + 505 + 165 + 40 + 40 + 0 + + + 1170 + 165 + 40 + 40 + 0 + + + + + + + + 27 + 0 + 0 + 205.33 + Outline + Bold + 2 + + + + SelectSlideArrowLeft + SelectSlideArrowRight + SelectSlide + SelectSlideArrowLeft + SelectSlideArrowRight + + 500 + 220 + 700 + 50 + 0 + + + 505 + 225 + 40 + 40 + 0 + + + 1170 + 225 + 40 + 40 + 0 + + + + + + + + 27 + 0 + 0 + 205.33 + Outline + Bold + 10 + + + + + + + + + \ No newline at end of file diff --git a/Output/PartyModes/Challenge/Themes/Default/Screens/PartyScreenChallengeMain.xml b/Output/PartyModes/Challenge/Themes/Default/Screens/PartyScreenChallengeMain.xml new file mode 100644 index 00000000..3edf6ca5 --- /dev/null +++ b/Output/PartyModes/Challenge/Themes/Default/Screens/PartyScreenChallengeMain.xml @@ -0,0 +1,557 @@ + + + + PartyScreenChallengeMain + 1 + + + + Video + + + BG_Default + + + + + + Menu + + + 40 + 40 + 1200 + 50 + 0 + + + + PopupBG + + + 0 + 0 + 1280 + 720 + -1 + + + + + + + 0 + 0 + 100 + 100 + 0 + + + + + + 640 + 48 + 0 + 27 + 0 + + + Center + Center + + Outline + TR_SCREENMAIN_TITLE + + + 40 + 102 + 0 + 27 + 0 + + + Right + Center + + Outline + TR_SCREENMAIN_TABLE_POS + + + 50 + 102 + 0 + 27 + 130 + + + Left + Center + + Outline + TR_SCREENMAIN_TABLE_PLAYERNAME + + + 260 + 102 + 0 + 27 + 0 + + + Right + Center + + Outline + TR_SCREENMAIN_TABLE_NUMPLAYED + + + 340 + 102 + 0 + 27 + 0 + + + Right + Center + + Outline + TR_SCREENMAIN_TABLE_WON + + + 490 + 102 + 0 + 27 + 0 + + + Right + Center + + Outline + TR_SCREENMAIN_TABLE_SINGPOINTS + + + 590 + 102 + 0 + 27 + 0 + + + Right + Center + + Outline + TR_SCREENMAIN_TABLE_GAMEPOINTS + + + 0 + 0 + 0 + 27 + 100 + + + Center + Center + + Outline + + + + 640 + 265 + -1.01 + 27 + 380 + + + Center + Center + + Outline + TR_SCREENMAIN_POPUP_REALLYEXIT + + + 660 + 102 + 0 + 27 + 0 + + + Right + Center + + Outline + 1) + + + 0 + 0 + 0 + 27 + 0 + + + Center + Center + + Outline + + + + 0 + 0 + 0 + 27 + 0 + + + Center + Center + + Outline + + + + 640 + 520 + 0 + 44 + 0 + + + Center + Center + + Outline + TR_SCREENMAIN_FINISH + + + 640 + 575 + 0 + 31 + 770 + + + Center + Center + + Outline + + + + 640 + 515 + 0 + 27 + 0 + + + Center + Center + + Outline + TR_SCREENMAIN_NEXT_PLAYER + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Output/PartyModes/Challenge/Themes/Default/Screens/PartyScreenChallengeNames.xml b/Output/PartyModes/Challenge/Themes/Default/Screens/PartyScreenChallengeNames.xml new file mode 100644 index 00000000..a3bd1919 --- /dev/null +++ b/Output/PartyModes/Challenge/Themes/Default/Screens/PartyScreenChallengeNames.xml @@ -0,0 +1,387 @@ + + + + PartyScreenChallengeNames + 1 + + + + Video + + + BG_Default + + + + + + Menu + + + 40 + 40 + 1200 + 50 + 0 + + + + + + 640 + 48 + 0 + 27 + 0 + + + Center + Center + + Outline + TR_SCREENNAMES_TITLE + + + + + + + + + + + + + + + + + SelectSlideArrowLeft + SelectSlideArrowRight + SelectSlide + SelectSlideArrowLeft + SelectSlideArrowRight + + 40 + 100 + 1200 + 50 + 0 + + + 45 + 105 + 40 + 40 + 0 + + + 1170 + 105 + 40 + 40 + 0 + + + + + + + + 27 + 0 + 0 + 205.33 + Outline + Bold + 2 + + + + SelectSlideArrowLeft + SelectSlideArrowRight + SelectSlidePlayer + SelectSlideArrowLeft + SelectSlideArrowRight + + 40 + 160 + 1200 + 150 + 0 + + + 45 + 210 + 40 + 40 + 0 + + + 1170 + 210 + 40 + 40 + 0 + + + + + + + + 27 + 0 + -5 + 205.33 + Outline + Bold + 8 + + + + + + + 42 + 327 + 1200 + 393 + 0 + + CoverTile + + 1 + 1 + 1 + 0.2 + + PlayerSelector + + 100 + 100 + 10 + 2 + 20.71 + 30 + + 2 + 17 + Outline + + + + + + + + + + + \ No newline at end of file diff --git a/Output/PartyModes/ChallengeMedley/Languages/Italian.xml b/Output/PartyModes/ChallengeMedley/Languages/Italian.xml index 7247406d..b3beee0e 100644 --- a/Output/PartyModes/ChallengeMedley/Languages/Italian.xml +++ b/Output/PartyModes/ChallengeMedley/Languages/Italian.xml @@ -1,16 +1,30 @@ Italiano + Sfida in Modalità Medley + Gioca alcuni turni di sfida usando solo un gruppo di 5 canzoni come Medley. + Per tutti quelli interessati a scontrarsi con duelli di Medley. Prossimo Indietro Inizia Esci Si No + Prossimo Turno + Sfida in Modalità Medley: Configurazione + Numero di giocatori + Numero di microfoni + Numero di Turni + Sfida in Modalità Medley: Scegli il Giocatore Selezione casuale + Sfida in Modalità Medley: Panoramica Pos Nome + Turni Vittorie + Punti Canto Punteggio Vuoi davvero uscire? + Giocatore del prossimo turno: + Tutti i turni di canto completati! E il vincitore è... diff --git a/Output/PartyModes/ChallengeMedley/Screens/PartyScreenChallengeMedleyConfig.xml b/Output/PartyModes/ChallengeMedley/Screens/PartyScreenChallengeMedleyConfig.xml deleted file mode 100644 index 31c764e5..00000000 --- a/Output/PartyModes/ChallengeMedley/Screens/PartyScreenChallengeMedleyConfig.xml +++ /dev/null @@ -1,458 +0,0 @@ - - - - 1 - - - Video - - - - BG_Default - - - BackgroundColor - - - - Menu - - 40 - 40 - 0,00 - 1200 - 50 - - - StaticColor - - - - - - - 640 - 48 - - 0,00 - - 27 - - - - StaticColor - - - TextSColor - - Center - - Center - - - - Outline - - TR_SCREENCONFIG_TITLE - - - - - - - 75 - 105 - - 0,00 - - 27 - - - - StaticColor - - - TextSColor - - Left - - Center - - - - Outline - - TR_SCREENCONFIG_NUMPLAYERS - - - - - - - 75 - 165 - - 0,00 - - 27 - - - - StaticColor - - - TextSColor - - Left - - Center - - - - Outline - - TR_SCREENCONFIG_NUMMICS - - - - - - - 75 - 225 - - 0,00 - - 27 - - - - StaticColor - - - TextSColor - - Left - - Center - - - - Outline - - TR_SCREENCONFIG_NUMROUNDS - - - - - - - Button - - Button - - 985 - 600 - 0,00 - 150 - 50 - - - ButtonColor - - - ButtonSColor - - - 75 - 10 - - 27 - - 142 - - - ButtonTextColor - - - ButtonTextSColor - - Center - - Center - - - - Outline - - TR_BUTTON_NEXT - - - - - - 10 - 26 - - - - - - 10 - 26 - - - - - Button - - Button - - 145 - 600 - 0,00 - 150 - 50 - - - ButtonColor - - - ButtonSColor - - - 75 - 10 - - 27 - - 142 - - - ButtonTextColor - - - ButtonTextSColor - - Center - - Center - - - - Outline - - TR_BUTTON_BACK - - - - - - 10 - 26 - - - - - - 10 - 26 - - - - - Invisible - - SelectSlideArrowLeft - - SelectSlideArrowRight - - SelectSlide - - SelectSlideArrowLeft - - SelectSlideArrowRight - - SelectSlide - - 500 - 100 - 0,00 - 700 - 50 - - 505 - 105 - 0,00 - 40 - 40 - - 1170 - 105 - 0,00 - 40 - 40 - - - SelectSlideColor - - - SelectSlideSColor - - - SelectSlideHColor - - - ArrowColor - - - ArrowSColor - - - TextColor - - - TextSColor - - 27,00 - - 205,33 - - Outline - - Bold - - 9 - - - - Invisible - - SelectSlideArrowLeft - - SelectSlideArrowRight - - SelectSlide - - SelectSlideArrowLeft - - SelectSlideArrowRight - - SelectSlide - - 500 - 160 - 0,00 - 700 - 50 - - 505 - 165 - 0,00 - 40 - 40 - - 1170 - 165 - 0,00 - 40 - 40 - - - SelectSlideColor - - - SelectSlideSColor - - - SelectSlideHColor - - - ArrowColor - - - ArrowSColor - - - TextColor - - - TextSColor - - 27,00 - - 205,33 - - Outline - - Bold - - 2 - - - - Invisible - - SelectSlideArrowLeft - - SelectSlideArrowRight - - SelectSlide - - SelectSlideArrowLeft - - SelectSlideArrowRight - - SelectSlide - - 500 - 220 - 0,00 - 700 - 50 - - 505 - 225 - 0,00 - 40 - 40 - - 1170 - 225 - 0,00 - 40 - 40 - - - SelectSlideColor - - - SelectSlideSColor - - - SelectSlideHColor - - - ArrowColor - - - ArrowSColor - - - TextColor - - - TextSColor - - 27,00 - - 205,33 - - Outline - - Bold - - 10 - - - diff --git a/Output/PartyModes/ChallengeMedley/Screens/PartyScreenChallengeMedleyMain.xml b/Output/PartyModes/ChallengeMedley/Screens/PartyScreenChallengeMedleyMain.xml deleted file mode 100644 index ca6ca079..00000000 --- a/Output/PartyModes/ChallengeMedley/Screens/PartyScreenChallengeMedleyMain.xml +++ /dev/null @@ -1,985 +0,0 @@ - - - - 1 - - - Video - - - - BG_Default - - - BackgroundColor - - - - Menu - - 40 - 40 - 0,00 - 1200 - 50 - - - StaticColor - - - - - - - PopupBG - - 0 - 0 - -1,00 - 1280 - 720 - - - StaticColor - - - - - - - Invisible - - 0 - 0 - 0,00 - 100 - 100 - - - StaticColor - - - - - - - 640 - 48 - - 0,00 - - 27 - - - - StaticColor - - - TextSColor - - Center - - Center - - - - Outline - - TR_SCREENMAIN_TITLE - - - - - - - 640 - 515 - - 0,00 - - 27 - - - - StaticColor - - - TextSColor - - Center - - Center - - - - Outline - - TR_SCREENMAIN_NEXT_PLAYER - - - - - - - 640 - 520 - - 0,00 - - 44 - - - - StaticColor - - - TextSColor - - Center - - Center - - - - Outline - - TR_SCREENMAIN_FINISH - - - - - - - 640 - 575 - - 0,00 - - 31 - - 770 - - - StaticColor - - - TextSColor - - Center - - Center - - - - Outline - - - - - - - - - 40 - 102 - - 0,00 - - 27 - - - - StaticColor - - - TextSColor - - Right - - Center - - - - Outline - - TR_SCREENMAIN_TABLE_POS - - - - - - - 50 - 102 - - 0,00 - - 27 - - 130 - - - StaticColor - - - TextSColor - - Left - - Center - - - - Outline - - TR_SCREENMAIN_TABLE_PLAYERNAME - - - - - - - 260 - 102 - - 0,00 - - 27 - - - - StaticColor - - - TextSColor - - Right - - Center - - - - Outline - - TR_SCREENMAIN_TABLE_NUMPLAYED - - - - - - - 340 - 102 - - 0,00 - - 27 - - - - StaticColor - - - TextSColor - - Right - - Center - - - - Outline - - TR_SCREENMAIN_TABLE_WON - - - - - - - 490 - 102 - - 0,00 - - 27 - - - - StaticColor - - - TextSColor - - Right - - Center - - - - Outline - - TR_SCREENMAIN_TABLE_SINGPOINTS - - - - - - - 590 - 102 - - 0,00 - - 27 - - - - StaticColor - - - TextSColor - - Right - - Center - - - - Outline - - TR_SCREENMAIN_TABLE_GAMEPOINTS - - - - - - - 0 - 0 - - 0,00 - - 27 - - 100 - - - StaticColor - - - TextSColor - - Center - - Center - - - - Outline - - - - - - - - - 0 - 0 - - 0,00 - - 27 - - - - StaticColor - - - TextSColor - - Center - - Center - - - - Outline - - - - - - - - - 660 - 102 - - 0,00 - - 27 - - - - StaticColor - - - TextSColor - - Right - - Center - - - - Outline - - - - - - - - - 0 - 0 - - 0,00 - - 27 - - - - StaticColor - - - TextSColor - - Center - - Center - - - - Outline - - - - - - - - - 640 - 265 - - -1,01 - - 27 - - 380 - - - StaticColor - - - TextSColor - - Center - - Center - - - - Outline - - TR_SCREENMAIN_POPUP_REALLYEXIT - - - - - - - Button - - Button - - 1030 - 600 - 0,00 - 150 - 50 - - - ButtonColor - - - ButtonSColor - - - 75 - 10 - - 27 - - 142 - - - ButtonTextColor - - - ButtonTextSColor - - Center - - Center - - - - Outline - - TR_BUTTON_NEXT_ROUND - - - - - - 10 - 26 - - - - - - 10 - 26 - - - - - Button - - Button - - 100 - 600 - 0,00 - 150 - 50 - - - ButtonColor - - - ButtonSColor - - - 75 - 10 - - 27 - - 142 - - - ButtonTextColor - - - ButtonTextSColor - - Center - - Center - - - - Outline - - TR_BUTTON_BACK - - - - - - 10 - 26 - - - - - - 10 - 26 - - - - - Button - - Button - - 100 - 600 - 0,00 - 150 - 50 - - - ButtonColor - - - ButtonSColor - - - 75 - 10 - - 27 - - 142 - - - ButtonTextColor - - - ButtonTextSColor - - Center - - Center - - - - Outline - - TR_BUTTON_EXIT - - - - - - 10 - 26 - - - - - - 10 - 26 - - - - - Button - - Button - - 665 - 360 - -1,01 - 150 - 50 - - - ButtonColor - - - ButtonSColor - - - 75 - 10 - - 27 - - 142 - - - ButtonTextColor - - - ButtonTextSColor - - Center - - Center - - - - Outline - - TR_BUTTON_YES - - - - - - 10 - 26 - - - - - - 10 - 26 - - - - - Button - - Button - - 465 - 360 - -1,01 - 150 - 50 - - - ButtonColor - - - ButtonSColor - - - 75 - 10 - - 27 - - 142 - - - ButtonTextColor - - - ButtonTextSColor - - Center - - Center - - - - Outline - - TR_BUTTON_NO - - - - - - 10 - 26 - - - - - - 10 - 26 - - - - - ScrollUp - - ScrollUp - - 281 - 94 - -0,01 - 28 - 15 - - - ButtonColor - - - ButtonSColor - - - 75 - 10 - - 27 - - 142 - - - ButtonTextColor - - - ButtonTextSColor - - Center - - Center - - - - Outline - - - - - - - - - - - - - ScrollDown - - ScrollDown - - 281 - 515 - -0,01 - 28 - 15 - - - ButtonColor - - - ButtonSColor - - - 75 - 10 - - 27 - - 142 - - - ButtonTextColor - - - ButtonTextSColor - - Center - - Center - - - - Outline - - - - - - - - - - - - - ScrollUp - - ScrollUp - - 954 - 94 - -0,01 - 28 - 15 - - - ButtonColor - - - ButtonSColor - - - 75 - 10 - - 27 - - 142 - - - ButtonTextColor - - - ButtonTextSColor - - Center - - Center - - - - Outline - - - - - - - - - - - - - ScrollDown - - ScrollDown - - 954 - 515 - -0,01 - 28 - 15 - - - ButtonColor - - - ButtonSColor - - - 75 - 10 - - 27 - - 142 - - - ButtonTextColor - - - ButtonTextSColor - - Center - - Center - - - - Outline - - - - - - - - - - - - diff --git a/Output/PartyModes/ChallengeMedley/Screens/PartyScreenChallengeMedleyNames.xml b/Output/PartyModes/ChallengeMedley/Screens/PartyScreenChallengeMedleyNames.xml deleted file mode 100644 index e6236e97..00000000 --- a/Output/PartyModes/ChallengeMedley/Screens/PartyScreenChallengeMedleyNames.xml +++ /dev/null @@ -1,607 +0,0 @@ - - - - 1 - - - Video - - - - BG_Default - - - BackgroundColor - - - - Menu - - 40 - 40 - 0,00 - 1200 - 50 - - - StaticColor - - - - - - - 640 - 48 - - 0,00 - - 27 - - - - StaticColor - - - TextSColor - - Center - - Center - - - - Outline - - TR_SCREENNAMES_TITLE - - - - - - - Button - - Button - - 985 - 625 - 0,00 - 150 - 50 - - - ButtonColor - - - ButtonSColor - - - 75 - 10 - - 27 - - 142 - - - ButtonTextColor - - - ButtonTextSColor - - Center - - Center - - - - Outline - - TR_BUTTON_NEXT - - - - - - 10 - 26 - - - - - - 10 - 26 - - - - - Button - - Button - - 145 - 625 - 0,00 - 150 - 50 - - - ButtonColor - - - ButtonSColor - - - 75 - 10 - - 27 - - 142 - - - ButtonTextColor - - - ButtonTextSColor - - Center - - Center - - - - Outline - - TR_BUTTON_BACK - - - - - - 10 - 26 - - - - - - 10 - 26 - - - - - Button - - Button - - 565 - 625 - 0,00 - 150 - 50 - - - ButtonColor - - - ButtonSColor - - - 75 - 10 - - 27 - - 142 - - - ButtonTextColor - - - ButtonTextSColor - - Center - - Center - - - - Outline - - TR_SCREENNAMES_BUTTON_RANDOM - - - - - - 10 - 26 - - - - - - 10 - 26 - - - - - Plus - - Plus - - 145 - 1200 - 0,00 - 40 - 40 - - - ButtonColor - - - ButtonSColor - - - 75 - 10 - - 27 - - 142 - - - ButtonTextColor - - - ButtonTextSColor - - Center - - Center - - - - Outline - - - - - - - - - - - - - Minus - - Minus - - 145 - 1200 - 0,00 - 40 - 40 - - - ButtonColor - - - ButtonSColor - - - 75 - 10 - - 27 - - 142 - - - ButtonTextColor - - - ButtonTextSColor - - Center - - Center - - - - Outline - - - - - - - - - - - - - Plus - - Plus - - 145 - 1200 - 0,00 - 40 - 40 - - - ButtonColor - - - ButtonSColor - - - 75 - 10 - - 27 - - 142 - - - ButtonTextColor - - - ButtonTextSColor - - Center - - Center - - - - Outline - - - - - - - - - - - - - Minus - - Minus - - 145 - 1200 - 0,00 - 40 - 40 - - - ButtonColor - - - ButtonSColor - - - 75 - 10 - - 27 - - 142 - - - ButtonTextColor - - - ButtonTextSColor - - Center - - Center - - - - Outline - - - - - - - - - - - - - Invisible - - SelectSlideArrowLeft - - SelectSlideArrowRight - - SelectSlide - - SelectSlideArrowLeft - - SelectSlideArrowRight - - SelectSlide - - 40 - 100 - 0,00 - 1200 - 50 - - 45 - 105 - 0,00 - 40 - 40 - - 1170 - 105 - 0,00 - 40 - 40 - - - SelectSlideColor - - - SelectSlideSColor - - - SelectSlideHColor - - - ArrowColor - - - ArrowSColor - - - TextColor - - - TextSColor - - 27,00 - - - - 205,33 - - Outline - - Bold - - 2 - - - - Invisible - - SelectSlideArrowLeft - - SelectSlideArrowRight - - SelectSlidePlayer - - SelectSlideArrowLeft - - SelectSlideArrowRight - - SelectSlidePlayer - - 40 - 160 - 0,00 - 1200 - 150 - - 45 - 210 - 0,00 - 40 - 40 - - 1170 - 210 - 0,00 - 40 - 40 - - - SelectSlideColor - - - SelectSlideSColor - - - SelectSlideHColor - - - ArrowColor - - - ArrowSColor - - - TextColor - - - TextSColor - - 27,00 - - - -5,00 - - 205,33 - - Outline - - Bold - - 8 - - - - 42 - 327 - 0,00 - 1200 - 393 - - CoverTile - - - 1,00 - 1,00 - 1,00 - 0,20 - - PlayerSelector - - - - 100 - 100 - - 10 - 2 - - 20,71 - 30,00 - - - - 2,0 - - Outline - - TextColor - - - - 17 - - - - - diff --git a/Output/PartyModes/ChallengeMedley/Textures/Button.png b/Output/PartyModes/ChallengeMedley/Textures/Button.png deleted file mode 100644 index 58685b3e..00000000 Binary files a/Output/PartyModes/ChallengeMedley/Textures/Button.png and /dev/null differ diff --git a/Output/PartyModes/ChallengeMedley/Textures/CoverTile.png b/Output/PartyModes/ChallengeMedley/Textures/CoverTile.png deleted file mode 100644 index 7db093e7..00000000 Binary files a/Output/PartyModes/ChallengeMedley/Textures/CoverTile.png and /dev/null differ diff --git a/Output/PartyModes/ChallengeMedley/Textures/Invisible.png b/Output/PartyModes/ChallengeMedley/Textures/Invisible.png deleted file mode 100644 index b2ff36e9..00000000 Binary files a/Output/PartyModes/ChallengeMedley/Textures/Invisible.png and /dev/null differ diff --git a/Output/PartyModes/ChallengeMedley/Textures/Menu.png b/Output/PartyModes/ChallengeMedley/Textures/Menu.png deleted file mode 100644 index 25fc125e..00000000 Binary files a/Output/PartyModes/ChallengeMedley/Textures/Menu.png and /dev/null differ diff --git a/Output/PartyModes/ChallengeMedley/Textures/Minus.png b/Output/PartyModes/ChallengeMedley/Textures/Minus.png deleted file mode 100644 index 9bdede57..00000000 Binary files a/Output/PartyModes/ChallengeMedley/Textures/Minus.png and /dev/null differ diff --git a/Output/PartyModes/ChallengeMedley/Textures/Plus.png b/Output/PartyModes/ChallengeMedley/Textures/Plus.png deleted file mode 100644 index 5b813c53..00000000 Binary files a/Output/PartyModes/ChallengeMedley/Textures/Plus.png and /dev/null differ diff --git a/Output/PartyModes/ChallengeMedley/Textures/Popup.png b/Output/PartyModes/ChallengeMedley/Textures/Popup.png deleted file mode 100644 index 80868001..00000000 Binary files a/Output/PartyModes/ChallengeMedley/Textures/Popup.png and /dev/null differ diff --git a/Output/PartyModes/ChallengeMedley/Textures/ScrollDown.png b/Output/PartyModes/ChallengeMedley/Textures/ScrollDown.png deleted file mode 100644 index 94bd2e14..00000000 Binary files a/Output/PartyModes/ChallengeMedley/Textures/ScrollDown.png and /dev/null differ diff --git a/Output/PartyModes/ChallengeMedley/Textures/ScrollUp.png b/Output/PartyModes/ChallengeMedley/Textures/ScrollUp.png deleted file mode 100644 index c3b4c6b9..00000000 Binary files a/Output/PartyModes/ChallengeMedley/Textures/ScrollUp.png and /dev/null differ diff --git a/Output/PartyModes/ChallengeMedley/Textures/SelectSlide.png b/Output/PartyModes/ChallengeMedley/Textures/SelectSlide.png deleted file mode 100644 index 46b86a23..00000000 Binary files a/Output/PartyModes/ChallengeMedley/Textures/SelectSlide.png and /dev/null differ diff --git a/Output/PartyModes/ChallengeMedley/Textures/SelectSlideArrowLeft.png b/Output/PartyModes/ChallengeMedley/Textures/SelectSlideArrowLeft.png deleted file mode 100644 index 313fe280..00000000 Binary files a/Output/PartyModes/ChallengeMedley/Textures/SelectSlideArrowLeft.png and /dev/null differ diff --git a/Output/PartyModes/ChallengeMedley/Textures/SelectSlideArrowRight.png b/Output/PartyModes/ChallengeMedley/Textures/SelectSlideArrowRight.png deleted file mode 100644 index 7dfd68c0..00000000 Binary files a/Output/PartyModes/ChallengeMedley/Textures/SelectSlideArrowRight.png and /dev/null differ diff --git a/Output/PartyModes/ChallengeMedley/Textures/SelectSlidePlayer.png b/Output/PartyModes/ChallengeMedley/Textures/SelectSlidePlayer.png deleted file mode 100644 index 4fb9a6df..00000000 Binary files a/Output/PartyModes/ChallengeMedley/Textures/SelectSlidePlayer.png and /dev/null differ diff --git a/Output/PartyModes/ChallengeMedley/Textures/Skin.xml b/Output/PartyModes/ChallengeMedley/Textures/Skin.xml deleted file mode 100644 index e89952f1..00000000 --- a/Output/PartyModes/ChallengeMedley/Textures/Skin.xml +++ /dev/null @@ -1,157 +0,0 @@ - - - 3 - - Blue - brunzel - 0 - 1 - - - - 0,000 - 0,000 - 0,750 - 1,000 - - - 0,675 - 0,890 - 0,969 - 1,000 - - - 0,675 - 0,890 - 0,969 - 0,500 - - - 0,675 - 0,890 - 0,969 - 1,000 - - - 0,675 - 0,890 - 0,969 - 0,300 - - - 0,675 - 0,890 - 0,969 - 1,000 - - - 0,675 - 0,890 - 0,969 - 0,500 - - - 0,675 - 0,890 - 0,969 - 1,000 - - - 0,675 - 0,890 - 0,969 - 1,000 - - - 0,675 - 0,890 - 0,969 - 0,500 - - - 0,675 - 0,890 - 0,969 - 1,000 - - - 0,675 - 0,890 - 0,969 - 0,500 - - - 0,675 - 0,890 - 0,969 - 0,300 - - - 0,675 - 0,890 - 0,969 - 1,000 - - - 0,675 - 0,890 - 0,969 - 0,500 - - - 0,675 - 0,890 - 0,969 - 1,000 - - - 1,000 - 0,000 - 0,000 - 1,000 - - - 0,000 - 0,000 - 0,000 - 1,000 - - - 0,000 - 0,000 - 0,000 - 1,000 - - - 1,000 - 1,000 - 1,000 - 1,000 - - - 1,000 - 1,000 - 1,000 - 0,000 - - - - [Blue]BG_Default.png - Menu.png - - CoverTile.png - SelectSlide.png - SelectSlidePlayer.png - SelectSlideArrowLeft.png - SelectSlideArrowRight.png - Popup.png - ScrollUp.png - ScrollDown.png - Invisible.png - Plus.png - Minus.png - - - [Blue]BG_Video.mp4 - - diff --git a/Output/PartyModes/ChallengeMedley/Textures/[Blue]BG_Default.png b/Output/PartyModes/ChallengeMedley/Textures/[Blue]BG_Default.png deleted file mode 100644 index 53bd3603..00000000 Binary files a/Output/PartyModes/ChallengeMedley/Textures/[Blue]BG_Default.png and /dev/null differ diff --git a/Output/PartyModes/ChallengeMedley/Textures/[Blue]BG_Video.mp4 b/Output/PartyModes/ChallengeMedley/Textures/[Blue]BG_Video.mp4 deleted file mode 100644 index c4fc7b24..00000000 Binary files a/Output/PartyModes/ChallengeMedley/Textures/[Blue]BG_Video.mp4 and /dev/null differ diff --git a/Output/PartyModes/ChallengeMedley/Theme.xml b/Output/PartyModes/ChallengeMedley/Theme.xml deleted file mode 100644 index 7a106892..00000000 --- a/Output/PartyModes/ChallengeMedley/Theme.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - 5 - - Ambient - brunzel - Textures - 0 - 1 - - \ No newline at end of file diff --git a/Output/PartyModes/ChallengeMedley/Themes/Default.xml b/Output/PartyModes/ChallengeMedley/Themes/Default.xml new file mode 100644 index 00000000..5999e8cc --- /dev/null +++ b/Output/PartyModes/ChallengeMedley/Themes/Default.xml @@ -0,0 +1,10 @@ + + + 5 + + Default + brunzel + 0 + 1 + + \ No newline at end of file diff --git a/Output/PartyModes/ChallengeMedley/Themes/Default/Default.xml b/Output/PartyModes/ChallengeMedley/Themes/Default/Default.xml new file mode 100644 index 00000000..f4299579 --- /dev/null +++ b/Output/PartyModes/ChallengeMedley/Themes/Default/Default.xml @@ -0,0 +1,16 @@ + + + 4 + + Default + brunzel + 0 + 1 + + + + + + + + diff --git a/Output/PartyModes/ChallengeMedley/Themes/Default/Screens/PartyScreenChallengeMedleyConfig.xml b/Output/PartyModes/ChallengeMedley/Themes/Default/Screens/PartyScreenChallengeMedleyConfig.xml new file mode 100644 index 00000000..02620808 --- /dev/null +++ b/Output/PartyModes/ChallengeMedley/Themes/Default/Screens/PartyScreenChallengeMedleyConfig.xml @@ -0,0 +1,295 @@ + + + + PartyScreenChallengeMedleyConfig + 1 + + + + Video + + + BG_Default + + + + + + Menu + + + 40 + 40 + 1200 + 50 + 0 + + + + + + 640 + 48 + 0 + 27 + 0 + + + Center + Center + + Outline + TR_SCREENCONFIG_TITLE + + + 75 + 105 + 0 + 27 + 0 + + + Left + Center + + Outline + TR_SCREENCONFIG_NUMPLAYERS + + + 75 + 165 + 0 + 27 + 0 + + + Left + Center + + Outline + TR_SCREENCONFIG_NUMMICS + + + 75 + 225 + 0 + 27 + 0 + + + Left + Center + + Outline + TR_SCREENCONFIG_NUMROUNDS + + + + + + + + + + + + SelectSlideArrowLeft + SelectSlideArrowRight + SelectSlide + SelectSlideArrowLeft + SelectSlideArrowRight + + 500 + 100 + 700 + 50 + 0 + + + 505 + 105 + 40 + 40 + 0 + + + 1170 + 105 + 40 + 40 + 0 + + + + + + + + 27 + 0 + 0 + 205.33 + Outline + Bold + 9 + + + + SelectSlideArrowLeft + SelectSlideArrowRight + SelectSlide + SelectSlideArrowLeft + SelectSlideArrowRight + + 500 + 160 + 700 + 50 + 0 + + + 505 + 165 + 40 + 40 + 0 + + + 1170 + 165 + 40 + 40 + 0 + + + + + + + + 27 + 0 + 0 + 205.33 + Outline + Bold + 2 + + + + SelectSlideArrowLeft + SelectSlideArrowRight + SelectSlide + SelectSlideArrowLeft + SelectSlideArrowRight + + 500 + 220 + 700 + 50 + 0 + + + 505 + 225 + 40 + 40 + 0 + + + 1170 + 225 + 40 + 40 + 0 + + + + + + + + 27 + 0 + 0 + 205.33 + Outline + Bold + 10 + + + + + + + + + \ No newline at end of file diff --git a/Output/PartyModes/ChallengeMedley/Themes/Default/Screens/PartyScreenChallengeMedleyMain.xml b/Output/PartyModes/ChallengeMedley/Themes/Default/Screens/PartyScreenChallengeMedleyMain.xml new file mode 100644 index 00000000..371c3e14 --- /dev/null +++ b/Output/PartyModes/ChallengeMedley/Themes/Default/Screens/PartyScreenChallengeMedleyMain.xml @@ -0,0 +1,557 @@ + + + + PartyScreenChallengeMedleyMain + 1 + + + + Video + + + BG_Default + + + + + + Menu + + + 40 + 40 + 1200 + 50 + 0 + + + + PopupBG + + + 0 + 0 + 1280 + 720 + -1 + + + + + + + 0 + 0 + 100 + 100 + 0 + + + + + + 640 + 48 + 0 + 27 + 0 + + + Center + Center + + Outline + TR_SCREENMAIN_TITLE + + + 40 + 102 + 0 + 27 + 0 + + + Right + Center + + Outline + TR_SCREENMAIN_TABLE_POS + + + 50 + 102 + 0 + 27 + 130 + + + Left + Center + + Outline + TR_SCREENMAIN_TABLE_PLAYERNAME + + + 260 + 102 + 0 + 27 + 0 + + + Right + Center + + Outline + TR_SCREENMAIN_TABLE_NUMPLAYED + + + 340 + 102 + 0 + 27 + 0 + + + Right + Center + + Outline + TR_SCREENMAIN_TABLE_WON + + + 490 + 102 + 0 + 27 + 0 + + + Right + Center + + Outline + TR_SCREENMAIN_TABLE_SINGPOINTS + + + 590 + 102 + 0 + 27 + 0 + + + Right + Center + + Outline + TR_SCREENMAIN_TABLE_GAMEPOINTS + + + 0 + 0 + 0 + 27 + 100 + + + Center + Center + + Outline + + + + 640 + 265 + -1.01 + 27 + 380 + + + Center + Center + + Outline + TR_SCREENMAIN_POPUP_REALLYEXIT + + + 660 + 102 + 0 + 27 + 0 + + + Right + Center + + Outline + 1) + + + 0 + 0 + 0 + 27 + 0 + + + Center + Center + + Outline + + + + 0 + 0 + 0 + 27 + 0 + + + Center + Center + + Outline + + + + 640 + 520 + 0 + 44 + 0 + + + Center + Center + + Outline + TR_SCREENMAIN_FINISH + + + 640 + 575 + 0 + 31 + 770 + + + Center + Center + + Outline + + + + 640 + 515 + 0 + 27 + 0 + + + Center + Center + + Outline + TR_SCREENMAIN_NEXT_PLAYER + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Output/PartyModes/ChallengeMedley/Themes/Default/Screens/PartyScreenChallengeMedleyNames.xml b/Output/PartyModes/ChallengeMedley/Themes/Default/Screens/PartyScreenChallengeMedleyNames.xml new file mode 100644 index 00000000..72512c94 --- /dev/null +++ b/Output/PartyModes/ChallengeMedley/Themes/Default/Screens/PartyScreenChallengeMedleyNames.xml @@ -0,0 +1,387 @@ + + + + PartyScreenChallengeMedleyNames + 1 + + + + Video + + + BG_Default + + + + + + Menu + + + 40 + 40 + 1200 + 50 + 0 + + + + + + 640 + 48 + 0 + 27 + 0 + + + Center + Center + + Outline + TR_SCREENNAMES_TITLE + + + + + + + + + + + + + + + + + SelectSlideArrowLeft + SelectSlideArrowRight + SelectSlide + SelectSlideArrowLeft + SelectSlideArrowRight + + 40 + 100 + 1200 + 50 + 0 + + + 45 + 105 + 40 + 40 + 0 + + + 1170 + 105 + 40 + 40 + 0 + + + + + + + + 27 + 0 + 0 + 205.33 + Outline + Bold + 2 + + + + SelectSlideArrowLeft + SelectSlideArrowRight + SelectSlidePlayer + SelectSlideArrowLeft + SelectSlideArrowRight + + 40 + 160 + 1200 + 150 + 0 + + + 45 + 210 + 40 + 40 + 0 + + + 1170 + 210 + 40 + 40 + 0 + + + + + + + + 27 + 0 + -5 + 205.33 + Outline + Bold + 8 + + + + + + + 42 + 327 + 1200 + 393 + 0 + + CoverTile + + 1 + 1 + 1 + 0.2 + + PlayerSelector + + 100 + 100 + 10 + 2 + 20.71 + 30 + + 2 + 17 + Outline + + + + + + + + + + + \ No newline at end of file diff --git a/Output/PartyModes/TicTacToe/Languages/Italian.xml b/Output/PartyModes/TicTacToe/Languages/Italian.xml index 9ef9c84b..b299e22a 100644 --- a/Output/PartyModes/TicTacToe/Languages/Italian.xml +++ b/Output/PartyModes/TicTacToe/Languages/Italian.xml @@ -1,7 +1,13 @@ Italiano - Tic-Tac-Toe + Tris + Gioca a Tris in un modo speciale + Turni di gioco divertenti per strategia, abilità e fortuna + Prossimo + Indietro + Inizia + Esci Si No Inizia @@ -10,8 +16,20 @@ Playlist Categoria Tutte le canzoni + Tris: Configurazione + Numero di giocatori della squadra 1 + Numero di giocatori della squadra 2 + Numero di caselle + Sorgente della Canzone + Modalità di Gioco + Tris: Scegli il Giocatore Squadra 1 Squadra 2 Selezione casuale - Tic-Tac-Toe + Tris + Scegli una casella. + Prossimo giocatore + Vuoi veramente uscire dal Tris? + E il vincitore è... + Non c\'è nessun vincitore in questo turno... diff --git a/Output/PartyModes/TicTacToe/Screens/PartyScreenTicTacToeConfig.xml b/Output/PartyModes/TicTacToe/Screens/PartyScreenTicTacToeConfig.xml deleted file mode 100644 index ab0ac65f..00000000 --- a/Output/PartyModes/TicTacToe/Screens/PartyScreenTicTacToeConfig.xml +++ /dev/null @@ -1,588 +0,0 @@ - - - - 1 - - - Video - - - - BG_Default - - - BackgroundColor - - - - Menu - - 40 - 40 - 0,00 - 1200 - 50 - - - StaticColor - - - - - - - 640 - 48 - - 0,00 - - 27 - - - - StaticColor - - - TextSColor - - Center - - Center - - - - Outline - - TR_SCREENCONFIG_TITLE - - - - - - - 75 - 105 - - 0,00 - - 27 - - - - StaticColor - - - TextSColor - - Left - - Center - - - - Outline - - TR_SCREENCONFIG_NUMFIELDS - - - - - - - 75 - 165 - - 0,00 - - 27 - - - - StaticColor - - - TextSColor - - Left - - Center - - - - Outline - - TR_SCREENCONFIG_SONGSOURCE - - - - - - - 75 - 285 - - 0,00 - - 27 - - - - StaticColor - - - TextSColor - - Left - - Center - - - - Outline - - TR_SCREENCONFIG_GAMEMODE - - - - - - - Button - - Button - - 985 - 600 - 0,00 - 150 - 50 - - - ButtonColor - - - ButtonSColor - - - 75 - 10 - - 27 - - 142 - - - ButtonTextColor - - - ButtonTextSColor - - Center - - Center - - - - Outline - - TR_BUTTON_NEXT - - - - - - 10 - 26 - - - - - - 10 - 26 - - - - - Button - - Button - - 145 - 600 - 0,00 - 150 - 50 - - - ButtonColor - - - ButtonSColor - - - 75 - 10 - - 27 - - 142 - - - ButtonTextColor - - - ButtonTextSColor - - Center - - Center - - - - Outline - - TR_BUTTON_BACK - - - - - - 10 - 26 - - - - - - 10 - 26 - - - - - Invisible - - SelectSlideArrowLeft - - SelectSlideArrowRight - - SelectSlide - - SelectSlideArrowLeft - - SelectSlideArrowRight - - SelectSlide - - 500 - 100 - 0,00 - 700 - 50 - - 505 - 105 - 0,00 - 40 - 40 - - 1170 - 105 - 0,00 - 40 - 40 - - - SelectSlideColor - - - SelectSlideSColor - - - SelectSlideHColor - - - ArrowColor - - - ArrowSColor - - - TextColor - - - TextSColor - - 27,00 - - 205,33 - - Outline - - Bold - - 3 - - - - Invisible - - SelectSlideArrowLeft - - SelectSlideArrowRight - - SelectSlide - - SelectSlideArrowLeft - - SelectSlideArrowRight - - SelectSlide - - 500 - 160 - 0,00 - 700 - 50 - - 505 - 165 - 0,00 - 40 - 40 - - 1170 - 165 - 0,00 - 40 - 40 - - - SelectSlideColor - - - SelectSlideSColor - - - SelectSlideHColor - - - ArrowColor - - - ArrowSColor - - - TextColor - - - TextSColor - - 27,00 - - 205,33 - - Outline - - Bold - - 3 - - - - Invisible - - SelectSlideArrowLeft - - SelectSlideArrowRight - - SelectSlide - - SelectSlideArrowLeft - - SelectSlideArrowRight - - SelectSlide - - 500 - 220 - 0,00 - 700 - 50 - - 505 - 225 - 0,00 - 40 - 40 - - 1170 - 225 - 0,00 - 40 - 40 - - - SelectSlideColor - - - SelectSlideSColor - - - SelectSlideHColor - - - ArrowColor - - - ArrowSColor - - - TextColor - - - TextSColor - - 27,00 - - 205,33 - - Outline - - Bold - - 1 - - - - Invisible - - SelectSlideArrowLeft - - SelectSlideArrowRight - - SelectSlide - - SelectSlideArrowLeft - - SelectSlideArrowRight - - SelectSlide - - 500 - 220 - 0,00 - 700 - 50 - - 505 - 225 - 0,00 - 40 - 40 - - 1170 - 225 - 0,00 - 40 - 40 - - - SelectSlideColor - - - SelectSlideSColor - - - SelectSlideHColor - - - ArrowColor - - - ArrowSColor - - - TextColor - - - TextSColor - - 27,00 - - 205,33 - - Outline - - Bold - - 1 - - - - Invisible - - SelectSlideArrowLeft - - SelectSlideArrowRight - - SelectSlide - - SelectSlideArrowLeft - - SelectSlideArrowRight - - SelectSlide - - 500 - 280 - 0,00 - 700 - 50 - - 505 - 285 - 0,00 - 40 - 40 - - 1170 - 285 - 0,00 - 40 - 40 - - - SelectSlideColor - - - SelectSlideSColor - - - SelectSlideHColor - - - ArrowColor - - - ArrowSColor - - - TextColor - - - TextSColor - - 27,00 - - 205,33 - - Outline - - Bold - - 1 - - - diff --git a/Output/PartyModes/TicTacToe/Screens/PartyScreenTicTacToeMain.xml b/Output/PartyModes/TicTacToe/Screens/PartyScreenTicTacToeMain.xml deleted file mode 100644 index 61e5e3a3..00000000 --- a/Output/PartyModes/TicTacToe/Screens/PartyScreenTicTacToeMain.xml +++ /dev/null @@ -1,844 +0,0 @@ - - - - 1 - - - Video - - - - BG_Default - - - BackgroundColor - - - - Menu - - 40 - 40 - 0,00 - 1200 - 50 - - - StaticColor - - - - - - - PopupBG - - 0 - 0 - -2,00 - 1280 - 720 - - - StaticColor - - - - - - - PopupBG - - 10 - 200 - -1,00 - 100 - 100 - - - StaticColor - - - - - - - PopupBG - - 1170 - 200 - -1,00 - 100 - 100 - - - StaticColor - - - - - - - 640 - 48 - - 0,00 - - 27 - - - - StaticColor - - - TextSColor - - Center - - Center - - - - Outline - - TR_SCREENMAIN_TITLE - - - - - - - 160 - 150 - - 0,00 - - 35 - - - - Player1 - - - TextSColor - - Center - - Center - - - - Outline - - TR_SCREENMAIN_NEXT_PLAYER - - - - - - - 1120 - 150 - - 0,00 - - 35 - - - - Player2 - - - TextSColor - - Center - - Center - - - - Outline - - TR_SCREENMAIN_NEXT_PLAYER - - - - - - - 120 - 230 - - 0,00 - - 35 - - - - Player1 - - - TextSColor - - Left - - Center - - - - Outline - - - - - - - - - 1160 - 230 - - 0,00 - - 40 - - - - Player2 - - - TextSColor - - Right - - Center - - - - Outline - - - - - - - - - 640 - 90 - - 0,00 - - 35 - - - - StaticColor - - - TextSColor - - Center - - Center - - - - Outline - - - - - - - - - 640 - 90 - - 0,00 - - 35 - - - - StaticColor - - - TextSColor - - Center - - Center - - - - Outline - - - - - - - - - 640 - 265 - - -2,01 - - 27 - - 380 - - - StaticColor - - - TextSColor - - Center - - Center - - - - Outline - - TR_SCREENMAIN_POPUP_REALLYEXIT - - - - - - - Random - - Random - - 10 - 320 - 0,00 - 100 - 100 - - - Player1Dim - - - Player1 - - - 50 - 25 - - 50 - - 50 - - - ButtonTextColor - - - ButtonTextSColor - - Center - - Center - - - - Outline - - - - - - - - - - - - - Random - - Random - - 1170 - 320 - 0,00 - 100 - 100 - - - Player2Dim - - - Player2 - - - 50 - 25 - - 50 - - 50 - - - ButtonTextColor - - - ButtonTextSColor - - Center - - Center - - - - Outline - - - - - - - - - - - - - RepeatIcon - - RepeatIcon - - 110 - 320 - 0,00 - 100 - 100 - - - Player1Dim - - - Player1 - - - 48 - 25 - - 50 - - 50 - - - ButtonTextColor - - - ButtonTextSColor - - Center - - Center - - - - Outline - - - - - - - - - - - - - RepeatIcon - - RepeatIcon - - 1070 - 320 - 0,00 - 100 - 100 - - - Player2Dim - - - Player2 - - - 48 - 25 - - 50 - - 50 - - - ButtonTextColor - - - ButtonTextSColor - - Center - - Center - - - - Outline - - - - - - - - - - - - - Button - - Button - - 1030 - 625 - 0,00 - 150 - 50 - - - ButtonColor - - - ButtonSColor - - - 75 - 10 - - 27 - - 142 - - - ButtonTextColor - - - ButtonTextSColor - - Center - - Center - - - - Outline - - TR_BUTTON_NEXT_ROUND - - - - - - 10 - 26 - - - - - - 10 - 26 - - - - - Button - - Button - - 100 - 625 - 0,00 - 150 - 50 - - - ButtonColor - - - ButtonSColor - - - 75 - 10 - - 27 - - 142 - - - ButtonTextColor - - - ButtonTextSColor - - Center - - Center - - - - Outline - - TR_BUTTON_BACK - - - - - - 10 - 26 - - - - - - 10 - 26 - - - - - Button - - Button - - 100 - 625 - 0,00 - 150 - 50 - - - ButtonColor - - - ButtonSColor - - - 75 - 10 - - 27 - - 142 - - - ButtonTextColor - - - ButtonTextSColor - - Center - - Center - - - - Outline - - TR_BUTTON_EXIT - - - - - - 10 - 26 - - - - - - 10 - 26 - - - - - Button - - Button - - 665 - 360 - -2,01 - 150 - 50 - - - ButtonColor - - - ButtonSColor - - - 75 - 10 - - 27 - - 142 - - - ButtonTextColor - - - ButtonTextSColor - - Center - - Center - - - - Outline - - TR_BUTTON_YES - - - - - - 10 - 26 - - - - - - 10 - 26 - - - - - Button - - Button - - 465 - 360 - -2,01 - 150 - 50 - - - ButtonColor - - - ButtonSColor - - - 75 - 10 - - 27 - - 142 - - - ButtonTextColor - - - ButtonTextSColor - - Center - - Center - - - - Outline - - TR_BUTTON_NO - - - - - - 10 - 26 - - - - - - 10 - 26 - - - - - CoverTile - - CoverTile - - 0 - 0 - -1,01 - 100 - 100 - - - ButtonColor - - - ButtonSColor - - - 75 - 10 - - 27 - - 142 - - - ButtonTextColor - - - ButtonTextSColor - - Center - - Center - - - - Outline - - - - - - - - - - - - diff --git a/Output/PartyModes/TicTacToe/Screens/PartyScreenTicTacToeNames.xml b/Output/PartyModes/TicTacToe/Screens/PartyScreenTicTacToeNames.xml deleted file mode 100644 index a968b115..00000000 --- a/Output/PartyModes/TicTacToe/Screens/PartyScreenTicTacToeNames.xml +++ /dev/null @@ -1,607 +0,0 @@ - - - - 1 - - - Video - - - - BG_Default - - - BackgroundColor - - - - Menu - - 40 - 40 - 0,00 - 1200 - 50 - - - StaticColor - - - - - - - 640 - 48 - - 0,00 - - 27 - - - - StaticColor - - - TextSColor - - Center - - Center - - - - Outline - - TR_SCREENNAMES_TITLE - - - - - - - Button - - Button - - 985 - 625 - 0,00 - 150 - 50 - - - ButtonColor - - - ButtonSColor - - - 75 - 10 - - 27 - - 142 - - - ButtonTextColor - - - ButtonTextSColor - - Center - - Center - - - - Outline - - TR_BUTTON_NEXT - - - - - - 10 - 26 - - - - - - 10 - 26 - - - - - Button - - Button - - 145 - 625 - 0,00 - 150 - 50 - - - ButtonColor - - - ButtonSColor - - - 75 - 10 - - 27 - - 142 - - - ButtonTextColor - - - ButtonTextSColor - - Center - - Center - - - - Outline - - TR_BUTTON_BACK - - - - - - 10 - 26 - - - - - - 10 - 26 - - - - - Button - - Button - - 565 - 625 - 0,00 - 150 - 50 - - - ButtonColor - - - ButtonSColor - - - 75 - 10 - - 27 - - 142 - - - ButtonTextColor - - - ButtonTextSColor - - Center - - Center - - - - Outline - - TR_SCREENNAMES_BUTTON_RANDOM - - - - - - 10 - 26 - - - - - - 10 - 26 - - - - - Plus - - Plus - - 1210 - 210 - 0,00 - 40 - 40 - - - ButtonColor - - - ButtonSColor - - - 75 - 10 - - 27 - - 142 - - - ButtonTextColor - - - ButtonTextSColor - - Center - - Center - - - - Outline - - - - - - - - - - - - - Minus - - Minus - - 1160 - 210 - 0,00 - 40 - 40 - - - ButtonColor - - - ButtonSColor - - - 75 - 10 - - 27 - - 142 - - - ButtonTextColor - - - ButtonTextSColor - - Center - - Center - - - - Outline - - - - - - - - - - - - - Plus - - Plus - - 145 - 1200 - 0,00 - 40 - 40 - - - ButtonColor - - - ButtonSColor - - - 75 - 10 - - 27 - - 142 - - - ButtonTextColor - - - ButtonTextSColor - - Center - - Center - - - - Outline - - - - - - - - - - - - - Minus - - Minus - - 145 - 1200 - 0,00 - 40 - 40 - - - ButtonColor - - - ButtonSColor - - - 75 - 10 - - 27 - - 142 - - - ButtonTextColor - - - ButtonTextSColor - - Center - - Center - - - - Outline - - - - - - - - - - - - - Invisible - - SelectSlideArrowLeft - - SelectSlideArrowRight - - SelectSlide - - SelectSlideArrowLeft - - SelectSlideArrowRight - - SelectSlide - - 40 - 100 - 0,00 - 1100 - 50 - - 45 - 105 - 0,00 - 40 - 40 - - 1050 - 105 - 0,00 - 40 - 40 - - - SelectSlideColor - - - SelectSlideSColor - - - SelectSlideHColor - - - ArrowColor - - - ArrowSColor - - - TextColor - - - TextSColor - - 27,00 - - - - 205,33 - - Outline - - Bold - - 2 - - - - Invisible - - SelectSlideArrowLeft - - SelectSlideArrowRight - - SelectSlidePlayer - - SelectSlideArrowLeft - - SelectSlideArrowRight - - SelectSlidePlayer - - 40 - 160 - 0,00 - 1100 - 150 - - 45 - 210 - 0,00 - 40 - 40 - - 1050 - 210 - 0,00 - 40 - 40 - - - SelectSlideColor - - - SelectSlideSColor - - - SelectSlideHColor - - - ArrowColor - - - ArrowSColor - - - TextColor - - - TextSColor - - 27,00 - - - -5,00 - - 205,33 - - Outline - - Bold - - 8 - - - - 42 - 327 - 0,00 - 1200 - 393 - - CoverTile - - - 1,00 - 1,00 - 1,00 - 0,20 - - PlayerSelector - - - - 100 - 100 - - 10 - 2 - - 20,71 - 30,00 - - - - 2,0 - - Outline - - TextColor - - - - 17 - - - - - diff --git a/Output/PartyModes/TicTacToe/Textures/Button.png b/Output/PartyModes/TicTacToe/Textures/Button.png deleted file mode 100644 index 58685b3e..00000000 Binary files a/Output/PartyModes/TicTacToe/Textures/Button.png and /dev/null differ diff --git a/Output/PartyModes/TicTacToe/Textures/CoverTile.png b/Output/PartyModes/TicTacToe/Textures/CoverTile.png deleted file mode 100644 index 7db093e7..00000000 Binary files a/Output/PartyModes/TicTacToe/Textures/CoverTile.png and /dev/null differ diff --git a/Output/PartyModes/TicTacToe/Textures/Invisible.png b/Output/PartyModes/TicTacToe/Textures/Invisible.png deleted file mode 100644 index b2ff36e9..00000000 Binary files a/Output/PartyModes/TicTacToe/Textures/Invisible.png and /dev/null differ diff --git a/Output/PartyModes/TicTacToe/Textures/Menu.png b/Output/PartyModes/TicTacToe/Textures/Menu.png deleted file mode 100644 index 25fc125e..00000000 Binary files a/Output/PartyModes/TicTacToe/Textures/Menu.png and /dev/null differ diff --git a/Output/PartyModes/TicTacToe/Textures/Minus.png b/Output/PartyModes/TicTacToe/Textures/Minus.png deleted file mode 100644 index 9bdede57..00000000 Binary files a/Output/PartyModes/TicTacToe/Textures/Minus.png and /dev/null differ diff --git a/Output/PartyModes/TicTacToe/Textures/PlayerSelector.png b/Output/PartyModes/TicTacToe/Textures/PlayerSelector.png deleted file mode 100644 index c57ab300..00000000 Binary files a/Output/PartyModes/TicTacToe/Textures/PlayerSelector.png and /dev/null differ diff --git a/Output/PartyModes/TicTacToe/Textures/Plus.png b/Output/PartyModes/TicTacToe/Textures/Plus.png deleted file mode 100644 index 5b813c53..00000000 Binary files a/Output/PartyModes/TicTacToe/Textures/Plus.png and /dev/null differ diff --git a/Output/PartyModes/TicTacToe/Textures/Popup.png b/Output/PartyModes/TicTacToe/Textures/Popup.png deleted file mode 100644 index 80868001..00000000 Binary files a/Output/PartyModes/TicTacToe/Textures/Popup.png and /dev/null differ diff --git a/Output/PartyModes/TicTacToe/Textures/Random.png b/Output/PartyModes/TicTacToe/Textures/Random.png deleted file mode 100644 index f19c9dc3..00000000 Binary files a/Output/PartyModes/TicTacToe/Textures/Random.png and /dev/null differ diff --git a/Output/PartyModes/TicTacToe/Textures/RepeatIcon.png b/Output/PartyModes/TicTacToe/Textures/RepeatIcon.png deleted file mode 100644 index ecf82df1..00000000 Binary files a/Output/PartyModes/TicTacToe/Textures/RepeatIcon.png and /dev/null differ diff --git a/Output/PartyModes/TicTacToe/Textures/ScrollDown.png b/Output/PartyModes/TicTacToe/Textures/ScrollDown.png deleted file mode 100644 index 94bd2e14..00000000 Binary files a/Output/PartyModes/TicTacToe/Textures/ScrollDown.png and /dev/null differ diff --git a/Output/PartyModes/TicTacToe/Textures/ScrollUp.png b/Output/PartyModes/TicTacToe/Textures/ScrollUp.png deleted file mode 100644 index c3b4c6b9..00000000 Binary files a/Output/PartyModes/TicTacToe/Textures/ScrollUp.png and /dev/null differ diff --git a/Output/PartyModes/TicTacToe/Textures/SelectSlide.png b/Output/PartyModes/TicTacToe/Textures/SelectSlide.png deleted file mode 100644 index 46b86a23..00000000 Binary files a/Output/PartyModes/TicTacToe/Textures/SelectSlide.png and /dev/null differ diff --git a/Output/PartyModes/TicTacToe/Textures/SelectSlideArrowLeft.png b/Output/PartyModes/TicTacToe/Textures/SelectSlideArrowLeft.png deleted file mode 100644 index 313fe280..00000000 Binary files a/Output/PartyModes/TicTacToe/Textures/SelectSlideArrowLeft.png and /dev/null differ diff --git a/Output/PartyModes/TicTacToe/Textures/SelectSlideArrowRight.png b/Output/PartyModes/TicTacToe/Textures/SelectSlideArrowRight.png deleted file mode 100644 index 7dfd68c0..00000000 Binary files a/Output/PartyModes/TicTacToe/Textures/SelectSlideArrowRight.png and /dev/null differ diff --git a/Output/PartyModes/TicTacToe/Textures/SelectSlidePlayer.png b/Output/PartyModes/TicTacToe/Textures/SelectSlidePlayer.png deleted file mode 100644 index 4fb9a6df..00000000 Binary files a/Output/PartyModes/TicTacToe/Textures/SelectSlidePlayer.png and /dev/null differ diff --git a/Output/PartyModes/TicTacToe/Textures/Skin.xml b/Output/PartyModes/TicTacToe/Textures/Skin.xml deleted file mode 100644 index 9145b6bf..00000000 --- a/Output/PartyModes/TicTacToe/Textures/Skin.xml +++ /dev/null @@ -1,232 +0,0 @@ - - - 3 - - Blue - brunzel - 0 - 1 - - - - 0,000 - 0,000 - 1,000 - 0,500 - - - 1,000 - 0,000 - 0,000 - 0,500 - - - 0,000 - 1,000 - 0,000 - 0,500 - - - 0,500 - 0,000 - 1,000 - 0,500 - - - 1,000 - 0,800 - 0,000 - 0,500 - - - 1,000 - 0,000 - 0,500 - 0,500 - - - 0,000 - 0,000 - 1,000 - 0,400 - - - 1,000 - 0,000 - 0,000 - 0,400 - - - 0,000 - 1,000 - 0,000 - 0,400 - - - 0,500 - 0,000 - 1,000 - 0,400 - - - 1,000 - 0,800 - 0,000 - 0,400 - - - 1,000 - 0,000 - 0,500 - 0,400 - - - 0,000 - 0,000 - 0,750 - 1,000 - - - 0,675 - 0,890 - 0,969 - 1,000 - - - 0,675 - 0,890 - 0,969 - 0,500 - - - 0,675 - 0,890 - 0,969 - 1,000 - - - 0,675 - 0,890 - 0,969 - 0,300 - - - 0,675 - 0,890 - 0,969 - 1,000 - - - 0,675 - 0,890 - 0,969 - 0,500 - - - 0,675 - 0,890 - 0,969 - 1,000 - - - 0,675 - 0,890 - 0,969 - 1,000 - - - 0,675 - 0,890 - 0,969 - 0,500 - - - 0,675 - 0,890 - 0,969 - 1,000 - - - 0,675 - 0,890 - 0,969 - 0,500 - - - 0,675 - 0,890 - 0,969 - 0,300 - - - 0,675 - 0,890 - 0,969 - 1,000 - - - 0,675 - 0,890 - 0,969 - 0,500 - - - 0,675 - 0,890 - 0,969 - 1,000 - - - 1,000 - 0,000 - 0,000 - 1,000 - - - 0,000 - 0,000 - 0,000 - 1,000 - - - 0,000 - 0,000 - 0,000 - 1,000 - - - 1,000 - 1,000 - 1,000 - 1,000 - - - 1,000 - 1,000 - 1,000 - 0,000 - - - - [Blue]BG_Default.png - Menu.png - - CoverTile.png - SelectSlide.png - SelectSlidePlayer.png - SelectSlideArrowLeft.png - SelectSlideArrowRight.png - Popup.png - RepeatIcon.png - Random.png - ScrollUp.png - ScrollDown.png - Invisible.png - PlayerSelector.png - Plus.png - Minus.png - - - [Blue]BG_Video.mp4 - - diff --git a/Output/PartyModes/TicTacToe/Textures/[Blue]BG_Default.png b/Output/PartyModes/TicTacToe/Textures/[Blue]BG_Default.png deleted file mode 100644 index 53bd3603..00000000 Binary files a/Output/PartyModes/TicTacToe/Textures/[Blue]BG_Default.png and /dev/null differ diff --git a/Output/PartyModes/TicTacToe/Textures/[Blue]BG_Video.mp4 b/Output/PartyModes/TicTacToe/Textures/[Blue]BG_Video.mp4 deleted file mode 100644 index c4fc7b24..00000000 Binary files a/Output/PartyModes/TicTacToe/Textures/[Blue]BG_Video.mp4 and /dev/null differ diff --git a/Output/PartyModes/TicTacToe/Theme.xml b/Output/PartyModes/TicTacToe/Theme.xml deleted file mode 100644 index 7a106892..00000000 --- a/Output/PartyModes/TicTacToe/Theme.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - 5 - - Ambient - brunzel - Textures - 0 - 1 - - \ No newline at end of file diff --git a/Output/PartyModes/TicTacToe/Themes/Default.xml b/Output/PartyModes/TicTacToe/Themes/Default.xml new file mode 100644 index 00000000..5999e8cc --- /dev/null +++ b/Output/PartyModes/TicTacToe/Themes/Default.xml @@ -0,0 +1,10 @@ + + + 5 + + Default + brunzel + 0 + 1 + + \ No newline at end of file diff --git a/Output/PartyModes/TicTacToe/Themes/Default/Default.xml b/Output/PartyModes/TicTacToe/Themes/Default/Default.xml new file mode 100644 index 00000000..f4299579 --- /dev/null +++ b/Output/PartyModes/TicTacToe/Themes/Default/Default.xml @@ -0,0 +1,16 @@ + + + 4 + + Default + brunzel + 0 + 1 + + + + + + + + diff --git a/Output/PartyModes/TicTacToe/Themes/Default/Screens/PartyScreenTicTacToeConfig.xml b/Output/PartyModes/TicTacToe/Themes/Default/Screens/PartyScreenTicTacToeConfig.xml new file mode 100644 index 00000000..1d02431f --- /dev/null +++ b/Output/PartyModes/TicTacToe/Themes/Default/Screens/PartyScreenTicTacToeConfig.xml @@ -0,0 +1,379 @@ + + + + PartyScreenTicTacToeConfig + 1 + + + + Video + + + BG_Default + + + + + + Menu + + + 40 + 40 + 1200 + 50 + 0 + + + + + + 640 + 48 + 0 + 27 + 0 + + + Center + Center + + Outline + TR_SCREENCONFIG_TITLE + + + 75 + 105 + 0 + 27 + 0 + + + Left + Center + + Outline + TR_SCREENCONFIG_NUMFIELDS + + + 75 + 165 + 0 + 27 + 0 + + + Left + Center + + Outline + TR_SCREENCONFIG_SONGSOURCE + + + 75 + 285 + 0 + 27 + 0 + + + Left + Center + + Outline + TR_SCREENCONFIG_GAMEMODE + + + + + + + + + + + + SelectSlideArrowLeft + SelectSlideArrowRight + SelectSlide + SelectSlideArrowLeft + SelectSlideArrowRight + + 500 + 100 + 700 + 50 + 0 + + + 505 + 105 + 40 + 40 + 0 + + + 1170 + 105 + 40 + 40 + 0 + + + + + + + + 27 + 0 + 0 + 205.33 + Outline + Bold + 3 + + + + SelectSlideArrowLeft + SelectSlideArrowRight + SelectSlide + SelectSlideArrowLeft + SelectSlideArrowRight + + 500 + 160 + 700 + 50 + 0 + + + 505 + 165 + 40 + 40 + 0 + + + 1170 + 165 + 40 + 40 + 0 + + + + + + + + 27 + 0 + 0 + 205.33 + Outline + Bold + 3 + + + + SelectSlideArrowLeft + SelectSlideArrowRight + SelectSlide + SelectSlideArrowLeft + SelectSlideArrowRight + + 500 + 220 + 700 + 50 + 0 + + + 505 + 225 + 40 + 40 + 0 + + + 1170 + 225 + 40 + 40 + 0 + + + + + + + + 27 + 0 + 0 + 205.33 + Outline + Bold + 1 + + + + SelectSlideArrowLeft + SelectSlideArrowRight + SelectSlide + SelectSlideArrowLeft + SelectSlideArrowRight + + 500 + 220 + 700 + 50 + 0 + + + 505 + 225 + 40 + 40 + 0 + + + 1170 + 225 + 40 + 40 + 0 + + + + + + + + 27 + 0 + 0 + 205.33 + Outline + Bold + 1 + + + + SelectSlideArrowLeft + SelectSlideArrowRight + SelectSlide + SelectSlideArrowLeft + SelectSlideArrowRight + + 500 + 280 + 700 + 50 + 0 + + + 505 + 285 + 40 + 40 + 0 + + + 1170 + 285 + 40 + 40 + 0 + + + + + + + + 27 + 0 + 0 + 205.33 + Outline + Bold + 1 + + + + + + + + + \ No newline at end of file diff --git a/Output/PartyModes/TicTacToe/Themes/Default/Screens/PartyScreenTicTacToeMain.xml b/Output/PartyModes/TicTacToe/Themes/Default/Screens/PartyScreenTicTacToeMain.xml new file mode 100644 index 00000000..f4dd7cad --- /dev/null +++ b/Output/PartyModes/TicTacToe/Themes/Default/Screens/PartyScreenTicTacToeMain.xml @@ -0,0 +1,497 @@ + + + + PartyScreenTicTacToeMain + 1 + + + + Video + + + BG_Default + + + + + + Menu + + + 40 + 40 + 1200 + 50 + 0 + + + + PopupBG + + + 0 + 0 + 1280 + 720 + -2 + + + + PopupBG + + + 10 + 200 + 100 + 100 + -1 + + + + PopupBG + + + 1170 + 200 + 100 + 100 + -1 + + + + + + 640 + 48 + 0 + 27 + 0 + + + Center + Center + + Outline + TR_SCREENMAIN_TITLE + + + 640 + 265 + -2.01 + 27 + 380 + + + Center + Center + + Outline + TR_SCREENMAIN_POPUP_REALLYEXIT + + + 640 + 90 + 0 + 35 + 0 + + + Center + Center + + Outline + + + + 640 + 90 + 0 + 35 + 0 + + + Center + Center + + Outline + + + + 160 + 150 + 0 + 35 + 0 + + + Center + Center + + Outline + TR_SCREENMAIN_NEXT_PLAYER + + + 1120 + 150 + 0 + 35 + 0 + + + Center + Center + + Outline + TR_SCREENMAIN_NEXT_PLAYER + + + 120 + 230 + 0 + 35 + 0 + + + Left + Center + + Outline + + + + 1160 + 230 + 0 + 40 + 0 + + + Right + Center + + Outline + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Output/PartyModes/TicTacToe/Themes/Default/Screens/PartyScreenTicTacToeNames.xml b/Output/PartyModes/TicTacToe/Themes/Default/Screens/PartyScreenTicTacToeNames.xml new file mode 100644 index 00000000..df5bc5db --- /dev/null +++ b/Output/PartyModes/TicTacToe/Themes/Default/Screens/PartyScreenTicTacToeNames.xml @@ -0,0 +1,387 @@ + + + + PartyScreenTicTacToeNames + 1 + + + + Video + + + BG_Default + + + + + + Menu + + + 40 + 40 + 1200 + 50 + 0 + + + + + + 640 + 48 + 0 + 27 + 0 + + + Center + Center + + Outline + TR_SCREENNAMES_TITLE + + + + + + + + + + + + + + + + + SelectSlideArrowLeft + SelectSlideArrowRight + SelectSlide + SelectSlideArrowLeft + SelectSlideArrowRight + + 40 + 100 + 1100 + 50 + 0 + + + 45 + 105 + 40 + 40 + 0 + + + 1050 + 105 + 40 + 40 + 0 + + + + + + + + 27 + 0 + 0 + 205.33 + Outline + Bold + 2 + + + + SelectSlideArrowLeft + SelectSlideArrowRight + SelectSlidePlayer + SelectSlideArrowLeft + SelectSlideArrowRight + + 40 + 160 + 1100 + 150 + 0 + + + 45 + 210 + 40 + 40 + 0 + + + 1050 + 210 + 40 + 40 + 0 + + + + + + + + 27 + 0 + -5 + 205.33 + Outline + Bold + 8 + + + + + + + 42 + 327 + 1200 + 393 + 0 + + CoverTile + + 1 + 1 + 1 + 0.2 + + PlayerSelector + + 100 + 100 + 10 + 2 + 20.71 + 30 + + 2 + 17 + Outline + + + + + + + + + + + \ No newline at end of file diff --git a/Output/Profiles/guest1.xml b/Output/Profiles/guest1.xml index 4a528851..92f0b29d 100644 --- a/Output/Profiles/guest1.xml +++ b/Output/Profiles/guest1.xml @@ -1,10 +1,8 @@  - - Guest 1 - TR_CONFIG_EASY - Avatar_f.png - TR_USERROLE_GUEST - TR_CONFIG_ON - + Guest 1 + TR_CONFIG_EASY + TR_USERROLE_GUEST + TR_CONFIG_ON + Avatar_f.png \ No newline at end of file diff --git a/Output/Profiles/guest2.xml b/Output/Profiles/guest2.xml index 15437dc4..55c2c971 100644 --- a/Output/Profiles/guest2.xml +++ b/Output/Profiles/guest2.xml @@ -1,10 +1,8 @@  - - Guest 2 - TR_CONFIG_EASY - Avatar_f.png - TR_USERROLE_GUEST - TR_CONFIG_ON - + Guest 2 + TR_CONFIG_EASY + TR_USERROLE_GUEST + TR_CONFIG_ON + Avatar_f.png \ No newline at end of file diff --git a/Output/Profiles/guest3.xml b/Output/Profiles/guest3.xml index ad1d56f6..ad3c3eb5 100644 --- a/Output/Profiles/guest3.xml +++ b/Output/Profiles/guest3.xml @@ -1,10 +1,8 @@  - - Guest 3 - TR_CONFIG_EASY - Avatar_m.png - TR_USERROLE_NORMAL - TR_CONFIG_ON - + Guest 3 + TR_CONFIG_EASY + TR_USERROLE_NORMAL + TR_CONFIG_ON + Avatar_m.png \ No newline at end of file diff --git a/Output/RequiredSkinElements.xml b/Output/RequiredSkinElements.xml new file mode 100644 index 00000000..7899e53d --- /dev/null +++ b/Output/RequiredSkinElements.xml @@ -0,0 +1,48 @@ + + + + BG_Default + Menu + Button + CoverTile + SelectSlide + SelectSlidePlayer + SelectSlideArrowLeft + SelectSlideArrowRight + PopupBG + Random + ScrollUp + ScrollDown + PlayerSelector + Plus + Minus + RepeatIcon + + + BG_Video + + + Player1 + Player2 + Player3 + Player4 + Player5 + Player6 + BackgroundColor + StaticColor + StaticWarningColor + ButtonColor + ButtonSelColor + ButtonTextColor + ButtonTextSelColor + SelectSlideColor + SelectSlideSelColor + ArrowColor + ArrowSelColor + TextColor + TextSelColor + TextWarningColor + Visible + Invisible + + diff --git a/Output/Themes/Ambient.xml b/Output/Themes/Ambient.xml index 28fbc49b..91b0c674 100644 --- a/Output/Themes/Ambient.xml +++ b/Output/Themes/Ambient.xml @@ -4,14 +4,13 @@ Ambient bohning - Ambient - 0 - 2 + 0 + 2 Cursor - 40,000 - 40,000 - StaticColor + 40 + 40 + \ No newline at end of file diff --git a/Output/Themes/Ambient/Invisible.png b/Output/Themes/Ambient/Invisible.png deleted file mode 100644 index b2ff36e9..00000000 Binary files a/Output/Themes/Ambient/Invisible.png and /dev/null differ diff --git a/Output/Themes/Ambient/Screens/PopupScreenPlayerControl.xml b/Output/Themes/Ambient/Screens/PopupScreenPlayerControl.xml index a1e0b31f..f4300e82 100644 --- a/Output/Themes/Ambient/Screens/PopupScreenPlayerControl.xml +++ b/Output/Themes/Ambient/Screens/PopupScreenPlayerControl.xml @@ -1,460 +1,275 @@ - - - + + + + PopupScreenPlayerControl 1 - - + + + + Menu - - 49 - 0 - 0,00 - 1181 - 42 - - - StaticColor - - - - - - + + + 49 + 0 + 1181 + 42 + 0 + + + CoverBackground - - 55 - 2 - 0,00 - 38 - 38 - - - Visible - - - - - - + + + 55 + 2 + 38 + 38 + 0 + + + + + 410 8 - - 0,00 - + 0 27 - 769 - - - StaticColor - - - TextSColor - + + Left - - Center - + Center - Outline - - - - - - - + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Output/Themes/Ambient/Screens/PopupScreenServerQR.xml b/Output/Themes/Ambient/Screens/PopupScreenServerQR.xml index 6bf09478..dd0d120f 100644 --- a/Output/Themes/Ambient/Screens/PopupScreenServerQR.xml +++ b/Output/Themes/Ambient/Screens/PopupScreenServerQR.xml @@ -1,315 +1,191 @@ - - - + + + + PopupScreenServerQR 1 - - + + + + SongMenuBG - - 0 - 0 - -1,99 - 1280 - 720 - - - 1,00 - 1,00 - 1,00 - 0,80 - - - - - - + + 1 + 1 + 1 + 0.8 + + + 0 + 0 + 1280 + 720 + -1.99 + + + Menu - - 490 - 210 - -2,00 - 300 - 300 - - - Visible - - - - - - + + + 490 + 210 + 300 + 300 + -2 + + + Menu - - 25 - 25 - -2,00 - 200 - 200 - - - Visible - - - - - - + + + 25 + 25 + 200 + 200 + -2 + + + Menu - - 1055 - 25 - -2,00 - 200 - 200 - - - Visible - - - - - - + + + 1055 + 25 + 200 + 200 + -2 + + + Menu - - 25 - 495 - -2,00 - 200 - 200 - - - Visible - - - - - - + + + 25 + 495 + 200 + 200 + -2 + + + Menu - - 1055 - 495 - -2,00 - 200 - 200 - - - Visible - - - - - - - 640 - 515 - - -2,00 - - 35 - - 300 - - - StaticColor - - - TextSColor - - Center - - Center - - - - Outline - - - - - - - - - 640 - 265 - - -2,00 - - 45 - - 600 - - - StaticColor - - - TextSColor - - Center - - Center - - - - Outline - - TR_SCREENPSERVERQR_NOTRUNNING - - - - - - + + + 1055 + 495 + 200 + 200 + -2 + + + + + 640 180 - - -2,00 - + -2 35 - 300 - - - StaticColor - - - TextSColor - + + Center - - Center - + Center - Outline - TR_SCREENPSERVERQR_ADDRESS - - - - - - + + 125 230 - - -2,00 - + -2 27 - 200 - - - StaticColor - - - TextSColor - + + Center - - Center - + Center - Outline - Android - - - - - - + + 1155 230 - - -2,00 - + -2 27 - 200 - - - StaticColor - - - TextSColor - + + Center - - Center - + Center - Outline - Symbian - - - - - - + + 125 460 - - -2,00 - + -2 27 - 200 - - - StaticColor - - - TextSColor - + + Center - - Center - + Center - Outline - WebOS - - - - - - + + 1155 460 - - -2,00 - + -2 27 - 200 - - - StaticColor - - - TextSColor - + + Center - - Center - + Center - Outline - Windows Phone - - - - - - + + + 640 + 515 + -2 + 35 + 300 + + + Center + Center + + Outline + + + + 640 + 265 + -2 + 45 + 600 + + + Center + Center + + Outline + TR_SCREENPSERVERQR_NOTRUNNING + + + + + + + + + + + + + \ No newline at end of file diff --git a/Output/Themes/Ambient/Screens/PopupScreenVolumeControl.xml b/Output/Themes/Ambient/Screens/PopupScreenVolumeControl.xml index 80b47b72..1bb2bfdd 100644 --- a/Output/Themes/Ambient/Screens/PopupScreenVolumeControl.xml +++ b/Output/Themes/Ambient/Screens/PopupScreenVolumeControl.xml @@ -1,121 +1,90 @@ - - - + + + + PopupScreenVolumeControl 1 - - + + + + Menu - - 1065 - 672 - -2,00 - 225 - 48 - - - StaticColor - - - - - - + + + 1065 + 672 + 225 + 48 + -2 + + + + + 1067 682 - - -2,00 - + -2 27 - 80 - - - StaticColor - - - TextSColor - + + Left - - Center - + Center - Outline - TR_SCREENPVOLUMECONTROL_VOLUME - - - - - - - Invisible - + + + + + + + + Minus - Plus - - Invisible - + Minus - Plus - - Invisible - - 1090 - 680 - -2,00 - 200 - 50 - - 1195 - 682 - -2,00 - 30 - 30 - - 1240 - 682 - -2,00 - 30 - 30 - - - SelectSlideColor - - - SelectSlideSColor - - - SelectSlideHColor - - - ArrowColor - - - ArrowSColor - - - TextColor - - - TextSColor - - 27,00 - - -15,00 - - -8,00 - - 500,00 - + + 1090 + 680 + 200 + 50 + -2 + + + 1195 + 682 + 30 + 30 + -2 + + + 1240 + 682 + 30 + 30 + -2 + + + + + + + + 27 + -15 + -8 + 500 Outline - Bold - 1 - - - \ No newline at end of file + + + + + + + + + \ No newline at end of file diff --git a/Output/Themes/Ambient/Screens/ScreenHighscore.xml b/Output/Themes/Ambient/Screens/ScreenHighscore.xml index 2af500cc..4e997947 100644 --- a/Output/Themes/Ambient/Screens/ScreenHighscore.xml +++ b/Output/Themes/Ambient/Screens/ScreenHighscore.xml @@ -1,1486 +1,795 @@ - - - + + + + ScreenHighscore 2 - - + + + Video - + - BG_Default - - - BackgroundColor - - - + + + + + Menu - - 40 - 40 - 0,00 - 1200 - 50 - - - StaticColor - - - - - - + + + 40 + 40 + 1200 + 50 + 0 + + + TextBG - - 50 - 90 - 0,00 - 1180 - 610 - - - Invisible - - - - - - + + + 50 + 90 + 1180 + 610 + 0 + + + + + 60 50 - - 0,00 - + 0 27 - - - - StaticColor - - - TextSColor - + 0 + + Left - - Center - + Center - Outline - TR_SCREENHIGHSCORE_HIGHSCORE - - - - - - + + 640 50 - - 0,00 - + 0 27 - - - - StaticColor - - - TextSColor - + 0 + + Center - - Center - + Center - Outline - - - - - - - + + 1220 50 - - 0,00 - + 0 27 - - - - StaticColor - - - TextSColor - + 0 + + Right - - Center - + Center - Outline - - - - - - - + + 120 103 - - 0,00 - + 0 35 - - - - StaticColor - - - TextSColor - + 0 + + Right - - Center - + Center - Outline - - - - - - - + + 120 160 - - 0,00 - + 0 42 - - - - StaticColor - - - TextSColor - + 0 + + Right - - Center - + Center - Outline - - - - - - - + + 120 223 - - 0,00 - + 0 35 - - - - StaticColor - - - TextSColor - + 0 + + Right - - Center - + Center - Outline - - - - - - - + + 120 283 - - 0,00 - + 0 35 - - - - StaticColor - - - TextSColor - + 0 + + Right - - Center - + Center - Outline - - - - - - - + + 120 343 - - 0,00 - + 0 35 - - - - StaticColor - - - TextSColor - + 0 + + Right - - Center - + Center - Outline - - - - - - - + + 120 403 - - 0,00 - + 0 35 - - - - StaticColor - - - TextSColor - + 0 + + Right - - Center - + Center - Outline - - - - - - - + + 120 463 - - 0,00 - + 0 35 - - - - StaticColor - - - TextSColor - + 0 + + Right - - Center - + Center - Outline - - - - - - - + + 120 523 - - 0,00 - + 0 35 - - - - StaticColor - - - TextSColor - + 0 + + Right - - Center - + Center - Outline - - - - - - - + + 120 583 - - 0,00 - + 0 35 - - - - StaticColor - - - TextSColor - + 0 + + Right - - Center - + Center - Outline - - - - - - - + + 120 643 - - 0,00 - + 0 35 - - - - StaticColor - - - TextSColor - + 0 + + Right - - Center - + Center - Outline - - - - - - - + + 200 103 - - 0,00 - + 0 35 - - - - StaticColor - - - TextSColor - + 0 + + Left - - Center - + Center - Outline - - - - - - - + + 200 163 - - 0,00 - + 0 35 - - - - StaticColor - - - TextSColor - + 0 + + Left - - Center - + Center - Outline - - - - - - - + + 200 223 - - 0,00 - + 0 35 - - - - StaticColor - - - TextSColor - + 0 + + Left - - Center - + Center - Outline - - - - - - - + + 200 283 - - 0,00 - + 0 35 - - - - StaticColor - - - TextSColor - + 0 + + Left - - Center - + Center - Outline - - - - - - - + + 200 343 - - 0,00 - + 0 35 - - - - StaticColor - - - TextSColor - + 0 + + Left - - Center - + Center - Outline - - - - - - - + + 200 403 - - 0,00 - + 0 35 - - - - StaticColor - - - TextSColor - + 0 + + Left - - Center - + Center - Outline - - - - - - - + + 200 463 - - 0,00 - + 0 35 - - - - StaticColor - - - TextSColor - + 0 + + Left - - Center - + Center - Outline - - - - - - - + + 200 523 - - 0,00 - + 0 35 - - - - StaticColor - - - TextSColor - + 0 + + Left - - Center - + Center - Outline - - - - - - - + + 200 583 - - 0,00 - + 0 35 - - - - StaticColor - - - TextSColor - + 0 + + Left - - Center - + Center - Outline - - - - - - - + + 200 643 - - 0,00 - + 0 35 - - - - StaticColor - - - TextSColor - + 0 + + Left - - Center - + Center - Outline - - - - - - - + + 800 103 - - 0,00 - + 0 35 - - - - StaticColor - - - TextSColor - + 0 + + Left - - Center - + Center - Outline - - - - - - - + + 800 163 - - 0,00 - + 0 35 - - - - StaticColor - - - TextSColor - + 0 + + Left - - Center - + Center - Outline - - - - - - - + + 800 223 - - 0,00 - + 0 35 - - - - StaticColor - - - TextSColor - + 0 + + Left - - Center - + Center - Outline - - - - - - - + + 800 283 - - 0,00 - + 0 35 - - - - StaticColor - - - TextSColor - + 0 + + Left - - Center - + Center - Outline - - - - - - - + + 800 343 - - 0,00 - + 0 35 - - - - StaticColor - - - TextSColor - + 0 + + Left - - Center - + Center - Outline - - - - - - - + + 800 403 - - 0,00 - + 0 35 - - - - StaticColor - - - TextSColor - + 0 + + Left - - Center - + Center - Outline - - - - - - - + + 800 463 - - 0,00 - + 0 35 - - - - StaticColor - - - TextSColor - + 0 + + Left - - Center - + Center - Outline - - - - - - - + + 800 523 - - 0,00 - + 0 35 - - - - StaticColor - - - TextSColor - + 0 + + Left - - Center - + Center - Outline - - - - - - - + + 800 583 - - 0,00 - + 0 35 - - - - StaticColor - - - TextSColor - + 0 + + Left - - Center - + Center - Outline - - - - - - - + + 800 643 - - 0,00 - + 0 35 - - - - StaticColor - - - TextSColor - + 0 + + Left - - Center - + Center - Outline - - - - - - - + + 1000 103 - - 0,00 - + 0 35 - - - - StaticColor - - - TextSColor - + 0 + + Left - - Center - + Center - Outline - - - - - - - + + 1000 163 - - 0,00 - + 0 35 - - - - StaticColor - - - TextSColor - + 0 + + Left - - Center - + Center - Outline - - - - - - - + + 1000 223 - - 0,00 - + 0 35 - - - - StaticColor - - - TextSColor - + 0 + + Left - - Center - + Center - Outline - - - - - - - + + 1000 283 - - 0,00 - + 0 35 - - - - StaticColor - - - TextSColor - + 0 + + Left - - Center - + Center - Outline - - - - - - - + + 1000 343 - - 0,00 - + 0 35 - - - - StaticColor - - - TextSColor - + 0 + + Left - - Center - + Center - Outline - - - - - - - + + 1000 403 - - 0,00 - + 0 35 - - - - StaticColor - - - TextSColor - + 0 + + Left - - Center - + Center - Outline - - - - - - - + + 1000 463 - - 0,00 - + 0 35 - - - - StaticColor - - - TextSColor - + 0 + + Left - - Center - + Center - Outline - - - - - - - + + 1000 523 - - 0,00 - + 0 35 - - - - StaticColor - - - TextSColor - + 0 + + Left - - Center - + Center - Outline - - - - - - - + + 1000 583 - - 0,00 - + 0 35 - - - - StaticColor - - - TextSColor - + 0 + + Left - - Center - + Center - Outline - - - - - - - + + 1000 643 - - 0,00 - + 0 35 - - - - StaticColor - - - TextSColor - + 0 + + Left - - Center - + Center - Outline - - - - - - - + + + + + + + + + + + + Star - - 80 - 100 - 1,00 - 1080 - 35 - - - StaticColor - + + 80 + 100 + 1080 + 35 + 1 + + Star - - 25,00 - + 25 250 - - - + + Star - - 80 - 160 - 1,00 - 1080 - 35 - - - StaticColor - + + 80 + 160 + 1080 + 35 + 1 + + Star - - 25,00 - + 25 250 - - - + + Star - - 80 - 220 - 1,00 - 1080 - 35 - - - StaticColor - + + 80 + 220 + 1080 + 35 + 1 + + Star - - 25,00 - + 25 250 - - - + + Star - - 80 - 280 - 1,00 - 1080 - 35 - - - StaticColor - + + 80 + 280 + 1080 + 35 + 1 + + Star - - 25,00 - + 25 250 - - - + + Star - - 80 - 340 - 1,00 - 1080 - 35 - - - StaticColor - + + 80 + 340 + 1080 + 35 + 1 + + Star - - 25,00 - + 25 250 - - - + + Star - - 80 - 400 - 1,00 - 1080 - 35 - - - StaticColor - + + 80 + 400 + 1080 + 35 + 1 + + Star - - 25,00 - + 25 250 - - - + + Star - - 80 - 460 - 1,00 - 1080 - 35 - - - StaticColor - + + 80 + 460 + 1080 + 35 + 1 + + Star - - 25,00 - + 25 250 - - - + + Star - - 80 - 520 - 1,00 - 1080 - 35 - - - StaticColor - + + 80 + 520 + 1080 + 35 + 1 + + Star - - 25,00 - + 25 250 - - - + + Star - - 80 - 580 - 1,00 - 1080 - 35 - - - StaticColor - + + 80 + 580 + 1080 + 35 + 1 + + Star - - 25,00 - + 25 250 - - - + + Star - - 80 - 640 - 1,00 - 1080 - 35 - - - StaticColor - + + 80 + 640 + 1080 + 35 + 1 + + Star - - 25,00 - + 25 250 - - - \ No newline at end of file + + + + \ No newline at end of file diff --git a/Output/Themes/Ambient/Screens/ScreenLoad.xml b/Output/Themes/Ambient/Screens/ScreenLoad.xml index 36041ea4..164888a9 100644 --- a/Output/Themes/Ambient/Screens/ScreenLoad.xml +++ b/Output/Themes/Ambient/Screens/ScreenLoad.xml @@ -1,120 +1,83 @@ - - - + + + + ScreenLoad 2 - - + + + Texture - + - BG_Default - - - BackgroundColor - - - + + + + + Menu - - 50 - 644 - 0,00 - 1195 - 50 - - - Invisible - - - - - - + + + 50 + 644 + 1195 + 50 + 0 + + + + + 60 655 - - 0,00 - + 0 27 - - - - StaticColor - - - TextSColor - + 0 + + Left - Center - - Outline - TR_SCREENLOAD_LOADING - - - - - - - 640 - 305 - - 0,00 - - 101 - - - - StaticColor - - - TextSColor - - Center - - Center - - - - Outline - - TR_PROGRAM_NAME - - - - - - + + 240 655 - - 0,00 - + 0 27 - - - - StaticColor - - - TextSColor - + 0 + + Left - Center - - Outline - - - - - - - - + Gesamt: 168 Lieder (168 geladen) + + + 640 + 305 + 0 + 101 + 0 + + + Center + Center + + Outline + TR_PROGRAM_NAME + + + + + + + + + + + + + \ No newline at end of file diff --git a/Output/Themes/Ambient/Screens/ScreenMain.xml b/Output/Themes/Ambient/Screens/ScreenMain.xml index 0d256cd2..a6f426e7 100644 --- a/Output/Themes/Ambient/Screens/ScreenMain.xml +++ b/Output/Themes/Ambient/Screens/ScreenMain.xml @@ -1,318 +1,256 @@ - - - - 1 - - + + + + ScreenMain + 2 + + + Video - + - BG_Default - - - BackgroundColor - - - + + + + + Menu - - 49 - 32 - 0,00 - 1181 - 50 - - - Invisible - - - - - - + + + 49 + 32 + 1181 + 50 + 0 + + + + TextBG + + + 150 + 610 + 355 + 30 + -1.9 + + + + + + 10 + 690 + -1 + 15 + 0 + + + Left + Center + + Normal + Vocaluxe "Shining Heaven" v0.3.0 (x64) Beta (0083) + + + 320 + 612 + -2 + 27 + 355 + + + Center + Center + + Outline + TR_SCREENMAIN_TEXT_NOPROFILES + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Output/Themes/Ambient/Screens/ScreenNames.xml b/Output/Themes/Ambient/Screens/ScreenNames.xml index 5d17ebe2..fe44cdc6 100644 --- a/Output/Themes/Ambient/Screens/ScreenNames.xml +++ b/Output/Themes/Ambient/Screens/ScreenNames.xml @@ -1,1308 +1,817 @@ - - - + + + + ScreenNames 3 - - + + + Video - + - BG_Options - - - BackgroundColor - - - + + + + + Menu - - 40 - 40 - 0,00 - 1200 - 50 - - - StaticColor - - - - - - - Invisible - - 20 - 105 - -3,00 - 108 - 108 - - - Visible - - - - - - - Invisible - - 20 - 260 - -3,00 - 108 - 108 - - - Visible - - - - - - - Invisible - - 20 - 415 - -3,00 - 108 - 108 - - - Visible - - - - - - - Invisible - - 1152 - 105 - -3,00 - 108 - 108 - - - Visible - - - - - - - Invisible - - 1152 - 260 - -3,00 - 108 - 108 - - - Visible - - - - - - - Invisible - - 1152 - 415 - -3,00 - 108 - 108 - - - Visible - - - - - - + + + 40 + 40 + 1200 + 50 + 0 + + + + + + + 20 + 105 + 108 + 108 + -3 + + + + + + + 20 + 260 + 108 + 108 + -3 + + + + + + + 20 + 415 + 108 + 108 + -3 + + + + + + + 1152 + 105 + 108 + 108 + -3 + + + + + + + 1152 + 260 + 108 + 108 + -3 + + + + + + + 1152 + 415 + 108 + 108 + -3 + + + PlayerSelector - - 15 - 100 - -2,00 - 118 - 118 - - - Player1 - - - - - - + + + 15 + 100 + 118 + 118 + -2 + + + PlayerSelector - - 15 - 255 - -2,00 - 118 - 118 - - - Player2 - - - - - - + + + 15 + 255 + 118 + 118 + -2 + + + PlayerSelector - - 15 - 410 - -2,00 - 118 - 118 - - - Player3 - - - - - - + + + 15 + 410 + 118 + 118 + -2 + + + PlayerSelector - - 1147 - 100 - -2,00 - 118 - 118 - - - Player4 - - - - - - + + + 1147 + 100 + 118 + 118 + -2 + + + PlayerSelector - - 1147 - 255 - -2,00 - 118 - 118 - - - Player5 - - - - - - + + + 1147 + 255 + 118 + 118 + -2 + + + PlayerSelector - - 1147 - 410 - -2,00 - 118 - 118 - - - Player6 - - - - - - - Invisible - - 145 - 663 - 0,00 - 990 - 50 - - - StaticWarningColor - - - - - - - Invisible - - 145 - 715 - 0,00 - 990 - 50 - - - StaticWarningColor - - - - - - + + + 1147 + 410 + 118 + 118 + -2 + + + + + + + 300 + 603 + 685 + 50 + -1 + + + + + + + 300 + 654 + 685 + 50 + -1 + + + + + 640 50 - - 0,00 - + 0 27 - - - - StaticColor - - - TextSColor - + 0 + + Center - - Center - + Center - Outline - TR_SCREENNAMES_MENU - - - - - - + + 640 617 - - 0,00 - + -1.1 27 - 970 - - - TextWarningColor - - - TextWarningColor - + + Center - - Center - + Center - Outline - - - - - - - + + 640 652 - - 0,00 - + -1.1 27 - 970 - - - TextWarningColor - - - TextWarningColor - + + Center - - Center - + Center - Outline - - - - - - - + + 74 219 - - 0,00 - + 0 20 - - - - Player1 - - - TextSColor - + 0 + + Center - - Center - + Center - Outline - - - - - - - + + 74 374 - - 0,00 - + 0 20 - - - - Player2 - - - TextSColor - + 0 + + Center - - Center - + Center - Outline - - - - - - - + + 74 529 - - 0,00 - + 0 20 - - - - Player3 - - - TextSColor - + 0 + + Center - - Center - + Center - Outline - - - - - - - + + 1206 219 - - 0,00 - + 0 20 - - - - Player4 - - - TextSColor - + 0 + + Center - - Center - + Center - Outline - - - - - - - + + 1206 374 - - 0,00 - + 0 20 - - - - Player5 - - - TextSColor - + 0 + + Center - - Center - + Center - Outline - - - - - - - + + 1206 529 - - 0,00 - + 0 20 - - - - Player6 - - - TextSColor - + 0 + + Center - - Center - + Center - Outline - - - - - - - + + + + + + + + + + + SelectSlideArrowLeft - SelectSlideArrowRight - SelectSlidePlayer - SelectSlideArrowLeft - SelectSlideArrowRight - - SelectSlidePlayer - - 70 - 548 - 0,00 - 1140 - 45 - - 75 - 553 - 0,00 - 40 - 40 - - 1170 - 553 - 0,00 - 40 - 40 - - - SelectSlideColor - - - SelectSlideSColor - - - SelectSlideHColor - - - ArrowColor - - - ArrowSColor - - - TextColor - - - TextSColor - - 27,00 - - - - 186,00 - + + 70 + 548 + 1140 + 45 + 0 + + + 75 + 553 + 40 + 40 + 0 + + + 1170 + 553 + 40 + 40 + 0 + + + + + + + + 27 + 0 + 0 + 186 Outline - Bold - 6 - - - - Invisible - + + + SelectSlideArrowLeft - SelectSlideArrowRight - Button - SelectSlideArrowLeft - SelectSlideArrowRight - - Button - - 41 - 105 - -4,00 - 88 - 20 - - 20 - 105 - -4,01 - 20 - 20 - - 20 - 105 - -4,01 - 20 - 20 - - - SelectSlideColor - - - SelectSlideSColor - - - SelectSlideHColor - - - ArrowColor - - - ArrowSColor - - - TextColor - - - TextSColor - - 20,00 - - - - 86,00 - + + 41 + 105 + 88 + 20 + -4 + + + 20 + 105 + 20 + 20 + -4.01 + + + 20 + 105 + 20 + 20 + -4.01 + + + + + + + + 20 + 0 + 0 + 86 Outline - Bold - 1 - - - - Invisible - + + + SelectSlideArrowLeft - SelectSlideArrowRight - Button - SelectSlideArrowLeft - SelectSlideArrowRight - - Button - - 41 - 260 - -4,00 - 88 - 20 - - 20 - 260 - -4,01 - 20 - 20 - - 20 - 260 - -4,01 - 20 - 20 - - - SelectSlideColor - - - SelectSlideSColor - - - SelectSlideHColor - - - ArrowColor - - - ArrowSColor - - - TextColor - - - TextSColor - - 20,00 - - - - 86,00 - + + 41 + 260 + 88 + 20 + -4 + + + 20 + 260 + 20 + 20 + -4.01 + + + 20 + 260 + 20 + 20 + -4.01 + + + + + + + + 20 + 0 + 0 + 86 Outline - Bold - 1 - - - - Invisible - + + + SelectSlideArrowLeft - SelectSlideArrowRight - Button - SelectSlideArrowLeft - SelectSlideArrowRight - - Button - - 41 - 415 - -4,00 - 88 - 20 - - 20 - 415 - -4,01 - 20 - 20 - - 20 - 415 - -4,01 - 20 - 20 - - - SelectSlideColor - - - SelectSlideSColor - - - SelectSlideHColor - - - ArrowColor - - - ArrowSColor - - - TextColor - - - TextSColor - - 20,00 - - - - 86,00 - + + 41 + 415 + 88 + 20 + -4 + + + 20 + 415 + 20 + 20 + -4.01 + + + 20 + 415 + 20 + 20 + -4.01 + + + + + + + + 20 + 0 + 0 + 86 Outline - Bold - 1 - - - - Invisible - + + + SelectSlideArrowLeft - SelectSlideArrowRight - Button - SelectSlideArrowLeft - SelectSlideArrowRight - - Button - - 1152 - 105 - -4,00 - 88 - 20 - - 1240 - 105 - -4,01 - 20 - 20 - - 1240 - 105 - -4,01 - 20 - 20 - - - SelectSlideColor - - - SelectSlideSColor - - - SelectSlideHColor - - - ArrowColor - - - ArrowSColor - - - TextColor - - - TextSColor - - 20,00 - - - - 86,00 - + + 1152 + 105 + 88 + 20 + -4 + + + 1240 + 105 + 20 + 20 + -4.01 + + + 1240 + 105 + 20 + 20 + -4.01 + + + + + + + + 20 + 0 + 0 + 86 Outline - Bold - 1 - - - - Invisible - + + + SelectSlideArrowLeft - SelectSlideArrowRight - Button - SelectSlideArrowLeft - SelectSlideArrowRight - - Button - - 1152 - 260 - -4,00 - 88 - 20 - - 1240 - 260 - -4,01 - 20 - 20 - - 1240 - 260 - -4,01 - 20 - 20 - - - SelectSlideColor - - - SelectSlideSColor - - - SelectSlideHColor - - - ArrowColor - - - ArrowSColor - - - TextColor - - - TextSColor - - 20,00 - - - - 86,00 - + + 1152 + 260 + 88 + 20 + -4 + + + 1240 + 260 + 20 + 20 + -4.01 + + + 1240 + 260 + 20 + 20 + -4.01 + + + + + + + + 20 + 0 + 0 + 86 Outline - Bold - 1 - - - - Invisible - + + + SelectSlideArrowLeft - SelectSlideArrowRight - Button - SelectSlideArrowLeft - SelectSlideArrowRight - - Button - - 1152 - 415 - -4,00 - 88 - 20 - - 1240 - 415 - -4,01 - 20 - 20 - - 1240 - 415 - -4,01 - 20 - 20 - - - SelectSlideColor - - - SelectSlideSColor - - - SelectSlideHColor - - - ArrowColor - - - ArrowSColor - - - TextColor - - - TextSColor - - 20,00 - - - - 86,00 - + + 1152 + 415 + 88 + 20 + -4 + + + 1240 + 415 + 20 + 20 + -4.01 + + + 1240 + 415 + 20 + 20 + -4.01 + + + + + + + + 20 + 0 + 0 + 86 Outline - Bold - 1 - - - - 172 - 127 - 0,00 - 945 - 393 - + + + + + + + 172 + 127 + 945 + 393 + 0 + CoverTile - - - 1,00 - 1,00 - 1,00 - 0,20 - + + 1 + 1 + 1 + 0.2 + PlayerSelector - - 100 100 - 8 3 - - 20,71 - 30,00 - + 20.71 + 30 - - 2,0 - - Outline - - TextColor - - - + 2 17 + Outline + + - - - Invisible - - 21 - 152 - -4,00 - 108 - 60 - + + + + + + 21 + 152 + 108 + 60 + -4 + 8 - - 2,00 - + 2 - TR_CONFIG_OFF - - - Player1Dim2 - - - Player1Dim2 - - - - - - - Invisible - - 21 - 307 - -4,00 - 108 - 60 - + 0.4 + 0.4 + + + + + 21 + 307 + 108 + 60 + -4 + 8 - - 2,00 - + 2 - TR_CONFIG_OFF - - - Player2Dim2 - - - Player2Dim2 - - - - - - - Invisible - - 21 - 467 - -4,00 - 108 - 60 - + 0.4 + 0.4 + + + + + 21 + 467 + 108 + 60 + -4 + 8 - - 2,00 - + 2 - TR_CONFIG_OFF - - - Player3Dim2 - - - Player3Dim2 - - - - - - - Invisible - - 1153 - 152 - -4,00 - 108 - 60 - + 0.4 + 0.4 + + + + + 1153 + 152 + 108 + 60 + -4 + 8 - - 2,00 - + 2 - TR_CONFIG_OFF - - - Player4Dim2 - - - Player4Dim2 - - - - - - - Invisible - - 1153 - 307 - -4,00 - 108 - 60 - + 0.4 + 0.4 + + + + + 1153 + 307 + 108 + 60 + -4 + 8 - - 2,00 - + 2 - TR_CONFIG_OFF - - - Player5Dim2 - - - Player5Dim2 - - - - - - - Invisible - - 1153 - 467 - -4,00 - 108 - 60 - + 0.4 + 0.4 + + + + + 1153 + 467 + 108 + 60 + -4 + 8 - - 2,00 - + 2 - TR_CONFIG_OFF - - - Player6Dim2 - - - Player6Dim2 - - - - - - \ No newline at end of file + 0.4 + 0.4 + + + + + + diff --git a/Output/Themes/Ambient/Screens/ScreenOptions.xml b/Output/Themes/Ambient/Screens/ScreenOptions.xml index de798ca2..76ca27d0 100644 --- a/Output/Themes/Ambient/Screens/ScreenOptions.xml +++ b/Output/Themes/Ambient/Screens/ScreenOptions.xml @@ -1,404 +1,266 @@ - - - + + + + ScreenOptions 1 - - + + + Video - + - BG_Default - - - BackgroundColor - - - + + + + + Menu - - 50 - 32 - 0,00 - 1180 - 50 - - - Invisible - - - - - - + + + 50 + 32 + 1180 + 50 + 0 + + + + + 60 43 - - 0,00 - + 0 27 - - - - Invisible - - - Invisible - + 0 + + Left - - Center - + Center - Outline - TR_SCREENO_OPTIONS - - - - - - + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Output/Themes/Ambient/Screens/ScreenOptionsGame.xml b/Output/Themes/Ambient/Screens/ScreenOptionsGame.xml index 49c9551a..cd75ed75 100644 --- a/Output/Themes/Ambient/Screens/ScreenOptionsGame.xml +++ b/Output/Themes/Ambient/Screens/ScreenOptionsGame.xml @@ -1,848 +1,529 @@ - - - + + + + ScreenOptionsGame 2 - - + + + Video - + - BG_Options - - - BackgroundColor - - - + + + + + Menu - - 40 - 40 - 0,00 - 1200 - 50 - - - StaticColor - - - - - - - Invisible - - 50 - 100 - 0,00 - 460 - 50 - - - StaticColor - - - - - - - Invisible - - 50 - 160 - 0,00 - 460 - 50 - - - StaticColor - - - - - - - Invisible - - 50 - 220 - 0,00 - 460 - 50 - - - StaticColor - - - - - - - Invisible - - 50 - 280 - 0,00 - 460 - 50 - - - StaticColor - - - - - - - Invisible - - 50 - 340 - 0,00 - 460 - 50 - - - StaticColor - - - - - - - Invisible - - 50 - 400 - 0,00 - 460 - 50 - - - StaticColor - - - - - - + + + 40 + 40 + 1200 + 50 + 0 + + + + + + + 50 + 100 + 460 + 50 + 0 + + + + + + + 50 + 160 + 460 + 50 + 0 + + + + + + + 50 + 220 + 460 + 50 + 0 + + + + + + + 50 + 280 + 460 + 50 + 0 + + + + + + + 50 + 340 + 460 + 50 + 0 + + + + + + + 50 + 400 + 460 + 50 + 0 + + + + + 640 50 - - 0,00 - + 0 27 - - - - StaticColor - - - TextSColor - + 0 + + Center - - Center - + Center - Outline - TR_SCREENOGAME_OPTIONS - - - - - - + + 75 107 - - 0,00 - + 0 27 - - - - StaticColor - - - TextSColor - + 0 + + Left - - Center - + Center - Outline - TR_SCREENOGAME_LANGUAGE - - - - - - + + 75 167 - - 0,00 - + 0 27 - - - - StaticColor - - - TextSColor - + 0 + + Left - - Center - + Center - Outline - TR_SCREENOGAME_DEBUGLEVEL - - - - - - + + 75 227 - - 0,00 - + 0 27 - - - - StaticColor - - - TextSColor - + 0 + + Left - - Center - + Center - Outline - TR_SCREENOGAME_SONGMENU - - - - - - + + 75 287 - - 0,00 - + 0 27 - - - - StaticColor - - - TextSColor - + 0 + + Left - - Center - + Center - Outline - TR_SCREENOGAME_SONGSORTING - - - - - - + + 75 347 - - 0,00 - + 0 27 - - - - StaticColor - - - TextSColor - + 0 + + Left - - Center - + Center - Outline - TR_SCREENOGAME_TABS - - - - - - + + 75 407 - - 0,00 - + 0 27 - - - - StaticColor - - - TextSColor - + 0 + + Left - - Center - + Center - Outline - TR_SCREENOGAME_TIMERMODE - - - - - - + + + + + + + + + + + SelectSlideArrowLeft - SelectSlideArrowRight - SelectSlide - SelectSlideArrowLeft - SelectSlideArrowRight - - SelectSlide - - 500 - 100 - 0,00 - 700 - 50 - - 505 - 105 - 0,00 - 40 - 40 - - 1170 - 105 - 0,00 - 40 - 40 - - - SelectSlideColor - - - SelectSlideSColor - - - SelectSlideHColor - - - ArrowColor - - - ArrowSColor - - - TextColor - - - TextSColor - - 27,00 - - - - 205,33 - + + 500 + 100 + 700 + 50 + 0 + + + 505 + 105 + 40 + 40 + 0 + + + 1170 + 105 + 40 + 40 + 0 + + + + + + + + 27 + 0 + 0 + 205.33 Outline - Bold - 3 - - - - Invisible - + + + SelectSlideArrowLeft - SelectSlideArrowRight - SelectSlide - SelectSlideArrowLeft - SelectSlideArrowRight - - SelectSlide - - 500 - 160 - 0,00 - 700 - 50 - - 505 - 165 - 0,00 - 40 - 40 - - 1170 - 165 - 0,00 - 40 - 40 - - - SelectSlideColor - - - SelectSlideSColor - - - SelectSlideHColor - - - ArrowColor - - - ArrowSColor - - - TextColor - - - TextSColor - - 27,00 - - - - 205,33 - + + 500 + 160 + 700 + 50 + 0 + + + 505 + 165 + 40 + 40 + 0 + + + 1170 + 165 + 40 + 40 + 0 + + + + + + + + 27 + 0 + 0 + 205.33 Outline - Bold - 3 - - - - Invisible - + + + SelectSlideArrowLeft - SelectSlideArrowRight - SelectSlide - SelectSlideArrowLeft - SelectSlideArrowRight - - SelectSlide - - 500 - 220 - 0,00 - 700 - 50 - - 505 - 225 - 0,00 - 40 - 40 - - 1170 - 225 - 0,00 - 40 - 40 - - - SelectSlideColor - - - SelectSlideSColor - - - SelectSlideHColor - - - ArrowColor - - - ArrowSColor - - - TextColor - - - TextSColor - - 27,00 - - - - 205,33 - + + 500 + 220 + 700 + 50 + 0 + + + 505 + 225 + 40 + 40 + 0 + + + 1170 + 225 + 40 + 40 + 0 + + + + + + + + 27 + 0 + 0 + 205.33 Outline - Bold - 3 - - - - Invisible - + + + SelectSlideArrowLeft - SelectSlideArrowRight - SelectSlide - SelectSlideArrowLeft - SelectSlideArrowRight - - SelectSlide - - 500 - 280 - 0,00 - 700 - 50 - - 505 - 285 - 0,00 - 40 - 40 - - 1170 - 285 - 0,00 - 40 - 40 - - - SelectSlideColor - - - SelectSlideSColor - - - SelectSlideHColor - - - ArrowColor - - - ArrowSColor - - - TextColor - - - TextSColor - - 27,00 - - - - 205,33 - + + 500 + 280 + 700 + 50 + 0 + + + 505 + 285 + 40 + 40 + 0 + + + 1170 + 285 + 40 + 40 + 0 + + + + + + + + 27 + 0 + 0 + 205.33 Outline - Bold - 3 - - - - Invisible - + + + SelectSlideArrowLeft - SelectSlideArrowRight - SelectSlide - SelectSlideArrowLeft - SelectSlideArrowRight - - SelectSlide - - 500 - 340 - 0,00 - 700 - 50 - - 505 - 345 - 0,00 - 40 - 40 - - 1170 - 345 - 0,00 - 40 - 40 - - - SelectSlideColor - - - SelectSlideSColor - - - SelectSlideHColor - - - ArrowColor - - - ArrowSColor - - - TextColor - - - TextSColor - - 27,00 - - - - 308,00 - + + 500 + 340 + 700 + 50 + 0 + + + 505 + 345 + 40 + 40 + 0 + + + 1170 + 345 + 40 + 40 + 0 + + + + + + + + 27 + 0 + 0 + 308 Outline - Bold - 2 - - - - Invisible - + + + SelectSlideArrowLeft - SelectSlideArrowRight - SelectSlide - SelectSlideArrowLeft - SelectSlideArrowRight - - SelectSlide - - 500 - 400 - 0,00 - 700 - 50 - - 505 - 405 - 0,00 - 40 - 40 - - 1170 - 405 - 0,00 - 40 - 40 - - - SelectSlideColor - - - SelectSlideSColor - - - SelectSlideHColor - - - ArrowColor - - - ArrowSColor - - - TextColor - - - TextSColor - - 27,00 - - - - 205,33 - + + 500 + 400 + 700 + 50 + 0 + + + 505 + 405 + 40 + 40 + 0 + + + 1170 + 405 + 40 + 40 + 0 + + + + + + + + 27 + 0 + 0 + 205.33 Outline - Bold - 3 - - - + + + + + + + + + diff --git a/Output/Themes/Ambient/Screens/ScreenOptionsLyrics.xml b/Output/Themes/Ambient/Screens/ScreenOptionsLyrics.xml index 2fa9d49b..4ad2bbf6 100644 --- a/Output/Themes/Ambient/Screens/ScreenOptionsLyrics.xml +++ b/Output/Themes/Ambient/Screens/ScreenOptionsLyrics.xml @@ -1,311 +1,204 @@ - - - + + + + ScreenOptionsLyrics 2 - - + + + Video - + - BG_Options - - - BackgroundColor - - - + + + + + Menu - - 40 - 40 - 0,00 - 1200 - 50 - - - StaticColor - - - - - - + + + 40 + 40 + 1200 + 50 + 0 + + + + + 640 50 - - 0,00 - + 0 27 - - - - StaticColor - - - TextSColor - + 0 + + Center - - Center - + Center - Outline - TR_SCREENOLYRICS_OPTIONS - - - - - - + + 75 107 - - 0,00 - + 0 27 - - - - StaticColor - - - TextSColor - + 0 + + Left - - Center - + Center - Outline - TR_SCREENOLYRICS_STYLE - - - - - - + + 75 167 - - 0,00 - + 0 27 - - - - StaticColor - - - TextSColor - + 0 + + Left - - Center - + Center - Outline - TR_SCREENOLYRICS_POSITION - - - - - - + + + + + + + + + + SelectSlideArrowLeft - SelectSlideArrowRight - SelectSlide - SelectSlideArrowLeft - SelectSlideArrowRight - - SelectSlide - - 500 - 100 - 0,00 - 700 - 50 - - 505 - 105 - 0,00 - 40 - 40 - - 1170 - 105 - 0,00 - 40 - 40 - - - SelectSlideColor - - - SelectSlideSColor - - - SelectSlideHColor - - - ArrowColor - - - ArrowSColor - - - TextColor - - - TextSColor - - 27,00 - - - - 205,33 - + + 500 + 100 + 700 + 50 + 0 + + + 505 + 105 + 40 + 40 + 0 + + + 1170 + 105 + 40 + 40 + 0 + + + + + + + + 27 + 0 + 0 + 205.33 Outline - Bold - 4 - - - - Invisible - + + + SelectSlideArrowLeft - SelectSlideArrowRight - SelectSlide - SelectSlideArrowLeft - SelectSlideArrowRight - - SelectSlide - - 500 - 160 - 0,00 - 700 - 50 - - 505 - 165 - 0,00 - 40 - 40 - - 1170 - 165 - 0,00 - 40 - 40 - - - SelectSlideColor - - - SelectSlideSColor - - - SelectSlideHColor - - - ArrowColor - - - ArrowSColor - - - TextColor - - - TextSColor - - 27,00 - - - - 205,33 - + + 500 + 160 + 700 + 50 + 0 + + + 505 + 165 + 40 + 40 + 0 + + + 1170 + 165 + 40 + 40 + 0 + + + + + + + + 27 + 0 + 0 + 205.33 Outline - Bold - 2 - - - \ No newline at end of file + + + + + + + + + \ No newline at end of file diff --git a/Output/Themes/Ambient/Screens/ScreenOptionsRecord.xml b/Output/Themes/Ambient/Screens/ScreenOptionsRecord.xml index 77c04934..f5696725 100644 --- a/Output/Themes/Ambient/Screens/ScreenOptionsRecord.xml +++ b/Output/Themes/Ambient/Screens/ScreenOptionsRecord.xml @@ -1,838 +1,522 @@ - - - + + + + ScreenOptionsRecord 4 - - + + + Video - + - BG_Options - - - BackgroundColor - - - + + + + + Menu - - 40 - 40 - 0,00 - 1200 - 50 - - - StaticColor - - - - - - - Invisible - - 50 - 100 - 0,00 - 460 - 50 - - - StaticColor - - - - - - - Invisible - - 50 - 160 - 0,00 - 460 - 50 - - - StaticColor - - - - - - - Invisible - - 50 - 220 - 0,00 - 460 - 50 - - - StaticColor - - - - - - - Invisible - - 50 - 280 - 0,00 - 460 - 50 - - - StaticColor - - - - - - - Invisible - - 50 - 340 - 0,00 - 460 - 50 - - - StaticColor - - - - - - - Invisible - - 145 - 530 - 0,00 - 990 - 50 - - - StaticWarningColor - - - - - - + + + 40 + 40 + 1200 + 50 + 0 + + + + + + + 50 + 100 + 460 + 50 + 0 + + + + + + + 50 + 160 + 460 + 50 + 0 + + + + + + + 50 + 220 + 460 + 50 + 0 + + + + + + + 50 + 280 + 460 + 50 + 0 + + + + + + + 50 + 340 + 460 + 50 + 0 + + + + + + + 145 + 530 + 990 + 50 + 0 + + + EnergyBeam - - 390 - 234 - 0,00 - 100 - 16 - - - Visible - - - - - - + + + 390 + 234 + 100 + 16 + 0 + + + EnergyBeam - - 390 - 296 - 0,00 - 100 - 16 - - - Visible - - - - - - + + + 390 + 296 + 100 + 16 + 0 + + + + + 640 55 - - 0,00 - + 0 27 - - - - StaticColor - - - TextSColor - + 0 + + Center - - Center - + Center - Outline - TR_SCREENORECORD_OPTIONS - - - - - - + + 75 106 - - 0,00 - + 0 27 - - - - StaticColor - - - TextSColor - + 0 + + Left - - Center - + Center - Outline - TR_SCREENORECORD_DEVICE - - - - - - + + 75 347 - - 0,00 - + 0 27 - - - - StaticColor - - - TextSColor - + 0 + + Left - - Center - + Center - Outline - TR_SCREENORECORD_MIC_DELAY - - - - - - - 75 - 227 - - 0,00 - - 27 - - - - StaticColor - - - TextSColor - - Left - - Center - - - - Outline - - TR_SCREENORECORD_CHANNEL_1 - - - - - - - 75 - 287 - - 0,00 - - 27 - - - - StaticColor - - - TextSColor - - Left - - Center - - - - Outline - - TR_SCREENORECORD_CHANNEL_2 - - - - - - + + 640 537 - - 0,00 - + 0 27 - 970 - - - TextWarningColor - - - TextWarningColor - + + Center - - Center - + Center - Outline - TR_SCREENORECORD_MIC_WARNING - - - - - - + + + 75 + 227 + 0 + 27 + 0 + + + Left + Center + + Outline + TR_SCREENORECORD_CHANNEL_1 + + + 75 + 287 + 0 + 27 + 0 + + + Left + Center + + Outline + TR_SCREENORECORD_CHANNEL_2 + + 330 227 - - -1,00 - + -1 27 - - - - StaticColor - - - TextSColor - + 0 + + Right - - Center - + Center - Outline - - - - - - - + + 330 287 - - -1,00 - + -1 27 - - - - StaticColor - - - TextSColor - + 0 + + Right - - Center - + Center - Outline - - - - - - - + + + + + + + + + + + SelectSlideArrowLeft - SelectSlideArrowRight - SelectSlide - SelectSlideArrowLeft - SelectSlideArrowRight - - SelectSlide - - 500 - 100 - 0,00 - 700 - 50 - - 505 - 105 - 0,00 - 40 - 40 - - 1170 - 105 - 0,00 - 40 - 40 - - - SelectSlideColor - - - SelectSlideSColor - - - SelectSlideHColor - - - ArrowColor - - - ArrowSColor - - - TextColor - - - TextSColor - - 27,00 - - - - 616,00 - + + 500 + 100 + 700 + 50 + 0 + + + 505 + 105 + 40 + 40 + 0 + + + 1170 + 105 + 40 + 40 + 0 + + + + + + + + 27 + 0 + 0 + 616 Outline - Bold - 1 - - - - Invisible - + + + SelectSlideArrowLeft - SelectSlideArrowRight - SelectSlide - SelectSlideArrowLeft - SelectSlideArrowRight - - SelectSlide - - 500 - 220 - 0,00 - 700 - 50 - - 505 - 225 - 0,00 - 40 - 40 - - 1170 - 225 - 0,00 - 40 - 40 - - - SelectSlideColor - - - SelectSlideSColor - - - SelectSlideHColor - - - ArrowColor - - - ArrowSColor - - - TextColor - - - TextSColor - - 27,00 - - - - 154,00 - + + 500 + 220 + 700 + 50 + 0 + + + 505 + 225 + 40 + 40 + 0 + + + 1170 + 225 + 40 + 40 + 0 + + + + + + + + 27 + 0 + 0 + 154 Outline - Bold - 7 - - - - Invisible - + + + SelectSlideArrowLeft - SelectSlideArrowRight - SelectSlide - SelectSlideArrowLeft - SelectSlideArrowRight - - SelectSlide - - 500 - 280 - 0,00 - 700 - 50 - - 505 - 285 - 0,00 - 40 - 40 - - 1170 - 285 - 0,00 - 40 - 40 - - - SelectSlideColor - - - SelectSlideSColor - - - SelectSlideHColor - - - ArrowColor - - - ArrowSColor - - - TextColor - - - TextSColor - - 27,00 - - - - 154,00 - + + 500 + 280 + 700 + 50 + 0 + + + 505 + 285 + 40 + 40 + 0 + + + 1170 + 285 + 40 + 40 + 0 + + + + + + + + 27 + 0 + 0 + 154 Outline - Bold - 7 - - - - Invisible - + + + SelectSlideArrowLeft - SelectSlideArrowRight - SelectSlide - SelectSlideArrowLeft - SelectSlideArrowRight - - SelectSlide - - 500 - 340 - 0,00 - 700 - 50 - - 505 - 345 - 0,00 - 40 - 40 - - 1170 - 345 - 0,00 - 40 - 40 - - - SelectSlideColor - - - SelectSlideSColor - - - SelectSlideHColor - - - ArrowColor - - - ArrowSColor - - - TextColor - - - TextSColor - - 27,00 - - - - 123,20 - + + 500 + 340 + 700 + 50 + 0 + + + 505 + 345 + 40 + 40 + 0 + + + 1170 + 345 + 40 + 40 + 0 + + + + + + + + 27 + 0 + 0 + 123.2 Outline - Bold - 5 - - - - Invisible - - 50 - 400 - -1,00 - 230 - 150 - + + + + + + + + + 50 + 400 + 230 + 150 + -1 + 12 - - 2,00 - + 2 - TR_CONFIG_OFF - - - ButtonColor - - - ButtonTextColor - - - + + - 10 26 + 10 - - - - Invisible - - 400 - 400 - -1,00 - 230 - 150 - + + + + + 400 + 400 + 230 + 150 + -1 + 12 - - 2,00 - + 2 - TR_CONFIG_OFF - - - ButtonColor - - - ButtonTextColor - - - + + - 10 26 + 10 - - - + + + + + + diff --git a/Output/Themes/Ambient/Screens/ScreenOptionsSound.xml b/Output/Themes/Ambient/Screens/ScreenOptionsSound.xml index 3472b1ab..ae35c3bc 100644 --- a/Output/Themes/Ambient/Screens/ScreenOptionsSound.xml +++ b/Output/Themes/Ambient/Screens/ScreenOptionsSound.xml @@ -1,599 +1,372 @@ - - - + + + + ScreenOptionsSound 3 - - + + + Video - + - BG_Options - - - BackgroundColor - - - + + + + + Menu - - 40 - 40 - 0,00 - 1200 - 50 - - - StaticColor - - - - - - + + + 40 + 40 + 1200 + 50 + 0 + + + + + 640 50 - - 0,00 - + 0 27 - - - - StaticColor - - - TextSColor - + 0 + + Center - - Center - + Center - Outline - TR_SCREENOSOUND_OPTIONS - - - - - - + + 75 107 - - 0,00 - + 0 27 - - - - StaticColor - - - TextSColor - + 0 + + Left - - Center - + Center - Outline - TR_SCREENOSOUND_BACKGROUNDMUSIC - - - - - - + + 75 167 - - 0,00 - + 0 27 - - - - StaticColor - - - TextSColor - + 0 + + Left - - Center - + Center - Outline - TR_SCREENOSOUND_BACKGROUNDMUSICVOLUME - - - - - - + + 75 227 - - 0,00 - + 0 27 - - - - StaticColor - - - TextSColor - + 0 + + Left - - Center - + Center - Outline - TR_SCREENOSOUND_BACKGROUNDMUSICSOURCE - - - - - - + + 75 287 - - 0,00 - + 0 27 - - - - StaticColor - - - TextSColor - + 0 + + Left - - Center - + Center - Outline - TR_SCREENOSOUND_PREVIEWMUSICVOLUME - - - - - - + + 75 347 - - 0,00 - + 0 27 - - - - StaticColor - - - TextSColor - + 0 + + Left - - Center - + Center - Outline - TR_SCREENOSOUND_GAMEMUSICVOLUME - - - - - - + + + + + + + + + + SelectSlideArrowLeft - SelectSlideArrowRight - SelectSlide - SelectSlideArrowLeft - SelectSlideArrowRight - - SelectSlide - - 500 - 100 - 0,00 - 700 - 50 - - 505 - 105 - 0,00 - 40 - 40 - - 1170 - 105 - 0,00 - 40 - 40 - - - SelectSlideColor - - - SelectSlideSColor - - - SelectSlideHColor - - - ArrowColor - - - ArrowSColor - - - TextColor - - - TextSColor - - 27,00 - - - - 205,33 - + + 500 + 100 + 700 + 50 + 0 + + + 505 + 105 + 40 + 40 + 0 + + + 1170 + 105 + 40 + 40 + 0 + + + + + + + + 27 + 0 + 0 + 205.33 Outline - Bold - 3 - - - - Invisible - + + + SelectSlideArrowLeft - SelectSlideArrowRight - SelectSlide - SelectSlideArrowLeft - SelectSlideArrowRight - - SelectSlide - - 500 - 160 - 0,00 - 700 - 50 - - 505 - 165 - 0,00 - 40 - 40 - - 1170 - 165 - 0,00 - 40 - 40 - - - SelectSlideColor - - - SelectSlideSColor - - - SelectSlideHColor - - - ArrowColor - - - ArrowSColor - - - TextColor - - - TextSColor - - 27,00 - - - - 205,33 - + + 500 + 160 + 700 + 50 + 0 + + + 505 + 165 + 40 + 40 + 0 + + + 1170 + 165 + 40 + 40 + 0 + + + + + + + + 27 + 0 + 0 + 205.33 Outline - Bold - 3 - - - - Invisible - + + + SelectSlideArrowLeft - SelectSlideArrowRight - SelectSlide - SelectSlideArrowLeft - SelectSlideArrowRight - - SelectSlide - - 500 - 220 - 0,00 - 700 - 50 - - 505 - 225 - 0,00 - 40 - 40 - - 1170 - 225 - 0,00 - 40 - 40 - - - SelectSlideColor - - - SelectSlideSColor - - - SelectSlideHColor - - - ArrowColor - - - ArrowSColor - - - TextColor - - - TextSColor - - 27,00 - - - - 500,00 - + + 500 + 220 + 700 + 50 + 0 + + + 505 + 225 + 40 + 40 + 0 + + + 1170 + 225 + 40 + 40 + 0 + + + + + + + + 27 + 0 + 0 + 500 Outline - Bold - 1 - - - - Invisible - + + + SelectSlideArrowLeft - SelectSlideArrowRight - SelectSlide - SelectSlideArrowLeft - SelectSlideArrowRight - - SelectSlide - - 500 - 280 - 0,00 - 700 - 50 - - 505 - 285 - 0,00 - 40 - 40 - - 1170 - 285 - 0,00 - 40 - 40 - - - SelectSlideColor - - - SelectSlideSColor - - - SelectSlideHColor - - - ArrowColor - - - ArrowSColor - - - TextColor - - - TextSColor - - 27,00 - - - - 500,00 - + + 500 + 280 + 700 + 50 + 0 + + + 505 + 285 + 40 + 40 + 0 + + + 1170 + 285 + 40 + 40 + 0 + + + + + + + + 27 + 0 + 0 + 500 Outline - Bold - 3 - - - - Invisible - + + + SelectSlideArrowLeft - SelectSlideArrowRight - SelectSlide - SelectSlideArrowLeft - SelectSlideArrowRight - - SelectSlide - - 500 - 340 - 0,00 - 700 - 50 - - 505 - 345 - 0,00 - 40 - 40 - - 1170 - 345 - 0,00 - 40 - 40 - - - SelectSlideColor - - - SelectSlideSColor - - - SelectSlideHColor - - - ArrowColor - - - ArrowSColor - - - TextColor - - - TextSColor - - 27,00 - - - - 500,00 - + + 500 + 340 + 700 + 50 + 0 + + + 505 + 345 + 40 + 40 + 0 + + + 1170 + 345 + 40 + 40 + 0 + + + + + + + + 27 + 0 + 0 + 500 Outline - Bold - 3 - - - \ No newline at end of file + + + + + + + + + \ No newline at end of file diff --git a/Output/Themes/Ambient/Screens/ScreenOptionsTheme.xml b/Output/Themes/Ambient/Screens/ScreenOptionsTheme.xml index a66566e2..3f0e890c 100644 --- a/Output/Themes/Ambient/Screens/ScreenOptionsTheme.xml +++ b/Output/Themes/Ambient/Screens/ScreenOptionsTheme.xml @@ -1,1015 +1,628 @@ - - - + + + + ScreenOptionsTheme 3 - - + + + Video - + - BG_Options - - - BackgroundColor - - - + + + + + Menu - - 40 - 40 - 0,00 - 1200 - 50 - - - StaticColor - - - - - - - Invisible - - 50 - 100 - 0,00 - 460 - 50 - - - StaticColor - - - - - - - Invisible - - 50 - 160 - 0,00 - 460 - 50 - - - StaticColor - - - - - - - Invisible - - 50 - 220 - 0,00 - 460 - 50 - - - StaticColor - - - - - - - Invisible - - 50 - 280 - 0,00 - 460 - 50 - - - StaticColor - - - - - - - Invisible - - 50 - 340 - 0,00 - 460 - 50 - - - StaticColor - - - - - - - Invisible - - 50 - 400 - 0,00 - 460 - 50 - - - StaticColor - - - - - - - Invisible - - 50 - 460 - 0,00 - 460 - 50 - - - StaticColor - - - - - - - Invisible - - 50 - 520 - 0,00 - 460 - 50 - - - StaticColor - - - - - - + + + 40 + 40 + 1200 + 50 + 0 + + + + + + + 50 + 100 + 460 + 50 + 0 + + + + + + + 50 + 160 + 460 + 50 + 0 + + + + + + + 50 + 220 + 460 + 50 + 0 + + + + + + + 50 + 280 + 460 + 50 + 0 + + + + + + + 50 + 340 + 460 + 50 + 0 + + + + + + + 50 + 400 + 460 + 50 + 0 + + + + + + + 50 + 460 + 460 + 50 + 0 + + + + + + + 50 + 520 + 460 + 50 + 0 + + + + + 640 50 - - 0,00 - + 0 27 - - - - StaticColor - - - TextSColor - + 0 + + Center - - Center - + Center - Outline - TR_SCREENOTHEME_OPTIONS - - - - - - + + 75 107 - - 0,00 - + 0 27 - - - - StaticColor - - - TextSColor - + 0 + + Left - - Center - + Center - Outline - TR_SCREENOTHEME_THEME - - - - - - + + 75 167 - - 0,00 - + 0 27 - - - - StaticColor - - - TextSColor - + 0 + + Left - - Center - + Center - Outline - TR_SCREENOTHEME_SKIN - - - - - - + + 75 227 - - 0,00 - + 0 27 - - - - StaticColor - - - TextSColor - + 0 + + Left - - Center - + Center - Outline - TR_SCREENOTHEME_COVERTHEME - - - - - - + + 75 287 - - 0,00 - + 0 27 - - - - StaticColor - - - TextSColor - + 0 + + Left - - Center - + Center - Outline - TR_SCREENOTHEME_NOTELINES - - - - - - + + 75 347 - - 0,00 - + 0 27 - - - - StaticColor - - - TextSColor - + 0 + + Left - - Center - + Center - Outline - TR_SCREENOTHEME_TONEHELPER - - - - - - + + 75 407 - - 0,00 - + 0 27 - - - - StaticColor - - - TextSColor - + 0 + + Left - - Center - + Center - Outline - TR_SCREENOTHEME_TIMERLOOK - - - - - - + + 75 467 - - 0,00 - + 0 27 - - - - StaticColor - - - TextSColor - + 0 + + Left - - Center - + Center - Outline - TR_SCREENOTHEME_FADEINFO - - - - - - + + 75 527 - - 0,00 - + 0 27 - - - - StaticColor - - - TextSColor - + 0 + + Left - - Center - + Center - Outline - TR_SCREENOTHEME_COVERLOADING - - - - - - + + + + + + + + + + SelectSlideArrowLeft - SelectSlideArrowRight - SelectSlide - SelectSlideArrowLeft - SelectSlideArrowRight - - SelectSlide - - 500 - 100 - 0,00 - 700 - 50 - - 505 - 105 - 0,00 - 40 - 40 - - 1170 - 105 - 0,00 - 40 - 40 - - - SelectSlideColor - - - SelectSlideSColor - - - SelectSlideHColor - - - ArrowColor - - - ArrowSColor - - - TextColor - - - TextSColor - - 27,00 - - - - 616,00 - + + 500 + 100 + 700 + 50 + 0 + + + 505 + 105 + 40 + 40 + 0 + + + 1170 + 105 + 40 + 40 + 0 + + + + + + + + 27 + 0 + 0 + 616 Outline - Bold - 1 - - - - Invisible - + + + SelectSlideArrowLeft - SelectSlideArrowRight - SelectSlide - SelectSlideArrowLeft - SelectSlideArrowRight - - SelectSlide - - 500 - 160 - 0,00 - 700 - 50 - - 505 - 165 - 0,00 - 40 - 40 - - 1170 - 165 - 0,00 - 40 - 40 - - - SelectSlideColor - - - SelectSlideSColor - - - SelectSlideHColor - - - ArrowColor - - - ArrowSColor - - - TextColor - - - TextSColor - - 27,00 - - - - 616,00 - + + 500 + 160 + 700 + 50 + 0 + + + 505 + 165 + 40 + 40 + 0 + + + 1170 + 165 + 40 + 40 + 0 + + + + + + + + 27 + 0 + 0 + 616 Outline - Bold - 1 - - - - Invisible - + + + SelectSlideArrowLeft - SelectSlideArrowRight - SelectSlide - SelectSlideArrowLeft - SelectSlideArrowRight - - SelectSlide - - 500 - 220 - 0,00 - 700 - 50 - - 505 - 225 - 0,00 - 40 - 40 - - 1170 - 225 - 0,00 - 40 - 40 - - - SelectSlideColor - - - SelectSlideSColor - - - SelectSlideHColor - - - ArrowColor - - - ArrowSColor - - - TextColor - - - TextSColor - - 27,00 - - - - 308,00 - + + 500 + 220 + 700 + 50 + 0 + + + 505 + 225 + 40 + 40 + 0 + + + 1170 + 225 + 40 + 40 + 0 + + + + + + + + 27 + 0 + 0 + 308 Outline - Bold - 2 - - - - Invisible - + + + SelectSlideArrowLeft - SelectSlideArrowRight - SelectSlide - SelectSlideArrowLeft - SelectSlideArrowRight - - SelectSlide - - 500 - 280 - 0,00 - 700 - 50 - - 505 - 285 - 0,00 - 40 - 40 - - 1170 - 285 - 0,00 - 40 - 40 - - - SelectSlideColor - - - SelectSlideSColor - - - SelectSlideHColor - - - ArrowColor - - - ArrowSColor - - - TextColor - - - TextSColor - - 27,00 - - - - 308,00 - + + 500 + 280 + 700 + 50 + 0 + + + 505 + 285 + 40 + 40 + 0 + + + 1170 + 285 + 40 + 40 + 0 + + + + + + + + 27 + 0 + 0 + 308 Outline - Bold - 2 - - - - Invisible - + + + SelectSlideArrowLeft - SelectSlideArrowRight - SelectSlide - SelectSlideArrowLeft - SelectSlideArrowRight - - SelectSlide - - 500 - 340 - 0,00 - 700 - 50 - - 505 - 345 - 0,00 - 40 - 40 - - 1170 - 345 - 0,00 - 40 - 40 - - - SelectSlideColor - - - SelectSlideSColor - - - SelectSlideHColor - - - ArrowColor - - - ArrowSColor - - - TextColor - - - TextSColor - - 27,00 - - - - 308,00 - + + 500 + 340 + 700 + 50 + 0 + + + 505 + 345 + 40 + 40 + 0 + + + 1170 + 345 + 40 + 40 + 0 + + + + + + + + 27 + 0 + 0 + 308 Outline - Bold - 2 - - - - Invisible - + + + SelectSlideArrowLeft - SelectSlideArrowRight - SelectSlide - SelectSlideArrowLeft - SelectSlideArrowRight - - SelectSlide - - 500 - 400 - 0,00 - 700 - 50 - - 505 - 405 - 0,00 - 40 - 40 - - 1170 - 405 - 0,00 - 40 - 40 - - - SelectSlideColor - - - SelectSlideSColor - - - SelectSlideHColor - - - ArrowColor - - - ArrowSColor - - - TextColor - - - TextSColor - - 27,00 - - - - 308,00 - + + 500 + 400 + 700 + 50 + 0 + + + 505 + 405 + 40 + 40 + 0 + + + 1170 + 405 + 40 + 40 + 0 + + + + + + + + 27 + 0 + 0 + 308 Outline - Bold - 2 - - - - Invisible - + + + SelectSlideArrowLeft - SelectSlideArrowRight - SelectSlide - SelectSlideArrowLeft - SelectSlideArrowRight - - SelectSlide - - 500 - 460 - 0,00 - 700 - 50 - - 505 - 465 - 0,00 - 40 - 40 - - 1170 - 465 - 0,00 - 40 - 40 - - - SelectSlideColor - - - SelectSlideSColor - - - SelectSlideHColor - - - ArrowColor - - - ArrowSColor - - - TextColor - - - TextSColor - - 27,00 - - - - 616,00 - + + 500 + 460 + 700 + 50 + 0 + + + 505 + 465 + 40 + 40 + 0 + + + 1170 + 465 + 40 + 40 + 0 + + + + + + + + 27 + 0 + 0 + 616 Outline - Bold - 2 - - - - Invisible - + + + SelectSlideArrowLeft - SelectSlideArrowRight - SelectSlide - SelectSlideArrowLeft - SelectSlideArrowRight - - SelectSlide - - 500 - 520 - 0,00 - 700 - 50 - - 505 - 525 - 0,00 - 40 - 40 - - 1170 - 525 - 0,00 - 40 - 40 - - - SelectSlideColor - - - SelectSlideSColor - - - SelectSlideHColor - - - ArrowColor - - - ArrowSColor - - - TextColor - - - TextSColor - - 27,00 - - - - 616,00 - + + 500 + 520 + 700 + 50 + 0 + + + 505 + 525 + 40 + 40 + 0 + + + 1170 + 525 + 40 + 40 + 0 + + + + + + + + 27 + 0 + 0 + 616 Outline - Bold - 1 - - - \ No newline at end of file + + + + + + + + + \ No newline at end of file diff --git a/Output/Themes/Ambient/Screens/ScreenOptionsVideo.xml b/Output/Themes/Ambient/Screens/ScreenOptionsVideo.xml index cabb55d9..b5740cc5 100644 --- a/Output/Themes/Ambient/Screens/ScreenOptionsVideo.xml +++ b/Output/Themes/Ambient/Screens/ScreenOptionsVideo.xml @@ -1,816 +1,507 @@ - - - + + + + ScreenOptionsVideo 5 - - + + + Video - + - BG_Options - - - BackgroundColor - - - + + + + + Menu - - 40 - 40 - 0,00 - 1200 - 50 - - - StaticColor - - - - - - - Invisible - - 50 - 100 - 0,00 - 460 - 50 - - - StaticColor - - - - - - - Invisible - - 50 - 160 - 0,00 - 460 - 50 - - - StaticColor - - - - - - - Invisible - - 50 - 220 - 0,00 - 460 - 50 - - - StaticColor - - - - - - - Invisible - - 550 - 460 - 0,00 - 320 - 240 - - - Visible - - - - - - + + + 40 + 40 + 1200 + 50 + 0 + + + + + + + 50 + 100 + 460 + 50 + 0 + + + + + + + 50 + 160 + 460 + 50 + 0 + + + + + + + 50 + 220 + 460 + 50 + 0 + + + + + + + 550 + 460 + 320 + 240 + 0 + + + + + 640 50 - - 0,00 - + 0 27 - - - - StaticColor - - - TextSColor - + 0 + + Center - - Center - + Center - Outline - TR_SCREENOVIDEO_OPTIONS - - - - - - + + 75 107 - - 0,00 - + 0 27 - - - - StaticColor - - - TextSColor - + 0 + + Left - - Center - + Center - Outline - TR_SCREENOVIDEO_VIDEOBACKGROUNDS - - - - - - + + 75 167 - - 0,00 - + 0 27 - - - - StaticColor - - - TextSColor - + 0 + + Left - - Center - + Center - Outline - TR_SCREENOVIDEO_VIDEOPREVIEW - - - - - - + + 75 227 - - 0,00 - + 0 27 - - - - StaticColor - - - TextSColor - + 0 + + Left - - Center - + Center - Outline - TR_SCREENOVIDEO_VIDEOINSONGS - - - - - - + + 75 287 - - 0,00 - + 0 27 - - - - StaticColor - - - TextSColor - + 0 + + Left - - Center - + Center - Outline - TR_SCREENOVIDEO_VIDEOSTOBACKGROUND - - - - - - + + 75 347 - - 0,00 - + 0 27 - - - - StaticColor - - - TextSColor - + 0 + + Left - - Center - + Center - Outline - TR_SCREENOVIDEO_WEBCAMDEVICES - - - - - - + + 75 407 - - 0,00 - + 0 27 - - - - StaticColor - - - TextSColor - + 0 + + Left - - Center - + Center - Outline - TR_SCREENOVIDEO_WEBCAMRESOLUTION - - - - - - + + + + + + + + + + + SelectSlideArrowLeft - SelectSlideArrowRight - SelectSlide - SelectSlideArrowLeft - SelectSlideArrowRight - - SelectSlide - - 500 - 100 - 0,00 - 700 - 50 - - 505 - 105 - 0,00 - 40 - 40 - - 1170 - 105 - 0,00 - 40 - 40 - - - SelectSlideColor - - - SelectSlideSColor - - - SelectSlideHColor - - - ArrowColor - - - ArrowSColor - - - TextColor - - - TextSColor - - 27,00 - - - - 205,33 - + + 500 + 100 + 700 + 50 + 0 + + + 505 + 105 + 40 + 40 + 0 + + + 1170 + 105 + 40 + 40 + 0 + + + + + + + + 27 + 0 + 0 + 205.33 Outline - Bold - 3 - - - - Invisible - + + + SelectSlideArrowLeft - SelectSlideArrowRight - SelectSlide - SelectSlideArrowLeft - SelectSlideArrowRight - - SelectSlide - - 500 - 160 - 0,00 - 700 - 50 - - 505 - 165 - 0,00 - 40 - 40 - - 1170 - 165 - 0,00 - 40 - 40 - - - SelectSlideColor - - - SelectSlideSColor - - - SelectSlideHColor - - - ArrowColor - - - ArrowSColor - - - TextColor - - - TextSColor - - 27,00 - - - - 205,33 - + + 500 + 160 + 700 + 50 + 0 + + + 505 + 165 + 40 + 40 + 0 + + + 1170 + 165 + 40 + 40 + 0 + + + + + + + + 27 + 0 + 0 + 205.33 Outline - Bold - 3 - - - - Invisible - + + + SelectSlideArrowLeft - SelectSlideArrowRight - SelectSlide - SelectSlideArrowLeft - SelectSlideArrowRight - - SelectSlide - - 500 - 220 - 0,00 - 700 - 50 - - 505 - 225 - 0,00 - 40 - 40 - - 1170 - 225 - 0,00 - 40 - 40 - - - SelectSlideColor - - - SelectSlideSColor - - - SelectSlideHColor - - - ArrowColor - - - ArrowSColor - - - TextColor - - - TextSColor - - 27,00 - - - - 205,33 - + + 500 + 220 + 700 + 50 + 0 + + + 505 + 225 + 40 + 40 + 0 + + + 1170 + 225 + 40 + 40 + 0 + + + + + + + + 27 + 0 + 0 + 205.33 Outline - Bold - 3 - - - - Invisible - + + + SelectSlideArrowLeft - SelectSlideArrowRight - SelectSlide - SelectSlideArrowLeft - SelectSlideArrowRight - - SelectSlide - - 500 - 280 - 0,00 - 700 - 50 - - 505 - 285 - 0,00 - 40 - 40 - - 1170 - 285 - 0,00 - 40 - 40 - - - SelectSlideColor - - - SelectSlideSColor - - - SelectSlideHColor - - - ArrowColor - - - ArrowSColor - - - TextColor - - - TextSColor - - 27,00 - - - - 205,33 - + + 500 + 280 + 700 + 50 + 0 + + + 505 + 285 + 40 + 40 + 0 + + + 1170 + 285 + 40 + 40 + 0 + + + + + + + + 27 + 0 + 0 + 205.33 Outline - Bold - 3 - - - - Invisible - + + + SelectSlideArrowLeft - SelectSlideArrowRight - SelectSlide - SelectSlideArrowLeft - SelectSlideArrowRight - - SelectSlide - - 500 - 340 - 0,00 - 700 - 50 - - 505 - 345 - 0,00 - 40 - 40 - - 1170 - 345 - 0,00 - 40 - 40 - - - SelectSlideColor - - - SelectSlideSColor - - - SelectSlideHColor - - - ArrowColor - - - ArrowSColor - - - TextColor - - - TextSColor - - 27,00 - - - - 205,33 - + + 500 + 340 + 700 + 50 + 0 + + + 505 + 345 + 40 + 40 + 0 + + + 1170 + 345 + 40 + 40 + 0 + + + + + + + + 27 + 0 + 0 + 205.33 Outline - Bold - 3 - - - - Invisible - + + + SelectSlideArrowLeft - SelectSlideArrowRight - SelectSlide - SelectSlideArrowLeft - SelectSlideArrowRight - - SelectSlide - - 500 - 400 - 0,00 - 700 - 50 - - 505 - 405 - 0,00 - 40 - 40 - - 1170 - 405 - 0,00 - 40 - 40 - - - SelectSlideColor - - - SelectSlideSColor - - - SelectSlideHColor - - - ArrowColor - - - ArrowSColor - - - TextColor - - - TextSColor - - 27,00 - - - - 150,00 - + + 500 + 400 + 700 + 50 + 0 + + + 505 + 405 + 40 + 40 + 0 + + + 1170 + 405 + 40 + 40 + 0 + + + + + + + + 27 + 0 + 0 + 150 Outline - Bold - 3 - - - + + + + + + + + + diff --git a/Output/Themes/Ambient/Screens/ScreenOptionsVideoAdjustments.xml b/Output/Themes/Ambient/Screens/ScreenOptionsVideoAdjustments.xml index e9ffb2eb..28b6f26d 100644 --- a/Output/Themes/Ambient/Screens/ScreenOptionsVideoAdjustments.xml +++ b/Output/Themes/Ambient/Screens/ScreenOptionsVideoAdjustments.xml @@ -1,251 +1,154 @@ - - - + + + + ScreenOptionsVideoAdjustments 1 - - + + + Color - + - BG_Options - - - 1,00 - 1,00 - 1,00 - 1,00 - - - + + 1 + 1 + 1 + 1 + + + + + + 0 0 - - 0,00 - + 0 27 - - - - StaticColor - - - TextSColor - + 0 + + Left - - Top - + Center - Outline - TR_SCREENOVIDEOADJUSTMENTS_TOPLEFT - - - - - - + + 1280 0 - - 0,00 - + 0 27 - - - - StaticColor - - - TextSColor - + 0 + + Right - - Top - + Center - Outline - TR_SCREENOVIDEOADJUSTMENTS_TOPRIGHT - - - - - - + + 0 693 - - 0,00 - + 0 27 - - - - StaticColor - - - TextSColor - + 0 + + Left - - Bottom - + Center - Outline - TR_SCREENOVIDEOADJUSTMENTS_BOTTOMLEFT - - - - - - + + 1280 693 - - 0,00 - + 0 27 - - - - StaticColor - - - TextSColor - + 0 + + Right - - Bottom - + Center - Outline - TR_SCREENOVIDEOADJUSTMENTS_BOTTOMRIGHT - - - - - - + + 640 320 - - 0,00 - + 0 35 - - - - StaticColor - - - TextSColor - + 0 + + Center - - Center - + Center - Outline - TR_SCREENOVIDEOADJUSTMENTS_NOTES - - - - - - + + 640 360 - - 0,00 - + 0 35 - - - - StaticColor - - - TextSColor - + 0 + + Center - - Center - + Center - Outline - TR_SCREENOVIDEOADJUSTMENTS_NOTESRESET - - - - - - + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Output/Themes/Ambient/Screens/ScreenParty.xml b/Output/Themes/Ambient/Screens/ScreenParty.xml index d725b993..de8283d4 100644 --- a/Output/Themes/Ambient/Screens/ScreenParty.xml +++ b/Output/Themes/Ambient/Screens/ScreenParty.xml @@ -1,656 +1,365 @@ - - - + + + + ScreenParty 1 - - + + + Video - + - BG_Default - - - BackgroundColor - - - + + + + + Menu - - 40 - 40 - 0,00 - 1200 - 50 - - - StaticColor - - - - - - + + + 40 + 40 + 1200 + 50 + 0 + + + + + 640 50 - - 0,00 - + 0 27 - - - - StaticColor - - - TextSColor - + 0 + + Center - - Center - + Center - Outline - TR_SCREENPARTY_TITLE - - - - - - + + 75 107 - - 0,00 - + 0 27 - - - - StaticColor - - - TextSColor - + 0 + + Left - - Center - + Center - Outline - TR_SCREENPARTY_MODES - - - - - - + + 75 167 - - 0,00 - + 0 27 - - - - StaticColor - - - TextSColor - + 0 + + Left - - Center - + Center - Outline - TR_SCREENPARTY_DESCRIPTION - - - - - - + + 75 227 - - 0,00 - + 0 27 - - - - StaticColor - - - TextSColor - + 0 + + Left - - Center - + Center - Outline - TR_SCREENPARTY_TARGETAUDIENCE - - - - - - + + 75 287 - - 0,00 - + 0 27 - - - - StaticColor - - - TextSColor - + 0 + + Left - - Center - + Center - Outline - TR_SCREENPARTY_NUMTEAMS - - - - - - + + 75 347 - - 0,00 - + 0 27 - - - - StaticColor - - - TextSColor - + 0 + + Left - - Center - + Center - Outline - TR_SCREENPARTY_NUMPLAYERS - - - - - - + + 75 407 - - 0,00 - + 0 27 - - - - StaticColor - - - TextSColor - + 0 + + Left - - Center - + Center - Outline - TR_SCREENPARTY_AUTHOR - - - - - - + + 75 467 - - 0,00 - + 0 27 - - - - StaticColor - - - TextSColor - + 0 + + Left - - Center - + Center - Outline - TR_SCREENPARTY_VERSION - - - - - - + + 850 167 - - 0,00 - + 0 27 - 600 - - - StaticColor - - - TextSColor - + + Center - - Center - + Center - Outline - - - - - - - + + 850 227 - - 0,00 - + 0 27 - 600 - - - StaticColor - - - TextSColor - + + Center - - Center - + Center - Outline - - - - - - - + + 850 287 - - 0,00 - + 0 27 - 600 - - - StaticColor - - - TextSColor - + + Center - - Center - + Center - Outline - - - - - - - + + 850 347 - - 0,00 - + 0 27 - 600 - - - StaticColor - - - TextSColor - + + Center - - Center - + Center - Outline - - - - - - - + + 850 407 - - 0,00 - + 0 27 - 600 - - - StaticColor - - - TextSColor - + + Center - - Center - + Center - Outline - - - - - - - + + 850 467 - - 0,00 - + 0 27 - 600 - - - StaticColor - - - TextSColor - + + Center - - Center - + Center - Outline - - - - - - - + + 850 527 - - 0,00 - + 0 27 - 600 - - - TextWarningColor - - - TextSColor - + + Center - - Center - + Center - Outline - TR_SCREENPARTY_ERROR - - - - - - + + + + + + + + + + + SelectSlideArrowLeft - SelectSlideArrowRight - SelectSlide - SelectSlideArrowLeft - SelectSlideArrowRight - - SelectSlide - - 500 - 100 - 0,00 - 700 - 50 - - 505 - 105 - 0,00 - 40 - 40 - - 1170 - 105 - 0,00 - 40 - 40 - - - SelectSlideColor - - - SelectSlideSColor - - - SelectSlideHColor - - - ArrowColor - - - ArrowSColor - - - TextColor - - - TextSColor - - 27,00 - - - - 600,00 - + + 500 + 100 + 700 + 50 + 0 + + + 505 + 105 + 40 + 40 + 0 + + + 1170 + 105 + 40 + 40 + 0 + + + + + + + + 27 + 0 + 0 + 600 Outline - Bold - 1 - - - + + + + + + + + + \ No newline at end of file diff --git a/Output/Themes/Ambient/Screens/ScreenProfiles.xml b/Output/Themes/Ambient/Screens/ScreenProfiles.xml index 1fb4ce6f..ca84426b 100644 --- a/Output/Themes/Ambient/Screens/ScreenProfiles.xml +++ b/Output/Themes/Ambient/Screens/ScreenProfiles.xml @@ -1,1127 +1,694 @@ - - - + + + + ScreenProfiles 3 - - + + + Video - + - BG_Options - - - BackgroundColor - - - + + + + + Menu - - 40 - 40 - 0,00 - 1200 - 50 - - - StaticColor - - - - - - - Invisible - - 50 - 160 - 0,00 - 460 - 50 - - - StaticColor - - - - - - - Invisible - - 50 - 220 - 0,00 - 460 - 50 - - - StaticColor - - - - - - - Invisible - - 50 - 280 - 0,00 - 460 - 50 - - - StaticColor - - - - - - - Invisible - - 50 - 340 - 0,00 - 460 - 50 - - - StaticColor - - - - - - - Invisible - - 50 - 400 - 0,00 - 460 - 50 - - - StaticColor - - - - - - + + + 40 + 40 + 1200 + 50 + 0 + + + + + + + 50 + 160 + 460 + 50 + 0 + + + + + + + 50 + 220 + 460 + 50 + 0 + + + + + + + 50 + 280 + 460 + 50 + 0 + + + + + + + 50 + 340 + 460 + 50 + 0 + + + + + + + 50 + 400 + 460 + 50 + 0 + + + - - 85 - 110 - 0,00 - 160 - 160 - - - Visible - - - - - - + + + 85 + 110 + 160 + 160 + 0 + + + + + 640 50 - - 0,00 - + 0 27 - - - - StaticColor - - - TextSColor - + 0 + + Center - - Center - + Center - Outline - TR_SCREENPROFILES_PROFILES - - - - - - + + 75 287 - - 0,00 - + 0 27 - - - - StaticColor - - - TextSColor - + 0 + + Left - - Center - + Center - Outline - TR_SCREENPROFILES_PLAYERNAME - - - - - - + + 75 347 - - 0,00 - + 0 27 - - - - StaticColor - - - TextSColor - + 0 + + Left - - Center - + Center - Outline - TR_SCREENPROFILES_GAMEDIFFICULTY - - - - - - + + 75 407 - - 0,00 - + 0 27 - - - - StaticColor - - - TextSColor - + 0 + + Left - - Center - + Center - Outline - TR_SCREENPROFILES_AVATAR - - - - - - + + 75 467 - - 0,00 - + 0 27 - - - - StaticColor - - - TextSColor - + 0 + + Left - - Center - + Center - Outline - TR_SCREENPROFILES_USERROLE - - - - - - + + 75 527 - - 0,00 - + 0 27 - - - - StaticColor - - - TextSColor - + 0 + + Left - - Center - + Center - Outline - TR_SCREENPROFILES_ACTIVE - - - - - - - Invisible - + + + + + + + + + + + + + + + + + + SelectSlideArrowLeft - SelectSlideArrowRight - SelectSlide - SelectSlideArrowLeft - SelectSlideArrowRight - - SelectSlide - - 500 - 160 - 0,00 - 710 - 50 - - 505 - 165 - 0,00 - 40 - 40 - - 1170 - 165 - 0,00 - 40 - 40 - - - SelectSlideColor - - - SelectSlideSColor - - - SelectSlideHColor - - - ArrowColor - - - ArrowSColor - - - TextColor - - - TextSColor - - 27,00 - - - - 219,20 - + + 500 + 160 + 710 + 50 + 0 + + + 505 + 165 + 40 + 40 + 0 + + + 1170 + 165 + 40 + 40 + 0 + + + + + + + + 27 + 0 + 0 + 219.2 Outline - Bold - 3 - - - - Invisible - + + + SelectSlideArrowLeft - SelectSlideArrowRight - SelectSlide - SelectSlideArrowLeft - SelectSlideArrowRight - - SelectSlide - - 500 - 340 - 0,00 - 710 - 50 - - 505 - 345 - 0,00 - 40 - 40 - - 1170 - 345 - 0,00 - 40 - 40 - - - SelectSlideColor - - - SelectSlideSColor - - - SelectSlideHColor - - - ArrowColor - - - ArrowSColor - - - TextColor - - - TextSColor - - 27,00 - - - - 208,67 - + + 500 + 340 + 710 + 50 + 0 + + + 505 + 345 + 40 + 40 + 0 + + + 1170 + 345 + 40 + 40 + 0 + + + + + + + + 27 + 0 + 0 + 208.67 Outline - Bold - 3 - - - - Invisible - + + + SelectSlideArrowLeft - SelectSlideArrowRight - SelectSlide - SelectSlideArrowLeft - SelectSlideArrowRight - - SelectSlide - - 500 - 400 - 0,00 - 710 - 50 - - 505 - 405 - 0,00 - 40 - 40 - - 1170 - 405 - 0,00 - 40 - 40 - - - SelectSlideColor - - - SelectSlideSColor - - - SelectSlideHColor - - - ArrowColor - - - ArrowSColor - - - TextColor - - - TextSColor - - 27,00 - - - - 208,67 - + + 500 + 400 + 710 + 50 + 0 + + + 505 + 405 + 40 + 40 + 0 + + + 1170 + 405 + 40 + 40 + 0 + + + + + + + + 27 + 0 + 0 + 208.67 Outline - Bold - 3 - - - - Invisible - + + + SelectSlideArrowLeft - SelectSlideArrowRight - SelectSlide - SelectSlideArrowLeft - SelectSlideArrowRight - - SelectSlide - - 500 - 460 - 0,00 - 710 - 50 - - 505 - 465 - 0,00 - 40 - 40 - - 1170 - 465 - 0,00 - 40 - 40 - - - SelectSlideColor - - - SelectSlideSColor - - - SelectSlideHColor - - - ArrowColor - - - ArrowSColor - - - TextColor - - - TextSColor - - 27,00 - - - - 313,00 - + + 500 + 460 + 710 + 50 + 0 + + + 505 + 465 + 40 + 40 + 0 + + + 1170 + 465 + 40 + 40 + 0 + + + + + + + + 27 + 0 + 0 + 313 Outline - Bold - 2 - - - - Invisible - + + + SelectSlideArrowLeft - SelectSlideArrowRight - SelectSlide - SelectSlideArrowLeft - SelectSlideArrowRight - - SelectSlide - - 500 - 520 - 0,00 - 710 - 50 - - 505 - 525 - 0,00 - 40 - 40 - - 1170 - 525 - 0,00 - 40 - 40 - - - SelectSlideColor - - - SelectSlideSColor - - - SelectSlideHColor - - - ArrowColor - - - ArrowSColor - - - TextColor - - - TextSColor - - 27,00 - - - - 313,00 - + + 500 + 520 + 710 + 50 + 0 + + + 505 + 525 + 40 + 40 + 0 + + + 1170 + 525 + 40 + 40 + 0 + + + + + + + + 27 + 0 + 0 + 313 Outline - Bold - 2 - - - + + + + + + + + + diff --git a/Output/Themes/Ambient/Screens/ScreenScore.xml b/Output/Themes/Ambient/Screens/ScreenScore.xml index a07f386c..fec36f43 100644 --- a/Output/Themes/Ambient/Screens/ScreenScore.xml +++ b/Output/Themes/Ambient/Screens/ScreenScore.xml @@ -1,3773 +1,2160 @@ - - - + + + + ScreenScore 3 - - + + + Video - + - BG_Default - - - BackgroundColor - - - + + + + + Menu - - 40 - 40 - 0,00 - 1200 - 50 - - - StaticColor - - - - - - + + + 40 + 40 + 1200 + 50 + 0 + + + TextBG - - 50 - 90 - 0,00 - 1180 - 610 - - - 0,00 - 0,00 - 0,00 - 0,00 - - - - - - + + 0 + 0 + 0 + 0 + + + 50 + 90 + 1180 + 610 + 0 + + + PointsBarBG - - 560 - 180 - 0,00 - 160 - 220 - - - 0,00 - 0,00 - 1,00 - 0,75 - - - - - - + + 0 + 0 + 1 + 0.75 + + + 560 + 180 + 160 + 220 + 0 + + + PointsBar - - 560 - 180 - 0,00 - 160 - 0 - - - Player1 - - - - - - + + + 560 + 180 + 160 + 0 + 0 + + + - - 560 - 410 - 0,00 - 160 - 160 - - - Visible - - - + + + 560 + 410 + 160 + 160 + 0 + - 15 40 + 15 - - - + + PointsBarBG - - 352 - 180 - 0,00 - 160 - 220 - - - 0,00 - 0,00 - 1,00 - 0,75 - - - - - - + + 0 + 0 + 1 + 0.75 + + + 352 + 180 + 160 + 220 + 0 + + + PointsBar - - 352 - 180 - 0,00 - 160 - 0 - - - Player1 - - - - - - + + + 352 + 180 + 160 + 0 + 0 + + + - - 352 - 410 - 0,00 - 160 - 160 - - - Visible - - - + + + 352 + 410 + 160 + 160 + 0 + - 15 40 + 15 - - - + + PointsBarBG - - 768 - 180 - 0,00 - 160 - 220 - - - 1,00 - 0,00 - 0,00 - 0,75 - - - - - - + + 1 + 0 + 0 + 0.75 + + + 768 + 180 + 160 + 220 + 0 + + + PointsBar - - 768 - 180 - 0,00 - 160 - 0 - - - Player2 - - - - - - + + + 768 + 180 + 160 + 0 + 0 + + + - - 768 - 410 - 0,00 - 160 - 160 - - - Visible - - - + + + 768 + 410 + 160 + 160 + 0 + - 15 40 + 15 - - - + + PointsBarBG - - 238 - 180 - 0,00 - 160 - 220 - - - 0,00 - 0,00 - 1,00 - 0,75 - - - - - - + + 0 + 0 + 1 + 0.75 + + + 238 + 180 + 160 + 220 + 0 + + + PointsBar - - 238 - 180 - 0,00 - 160 - 0 - - - Player1 - - - - - - + + + 238 + 180 + 160 + 0 + 0 + + + - - 238 - 410 - 0,00 - 160 - 160 - - - Visible - - - + + + 238 + 410 + 160 + 160 + 0 + - 15 40 + 15 - - - + + PointsBarBG - - 560 - 180 - 0,00 - 160 - 220 - - - 1,00 - 0,00 - 0,00 - 0,75 - - - - - - + + 1 + 0 + 0 + 0.75 + + + 560 + 180 + 160 + 220 + 0 + + + PointsBar - - 560 - 180 - 0,00 - 160 - 0 - - - Player2 - - - - - - + + + 560 + 180 + 160 + 0 + 0 + + + - - 560 - 410 - 0,00 - 160 - 160 - - - Visible - - - + + + 560 + 410 + 160 + 160 + 0 + - 15 40 + 15 - - - + + PointsBarBG - - 882 - 180 - 0,00 - 160 - 220 - - - 0,00 - 1,00 - 0,00 - 0,75 - - - - - - + + 0 + 1 + 0 + 0.75 + + + 882 + 180 + 160 + 220 + 0 + + + PointsBar - - 882 - 180 - 0,00 - 160 - 0 - - - Player3 - - - - - - + + + 882 + 180 + 160 + 0 + 0 + + + - - 882 - 410 - 0,00 - 160 - 160 - - - Visible - - - + + + 882 + 410 + 160 + 160 + 0 + - 15 40 + 15 - - - + + PointsBarBG - - 190 - 180 - 0,00 - 160 - 220 - - - 0,00 - 0,00 - 1,00 - 0,75 - - - - - - + + 0 + 0 + 1 + 0.75 + + + 190 + 180 + 160 + 220 + 0 + + + PointsBar - - 190 - 180 - 0,00 - 160 - 0 - - - Player1 - - - - - - + + + 190 + 180 + 160 + 0 + 0 + + + - - 190 - 410 - 0,00 - 160 - 160 - - - Visible - - - + + + 190 + 410 + 160 + 160 + 0 + - 15 40 + 15 - - - + + PointsBarBG - - 422 - 180 - 0,00 - 160 - 220 - - - 1,00 - 0,00 - 0,00 - 0,75 - - - - - - + + 1 + 0 + 0 + 0.75 + + + 422 + 180 + 160 + 220 + 0 + + + PointsBar - - 422 - 180 - 0,00 - 160 - 0 - - - Player2 - - - - - - + + + 422 + 180 + 160 + 0 + 0 + + + - - 422 - 410 - 0,00 - 160 - 160 - - - Visible - - - + + + 422 + 410 + 160 + 160 + 0 + - 15 40 + 15 - - - + + PointsBarBG - - 654 - 180 - 0,00 - 160 - 220 - - - 0,00 - 1,00 - 0,00 - 0,75 - - - - - - + + 0 + 1 + 0 + 0.75 + + + 654 + 180 + 160 + 220 + 0 + + + PointsBar - - 654 - 180 - 0,00 - 160 - 0 - - - Player3 - - - - - - + + + 654 + 180 + 160 + 0 + 0 + + + - - 654 - 410 - 0,00 - 160 - 160 - - - Visible - - - + + + 654 + 410 + 160 + 160 + 0 + - 15 40 + 15 - - - + + PointsBarBG - - 886 - 180 - 0,00 - 160 - 220 - - - 0,50 - 0,00 - 1,00 - 0,75 - - - - - - + + 0.5 + 0 + 1 + 0.75 + + + 886 + 180 + 160 + 220 + 0 + + + PointsBar - - 886 - 180 - 0,00 - 160 - 0 - - - Player4 - - - - - - + + + 886 + 180 + 160 + 0 + 0 + + + - - 886 - 410 - 0,00 - 160 - 160 - - - Visible - - - + + + 886 + 410 + 160 + 160 + 0 + - 15 40 + 15 - - - + + PointsBarBG - - 144 - 180 - 0,00 - 160 - 220 - - - 0,00 - 0,00 - 1,00 - 0,75 - - - - - - + + 0 + 0 + 1 + 0.75 + + + 144 + 180 + 160 + 220 + 0 + + + PointsBar - - 144 - 180 - 0,00 - 160 - 0 - - - Player1 - - - - - - + + + 144 + 180 + 160 + 0 + 0 + + + - - 144 - 410 - 0,00 - 160 - 160 - - - Visible - - - + + + 144 + 410 + 160 + 160 + 0 + - 15 40 + 15 - - - + + PointsBarBG - - 352 - 180 - 0,00 - 160 - 220 - - - 1,00 - 0,00 - 0,00 - 0,75 - - - - - - + + 1 + 0 + 0 + 0.75 + + + 352 + 180 + 160 + 220 + 0 + + + PointsBar - - 352 - 180 - 0,00 - 160 - 0 - - - Player2 - - - - - - + + + 352 + 180 + 160 + 0 + 0 + + + - - 352 - 410 - 0,00 - 160 - 160 - - - Visible - - - + + + 352 + 410 + 160 + 160 + 0 + - 15 40 + 15 - - - + + PointsBarBG - - 560 - 180 - 0,00 - 160 - 220 - - - 0,00 - 1,00 - 0,00 - 0,75 - - - - - - + + 0 + 1 + 0 + 0.75 + + + 560 + 180 + 160 + 220 + 0 + + + PointsBar - - 560 - 180 - 0,00 - 160 - 0 - - - Player3 - - - - - - + + + 560 + 180 + 160 + 0 + 0 + + + - - 560 - 410 - 0,00 - 160 - 160 - - - Visible - - - + + + 560 + 410 + 160 + 160 + 0 + - 15 40 + 15 - - - + + PointsBarBG - - 768 - 180 - 0,00 - 160 - 220 - - - 0,50 - 0,00 - 1,00 - 0,75 - - - - - - + + 0.5 + 0 + 1 + 0.75 + + + 768 + 180 + 160 + 220 + 0 + + + PointsBar - - 768 - 180 - 0,00 - 160 - 0 - - - Player4 - - - - - - + + + 768 + 180 + 160 + 0 + 0 + + + - - 768 - 410 - 0,00 - 160 - 160 - - - Visible - - - + + + 768 + 410 + 160 + 160 + 0 + - 15 40 + 15 - - - + + PointsBarBG - - 976 - 180 - 0,00 - 160 - 220 - - - 1,00 - 0,80 - 0,00 - 0,75 - - - - - - + + 1 + 0.8 + 0 + 0.75 + + + 976 + 180 + 160 + 220 + 0 + + + PointsBar - - 976 - 180 - 0,00 - 160 - 0 - - - Player5 - - - - - - + + + 976 + 180 + 160 + 0 + 0 + + + - - 976 - 410 - 0,00 - 160 - 160 - - - Visible - - - + + + 976 + 410 + 160 + 160 + 0 + - 15 40 + 15 - - - + + PointsBarBG - - 45 - 180 - 0,00 - 160 - 220 - - - 0,00 - 0,00 - 1,00 - 0,75 - - - - - - + + 0 + 0 + 1 + 0.75 + + + 45 + 180 + 160 + 220 + 0 + + + PointsBar - - 45 - 180 - 0,00 - 160 - 0 - - - Player1 - - - - - - + + + 45 + 180 + 160 + 0 + 0 + + + - - 45 - 410 - 0,00 - 160 - 160 - - - Visible - - - + + + 45 + 410 + 160 + 160 + 0 + - 15 40 + 15 - - - + + PointsBarBG - - 253 - 180 - 0,00 - 160 - 220 - - - 1,00 - 0,00 - 0,00 - 0,75 - - - - - - + + 1 + 0 + 0 + 0.75 + + + 253 + 180 + 160 + 220 + 0 + + + PointsBar - - 253 - 180 - 0,00 - 160 - 0 - - - Player2 - - - - - - + + + 253 + 180 + 160 + 0 + 0 + + + - - 253 - 410 - 0,00 - 160 - 160 - - - Visible - - - + + + 253 + 410 + 160 + 160 + 0 + - 15 40 + 15 - - - + + PointsBarBG - - 461 - 180 - 0,00 - 160 - 220 - - - 0,00 - 1,00 - 0,00 - 0,75 - - - - - - + + 0 + 1 + 0 + 0.75 + + + 461 + 180 + 160 + 220 + 0 + + + PointsBar - - 461 - 180 - 0,00 - 160 - 0 - - - Player3 - - - - - - + + + 461 + 180 + 160 + 0 + 0 + + + - - 461 - 410 - 0,00 - 160 - 160 - - - Visible - - - + + + 461 + 410 + 160 + 160 + 0 + - 15 40 + 15 - - - + + PointsBarBG - - 669 - 180 - 0,00 - 160 - 220 - - - 0,50 - 0,00 - 1,00 - 0,75 - - - - - - + + 0.5 + 0 + 1 + 0.75 + + + 669 + 180 + 160 + 220 + 0 + + + PointsBar - - 669 - 180 - 0,00 - 160 - 0 - - - Player4 - - - - - - + + + 669 + 180 + 160 + 0 + 0 + + + - - 669 - 410 - 0,00 - 160 - 160 - - - Visible - - - + + + 669 + 410 + 160 + 160 + 0 + - 15 40 + 15 - - - + + PointsBarBG - - 877 - 180 - 0,00 - 160 - 220 - - - 1,00 - 0,80 - 0,00 - 0,75 - - - - - - + + 1 + 0.8 + 0 + 0.75 + + + 877 + 180 + 160 + 220 + 0 + + + PointsBar - - 877 - 180 - 0,00 - 160 - 0 - - - Player5 - - - - - - + + + 877 + 180 + 160 + 0 + 0 + + + - - 877 - 410 - 0,00 - 160 - 160 - - - Visible - - - + + + 877 + 410 + 160 + 160 + 0 + - 15 40 + 15 - - - + + PointsBarBG - - 1085 - 180 - 0,00 - 160 - 220 - - - 1,00 - 0,00 - 0,50 - 0,75 - - - - - - + + 1 + 0 + 0.5 + 0.75 + + + 1085 + 180 + 160 + 220 + 0 + + + PointsBar - - 1085 - 180 - 0,00 - 160 - 0 - - - Player6 - - - - - - + + + 1085 + 180 + 160 + 0 + 0 + + + - - 1085 - 410 - 0,00 - 160 - 160 - - - Visible - - - + + + 1085 + 410 + 160 + 160 + 0 + - 15 40 + 15 - - - + + + + 60 50 - - 0,00 - + 0 27 - - - - StaticColor - - - TextSColor - + 0 + + Left - - Center - + Center - Outline - TR_SCREENSCORE_SCORES - - - - - - + + 640 50 - - 0,00 - + 0 27 - - - - StaticColor - - - TextSColor - + 0 + + Center - - Center - + Center - Outline - - - - - - - + + 640 630 - - 0,00 - + 0 44 - - - - StaticColor - - - TextSColor - + 0 + + Center - - Center - + Center - Outline - - - - - - - + + 640 142 - - 0,00 - + 0 27 - - - - StaticColor - - - TextSColor - + 0 + + Center - - Center - + Center - Outline - - - - - - - + + 640 107 - - 0,00 - + 0 27 - - - - StaticColor - - - TextSColor - + 0 + + Center - - Center - + Center - Outline - - - - - - - + + 640 670 - - 0,00 - + 0 28 - - - - StaticColor - - - TextSColor - + 0 + + Center - - Center - + Center - Outline - - - - - - - + + 432 630 - - 0,00 - + 0 44 - - - - StaticColor - - - TextSColor - + 0 + + Center - - Center - + Center - Outline - - - - - - - + + 432 142 - - 0,00 - + 0 27 - - - - StaticColor - - - TextSColor - + 0 + + Center - - Center - + Center - Outline - - - - - - - + + 432 107 - - 0,00 - + 0 27 - - - - StaticColor - - - TextSColor - + 0 + + Center - - Center - + Center - Outline - - - - - - - + + 432 670 - - 0,00 - + 0 28 - - - - StaticColor - - - TextSColor - + 0 + + Center - - Center - + Center - Outline - - - - - - - + + 848 630 - - 0,00 - + 0 44 - - - - StaticColor - - - TextSColor - + 0 + + Center - - Center - + Center - Outline - - - - - - - + + 848 142 - - 0,00 - + 0 27 - - - - StaticColor - - - TextSColor - + 0 + + Center - - Center - + Center - Outline - - - - - - - + + 848 107 - - 0,00 - + 0 27 - - - - StaticColor - - - TextSColor - + 0 + + Center - - Center - + Center - Outline - - - - - - - + + 858 670 - - 0,00 - + 0 28 - - - - StaticColor - - - TextSColor - + 0 + + Center - - Center - + Center - Outline - - - - - - - + + 318 630 - - 0,00 - + 0 44 - - - - StaticColor - - - TextSColor - + 0 + + Center - - Center - + Center - Outline - - - - - - - + + 318 142 - - 0,00 - + 0 27 - - - - StaticColor - - - TextSColor - + 0 + + Center - - Center - + Center - Outline - - - - - - - + + 318 107 - - 0,00 - + 0 27 - - - - StaticColor - - - TextSColor - + 0 + + Center - - Center - + Center - Outline - - - - - - - + + 318 670 - - 0,00 - + 0 28 - - - - StaticColor - - - TextSColor - + 0 + + Center - - Center - + Center - Outline - - - - - - - + + 640 630 - - 0,00 - + 0 44 - - - - StaticColor - - - TextSColor - + 0 + + Center - - Center - + Center - Outline - - - - - - - + + 640 142 - - 0,00 - + 0 27 - - - - StaticColor - - - TextSColor - + 0 + + Center - - Center - + Center - Outline - - - - - - - + + 640 107 - - 0,00 - + 0 27 - - - - StaticColor - - - TextSColor - + 0 + + Center - - Center - + Center - Outline - - - - - - - + + 640 670 - - 0,00 - + 0 28 - - - - StaticColor - - - TextSColor - + 0 + + Center - - Center - + Center - Outline - - - - - - - + + 962 630 - - 0,00 - + 0 44 - - - - StaticColor - - - TextSColor - + 0 + + Center - - Center - + Center - Outline - - - - - - - + + 962 142 - - 0,00 - + 0 27 - - - - StaticColor - - - TextSColor - + 0 + + Center - - Center - + Center - Outline - - - - - - - + + 962 107 - - 0,00 - + 0 27 - - - - StaticColor - - - TextSColor - + 0 + + Center - - Center - + Center - Outline - - - - - - - + + 962 670 - - 0,00 - + 0 28 - - - - StaticColor - - - TextSColor - + 0 + + Center - - Center - + Center - Outline - - - - - - - + + 270 630 - - 0,00 - + 0 44 - - - - StaticColor - - - TextSColor - + 0 + + Center - - Center - + Center - Outline - - - - - - - + + 270 142 - - 0,00 - + 0 27 - - - - StaticColor - - - TextSColor - + 0 + + Center - - Center - + Center - Outline - - - - - - - + + 270 107 - - 0,00 - + 0 27 - 160 - - - StaticColor - - - TextSColor - + + Center - - Center - + Center - Outline - - - - - - - + + 270 670 - - 0,00 - + 0 28 - - - - StaticColor - - - TextSColor - + 0 + + Center - - Center - + Center - Outline - - - - - - - + + 502 630 - - 0,00 - + 0 44 - - - - StaticColor - - - TextSColor - + 0 + + Center - - Center - + Center - Outline - - - - - - - + + 502 142 - - 0,00 - + 0 27 - - - - StaticColor - - - TextSColor - + 0 + + Center - - Center - + Center - Outline - - - - - - - + + 502 107 - - 0,00 - + 0 27 - 160 - - - StaticColor - - - TextSColor - + + Center - - Center - + Center - Outline - - - - - - - + + 502 670 - - 0,00 - + 0 28 - - - - StaticColor - - - TextSColor - + 0 + + Center - - Center - + Center - Outline - - - - - - - + + 734 630 - - 0,00 - + 0 44 - - - - StaticColor - - - TextSColor - + 0 + + Center - - Center - + Center - Outline - - - - - - - + + 734 142 - - 0,00 - + 0 27 - - - - StaticColor - - - TextSColor - + 0 + + Center - - Center - + Center - Outline - - - - - - - + + 734 107 - - 0,00 - + 0 27 - 160 - - - StaticColor - - - TextSColor - + + Center - - Center - + Center - Outline - - - - - - - + + 734 670 - - 0,00 - + 0 28 - - - - StaticColor - - - TextSColor - + 0 + + Center - - Center - + Center - Outline - - - - - - - + + 966 630 - - 0,00 - + 0 44 - - - - StaticColor - - - TextSColor - + 0 + + Center - - Center - + Center - Outline - - - - - - - + + 966 142 - - 0,00 - + 0 27 - - - - StaticColor - - - TextSColor - + 0 + + Center - - Center - + Center - Outline - - - - - - - + + 966 107 - - 0,00 - + 0 27 - 160 - - - StaticColor - - - TextSColor - + + Center - - Center - + Center - Outline - - - - - - - + + 966 670 - - 0,00 - + 0 28 - - - - StaticColor - - - TextSColor - + 0 + + Center - - Center - + Center - Outline - - - - - - - + + 224 630 - - 0,00 - + 0 44 - 160 - - - StaticColor - - - TextSColor - + + Center - - Center - + Center - Outline - - - - - - - + + 224 142 - - 0,00 - + 0 27 - 160 - - - StaticColor - - - TextSColor - + + Center - - Center - + Center - Outline - - - - - - - + + 224 107 - - 0,00 - + 0 27 - 160 - - - StaticColor - - - TextSColor - + + Center - - Center - + Center - Outline - - - - - - - + + 224 670 - - 0,00 - + 0 28 - 160 - - - StaticColor - - - TextSColor - + + Center - - Center - + Center - Outline - - - - - - - + + 432 630 - - 0,00 - + 0 44 - 160 - - - StaticColor - - - TextSColor - + + Center - - Center - + Center - Outline - - - - - - - + + 432 142 - - 0,00 - + 0 27 - 160 - - - StaticColor - - - TextSColor - + + Center - - Center - + Center - Outline - - - - - - - + + 432 107 - - 0,00 - + 0 27 - 160 - - - StaticColor - - - TextSColor - + + Center - - Center - + Center - Outline - - - - - - - + + 432 670 - - 0,00 - + 0 28 - 160 - - - StaticColor - - - TextSColor - + + Center - - Center - + Center - Outline - - - - - - - + + 640 630 - - 0,00 - + 0 44 - 160 - - - StaticColor - - - TextSColor - + + Center - - Center - + Center - Outline - - - - - - - + + 640 142 - - 0,00 - + 0 27 - 160 - - - StaticColor - - - TextSColor - + + Center - - Center - + Center - Outline - - - - - - - + + 640 107 - - 0,00 - + 0 27 - 160 - - - StaticColor - - - TextSColor - + + Center - - Center - + Center - Outline - - - - - - - + + 640 670 - - 0,00 - + 0 28 - 160 - - - StaticColor - - - TextSColor - + + Center - - Center - + Center - Outline - - - - - - - + + 848 630 - - 0,00 - + 0 44 - 160 - - - StaticColor - - - TextSColor - + + Center - - Center - + Center - Outline - - - - - - - + + 848 142 - - 0,00 - + 0 27 - 160 - - - StaticColor - - - TextSColor - + + Center - - Center - + Center - Outline - - - - - - - + + 848 107 - - 0,00 - + 0 27 - 160 - - - StaticColor - - - TextSColor - + + Center - - Center - + Center - Outline - - - - - - - + + 848 670 - - 0,00 - + 0 28 - 160 - - - StaticColor - - - TextSColor - + + Center - - Center - + Center - Outline - - - - - - - + + 1056 630 - - 0,00 - + 0 44 - 160 - - - StaticColor - - - TextSColor - + + Center - - Center - + Center - Outline - - - - - - - + + 1056 142 - - 0,00 - + 0 27 - 160 - - - StaticColor - - - TextSColor - + + Center - - Center - + Center - Outline - - - - - - - + + 1056 107 - - 0,00 - + 0 27 - 160 - - - StaticColor - - - TextSColor - + + Center - - Center - + Center - Outline - - - - - - - + + 1056 670 - - 0,00 - + 0 28 - 160 - - - StaticColor - - - TextSColor - + + Center - - Center - + Center - Outline - - - - - - - + + 125 630 - - 0,00 - + 0 44 - 160 - - - StaticColor - - - TextSColor - + + Center - - Center - + Center - Outline - - - - - - - + + 125 142 - - 0,00 - + 0 27 - 160 - - - StaticColor - - - TextSColor - + + Center - - Center - + Center - Outline - - - - - - - + + 125 107 - - 0,00 - + 0 27 - 160 - - - StaticColor - - - TextSColor - + + Center - - Center - + Center - Outline - - - - - - - + + 125 670 - - 0,00 - + 0 28 - 160 - - - StaticColor - - - TextSColor - + + Center - - Center - + Center - Outline - - - - - - - + + 333 630 - - 0,00 - + 0 44 - 160 - - - StaticColor - - - TextSColor - + + Center - - Center - + Center - Outline - - - - - - - + + 333 142 - - 0,00 - + 0 27 - 160 - - - StaticColor - - - TextSColor - + + Center - - Center - + Center - Outline - - - - - - - + + 333 107 - - 0,00 - + 0 27 - 160 - - - StaticColor - - - TextSColor - + + Center - - Center - + Center - Outline - - - - - - - + + 333 670 - - 0,00 - + 0 28 - 160 - - - StaticColor - - - TextSColor - + + Center - - Center - + Center - Outline - - - - - - - + + 541 630 - - 0,00 - + 0 44 - 160 - - - StaticColor - - - TextSColor - + + Center - - Center - + Center - Outline - - - - - - - + + 541 142 - - 0,00 - + 0 27 - 160 - - - StaticColor - - - TextSColor - + + Center - - Center - + Center - Outline - - - - - - - + + 541 107 - - 0,00 - + 0 27 - 160 - - - StaticColor - - - TextSColor - + + Center - - Center - + Center - Outline - - - - - - - + + 541 670 - - 0,00 - + 0 28 - 160 - - - StaticColor - - - TextSColor - + + Center - - Center - + Center - Outline - - - - - - - + + 749 630 - - 0,00 - + 0 44 - 160 - - - StaticColor - - - TextSColor - + + Center - - Center - + Center - Outline - - - - - - - + + 749 142 - - 0,00 - + 0 27 - 160 - - - StaticColor - - - TextSColor - + + Center - - Center - + Center - Outline - - - - - - - + + 749 107 - - 0,00 - + 0 27 - 160 - - - StaticColor - - - TextSColor - + + Center - - Center - + Center - Outline - - - - - - - + + 749 670 - - 0,00 - + 0 28 - 160 - - - StaticColor - - - TextSColor - + + Center - - Center - + Center - Outline - - - - - - - + + 957 630 - - 0,00 - + 0 44 - 160 - - - StaticColor - - - TextSColor - + + Center - - Center - + Center - Outline - - - - - - - + + 957 142 - - 0,00 - + 0 27 - 160 - - - StaticColor - - - TextSColor - + + Center - - Center - + Center - Outline - - - - - - - + + 957 107 - - 0,00 - + 0 27 - 160 - - - StaticColor - - - TextSColor - + + Center - - Center - + Center - Outline - - - - - - - + + 957 670 - - 0,00 - + 0 28 - 160 - - - StaticColor - - - TextSColor - + + Center - - Center - + Center - Outline - - - - - - - + + 1165 630 - - 0,00 - + 0 44 - 160 - - - StaticColor - - - TextSColor - + + Center - - Center - + Center - Outline - - - - - - - + + 1165 142 - - 0,00 - + 0 27 - 160 - - - StaticColor - - - TextSColor - + + Center - - Center - + Center - Outline - - - - - - - + + 1165 107 - - 0,00 - + 0 27 - 160 - - - StaticColor - - - TextSColor - + + Center - - Center - + Center - Outline - - - - - - - + + 1165 670 - - 0,00 - + 0 28 - 160 - - - StaticColor - - - TextSColor - + + Center - - Center - + Center - Outline - - - - - - - - Int - + + + + + + + + + + + + + 7 - - - Int - + + 4 - - - Int - + + 4 - - - - String - + Int + + Horizontal - - - \ No newline at end of file + String + + + \ No newline at end of file diff --git a/Output/Themes/Ambient/Screens/ScreenSing.xml b/Output/Themes/Ambient/Screens/ScreenSing.xml index 22342fca..ed9bcb15 100644 --- a/Output/Themes/Ambient/Screens/ScreenSing.xml +++ b/Output/Themes/Ambient/Screens/ScreenSing.xml @@ -1,2803 +1,1903 @@ - - - + + + + ScreenSing 7 - - + + + None - + + + + Score - - 190 - 10 - -1,00 - 900 - 50 - - - StaticColor - - - - - - + + + 190 + 10 + 900 + 50 + -1 + + + Lyrics - - 40 - 600 - -0,75 - 1200 - 90 - - - StaticColor - - - - - - + + + 40 + 600 + 1200 + 90 + -0.75 + + + Lyrics - - 40 - 7 - -0,75 - 1200 - 93 - - - StaticColor - - - - - - + + + 40 + 7 + 1200 + 93 + -0.75 + + + Lyrics - - 40 - 7 - -0,75 - 1200 - 93 - - - StaticColor - - - - - - + + + 40 + 7 + 1200 + 93 + -0.75 + + + TimeBar - - 40 - 696 - -0,75 - 1200 - 21 - - - StaticColor - - - - - - + + + 40 + 696 + 1200 + 21 + -0.75 + + + TimeLine - - 44 - 702 - -1,00 - 1090 - 10 - - - StaticColor - - - - - - + + + 50 + 702 + 1090 + 10 + -1 + + + TimeLine - - 44 - 696 - -1,00 - 1090 - 9 - - - TimeBar - - - - - - + + + 50 + 696 + 1090 + 9 + -1 + + + TimeLine - - 44 - 696 - -1,00 - 1090 - 9 - - - TimeBarSentence - - - - - - + + + 50 + 696 + 1090 + 9 + -1 + + + Pointer - - 44 - 702 - -1,25 - 2 - 10 - - - 0,00 - 0,00 - 0,00 - 1,00 - - - - - - + + 0 + 0 + 0 + 1 + + + 44 + 702 + 2 + 10 + -1.25 + + + LyricHelper - - 40 - 600 - -1,00 - 45 - 45 - - - LyricHelper - - - - - - + + + 40 + 600 + 45 + 45 + -1 + + + LyricHelper - - 40 - 12 - -1,00 - 45 - 45 - - - LyricHelper - - - - - - + + + 40 + 12 + 45 + 45 + -1 + + + LyricHelper - - 40 - 12 - -1,00 - 45 - 45 - - - LyricHelper - - - - - - + + + 40 + 12 + 45 + 45 + -1 + + + PauseBG - - 0 - 0 - -2,10 - 1280 - 720 - - - Visible - - - - - - - Invisible - - 1150 - 350 - -0,75 - 100 - 50 - - - StaticColor - - - - - - - Invisible - - 40 - 360 - -0,75 - 190 - 190 - - - 1,00 - 1,00 - 1,00 - 0,40 - - - - - - - Invisible - - 1150 - 150 - -0,75 - 100 - 50 - - - StaticColor - - - - - - - Invisible - - 40 - 160 - -0,75 - 165 - 165 - - - 1,00 - 1,00 - 1,00 - 0,40 - - - - - - - Invisible - - 1150 - 350 - -0,75 - 100 - 50 - - - StaticColor - - - - - - - Invisible - - 40 - 360 - -0,75 - 165 - 165 - - - 1,00 - 1,00 - 1,00 - 0,40 - - - - - - - Invisible - - 1150 - 10 - -0,75 - 100 - 50 - - - StaticColor - - - - - - - Invisible - - 40 - 111 - -0,75 - 140 - 140 - - - 1,00 - 1,00 - 1,00 - 0,40 - - - - - - - Invisible - - 1150 - 210 - -0,75 - 100 - 50 - - - StaticColor - - - - - - - Invisible - - 40 - 274 - -0,75 - 140 - 140 - - - 1,00 - 1,00 - 1,00 - 0,40 - - - - - - - Invisible - - 1150 - 410 - -0,75 - 100 - 50 - - - StaticColor - - - - - - - Invisible - - 40 - 442 - -0,75 - 140 - 140 - - - 1,00 - 1,00 - 1,00 - 0,40 - - - - - - - Invisible - - 528 - 150 - -0,75 - 100 - 50 - - - StaticColor - - - - - - - Invisible - - 40 - 160 - -0,75 - 165 - 165 - - - 1,00 - 1,00 - 1,00 - 0,40 - - - - - - - Invisible - - 528 - 350 - -0,75 - 100 - 50 - - - StaticColor - - - - - - - Invisible - - 40 - 360 - -0,75 - 165 - 165 - - - 1,00 - 1,00 - 1,00 - 0,40 - - - - - - - Invisible - - 1150 - 150 - -0,75 - 100 - 50 - - - StaticColor - - - - - - - Invisible - - 1103 - 160 - -0,75 - 165 - 165 - - - 1,00 - 1,00 - 1,00 - 0,40 - - - - - - - Invisible - - 1150 - 350 - -0,75 - 100 - 50 - - - StaticColor - - - - - - - Invisible - - 1103 - 360 - -0,75 - 165 - 165 - - - 1,00 - 1,00 - 1,00 - 0,40 - - - - - - - Invisible - - 528 - 10 - -0,75 - 100 - 50 - - - StaticColor - - - - - - - Invisible - - 40 - 111 - -0,75 - 140 - 140 - - - 1,00 - 1,00 - 1,00 - 0,40 - - - - - - - Invisible - - 528 - 210 - -0,75 - 100 - 50 - - - StaticColor - - - - - - - Invisible - - 40 - 274 - -0,75 - 140 - 140 - - - 1,00 - 1,00 - 1,00 - 0,40 - - - - - - - Invisible - - 528 - 410 - -0,75 - 100 - 50 - - - StaticColor - - - - - - - Invisible - - 40 - 442 - -0,75 - 140 - 140 - - - 1,00 - 1,00 - 1,00 - 0,40 - - - - - - - Invisible - - 1150 - 150 - -0,75 - 100 - 50 - - - StaticColor - - - - - - - Invisible - - 1103 - 160 - -0,75 - 165 - 165 - - - 1,00 - 1,00 - 1,00 - 0,40 - - - - - - - Invisible - - 1150 - 350 - -0,75 - 100 - 50 - - - StaticColor - - - - - - - Invisible - - 1103 - 360 - -0,75 - 165 - 165 - - - 1,00 - 1,00 - 1,00 - 0,40 - - - - - - - Invisible - - 528 - 10 - -0,75 - 100 - 50 - - - StaticColor - - - - - - - Invisible - - 40 - 111 - -0,75 - 140 - 140 - - - 1,00 - 1,00 - 1,00 - 0,40 - - - - - - - Invisible - - 528 - 210 - -0,75 - 100 - 50 - - - StaticColor - - - - - - - Invisible - - 40 - 274 - -0,75 - 140 - 140 - - - 1,00 - 1,00 - 1,00 - 0,40 - - - - - - - Invisible - - 528 - 410 - -0,75 - 100 - 50 - - - StaticColor - - - - - - - Invisible - - 40 - 442 - -0,75 - 140 - 140 - - - 1,00 - 1,00 - 1,00 - 0,40 - - - - - - - Invisible - - 1150 - 10 - -0,75 - 100 - 50 - - - StaticColor - - - - - - - Invisible - - 1103 - 111 - -0,75 - 140 - 140 - - - 1,00 - 1,00 - 1,00 - 0,40 - - - - - - - Invisible - - 1150 - 210 - -0,75 - 100 - 50 - - - StaticColor - - - - - - - Invisible - - 1103 - 274 - -0,75 - 140 - 140 - - - 1,00 - 1,00 - 1,00 - 0,40 - - - - - - - Invisible - - 1150 - 410 - -0,75 - 100 - 50 - - - StaticColor - - - - - - - Invisible - - 1103 - 442 - -0,75 - 140 - 140 - - - 1,00 - 1,00 - 1,00 - 0,40 - - - - - - + + + 0 + 0 + 1280 + 720 + -2.1 + + + + + + + 1150 + 350 + 100 + 50 + -0.75 + + + + + + 1 + 1 + 1 + 0.4 + + + 40 + 360 + 190 + 190 + -0.75 + + + + + + + 1150 + 150 + 100 + 50 + -0.75 + + + + + + 1 + 1 + 1 + 0.4 + + + 40 + 160 + 165 + 165 + -0.75 + + + + + + + 1150 + 350 + 100 + 50 + -0.75 + + + + + + 1 + 1 + 1 + 0.4 + + + 40 + 360 + 165 + 165 + -0.75 + + + + + + + 1150 + 10 + 100 + 50 + -0.75 + + + + + + 1 + 1 + 1 + 0.4 + + + 40 + 111 + 140 + 140 + -0.75 + + + + + + + 1150 + 210 + 100 + 50 + -0.75 + + + + + + 1 + 1 + 1 + 0.4 + + + 40 + 274 + 140 + 140 + -0.75 + + + + + + + 1150 + 410 + 100 + 50 + -0.75 + + + + + + 1 + 1 + 1 + 0.4 + + + 40 + 442 + 140 + 140 + -0.75 + + + + + + + 528 + 150 + 100 + 50 + -0.75 + + + + + + 1 + 1 + 1 + 0.4 + + + 40 + 160 + 165 + 165 + -0.75 + + + + + + + 528 + 350 + 100 + 50 + -0.75 + + + + + + 1 + 1 + 1 + 0.4 + + + 40 + 360 + 165 + 165 + -0.75 + + + + + + + 1150 + 150 + 100 + 50 + -0.75 + + + + + + 1 + 1 + 1 + 0.4 + + + 1103 + 160 + 165 + 165 + -0.75 + + + + + + + 1150 + 350 + 100 + 50 + -0.75 + + + + + + 1 + 1 + 1 + 0.4 + + + 1103 + 360 + 165 + 165 + -0.75 + + + + + + + 528 + 10 + 100 + 50 + -0.75 + + + + + + 1 + 1 + 1 + 0.4 + + + 40 + 111 + 140 + 140 + -0.75 + + + + + + + 528 + 210 + 100 + 50 + -0.75 + + + + + + 1 + 1 + 1 + 0.4 + + + 40 + 274 + 140 + 140 + -0.75 + + + + + + + 528 + 410 + 100 + 50 + -0.75 + + + + + + 1 + 1 + 1 + 0.4 + + + 40 + 442 + 140 + 140 + -0.75 + + + + + + + 1150 + 150 + 100 + 50 + -0.75 + + + + + + 1 + 1 + 1 + 0.4 + + + 1103 + 160 + 165 + 165 + -0.75 + + + + + + + 1150 + 350 + 100 + 50 + -0.75 + + + + + + 1 + 1 + 1 + 0.4 + + + 1103 + 360 + 165 + 165 + -0.75 + + + + + + + 528 + 10 + 100 + 50 + -0.75 + + + + + + 1 + 1 + 1 + 0.4 + + + 40 + 111 + 140 + 140 + -0.75 + + + + + + + 528 + 210 + 100 + 50 + -0.75 + + + + + + 1 + 1 + 1 + 0.4 + + + 40 + 274 + 140 + 140 + -0.75 + + + + + + + 528 + 410 + 100 + 50 + -0.75 + + + + + + 1 + 1 + 1 + 0.4 + + + 40 + 442 + 140 + 140 + -0.75 + + + + + + + 1150 + 10 + 100 + 50 + -0.75 + + + + + + 1 + 1 + 1 + 0.4 + + + 1103 + 111 + 140 + 140 + -0.75 + + + + + + + 1150 + 210 + 100 + 50 + -0.75 + + + + + + 1 + 1 + 1 + 0.4 + + + 1103 + 274 + 140 + 140 + -0.75 + + + + + + + 1150 + 410 + 100 + 50 + -0.75 + + + + + + 1 + 1 + 1 + 0.4 + + + 1103 + 442 + 140 + 140 + -0.75 + + + + + 640 20 - - -1,00 - + -2 27 - 880 - - - TextBlack - - - TextBlack - + + Center - - Center - + Center - Normal - - - - - - - + + 1214 697 - - -1,00 - + -1 20 - - - - TextWhite - - - TextWhite - + 0 + + Right - - Center - + Center - Normal - - - - - - - + + 640 170 - - -2,11 - + -2.11 90 - - - - StaticColor - - - TextSColor - + 0 + + Center - - Center - + Center - Normal - TR_SCREENSING_PAUSE - - - - - - + + 40 80 - - -1,00 - + -1 30 - - - - TextSColor - - - TextSColor - + 0 + + Left - - Center - + Center - Outline - - - - - - - + + 40 585 - - -1,00 - + -1 30 - - - - TextSColor - - - TextSColor - + 0 + + Left - - Center - + Center - Outline - - - - - - - + + 640 20 - - -1,00 - + -1 27 - - - - TextColor - - - TextSColor - + 0 + + Left - - Center - + Center - Outline - - - - - - - + + 1240 355 - - -1,00 - + -1 198 - - - - Player1Dim2 - - - TextSColor - + 0 + 0.4 + Right - - Center - + Center - Normal - - - - - - - + + 110 513 - - -1,00 - + -1 28 - - - - 1,00 - 1,00 - 1,00 - 0,40 - - - TextSColor - + 0 + + 1 + 1 + 1 + 0.4 + + Center - - Center - + Center - Outline - - - - - - - + + 1240 155 - - -1,00 - + -1 173 - - - - Player1Dim2 - - - Player1 - + 0 + 0.4 + Right - - Center - + Center - Normal - - - - - - - + + 110 288 - - -1,00 - + -1 28 - - - - 1,00 - 1,00 - 1,00 - 0,40 - - - Player1 - + 0 + + 1 + 1 + 1 + 0.4 + + Center - - Center - + Center - Outline - - - - - - - + + 1240 355 - - -1,00 - + -1 173 - - - - Player2Dim2 - - - Player2 - + 0 + 0.4 + Right - - Center - + Center - Normal - - - - - - - + + 110 488 - - -1,00 - + -1 28 - - - - 1,00 - 1,00 - 1,00 - 0,40 - - - Player2 - + 0 + + 1 + 1 + 1 + 0.4 + + Center - - Center - + Center - Outline - - - - - - - + + 1240 106 - - -1,00 - + -1 148 - - - - Player1Dim2 - - - Player1 - + 0 + 0.4 + Right - - Center - + Center - Normal - - - - - - - + + 110 219 - - -1,00 - + -1 28 - - - - 1,00 - 1,00 - 1,00 - 0,40 - - - Player1 - + 0 + + 1 + 1 + 1 + 0.4 + + Center - - Center - + Center - Outline - - - - - - - + + 1240 269 - - -1,00 - + -1 148 - - - - Player2Dim2 - - - Player2 - + 0 + 0.4 + Right - - Center - + Center - Normal - - - - - - - + + 110 382 - - -1,00 - + -1 28 - - - - 1,00 - 1,00 - 1,00 - 0,40 - - - Player2 - + 0 + + 1 + 1 + 1 + 0.4 + + Center - - Center - + Center - Outline - - - - - - - + + 1240 437 - - -1,00 - + -1 148 - - - - Player3Dim2 - - - Player3 - + 0 + 0.4 + Right - - Center - + Center - Normal - - - - - - - + + 110 550 - - -1,00 - + -1 28 - - - - 1,00 - 1,00 - 1,00 - 0,40 - - - Player3 - + 0 + + 1 + 1 + 1 + 0.4 + + Center - - Center - + Center - Outline - - - - - - - + + 324 155 - - -1,00 - + -1 173 - - - - Player1Dim2 - - - Player1 - + 0 + 0.4 + Center - - Center - + Center - Normal - - - - - - - + + 110 288 - - -1,00 - + -1 28 - - - - 1,00 - 1,00 - 1,00 - 0,40 - - - Player1 - + 0 + + 1 + 1 + 1 + 0.4 + + Center - - Center - + Center - Outline - - - - - - - + + 324 355 - - -1,00 - + -1 173 - - - - Player2Dim2 - - - Player2 - + 0 + 0.4 + Center - - Center - + Center - Normal - - - - - - - + + 110 488 - - -1,00 - + -1 28 - - - - 1,00 - 1,00 - 1,00 - 0,40 - - - Player2 - + 0 + + 1 + 1 + 1 + 0.4 + + Center - - Center - + Center - Outline - - - - - - - + + 967 155 - - -1,00 - + -1 173 - - - - Player3Dim2 - - - Player3 - + 0 + 0.4 + Center - - Center - + Center - Normal - - - - - - - + + 1173 288 - - -1,00 - + -1 28 - - - - 1,00 - 1,00 - 1,00 - 0,40 - - - Player3 - + 0 + + 1 + 1 + 1 + 0.4 + + Center - - Center - + Center - Outline - - - - - - - + + 967 355 - - -1,00 - + -1 173 - - - - Player4Dim2 - - - Player4 - + 0 + 0.4 + Center - - Center - + Center - Normal - - - - - - - + + 1173 488 - - -1,00 - + -1 28 - - - - 1,00 - 1,00 - 1,00 - 0,40 - - - Player4 - + 0 + + 1 + 1 + 1 + 0.4 + + Center - - Center - + Center - Outline - - - - - - - + + 324 106 - - -1,00 - + -1 148 - - - - Player1Dim2 - - - Player1 - + 0 + 0.4 + Center - - Center - + Center - Normal - - - - - - - + + 110 219 - - -1,00 - + -1 28 - - - - 1,00 - 1,00 - 1,00 - 0,40 - - - Player1 - + 0 + + 1 + 1 + 1 + 0.4 + + Center - - Center - + Center - Outline - - - - - - - + + 324 269 - - -1,00 - + -1 148 - - - - Player2Dim2 - - - Player2 - + 0 + 0.4 + Center - - Center - + Center - Normal - - - - - - - + + 110 382 - - -1,00 - + -1 28 - - - - 1,00 - 1,00 - 1,00 - 0,40 - - - Player2 - + 0 + + 1 + 1 + 1 + 0.4 + + Center - - Center - + Center - Outline - - - - - - - + + 324 437 - - -1,00 - + -1 148 - - - - Player3Dim2 - - - Player3 - + 0 + 0.4 + Center - - Center - + Center - Normal - - - - - - - + + 110 550 - - -1,00 - + -1 28 - - - - 1,00 - 1,00 - 1,00 - 0,40 - - - Player3 - + 0 + + 1 + 1 + 1 + 0.4 + + Center - - Center - + Center - Outline - - - - - - - + + 967 155 - - -1,00 - + -1 173 - - - - Player4Dim2 - - - Player4 - + 0 + 0.4 + Center - - Center - + Center - Normal - - - - - - - + + 1173 288 - - -1,00 - + -1 28 - - - - 1,00 - 1,00 - 1,00 - 0,40 - - - Player4 - + 0 + + 1 + 1 + 1 + 0.4 + + Center - - Center - + Center - Outline - - - - - - - + + 967 355 - - -1,00 - + -1 173 - - - - Player5Dim2 - - - Player5 - + 0 + 0.4 + Center - - Center - + Center - Normal - - - - - - - + + 1173 488 - - -1,00 - + -1 28 - - - - 1,00 - 1,00 - 1,00 - 0,40 - - - Player5 - + 0 + + 1 + 1 + 1 + 0.4 + + Center - - Center - + Center - Outline - - - - - - - + + 324 106 - - -1,00 - + -1 148 - - - - Player1Dim2 - - - Player1 - + 0 + 0.4 + Center - - Center - + Center - Normal - - - - - - - + + 110 219 - - -1,00 - + -1 28 - - - - 1,00 - 1,00 - 1,00 - 0,40 - - - Player1 - + 0 + + 1 + 1 + 1 + 0.4 + + Center - - Center - + Center - Outline - - - - - - - + + 324 269 - - -1,00 - + -1 148 - - - - Player2Dim2 - - - Player2 - + 0 + 0.4 + Center - - Center - + Center - Normal - - - - - - - + + 110 382 - - -1,00 - + -1 28 - - - - 1,00 - 1,00 - 1,00 - 0,40 - - - Player2 - + 0 + + 1 + 1 + 1 + 0.4 + + Center - - Center - + Center - Outline - - - - - - - + + 324 437 - - -1,00 - + -1 148 - - - - Player3Dim2 - - - Player3 - + 0 + 0.4 + Center - - Center - + Center - Normal - - - - - - - + + 110 550 - - -1,00 - + -1 28 - - - - 1,00 - 1,00 - 1,00 - 0,40 - - - Player3 - + 0 + + 1 + 1 + 1 + 0.4 + + Center - - Center - + Center - Outline - - - - - - - + + 967 106 - - -1,00 - + -1 148 - - - - Player4Dim2 - - - Player4 - + 0 + 0.4 + Center - - Center - + Center - Normal - - - - - - - + + 1173 219 - - -1,00 - + -1 28 - - - - 1,00 - 1,00 - 1,00 - 0,40 - - - Player4 - + 0 + + 1 + 1 + 1 + 0.4 + + Center - - Center - + Center - Outline - - - - - - - + + 967 269 - - -1,00 - + -1 148 - - - - Player5Dim2 - - - Player5 - + 0 + 0.4 + Center - - Center - + Center - Normal - - - - - - - + + 1173 382 - - -1,00 - + -1 28 - - - - 1,00 - 1,00 - 1,00 - 0,40 - - - Player5 - + 0 + + 1 + 1 + 1 + 0.4 + + Center - - Center - + Center - Outline - - - - - - - + + 967 437 - - -1,00 - + -1 148 - - - - Player6Dim2 - - - Player6 - + 0 + 0.4 + Center - - Center - + Center - Normal - - - - - - - + + 1173 550 - - -1,00 - + -1 28 - - - - 1,00 - 1,00 - 1,00 - 0,40 - - - Player6 - + 0 + + 1 + 1 + 1 + 0.4 + + Center - - Center - + Center - Outline - - - - - - - + + + + + + + + + + + + 637 + 600 + 1200 + 42 + -1 + + + + + + + 637 + 642 + 1200 + 38 + -1 + + + + + + + 637 + 12 + 1200 + 42 + -1 + + + + + + + 637 + 54 + 1200 + 38 + -1 + + + + + + + 637 + 12 + 1200 + 42 + -1 + + + + + + + 637 + 54 + 1200 + 38 + -1 + + + + + + + + NoteLeft - NoteMiddle - NoteRight - NoteBackgroundLeft - NoteBackgroundMiddle - NoteBackgroundRight - Star - ToneHelper - - PerfectNoteStar - - - + PerfectNoteStar - 35 - 350 - -1,50 - 1210 - 200 - 35 - 150 - -1,50 - 1210 - 175 - 35 - 350 - -1,50 - 1210 - 175 - 35 - 105 - -1,50 - 1210 - 150 - 35 - 268 - -1,50 - 1210 - 150 - 35 - 436 - -1,50 - 1210 - 150 - 35 - 150 - -1,50 - 578 - 175 - 35 - 350 - -1,50 - 578 - 175 - 678 - 150 - -1,50 - 578 - 175 - 678 - 350 - -1,50 - 578 - 175 - 35 - 105 - -1,50 - 578 - 150 - 35 - 268 - -1,50 - 578 - 150 - 35 - 436 - -1,50 - 578 - 150 - 678 - 150 - -1,50 - 578 - 175 - 678 - 350 - -1,50 - 578 - 175 - 35 - 105 - -1,50 - 578 - 150 - 35 - 268 - -1,50 - 578 - 150 - 35 - 436 - -1,50 - 578 - 150 - 678 - 105 - -1,50 - 578 - 150 - 678 - 268 - -1,50 - 578 - 150 - 678 - 436 - -1,50 - 578 - 150 + + + 35 + 350 + 1210 + 200 + -1.5 + + + + + 35 + 150 + 1210 + 175 + -1.5 + + + + + 35 + 350 + 1210 + 175 + -1.5 + + + + + 35 + 105 + 1210 + 150 + -1.5 + + + + + 35 + 268 + 1210 + 150 + -1.5 + + + + + 35 + 436 + 1210 + 150 + -1.5 + + + + + 35 + 150 + 578 + 175 + -1.5 + + + + + 35 + 350 + 578 + 175 + -1.5 + + + + + 678 + 150 + 578 + 175 + -1.5 + + + + + 678 + 350 + 578 + 175 + -1.5 + + + + + 35 + 105 + 578 + 150 + -1.5 + + + + + 35 + 268 + 578 + 150 + -1.5 + + + + + 35 + 436 + 578 + 150 + -1.5 + + + + + 678 + 150 + 578 + 175 + -1.5 + + + + + 678 + 350 + 578 + 175 + -1.5 + + + + + 35 + 105 + 578 + 150 + -1.5 + + + + + 35 + 268 + 578 + 150 + -1.5 + + + + + 35 + 436 + 578 + 150 + -1.5 + + + + + 678 + 105 + 578 + 150 + -1.5 + + + + + 678 + 268 + 578 + 150 + -1.5 + + + + + 678 + 436 + 578 + 150 + -1.5 + + - - - \ No newline at end of file + + + + + + + + diff --git a/Output/Themes/Ambient/Screens/ScreenSong.xml b/Output/Themes/Ambient/Screens/ScreenSong.xml index b23661d3..d9f45cd2 100644 --- a/Output/Themes/Ambient/Screens/ScreenSong.xml +++ b/Output/Themes/Ambient/Screens/ScreenSong.xml @@ -1,2215 +1,1280 @@ - - - + + + + ScreenSong 5 - - + + + Video - + - BG_Default - - - BackgroundColor - - - + + + + + SongMenu - - 40 - 600 - 0,00 - 1200 - 50 - - - StaticColor - - - + + + 40 + 600 + 1200 + 50 + 0 + - 10 26 + 10 - - - + + Menu - - 40 - 600 - 0,00 - 1200 - 50 - - - StaticColor - - - + + + 40 + 600 + 1200 + 50 + 0 + - 10 26 + 10 - - - + + SongMenuBG - - 40 - 40 - -2,10 - 360 - 360 - - - 1,00 - 1,00 - 1,00 - 1,00 - - - - - - + + + 40 + 40 + 360 + 360 + -2.1 + + + + + 1070 65 - - -2,11 - + -2.11 42 - 350 - - - Player1 - - - Player1 - + + Left - - Center - + Center - Outline - - - - - - - + + 1070 135 - - -2,11 - + -2.11 42 - 350 - - - Player2 - - - Player2 - + + Left - - Center - + Center - Outline - - - - - - - + + 1070 205 - - -2,11 - + -2.11 42 - 350 - - - Player3 - - - Player3 - + + Left - - Center - + Center - Outline - - - - - - - + + 1070 275 - - -2,11 - + -2.11 42 - 350 - - - Player4 - - - Player4 - + + Left - - Center - + Center - Outline - - - - - - - + + 1070 345 - - -2,11 - + -2.11 42 - 350 - - - Player5 - - - Player5 - + + Left - - Center - + Center - Outline - - - - - - - + + 1070 415 - - -2,11 - + -2.11 42 - 350 - - - Player6 - - - Player6 - + + Left - - Center - + Center - Outline - - - - - - - + + 220 612 - - 0,00 - + 0 27 - 340 - - - StaticColor - - - TextSColor - + + Center - - Center - + Center - Outline - - - - - 24 26 + 24 - - - + + 825 612 - - 0,00 - + 0 27 - 830 - - - StaticColor - - - TextSColor - + + Center - - Center - + Center - Outline - - - - - 24 26 + 24 - - - + + 400 612 - - 0,00 - + 0 27 - - - - StaticColor - - - TextSColor - + 0 + + Right - - Center - + Center - Outline - TR_SCREENSONG_SEARCH - - - - - - + + 410 612 - - 0,00 - + 0 27 - - - - StaticColor - - - TextSColor - + 0 + + Left - - Center - + Center - Outline - - - - - - - + + 220 47 - - -2,11 - + -2.11 34 - 350 - - - StaticColor - - - TextSColor - + + Center - - Center - + Center - Outline - TR_SCREENSONG_SONGOPTIONS - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + CoverTile - CoverBackground - DuetIcon - VideoIcon - MedleyCalcIcon - MedleyTagIcon - - - 1,00 - 1,00 - 1,00 - 0,20 - + + 1 + 1 + 1 + 0.2 + - 6 - 4 - - 10,00 - - 10,00 - 4 - 4 - - 410 - 40 - -1,00 - 830 - 550 - - 410 - 40 - -1,00 - 550 - 550 - - + 10 + 10 + + 410 + 40 + 830 + 550 + -1 + + + 410 + 40 + 550 + 550 + -1 + + 222 416 - - -1,01 - + -1.01 39 - 340 - - - StaticColor - - - TextSColor - + + Center - - Center - + Top - Outline - - - - - - - + + 222 456 - - -1,01 - + -1.01 32 - 340 - - - StaticColor - - - TextSColor - + + Center - - Center - + Top - Outline - - - - - - - + + 222 490 - - -1,01 - + -1.01 28 - 340 - - - StaticColor - - - TextSColor - + + Center - - Center - + Top - Outline - - - - - - - + + CoverBackground - - 40 - 40 - -1,00 - 360 - 360 - - - Visible - - - - - - + + + 40 + 40 + 360 + 360 + -1 + + + CoverBackground - - 40 - 40 - -1,00 - 360 - 550 - - - StaticColor - - - - - - + + + 40 + 40 + 360 + 550 + -1 + + + DuetIcon - - 200 - 530 - -1,00 - 40 - 40 - - - StaticColor - - - - - - + + + 200 + 530 + 40 + 40 + -1 + + + VideoIcon - - 120 - 530 - -1,00 - 40 - 40 - - - StaticColor - - - - - - + + + 120 + 530 + 40 + 40 + -1 + + + MedleyCalcIcon - - 280 - 530 - -1,00 - 40 - 40 - - - StaticColor - - - - - - + + + 280 + 530 + 40 + 40 + -1 + + + MedleyTagIcon - - 280 - 530 - -1,00 - 40 - 40 - - - StaticColor - - - - + + + 280 + 530 + 40 + 40 + -1 + + - - - 970 - 80 - -0,90 - 295 - 460 - 50,00 - + + + + + Button + SelectSlideArrowLeft + SelectSlideArrowRight + SelectSlide + SelectSlideArrowLeft + SelectSlideArrowRight + + 40 + 135 + 360 + 40 + -2.11 + + + 45 + 140 + 30 + 30 + -2.12 + + + 365 + 140 + 30 + 30 + -2.12 + + + + + + + + 25 + 0 + 0 + 280 + Outline + Bold + 1 + + + Button + SelectSlideArrowLeft + SelectSlideArrowRight + SelectSlide + SelectSlideArrowLeft + SelectSlideArrowRight + + 40 + 190 + 360 + 40 + -2.11 + + + 45 + 195 + 30 + 30 + -2.12 + + + 365 + 195 + 30 + 30 + -2.12 + + + + + + + + 25 + 0 + 0 + 280 + Outline + Bold + 1 + + + Button + SelectSlideArrowLeft + SelectSlideArrowRight + SelectSlide + SelectSlideArrowLeft + SelectSlideArrowRight + + 40 + 180 + 360 + 40 + -2.11 + + + 45 + 190 + 30 + 30 + -2.12 + + + 365 + 190 + 30 + 30 + -2.12 + + + + + + + + 25 + 0 + 0 + 280 + Outline + Bold + 1 + + + Button + SelectSlideArrowLeft + SelectSlideArrowRight + SelectSlide + SelectSlideArrowLeft + SelectSlideArrowRight + + 40 + 90 + 360 + 40 + -2.11 + + + 45 + 100 + 30 + 30 + -2.12 + + + 365 + 100 + 30 + 30 + -2.12 + + + + + + + + 25 + 0 + 0 + 280 + Outline + Bold + 3 + + + + + + + + + 970 + 80 + 295 + 460 + -0.9 + + 50 CoverTile - CoverTile - - - StaticColorAlpha - - - StaticColor - - - - + + + 54 5 - - -1,01 - + -1.01 22 - 235 - - - StaticColor - - - TextSColor - + + Left - - Center - + Center - Outline - TR_SCREENSONG_ARTIST_TITLE - - - - - - - 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 - - - - SelectSlideArrowLeft - - SelectSlideArrowRight - - - - 0 - 28 - -1,01 - 293 - 24 - - 54 - 30 - -1,02 - 20 - 20 - - 271 - 30 - -1,02 - 20 - 20 - - - ButtonColor - - - ButtonSColor - - - SelectSlideHColor - - - ArrowColor - - - ArrowSColor - - - TextColor - - - TextSColor - - 22,00 - - 25,00 - - - 230,00 - - Outline - - Bold - - 1 - - - - Invisible - - Invisible - - 975 - 45 - -1,01 - 220 - 25 - - - ButtonColor - - - ButtonSColor - - + + 0 0 - + 46 + 46 + -1 + + + + Menu + + + 970 + 40 + 295 + 40 + -1 + + + + Menu + + + 970 + 550 + 295 + 40 + -1 + + + + + + + 975 + 45 + 220 + 25 + -1.01 + + + + + 0 + 0 + 0 25 - 220 - - - ButtonTextColor - - - ButtonTextSColor - + + Left - - Center - + Center - Outline - - - - - - - - - - - + + + CloseIcon - CloseIcon - - 1215 - 42 - -1,01 - 35 - 35 - - - ButtonColor - - - ButtonSColor - - + + 1215 + 42 + 35 + 35 + -1.01 + + + + 180 7 - + 0 25 - 350 - - - ButtonTextColor - - - ButtonTextSColor - + + Center - - Center - + Center - Outline - - - - - - - - - - - - DeleteIcon - - DeleteIcon - - 1215 - 553 - -1,01 - 35 - 35 - - - ButtonColor - - - ButtonSColor - - - 180 - 5 - - 25 - - 350 - - - ButtonTextColor - - - ButtonTextSColor - - Center - - Center - - - - Outline - - - - - - - - - - - - + + + SaveIcon - SaveIcon - - 1175 - 553 - -1,01 - 35 - 35 - - - ButtonColor - - - ButtonSColor - - + + 1175 + 553 + 35 + 35 + -1.01 + + + + 180 5 - + 0 25 - 350 - - - ButtonTextColor - - - ButtonTextSColor - + + Center - - Center - + Center - Outline - - - - - - - - - - - + + + + DeleteIcon + DeleteIcon + + 1215 + 553 + 35 + 35 + -1.01 + + + + + 180 + 5 + 0 + 25 + 350 + + + Center + Center + + Outline + + + + SingIcon - SingIcon - - 975 - 553 - -1,01 - 35 - 35 - - - ButtonColor - - - ButtonSColor - - + + 975 + 553 + 35 + 35 + -1.01 + + + + 180 5 - + 0 25 - 350 - - - ButtonTextColor - - - ButtonTextSColor - + + Center - - Center - + Center - Outline - - - - - - - - - + + + + Button + SelectSlideArrowLeft + SelectSlideArrowRight + + SelectSlideArrowLeft + SelectSlideArrowRight + + 0 + 28 + 293 + 24 + -1.01 + + + 54 + 30 + 20 + 20 + -1.02 + + + 271 + 30 + 20 + 20 + -1.02 + + + + + + + + 22.00 + 25.00 + 230.00 + Outline + Bold + 1 + - - \ No newline at end of file + + + + \ No newline at end of file diff --git a/Output/Themes/Ambient/Screens/ScreenTest.xml b/Output/Themes/Ambient/Screens/ScreenTest.xml index 2137eab8..6958eb63 100644 --- a/Output/Themes/Ambient/Screens/ScreenTest.xml +++ b/Output/Themes/Ambient/Screens/ScreenTest.xml @@ -1,17 +1,21 @@  - - + + + ScreenTest 1 - - - Video - - - - BG_Default - - - BackgroundColor - - - \ No newline at end of file + + + + None + + + + diff --git a/Output/Themes/Ambient/Skin Blue.xml b/Output/Themes/Ambient/Skin Blue.xml index 34cff336..b1ab5aa9 100644 --- a/Output/Themes/Ambient/Skin Blue.xml +++ b/Output/Themes/Ambient/Skin Blue.xml @@ -1,286 +1,206 @@  - 3 + 4 Blue bohning - 0 - 0 + 0 + 0 - 0,000 - 0,000 - 1,000 - 1,000 + 0.000 + 0.000 + 1.000 + 1.000 - 1,000 - 0,000 - 0,000 - 1,000 + 1.000 + 0.000 + 0.000 + 1.000 - 0,000 - 1,000 - 0,000 - 1,000 + 0.000 + 1.000 + 0.000 + 1.000 - 0,500 - 0,000 - 1,000 - 1,000 + 0.500 + 0.000 + 1.000 + 1.000 - 1,000 - 0,800 - 0,000 - 1,000 + 1.000 + 0.800 + 0.000 + 1.000 - 1,000 - 0,000 - 0,500 - 1,000 + 1.000 + 0.000 + 0.500 + 1.000 - - - - 0,000 - 0,000 - 1,000 - 0,500 - - - 1,000 - 0,000 - 0,000 - 0,500 - - - 0,000 - 1,000 - 0,000 - 0,500 - - - 0,500 - 0,000 - 1,000 - 0,500 - - - 1,000 - 0,800 - 0,000 - 0,500 - - - 1,000 - 0,000 - 0,500 - 0,500 - - - 0,000 - 0,000 - 1,000 - 0,400 - - - 1,000 - 0,000 - 0,000 - 0,400 - - - 0,000 - 1,000 - 0,000 - 0,400 - - - 0,500 - 0,000 - 1,000 - 0,400 - - - 1,000 - 0,800 - 0,000 - 0,400 - - - 1,000 - 0,000 - 0,500 - 0,400 - - 0,000 - 0,000 - 0,750 - 1,000 + 0.000 + 0.000 + 0.750 + 1.000 - 0,675 - 0,890 - 0,969 - 1,000 + 0.675 + 0.890 + 0.969 + 1.000 - 0,675 - 0,890 - 0,969 - 0,500 + 0.675 + 0.890 + 0.969 + 0.500 - 0,675 - 0,890 - 0,969 - 1,000 + 0.675 + 0.890 + 0.969 + 0.600 - 0,675 - 0,890 - 0,969 - 0,300 + 0.675 + 0.890 + 0.969 + 0.300 - - 0,675 - 0,890 - 0,969 - 1,000 - + + 0.675 + 0.890 + 0.969 + 1.000 + - 0,675 - 0,890 - 0,969 - 0,500 + 0.675 + 0.890 + 0.969 + 0.500 - - 0,675 - 0,890 - 0,969 - 1,000 - + + 0.675 + 0.890 + 0.969 + 1.000 + - 0,675 - 0,890 - 0,969 - 1,000 + 0.675 + 0.890 + 0.969 + 1.000 - 0,675 - 0,890 - 0,969 - 0,500 + 0.675 + 0.890 + 0.969 + 0.500 - - 0,675 - 0,890 - 0,969 - 1,000 - - - 0,675 - 0,890 - 0,969 - 0,500 - + + 0.675 + 0.890 + 0.969 + 0.500 + - 0,675 - 0,890 - 0,969 - 0,300 + 0.675 + 0.890 + 0.969 + 0.300 - - 0,675 - 0,890 - 0,969 - 1,000 - + + 0.675 + 0.890 + 0.969 + 1.000 + - 0,675 - 0,890 - 0,969 - 0,500 + 0.675 + 0.890 + 0.969 + 0.500 - - 0,675 - 0,890 - 0,969 - 1,000 - + + 0.675 + 0.890 + 0.969 + 1.000 + - 1,000 - 0,000 - 0,000 - 1,000 + 1.000 + 0.000 + 0.000 + 1.000 - - 0,000 - 0,000 - 0,000 - 1,000 - - - 0,000 - 0,000 - 0,000 - 1,000 - + + 0.000 + 0.000 + 0.000 + 1.000 + + + 1.000 + 1.000 + 1.000 + 1.000 + - 1,000 - 1,000 - 1,000 - 1,000 + 1.000 + 1.000 + 1.000 + 1.000 - 1,000 - 1,000 - 1,000 - 0,000 + 1.000 + 1.000 + 1.000 + 0.000 - - 0,000 - 0,000 - 1,000 - 1,000 - + + 0.000 + 0.000 + 1.000 + 1.000 + - 0,000 - 0,000 - 0,000 - 1,000 + 0.000 + 0.000 + 0.000 + 1.000 - 0,300 - 0,300 - 0,300 - 1,000 + 0.300 + 0.300 + 0.300 + 1.000 - 0,000 - 0,000 - 1,000 - 0,500 + 0.000 + 0.000 + 1.000 + 0.500 - 0,800 - 0,950 - 1,000 - 0,500 + 0.800 + 0.950 + 1.000 + 0.500 - 0,800 - 0,950 - 1,000 - 0,850 + 0.800 + 0.950 + 1.000 + 0.850 - + [Blue]BG_Default.png [Blue]BG_Options.png @@ -321,7 +241,6 @@ VideoIconBG.png MedleyCalcIcon.png MedleyTagIcon.png - Invisible.png PlayerSelector.png PreviousIcon.png NextIcon.png diff --git a/Output/Themes/Ambient/Skin Green.xml b/Output/Themes/Ambient/Skin Green.xml index 868a0b0f..3b6e3ba8 100644 --- a/Output/Themes/Ambient/Skin Green.xml +++ b/Output/Themes/Ambient/Skin Green.xml @@ -1,280 +1,200 @@  - 3 + 4 Green bohning - 0 - 0 + 0 + 0 - 0,000 - 0,000 - 1,000 - 1,000 + 0.000 + 0.000 + 1.000 + 1.000 - 1,000 - 0,000 - 0,000 - 1,000 + 1.000 + 0.000 + 0.000 + 1.000 - 0,000 - 1,000 - 0,000 - 1,000 + 0.000 + 1.000 + 0.000 + 1.000 - 0,500 - 0,000 - 1,000 - 1,000 + 0.500 + 0.000 + 1.000 + 1.000 - 1,000 - 0,800 - 0,000 - 1,000 + 1.000 + 0.800 + 0.000 + 1.000 - 1,000 - 0,000 - 0,500 - 1,000 + 1.000 + 0.000 + 0.500 + 1.000 - - - - 0,000 - 0,000 - 1,000 - 0,500 - - - 1,000 - 0,000 - 0,000 - 0,500 - - - 0,000 - 1,000 - 0,000 - 0,500 - - - 0,500 - 0,000 - 1,000 - 0,500 - - - 1,000 - 0,800 - 0,000 - 0,500 - - - 1,000 - 0,000 - 0,500 - 0,500 - - - 0,000 - 0,000 - 1,000 - 0,400 - - - 1,000 - 0,000 - 0,000 - 0,400 - - - 0,000 - 1,000 - 0,000 - 0,400 - - - 0,500 - 0,000 - 1,000 - 0,400 - - - 1,000 - 0,800 - 0,000 - 0,400 - - - 1,000 - 0,000 - 0,500 - 0,400 - - 0,000 - 0,750 - 0,000 - 1,000 + 0.000 + 0.750 + 0.000 + 1.000 - 0,709 - 0,968 - 0,674 - 1,000 + 0.709 + 0.968 + 0.674 + 1.000 - 0,709 - 0,968 - 0,674 - 0,500 + 0.709 + 0.968 + 0.674 + 0.500 - 0,709 - 0,968 - 0,674 - 1,000 + 0.709 + 0.968 + 0.674 + 0.600 - 0,709 - 0,968 - 0,674 - 0,300 + 0.709 + 0.968 + 0.674 + 0.300 - - 0,709 - 0,968 - 0,674 - 1,000 - + + 0.709 + 0.968 + 0.674 + 1.000 + - 0,709 - 0,968 - 0,674 - 0,500 + 0.709 + 0.968 + 0.674 + 0.500 - - 0,709 - 0,968 - 0,674 - 1,000 - + + 0.709 + 0.968 + 0.674 + 1.000 + - 0,709 - 0,968 - 0,674 - 1,000 + 0.709 + 0.968 + 0.674 + 1.000 - - 0,709 - 0,968 - 0,674 - 1,000 - - - 0,709 - 0,968 - 0,674 - 0,500 - + + 0.709 + 0.968 + 0.674 + 0.500 + - 0,709 - 0,968 - 0,674 - 0,300 + 0.709 + 0.968 + 0.674 + 0.300 - - 0,709 - 0,968 - 0,674 - 1,000 - + + 0.709 + 0.968 + 0.674 + 1.000 + - 0,709 - 0,968 - 0,674 - 0,500 + 0.709 + 0.968 + 0.674 + 0.500 - - 0,709 - 0,968 - 0,674 - 1,000 - + + 0.709 + 0.968 + 0.674 + 1.000 + - 1,000 - 0,000 - 0,000 - 1,000 + 1.000 + 0.000 + 0.000 + 1.000 - - 0,000 - 0,000 - 0,000 - 1,000 - - - 0,000 - 0,000 - 0,000 - 1,000 - + + 0.000 + 0.000 + 0.000 + 1.000 + + + 1.000 + 1.000 + 1.000 + 1.000 + - 1,000 - 1,000 - 1,000 - 1,000 + 1.000 + 1.000 + 1.000 + 1.000 - 1,000 - 1,000 - 1,000 - 0,000 + 1.000 + 1.000 + 1.000 + 0.000 - - 0,000 - 1,000 - 0,000 - 1,000 - + + 0.000 + 1.000 + 0.000 + 1.000 + - 0,000 - 0,000 - 0,000 - 1,000 + 0.000 + 0.000 + 0.000 + 1.000 - 0,300 - 0,300 - 0,300 - 1,000 + 0.300 + 0.300 + 0.300 + 1.000 - 0,000 - 1,000 - 0,000 - 0,500 + 0.000 + 1.000 + 0.000 + 0.500 - 0,800 - 1,000 - 0,811 - 0,500 + 0.800 + 1.000 + 0.811 + 0.500 - 0,800 - 1,000 - 0,811 - 0,811 + 0.800 + 1.000 + 0.811 + 0.811 - + [Green]BG_Default.png [Green]BG_Options.png @@ -315,7 +235,6 @@ VideoIconBG.png MedleyCalcIcon.png MedleyTagIcon.png - Invisible.png PlayerSelector.png PreviousIcon.png NextIcon.png diff --git a/Output/Themes/Ambient/Skin Red.xml b/Output/Themes/Ambient/Skin Red.xml index a0929c67..0f65931e 100644 --- a/Output/Themes/Ambient/Skin Red.xml +++ b/Output/Themes/Ambient/Skin Red.xml @@ -1,280 +1,200 @@  - 3 + 4 Red bohning - 0 - 0 + 0 + 0 - 0,000 - 0,000 - 1,000 - 1,000 + 0.000 + 0.000 + 1.000 + 1.000 - 1,000 - 0,000 - 0,000 - 1,000 + 1.000 + 0.000 + 0.000 + 1.000 - 0,000 - 1,000 - 0,000 - 1,000 + 0.000 + 1.000 + 0.000 + 1.000 - 0,500 - 0,000 - 1,000 - 1,000 + 0.500 + 0.000 + 1.000 + 1.000 - 1,000 - 0,800 - 0,000 - 1,000 + 1.000 + 0.800 + 0.000 + 1.000 - 1,000 - 0,000 - 0,500 - 1,000 + 1.000 + 0.000 + 0.500 + 1.000 - - - - 0,000 - 0,000 - 1,000 - 0,500 - - - 1,000 - 0,000 - 0,000 - 0,500 - - - 0,000 - 1,000 - 0,000 - 0,500 - - - 0,500 - 0,000 - 1,000 - 0,500 - - - 1,000 - 0,800 - 0,000 - 0,500 - - - 1,000 - 0,000 - 0,500 - 0,500 - - - 0,000 - 0,000 - 1,000 - 0,400 - - - 1,000 - 0,000 - 0,000 - 0,400 - - - 0,000 - 1,000 - 0,000 - 0,400 - - - 0,500 - 0,000 - 1,000 - 0,400 - - - 1,000 - 0,800 - 0,000 - 0,400 - - - 1,000 - 0,000 - 0,500 - 0,400 - - 0,750 - 0,000 - 0,000 - 1,000 + 0.750 + 0.000 + 0.000 + 1.000 - 0,968 - 0,674 - 0,674 - 1,000 + 0.968 + 0.674 + 0.674 + 1.000 - 0,968 - 0,674 - 0,674 - 0,500 + 0.968 + 0.674 + 0.674 + 0.500 - 0,968 - 0,674 - 0,674 - 1,000 + 0.968 + 0.674 + 0.674 + 0.600 - 0,968 - 0,674 - 0,674 - 0,300 + 0.968 + 0.674 + 0.674 + 0.300 - - 0,968 - 0,674 - 0,674 - 1,000 - + + 0.968 + 0.674 + 0.674 + 1.000 + - 0,968 - 0,674 - 0,674 - 0,500 + 0.968 + 0.674 + 0.674 + 0.500 - - 0,968 - 0,674 - 0,674 - 1,000 - + + 0.968 + 0.674 + 0.674 + 1.000 + - 0,968 - 0,674 - 0,674 - 1,000 + 0.968 + 0.674 + 0.674 + 1.000 - - 0,968 - 0,674 - 0,674 - 1,000 - - - 0,968 - 0,674 - 0,674 - 0,500 - + + 0.968 + 0.674 + 0.674 + 0.500 + - 0,968 - 0,674 - 0,674 - 0,300 + 0.968 + 0.674 + 0.674 + 0.300 - - 0,968 - 0,674 - 0,674 - 1,000 - + + 0.968 + 0.674 + 0.674 + 1.000 + - 0,968 - 0,674 - 0,674 - 0,500 + 0.968 + 0.674 + 0.674 + 0.500 - - 0,968 - 0,674 - 0,674 - 1,000 - + + 0.968 + 0.674 + 0.674 + 1.000 + - 1,000 - 0,000 - 0,000 - 1,000 + 1.000 + 0.000 + 0.000 + 1.000 - - 0,000 - 0,000 - 0,000 - 1,000 - - - 0,000 - 0,000 - 0,000 - 1,000 - + + 0.000 + 0.000 + 0.000 + 1.000 + + + 1.000 + 1.000 + 1.000 + 1.000 + - 1,000 - 1,000 - 1,000 - 1,000 + 1.000 + 1.000 + 1.000 + 1.000 - 1,000 - 1,000 - 1,000 - 0,000 + 1.000 + 1.000 + 1.000 + 0.000 - - 1,000 - 0,000 - 0,000 - 1,000 - + + 1.000 + 0.000 + 0.000 + 1.000 + - 0,000 - 0,000 - 0,000 - 1,000 + 0.000 + 0.000 + 0.000 + 1.000 - 0,300 - 0,300 - 0,300 - 1,000 + 0.300 + 0.300 + 0.300 + 1.000 - 1,000 - 0,000 - 0,000 - 0,500 + 1.000 + 0.000 + 0.000 + 0.500 - 1,000 - 0,800 - 0,800 - 0,500 + 1.000 + 0.800 + 0.800 + 0.500 - 1,000 - 0,800 - 0,800 - 0,850 + 1.000 + 0.800 + 0.800 + 0.850 - + [Red]BG_Default.png [Red]BG_Options.png @@ -315,7 +235,6 @@ VideoIconBG.png MedleyCalcIcon.png MedleyTagIcon.png - Invisible.png PlayerSelector.png PreviousIcon.png NextIcon.png diff --git a/Output/Themes/Ambient/Skin Yellow.xml b/Output/Themes/Ambient/Skin Yellow.xml index 141050a2..48c2176b 100644 --- a/Output/Themes/Ambient/Skin Yellow.xml +++ b/Output/Themes/Ambient/Skin Yellow.xml @@ -1,280 +1,200 @@  - 3 + 4 Yellow bohning - 0 - 0 + 0 + 0 - 0,000 - 0,000 - 1,000 - 1,000 + 0.000 + 0.000 + 1.000 + 1.000 - 1,000 - 0,000 - 0,000 - 1,000 + 1.000 + 0.000 + 0.000 + 1.000 - 0,000 - 1,000 - 0,000 - 1,000 + 0.000 + 1.000 + 0.000 + 1.000 - 0,500 - 0,000 - 1,000 - 1,000 + 0.500 + 0.000 + 1.000 + 1.000 - 1,000 - 0,800 - 0,000 - 1,000 + 1.000 + 0.800 + 0.000 + 1.000 - 1,000 - 0,000 - 0,500 - 1,000 + 1.000 + 0.000 + 0.500 + 1.000 - - - - 0,000 - 0,000 - 1,000 - 0,500 - - - 1,000 - 0,000 - 0,000 - 0,500 - - - 0,000 - 1,000 - 0,000 - 0,500 - - - 0,500 - 0,000 - 1,000 - 0,500 - - - 1,000 - 0,800 - 0,000 - 0,500 - - - 1,000 - 0,000 - 0,500 - 0,500 - - - 0,000 - 0,000 - 1,000 - 0,400 - - - 1,000 - 0,000 - 0,000 - 0,400 - - - 0,000 - 1,000 - 0,000 - 0,400 - - - 0,500 - 0,000 - 1,000 - 0,400 - - - 1,000 - 0,800 - 0,000 - 0,400 - - - 1,000 - 0,000 - 0,500 - 0,400 - - 0,750 - 0,750 - 0,000 - 1,000 + 0.750 + 0.750 + 0.000 + 1.000 - 0,968 - 0,956 - 0,674 - 1,000 + 0.968 + 0.956 + 0.674 + 1.000 - 0,968 - 0,956 - 0,674 - 0,500 + 0.968 + 0.956 + 0.674 + 0.500 - 0,968 - 0,956 - 0,674 - 1,000 + 0.968 + 0.956 + 0.674 + 0.600 - 0,968 - 0,956 - 0,674 - 0,300 + 0.968 + 0.956 + 0.674 + 0.300 - - 0,968 - 0,956 - 0,674 - 1,000 - + + 0.968 + 0.956 + 0.674 + 1.000 + - 0,968 - 0,956 - 0,674 - 0,500 + 0.968 + 0.956 + 0.674 + 0.500 - - 0,968 - 0,956 - 0,674 - 1,000 - + + 0.968 + 0.956 + 0.674 + 1.000 + - 0,968 - 0,956 - 0,674 - 1,000 + 0.968 + 0.956 + 0.674 + 1.000 - - 0,968 - 0,956 - 0,674 - 1,000 - - - 0,968 - 0,956 - 0,674 - 0,500 - + + 0.968 + 0.956 + 0.674 + 0.500 + - 0,968 - 0,956 - 0,674 - 0,300 + 0.968 + 0.956 + 0.674 + 0.300 - - 0,968 - 0,956 - 0,674 - 1,000 - + + 0.968 + 0.956 + 0.674 + 1.000 + - 0,968 - 0,956 - 0,674 - 0,500 + 0.968 + 0.956 + 0.674 + 0.500 - - 0,968 - 0,956 - 0,674 - 1,000 - + + 0.968 + 0.956 + 0.674 + 1.000 + - 1,000 - 0,000 - 0,000 - 1,000 + 1.000 + 0.000 + 0.000 + 1.000 - - 0,000 - 0,000 - 0,000 - 1,000 - - - 0,000 - 0,000 - 0,000 - 1,000 - + + 0.000 + 0.000 + 0.000 + 1.000 + + + 1.000 + 1.000 + 1.000 + 1.000 + - 1,000 - 1,000 - 1,000 - 1,000 + 1.000 + 1.000 + 1.000 + 1.000 - 1,000 - 1,000 - 1,000 - 0,000 + 1.000 + 1.000 + 1.000 + 0.000 - - 1,000 - 1,000 - 0,000 - 1,000 - + + 1.000 + 1.000 + 0.000 + 1.000 + - 0,000 - 0,000 - 0,000 - 1,000 + 0.000 + 0.000 + 0.000 + 1.000 - 0,300 - 0,300 - 0,300 - 1,000 + 0.300 + 0.300 + 0.300 + 1.000 - 1,000 - 1,000 - 0,000 - 0,500 + 1.000 + 1.000 + 0.000 + 0.500 - 0,949 - 1,000 - 0,800 - 0,500 + 0.949 + 1.000 + 0.800 + 0.500 - 0,949 - 1,000 - 0,800 - 0,850 + 0.949 + 1.000 + 0.800 + 0.850 - + [Yellow]BG_Default.png [Yellow]BG_Options.png @@ -315,7 +235,6 @@ VideoIconBG.png MedleyCalcIcon.png MedleyTagIcon.png - Invisible.png PlayerSelector.png PreviousIcon.png NextIcon.png diff --git a/Output/Themes/Changelog/Changelog_ScreenMain.txt b/Output/Themes/Changelog/Changelog_ScreenMain.txt new file mode 100644 index 00000000..b3eb3bb7 --- /dev/null +++ b/Output/Themes/Changelog/Changelog_ScreenMain.txt @@ -0,0 +1,10 @@ +SceenMain + +++++++++++ +Version 2: + +Add: + + + + diff --git a/Output/Themes/Changelog/Changelog_SkinSystem.txt b/Output/Themes/Changelog/Changelog_SkinSystem.txt index 905890bb..ce2085ae 100644 --- a/Output/Themes/Changelog/Changelog_SkinSystem.txt +++ b/Output/Themes/Changelog/Changelog_SkinSystem.txt @@ -1,5 +1,9 @@ Skin System +++++++++++ +Version 4: +All Colors in (Playercolors and ColorSchemes) + ++++++++++ Version 3: diff --git a/Output/glib-sharp.dll b/Output/glib-sharp.dll index 2c5c288e..a4e18a6f 100644 Binary files a/Output/glib-sharp.dll and b/Output/glib-sharp.dll differ diff --git a/Output/gstreamer-sharp.dll b/Output/gstreamer-sharp.dll index 02c667ac..42183595 100644 Binary files a/Output/gstreamer-sharp.dll and b/Output/gstreamer-sharp.dll differ diff --git a/Output/x64/gstreamer/libFLAC-8.dll b/Output/x64/gstreamer/libFLAC-8.dll deleted file mode 100644 index a1a1c256..00000000 Binary files a/Output/x64/gstreamer/libFLAC-8.dll and /dev/null differ diff --git a/Output/x64/gstreamer/liba52-0.dll b/Output/x64/gstreamer/liba52-0.dll deleted file mode 100644 index 6dfdbb94..00000000 Binary files a/Output/x64/gstreamer/liba52-0.dll and /dev/null differ diff --git a/Output/x64/gstreamer/libass-4.dll b/Output/x64/gstreamer/libass-4.dll deleted file mode 100644 index b3cc88b0..00000000 Binary files a/Output/x64/gstreamer/libass-4.dll and /dev/null differ diff --git a/Output/x64/gstreamer/libbz2.dll b/Output/x64/gstreamer/libbz2.dll deleted file mode 100644 index ee820481..00000000 Binary files a/Output/x64/gstreamer/libbz2.dll and /dev/null differ diff --git a/Output/x64/gstreamer/libcairo-2.dll b/Output/x64/gstreamer/libcairo-2.dll deleted file mode 100644 index 87965c8e..00000000 Binary files a/Output/x64/gstreamer/libcairo-2.dll and /dev/null differ diff --git a/Output/x64/gstreamer/libcairo-gobject-2.dll b/Output/x64/gstreamer/libcairo-gobject-2.dll deleted file mode 100644 index e9aae569..00000000 Binary files a/Output/x64/gstreamer/libcairo-gobject-2.dll and /dev/null differ diff --git a/Output/x64/gstreamer/libcairo-script-interpreter-2.dll b/Output/x64/gstreamer/libcairo-script-interpreter-2.dll deleted file mode 100644 index 8ddf3911..00000000 Binary files a/Output/x64/gstreamer/libcairo-script-interpreter-2.dll and /dev/null differ diff --git a/Output/x64/gstreamer/libcharset-1.dll b/Output/x64/gstreamer/libcharset-1.dll deleted file mode 100644 index af20e572..00000000 Binary files a/Output/x64/gstreamer/libcharset-1.dll and /dev/null differ diff --git a/Output/x64/gstreamer/libdca-0.dll b/Output/x64/gstreamer/libdca-0.dll deleted file mode 100644 index f3077d4c..00000000 Binary files a/Output/x64/gstreamer/libdca-0.dll and /dev/null differ diff --git a/Output/x64/gstreamer/libdv-4.dll b/Output/x64/gstreamer/libdv-4.dll deleted file mode 100644 index de42c8eb..00000000 Binary files a/Output/x64/gstreamer/libdv-4.dll and /dev/null differ diff --git a/Output/x64/gstreamer/libdvdnav-4.dll b/Output/x64/gstreamer/libdvdnav-4.dll deleted file mode 100644 index 78d701c0..00000000 Binary files a/Output/x64/gstreamer/libdvdnav-4.dll and /dev/null differ diff --git a/Output/x64/gstreamer/libdvdnavmini-4.dll b/Output/x64/gstreamer/libdvdnavmini-4.dll deleted file mode 100644 index d94459aa..00000000 Binary files a/Output/x64/gstreamer/libdvdnavmini-4.dll and /dev/null differ diff --git a/Output/x64/gstreamer/libdvdread-4.dll b/Output/x64/gstreamer/libdvdread-4.dll deleted file mode 100644 index dd80070f..00000000 Binary files a/Output/x64/gstreamer/libdvdread-4.dll and /dev/null differ diff --git a/Output/x64/gstreamer/libexpat-1.dll b/Output/x64/gstreamer/libexpat-1.dll deleted file mode 100644 index 7b425c4d..00000000 Binary files a/Output/x64/gstreamer/libexpat-1.dll and /dev/null differ diff --git a/Output/x64/gstreamer/libfaad-2.dll b/Output/x64/gstreamer/libfaad-2.dll deleted file mode 100644 index ac9a9fc5..00000000 Binary files a/Output/x64/gstreamer/libfaad-2.dll and /dev/null differ diff --git a/Output/x64/gstreamer/libffi-6.dll b/Output/x64/gstreamer/libffi-6.dll deleted file mode 100644 index 207ef431..00000000 Binary files a/Output/x64/gstreamer/libffi-6.dll and /dev/null differ diff --git a/Output/x64/gstreamer/libfontconfig-1.dll b/Output/x64/gstreamer/libfontconfig-1.dll deleted file mode 100644 index 7230751d..00000000 Binary files a/Output/x64/gstreamer/libfontconfig-1.dll and /dev/null differ diff --git a/Output/x64/gstreamer/libfreetype-6.dll b/Output/x64/gstreamer/libfreetype-6.dll deleted file mode 100644 index c2c2e4f9..00000000 Binary files a/Output/x64/gstreamer/libfreetype-6.dll and /dev/null differ diff --git a/Output/x64/gstreamer/libfribidi-0.dll b/Output/x64/gstreamer/libfribidi-0.dll deleted file mode 100644 index e484d1b5..00000000 Binary files a/Output/x64/gstreamer/libfribidi-0.dll and /dev/null differ diff --git a/Output/x64/gstreamer/libgcc_s_sjlj-1.dll b/Output/x64/gstreamer/libgcc_s_sjlj-1.dll deleted file mode 100644 index c03ac645..00000000 Binary files a/Output/x64/gstreamer/libgcc_s_sjlj-1.dll and /dev/null differ diff --git a/Output/x64/gstreamer/libgdk_pixbuf-2.0-0.dll b/Output/x64/gstreamer/libgdk_pixbuf-2.0-0.dll deleted file mode 100644 index 5120d9df..00000000 Binary files a/Output/x64/gstreamer/libgdk_pixbuf-2.0-0.dll and /dev/null differ diff --git a/Output/x64/gstreamer/libgio-2.0-0.dll b/Output/x64/gstreamer/libgio-2.0-0.dll deleted file mode 100644 index 8e0b6729..00000000 Binary files a/Output/x64/gstreamer/libgio-2.0-0.dll and /dev/null differ diff --git a/Output/x64/gstreamer/libgiognutls.dll b/Output/x64/gstreamer/libgiognutls.dll deleted file mode 100644 index e9a13da7..00000000 Binary files a/Output/x64/gstreamer/libgiognutls.dll and /dev/null differ diff --git a/Output/x64/gstreamer/libglib-2.0-0.dll b/Output/x64/gstreamer/libglib-2.0-0.dll deleted file mode 100644 index b3e095c8..00000000 Binary files a/Output/x64/gstreamer/libglib-2.0-0.dll and /dev/null differ diff --git a/Output/x64/gstreamer/libgmodule-2.0-0.dll b/Output/x64/gstreamer/libgmodule-2.0-0.dll deleted file mode 100644 index 8b0889c2..00000000 Binary files a/Output/x64/gstreamer/libgmodule-2.0-0.dll and /dev/null differ diff --git a/Output/x64/gstreamer/libgnutls-28.dll b/Output/x64/gstreamer/libgnutls-28.dll deleted file mode 100644 index 7bc8d264..00000000 Binary files a/Output/x64/gstreamer/libgnutls-28.dll and /dev/null differ diff --git a/Output/x64/gstreamer/libgnutls-openssl-27.dll b/Output/x64/gstreamer/libgnutls-openssl-27.dll deleted file mode 100644 index 0f1f8444..00000000 Binary files a/Output/x64/gstreamer/libgnutls-openssl-27.dll and /dev/null differ diff --git a/Output/x64/gstreamer/libgnutlsxx-28.dll b/Output/x64/gstreamer/libgnutlsxx-28.dll deleted file mode 100644 index 3b661f06..00000000 Binary files a/Output/x64/gstreamer/libgnutlsxx-28.dll and /dev/null differ diff --git a/Output/x64/gstreamer/libgobject-2.0-0.dll b/Output/x64/gstreamer/libgobject-2.0-0.dll deleted file mode 100644 index 6adac242..00000000 Binary files a/Output/x64/gstreamer/libgobject-2.0-0.dll and /dev/null differ diff --git a/Output/x64/gstreamer/libgomp-1.dll b/Output/x64/gstreamer/libgomp-1.dll deleted file mode 100644 index bfdef6d9..00000000 Binary files a/Output/x64/gstreamer/libgomp-1.dll and /dev/null differ diff --git a/Output/x64/gstreamer/libgsta52dec.dll b/Output/x64/gstreamer/libgsta52dec.dll deleted file mode 100644 index bbf77d25..00000000 Binary files a/Output/x64/gstreamer/libgsta52dec.dll and /dev/null differ diff --git a/Output/x64/gstreamer/libgstadder.dll b/Output/x64/gstreamer/libgstadder.dll deleted file mode 100644 index fe87b9ea..00000000 Binary files a/Output/x64/gstreamer/libgstadder.dll and /dev/null differ diff --git a/Output/x64/gstreamer/libgstadpcmdec.dll b/Output/x64/gstreamer/libgstadpcmdec.dll deleted file mode 100644 index ed1e8670..00000000 Binary files a/Output/x64/gstreamer/libgstadpcmdec.dll and /dev/null differ diff --git a/Output/x64/gstreamer/libgstadpcmenc.dll b/Output/x64/gstreamer/libgstadpcmenc.dll deleted file mode 100644 index 763c14bc..00000000 Binary files a/Output/x64/gstreamer/libgstadpcmenc.dll and /dev/null differ diff --git a/Output/x64/gstreamer/libgstalaw.dll b/Output/x64/gstreamer/libgstalaw.dll deleted file mode 100644 index b906db09..00000000 Binary files a/Output/x64/gstreamer/libgstalaw.dll and /dev/null differ diff --git a/Output/x64/gstreamer/libgstalpha.dll b/Output/x64/gstreamer/libgstalpha.dll deleted file mode 100644 index c9da4e42..00000000 Binary files a/Output/x64/gstreamer/libgstalpha.dll and /dev/null differ diff --git a/Output/x64/gstreamer/libgstalphacolor.dll b/Output/x64/gstreamer/libgstalphacolor.dll deleted file mode 100644 index 827b5485..00000000 Binary files a/Output/x64/gstreamer/libgstalphacolor.dll and /dev/null differ diff --git a/Output/x64/gstreamer/libgstamrnb.dll b/Output/x64/gstreamer/libgstamrnb.dll deleted file mode 100644 index cf179595..00000000 Binary files a/Output/x64/gstreamer/libgstamrnb.dll and /dev/null differ diff --git a/Output/x64/gstreamer/libgstamrwbdec.dll b/Output/x64/gstreamer/libgstamrwbdec.dll deleted file mode 100644 index 199030f8..00000000 Binary files a/Output/x64/gstreamer/libgstamrwbdec.dll and /dev/null differ diff --git a/Output/x64/gstreamer/libgstapetag.dll b/Output/x64/gstreamer/libgstapetag.dll deleted file mode 100644 index f3c3c7ab..00000000 Binary files a/Output/x64/gstreamer/libgstapetag.dll and /dev/null differ diff --git a/Output/x64/gstreamer/libgstapp-1.0-0.dll b/Output/x64/gstreamer/libgstapp-1.0-0.dll deleted file mode 100644 index 3888aef7..00000000 Binary files a/Output/x64/gstreamer/libgstapp-1.0-0.dll and /dev/null differ diff --git a/Output/x64/gstreamer/libgstapp.dll b/Output/x64/gstreamer/libgstapp.dll deleted file mode 100644 index ceee5341..00000000 Binary files a/Output/x64/gstreamer/libgstapp.dll and /dev/null differ diff --git a/Output/x64/gstreamer/libgstasf.dll b/Output/x64/gstreamer/libgstasf.dll deleted file mode 100644 index 18a6d28f..00000000 Binary files a/Output/x64/gstreamer/libgstasf.dll and /dev/null differ diff --git a/Output/x64/gstreamer/libgstasfmux.dll b/Output/x64/gstreamer/libgstasfmux.dll deleted file mode 100644 index 28428ad8..00000000 Binary files a/Output/x64/gstreamer/libgstasfmux.dll and /dev/null differ diff --git a/Output/x64/gstreamer/libgstassrender.dll b/Output/x64/gstreamer/libgstassrender.dll deleted file mode 100644 index f6788bb1..00000000 Binary files a/Output/x64/gstreamer/libgstassrender.dll and /dev/null differ diff --git a/Output/x64/gstreamer/libgstaudio-1.0-0.dll b/Output/x64/gstreamer/libgstaudio-1.0-0.dll deleted file mode 100644 index 24f14d8c..00000000 Binary files a/Output/x64/gstreamer/libgstaudio-1.0-0.dll and /dev/null differ diff --git a/Output/x64/gstreamer/libgstaudioconvert.dll b/Output/x64/gstreamer/libgstaudioconvert.dll deleted file mode 100644 index ae4eb2cc..00000000 Binary files a/Output/x64/gstreamer/libgstaudioconvert.dll and /dev/null differ diff --git a/Output/x64/gstreamer/libgstaudiofx.dll b/Output/x64/gstreamer/libgstaudiofx.dll deleted file mode 100644 index 0feadf81..00000000 Binary files a/Output/x64/gstreamer/libgstaudiofx.dll and /dev/null differ diff --git a/Output/x64/gstreamer/libgstaudioparsers.dll b/Output/x64/gstreamer/libgstaudioparsers.dll deleted file mode 100644 index 01f0e4df..00000000 Binary files a/Output/x64/gstreamer/libgstaudioparsers.dll and /dev/null differ diff --git a/Output/x64/gstreamer/libgstaudiorate.dll b/Output/x64/gstreamer/libgstaudiorate.dll deleted file mode 100644 index f39f6e93..00000000 Binary files a/Output/x64/gstreamer/libgstaudiorate.dll and /dev/null differ diff --git a/Output/x64/gstreamer/libgstaudioresample.dll b/Output/x64/gstreamer/libgstaudioresample.dll deleted file mode 100644 index 304c7c9b..00000000 Binary files a/Output/x64/gstreamer/libgstaudioresample.dll and /dev/null differ diff --git a/Output/x64/gstreamer/libgstaudiotestsrc.dll b/Output/x64/gstreamer/libgstaudiotestsrc.dll deleted file mode 100644 index df012974..00000000 Binary files a/Output/x64/gstreamer/libgstaudiotestsrc.dll and /dev/null differ diff --git a/Output/x64/gstreamer/libgstaudiovisualizers.dll b/Output/x64/gstreamer/libgstaudiovisualizers.dll deleted file mode 100644 index fe0e4b17..00000000 Binary files a/Output/x64/gstreamer/libgstaudiovisualizers.dll and /dev/null differ diff --git a/Output/x64/gstreamer/libgstauparse.dll b/Output/x64/gstreamer/libgstauparse.dll deleted file mode 100644 index 521252a7..00000000 Binary files a/Output/x64/gstreamer/libgstauparse.dll and /dev/null differ diff --git a/Output/x64/gstreamer/libgstautoconvert.dll b/Output/x64/gstreamer/libgstautoconvert.dll deleted file mode 100644 index 345816ab..00000000 Binary files a/Output/x64/gstreamer/libgstautoconvert.dll and /dev/null differ diff --git a/Output/x64/gstreamer/libgstautodetect.dll b/Output/x64/gstreamer/libgstautodetect.dll deleted file mode 100644 index c36c6bdf..00000000 Binary files a/Output/x64/gstreamer/libgstautodetect.dll and /dev/null differ diff --git a/Output/x64/gstreamer/libgstavi.dll b/Output/x64/gstreamer/libgstavi.dll deleted file mode 100644 index 110cd16d..00000000 Binary files a/Output/x64/gstreamer/libgstavi.dll and /dev/null differ diff --git a/Output/x64/gstreamer/libgstbase-1.0-0.dll b/Output/x64/gstreamer/libgstbase-1.0-0.dll deleted file mode 100644 index 61c901b2..00000000 Binary files a/Output/x64/gstreamer/libgstbase-1.0-0.dll and /dev/null differ diff --git a/Output/x64/gstreamer/libgstbasecamerabinsrc-1.0-0.dll b/Output/x64/gstreamer/libgstbasecamerabinsrc-1.0-0.dll deleted file mode 100644 index 98613355..00000000 Binary files a/Output/x64/gstreamer/libgstbasecamerabinsrc-1.0-0.dll and /dev/null differ diff --git a/Output/x64/gstreamer/libgstbayer.dll b/Output/x64/gstreamer/libgstbayer.dll deleted file mode 100644 index 2b974151..00000000 Binary files a/Output/x64/gstreamer/libgstbayer.dll and /dev/null differ diff --git a/Output/x64/gstreamer/libgstcairo.dll b/Output/x64/gstreamer/libgstcairo.dll deleted file mode 100644 index 7ae8c9f5..00000000 Binary files a/Output/x64/gstreamer/libgstcairo.dll and /dev/null differ diff --git a/Output/x64/gstreamer/libgstcamerabin2.dll b/Output/x64/gstreamer/libgstcamerabin2.dll deleted file mode 100644 index 81f288ae..00000000 Binary files a/Output/x64/gstreamer/libgstcamerabin2.dll and /dev/null differ diff --git a/Output/x64/gstreamer/libgstcodecparsers-1.0-0.dll b/Output/x64/gstreamer/libgstcodecparsers-1.0-0.dll deleted file mode 100644 index 93717faa..00000000 Binary files a/Output/x64/gstreamer/libgstcodecparsers-1.0-0.dll and /dev/null differ diff --git a/Output/x64/gstreamer/libgstcoloreffects.dll b/Output/x64/gstreamer/libgstcoloreffects.dll deleted file mode 100644 index da9fdf91..00000000 Binary files a/Output/x64/gstreamer/libgstcoloreffects.dll and /dev/null differ diff --git a/Output/x64/gstreamer/libgstcontroller-1.0-0.dll b/Output/x64/gstreamer/libgstcontroller-1.0-0.dll deleted file mode 100644 index 9f378cde..00000000 Binary files a/Output/x64/gstreamer/libgstcontroller-1.0-0.dll and /dev/null differ diff --git a/Output/x64/gstreamer/libgstcoreelements.dll b/Output/x64/gstreamer/libgstcoreelements.dll deleted file mode 100644 index 53071c00..00000000 Binary files a/Output/x64/gstreamer/libgstcoreelements.dll and /dev/null differ diff --git a/Output/x64/gstreamer/libgstcutter.dll b/Output/x64/gstreamer/libgstcutter.dll deleted file mode 100644 index 3284d684..00000000 Binary files a/Output/x64/gstreamer/libgstcutter.dll and /dev/null differ diff --git a/Output/x64/gstreamer/libgstd3dvideosink.dll b/Output/x64/gstreamer/libgstd3dvideosink.dll deleted file mode 100644 index a256c1b2..00000000 Binary files a/Output/x64/gstreamer/libgstd3dvideosink.dll and /dev/null differ diff --git a/Output/x64/gstreamer/libgstdataurisrc.dll b/Output/x64/gstreamer/libgstdataurisrc.dll deleted file mode 100644 index 23f7cc17..00000000 Binary files a/Output/x64/gstreamer/libgstdataurisrc.dll and /dev/null differ diff --git a/Output/x64/gstreamer/libgstdebug.dll b/Output/x64/gstreamer/libgstdebug.dll deleted file mode 100644 index 5e57d929..00000000 Binary files a/Output/x64/gstreamer/libgstdebug.dll and /dev/null differ diff --git a/Output/x64/gstreamer/libgstdeinterlace.dll b/Output/x64/gstreamer/libgstdeinterlace.dll deleted file mode 100644 index 632dcd3d..00000000 Binary files a/Output/x64/gstreamer/libgstdeinterlace.dll and /dev/null differ diff --git a/Output/x64/gstreamer/libgstdirectsoundsink.dll b/Output/x64/gstreamer/libgstdirectsoundsink.dll deleted file mode 100644 index e88592ea..00000000 Binary files a/Output/x64/gstreamer/libgstdirectsoundsink.dll and /dev/null differ diff --git a/Output/x64/gstreamer/libgstdtmf.dll b/Output/x64/gstreamer/libgstdtmf.dll deleted file mode 100644 index 90842df1..00000000 Binary files a/Output/x64/gstreamer/libgstdtmf.dll and /dev/null differ diff --git a/Output/x64/gstreamer/libgstdtsdec.dll b/Output/x64/gstreamer/libgstdtsdec.dll deleted file mode 100644 index 2ab34a34..00000000 Binary files a/Output/x64/gstreamer/libgstdtsdec.dll and /dev/null differ diff --git a/Output/x64/gstreamer/libgstdv.dll b/Output/x64/gstreamer/libgstdv.dll deleted file mode 100644 index 79b387cd..00000000 Binary files a/Output/x64/gstreamer/libgstdv.dll and /dev/null differ diff --git a/Output/x64/gstreamer/libgstdvbsuboverlay.dll b/Output/x64/gstreamer/libgstdvbsuboverlay.dll deleted file mode 100644 index af9aab8a..00000000 Binary files a/Output/x64/gstreamer/libgstdvbsuboverlay.dll and /dev/null differ diff --git a/Output/x64/gstreamer/libgstdvdlpcmdec.dll b/Output/x64/gstreamer/libgstdvdlpcmdec.dll deleted file mode 100644 index 91957e78..00000000 Binary files a/Output/x64/gstreamer/libgstdvdlpcmdec.dll and /dev/null differ diff --git a/Output/x64/gstreamer/libgstdvdread.dll b/Output/x64/gstreamer/libgstdvdread.dll deleted file mode 100644 index 4bf8d797..00000000 Binary files a/Output/x64/gstreamer/libgstdvdread.dll and /dev/null differ diff --git a/Output/x64/gstreamer/libgstdvdspu.dll b/Output/x64/gstreamer/libgstdvdspu.dll deleted file mode 100644 index 0efa6a49..00000000 Binary files a/Output/x64/gstreamer/libgstdvdspu.dll and /dev/null differ diff --git a/Output/x64/gstreamer/libgsteffectv.dll b/Output/x64/gstreamer/libgsteffectv.dll deleted file mode 100644 index 9163d2ad..00000000 Binary files a/Output/x64/gstreamer/libgsteffectv.dll and /dev/null differ diff --git a/Output/x64/gstreamer/libgstencodebin.dll b/Output/x64/gstreamer/libgstencodebin.dll deleted file mode 100644 index 14aa774c..00000000 Binary files a/Output/x64/gstreamer/libgstencodebin.dll and /dev/null differ diff --git a/Output/x64/gstreamer/libgstequalizer.dll b/Output/x64/gstreamer/libgstequalizer.dll deleted file mode 100644 index 38248417..00000000 Binary files a/Output/x64/gstreamer/libgstequalizer.dll and /dev/null differ diff --git a/Output/x64/gstreamer/libgstfaad.dll b/Output/x64/gstreamer/libgstfaad.dll deleted file mode 100644 index a397019f..00000000 Binary files a/Output/x64/gstreamer/libgstfaad.dll and /dev/null differ diff --git a/Output/x64/gstreamer/libgstfft-1.0-0.dll b/Output/x64/gstreamer/libgstfft-1.0-0.dll deleted file mode 100644 index 81c46e71..00000000 Binary files a/Output/x64/gstreamer/libgstfft-1.0-0.dll and /dev/null differ diff --git a/Output/x64/gstreamer/libgstfieldanalysis.dll b/Output/x64/gstreamer/libgstfieldanalysis.dll deleted file mode 100644 index 9b0c7e3d..00000000 Binary files a/Output/x64/gstreamer/libgstfieldanalysis.dll and /dev/null differ diff --git a/Output/x64/gstreamer/libgstflac.dll b/Output/x64/gstreamer/libgstflac.dll deleted file mode 100644 index 5a841071..00000000 Binary files a/Output/x64/gstreamer/libgstflac.dll and /dev/null differ diff --git a/Output/x64/gstreamer/libgstflv.dll b/Output/x64/gstreamer/libgstflv.dll deleted file mode 100644 index 91b04163..00000000 Binary files a/Output/x64/gstreamer/libgstflv.dll and /dev/null differ diff --git a/Output/x64/gstreamer/libgstflxdec.dll b/Output/x64/gstreamer/libgstflxdec.dll deleted file mode 100644 index a530e638..00000000 Binary files a/Output/x64/gstreamer/libgstflxdec.dll and /dev/null differ diff --git a/Output/x64/gstreamer/libgstfragmented.dll b/Output/x64/gstreamer/libgstfragmented.dll deleted file mode 100644 index 8dbbf084..00000000 Binary files a/Output/x64/gstreamer/libgstfragmented.dll and /dev/null differ diff --git a/Output/x64/gstreamer/libgstfrei0r.dll b/Output/x64/gstreamer/libgstfrei0r.dll deleted file mode 100644 index b5bd952a..00000000 Binary files a/Output/x64/gstreamer/libgstfrei0r.dll and /dev/null differ diff --git a/Output/x64/gstreamer/libgstgaudieffects.dll b/Output/x64/gstreamer/libgstgaudieffects.dll deleted file mode 100644 index 88281c51..00000000 Binary files a/Output/x64/gstreamer/libgstgaudieffects.dll and /dev/null differ diff --git a/Output/x64/gstreamer/libgstgdkpixbuf.dll b/Output/x64/gstreamer/libgstgdkpixbuf.dll deleted file mode 100644 index 93e946b7..00000000 Binary files a/Output/x64/gstreamer/libgstgdkpixbuf.dll and /dev/null differ diff --git a/Output/x64/gstreamer/libgstgeometrictransform.dll b/Output/x64/gstreamer/libgstgeometrictransform.dll deleted file mode 100644 index d96a28cf..00000000 Binary files a/Output/x64/gstreamer/libgstgeometrictransform.dll and /dev/null differ diff --git a/Output/x64/gstreamer/libgstgio.dll b/Output/x64/gstreamer/libgstgio.dll deleted file mode 100644 index 6d46d1f6..00000000 Binary files a/Output/x64/gstreamer/libgstgio.dll and /dev/null differ diff --git a/Output/x64/gstreamer/libgstgoom.dll b/Output/x64/gstreamer/libgstgoom.dll deleted file mode 100644 index 12a2fae1..00000000 Binary files a/Output/x64/gstreamer/libgstgoom.dll and /dev/null differ diff --git a/Output/x64/gstreamer/libgstgoom2k1.dll b/Output/x64/gstreamer/libgstgoom2k1.dll deleted file mode 100644 index 81402b5b..00000000 Binary files a/Output/x64/gstreamer/libgstgoom2k1.dll and /dev/null differ diff --git a/Output/x64/gstreamer/libgsticydemux.dll b/Output/x64/gstreamer/libgsticydemux.dll deleted file mode 100644 index ec9f5da3..00000000 Binary files a/Output/x64/gstreamer/libgsticydemux.dll and /dev/null differ diff --git a/Output/x64/gstreamer/libgstid3demux.dll b/Output/x64/gstreamer/libgstid3demux.dll deleted file mode 100644 index 03dfb3c8..00000000 Binary files a/Output/x64/gstreamer/libgstid3demux.dll and /dev/null differ diff --git a/Output/x64/gstreamer/libgstid3tag.dll b/Output/x64/gstreamer/libgstid3tag.dll deleted file mode 100644 index 87ee51fa..00000000 Binary files a/Output/x64/gstreamer/libgstid3tag.dll and /dev/null differ diff --git a/Output/x64/gstreamer/libgstimagefreeze.dll b/Output/x64/gstreamer/libgstimagefreeze.dll deleted file mode 100644 index 7a7c77c2..00000000 Binary files a/Output/x64/gstreamer/libgstimagefreeze.dll and /dev/null differ diff --git a/Output/x64/gstreamer/libgstinterlace.dll b/Output/x64/gstreamer/libgstinterlace.dll deleted file mode 100644 index 023692d9..00000000 Binary files a/Output/x64/gstreamer/libgstinterlace.dll and /dev/null differ diff --git a/Output/x64/gstreamer/libgstinterleave.dll b/Output/x64/gstreamer/libgstinterleave.dll deleted file mode 100644 index 0a2fcfda..00000000 Binary files a/Output/x64/gstreamer/libgstinterleave.dll and /dev/null differ diff --git a/Output/x64/gstreamer/libgstisomp4.dll b/Output/x64/gstreamer/libgstisomp4.dll deleted file mode 100644 index 2bb6f4f2..00000000 Binary files a/Output/x64/gstreamer/libgstisomp4.dll and /dev/null differ diff --git a/Output/x64/gstreamer/libgstjpeg.dll b/Output/x64/gstreamer/libgstjpeg.dll deleted file mode 100644 index 5efccb76..00000000 Binary files a/Output/x64/gstreamer/libgstjpeg.dll and /dev/null differ diff --git a/Output/x64/gstreamer/libgstjpegformat.dll b/Output/x64/gstreamer/libgstjpegformat.dll deleted file mode 100644 index 16aa28ce..00000000 Binary files a/Output/x64/gstreamer/libgstjpegformat.dll and /dev/null differ diff --git a/Output/x64/gstreamer/libgstlevel.dll b/Output/x64/gstreamer/libgstlevel.dll deleted file mode 100644 index 9e5845bc..00000000 Binary files a/Output/x64/gstreamer/libgstlevel.dll and /dev/null differ diff --git a/Output/x64/gstreamer/libgstlibav.dll b/Output/x64/gstreamer/libgstlibav.dll deleted file mode 100644 index 14fb7fcb..00000000 Binary files a/Output/x64/gstreamer/libgstlibav.dll and /dev/null differ diff --git a/Output/x64/gstreamer/libgstlibvisual.dll b/Output/x64/gstreamer/libgstlibvisual.dll deleted file mode 100644 index 7e69637b..00000000 Binary files a/Output/x64/gstreamer/libgstlibvisual.dll and /dev/null differ diff --git a/Output/x64/gstreamer/libgstliveadder.dll b/Output/x64/gstreamer/libgstliveadder.dll deleted file mode 100644 index f813831c..00000000 Binary files a/Output/x64/gstreamer/libgstliveadder.dll and /dev/null differ diff --git a/Output/x64/gstreamer/libgstmad.dll b/Output/x64/gstreamer/libgstmad.dll deleted file mode 100644 index 34347486..00000000 Binary files a/Output/x64/gstreamer/libgstmad.dll and /dev/null differ diff --git a/Output/x64/gstreamer/libgstmatroska.dll b/Output/x64/gstreamer/libgstmatroska.dll deleted file mode 100644 index cdadba86..00000000 Binary files a/Output/x64/gstreamer/libgstmatroska.dll and /dev/null differ diff --git a/Output/x64/gstreamer/libgstmms.dll b/Output/x64/gstreamer/libgstmms.dll deleted file mode 100644 index 0e664a4a..00000000 Binary files a/Output/x64/gstreamer/libgstmms.dll and /dev/null differ diff --git a/Output/x64/gstreamer/libgstmpeg2dec.dll b/Output/x64/gstreamer/libgstmpeg2dec.dll deleted file mode 100644 index 8c594f28..00000000 Binary files a/Output/x64/gstreamer/libgstmpeg2dec.dll and /dev/null differ diff --git a/Output/x64/gstreamer/libgstmpegpsdemux.dll b/Output/x64/gstreamer/libgstmpegpsdemux.dll deleted file mode 100644 index 528d3145..00000000 Binary files a/Output/x64/gstreamer/libgstmpegpsdemux.dll and /dev/null differ diff --git a/Output/x64/gstreamer/libgstmpegpsmux.dll b/Output/x64/gstreamer/libgstmpegpsmux.dll deleted file mode 100644 index 28660251..00000000 Binary files a/Output/x64/gstreamer/libgstmpegpsmux.dll and /dev/null differ diff --git a/Output/x64/gstreamer/libgstmpegtsdemux.dll b/Output/x64/gstreamer/libgstmpegtsdemux.dll deleted file mode 100644 index 3815e96f..00000000 Binary files a/Output/x64/gstreamer/libgstmpegtsdemux.dll and /dev/null differ diff --git a/Output/x64/gstreamer/libgstmpegtsmux.dll b/Output/x64/gstreamer/libgstmpegtsmux.dll deleted file mode 100644 index e90cab54..00000000 Binary files a/Output/x64/gstreamer/libgstmpegtsmux.dll and /dev/null differ diff --git a/Output/x64/gstreamer/libgstmulaw.dll b/Output/x64/gstreamer/libgstmulaw.dll deleted file mode 100644 index f77d2a0f..00000000 Binary files a/Output/x64/gstreamer/libgstmulaw.dll and /dev/null differ diff --git a/Output/x64/gstreamer/libgstmultifile.dll b/Output/x64/gstreamer/libgstmultifile.dll deleted file mode 100644 index a5c667e3..00000000 Binary files a/Output/x64/gstreamer/libgstmultifile.dll and /dev/null differ diff --git a/Output/x64/gstreamer/libgstmultipart.dll b/Output/x64/gstreamer/libgstmultipart.dll deleted file mode 100644 index 1a07d138..00000000 Binary files a/Output/x64/gstreamer/libgstmultipart.dll and /dev/null differ diff --git a/Output/x64/gstreamer/libgstnet-1.0-0.dll b/Output/x64/gstreamer/libgstnet-1.0-0.dll deleted file mode 100644 index 00a0b717..00000000 Binary files a/Output/x64/gstreamer/libgstnet-1.0-0.dll and /dev/null differ diff --git a/Output/x64/gstreamer/libgstogg.dll b/Output/x64/gstreamer/libgstogg.dll deleted file mode 100644 index 6d67444d..00000000 Binary files a/Output/x64/gstreamer/libgstogg.dll and /dev/null differ diff --git a/Output/x64/gstreamer/libgstopus.dll b/Output/x64/gstreamer/libgstopus.dll deleted file mode 100644 index 46419c5e..00000000 Binary files a/Output/x64/gstreamer/libgstopus.dll and /dev/null differ diff --git a/Output/x64/gstreamer/libgstpango.dll b/Output/x64/gstreamer/libgstpango.dll deleted file mode 100644 index f0d64403..00000000 Binary files a/Output/x64/gstreamer/libgstpango.dll and /dev/null differ diff --git a/Output/x64/gstreamer/libgstpbutils-1.0-0.dll b/Output/x64/gstreamer/libgstpbutils-1.0-0.dll deleted file mode 100644 index c795b0b4..00000000 Binary files a/Output/x64/gstreamer/libgstpbutils-1.0-0.dll and /dev/null differ diff --git a/Output/x64/gstreamer/libgstpcapparse.dll b/Output/x64/gstreamer/libgstpcapparse.dll deleted file mode 100644 index fe8325e8..00000000 Binary files a/Output/x64/gstreamer/libgstpcapparse.dll and /dev/null differ diff --git a/Output/x64/gstreamer/libgstphotography-1.0-0.dll b/Output/x64/gstreamer/libgstphotography-1.0-0.dll deleted file mode 100644 index 2a8d90cf..00000000 Binary files a/Output/x64/gstreamer/libgstphotography-1.0-0.dll and /dev/null differ diff --git a/Output/x64/gstreamer/libgstplayback.dll b/Output/x64/gstreamer/libgstplayback.dll deleted file mode 100644 index 1468ee4a..00000000 Binary files a/Output/x64/gstreamer/libgstplayback.dll and /dev/null differ diff --git a/Output/x64/gstreamer/libgstpng.dll b/Output/x64/gstreamer/libgstpng.dll deleted file mode 100644 index 879b75cf..00000000 Binary files a/Output/x64/gstreamer/libgstpng.dll and /dev/null differ diff --git a/Output/x64/gstreamer/libgstpnm.dll b/Output/x64/gstreamer/libgstpnm.dll deleted file mode 100644 index 6190b5f4..00000000 Binary files a/Output/x64/gstreamer/libgstpnm.dll and /dev/null differ diff --git a/Output/x64/gstreamer/libgstrawparse.dll b/Output/x64/gstreamer/libgstrawparse.dll deleted file mode 100644 index b88704a5..00000000 Binary files a/Output/x64/gstreamer/libgstrawparse.dll and /dev/null differ diff --git a/Output/x64/gstreamer/libgstreamer-1.0-0.dll b/Output/x64/gstreamer/libgstreamer-1.0-0.dll deleted file mode 100644 index 41d966df..00000000 Binary files a/Output/x64/gstreamer/libgstreamer-1.0-0.dll and /dev/null differ diff --git a/Output/x64/gstreamer/libgstreamersharpglue-1.0.0.dll b/Output/x64/gstreamer/libgstreamersharpglue-1.0.0.dll deleted file mode 100644 index 4215d2ea..00000000 Binary files a/Output/x64/gstreamer/libgstreamersharpglue-1.0.0.dll and /dev/null differ diff --git a/Output/x64/gstreamer/libgstremovesilence.dll b/Output/x64/gstreamer/libgstremovesilence.dll deleted file mode 100644 index 8ce09432..00000000 Binary files a/Output/x64/gstreamer/libgstremovesilence.dll and /dev/null differ diff --git a/Output/x64/gstreamer/libgstreplaygain.dll b/Output/x64/gstreamer/libgstreplaygain.dll deleted file mode 100644 index a23e781d..00000000 Binary files a/Output/x64/gstreamer/libgstreplaygain.dll and /dev/null differ diff --git a/Output/x64/gstreamer/libgstresindvd.dll b/Output/x64/gstreamer/libgstresindvd.dll deleted file mode 100644 index 93165f46..00000000 Binary files a/Output/x64/gstreamer/libgstresindvd.dll and /dev/null differ diff --git a/Output/x64/gstreamer/libgstriff-1.0-0.dll b/Output/x64/gstreamer/libgstriff-1.0-0.dll deleted file mode 100644 index f84c4d32..00000000 Binary files a/Output/x64/gstreamer/libgstriff-1.0-0.dll and /dev/null differ diff --git a/Output/x64/gstreamer/libgstrmdemux.dll b/Output/x64/gstreamer/libgstrmdemux.dll deleted file mode 100644 index d96fbf96..00000000 Binary files a/Output/x64/gstreamer/libgstrmdemux.dll and /dev/null differ diff --git a/Output/x64/gstreamer/libgstrtp-1.0-0.dll b/Output/x64/gstreamer/libgstrtp-1.0-0.dll deleted file mode 100644 index 671314bd..00000000 Binary files a/Output/x64/gstreamer/libgstrtp-1.0-0.dll and /dev/null differ diff --git a/Output/x64/gstreamer/libgstrtp.dll b/Output/x64/gstreamer/libgstrtp.dll deleted file mode 100644 index 956c06a6..00000000 Binary files a/Output/x64/gstreamer/libgstrtp.dll and /dev/null differ diff --git a/Output/x64/gstreamer/libgstrtpmanager.dll b/Output/x64/gstreamer/libgstrtpmanager.dll deleted file mode 100644 index 368bfad3..00000000 Binary files a/Output/x64/gstreamer/libgstrtpmanager.dll and /dev/null differ diff --git a/Output/x64/gstreamer/libgstrtsp-1.0-0.dll b/Output/x64/gstreamer/libgstrtsp-1.0-0.dll deleted file mode 100644 index aa6e0113..00000000 Binary files a/Output/x64/gstreamer/libgstrtsp-1.0-0.dll and /dev/null differ diff --git a/Output/x64/gstreamer/libgstrtsp.dll b/Output/x64/gstreamer/libgstrtsp.dll deleted file mode 100644 index ffe21d20..00000000 Binary files a/Output/x64/gstreamer/libgstrtsp.dll and /dev/null differ diff --git a/Output/x64/gstreamer/libgstscaletempoplugin.dll b/Output/x64/gstreamer/libgstscaletempoplugin.dll deleted file mode 100644 index d6666bf6..00000000 Binary files a/Output/x64/gstreamer/libgstscaletempoplugin.dll and /dev/null differ diff --git a/Output/x64/gstreamer/libgstschro.dll b/Output/x64/gstreamer/libgstschro.dll deleted file mode 100644 index f2df296e..00000000 Binary files a/Output/x64/gstreamer/libgstschro.dll and /dev/null differ diff --git a/Output/x64/gstreamer/libgstsdp-1.0-0.dll b/Output/x64/gstreamer/libgstsdp-1.0-0.dll deleted file mode 100644 index e626b4ea..00000000 Binary files a/Output/x64/gstreamer/libgstsdp-1.0-0.dll and /dev/null differ diff --git a/Output/x64/gstreamer/libgstsdpelem.dll b/Output/x64/gstreamer/libgstsdpelem.dll deleted file mode 100644 index 7a76eba2..00000000 Binary files a/Output/x64/gstreamer/libgstsdpelem.dll and /dev/null differ diff --git a/Output/x64/gstreamer/libgstsegmentclip.dll b/Output/x64/gstreamer/libgstsegmentclip.dll deleted file mode 100644 index 65a59e2b..00000000 Binary files a/Output/x64/gstreamer/libgstsegmentclip.dll and /dev/null differ diff --git a/Output/x64/gstreamer/libgstshapewipe.dll b/Output/x64/gstreamer/libgstshapewipe.dll deleted file mode 100644 index 90936372..00000000 Binary files a/Output/x64/gstreamer/libgstshapewipe.dll and /dev/null differ diff --git a/Output/x64/gstreamer/libgstsiren.dll b/Output/x64/gstreamer/libgstsiren.dll deleted file mode 100644 index 4cdce371..00000000 Binary files a/Output/x64/gstreamer/libgstsiren.dll and /dev/null differ diff --git a/Output/x64/gstreamer/libgstsmooth.dll b/Output/x64/gstreamer/libgstsmooth.dll deleted file mode 100644 index ef4948b8..00000000 Binary files a/Output/x64/gstreamer/libgstsmooth.dll and /dev/null differ diff --git a/Output/x64/gstreamer/libgstsmpte.dll b/Output/x64/gstreamer/libgstsmpte.dll deleted file mode 100644 index a5dca248..00000000 Binary files a/Output/x64/gstreamer/libgstsmpte.dll and /dev/null differ diff --git a/Output/x64/gstreamer/libgstsouphttpsrc.dll b/Output/x64/gstreamer/libgstsouphttpsrc.dll deleted file mode 100644 index c0201bfd..00000000 Binary files a/Output/x64/gstreamer/libgstsouphttpsrc.dll and /dev/null differ diff --git a/Output/x64/gstreamer/libgstspectrum.dll b/Output/x64/gstreamer/libgstspectrum.dll deleted file mode 100644 index 4fa8ca1b..00000000 Binary files a/Output/x64/gstreamer/libgstspectrum.dll and /dev/null differ diff --git a/Output/x64/gstreamer/libgstspeed.dll b/Output/x64/gstreamer/libgstspeed.dll deleted file mode 100644 index 211bdb13..00000000 Binary files a/Output/x64/gstreamer/libgstspeed.dll and /dev/null differ diff --git a/Output/x64/gstreamer/libgstspeex.dll b/Output/x64/gstreamer/libgstspeex.dll deleted file mode 100644 index 43bedb83..00000000 Binary files a/Output/x64/gstreamer/libgstspeex.dll and /dev/null differ diff --git a/Output/x64/gstreamer/libgstsubenc.dll b/Output/x64/gstreamer/libgstsubenc.dll deleted file mode 100644 index 579ae262..00000000 Binary files a/Output/x64/gstreamer/libgstsubenc.dll and /dev/null differ diff --git a/Output/x64/gstreamer/libgstsubparse.dll b/Output/x64/gstreamer/libgstsubparse.dll deleted file mode 100644 index 76cf5e71..00000000 Binary files a/Output/x64/gstreamer/libgstsubparse.dll and /dev/null differ diff --git a/Output/x64/gstreamer/libgsttag-1.0-0.dll b/Output/x64/gstreamer/libgsttag-1.0-0.dll deleted file mode 100644 index 7ce3bf6e..00000000 Binary files a/Output/x64/gstreamer/libgsttag-1.0-0.dll and /dev/null differ diff --git a/Output/x64/gstreamer/libgsttaglib.dll b/Output/x64/gstreamer/libgsttaglib.dll deleted file mode 100644 index 9e21c5e7..00000000 Binary files a/Output/x64/gstreamer/libgsttaglib.dll and /dev/null differ diff --git a/Output/x64/gstreamer/libgsttcp.dll b/Output/x64/gstreamer/libgsttcp.dll deleted file mode 100644 index 55c1080a..00000000 Binary files a/Output/x64/gstreamer/libgsttcp.dll and /dev/null differ diff --git a/Output/x64/gstreamer/libgsttheora.dll b/Output/x64/gstreamer/libgsttheora.dll deleted file mode 100644 index 3f3e7164..00000000 Binary files a/Output/x64/gstreamer/libgsttheora.dll and /dev/null differ diff --git a/Output/x64/gstreamer/libgsttypefindfunctions.dll b/Output/x64/gstreamer/libgsttypefindfunctions.dll deleted file mode 100644 index 927329dc..00000000 Binary files a/Output/x64/gstreamer/libgsttypefindfunctions.dll and /dev/null differ diff --git a/Output/x64/gstreamer/libgstudp.dll b/Output/x64/gstreamer/libgstudp.dll deleted file mode 100644 index c87365eb..00000000 Binary files a/Output/x64/gstreamer/libgstudp.dll and /dev/null differ diff --git a/Output/x64/gstreamer/libgstvideo-1.0-0.dll b/Output/x64/gstreamer/libgstvideo-1.0-0.dll deleted file mode 100644 index 4ef9ebf5..00000000 Binary files a/Output/x64/gstreamer/libgstvideo-1.0-0.dll and /dev/null differ diff --git a/Output/x64/gstreamer/libgstvideobox.dll b/Output/x64/gstreamer/libgstvideobox.dll deleted file mode 100644 index d3595eb5..00000000 Binary files a/Output/x64/gstreamer/libgstvideobox.dll and /dev/null differ diff --git a/Output/x64/gstreamer/libgstvideoconvert.dll b/Output/x64/gstreamer/libgstvideoconvert.dll deleted file mode 100644 index 2608d3e2..00000000 Binary files a/Output/x64/gstreamer/libgstvideoconvert.dll and /dev/null differ diff --git a/Output/x64/gstreamer/libgstvideocrop.dll b/Output/x64/gstreamer/libgstvideocrop.dll deleted file mode 100644 index 0534e404..00000000 Binary files a/Output/x64/gstreamer/libgstvideocrop.dll and /dev/null differ diff --git a/Output/x64/gstreamer/libgstvideofilter.dll b/Output/x64/gstreamer/libgstvideofilter.dll deleted file mode 100644 index b8e1bf6f..00000000 Binary files a/Output/x64/gstreamer/libgstvideofilter.dll and /dev/null differ diff --git a/Output/x64/gstreamer/libgstvideomixer.dll b/Output/x64/gstreamer/libgstvideomixer.dll deleted file mode 100644 index 94c88e5a..00000000 Binary files a/Output/x64/gstreamer/libgstvideomixer.dll and /dev/null differ diff --git a/Output/x64/gstreamer/libgstvideoparsersbad.dll b/Output/x64/gstreamer/libgstvideoparsersbad.dll deleted file mode 100644 index 8ff7eb69..00000000 Binary files a/Output/x64/gstreamer/libgstvideoparsersbad.dll and /dev/null differ diff --git a/Output/x64/gstreamer/libgstvideorate.dll b/Output/x64/gstreamer/libgstvideorate.dll deleted file mode 100644 index bb2d18a6..00000000 Binary files a/Output/x64/gstreamer/libgstvideorate.dll and /dev/null differ diff --git a/Output/x64/gstreamer/libgstvideoscale.dll b/Output/x64/gstreamer/libgstvideoscale.dll deleted file mode 100644 index c6f33fbb..00000000 Binary files a/Output/x64/gstreamer/libgstvideoscale.dll and /dev/null differ diff --git a/Output/x64/gstreamer/libgstvideotestsrc.dll b/Output/x64/gstreamer/libgstvideotestsrc.dll deleted file mode 100644 index 6cf64eb8..00000000 Binary files a/Output/x64/gstreamer/libgstvideotestsrc.dll and /dev/null differ diff --git a/Output/x64/gstreamer/libgstvolume.dll b/Output/x64/gstreamer/libgstvolume.dll deleted file mode 100644 index 3aae8f8a..00000000 Binary files a/Output/x64/gstreamer/libgstvolume.dll and /dev/null differ diff --git a/Output/x64/gstreamer/libgstvorbis.dll b/Output/x64/gstreamer/libgstvorbis.dll deleted file mode 100644 index 2bff4c72..00000000 Binary files a/Output/x64/gstreamer/libgstvorbis.dll and /dev/null differ diff --git a/Output/x64/gstreamer/libgstvpx.dll b/Output/x64/gstreamer/libgstvpx.dll deleted file mode 100644 index 33f4d1db..00000000 Binary files a/Output/x64/gstreamer/libgstvpx.dll and /dev/null differ diff --git a/Output/x64/gstreamer/libgstwavenc.dll b/Output/x64/gstreamer/libgstwavenc.dll deleted file mode 100644 index 5395f473..00000000 Binary files a/Output/x64/gstreamer/libgstwavenc.dll and /dev/null differ diff --git a/Output/x64/gstreamer/libgstwavpack.dll b/Output/x64/gstreamer/libgstwavpack.dll deleted file mode 100644 index ed6e6d07..00000000 Binary files a/Output/x64/gstreamer/libgstwavpack.dll and /dev/null differ diff --git a/Output/x64/gstreamer/libgstwavparse.dll b/Output/x64/gstreamer/libgstwavparse.dll deleted file mode 100644 index 04eb79b1..00000000 Binary files a/Output/x64/gstreamer/libgstwavparse.dll and /dev/null differ diff --git a/Output/x64/gstreamer/libgstx264.dll b/Output/x64/gstreamer/libgstx264.dll deleted file mode 100644 index c90b1f99..00000000 Binary files a/Output/x64/gstreamer/libgstx264.dll and /dev/null differ diff --git a/Output/x64/gstreamer/libgstxingmux.dll b/Output/x64/gstreamer/libgstxingmux.dll deleted file mode 100644 index ca135b1e..00000000 Binary files a/Output/x64/gstreamer/libgstxingmux.dll and /dev/null differ diff --git a/Output/x64/gstreamer/libgsty4mdec.dll b/Output/x64/gstreamer/libgsty4mdec.dll deleted file mode 100644 index 496e64bd..00000000 Binary files a/Output/x64/gstreamer/libgsty4mdec.dll and /dev/null differ diff --git a/Output/x64/gstreamer/libgsty4menc.dll b/Output/x64/gstreamer/libgsty4menc.dll deleted file mode 100644 index 6a4de10c..00000000 Binary files a/Output/x64/gstreamer/libgsty4menc.dll and /dev/null differ diff --git a/Output/x64/gstreamer/libgthread-2.0-0.dll b/Output/x64/gstreamer/libgthread-2.0-0.dll deleted file mode 100644 index b148937b..00000000 Binary files a/Output/x64/gstreamer/libgthread-2.0-0.dll and /dev/null differ diff --git a/Output/x64/gstreamer/libhogweed-2-2.dll b/Output/x64/gstreamer/libhogweed-2-2.dll deleted file mode 100644 index f99fe527..00000000 Binary files a/Output/x64/gstreamer/libhogweed-2-2.dll and /dev/null differ diff --git a/Output/x64/gstreamer/libiconv-2.dll b/Output/x64/gstreamer/libiconv-2.dll deleted file mode 100644 index 525b96ee..00000000 Binary files a/Output/x64/gstreamer/libiconv-2.dll and /dev/null differ diff --git a/Output/x64/gstreamer/libintl-8.dll b/Output/x64/gstreamer/libintl-8.dll deleted file mode 100644 index c4f8427c..00000000 Binary files a/Output/x64/gstreamer/libintl-8.dll and /dev/null differ diff --git a/Output/x64/gstreamer/libjpeg-8.dll b/Output/x64/gstreamer/libjpeg-8.dll deleted file mode 100644 index 545f9efc..00000000 Binary files a/Output/x64/gstreamer/libjpeg-8.dll and /dev/null differ diff --git a/Output/x64/gstreamer/libkate-1.dll b/Output/x64/gstreamer/libkate-1.dll deleted file mode 100644 index c53dd128..00000000 Binary files a/Output/x64/gstreamer/libkate-1.dll and /dev/null differ diff --git a/Output/x64/gstreamer/libmms-0.dll b/Output/x64/gstreamer/libmms-0.dll deleted file mode 100644 index d510509f..00000000 Binary files a/Output/x64/gstreamer/libmms-0.dll and /dev/null differ diff --git a/Output/x64/gstreamer/libmpeg2-0.dll b/Output/x64/gstreamer/libmpeg2-0.dll deleted file mode 100644 index 1d2b87a8..00000000 Binary files a/Output/x64/gstreamer/libmpeg2-0.dll and /dev/null differ diff --git a/Output/x64/gstreamer/libmpeg2convert-0.dll b/Output/x64/gstreamer/libmpeg2convert-0.dll deleted file mode 100644 index f212e850..00000000 Binary files a/Output/x64/gstreamer/libmpeg2convert-0.dll and /dev/null differ diff --git a/Output/x64/gstreamer/libnettle-4-4.dll b/Output/x64/gstreamer/libnettle-4-4.dll deleted file mode 100644 index e991bad2..00000000 Binary files a/Output/x64/gstreamer/libnettle-4-4.dll and /dev/null differ diff --git a/Output/x64/gstreamer/libogg-0.dll b/Output/x64/gstreamer/libogg-0.dll deleted file mode 100644 index f247f6c6..00000000 Binary files a/Output/x64/gstreamer/libogg-0.dll and /dev/null differ diff --git a/Output/x64/gstreamer/liboggkate-1.dll b/Output/x64/gstreamer/liboggkate-1.dll deleted file mode 100644 index 562c6586..00000000 Binary files a/Output/x64/gstreamer/liboggkate-1.dll and /dev/null differ diff --git a/Output/x64/gstreamer/libopencore-amrnb-0.dll b/Output/x64/gstreamer/libopencore-amrnb-0.dll deleted file mode 100644 index 408b4365..00000000 Binary files a/Output/x64/gstreamer/libopencore-amrnb-0.dll and /dev/null differ diff --git a/Output/x64/gstreamer/libopencore-amrwb-0.dll b/Output/x64/gstreamer/libopencore-amrwb-0.dll deleted file mode 100644 index 99f59d7d..00000000 Binary files a/Output/x64/gstreamer/libopencore-amrwb-0.dll and /dev/null differ diff --git a/Output/x64/gstreamer/libopus-0.dll b/Output/x64/gstreamer/libopus-0.dll deleted file mode 100644 index 95237c43..00000000 Binary files a/Output/x64/gstreamer/libopus-0.dll and /dev/null differ diff --git a/Output/x64/gstreamer/liborc-0.4-0.dll b/Output/x64/gstreamer/liborc-0.4-0.dll deleted file mode 100644 index 78e956b9..00000000 Binary files a/Output/x64/gstreamer/liborc-0.4-0.dll and /dev/null differ diff --git a/Output/x64/gstreamer/liborc-test-0.4-0.dll b/Output/x64/gstreamer/liborc-test-0.4-0.dll deleted file mode 100644 index ca7a35d3..00000000 Binary files a/Output/x64/gstreamer/liborc-test-0.4-0.dll and /dev/null differ diff --git a/Output/x64/gstreamer/libpango-1.0-0.dll b/Output/x64/gstreamer/libpango-1.0-0.dll deleted file mode 100644 index 5284e414..00000000 Binary files a/Output/x64/gstreamer/libpango-1.0-0.dll and /dev/null differ diff --git a/Output/x64/gstreamer/libpangocairo-1.0-0.dll b/Output/x64/gstreamer/libpangocairo-1.0-0.dll deleted file mode 100644 index 47e96ff3..00000000 Binary files a/Output/x64/gstreamer/libpangocairo-1.0-0.dll and /dev/null differ diff --git a/Output/x64/gstreamer/libpangoft2-1.0-0.dll b/Output/x64/gstreamer/libpangoft2-1.0-0.dll deleted file mode 100644 index b6c1a482..00000000 Binary files a/Output/x64/gstreamer/libpangoft2-1.0-0.dll and /dev/null differ diff --git a/Output/x64/gstreamer/libpangowin32-1.0-0.dll b/Output/x64/gstreamer/libpangowin32-1.0-0.dll deleted file mode 100644 index 8fd59964..00000000 Binary files a/Output/x64/gstreamer/libpangowin32-1.0-0.dll and /dev/null differ diff --git a/Output/x64/gstreamer/libpixman-1-0.dll b/Output/x64/gstreamer/libpixman-1-0.dll deleted file mode 100644 index 77861e8c..00000000 Binary files a/Output/x64/gstreamer/libpixman-1-0.dll and /dev/null differ diff --git a/Output/x64/gstreamer/libpng15-15.dll b/Output/x64/gstreamer/libpng15-15.dll deleted file mode 100644 index 365c1092..00000000 Binary files a/Output/x64/gstreamer/libpng15-15.dll and /dev/null differ diff --git a/Output/x64/gstreamer/libschroedinger-1.0-0.dll b/Output/x64/gstreamer/libschroedinger-1.0-0.dll deleted file mode 100644 index cde8841e..00000000 Binary files a/Output/x64/gstreamer/libschroedinger-1.0-0.dll and /dev/null differ diff --git a/Output/x64/gstreamer/libsoup-2.4-1.dll b/Output/x64/gstreamer/libsoup-2.4-1.dll deleted file mode 100644 index 49ff8507..00000000 Binary files a/Output/x64/gstreamer/libsoup-2.4-1.dll and /dev/null differ diff --git a/Output/x64/gstreamer/libspeex-1.dll b/Output/x64/gstreamer/libspeex-1.dll deleted file mode 100644 index c566a3d2..00000000 Binary files a/Output/x64/gstreamer/libspeex-1.dll and /dev/null differ diff --git a/Output/x64/gstreamer/libspeexdsp-1.dll b/Output/x64/gstreamer/libspeexdsp-1.dll deleted file mode 100644 index f129899a..00000000 Binary files a/Output/x64/gstreamer/libspeexdsp-1.dll and /dev/null differ diff --git a/Output/x64/gstreamer/libstdc++-6.dll b/Output/x64/gstreamer/libstdc++-6.dll deleted file mode 100644 index f21f9d04..00000000 Binary files a/Output/x64/gstreamer/libstdc++-6.dll and /dev/null differ diff --git a/Output/x64/gstreamer/libtag.dll b/Output/x64/gstreamer/libtag.dll deleted file mode 100644 index 51e98425..00000000 Binary files a/Output/x64/gstreamer/libtag.dll and /dev/null differ diff --git a/Output/x64/gstreamer/libtag_c.dll b/Output/x64/gstreamer/libtag_c.dll deleted file mode 100644 index 91edaab8..00000000 Binary files a/Output/x64/gstreamer/libtag_c.dll and /dev/null differ diff --git a/Output/x64/gstreamer/libtasn1-3.dll b/Output/x64/gstreamer/libtasn1-3.dll deleted file mode 100644 index 9d5e7c98..00000000 Binary files a/Output/x64/gstreamer/libtasn1-3.dll and /dev/null differ diff --git a/Output/x64/gstreamer/libtheora-0.dll b/Output/x64/gstreamer/libtheora-0.dll deleted file mode 100644 index 9444654c..00000000 Binary files a/Output/x64/gstreamer/libtheora-0.dll and /dev/null differ diff --git a/Output/x64/gstreamer/libtheoradec-1.dll b/Output/x64/gstreamer/libtheoradec-1.dll deleted file mode 100644 index 5695322d..00000000 Binary files a/Output/x64/gstreamer/libtheoradec-1.dll and /dev/null differ diff --git a/Output/x64/gstreamer/libtheoraenc-1.dll b/Output/x64/gstreamer/libtheoraenc-1.dll deleted file mode 100644 index 97f6d413..00000000 Binary files a/Output/x64/gstreamer/libtheoraenc-1.dll and /dev/null differ diff --git a/Output/x64/gstreamer/libtiff-5.dll b/Output/x64/gstreamer/libtiff-5.dll deleted file mode 100644 index 2946cbbf..00000000 Binary files a/Output/x64/gstreamer/libtiff-5.dll and /dev/null differ diff --git a/Output/x64/gstreamer/libvisual-0.4-0.dll b/Output/x64/gstreamer/libvisual-0.4-0.dll deleted file mode 100644 index 41380ba0..00000000 Binary files a/Output/x64/gstreamer/libvisual-0.4-0.dll and /dev/null differ diff --git a/Output/x64/gstreamer/libvorbis-0.dll b/Output/x64/gstreamer/libvorbis-0.dll deleted file mode 100644 index 16ed64eb..00000000 Binary files a/Output/x64/gstreamer/libvorbis-0.dll and /dev/null differ diff --git a/Output/x64/gstreamer/libvorbisenc-2.dll b/Output/x64/gstreamer/libvorbisenc-2.dll deleted file mode 100644 index 74076909..00000000 Binary files a/Output/x64/gstreamer/libvorbisenc-2.dll and /dev/null differ diff --git a/Output/x64/gstreamer/libvorbisfile-3.dll b/Output/x64/gstreamer/libvorbisfile-3.dll deleted file mode 100644 index f72cc6b7..00000000 Binary files a/Output/x64/gstreamer/libvorbisfile-3.dll and /dev/null differ diff --git a/Output/x64/gstreamer/libwavpack-1.dll b/Output/x64/gstreamer/libwavpack-1.dll deleted file mode 100644 index eda6f846..00000000 Binary files a/Output/x64/gstreamer/libwavpack-1.dll and /dev/null differ diff --git a/Output/x64/gstreamer/libwinpthread-1.dll b/Output/x64/gstreamer/libwinpthread-1.dll deleted file mode 100644 index e517c82d..00000000 Binary files a/Output/x64/gstreamer/libwinpthread-1.dll and /dev/null differ diff --git a/Output/x64/gstreamer/libx264-125.dll b/Output/x64/gstreamer/libx264-125.dll deleted file mode 100644 index 661089e3..00000000 Binary files a/Output/x64/gstreamer/libx264-125.dll and /dev/null differ diff --git a/Output/x64/gstreamer/libxml2-2.dll b/Output/x64/gstreamer/libxml2-2.dll deleted file mode 100644 index 6cea9673..00000000 Binary files a/Output/x64/gstreamer/libxml2-2.dll and /dev/null differ diff --git a/Output/x64/gstreamer/libz.dll b/Output/x64/gstreamer/libz.dll deleted file mode 100644 index 5daeaade..00000000 Binary files a/Output/x64/gstreamer/libz.dll and /dev/null differ diff --git a/Output/x64/libgstreamersharpglue-1.0.0.dll b/Output/x64/libgstreamersharpglue-1.0.0.dll new file mode 100644 index 00000000..22022133 Binary files /dev/null and b/Output/x64/libgstreamersharpglue-1.0.0.dll differ diff --git a/Output/x86/gstreamer/libFLAC-8.dll b/Output/x86/gstreamer/libFLAC-8.dll deleted file mode 100644 index f18d03ba..00000000 Binary files a/Output/x86/gstreamer/libFLAC-8.dll and /dev/null differ diff --git a/Output/x86/gstreamer/liba52-0.dll b/Output/x86/gstreamer/liba52-0.dll deleted file mode 100644 index 0ca827a8..00000000 Binary files a/Output/x86/gstreamer/liba52-0.dll and /dev/null differ diff --git a/Output/x86/gstreamer/libass-4.dll b/Output/x86/gstreamer/libass-4.dll deleted file mode 100644 index 652e351c..00000000 Binary files a/Output/x86/gstreamer/libass-4.dll and /dev/null differ diff --git a/Output/x86/gstreamer/libbz2.dll b/Output/x86/gstreamer/libbz2.dll deleted file mode 100644 index bc4906bf..00000000 Binary files a/Output/x86/gstreamer/libbz2.dll and /dev/null differ diff --git a/Output/x86/gstreamer/libcairo-2.dll b/Output/x86/gstreamer/libcairo-2.dll deleted file mode 100644 index 41d46bab..00000000 Binary files a/Output/x86/gstreamer/libcairo-2.dll and /dev/null differ diff --git a/Output/x86/gstreamer/libcairo-gobject-2.dll b/Output/x86/gstreamer/libcairo-gobject-2.dll deleted file mode 100644 index 254ad744..00000000 Binary files a/Output/x86/gstreamer/libcairo-gobject-2.dll and /dev/null differ diff --git a/Output/x86/gstreamer/libcairo-script-interpreter-2.dll b/Output/x86/gstreamer/libcairo-script-interpreter-2.dll deleted file mode 100644 index cb94ab63..00000000 Binary files a/Output/x86/gstreamer/libcairo-script-interpreter-2.dll and /dev/null differ diff --git a/Output/x86/gstreamer/libcharset-1.dll b/Output/x86/gstreamer/libcharset-1.dll deleted file mode 100644 index adf7ff56..00000000 Binary files a/Output/x86/gstreamer/libcharset-1.dll and /dev/null differ diff --git a/Output/x86/gstreamer/libdca-0.dll b/Output/x86/gstreamer/libdca-0.dll deleted file mode 100644 index 810ec4ad..00000000 Binary files a/Output/x86/gstreamer/libdca-0.dll and /dev/null differ diff --git a/Output/x86/gstreamer/libdv-4.dll b/Output/x86/gstreamer/libdv-4.dll deleted file mode 100644 index f4550758..00000000 Binary files a/Output/x86/gstreamer/libdv-4.dll and /dev/null differ diff --git a/Output/x86/gstreamer/libdvdnav-4.dll b/Output/x86/gstreamer/libdvdnav-4.dll deleted file mode 100644 index 9d6b2708..00000000 Binary files a/Output/x86/gstreamer/libdvdnav-4.dll and /dev/null differ diff --git a/Output/x86/gstreamer/libdvdnavmini-4.dll b/Output/x86/gstreamer/libdvdnavmini-4.dll deleted file mode 100644 index 18b93733..00000000 Binary files a/Output/x86/gstreamer/libdvdnavmini-4.dll and /dev/null differ diff --git a/Output/x86/gstreamer/libdvdread-4.dll b/Output/x86/gstreamer/libdvdread-4.dll deleted file mode 100644 index 792db099..00000000 Binary files a/Output/x86/gstreamer/libdvdread-4.dll and /dev/null differ diff --git a/Output/x86/gstreamer/libexpat-1.dll b/Output/x86/gstreamer/libexpat-1.dll deleted file mode 100644 index 755a3191..00000000 Binary files a/Output/x86/gstreamer/libexpat-1.dll and /dev/null differ diff --git a/Output/x86/gstreamer/libfaad-2.dll b/Output/x86/gstreamer/libfaad-2.dll deleted file mode 100644 index 8b530f21..00000000 Binary files a/Output/x86/gstreamer/libfaad-2.dll and /dev/null differ diff --git a/Output/x86/gstreamer/libffi-6.dll b/Output/x86/gstreamer/libffi-6.dll deleted file mode 100644 index 3b439f96..00000000 Binary files a/Output/x86/gstreamer/libffi-6.dll and /dev/null differ diff --git a/Output/x86/gstreamer/libfontconfig-1.dll b/Output/x86/gstreamer/libfontconfig-1.dll deleted file mode 100644 index 12384b6b..00000000 Binary files a/Output/x86/gstreamer/libfontconfig-1.dll and /dev/null differ diff --git a/Output/x86/gstreamer/libfreetype-6.dll b/Output/x86/gstreamer/libfreetype-6.dll deleted file mode 100644 index 2681a07f..00000000 Binary files a/Output/x86/gstreamer/libfreetype-6.dll and /dev/null differ diff --git a/Output/x86/gstreamer/libfribidi-0.dll b/Output/x86/gstreamer/libfribidi-0.dll deleted file mode 100644 index 5ff8d465..00000000 Binary files a/Output/x86/gstreamer/libfribidi-0.dll and /dev/null differ diff --git a/Output/x86/gstreamer/libgcc_s_sjlj-1.dll b/Output/x86/gstreamer/libgcc_s_sjlj-1.dll deleted file mode 100644 index d7d77a76..00000000 Binary files a/Output/x86/gstreamer/libgcc_s_sjlj-1.dll and /dev/null differ diff --git a/Output/x86/gstreamer/libgdk_pixbuf-2.0-0.dll b/Output/x86/gstreamer/libgdk_pixbuf-2.0-0.dll deleted file mode 100644 index 70f3e79f..00000000 Binary files a/Output/x86/gstreamer/libgdk_pixbuf-2.0-0.dll and /dev/null differ diff --git a/Output/x86/gstreamer/libgio-2.0-0.dll b/Output/x86/gstreamer/libgio-2.0-0.dll deleted file mode 100644 index d25be862..00000000 Binary files a/Output/x86/gstreamer/libgio-2.0-0.dll and /dev/null differ diff --git a/Output/x86/gstreamer/libgiognutls.dll b/Output/x86/gstreamer/libgiognutls.dll deleted file mode 100644 index 1eb0bf5d..00000000 Binary files a/Output/x86/gstreamer/libgiognutls.dll and /dev/null differ diff --git a/Output/x86/gstreamer/libglib-2.0-0.dll b/Output/x86/gstreamer/libglib-2.0-0.dll deleted file mode 100644 index ce815096..00000000 Binary files a/Output/x86/gstreamer/libglib-2.0-0.dll and /dev/null differ diff --git a/Output/x86/gstreamer/libgmodule-2.0-0.dll b/Output/x86/gstreamer/libgmodule-2.0-0.dll deleted file mode 100644 index 821f700e..00000000 Binary files a/Output/x86/gstreamer/libgmodule-2.0-0.dll and /dev/null differ diff --git a/Output/x86/gstreamer/libgnutls-28.dll b/Output/x86/gstreamer/libgnutls-28.dll deleted file mode 100644 index a2fc2320..00000000 Binary files a/Output/x86/gstreamer/libgnutls-28.dll and /dev/null differ diff --git a/Output/x86/gstreamer/libgnutls-openssl-27.dll b/Output/x86/gstreamer/libgnutls-openssl-27.dll deleted file mode 100644 index cff30817..00000000 Binary files a/Output/x86/gstreamer/libgnutls-openssl-27.dll and /dev/null differ diff --git a/Output/x86/gstreamer/libgnutlsxx-28.dll b/Output/x86/gstreamer/libgnutlsxx-28.dll deleted file mode 100644 index cfbe9cdb..00000000 Binary files a/Output/x86/gstreamer/libgnutlsxx-28.dll and /dev/null differ diff --git a/Output/x86/gstreamer/libgobject-2.0-0.dll b/Output/x86/gstreamer/libgobject-2.0-0.dll deleted file mode 100644 index 97cab67f..00000000 Binary files a/Output/x86/gstreamer/libgobject-2.0-0.dll and /dev/null differ diff --git a/Output/x86/gstreamer/libgomp-1.dll b/Output/x86/gstreamer/libgomp-1.dll deleted file mode 100644 index 7a50d33b..00000000 Binary files a/Output/x86/gstreamer/libgomp-1.dll and /dev/null differ diff --git a/Output/x86/gstreamer/libgsta52dec.dll b/Output/x86/gstreamer/libgsta52dec.dll deleted file mode 100644 index 6935143b..00000000 Binary files a/Output/x86/gstreamer/libgsta52dec.dll and /dev/null differ diff --git a/Output/x86/gstreamer/libgstadder.dll b/Output/x86/gstreamer/libgstadder.dll deleted file mode 100644 index 0f7c83af..00000000 Binary files a/Output/x86/gstreamer/libgstadder.dll and /dev/null differ diff --git a/Output/x86/gstreamer/libgstadpcmdec.dll b/Output/x86/gstreamer/libgstadpcmdec.dll deleted file mode 100644 index 275324e1..00000000 Binary files a/Output/x86/gstreamer/libgstadpcmdec.dll and /dev/null differ diff --git a/Output/x86/gstreamer/libgstadpcmenc.dll b/Output/x86/gstreamer/libgstadpcmenc.dll deleted file mode 100644 index 13555dd8..00000000 Binary files a/Output/x86/gstreamer/libgstadpcmenc.dll and /dev/null differ diff --git a/Output/x86/gstreamer/libgstalaw.dll b/Output/x86/gstreamer/libgstalaw.dll deleted file mode 100644 index 62610a9b..00000000 Binary files a/Output/x86/gstreamer/libgstalaw.dll and /dev/null differ diff --git a/Output/x86/gstreamer/libgstalpha.dll b/Output/x86/gstreamer/libgstalpha.dll deleted file mode 100644 index e8ab504c..00000000 Binary files a/Output/x86/gstreamer/libgstalpha.dll and /dev/null differ diff --git a/Output/x86/gstreamer/libgstalphacolor.dll b/Output/x86/gstreamer/libgstalphacolor.dll deleted file mode 100644 index bade1163..00000000 Binary files a/Output/x86/gstreamer/libgstalphacolor.dll and /dev/null differ diff --git a/Output/x86/gstreamer/libgstamrnb.dll b/Output/x86/gstreamer/libgstamrnb.dll deleted file mode 100644 index 98ce6e3e..00000000 Binary files a/Output/x86/gstreamer/libgstamrnb.dll and /dev/null differ diff --git a/Output/x86/gstreamer/libgstamrwbdec.dll b/Output/x86/gstreamer/libgstamrwbdec.dll deleted file mode 100644 index 7667849a..00000000 Binary files a/Output/x86/gstreamer/libgstamrwbdec.dll and /dev/null differ diff --git a/Output/x86/gstreamer/libgstapetag.dll b/Output/x86/gstreamer/libgstapetag.dll deleted file mode 100644 index a20ca052..00000000 Binary files a/Output/x86/gstreamer/libgstapetag.dll and /dev/null differ diff --git a/Output/x86/gstreamer/libgstapp-1.0-0.dll b/Output/x86/gstreamer/libgstapp-1.0-0.dll deleted file mode 100644 index d9adcc4a..00000000 Binary files a/Output/x86/gstreamer/libgstapp-1.0-0.dll and /dev/null differ diff --git a/Output/x86/gstreamer/libgstapp.dll b/Output/x86/gstreamer/libgstapp.dll deleted file mode 100644 index 6826d2a3..00000000 Binary files a/Output/x86/gstreamer/libgstapp.dll and /dev/null differ diff --git a/Output/x86/gstreamer/libgstasf.dll b/Output/x86/gstreamer/libgstasf.dll deleted file mode 100644 index f8560d52..00000000 Binary files a/Output/x86/gstreamer/libgstasf.dll and /dev/null differ diff --git a/Output/x86/gstreamer/libgstasfmux.dll b/Output/x86/gstreamer/libgstasfmux.dll deleted file mode 100644 index be272a55..00000000 Binary files a/Output/x86/gstreamer/libgstasfmux.dll and /dev/null differ diff --git a/Output/x86/gstreamer/libgstassrender.dll b/Output/x86/gstreamer/libgstassrender.dll deleted file mode 100644 index 9c052a3c..00000000 Binary files a/Output/x86/gstreamer/libgstassrender.dll and /dev/null differ diff --git a/Output/x86/gstreamer/libgstaudio-1.0-0.dll b/Output/x86/gstreamer/libgstaudio-1.0-0.dll deleted file mode 100644 index 9d37513b..00000000 Binary files a/Output/x86/gstreamer/libgstaudio-1.0-0.dll and /dev/null differ diff --git a/Output/x86/gstreamer/libgstaudioconvert.dll b/Output/x86/gstreamer/libgstaudioconvert.dll deleted file mode 100644 index 6424f8d9..00000000 Binary files a/Output/x86/gstreamer/libgstaudioconvert.dll and /dev/null differ diff --git a/Output/x86/gstreamer/libgstaudiofx.dll b/Output/x86/gstreamer/libgstaudiofx.dll deleted file mode 100644 index 512b5f37..00000000 Binary files a/Output/x86/gstreamer/libgstaudiofx.dll and /dev/null differ diff --git a/Output/x86/gstreamer/libgstaudioparsers.dll b/Output/x86/gstreamer/libgstaudioparsers.dll deleted file mode 100644 index 4203a34d..00000000 Binary files a/Output/x86/gstreamer/libgstaudioparsers.dll and /dev/null differ diff --git a/Output/x86/gstreamer/libgstaudiorate.dll b/Output/x86/gstreamer/libgstaudiorate.dll deleted file mode 100644 index 0ac4431b..00000000 Binary files a/Output/x86/gstreamer/libgstaudiorate.dll and /dev/null differ diff --git a/Output/x86/gstreamer/libgstaudioresample.dll b/Output/x86/gstreamer/libgstaudioresample.dll deleted file mode 100644 index b9cb623a..00000000 Binary files a/Output/x86/gstreamer/libgstaudioresample.dll and /dev/null differ diff --git a/Output/x86/gstreamer/libgstaudiotestsrc.dll b/Output/x86/gstreamer/libgstaudiotestsrc.dll deleted file mode 100644 index def73e32..00000000 Binary files a/Output/x86/gstreamer/libgstaudiotestsrc.dll and /dev/null differ diff --git a/Output/x86/gstreamer/libgstaudiovisualizers.dll b/Output/x86/gstreamer/libgstaudiovisualizers.dll deleted file mode 100644 index 36015556..00000000 Binary files a/Output/x86/gstreamer/libgstaudiovisualizers.dll and /dev/null differ diff --git a/Output/x86/gstreamer/libgstauparse.dll b/Output/x86/gstreamer/libgstauparse.dll deleted file mode 100644 index 732f6592..00000000 Binary files a/Output/x86/gstreamer/libgstauparse.dll and /dev/null differ diff --git a/Output/x86/gstreamer/libgstautoconvert.dll b/Output/x86/gstreamer/libgstautoconvert.dll deleted file mode 100644 index aaf8aa7f..00000000 Binary files a/Output/x86/gstreamer/libgstautoconvert.dll and /dev/null differ diff --git a/Output/x86/gstreamer/libgstautodetect.dll b/Output/x86/gstreamer/libgstautodetect.dll deleted file mode 100644 index deb759da..00000000 Binary files a/Output/x86/gstreamer/libgstautodetect.dll and /dev/null differ diff --git a/Output/x86/gstreamer/libgstavi.dll b/Output/x86/gstreamer/libgstavi.dll deleted file mode 100644 index 63d6d1f9..00000000 Binary files a/Output/x86/gstreamer/libgstavi.dll and /dev/null differ diff --git a/Output/x86/gstreamer/libgstbase-1.0-0.dll b/Output/x86/gstreamer/libgstbase-1.0-0.dll deleted file mode 100644 index aec94495..00000000 Binary files a/Output/x86/gstreamer/libgstbase-1.0-0.dll and /dev/null differ diff --git a/Output/x86/gstreamer/libgstbasecamerabinsrc-1.0-0.dll b/Output/x86/gstreamer/libgstbasecamerabinsrc-1.0-0.dll deleted file mode 100644 index 3e9b960e..00000000 Binary files a/Output/x86/gstreamer/libgstbasecamerabinsrc-1.0-0.dll and /dev/null differ diff --git a/Output/x86/gstreamer/libgstbayer.dll b/Output/x86/gstreamer/libgstbayer.dll deleted file mode 100644 index 723b288d..00000000 Binary files a/Output/x86/gstreamer/libgstbayer.dll and /dev/null differ diff --git a/Output/x86/gstreamer/libgstcairo.dll b/Output/x86/gstreamer/libgstcairo.dll deleted file mode 100644 index 5b286ca3..00000000 Binary files a/Output/x86/gstreamer/libgstcairo.dll and /dev/null differ diff --git a/Output/x86/gstreamer/libgstcamerabin2.dll b/Output/x86/gstreamer/libgstcamerabin2.dll deleted file mode 100644 index a724114f..00000000 Binary files a/Output/x86/gstreamer/libgstcamerabin2.dll and /dev/null differ diff --git a/Output/x86/gstreamer/libgstcodecparsers-1.0-0.dll b/Output/x86/gstreamer/libgstcodecparsers-1.0-0.dll deleted file mode 100644 index 79883023..00000000 Binary files a/Output/x86/gstreamer/libgstcodecparsers-1.0-0.dll and /dev/null differ diff --git a/Output/x86/gstreamer/libgstcoloreffects.dll b/Output/x86/gstreamer/libgstcoloreffects.dll deleted file mode 100644 index 6d4cbf1e..00000000 Binary files a/Output/x86/gstreamer/libgstcoloreffects.dll and /dev/null differ diff --git a/Output/x86/gstreamer/libgstcontroller-1.0-0.dll b/Output/x86/gstreamer/libgstcontroller-1.0-0.dll deleted file mode 100644 index 60d450ed..00000000 Binary files a/Output/x86/gstreamer/libgstcontroller-1.0-0.dll and /dev/null differ diff --git a/Output/x86/gstreamer/libgstcoreelements.dll b/Output/x86/gstreamer/libgstcoreelements.dll deleted file mode 100644 index 09f11b80..00000000 Binary files a/Output/x86/gstreamer/libgstcoreelements.dll and /dev/null differ diff --git a/Output/x86/gstreamer/libgstcutter.dll b/Output/x86/gstreamer/libgstcutter.dll deleted file mode 100644 index 68761d85..00000000 Binary files a/Output/x86/gstreamer/libgstcutter.dll and /dev/null differ diff --git a/Output/x86/gstreamer/libgstd3dvideosink.dll b/Output/x86/gstreamer/libgstd3dvideosink.dll deleted file mode 100644 index d4cd9a0e..00000000 Binary files a/Output/x86/gstreamer/libgstd3dvideosink.dll and /dev/null differ diff --git a/Output/x86/gstreamer/libgstdataurisrc.dll b/Output/x86/gstreamer/libgstdataurisrc.dll deleted file mode 100644 index 92907916..00000000 Binary files a/Output/x86/gstreamer/libgstdataurisrc.dll and /dev/null differ diff --git a/Output/x86/gstreamer/libgstdebug.dll b/Output/x86/gstreamer/libgstdebug.dll deleted file mode 100644 index bd768e6a..00000000 Binary files a/Output/x86/gstreamer/libgstdebug.dll and /dev/null differ diff --git a/Output/x86/gstreamer/libgstdeinterlace.dll b/Output/x86/gstreamer/libgstdeinterlace.dll deleted file mode 100644 index a7a3cec6..00000000 Binary files a/Output/x86/gstreamer/libgstdeinterlace.dll and /dev/null differ diff --git a/Output/x86/gstreamer/libgstdirectsoundsink.dll b/Output/x86/gstreamer/libgstdirectsoundsink.dll deleted file mode 100644 index e6c4474b..00000000 Binary files a/Output/x86/gstreamer/libgstdirectsoundsink.dll and /dev/null differ diff --git a/Output/x86/gstreamer/libgstdtmf.dll b/Output/x86/gstreamer/libgstdtmf.dll deleted file mode 100644 index b6a84f90..00000000 Binary files a/Output/x86/gstreamer/libgstdtmf.dll and /dev/null differ diff --git a/Output/x86/gstreamer/libgstdtsdec.dll b/Output/x86/gstreamer/libgstdtsdec.dll deleted file mode 100644 index 2ed5f4cc..00000000 Binary files a/Output/x86/gstreamer/libgstdtsdec.dll and /dev/null differ diff --git a/Output/x86/gstreamer/libgstdv.dll b/Output/x86/gstreamer/libgstdv.dll deleted file mode 100644 index cca47530..00000000 Binary files a/Output/x86/gstreamer/libgstdv.dll and /dev/null differ diff --git a/Output/x86/gstreamer/libgstdvbsuboverlay.dll b/Output/x86/gstreamer/libgstdvbsuboverlay.dll deleted file mode 100644 index 551b74f8..00000000 Binary files a/Output/x86/gstreamer/libgstdvbsuboverlay.dll and /dev/null differ diff --git a/Output/x86/gstreamer/libgstdvdlpcmdec.dll b/Output/x86/gstreamer/libgstdvdlpcmdec.dll deleted file mode 100644 index 026b9510..00000000 Binary files a/Output/x86/gstreamer/libgstdvdlpcmdec.dll and /dev/null differ diff --git a/Output/x86/gstreamer/libgstdvdread.dll b/Output/x86/gstreamer/libgstdvdread.dll deleted file mode 100644 index 71992132..00000000 Binary files a/Output/x86/gstreamer/libgstdvdread.dll and /dev/null differ diff --git a/Output/x86/gstreamer/libgstdvdspu.dll b/Output/x86/gstreamer/libgstdvdspu.dll deleted file mode 100644 index 0d450e0b..00000000 Binary files a/Output/x86/gstreamer/libgstdvdspu.dll and /dev/null differ diff --git a/Output/x86/gstreamer/libgsteffectv.dll b/Output/x86/gstreamer/libgsteffectv.dll deleted file mode 100644 index dea2dfc1..00000000 Binary files a/Output/x86/gstreamer/libgsteffectv.dll and /dev/null differ diff --git a/Output/x86/gstreamer/libgstencodebin.dll b/Output/x86/gstreamer/libgstencodebin.dll deleted file mode 100644 index 04f897a0..00000000 Binary files a/Output/x86/gstreamer/libgstencodebin.dll and /dev/null differ diff --git a/Output/x86/gstreamer/libgstequalizer.dll b/Output/x86/gstreamer/libgstequalizer.dll deleted file mode 100644 index 71502973..00000000 Binary files a/Output/x86/gstreamer/libgstequalizer.dll and /dev/null differ diff --git a/Output/x86/gstreamer/libgstfaad.dll b/Output/x86/gstreamer/libgstfaad.dll deleted file mode 100644 index 21215363..00000000 Binary files a/Output/x86/gstreamer/libgstfaad.dll and /dev/null differ diff --git a/Output/x86/gstreamer/libgstfft-1.0-0.dll b/Output/x86/gstreamer/libgstfft-1.0-0.dll deleted file mode 100644 index e352b916..00000000 Binary files a/Output/x86/gstreamer/libgstfft-1.0-0.dll and /dev/null differ diff --git a/Output/x86/gstreamer/libgstfieldanalysis.dll b/Output/x86/gstreamer/libgstfieldanalysis.dll deleted file mode 100644 index 0409f03a..00000000 Binary files a/Output/x86/gstreamer/libgstfieldanalysis.dll and /dev/null differ diff --git a/Output/x86/gstreamer/libgstflac.dll b/Output/x86/gstreamer/libgstflac.dll deleted file mode 100644 index 0e95adeb..00000000 Binary files a/Output/x86/gstreamer/libgstflac.dll and /dev/null differ diff --git a/Output/x86/gstreamer/libgstflv.dll b/Output/x86/gstreamer/libgstflv.dll deleted file mode 100644 index 1d400bbe..00000000 Binary files a/Output/x86/gstreamer/libgstflv.dll and /dev/null differ diff --git a/Output/x86/gstreamer/libgstflxdec.dll b/Output/x86/gstreamer/libgstflxdec.dll deleted file mode 100644 index 849c48f7..00000000 Binary files a/Output/x86/gstreamer/libgstflxdec.dll and /dev/null differ diff --git a/Output/x86/gstreamer/libgstfragmented.dll b/Output/x86/gstreamer/libgstfragmented.dll deleted file mode 100644 index a1918e04..00000000 Binary files a/Output/x86/gstreamer/libgstfragmented.dll and /dev/null differ diff --git a/Output/x86/gstreamer/libgstfrei0r.dll b/Output/x86/gstreamer/libgstfrei0r.dll deleted file mode 100644 index f99ecf0e..00000000 Binary files a/Output/x86/gstreamer/libgstfrei0r.dll and /dev/null differ diff --git a/Output/x86/gstreamer/libgstgaudieffects.dll b/Output/x86/gstreamer/libgstgaudieffects.dll deleted file mode 100644 index 570c0943..00000000 Binary files a/Output/x86/gstreamer/libgstgaudieffects.dll and /dev/null differ diff --git a/Output/x86/gstreamer/libgstgdkpixbuf.dll b/Output/x86/gstreamer/libgstgdkpixbuf.dll deleted file mode 100644 index 6ad1fdc9..00000000 Binary files a/Output/x86/gstreamer/libgstgdkpixbuf.dll and /dev/null differ diff --git a/Output/x86/gstreamer/libgstgeometrictransform.dll b/Output/x86/gstreamer/libgstgeometrictransform.dll deleted file mode 100644 index a317340c..00000000 Binary files a/Output/x86/gstreamer/libgstgeometrictransform.dll and /dev/null differ diff --git a/Output/x86/gstreamer/libgstgio.dll b/Output/x86/gstreamer/libgstgio.dll deleted file mode 100644 index e7a63766..00000000 Binary files a/Output/x86/gstreamer/libgstgio.dll and /dev/null differ diff --git a/Output/x86/gstreamer/libgstgoom.dll b/Output/x86/gstreamer/libgstgoom.dll deleted file mode 100644 index 395c8faf..00000000 Binary files a/Output/x86/gstreamer/libgstgoom.dll and /dev/null differ diff --git a/Output/x86/gstreamer/libgstgoom2k1.dll b/Output/x86/gstreamer/libgstgoom2k1.dll deleted file mode 100644 index 0f6287f0..00000000 Binary files a/Output/x86/gstreamer/libgstgoom2k1.dll and /dev/null differ diff --git a/Output/x86/gstreamer/libgsticydemux.dll b/Output/x86/gstreamer/libgsticydemux.dll deleted file mode 100644 index 27957fce..00000000 Binary files a/Output/x86/gstreamer/libgsticydemux.dll and /dev/null differ diff --git a/Output/x86/gstreamer/libgstid3demux.dll b/Output/x86/gstreamer/libgstid3demux.dll deleted file mode 100644 index 8328cbaa..00000000 Binary files a/Output/x86/gstreamer/libgstid3demux.dll and /dev/null differ diff --git a/Output/x86/gstreamer/libgstid3tag.dll b/Output/x86/gstreamer/libgstid3tag.dll deleted file mode 100644 index b26d26e9..00000000 Binary files a/Output/x86/gstreamer/libgstid3tag.dll and /dev/null differ diff --git a/Output/x86/gstreamer/libgstimagefreeze.dll b/Output/x86/gstreamer/libgstimagefreeze.dll deleted file mode 100644 index 3e16aa13..00000000 Binary files a/Output/x86/gstreamer/libgstimagefreeze.dll and /dev/null differ diff --git a/Output/x86/gstreamer/libgstinterlace.dll b/Output/x86/gstreamer/libgstinterlace.dll deleted file mode 100644 index a30d5efe..00000000 Binary files a/Output/x86/gstreamer/libgstinterlace.dll and /dev/null differ diff --git a/Output/x86/gstreamer/libgstinterleave.dll b/Output/x86/gstreamer/libgstinterleave.dll deleted file mode 100644 index afe5e982..00000000 Binary files a/Output/x86/gstreamer/libgstinterleave.dll and /dev/null differ diff --git a/Output/x86/gstreamer/libgstisomp4.dll b/Output/x86/gstreamer/libgstisomp4.dll deleted file mode 100644 index 380ccbf0..00000000 Binary files a/Output/x86/gstreamer/libgstisomp4.dll and /dev/null differ diff --git a/Output/x86/gstreamer/libgstjpeg.dll b/Output/x86/gstreamer/libgstjpeg.dll deleted file mode 100644 index 782b348b..00000000 Binary files a/Output/x86/gstreamer/libgstjpeg.dll and /dev/null differ diff --git a/Output/x86/gstreamer/libgstjpegformat.dll b/Output/x86/gstreamer/libgstjpegformat.dll deleted file mode 100644 index 27c86925..00000000 Binary files a/Output/x86/gstreamer/libgstjpegformat.dll and /dev/null differ diff --git a/Output/x86/gstreamer/libgstlevel.dll b/Output/x86/gstreamer/libgstlevel.dll deleted file mode 100644 index 9579b6f3..00000000 Binary files a/Output/x86/gstreamer/libgstlevel.dll and /dev/null differ diff --git a/Output/x86/gstreamer/libgstlibav.dll b/Output/x86/gstreamer/libgstlibav.dll deleted file mode 100644 index b9b00c10..00000000 Binary files a/Output/x86/gstreamer/libgstlibav.dll and /dev/null differ diff --git a/Output/x86/gstreamer/libgstlibvisual.dll b/Output/x86/gstreamer/libgstlibvisual.dll deleted file mode 100644 index 10336c13..00000000 Binary files a/Output/x86/gstreamer/libgstlibvisual.dll and /dev/null differ diff --git a/Output/x86/gstreamer/libgstliveadder.dll b/Output/x86/gstreamer/libgstliveadder.dll deleted file mode 100644 index 68e431e7..00000000 Binary files a/Output/x86/gstreamer/libgstliveadder.dll and /dev/null differ diff --git a/Output/x86/gstreamer/libgstmad.dll b/Output/x86/gstreamer/libgstmad.dll deleted file mode 100644 index 464049b5..00000000 Binary files a/Output/x86/gstreamer/libgstmad.dll and /dev/null differ diff --git a/Output/x86/gstreamer/libgstmatroska.dll b/Output/x86/gstreamer/libgstmatroska.dll deleted file mode 100644 index 95073d1c..00000000 Binary files a/Output/x86/gstreamer/libgstmatroska.dll and /dev/null differ diff --git a/Output/x86/gstreamer/libgstmms.dll b/Output/x86/gstreamer/libgstmms.dll deleted file mode 100644 index d8d35f08..00000000 Binary files a/Output/x86/gstreamer/libgstmms.dll and /dev/null differ diff --git a/Output/x86/gstreamer/libgstmpeg2dec.dll b/Output/x86/gstreamer/libgstmpeg2dec.dll deleted file mode 100644 index e4ea7e8d..00000000 Binary files a/Output/x86/gstreamer/libgstmpeg2dec.dll and /dev/null differ diff --git a/Output/x86/gstreamer/libgstmpegpsdemux.dll b/Output/x86/gstreamer/libgstmpegpsdemux.dll deleted file mode 100644 index c28f4e7b..00000000 Binary files a/Output/x86/gstreamer/libgstmpegpsdemux.dll and /dev/null differ diff --git a/Output/x86/gstreamer/libgstmpegpsmux.dll b/Output/x86/gstreamer/libgstmpegpsmux.dll deleted file mode 100644 index eb6def20..00000000 Binary files a/Output/x86/gstreamer/libgstmpegpsmux.dll and /dev/null differ diff --git a/Output/x86/gstreamer/libgstmpegtsdemux.dll b/Output/x86/gstreamer/libgstmpegtsdemux.dll deleted file mode 100644 index 5b6ad429..00000000 Binary files a/Output/x86/gstreamer/libgstmpegtsdemux.dll and /dev/null differ diff --git a/Output/x86/gstreamer/libgstmpegtsmux.dll b/Output/x86/gstreamer/libgstmpegtsmux.dll deleted file mode 100644 index dec705bc..00000000 Binary files a/Output/x86/gstreamer/libgstmpegtsmux.dll and /dev/null differ diff --git a/Output/x86/gstreamer/libgstmulaw.dll b/Output/x86/gstreamer/libgstmulaw.dll deleted file mode 100644 index 7b688c10..00000000 Binary files a/Output/x86/gstreamer/libgstmulaw.dll and /dev/null differ diff --git a/Output/x86/gstreamer/libgstmultifile.dll b/Output/x86/gstreamer/libgstmultifile.dll deleted file mode 100644 index d2382518..00000000 Binary files a/Output/x86/gstreamer/libgstmultifile.dll and /dev/null differ diff --git a/Output/x86/gstreamer/libgstmultipart.dll b/Output/x86/gstreamer/libgstmultipart.dll deleted file mode 100644 index 0bbdc65a..00000000 Binary files a/Output/x86/gstreamer/libgstmultipart.dll and /dev/null differ diff --git a/Output/x86/gstreamer/libgstnet-1.0-0.dll b/Output/x86/gstreamer/libgstnet-1.0-0.dll deleted file mode 100644 index 31fd83b4..00000000 Binary files a/Output/x86/gstreamer/libgstnet-1.0-0.dll and /dev/null differ diff --git a/Output/x86/gstreamer/libgstogg.dll b/Output/x86/gstreamer/libgstogg.dll deleted file mode 100644 index bee771b7..00000000 Binary files a/Output/x86/gstreamer/libgstogg.dll and /dev/null differ diff --git a/Output/x86/gstreamer/libgstopus.dll b/Output/x86/gstreamer/libgstopus.dll deleted file mode 100644 index 321c821e..00000000 Binary files a/Output/x86/gstreamer/libgstopus.dll and /dev/null differ diff --git a/Output/x86/gstreamer/libgstpango.dll b/Output/x86/gstreamer/libgstpango.dll deleted file mode 100644 index 8a07a701..00000000 Binary files a/Output/x86/gstreamer/libgstpango.dll and /dev/null differ diff --git a/Output/x86/gstreamer/libgstpbutils-1.0-0.dll b/Output/x86/gstreamer/libgstpbutils-1.0-0.dll deleted file mode 100644 index 7591f07b..00000000 Binary files a/Output/x86/gstreamer/libgstpbutils-1.0-0.dll and /dev/null differ diff --git a/Output/x86/gstreamer/libgstpcapparse.dll b/Output/x86/gstreamer/libgstpcapparse.dll deleted file mode 100644 index 0ac800b6..00000000 Binary files a/Output/x86/gstreamer/libgstpcapparse.dll and /dev/null differ diff --git a/Output/x86/gstreamer/libgstphotography-1.0-0.dll b/Output/x86/gstreamer/libgstphotography-1.0-0.dll deleted file mode 100644 index 803f779d..00000000 Binary files a/Output/x86/gstreamer/libgstphotography-1.0-0.dll and /dev/null differ diff --git a/Output/x86/gstreamer/libgstplayback.dll b/Output/x86/gstreamer/libgstplayback.dll deleted file mode 100644 index 0008c346..00000000 Binary files a/Output/x86/gstreamer/libgstplayback.dll and /dev/null differ diff --git a/Output/x86/gstreamer/libgstpng.dll b/Output/x86/gstreamer/libgstpng.dll deleted file mode 100644 index 7faafb3e..00000000 Binary files a/Output/x86/gstreamer/libgstpng.dll and /dev/null differ diff --git a/Output/x86/gstreamer/libgstpnm.dll b/Output/x86/gstreamer/libgstpnm.dll deleted file mode 100644 index f90b3ec3..00000000 Binary files a/Output/x86/gstreamer/libgstpnm.dll and /dev/null differ diff --git a/Output/x86/gstreamer/libgstrawparse.dll b/Output/x86/gstreamer/libgstrawparse.dll deleted file mode 100644 index 4011a741..00000000 Binary files a/Output/x86/gstreamer/libgstrawparse.dll and /dev/null differ diff --git a/Output/x86/gstreamer/libgstreamer-1.0-0.dll b/Output/x86/gstreamer/libgstreamer-1.0-0.dll deleted file mode 100644 index dfd18558..00000000 Binary files a/Output/x86/gstreamer/libgstreamer-1.0-0.dll and /dev/null differ diff --git a/Output/x86/gstreamer/libgstreamersharpglue-1.0.0.dll b/Output/x86/gstreamer/libgstreamersharpglue-1.0.0.dll deleted file mode 100644 index fee8dae0..00000000 Binary files a/Output/x86/gstreamer/libgstreamersharpglue-1.0.0.dll and /dev/null differ diff --git a/Output/x86/gstreamer/libgstremovesilence.dll b/Output/x86/gstreamer/libgstremovesilence.dll deleted file mode 100644 index 74ea1b92..00000000 Binary files a/Output/x86/gstreamer/libgstremovesilence.dll and /dev/null differ diff --git a/Output/x86/gstreamer/libgstreplaygain.dll b/Output/x86/gstreamer/libgstreplaygain.dll deleted file mode 100644 index c9e77216..00000000 Binary files a/Output/x86/gstreamer/libgstreplaygain.dll and /dev/null differ diff --git a/Output/x86/gstreamer/libgstresindvd.dll b/Output/x86/gstreamer/libgstresindvd.dll deleted file mode 100644 index 49fab065..00000000 Binary files a/Output/x86/gstreamer/libgstresindvd.dll and /dev/null differ diff --git a/Output/x86/gstreamer/libgstriff-1.0-0.dll b/Output/x86/gstreamer/libgstriff-1.0-0.dll deleted file mode 100644 index 67a8dde4..00000000 Binary files a/Output/x86/gstreamer/libgstriff-1.0-0.dll and /dev/null differ diff --git a/Output/x86/gstreamer/libgstrmdemux.dll b/Output/x86/gstreamer/libgstrmdemux.dll deleted file mode 100644 index cffaa83f..00000000 Binary files a/Output/x86/gstreamer/libgstrmdemux.dll and /dev/null differ diff --git a/Output/x86/gstreamer/libgstrtp-1.0-0.dll b/Output/x86/gstreamer/libgstrtp-1.0-0.dll deleted file mode 100644 index a0de60e2..00000000 Binary files a/Output/x86/gstreamer/libgstrtp-1.0-0.dll and /dev/null differ diff --git a/Output/x86/gstreamer/libgstrtp.dll b/Output/x86/gstreamer/libgstrtp.dll deleted file mode 100644 index bad2ac0a..00000000 Binary files a/Output/x86/gstreamer/libgstrtp.dll and /dev/null differ diff --git a/Output/x86/gstreamer/libgstrtpmanager.dll b/Output/x86/gstreamer/libgstrtpmanager.dll deleted file mode 100644 index 30499b6c..00000000 Binary files a/Output/x86/gstreamer/libgstrtpmanager.dll and /dev/null differ diff --git a/Output/x86/gstreamer/libgstrtsp-1.0-0.dll b/Output/x86/gstreamer/libgstrtsp-1.0-0.dll deleted file mode 100644 index d1bc1db3..00000000 Binary files a/Output/x86/gstreamer/libgstrtsp-1.0-0.dll and /dev/null differ diff --git a/Output/x86/gstreamer/libgstrtsp.dll b/Output/x86/gstreamer/libgstrtsp.dll deleted file mode 100644 index f3f6235b..00000000 Binary files a/Output/x86/gstreamer/libgstrtsp.dll and /dev/null differ diff --git a/Output/x86/gstreamer/libgstscaletempoplugin.dll b/Output/x86/gstreamer/libgstscaletempoplugin.dll deleted file mode 100644 index bebc907e..00000000 Binary files a/Output/x86/gstreamer/libgstscaletempoplugin.dll and /dev/null differ diff --git a/Output/x86/gstreamer/libgstschro.dll b/Output/x86/gstreamer/libgstschro.dll deleted file mode 100644 index 2fa33e7d..00000000 Binary files a/Output/x86/gstreamer/libgstschro.dll and /dev/null differ diff --git a/Output/x86/gstreamer/libgstsdp-1.0-0.dll b/Output/x86/gstreamer/libgstsdp-1.0-0.dll deleted file mode 100644 index a158c2ba..00000000 Binary files a/Output/x86/gstreamer/libgstsdp-1.0-0.dll and /dev/null differ diff --git a/Output/x86/gstreamer/libgstsdpelem.dll b/Output/x86/gstreamer/libgstsdpelem.dll deleted file mode 100644 index 5b4887fa..00000000 Binary files a/Output/x86/gstreamer/libgstsdpelem.dll and /dev/null differ diff --git a/Output/x86/gstreamer/libgstsegmentclip.dll b/Output/x86/gstreamer/libgstsegmentclip.dll deleted file mode 100644 index 8dd51501..00000000 Binary files a/Output/x86/gstreamer/libgstsegmentclip.dll and /dev/null differ diff --git a/Output/x86/gstreamer/libgstshapewipe.dll b/Output/x86/gstreamer/libgstshapewipe.dll deleted file mode 100644 index feee0ab2..00000000 Binary files a/Output/x86/gstreamer/libgstshapewipe.dll and /dev/null differ diff --git a/Output/x86/gstreamer/libgstsiren.dll b/Output/x86/gstreamer/libgstsiren.dll deleted file mode 100644 index 9c776e17..00000000 Binary files a/Output/x86/gstreamer/libgstsiren.dll and /dev/null differ diff --git a/Output/x86/gstreamer/libgstsmooth.dll b/Output/x86/gstreamer/libgstsmooth.dll deleted file mode 100644 index 1a2a0c9b..00000000 Binary files a/Output/x86/gstreamer/libgstsmooth.dll and /dev/null differ diff --git a/Output/x86/gstreamer/libgstsmpte.dll b/Output/x86/gstreamer/libgstsmpte.dll deleted file mode 100644 index 01c51019..00000000 Binary files a/Output/x86/gstreamer/libgstsmpte.dll and /dev/null differ diff --git a/Output/x86/gstreamer/libgstsouphttpsrc.dll b/Output/x86/gstreamer/libgstsouphttpsrc.dll deleted file mode 100644 index 66f74e35..00000000 Binary files a/Output/x86/gstreamer/libgstsouphttpsrc.dll and /dev/null differ diff --git a/Output/x86/gstreamer/libgstspectrum.dll b/Output/x86/gstreamer/libgstspectrum.dll deleted file mode 100644 index 0184bcb7..00000000 Binary files a/Output/x86/gstreamer/libgstspectrum.dll and /dev/null differ diff --git a/Output/x86/gstreamer/libgstspeed.dll b/Output/x86/gstreamer/libgstspeed.dll deleted file mode 100644 index 028baf54..00000000 Binary files a/Output/x86/gstreamer/libgstspeed.dll and /dev/null differ diff --git a/Output/x86/gstreamer/libgstspeex.dll b/Output/x86/gstreamer/libgstspeex.dll deleted file mode 100644 index a82a92aa..00000000 Binary files a/Output/x86/gstreamer/libgstspeex.dll and /dev/null differ diff --git a/Output/x86/gstreamer/libgstsubenc.dll b/Output/x86/gstreamer/libgstsubenc.dll deleted file mode 100644 index 5149e54c..00000000 Binary files a/Output/x86/gstreamer/libgstsubenc.dll and /dev/null differ diff --git a/Output/x86/gstreamer/libgstsubparse.dll b/Output/x86/gstreamer/libgstsubparse.dll deleted file mode 100644 index 15e30386..00000000 Binary files a/Output/x86/gstreamer/libgstsubparse.dll and /dev/null differ diff --git a/Output/x86/gstreamer/libgsttag-1.0-0.dll b/Output/x86/gstreamer/libgsttag-1.0-0.dll deleted file mode 100644 index 03bd7db0..00000000 Binary files a/Output/x86/gstreamer/libgsttag-1.0-0.dll and /dev/null differ diff --git a/Output/x86/gstreamer/libgsttaglib.dll b/Output/x86/gstreamer/libgsttaglib.dll deleted file mode 100644 index d8c892c8..00000000 Binary files a/Output/x86/gstreamer/libgsttaglib.dll and /dev/null differ diff --git a/Output/x86/gstreamer/libgsttcp.dll b/Output/x86/gstreamer/libgsttcp.dll deleted file mode 100644 index 4a9a61dc..00000000 Binary files a/Output/x86/gstreamer/libgsttcp.dll and /dev/null differ diff --git a/Output/x86/gstreamer/libgsttheora.dll b/Output/x86/gstreamer/libgsttheora.dll deleted file mode 100644 index d5627b59..00000000 Binary files a/Output/x86/gstreamer/libgsttheora.dll and /dev/null differ diff --git a/Output/x86/gstreamer/libgsttypefindfunctions.dll b/Output/x86/gstreamer/libgsttypefindfunctions.dll deleted file mode 100644 index dd01f0c1..00000000 Binary files a/Output/x86/gstreamer/libgsttypefindfunctions.dll and /dev/null differ diff --git a/Output/x86/gstreamer/libgstudp.dll b/Output/x86/gstreamer/libgstudp.dll deleted file mode 100644 index a35f33e9..00000000 Binary files a/Output/x86/gstreamer/libgstudp.dll and /dev/null differ diff --git a/Output/x86/gstreamer/libgstvideo-1.0-0.dll b/Output/x86/gstreamer/libgstvideo-1.0-0.dll deleted file mode 100644 index b09b44c4..00000000 Binary files a/Output/x86/gstreamer/libgstvideo-1.0-0.dll and /dev/null differ diff --git a/Output/x86/gstreamer/libgstvideobox.dll b/Output/x86/gstreamer/libgstvideobox.dll deleted file mode 100644 index 719a0857..00000000 Binary files a/Output/x86/gstreamer/libgstvideobox.dll and /dev/null differ diff --git a/Output/x86/gstreamer/libgstvideoconvert.dll b/Output/x86/gstreamer/libgstvideoconvert.dll deleted file mode 100644 index b6585297..00000000 Binary files a/Output/x86/gstreamer/libgstvideoconvert.dll and /dev/null differ diff --git a/Output/x86/gstreamer/libgstvideocrop.dll b/Output/x86/gstreamer/libgstvideocrop.dll deleted file mode 100644 index 222e072b..00000000 Binary files a/Output/x86/gstreamer/libgstvideocrop.dll and /dev/null differ diff --git a/Output/x86/gstreamer/libgstvideofilter.dll b/Output/x86/gstreamer/libgstvideofilter.dll deleted file mode 100644 index 89cca146..00000000 Binary files a/Output/x86/gstreamer/libgstvideofilter.dll and /dev/null differ diff --git a/Output/x86/gstreamer/libgstvideomixer.dll b/Output/x86/gstreamer/libgstvideomixer.dll deleted file mode 100644 index 349dea27..00000000 Binary files a/Output/x86/gstreamer/libgstvideomixer.dll and /dev/null differ diff --git a/Output/x86/gstreamer/libgstvideoparsersbad.dll b/Output/x86/gstreamer/libgstvideoparsersbad.dll deleted file mode 100644 index 1dff2865..00000000 Binary files a/Output/x86/gstreamer/libgstvideoparsersbad.dll and /dev/null differ diff --git a/Output/x86/gstreamer/libgstvideorate.dll b/Output/x86/gstreamer/libgstvideorate.dll deleted file mode 100644 index 7bec823c..00000000 Binary files a/Output/x86/gstreamer/libgstvideorate.dll and /dev/null differ diff --git a/Output/x86/gstreamer/libgstvideoscale.dll b/Output/x86/gstreamer/libgstvideoscale.dll deleted file mode 100644 index 9190d1e1..00000000 Binary files a/Output/x86/gstreamer/libgstvideoscale.dll and /dev/null differ diff --git a/Output/x86/gstreamer/libgstvideotestsrc.dll b/Output/x86/gstreamer/libgstvideotestsrc.dll deleted file mode 100644 index 10737d05..00000000 Binary files a/Output/x86/gstreamer/libgstvideotestsrc.dll and /dev/null differ diff --git a/Output/x86/gstreamer/libgstvolume.dll b/Output/x86/gstreamer/libgstvolume.dll deleted file mode 100644 index 82d486d5..00000000 Binary files a/Output/x86/gstreamer/libgstvolume.dll and /dev/null differ diff --git a/Output/x86/gstreamer/libgstvorbis.dll b/Output/x86/gstreamer/libgstvorbis.dll deleted file mode 100644 index fbc886d0..00000000 Binary files a/Output/x86/gstreamer/libgstvorbis.dll and /dev/null differ diff --git a/Output/x86/gstreamer/libgstvpx.dll b/Output/x86/gstreamer/libgstvpx.dll deleted file mode 100644 index 2eaaef28..00000000 Binary files a/Output/x86/gstreamer/libgstvpx.dll and /dev/null differ diff --git a/Output/x86/gstreamer/libgstwavenc.dll b/Output/x86/gstreamer/libgstwavenc.dll deleted file mode 100644 index 5a0eaabf..00000000 Binary files a/Output/x86/gstreamer/libgstwavenc.dll and /dev/null differ diff --git a/Output/x86/gstreamer/libgstwavpack.dll b/Output/x86/gstreamer/libgstwavpack.dll deleted file mode 100644 index e176cb80..00000000 Binary files a/Output/x86/gstreamer/libgstwavpack.dll and /dev/null differ diff --git a/Output/x86/gstreamer/libgstwavparse.dll b/Output/x86/gstreamer/libgstwavparse.dll deleted file mode 100644 index 92071ac7..00000000 Binary files a/Output/x86/gstreamer/libgstwavparse.dll and /dev/null differ diff --git a/Output/x86/gstreamer/libgstx264.dll b/Output/x86/gstreamer/libgstx264.dll deleted file mode 100644 index eda314dd..00000000 Binary files a/Output/x86/gstreamer/libgstx264.dll and /dev/null differ diff --git a/Output/x86/gstreamer/libgstxingmux.dll b/Output/x86/gstreamer/libgstxingmux.dll deleted file mode 100644 index c93ac1f6..00000000 Binary files a/Output/x86/gstreamer/libgstxingmux.dll and /dev/null differ diff --git a/Output/x86/gstreamer/libgsty4mdec.dll b/Output/x86/gstreamer/libgsty4mdec.dll deleted file mode 100644 index 94d4ba85..00000000 Binary files a/Output/x86/gstreamer/libgsty4mdec.dll and /dev/null differ diff --git a/Output/x86/gstreamer/libgsty4menc.dll b/Output/x86/gstreamer/libgsty4menc.dll deleted file mode 100644 index a3bdd6a6..00000000 Binary files a/Output/x86/gstreamer/libgsty4menc.dll and /dev/null differ diff --git a/Output/x86/gstreamer/libgthread-2.0-0.dll b/Output/x86/gstreamer/libgthread-2.0-0.dll deleted file mode 100644 index c4716e47..00000000 Binary files a/Output/x86/gstreamer/libgthread-2.0-0.dll and /dev/null differ diff --git a/Output/x86/gstreamer/libhogweed-2-2.dll b/Output/x86/gstreamer/libhogweed-2-2.dll deleted file mode 100644 index 04cec47f..00000000 Binary files a/Output/x86/gstreamer/libhogweed-2-2.dll and /dev/null differ diff --git a/Output/x86/gstreamer/libiconv-2.dll b/Output/x86/gstreamer/libiconv-2.dll deleted file mode 100644 index 98b3e824..00000000 Binary files a/Output/x86/gstreamer/libiconv-2.dll and /dev/null differ diff --git a/Output/x86/gstreamer/libintl-8.dll b/Output/x86/gstreamer/libintl-8.dll deleted file mode 100644 index 76b00225..00000000 Binary files a/Output/x86/gstreamer/libintl-8.dll and /dev/null differ diff --git a/Output/x86/gstreamer/libjpeg-8.dll b/Output/x86/gstreamer/libjpeg-8.dll deleted file mode 100644 index e4f52bad..00000000 Binary files a/Output/x86/gstreamer/libjpeg-8.dll and /dev/null differ diff --git a/Output/x86/gstreamer/libkate-1.dll b/Output/x86/gstreamer/libkate-1.dll deleted file mode 100644 index e6bc08bf..00000000 Binary files a/Output/x86/gstreamer/libkate-1.dll and /dev/null differ diff --git a/Output/x86/gstreamer/libmms-0.dll b/Output/x86/gstreamer/libmms-0.dll deleted file mode 100644 index 495397cc..00000000 Binary files a/Output/x86/gstreamer/libmms-0.dll and /dev/null differ diff --git a/Output/x86/gstreamer/libmpeg2-0.dll b/Output/x86/gstreamer/libmpeg2-0.dll deleted file mode 100644 index 03d4d18d..00000000 Binary files a/Output/x86/gstreamer/libmpeg2-0.dll and /dev/null differ diff --git a/Output/x86/gstreamer/libmpeg2convert-0.dll b/Output/x86/gstreamer/libmpeg2convert-0.dll deleted file mode 100644 index 68ffc517..00000000 Binary files a/Output/x86/gstreamer/libmpeg2convert-0.dll and /dev/null differ diff --git a/Output/x86/gstreamer/libnettle-4-4.dll b/Output/x86/gstreamer/libnettle-4-4.dll deleted file mode 100644 index 5eb48dae..00000000 Binary files a/Output/x86/gstreamer/libnettle-4-4.dll and /dev/null differ diff --git a/Output/x86/gstreamer/libogg-0.dll b/Output/x86/gstreamer/libogg-0.dll deleted file mode 100644 index e0053c58..00000000 Binary files a/Output/x86/gstreamer/libogg-0.dll and /dev/null differ diff --git a/Output/x86/gstreamer/liboggkate-1.dll b/Output/x86/gstreamer/liboggkate-1.dll deleted file mode 100644 index 3ffe1994..00000000 Binary files a/Output/x86/gstreamer/liboggkate-1.dll and /dev/null differ diff --git a/Output/x86/gstreamer/libopencore-amrnb-0.dll b/Output/x86/gstreamer/libopencore-amrnb-0.dll deleted file mode 100644 index 1eef9151..00000000 Binary files a/Output/x86/gstreamer/libopencore-amrnb-0.dll and /dev/null differ diff --git a/Output/x86/gstreamer/libopencore-amrwb-0.dll b/Output/x86/gstreamer/libopencore-amrwb-0.dll deleted file mode 100644 index 09f6d1c2..00000000 Binary files a/Output/x86/gstreamer/libopencore-amrwb-0.dll and /dev/null differ diff --git a/Output/x86/gstreamer/libopus-0.dll b/Output/x86/gstreamer/libopus-0.dll deleted file mode 100644 index 4c37357f..00000000 Binary files a/Output/x86/gstreamer/libopus-0.dll and /dev/null differ diff --git a/Output/x86/gstreamer/liborc-0.4-0.dll b/Output/x86/gstreamer/liborc-0.4-0.dll deleted file mode 100644 index 60861bdd..00000000 Binary files a/Output/x86/gstreamer/liborc-0.4-0.dll and /dev/null differ diff --git a/Output/x86/gstreamer/liborc-test-0.4-0.dll b/Output/x86/gstreamer/liborc-test-0.4-0.dll deleted file mode 100644 index 03d611f7..00000000 Binary files a/Output/x86/gstreamer/liborc-test-0.4-0.dll and /dev/null differ diff --git a/Output/x86/gstreamer/libpango-1.0-0.dll b/Output/x86/gstreamer/libpango-1.0-0.dll deleted file mode 100644 index 3bc7dbd2..00000000 Binary files a/Output/x86/gstreamer/libpango-1.0-0.dll and /dev/null differ diff --git a/Output/x86/gstreamer/libpangocairo-1.0-0.dll b/Output/x86/gstreamer/libpangocairo-1.0-0.dll deleted file mode 100644 index a230677a..00000000 Binary files a/Output/x86/gstreamer/libpangocairo-1.0-0.dll and /dev/null differ diff --git a/Output/x86/gstreamer/libpangoft2-1.0-0.dll b/Output/x86/gstreamer/libpangoft2-1.0-0.dll deleted file mode 100644 index 972fc2b3..00000000 Binary files a/Output/x86/gstreamer/libpangoft2-1.0-0.dll and /dev/null differ diff --git a/Output/x86/gstreamer/libpangowin32-1.0-0.dll b/Output/x86/gstreamer/libpangowin32-1.0-0.dll deleted file mode 100644 index a8ca6052..00000000 Binary files a/Output/x86/gstreamer/libpangowin32-1.0-0.dll and /dev/null differ diff --git a/Output/x86/gstreamer/libpixman-1-0.dll b/Output/x86/gstreamer/libpixman-1-0.dll deleted file mode 100644 index 8b0e7510..00000000 Binary files a/Output/x86/gstreamer/libpixman-1-0.dll and /dev/null differ diff --git a/Output/x86/gstreamer/libpng15-15.dll b/Output/x86/gstreamer/libpng15-15.dll deleted file mode 100644 index 25b86025..00000000 Binary files a/Output/x86/gstreamer/libpng15-15.dll and /dev/null differ diff --git a/Output/x86/gstreamer/libschroedinger-1.0-0.dll b/Output/x86/gstreamer/libschroedinger-1.0-0.dll deleted file mode 100644 index 5b550844..00000000 Binary files a/Output/x86/gstreamer/libschroedinger-1.0-0.dll and /dev/null differ diff --git a/Output/x86/gstreamer/libsoup-2.4-1.dll b/Output/x86/gstreamer/libsoup-2.4-1.dll deleted file mode 100644 index 3f9d3f5b..00000000 Binary files a/Output/x86/gstreamer/libsoup-2.4-1.dll and /dev/null differ diff --git a/Output/x86/gstreamer/libspeex-1.dll b/Output/x86/gstreamer/libspeex-1.dll deleted file mode 100644 index e20e3aeb..00000000 Binary files a/Output/x86/gstreamer/libspeex-1.dll and /dev/null differ diff --git a/Output/x86/gstreamer/libspeexdsp-1.dll b/Output/x86/gstreamer/libspeexdsp-1.dll deleted file mode 100644 index b8c4c07f..00000000 Binary files a/Output/x86/gstreamer/libspeexdsp-1.dll and /dev/null differ diff --git a/Output/x86/gstreamer/libstdc++-6.dll b/Output/x86/gstreamer/libstdc++-6.dll deleted file mode 100644 index dcd41a9d..00000000 Binary files a/Output/x86/gstreamer/libstdc++-6.dll and /dev/null differ diff --git a/Output/x86/gstreamer/libtag.dll b/Output/x86/gstreamer/libtag.dll deleted file mode 100644 index 302fb280..00000000 Binary files a/Output/x86/gstreamer/libtag.dll and /dev/null differ diff --git a/Output/x86/gstreamer/libtag_c.dll b/Output/x86/gstreamer/libtag_c.dll deleted file mode 100644 index f9b18a5a..00000000 Binary files a/Output/x86/gstreamer/libtag_c.dll and /dev/null differ diff --git a/Output/x86/gstreamer/libtasn1-3.dll b/Output/x86/gstreamer/libtasn1-3.dll deleted file mode 100644 index 3efd4c60..00000000 Binary files a/Output/x86/gstreamer/libtasn1-3.dll and /dev/null differ diff --git a/Output/x86/gstreamer/libtheora-0.dll b/Output/x86/gstreamer/libtheora-0.dll deleted file mode 100644 index 97ef40c8..00000000 Binary files a/Output/x86/gstreamer/libtheora-0.dll and /dev/null differ diff --git a/Output/x86/gstreamer/libtheoradec-1.dll b/Output/x86/gstreamer/libtheoradec-1.dll deleted file mode 100644 index 7136909b..00000000 Binary files a/Output/x86/gstreamer/libtheoradec-1.dll and /dev/null differ diff --git a/Output/x86/gstreamer/libtheoraenc-1.dll b/Output/x86/gstreamer/libtheoraenc-1.dll deleted file mode 100644 index 38a7187a..00000000 Binary files a/Output/x86/gstreamer/libtheoraenc-1.dll and /dev/null differ diff --git a/Output/x86/gstreamer/libtiff-5.dll b/Output/x86/gstreamer/libtiff-5.dll deleted file mode 100644 index 4f64c71c..00000000 Binary files a/Output/x86/gstreamer/libtiff-5.dll and /dev/null differ diff --git a/Output/x86/gstreamer/libvisual-0.4-0.dll b/Output/x86/gstreamer/libvisual-0.4-0.dll deleted file mode 100644 index e25b19f2..00000000 Binary files a/Output/x86/gstreamer/libvisual-0.4-0.dll and /dev/null differ diff --git a/Output/x86/gstreamer/libvorbis-0.dll b/Output/x86/gstreamer/libvorbis-0.dll deleted file mode 100644 index dc0bed93..00000000 Binary files a/Output/x86/gstreamer/libvorbis-0.dll and /dev/null differ diff --git a/Output/x86/gstreamer/libvorbisenc-2.dll b/Output/x86/gstreamer/libvorbisenc-2.dll deleted file mode 100644 index 695beb90..00000000 Binary files a/Output/x86/gstreamer/libvorbisenc-2.dll and /dev/null differ diff --git a/Output/x86/gstreamer/libvorbisfile-3.dll b/Output/x86/gstreamer/libvorbisfile-3.dll deleted file mode 100644 index eae3fda5..00000000 Binary files a/Output/x86/gstreamer/libvorbisfile-3.dll and /dev/null differ diff --git a/Output/x86/gstreamer/libwavpack-1.dll b/Output/x86/gstreamer/libwavpack-1.dll deleted file mode 100644 index 7f5ece56..00000000 Binary files a/Output/x86/gstreamer/libwavpack-1.dll and /dev/null differ diff --git a/Output/x86/gstreamer/libwinpthread-1.dll b/Output/x86/gstreamer/libwinpthread-1.dll deleted file mode 100644 index e27a40c6..00000000 Binary files a/Output/x86/gstreamer/libwinpthread-1.dll and /dev/null differ diff --git a/Output/x86/gstreamer/libx264-125.dll b/Output/x86/gstreamer/libx264-125.dll deleted file mode 100644 index caf83228..00000000 Binary files a/Output/x86/gstreamer/libx264-125.dll and /dev/null differ diff --git a/Output/x86/gstreamer/libxml2-2.dll b/Output/x86/gstreamer/libxml2-2.dll deleted file mode 100644 index 70e68238..00000000 Binary files a/Output/x86/gstreamer/libxml2-2.dll and /dev/null differ diff --git a/Output/x86/gstreamer/libz.dll b/Output/x86/gstreamer/libz.dll deleted file mode 100644 index 49dd02aa..00000000 Binary files a/Output/x86/gstreamer/libz.dll and /dev/null differ diff --git a/Output/x86/libgstreamersharpglue-1.0.0.dll b/Output/x86/libgstreamersharpglue-1.0.0.dll new file mode 100644 index 00000000..37ddbf48 Binary files /dev/null and b/Output/x86/libgstreamersharpglue-1.0.0.dll differ diff --git a/PartyModes/PartyModeChallenge/CChallengeRounds.cs b/PartyModes/PartyModeChallenge/CChallengeRounds.cs index bb2d05cb..6b45ea1f 100644 --- a/PartyModes/PartyModeChallenge/CChallengeRounds.cs +++ b/PartyModes/PartyModeChallenge/CChallengeRounds.cs @@ -28,6 +28,16 @@ namespace VocaluxeLib.PartyModes.Challenge public readonly List Rounds; + public int Count + { + get { return Rounds.Count; } + } + + public CCombination this[int index] + { + get { return Rounds[index]; } + } + public CChallengeRounds(int numRounds, int numPlayer, int numPlayerAtOnce) { Rounds = new List(); diff --git a/PartyModes/PartyModeChallenge/CPartyModeChallenge.cs b/PartyModes/PartyModeChallenge/CPartyModeChallenge.cs index da2b74f7..db882cd4 100644 --- a/PartyModes/PartyModeChallenge/CPartyModeChallenge.cs +++ b/PartyModes/PartyModeChallenge/CPartyModeChallenge.cs @@ -24,33 +24,6 @@ using VocaluxeLib.Menu; namespace VocaluxeLib.PartyModes.Challenge { - - #region Communication - - #region ToScreen - public struct SDataToScreenConfig - { - public int NumPlayer; - public int NumPlayerAtOnce; - public int NumRounds; - } - - public struct SDataToScreenNames - { - public int NumPlayer; - public List ProfileIDs; - } - - public struct SDataToScreenMain - { - public int CurrentRoundNr; - public int NumPlayerAtOnce; - public List Combs; - public int[,] Results; - public List ResultTable; - public List ProfileIDs; - } - public class CResultTableRow : IComparable { public int Position; @@ -78,39 +51,21 @@ namespace VocaluxeLib.PartyModes.Challenge throw new ArgumentException("object is not a ResultTableRow"); } } - #endregion ToScreen - #region FromScreen - public struct SDataFromScreen + public abstract class CPartyScreenChallenge : CMenuParty { - public SFromScreenConfig ScreenConfig; - public SFromScreenNames ScreenNames; - public SFromScreenMain ScreenMain; + protected new CPartyModeChallenge _PartyMode; + + public override void Init() + { + base.Init(); + _PartyMode = (CPartyModeChallenge)base._PartyMode; + } } - public struct SFromScreenConfig - { - public int NumPlayer; - public int NumPlayerAtOnce; - public int NumRounds; - } - - public struct SFromScreenNames - { - public bool FadeBack; - public List ProfileIDs; - } - - public struct SFromScreenMain - { - public bool FadeToSongSelection; - public bool FadeToNameSelection; - } - #endregion FromScreen - - #endregion Communication - + // ReSharper disable ClassNeverInstantiated.Global public sealed class CPartyModeChallenge : CPartyMode + // ReSharper restore ClassNeverInstantiated.Global { private const int _MaxPlayer = 12; private const int _MinPlayer = 1; @@ -120,14 +75,13 @@ namespace VocaluxeLib.PartyModes.Challenge private enum EStage { - NotStarted, Config, Names, Main, Singing } - private struct SData + public struct SData { public int NumPlayer; public int NumPlayerAtOnce; @@ -151,14 +105,10 @@ namespace VocaluxeLib.PartyModes.Challenge public int Won; } - private SDataToScreenConfig _ToScreenConfig; - private SDataToScreenNames _ToScreenNames; - private SDataToScreenMain _ToScreenMain; - - private SData _GameData; + public SData GameData; private EStage _Stage; - public CPartyModeChallenge() + public CPartyModeChallenge(int id, string folder) : base(id, folder) { _ScreenSongOptions.Selection.RandomOnly = false; _ScreenSongOptions.Selection.PartyMode = true; @@ -170,18 +120,12 @@ namespace VocaluxeLib.PartyModes.Challenge _ScreenSongOptions.Sorting.SearchActive = false; _ScreenSongOptions.Sorting.DuetOptions = EDuetOptions.NoDuets; - _Stage = EStage.NotStarted; - - _ToScreenConfig = new SDataToScreenConfig(); - _ToScreenNames = new SDataToScreenNames(); - _ToScreenMain = new SDataToScreenMain(); - - _GameData = new SData {NumPlayer = 4, NumPlayerAtOnce = 2, NumRounds = 2, CurrentRoundNr = 1, ProfileIDs = new List(), CatSongIndices = null, Results = null}; + GameData = new SData {NumPlayer = 4, NumPlayerAtOnce = 2, NumRounds = 12, CurrentRoundNr = 1, ProfileIDs = new List(), CatSongIndices = null, Results = null}; } public override bool Init() { - _Stage = EStage.NotStarted; + _Stage = EStage.Config; _ScreenSongOptions.Sorting.IgnoreArticles = CBase.Config.GetIgnoreArticles(); _ScreenSongOptions.Sorting.SongSorting = CBase.Config.GetSongSorting(); @@ -191,82 +135,11 @@ namespace VocaluxeLib.PartyModes.Challenge if (CBase.Config.GetTabs() == EOffOn.TR_CONFIG_ON && _ScreenSongOptions.Sorting.SongSorting != ESongSorting.TR_CONFIG_NONE) _ScreenSongOptions.Sorting.Tabs = EOffOn.TR_CONFIG_ON; - _ToScreenMain.ResultTable = new List(); - _GameData.ResultTable = new List(); + GameData.ResultTable = new List(); return true; } - public override void DataFromScreen(string screenName, Object data) - { - SDataFromScreen dataFrom; - switch (screenName) - { - case "PartyScreenChallengeConfig": - - try - { - dataFrom = (SDataFromScreen)data; - _GameData.NumPlayer = dataFrom.ScreenConfig.NumPlayer; - _GameData.NumPlayerAtOnce = dataFrom.ScreenConfig.NumPlayerAtOnce; - _GameData.NumRounds = dataFrom.ScreenConfig.NumRounds; - - _Stage = EStage.Config; - CBase.Graphics.FadeTo(EScreens.ScreenPartyDummy); - } - catch (Exception e) - { - CBase.Log.LogError("Error in party mode challenge. Can't cast received data from screen " + screenName + ". " + e.Message); - } - break; - - case "PartyScreenChallengeNames": - try - { - dataFrom = (SDataFromScreen)data; - if (dataFrom.ScreenNames.FadeBack) - _Stage = EStage.NotStarted; - else - { - _GameData.ProfileIDs = dataFrom.ScreenNames.ProfileIDs; - _Stage = EStage.Names; - } - - CBase.Graphics.FadeTo(EScreens.ScreenPartyDummy); - } - catch (Exception e) - { - CBase.Log.LogError("Error in party mode challenge. Can't cast received data from screen " + screenName + ". " + e.Message); - } - break; - - case "PartyScreenChallengeMain": - try - { - dataFrom = (SDataFromScreen)data; - if (dataFrom.ScreenMain.FadeToSongSelection) - _Stage = EStage.Singing; - if (dataFrom.ScreenMain.FadeToNameSelection) - _Stage = EStage.Config; - } - catch (Exception e) - { - CBase.Log.LogError("Error in party mode challenge. Can't cast received data from screen " + screenName + ". " + e.Message); - } - - - if (_Stage == EStage.Singing) - _StartNextRound(); - if (_Stage == EStage.Config) - CBase.Graphics.FadeTo(EScreens.ScreenPartyDummy); - break; - - default: - CBase.Log.LogError("Error in party mode challenge. Wrong screen is sending: " + screenName); - break; - } - } - public override void UpdateGame() { /* @@ -276,78 +149,78 @@ namespace VocaluxeLib.PartyModes.Challenge _ScreenSongOptions.Selection.RandomOnly = false;*/ } - public override CMenuParty GetNextPartyScreen(out EScreens alternativeScreen) + private IMenu _GetNextScreen() { - CMenuParty screen = null; - alternativeScreen = EScreens.ScreenSong; - switch (_Stage) { - case EStage.NotStarted: - _Screens.TryGetValue("CPartyScreenChallengeConfig", out screen); - if (screen != null) - { - _ToScreenConfig.NumPlayer = _GameData.NumPlayer; - _ToScreenConfig.NumPlayerAtOnce = _GameData.NumPlayerAtOnce; - _ToScreenConfig.NumRounds = _GameData.NumRounds; - screen.DataToScreen(_ToScreenConfig); - } - break; case EStage.Config: - _Screens.TryGetValue("CPartyScreenChallengeNames", out screen); - if (screen != null) - { - _ToScreenNames.NumPlayer = _GameData.NumPlayer; - _ToScreenNames.ProfileIDs = _GameData.ProfileIDs; - screen.DataToScreen(_ToScreenNames); - } + return _Screens["CPartyScreenChallengeConfig"]; + case EStage.Names: + return _Screens["CPartyScreenChallengeNames"]; + case EStage.Main: + return _Screens["CPartyScreenChallengeMain"]; + case EStage.Singing: + return CBase.Graphics.GetScreen(EScreen.Song); + default: + throw new ArgumentException("Invalid stage: " + _Stage); + } + } + + private void _FadeToScreen() + { + CBase.Graphics.FadeTo(_GetNextScreen()); + } + + public void Next() + { + switch (_Stage) + { + case EStage.Config: + _Stage = EStage.Names; break; case EStage.Names: - _Screens.TryGetValue("CPartyScreenChallengeMain", out screen); - if (screen != null) - { - CBase.Songs.ResetSongSung(); - _ToScreenMain.ResultTable = new List(); - _GameData.ResultTable = new List(); - _GameData.Rounds = new CChallengeRounds(_GameData.NumRounds, _GameData.NumPlayer, _GameData.NumPlayerAtOnce); - _GameData.CurrentRoundNr = 1; - _ToScreenMain.CurrentRoundNr = 1; - _ToScreenMain.NumPlayerAtOnce = _GameData.NumPlayerAtOnce; - _ToScreenMain.Combs = _GameData.Rounds.Rounds; - _ToScreenMain.ProfileIDs = _GameData.ProfileIDs; - _UpdateScores(); - _ToScreenMain.ResultTable = _GameData.ResultTable; - _ToScreenMain.Results = _GameData.Results; - screen.DataToScreen(_ToScreenMain); - } + _Stage = EStage.Main; + CBase.Songs.ResetSongSung(); + GameData.ResultTable = new List(); + GameData.Rounds = new CChallengeRounds(GameData.NumRounds, GameData.NumPlayer, GameData.NumPlayerAtOnce); + GameData.CurrentRoundNr = 1; break; case EStage.Main: - //nothing to do + _Stage = EStage.Singing; + _StartNextRound(); break; case EStage.Singing: - _Screens.TryGetValue("CPartyScreenChallengeMain", out screen); - if (screen != null) - { - _UpdateScores(); - _ToScreenMain.CurrentRoundNr = _GameData.CurrentRoundNr; - _ToScreenMain.Combs = _GameData.Rounds.Rounds; - _ToScreenMain.Results = _GameData.Results; - screen.DataToScreen(_ToScreenMain); - } + _Stage = EStage.Main; + _UpdateScores(); break; + default: + throw new ArgumentException("Invalid stage: " + _Stage); } - - return screen; + _FadeToScreen(); } - public override EScreens GetStartScreen() + public void Back() { - return EScreens.ScreenPartyDummy; + switch (_Stage) + { + case EStage.Config: + CBase.Graphics.FadeTo(EScreen.Party); + return; + case EStage.Names: + _Stage = EStage.Config; + break; + case EStage.Main: + _Stage = EStage.Names; + break; + default: // Rest is not allowed + throw new ArgumentException("Invalid stage: " + _Stage); + } + _FadeToScreen(); } - public override EScreens GetMainScreen() + public override IMenu GetStartScreen() { - return EScreens.ScreenPartyDummy; + return _Screens["CPartyScreenChallengeConfig"]; } public override SScreenSongOptions GetScreenSongOptions() @@ -370,10 +243,10 @@ namespace VocaluxeLib.PartyModes.Challenge _ScreenSongOptions.Selection.SelectNextRandomSong = false; _CreateCatSongIndices(); - if (_GameData.CatSongIndices != null) + if (GameData.CatSongIndices != null) { - if (_GameData.CatSongIndices[CBase.Songs.GetCurrentCategoryIndex()] == -1) - _GameData.CatSongIndices[CBase.Songs.GetCurrentCategoryIndex()] = songIndex; + if (GameData.CatSongIndices[CBase.Songs.GetCurrentCategoryIndex()] == -1) + GameData.CatSongIndices[CBase.Songs.GetCurrentCategoryIndex()] = songIndex; } } @@ -384,15 +257,15 @@ namespace VocaluxeLib.PartyModes.Challenge public override void OnCategoryChange(int categoryIndex, ref SScreenSongOptions screenSongOptions) // ReSharper restore RedundantAssignment { - if (_GameData.CatSongIndices != null && categoryIndex != -1) + if (GameData.CatSongIndices != null && categoryIndex != -1) { - if (_GameData.CatSongIndices[categoryIndex] == -1) + if (GameData.CatSongIndices[categoryIndex] == -1) _ScreenSongOptions.Selection.SelectNextRandomSong = true; else - _ScreenSongOptions.Selection.SongIndex = _GameData.CatSongIndices[categoryIndex]; + _ScreenSongOptions.Selection.SongIndex = GameData.CatSongIndices[categoryIndex]; } - if (_GameData.CatSongIndices == null && categoryIndex != -1) + if (GameData.CatSongIndices == null && categoryIndex != -1) _ScreenSongOptions.Selection.SelectNextRandomSong = true; if (categoryIndex == -1) @@ -455,34 +328,34 @@ namespace VocaluxeLib.PartyModes.Challenge CBase.Game.Reset(); CBase.Game.ClearSongs(); CBase.Game.AddSong(songID, gm); - CBase.Game.SetNumPlayer(_GameData.NumPlayerAtOnce); + CBase.Game.SetNumPlayer(GameData.NumPlayerAtOnce); SPlayer[] players = CBase.Game.GetPlayers(); if (players == null) return; - if (players.Length < _GameData.NumPlayerAtOnce) + if (players.Length < GameData.NumPlayerAtOnce) return; - CCombination c = _GameData.Rounds.GetRound(_GameData.CurrentRoundNr - 1); + CCombination c = GameData.Rounds.GetRound(GameData.CurrentRoundNr - 1); - for (int i = 0; i < _GameData.NumPlayerAtOnce; i++) + for (int i = 0; i < GameData.NumPlayerAtOnce; i++) { //try to fill with the right data if (c != null) - players[i].ProfileID = _GameData.ProfileIDs[c.Player[i]]; + players[i].ProfileID = GameData.ProfileIDs[c.Player[i]]; else players[i].ProfileID = -1; } - CBase.Graphics.FadeTo(EScreens.ScreenSing); + CBase.Graphics.FadeTo(EScreen.Sing); } public override void LeavingHighscore() { CBase.Songs.AddPartySongSung(CBase.Game.GetSong(0).ID); - _GameData.CurrentRoundNr++; - CBase.Graphics.FadeTo(EScreens.ScreenPartyDummy); + GameData.CurrentRoundNr++; + Next(); } private void _StartNextRound() @@ -491,13 +364,12 @@ namespace VocaluxeLib.PartyModes.Challenge _ScreenSongOptions.Selection.CategoryChangeAllowed = _ScreenSongOptions.Sorting.Tabs == EOffOn.TR_CONFIG_ON; _SetNumJokers(); _SetTeamNames(); - _GameData.CatSongIndices = null; - CBase.Graphics.FadeTo(EScreens.ScreenSong); + GameData.CatSongIndices = null; } private void _SetNumJokers() { - switch (_GameData.NumPlayerAtOnce) + switch (GameData.NumPlayerAtOnce) { case 1: _ScreenSongOptions.Selection.NumJokers = new int[] {10}; @@ -530,19 +402,19 @@ namespace VocaluxeLib.PartyModes.Challenge private void _SetTeamNames() { - if (_GameData.NumPlayerAtOnce < 1 || _GameData.ProfileIDs.Count < _GameData.NumPlayerAtOnce) + if (GameData.NumPlayerAtOnce < 1 || GameData.ProfileIDs.Count < GameData.NumPlayerAtOnce) { _ScreenSongOptions.Selection.TeamNames = new string[] {"foo", "bar"}; return; } - _ScreenSongOptions.Selection.TeamNames = new string[_GameData.NumPlayerAtOnce]; - CCombination c = _GameData.Rounds.GetRound(_GameData.CurrentRoundNr - 1); + _ScreenSongOptions.Selection.TeamNames = new string[GameData.NumPlayerAtOnce]; + CCombination c = GameData.Rounds.GetRound(GameData.CurrentRoundNr - 1); - for (int i = 0; i < _GameData.NumPlayerAtOnce; i++) + for (int i = 0; i < GameData.NumPlayerAtOnce; i++) { if (c != null) - _ScreenSongOptions.Selection.TeamNames[i] = CBase.Profiles.GetPlayerName(_GameData.ProfileIDs[c.Player[i]]); + _ScreenSongOptions.Selection.TeamNames[i] = CBase.Profiles.GetPlayerName(GameData.ProfileIDs[c.Player[i]]); else _ScreenSongOptions.Selection.TeamNames[i] = "foobar"; } @@ -550,19 +422,19 @@ namespace VocaluxeLib.PartyModes.Challenge private void _UpdateScores() { - if (_GameData.ResultTable.Count == 0) + if (GameData.ResultTable.Count == 0) { - for (int i = 0; i < _GameData.NumPlayer; i++) + for (int i = 0; i < GameData.NumPlayer; i++) { - var row = new CResultTableRow {PlayerID = _GameData.ProfileIDs[i], NumPlayed = 0, NumWon = 0, NumSingPoints = 0, NumGamePoints = 0}; - _GameData.ResultTable.Add(row); + var row = new CResultTableRow {PlayerID = GameData.ProfileIDs[i], NumPlayed = 0, NumWon = 0, NumSingPoints = 0, NumGamePoints = 0}; + GameData.ResultTable.Add(row); } - _GameData.Results = new int[_GameData.NumRounds,_GameData.NumPlayerAtOnce]; - for (int i = 0; i < _GameData.NumRounds; i++) + GameData.Results = new int[GameData.NumRounds,GameData.NumPlayerAtOnce]; + for (int i = 0; i < GameData.NumRounds; i++) { - for (int j = 0; j < _GameData.NumPlayerAtOnce; j++) - _GameData.Results[i, j] = 0; + for (int j = 0; j < GameData.NumPlayerAtOnce; j++) + GameData.Results[i, j] = 0; } } else @@ -571,20 +443,20 @@ namespace VocaluxeLib.PartyModes.Challenge if (results == null) return; - if (results.Length < _GameData.NumPlayerAtOnce) + if (results.Length < GameData.NumPlayerAtOnce) return; - for (int j = 0; j < _GameData.NumPlayerAtOnce; j++) - _GameData.Results[_GameData.CurrentRoundNr - 2, j] = (int)Math.Round(results[j].Points); + for (int j = 0; j < GameData.NumPlayerAtOnce; j++) + GameData.Results[GameData.CurrentRoundNr - 2, j] = (int)Math.Round(results[j].Points); List points = _GetPointsForPlayer(results); - for (int i = 0; i < _GameData.NumPlayerAtOnce; i++) + for (int i = 0; i < GameData.NumPlayerAtOnce; i++) { int index = -1; - for (int j = 0; j < _GameData.ResultTable.Count; j++) + for (int j = 0; j < GameData.ResultTable.Count; j++) { - if (points[i].ProfileID == _GameData.ResultTable[j].PlayerID) + if (points[i].ProfileID == GameData.ResultTable[j].PlayerID) { index = j; break; @@ -593,24 +465,24 @@ namespace VocaluxeLib.PartyModes.Challenge if (index == -1) continue; - CResultTableRow row = _GameData.ResultTable[index]; + CResultTableRow row = GameData.ResultTable[index]; row.NumPlayed++; row.NumWon += points[i].Won; row.NumSingPoints += points[i].SingPoints; row.NumGamePoints += points[i].GamePoints; - _GameData.ResultTable[index] = row; + GameData.ResultTable[index] = row; } } - _GameData.ResultTable.Sort(); + GameData.ResultTable.Sort(); //Update position-number int pos = 1; int lastPoints = 0; int lastSingPoints = 0; - foreach (CResultTableRow resultRow in _GameData.ResultTable) + foreach (CResultTableRow resultRow in GameData.ResultTable) { if (lastPoints > resultRow.NumGamePoints || lastSingPoints > resultRow.NumSingPoints) pos++; @@ -623,7 +495,7 @@ namespace VocaluxeLib.PartyModes.Challenge private List _GetPointsForPlayer(SPlayer[] results) { var result = new List(); - for (int i = 0; i < _GameData.NumPlayerAtOnce; i++) + for (int i = 0; i < GameData.NumPlayerAtOnce; i++) { var stat = new SStats {ProfileID = results[i].ProfileID, SingPoints = (int)Math.Round(results[i].Points), Won = 0, GamePoints = 0}; result.Add(stat); @@ -671,15 +543,15 @@ namespace VocaluxeLib.PartyModes.Challenge private void _CreateCatSongIndices() { - if (_GameData.CatSongIndices == null && CBase.Songs.GetNumCategories() > 0 && _ScreenSongOptions.Sorting.Tabs == EOffOn.TR_CONFIG_ON) + if (GameData.CatSongIndices == null && CBase.Songs.GetNumCategories() > 0 && _ScreenSongOptions.Sorting.Tabs == EOffOn.TR_CONFIG_ON) { - _GameData.CatSongIndices = new int[CBase.Songs.GetNumCategories()]; - for (int i = 0; i < _GameData.CatSongIndices.Length; i++) - _GameData.CatSongIndices[i] = -1; + GameData.CatSongIndices = new int[CBase.Songs.GetNumCategories()]; + for (int i = 0; i < GameData.CatSongIndices.Length; i++) + GameData.CatSongIndices[i] = -1; } if (CBase.Songs.GetNumCategories() == 0 || _ScreenSongOptions.Sorting.Tabs == EOffOn.TR_CONFIG_OFF) - _GameData.CatSongIndices = null; + GameData.CatSongIndices = null; } } } \ No newline at end of file diff --git a/PartyModes/PartyModeChallenge/CPartyScreenChallengeConfig.cs b/PartyModes/PartyModeChallenge/CPartyScreenChallengeConfig.cs index 229d68ba..e1ef8456 100644 --- a/PartyModes/PartyModeChallenge/CPartyScreenChallengeConfig.cs +++ b/PartyModes/PartyModeChallenge/CPartyScreenChallengeConfig.cs @@ -15,14 +15,12 @@ // along with Vocaluxe. If not, see . #endregion -using System; using System.Windows.Forms; -using VocaluxeLib.Menu; namespace VocaluxeLib.PartyModes.Challenge { // ReSharper disable UnusedMember.Global - public class CPartyScreenChallengeConfig : CMenuParty + public class CPartyScreenChallengeConfig : CPartyScreenChallenge // ReSharper restore UnusedMember.Global { // Version number for theme files. Increment it, if you've changed something on the theme files! @@ -41,33 +39,12 @@ namespace VocaluxeLib.PartyModes.Challenge private int _MaxNumRounds = 100; private int _RoundSteps = 1; - private SDataFromScreen _Data; - public override void Init() { base.Init(); _ThemeSelectSlides = new string[] {_SelectSlideNumPlayers, _SelectSlideNumMics, _SelectSlideNumRounds}; _ThemeButtons = new string[] {_ButtonNext, _ButtonBack}; - - _Data = new SDataFromScreen(); - SFromScreenConfig config = new SFromScreenConfig {NumPlayer = 4, NumPlayerAtOnce = 2, NumRounds = 12}; - _Data.ScreenConfig = config; - } - - public override void DataToScreen(object receivedData) - { - try - { - SDataToScreenConfig config = (SDataToScreenConfig)receivedData; - _Data.ScreenConfig.NumPlayer = config.NumPlayer; - _Data.ScreenConfig.NumPlayerAtOnce = config.NumPlayerAtOnce; - _Data.ScreenConfig.NumRounds = config.NumRounds; - } - catch (Exception e) - { - CBase.Log.LogError("Error in party mode screen challenge config. Can't cast received data from game mode " + ThemeName + ". " + e.Message); - } } public override bool HandleInput(SKeyEvent keyEvent) @@ -81,17 +58,17 @@ namespace VocaluxeLib.PartyModes.Challenge { case Keys.Back: case Keys.Escape: - _Back(); + _PartyMode.Back(); break; case Keys.Enter: _UpdateSlides(); if (_Buttons[_ButtonBack].Selected) - _Back(); + _PartyMode.Back(); if (_Buttons[_ButtonNext].Selected) - _Next(); + _PartyMode.Next(); break; case Keys.Left: @@ -110,18 +87,18 @@ namespace VocaluxeLib.PartyModes.Challenge { base.HandleMouse(mouseEvent); - if (mouseEvent.LB && _IsMouseOver(mouseEvent)) + if (mouseEvent.LB && _IsMouseOverCurSelection(mouseEvent)) { _UpdateSlides(); if (_Buttons[_ButtonBack].Selected) - _Back(); + _PartyMode.Back(); if (_Buttons[_ButtonNext].Selected) - _Next(); + _PartyMode.Next(); } if (mouseEvent.RB) - _Back(); + _PartyMode.Back(); return true; } @@ -144,19 +121,13 @@ namespace VocaluxeLib.PartyModes.Challenge return true; } - public override bool Draw() - { - base.Draw(); - return true; - } - private void _RebuildSlides() { // build num player slide (min player ... max player); _SelectSlides[_SelectSlideNumPlayers].Clear(); for (int i = _PartyMode.GetMinPlayer(); i <= _PartyMode.GetMaxPlayer(); i++) _SelectSlides[_SelectSlideNumPlayers].AddValue(i.ToString()); - _SelectSlides[_SelectSlideNumPlayers].Selection = _Data.ScreenConfig.NumPlayer - _PartyMode.GetMinPlayer(); + _SelectSlides[_SelectSlideNumPlayers].Selection = _PartyMode.GameData.NumPlayer - _PartyMode.GetMinPlayer(); _UpdateMicsAtOnce(); _SetRoundSteps(); @@ -165,21 +136,21 @@ namespace VocaluxeLib.PartyModes.Challenge private void _UpdateSlides() { - int player = _Data.ScreenConfig.NumPlayer; - int mics = _Data.ScreenConfig.NumPlayerAtOnce; - _Data.ScreenConfig.NumPlayer = _SelectSlides[_SelectSlideNumPlayers].Selection + _PartyMode.GetMinPlayer(); - _Data.ScreenConfig.NumPlayerAtOnce = _SelectSlides[_SelectSlideNumMics].Selection + _PartyMode.GetMinPlayer(); - _Data.ScreenConfig.NumRounds = (_SelectSlides[_SelectSlideNumRounds].Selection + 1) * _RoundSteps; + int player = _PartyMode.GameData.NumPlayer; + int mics = _PartyMode.GameData.NumPlayerAtOnce; + _PartyMode.GameData.NumPlayer = _SelectSlides[_SelectSlideNumPlayers].Selection + _PartyMode.GetMinPlayer(); + _PartyMode.GameData.NumPlayerAtOnce = _SelectSlides[_SelectSlideNumMics].Selection + _PartyMode.GetMinPlayer(); + _PartyMode.GameData.NumRounds = (_SelectSlides[_SelectSlideNumRounds].Selection + 1) * _RoundSteps; _UpdateMicsAtOnce(); _SetRoundSteps(); - if (player != _Data.ScreenConfig.NumPlayer || mics != _Data.ScreenConfig.NumPlayerAtOnce) + if (player != _PartyMode.GameData.NumPlayer || mics != _PartyMode.GameData.NumPlayerAtOnce) { - int num = CHelper.CombinationCount(_Data.ScreenConfig.NumPlayer, _Data.ScreenConfig.NumPlayerAtOnce); + int num = CHelper.CombinationCount(_PartyMode.GameData.NumPlayer, _PartyMode.GameData.NumPlayerAtOnce); while (num > _MaxNumRounds) num -= _RoundSteps; - _Data.ScreenConfig.NumRounds = num; + _PartyMode.GameData.NumRounds = num; } _UpdateSlideRounds(); @@ -187,19 +158,18 @@ namespace VocaluxeLib.PartyModes.Challenge private void _UpdateMicsAtOnce() { - //Data.ScreenConfig.NumPlayerAtOnce int maxNum = _MaxNumMics; - if (_Data.ScreenConfig.NumPlayer < _MaxNumMics) - maxNum = _Data.ScreenConfig.NumPlayer; + if (_PartyMode.GameData.NumPlayer < _MaxNumMics) + maxNum = _PartyMode.GameData.NumPlayer; - if (_Data.ScreenConfig.NumPlayerAtOnce > maxNum) - _Data.ScreenConfig.NumPlayerAtOnce = maxNum; + if (_PartyMode.GameData.NumPlayerAtOnce > maxNum) + _PartyMode.GameData.NumPlayerAtOnce = maxNum; // build mics at once slide _SelectSlides[_SelectSlideNumMics].Clear(); for (int i = 1; i <= maxNum; i++) _SelectSlides[_SelectSlideNumMics].AddValue(i.ToString()); - _SelectSlides[_SelectSlideNumMics].Selection = _Data.ScreenConfig.NumPlayerAtOnce - _PartyMode.GetMinPlayer(); + _SelectSlides[_SelectSlideNumMics].Selection = _PartyMode.GameData.NumPlayerAtOnce - _PartyMode.GetMinPlayer(); } private void _UpdateSlideRounds() @@ -208,31 +178,21 @@ namespace VocaluxeLib.PartyModes.Challenge _SelectSlides[_SelectSlideNumRounds].Clear(); for (int i = _RoundSteps; i <= _MaxNumRounds; i += _RoundSteps) _SelectSlides[_SelectSlideNumRounds].AddValue(i.ToString()); - _SelectSlides[_SelectSlideNumRounds].Selection = _Data.ScreenConfig.NumRounds / _RoundSteps - 1; + _SelectSlides[_SelectSlideNumRounds].Selection = _PartyMode.GameData.NumRounds / _RoundSteps - 1; } private void _SetRoundSteps() { - if (_Data.ScreenConfig.NumPlayerAtOnce < 1 || _Data.ScreenConfig.NumPlayer < 1 || _Data.ScreenConfig.NumPlayerAtOnce > _Data.ScreenConfig.NumPlayer) + if (_PartyMode.GameData.NumPlayerAtOnce < 1 || _PartyMode.GameData.NumPlayer < 1 || _PartyMode.GameData.NumPlayerAtOnce > _PartyMode.GameData.NumPlayer) { _RoundSteps = 1; return; } - int res = _Data.ScreenConfig.NumPlayer / _Data.ScreenConfig.NumPlayerAtOnce; - int mod = _Data.ScreenConfig.NumPlayer % _Data.ScreenConfig.NumPlayerAtOnce; + int res = _PartyMode.GameData.NumPlayer / _PartyMode.GameData.NumPlayerAtOnce; + int mod = _PartyMode.GameData.NumPlayer % _PartyMode.GameData.NumPlayerAtOnce; - _RoundSteps = mod == 0 ? res : _Data.ScreenConfig.NumPlayer; - } - - private void _Back() - { - _FadeTo(EScreens.ScreenParty); - } - - private void _Next() - { - _PartyMode.DataFromScreen(ThemeName, _Data); + _RoundSteps = mod == 0 ? res : _PartyMode.GameData.NumPlayer; } } } \ No newline at end of file diff --git a/PartyModes/PartyModeChallenge/CPartyScreenChallengeMain.cs b/PartyModes/PartyModeChallenge/CPartyScreenChallengeMain.cs index 22945876..41805118 100644 --- a/PartyModes/PartyModeChallenge/CPartyScreenChallengeMain.cs +++ b/PartyModes/PartyModeChallenge/CPartyScreenChallengeMain.cs @@ -40,7 +40,7 @@ namespace VocaluxeLib.PartyModes.Challenge } // ReSharper disable UnusedMember.Global - public class CPartyScreenChallengeMain : CMenuParty + public class CPartyScreenChallengeMain : CPartyScreenChallenge // ReSharper restore UnusedMember.Global { // Version number for theme files. Increment it, if you've changed something on the theme files! @@ -79,8 +79,6 @@ namespace VocaluxeLib.PartyModes.Challenge private bool _ExitPopupVisible; - private SDataFromScreen _Data; - private SDataToScreenMain _GameState; private List _PlayerTable; private List _RoundsTable; @@ -94,11 +92,6 @@ namespace VocaluxeLib.PartyModes.Challenge private const int _NumPlayerVisible = 10; private int _NumRoundsVisible = 3; - public CPartyScreenChallengeMain() - { - _Data = new SDataFromScreen {ScreenMain = new SFromScreenMain()}; - } - public override void Init() { base.Init(); @@ -121,7 +114,6 @@ namespace VocaluxeLib.PartyModes.Challenge { base.LoadTheme(xmlPath); - _GameState = new SDataToScreenMain(); _BuildPlayerTable(); _CreateRoundsTable(); _NextPlayerTexts = new List(); @@ -134,19 +126,7 @@ namespace VocaluxeLib.PartyModes.Challenge _NextPlayerStatics.Add(GetNewStatic(_Statics[_StaticNextPlayer])); _AddStatic(_NextPlayerStatics[_NextPlayerStatics.Count - 1]); } - } - - public override void DataToScreen(object receivedData) - { - try - { - var data = (SDataToScreenMain)receivedData; - _GameState = data; - } - catch (Exception e) - { - CBase.Log.LogError("Error in party mode screen challenge main. Can't cast received data from game mode " + ThemeName + ". " + e.Message); - } + _Statics[_StaticNextPlayer].Visible = false; } public override bool HandleInput(SKeyEvent keyEvent) @@ -162,8 +142,8 @@ namespace VocaluxeLib.PartyModes.Challenge case Keys.Escape: if (!_ExitPopupVisible) { - if (_GameState.CurrentRoundNr == 1) - _Back(); + if (_PartyMode.GameData.CurrentRoundNr == 1) + _PartyMode.Back(); else _ShowPopup(true); } @@ -175,10 +155,10 @@ namespace VocaluxeLib.PartyModes.Challenge if (!_ExitPopupVisible) { if (_Buttons[_ButtonNextRound].Selected) - _NextRound(); - if (_Buttons[_ButtonBack].Selected && _GameState.CurrentRoundNr == 1) - _Back(); - if (_Buttons[_ButtonExit].Selected && _GameState.CurrentRoundNr > 1) + _PartyMode.Next(); + if (_Buttons[_ButtonBack].Selected && _PartyMode.GameData.CurrentRoundNr == 1) + _PartyMode.Back(); + if (_Buttons[_ButtonExit].Selected && _PartyMode.GameData.CurrentRoundNr > 1) _ShowPopup(true); if (_Buttons[_ButtonPlayerScrollUp].Selected) _ScrollPlayerTable(-1); @@ -206,15 +186,15 @@ namespace VocaluxeLib.PartyModes.Challenge { base.HandleMouse(mouseEvent); - if (mouseEvent.LB && _IsMouseOver(mouseEvent)) + if (mouseEvent.LB && _IsMouseOverCurSelection(mouseEvent)) { if (!_ExitPopupVisible) { if (_Buttons[_ButtonNextRound].Selected) - _NextRound(); - if (_Buttons[_ButtonBack].Selected && _GameState.CurrentRoundNr == 1) - _Back(); - if (_Buttons[_ButtonExit].Selected && _GameState.CurrentRoundNr > 1) + _PartyMode.Next(); + if (_Buttons[_ButtonBack].Selected && _PartyMode.GameData.CurrentRoundNr == 1) + _PartyMode.Back(); + if (_Buttons[_ButtonExit].Selected && _PartyMode.GameData.CurrentRoundNr > 1) _ShowPopup(true); if (_Buttons[_ButtonPlayerScrollUp].Selected) _ScrollPlayerTable(-1); @@ -238,8 +218,8 @@ namespace VocaluxeLib.PartyModes.Challenge { if (!_ExitPopupVisible) { - if (_GameState.CurrentRoundNr == 1) - _Back(); + if (_PartyMode.GameData.CurrentRoundNr == 1) + _PartyMode.Back(); else _ShowPopup(true); } @@ -268,13 +248,13 @@ namespace VocaluxeLib.PartyModes.Challenge _UpdatePlayerTable(); _UpdateNextPlayerPositions(); _UpdateNextPlayerContents(); - if (_GameState.CurrentRoundNr == 1) + if (_PartyMode.GameData.CurrentRoundNr == 1) _BuildRoundsTable(); else - _ScrollRoundsTable(_GameState.CurrentRoundNr - 2); + _ScrollRoundsTable(_PartyMode.GameData.CurrentRoundNr - 2); _UpdateRoundsTable(); - if (_GameState.CurrentRoundNr == 1) + if (_PartyMode.GameData.CurrentRoundNr == 1) { _Buttons[_ButtonBack].Visible = true; _Buttons[_ButtonExit].Visible = false; @@ -285,12 +265,12 @@ namespace VocaluxeLib.PartyModes.Challenge _Buttons[_ButtonExit].Visible = true; } - if (_GameState.CurrentRoundNr <= _GameState.Combs.Count) + if (_PartyMode.GameData.CurrentRoundNr <= _PartyMode.GameData.Rounds.Count) { _Buttons[_ButtonNextRound].Visible = true; _Texts[_TextFinishMessage].Visible = false; _Texts[_TextFinishPlayerWin].Visible = false; - _SetInteractionToButton(_Buttons[_ButtonNextRound]); + _SelectElement(_Buttons[_ButtonNextRound]); } else { @@ -298,7 +278,7 @@ namespace VocaluxeLib.PartyModes.Challenge _Texts[_TextFinishMessage].Visible = true; _Texts[_TextFinishPlayerWin].Visible = true; _Texts[_TextFinishPlayerWin].Text = _GetPlayerWinString(); - _SetInteractionToButton(_Buttons[_ButtonExit]); + _SelectElement(_Buttons[_ButtonExit]); } _ShowPopup(false); @@ -309,22 +289,9 @@ namespace VocaluxeLib.PartyModes.Challenge return true; } - public override bool Draw() - { - base.Draw(); - return true; - } - - private void _NextRound() - { - _Data.ScreenMain.FadeToNameSelection = false; - _Data.ScreenMain.FadeToSongSelection = true; - _PartyMode.DataFromScreen(ThemeName, _Data); - } - private void _EndParty() { - _FadeTo(EScreens.ScreenParty); + CBase.Graphics.FadeTo(EScreen.Party); } private void _ShowPopup(bool visible) @@ -337,26 +304,20 @@ namespace VocaluxeLib.PartyModes.Challenge _Buttons[_ButtonPopupNo].Visible = _ExitPopupVisible; if (_ExitPopupVisible) - _SetInteractionToButton(_Buttons[_ButtonPopupNo]); - } - - private void _Back() - { - _Data.ScreenMain.FadeToNameSelection = true; - _Data.ScreenMain.FadeToSongSelection = false; - _PartyMode.DataFromScreen(ThemeName, _Data); + _SelectElement(_Buttons[_ButtonPopupNo]); } private void _UpdateNextPlayerPositions() { - float x = (float)CBase.Settings.GetRenderW() / 2 - ((_GameState.NumPlayerAtOnce * _Statics[_StaticNextPlayer].Rect.W) + ((_GameState.NumPlayerAtOnce - 1) * 15)) / 2; + float x = (float)CBase.Settings.GetRenderW() / 2 - + ((_PartyMode.GameData.NumPlayerAtOnce * _Statics[_StaticNextPlayer].Rect.W) + ((_PartyMode.GameData.NumPlayerAtOnce - 1) * 15)) / 2; const float staticY = 590; const float textY = 550; - for (int i = 0; i < _GameState.NumPlayerAtOnce; i++) + for (int i = 0; i < _PartyMode.GameData.NumPlayerAtOnce; i++) { //static - _NextPlayerStatics[i].Rect.X = x; - _NextPlayerStatics[i].Rect.Y = staticY; + _NextPlayerStatics[i].X = x; + _NextPlayerStatics[i].Y = staticY; _NextPlayerStatics[i].Visible = true; //text _NextPlayerTexts[i].X = x + _Statics[_StaticNextPlayer].Rect.W / 2; @@ -365,7 +326,7 @@ namespace VocaluxeLib.PartyModes.Challenge x += _Statics[_StaticNextPlayer].Rect.W + 15; } - for (int i = _GameState.NumPlayerAtOnce; i < _PartyMode.GetMaxPlayer(); i++) + for (int i = _PartyMode.GameData.NumPlayerAtOnce; i < _PartyMode.GetMaxPlayer(); i++) { _NextPlayerStatics[i].Visible = false; _NextPlayerTexts[i].Visible = false; @@ -374,21 +335,21 @@ namespace VocaluxeLib.PartyModes.Challenge private void _UpdateNextPlayerContents() { - if (_GameState.CurrentRoundNr <= _GameState.Combs.Count) + if (_PartyMode.GameData.CurrentRoundNr <= _PartyMode.GameData.Rounds.Count) { _Texts[_TextNextPlayerMessage].Visible = true; - for (int i = 0; i < _GameState.NumPlayerAtOnce; i++) + for (int i = 0; i < _PartyMode.GameData.NumPlayerAtOnce; i++) { - int id = _GameState.ProfileIDs[_GameState.Combs[_GameState.CurrentRoundNr - 1].Player[i]]; + int id = _PartyMode.GameData.ProfileIDs[_PartyMode.GameData.Rounds[_PartyMode.GameData.CurrentRoundNr - 1].Player[i]]; _NextPlayerStatics[i].Texture = CBase.Profiles.GetAvatar(id); _NextPlayerTexts[i].Text = CBase.Profiles.GetPlayerName(id); - _NextPlayerTexts[i].Color = CBase.Theme.GetPlayerColor(i + 1); + _NextPlayerTexts[i].Color = CBase.Themes.GetPlayerColor(i + 1); } } else { _Texts[_TextNextPlayerMessage].Visible = false; - for (int i = 0; i < _GameState.NumPlayerAtOnce; i++) + for (int i = 0; i < _PartyMode.GameData.NumPlayerAtOnce; i++) { _NextPlayerStatics[i].Visible = false; _NextPlayerTexts[i].Visible = false; @@ -434,10 +395,10 @@ namespace VocaluxeLib.PartyModes.Challenge _RoundsTableScrollArea = new SRectF(); const int numPlayerInOneRow = 3; - _NumRoundsVisible = _GameState.NumPlayerAtOnce <= numPlayerInOneRow ? 5 : 3; + _NumRoundsVisible = _PartyMode.GameData.NumPlayerAtOnce <= numPlayerInOneRow ? 5 : 3; - if (_NumRoundsVisible > _GameState.Combs.Count) - _NumRoundsVisible = _GameState.Combs.Count; + if (_NumRoundsVisible > _PartyMode.GameData.Rounds.Count) + _NumRoundsVisible = _PartyMode.GameData.Rounds.Count; float numberX = _Texts[_TextRoundNumber].X; float numberY = _Texts[_TextRoundNumber].Y; @@ -446,7 +407,7 @@ namespace VocaluxeLib.PartyModes.Challenge _RoundsTableScrollArea.Y = numberY; _RoundsTableScrollArea.W = CBase.Settings.GetRenderW() - _Texts[_TextRoundNumber].X - 20; - float delta = _Texts[_TextRoundNumber].Height; + float delta = _Texts[_TextRoundNumber].Rect.H; //Update statics and texts for rounds foreach (CRoundsTableRow roundRow in _RoundsTable) @@ -454,15 +415,15 @@ namespace VocaluxeLib.PartyModes.Challenge //Round-number roundRow.Number.X = numberX; roundRow.Number.Y = numberY; - var numInnerRows = (int)Math.Ceiling(_GameState.NumPlayerAtOnce / ((double)numPlayerInOneRow)); + var numInnerRows = (int)Math.Ceiling(_PartyMode.GameData.NumPlayerAtOnce / ((double)numPlayerInOneRow)); for (int row = 0; row < numInnerRows; row++) { int num = (row + 1) * numPlayerInOneRow; int numPlayerInThisRow = numPlayerInOneRow; - if (num > _GameState.NumPlayerAtOnce) + if (num > _PartyMode.GameData.NumPlayerAtOnce) { - num = _GameState.NumPlayerAtOnce; - numPlayerInThisRow = _GameState.NumPlayerAtOnce - (row * numPlayerInOneRow); + num = _PartyMode.GameData.NumPlayerAtOnce; + numPlayerInThisRow = _PartyMode.GameData.NumPlayerAtOnce - (row * numPlayerInOneRow); } for (int column = row * numPlayerInOneRow; column < num; column++) { @@ -472,14 +433,13 @@ namespace VocaluxeLib.PartyModes.Challenge float maxw = ((CBase.Settings.GetRenderW() - _Texts[_TextRoundNumber].X - 20) / numPlayerInThisRow) / 2 - 5; roundRow.TextPlayer[column].X = x; roundRow.TextPlayer[column].Y = numberY; - roundRow.TextPlayer[column].MaxWidth = maxw; + roundRow.TextPlayer[column].W = maxw; //Score - roundRow.TextScores[column] = roundRow.TextScores[column]; roundRow.TextScores[column].X = x; roundRow.TextScores[column].Y = numberY + delta; - roundRow.TextScores[column].MaxWidth = maxw; + roundRow.TextScores[column].W = maxw; } - numberY = numberY + delta + delta; + numberY = numberY + 2 * delta; } numberY = numberY + delta / 2; } @@ -492,17 +452,18 @@ namespace VocaluxeLib.PartyModes.Challenge { for (int p = 0; p < _RoundsTable[i].TextPlayer.Count; p++) { - if (_GameState.Combs.Count > i + _RoundsTableOffset && _GameState.Combs[i + _RoundsTableOffset].Player.Count > p) + if (_PartyMode.GameData.Rounds.Count > i + _RoundsTableOffset && _PartyMode.GameData.Rounds[i + _RoundsTableOffset].Player.Count > p) { _RoundsTable[i].Number.Visible = true; _RoundsTable[i].TextPlayer[p].Visible = true; _RoundsTable[i].TextScores[p].Visible = true; _RoundsTable[i].Number.Text = (i + 1 + _RoundsTableOffset) + ")"; - _RoundsTable[i].TextPlayer[p].Text = CBase.Profiles.GetPlayerName(_GameState.ProfileIDs[_GameState.Combs[i + _RoundsTableOffset].Player[p]]); + _RoundsTable[i].TextPlayer[p].Text = + CBase.Profiles.GetPlayerName(_PartyMode.GameData.ProfileIDs[_PartyMode.GameData.Rounds[i + _RoundsTableOffset].Player[p]]); // ReSharper disable ConvertIfStatementToConditionalTernaryExpression - if ((_GameState.CurrentRoundNr - 1) > i + _RoundsTableOffset) + if ((_PartyMode.GameData.CurrentRoundNr - 1) > i + _RoundsTableOffset) // ReSharper restore ConvertIfStatementToConditionalTernaryExpression - _RoundsTable[i].TextScores[p].Text = _GameState.Results[i + _RoundsTableOffset, p].ToString(); + _RoundsTable[i].TextScores[p].Text = _PartyMode.GameData.Results[i + _RoundsTableOffset, p].ToString(); else _RoundsTable[i].TextScores[p].Text = ""; } @@ -512,7 +473,7 @@ namespace VocaluxeLib.PartyModes.Challenge _RoundsTable[i].TextScores[p].Visible = false; } } - if (_GameState.Combs.Count < i + _RoundsTableOffset || i + 1 > _NumRoundsVisible) + if (_PartyMode.GameData.Rounds.Count < i + _RoundsTableOffset || i + 1 > _NumRoundsVisible) { _RoundsTable[i].Number.Visible = false; for (int p = 0; p < _RoundsTable[i].TextPlayer.Count; p++) @@ -524,7 +485,7 @@ namespace VocaluxeLib.PartyModes.Challenge } _Buttons[_ButtonRoundsScrollUp].Visible = _RoundsTableOffset > 0; - _Buttons[_ButtonRoundsScrollDown].Visible = _GameState.Combs.Count - _NumRoundsVisible - _RoundsTableOffset > 0; + _Buttons[_ButtonRoundsScrollDown].Visible = _PartyMode.GameData.Rounds.Count - _NumRoundsVisible - _RoundsTableOffset > 0; } private void _BuildPlayerTable() @@ -532,7 +493,7 @@ namespace VocaluxeLib.PartyModes.Challenge _PlayerTableScrollArea = new SRectF {X = _Texts[_TextPosition].X, Y = _Texts[_TextPosition].Y, W = _Texts[_TextGamePoints].X - _Texts[_TextPosition].X}; _PlayerTable = new List(); - float delta = _Texts[_TextPosition].Height * 1.2f; + float delta = _Texts[_TextPosition].Rect.H * 1.2f; float h = 0; @@ -584,7 +545,7 @@ namespace VocaluxeLib.PartyModes.Challenge { STableRow row = _PlayerTable[i]; - if (i + _PlayerTableOffset < _GameState.ResultTable.Count) + if (i + _PlayerTableOffset < _PartyMode.GameData.ResultTable.Count) { row.Pos.Visible = true; row.Name.Visible = true; @@ -593,12 +554,12 @@ namespace VocaluxeLib.PartyModes.Challenge row.SingPoints.Visible = true; row.GamePoints.Visible = true; - row.Pos.Text = _GameState.ResultTable[i + _PlayerTableOffset].Position + "."; - row.Name.Text = CBase.Profiles.GetPlayerName(_GameState.ResultTable[i + _PlayerTableOffset].PlayerID); - row.Rounds.Text = _GameState.ResultTable[i + _PlayerTableOffset].NumPlayed.ToString(); - row.Won.Text = _GameState.ResultTable[i + _PlayerTableOffset].NumWon.ToString(); - row.SingPoints.Text = _GameState.ResultTable[i + _PlayerTableOffset].NumSingPoints.ToString(); - row.GamePoints.Text = _GameState.ResultTable[i + _PlayerTableOffset].NumGamePoints.ToString(); + row.Pos.Text = _PartyMode.GameData.ResultTable[i + _PlayerTableOffset].Position + "."; + row.Name.Text = CBase.Profiles.GetPlayerName(_PartyMode.GameData.ResultTable[i + _PlayerTableOffset].PlayerID); + row.Rounds.Text = _PartyMode.GameData.ResultTable[i + _PlayerTableOffset].NumPlayed.ToString(); + row.Won.Text = _PartyMode.GameData.ResultTable[i + _PlayerTableOffset].NumWon.ToString(); + row.SingPoints.Text = _PartyMode.GameData.ResultTable[i + _PlayerTableOffset].NumSingPoints.ToString(); + row.GamePoints.Text = _PartyMode.GameData.ResultTable[i + _PlayerTableOffset].NumGamePoints.ToString(); } else { @@ -612,37 +573,37 @@ namespace VocaluxeLib.PartyModes.Challenge } _Buttons[_ButtonPlayerScrollUp].Visible = _PlayerTableOffset > 0; - _Buttons[_ButtonPlayerScrollDown].Visible = _GameState.ProfileIDs.Count - _NumPlayerVisible - _PlayerTableOffset > 0; + _Buttons[_ButtonPlayerScrollDown].Visible = _PartyMode.GameData.ProfileIDs.Count - _NumPlayerVisible - _PlayerTableOffset > 0; } private void _ScrollPlayerTable(int offset) { - if (_GameState.ProfileIDs.Count <= _NumPlayerVisible) + if (_PartyMode.GameData.ProfileIDs.Count <= _NumPlayerVisible) _PlayerTableOffset = 0; else if (offset < 0 && _PlayerTableOffset + offset >= 0) _PlayerTableOffset += offset; else if (offset < 0 && _PlayerTableOffset + offset < 0) _PlayerTableOffset = 0; - else if (offset > 0 && _PlayerTableOffset + offset <= _GameState.ProfileIDs.Count - _NumPlayerVisible) + else if (offset > 0 && _PlayerTableOffset + offset <= _PartyMode.GameData.ProfileIDs.Count - _NumPlayerVisible) _PlayerTableOffset += offset; - else if (offset > 0 && _PlayerTableOffset + offset > _GameState.ProfileIDs.Count - _NumPlayerVisible) - _PlayerTableOffset = _GameState.ProfileIDs.Count - _NumPlayerVisible; + else if (offset > 0 && _PlayerTableOffset + offset > _PartyMode.GameData.ProfileIDs.Count - _NumPlayerVisible) + _PlayerTableOffset = _PartyMode.GameData.ProfileIDs.Count - _NumPlayerVisible; _UpdatePlayerTable(); } private void _ScrollRoundsTable(int offset) { - if (_GameState.Combs.Count <= _NumRoundsVisible) + if (_PartyMode.GameData.Rounds.Count <= _NumRoundsVisible) _RoundsTableOffset = 0; else if (offset < 0 && _RoundsTableOffset + offset >= 0) _RoundsTableOffset += offset; else if (offset < 0 && _RoundsTableOffset + offset < 0) _RoundsTableOffset = 0; - else if (offset > 0 && _RoundsTableOffset + offset <= _GameState.Combs.Count - _NumRoundsVisible) + else if (offset > 0 && _RoundsTableOffset + offset <= _PartyMode.GameData.Rounds.Count - _NumRoundsVisible) _RoundsTableOffset += offset; - else if (offset > 0 && _RoundsTableOffset + offset > _GameState.Combs.Count - _NumRoundsVisible) - _RoundsTableOffset = _GameState.Combs.Count - _NumRoundsVisible; + else if (offset > 0 && _RoundsTableOffset + offset > _PartyMode.GameData.Rounds.Count - _NumRoundsVisible) + _RoundsTableOffset = _PartyMode.GameData.Rounds.Count - _NumRoundsVisible; _UpdateRoundsTable(); } @@ -651,13 +612,13 @@ namespace VocaluxeLib.PartyModes.Challenge { string s = ""; - for (int i = 0; i < _GameState.ResultTable.Count; i++) + for (int i = 0; i < _PartyMode.GameData.ResultTable.Count; i++) { - if (_GameState.ResultTable[i].Position == 1) + if (_PartyMode.GameData.ResultTable[i].Position == 1) { if (i > 0) s += ", "; - s += CBase.Profiles.GetPlayerName(_GameState.ResultTable[i].PlayerID); + s += CBase.Profiles.GetPlayerName(_PartyMode.GameData.ResultTable[i].PlayerID); } else break; diff --git a/PartyModes/PartyModeChallenge/CPartyScreenChallengeNames.cs b/PartyModes/PartyModeChallenge/CPartyScreenChallengeNames.cs index 14b5102c..9b79c0d2 100644 --- a/PartyModes/PartyModeChallenge/CPartyScreenChallengeNames.cs +++ b/PartyModes/PartyModeChallenge/CPartyScreenChallengeNames.cs @@ -15,7 +15,6 @@ // along with Vocaluxe. If not, see . #endregion -using System; using System.Collections.Generic; using VocaluxeLib.Menu; @@ -31,62 +30,38 @@ namespace VocaluxeLib.PartyModes.Challenge get { return 1; } } - private SDataFromScreen _Data; + private new CPartyModeChallenge _PartyMode; public override void Init() { base.Init(); - - _Data.ScreenNames.ProfileIDs = new List(); - _Data = new SDataFromScreen(); - var names = new SFromScreenNames {FadeBack = false, ProfileIDs = new List()}; - _Data.ScreenNames = names; - + _PartyMode = (CPartyModeChallenge)base._PartyMode; _AllowChangePlayerNum = false; } - public override void DataToScreen(object receivedData) - { - try - { - var config = (SDataToScreenNames)receivedData; - _Data.ScreenNames.ProfileIDs = config.ProfileIDs ?? new List(); - - SetPartyModeData(config.NumPlayer); - - while (_Data.ScreenNames.ProfileIDs.Count > _NumPlayer) - _Data.ScreenNames.ProfileIDs.RemoveAt(_Data.ScreenNames.ProfileIDs.Count - 1); - - List[] ids = new List[] {_Data.ScreenNames.ProfileIDs}; - SetPartyModeProfiles(ids); - } - catch (Exception e) - { - CBase.Log.LogError("Error in party mode screen challenge names. Can't cast received data from game mode " + ThemeName + ". " + e.Message); - } - } - public override void OnShow() { base.OnShow(); + SetPartyModeData(_PartyMode.GameData.NumPlayer); + while (_PartyMode.GameData.ProfileIDs.Count > _NumPlayer) + _PartyMode.GameData.ProfileIDs.RemoveAt(_PartyMode.GameData.ProfileIDs.Count - 1); + + List[] ids = new List[] {_PartyMode.GameData.ProfileIDs}; + SetPartyModeProfiles(ids); } public override void Back() { - SPartyNameOptions options = GetData(); - if (options.TeamList.Length == 1) - _Data.ScreenNames.ProfileIDs = options.TeamList[0]; - _Data.ScreenNames.FadeBack = true; - _PartyMode.DataFromScreen(ThemeName, _Data); + if (_TeamList.Length == 1) + _PartyMode.GameData.ProfileIDs = _TeamList[0]; + _PartyMode.Back(); } public override void Next() { - SPartyNameOptions options = GetData(); - if (options.TeamList.Length == 1) - _Data.ScreenNames.ProfileIDs = options.TeamList[0]; - _Data.ScreenNames.FadeBack = false; - _PartyMode.DataFromScreen(ThemeName, _Data); + if (_TeamList.Length == 1) + _PartyMode.GameData.ProfileIDs = _TeamList[0]; + _PartyMode.Next(); } } } \ No newline at end of file diff --git a/PartyModes/PartyModeChallengeMedley/CChallengeRounds.cs b/PartyModes/PartyModeChallengeMedley/CChallengeRounds.cs index 3b7f00a8..01b6068e 100644 --- a/PartyModes/PartyModeChallengeMedley/CChallengeRounds.cs +++ b/PartyModes/PartyModeChallengeMedley/CChallengeRounds.cs @@ -28,6 +28,16 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley public readonly List Rounds; + public int Count + { + get { return Rounds.Count; } + } + + public CCombination this[int index] + { + get { return Rounds[index]; } + } + public CChallengeRounds(int numRounds, int numPlayer, int numPlayerAtOnce) { Rounds = new List(); @@ -59,7 +69,7 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley Rounds.Add(combinations.GetNextCombination(_GetPlayerDemand(i))); } - private List _GetPlayerDemand(int roundIndex) + private IEnumerable _GetPlayerDemand(int roundIndex) { List numPlayed = new List(_NumPlayer); for (int i = 0; i < _NumPlayer; i++) diff --git a/PartyModes/PartyModeChallengeMedley/CPartyModeChallengeMedley.cs b/PartyModes/PartyModeChallengeMedley/CPartyModeChallengeMedley.cs index c6f0d619..ec9429f9 100644 --- a/PartyModes/PartyModeChallengeMedley/CPartyModeChallengeMedley.cs +++ b/PartyModes/PartyModeChallengeMedley/CPartyModeChallengeMedley.cs @@ -18,43 +18,17 @@ using System; using System.Collections.Generic; using System.Collections.ObjectModel; +using System.Linq; using System.Runtime.InteropServices; using VocaluxeLib.Game; using VocaluxeLib.Menu; -using VocaluxeLib.Songs; using VocaluxeLib.Profile; +using VocaluxeLib.Songs; [assembly: ComVisible(false)] namespace VocaluxeLib.PartyModes.ChallengeMedley { - - #region Communication - - #region ToScreen - public struct SDataToScreenConfig - { - public int NumPlayer; - public int NumPlayerAtOnce; - public int NumRounds; - } - - public struct SDataToScreenNames - { - public int NumPlayer; - public List ProfileIDs; - } - - public struct SDataToScreenMain - { - public int CurrentRoundNr; - public int NumPlayerAtOnce; - public List Combs; - public int[,] Results; - public List ResultTable; - public List ProfileIDs; - } - public class CResultTableRow : IComparable { public int Position; @@ -66,7 +40,7 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley public int CompareTo(object obj) { - CResultTableRow row = obj as CResultTableRow; + var row = obj as CResultTableRow; if (row != null) { int res = row.NumGamePoints.CompareTo(NumGamePoints); @@ -82,39 +56,21 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley throw new ArgumentException("object is not a ResultTableRow"); } } - #endregion ToScreen - #region FromScreen - public struct SDataFromScreen + public abstract class CPartyScreenChallengeMedley : CMenuParty { - public SFromScreenConfig ScreenConfig; - public SFromScreenNames ScreenNames; - public SFromScreenMain ScreenMain; + protected new CPartyModeChallengeMedley _PartyMode; + + public override void Init() + { + base.Init(); + _PartyMode = (CPartyModeChallengeMedley)base._PartyMode; + } } - public struct SFromScreenConfig - { - public int NumPlayer; - public int NumPlayerAtOnce; - public int NumRounds; - } - - public struct SFromScreenNames - { - public bool FadeToConfig; - public List ProfileIDs; - } - - public struct SFromScreenMain - { - public bool FadeToSongSelection; - public bool FadeToNameSelection; - } - #endregion FromScreen - - #endregion Communication - + // ReSharper disable ClassNeverInstantiated.Global public sealed class CPartyModeChallengeMedley : CPartyMode + // ReSharper restore ClassNeverInstantiated.Global { private const int _MaxPlayer = 12; private const int _MinPlayer = 1; @@ -125,14 +81,13 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley private enum EStage { - NotStarted, Config, Names, Main, Singing } - private struct SData + public struct SData { public int NumPlayer; public int NumPlayerAtOnce; @@ -156,14 +111,10 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley public int Won; } - private SDataToScreenConfig _ToScreenConfig; - private SDataToScreenNames _ToScreenNames; - private SDataToScreenMain _ToScreenMain; - - private SData _GameData; + public SData GameData; private EStage _Stage; - public CPartyModeChallengeMedley() + public CPartyModeChallengeMedley(int id, string folder) : base(id, folder) { _ScreenSongOptions.Selection.RandomOnly = false; _ScreenSongOptions.Selection.PartyMode = true; @@ -175,103 +126,26 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley _ScreenSongOptions.Sorting.SearchActive = false; _ScreenSongOptions.Sorting.DuetOptions = EDuetOptions.NoDuets; - _Stage = EStage.NotStarted; - - _ToScreenConfig = new SDataToScreenConfig(); - _ToScreenNames = new SDataToScreenNames(); - _ToScreenMain = new SDataToScreenMain(); - - _GameData = new SData {NumPlayer = 4, NumPlayerAtOnce = 2, NumRounds = 2, CurrentRoundNr = 1, ProfileIDs = new List(), CatSongIndices = null, Results = null}; + GameData = new SData {NumPlayer = 4, NumPlayerAtOnce = 2, NumRounds = 12, CurrentRoundNr = 1, ProfileIDs = new List(), CatSongIndices = null, Results = null}; } public override bool Init() { - _Stage = EStage.NotStarted; + _Stage = EStage.Config; _ScreenSongOptions.Sorting.IgnoreArticles = EOffOn.TR_CONFIG_OFF; _ScreenSongOptions.Sorting.SongSorting = ESongSorting.TR_CONFIG_NONE; _ScreenSongOptions.Sorting.Tabs = EOffOn.TR_CONFIG_OFF; _ScreenSongOptions.Selection.SongIndex = -1; - _ToScreenMain.ResultTable = new List(); - _GameData.ResultTable = new List(); - CBase.Songs.SortSongs(ESongSorting.TR_CONFIG_NONE, EOffOn.TR_CONFIG_OFF, EOffOn.TR_CONFIG_OFF, String.Empty, EDuetOptions.NoDuets); CBase.Songs.SetCategory(0); + GameData.ResultTable = new List(); + return true; } - public override void DataFromScreen(string screenName, Object data) - { - SDataFromScreen dataFrom; - switch (screenName) - { - case "PartyScreenChallengeMedleyConfig": - - try - { - dataFrom = (SDataFromScreen)data; - _GameData.NumPlayer = dataFrom.ScreenConfig.NumPlayer; - _GameData.NumPlayerAtOnce = dataFrom.ScreenConfig.NumPlayerAtOnce; - _GameData.NumRounds = dataFrom.ScreenConfig.NumRounds; - - _Stage = EStage.Config; - CBase.Graphics.FadeTo(EScreens.ScreenPartyDummy); - } - catch (Exception e) - { - CBase.Log.LogError("Error in party mode challenge. Can't cast received data from screen " + screenName + ". " + e.Message); - } - break; - - case "PartyScreenChallengeMedleyNames": - try - { - dataFrom = (SDataFromScreen)data; - if (dataFrom.ScreenNames.FadeToConfig) - _Stage = EStage.NotStarted; - else - { - _GameData.ProfileIDs = dataFrom.ScreenNames.ProfileIDs; - _Stage = EStage.Names; - } - - CBase.Graphics.FadeTo(EScreens.ScreenPartyDummy); - } - catch (Exception e) - { - CBase.Log.LogError("Error in party mode challenge. Can't cast received data from screen " + screenName + ". " + e.Message); - } - break; - - case "PartyScreenChallengeMedleyMain": - try - { - dataFrom = (SDataFromScreen)data; - if (dataFrom.ScreenMain.FadeToSongSelection) - _Stage = EStage.Singing; - if (dataFrom.ScreenMain.FadeToNameSelection) - _Stage = EStage.Config; - } - catch (Exception e) - { - CBase.Log.LogError("Error in party mode challenge. Can't cast received data from screen " + screenName + ". " + e.Message); - } - - - if (_Stage == EStage.Singing) - _StartNextRound(); - if (_Stage == EStage.Config) - CBase.Graphics.FadeTo(EScreens.ScreenPartyDummy); - break; - - default: - CBase.Log.LogError("Error in party mode challenge. Wrong screen is sending: " + screenName); - break; - } - } - public override void UpdateGame() { /* @@ -281,78 +155,79 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley _ScreenSongOptions.Selection.RandomOnly = false;*/ } - public override CMenuParty GetNextPartyScreen(out EScreens alternativeScreen) + private IMenu _GetNextScreen() { - CMenuParty screen = null; - alternativeScreen = EScreens.ScreenSong; - switch (_Stage) { - case EStage.NotStarted: - _Screens.TryGetValue("CPartyScreenChallengeMedleyConfig", out screen); - if (screen != null) - { - _ToScreenConfig.NumPlayer = _GameData.NumPlayer; - _ToScreenConfig.NumPlayerAtOnce = _GameData.NumPlayerAtOnce; - _ToScreenConfig.NumRounds = _GameData.NumRounds; - screen.DataToScreen(_ToScreenConfig); - } - break; case EStage.Config: - _Screens.TryGetValue("CPartyScreenChallengeMedleyNames", out screen); - if (screen != null) - { - _ToScreenNames.NumPlayer = _GameData.NumPlayer; - _ToScreenNames.ProfileIDs = _GameData.ProfileIDs; - screen.DataToScreen(_ToScreenNames); - } + return _Screens["CPartyScreenChallengeMedleyConfig"]; + case EStage.Names: + return _Screens["CPartyScreenChallengeMedleyNames"]; + case EStage.Main: + return _Screens["CPartyScreenChallengeMedleyMain"]; + case EStage.Singing: + return CBase.Graphics.GetScreen(EScreen.Song); + default: + throw new ArgumentException("Invalid stage: " + _Stage); + } + } + + private void _FadeToScreen() + { + CBase.Graphics.FadeTo(_GetNextScreen()); + } + + public void Next() + { + switch (_Stage) + { + case EStage.Config: + _Stage = EStage.Names; break; case EStage.Names: - _Screens.TryGetValue("CPartyScreenChallengeMedleyMain", out screen); - if (screen != null) - { - CBase.Songs.ResetSongSung(); - _ToScreenMain.ResultTable = new List(); - _GameData.ResultTable = new List(); - _GameData.Rounds = new CChallengeRounds(_GameData.NumRounds, _GameData.NumPlayer, _GameData.NumPlayerAtOnce); - _GameData.CurrentRoundNr = 1; - _ToScreenMain.CurrentRoundNr = 1; - _ToScreenMain.NumPlayerAtOnce = _GameData.NumPlayerAtOnce; - _ToScreenMain.Combs = _GameData.Rounds.Rounds; - _ToScreenMain.ProfileIDs = _GameData.ProfileIDs; - _UpdateScores(); - _ToScreenMain.ResultTable = _GameData.ResultTable; - _ToScreenMain.Results = _GameData.Results; - screen.DataToScreen(_ToScreenMain); - } + _Stage = EStage.Main; + CBase.Songs.ResetSongSung(); + GameData.ResultTable = new List(); + GameData.Rounds = new CChallengeRounds(GameData.NumRounds, GameData.NumPlayer, GameData.NumPlayerAtOnce); + GameData.CurrentRoundNr = 1; break; case EStage.Main: - //nothing to do + _Stage = EStage.Singing; + if (!_StartNextRound()) + CBase.Graphics.FadeTo(EScreen.Party); break; case EStage.Singing: - _Screens.TryGetValue("CPartyScreenChallengeMedleyMain", out screen); - if (screen != null) - { - _UpdateScores(); - _ToScreenMain.CurrentRoundNr = _GameData.CurrentRoundNr; - _ToScreenMain.Combs = _GameData.Rounds.Rounds; - _ToScreenMain.Results = _GameData.Results; - screen.DataToScreen(_ToScreenMain); - } + _Stage = EStage.Main; + _UpdateScores(); break; + default: + throw new ArgumentException("Invalid stage: " + _Stage); } - - return screen; + _FadeToScreen(); } - public override EScreens GetStartScreen() + public void Back() { - return EScreens.ScreenPartyDummy; + switch (_Stage) + { + case EStage.Config: + CBase.Graphics.FadeTo(EScreen.Party); + return; + case EStage.Names: + _Stage = EStage.Config; + break; + case EStage.Main: + _Stage = EStage.Names; + break; + default: // Rest is not allowed + throw new ArgumentException("Invalid stage: " + _Stage); + } + _FadeToScreen(); } - public override EScreens GetMainScreen() + public override IMenu GetStartScreen() { - return EScreens.ScreenPartyDummy; + return _Screens["CPartyScreenChallengeMedleyConfig"]; } public override SScreenSongOptions GetScreenSongOptions() @@ -375,10 +250,10 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley _ScreenSongOptions.Selection.SelectNextRandomSong = false; _CreateCatSongIndices(); - if (_GameData.CatSongIndices != null) + if (GameData.CatSongIndices != null) { - if (_GameData.CatSongIndices[CBase.Songs.GetCurrentCategoryIndex()] == -1) - _GameData.CatSongIndices[CBase.Songs.GetCurrentCategoryIndex()] = songIndex; + if (GameData.CatSongIndices[CBase.Songs.GetCurrentCategoryIndex()] == -1) + GameData.CatSongIndices[CBase.Songs.GetCurrentCategoryIndex()] = songIndex; } } @@ -389,15 +264,15 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley public override void OnCategoryChange(int categoryIndex, ref SScreenSongOptions screenSongOptions) // ReSharper restore RedundantAssignment { - if (_GameData.CatSongIndices != null && categoryIndex != -1) + if (GameData.CatSongIndices != null && categoryIndex != -1) { - if (_GameData.CatSongIndices[categoryIndex] == -1) + if (GameData.CatSongIndices[categoryIndex] == -1) _ScreenSongOptions.Selection.SelectNextRandomSong = true; else - _ScreenSongOptions.Selection.SongIndex = _GameData.CatSongIndices[categoryIndex]; + _ScreenSongOptions.Selection.SongIndex = GameData.CatSongIndices[categoryIndex]; } - if (_GameData.CatSongIndices == null && categoryIndex != -1) + if (GameData.CatSongIndices == null && categoryIndex != -1) _ScreenSongOptions.Selection.SelectNextRandomSong = true; if (categoryIndex == -1) @@ -457,22 +332,19 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley public override void LeavingHighscore() { - for (int i = 0; i < CBase.Game.GetNumSongs();i++ ) - CBase.Songs.AddPartySongSung(CBase.Game.GetSong(i).ID); - _GameData.CurrentRoundNr++; - CBase.Graphics.FadeTo(EScreens.ScreenPartyDummy); + GameData.CurrentRoundNr++; + Next(); } - private void _StartNextRound() + private bool _StartNextRound() { _ScreenSongOptions.Selection.RandomOnly = _ScreenSongOptions.Sorting.Tabs != EOffOn.TR_CONFIG_ON; _ScreenSongOptions.Selection.CategoryChangeAllowed = _ScreenSongOptions.Sorting.Tabs == EOffOn.TR_CONFIG_ON; _SetNumJokers(); _SetTeamNames(); - _GameData.CatSongIndices = null; + GameData.CatSongIndices = null; - if (_RandomizeSongs()) - CBase.Graphics.FadeTo(EScreens.ScreenSing); + return _RandomizeSongs(); } private bool _RandomizeSongs() @@ -481,27 +353,27 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley CBase.Game.ClearSongs(); #region PlayerNames - CBase.Game.SetNumPlayer(_GameData.NumPlayerAtOnce); + CBase.Game.SetNumPlayer(GameData.NumPlayerAtOnce); SPlayer[] players = CBase.Game.GetPlayers(); if (players == null) return false; - if (players.Length < _GameData.NumPlayerAtOnce) + if (players.Length < GameData.NumPlayerAtOnce) return false; - CCombination c = _GameData.Rounds.GetRound(_GameData.CurrentRoundNr - 1); + CCombination c = GameData.Rounds.GetRound(GameData.CurrentRoundNr - 1); - for (int i = 0; i < _GameData.NumPlayerAtOnce; i++) + for (int i = 0; i < GameData.NumPlayerAtOnce; i++) { //try to fill with the right data if (c != null) - players[i].ProfileID = _GameData.ProfileIDs[c.Player[i]]; + players[i].ProfileID = GameData.ProfileIDs[c.Player[i]]; else players[i].ProfileID = -1; } #endregion PlayerNames - #region SongQueue + #region SongQueue if (CBase.Songs.GetNumSongsVisible() < _NumSongs) CBase.Songs.ResetSongSung(); @@ -511,14 +383,11 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley if (visibleSongs.Count == 0) { CBase.Log.LogError("CPartyChallengeMedleyMode Error: There are no songs!"); - CBase.Graphics.FadeTo(EScreens.ScreenParty); return false; } //Calc avarage sing-count - int totalCounts = 0; - foreach (CSong song in visibleSongs) - totalCounts += song.NumPlayedSession; + int totalCounts = visibleSongs.Sum(song => song.NumPlayedSession); int averageCount = totalCounts / visibleSongs.Count; // ReSharper disable LoopCanBeConvertedToQuery @@ -535,7 +404,6 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley if (ids.Count == 0) { CBase.Log.LogError("CPartyChallengeMedleyMode Error: There are no medley songs!"); - CBase.Graphics.FadeTo(EScreens.ScreenParty); return false; } @@ -544,6 +412,7 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley { int songID = ids[CBase.Game.GetRandom(ids.Count)]; CBase.Game.AddSong(songID, EGameMode.TR_GAMEMODE_MEDLEY); + CBase.Songs.AddPartySongSung(songID); ids.Remove(songID); s++; } @@ -553,7 +422,7 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley private void _SetNumJokers() { - switch (_GameData.NumPlayerAtOnce) + switch (GameData.NumPlayerAtOnce) { case 1: _ScreenSongOptions.Selection.NumJokers = new int[] {10}; @@ -594,21 +463,21 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley return; } - if (_GameData.NumPlayerAtOnce < 1 || _GameData.ProfileIDs.Count < _GameData.NumPlayerAtOnce || profiles.Length < _GameData.NumPlayerAtOnce) + if (GameData.NumPlayerAtOnce < 1 || GameData.ProfileIDs.Count < GameData.NumPlayerAtOnce || profiles.Length < GameData.NumPlayerAtOnce) { _ScreenSongOptions.Selection.TeamNames = new string[] {"foo", "bar"}; return; } - _ScreenSongOptions.Selection.TeamNames = new string[_GameData.NumPlayerAtOnce]; - CCombination c = _GameData.Rounds.GetRound(_GameData.CurrentRoundNr - 1); + _ScreenSongOptions.Selection.TeamNames = new string[GameData.NumPlayerAtOnce]; + CCombination c = GameData.Rounds.GetRound(GameData.CurrentRoundNr - 1); - for (int i = 0; i < _GameData.NumPlayerAtOnce; i++) + for (int i = 0; i < GameData.NumPlayerAtOnce; i++) { if (c != null) { - if (_GameData.ProfileIDs[c.Player[i]] < profiles.Length) - _ScreenSongOptions.Selection.TeamNames[i] = profiles[_GameData.ProfileIDs[c.Player[i]]].PlayerName; + if (GameData.ProfileIDs[c.Player[i]] < profiles.Length) + _ScreenSongOptions.Selection.TeamNames[i] = profiles[GameData.ProfileIDs[c.Player[i]]].PlayerName; else _ScreenSongOptions.Selection.TeamNames[i] = "foobar"; } @@ -619,32 +488,32 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley private void _UpdateScores() { - if (_GameData.ResultTable.Count == 0) + if (GameData.ResultTable.Count == 0) { - for (int i = 0; i < _GameData.NumPlayer; i++) + for (int i = 0; i < GameData.NumPlayer; i++) { - CResultTableRow row = new CResultTableRow {PlayerID = _GameData.ProfileIDs[i], NumPlayed = 0, NumWon = 0, NumSingPoints = 0, NumGamePoints = 0}; - _GameData.ResultTable.Add(row); + CResultTableRow row = new CResultTableRow {PlayerID = GameData.ProfileIDs[i], NumPlayed = 0, NumWon = 0, NumSingPoints = 0, NumGamePoints = 0}; + GameData.ResultTable.Add(row); } - _GameData.Results = new int[_GameData.NumRounds,_GameData.NumPlayerAtOnce]; - for (int i = 0; i < _GameData.NumRounds; i++) + GameData.Results = new int[GameData.NumRounds,GameData.NumPlayerAtOnce]; + for (int i = 0; i < GameData.NumRounds; i++) { - for (int j = 0; j < _GameData.NumPlayerAtOnce; j++) - _GameData.Results[i, j] = 0; + for (int j = 0; j < GameData.NumPlayerAtOnce; j++) + GameData.Results[i, j] = 0; } } else { CPoints gamePoints = CBase.Game.GetPoints(); - if (gamePoints == null || gamePoints.NumPlayer < _GameData.NumPlayerAtOnce) + if (gamePoints == null || gamePoints.NumPlayer < GameData.NumPlayerAtOnce) return; - SPlayer[] results = gamePoints.GetPlayer(0, _GameData.NumPlayerAtOnce); + SPlayer[] results = gamePoints.GetPlayer(0, GameData.NumPlayerAtOnce); if (results == null) return; - if (results.Length < _GameData.NumPlayerAtOnce) + if (results.Length < GameData.NumPlayerAtOnce) return; if (gamePoints.NumRounds == 0) @@ -652,25 +521,25 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley for (int i = 1; i < gamePoints.NumRounds; i++) { - SPlayer[] temp = gamePoints.GetPlayer(i, _GameData.NumPlayerAtOnce); - for (int p = 0; p < _GameData.NumPlayerAtOnce; p++) + SPlayer[] temp = gamePoints.GetPlayer(i, GameData.NumPlayerAtOnce); + for (int p = 0; p < GameData.NumPlayerAtOnce; p++) results[p].Points += temp[p].Points; } - for (int j = 0; j < _GameData.NumPlayerAtOnce; j++) + for (int j = 0; j < GameData.NumPlayerAtOnce; j++) { results[j].Points = results[j].Points / gamePoints.NumRounds; - _GameData.Results[_GameData.CurrentRoundNr - 2, j] = (int)Math.Round(results[j].Points); + GameData.Results[GameData.CurrentRoundNr - 2, j] = (int)Math.Round(results[j].Points); } List points = _GetPointsForPlayer(results); - for (int i = 0; i < _GameData.NumPlayerAtOnce; i++) + for (int i = 0; i < GameData.NumPlayerAtOnce; i++) { int index = -1; - for (int j = 0; j < _GameData.ResultTable.Count; j++) + for (int j = 0; j < GameData.ResultTable.Count; j++) { - if (points[i].ProfileID == _GameData.ResultTable[j].PlayerID) + if (points[i].ProfileID == GameData.ResultTable[j].PlayerID) { index = j; break; @@ -679,25 +548,25 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley if (index != -1) { - CResultTableRow row = _GameData.ResultTable[index]; + CResultTableRow row = GameData.ResultTable[index]; row.NumPlayed++; row.NumWon += points[i].Won; row.NumSingPoints += points[i].SingPoints; row.NumGamePoints += points[i].GamePoints; - _GameData.ResultTable[index] = row; + GameData.ResultTable[index] = row; } } } - _GameData.ResultTable.Sort(); + GameData.ResultTable.Sort(); //Update position-number int pos = 1; int lastPoints = 0; int lastSingPoints = 0; - foreach (CResultTableRow resultRow in _GameData.ResultTable) + foreach (CResultTableRow resultRow in GameData.ResultTable) { if (lastPoints > resultRow.NumGamePoints || lastSingPoints > resultRow.NumSingPoints) pos++; @@ -709,10 +578,10 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley private List _GetPointsForPlayer(SPlayer[] results) { - List result = new List(); - for (int i = 0; i < _GameData.NumPlayerAtOnce; i++) + var result = new List(); + for (int i = 0; i < GameData.NumPlayerAtOnce; i++) { - SStats stat = new SStats {ProfileID = results[i].ProfileID, SingPoints = (int)Math.Round(results[i].Points), Won = 0, GamePoints = 0}; + var stat = new SStats {ProfileID = results[i].ProfileID, SingPoints = (int)Math.Round(results[i].Points), Won = 0, GamePoints = 0}; result.Add(stat); } @@ -758,15 +627,15 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley private void _CreateCatSongIndices() { - if (_GameData.CatSongIndices == null && CBase.Songs.GetNumCategories() > 0 && _ScreenSongOptions.Sorting.Tabs == EOffOn.TR_CONFIG_ON) + if (GameData.CatSongIndices == null && CBase.Songs.GetNumCategories() > 0 && _ScreenSongOptions.Sorting.Tabs == EOffOn.TR_CONFIG_ON) { - _GameData.CatSongIndices = new int[CBase.Songs.GetNumCategories()]; - for (int i = 0; i < _GameData.CatSongIndices.Length; i++) - _GameData.CatSongIndices[i] = -1; + GameData.CatSongIndices = new int[CBase.Songs.GetNumCategories()]; + for (int i = 0; i < GameData.CatSongIndices.Length; i++) + GameData.CatSongIndices[i] = -1; } if (CBase.Songs.GetNumCategories() == 0 || _ScreenSongOptions.Sorting.Tabs == EOffOn.TR_CONFIG_OFF) - _GameData.CatSongIndices = null; + GameData.CatSongIndices = null; } } } \ No newline at end of file diff --git a/PartyModes/PartyModeChallengeMedley/CPartyScreenChallengeMedleyConfig.cs b/PartyModes/PartyModeChallengeMedley/CPartyScreenChallengeMedleyConfig.cs index b39c7052..2174939b 100644 --- a/PartyModes/PartyModeChallengeMedley/CPartyScreenChallengeMedleyConfig.cs +++ b/PartyModes/PartyModeChallengeMedley/CPartyScreenChallengeMedleyConfig.cs @@ -15,14 +15,12 @@ // along with Vocaluxe. If not, see . #endregion -using System; using System.Windows.Forms; -using VocaluxeLib.Menu; namespace VocaluxeLib.PartyModes.ChallengeMedley { // ReSharper disable UnusedMember.Global - public class CPartyScreenChallengeMedleyConfig : CMenuParty + public class CPartyScreenChallengeMedleyConfig : CPartyScreenChallengeMedley // ReSharper restore UnusedMember.Global { // Version number for theme files. Increment it, if you've changed something on the theme files! @@ -41,33 +39,12 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley private int _MaxNumRounds = 100; private int _RoundSteps = 1; - private SDataFromScreen _Data; - public override void Init() { base.Init(); _ThemeSelectSlides = new string[] {_SelectSlideNumPlayers, _SelectSlideNumMics, _SelectSlideNumRounds}; _ThemeButtons = new string[] {_ButtonNext, _ButtonBack}; - - _Data = new SDataFromScreen(); - SFromScreenConfig config = new SFromScreenConfig {NumPlayer = 4, NumPlayerAtOnce = 2, NumRounds = 12}; - _Data.ScreenConfig = config; - } - - public override void DataToScreen(object receivedData) - { - try - { - SDataToScreenConfig config = (SDataToScreenConfig)receivedData; - _Data.ScreenConfig.NumPlayer = config.NumPlayer; - _Data.ScreenConfig.NumPlayerAtOnce = config.NumPlayerAtOnce; - _Data.ScreenConfig.NumRounds = config.NumRounds; - } - catch (Exception e) - { - CBase.Log.LogError("Error in party mode screen challenge config. Can't cast received data from game mode " + ThemeName + ". " + e.Message); - } } public override bool HandleInput(SKeyEvent keyEvent) @@ -81,17 +58,17 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley { case Keys.Back: case Keys.Escape: - _Back(); + _PartyMode.Back(); break; case Keys.Enter: _UpdateSlides(); if (_Buttons[_ButtonBack].Selected) - _Back(); + _PartyMode.Back(); if (_Buttons[_ButtonNext].Selected) - _Next(); + _PartyMode.Next(); break; case Keys.Left: @@ -110,18 +87,18 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley { base.HandleMouse(mouseEvent); - if (mouseEvent.LB && _IsMouseOver(mouseEvent)) + if (mouseEvent.LB && _IsMouseOverCurSelection(mouseEvent)) { _UpdateSlides(); if (_Buttons[_ButtonBack].Selected) - _Back(); + _PartyMode.Back(); if (_Buttons[_ButtonNext].Selected) - _Next(); + _PartyMode.Next(); } if (mouseEvent.RB) - _Back(); + _PartyMode.Back(); return true; } @@ -144,19 +121,13 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley return true; } - public override bool Draw() - { - base.Draw(); - return true; - } - private void _RebuildSlides() { // build num player slide (min player ... max player); _SelectSlides[_SelectSlideNumPlayers].Clear(); for (int i = _PartyMode.GetMinPlayer(); i <= _PartyMode.GetMaxPlayer(); i++) _SelectSlides[_SelectSlideNumPlayers].AddValue(i.ToString()); - _SelectSlides[_SelectSlideNumPlayers].Selection = _Data.ScreenConfig.NumPlayer - _PartyMode.GetMinPlayer(); + _SelectSlides[_SelectSlideNumPlayers].Selection = _PartyMode.GameData.NumPlayer - _PartyMode.GetMinPlayer(); _UpdateMicsAtOnce(); _SetRoundSteps(); @@ -165,21 +136,21 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley private void _UpdateSlides() { - int player = _Data.ScreenConfig.NumPlayer; - int mics = _Data.ScreenConfig.NumPlayerAtOnce; - _Data.ScreenConfig.NumPlayer = _SelectSlides[_SelectSlideNumPlayers].Selection + _PartyMode.GetMinPlayer(); - _Data.ScreenConfig.NumPlayerAtOnce = _SelectSlides[_SelectSlideNumMics].Selection + _PartyMode.GetMinPlayer(); - _Data.ScreenConfig.NumRounds = (_SelectSlides[_SelectSlideNumRounds].Selection + 1) * _RoundSteps; + int player = _PartyMode.GameData.NumPlayer; + int mics = _PartyMode.GameData.NumPlayerAtOnce; + _PartyMode.GameData.NumPlayer = _SelectSlides[_SelectSlideNumPlayers].Selection + _PartyMode.GetMinPlayer(); + _PartyMode.GameData.NumPlayerAtOnce = _SelectSlides[_SelectSlideNumMics].Selection + _PartyMode.GetMinPlayer(); + _PartyMode.GameData.NumRounds = (_SelectSlides[_SelectSlideNumRounds].Selection + 1) * _RoundSteps; _UpdateMicsAtOnce(); _SetRoundSteps(); - if (player != _Data.ScreenConfig.NumPlayer || mics != _Data.ScreenConfig.NumPlayerAtOnce) + if (player != _PartyMode.GameData.NumPlayer || mics != _PartyMode.GameData.NumPlayerAtOnce) { - int num = CHelper.CombinationCount(_Data.ScreenConfig.NumPlayer, _Data.ScreenConfig.NumPlayerAtOnce); + int num = CHelper.CombinationCount(_PartyMode.GameData.NumPlayer, _PartyMode.GameData.NumPlayerAtOnce); while (num > _MaxNumRounds) num -= _RoundSteps; - _Data.ScreenConfig.NumRounds = num; + _PartyMode.GameData.NumRounds = num; } _UpdateSlideRounds(); @@ -187,19 +158,18 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley private void _UpdateMicsAtOnce() { - //Data.ScreenConfig.NumPlayerAtOnce int maxNum = _MaxNumMics; - if (_Data.ScreenConfig.NumPlayer < _MaxNumMics) - maxNum = _Data.ScreenConfig.NumPlayer; + if (_PartyMode.GameData.NumPlayer < _MaxNumMics) + maxNum = _PartyMode.GameData.NumPlayer; - if (_Data.ScreenConfig.NumPlayerAtOnce > maxNum) - _Data.ScreenConfig.NumPlayerAtOnce = maxNum; + if (_PartyMode.GameData.NumPlayerAtOnce > maxNum) + _PartyMode.GameData.NumPlayerAtOnce = maxNum; // build mics at once slide _SelectSlides[_SelectSlideNumMics].Clear(); for (int i = 1; i <= maxNum; i++) _SelectSlides[_SelectSlideNumMics].AddValue(i.ToString()); - _SelectSlides[_SelectSlideNumMics].Selection = _Data.ScreenConfig.NumPlayerAtOnce - _PartyMode.GetMinPlayer(); + _SelectSlides[_SelectSlideNumMics].Selection = _PartyMode.GameData.NumPlayerAtOnce - _PartyMode.GetMinPlayer(); } private void _UpdateSlideRounds() @@ -208,31 +178,21 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley _SelectSlides[_SelectSlideNumRounds].Clear(); for (int i = _RoundSteps; i <= _MaxNumRounds; i += _RoundSteps) _SelectSlides[_SelectSlideNumRounds].AddValue(i.ToString()); - _SelectSlides[_SelectSlideNumRounds].Selection = _Data.ScreenConfig.NumRounds / _RoundSteps - 1; + _SelectSlides[_SelectSlideNumRounds].Selection = _PartyMode.GameData.NumRounds / _RoundSteps - 1; } private void _SetRoundSteps() { - if (_Data.ScreenConfig.NumPlayerAtOnce < 1 || _Data.ScreenConfig.NumPlayer < 1 || _Data.ScreenConfig.NumPlayerAtOnce > _Data.ScreenConfig.NumPlayer) + if (_PartyMode.GameData.NumPlayerAtOnce < 1 || _PartyMode.GameData.NumPlayer < 1 || _PartyMode.GameData.NumPlayerAtOnce > _PartyMode.GameData.NumPlayer) { _RoundSteps = 1; return; } - int res = _Data.ScreenConfig.NumPlayer / _Data.ScreenConfig.NumPlayerAtOnce; - int mod = _Data.ScreenConfig.NumPlayer % _Data.ScreenConfig.NumPlayerAtOnce; + int res = _PartyMode.GameData.NumPlayer / _PartyMode.GameData.NumPlayerAtOnce; + int mod = _PartyMode.GameData.NumPlayer % _PartyMode.GameData.NumPlayerAtOnce; - _RoundSteps = mod == 0 ? res : _Data.ScreenConfig.NumPlayer; - } - - private void _Back() - { - _FadeTo(EScreens.ScreenParty); - } - - private void _Next() - { - _PartyMode.DataFromScreen(ThemeName, _Data); + _RoundSteps = mod == 0 ? res : _PartyMode.GameData.NumPlayer; } } } \ No newline at end of file diff --git a/PartyModes/PartyModeChallengeMedley/CPartyScreenChallengeMedleyMain.cs b/PartyModes/PartyModeChallengeMedley/CPartyScreenChallengeMedleyMain.cs index 47dcb43c..84831c23 100644 --- a/PartyModes/PartyModeChallengeMedley/CPartyScreenChallengeMedleyMain.cs +++ b/PartyModes/PartyModeChallengeMedley/CPartyScreenChallengeMedleyMain.cs @@ -40,7 +40,7 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley } // ReSharper disable UnusedMember.Global - public class CPartyScreenChallengeMedleyMain : CMenuParty + public class CPartyScreenChallengeMedleyMain : CPartyScreenChallengeMedley // ReSharper restore UnusedMember.Global { // Version number for theme files. Increment it, if you've changed something on the theme files! @@ -79,8 +79,6 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley private bool _ExitPopupVisible; - private SDataFromScreen _Data; - private SDataToScreenMain _GameState; private List _PlayerTable; private List _RoundsTable; @@ -94,11 +92,6 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley private const int _NumPlayerVisible = 10; private int _NumRoundsVisible = 3; - public CPartyScreenChallengeMedleyMain() - { - _Data = new SDataFromScreen {ScreenMain = new SFromScreenMain()}; - } - public override void Init() { base.Init(); @@ -121,7 +114,6 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley { base.LoadTheme(xmlPath); - _GameState = new SDataToScreenMain(); _BuildPlayerTable(); _CreateRoundsTable(); _NextPlayerTexts = new List(); @@ -134,19 +126,7 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley _NextPlayerStatics.Add(GetNewStatic(_Statics[_StaticNextPlayer])); _AddStatic(_NextPlayerStatics[_NextPlayerStatics.Count - 1]); } - } - - public override void DataToScreen(object receivedData) - { - try - { - var data = (SDataToScreenMain)receivedData; - _GameState = data; - } - catch (Exception e) - { - CBase.Log.LogError("Error in party mode screen challenge main. Can't cast received data from game mode " + ThemeName + ". " + e.Message); - } + _Statics[_StaticNextPlayer].Visible = false; } public override bool HandleInput(SKeyEvent keyEvent) @@ -162,8 +142,8 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley case Keys.Escape: if (!_ExitPopupVisible) { - if (_GameState.CurrentRoundNr == 1) - _Back(); + if (_PartyMode.GameData.CurrentRoundNr == 1) + _PartyMode.Back(); else _ShowPopup(true); } @@ -175,10 +155,10 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley if (!_ExitPopupVisible) { if (_Buttons[_ButtonNextRound].Selected) - _NextRound(); - if (_Buttons[_ButtonBack].Selected && _GameState.CurrentRoundNr == 1) - _Back(); - if (_Buttons[_ButtonExit].Selected && _GameState.CurrentRoundNr > 1) + _PartyMode.Next(); + if (_Buttons[_ButtonBack].Selected && _PartyMode.GameData.CurrentRoundNr == 1) + _PartyMode.Back(); + if (_Buttons[_ButtonExit].Selected && _PartyMode.GameData.CurrentRoundNr > 1) _ShowPopup(true); if (_Buttons[_ButtonPlayerScrollUp].Selected) _ScrollPlayerTable(-1); @@ -206,15 +186,15 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley { base.HandleMouse(mouseEvent); - if (mouseEvent.LB && _IsMouseOver(mouseEvent)) + if (mouseEvent.LB && _IsMouseOverCurSelection(mouseEvent)) { if (!_ExitPopupVisible) { if (_Buttons[_ButtonNextRound].Selected) - _NextRound(); - if (_Buttons[_ButtonBack].Selected && _GameState.CurrentRoundNr == 1) - _Back(); - if (_Buttons[_ButtonExit].Selected && _GameState.CurrentRoundNr > 1) + _PartyMode.Next(); + if (_Buttons[_ButtonBack].Selected && _PartyMode.GameData.CurrentRoundNr == 1) + _PartyMode.Back(); + if (_Buttons[_ButtonExit].Selected && _PartyMode.GameData.CurrentRoundNr > 1) _ShowPopup(true); if (_Buttons[_ButtonPlayerScrollUp].Selected) _ScrollPlayerTable(-1); @@ -238,8 +218,8 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley { if (!_ExitPopupVisible) { - if (_GameState.CurrentRoundNr == 1) - _Back(); + if (_PartyMode.GameData.CurrentRoundNr == 1) + _PartyMode.Back(); else _ShowPopup(true); } @@ -268,13 +248,13 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley _UpdatePlayerTable(); _UpdateNextPlayerPositions(); _UpdateNextPlayerContents(); - if (_GameState.CurrentRoundNr == 1) + if (_PartyMode.GameData.CurrentRoundNr == 1) _BuildRoundsTable(); else - _ScrollRoundsTable(_GameState.CurrentRoundNr - 2); + _ScrollRoundsTable(_PartyMode.GameData.CurrentRoundNr - 2); _UpdateRoundsTable(); - if (_GameState.CurrentRoundNr == 1) + if (_PartyMode.GameData.CurrentRoundNr == 1) { _Buttons[_ButtonBack].Visible = true; _Buttons[_ButtonExit].Visible = false; @@ -285,12 +265,12 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley _Buttons[_ButtonExit].Visible = true; } - if (_GameState.CurrentRoundNr <= _GameState.Combs.Count) + if (_PartyMode.GameData.CurrentRoundNr <= _PartyMode.GameData.Rounds.Count) { _Buttons[_ButtonNextRound].Visible = true; _Texts[_TextFinishMessage].Visible = false; _Texts[_TextFinishPlayerWin].Visible = false; - _SetInteractionToButton(_Buttons[_ButtonNextRound]); + _SelectElement(_Buttons[_ButtonNextRound]); } else { @@ -298,7 +278,7 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley _Texts[_TextFinishMessage].Visible = true; _Texts[_TextFinishPlayerWin].Visible = true; _Texts[_TextFinishPlayerWin].Text = _GetPlayerWinString(); - _SetInteractionToButton(_Buttons[_ButtonExit]); + _SelectElement(_Buttons[_ButtonExit]); } _ShowPopup(false); @@ -309,22 +289,9 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley return true; } - public override bool Draw() - { - base.Draw(); - return true; - } - - private void _NextRound() - { - _Data.ScreenMain.FadeToNameSelection = false; - _Data.ScreenMain.FadeToSongSelection = true; - _PartyMode.DataFromScreen(ThemeName, _Data); - } - private void _EndParty() { - _FadeTo(EScreens.ScreenParty); + CBase.Graphics.FadeTo(EScreen.Party); } private void _ShowPopup(bool visible) @@ -337,26 +304,20 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley _Buttons[_ButtonPopupNo].Visible = _ExitPopupVisible; if (_ExitPopupVisible) - _SetInteractionToButton(_Buttons[_ButtonPopupNo]); - } - - private void _Back() - { - _Data.ScreenMain.FadeToNameSelection = true; - _Data.ScreenMain.FadeToSongSelection = false; - _PartyMode.DataFromScreen(ThemeName, _Data); + _SelectElement(_Buttons[_ButtonPopupNo]); } private void _UpdateNextPlayerPositions() { - float x = (float)CBase.Settings.GetRenderW() / 2 - ((_GameState.NumPlayerAtOnce * _Statics[_StaticNextPlayer].Rect.W) + ((_GameState.NumPlayerAtOnce - 1) * 15)) / 2; + float x = (float)CBase.Settings.GetRenderW() / 2 - + ((_PartyMode.GameData.NumPlayerAtOnce * _Statics[_StaticNextPlayer].Rect.W) + ((_PartyMode.GameData.NumPlayerAtOnce - 1) * 15)) / 2; const float staticY = 590; const float textY = 550; - for (int i = 0; i < _GameState.NumPlayerAtOnce; i++) + for (int i = 0; i < _PartyMode.GameData.NumPlayerAtOnce; i++) { //static - _NextPlayerStatics[i].Rect.X = x; - _NextPlayerStatics[i].Rect.Y = staticY; + _NextPlayerStatics[i].X = x; + _NextPlayerStatics[i].Y = staticY; _NextPlayerStatics[i].Visible = true; //text _NextPlayerTexts[i].X = x + _Statics[_StaticNextPlayer].Rect.W / 2; @@ -365,7 +326,7 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley x += _Statics[_StaticNextPlayer].Rect.W + 15; } - for (int i = _GameState.NumPlayerAtOnce; i < _PartyMode.GetMaxPlayer(); i++) + for (int i = _PartyMode.GameData.NumPlayerAtOnce; i < _PartyMode.GetMaxPlayer(); i++) { _NextPlayerStatics[i].Visible = false; _NextPlayerTexts[i].Visible = false; @@ -374,21 +335,21 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley private void _UpdateNextPlayerContents() { - if (_GameState.CurrentRoundNr <= _GameState.Combs.Count) + if (_PartyMode.GameData.CurrentRoundNr <= _PartyMode.GameData.Rounds.Count) { _Texts[_TextNextPlayerMessage].Visible = true; - for (int i = 0; i < _GameState.NumPlayerAtOnce; i++) + for (int i = 0; i < _PartyMode.GameData.NumPlayerAtOnce; i++) { - int id = _GameState.ProfileIDs[_GameState.Combs[_GameState.CurrentRoundNr - 1].Player[i]]; + int id = _PartyMode.GameData.ProfileIDs[_PartyMode.GameData.Rounds[_PartyMode.GameData.CurrentRoundNr - 1].Player[i]]; _NextPlayerStatics[i].Texture = CBase.Profiles.GetAvatar(id); _NextPlayerTexts[i].Text = CBase.Profiles.GetPlayerName(id); - _NextPlayerTexts[i].Color = CBase.Theme.GetPlayerColor(i + 1); + _NextPlayerTexts[i].Color = CBase.Themes.GetPlayerColor(i + 1); } } else { _Texts[_TextNextPlayerMessage].Visible = false; - for (int i = 0; i < _GameState.NumPlayerAtOnce; i++) + for (int i = 0; i < _PartyMode.GameData.NumPlayerAtOnce; i++) { _NextPlayerStatics[i].Visible = false; _NextPlayerTexts[i].Visible = false; @@ -434,10 +395,10 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley _RoundsTableScrollArea = new SRectF(); const int numPlayerInOneRow = 3; - _NumRoundsVisible = _GameState.NumPlayerAtOnce <= numPlayerInOneRow ? 5 : 3; + _NumRoundsVisible = _PartyMode.GameData.NumPlayerAtOnce <= numPlayerInOneRow ? 5 : 3; - if (_NumRoundsVisible > _GameState.Combs.Count) - _NumRoundsVisible = _GameState.Combs.Count; + if (_NumRoundsVisible > _PartyMode.GameData.Rounds.Count) + _NumRoundsVisible = _PartyMode.GameData.Rounds.Count; float numberX = _Texts[_TextRoundNumber].X; float numberY = _Texts[_TextRoundNumber].Y; @@ -446,7 +407,7 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley _RoundsTableScrollArea.Y = numberY; _RoundsTableScrollArea.W = CBase.Settings.GetRenderW() - _Texts[_TextRoundNumber].X - 20; - float delta = _Texts[_TextRoundNumber].Height; + float delta = _Texts[_TextRoundNumber].Rect.H; //Update statics and texts for rounds foreach (CRoundsTableRow roundRow in _RoundsTable) @@ -454,15 +415,15 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley //Round-number roundRow.Number.X = numberX; roundRow.Number.Y = numberY; - var numInnerRows = (int)Math.Ceiling(_GameState.NumPlayerAtOnce / ((double)numPlayerInOneRow)); + var numInnerRows = (int)Math.Ceiling(_PartyMode.GameData.NumPlayerAtOnce / ((double)numPlayerInOneRow)); for (int row = 0; row < numInnerRows; row++) { int num = (row + 1) * numPlayerInOneRow; int numPlayerInThisRow = numPlayerInOneRow; - if (num > _GameState.NumPlayerAtOnce) + if (num > _PartyMode.GameData.NumPlayerAtOnce) { - num = _GameState.NumPlayerAtOnce; - numPlayerInThisRow = _GameState.NumPlayerAtOnce - (row * numPlayerInOneRow); + num = _PartyMode.GameData.NumPlayerAtOnce; + numPlayerInThisRow = _PartyMode.GameData.NumPlayerAtOnce - (row * numPlayerInOneRow); } for (int column = row * numPlayerInOneRow; column < num; column++) { @@ -472,14 +433,13 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley float maxw = ((CBase.Settings.GetRenderW() - _Texts[_TextRoundNumber].X - 20) / numPlayerInThisRow) / 2 - 5; roundRow.TextPlayer[column].X = x; roundRow.TextPlayer[column].Y = numberY; - roundRow.TextPlayer[column].MaxWidth = maxw; + roundRow.TextPlayer[column].W = maxw; //Score - roundRow.TextScores[column] = roundRow.TextScores[column]; roundRow.TextScores[column].X = x; roundRow.TextScores[column].Y = numberY + delta; - roundRow.TextScores[column].MaxWidth = maxw; + roundRow.TextScores[column].W = maxw; } - numberY = numberY + delta + delta; + numberY = numberY + 2 * delta; } numberY = numberY + delta / 2; } @@ -492,17 +452,18 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley { for (int p = 0; p < _RoundsTable[i].TextPlayer.Count; p++) { - if (_GameState.Combs.Count > i + _RoundsTableOffset && _GameState.Combs[i + _RoundsTableOffset].Player.Count > p) + if (_PartyMode.GameData.Rounds.Count > i + _RoundsTableOffset && _PartyMode.GameData.Rounds[i + _RoundsTableOffset].Player.Count > p) { _RoundsTable[i].Number.Visible = true; _RoundsTable[i].TextPlayer[p].Visible = true; _RoundsTable[i].TextScores[p].Visible = true; _RoundsTable[i].Number.Text = (i + 1 + _RoundsTableOffset) + ")"; - _RoundsTable[i].TextPlayer[p].Text = CBase.Profiles.GetPlayerName(_GameState.ProfileIDs[_GameState.Combs[i + _RoundsTableOffset].Player[p]]); + _RoundsTable[i].TextPlayer[p].Text = + CBase.Profiles.GetPlayerName(_PartyMode.GameData.ProfileIDs[_PartyMode.GameData.Rounds[i + _RoundsTableOffset].Player[p]]); // ReSharper disable ConvertIfStatementToConditionalTernaryExpression - if ((_GameState.CurrentRoundNr - 1) > i + _RoundsTableOffset) + if ((_PartyMode.GameData.CurrentRoundNr - 1) > i + _RoundsTableOffset) // ReSharper restore ConvertIfStatementToConditionalTernaryExpression - _RoundsTable[i].TextScores[p].Text = _GameState.Results[i + _RoundsTableOffset, p].ToString(); + _RoundsTable[i].TextScores[p].Text = _PartyMode.GameData.Results[i + _RoundsTableOffset, p].ToString(); else _RoundsTable[i].TextScores[p].Text = ""; } @@ -512,7 +473,7 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley _RoundsTable[i].TextScores[p].Visible = false; } } - if (_GameState.Combs.Count < i + _RoundsTableOffset || i + 1 > _NumRoundsVisible) + if (_PartyMode.GameData.Rounds.Count < i + _RoundsTableOffset || i + 1 > _NumRoundsVisible) { _RoundsTable[i].Number.Visible = false; for (int p = 0; p < _RoundsTable[i].TextPlayer.Count; p++) @@ -524,7 +485,7 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley } _Buttons[_ButtonRoundsScrollUp].Visible = _RoundsTableOffset > 0; - _Buttons[_ButtonRoundsScrollDown].Visible = _GameState.Combs.Count - _NumRoundsVisible - _RoundsTableOffset > 0; + _Buttons[_ButtonRoundsScrollDown].Visible = _PartyMode.GameData.Rounds.Count - _NumRoundsVisible - _RoundsTableOffset > 0; } private void _BuildPlayerTable() @@ -532,7 +493,7 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley _PlayerTableScrollArea = new SRectF {X = _Texts[_TextPosition].X, Y = _Texts[_TextPosition].Y, W = _Texts[_TextGamePoints].X - _Texts[_TextPosition].X}; _PlayerTable = new List(); - float delta = _Texts[_TextPosition].Height * 1.2f; + float delta = _Texts[_TextPosition].Rect.H * 1.2f; float h = 0; @@ -584,7 +545,7 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley { STableRow row = _PlayerTable[i]; - if (i + _PlayerTableOffset < _GameState.ResultTable.Count) + if (i + _PlayerTableOffset < _PartyMode.GameData.ResultTable.Count) { row.Pos.Visible = true; row.Name.Visible = true; @@ -593,12 +554,12 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley row.SingPoints.Visible = true; row.GamePoints.Visible = true; - row.Pos.Text = _GameState.ResultTable[i + _PlayerTableOffset].Position + "."; - row.Name.Text = CBase.Profiles.GetPlayerName(_GameState.ResultTable[i + _PlayerTableOffset].PlayerID); - row.Rounds.Text = _GameState.ResultTable[i + _PlayerTableOffset].NumPlayed.ToString(); - row.Won.Text = _GameState.ResultTable[i + _PlayerTableOffset].NumWon.ToString(); - row.SingPoints.Text = _GameState.ResultTable[i + _PlayerTableOffset].NumSingPoints.ToString(); - row.GamePoints.Text = _GameState.ResultTable[i + _PlayerTableOffset].NumGamePoints.ToString(); + row.Pos.Text = _PartyMode.GameData.ResultTable[i + _PlayerTableOffset].Position + "."; + row.Name.Text = CBase.Profiles.GetPlayerName(_PartyMode.GameData.ResultTable[i + _PlayerTableOffset].PlayerID); + row.Rounds.Text = _PartyMode.GameData.ResultTable[i + _PlayerTableOffset].NumPlayed.ToString(); + row.Won.Text = _PartyMode.GameData.ResultTable[i + _PlayerTableOffset].NumWon.ToString(); + row.SingPoints.Text = _PartyMode.GameData.ResultTable[i + _PlayerTableOffset].NumSingPoints.ToString(); + row.GamePoints.Text = _PartyMode.GameData.ResultTable[i + _PlayerTableOffset].NumGamePoints.ToString(); } else { @@ -612,37 +573,37 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley } _Buttons[_ButtonPlayerScrollUp].Visible = _PlayerTableOffset > 0; - _Buttons[_ButtonPlayerScrollDown].Visible = _GameState.ProfileIDs.Count - _NumPlayerVisible - _PlayerTableOffset > 0; + _Buttons[_ButtonPlayerScrollDown].Visible = _PartyMode.GameData.ProfileIDs.Count - _NumPlayerVisible - _PlayerTableOffset > 0; } private void _ScrollPlayerTable(int offset) { - if (_GameState.ProfileIDs.Count <= _NumPlayerVisible) + if (_PartyMode.GameData.ProfileIDs.Count <= _NumPlayerVisible) _PlayerTableOffset = 0; else if (offset < 0 && _PlayerTableOffset + offset >= 0) _PlayerTableOffset += offset; else if (offset < 0 && _PlayerTableOffset + offset < 0) _PlayerTableOffset = 0; - else if (offset > 0 && _PlayerTableOffset + offset <= _GameState.ProfileIDs.Count - _NumPlayerVisible) + else if (offset > 0 && _PlayerTableOffset + offset <= _PartyMode.GameData.ProfileIDs.Count - _NumPlayerVisible) _PlayerTableOffset += offset; - else if (offset > 0 && _PlayerTableOffset + offset > _GameState.ProfileIDs.Count - _NumPlayerVisible) - _PlayerTableOffset = _GameState.ProfileIDs.Count - _NumPlayerVisible; + else if (offset > 0 && _PlayerTableOffset + offset > _PartyMode.GameData.ProfileIDs.Count - _NumPlayerVisible) + _PlayerTableOffset = _PartyMode.GameData.ProfileIDs.Count - _NumPlayerVisible; _UpdatePlayerTable(); } private void _ScrollRoundsTable(int offset) { - if (_GameState.Combs.Count <= _NumRoundsVisible) + if (_PartyMode.GameData.Rounds.Count <= _NumRoundsVisible) _RoundsTableOffset = 0; else if (offset < 0 && _RoundsTableOffset + offset >= 0) _RoundsTableOffset += offset; else if (offset < 0 && _RoundsTableOffset + offset < 0) _RoundsTableOffset = 0; - else if (offset > 0 && _RoundsTableOffset + offset <= _GameState.Combs.Count - _NumRoundsVisible) + else if (offset > 0 && _RoundsTableOffset + offset <= _PartyMode.GameData.Rounds.Count - _NumRoundsVisible) _RoundsTableOffset += offset; - else if (offset > 0 && _RoundsTableOffset + offset > _GameState.Combs.Count - _NumRoundsVisible) - _RoundsTableOffset = _GameState.Combs.Count - _NumRoundsVisible; + else if (offset > 0 && _RoundsTableOffset + offset > _PartyMode.GameData.Rounds.Count - _NumRoundsVisible) + _RoundsTableOffset = _PartyMode.GameData.Rounds.Count - _NumRoundsVisible; _UpdateRoundsTable(); } @@ -650,13 +611,14 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley private string _GetPlayerWinString() { string s = ""; - for (int i = 0; i < _GameState.ResultTable.Count; i++) + + for (int i = 0; i < _PartyMode.GameData.ResultTable.Count; i++) { - if (_GameState.ResultTable[i].Position == 1) + if (_PartyMode.GameData.ResultTable[i].Position == 1) { if (i > 0) s += ", "; - s += CBase.Profiles.GetPlayerName(_GameState.ResultTable[i].PlayerID); + s += CBase.Profiles.GetPlayerName(_PartyMode.GameData.ResultTable[i].PlayerID); } else break; diff --git a/PartyModes/PartyModeChallengeMedley/CPartyScreenChallengeMedleyNames.cs b/PartyModes/PartyModeChallengeMedley/CPartyScreenChallengeMedleyNames.cs index 9c3521af..4d92fc7d 100644 --- a/PartyModes/PartyModeChallengeMedley/CPartyScreenChallengeMedleyNames.cs +++ b/PartyModes/PartyModeChallengeMedley/CPartyScreenChallengeMedleyNames.cs @@ -15,7 +15,6 @@ // along with Vocaluxe. If not, see . #endregion -using System; using System.Collections.Generic; using VocaluxeLib.Menu; @@ -31,58 +30,38 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley get { return 1; } } - private SDataFromScreen _Data; + private new CPartyModeChallengeMedley _PartyMode; public override void Init() { base.Init(); - - _Data.ScreenNames.ProfileIDs = new List(); - - _Data = new SDataFromScreen(); - var names = new SFromScreenNames {FadeToConfig = false, ProfileIDs = new List()}; - _Data.ScreenNames = names; - + _PartyMode = (CPartyModeChallengeMedley)base._PartyMode; _AllowChangePlayerNum = false; } - public override void DataToScreen(object receivedData) + public override void OnShow() { - try - { - var config = (SDataToScreenNames)receivedData; - _Data.ScreenNames.ProfileIDs = config.ProfileIDs ?? new List(); + base.OnShow(); + SetPartyModeData(_PartyMode.GameData.NumPlayer); + while (_PartyMode.GameData.ProfileIDs.Count > _NumPlayer) + _PartyMode.GameData.ProfileIDs.RemoveAt(_PartyMode.GameData.ProfileIDs.Count - 1); - SetPartyModeData(config.NumPlayer); - - while (_Data.ScreenNames.ProfileIDs.Count > _NumPlayer) - _Data.ScreenNames.ProfileIDs.RemoveAt(_Data.ScreenNames.ProfileIDs.Count - 1); - - List[] ids = new List[] {_Data.ScreenNames.ProfileIDs}; - SetPartyModeProfiles(ids); - } - catch (Exception e) - { - CBase.Log.LogError("Error in party mode screen challenge names. Can't cast received data from game mode " + ThemeName + ". " + e.Message); - } + List[] ids = new List[] {_PartyMode.GameData.ProfileIDs}; + SetPartyModeProfiles(ids); } public override void Back() { - SPartyNameOptions options = GetData(); - if (options.TeamList.Length == 1) - _Data.ScreenNames.ProfileIDs = options.TeamList[0]; - _Data.ScreenNames.FadeToConfig = true; - _PartyMode.DataFromScreen(ThemeName, _Data); + if (_TeamList.Length == 1) + _PartyMode.GameData.ProfileIDs = _TeamList[0]; + _PartyMode.Back(); } public override void Next() { - SPartyNameOptions options = GetData(); - if (options.TeamList.Length == 1) - _Data.ScreenNames.ProfileIDs = options.TeamList[0]; - _Data.ScreenNames.FadeToConfig = false; - _PartyMode.DataFromScreen(ThemeName, _Data); + if (_TeamList.Length == 1) + _PartyMode.GameData.ProfileIDs = _TeamList[0]; + _PartyMode.Next(); } } } \ No newline at end of file diff --git a/PartyModes/PartyModeTicTacToe/CPartyModeTicTacToe.cs b/PartyModes/PartyModeTicTacToe/CPartyModeTicTacToe.cs index 1fcf18c2..1dadbaea 100644 --- a/PartyModes/PartyModeTicTacToe/CPartyModeTicTacToe.cs +++ b/PartyModes/PartyModeTicTacToe/CPartyModeTicTacToe.cs @@ -17,8 +17,11 @@ using System; using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; using System.Runtime.InteropServices; using VocaluxeLib.Menu; +using VocaluxeLib.Songs; [assembly: ComVisible(false)] @@ -53,81 +56,20 @@ namespace VocaluxeLib.PartyModes.TicTacToe public bool Finished; } - #region Communication - - #region ToScreen - public struct SDataToScreenConfig + public abstract class CPartyScreenTicTacToe : CMenuParty { - public int NumFields; - public ESongSource SongSource; - public int CategoryID; - public int PlaylistID; - public EPartyGameMode GameMode; + protected new CPartyModeTicTacToe _PartyMode; + + public override void Init() + { + base.Init(); + _PartyMode = (CPartyModeTicTacToe)base._PartyMode; + } } - public struct SDataToScreenNames - { - public int NumPlayerTeam1; - public int NumPlayerTeam2; - public List ProfileIDsTeam1; - public List ProfileIDsTeam2; - } - - public struct SDataToScreenMain - { - public int CurrentRoundNr; - public int Team; - public int NumFields; - public List Rounds; - public List Songs; - public List ProfileIDsTeam1; - public List ProfileIDsTeam2; - public List PlayerTeam1; - public List PlayerTeam2; - public int[] NumJokerRandom; - public int[] NumJokerRetry; - } - - public struct SDataFromScreen - { - public SFromScreenConfig ScreenConfig; - public SFromScreenNames ScreenNames; - public SFromScreenMain ScreenMain; - } - - public struct SFromScreenConfig - { - public int NumFields; - public ESongSource SongSource; - public int CategoryID; - public int PlaylistID; - public EPartyGameMode GameMode; - } - - public struct SFromScreenNames - { - public bool FadeToConfig; - public int NumPlayerTeam1; - public int NumPlayerTeam2; - public List ProfileIDsTeam1; - public List ProfileIDsTeam2; - } - - public struct SFromScreenMain - { - public bool FadeToSinging; - public bool FadeToNameSelection; - public List PlayerTeam1; - public List PlayerTeam2; - public List Rounds; - public int SingRoundNr; - public List Songs; - } - #endregion FromScreen - - #endregion Communication - + // ReSharper disable ClassNeverInstantiated.Global public sealed class CPartyModeTicTacToe : CPartyMode + // ReSharper restore ClassNeverInstantiated.Global { private const int _MaxPlayer = 20; private const int _MinPlayer = 2; @@ -139,14 +81,13 @@ namespace VocaluxeLib.PartyModes.TicTacToe private enum EStage { - NotStarted, Config, Names, Main, Singing } - private struct SData + public struct SData { public int NumPlayerTeam1; public int NumPlayerTeam2; @@ -167,20 +108,16 @@ namespace VocaluxeLib.PartyModes.TicTacToe public List Songs; public int CurrentRoundNr; - public int SingRoundNr; + public int FieldNr; public int[] NumJokerRandom; public int[] NumJokerRetry; } - private SDataToScreenConfig _ToScreenConfig; - private SDataToScreenNames _ToScreenNames; - private SDataToScreenMain _ToScreenMain; - - private SData _GameData; + public SData GameData; private EStage _Stage; - public CPartyModeTicTacToe() + public CPartyModeTicTacToe(int id, string folder) : base(id, folder) { _ScreenSongOptions.Selection.RandomOnly = false; _ScreenSongOptions.Selection.PartyMode = true; @@ -192,23 +129,17 @@ namespace VocaluxeLib.PartyModes.TicTacToe _ScreenSongOptions.Sorting.SearchActive = false; _ScreenSongOptions.Sorting.DuetOptions = EDuetOptions.NoDuets; - _Stage = EStage.NotStarted; - - _ToScreenConfig = new SDataToScreenConfig(); - _ToScreenNames = new SDataToScreenNames(); - _ToScreenMain = new SDataToScreenMain(); - - _GameData = new SData + GameData = new SData { - NumFields = 9, NumPlayerTeam1 = 2, NumPlayerTeam2 = 2, + NumFields = 9, ProfileIDsTeam1 = new List(), ProfileIDsTeam2 = new List(), PlayerTeam1 = new List(), PlayerTeam2 = new List(), CurrentRoundNr = 0, - SingRoundNr = 0, + FieldNr = 0, SongSource = ESongSource.TR_ALLSONGS, PlaylistID = 0, CategoryID = 0, @@ -222,7 +153,7 @@ namespace VocaluxeLib.PartyModes.TicTacToe public override bool Init() { - _Stage = EStage.NotStarted; + _Stage = EStage.Config; _ScreenSongOptions.Sorting.IgnoreArticles = CBase.Config.GetIgnoreArticles(); _ScreenSongOptions.Sorting.SongSorting = CBase.Config.GetSongSorting(); @@ -232,100 +163,13 @@ namespace VocaluxeLib.PartyModes.TicTacToe if (CBase.Config.GetTabs() == EOffOn.TR_CONFIG_ON && _ScreenSongOptions.Sorting.SongSorting != ESongSorting.TR_CONFIG_NONE) _ScreenSongOptions.Sorting.Tabs = EOffOn.TR_CONFIG_ON; - _ToScreenMain.Rounds = new List(); - _ToScreenMain.Songs = new List(); - _ToScreenMain.PlayerTeam1 = new List(); - _ToScreenMain.PlayerTeam2 = new List(); - _GameData.Songs = new List(); - _GameData.Rounds = new List(); - _GameData.PlayerTeam1 = new List(); - _GameData.PlayerTeam2 = new List(); + GameData.Songs.Clear(); + GameData.Rounds.Clear(); + GameData.PlayerTeam1.Clear(); + GameData.PlayerTeam2.Clear(); return true; } - public override void DataFromScreen(string screenName, Object data) - { - var dataFrom = new SDataFromScreen(); - switch (screenName) - { - case "PartyScreenTicTacToeConfig": - - try - { - dataFrom = (SDataFromScreen)data; - _GameData.NumFields = dataFrom.ScreenConfig.NumFields; - _GameData.SongSource = dataFrom.ScreenConfig.SongSource; - _GameData.CategoryID = dataFrom.ScreenConfig.CategoryID; - _GameData.PlaylistID = dataFrom.ScreenConfig.PlaylistID; - _GameData.GameMode = dataFrom.ScreenConfig.GameMode; - - _Stage = EStage.Config; - CBase.Graphics.FadeTo(EScreens.ScreenPartyDummy); - } - catch (Exception e) - { - CBase.Log.LogError("Error in party mode TicTacToe. Can't cast received data from screen " + screenName + ". " + e.Message); - } - break; - - case "PartyScreenTicTacToeNames": - try - { - dataFrom = (SDataFromScreen)data; - if (dataFrom.ScreenNames.FadeToConfig) - _Stage = EStage.NotStarted; - else - { - _GameData.Team = CBase.Game.GetRandom(100) < 50 ? 0 : 1; - _GameData.NumPlayerTeam1 = dataFrom.ScreenNames.NumPlayerTeam1; - _GameData.NumPlayerTeam2 = dataFrom.ScreenNames.NumPlayerTeam2; - _GameData.ProfileIDsTeam1 = dataFrom.ScreenNames.ProfileIDsTeam1; - _GameData.ProfileIDsTeam2 = dataFrom.ScreenNames.ProfileIDsTeam2; - _Stage = EStage.Names; - } - - CBase.Graphics.FadeTo(EScreens.ScreenPartyDummy); - } - catch (Exception e) - { - CBase.Log.LogError("Error in party mode TicTacToe. Can't cast received data from screen " + screenName + ". " + e.Message); - } - break; - - case "PartyScreenTicTacToeMain": - try - { - dataFrom = (SDataFromScreen)data; - if (dataFrom.ScreenMain.FadeToSinging) - { - _Stage = EStage.Singing; - _GameData.Rounds = dataFrom.ScreenMain.Rounds; - _GameData.SingRoundNr = dataFrom.ScreenMain.SingRoundNr; - _GameData.Songs = dataFrom.ScreenMain.Songs; - _GameData.PlayerTeam1 = dataFrom.ScreenMain.PlayerTeam1; - _GameData.PlayerTeam2 = dataFrom.ScreenMain.PlayerTeam2; - } - if (dataFrom.ScreenMain.FadeToNameSelection) - _Stage = EStage.Config; - } - catch (Exception e) - { - CBase.Log.LogError("Error in party mode TicTacToe. Can't cast received data from screen " + screenName + ". " + e.Message); - } - - - if (_Stage == EStage.Singing) - _StartRound(dataFrom.ScreenMain.SingRoundNr); - if (_Stage == EStage.Config) - CBase.Graphics.FadeTo(EScreens.ScreenPartyDummy); - break; - - default: - CBase.Log.LogError("Error in party mode TicTacToe. Wrong screen is sending: " + screenName); - break; - } - } - public override void UpdateGame() { /* @@ -335,127 +179,102 @@ namespace VocaluxeLib.PartyModes.TicTacToe _ScreenSongOptions.Selection.RandomOnly = false;*/ } - public override CMenuParty GetNextPartyScreen(out EScreens alternativeScreen) + private IMenu _GetNextScreen() { - CMenuParty screen = null; - alternativeScreen = EScreens.ScreenSong; - switch (_Stage) { - case EStage.NotStarted: - _Screens.TryGetValue("CPartyScreenTicTacToeConfig", out screen); - if (screen != null) - { - _ToScreenConfig.NumFields = _GameData.NumFields; - _ToScreenConfig.SongSource = _GameData.SongSource; - _ToScreenConfig.CategoryID = _GameData.CategoryID; - _ToScreenConfig.PlaylistID = _GameData.PlaylistID; - _ToScreenConfig.GameMode = _GameData.GameMode; - screen.DataToScreen(_ToScreenConfig); - } - break; case EStage.Config: - _Screens.TryGetValue("CPartyScreenTicTacToeNames", out screen); - if (screen != null) - { - _ToScreenNames.NumPlayerTeam1 = _GameData.NumPlayerTeam1; - _ToScreenNames.NumPlayerTeam2 = _GameData.NumPlayerTeam2; - _ToScreenNames.ProfileIDsTeam1 = _GameData.ProfileIDsTeam1; - _ToScreenNames.ProfileIDsTeam2 = _GameData.ProfileIDsTeam2; - screen.DataToScreen(_ToScreenNames); - } + return _Screens["CPartyScreenTicTacToeConfig"]; + case EStage.Names: + return _Screens["CPartyScreenTicTacToeNames"]; + case EStage.Main: + return _Screens["CPartyScreenTicTacToeMain"]; + case EStage.Singing: + return CBase.Graphics.GetScreen(EScreen.Sing); + default: + throw new ArgumentException("Invalid stage: " + _Stage); + } + } + + private void _FadeToScreen() + { + if (CBase.Graphics.GetNextScreen() != _GetNextScreen()) + CBase.Graphics.FadeTo(_GetNextScreen()); + } + + public void Next() + { + switch (_Stage) + { + case EStage.Config: + _Stage = EStage.Names; break; case EStage.Names: - _Screens.TryGetValue("CPartyScreenTicTacToeMain", out screen); - if (screen != null) - { - _GameData.Team = _GameData.Team == 1 ? 0 : 1; - CBase.Songs.ResetSongSung(); - _GameData.CurrentRoundNr = 1; - _ToScreenMain.CurrentRoundNr = 1; - _ToScreenMain.NumFields = _GameData.NumFields; - _ToScreenMain.ProfileIDsTeam1 = _GameData.ProfileIDsTeam1; - _ToScreenMain.ProfileIDsTeam2 = _GameData.ProfileIDsTeam2; - _CreateRounds(); - _SetNumJokers(); - _PreparePlayerList(0); - _PrepareSongList(); - _ToScreenMain.Rounds = _GameData.Rounds; - _ToScreenMain.Songs = _GameData.Songs; - _ToScreenMain.PlayerTeam1 = _GameData.PlayerTeam1; - _ToScreenMain.PlayerTeam1 = _GameData.PlayerTeam2; - _ToScreenMain.NumJokerRandom = _GameData.NumJokerRandom; - _ToScreenMain.NumJokerRetry = _GameData.NumJokerRetry; - _ToScreenMain.Team = _GameData.Team; - screen.DataToScreen(_ToScreenMain); - } + _Stage = EStage.Main; + GameData.Team = CBase.Game.GetRandom(100) < 50 ? 0 : 1; + CBase.Songs.ResetSongSung(); + GameData.CurrentRoundNr = 1; + _CreateRounds(); + _SetNumJokers(); + _PreparePlayerList(0); break; case EStage.Main: - //nothing to do + _Stage = EStage.Singing; + _StartRound(GameData.FieldNr); break; case EStage.Singing: - _Screens.TryGetValue("CPartyScreenTicTacToeMain", out screen); - if (screen != null) - { - _GameData.Team = _GameData.Team == 1 ? 0 : 1; - _UpdateSongList(); - _UpdatePlayerList(); - _ToScreenMain.CurrentRoundNr = _GameData.CurrentRoundNr; - _ToScreenMain.NumFields = _GameData.NumFields; - _ToScreenMain.ProfileIDsTeam1 = _GameData.ProfileIDsTeam1; - _ToScreenMain.ProfileIDsTeam2 = _GameData.ProfileIDsTeam2; - _ToScreenMain.Rounds = _GameData.Rounds; - _ToScreenMain.Songs = _GameData.Songs; - _ToScreenMain.PlayerTeam1 = _GameData.PlayerTeam1; - _ToScreenMain.PlayerTeam2 = _GameData.PlayerTeam2; - _ToScreenMain.NumJokerRandom = _GameData.NumJokerRandom; - _ToScreenMain.NumJokerRetry = _GameData.NumJokerRetry; - _ToScreenMain.Team = _GameData.Team; - screen.DataToScreen(_ToScreenMain); - } + _Stage = EStage.Main; + GameData.Team = GameData.Team == 1 ? 0 : 1; + _UpdatePlayerList(); break; + default: + throw new ArgumentException("Invalid stage: " + _Stage); } - - return screen; + _FadeToScreen(); } - public override EScreens GetStartScreen() + public void Back() { - return EScreens.ScreenPartyDummy; + switch (_Stage) + { + case EStage.Config: + CBase.Graphics.FadeTo(EScreen.Party); + return; + case EStage.Names: + _Stage = EStage.Config; + break; + case EStage.Main: + _Stage = EStage.Names; + break; + default: // Rest is not allowed + throw new ArgumentException("Invalid stage: " + _Stage); + } + _FadeToScreen(); } - public override EScreens GetMainScreen() + public override IMenu GetStartScreen() { - return EScreens.ScreenPartyDummy; + return _Screens["CPartyScreenTicTacToeConfig"]; } public override SScreenSongOptions GetScreenSongOptions() { - _ScreenSongOptions.Sorting.SongSorting = CBase.Config.GetSongSorting(); - _ScreenSongOptions.Sorting.Tabs = CBase.Config.GetTabs(); - _ScreenSongOptions.Sorting.IgnoreArticles = CBase.Config.GetIgnoreArticles(); - - return _ScreenSongOptions; + throw new ArgumentException("Not required!"); } - // ReSharper disable RedundantAssignment public override void OnSongChange(int songIndex, ref SScreenSongOptions screenSongOptions) - // ReSharper restore RedundantAssignment { - screenSongOptions = _ScreenSongOptions; + throw new ArgumentException("Not required!"); } - // ReSharper disable RedundantAssignment public override void OnCategoryChange(int categoryIndex, ref SScreenSongOptions screenSongOptions) - // ReSharper restore RedundantAssignment { - screenSongOptions = _ScreenSongOptions; + throw new ArgumentException("Not required!"); } public override void SetSearchString(string searchString, bool visible) { - _ScreenSongOptions.Sorting.SearchString = searchString; - _ScreenSongOptions.Sorting.SearchActive = visible; + throw new ArgumentException("Not required!"); } public override int GetMaxPlayer() @@ -497,41 +316,23 @@ namespace VocaluxeLib.PartyModes.TicTacToe public override void SongSelected(int songID) { - var gm = EGameMode.TR_GAMEMODE_NORMAL; - - switch (_GameData.GameMode) - { - case EPartyGameMode.TR_GAMEMODE_NORMAL: - gm = EGameMode.TR_GAMEMODE_NORMAL; - break; - - case EPartyGameMode.TR_GAMEMODE_DUET: - gm = EGameMode.TR_GAMEMODE_DUET; - break; - - case EPartyGameMode.TR_GAMEMODE_SHORTSONG: - gm = EGameMode.TR_GAMEMODE_SHORTSONG; - break; - } - CBase.Game.AddSong(songID, gm); - - CBase.Graphics.FadeTo(EScreens.ScreenSing); + throw new ArgumentException("Not required!"); } public override void LeavingHighscore() { CBase.Songs.AddPartySongSung(CBase.Game.GetSong(0).ID); _UpdateScores(); - CBase.Graphics.FadeTo(EScreens.ScreenPartyDummy); + Next(); } private void _CreateRounds() { - _GameData.Rounds = new List(); - for (int i = 0; i < _GameData.NumFields; i++) + GameData.Rounds = new List(); + for (int i = 0; i < GameData.NumFields; i++) { var r = new CRound(); - _GameData.Rounds.Add(r); + GameData.Rounds.Add(r); } } @@ -541,41 +342,41 @@ namespace VocaluxeLib.PartyModes.TicTacToe { case 0: { - _GameData.PlayerTeam1 = new List(); - _GameData.PlayerTeam2 = new List(); + GameData.PlayerTeam1 = new List(); + GameData.PlayerTeam2 = new List(); //Prepare Player-IDs var ids1 = new List(); var ids2 = new List(); //Add IDs to team-list - while (_GameData.PlayerTeam1.Count < _GameData.NumFields + _GameData.NumJokerRetry[0] && - _GameData.PlayerTeam2.Count < _GameData.NumFields + _GameData.NumJokerRetry[1]) + while (GameData.PlayerTeam1.Count < GameData.NumFields + GameData.NumJokerRetry[0] && + GameData.PlayerTeam2.Count < GameData.NumFields + GameData.NumJokerRetry[1]) { if (ids1.Count == 0) { - for (int i = 0; i < _GameData.NumPlayerTeam1; i++) + for (int i = 0; i < GameData.NumPlayerTeam1; i++) ids1.Add(i); } if (ids2.Count == 0) { - for (int i = 0; i < _GameData.NumPlayerTeam2; i++) + for (int i = 0; i < GameData.NumPlayerTeam2; i++) ids2.Add(i); } int num; - if (_GameData.PlayerTeam1.Count < _GameData.NumFields + _GameData.NumJokerRetry[0]) + if (GameData.PlayerTeam1.Count < GameData.NumFields + GameData.NumJokerRetry[0]) { num = CBase.Game.GetRandom(ids1.Count); if (num >= ids1.Count) num = ids1.Count - 1; - _GameData.PlayerTeam1.Add(ids1[num]); + GameData.PlayerTeam1.Add(ids1[num]); ids1.RemoveAt(num); } - if (_GameData.PlayerTeam2.Count < _GameData.NumFields + _GameData.NumJokerRetry[1]) + if (GameData.PlayerTeam2.Count < GameData.NumFields + GameData.NumJokerRetry[1]) { num = CBase.Game.GetRandom(ids2.Count); if (num >= ids2.Count) num = ids2.Count - 1; - _GameData.PlayerTeam2.Add(ids2[num]); + GameData.PlayerTeam2.Add(ids2[num]); ids2.RemoveAt(num); } } @@ -586,19 +387,19 @@ namespace VocaluxeLib.PartyModes.TicTacToe //Prepare Player-IDs var ids = new List(); //Add IDs to team-list - while (_GameData.PlayerTeam1.Count < _GameData.NumFields + _GameData.NumJokerRetry[0] && ids.Count == 0) + while (GameData.PlayerTeam1.Count < GameData.NumFields + GameData.NumJokerRetry[0] && ids.Count == 0) { if (ids.Count == 0) { - for (int i = 0; i < _GameData.NumPlayerTeam1; i++) + for (int i = 0; i < GameData.NumPlayerTeam1; i++) ids.Add(i); } - if (_GameData.PlayerTeam1.Count < _GameData.NumFields + _GameData.NumJokerRetry[0]) + if (GameData.PlayerTeam1.Count < GameData.NumFields + GameData.NumJokerRetry[0]) { int num = CBase.Game.GetRandom(ids.Count); if (num >= ids.Count) num = ids.Count - 1; - _GameData.PlayerTeam1.Add(ids[num]); + GameData.PlayerTeam1.Add(ids[num]); ids.RemoveAt(num); } } @@ -609,19 +410,19 @@ namespace VocaluxeLib.PartyModes.TicTacToe //Prepare Player-IDs var ids = new List(); //Add IDs to team-list - while (_GameData.PlayerTeam2.Count < _GameData.NumFields + _GameData.NumJokerRetry[1] && ids.Count == 0) + while (GameData.PlayerTeam2.Count < GameData.NumFields + GameData.NumJokerRetry[1] && ids.Count == 0) { if (ids.Count == 0) { - for (int i = 0; i < _GameData.NumPlayerTeam2; i++) + for (int i = 0; i < GameData.NumPlayerTeam2; i++) ids.Add(i); } - if (_GameData.PlayerTeam2.Count < _GameData.NumFields + _GameData.NumJokerRetry[1]) + if (GameData.PlayerTeam2.Count < GameData.NumFields + GameData.NumJokerRetry[1]) { int num = CBase.Game.GetRandom(ids.Count); if (num >= ids.Count) num = ids.Count - 1; - _GameData.PlayerTeam2.Add(ids[num]); + GameData.PlayerTeam2.Add(ids[num]); ids.RemoveAt(num); } } @@ -630,11 +431,24 @@ namespace VocaluxeLib.PartyModes.TicTacToe } } - private void _PrepareSongList() + private static void _Shuffle(IList list) { - var gm = EGameMode.TR_GAMEMODE_NORMAL; + for (int n = list.Count - 1; n >= 1; n--) + { + int k = CBase.Game.GetRandom(n); + T value = list[k]; + list[k] = list[n]; + list[n] = value; + } + } - switch (_GameData.GameMode) + public void UpdateSongList() + { + if (GameData.Songs.Count > 0) + return; + + EGameMode gm; + switch (GameData.GameMode) { case EPartyGameMode.TR_GAMEMODE_NORMAL: gm = EGameMode.TR_GAMEMODE_NORMAL; @@ -647,77 +461,47 @@ namespace VocaluxeLib.PartyModes.TicTacToe case EPartyGameMode.TR_GAMEMODE_SHORTSONG: gm = EGameMode.TR_GAMEMODE_SHORTSONG; break; + + default: + gm = EGameMode.TR_GAMEMODE_NORMAL; + break; } - while (_GameData.Songs.Count < (_GameData.NumFields + _GameData.NumJokerRandom[0] + _GameData.NumJokerRandom[1])) + switch (GameData.SongSource) { - var songs = new List(); - switch (_GameData.SongSource) - { - case ESongSource.TR_PLAYLIST: - for (int i = 0; i < CBase.Playlist.GetSongCount(_GameData.PlaylistID); i++) - { - int id = CBase.Playlist.GetSong(_GameData.PlaylistID, i).SongID; - // ReSharper disable LoopCanBeConvertedToQuery - foreach (EGameMode mode in CBase.Songs.GetSongByID(id).AvailableGameModes) - // ReSharper restore LoopCanBeConvertedToQuery - { - if (mode == gm) - songs.Add(id); - } - } - break; + case ESongSource.TR_PLAYLIST: + for (int i = 0; i < CBase.Playlist.GetSongCount(GameData.PlaylistID); i++) + { + int id = CBase.Playlist.GetSong(GameData.PlaylistID, i).SongID; + if (CBase.Songs.GetSongByID(id).AvailableGameModes.Contains(gm)) + GameData.Songs.Add(id); + } + break; - case ESongSource.TR_ALLSONGS: - for (int i = 0; i < CBase.Songs.GetNumSongs(); i++) - { - // ReSharper disable LoopCanBeConvertedToQuery - foreach (EGameMode mode in CBase.Songs.GetSongByID(i).AvailableGameModes) - // ReSharper restore LoopCanBeConvertedToQuery - { - if (mode == gm) - songs.Add(i); - } - } - break; + case ESongSource.TR_ALLSONGS: + ReadOnlyCollection avSongs = CBase.Songs.GetSongs(); + GameData.Songs.AddRange(avSongs.Where(song => song.AvailableGameModes.Contains(gm)).Select(song => song.ID)); + break; - case ESongSource.TR_CATEGORY: - CBase.Songs.SetCategory(_GameData.CategoryID); - for (int i = 0; i < CBase.Songs.GetNumSongsVisible(); i++) - { - // ReSharper disable LoopCanBeConvertedToQuery - foreach (EGameMode mode in CBase.Songs.GetVisibleSong(i).AvailableGameModes) - // ReSharper restore LoopCanBeConvertedToQuery - { - if (mode == gm) - songs.Add(CBase.Songs.GetVisibleSong(i).ID); - } - } - CBase.Songs.SetCategory(-1); - break; - } - while (songs.Count > 0) - { - _GameData.Songs.Add(songs[CBase.Game.GetRandom(songs.Count - 1)]); - songs.Remove(_GameData.Songs[_GameData.Songs.Count - 1]); - } + case ESongSource.TR_CATEGORY: + CBase.Songs.SetCategory(GameData.CategoryID); + avSongs = CBase.Songs.GetVisibleSongs(); + GameData.Songs.AddRange(avSongs.Where(song => song.AvailableGameModes.Contains(gm)).Select(song => song.ID)); + + CBase.Songs.SetCategory(-1); + break; } + _Shuffle(GameData.Songs); } private void _UpdatePlayerList() { - if (_GameData.PlayerTeam1.Count == 0) + if (GameData.PlayerTeam1.Count == 0) _PreparePlayerList(1); - if (_GameData.PlayerTeam2.Count == 0) + if (GameData.PlayerTeam2.Count == 0) _PreparePlayerList(2); } - private void _UpdateSongList() - { - if (_GameData.Songs.Count == 0) - _PrepareSongList(); - } - private void _StartRound(int roundNr) { CBase.Game.Reset(); @@ -732,8 +516,8 @@ namespace VocaluxeLib.PartyModes.TicTacToe if (players.Length < 2) return; - CRound r = _GameData.Rounds[roundNr]; - bool isDuet = CBase.Songs.GetSongByID(r.SongID).IsDuet; + CRound round = GameData.Rounds[roundNr]; + bool isDuet = CBase.Songs.GetSongByID(round.SongID).IsDuet; for (int i = 0; i < 2; i++) { @@ -742,51 +526,64 @@ namespace VocaluxeLib.PartyModes.TicTacToe } //try to fill with the right data - if (r != null) + players[0].ProfileID = GameData.ProfileIDsTeam1[round.SingerTeam1]; + if (isDuet) + players[0].VoiceNr = 0; + + players[1].ProfileID = GameData.ProfileIDsTeam2[round.SingerTeam2]; + if (isDuet) + players[1].VoiceNr = 1; + + var gm = EGameMode.TR_GAMEMODE_NORMAL; + + switch (GameData.GameMode) { - players[0].ProfileID = _GameData.ProfileIDsTeam1[r.SingerTeam1]; - if (isDuet) - players[0].VoiceNr = 0; + case EPartyGameMode.TR_GAMEMODE_NORMAL: + gm = EGameMode.TR_GAMEMODE_NORMAL; + break; - players[1].ProfileID = _GameData.ProfileIDsTeam2[r.SingerTeam2]; - if (isDuet) - players[1].VoiceNr = 1; + case EPartyGameMode.TR_GAMEMODE_DUET: + gm = EGameMode.TR_GAMEMODE_DUET; + break; - SongSelected(r.SongID); + case EPartyGameMode.TR_GAMEMODE_SHORTSONG: + gm = EGameMode.TR_GAMEMODE_SHORTSONG; + break; } + CBase.Game.AddSong(round.SongID, gm); } private void _SetNumJokers() { - switch (_GameData.NumFields) + switch (GameData.NumFields) { case 9: - _GameData.NumJokerRandom[0] = 1; - _GameData.NumJokerRandom[1] = 1; - _GameData.NumJokerRetry[0] = 0; - _GameData.NumJokerRetry[1] = 0; + GameData.NumJokerRandom[0] = 1; + GameData.NumJokerRandom[1] = 1; + GameData.NumJokerRetry[0] = 0; + GameData.NumJokerRetry[1] = 0; break; case 16: - _GameData.NumJokerRandom[0] = 2; - _GameData.NumJokerRandom[1] = 2; - _GameData.NumJokerRetry[0] = 1; - _GameData.NumJokerRetry[1] = 1; + GameData.NumJokerRandom[0] = 2; + GameData.NumJokerRandom[1] = 2; + GameData.NumJokerRetry[0] = 1; + GameData.NumJokerRetry[1] = 1; break; case 25: - _GameData.NumJokerRandom[0] = 3; - _GameData.NumJokerRandom[1] = 3; - _GameData.NumJokerRetry[0] = 2; - _GameData.NumJokerRetry[1] = 2; + GameData.NumJokerRandom[0] = 3; + GameData.NumJokerRandom[1] = 3; + GameData.NumJokerRetry[0] = 2; + GameData.NumJokerRetry[1] = 2; break; } } private void _UpdateScores() { - if (!_GameData.Rounds[_GameData.SingRoundNr].Finished) - _GameData.CurrentRoundNr++; + if (!GameData.Rounds[GameData.FieldNr].Finished) + GameData.CurrentRoundNr++; SPlayer[] results = CBase.Game.GetPlayers(); if (results == null) @@ -795,17 +592,17 @@ namespace VocaluxeLib.PartyModes.TicTacToe if (results.Length < 2) return; - _GameData.Rounds[_GameData.SingRoundNr].PointsTeam1 = (int)Math.Round(results[0].Points); - _GameData.Rounds[_GameData.SingRoundNr].PointsTeam2 = (int)Math.Round(results[1].Points); - _GameData.Rounds[_GameData.SingRoundNr].Finished = true; - if (_GameData.Rounds[_GameData.SingRoundNr].PointsTeam1 < _GameData.Rounds[_GameData.SingRoundNr].PointsTeam2) - _GameData.Rounds[_GameData.SingRoundNr].Winner = 2; - else if (_GameData.Rounds[_GameData.SingRoundNr].PointsTeam1 > _GameData.Rounds[_GameData.SingRoundNr].PointsTeam2) - _GameData.Rounds[_GameData.SingRoundNr].Winner = 1; + GameData.Rounds[GameData.FieldNr].PointsTeam1 = (int)Math.Round(results[0].Points); + GameData.Rounds[GameData.FieldNr].PointsTeam2 = (int)Math.Round(results[1].Points); + GameData.Rounds[GameData.FieldNr].Finished = true; + if (GameData.Rounds[GameData.FieldNr].PointsTeam1 < GameData.Rounds[GameData.FieldNr].PointsTeam2) + GameData.Rounds[GameData.FieldNr].Winner = 2; + else if (GameData.Rounds[GameData.FieldNr].PointsTeam1 > GameData.Rounds[GameData.FieldNr].PointsTeam2) + GameData.Rounds[GameData.FieldNr].Winner = 1; else { - _GameData.Rounds[_GameData.SingRoundNr].Finished = false; - _GameData.CurrentRoundNr--; + GameData.Rounds[GameData.FieldNr].Finished = false; + GameData.CurrentRoundNr--; } } } diff --git a/PartyModes/PartyModeTicTacToe/CPartyScreenTicTacToeConfig.cs b/PartyModes/PartyModeTicTacToe/CPartyScreenTicTacToeConfig.cs index f44f881c..2986c303 100644 --- a/PartyModes/PartyModeTicTacToe/CPartyScreenTicTacToeConfig.cs +++ b/PartyModes/PartyModeTicTacToe/CPartyScreenTicTacToeConfig.cs @@ -15,17 +15,15 @@ // along with Vocaluxe. If not, see . #endregion -using System; using System.Collections.Generic; using System.Linq; using System.Windows.Forms; -using VocaluxeLib.Menu; using VocaluxeLib.Songs; namespace VocaluxeLib.PartyModes.TicTacToe { // ReSharper disable UnusedMember.Global - public class CPartyScreenTicTacToeConfig : CMenuParty + public class CPartyScreenTicTacToeConfig : CPartyScreenTicTacToe // ReSharper restore UnusedMember.Global { // Version number for theme files. Increment it, if you've changed something on the theme files! @@ -44,8 +42,6 @@ namespace VocaluxeLib.PartyModes.TicTacToe private bool _ConfigOk = true; - private SDataFromScreen _Data; - public override void Init() { base.Init(); @@ -55,34 +51,6 @@ namespace VocaluxeLib.PartyModes.TicTacToe _SelectSlideNumFields, _SelectSlideSongSource, _SelectSlidePlaylist, _SelectSlideCategory, _SelectSlideGameMode }; _ThemeButtons = new string[] {_ButtonNext, _ButtonBack}; - - _Data = new SDataFromScreen(); - var config = new SFromScreenConfig - { - PlaylistID = 0, - NumFields = 9, - GameMode = EPartyGameMode.TR_GAMEMODE_NORMAL, - CategoryID = 0, - SongSource = ESongSource.TR_ALLSONGS - }; - _Data.ScreenConfig = config; - } - - public override void DataToScreen(object receivedData) - { - try - { - var config = (SDataToScreenConfig)receivedData; - _Data.ScreenConfig.NumFields = config.NumFields; - _Data.ScreenConfig.PlaylistID = config.PlaylistID; - _Data.ScreenConfig.CategoryID = config.CategoryID; - _Data.ScreenConfig.SongSource = config.SongSource; - _Data.ScreenConfig.GameMode = config.GameMode; - } - catch (Exception e) - { - CBase.Log.LogError("Error in party mode screen TicTacToe config. Can't cast received data from game mode " + ThemeName + ". " + e.Message); - } } public override bool HandleInput(SKeyEvent keyEvent) @@ -96,17 +64,17 @@ namespace VocaluxeLib.PartyModes.TicTacToe { case Keys.Back: case Keys.Escape: - _Back(); + _PartyMode.Back(); break; case Keys.Enter: _UpdateSlides(); if (_Buttons[_ButtonBack].Selected) - _Back(); + _PartyMode.Back(); if (_Buttons[_ButtonNext].Selected) - _Next(); + _PartyMode.Next(); break; case Keys.Left: @@ -125,18 +93,18 @@ namespace VocaluxeLib.PartyModes.TicTacToe { base.HandleMouse(mouseEvent); - if (mouseEvent.LB && _IsMouseOver(mouseEvent)) + if (mouseEvent.LB && _IsMouseOverCurSelection(mouseEvent)) { _UpdateSlides(); if (_Buttons[_ButtonBack].Selected) - _Back(); + _PartyMode.Back(); if (_Buttons[_ButtonNext].Selected) - _Next(); + _PartyMode.Next(); } if (mouseEvent.RB) - _Back(); + _PartyMode.Back(); return true; } @@ -158,37 +126,31 @@ namespace VocaluxeLib.PartyModes.TicTacToe return true; } - public override bool Draw() - { - base.Draw(); - return true; - } - private void _FillSlides() { _SelectSlides[_SelectSlideNumFields].Clear(); _SelectSlides[_SelectSlideNumFields].AddValue("9"); _SelectSlides[_SelectSlideNumFields].AddValue("16"); _SelectSlides[_SelectSlideNumFields].AddValue("25"); - if (_Data.ScreenConfig.NumFields == 9) + if (_PartyMode.GameData.NumFields == 9) _SelectSlides[_SelectSlideNumFields].Selection = 0; - else if (_Data.ScreenConfig.NumFields == 16) + else if (_PartyMode.GameData.NumFields == 16) _SelectSlides[_SelectSlideNumFields].Selection = 1; - else if (_Data.ScreenConfig.NumFields == 25) + else if (_PartyMode.GameData.NumFields == 25) _SelectSlides[_SelectSlideNumFields].Selection = 2; _SelectSlides[_SelectSlideSongSource].Clear(); - _SelectSlides[_SelectSlideSongSource].SetValues((int)_Data.ScreenConfig.SongSource); + _SelectSlides[_SelectSlideSongSource].SetValues((int)_PartyMode.GameData.SongSource); List playlists = CBase.Playlist.GetNames(); _SelectSlides[_SelectSlidePlaylist].Clear(); for (int i = 0; i < playlists.Count; i++) { - string value = playlists[i] + " (" + CBase.Playlist.GetSongCount(i) + " " + CBase.Language.Translate("TR_SONGS", _PartyModeID) + ")"; + string value = playlists[i] + " (" + CBase.Playlist.GetSongCount(i) + " " + CBase.Language.Translate("TR_SONGS", PartyModeID) + ")"; _SelectSlides[_SelectSlidePlaylist].AddValue(value); } - _SelectSlides[_SelectSlidePlaylist].Selection = _Data.ScreenConfig.PlaylistID; - _SelectSlides[_SelectSlidePlaylist].Visible = _Data.ScreenConfig.SongSource == ESongSource.TR_PLAYLIST; + _SelectSlides[_SelectSlidePlaylist].Selection = _PartyMode.GameData.PlaylistID; + _SelectSlides[_SelectSlidePlaylist].Visible = _PartyMode.GameData.SongSource == ESongSource.TR_PLAYLIST; var categories = new string[CBase.Songs.GetNumCategories()]; for (int i = 0; i < CBase.Songs.GetNumCategories(); i++) @@ -196,33 +158,33 @@ namespace VocaluxeLib.PartyModes.TicTacToe _SelectSlides[_SelectSlideCategory].Clear(); for (int i = 0; i < categories.Length; i++) { - string value = categories[i] + " (" + CBase.Songs.GetNumSongsNotSungInCategory(i) + " " + CBase.Language.Translate("TR_SONGS", _PartyModeID) + ")"; + string value = categories[i] + " (" + CBase.Songs.GetNumSongsNotSungInCategory(i) + " " + CBase.Language.Translate("TR_SONGS", PartyModeID) + ")"; _SelectSlides[_SelectSlideCategory].AddValue(value); } - _SelectSlides[_SelectSlideCategory].Selection = _Data.ScreenConfig.CategoryID; - _SelectSlides[_SelectSlideCategory].Visible = _Data.ScreenConfig.SongSource == ESongSource.TR_CATEGORY; + _SelectSlides[_SelectSlideCategory].Selection = _PartyMode.GameData.CategoryID; + _SelectSlides[_SelectSlideCategory].Visible = _PartyMode.GameData.SongSource == ESongSource.TR_CATEGORY; _SelectSlides[_SelectSlideGameMode].Visible = true; - _SelectSlides[_SelectSlideGameMode].SetValues((int)_Data.ScreenConfig.GameMode); + _SelectSlides[_SelectSlideGameMode].SetValues((int)_PartyMode.GameData.GameMode); } private void _UpdateSlides() { if (_SelectSlides[_SelectSlideNumFields].Selection == 0) - _Data.ScreenConfig.NumFields = 9; + _PartyMode.GameData.NumFields = 9; else if (_SelectSlides[_SelectSlideNumFields].Selection == 1) - _Data.ScreenConfig.NumFields = 16; + _PartyMode.GameData.NumFields = 16; else if (_SelectSlides[_SelectSlideNumFields].Selection == 2) - _Data.ScreenConfig.NumFields = 25; + _PartyMode.GameData.NumFields = 25; - _Data.ScreenConfig.SongSource = (ESongSource)_SelectSlides[_SelectSlideSongSource].Selection; - _Data.ScreenConfig.PlaylistID = _SelectSlides[_SelectSlidePlaylist].Selection; - _Data.ScreenConfig.CategoryID = _SelectSlides[_SelectSlideCategory].Selection; - _Data.ScreenConfig.GameMode = (EPartyGameMode)_SelectSlides[_SelectSlideGameMode].Selection; + _PartyMode.GameData.SongSource = (ESongSource)_SelectSlides[_SelectSlideSongSource].Selection; + _PartyMode.GameData.PlaylistID = _SelectSlides[_SelectSlidePlaylist].Selection; + _PartyMode.GameData.CategoryID = _SelectSlides[_SelectSlideCategory].Selection; + _PartyMode.GameData.GameMode = (EPartyGameMode)_SelectSlides[_SelectSlideGameMode].Selection; var gm = EGameMode.TR_GAMEMODE_NORMAL; - switch (_Data.ScreenConfig.GameMode) + switch (_PartyMode.GameData.GameMode) { case EPartyGameMode.TR_GAMEMODE_NORMAL: gm = EGameMode.TR_GAMEMODE_NORMAL; @@ -237,16 +199,16 @@ namespace VocaluxeLib.PartyModes.TicTacToe break; } - if (_Data.ScreenConfig.SongSource == ESongSource.TR_PLAYLIST) + if (_PartyMode.GameData.SongSource == ESongSource.TR_PLAYLIST) { if (CBase.Playlist.GetNumPlaylists() > 0) { - if (CBase.Playlist.GetSongCount(_Data.ScreenConfig.PlaylistID) > 0) + if (CBase.Playlist.GetSongCount(_PartyMode.GameData.PlaylistID) > 0) { _ConfigOk = false; - for (int i = 0; i < CBase.Playlist.GetSongCount(_Data.ScreenConfig.PlaylistID); i++) + for (int i = 0; i < CBase.Playlist.GetSongCount(_PartyMode.GameData.PlaylistID); i++) { - int id = CBase.Playlist.GetSong(_Data.ScreenConfig.PlaylistID, i).SongID; + int id = CBase.Playlist.GetSong(_PartyMode.GameData.PlaylistID, i).SongID; _ConfigOk = CBase.Songs.GetSongByID(id).AvailableGameModes.Any(mode => mode == gm); if (_ConfigOk) break; @@ -258,15 +220,15 @@ namespace VocaluxeLib.PartyModes.TicTacToe else _ConfigOk = false; } - if (_Data.ScreenConfig.SongSource == ESongSource.TR_CATEGORY) + if (_PartyMode.GameData.SongSource == ESongSource.TR_CATEGORY) { if (CBase.Songs.GetNumCategories() == 0) _ConfigOk = false; - else if (CBase.Songs.GetNumSongsNotSungInCategory(_Data.ScreenConfig.CategoryID) <= 0) + else if (CBase.Songs.GetNumSongsNotSungInCategory(_PartyMode.GameData.CategoryID) <= 0) _ConfigOk = false; else { - CBase.Songs.SetCategory(_Data.ScreenConfig.CategoryID); + CBase.Songs.SetCategory(_PartyMode.GameData.CategoryID); _ConfigOk = false; foreach (CSong song in CBase.Songs.GetVisibleSongs()) { @@ -277,7 +239,7 @@ namespace VocaluxeLib.PartyModes.TicTacToe CBase.Songs.SetCategory(-1); } } - if (_Data.ScreenConfig.SongSource == ESongSource.TR_ALLSONGS) + if (_PartyMode.GameData.SongSource == ESongSource.TR_ALLSONGS) { if (CBase.Songs.GetNumSongs() > 0) { @@ -291,18 +253,8 @@ namespace VocaluxeLib.PartyModes.TicTacToe else _ConfigOk = false; } - _SelectSlides[_SelectSlideCategory].Visible = _Data.ScreenConfig.SongSource == ESongSource.TR_CATEGORY; - _SelectSlides[_SelectSlidePlaylist].Visible = _Data.ScreenConfig.SongSource == ESongSource.TR_PLAYLIST; - } - - private void _Back() - { - _FadeTo(EScreens.ScreenParty); - } - - private void _Next() - { - _PartyMode.DataFromScreen(ThemeName, _Data); + _SelectSlides[_SelectSlideCategory].Visible = _PartyMode.GameData.SongSource == ESongSource.TR_CATEGORY; + _SelectSlides[_SelectSlidePlaylist].Visible = _PartyMode.GameData.SongSource == ESongSource.TR_PLAYLIST; } } } \ No newline at end of file diff --git a/PartyModes/PartyModeTicTacToe/CPartyScreenTicTacToeMain.cs b/PartyModes/PartyModeTicTacToe/CPartyScreenTicTacToeMain.cs index 1182b700..1ffe157b 100644 --- a/PartyModes/PartyModeTicTacToe/CPartyScreenTicTacToeMain.cs +++ b/PartyModes/PartyModeTicTacToe/CPartyScreenTicTacToeMain.cs @@ -23,12 +23,6 @@ using VocaluxeLib.Songs; namespace VocaluxeLib.PartyModes.TicTacToe { - public class CField - { - public CRound Content; - public CButton Button; - } - public enum EStatus { FieldChoosing, @@ -37,7 +31,9 @@ namespace VocaluxeLib.PartyModes.TicTacToe None } - public class CPartyScreenTicTacToeMain : CMenuParty + // ReSharper disable UnusedMember.Global + public class CPartyScreenTicTacToeMain : CPartyScreenTicTacToe + // ReSharper restore UnusedMember.Global { // Version number for theme files. Increment it, if you've changed something on the theme files! protected override int _ScreenVersion @@ -71,17 +67,13 @@ namespace VocaluxeLib.PartyModes.TicTacToe private bool _ExitPopupVisible; - private SDataFromScreen _Data; - private SDataToScreenMain _GameData; - - private List _Fields; + private List _Fields = new List(); private float _FieldFirstX = 25; private float _FieldFirstY = 25; private const int _FieldSpace = 10; private float _FieldSize = 100; private int _PreviewStream = -1; - private int _SelectedField = -1; private int _OldSelectedField = -1; private int[,] _Possibilities; @@ -99,20 +91,6 @@ namespace VocaluxeLib.PartyModes.TicTacToe _ButtonJokerRetryT2 }; _ThemeStatics = new string[] {_StaticPopupBG, _StaticAvatarT1, _StaticAvatarT2}; - - _Data = new SDataFromScreen(); - var config = new SFromScreenMain(); - _GameData = new SDataToScreenMain(); - config.SingRoundNr = 1; - config.Rounds = new List(); - config.Songs = new List(); - config.PlayerTeam1 = new List(); - config.PlayerTeam2 = new List(); - config.FadeToNameSelection = false; - config.FadeToSinging = false; - _Data.ScreenMain = config; - - _Fields = new List(); } public override void LoadTheme(string xmlPath) @@ -123,19 +101,6 @@ namespace VocaluxeLib.PartyModes.TicTacToe _Buttons[_ButtonField].Visible = false; } - public override void DataToScreen(object receivedData) - { - try - { - var config = (SDataToScreenMain)receivedData; - _GameData = config; - } - catch (Exception e) - { - CBase.Log.LogError("Error in party mode screen TicTacToe main. Can't cast received data from game mode " + ThemeName + ". " + e.Message); - } - } - public override bool HandleInput(SKeyEvent keyEvent) { base.HandleInput(keyEvent); @@ -149,7 +114,7 @@ namespace VocaluxeLib.PartyModes.TicTacToe case Keys.Escape: if (!_ExitPopupVisible) { - if (_GameData.CurrentRoundNr == 1 && _Status != EStatus.FieldSelected) + if (_PartyMode.GameData.CurrentRoundNr == 1 && _Status != EStatus.FieldSelected) _Back(); else if (_Status == EStatus.None) _EndParty(); @@ -165,28 +130,28 @@ namespace VocaluxeLib.PartyModes.TicTacToe { if (_Buttons[_ButtonNextRound].Selected) _NextRound(); - if (_Buttons[_ButtonBack].Selected && _GameData.CurrentRoundNr == 1 && _Status != EStatus.FieldSelected) + if (_Buttons[_ButtonBack].Selected && _PartyMode.GameData.CurrentRoundNr == 1 && _Status != EStatus.FieldSelected) _Back(); - if (_Buttons[_ButtonExit].Selected && (_GameData.CurrentRoundNr > 1 || _Status == EStatus.FieldSelected) && _Status != EStatus.None) + if (_Buttons[_ButtonExit].Selected && (_PartyMode.GameData.CurrentRoundNr > 1 || _Status == EStatus.FieldSelected) && _Status != EStatus.None) _ShowPopup(true); else if (_Status == EStatus.None) _EndParty(); - for (int i = 0; i < _GameData.NumFields; i++) + for (int i = 0; i < _PartyMode.GameData.NumFields; i++) { switch (_Status) { case EStatus.FieldChoosing: - if (_Fields[i].Button.Selected) + if (_Fields[i].Selected) { - _SelectedField = i; + _PartyMode.GameData.FieldNr = i; _FieldSelected(); } break; case EStatus.JokerRetry: - if (_Fields[i].Button.Selected) + if (_Fields[i].Selected) { - _SelectedField = i; + _PartyMode.GameData.FieldNr = i; _FieldSelectedAgain(); } break; @@ -221,7 +186,7 @@ namespace VocaluxeLib.PartyModes.TicTacToe { base.HandleMouse(mouseEvent); - if (mouseEvent.LB && _IsMouseOver(mouseEvent)) + if (mouseEvent.LB && _IsMouseOverCurSelection(mouseEvent)) { if (!_ExitPopupVisible) { @@ -236,22 +201,22 @@ namespace VocaluxeLib.PartyModes.TicTacToe else _ShowPopup(true); } - for (int i = 0; i < _GameData.NumFields; i++) + for (int i = 0; i < _PartyMode.GameData.NumFields; i++) { switch (_Status) { case EStatus.FieldChoosing: - if (_Fields[i].Button.Selected) + if (_Fields[i].Selected) { - _SelectedField = i; + _PartyMode.GameData.FieldNr = i; _FieldSelected(); } break; case EStatus.JokerRetry: - if (_Fields[i].Button.Selected) + if (_Fields[i].Selected) { - _SelectedField = i; + _PartyMode.GameData.FieldNr = i; _FieldSelectedAgain(); } break; @@ -282,7 +247,7 @@ namespace VocaluxeLib.PartyModes.TicTacToe { if (!_ExitPopupVisible) { - if (_GameData.CurrentRoundNr == 1 && _Status != EStatus.FieldSelected) + if (_PartyMode.GameData.CurrentRoundNr == 1 && _Status != EStatus.FieldSelected) _Back(); else if (_Status == EStatus.None) _EndParty(); @@ -304,19 +269,19 @@ namespace VocaluxeLib.PartyModes.TicTacToe _PreviewStream = -1; - if (_GameData.CurrentRoundNr == 1) + if (_PartyMode.GameData.CurrentRoundNr == 1) { _BuildWinnerPossibilities(); - _SelectedField = -1; + _PartyMode.GameData.FieldNr = -1; _Buttons[_ButtonBack].Visible = true; _Buttons[_ButtonExit].Visible = false; - _SetInteractionToButton(_Buttons[_ButtonBack]); + _SelectElement(_Buttons[_ButtonBack]); } else { _Buttons[_ButtonBack].Visible = false; _Buttons[_ButtonExit].Visible = true; - _SetInteractionToButton(_Buttons[_ButtonExit]); + _SelectElement(_Buttons[_ButtonExit]); } _Status = EStatus.FieldChoosing; @@ -325,7 +290,7 @@ namespace VocaluxeLib.PartyModes.TicTacToe _UpdateFieldContents(); int winner = _GetWinner(); - if (_GameData.CurrentRoundNr <= _GameData.NumFields && winner == 0) + if (_PartyMode.GameData.CurrentRoundNr <= _PartyMode.GameData.NumFields && winner == 0) { _UpdateTeamChoosingMessage(); _Texts[_TextNextPlayerT1].Visible = false; @@ -349,16 +314,16 @@ namespace VocaluxeLib.PartyModes.TicTacToe _Texts[_TextTeamChoosing].Visible = false; if (winner > 0) { - _Texts[_TextFinishMessage].Color = CBase.Theme.GetPlayerColor(winner); - _Texts[_TextFinishMessage].Text = CBase.Language.Translate("TR_SCREENMAIN_WINNER", _PartyModeID) + " " + CBase.Language.Translate("TR_TEAM", _PartyModeID) + " " + + _Texts[_TextFinishMessage].Color = CBase.Themes.GetPlayerColor(winner); + _Texts[_TextFinishMessage].Text = CBase.Language.Translate("TR_SCREENMAIN_WINNER", PartyModeID) + " " + CBase.Language.Translate("TR_TEAM", PartyModeID) + " " + winner; } else { _Texts[_TextFinishMessage].Color = new SColorF(1, 1, 1, 1); - _Texts[_TextFinishMessage].Text = CBase.Language.Translate("TR_SCREENMAIN_NOWINNER", _PartyModeID); + _Texts[_TextFinishMessage].Text = CBase.Language.Translate("TR_SCREENMAIN_NOWINNER", PartyModeID); } - _SetInteractionToButton(_Buttons[_ButtonExit]); + _SelectElement(_Buttons[_ButtonExit]); } _ShowPopup(false); @@ -369,34 +334,27 @@ namespace VocaluxeLib.PartyModes.TicTacToe return true; } - public override bool Draw() - { - base.Draw(); - return true; - } - public override void OnClose() { base.OnClose(); CBase.BackgroundMusic.SetDisabled(false); - CBase.Sound.Fade(_PreviewStream, 0f, 0.5f, EStreamAction.Close); + CBase.Sound.Fade(_PreviewStream, 0, 0.5f, EStreamAction.Close); } private void _CreateFields() { for (int i = 0; i < 25; i++) { - var f = new CField {Button = GetNewButton(_Buttons[_ButtonField])}; - f.Button.Visible = false; - f.Content = new CRound(); - _AddButton(f.Button); + CButton f = GetNewButton(_Buttons[_ButtonField]); + f.Visible = false; + _AddButton(f); _Fields.Add(f); } } private void _UpdateFields() { - var numOneRow = (int)Math.Sqrt(_GameData.NumFields); + var numOneRow = (int)Math.Sqrt(_PartyMode.GameData.NumFields); float fieldSizeY = ((float)CBase.Settings.GetRenderH() - 150 - numOneRow * _FieldSpace) / numOneRow; float fieldSizeX = ((float)CBase.Settings.GetRenderW() - 300 - numOneRow * _FieldSpace) / numOneRow; _FieldSize = Math.Min(fieldSizeX, fieldSizeY); @@ -408,14 +366,14 @@ namespace VocaluxeLib.PartyModes.TicTacToe float y = _FieldFirstY; for (int i = 0; i < _Fields.Count; i++) { - if (i < _GameData.NumFields) + if (i < _PartyMode.GameData.NumFields) { - _Fields[i].Button.Rect.W = _FieldSize; - _Fields[i].Button.Rect.H = _FieldSize; - _Fields[i].Button.Rect.X = x; - _Fields[i].Button.Rect.Y = y; - _Fields[i].Button.Visible = true; - _Fields[i].Button.Enabled = true; + _Fields[i].W = _FieldSize; + _Fields[i].H = _FieldSize; + _Fields[i].X = x; + _Fields[i].Y = y; + _Fields[i].Visible = true; + _Fields[i].Selectable = true; column++; if ((i + 1) >= numOneRow * (row + 1)) { @@ -429,44 +387,43 @@ namespace VocaluxeLib.PartyModes.TicTacToe } else { - _Fields[i].Button.Visible = false; - _Fields[i].Button.Enabled = false; + _Fields[i].Visible = false; + _Fields[i].Selectable = false; } } } private void _UpdateFieldContents() { - for (int i = 0; i < _GameData.Rounds.Count; i++) + for (int i = 0; i < _PartyMode.GameData.Rounds.Count; i++) { - _Fields[i].Button.Enabled = true; - _Fields[i].Button.Texture = _Buttons[_ButtonField].Texture; - _Fields[i].Button.Color = _Buttons[_ButtonField].Color; - _Fields[i].Button.SelColor = _Buttons[_ButtonField].SelColor; - _Fields[i].Content = _GameData.Rounds[i]; - if (_Fields[i].Content.Finished) + _Fields[i].Selectable = true; + _Fields[i].Texture = _Buttons[_ButtonField].Texture; + _Fields[i].Color = _Buttons[_ButtonField].Color; + _Fields[i].SelColor = _Buttons[_ButtonField].SelColor; + if (_PartyMode.GameData.Rounds[i].Finished) { - _Fields[i].Button.Enabled = false; - _Fields[i].Button.Texture = CBase.Songs.GetSongByID(_Fields[i].Content.SongID).CoverTextureBig; - _Fields[i].Button.Color = CBase.Theme.GetPlayerColor(_Fields[i].Content.Winner); - _Fields[i].Button.SelColor = CBase.Theme.GetPlayerColor(_Fields[i].Content.Winner); + _Fields[i].Selectable = false; + _Fields[i].Texture = CBase.Songs.GetSongByID(_PartyMode.GameData.Rounds[i].SongID).CoverTextureBig; + _Fields[i].Color = CBase.Themes.GetPlayerColor(_PartyMode.GameData.Rounds[i].Winner); + _Fields[i].SelColor = CBase.Themes.GetPlayerColor(_PartyMode.GameData.Rounds[i].Winner); } - if (_Status == EStatus.FieldSelected && _SelectedField == i) + if (_Status == EStatus.FieldSelected && _PartyMode.GameData.FieldNr == i) { - _Fields[i].Button.Texture = CBase.Songs.GetSongByID(_Fields[i].Content.SongID).CoverTextureBig; - _Fields[i].Button.Color = new SColorF(1, 1, 1, 1); - _Fields[i].Button.SelColor = new SColorF(1, 1, 1, 1); - _Fields[i].Button.Enabled = false; + _Fields[i].Texture = CBase.Songs.GetSongByID(_PartyMode.GameData.Rounds[i].SongID).CoverTextureBig; + _Fields[i].Color = new SColorF(1, 1, 1, 1); + _Fields[i].SelColor = new SColorF(1, 1, 1, 1); + _Fields[i].Selectable = false; } - if (_Status == EStatus.JokerRetry && _Fields[i].Content.Finished) + if (_Status == EStatus.JokerRetry && _PartyMode.GameData.Rounds[i].Finished) { - _Fields[i].Button.SelColor = CBase.Theme.GetPlayerColor(_GameData.Team + 1); - _Fields[i].Button.Enabled = true; + _Fields[i].SelColor = CBase.Themes.GetPlayerColor(_PartyMode.GameData.Team + 1); + _Fields[i].Selectable = true; } - if (_Status == EStatus.JokerRetry && !_Fields[i].Content.Finished) - _Fields[i].Button.Enabled = false; + if (_Status == EStatus.JokerRetry && !_PartyMode.GameData.Rounds[i].Finished) + _Fields[i].Selectable = false; if (_Status == EStatus.FieldSelected) - _Fields[i].Button.Enabled = false; + _Fields[i].Selectable = false; } } @@ -477,40 +434,29 @@ namespace VocaluxeLib.PartyModes.TicTacToe int singerTeam1 = 0; int singerTeam2 = 0; - if (_GameData.PlayerTeam1.Count > 0) + if (_PartyMode.GameData.PlayerTeam1.Count > 0) { - singerTeam1 = _GameData.PlayerTeam1[0]; - _GameData.PlayerTeam1.RemoveAt(0); + singerTeam1 = _PartyMode.GameData.PlayerTeam1[0]; + _PartyMode.GameData.PlayerTeam1.RemoveAt(0); } - if (_GameData.PlayerTeam2.Count > 0) + if (_PartyMode.GameData.PlayerTeam2.Count > 0) { - singerTeam2 = _GameData.PlayerTeam2[0]; - _GameData.PlayerTeam2.RemoveAt(0); + singerTeam2 = _PartyMode.GameData.PlayerTeam2[0]; + _PartyMode.GameData.PlayerTeam2.RemoveAt(0); } - _GameData.Rounds[_SelectedField].SingerTeam1 = singerTeam1; - _GameData.Rounds[_SelectedField].SingerTeam2 = singerTeam2; + _PartyMode.GameData.Rounds[_PartyMode.GameData.FieldNr].SingerTeam1 = singerTeam1; + _PartyMode.GameData.Rounds[_PartyMode.GameData.FieldNr].SingerTeam2 = singerTeam2; _UpdatePlayerInformation(); } - int songID = 0; - if (_GameData.Songs.Count > 0) - { - songID = _GameData.Songs[0]; - _GameData.Songs.RemoveAt(0); - } - CSong song = CBase.Songs.GetSongByID(songID); + _PartyMode.UpdateSongList(); + int songID = _PartyMode.GameData.Songs[0]; + _PartyMode.GameData.Songs.RemoveAt(0); - CBase.BackgroundMusic.SetDisabled(true); - - _PreviewStream = CBase.Sound.Load(song.GetMP3()); - CBase.Sound.SetPosition(_PreviewStream, song.Preview.StartTime); - CBase.Sound.SetStreamVolume(_PreviewStream, 0f); - CBase.Sound.Play(_PreviewStream); - CBase.Sound.Fade(_PreviewStream, CBase.Config.GetBackgroundMusicVolume(), 1f); + _StartPreview(songID); _Status = EStatus.FieldSelected; - _Fields[_SelectedField].Content.SongID = songID; - _GameData.Rounds[_SelectedField].SongID = songID; + _PartyMode.GameData.Rounds[_PartyMode.GameData.FieldNr].SongID = songID; _UpdateFieldContents(); _UpdateJokerButtons(); @@ -518,36 +464,40 @@ namespace VocaluxeLib.PartyModes.TicTacToe _Buttons[_ButtonExit].Visible = true; _Buttons[_ButtonBack].Visible = false; - _SetInteractionToButton(_Buttons[_ButtonNextRound]); + _SelectElement(_Buttons[_ButtonNextRound]); } private void _FieldSelectedAgain() { - int songID = _Fields[_SelectedField].Content.SongID; - CSong song = CBase.Songs.GetSongByID(songID); - CBase.BackgroundMusic.SetDisabled(true); - - _PreviewStream = CBase.Sound.Load(song.GetMP3()); - CBase.Sound.SetPosition(_PreviewStream, song.Preview.StartTime); - CBase.Sound.SetStreamVolume(_PreviewStream, 0f); - CBase.Sound.Play(_PreviewStream); - CBase.Sound.Fade(_PreviewStream, CBase.Config.GetBackgroundMusicVolume(), 1f); + int songID = _PartyMode.GameData.Rounds[_OldSelectedField].SongID; + _StartPreview(songID); _Status = EStatus.FieldSelected; - _Fields[_SelectedField].Content.SongID = songID; - _GameData.Rounds[_SelectedField].SongID = songID; - _GameData.Rounds[_SelectedField].SingerTeam1 = _GameData.Rounds[_OldSelectedField].SingerTeam1; - _GameData.Rounds[_SelectedField].SingerTeam2 = _GameData.Rounds[_OldSelectedField].SingerTeam2; + _PartyMode.GameData.Rounds[_PartyMode.GameData.FieldNr].SongID = songID; + _PartyMode.GameData.Rounds[_PartyMode.GameData.FieldNr].SingerTeam1 = _PartyMode.GameData.Rounds[_OldSelectedField].SingerTeam1; + _PartyMode.GameData.Rounds[_PartyMode.GameData.FieldNr].SingerTeam2 = _PartyMode.GameData.Rounds[_OldSelectedField].SingerTeam2; _UpdateFieldContents(); _UpdatePlayerInformation(); - _UpdateJokerButtons(); _Buttons[_ButtonNextRound].Visible = true; _Buttons[_ButtonExit].Visible = true; _Buttons[_ButtonBack].Visible = false; - _SetInteractionToButton(_Buttons[_ButtonNextRound]); + _SelectElement(_Buttons[_ButtonNextRound]); + } + + private void _StartPreview(int songID) + { + CSong song = CBase.Songs.GetSongByID(songID); + CBase.BackgroundMusic.SetDisabled(true); + + _PreviewStream = CBase.Sound.Load(song.GetMP3()); + CBase.Sound.SetGlobalVolume(CBase.Config.GetMusicVolume(EMusicType.Preview)); + CBase.Sound.SetPosition(_PreviewStream, song.Preview.StartTime); + CBase.Sound.SetStreamVolume(_PreviewStream, 0); + CBase.Sound.Play(_PreviewStream); + CBase.Sound.Fade(_PreviewStream, 100, 1f); } private void _UpdatePlayerInformation() @@ -556,12 +506,14 @@ namespace VocaluxeLib.PartyModes.TicTacToe _Texts[_TextNextPlayerT2].Visible = true; _Texts[_TextNextPlayerNameT1].Visible = true; _Texts[_TextNextPlayerNameT2].Visible = true; - _Texts[_TextNextPlayerNameT1].Text = CBase.Profiles.GetPlayerName(_GameData.ProfileIDsTeam1[_GameData.Rounds[_SelectedField].SingerTeam1]); - _Texts[_TextNextPlayerNameT2].Text = CBase.Profiles.GetPlayerName(_GameData.ProfileIDsTeam2[_GameData.Rounds[_SelectedField].SingerTeam2]); + _Texts[_TextNextPlayerNameT1].Text = + CBase.Profiles.GetPlayerName(_PartyMode.GameData.ProfileIDsTeam1[_PartyMode.GameData.Rounds[_PartyMode.GameData.FieldNr].SingerTeam1]); + _Texts[_TextNextPlayerNameT2].Text = + CBase.Profiles.GetPlayerName(_PartyMode.GameData.ProfileIDsTeam2[_PartyMode.GameData.Rounds[_PartyMode.GameData.FieldNr].SingerTeam2]); _Statics[_StaticAvatarT1].Visible = true; _Statics[_StaticAvatarT2].Visible = true; - _Statics[_StaticAvatarT1].Texture = CBase.Profiles.GetAvatar(_GameData.ProfileIDsTeam1[_GameData.Rounds[_SelectedField].SingerTeam1]); - _Statics[_StaticAvatarT2].Texture = CBase.Profiles.GetAvatar(_GameData.ProfileIDsTeam2[_GameData.Rounds[_SelectedField].SingerTeam2]); + _Statics[_StaticAvatarT1].Texture = CBase.Profiles.GetAvatar(_PartyMode.GameData.ProfileIDsTeam1[_PartyMode.GameData.Rounds[_PartyMode.GameData.FieldNr].SingerTeam1]); + _Statics[_StaticAvatarT2].Texture = CBase.Profiles.GetAvatar(_PartyMode.GameData.ProfileIDsTeam2[_PartyMode.GameData.Rounds[_PartyMode.GameData.FieldNr].SingerTeam2]); } private void _UseJoker(int teamNr, int jokerNum) @@ -570,9 +522,9 @@ namespace VocaluxeLib.PartyModes.TicTacToe { //Random-Joker case 0: - if (_GameData.NumJokerRandom[teamNr] > 0) + if (_PartyMode.GameData.NumJokerRandom[teamNr] > 0) { - _GameData.NumJokerRandom[teamNr]--; + _PartyMode.GameData.NumJokerRandom[teamNr]--; if (!CBase.Sound.IsFinished(_PreviewStream)) CBase.Sound.Fade(_PreviewStream, 0, 1, EStreamAction.Close); _FieldSelected(true); @@ -581,15 +533,15 @@ namespace VocaluxeLib.PartyModes.TicTacToe //Retry-Joker case 1: - if (_GameData.NumJokerRetry[teamNr] > 0 && _GameData.CurrentRoundNr > 1) + if (_PartyMode.GameData.NumJokerRetry[teamNr] > 0 && _PartyMode.GameData.CurrentRoundNr > 1) { - _GameData.NumJokerRetry[teamNr]--; - _GameData.Team = teamNr; + _PartyMode.GameData.NumJokerRetry[teamNr]--; + _PartyMode.GameData.Team = teamNr; if (!CBase.Sound.IsFinished(_PreviewStream)) CBase.Sound.Fade(_PreviewStream, 0, 1, EStreamAction.Close); _Status = EStatus.JokerRetry; - _OldSelectedField = _SelectedField; - _SelectedField = -1; + _OldSelectedField = _PartyMode.GameData.FieldNr; + _PartyMode.GameData.FieldNr = -1; _UpdateFieldContents(); _Buttons[_ButtonNextRound].Visible = false; } @@ -600,9 +552,9 @@ namespace VocaluxeLib.PartyModes.TicTacToe private void _UpdateTeamChoosingMessage() { - _Texts[_TextTeamChoosing].Color = CBase.Theme.GetPlayerColor(_GameData.Team + 1); - _Texts[_TextTeamChoosing].Text = CBase.Language.Translate("TR_TEAM", _PartyModeID) + " " + (_GameData.Team + 1) + "! " + - CBase.Language.Translate("TR_SCREENMAIN_TEAM_CHOOSE", _PartyModeID); + _Texts[_TextTeamChoosing].Color = CBase.Themes.GetPlayerColor(_PartyMode.GameData.Team + 1); + _Texts[_TextTeamChoosing].Text = CBase.Language.Translate("TR_TEAM", PartyModeID) + " " + (_PartyMode.GameData.Team + 1) + "! " + + CBase.Language.Translate("TR_SCREENMAIN_TEAM_CHOOSE", PartyModeID); if (_Status == EStatus.JokerRetry || _Status == EStatus.FieldChoosing) _Texts[_TextTeamChoosing].Visible = true; else @@ -613,35 +565,28 @@ namespace VocaluxeLib.PartyModes.TicTacToe { _Buttons[_ButtonJokerRandomT1].Visible = true; _Buttons[_ButtonJokerRandomT2].Visible = true; - _Buttons[_ButtonJokerRandomT1].Text.Text = _GameData.NumJokerRandom[0].ToString(); - _Buttons[_ButtonJokerRandomT2].Text.Text = _GameData.NumJokerRandom[1].ToString(); - _Buttons[_ButtonJokerRandomT1].Enabled = _GameData.NumJokerRandom[0] > 0; - _Buttons[_ButtonJokerRandomT2].Enabled = _GameData.NumJokerRandom[1] > 0; + _Buttons[_ButtonJokerRandomT1].Text.Text = _PartyMode.GameData.NumJokerRandom[0].ToString(); + _Buttons[_ButtonJokerRandomT2].Text.Text = _PartyMode.GameData.NumJokerRandom[1].ToString(); + _Buttons[_ButtonJokerRandomT1].Selectable = _PartyMode.GameData.NumJokerRandom[0] > 0; + _Buttons[_ButtonJokerRandomT2].Selectable = _PartyMode.GameData.NumJokerRandom[1] > 0; _Buttons[_ButtonJokerRetryT1].Visible = true; _Buttons[_ButtonJokerRetryT2].Visible = true; - _Buttons[_ButtonJokerRetryT1].Text.Text = _GameData.NumJokerRetry[0].ToString(); - _Buttons[_ButtonJokerRetryT2].Text.Text = _GameData.NumJokerRetry[1].ToString(); - _Buttons[_ButtonJokerRetryT1].Enabled = _GameData.NumJokerRetry[0] > 0; - _Buttons[_ButtonJokerRetryT2].Enabled = _GameData.NumJokerRetry[1] > 0; + _Buttons[_ButtonJokerRetryT1].Text.Text = _PartyMode.GameData.NumJokerRetry[0].ToString(); + _Buttons[_ButtonJokerRetryT2].Text.Text = _PartyMode.GameData.NumJokerRetry[1].ToString(); + _Buttons[_ButtonJokerRetryT1].Selectable = _PartyMode.GameData.NumJokerRetry[0] > 0 && _PartyMode.GameData.CurrentRoundNr > 1; + _Buttons[_ButtonJokerRetryT2].Selectable = _PartyMode.GameData.NumJokerRetry[1] > 0 && _PartyMode.GameData.CurrentRoundNr > 1; } private void _NextRound() { - CBase.Sound.Fade(_PreviewStream, 0f, 0.5f, EStreamAction.Close); - _Data.ScreenMain.Rounds = _GameData.Rounds; - _Data.ScreenMain.FadeToNameSelection = false; - _Data.ScreenMain.FadeToSinging = true; - _Data.ScreenMain.Songs = _GameData.Songs; - _Data.ScreenMain.SingRoundNr = _SelectedField; - _Data.ScreenMain.PlayerTeam1 = _GameData.PlayerTeam1; - _Data.ScreenMain.PlayerTeam2 = _GameData.PlayerTeam2; - _PartyMode.DataFromScreen(ThemeName, _Data); + CBase.Sound.Fade(_PreviewStream, 0, 0.5f, EStreamAction.Close); + _PartyMode.Next(); } private void _EndParty() { - CBase.Sound.Fade(_PreviewStream, 0f, 0.5f, EStreamAction.Close); - _FadeTo(EScreens.ScreenParty); + CBase.Sound.Fade(_PreviewStream, 0, 0.5f, EStreamAction.Close); + CBase.Graphics.FadeTo(EScreen.Party); } private void _ShowPopup(bool visible) @@ -654,21 +599,18 @@ namespace VocaluxeLib.PartyModes.TicTacToe _Buttons[_ButtonPopupNo].Visible = _ExitPopupVisible; if (_ExitPopupVisible) - _SetInteractionToButton(_Buttons[_ButtonPopupNo]); + _SelectElement(_Buttons[_ButtonPopupNo]); } private void _Back() { - CBase.Sound.Fade(_PreviewStream, 0f, 0.5f, EStreamAction.Close); - _Data.ScreenMain.FadeToNameSelection = true; - _Data.ScreenMain.FadeToSinging = false; - _Data.ScreenMain.SingRoundNr = _SelectedField; - _PartyMode.DataFromScreen(ThemeName, _Data); + CBase.Sound.Fade(_PreviewStream, 0, 0.5f, EStreamAction.Close); + _PartyMode.Back(); } - private int _BuildWinnerPossibilities() + private void _BuildWinnerPossibilities() { - var numOneRow = (int)Math.Sqrt(_GameData.NumFields); + var numOneRow = (int)Math.Sqrt(_PartyMode.GameData.NumFields); _Possibilities = new int[(numOneRow * 2) + 2,numOneRow]; for (int i = 0; i < _Possibilities.GetLength(0); i++) { @@ -693,7 +635,6 @@ namespace VocaluxeLib.PartyModes.TicTacToe _Possibilities[i, c] = (numOneRow - 1) * c + (numOneRow - 1); } } - return 0; } private int _GetWinner() @@ -703,8 +644,8 @@ namespace VocaluxeLib.PartyModes.TicTacToe var check = new List(); for (int j = 0; j < _Possibilities.GetLength(1); j++) { - if (_Fields[_Possibilities[i, j]].Content.Winner > 0) - check.Add(_Fields[_Possibilities[i, j]].Content.Winner); + if (_PartyMode.GameData.Rounds[_Possibilities[i, j]].Winner > 0) + check.Add(_PartyMode.GameData.Rounds[_Possibilities[i, j]].Winner); } if (check.Count != _Possibilities.GetLength(1)) continue; diff --git a/PartyModes/PartyModeTicTacToe/CPartyScreenTicTacToeNames.cs b/PartyModes/PartyModeTicTacToe/CPartyScreenTicTacToeNames.cs index ebc7eddf..8d0e6cae 100644 --- a/PartyModes/PartyModeTicTacToe/CPartyScreenTicTacToeNames.cs +++ b/PartyModes/PartyModeTicTacToe/CPartyScreenTicTacToeNames.cs @@ -15,7 +15,6 @@ // along with Vocaluxe. If not, see . #endregion -using System; using System.Collections.Generic; using VocaluxeLib.Menu; @@ -31,89 +30,57 @@ namespace VocaluxeLib.PartyModes.TicTacToe get { return 1; } } - private int _NumPlayerTeam1 = 2; - private int _NumPlayerTeam2 = 2; - - private SDataFromScreen _Data; + private new CPartyModeTicTacToe _PartyMode; public override void Init() { base.Init(); - - _Data.ScreenNames.ProfileIDsTeam1 = new List(); - _Data.ScreenNames.ProfileIDsTeam2 = new List(); - - _Data = new SDataFromScreen(); - var names = new SFromScreenNames {FadeToConfig = false, ProfileIDsTeam1 = new List(), ProfileIDsTeam2 = new List()}; - _Data.ScreenNames = names; - } - - public override void DataToScreen(object receivedData) - { - try - { - var config = (SDataToScreenNames)receivedData; - _Data.ScreenNames.ProfileIDsTeam1 = config.ProfileIDsTeam1; - _Data.ScreenNames.ProfileIDsTeam2 = config.ProfileIDsTeam2; - if (_Data.ScreenNames.ProfileIDsTeam1 == null) - _Data.ScreenNames.ProfileIDsTeam1 = new List(); - if (_Data.ScreenNames.ProfileIDsTeam2 == null) - _Data.ScreenNames.ProfileIDsTeam2 = new List(); - - _NumPlayerTeam1 = config.NumPlayerTeam1; - _NumPlayerTeam2 = config.NumPlayerTeam2; - - while (_Data.ScreenNames.ProfileIDsTeam1.Count > _NumPlayerTeam1) - _Data.ScreenNames.ProfileIDsTeam1.RemoveAt(_Data.ScreenNames.ProfileIDsTeam1.Count - 1); - while (_Data.ScreenNames.ProfileIDsTeam2.Count > _NumPlayerTeam2) - _Data.ScreenNames.ProfileIDsTeam2.RemoveAt(_Data.ScreenNames.ProfileIDsTeam2.Count - 1); - } - catch (Exception e) - { - CBase.Log.LogError("Error in party mode screen TicTacToe names. Can't cast received data from game mode " + ThemeName + ". " + e.Message); - } + _PartyMode = (CPartyModeTicTacToe)base._PartyMode; } public override void OnShow() { base.OnShow(); - SetPartyModeData(2, _NumPlayerTeam1 + _NumPlayerTeam2, new int[] {_NumPlayerTeam1, _NumPlayerTeam2}); - List[] ids = new List[] {_Data.ScreenNames.ProfileIDsTeam1, _Data.ScreenNames.ProfileIDsTeam2}; + + while (_PartyMode.GameData.ProfileIDsTeam1.Count > _PartyMode.GameData.NumPlayerTeam1) + _PartyMode.GameData.ProfileIDsTeam1.RemoveAt(_PartyMode.GameData.ProfileIDsTeam1.Count - 1); + while (_PartyMode.GameData.ProfileIDsTeam2.Count > _PartyMode.GameData.NumPlayerTeam2) + _PartyMode.GameData.ProfileIDsTeam2.RemoveAt(_PartyMode.GameData.ProfileIDsTeam2.Count - 1); + + SetPartyModeData(2, _PartyMode.GameData.NumPlayerTeam1 + _PartyMode.GameData.NumPlayerTeam2, + new int[] {_PartyMode.GameData.NumPlayerTeam1, _PartyMode.GameData.NumPlayerTeam2}); + List[] ids = new List[] {_PartyMode.GameData.ProfileIDsTeam1, _PartyMode.GameData.ProfileIDsTeam2}; SetPartyModeProfiles(ids); } public override void Back() { - SPartyNameOptions options = GetData(); - if (options.TeamList.Length == 2) + if (_TeamList.Length == 2) { - _Data.ScreenNames.ProfileIDsTeam1 = options.TeamList[0]; - _Data.ScreenNames.ProfileIDsTeam2 = options.TeamList[1]; + _PartyMode.GameData.ProfileIDsTeam1 = _TeamList[0]; + _PartyMode.GameData.ProfileIDsTeam2 = _TeamList[1]; } - if (options.NumPlayerTeams.Length == 2) + if (_NumPlayerTeams.Length == 2) { - _Data.ScreenNames.NumPlayerTeam1 = options.NumPlayerTeams[0]; - _Data.ScreenNames.NumPlayerTeam2 = options.NumPlayerTeams[1]; + _PartyMode.GameData.NumPlayerTeam1 = _NumPlayerTeams[0]; + _PartyMode.GameData.NumPlayerTeam2 = _NumPlayerTeams[1]; } - _Data.ScreenNames.FadeToConfig = true; - _PartyMode.DataFromScreen(ThemeName, _Data); + _PartyMode.Back(); } public override void Next() { - SPartyNameOptions options = GetData(); - if (options.TeamList.Length == 2) + if (_TeamList.Length == 2) { - _Data.ScreenNames.ProfileIDsTeam1 = options.TeamList[0]; - _Data.ScreenNames.ProfileIDsTeam2 = options.TeamList[1]; + _PartyMode.GameData.ProfileIDsTeam1 = _TeamList[0]; + _PartyMode.GameData.ProfileIDsTeam2 = _TeamList[1]; } - if (options.NumPlayerTeams.Length == 2) + if (_NumPlayerTeams.Length == 2) { - _Data.ScreenNames.NumPlayerTeam1 = options.NumPlayerTeams[0]; - _Data.ScreenNames.NumPlayerTeam2 = options.NumPlayerTeams[1]; + _PartyMode.GameData.NumPlayerTeam1 = _NumPlayerTeams[0]; + _PartyMode.GameData.NumPlayerTeam2 = _NumPlayerTeams[1]; } - _Data.ScreenNames.FadeToConfig = false; - _PartyMode.DataFromScreen(ThemeName, _Data); + _PartyMode.Next(); } } } \ No newline at end of file diff --git a/PitchTracker/PitchTracker.vcxproj b/PitchTracker/PitchTracker.vcxproj index 2435c698..06c0b94c 100644 --- a/PitchTracker/PitchTracker.vcxproj +++ b/PitchTracker/PitchTracker.vcxproj @@ -1,5 +1,5 @@  - + Debug @@ -28,26 +28,26 @@ DynamicLibrary true - v120_xp + v110_xp Unicode DynamicLibrary true - v120_xp + v110_xp Unicode DynamicLibrary false - v120_xp + v110_xp true Unicode DynamicLibrary false - v120_xp + v110_xp true Unicode diff --git a/ServerLib/CDiscover.cs b/ServerLib/CDiscover.cs index d78bc19b..1fef7ac1 100644 --- a/ServerLib/CDiscover.cs +++ b/ServerLib/CDiscover.cs @@ -104,8 +104,9 @@ namespace ServerLib IPEndPoint groupEp = new IPEndPoint(IPAddress.Any, _Port); listener.Client.ReceiveTimeout = timeout; - byte[] bytes = listener.Receive(ref groupEp); - string message = Encoding.UTF8.GetString(bytes, 0, bytes.Length); + //byte[] bytes = + listener.Receive(ref groupEp); + //string message = Encoding.UTF8.GetString(bytes, 0, bytes.Length); foundSomething = true; if (!knownServer.Contains(groupEp.Address.ToString())) diff --git a/ServerLib/CServer.cs b/ServerLib/CServer.cs index e4c46301..b085e2c1 100644 --- a/ServerLib/CServer.cs +++ b/ServerLib/CServer.cs @@ -33,6 +33,7 @@ namespace ServerLib private bool _Encrypted; public static SendKeyEventDelegate SendKeyEvent { internal get; set; } + public static SendKeyStringEventDelegate SendKeyStringEvent { internal get; set; } #region profile public static GetProfileDataDelegate GetProfileData { internal get; set; } diff --git a/ServerLib/CWebservice.cs b/ServerLib/CWebservice.cs index 97a8962c..fc385e89 100644 --- a/ServerLib/CWebservice.cs +++ b/ServerLib/CWebservice.cs @@ -58,6 +58,23 @@ namespace ServerLib CServer.SendKeyEvent(key); } + public void SendKeyStringEvent(string keyString, bool isShiftPressed = false, bool isAltPressed = false, bool isCtrlPressed = false) + { + if (!_CheckRight(EUserRights.UseKeyboard)) + return; + + if (CServer.SendKeyStringEvent == null) + { + if (WebOperationContext.Current != null) + { + WebOperationContext.Current.OutgoingResponse.StatusCode = HttpStatusCode.NotFound; + WebOperationContext.Current.OutgoingResponse.StatusDescription = "Not found"; + } + } + else + CServer.SendKeyStringEvent(keyString, isShiftPressed, isAltPressed, isCtrlPressed); + } + #region profile public int GetOwnProfileId() { @@ -111,7 +128,7 @@ namespace ServerLib public SProfileData GetProfile(int profileId) { Guid sessionKey = _GetSession(); - if (_CheckRight(EUserRights.ViewOtherProfiles) || CSessionControl.GetUserIdFromSession(sessionKey) == profileId) + if (CSessionControl.GetUserIdFromSession(sessionKey) == profileId || _CheckRight(EUserRights.ViewOtherProfiles)) { if (CServer.GetProfileData == null) return new SProfileData(); @@ -121,8 +138,7 @@ namespace ServerLib return CServer.GetProfileData(profileId, isReadonly); } - else - return new SProfileData(); + return new SProfileData(); } public SProfileData[] GetProfileList() @@ -295,12 +311,12 @@ namespace ServerLib #endregion #region playlist - public SPlaylistInfo[] GetPlaylists() + public SPlaylistData[] GetPlaylists() { return CServer.GetPlaylists(); } - public SPlaylistInfo GetPlaylist(int playlistId) + public SPlaylistData GetPlaylist(int playlistId) { return CServer.GetPlaylist(playlistId); } diff --git a/ServerLib/DataStructs.cs b/ServerLib/DataStructs.cs index 4d4bbed7..11942ac9 100644 --- a/ServerLib/DataStructs.cs +++ b/ServerLib/DataStructs.cs @@ -27,6 +27,8 @@ namespace ServerLib { public delegate bool SendKeyEventDelegate(string key); + public delegate bool SendKeyStringEventDelegate(string keyString, bool isShiftPressed, bool isAltPressed, bool isCtrlPressed); + #region profile public delegate SProfileData GetProfileDataDelegate(int profileId, bool isReadonly); @@ -67,9 +69,10 @@ namespace ServerLib [DataContract] public class CBase64Image { + // ReSharper disable InconsistentNaming [DataMember] private string base64Data = ""; - [DataMember] private string imageId = ""; + // ReSharper restore InconsistentNaming public CBase64Image(Image img, ImageFormat format) { @@ -128,9 +131,9 @@ namespace ServerLib #endregion #region playlists - public delegate SPlaylistInfo[] GetPlaylistsDelegate(); + public delegate SPlaylistData[] GetPlaylistsDelegate(); - public delegate SPlaylistInfo GetPlaylistDelegate(int playlistId); + public delegate SPlaylistData GetPlaylistDelegate(int playlistId); public delegate void AddSongToPlaylistDelegate(int songId, int playlistId, bool allowDuplicates); @@ -156,7 +159,7 @@ namespace ServerLib } [DataContract] - public struct SPlaylistInfo + public struct SPlaylistData { [DataMember] public int PlaylistId; [DataMember] public string PlaylistName; diff --git a/ServerLib/ICWebservice.cs b/ServerLib/ICWebservice.cs index 0305e418..1324c2d9 100644 --- a/ServerLib/ICWebservice.cs +++ b/ServerLib/ICWebservice.cs @@ -30,6 +30,11 @@ namespace ServerLib UriTemplate = "/sendKeyEvent?key={key}")] void SendKeyEvent(string key); + [OperationContract, WebInvoke(Method = "GET", + ResponseFormat = WebMessageFormat.Json, + UriTemplate = "/sendKeyStringEvent?keyString={keyString}&shift={isShiftPressed}&alt={isAltPressed}&ctrl={isCtrlPressed}")] + void SendKeyStringEvent(string keyString, bool isShiftPressed = false, bool isAltPressed = false, bool isCtrlPressed = false); + #region profile [OperationContract, WebInvoke(Method = "GET", ResponseFormat = WebMessageFormat.Json, @@ -128,12 +133,12 @@ namespace ServerLib [OperationContract, WebInvoke(Method = "GET", ResponseFormat = WebMessageFormat.Json, UriTemplate = "/getPlaylists")] - SPlaylistInfo[] GetPlaylists(); + SPlaylistData[] GetPlaylists(); [OperationContract, WebInvoke(Method = "GET", ResponseFormat = WebMessageFormat.Json, UriTemplate = "/getPlaylist?id={playlistId}")] - SPlaylistInfo GetPlaylist(int playlistId); + SPlaylistData GetPlaylist(int playlistId); [OperationContract, WebInvoke(Method = "GET", ResponseFormat = WebMessageFormat.Json, diff --git a/ServerLib/UserRoles.cs b/ServerLib/UserRoles.cs index 860b9d7f..bc3c9d37 100644 --- a/ServerLib/UserRoles.cs +++ b/ServerLib/UserRoles.cs @@ -22,6 +22,7 @@ namespace ServerLib [Flags] enum EUserRoles { + // ReSharper disable InconsistentNaming TR_USERROLE_GUEST = 0, TR_USERROLE_NORMAL = 1, TR_USERROLE_ADMIN = 2, @@ -29,5 +30,6 @@ namespace ServerLib TR_USERROLE_ADDSONGSUSER = 8, TR_USERROLE_PLAYLISTEDITOR = 16, TR_USERROLE_PROFILEEDITOR = 32 + // ReSharper restore InconsistentNaming } } \ No newline at end of file diff --git a/Vocaluxe.sln b/Vocaluxe.sln index fb446cb0..b3499d21 100644 --- a/Vocaluxe.sln +++ b/Vocaluxe.sln @@ -25,6 +25,13 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WebserverInitalConfig", "We EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "PitchTracker", "PitchTracker\PitchTracker.vcxproj", "{54A48AF7-515C-4EDD-B395-2BFFA096050A}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "VocaluxeTests", "VocaluxeTests\VocaluxeTests.csproj", "{93356718-3A0B-4784-AAE1-215065BFFC66}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{2BDDF9CE-271F-49C6-A92E-9CB6185ACF58}" + ProjectSection(SolutionItems) = preProject + Vocaluxe.testsettings = Vocaluxe.testsettings + EndProjectSection +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution DebugLinux|x64 = DebugLinux|x64 @@ -195,6 +202,26 @@ Global {54A48AF7-515C-4EDD-B395-2BFFA096050A}.ReleaseWin|x64.Build.0 = Release|x64 {54A48AF7-515C-4EDD-B395-2BFFA096050A}.ReleaseWin|x86.ActiveCfg = Release|Win32 {54A48AF7-515C-4EDD-B395-2BFFA096050A}.ReleaseWin|x86.Build.0 = Release|Win32 + {93356718-3A0B-4784-AAE1-215065BFFC66}.DebugLinux|x64.ActiveCfg = Debug|x64 + {93356718-3A0B-4784-AAE1-215065BFFC66}.DebugLinux|x64.Build.0 = Debug|x64 + {93356718-3A0B-4784-AAE1-215065BFFC66}.DebugLinux|x86.ActiveCfg = Debug|x86 + {93356718-3A0B-4784-AAE1-215065BFFC66}.DebugLinux|x86.Build.0 = Debug|x86 + {93356718-3A0B-4784-AAE1-215065BFFC66}.DebugWin|x64.ActiveCfg = Debug|x64 + {93356718-3A0B-4784-AAE1-215065BFFC66}.DebugWin|x64.Build.0 = Debug|x64 + {93356718-3A0B-4784-AAE1-215065BFFC66}.DebugWin|x86.ActiveCfg = Debug|x86 + {93356718-3A0B-4784-AAE1-215065BFFC66}.DebugWin|x86.Build.0 = Debug|x86 + {93356718-3A0B-4784-AAE1-215065BFFC66}.InstallerWin|x64.ActiveCfg = Release|x64 + {93356718-3A0B-4784-AAE1-215065BFFC66}.InstallerWin|x64.Build.0 = Release|x64 + {93356718-3A0B-4784-AAE1-215065BFFC66}.InstallerWin|x86.ActiveCfg = Release|x86 + {93356718-3A0B-4784-AAE1-215065BFFC66}.InstallerWin|x86.Build.0 = Release|x86 + {93356718-3A0B-4784-AAE1-215065BFFC66}.ReleaseLinux|x64.ActiveCfg = Release|x64 + {93356718-3A0B-4784-AAE1-215065BFFC66}.ReleaseLinux|x64.Build.0 = Release|x64 + {93356718-3A0B-4784-AAE1-215065BFFC66}.ReleaseLinux|x86.ActiveCfg = Release|x86 + {93356718-3A0B-4784-AAE1-215065BFFC66}.ReleaseLinux|x86.Build.0 = Release|x86 + {93356718-3A0B-4784-AAE1-215065BFFC66}.ReleaseWin|x64.ActiveCfg = Release|x64 + {93356718-3A0B-4784-AAE1-215065BFFC66}.ReleaseWin|x64.Build.0 = Release|x64 + {93356718-3A0B-4784-AAE1-215065BFFC66}.ReleaseWin|x86.ActiveCfg = Release|x86 + {93356718-3A0B-4784-AAE1-215065BFFC66}.ReleaseWin|x86.Build.0 = Release|x86 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/Vocaluxe.sln.DotSettings b/Vocaluxe.sln.DotSettings index 661e1a2c..a260a4fb 100644 --- a/Vocaluxe.sln.DotSettings +++ b/Vocaluxe.sln.DotSettings @@ -3,6 +3,7 @@ NotCompiledCode True True + True SOLUTION DO_NOT_SHOW DO_NOT_SHOW @@ -114,4 +115,9 @@ along with $SOLUTION$. If not, see <http://www.gnu.org/licenses/>.<Policy><Descriptor Staticness="Static, Instance" AccessRightKinds="Private, Protected, ProtectedInternal, Internal, Public" Description="Classes"><ElementKinds><Kind Name="CLASS" /></ElementKinds></Descriptor><Policy Inspect="True" Prefix="C" Suffix="" Style="AaBb" /></Policy> <Policy><Descriptor Staticness="Static, Instance" AccessRightKinds="Private, Protected" Description="Fields (not public)"><ElementKinds><Kind Name="FIELD" /><Kind Name="READONLY_FIELD" /><Kind Name="METHOD" /><Kind Name="PROPERTY" /></ElementKinds></Descriptor><Policy Inspect="True" Prefix="_" Suffix="" Style="AaBb" /></Policy> <Policy><Descriptor Staticness="Static, Instance" AccessRightKinds="Private, Protected, ProtectedInternal, Internal, Public" Description="Structs"><ElementKinds><Kind Name="STRUCT" /></ElementKinds></Descriptor><Policy Inspect="True" Prefix="S" Suffix="" Style="AaBb" /></Policy> + False + Vocaluxe.testsettings + True + False + True \ No newline at end of file diff --git a/Vocaluxe.testsettings b/Vocaluxe.testsettings new file mode 100644 index 00000000..ccf7a8c8 --- /dev/null +++ b/Vocaluxe.testsettings @@ -0,0 +1,28 @@ + + + Dies sind die standardmäßigen Testeinstellungen für einen lokalen Testlauf. + + + + + + + + + + + + + +
+
+
+
+ + + + + + + + \ No newline at end of file diff --git a/Vocaluxe/Base/CBackgroundMusic.cs b/Vocaluxe/Base/CBackgroundMusic.cs index d34d5432..1e38e42b 100644 --- a/Vocaluxe/Base/CBackgroundMusic.cs +++ b/Vocaluxe/Base/CBackgroundMusic.cs @@ -52,25 +52,25 @@ namespace Vocaluxe.Base public static bool VideoEnabled { get { return _PlaysPreview ? _PreviewPlayer.VideoEnabled : _SongPlayer.VideoEnabled; } - set { - if(_PlaysPreview) + set + { + if (_PlaysPreview) _PreviewPlayer.VideoEnabled = value; - else + else _SongPlayer.VideoEnabled = value; } } - public static bool CanSing - { - get + public static bool CanSing + { + get { if (_PlaysPreview) return false; - else - if (_BGMusicFiles.Contains(_CurrentPlaylistElement)) - return false; - else return true; - } + if (_BGMusicFiles.Contains(_CurrentPlaylistElement)) + return false; + return true; + } } public static bool Disabled @@ -85,7 +85,8 @@ namespace Vocaluxe.Base } } - public static bool RepeatSong { + public static bool RepeatSong + { get { return _SongPlayer.RepeatSong; } set { _SongPlayer.RepeatSong = value; } } @@ -100,17 +101,23 @@ namespace Vocaluxe.Base get { return _SongPlayer.SongHasVideo; } } - public static bool IsPlaying { get { return _PlaysPreview ? _PreviewPlayer.IsPlaying : _SongPlayer.IsPlaying; } } + public static bool IsPlaying + { + get { return _PlaysPreview ? _PreviewPlayer.IsPlaying : _SongPlayer.IsPlaying; } + } - public static bool IsPlayingPreview { get { return _PlaysPreview; } } + public static bool IsPlayingPreview + { + get { return _PlaysPreview; } + } public static string ArtistAndTitle { - get { + get + { if (_PlaysPreview) return _PreviewPlayer.ArtistAndTitle; - else - return _BGMusicFiles.Contains(_CurrentPlaylistElement) ? Path.GetFileNameWithoutExtension(_CurrentPlaylistElement.MusicFilePath) : _SongPlayer.ArtistAndTitle; + return _BGMusicFiles.Contains(_CurrentPlaylistElement) ? Path.GetFileNameWithoutExtension(_CurrentPlaylistElement.MusicFilePath) : _SongPlayer.ArtistAndTitle; } } @@ -119,7 +126,7 @@ namespace Vocaluxe.Base get { return _PlaysPreview ? _PreviewPlayer.Length : _SongPlayer.Length; } } - public static CTexture Cover + public static CTextureRef Cover { get { return _PlaysPreview ? _PreviewPlayer.Cover : _SongPlayer.Cover; } } @@ -154,21 +161,20 @@ namespace Vocaluxe.Base _AddBackgroundMusic(); _SongPlayer = new CSongPlayer(); - _SongPlayer.Volume = CConfig.BackgroundMusicVolume; - _PreviewPlayer = new CSongPlayer(); - _PreviewPlayer.Volume = CConfig.PreviewMusicVolume; - _PreviewPlayer.RepeatSong = true; + _PreviewPlayer = new CSongPlayer {RepeatSong = true}; - _VideoEnabled = (CConfig.VideoBackgrounds == EOffOn.TR_CONFIG_ON && CConfig.VideosToBackground == EOffOn.TR_CONFIG_ON); - SetMusicSource(CConfig.BackgroundMusicSource); + _VideoEnabled = (CConfig.Config.Video.VideoBackgrounds == EOffOn.TR_CONFIG_ON && CConfig.Config.Video.VideosToBackground == EOffOn.TR_CONFIG_ON); + SetMusicSource(CConfig.Config.Sound.BackgroundMusicSource); _Initialized = true; } public static void Close() { - _SongPlayer.Stop(); - _PreviewPlayer.Stop(); + if (_SongPlayer != null) + _SongPlayer.Stop(); + if (_PreviewPlayer != null) + _PreviewPlayer.Stop(); _BGMusicFiles.Clear(); _NotPlayedFiles.Clear(); @@ -179,17 +185,19 @@ namespace Vocaluxe.Base public static void Play() { - if (IsPlaying || (CConfig.BackgroundMusic != EBackgroundMusicOffOn.TR_CONFIG_ON && !_PlaysPreview)) + if (IsPlaying || (CConfig.Config.Sound.BackgroundMusic != EBackgroundMusicOffOn.TR_CONFIG_ON && !_PlaysPreview)) return; if (_PlaysPreview) _PreviewPlayer.Play(); - else if(CConfig.BackgroundMusic == EBackgroundMusicOffOn.TR_CONFIG_OFF) + else if (CConfig.Config.Sound.BackgroundMusic == EBackgroundMusicOffOn.TR_CONFIG_ON) + { if (_SongPlayer.SongLoaded) //Resume _SongPlayer.TogglePause(); else Next(); + } } public static void Stop() @@ -202,6 +210,7 @@ namespace Vocaluxe.Base _PreviewPlayer.Stop(); _PlaysPreview = false; Pause(); + CSound.SetGlobalVolume(CConfig.BackgroundMusicVolume); } else { @@ -218,7 +227,7 @@ namespace Vocaluxe.Base return; _PreviewPlayer.TogglePause(); } - else if (CConfig.BackgroundMusic == EBackgroundMusicOffOn.TR_CONFIG_ON) + else if (CConfig.Config.Sound.BackgroundMusic == EBackgroundMusicOffOn.TR_CONFIG_ON) { if (!_SongPlayer.SongLoaded) Next(); @@ -278,7 +287,7 @@ namespace Vocaluxe.Base public static void Update() { - if (!IsPlaying && (!_SongPlayer.SongLoaded || !_PreviewPlayer.SongLoaded) ) + if (!IsPlaying && (!_SongPlayer.SongLoaded || !_PreviewPlayer.SongLoaded)) return; if (_PlaysPreview) @@ -291,7 +300,7 @@ namespace Vocaluxe.Base } } - public static CTexture GetVideoTexture() + public static CTextureRef GetVideoTexture() { return _PlaysPreview ? _PreviewPlayer.GetVideoTexture() : _SongPlayer.GetVideoTexture(); } @@ -329,10 +338,13 @@ namespace Vocaluxe.Base if (song == null) return; + // ReSharper disable CompareOfFloatsByEqualityOperator if (start == 0f) start = song.Preview.StartTime; + // ReSharper restore CompareOfFloatsByEqualityOperator _PlaysPreview = true; + CSound.SetGlobalVolume(CConfig.PreviewMusicVolume); _PreviewPlayer.Load(song, start); float startposition = song.Preview.StartTime; @@ -364,6 +376,7 @@ namespace Vocaluxe.Base { _PreviewPlayer.Stop(); _PlaysPreview = false; + CSound.SetGlobalVolume(CConfig.BackgroundMusicVolume); } /// @@ -384,7 +397,7 @@ namespace Vocaluxe.Base { //Seek to #Start-Tag, if found float start = 0f; - if (_CurrentPlaylistElement.Start > 0.001 && CConfig.BackgroundMusicUseStart == EOffOn.TR_CONFIG_ON) + if (_CurrentPlaylistElement.Start > 0.001 && CConfig.Config.Sound.BackgroundMusicUseStart == EOffOn.TR_CONFIG_ON) start = _CurrentPlaylistElement.Start; _SongPlayer.Load(CBase.Songs.GetSongByID(_CurrentPlaylistElement.SongID), start, true); } @@ -439,6 +452,5 @@ namespace Vocaluxe.Base { return _BGMusicFiles.Contains(element); } - } } \ No newline at end of file diff --git a/Vocaluxe/Base/CConfig.cs b/Vocaluxe/Base/CConfig.cs index 98662afe..267b73c4 100644 --- a/Vocaluxe/Base/CConfig.cs +++ b/Vocaluxe/Base/CConfig.cs @@ -18,31 +18,22 @@ using System; using System.Collections.Generic; using System.Collections.ObjectModel; +using System.ComponentModel; using System.IO; using System.Linq; -using System.Text; using System.Text.RegularExpressions; using System.Windows.Forms; -using System.Xml; +using System.Xml.Serialization; using Vocaluxe.Lib.Sound.Record; using Vocaluxe.Lib.Webcam; using VocaluxeLib; using VocaluxeLib.Profile; +using VocaluxeLib.Xml; namespace Vocaluxe.Base { static class CConfig { - /// - /// Uniform settings for writing XML files. ALWAYS use this! - /// - public static readonly XmlWriterSettings XMLSettings = new XmlWriterSettings - { - Indent = true, - Encoding = Encoding.UTF8, - ConformanceLevel = ConformanceLevel.Document - }; - private static bool _Initialized; // Base file and folder names (formerly from CSettings but they can be changed) @@ -50,58 +41,149 @@ namespace Vocaluxe.Base public static string FileHighscoreDB = Path.Combine(CSettings.DataFolder, "HighscoreDB.sqlite"); private static string _FileConfig = Path.Combine(CSettings.DataFolder, "Config.xml"); - // Debug - public static EDebugLevel DebugLevel = EDebugLevel.TR_CONFIG_OFF; - public static EOffOn SaveModifiedSongs = EOffOn.TR_CONFIG_OFF; + // ReSharper disable UnassignedField.Global +#pragma warning disable 649 + // ReSharper disable MemberCanBePrivate.Global + public struct SConfigInfo + // ReSharper restore MemberCanBePrivate.Global + { + // ReSharper disable NotAccessedField.Global + // ReSharper disable NotAccessedField.Local + public string Version; + public string Time; + public string Platform; + public string OSVersion; + public int ProcessorCount; + public int Screens; + public string PrimaryScreenResolution; + public string Directory; + // ReSharper restore NotAccessedField.Local + // ReSharper restore NotAccessedField.Global + } - // Graphics + public struct SConfigDebug + { + [DefaultValue(EDebugLevel.TR_CONFIG_OFF)] public EDebugLevel DebugLevel; + [DefaultValue(EOffOn.TR_CONFIG_OFF)] public EOffOn SaveModifiedSongs; + } + + public struct SConfigGraphics + { #if WIN - public static ERenderer Renderer = ERenderer.TR_CONFIG_DIRECT3D; + [DefaultValue(ERenderer.TR_CONFIG_DIRECT3D)] public ERenderer Renderer; #else - public static ERenderer Renderer = ERenderer.TR_CONFIG_OPENGL; + [DefaultValue(ERenderer.TR_CONFIG_OPENGL)] public ERenderer Renderer; #endif - public static ETextureQuality TextureQuality = ETextureQuality.TR_CONFIG_TEXTURE_MEDIUM; - public static float MaxFPS = 60f; + [DefaultValue(ETextureQuality.TR_CONFIG_TEXTURE_MEDIUM)] public ETextureQuality TextureQuality; + [XmlRanged(32, 1024), DefaultValue(128)] public int CoverSize; - public static int ScreenW = 1024; - public static int ScreenH = 576; + [DefaultValue(1024)] public int ScreenW; + [DefaultValue(576)] public int ScreenH; + [DefaultValue(EGeneralAlignment.Middle)] public EGeneralAlignment ScreenAlignment; + [DefaultValue(0)] public int BorderLeft; + [DefaultValue(0)] public int BorderRight; + [DefaultValue(0)] public int BorderTop; + [DefaultValue(0)] public int BorderBottom; + [DefaultValue(EAntiAliasingModes.X0)] public EAntiAliasingModes AAMode; + [DefaultValue(60f)] public float MaxFPS; + [DefaultValue(EOffOn.TR_CONFIG_ON)] public EOffOn VSync; + [DefaultValue(EOffOn.TR_CONFIG_ON)] public EOffOn FullScreen; + [DefaultValue(0.4f), XmlRanged(0, 3)] public float FadeTime; + } - public static int BorderLeft; - public static int BorderRight; - public static int BorderTop; - public static int BorderBottom; + public struct SConfigTheme + { + [XmlElement("Name"), DefaultValue("Ambient")] public string Theme; + [DefaultValue("Blue")] public string Skin; + [XmlElement("Cover"), DefaultValue("Ambient Blue")] public string CoverTheme; + [DefaultValue(EOffOn.TR_CONFIG_ON)] public EOffOn DrawNoteLines; + [DefaultValue(EOffOn.TR_CONFIG_ON)] public EOffOn DrawToneHelper; + [DefaultValue(ETimerLook.TR_CONFIG_TIMERLOOK_EXPANDED)] public ETimerLook TimerLook; + [DefaultValue(EPlayerInfo.TR_CONFIG_PLAYERINFO_BOTH)] public EPlayerInfo PlayerInfo; + [DefaultValue(EFadePlayerInfo.TR_CONFIG_FADEPLAYERINFO_OFF)] public EFadePlayerInfo FadePlayerInfo; + [DefaultValue(ECoverLoading.TR_CONFIG_COVERLOADING_DYNAMIC)] public ECoverLoading CoverLoading; + [DefaultValue(ELyricStyle.Slide)] public ELyricStyle LyricStyle; + } - public static EAntiAliasingModes AAMode = EAntiAliasingModes.X0; + public struct SConfigSound + { + [DefaultValue(EPlaybackLib.GstreamerSharp)] public EPlaybackLib PlayBackLib; + [DefaultValue(ERecordLib.PortAudio)] public ERecordLib RecordLib; + [DefaultValue(EBufferSize.B2048)] public EBufferSize AudioBufferSize; + [XmlRanged(-500, 500)] public int AudioLatency; + // ReSharper disable MemberHidesStaticFromOuterClass + [DefaultValue(EBackgroundMusicOffOn.TR_CONFIG_ON)] public EBackgroundMusicOffOn BackgroundMusic; + [XmlRanged(0, 100), DefaultValue(30)] public int BackgroundMusicVolume; + [DefaultValue(EBackgroundMusicSource.TR_CONFIG_NO_OWN_MUSIC)] public EBackgroundMusicSource BackgroundMusicSource; + [DefaultValue(EOffOn.TR_CONFIG_ON)] public EOffOn BackgroundMusicUseStart; + [XmlRanged(0, 100), DefaultValue(50)] public int PreviewMusicVolume; + [XmlRanged(0, 100), DefaultValue(80)] public int GameMusicVolume; + // ReSharper restore MemberHidesStaticFromOuterClass + } - public static EOffOn VSync = EOffOn.TR_CONFIG_ON; - public static EOffOn FullScreen = EOffOn.TR_CONFIG_ON; + public struct SConfigGame + { + [DefaultValue(CSettings.FallbackLanguage)] public string Language; + public string[] SongFolder; + // ReSharper disable MemberHidesStaticFromOuterClass + [DefaultValue(ESongMenu.TR_CONFIG_TILE_BOARD)] public ESongMenu SongMenu; + // ReSharper restore MemberHidesStaticFromOuterClass + [DefaultValue(ESongSorting.TR_CONFIG_ARTIST)] public ESongSorting SongSorting; + [DefaultValue(EOffOn.TR_CONFIG_ON)] public EOffOn IgnoreArticles; + [DefaultValue(10)] public float ScoreAnimationTime; + [DefaultValue(ETimerMode.TR_CONFIG_TIMERMODE_REMAINING)] public ETimerMode TimerMode; + [XmlAltName("NumPlayer"), DefaultValue(2)] public int NumPlayers; + [DefaultValue(EOffOn.TR_CONFIG_OFF)] public EOffOn Tabs; + [DefaultValue(ELyricsPosition.TR_CONFIG_LYRICSPOSITION_BOTTOM)] public ELyricsPosition LyricsPosition; + [DefaultValue(0.1f)] public float MinLineBreakTime; //Minimum time to show the text before it is (to be) sung (if possible) + [XmlArrayItem("Player"), XmlArray] public string[] Players; + } - public static float FadeTime = 0.4f; - public static int CoverSize = 128; + public struct SConfigVideo + { + [DefaultValue(EVideoDecoder.FFmpeg)] public EVideoDecoder VideoDecoder; + [DefaultValue(EOffOn.TR_CONFIG_ON)] public EOffOn VideoBackgrounds; + [DefaultValue(EOffOn.TR_CONFIG_ON)] public EOffOn VideoPreview; + [DefaultValue(EOffOn.TR_CONFIG_ON)] public EOffOn VideosInSongs; + [DefaultValue(EOffOn.TR_CONFIG_OFF)] public EOffOn VideosToBackground; + [DefaultValue(EWebcamLib.OpenCV)] public EWebcamLib WebcamLib; + public SWebcamConfig? WebcamConfig; + } - // Theme - public static string Theme = "Ambient"; - public static string Skin = "Blue"; - public static string CoverTheme = "Blue"; - public static EOffOn DrawNoteLines = EOffOn.TR_CONFIG_ON; - public static EOffOn DrawToneHelper = EOffOn.TR_CONFIG_ON; - public static ETimerLook TimerLook = ETimerLook.TR_CONFIG_TIMERLOOK_EXPANDED; - public static EPlayerInfo PlayerInfo = EPlayerInfo.TR_CONFIG_PLAYERINFO_BOTH; - public static EFadePlayerInfo FadePlayerInfo = EFadePlayerInfo.TR_CONFIG_FADEPLAYERINFO_OFF; - public static ECoverLoading CoverLoading = ECoverLoading.TR_CONFIG_COVERLOADING_DYNAMIC; - public static ELyricStyle LyricStyle = ELyricStyle.Slide; + public struct SConfigRecord + { + public SMicConfig[] MicConfig; + [DefaultValue(200)] public int MicDelay; //[ms] + } - // Sound - public static EPlaybackLib PlayBackLib = EPlaybackLib.GstreamerSharp; - public static EBufferSize AudioBufferSize = EBufferSize.B2048; - public static int AudioLatency; - private static int _BackgroundMusicVolume = 30; - public static EBackgroundMusicOffOn BackgroundMusic = EBackgroundMusicOffOn.TR_CONFIG_ON; - public static EBackgroundMusicSource BackgroundMusicSource = EBackgroundMusicSource.TR_CONFIG_NO_OWN_MUSIC; - public static EOffOn BackgroundMusicUseStart = EOffOn.TR_CONFIG_ON; - private static int _PreviewMusicVolume = 50; - private static int _GameMusicVolume = 80; + public struct SConfigServer + { + [DefaultValue(EOffOn.TR_CONFIG_OFF)] public EOffOn ServerActive; + [DefaultValue(EOffOn.TR_CONFIG_OFF)] public EOffOn ServerEncryption; + [DefaultValue(3000)] public int ServerPort; + } +#pragma warning restore 649 + // ReSharper restore UnassignedField.Global + + public struct SConfig + { + // ReSharper disable NotAccessedField.Global + public SConfigInfo? Info; + // ReSharper restore NotAccessedField.Global + public SConfigDebug Debug; + public SConfigGraphics Graphics; + public SConfigTheme Theme; + public SConfigSound Sound; + public SConfigGame Game; + public SConfigVideo Video; + public SConfigRecord Record; + public SConfigServer Server; + } + + public static SConfig Config; + public static bool LoadOldThemeFiles; + public static event OnSongMenuChanged SongMenuChanged; //Folders public static readonly List SongFolders = new List @@ -109,7 +191,8 @@ namespace Vocaluxe.Base Path.Combine(CSettings.ProgramFolder, CSettings.FolderNameSongs) #if INSTALLER - ,Path.Combine(CSettings.DataFolder, CSettings.FolderNameSongs); + , + Path.Combine(CSettings.DataFolder, CSettings.FolderNameSongs) #endif }; /// @@ -124,517 +207,284 @@ namespace Vocaluxe.Base Path.Combine(CSettings.DataFolder, CSettings.FolderNameProfiles) }; - // Game - //public static ESongMenu SongMenu = ESongMenu.TR_CONFIG_TILE_BOARD; - public static ESongMenu SongMenu = ESongMenu.TR_CONFIG_TILE_BOARD; - public static ESongSorting SongSorting = ESongSorting.TR_CONFIG_ARTIST; - public static EOffOn IgnoreArticles = EOffOn.TR_CONFIG_ON; - public static float ScoreAnimationTime = 10; - public static ETimerMode TimerMode = ETimerMode.TR_CONFIG_TIMERMODE_REMAINING; - public static int NumPlayer = 2; - public static EOffOn Tabs = EOffOn.TR_CONFIG_OFF; - public static string Language = CSettings.FallbackLanguage; - public static ELyricsPosition LyricsPosition = ELyricsPosition.TR_CONFIG_LYRICSPOSITION_BOTTOM; - public static readonly string[] Players = new string[CSettings.MaxNumPlayer]; - - public static float MinLineBreakTime = 0.1f; //Minimum time to show the text before it is (to be) sung (if possible) - - // Video - public static EVideoDecoder VideoDecoder = EVideoDecoder.FFmpeg; - public static EOffOn VideoBackgrounds = EOffOn.TR_CONFIG_ON; - public static EOffOn VideoPreview = EOffOn.TR_CONFIG_ON; - public static EOffOn VideosInSongs = EOffOn.TR_CONFIG_ON; - public static EOffOn VideosToBackground = EOffOn.TR_CONFIG_OFF; - - // Record - public static ERecordLib RecordLib = ERecordLib.PortAudio; - public static readonly SMicConfig[] MicConfig = new SMicConfig[CSettings.MaxNumPlayer]; - public static int MicDelay = 200; //[ms] - - // Webcam - public static EWebcamLib WebcamLib = EWebcamLib.OpenCV; - public static SWebcamConfig WebcamConfig; - - // Server - public static EOffOn ServerActive = EOffOn.TR_CONFIG_OFF; - public static EOffOn ServerEncryption = EOffOn.TR_CONFIG_OFF; - public static int ServerPort = 3000; - //public static string ServerPassword = "vocaluxe"; - //Lists to save parameters and values private static readonly List _Params = new List(); private static readonly List _Values = new List(); + public static int GetVolumeByType(EMusicType type) + { + switch (type) + { + case EMusicType.Preview: + return PreviewMusicVolume; + case EMusicType.Game: + return GameMusicVolume; + case EMusicType.Background: + return BackgroundMusicVolume; + case EMusicType.None: + return 0; + default: + throw new ArgumentException("Invalid type: " + type); + } + } + + public static void SetVolumeByType(EMusicType type, int volume) + { + switch (type) + { + case EMusicType.Preview: + PreviewMusicVolume = volume; + break; + case EMusicType.Game: + GameMusicVolume = volume; + break; + case EMusicType.Background: + BackgroundMusicVolume = volume; + break; + default: + throw new ArgumentException("Invalid type: " + type); + } + } + public static int BackgroundMusicVolume { - get { return _BackgroundMusicVolume; } + get { return Config.Sound.BackgroundMusicVolume; } set { - _BackgroundMusicVolume = value.Clamp(0, 100); + Config.Sound.BackgroundMusicVolume = value.Clamp(0, 100); SaveConfig(); } } public static int GameMusicVolume { - get { return _GameMusicVolume; } + get { return Config.Sound.GameMusicVolume; } set { - _GameMusicVolume = value.Clamp(0, 100); + Config.Sound.GameMusicVolume = value.Clamp(0, 100); SaveConfig(); } } public static int PreviewMusicVolume { - get { return _PreviewMusicVolume; } + get { return Config.Sound.PreviewMusicVolume; } set { - _PreviewMusicVolume = value.Clamp(0, 100); + Config.Sound.PreviewMusicVolume = value.Clamp(0, 100); SaveConfig(); } } + public static ESongMenu SongMenu + { + get { return Config.Game.SongMenu; } + set + { + if (Config.Game.SongMenu == value) + return; + Config.Game.SongMenu = value; + if (SongMenuChanged != null) + SongMenuChanged(); + } + } + public static void Init() { if (_Initialized) return; // Init config file + _LoadConfig(); if (!File.Exists(_FileConfig)) SaveConfig(); - else - _LoadConfig(); _Initialized = true; } + private static bool _XmlErrorsOccured; + + private static void _HandleXmlError(CXmlException e) + { + _XmlErrorsOccured = true; + } + private static void _LoadConfig() { - CXMLReader xmlReader = CXMLReader.OpenFile(_FileConfig); - if (xmlReader == null) - return; - - xmlReader.TryGetEnumValue("//root/Debug/DebugLevel", ref DebugLevel); - xmlReader.TryGetEnumValue("//root/Debug/SaveModifiedSongs", ref SaveModifiedSongs); - - #region Graphics - xmlReader.TryGetEnumValue("//root/Graphics/Renderer", ref Renderer); - xmlReader.TryGetEnumValue("//root/Graphics/TextureQuality", ref TextureQuality); - xmlReader.TryGetIntValueRange("//root/Graphics/CoverSize", ref CoverSize, 32, 1024); - - xmlReader.TryGetIntValue("//root/Graphics/ScreenW", ref ScreenW); - xmlReader.TryGetIntValue("//root/Graphics/ScreenH", ref ScreenH); - - xmlReader.TryGetIntValue("//root/Graphics/BorderLeft", ref BorderLeft); - xmlReader.TryGetIntValue("//root/Graphics/BorderRight", ref BorderRight); - xmlReader.TryGetIntValue("//root/Graphics/BorderTop", ref BorderTop); - xmlReader.TryGetIntValue("//root/Graphics/BorderBottom", ref BorderBottom); - - xmlReader.TryGetEnumValue("//root/Graphics/AAMode", ref AAMode); - xmlReader.TryGetFloatValue("//root/Graphics/MaxFPS", ref MaxFPS); - xmlReader.TryGetEnumValue("//root/Graphics/VSync", ref VSync); - xmlReader.TryGetEnumValue("//root/Graphics/FullScreen", ref FullScreen); - xmlReader.TryGetFloatValue("//root/Graphics/FadeTime", ref FadeTime); - #endregion Graphics - - #region Theme - xmlReader.GetValue("//root/Theme/Name", out Theme, Theme); - xmlReader.GetValue("//root/Theme/Skin", out Skin, Skin); - xmlReader.GetValue("//root/Theme/Cover", out CoverTheme, CoverTheme); - xmlReader.TryGetEnumValue("//root/Theme/DrawNoteLines", ref DrawNoteLines); - xmlReader.TryGetEnumValue("//root/Theme/DrawToneHelper", ref DrawToneHelper); - xmlReader.TryGetEnumValue("//root/Theme/TimerLook", ref TimerLook); - xmlReader.TryGetEnumValue("//root/Theme/PlayerInfo", ref PlayerInfo); - xmlReader.TryGetEnumValue("//root/Theme/FadePlayerInfo", ref FadePlayerInfo); - xmlReader.TryGetEnumValue("//root/Theme/CoverLoading", ref CoverLoading); - xmlReader.TryGetEnumValue("//root/Theme/LyricStyle", ref LyricStyle); - #endregion Theme - - #region Sound - xmlReader.TryGetEnumValue("//root/Sound/PlayBackLib", ref PlayBackLib); - xmlReader.TryGetEnumValue("//root/Sound/RecordLib", ref RecordLib); - xmlReader.TryGetEnumValue("//root/Sound/AudioBufferSize", ref AudioBufferSize); - - xmlReader.TryGetIntValueRange("//root/Sound/AudioLatency", ref AudioLatency, -500, 500); - - xmlReader.TryGetEnumValue("//root/Sound/BackgroundMusic", ref BackgroundMusic); - xmlReader.TryGetIntValueRange("//root/Sound/BackgroundMusicVolume", ref _BackgroundMusicVolume); - xmlReader.TryGetEnumValue("//root/Sound/BackgroundMusicSource", ref BackgroundMusicSource); - xmlReader.TryGetEnumValue("//root/Sound/BackgroundMusicUseStart", ref BackgroundMusicUseStart); - xmlReader.TryGetIntValueRange("//root/Sound/PreviewMusicVolume", ref _PreviewMusicVolume); - xmlReader.TryGetIntValueRange("//root/Sound/GameMusicVolume", ref _GameMusicVolume); - #endregion Sound - - #region Game - // Songfolder - string value = String.Empty; - int i = 1; - while (xmlReader.GetValue("//root/Game/SongFolder" + i, out value, value)) + _XmlErrorsOccured = false; + var xml = new CXmlDeserializer(new CXmlErrorHandler(_HandleXmlError)); + if (File.Exists(_FileConfig)) { - if (i == 1) - SongFolders.Clear(); - SongFolders.Add(value); - value = String.Empty; - i++; + Config = xml.Deserialize(_FileConfig); + if (_XmlErrorsOccured) + CLog.LogError("There were some warnings or errors loading the config file. Some values might have been reset to their defaults."); } + else + Config = xml.DeserializeString(""); - xmlReader.TryGetEnumValue("//root/Game/SongMenu", ref SongMenu); - xmlReader.TryGetEnumValue("//root/Game/SongSorting", ref SongSorting); - xmlReader.TryGetEnumValue("//root/Game/IgnoreArticles", ref IgnoreArticles); - xmlReader.TryGetFloatValue("//root/Game/ScoreAnimationTime", ref ScoreAnimationTime); - xmlReader.TryGetEnumValue("//root/Game/TimerMode", ref TimerMode); - xmlReader.TryGetIntValue("//root/Game/NumPlayer", ref NumPlayer); - xmlReader.TryGetEnumValue("//root/Game/Tabs", ref Tabs); - xmlReader.GetValue("//root/Game/Language", out Language, Language); - xmlReader.TryGetEnumValue("//root/Game/LyricsPosition", ref LyricsPosition); - xmlReader.TryGetFloatValue("//root/Game/MinLineBreakTime", ref MinLineBreakTime); + if (Config.Game.SongFolder.Length > 0) + { + SongFolders.Clear(); + SongFolders.AddRange(Config.Game.SongFolder); + } + if ((Config.Game.ScoreAnimationTime > 0 && Config.Game.ScoreAnimationTime < 1) || Config.Game.ScoreAnimationTime < 0) + Config.Game.ScoreAnimationTime = 1; - if ((ScoreAnimationTime > 0 && ScoreAnimationTime < 1) || ScoreAnimationTime < 0) - ScoreAnimationTime = 1; + if (Config.Game.MinLineBreakTime < 0) + Config.Game.MinLineBreakTime = 0.1f; - if (MinLineBreakTime < 0) - MinLineBreakTime = 0.1f; + if (!Config.Game.NumPlayers.IsInRange(1, CSettings.MaxNumPlayer)) + Config.Game.NumPlayers = 2; + Array.Resize(ref Config.Game.Players, CSettings.MaxNumPlayer); - if (NumPlayer < 1 || NumPlayer > CSettings.MaxNumPlayer) - NumPlayer = 2; - - bool langExists = CLanguage.SetLanguage(Language); + bool langExists = CLanguage.SetLanguage(Config.Game.Language); if (langExists == false) { - Language = CSettings.FallbackLanguage; - CLanguage.SetLanguage(Language); + Config.Game.Language = CSettings.FallbackLanguage; + CLanguage.SetLanguage(Config.Game.Language); } - //Read players from config - for (i = 1; i <= CSettings.MaxNumPlayer; i++) - xmlReader.GetValue("//root/Game/Players/Player" + i, out Players[i - 1], String.Empty); - #endregion Game + Array.Resize(ref Config.Record.MicConfig, CSettings.MaxNumPlayer); + Config.Record.MicDelay = (int)(20 * Math.Round(Config.Record.MicDelay / 20.0)); - #region Video - xmlReader.TryGetEnumValue("//root/Video/VideoDecoder", ref VideoDecoder); - xmlReader.TryGetEnumValue("//root/Video/VideoBackgrounds", ref VideoBackgrounds); - xmlReader.TryGetEnumValue("//root/Video/VideoPreview", ref VideoPreview); - xmlReader.TryGetEnumValue("//root/Video/VideosInSongs", ref VideosInSongs); - xmlReader.TryGetEnumValue("//root/Video/VideosToBackground", ref VideosToBackground); + if (!Config.Server.ServerPort.IsInRange(1, 65535)) + Config.Server.ServerPort = 3000; - xmlReader.TryGetEnumValue("//root/Video/WebcamLib", ref WebcamLib); - WebcamConfig = new SWebcamConfig(); - xmlReader.GetValue("//root/Video/WebcamConfig/MonikerString", out WebcamConfig.MonikerString, String.Empty); - xmlReader.TryGetIntValue("//root/Video/WebcamConfig/Framerate", ref WebcamConfig.Framerate); - xmlReader.TryGetIntValue("//root/Video/WebcamConfig/Width", ref WebcamConfig.Width); - xmlReader.TryGetIntValue("//root/Video/WebcamConfig/Height", ref WebcamConfig.Height); - #endregion Video - - #region Record - for (int p = 1; p <= CSettings.MaxNumPlayer; p++) - { - MicConfig[p - 1] = new SMicConfig(0); - xmlReader.GetValue("//root/Record/MicConfig" + p + "/DeviceName", out MicConfig[p - 1].DeviceName, String.Empty); - xmlReader.GetValue("//root/Record/MicConfig" + p + "/DeviceDriver", out MicConfig[p - 1].DeviceDriver, String.Empty); - xmlReader.TryGetIntValue("//root/Record/MicConfig" + p + "/Channel", ref MicConfig[p - 1].Channel); - } - - xmlReader.TryGetIntValueRange("//root/Record/MicDelay", ref MicDelay, 0, 500); - MicDelay = (int)(20 * Math.Round(MicDelay / 20.0)); - #endregion Record - - #region Server - xmlReader.TryGetEnumValue("//root/Server/ServerActive", ref ServerActive); - xmlReader.TryGetEnumValue("//root/Server/ServerEncryption", ref ServerEncryption); - xmlReader.TryGetIntValue("//root/Server/ServerPort", ref ServerPort); - if (ServerPort < 1 || ServerPort > 65535) - ServerPort = 3000; - - //xmlReader.GetValue("//root/Server/ServerPassword", out ServerPassword, ServerPassword); - #endregion Server + Config.Info = new SConfigInfo + { + Version = CSettings.GetFullVersionText(), + Time = DateTime.Now.ToString(), + Platform = Environment.OSVersion.Platform.ToString(), + OSVersion = Environment.OSVersion.ToString(), + ProcessorCount = Environment.ProcessorCount, + Screens = Screen.AllScreens.Length, + PrimaryScreenResolution = Screen.PrimaryScreen.Bounds.Size.ToString(), + Directory = CSettings.ProgramFolder + }; } - public static bool SaveConfig() + private static string _GetComment(string elName) { - XmlWriter writer = null; - try + switch (elName) { - writer = XmlWriter.Create(_FileConfig, XMLSettings); - writer.WriteStartDocument(); - writer.WriteStartElement("root"); - - - writer.WriteStartElement("Info"); - - writer.WriteElementString("Version", CSettings.GetFullVersionText()); - writer.WriteElementString("Time", DateTime.Now.ToString()); - writer.WriteElementString("Platform", Environment.OSVersion.Platform.ToString()); - writer.WriteElementString("OSVersion", Environment.OSVersion.ToString()); - writer.WriteElementString("ProcessorCount", Environment.ProcessorCount.ToString()); - - writer.WriteElementString("Screens", Screen.AllScreens.Length.ToString()); - writer.WriteElementString("PrimaryScreenResolution", Screen.PrimaryScreen.Bounds.Size.ToString()); - - writer.WriteElementString("Directory", CSettings.ProgramFolder); - - writer.WriteEndElement(); - - #region Debug - writer.WriteStartElement("Debug"); - - writer.WriteComment("DebugLevel: " + CHelper.ListStrings(Enum.GetNames(typeof(EDebugLevel)))); - writer.WriteElementString("DebugLevel", Enum.GetName(typeof(EDebugLevel), DebugLevel)); - - writer.WriteComment("SaveModifiedSongs: " + CHelper.ListStrings(Enum.GetNames(typeof(EOffOn)))); - writer.WriteElementString("SaveModifiedSongs", Enum.GetName(typeof(EOffOn), SaveModifiedSongs)); - - writer.WriteEndElement(); - #endregion Debug - - #region Graphics - writer.WriteStartElement("Graphics"); - - writer.WriteComment("Renderer: " + CHelper.ListStrings(Enum.GetNames(typeof(ERenderer)))); - writer.WriteElementString("Renderer", Enum.GetName(typeof(ERenderer), Renderer)); - - writer.WriteComment("TextureQuality: " + CHelper.ListStrings(Enum.GetNames(typeof(ETextureQuality)))); - writer.WriteElementString("TextureQuality", Enum.GetName(typeof(ETextureQuality), TextureQuality)); - - writer.WriteComment("CoverSize (pixels): 32, 64, 128, 256, 512, 1024 (default: 128)"); - writer.WriteElementString("CoverSize", CoverSize.ToString()); - - writer.WriteComment("Screen width and height (pixels)"); - writer.WriteElementString("ScreenW", ScreenW.ToString()); - writer.WriteElementString("ScreenH", ScreenH.ToString()); - - writer.WriteComment("Screen borders (pixels)"); - writer.WriteElementString("BorderLeft", BorderLeft.ToString()); - writer.WriteElementString("BorderRight", BorderRight.ToString()); - writer.WriteElementString("BorderTop", BorderTop.ToString()); - writer.WriteElementString("BorderBottom", BorderBottom.ToString()); - - writer.WriteComment("AAMode: " + CHelper.ListStrings(Enum.GetNames(typeof(EAntiAliasingModes)))); - writer.WriteElementString("AAMode", Enum.GetName(typeof(EAntiAliasingModes), AAMode)); - - writer.WriteComment("MaxFPS should be between 1..200"); - writer.WriteElementString("MaxFPS", MaxFPS.ToString("#")); - - writer.WriteComment("VSync: " + CHelper.ListStrings(Enum.GetNames(typeof(EOffOn)))); - writer.WriteElementString("VSync", Enum.GetName(typeof(EOffOn), VSync)); - - writer.WriteComment("FullScreen: " + CHelper.ListStrings(Enum.GetNames(typeof(EOffOn)))); - writer.WriteElementString("FullScreen", Enum.GetName(typeof(EOffOn), FullScreen)); - - writer.WriteComment("FadeTime should be between 0..3 Seconds"); - writer.WriteElementString("FadeTime", FadeTime.ToString("#0.00")); - - writer.WriteEndElement(); - #endregion Graphics - - #region Theme - writer.WriteStartElement("Theme"); - - writer.WriteComment("Theme name"); - writer.WriteElementString("Name", Theme); - - writer.WriteComment("Skin name"); - writer.WriteElementString("Skin", Skin); - - writer.WriteComment("Name of cover-theme"); - writer.WriteElementString("Cover", CoverTheme); - - writer.WriteComment("Draw note-lines: " + CHelper.ListStrings(Enum.GetNames(typeof(EOffOn)))); - writer.WriteElementString("DrawNoteLines", Enum.GetName(typeof(EOffOn), DrawNoteLines)); - - writer.WriteComment("Draw tone-helper: " + CHelper.ListStrings(Enum.GetNames(typeof(EOffOn)))); - writer.WriteElementString("DrawToneHelper", Enum.GetName(typeof(EOffOn), DrawToneHelper)); - - writer.WriteComment("Look of timer: " + CHelper.ListStrings(Enum.GetNames(typeof(ETimerLook)))); - writer.WriteElementString("TimerLook", Enum.GetName(typeof(ETimerLook), TimerLook)); - - writer.WriteComment("Information about players on SingScreen: " + CHelper.ListStrings(Enum.GetNames(typeof(EPlayerInfo)))); - writer.WriteElementString("PlayerInfo", Enum.GetName(typeof(EPlayerInfo), PlayerInfo)); - - writer.WriteComment("Fade player-information with lyrics and notebars: " + CHelper.ListStrings(Enum.GetNames(typeof(EFadePlayerInfo)))); - writer.WriteElementString("FadePlayerInfo", Enum.GetName(typeof(EFadePlayerInfo), FadePlayerInfo)); - - writer.WriteComment("Cover Loading: " + CHelper.ListStrings(Enum.GetNames(typeof(ECoverLoading)))); - writer.WriteElementString("CoverLoading", Enum.GetName(typeof(ECoverLoading), CoverLoading)); - - writer.WriteComment("Lyric Style: " + CHelper.ListStrings(Enum.GetNames(typeof(ELyricStyle)))); - writer.WriteElementString("LyricStyle", Enum.GetName(typeof(ELyricStyle), LyricStyle)); - - writer.WriteEndElement(); - #endregion Theme - - #region Sound - writer.WriteStartElement("Sound"); - - writer.WriteComment("PlayBackLib: " + CHelper.ListStrings(Enum.GetNames(typeof(EPlaybackLib)))); - writer.WriteElementString("PlayBackLib", Enum.GetName(typeof(EPlaybackLib), PlayBackLib)); - - writer.WriteComment("RecordLib: " + CHelper.ListStrings(Enum.GetNames(typeof(ERecordLib)))); - writer.WriteElementString("RecordLib", Enum.GetName(typeof(ERecordLib), RecordLib)); - - writer.WriteComment("AudioBufferSize: " + CHelper.ListStrings(Enum.GetNames(typeof(EBufferSize)))); - writer.WriteElementString("AudioBufferSize", Enum.GetName(typeof(EBufferSize), AudioBufferSize)); - - writer.WriteComment("AudioLatency from -500 to 500 ms"); - writer.WriteElementString("AudioLatency", AudioLatency.ToString()); - - writer.WriteComment("Background Music: " + CHelper.ListStrings(Enum.GetNames(typeof(EBackgroundMusicOffOn)))); - writer.WriteElementString("BackgroundMusic", Enum.GetName(typeof(EBackgroundMusicOffOn), BackgroundMusic)); - - writer.WriteComment("Background Music Volume from 0 to 100"); - writer.WriteElementString("BackgroundMusicVolume", BackgroundMusicVolume.ToString()); - - writer.WriteComment("Background Music Source: " + CHelper.ListStrings(Enum.GetNames(typeof(EBackgroundMusicSource)))); - writer.WriteElementString("BackgroundMusicSource", Enum.GetName(typeof(EBackgroundMusicSource), BackgroundMusicSource)); - - writer.WriteComment("Background Music use start-tag of songs: " + CHelper.ListStrings(Enum.GetNames(typeof(EOffOn)))); - writer.WriteElementString("BackgroundMusicUseStart", Enum.GetName(typeof(EOffOn), BackgroundMusicUseStart)); - - writer.WriteComment("Preview Volume from 0 to 100"); - writer.WriteElementString("PreviewMusicVolume", PreviewMusicVolume.ToString()); - - writer.WriteComment("Game Volume from 0 to 100"); - writer.WriteElementString("GameMusicVolume", GameMusicVolume.ToString()); - - writer.WriteEndElement(); - #endregion Sound - - #region Game - writer.WriteStartElement("Game"); - - writer.WriteComment("Game-Language:"); - writer.WriteElementString("Language", Language); - - // SongFolder - writer.WriteComment("SongFolder: SongFolder1, SongFolder2, SongFolder3, ..."); - for (int i = 0; i < SongFolders.Count; i++) - writer.WriteElementString("SongFolder" + (i + 1), SongFolders[i]); - - writer.WriteComment("SongMenu: " + CHelper.ListStrings(Enum.GetNames(typeof(ESongMenu)))); - writer.WriteElementString("SongMenu", Enum.GetName(typeof(ESongMenu), SongMenu)); - - writer.WriteComment("SongSorting: " + CHelper.ListStrings(Enum.GetNames(typeof(ESongSorting)))); - writer.WriteElementString("SongSorting", Enum.GetName(typeof(ESongSorting), SongSorting)); - - writer.WriteComment("Ignore articles on song-sorting: " + CHelper.ListStrings(Enum.GetNames(typeof(EOffOn)))); - writer.WriteElementString("IgnoreArticles", Enum.GetName(typeof(EOffOn), IgnoreArticles)); - - writer.WriteComment("ScoreAnimationTime: Values >= 1 or 0 for no animation. Time is in seconds."); - writer.WriteElementString("ScoreAnimationTime", ScoreAnimationTime.ToString()); - - writer.WriteComment("TimerMode: " + CHelper.ListStrings(Enum.GetNames(typeof(ETimerMode)))); - writer.WriteElementString("TimerMode", Enum.GetName(typeof(ETimerMode), TimerMode)); - - writer.WriteComment("NumPlayer: 1.." + CSettings.MaxNumPlayer); - writer.WriteElementString("NumPlayer", NumPlayer.ToString()); - - writer.WriteComment("Order songs in tabs: " + CHelper.ListStrings(Enum.GetNames(typeof(EOffOn)))); - writer.WriteElementString("Tabs", Enum.GetName(typeof(EOffOn), Tabs)); - - writer.WriteComment("Position if lyrics on screen: " + CHelper.ListStrings(Enum.GetNames(typeof(ELyricsPosition)))); - writer.WriteElementString("LyricsPosition", Enum.GetName(typeof(ELyricsPosition), LyricsPosition)); - - writer.WriteComment("MinLineBreakTime: Value >= 0 in s. Minimum time the text is shown before it is to be sung"); - writer.WriteElementString("MinLineBreakTime", MinLineBreakTime.ToString()); - - writer.WriteComment("Default profile for players 1..." + CSettings.MaxNumPlayer + ":"); - writer.WriteStartElement("Players"); - for (int i = 1; i <= CSettings.MaxNumPlayer; i++) - writer.WriteElementString("Player" + i, Path.GetFileName(Players[i - 1])); - writer.WriteEndElement(); - - writer.WriteEndElement(); - #endregion Game - - #region Video - writer.WriteStartElement("Video"); - - writer.WriteComment("VideoDecoder: " + CHelper.ListStrings(Enum.GetNames(typeof(EVideoDecoder)))); - writer.WriteElementString("VideoDecoder", Enum.GetName(typeof(EVideoDecoder), VideoDecoder)); - - writer.WriteComment("VideoBackgrounds: " + CHelper.ListStrings(Enum.GetNames(typeof(EOffOn)))); - writer.WriteElementString("VideoBackgrounds", Enum.GetName(typeof(EOffOn), VideoBackgrounds)); - - writer.WriteComment("VideoPreview: " + CHelper.ListStrings(Enum.GetNames(typeof(EOffOn)))); - writer.WriteElementString("VideoPreview", Enum.GetName(typeof(EOffOn), VideoPreview)); - - writer.WriteComment("Show Videos while singing: " + CHelper.ListStrings(Enum.GetNames(typeof(EOffOn)))); - writer.WriteElementString("VideosInSongs", Enum.GetName(typeof(EOffOn), VideosInSongs)); - - writer.WriteComment("Show backgroundmusic videos as background: " + CHelper.ListStrings(Enum.GetNames(typeof(EOffOn)))); - writer.WriteElementString("VideosToBackground", Enum.GetName(typeof(EOffOn), VideosToBackground)); - - writer.WriteComment("WebcamLib: " + CHelper.ListStrings(Enum.GetNames(typeof(EWebcamLib)))); - writer.WriteElementString("WebcamLib", Enum.GetName(typeof(EWebcamLib), WebcamLib)); - - writer.WriteStartElement("WebcamConfig"); - - writer.WriteElementString("MonikerString", WebcamConfig.MonikerString); - writer.WriteElementString("Framerate", WebcamConfig.Framerate.ToString()); - writer.WriteElementString("Width", WebcamConfig.Width.ToString()); - writer.WriteElementString("Height", WebcamConfig.Height.ToString()); - - writer.WriteEndElement(); - - writer.WriteEndElement(); - #endregion Video - - #region Record - writer.WriteStartElement("Record"); - - for (int p = 1; p <= CSettings.MaxNumPlayer; p++) - { - if (MicConfig[p - 1].DeviceName != "" && MicConfig[p - 1].Channel > 0) - { - writer.WriteStartElement("MicConfig" + p); - - writer.WriteElementString("DeviceName", MicConfig[p - 1].DeviceName); - writer.WriteElementString("DeviceDriver", MicConfig[p - 1].DeviceDriver); - writer.WriteElementString("Channel", MicConfig[p - 1].Channel.ToString()); - - writer.WriteEndElement(); - } - } - - writer.WriteComment("Mic delay in ms. 0, 20, 40, 60 ... 500"); - writer.WriteElementString("MicDelay", MicDelay.ToString()); - - writer.WriteEndElement(); - #endregion Record - - #region Server - writer.WriteStartElement("Server"); - - writer.WriteComment("Server On/Off: " + CHelper.ListStrings(Enum.GetNames(typeof(EOffOn)))); - writer.WriteElementString("ServerActive", Enum.GetName(typeof(EOffOn), ServerActive)); - - writer.WriteComment("Server Encryption On/Off: " + CHelper.ListStrings(Enum.GetNames(typeof(EOffOn)))); - writer.WriteElementString("ServerEncryption", Enum.GetName(typeof(EOffOn), ServerEncryption)); - - writer.WriteComment("Server Port (default: 3000) [1..65535]"); - writer.WriteElementString("ServerPort", ServerPort.ToString()); - - //writer.WriteComment("Server Password (default: vocaluxe)"); - //writer.WriteElementString("ServerPassword", ServerPassword); - - writer.WriteEndElement(); - #endregion Server - - // End of File - writer.WriteEndElement(); //end of root - writer.WriteEndDocument(); - writer.Flush(); - writer.Close(); - writer = null; + case "DebugLevel": + return "DebugLevel: " + CHelper.ListStrings(Enum.GetNames(typeof(EDebugLevel))); + case "SaveModifiedSongs": + return "SaveModifiedSongs: " + CHelper.ListStrings(Enum.GetNames(typeof(EOffOn))); + case "Renderer": + return "Renderer: " + CHelper.ListStrings(Enum.GetNames(typeof(ERenderer))); + case "TextureQuality": + return "TextureQuality: " + CHelper.ListStrings(Enum.GetNames(typeof(ETextureQuality))); + case "CoverSize": + return "CoverSize (pixels): 32, 64, 128, 256, 512, 1024 (default: 128)"; + case "ScreenW": + return "Screen width and height (pixels)"; + case "BorderLeft": + return "Screen borders (pixels)"; + case "AAMode": + return "AAMode: " + CHelper.ListStrings(Enum.GetNames(typeof(EAntiAliasingModes))); + case "MaxFPS": + return "MaxFPS should be between 1..200"; + case "VSync": + return "VSync: " + CHelper.ListStrings(Enum.GetNames(typeof(EOffOn))); + case "FullScreen": + return "FullScreen: " + CHelper.ListStrings(Enum.GetNames(typeof(EOffOn))); + case "FadeTime": + return "FadeTime should be between 0..3 Seconds"; + case "Theme": + return "Theme name"; + case "Skin": + return "Skin name"; + case "Cover": + return "Name of cover-theme"; + case "DrawNoteLines": + return "Draw note-lines: " + CHelper.ListStrings(Enum.GetNames(typeof(EOffOn))); + case "DrawToneHelper": + return "Draw tone-helper: " + CHelper.ListStrings(Enum.GetNames(typeof(EOffOn))); + case "TimerLook": + return "Look of timer: " + CHelper.ListStrings(Enum.GetNames(typeof(ETimerLook))); + case "PlayerInfo": + return "Information about players on SingScreen: " + CHelper.ListStrings(Enum.GetNames(typeof(EPlayerInfo))); + case "FadePlayerInfo": + return "Fade player-information with lyrics and notebars: " + CHelper.ListStrings(Enum.GetNames(typeof(EFadePlayerInfo))); + case "CoverLoading": + return "Cover Loading: " + CHelper.ListStrings(Enum.GetNames(typeof(ECoverLoading))); + case "LyricStyle": + return "Lyric Style: " + CHelper.ListStrings(Enum.GetNames(typeof(ELyricStyle))); + case "PlayBackLib": + return "PlayBackLib: " + CHelper.ListStrings(Enum.GetNames(typeof(EPlaybackLib))); + case "RecordLib": + return "RecordLib: " + CHelper.ListStrings(Enum.GetNames(typeof(ERecordLib))); + case "AudioBufferSize": + return "AudioBufferSize: " + CHelper.ListStrings(Enum.GetNames(typeof(EBufferSize))); + case "AudioLatency": + return "AudioLatency from -500 to 500 ms"; + case "BackgroundMusic": + return "Background Music: " + CHelper.ListStrings(Enum.GetNames(typeof(EBackgroundMusicOffOn))); + case "BackgroundMusicVolume": + return "Background Music Volume from 0 to 100"; + case "BackgroundMusicSource": + return "Background Music Source: " + CHelper.ListStrings(Enum.GetNames(typeof(EBackgroundMusicSource))); + case "BackgroundMusicUseStart": + return "Background Music use start-tag of songs " + CHelper.ListStrings(Enum.GetNames(typeof(EOffOn))); + case "PreviewMusicVolume": + return "Preview Volume from 0 to 100"; + case "GameMusicVolume": + return "Game Volume from 0 to 100"; + case "Language": + return "Game-Language"; + case "SongFolder": + return "SongFolder: SongFolder1, SongFolder2, SongFolder3, ..."; + case "SongMenu": + return "SongMenu: " + CHelper.ListStrings(Enum.GetNames(typeof(ESongMenu))); + case "SongSorting": + return "SongSorting: " + CHelper.ListStrings(Enum.GetNames(typeof(ESongSorting))); + case "IgnoreArticles": + return "Ignore articles on song-sorting: " + CHelper.ListStrings(Enum.GetNames(typeof(EOffOn))); + case "ScoreAnimationTime": + return "ScoreAnimationTime: Values >= 1 or 0 for no animation. Time is in seconds."; + case "TimerMode": + return "TimerMode: " + CHelper.ListStrings(Enum.GetNames(typeof(ETimerMode))); + case "NumPlayers": + return "NumPlayers: 1.." + CSettings.MaxNumPlayer; + case "Tabs": + return "Order songs in tabs: " + CHelper.ListStrings(Enum.GetNames(typeof(EOffOn))); + case "LyricsPosition": + return "Position if lyrics on screen: " + CHelper.ListStrings(Enum.GetNames(typeof(ELyricsPosition))); + case "MinLineBreakTime": + return "MinLineBreakTime: Value >= 0 in s. Minimum time the text is shown before it is to be sung"; + case "Players": + return "Default profile for players 1..." + CSettings.MaxNumPlayer + ":"; + case "VideoDecoder": + return "VideoDecoder: " + CHelper.ListStrings(Enum.GetNames(typeof(EVideoDecoder))); + case "VideoBackgrounds": + return "VideoBackgrounds: " + CHelper.ListStrings(Enum.GetNames(typeof(EOffOn))); + case "VideoPreview": + return "VideoPreview: " + CHelper.ListStrings(Enum.GetNames(typeof(EOffOn))); + case "VideosInSongs": + return "Show Videos while singing: " + CHelper.ListStrings(Enum.GetNames(typeof(EOffOn))); + case "VideosToBackground": + return "Show backgroundmusic videos as background: " + CHelper.ListStrings(Enum.GetNames(typeof(EOffOn))); + case "WebcamLib": + return "WebcamLib: " + CHelper.ListStrings(Enum.GetNames(typeof(EWebcamLib))); + case "MicDelay": + return "Mic delay in ms. 0, 20, 40, 60 ... 500"; + case "ServerActive": + return "Server On/Off: " + CHelper.ListStrings(Enum.GetNames(typeof(EOffOn))); + case "ServerEncryption": + return "Server Encryption On/Off: " + CHelper.ListStrings(Enum.GetNames(typeof(EOffOn))); + case "ServerPort": + return "Server Port (default: 3000) [1..65535]"; + default: + return null; } - catch (Exception) - { - if (writer != null) - writer.Close(); - return false; - } - return true; + } + + public static void SaveConfig() + { + var xml = new CXmlSerializer(true, _GetComment); + xml.Serialize(_FileConfig, Config); } /// @@ -642,7 +492,7 @@ namespace Vocaluxe.Base /// public static float CalcCycleTime() { - return (1f / MaxFPS) * 1000f; + return (1f / Config.Graphics.MaxFPS) * 1000f; } /// @@ -705,13 +555,13 @@ namespace Vocaluxe.Base if (device.Channels >= 2) { //Set this device to player 1 - MicConfig[0].DeviceName = device.Name; - MicConfig[0].DeviceDriver = device.Driver; - MicConfig[0].Channel = 1; + Config.Record.MicConfig[0].DeviceName = device.Name; + Config.Record.MicConfig[0].DeviceDriver = device.Driver; + Config.Record.MicConfig[0].Channel = 1; //Set this device to player 2 - MicConfig[1].DeviceName = device.Name; - MicConfig[1].DeviceDriver = device.Driver; - MicConfig[1].Channel = 2; + Config.Record.MicConfig[1].DeviceName = device.Name; + Config.Record.MicConfig[1].DeviceDriver = device.Driver; + Config.Record.MicConfig[1].Channel = 2; return true; } @@ -727,16 +577,16 @@ namespace Vocaluxe.Base if (device.Channels >= 1) { //Set this device to player 1 - MicConfig[0].DeviceName = device.Name; - MicConfig[0].DeviceDriver = device.Driver; - MicConfig[0].Channel = 1; + Config.Record.MicConfig[0].DeviceName = device.Name; + Config.Record.MicConfig[0].DeviceDriver = device.Driver; + Config.Record.MicConfig[0].Channel = 1; if (device.Channels >= 2) { //Set this device to player 2 - MicConfig[1].DeviceName = device.Name; - MicConfig[1].DeviceDriver = device.Driver; - MicConfig[1].Channel = 2; + Config.Record.MicConfig[1].DeviceName = device.Name; + Config.Record.MicConfig[1].DeviceDriver = device.Driver; + Config.Record.MicConfig[1].Channel = 2; return true; } @@ -832,6 +682,11 @@ namespace Vocaluxe.Base ProfileFolders.Clear(); ProfileFolders.Add(value); break; + + case "oldtheme": + if (value == "yes") + LoadOldThemeFiles = true; + break; } } } @@ -889,12 +744,12 @@ namespace Vocaluxe.Base for (int j = 0; j < CSettings.MaxNumPlayer; j++) { CGame.Players[j].ProfileID = -1; - if (Players[j] == "" || profiles == null) + if (string.IsNullOrEmpty(Config.Game.Players[j])) continue; foreach (CProfile profile in profiles) { - if (Path.GetFileName(profile.FileName) == Players[j] && profile.Active == EOffOn.TR_CONFIG_ON) + if (Path.GetFileName(profile.FilePath) == Config.Game.Players[j] && profile.Active == EOffOn.TR_CONFIG_ON) { //Update Game-infos with player CGame.Players[j].ProfileID = profile.ID; diff --git a/Vocaluxe/Base/CCover.cs b/Vocaluxe/Base/CCover.cs index ac9cc10c..0a155740 100644 --- a/Vocaluxe/Base/CCover.cs +++ b/Vocaluxe/Base/CCover.cs @@ -17,34 +17,39 @@ using System; using System.Collections.Generic; +using System.Diagnostics; +using System.Drawing; using System.IO; +using System.Threading; +using System.Threading.Tasks; +using System.Linq; using VocaluxeLib; using VocaluxeLib.Draw; +using VocaluxeLib.Songs; +using VocaluxeLib.Xml; namespace Vocaluxe.Base { - struct SCoverTheme - { - public string Name; - public string Folder; - public string File; - } - static class CCover { - private static readonly Dictionary _Covers = new Dictionary(); - private static readonly List _CoverThemes = new List(); + private const string _NoCoverName = "No Cover"; + private const string _NoCoverNameAlt = "NoCover"; + private static readonly Dictionary _Covers = new Dictionary(); + private static readonly Dictionary _CoverGenerators = new Dictionary(); + private static readonly List _CoverThemes = new List(); + private static readonly CancellationTokenSource _CancelToken = new CancellationTokenSource(); - public static CTexture NoCover { get; private set; } + public static CTextureRef NoCover { get; private set; } - public static void Init() + public static bool Init() { _LoadCoverThemes(); - _LoadCover(CConfig.CoverTheme); + return _CoverThemes.Count != 0 && _LoadCovers(); } public static void Close() { + _CancelToken.Cancel(); _UnloadCovers(); _CoverThemes.Clear(); } @@ -54,14 +59,7 @@ namespace Vocaluxe.Base /// public static string[] CoverThemes { - get - { - var coverThemes = new List(); - for (int i = 0; i < _CoverThemes.Count; i++) - coverThemes.Add(_CoverThemes[i].Name); - - return coverThemes.ToArray(); - } + get { return _CoverThemes.Select(th => th.Info.Name).ToArray(); } } /// @@ -72,16 +70,16 @@ namespace Vocaluxe.Base { for (int i = 0; i < _CoverThemes.Count; i++) { - if (_CoverThemes[i].Name == CConfig.CoverTheme) + if (_CoverThemes[i].Info.Name == CConfig.Config.Theme.CoverTheme) return i; } return -1; } /// - /// Returns a STexture for a given cover name. Returns "NoCover" if the cover does not exist. + /// Returns a Texture reference for a given cover name. Returns "NoCover" if the cover does not exist. /// - public static CTexture Cover(string name) + public static CTextureRef Cover(string name) { lock (_Covers) { @@ -92,6 +90,32 @@ namespace Vocaluxe.Base } } + public static CTextureRef GenerateCover(string text, ECoverGeneratorType type, CSong firstSong) + { + CTextureRef texture = Cover(text); + if (texture != NoCover) + return texture; + texture = CDraw.CopyTexture(NoCover); + Task.Factory.StartNew(() => + { + _CancelToken.Token.ThrowIfCancellationRequested(); + Bitmap coverBmp = !_CoverGenerators.ContainsKey(type) + ? null : _CoverGenerators[type].GetCover(text, firstSong != null ? Path.Combine(firstSong.Folder, firstSong.CoverFileName) : null); + _CancelToken.Token.ThrowIfCancellationRequested(); + if (coverBmp == null && _CoverGenerators.ContainsKey(ECoverGeneratorType.Default)) + coverBmp = _CoverGenerators[ECoverGeneratorType.Default].GetCover(text, firstSong != null ? Path.Combine(firstSong.Folder, firstSong.CoverFileName) : null); + _CancelToken.Token.ThrowIfCancellationRequested(); + if (coverBmp != null) + CDraw.EnqueueTextureUpdate(texture, coverBmp); + _CancelToken.Token.ThrowIfCancellationRequested(); + }, _CancelToken.Token); + lock (_Covers) + { + _Covers.Add(text, texture); + } + return texture; + } + /// /// Returns true if a cover with the given name exists. /// MUST HOLD _Covers lock at this point @@ -107,7 +131,7 @@ namespace Vocaluxe.Base public static void ReloadCovers() { _UnloadCovers(); - _LoadCover(CConfig.CoverTheme); + _LoadCovers(); } private static void _UnloadCovers() @@ -116,24 +140,29 @@ namespace Vocaluxe.Base { foreach (string key in _Covers.Keys) { - CTexture texture = _Covers[key]; + CTextureRef texture = _Covers[key]; CDraw.RemoveTexture(ref texture); } _Covers.Clear(); } + lock (_CoverGenerators) + { + _CoverGenerators.Clear(); + } } /// /// Returns a SCoverTheme by cover-theme-name /// - private static SCoverTheme _CoverTheme(string coverThemeName) + private static SThemeCover _GetCoverTheme() { - for (int i = 0; i < _CoverThemes.Count; i++) + int index = GetCoverThemeIndex(); + if (index < 0) { - if (_CoverThemes[i].Name == coverThemeName) - return _CoverThemes[i]; + index = 0; + CConfig.Config.Theme.CoverTheme = _CoverThemes[0].Info.Name; } - return new SCoverTheme(); + return _CoverThemes[index]; } /// @@ -143,96 +172,118 @@ namespace Vocaluxe.Base { _CoverThemes.Clear(); - string path = Path.Combine(CSettings.ProgramFolder, CSettings.FolderNameCover); - List files = CHelper.ListFiles(path, "*.xml"); + string folderPath = Path.Combine(CSettings.ProgramFolder, CSettings.FolderNameCover); + List files = CHelper.ListFiles(folderPath, "*.xml"); + var xml = new CXmlDeserializer(); foreach (string file in files) { - CXMLReader xmlReader = CXMLReader.OpenFile(Path.Combine(path, file)); - - if (xmlReader != null) + SThemeCover theme; + try { - var coverTheme = new SCoverTheme(); + theme = xml.Deserialize(Path.Combine(folderPath, file)); + } + catch (CXmlException e) + { + CLog.LogError("Error loading cover theme " + file + ": " + e); + continue; + } - xmlReader.GetValue("//root/Info/Name", out coverTheme.Name, String.Empty); - xmlReader.GetValue("//root/Info/Folder", out coverTheme.Folder, String.Empty); - - if (coverTheme.Folder != "" && coverTheme.Name != "") - { - coverTheme.File = file; - - _CoverThemes.Add(coverTheme); - } + if (!String.IsNullOrEmpty(theme.Info.Folder) && !String.IsNullOrEmpty(theme.Info.Name)) + { + theme.FolderPath = Path.Combine(folderPath, theme.Info.Folder); + _CoverThemes.Add(theme); } } } /// - /// Loads all cover which are defined in the cover config file. + /// Loads all covers from the theme /// - private static void _LoadCover(string coverThemeName) + private static bool _LoadCovers() { - SCoverTheme coverTheme = _CoverTheme(coverThemeName); + SThemeCover coverTheme = _GetCoverTheme(); - if (String.IsNullOrEmpty(coverTheme.Name)) - return; + Debug.Assert(!String.IsNullOrEmpty(coverTheme.Info.Name)); - var ignoreList = new List(); + List files = CHelper.ListImageFiles(coverTheme.FolderPath, true, true); - string coverPath = Path.Combine(CSettings.ProgramFolder, CSettings.FolderNameCover, coverTheme.Folder); - List files = CHelper.ListImageFiles(coverPath, true, true); - - CXMLReader xmlReader = CXMLReader.OpenFile(Path.Combine(CSettings.ProgramFolder, CSettings.FolderNameCover, coverTheme.File)); lock (_Covers) { - if (xmlReader != null) - { - _Covers.Clear(); - List cover = xmlReader.GetNames("//root/Cover/*"); - foreach (string coverName in cover) - { - string name; - string filePath; - xmlReader.GetValue("//root/Cover/" + coverName + "/Name", out name, String.Empty); - xmlReader.GetValue("//root/Cover/" + coverName + "/Path", out filePath, String.Empty); - string coverFilePath = Path.Combine(CSettings.ProgramFolder, CSettings.FolderNameCover, coverTheme.Folder, filePath); - if (!File.Exists(coverFilePath)) - continue; - - _AddCover(name, coverFilePath); - ignoreList.Add(Path.GetFileName(coverFilePath)); - - if (name == "NoCover") - NoCover = _Covers[name]; - } - } - - foreach (string file in files) + _AddCover(Path.GetFileNameWithoutExtension(file), file); + if (_CoverExists(_NoCoverName)) + NoCover = _Covers[_NoCoverName]; + else if (_CoverExists(_NoCoverNameAlt)) + NoCover = _Covers[_NoCoverNameAlt]; + else { - if (!ignoreList.Contains(Path.GetFileName(file))) - _AddCover(Path.GetFileNameWithoutExtension(file), file); + CBase.Log.LogError("Covertheme \"" + coverTheme.Info.Name + "\" does not include a cover file named \"" + _NoCoverName + "\" and cannot be used!", true, true); + _UnloadCovers(); + // Remove current theme and recursively try the other themes + _CoverThemes.Remove(coverTheme); + return _CoverThemes.Count > 0 && _LoadCovers(); + } + } + _LoadCoverGenerators(coverTheme); + return true; + } + + public static ECoverGeneratorType _SongSortingToType(ESongSorting sorting) + { + switch (sorting) + { + case ESongSorting.TR_CONFIG_NONE: + return ECoverGeneratorType.Default; + case ESongSorting.TR_CONFIG_FOLDER: + return ECoverGeneratorType.Folder; + case ESongSorting.TR_CONFIG_ARTIST: + return ECoverGeneratorType.Artist; + case ESongSorting.TR_CONFIG_ARTIST_LETTER: + case ESongSorting.TR_CONFIG_TITLE_LETTER: + return ECoverGeneratorType.Letter; + case ESongSorting.TR_CONFIG_EDITION: + return ECoverGeneratorType.Edition; + case ESongSorting.TR_CONFIG_GENRE: + return ECoverGeneratorType.Genre; + case ESongSorting.TR_CONFIG_LANGUAGE: + return ECoverGeneratorType.Language; + case ESongSorting.TR_CONFIG_YEAR: + return ECoverGeneratorType.Year; + case ESongSorting.TR_CONFIG_DECADE: + return ECoverGeneratorType.Decade; + case ESongSorting.TR_CONFIG_DATEADDED: + return ECoverGeneratorType.Date; + default: + throw new ArgumentOutOfRangeException("sorting"); + } + } + + private static void _LoadCoverGenerators(SThemeCover coverTheme) + { + lock (_CoverGenerators) + { + foreach (SThemeCoverGenerator theme in coverTheme.CoverGenerators) + { + if (_CoverGenerators.ContainsKey(theme.Type)) + continue; + CCoverGenerator el = new CCoverGenerator(theme, coverTheme.FolderPath); + _CoverGenerators.Add(theme.Type, el); } } } /// /// Ads a cover with the given name if it does not exist yet - /// MUST HOLD _Covers lock at this point /// /// Name of the cover /// Filename of image file private static void _AddCover(string name, string file) { - CTexture texture = CDraw.AddTexture(file); - - if (!_CoverExists(name)) - _Covers.Add(name, texture); - else + lock (_Covers) { - CTexture tex = _Covers[name]; - CDraw.RemoveTexture(ref tex); - _Covers[name] = texture; + if (!_CoverExists(name)) + _Covers.Add(name, CDraw.AddTexture(file)); } } } diff --git a/Vocaluxe/Base/CCoverGenerator.cs b/Vocaluxe/Base/CCoverGenerator.cs new file mode 100644 index 00000000..1ff20fa9 --- /dev/null +++ b/Vocaluxe/Base/CCoverGenerator.cs @@ -0,0 +1,503 @@ +#region license +// This file is part of Vocaluxe. +// +// Vocaluxe is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Vocaluxe is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with Vocaluxe. If not, see . +#endregion + +using System; +using System.Collections.Generic; +using System.Diagnostics; +using System.Drawing; +using System.Drawing.Drawing2D; +using System.Drawing.Imaging; +using System.Drawing.Text; +using System.IO; +using Vocaluxe.Base.Fonts; +using VocaluxeLib; +using System.Linq; + +namespace Vocaluxe.Base +{ + /// + /// Class that generates Covers if the right Cover is missing + /// Themeable via the xml of the Cover theme + /// + class CCoverGenerator + { + private readonly bool _Valid; + private readonly SThemeCoverGenerator _Theme; + private readonly string _Image; + private readonly SColorF _TextColor; + private readonly SColorF _BGColor; + private const int _LineSpace = 5; + private readonly int _MarginLeft; + private readonly int _MarginRight; + private readonly int _MarginTop; + private readonly int _MarginBottom; + + /// + /// Split lines after special chars, descending priority + /// + private static readonly char[] _SplitCharPreferences = {':', '/', '-'}; + private static readonly char[] _SplitCharAfter = {':', '/', '-', ' ', ')', '.', '*', ','}; + private static readonly char[] _SplitCharBefore = {'('}; + + public CCoverGenerator(SThemeCoverGenerator theme, string basePath) + { + _Theme = theme; + _Valid = true; + _Valid &= _Theme.Text.Color.Get(-1, out _TextColor); + _Valid &= _Theme.BackgroundColor.Get(-1, out _BGColor); + if (_Valid) + { + _Image = Path.Combine(basePath, _Theme.Image); + _Valid = File.Exists(_Image); + } + _MarginLeft = theme.Text.Margin.Left.HasValue ? theme.Text.Margin.Left.Value : theme.Text.Margin.Default; + _MarginRight = theme.Text.Margin.Right.HasValue ? theme.Text.Margin.Right.Value : theme.Text.Margin.Default; + _MarginTop = theme.Text.Margin.Top.HasValue ? theme.Text.Margin.Top.Value : theme.Text.Margin.Default; + _MarginBottom = theme.Text.Margin.Bottom.HasValue ? theme.Text.Margin.Bottom.Value : theme.Text.Margin.Default; + } + + private class CTextElement + { + public readonly string Text; + public float Width, Height; + private readonly Graphics _Graphics; + private readonly Font _Font; + private float _WidthTrimmed = -1; + public float WidthTrimmed + { + get + { + if (_WidthTrimmed < 0f) + { + string text = Text.TrimEnd(null); + _WidthTrimmed = text.Length == Text.Length ? Width : _Graphics.MeasureString(text, _Font, -1, StringFormat.GenericTypographic).Width; + } + return _WidthTrimmed; + } + } + public int Line; + + public CTextElement(string text, Graphics g, Font font) + { + Text = text; + SizeF dimensions = g.MeasureString(text, font, -1, StringFormat.GenericTypographic); + Width = dimensions.Width; + Height = (dimensions.Height + font.Height) / 2; + _Graphics = g; + _Font = font; + } + + public void AdjustSize(float factor) + { + Width *= factor; + _WidthTrimmed *= factor; + Height *= factor; + } + } + + private void _DrawBackground(Graphics g, Bitmap bmpBackground, String firstCoverPath) + { + g.Clear(_BGColor.AsColor()); + + ImageAttributes ia = null; + if (_Theme.ShowFirstCover && !String.IsNullOrEmpty(firstCoverPath) && File.Exists(firstCoverPath)) + { + using (Bitmap bmp2 = new Bitmap(firstCoverPath)) + g.DrawImage(bmp2, bmpBackground.GetRect(), 0, 0, bmp2.Width, bmp2.Height, GraphicsUnit.Pixel); + ColorMatrix cm = new ColorMatrix {Matrix33 = _Theme.ImageAlpha}; + ia = new ImageAttributes(); + ia.SetColorMatrix(cm); + } + g.DrawImage(bmpBackground, bmpBackground.GetRect(), 0, 0, bmpBackground.Width, bmpBackground.Height, GraphicsUnit.Pixel, ia); + } + + private void _DrawText(Graphics g, Size bmpSize, CFont font, List elements) + { + Font fo = CFonts.GetSystemFont(font); + + float maxHeight = elements.Select(el => el.Height).Max(); + int lineCount = elements.Last().Line + 1; + + //Have to use size in em not pixels! + float emSize = fo.Size * fo.FontFamily.GetCellAscent(fo.Style) / fo.FontFamily.GetEmHeight(fo.Style); + float outlineSize = CFonts.GetOutlineSize(font) * font.Height; + SColorF outlineColorF = CFonts.GetOutlineColor(font); + outlineColorF.A = outlineColorF.A * _TextColor.A; + + using (var path = new GraphicsPath()) + using (var pen = new Pen(outlineColorF.AsColor(), outlineSize / 2)) + { + pen.LineJoin = LineJoin.Round; + pen.Alignment = PenAlignment.Outset; + float top = (bmpSize.Height - _MarginBottom - _MarginTop - maxHeight * lineCount) / 2 + _MarginTop; + int nextLineEl = 0; + for (int i = 0; i < lineCount; i++) + { + int firstEl = nextLineEl; + for (; nextLineEl < elements.Count; nextLineEl++) + { + if (elements[nextLineEl].Line > i) + break; + } + + string line = elements.GetRange(firstEl, nextLineEl - firstEl).Aggregate("", (current, element) => current + element.Text); + float left; + if (lineCount == 1 || (i == 1 && lineCount == 3)) + { + //Center Text if this is the only line or the middle line + float width = _GetWidth(elements, firstEl, nextLineEl - 1); + left = (bmpSize.Width - _MarginLeft - _MarginRight - width) / 2 + _MarginLeft; + } + else if (i == lineCount - 1) + { + //Place last line at right + float width = _GetWidth(elements, firstEl, nextLineEl - 1); + left = bmpSize.Width - width - _MarginRight; + } + else + left = _MarginLeft; + //g.DrawString(line, fo, new SolidBrush(_TextColor.AsColor()), left, top, StringFormat.GenericTypographic); + path.AddString(line, fo.FontFamily, (int)fo.Style, emSize, new PointF(left, top), StringFormat.GenericTypographic); + top += maxHeight + _LineSpace; + } + g.DrawPath(pen, path); + g.FillPath(new SolidBrush(_TextColor.AsColor()), path); + } + } + + public Bitmap GetCover(string text, string firstCoverPath) + { + if (!_Valid) + return null; + text = CLanguage.Translate(_Theme.Text.Text.Replace("%TEXT%", text)); + using (Bitmap bmpImage = new Bitmap(_Image)) + { + Bitmap bmp = new Bitmap(bmpImage.Width, bmpImage.Height, PixelFormat.Format32bppArgb); + try + { + using (Graphics g = Graphics.FromImage(bmp)) + { + g.SmoothingMode = SmoothingMode.AntiAlias; + g.InterpolationMode = InterpolationMode.HighQualityBicubic; + g.TextRenderingHint = TextRenderingHint.AntiAlias; + + _DrawBackground(g, bmpImage, firstCoverPath); + + if (text != "") + { + CFont font = new CFont(_Theme.Text.Font); + Font fo = CFonts.GetSystemFont(font); + IEnumerable textParts = _SplitText(text); + List elements = textParts.Select(line => new CTextElement(line, g, fo)).ToList(); + float factor = _DistributeText(elements, bmp.Width, bmp.Height); + foreach (CTextElement element in elements) + element.AdjustSize(factor); + font.Height *= factor / (1f + CFonts.GetOutlineSize(font)); //Adjust for outline size + _DrawText(g, bmp.GetSize(), font, elements); + } + } + return bmp; + } + catch (Exception) + { + bmp.Dispose(); + } + } + return null; + } + + /// + /// Distributes the text among max. 3 lines maximizing the height of the line
+ /// Sets the Line field in the elements + ///
+ /// Text with set Width and Height + /// Image Width + /// Image Height + /// Factor for resizing the text (Maximizing this factor means maximizing the height) + private float _DistributeText(List elements, int width, int height) + { + int availableWidth = width - _MarginLeft - _MarginRight; + int availableHeight = height - _MarginTop - _MarginBottom; + + float textHeight = elements.Select(el => el.Height).Max(); + + //Try 1 line: + float textWidth = _GetWidth(elements, 0); + int maxHeight = Math.Min(availableHeight, (int)_Theme.Text.Font.Size); + float factorH = maxHeight / textHeight; + float factorW = availableWidth / textWidth; + if (factorH <= factorW) + return factorH; //Limited by Height + float factor1 = factorW; + + //Try 2 lines + if (elements.Count == 1) + { + //Only 1 element -> 1 line + return factor1; + } + availableWidth -= _Theme.Text.Indent; + maxHeight = Math.Min(availableHeight / 2 - _LineSpace, (int)_Theme.Text.Font.Size); + factorH = maxHeight / textHeight; + if (factorH <= factor1) + return factor1; //Cannot get any bigger with more lines + int splitEl = _GetSplitElement(elements, textWidth / 2); + Debug.Assert(splitEl >= 0 && splitEl < elements.Count - 1); + float width1 = _GetWidth(elements, 0, splitEl); + float width2 = _GetWidth(elements, splitEl + 1); + factorW = availableWidth / Math.Max(width1, width2); + if (factorH <= factorW) + { + // Assertion: factorH>factor1 (check above) && factorH<=factorW --> Min(factorH,factorW)>factor 1 + // but for 2 lines it is limited by height + // --> Use 2 lines + _SetLine(elements, splitEl + 1, elements.Count - 1, 1); + return factorH; + } + // factor2 < factorH && factorH>factor1 + float factor2 = factorW; + + //Try 3 lines + maxHeight = Math.Min(availableHeight / 3 - 2 * _LineSpace, (int)_Theme.Text.Font.Size); + factorH = maxHeight / textHeight; + if (elements.Count == 2 || factorH <= Math.Max(factor1, factor2)) + { + //Only 2 elements or cannot get any bigger + if (factor2 <= factor1) + return factor1; + _SetLine(elements, splitEl + 1, elements.Count - 1, 1); + return factor2; + } + int splitEl21 = _GetSplitElement(elements, textWidth / 3, false); + int splitEl22 = _GetSplitElement(elements, textWidth / 3, true, splitEl21 + 1); + Debug.Assert(splitEl21 >= 0 && splitEl21 < splitEl22 && splitEl22 < elements.Count - 1); + float width21 = _GetWidth(elements, 0, splitEl21); + float width22 = _GetWidth(elements, splitEl21 + 1, splitEl22); + float width23 = _GetWidth(elements, splitEl22 + 1); + factorW = availableWidth / Math.Max(Math.Max(width21, width22), width23); + float factor3 = Math.Min(factorH, factorW); + if (factor3 > Math.Max(factor1, factor2)) + { + _SetLine(elements, splitEl21 + 1, splitEl22, 1); + _SetLine(elements, splitEl22 + 1, elements.Count - 1, 2); + return factor3; + } + if (factor2 > factor1) + { + _SetLine(elements, splitEl + 1, elements.Count - 1, 1); + return factor2; + } + return factor1; + } + + /// + /// Returns the width of the elements with index from start to end of the list (inclusive) if they are put on 1 line + /// + /// + /// + /// + private static float _GetWidth(List list, int start) + { + return _GetWidth(list, start, list.Count - 1); + } + + /// + /// Returns the width of the elements with index from start to end (inclusive) if they are put on 1 line + /// + /// + /// + /// + /// + private static float _GetWidth(List list, int start, int end) + { + if (start < 0) + start = 0; + if (end >= list.Count) + end = list.Count - 1; + if (start > end) + return 0f; + float width = list.GetRange(start, end - start).Select(el => el.Width).Sum(); + return width + list[end].WidthTrimmed; + } + + private static void _SetLine(List list, int start, int end, int line) + { + for (int i = start; i <= end; i++) + list[i].Line = line; + } + + /// + /// Find the element after which to split the line + /// + /// List with elements, width must be set + /// The requested line width + /// Split on one point or two + /// First element on line + /// Index of element AFTER which to split + private static int _GetSplitElement(List elements, float requestedWidth, bool singleSplit = true, int startElement = 0) + { + //Assert we have enough elements + Debug.Assert(singleSplit && elements.Count - startElement >= 2 || !singleSplit && elements.Count - startElement >= 3); + float curWidth = 0f; + int splitEl; + for (splitEl = startElement; splitEl < elements.Count; splitEl++) + { + curWidth += elements[splitEl].Width; + if (curWidth >= requestedWidth) + break; + } + + // At this point we can either keep splitEl on this line for move it to the next line + // ==> line with splitEl is to long, without it is to short. so find the best option + // Check if line starts or ends with a long word, than put that on a single line + if (splitEl == startElement) + return splitEl; + // These 2 conditions also cover if the text fits on 1 line + if (!singleSplit && splitEl >= elements.Count - 2) + return elements.Count - 3; // Make sure we have 2 elements left if in multi split mode! + if (splitEl >= elements.Count - 1) + return elements.Count - 2; // Make sure we have 1 element left! + + float diffWith = curWidth - requestedWidth; + float diffWithout = requestedWidth - (curWidth - elements[splitEl].Width); + if (!singleSplit) + { + // If we split in 3 lines, add the error of the next 2 lines to the current error for both cases + int splitEl2 = _GetSplitElement(elements, requestedWidth, true, splitEl + 1); + int splitEl3 = _GetSplitElement(elements, requestedWidth, true, splitEl); + diffWith += Math.Abs(requestedWidth - _GetWidth(elements, splitEl + 1, splitEl2)) + Math.Abs(requestedWidth - _GetWidth(elements, splitEl2 + 1)); + diffWithout += Math.Abs(requestedWidth - _GetWidth(elements, splitEl, splitEl3)) + Math.Abs(requestedWidth - _GetWidth(elements, splitEl3 + 1)); + } + float diff = diffWith - diffWithout; + //Differences below this value are considered acceptable + float equalDist = requestedWidth * 0.025f; + if (diff > equalDist) + return splitEl - 1; // width error with element is much higher than without -> put element on next line + if (diff < -equalDist) + return splitEl; // width error with element is much less than without -> keep element on line + + //The real split would be somewhere in the middle of the element so we can move it to either line + string tmp = elements[splitEl].Text.TrimEnd(null); + char lastCharWith = tmp[tmp.Length - 1]; + tmp = elements[splitEl - 1].Text.TrimEnd(null); + char lastCharWithout = tmp[tmp.Length - 1]; + //Check if last chars are special chars + if (Char.IsLetterOrDigit(lastCharWith)) + { + if (Char.IsLetterOrDigit(lastCharWithout)) + return startElement == 0 ? splitEl : splitEl - 1; //Both are alphanumeric, favor longer first lines but shorter middle lines + return splitEl - 1; //Split after non-alphanumeric char + } + if (Char.IsLetterOrDigit(lastCharWithout)) + return splitEl; //Split after non-alphanumeric char + + int indexWith = Array.IndexOf(_SplitCharPreferences, lastCharWith); + int indexWithout = Array.IndexOf(_SplitCharPreferences, lastCharWithout); + if (indexWith <= indexWithout) + return startElement == 0 ? splitEl : splitEl - 1; //favor longer first lines but shorter middle lines + return splitEl - 1; + } + + /// + /// Split the text in parts that can then be distributet among the lines + /// + /// + /// + private static IEnumerable _SplitText(string text) + { + Debug.Assert(!String.IsNullOrWhiteSpace(text)); + + text = text.Trim().TrimMultipleWs(); + List lines = new List(); + if (text.Length == 1) + { + lines.Add(text); + return lines; + } + //Split the text on non-letter chars + int curStart = 0; + for (int i = 1; i < text.Length - 1; i++) + { + if ((Array.IndexOf(_SplitCharAfter, text[i]) >= 0 && (Char.IsLetterOrDigit(text, i + 1) || Array.IndexOf(_SplitCharBefore, text[i + 1]) >= 0)) || + (Char.IsLetterOrDigit(text, i) && Array.IndexOf(_SplitCharBefore, text[i + 1]) >= 0)) + { + lines.Add(text.Substring(curStart, i - curStart + 1)); + curStart = ++i; + } + } + //Add the rest + lines.Add(text.Substring(curStart)); + + //Check for initials (like J. R.R. Tolkien) and join them + curStart = -1; + string curText = ""; + for (int i = 0; i < lines.Count; i++) + { + string part = lines[i].Trim(); + if (part.Length == 2 && part[1] == '.') + { + //Initials found, continue or start new + if (curStart < 0) + curStart = i; + curText += lines[i]; + } + else if (curStart >= 0) + { + //Initials end + if (curStart < i - 1) + { + //More than 1 part + lines[curStart] = curText; + lines.RemoveRange(curStart + 1, i - curStart - 1); + i = curStart; + } + curText = ""; + curStart = -1; + } + } + //Handle last part + if (curStart >= 0) + { + //Initials end + if (curStart < lines.Count - 1) + { + //More than 1 part + lines[curStart] = curText; + lines.RemoveRange(curStart + 1, lines.Count - curStart - 1); + } + } + + // Remove single char lines + for (int i = 0; i < lines.Count; i++) + { + string part = lines[i]; + if (part.Trim().Length == 1) + { + lines.RemoveAt(i); + if (i == 0) + lines[0] = part + lines[0]; + else + { + lines[i - 1] += part; + i--; + } + } + } + return lines; + } + } +} \ No newline at end of file diff --git a/Vocaluxe/Base/CCursor.cs b/Vocaluxe/Base/CCursor.cs index 46a6e2b1..fe8629d8 100644 --- a/Vocaluxe/Base/CCursor.cs +++ b/Vocaluxe/Base/CCursor.cs @@ -18,6 +18,7 @@ using System; using System.Diagnostics; using System.Drawing; +using Vocaluxe.Base.ThemeSystem; using VocaluxeLib; using VocaluxeLib.Draw; @@ -27,7 +28,7 @@ namespace Vocaluxe.Base { private int _MouseMoveDiffMin = CSettings.MouseMoveDiffMinActive; private CFading _Fading; - private CTexture _Cursor; + private CTextureRef _Cursor; private Point _LastDiffPos; private readonly Stopwatch _Movetimer = new Stopwatch(); @@ -84,28 +85,28 @@ namespace Vocaluxe.Base _Cursor.Rect.Y = y; } - public void LoadTextures() + public void LoadSkin() { - _Cursor = CDraw.AddTexture(CTheme.GetSkinFilePath(CTheme.Cursor.SkinName, -1)); + SThemeCursor theme = CThemes.GetCursorTheme(); + _Cursor = CDraw.CopyTexture(CThemes.GetSkinTexture(theme.SkinName, -1)); - _Cursor.Color = !String.IsNullOrEmpty(CTheme.Cursor.Color) - ? CTheme.GetColor(CTheme.Cursor.Color, -1) : new SColorF(CTheme.Cursor.R, CTheme.Cursor.G, CTheme.Cursor.B, CTheme.Cursor.A); - _Cursor.Rect.W = CTheme.Cursor.W; - _Cursor.Rect.H = CTheme.Cursor.H; + theme.Color.Get(-1, out _Cursor.Color); + _Cursor.Rect.W = theme.W; + _Cursor.Rect.H = theme.H; _Cursor.Rect.Z = CSettings.ZNear; } - public void UnloadTextures() + public void UnloadSkin() { CDraw.RemoveTexture(ref _Cursor); } - public void ReloadTextures() + public void ReloadSkin() { int x = X; int y = Y; - UnloadTextures(); - LoadTextures(); + UnloadSkin(); + LoadSkin(); UpdatePosition(x, y); } diff --git a/Vocaluxe/Base/CDataBase.cs b/Vocaluxe/Base/CDataBase.cs index 6297433e..a3e6397d 100644 --- a/Vocaluxe/Base/CDataBase.cs +++ b/Vocaluxe/Base/CDataBase.cs @@ -93,7 +93,7 @@ namespace Vocaluxe.Base _HighscoreDB.IncreaseSongCounter(dataBaseSongID); } - public static bool GetCover(string fileName, ref CTexture tex, int maxSize) + public static bool GetCover(string fileName, ref CTextureRef tex, int maxSize) { return _CoverDB.GetCover(fileName, ref tex, maxSize); } @@ -103,7 +103,7 @@ namespace Vocaluxe.Base _CoverDB.CommitCovers(); } - public static bool GetCreditsRessource(string fileName, ref CTexture tex) + public static bool GetCreditsRessource(string fileName, ref CTextureRef tex) { return _ResourceDB.GetCreditsRessource(fileName, ref tex); } diff --git a/Vocaluxe/Base/CDraw.cs b/Vocaluxe/Base/CDraw.cs index f109645b..7b3b58d1 100644 --- a/Vocaluxe/Base/CDraw.cs +++ b/Vocaluxe/Base/CDraw.cs @@ -20,7 +20,6 @@ using System.Drawing; using Vocaluxe.Lib.Draw; using VocaluxeLib; using VocaluxeLib.Draw; -using VocaluxeLib.Menu; namespace Vocaluxe.Base { @@ -28,11 +27,15 @@ namespace Vocaluxe.Base { private static IDraw _Draw; + /// + /// Initializes the Driver selected in the config + /// + /// public static bool Init() { if (_Draw != null) return false; - switch (CConfig.Renderer) + switch (CConfig.Config.Graphics.Renderer) { case ERenderer.TR_CONFIG_SOFTWARE: _Draw = new CDrawWinForm(); @@ -74,158 +77,327 @@ namespace Vocaluxe.Base return _Draw.Init(); } + /// + /// Has to be called to start rendering
+ /// Will only return if program is closed
+ /// Also inits the first screen + ///
public static void MainLoop() { CGraphics.InitFirstScreen(); _Draw.MainLoop(); } - public static void Unload() + /// + /// Unloads the current driver, e.g. to switch to another one + /// + public static void Close() { if (_Draw != null) { - _Draw.Unload(); + _Draw.Close(); _Draw = null; } } + /// + /// Gets the width of the rendering area + /// + /// public static int GetScreenWidth() { return _Draw.GetScreenWidth(); } + /// + /// Gets the height of the rendering area + /// + /// public static int GetScreenHeight() { return _Draw.GetScreenHeight(); } - public static void DrawLine(int a, int r, int g, int b, int w, int x1, int y1, int x2, int y2) - { - _Draw.DrawLine(a, r, g, b, w, x1, y1, x2, y2); - } - - public static void DrawRect(SColorF color, SRectF rect, float thickness) - { - if (thickness <= 0f) - return; - - _Draw.DrawColor(color, new SRectF(rect.X - thickness / 2, rect.Y - thickness / 2, rect.W + thickness, thickness, rect.Z)); - _Draw.DrawColor(color, new SRectF(rect.X - thickness / 2, rect.Y + rect.H - thickness / 2, rect.W + thickness, thickness, rect.Z)); - _Draw.DrawColor(color, new SRectF(rect.X - thickness / 2, rect.Y - thickness / 2, thickness, rect.H + thickness, rect.Z)); - _Draw.DrawColor(color, new SRectF(rect.X + rect.W - thickness / 2, rect.Y - thickness / 2, thickness, rect.H + thickness, rect.Z)); - } - - public static void DrawColor(SColorF color, SRectF rect) - { - _Draw.DrawColor(color, rect); - } - - public static void DrawColorReflection(SColorF color, SRectF rect, float space, float height) - { - _Draw.DrawColorReflection(color, rect, space, height); - } - - public static void ClearScreen() - { - _Draw.ClearScreen(); - } - - public static CTexture CopyScreen() - { - return _Draw.CopyScreen(); - } - - public static void CopyScreen(ref CTexture texture) - { - _Draw.CopyScreen(ref texture); - } - + /// + /// Takes a screenshot and saves it to the Screenshot folder + /// public static void MakeScreenShot() { _Draw.MakeScreenShot(); } - public static CTexture AddTexture(Bitmap bitmap) + /// + /// Gets the current screen content as a texture + /// + /// + public static CTextureRef CopyScreen() + { + return _Draw.CopyScreen(); + } + + /// + /// Gets the current screen content updating the given texture + /// + /// + public static void CopyScreen(ref CTextureRef texture) + { + _Draw.CopyScreen(ref texture); + } + + /// + /// Adds a texture from a Bitmap and returns a reference to it
+ /// Must be called from main thread! + ///
+ /// + /// Reference to texture + public static CTextureRef AddTexture(Bitmap bitmap) { return _Draw.AddTexture(bitmap); } - public static CTexture AddTexture(string texturePath) + /// + /// Adds a texture from an image file given by its file path
+ /// Must be called from main thread! + ///
+ /// + /// Reference to texture or null on error + public static CTextureRef AddTexture(string texturePath) { return _Draw.AddTexture(texturePath); } - public static CTexture AddTexture(int w, int h, byte[] data) + /// + /// Adds a texture from a byte array
+ /// Must be called from main thread! + ///
+ /// Width of the image + /// Height of the image + /// Array of 4 byte values for each pixel + /// Reference to texture + public static CTextureRef AddTexture(int w, int h, byte[] data) { return _Draw.AddTexture(w, h, data); } - public static CTexture EnqueueTexture(int w, int h, byte[] data) + /// + /// Requests aadding a texture from a byte array
+ /// Use this if you add textures from another thread or don't need it immediatelly + ///
+ /// Width of the image + /// Height of the image + /// Array of 4 byte values for each pixel + /// Reference to texture + public static CTextureRef EnqueueTexture(int w, int h, byte[] data) { return _Draw.EnqueueTexture(w, h, data); } - public static bool UpdateTexture(CTexture texture, int w, int h, byte[] data) + /// + /// Requests adding a texture from a bitmap
+ /// Use this if you add textures from another thread or don't need it immediatelly + ///
+ /// Bitmap to add, gets disposed after adding! + /// Reference to texture + public static CTextureRef EnqueueTexture(Bitmap bmp) { - return _Draw.UpdateTexture(texture, w, h, data); + return _Draw.EnqueueTexture(bmp); } - public static bool UpdateOrAddTexture(ref CTexture texture, int w, int h, byte[] data) + /// + /// Requests adding a texture from a file
+ /// Use this if you add textures from another thread or don't need it immediatelly + ///
+ /// Full path to the image file + /// Reference to texture + public static CTextureRef EnqueueTexture(String texturePath) { - return _Draw.UpdateOrAddTexture(ref texture, w, h, data); + return _Draw.EnqueueTexture(texturePath); } - public static void RemoveTexture(ref CTexture texture) + /// + /// Requests updating a texture from a bitmap
+ /// Use this if you add textures from another thread or don't need it immediatelly
+ /// Bitmap is freed after use + ///
+ /// Reference to the texture to update + /// + public static void EnqueueTextureUpdate(CTextureRef textureRef, Bitmap bmp) { - _Draw.RemoveTexture(ref texture); + _Draw.EnqueueTextureUpdate(textureRef, bmp); } - public static void DrawTexture(CTexture texture) + /// + /// Creates a copy of the texture
+ /// Updates to the copy do not affect the original texture + ///
+ /// Original texture reference + /// New texture reference of the copy + public static CTextureRef CopyTexture(CTextureRef textureRef) { - _Draw.DrawTexture(texture); + return _Draw.CopyTexture(textureRef); } - public static void DrawTexture(CTexture texture, SRectF rect) + /// + /// Updates a texture, filling it with the new data + /// + /// + /// Width of the image + /// Height of the image + /// Array of 4 byte values for each pixel + public static void UpdateTexture(CTextureRef textureRef, int w, int h, byte[] data) { - _Draw.DrawTexture(texture, rect); + _Draw.UpdateTexture(textureRef, w, h, data); } - public static void DrawTexture(CTexture texture, SRectF rect, SColorF color, bool mirrored = false) + /// + /// Updates a texture, filling it with the new data from the bitmap + /// + /// + /// + public static void UpdateTexture(CTextureRef textureRef, Bitmap bmp) { - _Draw.DrawTexture(texture, rect, color, mirrored); + _Draw.UpdateTexture(textureRef, bmp); } - public static void DrawTexture(CTexture texture, SRectF rect, SColorF color, SRectF bounds, bool mirrored = false) + /// + /// Removes a texture from the VRAM and sets it to null to avoid accidential usage
+ /// Note: You can also use its Dispose method to do the same as this gets automaticly called from the Dispose method and destructor of a texture reference + ///
+ /// + public static void RemoveTexture(ref CTextureRef texture) { - _Draw.DrawTexture(texture, rect, color, bounds, mirrored); - } - - public static void DrawTexture(CTexture texture, SRectF rect, SColorF color, float begin, float end) - { - _Draw.DrawTexture(texture, rect, color, begin, end); - } - - public static void DrawTexture(CStatic staticBounds, CTexture texture, EAspect aspect) - { - if (texture == null) - return; - - var bounds = new RectangleF(staticBounds.Rect.X, staticBounds.Rect.Y, staticBounds.Rect.W, staticBounds.Rect.H); - RectangleF rect; - - CHelper.SetRect(bounds, out rect, texture.OrigAspect, aspect); - DrawTexture(texture, new SRectF(rect.X, rect.Y, rect.Width, rect.Height, staticBounds.Rect.Z), - texture.Color, new SRectF(bounds.X, bounds.Y, bounds.Width, bounds.Height, 0f)); - } - - public static void DrawTextureReflection(CTexture texture, SRectF rect, SColorF color, SRectF bounds, float space, float height) - { - _Draw.DrawTextureReflection(texture, rect, color, bounds, space, height); + // Disposed textures call this, possibly at program end! + if (_Draw != null) + _Draw.RemoveTexture(ref texture); } + /// + /// Returns the number of textures in the VRAM (textures might get reused so this might not be the actual number of textures in use) + /// + /// public static int TextureCount() { return _Draw.GetTextureCount(); } + + /// + /// Draws a simple (filled) rectangle with the given color + /// + /// + /// + public static void DrawRect(SColorF color, SRectF rect) + { + _Draw.DrawRect(color, rect); + } + + /// + /// Draws the reflection of a filled rectangle with the given color + /// + /// + /// (Original) rectangle to draw the reflection for + /// Spacing between the rect and the reflection + /// Height of the reflection + public static void DrawRectReflection(SColorF color, SRectF rect, float space, float height) + { + _Draw.DrawRectReflection(color, rect, space, height); + } + + /// + /// Draws a texture at its position and with its color + /// + /// The texture to be drawn + public static void DrawTexture(CTextureRef texture) + { + DrawTexture(texture, texture.Rect); + } + + /// + /// Draws a texture with its color at the given position + /// + /// The texture to be drawn + /// A rectangle with the destination coordinates + public static void DrawTexture(CTextureRef textureRef, SRectF rect) + { + DrawTexture(textureRef, rect, textureRef.Color); + } + + /// + /// Draws a texture at the given position with the given color + /// + /// + /// + /// + /// True to mirror the texture on the y axis + public static void DrawTexture(CTextureRef textureRef, SRectF rect, SColorF color, bool mirrored = false) + { + _Draw.DrawTexture(textureRef, rect, color, mirrored); + } + + /// + /// Draws a texture at the given position with the given color + /// + /// + /// + /// + /// Bounds to draw the texture in (rest gets cropped off) + /// True to mirror the texture on the y axis + public static void DrawTexture(CTextureRef textureRef, SRectF rect, SColorF color, SRectF bounds, bool mirrored = false) + { + _Draw.DrawTexture(textureRef, rect, color, bounds, mirrored); + } + + /// + /// Draws a part of a texture at the given position with the given color + /// + /// + /// + /// + /// Normalized start x-coordinate (0..1) + /// Normalized end x-coordinate (0..1) + public static void DrawTexture(CTextureRef textureRef, SRectF rect, SColorF color, float begin, float end) + { + _Draw.DrawTexture(textureRef, rect, color, begin, end); + } + + /// + /// Draws a texture fitting it within the given bounds with the method specified by aspect + /// + /// + /// Where to draw the texture + /// How to fit a texture in the bounds if the size differs + public static void DrawTexture(CTextureRef textureRef, SRectF bounds, EAspect aspect) + { + DrawTexture(textureRef, bounds, aspect, textureRef.Color); + } + + /// + /// Draws a texture fitting it within the given color and bounds with the method specified by aspect + /// + /// + /// Where to draw the texture + /// How to fit a texture in the bounds if the size differs + /// Color to use + public static void DrawTexture(CTextureRef textureRef, SRectF bounds, EAspect aspect, SColorF color) + { + if (textureRef == null) + return; + + SRectF rect = CHelper.FitInBounds(bounds, textureRef.OrigAspect, aspect); + DrawTexture(textureRef, rect, color); + } + + /// + /// Draws the reflection of a texture at the given position and with the given color + /// + /// + /// (Original) rectangle to draw the reflection for + /// + /// + /// Spacing between the rect and the reflection + /// Height of the reflection + public static void DrawTextureReflection(CTextureRef textureRef, SRectF rect, SColorF color, SRectF bounds, float space, float height) + { + _Draw.DrawTextureReflection(textureRef, rect, color, bounds, space, height); + } } } \ No newline at end of file diff --git a/Vocaluxe/Base/CGame.cs b/Vocaluxe/Base/CGame.cs index 46df686f..187ac2bf 100644 --- a/Vocaluxe/Base/CGame.cs +++ b/Vocaluxe/Base/CGame.cs @@ -30,7 +30,7 @@ namespace Vocaluxe.Base static class CGame { private static ISongQueue _SongQueue; - private static int _NumPlayer = CConfig.NumPlayer; + private static int _NumPlayers = CConfig.Config.Game.NumPlayers; /// /// Last beat that has been evaluated @@ -177,16 +177,21 @@ namespace Vocaluxe.Base get { return _SongQueue.GetNumSongs(); } } - public static int NumPlayer + public static int NumPlayers { - get { return _NumPlayer; } + get { return _NumPlayers; } set { if (value > 0 && value <= CSettings.MaxNumPlayer) - _NumPlayer = value; + _NumPlayers = value; } } + public static void GotoNameSelection() + { + CGraphics.FadeTo(EScreen.Names); + } + public static void ResetPlayer() { for (int i = 0; i < Players.Length; i++) @@ -222,15 +227,15 @@ namespace Vocaluxe.Base CurrentBeatF = b; - MidRecordedBeat = -0.5f + GetBeatFromTime(time, song.BPM, song.Gap + CConfig.MicDelay / 1000f); + MidRecordedBeat = -0.5f + GetBeatFromTime(time, song.BPM, song.Gap + CConfig.Config.Record.MicDelay / 1000f); - for (int p = 0; p < _NumPlayer; p++) + for (int p = 0; p < _NumPlayers; p++) CRecord.AnalyzeBuffer(p); if (_LastEvalBeat >= RecordedBeat) return; - for (int p = 0; p < _NumPlayer; p++) + for (int p = 0; p < _NumPlayers; p++) { for (int beat = _LastEvalBeat + 1; beat <= RecordedBeat; beat++) { @@ -364,20 +369,20 @@ namespace Vocaluxe.Base _LastEvalBeat = RecordedBeat; } - public static void ResetToLastLine(int soundStream, int vidStream) + public static void ResetToLastLine(int soundStream, CVideoStream vidStream) { float[] time = _GetLastSungLineStart(); ResetToTime(time[0], time[1], soundStream, vidStream); } - public static void ResetToTime(float time, float nextStart, int soundStream, int vidStream) + public static void ResetToTime(float time, float nextStart, int soundStream, CVideoStream vidStream) { if (time < 0) time = 0; CurrentBeatF = GetBeatFromTime(time, GetSong().BPM, GetSong().Gap); - for (int p = 0; p < _NumPlayer; p++) + for (int p = 0; p < _NumPlayers; p++) { Players[p].Points = 0; Players[p].PointsGoldenNotes = 0; diff --git a/Vocaluxe/Base/CGraphics.cs b/Vocaluxe/Base/CGraphics.cs index 69bf1c51..5d4ea1c6 100644 --- a/Vocaluxe/Base/CGraphics.cs +++ b/Vocaluxe/Base/CGraphics.cs @@ -21,10 +21,10 @@ using System.Diagnostics; using System.Drawing; using System.Windows.Forms; using Vocaluxe.Base.Fonts; +using Vocaluxe.Base.ThemeSystem; using Vocaluxe.Screens; using VocaluxeLib; using VocaluxeLib.Menu; -using VocaluxeLib.PartyModes; namespace Vocaluxe.Base { @@ -32,11 +32,7 @@ namespace Vocaluxe.Base { private static CFading _Fading; private static readonly CCursor _Cursor = new CCursor(); - private static float _GlobalAlpha; - private static float _ZOffset; - private static EScreens _CurrentScreen; - private static EScreens _NextScreen; private static EPopupScreens _CurrentPopupScreen; private static readonly List _Screens = new List(); @@ -45,24 +41,20 @@ namespace Vocaluxe.Base private static Stopwatch _VolumePopupTimer; private static bool _CursorOverVolumeControl; - public static float GlobalAlpha - { - get { return _GlobalAlpha; } - } + public static float GlobalAlpha { get; private set; } - public static float ZOffset - { - get { return _ZOffset; } - } + public static float ZOffset { get; private set; } - public static EScreens CurrentScreen - { - get { return _CurrentScreen; } - } + public static IMenu CurrentScreen { get; private set; } - public static EScreens NextScreen + public static IMenu NextScreen { get; private set; } + public static EScreen NextScreenType { - get { return _NextScreen; } + get + { + int id = _Screens.IndexOf(NextScreen); + return (EScreen)id; + } } #region public methods @@ -90,7 +82,8 @@ namespace Vocaluxe.Base _Screens.Add(new CScreenNames()); _Screens.Add(new CScreenCredits()); _Screens.Add(new CScreenParty()); - _Screens.Add(new CScreenPartyDummy()); + + Debug.Assert(_Screens.Count == (int)EScreen.CountEntry, "Screen list and screens enum do not match"); _PopupScreens.Add(new CPopupScreenPlayerControl()); _PopupScreens.Add(new CPopupScreenVolumeControl()); @@ -98,13 +91,13 @@ namespace Vocaluxe.Base CLog.StopBenchmark("Build Screen List"); - _CurrentScreen = EScreens.ScreenLoad; - _NextScreen = EScreens.ScreenNull; + CurrentScreen = _Screens[(int)EScreen.Load]; + NextScreen = null; _CurrentPopupScreen = EPopupScreens.NoPopup; _VolumePopupTimer = new Stopwatch(); - _GlobalAlpha = 1f; - _ZOffset = 0f; + GlobalAlpha = 1f; + ZOffset = 0f; CLog.StartBenchmark("Load Theme"); LoadTheme(); @@ -113,64 +106,75 @@ namespace Vocaluxe.Base public static void Close() { - if (_CurrentPopupScreen != EPopupScreens.NoPopup) + if (_CurrentPopupScreen != EPopupScreens.NoPopup && _PopupScreens.Count > 0) _PopupScreens[(int)_CurrentPopupScreen].OnClose(); - _Screens[(int)_CurrentScreen].OnClose(); + if (CurrentScreen != null) + CurrentScreen.OnClose(); } public static void LoadTheme() { - _Cursor.LoadTextures(); + _Cursor.LoadSkin(); for (int i = 0; i < _Screens.Count; i++) { - CLog.StartBenchmark("Load Theme " + Enum.GetNames(typeof(EScreens))[i]); + CLog.StartBenchmark("Load Theme " + Enum.GetNames(typeof(EScreen))[i]); _Screens[i].Init(); - _Screens[i].LoadTheme(CTheme.GetThemeScreensPath(-1)); - CLog.StopBenchmark("Load Theme " + Enum.GetNames(typeof(EScreens))[i]); + _Screens[i].LoadTheme(CThemes.GetThemeScreensPath(_Screens[i].PartyModeID)); + CLog.StopBenchmark("Load Theme " + Enum.GetNames(typeof(EScreen))[i]); } foreach (IMenu popup in _PopupScreens) { popup.Init(); - popup.LoadTheme(CTheme.GetThemeScreensPath(-1)); + popup.LoadTheme(CThemes.GetThemeScreensPath(popup.PartyModeID)); } } public static void ReloadTheme() { - _Cursor.ReloadTextures(); + _Cursor.ReloadSkin(); foreach (IMenu screen in _Screens) - screen.ReloadTheme(CTheme.GetThemeScreensPath(-1)); + screen.ReloadTheme(CThemes.GetThemeScreensPath(screen.PartyModeID)); foreach (IMenu popup in _PopupScreens) - popup.ReloadTheme(CTheme.GetThemeScreensPath(-1)); + popup.ReloadTheme(CThemes.GetThemeScreensPath(popup.PartyModeID)); + + CParty.ReloadTheme(); } public static void ReloadSkin() { - _Cursor.ReloadTextures(); + _Cursor.ReloadSkin(); foreach (IMenu menu in _Screens) - menu.ReloadTextures(); + menu.ReloadSkin(); foreach (IMenu menu in _PopupScreens) - menu.ReloadTextures(); + menu.ReloadSkin(); + + CParty.ReloadSkin(); } public static void SaveTheme() { - CTheme.SaveTheme(); - foreach (IMenu screen in _Screens) + foreach (CMenu screen in _Screens) + { + if (screen.ThemePath == null || screen.ThemeName == "ScreenTest") + continue; + screen.SaveTheme(); + } foreach (IMenu popup in _PopupScreens) popup.SaveTheme(); + + CParty.SaveThemes(); } public static void InitFirstScreen() { - _Screens[(int)_CurrentScreen].OnShow(); - _Screens[(int)_CurrentScreen].OnShowFinish(); + CurrentScreen.OnShow(); + CurrentScreen.OnShowFinish(); } public static bool UpdateGameLogic(CKeys keys, CMouse mouse) @@ -187,9 +191,6 @@ namespace Vocaluxe.Base CController.Update(); CProfiles.Update(); - if (CConfig.CoverLoading == ECoverLoading.TR_CONFIG_COVERLOADING_DYNAMIC && _CurrentScreen != EScreens.ScreenSing) - CSongs.LoadCover(); - if (CSettings.ProgramState != EProgramState.EditTheme) { run &= _HandleInputs(keys, mouse); @@ -207,18 +208,20 @@ namespace Vocaluxe.Base public static bool Draw() { - if (_NextScreen != EScreens.ScreenNull && _Fading == null) + if (NextScreen != null && _Fading == null) { - _Fading = new CFading(0f, 1f, CConfig.FadeTime); + _Fading = new CFading(0f, 1f, CConfig.Config.Graphics.FadeTime); - if (_NextScreen == EScreens.ScreenPartyDummy) + if (NextScreen.PartyModeID != -1) { - CFonts.PartyModeID = CParty.CurrentPartyModeID; - _Screens[(int)_NextScreen].OnShow(); + CFonts.PartyModeID = NextScreen.PartyModeID; + NextScreen.OnShow(); CFonts.PartyModeID = -1; } else - _Screens[(int)_NextScreen].OnShow(); + NextScreen.OnShow(); + if (_Cursor.IsActive) + NextScreen.ProcessMouseMove(_Cursor.X, _Cursor.Y); HidePopup(EPopupScreens.PopupPlayerControl); } @@ -230,34 +233,27 @@ namespace Vocaluxe.Base if (!finished) { - _GlobalAlpha = 1f; // -newAlpha / 100f; - _ZOffset = CSettings.ZFar / 2; + GlobalAlpha = 1f; + ZOffset = CSettings.ZFar / 2; + _DrawScreen(CurrentScreen); - _DrawScreen(_CurrentScreen); + GlobalAlpha = newAlpha; + ZOffset = 0f; + _DrawScreen(NextScreen); - - _GlobalAlpha = newAlpha; - _ZOffset = 0f; - - _DrawScreen(_NextScreen); - - _GlobalAlpha = 1f; + GlobalAlpha = 1f; } else { - _Screens[(int)_CurrentScreen].OnClose(); - _CurrentScreen = _NextScreen; - _NextScreen = EScreens.ScreenNull; - _Screens[(int)_CurrentScreen].OnShowFinish(); - _Screens[(int)_CurrentScreen].ProcessMouseMove(_Cursor.X, _Cursor.Y); + _FinishScreenFading(); + if (_Cursor.IsActive) + CurrentScreen.ProcessMouseMove(_Cursor.X, _Cursor.Y); - _DrawScreen(_CurrentScreen); - - _Fading = null; + _DrawScreen(CurrentScreen); } } else - _DrawScreen(_CurrentScreen); + _DrawScreen(CurrentScreen); foreach (IMenu popup in _PopupScreens) popup.Draw(); @@ -268,33 +264,53 @@ namespace Vocaluxe.Base return true; } - private static void _DrawScreen(EScreens screen) + private static void _FinishScreenFading() { - if (screen == EScreens.ScreenPartyDummy) + if (_Fading == null) + return; + Debug.Assert(NextScreen != null); + CurrentScreen.OnClose(); + CurrentScreen = NextScreen; + NextScreen = null; + CurrentScreen.OnShowFinish(); + CSound.SetGlobalVolume(CConfig.GetVolumeByType(CurrentScreen.CurrentMusicType)); + _Fading = null; + } + + private static void _DrawScreen(IMenu screen) + { + if (screen.PartyModeID != -1) { - CFonts.PartyModeID = CParty.CurrentPartyModeID; - _Screens[(int)screen].Draw(); + CFonts.PartyModeID = screen.PartyModeID; + screen.Draw(); CFonts.PartyModeID = -1; } else - _Screens[(int)screen].Draw(); + screen.Draw(); } - public static void FadeTo(EScreens screen) + public static IMenu GetScreen(EScreen screen) { - if (screen == EScreens.ScreenPartyDummy) - { - EScreens alt; - CMenu scr = CParty.GetNextPartyScreen(out alt); - if (scr == null) - { - _NextScreen = alt; - return; - } - _Screens[(int)EScreens.ScreenPartyDummy] = scr; - } + if (screen == EScreen.Unknown || screen == EScreen.CountEntry) + throw new ArgumentException("Invalid screen: " + screen); + return _Screens[(int)screen]; + } - _NextScreen = screen; + public static void FadeTo(EScreen screen) + { + FadeTo(GetScreen(screen)); + } + + public static void FadeTo(IMenu screen) + { + if (screen == null) + throw new ArgumentNullException("screen"); + Debug.Assert(NextScreen==null || NextScreen!=screen, "Don't fade to currently fading screen!"); + if(screen==NextScreen) + return; + // Make sure the last screen change is done + _FinishScreenFading(); + NextScreen = screen; } public static void ShowPopup(EPopupScreens popupScreen) @@ -332,18 +348,12 @@ namespace Vocaluxe.Base SKeyEvent inputKeyEvent = new SKeyEvent(); SMouseEvent inputMouseEvent = new SMouseEvent(); - bool popupPlayerControlAllowed = _CurrentScreen != EScreens.ScreenOptionsRecord && _CurrentScreen != EScreens.ScreenSing && - (_CurrentScreen != EScreens.ScreenSong || - (_CurrentScreen == EScreens.ScreenSong && !CSongs.IsInCategory && CConfig.Tabs == EOffOn.TR_CONFIG_ON)) - && _CurrentScreen != EScreens.ScreenCredits && !CBackgroundMusic.Disabled; - - bool popupVolumeControlAllowed = _CurrentScreen != EScreens.ScreenCredits && _CurrentScreen != EScreens.ScreenOptionsRecord; + bool popupPlayerControlAllowed = CurrentScreen.CurrentMusicType == EMusicType.Background && !CBackgroundMusic.Disabled; + bool popupVolumeControlAllowed = CurrentScreen.CurrentMusicType != EMusicType.None; //Hide volume control for bg-music if bg-music is disabled - if (popupVolumeControlAllowed && (_CurrentScreen != EScreens.ScreenSong || CSongs.Category == -1) - && _CurrentScreen != EScreens.ScreenSing && CConfig.BackgroundMusic == EBackgroundMusicOffOn.TR_CONFIG_OFF) + if (popupVolumeControlAllowed && CurrentScreen.CurrentMusicType == EMusicType.Background && CConfig.Config.Sound.BackgroundMusic == EBackgroundMusicOffOn.TR_CONFIG_OFF) popupVolumeControlAllowed = false; - bool resume = true; bool eventsAvailable; bool inputEventsAvailable = CController.PollKeyEvent(ref inputKeyEvent); @@ -353,32 +363,56 @@ namespace Vocaluxe.Base if (!eventsAvailable) keyEvent = inputKeyEvent; - if (keyEvent.IsArrowKey() || keyEvent.Key == Keys.NumPad0 || keyEvent.Key == Keys.D0) + if (keyEvent.IsArrowKey() || keyEvent.Key == Keys.NumPad0 || keyEvent.Key == Keys.D0 || keyEvent.Key == Keys.Add) { _Cursor.Deactivate(); - if (keyEvent.ModAlt && keyEvent.ModCtrl && keyEvent.ModShift) + if (keyEvent.ModAlt && keyEvent.ModCtrl) { switch (keyEvent.Key) { - case Keys.Left: - CConfig.BorderLeft -= 1; - CConfig.BorderRight -= 1; - CConfig.BorderTop -= 1; - CConfig.BorderBottom -= 1; - break; case Keys.Right: - CConfig.BorderLeft += 1; - CConfig.BorderRight += 1; - CConfig.BorderTop += 1; - CConfig.BorderBottom += 1; + if (keyEvent.ModShift) + CConfig.Config.Graphics.BorderLeft++; + else + CConfig.Config.Graphics.BorderRight--; + break; + case Keys.Left: + if (keyEvent.ModShift) + CConfig.Config.Graphics.BorderLeft--; + else + CConfig.Config.Graphics.BorderRight++; + break; + case Keys.Down: + if (keyEvent.ModShift) + CConfig.Config.Graphics.BorderTop++; + else + CConfig.Config.Graphics.BorderBottom--; + break; + case Keys.Up: + if (keyEvent.ModShift) + CConfig.Config.Graphics.BorderTop--; + else + CConfig.Config.Graphics.BorderBottom++; break; case Keys.D0: case Keys.NumPad0: - CConfig.BorderLeft = 0; - CConfig.BorderRight = 0; - CConfig.BorderTop = 0; - CConfig.BorderBottom = 0; + CConfig.Config.Graphics.BorderLeft = + CConfig.Config.Graphics.BorderRight = CConfig.Config.Graphics.BorderTop = CConfig.Config.Graphics.BorderBottom = 0; + break; + case Keys.Add: + switch (CConfig.Config.Graphics.ScreenAlignment) + { + case EGeneralAlignment.Middle: + CConfig.Config.Graphics.ScreenAlignment = EGeneralAlignment.End; + break; + case EGeneralAlignment.End: + CConfig.Config.Graphics.ScreenAlignment = EGeneralAlignment.Start; + break; + default: + CConfig.Config.Graphics.ScreenAlignment = EGeneralAlignment.Middle; + break; + } break; } CConfig.SaveConfig(); @@ -396,13 +430,13 @@ namespace Vocaluxe.Base if (popupPlayerControlAllowed && keyEvent.Key == Keys.Tab) { - if (_CurrentPopupScreen == EPopupScreens.NoPopup && CConfig.BackgroundMusic == EBackgroundMusicOffOn.TR_CONFIG_ON) + if (_CurrentPopupScreen == EPopupScreens.NoPopup && CConfig.Config.Sound.BackgroundMusic == EBackgroundMusicOffOn.TR_CONFIG_ON) ShowPopup(EPopupScreens.PopupPlayerControl); else HidePopup(EPopupScreens.PopupPlayerControl); } - if (popupPlayerControlAllowed && CConfig.BackgroundMusic != EBackgroundMusicOffOn.TR_CONFIG_OFF) + if (popupPlayerControlAllowed && CConfig.Config.Sound.BackgroundMusic != EBackgroundMusicOffOn.TR_CONFIG_OFF) { if (keyEvent.Key == Keys.MediaNextTrack) CBackgroundMusic.Next(); @@ -417,57 +451,10 @@ namespace Vocaluxe.Base } } - if (popupVolumeControlAllowed) - { - //TODO: Handle this in the volume popup - int diff = 0; - if ((keyEvent.ModShift && (keyEvent.Key == Keys.Add || keyEvent.Key == Keys.PageUp)) || (keyEvent.Sender == ESender.WiiMote && keyEvent.Key == Keys.Add)) - diff = 5; - else if ((keyEvent.ModShift && (keyEvent.Key == Keys.Subtract || keyEvent.Key == Keys.PageDown)) || - (keyEvent.Sender == ESender.WiiMote && keyEvent.Key == Keys.Subtract)) - diff = -5; - - if (diff != 0) - { - switch (CurrentScreen) - { - case EScreens.ScreenSong: - if (CSongs.IsInCategory) - { - CConfig.PreviewMusicVolume += diff; - CSound.SetGlobalVolume(CConfig.PreviewMusicVolume); - } - else - { - CConfig.BackgroundMusicVolume += diff; - CSound.SetGlobalVolume(CConfig.BackgroundMusicVolume); - } - break; - - case EScreens.ScreenSing: - CConfig.GameMusicVolume += diff; - CSound.SetGlobalVolume(CConfig.GameMusicVolume); - break; - - default: - CConfig.BackgroundMusicVolume += diff; - CSound.SetGlobalVolume(CConfig.BackgroundMusicVolume); - break; - } - CConfig.SaveConfig(); - } - - if (_CurrentPopupScreen == EPopupScreens.NoPopup && diff != 0) - { - ShowPopup(EPopupScreens.PopupVolumeControl); - _VolumePopupTimer.Restart(); - } - } - if (keyEvent.ModShift && (keyEvent.Key == Keys.F1)) CSettings.ProgramState = EProgramState.EditTheme; else if (keyEvent.ModAlt && (keyEvent.Key == Keys.Enter)) - CConfig.FullScreen = (CConfig.FullScreen == EOffOn.TR_CONFIG_ON) ? EOffOn.TR_CONFIG_OFF : EOffOn.TR_CONFIG_ON; + CConfig.Config.Graphics.FullScreen = (CConfig.Config.Graphics.FullScreen == EOffOn.TR_CONFIG_ON) ? EOffOn.TR_CONFIG_OFF : EOffOn.TR_CONFIG_ON; else if (keyEvent.ModAlt && (keyEvent.Key == Keys.P)) CDraw.MakeScreenShot(); else @@ -476,10 +463,19 @@ namespace Vocaluxe.Base { bool handled = false; if (_CurrentPopupScreen != EPopupScreens.NoPopup) + { handled = _PopupScreens[(int)_CurrentPopupScreen].HandleInput(keyEvent); + if (popupVolumeControlAllowed && _CurrentPopupScreen == EPopupScreens.PopupVolumeControl && handled) + _VolumePopupTimer.Restart(); + } + else if (popupVolumeControlAllowed && _PopupScreens[(int)EPopupScreens.PopupVolumeControl].HandleInput(keyEvent)) + { + ShowPopup(EPopupScreens.PopupVolumeControl); + _VolumePopupTimer.Restart(); + } if (!handled) - resume &= _Screens[(int)_CurrentScreen].HandleInput(keyEvent); + resume &= CurrentScreen.HandleInput(keyEvent); } } @@ -502,7 +498,7 @@ namespace Vocaluxe.Base bool isOverPopupPlayerControl = CHelper.IsInBounds(_PopupScreens[(int)EPopupScreens.PopupPlayerControl].ScreenArea, mouseEvent); if (popupPlayerControlAllowed && isOverPopupPlayerControl) { - if (_CurrentPopupScreen == EPopupScreens.NoPopup && CConfig.BackgroundMusic == EBackgroundMusicOffOn.TR_CONFIG_ON) + if (_CurrentPopupScreen == EPopupScreens.NoPopup && CConfig.Config.Sound.BackgroundMusic == EBackgroundMusicOffOn.TR_CONFIG_ON) ShowPopup(EPopupScreens.PopupPlayerControl); } @@ -536,7 +532,7 @@ namespace Vocaluxe.Base handled = _PopupScreens[(int)_CurrentPopupScreen].HandleMouse(mouseEvent); if (!handled && _Fading == null && (_Cursor.IsActive || mouseEvent.LB || mouseEvent.RB || mouseEvent.MB)) - resume &= _Screens[(int)_CurrentScreen].HandleMouse(mouseEvent); + resume &= CurrentScreen.HandleMouse(mouseEvent); if (!eventsAvailable) inputEventsAvailable = CController.PollMouseEvent(ref inputMouseEvent); @@ -554,23 +550,23 @@ namespace Vocaluxe.Base if (keyEvent.ModShift && (keyEvent.Key == Keys.F1)) { CSettings.ProgramState = EProgramState.Normal; - _Screens[(int)_CurrentScreen].NextInteraction(); + CurrentScreen.NextElement(); } else if (keyEvent.ModAlt && (keyEvent.Key == Keys.Enter)) - CConfig.FullScreen = (CConfig.FullScreen == EOffOn.TR_CONFIG_ON) ? EOffOn.TR_CONFIG_OFF : EOffOn.TR_CONFIG_ON; + CConfig.Config.Graphics.FullScreen = (CConfig.Config.Graphics.FullScreen == EOffOn.TR_CONFIG_ON) ? EOffOn.TR_CONFIG_OFF : EOffOn.TR_CONFIG_ON; else if (keyEvent.ModAlt && (keyEvent.Key == Keys.P)) CDraw.MakeScreenShot(); else { if (_Fading == null) - _Screens[(int)_CurrentScreen].HandleInputThemeEditor(keyEvent); + CurrentScreen.HandleInputThemeEditor(keyEvent); } } while (mouse.PollEvent(ref mouseEvent)) { if (_Fading == null) - _Screens[(int)_CurrentScreen].HandleMouseThemeEditor(mouseEvent); + CurrentScreen.HandleMouseThemeEditor(mouseEvent); _UpdateMousePosition(mouseEvent.X, mouseEvent.Y); } @@ -595,17 +591,17 @@ namespace Vocaluxe.Base if (_CurrentPopupScreen != EPopupScreens.NoPopup) _PopupScreens[(int)_CurrentPopupScreen].UpdateGame(); - return _Screens[(int)_CurrentScreen].UpdateGame(); + return CurrentScreen.UpdateGame(); } private static void _DrawDebugInfos() { - if (CConfig.DebugLevel == EDebugLevel.TR_CONFIG_OFF) + if (CConfig.Config.Debug.DebugLevel == EDebugLevel.TR_CONFIG_OFF) return; List debugOutput = new List {CTime.GetFPS().ToString("FPS: 000")}; - if (CConfig.DebugLevel >= EDebugLevel.TR_CONFIG_LEVEL1) + if (CConfig.Config.Debug.DebugLevel >= EDebugLevel.TR_CONFIG_LEVEL1) { debugOutput.Add(CSound.GetStreamCount().ToString(CLanguage.Translate("TR_DEBUG_AUDIO_STREAMS") + ": 00")); debugOutput.Add(CVideo.GetNumStreams().ToString(CLanguage.Translate("TR_DEBUG_VIDEO_STREAMS") + ": 00")); @@ -613,32 +609,31 @@ namespace Vocaluxe.Base long memory = GC.GetTotalMemory(false); debugOutput.Add((memory / 1000000L).ToString(CLanguage.Translate("TR_DEBUG_MEMORY") + ": 00000 MB")); - if (CConfig.DebugLevel >= EDebugLevel.TR_CONFIG_LEVEL2) + if (CConfig.Config.Debug.DebugLevel >= EDebugLevel.TR_CONFIG_LEVEL2) { debugOutput.Add(CRecord.GetToneAbs(0).ToString(CLanguage.Translate("TR_DEBUG_TONE_ABS") + " P1: 00")); debugOutput.Add(CRecord.GetMaxVolume(0).ToString(CLanguage.Translate("TR_DEBUG_MAX_VOLUME") + " P1: 0.000")); debugOutput.Add(CRecord.GetToneAbs(1).ToString(CLanguage.Translate("TR_DEBUG_TONE_ABS") + " P2: 00")); debugOutput.Add(CRecord.GetMaxVolume(1).ToString(CLanguage.Translate("TR_DEBUG_MAX_VOLUME") + " P2: 0.000")); - if (CConfig.DebugLevel >= EDebugLevel.TR_CONFIG_LEVEL3) + if (CConfig.Config.Debug.DebugLevel >= EDebugLevel.TR_CONFIG_LEVEL3) { debugOutput.Add(CSongs.NumSongsWithCoverLoaded.ToString(CLanguage.Translate("TR_DEBUG_SONGS") + ": 00000")); - if (CConfig.DebugLevel >= EDebugLevel.TR_CONFIG_LEVEL_MAX) + if (CConfig.Config.Debug.DebugLevel >= EDebugLevel.TR_CONFIG_LEVEL_MAX) debugOutput.Add(_Cursor.X.ToString(CLanguage.Translate("TR_DEBUG_MOUSE") + " : (0000/") + _Cursor.Y.ToString("0000)")); } } } - CFonts.Style = EStyle.Normal; - CFonts.SetFont("Normal"); - CFonts.Height = 25; + CFont font = new CFont("Normal", EStyle.Normal, 25); SColorF gray = new SColorF(1f, 1f, 1f, 0.5f); float y = 0; foreach (string txt in debugOutput) { - RectangleF rect = new RectangleF(CSettings.RenderW - CFonts.GetTextWidth(txt), y, CFonts.GetTextWidth(txt), CFonts.GetTextHeight(txt)); - CDraw.DrawColor(gray, new SRectF(rect.X, rect.Top, rect.Width, rect.Height, CSettings.ZNear)); - CFonts.DrawText(txt, rect.X, rect.Y, CSettings.ZNear); + float textWidth = CFonts.GetTextWidth(txt, font); + RectangleF rect = new RectangleF(CSettings.RenderW - textWidth, y, textWidth, CFonts.GetTextHeight(txt, font)); + CDraw.DrawRect(gray, new SRectF(rect.X, rect.Top, rect.Width, rect.Height, CSettings.ZNear)); + CFonts.DrawText(txt, font, rect.X, rect.Y, CSettings.ZNear); y += rect.Height; } } diff --git a/Vocaluxe/Base/CLanguage.cs b/Vocaluxe/Base/CLanguage.cs index a86faf0f..d6b1cbe4 100644 --- a/Vocaluxe/Base/CLanguage.cs +++ b/Vocaluxe/Base/CLanguage.cs @@ -20,13 +20,14 @@ using System.Collections.Generic; using System.IO; using System.Linq; using VocaluxeLib; +using VocaluxeLib.Xml; namespace Vocaluxe.Base { struct SLanguage { public string Name; - public string LanguageFilePath; + public string FilePath; public Dictionary Texts; public List PartyModeTexts; @@ -40,7 +41,7 @@ namespace Vocaluxe.Base static class CLanguage { - private static List _Languages; + private static readonly List _Languages = new List(); private static int _CurrentLanguage = -1; private static int _FallbackLanguage; @@ -54,11 +55,6 @@ namespace Vocaluxe.Base } } - public static string GetLanguageName(int lang) - { - return _Languages[lang].Name; - } - public static IEnumerable GetLanguageNames() { var languages = new string[_Languages.Count]; @@ -71,8 +67,6 @@ namespace Vocaluxe.Base public static bool Init() { - _Languages = new List(); - var files = new List(); files.AddRange(CHelper.ListFiles(CSettings.FolderNameLanguages, "*.xml", true, true)); @@ -83,7 +77,7 @@ namespace Vocaluxe.Base public static bool SetLanguage(string language) { - int nr = GetLanguageNr(language); + int nr = _GetLanguageNr(language); if (nr != -1) { _CurrentLanguage = nr; @@ -92,7 +86,7 @@ namespace Vocaluxe.Base return false; } - public static int GetLanguageNr(string language) + private static int _GetLanguageNr(string language) { for (int i = 0; i < _Languages.Count; i++) { @@ -102,59 +96,58 @@ namespace Vocaluxe.Base return -1; } - public static string Translate(string keyWord, int partyModeID = -1) + /// + /// Checks if a translation exists and returns it + /// + /// Word to translate + /// + /// Translated word or keyWord if translation does not exist + /// True if word was translated + private static bool _GetTranslation(string keyWord, int partyModeID, out string translation) { if (keyWord == null) - return "Error"; - - if (keyWord.Length < 3 || keyWord.Substring(0, 3) != "TR_") - return keyWord; - - string result; - if (partyModeID != -1) { - int partyModeNr = _GetPartyModeNr(partyModeID, _CurrentLanguage); - if (partyModeNr != -1 && _Languages[_CurrentLanguage].PartyModeTexts[partyModeNr].Texts.TryGetValue(keyWord, out result)) - return result; - - partyModeNr = _GetPartyModeNr(partyModeID, _FallbackLanguage); - if (partyModeNr != -1 && _Languages[_CurrentLanguage].PartyModeTexts[partyModeNr].Texts.TryGetValue(keyWord, out result)) - return result; + translation = "Error"; + return false; } - if (_Languages[_CurrentLanguage].Texts.TryGetValue(keyWord, out result)) - return result; - if (_Languages[_FallbackLanguage].Texts.TryGetValue(keyWord, out result)) - return result; + if (keyWord.Length < 3 || keyWord.Substring(0, 3) != "TR_") + { + translation = keyWord; + return false; + } - return keyWord; + if (partyModeID != -1) + { + Dictionary partyModeTexts = _GetPartyModeTexts(_CurrentLanguage, partyModeID); + if (partyModeTexts != null && partyModeTexts.TryGetValue(keyWord, out translation)) + return true; + + partyModeTexts = _GetPartyModeTexts(_FallbackLanguage, partyModeID); + if (partyModeTexts != null && partyModeTexts.TryGetValue(keyWord, out translation)) + return true; + } + + if (_Languages[_CurrentLanguage].Texts.TryGetValue(keyWord, out translation)) + return true; + if (_Languages[_FallbackLanguage].Texts.TryGetValue(keyWord, out translation)) + return true; + + translation = keyWord; + return false; + } + + public static string Translate(string keyWord, int partyModeID = -1) + { + string translation; + _GetTranslation(keyWord, partyModeID, out translation); + return translation; } public static bool TranslationExists(string keyWord, int partyModeID = -1) { - if (keyWord == null) - return false; - - if (keyWord.Length < 3 || keyWord.Substring(0, 3) != "TR_") - return false; - - if (partyModeID != -1) - { - int partyModeNr = _GetPartyModeNr(partyModeID, _CurrentLanguage); - if (partyModeNr != -1 && _Languages[_CurrentLanguage].PartyModeTexts[partyModeNr].Texts.ContainsKey(keyWord)) - return true; - - partyModeNr = _GetPartyModeNr(partyModeID, _FallbackLanguage); - if (partyModeNr != -1 && _Languages[_CurrentLanguage].PartyModeTexts[partyModeNr].Texts.ContainsKey(keyWord)) - return true; - } - - if (_Languages[_CurrentLanguage].Texts.ContainsKey(keyWord)) - return true; - if (_Languages[_FallbackLanguage].Texts.ContainsKey(keyWord)) - return true; - - return false; + string translation; + return _GetTranslation(keyWord, partyModeID, out translation); } public static bool LoadPartyLanguageFiles(int partyModeID, string path) @@ -165,89 +158,60 @@ namespace Vocaluxe.Base return files.All(file => _LoadPartyLanguageFile(partyModeID, file)); } - private static bool _LoadLanguageEntries(CXMLReader xmlReader, out Dictionary texts) + private static bool _LoadLanguageEntries(string filePath, out Dictionary texts) { - texts = new Dictionary(); - IEnumerable names = xmlReader.GetAttributes("//resources/string", "name"); - foreach (string name in names) + var deser = new CXmlDeserializer(); + try { - string value; - if (!xmlReader.GetValue("//resources/string[@name='" + name + "']", out value, "")) - continue; - try - { - texts.Add(name, value); - } - catch (Exception e) - { - CLog.LogError("Error reading language file " + xmlReader.FileName + ": " + e.Message); - return false; - } + texts = deser.Deserialize>(filePath); + string language; + if (!texts.TryGetValue("language", out language)) + throw new Exception("'language' entry is missing"); + } + catch (Exception e) + { + CLog.LogError("Error reading language file " + filePath + ": " + e.Message); + texts = null; + return false; } return true; } - private static bool _LoadPartyLanguageFile(int partyModeID, string file) + private static bool _LoadPartyLanguageFile(int partyModeID, string filePath) { - CXMLReader xmlReader = CXMLReader.OpenFile(file); - if (xmlReader == null) + var lang = new SPartyLanguage {PartyModeID = partyModeID}; + + if (!_LoadLanguageEntries(filePath, out lang.Texts)) return false; - string value = string.Empty; - if (xmlReader.GetValue("//resources/string[@name='language']", out value, value)) - { - int nr = GetLanguageNr(value); - - if (nr == -1) - return true; - - var lang = new SPartyLanguage {PartyModeID = partyModeID}; - if (!_LoadLanguageEntries(xmlReader, out lang.Texts)) - return false; + int nr = _GetLanguageNr(lang.Texts["language"]); + if (nr >= 0) _Languages[nr].PartyModeTexts.Add(lang); - return true; - } - CLog.LogError("Error reading Party Language File " + file); - return false; + return true; } private static void _LoadLanguageFile(string fileName) { - var lang = new SLanguage {LanguageFilePath = Path.Combine(CSettings.ProgramFolder, CSettings.FolderNameLanguages, fileName)}; - - CXMLReader xmlReader = CXMLReader.OpenFile(lang.LanguageFilePath); - if (xmlReader == null) + var lang = new SLanguage {FilePath = Path.Combine(CSettings.ProgramFolder, CSettings.FolderNameLanguages, fileName), PartyModeTexts = new List()}; + if (!_LoadLanguageEntries(lang.FilePath, out lang.Texts)) return; - string value = string.Empty; - if (xmlReader.GetValue("//resources/string[@name='language']", out value, value)) + lang.Name = lang.Texts["language"]; + if (lang.Name == CSettings.FallbackLanguage) { - lang.Name = value; - - if (lang.Name == CSettings.FallbackLanguage) - { - _FallbackLanguage = _Languages.Count; - if (_CurrentLanguage < 0) - _CurrentLanguage = _FallbackLanguage; - } - - lang.PartyModeTexts = new List(); - - _LoadLanguageEntries(xmlReader, out lang.Texts); - - _Languages.Add(lang); + _FallbackLanguage = _Languages.Count; + if (_CurrentLanguage < 0) + _CurrentLanguage = _FallbackLanguage; } + + _Languages.Add(lang); } - private static int _GetPartyModeNr(int partyModeID, int language) + private static Dictionary _GetPartyModeTexts(int language, int partyModeID) { - for (int i = 0; i < _Languages[language].PartyModeTexts.Count; i++) - { - if (_Languages[language].PartyModeTexts[i].PartyModeID == partyModeID) - return i; - } - return -1; + return + _Languages[language].PartyModeTexts.Where(partyLanguage => partyLanguage.PartyModeID == partyModeID).Select(partyLanguage => partyLanguage.Texts).FirstOrDefault(); } } } \ No newline at end of file diff --git a/Vocaluxe/Base/CLog.cs b/Vocaluxe/Base/CLog.cs index 31d26f5a..f91b9d00 100644 --- a/Vocaluxe/Base/CLog.cs +++ b/Vocaluxe/Base/CLog.cs @@ -130,7 +130,7 @@ namespace Vocaluxe.Base _Initialized = true; } - public static void CloseAll() + public static void Close() { if (_Initialized) { diff --git a/Vocaluxe/Base/CMain.cs b/Vocaluxe/Base/CMain.cs index 68bdb588..fab4eaa0 100644 --- a/Vocaluxe/Base/CMain.cs +++ b/Vocaluxe/Base/CMain.cs @@ -19,8 +19,8 @@ using System; using System.Collections.Generic; using System.Collections.ObjectModel; using System.Drawing; -using System.Xml; using Vocaluxe.Base.Fonts; +using Vocaluxe.Base.ThemeSystem; using VocaluxeLib; using VocaluxeLib.Game; using VocaluxeLib.Draw; @@ -34,7 +34,7 @@ namespace Vocaluxe.Base { private static readonly IConfig _Config = new CBconfig(); private static readonly ISettings _Settings = new CBsettings(); - private static readonly ITheme _Theme = new CBtheme(); + private static readonly IThemes _Themes = new CBtheme(); private static readonly IBackgroundMusic _BackgroundMusic = new CBbackgroundMusic(); private static readonly IDrawing _Draw = new CBdraw(); private static readonly IGraphics _Graphics = new CBGraphics(); @@ -54,7 +54,7 @@ namespace Vocaluxe.Base public static void Init() { - CBase.Assign(_Config, _Settings, _Theme, _Log, _BackgroundMusic, _Draw, _Graphics, _Fonts, _Language, + CBase.Assign(_Config, _Settings, _Themes, _Log, _BackgroundMusic, _Draw, _Graphics, _Fonts, _Language, _Game, _Profiles, _Record, _Songs, _Video, _Sound, _Cover, _DataBase, _Controller, _Playlist); } } @@ -63,7 +63,7 @@ namespace Vocaluxe.Base { public EOffOn GetSaveModifiedSongs() { - return CConfig.SaveModifiedSongs; + return CConfig.Config.Debug.SaveModifiedSongs; } public void SetBackgroundMusicVolume(int newVolume) @@ -71,14 +71,14 @@ namespace Vocaluxe.Base CConfig.BackgroundMusicVolume = newVolume; } - public int GetBackgroundMusicVolume() + public int GetMusicVolume(EMusicType type) { - return CConfig.BackgroundMusicVolume; + return CConfig.GetVolumeByType(type); } public EBackgroundMusicOffOn GetBackgroundMusicStatus() { - return CConfig.BackgroundMusic; + return CConfig.Config.Sound.BackgroundMusic; } public int GetPreviewMusicVolume() @@ -93,32 +93,32 @@ namespace Vocaluxe.Base public EOffOn GetVideosToBackground() { - return CConfig.VideosToBackground; + return CConfig.Config.Video.VideosToBackground; } public EOffOn GetVideoBackgrounds() { - return CConfig.VideoBackgrounds; + return CConfig.Config.Video.VideoBackgrounds; } public EOffOn GetVideoPreview() { - return CConfig.VideoPreview; + return CConfig.Config.Video.VideoPreview; } public EOffOn GetDrawNoteLines() { - return CConfig.DrawNoteLines; + return CConfig.Config.Theme.DrawNoteLines; } public EOffOn GetDrawToneHelper() { - return CConfig.DrawToneHelper; + return CConfig.Config.Theme.DrawToneHelper; } public int GetCoverSize() { - return CConfig.CoverSize; + return CConfig.Config.Graphics.CoverSize; } public IEnumerable GetSongFolders() @@ -128,17 +128,17 @@ namespace Vocaluxe.Base public ESongSorting GetSongSorting() { - return CConfig.SongSorting; + return CConfig.Config.Game.SongSorting; } public EOffOn GetTabs() { - return CConfig.Tabs; + return CConfig.Config.Game.Tabs; } public EOffOn GetIgnoreArticles() { - return CConfig.IgnoreArticles; + return CConfig.Config.Game.IgnoreArticles; } public bool IsMicConfigured(int playerNr) @@ -151,9 +151,19 @@ namespace Vocaluxe.Base return CConfig.GetMaxNumMics(); } - public XmlWriterSettings GetXMLSettings() + public bool GetLoadOldThemeFiles() { - return CConfig.XMLSettings; + return CConfig.LoadOldThemeFiles; + } + + public void AddSongMenuListener(OnSongMenuChanged onSongMenuChanged) + { + CConfig.SongMenuChanged += onSongMenuChanged; + } + + public void RemoveSongMenuListener(OnSongMenuChanged onSongMenuChanged) + { + CConfig.SongMenuChanged -= onSongMenuChanged; } } @@ -169,6 +179,11 @@ namespace Vocaluxe.Base return CSettings.RenderH; } + public SRectF GetRenderRect() + { + return CSettings.RenderRect; + } + public bool IsTabNavigation() { return CSettings.TabNavigation; @@ -255,71 +270,36 @@ namespace Vocaluxe.Base } } - class CBtheme : ITheme + class CBtheme : IThemes { public string GetThemeScreensPath(int partyModeID) { - return CTheme.GetThemeScreensPath(partyModeID); + return CThemes.GetThemeScreensPath(partyModeID); } - public int GetSkinIndex(int partyModeID) + public CTextureRef GetSkinTexture(string textureName, int partyModeID) { - return CTheme.GetSkinIndex(partyModeID); + return CThemes.GetSkinTexture(textureName, partyModeID); } - public CTexture GetSkinTexture(string textureName, int partyModeID) + public CVideoStream GetSkinVideo(string videoName, int partyModeID, bool loop) { - return CTheme.GetSkinTexture(textureName, partyModeID); + return CThemes.GetSkinVideo(videoName, partyModeID, loop); } - public CTexture GetSkinVideoTexture(string videoName, int partyModeID) + public bool GetColor(string colorName, int partyModeID, out SColorF color) { - return CTheme.GetSkinVideoTexture(videoName, partyModeID); - } - - public void SkinVideoResume(string videoName, int partyModeID) - { - CTheme.SkinVideoResume(videoName, partyModeID); - } - - public void SkinVideoPause(string videoName, int partyModeID) - { - CTheme.SkinVideoPause(videoName, partyModeID); - } - - public SColorF GetColor(string colorName, int partyModeID) - { - return CTheme.GetColor(colorName, partyModeID); - } - - public bool GetColor(string colorName, int skinIndex, out SColorF color) - { - return CTheme.GetColor(colorName, skinIndex, out color); + return CThemes.GetColor(colorName, partyModeID, out color); } public SColorF GetPlayerColor(int playerNr) { - return CTheme.GetPlayerColor(playerNr); + return CThemes.GetPlayerColor(playerNr); } - public void UnloadSkins() + public void Reload() { - CTheme.UnloadSkins(); - } - - public void ListSkins() - { - CTheme.ListSkins(); - } - - public void LoadSkins() - { - CTheme.LoadSkins(); - } - - public void LoadTheme() - { - CTheme.LoadTheme(); + CThemes.Reload(); } } @@ -400,7 +380,7 @@ namespace Vocaluxe.Base CBackgroundMusic.StopPreview(); } - public CTexture GetVideoTexture() + public CTextureRef GetVideoTexture() { return CBackgroundMusic.GetVideoTexture(); } @@ -408,44 +388,59 @@ namespace Vocaluxe.Base class CBdraw : IDrawing { - public void DrawTexture(CTexture texture, SRectF rect) + public void DrawTexture(CTextureRef texture, SRectF rect) { CDraw.DrawTexture(texture, rect); } - public void DrawTexture(CTexture texture, SRectF rect, SColorF color) + public void DrawTexture(CTextureRef texture, SRectF rect, SColorF color) { CDraw.DrawTexture(texture, rect, color); } - public void DrawTexture(CTexture texture, SRectF rect, SColorF color, SRectF bounds, bool mirrored = false) + public void DrawTexture(CTextureRef texture, SRectF rect, SColorF color, SRectF bounds, bool mirrored = false) { CDraw.DrawTexture(texture, rect, color, bounds, mirrored); } - public void DrawTextureReflection(CTexture texture, SRectF rect, SColorF color, SRectF bounds, float reflectionSpace, float reflectionHeight) + public void DrawTexture(CTextureRef textureRef, SRectF bounds, EAspect aspect) + { + CDraw.DrawTexture(textureRef, bounds, aspect); + } + + public void DrawTexture(CTextureRef textureRef, SRectF bounds, EAspect aspect, SColorF color) + { + CDraw.DrawTexture(textureRef, bounds, aspect, color); + } + + public void DrawTextureReflection(CTextureRef texture, SRectF rect, SColorF color, SRectF bounds, float reflectionSpace, float reflectionHeight) { CDraw.DrawTextureReflection(texture, rect, color, bounds, reflectionSpace, reflectionHeight); } - public CTexture AddTexture(string fileName) + public CTextureRef AddTexture(string fileName) { return CDraw.AddTexture(fileName); } - public void RemoveTexture(ref CTexture texture) + public CTextureRef EnqueueTexture(string fileName) + { + return CDraw.EnqueueTexture(fileName); + } + + public void RemoveTexture(ref CTextureRef texture) { CDraw.RemoveTexture(ref texture); } - public void DrawColor(SColorF color, SRectF rect) + public void DrawRect(SColorF color, SRectF rect) { - CDraw.DrawColor(color, rect); + CDraw.DrawRect(color, rect); } - public void DrawColorReflection(SColorF color, SRectF rect, float space, float height) + public void DrawRectReflection(SColorF color, SRectF rect, float space, float height) { - CDraw.DrawColorReflection(color, rect, space, height); + CDraw.DrawRectReflection(color, rect, space, height); } } @@ -461,7 +456,12 @@ namespace Vocaluxe.Base CGraphics.SaveTheme(); } - public void FadeTo(EScreens nextScreen) + public void FadeTo(EScreen nextScreen) + { + CGraphics.FadeTo(nextScreen); + } + + public void FadeTo(IMenu nextScreen) { CGraphics.FadeTo(nextScreen); } @@ -471,17 +471,27 @@ namespace Vocaluxe.Base return CGraphics.GlobalAlpha; } - public EScreens GetNextScreen() + public IMenu GetNextScreen() { return CGraphics.NextScreen; } + + public EScreen GetNextScreenType() + { + return CGraphics.NextScreenType; + } + + public IMenu GetScreen(EScreen screen) + { + return CGraphics.GetScreen(screen); + } } class CBlog : ILog { - public void LogError(string errorText) + public void LogError(string errorText, bool showMsg = false, bool exit = false) { - CLog.LogError(errorText); + CLog.LogError(errorText, showMsg, exit); } public void LogDebug(string text) @@ -497,39 +507,24 @@ namespace Vocaluxe.Base class CBfonts : IFonts { - public void SetFont(string fontName) - { - CFonts.SetFont(fontName); - } - - public void SetStyle(EStyle fontStyle) - { - CFonts.Style = fontStyle; - } - public RectangleF GetTextBounds(CText text) { return CFonts.GetTextBounds(text); } - public RectangleF GetTextBounds(CText text, float textHeight) + public void DrawText(string text, CFont font, float x, float y, float z, SColorF color) { - return CFonts.GetTextBounds(text, textHeight); + CFonts.DrawText(text, font, x, y, z, color); } - public void DrawText(string text, float textHeight, float x, float y, float z, SColorF color) + public void DrawTextReflection(string text, CFont font, float x, float y, float z, SColorF color, float reflectionSpace, float reflectionHeight) { - CFonts.DrawText(text, textHeight, x, y, z, color); + CFonts.DrawTextReflection(text, font, x, y, z, color, reflectionSpace, reflectionHeight); } - public void DrawTextReflection(string text, float textHeight, float x, float y, float z, SColorF color, float reflectionSpace, float reflectionHeight) + public void DrawText(string text, CFont font, float x, float y, float z, SColorF color, float begin, float end) { - CFonts.DrawTextReflection(text, textHeight, x, y, z, color, reflectionSpace, reflectionHeight); - } - - public void DrawText(string text, float textHeight, float x, float y, float z, SColorF color, float begin, float end) - { - CFonts.DrawText(text, textHeight, x, y, z, color, begin, end); + CFonts.DrawText(text, font, x, y, z, color, begin, end); } } @@ -555,12 +550,12 @@ namespace Vocaluxe.Base { public int GetNumPlayer() { - return CGame.NumPlayer; + return CGame.NumPlayers; } public void SetNumPlayer(int numPlayer) { - CGame.NumPlayer = numPlayer; + CGame.NumPlayers = numPlayer; } public SPlayer[] GetPlayers() @@ -651,7 +646,7 @@ namespace Vocaluxe.Base return CProfiles.GetPlayerName(profileID, playerNum); } - public CTexture GetAvatar(int profileID) + public CTextureRef GetAvatar(int profileID) { return CProfiles.GetAvatarTextureFromProfile(profileID); } @@ -679,9 +674,9 @@ namespace Vocaluxe.Base class CBrecord : IRecording { - public int GetToneAbs(int playerNr) + public int GetToneAbs(int player) { - return CRecord.GetToneAbs(playerNr); + return CRecord.GetToneAbs(player); } } @@ -800,44 +795,44 @@ namespace Vocaluxe.Base class CBvideo : IVideo { - public int Load(string videoFileName) + public CVideoStream Load(string videoFileName) { return CVideo.Load(videoFileName); } - public bool Skip(int videoStream, float startPosition, float videoGap) + public bool Skip(CVideoStream stream, float startPosition, float videoGap) { - return CVideo.Skip(videoStream, startPosition, videoGap); + return CVideo.Skip(stream, startPosition, videoGap); } - public bool GetFrame(int videoStream, ref CTexture videoTexture, float time, out float videoTime) + public bool GetFrame(CVideoStream stream, float time) { - return CVideo.GetFrame(videoStream, ref videoTexture, time, out videoTime); + return CVideo.GetFrame(stream, time); } - public bool IsFinished(int videoStream) + public bool IsFinished(CVideoStream stream) { - return CVideo.Finished(videoStream); + return CVideo.Finished(stream); } - public bool Close(int videoStream) + public void Close(ref CVideoStream stream) { - return CVideo.Close(videoStream); + CVideo.Close(ref stream); } - public void SetLoop(int streamID, bool loop = true) + public void SetLoop(CVideoStream stream, bool loop = true) { - CVideo.SetLoop(streamID, loop); + CVideo.SetLoop(stream, loop); } - public void Pause(int streamID) + public void Pause(CVideoStream stream) { - CVideo.Pause(streamID); + CVideo.Pause(stream); } - public void Resume(int streamID) + public void Resume(CVideoStream stream) { - CVideo.Resume(streamID); + CVideo.Resume(stream); } } @@ -858,7 +853,7 @@ namespace Vocaluxe.Base CSound.Play(soundStream); } - public void Fade(int soundStream, float targetVolume, float duration, EStreamAction afterFadeAction = EStreamAction.Nothing) + public void Fade(int soundStream, int targetVolume, float duration, EStreamAction afterFadeAction = EStreamAction.Nothing) { CSound.Fade(soundStream, targetVolume, duration, afterFadeAction); } @@ -883,23 +878,33 @@ namespace Vocaluxe.Base return CSound.GetLength(soundStream); } - public void SetStreamVolume(int soundStream, float volume) + public void SetStreamVolume(int soundStream, int volume) { CSound.SetStreamVolume(soundStream, volume); } + + public void SetGlobalVolume(int volume) + { + CSound.SetGlobalVolume(volume); + } } class CBcover : ICover { - public CTexture GetNoCover() + public CTextureRef GetNoCover() { return CCover.NoCover; } + + public CTextureRef GenerateCover(string text, ECoverGeneratorType type, CSong firstSong) + { + return CCover.GenerateCover(text, type, firstSong); + } } class CBdataBase : IDataBase { - public bool GetCover(string fileName, ref CTexture texture, int coverSize) + public bool GetCover(string fileName, ref CTextureRef texture, int coverSize) { return CDataBase.GetCover(fileName, ref texture, coverSize); } diff --git a/Vocaluxe/Base/CParty.cs b/Vocaluxe/Base/CParty.cs index 22bc3b33..6408281b 100644 --- a/Vocaluxe/Base/CParty.cs +++ b/Vocaluxe/Base/CParty.cs @@ -20,38 +20,20 @@ using System.CodeDom.Compiler; using System.Collections.Generic; using System.IO; using System.Reflection; +using Vocaluxe.Base.ThemeSystem; using VocaluxeLib; using VocaluxeLib.Menu; using VocaluxeLib.PartyModes; +using VocaluxeLib.Xml; namespace Vocaluxe.Base { - - #region Structs - struct SPartyMode - { - public int PartyModeID; - public int PartyModeSystemVersion; - public string Name; - public string Description; - public string Author; - public string Folder; - public string PartyModeFile; - public List ScreenFiles; - public int PartyModeVersionMajor; - public int PartyModeVersionMinor; - public string TargetAudience; - public bool NoErrors; - public IPartyMode PartyMode; - } - #endregion Structs - static class CParty { private const int _PartyModeSystemVersion = 1; private static Dictionary _PartyModes; - private static Queue _IDs; + private static int _NextID; private static int _NormalGameModeID; private static SPartyMode _CurrentPartyMode; @@ -60,17 +42,12 @@ namespace Vocaluxe.Base public static void Init() { _PartyModes = new Dictionary(); - _IDs = new Queue(1000); - - for (int i = 0; i < 1000; i++) - _IDs.Enqueue(i); + _NextID = 0; //add dummy normal game mode and set it as default - var pm = new SPartyMode {PartyMode = new CPartyModeNone(), ScreenFiles = new List()}; - pm.PartyMode.Initialize(); - pm.PartyModeID = _IDs.Dequeue(); - _NormalGameModeID = pm.PartyModeID; - _PartyModes.Add(pm.PartyModeID, pm); + var pm = new SPartyMode {ScreenFiles = new List(), PartyMode = new CPartyModeNone(_NextID++, null)}; + _NormalGameModeID = pm.PartyMode.ID; + _PartyModes.Add(pm.PartyMode.ID, pm); _CurrentPartyMode = pm; //load other party modes @@ -81,8 +58,8 @@ namespace Vocaluxe.Base { get { - if (_CurrentPartyMode.PartyModeID != _NormalGameModeID) - return _CurrentPartyMode.PartyModeID; + if (_CurrentPartyMode.PartyMode.ID != _NormalGameModeID) + return _CurrentPartyMode.PartyMode.ID; return -1; } @@ -93,41 +70,32 @@ namespace Vocaluxe.Base get { return _PartyModes.Count; } } + public static void ReloadTheme() + { + foreach (SPartyMode pm in _PartyModes.Values) + pm.PartyMode.ReloadTheme(); + } + + public static void ReloadSkin() + { + foreach (SPartyMode pm in _PartyModes.Values) + pm.PartyMode.ReloadSkin(); + } + + public static void SaveThemes() + { + foreach (SPartyMode pm in _PartyModes.Values) + pm.PartyMode.SaveScreens(); + } + public static List GetPartyModeInfos() { var infos = new List(); - var pmIDs = new int[_PartyModes.Count]; - _PartyModes.Keys.CopyTo(pmIDs, 0); - - foreach (int pmID in pmIDs) + foreach (KeyValuePair kvp in _PartyModes) { - if (pmID != _NormalGameModeID) - { - SPartyMode mode; - _PartyModes.TryGetValue(pmID, out mode); - - if (mode.PartyMode != null) - { - var info = new SPartyModeInfos - { - Author = mode.Author, - Description = mode.Description, - Name = mode.Name, - PartyModeID = mode.PartyModeID, - Playable = mode.NoErrors, - VersionMajor = mode.PartyModeVersionMajor, - VersionMinor = mode.PartyModeVersionMinor, - TargetAudience = mode.TargetAudience, - MaxPlayers = mode.PartyMode.GetMaxPlayer(), - MinPlayers = mode.PartyMode.GetMinPlayer(), - MaxTeams = mode.PartyMode.GetMaxTeams(), - MinTeams = mode.PartyMode.GetMinTeams() - }; - - infos.Add(info); - } - } + if (kvp.Key != _NormalGameModeID) + infos.Add(kvp.Value.Info); } return infos; } @@ -145,11 +113,6 @@ namespace Vocaluxe.Base _CurrentPartyMode.PartyMode.Init(); } - - public static CMenu GetNextPartyScreen(out EScreens alternativeScreen) - { - return _CurrentPartyMode.PartyMode.GetNextPartyScreen(out alternativeScreen); - } #endregion public stuff #region Interface @@ -158,16 +121,11 @@ namespace Vocaluxe.Base _CurrentPartyMode.PartyMode.UpdateGame(); } - public static EScreens GetStartScreen() + public static IMenu GetStartScreen() { return _CurrentPartyMode.PartyMode.GetStartScreen(); } - public static EScreens GetMainScreen() - { - return _CurrentPartyMode.PartyMode.GetMainScreen(); - } - public static SScreenSongOptions GetSongSelectionOptions() { return _CurrentPartyMode.PartyMode.GetScreenSongOptions(); @@ -222,54 +180,32 @@ namespace Vocaluxe.Base foreach (string file in files) { - SPartyMode pm = _LoadPartyMode(file); - if (pm.NoErrors) - _PartyModes.Add(pm.PartyModeID, pm); + SPartyMode pm; + if (_LoadPartyMode(file, out pm)) + _PartyModes.Add(pm.PartyMode.ID, pm); } } - private static SPartyMode _LoadPartyMode(string file) + private static bool _LoadPartyMode(string filePath, out SPartyMode pm) { - var pm = new SPartyMode {PartyModeID = _IDs.Dequeue(), ScreenFiles = new List(), NoErrors = false}; - - CXMLReader xmlReader = CXMLReader.OpenFile(file); - - //Error... - if (xmlReader == null) - return pm; - - bool loaded = true; - - loaded &= xmlReader.TryGetIntValue("//root/PartyModeSystemVersion", ref pm.PartyModeSystemVersion); - loaded &= xmlReader.GetValue("//root/Info/Name", out pm.Name, "ERROR Name"); - loaded &= xmlReader.GetValue("//root/Info/Description", out pm.Description, "ERROR Description"); - loaded &= xmlReader.GetValue("//root/Info/Author", out pm.Author, "ERROR Author"); - loaded &= xmlReader.GetValue("//root/Info/Folder", out pm.Folder, "ERROR Folder"); - loaded &= xmlReader.GetValue("//root/Info/PartyModeFile", out pm.PartyModeFile, "ERROR PartyModeFile"); - loaded &= xmlReader.TryGetIntValue("//root/Info/PartyModeVersionMajor", ref pm.PartyModeVersionMajor); - loaded &= xmlReader.TryGetIntValue("//root/Info/PartyModeVersionMinor", ref pm.PartyModeVersionMinor); - loaded &= xmlReader.GetValue("//root/Info/TargetAudience", out pm.TargetAudience, "ERROR TargetAudience"); - loaded &= xmlReader.GetValues("//root/PartyScreens/*", ref pm.ScreenFiles); - - if (!loaded) + CXmlDeserializer deser = new CXmlDeserializer(); + try { - CLog.LogError("Error loading PartyMode file: " + file); - return pm; + pm = deser.Deserialize(filePath); + if (pm.PartyModeSystemVersion != _PartyModeSystemVersion) + throw new Exception("Wrong PartyModeSystemVersion " + pm.PartyModeSystemVersion + " expected: " + _PartyModeSystemVersion); + + if (pm.ScreenFiles.Count == 0) + throw new Exception("No ScreenFiles found"); + } + catch (Exception e) + { + pm = new SPartyMode(); + CLog.LogError("Error loading PartyMode file " + filePath + ": " + e.Message); + return false; } - if (pm.PartyModeSystemVersion != _PartyModeSystemVersion) - { - CLog.LogError("Error loading PartyMode file (wrong PartyModeSystemVersion): " + file); - return pm; - } - - if (pm.ScreenFiles.Count == 0) - { - CLog.LogError("Error loading PartyMode file (no ScreenFiles found): " + file); - return pm; - } - - string pathToPm = Path.Combine(CSettings.ProgramFolder, CSettings.FolderNamePartyModes, pm.Folder); + string pathToPm = Path.Combine(CSettings.ProgramFolder, CSettings.FolderNamePartyModes, pm.Info.Folder); string pathToCode = Path.Combine(pathToPm, CSettings.FolderNamePartyModeCode); var filesToCompile = new List(); @@ -277,19 +213,14 @@ namespace Vocaluxe.Base Assembly output = _CompileFiles(filesToCompile.ToArray()); if (output == null) - return pm; + return false; - if (!CLanguage.LoadPartyLanguageFiles(pm.PartyModeID, Path.Combine(pathToPm, CSettings.FolderNamePartyModeLanguages))) - { - CLog.LogError("Error loading language files for PartyMode: " + file); - return pm; - } - - object instance = output.CreateInstance(typeof(IPartyMode).Namespace + "." + pm.Folder + "." + pm.PartyModeFile); + object instance = output.CreateInstance(typeof(IPartyMode).Namespace + "." + pm.Info.Folder + "." + pm.Info.PartyModeFile, false, + BindingFlags.Public | BindingFlags.Instance, null, new object[] {_NextID++, pathToPm}, null, null); if (instance == null) { - CLog.LogError("Error creating Instance of PartyMode file: " + file); - return pm; + CLog.LogError("Error creating Instance of PartyMode file: " + filePath); + return false; } try @@ -298,44 +229,37 @@ namespace Vocaluxe.Base } catch (Exception e) { - CLog.LogError("Error casting PartyMode file: " + file + "; " + e.Message); - return pm; + CLog.LogError("Error casting PartyMode file: " + filePath + "; " + e.Message); + return false; } - pm.PartyMode.Initialize(); - pm.PartyMode.SetFolder(pathToPm); - if (!CTheme.AddTheme(Path.Combine(pathToPm, "Theme.xml"), pm.PartyModeID)) - return pm; + if (!CLanguage.LoadPartyLanguageFiles(pm.PartyMode.ID, Path.Combine(pathToPm, CSettings.FolderNamePartyModeLanguages))) + { + CLog.LogError("Error loading language files for PartyMode: " + filePath); + return false; + } - int themeIndex = CTheme.GetThemeIndex(pm.PartyModeID); - CTheme.ListSkins(themeIndex); - int skinIndex = CTheme.GetSkinIndex(pm.PartyModeID); + if (!CThemes.ReadThemesFromFolder(Path.Combine(pathToPm, CSettings.FolderNameThemes), pm.PartyMode.ID)) + return false; - if (!CTheme.LoadSkin(skinIndex)) - return pm; - - if (!CTheme.LoadTheme(themeIndex)) - return pm; + if (!CThemes.LoadPartymodeTheme(pm.PartyMode.ID)) + return false; foreach (string screenfile in pm.ScreenFiles) { - string xmlPath = Path.Combine(pathToPm, CSettings.FolderNamePartyModeScreens); - CMenuParty screen = _GetPartyScreenInstance(output, screenfile, pm.Folder); + CMenuParty screen = _GetPartyScreenInstance(output, screenfile, pm.Info.Folder); if (screen != null) { - screen.Init(); screen.AssignPartyMode(pm.PartyMode); - screen.SetPartyModeID(pm.PartyModeID); - screen.LoadTheme(xmlPath); pm.PartyMode.AddScreen(screen, screenfile); } else - return pm; + return false; } - - pm.NoErrors = true; - return pm; + pm.PartyMode.LoadTheme(); + pm.Info.LoadData(pm.PartyMode); + return true; } private static Assembly _CompileFiles(string[] files) diff --git a/Vocaluxe/Base/CPlaylistElement.cs b/Vocaluxe/Base/CPlaylistElement.cs index 3b6588de..eec209c1 100644 --- a/Vocaluxe/Base/CPlaylistElement.cs +++ b/Vocaluxe/Base/CPlaylistElement.cs @@ -61,7 +61,7 @@ namespace Vocaluxe.Base get { return _Song != null ? _Song.Finish : 0f; } } - public CTexture Cover + public CTextureRef Cover { get { return _Song != null ? _Song.CoverTextureSmall : CCover.NoCover; } } diff --git a/Vocaluxe/Base/CPlaylists.cs b/Vocaluxe/Base/CPlaylists.cs index 2189fee2..f2f84ed8 100644 --- a/Vocaluxe/Base/CPlaylists.cs +++ b/Vocaluxe/Base/CPlaylists.cs @@ -31,7 +31,6 @@ namespace Vocaluxe.Base static class CPlaylists { private static List _Playlists; - private static int _NextID; public static IEnumerable Playlists { @@ -78,8 +77,9 @@ namespace Vocaluxe.Base foreach (string file in files) { - CPlaylistFile playlist = new CPlaylistFile(files.IndexOf(file), file); - _Playlists.Add(playlist); + CPlaylistFile playlist = new CPlaylistFile(); + if (playlist._Load(file)) + _Playlists.Add(playlist); } } @@ -130,7 +130,7 @@ namespace Vocaluxe.Base public static int NewPlaylist(string name = "New Playlist") { - CPlaylistFile pl = new CPlaylistFile(_NextID++) {Name = name}; + CPlaylistFile pl = new CPlaylistFile {Name = name}; _Playlists.Add(pl); return pl.Id; } @@ -212,7 +212,7 @@ namespace Vocaluxe.Base private static CPlaylistFile _ConvertUSDXPlaylist(string file) { - var pl = new CPlaylistFile(_NextID++); + var pl = new CPlaylistFile(); ReadOnlyCollection allSongs = CSongs.AllSongs; if (!File.Exists(file)) diff --git a/Vocaluxe/Base/CProfiles.cs b/Vocaluxe/Base/CProfiles.cs index 8c5c9887..1cf1d983 100644 --- a/Vocaluxe/Base/CProfiles.cs +++ b/Vocaluxe/Base/CProfiles.cs @@ -297,7 +297,7 @@ namespace Vocaluxe.Base public static CProfile[] GetProfiles() { if (_Profiles.Count == 0) - return null; + return new CProfile[0]; var list = new List(_Profiles.Values); list.Sort(_CompareByPlayerName); @@ -327,10 +327,10 @@ namespace Vocaluxe.Base { var profile = new CProfile { - FileName = fileName != "" ? Path.Combine(CConfig.ProfileFolders[0], fileName) : String.Empty + FilePath = fileName != "" ? Path.Combine(CConfig.ProfileFolders[0], fileName) : String.Empty }; - if (File.Exists(profile.FileName)) + if (File.Exists(profile.FilePath)) return -1; profile.ID = _ProfileIDs.Dequeue(); @@ -393,7 +393,7 @@ namespace Vocaluxe.Base if (!IsProfileIDValid(profileID)) return String.Empty; - return Path.GetFileName(_Profiles[profileID].FileName); + return Path.GetFileName(_Profiles[profileID].FilePath); } public static string AddGetPlayerName(int profileID, char chr) @@ -504,7 +504,7 @@ namespace Vocaluxe.Base #endregion profile properties #region avatar texture - public static CTexture GetAvatarTexture(int avatarID) + public static CTextureRef GetAvatarTexture(int avatarID) { if (!IsAvatarIDValid(avatarID)) return null; @@ -512,7 +512,7 @@ namespace Vocaluxe.Base return _Avatars[avatarID].Texture; } - public static CTexture GetAvatarTextureFromProfile(int profileID) + public static CTextureRef GetAvatarTextureFromProfile(int profileID) { if (!IsProfileIDValid(profileID) || _Profiles[profileID].Avatar == null) return null; @@ -534,7 +534,7 @@ namespace Vocaluxe.Base foreach (int id in ids) { if (_Profiles[id].LoadProfile()) - knownFiles.Add(Path.GetFileName(_Profiles[id].FileName)); + knownFiles.Add(Path.GetFileName(_Profiles[id].FilePath)); else _Profiles.Remove(id); } @@ -550,13 +550,9 @@ namespace Vocaluxe.Base if (knownFiles.Contains(Path.GetFileName(file))) continue; - var profile = new CProfile - { - FileName = Path.GetFileName(file), - FilePath = Path.GetDirectoryName(file) - }; + var profile = new CProfile(); - if (profile.LoadProfile()) + if (profile.LoadProfile(file)) { profile.ID = _ProfileIDs.Dequeue(); _Profiles.Add(profile.ID, profile); @@ -605,7 +601,7 @@ namespace Vocaluxe.Base if (!IsProfileIDValid(profileID)) return; - if (_Profiles[profileID].FileName == "") + if (string.IsNullOrEmpty(_Profiles[profileID].FilePath)) { _RemoveProfile(profileID); return; @@ -614,15 +610,15 @@ namespace Vocaluxe.Base try { //Check if profile saved in config - for (int i = 0; i < CConfig.Players.Length; i++) + for (int i = 0; i < CSettings.MaxNumPlayer; i++) { - if (CConfig.Players[i] == _Profiles[profileID].FileName) + if (CConfig.Config.Game.Players[i] == GetProfileFileName(profileID)) { - CConfig.Players[i] = string.Empty; + CConfig.Config.Game.Players[i] = string.Empty; CConfig.SaveConfig(); } } - File.Delete(Path.Combine(_Profiles[profileID].FilePath, _Profiles[profileID].FileName)); + File.Delete(_Profiles[profileID].FilePath); _RemoveProfile(profileID); //Check if profile is selected in game @@ -636,7 +632,7 @@ namespace Vocaluxe.Base } catch (Exception) { - CLog.LogError("Can't delete Profile File " + _Profiles[profileID].FileName + ".xml"); + CLog.LogError("Can't delete Profile File " + _Profiles[profileID].FilePath); } _ProfilesChanged = true; } diff --git a/Vocaluxe/Base/CRecord.cs b/Vocaluxe/Base/CRecord.cs index 43c8f099..9b671f76 100644 --- a/Vocaluxe/Base/CRecord.cs +++ b/Vocaluxe/Base/CRecord.cs @@ -31,7 +31,7 @@ namespace Vocaluxe.Base { if (_Record != null) return false; - switch (CConfig.RecordLib) + switch (CConfig.Config.Sound.RecordLib) { #if WIN case ERecordLib.DirectSound: @@ -137,10 +137,9 @@ namespace Vocaluxe.Base { for (int p = 0; p < CSettings.MaxNumPlayer; p++) { - if (CConfig.MicConfig[p].Channel != 0 && - CConfig.MicConfig[p].DeviceName == device && - CConfig.MicConfig[p].DeviceDriver == devicedriver && - CConfig.MicConfig[p].Channel == channel) + if (CConfig.Config.Record.MicConfig[p].DeviceName == device && + CConfig.Config.Record.MicConfig[p].DeviceDriver == devicedriver && + CConfig.Config.Record.MicConfig[p].Channel == channel) return p + 1; } return 0; diff --git a/Vocaluxe/Base/CSettings.cs b/Vocaluxe/Base/CSettings.cs index b419e7b1..0063a2e6 100644 --- a/Vocaluxe/Base/CSettings.cs +++ b/Vocaluxe/Base/CSettings.cs @@ -19,6 +19,7 @@ using System; using System.Collections.Generic; using System.IO; using System.Reflection; +using System.Windows.Forms; using VocaluxeLib; namespace Vocaluxe.Base @@ -53,8 +54,6 @@ namespace Vocaluxe.Base //Adjusting of programName and version now in the assembly config. //I'd use the major and minor for Main releases, build number for every public release and revision for every bugfix version without any features - //As it is different than before, this is open for discussion. - //TODO: Remove this when this is decided private const string _ProgramCodeName = "Shining Heaven"; public const ERevision VersionRevision = ERevision.Beta; @@ -65,6 +64,7 @@ namespace Vocaluxe.Base public const int RenderW = 1280; public const int RenderH = 720; + public static readonly SRectF RenderRect = new SRectF(0, 0, RenderW, RenderH, 0); public const int ZNear = -100; public const int ZFar = 100; @@ -95,6 +95,8 @@ namespace Vocaluxe.Base public const string FileNameDebugLog = "Debug.log"; public const string FileNameSongInfoLog = "SongInformation.log"; + public const string FileNameRequiredSkinElements = "RequiredSkinElements.xml"; + public const string FileNameSoundT440 = "440Hz.mp3"; public const string FolderNameSongs = "Songs"; @@ -113,7 +115,6 @@ namespace Vocaluxe.Base public const string FolderNamePartyModes = "PartyModes"; public const string FolderNamePartyModeCode = "Code"; - public const string FolderNamePartyModeScreens = "Screens"; public const string FolderNamePartyModeLanguages = "Languages"; public const string FolderNamePartyModeFonts = "Fonts"; @@ -122,6 +123,11 @@ namespace Vocaluxe.Base public const string LinkWebOSApp = "https://build.phonegap.com/apps/639714/download/webos/?qr_key=uY98ymvTr6K144RyTdhs"; public const string LinkWindowsPhoneApp = "https://build.phonegap.com/apps/639714/download/winphone/?qr_key=uY98ymvTr6K144RyTdhs"; + /// + /// Default name for themes, skins... + /// + public const string DefaultName = "Default"; + //public const String[] ToneStrings = new String[]{ "C", "C#", "D", "D#", "E", "F", "F#", "G", "G#", "A", "A#", "B" }; public const int ToneMin = -36; public const int ToneMax = 89; @@ -180,8 +186,11 @@ namespace Vocaluxe.Base // ReSharper disable ConditionIsAlwaysTrueOrFalse if (VersionRevision != ERevision.Release) + { // ReSharper restore ConditionIsAlwaysTrueOrFalse - version += " " + _GetVersionStatus() + String.Format(" ({0:0000)}", _Assembly.Version.Revision); + string gitversion = Application.ProductVersion; + version += " " + _GetVersionStatus() + String.Format(" ({0})", gitversion); + } return version; } diff --git a/Vocaluxe/Base/CSongCategorizer.cs b/Vocaluxe/Base/CSongCategorizer.cs index 4c16bf3a..ab7fb777 100644 --- a/Vocaluxe/Base/CSongCategorizer.cs +++ b/Vocaluxe/Base/CSongCategorizer.cs @@ -26,7 +26,7 @@ namespace Vocaluxe.Base class CSongCategorizer : CObservable { private readonly List _Categories = new List(); - private EOffOn _Tabs = CConfig.Tabs; + private EOffOn _Tabs = CConfig.Config.Game.Tabs; public CSongCategorizer() { @@ -178,7 +178,11 @@ namespace Vocaluxe.Base } foreach (CCategory cat in _Categories) + { cat.CoverTextureSmall = CCover.Cover(cat.Name); + if (cat.CoverTextureSmall == CCover.NoCover) + cat.CoverTextureSmall = CCover.GenerateCover(cat.Name, CCover._SongSortingToType(CSongs.Sorter.SongSorting), cat.GetSong(0)); + } _Changed = false; } } diff --git a/Vocaluxe/Base/CSongSorter.cs b/Vocaluxe/Base/CSongSorter.cs index f521118f..8a956107 100644 --- a/Vocaluxe/Base/CSongSorter.cs +++ b/Vocaluxe/Base/CSongSorter.cs @@ -27,8 +27,8 @@ namespace Vocaluxe.Base class CSongSorter : CObservable { private CSongPointer[] _SortedSongs = new CSongPointer[0]; - private EOffOn _IgnoreArticles = CConfig.IgnoreArticles; - private ESongSorting _SongSorting = CConfig.SongSorting; + private EOffOn _IgnoreArticles = CConfig.Config.Game.IgnoreArticles; + private ESongSorting _SongSorting = CConfig.Config.Game.SongSorting; public CSongSorter() { diff --git a/Vocaluxe/Base/CSongs.cs b/Vocaluxe/Base/CSongs.cs index 2bf74681..3216d620 100644 --- a/Vocaluxe/Base/CSongs.cs +++ b/Vocaluxe/Base/CSongs.cs @@ -21,6 +21,7 @@ using System.Collections.ObjectModel; using System.Linq; using System.Threading; using System.IO; +using System.Threading.Tasks; using VocaluxeLib; using VocaluxeLib.Songs; @@ -28,6 +29,8 @@ namespace Vocaluxe.Base { static class CSongs { + public delegate void CategoryChangedHandler(); + private static readonly List _Songs = new List(); private static readonly List _SongsForRandom = new List(); @@ -40,6 +43,7 @@ namespace Vocaluxe.Base public static readonly CSongCategorizer Categorizer = new CSongCategorizer(); private static Thread _CoverLoaderThread; + public static event CategoryChangedHandler OnCategoryChanged; public static List Songs { @@ -83,8 +87,14 @@ namespace Vocaluxe.Base } set { + if (value == _CatIndex) + return; if (value == -1 || _IsCatIndexValid(value)) + { _CatIndex = value; + if (OnCategoryChanged != null) + OnCategoryChanged(); + } } } @@ -134,23 +144,13 @@ namespace Vocaluxe.Base Category--; } - public static int GetNextSongWithoutCover(ref CSong song) + private static int _NumSongsWithCoverLoaded; + public static int NumSongsWithCoverLoaded { - if (!SongsLoaded) - return -1; - - if (NumSongsWithCoverLoaded < _Songs.Count) - { - song = _Songs[NumSongsWithCoverLoaded]; - NumSongsWithCoverLoaded++; - return NumSongsWithCoverLoaded; - } - - return -2; + get { return _NumSongsWithCoverLoaded; } + private set { _NumSongsWithCoverLoaded = value; } } - public static int NumSongsWithCoverLoaded { get; private set; } - public static string GetCurrentCategoryName() { return _IsCatIndexValid(_CatIndex) ? Categories[_CatIndex].Name : ""; @@ -363,67 +363,58 @@ namespace Vocaluxe.Base CLog.StopBenchmark("Read TXTs"); CLog.StartBenchmark("Sort Songs"); - Sorter.SongSorting = CConfig.SongSorting; - Sorter.IgnoreArticles = CConfig.IgnoreArticles; - Categorizer.Tabs = CConfig.Tabs; + Sorter.SongSorting = CConfig.Config.Game.SongSorting; + Sorter.IgnoreArticles = CConfig.Config.Game.IgnoreArticles; + Categorizer.Tabs = CConfig.Config.Game.Tabs; Categorizer.ObjectChanged += _HandleCategoriesChanged; CLog.StopBenchmark("Sort Songs"); Category = -1; SongsLoaded = true; - if (CConfig.CoverLoading == ECoverLoading.TR_CONFIG_COVERLOADING_ATSTART) + switch (CConfig.Config.Theme.CoverLoading) { - CLog.StartBenchmark("Load Covers/Notes"); - _LoadCover(); - CLog.StopBenchmark("Load Covers/Notes"); + case ECoverLoading.TR_CONFIG_COVERLOADING_ATSTART: + _LoadCovers(); + break; + case ECoverLoading.TR_CONFIG_COVERLOADING_DYNAMIC: + _LoadCoversAsync(); + break; } - CLog.StopBenchmark("Load Songs "); + CLog.StopBenchmark("Load Songs"); } - public static void LoadCover() + private static void _LoadCoversAsync() { - if (CConfig.Renderer == ERenderer.TR_CONFIG_SOFTWARE) - return; //should be removed as soon as the other renderer are ready for queue - if (!SongsLoaded || CoverLoaded) return; if (_CoverLoaderThread != null) return; - _CoverLoaderThread = new Thread(_LoadCover) {Name = "CoverLoader", Priority = ThreadPriority.BelowNormal, IsBackground = true}; + _CoverLoaderThread = new Thread(_LoadCovers) {Name = "CoverLoader", Priority = ThreadPriority.BelowNormal, IsBackground = true}; _CoverLoaderThread.Start(); - - /* - if (_CoverLoadTimer.ElapsedMilliseconds >= WaitTime) - { - for (int i = 0; i < NumLoads; i++) - { - CSong song = null; - int n = GetNextSongWithoutCover(ref song); - - if (n < 0) - return; - - song.LoadSmallCover(); - - if (n == NumAllSongs) - CDataBase.CommitCovers(); - } - _CoverLoadTimer.Reset(); - _CoverLoadTimer.Start(); - } - * */ } - private static void _LoadCover() + private static void _LoadCovers() { + CLog.StartBenchmark("Load Covers"); + int songCount = _Songs.Count; + AutoResetEvent ev = new AutoResetEvent(songCount == 0); + + NumSongsWithCoverLoaded = 0; foreach (CSong song in _Songs) { - song.LoadSmallCover(); - NumSongsWithCoverLoaded++; + CSong tmp = song; + Task.Factory.StartNew(() => + { + tmp.LoadSmallCover(); + if (Interlocked.Increment(ref _NumSongsWithCoverLoaded) >= songCount) + ev.Set(); + }); } + ev.WaitOne(); _CoverLoaded = true; CDataBase.CommitCovers(); + CLog.StopBenchmark("Load Covers"); } } } \ No newline at end of file diff --git a/Vocaluxe/Base/CSound.cs b/Vocaluxe/Base/CSound.cs index d20061f2..dc76f86f 100644 --- a/Vocaluxe/Base/CSound.cs +++ b/Vocaluxe/Base/CSound.cs @@ -15,7 +15,6 @@ // along with Vocaluxe. If not, see . #endregion -using System; using System.IO; using Vocaluxe.Lib.Sound.Playback; using Vocaluxe.Lib.Sound.Playback.GstreamerSharp; @@ -40,7 +39,7 @@ namespace Vocaluxe.Base { if (_Playback != null) return false; - switch (CConfig.PlayBackLib) + switch (CConfig.Config.Sound.PlayBackLib) { case EPlaybackLib.PortAudio: _Playback = new CPortAudioPlay(); @@ -61,7 +60,11 @@ namespace Vocaluxe.Base return _Playback.Init(); } - public static void SetGlobalVolume(float volume) + /// + /// Sets the volume (in percent 0-100) + /// + /// + public static void SetGlobalVolume(int volume) { _Playback.SetGlobalVolume(volume); } @@ -110,27 +113,27 @@ namespace Vocaluxe.Base _Playback.Stop(stream); } - public static void Fade(int stream, float targetVolume, float seconds, EStreamAction afterFadeAction = EStreamAction.Nothing) + public static void Fade(int stream, int targetVolume, float seconds, EStreamAction afterFadeAction = EStreamAction.Nothing) { _Playback.Fade(stream, targetVolume, seconds, afterFadeAction); } - public static void FadeAndPause(int stream, float targetVolume, float seconds) + public static void FadeAndPause(int stream, int targetVolume, float seconds) { Fade(stream, targetVolume, seconds, EStreamAction.Pause); } - public static void FadeAndClose(int stream, float targetVolume, float seconds) + public static void FadeAndClose(int stream, int targetVolume, float seconds) { Fade(stream, targetVolume, seconds, EStreamAction.Close); } - public static void FadeAndStop(int stream, float targetVolume, float seconds) + public static void FadeAndStop(int stream, int targetVolume, float seconds) { Fade(stream, targetVolume, seconds, EStreamAction.Stop); } - public static void SetStreamVolume(int stream, float volume) + public static void SetStreamVolume(int stream, int volume) { _Playback.SetStreamVolume(stream, volume); } @@ -205,8 +208,8 @@ namespace Vocaluxe.Base } if (length > 0f) { - SetStreamVolume(stream, 0f); - Fade(stream, 100f, length); + SetStreamVolume(stream, 0); + Fade(stream, 100, length); } } return stream; diff --git a/Vocaluxe/Base/CTheme.cs b/Vocaluxe/Base/CTheme.cs deleted file mode 100644 index 520353a4..00000000 --- a/Vocaluxe/Base/CTheme.cs +++ /dev/null @@ -1,836 +0,0 @@ -#region license -// This file is part of Vocaluxe. -// -// Vocaluxe is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// Vocaluxe is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with Vocaluxe. If not, see . -#endregion - -using System; -using System.Collections.Generic; -using System.IO; -using System.Windows.Forms; -using System.Xml; -using Vocaluxe.Base.Fonts; -using VocaluxeLib; -using VocaluxeLib.Draw; - -namespace Vocaluxe.Base -{ - - #region Structs - struct STheme - { - public string Name; - public string Author; - public string SkinFolder; - public int ThemeVersionMajor; - public int ThemeVersionMinor; - - public string Path; - public string FileName; - public int PartyModeID; - } - - class CSkinElement - { - public string Value; - public CTexture Texture; - } - - class CVideoSkinElement : CSkinElement - { - public int VideoIndex = -1; - } - - struct SSkin - { - public string Name; - public string Author; - public int SkinVersionMajor; - public int SkinVersionMinor; - - public string Path; - public string FileName; - public int PartyModeID; - - public Dictionary SkinList; - public Dictionary VideoList; - - public SColors ThemeColors; - } - - struct SColors - { - public SColorF[] Player; - public SColorScheme[] ColorSchemes; - } - - struct SColorScheme - { - public string Name; - public SColorF Color; - } - - struct SCursor - { - public string SkinName; - - public float W; - public float H; - - public float R; - public float G; - public float B; - public float A; - - public string Color; - } - #endregion Structs - - static class CTheme - { - // Version number for main theme and skin files. Increment it, if you've changed something on the theme files! - private const int _ThemeSystemVersion = 5; - private const int _SkinSystemVersion = 3; - - #region Vars - private static readonly List _Themes = new List(); - public static string[] ThemeNames - { - get - { - var names = new List(); - // ReSharper disable LoopCanBeConvertedToQuery - foreach (STheme th in _Themes) - // ReSharper restore LoopCanBeConvertedToQuery - { - if (th.PartyModeID == -1) - names.Add(th.Name); - } - return names.ToArray(); - } - } - - private static readonly List _Skins = new List(); - public static string[] SkinNames - { - get - { - var names = new List(); - // ReSharper disable LoopCanBeConvertedToQuery - foreach (SSkin sk in _Skins) - // ReSharper restore LoopCanBeConvertedToQuery - { - if (sk.PartyModeID == -1) - names.Add(sk.Name); - } - return names.ToArray(); - } - } - - public static SCursor Cursor; - #endregion Vars - - #region Theme and Skin loading and writing - public static bool Init() - { - _ListThemes(); - ListSkins(); - - return LoadSkins() && LoadTheme(); - } - - public static bool LoadSkins() - { - //Fail if loading of any skin failed or no skin was loaded - //TODO: implement handlers that failing skins are logged and ignored - bool result = false; - for (int index = 0; index < _Skins.Count; index++) - { - if (_Skins[index].PartyModeID == -1) - { - if (LoadSkin(index)) - result = true; - else - return false; - } - } - return result; - } - - public static bool LoadSkin(int skinIndex) - { - CXMLReader xmlReader = CXMLReader.OpenFile(Path.Combine(_Skins[skinIndex].Path, _Skins[skinIndex].FileName)); - if (xmlReader == null) - return false; - - // load skins/textures - foreach (KeyValuePair valuePair in _Skins[skinIndex].SkinList) - { - CSkinElement sk = valuePair.Value; - try - { - xmlReader.GetValue("//root/Skins/" + valuePair.Key, out sk.Value, String.Empty); - sk.Texture = CDraw.AddTexture(Path.Combine(_Skins[skinIndex].Path, sk.Value)); - } - catch (Exception e) - { - MessageBox.Show("Error on loading texture \"" + valuePair.Key + "\": " + e.Message + e.StackTrace); - CLog.LogError("Error on loading texture \"" + valuePair.Key + "\": " + e.Message + e.StackTrace); - } - } - - - // load videos - foreach (KeyValuePair valuePair in _Skins[skinIndex].VideoList) - { - try - { - xmlReader.GetValue("//root/Videos/" + valuePair.Key, out valuePair.Value.Value, String.Empty); - } - catch (Exception e) - { - MessageBox.Show("Error on loading video \"" + valuePair.Key + "\": " + e.Message + e.StackTrace); - CLog.LogError("Error on loading video \"" + valuePair.Key + "\": " + e.Message + e.StackTrace); - } - } - - // load colors - _LoadColors(xmlReader, skinIndex); - return true; - } - - public static void UnloadSkins() - { - for (int i = 0; i < _Skins.Count; i++) - { - foreach (CSkinElement sk in _Skins[i].SkinList.Values) - CDraw.RemoveTexture(ref sk.Texture); - - foreach (CVideoSkinElement vsk in _Skins[i].VideoList.Values) - { - CVideo.Close(vsk.VideoIndex); - CDraw.RemoveTexture(ref vsk.Texture); - } - } - - for (int i = 0; i < _Skins.Count; i++) - { - if (_Skins[i].PartyModeID != -1) - continue; - _Skins.RemoveAt(i); - i--; - } - } - - public static bool LoadTheme() - { - for (int i = 0; i < _Themes.Count; i++) - { - if (_Themes[i].Name == CConfig.Theme && _Themes[i].PartyModeID == -1) - return LoadTheme(i); - } - return false; - } - - public static bool LoadTheme(int themeIndex) - { - if (themeIndex < 0 || themeIndex >= _Themes.Count) - { - CLog.LogError("Can't find Theme Index " + themeIndex); - return false; - } - - CXMLReader xmlReader = CXMLReader.OpenFile(Path.Combine(_Themes[themeIndex].Path, _Themes[themeIndex].FileName)); - if (xmlReader == null) - return false; - - int skinIndex = GetSkinIndex(_Themes[themeIndex].PartyModeID); - - // Load Cursor - if (_Themes[themeIndex].PartyModeID == -1) - _LoadCursor(xmlReader, skinIndex); - - // load fonts - if (_Themes[themeIndex].PartyModeID == -1) - { - CFonts.LoadThemeFonts( - _Themes[themeIndex].Name, - Path.Combine(Path.Combine(_Themes[themeIndex].Path, _Themes[themeIndex].SkinFolder), CSettings.FolderNameThemeFonts), - xmlReader); - } - else - { - CFonts.LoadPartyModeFonts(_Themes[themeIndex].PartyModeID, - Path.Combine(_Themes[themeIndex].Path, CSettings.FolderNamePartyModeFonts), - xmlReader); - } - return true; - } - - public static void SaveTheme() - { - SaveSkin(); - - for (int i = 0; i < _Themes.Count; i++) - { - if (_Themes[i].Name == CConfig.Theme && _Themes[i].PartyModeID == -1 || _Themes[i].PartyModeID != -1) - _SaveTheme(i); - } - } - - private static void _SaveTheme(int themeIndex) - { - #region ThemeMainFile - using (XmlWriter writer = XmlWriter.Create(Path.Combine(_Themes[themeIndex].Path, _Themes[themeIndex].FileName), CConfig.XMLSettings)) - { - writer.WriteStartDocument(); - writer.WriteStartElement("root"); - - // ThemeSystemVersion - writer.WriteElementString("ThemeSystemVersion", _ThemeSystemVersion.ToString()); - - #region Info - writer.WriteStartElement("Info"); - - writer.WriteElementString("Name", _Themes[themeIndex].Name); - writer.WriteElementString("Author", _Themes[themeIndex].Author); - writer.WriteElementString("SkinFolder", _Themes[themeIndex].SkinFolder); - writer.WriteElementString("ThemeVersionMajor", _Themes[themeIndex].ThemeVersionMajor.ToString()); - writer.WriteElementString("ThemeVersionMinor", _Themes[themeIndex].ThemeVersionMinor.ToString()); - - writer.WriteEndElement(); - #endregion Info - - // Cursor - if (_Themes[themeIndex].PartyModeID == -1) - _SaveCursor(writer); - - // save fonts - if (_Themes[themeIndex].PartyModeID == -1) - CFonts.SaveThemeFonts(_Themes[themeIndex].Name, writer); - - - // End of File - writer.WriteEndElement(); //end of root - writer.WriteEndDocument(); - - writer.Flush(); - } - #endregion ThemeMainFile - } - - public static void SaveSkin() - { - for (int skinIndex = 0; skinIndex < _Skins.Count; skinIndex++) - { - using (XmlWriter writer = XmlWriter.Create(Path.Combine(_Skins[skinIndex].Path, _Skins[skinIndex].FileName), CConfig.XMLSettings)) - { - writer.WriteStartDocument(); - writer.WriteStartElement("root"); - - // ThemeSystemVersion - writer.WriteElementString("SkinSystemVersion", _SkinSystemVersion.ToString()); - - #region Info - writer.WriteStartElement("Info"); - - writer.WriteElementString("Name", _Skins[skinIndex].Name); - writer.WriteElementString("Author", _Skins[skinIndex].Author); - writer.WriteElementString("SkinVersionMajor", _Skins[skinIndex].SkinVersionMajor.ToString()); - writer.WriteElementString("SkinVersionMinor", _Skins[skinIndex].SkinVersionMinor.ToString()); - - writer.WriteEndElement(); - #endregion Info - - // save colors - _SaveColors(writer, skinIndex); - - #region Skins - writer.WriteStartElement("Skins"); - - foreach (KeyValuePair element in _Skins[skinIndex].SkinList) - writer.WriteElementString(element.Key, element.Value.Value); - writer.WriteEndElement(); - #endregion Skins - - #region Videos - writer.WriteStartElement("Videos"); - - foreach (KeyValuePair element in _Skins[skinIndex].VideoList) - writer.WriteElementString(element.Key, element.Value.Value); - writer.WriteEndElement(); - #endregion Videos - - // End of File - writer.WriteEndElement(); //end of root - writer.WriteEndDocument(); - - writer.Flush(); - } - } - } - - private static void _ListThemes() - { - _Themes.Clear(); - - string path = Path.Combine(CSettings.ProgramFolder, CSettings.FolderNameThemes); - List files = CHelper.ListFiles(path, "*.xml", false, true); - - foreach (string file in files) - AddTheme(file, -1); - } - - public static bool AddTheme(string filePath, int partyModeID) - { - CXMLReader xmlReader = CXMLReader.OpenFile(filePath); - if (xmlReader == null) - return false; - - var theme = new STheme(); - - int version = 0; - xmlReader.TryGetIntValue("//root/ThemeSystemVersion", ref version); - - if (version == _ThemeSystemVersion) - { - xmlReader.GetValue("//root/Info/Name", out theme.Name, String.Empty); - if (theme.Name != "") - { - xmlReader.GetValue("//root/Info/Author", out theme.Author, String.Empty); - xmlReader.GetValue("//root/Info/SkinFolder", out theme.SkinFolder, String.Empty); - xmlReader.TryGetIntValue("//root/Info/ThemeVersionMajor", ref theme.ThemeVersionMajor); - xmlReader.TryGetIntValue("//root/Info/ThemeVersionMinor", ref theme.ThemeVersionMinor); - theme.Path = Path.GetDirectoryName(filePath); - theme.FileName = Path.GetFileName(filePath); - theme.PartyModeID = partyModeID; - - _Themes.Add(theme); - } - } - else - { - string msg = "Can't load Theme \"" + filePath + "\", "; - if (version < _ThemeSystemVersion) - msg += "the file is outdated! "; - else - msg += "the file is for newer program versions! "; - - msg += "Current ThemeSystemVersion is " + _ThemeSystemVersion + " but found " + version; - CLog.LogError(msg); - } - return true; - } - - public static void ListSkins() - { - int themeIndex = GetThemeIndex(-1); - _Skins.Clear(); - - if (themeIndex < 0 || themeIndex >= _Themes.Count) - { - CLog.LogError("Error List Skins. Can't find Theme: " + CConfig.Theme); - return; - } - ListSkins(themeIndex); - } - - public static void ListSkins(int themeIndex) - { - if (themeIndex < 0 || themeIndex >= _Themes.Count) - { - CLog.LogError("Error List Skins. Can't find Theme index: " + themeIndex); - return; - } - - STheme theme = _Themes[themeIndex]; - - string path = Path.Combine(theme.Path, theme.SkinFolder); - List files = CHelper.ListFiles(path, "*.xml"); - - foreach (string file in files) - { - CXMLReader xmlReader = CXMLReader.OpenFile(Path.Combine(path, file)); - if (xmlReader == null) - continue; - - var skin = new SSkin(); - - int version = 0; - xmlReader.TryGetIntValue("//root/SkinSystemVersion", ref version); - - if (version == _SkinSystemVersion) - { - xmlReader.GetValue("//root/Info/Name", out skin.Name, String.Empty); - if (skin.Name != "") - { - xmlReader.GetValue("//root/Info/Author", out skin.Author, String.Empty); - xmlReader.TryGetIntValue("//root/Info/SkinVersionMajor", ref skin.SkinVersionMajor); - xmlReader.TryGetIntValue("//root/Info/SkinVersionMinor", ref skin.SkinVersionMinor); - - - skin.Path = path; - skin.FileName = file; - skin.PartyModeID = theme.PartyModeID; - - skin.SkinList = new Dictionary(); - List names = xmlReader.GetNames("//root/Skins/*"); - foreach (string str in names) - skin.SkinList[str] = new CSkinElement(); - - skin.VideoList = new Dictionary(); - names = xmlReader.GetNames("//root/Videos/*"); - foreach (string str in names) - skin.VideoList[str] = new CVideoSkinElement(); - _Skins.Add(skin); - } - } - else - { - string msg = "Can't load Skin \"" + file + "\", "; - if (version < _SkinSystemVersion) - msg += "the file ist outdated! "; - else - msg += "the file is for newer program versions! "; - - msg += "Current SkinSystemVersion is " + _SkinSystemVersion; - CLog.LogError(msg); - } - } - } - #endregion Theme and Skin loading and writing - - #region Theme and Skin index handling - public static int GetSkinIndex(int partyModeID) - { - for (int i = 0; i < _Skins.Count; i++) - { - if (partyModeID != -1 && _Skins[i].PartyModeID == partyModeID) - return i; - if (partyModeID == -1 && _Skins[i].Name == CConfig.Skin) - return i; - } - - return -1; - } - - public static int GetThemeIndex(int partyModeID) - { - for (int i = 0; i < _Themes.Count; i++) - { - if (partyModeID != -1 && _Themes[i].PartyModeID == partyModeID) - return i; - if (partyModeID == -1 && _Themes[i].Name == CConfig.Theme) - return i; - } - - return -1; - } - - public static string GetThemeScreensPath(int partyModeID) - { - string path = String.Empty; - - int themeIndex = GetThemeIndex(partyModeID); - if (themeIndex != -1) - { - path = Path.Combine(_Themes[themeIndex].Path, _Themes[themeIndex].SkinFolder); - path = Path.Combine(path, CSettings.FolderNameScreens); - } - else - CLog.LogError("Can't find current Theme"); - - return path; - } - - public static CTexture GetSkinTexture(string textureName, int partyModeID) - { - int skinIndex = GetSkinIndex(partyModeID); - CSkinElement sk; - if (skinIndex != -1 && textureName != null && _Skins[skinIndex].SkinList.TryGetValue(textureName, out sk)) - return sk.Texture; - return null; - } - - public static string GetSkinFilePath(string skinName, int partyModeID) - { - return _GetSkinFileName(skinName, GetSkinIndex(partyModeID), true); - } - - private static string _GetSkinFileName(string skinName, int skinIndex, bool returnPath = false) - { - CSkinElement sk; - if (_Skins[skinIndex].SkinList.TryGetValue(skinName, out sk)) - return !returnPath ? sk.Value : Path.Combine(_Skins[skinIndex].Path, sk.Value); - - CLog.LogError("Can't find Skin Element \"" + skinName); - return skinName; - } - - public static CVideoSkinElement GetSkinVideo(string videoName, int partyModeID, bool load = true) - { - int skinIndex = GetSkinIndex(partyModeID); - if (skinIndex != -1) - { - CVideoSkinElement sk; - if (_Skins[skinIndex].VideoList.TryGetValue(videoName, out sk)) - { - if (sk.VideoIndex == -1 && load) - { - sk.VideoIndex = CVideo.Load(GetVideoFilePath(videoName, partyModeID)); - CVideo.SetLoop(sk.VideoIndex, true); - } - return sk; - } - } - return null; - } - - public static CTexture GetSkinVideoTexture(string videoName, int partyModeID) - { - CVideoSkinElement sk = GetSkinVideo(videoName, partyModeID); - if (sk == null) - return null; - float time = 0f; - CVideo.GetFrame(sk.VideoIndex, ref sk.Texture, time, out time); - return sk.Texture; - } - - public static void SkinVideoPause(string videoName, int partyModeID) - { - CVideoSkinElement sk = GetSkinVideo(videoName, partyModeID, false); - if (sk == null) - return; - CVideo.Pause(sk.VideoIndex); - } - - public static void SkinVideoResume(string videoName, int partyModeID) - { - CVideoSkinElement sk = GetSkinVideo(videoName, partyModeID); - if (sk == null) - return; - CVideo.Resume(sk.VideoIndex); - } - - public static string GetVideoFilePath(string videoName, int partyModeID) - { - return _GetVideoFileName(videoName, GetSkinIndex(partyModeID), true); - } - - private static string _GetVideoFileName(string videoName, int skinIndex, bool returnPath = false) - { - CVideoSkinElement sk; - if (_Skins[skinIndex].VideoList.TryGetValue(videoName, out sk)) - return !returnPath ? sk.Value : Path.Combine(_Skins[skinIndex].Path, sk.Value); - - CLog.LogError("Can't find Video Element \"" + videoName); - return videoName; - } - #endregion Theme and Skin index handling - - #region Element loading - private static void _LoadColors(CXMLReader xmlReader, int skinIndex) - { - SSkin skin = _Skins[skinIndex]; - - if (_Skins[skinIndex].PartyModeID == -1) - { - var playerColors = new List(); - float value = 0f; - - int i = 1; - while (xmlReader.TryGetFloatValue("//root/Colors/Player" + i + "/R", ref value)) - { - var color = new SColorF {R = value}; - - xmlReader.TryGetFloatValue("//root/Colors/Player" + i + "/G", ref color.G); - xmlReader.TryGetFloatValue("//root/Colors/Player" + i + "/B", ref color.B); - xmlReader.TryGetFloatValue("//root/Colors/Player" + i + "/A", ref color.A); - - playerColors.Add(color); - i++; - } - skin.ThemeColors.Player = playerColors.ToArray(); - } - - var colorScheme = new List(); - List names = xmlReader.GetNames("//root/ColorSchemes/*"); - foreach (string str in names) - { - var scheme = new SColorScheme {Name = str}; - - xmlReader.TryGetFloatValue("//root/ColorSchemes/" + str + "/R", ref scheme.Color.R); - xmlReader.TryGetFloatValue("//root/ColorSchemes/" + str + "/G", ref scheme.Color.G); - xmlReader.TryGetFloatValue("//root/ColorSchemes/" + str + "/B", ref scheme.Color.B); - xmlReader.TryGetFloatValue("//root/ColorSchemes/" + str + "/A", ref scheme.Color.A); - - colorScheme.Add(scheme); - } - skin.ThemeColors.ColorSchemes = colorScheme.ToArray(); - - _Skins[skinIndex] = skin; - } - - private static void _LoadCursor(CXMLReader xmlReader, int skinIndex) - { - string value = String.Empty; - xmlReader.GetValue("//root/Cursor/Skin", out Cursor.SkinName, value); - - xmlReader.TryGetFloatValue("//root/Cursor/W", ref Cursor.W); - xmlReader.TryGetFloatValue("//root/Cursor/H", ref Cursor.H); - - if (xmlReader.GetValue("//root/Cursor/Color", out value, value)) - { - SColorF color = GetColor(value, _Skins[skinIndex].PartyModeID); - Cursor.R = color.R; - Cursor.G = color.G; - Cursor.B = color.B; - Cursor.A = color.A; - Cursor.Color = value; - } - else - { - Cursor.Color = String.Empty; - xmlReader.TryGetFloatValue("//root/Cursor/R", ref Cursor.R); - xmlReader.TryGetFloatValue("//root/Cursor/G", ref Cursor.G); - xmlReader.TryGetFloatValue("//root/Cursor/B", ref Cursor.B); - xmlReader.TryGetFloatValue("//root/Cursor/A", ref Cursor.A); - } - } - #endregion Element loading - - #region Element Writing - private static void _SaveColors(XmlWriter writer, int skinIndex) - { - if (_Skins[skinIndex].PartyModeID == -1) - { - writer.WriteStartElement("Colors"); - for (int i = 0; i < _Skins[skinIndex].ThemeColors.Player.Length; i++) - { - writer.WriteStartElement("Player" + (i + 1)); - - writer.WriteElementString("R", _Skins[skinIndex].ThemeColors.Player[i].R.ToString("#0.000")); - writer.WriteElementString("G", _Skins[skinIndex].ThemeColors.Player[i].G.ToString("#0.000")); - writer.WriteElementString("B", _Skins[skinIndex].ThemeColors.Player[i].B.ToString("#0.000")); - writer.WriteElementString("A", _Skins[skinIndex].ThemeColors.Player[i].A.ToString("#0.000")); - - writer.WriteEndElement(); - } - writer.WriteEndElement(); - } - - writer.WriteStartElement("ColorSchemes"); - foreach (SColorScheme scheme in _Skins[skinIndex].ThemeColors.ColorSchemes) - { - writer.WriteStartElement(scheme.Name); - - writer.WriteElementString("R", scheme.Color.R.ToString("#0.000")); - writer.WriteElementString("G", scheme.Color.G.ToString("#0.000")); - writer.WriteElementString("B", scheme.Color.B.ToString("#0.000")); - writer.WriteElementString("A", scheme.Color.A.ToString("#0.000")); - - writer.WriteEndElement(); - } - writer.WriteEndElement(); - } - - private static void _SaveCursor(XmlWriter writer) - { - writer.WriteStartElement("Cursor"); - - writer.WriteElementString("Skin", Cursor.SkinName); - - writer.WriteElementString("W", Cursor.W.ToString("#0.000")); - writer.WriteElementString("H", Cursor.H.ToString("#0.000")); - - if (!String.IsNullOrEmpty(Cursor.Color)) - writer.WriteElementString("Color", Cursor.Color); - else - { - writer.WriteElementString("R", Cursor.R.ToString("#0.000")); - writer.WriteElementString("G", Cursor.G.ToString("#0.000")); - writer.WriteElementString("B", Cursor.B.ToString("#0.000")); - writer.WriteElementString("A", Cursor.A.ToString("#0.000")); - } - - writer.WriteEndElement(); - } - #endregion ElementWriting - - #region Color Handling - public static SColorF GetColor(string colorName, int partyModeID) - { - SColorF color; - - int skinIndex = GetSkinIndex(partyModeID); - - GetColor(colorName, skinIndex, out color); - return color; - } - - public static bool GetColor(string colorName, int skinIndex, out SColorF color) - { - foreach (SColorScheme scheme in _Skins[skinIndex].ThemeColors.ColorSchemes) - { - if (scheme.Name == colorName) - { - color = new SColorF(scheme.Color); - return true; - } - } - - bool success; - color = GetPlayerColor(colorName, GetSkinIndex(-1), out success); - return success; - } - - public static SColorF GetPlayerColor(int playerNr) - { - bool dummy; - return GetPlayerColor(playerNr, out dummy); - } - - public static SColorF GetPlayerColor(string playerNrString) - { - bool dummy; - return GetPlayerColor(playerNrString, GetSkinIndex(-1), out dummy); - } - - public static SColorF GetPlayerColor(string playerNrString, int skinIndex, out bool success) - { - int selection = 0; - if (playerNrString != null && playerNrString.StartsWith("Player")) - int.TryParse(playerNrString.Substring(6), out selection); - - return GetPlayerColor(selection, skinIndex, out success); - } - - public static SColorF GetPlayerColor(int playerNr, out bool success) - { - return GetPlayerColor(playerNr, GetSkinIndex(-1), out success); - } - - public static SColorF GetPlayerColor(int playerNr, int skinIndex, out bool success) - { - success = false; - - if (_Skins[skinIndex].ThemeColors.Player.Length < playerNr || playerNr < 1) - return new SColorF(1f, 1f, 1f, 1f); - - success = true; - return _Skins[skinIndex].ThemeColors.Player[playerNr - 1]; - } - #endregion Color Handling - } -} \ No newline at end of file diff --git a/Vocaluxe/Base/CVideo.cs b/Vocaluxe/Base/CVideo.cs index 3d57cbd3..d9400cc8 100644 --- a/Vocaluxe/Base/CVideo.cs +++ b/Vocaluxe/Base/CVideo.cs @@ -17,7 +17,6 @@ using Vocaluxe.Lib.Video; using VocaluxeLib; -using VocaluxeLib.Draw; namespace Vocaluxe.Base { @@ -31,7 +30,7 @@ namespace Vocaluxe.Base { if (_VideoDecoder != null) return false; - switch (CConfig.VideoDecoder) + switch (CConfig.Config.Video.VideoDecoder) { case EVideoDecoder.FFmpeg: _VideoDecoder = new CVideoDecoderFFmpeg(); @@ -60,49 +59,51 @@ namespace Vocaluxe.Base return _VideoDecoder.GetNumStreams(); } - public static int Load(string videoFileName) + public static CVideoStream Load(string videoFileName) { return _VideoDecoder.Load(videoFileName); } - public static bool Close(int streamID) + public static void Close(ref CVideoStream stream) { - return _VideoDecoder.Close(streamID); + //Check for null because the videostreams may close themselves on destroy (GC) + if (_VideoDecoder != null) + _VideoDecoder.Close(ref stream); } - public static float GetLength(int streamID) + public static float GetLength(CVideoStream stream) { - return _VideoDecoder.GetLength(streamID); + return _VideoDecoder.GetLength(stream); } - public static bool GetFrame(int streamID, ref CTexture frame, float time, out float videoTime) + public static bool GetFrame(CVideoStream stream, float time) { - return _VideoDecoder.GetFrame(streamID, ref frame, time, out videoTime); + return _VideoDecoder.GetFrame(stream, time); } - public static bool Skip(int streamID, float start, float gap) + public static bool Skip(CVideoStream stream, float start, float gap) { - return _VideoDecoder.Skip(streamID, start, gap); + return _VideoDecoder.Skip(stream, start, gap); } - public static void SetLoop(int streamID, bool loop) + public static void SetLoop(CVideoStream stream, bool loop) { - _VideoDecoder.SetLoop(streamID, loop); + _VideoDecoder.SetLoop(stream, loop); } - public static void Pause(int streamID) + public static void Pause(CVideoStream stream) { - _VideoDecoder.Pause(streamID); + _VideoDecoder.Pause(stream); } - public static void Resume(int streamID) + public static void Resume(CVideoStream stream) { - _VideoDecoder.Resume(streamID); + _VideoDecoder.Resume(stream); } - public static bool Finished(int streamID) + public static bool Finished(CVideoStream stream) { - return _VideoDecoder.Finished(streamID); + return _VideoDecoder.Finished(stream); } public static void Update() diff --git a/Vocaluxe/Base/CVideoPlayer.cs b/Vocaluxe/Base/CVideoPlayer.cs index 8dd47d4b..86e8537b 100644 --- a/Vocaluxe/Base/CVideoPlayer.cs +++ b/Vocaluxe/Base/CVideoPlayer.cs @@ -1,14 +1,29 @@ -using System.Diagnostics; -using System.Drawing; +#region license +// This file is part of Vocaluxe. +// +// Vocaluxe is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Vocaluxe is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with Vocaluxe. If not, see . +#endregion + +using System.Diagnostics; +using Vocaluxe.Base.ThemeSystem; using VocaluxeLib; -using VocaluxeLib.Draw; namespace Vocaluxe.Base { class CVideoPlayer { - private CTexture _VideoTexture; - private int _VideoStream; + private CVideoStream _VideoStream; private readonly Stopwatch _VideoTimer = new Stopwatch(); private bool _Finished; private bool _Loaded; @@ -25,7 +40,7 @@ namespace Vocaluxe.Base public void Load(string videoName) { - _VideoStream = CVideo.Load(CTheme.GetVideoFilePath(videoName, -1)); + _VideoStream = CThemes.GetSkinVideo(videoName, -1, false); _Loaded = true; CVideo.Pause(_VideoStream); } @@ -58,15 +73,12 @@ namespace Vocaluxe.Base float videoTime = _VideoTimer.ElapsedMilliseconds / 1000f; _Finished = CVideo.Finished(_VideoStream); - CVideo.GetFrame(_VideoStream, ref _VideoTexture, videoTime, out videoTime); + CVideo.GetFrame(_VideoStream, videoTime); } - if (_VideoTexture == null) + if (_VideoStream.Texture == null) return; - var bounds = new RectangleF(0f, 0f, CSettings.RenderW, CSettings.RenderH); - RectangleF rect; - CHelper.SetRect(bounds, out rect, _VideoTexture.OrigAspect, EAspect.Crop); - CDraw.DrawTexture(_VideoTexture, new SRectF(rect.X, rect.Y, rect.Width, rect.Height, CSettings.ZFar / 4)); + CDraw.DrawTexture(_VideoStream.Texture, CSettings.RenderRect, EAspect.Crop); } public void PreLoad() @@ -75,10 +87,9 @@ namespace Vocaluxe.Base if (paused) CVideo.Resume(_VideoStream); float videoTime = 0f; - while (_VideoTexture == null && videoTime < 1f) + while (_VideoStream.Texture == null && videoTime < 1f) { - float dummy; - CVideo.GetFrame(_VideoStream, ref _VideoTexture, 0, out dummy); + CVideo.GetFrame(_VideoStream, 0); videoTime += 0.05f; } if (paused) @@ -87,8 +98,7 @@ namespace Vocaluxe.Base public void Close() { - CVideo.Close(_VideoStream); - CDraw.RemoveTexture(ref _VideoTexture); + CVideo.Close(ref _VideoStream); _Loaded = false; _Finished = false; _VideoTimer.Reset(); diff --git a/Vocaluxe/Base/CWebcam.cs b/Vocaluxe/Base/CWebcam.cs index af66025a..a73e1fd0 100644 --- a/Vocaluxe/Base/CWebcam.cs +++ b/Vocaluxe/Base/CWebcam.cs @@ -30,7 +30,7 @@ namespace Vocaluxe.Base { if (_Webcam != null) return false; - switch (CConfig.WebcamLib) + switch (CConfig.Config.Video.WebcamLib) { case EWebcamLib.AForgeNet: _Webcam = new CAForgeNet(); @@ -42,9 +42,9 @@ namespace Vocaluxe.Base } if (!_Webcam.Init()) return false; - _Webcam.Select(CConfig.WebcamConfig); + _Webcam.Select(CConfig.Config.Video.WebcamConfig.HasValue ? CConfig.Config.Video.WebcamConfig.Value : new SWebcamConfig()); - CConfig.WebcamConfig = _Webcam.GetConfig(); + CConfig.Config.Video.WebcamConfig = _Webcam.GetConfig(); CConfig.SaveConfig(); return true; } @@ -57,7 +57,7 @@ namespace Vocaluxe.Base _Webcam = null; } - public static bool GetFrame(ref CTexture tex) + public static bool GetFrame(ref CTextureRef tex) { return _Webcam != null && _Webcam.GetFrame(ref tex); } @@ -69,23 +69,20 @@ namespace Vocaluxe.Base public static void Pause() { - if (_Webcam == null) - return; - _Webcam.Pause(); + if (_Webcam != null) + _Webcam.Pause(); } public static void Start() { - if (_Webcam == null) - return; - _Webcam.Start(); + if (_Webcam != null) + _Webcam.Start(); } public static void Stop() { - if (_Webcam == null) - return; - _Webcam.Stop(); + if (_Webcam != null) + _Webcam.Stop(); } public static bool Select(SWebcamConfig c) @@ -95,9 +92,8 @@ namespace Vocaluxe.Base public static void DeSelect() { - if (_Webcam == null) - return; - _Webcam.DeSelect(); + if (_Webcam != null) + _Webcam.DeSelect(); } public static SWebcamDevice[] GetDevices() diff --git a/Vocaluxe/Base/Fonts/CFont.cs b/Vocaluxe/Base/Fonts/CFontStyle.cs similarity index 52% rename from Vocaluxe/Base/Fonts/CFont.cs rename to Vocaluxe/Base/Fonts/CFontStyle.cs index e1408b72..ba59e87b 100644 --- a/Vocaluxe/Base/Fonts/CFont.cs +++ b/Vocaluxe/Base/Fonts/CFontStyle.cs @@ -24,48 +24,64 @@ using VocaluxeLib.Draw; namespace Vocaluxe.Base.Fonts { - class CFont : IDisposable + class CFontStyle : IDisposable { - private readonly Dictionary _Glyphs; + private readonly string _FilePath; + private readonly EStyle _Style; + public readonly float Outline; //0..1, 0=not outline 1=100% outline + public readonly SColorF OutlineColor; + private readonly float _MaxGlyphHeight; + private readonly Dictionary _Glyphs = new Dictionary(); private PrivateFontCollection _Fonts; private FontFamily _Family; - private readonly float _MaxGlyphHeight; - private readonly string _FilePath; - - private bool _Disposed; - - public CFont(string file) + public CFontStyle(string file, EStyle style, float outline, SColorF outlineColor) { _FilePath = file; + _Style = style; + Outline = outline; + OutlineColor = outlineColor; - _Glyphs = new Dictionary(); - - switch (CConfig.TextureQuality) + switch (CConfig.Config.Graphics.TextureQuality) { case ETextureQuality.TR_CONFIG_TEXTURE_LOWEST: - _MaxGlyphHeight = 25f; + _MaxGlyphHeight = 20f; break; case ETextureQuality.TR_CONFIG_TEXTURE_LOW: - _MaxGlyphHeight = 50f; + _MaxGlyphHeight = 40f; break; case ETextureQuality.TR_CONFIG_TEXTURE_MEDIUM: - _MaxGlyphHeight = 100f; + _MaxGlyphHeight = 60f; break; case ETextureQuality.TR_CONFIG_TEXTURE_HIGH: - _MaxGlyphHeight = 200f; + _MaxGlyphHeight = 80f; break; case ETextureQuality.TR_CONFIG_TEXTURE_HIGHEST: - _MaxGlyphHeight = 400f; - break; - default: _MaxGlyphHeight = 100f; break; + default: + _MaxGlyphHeight = 60f; + break; } - _MaxGlyphHeight = 50; } - public Font GetFont() + private FontStyle _GetSystemFontStyle() + { + switch (_Style) + { + case EStyle.Normal: + return FontStyle.Regular; + case EStyle.Italic: + return FontStyle.Italic; + case EStyle.Bold: + return FontStyle.Bold; + case EStyle.BoldItalic: + return FontStyle.Bold | FontStyle.Italic; + } + throw new ArgumentException("Invalid style: " + _Style); + } + + public Font GetSystemFont(float height) { if (_Fonts == null) { @@ -80,100 +96,83 @@ namespace Vocaluxe.Base.Fonts CLog.LogError("Error opening font file " + _FilePath + ": " + e.Message); } } - return new Font(_Family, CFonts.Height, CFonts.GetFontStyle(), GraphicsUnit.Pixel); + return new Font(_Family, height, _GetSystemFontStyle(), GraphicsUnit.Pixel); } - public void DrawGlyph(char chr, float x, float y, float z, SColorF color) + public void DrawGlyph(char chr, float fontHeight, float x, float y, float z, SColorF color) { - CTexture texture; + CTextureRef texture; SRectF rect; - GetOrAddGlyph(chr).GetTextureAndRect(x, y, z, out texture, out rect); + GetOrAddGlyph(chr, fontHeight).GetTextureAndRect(fontHeight, x, y, z, out texture, out rect); CDraw.DrawTexture(texture, rect, color); } - public void DrawGlyph(char chr, float x, float y, float z, SColorF color, float begin, float end) + public void DrawGlyph(char chr, float fontHeight, float x, float y, float z, SColorF color, float begin, float end) { - CTexture texture; + CTextureRef texture; SRectF rect; - GetOrAddGlyph(chr).GetTextureAndRect(x, y, z, out texture, out rect); + GetOrAddGlyph(chr, fontHeight).GetTextureAndRect(fontHeight, x, y, z, out texture, out rect); CDraw.DrawTexture(texture, rect, color, begin, end); } - public void DrawGlyphReflection(char chr, float x, float y, float z, SColorF color, float rspace, float rheight) + public void DrawGlyphReflection(char chr, float fontHeight, float x, float y, float z, SColorF color, float rspace, float rheight) { - CTexture texture; + CTextureRef texture; SRectF rect; - GetOrAddGlyph(chr).GetTextureAndRect(x, y, z, out texture, out rect); + GetOrAddGlyph(chr, fontHeight).GetTextureAndRect(fontHeight, x, y, z, out texture, out rect); CDraw.DrawTextureReflection(texture, rect, color, rect, rspace, rheight); } - public float GetWidth(char chr) + public float GetWidth(char chr, float height) { - return GetOrAddGlyph(chr).Width; + return GetOrAddGlyph(chr, height).GetWidth(height); } - public float GetHeight(char chr) + public float GetHeight(char chr, float height) { - return GetOrAddGlyph(chr).Height; + return GetOrAddGlyph(chr, height).GetHeight(height); } - public CGlyph GetOrAddGlyph(char chr) + public CGlyph GetOrAddGlyph(char chr, float height) { CGlyph glyph; if (!_Glyphs.TryGetValue(chr, out glyph)) { - glyph = new CGlyph(chr, _MaxGlyphHeight); + float maxHeight = (height < 0 || _MaxGlyphHeight + 50 >= height) ? _MaxGlyphHeight : (float)Math.Round(height / 50) * 50; + glyph = new CGlyph(chr, this, maxHeight); _Glyphs.Add(chr, glyph); } - if (glyph.MaxHeight + 50 < CFonts.Height) + if (glyph.MaxHeight + 50 < height) { glyph.UnloadTexture(); - glyph = new CGlyph(chr, (float)Math.Round(CFonts.Height / 50) * 50); + glyph = new CGlyph(chr, this, (float)Math.Round(height / 50) * 50); _Glyphs[chr] = glyph; } return glyph; } - public void UnloadGlyphs() + private void _UnloadGlyphs() { foreach (CGlyph glyph in _Glyphs.Values) glyph.UnloadTexture(); _Glyphs.Clear(); } + private bool _Disposed; + public void Dispose() { if (!_Disposed) { if (_Fonts != null) + { _Fonts.Dispose(); - UnloadGlyphs(); + _Fonts = null; + } + _UnloadGlyphs(); _Disposed = true; } GC.SuppressFinalize(this); } } - - struct SFont - { - public string Name; - - public bool IsThemeFont; - public int PartyModeID; - public string ThemeName; - - public string Folder; - public string FileNormal; - public string FileItalic; - public string FileBold; - public string FileBoldItalic; - - public float Outline; //0..1, 0=not outline 1=100% outline - public SColorF OutlineColor; - - public CFont Normal; - public CFont Italic; - public CFont Bold; - public CFont BoldItalic; - } } \ No newline at end of file diff --git a/Vocaluxe/Base/Fonts/CFonts.cs b/Vocaluxe/Base/Fonts/CFonts.cs index 1fa9ee31..b0ab10d8 100644 --- a/Vocaluxe/Base/Fonts/CFonts.cs +++ b/Vocaluxe/Base/Fonts/CFonts.cs @@ -15,216 +15,132 @@ // along with Vocaluxe. If not, see . #endregion +using System; using System.Collections.Generic; +using System.Diagnostics; using System.Drawing; using System.IO; using System.Linq; -using System.Xml; using VocaluxeLib; using VocaluxeLib.Menu; +using VocaluxeLib.Xml; namespace Vocaluxe.Base.Fonts { static class CFonts { - private static readonly List _Fonts = new List(); - private static int _CurrentFont; - private static float _Height = 1f; + private static bool _IsInitialized; + private static readonly List _FontFamilies = new List(); + private static readonly List _LoggedMissingFonts = new List(); - // ReSharper disable MemberCanBePrivate.Global public static int PartyModeID { get; set; } - // ReSharper restore MemberCanBePrivate.Global - public static EStyle Style = EStyle.Normal; - - public static float Height + public static bool Init() { - get { return _Height; } - set { _Height = value < 0f ? 0f : value; } - } - - public static float Outline - { - get { return _Fonts[_CurrentFont].Outline; } - } - - public static SColorF OutlineColor - { - get { return _Fonts[_CurrentFont].OutlineColor; } - } - - public static void Init() - { - _CurrentFont = 0; + if (_IsInitialized) + return false; PartyModeID = -1; - _BuildFonts(); + return _LoadDefaultFonts(); } - private static void _BuildFonts() + public static void Close() { - foreach (SFont font in _Fonts) - { - font.Normal.Dispose(); - font.Bold.Dispose(); - font.Italic.Dispose(); - font.BoldItalic.Dispose(); - } - _Fonts.Clear(); - _CurrentFont = 0; - - _LoadFontList(); - } - - public static Font GetFont() - { - return _GetCurrentFont().GetFont(); - } - - private static CFont _GetCurrentFont() - { - switch (Style) - { - case EStyle.Normal: - return _Fonts[_CurrentFont].Normal; - case EStyle.Italic: - return _Fonts[_CurrentFont].Italic; - case EStyle.Bold: - return _Fonts[_CurrentFont].Bold; - case EStyle.BoldItalic: - return _Fonts[_CurrentFont].BoldItalic; - } - //Just in case... - return _Fonts[_CurrentFont].Normal; + foreach (SFontFamily font in _FontFamilies) + font.Dispose(); + _FontFamilies.Clear(); + _IsInitialized = false; } #region DrawText - public static void DrawText(string text, int x, int y, int h) + /// + /// Draws a black text + /// + /// The text to be drawn + /// The texts font + /// The texts x-position + /// The texts y-position + /// The texts z-position + public static void DrawText(string text, CFont font, float x, float y, float z) { - DrawText(text, h, x, y, 0f, new SColorF(0f, 0f, 0f, 1f)); - } - - public static void DrawText(string text, float x, float y, float z) - { - DrawText(text, Height, x, y, z, new SColorF(0f, 0f, 0f, 1f)); + DrawText(text, font, x, y, z, new SColorF(0f, 0f, 0f, 1f)); } /// - /// Draws a text string + /// Draws a text /// /// The text to be drawn - /// The text's x-position - /// The text's y-position - /// The text's height - /// The text's z-position + /// The texts font + /// The texts x-position + /// The texts y-position + /// The texts z-position /// The text color - public static void DrawText(string text, float h, float x, float y, float z, SColorF color) + public static void DrawText(string text, CFont font, float x, float y, float z, SColorF color) { - if (h <= 0f) + if (font.Height <= 0f || text == "") return; - if (text == "") - return; - - Height = h; - CFont font = _GetCurrentFont(); + CFontStyle fontStyle = _GetFontStyle(font); float dx = x; foreach (char chr in text) { - font.DrawGlyph(chr, dx, y, z, color); - dx += font.GetWidth(chr); + fontStyle.DrawGlyph(chr, font.Height, dx, y, z, color); + dx += fontStyle.GetWidth(chr, font.Height); } } - public static void DrawTextReflection(string text, float h, float x, float y, float z, SColorF color, float rspace, float rheight) + public static void DrawTextReflection(string text, CFont font, float x, float y, float z, SColorF color, float rspace, float rheight) { - if (h <= 0f) + if (font.Height <= 0f || text == "") return; - if (text == "") - return; - - Height = h; - CFont font = _GetCurrentFont(); + CFontStyle fontStyle = _GetFontStyle(font); float dx = x; foreach (char chr in text) { - font.DrawGlyphReflection(chr, dx, y, z, color, rspace, rheight); - dx += font.GetWidth(chr); + fontStyle.DrawGlyphReflection(chr, font.Height, dx, y, z, color, rspace, rheight); + dx += fontStyle.GetWidth(chr, font.Height); } } - public static void DrawText(string text, float h, float x, float y, float z, SColorF color, float begin, float end) + public static void DrawText(string text, CFont font, float x, float y, float z, SColorF color, float begin, float end) { - if (h <= 0f) + if (font.Height <= 0f || text == "") return; - if (text == "") - return; - - Height = h; - - float dx = x; - float w = GetTextWidth(text); + float w = GetTextWidth(text, font); if (w <= 0f) return; - float x1 = x + w * begin; - float x2 = x + w * end; + float xStart = x + w * begin; + float xEnd = x + w * end; + float xCur = x; - CFont font = _GetCurrentFont(); + CFontStyle fontStyle = _GetFontStyle(font); foreach (char chr in text) { - float w2 = font.GetWidth(chr); - float b = (x1 - dx) / w2; + float w2 = fontStyle.GetWidth(chr, font.Height); + float b = (xStart - xCur) / w2; if (b < 1f) { if (b < 0f) b = 0f; - float e = (x2 - dx) / w2; + float e = (xEnd - xCur) / w2; if (e > 0f) { if (e > 1f) e = 1f; - font.DrawGlyph(chr, dx, y, z, color, b, e); + fontStyle.DrawGlyph(chr, font.Height, xCur, y, z, color, b, e); } } - dx += w2; + xCur += w2; } } #endregion DrawText - public static FontStyle GetFontStyle() - { - switch (Style) - { - case EStyle.Normal: - return FontStyle.Regular; - case EStyle.Italic: - return FontStyle.Italic; - case EStyle.Bold: - return FontStyle.Bold; - case EStyle.BoldItalic: - return FontStyle.Bold | FontStyle.Italic; - default: - return FontStyle.Regular; - } - } - - public static void SetFont(string fontName) - { - int index = _GetPartyFontIndex(PartyModeID, fontName); - if (index < 0) - index = _GetThemeFontIndex(CConfig.Theme, fontName); - if (index < 0) - index = _GetFontIndex(fontName); - if (index >= 0) - _CurrentFont = index; - } - /// /// Calculates the bounds for a CText object /// @@ -232,268 +148,209 @@ namespace Vocaluxe.Base.Fonts /// RectangleF object containing the bounds public static RectangleF GetTextBounds(CText text) { - return GetTextBounds(text, text.Height); + return new RectangleF(text.X, text.Y, GetTextWidth(text.TranslatedText, text.CalculatedFont), GetTextHeight(text.TranslatedText, text.CalculatedFont)); } - /// - /// Calculates the bounds for a CText object - /// - /// The CText object of which the bounds should be calculated for - /// The height of the CText object - /// RectangleF object containing the bounds - public static RectangleF GetTextBounds(CText text, float height) + public static Font GetSystemFont(CFont font) { - float oldHeight = Height; - int oldFont = _CurrentFont; - EStyle oldStyle = Style; - Height = height; - SetFont(text.Font); - Style = text.Style; - var result = new RectangleF(text.X, text.Y, GetTextWidth(CLanguage.Translate(text.Text, text.TranslationID)), - GetTextHeight(CLanguage.Translate(text.Text, text.TranslationID))); - //restore old values - Height = oldHeight; - _CurrentFont = oldFont; - Style = oldStyle; - return result; + return _GetFontStyle(font).GetSystemFont(font.Height); } - public static float GetTextWidth(string text) + public static float GetOutlineSize(CFont font) { - CFont font = _GetCurrentFont(); - return text.Sum(chr => font.GetWidth(chr)); + return _FontFamilies[_GetFontIndex(font.Name)].Outline; } - public static float GetTextHeight(string text) + public static SColorF GetOutlineColor(CFont font) { - //return TextRenderer.MeasureText(text, GetFont()).Height; - CFont font = _GetCurrentFont(); - return text == "" ? 0 : text.Select(font.GetHeight).Max(); + return _FontFamilies[_GetFontIndex(font.Name)].OutlineColor; } - private static void _LoadFontFiles(CXMLReader xmlReader, string fontFolder, string themeName = "", int partyModeId = -1) + private static CFontStyle _GetFontStyle(CFont font) { - string value = string.Empty; - int i = 1; - while (xmlReader.GetValue("//root/Fonts/Font" + i + "/Folder", out value, value)) + int index = _GetFontIndex(font.Name); + + switch (font.Style) { - var sf = new SFont {Folder = value, IsThemeFont = themeName != "", ThemeName = themeName, PartyModeID = partyModeId}; - - bool ok = true; - - string name; - ok &= xmlReader.GetValue("//root/Fonts/Font" + i + "/Name", out name, value); - sf.Name = name; - - ok &= xmlReader.GetValue("//root/Fonts/Font" + i + "/FileNormal", out value, value); - sf.FileNormal = value; - value = Path.Combine(fontFolder, Path.Combine(sf.Folder, value)); - var f = new CFont(value); - sf.Normal = f; - - ok &= xmlReader.GetValue("//root/Fonts/Font" + i + "/FileItalic", out value, value); - sf.FileItalic = value; - value = Path.Combine(fontFolder, Path.Combine(sf.Folder, value)); - f = new CFont(value); - sf.Italic = f; - - ok &= xmlReader.GetValue("//root/Fonts/Font" + i + "/FileBold", out value, value); - sf.FileBold = value; - value = Path.Combine(fontFolder, Path.Combine(sf.Folder, value)); - f = new CFont(value); - sf.Bold = f; - - ok &= xmlReader.GetValue("//root/Fonts/Font" + i + "/FileBoldItalic", out value, value); - sf.FileBoldItalic = value; - value = Path.Combine(fontFolder, Path.Combine(sf.Folder, value)); - f = new CFont(value); - sf.BoldItalic = f; - - sf.Outline = 0f; - ok &= xmlReader.TryGetFloatValue("//root/Fonts/Font" + i + "/Outline", ref sf.Outline); - - sf.OutlineColor = new SColorF(0f, 0f, 0f, 1f); - ok &= xmlReader.TryGetFloatValue("//root/Fonts/Font" + i + "/OutlineColorR", ref sf.OutlineColor.R); - ok &= xmlReader.TryGetFloatValue("//root/Fonts/Font" + i + "/OutlineColorG", ref sf.OutlineColor.G); - ok &= xmlReader.TryGetFloatValue("//root/Fonts/Font" + i + "/OutlineColorB", ref sf.OutlineColor.B); - ok &= xmlReader.TryGetFloatValue("//root/Fonts/Font" + i + "/OutlineColorA", ref sf.OutlineColor.A); - - if (ok) - _Fonts.Add(sf); - else - { - string fontTypes; - if (partyModeId >= 0) - fontTypes = "theme fonts for party mode"; - else if (themeName != "") - fontTypes = "theme fonts for theme \"" + themeName + "\""; - else - fontTypes = "basic fonts"; - CLog.LogError("Error loading " + fontTypes + ": Error in Font" + i); - } - i++; + case EStyle.Normal: + return _FontFamilies[index].Normal; + case EStyle.Italic: + return _FontFamilies[index].Italic; + case EStyle.Bold: + return _FontFamilies[index].Bold; + case EStyle.BoldItalic: + return _FontFamilies[index].BoldItalic; } + throw new ArgumentException("Invalid Style: " + font.Style); + } + + public static float GetTextWidth(string text, CFont font) + { + CFontStyle fontStyle = _GetFontStyle(font); + return text.Sum(chr => fontStyle.GetWidth(chr, font.Height)); + } + + public static float GetTextHeight(string text, CFont font) + { + CFontStyle fontStyle = _GetFontStyle(font); + return text == "" ? 0 : text.Select(chr => fontStyle.GetHeight(chr, font.Height)).Max(); + } + + private static int _GetFontIndex(string fontName) + { + if (fontName != "") + { + int index = _GetPartyFontIndex(fontName, PartyModeID); + if (index < 0) + index = _GetThemeFontIndex(fontName, CConfig.Config.Theme.Theme); + if (index >= 0) + return index; + for (int i = 0; i < _FontFamilies.Count; i++) + { + if (_FontFamilies[i].Name == fontName) + return i; + } + if (!_LoggedMissingFonts.Contains(fontName)) + { + _LoggedMissingFonts.Add(fontName); + CLog.LogError("Font \"" + fontName + "\" not found!"); + } + } + else + CLog.LogError("Empty fontName requested", false, false, new Exception()); + + if (_FontFamilies.Count == 0) + CLog.LogError("No fonts found!", true, true); + + return 0; + } + + private static int _GetThemeFontIndex(string fontName, string themeName) + { + Debug.Assert(fontName != "" && themeName != ""); + + for (int i = 0; i < _FontFamilies.Count; i++) + { + if (_FontFamilies[i].Name == fontName && _FontFamilies[i].ThemeName == themeName) + return i; + } + + return -1; + } + + private static int _GetPartyFontIndex(string fontName, int partyModeID) + { + Debug.Assert(fontName != ""); + + for (int i = 0; i < _FontFamilies.Count; i++) + { + if (_FontFamilies[i].PartyModeID == partyModeID && _FontFamilies[i].Name == fontName) + return i; + } + + return -1; } /// /// Load default fonts /// /// - private static void _LoadFontList() + private static bool _LoadDefaultFonts() { - CXMLReader xmlReader = CXMLReader.OpenFile(Path.Combine(CSettings.ProgramFolder, CSettings.FolderNameFonts, CSettings.FileNameFonts)); - if (xmlReader == null) - return; - - _LoadFontFiles(xmlReader, Path.Combine(CSettings.ProgramFolder, CSettings.FolderNameFonts)); - } - - /// - /// Loads theme fonts from skin file - /// - public static void LoadThemeFonts(string themeName, string fontFolder, CXMLReader xmlReader) - { - _LoadFontFiles(xmlReader, fontFolder, themeName); - CLog.StartBenchmark("BuildGlyphs"); - _BuildGlyphs(); - CLog.StopBenchmark("BuildGlyphs"); - } - - /// - /// Loads party mode fonts from skin file - /// - public static void LoadPartyModeFonts(int partyModeID, string fontFolder, CXMLReader xmlReader) - { - _LoadFontFiles(xmlReader, fontFolder, "", partyModeID); - CLog.StartBenchmark("BuildGlyphs"); - _BuildGlyphs(); - CLog.StopBenchmark("BuildGlyphs"); - } - - public static void SaveThemeFonts(string themeName, XmlWriter writer) - { - if (_Fonts.Count == 0) - return; - - int index = 0; - int fontNr = 1; - bool setStart = false; - while (index < _Fonts.Count) + SDefaultFonts defaultFonts; + try { - if (_Fonts[index].IsThemeFont && _Fonts[index].ThemeName == themeName) - { - if (!setStart) - { - writer.WriteStartElement("Fonts"); - setStart = true; - } - - writer.WriteStartElement("Font" + fontNr); - - writer.WriteElementString("Name", _Fonts[index].Name); - writer.WriteElementString("Folder", _Fonts[index].Folder); - - writer.WriteElementString("Outline", _Fonts[index].Outline.ToString("#0.00")); - writer.WriteElementString("OutlineColorR", _Fonts[index].OutlineColor.R.ToString("#0.00")); - writer.WriteElementString("OutlineColorG", _Fonts[index].OutlineColor.G.ToString("#0.00")); - writer.WriteElementString("OutlineColorB", _Fonts[index].OutlineColor.B.ToString("#0.00")); - writer.WriteElementString("OutlineColorA", _Fonts[index].OutlineColor.A.ToString("#0.00")); - - writer.WriteElementString("FileNormal", _Fonts[index].FileNormal); - writer.WriteElementString("FileBold", _Fonts[index].FileBold); - writer.WriteElementString("FileItalic", _Fonts[index].FileItalic); - writer.WriteElementString("FileBoldItalic", _Fonts[index].FileBoldItalic); - - writer.WriteEndElement(); - - fontNr++; - } - index++; + var xml = new CXmlDeserializer(); + defaultFonts = xml.Deserialize(Path.Combine(CSettings.ProgramFolder, CSettings.FolderNameFonts, CSettings.FileNameFonts)); + } + catch (Exception e) + { + CLog.LogError("Error loading default Fonts", false, false, e); + return false; } - if (setStart) - writer.WriteEndElement(); + return LoadThemeFonts(defaultFonts.Fonts, Path.Combine(CSettings.ProgramFolder, CSettings.FolderNameFonts), "", -1); + } + + /// + /// Loads theme fonts + /// + public static bool LoadThemeFonts(IEnumerable fontFamilies, string fontFolder, string themeName, int partyModeId) + { + if (fontFamilies == null) + return true; + foreach (SFontFamily fontFamily in fontFamilies) + { + if (!_LoadFont(fontFamily, fontFolder, themeName, partyModeId)) + { + CLog.LogError("Error loading fonts for Theme " + themeName + "(" + partyModeId + ")"); + return false; + } + } + CLog.StartBenchmark("BuildGlyphs"); + _BuildGlyphs(); + CLog.StopBenchmark("BuildGlyphs"); + return true; + } + + private static bool _LoadFont(SFontFamily fontFamily, string fontFolder, string themeName, int partyModeId) + { + fontFamily.ThemeName = themeName; + fontFamily.PartyModeID = partyModeId; + fontFamily.Normal = new CFontStyle(Path.Combine(fontFolder, fontFamily.Folder, fontFamily.FileNormal), EStyle.Normal, fontFamily.Outline, fontFamily.OutlineColor); + fontFamily.Italic = new CFontStyle(Path.Combine(fontFolder, fontFamily.Folder, fontFamily.FileItalic), EStyle.Italic, fontFamily.Outline, fontFamily.OutlineColor); + fontFamily.Bold = new CFontStyle(Path.Combine(fontFolder, fontFamily.Folder, fontFamily.FileBold), EStyle.Bold, fontFamily.Outline, fontFamily.OutlineColor); + fontFamily.BoldItalic = new CFontStyle(Path.Combine(fontFolder, fontFamily.Folder, fontFamily.FileBoldItalic), EStyle.BoldItalic, fontFamily.Outline, + fontFamily.OutlineColor); + _FontFamilies.Add(fontFamily); + return true; } public static void UnloadThemeFonts(string themeName) { int index = 0; - while (index < _Fonts.Count) + while (index < _FontFamilies.Count) { - if (_Fonts[index].IsThemeFont && _Fonts[index].ThemeName == themeName) + if (_FontFamilies[index].ThemeName == themeName) { - _Fonts[index].Normal.UnloadGlyphs(); - _Fonts[index].Italic.UnloadGlyphs(); - _Fonts[index].Bold.UnloadGlyphs(); - _Fonts[index].BoldItalic.UnloadGlyphs(); - _Fonts.RemoveAt(index); + _FontFamilies[index].Dispose(); + _FontFamilies.RemoveAt(index); } else index++; } } - private static int _GetFontIndex(string fontName) + public static void UnloadPartyModeFonts(int partyModeID) { - for (int i = 0; i < _Fonts.Count; i++) + Debug.Assert(partyModeID >= 0); + int index = 0; + while (index < _FontFamilies.Count) { - if (!_Fonts[i].IsThemeFont && _Fonts[i].Name == fontName) - return i; + if (_FontFamilies[index].PartyModeID == partyModeID) + { + _FontFamilies[index].Dispose(); + _FontFamilies.RemoveAt(index); + } + else + index++; } - - return -1; - } - - private static int _GetThemeFontIndex(string themeName, string fontName) - { - if (themeName == "" || fontName == "") - return -1; - - for (int i = 0; i < _Fonts.Count; i++) - { - if (_Fonts[i].IsThemeFont && _Fonts[i].Name == fontName && _Fonts[i].ThemeName == themeName) - return i; - } - - return -1; - } - - private static int _GetPartyFontIndex(int partyModeID, string fontName) - { - if (partyModeID == -1 || fontName == "") - return -1; - - for (int i = 0; i < _Fonts.Count; i++) - { - if (!_Fonts[i].IsThemeFont && _Fonts[i].PartyModeID == partyModeID && _Fonts[i].Name == fontName) - return i; - } - - return -1; } private static void _BuildGlyphs() { const string text = " abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890"; - for (int i = 0; i < _Fonts.Count; i++) + foreach (SFontFamily fontFamily in _FontFamilies) { - _CurrentFont = i; - foreach (char chr in text) { - Style = EStyle.Normal; - _Fonts[_CurrentFont].Normal.GetOrAddGlyph(chr); - Style = EStyle.Bold; - _Fonts[_CurrentFont].Bold.GetOrAddGlyph(chr); - Style = EStyle.Italic; - _Fonts[_CurrentFont].Italic.GetOrAddGlyph(chr); - Style = EStyle.BoldItalic; - _Fonts[_CurrentFont].BoldItalic.GetOrAddGlyph(chr); + fontFamily.Normal.GetOrAddGlyph(chr, -1); + fontFamily.Bold.GetOrAddGlyph(chr, -1); + fontFamily.Italic.GetOrAddGlyph(chr, -1); + fontFamily.BoldItalic.GetOrAddGlyph(chr, -1); } } - Style = EStyle.Normal; - SetFont("Normal"); } } } \ No newline at end of file diff --git a/Vocaluxe/Base/Fonts/CGlyph.cs b/Vocaluxe/Base/Fonts/CGlyph.cs index c694c84d..6b949903 100644 --- a/Vocaluxe/Base/Fonts/CGlyph.cs +++ b/Vocaluxe/Base/Fonts/CGlyph.cs @@ -31,31 +31,18 @@ namespace Vocaluxe.Base.Fonts { class CGlyph { - private CTexture _Texture; + private CTextureRef _Texture; private readonly SizeF _BoundingBox; private readonly RectangleF _DrawBounding; public readonly float MaxHeight; - public float Width - { - get { return _BoundingBox.Width * _GetFactor(); } - } - - public float Height - { - get { return _BoundingBox.Height * _GetFactor(); } - } - - public CGlyph(char chr, float maxHeight) + public CGlyph(char chr, CFontStyle fontStyle, float maxHeight) { MaxHeight = maxHeight; - float oldHeight = CFonts.Height; - float outline = CFonts.Outline; - float outlineSize = outline * maxHeight; + float outlineSize = fontStyle.Outline * maxHeight; string chrString = chr.ToString(); - CFonts.Height = maxHeight; - Font fo = CFonts.GetFont(); + Font fo = fontStyle.GetSystemFont(maxHeight); SizeF fullSize; Size bmpSize; using (Graphics g = Graphics.FromHwnd(IntPtr.Zero)) @@ -64,7 +51,7 @@ namespace Vocaluxe.Base.Fonts if (chr != ' ') { //Gets exact height and width for drawing more than 1 char. But width is to small to draw char on bitmap as e.g. italic chars will get cropped - _BoundingBox = g.MeasureString(chrString, fo, -1, new StringFormat(StringFormat.GenericTypographic)); + _BoundingBox = g.MeasureString(chrString, fo, -1, StringFormat.GenericTypographic); // ReSharper disable CompareOfFloatsByEqualityOperator if (_BoundingBox.Height == 0) // ReSharper restore CompareOfFloatsByEqualityOperator @@ -105,7 +92,7 @@ namespace Vocaluxe.Base.Fonts float emSize = fo.Size * fo.FontFamily.GetCellAscent(fo.Style) / fo.FontFamily.GetEmHeight(fo.Style); path.AddString(chrString, fo.FontFamily, (int)fo.Style, emSize, point, new StringFormat()); - using (var pen = new Pen(CFonts.OutlineColor.AsColor(), outlineSize)) + using (var pen = new Pen(fontStyle.OutlineColor.AsColor(), outlineSize)) { pen.LineJoin = LineJoin.Round; g.DrawPath(pen, path); @@ -134,7 +121,6 @@ namespace Vocaluxe.Base.Fonts } } } - CFonts.Height = oldHeight; } public void UnloadTexture() @@ -142,15 +128,25 @@ namespace Vocaluxe.Base.Fonts CDraw.RemoveTexture(ref _Texture); } - private float _GetFactor() + private float _GetFactor(float fontHeight) { - return CFonts.Height / _BoundingBox.Height; + return fontHeight / _BoundingBox.Height; } - public void GetTextureAndRect(float x, float y, float z, out CTexture texture, out SRectF rect) + public float GetWidth(float fontHeight) + { + return _BoundingBox.Width * _GetFactor(fontHeight); + } + + public float GetHeight(float fontHeight) + { + return _BoundingBox.Height * _GetFactor(fontHeight); + } + + public void GetTextureAndRect(float fontHeight, float x, float y, float z, out CTextureRef texture, out SRectF rect) { texture = _Texture; - float factor = _GetFactor(); + float factor = _GetFactor(fontHeight); x += _DrawBounding.X * factor; y += _DrawBounding.Y * factor; float h = _DrawBounding.Height * factor; @@ -161,7 +157,7 @@ namespace Vocaluxe.Base.Fonts private static Rectangle _GetRealBounds(Bitmap bmp) { int minX = 0, maxX = bmp.Width - 1, minY = 0; - BitmapData bmpData = bmp.LockBits(new Rectangle(0, 0, bmp.Width, bmp.Height), ImageLockMode.ReadOnly, PixelFormat.Format32bppArgb); + BitmapData bmpData = bmp.LockBits(bmp.GetRect(), ImageLockMode.ReadOnly, PixelFormat.Format32bppArgb); int values = bmpData.Width * bmp.Height; var rgbValues = new Int32[values]; Marshal.Copy(bmpData.Scan0, rgbValues, 0, values); diff --git a/Vocaluxe/Base/Server/CVocaluxeServer.cs b/Vocaluxe/Base/Server/CVocaluxeServer.cs index e0afa162..878bbc37 100644 --- a/Vocaluxe/Base/Server/CVocaluxeServer.cs +++ b/Vocaluxe/Base/Server/CVocaluxeServer.cs @@ -61,9 +61,10 @@ namespace Vocaluxe.Base.Server public static void Init() { - _Server = new CServer(CConfig.ServerPort, CConfig.ServerEncryption == EOffOn.TR_CONFIG_ON); + _Server = new CServer(CConfig.Config.Server.ServerPort, CConfig.Config.Server.ServerEncryption == EOffOn.TR_CONFIG_ON); CServer.SendKeyEvent = _SendKeyEvent; + CServer.SendKeyStringEvent = _sendKeyStringEvent; CServer.GetProfileData = _GetProfileData; CServer.SendProfileData = _SendProfileData; CServer.GetProfileList = _GetProfileList; @@ -87,12 +88,14 @@ namespace Vocaluxe.Base.Server CServer.RemovePlaylist = _RemovePlaylist; CServer.AddPlaylist = _AddPlaylist; + Start(); + //_Discover = new CDiscover(CConfig.ServerPort, CCommands.BroadcastKeyword); } public static void Start() { - if (CConfig.ServerActive == EOffOn.TR_CONFIG_ON) + if (CConfig.Config.Server.ServerActive == EOffOn.TR_CONFIG_ON) { _Server.Start(); //_Discover.StartBroadcasting(); @@ -125,9 +128,11 @@ namespace Vocaluxe.Base.Server private static bool _SendKeyEvent(string key) { bool result = false; - if (!string.IsNullOrEmpty(key)) + string lowerKey = key.ToLower(); + + if (!string.IsNullOrEmpty(lowerKey)) { - switch (key.ToLower()) + switch (lowerKey) { case "up": Controller.AddKeyEvent(new SKeyEvent(ESender.Keyboard, false, false, false, false, Char.MinValue, Keys.Up)); @@ -157,25 +162,22 @@ namespace Vocaluxe.Base.Server Controller.AddKeyEvent(new SKeyEvent(ESender.Keyboard, false, false, false, false, Char.MinValue, Keys.Tab)); result = true; break; + case "backspace": + Controller.AddKeyEvent(new SKeyEvent(ESender.Keyboard, false, false, false, false, Char.MinValue, Keys.Back)); + result = true; + break; default: - foreach (char c in key) + if (lowerKey.StartsWith("f")) { - bool shift = true; - char keyChar; - if (char.ToUpper(c) != c) - { - keyChar = char.ToUpper(c); - shift = false; - } - else - keyChar = c; + string numberString = lowerKey.Substring(1); + int number; + Keys fKey; - if ((keyChar >= '0' && keyChar <= '9') || (keyChar >= 'A' && keyChar <= 'Z')) + if (Int32.TryParse(numberString, out number) && number >= 1 + && number <= 12 + && Enum.TryParse("F" + number, true, out fKey)) { - Keys keys = (Keys)keyChar; - if (shift) - keys |= Keys.Shift; - Controller.AddKeyEvent(new SKeyEvent(ESender.Keyboard, false, false, false, false, Char.MinValue, keys)); + Controller.AddKeyEvent(new SKeyEvent(ESender.Keyboard, false, false, false, false, Char.MinValue, fKey)); result = true; } } @@ -186,6 +188,43 @@ namespace Vocaluxe.Base.Server return result; } + private static bool _sendKeyStringEvent(string keyString, bool isShiftPressed, bool isAltPressed, bool isCtrlPressed) + { + bool result = false; + + foreach (char key in keyString) + { + Controller.AddKeyEvent(new SKeyEvent(ESender.Keyboard, isAltPressed, + Char.IsUpper(key) || isShiftPressed, + isCtrlPressed, true, + isShiftPressed ? Char.ToUpper(key) : key, + _ParseKeys(key))); + result = true; + } + + return result; + } + + private static Keys _ParseKeys(char keyText) + { + Keys key; + + if (!Enum.TryParse(keyText.ToString(), true, out key)) + { + switch (keyText) + { + case ' ': + key = Keys.Space; + break; + default: + key = Keys.None; + break; + } + } + + return key; + } + #region profile private static SProfileData _GetProfileData(int profileId, bool isReadonly) { @@ -205,7 +244,7 @@ namespace Vocaluxe.Base.Server newProfile = new CProfile { ID = existingProfile.ID, - FileName = existingProfile.FileName, + FilePath = existingProfile.FilePath, Active = existingProfile.Active, Avatar = existingProfile.Avatar, Difficulty = existingProfile.Difficulty, @@ -453,13 +492,13 @@ namespace Vocaluxe.Base.Server #endregion #region playlist - private static SPlaylistInfo[] _GetPlaylists() + private static SPlaylistData[] _GetPlaylists() { return (from p in CPlaylists.Playlists select _GetPlaylistInfo(p)).ToArray(); } - private static SPlaylistInfo _GetPlaylist(int playlistId) + private static SPlaylistData _GetPlaylist(int playlistId) { if (CPlaylists.Get(playlistId) == null) throw new ArgumentException("invalid playlistId"); @@ -548,9 +587,9 @@ namespace Vocaluxe.Base.Server return result; } - private static SPlaylistInfo _GetPlaylistInfo(CPlaylistFile playlist) + private static SPlaylistData _GetPlaylistInfo(CPlaylistFile playlist) { - return new SPlaylistInfo + return new SPlaylistData { PlaylistId = playlist.Id, PlaylistName = playlist.Name, @@ -658,10 +697,14 @@ namespace Vocaluxe.Base.Server IEnumerable playerIds = (from p in CProfiles.GetProfiles() where String.Equals(p.PlayerName, username, StringComparison.OrdinalIgnoreCase) select p.ID); - if (!playerIds.Any()) + try + { + return playerIds.First(); + } + catch (InvalidOperationException) + { throw new ArgumentException("Invalid playername"); - - return playerIds.First(); + } } private static byte[] _Hash(byte[] password, byte[] salt) diff --git a/Vocaluxe/Base/ThemeSystem/CBaseSkin.cs b/Vocaluxe/Base/ThemeSystem/CBaseSkin.cs new file mode 100644 index 00000000..91d36113 --- /dev/null +++ b/Vocaluxe/Base/ThemeSystem/CBaseSkin.cs @@ -0,0 +1,59 @@ +#region license +// This file is part of Vocaluxe. +// +// Vocaluxe is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Vocaluxe is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with Vocaluxe. If not, see . +#endregion + +using System; +using System.Collections.Generic; + +namespace Vocaluxe.Base.ThemeSystem +{ + class CBaseSkin : CSkin + { + public CBaseSkin(string folder, string file, CTheme parent) : base(folder, file, parent) {} + + public override bool Load() + { + if (!base.Load()) + return false; + + if (!_CheckRequiredElements()) + { + _IsLoaded = false; + return false; + } + + return true; + } + + private bool _CheckRequiredElements() + { + List missingTextures = _Required.Textures.FindAll(name => !_Textures.ContainsKey(name)); + List missingVideos = _Required.Videos.FindAll(name => !_Videos.ContainsKey(name)); + List missingColors = _Required.Colors.FindAll(name => !_Data.Colors.ContainsKey(name)); + if (missingTextures.Count + missingVideos.Count + missingColors.Count == 0) + return true; + string msg = "The skin \"" + this + "\" is missing the following elements: "; + if (missingTextures.Count > 0) + msg += Environment.NewLine + "Textures: " + String.Join(", ", missingTextures); + if (missingVideos.Count > 0) + msg += Environment.NewLine + "Videos: " + String.Join(", ", missingVideos); + if (missingColors.Count > 0) + msg += Environment.NewLine + "Colors: " + String.Join(", ", missingColors); + CLog.LogError(msg); + return false; + } + } +} \ No newline at end of file diff --git a/Vocaluxe/Base/ThemeSystem/CBaseTheme.cs b/Vocaluxe/Base/ThemeSystem/CBaseTheme.cs new file mode 100644 index 00000000..cc4c5f3c --- /dev/null +++ b/Vocaluxe/Base/ThemeSystem/CBaseTheme.cs @@ -0,0 +1,77 @@ +#region license +// This file is part of Vocaluxe. +// +// Vocaluxe is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Vocaluxe is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with Vocaluxe. If not, see . +#endregion + +using System.Diagnostics; +using System.IO; +using System.Linq; +using Vocaluxe.Base.Fonts; + +namespace Vocaluxe.Base.ThemeSystem +{ + class CBaseTheme : CTheme + { + public SThemeCursor CursorTheme + { + get + { + Debug.Assert(_Data.Cursor != null, "Check in _Load!"); + return _Data.Cursor.Value; + } + } + + public CBaseTheme(string filePath) : base(filePath, -1) {} + + protected override CSkin _GetNewSkin(string path, string file) + { + return new CBaseSkin(path, file, this); + } + + public override void Unload() + { + base.Unload(); + CFonts.UnloadThemeFonts(Name); + } + + protected override bool _Load() + { + if (!_Data.Cursor.HasValue) + return false; + + return CFonts.LoadThemeFonts(_Data.Fonts, Path.Combine(_Folder, Name, CSettings.FolderNameThemeFonts), Name, -1); + } + + protected override bool _LoadSkin() + { + CSkin skin; + if (!_Skins.TryGetValue(CConfig.Config.Theme.Skin, out skin)) + skin = _Skins.Values.FirstOrDefault(); + while (skin != null) + { + if (skin.Load()) + break; + skin.Unload(); + CLog.LogError("Failed to load skin " + skin + "! Removing...", true); + _Skins.Remove(skin.Name); + skin = _Skins.Values.FirstOrDefault(); + } + if (skin == null) + return false; + CurrentSkin = skin; + return true; + } + } +} \ No newline at end of file diff --git a/Vocaluxe/Base/ThemeSystem/CPartySkin.cs b/Vocaluxe/Base/ThemeSystem/CPartySkin.cs new file mode 100644 index 00000000..16484bfc --- /dev/null +++ b/Vocaluxe/Base/ThemeSystem/CPartySkin.cs @@ -0,0 +1,65 @@ +#region license +// This file is part of Vocaluxe. +// +// Vocaluxe is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Vocaluxe is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with Vocaluxe. If not, see . +#endregion + +using VocaluxeLib; +using VocaluxeLib.Draw; + +namespace Vocaluxe.Base.ThemeSystem +{ + class CPartySkin : CSkin + { + private CSkin _BaseSkin; + + public CPartySkin(string folder, string file, CTheme parent) : base(folder, file, parent) {} + + public override bool Load() + { + _BaseSkin = CThemes.CurrentThemes[-1].CurrentSkin; + if (!base.Load()) + return false; + for (int i = 1; i <= CSettings.MaxNumPlayer; i++) + { + if (!_Data.Colors.ContainsKey("Player" + i)) + continue; + CLog.LogDebug("Party themes cannot contain player colors. They will be ignored!"); + break; + } + return true; + } + + public override bool GetColor(string name, out SColorF color) + { + if (_Parent.Name == "Default" && !_Required.Colors.Contains(name)) + CLog.LogDebug("Non-Default color: " + name); + return base.GetColor(name, out color) || _BaseSkin.GetColor(name, out color); + } + + public override CVideoStream GetVideo(string name, bool loop) + { + if (_Parent.Name == "Default" && !_Required.Videos.Contains(name)) + CLog.LogDebug("Non-Default color: " + name); + return base.GetVideo(name, loop) ?? _BaseSkin.GetVideo(name, loop); + } + + public override CTextureRef GetTexture(string name) + { + if (_Parent.Name == "Default" && !_Required.Textures.Contains(name)) + CLog.LogDebug("Non-Default color: " + name); + return base.GetTexture(name) ?? _BaseSkin.GetTexture(name); + } + } +} \ No newline at end of file diff --git a/Vocaluxe/Base/ThemeSystem/CPartyTheme.cs b/Vocaluxe/Base/ThemeSystem/CPartyTheme.cs new file mode 100644 index 00000000..f91a09d0 --- /dev/null +++ b/Vocaluxe/Base/ThemeSystem/CPartyTheme.cs @@ -0,0 +1,85 @@ +#region license +// This file is part of Vocaluxe. +// +// Vocaluxe is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Vocaluxe is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with Vocaluxe. If not, see . +#endregion + +using System; +using System.IO; +using System.Linq; +using Vocaluxe.Base.Fonts; + +namespace Vocaluxe.Base.ThemeSystem +{ + class CPartyTheme : CTheme + { + public CPartyTheme(string filePath, int partyModeID) : base(filePath, partyModeID) {} + + public override void Unload() + { + base.Unload(); + CFonts.UnloadPartyModeFonts(PartyModeID); + } + + protected override CSkin _GetNewSkin(string path, string file) + { + return new CPartySkin(path, file, this); + } + + protected override bool _Load() + { + return CFonts.LoadThemeFonts(_Data.Fonts, Path.Combine(_Folder, "..", CSettings.FolderNamePartyModeFonts), Name, PartyModeID); + } + + private CSkin _GetSkinToLoad(int fallbackNum) + { + CSkin skin; + switch (fallbackNum) + { + case 0: + _Skins.TryGetValue(CConfig.Config.Theme.Skin, out skin); + break; + case 1: + _Skins.TryGetValue(CSettings.DefaultName, out skin); + break; + case 2: + skin = _Skins.Values.FirstOrDefault(); + break; + default: + throw new ArgumentException(); + } + return skin; + } + + protected override bool _LoadSkin() + { + CSkin skin = null; + for (int i = 0; i < 3; i++) + { + skin = _GetSkinToLoad(i); + if (skin == null) + continue; + if (skin.Load()) + break; + skin.Unload(); + CLog.LogError("Failed to load skin " + skin + "! Removing...", true); + _Skins.Remove(skin.Name); + } + if (skin == null) + return false; + CurrentSkin = skin; + return true; + } + } +} \ No newline at end of file diff --git a/Vocaluxe/Base/ThemeSystem/CSkin.cs b/Vocaluxe/Base/ThemeSystem/CSkin.cs new file mode 100644 index 00000000..5474177e --- /dev/null +++ b/Vocaluxe/Base/ThemeSystem/CSkin.cs @@ -0,0 +1,232 @@ +#region license +// This file is part of Vocaluxe. +// +// Vocaluxe is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Vocaluxe is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with Vocaluxe. If not, see . +#endregion + +using System; +using System.Collections.Generic; +using System.Diagnostics; +using System.IO; +using System.Xml.Serialization; +using VocaluxeLib; +using VocaluxeLib.Draw; +using VocaluxeLib.Xml; +using System.Linq; + +namespace Vocaluxe.Base.ThemeSystem +{ + class CVideoSkinElement + { + public string FileName; + public CVideoStream VideoStream; + } + + abstract class CSkin + { + private const int _SkinSystemVersion = 4; + + protected struct SRequiredElements + { + [XmlIgnore] public List Textures, Videos, Colors; + [XmlElement("Textures")] + public string TexturesStr + { + get { return string.Join("\r\n", Textures); } + set + { + string[] entries = value.Split(new string[] {"\r\n", "\n"}, StringSplitOptions.RemoveEmptyEntries); + Textures = entries.Select(s => s.Trim()).Where(s => !string.IsNullOrEmpty(s)).ToList(); + } + } + [XmlElement("Videos")] + public string VideosStr + { + get { return string.Join("\r\n", Videos); } + set + { + string[] entries = value.Split(new string[] {"\r\n", "\n"}, StringSplitOptions.RemoveEmptyEntries); + Videos = entries.Select(s => s.Trim()).Where(s => !string.IsNullOrEmpty(s)).ToList(); + } + } + [XmlElement("Colors")] + public string ColorsStr + { + get { return string.Join("\r\n", Colors); } + set + { + string[] entries = value.Split(new string[] {"\r\n", "\n"}, StringSplitOptions.RemoveEmptyEntries); + Colors = entries.Select(s => s.Trim()).Where(s => !string.IsNullOrEmpty(s)).ToList(); + } + } + } + + protected static SRequiredElements _Required; + + private readonly string _Folder; + private readonly string _FileName; + protected readonly CTheme _Parent; + + protected SSkin _Data; + public String Name + { + get { return _Data.Info.Name; } + } + + protected readonly Dictionary _Textures = new Dictionary(); + protected readonly Dictionary _Videos = new Dictionary(); + + protected bool _IsLoaded; + + public static bool InitRequiredElements() + { + string path = Path.Combine(CSettings.ProgramFolder, CSettings.FileNameRequiredSkinElements); + var xml = new CXmlDeserializer(); + try + { + _Required = xml.Deserialize(path); + } + catch (CXmlException e) + { + CLog.LogError("Error reading required elements: " + e); + return false; + } + for (int i = 1; i <= CSettings.MaxNumPlayer; i++) + { + string name = "Player" + i; + if (!_Required.Colors.Contains(name)) + _Required.Colors.Add(name); + } + return true; + } + + public static void Close() + { + if (_Required.Textures == null) + return; + _Required.Textures.Clear(); + _Required.Videos.Clear(); + _Required.Colors.Clear(); + } + + protected CSkin(string folder, string file, CTheme parent) + { + _Folder = folder; + _FileName = file; + _Parent = parent; + } + + public override string ToString() + { + return _Parent.Name + ":" + Name; + } + + public bool Init() + { + try + { + var xml = new CXmlDeserializer(); + _Data = xml.Deserialize(Path.Combine(_Folder, _FileName)); + if (_Data.SkinSystemVersion != _SkinSystemVersion) + { + string errorMsg = _Data.SkinSystemVersion < _SkinSystemVersion ? "the file ist outdated!" : "the file is for newer program versions!"; + errorMsg += " Current Version is " + _SkinSystemVersion; + throw new Exception(errorMsg); + } + } + catch (Exception e) + { + CLog.LogError("Can't load skin file \"" + Path.Combine(_Folder, _FileName) + "\". Invalid file!", false, false, e); + return false; + } + + return true; + } + + public virtual bool Load() + { + if (_IsLoaded) + return true; + Debug.Assert(_Textures.Count == 0 && _Videos.Count == 0); + + // load skins/textures + foreach (KeyValuePair kvp in _Data.Skins) + { + CTextureRef texture = CDraw.AddTexture(Path.Combine(_Folder, kvp.Value)); + if (texture == null) + { + CLog.LogError("Error on loading texture \"" + kvp.Key + "\": " + kvp.Value, true); + return false; + } + _Textures.Add(kvp.Key, texture); + } + + // load videos + foreach (KeyValuePair kvp in _Data.Videos) + { + CVideoSkinElement sk = new CVideoSkinElement {FileName = kvp.Value}; + if (!File.Exists(Path.Combine(_Folder, sk.FileName))) + { + CLog.LogError("Video \"" + kvp.Key + "\": (" + sk.FileName + ") not found!", true); + return false; + } + _Videos.Add(kvp.Key, sk); + } + + _IsLoaded = true; + return true; + } + + public void Unload() + { + foreach (CTextureRef tex in _Textures.Values) + tex.Dispose(); + + foreach (CVideoSkinElement vsk in _Videos.Values) + CVideo.Close(ref vsk.VideoStream); + + _Textures.Clear(); + _Videos.Clear(); + + _IsLoaded = false; + } + + public virtual bool GetColor(string colorName, out SColorF color) + { + return _Data.Colors.TryGetValue(colorName, out color); + } + + public virtual CVideoStream GetVideo(string videoName, bool loop) + { + CVideoSkinElement sk; + if (_Videos.TryGetValue(videoName, out sk)) + { + if (sk.VideoStream == null || sk.VideoStream.IsClosed()) + { + sk.VideoStream = CVideo.Load(Path.Combine(_Folder, sk.FileName)); + CVideo.SetLoop(sk.VideoStream, loop); + } + return sk.VideoStream; + } + return null; + } + + public virtual CTextureRef GetTexture(string name) + { + CTextureRef texture; + _Textures.TryGetValue(name, out texture); + return texture; + } + } +} \ No newline at end of file diff --git a/Vocaluxe/Base/ThemeSystem/CTheme.cs b/Vocaluxe/Base/ThemeSystem/CTheme.cs new file mode 100644 index 00000000..94c9433f --- /dev/null +++ b/Vocaluxe/Base/ThemeSystem/CTheme.cs @@ -0,0 +1,147 @@ +#region license +// This file is part of Vocaluxe. +// +// Vocaluxe is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Vocaluxe is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with Vocaluxe. If not, see . +#endregion + +using System; +using System.Collections.Generic; +using System.Diagnostics; +using System.IO; +using System.Linq; +using VocaluxeLib; +using VocaluxeLib.Xml; + +namespace Vocaluxe.Base.ThemeSystem +{ + abstract class CTheme + { + // Version number for theme files. Increment it, if you've changed something on the theme files! + private const int _ThemeSystemVersion = 5; + + protected STheme _Data; + public String Name + { + get { return _Data.Info.Name; } + } + + public string[] SkinNames + { + get { return _Skins.Keys.ToArray(); } + } + + public readonly int PartyModeID; + + protected readonly string _Folder; + private readonly string _FileName; + + public CSkin CurrentSkin { get; protected set; } + + protected readonly Dictionary _Skins = new Dictionary(); + + private bool _IsLoaded; + + protected CTheme(string filePath, int partyModeID) + { + _Folder = Path.GetDirectoryName(filePath); + _FileName = Path.GetFileName(filePath); + PartyModeID = partyModeID; + CurrentSkin = null; + } + + public override string ToString() + { + return Name; + } + + public bool Init() + { + try + { + var xml = new CXmlDeserializer(); + _Data = xml.Deserialize(Path.Combine(_Folder, _FileName)); + if (_Data.ThemeSystemVersion != _ThemeSystemVersion) + { + string errorMsg = _Data.ThemeSystemVersion < _ThemeSystemVersion ? "the file ist outdated!" : "the file is for newer program versions!"; + errorMsg += " Current Version is " + _ThemeSystemVersion; + throw new Exception(errorMsg); + } + } + catch (Exception e) + { + CLog.LogError("Can't load theme \"" + _FileName + "\". Invalid file!", false, false, e); + return false; + } + + string path = Path.Combine(_Folder, Name); + List files = CHelper.ListFiles(path, "*.xml"); + + // Load skins, succeed if at least 1 skin was loaded + bool ok = false; + foreach (string file in files) + { + CSkin skin = _GetNewSkin(path, file); + if (skin.Init()) + { + _Skins.Add(skin.Name, skin); + ok = true; + } + } + return ok; + } + + protected abstract CSkin _GetNewSkin(string path, string file); + protected abstract bool _Load(); + protected abstract bool _LoadSkin(); + + public bool Load() + { + if (_IsLoaded) + return true; + + if (!_LoadSkin()) + return false; + bool ok = _Load(); + + _IsLoaded = ok; + return ok; + } + + public virtual void Unload() + { + if (CurrentSkin != null) + { + CurrentSkin.Unload(); + CurrentSkin = null; + } + _IsLoaded = false; + } + + public string GetScreenPath() + { + return Path.Combine(_Folder, Name, CSettings.FolderNameScreens); + } + + public void ReloadSkin() + { + if (CurrentSkin != null) + { + CurrentSkin.Unload(); + CurrentSkin = null; + } + bool ok = _LoadSkin(); + Debug.Assert(ok); + } + } +} \ No newline at end of file diff --git a/Vocaluxe/Base/ThemeSystem/CThemes.cs b/Vocaluxe/Base/ThemeSystem/CThemes.cs new file mode 100644 index 00000000..fabfa85f --- /dev/null +++ b/Vocaluxe/Base/ThemeSystem/CThemes.cs @@ -0,0 +1,219 @@ +#region license +// This file is part of Vocaluxe. +// +// Vocaluxe is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Vocaluxe is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with Vocaluxe. If not, see . +#endregion + +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using VocaluxeLib; +using VocaluxeLib.Draw; +using System.Diagnostics; + +namespace Vocaluxe.Base.ThemeSystem +{ + static class CThemes + { + private static readonly List _Themes = new List(); + public static string[] ThemeNames + { + get { return _Themes.Where(th=>th is CBaseTheme).Select(th => th.Name).Distinct().ToArray(); } + } + + public static string[] SkinNames + { + get { return CurrentThemes[-1].SkinNames; } + } + + public static bool Init() + { + return CSkin.InitRequiredElements() && ReadThemesFromFolder(Path.Combine(CSettings.ProgramFolder, CSettings.FolderNameThemes), -1); + } + + /// + /// Currently loaded themes. Only for internal use methods of this static class for getting values from the themes. + /// + public static readonly Dictionary CurrentThemes = new Dictionary(); + + public static void Close() + { + Unload(); + _Themes.Clear(); + CSkin.Close(); + } + + public static void Unload() + { + foreach (CTheme theme in _Themes) + theme.Unload(); + CurrentThemes.Clear(); + } + + /// + /// Loads the currently selected theme trying all others if current theme failed loading
+ /// Therefore CConfig.Theme/Skin might be changed!
+ /// Closes the program on failure! + ///
+ public static void Load() + { + CTheme theme = _Themes.FirstOrDefault(th => th is CBaseTheme && th.Name == CConfig.Config.Theme.Theme) ?? _Themes.FirstOrDefault(th => th is CBaseTheme); + while (theme != null) + { + if (theme.Load()) + break; + theme.Unload(); + CLog.LogError("Failed to load theme " + theme + "! Removing...", true); + _Themes.Remove(theme); + theme = _Themes.FirstOrDefault(th => th is CBaseTheme); + } + CurrentThemes.Add(-1, theme); + if (theme == null) + CLog.LogError("No themes found! Cannot continue!", true, true); + else + { + CConfig.Config.Theme.Theme = theme.Name; + CConfig.Config.Theme.Skin = theme.CurrentSkin.Name; + int[] ids = _Themes.Select(th => th.PartyModeID).Distinct().ToArray(); + foreach (int id in ids.Where(id => id >= 0)) + LoadPartymodeTheme(id); + } + } + + public static bool LoadPartymodeTheme(int partyModeID) + { + Debug.Assert(partyModeID >= 0); + CTheme theme = _Themes.FirstOrDefault(th => th.PartyModeID == partyModeID && th.Name == CConfig.Config.Theme.Theme); + if (theme != null) + { + if (theme.Load()) + { + CurrentThemes.Add(partyModeID, theme); + return true; + } + theme.Unload(); + CLog.LogError("Failed to load theme " + theme + " for partymode! Removing...", true); + _Themes.Remove(theme); + } + theme = _Themes.First(th => th.PartyModeID == partyModeID && th.Name == CSettings.DefaultName); + if (theme.Load()) + { + CurrentThemes.Add(partyModeID, theme); + return true; + } + CLog.LogError("Failed to load default theme for partymode! Unloading partymode!", true); + foreach (CPartyTheme th in _Themes.Where(th => th.PartyModeID == partyModeID)) + th.Unload(); + _Themes.RemoveAll(th => th.PartyModeID == partyModeID); + return false; + } + + public static void Reload() + { + Unload(); + Load(); + } + + public static void ReloadSkin() + { + foreach (CTheme theme in CurrentThemes.Values) + theme.ReloadSkin(); + } + + public static bool ReadThemesFromFolder(string path, int partyModeID) + { + List files = CHelper.ListFiles(path, "*.xml", false, true); + + List newThemes = new List(); + foreach (string file in files) + { + CTheme theme; + if (partyModeID < 0) + theme = new CBaseTheme(file); + else + theme = new CPartyTheme(file, partyModeID); + if (theme.Init()) + newThemes.Add(theme); + } + if (newThemes.Count == 0) + { + CLog.LogError("No valid themes found in " + path); + return false; + } + if (partyModeID >= 0 && newThemes.Count(th => th.Name == CSettings.DefaultName) == 0) + { + CLog.LogError("Partymode misses default theme in " + path); + return false; + } + + _Themes.AddRange(newThemes); + return true; + } + + public static string GetThemeScreensPath(int partyModeID) + { + CTheme theme; + return CurrentThemes.TryGetValue(partyModeID, out theme) ? theme.GetScreenPath() : null; + } + + private static void _LogMissingElement(int partyModeID, string elType, string elName) + { + CLog.LogError("Skin " + CurrentThemes[partyModeID].CurrentSkin + " is missing the " + elType + " \"" + elName + "\"! Expect visual problems!"); + } + + public static CTextureRef GetSkinTexture(string textureName, int partyModeID) + { + if (String.IsNullOrEmpty(textureName)) + return null; + CTextureRef texture = CurrentThemes[partyModeID].CurrentSkin.GetTexture(textureName); + if (texture == null) + _LogMissingElement(partyModeID, "texture", textureName); + return texture; + } + + public static CVideoStream GetSkinVideo(string videoName, int partyModeID, bool loop = true) + { + Debug.Assert(!String.IsNullOrEmpty(videoName)); + CVideoStream video = CurrentThemes[partyModeID].CurrentSkin.GetVideo(videoName, loop); + if (video == null) + _LogMissingElement(partyModeID, "video", videoName); + return video; + } + + public static SThemeCursor GetCursorTheme() + { + return ((CBaseTheme)CurrentThemes[-1]).CursorTheme; + } + + public static bool GetColor(string colorName, int partyModeID, out SColorF color) + { + Debug.Assert(!String.IsNullOrEmpty(colorName)); + if (!CurrentThemes[partyModeID].CurrentSkin.GetColor(colorName, out color)) + { + _LogMissingElement(partyModeID, "color", colorName); + return false; + } + return true; + } + + public static SColorF GetPlayerColor(int playerNr) + { + SColorF color; + if (!GetColor("Player" + playerNr, -1, out color)) + CLog.LogError("Invalid color requested: Color for player " + playerNr + ". Expect visual problems!", true); + return color; + } + } +} \ No newline at end of file diff --git a/Vocaluxe/Base/XmlStructs.cs b/Vocaluxe/Base/XmlStructs.cs new file mode 100644 index 00000000..e9ee97d2 --- /dev/null +++ b/Vocaluxe/Base/XmlStructs.cs @@ -0,0 +1,145 @@ +#region license +// This file is part of Vocaluxe. +// +// Vocaluxe is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Vocaluxe is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with Vocaluxe. If not, see . +#endregion + +using System.Collections.Generic; +using System.ComponentModel; +using System.Xml.Serialization; +using Vocaluxe.Base.Fonts; +using VocaluxeLib; +using VocaluxeLib.PartyModes; +using VocaluxeLib.Xml; + +namespace Vocaluxe.Base +{ + public struct SInfo + { + public string Name; + public string Author; + public int VersionMajor; + public int VersionMinor; + } + + struct SThemeCursor + { + [XmlElement("Skin")] public string SkinName; + + public float W; + public float H; + + public SThemeColor Color; + } + + struct STheme + { + public int ThemeSystemVersion; + public SInfo Info; + [XmlArray, DefaultValue(null)] public SFontFamily[] Fonts; + public SThemeCursor? Cursor; + } + + struct SDefaultFonts + { + [XmlArray] public SFontFamily[] Fonts; + } + + /// + /// Struct used for describing a font family (a type of text with 4 different styles) + /// + [XmlType("Font")] + struct SFontFamily + { + public string Name; + [XmlIgnore] public int PartyModeID; + [XmlIgnore] public string ThemeName; + + [XmlNormalized] public float Outline; //0..1, 0=not outline 1=100% outline + public SColorF OutlineColor; + + public string Folder; + + public string FileNormal; + public string FileBold; + public string FileItalic; + public string FileBoldItalic; + + [XmlIgnore] public CFontStyle Normal; + [XmlIgnore] public CFontStyle Italic; + [XmlIgnore] public CFontStyle Bold; + [XmlIgnore] public CFontStyle BoldItalic; + + public void Dispose() + { + Normal.Dispose(); + Italic.Dispose(); + Bold.Dispose(); + BoldItalic.Dispose(); + } + } + + struct SSkin + { + public int SkinSystemVersion; + public SInfo Info; + public Dictionary Colors; + public Dictionary Skins; + public Dictionary Videos; + } + + struct SPlaylistInfo + { + [XmlElement("PlaylistName")] public string Name; + } + + struct SPlaylist + { + public SPlaylistInfo Info; + [XmlArray] public SPlaylistSong[] Songs; + } + + #region Partymode + struct SPartyModeInfos + { + public string Name; + public string Description; + public string Author; + public string Folder; + public string PartyModeFile; + [XmlAltName("PartyModeVersionMajor")] public int VersionMajor; + [XmlAltName("PartyModeVersionMinor")] public int VersionMinor; + public string TargetAudience; + [XmlIgnore] public int MaxPlayers, MinPlayers, MaxTeams, MinTeams; + [XmlIgnore] public int PartyModeID; + + public void LoadData(IPartyMode pm) + { + MaxPlayers = pm.GetMaxPlayer(); + MinPlayers = pm.GetMinPlayer(); + MaxTeams = pm.GetMaxTeams(); + MinTeams = pm.GetMinTeams(); + PartyModeID = pm.ID; + } + } + + struct SPartyMode + { + public int PartyModeSystemVersion; + [XmlArray("PartyScreens"), XmlArrayItem("ScreenFile")] public List ScreenFiles; + [XmlIgnore] public IPartyMode PartyMode; + public SPartyModeInfos Info; + } + #endregion Partymode +} \ No newline at end of file diff --git a/Vocaluxe/COSFunctions.cs b/Vocaluxe/COSFunctions.cs index d8aec79a..91f451a9 100644 --- a/Vocaluxe/COSFunctions.cs +++ b/Vocaluxe/COSFunctions.cs @@ -23,29 +23,14 @@ namespace Vocaluxe static class COSFunctions { #if WIN - private static bool _DefaultDllDirSet; - private static bool _UsePath; - private static bool _UseSetDllDir; - private static class CWindowsFunctions { - [DllImport("kernel32.dll", CharSet = CharSet.Auto, CallingConvention = CallingConvention.StdCall)] - public static extern void AddDllDirectory(string lpPathName); - - [DllImport("kernel32.dll", CharSet = CharSet.Auto, CallingConvention = CallingConvention.StdCall)] - public static extern void SetDllDirectory(string lpPathName); - + // ReSharper disable MemberHidesStaticFromOuterClass [DllImport("user32.dll", CallingConvention = CallingConvention.StdCall)] [return: MarshalAs(UnmanagedType.Bool)] public static extern bool SetForegroundWindow(IntPtr hWnd); - [DllImport("kernel32.dll", CallingConvention = CallingConvention.StdCall)] - [return: MarshalAs(UnmanagedType.Bool)] - public static extern bool SetDefaultDllDirectories(int directoryFlags); - - // ReSharper disable InconsistentNaming - public const int LOAD_LIBRARY_SEARCH_DEFAULT_DIRS = 0x00001000; - // ReSharper restore InconsistentNaming + // ReSharper restore MemberHidesStaticFromOuterClass } #endif @@ -59,40 +44,6 @@ namespace Vocaluxe Environment.SetEnvironmentVariable("PATH", newPath); } - public static void AddLibrarySearchpath(string path) - { -#if WIN - if (!_DefaultDllDirSet) - { - try - { - CWindowsFunctions.SetDefaultDllDirectories(CWindowsFunctions.LOAD_LIBRARY_SEARCH_DEFAULT_DIRS); - } - catch (Exception) - { - _UsePath = true; - _UseSetDllDir = true; - } - _DefaultDllDirSet = true; - } - if (_UsePath) - AddEnvironmentPath(path); - if (!_UseSetDllDir) - { - try - { - CWindowsFunctions.AddDllDirectory(path); - } - catch (Exception) - { - _UseSetDllDir = true; - } - } - if (_UseSetDllDir) - CWindowsFunctions.SetDllDirectory(path); -#endif - } - public static void SetForegroundWindow(IntPtr hWnd) { #if WIN diff --git a/Vocaluxe/CProgrammHelper.cs b/Vocaluxe/CProgrammHelper.cs index 800b907a..651ef8bf 100644 --- a/Vocaluxe/CProgrammHelper.cs +++ b/Vocaluxe/CProgrammHelper.cs @@ -132,8 +132,7 @@ namespace Vocaluxe string path = "x64"; #endif path = Path.GetDirectoryName(Assembly.GetEntryAssembly().Location) + Path.DirectorySeparatorChar + path; - COSFunctions.AddLibrarySearchpath(path); - COSFunctions.AddLibrarySearchpath(path + Path.DirectorySeparatorChar + "gstreamer"); + COSFunctions.AddEnvironmentPath(path); } } } \ No newline at end of file diff --git a/Vocaluxe/Lib/Database/CCoverDB.cs b/Vocaluxe/Lib/Database/CCoverDB.cs index 7723e2d4..efd33c13 100644 --- a/Vocaluxe/Lib/Database/CCoverDB.cs +++ b/Vocaluxe/Lib/Database/CCoverDB.cs @@ -22,6 +22,7 @@ using System.Drawing.Imaging; using System.IO; using System.Runtime.InteropServices; using Vocaluxe.Base; +using VocaluxeLib; using VocaluxeLib.Draw; #if WIN using System.Data.SQLite; @@ -34,28 +35,29 @@ namespace Vocaluxe.Lib.Database { public class CCoverDB : CDatabaseBase { - //You have to lock all actions using cover connection or transaction, otherwhise order is not guaranted - private readonly object _CoverMutex = new object(); private SQLiteTransaction _TransactionCover; public CCoverDB(string filePath) : base(filePath) {} public override bool Init() { - if (!base.Init()) - return false; + lock (_Mutex) + { + if (!base.Init()) + return false; - if (_Version < 0) - return _CreateCoverDB(); - if (_Version < CSettings.DatabaseCoverVersion) - throw new NotImplementedException("Upgrading of cover DB not implemented"); + if (_Version < 0) + return _CreateCoverDB(); + if (_Version < CSettings.DatabaseCoverVersion) + throw new NotImplementedException("Upgrading of cover DB not implemented"); + } return true; } public override void Close() { //Do commit and close atomicly otherwhise we may loose changes - lock (_CoverMutex) + lock (_Mutex) { _CommitCovers(); @@ -63,7 +65,7 @@ namespace Vocaluxe.Lib.Database } } - public bool GetCover(string coverPath, ref CTexture tex, int maxSize) + public bool GetCover(string coverPath, ref CTextureRef tex, int maxSize) { if (_Connection == null) return false; @@ -73,7 +75,7 @@ namespace Vocaluxe.Lib.Database return false; } - lock (_CoverMutex) + lock (_Mutex) { //Double check here because we may have just closed our connection if (_Connection == null) @@ -81,7 +83,7 @@ namespace Vocaluxe.Lib.Database using (var command = new SQLiteCommand(_Connection)) { command.CommandText = "SELECT id, width, height FROM Cover WHERE [Path] = @path"; - command.Parameters.Add("@path", DbType.String, 0).Value = coverPath; + command.Parameters.Add("@path", DbType.String).Value = coverPath; SQLiteDataReader reader = command.ExecuteReader(); @@ -100,81 +102,81 @@ namespace Vocaluxe.Lib.Database if (reader.HasRows) { reader.Read(); - byte[] data = _GetBytes(reader); + byte[] data2 = _GetBytes(reader); reader.Dispose(); - tex = CDraw.EnqueueTexture(w, h, data); + tex = CDraw.EnqueueTexture(w, h, data2); return true; } - } - else - { - if (reader != null) - reader.Close(); - - if (_TransactionCover == null) - _TransactionCover = _Connection.BeginTransaction(); - - Bitmap origin; - try - { - origin = new Bitmap(coverPath); - } - catch (Exception) - { - CLog.LogError("Error loading Texture: " + coverPath); - return false; - } - - int w = maxSize; - int h = maxSize; - byte[] data; - - try - { - if (origin.Width >= origin.Height && origin.Width > w) - h = (int)Math.Round((float)w / origin.Width * origin.Height); - else if (origin.Height > origin.Width && origin.Height > h) - w = (int)Math.Round((float)h / origin.Height * origin.Width); - - using (var bmp = new Bitmap(w, h)) - { - using (Graphics g = Graphics.FromImage(bmp)) - g.DrawImage(origin, new Rectangle(0, 0, w, h)); - - data = new byte[w * h * 4]; - BitmapData bmpData = bmp.LockBits(new Rectangle(0, 0, bmp.Width, bmp.Height), ImageLockMode.ReadOnly, PixelFormat.Format32bppArgb); - Marshal.Copy(bmpData.Scan0, data, 0, w * h * 4); - bmp.UnlockBits(bmpData); - } - } - finally - { - origin.Dispose(); - } - - tex = CDraw.EnqueueTexture(w, h, data); - - command.CommandText = "INSERT INTO Cover (Path, width, height) VALUES (@path, @w, @h)"; - command.Parameters.Add("@w", DbType.Int32).Value = w; - command.Parameters.Add("@h", DbType.Int32).Value = h; - command.Parameters.Add("@path", DbType.String, 0).Value = coverPath; + command.CommandText = "DELETE FROM Cover WHERE id = @id"; + command.Parameters.Add("@id", DbType.Int32).Value = id; command.ExecuteNonQuery(); + } + if (reader != null) + reader.Close(); + } + } - command.CommandText = "SELECT id FROM Cover WHERE [Path] = @path"; - command.Parameters.Add("@path", DbType.String, 0).Value = coverPath; - reader = command.ExecuteReader(); + // At this point we do not have a mathing entry in the CoverDB (either no Data found and deleted or nothing at all) + // We break out of the lock to do the bitmap loading and resizing here to allow multithreaded loading - if (reader != null) - { - reader.Read(); - int id = reader.GetInt32(0); - reader.Dispose(); - command.CommandText = "INSERT INTO CoverData (CoverID, Data) VALUES (@id, @data)"; - command.Parameters.Add("@id", DbType.Int32).Value = id; - command.Parameters.Add("@data", DbType.Binary, 20).Value = data; - command.ExecuteReader(); - return true; - } + Bitmap origin = CHelper.LoadBitmap(coverPath); + if (origin == null) + return false; + + Size size = origin.GetSize(); + if (size.Width > maxSize || size.Height > maxSize) + { + size = CHelper.FitInBounds(new SRectF(0, 0, maxSize, maxSize, 0), (float)size.Width / size.Height, EAspect.LetterBox).SizeI; + Bitmap tmp = origin.Resize(size); + origin.Dispose(); + origin = tmp; + } + + byte[] data; + + try + { + data = new byte[size.Width * size.Height * 4]; + BitmapData bmpData = origin.LockBits(origin.GetRect(), ImageLockMode.ReadOnly, PixelFormat.Format32bppArgb); + Marshal.Copy(bmpData.Scan0, data, 0, data.Length); + origin.UnlockBits(bmpData); + } + finally + { + origin.Dispose(); + } + + tex = CDraw.EnqueueTexture(size.Width, size.Height, data); + + lock (_Mutex) + { + //Double check here because we may have just closed our connection + if (_Connection == null) + return false; + if (_TransactionCover == null) + _TransactionCover = _Connection.BeginTransaction(); + using (var command = new SQLiteCommand(_Connection)) + { + command.CommandText = "INSERT INTO Cover (Path, width, height) VALUES (@path, @w, @h)"; + command.Parameters.Add("@w", DbType.Int32).Value = size.Width; + command.Parameters.Add("@h", DbType.Int32).Value = size.Height; + command.Parameters.Add("@path", DbType.String).Value = coverPath; + command.ExecuteNonQuery(); + + command.CommandText = "SELECT id FROM Cover WHERE [Path] = @path"; + command.Parameters.Add("@path", DbType.String).Value = coverPath; + SQLiteDataReader reader = command.ExecuteReader(); + + if (reader != null) + { + reader.Read(); + int id = reader.GetInt32(0); + reader.Dispose(); + command.CommandText = "INSERT INTO CoverData (CoverID, Data) VALUES (@id, @data)"; + command.Parameters.Add("@id", DbType.Int32).Value = id; + command.Parameters.Add("@data", DbType.Binary).Value = data; + command.ExecuteNonQuery(); + return true; } } } @@ -183,7 +185,7 @@ namespace Vocaluxe.Lib.Database public void CommitCovers() { - lock (_CoverMutex) + lock (_Mutex) { _CommitCovers(); } diff --git a/Vocaluxe/Lib/Database/CDatabaseBase.cs b/Vocaluxe/Lib/Database/CDatabaseBase.cs index 068530e5..bbe0f026 100644 --- a/Vocaluxe/Lib/Database/CDatabaseBase.cs +++ b/Vocaluxe/Lib/Database/CDatabaseBase.cs @@ -17,7 +17,6 @@ using System; using System.IO; -using Vocaluxe.Base; #if WIN using System.Data.SQLite; @@ -27,61 +26,72 @@ using Mono.Data.Sqlite; namespace Vocaluxe.Lib.Database { - public class CDatabaseBase + public abstract class CDatabaseBase { protected readonly string _FilePath; protected SQLiteConnection _Connection; + //You have to lock all actions using connection or transaction, otherwhise order is not guaranted + protected readonly object _Mutex = new object(); + protected int _Version; //Version of the database (value of row "Value" in table "Version") or -1 if none - public CDatabaseBase(string filePath) + protected CDatabaseBase(string filePath) { _FilePath = filePath; } public virtual bool Init() { - _Connection = new SQLiteConnection("Data Source=" + _FilePath); - try + lock (_Mutex) { - _Connection.Open(); - } - catch (Exception) - { - _Connection.Dispose(); - _Connection = null; - return false; - } - - using (var command = new SQLiteCommand(_Connection)) - { - command.CommandText = "SELECT Value FROM Version"; - - SQLiteDataReader reader = null; - + if (_Connection != null) + return false; + _Connection = new SQLiteConnection("Data Source=" + _FilePath); try { - reader = command.ExecuteReader(); + _Connection.Open(); + } + catch (Exception) + { + _Connection.Dispose(); + _Connection = null; + return false; } - catch (Exception) {} - if (reader == null || !reader.Read() || reader.FieldCount == 0) - _Version = -1; - else - _Version = reader.GetInt32(0); + using (var command = new SQLiteCommand(_Connection)) + { + command.CommandText = "SELECT Value FROM Version"; - if (reader != null) - reader.Dispose(); + SQLiteDataReader reader = null; + + try + { + reader = command.ExecuteReader(); + } + catch (Exception) {} + + if (reader == null || !reader.Read() || reader.FieldCount == 0) + _Version = -1; + else + _Version = reader.GetInt32(0); + + if (reader != null) + reader.Dispose(); + } } return true; } public virtual void Close() { - if (_Connection != null) + lock (_Mutex) { - _Connection.Dispose(); - _Connection = null; + if (_Connection != null) + { + _Connection.Dispose(); + _Connection = null; + } } } @@ -92,6 +102,13 @@ namespace Vocaluxe.Lib.Database return t70.Ticks; } + /// + /// Reads the contents of a field as a byte array
+ /// Assumes you did the locking! + ///
+ /// + /// Field number to read from (default=first) + /// protected static byte[] _GetBytes(SQLiteDataReader reader, int field = 0) { const int chunkSize = 2 * 1024; diff --git a/Vocaluxe/Lib/Database/CResourceDB.cs b/Vocaluxe/Lib/Database/CResourceDB.cs index 4891a19e..0da33eb9 100644 --- a/Vocaluxe/Lib/Database/CResourceDB.cs +++ b/Vocaluxe/Lib/Database/CResourceDB.cs @@ -38,7 +38,7 @@ namespace Vocaluxe.Lib.Database private readonly string[] _FilesV1 = new string[] { "Logo_voc.png", "PerfectNoteStar.png", "redDot.png", "blueDot.png", "brunzel.png", "Darkice.png", "flokuep.png", "flamefire.png", "bohning.png", "mesand.png", - "babene03.png", "pantero.png", "Pinky007.png" + "babene03.png", "lukeIam.png" }; #endif public CResourceDB(string filePath) : base(filePath) {} @@ -66,7 +66,7 @@ namespace Vocaluxe.Lib.Database return true; } - public bool GetCreditsRessource(string fileName, ref CTexture tex) + public bool GetCreditsRessource(string fileName, ref CTextureRef tex) { if (_Connection == null) return false; diff --git a/Vocaluxe/Lib/Draw/CDirect3D.cs b/Vocaluxe/Lib/Draw/CDirect3D.cs index 1c04f6fd..6289f02a 100644 --- a/Vocaluxe/Lib/Draw/CDirect3D.cs +++ b/Vocaluxe/Lib/Draw/CDirect3D.cs @@ -15,13 +15,10 @@ // along with Vocaluxe. If not, see . #endregion -using System.Drawing.Drawing2D; -using System.Threading; using SlimDX; using SlimDX.Direct3D9; using System; using System.Collections.Generic; -using System.ComponentModel; using System.Drawing; using System.Drawing.Imaging; using System.IO; @@ -34,63 +31,63 @@ using VocaluxeLib.Draw; namespace Vocaluxe.Lib.Draw { - class CDirect3D : RenderForm, IDraw + class CRenderFormHook : RenderForm, IFormHook { - #region private vars - private const int _MaxID = 100000; + public MessageEventHandler OnMessage { private get; set; } - private readonly CKeys _Keys; - private readonly CMouse _Mouse; - private bool _Run; + protected override void WndProc(ref Message m) + { + if (OnMessage == null || OnMessage(ref m)) + base.WndProc(ref m); + } + } + class CD3DTexture : CTextureBase + { + public readonly Texture D3DTexture; + + public CD3DTexture(Device device, Size dataSize, int texWidth = 0, int texHeight = 0) : base(dataSize, new Size(texWidth, texHeight)) + { + //Create a new texture in the managed pool, which does not need to be recreated on a lost device + //because a copy of the texture is hold in the Ram + D3DTexture = device == null ? null : new Texture(device, texWidth, texHeight, 0, Usage.AutoGenerateMipMap, Format.A8R8G8B8, Pool.Managed); + } + + public override bool IsLoaded + { + get { return D3DTexture != null; } + } + + public override void Dispose() + { + base.Dispose(); + if (D3DTexture != null) + D3DTexture.Dispose(); + } + } + + class CDirect3D : CDrawBaseWindows, IDraw + { private readonly Direct3D _D3D; private readonly Device _Device; private readonly PresentParameters _PresentParameters; - private bool _Fullscreen; - private Size _OldSize; - private Size _SizeBeforeMinimize; - - private readonly Dictionary _D3DTextures = new Dictionary(); - private readonly Queue _TexturesToLoad = new Queue(); - private readonly Queue _IDs = new Queue(_MaxID); - - private readonly Object _MutexTexture = new Object(); - private VertexBuffer _VertexBuffer; private IndexBuffer _IndexBuffer; - private int _H = 1; - private int _W = 1; - private int _Y; - private int _X; - - private int _BorderLeft; - private int _BorderRight; - private int _BorderTop; - private int _BorderBottom; - - private CTexture _BlankTexture; + private CTextureRef _BlankTexture; private readonly Queue _Vertices = new Queue(); private readonly Queue _VerticesTextures = new Queue(); - private readonly Queue _VerticesRotationMatrices = new Queue(); - - private readonly bool _NonPowerOf2TextureSupported; - #endregion private vars + private readonly Queue _VerticesRotationMatrices = new Queue(); /// /// Creates a new Instance of the CDirect3D Class /// public CDirect3D() { - Icon = new Icon(Path.Combine(CSettings.ProgramFolder, CSettings.FileNameIcon)); + _Form = new CRenderFormHook {ClientSize = new Size(CConfig.Config.Graphics.ScreenW, CConfig.Config.Graphics.ScreenH)}; - //Fill Queue with 100000 IDs - for (int i = 0; i < _MaxID; i++) - _IDs.Enqueue(i); - - _Keys = new CKeys(); try { _D3D = new Direct3D(); @@ -100,32 +97,24 @@ namespace Vocaluxe.Lib.Draw CLog.LogError("No DirectX runtimes were found, please download and install them from http://www.microsoft.com/download/en/details.aspx?id=8109", true, true, e); } - Paint += _OnPaintEvent; - Closing += _OnClosingEvent; - Resize += _OnResizeEvent; + _Form.KeyDown += _OnKeyDown; + _Form.PreviewKeyDown += _OnPreviewKeyDown; + _Form.KeyPress += _OnKeyPress; + _Form.KeyUp += _OnKeyUp; - KeyDown += _OnKeyDown; - PreviewKeyDown += _OnPreviewKeyDown; - KeyPress += _OnKeyPress; - KeyUp += _OnKeyUp; - - _Mouse = new CMouse(); - MouseMove += _OnMouseMove; - MouseWheel += _OnMouseWheel; - MouseDown += _OnMouseDown; - MouseUp += _OnMouseUp; - MouseLeave += _OnMouseLeave; - MouseEnter += _OnMouseEnter; - - ClientSize = new Size(CConfig.ScreenW, CConfig.ScreenH); - _SizeBeforeMinimize = ClientSize; + _Form.MouseMove += _OnMouseMove; + _Form.MouseWheel += _OnMouseWheel; + _Form.MouseDown += _OnMouseDown; + _Form.MouseUp += _OnMouseUp; + _Form.MouseLeave += _OnMouseLeave; + _Form.MouseEnter += _OnMouseEnter; _PresentParameters = new PresentParameters { Windowed = true, SwapEffect = SwapEffect.Discard, - BackBufferHeight = CConfig.ScreenH, - BackBufferWidth = CConfig.ScreenW, + BackBufferHeight = CConfig.Config.Graphics.ScreenH, + BackBufferWidth = CConfig.Config.Graphics.ScreenW, BackBufferFormat = _D3D.Adapters.DefaultAdapter.CurrentDisplayMode.Format, Multisample = MultisampleType.None, MultisampleQuality = 0 @@ -136,7 +125,7 @@ namespace Vocaluxe.Lib.Draw #region Antialiasing int quality; MultisampleType msType; - switch (CConfig.AAMode) + switch (CConfig.Config.Graphics.AAMode) { case EAntiAliasingModes.X2: msType = MultisampleType.TwoSamples; @@ -170,7 +159,7 @@ namespace Vocaluxe.Lib.Draw #endregion Antialiasing //Apply the VSync configuration - _PresentParameters.PresentationInterval = CConfig.VSync == EOffOn.TR_CONFIG_ON ? PresentInterval.Default : PresentInterval.Immediate; + _PresentParameters.PresentationInterval = CConfig.Config.Graphics.VSync == EOffOn.TR_CONFIG_ON ? PresentInterval.Default : PresentInterval.Immediate; //GMA 950 graphics devices can only process vertices in software mode Capabilities caps = _D3D.GetDeviceCaps(_D3D.Adapters.DefaultAdapter.Adapter, DeviceType.Hardware); @@ -184,7 +173,11 @@ namespace Vocaluxe.Lib.Draw try { - _Device = new Device(_D3D, _D3D.Adapters.DefaultAdapter.Adapter, DeviceType.Hardware, Handle, flags, _PresentParameters); + _Device = new Device(_D3D, _D3D.Adapters.DefaultAdapter.Adapter, DeviceType.Hardware, _Form.Handle, flags, _PresentParameters); + } + catch (Exception e) + { + CLog.LogError("Error during D3D device creation.", false, false, e); } finally { @@ -195,213 +188,87 @@ namespace Vocaluxe.Lib.Draw true, true); } } - - CenterToScreen(); } - #region form events - private void _OnPaintEvent(object sender, PaintEventArgs e) {} - - private void _OnResizeEvent(object sender, EventArgs e) {} - - private void _OnClosingEvent(object sender, CancelEventArgs e) - { - _Run = false; - } - - protected override void OnLoad(EventArgs e) - { - _Device.Clear(ClearFlags.Target | ClearFlags.ZBuffer, Color.Black, 1.0f, 0); - } - - protected override void OnResize(EventArgs e) - { - base.OnResize(e); - _DoResize(); - } - - protected override void WndProc(ref Message m) - { - switch (m.Msg) - { - case 0x112: // WM_SYSCOMMAND - switch ((int)m.WParam & 0xFFF0) - { - case 0xF100: // SC_KEYMENU - m.Result = IntPtr.Zero; - break; - case 0xF140: // SC_SCREENSAVER - case 0xF170: // SC_MONITORPOWER - break; - default: - base.WndProc(ref m); - break; - } - break; - default: - base.WndProc(ref m); - break; - } - } - #endregion form events - #region resize /// /// Resizes the viewport /// - private void _DoResize() + protected override void _DoResize() { // The window was minimized, so restore it to the last known size - if (ClientSize.Width == 0 || ClientSize.Height == 0) - ClientSize = _SizeBeforeMinimize; - if (!_Run) - return; - _H = ClientSize.Height; - _W = ClientSize.Width; - _Y = 0; - _X = 0; + if (_Form.ClientSize.Width == 0 || _Form.ClientSize.Height == 0) + _Form.ClientSize = _SizeBeforeMinimize; - if (_W / (float)_H > CSettings.GetRenderAspect()) - { - //The windows's width is too big - _W = (int)Math.Round(_H * CSettings.GetRenderAspect()); - _X = (ClientSize.Width - _W) / 2; - } - else - { - //The windows's height is too big - _H = (int)Math.Round(_W / CSettings.GetRenderAspect()); - _Y = (ClientSize.Height - _H) / 2; - } + if (_H == _Form.ClientSize.Height && _W == _Form.ClientSize.Width && CConfig.Config.Graphics.ScreenAlignment == _CurrentAlignment) + return; + + _CurrentAlignment = CConfig.Config.Graphics.ScreenAlignment; + _H = _Form.ClientSize.Height; + _W = _Form.ClientSize.Width; + + _AdjustAspect(false); //Apply the new sizes to the PresentParameters - _PresentParameters.BackBufferWidth = ClientSize.Width; - _PresentParameters.BackBufferHeight = ClientSize.Height; - ClearScreen(); - //To set new PresentParameters the device has to be resetted - _Reset(); - //All configurations got flushed due to Reset(), so apply them again - Init(); + _PresentParameters.BackBufferWidth = _Form.ClientSize.Width; + _PresentParameters.BackBufferHeight = _Form.ClientSize.Height; + if (_Run) + { + _ClearScreen(); + //To set new PresentParameters the device has to be resetted + _Reset(); + //All configurations got flushed due to Reset(), so apply them again + _InitDevice(); + _Device.Viewport = new Viewport(_X, _Y, _W, _H); + } - //Set the new Viewport - _Device.Viewport = new Viewport(_X, _Y, _W, _H); //Store size so it can get restored after the window gets minimized - _SizeBeforeMinimize = ClientSize; + _SizeBeforeMinimize = _Form.ClientSize; } + // ReSharper disable RedundantOverridenMember /// /// Triggers the Fullscreen mode /// - private void _EnterFullScreen() + protected override void _EnterFullScreen() { //This currently not using real fullscreen mode but a borderless window //Real fullscreen could be gained setting _PresentParameters.Windowed = true //And calling Reset() and Init() after - _OldSize = ClientSize; - - int screenNr = 0; - for (int i = 0; i < Screen.AllScreens.Length; i++) - { - Screen scr = Screen.AllScreens[i]; - if (scr.Bounds.Top <= Top && scr.Bounds.Left <= Left) - screenNr = i; - } - - ClientSize = new Size(Screen.AllScreens[screenNr].Bounds.Width, Screen.AllScreens[screenNr].Bounds.Height); - FormBorderStyle = FormBorderStyle.None; - CenterToScreen(); - _Fullscreen = true; - - if (WindowState == FormWindowState.Maximized) - { - WindowState = FormWindowState.Normal; - _DoResize(); - WindowState = FormWindowState.Maximized; - } - else - _DoResize(); + base._EnterFullScreen(); } - /// - /// Triggers the windowed mode - /// - private void _LeaveFullScreen() - { - ClientSize = _OldSize; - FormBorderStyle = FormBorderStyle.Sizable; - CenterToScreen(); - _Fullscreen = false; - } + // ReSharper restore RedundantOverridenMember #endregion resize - #region mouse event handlers - private void _OnMouseMove(object sender, MouseEventArgs e) - { - _Mouse.MouseMove(e); - } - - private void _OnMouseWheel(object sender, MouseEventArgs e) - { - _Mouse.MouseWheel(e); - } - - private void _OnMouseDown(object sender, MouseEventArgs e) - { - _Mouse.MouseDown(e); - } - - private void _OnMouseUp(object sender, MouseEventArgs e) - { - _Mouse.MouseUp(e); - } - - private void _OnMouseLeave(object sender, EventArgs e) - { - _Mouse.Visible = false; - Cursor.Show(); - } - - private void _OnMouseEnter(object sender, EventArgs e) - { - Cursor.Hide(); - _Mouse.Visible = true; - } - #endregion - - #region keyboard event handlers - private void _OnPreviewKeyDown(object sender, PreviewKeyDownEventArgs e) - { - _OnKeyDown(sender, new KeyEventArgs(e.KeyData)); - } - - private void _OnKeyDown(object sender, KeyEventArgs e) - { - _Keys.KeyDown(e); - } - - private void _OnKeyPress(object sender, KeyPressEventArgs e) - { - _Keys.KeyPress(e); - } - - private void _OnKeyUp(object sender, KeyEventArgs e) - { - _Keys.KeyUp(e); - } - #endregion keyboard event handlers - - #region implementation - #region main stuff /// /// Inits the Device /// /// True if it succeeded else false - public bool Init() + public override bool Init() { + if (!base.Init()) + return false; + if (_Device.Disposed) return false; - Text = CSettings.GetFullVersionText(); + + _InitDevice(); + + //This creates a new white texture and adds it to the texture pool + //This texture is used for the DrawRect method + using (var blankMap = new Bitmap(1, 1)) + using (Graphics g = Graphics.FromImage(blankMap)) + { + g.Clear(Color.White); + _BlankTexture = AddTexture(blankMap); + } + return true; + } + + private void _InitDevice() + { _AdjustNewBorders(); _VertexBuffer = new VertexBuffer(_Device, CSettings.VertexBufferElements * (4 * Marshal.SizeOf(typeof(STexturedColoredVertex))), Usage.WriteOnly | Usage.Dynamic, @@ -417,9 +284,9 @@ namespace Vocaluxe.Lib.Draw CLog.LogError("Failed to enable alpha blending"); if (_Device.SetRenderState(RenderState.Lighting, false).IsFailure) CLog.LogError("Failed to disable lighting"); - if (_Device.SetRenderState(RenderState.DestinationBlend, SlimDX.Direct3D9.Blend.InverseSourceAlpha).IsFailure) + if (_Device.SetRenderState(RenderState.DestinationBlend, Blend.InverseSourceAlpha).IsFailure) CLog.LogError("Failed to set destination blend"); - if (_Device.SetRenderState(RenderState.SourceBlend, SlimDX.Direct3D9.Blend.SourceAlpha).IsFailure) + if (_Device.SetRenderState(RenderState.SourceBlend, Blend.SourceAlpha).IsFailure) CLog.LogError("Failed to set source blend"); if (_PresentParameters.Multisample != MultisampleType.None) { @@ -457,99 +324,37 @@ namespace Vocaluxe.Lib.Draw stream.WriteRange(indices); _IndexBuffer.Unlock(); _Device.Indices = _IndexBuffer; - - //This creates a new white texture and adds it to the texture pool - //This texture is used for the DrawRect method - using (var blankMap = new Bitmap(1, 1)) - { - Graphics g = Graphics.FromImage(blankMap); - g.Clear(Color.White); - g.Dispose(); - _BlankTexture = AddTexture(blankMap); - } - return true; } - /// - /// Starts the rendering - /// - public void MainLoop() + protected override void _OnBeforeDraw() { - _Run = true; - int delay = 0; - Show(); + if (_Device.BeginScene().IsFailure) + CLog.LogError("Failed to begin scene"); + } - if (CConfig.FullScreen == EOffOn.TR_CONFIG_ON) - _EnterFullScreen(); - - //Resize window if aspect ratio is incorrect - if (Math.Abs(_W / (float)_H - CSettings.GetRenderAspect()) > 0.01) - _DoResize(); - - while (_Run) + protected override void _OnAfterDraw() + { + _RenderVertexBuffer(); + if (_Device.EndScene().IsFailure) + CLog.LogError("Failed to end scene"); + try { - Application.DoEvents(); - //Clear the previous Frame - ClearScreen(); - //We want to begin drawing - if (_Device.BeginScene().IsFailure) - CLog.LogError("Failed to begin scene"); - _CheckQueue(); - if (!CGraphics.Draw()) - _Run = false; - _RenderVertexBuffer(); - //We finished drawing the frame - if (_Device.EndScene().IsFailure) - CLog.LogError("Failed to end scene"); - if (!CGraphics.UpdateGameLogic(_Keys, _Mouse)) - _Run = false; - try - { - //Now push the frame to the Viewport - _Device.Present(); - } - catch (Direct3D9Exception) - { - //In Direct3D devices can get lost. - //This happens for example when opening the Task Manager in Vista/Windows 7 or if a UAC message is opening - //We need to reset the device to get it to workable state again - //After a reset Init() needs to be called because all data in the Direct3D default pool are lost and need to be recreated - if (_Device.TestCooperativeLevel() == ResultCode.DeviceNotReset) - { - _Reset(); - Init(); - } - } - //Apply fullscreen mode - if ((CConfig.FullScreen == EOffOn.TR_CONFIG_ON) != _Fullscreen) - { - if (!_Fullscreen) - _EnterFullScreen(); - else - _LeaveFullScreen(); - } - - //Apply border changes - if (_BorderLeft != CConfig.BorderLeft || _BorderRight != CConfig.BorderRight || _BorderTop != CConfig.BorderTop || _BorderBottom != CConfig.BorderBottom) - { - _BorderLeft = CConfig.BorderLeft; - _BorderRight = CConfig.BorderRight; - _BorderTop = CConfig.BorderTop; - _BorderBottom = CConfig.BorderBottom; - - _AdjustNewBorders(); - } - - if (CTime.IsRunning()) - delay = (int)Math.Floor(CConfig.CalcCycleTime() - CTime.GetMilliseconds()); - - if (delay >= 1 && CConfig.VSync == EOffOn.TR_CONFIG_OFF) - Thread.Sleep(delay); - //Calculate the FPS Rate and restart the timer after a frame - CTime.CalculateFPS(); - CTime.Restart(); + //Now push the frame to the Viewport + _Device.Present(); } - Close(); + catch (Direct3D9Exception) + { + //In Direct3D devices can get lost. + //This happens for example when opening the Task Manager in Vista/Windows 7 or if a UAC message is opening + //We need to reset the device to get it to workable state again + //After a reset Init() needs to be called because all data in the Direct3D default pool are lost and need to be recreated + if (_Device.TestCooperativeLevel() == ResultCode.DeviceNotReset) + { + _Reset(); + _InitDevice(); + } + } + Application.DoEvents(); } /// @@ -565,12 +370,14 @@ namespace Vocaluxe.Lib.Draw CLog.LogError("Failed to reset the device"); } - private void _AdjustNewBorders() + protected override void _AdjustNewBorders() { - SlimDX.Matrix translate = SlimDX.Matrix.Translation(new Vector3(-(float)CSettings.RenderW / 2, (float)CSettings.RenderH / 2, 0)); - SlimDX.Matrix projection = SlimDX.Matrix.OrthoOffCenterLH( - -(float)CSettings.RenderW / 2 - _BorderLeft, (float)CSettings.RenderW / 2 + _BorderRight, - -(float)CSettings.RenderH / 2 - _BorderBottom, (float)CSettings.RenderH / 2 + _BorderTop, + const float dx = (float)CSettings.RenderW / 2; + const float dy = (float)CSettings.RenderH / 2; + Matrix translate = Matrix.Translation(new Vector3(-dx, dy, 0)); + Matrix projection = Matrix.OrthoOffCenterLH( + -dx - _BorderLeft, dx + _BorderRight, + -dy - _BorderBottom, dy + _BorderTop, CSettings.ZNear, CSettings.ZFar); if (_Device.SetTransform(TransformState.Projection, projection).IsFailure) @@ -583,21 +390,10 @@ namespace Vocaluxe.Lib.Draw /// Unloads all Textures and other objects used by Direct3D for rendering /// /// - public void Unload() + public override void Close() { - try - { - Close(); - } - catch {} - //Dispose all textures - foreach (Texture texture in _D3DTextures.Values) - { - if (texture != null) - texture.Dispose(); - } - - STexturedColoredVertex.GetDeclaration(_Device).Dispose(); + base.Close(); + STexturedColoredVertex.DisposeDeclaration(); _VertexBuffer.Dispose(); _IndexBuffer.Dispose(); _Device.Dispose(); @@ -622,13 +418,47 @@ namespace Vocaluxe.Lib.Draw return _Device.Viewport.Height; } + /// + /// Adds a texture to the vertext buffer + /// + /// Texture to draw + /// Coordinates to draw on + /// Color to use + /// If true, then color is faded out in y direction + protected override void _DrawTexture(CD3DTexture texture, SDrawCoords dc, SColorF color, bool isReflection = false) + { + //Align the pixels because Direct3D expects the pixels to be the left top corner + dc.Wx1 -= 0.5f; + dc.Wy1 -= 0.5f; + dc.Wx2 -= 0.5f; + dc.Wy2 -= 0.5f; + + color.A *= CGraphics.GlobalAlpha; + int c = color.AsColor().ToArgb(); + int c2; + if (isReflection) + { + color.A = 0; + c2 = color.AsColor().ToArgb(); + } + else + c2 = c; + + var vert = new STexturedColoredVertex[4]; + vert[0] = new STexturedColoredVertex(new Vector3(dc.Wx1, -dc.Wy1, dc.Wz), new Vector2(dc.Tx1, dc.Ty1), c); + vert[1] = new STexturedColoredVertex(new Vector3(dc.Wx1, -dc.Wy2, dc.Wz), new Vector2(dc.Tx1, dc.Ty2), c2); + vert[2] = new STexturedColoredVertex(new Vector3(dc.Wx2, -dc.Wy2, dc.Wz), new Vector2(dc.Tx2, dc.Ty2), c2); + vert[3] = new STexturedColoredVertex(new Vector3(dc.Wx2, -dc.Wy1, dc.Wz), new Vector2(dc.Tx2, dc.Ty1), c); + _AddToVertexBuffer(vert, texture.D3DTexture, _CalculateRotationMatrix(dc.Rotation, dc.Wx1, dc.Wx2, dc.Wy1, dc.Wy2)); + } + /// /// Adds a quad a list which will be added and rendered to the vertexbuffer when calling RenderToVertexBuffer to reduce vertexbuffer calls each frame to a minimum /// /// A TexturedColoredVertex array containg 4 vertices /// The texture the vertex should be textured with /// The vertices' rotation - private void _AddToVertexBuffer(STexturedColoredVertex[] vertices, Texture tex, SlimDX.Matrix rotation) + private void _AddToVertexBuffer(STexturedColoredVertex[] vertices, Texture tex, Matrix rotation) { //The vertexbuffer is full, so we need to flush it before we can continue if (_Vertices.Count >= CSettings.VertexBufferElements) @@ -673,11 +503,10 @@ namespace Vocaluxe.Lib.Draw } #endregion main stuff - #region Basic Draw Methods /// /// Removes all textures from the screen /// - public void ClearScreen() + protected override void _ClearScreen() { if (_Device.Clear(ClearFlags.Target | ClearFlags.ZBuffer, Color.Black, 1.0f, 0).IsFailure) CLog.LogError("Failed to clear the backbuffer"); @@ -687,41 +516,35 @@ namespace Vocaluxe.Lib.Draw /// Copies the current frame into a texture /// A texture holding the current frame ///
- public CTexture CopyScreen() + public CTextureRef CopyScreen() { - CTexture texture = _GetNewTexture(_W, _H); - + CD3DTexture tex = _CreateTexture(new Size(_W, _H)); Surface backbufferSurface = _Device.GetBackBuffer(0, 0); - var tex = new Texture(_Device, texture.W2, texture.H2, 0, Usage.AutoGenerateMipMap, Format.A8R8G8B8, Pool.Managed); - Surface textureSurface = tex.GetSurfaceLevel(0); + Surface textureSurface = tex.D3DTexture.GetSurfaceLevel(0); Surface.FromSurface(textureSurface, backbufferSurface, Filter.Default, 0, new Rectangle(0, 0, _W, _H), new Rectangle(0, 0, _W, _H)); backbufferSurface.Dispose(); - lock (_MutexTexture) - { - texture.ID = _IDs.Dequeue(); - _D3DTextures.Add(texture.ID, tex); - return texture; - } + return _GetTextureReference(_W, _H, tex); } /// /// Copies the current frame into a texture /// - /// The texture in which the frame is copied to - public void CopyScreen(ref CTexture texture) + /// The texture in which the frame is copied to + public void CopyScreen(ref CTextureRef textureRef) { - //Check for actual texture sizes! (W2/H2) as it may be up/downsized compared to OrigSize - if (!_TextureExists(texture) || texture.W2 != GetScreenWidth() || texture.H2 != GetScreenHeight()) + CD3DTexture texture; + if (!_GetTexture(textureRef, out texture) || texture.DataSize.Width != GetScreenWidth() || texture.DataSize.Height != GetScreenHeight()) { - RemoveTexture(ref texture); - texture = CopyScreen(); + RemoveTexture(ref textureRef); + textureRef = CopyScreen(); } else { Surface backbufferSurface = _Device.GetBackBuffer(0, 0); - Surface textureSurface = _D3DTextures[texture.ID].GetSurfaceLevel(0); + Surface textureSurface = texture.D3DTexture.GetSurfaceLevel(0); Surface.FromSurface(textureSurface, backbufferSurface, Filter.Default, 0); + backbufferSurface.Dispose(); } } @@ -741,36 +564,12 @@ namespace Vocaluxe.Lib.Draw } } - /// - /// Draws a line - /// - /// The alpha value from 0-255 - /// The red value from 0-255 - /// The red value from 0-255 - /// The red value from 0-255 - /// The width of the line - /// The start x-value - /// The start y-value - /// The end x-value - /// The end y-value - public void DrawLine(int a, int r, int g, int b, int w, int x1, int y1, int x2, int y2) - { - var lineVector = new Vector2[] {new Vector2(x1, y1), new Vector2(x2, y2)}; - using (var line = new Line(_Device)) - { - line.Antialias = true; - line.Begin(); - line.Draw(lineVector, new Color4((float)a / 255, (float)r / 255, (float)g / 255, (float)b / 255)); - line.End(); - } - } - /// /// Draws a colored rectangle /// /// The color in which the rectangle will be drawn in /// The coordinates in a SRectF struct - public void DrawColor(SColorF color, SRectF rect) + public void DrawRect(SColorF color, SRectF rect) { DrawTexture(_BlankTexture, rect, color); } @@ -782,154 +581,23 @@ namespace Vocaluxe.Lib.Draw /// The coordinates in a SRectF struct /// The space between the texture and the reflection /// The height of the reflection - public void DrawColorReflection(SColorF color, SRectF rect, float space, float height) + public void DrawRectReflection(SColorF color, SRectF rect, float space, float height) { DrawTextureReflection(_BlankTexture, rect, color, rect, space, height); } - #endregion Basic Draw Methods - #region Textures - - #region adding - /// - /// Adds a texture and stores it in the VRam - /// - /// The texture's filepath - /// A STexture object containing the added texture - public CTexture AddTexture(string texturePath) + protected override CD3DTexture _CreateTexture(Size dataSize) { - if (!File.Exists(texturePath)) - { - CLog.LogError("Can't find File: " + texturePath); - return null; - } - Bitmap bmp; - try - { - bmp = new Bitmap(texturePath); - } - catch (Exception) - { - CLog.LogError("Error loading Texture: " + texturePath); - return null; - } - CTexture s; - try - { - s = AddTexture(bmp); - } - finally - { - bmp.Dispose(); - } - return s; + if (dataSize.Width < 0) + return new CD3DTexture(null, dataSize); + return new CD3DTexture(_Device, dataSize, _CheckForNextPowerOf2(dataSize.Width), _CheckForNextPowerOf2(dataSize.Height)); } - /// - /// Adds a texture and stores it in the Vram - /// - /// The Bitmap of which the texure will be created from - /// A STexture object containing the added texture - public CTexture AddTexture(Bitmap bmp) - { - if (bmp.Height == 0 || bmp.Width == 0) - return null; - int maxSize; - //Apply the right max size - switch (CConfig.TextureQuality) - { - case ETextureQuality.TR_CONFIG_TEXTURE_LOWEST: - maxSize = 128; - break; - case ETextureQuality.TR_CONFIG_TEXTURE_LOW: - maxSize = 256; - break; - case ETextureQuality.TR_CONFIG_TEXTURE_MEDIUM: - maxSize = 512; - break; - case ETextureQuality.TR_CONFIG_TEXTURE_HIGH: - maxSize = 1024; - break; - case ETextureQuality.TR_CONFIG_TEXTURE_HIGHEST: - maxSize = 2048; - break; - default: - maxSize = 512; - break; - } - - int w = Math.Min(bmp.Width, maxSize); - int h = Math.Min(bmp.Height, maxSize); - w = _CheckForNextPowerOf2(w); - h = _CheckForNextPowerOf2(h); - - var texture = new CTexture(bmp.Width, bmp.Height, w, h, true); - - Bitmap bmp2 = null; - byte[] data; - try - { - if (bmp.Width != w || bmp.Height != h) - { - //Create a new Bitmap with the new sizes - bmp2 = new Bitmap(w, h); - //Scale the texture - using (Graphics g = Graphics.FromImage(bmp2)) - { - g.InterpolationMode = InterpolationMode.HighQualityBicubic; - g.SmoothingMode = SmoothingMode.HighQuality; - g.DrawImage(bmp, new Rectangle(0, 0, bmp2.Width, bmp2.Height)); - } - bmp = bmp2; - } - - //Fill the new Bitmap with the texture data - BitmapData bmpData = bmp.LockBits(new Rectangle(0, 0, w, h), ImageLockMode.ReadOnly, PixelFormat.Format32bppArgb); - data = new byte[4 * w * h]; - Marshal.Copy(bmpData.Scan0, data, 0, data.Length); - bmp.UnlockBits(bmpData); - } - finally - { - if (bmp2 != null) - bmp2.Dispose(); - } - - return _AddTexture(texture, w, data); - } - - public CTexture AddTexture(int w, int h, byte[] data) - { - CTexture texture = _GetNewTexture(w, h); - return _AddTexture(texture, w, data); - } - - private CTexture _AddTexture(CTexture texture, int w, byte[] data) - { - Texture t = _CreateTexture(texture.W2, texture.H2, w, data); - - lock (_MutexTexture) - { - texture.ID = _IDs.Dequeue(); - _D3DTextures.Add(texture.ID, t); - } - return texture; - } - - private Texture _CreateTexture(int textureW, int textureH, int w, byte[] data) - { - //Create a new texture in the managed pool, which does not need to be recreated on a lost device - //because a copy of the texture is hold in the Ram - var t = new Texture(_Device, textureW, textureH, 0, Usage.AutoGenerateMipMap, Format.A8R8G8B8, Pool.Managed); - _WriteDataToTexture(t, w, data); - return t; - } - - private static void _WriteDataToTexture(Texture t, int w, byte[] data) + protected override void _WriteDataToTexture(CD3DTexture texture, byte[] data) { //Lock the texture and fill it with the data - DataRectangle rect = t.LockRectangle(0, LockFlags.Discard); - int rowWidth = 4 * w; + DataRectangle rect = texture.D3DTexture.LockRectangle(0, LockFlags.Discard); + int rowWidth = 4 * texture.DataSize.Width; if (rowWidth == rect.Pitch) rect.Data.Write(data, 0, data.Length); else @@ -941,414 +609,32 @@ namespace Vocaluxe.Lib.Draw rect.Data.Position = rect.Data.Position - rowWidth + rect.Pitch; } } - t.UnlockRectangle(0); + texture.D3DTexture.UnlockRectangle(0); } - public CTexture EnqueueTexture(int w, int h, byte[] data) + private static Matrix _CalculateRotationMatrix(float rot, float rx1, float rx2, float ry1, float ry2) { - CTexture texture = _GetNewTexture(w, h); - - lock (_MutexTexture) - { - texture.ID = _IDs.Dequeue(); - _D3DTextures.Add(texture.ID, null); - var queue = new STextureQueue(texture.ID, texture.W2, texture.H2, w, h, data); - _TexturesToLoad.Enqueue(queue); - } - return texture; - } - - private CTexture _GetNewTexture(int w, int h) - { - return new CTexture(w, h, _CheckForNextPowerOf2(w), _CheckForNextPowerOf2(h)); - } - #endregion adding - - #region updating - /// - /// Updates the data of a texture - /// - /// The texture to update - /// - /// - /// A byte array containing the new texture's data - /// True if succeeded - public bool UpdateTexture(CTexture texture, int w, int h, byte[] data) - { - //Check if texture exists and extend matches - if (!_TextureExists(texture) || texture.UsedWidth != w || texture.UsedHeight != h) - return false; - lock (_MutexTexture) - { - _WriteDataToTexture(_D3DTextures[texture.ID], w, data); - } - return true; - } - - public bool UpdateOrAddTexture(ref CTexture texture, int w, int h, byte[] data) - { - if (!UpdateTexture(texture, w, h, data)) - { - RemoveTexture(ref texture); - texture = AddTexture(w, h, data); - } - return true; - } - #endregion updating - - /// - /// Checks if a texture exists - /// - /// The texture to check - /// True if the texture exists - private bool _TextureExists(CTexture texture) - { - lock (_MutexTexture) - { - return texture != null && _D3DTextures.ContainsKey(texture.ID); - } - } - - /// - /// Removes a texture from the Vram - /// - /// The texture to be removed - public void RemoveTexture(ref CTexture texture) - { - if (_TextureExists(texture)) - { - lock (_MutexTexture) - { - _D3DTextures[texture.ID].Dispose(); - _D3DTextures.Remove(texture.ID); - _IDs.Enqueue(texture.ID); - } - } - texture = null; - } - - #region drawing - /// - /// Draws a texture - /// - /// The texture to be drawn - public void DrawTexture(CTexture texture) - { - if (texture == null) - return; - DrawTexture(texture, texture.Rect, texture.Color); - } - - /// - /// Draws a texture - /// - /// The texture to be drawn - /// A SRectF struct containing the destination coordinates - public void DrawTexture(CTexture texture, SRectF rect) - { - if (texture == null) - return; - DrawTexture(texture, rect, texture.Color); - } - - /// - /// Draws a texture - /// - /// The texture to be drawn - /// A SRectF struct containing the destination coordinates - /// A SColorF struct containing a color which the texture will be colored in - /// True if the texture should be mirrored - public void DrawTexture(CTexture texture, SRectF rect, SColorF color, bool mirrored = false) - { - DrawTexture(texture, rect, color, new SRectF(0, 0, CSettings.RenderW, CSettings.RenderH, rect.Z), mirrored); - } - - /// - /// Draws a texture - /// - /// The texture to be drawn - /// A SRectF struct containing the destination coordinates - /// A SColorF struct containing a color which the texture will be colored in - /// A SRectF struct containing which part of the texture should be drawn - /// True if the texture should be mirrored - public void DrawTexture(CTexture texture, SRectF rect, SColorF color, SRectF bounds, bool mirrored = false) - { - if (!_TextureExists(texture)) - return; - if (_D3DTextures[texture.ID] == null) - return; - - //Calculate the position - float x1 = (bounds.X - rect.X) / rect.W * texture.WidthRatio; - float x2 = (bounds.X + bounds.W - rect.X) / rect.W * texture.WidthRatio; - float y1 = (bounds.Y - rect.Y) / rect.H * texture.HeightRatio; - float y2 = (bounds.Y + bounds.H - rect.Y) / rect.H * texture.HeightRatio; - - if (x1 < 0) - x1 = 0f; - - if (x2 > texture.WidthRatio) - x2 = texture.WidthRatio; - - if (y1 < 0) - y1 = 0f; - - if (y2 > texture.HeightRatio) - y2 = texture.HeightRatio; - - //Calculate the size - float rx1 = rect.X; - float rx2 = rect.X + rect.W; - float ry1 = rect.Y; - float ry2 = rect.Y + rect.H; - - if (rx1 < bounds.X) - rx1 = bounds.X; - - if (rx2 > bounds.X + bounds.W) - rx2 = bounds.X + bounds.W; - - if (ry1 < bounds.Y) - ry1 = bounds.Y; - - if (ry2 > bounds.Y + bounds.H) - ry2 = bounds.Y + bounds.H; - - //Align the pixels because Direct3D expects the pixels to be the left top corner - rx1 -= 0.5f; - ry1 -= 0.5f; - rx2 -= 0.5f; - ry2 -= 0.5f; - - color.A *= CGraphics.GlobalAlpha; - - if (color.A > 1) - color.A = 1; - if (color.R > 1) - color.R = 1; - if (color.G > 1) - color.G = 1; - if (color.B > 1) - color.B = 1; - - Color c = color.AsColor(); - - if (!mirrored) - { - var vert = new STexturedColoredVertex[4]; - vert[0] = new STexturedColoredVertex(new Vector3(rx1, -ry1, rect.Z + CGraphics.ZOffset), new Vector2(x1, y1), c.ToArgb()); - vert[1] = new STexturedColoredVertex(new Vector3(rx1, -ry2, rect.Z + CGraphics.ZOffset), new Vector2(x1, y2), c.ToArgb()); - vert[2] = new STexturedColoredVertex(new Vector3(rx2, -ry2, rect.Z + CGraphics.ZOffset), new Vector2(x2, y2), c.ToArgb()); - vert[3] = new STexturedColoredVertex(new Vector3(rx2, -ry1, rect.Z + CGraphics.ZOffset), new Vector2(x2, y1), c.ToArgb()); - _AddToVertexBuffer(vert, _D3DTextures[texture.ID], _CalculateRotationMatrix(rect.Rotation, rx1, rx2, ry1, ry2)); - } - else - { - var vert = new STexturedColoredVertex[4]; - vert[0] = new STexturedColoredVertex(new Vector3(rx1, -ry1, rect.Z + CGraphics.ZOffset), new Vector2(x1, -y1), c.ToArgb()); - vert[1] = new STexturedColoredVertex(new Vector3(rx1, -ry2, rect.Z + CGraphics.ZOffset), new Vector2(x1, -y2), c.ToArgb()); - vert[2] = new STexturedColoredVertex(new Vector3(rx2, -ry2, rect.Z + CGraphics.ZOffset), new Vector2(x2, -y2), c.ToArgb()); - vert[3] = new STexturedColoredVertex(new Vector3(rx2, -ry1, rect.Z + CGraphics.ZOffset), new Vector2(x2, -y1), c.ToArgb()); - _AddToVertexBuffer(vert, _D3DTextures[texture.ID], _CalculateRotationMatrix(rect.Rotation, rx1, rx2, ry1, ry2)); - } - } - - /// - /// Draws a texture - /// - /// The texture to be drawn - /// A SRectF struct containing the destination coordinates - /// A SColorF struct containing a color which the texture will be colored in - /// A Value ranging from 0 to 1 containing the beginning of the texture - /// A Value ranging from 0 to 1 containing the ending of the texture - public void DrawTexture(CTexture texture, SRectF rect, SColorF color, float begin, float end) - { - if (!_TextureExists(texture)) - return; - if (_D3DTextures[texture.ID] == null) - return; - - float x1 = 0f + begin * texture.WidthRatio; - float x2 = texture.WidthRatio * end; - const float y1 = 0f; - float y2 = texture.HeightRatio; - - float rx1 = rect.X + begin * rect.W; - float rx2 = rect.X + end * rect.W; - float ry1 = rect.Y; - float ry2 = rect.Y + rect.H; - - //Align the pixels because Direct3D expects the pixels to be the left top corner - rx1 -= 0.5f; - ry1 -= 0.5f; - rx2 -= 0.5f; - ry2 -= 0.5f; - - color.A *= CGraphics.GlobalAlpha; - - Color c = color.AsColor(); - - var vert = new STexturedColoredVertex[4]; - vert[0] = new STexturedColoredVertex(new Vector3(rx1, -ry1, rect.Z + CGraphics.ZOffset), new Vector2(x1, y1), c.ToArgb()); - vert[1] = new STexturedColoredVertex(new Vector3(rx1, -ry2, rect.Z + CGraphics.ZOffset), new Vector2(x1, y2), c.ToArgb()); - vert[2] = new STexturedColoredVertex(new Vector3(rx2, -ry2, rect.Z + CGraphics.ZOffset), new Vector2(x2, y2), c.ToArgb()); - vert[3] = new STexturedColoredVertex(new Vector3(rx2, -ry1, rect.Z + CGraphics.ZOffset), new Vector2(x2, y1), c.ToArgb()); - _AddToVertexBuffer(vert, _D3DTextures[texture.ID], _CalculateRotationMatrix(rect.Rotation, rx1, rx2, ry1, ry2)); - } - - /// - /// Draws a reflection of a texture - /// - /// The texture of which a reflection should be drawn - /// A SRectF struct containing the destination coordinates - /// A SColorF struct containing a color which the texture will be colored in - /// A SRectF struct containing which part of the texture should be drawn - /// The space between the texture and the reflection - /// The height of the reflection - public void DrawTextureReflection(CTexture texture, SRectF rect, SColorF color, SRectF bounds, float space, float height) - { - if (!_TextureExists(texture)) - return; - if (_D3DTextures[texture.ID] == null) - return; - - if (Math.Abs(rect.W) < float.Epsilon || Math.Abs(rect.H) < float.Epsilon || Math.Abs(bounds.H) < float.Epsilon || Math.Abs(bounds.W) < float.Epsilon || - Math.Abs(color.A) < float.Epsilon || height <= 0f) - return; - - if (bounds.X > rect.X + rect.W || bounds.X + bounds.W < rect.X) - return; - - if (bounds.Y > rect.Y + rect.H || bounds.Y + bounds.H < rect.Y) - return; - - if (height > bounds.H) - height = bounds.H; - - float x1 = (bounds.X - rect.X) / rect.W * texture.WidthRatio; - float x2 = (bounds.X + bounds.W - rect.X) / rect.W * texture.WidthRatio; - float y1 = (bounds.Y - rect.Y + rect.H - height) / rect.H * texture.HeightRatio; - float y2 = (bounds.Y + bounds.H - rect.Y) / rect.H * texture.HeightRatio; - - if (x1 < 0) - x1 = 0f; - - if (x2 > texture.WidthRatio) - x2 = texture.WidthRatio; - - if (y1 < 0) - y1 = 0f; - - if (y2 > texture.HeightRatio) - y2 = texture.HeightRatio; - - - float rx1 = rect.X; - float rx2 = rect.X + rect.W; - float ry1 = rect.Y + rect.H + space; - float ry2 = rect.Y + rect.H + space + height; - - if (rx1 < bounds.X) - rx1 = bounds.X; - - if (rx2 > bounds.X + bounds.W) - rx2 = bounds.X + bounds.W; - - if (ry1 < bounds.Y + space) - ry1 = bounds.Y + space; - - if (ry2 > bounds.Y + bounds.H + space + height) - ry2 = bounds.Y + bounds.H + space + height; - - //Align the pixels because Direct3D expects the pixels to be the left top corner - rx1 -= 0.5f; - ry1 -= 0.5f; - rx2 -= 0.5f; - ry2 -= 0.5f; - - color.A *= CGraphics.GlobalAlpha; - Color c = color.AsColor(); - color.A = 0; - Color transparent = color.AsColor(); - - var vert = new STexturedColoredVertex[4]; - vert[0] = new STexturedColoredVertex(new Vector3(rx1, -ry1, rect.Z + CGraphics.ZOffset), new Vector2(x1, y2), c.ToArgb()); - vert[1] = new STexturedColoredVertex(new Vector3(rx1, -ry2, rect.Z + CGraphics.ZOffset), new Vector2(x1, y1), transparent.ToArgb()); - vert[2] = new STexturedColoredVertex(new Vector3(rx2, -ry2, rect.Z + CGraphics.ZOffset), new Vector2(x2, y1), transparent.ToArgb()); - vert[3] = new STexturedColoredVertex(new Vector3(rx2, -ry1, rect.Z + CGraphics.ZOffset), new Vector2(x2, y2), c.ToArgb()); - _AddToVertexBuffer(vert, _D3DTextures[texture.ID], _CalculateRotationMatrix(rect.Rotation, rx1, rx2, ry1, ry2)); - } - #endregion drawing - - private void _CheckQueue() - { - lock (_MutexTexture) - { - while (_TexturesToLoad.Count > 0) - { - STextureQueue q = _TexturesToLoad.Dequeue(); - Texture t; - if (_D3DTextures.TryGetValue(q.ID, out t) && t != null) - continue; - - t = _CreateTexture(q.TextureWidth, q.TextureHeight, q.DataWidth, q.Data); - _D3DTextures[q.ID] = t; - } - } - } - - /// - /// Gets the count of current textures - /// - /// The amount of textures - public int GetTextureCount() - { - return _D3DTextures.Count; - } - #endregion Textures - - #endregion implementation - - #region utility - /// - /// Calculates the next power of two if the device has the POW2 flag set - /// - /// The value of which the next power of two will be calculated - /// The next power of two - private int _CheckForNextPowerOf2(int n) - { - if (_NonPowerOf2TextureSupported) - return n; - if (n < 0) - throw new ArgumentOutOfRangeException("n", "Must be positive."); - return (int)Math.Pow(2, Math.Ceiling(Math.Log(n, 2))); - } - - private SlimDX.Matrix _CalculateRotationMatrix(float rot, float rx1, float rx2, float ry1, float ry2) - { - SlimDX.Matrix originTranslation = SlimDX.Matrix.Translation(new Vector3(-(float)CSettings.RenderW / 2, (float)CSettings.RenderH / 2, 0)); + Matrix originTranslation = Matrix.Translation(new Vector3(-(float)CSettings.RenderW / 2, (float)CSettings.RenderH / 2, 0)); if (Math.Abs(rot) > float.Epsilon) { float rotation = rot * (float)Math.PI / 180; float centerX = (rx1 + rx2) / 2f; float centerY = -(ry1 + ry2) / 2f; - SlimDX.Matrix translationA = SlimDX.Matrix.Translation(-centerX, -centerY, 0); - SlimDX.Matrix rotationMat = SlimDX.Matrix.RotationZ(-rotation); - SlimDX.Matrix translationB = SlimDX.Matrix.Translation(centerX, centerY, 0); + Matrix translationA = Matrix.Translation(-centerX, -centerY, 0); + Matrix rotationMat = Matrix.RotationZ(-rotation); + Matrix translationB = Matrix.Translation(centerX, centerY, 0); //Multiplicate the matrices to get the real world matrix, //First shift the texture into the center //Rotate it and shift it back to the origin position //Apply the originTranslation after - SlimDX.Matrix result = translationA * rotationMat * translationB * originTranslation; + Matrix result = translationA * rotationMat * translationB * originTranslation; return result; } return originTranslation; } - #endregion utility - #region TexturedColoredVertex private struct STexturedColoredVertex { private static VertexDeclaration _Declaration; @@ -1380,7 +666,15 @@ namespace Vocaluxe.Lib.Draw return _Declaration; } + + public static void DisposeDeclaration() + { + if (_Declaration != null && !_Declaration.Disposed) + { + _Declaration.Dispose(); + _Declaration = null; + } + } } - #endregion TexturedColoredVertex } } \ No newline at end of file diff --git a/Vocaluxe/Lib/Draw/CDrawBase.cs b/Vocaluxe/Lib/Draw/CDrawBase.cs new file mode 100644 index 00000000..eb72ad6d --- /dev/null +++ b/Vocaluxe/Lib/Draw/CDrawBase.cs @@ -0,0 +1,388 @@ +#region license +// This file is part of Vocaluxe. +// +// Vocaluxe is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Vocaluxe is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with Vocaluxe. If not, see . +#endregion + +using System; +using System.Threading; +using Vocaluxe.Base; +using VocaluxeLib; +using VocaluxeLib.Draw; +using System.Diagnostics; + +namespace Vocaluxe.Lib.Draw +{ + /// + /// Base class for graphic drivers + /// A few notes: + /// Writes to textures (TTextureType) should only be done in the main thread + /// Writes to the RefCount of existing textures should only be done in the main thread and guarded by _Textures lock + /// + /// + abstract class CDrawBase : CTextureProvider where TTextureType : CTextureBase, IDisposable + { + protected bool _Fullscreen; + + protected bool _Run; + + protected readonly CKeys _Keys = new CKeys(); + protected readonly CMouse _Mouse = new CMouse(); + + protected int _H; + protected int _W; + protected int _Y; + protected int _X; + + protected int _BorderLeft; + protected int _BorderRight; + protected int _BorderTop; + protected int _BorderBottom; + protected EGeneralAlignment _CurrentAlignment = EGeneralAlignment.Middle; + + protected abstract void _ClearScreen(); + protected abstract void _AdjustNewBorders(); + protected abstract void _LeaveFullScreen(); + + protected abstract void _OnAfterDraw(); + + protected abstract void _OnBeforeDraw(); + + protected abstract void _DoResize(); + + protected abstract void _EnterFullScreen(); + + protected void _AdjustAspect(bool reverse) + { + if (_W / (float)_H > CSettings.GetRenderAspect()) + { + _Y = 0; + //The windows width is too big + int old = _W; + _W = (int)Math.Round(_H * CSettings.GetRenderAspect()); + int diff = old - _W; + switch (_CurrentAlignment) + { + case EGeneralAlignment.Start: + _X = 0; + break; + case EGeneralAlignment.Middle: + _X = diff / 2; + break; + case EGeneralAlignment.End: + _X = diff; + break; + } + } + else + { + _X = 0; + //The windows height is too big + int old = _H; + _H = (int)Math.Round(_W / CSettings.GetRenderAspect()); + int diff = old - _H; + switch (_CurrentAlignment) + { + case EGeneralAlignment.Start: + _Y = reverse ? diff : 0; + break; + case EGeneralAlignment.Middle: + _Y = diff / 2; + break; + case EGeneralAlignment.End: + _Y = reverse ? 0 : diff; + break; + } + } + } + + /// + /// Struct that contains texture and world coordinates for drawing + /// + protected struct SDrawCoords + { + /// + /// Texture coordinates + /// + public float Tx1, Tx2, Ty1, Ty2; + /// + /// World coordinates + /// + public float Wx1, Wx2, Wy1, Wy2, Wz; + public float Rotation; + } + + /// + /// Adds a texture to the vertext buffer + /// + /// Texture to draw + /// Coordinates to draw on + /// Color to use + /// If true, then color is faded out in y direction + protected abstract void _DrawTexture(TTextureType texture, SDrawCoords dc, SColorF color, bool isReflection = false); + + /// + /// Calculates the texture and world coordinates for drawing the texture in the rect cropping at the the bounds + /// + /// + /// Rect to draw the texture (might stretch the texture) + /// Rect to stay in (might crop the texture) + /// Struct for the coordinates + /// Mirror on y-axis + /// True if anything will be dawn + protected bool _CalcDrawCoords(TTextureType texture, SRectF rect, SRectF bounds, out SDrawCoords drawCoords, bool mirrored = false) + { + drawCoords = new SDrawCoords(); + if (Math.Abs(rect.W) < 1 || Math.Abs(rect.H) < 1 || Math.Abs(bounds.H) < 1 || Math.Abs(bounds.W) < 1) + return false; + + if (bounds.X >= rect.Right || bounds.Right <= rect.X) + return false; + + if (bounds.Y >= rect.Bottom || bounds.Bottom <= rect.Y) + return false; + + drawCoords.Tx1 = Math.Max(0, (bounds.X - rect.X) / rect.W * texture.WidthRatio); + drawCoords.Wx1 = Math.Max(rect.X, bounds.X); + drawCoords.Tx2 = Math.Min(1, (bounds.Right - rect.X) / rect.W) * texture.WidthRatio; + drawCoords.Wx2 = Math.Min(rect.Right, bounds.Right); + + drawCoords.Ty1 = Math.Max(0, (bounds.Y - rect.Y) / rect.H * texture.HeightRatio); + drawCoords.Wy1 = Math.Max(rect.Y, bounds.Y); + drawCoords.Ty2 = Math.Min(1, (bounds.Bottom - rect.Y) / rect.H) * texture.HeightRatio; + drawCoords.Wy2 = Math.Min(rect.Bottom, bounds.Bottom); + + if (mirrored) + { + float tmp = drawCoords.Ty1; + drawCoords.Ty1 = drawCoords.Ty2; + drawCoords.Ty2 = tmp; + } + + drawCoords.Wz = rect.Z + CGraphics.ZOffset; + drawCoords.Rotation = rect.Rotation; + + return true; + } + + /// + /// Calculates the texture and world coordinates for drawing (a part of) the texture in the rect + /// + /// Texture to draw + /// Rect to draw in (might stretch the texture) + /// Struct for the coordinates + /// Mirror on y axis + /// Position of the texture to begin drawing (0 <=x<=1) + /// Position of the texture to end drawing (0 <=x<=1) + /// True if anything will be dawn + protected bool _CalcDrawCoords(TTextureType texture, SRectF rect, out SDrawCoords drawCoords, bool mirrored = false, float begin = 0, float end = 1) + { + drawCoords = new SDrawCoords(); + if (Math.Abs(rect.W) < 1 || Math.Abs(rect.H) < 1) + return false; + if (begin >= 1 || begin >= end) + return false; + + Debug.Assert(begin.IsInRange(0, 1) && end.IsInRange(0, 1)); + + drawCoords.Tx1 = begin * texture.WidthRatio; + drawCoords.Wx1 = rect.X + begin * rect.W; + drawCoords.Tx2 = end * texture.WidthRatio; + drawCoords.Wx2 = rect.X + end * rect.W; + + drawCoords.Ty1 = 0; + drawCoords.Wy1 = rect.Y; + drawCoords.Ty2 = texture.HeightRatio; + drawCoords.Wy2 = rect.Bottom; + + if (mirrored) + { + float tmp = drawCoords.Ty1; + drawCoords.Ty1 = drawCoords.Ty2; + drawCoords.Ty2 = tmp; + } + + drawCoords.Wz = rect.Z + CGraphics.ZOffset; + drawCoords.Rotation = rect.Rotation; + + return true; + } + + public void DrawTexture(CTextureRef textureRef, SRectF rect, SColorF color, bool mirrored = false) + { + if (Math.Abs(color.A) < 0.01) + return; + SDrawCoords dc; + TTextureType texture; + if (!_GetTexture(textureRef, out texture)) + return; + if (!_CalcDrawCoords(texture, rect, out dc, mirrored)) + return; + + _DrawTexture(texture, dc, color); + } + + /// + /// Draws a texture + /// + /// The texture to be drawn + /// A SRectF struct containing the destination coordinates + /// A SColorF struct containing a color which the texture will be colored in + /// A SRectF struct containing which part of the texture should be drawn + /// True if the texture should be mirrored + public void DrawTexture(CTextureRef textureRef, SRectF rect, SColorF color, SRectF bounds, bool mirrored = false) + { + if (Math.Abs(color.A) < 0.01) + return; + SDrawCoords dc; + TTextureType texture; + if (!_GetTexture(textureRef, out texture)) + return; + if (!_CalcDrawCoords(texture, rect, bounds, out dc)) + return; + + _DrawTexture(texture, dc, color); + } + + /// + /// Draws a texture + /// + /// The texture to be drawn + /// A SRectF struct containing the destination coordinates + /// A SColorF struct containing a color which the texture will be colored in + /// A Value ranging from 0 to 1 containing the beginning of the texture + /// A Value ranging from 0 to 1 containing the ending of the texture + public void DrawTexture(CTextureRef textureRef, SRectF rect, SColorF color, float begin, float end) + { + if (Math.Abs(color.A) < 0.01) + return; + SDrawCoords dc; + TTextureType texture; + if (!_GetTexture(textureRef, out texture)) + return; + if (!_CalcDrawCoords(texture, rect, out dc, false, begin, end)) + return; + + _DrawTexture(texture, dc, color); + } + + /// + /// Draws a reflection of a texture + /// + /// The texture of which a reflection should be drawn + /// A SRectF struct containing the destination coordinates + /// A SColorF struct containing a color which the texture will be colored in + /// A SRectF struct containing which part of the texture should be drawn + /// The space between the texture and the reflection + /// The height of the reflection + public void DrawTextureReflection(CTextureRef textureRef, SRectF rect, SColorF color, SRectF bounds, float space, float height) + { + Debug.Assert(height >= 0); + + if (Math.Abs(color.A) < 0.01 || height < 1) + return; + SDrawCoords dc; + TTextureType texture; + if (!_GetTexture(textureRef, out texture)) + return; + if (!_CalcDrawCoords(texture, rect, bounds, out dc, true)) + return; + + if (height > rect.H) + height = rect.H; + + dc.Wy1 += rect.H + space; // Move from start of rect to end of rect with spacing + dc.Wy2 += space + height; // Move from end of rect + dc.Ty2 += (rect.H - height) / rect.H; // Adjust so not all of the start of the texture is drawn (mirrored--> Ty1>Ty2) + if (dc.Ty2 < dc.Ty1) // Make sure we actually draw something + _DrawTexture(texture, dc, color, true); + } + + // Resharper doesn't get that this is used -.- + // ReSharper disable UnusedMemberHiearchy.Global + /// + /// Starts the rendering + /// + public virtual void MainLoop() + { + // ReSharper restore UnusedMemberHiearchy.Global + _EnsureMainThread(); + _Run = true; + + _Fullscreen = false; + if (CConfig.Config.Graphics.FullScreen == EOffOn.TR_CONFIG_ON) + _EnterFullScreen(); + else + _DoResize(); //Resize window if aspect ratio is incorrect + + while (_Run) + { + _CheckQueue(); + + //We want to begin drawing + _OnBeforeDraw(); + + //Clear the previous Frame + _ClearScreen(); + if (!CGraphics.Draw()) + _Run = false; + _OnAfterDraw(); + + if (!CGraphics.UpdateGameLogic(_Keys, _Mouse)) + _Run = false; + + //Apply fullscreen mode + if ((CConfig.Config.Graphics.FullScreen == EOffOn.TR_CONFIG_ON) != _Fullscreen) + _ToggleFullScreen(); + + //Apply border changes + if (_BorderLeft != CConfig.Config.Graphics.BorderLeft || _BorderRight != CConfig.Config.Graphics.BorderRight || _BorderTop != CConfig.Config.Graphics.BorderTop || + _BorderBottom != CConfig.Config.Graphics.BorderBottom) + { + _BorderLeft = CConfig.Config.Graphics.BorderLeft; + _BorderRight = CConfig.Config.Graphics.BorderRight; + _BorderTop = CConfig.Config.Graphics.BorderTop; + _BorderBottom = CConfig.Config.Graphics.BorderBottom; + + _AdjustNewBorders(); + } + + if (_CurrentAlignment != CConfig.Config.Graphics.ScreenAlignment) + _DoResize(); + + if (CConfig.Config.Graphics.VSync == EOffOn.TR_CONFIG_OFF) + { + if (CTime.IsRunning()) + { + int delay = (int)Math.Floor(CConfig.CalcCycleTime() - CTime.GetMilliseconds()); + + if (delay >= 1 && delay < 500) + Thread.Sleep(delay); + } + } + //Calculate the FPS Rate and restart the timer after a frame + CTime.CalculateFPS(); + CTime.Restart(); + } + } + + private void _ToggleFullScreen() + { + if (!_Fullscreen) + _EnterFullScreen(); + else + _LeaveFullScreen(); + } + } +} \ No newline at end of file diff --git a/Vocaluxe/Lib/Draw/CDrawBaseWindows.cs b/Vocaluxe/Lib/Draw/CDrawBaseWindows.cs new file mode 100644 index 00000000..145ce1e7 --- /dev/null +++ b/Vocaluxe/Lib/Draw/CDrawBaseWindows.cs @@ -0,0 +1,215 @@ +#region license +// This file is part of Vocaluxe. +// +// Vocaluxe is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Vocaluxe is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with Vocaluxe. If not, see . +#endregion + +using System; +using System.ComponentModel; +using System.Diagnostics; +using System.Drawing; +using System.IO; +using System.Windows.Forms; +using Vocaluxe.Base; + +namespace Vocaluxe.Lib.Draw +{ + public delegate bool MessageEventHandler(ref Message m); + + public interface IFormHook + { + MessageEventHandler OnMessage { set; } + } + + abstract class CDrawBaseWindows : CDrawBase where TTextureType : CTextureBase, IDisposable + { + private struct SClientRect + { + public Point Location; + public int Width; + public int Height; + } + + protected Form _Form; + private SClientRect _Restore; + protected Size _SizeBeforeMinimize; + + public override void Close() + { + base.Close(); + try + { + _Form.Close(); + } + catch {} + } + + protected void _CenterToScreen() + { + Screen screen = Screen.FromControl(_Form); + _Form.Location = new Point((screen.WorkingArea.Width - _Form.Width) / 2, + (screen.WorkingArea.Height - _Form.Height) / 2); + } + + private static bool _OnMessageAvoidScreenOff(ref Message m) + { + switch (m.Msg) + { + case 0x112: // WM_SYSCOMMAND + switch ((int)m.WParam & 0xFFF0) + { + case 0xF100: // SC_KEYMENU + m.Result = IntPtr.Zero; + return false; + case 0xF140: // SC_SCREENSAVER + case 0xF170: // SC_MONITORPOWER + return false; + } + break; + } + return true; + } + + protected override void _EnterFullScreen() + { + Debug.Assert(!_Fullscreen); + _Fullscreen = true; + + _Restore.Location = _Form.Location; + _Restore.Width = _Form.Width; + _Restore.Height = _Form.Height; + + _Form.FormBorderStyle = FormBorderStyle.None; + + Screen screen = Screen.FromControl(_Form); + _Form.DesktopBounds = new Rectangle(screen.Bounds.Location, new Size(screen.Bounds.Width, screen.Bounds.Height)); + + if (_Form.WindowState == FormWindowState.Maximized) + { + _Form.WindowState = FormWindowState.Normal; + _DoResize(); + _Form.WindowState = FormWindowState.Maximized; + } + else + _DoResize(); + } + + protected override void _LeaveFullScreen() + { + Debug.Assert(_Fullscreen); + _Fullscreen = false; + + _Form.FormBorderStyle = FormBorderStyle.Sizable; + _Form.DesktopBounds = new Rectangle(_Restore.Location, new Size(_Restore.Width, _Restore.Height)); + } + + #region form event handlers + private void _OnClose(object sender, CancelEventArgs e) + { + _Run = false; + } + + private void _OnLoad(object sender, EventArgs e) + { + _ClearScreen(); + } + + protected virtual void _OnResize(object sender, EventArgs e) + { + _DoResize(); + } + + #region mouse event handlers + protected void _OnMouseMove(object sender, MouseEventArgs e) + { + _Mouse.MouseMove(e); + } + + protected void _OnMouseWheel(object sender, MouseEventArgs e) + { + _Mouse.MouseWheel(e); + } + + protected void _OnMouseDown(object sender, MouseEventArgs e) + { + _Mouse.MouseDown(e); + } + + protected void _OnMouseUp(object sender, MouseEventArgs e) + { + _Mouse.MouseUp(e); + } + + protected void _OnMouseLeave(object sender, EventArgs e) + { + _Mouse.Visible = false; + Cursor.Show(); + } + + protected void _OnMouseEnter(object sender, EventArgs e) + { + Cursor.Hide(); + _Mouse.Visible = true; + } + #endregion + + #region keyboard event handlers + protected void _OnPreviewKeyDown(object sender, PreviewKeyDownEventArgs e) + { + _OnKeyDown(sender, new KeyEventArgs(e.KeyData)); + } + + protected void _OnKeyDown(object sender, KeyEventArgs e) + { + _Keys.KeyDown(e); + } + + protected void _OnKeyPress(object sender, KeyPressEventArgs e) + { + _Keys.KeyPress(e); + } + + protected void _OnKeyUp(object sender, KeyEventArgs e) + { + _Keys.KeyUp(e); + } + #endregion keyboard event handlers + + #endregion + + public override bool Init() + { + if (!base.Init()) + return false; + _Form.Icon = new Icon(Path.Combine(CSettings.ProgramFolder, CSettings.FileNameIcon)); + _Form.Text = CSettings.GetFullVersionText(); + ((IFormHook)_Form).OnMessage = _OnMessageAvoidScreenOff; + _Form.Closing += _OnClose; + _Form.Resize += _OnResize; + _Form.Load += _OnLoad; + + _SizeBeforeMinimize = _Form.ClientSize; + _CenterToScreen(); + + return true; + } + + public override void MainLoop() + { + _Form.Show(); + base.MainLoop(); + _Form.Hide(); + } + } +} \ No newline at end of file diff --git a/Vocaluxe/Lib/Draw/CDrawWinForm.cs b/Vocaluxe/Lib/Draw/CDrawWinForm.cs index 08720117..6a1b94a7 100644 --- a/Vocaluxe/Lib/Draw/CDrawWinForm.cs +++ b/Vocaluxe/Lib/Draw/CDrawWinForm.cs @@ -44,7 +44,8 @@ namespace Vocaluxe.Lib.Draw private bool _TopMost; private Rectangle _Bounds; - private readonly Dictionary _Textures = new Dictionary(); + private readonly Dictionary _Textures = new Dictionary(); + private readonly Dictionary _TextureCache = new Dictionary(); private readonly List _Bitmaps = new List(); private readonly Color _ClearColor = Color.DarkBlue; @@ -64,7 +65,6 @@ namespace Vocaluxe.Lib.Draw _G = Graphics.FromImage(_Backbuffer); _G.Clear(Color.DarkBlue); - Paint += _OnPaintEvent; Closing += _OnClosingEvent; KeyDown += _OnKeyDownEvent; KeyPress += _OnKeyPressEvent; @@ -107,8 +107,6 @@ namespace Vocaluxe.Lib.Draw frontBuffer.DrawImage(_Backbuffer, new Rectangle(x, y, w, h), new Rectangle(0, 0, _Backbuffer.Width, _Backbuffer.Height), GraphicsUnit.Pixel); } - private void _OnPaintEvent(object sender, PaintEventArgs e) {} - #region FullScreenStuff private void _ToggleFullScreen() { @@ -225,7 +223,7 @@ namespace Vocaluxe.Lib.Draw int delay = 0; Show(); - if (CConfig.FullScreen == EOffOn.TR_CONFIG_ON) + if (CConfig.Config.Graphics.FullScreen == EOffOn.TR_CONFIG_ON) _Maximize(this); while (_Run) @@ -234,11 +232,12 @@ namespace Vocaluxe.Lib.Draw if (_Run) { + ClearScreen(); _Run = _Run && CGraphics.Draw(); _Run = CGraphics.UpdateGameLogic(_Keys, _Mouse); _FlipBuffer(); - if ((CConfig.FullScreen == EOffOn.TR_CONFIG_ON) != _Fullscreen) + if ((CConfig.Config.Graphics.FullScreen == EOffOn.TR_CONFIG_ON) != _Fullscreen) _ToggleFullScreen(); if (CTime.IsRunning()) @@ -254,11 +253,11 @@ namespace Vocaluxe.Lib.Draw Close(); } - public void Unload() + public new void Close() { try { - Close(); + base.Close(); } catch {} Dispose(); @@ -279,11 +278,11 @@ namespace Vocaluxe.Lib.Draw _G.Clear(_ClearColor); } - public CTexture CopyScreen() + public CTextureRef CopyScreen() { var bmp = new Bitmap(_Backbuffer); _Bitmaps.Add(bmp); - CTexture texture = _GetNewTexture(bmp.Width, bmp.Height); + CTextureRef texture = _GetNewTexture(bmp.GetSize()); // Add to Texture List _Textures[texture.ID] = texture; @@ -291,9 +290,9 @@ namespace Vocaluxe.Lib.Draw return texture; } - public void CopyScreen(ref CTexture texture) + public void CopyScreen(ref CTextureRef texture) { - if (!_TextureExists(texture) || texture.W2 != GetScreenWidth() || texture.H2 != GetScreenHeight()) + if (!_TextureExists(texture) || texture.OrigSize.Width != GetScreenWidth() || texture.OrigSize.Height != GetScreenHeight()) { RemoveTexture(ref texture); texture = CopyScreen(); @@ -309,20 +308,15 @@ namespace Vocaluxe.Lib.Draw _Backbuffer.Save(file, ImageFormat.Png); } - public void DrawLine(int a, int r, int g, int b, int w, int x1, int y1, int x2, int y2) - { - _G.DrawLine(new Pen(Color.FromArgb(a, r, g, b), w), new Point(x1, y1), new Point(x2, y2)); - } + public void DrawRect(SColorF color, SRectF rect) {} - public void DrawColor(SColorF color, SRectF rect) {} + public void DrawRectReflection(SColorF color, SRectF rect, float space, float height) {} - public void DrawColorReflection(SColorF color, SRectF rect, float space, float height) {} - - public CTexture AddTexture(Bitmap bmp) + public CTextureRef AddTexture(Bitmap bmp) { var bmp2 = new Bitmap(bmp); _Bitmaps.Add(bmp2); - CTexture texture = _GetNewTexture(bmp.Width, bmp.Height); + CTextureRef texture = _GetNewTexture(bmp.GetSize()); // Add to Texture List _Textures[texture.ID] = texture; @@ -330,62 +324,84 @@ namespace Vocaluxe.Lib.Draw return texture; } - private CTexture _GetNewTexture(int w, int h) + private CTextureRef _GetNewTexture(Size size) { - return new CTexture(w, h) {ID = _Bitmaps.Count - 1}; + return new CTextureRef(_Bitmaps.Count - 1, size); } - public CTexture AddTexture(string texturePath) + public CTextureRef AddTexture(string texturePath) { if (File.Exists(texturePath)) { - foreach (CTexture tex in _Textures.Values) - { - if (tex.TexturePath == texturePath) - return tex; - } + CTextureRef texture; + if (_TextureCache.TryGetValue(texturePath, out texture)) + return texture; using (var bmp = new Bitmap(texturePath)) { - CTexture texture = AddTexture(bmp); - texture.TexturePath = texturePath; + texture = AddTexture(bmp); + _TextureCache.Add(texturePath, texture); } + return texture; } return null; } - private bool _TextureExists(CTexture texture) + private bool _TextureExists(CTextureRef texture) { return texture != null && _Textures.ContainsKey(texture.ID); } - public void RemoveTexture(ref CTexture texture) + public CTextureRef CopyTexture(CTextureRef textureRef) + { + if (_TextureExists(textureRef)) + return AddTexture(_Bitmaps[textureRef.ID]); + return null; + } + + public void RemoveTexture(ref CTextureRef texture) { if (_TextureExists(texture)) { _Bitmaps[texture.ID].Dispose(); _Textures.Remove(texture.ID); + texture.SetRemoved(); } texture = null; } - public CTexture EnqueueTexture(int w, int h, byte[] data) + public CTextureRef EnqueueTexture(int w, int h, byte[] data) { return AddTexture(w, h, data); } - public CTexture AddTexture(int w, int h, byte[] data) + public CTextureRef EnqueueTexture(string texturePath) + { + return AddTexture(texturePath); + } + + public CTextureRef EnqueueTexture(Bitmap bmp) + { + return AddTexture(bmp); + } + + public void EnqueueTextureUpdate(CTextureRef textureRef, Bitmap bmp) + { + UpdateTexture(textureRef, bmp); + } + + public CTextureRef AddTexture(int w, int h, byte[] data) { using (var bmp = new Bitmap(w, h)) { - BitmapData bmpData = bmp.LockBits(new Rectangle(0, 0, bmp.Width, bmp.Height), ImageLockMode.ReadWrite, PixelFormat.Format32bppArgb); + BitmapData bmpData = bmp.LockBits(bmp.GetRect(), ImageLockMode.ReadWrite, PixelFormat.Format32bppArgb); Marshal.Copy(data, 0, bmpData.Scan0, data.Length); bmp.UnlockBits(bmpData); return AddTexture(bmp); } } - public bool UpdateTexture(CTexture texture, int w, int h, byte[] data) + public void UpdateTexture(CTextureRef texture, int w, int h, byte[] data) { if (_TextureExists(texture)) { @@ -393,40 +409,22 @@ namespace Vocaluxe.Lib.Draw ImageLockMode.ReadWrite, PixelFormat.Format32bppArgb); Marshal.Copy(data, 0, bmpData.Scan0, data.Length); _Bitmaps[texture.ID].UnlockBits(bmpData); - return true; } - return false; } - public bool UpdateOrAddTexture(ref CTexture texture, int w, int h, byte[] data) + public void UpdateTexture(CTextureRef textureRef, Bitmap bmp) { - if (!UpdateTexture(texture, w, h, data)) - { - RemoveTexture(ref texture); - texture = AddTexture(w, h, data); - } - return true; + if (_TextureExists(textureRef)) + _Bitmaps[textureRef.ID] = bmp; } - public void DrawTexture(CTexture texture) - { - if (texture != null) - DrawTexture(texture, texture.Rect, texture.Color); - } - - public void DrawTexture(CTexture texture, SRectF rect) - { - if (texture != null) - DrawTexture(texture, rect, texture.Color); - } - - public void DrawTexture(CTexture texture, SRectF rect, SColorF color, bool mirrored = false) + public void DrawTexture(CTextureRef texture, SRectF rect, SColorF color, bool mirrored = false) { if (texture != null) DrawTexture(texture, rect, color, rect, mirrored); } - public void DrawTexture(CTexture texture, SRectF rect, SColorF color, SRectF bounds, bool mirrored = false) + public void DrawTexture(CTextureRef texture, SRectF rect, SColorF color, SRectF bounds, bool mirrored = false) { if (!_TextureExists(texture)) return; @@ -435,9 +433,9 @@ namespace Vocaluxe.Lib.Draw coloredBitmap.Dispose(); } - public void DrawTexture(CTexture texture, SRectF rect, SColorF color, float begin, float end) {} + public void DrawTexture(CTextureRef texture, SRectF rect, SColorF color, float begin, float end) {} - public void DrawTextureReflection(CTexture texture, SRectF rect, SColorF color, SRectF bounds, float space, float height) {} + public void DrawTextureReflection(CTextureRef texture, SRectF rect, SColorF color, SRectF bounds, float space, float height) {} public int GetTextureCount() { diff --git a/Vocaluxe/Lib/Draw/COpenGL.cs b/Vocaluxe/Lib/Draw/COpenGL.cs index 43ba70c2..261dd4f5 100644 --- a/Vocaluxe/Lib/Draw/COpenGL.cs +++ b/Vocaluxe/Lib/Draw/COpenGL.cs @@ -15,17 +15,13 @@ // along with Vocaluxe. If not, see . #endregion -using System.Drawing.Drawing2D; +using System.Diagnostics; using System.Drawing.Imaging; -using System.Threading; using OpenTK; using OpenTK.Graphics; using System; -using System.Collections.Generic; -using System.ComponentModel; using System.Drawing; using System.IO; -using System.Runtime.InteropServices; using System.Windows.Forms; using Vocaluxe.Base; using VocaluxeLib; @@ -33,15 +29,11 @@ using VocaluxeLib.Draw; using BeginMode = OpenTK.Graphics.OpenGL.BeginMode; using BlendingFactorDest = OpenTK.Graphics.OpenGL.BlendingFactorDest; using BlendingFactorSrc = OpenTK.Graphics.OpenGL.BlendingFactorSrc; -using BufferAccess = OpenTK.Graphics.OpenGL.BufferAccess; -using BufferTarget = OpenTK.Graphics.OpenGL.BufferTarget; -using BufferUsageHint = OpenTK.Graphics.OpenGL.BufferUsageHint; using ClearBufferMask = OpenTK.Graphics.OpenGL.ClearBufferMask; using DepthFunction = OpenTK.Graphics.OpenGL.DepthFunction; using EnableCap = OpenTK.Graphics.OpenGL.EnableCap; using GL = OpenTK.Graphics.OpenGL.GL; using GenerateMipmapTarget = OpenTK.Graphics.OpenGL.GenerateMipmapTarget; -using KeyPressEventArgs = System.Windows.Forms.KeyPressEventArgs; using MatrixMode = OpenTK.Graphics.OpenGL.MatrixMode; using PixelFormat = OpenTK.Graphics.OpenGL.PixelFormat; using PixelInternalFormat = OpenTK.Graphics.OpenGL.PixelInternalFormat; @@ -54,75 +46,69 @@ using TextureTarget = OpenTK.Graphics.OpenGL.TextureTarget; namespace Vocaluxe.Lib.Draw { - struct SClientRect + class CFormHook : Form, IFormHook { - public Point Location; - public int Width; - public int Height; - }; + public MessageEventHandler OnMessage { private get; set; } - struct STextureQueue - { - public readonly int ID; - public readonly int TextureWidth; - public readonly int TextureHeight; - public readonly int DataWidth; - public readonly int DataHeight; - public readonly byte[] Data; - - public STextureQueue(int id, int textureWidth, int textureHeight, int dataWidth, int dataHeight, byte[] data) + protected override void WndProc(ref Message m) { - ID = id; - TextureWidth = textureWidth; - TextureHeight = textureHeight; - DataWidth = dataWidth; - DataHeight = dataHeight; - Data = data; + if (OnMessage == null || OnMessage(ref m)) + base.WndProc(ref m); } } - class COpenGL : Form, IDraw + class COGLTexture : CTextureBase { - #region private vars - private const int _MaxID = 100000; + //The texture "name" according to the specs + public readonly int Name; - private readonly CKeys _Keys; - private readonly CMouse _Mouse; - private bool _Run; + public COGLTexture(int name, Size dataSize, int texWidth = 0, int texHeight = 0) : base(dataSize, new Size(texWidth, texHeight)) + { + Name = name; + if (name == 0) + return; + GL.BindTexture(TextureTarget.Texture2D, Name); + GL.TexImage2D(TextureTarget.Texture2D, 0, PixelInternalFormat.Rgba, texWidth, texHeight, 0, PixelFormat.Bgra, PixelType.UnsignedByte, IntPtr.Zero); + + GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureWrapS, (int)TextureWrapMode.ClampToEdge); + GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureWrapT, (int)TextureWrapMode.ClampToEdge); + GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureMagFilter, (int)TextureMagFilter.Linear); + GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureMinFilter, (int)TextureMinFilter.LinearMipmapLinear); + + GL.BindTexture(TextureTarget.Texture2D, 0); + } + + public override bool IsLoaded + { + get { return Name != 0; } + } + + public override void Dispose() + { + base.Dispose(); + if (Name != 0) + GL.DeleteTexture(Name); + } + } + + class COpenGL : CDrawBaseWindows, IDraw + { private readonly GLControl _Control; - - private SClientRect _Restore; - private bool _Fullscreen; - - private readonly Dictionary _Textures = new Dictionary(); - private readonly Queue _IDs = new Queue(_MaxID); - private readonly Queue _TexturesToLoad = new Queue(); - - private readonly Object _MutexTexture = new Object(); - - private int _H = 1; - private int _W = 1; - private int _Y; - private int _X; - - private bool _UsePBO; - #endregion private vars + private int _FBO; public COpenGL() { - Icon = new Icon(Path.Combine(CSettings.ProgramFolder, CSettings.FileNameIcon)); - - for (int i = 1; i < _MaxID; i++) - _IDs.Enqueue(i); + _Form = new CFormHook {ClientSize = new Size(CConfig.Config.Graphics.ScreenW, CConfig.Config.Graphics.ScreenH)}; + //OpenGL needs that here but D3D needs it in the constructor, so do NOT unify! //Check AA Mode - CConfig.AAMode = (EAntiAliasingModes)_CheckAntiAliasingMode((int)CConfig.AAMode); + CConfig.Config.Graphics.AAMode = (EAntiAliasingModes)_CheckAntiAliasingMode((int)CConfig.Config.Graphics.AAMode); bool ok = false; try { - var gm = new GraphicsMode(32, 24, 0, (int)CConfig.AAMode); + var gm = new GraphicsMode(32, 24, 0, (int)CConfig.Config.Graphics.AAMode); _Control = new GLControl(gm, 2, 1, GraphicsContextFlags.Default); if (_Control.GraphicsMode != null) ok = true; @@ -136,22 +122,16 @@ namespace Vocaluxe.Lib.Draw _Control = new GLControl(); _Control.MakeCurrent(); - _Control.VSync = CConfig.VSync == EOffOn.TR_CONFIG_ON; + _Control.VSync = CConfig.Config.Graphics.VSync == EOffOn.TR_CONFIG_ON; - Controls.Add(_Control); + _Form.Controls.Add(_Control); + _Control.ClientSize = _Form.ClientSize; + _Control.KeyDown += _OnKeyDown; + _Control.PreviewKeyDown += _OnPreviewKeyDown; + _Control.KeyPress += _OnKeyPress; + _Control.KeyUp += _OnKeyUp; - _Keys = new CKeys(); - Paint += _OnPaintEvent; - Closing += _OnClosingEvent; - Resize += _OnResizeEvent; - - _Control.KeyDown += _OnKeyDownEvent; - _Control.PreviewKeyDown += _OnPreviewKeyDownEvent; - _Control.KeyPress += _OnKeyPressEvent; - _Control.KeyUp += _OnKeyUpEvent; - - _Mouse = new CMouse(); _Control.MouseMove += _OnMouseMove; _Control.MouseWheel += _OnMouseWheel; _Control.MouseDown += _OnMouseDown; @@ -159,12 +139,10 @@ namespace Vocaluxe.Lib.Draw _Control.MouseLeave += _OnMouseLeave; _Control.MouseEnter += _OnMouseEnter; - ClientSize = new Size(CConfig.ScreenW, CConfig.ScreenH); - CenterToScreen(); + _NonPowerOf2TextureSupported = false; } - #region Helpers - private int _CheckAntiAliasingMode(int setValue) + private static int _CheckAntiAliasingMode(int setValue) { int samples = 0; @@ -224,188 +202,27 @@ namespace Vocaluxe.Lib.Draw } */ - private void _ToggleFullScreen() + protected override void _OnResize(object sender, EventArgs e) { - if (!_Fullscreen) - _EnterFullScreen(); - else - _LeaveFullScreen(); + _Control.ClientSize = _Form.ClientSize; + base._OnResize(sender, e); } - private void _EnterFullScreen() - { - _Fullscreen = true; - - _Restore.Location = Location; - _Restore.Width = Width; - _Restore.Height = Height; - - FormBorderStyle = FormBorderStyle.None; - - int screenNr = 0; - for (int i = 0; i < Screen.AllScreens.Length; i++) - { - Screen scr = Screen.AllScreens[i]; - if (scr.Bounds.Top <= Top && scr.Bounds.Left <= Left) - screenNr = i; - } - - DesktopBounds = new Rectangle(Screen.AllScreens[screenNr].Bounds.Location, new Size(Screen.AllScreens[screenNr].Bounds.Width, Screen.AllScreens[screenNr].Bounds.Height)); - - if (WindowState == FormWindowState.Maximized) - { - WindowState = FormWindowState.Normal; - _DoResize(); - WindowState = FormWindowState.Maximized; - } - else - _DoResize(); - } - - private void _LeaveFullScreen() - { - _Fullscreen = false; - - FormBorderStyle = FormBorderStyle.Sizable; - DesktopBounds = new Rectangle(_Restore.Location, new Size(_Restore.Width, _Restore.Height)); - } - #endregion Helpers - - #region form events - private void _OnPaintEvent(object sender, PaintEventArgs e) {} - - private void _OnResizeEvent(object sender, EventArgs e) {} - - private void _OnClosingEvent(object sender, CancelEventArgs e) - { - _Run = false; - } - - protected override void OnLoad(EventArgs e) - { - GL.ClearColor(Color.Black); - } - - protected override void OnResize(EventArgs e) - { - base.OnResize(e); - - _Control.ClientSize = ClientSize; - _DoResize(); - } - - protected override void WndProc(ref Message m) - { - switch (m.Msg) - { - case 0x112: // WM_SYSCOMMAND - switch ((int)m.WParam & 0xFFF0) - { - case 0xF100: // SC_KEYMENU - m.Result = IntPtr.Zero; - break; - case 0xF140: // SC_SCREENSAVER - case 0xF170: // SC_MONITORPOWER - break; - default: - base.WndProc(ref m); - break; - } - break; - default: - base.WndProc(ref m); - break; - } - } - #endregion form events - - #region mouse event handlers - private void _OnMouseMove(object sender, MouseEventArgs e) - { - _Mouse.MouseMove(e); - } - - private void _OnMouseWheel(object sender, MouseEventArgs e) - { - _Mouse.MouseWheel(e); - } - - private void _OnMouseDown(object sender, MouseEventArgs e) - { - _Mouse.MouseDown(e); - } - - private void _OnMouseUp(object sender, MouseEventArgs e) - { - _Mouse.MouseUp(e); - } - - private void _OnMouseLeave(object sender, EventArgs e) - { - _Mouse.Visible = false; - Cursor.Show(); - } - - private void _OnMouseEnter(object sender, EventArgs e) - { - Cursor.Hide(); - _Mouse.Visible = true; - } - #endregion - - #region keyboard event handlers - private void _OnPreviewKeyDownEvent(object sender, PreviewKeyDownEventArgs e) - { - _OnKeyDownEvent(sender, new KeyEventArgs(e.KeyData)); - } - - private void _OnKeyDownEvent(object sender, KeyEventArgs e) - { - _Keys.KeyDown(e); - } - - private void _OnKeyPressEvent(object sender, KeyPressEventArgs e) - { - _Keys.KeyPress(e); - } - - private void _OnKeyUpEvent(object sender, KeyEventArgs e) - { - _Keys.KeyUp(e); - } - #endregion keyboard event handlers - - private void _DoResize() + protected override void _DoResize() { _H = _Control.Height; _W = _Control.Width; - _Y = 0; - _X = 0; + _CurrentAlignment = CConfig.Config.Graphics.ScreenAlignment; - - if (_W / (float)_H > CSettings.GetRenderAspect()) - { - _W = (int)Math.Round(_H * CSettings.GetRenderAspect()); - _X = (_Control.Width - _W) / 2; - } - else - { - _H = (int)Math.Round(_W / CSettings.GetRenderAspect()); - _Y = (_Control.Height - _H) / 2; - } - - GL.MatrixMode(MatrixMode.Projection); - GL.LoadIdentity(); - GL.Ortho(0, CSettings.RenderW, CSettings.RenderH, 0, CSettings.ZNear, CSettings.ZFar); + _AdjustAspect(true); + _AdjustNewBorders(); GL.Viewport(_X, _Y, _W, _H); } - #region implementation - - #region main stuff - public bool Init() + public override bool Init() { - Text = CSettings.GetFullVersionText(); + if (!base.Init()) + return false; // Init Texturing GL.Enable(EnableCap.Texture2D); @@ -416,59 +233,28 @@ namespace Vocaluxe.Lib.Draw GL.DepthRange(CSettings.ZFar, CSettings.ZNear); GL.DepthFunc(DepthFunction.Lequal); GL.Enable(EnableCap.DepthTest); + GL.ClearColor(Color.Black); + + GL.GenFramebuffers(1, out _FBO); return true; } - public void MainLoop() + public override void Close() { - _Run = true; - int delay = 0; - Show(); - - if (CConfig.FullScreen == EOffOn.TR_CONFIG_ON) - _EnterFullScreen(); - - while (_Run) - { - ClearScreen(); - if (!CGraphics.Draw()) - _Run = false; - if (!CGraphics.UpdateGameLogic(_Keys, _Mouse)) - _Run = false; - - _Control.SwapBuffers(); - - if ((CConfig.FullScreen == EOffOn.TR_CONFIG_ON) != _Fullscreen) - _ToggleFullScreen(); - - _CheckQueue(); - - if (CTime.IsRunning()) - delay = (int)Math.Floor(CConfig.CalcCycleTime() - CTime.GetMilliseconds()); - - if (delay >= 1 && CConfig.VSync == EOffOn.TR_CONFIG_OFF) - Thread.Sleep(delay); - - CTime.CalculateFPS(); - CTime.Restart(); - - Application.DoEvents(); - } - Close(); + base.Close(); + GL.DeleteFramebuffers(1, ref _FBO); } - public void Unload() + protected override void _OnBeforeDraw() { - try - { - Close(); - } - catch {} - var textures = new CTexture[_Textures.Count]; - _Textures.Values.CopyTo(textures, 0); - for (int i = 0; i < _Textures.Count; i++) - RemoveTexture(ref textures[i]); + //Nothing to do + } + + protected override void _OnAfterDraw() + { + _Control.SwapBuffers(); + Application.DoEvents(); } public int GetScreenWidth() @@ -480,56 +266,18 @@ namespace Vocaluxe.Lib.Draw { return _Control.Height; } - #endregion main stuff - #region Basic Draw Methods - public void ClearScreen() + protected override void _ClearScreen() { GL.Clear(ClearBufferMask.ColorBufferBit | ClearBufferMask.DepthBufferBit); } - public CTexture CopyScreen() + protected override void _AdjustNewBorders() { - CTexture texture = _GetNewTexture(_W, _H); - - texture.Name = GL.GenTexture(); - GL.BindTexture(TextureTarget.Texture2D, texture.Name); - - GL.TexImage2D(TextureTarget.Texture2D, 0, PixelInternalFormat.Rgba, texture.W2, texture.H2, 0, PixelFormat.Bgra, PixelType.UnsignedByte, IntPtr.Zero); - GL.CopyTexSubImage2D(TextureTarget.Texture2D, 0, 0, 0, _X, _Y, _W, _H); - - GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureMagFilter, (int)TextureMagFilter.Linear); - GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureMinFilter, (int)TextureMinFilter.Linear); - - GL.BindTexture(TextureTarget.Texture2D, 0); - - // Add to Texture List - - lock (_MutexTexture) - { - texture.ID = _IDs.Dequeue(); - _Textures[texture.ID] = texture; - } - - return texture; - } - - public void CopyScreen(ref CTexture texture) - { - //Check for actual texture sizes as it may be downsized compared to OrigSize - if (!_TextureExists(texture) || texture.UsedWidth != GetScreenWidth() || texture.UsedHeight != GetScreenHeight()) - { - RemoveTexture(ref texture); - texture = CopyScreen(); - } - else - { - GL.BindTexture(TextureTarget.Texture2D, texture.Name); - - GL.CopyTexSubImage2D(TextureTarget.Texture2D, 0, 0, 0, 0, 0, GetScreenWidth(), GetScreenHeight()); - - GL.BindTexture(TextureTarget.Texture2D, 0); - } + GL.MatrixMode(MatrixMode.Projection); + GL.LoadIdentity(); + GL.Ortho(-CConfig.Config.Graphics.BorderLeft, CConfig.Config.Graphics.BorderRight + CSettings.RenderW, CConfig.Config.Graphics.BorderBottom + CSettings.RenderH, + -CConfig.Config.Graphics.BorderTop, CSettings.ZNear, CSettings.ZFar); } public void MakeScreenShot() @@ -551,35 +299,60 @@ namespace Vocaluxe.Lib.Draw } } - public void DrawLine(int a, int r, int g, int b, int w, int x1, int y1, int x2, int y2) + public CTextureRef CopyScreen() { - GL.Enable(EnableCap.Blend); - GL.Color4(r, g, b, a * CGraphics.GlobalAlpha); + //TODO: Check if _W,_H needs to be used or not + Size size = new Size(GetScreenWidth(), GetScreenHeight()); + COGLTexture texture = _CreateTexture(size); - GL.Begin(BeginMode.Lines); - GL.Vertex3(x1, y1, CGraphics.ZOffset); - GL.Vertex3(x2, y2, CGraphics.ZOffset); - GL.End(); + GL.BindTexture(TextureTarget.Texture2D, texture.Name); + GL.CopyTexSubImage2D(TextureTarget.Texture2D, 0, 0, 0, 0, 0, size.Width, size.Height); //TODO: Use _X,_Y and _W,_H? + GL.BindTexture(TextureTarget.Texture2D, 0); - GL.Disable(EnableCap.Blend); + return _GetTextureReference(size, texture); } - public void DrawColor(SColorF color, SRectF rect) + public void CopyScreen(ref CTextureRef textureRef) + { + COGLTexture texture; + //Check for actual texture sizes as it may be downsized compared to OrigSize + if (!_GetTexture(textureRef, out texture) || texture.DataSize.Width != GetScreenWidth() || texture.DataSize.Height != GetScreenHeight()) + { + RemoveTexture(ref textureRef); + textureRef = CopyScreen(); + } + else + { + GL.BindTexture(TextureTarget.Texture2D, texture.Name); + GL.CopyTexSubImage2D(TextureTarget.Texture2D, 0, 0, 0, 0, 0, GetScreenWidth(), GetScreenHeight()); + GL.BindTexture(TextureTarget.Texture2D, 0); + } + } + + public void DrawRect(SColorF color, SRectF rect) { GL.Enable(EnableCap.Blend); GL.Color4(color.R, color.G, color.B, color.A * CGraphics.GlobalAlpha); GL.Begin(BeginMode.Quads); + GL.MatrixMode(MatrixMode.Color); + GL.PushMatrix(); + if (Math.Abs(rect.Rotation) > 0.001) + { + GL.Translate(0.5f, 0.5f, 0); + GL.Rotate(-rect.Rotation, 0f, 0f, 1f); + GL.Translate(-0.5f, -0.5f, 0); + } GL.Vertex3(rect.X, rect.Y, rect.Z + CGraphics.ZOffset); GL.Vertex3(rect.X, rect.Y + rect.H, rect.Z + CGraphics.ZOffset); GL.Vertex3(rect.X + rect.W, rect.Y + rect.H, rect.Z + CGraphics.ZOffset); GL.Vertex3(rect.X + rect.W, rect.Y, rect.Z + CGraphics.ZOffset); GL.End(); - + GL.PopMatrix(); GL.Disable(EnableCap.Blend); } - public void DrawColorReflection(SColorF color, SRectF rect, float space, float height) + public void DrawRectReflection(SColorF color, SRectF rect, float space, float height) { if (rect.H < height) height = rect.H; @@ -603,7 +376,8 @@ namespace Vocaluxe.Lib.Draw GL.Enable(EnableCap.Blend); - + GL.MatrixMode(MatrixMode.Color); + GL.PushMatrix(); if (Math.Abs(rect.Rotation) > 0.001) { GL.Translate(0.5f, 0.5f, 0); @@ -618,557 +392,109 @@ namespace Vocaluxe.Lib.Draw GL.Color4(color.R, color.G, color.B, 0f); GL.Vertex3(rx2, ry2, rect.Z + CGraphics.ZOffset); - - GL.Color4(color.R, color.G, color.B, 0f); GL.Vertex3(rx1, ry2, rect.Z + CGraphics.ZOffset); GL.Color4(color.R, color.G, color.B, color.A * CGraphics.GlobalAlpha); GL.Vertex3(rx1, ry1, rect.Z + CGraphics.ZOffset); GL.End(); - - GL.Disable(EnableCap.Blend); - } - #endregion Basic Draw Methods - - #region Textures - - #region adding - public CTexture AddTexture(string texturePath) - { - if (!File.Exists(texturePath)) - { - CLog.LogError("Can't find File: " + texturePath); - return null; - } - Bitmap bmp; - try - { - bmp = new Bitmap(texturePath); - } - catch (Exception) - { - CLog.LogError("Error loading Texture: " + texturePath); - return null; - } - try - { - return AddTexture(bmp); - } - finally - { - bmp.Dispose(); - } - } - - public CTexture AddTexture(Bitmap bmp) - { - if (bmp.Height == 0 || bmp.Width == 0) - return null; - - int maxSize; - switch (CConfig.TextureQuality) - { - case ETextureQuality.TR_CONFIG_TEXTURE_LOWEST: - maxSize = 128; - break; - case ETextureQuality.TR_CONFIG_TEXTURE_LOW: - maxSize = 256; - break; - case ETextureQuality.TR_CONFIG_TEXTURE_MEDIUM: - maxSize = 512; - break; - case ETextureQuality.TR_CONFIG_TEXTURE_HIGH: - maxSize = 1024; - break; - case ETextureQuality.TR_CONFIG_TEXTURE_HIGHEST: - maxSize = 2048; - break; - default: - maxSize = 512; - break; - } - - int w = Math.Min(bmp.Width, maxSize); - int h = Math.Min(bmp.Height, maxSize); - w = MathHelper.NextPowerOfTwo(w); - h = MathHelper.NextPowerOfTwo(h); - - var texture = new CTexture(bmp.Width, bmp.Height, w, h, true) {Name = GL.GenTexture()}; - - GL.BindTexture(TextureTarget.Texture2D, texture.Name); - Bitmap bmp2 = null; - try - { - if (bmp.Width != w || bmp.Height != h) - { - //Create a new Bitmap with the new sizes - bmp2 = new Bitmap(w, h); - //Scale the texture - using (Graphics g = Graphics.FromImage(bmp2)) - { - g.InterpolationMode = InterpolationMode.HighQualityBicubic; - g.SmoothingMode = SmoothingMode.HighQuality; - g.DrawImage(bmp, new Rectangle(0, 0, bmp2.Width, bmp2.Height)); - } - bmp = bmp2; - } - - BitmapData bmpData = bmp.LockBits(new Rectangle(0, 0, bmp.Width, bmp.Height), ImageLockMode.ReadOnly, System.Drawing.Imaging.PixelFormat.Format32bppArgb); - GL.TexImage2D(TextureTarget.Texture2D, 0, PixelInternalFormat.Rgba, texture.W2, texture.H2, 0, PixelFormat.Bgra, PixelType.UnsignedByte, IntPtr.Zero); - GL.TexSubImage2D(TextureTarget.Texture2D, 0, 0, 0, bmpData.Width, bmpData.Height, PixelFormat.Bgra, PixelType.UnsignedByte, bmpData.Scan0); - bmp.UnlockBits(bmpData); - } - finally - { - if (bmp2 != null) - bmp2.Dispose(); - } - - GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureWrapS, (int)TextureParameterName.ClampToEdge); - GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureWrapT, (int)TextureParameterName.ClampToEdge); - - GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureMagFilter, (int)TextureMagFilter.Linear); - GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureMinFilter, (int)TextureMinFilter.LinearMipmapLinear); - GL.Ext.GenerateMipmap(GenerateMipmapTarget.Texture2D); - - GL.BindTexture(TextureTarget.Texture2D, 0); - // Add to Texture List - texture.TexturePath = String.Empty; - - lock (_MutexTexture) - { - texture.ID = _IDs.Dequeue(); - _Textures[texture.ID] = texture; - } - - return texture; - } - - public CTexture AddTexture(int w, int h, byte[] data) - { - CTexture texture = _GetNewTexture(w, h); - - _CreateTexture(texture, w, h, data); - - lock (_MutexTexture) - { - texture.ID = _IDs.Dequeue(); - _Textures[texture.ID] = texture; - } - - return texture; - } - - private void _CreateTexture(CTexture texture, int w, int h, byte[] data) - { - if (_UsePBO) - { - try - { - GL.GenBuffers(1, out texture.PBO); - GL.BindBuffer(BufferTarget.PixelUnpackBuffer, texture.PBO); - GL.BufferData(BufferTarget.PixelUnpackBuffer, (IntPtr)data.Length, IntPtr.Zero, BufferUsageHint.StreamDraw); - GL.BindBuffer(BufferTarget.PixelUnpackBuffer, 0); - } - catch (Exception) - { - //throw; - _UsePBO = false; - } - } - - texture.Name = GL.GenTexture(); - GL.BindTexture(TextureTarget.Texture2D, texture.Name); - - GL.TexImage2D(TextureTarget.Texture2D, 0, PixelInternalFormat.Rgba, texture.W2, texture.H2, 0, PixelFormat.Bgra, PixelType.UnsignedByte, IntPtr.Zero); - GL.TexSubImage2D(TextureTarget.Texture2D, 0, 0, 0, w, h, PixelFormat.Bgra, PixelType.UnsignedByte, data); - - GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureWrapS, (int)TextureParameterName.ClampToEdge); - GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureWrapT, (int)TextureParameterName.ClampToEdge); - GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureMagFilter, (int)TextureMagFilter.Linear); - GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureMinFilter, (int)TextureMinFilter.LinearMipmapLinear); - GL.Ext.GenerateMipmap(GenerateMipmapTarget.Texture2D); - - GL.BindTexture(TextureTarget.Texture2D, 0); - } - - public CTexture EnqueueTexture(int w, int h, byte[] data) - { - CTexture texture = _GetNewTexture(w, h); - - lock (_MutexTexture) - { - texture.ID = _IDs.Dequeue(); - var queue = new STextureQueue(texture.ID, texture.W2, texture.H2, w, h, data); - _TexturesToLoad.Enqueue(queue); - _Textures[texture.ID] = texture; - } - - return texture; - } - - private static CTexture _GetNewTexture(int w, int h) - { - return new CTexture(w, h, MathHelper.NextPowerOfTwo(w), MathHelper.NextPowerOfTwo(h)); - } - #endregion adding - - #region updating - public bool UpdateTexture(CTexture texture, int w, int h, byte[] data) - { - //Check if texture exists and extend matches - if (!_TextureExists(texture) || texture.UsedWidth != w || texture.UsedHeight != h) - return false; - if (_UsePBO) - { - GL.BindBuffer(BufferTarget.PixelUnpackBuffer, texture.PBO); - - IntPtr buffer = GL.MapBuffer(BufferTarget.PixelUnpackBuffer, BufferAccess.WriteOnly); - Marshal.Copy(data, 0, buffer, data.Length); - - GL.UnmapBuffer(BufferTarget.PixelUnpackBuffer); - - GL.BindTexture(TextureTarget.Texture2D, texture.Name); - - GL.TexSubImage2D(TextureTarget.Texture2D, 0, 0, 0, w, h, PixelFormat.Bgra, PixelType.UnsignedByte, IntPtr.Zero); - - GL.Ext.GenerateMipmap(GenerateMipmapTarget.Texture2D); - - GL.BindTexture(TextureTarget.Texture2D, 0); - GL.BindBuffer(BufferTarget.PixelUnpackBuffer, 0); - - return true; - } - - GL.BindTexture(TextureTarget.Texture2D, texture.Name); - - GL.TexSubImage2D(TextureTarget.Texture2D, 0, 0, 0, w, h, PixelFormat.Bgra, PixelType.UnsignedByte, data); - - GL.Ext.GenerateMipmap(GenerateMipmapTarget.Texture2D); - - GL.BindTexture(TextureTarget.Texture2D, 0); - - return true; - } - - public bool UpdateOrAddTexture(ref CTexture texture, int w, int h, byte[] data) - { - if (!UpdateTexture(texture, w, h, data)) - { - RemoveTexture(ref texture); - texture = AddTexture(w, h, data); - } - return true; - } - #endregion updating - - public void RemoveTexture(ref CTexture texture) - { - if (_TextureExists(texture, false)) - { - lock (_MutexTexture) - { - _IDs.Enqueue(texture.ID); - GL.DeleteTexture(texture.Name); - if (texture.PBO > 0) - GL.DeleteBuffers(1, ref texture.PBO); - _Textures.Remove(texture.ID); - } - } - texture = null; - } - - private bool _TextureExists(CTexture texture, bool checkIfLoaded = true) - { - lock (_MutexTexture) - { - if (texture != null && _Textures.ContainsKey(texture.ID)) - { - if (!checkIfLoaded || _Textures[texture.ID].Name > 0) - return true; - } - } - return false; - } - - #region drawing - public void DrawTexture(CTexture texture) - { - if (texture == null) - return; - DrawTexture(texture, texture.Rect, texture.Color); - } - - public void DrawTexture(CTexture texture, SRectF rect) - { - if (texture == null) - return; - DrawTexture(texture, rect, texture.Color); - } - - public void DrawTexture(CTexture texture, SRectF rect, SColorF color, bool mirrored = false) - { - DrawTexture(texture, rect, color, new SRectF(0, 0, CSettings.RenderW, CSettings.RenderH, rect.Z), mirrored); - } - - public void DrawTexture(CTexture texture, SRectF rect, SColorF color, SRectF bounds, bool mirrored = false) - { - if (!_TextureExists(texture)) - return; - - if (Math.Abs(rect.W) < float.Epsilon || Math.Abs(rect.H) < float.Epsilon || Math.Abs(bounds.H) < float.Epsilon || Math.Abs(bounds.W) < float.Epsilon || - Math.Abs(color.A) < float.Epsilon) - return; - - if (bounds.X > rect.X + rect.W || bounds.X + bounds.W < rect.X) - return; - - if (bounds.Y > rect.Y + rect.H || bounds.Y + bounds.H < rect.Y) - return; - - GL.BindTexture(TextureTarget.Texture2D, texture.Name); - - float x1 = (bounds.X - rect.X) / rect.W * texture.WidthRatio; - float x2 = (bounds.X + bounds.W - rect.X) / rect.W * texture.WidthRatio; - float y1 = (bounds.Y - rect.Y) / rect.H * texture.HeightRatio; - float y2 = (bounds.Y + bounds.H - rect.Y) / rect.H * texture.HeightRatio; - - if (x1 < 0) - x1 = 0f; - - if (x2 > texture.WidthRatio) - x2 = texture.WidthRatio; - - if (y1 < 0) - y1 = 0f; - - if (y2 > texture.HeightRatio) - y2 = texture.HeightRatio; - - - float rx1 = rect.X; - float rx2 = rect.X + rect.W; - float ry1 = rect.Y; - float ry2 = rect.Y + rect.H; - - if (rx1 < bounds.X) - rx1 = bounds.X; - - if (rx2 > bounds.X + bounds.W) - rx2 = bounds.X + bounds.W; - - if (ry1 < bounds.Y) - ry1 = bounds.Y; - - if (ry2 > bounds.Y + bounds.H) - ry2 = bounds.Y + bounds.H; - - GL.Enable(EnableCap.Blend); - GL.Color4(color.R, color.G, color.B, color.A * CGraphics.GlobalAlpha); - - GL.MatrixMode(MatrixMode.Texture); - GL.PushMatrix(); - - if (Math.Abs(rect.Rotation) > float.Epsilon) - { - GL.Translate(0.5f, 0.5f, 0); - GL.Rotate(-rect.Rotation, 0f, 0f, 1f); - GL.Translate(-0.5f, -0.5f, 0); - } - - if (!mirrored) - { - GL.Begin(BeginMode.Quads); - - GL.TexCoord2(x1, y1); - GL.Vertex3(rx1, ry1, rect.Z + CGraphics.ZOffset); - - GL.TexCoord2(x1, y2); - GL.Vertex3(rx1, ry2, rect.Z + CGraphics.ZOffset); - - GL.TexCoord2(x2, y2); - GL.Vertex3(rx2, ry2, rect.Z + CGraphics.ZOffset); - - GL.TexCoord2(x2, y1); - GL.Vertex3(rx2, ry1, rect.Z + CGraphics.ZOffset); - - GL.End(); - } - else - { - GL.Begin(BeginMode.Quads); - - GL.TexCoord2(x2, y2); - GL.Vertex3(rx2, ry1, rect.Z + CGraphics.ZOffset); - - GL.TexCoord2(x2, y1); - GL.Vertex3(rx2, ry2, rect.Z + CGraphics.ZOffset); - - GL.TexCoord2(x1, y1); - GL.Vertex3(rx1, ry2, rect.Z + CGraphics.ZOffset); - - GL.TexCoord2(x1, y2); - GL.Vertex3(rx1, ry1, rect.Z + CGraphics.ZOffset); - - GL.End(); - } - GL.PopMatrix(); - GL.Disable(EnableCap.Blend); + } + + protected override COGLTexture _CreateTexture(Size dataSize) + { + if (dataSize.Width < 0) + return new COGLTexture(0, dataSize); + COGLTexture texture = new COGLTexture(GL.GenTexture(), dataSize, _CheckForNextPowerOf2(dataSize.Width), _CheckForNextPowerOf2(dataSize.Height)); + + return texture; + } + + private void _ClearTexture(COGLTexture texture) + { + if (texture.DataSize.Equals(texture.Size)) + return; + GL.BindFramebuffer(OpenTK.Graphics.OpenGL.FramebufferTarget.Framebuffer, _FBO); + GL.FramebufferTexture2D(OpenTK.Graphics.OpenGL.FramebufferTarget.Framebuffer, OpenTK.Graphics.OpenGL.FramebufferAttachment.ColorAttachment0, TextureTarget.Texture2D, + texture.Name, 0); + GL.ClearColor(Color.FromArgb(0)); + GL.Clear(ClearBufferMask.ColorBufferBit); + GL.ClearColor(Color.Black); + GL.BindFramebuffer(OpenTK.Graphics.OpenGL.FramebufferTarget.Framebuffer, 0); + } + + protected override void _WriteDataToTexture(COGLTexture texture, byte[] data) + { + Debug.Assert(texture.Name > 0); + _ClearTexture(texture); + GL.BindTexture(TextureTarget.Texture2D, texture.Name); + + GL.TexSubImage2D(TextureTarget.Texture2D, 0, 0, 0, texture.DataSize.Width, texture.DataSize.Height, PixelFormat.Bgra, PixelType.UnsignedByte, data); + GL.Ext.GenerateMipmap(GenerateMipmapTarget.Texture2D); + GL.BindTexture(TextureTarget.Texture2D, 0); } - public void DrawTexture(CTexture texture, SRectF rect, SColorF color, float begin, float end) + protected override void _WriteDataToTexture(COGLTexture texture, IntPtr data) { - if (!_TextureExists(texture)) - return; + Debug.Assert(texture.Name > 0); + _ClearTexture(texture); GL.BindTexture(TextureTarget.Texture2D, texture.Name); - GL.Enable(EnableCap.Blend); - GL.Color4(color.R, color.G, color.B, color.A * CGraphics.GlobalAlpha); + GL.TexSubImage2D(TextureTarget.Texture2D, 0, 0, 0, texture.DataSize.Width, texture.DataSize.Height, PixelFormat.Bgra, PixelType.UnsignedByte, data); + GL.Ext.GenerateMipmap(GenerateMipmapTarget.Texture2D); - - GL.Begin(BeginMode.Quads); - - GL.TexCoord2(0f + begin * texture.WidthRatio, 0f); - GL.Vertex3(rect.X + begin * rect.W, rect.Y, rect.Z + CGraphics.ZOffset); - - GL.TexCoord2(0f + begin * texture.WidthRatio, texture.HeightRatio); - GL.Vertex3(rect.X + begin * rect.W, rect.Y + rect.H, rect.Z + CGraphics.ZOffset); - - GL.TexCoord2(texture.WidthRatio * end, texture.HeightRatio); - GL.Vertex3(rect.X + end * rect.W, rect.Y + rect.H, rect.Z + CGraphics.ZOffset); - - GL.TexCoord2(texture.WidthRatio * end, 0f); - GL.Vertex3(rect.X + end * rect.W, rect.Y, rect.Z + CGraphics.ZOffset); - - GL.End(); - - - GL.Disable(EnableCap.Blend); GL.BindTexture(TextureTarget.Texture2D, 0); } - public void DrawTextureReflection(CTexture texture, SRectF rect, SColorF color, SRectF bounds, float space, float height) + protected override void _DrawTexture(COGLTexture texture, SDrawCoords dc, SColorF color, bool isReflection = false) { - if (!_TextureExists(texture)) - return; - - if (Math.Abs(rect.W) < float.Epsilon || Math.Abs(rect.H) < float.Epsilon || Math.Abs(bounds.H) < float.Epsilon || Math.Abs(bounds.W) < float.Epsilon || - Math.Abs(color.A) < float.Epsilon || height <= float.Epsilon) - return; - - if (bounds.X > rect.X + rect.W || bounds.X + bounds.W < rect.X) - return; - - if (bounds.Y > rect.Y + rect.H || bounds.Y + bounds.H < rect.Y) - return; - - if (height > bounds.H) - height = bounds.H; + // Align textures to full pixels to reduce artefacts + dc.Wx1 = (float)Math.Round(dc.Wx1); + dc.Wy1 = (float)Math.Round(dc.Wy1); + dc.Wx2 = (float)Math.Round(dc.Wx2); + dc.Wy2 = (float)Math.Round(dc.Wy2); GL.BindTexture(TextureTarget.Texture2D, texture.Name); - float x1 = (bounds.X - rect.X) / rect.W * texture.WidthRatio; - float x2 = (bounds.X + bounds.W - rect.X) / rect.W * texture.WidthRatio; - float y1 = (bounds.Y - rect.Y + rect.H - height) / rect.H * texture.HeightRatio; - float y2 = (bounds.Y + bounds.H - rect.Y) / rect.H * texture.HeightRatio; - - if (x1 < 0) - x1 = 0f; - - if (x2 > texture.WidthRatio) - x2 = texture.WidthRatio; - - if (y1 < 0) - y1 = 0f; - - if (y2 > texture.HeightRatio) - y2 = texture.HeightRatio; - - - float rx1 = rect.X; - float rx2 = rect.X + rect.W; - float ry1 = rect.Y + rect.H + space; - float ry2 = rect.Y + rect.H + space + height; - - if (rx1 < bounds.X) - rx1 = bounds.X; - - if (rx2 > bounds.X + bounds.W) - rx2 = bounds.X + bounds.W; - - if (ry1 < bounds.Y + space) - ry1 = bounds.Y + space; - - if (ry2 > bounds.Y + bounds.H + space + height) - ry2 = bounds.Y + bounds.H + space + height; - GL.Enable(EnableCap.Blend); GL.MatrixMode(MatrixMode.Texture); GL.PushMatrix(); - if (Math.Abs(rect.Rotation) > float.Epsilon) + if (Math.Abs(dc.Rotation) > float.Epsilon) { GL.Translate(0.5f, 0.5f, 0); - GL.Rotate(-rect.Rotation, 0f, 0f, 1f); + GL.Rotate(-dc.Rotation, 0f, 0f, 1f); GL.Translate(-0.5f, -0.5f, 0); } - GL.Begin(BeginMode.Quads); GL.Color4(color.R, color.G, color.B, color.A * CGraphics.GlobalAlpha); - GL.TexCoord2(x2, y2); - GL.Vertex3(rx2, ry1, rect.Z + CGraphics.ZOffset); + GL.TexCoord2(dc.Tx1, dc.Ty1); + GL.Vertex3(dc.Wx1, dc.Wy1, dc.Wz); - GL.Color4(color.R, color.G, color.B, 0f); - GL.TexCoord2(x2, y1); - GL.Vertex3(rx2, ry2, rect.Z + CGraphics.ZOffset); + if (isReflection) + GL.Color4(color.R, color.G, color.B, 0); + GL.TexCoord2(dc.Tx1, dc.Ty2); + GL.Vertex3(dc.Wx1, dc.Wy2, dc.Wz); - GL.Color4(color.R, color.G, color.B, 0f); - GL.TexCoord2(x1, y1); - GL.Vertex3(rx1, ry2, rect.Z + CGraphics.ZOffset); + GL.TexCoord2(dc.Tx2, dc.Ty2); + GL.Vertex3(dc.Wx2, dc.Wy2, dc.Wz); - GL.Color4(color.R, color.G, color.B, color.A * CGraphics.GlobalAlpha); - GL.TexCoord2(x1, y2); - GL.Vertex3(rx1, ry1, rect.Z + CGraphics.ZOffset); + if (isReflection) + GL.Color4(color.R, color.G, color.B, color.A * CGraphics.GlobalAlpha); + GL.TexCoord2(dc.Tx2, dc.Ty1); + GL.Vertex3(dc.Wx2, dc.Wy1, dc.Wz); GL.End(); - GL.PopMatrix(); GL.Disable(EnableCap.Blend); GL.BindTexture(TextureTarget.Texture2D, 0); } - #endregion drawing - - public int GetTextureCount() - { - return _Textures.Count; - } - - private void _CheckQueue() - { - lock (_MutexTexture) - { - while (_TexturesToLoad.Count > 0) - { - STextureQueue q = _TexturesToLoad.Dequeue(); - CTexture texture; - if (!_Textures.TryGetValue(q.ID, out texture)) - continue; - - _CreateTexture(texture, q.DataWidth, q.DataHeight, q.Data); - } - } - } - #endregion Textures - - #endregion implementation } } \ No newline at end of file diff --git a/Vocaluxe/Lib/Draw/CTextureBase.cs b/Vocaluxe/Lib/Draw/CTextureBase.cs new file mode 100644 index 00000000..01c0dc86 --- /dev/null +++ b/Vocaluxe/Lib/Draw/CTextureBase.cs @@ -0,0 +1,96 @@ +#region license +// This file is part of Vocaluxe. +// +// Vocaluxe is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Vocaluxe is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with Vocaluxe. If not, see . +#endregion + +using System; +using System.Drawing; + +namespace Vocaluxe.Lib.Draw +{ + abstract class CTextureBase : IDisposable + { + public int RefCount; + public string TexturePath; + + private Size _DataSize; + /// + /// Size of data used (mostly equal to OrigSize but due to resizing this might change) + /// + public Size DataSize + { + get { return _DataSize; } + set + { + _DataSize = value; + _CalcRatios(); + } + } + + /// + /// texture Size (on device), a power of 2 if necessary + /// + public Size Size { get; private set; } + + /// + /// Specifies which part of texture memory is actually used + /// + public float WidthRatio { get; private set; } + /// + /// Specifies which part of texture memory is actually used + /// + public float HeightRatio { get; private set; } + + /// + /// True if the texture contains usefull data + /// + public abstract bool IsLoaded { get; } + + /// + /// Creates a new texture + /// + /// Size of the data used + /// Size in video memory + protected CTextureBase(Size dataSize, Size textureSize) + { + _DataSize = dataSize; + Size = textureSize; + + _CalcRatios(); + } + + private void _CalcRatios() + { + if (_DataSize.Width == Size.Width) + WidthRatio = 1f; + else + WidthRatio = (float)_DataSize.Width / Size.Width; + if (_DataSize.Height == Size.Height) + HeightRatio = 1f; + else + HeightRatio = (float)_DataSize.Height / Size.Height; + } + + private bool _IsDisposed; + + public virtual void Dispose() + { + if (_IsDisposed) + throw new ObjectDisposedException(GetType().Name); + RefCount = 0; + _IsDisposed = true; + } + } +} \ No newline at end of file diff --git a/Vocaluxe/Lib/Draw/CTextureProvider.cs b/Vocaluxe/Lib/Draw/CTextureProvider.cs new file mode 100644 index 00000000..52fb5226 --- /dev/null +++ b/Vocaluxe/Lib/Draw/CTextureProvider.cs @@ -0,0 +1,896 @@ +#region license +// This file is part of Vocaluxe. +// +// Vocaluxe is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Vocaluxe is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with Vocaluxe. If not, see . +#endregion + +using System; +using System.Collections.Generic; +using System.Diagnostics; +using System.Drawing; +using System.Drawing.Imaging; +using System.IO; +using System.Linq; +using System.Runtime.InteropServices; +using System.Threading; +using System.Threading.Tasks; +using Vocaluxe.Base; +using VocaluxeLib; +using VocaluxeLib.Draw; + +namespace Vocaluxe.Lib.Draw +{ + /// + /// Base class for graphic drivers containing the handling of textures + /// A few notes: + /// Writes to textures (TTextureType) should only be done in the main thread + /// Writes to the RefCount of existing textures should only be done in the main thread and guarded by _Textures lock + /// + /// + abstract class CTextureProvider where TTextureType : CTextureBase, IDisposable + { + private enum EQueueAction + { + Add, + Update, + Delete + } + + private struct STextureQueue + { + public readonly object TextureOrRef; + /// + /// Only valid if Data is byte[] + /// + public readonly Size DataSize; + public readonly object Data; + public readonly EQueueAction Action; + + /// + /// Creates a new Queue entry + /// + /// TTextureType or CTextureRef + /// + /// Texture data as a bitmap + public STextureQueue(object textureOrRef, EQueueAction action, Bitmap data) + { + TextureOrRef = textureOrRef; + Action = action; + Data = data; + DataSize = new Size(); + } + + /// + /// Creates a new Queue entry + /// + /// TTextureType or CTextureRef + /// + /// Size of data + /// Texture data + public STextureQueue(object textureOrRef, EQueueAction action, Size dataSize, byte[] data) + { + TextureOrRef = textureOrRef; + Action = action; + DataSize = dataSize; + Data = data; + } + } + + private struct STextureCacheEntry + { + public TTextureType Texture; + /// + /// Size of original image (e.g. of bmp) + /// + public Size OrigSize; + } + + protected bool _NonPowerOf2TextureSupported; + + private int _NextID; + private readonly Object _MutexID = new object(); + + // Maps texture IDs to textures. Multiple IDs can be mapped to one texture (-->texture.RefCount>1) + private readonly Dictionary _Textures = new Dictionary(); + // Maps texturePaths to textures. Texture may have already been disposed (RefCount<=0) + private readonly Dictionary _TextureCache = new Dictionary(); + private readonly Queue _TextureQueue = new Queue(); + private readonly Dictionary> _BitmapsLoading = new Dictionary>(); + private int _TextureCount; + + private int _MainThreadID; + + public virtual bool Init() + { + _MainThreadID = Thread.CurrentThread.ManagedThreadId; + return true; + } + + public virtual void Close() + { + _EnsureMainThread(); + lock (_Textures) + { + //Dispose all textures + foreach (TTextureType texture in _Textures.Values) + { + if (texture != null && --texture.RefCount <= 0) + texture.Dispose(); + } + _Textures.Clear(); + _TextureCache.Clear(); + } + } + + /// + /// This makes sure, the function is called from within the main thread + /// + protected void _EnsureMainThread() + { + Debug.Assert(_MainThreadID == Thread.CurrentThread.ManagedThreadId); + } + + /// + /// Calculates the next power of two if the device has the POW2 flag set + /// + /// The value of which the next power of two will be calculated + /// The next power of two + protected int _CheckForNextPowerOf2(int n) + { + if (_NonPowerOf2TextureSupported) + return n; + if (n < 0) + throw new ArgumentOutOfRangeException("n", "Must be positive."); + return (int)Math.Pow(2, Math.Ceiling(Math.Log(n, 2))); + } + + /// + /// Returns the maximum area allowed for a texture based on the current quality + /// + /// + private static int _GetMaxTextureArea() + { + switch (CConfig.Config.Graphics.TextureQuality) + { + case ETextureQuality.TR_CONFIG_TEXTURE_LOWEST: + return 128 * 128; + case ETextureQuality.TR_CONFIG_TEXTURE_LOW: + return 256 * 128; + case ETextureQuality.TR_CONFIG_TEXTURE_MEDIUM: + return 512 * 256; + case ETextureQuality.TR_CONFIG_TEXTURE_HIGH: + return 1024 * 512; + case ETextureQuality.TR_CONFIG_TEXTURE_HIGHEST: + return CSettings.RenderW * CSettings.RenderH; + default: + throw new ArgumentException(); + } + } + + /// + /// Returns true if a texture with the given size needs to be resized + /// + /// + /// + private static bool _RequiresResize(Size size) + { + int maxArea = _GetMaxTextureArea(); + int curArea = size.Width * size.Height; + return curArea > maxArea; + } + + /// + /// Calculates the size for a new texture using the quality and smart values for rescaling + /// + /// New size for the texture + private Size _GetNewTextureSize(Size size) + { + Debug.Assert(size.Width > 0 && size.Height > 0); + int maxArea = _GetMaxTextureArea(); + int curArea = size.Width * size.Height; + if (curArea <= maxArea) + return size; + Debug.Assert(_RequiresResize(size)); + double factor = Math.Sqrt((double)maxArea / curArea); + Size newSize = new Size((int)(size.Width * factor), (int)(size.Height * factor)); + if (!_NonPowerOf2TextureSupported) + { + if (size.Width < size.Height) + { + newSize.Width = _CheckForNextPowerOf2(newSize.Width); + newSize.Height = _CheckForNextPowerOf2(maxArea / newSize.Width); + if (newSize.Width * newSize.Height > maxArea) + newSize.Height /= 2; + } + else + { + newSize.Height = _CheckForNextPowerOf2(newSize.Height); + newSize.Width = _CheckForNextPowerOf2(maxArea / newSize.Height); + if (newSize.Width * newSize.Height > maxArea) + newSize.Width /= 2; + } + } + Debug.Assert(newSize.Width * newSize.Height <= maxArea); + return newSize; + } + + protected abstract void _WriteDataToTexture(TTextureType texture, byte[] data); + + protected virtual void _WriteDataToTexture(TTextureType texture, IntPtr data) + { + byte[] dataArray = new byte[4 * texture.DataSize.Width * texture.DataSize.Height]; + Marshal.Copy(data, dataArray, 0, dataArray.Length); + _WriteDataToTexture(texture, dataArray); + } + + /// + /// Factory method to create a texture of the actual type
+ /// The implementer has to create an invalid texture (IsLoaded=false) if dataSize=(-1,-1) + ///
+ /// + /// + protected abstract TTextureType _CreateTexture(Size dataSize); + + /// + /// Creates the texture specified by the reference and fills it with the given data + /// + /// + /// + /// + private TTextureType _CreateAndFillTexture(Size dataSize, byte[] data) + { + TTextureType texture = _CreateTexture(dataSize); + _WriteDataToTexture(texture, data); + return texture; + } + + /// + /// Writes the specified bitmap to the texture, creating it if null
+ /// Also does the resizing if required + ///
+ /// + /// + private void _WriteBitmapToTexture(ref TTextureType texture, Bitmap bmp) + { + Bitmap bmp2 = null; + try + { + Size size = _GetNewTextureSize(bmp.GetSize()); + if (!size.Equals(bmp.GetSize())) + { + bmp2 = bmp.Resize(size); + bmp = bmp2; + } + + //Fill the new Bitmap with the texture data + BitmapData bmpData = bmp.LockBits(bmp.GetRect(), ImageLockMode.ReadOnly, PixelFormat.Format32bppArgb); + if (texture == null) + texture = _CreateTexture(size); + else + texture.DataSize = size; + _WriteDataToTexture(texture, bmpData.Scan0); + bmp.UnlockBits(bmpData); + } + finally + { + if (bmp2 != null) + bmp2.Dispose(); + } + } + + /// + /// Adds the texture to the cache
+ /// Asserts that the cache entry does not exist yet. So make Get/Add cache atomic through use of _TextureCache lock!
+ /// Thread safe + ///
+ /// + /// + /// + private void _AddToCache(TTextureType texture, Size origSize, string texturePath) + { + if (String.IsNullOrEmpty(texturePath)) + return; + Debug.Assert(texture != null); + lock (_Textures) + { + Debug.Assert(!_TextureCache.ContainsKey(texturePath)); + texture.TexturePath = texturePath; + STextureCacheEntry cacheEntry = new STextureCacheEntry {OrigSize = origSize, Texture = texture}; + _TextureCache.Add(texturePath, cacheEntry); + } + } + + /// + /// Gets a new texture reference from the cache
+ /// Thread safe + ///
+ /// + /// Task that loads the texture or null if not loading + /// + private CTextureRef _GetFromCache(string texturePath, out Task loader) + { + loader = null; + if (String.IsNullOrEmpty(texturePath)) + return null; + lock (_TextureCache) + lock (_Textures) + { + STextureCacheEntry cacheEntry; + if (_TextureCache.TryGetValue(texturePath, out cacheEntry)) + { + if (cacheEntry.Texture.RefCount <= 0) + _TextureCache.Remove(texturePath); + else + { + if (cacheEntry.OrigSize.Width < 0) + { + lock (_BitmapsLoading) + { + loader = _BitmapsLoading[texturePath]; + } + } + return _GetTextureReference(cacheEntry.OrigSize, cacheEntry.Texture); + } + } + } + return null; + } + + /// + /// Method used to add a texture to the texture list and return a TextureRef to it
+ /// If you are using an already used texture, you have to hold the _Textures lock or call from the main thread!
+ /// Thread safe + ///
+ /// + /// + /// + protected CTextureRef _GetTextureReference(Size origSize, TTextureType texture) + { + Debug.Assert(origSize.Width > 0 && origSize.Height > 0 || origSize.Width == -1 && origSize.Height == -1); + Debug.Assert(texture != null); + int id; + lock (_MutexID) + { + id = _NextID++; + } + CTextureRef textureRef = new CTextureRef(id, origSize); + lock (_Textures) + { + if (texture.RefCount == 0) + _TextureCount++; + texture.RefCount++; + _Textures.Add(id, texture); + } + return textureRef; + } + + /// + /// Method used to add a texture to the texture list and return a TextureRef to it
+ /// Thread safe
+ /// Convenience method + ///
+ /// + /// + /// + /// + protected CTextureRef _GetTextureReference(int origWidth, int origHeight, TTextureType texture) + { + return _GetTextureReference(new Size(origWidth, origHeight), texture); + } + + private static bool _IsTextureUsable(TTextureType texture, Size dataSize) + { + if (texture == null) + return false; + if (!texture.DataSize.Equals(dataSize)) + { + if (texture.Size.Width < dataSize.Width || texture.Size.Height < dataSize.Height) + return false; // Texture memory to small + if (texture.Size.Width * 0.9 > dataSize.Width || texture.Size.Height * 0.9 > dataSize.Height) + return false; // Texture memory to big + } + return true; + } + + protected bool _GetTexture(CTextureRef textureRef, out TTextureType texture, bool checkDrawable = true) + { + if (textureRef == null) + { + texture = null; + return false; + } + lock (_Textures) + { + return _Textures.TryGetValue(textureRef.ID, out texture) && (!checkDrawable || texture.IsLoaded); + } + } + + /// + /// Decreases the RefCount of a texture and disposes it if necessary + /// + /// + private void _DisposeTexture(TTextureType texture) + { + _EnsureMainThread(); + lock (_Textures) + { + if (texture != null && --texture.RefCount <= 0) + { + if (texture.TexturePath != null) + _TextureCache.Remove(texture.TexturePath); + texture.Dispose(); + _TextureCount--; + } + } + } + + protected void _CheckQueue() + { + _EnsureMainThread(); + lock (_TextureQueue) + { + while (_TextureQueue.Count > 0) + { + STextureQueue q = _TextureQueue.Dequeue(); + + if (q.Action == EQueueAction.Add) + { + TTextureType oldTexture = q.TextureOrRef as TTextureType; + Debug.Assert(oldTexture != null, "Queued type is wrong"); + Debug.Assert(!oldTexture.IsLoaded); + if (oldTexture.RefCount <= 0) + { + Bitmap bmp = q.Data as Bitmap; + if (bmp != null) + bmp.Dispose(); + continue; + } + TTextureType texture = null; + // ReSharper disable CanBeReplacedWithTryCastAndCheckForNull + if (q.Data is Bitmap) + { + Bitmap bmp = (Bitmap)q.Data; + _WriteBitmapToTexture(ref texture, bmp); + bmp.Dispose(); + } + else if (q.Data is byte[]) + texture = _CreateAndFillTexture(q.DataSize, (byte[])q.Data); + else + throw new ArgumentException("q.Data is of invalid type"); + // ReSharper restore CanBeReplacedWithTryCastAndCheckForNull + _MergeTextures(oldTexture, texture); + } + else + { + CTextureRef textureRef = q.TextureOrRef as CTextureRef; + Debug.Assert(textureRef != null, "Queued type is wrong"); + if (!_Textures.ContainsKey(textureRef.ID)) + { + Bitmap bmp = q.Data as Bitmap; + if (bmp != null) + bmp.Dispose(); + continue; + } + if (q.Action == EQueueAction.Update) + { + // ReSharper disable CanBeReplacedWithTryCastAndCheckForNull + if (q.Data is Bitmap) + { + Bitmap bmp = (Bitmap)q.Data; + UpdateTexture(textureRef, bmp); + bmp.Dispose(); + } + else if (q.Data is byte[]) + UpdateTexture(textureRef, q.DataSize, (byte[])q.Data); + else + throw new ArgumentException("q.Data is of invalid type"); + // ReSharper restore CanBeReplacedWithTryCastAndCheckForNull + } + else if (q.Action == EQueueAction.Delete) + RemoveTexture(ref textureRef); + } + } + } + } + + /// + /// Replaces one oldTexture by newTexture summing the refCounts. Also disposes oldTexture + /// + /// + /// + private void _MergeTextures(TTextureType oldTexture, TTextureType newTexture) + { + _EnsureMainThread(); + Debug.Assert(oldTexture.RefCount > 0); + lock (_Textures) + { + newTexture.RefCount += oldTexture.RefCount; + IEnumerable oldKeys = _Textures.Where(pair => pair.Value == oldTexture).Select(pair => pair.Key).ToArray(); + foreach (int key in oldKeys) + _Textures[key] = newTexture; + if (!String.IsNullOrEmpty(oldTexture.TexturePath)) + { + newTexture.TexturePath = oldTexture.TexturePath; + STextureCacheEntry cacheEntry; + if (_TextureCache.TryGetValue(newTexture.TexturePath, out cacheEntry)) + { + cacheEntry.Texture = newTexture; + _TextureCache[newTexture.TexturePath] = cacheEntry; + } + } + oldTexture.Dispose(); + } + } + + /// + /// Enqueues a bitmap to add or update the texture + /// + /// TTextureType (Add) or CTextureRef(Update) + /// + /// + /// True if resizing should be done in an extra thread + private void _EnqueueTextureAddOrUpdate(Object texture, Bitmap bmp, EQueueAction action, bool asyncResize) + { + Debug.Assert(action == EQueueAction.Add || action == EQueueAction.Update); + Debug.Assert(action != EQueueAction.Add || texture is TTextureType); + Debug.Assert(action != EQueueAction.Update || texture is CTextureRef); + if (_RequiresResize(bmp.GetSize())) + { + if (asyncResize) + Task.Factory.StartNew(() => _ResizeTextureAndEnqueue(texture, bmp, action)); + else + _ResizeTextureAndEnqueue(texture, bmp, action); + } + else + { + lock (_TextureQueue) + { + _TextureQueue.Enqueue(new STextureQueue(texture, action, bmp)); + } + } + } + + /// + /// Helper function to resize a bitmap and enqueue it + /// + /// + /// + /// + private void _ResizeTextureAndEnqueue(object texture, Bitmap bmp, EQueueAction action) + { + Bitmap bmp2 = bmp.Resize(_GetNewTextureSize(bmp.Size)); + bmp.Dispose(); + lock (_TextureQueue) + { + _TextureQueue.Enqueue(new STextureQueue(texture, action, bmp2)); + } + } + + /// + /// Helper function for loading a bitmap in a task + /// + /// + /// + /// + /// + private Size _LoadAndEnqueueBitmap(string filePath, CTextureRef textureRef, TTextureType texture) + { + Bitmap bmp = CHelper.LoadBitmap(filePath); + if (bmp == null) + { + RemoveTexture(ref textureRef); // Done asynchonously in the function + lock (_Textures) + { + _TextureCache.Remove(filePath); + lock (_BitmapsLoading) + { + _BitmapsLoading.Remove(filePath); + } + } + return new Size(-1, -1); + } + Size origSize = bmp.GetSize(); + textureRef.OrigSize = origSize; + // Update cache, use the same lock as in add/get cache methods + lock (_Textures) + { + STextureCacheEntry cacheEntry; + if (_TextureCache.TryGetValue(filePath, out cacheEntry)) + { + cacheEntry.OrigSize = origSize; + _TextureCache[filePath] = cacheEntry; + } + lock (_BitmapsLoading) + { + _BitmapsLoading.Remove(filePath); + } + } + _EnqueueTextureAddOrUpdate(texture, bmp, EQueueAction.Add, false); + return origSize; + } + + /// + /// Adds a texture and stores it in the VRam + /// + /// The texture's filepath + /// A STexture object containing the added texture + public CTextureRef AddTexture(string texturePath) + { + _EnsureMainThread(); + CTextureRef textureRef; + Task loader; + lock (_TextureCache) + { + textureRef = _GetFromCache(texturePath, out loader); + } + if (textureRef != null) + { + if (loader != null) + textureRef.OrigSize = loader.Result; + Debug.Assert(textureRef.OrigSize.Width > 0); + return textureRef; + } + + Bitmap bmp = CHelper.LoadBitmap(texturePath); + if (bmp == null) + return null; + try + { + textureRef = AddTexture(bmp, texturePath); + } + finally + { + bmp.Dispose(); + } + return textureRef; + } + + public CTextureRef AddTexture(Bitmap bmp) + { + _EnsureMainThread(); + return AddTexture(bmp, null); + } + + /// + /// Adds a texture and stores it in the Vram + /// + /// The Bitmap of which the texure will be created from + /// + /// A reference to the texture + public CTextureRef AddTexture(Bitmap bmp, string texturePath) + { + _EnsureMainThread(); + if (bmp.Height == 0 || bmp.Width == 0) + return null; + + CTextureRef textureRef; + Size origSize = bmp.GetSize(); + TTextureType texture = null; + Task loader; + // Make the Get/Add Cache methods atomic + lock (_TextureCache) + { + textureRef = _GetFromCache(texturePath, out loader); + if (textureRef == null) + { + _WriteBitmapToTexture(ref texture, bmp); + + _AddToCache(texture, origSize, texturePath); + } + } + if (textureRef == null) + textureRef = _GetTextureReference(origSize, texture); + else if (loader != null) + textureRef.OrigSize = loader.Result; + Debug.Assert(textureRef.OrigSize.Width > 0); + return textureRef; + } + + public CTextureRef AddTexture(int w, int h, byte[] data) + { + _EnsureMainThread(); + TTextureType texture = _CreateAndFillTexture(new Size(w, h), data); + return _GetTextureReference(w, h, texture); + } + + public CTextureRef EnqueueTexture(int w, int h, byte[] data) + { + lock (_TextureQueue) + { + TTextureType texture = _CreateTexture(new Size(-1, -1)); + CTextureRef textureRef = _GetTextureReference(w, h, texture); + _TextureQueue.Enqueue(new STextureQueue(texture, EQueueAction.Add, new Size(w, h), data)); + return textureRef; + } + } + + public CTextureRef EnqueueTexture(Bitmap bmp) + { + TTextureType texture = _CreateTexture(new Size(-1, -1)); + CTextureRef textureRef = _GetTextureReference(bmp.GetSize(), texture); + _EnqueueTextureAddOrUpdate(texture, bmp, EQueueAction.Add, true); + + return textureRef; + } + + public CTextureRef EnqueueTexture(String filePath) + { + // 3 important scenarios: (+ means after, || means in parallel) + // 1) EnqueueTexture(fileA) (+ or ||) EnqueueTexture(fileA) --> No block on 2nd call and same texture returned + // 2) EnqueueTexture(fileA) + AddTexture(fileA) before texture is loaded --> Wait in AddTexture for this to finish + // 3) a) AddTexture(fileA) || b) EnqueueTexture(fileA) with a)getFromCache + b)getFromCache + a)addToCache + b)addToCache --> Only keep one copy + // All solved with atomic get/add cache and _WaitForTextureLoaded + + if (!File.Exists(filePath)) + return null; + CTextureRef textureRef; + TTextureType texture = null; + Task loader; + // Make Get/Add cache atomic + lock (_TextureCache) + { + textureRef = _GetFromCache(filePath, out loader); + if (textureRef == null) + { + Debug.Assert(loader == null); + Size invalidSize = new Size(-1, -1); + texture = _CreateTexture(invalidSize); + // This cache entry has to be updated once the real origSize is available + _AddToCache(texture, invalidSize, filePath); + textureRef = _GetTextureReference(invalidSize, texture); + // Add the loader to the dictionary in the same lock as the add cache call + // Avoids that we get a cache entry in AddTexture but no Task + loader = new Task(() => _LoadAndEnqueueBitmap(filePath, textureRef, texture)); + lock (_BitmapsLoading) + { + _BitmapsLoading.Add(filePath, loader); + } + } + } + + if (texture == null) + { + // Found in cache + CTextureRef tmp = textureRef; // Workaround for implicitly captured closure warning (false positive) + if (loader != null) + Task.Factory.StartNew(() => tmp.OrigSize = loader.Result); + return textureRef; + } + + Debug.Assert(loader != null); + Debug.Assert(texture != null); + loader.Start(); + return textureRef; + } + + public void EnqueueTextureUpdate(CTextureRef textureRef, Bitmap bmp) + { + _EnqueueTextureAddOrUpdate(textureRef, bmp, EQueueAction.Update, true); + } + + public void UpdateTexture(CTextureRef textureRef, int w, int h, byte[] data) + { + UpdateTexture(textureRef, new Size(w, h), data); + } + + /// + /// Updates the data of a texture + /// + /// The texture to update + /// + /// A byte array containing the new texture's data + /// True if succeeded + public void UpdateTexture(CTextureRef textureRef, Size dataSize, byte[] data) + { + _EnsureMainThread(); + TTextureType texture; + if (!_GetTexture(textureRef, out texture, false)) + return; + bool reuseTexture = _IsTextureUsable(texture, dataSize); + if (reuseTexture && texture.RefCount == 1) + { + texture.DataSize = dataSize; + _WriteDataToTexture(texture, data); + } + else + { + _DisposeTexture(texture); + texture = _CreateAndFillTexture(dataSize, data); + texture.RefCount = 1; + _Textures[textureRef.ID] = texture; + } + } + + public void UpdateTexture(CTextureRef textureRef, Bitmap bmp) + { + _EnsureMainThread(); + TTextureType texture; + if (!_GetTexture(textureRef, out texture, false)) + return; + bool reuseTexture = _IsTextureUsable(texture, bmp.Size); + if (reuseTexture && texture.RefCount == 1) + _WriteBitmapToTexture(ref texture, bmp); + else + { + _DisposeTexture(texture); + texture = null; + _WriteBitmapToTexture(ref texture, bmp); + texture.RefCount = 1; + _Textures[textureRef.ID] = texture; + } + } + + public CTextureRef CopyTexture(CTextureRef textureRef) + { + // Lock to make sure the texture is not disposed while we are in this method + lock (_Textures) + { + TTextureType texture; + if (!_GetTexture(textureRef, out texture, false)) + return null; + // If bitmap is not yet loaded, wait for it + if (!String.IsNullOrEmpty(texture.TexturePath)) + { + Task loader; + lock (_BitmapsLoading) + { + _BitmapsLoading.TryGetValue(texture.TexturePath, out loader); + } + if (loader != null) + textureRef.OrigSize = loader.Result; + } + Debug.Assert(textureRef.OrigSize.Width > 0); + return _GetTextureReference(textureRef.OrigSize, texture); + } + } + + /// + /// Removes a texture from the Vram + /// + /// The texture to be removed + public void RemoveTexture(ref CTextureRef textureRef) + { + if (textureRef == null) + return; + if (textureRef.ID > 0) + { + if (_MainThreadID != Thread.CurrentThread.ManagedThreadId) + { + lock (_TextureQueue) + { + _TextureQueue.Enqueue(new STextureQueue(textureRef, EQueueAction.Delete, null)); + } + textureRef = null; + return; + } + lock (_Textures) + { + TTextureType t; + if (_Textures.TryGetValue(textureRef.ID, out t)) + { + _DisposeTexture(t); + _Textures.Remove(textureRef.ID); + } + textureRef.SetRemoved(); + } + } + textureRef = null; + } + + public int GetTextureCount() + { + return _TextureCount; + } + } +} \ No newline at end of file diff --git a/Vocaluxe/Lib/Draw/IDraw.cs b/Vocaluxe/Lib/Draw/IDraw.cs index f5e3fad3..5b362a49 100644 --- a/Vocaluxe/Lib/Draw/IDraw.cs +++ b/Vocaluxe/Lib/Draw/IDraw.cs @@ -25,37 +25,37 @@ namespace Vocaluxe.Lib.Draw { bool Init(); void MainLoop(); - void Unload(); + void Close(); int GetScreenWidth(); int GetScreenHeight(); int GetTextureCount(); - void ClearScreen(); - CTexture CopyScreen(); - void CopyScreen(ref CTexture texture); + CTextureRef CopyScreen(); + void CopyScreen(ref CTextureRef texture); void MakeScreenShot(); - CTexture AddTexture(string texturePath); - CTexture AddTexture(Bitmap bitmap); - CTexture AddTexture(int w, int h, byte[] data); - CTexture EnqueueTexture(int w, int h, byte[] data); - bool UpdateTexture(CTexture texture, int w, int h, byte[] data); - bool UpdateOrAddTexture(ref CTexture texture, int w, int h, byte[] data); - void RemoveTexture(ref CTexture texture); + CTextureRef AddTexture(string texturePath); + CTextureRef AddTexture(Bitmap bitmap); + CTextureRef AddTexture(int w, int h, byte[] data); + void UpdateTexture(CTextureRef texture, Bitmap bmp); + void UpdateTexture(CTextureRef texture, int w, int h, byte[] data); + CTextureRef EnqueueTexture(string texturePath); + CTextureRef EnqueueTexture(Bitmap bmp); + CTextureRef EnqueueTexture(int w, int h, byte[] data); + void EnqueueTextureUpdate(CTextureRef textureRef, Bitmap bmp); + CTextureRef CopyTexture(CTextureRef textureRef); + void RemoveTexture(ref CTextureRef texture); // Basic Draw Methods - void DrawLine(int a, int r, int g, int b, int w, int x1, int y1, int x2, int y2); - void DrawColor(SColorF color, SRectF rect); - void DrawColorReflection(SColorF color, SRectF rect, float space, float height); + void DrawRect(SColorF color, SRectF rect); + void DrawRectReflection(SColorF color, SRectF rect, float space, float height); - void DrawTexture(CTexture texture); - void DrawTexture(CTexture texture, SRectF rect); - void DrawTexture(CTexture texture, SRectF rect, SColorF color, bool mirrored = false); - void DrawTexture(CTexture texture, SRectF rect, SColorF color, SRectF bounds, bool mirrored = false); - void DrawTexture(CTexture texture, SRectF rect, SColorF color, float begin, float end); + void DrawTexture(CTextureRef texture, SRectF rect, SColorF color, bool mirrored = false); + void DrawTexture(CTextureRef texture, SRectF rect, SColorF color, SRectF bounds, bool mirrored = false); + void DrawTexture(CTextureRef texture, SRectF rect, SColorF color, float begin, float end); - void DrawTextureReflection(CTexture texture, SRectF rect, SColorF color, SRectF bounds, float space, float height); + void DrawTextureReflection(CTextureRef texture, SRectF rect, SColorF color, SRectF bounds, float space, float height); } } \ No newline at end of file diff --git a/Vocaluxe/Lib/Playlist/CPlaylistFile.cs b/Vocaluxe/Lib/Playlist/CPlaylistFile.cs index ff86215f..77fc2b06 100644 --- a/Vocaluxe/Lib/Playlist/CPlaylistFile.cs +++ b/Vocaluxe/Lib/Playlist/CPlaylistFile.cs @@ -19,11 +19,11 @@ using System; using System.Collections.Generic; using System.IO; using System.Linq; -using System.Xml; using Vocaluxe.Base; using VocaluxeLib; using VocaluxeLib.Menu; using VocaluxeLib.Songs; +using VocaluxeLib.Xml; namespace Vocaluxe.Lib.Playlist { @@ -31,15 +31,14 @@ namespace Vocaluxe.Lib.Playlist { public string Name = ""; public string File; - public readonly int Id = -1; + public readonly int Id; public List Songs = new List(); - public CPlaylistFile(int id, string file = "") + private static int _NextID; + + public CPlaylistFile() { - Id = id; - File = file; - if (File != "") - _Load(); + Id = _NextID++; } public void Save() @@ -61,90 +60,40 @@ namespace Vocaluxe.Lib.Playlist File = CHelper.GetUniqueFileName(Path.Combine(CSettings.DataFolder, CConfig.FolderPlaylists), filename + ".xml"); } - XmlWriter writer; + SPlaylist data = new SPlaylist {Info = {Name = Name}, Songs = Songs.Select(plSong => plSong.ToStruct()).ToArray()}; + + var xml = new CXmlSerializer(); + xml.Serialize(File, data); + } + + public bool _Load(string file) + { + File = file; + SPlaylist data; try { - writer = XmlWriter.Create(File, CConfig.XMLSettings); + var xml = new CXmlDeserializer(); + data = xml.Deserialize(File); } catch (Exception e) { - CLog.LogError("Error creating/opening Playlist File " + File + ": " + e.Message); - return; + CLog.LogError("Cannot load playlist from " + file + ": " + e.Message); + return false; } - - try + Name = data.Info.Name; + Songs = new List(); + foreach (SPlaylistSong songEntry in data.Songs) { - writer.WriteStartDocument(); - writer.WriteStartElement("root"); - - writer.WriteStartElement("Info"); - writer.WriteElementString("PlaylistName", Name); - writer.WriteEndElement(); - - writer.WriteStartElement("Songs"); - for (int i = 0; i < Songs.Count; i++) + CSong plSong = CSongs.AllSongs.FirstOrDefault(song => song.Artist == songEntry.Artist && song.Title == songEntry.Title); + if (plSong == null) + CLog.LogError("Can't find song '" + songEntry.Title + "' from '" + songEntry.Artist + "' in playlist file: " + File); + else { - CSong song = CSongs.GetSong(Songs[i].SongID); - if (song != null) - { - writer.WriteStartElement("Song" + (i + 1)); - writer.WriteElementString("Artist", song.Artist); - writer.WriteElementString("Title", song.Title); - writer.WriteElementString("GameMode", Enum.GetName(typeof(EGameMode), Songs[i].GameMode)); - 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(); - } - finally - { - writer.Close(); - } - } - - private void _Load() - { - CXMLReader xmlReader = CXMLReader.OpenFile(File); - if (xmlReader == null) - return; - - string value; - if (xmlReader.GetValue("//root/Info/PlaylistName", out value, "")) - { - Name = value; - - Songs = new List(); - - List songs = xmlReader.GetNames("//root/Songs/*"); - - foreach (string songEntry in songs) - { - string artist; - string title; - xmlReader.GetValue("//root/Songs/" + songEntry + "/Artist", out artist, String.Empty); - xmlReader.GetValue("//root/Songs/" + songEntry + "/Title", out title, String.Empty); - EGameMode gm = EGameMode.TR_GAMEMODE_NORMAL; - xmlReader.TryGetEnumValue("//root/Songs/" + songEntry + "/GameMode", ref gm); - - CSong plSong = CSongs.AllSongs.FirstOrDefault(song => song.Artist == artist && song.Title == title); - if (plSong != null) - { - var playlistSong = new CPlaylistSong(plSong.ID, gm); - Songs.Add(playlistSong); - } - else - CLog.LogError("Can't find song '" + title + "' from '" + artist + "' in playlist file: " + File); + var playlistSong = new CPlaylistSong(plSong.ID, songEntry.GameMode); + Songs.Add(playlistSong); } } - else - CLog.LogError("Can't find PlaylistName in Playlist File: " + File); + return true; } public void AddSong(int songID) diff --git a/Vocaluxe/Lib/Sound/Playback/CAudioStreamBase.cs b/Vocaluxe/Lib/Sound/Playback/CAudioStreamBase.cs index d8046b4d..5040c427 100644 --- a/Vocaluxe/Lib/Sound/Playback/CAudioStreamBase.cs +++ b/Vocaluxe/Lib/Sound/Playback/CAudioStreamBase.cs @@ -43,7 +43,7 @@ namespace Vocaluxe.Lib.Sound.Playback public abstract bool IsPaused { get; set; } public abstract bool IsFinished { get; } - public CAudioStreamBase(int id, string medium, bool loop) + protected CAudioStreamBase(int id, string medium, bool loop) { _ID = id; _Medium = medium; diff --git a/Vocaluxe/Lib/Sound/Playback/CPlaybackBase.cs b/Vocaluxe/Lib/Sound/Playback/CPlaybackBase.cs index a9ce5959..d3e4a168 100644 --- a/Vocaluxe/Lib/Sound/Playback/CPlaybackBase.cs +++ b/Vocaluxe/Lib/Sound/Playback/CPlaybackBase.cs @@ -15,6 +15,7 @@ // along with Vocaluxe. If not, see . #endregion +using System; using System.Collections.Generic; using System.Threading; using VocaluxeLib; @@ -62,19 +63,19 @@ namespace Vocaluxe.Lib.Sound.Playback } } - public float GetGlobalVolume() + public int GetGlobalVolume() { - return (_Initialized) ? _GlobalVolume * 100f : 100f; + return (_Initialized) ? (int) Math.Round(_GlobalVolume * 100) : 100; } - public void SetGlobalVolume(float volume) + public void SetGlobalVolume(int volume) { if (!_Initialized) return; - volume = volume.Clamp(0f, 100f) / 100f; + float volumeF = volume.Clamp(0, 100) / 100f; foreach (IAudioStream stream in _Streams) - stream.VolumeMax = volume; - _GlobalVolume = volume; + stream.VolumeMax = volumeF; + _GlobalVolume = volumeF; } public int GetStreamCount() @@ -117,7 +118,7 @@ namespace Vocaluxe.Lib.Sound.Playback { if (!_Initialized) return -1; - IAudioStream stream = _CreateStream(_NextID, medium, loop); + IAudioStream stream = _CreateStream(_NextID++, medium, loop); if (stream.Open(prescan)) { @@ -127,7 +128,6 @@ namespace Vocaluxe.Lib.Sound.Playback stream.VolumeMax = _GlobalVolume; stream.SetOnCloseListener(this); _Streams.Add(stream); - _NextID++; return stream.ID; } } @@ -179,28 +179,28 @@ namespace Vocaluxe.Lib.Sound.Playback } } - public void Fade(int streamID, float targetVolume, float seconds, EStreamAction afterFadeAction = EStreamAction.Nothing) + public void Fade(int streamID, int targetVolume, float seconds, EStreamAction afterFadeAction = EStreamAction.Nothing) { if (!_Initialized) return; - targetVolume = targetVolume.Clamp(0f, 100f) / 100f; + float targetVolumeF = targetVolume.Clamp(0, 100) / 100f; lock (_Streams) { if (_StreamExists(streamID)) - _Streams[_GetStreamIndex(streamID)].Fade(targetVolume, seconds, afterFadeAction); + _Streams[_GetStreamIndex(streamID)].Fade(targetVolumeF, seconds, afterFadeAction); } } - public void SetStreamVolume(int streamID, float volume) + public void SetStreamVolume(int streamID, int volume) { if (!_Initialized) return; - volume = volume.Clamp(0f, 100f) / 100f; + float volumeF = volume.Clamp(0, 100) / 100f; lock (_Streams) { if (_StreamExists(streamID)) { - _Streams[_GetStreamIndex(streamID)].Volume = volume; + _Streams[_GetStreamIndex(streamID)].Volume = volumeF; _Streams[_GetStreamIndex(streamID)].CancelFading(); } } diff --git a/Vocaluxe/Lib/Sound/Playback/GstreamerSharp/CGstreamerSharpAudio.cs b/Vocaluxe/Lib/Sound/Playback/GstreamerSharp/CGstreamerSharpAudio.cs index 651dcd21..e32d3795 100644 --- a/Vocaluxe/Lib/Sound/Playback/GstreamerSharp/CGstreamerSharpAudio.cs +++ b/Vocaluxe/Lib/Sound/Playback/GstreamerSharp/CGstreamerSharpAudio.cs @@ -16,6 +16,8 @@ #endregion using Gst; +using System; +using Vocaluxe.Base; namespace Vocaluxe.Lib.Sound.Playback.GstreamerSharp { @@ -25,16 +27,23 @@ namespace Vocaluxe.Lib.Sound.Playback.GstreamerSharp { if (_Initialized) return false; + #if ARCH_X86 - const string path = ".\\x86\\gstreamer"; + const string varName = "GSTREAMER_1_0_ROOT_X86"; #endif #if ARCH_X64 - const string path = ".\\x64\\gstreamer"; + const string varName = "GSTREAMER_1_0_ROOT_X86_64"; #endif - //SetDllDirectory(path); + string gstreamerEnvVar = Environment.GetEnvironmentVariable(varName, EnvironmentVariableTarget.User); + if (gstreamerEnvVar == null) + { + CLog.LogError("Gstreamer not found! Make sure you installed it correctly and if it set the environment variable '" + varName + "'!", true); + return false; + } + string dllDirectory = gstreamerEnvVar + "bin\\"; + COSFunctions.AddEnvironmentPath(dllDirectory); + Application.Init(); - Registry reg = Registry.Get(); - reg.ScanPath(path); _Initialized = Application.IsInitialized; return _Initialized; diff --git a/Vocaluxe/Lib/Sound/Playback/GstreamerSharp/CGstreamerSharpAudioStream.cs b/Vocaluxe/Lib/Sound/Playback/GstreamerSharp/CGstreamerSharpAudioStream.cs index d7ac9f72..c66ba54b 100644 --- a/Vocaluxe/Lib/Sound/Playback/GstreamerSharp/CGstreamerSharpAudioStream.cs +++ b/Vocaluxe/Lib/Sound/Playback/GstreamerSharp/CGstreamerSharpAudioStream.cs @@ -58,8 +58,9 @@ namespace Vocaluxe.Lib.Sound.Playback.GstreamerSharp get { //TODO: Is it ok, to remove this? Gst should post a message if duration was changed so this should not be required - //if (base.Length < 0 && _Element != null) - // _UpdateDuration(); + // Removing would not work in some cases where length is not know at startup + if (base.Length < 0 && _Element != null) + _UpdateDuration(); return base.Length >= 0f ? base.Length : 0f; } } @@ -174,9 +175,12 @@ namespace Vocaluxe.Lib.Sound.Playback.GstreamerSharp // Passing CLOCK_TIME_NONE here causes the pipeline to block for a long time so with // prescan enabled the pipeline will wait 500ms for stream to initialize and then continue // if it takes more than 500ms, duration queries will be performed asynchronously - Message msg = _Element.Bus.TimedPopFiltered(prescan ? ulong.MaxValue : 0L, MessageType.AsyncDone); - if (msg.Handle != IntPtr.Zero) - _UpdateDuration(); + Message msg = _Element.Bus.TimedPopFiltered(prescan ? ulong.MaxValue : 0L, MessageType.AsyncDone | MessageType.Error | MessageType.DurationChanged); + if (!_OnMessage(msg)) + { + _Dispose(true); + return false; + } _FileOpened = true; return true; } @@ -231,10 +235,10 @@ namespace Vocaluxe.Lib.Sound.Playback.GstreamerSharp _Element["volume"] = Volume * VolumeMax; } - private void _OnMessage(Message msg) + private bool _OnMessage(Message msg) { - if (msg.Handle == IntPtr.Zero) - return; + if (msg == null || msg.Handle == IntPtr.Zero) + return true; switch (msg.Type) { case MessageType.Eos: @@ -248,12 +252,13 @@ namespace Vocaluxe.Lib.Sound.Playback.GstreamerSharp string debug; msg.ParseError(out error, out debug); CLog.LogError("Gstreamer error: message" + error.Message + ", code" + error.Code + " ,debug information" + debug); - break; + return false; case MessageType.DurationChanged: _UpdateDuration(); break; } - msg.Unref(); + msg.Dispose(); + return true; } public override void Update() diff --git a/Vocaluxe/Lib/Sound/Playback/IPlayback.cs b/Vocaluxe/Lib/Sound/Playback/IPlayback.cs index a022d455..1dd10288 100644 --- a/Vocaluxe/Lib/Sound/Playback/IPlayback.cs +++ b/Vocaluxe/Lib/Sound/Playback/IPlayback.cs @@ -19,19 +19,18 @@ using VocaluxeLib; namespace Vocaluxe.Lib.Sound.Playback { - interface IPlayback { bool Init(); void Close(); - float GetGlobalVolume(); + int GetGlobalVolume(); /// /// Set the global (maximum) volume
/// All streams (existent and future ones) will have their maximum volume set to this value ///
/// Volume in percent - void SetGlobalVolume(float volume); + void SetGlobalVolume(int volume); int GetStreamCount(); void CloseAll(); @@ -43,14 +42,14 @@ namespace Vocaluxe.Lib.Sound.Playback void Play(int streamID); void Pause(int streamID); void Stop(int streamID); - void Fade(int streamID, float targetVolume, float seconds, EStreamAction afterFadeAction = EStreamAction.Nothing); + void Fade(int streamID, int targetVolume, float seconds, EStreamAction afterFadeAction = EStreamAction.Nothing); /// /// Set the streams current volume. Cancels fading /// /// Id of the stream (optained by Load) /// Volume in percent - void SetStreamVolume(int streamID, float volume); + void SetStreamVolume(int streamID, int volume); float GetLength(int streamID); float GetPosition(int streamID); diff --git a/Vocaluxe/Lib/Sound/Playback/OpenAL/COpenAlStream.cs b/Vocaluxe/Lib/Sound/Playback/OpenAL/COpenAlStream.cs index 7428b494..f9b5f41d 100644 --- a/Vocaluxe/Lib/Sound/Playback/OpenAL/COpenAlStream.cs +++ b/Vocaluxe/Lib/Sound/Playback/OpenAL/COpenAlStream.cs @@ -208,7 +208,7 @@ namespace Vocaluxe.Lib.Sound.Playback.OpenAL _Timer.Reset(); _Data = new CRingBuffer(_Bufsize); _NoMoreData = false; - _SampleBuf = new byte[(int)CConfig.AudioBufferSize]; + _SampleBuf = new byte[(int)CConfig.Config.Sound.AudioBufferSize]; //From now on closing the driver and the decoder is handled by the thread ONLY! _DecoderThread = new Thread(_Execute) {Priority = ThreadPriority.Normal, Name = Path.GetFileName(_Medium)}; @@ -384,7 +384,7 @@ namespace Vocaluxe.Lib.Sound.Playback.OpenAL } } - float latency = CConfig.AudioLatency / 1000f + queuedCount * _SampleBuf.Length / _BytesPerSecond + 0.1f; + float latency = CConfig.Config.Sound.AudioLatency / 1000f + queuedCount * _SampleBuf.Length / _BytesPerSecond + 0.1f; _CurrentTime = _TimeCode - _Data.BytesNotRead / _BytesPerSecond - latency; _Timer.Restart(); } diff --git a/Vocaluxe/Lib/Sound/Playback/PortAudio/CPortAudioStream.cs b/Vocaluxe/Lib/Sound/Playback/PortAudio/CPortAudioStream.cs index ac913aaf..34421547 100644 --- a/Vocaluxe/Lib/Sound/Playback/PortAudio/CPortAudioStream.cs +++ b/Vocaluxe/Lib/Sound/Playback/PortAudio/CPortAudioStream.cs @@ -199,7 +199,7 @@ namespace Vocaluxe.Lib.Sound.Playback.PortAudio out _Stream, ref outputParams, format.SamplesPerSecond, - (uint)CConfig.AudioBufferSize / 2, + (uint)CConfig.Config.Sound.AudioBufferSize / 2, PortAudioSharp.PortAudio.PaStreamFlags.paNoFlag, _PaStreamCallback, IntPtr.Zero) || _Stream == IntPtr.Zero) @@ -208,7 +208,7 @@ namespace Vocaluxe.Lib.Sound.Playback.PortAudio return false; } - _Latency = CConfig.AudioLatency / 1000f + (float)PortAudioSharp.PortAudio.Pa_GetStreamInfo(_Stream).outputLatency; + _Latency = CConfig.Config.Sound.AudioLatency / 1000f + (float)PortAudioSharp.PortAudio.Pa_GetStreamInfo(_Stream).outputLatency; //From now on closing the driver and the decoder is handled by the thread ONLY! @@ -240,15 +240,13 @@ namespace Vocaluxe.Lib.Sound.Playback.PortAudio if (!_FileOpened || _Terminated || !IsPaused) return; IsPaused = false; - _PaHandle.CheckError("StartStream", PortAudioSharp.PortAudio.Pa_StartStream(_Stream)); } public override void Stop() { if (!_FileOpened || _Terminated) return; - _Paused = true; - _PaHandle.CheckError("StopStream (playback)", PortAudioSharp.PortAudio.Pa_StopStream(_Stream)); + IsPaused = true; Position = 0f; } diff --git a/Vocaluxe/Lib/Sound/Record/CRecordBase.cs b/Vocaluxe/Lib/Sound/Record/CRecordBase.cs index 62c67da7..dde798fe 100644 --- a/Vocaluxe/Lib/Sound/Record/CRecordBase.cs +++ b/Vocaluxe/Lib/Sound/Record/CRecordBase.cs @@ -1,4 +1,21 @@ -using System.Collections.Generic; +#region license +// This file is part of Vocaluxe. +// +// Vocaluxe is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Vocaluxe is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with Vocaluxe. If not, see . +#endregion + +using System.Collections.Generic; using System.Collections.ObjectModel; using Vocaluxe.Base; diff --git a/Vocaluxe/Lib/Sound/Record/PitchTracker/CAnalyzer.cs b/Vocaluxe/Lib/Sound/Record/PitchTracker/CAnalyzer.cs index 2a50540f..546bdf95 100644 --- a/Vocaluxe/Lib/Sound/Record/PitchTracker/CAnalyzer.cs +++ b/Vocaluxe/Lib/Sound/Record/PitchTracker/CAnalyzer.cs @@ -1,11 +1,28 @@ -using System; +#region license +// This file is part of Vocaluxe. +// +// Vocaluxe is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Vocaluxe is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with Vocaluxe. If not, see . +#endregion + +using System; using System.Runtime.InteropServices; namespace Vocaluxe.Lib.Sound.Record.PitchTracker { /// - /// Analyzer from Performous - /// Should be very reliable but needs some proof (artificial tests show some errors) + /// Analyzer from Performous + /// Should be very reliable but needs some proof (artificial tests show some errors) /// class CAnalyzer : CPitchTracker { diff --git a/Vocaluxe/Lib/Sound/Record/PitchTracker/CPitchTrackerTest.cs b/Vocaluxe/Lib/Sound/Record/PitchTracker/CPitchTrackerTest.cs index 7ba4966b..7c727693 100644 --- a/Vocaluxe/Lib/Sound/Record/PitchTracker/CPitchTrackerTest.cs +++ b/Vocaluxe/Lib/Sound/Record/PitchTracker/CPitchTrackerTest.cs @@ -1,4 +1,21 @@ -using System; +#region license +// This file is part of Vocaluxe. +// +// Vocaluxe is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Vocaluxe is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with Vocaluxe. If not, see . +#endregion + +using System; using System.Collections.Generic; using System.Diagnostics; using System.IO; diff --git a/Vocaluxe/Lib/Sound/Record/PitchTracker/CPtAKF.cs b/Vocaluxe/Lib/Sound/Record/PitchTracker/CPtAKF.cs index c47ff51f..351dac22 100644 --- a/Vocaluxe/Lib/Sound/Record/PitchTracker/CPtAKF.cs +++ b/Vocaluxe/Lib/Sound/Record/PitchTracker/CPtAKF.cs @@ -1,4 +1,21 @@ -using System; +#region license +// This file is part of Vocaluxe. +// +// Vocaluxe is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Vocaluxe is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with Vocaluxe. If not, see . +#endregion + +using System; using System.Runtime.InteropServices; namespace Vocaluxe.Lib.Sound.Record.PitchTracker diff --git a/Vocaluxe/Lib/Sound/Record/PitchTracker/CPtDyWa.cs b/Vocaluxe/Lib/Sound/Record/PitchTracker/CPtDyWa.cs index 2907f1c8..2f21ea0b 100644 --- a/Vocaluxe/Lib/Sound/Record/PitchTracker/CPtDyWa.cs +++ b/Vocaluxe/Lib/Sound/Record/PitchTracker/CPtDyWa.cs @@ -1,10 +1,27 @@ -using System; +#region license +// This file is part of Vocaluxe. +// +// Vocaluxe is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Vocaluxe is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with Vocaluxe. If not, see . +#endregion + +using System; using System.Runtime.InteropServices; namespace Vocaluxe.Lib.Sound.Record.PitchTracker { /// - /// Pitchtracker (Pt) that uses a dynamic wavelet (DyWa) algorithm + /// Pitchtracker (Pt) that uses a dynamic wavelet (DyWa) algorithm /// class CPtDyWa : CPitchTracker { diff --git a/Vocaluxe/Lib/Sound/Record/PitchTracker/CPtSharp.cs b/Vocaluxe/Lib/Sound/Record/PitchTracker/CPtSharp.cs deleted file mode 100644 index 9f73b0f2..00000000 --- a/Vocaluxe/Lib/Sound/Record/PitchTracker/CPtSharp.cs +++ /dev/null @@ -1,54 +0,0 @@ -using System; - -namespace Vocaluxe.Lib.Sound.Record.PitchTracker -{ - /// - /// Pitchtracker (Pt) in C# that uses IIR filters for smoothing and an intelligent detection algorithm to reduce calculations - /// DO NOT USE in 32 Bit! Due to floating point errors the filter will raise all values to NAN (TODO: FIX it!) - /// - class CPtSharp : CPitchTracker - { - private Pitch.PitchTracker _Instance; - - public CPtSharp() - { - _Instance = new Pitch.PitchTracker {SampleRate = 44100, DetectLevelThreshold = 0.01f, PitchRecordHistorySize = 1}; - } - - public override void Input(byte[] data) - { - short[] samplesShort = new short[data.Length / 2]; - Buffer.BlockCopy(data, 0, samplesShort, 0, data.Length); - float[] samplesFloat = new float[samplesShort.Length]; - for (int i = 0; i < samplesShort.Length; i++) - samplesFloat[i] = (float)samplesShort[i] / short.MaxValue; - _Instance.ProcessBuffer(samplesFloat); - } - - public override int GetNote(out float maxVolume, float[] weights) - { - int note = _Instance.CurrentPitchRecord.MidiNote - 15 - 21; - maxVolume = _Instance.LastMaxVol; - _SetWeights(note, weights); - return note; - } - - public override int GetNumHalfTones() - { - return NumHalfTonesDef; - } - - public override float VolumeTreshold - { - get { return _Instance.DetectLevelThreshold; } - set { _Instance.DetectLevelThreshold = value; } - } - - protected override void _Dispose(bool disposing) - { - if (_Instance == null) - throw new ObjectDisposedException(GetType().Name); - _Instance = null; - } - } -} \ No newline at end of file diff --git a/Vocaluxe/Lib/Sound/Record/PitchTracker/IPitchTracker.cs b/Vocaluxe/Lib/Sound/Record/PitchTracker/IPitchTracker.cs index 94c4876f..15f95bea 100644 --- a/Vocaluxe/Lib/Sound/Record/PitchTracker/IPitchTracker.cs +++ b/Vocaluxe/Lib/Sound/Record/PitchTracker/IPitchTracker.cs @@ -1,11 +1,28 @@ -using System; +#region license +// This file is part of Vocaluxe. +// +// Vocaluxe is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Vocaluxe is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with Vocaluxe. If not, see . +#endregion + +using System; using System.Diagnostics; namespace Vocaluxe.Lib.Sound.Record.PitchTracker { /// - /// Base class/Interface for pitch detectors - /// Most likely some structures or system resources are used, hence it should be disposed if no longer needed + /// Base class/Interface for pitch detectors + /// Most likely some structures or system resources are used, hence it should be disposed if no longer needed /// abstract class CPitchTracker : IDisposable { @@ -26,8 +43,8 @@ namespace Vocaluxe.Lib.Sound.Record.PitchTracker } /// - /// Method to set weights if the algorithm does not provide anything that could simulate a visualizer. - /// Should be called with each valid detection + /// Method to set weights if the algorithm does not provide anything that could simulate a visualizer. + /// Should be called with each valid detection /// /// Current note /// Array of weights (Length = NumHalfTonesDef) @@ -43,30 +60,32 @@ namespace Vocaluxe.Lib.Sound.Record.PitchTracker } /// - /// Gets the number of half tones the algorithm provides weights for. - /// This may not be the number of half tones the algorithm detects! + /// Gets the number of half tones the algorithm provides weights for. + /// This may not be the number of half tones the algorithm detects! /// /// public abstract int GetNumHalfTones(); /// - /// The treshold for detecting silence - /// Value (0-1) for which everything below is considered silence + /// The treshold for detecting silence + /// Value (0-1) for which everything below is considered silence /// public abstract float VolumeTreshold { get; set; } /// - /// Recorded data. Has to be 16 bit short values. + /// Recorded data. Has to be 16 bit short values. /// /// 16bit short values of data public abstract void Input(byte[] data); /// - /// Returns the current note detected + /// Returns the current note detected /// /// Current maximum volume (0-1) - /// Array of NumHalfTones floats that gets filled with the current weights (0-1) where each value indicates how strong that tone is. - /// Only for basic visualization as it may not be accurate. + /// + /// Array of NumHalfTones floats that gets filled with the current weights (0-1) where each value indicates how strong that tone is. + /// Only for basic visualization as it may not be accurate. + /// /// Current note index (0 = C2, 12 = C3, ...) public abstract int GetNote(out float maxVolume, float[] weights); } diff --git a/Vocaluxe/Lib/Sound/Record/PitchTracker/Pitch/CircularBuffer.cs b/Vocaluxe/Lib/Sound/Record/PitchTracker/Pitch/CircularBuffer.cs deleted file mode 100644 index 07b6836b..00000000 --- a/Vocaluxe/Lib/Sound/Record/PitchTracker/Pitch/CircularBuffer.cs +++ /dev/null @@ -1,173 +0,0 @@ -using System; - -namespace Vocaluxe.Lib.Sound.Record.PitchTracker.Pitch -{ - public class CircularBuffer : IDisposable - { - int m_bufSize; - int m_begBufOffset; - int m_availBuf; - long m_startPos; // total circular buffer position - T[] m_buffer; - - /// - /// Constructor - /// - public CircularBuffer() - { - } - - /// - /// Constructor - /// - /// - public CircularBuffer(int bufCount) - { - SetSize(bufCount); - } - - /// - /// Dispose - /// - public void Dispose() - { - SetSize(0); - } - - /// - /// Reset to the beginning of the buffer - /// - public void Reset() - { - m_begBufOffset = 0; - m_availBuf = 0; - m_startPos = 0; - } - - /// - /// Set the buffer to the specified size - /// - /// - public void SetSize(int newSize) - { - Reset(); - - if (m_bufSize == newSize) - return; - - if (m_buffer != null) - m_buffer = null; - - m_bufSize = newSize; - - if (m_bufSize > 0) - m_buffer = new T[m_bufSize]; - } - - /// - /// Clear the buffer - /// - public void Clear() - { - Array.Clear(m_buffer, 0, m_buffer.Length); - } - - /// - /// Get or set the start position - /// - public long StartPosition - { - get { return m_startPos; } - set { m_startPos = value; } - } - - /// - /// Get the end position - /// - public long EndPosition - { - get { return m_startPos + m_availBuf; } - } - - /// - /// Get or set the amount of avaliable space - /// - public int Available - { - get { return m_availBuf; } - set { m_availBuf = Math.Min(value, m_bufSize); } - } - - /// - /// Write data into the buffer - /// - /// - /// - /// - public int WriteBuffer(T[] m_pInBuffer, int count) - { - count = Math.Min(count, m_bufSize); - - var startPos = m_availBuf != m_bufSize ? m_availBuf : m_begBufOffset; - var pass1Count = Math.Min(count, m_bufSize - startPos); - var pass2Count = count - pass1Count; - - PitchDsp.CopyBuffer(m_pInBuffer, 0, m_buffer, startPos, pass1Count); - - if (pass2Count > 0) - PitchDsp.CopyBuffer(m_pInBuffer, pass1Count, m_buffer, 0, pass2Count); - - if (pass2Count == 0) - { - // did not wrap around - if (m_availBuf != m_bufSize) - m_availBuf += count; // have never wrapped around - else - { - m_begBufOffset += count; - m_startPos += count; - } - } - else - { - // wrapped around - if (m_availBuf != m_bufSize) - m_startPos += pass2Count; // first time wrap-around - else - m_startPos += count; - - m_begBufOffset = pass2Count; - m_availBuf = m_bufSize; - } - - return count; - } - - /// - /// Read from the buffer - /// - /// - /// - /// - /// - public bool ReadBuffer(T[] outBuffer, long startRead, int readCount) - { - var endRead = (int)(startRead + readCount); - var endAvail = (int)(m_startPos + m_availBuf); - - if (startRead < m_startPos || endRead > endAvail) - return false; - - var startReadPos = (int)(((startRead - m_startPos) + m_begBufOffset) % m_bufSize); - var block1Samples = Math.Min(readCount, m_bufSize - startReadPos); - var block2Samples = readCount - block1Samples; - - PitchDsp.CopyBuffer(m_buffer, startReadPos, outBuffer, 0, block1Samples); - - if (block2Samples > 0) - PitchDsp.CopyBuffer(m_buffer, 0, outBuffer, block1Samples, block2Samples); - - return true; - } - } -} diff --git a/Vocaluxe/Lib/Sound/Record/PitchTracker/Pitch/Extensions.cs b/Vocaluxe/Lib/Sound/Record/PitchTracker/Pitch/Extensions.cs deleted file mode 100644 index 4cbd7c81..00000000 --- a/Vocaluxe/Lib/Sound/Record/PitchTracker/Pitch/Extensions.cs +++ /dev/null @@ -1,105 +0,0 @@ -using System; - -namespace Vocaluxe.Lib.Sound.Record.PitchTracker.Pitch -{ - public static class Extensions - { - /// - /// Clear the buffer - /// - /// - /// - public static void Clear(this float[] buffer) - { - Array.Clear(buffer, 0, buffer.Length); - } - - /// - /// Clear the buffer - /// - /// - /// - public static void Clear(this double[] buffer) - { - Array.Clear(buffer, 0, buffer.Length); - } - - /// - /// Copy the values from one buffer to a different or the same buffer. - /// It is safe to copy to the same buffer, even if the areas overlap - /// - /// - /// - /// - /// - public static void Copy(this float[] fromBuffer, float[] toBuffer, int fromStart, int toStart, int length) - { - if (toBuffer == null || fromBuffer.Length == 0 || toBuffer.Length == 0) - return; - - int fromBegIdx = fromStart; - int fromEndIdx = fromStart + length; - int toBegIdx = toStart; - int toEndIdx = toStart + length; - - if (fromBegIdx < 0) - { - toBegIdx -= fromBegIdx; - fromBegIdx = 0; - } - - if (toBegIdx < 0) - { - fromBegIdx -= toBegIdx; - toBegIdx = 0; - } - - if (fromEndIdx >= fromBuffer.Length) - { - toEndIdx -= fromEndIdx - fromBuffer.Length + 1; - fromEndIdx = fromBuffer.Length - 1; - } - - if (toEndIdx >= toBuffer.Length) - { - fromEndIdx -= toEndIdx - toBuffer.Length + 1; - toEndIdx = fromBuffer.Length - 1; - } - - if (fromBegIdx < toBegIdx) - { - // Shift right, so start at the right - for (int fromIdx = fromEndIdx, toIdx = toEndIdx; fromIdx >= fromBegIdx; fromIdx--, toIdx--) - toBuffer[toIdx] = fromBuffer[fromIdx]; - } - else - { - // Shift left, so start at the left - for (int fromIdx = fromBegIdx, toIdx = toBegIdx; fromIdx <= fromEndIdx; fromIdx++, toIdx++) - toBuffer[toIdx] = fromBuffer[fromIdx]; - } - } - - /// - /// - /// - /// - /// - public static void Clear(this float[] buffer, int startIdx, int endIdx) - { - Array.Clear(buffer, startIdx, endIdx - startIdx + 1); - } - - /// - /// Fill the buffer with the specified value - /// - /// - /// - /// - public static void Fill(this double[] buffer, double value) - { - for (int idx = 0; idx < buffer.Length; idx++) - buffer[idx] = value; - } - } -} \ No newline at end of file diff --git a/Vocaluxe/Lib/Sound/Record/PitchTracker/Pitch/IIRFilter.cs b/Vocaluxe/Lib/Sound/Record/PitchTracker/Pitch/IIRFilter.cs deleted file mode 100644 index e180ff72..00000000 --- a/Vocaluxe/Lib/Sound/Record/PitchTracker/Pitch/IIRFilter.cs +++ /dev/null @@ -1,613 +0,0 @@ -using System; - -namespace Vocaluxe.Lib.Sound.Record.PitchTracker.Pitch -{ - /// - /// Infinite impulse response filter (old style analog filters) - /// - class IIRFilter - { - /// - /// The type of filter - /// - public enum FilterType - { - None = 0, - LP, - HP, - BP - } - - /// - /// The filter prototype - /// - public enum ProtoType - { - None = 0, - Butterworth, - Chebyshev, - } - - const int kHistMask = 31; - const int kHistSize = 32; - - private int m_order; - private ProtoType m_protoType; - private FilterType m_filterType; - - private float m_fp1; - private float m_fp2; - private float m_fN; - private float m_ripple; - private float m_sampleRate; - private double[] m_real; - private double[] m_imag; - private double[] m_z; - private double[] m_aCoeff; - private double[] m_bCoeff; - private double[] m_inHistory; - private double[] m_outHistory; - private int m_histIdx; - private bool m_invertDenormal; - - public IIRFilter() - { - } - - /// - /// Returns true if all the filter parameters are valid - /// - public bool FilterValid - { - get - { - if (m_order < 1 || m_order > 16 || - m_protoType == ProtoType.None || - m_filterType == FilterType.None || - m_sampleRate <= 0.0f || - m_fN <= 0.0f) - return false; - - switch (m_filterType) - { - case FilterType.LP: - if (m_fp2 <= 0.0f) - return false; - break; - - case FilterType.BP: - if (m_fp1 <= 0.0f || m_fp2 <= 0.0f || m_fp1 >= m_fp2) - return false; - break; - - case FilterType.HP: - if (m_fp1 <= 0.0f) - return false; - break; - } - - // For bandpass, the order must be even - if (m_filterType == FilterType.BP && (m_order & 1) != 0) - return false; - - return true; - } - } - - /// - /// Set the filter prototype - /// - public ProtoType Proto - { - get { return m_protoType; } - - set - { - m_protoType = value; - Design(); - } - } - - /// - /// Set the filter type - /// - public FilterType Type - { - get { return m_filterType; } - - set - { - m_filterType = value; - Design(); - } - } - - public int Order - { - get { return m_order; } - - set - { - m_order = Math.Min(16, Math.Max(1, Math.Abs(value))); - - if (m_filterType == FilterType.BP && Odd(m_order)) - m_order++; - - Design(); - } - } - - public float SampleRate - { - get { return m_sampleRate; } - - set - { - m_sampleRate = value; - m_fN = 0.5f * m_sampleRate; - Design(); - } - } - - public float FreqLow - { - get { return m_fp1; } - - set - { - m_fp1 = value; - Design(); - } - } - - public float FreqHigh - { - get { return m_fp2; } - - set - { - m_fp2 = value; - Design(); - } - } - - public float Ripple - { - get { return m_ripple; } - - set - { - m_ripple = value; - Design(); - } - } - - /// - /// Returns true if n is odd - /// - /// - /// - private bool Odd(int n) - { - return (n & 1) == 1; - } - - /// - /// Square - /// - /// - /// - private float Sqr(float value) - { - return value * value; - } - - /// - /// Square - /// - /// - /// - private double Sqr(double value) - { - return value * value; - } - - /// - /// Determines poles and zeros of IIR filter - /// based on bilinear transform method - /// - private void LocatePolesAndZeros() - { - m_real = new double[m_order + 1]; - m_imag = new double[m_order + 1]; - m_z = new double[m_order + 1]; - double ln10 = Math.Log(10.0); - - // Butterworth, Chebyshev parameters - int n = m_order; - - if (m_filterType == FilterType.BP) - n = n / 2; - - int ir = n % 2; - int n1 = n + ir; - int n2 = (3 * n + ir) / 2 - 1; - double f1; - - switch (m_filterType) - { - case FilterType.LP: - f1 = m_fp2; - break; - - case FilterType.HP: - f1 = m_fN - m_fp1; - break; - - case FilterType.BP: - f1 = m_fp2 - m_fp1; - break; - - default: - f1 = 0.0; - break; - } - - double tanw1 = Math.Tan(0.5 * Math.PI * f1 / m_fN); - double tansqw1 = Sqr(tanw1); - - // Real and Imaginary parts of low-pass poles - double t, a = 1.0, r = 1.0, i = 1.0; - - for (int k = n1; k <= n2; k++) - { - t = 0.5 * (2 * k + 1 - ir) * Math.PI / (double)n; - - switch (m_protoType) - { - case ProtoType.Butterworth: - double b3 = 1.0 - 2.0 * tanw1 * Math.Cos(t) + tansqw1; - r = (1.0 - tansqw1) / b3; - i = 2.0 * tanw1 * Math.Sin(t) / b3; - break; - - case ProtoType.Chebyshev: - double d = 1.0 - Math.Exp(-0.05 * m_ripple * ln10); - double e = 1.0 / Math.Sqrt(1.0 / Sqr(1.0 - d) - 1.0); - double x = Math.Pow(Math.Sqrt(e * e + 1.0) + e, 1.0 / (double)n); - a = 0.5 * (x - 1.0 / x); - double b = 0.5 * (x + 1.0 / x); - double c3 = a * tanw1 * Math.Cos(t); - double c4 = b * tanw1 * Math.Sin(t); - double c5 = Sqr(1.0 - c3) + Sqr(c4); - r = 2.0 * (1.0 - c3) / c5 - 1.0; - i = 2.0 * c4 / c5; - break; - } - - int m = 2 * (n2 - k) + 1; - m_real[m + ir] = r; - m_imag[m + ir] = Math.Abs(i); - m_real[m + ir + 1] = r; - m_imag[m + ir + 1] = -Math.Abs(i); - } - - if (Odd(n)) - { - if (m_protoType == ProtoType.Butterworth) - r = (1.0 - tansqw1) / (1.0 + 2.0 * tanw1 + tansqw1); - - if (m_protoType == ProtoType.Chebyshev) - r = 2.0 / (1.0 + a * tanw1) - 1.0; - - m_real[1] = r; - m_imag[1] = 0.0; - } - - switch (m_filterType) - { - case FilterType.LP: - for (int m = 1; m <= n; m++) - m_z[m] = -1.0; - break; - - case FilterType.HP: - // Low-pass to high-pass transformation - for (int m = 1; m <= n; m++) - { - m_real[m] = -m_real[m]; - m_z[m] = 1.0; - } - break; - - case FilterType.BP: - // Low-pass to bandpass transformation - for (int m = 1; m <= n; m++) - { - m_z[m] = 1.0; - m_z[m + n] = -1.0; - } - - double f4 = 0.5 * Math.PI * m_fp1 / m_fN; - double f5 = 0.5 * Math.PI * m_fp2 / m_fN; - double aa = Math.Cos(f4 + f5) / Math.Cos(f5 - f4); - double aR, aI, h1, h2, p1R, p2R, p1I, p2I; - - for (int m1 = 0; m1 <= (m_order - 1) / 2; m1++) - { - int m = 1 + 2 * m1; - aR = m_real[m]; - aI = m_imag[m]; - - if (Math.Abs(aI) < 0.0001) - { - h1 = 0.5 * aa * (1.0 + aR); - h2 = Sqr(h1) - aR; - if (h2 > 0.0) - { - p1R = h1 + Math.Sqrt(h2); - p2R = h1 - Math.Sqrt(h2); - p1I = 0.0; - p2I = 0.0; - } - else - { - p1R = h1; - p2R = h1; - p1I = Math.Sqrt(Math.Abs(h2)); - p2I = -p1I; - } - } - else - { - double fR = aa * 0.5 * (1.0 + aR); - double fI = aa * 0.5 * aI; - double gR = Sqr(fR) - Sqr(fI) - aR; - double gI = 2 * fR * fI - aI; - double sR = Math.Sqrt(0.5 * Math.Abs(gR + Math.Sqrt(Sqr(gR) + Sqr(gI)))); - double sI = gI / (2.0 * sR); - p1R = fR + sR; - p1I = fI + sI; - p2R = fR - sR; - p2I = fI - sI; - } - - m_real[m] = p1R; - m_real[m + 1] = p2R; - m_imag[m] = p1I; - m_imag[m + 1] = p2I; - } - - if (Odd(n)) - { - m_real[2] = m_real[n + 1]; - m_imag[2] = m_imag[n + 1]; - } - - for (int k = n; k >= 1; k--) - { - int m = 2 * k - 1; - m_real[m] = m_real[k]; - m_real[m + 1] = m_real[k]; - m_imag[m] = Math.Abs(m_imag[k]); - m_imag[m + 1] = -Math.Abs(m_imag[k]); - } - - break; - } - } - - /// - /// Calculate all the values - /// - public void Design() - { - if (!this.FilterValid) - return; - - m_aCoeff = new double[m_order + 1]; - m_bCoeff = new double[m_order + 1]; - m_inHistory = new double[kHistSize]; - m_outHistory = new double[kHistSize]; - - double[] newA = new double[m_order + 1]; - double[] newB = new double[m_order + 1]; - - // Find filter poles and zeros - LocatePolesAndZeros(); - - // Compute filter coefficients from pole/zero values - m_aCoeff[0] = 1.0; - m_bCoeff[0] = 1.0; - - for (int i = 1; i <= m_order; i++) - { - m_aCoeff[i] = 0.0; - m_bCoeff[i] = 0.0; - } - - int k = 0; - int n = m_order; - int pairs = n / 2; - - if (Odd(m_order)) - { - // First subfilter is first order - m_aCoeff[1] = -m_z[1]; - m_bCoeff[1] = -m_real[1]; - k = 1; - } - - for (int p = 1; p <= pairs; p++) - { - int m = 2 * p - 1 + k; - double alpha1 = -(m_z[m] + m_z[m + 1]); - double alpha2 = m_z[m] * m_z[m + 1]; - double beta1 = -2.0 * m_real[m]; - double beta2 = Sqr(m_real[m]) + Sqr(m_imag[m]); - - newA[1] = m_aCoeff[1] + alpha1 * m_aCoeff[0]; - newB[1] = m_bCoeff[1] + beta1 * m_bCoeff[0]; - - for (int i = 2; i <= n; i++) - { - newA[i] = m_aCoeff[i] + alpha1 * m_aCoeff[i - 1] + alpha2 * m_aCoeff[i - 2]; - newB[i] = m_bCoeff[i] + beta1 * m_bCoeff[i - 1] + beta2 * m_bCoeff[i - 2]; - } - - for (int i = 1; i <= n; i++) - { - m_aCoeff[i] = newA[i]; - m_bCoeff[i] = newB[i]; - } - } - - // Ensure the filter is normalized - FilterGain(1000); - } - - /// - /// Reset the history buffers - /// - public void Reset() - { - if (m_inHistory != null) - m_inHistory.Clear(); - - if (m_outHistory != null) - m_outHistory.Clear(); - - m_histIdx = 0; - } - - /// - /// Reset the filter, and fill the appropriate history buffers with the specified value - /// - /// - public void Reset(double startValue) - { - m_histIdx = 0; - - if (m_inHistory == null || m_outHistory == null) - return; - - m_inHistory.Fill(startValue); - - if (m_inHistory != null) - { - switch (m_filterType) - { - case FilterType.LP: - m_outHistory.Fill(startValue); - break; - - default: - m_outHistory.Clear(); - break; - } - } - } - - /// - /// Apply the filter to the buffer - /// - /// - public void FilterBuffer(float[] srcBuf, long srcPos, float[] dstBuf, long dstPos, long nLen) - { - const double kDenormal = 0.000000000000001; - double denormal = m_invertDenormal ? -kDenormal : kDenormal; - m_invertDenormal = !m_invertDenormal; - - for (int sampleIdx = 0; sampleIdx < nLen; sampleIdx++) - { - double sum = 0.0f; - - m_inHistory[m_histIdx] = srcBuf[srcPos + sampleIdx] + denormal; - - for (int idx = 0; idx < m_aCoeff.Length; idx++) - sum += m_aCoeff[idx] * m_inHistory[(m_histIdx - idx) & kHistMask]; - - for (int idx = 1; idx < m_bCoeff.Length; idx++) - sum -= m_bCoeff[idx] * m_outHistory[(m_histIdx - idx) & kHistMask]; - - m_outHistory[m_histIdx] = sum; - m_histIdx = (m_histIdx + 1) & kHistMask; - dstBuf[dstPos + sampleIdx] = (float)sum; - } - } - - public float FilterSample(float inVal) - { - double sum = 0.0f; - - m_inHistory[m_histIdx] = inVal; - - for (int idx = 0; idx < m_aCoeff.Length; idx++) - sum += m_aCoeff[idx] * m_inHistory[(m_histIdx - idx) & kHistMask]; - - for (int idx = 1; idx < m_bCoeff.Length; idx++) - sum -= m_bCoeff[idx] * m_outHistory[(m_histIdx - idx) & kHistMask]; - - m_outHistory[m_histIdx] = sum; - m_histIdx = (m_histIdx + 1) & kHistMask; - - return (float)sum; - } - - /// - /// Get the gain at the specified number of frequency points - /// - /// - /// - public float[] FilterGain(int freqPoints) - { - // Filter gain at uniform frequency intervals - float[] g = new float[freqPoints]; - double theta, s, c, sac, sas, sbc, sbs; - float gMax = -100.0f; - float sc = 10.0f / (float)Math.Log(10.0f); - double t = Math.PI / (freqPoints - 1); - - for (int i = 0; i < freqPoints; i++) - { - theta = i * t; - - if (i == 0) - theta = Math.PI * 0.0001; - - if (i == freqPoints - 1) - theta = Math.PI * 0.9999; - - sac = 0.0f; - sas = 0.0f; - sbc = 0.0f; - sbs = 0.0f; - - for (int k = 0; k <= m_order; k++) - { - c = Math.Cos(k * theta); - s = Math.Sin(k * theta); - sac += c * m_aCoeff[k]; - sas += s * m_aCoeff[k]; - sbc += c * m_bCoeff[k]; - sbs += s * m_bCoeff[k]; - } - - g[i] = sc * (float)Math.Log((Sqr(sac) + Sqr(sas)) / (Sqr(sbc) + Sqr(sbs))); - gMax = Math.Max(gMax, g[i]); - } - - // Normalize to 0 dB maximum gain - for (int i = 0; i < freqPoints; i++) - g[i] -= gMax; - - // Normalize numerator (a) coefficients - float normFactor = (float)Math.Pow(10.0, -0.05 * gMax); - - for (int i = 0; i <= m_order; i++) - m_aCoeff[i] *= normFactor; - - return g; - } - } -} diff --git a/Vocaluxe/Lib/Sound/Record/PitchTracker/Pitch/PitchDsp.cs b/Vocaluxe/Lib/Sound/Record/PitchTracker/Pitch/PitchDsp.cs deleted file mode 100644 index 3fc22ee6..00000000 --- a/Vocaluxe/Lib/Sound/Record/PitchTracker/Pitch/PitchDsp.cs +++ /dev/null @@ -1,561 +0,0 @@ -using System; - -namespace Vocaluxe.Lib.Sound.Record.PitchTracker.Pitch -{ - /// - /// Pitch related DSP - /// - public class PitchDsp - { - public static readonly double InverseLog2 = 1.0 / Math.Log10(2.0); - - private const int kCourseOctaveSteps = 96; - private const int kScanHiSize = 31; - private const float kScanHiFreqStep = 1.005f; - private const int kMinMidiNote = 21; // A0 - private const int kMaxMidiNote = 108; // C8 - - private float m_minPitch; - private float m_maxPitch; - private int m_minNote; - private int m_maxNote; - private int m_blockLen14; // 1/4 block len - private int m_blockLen24; // 2/4 block len - private int m_blockLen34; // 3/4 block len - private int m_blockLen44; // 4/4 block len - private double m_sampleRate; - - private int m_numCourseSteps; - private float[] m_pCourseFreqOffset; - private float[] m_pCourseFreq; - private float[] m_scanHiOffset = new float[kScanHiSize]; - private float[] m_peakBuf = new float[kScanHiSize]; - private int m_prevPitchIdx; - private float[] m_detectCurve; - - /// - /// Constructor - /// - /// - /// - /// - /// - public PitchDsp(double sampleRate, float minPitch, float maxPitch) - { - m_sampleRate = sampleRate; - m_minPitch = minPitch; - m_maxPitch = maxPitch; - - m_minNote = (int)(PitchToMidiNote(m_minPitch) + 0.5f) + 2; - m_maxNote = (int)(PitchToMidiNote(m_maxPitch) + 0.5f) - 2; - - m_blockLen44 = (int)(m_sampleRate / m_minPitch + 0.5f); - m_blockLen34 = (m_blockLen44 * 3) / 4; - m_blockLen24 = m_blockLen44 / 2; - m_blockLen14 = m_blockLen44 / 4; - - m_numCourseSteps = (int)((Math.Log((double)m_maxPitch / (double)m_minPitch) / Math.Log(2.0)) * kCourseOctaveSteps + 0.5) + 3; - - m_pCourseFreqOffset = new float[m_numCourseSteps + 10000]; - m_pCourseFreq = new float[m_numCourseSteps + 10000]; - - m_detectCurve = new float[m_numCourseSteps]; - - double freqStep = 1.0 / Math.Pow(2.0, 1.0 / kCourseOctaveSteps); - double curFreq = m_maxPitch / freqStep; - - // frequency is stored from high to low - for (int idx = 0; idx < m_numCourseSteps; idx++) - { - m_pCourseFreq[idx] = (float)curFreq; - m_pCourseFreqOffset[idx] = (float)(m_sampleRate / curFreq); - curFreq *= freqStep; - } - - for (int idx = 0; idx < kScanHiSize; idx++) - m_scanHiOffset[idx] = (float)Math.Pow(kScanHiFreqStep, (kScanHiSize / 2) - idx); - } - - /// - /// Get the max detected pitch - /// - public float MaxPitch - { - get { return m_maxPitch; } - } - - /// - /// Get the min detected pitch - /// - public float MinPitch - { - get { return m_minPitch; } - } - - /// - /// Get the max note - /// - public int MaxNote - { - get { return m_maxNote; } - } - - /// - /// Get the min note - /// - public int MinNote - { - get { return m_minNote; } - } - - /// - /// Detect the pitch - /// - public float DetectPitch(float[] samplesLo, float[] samplesHi) - { - return DetectPitchLo(samplesLo, samplesHi); - } - - /// - /// Low resolution pitch detection - /// - /// - /// - /// - /// - /// - /// - private float DetectPitchLo(float[] samplesLo, float[] samplesHi) - { - m_detectCurve.Clear(); - - const int skipSize = 8; - const int peakScanSize = 23; - const int peakScanSizeHalf = peakScanSize / 2; - - float peakThresh1 = 200.0f; - float peakThresh2 = 600.0f; - bool bufferSwitched = false; - - for (int idx = 0; idx < m_numCourseSteps; idx += skipSize) - { - int blockLen = Math.Min(m_blockLen44, (int)m_pCourseFreqOffset[idx] * 2); - float[] curSamples = null; - - // 258 is at 250 Hz, which is the switchover frequency for the two filters - bool loBuffer = idx >= 258; - - if (loBuffer) - { - if (!bufferSwitched) - { - m_detectCurve.Clear(258 - peakScanSizeHalf, 258 + peakScanSizeHalf); - bufferSwitched = true; - } - - curSamples = samplesLo; - } - else - curSamples = samplesHi; - - int stepSizeLoRes = blockLen / 10; - int stepSizeHiRes = Math.Max(1, Math.Min(5, idx * 5 / m_numCourseSteps)); - - float fValue = RatioAbsDiffLinear(curSamples, idx, blockLen, stepSizeLoRes, false); - - if (fValue > peakThresh1) - { - // Do a closer search for the peak - int peakIdx = -1; - float peakVal = 0.0f; - float prevVal = 0.0f; - int dir = 4; // start going forward - int curPos = idx; // start at center of the scan range - int begSearch = Math.Max(idx - peakScanSizeHalf, 0); - int endSearch = Math.Min(idx + peakScanSizeHalf, m_numCourseSteps - 1); - - while (curPos >= begSearch && curPos < endSearch) - { - float curVal = RatioAbsDiffLinear(curSamples, curPos, blockLen, stepSizeHiRes, true); - - if (peakVal < curVal) - { - peakVal = curVal; - peakIdx = curPos; - } - - if (prevVal > curVal) - { - dir = -dir >> 1; - - if (dir == 0) - { - if (peakVal > peakThresh2 && peakIdx >= 6 && peakIdx <= m_numCourseSteps - 7) - { - float fValL = RatioAbsDiffLinear(curSamples, peakIdx - 5, blockLen, stepSizeHiRes, true); - float fValR = RatioAbsDiffLinear(curSamples, peakIdx + 5, blockLen, stepSizeHiRes, true); - float fPointy = peakVal / (fValL + fValR) * 2.0f; - - float minPointy = (m_prevPitchIdx > 0 && Math.Abs(m_prevPitchIdx - peakIdx) < 10) ? 1.2f : 1.5f; - - if (fPointy > minPointy) - { - float pitchHi = DetectPitchHi(curSamples, peakIdx); - - if (pitchHi > 1.0f) - { - m_prevPitchIdx = peakIdx; - return pitchHi; - } - } - } - - break; - } - } - - prevVal = curVal; - curPos += dir; - } - } - } - - m_prevPitchIdx = 0; - return 0.0f; - } - - /// - /// High resolution pitch detection - /// - /// - /// - /// - private float DetectPitchHi(float[] samples, int lowFreqIdx) - { - int peakIdx = -1; - float prevVal = 0.0f; - int dir = 4; // start going forward - int curPos = kScanHiSize >> 1; // start at center of the scan range - - m_peakBuf.Clear(); - - float offset = m_pCourseFreqOffset[lowFreqIdx]; - - while (curPos >= 0 && curPos < kScanHiSize) - { - if (m_peakBuf[curPos] == 0.0f) - m_peakBuf[curPos] = SumAbsDiffHermite(samples, offset * m_scanHiOffset[curPos], m_blockLen44, 1); - - if (peakIdx < 0 || m_peakBuf[peakIdx] < m_peakBuf[curPos]) - peakIdx = curPos; - - if (prevVal > m_peakBuf[curPos]) - { - dir = -dir >> 1; - - if (dir == 0) - { - // found the peak - float minVal = Math.Min(m_peakBuf[peakIdx - 1], m_peakBuf[peakIdx + 1]); - - minVal -= minVal * (1.0f / 32.0f); - - var y1 = (float)Math.Log10(m_peakBuf[peakIdx - 1] - minVal); - var y2 = (float)Math.Log10(m_peakBuf[peakIdx] - minVal); - var y3 = (float)Math.Log10(m_peakBuf[peakIdx + 1] - minVal); - - float fIdx = (float)peakIdx + (y3 - y1) / (2.0f * (2.0f * y2 - y1 - y3)); - - return (float)Math.Pow(kScanHiFreqStep, fIdx - (kScanHiSize / 2)) * m_pCourseFreq[lowFreqIdx]; - } - } - - prevVal = m_peakBuf[curPos]; - curPos += dir; - } - - return 0.0f; - } - - /// - /// Create a sine wave with the specified frequency, amplitude and starting angle. - /// Returns the updated angle. - /// - /// - /// - /// - /// - /// - /// - public static double CreateSineWave(float[] buffer, int numSamples, float sampleRate, - float freq, float amplitude, double startAngle) - { - double angleStep = freq / sampleRate * Math.PI * 2.0; - double curAngle = startAngle; - - for (int idx = 0; idx < numSamples; idx++) - { - buffer[idx] = (float)Math.Sin(curAngle) * amplitude; - - curAngle += angleStep; - - while (curAngle > Math.PI) - curAngle -= Math.PI * 2.0; - } - - return curAngle; - } - - /// - /// Returns true if the level is above the specified value - /// - /// - /// - /// - /// - /// - public bool LevelIsAbove(float[] buffer, int len, float level) - { - if (buffer == null || buffer.Length == 0) - return false; - - int endIdx = Math.Min(buffer.Length, len); - - for (int idx = 0; idx < endIdx; idx++) - { - if (Math.Abs(buffer[idx]) >= level) - return true; - } - - return false; - } - - /// - /// Copy the data from the source to the destination buffer - /// - /// - /// - /// - /// - public static void CopyBuffer(T[] source, int srcStart, T[] destination, int dstStart, int length) - { - if (length < 0) - throw new ArgumentOutOfRangeException("length"); - - if (source == null || source.Length < srcStart + length) - throw new Exception("Source buffer is null or not large enough"); - - if (destination == null || destination.Length < dstStart + length) - throw new Exception("Destination buffer is null or not large enough"); - - int srcIdx = srcStart; - int dstIdx = dstStart; - - for (int idx = 0; idx < length; idx++) - destination[dstIdx++] = source[srcIdx++]; - } - - /// - /// // 4-point, 3rd-order Hermite (x-form) - /// - private float InterpolateHermite(float fY0, float fY1, float fY2, float fY3, float frac) - { - float c1 = 0.5f * (fY2 - fY0); - float c3 = 1.5f * (fY1 - fY2) + 0.5f * (fY3 - fY0); - float c2 = fY0 - fY1 + c1 - c3; - - return ((c3 * frac + c2) * frac + c1) * frac + fY1; - } - - /// - /// Linear interpolation - /// nFrac is based on 1.0 = 256 - /// - private float InterpolateLinear(float y0, float y1, float frac) - { - return y0 * (1.0f - frac) + y1 * frac; - } - - /// - /// Medium Low res SumAbsDiff - /// - private float RatioAbsDiffLinear(float[] samples, int freqIdx, int blockLen, int stepSize, bool hiRes) - { - if (hiRes && m_detectCurve[freqIdx] > 0.0f) - return m_detectCurve[freqIdx]; - - var offsetInt = (int)m_pCourseFreqOffset[freqIdx]; - float offsetFrac = m_pCourseFreqOffset[freqIdx] - offsetInt; - float rect = 0.0f; - float absDiff = 0.01f; // prevent divide by zero - int count = 0; - float interp; - float sample; - - // Do a scan using linear interpolation and the specified step size - for (int idx = 0; idx < blockLen; idx += stepSize, count++) - { - sample = samples[idx]; - interp = InterpolateLinear(samples[offsetInt + idx], samples[offsetInt + idx + 1], offsetFrac); - absDiff += Math.Abs(sample - interp); - rect += Math.Abs(sample) + Math.Abs(interp); - } - - float finalVal = rect / absDiff * 100.0f; - - if (hiRes) - m_detectCurve[freqIdx] = finalVal; - - return finalVal; - } - - /// - /// Medium High res SumAbsDiff - /// - private float SumAbsDiffHermite(float[] samples, float fOffset, int blockLen, int stepSize) - { - var offsetInt = (int)fOffset; - float offsetFrac = fOffset - offsetInt; - float value = 0.001f; // prevent divide by zero - int count = 0; - - // do a scan using linear interpolation and the specified step size - for (int idx = 0; idx < blockLen; idx += stepSize, count++) - { - int offsetIdx = offsetInt + idx; - - value += Math.Abs(samples[idx] - InterpolateHermite(samples[offsetIdx - 1], - samples[offsetIdx], - samples[offsetIdx + 1], - samples[offsetIdx + 2], - offsetFrac)); - } - - return count / value; - } - - /// - /// Get the MIDI note and cents of the pitch - /// - /// - /// - /// - /// - public static bool PitchToMidiNote(float pitch, out int note, out int cents) - { - if (pitch < 20.0f) - { - note = 0; - cents = 0; - return false; - } - - float fNote = (float)((12.0 * Math.Log10(pitch / 55.0) * InverseLog2)) + 33.0f; - note = (int)(fNote + 0.5f); - cents = (int)((note - fNote) * 100); - return true; - } - - /// - /// Get the pitch from the MIDI note - /// - /// - /// - public static float PitchToMidiNote(float pitch) - { - if (pitch < 20.0f) - return 0.0f; - - return (float)(12.0 * Math.Log10(pitch / 55.0) * InverseLog2) + 33.0f; - } - - /// - /// Get the pitch from the MIDI note - /// - /// - /// - public float MidiNoteToPitch(float note) - { - if (note < 33.0f) - return 0.0f; - - float pitch = (float)Math.Pow(10.0, (note - 33.0f) / InverseLog2 / 12.0f) * 55.0f; - return pitch <= m_maxPitch ? pitch : 0.0f; - } - - /// - /// Format a midi note to text - /// - /// - /// - /// - /// - public static string GetNoteName(int note, bool sharps, bool showOctave) - { - if (note < kMinMidiNote || note > kMaxMidiNote) - return null; - - note -= kMinMidiNote; - - int octave = (note + 9) / 12; - note = note % 12; - string noteText = null; - - switch (note) - { - case 0: - noteText = "A"; - break; - - case 1: - noteText = sharps ? "A#" : "Bb"; - break; - - case 2: - noteText = "B"; - break; - - case 3: - noteText = "C"; - break; - - case 4: - noteText = sharps ? "C#" : "Db"; - break; - - case 5: - noteText = "D"; - break; - - case 6: - noteText = sharps ? "D#" : "Eb"; - break; - - case 7: - noteText = "E"; - break; - - case 8: - noteText = "F"; - break; - - case 9: - noteText = sharps ? "F#" : "Gb"; - break; - - case 10: - noteText = "G"; - break; - - case 11: - noteText = sharps ? "G#" : "Ab"; - break; - } - - if (showOctave) - noteText += " " + octave.ToString(); - - return noteText; - } - } -} \ No newline at end of file diff --git a/Vocaluxe/Lib/Sound/Record/PitchTracker/Pitch/PitchTracker.cs b/Vocaluxe/Lib/Sound/Record/PitchTracker/Pitch/PitchTracker.cs deleted file mode 100644 index 59522197..00000000 --- a/Vocaluxe/Lib/Sound/Record/PitchTracker/Pitch/PitchTracker.cs +++ /dev/null @@ -1,431 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Collections; - -namespace Vocaluxe.Lib.Sound.Record.PitchTracker.Pitch -{ - /// - /// Tracks pitch - /// - // ReSharper disable InconsistentNaming - public class PitchTracker - { - private const int kOctaveSteps = 96; - private const int kStepOverlap = 4; - private const float kMinFreq = 50.0f; // A1, Midi note 33, 55.0Hz - private const float kMaxFreq = 1800.0f; // A#6. Midi note 92 - private const int kStartCircular = 40; // how far into the sample buffer do we start checking (allow for filter settling) - private const float kDetectOverlapSec = 0.005f; - private const float kMaxOctaveSecRate = 10.0f; - - private const float kAvgOffset = 0.005f; // time offset between pitch averaging values - private const int kAvgCount = 1; // number of average pitch samples to take - private const float kCircularBufSaveTime = 1.0f; // Amount of samples to store in the history buffer - - private PitchDsp m_dsp; - private CircularBuffer m_circularBufferLo; - private CircularBuffer m_circularBufferHi; - private double m_sampleRate; - private float m_detectLevelThreshold = 0.01f; // -40dB - private int m_pitchRecordsPerSecond = 50; // default is 50, or one record every 20ms - - private float[] m_pitchBufLo; - private float[] m_pitchBufHi; - private int m_pitchBufSize; - private int m_samplesPerPitchBlock; - private int m_curPitchIndex; - private long m_curPitchSamplePos; - - private int m_detectOverlapSamples; - private float m_maxOverlapDiff; - - private bool m_recordPitchRecords; - private int m_pitchRecordHistorySize; - private List m_pitchRecords = new List(); - private PitchRecord m_curPitchRecord = new PitchRecord(); - - private IIRFilter m_iirFilterLoLo; - private IIRFilter m_iirFilterLoHi; - private IIRFilter m_iirFilterHiLo; - private IIRFilter m_iirFilterHiHi; - - public float LastMaxVol = 0; - - public delegate void PitchDetectedHandler(PitchTracker sender, PitchRecord pitchRecord); - - public event PitchDetectedHandler PitchDetected; - - /// - /// Constructor - /// - public PitchTracker() {} - - /// - /// Set the sample rate - /// - public double SampleRate - { - set - { - if (m_sampleRate == value) - return; - - m_sampleRate = value; - Setup(); - } - } - - /// - /// Set the detect level threshold, The value must be between 0.0001f and 1.0f (-80 dB to 0 dB) - /// - public float DetectLevelThreshold - { - set - { - float newValue = Math.Max(0.0001f, Math.Min(1.0f, value)); - - if (m_detectLevelThreshold == newValue) - return; - - m_detectLevelThreshold = newValue; - //Setup(); - } - get { return m_detectLevelThreshold; } - } - - /// - /// Return the samples per pitch block - /// - public int SamplesPerPitchBlock - { - get { return m_samplesPerPitchBlock; } - } - - /// - /// Get or set the number of pitch records per second (default is 50, or one record every 20ms) - /// - public int PitchRecordsPerSecond - { - get { return m_pitchRecordsPerSecond; } - set - { - m_pitchRecordsPerSecond = Math.Max(1, Math.Min(100, value)); - Setup(); - } - } - - /// - /// Get or set whether pitch records should be recorded into a history buffer - /// - public bool RecordPitchRecords - { - get { return m_recordPitchRecords; } - set - { - if (m_recordPitchRecords == value) - return; - - m_recordPitchRecords = value; - - if (!m_recordPitchRecords) - m_pitchRecords = new List(); - } - } - - /// - /// Get or set the max number of pitch records to keep. A value of 0 means no limit. - /// Don't leave this at 0 when RecordPitchRecords is true and this is used in a realtime - /// application since the buffer will grow indefinately! - /// - public int PitchRecordHistorySize - { - get { return m_pitchRecordHistorySize; } - set - { - m_pitchRecordHistorySize = value; - - m_pitchRecords.Capacity = m_pitchRecordHistorySize; - } - } - - /// - /// Get the current pitch records - /// - public IList PitchRecords - { - get { return m_pitchRecords.AsReadOnly(); } - } - - /// - /// Get the latest pitch record - /// - public PitchRecord CurrentPitchRecord - { - get { return m_curPitchRecord; } - } - - /// - /// Get the current pitch position - /// - public long CurrentPitchSamplePosition - { - get { return m_curPitchSamplePos; } - } - - /// - /// Get the minimum frequency that can be detected - /// - public static float MinDetectFrequency - { - get { return kMinFreq; } - } - - /// - /// Get the maximum frequency that can be detected - /// - public static float MaxDetectFrequency - { - get { return kMaxFreq; } - } - - /// - /// Get the frequency step - /// - public static double FrequencyStep - { - get { return Math.Pow(2.0, 1.0 / kOctaveSteps); } - } - - /// - /// Get the number of samples that the detected pitch is offset from the input buffer. - /// This is just an estimate to sync up the samples and detected pitch - /// - public int DetectSampleOffset - { - get { return (m_pitchBufSize + m_detectOverlapSamples) / 2; } - } - - /// - /// Reset the pitch tracker. Call this when the sample position is - /// not consecutive from the previous position - /// - public void Reset() - { - m_curPitchIndex = 0; - m_curPitchSamplePos = 0; - m_pitchRecords.Clear(); - m_iirFilterLoLo.Reset(); - m_iirFilterLoHi.Reset(); - m_iirFilterHiLo.Reset(); - m_iirFilterHiHi.Reset(); - m_circularBufferLo.Reset(); - m_circularBufferLo.Clear(); - m_circularBufferHi.Reset(); - m_circularBufferHi.Clear(); - m_pitchBufLo.Clear(); - m_pitchBufHi.Clear(); - - m_circularBufferLo.StartPosition = -m_detectOverlapSamples; - m_circularBufferLo.Available = m_detectOverlapSamples; - m_circularBufferHi.StartPosition = -m_detectOverlapSamples; - m_circularBufferHi.Available = m_detectOverlapSamples; - } - - /// - /// Process the passed in buffer of data. During this call, the PitchDetected event will - /// be fired zero or more times, depending how many pitch records will fit in the new - /// and previously cached buffer. - /// - /// This means that there is no size restriction on the buffer that is passed into ProcessBuffer. - /// For instance, ProcessBuffer can be called with one very large buffer that contains all of the - /// audio to be processed (many PitchDetected events will be fired), or just a small buffer at - /// a time which is more typical for realtime applications. In the latter case, the PitchDetected - /// event might not be fired at all since additional calls must first be made to accumulate enough - /// data do another pitch detect operation. - /// - /// Input buffer. Samples must be in the range -1.0 to 1.0 - /// - /// Number of samples to process. Zero means all samples in the buffer - public void ProcessBuffer(float[] inBuffer, int sampleCount = 0) - { - if (inBuffer == null) - throw new ArgumentNullException("inBuffer", "Input buffer cannot be null"); - - int samplesProcessed = 0; - int srcLength = sampleCount == 0 ? inBuffer.Length : Math.Min(sampleCount, inBuffer.Length); - - float maxVolume = LastMaxVol * 0.85f; - - while (samplesProcessed < srcLength) - { - int frameCount = Math.Min(srcLength - samplesProcessed, m_pitchBufSize + m_detectOverlapSamples); - - m_iirFilterLoLo.FilterBuffer(inBuffer, samplesProcessed, m_pitchBufLo, 0, frameCount); - m_iirFilterLoHi.FilterBuffer(m_pitchBufLo, 0, m_pitchBufLo, 0, frameCount); - - m_iirFilterHiLo.FilterBuffer(inBuffer, samplesProcessed, m_pitchBufHi, 0, frameCount); - m_iirFilterHiHi.FilterBuffer(m_pitchBufHi, 0, m_pitchBufHi, 0, frameCount); - - m_circularBufferLo.WriteBuffer(m_pitchBufLo, frameCount); - m_circularBufferHi.WriteBuffer(m_pitchBufHi, frameCount); - - // Loop while there is enough samples in the circular buffer - while (m_circularBufferLo.ReadBuffer(m_pitchBufLo, m_curPitchSamplePos, m_pitchBufSize + m_detectOverlapSamples)) - { - float pitch1; - float pitch2; - float detectedPitch = 0.0f; - - m_circularBufferHi.ReadBuffer(m_pitchBufHi, m_curPitchSamplePos, m_pitchBufSize + m_detectOverlapSamples); - - maxVolume = 0f; - for (int i = 0; i < (m_pitchBufSize + m_detectOverlapSamples) / 2; i++) - { - if (maxVolume < m_pitchBufHi[i]) - maxVolume = m_pitchBufHi[i]; - if (maxVolume < m_pitchBufLo[i]) - maxVolume = m_pitchBufLo[i]; - } - - pitch1 = (maxVolume >= m_detectLevelThreshold) ? m_dsp.DetectPitch(m_pitchBufLo, m_pitchBufHi) : 0f; - - if (pitch1 > 0.0f) - { - // Shift the buffers left by the overlapping amount - m_pitchBufLo.Copy(m_pitchBufLo, m_detectOverlapSamples - 1, 0, m_pitchBufSize); - m_pitchBufHi.Copy(m_pitchBufHi, m_detectOverlapSamples - 1, 0, m_pitchBufSize); - - pitch2 = m_dsp.DetectPitch(m_pitchBufLo, m_pitchBufHi); - - if (pitch2 > 0.0f) - { - float fDiff = Math.Max(pitch1, pitch2) / Math.Min(pitch1, pitch2) - 1.0f; - - if (fDiff < m_maxOverlapDiff) - detectedPitch = (pitch1 + pitch2) * 0.5f; - } - } - - // Log the pitch record - AddPitchRecord(detectedPitch); - - m_curPitchSamplePos += m_samplesPerPitchBlock; - m_curPitchIndex++; - } - - samplesProcessed += frameCount; - } - LastMaxVol = maxVolume; - } - - /// - /// Setup - /// - private void Setup() - { - if (m_sampleRate < 1.0f) - return; - - m_dsp = new PitchDsp(m_sampleRate, kMinFreq, kMaxFreq); - - m_iirFilterLoLo = new IIRFilter(); - m_iirFilterLoLo.Proto = IIRFilter.ProtoType.Butterworth; - m_iirFilterLoLo.Type = IIRFilter.FilterType.HP; - m_iirFilterLoLo.Order = 5; - m_iirFilterLoLo.FreqLow = 45.0f; - m_iirFilterLoLo.SampleRate = (float)m_sampleRate; - - m_iirFilterLoHi = new IIRFilter(); - m_iirFilterLoHi.Proto = IIRFilter.ProtoType.Butterworth; - m_iirFilterLoHi.Type = IIRFilter.FilterType.LP; - m_iirFilterLoHi.Order = 5; - m_iirFilterLoHi.FreqHigh = 280.0f; - m_iirFilterLoHi.SampleRate = (float)m_sampleRate; - - m_iirFilterHiLo = new IIRFilter(); - m_iirFilterHiLo.Proto = IIRFilter.ProtoType.Butterworth; - m_iirFilterHiLo.Type = IIRFilter.FilterType.HP; - m_iirFilterHiLo.Order = 5; - m_iirFilterHiLo.FreqLow = 45.0f; - m_iirFilterHiLo.SampleRate = (float)m_sampleRate; - - m_iirFilterHiHi = new IIRFilter(); - m_iirFilterHiHi.Proto = IIRFilter.ProtoType.Butterworth; - m_iirFilterHiHi.Type = IIRFilter.FilterType.LP; - m_iirFilterHiHi.Order = 5; - m_iirFilterHiHi.FreqHigh = 2000.0f; - m_iirFilterHiHi.SampleRate = (float)m_sampleRate; - - m_detectOverlapSamples = (int)(kDetectOverlapSec * m_sampleRate); - m_maxOverlapDiff = kMaxOctaveSecRate * kDetectOverlapSec; - - m_pitchBufSize = (int)(((1.0f / (float)kMinFreq) * 2.0f + ((kAvgCount - 1) * kAvgOffset)) * m_sampleRate) + 16; - m_pitchBufLo = new float[m_pitchBufSize + m_detectOverlapSamples]; - m_pitchBufHi = new float[m_pitchBufSize + m_detectOverlapSamples]; - m_samplesPerPitchBlock = (int)Math.Round(m_sampleRate / m_pitchRecordsPerSecond); - - m_circularBufferLo = new CircularBuffer((int)(kCircularBufSaveTime * m_sampleRate + 0.5f) + 10000); - m_circularBufferHi = new CircularBuffer((int)(kCircularBufSaveTime * m_sampleRate + 0.5f) + 10000); - } - - /// - /// The pitch was detected - add the record - /// - /// - private void AddPitchRecord(float pitch) - { - int midiNote = 0; - int midiCents = 0; - - PitchDsp.PitchToMidiNote(pitch, out midiNote, out midiCents); - - var record = new PitchRecord(); - - record.RecordIndex = m_curPitchIndex; - record.Pitch = pitch; - record.MidiNote = midiNote; - record.MidiCents = midiCents; - - m_curPitchRecord = record; - - if (m_recordPitchRecords) - { - if (m_pitchRecordHistorySize > 0 && m_pitchRecords.Count >= m_pitchRecordHistorySize) - m_pitchRecords.RemoveAt(0); - - m_pitchRecords.Add(record); - } - - if (this.PitchDetected != null) - this.PitchDetected(this, record); - } - - /// - /// Stores one record - /// - public struct PitchRecord - { - /// - /// The index of the pitch record since the last Reset call - /// - public int RecordIndex { get; set; } - - /// - /// The detected pitch - /// - public float Pitch { get; set; } - - /// - /// The detected MIDI note, or 0 for no pitch - /// - public int MidiNote { get; set; } - - /// - /// The offset from the detected MIDI note in cents, from -50 to +50. - /// - public int MidiCents { get; set; } - } - } - - // ReSharper restore InconsistentNaming -} \ No newline at end of file diff --git a/Vocaluxe/Lib/Video/Acinerella/CDecoder.cs b/Vocaluxe/Lib/Video/Acinerella/CDecoder.cs index 9203b118..823c5290 100644 --- a/Vocaluxe/Lib/Video/Acinerella/CDecoder.cs +++ b/Vocaluxe/Lib/Video/Acinerella/CDecoder.cs @@ -102,7 +102,7 @@ namespace Vocaluxe.Lib.Video.Acinerella Finished = true; } - public bool GetFrame(ref CTexture frame, float time, out float videoTime) + public bool GetFrame(ref CTextureRef frame, float time, out float videoTime) { if (Finished) { diff --git a/Vocaluxe/Lib/Video/Acinerella/CDecoderThread.cs b/Vocaluxe/Lib/Video/Acinerella/CDecoderThread.cs index 0ff06799..78707644 100644 --- a/Vocaluxe/Lib/Video/Acinerella/CDecoderThread.cs +++ b/Vocaluxe/Lib/Video/Acinerella/CDecoderThread.cs @@ -193,7 +193,7 @@ namespace Vocaluxe.Lib.Video.Acinerella /// Maximum start time for frame /// Set to whether there are no more frames (stream finished, no loop, future calls will always return false) /// True if a new frame was gotten - public bool GetFrame(ref CTexture frame, ref float time, out bool finished) + public bool GetFrame(ref CTextureRef frame, ref float time, out bool finished) { bool result; if (Math.Abs(_LastShownTime - time) < _FrameDuration && frame != null) //Check 1 frame difference @@ -206,7 +206,10 @@ namespace Vocaluxe.Lib.Video.Acinerella CFramebuffer.CFrame curFrame = _FindFrame(time); if (curFrame != null) { - CDraw.UpdateOrAddTexture(ref frame, _Width, _Height, curFrame.Data); + if (frame == null) + frame = CDraw.AddTexture(_Width, _Height, curFrame.Data); + else + CDraw.UpdateTexture(frame, _Width, _Height, curFrame.Data); if (!_Paused) curFrame.SetRead(); time = curFrame.Time; diff --git a/Vocaluxe/Lib/Video/CVideoDecoderFFmpeg.cs b/Vocaluxe/Lib/Video/CVideoDecoderFFmpeg.cs index 27f2baeb..48e6954e 100644 --- a/Vocaluxe/Lib/Video/CVideoDecoderFFmpeg.cs +++ b/Vocaluxe/Lib/Video/CVideoDecoderFFmpeg.cs @@ -17,7 +17,7 @@ using System.Collections.Generic; using Vocaluxe.Lib.Video.Acinerella; -using VocaluxeLib.Draw; +using VocaluxeLib; namespace Vocaluxe.Lib.Video { @@ -39,7 +39,7 @@ namespace Vocaluxe.Lib.Video _Decoder.Clear(); } - public int Load(string videoFileName) + public CVideoStream Load(string videoFileName) { var decoder = new CDecoder(); @@ -47,21 +47,23 @@ namespace Vocaluxe.Lib.Video { int id = _LastID++; _Decoder.Add(id, decoder); - return id; + return new CVideoStream(id); } - return -1; + return null; } - public bool Close(int streamID) + public void Close(ref CVideoStream stream) { + if (stream == null) + return; CDecoder decoder; - if (_Decoder.TryGetValue(streamID, out decoder)) + if (_TryGetDecoder(stream, out decoder)) { decoder.Close(); - _Decoder.Remove(streamID); - return true; + _Decoder.Remove(stream.ID); } - return false; + stream.SetClosed(); + stream = null; } public int GetNumStreams() @@ -69,60 +71,70 @@ namespace Vocaluxe.Lib.Video return _Decoder.Count; } - public bool GetFrame(int streamID, ref CTexture frame, float time, out float videoTime) + public bool GetFrame(CVideoStream stream, float time) { CDecoder decoder; - if (_Decoder.TryGetValue(streamID, out decoder)) - return decoder.GetFrame(ref frame, time, out videoTime); - videoTime = 0; + if (_TryGetDecoder(stream, out decoder)) + return decoder.GetFrame(ref stream.Texture, time, out stream.VideoTime); + stream.VideoTime = 0; return false; } - public float GetLength(int streamID) + public float GetLength(CVideoStream stream) { CDecoder decoder; - if (_Decoder.TryGetValue(streamID, out decoder)) + if (_TryGetDecoder(stream, out decoder)) return decoder.Length; return 0f; } - public bool Skip(int streamID, float start, float gap) + public bool Skip(CVideoStream stream, float start, float gap) { CDecoder decoder; - if (_Decoder.TryGetValue(streamID, out decoder)) + if (_TryGetDecoder(stream, out decoder)) return decoder.Skip(start, gap); return false; } - public void SetLoop(int streamID, bool loop) + public void SetLoop(CVideoStream stream, bool loop) { CDecoder decoder; - if (_Decoder.TryGetValue(streamID, out decoder)) + if (_TryGetDecoder(stream, out decoder)) decoder.Loop = loop; } - public void Pause(int streamID) + public void Pause(CVideoStream stream) { CDecoder decoder; - if (_Decoder.TryGetValue(streamID, out decoder)) + if (_TryGetDecoder(stream, out decoder)) decoder.Paused = true; } - public void Resume(int streamID) + public void Resume(CVideoStream stream) { CDecoder decoder; - if (_Decoder.TryGetValue(streamID, out decoder)) + if (_TryGetDecoder(stream, out decoder)) decoder.Paused = false; } - public bool Finished(int streamID) + public bool Finished(CVideoStream stream) { CDecoder decoder; - if (_Decoder.TryGetValue(streamID, out decoder)) + if (_TryGetDecoder(stream, out decoder)) return decoder.Finished; return true; } public void Update() {} + + private bool _TryGetDecoder(CVideoStream stream, out CDecoder decoder) + { + if (stream == null) + { + decoder = null; + return false; + } + return _Decoder.TryGetValue(stream.ID, out decoder); + } } } \ No newline at end of file diff --git a/Vocaluxe/Lib/Video/IVideoDecoder.cs b/Vocaluxe/Lib/Video/IVideoDecoder.cs index b1da1feb..205b157c 100644 --- a/Vocaluxe/Lib/Video/IVideoDecoder.cs +++ b/Vocaluxe/Lib/Video/IVideoDecoder.cs @@ -15,7 +15,7 @@ // along with Vocaluxe. If not, see . #endregion -using VocaluxeLib.Draw; +using VocaluxeLib; namespace Vocaluxe.Lib.Video { @@ -36,15 +36,14 @@ namespace Vocaluxe.Lib.Video /// Loads the file with the given file path. ///
/// Absolute file path of the video file - /// StreamID >=0 on success or -1 on failure - int Load(string videoFileName); + /// stream >=0 on success or -1 on failure + CVideoStream Load(string videoFileName); /// /// Closes the stream with the given ID /// - /// ID of the stream - /// true if stream was closed, false if stream doesn't exist or already closed - bool Close(int streamID); + /// ID of the stream + void Close(ref CVideoStream stream); /// /// Gets the number of streams currently active @@ -55,60 +54,56 @@ namespace Vocaluxe.Lib.Video /// /// Gets the length of the video in s /// - /// Id of the stream + /// Id of the stream /// Length of the video in s - float GetLength(int streamID); + float GetLength(CVideoStream stream); /// /// Gets a frame of the video and sets the current video time - /// - /// Id of the stream - /// - /// Reference to already initialized video texture (from previous calls). If null, one will be created.
/// Returns the current video frame which might be outdated if time != current (internal) video position or unchanged (even null) if none is available. - /// + ///
+ /// Id of the stream /// /// The position in s of the video you want to get a frame of. If != current (internal) video position, it will seek to get to right position.
/// Note:Will be ignored for looped playback! /// - /// The actual position in s of the returned frame. Should be ~ time+VideoGap /// True if frame is valid, false: frame and videoTime might be unchanged or invalid - bool GetFrame(int streamID, ref CTexture frame, float time, out float videoTime); + bool GetFrame(CVideoStream stream, float time); /// /// Seeks to given position /// - /// Id of the stream + /// Id of the stream /// Position to seek to /// New video gap -> Actual position will be start+gap /// True on success - bool Skip(int streamID, float start, float gap); + bool Skip(CVideoStream stream, float start, float gap); /// /// Set if the video should be looped /// - /// Id of the stream + /// Id of the stream /// True if it should be looped - void SetLoop(int streamID, bool loop); + void SetLoop(CVideoStream stream, bool loop); /// /// Pauses the video (no new frames will be decoded) /// - /// Id of the stream - void Pause(int streamID); + /// Id of the stream + void Pause(CVideoStream stream); /// /// Resumes a paused video /// - /// Id of the stream - void Resume(int streamID); + /// Id of the stream + void Resume(CVideoStream stream); /// /// Check if the given video is finished /// - /// Id of the stream + /// Id of the stream /// True if all frames are shown - bool Finished(int streamID); + bool Finished(CVideoStream stream); /// /// Do a step of the decoder in unthreaded decoders. Should be called once every frame. diff --git a/Vocaluxe/Lib/Webcam/CAForgeNet.cs b/Vocaluxe/Lib/Webcam/CAForgeNet.cs index 13bc4d20..0d6e9918 100644 --- a/Vocaluxe/Lib/Webcam/CAForgeNet.cs +++ b/Vocaluxe/Lib/Webcam/CAForgeNet.cs @@ -201,13 +201,16 @@ namespace Vocaluxe.Lib.Webcam } } - public bool GetFrame(ref CTexture frame) + public bool GetFrame(ref CTextureRef frame) { lock (_MutexData) { if (_Data != null && _Data.Length == _Width * _Height * 4 && _NewFrameAvailable) { - CDraw.UpdateOrAddTexture(ref frame, _Width, _Height, _Data); + if (frame == null) + frame = CDraw.AddTexture(_Width, _Height, _Data); + else + CDraw.UpdateTexture(frame, _Width, _Height, _Data); _NewFrameAvailable = false; return true; } diff --git a/Vocaluxe/Lib/Webcam/IWebcam.cs b/Vocaluxe/Lib/Webcam/IWebcam.cs index 98ae1804..289b51f5 100644 --- a/Vocaluxe/Lib/Webcam/IWebcam.cs +++ b/Vocaluxe/Lib/Webcam/IWebcam.cs @@ -58,12 +58,11 @@ namespace Vocaluxe.Lib.Webcam /// /// /// - bool GetFrame(ref CTexture frame); + bool GetFrame(ref CTextureRef frame); /// /// Gets the last captured frame as a bitma /// - /// /// Null if no frame was captured, the bitmap otherwise Bitmap GetBitmap(); diff --git a/Vocaluxe/Program.cs b/Vocaluxe/Program.cs index b4720e87..24873361 100644 --- a/Vocaluxe/Program.cs +++ b/Vocaluxe/Program.cs @@ -20,12 +20,16 @@ using System.Diagnostics; using System.IO; using System.Linq; using System.Reflection; +using System.Runtime.CompilerServices; using System.Runtime.ExceptionServices; using System.Threading; using System.Windows.Forms; using Vocaluxe.Base; using Vocaluxe.Base.Fonts; using Vocaluxe.Base.Server; +using Vocaluxe.Base.ThemeSystem; + +[assembly: InternalsVisibleTo("VocaluxeTests")] namespace Vocaluxe { @@ -81,7 +85,7 @@ namespace Vocaluxe { // Init Log CLog.Init(); - + CLog.StartBenchmark("Init Program"); if (!CProgrammHelper.CheckRequirements()) return; CProgrammHelper.Init(); @@ -173,26 +177,32 @@ namespace Vocaluxe Application.DoEvents(); - // Init Font - CLog.StartBenchmark("Init Font"); - CFonts.Init(); - CLog.StopBenchmark("Init Font"); - - Application.DoEvents(); - - // Load Cover - CLog.StartBenchmark("Init Cover"); - CCover.Init(); - CLog.StopBenchmark("Init Cover"); + // Init Fonts + CLog.StartBenchmark("Init Fonts"); + if (!CFonts.Init()) + throw new CLoadingException("fonts"); + CLog.StopBenchmark("Init Fonts"); Application.DoEvents(); // Theme System CLog.StartBenchmark("Init Theme"); - if (!CTheme.Init()) + if (!CThemes.Init()) throw new CLoadingException("theme"); CLog.StopBenchmark("Init Theme"); + CLog.StartBenchmark("Load Theme"); + CThemes.Load(); + CLog.StopBenchmark("Load Theme"); + + Application.DoEvents(); + + // Load Cover + CLog.StartBenchmark("Init Cover"); + if (!CCover.Init()) + throw new CLoadingException("covertheme"); + CLog.StopBenchmark("Init Cover"); + Application.DoEvents(); // Init Screens @@ -235,6 +245,7 @@ namespace Vocaluxe //Only reasonable point to call GC.Collect() because initialization may cause lots of garbage //Rely on GC doing its job afterwards and call Dispose methods where appropriate GC.Collect(); + CLog.StopBenchmark("Init Program"); } catch (Exception e) { @@ -250,7 +261,6 @@ namespace Vocaluxe // Start Main Loop if (_SplashScreen != null) _SplashScreen.Close(); - CVocaluxeServer.Start(); CDraw.MainLoop(); } @@ -263,16 +273,25 @@ namespace Vocaluxe CController.Close(); CVocaluxeServer.Close(); CGraphics.Close(); + CThemes.Close(); CCover.Close(); + CFonts.Close(); CBackgroundMusic.Close(); CWebcam.Close(); CDataBase.Close(); CVideo.Close(); CRecord.Close(); CSound.Close(); - CDraw.Unload(); - GC.Collect(); // Do a GC run here before we close logs to have finalizers run - CLog.CloseAll(); // Do this last, so we get all log entries! + CDraw.Close(); + } + catch (Exception e) + { + CLog.LogError("Error during shutdown!", false, false, e); + } + GC.Collect(); // Do a GC run here before we close logs to have finalizers run + try + { + CLog.Close(); // Do this last, so we get all log entries! } catch (Exception) {} Environment.Exit(Environment.ExitCode); diff --git a/Vocaluxe/Properties/AssemblyInfo.cs b/Vocaluxe/Properties/AssemblyInfo.cs index 861326f6..3e00fede 100644 --- a/Vocaluxe/Properties/AssemblyInfo.cs +++ b/Vocaluxe/Properties/AssemblyInfo.cs @@ -50,4 +50,5 @@ using System.Runtime.InteropServices; // [assembly: AssemblyVersion("0.3.0.83")] -[assembly: AssemblyFileVersion("0.3.0.83")] \ No newline at end of file +[assembly: AssemblyFileVersion("0.3.0.83")] +[assembly: AssemblyInformationalVersion("GITVERSION")] diff --git a/Vocaluxe/Screens/CPopupScreenPlayerControl.cs b/Vocaluxe/Screens/CPopupScreenPlayerControl.cs index e0c1cdf2..0ed15bc7 100644 --- a/Vocaluxe/Screens/CPopupScreenPlayerControl.cs +++ b/Vocaluxe/Screens/CPopupScreenPlayerControl.cs @@ -58,44 +58,41 @@ namespace Vocaluxe.Screens private bool _VideoBackground { - get { return CConfig.VideosToBackground == EOffOn.TR_CONFIG_ON; } + get { return CConfig.Config.Video.VideosToBackground == EOffOn.TR_CONFIG_ON; } set { if (!value) { - if (CConfig.VideosToBackground == EOffOn.TR_CONFIG_ON) + if (CConfig.Config.Video.VideosToBackground == EOffOn.TR_CONFIG_ON) { - CConfig.VideosToBackground = EOffOn.TR_CONFIG_OFF; + CConfig.Config.Video.VideosToBackground = EOffOn.TR_CONFIG_OFF; if (!_VideoPreviewInt) CBackgroundMusic.VideoEnabled = false; } } else { - CConfig.VideosToBackground = EOffOn.TR_CONFIG_ON; + CConfig.Config.Video.VideosToBackground = EOffOn.TR_CONFIG_ON; CBackgroundMusic.VideoEnabled = true; } CConfig.SaveConfig(); } } + public override SRectF ScreenArea + { + get { return _Statics[_StaticBG].Rect; } + } + public override void Init() { base.Init(); _ThemeStatics = new string[] {_StaticBG, _StaticCover}; _ThemeTexts = new string[] {_TextCurrentSong}; - _ThemeButtons = new string[] {_ButtonPlay, _ButtonPause, _ButtonPrevious, _ButtonNext, _ButtonRepeat, _ButtonShowVideo, _ButtonSing, _ButtonToBackgroundVideo}; } - public override void LoadTheme(string xmlPath) - { - base.LoadTheme(xmlPath); - - _ScreenArea = _Statics[_StaticBG].Rect; - } - public override bool HandleInput(SKeyEvent keyEvent) { base.HandleInput(keyEvent); @@ -136,7 +133,7 @@ namespace Vocaluxe.Screens public override bool HandleMouse(SMouseEvent mouseEvent) { base.HandleMouse(mouseEvent); - if (mouseEvent.LB && _IsMouseOver(mouseEvent)) + if (mouseEvent.LB && _IsMouseOverCurSelection(mouseEvent)) { if (_Buttons[_ButtonNext].Selected) CBackgroundMusic.Next(); @@ -181,26 +178,19 @@ namespace Vocaluxe.Screens public override bool UpdateGame() { + if (CBackgroundMusic.VideoEnabled && _VideoPreview && CBackgroundMusic.SongHasVideo) + _Statics[_StaticCover].Texture = CBackgroundMusic.GetVideoTexture(); + else + _Statics[_StaticCover].Texture = CBackgroundMusic.Cover; _Statics[_StaticCover].Visible = !_VideoPreviewInt || !CBackgroundMusic.SongHasVideo; _Buttons[_ButtonToBackgroundVideo].Pressed = _VideoBackground; _Buttons[_ButtonShowVideo].Pressed = _VideoPreviewInt; _Buttons[_ButtonRepeat].Pressed = CBackgroundMusic.RepeatSong; _Buttons[_ButtonSing].Visible = CBackgroundMusic.CanSing && CParty.CurrentPartyModeID == -1; - return true; - } - - public override bool Draw() - { - if (!_Active) - return false; - _Statics[_StaticCover].Texture = CBackgroundMusic.Cover; - if (CBackgroundMusic.VideoEnabled && _VideoPreview && CBackgroundMusic.SongHasVideo) - CDraw.DrawTexture(_Statics[_StaticCover], CBackgroundMusic.GetVideoTexture(), EAspect.Crop); _Buttons[_ButtonPause].Visible = CBackgroundMusic.IsPlaying; _Buttons[_ButtonPlay].Visible = !CBackgroundMusic.IsPlaying; _Texts[_TextCurrentSong].Text = CBackgroundMusic.ArtistAndTitle; - - return base.Draw(); + return true; } private void _StartSong(int songNr) @@ -216,7 +206,7 @@ namespace Vocaluxe.Screens CGame.AddSong(songNr, gm); - CGraphics.FadeTo(EScreens.ScreenNames); + CGame.GotoNameSelection(); } } } \ No newline at end of file diff --git a/Vocaluxe/Screens/CPopupScreenServerQR.cs b/Vocaluxe/Screens/CPopupScreenServerQR.cs index febb08a2..fce4ed96 100644 --- a/Vocaluxe/Screens/CPopupScreenServerQR.cs +++ b/Vocaluxe/Screens/CPopupScreenServerQR.cs @@ -33,11 +33,11 @@ namespace Vocaluxe.Screens get { return 1; } } - private CTexture _QRServerAddress; - private CTexture _QRAndroidLink; - private CTexture _QRSymbianLink; - private CTexture _QRWebOSLink; - private CTexture _QRWindowsPhoneLink; + private CTextureRef _QRServerAddress; + private CTextureRef _QRAndroidLink; + private CTextureRef _QRSymbianLink; + private CTextureRef _QRWebOSLink; + private CTextureRef _QRWindowsPhoneLink; private const string _StaticQRServer = "StaticQRServer"; private const string _StaticQRAndroid = "StaticQRAndroid"; @@ -101,14 +101,6 @@ namespace Vocaluxe.Screens return true; } - public override bool Draw() - { - if (!_Active) - return false; - - return base.Draw(); - } - private void _GenerateQRs() { QRCodeGenerator qr = new QRCodeGenerator(); diff --git a/Vocaluxe/Screens/CPopupScreenVolumeControl.cs b/Vocaluxe/Screens/CPopupScreenVolumeControl.cs index 4bfde64c..4bb77849 100644 --- a/Vocaluxe/Screens/CPopupScreenVolumeControl.cs +++ b/Vocaluxe/Screens/CPopupScreenVolumeControl.cs @@ -15,6 +15,7 @@ // along with Vocaluxe. If not, see . #endregion +using System.Windows.Forms; using Vocaluxe.Base; using VocaluxeLib; using VocaluxeLib.Menu; @@ -30,9 +31,13 @@ namespace Vocaluxe.Screens } private const string _StaticBG = "StaticBG"; - private const string _SelectSlideVolume = "SelectSlideVolume"; + public override SRectF ScreenArea + { + get { return _Statics[_StaticBG].Rect; } + } + public override void Init() { base.Init(); @@ -45,7 +50,6 @@ namespace Vocaluxe.Screens { base.LoadTheme(xmlPath); - _ScreenArea = _Statics[_StaticBG].Rect; _SelectSlides[_SelectSlideVolume].AddValues(new string[] {"0", "5", "10", "15", "20", "25", "30", "35", "40", "45", "50", "55", "60", "65", "70", "75", "80", "85", "90", "95", "100"}); } @@ -53,6 +57,19 @@ namespace Vocaluxe.Screens public override bool HandleInput(SKeyEvent keyEvent) { _UpdateSlides(); + if (keyEvent.ModShift || keyEvent.Sender == ESender.WiiMote) + { + if (keyEvent.Key == Keys.Add || keyEvent.Key == Keys.PageUp) + _SelectSlides[_SelectSlideVolume].Selection++; + else if (keyEvent.Key == Keys.Subtract || keyEvent.Key == Keys.PageDown) + _SelectSlides[_SelectSlideVolume].Selection--; + else + return false; + } + else + return false; + + _SaveConfig(); return true; } @@ -64,21 +81,15 @@ namespace Vocaluxe.Screens _SaveConfig(); return true; } - if (mouseEvent.Wheel > 0 && CHelper.IsInBounds(_ScreenArea, mouseEvent)) + if (mouseEvent.Wheel > 0 && CHelper.IsInBounds(ScreenArea, mouseEvent)) { - if (_SelectSlides[_SelectSlideVolume].Selection - mouseEvent.Wheel >= 0) - _SelectSlides[_SelectSlideVolume].Selection = _SelectSlides[_SelectSlideVolume].Selection - mouseEvent.Wheel; - else if (_SelectSlides[_SelectSlideVolume].Selection - mouseEvent.Wheel < 0) - _SelectSlides[_SelectSlideVolume].Selection = 0; + _SelectSlides[_SelectSlideVolume].Selection = _SelectSlides[_SelectSlideVolume].Selection - mouseEvent.Wheel; _SaveConfig(); return true; } - if (mouseEvent.Wheel < 0 && CHelper.IsInBounds(_ScreenArea, mouseEvent)) + if (mouseEvent.Wheel < 0 && CHelper.IsInBounds(ScreenArea, mouseEvent)) { - if (_SelectSlides[_SelectSlideVolume].Selection - mouseEvent.Wheel < _SelectSlides[_SelectSlideVolume].NumValues) - _SelectSlides[_SelectSlideVolume].Selection = _SelectSlides[_SelectSlideVolume].Selection - mouseEvent.Wheel; - else if (_SelectSlides[_SelectSlideVolume].Selection - mouseEvent.Wheel >= _SelectSlides[_SelectSlideVolume].NumValues) - _SelectSlides[_SelectSlideVolume].Selection = _SelectSlides[_SelectSlideVolume].NumValues - 1; + _SelectSlides[_SelectSlideVolume].Selection = _SelectSlides[_SelectSlideVolume].Selection - mouseEvent.Wheel; _SaveConfig(); return true; } @@ -97,58 +108,17 @@ namespace Vocaluxe.Screens return true; } - public override bool Draw() - { - if (!_Active) - return false; - - return base.Draw(); - } - private void _SaveConfig() { int volume = _SelectSlides[_SelectSlideVolume].Selection * 5; - switch (CGraphics.CurrentScreen) - { - case EScreens.ScreenSong: - if (CSongs.IsInCategory) - CConfig.PreviewMusicVolume = volume; - else - CConfig.BackgroundMusicVolume = volume; - break; - - case EScreens.ScreenSing: - CConfig.GameMusicVolume = volume; - break; - - default: - CConfig.BackgroundMusicVolume = volume; - break; - } + CConfig.SetVolumeByType(CGraphics.CurrentScreen.CurrentMusicType, volume); CConfig.SaveConfig(); CSound.SetGlobalVolume(volume); } private void _UpdateSlides() { - int volume; - switch (CGraphics.CurrentScreen) - { - case EScreens.ScreenSong: - if (CSongs.IsInCategory) - volume = CConfig.PreviewMusicVolume; - else - volume = CConfig.BackgroundMusicVolume; - break; - - case EScreens.ScreenSing: - volume = CConfig.GameMusicVolume; - break; - - default: - volume = CConfig.BackgroundMusicVolume; - break; - } + int volume = CConfig.GetVolumeByType(CGraphics.CurrentScreen.CurrentMusicType); _SelectSlides[_SelectSlideVolume].Selection = volume / 5; } } diff --git a/Vocaluxe/Screens/CScreenCredits.cs b/Vocaluxe/Screens/CScreenCredits.cs index 7c340a7a..e65d33c8 100644 --- a/Vocaluxe/Screens/CScreenCredits.cs +++ b/Vocaluxe/Screens/CScreenCredits.cs @@ -43,7 +43,6 @@ namespace Vocaluxe.Screens private readonly int _ParticleOffsetY; public EDirection Direction; public float StartTimeUp; - public bool Active; public CCreditName(CStatic image, CStatic imgDot, CParticleEffect particle, int particleOffsetX, int particleOffsetY) { @@ -52,17 +51,17 @@ namespace Vocaluxe.Screens _Particle = particle; _ParticleOffsetX = (int)Math.Round(particleOffsetX * image.Rect.W / image.Texture.OrigSize.Width - particle.Rect.W / 2); _ParticleOffsetY = (int)Math.Round(particleOffsetY * image.Rect.H / image.Texture.OrigSize.Height - particle.Rect.H / 2); - Active = true; + Visible = true; } public float X { - get { return _Image.Rect.X; } + get { return _Image.X; } set { - _Image.Rect.X = value; - _ImgDot.Rect.X = value + _ParticleOffsetX; - _Particle.Rect.X = value + _ParticleOffsetX; + _Image.X = value; + _ImgDot.X = value + _ParticleOffsetX; + _Particle.X = value + _ParticleOffsetX; } } public float Y @@ -70,9 +69,9 @@ namespace Vocaluxe.Screens get { return _Image.Rect.Y; } set { - _Image.Rect.Y = value; - _ImgDot.Rect.Y = value + _ParticleOffsetY; - _Particle.Rect.Y = value + _ParticleOffsetY; + _Image.Y = value; + _ImgDot.Y = value + _ParticleOffsetY; + _Particle.Y = value + _ParticleOffsetY; } } @@ -80,6 +79,7 @@ namespace Vocaluxe.Screens { get { return _Image.Rect.W; } } + public float H { get { return _Image.Rect.H; } @@ -95,18 +95,19 @@ namespace Vocaluxe.Screens } } - public void Draw() + public bool Visible { - if (Active) + set { - _Image.Draw(); - _ImgDot.Draw(); - _Particle.Draw(); + _Image.Visible = value; + _ImgDot.Visible = value; + _Particle.Visible = value; } + get { return _Image.Visible; } } } - class CScreenCredits : CMenu + public class CScreenCredits : CMenu { // Version number for theme files. Increment it, if you've changed something on the theme files! protected override int _ScreenVersion @@ -126,21 +127,27 @@ namespace Vocaluxe.Screens private List _Paragraphs; private List _ParagraphTexts; - private CTexture _TexLogo; - private CTexture _TexPerfectNoteStar; + private CTextureRef _TexLogo; + private CTextureRef _TexPerfectNoteStar; - private CTexture _TexRedDot; - private CTexture _TexBlueDot; + private CTextureRef _TexRedDot; + private CTextureRef _TexBlueDot; - private CTexture _TexNameBrunzel; - private CTexture _TexNameDarkice; - private CTexture _TexNameFlokuep; - private CTexture _TexNameFlamefire; - private CTexture _TexNameMesand; - private CTexture _TexNameBohning; - private CTexture _TexNameBabene03; - private CTexture _TexNamePantero; - private CTexture _TexNamePinky007; + private CTextureRef _TexNameBrunzel; + private CTextureRef _TexNameDarkice; + private CTextureRef _TexNameFlokuep; + private CTextureRef _TexNameFlamefire; + private CTextureRef _TexNameLukeIam; + private CTextureRef _TexNameMesand; + private CTextureRef _TexNameBohning; + private CTextureRef _TexNameBabene03; + + private SThemeBackground _BGTheme; + + public override EMusicType CurrentMusicType + { + get { return EMusicType.None; } + } public override void Init() { @@ -179,6 +186,9 @@ namespace Vocaluxe.Screens "of your abilities!"; words = paragraph.Split(new char[] {' '}); _Paragraphs.Add(words); + + _BGTheme.Type = EBackgroundTypes.Color; + _BGTheme.Color = new SThemeColor {Name = null, R = 0, G = 0.18f, B = 0.474f, A = 1}; } public override void LoadTheme(string xmlPath) @@ -197,11 +207,10 @@ namespace Vocaluxe.Screens ressourceOK &= CDataBase.GetCreditsRessource("Darkice.png", ref _TexNameDarkice); ressourceOK &= CDataBase.GetCreditsRessource("flokuep.png", ref _TexNameFlokuep); ressourceOK &= CDataBase.GetCreditsRessource("flamefire.png", ref _TexNameFlamefire); + ressourceOK &= CDataBase.GetCreditsRessource("lukeIam.png", ref _TexNameLukeIam); ressourceOK &= CDataBase.GetCreditsRessource("bohning.png", ref _TexNameBohning); ressourceOK &= CDataBase.GetCreditsRessource("mesand.png", ref _TexNameMesand); ressourceOK &= CDataBase.GetCreditsRessource("babene03.png", ref _TexNameBabene03); - ressourceOK &= CDataBase.GetCreditsRessource("pantero.png", ref _TexNamePantero); - ressourceOK &= CDataBase.GetCreditsRessource("Pinky007.png", ref _TexNamePinky007); if (!ressourceOK) CLog.LogError("Could not load all ressources!", true, true); @@ -217,6 +226,7 @@ namespace Vocaluxe.Screens continue; string newLine = " " + paragraph[e]; CText text = GetNewText(75, lastY, -2, 25, -1, EAlignment.Left, EStyle.Bold, "Outline", new SColorF(1, 1, 1, 1), line); + text.Visible = false; if (CFonts.GetTextBounds(text).Width < (CSettings.RenderW - 220)) { line += newLine; @@ -236,17 +246,47 @@ namespace Vocaluxe.Screens line = newLine; lastY += 27; } + _AddText(text); } } + + CBackground bg = new CBackground(_BGTheme, -1); + bg.LoadSkin(); + _AddBackground(bg); + + //Vocaluxe-Logo + _Logo = GetNewStatic(_TexLogo, new SColorF(1, 1, 1, 1), + new SRectF((float)(CSettings.RenderW - _TexLogo.OrigSize.Width) / 2, -270, _TexLogo.OrigSize.Width, _TexLogo.OrigSize.Height, -2)); + _AddStatic(_Logo); + + //Little stars for logo + var numstars = (int)(_Logo.Rect.W * 0.25f / 2f); + var partRect = new SRectF(_Logo.Rect.X, _Logo.Rect.Y, _Logo.Rect.W, _Logo.Rect.H, -1); + _StarsRed = _GetStarParticles(numstars, true, partRect, true); + _StarsBlue = _GetStarParticles(numstars, false, partRect, true); + _AddParticleEffect(_StarsRed); + _AddParticleEffect(_StarsBlue); + + //Credit names + _CreditNames = new List(); + + _AddNewCreditName(_TexNameBrunzel, 502, 29, true); + _AddNewCreditName(_TexNameDarkice, 360, 55, true); + _AddNewCreditName(_TexNameFlokuep, 214, 14, true); + _AddNewCreditName(_TexNameFlamefire, 496, 46, true); + _AddNewCreditName(_TexNameLukeIam, 411, 26, true); + _AddNewCreditName(_TexNameBohning, 383, 54, false); + _AddNewCreditName(_TexNameMesand, 525, 13, false); + _AddNewCreditName(_TexNameBabene03, 33, 26, false); } public override void ReloadTheme(string xmlPath) {} public override void SaveTheme() {} - public override void UnloadTextures() {} + public override void UnloadSkin() {} - public override void ReloadTextures() {} + public override void ReloadSkin() {} public override bool HandleInput(SKeyEvent keyEvent) { @@ -257,7 +297,7 @@ namespace Vocaluxe.Screens case Keys.Escape: case Keys.Back: case Keys.Enter: - CGraphics.FadeTo(EScreens.ScreenMain); + CGraphics.FadeTo(EScreen.Main); break; } } @@ -268,14 +308,14 @@ namespace Vocaluxe.Screens public override bool HandleMouse(SMouseEvent mouseEvent) { if (mouseEvent.LB || mouseEvent.RB) - CGraphics.FadeTo(EScreens.ScreenMain); + CGraphics.FadeTo(EScreen.Main); return true; } public override bool UpdateGame() { - if (!_Animation()) - CGraphics.FadeTo(EScreens.ScreenMain); + if (!_Animation() && CGraphics.NextScreen != CGraphics.GetScreen(EScreen.Main)) + CGraphics.FadeTo(EScreen.Main); return true; } @@ -286,62 +326,48 @@ namespace Vocaluxe.Screens return GetNewParticleEffect(numStars, partColor, rect, _TexPerfectNoteStar, partSize, EParticleType.Star); } - private void _AddNewCreditName(CTexture texture, int particleOffsetX, int particleOffsetY, bool bigParticles) + private void _AddNewCreditName(CTextureRef texture, int particleOffsetX, int particleOffsetY, bool bigParticles) { - bool isRight = _CreditNames.Count % 2 == 0; + bool isRed = _CreditNames.Count % 2 == 0; int partRectSize = bigParticles ? 25 : 20; int partCount = bigParticles ? 8 : 6; - CTexture texDot = isRight ? _TexRedDot : _TexBlueDot; + CTextureRef texDot = isRed ? _TexRedDot : _TexBlueDot; CStatic image = GetNewStatic(texture, new SColorF(1, 1, 1, 1), new SRectF(-1, -1, 400, 120, -4)); var particleRect = new SRectF(-1, -1, partRectSize, partRectSize, -6); - var imgDotRect = new SRectF(particleRect) {Z = -5}; + SRectF imgDotRect = particleRect; + imgDotRect.Z = -5; CStatic imgDot = GetNewStatic(texDot, new SColorF(1, 1, 1, 1), imgDotRect); - CParticleEffect particle = _GetStarParticles(partCount, isRight, particleRect, bigParticles); + CParticleEffect particle = _GetStarParticles(partCount, isRed, particleRect, bigParticles); var credit = new CCreditName(image, imgDot, particle, particleOffsetX, particleOffsetY); - if (isRight) - { - credit.X = CSettings.RenderW; - credit.Direction = EDirection.Right; - } - else - { - credit.X = -450; - credit.Direction = EDirection.Left; - } - credit.Y = 580; _CreditNames.Add(credit); + _AddStatic(image); + _AddStatic(imgDot); + _AddParticleEffect(particle); } public override void OnShow() { base.OnShow(); - //Vocaluxe-Logo - _Logo = GetNewStatic(_TexLogo, new SColorF(1, 1, 1, 1), - new SRectF((float)(CSettings.RenderW - _TexLogo.OrigSize.Width) / 2, -270, _TexLogo.OrigSize.Width, _TexLogo.OrigSize.Height, -2)); - - //Little stars for logo - var numstars = (int)(_Logo.Rect.W * 0.25f / 2f); - var partRect = new SRectF(_Logo.Rect.X, _Logo.Rect.Y, _Logo.Rect.W, _Logo.Rect.H, -1); - _StarsRed = _GetStarParticles(numstars, true, partRect, true); - _StarsBlue = _GetStarParticles(numstars, false, partRect, true); - - //Credit names - _CreditNames = new List(); - - _AddNewCreditName(_TexNameBrunzel, 502, 29, true); - _AddNewCreditName(_TexNameDarkice, 360, 55, true); - _AddNewCreditName(_TexNameFlokuep, 214, 14, true); - _AddNewCreditName(_TexNameFlamefire, 496, 46, true); - _AddNewCreditName(_TexNameBohning, 383, 54, false); - _AddNewCreditName(_TexNameMesand, 525, 13, false); - _AddNewCreditName(_TexNameBabene03, 33, 26, false); - _AddNewCreditName(_TexNamePantero, 311, 45, false); - _AddNewCreditName(_TexNamePinky007, 113, 50, false); + foreach (CText text in _ParagraphTexts) + text.Visible = false; + bool isRight = true; + foreach (CCreditName name in _CreditNames) + { + name.Visible = true; + name.Direction = isRight ? EDirection.Right : EDirection.Left; + name.X = -name.W; + name.Y = 580; + name.Alpha = 1; + isRight = !isRight; + } + _Logo.Y = -270; + _StarsRed.Y = _Logo.Y; + _StarsBlue.Y = _Logo.Y; _TextTimer.Reset(); _LogoTimer.Reset(); @@ -355,32 +381,6 @@ namespace Vocaluxe.Screens _LogoTimer.Start(); } - public override bool Draw() - { - base.Draw(); - - //Draw background - CDraw.DrawColor(new SColorF(0, 0.18f, 0.474f, 1), new SRectF(0, 0, CSettings.RenderW, CSettings.RenderH, 0)); - - //Draw stars - _StarsBlue.Draw(); - _StarsRed.Draw(); - - _Logo.Draw(); - - //Draw credit-entries - foreach (CCreditName cn in _CreditNames) - cn.Draw(); - - //Draw Text - if (_TextTimer.IsRunning) - { - foreach (CText text in _ParagraphTexts) - text.Draw(); - } - return true; - } - private bool _Animation() { bool active = false; @@ -388,16 +388,13 @@ namespace Vocaluxe.Screens { active = true; - _Logo.Rect.Y = -270 + (270f / 3000f) * _LogoTimer.ElapsedMilliseconds; - _StarsRed.Rect.Y = _Logo.Rect.Y; - _StarsBlue.Rect.Y = _Logo.Rect.Y; + _Logo.Y = -270 + (270f / 3000f) * _LogoTimer.ElapsedMilliseconds; + _StarsRed.Y = _Logo.Y; + _StarsBlue.Y = _Logo.Y; if (_LogoTimer.ElapsedMilliseconds >= 2000 && !_CreditsTimer.IsRunning) _CreditsTimer.Start(); if (_LogoTimer.ElapsedMilliseconds >= 3000) - { _LogoTimer.Stop(); - _LogoTimer.Reset(); - } } if (_CreditsTimer.IsRunning) @@ -406,77 +403,69 @@ namespace Vocaluxe.Screens for (int i = 0; i < _CreditNames.Count; i++) { - if (_CreditNames[i].Active) + if (!_CreditNames[i].Visible) + continue; + switch (_CreditNames[i].Direction) { - switch (_CreditNames[i].Direction) - { - case EDirection.Right: - if (i * 4000f <= _CreditsTimer.ElapsedMilliseconds) + case EDirection.Right: + if (i * 4000f <= _CreditsTimer.ElapsedMilliseconds) + { + _CreditNames[i].X = -450 + (((CSettings.RenderW - _CreditNames[i].W) / 2) / 3000f) * (_CreditsTimer.ElapsedMilliseconds - (i * 4000f)); + + //Check if name is in middle of screen and should go up + if (_CreditNames[i].X >= (CSettings.RenderW - _CreditNames[i].W) / 2) { - _CreditNames[i].X = -450 + (((CSettings.RenderW - _CreditNames[i].W) / 2) / 3000f) * (_CreditsTimer.ElapsedMilliseconds - (i * 4000f)); - - //Check if name is in middle of screen and should go up - if (_CreditNames[i].X >= (CSettings.RenderW - _CreditNames[i].W) / 2) - { - _CreditNames[i].Direction = EDirection.Up; - _CreditNames[i].StartTimeUp = _CreditsTimer.ElapsedMilliseconds; - } + _CreditNames[i].Direction = EDirection.Up; + _CreditNames[i].StartTimeUp = _CreditsTimer.ElapsedMilliseconds; } - break; + } + break; - case EDirection.Left: - if (i * 4000f <= _CreditsTimer.ElapsedMilliseconds) + case EDirection.Left: + if (i * 4000f <= _CreditsTimer.ElapsedMilliseconds) + { + _CreditNames[i].X = CSettings.RenderW - + (((CSettings.RenderW - _CreditNames[i].W) / 2) / 3000f) * (_CreditsTimer.ElapsedMilliseconds - (i * 4000f)); + + //Check if name is in middle of screen and should go up + if (_CreditNames[i].X <= (CSettings.RenderW - _CreditNames[i].W) / 2) { - _CreditNames[i].X = CSettings.RenderW - - (((CSettings.RenderW - _CreditNames[i].W) / 2) / 3000f) * (_CreditsTimer.ElapsedMilliseconds - (i * 4000f)); - - //Check if name is in middle of screen and should go up - if (_CreditNames[i].X <= (CSettings.RenderW - _CreditNames[i].W) / 2) - { - _CreditNames[i].Direction = EDirection.Up; - _CreditNames[i].StartTimeUp = _CreditsTimer.ElapsedMilliseconds; - } + _CreditNames[i].Direction = EDirection.Up; + _CreditNames[i].StartTimeUp = _CreditsTimer.ElapsedMilliseconds; } - break; + } + break; - case EDirection.Up: - _CreditNames[i].Y = 580 - (430f / 3000f) * (_CreditsTimer.ElapsedMilliseconds - _CreditNames[i].StartTimeUp); + case EDirection.Up: + _CreditNames[i].Y = 580 - (430f / 3000f) * (_CreditsTimer.ElapsedMilliseconds - _CreditNames[i].StartTimeUp); - //Set name inactive - if (_CreditNames[i].Y <= 160f) + //Set name inactive + if (_CreditNames[i].Y <= 160f) + { + _CreditNames[i].Visible = false; + //Check, if last name is shown + if (i == _CreditNames.Count - 1) { - _CreditNames[i].Active = false; - //Check, if last name is set to false - if (i == _CreditNames.Count - 1) - { - //Stop and reset timer for next time - _CreditsTimer.Stop(); - _CreditsTimer.Reset(); - - //Start Text-Timer - _TextTimer.Start(); - } - } - else if (_CreditNames[i].Y <= 360f) - { - //Fade names out - float alpha = (360 - _CreditNames[i].Y) / 200; - //Catch some bad alpha-values - if (alpha > 1) - alpha = 1; - else if (alpha < 0) - alpha = 0; - _CreditNames[i].Alpha = 1 - alpha; + _CreditsTimer.Stop(); + _TextTimer.Start(); + foreach (CText text in _ParagraphTexts) + text.Visible = true; } + } + else if (_CreditNames[i].Y <= 360f) + { + //Fade names out + float alpha = ((360 - _CreditNames[i].Y) / 200).Clamp(0, 1); + _CreditNames[i].Alpha = 1 - alpha; + } - break; - } + break; } } } if (_TextTimer.IsRunning) - active = _TextTimer.ElapsedMilliseconds <= 60000; + active = _TextTimer.ElapsedMilliseconds <= 500; return active; } diff --git a/Vocaluxe/Screens/CScreenHighscore.cs b/Vocaluxe/Screens/CScreenHighscore.cs index 010a3cce..6149c8bd 100644 --- a/Vocaluxe/Screens/CScreenHighscore.cs +++ b/Vocaluxe/Screens/CScreenHighscore.cs @@ -27,7 +27,7 @@ using VocaluxeLib.Songs; namespace Vocaluxe.Screens { - class CScreenHighscore : CMenu + public class CScreenHighscore : CMenu { // Version number for theme files. Increment it, if you've changed something on the theme files! protected override int _ScreenVersion @@ -130,7 +130,7 @@ namespace Vocaluxe.Screens public override bool HandleMouse(SMouseEvent mouseEvent) { - if (mouseEvent.LB && _IsMouseOver(mouseEvent)) {} + if (mouseEvent.LB && _IsMouseOverCurSelection(mouseEvent)) {} if (mouseEvent.LB) _LeaveScreen(); @@ -215,7 +215,7 @@ namespace Vocaluxe.Screens for (int round = 0; round < points.NumRounds; round++) { - SPlayer[] players = points.GetPlayer(round, CGame.NumPlayer); + SPlayer[] players = points.GetPlayer(round, CGame.NumPlayers); for (int p = 0; p < players.Length; p++) { diff --git a/Vocaluxe/Screens/CScreenLoad.cs b/Vocaluxe/Screens/CScreenLoad.cs index 50c57008..641bad44 100644 --- a/Vocaluxe/Screens/CScreenLoad.cs +++ b/Vocaluxe/Screens/CScreenLoad.cs @@ -23,7 +23,7 @@ using VocaluxeLib.Menu; namespace Vocaluxe.Screens { - class CScreenLoad : CMenu + public class CScreenLoad : CMenu { // Version number for theme files. Increment it, if you've changed something on the theme files! protected override int _ScreenVersion @@ -105,7 +105,7 @@ namespace Vocaluxe.Screens _CurrentIntroVideo = -1; _IntroOutPlayed = false; - if (CConfig.VideoBackgrounds == EOffOn.TR_CONFIG_ON) + if (CConfig.Config.Video.VideoBackgrounds == EOffOn.TR_CONFIG_ON) { for (int i = 0; i < _Intros.Length; i++) _Intros[i].Load(_IntroVideo[i]); @@ -117,7 +117,7 @@ namespace Vocaluxe.Screens { base.OnShowFinish(); - if (CConfig.VideoBackgrounds == EOffOn.TR_CONFIG_ON) + if (CConfig.Config.Video.VideoBackgrounds == EOffOn.TR_CONFIG_ON) { foreach (CVideoPlayer videoPlayer in _Intros) videoPlayer.PreLoad(); @@ -135,13 +135,13 @@ namespace Vocaluxe.Screens { _CheckStartIntroVideos(); - bool next = CConfig.CoverLoading != ECoverLoading.TR_CONFIG_COVERLOADING_ATSTART || CSongs.CoverLoaded; + bool next = CConfig.Config.Theme.CoverLoading != ECoverLoading.TR_CONFIG_COVERLOADING_ATSTART || CSongs.CoverLoaded; - if ((_IntroOutPlayed || _SkipIntro) && next && CSettings.ProgramState != EProgramState.EditTheme && CSongs.SongsLoaded) + if ((_IntroOutPlayed || _SkipIntro) && next && CSettings.ProgramState == EProgramState.Start && CSongs.SongsLoaded) + { CSettings.ProgramState = EProgramState.Normal; - - if (CSettings.ProgramState == EProgramState.Normal) - CGraphics.FadeTo(EScreens.ScreenMain); + CGraphics.FadeTo(EScreen.Main); + } _Texts[_TextStatus].Text = CLanguage.Translate("TR_SCREENLOAD_TOTAL") + ": " + CSongs.NumAllSongs + " " + @@ -152,7 +152,7 @@ namespace Vocaluxe.Screens { CBackgroundMusic.OwnSongsAvailable = true; - if (CConfig.VideoBackgrounds == EOffOn.TR_CONFIG_ON || CConfig.VideosToBackground == EOffOn.TR_CONFIG_ON) + if (CConfig.Config.Video.VideoBackgrounds == EOffOn.TR_CONFIG_ON || CConfig.Config.Video.VideosToBackground == EOffOn.TR_CONFIG_ON) CBackgroundMusic.VideoEnabled = true; CBackgroundMusic.Play(); @@ -161,15 +161,12 @@ namespace Vocaluxe.Screens return true; } - public override bool Draw() + public override void Draw() { - _DrawBG(); - if (_CurrentIntroVideo >= 0 && _CurrentIntroVideo < _Intros.Length) _Intros[_CurrentIntroVideo].Draw(); - _DrawFG(); - return true; + base.Draw(); } public override void OnClose() @@ -192,7 +189,7 @@ namespace Vocaluxe.Screens if (_IntroOutPlayed) return; - if (CConfig.VideoBackgrounds == EOffOn.TR_CONFIG_OFF) + if (CConfig.Config.Video.VideoBackgrounds == EOffOn.TR_CONFIG_OFF) { _IntroOutPlayed = true; return; @@ -203,7 +200,7 @@ namespace Vocaluxe.Screens _CurrentIntroVideo = 0; _Intros[0].Start(); } - else if (_CurrentIntroVideo == 0 && _Intros[0].IsFinished && CConfig.CoverLoading == ECoverLoading.TR_CONFIG_COVERLOADING_ATSTART) + else if (_CurrentIntroVideo == 0 && _Intros[0].IsFinished && CConfig.Config.Theme.CoverLoading == ECoverLoading.TR_CONFIG_COVERLOADING_ATSTART) { _Intros[_CurrentIntroVideo].Close(); _CurrentIntroVideo = 1; diff --git a/Vocaluxe/Screens/CScreenMain.cs b/Vocaluxe/Screens/CScreenMain.cs index 6cd878bc..f45915da 100644 --- a/Vocaluxe/Screens/CScreenMain.cs +++ b/Vocaluxe/Screens/CScreenMain.cs @@ -22,12 +22,12 @@ using VocaluxeLib.Menu; namespace Vocaluxe.Screens { - class CScreenMain : CMenu + public class CScreenMain : CMenu { // Version number for theme files. Increment it, if you've changed something on the theme files! protected override int _ScreenVersion { - get { return 1; } + get { return 2; } } private const string _ButtonSing = "ButtonSing"; @@ -35,23 +35,30 @@ namespace Vocaluxe.Screens private const string _ButtonOptions = "ButtonOptions"; private const string _ButtonProfiles = "ButtonProfiles"; private const string _ButtonExit = "ButtonExit"; - - private CText _ReleaseText; + private const string _StaticWarningProfiles = "StaticWarningProfiles"; + private const string _TextWarningProfiles = "TextWarningProfiles"; + private const string _TextRelease = "TextRelease"; //CParticleEffect Snowflakes; public override void Init() { base.Init(); - _ThemeStatics = new string[] {"StaticMenuBar"}; + _ThemeStatics = new string[] {"StaticMenuBar", _StaticWarningProfiles}; _ThemeButtons = new string[] {_ButtonSing, _ButtonParty, _ButtonOptions, _ButtonProfiles, _ButtonExit}; + _ThemeTexts = new string[] {_TextRelease, _TextWarningProfiles}; } public override void LoadTheme(string xmlPath) { base.LoadTheme(xmlPath); - _ReleaseText = GetNewText(10, 690, -1, 15, -1, EAlignment.Left, EStyle.Normal, "Normal", new SColorF(1f, 1f, 1f, 1f), CSettings.GetFullVersionText()); + _Texts[_TextRelease].Text = CSettings.GetFullVersionText(); + // ReSharper disable ConditionIsAlwaysTrueOrFalse + _Texts[_TextRelease].Visible = CSettings.VersionRevision != ERevision.Release; + // ReSharper restore ConditionIsAlwaysTrueOrFalse + _Statics[_StaticWarningProfiles].Visible = false; + _Texts[_TextWarningProfiles].Visible = false; } public override bool HandleInput(SKeyEvent keyEvent) @@ -64,36 +71,37 @@ namespace Vocaluxe.Screens switch (keyEvent.Key) { case Keys.O: - CGraphics.FadeTo(EScreens.ScreenOptions); + CGraphics.FadeTo(EScreen.Options); break; case Keys.S: - CGraphics.FadeTo(EScreens.ScreenSong); + if (CProfiles.NumProfiles > 0) + CGraphics.FadeTo(EScreen.Song); break; case Keys.C: - CGraphics.FadeTo(EScreens.ScreenCredits); + CGraphics.FadeTo(EScreen.Credits); break; case Keys.T: - CGraphics.FadeTo(EScreens.ScreenTest); + CGraphics.FadeTo(EScreen.Test); break; case Keys.Enter: if (_Buttons[_ButtonSing].Selected) { CParty.SetNormalGameMode(); - CGraphics.FadeTo(EScreens.ScreenSong); + CGraphics.FadeTo(EScreen.Song); } if (_Buttons[_ButtonParty].Selected) - CGraphics.FadeTo(EScreens.ScreenParty); + CGraphics.FadeTo(EScreen.Party); if (_Buttons[_ButtonOptions].Selected) - CGraphics.FadeTo(EScreens.ScreenOptions); + CGraphics.FadeTo(EScreen.Options); if (_Buttons[_ButtonProfiles].Selected) - CGraphics.FadeTo(EScreens.ScreenProfiles); + CGraphics.FadeTo(EScreen.Profiles); if (_Buttons[_ButtonExit].Selected) return false; @@ -108,22 +116,22 @@ namespace Vocaluxe.Screens { base.HandleMouse(mouseEvent); - if (mouseEvent.LB && _IsMouseOver(mouseEvent)) + if (mouseEvent.LB && _IsMouseOverCurSelection(mouseEvent)) { if (_Buttons[_ButtonSing].Selected) { CParty.SetNormalGameMode(); - CGraphics.FadeTo(EScreens.ScreenSong); + CGraphics.FadeTo(EScreen.Song); } if (_Buttons[_ButtonParty].Selected) - CGraphics.FadeTo(EScreens.ScreenParty); + CGraphics.FadeTo(EScreen.Party); if (_Buttons[_ButtonOptions].Selected) - CGraphics.FadeTo(EScreens.ScreenOptions); + CGraphics.FadeTo(EScreen.Options); if (_Buttons[_ButtonProfiles].Selected) - CGraphics.FadeTo(EScreens.ScreenProfiles); + CGraphics.FadeTo(EScreen.Profiles); if (_Buttons[_ButtonExit].Selected) return false; @@ -132,50 +140,14 @@ namespace Vocaluxe.Screens return true; } - // ReSharper disable RedundantOverridenMember - public override void OnShow() - { - base.OnShow(); - - //if (Snowflakes != null) - // Snowflakes.Resume(); - } - - // ReSharper restore RedundantOverridenMember - public override bool UpdateGame() { + bool profileOK = CProfiles.NumProfiles > 0; + _Statics[_StaticWarningProfiles].Visible = !profileOK; + _Texts[_TextWarningProfiles].Visible = !profileOK; + _Buttons[_ButtonSing].Selectable = profileOK; + _Buttons[_ButtonParty].Selectable = profileOK; return true; } - - public override bool Draw() - { - _DrawBG(); - - //if (Snowflakes == null) - // Snowflakes = new CParticleEffect(300, new SColorF(1, 1, 1, 1), new SRectF(0, 0, CSettings.iRenderW, 0, 0.5f), "Snowflake", 25, EParticeType.Snow); - - //Snowflakes.Update(); - //Snowflakes.Draw(); - _DrawFG(); - - // ReSharper disable ConditionIsAlwaysTrueOrFalse - if (CSettings.VersionRevision != ERevision.Release) - // ReSharper restore ConditionIsAlwaysTrueOrFalse - _ReleaseText.Draw(); - - return true; - } - - // ReSharper disable RedundantOverridenMember - public override void OnClose() - { - base.OnClose(); - - //if (Snowflakes != null) - // Snowflakes.Pause(); - } - - // ReSharper restore RedundantOverridenMember } } \ No newline at end of file diff --git a/Vocaluxe/Screens/CScreenNames.cs b/Vocaluxe/Screens/CScreenNames.cs index 945e6731..bd04a3ab 100644 --- a/Vocaluxe/Screens/CScreenNames.cs +++ b/Vocaluxe/Screens/CScreenNames.cs @@ -27,7 +27,7 @@ using VocaluxeLib.Profile; namespace Vocaluxe.Screens { - class CScreenNames : CMenu + public class CScreenNames : CMenu { // Version number for theme files. Increment it, if you've changed something on the theme files! protected override int _ScreenVersion @@ -55,7 +55,7 @@ namespace Vocaluxe.Screens {"EqualizerPlayer1", "EqualizerPlayer2", "EqualizerPlayer3", "EqualizerPlayer4", "EqualizerPlayer5", "EqualizerPlayer6"}; private readonly string[] _SelectSlideDuetPlayer = new string[] {"SelectSlideDuetPlayer1", "SelectSlideDuetPlayer2", "SelectSlideDuetPlayer3", "SelectSlideDuetPlayer4", "SelectSlideDuetPlayer5", "SelectSlideDuetPlayer6"}; - private readonly CTexture[] _OriginalPlayerAvatarTextures = new CTexture[CSettings.MaxNumPlayer]; + private readonly CTextureRef[] _OriginalPlayerAvatarTextures = new CTextureRef[CSettings.MaxNumPlayer]; private bool _SelectingKeyboardActive; private bool _SelectingFast; @@ -117,9 +117,7 @@ namespace Vocaluxe.Screens _OriginalPlayerAvatarTextures[i] = _Statics[_StaticPlayerAvatar[i]].Texture; _Statics[_StaticPlayerAvatar[i]].Aspect = EAspect.Crop; } - - for (int i = 1; i <= CSettings.MaxNumPlayer; i++) - _Equalizers["EqualizerPlayer" + i].ScreenHandles = true; + _AddStatic(_ChooseAvatarStatic); } public override bool HandleInput(SKeyEvent keyEvent) @@ -127,9 +125,9 @@ namespace Vocaluxe.Screens switch (keyEvent.Key) { case Keys.Add: - if (CConfig.NumPlayer + 1 <= CSettings.MaxNumPlayer) + if (CConfig.Config.Game.NumPlayers + 1 <= CSettings.MaxNumPlayer) { - _SelectSlides[_SelectSlidePlayerNumber].Selection = CConfig.NumPlayer; + _SelectSlides[_SelectSlidePlayerNumber].Selection = CConfig.Config.Game.NumPlayers; _UpdatePlayerNumber(); //Update Tiles-List _NameSelections[_NameSelection].UpdateList(); @@ -137,9 +135,9 @@ namespace Vocaluxe.Screens break; case Keys.Subtract: - if (CConfig.NumPlayer - 1 > 0) + if (CConfig.Config.Game.NumPlayers - 1 > 0) { - _SelectSlides[_SelectSlidePlayerNumber].Selection = CConfig.NumPlayer - 2; + _SelectSlides[_SelectSlidePlayerNumber].Selection = CConfig.Config.Game.NumPlayers - 2; _UpdatePlayerNumber(); //Update Tiles-List _NameSelections[_NameSelection].UpdateList(); @@ -155,7 +153,7 @@ namespace Vocaluxe.Screens } else { - if (_SelectingFastPlayerNr + 1 <= CGame.NumPlayer) + if (_SelectingFastPlayerNr + 1 <= CGame.NumPlayers) _SelectingFastPlayerNr++; else _SelectingFastPlayerNr = 1; @@ -182,14 +180,15 @@ namespace Vocaluxe.Screens return true; _UpdateSelectedProfile(_SelectingFastPlayerNr - 1, _SelectedProfileID); - - _SetInteractionToButton(_Buttons[_ButtonStart]); } //Started selecting with 'P' if (_SelectingFast) { - if (_SelectingFastPlayerNr == CGame.NumPlayer) + if (_SelectingFastPlayerNr == CGame.NumPlayers) + { resetSelection = true; + _SelectElement(_Buttons[_ButtonStart]); + } else { _SelectingFastPlayerNr++; @@ -227,6 +226,7 @@ namespace Vocaluxe.Screens case Keys.Escape: resetSelection = true; + _SelectElement(_SelectSlides[_SelectSlidePlayerNumber]); break; case Keys.Delete: @@ -250,7 +250,7 @@ namespace Vocaluxe.Screens _SelectingKeyboardActive = false; _SelectingFast = false; _NameSelections[_NameSelection].FastSelection(false, -1); - _SetInteractionToButton(_Buttons[_ButtonStart]); + _SelectElement(_Buttons[_ButtonStart]); } break; } @@ -261,9 +261,10 @@ namespace Vocaluxe.Screens //Reset all values _SelectingFastPlayerNr = 0; _SelectingKeyboardActive = false; + _SelectElement(_SelectSlides[_SelectSlidePlayerNumber]); _NameSelections[_NameSelection].FastSelection(false, -1); } - else if (numberPressed <= CConfig.NumPlayer) + else if (numberPressed <= CConfig.Config.Game.NumPlayers) { _SelectingFastPlayerNr = numberPressed; _NameSelections[_NameSelection].FastSelection(true, numberPressed); @@ -279,14 +280,14 @@ namespace Vocaluxe.Screens { case Keys.Escape: case Keys.Back: - CGraphics.FadeTo(EScreens.ScreenSong); + CGraphics.FadeTo(EScreen.Song); break; case Keys.Enter: if (_Buttons[_ButtonBack].Selected) - CGraphics.FadeTo(EScreens.ScreenSong); - else + CGraphics.FadeTo(EScreen.Song); + else if (_Buttons[_ButtonStart].Selected) _StartSong(); break; @@ -325,12 +326,19 @@ namespace Vocaluxe.Screens break; } - - if (_SelectingFastPlayerNr > 0 && _SelectingFastPlayerNr <= CConfig.NumPlayer) + if (_SelectingFastPlayerNr > 0 && _SelectingFastPlayerNr <= CConfig.Config.Game.NumPlayers) { _SelectingKeyboardActive = true; _NameSelections[_NameSelection].FastSelection(true, _SelectingFastPlayerNr); } + if (_NameSelections[_NameSelection].Selected && !_SelectingKeyboardActive) + { + _SelectingKeyboardActive = true; + _SelectingFast = true; + _SelectingFastPlayerNr = 1; + _SelectingKeyboardActive = true; + _NameSelections[_NameSelection].FastSelection(true, _SelectingFastPlayerNr); + } } return true; @@ -361,15 +369,15 @@ namespace Vocaluxe.Screens //Update of Drag/Drop-Texture CStatic selectedPlayer = _NameSelections[_NameSelection].TilePlayerAvatar(mouseEvent); _ChooseAvatarStatic.Visible = true; - _ChooseAvatarStatic.Rect = selectedPlayer.Rect; - _ChooseAvatarStatic.Rect.Z = CSettings.ZNear; + _ChooseAvatarStatic.MaxRect = selectedPlayer.Rect; + _ChooseAvatarStatic.Z = CSettings.ZNear; _ChooseAvatarStatic.Color = new SColorF(1, 1, 1, 1); _ChooseAvatarStatic.Texture = selectedPlayer.Texture; } } else { - for (int i = 0; i < CGame.NumPlayer; i++) + for (int i = 0; i < CGame.NumPlayers; i++) { if (CHelper.IsInBounds(_Statics[_StaticPlayer[i]].Rect, mouseEvent)) { @@ -378,8 +386,8 @@ namespace Vocaluxe.Screens //Update of Drag/Drop-Texture CStatic selectedPlayer = _Statics[_StaticPlayerAvatar[i]]; _ChooseAvatarStatic.Visible = true; - _ChooseAvatarStatic.Rect = selectedPlayer.Rect; - _ChooseAvatarStatic.Rect.Z = CSettings.ZNear; + _ChooseAvatarStatic.MaxRect = selectedPlayer.Rect; + _ChooseAvatarStatic.Z = CSettings.ZNear; _ChooseAvatarStatic.Color = new SColorF(1, 1, 1, 1); _ChooseAvatarStatic.Texture = selectedPlayer.Texture; break; @@ -392,8 +400,8 @@ namespace Vocaluxe.Screens if (mouseEvent.LBH && _SelectedProfileID >= 0 && !_SelectingFast) { //Update coords for Drag/Drop-Texture - _ChooseAvatarStatic.Rect.X += mouseEvent.X - _OldMouseX; - _ChooseAvatarStatic.Rect.Y += mouseEvent.Y - _OldMouseY; + _ChooseAvatarStatic.X += mouseEvent.X - _OldMouseX; + _ChooseAvatarStatic.Y += mouseEvent.Y - _OldMouseY; _OldMouseX = mouseEvent.X; _OldMouseY = mouseEvent.Y; } @@ -444,7 +452,7 @@ namespace Vocaluxe.Screens _UpdateSelectedProfile(_SelectingFastPlayerNr - 1, _SelectedProfileID); _SelectingFastPlayerNr++; - if (_SelectingFastPlayerNr <= CGame.NumPlayer) + if (_SelectingFastPlayerNr <= CGame.NumPlayers) _NameSelections[_NameSelection].FastSelection(true, _SelectingFastPlayerNr); else stopSelectingFast = true; @@ -453,10 +461,10 @@ namespace Vocaluxe.Screens stopSelectingFast = true; } } - else if (mouseEvent.LB && _IsMouseOver(mouseEvent)) + else if (mouseEvent.LB && _IsMouseOverCurSelection(mouseEvent)) { if (_Buttons[_ButtonBack].Selected) - CGraphics.FadeTo(EScreens.ScreenSong); + CGraphics.FadeTo(EScreen.Song); else if (_Buttons[_ButtonStart].Selected) _StartSong(); else @@ -470,7 +478,7 @@ namespace Vocaluxe.Screens _SelectedProfileID = _NameSelections[_NameSelection].TilePlayerNr(mouseEvent); if (_SelectedProfileID > -1) { - for (int i = 0; i < CGame.NumPlayer; i++) + for (int i = 0; i < CGame.NumPlayers; i++) { if (CGame.Players[i].ProfileID == -1) { @@ -490,7 +498,7 @@ namespace Vocaluxe.Screens { bool exit = true; //Remove profile-selection - for (int i = 0; i < CConfig.NumPlayer; i++) + for (int i = 0; i < CConfig.Config.Game.NumPlayers; i++) { if (CHelper.IsInBounds(_Statics[_StaticPlayer[i]].Rect, mouseEvent)) { @@ -499,13 +507,13 @@ namespace Vocaluxe.Screens } } if (exit) - CGraphics.FadeTo(EScreens.ScreenSong); + CGraphics.FadeTo(EScreen.Song); } if (mouseEvent.MB && _SelectingFast) { _SelectingFastPlayerNr++; - if (_SelectingFastPlayerNr <= CGame.NumPlayer) + if (_SelectingFastPlayerNr <= CGame.NumPlayers) _NameSelections[_NameSelection].FastSelection(true, _SelectingFastPlayerNr); else stopSelectingFast = true; @@ -544,7 +552,7 @@ namespace Vocaluxe.Screens if (_ProfilesChanged || _AvatarsChanged) _LoadProfiles(); - for (int i = 1; i <= CGame.NumPlayer; i++) + for (int i = 1; i <= CGame.NumPlayers; i++) { CRecord.AnalyzeBuffer(i - 1); _Equalizers["EqualizerPlayer" + i].Update(CRecord.ToneWeigth(i - 1), CRecord.GetMaxVolume(i - 1)); @@ -559,7 +567,7 @@ namespace Vocaluxe.Screens _NameSelections[_NameSelection].Init(); _LoadProfiles(); - _SetInteractionToButton(_Buttons[_ButtonStart]); + _SelectElement(_Buttons[_ButtonStart]); } public override void OnClose() @@ -567,17 +575,6 @@ namespace Vocaluxe.Screens base.OnClose(); CRecord.Stop(); } - - public override bool Draw() - { - base.Draw(); - - if (_ChooseAvatarStatic.Visible) - _ChooseAvatarStatic.Draw(); - for (int i = 1; i <= CGame.NumPlayer; i++) - _Equalizers["EqualizerPlayer" + i].Draw(); - return true; - } #endregion public methods #region private methods @@ -611,7 +608,7 @@ namespace Vocaluxe.Screens if (CGame.GetNumSongs() == 1 && firstSong.IsDuet) { _SelectSlides[_SelectSlideDuetPlayer[i]].Clear(); - _SelectSlides[_SelectSlideDuetPlayer[i]].Visible = i + 1 <= CGame.NumPlayer; + _SelectSlides[_SelectSlideDuetPlayer[i]].Visible = i + 1 <= CGame.NumPlayers; for (int j = 0; j < firstSong.Notes.VoiceCount; j++) _SelectSlides[_SelectSlideDuetPlayer[i]].AddValue(firstSong.Notes.VoiceNames[j]); @@ -629,10 +626,10 @@ namespace Vocaluxe.Screens { if (CGame.GetNumSongs() == 1 && CGame.GetSong(0).IsDuet) { - for (int i = 0; i < CGame.NumPlayer; i++) + for (int i = 0; i < CGame.NumPlayers; i++) CGame.Players[i].VoiceNr = _SelectSlides[_SelectSlideDuetPlayer[i]].Selection; } - CGraphics.FadeTo(EScreens.ScreenSing); + CGraphics.FadeTo(EScreen.Sing); } private void _UpdateSlides() @@ -640,16 +637,16 @@ namespace Vocaluxe.Screens _SelectSlides[_SelectSlidePlayerNumber].Clear(); for (int i = 1; i <= CSettings.MaxNumPlayer; i++) _SelectSlides[_SelectSlidePlayerNumber].AddValue(CLanguage.Translate("TR_SCREENNAMES_" + i + "PLAYER")); - _SelectSlides[_SelectSlidePlayerNumber].Selection = CConfig.NumPlayer - 1; + _SelectSlides[_SelectSlidePlayerNumber].Selection = CConfig.Config.Game.NumPlayers - 1; } private void _UpdatePlayerNumber() { - CConfig.NumPlayer = _SelectSlides[_SelectSlidePlayerNumber].Selection + 1; - CGame.NumPlayer = _SelectSlides[_SelectSlidePlayerNumber].Selection + 1; + CConfig.Config.Game.NumPlayers = _SelectSlides[_SelectSlidePlayerNumber].Selection + 1; + CGame.NumPlayers = _SelectSlides[_SelectSlidePlayerNumber].Selection + 1; for (int i = 1; i <= CSettings.MaxNumPlayer; i++) { - if (i <= CGame.NumPlayer) + if (i <= CGame.NumPlayers) { _Statics["StaticPlayer" + i].Visible = true; _Statics["StaticPlayerAvatar" + i].Visible = true; @@ -681,7 +678,7 @@ namespace Vocaluxe.Screens //Update Game-infos with new player CGame.Players[playerNum].ProfileID = profileId; //Update config for default players. - CConfig.Players[playerNum] = CProfiles.GetProfileFileName(profileId); + CConfig.Config.Game.Players[playerNum] = CProfiles.GetProfileFileName(profileId); CConfig.SaveConfig(); //Update texture and name _Statics[_StaticPlayerAvatar[playerNum]].Texture = CProfiles.GetAvatarTextureFromProfile(profileId); @@ -694,12 +691,12 @@ namespace Vocaluxe.Screens private void _ResetPlayerSelections() { - for (int i = 0; i < CGame.NumPlayer; i++) + for (int i = 0; i < CGame.NumPlayers; i++) { _NameSelections[_NameSelection].RemoveUsedProfile(CGame.Players[i].ProfileID); CGame.Players[i].ProfileID = -1; //Update config for default players. - CConfig.Players[i] = String.Empty; + CConfig.Config.Game.Players[i] = String.Empty; //Update texture and name _Statics[_StaticPlayerAvatar[i]].Texture = _OriginalPlayerAvatarTextures[i]; _Texts[_TextPlayer[i]].Text = CProfiles.GetPlayerName(-1, i + 1); @@ -713,7 +710,7 @@ namespace Vocaluxe.Screens _NameSelections[_NameSelection].RemoveUsedProfile(CGame.Players[playerNum].ProfileID); CGame.Players[playerNum].ProfileID = -1; //Update config for default players. - CConfig.Players[playerNum] = String.Empty; + CConfig.Config.Game.Players[playerNum] = String.Empty; CConfig.SaveConfig(); //Update texture and name _Statics[_StaticPlayerAvatar[playerNum]].Texture = _OriginalPlayerAvatarTextures[playerNum]; @@ -727,7 +724,7 @@ namespace Vocaluxe.Screens private void _CheckMics() { var playerWithoutMicro = new List(); - for (int player = 0; player < CConfig.NumPlayer; player++) + for (int player = 0; player < CConfig.Config.Game.NumPlayers; player++) { if (!CConfig.IsMicConfig(player + 1)) playerWithoutMicro.Add(player + 1); @@ -765,7 +762,7 @@ namespace Vocaluxe.Screens private void _CheckPlayers() { var playerWithoutProfile = new List(); - for (int player = 0; player < CConfig.NumPlayer; player++) + for (int player = 0; player < CConfig.Config.Game.NumPlayers; player++) { if (CGame.Players[player].ProfileID < 0) playerWithoutProfile.Add(player + 1); diff --git a/Vocaluxe/Screens/CScreenOptions.cs b/Vocaluxe/Screens/CScreenOptions.cs index 627b6027..63ce4dd6 100644 --- a/Vocaluxe/Screens/CScreenOptions.cs +++ b/Vocaluxe/Screens/CScreenOptions.cs @@ -22,7 +22,7 @@ using VocaluxeLib.Menu; namespace Vocaluxe.Screens { - class CScreenOptions : CMenu + public class CScreenOptions : CMenu { // Version number for theme files. Increment it, if you've changed something on the theme files! protected override int _ScreenVersion @@ -55,32 +55,32 @@ namespace Vocaluxe.Screens { case Keys.Escape: case Keys.Back: - CGraphics.FadeTo(EScreens.ScreenMain); + CGraphics.FadeTo(EScreen.Main); break; case Keys.S: CParty.SetNormalGameMode(); - CGraphics.FadeTo(EScreens.ScreenSong); + CGraphics.FadeTo(EScreen.Song); break; case Keys.Enter: if (_Buttons[_ButtonOptionsGame].Selected) - CGraphics.FadeTo(EScreens.ScreenOptionsGame); + CGraphics.FadeTo(EScreen.OptionsGame); if (_Buttons[_ButtonOptionsSound].Selected) - CGraphics.FadeTo(EScreens.ScreenOptionsSound); + CGraphics.FadeTo(EScreen.OptionsSound); if (_Buttons[_ButtonOptionsRecord].Selected) - CGraphics.FadeTo(EScreens.ScreenOptionsRecord); + CGraphics.FadeTo(EScreen.OptionsRecord); if (_Buttons[_ButtonOptionsVideo].Selected) - CGraphics.FadeTo(EScreens.ScreenOptionsVideo); + CGraphics.FadeTo(EScreen.OptionsVideo); if (_Buttons[_ButtonOptionsLyrics].Selected) - CGraphics.FadeTo(EScreens.ScreenOptionsLyrics); + CGraphics.FadeTo(EScreen.OptionsLyrics); if (_Buttons[_ButtonOptionsTheme].Selected) - CGraphics.FadeTo(EScreens.ScreenOptionsTheme); + CGraphics.FadeTo(EScreen.OptionsTheme); break; } @@ -92,29 +92,29 @@ namespace Vocaluxe.Screens { base.HandleMouse(mouseEvent); - if (mouseEvent.LB && _IsMouseOver(mouseEvent)) + if (mouseEvent.LB && _IsMouseOverCurSelection(mouseEvent)) { if (_Buttons[_ButtonOptionsGame].Selected) - CGraphics.FadeTo(EScreens.ScreenOptionsGame); + CGraphics.FadeTo(EScreen.OptionsGame); if (_Buttons[_ButtonOptionsSound].Selected) - CGraphics.FadeTo(EScreens.ScreenOptionsSound); + CGraphics.FadeTo(EScreen.OptionsSound); if (_Buttons[_ButtonOptionsRecord].Selected) - CGraphics.FadeTo(EScreens.ScreenOptionsRecord); + CGraphics.FadeTo(EScreen.OptionsRecord); if (_Buttons[_ButtonOptionsVideo].Selected) - CGraphics.FadeTo(EScreens.ScreenOptionsVideo); + CGraphics.FadeTo(EScreen.OptionsVideo); if (_Buttons[_ButtonOptionsLyrics].Selected) - CGraphics.FadeTo(EScreens.ScreenOptionsLyrics); + CGraphics.FadeTo(EScreen.OptionsLyrics); if (_Buttons[_ButtonOptionsTheme].Selected) - CGraphics.FadeTo(EScreens.ScreenOptionsTheme); + CGraphics.FadeTo(EScreen.OptionsTheme); } if (mouseEvent.RB) - CGraphics.FadeTo(EScreens.ScreenMain); + CGraphics.FadeTo(EScreen.Main); return true; } @@ -122,11 +122,5 @@ namespace Vocaluxe.Screens { return true; } - - public override bool Draw() - { - base.Draw(); - return true; - } } } \ No newline at end of file diff --git a/Vocaluxe/Screens/CScreenOptionsGame.cs b/Vocaluxe/Screens/CScreenOptionsGame.cs index 4ed5c752..40729730 100644 --- a/Vocaluxe/Screens/CScreenOptionsGame.cs +++ b/Vocaluxe/Screens/CScreenOptionsGame.cs @@ -22,7 +22,7 @@ using VocaluxeLib.Menu; namespace Vocaluxe.Screens { - class CScreenOptionsGame : CMenu + public class CScreenOptionsGame : CMenu { // Version number for theme files. Increment it, if you've changed something on the theme files! protected override int _ScreenVersion @@ -55,11 +55,11 @@ namespace Vocaluxe.Screens _SelectSlides[_SelectSlideLanguage].AddValues(CLanguage.GetLanguageNames()); _SelectSlides[_SelectSlideLanguage].Selection = CLanguage.LanguageId; - _SelectSlides[_SelectSlideDebugLevel].SetValues((int)CConfig.DebugLevel); + _SelectSlides[_SelectSlideDebugLevel].SetValues((int)CConfig.Config.Debug.DebugLevel); _SelectSlides[_SelectSlideSongMenu].SetValues((int)CConfig.SongMenu); - _SelectSlides[_SelectSlideSongSorting].SetValues((int)CConfig.SongSorting); - _SelectSlides[_SelectSlideTabs].SetValues((int)CConfig.Tabs); - _SelectSlides[_SelectSlideTimerMode].SetValues((int)CConfig.TimerMode); + _SelectSlides[_SelectSlideSongSorting].SetValues((int)CConfig.Config.Game.SongSorting); + _SelectSlides[_SelectSlideTabs].SetValues((int)CConfig.Config.Game.Tabs); + _SelectSlides[_SelectSlideTimerMode].SetValues((int)CConfig.Config.Game.TimerMode); } public override bool HandleInput(SKeyEvent keyEvent) @@ -73,19 +73,19 @@ namespace Vocaluxe.Screens case Keys.Escape: case Keys.Back: _SaveConfig(); - CGraphics.FadeTo(EScreens.ScreenOptions); + CGraphics.FadeTo(EScreen.Options); break; case Keys.S: CParty.SetNormalGameMode(); - CGraphics.FadeTo(EScreens.ScreenSong); + CGraphics.FadeTo(EScreen.Song); break; case Keys.Enter: if (_Buttons[_ButtonExit].Selected) { _SaveConfig(); - CGraphics.FadeTo(EScreens.ScreenOptions); + CGraphics.FadeTo(EScreen.Options); } else if (_Buttons[_ButtonServer].Selected) CGraphics.ShowPopup(EPopupScreens.PopupServerQR); @@ -110,14 +110,14 @@ namespace Vocaluxe.Screens if (mouseEvent.RB) { _SaveConfig(); - CGraphics.FadeTo(EScreens.ScreenOptions); + CGraphics.FadeTo(EScreen.Options); } - if (mouseEvent.LB && _IsMouseOver(mouseEvent)) + if (mouseEvent.LB && _IsMouseOverCurSelection(mouseEvent)) { if (_Buttons[_ButtonExit].Selected) { - CGraphics.FadeTo(EScreens.ScreenOptions); + CGraphics.FadeTo(EScreen.Options); _SaveConfig(); } else if (_Buttons[_ButtonServer].Selected) @@ -131,26 +131,20 @@ namespace Vocaluxe.Screens return true; } - public override bool Draw() - { - base.Draw(); - return true; - } - private void _SaveConfig() { CLanguage.LanguageId = _SelectSlides[_SelectSlideLanguage].Selection; - CConfig.Language = CLanguage.GetLanguageName(CLanguage.LanguageId); - CConfig.DebugLevel = (EDebugLevel)_SelectSlides[_SelectSlideDebugLevel].Selection; + CConfig.Config.Game.Language = _SelectSlides[_SelectSlideLanguage].Value; + CConfig.Config.Debug.DebugLevel = (EDebugLevel)_SelectSlides[_SelectSlideDebugLevel].Selection; CConfig.SongMenu = (ESongMenu)_SelectSlides[_SelectSlideSongMenu].Selection; - CConfig.SongSorting = (ESongSorting)_SelectSlides[_SelectSlideSongSorting].Selection; - CConfig.Tabs = (EOffOn)_SelectSlides[_SelectSlideTabs].Selection; - CConfig.TimerMode = (ETimerMode)_SelectSlides[_SelectSlideTimerMode].Selection; + CConfig.Config.Game.SongSorting = (ESongSorting)_SelectSlides[_SelectSlideSongSorting].Selection; + CConfig.Config.Game.Tabs = (EOffOn)_SelectSlides[_SelectSlideTabs].Selection; + CConfig.Config.Game.TimerMode = (ETimerMode)_SelectSlides[_SelectSlideTimerMode].Selection; CConfig.SaveConfig(); - CSongs.Sorter.SongSorting = CConfig.SongSorting; - CSongs.Categorizer.Tabs = CConfig.Tabs; + CSongs.Sorter.SongSorting = CConfig.Config.Game.SongSorting; + CSongs.Categorizer.Tabs = CConfig.Config.Game.Tabs; } } } \ No newline at end of file diff --git a/Vocaluxe/Screens/CScreenOptionsLyrics.cs b/Vocaluxe/Screens/CScreenOptionsLyrics.cs index e2093af4..da4a608d 100644 --- a/Vocaluxe/Screens/CScreenOptionsLyrics.cs +++ b/Vocaluxe/Screens/CScreenOptionsLyrics.cs @@ -22,7 +22,7 @@ using VocaluxeLib.Menu; namespace Vocaluxe.Screens { - class CScreenOptionsLyrics : CMenu + public class CScreenOptionsLyrics : CMenu { // Version number for theme files. Increment it, if you've changed something on the theme files! protected override int _ScreenVersion @@ -46,8 +46,8 @@ namespace Vocaluxe.Screens public override void LoadTheme(string xmlPath) { base.LoadTheme(xmlPath); - _SelectSlides[_SelectSlideLyricStyle].SetValues((int)CConfig.LyricStyle); - _SelectSlides[_SelectSlideLyricsPosition].SetValues((int)CConfig.LyricsPosition); + _SelectSlides[_SelectSlideLyricStyle].SetValues((int)CConfig.Config.Theme.LyricStyle); + _SelectSlides[_SelectSlideLyricsPosition].SetValues((int)CConfig.Config.Game.LyricsPosition); } public override bool HandleInput(SKeyEvent keyEvent) @@ -62,19 +62,19 @@ namespace Vocaluxe.Screens case Keys.Escape: case Keys.Back: _SaveConfig(); - CGraphics.FadeTo(EScreens.ScreenOptions); + CGraphics.FadeTo(EScreen.Options); break; case Keys.S: CParty.SetNormalGameMode(); - CGraphics.FadeTo(EScreens.ScreenSong); + CGraphics.FadeTo(EScreen.Song); break; case Keys.Enter: if (_Buttons[_ButtonExit].Selected) { _SaveConfig(); - CGraphics.FadeTo(EScreens.ScreenOptions); + CGraphics.FadeTo(EScreen.Options); } break; @@ -97,13 +97,13 @@ namespace Vocaluxe.Screens if (mouseEvent.RB) { _SaveConfig(); - CGraphics.FadeTo(EScreens.ScreenOptions); + CGraphics.FadeTo(EScreen.Options); } - if (mouseEvent.LB && _IsMouseOver(mouseEvent)) + if (mouseEvent.LB && _IsMouseOverCurSelection(mouseEvent)) { _SaveConfig(); if (_Buttons[_ButtonExit].Selected) - CGraphics.FadeTo(EScreens.ScreenOptions); + CGraphics.FadeTo(EScreen.Options); } return true; } @@ -113,16 +113,10 @@ namespace Vocaluxe.Screens return true; } - public override bool Draw() - { - base.Draw(); - return true; - } - private void _SaveConfig() { - CConfig.LyricsPosition = (ELyricsPosition)_SelectSlides[_SelectSlideLyricsPosition].Selection; - CConfig.LyricStyle = (ELyricStyle)_SelectSlides[_SelectSlideLyricStyle].Selection; + CConfig.Config.Game.LyricsPosition = (ELyricsPosition)_SelectSlides[_SelectSlideLyricsPosition].Selection; + CConfig.Config.Theme.LyricStyle = (ELyricStyle)_SelectSlides[_SelectSlideLyricStyle].Selection; CConfig.SaveConfig(); } } diff --git a/Vocaluxe/Screens/CScreenOptionsRecord.cs b/Vocaluxe/Screens/CScreenOptionsRecord.cs index 1a658fe5..df51de82 100644 --- a/Vocaluxe/Screens/CScreenOptionsRecord.cs +++ b/Vocaluxe/Screens/CScreenOptionsRecord.cs @@ -19,13 +19,14 @@ using System.Collections.Generic; using System.Collections.ObjectModel; using System.Windows.Forms; using Vocaluxe.Base; +using Vocaluxe.Base.ThemeSystem; using Vocaluxe.Lib.Sound.Record; using VocaluxeLib; using VocaluxeLib.Menu; namespace Vocaluxe.Screens { - class CScreenOptionsRecord : CMenu + public class CScreenOptionsRecord : CMenu { // Version number for theme files. Increment it, if you've changed something on the theme files! protected override int _ScreenVersion @@ -62,6 +63,11 @@ namespace Vocaluxe.Screens private readonly CDelayTest _DelayTest = new CDelayTest(2); + public override EMusicType CurrentMusicType + { + get { return EMusicType.Game; } + } + public override void Init() { base.Init(); @@ -106,9 +112,6 @@ namespace Vocaluxe.Screens _Statics[_StaticEnergyChannel[i]].Visible = false; _ChannelEnergy[i] = 0f; } - - _Equalizers[_EqualizerChannel1].ScreenHandles = true; - _Equalizers[_EqualizerChannel2].ScreenHandles = true; } public override bool HandleInput(SKeyEvent keyEvent) @@ -123,19 +126,19 @@ namespace Vocaluxe.Screens case Keys.Escape: case Keys.Back: _SaveMicConfig(); - CGraphics.FadeTo(EScreens.ScreenOptions); + CGraphics.FadeTo(EScreen.Options); break; case Keys.S: CParty.SetNormalGameMode(); - CGraphics.FadeTo(EScreens.ScreenSong); + CGraphics.FadeTo(EScreen.Song); break; case Keys.Enter: if (_Buttons[_ButtonExit].Selected) { _SaveMicConfig(); - CGraphics.FadeTo(EScreens.ScreenOptions); + CGraphics.FadeTo(EScreen.Options); } if (_Buttons[_ButtonDelayTest].Selected) @@ -182,10 +185,10 @@ namespace Vocaluxe.Screens if (mouseEvent.RB) { _SaveMicConfig(); - CGraphics.FadeTo(EScreens.ScreenOptions); + CGraphics.FadeTo(EScreen.Options); } - if (mouseEvent.LB && _IsMouseOver(mouseEvent)) + if (mouseEvent.LB && _IsMouseOverCurSelection(mouseEvent)) { if (_SelectSlides[_SelectSlideRecordDevices].Selected) _OnDeviceEvent(); @@ -200,7 +203,7 @@ namespace Vocaluxe.Screens if (_Buttons[_ButtonExit].Selected) { _SaveMicConfig(); - CGraphics.FadeTo(EScreens.ScreenOptions); + CGraphics.FadeTo(EScreen.Options); } if (_Buttons[_ButtonDelayTest].Selected) @@ -255,6 +258,10 @@ namespace Vocaluxe.Screens _Equalizers[_EqualizerChannel2].Reset(); } + bool showWarning = !_CheckMicConfig(); + _Statics[_StaticWarning].Visible = showWarning; + _Texts[_TextWarning].Visible = showWarning; + return true; } @@ -290,7 +297,7 @@ namespace Vocaluxe.Screens _DelayTest.Reset(); - _SelectSlides[_SelectSlideDelay].Selection = CConfig.MicDelay / 20; + _SelectSlides[_SelectSlideDelay].Selection = CConfig.Config.Record.MicDelay / 20; } public override void OnShowFinish() @@ -299,20 +306,9 @@ namespace Vocaluxe.Screens CBackgroundMusic.Disabled = true; } - public override bool Draw() + public override void Draw() { - _DrawBG(); - - if (!_CheckMicConfig()) - { - _Statics[_StaticWarning].Visible = true; - _Texts[_TextWarning].Visible = true; - } - else - { - _Statics[_StaticWarning].Visible = false; - _Texts[_TextWarning].Visible = false; - } + base.Draw(); for (int i = 0; i < _StaticEnergyChannel.Length; i++) { @@ -328,13 +324,6 @@ namespace Vocaluxe.Screens new SColorF(1f, 1f, 1f, 1f), rect); } } - - _Equalizers[_EqualizerChannel1].Draw(); - _Equalizers[_EqualizerChannel2].Draw(); - - _DrawFG(); - - return true; } public override void OnClose() @@ -357,7 +346,7 @@ namespace Vocaluxe.Screens private void _SaveDelayConfig() { - CConfig.MicDelay = _SelectSlides[_SelectSlideDelay].Selection * 20; + CConfig.Config.Record.MicDelay = _SelectSlides[_SelectSlideDelay].Selection * 20; CConfig.SaveConfig(); } @@ -371,23 +360,23 @@ namespace Vocaluxe.Screens if (_CheckMicConfig()) { - for (int p = 0; p < CSettings.MaxNumPlayer; p++) - CConfig.MicConfig[p].Channel = 0; + for (int p = 0; p < CConfig.Config.Record.MicConfig.Length; p++) + CConfig.Config.Record.MicConfig[p].Channel = 0; foreach (CRecordDevice device in _Devices) { if (device.PlayerChannel1 > 0) { - CConfig.MicConfig[device.PlayerChannel1 - 1].Channel = 1; - CConfig.MicConfig[device.PlayerChannel1 - 1].DeviceName = device.Name; - CConfig.MicConfig[device.PlayerChannel1 - 1].DeviceDriver = device.Driver; + CConfig.Config.Record.MicConfig[device.PlayerChannel1 - 1].Channel = 1; + CConfig.Config.Record.MicConfig[device.PlayerChannel1 - 1].DeviceName = device.Name; + CConfig.Config.Record.MicConfig[device.PlayerChannel1 - 1].DeviceDriver = device.Driver; } if (device.PlayerChannel2 > 0) { - CConfig.MicConfig[device.PlayerChannel2 - 1].Channel = 2; - CConfig.MicConfig[device.PlayerChannel2 - 1].DeviceName = device.Name; - CConfig.MicConfig[device.PlayerChannel2 - 1].DeviceDriver = device.Driver; + CConfig.Config.Record.MicConfig[device.PlayerChannel2 - 1].Channel = 2; + CConfig.Config.Record.MicConfig[device.PlayerChannel2 - 1].DeviceName = device.Name; + CConfig.Config.Record.MicConfig[device.PlayerChannel2 - 1].DeviceDriver = device.Driver; } } CConfig.SaveConfig(); @@ -397,8 +386,10 @@ namespace Vocaluxe.Screens private void _SetPlayerColors() { - _Texts[_TextChannel1].Color = CTheme.GetPlayerColor(_SelectSlides[_SelectSlideRecordChannel1].Selection); - _Texts[_TextChannel2].Color = CTheme.GetPlayerColor(_SelectSlides[_SelectSlideRecordChannel2].Selection); + _Texts[_TextChannel1].Color = _SelectSlides[_SelectSlideRecordChannel1].Selection <= 0 + ? new SColorF(1, 1, 1, 1) : CThemes.GetPlayerColor(_SelectSlides[_SelectSlideRecordChannel1].Selection); + _Texts[_TextChannel2].Color = _SelectSlides[_SelectSlideRecordChannel2].Selection <= 0 + ? new SColorF(1, 1, 1, 1) : CThemes.GetPlayerColor(_SelectSlides[_SelectSlideRecordChannel2].Selection); } private void _SetMicConfig() @@ -462,15 +453,15 @@ namespace Vocaluxe.Screens if (_Devices == null) return; - if (CConfig.MicConfig == null) + if (CConfig.Config.Record.MicConfig == null) return; - if (CConfig.MicConfig[0].Channel <= 0) + if (CConfig.Config.Record.MicConfig[0].Channel <= 0) return; for (int i = 0; i < _Devices.Count; i++) { - if (_Devices[i].Name == CConfig.MicConfig[0].DeviceName && _Devices[i].Driver == CConfig.MicConfig[0].DeviceDriver) + if (_Devices[i].Name == CConfig.Config.Record.MicConfig[0].DeviceName && _Devices[i].Driver == CConfig.Config.Record.MicConfig[0].DeviceDriver) { device = i; return; diff --git a/Vocaluxe/Screens/CScreenOptionsSound.cs b/Vocaluxe/Screens/CScreenOptionsSound.cs index 0d711fd0..b3deb818 100644 --- a/Vocaluxe/Screens/CScreenOptionsSound.cs +++ b/Vocaluxe/Screens/CScreenOptionsSound.cs @@ -22,7 +22,7 @@ using VocaluxeLib.Menu; namespace Vocaluxe.Screens { - class CScreenOptionsSound : CMenu + public class CScreenOptionsSound : CMenu { // Version number for theme files. Increment it, if you've changed something on the theme files! protected override int _ScreenVersion @@ -52,12 +52,12 @@ namespace Vocaluxe.Screens public override void LoadTheme(string xmlPath) { base.LoadTheme(xmlPath); - _SelectSlides[_SelectSlideBackgroundMusic].SetValues((int)CConfig.BackgroundMusic); + _SelectSlides[_SelectSlideBackgroundMusic].SetValues((int)CConfig.Config.Sound.BackgroundMusic); _SelectSlides[_SelectSlideBackgroundMusicVolume].AddValues(new string[] {"0", "5", "10", "15", "20", "25", "30", "35", "40", "45", "50", "55", "60", "65", "70", "75", "80", "85", "90", "95", "100"}); _SelectSlides[_SelectSlideBackgroundMusicVolume].Selection = CConfig.BackgroundMusicVolume / 5; - _SelectSlides[_SelectSlideBackgroundMusicSource].SetValues((int)CConfig.BackgroundMusicSource); - _SelectSlides[_SelectSlideBackgroundMusicSource].Selection = (int)CConfig.BackgroundMusicSource; + _SelectSlides[_SelectSlideBackgroundMusicSource].SetValues((int)CConfig.Config.Sound.BackgroundMusicSource); + _SelectSlides[_SelectSlideBackgroundMusicSource].Selection = (int)CConfig.Config.Sound.BackgroundMusicSource; _SelectSlides[_SelectSlidePreviewMusicVolume].AddValues(new string[] {"0", "5", "10", "15", "20", "25", "30", "35", "40", "45", "50", "55", "60", "65", "70", "75", "80", "85", "90", "95", "100"}); _SelectSlides[_SelectSlidePreviewMusicVolume].Selection = CConfig.PreviewMusicVolume / 5; @@ -78,19 +78,19 @@ namespace Vocaluxe.Screens case Keys.Escape: case Keys.Back: _SaveConfig(); - CGraphics.FadeTo(EScreens.ScreenOptions); + CGraphics.FadeTo(EScreen.Options); break; case Keys.S: CParty.SetNormalGameMode(); - CGraphics.FadeTo(EScreens.ScreenSong); + CGraphics.FadeTo(EScreen.Song); break; case Keys.Enter: if (_Buttons[_ButtonExit].Selected) { _SaveConfig(); - CGraphics.FadeTo(EScreens.ScreenOptions); + CGraphics.FadeTo(EScreen.Options); } break; @@ -113,13 +113,13 @@ namespace Vocaluxe.Screens if (mouseEvent.RB) { _SaveConfig(); - CGraphics.FadeTo(EScreens.ScreenOptions); + CGraphics.FadeTo(EScreen.Options); } - if (mouseEvent.LB && _IsMouseOver(mouseEvent)) + if (mouseEvent.LB && _IsMouseOverCurSelection(mouseEvent)) { _SaveConfig(); if (_Buttons[_ButtonExit].Selected) - CGraphics.FadeTo(EScreens.ScreenOptions); + CGraphics.FadeTo(EScreen.Options); } return true; } @@ -131,12 +131,6 @@ namespace Vocaluxe.Screens return true; } - public override bool Draw() - { - base.Draw(); - return true; - } - public override void OnShow() { base.OnShow(); @@ -150,17 +144,17 @@ namespace Vocaluxe.Screens { CConfig.GameMusicVolume = _SelectSlides[_SelectSlideGameMusicVolume].Selection * 5; CConfig.PreviewMusicVolume = _SelectSlides[_SelectSlidePreviewMusicVolume].Selection * 5; - CConfig.BackgroundMusic = (EBackgroundMusicOffOn)_SelectSlides[_SelectSlideBackgroundMusic].Selection; - CConfig.BackgroundMusicSource = (EBackgroundMusicSource)_SelectSlides[_SelectSlideBackgroundMusicSource].Selection; + CConfig.Config.Sound.BackgroundMusic = (EBackgroundMusicOffOn)_SelectSlides[_SelectSlideBackgroundMusic].Selection; + CConfig.Config.Sound.BackgroundMusicSource = (EBackgroundMusicSource)_SelectSlides[_SelectSlideBackgroundMusicSource].Selection; CConfig.BackgroundMusicVolume = _SelectSlides[_SelectSlideBackgroundMusicVolume].Selection * 5; CConfig.SaveConfig(); - CBackgroundMusic.SetMusicSource(CConfig.BackgroundMusicSource); + CBackgroundMusic.SetMusicSource(CConfig.Config.Sound.BackgroundMusicSource); CSound.SetGlobalVolume(CConfig.BackgroundMusicVolume); - if (CConfig.BackgroundMusic == EBackgroundMusicOffOn.TR_CONFIG_ON) + if (CConfig.Config.Sound.BackgroundMusic == EBackgroundMusicOffOn.TR_CONFIG_ON) CBackgroundMusic.Play(); else - CBackgroundMusic.Pause(); + CBackgroundMusic.Stop(); } } } \ No newline at end of file diff --git a/Vocaluxe/Screens/CScreenOptionsTheme.cs b/Vocaluxe/Screens/CScreenOptionsTheme.cs index a58226a8..e21f5087 100644 --- a/Vocaluxe/Screens/CScreenOptionsTheme.cs +++ b/Vocaluxe/Screens/CScreenOptionsTheme.cs @@ -15,15 +15,16 @@ // along with Vocaluxe. If not, see . #endregion +using System; using System.Windows.Forms; using Vocaluxe.Base; -using Vocaluxe.Base.Fonts; +using Vocaluxe.Base.ThemeSystem; using VocaluxeLib; using VocaluxeLib.Menu; namespace Vocaluxe.Screens { - class CScreenOptionsTheme : CMenu + public class CScreenOptionsTheme : CMenu { // Version number for theme files. Increment it, if you've changed something on the theme files! protected override int _ScreenVersion @@ -42,11 +43,7 @@ namespace Vocaluxe.Screens private const string _ButtonExit = "ButtonExit"; - private int _OldCoverTheme; - private int _OldTheme; - private int _OldSkin; - - private int _TempSkin; + private string _OldCoverTheme; public override void Init() { @@ -70,19 +67,13 @@ namespace Vocaluxe.Screens { base.LoadTheme(xmlPath); - _SelectSlides[_SelectSlideTheme].AddValues(CTheme.ThemeNames); - _SelectSlides[_SelectSlideTheme].Selection = CTheme.GetThemeIndex(-1); - - _SelectSlides[_SelectSlideSkin].AddValues(CTheme.SkinNames); - _SelectSlides[_SelectSlideSkin].Selection = CTheme.GetSkinIndex(-1); - _SelectSlides[_SelectSlideCover].AddValues(CCover.CoverThemes); _SelectSlides[_SelectSlideCover].Selection = CCover.GetCoverThemeIndex(); - _SelectSlides[_SelectSlideNoteLines].SetValues((int)CConfig.DrawNoteLines); - _SelectSlides[_SelectSlideToneHelper].SetValues((int)CConfig.DrawToneHelper); - _SelectSlides[_SelectSlideTimerLook].SetValues((int)CConfig.TimerLook); - _SelectSlides[_SelectSlideFadeInfo].SetValues((int)CConfig.FadePlayerInfo); - _SelectSlides[_SelectSlideCoverLoading].SetValues((int)CConfig.CoverLoading); + _SelectSlides[_SelectSlideNoteLines].SetValues((int)CConfig.Config.Theme.DrawNoteLines); + _SelectSlides[_SelectSlideToneHelper].SetValues((int)CConfig.Config.Theme.DrawToneHelper); + _SelectSlides[_SelectSlideTimerLook].SetValues((int)CConfig.Config.Theme.TimerLook); + _SelectSlides[_SelectSlideFadeInfo].SetValues((int)CConfig.Config.Theme.FadePlayerInfo); + _SelectSlides[_SelectSlideCoverLoading].SetValues((int)CConfig.Config.Theme.CoverLoading); } public override bool HandleInput(SKeyEvent keyEvent) @@ -101,7 +92,7 @@ namespace Vocaluxe.Screens case Keys.S: CParty.SetNormalGameMode(); - CGraphics.FadeTo(EScreens.ScreenSong); + CGraphics.FadeTo(EScreen.Song); break; case Keys.Enter: @@ -128,7 +119,7 @@ namespace Vocaluxe.Screens if (mouseEvent.RB) _Close(); - if (mouseEvent.LB && _IsMouseOver(mouseEvent)) + if (mouseEvent.LB && _IsMouseOverCurSelection(mouseEvent)) { if (_Buttons[_ButtonExit].Selected) _Close(); @@ -142,10 +133,20 @@ namespace Vocaluxe.Screens { base.OnShow(); - _OldCoverTheme = CCover.GetCoverThemeIndex(); - _OldTheme = CTheme.GetThemeIndex(-1); - _OldSkin = CTheme.GetSkinIndex(-1); - _TempSkin = _OldSkin; + _ResetSlides(); + + _OldCoverTheme = CConfig.Config.Theme.CoverTheme; + } + + private void _ResetSlides() + { + _SelectSlides[_SelectSlideTheme].Clear(); + _SelectSlides[_SelectSlideTheme].AddValues(CThemes.ThemeNames); + _SelectSlides[_SelectSlideTheme].Selection = Array.IndexOf(CThemes.ThemeNames, CConfig.Config.Theme.Theme); + + _SelectSlides[_SelectSlideSkin].Clear(); + _SelectSlides[_SelectSlideSkin].AddValues(CThemes.SkinNames); + _SelectSlides[_SelectSlideSkin].Selection = Array.IndexOf(CThemes.SkinNames, CConfig.Config.Theme.Skin); } public override bool UpdateGame() @@ -153,86 +154,47 @@ namespace Vocaluxe.Screens return true; } - public override bool Draw() - { - base.Draw(); - return true; - } - private void _Close() { _SaveConfig(); - CGraphics.FadeTo(EScreens.ScreenOptions); + CGraphics.FadeTo(EScreen.Options); } private void _SaveConfig() { - CConfig.Theme = CTheme.ThemeNames[_SelectSlides[_SelectSlideTheme].Selection]; - CConfig.Skin = CTheme.SkinNames[_SelectSlides[_SelectSlideSkin].Selection]; - CConfig.CoverTheme = CCover.CoverThemes[_SelectSlides[_SelectSlideCover].Selection]; - CConfig.DrawNoteLines = (EOffOn)_SelectSlides[_SelectSlideNoteLines].Selection; - CConfig.DrawToneHelper = (EOffOn)_SelectSlides[_SelectSlideToneHelper].Selection; - CConfig.TimerLook = (ETimerLook)_SelectSlides[_SelectSlideTimerLook].Selection; - CConfig.FadePlayerInfo = (EFadePlayerInfo)_SelectSlides[_SelectSlideFadeInfo].Selection; - CConfig.CoverLoading = (ECoverLoading)_SelectSlides[_SelectSlideCoverLoading].Selection; + CConfig.Config.Theme.CoverTheme = CCover.CoverThemes[_SelectSlides[_SelectSlideCover].Selection]; + CConfig.Config.Theme.DrawNoteLines = (EOffOn)_SelectSlides[_SelectSlideNoteLines].Selection; + CConfig.Config.Theme.DrawToneHelper = (EOffOn)_SelectSlides[_SelectSlideToneHelper].Selection; + CConfig.Config.Theme.TimerLook = (ETimerLook)_SelectSlides[_SelectSlideTimerLook].Selection; + CConfig.Config.Theme.FadePlayerInfo = (EFadePlayerInfo)_SelectSlides[_SelectSlideFadeInfo].Selection; + CConfig.Config.Theme.CoverLoading = (ECoverLoading)_SelectSlides[_SelectSlideCoverLoading].Selection; CConfig.SaveConfig(); - if (_OldCoverTheme != _SelectSlides[_SelectSlideCover].Selection) + if (_OldCoverTheme != _SelectSlides[_SelectSlideCover].Value) CCover.ReloadCovers(); - - if (_OldTheme != _SelectSlides[_SelectSlideTheme].Selection) - { - CConfig.Theme = CTheme.ThemeNames[_SelectSlides[_SelectSlideTheme].Selection]; - _OldTheme = _SelectSlides[_SelectSlideTheme].Selection; - - CTheme.UnloadSkins(); - CFonts.UnloadThemeFonts(CConfig.Theme); - CTheme.ListSkins(); - CConfig.Skin = CTheme.SkinNames[0]; - _OldSkin = 0; - _TempSkin = _OldSkin; - - CConfig.SaveConfig(); - - CTheme.LoadSkins(); - CTheme.LoadTheme(); - CGraphics.ReloadTheme(); - } } private void _OnChange() { - if (_OldTheme != _SelectSlides[_SelectSlideTheme].Selection) + if (CConfig.Config.Theme.Theme != _SelectSlides[_SelectSlideTheme].Value) { - CConfig.Theme = CTheme.ThemeNames[_SelectSlides[_SelectSlideTheme].Selection]; - _OldTheme = _SelectSlides[_SelectSlideTheme].Selection; + CConfig.Config.Theme.Theme = _SelectSlides[_SelectSlideTheme].Value; - CTheme.UnloadSkins(); - CFonts.UnloadThemeFonts(CConfig.Theme); - CTheme.ListSkins(); - CConfig.Skin = CTheme.SkinNames[0]; - _OldSkin = 0; - _TempSkin = _OldSkin; - - CConfig.SaveConfig(); - - CTheme.LoadSkins(); - CTheme.LoadTheme(); + CThemes.Reload(); CGraphics.ReloadTheme(); - - OnShow(); - OnShowFinish(); + _ResetSlides(); + _ResumeBG(); return; } - if (_TempSkin != _SelectSlides[_SelectSlideSkin].Selection) + if (CConfig.Config.Theme.Skin != _SelectSlides[_SelectSlideSkin].Value) { - _TempSkin = _SelectSlides[_SelectSlideSkin].Selection; + CConfig.Config.Theme.Skin = _SelectSlides[_SelectSlideSkin].Value; - _PauseBG(); - CConfig.Skin = CTheme.SkinNames[_TempSkin]; + CThemes.ReloadSkin(); CGraphics.ReloadSkin(); + _ResetSlides(); _ResumeBG(); } } diff --git a/Vocaluxe/Screens/CScreenOptionsVideo.cs b/Vocaluxe/Screens/CScreenOptionsVideo.cs index a2bf330d..d8ff7710 100644 --- a/Vocaluxe/Screens/CScreenOptionsVideo.cs +++ b/Vocaluxe/Screens/CScreenOptionsVideo.cs @@ -25,7 +25,7 @@ using VocaluxeLib.Draw; namespace Vocaluxe.Screens { - class CScreenOptionsVideo : CMenu + public class CScreenOptionsVideo : CMenu { // Version number for theme files. Increment it, if you've changed something on the theme files! protected override int _ScreenVersion @@ -49,7 +49,7 @@ namespace Vocaluxe.Screens private const string _TextWebcamResolution = "TextWebcamResolution"; private SWebcamConfig _Config; - private CTexture _WebcamTexture; + private CTextureRef _WebcamTexture; private int _DeviceNr; private int _CapabilityNr; @@ -71,10 +71,10 @@ namespace Vocaluxe.Screens { base.LoadTheme(xmlPath); - _SelectSlides[_SelectSlideVideoBackgrounds].SetValues((int)CConfig.VideoBackgrounds); - _SelectSlides[_SelectSlideVideoPreview].SetValues((int)CConfig.VideoPreview); - _SelectSlides[_SelectSlideVideosInSongs].SetValues((int)CConfig.VideosInSongs); - _SelectSlides[_SelectSlideVideosToBackground].SetValues((int)CConfig.VideosToBackground); + _SelectSlides[_SelectSlideVideoBackgrounds].SetValues((int)CConfig.Config.Video.VideoBackgrounds); + _SelectSlides[_SelectSlideVideoPreview].SetValues((int)CConfig.Config.Video.VideoPreview); + _SelectSlides[_SelectSlideVideosInSongs].SetValues((int)CConfig.Config.Video.VideosInSongs); + _SelectSlides[_SelectSlideVideosToBackground].SetValues((int)CConfig.Config.Video.VideosToBackground); _Statics[_StaticWebcamOutput].Aspect = EAspect.Crop; } @@ -90,24 +90,24 @@ namespace Vocaluxe.Screens case Keys.Escape: case Keys.Back: _SaveConfig(); - CGraphics.FadeTo(EScreens.ScreenOptions); + CGraphics.FadeTo(EScreen.Options); break; case Keys.S: CParty.SetNormalGameMode(); - CGraphics.FadeTo(EScreens.ScreenSong); + CGraphics.FadeTo(EScreen.Song); break; case Keys.Enter: if (_Buttons[_ButtonExit].Selected) { _SaveConfig(); - CGraphics.FadeTo(EScreens.ScreenOptions); + CGraphics.FadeTo(EScreen.Options); } else if (_Buttons[_ButtonScreenAdjustments].Selected) { _SaveConfig(); - CGraphics.FadeTo(EScreens.ScreenOptionsVideoAdjustments); + CGraphics.FadeTo(EScreen.OptionsVideoAdjustments); } break; @@ -138,10 +138,10 @@ namespace Vocaluxe.Screens if (mouseEvent.RB) { _SaveConfig(); - CGraphics.FadeTo(EScreens.ScreenOptions); + CGraphics.FadeTo(EScreen.Options); } - if (mouseEvent.LB && _IsMouseOver(mouseEvent)) + if (mouseEvent.LB && _IsMouseOverCurSelection(mouseEvent)) { if (_SelectSlides[_SelectSlideWebcamDevices].Selected) _OnDeviceEvent(); @@ -149,9 +149,9 @@ namespace Vocaluxe.Screens _OnCapabilitiesEvent(); _SaveConfig(); if (_Buttons[_ButtonExit].Selected) - CGraphics.FadeTo(EScreens.ScreenOptions); + CGraphics.FadeTo(EScreen.Options); if (_Buttons[_ButtonScreenAdjustments].Selected) - CGraphics.FadeTo(EScreens.ScreenOptionsVideoAdjustments); + CGraphics.FadeTo(EScreen.OptionsVideoAdjustments); } return true; } @@ -160,14 +160,7 @@ namespace Vocaluxe.Screens { if (CWebcam.GetFrame(ref _WebcamTexture)) _Statics[_StaticWebcamOutput].Texture = _WebcamTexture; - _SelectSlides[_SelectSlideVideosToBackground].Selection = (int)CConfig.VideosToBackground; - return true; - } - - public override bool Draw() - { - base.Draw(); - + _SelectSlides[_SelectSlideVideosToBackground].Selection = (int)CConfig.Config.Video.VideosToBackground; return true; } @@ -223,13 +216,13 @@ namespace Vocaluxe.Screens private void _SaveConfig() { - CConfig.VideoBackgrounds = (EOffOn)_SelectSlides[_SelectSlideVideoBackgrounds].Selection; - CConfig.VideoPreview = (EOffOn)_SelectSlides[_SelectSlideVideoPreview].Selection; - CConfig.VideosInSongs = (EOffOn)_SelectSlides[_SelectSlideVideosInSongs].Selection; - CConfig.VideosToBackground = (EOffOn)_SelectSlides[_SelectSlideVideosToBackground].Selection; + CConfig.Config.Video.VideoBackgrounds = (EOffOn)_SelectSlides[_SelectSlideVideoBackgrounds].Selection; + CConfig.Config.Video.VideoPreview = (EOffOn)_SelectSlides[_SelectSlideVideoPreview].Selection; + CConfig.Config.Video.VideosInSongs = (EOffOn)_SelectSlides[_SelectSlideVideosInSongs].Selection; + CConfig.Config.Video.VideosToBackground = (EOffOn)_SelectSlides[_SelectSlideVideosToBackground].Selection; - CConfig.WebcamConfig = _Config; - CBackgroundMusic.VideoEnabled = CConfig.VideoBackgrounds == EOffOn.TR_CONFIG_ON && CConfig.VideosToBackground == EOffOn.TR_CONFIG_ON; + CConfig.Config.Video.WebcamConfig = _Config; + CBackgroundMusic.VideoEnabled = CConfig.Config.Video.VideoBackgrounds == EOffOn.TR_CONFIG_ON && CConfig.Config.Video.VideosToBackground == EOffOn.TR_CONFIG_ON; CConfig.SaveConfig(); } @@ -264,8 +257,8 @@ namespace Vocaluxe.Screens _Config.Height = d.Capabilities[_CapabilityNr].Height; _Config.Framerate = d.Capabilities[_CapabilityNr].Framerate; - CWebcam.Select(_Config); - CWebcam.Start(); + if (CWebcam.Select(_Config)) + CWebcam.Start(); } } @@ -279,15 +272,16 @@ namespace Vocaluxe.Screens capabilities = -1; return false; } - + SWebcamConfig curConfig = CConfig.Config.Video.WebcamConfig.HasValue ? CConfig.Config.Video.WebcamConfig.Value : new SWebcamConfig(); for (int i = 0; i < devices.Length; i++) { - if (devices[i].MonikerString != CConfig.WebcamConfig.MonikerString) + if (devices[i].MonikerString != curConfig.MonikerString) continue; for (int j = 0; j < devices[i].Capabilities.Count; j++) { - if (devices[i].Capabilities[j].Framerate == CConfig.WebcamConfig.Framerate && devices[i].Capabilities[j].Width == CConfig.WebcamConfig.Width && - devices[i].Capabilities[j].Height == CConfig.WebcamConfig.Height) + if (devices[i].Capabilities[j].Framerate == curConfig.Framerate && + devices[i].Capabilities[j].Width == curConfig.Width && + devices[i].Capabilities[j].Height == curConfig.Height) { device = i; capabilities = j; diff --git a/Vocaluxe/Screens/CScreenOptionsVideoAdjustments.cs b/Vocaluxe/Screens/CScreenOptionsVideoAdjustments.cs index 6c22392b..0ad53c54 100644 --- a/Vocaluxe/Screens/CScreenOptionsVideoAdjustments.cs +++ b/Vocaluxe/Screens/CScreenOptionsVideoAdjustments.cs @@ -22,7 +22,7 @@ using VocaluxeLib.Menu; namespace Vocaluxe.Screens { - class CScreenOptionsVideoAdjustments : CMenu + public class CScreenOptionsVideoAdjustments : CMenu { // Version number for theme files. Increment it, if you've changed something on the theme files! protected override int _ScreenVersion @@ -51,19 +51,19 @@ namespace Vocaluxe.Screens case Keys.Escape: case Keys.Back: _SaveConfig(); - CGraphics.FadeTo(EScreens.ScreenOptionsVideo); + CGraphics.FadeTo(EScreen.OptionsVideo); break; case Keys.S: CParty.SetNormalGameMode(); - CGraphics.FadeTo(EScreens.ScreenSong); + CGraphics.FadeTo(EScreen.Song); break; case Keys.Enter: if (_Buttons[_ButtonExit].Selected) { _SaveConfig(); - CGraphics.FadeTo(EScreens.ScreenOptionsVideo); + CGraphics.FadeTo(EScreen.OptionsVideo); } break; } @@ -78,14 +78,14 @@ namespace Vocaluxe.Screens if (mouseEvent.RB) { _SaveConfig(); - CGraphics.FadeTo(EScreens.ScreenOptionsVideo); + CGraphics.FadeTo(EScreen.OptionsVideo); } - if (mouseEvent.LB && _IsMouseOver(mouseEvent)) + if (mouseEvent.LB && _IsMouseOverCurSelection(mouseEvent)) { _SaveConfig(); if (_Buttons[_ButtonExit].Selected) - CGraphics.FadeTo(EScreens.ScreenOptionsVideo); + CGraphics.FadeTo(EScreen.OptionsVideo); } return true; } diff --git a/Vocaluxe/Screens/CScreenParty.cs b/Vocaluxe/Screens/CScreenParty.cs index ab6d5131..3f6d801f 100644 --- a/Vocaluxe/Screens/CScreenParty.cs +++ b/Vocaluxe/Screens/CScreenParty.cs @@ -23,7 +23,7 @@ using VocaluxeLib.Menu; namespace Vocaluxe.Screens { - class CScreenParty : CMenu + public class CScreenParty : CMenu { // Version number for theme files. Increment it, if you've changed something on the theme files! protected override int _ScreenVersion @@ -64,7 +64,7 @@ namespace Vocaluxe.Screens { case Keys.Back: case Keys.Escape: - CGraphics.FadeTo(EScreens.ScreenMain); + CGraphics.FadeTo(EScreen.Main); break; case Keys.Enter: @@ -72,7 +72,7 @@ namespace Vocaluxe.Screens _StartPartyMode(); if (_Buttons[_ButtonExit].Selected) - CGraphics.FadeTo(EScreens.ScreenMain); + CGraphics.FadeTo(EScreen.Main); break; case Keys.Left: @@ -89,20 +89,20 @@ namespace Vocaluxe.Screens { base.HandleMouse(mouseEvent); - if (mouseEvent.LB && _IsMouseOver(mouseEvent)) + if (mouseEvent.LB && _IsMouseOverCurSelection(mouseEvent)) { if (_Buttons[_ButtonStart].Selected) _StartPartyMode(); if (_Buttons[_ButtonExit].Selected) - CGraphics.FadeTo(EScreens.ScreenMain); + CGraphics.FadeTo(EScreen.Main); if (_SelectSlides[_SelectSlideModes].Selected) _UpdateSelection(); } if (mouseEvent.RB) - CGraphics.FadeTo(EScreens.ScreenMain); + CGraphics.FadeTo(EScreen.Main); return true; } @@ -119,7 +119,7 @@ namespace Vocaluxe.Screens _SelectSlides[_SelectSlideModes].Selection = 0; _UpdateSelection(); - _SetInteractionToSelectSlide(_SelectSlides[_SelectSlideModes]); + _SelectElement(_SelectSlides[_SelectSlideModes]); } public override bool UpdateGame() @@ -127,13 +127,6 @@ namespace Vocaluxe.Screens return true; } - public override bool Draw() - { - base.Draw(); - - return true; - } - private void _UpdateSelection() { if (_PartyModeInfos.Count == 0) @@ -173,13 +166,7 @@ namespace Vocaluxe.Screens _Texts[_TextVersion].Text = _PartyModeInfos[index].VersionMajor + "." + _PartyModeInfos[index].VersionMinor; _Texts[_TextVersion].TranslationID = _PartyModeInfos[index].PartyModeID; - if (!_PartyModeInfos[index].Playable) - { - _Buttons[_ButtonStart].Visible = false; - _Texts[_TextError].Text = "TR_SCREENPARTY_ERROR"; - _Texts[_TextError].Visible = true; - } - else if (CConfig.GetMaxNumMics() == 0) + if (CConfig.GetMaxNumMics() == 0) { _Buttons[_ButtonStart].Visible = false; _Texts[_TextError].Text = "TR_SCREENPARTY_ERROR_MICS"; @@ -207,7 +194,7 @@ namespace Vocaluxe.Screens } CParty.SetPartyMode(_PartyModeInfos[index].PartyModeID); - CGraphics.FadeTo(EScreens.ScreenPartyDummy); + CGraphics.FadeTo(CParty.GetStartScreen()); } } } \ No newline at end of file diff --git a/Vocaluxe/Screens/CScreenProfiles.cs b/Vocaluxe/Screens/CScreenProfiles.cs index c8fdacfb..383ff57b 100644 --- a/Vocaluxe/Screens/CScreenProfiles.cs +++ b/Vocaluxe/Screens/CScreenProfiles.cs @@ -35,7 +35,7 @@ namespace Vocaluxe.Screens PlayerName } - class CScreenProfiles : CMenu + public class CScreenProfiles : CMenu { // Version number for theme files. Increment it, if you've changed something on the theme files! protected override int _ScreenVersion @@ -64,7 +64,7 @@ namespace Vocaluxe.Screens private EEditMode _EditMode; - private CTexture _WebcamTexture; + private CTextureRef _WebcamTexture; private Bitmap _Snapshot; public override void Init() @@ -122,12 +122,12 @@ namespace Vocaluxe.Screens if (_EditMode == EEditMode.PlayerName) _EditMode = EEditMode.None; else - CGraphics.FadeTo(EScreens.ScreenMain); + CGraphics.FadeTo(EScreen.Main); break; case Keys.Enter: if (_Buttons[_ButtonExit].Selected) - CGraphics.FadeTo(EScreens.ScreenMain); + CGraphics.FadeTo(EScreen.Main); else if (_Buttons[_ButtonSave].Selected) _SaveProfiles(); else if (_Buttons[_ButtonNew].Selected) @@ -159,7 +159,7 @@ namespace Vocaluxe.Screens _ProfilesChanged = true; } else - CGraphics.FadeTo(EScreens.ScreenMain); + CGraphics.FadeTo(EScreen.Main); break; case Keys.Delete: @@ -196,10 +196,10 @@ namespace Vocaluxe.Screens if (_EditMode == EEditMode.None) base.HandleMouse(mouseEvent); - if (mouseEvent.LB && _IsMouseOver(mouseEvent)) + if (mouseEvent.LB && _IsMouseOverCurSelection(mouseEvent)) { if (_Buttons[_ButtonExit].Selected) - CGraphics.FadeTo(EScreens.ScreenMain); + CGraphics.FadeTo(EScreen.Main); else if (_Buttons[_ButtonSave].Selected) _SaveProfiles(); else if (_Buttons[_ButtonNew].Selected) @@ -246,7 +246,7 @@ namespace Vocaluxe.Screens } if (mouseEvent.RB) - CGraphics.FadeTo(EScreens.ScreenMain); + CGraphics.FadeTo(EScreen.Main); return true; } @@ -386,7 +386,7 @@ namespace Vocaluxe.Screens CProfiles.SetAvatar(_SelectSlides[_SelectSlideProfiles].ValueIndex, _SelectSlides[_SelectSlideAvatars].ValueIndex); - _SetInteractionToButton(_Buttons[_ButtonPlayerName]); + _SelectElement(_Buttons[_ButtonPlayerName]); _EditMode = EEditMode.PlayerName; } diff --git a/Vocaluxe/Screens/CScreenScore.cs b/Vocaluxe/Screens/CScreenScore.cs index bbf4aaf4..4f8a7aff 100644 --- a/Vocaluxe/Screens/CScreenScore.cs +++ b/Vocaluxe/Screens/CScreenScore.cs @@ -28,7 +28,7 @@ using VocaluxeLib.Songs; namespace Vocaluxe.Screens { - class CScreenScore : CMenu + public class CScreenScore : CMenu { // Version number for theme files. Increment it, if you've changed something on the theme files! protected override int _ScreenVersion @@ -56,7 +56,6 @@ namespace Vocaluxe.Screens private int _Round; private CPoints _Points; private Stopwatch _Timer; - private bool _SlideShowBGAvailable; public override void Init() { @@ -78,6 +77,8 @@ namespace Vocaluxe.Screens _StaticPointsBarDrawnPoints = new double[CSettings.MaxNumPlayer]; _SlideShowBG = GetNewBackground(); + _AddBackground(_SlideShowBG); + _SlideShowBG.Z--; } public override bool HandleInput(SKeyEvent keyEvent) @@ -134,19 +135,19 @@ namespace Vocaluxe.Screens _SetVisibility(); _UpdateRatings(); - _SlideShowBGAvailable = _UpdateBackground(); + _SlideShowBG.Visible = _UpdateBackground(); } public override bool UpdateGame() { - var players = new SPlayer[CGame.NumPlayer]; + var players = new SPlayer[CGame.NumPlayers]; if (_Round >= 0) - players = _Points.GetPlayer(_Round, CGame.NumPlayer); + players = _Points.GetPlayer(_Round, CGame.NumPlayers); else { for (int i = 0; i < CGame.NumRounds; i++) { - SPlayer[] points = _Points.GetPlayer(i, CGame.NumPlayer); + SPlayer[] points = _Points.GetPlayer(i, CGame.NumPlayers); for (int p = 0; p < players.Length; p++) players[p].Points += points[p].Points; } @@ -157,9 +158,9 @@ namespace Vocaluxe.Screens { if (_StaticPointsBarDrawnPoints[p] < players[p].Points) { - if (CConfig.ScoreAnimationTime >= 1) + if (CConfig.Config.Game.ScoreAnimationTime >= 1) { - _StaticPointsBarDrawnPoints[p] = (_Timer.ElapsedMilliseconds / 1000f) / CConfig.ScoreAnimationTime * 10000; + _StaticPointsBarDrawnPoints[p] = (_Timer.ElapsedMilliseconds / 1000f) / CConfig.Config.Game.ScoreAnimationTime * 10000; if (_StaticPointsBarDrawnPoints[p] > players[p].Points) @@ -167,16 +168,16 @@ namespace Vocaluxe.Screens var direction = (string)_ScreenSettings[_ScreenSettingAnimationDirection].GetValue(); if (direction.ToLower() == "vertical") { - _Statics[_StaticPointsBar[p, CGame.NumPlayer - 1]].Rect.W = ((float)_StaticPointsBarDrawnPoints[p]) * - (_Statics[_StaticPointsBarBG[p, CGame.NumPlayer - 1]].Rect.W / CSettings.MaxScore); + _Statics[_StaticPointsBar[p, CGame.NumPlayers - 1]].W = ((float)_StaticPointsBarDrawnPoints[p]) * + (_Statics[_StaticPointsBarBG[p, CGame.NumPlayers - 1]].W / CSettings.MaxScore); } else { - _Statics[_StaticPointsBar[p, CGame.NumPlayer - 1]].Rect.H = ((float)_StaticPointsBarDrawnPoints[p]) * - (_Statics[_StaticPointsBarBG[p, CGame.NumPlayer - 1]].Rect.H / CSettings.MaxScore); - _Statics[_StaticPointsBar[p, CGame.NumPlayer - 1]].Rect.Y = _Statics[_StaticPointsBarBG[p, CGame.NumPlayer - 1]].Rect.H + - _Statics[_StaticPointsBarBG[p, CGame.NumPlayer - 1]].Rect.Y - - _Statics[_StaticPointsBar[p, CGame.NumPlayer - 1]].Rect.H; + _Statics[_StaticPointsBar[p, CGame.NumPlayers - 1]].H = ((float)_StaticPointsBarDrawnPoints[p]) * + (_Statics[_StaticPointsBarBG[p, CGame.NumPlayers - 1]].H / CSettings.MaxScore); + _Statics[_StaticPointsBar[p, CGame.NumPlayers - 1]].Y = _Statics[_StaticPointsBarBG[p, CGame.NumPlayers - 1]].H + + _Statics[_StaticPointsBarBG[p, CGame.NumPlayers - 1]].Y - + _Statics[_StaticPointsBar[p, CGame.NumPlayers - 1]].H; } } } @@ -184,16 +185,6 @@ namespace Vocaluxe.Screens return true; } - public override bool Draw() - { - if (_SlideShowBGAvailable) - _SlideShowBG.Draw(); - else - _DrawBG(); - _DrawFG(); - return true; - } - private static string _GetRating(double points) { string rating = String.Empty; @@ -276,7 +267,7 @@ namespace Vocaluxe.Screens private void _UpdateRatings() { CSong song = null; - var players = new SPlayer[CGame.NumPlayer]; + var players = new SPlayer[CGame.NumPlayers]; if (_Round >= 0) { song = CGame.GetSong(_Round); @@ -286,14 +277,14 @@ namespace Vocaluxe.Screens _Texts[_TextSong].Text = song.Artist + " - " + song.Title; if (_Points.NumRounds > 1) _Texts[_TextSong].Text += " (" + (_Round + 1) + "/" + _Points.NumRounds + ")"; - players = _Points.GetPlayer(_Round, CGame.NumPlayer); + players = _Points.GetPlayer(_Round, CGame.NumPlayers); } else { _Texts[_TextSong].Text = "TR_SCREENSCORE_OVERALLSCORE"; for (int i = 0; i < CGame.NumRounds; i++) { - SPlayer[] points = _Points.GetPlayer(i, CGame.NumPlayer); + SPlayer[] points = _Points.GetPlayer(i, CGame.NumPlayers); for (int p = 0; p < players.Length; p++) { if (i < 1) @@ -314,57 +305,57 @@ namespace Vocaluxe.Screens if (song.Notes.VoiceNames.IsSet(players[p].VoiceNr)) name += " (" + song.Notes.VoiceNames[players[p].VoiceNr] + ")"; } - _Texts[_TextNames[p, CGame.NumPlayer - 1]].Text = name; + _Texts[_TextNames[p, CGame.NumPlayers - 1]].Text = name; - if (CGame.NumPlayer < (int)_ScreenSettings[_ScreenSettingShortScore].GetValue()) - _Texts[_TextScores[p, CGame.NumPlayer - 1]].Text = ((int)Math.Round(players[p].Points)).ToString("0000") + " " + CLanguage.Translate("TR_SCREENSCORE_POINTS"); + if (CGame.NumPlayers < (int)_ScreenSettings[_ScreenSettingShortScore].GetValue()) + _Texts[_TextScores[p, CGame.NumPlayers - 1]].Text = ((int)Math.Round(players[p].Points)).ToString("0000") + " " + CLanguage.Translate("TR_SCREENSCORE_POINTS"); else - _Texts[_TextScores[p, CGame.NumPlayer - 1]].Text = ((int)Math.Round(players[p].Points)).ToString("0000"); - if (CGame.NumPlayer < (int)_ScreenSettings[_ScreenSettingShortDifficulty].GetValue()) + _Texts[_TextScores[p, CGame.NumPlayers - 1]].Text = ((int)Math.Round(players[p].Points)).ToString("0000"); + if (CGame.NumPlayers < (int)_ScreenSettings[_ScreenSettingShortDifficulty].GetValue()) { - _Texts[_TextDifficulty[p, CGame.NumPlayer - 1]].Text = CLanguage.Translate("TR_SCREENSCORE_GAMEDIFFICULTY") + ": " + - CLanguage.Translate(CProfiles.GetDifficulty(players[p].ProfileID).ToString()); + _Texts[_TextDifficulty[p, CGame.NumPlayers - 1]].Text = CLanguage.Translate("TR_SCREENSCORE_GAMEDIFFICULTY") + ": " + + CLanguage.Translate(CProfiles.GetDifficulty(players[p].ProfileID).ToString()); } else - _Texts[_TextDifficulty[p, CGame.NumPlayer - 1]].Text = CLanguage.Translate(CProfiles.GetDifficulty(players[p].ProfileID).ToString()); - if (CGame.NumPlayer < (int)_ScreenSettings[_ScreenSettingShortRating].GetValue()) + _Texts[_TextDifficulty[p, CGame.NumPlayers - 1]].Text = CLanguage.Translate(CProfiles.GetDifficulty(players[p].ProfileID).ToString()); + if (CGame.NumPlayers < (int)_ScreenSettings[_ScreenSettingShortRating].GetValue()) { - _Texts[_TextRatings[p, CGame.NumPlayer - 1]].Text = CLanguage.Translate("TR_SCREENSCORE_RATING") + ": " + - CLanguage.Translate(_GetRating((int)Math.Round(players[p].Points))); + _Texts[_TextRatings[p, CGame.NumPlayers - 1]].Text = CLanguage.Translate("TR_SCREENSCORE_RATING") + ": " + + CLanguage.Translate(_GetRating((int)Math.Round(players[p].Points))); } else - _Texts[_TextRatings[p, CGame.NumPlayer - 1]].Text = CLanguage.Translate(_GetRating((int)Math.Round(players[p].Points))); + _Texts[_TextRatings[p, CGame.NumPlayers - 1]].Text = CLanguage.Translate(_GetRating((int)Math.Round(players[p].Points))); _StaticPointsBarDrawnPoints[p] = 0.0; if (pointAnimDirection.ToLower() == "vertical") - _Statics[_StaticPointsBar[p, CGame.NumPlayer - 1]].Rect.W = 0; + _Statics[_StaticPointsBar[p, CGame.NumPlayers - 1]].W = 0; else { - _Statics[_StaticPointsBar[p, CGame.NumPlayer - 1]].Rect.H = 0; - _Statics[_StaticPointsBar[p, CGame.NumPlayer - 1]].Rect.Y = _Statics[_StaticPointsBarBG[p, CGame.NumPlayer - 1]].Rect.H + - _Statics[_StaticPointsBarBG[p, CGame.NumPlayer - 1]].Rect.Y - - _Statics[_StaticPointsBar[p, CGame.NumPlayer - 1]].Rect.H; + _Statics[_StaticPointsBar[p, CGame.NumPlayers - 1]].H = 0; + _Statics[_StaticPointsBar[p, CGame.NumPlayers - 1]].Y = _Statics[_StaticPointsBarBG[p, CGame.NumPlayers - 1]].H + + _Statics[_StaticPointsBarBG[p, CGame.NumPlayers - 1]].Y - + _Statics[_StaticPointsBar[p, CGame.NumPlayers - 1]].H; } if (CProfiles.IsProfileIDValid(players[p].ProfileID)) - _Statics[_StaticAvatar[p, CGame.NumPlayer - 1]].Texture = CProfiles.GetAvatarTextureFromProfile(players[p].ProfileID); + _Statics[_StaticAvatar[p, CGame.NumPlayers - 1]].Texture = CProfiles.GetAvatarTextureFromProfile(players[p].ProfileID); } - if (CConfig.ScoreAnimationTime < 1) + if (CConfig.Config.Game.ScoreAnimationTime < 1) { - for (int p = 0; p < CGame.NumPlayer; p++) + for (int p = 0; p < CGame.NumPlayers; p++) { if (pointAnimDirection.ToLower() == "vertical") { - _Statics[_StaticPointsBar[p, CGame.NumPlayer - 1]].Rect.W = ((float)players[p].Points) * - (_Statics[_StaticPointsBarBG[p, CGame.NumPlayer - 1]].Rect.W / CSettings.MaxScore); + _Statics[_StaticPointsBar[p, CGame.NumPlayers - 1]].W = ((float)players[p].Points) * + (_Statics[_StaticPointsBarBG[p, CGame.NumPlayers - 1]].W / CSettings.MaxScore); } else { - _Statics[_StaticPointsBar[p, CGame.NumPlayer - 1]].Rect.H = ((float)players[p].Points) * - (_Statics[_StaticPointsBarBG[p, CGame.NumPlayer - 1]].Rect.H / CSettings.MaxScore); - _Statics[_StaticPointsBar[p, CGame.NumPlayer - 1]].Rect.Y = _Statics[_StaticPointsBarBG[p, CGame.NumPlayer - 1]].Rect.H + - _Statics[_StaticPointsBarBG[p, CGame.NumPlayer - 1]].Rect.Y - - _Statics[_StaticPointsBar[p, CGame.NumPlayer - 1]].Rect.H; + _Statics[_StaticPointsBar[p, CGame.NumPlayers - 1]].H = ((float)players[p].Points) * + (_Statics[_StaticPointsBarBG[p, CGame.NumPlayers - 1]].H / CSettings.MaxScore); + _Statics[_StaticPointsBar[p, CGame.NumPlayers - 1]].Y = _Statics[_StaticPointsBarBG[p, CGame.NumPlayers - 1]].H + + _Statics[_StaticPointsBarBG[p, CGame.NumPlayers - 1]].Y - + _Statics[_StaticPointsBar[p, CGame.NumPlayers - 1]].H; } _StaticPointsBarDrawnPoints[p] = players[p].Points; } @@ -382,13 +373,13 @@ namespace Vocaluxe.Screens { if (player <= numplayer) { - _Texts[_TextNames[player, numplayer]].Visible = numplayer + 1 == CGame.NumPlayer; - _Texts[_TextScores[player, numplayer]].Visible = numplayer + 1 == CGame.NumPlayer; - _Texts[_TextRatings[player, numplayer]].Visible = numplayer + 1 == CGame.NumPlayer; - _Texts[_TextDifficulty[player, numplayer]].Visible = numplayer + 1 == CGame.NumPlayer; - _Statics[_StaticPointsBar[player, numplayer]].Visible = numplayer + 1 == CGame.NumPlayer; - _Statics[_StaticPointsBarBG[player, numplayer]].Visible = numplayer + 1 == CGame.NumPlayer; - _Statics[_StaticAvatar[player, numplayer]].Visible = numplayer + 1 == CGame.NumPlayer; + _Texts[_TextNames[player, numplayer]].Visible = numplayer + 1 == CGame.NumPlayers; + _Texts[_TextScores[player, numplayer]].Visible = numplayer + 1 == CGame.NumPlayers; + _Texts[_TextRatings[player, numplayer]].Visible = numplayer + 1 == CGame.NumPlayers; + _Texts[_TextDifficulty[player, numplayer]].Visible = numplayer + 1 == CGame.NumPlayers; + _Statics[_StaticPointsBar[player, numplayer]].Visible = numplayer + 1 == CGame.NumPlayers; + _Statics[_StaticPointsBarBG[player, numplayer]].Visible = numplayer + 1 == CGame.NumPlayers; + _Statics[_StaticAvatar[player, numplayer]].Visible = numplayer + 1 == CGame.NumPlayers; _Statics[_StaticAvatar[player, numplayer]].Texture = null; } @@ -408,7 +399,7 @@ namespace Vocaluxe.Screens { for (int round = 0; round < _Points.NumRounds; round++) { - SPlayer[] players = _Points.GetPlayer(round, CGame.NumPlayer); + SPlayer[] players = _Points.GetPlayer(round, CGame.NumPlayers); for (int p = 0; p < players.Length; p++) { diff --git a/Vocaluxe/Screens/CScreenSing.cs b/Vocaluxe/Screens/CScreenSing.cs index ff4416f8..24584cd1 100644 --- a/Vocaluxe/Screens/CScreenSing.cs +++ b/Vocaluxe/Screens/CScreenSing.cs @@ -27,11 +27,12 @@ using Vocaluxe.Base.Fonts; using VocaluxeLib; using VocaluxeLib.Draw; using VocaluxeLib.Menu; +using VocaluxeLib.Menu.SingNotes; using VocaluxeLib.Songs; namespace Vocaluxe.Screens { - class CScreenSing : CMenu + public class CScreenSing : CMenu { // Version number for theme files. Increment it, if you've changed something on the theme files! protected override int _ScreenVersion @@ -96,12 +97,11 @@ namespace Vocaluxe.Screens private int _CurrentStream = -1; private float _Length = -1f; //private int _NextStream = -1; - private const float _Volume = 100f; - private int _CurrentVideo = -1; + private const int _Volume = 100; + private CVideoStream _CurrentVideo; private EAspect _VideoAspect = EAspect.Crop; - private CTexture _CurrentVideoTexture; - private CTexture _CurrentWebcamFrameTexture; - private CTexture _Background; + private CTextureRef _CurrentWebcamFrameTexture; + private CTextureRef _Background; private float _CurrentTime; private float _FinishTime; @@ -111,8 +111,6 @@ namespace Vocaluxe.Screens private float _TimeToFirstNoteDuet; private float _RemainingTimeToFirstNoteDuet; - private readonly int[] _NoteLines = new int[CSettings.MaxNumPlayer]; - private Stopwatch _TimerSongText; private Stopwatch _TimerDuetText1; private Stopwatch _TimerDuetText2; @@ -122,6 +120,11 @@ namespace Vocaluxe.Screens private CBackground _SlideShow; + public override EMusicType CurrentMusicType + { + get { return EMusicType.Game; } + } + public override void Init() { base.Init(); @@ -149,9 +152,7 @@ namespace Vocaluxe.Screens _BuildStaticStrings(ref statics); _ThemeStatics = statics.ToArray(); - var buttons = new List {_ButtonCancel, _ButtonContinue, _ButtonSkip}; - _ThemeButtons = buttons.ToArray(); - + _ThemeButtons = new string[] {_ButtonCancel, _ButtonContinue, _ButtonSkip}; _ThemeLyrics = new string[] {_LyricMain, _LyricSub, _LyricMainDuet, _LyricSubDuet, _LyricMainTop, _LyricSubTop}; _ThemeSingNotes = new string[] {_SingBars}; @@ -161,64 +162,43 @@ namespace Vocaluxe.Screens _TimerDuetText2 = new Stopwatch(); } - public override void LoadTheme(string xmlPath) - { - base.LoadTheme(xmlPath); - - _Statics[_StaticTimeLine].Visible = false; - _Statics[_StaticTimeLineExpandedNormal].Visible = false; - _Statics[_StaticTimeLineExpandedHighlighted].Visible = false; - _Statics[_StaticPauseBG].Visible = false; - _Texts[_TextPause].Visible = false; - - _Statics[_StaticPauseBG].Visible = false; - _Texts[_TextPause].Visible = false; - - _Buttons[_ButtonCancel].Visible = false; - _Buttons[_ButtonContinue].Visible = false; - } - public override bool HandleInput(SKeyEvent keyEvent) { base.HandleInput(keyEvent); - if (keyEvent.KeyPressed) - { - // - } - else + if (!keyEvent.KeyPressed) { switch (keyEvent.Key) { case Keys.Escape: _TogglePause(); if (_Pause) - _SetInteractionToButton(_Buttons[_ButtonCancel]); + _SelectElement(_Buttons[_ButtonCancel]); break; case Keys.P: _TogglePause(); if (_Pause) - _SetInteractionToButton(_Buttons[_ButtonContinue]); + _SelectElement(_Buttons[_ButtonContinue]); break; case Keys.T: - var mode = (int)CConfig.TimerMode; + var mode = (int)CConfig.Config.Game.TimerMode; mode++; if (mode > Enum.GetNames(typeof(ETimerMode)).Length - 1) mode = 0; - CConfig.TimerMode = (ETimerMode)mode; + CConfig.Config.Game.TimerMode = (ETimerMode)mode; CConfig.SaveConfig(); break; case Keys.I: - mode = (int)CConfig.PlayerInfo; + mode = (int)CConfig.Config.Theme.PlayerInfo; mode++; if (mode > Enum.GetNames(typeof(EPlayerInfo)).Length - 1) mode = 0; - CConfig.PlayerInfo = (EPlayerInfo)mode; + CConfig.Config.Theme.PlayerInfo = (EPlayerInfo)mode; CConfig.SaveConfig(); _SetVisibility(); if (CGame.GetSong() != null) @@ -243,33 +223,31 @@ namespace Vocaluxe.Screens } break; case Keys.Enter: - if (_Buttons[_ButtonContinue].Selected && _Pause) - _TogglePause(); - if (_Buttons[_ButtonCancel].Selected && _Pause) - _Stop(); - if (_Buttons[_ButtonSkip].Selected && _Pause) + if (_Pause) { - _LoadNextSong(); - _TogglePause(); + if (_Buttons[_ButtonContinue].Selected) + _SetPause(false); + if (_Buttons[_ButtonCancel].Selected) + _Stop(); + if (_Buttons[_ButtonSkip].Selected) + { + _LoadNextSong(); + _SetPause(false); + } } break; - case Keys.Add: - case Keys.PageUp: - if (keyEvent.ModShift) - { - CConfig.GameMusicVolume += 5; - CSound.SetGlobalVolume(CConfig.GameMusicVolume); - } - break; + case Keys.V: + if (_VideoAspect == EAspect.Zoom2) + _VideoAspect = EAspect.Crop; + else + _VideoAspect++; - case Keys.Subtract: - case Keys.PageDown: - if (keyEvent.ModShift) - { - CConfig.GameMusicVolume -= 5; - CSound.SetGlobalVolume(CConfig.GameMusicVolume); - } + CSong song = CGame.GetSong(); + song.VideoAspect = _VideoAspect; + + if (CConfig.Config.Debug.SaveModifiedSongs == EOffOn.TR_CONFIG_ON) + song.Save(); break; } } @@ -285,21 +263,21 @@ namespace Vocaluxe.Screens { _TogglePause(); if (_Pause) - _SetInteractionToButton(_Buttons[_ButtonContinue]); + _SelectElement(_Buttons[_ButtonContinue]); } - if (mouseEvent.LB && _IsMouseOver(mouseEvent) && _Pause) + if (mouseEvent.LB && _IsMouseOverCurSelection(mouseEvent) && _Pause) { - if (_Buttons[_ButtonContinue].Selected && _Pause) - _TogglePause(); + if (_Buttons[_ButtonContinue].Selected) + _SetPause(false); - if (_Buttons[_ButtonCancel].Selected && _Pause) + if (_Buttons[_ButtonCancel].Selected) _Stop(); - if (_Buttons[_ButtonSkip].Selected && _Pause) + if (_Buttons[_ButtonSkip].Selected) { _LoadNextSong(); - _TogglePause(); + _SetPause(false); } } @@ -320,7 +298,7 @@ namespace Vocaluxe.Screens else finish = true; - if (finish) + if (finish && !_FadeOut) _LoadNextSong(); _UpdateSongText(); @@ -332,6 +310,8 @@ namespace Vocaluxe.Screens CGame.UpdatePoints(_CurrentTime); _UpdateLyrics(); + if (CGame.GameMode == EGameMode.TR_GAMEMODE_MEDLEY) + _UpdateMedleyCountdown(); float[] alpha = _CalcFadingAlpha(); if (alpha != null) @@ -348,20 +328,21 @@ namespace Vocaluxe.Screens _Statics[_StaticLyricHelper].Alpha = alpha[0]; _Statics[_StaticLyricHelperTop].Alpha = alpha[0]; - for (int p = 0; p < CGame.NumPlayer; p++) + for (int p = 0; p < CGame.NumPlayers; p++) { - _SingNotes[_SingBars].SetAlpha(_NoteLines[p], alpha[CGame.Players[p].VoiceNr * 2]); - if (CConfig.FadePlayerInfo == EFadePlayerInfo.TR_CONFIG_FADEPLAYERINFO_INFO || CConfig.FadePlayerInfo == EFadePlayerInfo.TR_CONFIG_FADEPLAYERINFO_ALL) + _SingNotes[_SingBars].PlayerNotes[p].Alpha = alpha[CGame.Players[p].VoiceNr * 2]; + if (CConfig.Config.Theme.FadePlayerInfo == EFadePlayerInfo.TR_CONFIG_FADEPLAYERINFO_INFO || + CConfig.Config.Theme.FadePlayerInfo == EFadePlayerInfo.TR_CONFIG_FADEPLAYERINFO_ALL) { - _Statics[_StaticAvatars[p, CGame.NumPlayer - 1]].Alpha = alpha[CGame.Players[p].VoiceNr * 2]; - _Texts[_TextNames[p, CGame.NumPlayer - 1]].Alpha = alpha[CGame.Players[p].VoiceNr * 2]; + _Statics[_StaticAvatars[p, CGame.NumPlayers - 1]].Alpha = alpha[CGame.Players[p].VoiceNr * 2]; + _Texts[_TextNames[p, CGame.NumPlayers - 1]].Alpha = alpha[CGame.Players[p].VoiceNr * 2]; } - if (CConfig.FadePlayerInfo == EFadePlayerInfo.TR_CONFIG_FADEPLAYERINFO_ALL) + if (CConfig.Config.Theme.FadePlayerInfo == EFadePlayerInfo.TR_CONFIG_FADEPLAYERINFO_ALL) { - _Statics[_StaticScores[p, CGame.NumPlayer - 1]].Alpha = alpha[CGame.Players[p].VoiceNr * 2]; - _Statics[_StaticAvatars[p, CGame.NumPlayer - 1]].Alpha = alpha[CGame.Players[p].VoiceNr * 2]; - _Texts[_TextNames[p, CGame.NumPlayer - 1]].Alpha = alpha[CGame.Players[p].VoiceNr * 2]; - _Texts[_TextScores[p, CGame.NumPlayer - 1]].Alpha = alpha[CGame.Players[p].VoiceNr * 2]; + _Statics[_StaticScores[p, CGame.NumPlayers - 1]].Alpha = alpha[CGame.Players[p].VoiceNr * 2]; + _Statics[_StaticAvatars[p, CGame.NumPlayers - 1]].Alpha = alpha[CGame.Players[p].VoiceNr * 2]; + _Texts[_TextNames[p, CGame.NumPlayers - 1]].Alpha = alpha[CGame.Players[p].VoiceNr * 2]; + _Texts[_TextScores[p, CGame.NumPlayers - 1]].Alpha = alpha[CGame.Players[p].VoiceNr * 2]; } } @@ -382,17 +363,14 @@ namespace Vocaluxe.Screens } - for (int p = 0; p < CGame.NumPlayer; p++) + for (int p = 0; p < CGame.NumPlayers; p++) { string fmtString = (CGame.Players[p].Points < 10000) ? "0000" : "00000"; - _Texts[_TextScores[p, CGame.NumPlayer - 1]].Text = CGame.Players[p].Points.ToString(fmtString); + _Texts[_TextScores[p, CGame.NumPlayers - 1]].Text = CGame.Players[p].Points.ToString(fmtString); } - if (_CurrentVideo != -1 && !_FadeOut && CConfig.VideosInSongs == EOffOn.TR_CONFIG_ON) - { - float vtime; - CVideo.GetFrame(_CurrentVideo, ref _CurrentVideoTexture, _CurrentTime, out vtime); - } + if (_CurrentVideo != null && !_FadeOut && CConfig.Config.Video.VideosInSongs == EOffOn.TR_CONFIG_ON) + CVideo.GetFrame(_CurrentVideo, _CurrentTime); if (_Webcam) CWebcam.GetFrame(ref _CurrentWebcamFrameTexture); @@ -406,8 +384,7 @@ namespace Vocaluxe.Screens _FadeOut = false; - _CurrentVideo = -1; - _CurrentVideoTexture = null; + _CurrentVideo = null; _CurrentWebcamFrameTexture = null; _CurrentBeat = -100; _CurrentTime = 0f; @@ -415,26 +392,23 @@ namespace Vocaluxe.Screens _Length = -1f; _TimeToFirstNote = 0f; _TimeToFirstNoteDuet = 0f; - _Pause = false; + _SetPause(false); _TimeRects.Clear(); - _SingNotes[_SingBars].Reset(); - for (int i = 0; i < CSettings.MaxNumPlayer; i++) - _NoteLines[i] = -1; + _SingNotes[_SingBars].Init(0); foreach (CLyric lyric in _Lyrics) - lyric.LyricStyle = CConfig.LyricStyle; + lyric.LyricStyle = CConfig.Config.Theme.LyricStyle; - for (int p = 0; p < CGame.NumPlayer; p++) - _Statics[_StaticAvatars[p, CGame.NumPlayer - 1]].Aspect = EAspect.Crop; + for (int p = 0; p < CGame.NumPlayers; p++) + _Statics[_StaticAvatars[p, CGame.NumPlayers - 1]].Aspect = EAspect.Crop; _SetVisibility(); _UpdateAvatars(); _UpdateNames(); _CloseSong(); - CSound.SetGlobalVolume(CConfig.GameMusicVolume); } public override void OnShowFinish() @@ -446,15 +420,15 @@ namespace Vocaluxe.Screens _LoadNextSong(); } - public override bool Draw() + public override void Draw() { if (_Active) { - CTexture background; + CTextureRef background; var aspect = EAspect.Crop; - if (_CurrentVideo != -1 && CConfig.VideosInSongs == EOffOn.TR_CONFIG_ON && !_Webcam) + if (_CurrentVideo != null && CConfig.Config.Video.VideosInSongs == EOffOn.TR_CONFIG_ON && !_Webcam) { - background = _CurrentVideoTexture; + background = _CurrentVideo.Texture; aspect = _VideoAspect; } else if (_Webcam) @@ -466,25 +440,17 @@ namespace Vocaluxe.Screens background = _Background; if (background != null) { - var bounds = new RectangleF(0, 0, CSettings.RenderW, CSettings.RenderH); - RectangleF rect; - CHelper.SetRect(bounds, out rect, background.OrigAspect, aspect); - CDraw.DrawTexture(background, new SRectF(rect.X, rect.Y, rect.Width, rect.Height, 0f), - background.Color, new SRectF(bounds.X, bounds.Y, bounds.Width, bounds.Height, 0f)); + SRectF bounds = CSettings.RenderRect; + SRectF rect = CHelper.FitInBounds(bounds, background.OrigAspect, aspect); + CDraw.DrawTexture(background, rect, background.Color, bounds); } else if (_SlideShow != null) _SlideShow.Draw(); } - _DrawBG(); + base.Draw(); - foreach (CStatic stat in _Statics) - stat.Draw(); - - foreach (CText text in _Texts) - text.Draw(); - - switch (CConfig.TimerLook) + switch (CConfig.Config.Theme.TimerLook) { case ETimerLook.TR_CONFIG_TIMERLOOK_NORMAL: CDraw.DrawTexture(_Statics[_StaticTimeLine].Texture, _Statics[_StaticTimeLine].Rect, new SColorF(1, 1, 1, 1), _TimeLineRect); @@ -495,40 +461,7 @@ namespace Vocaluxe.Screens break; } - _Lyrics[_LyricSub].Draw(-100); - _Lyrics[_LyricMain].Draw(CGame.CurrentBeatF); - - _Lyrics[_LyricSubDuet].Draw(-100); - _Lyrics[_LyricMainDuet].Draw(CGame.CurrentBeatF); - - _Lyrics[_LyricSubTop].Draw(-100); - _Lyrics[_LyricMainTop].Draw(CGame.CurrentBeatF); - - - for (int i = 0; i < CGame.NumPlayer; i++) - _SingNotes[_SingBars].Draw(_NoteLines[i], CGame.Players[i].SungLines, i); - _DrawLyricHelper(); - - if (CGame.GameMode == EGameMode.TR_GAMEMODE_MEDLEY) - { - _UpdateMedleyCountdown(); - _Texts[_TextMedleyCountdown].Draw(); - } - - if (_Pause) - { - _Statics[_StaticPauseBG].Draw(true); - _Texts[_TextPause].Draw(true); - - foreach (CButton button in _Buttons) - button.Draw(); - - foreach (CSelectSlide slide in _SelectSlides) - slide.Draw(); - } - - return true; } public override void OnClose() @@ -537,22 +470,19 @@ namespace Vocaluxe.Screens _CloseSong(); if (_Webcam) CWebcam.Stop(); + CBackgroundMusic.Disabled = false; } private void _CloseSong() { if (_CurrentStream > -1) { - CSound.FadeAndClose(_CurrentStream, 0f, 0.5f); + CSound.FadeAndClose(_CurrentStream, 0, 0.5f); _CurrentStream = -1; } CRecord.Stop(); - if (_CurrentVideo != -1) - { - CVideo.Close(_CurrentVideo); - _CurrentVideo = -1; - CDraw.RemoveTexture(ref _CurrentVideoTexture); - } + if (_CurrentVideo != null) + CVideo.Close(ref _CurrentVideo); CDraw.RemoveTexture(ref _Background); if (_SlideShow != null) @@ -605,7 +535,7 @@ namespace Vocaluxe.Screens _TimeToFirstNote = 0f; _TimeToFirstNoteDuet = 0f; _Length = -1f; - var voiceAssignments = new int[CGame.NumPlayer]; + var voiceAssignments = new int[CGame.NumPlayers]; if (song.IsDuet) { //Save duet-assignment before resetting @@ -614,8 +544,6 @@ namespace Vocaluxe.Screens } CGame.ResetPlayer(); - CDraw.RemoveTexture(ref _CurrentVideoTexture); - if (!String.IsNullOrEmpty(song.VideoFileName)) { _CurrentVideo = CVideo.Load(Path.Combine(song.Folder, song.VideoFileName)); @@ -636,7 +564,7 @@ namespace Vocaluxe.Screens _Background = CDraw.AddTexture(Path.Combine(song.Folder, song.BackgroundFileNames[0])); } - _SingNotes[_SingBars].Reset(); + _SingNotes[_SingBars].Init(CGame.NumPlayers); if (song.IsDuet) @@ -648,12 +576,12 @@ namespace Vocaluxe.Screens //Otherwise, this is done by CScreenNames if (CGame.GetNumSongs() > 1) { - for (int i = 0; i < CGame.NumPlayer; i++) + for (int i = 0; i < CGame.NumPlayers; i++) CGame.Players[i].VoiceNr = (i + 1) % 2; } else { - for (int i = 0; i < CGame.NumPlayer; i++) + for (int i = 0; i < CGame.NumPlayers; i++) CGame.Players[i].VoiceNr = voiceAssignments[i]; } } @@ -661,10 +589,9 @@ namespace Vocaluxe.Screens _DynamicLyricsTop = false; _DynamicLyricsBottom = false; - for (int p = 0; p < CGame.NumPlayer; p++) + foreach (CNoteBars notes in _SingNotes[_SingBars].PlayerNotes) { - _NoteLines[p] = _SingNotes[_SingBars].AddPlayer(_SingNotes[_SingBars].BarPos[p, CGame.NumPlayer - 1], CTheme.GetPlayerColor(p + 1), p); - if (_SingNotes[_SingBars].BarPos[p, CGame.NumPlayer - 1].Y + _SingNotes[_SingBars].BarPos[p, CGame.NumPlayer - 1].H >= CSettings.RenderH / 2) + if (notes.Rect.Bottom >= CSettings.RenderH / 2) _DynamicLyricsBottom = true; else _DynamicLyricsTop = true; @@ -672,14 +599,7 @@ namespace Vocaluxe.Screens _SetDuetLyricsVisibility(song.IsDuet); _SetNormalLyricsVisibility(); - /* - case 4: - NoteLines[0] = SingNotes[SingBars].AddPlayer(new SRectF(35f, 100f, 590f, 200f, -0.5f), CTheme.ThemeColors.Player[0]); - NoteLines[1] = SingNotes[SingBars].AddPlayer(new SRectF(35f, 350f, 590f, 200f, -0.5f), CTheme.ThemeColors.Player[1]); - NoteLines[2] = SingNotes[SingBars].AddPlayer(new SRectF(640f, 100f, 590f, 200f, -0.5f), CTheme.ThemeColors.Player[2]); - NoteLines[3] = SingNotes[SingBars].AddPlayer(new SRectF(640f, 350f, 590f, 200f, -0.5f), CTheme.ThemeColors.Player[3]); - break; - */ + _TimerSongText.Reset(); _TimerDuetText1.Reset(); _TimerDuetText2.Reset(); @@ -704,9 +624,9 @@ namespace Vocaluxe.Screens } else { - bool lyricsOnTop = CConfig.LyricsPosition == ELyricsPosition.TR_CONFIG_LYRICSPOSITION_TOP - || CConfig.LyricsPosition == ELyricsPosition.TR_CONFIG_LYRICSPOSITION_BOTH - || (CConfig.LyricsPosition == ELyricsPosition.TR_CONFIG_LYRICSPOSITION_DYNAMIC && _DynamicLyricsTop); + bool lyricsOnTop = CConfig.Config.Game.LyricsPosition == ELyricsPosition.TR_CONFIG_LYRICSPOSITION_TOP + || CConfig.Config.Game.LyricsPosition == ELyricsPosition.TR_CONFIG_LYRICSPOSITION_BOTH + || (CConfig.Config.Game.LyricsPosition == ELyricsPosition.TR_CONFIG_LYRICSPOSITION_DYNAMIC && _DynamicLyricsTop); _Lyrics[_LyricMainTop].Visible = lyricsOnTop; _Lyrics[_LyricSubTop].Visible = lyricsOnTop; _Statics[_StaticLyricsTop].Visible = lyricsOnTop; @@ -715,9 +635,9 @@ namespace Vocaluxe.Screens private void _SetNormalLyricsVisibility() { - bool visible = CConfig.LyricsPosition == ELyricsPosition.TR_CONFIG_LYRICSPOSITION_BOTTOM - || CConfig.LyricsPosition == ELyricsPosition.TR_CONFIG_LYRICSPOSITION_BOTH - || (CConfig.LyricsPosition == ELyricsPosition.TR_CONFIG_LYRICSPOSITION_DYNAMIC && _DynamicLyricsBottom); + bool visible = CConfig.Config.Game.LyricsPosition == ELyricsPosition.TR_CONFIG_LYRICSPOSITION_BOTTOM + || CConfig.Config.Game.LyricsPosition == ELyricsPosition.TR_CONFIG_LYRICSPOSITION_BOTH + || (CConfig.Config.Game.LyricsPosition == ELyricsPosition.TR_CONFIG_LYRICSPOSITION_DYNAMIC && _DynamicLyricsBottom); _Lyrics[_LyricMain].Visible = visible; _Lyrics[_LyricSub].Visible = visible; _Statics[_StaticLyrics].Visible = visible; @@ -762,11 +682,11 @@ namespace Vocaluxe.Screens if (firstNoteTime <= currentTime + 10f) { //First line has no predecessor or line has to be shown - if (j == 0 || firstNoteTime - CConfig.MinLineBreakTime <= currentTime) + if (j == 0 || firstNoteTime - CConfig.Config.Game.MinLineBreakTime <= currentTime) return j; float lastNoteTime = CGame.GetTimeFromBeats(lines[j - 1].LastNoteBeat, song.BPM); //No line break if last line is not fully evaluated (with 50% tolerance -> tested so notes are drawn) - if (lastNoteTime + CConfig.MicDelay / 1000f * 1.5f >= currentTime) + if (lastNoteTime + CConfig.Config.Record.MicDelay / 1000f * 1.5f >= currentTime) return j - 1; return j; } @@ -784,8 +704,16 @@ namespace Vocaluxe.Screens if (song == null) return; - _CurrentBeat = CGame.CurrentBeat; + _Lyrics[_LyricSub].Update(-100); + _Lyrics[_LyricMain].Update(CGame.CurrentBeatF); + + _Lyrics[_LyricSubDuet].Update(-100); + _Lyrics[_LyricMainDuet].Update(CGame.CurrentBeatF); + + _Lyrics[_LyricSubTop].Update(-100); + _Lyrics[_LyricMainTop].Update(CGame.CurrentBeatF); + for (int i = 0; i < song.Notes.VoiceCount; i++) { if (i > 1) @@ -799,10 +727,10 @@ namespace Vocaluxe.Screens if (nr != -1) { - for (int j = 0; j < CGame.NumPlayer; j++) + for (int j = 0; j < CGame.NumPlayers; j++) { if (CGame.Players[j].VoiceNr == i) - _SingNotes[_SingBars].SetLines(_NoteLines[j], lines, nr); + _SingNotes[_SingBars].PlayerNotes[j].SetLine(nr); } if (i == 0 && !song.IsDuet || i == 1 && song.IsDuet) @@ -858,27 +786,21 @@ namespace Vocaluxe.Screens private void _TogglePause() { - _Pause = !_Pause; + _SetPause(!_Pause); + } + + private void _SetPause(bool paused) + { + _Pause = paused; + _Statics[_StaticPauseBG].Visible = _Pause; + _Texts[_TextPause].Visible = _Pause; + _Buttons[_ButtonCancel].Visible = _Pause; + _Buttons[_ButtonContinue].Visible = _Pause; + _Buttons[_ButtonSkip].Visible = _Pause && CGame.NumRounds > CGame.RoundNr && CGame.NumRounds > 1; if (_Pause) - { - _Buttons[_ButtonCancel].Visible = true; - _Buttons[_ButtonContinue].Visible = true; - if (CGame.NumRounds > CGame.RoundNr && CGame.NumRounds > 1) - _Buttons[_ButtonSkip].Visible = true; - else - _Buttons[_ButtonSkip].Visible = false; CSound.Pause(_CurrentStream); - } else - { - //CGame.ResetToLastLine(_CurrentStream, _CurrentVideo); - _Buttons[_ButtonCancel].Visible = false; - _Buttons[_ButtonContinue].Visible = false; - _Buttons[_ButtonSkip].Visible = false; CSound.Play(_CurrentStream); - if (_Webcam) - CWebcam.Start(); - } } private void _BuildTextStrings(List texts) @@ -941,21 +863,17 @@ namespace Vocaluxe.Screens for (int numplayer = 0; numplayer < CSettings.MaxNumPlayer; numplayer++) { - for (int player = 0; player < CSettings.MaxNumPlayer; player++) + for (int player = 0; player < CSettings.MaxNumPlayer && player <= numplayer; player++) { - if (player <= numplayer) - { - _Texts[_TextScores[player, numplayer]].Visible = numplayer + 1 == CGame.NumPlayer; - _Texts[_TextNames[player, numplayer]].Visible = (numplayer + 1 == CGame.NumPlayer) - && - (CConfig.PlayerInfo == EPlayerInfo.TR_CONFIG_PLAYERINFO_BOTH || - CConfig.PlayerInfo == EPlayerInfo.TR_CONFIG_PLAYERINFO_NAME); - _Statics[_StaticScores[player, numplayer]].Visible = numplayer + 1 == CGame.NumPlayer; - _Statics[_StaticAvatars[player, numplayer]].Visible = (numplayer + 1 == CGame.NumPlayer) - && - (CConfig.PlayerInfo == EPlayerInfo.TR_CONFIG_PLAYERINFO_BOTH || - CConfig.PlayerInfo == EPlayerInfo.TR_CONFIG_PLAYERINFO_AVATAR); - } + bool isIvisible = numplayer + 1 == CGame.NumPlayers && player <= CGame.NumPlayers; + _Texts[_TextScores[player, numplayer]].Visible = isIvisible; + _Texts[_TextNames[player, numplayer]].Visible = isIvisible && + (CConfig.Config.Theme.PlayerInfo == EPlayerInfo.TR_CONFIG_PLAYERINFO_BOTH || + CConfig.Config.Theme.PlayerInfo == EPlayerInfo.TR_CONFIG_PLAYERINFO_NAME); + _Statics[_StaticScores[player, numplayer]].Visible = isIvisible; + _Statics[_StaticAvatars[player, numplayer]].Visible = isIvisible && + (CConfig.Config.Theme.PlayerInfo == EPlayerInfo.TR_CONFIG_PLAYERINFO_BOTH || + CConfig.Config.Theme.PlayerInfo == EPlayerInfo.TR_CONFIG_PLAYERINFO_AVATAR); } } @@ -976,6 +894,10 @@ namespace Vocaluxe.Screens _Statics[_StaticLyricsDuet].Alpha = 0f; _Statics[_StaticLyricHelperDuet].Alpha = 0f; + + _Statics[_StaticTimeLine].Visible = CConfig.Config.Theme.TimerLook == ETimerLook.TR_CONFIG_TIMERLOOK_NORMAL; + _Statics[_StaticTimeLineExpandedHighlighted].Visible = false; + _Statics[_StaticTimeLineExpandedNormal].Visible = false; } private void _UpdateMedleyCountdown() @@ -991,13 +913,13 @@ namespace Vocaluxe.Screens float partSeconds = timeDiff - fullSeconds; _Texts[_TextMedleyCountdown].Visible = true; _Texts[_TextMedleyCountdown].Text = fullSeconds.ToString(); - float h = partSeconds * CSettings.RenderH; - float w = CFonts.GetTextBounds(_Texts[_TextMedleyCountdown], h).Width; - float x = CSettings.RenderW / 2 - w / 2; - float y = CSettings.RenderH / 2 - h / 2; + _Texts[_TextMedleyCountdown].Font.Height = partSeconds * CSettings.RenderH; + + RectangleF textBounds = CFonts.GetTextBounds(_Texts[_TextMedleyCountdown]); + float x = CSettings.RenderW / 2 - textBounds.Width / 2; + float y = CSettings.RenderH / 2 - textBounds.Height / 2; _Texts[_TextMedleyCountdown].X = x; _Texts[_TextMedleyCountdown].Y = y; - _Texts[_TextMedleyCountdown].Height = h; } else _Texts[_TextMedleyCountdown].Visible = false; @@ -1203,8 +1125,8 @@ namespace Vocaluxe.Screens } else { - _Statics[_StaticSongText].Color.A = 10f - t / 3f; - _Texts[_TextSongName].Color.A = 10f - t / 3f; + _Statics[_StaticSongText].Color.A = (10f - t) / 3f; + _Texts[_TextSongName].Color.A = (10f - t) / 3f; } } else @@ -1303,7 +1225,7 @@ namespace Vocaluxe.Screens if (totalTime <= 0f) return; - switch (CConfig.TimerMode) + switch (CConfig.Config.Game.TimerMode) { case ETimerMode.TR_CONFIG_TIMERMODE_CURRENT: var min = (int)Math.Floor(currentTime / 60f); @@ -1325,7 +1247,7 @@ namespace Vocaluxe.Screens } - switch (CConfig.TimerLook) + switch (CConfig.Config.Theme.TimerLook) { case ETimerLook.TR_CONFIG_TIMERLOOK_NORMAL: _TimeLineRect.W = _Statics[_StaticTimeLine].Rect.W * (currentTime / totalTime); @@ -1347,7 +1269,7 @@ namespace Vocaluxe.Screens _TimeRects[i].Rect.Color = _Statics[_StaticTimeLineExpandedNormal].Color; } } - _Statics[_StaticTimePointer].Rect.X = stat.Rect.X + stat.Rect.W * (currentTime / totalTime); + _Statics[_StaticTimePointer].X = stat.X + stat.W * (currentTime / totalTime); break; } } @@ -1355,10 +1277,10 @@ namespace Vocaluxe.Screens private void _PrepareTimeLine() { CStatic stat = _Statics[_StaticTimeLine]; - switch (CConfig.TimerLook) + switch (CConfig.Config.Theme.TimerLook) { case ETimerLook.TR_CONFIG_TIMERLOOK_NORMAL: - _TimeLineRect = new SRectF(stat.Rect.X, stat.Rect.Y, 0f, stat.Rect.H, stat.Rect.Z); + _TimeLineRect = stat.Rect; _Statics[_StaticTimePointer].Visible = false; break; @@ -1405,23 +1327,23 @@ namespace Vocaluxe.Screens private void _UpdateAvatars() { - for (int i = 0; i < CGame.NumPlayer; i++) + for (int i = 0; i < CGame.NumPlayers; i++) { if (CProfiles.IsProfileIDValid(CGame.Players[i].ProfileID)) - _Statics[_StaticAvatars[i, CGame.NumPlayer - 1]].Texture = CProfiles.GetAvatarTextureFromProfile(CGame.Players[i].ProfileID); + _Statics[_StaticAvatars[i, CGame.NumPlayers - 1]].Texture = CProfiles.GetAvatarTextureFromProfile(CGame.Players[i].ProfileID); else - _Statics[_StaticAvatars[i, CGame.NumPlayer - 1]].Visible = false; + _Statics[_StaticAvatars[i, CGame.NumPlayers - 1]].Visible = false; } } private void _UpdateNames() { - for (int i = 0; i < CGame.NumPlayer; i++) + for (int i = 0; i < CGame.NumPlayers; i++) { if (CProfiles.IsProfileIDValid(CGame.Players[i].ProfileID)) - _Texts[_TextNames[i, CGame.NumPlayer - 1]].Text = CProfiles.GetPlayerName(CGame.Players[i].ProfileID); + _Texts[_TextNames[i, CGame.NumPlayers - 1]].Text = CProfiles.GetPlayerName(CGame.Players[i].ProfileID); else - _Texts[_TextNames[i, CGame.NumPlayer - 1]].Visible = false; + _Texts[_TextNames[i, CGame.NumPlayers - 1]].Visible = false; } } } diff --git a/Vocaluxe/Screens/CScreenSong.cs b/Vocaluxe/Screens/CScreenSong.cs index ace7503d..3445c25c 100644 --- a/Vocaluxe/Screens/CScreenSong.cs +++ b/Vocaluxe/Screens/CScreenSong.cs @@ -29,7 +29,7 @@ using VocaluxeLib.Songs; namespace Vocaluxe.Screens { - class CScreenSong : CMenu + public class CScreenSong : CMenu { private enum ESongOptionsView { @@ -85,16 +85,20 @@ namespace Vocaluxe.Screens private SScreenSongOptions _Sso; private CStatic _DragAndDropCover; - private bool _DragAndDropActive; private int _OldMousePosX; private int _OldMousePosY; private int _SelectedSongID; private int _SelectedCategoryIndex; - private CSongMenu _SongMenu; + private ISongMenu _SongMenu; private CPlaylist _Playlist; + public override EMusicType CurrentMusicType + { + get { return CSongs.IsInCategory ? EMusicType.Preview : EMusicType.Background; } + } + public CScreenSong() { _AvailableGameModes = new List(); @@ -139,6 +143,14 @@ namespace Vocaluxe.Screens _ThemeSelectSlides = new string[] {_SelectSlideOptionsMode, _SelectSlideOptionsPlaylistAdd, _SelectSlideOptionsPlaylistOpen, _SelectSlideOptionsNumMedleySongs}; _ThemeSongMenus = new string[] {_SongMenuName}; _ThemePlaylists = new string[] {_PlaylistName}; + + _DragAndDropCover = GetNewStatic(); + } + + protected override void _OnSongMenuChanged() + { + base._OnSongMenuChanged(); + _SongMenu = _SongMenus[_SongMenuName]; } public override void LoadTheme(string xmlPath) @@ -147,12 +159,12 @@ namespace Vocaluxe.Screens _SongMenu = _SongMenus[_SongMenuName]; _Playlist = _Playlists[_PlaylistName]; _ToggleSongOptions(ESongOptionsView.None); - _DragAndDropCover = GetNewStatic(); _Playlist.Init(); _Playlist.Visible = false; _AvailableGameModes.Clear(); + _AddStatic(_DragAndDropCover); } public override bool HandleInput(SKeyEvent keyEvent) @@ -191,7 +203,7 @@ namespace Vocaluxe.Screens { case Keys.Escape: if ((CSongs.Category < 0 || _Sso.Sorting.Tabs == EOffOn.TR_CONFIG_OFF) && !_Sso.Selection.PartyMode && !_SearchActive) - CGraphics.FadeTo(EScreens.ScreenMain); + CGraphics.FadeTo(EScreen.Main); if (_SearchActive) { _SearchActive = false; @@ -229,7 +241,7 @@ namespace Vocaluxe.Screens { _PlaylistActive = !_PlaylistActive; _Playlist.Selected = _PlaylistActive; - _SongMenu.Active = !_PlaylistActive; + _SongMenu.Selected = !_PlaylistActive; } break; @@ -240,7 +252,7 @@ namespace Vocaluxe.Screens _ApplyNewSearchFilter(_SearchText.Remove(_SearchText.Length - 1)); } else if ((!CSongs.IsInCategory || _Sso.Sorting.Tabs == EOffOn.TR_CONFIG_OFF) && !_Sso.Selection.PartyMode) - CGraphics.FadeTo(EScreens.ScreenMain); + CGraphics.FadeTo(EScreen.Main); break; @@ -371,26 +383,6 @@ namespace Vocaluxe.Screens break; } } - - int volumeDiff = 0; - if (keyEvent.ModShift && (keyEvent.Key == Keys.Add || keyEvent.Key == Keys.PageUp)) - volumeDiff = 5; - else if (keyEvent.ModShift && (keyEvent.Key == Keys.Subtract || keyEvent.Key == Keys.PageDown)) - volumeDiff = -5; - if (volumeDiff != 0) - { - if (CSongs.IsInCategory) - { - CConfig.PreviewMusicVolume += volumeDiff; - CSound.SetGlobalVolume(CConfig.PreviewMusicVolume); - } - else - { - CConfig.BackgroundMusicVolume += volumeDiff; - CSound.SetGlobalVolume(CConfig.BackgroundMusicVolume); - } - } - return true; } @@ -398,10 +390,10 @@ namespace Vocaluxe.Screens { base.HandleMouse(mouseEvent); - if (_DragAndDropActive) + if (_DragAndDropCover.Visible) { - _DragAndDropCover.Rect.X += mouseEvent.X - _OldMousePosX; - _DragAndDropCover.Rect.Y += mouseEvent.Y - _OldMousePosY; + _DragAndDropCover.X += mouseEvent.X - _OldMousePosX; + _DragAndDropCover.Y += mouseEvent.Y - _OldMousePosY; } _OldMousePosX = mouseEvent.X; _OldMousePosY = mouseEvent.Y; @@ -410,14 +402,14 @@ namespace Vocaluxe.Screens { _PlaylistActive = true; _Playlist.Selected = _PlaylistActive; - _SongMenu.Active = !_PlaylistActive; + _SongMenu.Selected = !_PlaylistActive; _ToggleSongOptions(ESongOptionsView.None); } - else if (CHelper.IsInBounds(_SongMenu.Rect, mouseEvent.X, mouseEvent.Y)) + else if (CHelper.IsInBounds(_SongMenu.Rect, mouseEvent)) { _PlaylistActive = false; _Playlist.Selected = _PlaylistActive; - _SongMenu.Active = !_PlaylistActive; + _SongMenu.Selected = !_PlaylistActive; } @@ -446,7 +438,7 @@ namespace Vocaluxe.Screens if (CSongs.Category < 0 && !_Sso.Selection.PartyMode && !_SearchActive) { - CGraphics.FadeTo(EScreens.ScreenMain); + CGraphics.FadeTo(EScreen.Main); return true; } } @@ -464,8 +456,11 @@ namespace Vocaluxe.Screens } } - if (_SongMenu.HandleMouse(ref mouseEvent, _Sso)) - mouseEvent.Handled = true; + if (_CurSongOptionsView == ESongOptionsView.None) + { + if (_SongMenu.HandleMouse(ref mouseEvent, _Sso)) + mouseEvent.Handled = true; + } if (mouseEvent.Handled) { @@ -476,7 +471,7 @@ namespace Vocaluxe.Screens if (mouseEvent.LB) { - if (_IsMouseOver(mouseEvent)) + if (_IsMouseOverCurSelection(mouseEvent)) { if (_Buttons[_ButtonOpenOptions].Selected) { @@ -585,20 +580,24 @@ namespace Vocaluxe.Screens if (mouseEvent.LBH) { - if (!_DragAndDropActive && _Playlist.Visible && CSongs.NumSongsVisible > 0 && _SongMenu.GetSelectedSongNr() != -1) + if (!_DragAndDropCover.Visible && _Playlist.Visible && CSongs.NumSongsVisible > 0 && _SongMenu.GetSelectedSongNr() != -1) { - _DragAndDropCover = _SongMenu.GetSelectedSongCover(); - _DragAndDropCover.Rect.Z = CSettings.ZNear; + CStatic cover = _SongMenu.GetSelectedSongCover(); + _DragAndDropCover.Texture = cover.Texture; + _DragAndDropCover.Aspect = cover.Aspect; + _DragAndDropCover.MaxRect = cover.Rect; + _DragAndDropCover.Color = cover.Color; + _DragAndDropCover.Z = CSettings.ZNear; _Playlist.DragAndDropSongID = CSongs.VisibleSongs[_SongMenu.GetSelectedSongNr()].ID; - _DragAndDropActive = true; + _DragAndDropCover.Visible = true; return true; } } - if (!mouseEvent.LBH && _DragAndDropActive) + if (!mouseEvent.LBH && _DragAndDropCover.Visible) { - _DragAndDropActive = false; + _DragAndDropCover.Visible = false; _Playlist.DragAndDropSongID = -1; return true; } @@ -641,24 +640,38 @@ namespace Vocaluxe.Screens if (_Sso.Selection.PartyMode) _ToggleSongOptions(ESongOptionsView.None); - _SongMenu.Active = !_PlaylistActive; + _SongMenu.Selected = !_PlaylistActive; _SongMenu.SmallView = _Playlist.Visible; if (_Playlist.ActivePlaylistID != -1) _Playlist.LoadPlaylist(_Playlist.ActivePlaylistID); - _DragAndDropActive = false; + _DragAndDropCover.Visible = false; _Playlist.DragAndDropSongID = -1; UpdateGame(); - if (CSongs.IsInCategory) - CSound.SetGlobalVolume(CConfig.PreviewMusicVolume); + } + + public override void OnShowFinish() + { + base.OnShowFinish(); + CSongs.OnCategoryChanged += _OnCategoryChanged; + } + + private static void _OnCategoryChanged() + { + CSound.SetGlobalVolume(CSongs.IsInCategory ? CConfig.PreviewMusicVolume : CConfig.BackgroundMusicVolume); } public override bool UpdateGame() { if (_PlaylistActive) - _CheckPlaylist(); + { + if (_Playlist.ActivePlaylistID == -1) + _ClosePlaylist(); + else + _Playlist.UpdateGame(); + } _Texts[_TextCategory].Text = CSongs.GetCurrentCategoryName(); @@ -698,27 +711,12 @@ namespace Vocaluxe.Screens return true; } - public override bool Draw() - { - base.Draw(); - - if (_DragAndDropActive) - _DragAndDropCover.Draw(); - - return true; - } - public override void OnClose() { base.OnClose(); _SongMenu.OnHide(); - - if (CGraphics.NextScreen != EScreens.ScreenNames) - { - CBackgroundMusic.Disabled = false; - CSound.SetGlobalVolume(CConfig.BackgroundMusicVolume); - } + CSongs.OnCategoryChanged -= _OnCategoryChanged; } private void _HandlePartySongSelection(int songNr) @@ -832,7 +830,7 @@ namespace Vocaluxe.Screens CGame.ClearSongs(); if (CGame.AddVisibleSong(songNr, gm)) - CGraphics.FadeTo(EScreens.ScreenNames); + CGraphics.FadeTo(EScreen.Names); } } @@ -846,7 +844,7 @@ namespace Vocaluxe.Screens CGame.ClearSongs(); if (CGame.AddVisibleSong(songNr, gm)) - CGraphics.FadeTo(EScreens.ScreenNames); + CGraphics.FadeTo(EScreen.Names); } } @@ -860,7 +858,7 @@ namespace Vocaluxe.Screens CGame.Reset(); CGame.ClearSongs(); if (CGame.AddVisibleSong(songNr, EGameMode.TR_GAMEMODE_MEDLEY)) - CGraphics.FadeTo(EScreens.ScreenNames); + CGraphics.FadeTo(EScreen.Names); } } @@ -887,7 +885,7 @@ namespace Vocaluxe.Screens } if (CGame.GetNumSongs() > 0) - CGraphics.FadeTo(EScreens.ScreenNames); + CGraphics.FadeTo(EScreen.Names); } private void _StartRandomVisibleSongs() @@ -911,7 +909,7 @@ namespace Vocaluxe.Screens } if (CGame.GetNumSongs() > 0) - CGraphics.FadeTo(EScreens.ScreenNames); + CGraphics.FadeTo(EScreen.Names); } private void _StartRandomMedley(int numSongs, bool allSongs) @@ -947,7 +945,7 @@ namespace Vocaluxe.Screens } if (CGame.GetNumSongs() > 0) - CGraphics.FadeTo(EScreens.ScreenNames); + CGraphics.FadeTo(EScreen.Names); } private bool _SelectNextRandom(int teamNr) @@ -1014,12 +1012,12 @@ namespace Vocaluxe.Screens { int start = 0; int curSelected = CSongs.IsInCategory ? _SongMenu.GetSelectedSongNr() : _SongMenu.GetSelectedCategory(); - bool firstLevel = CConfig.Tabs == EOffOn.TR_CONFIG_OFF && CSongs.IsInCategory; - bool secondSort = CConfig.Tabs == EOffOn.TR_CONFIG_ON && - (CConfig.SongSorting == ESongSorting.TR_CONFIG_ARTIST || - CConfig.SongSorting == ESongSorting.TR_CONFIG_ARTIST_LETTER || - CConfig.SongSorting == ESongSorting.TR_CONFIG_FOLDER || - CConfig.SongSorting == ESongSorting.TR_CONFIG_TITLE_LETTER); + bool firstLevel = CConfig.Config.Game.Tabs == EOffOn.TR_CONFIG_OFF && CSongs.IsInCategory; + bool secondSort = CConfig.Config.Game.Tabs == EOffOn.TR_CONFIG_ON && + (CConfig.Config.Game.SongSorting == ESongSorting.TR_CONFIG_ARTIST || + CConfig.Config.Game.SongSorting == ESongSorting.TR_CONFIG_ARTIST_LETTER || + CConfig.Config.Game.SongSorting == ESongSorting.TR_CONFIG_FOLDER || + CConfig.Config.Game.SongSorting == ESongSorting.TR_CONFIG_TITLE_LETTER); if (firstLevel && !secondSort) { //TODO: What's to do with multiple tags? @@ -1027,7 +1025,7 @@ namespace Vocaluxe.Screens ReadOnlyCollection songs = CSongs.VisibleSongs; int ct = songs.Count; int visibleID = -1; - switch (CConfig.SongSorting) + switch (CConfig.Config.Game.SongSorting) { case ESongSorting.TR_CONFIG_ARTIST: case ESongSorting.TR_CONFIG_ARTIST_LETTER: @@ -1063,7 +1061,7 @@ namespace Vocaluxe.Screens ReadOnlyCollection songs = CSongs.VisibleSongs; int ct = songs.Count; int visibleID = -1; - switch (CConfig.SongSorting) + switch (CConfig.Config.Game.SongSorting) { case ESongSorting.TR_CONFIG_FOLDER: case ESongSorting.TR_CONFIG_TITLE_LETTER: @@ -1206,7 +1204,7 @@ namespace Vocaluxe.Screens _SelectSlides[_SelectSlideOptionsPlaylistAdd].Visible = true; _Buttons[_ButtonOptionsSing].Visible = true; _Buttons[_ButtonOptionsPlaylist].Visible = true; - _SetInteractionToButton(_Buttons[_ButtonOptionsSing]); + _SelectElement(_Buttons[_ButtonOptionsSing]); _SetSelectSlidePlaylistToCurrentPlaylist(); } @@ -1229,9 +1227,9 @@ namespace Vocaluxe.Screens // ReSharper disable ConvertIfStatementToConditionalTernaryExpression if (_Buttons[_ButtonOptionsRandom].Visible) // ReSharper restore ConvertIfStatementToConditionalTernaryExpression - _SetInteractionToButton(_Buttons[_ButtonOptionsRandom]); + _SelectElement(_Buttons[_ButtonOptionsRandom]); else - _SetInteractionToButton(_Buttons[_ButtonOptionsRandomCategory]); + _SelectElement(_Buttons[_ButtonOptionsRandomCategory]); } private void _ShowSongOptionsMedley() @@ -1253,16 +1251,10 @@ namespace Vocaluxe.Screens _SelectSlides[_SelectSlideOptionsNumMedleySongs].SetSelectionByValueIndex(4); else _SelectSlides[_SelectSlideOptionsNumMedleySongs].SetSelectionByValueIndex(_SelectSlides[_SelectSlideOptionsNumMedleySongs].NumValues - 1); - _SetInteractionToButton(_Buttons[_ButtonOptionsStartMedley]); + _SelectElement(_Buttons[_ButtonOptionsStartMedley]); } #region Playlist Actions - private void _CheckPlaylist() - { - if (_Playlist.ActivePlaylistID == -1 && _PlaylistActive) - _ClosePlaylist(); - } - private void _OpenPlaylist(int playlistID) { if (_Playlist.LoadPlaylist(playlistID)) @@ -1279,7 +1271,7 @@ namespace Vocaluxe.Screens _SongMenu.SmallView = false; _PlaylistActive = false; _Playlist.Selected = _PlaylistActive; - _SongMenu.Active = !_PlaylistActive; + _SongMenu.Selected = !_PlaylistActive; _Playlist.ClosePlaylist(); } } diff --git a/Vocaluxe/Screens/CScreenTest.cs b/Vocaluxe/Screens/CScreenTest.cs index 1d571be9..bfdc9827 100644 --- a/Vocaluxe/Screens/CScreenTest.cs +++ b/Vocaluxe/Screens/CScreenTest.cs @@ -23,7 +23,7 @@ using VocaluxeLib.Menu; namespace Vocaluxe.Screens { - class CScreenTest : CMenu + public class CScreenTest : CMenu { // Version number for theme files. Increment it, if you've changed something on the theme files! protected override int _ScreenVersion @@ -63,11 +63,11 @@ namespace Vocaluxe.Screens { case Keys.Escape: case Keys.Back: - CGraphics.FadeTo(EScreens.ScreenMain); + CGraphics.FadeTo(EScreen.Main); break; case Keys.Enter: - CGraphics.FadeTo(EScreens.ScreenMain); + CGraphics.FadeTo(EScreen.Main); break; case Keys.F: @@ -89,13 +89,13 @@ namespace Vocaluxe.Screens public override bool HandleMouse(SMouseEvent mouseEvent) { - if (mouseEvent.LB && _IsMouseOver(mouseEvent)) {} + if (mouseEvent.LB && _IsMouseOverCurSelection(mouseEvent)) {} if (mouseEvent.LB) - CGraphics.FadeTo(EScreens.ScreenMain); + CGraphics.FadeTo(EScreen.Main); if (mouseEvent.RB) - CGraphics.FadeTo(EScreens.ScreenMain); + CGraphics.FadeTo(EScreen.Main); return true; } diff --git a/Vocaluxe/Vocaluxe.csproj b/Vocaluxe/Vocaluxe.csproj index b8276467..0c0d6aac 100644 --- a/Vocaluxe/Vocaluxe.csproj +++ b/Vocaluxe/Vocaluxe.csproj @@ -216,14 +216,26 @@ + + + + + + + + + + + + @@ -241,7 +253,7 @@ - + @@ -257,7 +269,7 @@ - + @@ -280,13 +292,7 @@ - - - - - - @@ -509,7 +515,11 @@ - xcopy /E /D /Y "$(ProjectDir)\Website" "$(SolutionDir)\PhoneGap" + xcopy /E /D /Y "$(ProjectDir)\Website" "$(SolutionDir)\PhoneGap" +powershell -command "(Get-Content -Encoding UTF8 '$(ProjectDir)Properties\AssemblyInfo.cs') | Foreach-Object {$_ -replace '(?<=AssemblyInformationalVersion\()(.*)(?=\))', '\"GITVERSION\"'} | Set-Content -Encoding UTF8 '$(ProjectDir)Properties\AssemblyInfo.cs'" + + + powershell -command "$version = git describe --long; (Get-Content -Encoding UTF8 '$(ProjectDir)Properties\AssemblyInfo.cs') | Foreach-Object {$_ -replace 'GITVERSION', $version} | Set-Content -Encoding UTF8 '$(ProjectDir)Properties\AssemblyInfo.cs'" -
+

Volcaluxe

@@ -297,14 +297,36 @@
+
+ +
+
+
+ + + + + + +
+
- P +
- + +
diff --git a/Vocaluxe/Website/js/main.js b/Vocaluxe/Website/js/main.js index 53b892be..814d253b 100644 --- a/Vocaluxe/Website/js/main.js +++ b/Vocaluxe/Website/js/main.js @@ -1,628 +1,1278 @@ -var ownProfileId = -1; -var profileIdRequest = -1; -var songIdRequest = -1; -var allSongsCache = null; -var playlistIdRequest = -1; -var playlistRequestName = ""; -var customSelectPlaylistSongCallback = null; -var sessionId = ""; -var serverBaseAddress = ""; -var translationLoaded; +/// +/// +(function () { + var imageLoader; + var externalServices; + var translator; + var pageHandler; + var sessionHandler; -if (document.location.protocol == "file:") { - if (typeof (window.deviceAndJqmLoaded) == "undefined") { - window.deviceAndJqmLoaded = $.Deferred(); - } - window.deviceAndJqmLoaded.done(function () { - preStart(); - }); -} else { - $(document).ready(function () { - preStart(); - }); -} - -function preStart() { - translationLoaded = $.Deferred(); - initTranslation(); - - translationLoaded.done(function () { - translate(); - start(); - }); -} - -function start() { - replaceTransitionHandler(); - initPageLoadHandler(); - initKeyboardPageHandler(); - initMainPageHandler(); - initDiscoverPageHandler(); - initLoginPageHandler(); - initHeartbeat(); - initVideoPopup(); -} - -function replaceTransitionHandler() { - //Thx to http://stackoverflow.com/a/14096311 - var oldDefaultTransitionHandler = $.mobile.defaultTransitionHandler; - - $.mobile.defaultTransitionHandler = function (name, reverse, $to, $from) { - var promise = $to.data('promise'); - if (promise) { - $to.removeData('promise'); - /*$('div[data-role="content"]').wrap('
'); - $.mobile.loading('show', { - text: 'Loading data...', - textVisible: true - });*/ - return promise.then(function () { - /*$.mobile.loading('hide'); - $('div[data-role="content"]').unwrap();*/ - return oldDefaultTransitionHandler(name, reverse, $to, $from); + var initMain = function () { + if (document.location.protocol == "file:") { + if (typeof (window.deviceAndJqmLoaded) == "undefined") { + window.deviceAndJqmLoaded = $.Deferred(); + } + window.deviceAndJqmLoaded.done(function () { + preStart(); + }); + } else { + $(document).ready(function () { + translator = new Translator(); + preStart(); }); } - return oldDefaultTransitionHandler(name, reverse, $to, $from); }; -} -function initPageLoadHandler() { - //pageLoadHandler for discover - $(document).on('pagebeforeshow', '#discover', pagebeforeshowDiscover); + function preStart() { + translator.translationLoaded.done(function () { + translator.translate(); - //pageLoadHandler for displayProfile - $(document).on('pagebeforeshow', '#displayProfile', function () { - if (profileIdRequest >= 0) { - var promise = request({ - url: "getProfile?profileId=" + profileIdRequest - }).done(function (result) { - handleDisplayProfileData(result); + sessionHandler = new SessionHandler(); + imageLoader = new ImageLoader(); + externalServices = new ExternalServices(); + pageHandler = new PageHandler(); - $('#playerSaveButton').click(function () { - var dataToUpload = {}; - - dataToUpload["ProfileId"] = profileIdRequest; - dataToUpload["PlayerName"] = $('#playerName').prop("value"); - dataToUpload["Type"] = $('#playerType').prop("value"); - dataToUpload["Difficulty"] = $('#playerDifficulty').prop("value"); - dataToUpload["Avatar"] = $('#playerAvatar').data("changed") ? { "base64Data": $('#playerAvatar').prop("src") } : null; - - var pass = $('#playerPassword').prop("value"); - if (pass != "***__oldPassword__***") { - if (pass == "") { - dataToUpload["Password"] = "***__CLEAR_PASSWORD__***"; - } else { - dataToUpload["Password"] = pass; - } - } else { - dataToUpload["Password"] = null; - } - - request({ - url: "sendProfile", - contentType: "application/json;charset=utf-8", - type: "POST", - data: JSON.stringify(dataToUpload), - }, "Uploading profile...").done(function () { - history.back(); - }); - - }); - }); - - // Save promise on page so the transition handler can find it. - $(this).data('promise', promise); - } - else { - //new profile - handleDisplayProfileData({ - "Avatar": { "base64Data": null }, - "Difficulty": 0, - "IsEditable": true, - "PlayerName": i18n.t("YourName") || "YourName", - "ProfileId": -1, - "Type": 1 - }); - $('#playerType').prop("value", 0); - $('#playerDifficulty').prop("value", 0); - - $('#playerSaveButton').click(function () { - var dataToUpload = {}; - - dataToUpload["ProfileId"] = -1; - dataToUpload["PlayerName"] = $('#playerName').prop("value"); - dataToUpload["Type"] = $('#playerType').prop("value"); - dataToUpload["Difficulty"] = $('#playerDifficulty').prop("value"); - dataToUpload["Avatar"] = $('#playerAvatar').data("changed") ? { "base64Data": $('#playerAvatar').prop("src") } : null; - - var pass = $('#playerPassword').prop("value"); - if (pass != "***__oldPassword__***") { - if (pass == "") { - dataToUpload["Password"] = "***__CLEAR_PASSWORD__***"; - } else { - dataToUpload["Password"] = pass; - } - } else { - dataToUpload["Password"] = null; - } - - request({ - url: "sendProfile", - contentType: "application/json;charset=utf-8", - type: "POST", - data: JSON.stringify(dataToUpload) - }, 'Creating profile...').done(function () { - $.mobile.changePage("#login", { transition: "slidefade" }); - }); - - }); - } - }); - - function handleDisplayProfileData(data) { - $('#playerName').prop("value", data.PlayerName); - - addImage($('#playerAvatar')[0], data.Avatar, "img/profile.png"); - - $('#playerAvatar').data("changed", false); - $('#playerType').prop("selectedIndex", data.Type).selectmenu("refresh"); - $('#playerDifficulty').prop("selectedIndex", data.Difficulty).selectmenu("refresh"); - if (data.IsEditable) { - $('#playerName').prop('disabled', false); - $('#playerType').prop('disabled', false); - $('#playerDifficulty').prop('disabled', false); - $('#playerSaveButton').show().unbind("click"); - $('#playerAvatar').unbind("click"); - $('#playerPassword').prop('disabled', false).prop("value", "***__oldPassword__***").parent().show(); - $('#playerPasswordLabel').show(); - - $('#playerAvatar').click(function () { - if ($('#captureContainer').length > 0) { - $('#captureContainer').remove(); - } - - if (document.location.protocol == "file:" - && typeof (navigator) != 'undefined' - && typeof (navigator.camera) != 'undefined' - && typeof (navigator.camera.getPicture) != 'undefined') { - navigator.camera.getPicture(function (imageData) { - $('#playerAvatar').prop("src", "data:image/jpeg;base64," + imageData); - $('#playerAvatar').data("changed", true); - }, function () { - //Fail - do nothing - }, { - destinationType: navigator.camera.DestinationType.DATA_URL, - allowEdit: true, - correctOrientation: true, - saveToPhotoAlbum: true, - quality: 50 - }); - - } else { - $(document.body).append('
'); - - $('#capture').change(function (eventData) { - if (eventData && eventData.target && eventData.target.files && eventData.target.files.length == 1) { - var file = eventData.target.files[0]; - var reader = new FileReader(); - reader.onloadend = function (e) { - $('#playerAvatar').prop("src", e.target.result); - $('#playerAvatar').data("changed", true); - $('#captureContainer').remove(); - }; - reader.readAsDataURL(file); - } - }); - - $('#capture').click(); - } - }); - } - else { - $('#playerName').prop('disabled', true); - $('#playerType').prop('disabled', true); - $('#playerDifficulty').prop('disabled', true); - $('#playerSaveButton').hide().unbind("click"); - $('#playerAvatar').unbind("click"); - $('#playerPassword').prop('disabled', true).parent().hide(); - $('#playerPasswordLabel').hide(); - } + pageHandler.init(); + }); + translator.initTranslation(); } - //pageLoadHandler for selectProfile - $(document).on('pagebeforeshow', '#selectProfile', function () { - var promise = request({ - url: "getProfileList" - }).done(function (data) { - $('#selectProfileList').children().remove(); + function request(data, message) { + if ((typeof message) == "undefined" || message == null) { + message = "Loading..."; + } - function handleProfileSelectLineClick(e) { - profileIdRequest = parseInt(e.currentTarget.id.replace("ProfileSelectLine_", "")); - $.mobile.changePage("#displayProfile", { transition: "slidefade" }); + if ((typeof data.timeout) == "undefined") { + data.timeout = 10000; //10 sec. timeout + } + + if (message != "noOverlay") { + var message2 = message; + if (i18n.t) { + message2 = i18n.t(message2); } + $('div[data-role="content"]').wrap('
'); + $.mobile.loading('show', { + text: message2, + textVisible: true + }); + } - for (var profile in data) { - var img = $('
  • ' + data[profile].PlayerName + '

    Click here to show the profile of ' + data[profile].PlayerName + '

  • ') - .appendTo('#selectProfileList') - .click(handleProfileSelectLineClick) - .find("img")[0]; + if (!data["headers"]) { + data["headers"] = {}; + } - addImage(img, data[profile].Avatar, "img/profile.png"); + if (message == "external") { + message = "Loading (external)..."; + if (i18n.t) { + message = i18n.t(message) || message; } + } else { + data["headers"]["session"] = sessionHandler.sessionId; + data.url = sessionHandler.serverBaseAddress + data.url; + } - $('#selectProfileList').listview('refresh'); + return $.ajax(data).always(function (result) { + if (message != "noOverlay") { + $.mobile.loading('hide'); + $('div[data-role="content"]').unwrap(); + } + }).fail(function (result) { + if (result.statusText.indexOf("No session") != -1) { + sessionHandler.logout(); + return; + } + if (message != "noOverlay") { + var msg = result.statusText.length <= 20 ? result.statusText : "Error..."; + if (msg == "error" && result.readyState == 0) { + msg = "No connection"; + } + showError(msg); + } }); + } - // Save promise on page so the transition handler can find it. - $(this).data('promise', promise); - }); + function showError(message) { + if (!message) { + message = "Error..."; + } - //pageLoadHandler for displaySong - $(document).on('pagebeforeshow', '#displaySong', function () { - var promise = request({ - url: "getSong?songId=" + songIdRequest - }).done(function (result) { - $('#displaySongAddPlaylist').hide(); + if (i18n.t) { + message = i18n.t(message) || message; + } - if (result.Title != null) { - $('#displaySongTitle').text(result.Title); - } - else { - $('#displaySongTitle').text("No current song"); - } + $('div[data-role="content"]').wrap('
    '); + $.mobile.loading('show', { + text: message, + textVisible: true + }); + $('.ui-loader').find('span').removeClass('ui-icon-loading').addClass('ui-custom-errorIcon'); - addImage($('#displaySongCover')[0], result.Cover, "img/noCover.png"); + setTimeout(function () { + $.mobile.loading('hide'); + $('div[data-role="content"]').unwrap(); + $('.ui-loader').find('span').removeClass('ui-custom-errorIcon').addClass('ui-icon-loading'); + }, 1000); + } - if (result.Artist != null) { - $('#displaySongArtist').text(result.Artist); - } - else { - $('#displaySongArtist').text("-"); - } + function ImageLoader() { + var cachedImages = {}; - if (result.Genre != null) { - $('#displaySongGenre').text(result.Genre); - } - else { - $('#displaySongGenre').text("-"); - } + this.delayedImageLoad = function (elem, id, fail) { + if (elem && id) { + if (cachedImages[id]) { + elem.src = cachedImages[id].base64Data; + return; + } - if (result.Year != null && result.Year != "") { - $('#displaySongYear').text(result.Year); - } - else { - $('#displaySongYear').text("-"); - } - - if (result.Language != null) { - $('#displaySongLanguage').text(result.Language); - } - else { - $('#displaySongLanguage').text("-"); - } - - $('#displaySongIsDuet').text(result.IsDuet ? "Yes" : "No"); - - if (result.Title != null || result.Artist != null) { - $('#displaySongLinks').show(); - - $('#displaySongAddPlaylist').unbind('click').click(function () { - customSelectPlaylistSongCallback = function (playlistId) { - request({ url: "addSongToPlaylist?songId=" + result.SongId + "&playlistId=" + playlistId + "&duplicates=false" }, "Add to playlist..."); - history.back(); - }; - $.mobile.changePage("#selectPlaylist", { transition: "slidefade" }); + elem.src = ""; + $(elem).addClass("imageLoaderImg"); + request({ + url: "delayedImage?id=" + id + }).done(function (result) { + $(elem).removeClass("imageLoaderImg"); + elem.src = result.base64Data; + cachedImages[id] = result; + }).fail(function () { + $(elem).removeClass("imageLoaderImg"); + if (fail) { + elem.src = fail; + } }); - - $('#displaySongLinkYoutube').unbind('click').click(function () { - showYoutube(result.Artist, result.Title); - }); - - $('#displaySongLinkSpotify').unbind('click').click(function () { - showSpotify(result.Artist, result.Title); - }); - - $('#displaySongLinkWikipedia').unbind('click').click(function () { - showWikipedia(result.Artist); - }); - } else { - $('#displaySongLinks').hide(); } + }; - request({ - url: "hasUserRight?right=" + 32 - }).done(function (result2) { - if (result2) { - $('#displaySongAddPlaylist').show(); + this.addImage = function (img, base64Image, defaultImg) { + if (base64Image && (base64Image.base64Data || base64Image.imageId)) { + if (base64Image.base64Data) { + $(img).prop("src", base64Image.base64Data); } else { - $('#displaySongAddPlaylist').hide(); + imageLoader.delayedImageLoad(img, base64Image.imageId, defaultImg); + } + } else { + $(img).prop("src", defaultImg); + } + }; + } + + function ExternalServices() { + var popupVideoHeight = 390; + var popupVideoWidth = 640; + + var init = function () { + initVideoPopup(); + }; + + var initVideoPopup = function () { + + function scale(width, height, padding, border) { + var scrWidth = $(window).width() - 30, + scrHeight = $(window).height() - 30, + ifrPadding = 2 * padding, + ifrBorder = 2 * border, + ifrWidth = width + ifrPadding + ifrBorder, + ifrHeight = height + ifrPadding + ifrBorder, + h, w; + + if (ifrWidth < scrWidth && ifrHeight < scrHeight) { + w = ifrWidth; + h = ifrHeight; + } else if ((ifrWidth / scrWidth) > (ifrHeight / scrHeight)) { + w = scrWidth; + h = (scrWidth / ifrWidth) * ifrHeight; + } else { + h = scrHeight; + w = (scrHeight / ifrHeight) * ifrWidth; + } + + return { + 'width': w - (ifrPadding + ifrBorder), + 'height': h - (ifrPadding + ifrBorder) + }; + } + + $("#popupVideo").find("a").click(function () { + $("#popupVideo").popup("close"); + $("#popupVideo").popup("close"); //Sometimes twice?? + }); + + $("#popupVideo iframe") + .attr("width", 0) + .attr("height", 0); + + $("#popupVideo").on({ + popupbeforeposition: function () { + var size = scale(popupVideoWidth, popupVideoHeight, 15, 1), + w = size.width, + h = size.height; + + $("#popupVideo iframe") + .attr("width", w) + .attr("height", h); + }, + popupafterclose: function () { + $("#popupVideo iframe") + .attr("width", 0) + .attr("height", 0) + .attr("src", ""); } }); - }); + }; - // Save promise on page so the transition handler can find it. - $(this).data('promise', promise); - }); + this.showYoutube = function (artist, title) { + request({ + url: "http://gdata.youtube.com/feeds/api/videos/-/Music?max-results=1&alt=json&format=5&q=" + artist + " " + title, + dataType: "json", + }, "external") + .done(function (result) { + if (result && result.feed && result.feed.entry && result.feed.entry.length > 0) { + var vidId = result.feed.entry[0].id.$t.replace("http://gdata.youtube.com/feeds/api/videos/", ""); + popupVideoHeight = 390; + popupVideoWidth = 640; - //pageLoadHandler for selectSong - $(document).on('pagebeforeshow', '#selectSong', function () { - function handleGetAllSongs() { - $('#selectSongList').children().remove(); + $("#popupVideo iframe").attr("src", "http://www.youtube.com/embed/" + vidId + "?&autoplay=1&rel=0&showinfo=0&disablekb=1&autohide=1"); + $("#popupVideo").popup("open"); + } + }); + }; - function handleSelectSongLineClick(e) { - songIdRequest = parseInt(e.currentTarget.id.replace("selectSongLine_", "")); - $.mobile.changePage("#displaySong", { transition: "slidefade" }); - } + this.showSpotify = function (artist, title) { + request({ + url: "http://ws.spotify.com/search/1/track.json?q=" + title + "+artist:" + artist, + dataType: "json", + }, "external") + .done(function (result) { + if (result && result.tracks && result.tracks.length > 0) { + var spotId = result.tracks[0].href; + popupVideoHeight = 80; + popupVideoWidth = 300; - for (var id in allSongsCache) { - $('
  • '/*+' '*/ + '

    ' + allSongsCache[id].Artist + '

    ' + allSongsCache[id].Title + '

  • ') - .appendTo('#selectSongList') - .click(handleSelectSongLineClick); - } + $("#popupVideo iframe").attr("src", "https://embed.spotify.com/?uri=" + spotId); + $("#popupVideo").popup("open"); + } + }); + }; - $('#selectSongList').listview('refresh'); - } + this.showWikipedia = function (artist) { + popupVideoHeight = 800; + popupVideoWidth = 600; - if (allSongsCache == null) { - var promise = request({ - url: "getAllSongs" - }).done(function (data) { - allSongsCache = data; - handleGetAllSongs(); + $("#popupVideo iframe").attr("src", "http://m.wikipedia.org/wiki/Special:Search/" + artist); + $("#popupVideo").popup("open"); + }; + + init(); + } + + function Translator() { + this.translationLoaded = $.Deferred(); + var translationLoaded = this.translationLoaded; + + this.initTranslation = function () { + $.i18n.init({ + resGetPath: 'locales/__lng__.json', + supportedLngs: ['en', 'de', 'fr', 'sv', 'cs'], + fallbackLng: 'en', + keyseparator: '::', + nsseparator: ':::' + }).done(function () { + translationLoaded.resolve(); }); + }; - // Save promise on page so the transition handler can find it. - $(this).data('promise', promise); - } - else { - handleGetAllSongs(); - } - }); + this.translate = function () { + //repair broken buttons on the first page (get broken while translating) + var repairButtons = function () { + $($('#discoverConnect')[0].childNodes).wrap(' '); + $($('#discoverReadQr')[0].childNodes).wrap(' '); + }; + $('body').i18n(); + repairButtons(); + }; + } - //pageLoadHandler for selectUserAdmin - $(document).on('pagebeforeshow', '#selectUserAdmin', function () { - var promise = request({ - url: "getProfileList" - }).done(function (data) { - $('#selectUserAdminList').children().remove(); + function PageHandler() { + var loginPageHandler; + var discoverPageHandler; + var mainPageHandler; + var keyboardPageHandler; + var userPageHandler; + var songPageHandler; + var playlistPageHandler; - function handleSelectUserAdminLineClick(e) { - profileIdRequest = parseInt(e.currentTarget.id.replace("SelectUserAdminLine_", "")); - $.mobile.changePage("#displayUserAdmin", { transition: "slidefade" }); - } + var t = this; - for (var profile in data) { - $('
  • ' + data[profile].PlayerName + '

    Click here to edit roles for ' + data[profile].PlayerName + '

  • ') - .appendTo('#selectUserAdminList') - .click(handleSelectUserAdminLineClick); - } + this.customSelectPlaylistSongCallback = null; + this.profileIdRequest = -1; + this.songIdRequest = -1; - $('#selectUserAdminList').listview('refresh'); - }); + this.init = function () { + replaceTransitionHandler(); + loginPageHandler = new LoginPageHandler(); + discoverPageHandler = new DiscoverPageHandler(); + mainPageHandler = new MainPageHandler(); + keyboardPageHandler = new KeyboardPageHandler(); + userPageHandler = new UserPageHandler(); + songPageHandler = new SongPageHandler(); + playlistPageHandler = new PlaylistPageHandler(); + }; - // Save promise on page so the transition handler can find it. - $(this).data('promise', promise); - }); + this.reset = function () { + t.customSelectPlaylistSongCallback = null; + t.profileIdRequest = -1; + t.songIdRequest = -1; + }; - //pageLoadHandler for displayUserAdmin - $(document).on('pagebeforeshow', '#displayUserAdmin', function () { - var promise = request({ - url: "getUserRole?profileId=" + profileIdRequest - }).done(function (result) { - var userRoles = { - TR_USERROLE_ADMIN: 2, - TR_USERROLE_KEYBOARDUSER: 4, - TR_USERROLE_ADDSONGSUSER: 8, - TR_USERROLE_PLAYLISTEDITOR: 16, - TR_USERROLE_PROFILEEDITOR: 32 + var replaceTransitionHandler = function () { + //Thx to http://stackoverflow.com/a/14096311 + var oldDefaultTransitionHandler = $.mobile.defaultTransitionHandler; + + $.mobile.defaultTransitionHandler = function (name, reverse, $to, $from) { + var promise = $to.data('promise'); + if (promise) { + $to.removeData('promise'); + /*$('div[data-role="content"]').wrap('
    '); + $.mobile.loading('show', { + text: 'Loading data...', + textVisible: true + });*/ + return promise.then(function () { + /*$.mobile.loading('hide'); + $('div[data-role="content"]').unwrap();*/ + return oldDefaultTransitionHandler(name, reverse, $to, $from); + }); + } + return oldDefaultTransitionHandler(name, reverse, $to, $from); + }; + }; + + var DiscoverPageHandler = function () { + var init = function () { + //pageLoadHandler for discover + $(document).on('pagebeforeshow', '#discover', pagebeforeshowDiscover); + + initDiscoverPageHandler(); }; - for (var roleName in userRoles) { - $('#' + roleName).prop("checked", ((result & userRoles[roleName]) != 0)).checkboxradio("refresh"); - } - - - $('#btnRoleSave').unbind('click').click(function () { - var role = 0; - - for (var roleName2 in userRoles) { - if ($('#' + roleName2).prop("checked")) { - role = (role | userRoles[roleName2]); + var initDiscoverPageHandler = function () { + var keyPressed = function (e) { + if (e.which == 13) { + $('#discoverConnect').click(); } + }; + + $('#discoverServerAddress').keypress(keyPressed); + + function handleAddress(address) { + if (address != null && address != "") { + if (address.indexOf("http") != 0) { + address = "http://" + address; + } + if (address.slice(-1) != '/') { + address = address + '/'; + } + sessionHandler.serverBaseAddress = ""; + request({ + url: address + "isServerOnline", + timeout: 10000 + }, "Checking...") + .done(function () { + sessionHandler.serverBaseAddress = address; + window.localStorage.setItem("VocaluxeServerAddress", address); + $.mobile.changePage("#login", { transition: "slidefade" }); + }) + .fail(function () { + $('#discoverServerAddress').prop("value", ""); + if (document.location.protocol == "file:" + && typeof window.BarcodeScanner != "undefined") { + $('#discoverReadQr').show(); + } + }); + } + } + + $('#discoverConnect').click(function () { + handleAddress($('#discoverServerAddress').prop("value")); + }); + + try { + window.BarcodeScanner = cordova.require("cordova/plugin/BarcodeScanner"); + } catch (e) { + } + + $('#discoverReadQr').hide().click(function () { + window.BarcodeScanner.scan( + function (result) { + handleAddress(result.text); + }, + function () { + showError("Scan faild"); + } + ); + }); + + //Fire pageLoadHandler for discover (first page shown after start) + setTimeout(function () { + pagebeforeshowDiscover(); + $(this).removeData('promise'); + }, 1); + }; + + var pagebeforeshowDiscover = function () { + if (document.location.protocol == "file:") { + if (window.localStorage) { + var address = window.localStorage.getItem("VocaluxeServerAddress"); + if (address != null) { + sessionHandler.serverBaseAddress = ""; + var prom = request({ + url: address + "isServerOnline", + timeout: 10000 + }, "Checking...").done(function () { + sessionHandler.serverBaseAddress = address; + window.localStorage.setItem("VocaluxeServerAddress", address); + $.mobile.changePage("#login", { transition: "none" }); + }).fail(function () { + if (typeof window.BarcodeScanner != "undefined") { + $('#discoverReadQr').show(); + } + }); + $(this).data('promise', prom); + return; + } + if (typeof window.BarcodeScanner != "undefined") { + $('#discoverReadQr').show(); + } + } + } else { + $('#discoverReadQr').hide(); + $.mobile.changePage("#login", { transition: "none" }); + } + }; + + init(); + }; + + var LoginPageHandler = function () { + var init = function () { + //pageLoadHandler for login + $(document).on('pagebeforeshow', '#login', pagebeforeshowLogin); + + initLoginPageHandler(); + }; + + var pagebeforeshowLogin = function () { + if (window.localStorage) { + var value = window.localStorage.getItem("VocaluxeSessionKey"); + if (value != null && value != "") { + sessionHandler.sessionId = value; + } + } + + if (sessionHandler.sessionId != "") { + if (sessionHandler.ownProfileId != -1) { + $.mobile.changePage("#main", { transition: "slidefade" }); + } else { + request({ + url: "getOwnProfileId", + headers: { "session": sessionHandler.sessionId } + }, 'Login...').done(function (result) { + sessionHandler.ownProfileId = result; + $.mobile.changePage("#main", { transition: "slidefade" }); + }); + } + } + }; + + var initLoginPageHandler = function () { + var keyPressed = function (e) { + if (e.which == 13) { + $('#loginButton').click(); + } + }; + + $('#loginName').keypress(keyPressed); + $('#loginPassword').keypress(keyPressed); + + $('#loginButton').click(function () { + var username = $('#loginName').prop("value"); + var password = $('#loginPassword').prop("value"); + + request({ + url: "login?username=" + username + "&password=" + password + }).done(function (result) { + sessionHandler.sessionId = result; + if (window.localStorage) { + window.localStorage.setItem("VocaluxeSessionKey", sessionHandler.sessionId); + } + request({ + url: "getOwnProfileId", + headers: { "session": sessionHandler.sessionId } + }, 'Login...').done(function (result2) { + sessionHandler.ownProfileId = result2; + $.mobile.changePage("#main", { transition: "slidefade" }); + }); + }); + }); + + $('#registerButton').click(function () { + sessionHandler.ownProfileId = -1; + pageHandler.profileIdRequest = -1; + $.mobile.changePage("#displayProfile", { transition: "slidefade" }); + }); + }; + + init(); + }; + + var MainPageHandler = function () { + var init = function () { + //pageLoadHandler for main + $(document).on('pagebeforeshow', '#main', pagebeforeshowMain); + + initMainPageHandler(); + }; + + var pagebeforeshowMain = function () { + request({ + url: "hasUserRight?right=" + 2 + }).done(function (result) { + if (result) { + $('#mainPageTakePhotoLink').parent().parent().parent().show(); + } else { + $('#mainPageTakePhotoLink').parent().parent().parent().hide(); + } + }); + + request({ + url: "hasUserRight?right=" + 8 + }).done(function (result) { + if (result) { + $('#mainPageKeyboard').parent().parent().parent().show(); + } else { + $('#mainPageKeyboard').parent().parent().parent().hide(); + } + }); + + request({ + url: "hasUserRight?right=" + 4 + }).done(function (result) { + if (result) { + $('#mainPageSelectProfile').parent().parent().parent().show(); + } else { + $('#mainPageSelectProfile').parent().parent().parent().hide(); + } + }); + }; + + var initMainPageHandler = function () { + $('#yourProfileLink').click(function () { + pageHandler.profileIdRequest = sessionHandler.ownProfileId; + $.mobile.changePage("#displayProfile", { transition: "slidefade" }); + }); + + $('#currentSongLink').click(function () { + request({ + url: "getCurrentSongId", + headers: { "session": sessionHandler.sessionId } + }, 'Getting current song...').done(function (result) { + pageHandler.songIdRequest = parseInt(result); + $.mobile.changePage("#displaySong", { transition: "slidefade" }); + }); + }); + + function uploadImg(imgData) { + request({ + url: "sendPhoto", + contentType: "application/json;charset=utf-8", + type: "POST", + data: JSON.stringify({ Photo: { base64Data: imgData } }) + }, 'Uploading photo...'); + } + + $('#mainPageTakePhotoLink').click(function () { + if ($('#captureContainer').length > 0) { + $('#captureContainer').remove(); + } + + if (document.location.protocol == "file:" + && typeof (navigator) != 'undefined' + && typeof (navigator.camera) != 'undefined' + && typeof (navigator.camera.getPicture) != 'undefined') { + navigator.camera.getPicture(function (imageData) { + uploadImg("data:image/jpeg;base64," + imageData); + }, function () { + //Fail - do nothing + }, { + destinationType: navigator.camera.DestinationType.DATA_URL, + allowEdit: true, + correctOrientation: true, + saveToPhotoAlbum: true, + quality: 100 + }); + + } else { + $(document.body).append('
    '); + + $('#capture').change(function (eventData) { + if (eventData && eventData.target && eventData.target.files && eventData.target.files.length == 1) { + var file = eventData.target.files[0]; + var reader = new FileReader(); + + reader.onloadend = function (e) { + uploadImg(e.target.result); + $('#capture').remove(); + }; + + reader.readAsDataURL(file); + } + }); + + $('#capture').click(); + } + }); + + $('#mainPageLogoutLink').click(function () { + sessionHandler.logout(); + }); + }; + + init(); + }; + + var KeyboardPageHandler = function () { + var init = function () { + initKeyboardPageHandler(); + }; + + var initKeyboardPageHandler = function () { + $('#keyboardButtonUp').click(function () { + request({ + url: "sendKeyEvent?key=up" + }); + }); + + $('#keyboardButtonDown').click(function () { + request({ + url: "sendKeyEvent?key=down" + }); + }); + + $('#keyboardButtonLeft').click(function () { + request({ + url: "sendKeyEvent?key=left" + }); + }); + + $('#keyboardButtonRight').click(function () { + request({ + url: "sendKeyEvent?key=right" + }); + }); + + $('#keyboardButtonEscape').click(function () { + request({ + url: "sendKeyEvent?key=escape" + }); + }); + + $('#keyboardButtonTab').click(function () { + request({ + url: "sendKeyEvent?key=tab" + }); + }); + + $('#keyboardButtonReturn').click(function () { + request({ + url: "sendKeyEvent?key=return" + }); + }); + + $('#keyboardButtonBackspace').click(function () { + request({ + url: "sendKeyEvent?key=backspace" + }); + }); + + $("#keyboardAutoSend").change(function () { + if ($('#keyboardAutoSend').is(':checked')) { + $('#keyboardButtonSend').hide(); + } else { + $('#keyboardButtonSend').show(); + } + }); + + $('#keyboardButtonSend').click(function () { + sendKeyboardText(); + }); + + $('#keyboardButtonKeys').keyup(function (e) { + if (!$('#keyboardAutoSend').is(':checked') && e.keyCode != 13) { + return; + } + sendKeyboardText(); + }); + + function sendKeyboardText() { + var text = $('#keyboardButtonKeys')[0].value; + + if (text.length <= 0) { + return; + } + + $('#keyboardButtonKeys')[0].value = ""; + $('#keyboardButtonKeys').first().focus(); + + /* if ($('#keyboardButtonFunct').is(':checked')) { + $('#keyboardButtonKeys')[0].value = text.splice(1) + $('#keyboardButtonKeys')[0].value; + var numericElements = /^[0-9][0-9]?/.exec(text.charAt(0)); + if (parseInt(numericElements)) { + request({ + url: "sendKeyEvent?key=F" + numericElements + }); + } + $("#keyboardButtonFunct").attr("checked", false).checkboxradio("refresh"); + }*/ + + request({ + contentType: "application/json;charset=utf-8", + type: "GET", + url: "sendKeyStringEvent?keyString=" + text + + "&shift=" + $('#keyboardButtonShift').is(':checked') + + "&alt=" + $('#keyboardButtonAlt').is(':checked') + + "&ctrl=" + $('#keyboardButtonCtrl').is(':checked') + + }).fail(function () { + $('#keyboardButtonKeys')[0].value = text + $('#keyboardButtonKeys')[0].value; + }); + } + }; + + init(); + }; + + var UserPageHandler = function () { + var init = function () { + //pageLoadHandler for displayProfile + $(document).on('pagebeforeshow', '#displayProfile', pagebeforeshowDisplayProfile); + + //pageLoadHandler for selectProfile + $(document).on('pagebeforeshow', '#selectProfile', pagebeforeshowSelectProfile); + + //pageLoadHandler for selectUserAdmin + $(document).on('pagebeforeshow', '#selectUserAdmin', pagebeforeshowSelectUserAdmin); + + //pageLoadHandler for displayUserAdmin + $(document).on('pagebeforeshow', '#displayUserAdmin', pagebeforeshowDisplayUserAdmin); + }; + + var pagebeforeshowDisplayProfile = function () { + if (pageHandler.profileIdRequest >= 0) { + var promise = request({ + url: "getProfile?profileId=" + pageHandler.profileIdRequest + }).done(function (result) { + handleDisplayProfileData(result); + + $('#playerSaveButton').click(function () { + var dataToUpload = {}; + + dataToUpload["ProfileId"] = pageHandler.profileIdRequest; + dataToUpload["PlayerName"] = $('#playerName').prop("value"); + dataToUpload["Type"] = $('#playerType').prop("value"); + dataToUpload["Difficulty"] = $('#playerDifficulty').prop("value"); + dataToUpload["Avatar"] = $('#playerAvatar').data("changed") ? { "base64Data": $('#playerAvatar').prop("src") } : null; + + var pass = $('#playerPassword').prop("value"); + if (pass != "***__oldPassword__***") { + if (pass == "") { + dataToUpload["Password"] = "***__CLEAR_PASSWORD__***"; + } else { + dataToUpload["Password"] = pass; + } + } else { + dataToUpload["Password"] = null; + } + + request({ + url: "sendProfile", + contentType: "application/json;charset=utf-8", + type: "POST", + data: JSON.stringify(dataToUpload), + }, "Uploading profile...").done(function () { + history.back(); + }); + + }); + }); + + // Save promise on page so the transition handler can find it. + $(this).data('promise', promise); + } else { + //new profile + handleDisplayProfileData({ + "Avatar": { "base64Data": null }, + "Difficulty": 0, + "IsEditable": true, + "PlayerName": i18n.t("YourName") || "YourName", + "ProfileId": -1, + "Type": 1 + }); + $('#playerType').prop("value", 0); + $('#playerDifficulty').prop("value", 0); + + $('#playerSaveButton').click(function () { + var dataToUpload = {}; + + dataToUpload["ProfileId"] = -1; + dataToUpload["PlayerName"] = $('#playerName').prop("value"); + dataToUpload["Type"] = $('#playerType').prop("value"); + dataToUpload["Difficulty"] = $('#playerDifficulty').prop("value"); + dataToUpload["Avatar"] = $('#playerAvatar').data("changed") ? { "base64Data": $('#playerAvatar').prop("src") } : null; + + var pass = $('#playerPassword').prop("value"); + if (pass != "***__oldPassword__***") { + if (pass == "") { + dataToUpload["Password"] = "***__CLEAR_PASSWORD__***"; + } else { + dataToUpload["Password"] = pass; + } + } else { + dataToUpload["Password"] = null; + } + + request({ + url: "sendProfile", + contentType: "application/json;charset=utf-8", + type: "POST", + data: JSON.stringify(dataToUpload) + }, 'Creating profile...').done(function () { + $.mobile.changePage("#login", { transition: "slidefade" }); + }); + + }); + } + }; + + var handleDisplayProfileData = function (data) { + $('#playerName').prop("value", data.PlayerName); + + imageLoader.addImage($('#playerAvatar')[0], data.Avatar, "img/profile.png"); + + $('#playerAvatar').data("changed", false); + $('#playerType').prop("selectedIndex", data.Type).selectmenu("refresh"); + $('#playerDifficulty').prop("selectedIndex", data.Difficulty).selectmenu("refresh"); + if (data.IsEditable) { + $('#playerName').prop('disabled', false); + $('#playerType').prop('disabled', false); + $('#playerDifficulty').prop('disabled', false); + $('#playerSaveButton').show().unbind("click"); + $('#playerAvatar').unbind("click"); + $('#playerPassword').prop('disabled', false).prop("value", "***__oldPassword__***").parent().show(); + $('#playerPasswordLabel').show(); + + $('#playerAvatar').click(function () { + if ($('#captureContainer').length > 0) { + $('#captureContainer').remove(); + } + + if (document.location.protocol == "file:" + && typeof (navigator) != 'undefined' + && typeof (navigator.camera) != 'undefined' + && typeof (navigator.camera.getPicture) != 'undefined') { + navigator.camera.getPicture(function (imageData) { + $('#playerAvatar').prop("src", "data:image/jpeg;base64," + imageData); + $('#playerAvatar').data("changed", true); + }, function () { + //Fail - do nothing + }, { + destinationType: navigator.camera.DestinationType.DATA_URL, + allowEdit: true, + correctOrientation: true, + saveToPhotoAlbum: true, + quality: 50 + }); + + } else { + $(document.body).append('
    '); + + $('#capture').change(function (eventData) { + if (eventData && eventData.target && eventData.target.files && eventData.target.files.length == 1) { + var file = eventData.target.files[0]; + var reader = new FileReader(); + reader.onloadend = function (e) { + $('#playerAvatar').prop("src", e.target.result); + $('#playerAvatar').data("changed", true); + $('#captureContainer').remove(); + }; + reader.readAsDataURL(file); + } + }); + + $('#capture').click(); + } + }); + } else { + $('#playerName').prop('disabled', true); + $('#playerType').prop('disabled', true); + $('#playerDifficulty').prop('disabled', true); + $('#playerSaveButton').hide().unbind("click"); + $('#playerAvatar').unbind("click"); + $('#playerPassword').prop('disabled', true).parent().hide(); + $('#playerPasswordLabel').hide(); + } + }; + + var pagebeforeshowSelectProfile = function () { + var promise = request({ + url: "getProfileList" + }).done(function (data) { + $('#selectProfileList').children().remove(); + + function handleProfileSelectLineClick(e) { + pageHandler.profileIdRequest = parseInt(e.currentTarget.id.replace("ProfileSelectLine_", "")); + $.mobile.changePage("#displayProfile", { transition: "slidefade" }); + } + + for (var profile in data) { + var img = $('
  • ' + data[profile].PlayerName + '

    Click here to show the profile of ' + data[profile].PlayerName + '

  • ') + .appendTo('#selectProfileList') + .click(handleProfileSelectLineClick) + .find("img")[0]; + + imageLoader.addImage(img, data[profile].Avatar, "img/profile.png"); + } + + $('#selectProfileList').listview('refresh'); + }); + + // Save promise on page so the transition handler can find it. + $(this).data('promise', promise); + }; + + var pagebeforeshowSelectUserAdmin = function () { + var promise = request({ + url: "getProfileList" + }).done(function (data) { + $('#selectUserAdminList').children().remove(); + + function handleSelectUserAdminLineClick(e) { + pageHandler.profileIdRequest = parseInt(e.currentTarget.id.replace("SelectUserAdminLine_", "")); + $.mobile.changePage("#displayUserAdmin", { transition: "slidefade" }); + } + + for (var profile in data) { + $('
  • ' + data[profile].PlayerName + '

    Click here to edit roles for ' + data[profile].PlayerName + '

  • ') + .appendTo('#selectUserAdminList') + .click(handleSelectUserAdminLineClick); + } + + $('#selectUserAdminList').listview('refresh'); + }); + + // Save promise on page so the transition handler can find it. + $(this).data('promise', promise); + }; + + var pagebeforeshowDisplayUserAdmin = function () { + var promise = request({ + url: "getUserRole?profileId=" + pageHandler.profileIdRequest + }).done(function (result) { + var userRoles = { + TR_USERROLE_ADMIN: 2, + TR_USERROLE_KEYBOARDUSER: 4, + TR_USERROLE_ADDSONGSUSER: 8, + TR_USERROLE_PLAYLISTEDITOR: 16, + TR_USERROLE_PROFILEEDITOR: 32 + }; + + for (var roleName in userRoles) { + $('#' + roleName).prop("checked", ((result & userRoles[roleName]) != 0)).checkboxradio("refresh"); + } + + + $('#btnRoleSave').unbind('click').click(function () { + var role = 0; + + for (var roleName2 in userRoles) { + if ($('#' + roleName2).prop("checked")) { + role = (role | userRoles[roleName2]); + } + } + + request({ + url: "setUserRole?profileId=" + pageHandler.profileIdRequest + "&userRole=" + role, + headers: { "session": sessionHandler.sessionId } + }, "Saving...").done(function (result) { + history.back(); + }); + }); + }); + + // Save promise on page so the transition handler can find it. + $(this).data('promise', promise); + }; + + init(); + }; + } + + function SongPageHandler() { + var allSongsCache = null; + + var init = function () { + //pageLoadHandler for displaySong + $(document).on('pagebeforeshow', '#displaySong', pagebeforeshowDisplaySong); + + //pageLoadHandler for selectSong + $(document).on('pagebeforeshow', '#selectSong', pagebeforeshowSelectSong); + }; + + var pagebeforeshowDisplaySong = function () { + var promise = request({ + url: "getSong?songId=" + pageHandler.songIdRequest + }).done(function (result) { + $('#displaySongAddPlaylist').hide(); + + if (result.Title != null) { + $('#displaySongTitle').text(result.Title); + } else { + $('#displaySongTitle').text("No current song"); + } + + imageLoader.addImage($('#displaySongCover')[0], result.Cover, "img/noCover.png"); + + if (result.Artist != null) { + $('#displaySongArtist').text(result.Artist); + } else { + $('#displaySongArtist').text("-"); + } + + if (result.Genre != null) { + $('#displaySongGenre').text(result.Genre); + } else { + $('#displaySongGenre').text("-"); + } + + if (result.Year != null && result.Year != "") { + $('#displaySongYear').text(result.Year); + } else { + $('#displaySongYear').text("-"); + } + + if (result.Language != null) { + $('#displaySongLanguage').text(result.Language); + } else { + $('#displaySongLanguage').text("-"); + } + + $('#displaySongIsDuet').text(result.IsDuet ? "Yes" : "No"); + + if (result.Title != null || result.Artist != null) { + $('#displaySongLinks').show(); + + $('#displaySongAddPlaylist').unbind('click').click(function () { + pageHandler.customSelectPlaylistSongCallback = function (playlistId) { + request({ url: "addSongToPlaylist?songId=" + result.SongId + "&playlistId=" + playlistId + "&duplicates=false" }, "Add to playlist..."); + history.back(); + }; + $.mobile.changePage("#selectPlaylist", { transition: "slidefade" }); + }); + + $('#displaySongLinkYoutube').unbind('click').click(function () { + externalServices.showYoutube(result.Artist, result.Title); + }); + + $('#displaySongLinkSpotify').unbind('click').click(function () { + externalServices.showSpotify(result.Artist, result.Title); + }); + + $('#displaySongLinkWikipedia').unbind('click').click(function () { + externalServices.showWikipedia(result.Artist); + }); + } else { + $('#displaySongLinks').hide(); } request({ - url: "setUserRole?profileId=" + profileIdRequest + "&userRole=" + role, - headers: { "session": sessionId } - }, "Saving...").done(function (result) { - history.back(); + url: "hasUserRight?right=" + 32 + }).done(function (result2) { + if (result2) { + $('#displaySongAddPlaylist').show(); + } else { + $('#displaySongAddPlaylist').hide(); + } }); }); - }); - // Save promise on page so the transition handler can find it. - $(this).data('promise', promise); - }); + // Save promise on page so the transition handler can find it. + $(this).data('promise', promise); + }; - //pageLoadHandler for login - $(document).on('pagebeforeshow', '#login', pagebeforeshowLogin); + var pagebeforeshowSelectSong = function () { - //pageLoadHandler for main - $(document).on('pagebeforeshow', '#main', function () { - request({ - url: "hasUserRight?right=" + 2 - }).done(function (result) { - if (result) { - $('#mainPageTakePhotoLink').parent().parent().parent().show(); - } else { - $('#mainPageTakePhotoLink').parent().parent().parent().hide(); - } - }); + function handleGetAllSongs() { + $('#selectSongList').children().remove(); - request({ - url: "hasUserRight?right=" + 8 - }).done(function (result) { - if (result) { - $('#mainPageKeyboard').parent().parent().parent().show(); - } else { - $('#mainPageKeyboard').parent().parent().parent().hide(); - } - }); - - request({ - url: "hasUserRight?right=" + 4 - }).done(function (result) { - if (result) { - $('#mainPageSelectProfile').parent().parent().parent().show(); - } else { - $('#mainPageSelectProfile').parent().parent().parent().hide(); - } - }); - }); - - //pageLoadHandler for selectPlaylist - $(document).on('pagebeforeshow', '#selectPlaylist', function () { - function handleGetAllPlaylists(data) { - $('#selectPlaylistContentList').children().remove(); - $('#selectPlaylistAddPlaylistButton').hide(); - - function handleSelectSongLineClick(e) { - playlistIdRequest = parseInt(e.currentTarget.parentElement.parentElement.parentElement.id.replace("selectPlaylistLine_", "")); - playlistRequestName = $(e.currentTarget.parentElement.parentElement.parentElement).find('h2').text(); - if (customSelectPlaylistSongCallback != null) { - customSelectPlaylistSongCallback(playlistIdRequest, playlistRequestName); - customSelectPlaylistSongCallback = null; - } else { - - $.mobile.changePage("#displayPlaylist", { transition: "slidefade" }); + function handleSelectSongLineClick(e) { + pageHandler.songIdRequest = parseInt(e.currentTarget.id.replace("selectSongLine_", "")); + $.mobile.changePage("#displaySong", { transition: "slidefade" }); } + + for (var id in allSongsCache) { + $('
  • '/*+' '*/ + '

    ' + allSongsCache[id].Artist + '

    ' + allSongsCache[id].Title + '

  • ') + .appendTo('#selectSongList') + .click(handleSelectSongLineClick); + } + + $('#selectSongList').listview('refresh'); } - function handleSelectSongLineDeleteClick(e) { - var playlistToDeleteId = parseInt(e.currentTarget.parentElement.id.replace("selectPlaylistLine_", "")); - var playlistToDeleteName = $(e.currentTarget.parentElement).find('h2').text(); - if (window.confirm("Do you really want to delete this playlist:\n" + playlistToDeleteName)) { - request({ url: "removePlaylist?playlistId=" + playlistToDeleteId }, "Loading...").done(function () { - request({ - url: "getPlaylists" - }).done(function (data2) { - handleGetAllPlaylists(data2); + if (allSongsCache == null) { + var promise = request({ + url: "getAllSongs" + }).done(function (data) { + allSongsCache = data; + handleGetAllSongs(); + }); + + // Save promise on page so the transition handler can find it. + $(this).data('promise', promise); + } else { + handleGetAllSongs(); + } + }; + + init(); + } + + function PlaylistPageHandler() { + var playlistIdRequest = -1; + var playlistRequestName = ""; + + var init = function () { + //pageLoadHandler for selectPlaylist + $(document).on('pagebeforeshow', '#selectPlaylist', pagebeforeshowSelectPlaylist); + + //pageLoadHandler for displayPlaylist + $(document).on('pagebeforeshow', '#displayPlaylist', pagebeforeshowDisplayPlaylist); + }; + + var pagebeforeshowSelectPlaylist = function () { + + function handleGetAllPlaylists(data) { + $('#selectPlaylistContentList').children().remove(); + $('#selectPlaylistAddPlaylistButton').hide(); + + function handleSelectSongLineClick(e) { + playlistIdRequest = parseInt(e.currentTarget.parentElement.parentElement.parentElement.id.replace("selectPlaylistLine_", "")); + playlistRequestName = $(e.currentTarget.parentElement.parentElement.parentElement).find('h2').text(); + if (pageHandler.customSelectPlaylistSongCallback != null) { + pageHandler.customSelectPlaylistSongCallback(playlistIdRequest, playlistRequestName); + pageHandler.customSelectPlaylistSongCallback = null; + } else { + + $.mobile.changePage("#displayPlaylist", { transition: "slidefade" }); + } + } + + function handleSelectSongLineDeleteClick(e) { + var playlistToDeleteId = parseInt(e.currentTarget.parentElement.id.replace("selectPlaylistLine_", "")); + var playlistToDeleteName = $(e.currentTarget.parentElement).find('h2').text(); + if (window.confirm("Do you really want to delete this playlist:\n" + playlistToDeleteName)) { + request({ url: "removePlaylist?playlistId=" + playlistToDeleteId }, "Loading...").done(function () { + request({ + url: "getPlaylists" + }).done(function (data2) { + handleGetAllPlaylists(data2); + }); }); - }); + } } - } - for (var id in data) { - var line = $('
  • '/*+' '*/ - + '

    ' + data[id].PlaylistName + '

    ' - + data[id].SongCount - + ' ' + i18n.t('songs') + '

    Delete
  • ') - .appendTo('#selectPlaylistContentList'); - line.find('a:not(.delete)').click(handleSelectSongLineClick); - line.find('a.delete').click(handleSelectSongLineDeleteClick); - } - - $('#selectPlaylistContentList').listview('refresh'); - - request({ - url: "hasUserRight?right=" + 128 - }).done(function (result) { - if (result) { - $('#selectPlaylistContentList').find('.delete').show(); - $('#selectPlaylistContentList').listview('refresh'); - } else { - $('#selectPlaylistContentList').find('.delete').hide(); - $('#selectPlaylistContentList').listview('refresh'); + for (var id in data) { + var line = $('
  • '/*+' '*/ + + '

    ' + data[id].PlaylistName + '

    ' + + data[id].SongCount + + ' ' + i18n.t('songs') + '

    Delete
  • ') + .appendTo('#selectPlaylistContentList'); + line.find('a:not(.delete)').click(handleSelectSongLineClick); + line.find('a.delete').click(handleSelectSongLineDeleteClick); } - }); - $('#selectPlaylistAddPlaylistButton').unbind('click').hide().click(function () { - var name = prompt("Name of the new playlist:", "NewPlaylistName"); - if (name != null - && name.replace(" ", "") != "" - && $('h2').filter(function () { return this.textContent == name; }).length == 0) { - request({ url: "addPlaylist?playlistName=" + name }, "Creating...").done(function () { - request({ - url: "getPlaylists" - }).done(function (data2) { - handleGetAllPlaylists(data2); - }); - }); - } else { - alert(i18n.t("This is not a valid name.")); - } - }); + $('#selectPlaylistContentList').listview('refresh'); - request({ - url: "hasUserRight?right=" + 64 - }).done(function (result) { - if (result) { - $('#selectPlaylistAddPlaylistButton').show(); - } else { - $('#selectPlaylistAddPlaylistButton').hide(); - } - }); - } - - var promise = request({ - url: "getPlaylists" - }).done(function (data) { - handleGetAllPlaylists(data); - }); - - // Save promise on page so the transition handler can find it. - $(this).data('promise', promise); - - }); - - //pageLoadHandler for displayPlaylist - $(document).on('pagebeforeshow', '#displayPlaylist', function () { - function handleGetAllPlaylistSongs(data) { - $('#displayPlaylistHeader').find('h1').text(playlistRequestName); - - $('#displayPlaylistSaveButton').hide().unbind('click').click(function () { - var promises = []; - $('#displayPlaylistContentList').find('li').each(function (indx, elem) { - var newPos = $(elem).index(); - var oldPos = $(elem).data("oldPos"); - if (newPos != oldPos) { - var movedId = elem.id.replace("selectSongLine_", ""); - - promises.push(request({ - url: "moveSongInPlaylist?&newPosition=" + newPos + "&playlistId=" + playlistIdRequest + "&songId=" + movedId - }, "Resorting...")); + request({ + url: "hasUserRight?right=" + 128 + }).done(function (result) { + if (result) { + $('#selectPlaylistContentList').find('.delete').show(); + $('#selectPlaylistContentList').listview('refresh'); + } else { + $('#selectPlaylistContentList').find('.delete').hide(); + $('#selectPlaylistContentList').listview('refresh'); } }); - $.when.apply(promises).done(function () { - //reload data - request({ - url: "getPlaylistSongs?playlistId=" + playlistIdRequest - }).done(function (data2) { - handleGetAllPlaylistSongs(data2); - }); + $('#selectPlaylistAddPlaylistButton').unbind('click').hide().click(function () { + var name = prompt("Name of the new playlist:", "NewPlaylistName"); + if (name != null + && name.replace(" ", "") != "" + && $('h2').filter(function () { return this.textContent == name; }).length == 0) { + request({ url: "addPlaylist?playlistName=" + name }, "Creating...").done(function () { + request({ + url: "getPlaylists" + }).done(function (data2) { + handleGetAllPlaylists(data2); + }); + }); + } else { + alert(i18n.t("This is not a valid name.")); + } }); - }); - $('#displayPlaylistContentList').children().remove(); - - function handleSelectPlaylistSongLineClick(e) { - songIdRequest = parseInt(e.currentTarget.parentElement.parentElement.parentElement.id.replace("selectSongLine_", "")); - $.mobile.changePage("#displaySong", { transition: "slidefade" }); + request({ + url: "hasUserRight?right=" + 64 + }).done(function (result) { + if (result) { + $('#selectPlaylistAddPlaylistButton').show(); + } else { + $('#selectPlaylistAddPlaylistButton').hide(); + } + }); } - function handleSelectPlaylistSongLineDeleteClick(e) { - var songToDeleteId = parseInt(e.currentTarget.parentElement.id.replace("selectSongLine_", "")); - var songToDeleteName = $(e.currentTarget.parentElement).find('h2').text(); + var promise = request({ + url: "getPlaylists" + }).done(function (data) { + handleGetAllPlaylists(data); + }); - if (window.confirm("Do you really want to delete this song from playlist:\n" + songToDeleteName)) { - request({ - url: "/removeSongFromPlaylist?position=" + $('#selectSongLine_' + songToDeleteId).index() - + "&playlistId=" + playlistIdRequest - + "&songId=" + songToDeleteId - }, "Loading...").done(function () { + // Save promise on page so the transition handler can find it. + $(this).data('promise', promise); + + }; + + var pagebeforeshowDisplayPlaylist = function () { + + function handleGetAllPlaylistSongs(data) { + $('#displayPlaylistHeader').find('h1').text(playlistRequestName); + + $('#displayPlaylistSaveButton').hide().unbind('click').click(function () { + var promises = []; + $('#displayPlaylistContentList').find('li').each(function (indx, elem) { + var newPos = $(elem).index(); + var oldPos = $(elem).data("oldPos"); + if (newPos != oldPos) { + var movedId = elem.id.replace("selectSongLine_", ""); + + promises.push(request({ + url: "moveSongInPlaylist?&newPosition=" + newPos + "&playlistId=" + playlistIdRequest + "&songId=" + movedId + }, "Resorting...")); + } + }); + + $.when.apply(promises).done(function () { //reload data request({ url: "getPlaylistSongs?playlistId=" + playlistIdRequest @@ -630,659 +1280,167 @@ function initPageLoadHandler() { handleGetAllPlaylistSongs(data2); }); }); + }); + + $('#displayPlaylistContentList').children().remove(); + + function handleSelectPlaylistSongLineClick(e) { + pageHandler.songIdRequest = parseInt(e.currentTarget.parentElement.parentElement.parentElement.id.replace("selectSongLine_", "")); + $.mobile.changePage("#displaySong", { transition: "slidefade" }); } + function handleSelectPlaylistSongLineDeleteClick(e) { + var songToDeleteId = parseInt(e.currentTarget.parentElement.id.replace("selectSongLine_", "")); + var songToDeleteName = $(e.currentTarget.parentElement).find('h2').text(); - } - - var sortedData = []; - - for (var id1 in data) { - sortedData[data[id1].PlaylistPosition] = data[id1].Song; - } - var i = 0; - for (var id in sortedData) { - var line = $('
  • ' - + sortedData[id].Artist - + '

    ' - + sortedData[id].Title - + '

    Delete
  • ') - .appendTo('#displayPlaylistContentList').data("oldPos", i++); - - line.find('a:not(.delete)').click(handleSelectPlaylistSongLineClick); - line.find('a.delete').click(handleSelectPlaylistSongLineDeleteClick); - - var img = line.find("img")[0]; - - addImage(img, sortedData[id].Cover, "img/noCover.png"); - } - - $('#displayPlaylistContentList').listview('refresh'); - - request({ - url: "hasUserRight?right=" + 256 - }).done(function (result) { - if (result) { - $('#displayPlaylistContentList').find('.delete').show(); - $('#displayPlaylistContentList').listview('refresh'); - } else { - $('#displayPlaylistContentList').find('.delete').hide(); - $('#displayPlaylistContentList').listview('refresh'); - } - }); - - request({ - url: "hasUserRight?right=" + 16 - }).done(function (result) { - if (result) { - $('#displayPlaylistContentList').sortable({ - axis: 'y', - sort: function () { - $('#displayPlaylistSaveButton').show(); - - var $lis = $(this).children('li'); - $lis.each(function () { - var $li = $(this); - var hindex = $lis.filter('.ui-sortable-helper').index(); - if (!$li.is('.ui-sortable-helper')) { - var index = $li.index(); - index = index < hindex ? index + 1 : index; - - $li.val(index); - - if ($li.is('.ui-sortable-placeholder')) { - $lis.filter('.ui-sortable-helper').val(index); - } - } + if (window.confirm("Do you really want to delete this song from playlist:\n" + songToDeleteName)) { + request({ + url: "/removeSongFromPlaylist?position=" + $('#selectSongLine_' + songToDeleteId).index() + + "&playlistId=" + playlistIdRequest + + "&songId=" + songToDeleteId + }, "Loading...").done(function () { + //reload data + request({ + url: "getPlaylistSongs?playlistId=" + playlistIdRequest + }).done(function (data2) { + handleGetAllPlaylistSongs(data2); }); - } - }); + }); + } + + } - }); - } - var promise = request({ - url: "getPlaylistSongs?playlistId=" + playlistIdRequest - }).done(function (data) { - handleGetAllPlaylistSongs(data); - }); + var sortedData = []; - // Save promise on page so the transition handler can find it. - $(this).data('promise', promise); + for (var id1 in data) { + sortedData[data[id1].PlaylistPosition] = data[id1].Song; + } + var i = 0; + for (var id in sortedData) { + var line = $('
  • ' + + sortedData[id].Artist + + '

    ' + + sortedData[id].Title + + '

    Delete
  • ') + .appendTo('#displayPlaylistContentList').data("oldPos", i++); - }); -} + line.find('a:not(.delete)').click(handleSelectPlaylistSongLineClick); + line.find('a.delete').click(handleSelectPlaylistSongLineDeleteClick); -function pagebeforeshowLogin() { - if (window.localStorage) { - var value = window.localStorage.getItem("VocaluxeSessionKey"); - if (value != null && value != "") { - sessionId = value; - } - } + var img = line.find("img")[0]; - if (sessionId != "") { - if (ownProfileId != -1) { - $.mobile.changePage("#main", { transition: "slidefade" }); - } - else { - request({ - url: "getOwnProfileId", - headers: { "session": sessionId } - }, 'Login...').done(function (result) { - ownProfileId = result; - $.mobile.changePage("#main", { transition: "slidefade" }); - }); - } - } -} + imageLoader.addImage(img, sortedData[id].Cover, "img/noCover.png"); + } -function pagebeforeshowDiscover() { - if (document.location.protocol == "file:") { - if (window.localStorage) { - var address = window.localStorage.getItem("VocaluxeServerAddress"); - if (address != null) { - serverBaseAddress = ""; - var prom = request({ - url: address + "isServerOnline", - timeout: 10000 - }, "Checking...").done(function () { - serverBaseAddress = address; - window.localStorage.setItem("VocaluxeServerAddress", address); - $.mobile.changePage("#login", { transition: "none" }); - }).fail(function () { - if (typeof window.BarcodeScanner != "undefined") { - $('#discoverReadQr').show(); + $('#displayPlaylistContentList').listview('refresh'); + + request({ + url: "hasUserRight?right=" + 256 + }).done(function (result) { + if (result) { + $('#displayPlaylistContentList').find('.delete').show(); + $('#displayPlaylistContentList').listview('refresh'); + } else { + $('#displayPlaylistContentList').find('.delete').hide(); + $('#displayPlaylistContentList').listview('refresh'); } }); - $(this).data('promise', prom); + + request({ + url: "hasUserRight?right=" + 16 + }).done(function (result) { + if (result) { + $('#displayPlaylistContentList').sortable({ + axis: 'y', + sort: function () { + $('#displayPlaylistSaveButton').show(); + + var $lis = $(this).children('li'); + $lis.each(function () { + var $li = $(this); + var hindex = $lis.filter('.ui-sortable-helper').index(); + if (!$li.is('.ui-sortable-helper')) { + var index = $li.index(); + index = index < hindex ? index + 1 : index; + + $li.val(index); + + if ($li.is('.ui-sortable-placeholder')) { + $lis.filter('.ui-sortable-helper').val(index); + } + } + }); + } + }); + } + }); + } + + var promise = request({ + url: "getPlaylistSongs?playlistId=" + playlistIdRequest + }).done(function (data) { + handleGetAllPlaylistSongs(data); + }); + + // Save promise on page so the transition handler can find it. + $(this).data('promise', promise); + + }; + + init(); + } + + function SessionHandler() { + this.ownProfileId = -1; + this.sessionId = ""; + this.serverBaseAddress = ""; + + var t = this; + + var init = function () { + initHeartbeat(); + }; + + this.logout = function () { + t.ownProfileId = -1; + + t.sessionId = ""; + + pageHandler.reset(); + + if (window.localStorage) { + window.localStorage.setItem("VocaluxeSessionKey", ""); + } + $.mobile.changePage("#login", { transition: "slidefade" }); + }; + + + var checkSession = function () { + if (t.ownProfileId == -1 + && pageHandler.profileIdRequest == -1 + && ($.mobile.activePage.attr("id") == "displayProfile" || $.mobile.activePage.attr("id") == "login" || $.mobile.activePage.attr("id") == "discover")) { return; } - if (typeof window.BarcodeScanner != "undefined") { - $('#discoverReadQr').show(); - } - } - } else { - $('#discoverReadQr').hide(); - $.mobile.changePage("#login", { transition: "none" }); - } -} - -function initLoginPageHandler() { - var keyPressed = function (e) { - if (e.which == 13) { - $('#loginButton').click(); - } - }; - - $('#loginName').keypress(keyPressed); - $('#loginPassword').keypress(keyPressed); - - $('#loginButton').click(function () { - var username = $('#loginName').prop("value"); - var password = $('#loginPassword').prop("value"); - - request({ - url: "login?username=" + username + "&password=" + password - }).done(function (result) { - sessionId = result; - if (window.localStorage) { - window.localStorage.setItem("VocaluxeSessionKey", sessionId); - } request({ - url: "getOwnProfileId", - headers: { "session": sessionId } - }, 'Login...').done(function (result2) { - ownProfileId = result2; - $.mobile.changePage("#main", { transition: "slidefade" }); - }); - }); - }); - - $('#registerButton').click(function () { - ownProfileId = -1; - profileIdRequest = -1; - $.mobile.changePage("#displayProfile", { transition: "slidefade" }); - }); - - //Fire pageLoadHandler for login - //pagebeforeshowLogin(); -} - -function initMainPageHandler() { - $('#yourProfileLink').click(function () { - profileIdRequest = ownProfileId; - $.mobile.changePage("#displayProfile", { transition: "slidefade" }); - }); - - $('#currentSongLink').click(function () { - request({ - url: "getCurrentSongId", - headers: { "session": sessionId } - }, 'Getting current song...').done(function (result) { - songIdRequest = parseInt(result); - $.mobile.changePage("#displaySong", { transition: "slidefade" }); - }); - }); - - function uploadImg(imgData) { - request({ - url: "sendPhoto", - contentType: "application/json;charset=utf-8", - type: "POST", - data: JSON.stringify({ Photo: { base64Data: imgData } }) - }, 'Uploading photo...'); - } - - $('#mainPageTakePhotoLink').click(function () { - if ($('#captureContainer').length > 0) { - $('#captureContainer').remove(); - } - - if (document.location.protocol == "file:" - && typeof (navigator) != 'undefined' - && typeof (navigator.camera) != 'undefined' - && typeof (navigator.camera.getPicture) != 'undefined') { - navigator.camera.getPicture(function (imageData) { - uploadImg("data:image/jpeg;base64," + imageData); - }, function () { - //Fail - do nothing - }, { - destinationType: navigator.camera.DestinationType.DATA_URL, - allowEdit: true, - correctOrientation: true, - saveToPhotoAlbum: true, - quality: 100 - }); - - } else { - $(document.body).append('
    '); - - $('#capture').change(function (eventData) { - if (eventData && eventData.target && eventData.target.files && eventData.target.files.length == 1) { - var file = eventData.target.files[0]; - var reader = new FileReader(); - - reader.onloadend = function (e) { - uploadImg(e.target.result); - $('#capture').remove(); - }; - - reader.readAsDataURL(file); + url: "getOwnProfileId" + }, "noOverlay").done(function (result) { + if (result == -1) { + t.logout(); } + }).fail(function (result) { + t.logout(); }); - - $('#capture').click(); - } - }); - - $('#mainPageLogoutLink').click(function () { - logout(); - }); -} - -function initKeyboardPageHandler() { - $('#keyboardButtonUp').click(function () { - request({ - url: "sendKeyEvent?key=up" - }); - }); - - $('#keyboardButtonDown').click(function () { - request({ - url: "sendKeyEvent?key=down" - }); - }); - - $('#keyboardButtonLeft').click(function () { - request({ - url: "sendKeyEvent?key=left" - }); - }); - - $('#keyboardButtonRight').click(function () { - request({ - url: "sendKeyEvent?key=right" - }); - }); - - $('#keyboardButtonEscape').click(function () { - request({ - url: "sendKeyEvent?key=escape" - }); - }); - - $('#keyboardButtonTab').click(function () { - request({ - url: "sendKeyEvent?key=tab" - }); - }); - - $('#keyboardButtonReturn').click(function () { - request({ - url: "sendKeyEvent?key=return" - }); - }); - - $('#keyboardButtonP').click(function () { - request({ - url: "sendKeyEvent?key=p" - }); - }); - - $('#keyboardButtonKeys').keyup(function (e) { - var c = String.fromCharCode(e.keyCode); - if (c.match(/\w/)) { - c = e.keyCode >= 65 ? c.toLowerCase() : c; - request({ - url: "sendKeyEvent?key=" + c - }); - } - var oldText = $('#keyboardButtonKeys')[0].value; - if (oldText.length > 0) { - $('#keyboardButtonKeys')[0].value = oldText.slice(1); - } - }); -} - -function initDiscoverPageHandler() { - var keyPressed = function (e) { - if (e.which == 13) { - $('#discoverConnect').click(); - } - }; - - $('#discoverServerAddress').keypress(keyPressed); - - function handleAddress(address) { - if (address != null && address != "") { - if (address.indexOf("http") != 0) { - address = "http://" + address; - } - if (address.slice(-1) != '/') { - address = address + '/'; - } - serverBaseAddress = ""; - request({ - url: address + "isServerOnline", - timeout: 10000 - }, "Checking...") - .done(function () { - serverBaseAddress = address; - window.localStorage.setItem("VocaluxeServerAddress", address); - $.mobile.changePage("#login", { transition: "slidefade" }); - }) - .fail(function () { - $('#discoverServerAddress').prop("value", ""); - if (document.location.protocol == "file:" - && typeof window.BarcodeScanner != "undefined") { - $('#discoverReadQr').show(); - } - }); - } - } - - $('#discoverConnect').click(function () { - handleAddress($('#discoverServerAddress').prop("value")); - }); - - try { - window.BarcodeScanner = cordova.require("cordova/plugin/BarcodeScanner"); - } catch (e) { } - - $('#discoverReadQr').hide().click(function () { - window.BarcodeScanner.scan( - function (result) { - handleAddress(result.text); - }, - function () { - showError("Scan faild"); - } - ); - }); - - //Fire pageLoadHandler for discover (first page shown after start) - setTimeout(function () { - pagebeforeshowDiscover(); - $(this).removeData('promise'); - }, 1); -} - -var cachedImages = {}; - -function delayedImageLoad(elem, id, fail) { - if (elem && id) { - if (cachedImages[id]) { - elem.src = cachedImages[id].base64Data; - return; - } - - elem.src = ""; - $(elem).addClass("imageLoaderImg"); - request({ - url: "delayedImage?id=" + id - }).done(function (result) { - $(elem).removeClass("imageLoaderImg"); - elem.src = result.base64Data; - cachedImages[id] = result; - }).fail(function () { - $(elem).removeClass("imageLoaderImg"); - if (fail) { - elem.src = fail; - } - }); - } -} - -function addImage(img, base64Image, defaultImg) { - if (base64Image && (base64Image.base64Data || base64Image.imageId)) { - if (base64Image.base64Data) { - $(img).prop("src", base64Image.base64Data); - } - else { - delayedImageLoad(img, base64Image.imageId, defaultImg); - } - } - else { - $(img).prop("src", defaultImg); - } -} - -function logout() { - ownProfileId = -1; - profileIdRequest = -1; - songIdRequest = -1; - sessionId = ""; - if (window.localStorage) { - window.localStorage.setItem("VocaluxeSessionKey", ""); - } - $.mobile.changePage("#login", { transition: "slidefade" }); -} - -function checkSession() { - if (ownProfileId == -1 - && profileIdRequest == -1 - && ($.mobile.activePage.attr("id") == "displayProfile" || $.mobile.activePage.attr("id") == "login" || $.mobile.activePage.attr("id") == "discover")) { - return; - } - request({ - url: "getOwnProfileId" - }, "noOverlay").done(function (result) { - if (result == -1) { - logout(); - } - }).fail(function (result) { - logout(); - }); -} - -function initHeartbeat() { - setInterval(checkSession, 20000); -} - -function request(data, message) { - if ((typeof message) == "undefined" || message == null) { - message = "Loading..."; - } - - if ((typeof data.timeout) == "undefined") { - data.timeout = 10000; //10 sec. timeout - } - - if (message != "noOverlay") { - var message2 = message; - if (i18n.t) { - message2 = i18n.t(message2); - } - $('div[data-role="content"]').wrap('
    '); - $.mobile.loading('show', { - text: message2, - textVisible: true - }); - } - - if (!data["headers"]) { - data["headers"] = {}; - } - - if (message == "external") { - message = "Loading (external)..."; - if (i18n.t) { - message = i18n.t(message) || message; - } - } else { - data["headers"]["session"] = sessionId; - data.url = serverBaseAddress + data.url; - } - - return $.ajax(data).always(function (result) { - if (message != "noOverlay") { - $.mobile.loading('hide'); - $('div[data-role="content"]').unwrap(); - } - }).fail(function (result) { - if (result.statusText.indexOf("No session") != -1) { - logout(); - return; - } - if (message != "noOverlay") { - var msg = result.statusText.length <= 20 ? result.statusText : "Error..."; - if (msg == "error" && result.readyState == 0) { - msg = "No connection"; - } - showError(msg); - } - }); -} - -function showError(message) { - if (!message) { - message = "Error..."; - } - - if (i18n.t) { - message = i18n.t(message) || message; - } - - $('div[data-role="content"]').wrap('
    '); - $.mobile.loading('show', { - text: message, - textVisible: true - }); - $('.ui-loader').find('span').removeClass('ui-icon-loading').addClass('ui-custom-errorIcon'); - - setTimeout(function () { - $.mobile.loading('hide'); - $('div[data-role="content"]').unwrap(); - $('.ui-loader').find('span').removeClass('ui-custom-errorIcon').addClass('ui-icon-loading'); - }, 1000); -} - -var popupVideoHeight = 390; -var popupVideoWidth = 640; -function initVideoPopup() { - function scale(width, height, padding, border) { - var scrWidth = $(window).width() - 30, - scrHeight = $(window).height() - 30, - ifrPadding = 2 * padding, - ifrBorder = 2 * border, - ifrWidth = width + ifrPadding + ifrBorder, - ifrHeight = height + ifrPadding + ifrBorder, - h, w; - - if (ifrWidth < scrWidth && ifrHeight < scrHeight) { - w = ifrWidth; - h = ifrHeight; - } else if ((ifrWidth / scrWidth) > (ifrHeight / scrHeight)) { - w = scrWidth; - h = (scrWidth / ifrWidth) * ifrHeight; - } else { - h = scrHeight; - w = (scrHeight / ifrHeight) * ifrWidth; - } - - return { - 'width': w - (ifrPadding + ifrBorder), - 'height': h - (ifrPadding + ifrBorder) }; - }; - $("#popupVideo").find("a").click(function () { - $("#popupVideo").popup("close"); - $("#popupVideo").popup("close"); //Sometimes twice?? - }); - $("#popupVideo iframe") - .attr("width", 0) - .attr("height", 0); + var initHeartbeat = function () { + setInterval(checkSession, 20000); + }; - $("#popupVideo").on({ - popupbeforeposition: function () { - var size = scale(popupVideoWidth, popupVideoHeight, 15, 1), - w = size.width, - h = size.height; + init(); + } - $("#popupVideo iframe") - .attr("width", w) - .attr("height", h); - }, - popupafterclose: function () { - $("#popupVideo iframe") - .attr("width", 0) - .attr("height", 0) - .attr("src", ""); - } - }); -}; - -function showYoutube(artist, title) { - request({ - url: "http://gdata.youtube.com/feeds/api/videos/-/Music?max-results=1&alt=json&format=5&q=" + artist + " " + title, - dataType: "json", - }, "external") - .done(function (result) { - if (result && result.feed && result.feed.entry && result.feed.entry.length > 0) { - var vidId = result.feed.entry[0].id.$t.replace("http://gdata.youtube.com/feeds/api/videos/", ""); - popupVideoHeight = 390; - popupVideoWidth = 640; - - $("#popupVideo iframe").attr("src", "http://www.youtube.com/embed/" + vidId + "?&autoplay=1&rel=0&showinfo=0&disablekb=1&autohide=1"); - $("#popupVideo").popup("open"); - } - }); -} - -function showSpotify(artist, title) { - request({ - url: "http://ws.spotify.com/search/1/track.json?q=" + title + "+artist:" + artist, - dataType: "json", - }, "external") - .done(function (result) { - if (result && result.tracks && result.tracks.length > 0) { - var spotId = result.tracks[0].href; - popupVideoHeight = 80; - popupVideoWidth = 300; - - $("#popupVideo iframe").attr("src", "https://embed.spotify.com/?uri=" + spotId); - $("#popupVideo").popup("open"); - } - }); -} - -function showWikipedia(artist) { - popupVideoHeight = 800; - popupVideoWidth = 600; - - $("#popupVideo iframe").attr("src", "http://m.wikipedia.org/wiki/Special:Search/" + artist); - $("#popupVideo").popup("open"); -} - -function initTranslation() { - - //repair broken buttons on the first page (get broken while translating) - var repairButtons = function () { - $($('#discoverConnect')[0].childNodes).wrap(' '); - $($('#discoverReadQr')[0].childNodes).wrap(' '); - }; - - $.i18n.init({ - resGetPath: 'locales/__lng__.json', - supportedLngs: ['en', 'de', 'fr', 'sv', 'cs'], - fallbackLng: 'en', - keyseparator: '::', - nsseparator: ':::' - }).done(function () { - translationLoaded.resolve(); - }); -} - -function translate() { - //repair broken buttons on the first page (get broken while translating) - var repairButtons = function () { - $($('#discoverConnect')[0].childNodes).wrap(' '); - $($('#discoverReadQr')[0].childNodes).wrap(' '); - }; - $('body').i18n(); - repairButtons(); -} + initMain(); +})(); \ No newline at end of file diff --git a/Vocaluxe/Website/locales/cs.json b/Vocaluxe/Website/locales/cs.json index 152a6b32..b35ca179 100644 --- a/Vocaluxe/Website/locales/cs.json +++ b/Vocaluxe/Website/locales/cs.json @@ -76,5 +76,11 @@ "discoverConnectServerAddress": "Adresa serveru:", "discoverConnectButton": "Připojit se", "Checking...": "Ověřuje se...", - "timeout": "Překročení časového omezení" + "timeout": "Překročení časového omezení", + "keyboardButtonShift": "Shift", + "keyboardButtonAlt": "Alt", + "keyboardButtonCtrl": "Control", + "keyboardButtonBackspace": "Backspace", + "keyboardAutoSend": "Auto send keys", + "keyboardButtonSend": "Send" } \ No newline at end of file diff --git a/Vocaluxe/Website/locales/de.json b/Vocaluxe/Website/locales/de.json index ddf85d71..4d9812c3 100644 --- a/Vocaluxe/Website/locales/de.json +++ b/Vocaluxe/Website/locales/de.json @@ -76,5 +76,11 @@ "discoverConnectServerAddress": "Serveradresse:", "discoverConnectButton": "Verbinden", "Checking...": "Prüfen...", - "timeout": "Zeitüberschreitung" + "timeout": "Zeitüberschreitung", + "keyboardButtonShift": "Shift", + "keyboardButtonAlt": "Alt", + "keyboardButtonCtrl": "Steuerung", + "keyboardButtonBackspace": "Backspace", + "keyboardAutoSend": "Automatisch Tasten senden", + "keyboardButtonSend": "Senden" } \ No newline at end of file diff --git a/Vocaluxe/Website/locales/en.json b/Vocaluxe/Website/locales/en.json index c6b28fd0..308d01c1 100644 --- a/Vocaluxe/Website/locales/en.json +++ b/Vocaluxe/Website/locales/en.json @@ -76,5 +76,11 @@ "discoverConnectServerAddress": "Serveraddress:", "discoverConnectButton": "Connect", "Checking...": "Checking...", - "timeout": "Timeout" + "timeout": "Timeout", + "keyboardButtonShift": "Shift", + "keyboardButtonAlt": "Alt", + "keyboardButtonCtrl": "Control", + "keyboardButtonBackspace": "Backspace", + "keyboardAutoSend": "Auto send keys", + "keyboardButtonSend": "Send" } \ No newline at end of file diff --git a/Vocaluxe/Website/locales/es.json b/Vocaluxe/Website/locales/es.json index 35b38409..044e18fd 100644 --- a/Vocaluxe/Website/locales/es.json +++ b/Vocaluxe/Website/locales/es.json @@ -76,5 +76,11 @@ "discoverConnectServerAddress": "Dirección del servidor:", "discoverConnectButton": "Conectar", "Checking...": "Comprobando...", - "timeout": "Tiempo de espera" + "timeout": "Tiempo de espera", + "keyboardButtonShift": "Shift", + "keyboardButtonAlt": "Alt", + "keyboardButtonCtrl": "Control", + "keyboardButtonBackspace": "Backspace", + "keyboardAutoSend": "Auto send keys", + "keyboardButtonSend": "Send" } \ No newline at end of file diff --git a/Vocaluxe/Website/locales/fr.json b/Vocaluxe/Website/locales/fr.json index 3e89e528..4ab27121 100644 --- a/Vocaluxe/Website/locales/fr.json +++ b/Vocaluxe/Website/locales/fr.json @@ -17,7 +17,7 @@ "mainPageTakePhotoLink": "Prendre une photo", "mainPageTakePhotoLinkDesc": "Prends une photo et l'affiche à la fin de la partie actuelle", "mainPageKeyboard": "Clavier", - "mainPageKeyboardDesc": "Envoyer la clé", + "mainPageKeyboardDesc": "Envoyer les caractères", "mainPageSelectUserAdmin": "Administration", "mainPageSelectUserAdminDesc": "Configurer les droits administrateurs", "mainPageLogoutLink": "Se déconnecter", @@ -50,7 +50,7 @@ "keyboardButtonEscape": "echappe", "keyboardButtonTab": "tabulation", "keyboardButtonReturn": "Retour", - "keyboardButtonKeys": "Pour envoyer d'autres clé, taper ici :", + "keyboardButtonKeys": "Pour envoyer d'autres caractères, taper ici :", "selectUserAdminHeader": "Tous les profils", "displayUserAdminHeader": "Profil", "displayUserAdminContentSaveButton": "Sauvegarder", @@ -76,5 +76,11 @@ "discoverConnectServerAddress": "Adresse du serveur :", "discoverConnectButton": "Connecter", "Checking...": "Vérification", - "timeout": "Temps dépassé" + "timeout": "Temps dépassé", + "keyboardButtonShift": "Maj.", + "keyboardButtonAlt": "Alt", + "keyboardButtonCtrl": "Controle", + "keyboardButtonBackspace": "Retour", + "keyboardAutoSend": "Envoyer la saisie automatiquement", + "keyboardButtonSend": "Envoyer" } \ No newline at end of file diff --git a/Vocaluxe/Website/locales/it.json b/Vocaluxe/Website/locales/it.json index a757def3..c055b460 100644 --- a/Vocaluxe/Website/locales/it.json +++ b/Vocaluxe/Website/locales/it.json @@ -76,5 +76,11 @@ "discoverConnectServerAddress": "Indirizzo server:", "discoverConnectButton": "Connetti", "Checking...": "Controllo...", - "timeout": "Timeout" + "timeout": "Timeout", + "keyboardButtonShift": "Shift", + "keyboardButtonAlt": "Alt", + "keyboardButtonCtrl": "Control", + "keyboardButtonBackspace": "Backspace", + "keyboardAutoSend": "Auto send keys", + "keyboardButtonSend": "Send" } \ No newline at end of file diff --git a/Vocaluxe/Website/locales/sv.json b/Vocaluxe/Website/locales/sv.json index 1a67d61b..dafc5bcc 100644 --- a/Vocaluxe/Website/locales/sv.json +++ b/Vocaluxe/Website/locales/sv.json @@ -76,5 +76,11 @@ "discoverConnectServerAddress": "serveradress:", "discoverConnectButton": "Anslut", "Checking...": "Kontrollerar...", - "timeout": "Timeout" + "timeout": "Timeout", + "keyboardButtonShift": "Shift", + "keyboardButtonAlt": "Alt", + "keyboardButtonCtrl": "Control", + "keyboardButtonBackspace": "Backspace", + "keyboardAutoSend": "Auto send keys", + "keyboardButtonSend": "Send" } \ No newline at end of file diff --git a/VocaluxeLib/CBasic.cs b/VocaluxeLib/CBasic.cs index 7a588ee1..c100ea7b 100644 --- a/VocaluxeLib/CBasic.cs +++ b/VocaluxeLib/CBasic.cs @@ -21,7 +21,7 @@ namespace VocaluxeLib { public static IConfig Config; public static ISettings Settings; - public static ITheme Theme; + public static IThemes Themes; public static ILog Log; public static IBackgroundMusic BackgroundMusic; public static IDrawing Drawing; @@ -39,13 +39,13 @@ namespace VocaluxeLib public static IControllers Controller; public static IPlaylist Playlist; - public static void Assign(IConfig config, ISettings settings, ITheme theme, ILog log, IBackgroundMusic backgroundMusic, + public static void Assign(IConfig config, ISettings settings, IThemes themes, ILog log, IBackgroundMusic backgroundMusic, IDrawing draw, IGraphics graphics, IFonts fonts, ILanguage language, IGame game, IProfiles profiles, IRecording record, ISongs songs, IVideo video, ISound sound, ICover cover, IDataBase dataBase, IControllers controller, IPlaylist playlist) { Config = config; Settings = settings; - Theme = theme; + Themes = themes; Log = log; BackgroundMusic = backgroundMusic; Drawing = draw; diff --git a/VocaluxeLib/CEncoding.cs b/VocaluxeLib/CEncoding.cs new file mode 100644 index 00000000..3afdfe49 --- /dev/null +++ b/VocaluxeLib/CEncoding.cs @@ -0,0 +1,56 @@ +#region license +// This file is part of Vocaluxe. +// +// Vocaluxe is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Vocaluxe is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with Vocaluxe. If not, see . +#endregion + +using System.Text; + +namespace VocaluxeLib +{ + static class CEncoding + { + public static Encoding GetEncoding(this string encodingName) + { + switch (encodingName) + { + case "AUTO": + return Encoding.Default; + case "CP1250": + return Encoding.GetEncoding(1250); + case "CP1252": + return Encoding.GetEncoding(1252); + case "LOCALE": + return Encoding.Default; + case "UTF8": + return Encoding.UTF8; + default: + return Encoding.Default; + } + } + + public static string GetEncodingName(this Encoding enc) + { + string result = "UTF8"; + + if (enc.CodePage == 1250) + result = "CP1250"; + + if (enc.CodePage == 1252) + result = "CP1252"; + + return result; + } + } +} \ No newline at end of file diff --git a/VocaluxeLib/CFont.cs b/VocaluxeLib/CFont.cs new file mode 100644 index 00000000..15df7ee1 --- /dev/null +++ b/VocaluxeLib/CFont.cs @@ -0,0 +1,120 @@ +#region license +// This file is part of Vocaluxe. +// +// Vocaluxe is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Vocaluxe is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with Vocaluxe. If not, see . +#endregion + +using System; +using System.Collections.Generic; + +namespace VocaluxeLib +{ + public interface IFontObserver + { + void FontChanged(); + } + + public struct SThemeFont + { + // ReSharper disable UnassignedField.Global + public string Name; + public EStyle Style; + public float Size; + // ReSharper restore UnassignedField.Global + } + + public class CFont + { + private string _Name; + private EStyle _Style; + private float _Height; + private readonly List _Observers = new List(); + + public string Name + { + get { return _Name; } + set + { + if (_Name == value) + return; + _Name = value; + foreach (IFontObserver observer in _Observers) + observer.FontChanged(); + } + } + public EStyle Style + { + get { return _Style; } + set + { + if (_Style == value) + return; + _Style = value; + foreach (IFontObserver observer in _Observers) + observer.FontChanged(); + } + } + public float Height + { + get { return _Height; } + set + { + if (Math.Abs(_Height - value) < 0.001) + return; + _Height = value; + foreach (IFontObserver observer in _Observers) + observer.FontChanged(); + } + } + + public CFont() + { + _Name = "Normal"; + _Style = EStyle.Normal; + _Height = 25f; + } + + public CFont(SThemeFont font) + { + _Name = font.Name; + _Style = font.Style; + _Height = font.Size; + } + + public CFont(CFont font) + { + _Name = font._Name; + _Style = font._Style; + _Height = font._Height; + } + + public CFont(string fontFamily, EStyle style, float h) + { + _Name = fontFamily; + _Style = style; + _Height = h; + } + + public void AddObserver(IFontObserver observer) + { + if (!_Observers.Contains(observer)) + _Observers.Add(observer); + } + + public void RemoveObserver(IFontObserver observer) + { + _Observers.Remove(observer); + } + } +} \ No newline at end of file diff --git a/VocaluxeLib/CHelper.cs b/VocaluxeLib/CHelper.cs index 411d39ec..6c143b59 100644 --- a/VocaluxeLib/CHelper.cs +++ b/VocaluxeLib/CHelper.cs @@ -17,11 +17,9 @@ using System; using System.Collections.Generic; -using System.Diagnostics; using System.Drawing; using System.Globalization; using System.IO; -using System.Text; namespace VocaluxeLib { @@ -64,46 +62,6 @@ namespace VocaluxeLib return (int)result; } - /// - /// Makes sure val is between min and max - /// Asserts that min<=max - /// - /// - /// - /// - /// - /// Clamped value - public static T Clamp(this T val, T min, T max) where T : IComparable - { - Debug.Assert(min.CompareTo(max) <= 0); - if (val.CompareTo(min) < 0) - return min; - if (val.CompareTo(max) > 0) - return max; - return val; - } - - /// - /// Makes sure val is between min and max but also handles the case where min>max - /// - /// - /// - /// - /// - /// - /// Clamped value - public static T Clamp(this T val, T min, T max, bool preferMin) where T : IComparable - { - if (min.CompareTo(max) > 0) - { - if (preferMin) - max = min; - else - min = max; - } - return Clamp(val, min, max); - } - /// /// Concat strings into one string with ", " as separator. /// @@ -120,66 +78,88 @@ namespace VocaluxeLib return result; } - public static void SetRect(SRectF bounds, out SRectF rect, float rectAspect, EAspect aspect) + /// + /// Places a rect within the bounds maintaining the aspectRatio and using the given aspect + /// + /// Bounds to fit the rect in + /// The original aspectRatio of the rect/image/... + /// + /// Crop: No empty space in bounds but has overhanging parts (same on both sides)
    + /// LetterBox: Fit the long side possibly leaving some space on the other (rect will be centered)
    + /// StretcH: Just fit the rect in the bounds (rect=bounds) + /// + public static SRectF FitInBounds(SRectF bounds, float aspectRatio, EAspect aspect) { - var bounds2 = new RectangleF(bounds.X, bounds.Y, bounds.W, bounds.H); - RectangleF rect2; - SetRect(bounds2, out rect2, rectAspect, aspect); + if (aspect == EAspect.Stretch) + return bounds; - rect = new SRectF(rect2.X, rect2.Y, rect2.Width, rect2.Height, bounds.Z); - } + float boundsAspectRatio = bounds.W / bounds.H; - public static void SetRect(RectangleF bounds, out RectangleF rect, float rectAspect, EAspect aspect) - { - float boundsW = bounds.Width; - float boundsH = bounds.Height; - float boundsAspect = boundsW / boundsH; - - float scaledWidth; - float scaledHeight; + float scaledWidth, scaledHeight; switch (aspect) { case EAspect.Crop: - if (boundsAspect >= rectAspect) + if (boundsAspectRatio >= aspectRatio) { - scaledWidth = boundsW; - scaledHeight = boundsW / rectAspect; + scaledWidth = bounds.W; + scaledHeight = bounds.W / aspectRatio; } else { - scaledHeight = boundsH; - scaledWidth = boundsH * rectAspect; + scaledHeight = bounds.H; + scaledWidth = bounds.H * aspectRatio; + } + break; + case EAspect.Zoom1: + if (boundsAspectRatio >= aspectRatio) + { + scaledWidth = bounds.W * 1.33f; + scaledHeight = bounds.W * 1.33f / aspectRatio; + } + else + { + scaledHeight = bounds.H / 1.33f; + scaledWidth = bounds.H / 1.33f * aspectRatio; + } + break; + case EAspect.Zoom2: + if (boundsAspectRatio >= aspectRatio) + { + scaledWidth = bounds.W * 1.17f; + scaledHeight = bounds.W * 1.17f / aspectRatio; + } + else + { + scaledHeight = bounds.H / 1.17f; + scaledWidth = bounds.H / 1.17f * aspectRatio; } break; case EAspect.LetterBox: - if (boundsAspect <= rectAspect) + if (boundsAspectRatio <= aspectRatio) { - scaledWidth = boundsW; - scaledHeight = boundsW / rectAspect; + scaledWidth = bounds.W; + scaledHeight = bounds.W / aspectRatio; } else { - scaledHeight = boundsH; - scaledWidth = boundsH * rectAspect; + scaledHeight = bounds.H; + scaledWidth = bounds.H * aspectRatio; } break; default: - scaledWidth = boundsW; - scaledHeight = boundsH; - break; + return bounds; } + float left = (bounds.W - scaledWidth) / 2 + bounds.X; + float top = (bounds.H - scaledHeight) / 2 + bounds.Y; - float left = (boundsW - scaledWidth) / 2 + bounds.Left; - float upper = (boundsH - scaledHeight) / 2 + bounds.Top; - - rect = new RectangleF(left, upper, scaledWidth, scaledHeight); + return new SRectF(left, top, scaledWidth, scaledHeight, bounds.Z); } /// /// Returns a list with all files in the given path that match a given pattern /// - /// Path to search for + /// Path to search /// Pattern to match (e.g. "*.jpg") /// Search directories recursively /// False for just file names, True for full path @@ -277,7 +257,7 @@ namespace VocaluxeLib public static bool IsInBounds(SRectF bounds, int x, int y) { - return (bounds.X <= x) && (bounds.X + bounds.W >= x) && (bounds.Y <= y) && (bounds.Y + bounds.H >= y); + return ((float)x).IsInRange(bounds.X, bounds.X + bounds.W) && ((float)y).IsInRange(bounds.Y, bounds.Y + bounds.H); } /// @@ -302,40 +282,35 @@ namespace VocaluxeLib filename = Path.Combine(path, filename); return filename + ext; } - } - static class CEncoding - { - public static Encoding GetEncoding(this string encodingName) + public static int Sum(int n) { - switch (encodingName) - { - case "AUTO": - return Encoding.Default; - case "CP1250": - return Encoding.GetEncoding(1250); - case "CP1252": - return Encoding.GetEncoding(1252); - case "LOCALE": - return Encoding.Default; - case "UTF8": - return Encoding.UTF8; - default: - return Encoding.Default; - } + return (n * n + n) / 2; } - public static string GetEncodingName(this Encoding enc) + /// + /// Loads a bitmap from a file logging errors + /// + /// Full path to image file + /// Bitmap or null on error + public static Bitmap LoadBitmap(string filePath) { - string result = "UTF8"; - - if (enc.CodePage == 1250) - result = "CP1250"; - - if (enc.CodePage == 1252) - result = "CP1252"; - - return result; + if (!File.Exists(filePath)) + { + CBase.Log.LogError("Can't find File: " + filePath); + return null; + } + Bitmap bmp; + try + { + bmp = new Bitmap(filePath); + } + catch (Exception) + { + CBase.Log.LogError("Error loading bitmap: " + filePath); + return null; + } + return bmp; } } } \ No newline at end of file diff --git a/VocaluxeLib/CVideoStream.cs b/VocaluxeLib/CVideoStream.cs new file mode 100644 index 00000000..9618aa52 --- /dev/null +++ b/VocaluxeLib/CVideoStream.cs @@ -0,0 +1,62 @@ +#region license +// This file is part of Vocaluxe. +// +// Vocaluxe is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Vocaluxe is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with Vocaluxe. If not, see . +#endregion + +using VocaluxeLib.Draw; + +namespace VocaluxeLib +{ + public class CVideoStream + { + public int ID { get; private set; } + public CTextureRef Texture; + /// The actual position in s of the returned frame. Should be ~ time+VideoGap + public float VideoTime; + + public CVideoStream(int id) + { + ID = id; + } + + ~CVideoStream() + { + if (ID >= 0) + { + CVideoStream tmp = this; + CBase.Video.Close(ref tmp); + } + } + + /// + /// Should only be used by video decoders
    + /// Set's this stream to closed state and frees the texture + ///
    + public void SetClosed() + { + ID = -1; + CBase.Drawing.RemoveTexture(ref Texture); + } + + /// + /// Returns true if the video stream is closed + /// + /// + public bool IsClosed() + { + return ID < 0; + } + } +} \ No newline at end of file diff --git a/VocaluxeLib/Draw/CTexture.cs b/VocaluxeLib/Draw/CTexture.cs deleted file mode 100644 index 76a03818..00000000 --- a/VocaluxeLib/Draw/CTexture.cs +++ /dev/null @@ -1,149 +0,0 @@ -#region license -// This file is part of Vocaluxe. -// -// Vocaluxe is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// Vocaluxe is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with Vocaluxe. If not, see . -#endregion - -using System.Drawing; - -namespace VocaluxeLib.Draw -{ - public class CTexture - { - public int ID = -1; - public int PBO; - //Only used by OpenGL (the texture "name" according to the specs) - public int Name = -1; - - public string TexturePath = ""; - - /// - /// Original size (e.g. of bmp) - /// - public readonly Size OrigSize; - public float OrigAspect - { - get { return (float)OrigSize.Width / OrigSize.Height; } - } - - /// - /// Current size when drawn - /// - public SRectF Rect; - - public SColorF Color = new SColorF(1f, 1f, 1f, 1f); - - private int _W2, _H2; - private readonly bool _UseFullTexture; - /// - /// Internal texture width (on device), a power of 2 if necessary - /// - public int W2 - { - get { return _W2; } - set - { - _W2 = value; - if (_UseFullTexture) - WidthRatio = 1; - else - WidthRatio = (float)OrigSize.Width / _W2; - } - } - /// - /// Internal texture height (on device), a power of 2 if necessary - /// - public int H2 - { - get { return _H2; } - set - { - _H2 = value; - if (_UseFullTexture) - HeightRatio = 1; - else - HeightRatio = (float)OrigSize.Height / _H2; - } - } - - /// - /// Internal use. Specifies which part of texture memory is actually used - /// - public float WidthRatio { get; private set; } - /// - /// Internal use. Specifies which part of texture memory is actually used - /// - public float HeightRatio { get; private set; } - - /// - /// Actual texture space used in x direction - /// - public int UsedWidth - { - get { return (int)(_W2 * WidthRatio); } - } - - /// - /// Actual texture space used in y direction - /// - public int UsedHeight - { - get { return (int)(_H2 * HeightRatio); } - } - - /* - /// - /// Internal use. Specifies if full texture memory should be used - /// Set to true if you resized the original image to the maximum - /// - public bool UseFullTexture - { - get { return _UseFullTexture; } - set - { - _UseFullTexture = value; - if (value) - { - WidthRatio = 1; - HeightRatio = 1; - } - else - { - WidthRatio = (float)OrigSize.Width / _W2; - HeightRatio = (float)OrigSize.Height / _H2; - } - } - } -*/ - - /// - /// Creates a new texture reference - /// - /// Original width (Bitmap size) - /// Original height (Bitmap size) - /// Width in video memory - /// Height in video memory - /// True if it is using the full size of the video memory (no blank parts due to Pow-2-Issue) - public CTexture(int origWidth, int origHeight, int texWidth = 0, int texHeight = 0, bool useFullTexture = false) - { - OrigSize = new Size(origWidth, origHeight); - Rect = new SRectF(0f, 0f, origWidth, origHeight, 0f); - _UseFullTexture = useFullTexture; - - //IMPORTANT: Use setter here to calculate ratios! - W2 = (texWidth > 0) ? texWidth : origWidth; - H2 = (texHeight > 0) ? texHeight : origHeight; - } - } -} \ No newline at end of file diff --git a/VocaluxeLib/Draw/CTextureRef.cs b/VocaluxeLib/Draw/CTextureRef.cs new file mode 100644 index 00000000..1f13444d --- /dev/null +++ b/VocaluxeLib/Draw/CTextureRef.cs @@ -0,0 +1,92 @@ +#region license +// This file is part of Vocaluxe. +// +// Vocaluxe is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Vocaluxe is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with Vocaluxe. If not, see . +#endregion + +using System; +using System.Drawing; + +namespace VocaluxeLib.Draw +{ + /// + /// Reference to a texture in the drawing driver + /// + public class CTextureRef : IDisposable + { + public int ID { get; private set; } + /// + /// Size of original image (e.g. of bmp) + /// + public Size OrigSize; + + public float OrigAspect + { + get { return (float)OrigSize.Width / OrigSize.Height; } + } + + /// + /// Current size when drawn + /// + public SRectF Rect; + + public SColorF Color = new SColorF(1f, 1f, 1f, 1f); + + /// + /// Creates a new texture reference + /// + /// ID of the texture + /// Original size (Bitmap size) + public CTextureRef(int id, Size origSize) + { + ID = id; + OrigSize = origSize; + + Rect = new SRectF(0f, 0f, origSize.Width, origSize.Height, 0f); + } + + ~CTextureRef() + { + Dispose(); + } + + public void Dispose() + { + if (ID >= 0) + { + //Free textures that are no longer referenced + CTextureRef tmp = this; + CBase.Drawing.RemoveTexture(ref tmp); + _SetRemoved(); + } + } + + /// + /// Call this from the graphics driver to denote that this reference is remove and no longer valid
    + /// This avoids the finalizer + ///
    + public void SetRemoved() + { + if (ID < 0) + throw new ObjectDisposedException(GetType().Name); + _SetRemoved(); + } + + private void _SetRemoved() + { + ID = -1; + GC.SuppressFinalize(this); + } + } +} \ No newline at end of file diff --git a/VocaluxeLib/Enums.cs b/VocaluxeLib/Enums.cs index 3c13e5cc..0b2d0d7d 100644 --- a/VocaluxeLib/Enums.cs +++ b/VocaluxeLib/Enums.cs @@ -19,6 +19,28 @@ using System; namespace VocaluxeLib { + public enum ECoverGeneratorType + { + Default, + Song, + Folder, + Artist, + Letter, + Edition, + Genre, + Language, + Year, + Decade, + Date + } + + public enum EDirection + { + Up = 0, + Right = 1, + Down = 2, + Left = 3 + } #region Inputs [Flags] @@ -43,7 +65,16 @@ namespace VocaluxeLib { Crop, LetterBox, - Stretch + Stretch, + Zoom1, + Zoom2 + } + + public enum EGeneralAlignment + { + Middle, + Start, + End } public enum EAlignment @@ -169,11 +200,10 @@ namespace VocaluxeLib public enum ESongMenu { // ReSharper disable InconsistentNaming - TR_CONFIG_LIST, //a simple list - //TR_CONFIG_DREIDEL, //as in ultrastar deluxe + TR_CONFIG_LIST, // list of covers and artist - title + //TR_CONFIG_DREIDEL, //as in ultrastar deluxe TR_CONFIG_TILE_BOARD, //chessboard like - //TR_CONFIG_LIST__AND_COVER // list of covers and artist - title - //TR_CONFIG_BOOK //for playlists + //TR_CONFIG_BOOK //for playlists // ReSharper restore InconsistentNaming } @@ -251,9 +281,11 @@ namespace VocaluxeLib public enum EBackgroundMusicOffOn { + // ReSharper disable InconsistentNaming TR_CONFIG_OFF, TR_CONFIG_ONLY_SONG, TR_CONFIG_ON + // ReSharper restore InconsistentNaming } public enum EPlayerInfo @@ -328,32 +360,44 @@ namespace VocaluxeLib Freestyle } - public enum EScreens + public enum EMusicType { - ScreenTest = 0, - ScreenLoad = 1, - ScreenMain = 2, - ScreenSong = 3, - ScreenOptions = 4, - ScreenSing = 5, - ScreenProfiles = 6, - ScreenScore = 7, - ScreenHighscore = 8, + None, + Background, + Preview, + Game + } - ScreenOptionsGame = 9, - ScreenOptionsSound = 10, - ScreenOptionsRecord = 11, - ScreenOptionsVideo = 12, - ScreenOptionsVideoAdjustments = 13, - ScreenOptionsLyrics = 14, - ScreenOptionsTheme = 15, + /// + /// Base screens + /// + public enum EScreen + { + Unknown = -1, - ScreenNames = 16, - ScreenCredits = 17, - ScreenParty = 18, - ScreenPartyDummy = 19, + Test, + Load, + Main, + Song, + Options, + Sing, + Profiles, + Score, + Highscore, - ScreenNull = -1 + OptionsGame, + OptionsSound, + OptionsRecord, + OptionsVideo, + OptionsVideoAdjustments, + OptionsLyrics, + OptionsTheme, + + Names, + Credits, + Party, + + CountEntry //Leave this as last entry and never use it! } public enum EPopupScreens diff --git a/VocaluxeLib/Extensions.cs b/VocaluxeLib/Extensions.cs index f04d5f40..12f06137 100644 --- a/VocaluxeLib/Extensions.cs +++ b/VocaluxeLib/Extensions.cs @@ -17,13 +17,71 @@ using System; using System.Collections.Generic; +using System.Diagnostics; +using System.Drawing; +using System.Drawing.Drawing2D; using System.Globalization; using System.Linq; +using System.Text.RegularExpressions; namespace VocaluxeLib { public static class CExtensions { + /// + /// Makes sure val is between min and max + /// Asserts that min<=max + /// + /// + /// + /// + /// + /// Clamped value + public static T Clamp(this T val, T min, T max) where T : IComparable + { + Debug.Assert(min.CompareTo(max) <= 0); + if (val.CompareTo(min) < 0) + return min; + if (val.CompareTo(max) > 0) + return max; + return val; + } + + /// + /// Makes sure val is between min and max but also handles the case where min>max + /// + /// + /// + /// + /// + /// + /// Clamped value + public static T Clamp(this T val, T min, T max, bool preferMin) where T : IComparable + { + if (min.CompareTo(max) > 0) + { + if (preferMin) + max = min; + else + min = max; + } + return Clamp(val, min, max); + } + + /// + /// Checks if the value is in the specified range + /// + /// + /// + /// + /// + /// + public static bool IsInRange(this T val, T min, T max) where T : IComparable + { + Debug.Assert(min.CompareTo(max) <= 0); + return min.CompareTo(val) <= 0 && max.CompareTo(val) >= 0; + } + /// /// Resizes the given list to the given size. Removes elements or adds default values /// @@ -91,28 +149,13 @@ namespace VocaluxeLib return value.IndexOf(other, StringComparison.CurrentCultureIgnoreCase) >= 0; } + private static Regex _MultipleWhiteSpaceRegEx = new Regex(@" {2,}"); + public static string TrimMultipleWs(this string value) { if (string.IsNullOrEmpty(value)) return ""; - int start = 0; - int len = value.Length; - while (value[start] == ' ') - { - start++; - if (start >= len) - return ""; - } - if (start > 0) - start--; - int end = --len; - while (value[end] == ' ') - end--; - if (end < len) - end++; - if (end - start < len) - value = value.Substring(start, end - start + 1); - return value; + return _MultipleWhiteSpaceRegEx.Replace(value, " "); } /// @@ -134,5 +177,47 @@ namespace VocaluxeLib rect.H + 2 * rect.H * (scale - 1f), rect.Z); } + + public static Size GetSize(this Bitmap bmp) + { + return new Size(bmp.Width, bmp.Height); + } + + public static Rectangle GetRect(this Bitmap bmp) + { + return Rectangle.Round(new Rectangle(0, 0, bmp.Width, bmp.Height)); + } + + /// + /// Resizes the bitmap to the given size creating a copy of it + /// + /// + /// + /// Resized bitmap or null on error + public static Bitmap Resize(this Bitmap bmp, Size newSize) + { + Bitmap result = null; + try + { + //Create a new Bitmap with the new sizes + result = new Bitmap(newSize.Width, newSize.Height); + //Scale the texture + using (Graphics g = Graphics.FromImage(result)) + { + g.InterpolationMode = InterpolationMode.HighQualityBicubic; + g.SmoothingMode = SmoothingMode.HighQuality; + g.DrawImage(bmp, result.GetRect()); + } + } + catch (Exception) + { + if (result != null) + { + result.Dispose(); + result = null; + } + } + return result; + } } } \ No newline at end of file diff --git a/VocaluxeLib/IBasic.cs b/VocaluxeLib/IBasic.cs index d88a4ea7..ef287370 100644 --- a/VocaluxeLib/IBasic.cs +++ b/VocaluxeLib/IBasic.cs @@ -19,7 +19,6 @@ using System; using System.Collections.Generic; using System.Collections.ObjectModel; using System.Drawing; -using System.Xml; using VocaluxeLib.Draw; using VocaluxeLib.Game; using VocaluxeLib.Menu; @@ -28,12 +27,14 @@ using VocaluxeLib.Songs; namespace VocaluxeLib { + public delegate void OnSongMenuChanged(); + public interface IConfig { EOffOn GetSaveModifiedSongs(); void SetBackgroundMusicVolume(int newVolume); - int GetBackgroundMusicVolume(); + int GetMusicVolume(EMusicType type); EBackgroundMusicOffOn GetBackgroundMusicStatus(); @@ -58,16 +59,16 @@ namespace VocaluxeLib bool IsMicConfigured(int playerNr); int GetMaxNumMics(); - /// - /// Get the uniform settings for writing XML files. ALWAYS use this! - /// - XmlWriterSettings GetXMLSettings(); + bool GetLoadOldThemeFiles(); + void AddSongMenuListener(OnSongMenuChanged onSongMenuChanged); + void RemoveSongMenuListener(OnSongMenuChanged onSongMenuChanged); } public interface ISettings { int GetRenderW(); int GetRenderH(); + SRectF GetRenderRect(); bool IsTabNavigation(); float GetZFar(); @@ -95,24 +96,15 @@ namespace VocaluxeLib float GetSoundPlayerFadeTime(); } - public interface ITheme + public interface IThemes { string GetThemeScreensPath(int partyModeID); - int GetSkinIndex(int partyModeID); - CTexture GetSkinTexture(string textureName, int partyModeID); - CTexture GetSkinVideoTexture(string videoName, int partyModeID); + CTextureRef GetSkinTexture(string textureName, int partyModeID); + CVideoStream GetSkinVideo(string videoName, int partyModeID, bool loop); - void SkinVideoResume(string videoName, int partyModeID); - void SkinVideoPause(string videoName, int partyModeID); - - SColorF GetColor(string colorName, int partyModeID); - bool GetColor(string colorName, int skinIndex, out SColorF color); + bool GetColor(string colorName, int partyModeID, out SColorF color); SColorF GetPlayerColor(int playerNr); - - void UnloadSkins(); - void ListSkins(); - void LoadSkins(); - void LoadTheme(); + void Reload(); } public interface IBackgroundMusic @@ -131,57 +123,58 @@ namespace VocaluxeLib void Play(); void Stop(); - CTexture GetVideoTexture(); + CTextureRef GetVideoTexture(); void LoadPreview(CSong song, float start = 0f); void PlayPreview(float start = -1f); void StopPreview(); - } public interface IDrawing { - void DrawTexture(CTexture texture, SRectF rect); - void DrawTexture(CTexture texture, SRectF rect, SColorF color); - void DrawTexture(CTexture texture, SRectF rect, SColorF color, SRectF bounds, bool mirrored = false); - void DrawTextureReflection(CTexture texture, SRectF rect, SColorF color, SRectF bounds, float reflectionSpace, float reflectionHeight); + void DrawTexture(CTextureRef texture, SRectF rect); + void DrawTexture(CTextureRef texture, SRectF rect, SColorF color); + void DrawTexture(CTextureRef texture, SRectF rect, SColorF color, SRectF bounds, bool mirrored = false); + void DrawTexture(CTextureRef textureRef, SRectF bounds, EAspect aspect); + void DrawTexture(CTextureRef textureRef, SRectF bounds, EAspect aspect, SColorF color); + void DrawTextureReflection(CTextureRef texture, SRectF rect, SColorF color, SRectF bounds, float reflectionSpace, float reflectionHeight); - CTexture AddTexture(string fileName); - void RemoveTexture(ref CTexture texture); + CTextureRef AddTexture(string fileName); + CTextureRef EnqueueTexture(string fileName); + void RemoveTexture(ref CTextureRef texture); - void DrawColor(SColorF color, SRectF rect); - void DrawColorReflection(SColorF color, SRectF rect, float space, float height); + void DrawRect(SColorF color, SRectF rect); + void DrawRectReflection(SColorF color, SRectF rect, float space, float height); } public interface IGraphics { void ReloadTheme(); void SaveTheme(); - void FadeTo(EScreens nextScreen); + void FadeTo(EScreen nextScreen); + void FadeTo(IMenu nextScreen); float GetGlobalAlpha(); - EScreens GetNextScreen(); + IMenu GetNextScreen(); + EScreen GetNextScreenType(); + IMenu GetScreen(EScreen screen); } public interface ILog { - void LogError(string errorText); + void LogError(string errorText, bool showMsg = false, bool exit = false); void LogDebug(string text); void LogSongInfo(string text); } public interface IFonts { - void SetFont(string fontName); - void SetStyle(EStyle fontStyle); - RectangleF GetTextBounds(CText text); - RectangleF GetTextBounds(CText text, float textHeight); - void DrawText(string text, float textHeight, float x, float y, float z, SColorF color); - void DrawTextReflection(string text, float textHeight, float x, float y, float z, SColorF color, float reflectionSpace, float reflectionHeight); - void DrawText(string text, float textHeight, float x, float y, float z, SColorF color, float begin, float end); + void DrawText(string text, CFont font, float x, float y, float z, SColorF color); + void DrawTextReflection(string text, CFont font, float x, float y, float z, SColorF color, float reflectionSpace, float reflectionHeight); + void DrawText(string text, CFont font, float x, float y, float z, SColorF color, float begin, float end); } public interface ILanguage @@ -216,7 +209,7 @@ namespace VocaluxeLib public interface IRecording { - int GetToneAbs(int playerNr); + int GetToneAbs(int player); } public interface IProfiles @@ -224,7 +217,7 @@ namespace VocaluxeLib CProfile[] GetProfiles(); EGameDifficulty GetDifficulty(int profileID); string GetPlayerName(int profileID, int playerNum = 0); - CTexture GetAvatar(int profileID); + CTextureRef GetAvatar(int profileID); CAvatar GetAvatarByFilename(string fileName); bool IsProfileIDValid(int profileID); bool IsGuest(int profileID); @@ -249,6 +242,7 @@ namespace VocaluxeLib CSong GetVisibleSong(int visibleIndex); CSong GetSongByID(int songID); + ReadOnlyCollection GetSongs(); ReadOnlyCollection GetVisibleSongs(); CCategory GetCategory(int index); @@ -263,14 +257,14 @@ namespace VocaluxeLib public interface IVideo { - int Load(string videoFileName); - bool Skip(int streamID, float startPosition, float videoGap); - bool GetFrame(int streamID, ref CTexture videoTexture, float time, out float videoTime); - bool IsFinished(int streamID); - bool Close(int streamID); - void SetLoop(int streamID, bool loop = true); - void Resume(int streamID); - void Pause(int streamID); + CVideoStream Load(string videoFileName); + bool Skip(CVideoStream stream, float startPosition, float videoGap); + bool GetFrame(CVideoStream stream, float time); + bool IsFinished(CVideoStream stream); + void Close(ref CVideoStream stream); + void SetLoop(CVideoStream stream, bool loop = true); + void Resume(CVideoStream stream); + void Pause(CVideoStream stream); } public interface ISound @@ -278,24 +272,26 @@ namespace VocaluxeLib int Load(string soundFile, bool loop = false, bool prescan = false); void SetPosition(int soundStream, float newPosition); void Play(int soundStream); - void Fade(int soundStream, float targetVolume, float duration, EStreamAction afterFadeAction = EStreamAction.Nothing); + void Fade(int soundStream, int targetVolume, float duration, EStreamAction afterFadeAction = EStreamAction.Nothing); void Close(int soundStream); bool IsFinished(int soundStream); float GetPosition(int soundStream); float GetLength(int soundStream); - void SetStreamVolume(int soundStream, float volume); + void SetStreamVolume(int soundStream, int volume); + void SetGlobalVolume(int volume); } public interface ICover { - CTexture GetNoCover(); + CTextureRef GetNoCover(); + CTextureRef GenerateCover(string text, ECoverGeneratorType type, CSong firstSong); } public interface IDataBase { - bool GetCover(string fileName, ref CTexture texture, int coverSize); + bool GetCover(string fileName, ref CTextureRef texture, int coverSize); bool GetDataBaseSongInfos(string artist, string title, out int numPlayed, out DateTime dateAdded, out int highscoreID); } @@ -334,10 +330,9 @@ namespace VocaluxeLib void Load(CSong song, float start = 0f); void Stop(); void TogglePause(); - CTexture GetCover(); - CTexture GetVideoTexture(); + CTextureRef GetCover(); + CTextureRef GetVideoTexture(); bool IsPlaying(); float GetLength(); - } } \ No newline at end of file diff --git a/VocaluxeLib/Menu/CBackground.cs b/VocaluxeLib/Menu/CBackground.cs index 67ba0755..548d10fa 100644 --- a/VocaluxeLib/Menu/CBackground.cs +++ b/VocaluxeLib/Menu/CBackground.cs @@ -16,11 +16,11 @@ #endregion using System; -using System.Drawing; -using System.Xml; +using System.Xml.Serialization; using System.Diagnostics; using System.Collections.Generic; using VocaluxeLib.Draw; +using VocaluxeLib.Xml; namespace VocaluxeLib.Menu { @@ -33,31 +33,35 @@ namespace VocaluxeLib.Menu Video } - struct SThemeBackground + [XmlType("Background")] + public struct SThemeBackground { - public string Name; - + [XmlAttribute(AttributeName = "Name")] public string Name; public EBackgroundTypes Type; - - public List SlideShowTextures; - - public string VideoName; - public string TextureName; - - public string ColorName; + [XmlArray] public List SlideShowTextures; + [XmlElement("Video")] public string VideoName; + public string Skin; + public SThemeColor Color; } - public class CBackground : IMenuElement + public class CBackground : CMenuElementBase, IMenuElement, IThemeable { private readonly int _PartyModeID; private SThemeBackground _Theme; - private bool _ThemeLoaded; private int _SlideShowCurrent; private readonly Stopwatch _SlideShowTimer = new Stopwatch(); - private readonly List _SlideShowTextures = new List(); + private readonly List _SlideShowTextures = new List(); + + private CVideoStream _VideoStream; + + public bool Selectable + { + get { return false; } + } public SColorF Color; + public bool ThemeLoaded { get; private set; } public string GetThemeName() { @@ -68,27 +72,35 @@ namespace VocaluxeLib.Menu public CBackground(int partyModeID) { _PartyModeID = partyModeID; - _ThemeLoaded = false; + ThemeLoaded = false; _Theme = new SThemeBackground {SlideShowTextures = new List()}; Color = new SColorF(0f, 0f, 0f, 1f); } + + public CBackground(SThemeBackground theme, int partyModeID) + { + _Theme = theme; + _PartyModeID = partyModeID; + + ThemeLoaded = true; + } #endregion Constructors #region public - public bool LoadTheme(string xmlPath, string elementName, CXMLReader xmlReader, int skinIndex) + public bool LoadTheme(string xmlPath, string elementName, CXmlReader xmlReader) { string item = xmlPath + "/" + elementName; - _ThemeLoaded = true; + ThemeLoaded = true; - _ThemeLoaded &= xmlReader.TryGetEnumValue(item + "/Type", ref _Theme.Type); + ThemeLoaded &= xmlReader.TryGetEnumValue(item + "/Type", ref _Theme.Type); bool vid = xmlReader.GetValue(item + "/Video", out _Theme.VideoName, String.Empty); - bool tex = xmlReader.GetValue(item + "/Skin", out _Theme.TextureName, String.Empty); - _ThemeLoaded &= vid || tex || _Theme.Type == EBackgroundTypes.None; + bool tex = xmlReader.GetValue(item + "/Skin", out _Theme.Skin, String.Empty); + ThemeLoaded &= vid || tex || _Theme.Type == EBackgroundTypes.None; - if (xmlReader.GetValue(item + "/Color", out _Theme.ColorName, String.Empty)) - _ThemeLoaded &= CBase.Theme.GetColor(_Theme.ColorName, skinIndex, out Color); + if (xmlReader.GetValue(item + "/Color", out _Theme.Color.Name, String.Empty)) + ThemeLoaded &= _Theme.Color.Get(_PartyModeID, out Color); else { bool success = true; @@ -98,9 +110,11 @@ namespace VocaluxeLib.Menu success &= xmlReader.TryGetFloatValue(item + "/A", ref Color.A); if (_Theme.Type != EBackgroundTypes.None) - _ThemeLoaded &= success; + ThemeLoaded &= success; } + _Theme.Color.Color = Color; + int i = 1; while (xmlReader.ItemExists(item + "/SlideShow" + i)) @@ -112,110 +126,75 @@ namespace VocaluxeLib.Menu i++; } - if (_ThemeLoaded) + if (ThemeLoaded) { _Theme.Name = elementName; - LoadTextures(); + LoadSkin(); } - return _ThemeLoaded; - } - - public bool SaveTheme(XmlWriter writer) - { - if (_ThemeLoaded) - { - writer.WriteStartElement(_Theme.Name); - - writer.WriteComment(": Background type: " + CHelper.ListStrings(Enum.GetNames(typeof(EBackgroundTypes)))); - writer.WriteElementString("Type", Enum.GetName(typeof(EBackgroundTypes), _Theme.Type)); - - writer.WriteComment("