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/ChallengeMedley/Theme.xml b/Output/PartyModes/Challenge/Themes/Ambient.xml similarity index 57% rename from Output/PartyModes/ChallengeMedley/Theme.xml rename to Output/PartyModes/Challenge/Themes/Ambient.xml index 7a106892..626053da 100644 --- a/Output/PartyModes/ChallengeMedley/Theme.xml +++ b/Output/PartyModes/Challenge/Themes/Ambient.xml @@ -4,8 +4,7 @@ Ambient brunzel - Textures - 0 - 1 + 0 + 1 \ No newline at end of file diff --git a/Output/PartyModes/TicTacToe/Textures/Skin.xml b/Output/PartyModes/Challenge/Themes/Ambient/Blue.xml similarity index 98% rename from Output/PartyModes/TicTacToe/Textures/Skin.xml rename to Output/PartyModes/Challenge/Themes/Ambient/Blue.xml index 5979ac45..f4b8bb59 100644 --- a/Output/PartyModes/TicTacToe/Textures/Skin.xml +++ b/Output/PartyModes/Challenge/Themes/Ambient/Blue.xml @@ -4,8 +4,8 @@ Blue brunzel - 0 - 1 + 0 + 1 diff --git a/Output/PartyModes/Challenge/Textures/Button.png b/Output/PartyModes/Challenge/Themes/Ambient/Button.png similarity index 100% rename from Output/PartyModes/Challenge/Textures/Button.png rename to Output/PartyModes/Challenge/Themes/Ambient/Button.png diff --git a/Output/PartyModes/Challenge/Textures/CoverTile.png b/Output/PartyModes/Challenge/Themes/Ambient/CoverTile.png similarity index 100% rename from Output/PartyModes/Challenge/Textures/CoverTile.png rename to Output/PartyModes/Challenge/Themes/Ambient/CoverTile.png diff --git a/Output/PartyModes/Challenge/Textures/Invisible.png b/Output/PartyModes/Challenge/Themes/Ambient/Invisible.png similarity index 100% rename from Output/PartyModes/Challenge/Textures/Invisible.png rename to Output/PartyModes/Challenge/Themes/Ambient/Invisible.png diff --git a/Output/PartyModes/Challenge/Textures/Menu.png b/Output/PartyModes/Challenge/Themes/Ambient/Menu.png similarity index 100% rename from Output/PartyModes/Challenge/Textures/Menu.png rename to Output/PartyModes/Challenge/Themes/Ambient/Menu.png diff --git a/Output/PartyModes/Challenge/Textures/Minus.png b/Output/PartyModes/Challenge/Themes/Ambient/Minus.png similarity index 100% rename from Output/PartyModes/Challenge/Textures/Minus.png rename to Output/PartyModes/Challenge/Themes/Ambient/Minus.png diff --git a/Output/PartyModes/Challenge/Textures/PlayerSelector.png b/Output/PartyModes/Challenge/Themes/Ambient/PlayerSelector.png similarity index 100% rename from Output/PartyModes/Challenge/Textures/PlayerSelector.png rename to Output/PartyModes/Challenge/Themes/Ambient/PlayerSelector.png diff --git a/Output/PartyModes/Challenge/Textures/Plus.png b/Output/PartyModes/Challenge/Themes/Ambient/Plus.png similarity index 100% rename from Output/PartyModes/Challenge/Textures/Plus.png rename to Output/PartyModes/Challenge/Themes/Ambient/Plus.png diff --git a/Output/PartyModes/Challenge/Textures/Popup.png b/Output/PartyModes/Challenge/Themes/Ambient/Popup.png similarity index 100% rename from Output/PartyModes/Challenge/Textures/Popup.png rename to Output/PartyModes/Challenge/Themes/Ambient/Popup.png diff --git a/Output/PartyModes/TicTacToe/Textures/Random.png b/Output/PartyModes/Challenge/Themes/Ambient/Random.png similarity index 100% rename from Output/PartyModes/TicTacToe/Textures/Random.png rename to Output/PartyModes/Challenge/Themes/Ambient/Random.png diff --git a/Output/PartyModes/TicTacToe/Textures/RepeatIcon.png b/Output/PartyModes/Challenge/Themes/Ambient/RepeatIcon.png similarity index 100% rename from Output/PartyModes/TicTacToe/Textures/RepeatIcon.png rename to Output/PartyModes/Challenge/Themes/Ambient/RepeatIcon.png diff --git a/Output/PartyModes/Challenge/Screens/PartyScreenChallengeConfig.xml b/Output/PartyModes/Challenge/Themes/Ambient/Screens/PartyScreenChallengeConfig.xml similarity index 100% rename from Output/PartyModes/Challenge/Screens/PartyScreenChallengeConfig.xml rename to Output/PartyModes/Challenge/Themes/Ambient/Screens/PartyScreenChallengeConfig.xml diff --git a/Output/PartyModes/Challenge/Screens/PartyScreenChallengeMain.xml b/Output/PartyModes/Challenge/Themes/Ambient/Screens/PartyScreenChallengeMain.xml similarity index 100% rename from Output/PartyModes/Challenge/Screens/PartyScreenChallengeMain.xml rename to Output/PartyModes/Challenge/Themes/Ambient/Screens/PartyScreenChallengeMain.xml diff --git a/Output/PartyModes/Challenge/Screens/PartyScreenChallengeNames.xml b/Output/PartyModes/Challenge/Themes/Ambient/Screens/PartyScreenChallengeNames.xml similarity index 100% rename from Output/PartyModes/Challenge/Screens/PartyScreenChallengeNames.xml rename to Output/PartyModes/Challenge/Themes/Ambient/Screens/PartyScreenChallengeNames.xml diff --git a/Output/PartyModes/Challenge/Textures/ScrollDown.png b/Output/PartyModes/Challenge/Themes/Ambient/ScrollDown.png similarity index 100% rename from Output/PartyModes/Challenge/Textures/ScrollDown.png rename to Output/PartyModes/Challenge/Themes/Ambient/ScrollDown.png diff --git a/Output/PartyModes/Challenge/Textures/ScrollUp.png b/Output/PartyModes/Challenge/Themes/Ambient/ScrollUp.png similarity index 100% rename from Output/PartyModes/Challenge/Textures/ScrollUp.png rename to Output/PartyModes/Challenge/Themes/Ambient/ScrollUp.png diff --git a/Output/PartyModes/Challenge/Textures/SelectSlide.png b/Output/PartyModes/Challenge/Themes/Ambient/SelectSlide.png similarity index 100% rename from Output/PartyModes/Challenge/Textures/SelectSlide.png rename to Output/PartyModes/Challenge/Themes/Ambient/SelectSlide.png diff --git a/Output/PartyModes/Challenge/Textures/SelectSlideArrowLeft.png b/Output/PartyModes/Challenge/Themes/Ambient/SelectSlideArrowLeft.png similarity index 100% rename from Output/PartyModes/Challenge/Textures/SelectSlideArrowLeft.png rename to Output/PartyModes/Challenge/Themes/Ambient/SelectSlideArrowLeft.png diff --git a/Output/PartyModes/Challenge/Textures/SelectSlideArrowRight.png b/Output/PartyModes/Challenge/Themes/Ambient/SelectSlideArrowRight.png similarity index 100% rename from Output/PartyModes/Challenge/Textures/SelectSlideArrowRight.png rename to Output/PartyModes/Challenge/Themes/Ambient/SelectSlideArrowRight.png diff --git a/Output/PartyModes/Challenge/Textures/SelectSlidePlayer.png b/Output/PartyModes/Challenge/Themes/Ambient/SelectSlidePlayer.png similarity index 100% rename from Output/PartyModes/Challenge/Textures/SelectSlidePlayer.png rename to Output/PartyModes/Challenge/Themes/Ambient/SelectSlidePlayer.png diff --git a/Output/PartyModes/Challenge/Textures/[Blue]BG_Default.png b/Output/PartyModes/Challenge/Themes/Ambient/[Blue]BG_Default.png similarity index 100% rename from Output/PartyModes/Challenge/Textures/[Blue]BG_Default.png rename to Output/PartyModes/Challenge/Themes/Ambient/[Blue]BG_Default.png 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/TicTacToe/Theme.xml b/Output/PartyModes/ChallengeMedley/Themes/Ambient.xml similarity index 57% rename from Output/PartyModes/TicTacToe/Theme.xml rename to Output/PartyModes/ChallengeMedley/Themes/Ambient.xml index 7a106892..626053da 100644 --- a/Output/PartyModes/TicTacToe/Theme.xml +++ b/Output/PartyModes/ChallengeMedley/Themes/Ambient.xml @@ -4,8 +4,7 @@ Ambient brunzel - Textures - 0 - 1 + 0 + 1 \ No newline at end of file diff --git a/Output/PartyModes/Challenge/Textures/Skin.xml b/Output/PartyModes/ChallengeMedley/Themes/Ambient/Blue.xml similarity index 69% rename from Output/PartyModes/Challenge/Textures/Skin.xml rename to Output/PartyModes/ChallengeMedley/Themes/Ambient/Blue.xml index 9217b4e3..f4b8bb59 100644 --- a/Output/PartyModes/Challenge/Textures/Skin.xml +++ b/Output/PartyModes/ChallengeMedley/Themes/Ambient/Blue.xml @@ -4,10 +4,82 @@ Blue brunzel - 0 - 1 + 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 @@ -145,6 +217,8 @@ SelectSlideArrowLeft.png SelectSlideArrowRight.png Popup.png + RepeatIcon.png + Random.png ScrollUp.png ScrollDown.png Invisible.png diff --git a/Output/PartyModes/ChallengeMedley/Textures/Button.png b/Output/PartyModes/ChallengeMedley/Themes/Ambient/Button.png similarity index 100% rename from Output/PartyModes/ChallengeMedley/Textures/Button.png rename to Output/PartyModes/ChallengeMedley/Themes/Ambient/Button.png diff --git a/Output/PartyModes/ChallengeMedley/Textures/CoverTile.png b/Output/PartyModes/ChallengeMedley/Themes/Ambient/CoverTile.png similarity index 100% rename from Output/PartyModes/ChallengeMedley/Textures/CoverTile.png rename to Output/PartyModes/ChallengeMedley/Themes/Ambient/CoverTile.png diff --git a/Output/PartyModes/ChallengeMedley/Textures/Invisible.png b/Output/PartyModes/ChallengeMedley/Themes/Ambient/Invisible.png similarity index 100% rename from Output/PartyModes/ChallengeMedley/Textures/Invisible.png rename to Output/PartyModes/ChallengeMedley/Themes/Ambient/Invisible.png diff --git a/Output/PartyModes/ChallengeMedley/Textures/Menu.png b/Output/PartyModes/ChallengeMedley/Themes/Ambient/Menu.png similarity index 100% rename from Output/PartyModes/ChallengeMedley/Textures/Menu.png rename to Output/PartyModes/ChallengeMedley/Themes/Ambient/Menu.png diff --git a/Output/PartyModes/ChallengeMedley/Textures/Minus.png b/Output/PartyModes/ChallengeMedley/Themes/Ambient/Minus.png similarity index 100% rename from Output/PartyModes/ChallengeMedley/Textures/Minus.png rename to Output/PartyModes/ChallengeMedley/Themes/Ambient/Minus.png diff --git a/Output/PartyModes/TicTacToe/Textures/PlayerSelector.png b/Output/PartyModes/ChallengeMedley/Themes/Ambient/PlayerSelector.png similarity index 100% rename from Output/PartyModes/TicTacToe/Textures/PlayerSelector.png rename to Output/PartyModes/ChallengeMedley/Themes/Ambient/PlayerSelector.png diff --git a/Output/PartyModes/ChallengeMedley/Textures/Plus.png b/Output/PartyModes/ChallengeMedley/Themes/Ambient/Plus.png similarity index 100% rename from Output/PartyModes/ChallengeMedley/Textures/Plus.png rename to Output/PartyModes/ChallengeMedley/Themes/Ambient/Plus.png diff --git a/Output/PartyModes/ChallengeMedley/Textures/Popup.png b/Output/PartyModes/ChallengeMedley/Themes/Ambient/Popup.png similarity index 100% rename from Output/PartyModes/ChallengeMedley/Textures/Popup.png rename to Output/PartyModes/ChallengeMedley/Themes/Ambient/Popup.png diff --git a/Output/PartyModes/ChallengeMedley/Themes/Ambient/Random.png b/Output/PartyModes/ChallengeMedley/Themes/Ambient/Random.png new file mode 100644 index 00000000..f19c9dc3 Binary files /dev/null and b/Output/PartyModes/ChallengeMedley/Themes/Ambient/Random.png differ diff --git a/Output/PartyModes/ChallengeMedley/Themes/Ambient/RepeatIcon.png b/Output/PartyModes/ChallengeMedley/Themes/Ambient/RepeatIcon.png new file mode 100644 index 00000000..ecf82df1 Binary files /dev/null and b/Output/PartyModes/ChallengeMedley/Themes/Ambient/RepeatIcon.png differ diff --git a/Output/PartyModes/ChallengeMedley/Screens/PartyScreenChallengeMedleyConfig.xml b/Output/PartyModes/ChallengeMedley/Themes/Ambient/Screens/PartyScreenChallengeMedleyConfig.xml similarity index 100% rename from Output/PartyModes/ChallengeMedley/Screens/PartyScreenChallengeMedleyConfig.xml rename to Output/PartyModes/ChallengeMedley/Themes/Ambient/Screens/PartyScreenChallengeMedleyConfig.xml diff --git a/Output/PartyModes/ChallengeMedley/Screens/PartyScreenChallengeMedleyMain.xml b/Output/PartyModes/ChallengeMedley/Themes/Ambient/Screens/PartyScreenChallengeMedleyMain.xml similarity index 100% rename from Output/PartyModes/ChallengeMedley/Screens/PartyScreenChallengeMedleyMain.xml rename to Output/PartyModes/ChallengeMedley/Themes/Ambient/Screens/PartyScreenChallengeMedleyMain.xml diff --git a/Output/PartyModes/ChallengeMedley/Screens/PartyScreenChallengeMedleyNames.xml b/Output/PartyModes/ChallengeMedley/Themes/Ambient/Screens/PartyScreenChallengeMedleyNames.xml similarity index 100% rename from Output/PartyModes/ChallengeMedley/Screens/PartyScreenChallengeMedleyNames.xml rename to Output/PartyModes/ChallengeMedley/Themes/Ambient/Screens/PartyScreenChallengeMedleyNames.xml diff --git a/Output/PartyModes/ChallengeMedley/Textures/ScrollDown.png b/Output/PartyModes/ChallengeMedley/Themes/Ambient/ScrollDown.png similarity index 100% rename from Output/PartyModes/ChallengeMedley/Textures/ScrollDown.png rename to Output/PartyModes/ChallengeMedley/Themes/Ambient/ScrollDown.png diff --git a/Output/PartyModes/ChallengeMedley/Textures/ScrollUp.png b/Output/PartyModes/ChallengeMedley/Themes/Ambient/ScrollUp.png similarity index 100% rename from Output/PartyModes/ChallengeMedley/Textures/ScrollUp.png rename to Output/PartyModes/ChallengeMedley/Themes/Ambient/ScrollUp.png diff --git a/Output/PartyModes/ChallengeMedley/Textures/SelectSlide.png b/Output/PartyModes/ChallengeMedley/Themes/Ambient/SelectSlide.png similarity index 100% rename from Output/PartyModes/ChallengeMedley/Textures/SelectSlide.png rename to Output/PartyModes/ChallengeMedley/Themes/Ambient/SelectSlide.png diff --git a/Output/PartyModes/ChallengeMedley/Textures/SelectSlideArrowLeft.png b/Output/PartyModes/ChallengeMedley/Themes/Ambient/SelectSlideArrowLeft.png similarity index 100% rename from Output/PartyModes/ChallengeMedley/Textures/SelectSlideArrowLeft.png rename to Output/PartyModes/ChallengeMedley/Themes/Ambient/SelectSlideArrowLeft.png diff --git a/Output/PartyModes/ChallengeMedley/Textures/SelectSlideArrowRight.png b/Output/PartyModes/ChallengeMedley/Themes/Ambient/SelectSlideArrowRight.png similarity index 100% rename from Output/PartyModes/ChallengeMedley/Textures/SelectSlideArrowRight.png rename to Output/PartyModes/ChallengeMedley/Themes/Ambient/SelectSlideArrowRight.png diff --git a/Output/PartyModes/ChallengeMedley/Textures/SelectSlidePlayer.png b/Output/PartyModes/ChallengeMedley/Themes/Ambient/SelectSlidePlayer.png similarity index 100% rename from Output/PartyModes/ChallengeMedley/Textures/SelectSlidePlayer.png rename to Output/PartyModes/ChallengeMedley/Themes/Ambient/SelectSlidePlayer.png diff --git a/Output/PartyModes/ChallengeMedley/Textures/[Blue]BG_Default.png b/Output/PartyModes/ChallengeMedley/Themes/Ambient/[Blue]BG_Default.png similarity index 100% rename from Output/PartyModes/ChallengeMedley/Textures/[Blue]BG_Default.png rename to Output/PartyModes/ChallengeMedley/Themes/Ambient/[Blue]BG_Default.png 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/Challenge/Theme.xml b/Output/PartyModes/TicTacToe/Themes/Ambient.xml similarity index 57% rename from Output/PartyModes/Challenge/Theme.xml rename to Output/PartyModes/TicTacToe/Themes/Ambient.xml index 7a106892..626053da 100644 --- a/Output/PartyModes/Challenge/Theme.xml +++ b/Output/PartyModes/TicTacToe/Themes/Ambient.xml @@ -4,8 +4,7 @@ Ambient brunzel - Textures - 0 - 1 + 0 + 1 \ No newline at end of file diff --git a/Output/PartyModes/ChallengeMedley/Textures/Skin.xml b/Output/PartyModes/TicTacToe/Themes/Ambient/Blue.xml similarity index 68% rename from Output/PartyModes/ChallengeMedley/Textures/Skin.xml rename to Output/PartyModes/TicTacToe/Themes/Ambient/Blue.xml index f73b7fbd..f4b8bb59 100644 --- a/Output/PartyModes/ChallengeMedley/Textures/Skin.xml +++ b/Output/PartyModes/TicTacToe/Themes/Ambient/Blue.xml @@ -4,10 +4,82 @@ Blue brunzel - 0 - 1 + 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 @@ -145,9 +217,12 @@ SelectSlideArrowLeft.png SelectSlideArrowRight.png Popup.png + RepeatIcon.png + Random.png ScrollUp.png ScrollDown.png Invisible.png + PlayerSelector.png Plus.png Minus.png diff --git a/Output/PartyModes/TicTacToe/Textures/Button.png b/Output/PartyModes/TicTacToe/Themes/Ambient/Button.png similarity index 100% rename from Output/PartyModes/TicTacToe/Textures/Button.png rename to Output/PartyModes/TicTacToe/Themes/Ambient/Button.png diff --git a/Output/PartyModes/TicTacToe/Textures/CoverTile.png b/Output/PartyModes/TicTacToe/Themes/Ambient/CoverTile.png similarity index 100% rename from Output/PartyModes/TicTacToe/Textures/CoverTile.png rename to Output/PartyModes/TicTacToe/Themes/Ambient/CoverTile.png diff --git a/Output/PartyModes/TicTacToe/Textures/Invisible.png b/Output/PartyModes/TicTacToe/Themes/Ambient/Invisible.png similarity index 100% rename from Output/PartyModes/TicTacToe/Textures/Invisible.png rename to Output/PartyModes/TicTacToe/Themes/Ambient/Invisible.png diff --git a/Output/PartyModes/TicTacToe/Textures/Menu.png b/Output/PartyModes/TicTacToe/Themes/Ambient/Menu.png similarity index 100% rename from Output/PartyModes/TicTacToe/Textures/Menu.png rename to Output/PartyModes/TicTacToe/Themes/Ambient/Menu.png diff --git a/Output/PartyModes/TicTacToe/Textures/Minus.png b/Output/PartyModes/TicTacToe/Themes/Ambient/Minus.png similarity index 100% rename from Output/PartyModes/TicTacToe/Textures/Minus.png rename to Output/PartyModes/TicTacToe/Themes/Ambient/Minus.png diff --git a/Output/PartyModes/TicTacToe/Themes/Ambient/PlayerSelector.png b/Output/PartyModes/TicTacToe/Themes/Ambient/PlayerSelector.png new file mode 100644 index 00000000..c57ab300 Binary files /dev/null and b/Output/PartyModes/TicTacToe/Themes/Ambient/PlayerSelector.png differ diff --git a/Output/PartyModes/TicTacToe/Textures/Plus.png b/Output/PartyModes/TicTacToe/Themes/Ambient/Plus.png similarity index 100% rename from Output/PartyModes/TicTacToe/Textures/Plus.png rename to Output/PartyModes/TicTacToe/Themes/Ambient/Plus.png diff --git a/Output/PartyModes/TicTacToe/Textures/Popup.png b/Output/PartyModes/TicTacToe/Themes/Ambient/Popup.png similarity index 100% rename from Output/PartyModes/TicTacToe/Textures/Popup.png rename to Output/PartyModes/TicTacToe/Themes/Ambient/Popup.png diff --git a/Output/PartyModes/TicTacToe/Themes/Ambient/Random.png b/Output/PartyModes/TicTacToe/Themes/Ambient/Random.png new file mode 100644 index 00000000..f19c9dc3 Binary files /dev/null and b/Output/PartyModes/TicTacToe/Themes/Ambient/Random.png differ diff --git a/Output/PartyModes/TicTacToe/Themes/Ambient/RepeatIcon.png b/Output/PartyModes/TicTacToe/Themes/Ambient/RepeatIcon.png new file mode 100644 index 00000000..ecf82df1 Binary files /dev/null and b/Output/PartyModes/TicTacToe/Themes/Ambient/RepeatIcon.png differ diff --git a/Output/PartyModes/TicTacToe/Screens/PartyScreenTicTacToeConfig.xml b/Output/PartyModes/TicTacToe/Themes/Ambient/Screens/PartyScreenTicTacToeConfig.xml similarity index 100% rename from Output/PartyModes/TicTacToe/Screens/PartyScreenTicTacToeConfig.xml rename to Output/PartyModes/TicTacToe/Themes/Ambient/Screens/PartyScreenTicTacToeConfig.xml diff --git a/Output/PartyModes/TicTacToe/Screens/PartyScreenTicTacToeMain.xml b/Output/PartyModes/TicTacToe/Themes/Ambient/Screens/PartyScreenTicTacToeMain.xml similarity index 100% rename from Output/PartyModes/TicTacToe/Screens/PartyScreenTicTacToeMain.xml rename to Output/PartyModes/TicTacToe/Themes/Ambient/Screens/PartyScreenTicTacToeMain.xml diff --git a/Output/PartyModes/TicTacToe/Screens/PartyScreenTicTacToeNames.xml b/Output/PartyModes/TicTacToe/Themes/Ambient/Screens/PartyScreenTicTacToeNames.xml similarity index 100% rename from Output/PartyModes/TicTacToe/Screens/PartyScreenTicTacToeNames.xml rename to Output/PartyModes/TicTacToe/Themes/Ambient/Screens/PartyScreenTicTacToeNames.xml diff --git a/Output/PartyModes/TicTacToe/Textures/ScrollDown.png b/Output/PartyModes/TicTacToe/Themes/Ambient/ScrollDown.png similarity index 100% rename from Output/PartyModes/TicTacToe/Textures/ScrollDown.png rename to Output/PartyModes/TicTacToe/Themes/Ambient/ScrollDown.png diff --git a/Output/PartyModes/TicTacToe/Textures/ScrollUp.png b/Output/PartyModes/TicTacToe/Themes/Ambient/ScrollUp.png similarity index 100% rename from Output/PartyModes/TicTacToe/Textures/ScrollUp.png rename to Output/PartyModes/TicTacToe/Themes/Ambient/ScrollUp.png diff --git a/Output/PartyModes/TicTacToe/Textures/SelectSlide.png b/Output/PartyModes/TicTacToe/Themes/Ambient/SelectSlide.png similarity index 100% rename from Output/PartyModes/TicTacToe/Textures/SelectSlide.png rename to Output/PartyModes/TicTacToe/Themes/Ambient/SelectSlide.png diff --git a/Output/PartyModes/TicTacToe/Textures/SelectSlideArrowLeft.png b/Output/PartyModes/TicTacToe/Themes/Ambient/SelectSlideArrowLeft.png similarity index 100% rename from Output/PartyModes/TicTacToe/Textures/SelectSlideArrowLeft.png rename to Output/PartyModes/TicTacToe/Themes/Ambient/SelectSlideArrowLeft.png diff --git a/Output/PartyModes/TicTacToe/Textures/SelectSlideArrowRight.png b/Output/PartyModes/TicTacToe/Themes/Ambient/SelectSlideArrowRight.png similarity index 100% rename from Output/PartyModes/TicTacToe/Textures/SelectSlideArrowRight.png rename to Output/PartyModes/TicTacToe/Themes/Ambient/SelectSlideArrowRight.png diff --git a/Output/PartyModes/TicTacToe/Textures/SelectSlidePlayer.png b/Output/PartyModes/TicTacToe/Themes/Ambient/SelectSlidePlayer.png similarity index 100% rename from Output/PartyModes/TicTacToe/Textures/SelectSlidePlayer.png rename to Output/PartyModes/TicTacToe/Themes/Ambient/SelectSlidePlayer.png diff --git a/Output/PartyModes/TicTacToe/Textures/[Blue]BG_Default.png b/Output/PartyModes/TicTacToe/Themes/Ambient/[Blue]BG_Default.png similarity index 100% rename from Output/PartyModes/TicTacToe/Textures/[Blue]BG_Default.png rename to Output/PartyModes/TicTacToe/Themes/Ambient/[Blue]BG_Default.png diff --git a/Output/Themes/Ambient.xml b/Output/Themes/Ambient.xml index 28fbc49b..7c70d365 100644 --- a/Output/Themes/Ambient.xml +++ b/Output/Themes/Ambient.xml @@ -4,9 +4,8 @@ Ambient bohning - Ambient - 0 - 2 + 0 + 2 Cursor diff --git a/Output/Themes/Ambient/Skin Blue.xml b/Output/Themes/Ambient/Skin Blue.xml index bba00650..2ba0f09d 100644 --- a/Output/Themes/Ambient/Skin Blue.xml +++ b/Output/Themes/Ambient/Skin Blue.xml @@ -4,8 +4,8 @@ Blue bohning - 0 - 0 + 0 + 0 diff --git a/Output/Themes/Ambient/Skin Green.xml b/Output/Themes/Ambient/Skin Green.xml index 5b1b4d5f..102de2cb 100644 --- a/Output/Themes/Ambient/Skin Green.xml +++ b/Output/Themes/Ambient/Skin Green.xml @@ -4,8 +4,8 @@ Green bohning - 0 - 0 + 0 + 0 diff --git a/Output/Themes/Ambient/Skin Red.xml b/Output/Themes/Ambient/Skin Red.xml index 50f1eecc..33c98a15 100644 --- a/Output/Themes/Ambient/Skin Red.xml +++ b/Output/Themes/Ambient/Skin Red.xml @@ -4,8 +4,8 @@ Red bohning - 0 - 0 + 0 + 0 diff --git a/Output/Themes/Ambient/Skin Yellow.xml b/Output/Themes/Ambient/Skin Yellow.xml index 9dd57a3b..e5ffcf93 100644 --- a/Output/Themes/Ambient/Skin Yellow.xml +++ b/Output/Themes/Ambient/Skin Yellow.xml @@ -4,8 +4,8 @@ Yellow bohning - 0 - 0 + 0 + 0 diff --git a/PartyModes/PartyModeTicTacToe/CPartyScreenTicTacToeConfig.cs b/PartyModes/PartyModeTicTacToe/CPartyScreenTicTacToeConfig.cs index f44f881c..298e36e6 100644 --- a/PartyModes/PartyModeTicTacToe/CPartyScreenTicTacToeConfig.cs +++ b/PartyModes/PartyModeTicTacToe/CPartyScreenTicTacToeConfig.cs @@ -184,7 +184,7 @@ namespace VocaluxeLib.PartyModes.TicTacToe _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; @@ -196,7 +196,7 @@ 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; diff --git a/PartyModes/PartyModeTicTacToe/CPartyScreenTicTacToeMain.cs b/PartyModes/PartyModeTicTacToe/CPartyScreenTicTacToeMain.cs index 3e1ee098..c0e5f454 100644 --- a/PartyModes/PartyModeTicTacToe/CPartyScreenTicTacToeMain.cs +++ b/PartyModes/PartyModeTicTacToe/CPartyScreenTicTacToeMain.cs @@ -350,13 +350,13 @@ namespace VocaluxeLib.PartyModes.TicTacToe if (winner > 0) { _Texts[_TextFinishMessage].Color = CBase.Themes.GetPlayerColor(winner); - _Texts[_TextFinishMessage].Text = CBase.Language.Translate("TR_SCREENMAIN_WINNER", _PartyModeID) + " " + CBase.Language.Translate("TR_TEAM", _PartyModeID) + " " + + _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]); } @@ -601,8 +601,8 @@ namespace VocaluxeLib.PartyModes.TicTacToe private void _UpdateTeamChoosingMessage() { _Texts[_TextTeamChoosing].Color = CBase.Themes.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].Text = CBase.Language.Translate("TR_TEAM", PartyModeID) + " " + (_GameData.Team + 1) + "! " + + CBase.Language.Translate("TR_SCREENMAIN_TEAM_CHOOSE", PartyModeID); if (_Status == EStatus.JokerRetry || _Status == EStatus.FieldChoosing) _Texts[_TextTeamChoosing].Visible = true; else diff --git a/Vocaluxe/Base/CCursor.cs b/Vocaluxe/Base/CCursor.cs index 9b2cac66..bbc266da 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; @@ -86,11 +87,12 @@ namespace Vocaluxe.Base public void LoadTextures() { - _Cursor = CDraw.CopyTexture(CThemes.GetSkinTexture(CThemes.Cursor.SkinName, -1)); + SThemeCursor theme = CThemes.GetCursorTheme(); + _Cursor = CDraw.CopyTexture(CThemes.GetSkinTexture(theme.SkinName, -1)); - CThemes.Cursor.Color.Get(-1, out _Cursor.Color); - _Cursor.Rect.W = CThemes.Cursor.W; - _Cursor.Rect.H = CThemes.Cursor.H; + theme.Color.Get(-1, out _Cursor.Color); + _Cursor.Rect.W = theme.W; + _Cursor.Rect.H = theme.H; _Cursor.Rect.Z = CSettings.ZNear; } diff --git a/Vocaluxe/Base/CGraphics.cs b/Vocaluxe/Base/CGraphics.cs index a7680cb1..792f25cc 100644 --- a/Vocaluxe/Base/CGraphics.cs +++ b/Vocaluxe/Base/CGraphics.cs @@ -23,6 +23,7 @@ using System.Windows.Forms; using System.IO; using System.Xml.Serialization; using Vocaluxe.Base.Fonts; +using Vocaluxe.Base.ThemeSystem; using Vocaluxe.Screens; using VocaluxeLib; using VocaluxeLib.Menu; @@ -128,14 +129,14 @@ namespace Vocaluxe.Base { CLog.StartBenchmark("Load Theme " + Enum.GetNames(typeof(EScreens))[i]); _Screens[i].Init(); - _Screens[i].LoadTheme(CThemes.GetThemeScreensPath(-1)); + _Screens[i].LoadTheme(CThemes.GetThemeScreensPath(_Screens[i].PartyModeID)); CLog.StopBenchmark("Load Theme " + Enum.GetNames(typeof(EScreens))[i]); } foreach (IMenu popup in _PopupScreens) { popup.Init(); - popup.LoadTheme(CThemes.GetThemeScreensPath(-1)); + popup.LoadTheme(CThemes.GetThemeScreensPath(popup.PartyModeID)); } } @@ -143,10 +144,10 @@ namespace Vocaluxe.Base { _Cursor.ReloadTextures(); foreach (IMenu screen in _Screens) - screen.ReloadTheme(CThemes.GetThemeScreensPath(-1)); + screen.ReloadTheme(CThemes.GetThemeScreensPath(screen.PartyModeID)); foreach (IMenu popup in _PopupScreens) - popup.ReloadTheme(CThemes.GetThemeScreensPath(-1)); + popup.ReloadTheme(CThemes.GetThemeScreensPath(popup.PartyModeID)); } public static void ReloadSkin() @@ -161,7 +162,6 @@ namespace Vocaluxe.Base public static void SaveTheme() { - CThemes.SaveTheme(); foreach (CMenu screen in _Screens) { if (screen.ThemePath == null || screen.ThemeName == "ScreenTest") @@ -658,13 +658,13 @@ namespace Vocaluxe.Base } } } - CFont font=new CFont("Normal",EStyle.Normal, 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) { float textWidth = CFonts.GetTextWidth(txt, font); - RectangleF rect = new RectangleF(CSettings.RenderW - textWidth, y, textWidth, CFonts.GetTextHeight(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/CMain.cs b/Vocaluxe/Base/CMain.cs index caf242b1..aeaa324d 100644 --- a/Vocaluxe/Base/CMain.cs +++ b/Vocaluxe/Base/CMain.cs @@ -21,6 +21,7 @@ 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; @@ -272,11 +273,6 @@ namespace Vocaluxe.Base return CThemes.GetThemeScreensPath(partyModeID); } - public int GetSkinIndex(int partyModeID) - { - return CThemes.GetSkinIndex(partyModeID); - } - public CTextureRef GetSkinTexture(string textureName, int partyModeID) { return CThemes.GetSkinTexture(textureName, partyModeID); @@ -297,24 +293,9 @@ namespace Vocaluxe.Base return CThemes.GetPlayerColor(playerNr); } - public void UnloadSkins() + public void Reload() { - CThemes.UnloadSkins(); - } - - public void ListSkins() - { - CThemes.ListSkins(); - } - - public void LoadSkins() - { - CThemes.LoadSkins(); - } - - public void LoadTheme() - { - CThemes.LoadTheme(); + CThemes.Reload(); } } diff --git a/Vocaluxe/Base/CParty.cs b/Vocaluxe/Base/CParty.cs index 8716b81a..94df0720 100644 --- a/Vocaluxe/Base/CParty.cs +++ b/Vocaluxe/Base/CParty.cs @@ -20,6 +20,7 @@ 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; @@ -311,22 +312,15 @@ namespace Vocaluxe.Base pm.PartyMode.Initialize(); pm.PartyMode.SetFolder(pathToPm); - if (!CThemes.AddTheme(Path.Combine(pathToPm, "Theme.xml"), pm.PartyModeID)) + if (!CThemes.ReadThemesFromFolder(Path.Combine(pathToPm, CSettings.FolderNameThemes), pm.PartyModeID)) return pm; - int themeIndex = CThemes.GetThemeIndex(pm.PartyModeID); - CThemes.ListSkins(themeIndex); - int skinIndex = CThemes.GetSkinIndex(pm.PartyModeID); - - if (!CThemes.LoadSkin(skinIndex)) - return pm; - - if (!CThemes.LoadTheme(themeIndex)) + if (!CThemes.LoadPartymodeTheme(pm.PartyModeID)) return pm; foreach (string screenfile in pm.ScreenFiles) { - string xmlPath = Path.Combine(pathToPm, CSettings.FolderNamePartyModeScreens); + string xmlPath = CThemes.GetThemeScreensPath(pm.PartyModeID); CMenuParty screen = _GetPartyScreenInstance(output, screenfile, pm.Folder); if (screen != null) diff --git a/Vocaluxe/Base/CSettings.cs b/Vocaluxe/Base/CSettings.cs index 36a66d15..b5f599de 100644 --- a/Vocaluxe/Base/CSettings.cs +++ b/Vocaluxe/Base/CSettings.cs @@ -53,8 +53,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; @@ -114,7 +112,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"; @@ -123,6 +120,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; diff --git a/Vocaluxe/Base/CSkin.cs b/Vocaluxe/Base/CSkin.cs deleted file mode 100644 index c51ddd8d..00000000 --- a/Vocaluxe/Base/CSkin.cs +++ /dev/null @@ -1,291 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Diagnostics; -using System.IO; -using System.Xml; -using VocaluxeLib; -using VocaluxeLib.Draw; -using VocaluxeLib.Xml; - -namespace Vocaluxe.Base -{ - class CSkinElement - { - public string Value; - public CTextureRef Texture; - } - - class CVideoSkinElement - { - public string Value; - public CVideoStream VideoStream; - } - - class CSkin - { - private const int _SkinSystemVersion = 3; - - private readonly string _Folder; - private readonly string _FileName; - public readonly int PartyModeID; - - public string Name; - private string _Author; - private int _SkinVersionMajor; - private int _SkinVersionMinor; - - public readonly Dictionary SkinList = new Dictionary(); - public readonly Dictionary VideoList = new Dictionary(); - - private readonly Dictionary _ColorSchemes = new Dictionary(); - private SColorF?[] _PlayerColors; - - public CSkin(string folder, string file, int partyModeId) - { - _Folder = folder; - _FileName = file; - PartyModeID = partyModeId; - } - - #region Load/Save - public bool Init() - { - CXMLReader xmlReader = CXMLReader.OpenFile(Path.Combine(_Folder, _FileName)); - if (xmlReader == null) - return false; - - int version = 0; - if (!xmlReader.TryGetIntValue("//root/SkinSystemVersion", ref version) || version != _SkinSystemVersion) - { - string msg = "Can't load Skin \"" + _FileName + "\", "; - 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); - return false; - } - - bool ok = xmlReader.GetValue("//root/Info/Name", out Name); - ok &= xmlReader.GetValue("//root/Info/Author", out _Author, String.Empty); - ok &= xmlReader.TryGetIntValue("//root/Info/SkinVersionMajor", ref _SkinVersionMajor); - ok &= xmlReader.TryGetIntValue("//root/Info/SkinVersionMinor", ref _SkinVersionMinor); - - if (!ok) - { - CLog.LogError("Can't load skin \"" + _FileName + "\". Invalid file!"); - return false; - } - - return true; - } - - public bool Load() - { - Debug.Assert(SkinList.Count == 0 && VideoList.Count == 0); - CXMLReader xmlReader = CXMLReader.OpenFile(Path.Combine(_Folder, _FileName)); - if (xmlReader == null) - return false; - - // load skins/textures - List names = xmlReader.GetNames("//root/Skins/*"); - foreach (string name in names) - { - CSkinElement sk = new CSkinElement(); - xmlReader.GetValue("//root/Skins/" + name, out sk.Value); - sk.Texture = CDraw.AddTexture(Path.Combine(_Folder, sk.Value)); - if (sk.Texture == null) - { - CLog.LogError("Error on loading texture \"" + name + "\": " + sk.Value, true); - return false; - } - SkinList.Add(name, sk); - } - - // load videos - names = xmlReader.GetNames("//root/Videos/*"); - foreach (string name in names) - { - CVideoSkinElement sk = new CVideoSkinElement(); - xmlReader.GetValue("//root/Videos/" + name, out sk.Value); - VideoList.Add(name, sk); - } - - // load colors - _LoadColors(xmlReader); - return true; - } - - public void Unload() - { - foreach (CSkinElement sk in SkinList.Values) - CDraw.RemoveTexture(ref sk.Texture); - - foreach (CVideoSkinElement vsk in VideoList.Values) - { - CVideo.Close(ref vsk.VideoStream); - } - SkinList.Clear(); - VideoList.Clear(); - _PlayerColors = null; - _ColorSchemes.Clear(); - } - - private void _LoadColors(CXMLReader xmlReader) - { - if (PartyModeID == -1) - { - _PlayerColors = new SColorF?[CSettings.MaxNumPlayer]; - - for (int i = 0; i < CSettings.MaxNumPlayer; i++) - { - SColorF color; - if (xmlReader.TryGetColorFromRGBA("//root/Colors/Player" + (i + 1), out color)) - _PlayerColors[i] = color; - else - _PlayerColors[i] = null; - } - } - - List names = xmlReader.GetNames("//root/ColorSchemes/*"); - foreach (string str in names) - { - SColorF color; - if (xmlReader.TryGetColorFromRGBA("//root/ColorSchemes/" + str, out color)) - _ColorSchemes.Add(str, color); - } - } - - public void SaveSkin() - { - using (XmlWriter writer = XmlWriter.Create(Path.Combine(_Folder, _FileName), CConfig.XMLSettings)) - { - writer.WriteStartDocument(); - writer.WriteStartElement("root"); - - // ThemeSystemVersion - writer.WriteElementString("SkinSystemVersion", _SkinSystemVersion.ToString()); - - writer.WriteStartElement("Info"); - - writer.WriteElementString("Name", Name); - writer.WriteElementString("Author", _Author); - writer.WriteElementString("SkinVersionMajor", _SkinVersionMajor.ToString()); - writer.WriteElementString("SkinVersionMinor", _SkinVersionMinor.ToString()); - - writer.WriteEndElement(); - - // save colors - _SaveColors(writer); - - writer.WriteStartElement("Skins"); - - foreach (KeyValuePair element in SkinList) - writer.WriteElementString(element.Key, element.Value.Value); - writer.WriteEndElement(); - - writer.WriteStartElement("Videos"); - - foreach (KeyValuePair element in VideoList) - writer.WriteElementString(element.Key, element.Value.Value); - writer.WriteEndElement(); - - // End of File - writer.WriteEndElement(); //end of root - writer.WriteEndDocument(); - - writer.Flush(); - } - } - - private void _SaveColors(XmlWriter writer) - { - if (PartyModeID == -1) - { - writer.WriteStartElement("Colors"); - for (int i = 0; i < _PlayerColors.Length; i++) - { - SColorF? color = _PlayerColors[i]; - if (color == null) - continue; - writer.WriteStartElement("Player" + (i + 1)); - - writer.WriteElementString("R", color.Value.R.ToString("#0.000")); - writer.WriteElementString("G", color.Value.G.ToString("#0.000")); - writer.WriteElementString("B", color.Value.B.ToString("#0.000")); - writer.WriteElementString("A", color.Value.A.ToString("#0.000")); - - writer.WriteEndElement(); - } - writer.WriteEndElement(); - } - - writer.WriteStartElement("ColorSchemes"); - foreach (KeyValuePair kvp in _ColorSchemes) - { - writer.WriteStartElement(kvp.Key); - - writer.WriteElementString("R", kvp.Value.R.ToString("#0.000")); - writer.WriteElementString("G", kvp.Value.G.ToString("#0.000")); - writer.WriteElementString("B", kvp.Value.B.ToString("#0.000")); - writer.WriteElementString("A", kvp.Value.A.ToString("#0.000")); - - writer.WriteEndElement(); - } - writer.WriteEndElement(); - } - #endregion Load/Save - - public bool GetColor(string colorName, out SColorF color) - { - return _ColorSchemes.TryGetValue(colorName, out color) || GetPlayerColor(colorName, out color); - } - - public bool GetPlayerColor(string playerNrString, out SColorF color) - { - color = new SColorF(); - if (playerNrString == null) - return false; - if (playerNrString.StartsWith("Player")) - playerNrString = playerNrString.Substring(6); - int playerNr; - if (!int.TryParse(playerNrString, out playerNr)) - return false; - - return GetPlayerColor(playerNr, out color); - } - - public bool GetPlayerColor(int playerNr, out SColorF color) - { - if (_PlayerColors != null && playerNr >= 1 && playerNr <= _PlayerColors.Length) - { - SColorF? colorTmp = _PlayerColors[playerNr - 1]; - if (colorTmp != null) - { - color = colorTmp.Value; - return true; - } - } - - color = new SColorF(); - return false; - } - - public CVideoStream GetVideo(string videoName, bool loop = true) - { - CVideoSkinElement sk; - if (VideoList.TryGetValue(videoName, out sk)) - { - if (sk.VideoStream == null || sk.VideoStream.IsClosed()) - { - sk.VideoStream = CVideo.Load(Path.Combine(_Folder, sk.Value)); - CVideo.SetLoop(sk.VideoStream, loop); - } - return sk.VideoStream; - } - return null; - } - } -} \ No newline at end of file diff --git a/Vocaluxe/Base/CThemes.cs b/Vocaluxe/Base/CThemes.cs deleted file mode 100644 index 2ce8d9ee..00000000 --- a/Vocaluxe/Base/CThemes.cs +++ /dev/null @@ -1,469 +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.Linq; -using System.Xml; -using Vocaluxe.Base.Fonts; -using VocaluxeLib; -using VocaluxeLib.Draw; -using VocaluxeLib.Xml; - -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; - } - - struct SCursor - { - public string SkinName; - - public float W; - public float H; - - public SThemeColor Color; - } - #endregion Structs - - static class CThemes - { - // Version number for main theme and skin files. Increment it, if you've changed something on the theme files! - private const int _ThemeSystemVersion = 5; - - #region Vars - private static readonly List _Themes = new List(); - public static string[] ThemeNames - { - get { return _Themes.Where(th => th.PartyModeID == -1).Select(th => th.Name).ToArray(); } - } - - private static readonly List _Skins = new List(); - public static string[] SkinNames - { - get { return _Skins.Where(ak => ak.PartyModeID == -1).Select(ak => ak.Name).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 void Close() - { - UnloadSkins(); - } - - 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) - { - return _Skins[skinIndex].Load(); - } - - public static void UnloadSkins() - { - for (int i = 0; i < _Skins.Count; i++) - { - if (_Skins[i].PartyModeID != -1) - continue; - _Skins[i].Unload(); - _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; - - // Load Cursor - if (_Themes[themeIndex].PartyModeID == -1) - _LoadCursor(xmlReader); - - // load fonts - if (_Themes[themeIndex].PartyModeID == -1) - { - CFonts.LoadThemeFonts( - _Themes[themeIndex].Name, - 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() - { - foreach (CSkin skin in _Skins) - skin.SaveSkin(); - } - - 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) - { - CSkin skin = new CSkin(path, file, theme.PartyModeID); - if (skin.Init()) - _Skins.Add(skin); - } - } - #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 (_Skins[i].PartyModeID == partyModeID && _Skins[i].Name == CConfig.Skin) - return i; - } - if (partyModeID >= 0) - { - for (int i = 0; i < _Skins.Count; i++) - { - if (_Skins[i].PartyModeID == partyModeID) - return i; - } - } - for (int i = 0; i < _Skins.Count; i++) - { - if (_Skins[i].PartyModeID < 0 && _Skins[i].Name == CConfig.Skin) - return i; - } - return -1; - } - - private static CSkin _GetSkin(int partyModeID) - { - int index = GetSkinIndex(partyModeID); - return index < 0 ? null : _Skins[index]; - } - - public static int GetThemeIndex(int partyModeID) - { - for (int i = 0; i < _Themes.Count; i++) - { - if (_Themes[i].PartyModeID == partyModeID && _Themes[i].Name == CConfig.Theme) - return i; - } - if (partyModeID >= 0) - { - for (int i = 0; i < _Themes.Count; i++) - { - if (_Themes[i].PartyModeID == partyModeID) - return i; - } - } - for (int i = 0; i < _Themes.Count; i++) - { - if (_Themes[i].PartyModeID < 0 && _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, CSettings.FolderNameScreens); - else - CLog.LogError("Can't find current Theme"); - - return path; - } - - public static CTextureRef 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 CVideoStream GetSkinVideo(string videoName, int partyModeID, bool loop = true) - { - CSkin skin = _GetSkin(partyModeID); - return skin == null ? null : skin.GetVideo(videoName, loop); - } - #endregion Theme and Skin index handling - - #region Cursor save/load - private static void _LoadCursor(CXMLReader xmlReader) - { - 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)) - Cursor.Color.Name = value; - else - { - Cursor.Color.Name = null; - xmlReader.TryGetColorFromRGBA("//root/Cursor", out Cursor.Color.Color); - } - } - - 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.Name)) - writer.WriteElementString("Color", Cursor.Color.Name); - else - { - writer.WriteElementString("R", Cursor.Color.Color.R.ToString("#0.000")); - writer.WriteElementString("G", Cursor.Color.Color.G.ToString("#0.000")); - writer.WriteElementString("B", Cursor.Color.Color.B.ToString("#0.000")); - writer.WriteElementString("A", Cursor.Color.Color.A.ToString("#0.000")); - } - - writer.WriteEndElement(); - } - #endregion Cursor save/load - - #region Color Handling - public static bool GetColor(string colorName, int partyModeID, out SColorF color) - { - int skinIndex = GetSkinIndex(partyModeID); - - if (_Skins[skinIndex].GetColor(colorName, out color)) - return true; - - if (partyModeID < 0) - return false; - return GetColor(colorName, -1, out color); - } - - public static SColorF GetPlayerColor(int playerNr) - { - bool dummy; - return GetPlayerColor(playerNr, out dummy); - } - - 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) - { - SColorF color; - success = _Skins[skinIndex].GetPlayerColor(playerNr, out color); - return color; - } - #endregion Color Handling - } -} \ No newline at end of file diff --git a/Vocaluxe/Base/CVideoPlayer.cs b/Vocaluxe/Base/CVideoPlayer.cs index 5cc6c559..0790191f 100644 --- a/Vocaluxe/Base/CVideoPlayer.cs +++ b/Vocaluxe/Base/CVideoPlayer.cs @@ -1,4 +1,5 @@ using System.Diagnostics; +using Vocaluxe.Base.ThemeSystem; using Vocaluxe.Lib.Video; using VocaluxeLib; using VocaluxeLib.Draw; diff --git a/Vocaluxe/Base/Fonts/CFonts.cs b/Vocaluxe/Base/Fonts/CFonts.cs index a2f0b4cb..5b9c3e34 100644 --- a/Vocaluxe/Base/Fonts/CFonts.cs +++ b/Vocaluxe/Base/Fonts/CFonts.cs @@ -418,6 +418,22 @@ namespace Vocaluxe.Base.Fonts } } + public static void UnloadPartyModeFonts(int partyModeID) + { + Debug.Assert(partyModeID >= 0); + int index = 0; + while (index < _FontFamilies.Count) + { + if (_FontFamilies[index].PartyModeID == partyModeID) + { + _FontFamilies[index].Dispose(); + _FontFamilies.RemoveAt(index); + } + else + index++; + } + } + private static void _BuildGlyphs() { const string text = " abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890"; diff --git a/Vocaluxe/Base/ThemeSystem/CSkin.cs b/Vocaluxe/Base/ThemeSystem/CSkin.cs new file mode 100644 index 00000000..ac4bea9e --- /dev/null +++ b/Vocaluxe/Base/ThemeSystem/CSkin.cs @@ -0,0 +1,214 @@ +using System; +using System.Collections.Generic; +using System.Diagnostics; +using System.IO; +using VocaluxeLib; +using VocaluxeLib.Draw; +using VocaluxeLib.Xml; + +namespace Vocaluxe.Base.ThemeSystem +{ + class CVideoSkinElement + { + public string FileName; + public CVideoStream VideoStream; + } + + class CSkin + { + private const int _SkinSystemVersion = 3; + + private readonly string _Folder; + private readonly string _FileName; + public readonly int PartyModeID; + + private SInfo _Info; + public String Name + { + get { return _Info.Name; } + } + + public readonly Dictionary Textures = new Dictionary(); + private readonly Dictionary _Videos = new Dictionary(); + + private readonly Dictionary _ColorSchemes = new Dictionary(); + private SColorF[] _PlayerColors; + + private bool _IsLoaded; + + public CSkin(string folder, string file, int partyModeId) + { + _Folder = folder; + _FileName = file; + PartyModeID = partyModeId; + } + + public override string ToString() + { + return Name; + } + + #region Load + public bool Init() + { + CXMLReader xmlReader = CXMLReader.OpenFile(Path.Combine(_Folder, _FileName)); + if (xmlReader == null) + return false; + + if (!xmlReader.CheckVersion("//root/SkinSystemVersion", _SkinSystemVersion)) + return false; + + bool ok = xmlReader.Read("//root/Info", out _Info); + + if (!ok) + { + CLog.LogError("Can't load skin \"" + _FileName + "\". Invalid file!"); + return false; + } + + return true; + } + + public bool Load() + { + if (_IsLoaded) + return true; + Debug.Assert(Textures.Count == 0 && _Videos.Count == 0); + CXMLReader xmlReader = CXMLReader.OpenFile(Path.Combine(_Folder, _FileName)); + if (xmlReader == null) + return false; + + // load skins/textures + List names = xmlReader.GetNames("//root/Skins/*"); + foreach (string name in names) + { + string fileName; + xmlReader.GetValue("//root/Skins/" + name, out fileName); + CTextureRef texture = CDraw.AddTexture(Path.Combine(_Folder, fileName)); + if (texture == null) + { + CLog.LogError("Error on loading texture \"" + name + "\": " + fileName, true); + return false; + } + Textures.Add(name, texture); + } + + // load videos + names = xmlReader.GetNames("//root/Videos/*"); + foreach (string name in names) + { + CVideoSkinElement sk = new CVideoSkinElement(); + xmlReader.GetValue("//root/Videos/" + name, out sk.FileName); + if (!File.Exists(Path.Combine(_Folder, sk.FileName))) + { + CLog.LogError("Video \"" + name + "\": (" + sk.FileName + ") not found!", true); + return false; + } + _Videos.Add(name, sk); + } + + // load colors + if (_LoadColors(xmlReader)) + return false; + + _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(); + _PlayerColors = null; + _ColorSchemes.Clear(); + + _IsLoaded = false; + } + + private bool _LoadColors(CXMLReader xmlReader) + { + if (PartyModeID == -1) + { + _PlayerColors = new SColorF[CSettings.MaxNumPlayer]; + + for (int i = 0; i < CSettings.MaxNumPlayer; i++) + { + SColorF color; + if (!xmlReader.TryGetColorFromRGBA("//root/Colors/Player" + (i + 1), out color)) + return false; + _PlayerColors[i] = color; + } + } + + List names = xmlReader.GetNames("//root/ColorSchemes/*"); + foreach (string str in names) + { + SColorF color; + if (!xmlReader.TryGetColorFromRGBA("//root/ColorSchemes/" + str, out color)) + return false; + _ColorSchemes.Add(str, color); + } + return true; + } + #endregion Load + + public bool GetColor(string colorName, out SColorF color) + { + return _ColorSchemes.TryGetValue(colorName, out color) || _GetPlayerColor(colorName, out color); + } + + private bool _GetPlayerColor(string playerNrString, out SColorF color) + { + color = new SColorF(); + if (playerNrString == null) + return false; + if (playerNrString.StartsWith("Player")) + playerNrString = playerNrString.Substring(6); + int playerNr; + if (!int.TryParse(playerNrString, out playerNr)) + return false; + + return GetPlayerColor(playerNr, out color); + } + + public bool GetPlayerColor(int playerNr, out SColorF color) + { + if (_PlayerColors != null && playerNr >= 1 && playerNr <= _PlayerColors.Length) + { + color = _PlayerColors[playerNr - 1]; + return true; + } + + color = new SColorF(); + return false; + } + + public CVideoStream GetVideo(string videoName, bool loop = true) + { + 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 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..5aa8a0db --- /dev/null +++ b/Vocaluxe/Base/ThemeSystem/CTheme.cs @@ -0,0 +1,189 @@ +using System; +using System.Collections.Generic; +using System.Diagnostics; +using System.IO; +using System.Linq; +using Vocaluxe.Base.Fonts; +using VocaluxeLib; +using VocaluxeLib.Xml; + +namespace Vocaluxe.Base.ThemeSystem +{ + struct SThemeCursor + { + public string SkinName; + + public float W; + public float H; + + public SThemeColor Color; + } + + class CTheme + { + // Version number for theme files. Increment it, if you've changed something on the theme files! + private const int _ThemeSystemVersion = 5; + + private SInfo _Info; + public String Name + { + get { return _Info.Name; } + } + + public string[] SkinNames + { + get { return _Skins.Keys.ToArray(); } + } + + private readonly string _Folder; + private readonly string _FileName; + public readonly int PartyModeID; + + public SThemeCursor CursorTheme; + public CSkin CurrentSkin { get; private set; } + + private readonly Dictionary _Skins = new Dictionary(); + + private bool _IsLoaded; + + public 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() + { + CXMLReader xmlReader = CXMLReader.OpenFile(Path.Combine(_Folder, _FileName)); + if (xmlReader == null) + return false; + + if (!xmlReader.CheckVersion("//root/ThemeSystemVersion", _ThemeSystemVersion)) + return false; + + bool ok = xmlReader.Read("//root/Info", out _Info); + + if (!ok) + { + CLog.LogError("Can't load theme \"" + _FileName + "\". Invalid file!"); + return false; + } + + string path = Path.Combine(_Folder, Name); + List files = CHelper.ListFiles(path, "*.xml"); + + // Load skins, succeed if at least 1 skin was loaded + ok = false; + foreach (string file in files) + { + CSkin skin = new CSkin(path, file, PartyModeID); + if (skin.Init()) + { + _Skins.Add(skin.Name, skin); + ok = true; + } + } + return ok; + } + + public bool Load() + { + if (_IsLoaded) + return true; + CXMLReader xmlReader = CXMLReader.OpenFile(Path.Combine(_Folder, _FileName)); + if (xmlReader == null) + return false; + + if (!_LoadSkin()) + return false; + bool ok; + if (PartyModeID == -1) + { + ok = _LoadCursor(xmlReader); + ok &= CFonts.LoadThemeFonts(Name, Path.Combine(_Folder, Name, CSettings.FolderNameThemeFonts), xmlReader); + } + else + ok = CFonts.LoadPartyModeFonts(PartyModeID, Path.Combine(_Folder, "..", CSettings.FolderNamePartyModeFonts), xmlReader); + _IsLoaded = ok; + return ok; + } + + private bool _LoadSkin() + { + CSkin skin; + if (!_Skins.TryGetValue(CConfig.Skin, out skin)) + { + if (PartyModeID < 0) + skin = _Skins.Values.FirstOrDefault(); + else if (Name == CSettings.DefaultName) + { + if (!_Skins.TryGetValue(CSettings.DefaultName, out skin)) + skin = _Skins.Values.FirstOrDefault(); + } + } + while (skin != null) + { + if (skin.Load()) + break; + skin.Unload(); + CLog.LogError("Failed to load skin " + Name + ":" + skin + "! Removing...", true); + _Skins.Remove(skin.Name); + skin = (PartyModeID == -1 || Name == CSettings.DefaultName) ? _Skins.Values.FirstOrDefault() : null; + } + if (skin == null) + return false; + CurrentSkin = skin; + return true; + } + + private bool _LoadCursor(CXMLReader xmlReader) + { + bool ok = xmlReader.GetValue("//root/Cursor/Skin", out CursorTheme.SkinName); + + ok &= xmlReader.TryGetFloatValue("//root/Cursor/W", ref CursorTheme.W); + ok &= xmlReader.TryGetFloatValue("//root/Cursor/H", ref CursorTheme.H); + + if (!xmlReader.GetValue("//root/Cursor/Color/Name", out CursorTheme.Color.Name)) + ok &= xmlReader.TryGetColorFromRGBA("//root/Cursor/Color/Color", out CursorTheme.Color.Color); + + return ok; + } + + public void Unload() + { + if (CurrentSkin != null) + { + CurrentSkin.Unload(); + CurrentSkin = null; + } + if (PartyModeID == -1) + CFonts.UnloadThemeFonts(Name); + else + CFonts.UnloadPartyModeFonts(PartyModeID); + _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..97661eee --- /dev/null +++ b/Vocaluxe/Base/ThemeSystem/CThemes.cs @@ -0,0 +1,225 @@ +#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.PartyModeID == -1).Select(th => th.Name).ToArray(); } + } + + public static string[] SkinNames + { + get { return _GetTheme(-1).SkinNames; } + } + + public static bool Init() + { + return ReadThemesFromFolder(Path.Combine(CSettings.ProgramFolder, CSettings.FolderNameThemes), -1); + } + + public static void Close() + { + Unload(); + _Themes.Clear(); + } + + public static void Unload() + { + foreach (CTheme theme in _Themes) + theme.Unload(); + } + + /// + /// 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 = _GetTheme(-1) ?? _Themes.FirstOrDefault(th => th.PartyModeID == -1); + 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.PartyModeID == -1); + } + if (theme == null) + CLog.LogError("No themes found! Cannot continue!", true, true); + else + { + CConfig.Theme = theme.Name; + CConfig.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) + { + CTheme theme = _GetTheme(partyModeID); + if (theme.Load()) + return true; + theme.Unload(); + if (theme.Name != CSettings.DefaultName) + { + CLog.LogError("Failed to load theme " + theme + " for partymode! Removing...", true); + _Themes.Remove(theme); + theme = _GetTheme(partyModeID); + if (theme.Load()) + return true; + } + CLog.LogError("Failed to load default theme for partymode! Unloading partymode!", true); + foreach (CTheme 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() + { + _GetTheme(-1).ReloadSkin(); + } + + public static bool ReadThemesFromFolder(string path, int partyModeID) + { + Debug.Assert(_Themes.Count == 0); + + List files = CHelper.ListFiles(path, "*.xml", false, true); + + List newThemes = new List(); + foreach (string file in files) + { + CTheme theme = new CTheme(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; + } + + private static CTheme _GetTheme(int partyModeID) + { + foreach (CTheme theme in _Themes) + { + if (theme.PartyModeID == partyModeID && theme.Name == CConfig.Theme) + return theme; + } + if (partyModeID >= 0) + { + foreach (CTheme theme in _Themes) + { + if (theme.PartyModeID == partyModeID && theme.Name == CSettings.DefaultName) + return theme; + } + Debug.Assert(false, "Partymode misses default theme, this should be checked during partymode loading!"); + } + return null; + } + + public static string GetThemeScreensPath(int partyModeID) + { + return _GetTheme(partyModeID).GetScreenPath(); + } + + private static void _LogMissingElement(CTheme theme, string elType, string elName) + { + CLog.LogError("Skin " + theme + ":" + theme.CurrentSkin + " is missing the " + elType + " \"" + elName + "\"! Expect visual problems!"); + } + + public static CTextureRef GetSkinTexture(string textureName, int partyModeID) + { + Debug.Assert(!String.IsNullOrEmpty(textureName)); + CTheme theme = _GetTheme(partyModeID); + CTextureRef texture = theme.CurrentSkin.GetTexture(textureName); + if (texture == null && partyModeID >= 0) + texture = _GetTheme(-1).CurrentSkin.GetTexture(textureName); + if (texture == null) + _LogMissingElement(theme, "texture", textureName); + return texture; + } + + public static CVideoStream GetSkinVideo(string videoName, int partyModeID, bool loop = true) + { + Debug.Assert(!String.IsNullOrEmpty(videoName)); + CTheme theme = _GetTheme(partyModeID); + CVideoStream video = theme.CurrentSkin.GetVideo(videoName, loop); + if (video == null && partyModeID >= 0) + video = _GetTheme(-1).CurrentSkin.GetVideo(videoName, loop); + if (video == null) + _LogMissingElement(theme, "video", videoName); + return video; + } + + public static SThemeCursor GetCursorTheme() + { + return _GetTheme(-1).CursorTheme; + } + + public static bool GetColor(string colorName, int partyModeID, out SColorF color) + { + Debug.Assert(!String.IsNullOrEmpty(colorName)); + CTheme theme = _GetTheme(partyModeID); + if (!theme.CurrentSkin.GetColor(colorName, out color) && (partyModeID == -1 || !_GetTheme(-1).CurrentSkin.GetColor(colorName, out color))) + { + _LogMissingElement(theme, "color", colorName); + return false; + } + return true; + } + + public static SColorF GetPlayerColor(int playerNr) + { + SColorF color; + if (!_GetTheme(-1).CurrentSkin.GetPlayerColor(playerNr, 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/Program.cs b/Vocaluxe/Program.cs index ce373392..8686be54 100644 --- a/Vocaluxe/Program.cs +++ b/Vocaluxe/Program.cs @@ -26,6 +26,7 @@ using System.Windows.Forms; using Vocaluxe.Base; using Vocaluxe.Base.Fonts; using Vocaluxe.Base.Server; +using Vocaluxe.Base.ThemeSystem; namespace Vocaluxe { @@ -187,6 +188,10 @@ namespace Vocaluxe throw new CLoadingException("theme"); CLog.StopBenchmark("Init Theme"); + CLog.StartBenchmark("Load Theme"); + CThemes.Load(); + CLog.StopBenchmark("Load Theme"); + Application.DoEvents(); // Load Cover diff --git a/Vocaluxe/Screens/CScreenOptionsRecord.cs b/Vocaluxe/Screens/CScreenOptionsRecord.cs index eb954877..09cd1aee 100644 --- a/Vocaluxe/Screens/CScreenOptionsRecord.cs +++ b/Vocaluxe/Screens/CScreenOptionsRecord.cs @@ -19,6 +19,7 @@ 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; diff --git a/Vocaluxe/Screens/CScreenOptionsTheme.cs b/Vocaluxe/Screens/CScreenOptionsTheme.cs index 2c022579..b03ccee4 100644 --- a/Vocaluxe/Screens/CScreenOptionsTheme.cs +++ b/Vocaluxe/Screens/CScreenOptionsTheme.cs @@ -15,9 +15,10 @@ // 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; @@ -42,9 +43,7 @@ namespace Vocaluxe.Screens private const string _ButtonExit = "ButtonExit"; - private int _OldCoverTheme; - private int _OldTheme; - private int _OldSkin; + private string _OldCoverTheme; public override void Init() { @@ -68,12 +67,6 @@ namespace Vocaluxe.Screens { base.LoadTheme(xmlPath); - _SelectSlides[_SelectSlideTheme].AddValues(CThemes.ThemeNames); - _SelectSlides[_SelectSlideTheme].Selection = CThemes.GetThemeIndex(-1); - - _SelectSlides[_SelectSlideSkin].AddValues(CThemes.SkinNames); - _SelectSlides[_SelectSlideSkin].Selection = CThemes.GetSkinIndex(-1); - _SelectSlides[_SelectSlideCover].AddValues(CCover.CoverThemes); _SelectSlides[_SelectSlideCover].Selection = CCover.GetCoverThemeIndex(); _SelectSlides[_SelectSlideNoteLines].SetValues((int)CConfig.DrawNoteLines); @@ -140,9 +133,20 @@ namespace Vocaluxe.Screens { base.OnShow(); - _OldCoverTheme = CCover.GetCoverThemeIndex(); - _OldTheme = CThemes.GetThemeIndex(-1); - _OldSkin = CThemes.GetSkinIndex(-1); + _ResetSlides(); + + _OldCoverTheme = CConfig.CoverTheme; + } + + private void _ResetSlides() + { + _SelectSlides[_SelectSlideTheme].Clear(); + _SelectSlides[_SelectSlideTheme].AddValues(CThemes.ThemeNames); + _SelectSlides[_SelectSlideTheme].Selection = Array.IndexOf(CThemes.ThemeNames, CConfig.Theme); + + _SelectSlides[_SelectSlideSkin].Clear(); + _SelectSlides[_SelectSlideSkin].AddValues(CThemes.SkinNames); + _SelectSlides[_SelectSlideSkin].Selection = Array.IndexOf(CThemes.SkinNames, CConfig.Skin); } public override bool UpdateGame() @@ -150,12 +154,6 @@ namespace Vocaluxe.Screens return true; } - public override bool Draw() - { - base.Draw(); - return true; - } - private void _Close() { _SaveConfig(); @@ -164,8 +162,6 @@ namespace Vocaluxe.Screens private void _SaveConfig() { - CConfig.Theme = CThemes.ThemeNames[_SelectSlides[_SelectSlideTheme].Selection]; - CConfig.Skin = CThemes.SkinNames[_SelectSlides[_SelectSlideSkin].Selection]; CConfig.CoverTheme = CCover.CoverThemes[_SelectSlides[_SelectSlideCover].Selection]; CConfig.DrawNoteLines = (EOffOn)_SelectSlides[_SelectSlideNoteLines].Selection; CConfig.DrawToneHelper = (EOffOn)_SelectSlides[_SelectSlideToneHelper].Selection; @@ -175,59 +171,30 @@ namespace Vocaluxe.Screens CConfig.SaveConfig(); - if (_OldCoverTheme != _SelectSlides[_SelectSlideCover].Selection) + if (_OldCoverTheme != _SelectSlides[_SelectSlideCover].Value) CCover.ReloadCovers(); - - if (_OldTheme != _SelectSlides[_SelectSlideTheme].Selection) - { - CConfig.Theme = CThemes.ThemeNames[_SelectSlides[_SelectSlideTheme].Selection]; - _OldTheme = _SelectSlides[_SelectSlideTheme].Selection; - - CThemes.UnloadSkins(); - CFonts.UnloadThemeFonts(CConfig.Theme); - CThemes.ListSkins(); - CConfig.Skin = CThemes.SkinNames[0]; - _OldSkin = 0; - - CConfig.SaveConfig(); - - CThemes.LoadSkins(); - CThemes.LoadTheme(); - CGraphics.ReloadTheme(); - } } private void _OnChange() { - if (_OldTheme != _SelectSlides[_SelectSlideTheme].Selection) + if (CConfig.Theme != _SelectSlides[_SelectSlideTheme].Value) { - CConfig.Theme = CThemes.ThemeNames[_SelectSlides[_SelectSlideTheme].Selection]; - _OldTheme = _SelectSlides[_SelectSlideTheme].Selection; + CConfig.Theme = _SelectSlides[_SelectSlideTheme].Value; - CThemes.UnloadSkins(); - CFonts.UnloadThemeFonts(CConfig.Theme); - CThemes.ListSkins(); - CConfig.Skin = CThemes.SkinNames[0]; - _OldSkin = 0; - - CConfig.SaveConfig(); - - CThemes.LoadSkins(); - CThemes.LoadTheme(); + CThemes.Reload(); CGraphics.ReloadTheme(); - - OnShow(); - OnShowFinish(); + _ResetSlides(); + _ResumeBG(); return; } - if (_OldSkin != _SelectSlides[_SelectSlideSkin].Selection) + if (CConfig.Skin != _SelectSlides[_SelectSlideSkin].Value) { - _OldSkin = _SelectSlides[_SelectSlideSkin].Selection; + CConfig.Skin = _SelectSlides[_SelectSlideSkin].Value; - _PauseBG(); - CConfig.Skin = CThemes.SkinNames[_OldSkin]; + CThemes.ReloadSkin(); CGraphics.ReloadSkin(); + _ResetSlides(); _ResumeBG(); } } diff --git a/Vocaluxe/Screens/CScreenSing.cs b/Vocaluxe/Screens/CScreenSing.cs index d72a214a..64e59518 100644 --- a/Vocaluxe/Screens/CScreenSing.cs +++ b/Vocaluxe/Screens/CScreenSing.cs @@ -24,6 +24,7 @@ using System.Linq; using System.Windows.Forms; using Vocaluxe.Base; using Vocaluxe.Base.Fonts; +using Vocaluxe.Base.ThemeSystem; using Vocaluxe.Lib.Video; using VocaluxeLib; using VocaluxeLib.Draw; diff --git a/Vocaluxe/Vocaluxe.csproj b/Vocaluxe/Vocaluxe.csproj index d3014e50..db195a8d 100644 --- a/Vocaluxe/Vocaluxe.csproj +++ b/Vocaluxe/Vocaluxe.csproj @@ -219,8 +219,9 @@ + - + @@ -263,7 +264,7 @@ - + diff --git a/VocaluxeLib/IBasic.cs b/VocaluxeLib/IBasic.cs index 594b04fe..2b64940b 100644 --- a/VocaluxeLib/IBasic.cs +++ b/VocaluxeLib/IBasic.cs @@ -101,17 +101,12 @@ namespace VocaluxeLib public interface IThemes { string GetThemeScreensPath(int partyModeID); - int GetSkinIndex(int partyModeID); CTextureRef GetSkinTexture(string textureName, int partyModeID); CVideoStream GetSkinVideo(string videoName, int partyModeID, bool loop); 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 diff --git a/VocaluxeLib/Menu/CBackground.cs b/VocaluxeLib/Menu/CBackground.cs index 6fdb7b39..c032cd0f 100644 --- a/VocaluxeLib/Menu/CBackground.cs +++ b/VocaluxeLib/Menu/CBackground.cs @@ -87,7 +87,7 @@ namespace VocaluxeLib.Menu #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; diff --git a/VocaluxeLib/Menu/CButton.cs b/VocaluxeLib/Menu/CButton.cs index 44a699ba..8d47555d 100644 --- a/VocaluxeLib/Menu/CButton.cs +++ b/VocaluxeLib/Menu/CButton.cs @@ -162,7 +162,7 @@ namespace VocaluxeLib.Menu _SelReflectionSpace = button._SelReflectionSpace; } - 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; @@ -196,12 +196,12 @@ namespace VocaluxeLib.Menu _ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/SA", ref SelColor.A); } - _ThemeLoaded &= Text.LoadTheme(item, "Text", xmlReader, skinIndex, true); + _ThemeLoaded &= Text.LoadTheme(item, "Text", xmlReader, true); Text.Z = Rect.Z; if (xmlReader.ItemExists(item + "/SText")) { _Theme.STextSpecified = true; - _ThemeLoaded &= _SelText.LoadTheme(item, "SText", xmlReader, skinIndex, true); + _ThemeLoaded &= _SelText.LoadTheme(item, "SText", xmlReader, true); _SelText.Z = Rect.Z; } diff --git a/VocaluxeLib/Menu/CEqualizer.cs b/VocaluxeLib/Menu/CEqualizer.cs index 40daa2a6..3a6bf9f2 100644 --- a/VocaluxeLib/Menu/CEqualizer.cs +++ b/VocaluxeLib/Menu/CEqualizer.cs @@ -109,7 +109,7 @@ namespace VocaluxeLib.Menu LoadTextures(); } - 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; diff --git a/VocaluxeLib/Menu/CLyric.cs b/VocaluxeLib/Menu/CLyric.cs index e2cd3460..0caf9c87 100644 --- a/VocaluxeLib/Menu/CLyric.cs +++ b/VocaluxeLib/Menu/CLyric.cs @@ -130,7 +130,7 @@ namespace VocaluxeLib.Menu LoadTextures(); } - 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; diff --git a/VocaluxeLib/Menu/CMenu.cs b/VocaluxeLib/Menu/CMenu.cs index a479abe6..a8b2af70 100644 --- a/VocaluxeLib/Menu/CMenu.cs +++ b/VocaluxeLib/Menu/CMenu.cs @@ -65,7 +65,6 @@ namespace VocaluxeLib.Menu private List _Interactions; private int _Selection; public string ThemePath { get; private set; } - protected int _PartyModeID = -1; private int _PrevMouseX; private int _PrevMouseY; @@ -76,6 +75,7 @@ namespace VocaluxeLib.Menu protected bool _Active; protected abstract int _ScreenVersion { get; } + public int PartyModeID { get; protected set; } public string ThemeName { get; set; } public STheme Theme; @@ -121,6 +121,7 @@ namespace VocaluxeLib.Menu if (ThemeName[0] == 'C' && Char.IsUpper(ThemeName[1])) ThemeName = ThemeName.Remove(0, 1); + PartyModeID = -1; _Interactions = new List(); _Selection = 0; @@ -170,14 +171,14 @@ namespace VocaluxeLib.Menu #region ThemeHandler private delegate void AddElementHandler(T element, String key); - private void _LoadThemeElement(IEnumerable elements, AddElementHandler addElementHandler, CXMLReader xmlReader, int skinIndex) where T : IMenuElement + private void _LoadThemeElement(IEnumerable elements, AddElementHandler addElementHandler, CXMLReader xmlReader) where T : IMenuElement { if (elements != null) { foreach (string elName in elements) { - var element = (T)Activator.CreateInstance(typeof(T), _PartyModeID); - if (element.LoadTheme("//root/" + ThemeName, elName, xmlReader, skinIndex)) + var element = (T)Activator.CreateInstance(typeof(T), PartyModeID); + if (element.LoadTheme("//root/" + ThemeName, elName, xmlReader)) addElementHandler(element, elName); else CBase.Log.LogError("Can't load " + typeof(T).Name.Substring(1) + " \"" + elName + "\" in screen " + ThemeName); @@ -196,7 +197,6 @@ namespace VocaluxeLib.Menu ThemePath = xmlPath; string file = Path.Combine(xmlPath, ThemeName + ".xml"); - int skinIndex = CBase.Themes.GetSkinIndex(_PartyModeID); Theme.ScreenInformation = new SScreenInformation(); Theme.Backgrounds = new List(); @@ -220,43 +220,43 @@ namespace VocaluxeLib.Menu Theme = (STheme)deserializer.Deserialize(textReader); foreach (SThemeBackground bg in Theme.Backgrounds) - _AddBackground(new CBackground(bg, _PartyModeID), bg.Name); + _AddBackground(new CBackground(bg, PartyModeID), bg.Name); foreach (SThemeButton bt in Theme.Buttons) - _AddButton(new CButton(bt, _PartyModeID), bt.Name); + _AddButton(new CButton(bt, PartyModeID), bt.Name); foreach (SThemeEqualizer eq in Theme.Equalizers) - _AddEqualizer(new CEqualizer(eq, _PartyModeID), eq.Name); + _AddEqualizer(new CEqualizer(eq, PartyModeID), eq.Name); foreach (SThemeLyrics ly in Theme.Lyrics) - _AddLyric(new CLyric(ly, _PartyModeID), ly.Name); + _AddLyric(new CLyric(ly, PartyModeID), ly.Name); foreach (SThemeNameSelection ns in Theme.NameSelections) - _AddNameSelection(new CNameSelection(ns, _PartyModeID), ns.Name); + _AddNameSelection(new CNameSelection(ns, PartyModeID), ns.Name); foreach (SThemeParticleEffect pe in Theme.ParticleEffects) - _AddParticleEffect(new CParticleEffect(pe, _PartyModeID), pe.Name); + _AddParticleEffect(new CParticleEffect(pe, PartyModeID), pe.Name); foreach (SThemePlaylist pl in Theme.Playlists) - _AddPlaylist(new CPlaylist(pl, _PartyModeID), pl.Name); + _AddPlaylist(new CPlaylist(pl, PartyModeID), pl.Name); foreach (SScreenSetting ss in Theme.ScreenSettings) - _AddScreenSetting(new CScreenSetting(ss, _PartyModeID), ss.Name); + _AddScreenSetting(new CScreenSetting(ss, PartyModeID), ss.Name); foreach (SThemeSelectSlide sl in Theme.SelectSlides) - _AddSelectSlide(new CSelectSlide(sl, _PartyModeID), sl.Name); + _AddSelectSlide(new CSelectSlide(sl, PartyModeID), sl.Name); foreach (SThemeSingBar sb in Theme.SingNotes) - _AddSingNote(new CSingNotesClassic(sb, _PartyModeID), sb.Name); + _AddSingNote(new CSingNotesClassic(sb, PartyModeID), sb.Name); foreach (SThemeSongMenu sm in Theme.SongMenus) - _AddSongMenu(new CSongMenu(sm, _PartyModeID), sm.Name); + _AddSongMenu(new CSongMenu(sm, PartyModeID), sm.Name); foreach (SThemeStatic st in Theme.Statics) - _AddStatic(new CStatic(st, _PartyModeID), st.Name); + _AddStatic(new CStatic(st, PartyModeID), st.Name); foreach (SThemeText te in Theme.Texts) - _AddText(new CText(te, _PartyModeID), te.Name); + _AddText(new CText(te, PartyModeID), te.Name); } catch (InvalidOperationException e) { @@ -278,26 +278,24 @@ namespace VocaluxeLib.Menu bool versionCheck = _CheckVersion(_ScreenVersion, xmlReader); - int skinIndex = CBase.Themes.GetSkinIndex(_PartyModeID); - - if (versionCheck && skinIndex != -1) + if (versionCheck) { ThemePath = xmlPath; - _LoadThemeBasics(xmlReader, skinIndex); + _LoadThemeBasics(xmlReader); - _LoadThemeElement(_ThemeBackgrounds, _AddBackground, xmlReader, skinIndex); - _LoadThemeElement(_ThemeStatics, _AddStatic, xmlReader, skinIndex); - _LoadThemeElement(_ThemeTexts, _AddText, xmlReader, skinIndex); - _LoadThemeElement(_ThemeButtons, _AddButton, xmlReader, skinIndex); - _LoadThemeElement(_ThemeSelectSlides, _AddSelectSlide, xmlReader, skinIndex); - _LoadThemeElement(_ThemeSongMenus, _AddSongMenu, xmlReader, skinIndex); - _LoadThemeElement(_ThemeLyrics, _AddLyric, xmlReader, skinIndex); - _LoadThemeElement(_ThemeSingNotes, _AddSingNote, xmlReader, skinIndex); - _LoadThemeElement(_ThemeNameSelections, _AddNameSelection, xmlReader, skinIndex); - _LoadThemeElement(_ThemeEqualizers, _AddEqualizer, xmlReader, skinIndex); - _LoadThemeElement(_ThemePlaylists, _AddPlaylist, xmlReader, skinIndex); - _LoadThemeElement(_ThemeParticleEffects, _AddParticleEffect, xmlReader, skinIndex); - _LoadThemeElement(_ThemeScreenSettings, _AddScreenSetting, xmlReader, skinIndex); + _LoadThemeElement(_ThemeBackgrounds, _AddBackground, xmlReader); + _LoadThemeElement(_ThemeStatics, _AddStatic, xmlReader); + _LoadThemeElement(_ThemeTexts, _AddText, xmlReader); + _LoadThemeElement(_ThemeButtons, _AddButton, xmlReader); + _LoadThemeElement(_ThemeSelectSlides, _AddSelectSlide, xmlReader); + _LoadThemeElement(_ThemeSongMenus, _AddSongMenu, xmlReader); + _LoadThemeElement(_ThemeLyrics, _AddLyric, xmlReader); + _LoadThemeElement(_ThemeSingNotes, _AddSingNote, xmlReader); + _LoadThemeElement(_ThemeNameSelections, _AddNameSelection, xmlReader); + _LoadThemeElement(_ThemeEqualizers, _AddEqualizer, xmlReader); + _LoadThemeElement(_ThemePlaylists, _AddPlaylist, xmlReader); + _LoadThemeElement(_ThemeParticleEffects, _AddParticleEffect, xmlReader); + _LoadThemeElement(_ThemeScreenSettings, _AddScreenSetting, xmlReader); } Theme.ScreenInformation.ScreenName = ThemeName; @@ -537,7 +535,7 @@ namespace VocaluxeLib.Menu // ReSharper disable MemberCanBeProtected.Global public CButton GetNewButton() { - return new CButton(_PartyModeID); + return new CButton(PartyModeID); } public static CButton GetNewButton(CButton button) @@ -547,7 +545,7 @@ namespace VocaluxeLib.Menu public CText GetNewText() { - return new CText(_PartyModeID); + return new CText(PartyModeID); } public static CText GetNewText(CText text) @@ -562,12 +560,12 @@ namespace VocaluxeLib.Menu public CBackground GetNewBackground() { - return new CBackground(_PartyModeID); + return new CBackground(PartyModeID); } public CStatic GetNewStatic() { - return new CStatic(_PartyModeID); + return new CStatic(PartyModeID); } public static CStatic GetNewStatic(CStatic oldStatic) @@ -577,12 +575,12 @@ namespace VocaluxeLib.Menu public CStatic GetNewStatic(CTextureRef texture, SColorF color, SRectF rect) { - return new CStatic(_PartyModeID, texture, color, rect); + return new CStatic(PartyModeID, texture, color, rect); } public CSelectSlide GetNewSelectSlide() { - return new CSelectSlide(_PartyModeID); + return new CSelectSlide(PartyModeID); } public static CSelectSlide GetNewSelectSlide(CSelectSlide slide) @@ -592,37 +590,37 @@ namespace VocaluxeLib.Menu public CSongMenu GetNewSongMenu() { - return new CSongMenu(_PartyModeID); + return new CSongMenu(PartyModeID); } public CLyric GetNewLyric() { - return new CLyric(_PartyModeID); + return new CLyric(PartyModeID); } public CSingNotes GetNewSingNotes() { - return new CSingNotesClassic(_PartyModeID); + return new CSingNotesClassic(PartyModeID); } public CNameSelection GetNewNameSelection() { - return new CNameSelection(_PartyModeID); + return new CNameSelection(PartyModeID); } public CEqualizer GetNewEqualizer() { - return new CEqualizer(_PartyModeID); + return new CEqualizer(PartyModeID); } public CPlaylist GetNewPlaylist() { - return new CPlaylist(_PartyModeID); + return new CPlaylist(PartyModeID); } public CParticleEffect GetNewParticleEffect(int maxNumber, SColorF color, SRectF area, CTextureRef texture, float size, EParticleType type) { - return new CParticleEffect(_PartyModeID, maxNumber, color, area, texture, size, type); + return new CParticleEffect(PartyModeID, maxNumber, color, area, texture, size, type); } // ReSharper restore MemberCanBeProtected.Global @@ -1901,55 +1899,52 @@ namespace VocaluxeLib.Menu return false; } - private void _LoadThemeBasics(CXMLReader xmlReader, int skinIndex) + private void _LoadThemeBasics(CXMLReader xmlReader) { // Backgrounds - var background = new CBackground(_PartyModeID); + var background = new CBackground(PartyModeID); int i = 1; - while (background.LoadTheme("//root/" + ThemeName, "Background" + i, xmlReader, skinIndex)) + while (background.LoadTheme("//root/" + ThemeName, "Background" + i, xmlReader)) { _AddBackground(background); - background = new CBackground(_PartyModeID); + background = new CBackground(PartyModeID); i++; } // Statics - var stat = new CStatic(_PartyModeID); + var stat = new CStatic(PartyModeID); i = 1; - while (stat.LoadTheme("//root/" + ThemeName, "Static" + i, xmlReader, skinIndex)) + while (stat.LoadTheme("//root/" + ThemeName, "Static" + i, xmlReader)) { _AddStatic(stat); - stat = new CStatic(_PartyModeID); + stat = new CStatic(PartyModeID); i++; } // Texts - var text = new CText(_PartyModeID); + var text = new CText(PartyModeID); i = 1; - while (text.LoadTheme("//root/" + ThemeName, "Text" + i, xmlReader, skinIndex)) + while (text.LoadTheme("//root/" + ThemeName, "Text" + i, xmlReader)) { _AddText(text); - text = new CText(_PartyModeID); + text = new CText(PartyModeID); i++; } // ParticleEffects - var partef = new CParticleEffect(_PartyModeID); + var partef = new CParticleEffect(PartyModeID); i = 1; - while (partef.LoadTheme("//root/" + ThemeName, "ParticleEffect" + i, xmlReader, skinIndex)) + while (partef.LoadTheme("//root/" + ThemeName, "ParticleEffect" + i, xmlReader)) { _AddParticleEffect(partef); - partef = new CParticleEffect(_PartyModeID); + partef = new CParticleEffect(PartyModeID); i++; } } private void _ReloadThemeEditMode() { - CBase.Themes.UnloadSkins(); - CBase.Themes.ListSkins(); - CBase.Themes.LoadSkins(); - CBase.Themes.LoadTheme(); + CBase.Themes.Reload(); CBase.Graphics.ReloadTheme(); OnShow(); diff --git a/VocaluxeLib/Menu/CMenuParty.cs b/VocaluxeLib/Menu/CMenuParty.cs index cbb68aff..865f8b35 100644 --- a/VocaluxeLib/Menu/CMenuParty.cs +++ b/VocaluxeLib/Menu/CMenuParty.cs @@ -31,7 +31,7 @@ namespace VocaluxeLib.Menu public void SetPartyModeID(int partyModeID) { - _PartyModeID = partyModeID; + PartyModeID = partyModeID; } public void AssignPartyMode(IPartyMode partyMode) diff --git a/VocaluxeLib/Menu/CNameSelection.cs b/VocaluxeLib/Menu/CNameSelection.cs index 3c230aaa..c0976af6 100644 --- a/VocaluxeLib/Menu/CNameSelection.cs +++ b/VocaluxeLib/Menu/CNameSelection.cs @@ -154,7 +154,7 @@ namespace VocaluxeLib.Menu UpdateList(0); } - 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; diff --git a/VocaluxeLib/Menu/CParticle.cs b/VocaluxeLib/Menu/CParticle.cs index b8d8fc2a..251c29de 100644 --- a/VocaluxeLib/Menu/CParticle.cs +++ b/VocaluxeLib/Menu/CParticle.cs @@ -391,7 +391,7 @@ namespace VocaluxeLib.Menu LoadTextures(); } - 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; diff --git a/VocaluxeLib/Menu/CPlaylist.cs b/VocaluxeLib/Menu/CPlaylist.cs index f3f5de8b..13bf5d4e 100644 --- a/VocaluxeLib/Menu/CPlaylist.cs +++ b/VocaluxeLib/Menu/CPlaylist.cs @@ -292,7 +292,7 @@ namespace VocaluxeLib.Menu _Interactions.AddButton(ButtonPlaylistSing); } - 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; @@ -324,19 +324,19 @@ namespace VocaluxeLib.Menu _ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/SBackgroundA", ref BackgroundSelColor.A); } - _ThemeLoaded &= Text1.LoadTheme(item, "TextPart1", xmlReader, skinIndex); + _ThemeLoaded &= Text1.LoadTheme(item, "TextPart1", xmlReader); - _ThemeLoaded &= StaticCover.LoadTheme(item, "StaticCover", xmlReader, skinIndex); - _ThemeLoaded &= StaticPlaylistHeader.LoadTheme(item, "StaticPlaylistHeader", xmlReader, skinIndex); - _ThemeLoaded &= StaticPlaylistFooter.LoadTheme(item, "StaticPlaylistFooter", xmlReader, skinIndex); + _ThemeLoaded &= StaticCover.LoadTheme(item, "StaticCover", xmlReader); + _ThemeLoaded &= StaticPlaylistHeader.LoadTheme(item, "StaticPlaylistHeader", xmlReader); + _ThemeLoaded &= StaticPlaylistFooter.LoadTheme(item, "StaticPlaylistFooter", xmlReader); - _ThemeLoaded &= ButtonPlaylistName.LoadTheme(item, "ButtonPlaylistName", xmlReader, skinIndex); - _ThemeLoaded &= ButtonPlaylistSing.LoadTheme(item, "ButtonPlaylistSing", xmlReader, skinIndex); - _ThemeLoaded &= ButtonPlaylistClose.LoadTheme(item, "ButtonPlaylistClose", xmlReader, skinIndex); - _ThemeLoaded &= ButtonPlaylistSave.LoadTheme(item, "ButtonPlaylistSave", xmlReader, skinIndex); - _ThemeLoaded &= ButtonPlaylistDelete.LoadTheme(item, "ButtonPlaylistDelete", xmlReader, skinIndex); + _ThemeLoaded &= ButtonPlaylistName.LoadTheme(item, "ButtonPlaylistName", xmlReader); + _ThemeLoaded &= ButtonPlaylistSing.LoadTheme(item, "ButtonPlaylistSing", xmlReader); + _ThemeLoaded &= ButtonPlaylistClose.LoadTheme(item, "ButtonPlaylistClose", xmlReader); + _ThemeLoaded &= ButtonPlaylistSave.LoadTheme(item, "ButtonPlaylistSave", xmlReader); + _ThemeLoaded &= ButtonPlaylistDelete.LoadTheme(item, "ButtonPlaylistDelete", xmlReader); - _ThemeLoaded &= SelectSlideGameMode.LoadTheme(item, "SelectSlideGameMode", xmlReader, skinIndex); + _ThemeLoaded &= SelectSlideGameMode.LoadTheme(item, "SelectSlideGameMode", xmlReader); _ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/EntryHeight", ref _Theme.EntryHeight); if (_ThemeLoaded) diff --git a/VocaluxeLib/Menu/CScreenSetting.cs b/VocaluxeLib/Menu/CScreenSetting.cs index e1a07344..18b34436 100644 --- a/VocaluxeLib/Menu/CScreenSetting.cs +++ b/VocaluxeLib/Menu/CScreenSetting.cs @@ -72,7 +72,7 @@ namespace VocaluxeLib.Menu _Theme = theme; } - 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; diff --git a/VocaluxeLib/Menu/CSelectSlide.cs b/VocaluxeLib/Menu/CSelectSlide.cs index c7d307df..5e3e314a 100644 --- a/VocaluxeLib/Menu/CSelectSlide.cs +++ b/VocaluxeLib/Menu/CSelectSlide.cs @@ -140,11 +140,12 @@ namespace VocaluxeLib.Menu public int Selection { get { return _Selection; } - set - { - if (value >= 0 && value < _ValueNames.Count) - _Selection = value; - } + set { _Selection = value.Clamp(0, _ValueNames.Count - 1, false); } + } + + public string Value + { + get { return (_Selection >= 0 && _Selection < _ValueNames.Count) ? _ValueNames[_Selection] : null; } } public int ValueIndex @@ -271,7 +272,7 @@ namespace VocaluxeLib.Menu LoadTextures(); } - 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; diff --git a/VocaluxeLib/Menu/CStatic.cs b/VocaluxeLib/Menu/CStatic.cs index f266b4ad..d4843b86 100644 --- a/VocaluxeLib/Menu/CStatic.cs +++ b/VocaluxeLib/Menu/CStatic.cs @@ -120,7 +120,7 @@ namespace VocaluxeLib.Menu LoadTextures(); } - 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; diff --git a/VocaluxeLib/Menu/CText.cs b/VocaluxeLib/Menu/CText.cs index b21c92ae..93ff634b 100644 --- a/VocaluxeLib/Menu/CText.cs +++ b/VocaluxeLib/Menu/CText.cs @@ -312,12 +312,12 @@ namespace VocaluxeLib.Menu LoadTextures(); } - public bool LoadTheme(string xmlPath, string elementName, CXMLReader xmlReader, int skinIndex) + public bool LoadTheme(string xmlPath, string elementName, CXMLReader xmlReader) { - return LoadTheme(xmlPath, elementName, xmlReader, skinIndex, false); + return LoadTheme(xmlPath, elementName, xmlReader, false); } - public bool LoadTheme(string xmlPath, string elementName, CXMLReader xmlReader, int skinIndex, bool buttonText) + public bool LoadTheme(string xmlPath, string elementName, CXMLReader xmlReader, bool buttonText) { string item = xmlPath + "/" + elementName; _ThemeLoaded = true; @@ -553,6 +553,6 @@ namespace VocaluxeLib.Menu public void FontChanged() { _PositionNeedsUpdate = true; - } + } } } \ No newline at end of file diff --git a/VocaluxeLib/Menu/IMenu.cs b/VocaluxeLib/Menu/IMenu.cs index 91890d65..5c129415 100644 --- a/VocaluxeLib/Menu/IMenu.cs +++ b/VocaluxeLib/Menu/IMenu.cs @@ -19,6 +19,8 @@ namespace VocaluxeLib.Menu { public interface IMenu { + int PartyModeID { get; } + void Init(); void LoadTheme(string xmlPath); diff --git a/VocaluxeLib/Menu/IMenuElement.cs b/VocaluxeLib/Menu/IMenuElement.cs index 391dd1ad..07e7522f 100644 --- a/VocaluxeLib/Menu/IMenuElement.cs +++ b/VocaluxeLib/Menu/IMenuElement.cs @@ -24,7 +24,7 @@ namespace VocaluxeLib.Menu { string GetThemeName(); - bool LoadTheme(string xmlPath, string elementName, CXMLReader xmlReader, int skinIndex); + bool LoadTheme(string xmlPath, string elementName, CXMLReader xmlReader); void UnloadTextures(); void LoadTextures(); diff --git a/VocaluxeLib/Menu/SingNotes/CSingNotes.cs b/VocaluxeLib/Menu/SingNotes/CSingNotes.cs index 2cb97bac..26d2dba1 100644 --- a/VocaluxeLib/Menu/SingNotes/CSingNotes.cs +++ b/VocaluxeLib/Menu/SingNotes/CSingNotes.cs @@ -119,7 +119,7 @@ namespace VocaluxeLib.Menu.SingNotes get { return _ThemeLoaded; } } - 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; diff --git a/VocaluxeLib/Menu/SongMenu/CSongMenu.cs b/VocaluxeLib/Menu/SongMenu/CSongMenu.cs index 1fcb9619..56504f45 100644 --- a/VocaluxeLib/Menu/SongMenu/CSongMenu.cs +++ b/VocaluxeLib/Menu/SongMenu/CSongMenu.cs @@ -157,9 +157,9 @@ namespace VocaluxeLib.Menu.SongMenu return _SongMenu.GetThemeName(); } - public bool LoadTheme(string xmlPath, string elementName, CXMLReader xmlReader, int skinIndex) + public bool LoadTheme(string xmlPath, string elementName, CXMLReader xmlReader) { - return _SongMenu.LoadTheme(xmlPath, elementName, xmlReader, skinIndex); + return _SongMenu.LoadTheme(xmlPath, elementName, xmlReader); } public void UnloadTextures() diff --git a/VocaluxeLib/Menu/SongMenu/CSongMenuFramework.cs b/VocaluxeLib/Menu/SongMenu/CSongMenuFramework.cs index 84c6a95a..b0f2097a 100644 --- a/VocaluxeLib/Menu/SongMenu/CSongMenuFramework.cs +++ b/VocaluxeLib/Menu/SongMenu/CSongMenuFramework.cs @@ -198,7 +198,7 @@ namespace VocaluxeLib.Menu.SongMenu return new SThemeSongMenu(_Theme); } - public virtual bool LoadTheme(string xmlPath, string elementName, CXMLReader xmlReader, int skinIndex) + public virtual bool LoadTheme(string xmlPath, string elementName, CXMLReader xmlReader) { string item = xmlPath + "/" + elementName; _ThemeLoaded = true; diff --git a/VocaluxeLib/Menu/SongMenu/CSongMenuTileBoard.cs b/VocaluxeLib/Menu/SongMenu/CSongMenuTileBoard.cs index 05cbc2d2..31e780bd 100644 --- a/VocaluxeLib/Menu/SongMenu/CSongMenuTileBoard.cs +++ b/VocaluxeLib/Menu/SongMenu/CSongMenuTileBoard.cs @@ -121,24 +121,24 @@ namespace VocaluxeLib.Menu.SongMenu } } - public override bool LoadTheme(string xmlPath, string elementName, CXMLReader xmlReader, int skinIndex) + public override bool LoadTheme(string xmlPath, string elementName, CXMLReader xmlReader) { string item = xmlPath + "/" + elementName; bool themeLoaded = true; - themeLoaded &= base.LoadTheme(xmlPath, elementName, xmlReader, skinIndex); + themeLoaded &= base.LoadTheme(xmlPath, elementName, xmlReader); - themeLoaded &= _Artist.LoadTheme(item + "/SongMenuTileBoard", "TextArtist", xmlReader, skinIndex); - themeLoaded &= _Title.LoadTheme(item + "/SongMenuTileBoard", "TextTitle", xmlReader, skinIndex); - themeLoaded &= _SongLength.LoadTheme(item + "/SongMenuTileBoard", "TextSongLength", xmlReader, skinIndex); + themeLoaded &= _Artist.LoadTheme(item + "/SongMenuTileBoard", "TextArtist", xmlReader); + themeLoaded &= _Title.LoadTheme(item + "/SongMenuTileBoard", "TextTitle", xmlReader); + themeLoaded &= _SongLength.LoadTheme(item + "/SongMenuTileBoard", "TextSongLength", xmlReader); - themeLoaded &= _CoverBig.LoadTheme(item + "/SongMenuTileBoard", "StaticCoverBig", xmlReader, skinIndex); - themeLoaded &= _TextBG.LoadTheme(item + "/SongMenuTileBoard", "StaticTextBG", xmlReader, skinIndex); - themeLoaded &= _DuetIcon.LoadTheme(item + "/SongMenuTileBoard", "StaticDuetIcon", xmlReader, skinIndex); - themeLoaded &= _VideoIcon.LoadTheme(item + "/SongMenuTileBoard", "StaticVideoIcon", xmlReader, skinIndex); - themeLoaded &= _MedleyCalcIcon.LoadTheme(item + "/SongMenuTileBoard", "StaticMedleyCalcIcon", xmlReader, skinIndex); - themeLoaded &= _MedleyTagIcon.LoadTheme(item + "/SongMenuTileBoard", "StaticMedleyTagIcon", xmlReader, skinIndex); + themeLoaded &= _CoverBig.LoadTheme(item + "/SongMenuTileBoard", "StaticCoverBig", xmlReader); + themeLoaded &= _TextBG.LoadTheme(item + "/SongMenuTileBoard", "StaticTextBG", xmlReader); + themeLoaded &= _DuetIcon.LoadTheme(item + "/SongMenuTileBoard", "StaticDuetIcon", xmlReader); + themeLoaded &= _VideoIcon.LoadTheme(item + "/SongMenuTileBoard", "StaticVideoIcon", xmlReader); + themeLoaded &= _MedleyCalcIcon.LoadTheme(item + "/SongMenuTileBoard", "StaticMedleyCalcIcon", xmlReader); + themeLoaded &= _MedleyTagIcon.LoadTheme(item + "/SongMenuTileBoard", "StaticMedleyTagIcon", xmlReader); if (themeLoaded) { diff --git a/VocaluxeLib/Structs.cs b/VocaluxeLib/Structs.cs index 11fe9052..fb9ff313 100644 --- a/VocaluxeLib/Structs.cs +++ b/VocaluxeLib/Structs.cs @@ -65,6 +65,14 @@ namespace VocaluxeLib public bool ShowFirstCover; } + public struct SInfo + { + public string Name; + public string Author; + public int VersionMajor; + public int VersionMinor; + } + #region Drawing public struct SColorF { diff --git a/VocaluxeLib/Xml/CXMLReader.cs b/VocaluxeLib/Xml/CXMLReader.cs index 50045800..917881da 100644 --- a/VocaluxeLib/Xml/CXMLReader.cs +++ b/VocaluxeLib/Xml/CXMLReader.cs @@ -26,7 +26,7 @@ namespace VocaluxeLib.Xml private readonly XPathNavigator _Navigator; private readonly String _FilePath; - public string FilePath + public override string FilePath { get { return _FilePath; } } diff --git a/VocaluxeLib/Xml/CXmlDeserializer.cs b/VocaluxeLib/Xml/CXmlDeserializer.cs index 0b202c6b..478bcadc 100644 --- a/VocaluxeLib/Xml/CXmlDeserializer.cs +++ b/VocaluxeLib/Xml/CXmlDeserializer.cs @@ -4,6 +4,8 @@ namespace VocaluxeLib.Xml { public abstract class CXmlDeserializer : CXmlReaderBase { + public abstract string FilePath { get; } + public bool Read(string xPath, out SThemeFont el) { el = new SThemeFont(); @@ -64,5 +66,32 @@ namespace VocaluxeLib.Xml TryGetBoolValue(xPath + "/ShowFirstCover", out el.ShowFirstCover); return ok; } + + public bool Read(string xPath, out SInfo el) + { + el=new SInfo(); + bool ok = GetValue(xPath+"/Name", out el.Name); + ok &= GetValue(xPath + "/Author", out el.Author); + ok &= TryGetIntValue(xPath + "/VersionMajor", ref el.VersionMajor); + ok &= TryGetIntValue(xPath + "/VersionMinor", ref el.VersionMinor); + return ok; + } + + public bool CheckVersion(string xPath, int reqVersion) + { + int version=0; + string errorMsg; + if (!TryGetIntValue(xPath, ref version)) + errorMsg = "Version missing"; + else if (version != reqVersion) + { + errorMsg = version < reqVersion ? "the file ist outdated!" : "the file is for newer program versions!"; + errorMsg += " Current Version is " + reqVersion; + } + else + return true; + CBase.Log.LogError("Cannot load "+FilePath+": "+errorMsg); + return false; + } } } \ No newline at end of file