Merge branch 'develop' of https://github.com/Vocaluxe/Vocaluxe into develop

This commit is contained in:
lukeIam committed 2014-12-29 19:09:31 +01:00
commit 51dc4391bd
88 files changed
+1970 -1744

No files matched your search

+1
View File
@@ -101,6 +101,7 @@
<string name="TR_SCREENPARTY_VERSION">Version</string> <string name="TR_SCREENPARTY_VERSION">Version</string>
<string name="TR_SCREENPARTY_ERROR">Can\'t load this party-mode.</string> <string name="TR_SCREENPARTY_ERROR">Can\'t load this party-mode.</string>
<string name="TR_SCREENPARTY_ERROR_MICS">There are no mics configured!</string> <string name="TR_SCREENPARTY_ERROR_MICS">There are no mics configured!</string>
<string name="TR_SCREENPARTY_ERROR_MIC_NUM">%d mics are required for this party-mode!</string>
<string name="TR_SCREENPARTY_TARGETAUDIENCE">Target audience</string> <string name="TR_SCREENPARTY_TARGETAUDIENCE">Target audience</string>
<string name="TR_SCREENPARTY_NOTEAMS">No teams</string> <string name="TR_SCREENPARTY_NOTEAMS">No teams</string>
<string name="TR_SCREENPARTY_NUMTEAMS">Number of teams</string> <string name="TR_SCREENPARTY_NUMTEAMS">Number of teams</string>
+1
View File
@@ -101,6 +101,7 @@
<string name="TR_SCREENPARTY_VERSION">Version</string> <string name="TR_SCREENPARTY_VERSION">Version</string>
<string name="TR_SCREENPARTY_ERROR">Dieser Party-Modus konnte nicht geladen werden.</string> <string name="TR_SCREENPARTY_ERROR">Dieser Party-Modus konnte nicht geladen werden.</string>
<string name="TR_SCREENPARTY_ERROR_MICS">Es sind keine Mikros konfiguriert!</string> <string name="TR_SCREENPARTY_ERROR_MICS">Es sind keine Mikros konfiguriert!</string>
<string name="TR_SCREENPARTY_ERROR_MIC_NUM">Für diesen Party-Modus werden %d Mikros benötigt!</string>
<string name="TR_SCREENPARTY_TARGETAUDIENCE">Zielgruppe</string> <string name="TR_SCREENPARTY_TARGETAUDIENCE">Zielgruppe</string>
<string name="TR_SCREENPARTY_NOTEAMS">Keine Teams</string> <string name="TR_SCREENPARTY_NOTEAMS">Keine Teams</string>
<string name="TR_SCREENPARTY_NUMTEAMS">Anzahl der Teams</string> <string name="TR_SCREENPARTY_NUMTEAMS">Anzahl der Teams</string>
-2
View File
@@ -210,8 +210,6 @@
<string name="TR_SCREENOVIDEO_WEBCAMDEVICES">Cámaras web</string> <string name="TR_SCREENOVIDEO_WEBCAMDEVICES">Cámaras web</string>
<string name="TR_SCREENOVIDEO_WEBCAMRESOLUTION">Resolución cámara web</string> <string name="TR_SCREENOVIDEO_WEBCAMRESOLUTION">Resolución cámara web</string>
<string name="TR_SCREENOVIDEO_BUTTON_ADJUSTMENTS">Ajustes de pantalla</string> <string name="TR_SCREENOVIDEO_BUTTON_ADJUSTMENTS">Ajustes de pantalla</string>
<string name="TR_SCREENOVIDEOADJUSTMENTS_NOTES">Pulsa CTRL + ALT + SHIFT + Flechas para ajustar la pantalla</string>
<string name="TR_SCREENOVIDEOADJUSTMENTS_NOTESRESET">CTRL + ALT + SHIFT + 0 para reiniciar</string>
<string name="TR_SCREENOVIDEOADJUSTMENTS_TOPLEFT">Arriba izquierda</string> <string name="TR_SCREENOVIDEOADJUSTMENTS_TOPLEFT">Arriba izquierda</string>
<string name="TR_SCREENOVIDEOADJUSTMENTS_TOPRIGHT">Abajo derecha</string> <string name="TR_SCREENOVIDEOADJUSTMENTS_TOPRIGHT">Abajo derecha</string>
<string name="TR_SCREENOVIDEOADJUSTMENTS_BOTTOMLEFT">Abajo izquierda</string> <string name="TR_SCREENOVIDEOADJUSTMENTS_BOTTOMLEFT">Abajo izquierda</string>
+4 -2
View File
@@ -93,6 +93,7 @@
<string name="TR_SCREENMAIN_BUTTON_PARTY">Party</string> <string name="TR_SCREENMAIN_BUTTON_PARTY">Party</string>
<string name="TR_SCREENMAIN_BUTTON_OPTIONS">Alternativ</string> <string name="TR_SCREENMAIN_BUTTON_OPTIONS">Alternativ</string>
<string name="TR_SCREENMAIN_BUTTON_PROFILES">Profiler</string> <string name="TR_SCREENMAIN_BUTTON_PROFILES">Profiler</string>
<string name="TR_SCREENMAIN_TEXT_NOPROFILES">Inga profiler funna!</string>
<string name="TR_SCREENPARTY_TITLE">Party Läge Väljare</string> <string name="TR_SCREENPARTY_TITLE">Party Läge Väljare</string>
<string name="TR_SCREENPARTY_MODES">Party Läge</string> <string name="TR_SCREENPARTY_MODES">Party Läge</string>
<string name="TR_SCREENPARTY_DESCRIPTION">Beskrivning</string> <string name="TR_SCREENPARTY_DESCRIPTION">Beskrivning</string>
@@ -100,6 +101,7 @@
<string name="TR_SCREENPARTY_VERSION">Version</string> <string name="TR_SCREENPARTY_VERSION">Version</string>
<string name="TR_SCREENPARTY_ERROR">kan ej ladda detta party läge</string> <string name="TR_SCREENPARTY_ERROR">kan ej ladda detta party läge</string>
<string name="TR_SCREENPARTY_ERROR_MICS">Det finns inga mikrofoner konfigurerade!</string> <string name="TR_SCREENPARTY_ERROR_MICS">Det finns inga mikrofoner konfigurerade!</string>
<string name="TR_SCREENPARTY_ERROR_MIC_NUM">%d mikrofoner krävs för denna party-mode!</string>
<string name="TR_SCREENPARTY_TARGETAUDIENCE">Mål publik</string> <string name="TR_SCREENPARTY_TARGETAUDIENCE">Mål publik</string>
<string name="TR_SCREENPARTY_NOTEAMS">Inga lag</string> <string name="TR_SCREENPARTY_NOTEAMS">Inga lag</string>
<string name="TR_SCREENPARTY_NUMTEAMS">Antal lag</string> <string name="TR_SCREENPARTY_NUMTEAMS">Antal lag</string>
@@ -211,8 +213,8 @@
<string name="TR_SCREENOVIDEO_WEBCAMDEVICES">Webkameror</string> <string name="TR_SCREENOVIDEO_WEBCAMDEVICES">Webkameror</string>
<string name="TR_SCREENOVIDEO_WEBCAMRESOLUTION">Webkamera Upplösning</string> <string name="TR_SCREENOVIDEO_WEBCAMRESOLUTION">Webkamera Upplösning</string>
<string name="TR_SCREENOVIDEO_BUTTON_ADJUSTMENTS">Skärmjusteringar</string> <string name="TR_SCREENOVIDEO_BUTTON_ADJUSTMENTS">Skärmjusteringar</string>
<string name="TR_SCREENOVIDEOADJUSTMENTS_NOTES">Tryck CTRL + ALT +SHIFT + Pilar för att justera skärmen</string> <string name="TR_SCREENOVIDEOADJUSTMENTS_NOTES">Tryck CTR + ALT (+ SHIFT) + Pilar"+" för att justera skärmen</string>
<string name="TR_SCREENOVIDEOADJUSTMENTS_NOTESRESET">CTRL + ALT + SHIFT + 0 för att återställa</string> <string name="TR_SCREENOVIDEOADJUSTMENTS_NOTESRESET">CTR + ALT + 0 för att återställa</string>
<string name="TR_SCREENOVIDEOADJUSTMENTS_TOPLEFT">Överst till vänster</string> <string name="TR_SCREENOVIDEOADJUSTMENTS_TOPLEFT">Överst till vänster</string>
<string name="TR_SCREENOVIDEOADJUSTMENTS_TOPRIGHT">Överst till höger</string> <string name="TR_SCREENOVIDEOADJUSTMENTS_TOPRIGHT">Överst till höger</string>
<string name="TR_SCREENOVIDEOADJUSTMENTS_BOTTOMLEFT">Nederst till vänster</string> <string name="TR_SCREENOVIDEOADJUSTMENTS_BOTTOMLEFT">Nederst till vänster</string>
@@ -194,7 +194,7 @@
<TextColor Name="TextColor" /> <TextColor Name="TextColor" />
<TextSelColor Name="TextSelColor" /> <TextSelColor Name="TextSelColor" />
<TextH>27</TextH> <TextH>27</TextH>
<TextRelativeX>0</TextRelativeX> <TextRelativeX>50</TextRelativeX>
<TextRelativeY>0</TextRelativeY> <TextRelativeY>0</TextRelativeY>
<TextMaxW>205.33</TextMaxW> <TextMaxW>205.33</TextMaxW>
<TextFont>Outline</TextFont> <TextFont>Outline</TextFont>
@@ -236,7 +236,7 @@
<TextColor Name="TextColor" /> <TextColor Name="TextColor" />
<TextSelColor Name="TextSelColor" /> <TextSelColor Name="TextSelColor" />
<TextH>27</TextH> <TextH>27</TextH>
<TextRelativeX>0</TextRelativeX> <TextRelativeX>50</TextRelativeX>
<TextRelativeY>0</TextRelativeY> <TextRelativeY>0</TextRelativeY>
<TextMaxW>205.33</TextMaxW> <TextMaxW>205.33</TextMaxW>
<TextFont>Outline</TextFont> <TextFont>Outline</TextFont>
@@ -278,7 +278,7 @@
<TextColor Name="TextColor" /> <TextColor Name="TextColor" />
<TextSelColor Name="TextSelColor" /> <TextSelColor Name="TextSelColor" />
<TextH>27</TextH> <TextH>27</TextH>
<TextRelativeX>0</TextRelativeX> <TextRelativeX>50</TextRelativeX>
<TextRelativeY>0</TextRelativeY> <TextRelativeY>0</TextRelativeY>
<TextMaxW>205.33</TextMaxW> <TextMaxW>205.33</TextMaxW>
<TextFont>Outline</TextFont> <TextFont>Outline</TextFont>
@@ -295,7 +295,7 @@
<TextColor Name="TextColor" /> <TextColor Name="TextColor" />
<TextSelColor Name="TextSelColor" /> <TextSelColor Name="TextSelColor" />
<TextH>27</TextH> <TextH>27</TextH>
<TextRelativeX>0</TextRelativeX> <TextRelativeX>50</TextRelativeX>
<TextRelativeY>0</TextRelativeY> <TextRelativeY>0</TextRelativeY>
<TextMaxW>205.33</TextMaxW> <TextMaxW>205.33</TextMaxW>
<TextFont>Outline</TextFont> <TextFont>Outline</TextFont>
@@ -337,8 +337,8 @@
<TextColor Name="TextColor" /> <TextColor Name="TextColor" />
<TextSelColor Name="TextSelColor" /> <TextSelColor Name="TextSelColor" />
<TextH>27</TextH> <TextH>27</TextH>
<TextRelativeX>0</TextRelativeX> <TextRelativeX>50</TextRelativeX>
<TextRelativeY>-5</TextRelativeY> <TextRelativeY>5</TextRelativeY>
<TextMaxW>205.33</TextMaxW> <TextMaxW>205.33</TextMaxW>
<TextFont>Outline</TextFont> <TextFont>Outline</TextFont>
<TextStyle>Bold</TextStyle> <TextStyle>Bold</TextStyle>
@@ -194,7 +194,7 @@
<TextColor Name="TextColor" /> <TextColor Name="TextColor" />
<TextSelColor Name="TextSelColor" /> <TextSelColor Name="TextSelColor" />
<TextH>27</TextH> <TextH>27</TextH>
<TextRelativeX>0</TextRelativeX> <TextRelativeX>50</TextRelativeX>
<TextRelativeY>0</TextRelativeY> <TextRelativeY>0</TextRelativeY>
<TextMaxW>205.33</TextMaxW> <TextMaxW>205.33</TextMaxW>
<TextFont>Outline</TextFont> <TextFont>Outline</TextFont>
@@ -236,7 +236,7 @@
<TextColor Name="TextColor" /> <TextColor Name="TextColor" />
<TextSelColor Name="TextSelColor" /> <TextSelColor Name="TextSelColor" />
<TextH>27</TextH> <TextH>27</TextH>
<TextRelativeX>0</TextRelativeX> <TextRelativeX>50</TextRelativeX>
<TextRelativeY>0</TextRelativeY> <TextRelativeY>0</TextRelativeY>
<TextMaxW>205.33</TextMaxW> <TextMaxW>205.33</TextMaxW>
<TextFont>Outline</TextFont> <TextFont>Outline</TextFont>
@@ -278,7 +278,7 @@
<TextColor Name="TextColor" /> <TextColor Name="TextColor" />
<TextSelColor Name="TextSelColor" /> <TextSelColor Name="TextSelColor" />
<TextH>27</TextH> <TextH>27</TextH>
<TextRelativeX>0</TextRelativeX> <TextRelativeX>50</TextRelativeX>
<TextRelativeY>0</TextRelativeY> <TextRelativeY>0</TextRelativeY>
<TextMaxW>205.33</TextMaxW> <TextMaxW>205.33</TextMaxW>
<TextFont>Outline</TextFont> <TextFont>Outline</TextFont>
@@ -295,7 +295,7 @@
<TextColor Name="TextColor" /> <TextColor Name="TextColor" />
<TextSelColor Name="TextSelColor" /> <TextSelColor Name="TextSelColor" />
<TextH>27</TextH> <TextH>27</TextH>
<TextRelativeX>0</TextRelativeX> <TextRelativeX>50</TextRelativeX>
<TextRelativeY>0</TextRelativeY> <TextRelativeY>0</TextRelativeY>
<TextMaxW>205.33</TextMaxW> <TextMaxW>205.33</TextMaxW>
<TextFont>Outline</TextFont> <TextFont>Outline</TextFont>
@@ -337,8 +337,8 @@
<TextColor Name="TextColor" /> <TextColor Name="TextColor" />
<TextSelColor Name="TextSelColor" /> <TextSelColor Name="TextSelColor" />
<TextH>27</TextH> <TextH>27</TextH>
<TextRelativeX>0</TextRelativeX> <TextRelativeX>50</TextRelativeX>
<TextRelativeY>-5</TextRelativeY> <TextRelativeY>5</TextRelativeY>
<TextMaxW>205.33</TextMaxW> <TextMaxW>205.33</TextMaxW>
<TextFont>Outline</TextFont> <TextFont>Outline</TextFont>
<TextStyle>Bold</TextStyle> <TextStyle>Bold</TextStyle>
@@ -194,7 +194,7 @@
<TextColor Name="TextColor" /> <TextColor Name="TextColor" />
<TextSelColor Name="TextSelColor" /> <TextSelColor Name="TextSelColor" />
<TextH>27</TextH> <TextH>27</TextH>
<TextRelativeX>0</TextRelativeX> <TextRelativeX>50</TextRelativeX>
<TextRelativeY>0</TextRelativeY> <TextRelativeY>0</TextRelativeY>
<TextMaxW>205.33</TextMaxW> <TextMaxW>205.33</TextMaxW>
<TextFont>Outline</TextFont> <TextFont>Outline</TextFont>
@@ -236,7 +236,7 @@
<TextColor Name="TextColor" /> <TextColor Name="TextColor" />
<TextSelColor Name="TextSelColor" /> <TextSelColor Name="TextSelColor" />
<TextH>27</TextH> <TextH>27</TextH>
<TextRelativeX>0</TextRelativeX> <TextRelativeX>50</TextRelativeX>
<TextRelativeY>0</TextRelativeY> <TextRelativeY>0</TextRelativeY>
<TextMaxW>205.33</TextMaxW> <TextMaxW>205.33</TextMaxW>
<TextFont>Outline</TextFont> <TextFont>Outline</TextFont>
@@ -278,7 +278,7 @@
<TextColor Name="TextColor" /> <TextColor Name="TextColor" />
<TextSelColor Name="TextSelColor" /> <TextSelColor Name="TextSelColor" />
<TextH>27</TextH> <TextH>27</TextH>
<TextRelativeX>0</TextRelativeX> <TextRelativeX>50</TextRelativeX>
<TextRelativeY>0</TextRelativeY> <TextRelativeY>0</TextRelativeY>
<TextMaxW>205.33</TextMaxW> <TextMaxW>205.33</TextMaxW>
<TextFont>Outline</TextFont> <TextFont>Outline</TextFont>
@@ -320,7 +320,7 @@
<TextColor Name="TextColor" /> <TextColor Name="TextColor" />
<TextSelColor Name="TextSelColor" /> <TextSelColor Name="TextSelColor" />
<TextH>27</TextH> <TextH>27</TextH>
<TextRelativeX>0</TextRelativeX> <TextRelativeX>50</TextRelativeX>
<TextRelativeY>0</TextRelativeY> <TextRelativeY>0</TextRelativeY>
<TextMaxW>205.33</TextMaxW> <TextMaxW>205.33</TextMaxW>
<TextFont>Outline</TextFont> <TextFont>Outline</TextFont>
@@ -362,7 +362,7 @@
<TextColor Name="TextColor" /> <TextColor Name="TextColor" />
<TextSelColor Name="TextSelColor" /> <TextSelColor Name="TextSelColor" />
<TextH>27</TextH> <TextH>27</TextH>
<TextRelativeX>0</TextRelativeX> <TextRelativeX>50</TextRelativeX>
<TextRelativeY>0</TextRelativeY> <TextRelativeY>0</TextRelativeY>
<TextMaxW>205.33</TextMaxW> <TextMaxW>205.33</TextMaxW>
<TextFont>Outline</TextFont> <TextFont>Outline</TextFont>
@@ -295,7 +295,7 @@
<TextColor Name="TextColor" /> <TextColor Name="TextColor" />
<TextSelColor Name="TextSelColor" /> <TextSelColor Name="TextSelColor" />
<TextH>27</TextH> <TextH>27</TextH>
<TextRelativeX>0</TextRelativeX> <TextRelativeX>50</TextRelativeX>
<TextRelativeY>0</TextRelativeY> <TextRelativeY>0</TextRelativeY>
<TextMaxW>205.33</TextMaxW> <TextMaxW>205.33</TextMaxW>
<TextFont>Outline</TextFont> <TextFont>Outline</TextFont>
@@ -337,8 +337,8 @@
<TextColor Name="TextColor" /> <TextColor Name="TextColor" />
<TextSelColor Name="TextSelColor" /> <TextSelColor Name="TextSelColor" />
<TextH>27</TextH> <TextH>27</TextH>
<TextRelativeX>0</TextRelativeX> <TextRelativeX>50</TextRelativeX>
<TextRelativeY>-5</TextRelativeY> <TextRelativeY>5</TextRelativeY>
<TextMaxW>205.33</TextMaxW> <TextMaxW>205.33</TextMaxW>
<TextFont>Outline</TextFont> <TextFont>Outline</TextFont>
<TextStyle>Bold</TextStyle> <TextStyle>Bold</TextStyle>
@@ -46,22 +46,22 @@
<SkinArrowLeftSelected>Minus</SkinArrowLeftSelected> <SkinArrowLeftSelected>Minus</SkinArrowLeftSelected>
<SkinArrowRightSelected>Plus</SkinArrowRightSelected> <SkinArrowRightSelected>Plus</SkinArrowRightSelected>
<Rect> <Rect>
<X>1090</X> <X>1070</X>
<Y>680</Y> <Y>680</Y>
<W>200</W> <W>200</W>
<H>50</H> <H>30</H>
<Z>-2</Z> <Z>-2</Z>
</Rect> </Rect>
<RectArrowLeft> <RectArrowLeft>
<X>1195</X> <X>1195</X>
<Y>682</Y> <Y>680</Y>
<W>30</W> <W>30</W>
<H>30</H> <H>30</H>
<Z>-2</Z> <Z>-2</Z>
</RectArrowLeft> </RectArrowLeft>
<RectArrowRight> <RectArrowRight>
<X>1240</X> <X>1235</X>
<Y>682</Y> <Y>680</Y>
<W>30</W> <W>30</W>
<H>30</H> <H>30</H>
<Z>-2</Z> <Z>-2</Z>
@@ -73,9 +73,9 @@
<TextColor Name="TextColor" /> <TextColor Name="TextColor" />
<TextSelColor Name="TextSelColor" /> <TextSelColor Name="TextSelColor" />
<TextH>27</TextH> <TextH>27</TextH>
<TextRelativeX>-15</TextRelativeX> <TextRelativeX>0</TextRelativeX>
<TextRelativeY>-8</TextRelativeY> <TextRelativeY>0</TextRelativeY>
<TextMaxW>500</TextMaxW> <TextMaxW>25</TextMaxW>
<TextFont>Outline</TextFont> <TextFont>Outline</TextFont>
<TextStyle>Bold</TextStyle> <TextStyle>Bold</TextStyle>
<NumVisible>1</NumVisible> <NumVisible>1</NumVisible>
@@ -418,7 +418,7 @@
<TextColor Name="TextColor" /> <TextColor Name="TextColor" />
<TextSelColor Name="TextSelColor" /> <TextSelColor Name="TextSelColor" />
<TextH>27</TextH> <TextH>27</TextH>
<TextRelativeX>0</TextRelativeX> <TextRelativeX>50</TextRelativeX>
<TextRelativeY>0</TextRelativeY> <TextRelativeY>0</TextRelativeY>
<TextMaxW>186</TextMaxW> <TextMaxW>186</TextMaxW>
<TextFont>Outline</TextFont> <TextFont>Outline</TextFont>
@@ -460,7 +460,7 @@
<TextColor Name="TextColor" /> <TextColor Name="TextColor" />
<TextSelColor Name="TextSelColor" /> <TextSelColor Name="TextSelColor" />
<TextH>20</TextH> <TextH>20</TextH>
<TextRelativeX>0</TextRelativeX> <TextRelativeX>50</TextRelativeX>
<TextRelativeY>0</TextRelativeY> <TextRelativeY>0</TextRelativeY>
<TextMaxW>86</TextMaxW> <TextMaxW>86</TextMaxW>
<TextFont>Outline</TextFont> <TextFont>Outline</TextFont>
@@ -502,7 +502,7 @@
<TextColor Name="TextColor" /> <TextColor Name="TextColor" />
<TextSelColor Name="TextSelColor" /> <TextSelColor Name="TextSelColor" />
<TextH>20</TextH> <TextH>20</TextH>
<TextRelativeX>0</TextRelativeX> <TextRelativeX>50</TextRelativeX>
<TextRelativeY>0</TextRelativeY> <TextRelativeY>0</TextRelativeY>
<TextMaxW>86</TextMaxW> <TextMaxW>86</TextMaxW>
<TextFont>Outline</TextFont> <TextFont>Outline</TextFont>
@@ -544,7 +544,7 @@
<TextColor Name="TextColor" /> <TextColor Name="TextColor" />
<TextSelColor Name="TextSelColor" /> <TextSelColor Name="TextSelColor" />
<TextH>20</TextH> <TextH>20</TextH>
<TextRelativeX>0</TextRelativeX> <TextRelativeX>50</TextRelativeX>
<TextRelativeY>0</TextRelativeY> <TextRelativeY>0</TextRelativeY>
<TextMaxW>86</TextMaxW> <TextMaxW>86</TextMaxW>
<TextFont>Outline</TextFont> <TextFont>Outline</TextFont>
@@ -586,7 +586,7 @@
<TextColor Name="TextColor" /> <TextColor Name="TextColor" />
<TextSelColor Name="TextSelColor" /> <TextSelColor Name="TextSelColor" />
<TextH>20</TextH> <TextH>20</TextH>
<TextRelativeX>0</TextRelativeX> <TextRelativeX>50</TextRelativeX>
<TextRelativeY>0</TextRelativeY> <TextRelativeY>0</TextRelativeY>
<TextMaxW>86</TextMaxW> <TextMaxW>86</TextMaxW>
<TextFont>Outline</TextFont> <TextFont>Outline</TextFont>
@@ -628,7 +628,7 @@
<TextColor Name="TextColor" /> <TextColor Name="TextColor" />
<TextSelColor Name="TextSelColor" /> <TextSelColor Name="TextSelColor" />
<TextH>20</TextH> <TextH>20</TextH>
<TextRelativeX>0</TextRelativeX> <TextRelativeX>50</TextRelativeX>
<TextRelativeY>0</TextRelativeY> <TextRelativeY>0</TextRelativeY>
<TextMaxW>86</TextMaxW> <TextMaxW>86</TextMaxW>
<TextFont>Outline</TextFont> <TextFont>Outline</TextFont>
@@ -670,7 +670,7 @@
<TextColor Name="TextColor" /> <TextColor Name="TextColor" />
<TextSelColor Name="TextSelColor" /> <TextSelColor Name="TextSelColor" />
<TextH>20</TextH> <TextH>20</TextH>
<TextRelativeX>0</TextRelativeX> <TextRelativeX>50</TextRelativeX>
<TextRelativeY>0</TextRelativeY> <TextRelativeY>0</TextRelativeY>
<TextMaxW>86</TextMaxW> <TextMaxW>86</TextMaxW>
<TextFont>Outline</TextFont> <TextFont>Outline</TextFont>
@@ -302,7 +302,7 @@
<TextColor Name="TextColor" /> <TextColor Name="TextColor" />
<TextSelColor Name="TextSelColor" /> <TextSelColor Name="TextSelColor" />
<TextH>27</TextH> <TextH>27</TextH>
<TextRelativeX>0</TextRelativeX> <TextRelativeX>50</TextRelativeX>
<TextRelativeY>0</TextRelativeY> <TextRelativeY>0</TextRelativeY>
<TextMaxW>205.33</TextMaxW> <TextMaxW>205.33</TextMaxW>
<TextFont>Outline</TextFont> <TextFont>Outline</TextFont>
@@ -344,7 +344,7 @@
<TextColor Name="TextColor" /> <TextColor Name="TextColor" />
<TextSelColor Name="TextSelColor" /> <TextSelColor Name="TextSelColor" />
<TextH>27</TextH> <TextH>27</TextH>
<TextRelativeX>0</TextRelativeX> <TextRelativeX>50</TextRelativeX>
<TextRelativeY>0</TextRelativeY> <TextRelativeY>0</TextRelativeY>
<TextMaxW>205.33</TextMaxW> <TextMaxW>205.33</TextMaxW>
<TextFont>Outline</TextFont> <TextFont>Outline</TextFont>
@@ -386,7 +386,7 @@
<TextColor Name="TextColor" /> <TextColor Name="TextColor" />
<TextSelColor Name="TextSelColor" /> <TextSelColor Name="TextSelColor" />
<TextH>27</TextH> <TextH>27</TextH>
<TextRelativeX>0</TextRelativeX> <TextRelativeX>50</TextRelativeX>
<TextRelativeY>0</TextRelativeY> <TextRelativeY>0</TextRelativeY>
<TextMaxW>205.33</TextMaxW> <TextMaxW>205.33</TextMaxW>
<TextFont>Outline</TextFont> <TextFont>Outline</TextFont>
@@ -428,7 +428,7 @@
<TextColor Name="TextColor" /> <TextColor Name="TextColor" />
<TextSelColor Name="TextSelColor" /> <TextSelColor Name="TextSelColor" />
<TextH>27</TextH> <TextH>27</TextH>
<TextRelativeX>0</TextRelativeX> <TextRelativeX>50</TextRelativeX>
<TextRelativeY>0</TextRelativeY> <TextRelativeY>0</TextRelativeY>
<TextMaxW>205.33</TextMaxW> <TextMaxW>205.33</TextMaxW>
<TextFont>Outline</TextFont> <TextFont>Outline</TextFont>
@@ -470,7 +470,7 @@
<TextColor Name="TextColor" /> <TextColor Name="TextColor" />
<TextSelColor Name="TextSelColor" /> <TextSelColor Name="TextSelColor" />
<TextH>27</TextH> <TextH>27</TextH>
<TextRelativeX>0</TextRelativeX> <TextRelativeX>50</TextRelativeX>
<TextRelativeY>0</TextRelativeY> <TextRelativeY>0</TextRelativeY>
<TextMaxW>308</TextMaxW> <TextMaxW>308</TextMaxW>
<TextFont>Outline</TextFont> <TextFont>Outline</TextFont>
@@ -512,7 +512,7 @@
<TextColor Name="TextColor" /> <TextColor Name="TextColor" />
<TextSelColor Name="TextSelColor" /> <TextSelColor Name="TextSelColor" />
<TextH>27</TextH> <TextH>27</TextH>
<TextRelativeX>0</TextRelativeX> <TextRelativeX>50</TextRelativeX>
<TextRelativeY>0</TextRelativeY> <TextRelativeY>0</TextRelativeY>
<TextMaxW>205.33</TextMaxW> <TextMaxW>205.33</TextMaxW>
<TextFont>Outline</TextFont> <TextFont>Outline</TextFont>
@@ -145,7 +145,7 @@
<TextColor Name="TextColor" /> <TextColor Name="TextColor" />
<TextSelColor Name="TextSelColor" /> <TextSelColor Name="TextSelColor" />
<TextH>27</TextH> <TextH>27</TextH>
<TextRelativeX>0</TextRelativeX> <TextRelativeX>50</TextRelativeX>
<TextRelativeY>0</TextRelativeY> <TextRelativeY>0</TextRelativeY>
<TextMaxW>205.33</TextMaxW> <TextMaxW>205.33</TextMaxW>
<TextFont>Outline</TextFont> <TextFont>Outline</TextFont>
@@ -187,7 +187,7 @@
<TextColor Name="TextColor" /> <TextColor Name="TextColor" />
<TextSelColor Name="TextSelColor" /> <TextSelColor Name="TextSelColor" />
<TextH>27</TextH> <TextH>27</TextH>
<TextRelativeX>0</TextRelativeX> <TextRelativeX>50</TextRelativeX>
<TextRelativeY>0</TextRelativeY> <TextRelativeY>0</TextRelativeY>
<TextMaxW>205.33</TextMaxW> <TextMaxW>205.33</TextMaxW>
<TextFont>Outline</TextFont> <TextFont>Outline</TextFont>
@@ -338,7 +338,7 @@
<TextColor Name="TextColor" /> <TextColor Name="TextColor" />
<TextSelColor Name="TextSelColor" /> <TextSelColor Name="TextSelColor" />
<TextH>27</TextH> <TextH>27</TextH>
<TextRelativeX>0</TextRelativeX> <TextRelativeX>50</TextRelativeX>
<TextRelativeY>0</TextRelativeY> <TextRelativeY>0</TextRelativeY>
<TextMaxW>616</TextMaxW> <TextMaxW>616</TextMaxW>
<TextFont>Outline</TextFont> <TextFont>Outline</TextFont>
@@ -380,7 +380,7 @@
<TextColor Name="TextColor" /> <TextColor Name="TextColor" />
<TextSelColor Name="TextSelColor" /> <TextSelColor Name="TextSelColor" />
<TextH>27</TextH> <TextH>27</TextH>
<TextRelativeX>0</TextRelativeX> <TextRelativeX>50</TextRelativeX>
<TextRelativeY>0</TextRelativeY> <TextRelativeY>0</TextRelativeY>
<TextMaxW>154</TextMaxW> <TextMaxW>154</TextMaxW>
<TextFont>Outline</TextFont> <TextFont>Outline</TextFont>
@@ -422,7 +422,7 @@
<TextColor Name="TextColor" /> <TextColor Name="TextColor" />
<TextSelColor Name="TextSelColor" /> <TextSelColor Name="TextSelColor" />
<TextH>27</TextH> <TextH>27</TextH>
<TextRelativeX>0</TextRelativeX> <TextRelativeX>50</TextRelativeX>
<TextRelativeY>0</TextRelativeY> <TextRelativeY>0</TextRelativeY>
<TextMaxW>154</TextMaxW> <TextMaxW>154</TextMaxW>
<TextFont>Outline</TextFont> <TextFont>Outline</TextFont>
@@ -464,7 +464,7 @@
<TextColor Name="TextColor" /> <TextColor Name="TextColor" />
<TextSelColor Name="TextSelColor" /> <TextSelColor Name="TextSelColor" />
<TextH>27</TextH> <TextH>27</TextH>
<TextRelativeX>0</TextRelativeX> <TextRelativeX>50</TextRelativeX>
<TextRelativeY>0</TextRelativeY> <TextRelativeY>0</TextRelativeY>
<TextMaxW>123.2</TextMaxW> <TextMaxW>123.2</TextMaxW>
<TextFont>Outline</TextFont> <TextFont>Outline</TextFont>
@@ -187,7 +187,7 @@
<TextColor Name="TextColor" /> <TextColor Name="TextColor" />
<TextSelColor Name="TextSelColor" /> <TextSelColor Name="TextSelColor" />
<TextH>27</TextH> <TextH>27</TextH>
<TextRelativeX>0</TextRelativeX> <TextRelativeX>50</TextRelativeX>
<TextRelativeY>0</TextRelativeY> <TextRelativeY>0</TextRelativeY>
<TextMaxW>205.33</TextMaxW> <TextMaxW>205.33</TextMaxW>
<TextFont>Outline</TextFont> <TextFont>Outline</TextFont>
@@ -229,7 +229,7 @@
<TextColor Name="TextColor" /> <TextColor Name="TextColor" />
<TextSelColor Name="TextSelColor" /> <TextSelColor Name="TextSelColor" />
<TextH>27</TextH> <TextH>27</TextH>
<TextRelativeX>0</TextRelativeX> <TextRelativeX>50</TextRelativeX>
<TextRelativeY>0</TextRelativeY> <TextRelativeY>0</TextRelativeY>
<TextMaxW>205.33</TextMaxW> <TextMaxW>205.33</TextMaxW>
<TextFont>Outline</TextFont> <TextFont>Outline</TextFont>
@@ -271,7 +271,7 @@
<TextColor Name="TextColor" /> <TextColor Name="TextColor" />
<TextSelColor Name="TextSelColor" /> <TextSelColor Name="TextSelColor" />
<TextH>27</TextH> <TextH>27</TextH>
<TextRelativeX>0</TextRelativeX> <TextRelativeX>50</TextRelativeX>
<TextRelativeY>0</TextRelativeY> <TextRelativeY>0</TextRelativeY>
<TextMaxW>500</TextMaxW> <TextMaxW>500</TextMaxW>
<TextFont>Outline</TextFont> <TextFont>Outline</TextFont>
@@ -313,7 +313,7 @@
<TextColor Name="TextColor" /> <TextColor Name="TextColor" />
<TextSelColor Name="TextSelColor" /> <TextSelColor Name="TextSelColor" />
<TextH>27</TextH> <TextH>27</TextH>
<TextRelativeX>0</TextRelativeX> <TextRelativeX>50</TextRelativeX>
<TextRelativeY>0</TextRelativeY> <TextRelativeY>0</TextRelativeY>
<TextMaxW>500</TextMaxW> <TextMaxW>500</TextMaxW>
<TextFont>Outline</TextFont> <TextFont>Outline</TextFont>
@@ -355,7 +355,7 @@
<TextColor Name="TextColor" /> <TextColor Name="TextColor" />
<TextSelColor Name="TextSelColor" /> <TextSelColor Name="TextSelColor" />
<TextH>27</TextH> <TextH>27</TextH>
<TextRelativeX>0</TextRelativeX> <TextRelativeX>50</TextRelativeX>
<TextRelativeY>0</TextRelativeY> <TextRelativeY>0</TextRelativeY>
<TextMaxW>500</TextMaxW> <TextMaxW>500</TextMaxW>
<TextFont>Outline</TextFont> <TextFont>Outline</TextFont>
@@ -317,7 +317,7 @@
<TextColor Name="TextColor" /> <TextColor Name="TextColor" />
<TextSelColor Name="TextSelColor" /> <TextSelColor Name="TextSelColor" />
<TextH>27</TextH> <TextH>27</TextH>
<TextRelativeX>0</TextRelativeX> <TextRelativeX>50</TextRelativeX>
<TextRelativeY>0</TextRelativeY> <TextRelativeY>0</TextRelativeY>
<TextMaxW>616</TextMaxW> <TextMaxW>616</TextMaxW>
<TextFont>Outline</TextFont> <TextFont>Outline</TextFont>
@@ -359,7 +359,7 @@
<TextColor Name="TextColor" /> <TextColor Name="TextColor" />
<TextSelColor Name="TextSelColor" /> <TextSelColor Name="TextSelColor" />
<TextH>27</TextH> <TextH>27</TextH>
<TextRelativeX>0</TextRelativeX> <TextRelativeX>50</TextRelativeX>
<TextRelativeY>0</TextRelativeY> <TextRelativeY>0</TextRelativeY>
<TextMaxW>616</TextMaxW> <TextMaxW>616</TextMaxW>
<TextFont>Outline</TextFont> <TextFont>Outline</TextFont>
@@ -401,7 +401,7 @@
<TextColor Name="TextColor" /> <TextColor Name="TextColor" />
<TextSelColor Name="TextSelColor" /> <TextSelColor Name="TextSelColor" />
<TextH>27</TextH> <TextH>27</TextH>
<TextRelativeX>0</TextRelativeX> <TextRelativeX>50</TextRelativeX>
<TextRelativeY>0</TextRelativeY> <TextRelativeY>0</TextRelativeY>
<TextMaxW>308</TextMaxW> <TextMaxW>308</TextMaxW>
<TextFont>Outline</TextFont> <TextFont>Outline</TextFont>
@@ -443,7 +443,7 @@
<TextColor Name="TextColor" /> <TextColor Name="TextColor" />
<TextSelColor Name="TextSelColor" /> <TextSelColor Name="TextSelColor" />
<TextH>27</TextH> <TextH>27</TextH>
<TextRelativeX>0</TextRelativeX> <TextRelativeX>50</TextRelativeX>
<TextRelativeY>0</TextRelativeY> <TextRelativeY>0</TextRelativeY>
<TextMaxW>308</TextMaxW> <TextMaxW>308</TextMaxW>
<TextFont>Outline</TextFont> <TextFont>Outline</TextFont>
@@ -485,7 +485,7 @@
<TextColor Name="TextColor" /> <TextColor Name="TextColor" />
<TextSelColor Name="TextSelColor" /> <TextSelColor Name="TextSelColor" />
<TextH>27</TextH> <TextH>27</TextH>
<TextRelativeX>0</TextRelativeX> <TextRelativeX>50</TextRelativeX>
<TextRelativeY>0</TextRelativeY> <TextRelativeY>0</TextRelativeY>
<TextMaxW>308</TextMaxW> <TextMaxW>308</TextMaxW>
<TextFont>Outline</TextFont> <TextFont>Outline</TextFont>
@@ -527,7 +527,7 @@
<TextColor Name="TextColor" /> <TextColor Name="TextColor" />
<TextSelColor Name="TextSelColor" /> <TextSelColor Name="TextSelColor" />
<TextH>27</TextH> <TextH>27</TextH>
<TextRelativeX>0</TextRelativeX> <TextRelativeX>50</TextRelativeX>
<TextRelativeY>0</TextRelativeY> <TextRelativeY>0</TextRelativeY>
<TextMaxW>308</TextMaxW> <TextMaxW>308</TextMaxW>
<TextFont>Outline</TextFont> <TextFont>Outline</TextFont>
@@ -569,7 +569,7 @@
<TextColor Name="TextColor" /> <TextColor Name="TextColor" />
<TextSelColor Name="TextSelColor" /> <TextSelColor Name="TextSelColor" />
<TextH>27</TextH> <TextH>27</TextH>
<TextRelativeX>0</TextRelativeX> <TextRelativeX>50</TextRelativeX>
<TextRelativeY>0</TextRelativeY> <TextRelativeY>0</TextRelativeY>
<TextMaxW>616</TextMaxW> <TextMaxW>616</TextMaxW>
<TextFont>Outline</TextFont> <TextFont>Outline</TextFont>
@@ -611,7 +611,7 @@
<TextColor Name="TextColor" /> <TextColor Name="TextColor" />
<TextSelColor Name="TextSelColor" /> <TextSelColor Name="TextSelColor" />
<TextH>27</TextH> <TextH>27</TextH>
<TextRelativeX>0</TextRelativeX> <TextRelativeX>50</TextRelativeX>
<TextRelativeY>0</TextRelativeY> <TextRelativeY>0</TextRelativeY>
<TextMaxW>616</TextMaxW> <TextMaxW>616</TextMaxW>
<TextFont>Outline</TextFont> <TextFont>Outline</TextFont>
@@ -280,7 +280,7 @@
<TextColor Name="TextColor" /> <TextColor Name="TextColor" />
<TextSelColor Name="TextSelColor" /> <TextSelColor Name="TextSelColor" />
<TextH>27</TextH> <TextH>27</TextH>
<TextRelativeX>0</TextRelativeX> <TextRelativeX>50</TextRelativeX>
<TextRelativeY>0</TextRelativeY> <TextRelativeY>0</TextRelativeY>
<TextMaxW>205.33</TextMaxW> <TextMaxW>205.33</TextMaxW>
<TextFont>Outline</TextFont> <TextFont>Outline</TextFont>
@@ -322,7 +322,7 @@
<TextColor Name="TextColor" /> <TextColor Name="TextColor" />
<TextSelColor Name="TextSelColor" /> <TextSelColor Name="TextSelColor" />
<TextH>27</TextH> <TextH>27</TextH>
<TextRelativeX>0</TextRelativeX> <TextRelativeX>50</TextRelativeX>
<TextRelativeY>0</TextRelativeY> <TextRelativeY>0</TextRelativeY>
<TextMaxW>205.33</TextMaxW> <TextMaxW>205.33</TextMaxW>
<TextFont>Outline</TextFont> <TextFont>Outline</TextFont>
@@ -364,7 +364,7 @@
<TextColor Name="TextColor" /> <TextColor Name="TextColor" />
<TextSelColor Name="TextSelColor" /> <TextSelColor Name="TextSelColor" />
<TextH>27</TextH> <TextH>27</TextH>
<TextRelativeX>0</TextRelativeX> <TextRelativeX>50</TextRelativeX>
<TextRelativeY>0</TextRelativeY> <TextRelativeY>0</TextRelativeY>
<TextMaxW>205.33</TextMaxW> <TextMaxW>205.33</TextMaxW>
<TextFont>Outline</TextFont> <TextFont>Outline</TextFont>
@@ -406,7 +406,7 @@
<TextColor Name="TextColor" /> <TextColor Name="TextColor" />
<TextSelColor Name="TextSelColor" /> <TextSelColor Name="TextSelColor" />
<TextH>27</TextH> <TextH>27</TextH>
<TextRelativeX>0</TextRelativeX> <TextRelativeX>50</TextRelativeX>
<TextRelativeY>0</TextRelativeY> <TextRelativeY>0</TextRelativeY>
<TextMaxW>205.33</TextMaxW> <TextMaxW>205.33</TextMaxW>
<TextFont>Outline</TextFont> <TextFont>Outline</TextFont>
@@ -448,7 +448,7 @@
<TextColor Name="TextColor" /> <TextColor Name="TextColor" />
<TextSelColor Name="TextSelColor" /> <TextSelColor Name="TextSelColor" />
<TextH>27</TextH> <TextH>27</TextH>
<TextRelativeX>0</TextRelativeX> <TextRelativeX>50</TextRelativeX>
<TextRelativeY>0</TextRelativeY> <TextRelativeY>0</TextRelativeY>
<TextMaxW>205.33</TextMaxW> <TextMaxW>205.33</TextMaxW>
<TextFont>Outline</TextFont> <TextFont>Outline</TextFont>
@@ -490,7 +490,7 @@
<TextColor Name="TextColor" /> <TextColor Name="TextColor" />
<TextSelColor Name="TextSelColor" /> <TextSelColor Name="TextSelColor" />
<TextH>27</TextH> <TextH>27</TextH>
<TextRelativeX>0</TextRelativeX> <TextRelativeX>50</TextRelativeX>
<TextRelativeY>0</TextRelativeY> <TextRelativeY>0</TextRelativeY>
<TextMaxW>150</TextMaxW> <TextMaxW>150</TextMaxW>
<TextFont>Outline</TextFont> <TextFont>Outline</TextFont>
@@ -348,7 +348,7 @@
<TextColor Name="TextColor" /> <TextColor Name="TextColor" />
<TextSelColor Name="TextSelColor" /> <TextSelColor Name="TextSelColor" />
<TextH>27</TextH> <TextH>27</TextH>
<TextRelativeX>0</TextRelativeX> <TextRelativeX>50</TextRelativeX>
<TextRelativeY>0</TextRelativeY> <TextRelativeY>0</TextRelativeY>
<TextMaxW>600</TextMaxW> <TextMaxW>600</TextMaxW>
<TextFont>Outline</TextFont> <TextFont>Outline</TextFont>
@@ -509,7 +509,7 @@
<TextColor Name="TextColor" /> <TextColor Name="TextColor" />
<TextSelColor Name="TextSelColor" /> <TextSelColor Name="TextSelColor" />
<TextH>27</TextH> <TextH>27</TextH>
<TextRelativeX>0</TextRelativeX> <TextRelativeX>50</TextRelativeX>
<TextRelativeY>0</TextRelativeY> <TextRelativeY>0</TextRelativeY>
<TextMaxW>219.2</TextMaxW> <TextMaxW>219.2</TextMaxW>
<TextFont>Outline</TextFont> <TextFont>Outline</TextFont>
@@ -551,7 +551,7 @@
<TextColor Name="TextColor" /> <TextColor Name="TextColor" />
<TextSelColor Name="TextSelColor" /> <TextSelColor Name="TextSelColor" />
<TextH>27</TextH> <TextH>27</TextH>
<TextRelativeX>0</TextRelativeX> <TextRelativeX>50</TextRelativeX>
<TextRelativeY>0</TextRelativeY> <TextRelativeY>0</TextRelativeY>
<TextMaxW>208.67</TextMaxW> <TextMaxW>208.67</TextMaxW>
<TextFont>Outline</TextFont> <TextFont>Outline</TextFont>
@@ -593,7 +593,7 @@
<TextColor Name="TextColor" /> <TextColor Name="TextColor" />
<TextSelColor Name="TextSelColor" /> <TextSelColor Name="TextSelColor" />
<TextH>27</TextH> <TextH>27</TextH>
<TextRelativeX>0</TextRelativeX> <TextRelativeX>50</TextRelativeX>
<TextRelativeY>0</TextRelativeY> <TextRelativeY>0</TextRelativeY>
<TextMaxW>208.67</TextMaxW> <TextMaxW>208.67</TextMaxW>
<TextFont>Outline</TextFont> <TextFont>Outline</TextFont>
@@ -635,7 +635,7 @@
<TextColor Name="TextColor" /> <TextColor Name="TextColor" />
<TextSelColor Name="TextSelColor" /> <TextSelColor Name="TextSelColor" />
<TextH>27</TextH> <TextH>27</TextH>
<TextRelativeX>0</TextRelativeX> <TextRelativeX>50</TextRelativeX>
<TextRelativeY>0</TextRelativeY> <TextRelativeY>0</TextRelativeY>
<TextMaxW>313</TextMaxW> <TextMaxW>313</TextMaxW>
<TextFont>Outline</TextFont> <TextFont>Outline</TextFont>
@@ -677,7 +677,7 @@
<TextColor Name="TextColor" /> <TextColor Name="TextColor" />
<TextSelColor Name="TextSelColor" /> <TextSelColor Name="TextSelColor" />
<TextH>27</TextH> <TextH>27</TextH>
<TextRelativeX>0</TextRelativeX> <TextRelativeX>50</TextRelativeX>
<TextRelativeY>0</TextRelativeY> <TextRelativeY>0</TextRelativeY>
<TextMaxW>313</TextMaxW> <TextMaxW>313</TextMaxW>
<TextFont>Outline</TextFont> <TextFont>Outline</TextFont>
+5 -5
View File
@@ -899,7 +899,7 @@
<TextColor Name="TextColor" /> <TextColor Name="TextColor" />
<TextSelColor Name="TextSelColor" /> <TextSelColor Name="TextSelColor" />
<TextH>25</TextH> <TextH>25</TextH>
<TextRelativeX>0</TextRelativeX> <TextRelativeX>50</TextRelativeX>
<TextRelativeY>0</TextRelativeY> <TextRelativeY>0</TextRelativeY>
<TextMaxW>280</TextMaxW> <TextMaxW>280</TextMaxW>
<TextFont>Outline</TextFont> <TextFont>Outline</TextFont>
@@ -941,7 +941,7 @@
<TextColor Name="TextColor" /> <TextColor Name="TextColor" />
<TextSelColor Name="TextSelColor" /> <TextSelColor Name="TextSelColor" />
<TextH>25</TextH> <TextH>25</TextH>
<TextRelativeX>0</TextRelativeX> <TextRelativeX>50</TextRelativeX>
<TextRelativeY>0</TextRelativeY> <TextRelativeY>0</TextRelativeY>
<TextMaxW>280</TextMaxW> <TextMaxW>280</TextMaxW>
<TextFont>Outline</TextFont> <TextFont>Outline</TextFont>
@@ -983,7 +983,7 @@
<TextColor Name="TextColor" /> <TextColor Name="TextColor" />
<TextSelColor Name="TextSelColor" /> <TextSelColor Name="TextSelColor" />
<TextH>25</TextH> <TextH>25</TextH>
<TextRelativeX>0</TextRelativeX> <TextRelativeX>50</TextRelativeX>
<TextRelativeY>0</TextRelativeY> <TextRelativeY>0</TextRelativeY>
<TextMaxW>280</TextMaxW> <TextMaxW>280</TextMaxW>
<TextFont>Outline</TextFont> <TextFont>Outline</TextFont>
@@ -1025,7 +1025,7 @@
<TextColor Name="TextColor" /> <TextColor Name="TextColor" />
<TextSelColor Name="TextSelColor" /> <TextSelColor Name="TextSelColor" />
<TextH>25</TextH> <TextH>25</TextH>
<TextRelativeX>0</TextRelativeX> <TextRelativeX>50</TextRelativeX>
<TextRelativeY>0</TextRelativeY> <TextRelativeY>0</TextRelativeY>
<TextMaxW>280</TextMaxW> <TextMaxW>280</TextMaxW>
<TextFont>Outline</TextFont> <TextFont>Outline</TextFont>
@@ -1232,7 +1232,7 @@
<Text /> <Text />
</Text> </Text>
</ButtonPlaylistSing> </ButtonPlaylistSing>
<SelectSlideGameMode> <SelectSlideGameMode Name="SelectSlideGameMode">
<Skin>Button</Skin> <Skin>Button</Skin>
<SkinArrowLeft>SelectSlideArrowLeft</SkinArrowLeft> <SkinArrowLeft>SelectSlideArrowLeft</SkinArrowLeft>
<SkinArrowRight>SelectSlideArrowRight</SkinArrowRight> <SkinArrowRight>SelectSlideArrowRight</SkinArrowRight>
+87 -169
View File
@@ -17,218 +17,136 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Diagnostics;
using System.Linq; using System.Linq;
using VocaluxeLib.Utils.Combinatorics;
namespace VocaluxeLib.PartyModes.Challenge namespace VocaluxeLib.PartyModes.Challenge
{ {
public class CChallengeRounds public class CChallengeRounds
{ {
private readonly Random _Rand; private readonly List<CRound> _Rounds = new List<CRound>();
private readonly int _NumPlayer;
public readonly List<CCombination> Rounds;
public int Count public int Count
{ {
get { return Rounds.Count; } get { return _Rounds.Count; }
} }
public CCombination this[int index] public CRound this[int index]
{ {
get { return Rounds[index]; } get { return _Rounds[index]; }
} }
public CChallengeRounds(int numRounds, int numPlayer, int numPlayerAtOnce) public CChallengeRounds(int numRounds, int numPlayer, int playersPerRound)
{ {
Rounds = new List<CCombination>(); if (numRounds < 1 || numPlayer < 1 || playersPerRound < 1)
_Rand = new Random(DateTime.Now.Millisecond); throw new ArgumentException("Invalid paramters for the rounds");
if (numPlayerAtOnce < 1 || numRounds < 1 || numPlayer == 0) if (playersPerRound > numPlayer)
_NumPlayer = 0; playersPerRound = numPlayer;
else
_BuildRounds(numRounds, numPlayer, playersPerRound);
if (Count > numRounds)
{ {
_NumPlayer = numPlayer; //Try again and take the better one
_BuildRounds(numRounds, numPlayerAtOnce, _Rand); List<CRound> old = new List<CRound>(_Rounds);
_Rounds.Clear();
_BuildRounds(numRounds, numPlayer, playersPerRound);
if (Count > old.Count)
{
_Rounds.Clear();
_Rounds.AddRange(old);
}
} }
} }
public CCombination GetRound(int roundNr) /// <summary>
/// Divides players in 2 categories: Those how sung the most and the others
/// </summary>
/// <param name="numSung">List matching the playerIndex to the number of songs sung</param>
private static List<int> _GetPlayersForRound(IList<int> numSung)
{ {
if (roundNr >= Rounds.Count || _NumPlayer == 0 || Rounds.Count == 0) List<int> mustSing = new List<int>();
return null; int max = numSung.Max();
for (int i = 0; i < numSung.Count; i++)
return Rounds[roundNr]; {
if (numSung[i] < max)
mustSing.Add(i);
}
return mustSing;
} }
private void _BuildRounds(int numRounds, int numPlayerAtOnce, Random rand) private static void _AddCombinations(int numPlayer, int playersPerRound, List<CRound> combinations)
{ {
CCombinations combinations = new CCombinations(_NumPlayer, numPlayerAtOnce, rand); List<int> input = new List<int>(numPlayer);
Rounds.Add(combinations.GetNextCombination(null)); for (int i = 0; i < numPlayer; i++)
input.Add(i);
for (int i = 1; i < numRounds; i++) CCombinations<int> combs = new CCombinations<int>(input, playersPerRound);
Rounds.Add(combinations.GetNextCombination(_GetPlayerDemand(i))); combinations.AddRange(combs.Select(combination => new CRound(combination)));
combinations.Shuffle();
} }
private IEnumerable<int> _GetPlayerDemand(int roundIndex) private static CRound _GetMatchingCombination(List<int> playersInRound, List<int> numSung, List<CRound> combinations)
{ {
List<int> numPlayed = new List<int>(_NumPlayer); foreach (CRound round in combinations)
for (int i = 0; i < _NumPlayer; i++)
numPlayed.Add(0);
for (int i = 0; i < roundIndex; i++)
{ {
foreach (int playerIndex in Rounds[i].Player) int matching = round.Players.Count(playersInRound.Contains);
numPlayed[playerIndex]++; // A valid round contains only players from playersInRound or all players from playersInRound (and some others)
if (matching == round.Players.Count || matching == playersInRound.Count)
return round;
} }
// It may happen, that there are only players that already sung against each other. So create a 2nd best option with the most number of players that should sing in it
int max = numPlayed.Max(); int maxMatching = combinations.Max(c => c.Players.Count(playersInRound.Contains));
List<CRound> nextOptions = combinations.Where(c => c.Players.Count(playersInRound.Contains) == maxMatching).ToList();
int num = Rounds[0].Player.Count; // And select the combination that minimizes the sum of the number of songs sung (--> favor rounds with players that sung less than others)
List<int> result = new List<int>(); CRound result = null;
List<int> other = new List<int>(); int minSung = int.MaxValue;
List<int> last = new List<int>(); foreach (CRound round in nextOptions)
for (int i = 0; i < numPlayed.Count; i++)
{ {
if (roundIndex == 0 || numPlayed[i] < max) int curNumSung = round.Players.Sum(pl => numSung[pl]);
if (curNumSung < minSung)
{ {
if (roundIndex == 0 || roundIndex > 0 && numPlayed[i] < max && !Rounds[roundIndex - 1].IsAvailable(i)) minSung = curNumSung;
result.Add(i); result = round;
else if (numPlayed[i] < max)
other.Add(i);
}
else
{
if (roundIndex > 0)
{
if (!Rounds[roundIndex - 1].IsAvailable(i))
other.Add(i);
else
last.Add(i);
}
else
last.Add(i);
} }
} }
Debug.Assert(result != null);
while (result.Count < num && other.Count > 0)
{
int n = other.Count;
int r = _Rand.Next(n);
result.Add(other[r]);
other.RemoveAt(r);
}
while (result.Count < num)
{
int n = last.Count;
int r = _Rand.Next(n);
result.Add(last[r]);
last.RemoveAt(r);
}
while (result.Count > num)
{
int n = result.Count;
int r = _Rand.Next(n);
result.RemoveAt(r);
}
result.Sort();
return result; return result;
} }
}
class CCombinations private void _BuildRounds(int numRounds, int numPlayer, int playersPerRound)
{ {
private readonly List<CCombination> _Combs; // What we want is that every player sung the same amount of songs
private readonly Random _Rand; // So we keep track how many songs each palyer sung
private readonly int _NumPlayer; List<int> numSung = new List<int>(numPlayer);
private readonly int _NumMics; for (int i = 0; i < numPlayer; i++)
numSung.Add(0);
public CCombinations(int numPlayer, int numMics, Random rand) List<CRound> combinations = new List<CRound>();
// Posibly add more rounds than requested if the song count per player is unequal
for (int i = 0; i < numRounds * 10; i++)
{ {
_Combs = new List<CCombination>(); if (combinations.Count == 0)
_NumMics = numMics; _AddCombinations(numPlayer, playersPerRound, combinations);
_NumPlayer = numPlayer; List<int> playersInRound = _GetPlayersForRound(numSung);
_Rand = rand; CRound curRound = _GetMatchingCombination(playersInRound, numSung, combinations);
foreach (int player in curRound.Players)
numSung[player]++;
_Rounds.Add(curRound);
combinations.Remove(curRound);
//Stop if we have enough rounds and all players sung the same amount of songs
if (_Rounds.Count >= numRounds && numSung.All(ct => ct == numSung[0]))
break;
}
}
} }
public CCombination GetNextCombination(IEnumerable<int> playerNrDemand) public class CRound
{ {
if (_Combs.Count == 0) public readonly List<int> Players;
_Create();
if (_NumPlayer == _NumMics) public CRound(List<int> players)
return _Combs[0];
//filter against PlayerNrDemand
List<CCombination> combsFiltered = new List<CCombination>();
if (playerNrDemand != null)
combsFiltered.AddRange(_Combs.Where(t => t.IsAvailableAll(playerNrDemand)));
//1st fallback
if (playerNrDemand != null && combsFiltered.Count == 0)
combsFiltered.AddRange(_Combs.Where(t => t.IsAvailableSomeone(playerNrDemand)));
//2nd fallback
if (combsFiltered.Count == 0)
combsFiltered.AddRange(_Combs);
int num = combsFiltered.Count;
int rand = _Rand.Next(num);
CCombination c = new CCombination();
for (int i = 0; i < combsFiltered[rand].Player.Count; i++)
c.Player.Add(combsFiltered[rand].Player[i]);
_Combs.Remove(combsFiltered[rand]);
return combsFiltered[rand];
}
private void _Create()
{ {
_Combs.Clear(); Players = players.Shuffle();
int num = (int)Math.Pow(2, _NumPlayer);
for (int i = 1; i <= num; i++)
{
CCombination c = new CCombination();
for (int j = 0; j < _NumPlayer; j++)
{
if ((i & (1 << j)) > 0)
c.Player.Add(j);
}
if (c.Player.Count == _NumMics)
_Combs.Add(c);
}
}
}
public class CCombination
{
public readonly List<int> Player;
public CCombination()
{
Player = new List<int>();
}
public bool IsAvailable(int playerIndex)
{
return Player.Any(p => p == playerIndex);
}
public bool IsAvailableAll(IEnumerable<int> playerIndices)
{
return playerIndices.All(IsAvailable);
}
public bool IsAvailableSomeone(IEnumerable<int> playerIndices)
{
return playerIndices.Any(IsAvailable);
} }
} }
} }
@@ -67,11 +67,38 @@ namespace VocaluxeLib.PartyModes.Challenge
public sealed class CPartyModeChallenge : CPartyMode public sealed class CPartyModeChallenge : CPartyMode
// ReSharper restore ClassNeverInstantiated.Global // ReSharper restore ClassNeverInstantiated.Global
{ {
private const int _MaxPlayer = 12; public override int MinMics
private const int _MinPlayer = 1; {
private const int _MaxTeams = 0; get { return 1; }
private const int _MinTeams = 0; }
private const int _MaxNumRounds = 100; public override int MaxMics
{
get { return CBase.Config.GetMaxNumMics(); }
}
public override int MinPlayers
{
get { return 1; }
}
public override int MaxPlayers
{
get { return 12; }
}
public override int MinTeams
{
get { return 1; }
}
public override int MaxTeams
{
get { return 1; }
}
public override int MinPlayersPerTeam
{
get { return MinPlayers; }
}
public override int MaxPlayersPerTeam
{
get { return MaxPlayers; }
}
private enum EStage private enum EStage
{ {
@@ -108,7 +135,7 @@ namespace VocaluxeLib.PartyModes.Challenge
public SData GameData; public SData GameData;
private EStage _Stage; private EStage _Stage;
public CPartyModeChallenge(int id, string folder) : base(id, folder) public CPartyModeChallenge(int id) : base(id)
{ {
_ScreenSongOptions.Selection.RandomOnly = false; _ScreenSongOptions.Selection.RandomOnly = false;
_ScreenSongOptions.Selection.PartyMode = true; _ScreenSongOptions.Selection.PartyMode = true;
@@ -125,6 +152,8 @@ namespace VocaluxeLib.PartyModes.Challenge
public override bool Init() public override bool Init()
{ {
if (!base.Init())
return false;
_Stage = EStage.Config; _Stage = EStage.Config;
_ScreenSongOptions.Sorting.IgnoreArticles = CBase.Config.GetIgnoreArticles(); _ScreenSongOptions.Sorting.IgnoreArticles = CBase.Config.GetIgnoreArticles();
@@ -283,31 +312,6 @@ namespace VocaluxeLib.PartyModes.Challenge
_ScreenSongOptions.Sorting.SearchActive = visible; _ScreenSongOptions.Sorting.SearchActive = visible;
} }
public override int GetMaxPlayer()
{
return _MaxPlayer;
}
public override int GetMinPlayer()
{
return _MinPlayer;
}
public override int GetMaxTeams()
{
return _MaxTeams;
}
public override int GetMinTeams()
{
return _MinTeams;
}
public override int GetMaxNumRounds()
{
return _MaxNumRounds;
}
public override void JokerUsed(int teamNr) public override void JokerUsed(int teamNr)
{ {
if (_ScreenSongOptions.Selection.NumJokers == null) if (_ScreenSongOptions.Selection.NumJokers == null)
@@ -337,13 +341,13 @@ namespace VocaluxeLib.PartyModes.Challenge
if (players.Length < GameData.NumPlayerAtOnce) if (players.Length < GameData.NumPlayerAtOnce)
return; return;
CCombination c = GameData.Rounds.GetRound(GameData.CurrentRoundNr - 1); CRound c = GameData.Rounds[GameData.CurrentRoundNr - 1];
for (int i = 0; i < GameData.NumPlayerAtOnce; i++) for (int i = 0; i < GameData.NumPlayerAtOnce; i++)
{ {
//try to fill with the right data //try to fill with the right data
if (c != null) if (c != null)
players[i].ProfileID = GameData.ProfileIDs[c.Player[i]]; players[i].ProfileID = GameData.ProfileIDs[c.Players[i]];
else else
players[i].ProfileID = -1; players[i].ProfileID = -1;
} }
@@ -409,15 +413,10 @@ namespace VocaluxeLib.PartyModes.Challenge
} }
_ScreenSongOptions.Selection.TeamNames = new string[GameData.NumPlayerAtOnce]; _ScreenSongOptions.Selection.TeamNames = new string[GameData.NumPlayerAtOnce];
CCombination c = GameData.Rounds.GetRound(GameData.CurrentRoundNr - 1); CRound c = GameData.Rounds[GameData.CurrentRoundNr - 1];
for (int i = 0; i < GameData.NumPlayerAtOnce; i++) for (int i = 0; i < GameData.NumPlayerAtOnce; i++)
{ _ScreenSongOptions.Selection.TeamNames[i] = CBase.Profiles.GetPlayerName(GameData.ProfileIDs[c.Players[i]]);
if (c != null)
_ScreenSongOptions.Selection.TeamNames[i] = CBase.Profiles.GetPlayerName(GameData.ProfileIDs[c.Player[i]]);
else
_ScreenSongOptions.Selection.TeamNames[i] = "foobar";
}
} }
private void _UpdateScores() private void _UpdateScores()
@@ -437,8 +436,6 @@ namespace VocaluxeLib.PartyModes.Challenge
GameData.Results[i, j] = 0; GameData.Results[i, j] = 0;
} }
} }
else
{
SPlayer[] results = CBase.Game.GetPlayers(); SPlayer[] results = CBase.Game.GetPlayers();
if (results == null) if (results == null)
return; return;
@@ -474,7 +471,7 @@ namespace VocaluxeLib.PartyModes.Challenge
GameData.ResultTable[index] = row; GameData.ResultTable[index] = row;
} }
}
GameData.ResultTable.Sort(); GameData.ResultTable.Sort();
@@ -15,6 +15,7 @@
// along with Vocaluxe. If not, see <http://www.gnu.org/licenses/>. // along with Vocaluxe. If not, see <http://www.gnu.org/licenses/>.
#endregion #endregion
using System;
using System.Windows.Forms; using System.Windows.Forms;
namespace VocaluxeLib.PartyModes.Challenge namespace VocaluxeLib.PartyModes.Challenge
@@ -35,8 +36,7 @@ namespace VocaluxeLib.PartyModes.Challenge
private const string _ButtonNext = "ButtonNext"; private const string _ButtonNext = "ButtonNext";
private const string _ButtonBack = "ButtonBack"; private const string _ButtonBack = "ButtonBack";
private int _MaxNumMics = 2; private const int _MaxNumRounds = 100;
private int _MaxNumRounds = 100;
private int _RoundSteps = 1; private int _RoundSteps = 1;
public override void Init() public override void Init()
@@ -107,12 +107,6 @@ namespace VocaluxeLib.PartyModes.Challenge
{ {
base.OnShow(); base.OnShow();
_MaxNumMics = CBase.Config.GetMaxNumMics();
if (_MaxNumMics > 6)
_MaxNumMics = 6;
_MaxNumRounds = _PartyMode.GetMaxNumRounds();
_RebuildSlides(); _RebuildSlides();
} }
@@ -125,9 +119,9 @@ namespace VocaluxeLib.PartyModes.Challenge
{ {
// build num player slide (min player ... max player); // build num player slide (min player ... max player);
_SelectSlides[_SelectSlideNumPlayers].Clear(); _SelectSlides[_SelectSlideNumPlayers].Clear();
for (int i = _PartyMode.GetMinPlayer(); i <= _PartyMode.GetMaxPlayer(); i++) for (int i = _PartyMode.MinPlayers; i <= _PartyMode.MaxPlayers; i++)
_SelectSlides[_SelectSlideNumPlayers].AddValue(i.ToString()); _SelectSlides[_SelectSlideNumPlayers].AddValue(i.ToString());
_SelectSlides[_SelectSlideNumPlayers].Selection = _PartyMode.GameData.NumPlayer - _PartyMode.GetMinPlayer(); _SelectSlides[_SelectSlideNumPlayers].SelectedValue = _PartyMode.GameData.NumPlayer.ToString();
_UpdateMicsAtOnce(); _UpdateMicsAtOnce();
_SetRoundSteps(); _SetRoundSteps();
@@ -138,8 +132,8 @@ namespace VocaluxeLib.PartyModes.Challenge
{ {
int player = _PartyMode.GameData.NumPlayer; int player = _PartyMode.GameData.NumPlayer;
int mics = _PartyMode.GameData.NumPlayerAtOnce; int mics = _PartyMode.GameData.NumPlayerAtOnce;
_PartyMode.GameData.NumPlayer = _SelectSlides[_SelectSlideNumPlayers].Selection + _PartyMode.GetMinPlayer(); _PartyMode.GameData.NumPlayer = _SelectSlides[_SelectSlideNumPlayers].Selection + _PartyMode.MinPlayers;
_PartyMode.GameData.NumPlayerAtOnce = _SelectSlides[_SelectSlideNumMics].Selection + _PartyMode.GetMinPlayer(); _PartyMode.GameData.NumPlayerAtOnce = _SelectSlides[_SelectSlideNumMics].Selection + _PartyMode.MinPlayers;
_PartyMode.GameData.NumRounds = (_SelectSlides[_SelectSlideNumRounds].Selection + 1) * _RoundSteps; _PartyMode.GameData.NumRounds = (_SelectSlides[_SelectSlideNumRounds].Selection + 1) * _RoundSteps;
_UpdateMicsAtOnce(); _UpdateMicsAtOnce();
@@ -158,9 +152,7 @@ namespace VocaluxeLib.PartyModes.Challenge
private void _UpdateMicsAtOnce() private void _UpdateMicsAtOnce()
{ {
int maxNum = _MaxNumMics; int maxNum = Math.Min(_PartyMode.MaxMics, _PartyMode.GameData.NumPlayer);
if (_PartyMode.GameData.NumPlayer < _MaxNumMics)
maxNum = _PartyMode.GameData.NumPlayer;
if (_PartyMode.GameData.NumPlayerAtOnce > maxNum) if (_PartyMode.GameData.NumPlayerAtOnce > maxNum)
_PartyMode.GameData.NumPlayerAtOnce = maxNum; _PartyMode.GameData.NumPlayerAtOnce = maxNum;
@@ -169,7 +161,7 @@ namespace VocaluxeLib.PartyModes.Challenge
_SelectSlides[_SelectSlideNumMics].Clear(); _SelectSlides[_SelectSlideNumMics].Clear();
for (int i = 1; i <= maxNum; i++) for (int i = 1; i <= maxNum; i++)
_SelectSlides[_SelectSlideNumMics].AddValue(i.ToString()); _SelectSlides[_SelectSlideNumMics].AddValue(i.ToString());
_SelectSlides[_SelectSlideNumMics].Selection = _PartyMode.GameData.NumPlayerAtOnce - _PartyMode.GetMinPlayer(); _SelectSlides[_SelectSlideNumMics].Selection = _PartyMode.GameData.NumPlayerAtOnce - _PartyMode.MinPlayers;
} }
private void _UpdateSlideRounds() private void _UpdateSlideRounds()
@@ -119,7 +119,7 @@ namespace VocaluxeLib.PartyModes.Challenge
_NextPlayerTexts = new List<CText>(); _NextPlayerTexts = new List<CText>();
_NextPlayerStatics = new List<CStatic>(); _NextPlayerStatics = new List<CStatic>();
for (int i = 0; i < _PartyMode.GetMaxPlayer(); i++) for (int i = 0; i < _PartyMode.MaxPlayers; i++)
{ {
_NextPlayerTexts.Add(GetNewText(_Texts[_TextNextPlayer])); _NextPlayerTexts.Add(GetNewText(_Texts[_TextNextPlayer]));
_AddText(_NextPlayerTexts[_NextPlayerTexts.Count - 1]); _AddText(_NextPlayerTexts[_NextPlayerTexts.Count - 1]);
@@ -326,7 +326,7 @@ namespace VocaluxeLib.PartyModes.Challenge
x += _Statics[_StaticNextPlayer].Rect.W + 15; x += _Statics[_StaticNextPlayer].Rect.W + 15;
} }
for (int i = _PartyMode.GameData.NumPlayerAtOnce; i < _PartyMode.GetMaxPlayer(); i++) for (int i = _PartyMode.GameData.NumPlayerAtOnce; i < _PartyMode.MaxPlayers; i++)
{ {
_NextPlayerStatics[i].Visible = false; _NextPlayerStatics[i].Visible = false;
_NextPlayerTexts[i].Visible = false; _NextPlayerTexts[i].Visible = false;
@@ -340,7 +340,7 @@ namespace VocaluxeLib.PartyModes.Challenge
_Texts[_TextNextPlayerMessage].Visible = true; _Texts[_TextNextPlayerMessage].Visible = true;
for (int i = 0; i < _PartyMode.GameData.NumPlayerAtOnce; i++) for (int i = 0; i < _PartyMode.GameData.NumPlayerAtOnce; i++)
{ {
int id = _PartyMode.GameData.ProfileIDs[_PartyMode.GameData.Rounds[_PartyMode.GameData.CurrentRoundNr - 1].Player[i]]; int id = _PartyMode.GameData.ProfileIDs[_PartyMode.GameData.Rounds[_PartyMode.GameData.CurrentRoundNr - 1].Players[i]];
_NextPlayerStatics[i].Texture = CBase.Profiles.GetAvatar(id); _NextPlayerStatics[i].Texture = CBase.Profiles.GetAvatar(id);
_NextPlayerTexts[i].Text = CBase.Profiles.GetPlayerName(id); _NextPlayerTexts[i].Text = CBase.Profiles.GetPlayerName(id);
_NextPlayerTexts[i].Color = CBase.Themes.GetPlayerColor(i + 1); _NextPlayerTexts[i].Color = CBase.Themes.GetPlayerColor(i + 1);
@@ -452,14 +452,14 @@ namespace VocaluxeLib.PartyModes.Challenge
{ {
for (int p = 0; p < _RoundsTable[i].TextPlayer.Count; p++) for (int p = 0; p < _RoundsTable[i].TextPlayer.Count; p++)
{ {
if (_PartyMode.GameData.Rounds.Count > i + _RoundsTableOffset && _PartyMode.GameData.Rounds[i + _RoundsTableOffset].Player.Count > p) if (_PartyMode.GameData.Rounds.Count > i + _RoundsTableOffset && _PartyMode.GameData.Rounds[i + _RoundsTableOffset].Players.Count > p)
{ {
_RoundsTable[i].Number.Visible = true; _RoundsTable[i].Number.Visible = true;
_RoundsTable[i].TextPlayer[p].Visible = true; _RoundsTable[i].TextPlayer[p].Visible = true;
_RoundsTable[i].TextScores[p].Visible = true; _RoundsTable[i].TextScores[p].Visible = true;
_RoundsTable[i].Number.Text = (i + 1 + _RoundsTableOffset) + ")"; _RoundsTable[i].Number.Text = (i + 1 + _RoundsTableOffset) + ")";
_RoundsTable[i].TextPlayer[p].Text = _RoundsTable[i].TextPlayer[p].Text =
CBase.Profiles.GetPlayerName(_PartyMode.GameData.ProfileIDs[_PartyMode.GameData.Rounds[i + _RoundsTableOffset].Player[p]]); CBase.Profiles.GetPlayerName(_PartyMode.GameData.ProfileIDs[_PartyMode.GameData.Rounds[i + _RoundsTableOffset].Players[p]]);
// ReSharper disable ConvertIfStatementToConditionalTernaryExpression // ReSharper disable ConvertIfStatementToConditionalTernaryExpression
if ((_PartyMode.GameData.CurrentRoundNr - 1) > i + _RoundsTableOffset) if ((_PartyMode.GameData.CurrentRoundNr - 1) > i + _RoundsTableOffset)
// ReSharper restore ConvertIfStatementToConditionalTernaryExpression // ReSharper restore ConvertIfStatementToConditionalTernaryExpression
@@ -17,218 +17,136 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Diagnostics;
using System.Linq; using System.Linq;
using VocaluxeLib.Utils.Combinatorics;
namespace VocaluxeLib.PartyModes.ChallengeMedley namespace VocaluxeLib.PartyModes.ChallengeMedley
{ {
public class CChallengeRounds public class CChallengeRounds
{ {
private readonly Random _Rand; private readonly List<CRound> _Rounds = new List<CRound>();
private readonly int _NumPlayer;
public readonly List<CCombination> Rounds;
public int Count public int Count
{ {
get { return Rounds.Count; } get { return _Rounds.Count; }
} }
public CCombination this[int index] public CRound this[int index]
{ {
get { return Rounds[index]; } get { return _Rounds[index]; }
} }
public CChallengeRounds(int numRounds, int numPlayer, int numPlayerAtOnce) public CChallengeRounds(int numRounds, int numPlayer, int playersPerRound)
{ {
Rounds = new List<CCombination>(); if (numRounds < 1 || numPlayer < 1 || playersPerRound < 1)
_Rand = new Random(DateTime.Now.Millisecond); throw new ArgumentException("Invalid paramters for the rounds");
if (numPlayerAtOnce < 1 || numRounds < 1 || numPlayer == 0) if (playersPerRound > numPlayer)
_NumPlayer = 0; playersPerRound = numPlayer;
else
_BuildRounds(numRounds, numPlayer, playersPerRound);
if (Count > numRounds)
{ {
_NumPlayer = numPlayer; //Try again and take the better one
_BuildRounds(numRounds, numPlayerAtOnce, _Rand); List<CRound> old = new List<CRound>(_Rounds);
_Rounds.Clear();
_BuildRounds(numRounds, numPlayer, playersPerRound);
if (Count > old.Count)
{
_Rounds.Clear();
_Rounds.AddRange(old);
}
} }
} }
public CCombination GetRound(int roundNr) /// <summary>
/// Divides players in 2 categories: Those how sung the most and the others
/// </summary>
/// <param name="numSung">List matching the playerIndex to the number of songs sung</param>
private static List<int> _GetPlayersForRound(IList<int> numSung)
{ {
if (roundNr >= Rounds.Count || _NumPlayer == 0 || Rounds.Count == 0) List<int> mustSing = new List<int>();
return null; int max = numSung.Max();
for (int i = 0; i < numSung.Count; i++)
return Rounds[roundNr]; {
if (numSung[i] < max)
mustSing.Add(i);
}
return mustSing;
} }
private void _BuildRounds(int numRounds, int numPlayerAtOnce, Random rand) private static void _AddCombinations(int numPlayer, int playersPerRound, List<CRound> combinations)
{ {
CCombinations combinations = new CCombinations(_NumPlayer, numPlayerAtOnce, rand); List<int> input = new List<int>(numPlayer);
Rounds.Add(combinations.GetNextCombination(null)); for (int i = 0; i < numPlayer; i++)
input.Add(i);
for (int i = 1; i < numRounds; i++) CCombinations<int> combs = new CCombinations<int>(input, playersPerRound);
Rounds.Add(combinations.GetNextCombination(_GetPlayerDemand(i))); combinations.AddRange(combs.Select(combination => new CRound(combination)));
combinations.Shuffle();
} }
private IEnumerable<int> _GetPlayerDemand(int roundIndex) private static CRound _GetMatchingCombination(List<int> playersInRound, List<int> numSung, List<CRound> combinations)
{ {
List<int> numPlayed = new List<int>(_NumPlayer); foreach (CRound round in combinations)
for (int i = 0; i < _NumPlayer; i++)
numPlayed.Add(0);
for (int i = 0; i < roundIndex; i++)
{ {
foreach (int playerIndex in Rounds[i].Player) int matching = round.Players.Count(playersInRound.Contains);
numPlayed[playerIndex]++; // A valid round contains only players from playersInRound or all players from playersInRound (and some others)
if (matching == round.Players.Count || matching == playersInRound.Count)
return round;
} }
// It may happen, that there are only players that already sung against each other. So create a 2nd best option with the most number of players that should sing in it
int max = numPlayed.Max(); int maxMatching = combinations.Max(c => c.Players.Count(playersInRound.Contains));
List<CRound> nextOptions = combinations.Where(c => c.Players.Count(playersInRound.Contains) == maxMatching).ToList();
int num = Rounds[0].Player.Count; // And select the combination that minimizes the sum of the number of songs sung (--> favor rounds with players that sung less than others)
List<int> result = new List<int>(); CRound result = null;
List<int> other = new List<int>(); int minSung = int.MaxValue;
List<int> last = new List<int>(); foreach (CRound round in nextOptions)
for (int i = 0; i < numPlayed.Count; i++)
{ {
if (roundIndex == 0 || numPlayed[i] < max) int curNumSung = round.Players.Sum(pl => numSung[pl]);
if (curNumSung < minSung)
{ {
if (roundIndex == 0 || roundIndex > 0 && numPlayed[i] < max && !Rounds[roundIndex - 1].IsAvailable(i)) minSung = curNumSung;
result.Add(i); result = round;
else if (numPlayed[i] < max)
other.Add(i);
}
else
{
if (roundIndex > 0)
{
if (!Rounds[roundIndex - 1].IsAvailable(i))
other.Add(i);
else
last.Add(i);
}
else
last.Add(i);
} }
} }
Debug.Assert(result != null);
while (result.Count < num && other.Count > 0)
{
int n = other.Count;
int r = _Rand.Next(n);
result.Add(other[r]);
other.RemoveAt(r);
}
while (result.Count < num)
{
int n = last.Count;
int r = _Rand.Next(n);
result.Add(last[r]);
last.RemoveAt(r);
}
while (result.Count > num)
{
int n = result.Count;
int r = _Rand.Next(n);
result.RemoveAt(r);
}
result.Sort();
return result; return result;
} }
}
class CCombinations private void _BuildRounds(int numRounds, int numPlayer, int playersPerRound)
{ {
private readonly List<CCombination> _Combs; // What we want is that every player sung the same amount of songs
private readonly Random _Rand; // So we keep track how many songs each palyer sung
private readonly int _NumPlayer; List<int> numSung = new List<int>(numPlayer);
private readonly int _NumMics; for (int i = 0; i < numPlayer; i++)
numSung.Add(0);
public CCombinations(int numPlayer, int numMics, Random rand) List<CRound> combinations = new List<CRound>();
// Posibly add more rounds than requested if the song count per player is unequal
for (int i = 0; i < numRounds * 10; i++)
{ {
_Combs = new List<CCombination>(); if (combinations.Count == 0)
_NumMics = numMics; _AddCombinations(numPlayer, playersPerRound, combinations);
_NumPlayer = numPlayer; List<int> playersInRound = _GetPlayersForRound(numSung);
_Rand = rand; CRound curRound = _GetMatchingCombination(playersInRound, numSung, combinations);
foreach (int player in curRound.Players)
numSung[player]++;
_Rounds.Add(curRound);
combinations.Remove(curRound);
//Stop if we have enough rounds and all players sung the same amount of songs
if (_Rounds.Count >= numRounds && numSung.All(ct => ct == numSung[0]))
break;
}
}
} }
public CCombination GetNextCombination(IEnumerable<int> playerNrDemand) public class CRound
{ {
if (_Combs.Count == 0) public readonly List<int> Players;
_Create();
if (_NumPlayer == _NumMics) public CRound(List<int> players)
return _Combs[0];
//filter against PlayerNrDemand
List<CCombination> combsFiltered = new List<CCombination>();
if (playerNrDemand != null)
combsFiltered.AddRange(_Combs.Where(t => t.IsAvailableAll(playerNrDemand)));
//1st fallback
if (playerNrDemand != null && combsFiltered.Count == 0)
combsFiltered.AddRange(_Combs.Where(t => t.IsAvailableSomeone(playerNrDemand)));
//2nd fallback
if (combsFiltered.Count == 0)
combsFiltered.AddRange(_Combs);
int num = combsFiltered.Count;
int rand = _Rand.Next(num);
CCombination c = new CCombination();
for (int i = 0; i < combsFiltered[rand].Player.Count; i++)
c.Player.Add(combsFiltered[rand].Player[i]);
_Combs.Remove(combsFiltered[rand]);
return combsFiltered[rand];
}
private void _Create()
{ {
_Combs.Clear(); Players = players.Shuffle();
int num = (int)Math.Pow(2, _NumPlayer);
for (int i = 1; i <= num; i++)
{
CCombination c = new CCombination();
for (int j = 0; j < _NumPlayer; j++)
{
if ((i & (1 << j)) > 0)
c.Player.Add(j);
}
if (c.Player.Count == _NumMics)
_Combs.Add(c);
}
}
}
public class CCombination
{
public readonly List<int> Player;
public CCombination()
{
Player = new List<int>();
}
public bool IsAvailable(int playerIndex)
{
return Player.Any(p => p == playerIndex);
}
public bool IsAvailableAll(IEnumerable<int> playerIndices)
{
return playerIndices.All(IsAvailable);
}
public bool IsAvailableSomeone(IEnumerable<int> playerIndices)
{
return playerIndices.Any(IsAvailable);
} }
} }
} }
@@ -72,13 +72,41 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley
public sealed class CPartyModeChallengeMedley : CPartyMode public sealed class CPartyModeChallengeMedley : CPartyMode
// ReSharper restore ClassNeverInstantiated.Global // ReSharper restore ClassNeverInstantiated.Global
{ {
private const int _MaxPlayer = 12;
private const int _MinPlayer = 1;
private const int _MaxTeams = 0;
private const int _MinTeams = 0;
private const int _MaxNumRounds = 100;
private const int _NumSongs = 5; private const int _NumSongs = 5;
public override int MinMics
{
get { return 1; }
}
public override int MaxMics
{
get { return CBase.Config.GetMaxNumMics(); }
}
public override int MinPlayers
{
get { return 1; }
}
public override int MaxPlayers
{
get { return 12; }
}
public override int MinTeams
{
get { return 1; }
}
public override int MaxTeams
{
get { return 1; }
}
public override int MinPlayersPerTeam
{
get { return MinPlayers; }
}
public override int MaxPlayersPerTeam
{
get { return MaxPlayers; }
}
private enum EStage private enum EStage
{ {
Config, Config,
@@ -114,7 +142,7 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley
public SData GameData; public SData GameData;
private EStage _Stage; private EStage _Stage;
public CPartyModeChallengeMedley(int id, string folder) : base(id, folder) public CPartyModeChallengeMedley(int id) : base(id)
{ {
_ScreenSongOptions.Selection.RandomOnly = false; _ScreenSongOptions.Selection.RandomOnly = false;
_ScreenSongOptions.Selection.PartyMode = true; _ScreenSongOptions.Selection.PartyMode = true;
@@ -131,6 +159,8 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley
public override bool Init() public override bool Init()
{ {
if (!base.Init())
return false;
_Stage = EStage.Config; _Stage = EStage.Config;
_ScreenSongOptions.Sorting.IgnoreArticles = EOffOn.TR_CONFIG_OFF; _ScreenSongOptions.Sorting.IgnoreArticles = EOffOn.TR_CONFIG_OFF;
@@ -166,7 +196,7 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley
case EStage.Main: case EStage.Main:
return _Screens["CPartyScreenChallengeMedleyMain"]; return _Screens["CPartyScreenChallengeMedleyMain"];
case EStage.Singing: case EStage.Singing:
return CBase.Graphics.GetScreen(EScreen.Song); return CBase.Graphics.GetScreen(EScreen.Sing);
default: default:
throw new ArgumentException("Invalid stage: " + _Stage); throw new ArgumentException("Invalid stage: " + _Stage);
} }
@@ -290,31 +320,6 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley
_ScreenSongOptions.Sorting.SearchActive = visible; _ScreenSongOptions.Sorting.SearchActive = visible;
} }
public override int GetMaxPlayer()
{
return _MaxPlayer;
}
public override int GetMinPlayer()
{
return _MinPlayer;
}
public override int GetMaxTeams()
{
return _MaxTeams;
}
public override int GetMinTeams()
{
return _MinTeams;
}
public override int GetMaxNumRounds()
{
return _MaxNumRounds;
}
public override void JokerUsed(int teamNr) public override void JokerUsed(int teamNr)
{ {
if (_ScreenSongOptions.Selection.NumJokers == null) if (_ScreenSongOptions.Selection.NumJokers == null)
@@ -361,13 +366,13 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley
if (players.Length < GameData.NumPlayerAtOnce) if (players.Length < GameData.NumPlayerAtOnce)
return false; return false;
CCombination c = GameData.Rounds.GetRound(GameData.CurrentRoundNr - 1); CRound c = GameData.Rounds[GameData.CurrentRoundNr - 1];
for (int i = 0; i < GameData.NumPlayerAtOnce; i++) for (int i = 0; i < GameData.NumPlayerAtOnce; i++)
{ {
//try to fill with the right data //try to fill with the right data
if (c != null) if (c != null)
players[i].ProfileID = GameData.ProfileIDs[c.Player[i]]; players[i].ProfileID = GameData.ProfileIDs[c.Players[i]];
else else
players[i].ProfileID = -1; players[i].ProfileID = -1;
} }
@@ -470,14 +475,14 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley
} }
_ScreenSongOptions.Selection.TeamNames = new string[GameData.NumPlayerAtOnce]; _ScreenSongOptions.Selection.TeamNames = new string[GameData.NumPlayerAtOnce];
CCombination c = GameData.Rounds.GetRound(GameData.CurrentRoundNr - 1); CRound c = GameData.Rounds[GameData.CurrentRoundNr - 1];
for (int i = 0; i < GameData.NumPlayerAtOnce; i++) for (int i = 0; i < GameData.NumPlayerAtOnce; i++)
{ {
if (c != null) if (c != null)
{ {
if (GameData.ProfileIDs[c.Player[i]] < profiles.Length) if (GameData.ProfileIDs[c.Players[i]] < profiles.Length)
_ScreenSongOptions.Selection.TeamNames[i] = profiles[GameData.ProfileIDs[c.Player[i]]].PlayerName; _ScreenSongOptions.Selection.TeamNames[i] = profiles[GameData.ProfileIDs[c.Players[i]]].PlayerName;
else else
_ScreenSongOptions.Selection.TeamNames[i] = "foobar"; _ScreenSongOptions.Selection.TeamNames[i] = "foobar";
} }
@@ -503,8 +508,7 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley
GameData.Results[i, j] = 0; GameData.Results[i, j] = 0;
} }
} }
else
{
CPoints gamePoints = CBase.Game.GetPoints(); CPoints gamePoints = CBase.Game.GetPoints();
if (gamePoints == null || gamePoints.NumPlayer < GameData.NumPlayerAtOnce) if (gamePoints == null || gamePoints.NumPlayer < GameData.NumPlayerAtOnce)
return; return;
@@ -558,7 +562,6 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley
GameData.ResultTable[index] = row; GameData.ResultTable[index] = row;
} }
} }
}
GameData.ResultTable.Sort(); GameData.ResultTable.Sort();
@@ -15,6 +15,7 @@
// along with Vocaluxe. If not, see <http://www.gnu.org/licenses/>. // along with Vocaluxe. If not, see <http://www.gnu.org/licenses/>.
#endregion #endregion
using System;
using System.Windows.Forms; using System.Windows.Forms;
namespace VocaluxeLib.PartyModes.ChallengeMedley namespace VocaluxeLib.PartyModes.ChallengeMedley
@@ -35,8 +36,7 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley
private const string _ButtonNext = "ButtonNext"; private const string _ButtonNext = "ButtonNext";
private const string _ButtonBack = "ButtonBack"; private const string _ButtonBack = "ButtonBack";
private int _MaxNumMics = 2; private const int _MaxNumRounds = 100;
private int _MaxNumRounds = 100;
private int _RoundSteps = 1; private int _RoundSteps = 1;
public override void Init() public override void Init()
@@ -107,12 +107,6 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley
{ {
base.OnShow(); base.OnShow();
_MaxNumMics = CBase.Config.GetMaxNumMics();
if (_MaxNumMics > 6)
_MaxNumMics = 6;
_MaxNumRounds = _PartyMode.GetMaxNumRounds();
_RebuildSlides(); _RebuildSlides();
} }
@@ -125,9 +119,9 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley
{ {
// build num player slide (min player ... max player); // build num player slide (min player ... max player);
_SelectSlides[_SelectSlideNumPlayers].Clear(); _SelectSlides[_SelectSlideNumPlayers].Clear();
for (int i = _PartyMode.GetMinPlayer(); i <= _PartyMode.GetMaxPlayer(); i++) for (int i = _PartyMode.MinPlayers; i <= _PartyMode.MaxPlayers; i++)
_SelectSlides[_SelectSlideNumPlayers].AddValue(i.ToString()); _SelectSlides[_SelectSlideNumPlayers].AddValue(i.ToString());
_SelectSlides[_SelectSlideNumPlayers].Selection = _PartyMode.GameData.NumPlayer - _PartyMode.GetMinPlayer(); _SelectSlides[_SelectSlideNumPlayers].Selection = _PartyMode.GameData.NumPlayer - _PartyMode.MinPlayers;
_UpdateMicsAtOnce(); _UpdateMicsAtOnce();
_SetRoundSteps(); _SetRoundSteps();
@@ -138,8 +132,8 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley
{ {
int player = _PartyMode.GameData.NumPlayer; int player = _PartyMode.GameData.NumPlayer;
int mics = _PartyMode.GameData.NumPlayerAtOnce; int mics = _PartyMode.GameData.NumPlayerAtOnce;
_PartyMode.GameData.NumPlayer = _SelectSlides[_SelectSlideNumPlayers].Selection + _PartyMode.GetMinPlayer(); _PartyMode.GameData.NumPlayer = _SelectSlides[_SelectSlideNumPlayers].Selection + _PartyMode.MinPlayers;
_PartyMode.GameData.NumPlayerAtOnce = _SelectSlides[_SelectSlideNumMics].Selection + _PartyMode.GetMinPlayer(); _PartyMode.GameData.NumPlayerAtOnce = _SelectSlides[_SelectSlideNumMics].Selection + _PartyMode.MinPlayers;
_PartyMode.GameData.NumRounds = (_SelectSlides[_SelectSlideNumRounds].Selection + 1) * _RoundSteps; _PartyMode.GameData.NumRounds = (_SelectSlides[_SelectSlideNumRounds].Selection + 1) * _RoundSteps;
_UpdateMicsAtOnce(); _UpdateMicsAtOnce();
@@ -158,9 +152,7 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley
private void _UpdateMicsAtOnce() private void _UpdateMicsAtOnce()
{ {
int maxNum = _MaxNumMics; int maxNum = Math.Min(_PartyMode.MaxMics, _PartyMode.GameData.NumPlayer);
if (_PartyMode.GameData.NumPlayer < _MaxNumMics)
maxNum = _PartyMode.GameData.NumPlayer;
if (_PartyMode.GameData.NumPlayerAtOnce > maxNum) if (_PartyMode.GameData.NumPlayerAtOnce > maxNum)
_PartyMode.GameData.NumPlayerAtOnce = maxNum; _PartyMode.GameData.NumPlayerAtOnce = maxNum;
@@ -169,7 +161,7 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley
_SelectSlides[_SelectSlideNumMics].Clear(); _SelectSlides[_SelectSlideNumMics].Clear();
for (int i = 1; i <= maxNum; i++) for (int i = 1; i <= maxNum; i++)
_SelectSlides[_SelectSlideNumMics].AddValue(i.ToString()); _SelectSlides[_SelectSlideNumMics].AddValue(i.ToString());
_SelectSlides[_SelectSlideNumMics].Selection = _PartyMode.GameData.NumPlayerAtOnce - _PartyMode.GetMinPlayer(); _SelectSlides[_SelectSlideNumMics].Selection = _PartyMode.GameData.NumPlayerAtOnce - _PartyMode.MinPlayers;
} }
private void _UpdateSlideRounds() private void _UpdateSlideRounds()
@@ -119,7 +119,7 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley
_NextPlayerTexts = new List<CText>(); _NextPlayerTexts = new List<CText>();
_NextPlayerStatics = new List<CStatic>(); _NextPlayerStatics = new List<CStatic>();
for (int i = 0; i < _PartyMode.GetMaxPlayer(); i++) for (int i = 0; i < _PartyMode.MaxPlayers; i++)
{ {
_NextPlayerTexts.Add(GetNewText(_Texts[_TextNextPlayer])); _NextPlayerTexts.Add(GetNewText(_Texts[_TextNextPlayer]));
_AddText(_NextPlayerTexts[_NextPlayerTexts.Count - 1]); _AddText(_NextPlayerTexts[_NextPlayerTexts.Count - 1]);
@@ -326,7 +326,7 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley
x += _Statics[_StaticNextPlayer].Rect.W + 15; x += _Statics[_StaticNextPlayer].Rect.W + 15;
} }
for (int i = _PartyMode.GameData.NumPlayerAtOnce; i < _PartyMode.GetMaxPlayer(); i++) for (int i = _PartyMode.GameData.NumPlayerAtOnce; i < _PartyMode.MaxPlayers; i++)
{ {
_NextPlayerStatics[i].Visible = false; _NextPlayerStatics[i].Visible = false;
_NextPlayerTexts[i].Visible = false; _NextPlayerTexts[i].Visible = false;
@@ -340,7 +340,7 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley
_Texts[_TextNextPlayerMessage].Visible = true; _Texts[_TextNextPlayerMessage].Visible = true;
for (int i = 0; i < _PartyMode.GameData.NumPlayerAtOnce; i++) for (int i = 0; i < _PartyMode.GameData.NumPlayerAtOnce; i++)
{ {
int id = _PartyMode.GameData.ProfileIDs[_PartyMode.GameData.Rounds[_PartyMode.GameData.CurrentRoundNr - 1].Player[i]]; int id = _PartyMode.GameData.ProfileIDs[_PartyMode.GameData.Rounds[_PartyMode.GameData.CurrentRoundNr - 1].Players[i]];
_NextPlayerStatics[i].Texture = CBase.Profiles.GetAvatar(id); _NextPlayerStatics[i].Texture = CBase.Profiles.GetAvatar(id);
_NextPlayerTexts[i].Text = CBase.Profiles.GetPlayerName(id); _NextPlayerTexts[i].Text = CBase.Profiles.GetPlayerName(id);
_NextPlayerTexts[i].Color = CBase.Themes.GetPlayerColor(i + 1); _NextPlayerTexts[i].Color = CBase.Themes.GetPlayerColor(i + 1);
@@ -452,14 +452,14 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley
{ {
for (int p = 0; p < _RoundsTable[i].TextPlayer.Count; p++) for (int p = 0; p < _RoundsTable[i].TextPlayer.Count; p++)
{ {
if (_PartyMode.GameData.Rounds.Count > i + _RoundsTableOffset && _PartyMode.GameData.Rounds[i + _RoundsTableOffset].Player.Count > p) if (_PartyMode.GameData.Rounds.Count > i + _RoundsTableOffset && _PartyMode.GameData.Rounds[i + _RoundsTableOffset].Players.Count > p)
{ {
_RoundsTable[i].Number.Visible = true; _RoundsTable[i].Number.Visible = true;
_RoundsTable[i].TextPlayer[p].Visible = true; _RoundsTable[i].TextPlayer[p].Visible = true;
_RoundsTable[i].TextScores[p].Visible = true; _RoundsTable[i].TextScores[p].Visible = true;
_RoundsTable[i].Number.Text = (i + 1 + _RoundsTableOffset) + ")"; _RoundsTable[i].Number.Text = (i + 1 + _RoundsTableOffset) + ")";
_RoundsTable[i].TextPlayer[p].Text = _RoundsTable[i].TextPlayer[p].Text =
CBase.Profiles.GetPlayerName(_PartyMode.GameData.ProfileIDs[_PartyMode.GameData.Rounds[i + _RoundsTableOffset].Player[p]]); CBase.Profiles.GetPlayerName(_PartyMode.GameData.ProfileIDs[_PartyMode.GameData.Rounds[i + _RoundsTableOffset].Players[p]]);
// ReSharper disable ConvertIfStatementToConditionalTernaryExpression // ReSharper disable ConvertIfStatementToConditionalTernaryExpression
if ((_PartyMode.GameData.CurrentRoundNr - 1) > i + _RoundsTableOffset) if ((_PartyMode.GameData.CurrentRoundNr - 1) > i + _RoundsTableOffset)
// ReSharper restore ConvertIfStatementToConditionalTernaryExpression // ReSharper restore ConvertIfStatementToConditionalTernaryExpression
@@ -36,15 +36,6 @@ namespace VocaluxeLib.PartyModes.TicTacToe
// ReSharper restore InconsistentNaming // ReSharper restore InconsistentNaming
} }
public enum EPartyGameMode
{
// ReSharper disable InconsistentNaming
TR_GAMEMODE_NORMAL,
TR_GAMEMODE_SHORTSONG,
TR_GAMEMODE_DUET
// ReSharper restore InconsistentNaming
}
public class CRound public class CRound
{ {
public int SongID; public int SongID;
@@ -71,13 +62,39 @@ namespace VocaluxeLib.PartyModes.TicTacToe
public sealed class CPartyModeTicTacToe : CPartyMode public sealed class CPartyModeTicTacToe : CPartyMode
// ReSharper restore ClassNeverInstantiated.Global // ReSharper restore ClassNeverInstantiated.Global
{ {
private const int _MaxPlayer = 20; public override int MinMics
private const int _MinPlayer = 2; {
private const int _MaxTeams = 2; get { return 2; }
private const int _MinTeams = 2; }
private const int _MinPlayerPerTeam = 1; public override int MaxMics
private const int _MaxPlayerPerTeam = 10; {
private const int _NumFields = 9; get { return 2; }
}
public override int MinPlayers
{
get { return 2; }
}
public override int MaxPlayers
{
get { return 20; }
}
public override int MinTeams
{
get { return 2; }
}
public override int MaxTeams
{
get { return 2; }
}
public override int MinPlayersPerTeam
{
get { return 1; }
}
public override int MaxPlayersPerTeam
{
get { return 10; }
}
private enum EStage private enum EStage
{ {
@@ -99,10 +116,10 @@ namespace VocaluxeLib.PartyModes.TicTacToe
public List<int> PlayerTeam2; public List<int> PlayerTeam2;
public ESongSource SongSource; public ESongSource SongSource;
public int CategoryID; public int CategoryIndex;
public int PlaylistID; public int PlaylistID;
public EPartyGameMode GameMode; public EGameMode GameMode;
public List<CRound> Rounds; public List<CRound> Rounds;
public List<int> Songs; public List<int> Songs;
@@ -117,7 +134,7 @@ namespace VocaluxeLib.PartyModes.TicTacToe
public SData GameData; public SData GameData;
private EStage _Stage; private EStage _Stage;
public CPartyModeTicTacToe(int id, string folder) : base(id, folder) public CPartyModeTicTacToe(int id) : base(id)
{ {
_ScreenSongOptions.Selection.RandomOnly = false; _ScreenSongOptions.Selection.RandomOnly = false;
_ScreenSongOptions.Selection.PartyMode = true; _ScreenSongOptions.Selection.PartyMode = true;
@@ -142,8 +159,8 @@ namespace VocaluxeLib.PartyModes.TicTacToe
FieldNr = 0, FieldNr = 0,
SongSource = ESongSource.TR_ALLSONGS, SongSource = ESongSource.TR_ALLSONGS,
PlaylistID = 0, PlaylistID = 0,
CategoryID = 0, CategoryIndex = 0,
GameMode = EPartyGameMode.TR_GAMEMODE_NORMAL, GameMode = EGameMode.TR_GAMEMODE_NORMAL,
Rounds = new List<CRound>(), Rounds = new List<CRound>(),
Songs = new List<int>(), Songs = new List<int>(),
NumJokerRandom = new int[2], NumJokerRandom = new int[2],
@@ -153,6 +170,8 @@ namespace VocaluxeLib.PartyModes.TicTacToe
public override bool Init() public override bool Init()
{ {
if (!base.Init())
return false;
_Stage = EStage.Config; _Stage = EStage.Config;
_ScreenSongOptions.Sorting.IgnoreArticles = CBase.Config.GetIgnoreArticles(); _ScreenSongOptions.Sorting.IgnoreArticles = CBase.Config.GetIgnoreArticles();
@@ -277,41 +296,6 @@ namespace VocaluxeLib.PartyModes.TicTacToe
throw new ArgumentException("Not required!"); throw new ArgumentException("Not required!");
} }
public override int GetMaxPlayer()
{
return _MaxPlayer;
}
public override int GetMinPlayer()
{
return _MinPlayer;
}
public override int GetMaxTeams()
{
return _MaxTeams;
}
public override int GetMinTeams()
{
return _MinTeams;
}
public override int GetMinPlayerPerTeam()
{
return _MinPlayerPerTeam;
}
public override int GetMaxPlayerPerTeam()
{
return _MaxPlayerPerTeam;
}
public override int GetMaxNumRounds()
{
return _NumFields;
}
public override void JokerUsed(int teamNr) {} public override void JokerUsed(int teamNr) {}
public override void SongSelected(int songID) public override void SongSelected(int songID)
@@ -431,67 +415,36 @@ namespace VocaluxeLib.PartyModes.TicTacToe
} }
} }
private static void _Shuffle<T>(IList<T> list)
{
for (int n = list.Count - 1; n >= 1; n--)
{
int k = CBase.Game.GetRandom(n);
T value = list[k];
list[k] = list[n];
list[n] = value;
}
}
public void UpdateSongList() public void UpdateSongList()
{ {
if (GameData.Songs.Count > 0) if (GameData.Songs.Count > 0)
return; return;
EGameMode gm;
switch (GameData.GameMode)
{
case EPartyGameMode.TR_GAMEMODE_NORMAL:
gm = EGameMode.TR_GAMEMODE_NORMAL;
break;
case EPartyGameMode.TR_GAMEMODE_DUET:
gm = EGameMode.TR_GAMEMODE_DUET;
break;
case EPartyGameMode.TR_GAMEMODE_SHORTSONG:
gm = EGameMode.TR_GAMEMODE_SHORTSONG;
break;
default:
gm = EGameMode.TR_GAMEMODE_NORMAL;
break;
}
switch (GameData.SongSource) switch (GameData.SongSource)
{ {
case ESongSource.TR_PLAYLIST: case ESongSource.TR_PLAYLIST:
for (int i = 0; i < CBase.Playlist.GetSongCount(GameData.PlaylistID); i++) for (int i = 0; i < CBase.Playlist.GetSongCount(GameData.PlaylistID); i++)
{ {
int id = CBase.Playlist.GetSong(GameData.PlaylistID, i).SongID; int id = CBase.Playlist.GetSong(GameData.PlaylistID, i).SongID;
if (CBase.Songs.GetSongByID(id).AvailableGameModes.Contains(gm)) if (CBase.Songs.GetSongByID(id).AvailableGameModes.Contains(GameData.GameMode))
GameData.Songs.Add(id); GameData.Songs.Add(id);
} }
break; break;
case ESongSource.TR_ALLSONGS: case ESongSource.TR_ALLSONGS:
ReadOnlyCollection<CSong> avSongs = CBase.Songs.GetSongs(); ReadOnlyCollection<CSong> avSongs = CBase.Songs.GetSongs();
GameData.Songs.AddRange(avSongs.Where(song => song.AvailableGameModes.Contains(gm)).Select(song => song.ID)); GameData.Songs.AddRange(avSongs.Where(song => song.AvailableGameModes.Contains(GameData.GameMode)).Select(song => song.ID));
break; break;
case ESongSource.TR_CATEGORY: case ESongSource.TR_CATEGORY:
CBase.Songs.SetCategory(GameData.CategoryID); CBase.Songs.SetCategory(GameData.CategoryIndex);
avSongs = CBase.Songs.GetVisibleSongs(); avSongs = CBase.Songs.GetVisibleSongs();
GameData.Songs.AddRange(avSongs.Where(song => song.AvailableGameModes.Contains(gm)).Select(song => song.ID)); GameData.Songs.AddRange(avSongs.Where(song => song.AvailableGameModes.Contains(GameData.GameMode)).Select(song => song.ID));
CBase.Songs.SetCategory(-1); CBase.Songs.SetCategory(-1);
break; break;
} }
_Shuffle(GameData.Songs); GameData.Songs.Shuffle();
} }
private void _UpdatePlayerList() private void _UpdatePlayerList()
@@ -534,23 +487,7 @@ namespace VocaluxeLib.PartyModes.TicTacToe
if (isDuet) if (isDuet)
players[1].VoiceNr = 1; players[1].VoiceNr = 1;
var gm = EGameMode.TR_GAMEMODE_NORMAL; CBase.Game.AddSong(round.SongID, GameData.GameMode);
switch (GameData.GameMode)
{
case EPartyGameMode.TR_GAMEMODE_NORMAL:
gm = EGameMode.TR_GAMEMODE_NORMAL;
break;
case EPartyGameMode.TR_GAMEMODE_DUET:
gm = EGameMode.TR_GAMEMODE_DUET;
break;
case EPartyGameMode.TR_GAMEMODE_SHORTSONG:
gm = EGameMode.TR_GAMEMODE_SHORTSONG;
break;
}
CBase.Game.AddSong(round.SongID, gm);
} }
private void _SetNumJokers() private void _SetNumJokers()
@@ -16,6 +16,7 @@
#endregion #endregion
using System.Collections.Generic; using System.Collections.Generic;
using System.Diagnostics;
using System.Linq; using System.Linq;
using System.Windows.Forms; using System.Windows.Forms;
using VocaluxeLib.Songs; using VocaluxeLib.Songs;
@@ -113,8 +114,7 @@ namespace VocaluxeLib.PartyModes.TicTacToe
{ {
base.OnShow(); base.OnShow();
if (CBase.Config.GetMaxNumMics() >= 2) Debug.Assert(CBase.Config.GetMaxNumMics() >= 2);
_ConfigOk = true;
_FillSlides(); _FillSlides();
_UpdateSlides(); _UpdateSlides();
@@ -129,15 +129,11 @@ namespace VocaluxeLib.PartyModes.TicTacToe
private void _FillSlides() private void _FillSlides()
{ {
_SelectSlides[_SelectSlideNumFields].Clear(); _SelectSlides[_SelectSlideNumFields].Clear();
_SelectSlides[_SelectSlideNumFields].AddValue("9"); _SelectSlides[_SelectSlideNumFields].AddValue(9);
_SelectSlides[_SelectSlideNumFields].AddValue("16"); _SelectSlides[_SelectSlideNumFields].AddValue(16);
_SelectSlides[_SelectSlideNumFields].AddValue("25"); _SelectSlides[_SelectSlideNumFields].AddValue(25);
if (_PartyMode.GameData.NumFields == 9)
_SelectSlides[_SelectSlideNumFields].Selection = 0; _SelectSlides[_SelectSlideNumFields].SelectedTag = _PartyMode.GameData.NumFields;
else if (_PartyMode.GameData.NumFields == 16)
_SelectSlides[_SelectSlideNumFields].Selection = 1;
else if (_PartyMode.GameData.NumFields == 25)
_SelectSlides[_SelectSlideNumFields].Selection = 2;
_SelectSlides[_SelectSlideSongSource].Clear(); _SelectSlides[_SelectSlideSongSource].Clear();
_SelectSlides[_SelectSlideSongSource].SetValues<ESongSource>((int)_PartyMode.GameData.SongSource); _SelectSlides[_SelectSlideSongSource].SetValues<ESongSource>((int)_PartyMode.GameData.SongSource);
@@ -152,52 +148,32 @@ namespace VocaluxeLib.PartyModes.TicTacToe
_SelectSlides[_SelectSlidePlaylist].Selection = _PartyMode.GameData.PlaylistID; _SelectSlides[_SelectSlidePlaylist].Selection = _PartyMode.GameData.PlaylistID;
_SelectSlides[_SelectSlidePlaylist].Visible = _PartyMode.GameData.SongSource == ESongSource.TR_PLAYLIST; _SelectSlides[_SelectSlidePlaylist].Visible = _PartyMode.GameData.SongSource == ESongSource.TR_PLAYLIST;
var categories = new string[CBase.Songs.GetNumCategories()];
for (int i = 0; i < CBase.Songs.GetNumCategories(); i++)
categories[i] = CBase.Songs.GetCategory(i).Name;
_SelectSlides[_SelectSlideCategory].Clear(); _SelectSlides[_SelectSlideCategory].Clear();
for (int i = 0; i < categories.Length; i++) for (int i = 0; i < CBase.Songs.GetNumCategories(); i++)
{ {
string value = categories[i] + " (" + CBase.Songs.GetNumSongsNotSungInCategory(i) + " " + CBase.Language.Translate("TR_SONGS", PartyModeID) + ")"; CCategory cat = CBase.Songs.GetCategory(i);
string value = cat.Name + " (" + cat.GetNumSongsNotSung() + " " + CBase.Language.Translate("TR_SONGS", PartyModeID) + ")";
_SelectSlides[_SelectSlideCategory].AddValue(value); _SelectSlides[_SelectSlideCategory].AddValue(value);
} }
_SelectSlides[_SelectSlideCategory].Selection = _PartyMode.GameData.CategoryID; _SelectSlides[_SelectSlideCategory].Selection = _PartyMode.GameData.CategoryIndex;
_SelectSlides[_SelectSlideCategory].Visible = _PartyMode.GameData.SongSource == ESongSource.TR_CATEGORY; _SelectSlides[_SelectSlideCategory].Visible = _PartyMode.GameData.SongSource == ESongSource.TR_CATEGORY;
_SelectSlides[_SelectSlideGameMode].Visible = true; _SelectSlides[_SelectSlideGameMode].Visible = true;
_SelectSlides[_SelectSlideGameMode].SetValues<EPartyGameMode>((int)_PartyMode.GameData.GameMode); _SelectSlides[_SelectSlideGameMode].Clear();
_SelectSlides[_SelectSlideGameMode].SetValues<EGameMode>((int)_PartyMode.GameData.GameMode);
_SelectSlides[_SelectSlideGameMode].RemoveValue(EGameMode.TR_GAMEMODE_MEDLEY.ToString());
} }
private void _UpdateSlides() private void _UpdateSlides()
{ {
if (_SelectSlides[_SelectSlideNumFields].Selection == 0) _PartyMode.GameData.NumFields = _SelectSlides[_SelectSlideNumFields].SelectedTag;
_PartyMode.GameData.NumFields = 9;
else if (_SelectSlides[_SelectSlideNumFields].Selection == 1)
_PartyMode.GameData.NumFields = 16;
else if (_SelectSlides[_SelectSlideNumFields].Selection == 2)
_PartyMode.GameData.NumFields = 25;
_PartyMode.GameData.SongSource = (ESongSource)_SelectSlides[_SelectSlideSongSource].Selection; _PartyMode.GameData.SongSource = (ESongSource)_SelectSlides[_SelectSlideSongSource].Selection;
_PartyMode.GameData.PlaylistID = _SelectSlides[_SelectSlidePlaylist].Selection; _PartyMode.GameData.PlaylistID = _SelectSlides[_SelectSlidePlaylist].Selection;
_PartyMode.GameData.CategoryID = _SelectSlides[_SelectSlideCategory].Selection; _PartyMode.GameData.CategoryIndex = _SelectSlides[_SelectSlideCategory].Selection;
_PartyMode.GameData.GameMode = (EPartyGameMode)_SelectSlides[_SelectSlideGameMode].Selection; _PartyMode.GameData.GameMode = (EGameMode)_SelectSlides[_SelectSlideGameMode].Selection;
var gm = EGameMode.TR_GAMEMODE_NORMAL; EGameMode gm = _PartyMode.GameData.GameMode;
switch (_PartyMode.GameData.GameMode)
{
case EPartyGameMode.TR_GAMEMODE_NORMAL:
gm = EGameMode.TR_GAMEMODE_NORMAL;
break;
case EPartyGameMode.TR_GAMEMODE_DUET:
gm = EGameMode.TR_GAMEMODE_DUET;
break;
case EPartyGameMode.TR_GAMEMODE_SHORTSONG:
gm = EGameMode.TR_GAMEMODE_SHORTSONG;
break;
}
if (_PartyMode.GameData.SongSource == ESongSource.TR_PLAYLIST) if (_PartyMode.GameData.SongSource == ESongSource.TR_PLAYLIST)
{ {
@@ -224,11 +200,11 @@ namespace VocaluxeLib.PartyModes.TicTacToe
{ {
if (CBase.Songs.GetNumCategories() == 0) if (CBase.Songs.GetNumCategories() == 0)
_ConfigOk = false; _ConfigOk = false;
else if (CBase.Songs.GetNumSongsNotSungInCategory(_PartyMode.GameData.CategoryID) <= 0) else if (CBase.Songs.GetNumSongsNotSungInCategory(_PartyMode.GameData.CategoryIndex) <= 0)
_ConfigOk = false; _ConfigOk = false;
else else
{ {
CBase.Songs.SetCategory(_PartyMode.GameData.CategoryID); CBase.Songs.SetCategory(_PartyMode.GameData.CategoryIndex);
_ConfigOk = false; _ConfigOk = false;
foreach (CSong song in CBase.Songs.GetVisibleSongs()) foreach (CSong song in CBase.Songs.GetVisibleSongs())
{ {
@@ -73,7 +73,6 @@ namespace VocaluxeLib.PartyModes.TicTacToe
private const int _FieldSpace = 10; private const int _FieldSpace = 10;
private float _FieldSize = 100; private float _FieldSize = 100;
private int _PreviewStream = -1;
private int _OldSelectedField = -1; private int _OldSelectedField = -1;
private int[,] _Possibilities; private int[,] _Possibilities;
@@ -267,8 +266,6 @@ namespace VocaluxeLib.PartyModes.TicTacToe
{ {
base.OnShow(); base.OnShow();
_PreviewStream = -1;
if (_PartyMode.GameData.CurrentRoundNr == 1) if (_PartyMode.GameData.CurrentRoundNr == 1)
{ {
_BuildWinnerPossibilities(); _BuildWinnerPossibilities();
@@ -334,13 +331,6 @@ namespace VocaluxeLib.PartyModes.TicTacToe
return true; return true;
} }
public override void OnClose()
{
base.OnClose();
CBase.BackgroundMusic.SetDisabled(false);
CBase.Sound.Fade(_PreviewStream, 0, 0.5f, EStreamAction.Close);
}
private void _CreateFields() private void _CreateFields()
{ {
for (int i = 0; i < 25; i++) for (int i = 0; i < 25; i++)
@@ -490,14 +480,7 @@ namespace VocaluxeLib.PartyModes.TicTacToe
private void _StartPreview(int songID) private void _StartPreview(int songID)
{ {
CSong song = CBase.Songs.GetSongByID(songID); CSong song = CBase.Songs.GetSongByID(songID);
CBase.BackgroundMusic.SetDisabled(true); CBase.BackgroundMusic.LoadPreview(song);
_PreviewStream = CBase.Sound.Load(song.GetMP3());
CBase.Sound.SetGlobalVolume(CBase.Config.GetMusicVolume(EMusicType.Preview));
CBase.Sound.SetPosition(_PreviewStream, song.Preview.StartTime);
CBase.Sound.SetStreamVolume(_PreviewStream, 0);
CBase.Sound.Play(_PreviewStream);
CBase.Sound.Fade(_PreviewStream, 100, 1f);
} }
private void _UpdatePlayerInformation() private void _UpdatePlayerInformation()
@@ -525,8 +508,6 @@ namespace VocaluxeLib.PartyModes.TicTacToe
if (_PartyMode.GameData.NumJokerRandom[teamNr] > 0) if (_PartyMode.GameData.NumJokerRandom[teamNr] > 0)
{ {
_PartyMode.GameData.NumJokerRandom[teamNr]--; _PartyMode.GameData.NumJokerRandom[teamNr]--;
if (!CBase.Sound.IsFinished(_PreviewStream))
CBase.Sound.Fade(_PreviewStream, 0, 1, EStreamAction.Close);
_FieldSelected(true); _FieldSelected(true);
} }
break; break;
@@ -537,8 +518,6 @@ namespace VocaluxeLib.PartyModes.TicTacToe
{ {
_PartyMode.GameData.NumJokerRetry[teamNr]--; _PartyMode.GameData.NumJokerRetry[teamNr]--;
_PartyMode.GameData.Team = teamNr; _PartyMode.GameData.Team = teamNr;
if (!CBase.Sound.IsFinished(_PreviewStream))
CBase.Sound.Fade(_PreviewStream, 0, 1, EStreamAction.Close);
_Status = EStatus.JokerRetry; _Status = EStatus.JokerRetry;
_OldSelectedField = _PartyMode.GameData.FieldNr; _OldSelectedField = _PartyMode.GameData.FieldNr;
_PartyMode.GameData.FieldNr = -1; _PartyMode.GameData.FieldNr = -1;
@@ -579,13 +558,11 @@ namespace VocaluxeLib.PartyModes.TicTacToe
private void _NextRound() private void _NextRound()
{ {
CBase.Sound.Fade(_PreviewStream, 0, 0.5f, EStreamAction.Close);
_PartyMode.Next(); _PartyMode.Next();
} }
private void _EndParty() private void _EndParty()
{ {
CBase.Sound.Fade(_PreviewStream, 0, 0.5f, EStreamAction.Close);
CBase.Graphics.FadeTo(EScreen.Party); CBase.Graphics.FadeTo(EScreen.Party);
} }
@@ -604,7 +581,6 @@ namespace VocaluxeLib.PartyModes.TicTacToe
private void _Back() private void _Back()
{ {
CBase.Sound.Fade(_PreviewStream, 0, 0.5f, EStreamAction.Close);
_PartyMode.Back(); _PartyMode.Back();
} }
+82 -133
View File
@@ -18,7 +18,6 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Diagnostics; using System.Diagnostics;
using System.IO;
using VocaluxeLib; using VocaluxeLib;
using VocaluxeLib.Songs; using VocaluxeLib.Songs;
using VocaluxeLib.Draw; using VocaluxeLib.Draw;
@@ -30,12 +29,12 @@ namespace Vocaluxe.Base
{ {
private static bool _Initialized; private static bool _Initialized;
private static CSongPlayer _SongPlayer; private static readonly CSongPlayer _BGPlayer = new CSongPlayer();
private static CSongPlayer _PreviewPlayer; private static readonly CSongPlayer _PreviewPlayer = new CSongPlayer(true);
private static CSongPlayer _CurPlayer;
private static bool _OwnSongsAvailable; private static bool _OwnSongsAvailable;
private static EBackgroundMusicSource _MusicSource; private static EBackgroundMusicSource _MusicSource;
private static bool _VideoEnabled;
private static CPlaylistElement _CurrentPlaylistElement; //Currently played music private static CPlaylistElement _CurrentPlaylistElement; //Currently played music
private static int _PreviousMusicIndex = -1; private static int _PreviousMusicIndex = -1;
@@ -47,29 +46,20 @@ namespace Vocaluxe.Base
private static bool _OwnMusicAdded; private static bool _OwnMusicAdded;
private static bool _BackgroundMusicAdded; private static bool _BackgroundMusicAdded;
private static bool _Disabled; private static bool _Disabled;
private static bool _PlaysPreview;
public static bool VideoEnabled public static bool VideoEnabled
{ {
get { return _PlaysPreview ? _PreviewPlayer.VideoEnabled : _SongPlayer.VideoEnabled; } get { return _CurPlayer.VideoEnabled; }
set set { _CurPlayer.VideoEnabled = value; }
{
if (_PlaysPreview)
_PreviewPlayer.VideoEnabled = value;
else
_SongPlayer.VideoEnabled = value;
}
} }
public static bool CanSing public static bool CanSing
{ {
get get
{ {
if (_PlaysPreview) if (IsPlayingPreview)
return false; return false;
if (_BGMusicFiles.Contains(_CurrentPlaylistElement)) return !_BGMusicFiles.Contains(_CurrentPlaylistElement);
return false;
return true;
} }
} }
@@ -81,54 +71,63 @@ namespace Vocaluxe.Base
if (Disabled == value) if (Disabled == value)
return; return;
_Disabled = value; _Disabled = value;
if (_Disabled)
Pause(); Pause();
else
Play();
} }
} }
/// <summary>
/// Repeat the background song (preview songs are always repeating!)
/// </summary>
public static bool RepeatSong public static bool RepeatSong
{ {
get { return _SongPlayer.RepeatSong; } get { return _BGPlayer.Loop; }
set { _SongPlayer.RepeatSong = value; } set { _BGPlayer.Loop = value; }
} }
public static int SongID public static int SongID
{ {
get { return _SongPlayer.SongID; } get { return _CurPlayer.SongID; }
} }
public static bool SongHasVideo public static bool SongHasVideo
{ {
get { return _SongPlayer.SongHasVideo; } get { return _CurPlayer.SongHasVideo; }
} }
public static bool IsPlaying public static bool IsPlaying
{ {
get { return _PlaysPreview ? _PreviewPlayer.IsPlaying : _SongPlayer.IsPlaying; } get { return _CurPlayer.IsPlaying; }
} }
public static bool IsPlayingPreview public static bool IsPlayingPreview
{ {
get { return _PlaysPreview; } get { return _CurPlayer == _PreviewPlayer; }
set
{
if (IsPlayingPreview == value)
return;
Pause();
_CurPlayer = value ? _PreviewPlayer : _BGPlayer;
Play();
}
} }
public static string ArtistAndTitle public static string ArtistAndTitle
{ {
get get { return _CurPlayer.ArtistAndTitle; }
{
if (_PlaysPreview)
return _PreviewPlayer.ArtistAndTitle;
return _BGMusicFiles.Contains(_CurrentPlaylistElement) ? Path.GetFileNameWithoutExtension(_CurrentPlaylistElement.MusicFilePath) : _SongPlayer.ArtistAndTitle;
}
} }
public static float Length public static float Length
{ {
get { return _PlaysPreview ? _PreviewPlayer.Length : _SongPlayer.Length; } get { return _CurPlayer.Length; }
} }
public static CTextureRef Cover public static CTextureRef Cover
{ {
get { return _PlaysPreview ? _PreviewPlayer.Cover : _SongPlayer.Cover; } get { return _CurPlayer.Cover; }
} }
//Use this to set whether own songs are available for access //Use this to set whether own songs are available for access
@@ -160,21 +159,15 @@ namespace Vocaluxe.Base
_MusicSource = EBackgroundMusicSource.TR_CONFIG_NO_OWN_MUSIC; _MusicSource = EBackgroundMusicSource.TR_CONFIG_NO_OWN_MUSIC;
_AddBackgroundMusic(); _AddBackgroundMusic();
_SongPlayer = new CSongPlayer();
_PreviewPlayer = new CSongPlayer {RepeatSong = true};
_VideoEnabled = (CConfig.Config.Video.VideoBackgrounds == EOffOn.TR_CONFIG_ON && CConfig.Config.Video.VideosToBackground == EOffOn.TR_CONFIG_ON);
SetMusicSource(CConfig.Config.Sound.BackgroundMusicSource); SetMusicSource(CConfig.Config.Sound.BackgroundMusicSource);
_CurPlayer = _BGPlayer;
_Initialized = true; _Initialized = true;
} }
public static void Close() public static void Close()
{ {
if (_SongPlayer != null) _BGPlayer.Close();
_SongPlayer.Stop(); _PreviewPlayer.Close();
if (_PreviewPlayer != null)
_PreviewPlayer.Stop();
_BGMusicFiles.Clear(); _BGMusicFiles.Clear();
_NotPlayedFiles.Clear(); _NotPlayedFiles.Clear();
@@ -185,61 +178,32 @@ namespace Vocaluxe.Base
public static void Play() public static void Play()
{ {
if (IsPlaying || (CConfig.Config.Sound.BackgroundMusic != EBackgroundMusicOffOn.TR_CONFIG_ON && !_PlaysPreview)) if (!IsPlayingPreview && CConfig.Config.Sound.BackgroundMusic == EBackgroundMusicOffOn.TR_CONFIG_OFF)
return; return;
if (_PlaysPreview) if (IsPlayingPreview || _BGPlayer.SoundLoaded)
_PreviewPlayer.Play(); _CurPlayer.Play();
else if (CConfig.Config.Sound.BackgroundMusic == EBackgroundMusicOffOn.TR_CONFIG_ON)
{
if (_SongPlayer.SongLoaded)
//Resume
_SongPlayer.TogglePause();
else else
Next(); Next();
} }
}
public static void Stop() public static void Stop()
{ {
if (!IsPlaying) _CurPlayer.Stop();
return; if (!IsPlayingPreview)
if (_PlaysPreview)
{
_PreviewPlayer.Stop();
_PlaysPreview = false;
Pause();
CSound.SetGlobalVolume(CConfig.BackgroundMusicVolume);
}
else
{
_SongPlayer.Stop();
_CurrentPlaylistElement = null; _CurrentPlaylistElement = null;
} }
}
public static void Pause() public static void Pause()
{ {
if (_PlaysPreview) _CurPlayer.Pause();
{
if (!_PreviewPlayer.SongLoaded)
return;
_PreviewPlayer.TogglePause();
}
else if (CConfig.Config.Sound.BackgroundMusic == EBackgroundMusicOffOn.TR_CONFIG_ON)
{
if (!_SongPlayer.SongLoaded)
Next();
else
_SongPlayer.TogglePause();
}
} }
public static void Next() public static void Next()
{ {
if (!_PlaysPreview) if (IsPlayingPreview)
{ return;
Stop(); //stop last song if any Stop(); //stop last song if any
if (_PreviousMusicIndex < _PreviousFiles.Count - 2) if (_PreviousMusicIndex < _PreviousFiles.Count - 2)
{ {
@@ -265,16 +229,15 @@ namespace Vocaluxe.Base
} }
_StartSong(); _StartSong();
} }
}
public static void Previous() public static void Previous()
{ {
if (!_PlaysPreview) if (IsPlayingPreview)
{ return;
if (_PreviousMusicIndex < 0) if (_PreviousMusicIndex < 0)
return; return;
Debug.Assert(_CurrentPlaylistElement != null);
if (_SongPlayer.Position <= 1.5f && _PreviousMusicIndex > 0) if (_CurrentPlaylistElement == null || (_BGPlayer.Position <= 1.5f && _PreviousMusicIndex > 0))
{ {
Stop(); //stop last song Stop(); //stop last song
_PreviousMusicIndex--; _PreviousMusicIndex--;
@@ -283,26 +246,20 @@ namespace Vocaluxe.Base
} }
_StartSong(); _StartSong();
} }
}
public static void Update() public static void Update()
{ {
if (!IsPlaying && (!_SongPlayer.SongLoaded || !_PreviewPlayer.SongLoaded)) if (!IsPlaying)
return; return;
if (_PlaysPreview) _CurPlayer.Update();
_PreviewPlayer.Update(); if (!IsPlayingPreview && _BGPlayer.IsFinished)
else
{
_SongPlayer.Update();
if (_SongPlayer.IsFinished)
Next(); Next();
} }
}
public static CTextureRef GetVideoTexture() public static CTextureRef GetVideoTexture()
{ {
return _PlaysPreview ? _PreviewPlayer.GetVideoTexture() : _SongPlayer.GetVideoTexture(); return _CurPlayer.GetVideoTexture();
} }
public static void SetMusicSource(EBackgroundMusicSource source) public static void SetMusicSource(EBackgroundMusicSource source)
@@ -328,45 +285,31 @@ namespace Vocaluxe.Base
} }
} }
public static void LoadPreview(CSong song, float start = 0f) public static void LoadPreview(CSong song, float start = -1f)
{ {
if (!_PlaysPreview)
Pause();
else
StopPreview();
if (song == null) if (song == null)
return; throw new ArgumentNullException("song");
// ReSharper disable CompareOfFloatsByEqualityOperator if (!IsPlayingPreview)
if (start == 0f) {
start = song.Preview.StartTime; Pause();
// ReSharper restore CompareOfFloatsByEqualityOperator _CurPlayer = _PreviewPlayer;
_PlaysPreview = true;
CSound.SetGlobalVolume(CConfig.PreviewMusicVolume); CSound.SetGlobalVolume(CConfig.PreviewMusicVolume);
_PreviewPlayer.Load(song, start);
float startposition = song.Preview.StartTime;
float length = _PreviewPlayer.Length;
if (song.Preview.Source == EDataSource.None)
startposition = length / 4f;
else if (startposition > length - 5f)
startposition = Math.Max(0f, Math.Min(length / 4f, length - 5f));
if (startposition >= 0.5f)
startposition -= 0.5f;
_PreviewPlayer.Position = startposition;
Play();
} }
public static void PlayPreview(float start = -1f) _PreviewPlayer.Load(song);
{
if (start > -1f) float length = _PreviewPlayer.Length;
if (length < 1)
length = 30; // If length is unknow or invalid assume a length of 30s
if (start < 0)
start = (song.Preview.Source == EDataSource.None) ? length / 4f : song.Preview.StartTime;
if (start > length - 5f)
start = Math.Max(0f, Math.Min(length / 4f, length - 5f));
if (start >= 0.5f)
start -= 0.5f;
_PreviewPlayer.Position = start; _PreviewPlayer.Position = start;
Play(); Play();
@@ -374,8 +317,10 @@ namespace Vocaluxe.Base
public static void StopPreview() public static void StopPreview()
{ {
_PreviewPlayer.Stop(); if (!IsPlayingPreview)
_PlaysPreview = false; return;
Stop();
_CurPlayer = _BGPlayer;
CSound.SetGlobalVolume(CConfig.BackgroundMusicVolume); CSound.SetGlobalVolume(CConfig.BackgroundMusicVolume);
} }
@@ -387,19 +332,23 @@ namespace Vocaluxe.Base
Debug.Assert(_CurrentPlaylistElement != null); Debug.Assert(_CurrentPlaylistElement != null);
//If current song same as loaded restart only //If current song same as loaded restart only
if (_CurrentPlaylistElement.SongID == _SongPlayer.SongID && _SongPlayer.SongLoaded) if (_BGPlayer.SoundLoaded && _CurrentPlaylistElement.MusicFilePath == _BGPlayer.FilePath)
_SongPlayer.Play(); {
_BGPlayer.Stop();
_BGPlayer.Play();
return;
}
//otherwhise load //otherwhise load
if (_BGMusicFiles.Contains(_CurrentPlaylistElement)) if (!_CurrentPlaylistElement.HasMetaData)
_SongPlayer.LoadFile(_CurrentPlaylistElement.MusicFilePath, 0f, true); _BGPlayer.Load(_CurrentPlaylistElement.MusicFilePath, 0f, true);
else else
{ {
//Seek to #Start-Tag, if found //Seek to #Start-Tag, if found
float start = 0f; float start = 0f;
if (_CurrentPlaylistElement.Start > 0.001 && CConfig.Config.Sound.BackgroundMusicUseStart == EOffOn.TR_CONFIG_ON) if (_CurrentPlaylistElement.Start > 0.001 && CConfig.Config.Sound.BackgroundMusicUseStart == EOffOn.TR_CONFIG_ON)
start = _CurrentPlaylistElement.Start; start = _CurrentPlaylistElement.Start;
_SongPlayer.Load(CBase.Songs.GetSongByID(_CurrentPlaylistElement.SongID), start, true); _BGPlayer.Load(_CurrentPlaylistElement.Song, start, true);
} }
} }
+9 -2
View File
@@ -145,7 +145,7 @@ namespace Vocaluxe.Base
[DefaultValue(EOffOn.TR_CONFIG_ON)] public EOffOn VideoPreview; [DefaultValue(EOffOn.TR_CONFIG_ON)] public EOffOn VideoPreview;
[DefaultValue(EOffOn.TR_CONFIG_ON)] public EOffOn VideosInSongs; [DefaultValue(EOffOn.TR_CONFIG_ON)] public EOffOn VideosInSongs;
[DefaultValue(EOffOn.TR_CONFIG_OFF)] public EOffOn VideosToBackground; [DefaultValue(EOffOn.TR_CONFIG_OFF)] public EOffOn VideosToBackground;
[DefaultValue(EWebcamLib.OpenCV)] public EWebcamLib WebcamLib; [DefaultValue(EWebcamLib.AForgeNet)] public EWebcamLib WebcamLib;
public SWebcamConfig? WebcamConfig; public SWebcamConfig? WebcamConfig;
} }
@@ -348,8 +348,14 @@ namespace Vocaluxe.Base
}; };
} }
private static readonly List<string> _CommentsGot = new List<string>();
private static string _GetComment(string elName) private static string _GetComment(string elName)
{ {
// Avoid multiple comments (e.g. for array entries)
if (_CommentsGot.Contains(elName))
return null;
_CommentsGot.Add(elName);
switch (elName) switch (elName)
{ {
case "DebugLevel": case "DebugLevel":
@@ -419,7 +425,7 @@ namespace Vocaluxe.Base
case "Language": case "Language":
return "Game-Language"; return "Game-Language";
case "SongFolder": case "SongFolder":
return "SongFolder: SongFolder1, SongFolder2, SongFolder3, ..."; return "SongFolder: Add each song folder in a seperate SongFolder entry";
case "SongMenu": case "SongMenu":
return "SongMenu: " + CHelper.ListStrings(Enum.GetNames(typeof(ESongMenu))); return "SongMenu: " + CHelper.ListStrings(Enum.GetNames(typeof(ESongMenu)));
case "SongSorting": case "SongSorting":
@@ -467,6 +473,7 @@ namespace Vocaluxe.Base
public static void SaveConfig() public static void SaveConfig()
{ {
_CommentsGot.Clear();
var xml = new CXmlSerializer(true, _GetComment); var xml = new CXmlSerializer(true, _GetComment);
xml.Serialize(_FileConfig, Config); xml.Serialize(_FileConfig, Config);
} }
+26 -15
View File
@@ -17,6 +17,7 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Diagnostics;
using System.Drawing; using System.Drawing;
using System.IO; using System.IO;
using System.Threading; using System.Threading;
@@ -40,10 +41,10 @@ namespace Vocaluxe.Base
public static CTextureRef NoCover { get; private set; } public static CTextureRef NoCover { get; private set; }
public static void Init() public static bool Init()
{ {
_LoadCoverThemes(); _LoadCoverThemes();
_LoadCovers(CConfig.Config.Theme.CoverTheme); return _CoverThemes.Count != 0 && _LoadCovers();
} }
public static void Close() public static void Close()
@@ -91,7 +92,10 @@ namespace Vocaluxe.Base
public static CTextureRef GenerateCover(string text, ECoverGeneratorType type, CSong firstSong) public static CTextureRef GenerateCover(string text, ECoverGeneratorType type, CSong firstSong)
{ {
CTextureRef texture = CDraw.CopyTexture(NoCover); CTextureRef texture = Cover(text);
if (texture != NoCover)
return texture;
texture = CDraw.CopyTexture(NoCover);
Task.Factory.StartNew(() => Task.Factory.StartNew(() =>
{ {
_CancelToken.Token.ThrowIfCancellationRequested(); _CancelToken.Token.ThrowIfCancellationRequested();
@@ -127,7 +131,7 @@ namespace Vocaluxe.Base
public static void ReloadCovers() public static void ReloadCovers()
{ {
_UnloadCovers(); _UnloadCovers();
_LoadCovers(CConfig.Config.Theme.CoverTheme); _LoadCovers();
} }
private static void _UnloadCovers() private static void _UnloadCovers()
@@ -150,14 +154,15 @@ namespace Vocaluxe.Base
/// <summary> /// <summary>
/// Returns a SCoverTheme by cover-theme-name /// Returns a SCoverTheme by cover-theme-name
/// </summary> /// </summary>
private static SThemeCover _CoverTheme(string coverThemeName) private static SThemeCover _GetCoverTheme()
{ {
for (int i = 0; i < _CoverThemes.Count; i++) int index = GetCoverThemeIndex();
if (index < 0)
{ {
if (_CoverThemes[i].Info.Name == coverThemeName) index = 0;
return _CoverThemes[i]; CConfig.Config.Theme.CoverTheme = _CoverThemes[0].Info.Name;
} }
return new SThemeCover(); return _CoverThemes[index];
} }
/// <summary> /// <summary>
@@ -184,7 +189,7 @@ namespace Vocaluxe.Base
continue; continue;
} }
if (theme.Info.Folder != "" && theme.Info.Name != "") if (!String.IsNullOrEmpty(theme.Info.Folder) && !String.IsNullOrEmpty(theme.Info.Name))
{ {
theme.FolderPath = Path.Combine(folderPath, theme.Info.Folder); theme.FolderPath = Path.Combine(folderPath, theme.Info.Folder);
_CoverThemes.Add(theme); _CoverThemes.Add(theme);
@@ -195,12 +200,11 @@ namespace Vocaluxe.Base
/// <summary> /// <summary>
/// Loads all covers from the theme /// Loads all covers from the theme
/// </summary> /// </summary>
private static void _LoadCovers(string coverThemeName) private static bool _LoadCovers()
{ {
SThemeCover coverTheme = _CoverTheme(coverThemeName); SThemeCover coverTheme = _GetCoverTheme();
if (String.IsNullOrEmpty(coverTheme.Info.Name)) Debug.Assert(!String.IsNullOrEmpty(coverTheme.Info.Name));
return;
List<string> files = CHelper.ListImageFiles(coverTheme.FolderPath, true, true); List<string> files = CHelper.ListImageFiles(coverTheme.FolderPath, true, true);
@@ -213,9 +217,16 @@ namespace Vocaluxe.Base
else if (_CoverExists(_NoCoverNameAlt)) else if (_CoverExists(_NoCoverNameAlt))
NoCover = _Covers[_NoCoverNameAlt]; NoCover = _Covers[_NoCoverNameAlt];
else else
CBase.Log.LogError("Covertheme \"" + coverThemeName + "\" does not include a cover file named \"" + _NoCoverName + "\" and cannot be used!", true, true); {
CBase.Log.LogError("Covertheme \"" + coverTheme.Info.Name + "\" does not include a cover file named \"" + _NoCoverName + "\" and cannot be used!", true, true);
_UnloadCovers();
// Remove current theme and recursively try the other themes
_CoverThemes.Remove(coverTheme);
return _CoverThemes.Count > 0 && _LoadCovers();
}
} }
_LoadCoverGenerators(coverTheme); _LoadCoverGenerators(coverTheme);
return true;
} }
public static ECoverGeneratorType _SongSortingToType(ESongSorting sorting) public static ECoverGeneratorType _SongSortingToType(ESongSorting sorting)
+13 -4
View File
@@ -75,37 +75,46 @@ namespace Vocaluxe.Base
public static bool GetDataBaseSongInfos(string artist, string title, out int numPlayed, out DateTime dateAdded, out int highscoreID) public static bool GetDataBaseSongInfos(string artist, string title, out int numPlayed, out DateTime dateAdded, out int highscoreID)
{ {
if (_HighscoreDB == null)
{
numPlayed = 0;
dateAdded = new DateTime();
highscoreID = 0;
return false;
}
return _HighscoreDB.GetDataBaseSongInfos(artist, title, out numPlayed, out dateAdded, out highscoreID); return _HighscoreDB.GetDataBaseSongInfos(artist, title, out numPlayed, out dateAdded, out highscoreID);
} }
public static List<SDBScoreEntry> LoadScore(int songID, EGameMode gameMode) public static List<SDBScoreEntry> LoadScore(int songID, EGameMode gameMode)
{ {
return _HighscoreDB.LoadScore(songID, gameMode); return _HighscoreDB == null ? null : _HighscoreDB.LoadScore(songID, gameMode);
} }
public static int AddScore(SPlayer player) public static int AddScore(SPlayer player)
{ {
return _HighscoreDB.AddScore(player); return _HighscoreDB == null ? -1 : _HighscoreDB.AddScore(player);
} }
public static void IncreaseSongCounter(int dataBaseSongID) public static void IncreaseSongCounter(int dataBaseSongID)
{ {
if (_HighscoreDB != null)
_HighscoreDB.IncreaseSongCounter(dataBaseSongID); _HighscoreDB.IncreaseSongCounter(dataBaseSongID);
} }
public static bool GetCover(string fileName, ref CTextureRef tex, int maxSize) public static bool GetCover(string fileName, ref CTextureRef tex, int maxSize)
{ {
return _CoverDB.GetCover(fileName, ref tex, maxSize); return _CoverDB != null && _CoverDB.GetCover(fileName, ref tex, maxSize);
} }
public static void CommitCovers() public static void CommitCovers()
{ {
if (_CoverDB != null)
_CoverDB.CommitCovers(); _CoverDB.CommitCovers();
} }
public static bool GetCreditsRessource(string fileName, ref CTextureRef tex) public static bool GetCreditsRessource(string fileName, ref CTextureRef tex)
{ {
return _ResourceDB.GetCreditsRessource(fileName, ref tex); return _ResourceDB != null && _ResourceDB.GetCreditsRessource(fileName, ref tex);
} }
} }
} }
+12 -2
View File
@@ -224,16 +224,18 @@ namespace Vocaluxe.Base
NextScreen.ProcessMouseMove(_Cursor.X, _Cursor.Y); NextScreen.ProcessMouseMove(_Cursor.X, _Cursor.Y);
HidePopup(EPopupScreens.PopupPlayerControl); HidePopup(EPopupScreens.PopupPlayerControl);
if (NextScreen.CurrentMusicType != EMusicType.Background && NextScreen.CurrentMusicType != EMusicType.Preview)
CBackgroundMusic.Disabled = true;
} }
if (_Fading != null) if (_Fading != null)
{ {
Debug.Assert(NextScreen != null);
bool finished; bool finished;
float newAlpha = _Fading.GetValue(out finished); float newAlpha = _Fading.GetValue(out finished);
if (!finished) if (!finished)
{ {
GlobalAlpha = 1f;
ZOffset = CSettings.ZFar / 2; ZOffset = CSettings.ZFar / 2;
_DrawScreen(CurrentScreen); _DrawScreen(CurrentScreen);
@@ -242,6 +244,9 @@ namespace Vocaluxe.Base
_DrawScreen(NextScreen); _DrawScreen(NextScreen);
GlobalAlpha = 1f; GlobalAlpha = 1f;
int oldVol = CConfig.GetVolumeByType(CurrentScreen.CurrentMusicType);
int newVol = CConfig.GetVolumeByType(NextScreen.CurrentMusicType);
CSound.SetGlobalVolume((int)((newVol - oldVol) * newAlpha + oldVol));
} }
else else
{ {
@@ -274,6 +279,11 @@ namespace Vocaluxe.Base
NextScreen = null; NextScreen = null;
CurrentScreen.OnShowFinish(); CurrentScreen.OnShowFinish();
CSound.SetGlobalVolume(CConfig.GetVolumeByType(CurrentScreen.CurrentMusicType)); CSound.SetGlobalVolume(CConfig.GetVolumeByType(CurrentScreen.CurrentMusicType));
if (CurrentScreen.CurrentMusicType == EMusicType.Background || CurrentScreen.CurrentMusicType == EMusicType.Preview)
{
CBackgroundMusic.Disabled = false;
CBackgroundMusic.IsPlayingPreview = CurrentScreen.CurrentMusicType == EMusicType.Preview;
}
_Fading = null; _Fading = null;
} }
@@ -348,7 +358,7 @@ namespace Vocaluxe.Base
SKeyEvent inputKeyEvent = new SKeyEvent(); SKeyEvent inputKeyEvent = new SKeyEvent();
SMouseEvent inputMouseEvent = new SMouseEvent(); SMouseEvent inputMouseEvent = new SMouseEvent();
bool popupPlayerControlAllowed = CurrentScreen.CurrentMusicType == EMusicType.Background && !CBackgroundMusic.Disabled; bool popupPlayerControlAllowed = CurrentScreen.CurrentMusicType == EMusicType.Background;
bool popupVolumeControlAllowed = CurrentScreen.CurrentMusicType != EMusicType.None; bool popupVolumeControlAllowed = CurrentScreen.CurrentMusicType != EMusicType.None;
//Hide volume control for bg-music if bg-music is disabled //Hide volume control for bg-music if bg-music is disabled
if (popupVolumeControlAllowed && CurrentScreen.CurrentMusicType == EMusicType.Background && CConfig.Config.Sound.BackgroundMusic == EBackgroundMusicOffOn.TR_CONFIG_OFF) if (popupVolumeControlAllowed && CurrentScreen.CurrentMusicType == EMusicType.Background && CConfig.Config.Sound.BackgroundMusic == EBackgroundMusicOffOn.TR_CONFIG_OFF)
+11 -6
View File
@@ -355,21 +355,21 @@ namespace Vocaluxe.Base
CBackgroundMusic.Stop(); CBackgroundMusic.Stop();
} }
public void LoadPreview(CSong song, float start = 0f) public void LoadPreview(CSong song, float start = -1f)
{ {
CBackgroundMusic.LoadPreview(song, start); CBackgroundMusic.LoadPreview(song, start);
} }
public void PlayPreview(float start = -1f)
{
CBackgroundMusic.PlayPreview(start);
}
public void StopPreview() public void StopPreview()
{ {
CBackgroundMusic.StopPreview(); CBackgroundMusic.StopPreview();
} }
public void SetPlayingPreview(bool playPreview)
{
CBackgroundMusic.IsPlayingPreview = playPreview;
}
public CTextureRef GetVideoTexture() public CTextureRef GetVideoTexture()
{ {
return CBackgroundMusic.GetVideoTexture(); return CBackgroundMusic.GetVideoTexture();
@@ -877,6 +877,11 @@ namespace Vocaluxe.Base
{ {
CSound.SetGlobalVolume(volume); CSound.SetGlobalVolume(volume);
} }
public bool IsPaused(int streamID)
{
return CSound.IsPaused(streamID);
}
} }
class CBcover : ICover class CBcover : ICover
+53 -43
View File
@@ -18,6 +18,7 @@
using System; using System;
using System.CodeDom.Compiler; using System.CodeDom.Compiler;
using System.Collections.Generic; using System.Collections.Generic;
using System.Diagnostics;
using System.IO; using System.IO;
using System.Reflection; using System.Reflection;
using Vocaluxe.Base.ThemeSystem; using Vocaluxe.Base.ThemeSystem;
@@ -32,40 +33,52 @@ namespace Vocaluxe.Base
{ {
private const int _PartyModeSystemVersion = 1; private const int _PartyModeSystemVersion = 1;
private static Dictionary<int, SPartyMode> _PartyModes; private static readonly Dictionary<int, SPartyMode> _PartyModes = new Dictionary<int, SPartyMode>();
private static int _NextID; private static int _NextID;
private static IPartyMode _CurrentPartyMode;
private static int _NormalGameModeID;
private static SPartyMode _CurrentPartyMode;
#region public stuff #region public stuff
public static void Init() public static bool Init()
{ {
_PartyModes = new Dictionary<int, SPartyMode>(); if (_PartyModes.Count > 0)
_NextID = 0; return false; //Already initialized
SPartyMode pm = new SPartyMode
//add dummy normal game mode and set it as default {
var pm = new SPartyMode {ScreenFiles = new List<string>(), PartyMode = new CPartyModeNone(_NextID++, null)}; Info = new SPartyModeInfos {Author = "Vocaluxe Team", Description = "Normal game", Name = "Normal", TargetAudience = "Just a normal game for everyone"},
_NormalGameModeID = pm.PartyMode.ID; PartyMode = new CPartyModeNormal(-1),
_PartyModes.Add(pm.PartyMode.ID, pm); PartyModeSystemVersion = _PartyModeSystemVersion,
_CurrentPartyMode = pm; ScreenFiles = new List<string>()
};
_PartyModes.Add(-1, pm);
_CurrentPartyMode = pm.PartyMode;
Debug.Assert(_CurrentPartyMode != null && _CurrentPartyMode.ID == -1);
//load other party modes //load other party modes
_LoadPartyModes(); _LoadPartyModes();
return _CurrentPartyMode.Init();
} }
public static int CurrentPartyModeID public static int CurrentPartyModeID
{ {
get get { return _CurrentPartyMode.ID; }
set
{ {
if (_CurrentPartyMode.PartyMode.ID != _NormalGameModeID) if (_CurrentPartyMode.ID == value)
return _CurrentPartyMode.PartyMode.ID; return;
if (value != -1 && !_PartyModes.ContainsKey(value))
return -1; throw new ArgumentException("Partymode with ID=" + value + " does not exist!");
IPartyMode pm = _PartyModes[value].PartyMode;
if (pm.Init())
_CurrentPartyMode = pm;
else
{
CLog.LogError("Could not init PartyMode \"" + _PartyModes[value].Info.Name + "\"! Removing...", true);
_PartyModes.Remove(value);
}
} }
} }
public static int NumModes public static int Count
{ {
get { return _PartyModes.Count; } get { return _PartyModes.Count; }
} }
@@ -90,85 +103,81 @@ namespace Vocaluxe.Base
public static List<SPartyModeInfos> GetPartyModeInfos() public static List<SPartyModeInfos> GetPartyModeInfos()
{ {
var infos = new List<SPartyModeInfos>(); List<SPartyModeInfos> list = new List<SPartyModeInfos>();
foreach (SPartyMode pm in _PartyModes.Values)
foreach (KeyValuePair<int, SPartyMode> kvp in _PartyModes)
{ {
if (kvp.Key != _NormalGameModeID) if (pm.PartyMode.ID >= 0)
infos.Add(kvp.Value.Info); list.Add(pm.Info);
} }
return infos; return list;
} }
public static void SetNormalGameMode() public static void SetNormalGameMode()
{ {
CSongs.ResetPartySongSung(); CSongs.ResetPartySongSung();
SetPartyMode(_NormalGameModeID); CurrentPartyModeID = -1;
} }
public static void SetPartyMode(int partyModeID) public static void SetPartyMode(int partyModeID)
{ {
if (!_PartyModes.TryGetValue(partyModeID, out _CurrentPartyMode)) CurrentPartyModeID = partyModeID;
CLog.LogError("CParty: Can't find party mode ID: " + partyModeID);
_CurrentPartyMode.PartyMode.Init();
} }
#endregion public stuff #endregion public stuff
#region Interface #region Interface
public static void UpdateGame() public static void UpdateGame()
{ {
_CurrentPartyMode.PartyMode.UpdateGame(); _CurrentPartyMode.UpdateGame();
} }
public static IMenu GetStartScreen() public static IMenu GetStartScreen()
{ {
return _CurrentPartyMode.PartyMode.GetStartScreen(); return _CurrentPartyMode.GetStartScreen();
} }
public static SScreenSongOptions GetSongSelectionOptions() public static SScreenSongOptions GetSongSelectionOptions()
{ {
return _CurrentPartyMode.PartyMode.GetScreenSongOptions(); return _CurrentPartyMode.GetScreenSongOptions();
} }
public static void OnSongChange(int songIndex, ref SScreenSongOptions screenSongOptions) public static void OnSongChange(int songIndex, ref SScreenSongOptions screenSongOptions)
{ {
_CurrentPartyMode.PartyMode.OnSongChange(songIndex, ref screenSongOptions); _CurrentPartyMode.OnSongChange(songIndex, ref screenSongOptions);
} }
public static void OnCategoryChange(int categoryIndex, ref SScreenSongOptions screenSongOptions) public static void OnCategoryChange(int categoryIndex, ref SScreenSongOptions screenSongOptions)
{ {
_CurrentPartyMode.PartyMode.OnCategoryChange(categoryIndex, ref screenSongOptions); _CurrentPartyMode.OnCategoryChange(categoryIndex, ref screenSongOptions);
} }
public static void SetSearchString(string searchString, bool visible) public static void SetSearchString(string searchString, bool visible)
{ {
_CurrentPartyMode.PartyMode.SetSearchString(searchString, visible); _CurrentPartyMode.SetSearchString(searchString, visible);
} }
public static void JokerUsed(int teamNr) public static void JokerUsed(int teamNr)
{ {
_CurrentPartyMode.PartyMode.JokerUsed(teamNr); _CurrentPartyMode.JokerUsed(teamNr);
} }
public static void SongSelected(int songID) public static void SongSelected(int songID)
{ {
_CurrentPartyMode.PartyMode.SongSelected(songID); _CurrentPartyMode.SongSelected(songID);
} }
public static void FinishedSinging() public static void FinishedSinging()
{ {
_CurrentPartyMode.PartyMode.FinishedSinging(); _CurrentPartyMode.FinishedSinging();
} }
public static void LeavingScore() public static void LeavingScore()
{ {
_CurrentPartyMode.PartyMode.LeavingScore(); _CurrentPartyMode.LeavingScore();
} }
public static void LeavingHighscore() public static void LeavingHighscore()
{ {
_CurrentPartyMode.PartyMode.LeavingHighscore(); _CurrentPartyMode.LeavingHighscore();
} }
#endregion Interface #endregion Interface
@@ -216,7 +225,7 @@ namespace Vocaluxe.Base
return false; return false;
object instance = output.CreateInstance(typeof(IPartyMode).Namespace + "." + pm.Info.Folder + "." + pm.Info.PartyModeFile, false, object instance = output.CreateInstance(typeof(IPartyMode).Namespace + "." + pm.Info.Folder + "." + pm.Info.PartyModeFile, false,
BindingFlags.Public | BindingFlags.Instance, null, new object[] {_NextID++, pathToPm}, null, null); BindingFlags.Public | BindingFlags.Instance, null, new object[] {_NextID++}, null, null);
if (instance == null) if (instance == null)
{ {
CLog.LogError("Error creating Instance of PartyMode file: " + filePath); CLog.LogError("Error creating Instance of PartyMode file: " + filePath);
@@ -258,7 +267,7 @@ namespace Vocaluxe.Base
return false; return false;
} }
pm.PartyMode.LoadTheme(); pm.PartyMode.LoadTheme();
pm.Info.LoadData(pm.PartyMode); pm.Info.ExtInfo = pm.PartyMode;
return true; return true;
} }
@@ -269,6 +278,7 @@ namespace Vocaluxe.Base
var compilerParams = new CompilerParameters(); var compilerParams = new CompilerParameters();
compilerParams.ReferencedAssemblies.Add("System.Windows.Forms.dll"); compilerParams.ReferencedAssemblies.Add("System.Windows.Forms.dll");
compilerParams.ReferencedAssemblies.Add("System.dll");
compilerParams.ReferencedAssemblies.Add("System.Core.dll"); compilerParams.ReferencedAssemblies.Add("System.Core.dll");
compilerParams.ReferencedAssemblies.Add("VocaluxeLib.dll"); compilerParams.ReferencedAssemblies.Add("VocaluxeLib.dll");
compilerParams.GenerateInMemory = true; compilerParams.GenerateInMemory = true;
+20 -11
View File
@@ -23,61 +23,70 @@ namespace Vocaluxe.Base
{ {
class CPlaylistElement class CPlaylistElement
{ {
private readonly CSong _Song; public readonly CSong Song;
private readonly string _MusicFilePath = String.Empty; private readonly string _MusicFilePath = String.Empty;
public bool HasMetaData
{
get { return Song != null; }
}
public int SongID public int SongID
{ {
get { return (_Song == null) ? -1 : _Song.ID; } get { return HasMetaData ? Song.ID : -1; }
} }
public string MusicFilePath public string MusicFilePath
{ {
get { return _Song != null ? _Song.GetMP3() : _MusicFilePath; } get { return HasMetaData ? Song.GetMP3() : _MusicFilePath; }
} }
public string VideoFilePath public string VideoFilePath
{ {
get { return _Song != null ? _Song.GetVideo() : string.Empty; } get { return HasMetaData ? Song.GetVideo() : string.Empty; }
} }
public string Title public string Title
{ {
get { return _Song != null ? _Song.Title : ""; } get { return HasMetaData ? Song.Title : ""; }
} }
public string Artist public string Artist
{ {
get { return _Song != null ? _Song.Artist : ""; } get { return HasMetaData ? Song.Artist : ""; }
} }
public float Start public float Start
{ {
get { return _Song != null ? _Song.Start : 0f; } get { return HasMetaData ? Song.Start : 0f; }
} }
public float Finish public float Finish
{ {
get { return _Song != null ? _Song.Finish : 0f; } get { return HasMetaData ? Song.Finish : 0f; }
} }
public CTextureRef Cover public CTextureRef Cover
{ {
get { return _Song != null ? _Song.CoverTextureSmall : CCover.NoCover; } get { return HasMetaData ? Song.CoverTextureSmall : CCover.NoCover; }
} }
public float VideoGap public float VideoGap
{ {
get { return _Song != null ? _Song.VideoGap : 0; } get { return HasMetaData ? Song.VideoGap : 0; }
} }
public CPlaylistElement(CSong song) public CPlaylistElement(CSong song)
{ {
_Song = song; if (song == null)
throw new ArgumentNullException("song");
Song = song;
} }
public CPlaylistElement(string filePath) public CPlaylistElement(string filePath)
{ {
if (String.IsNullOrEmpty(filePath))
throw new ArgumentNullException("filePath");
_MusicFilePath = filePath; _MusicFilePath = filePath;
} }
} }
+2 -11
View File
@@ -17,6 +17,7 @@
using System.Collections.Generic; using System.Collections.Generic;
using System.ComponentModel; using System.ComponentModel;
using System.Diagnostics;
using System.Xml.Serialization; using System.Xml.Serialization;
using Vocaluxe.Base.Fonts; using Vocaluxe.Base.Fonts;
using VocaluxeLib; using VocaluxeLib;
@@ -121,17 +122,7 @@ namespace Vocaluxe.Base
[XmlAltName("PartyModeVersionMajor")] public int VersionMajor; [XmlAltName("PartyModeVersionMajor")] public int VersionMajor;
[XmlAltName("PartyModeVersionMinor")] public int VersionMinor; [XmlAltName("PartyModeVersionMinor")] public int VersionMinor;
public string TargetAudience; public string TargetAudience;
[XmlIgnore] public int MaxPlayers, MinPlayers, MaxTeams, MinTeams; [XmlIgnore] public IPartyModeInfo ExtInfo;
[XmlIgnore] public int PartyModeID;
public void LoadData(IPartyMode pm)
{
MaxPlayers = pm.GetMaxPlayer();
MinPlayers = pm.GetMinPlayer();
MaxTeams = pm.GetMaxTeams();
MinTeams = pm.GetMinTeams();
PartyModeID = pm.ID;
}
} }
struct SPartyMode struct SPartyMode
@@ -237,7 +237,7 @@ namespace Vocaluxe.Lib.Sound.Playback.GstreamerSharp
private bool _OnMessage(Message msg) private bool _OnMessage(Message msg)
{ {
if (msg.Handle == IntPtr.Zero) if (msg == null || msg.Handle == IntPtr.Zero)
return true; return true;
switch (msg.Type) switch (msg.Type)
{ {
+2 -2
View File
@@ -45,9 +45,9 @@ namespace Vocaluxe.Lib.Sound.Playback
void Fade(int streamID, int targetVolume, float seconds, EStreamAction afterFadeAction = EStreamAction.Nothing); void Fade(int streamID, int targetVolume, float seconds, EStreamAction afterFadeAction = EStreamAction.Nothing);
/// <summary> /// <summary>
/// Set the streams current volume. Cancels fading /// Set the stream's current volume. Cancels fading
/// </summary> /// </summary>
/// <param name="streamID">Id of the stream (optained by Load)</param> /// <param name="streamID">Id of the stream (obtained by Load)</param>
/// <param name="volume">Volume in percent</param> /// <param name="volume">Volume in percent</param>
void SetStreamVolume(int streamID, int volume); void SetStreamVolume(int streamID, int volume);
@@ -49,8 +49,7 @@ namespace Vocaluxe.Lib.Sound.Playback.PortAudio
_CurrentTime = value; _CurrentTime = value;
_OldTime = value; _OldTime = value;
_Timer.Reset(); _Timer.Restart();
_Timer.Start();
} }
} }
@@ -44,8 +44,7 @@ namespace Vocaluxe.Lib.Sound.Playback.PortAudio
{ {
_ExternTime.Time = value; _ExternTime.Time = value;
_SetValue = value; _SetValue = value;
_Timer.Reset(); _Timer.Restart();
_Timer.Start();
} }
} }
+1 -1
View File
@@ -36,7 +36,7 @@ namespace Vocaluxe.Lib.Video
/// Loads the file with the given file path. /// Loads the file with the given file path.
/// </summary> /// </summary>
/// <param name="videoFileName">Absolute file path of the video file</param> /// <param name="videoFileName">Absolute file path of the video file</param>
/// <returns>stream &gt;=0 on success or -1 on failure</returns> /// <returns>Loaded video stream or null on failure</returns>
CVideoStream Load(string videoFileName); CVideoStream Load(string videoFileName);
/// <summary> /// <summary>
+4 -2
View File
@@ -199,7 +199,8 @@ namespace Vocaluxe
// Load Cover // Load Cover
CLog.StartBenchmark("Init Cover"); CLog.StartBenchmark("Init Cover");
CCover.Init(); if (!CCover.Init())
throw new CLoadingException("covertheme");
CLog.StopBenchmark("Init Cover"); CLog.StopBenchmark("Init Cover");
Application.DoEvents(); Application.DoEvents();
@@ -237,7 +238,8 @@ namespace Vocaluxe
// Init Party Modes; // Init Party Modes;
CLog.StartBenchmark("Init Party Modes"); CLog.StartBenchmark("Init Party Modes");
CParty.Init(); if (!CParty.Init())
throw new CLoadingException("Party Modes");
CLog.StopBenchmark("Init Party Modes"); CLog.StopBenchmark("Init Party Modes");
Application.DoEvents(); Application.DoEvents();
@@ -112,7 +112,7 @@ namespace Vocaluxe.Screens
if (_Buttons[_ButtonPrevious].Selected) if (_Buttons[_ButtonPrevious].Selected)
CBackgroundMusic.Previous(); CBackgroundMusic.Previous();
if (_Buttons[_ButtonPlay].Selected) if (_Buttons[_ButtonPlay].Selected)
CBackgroundMusic.Pause(); CBackgroundMusic.Play();
if (_Buttons[_ButtonPause].Selected) if (_Buttons[_ButtonPause].Selected)
CBackgroundMusic.Pause(); CBackgroundMusic.Pause();
if (_Buttons[_ButtonRepeat].Selected) if (_Buttons[_ButtonRepeat].Selected)
@@ -140,7 +140,7 @@ namespace Vocaluxe.Screens
if (_Buttons[_ButtonPrevious].Selected) if (_Buttons[_ButtonPrevious].Selected)
CBackgroundMusic.Previous(); CBackgroundMusic.Previous();
if (_Buttons[_ButtonPlay].Selected) if (_Buttons[_ButtonPlay].Selected)
CBackgroundMusic.Pause(); CBackgroundMusic.Play();
if (_Buttons[_ButtonPause].Selected) if (_Buttons[_ButtonPause].Selected)
CBackgroundMusic.Pause(); CBackgroundMusic.Pause();
if (_Buttons[_ButtonRepeat].Selected) if (_Buttons[_ButtonRepeat].Selected)
+148 -4
View File
@@ -34,6 +34,72 @@ namespace Vocaluxe.Screens
Up Up
} }
class CCreditTranslation
{
private readonly string _Language;
private readonly List<CText> _Texts;
public float StartTime;
public float Y
{
get { return _Texts[0].Y; }
set
{
float diff = value - _Texts[0].Y;
foreach (CText t in _Texts)
t.Y += diff;
}
}
public float Alpha
{
get { return _Texts[0].Alpha; }
set
{
foreach (CText t in _Texts)
t.Alpha = value;
}
}
public bool Visible
{
set
{
foreach (CText t in _Texts)
t.Visible = value;
}
}
public float LastY
{
get
{
int lastText = _Texts.Count - 1;
return _Texts[lastText].Y + _Texts[lastText].H;
}
}
public CCreditTranslation(string language, List<CText> texts)
{
_Language = language;
_Texts = texts;
}
public void Reset()
{
StartTime = -1;
Alpha = 1f;
Visible = true;
_Texts[0].Y = CSettings.RenderH + 1;
float y = CSettings.RenderH + 1;
foreach (CText t in _Texts)
{
y += 25;
t.Y = y;
}
}
}
class CCreditName class CCreditName
{ {
private readonly CStatic _Image; private readonly CStatic _Image;
@@ -120,8 +186,12 @@ namespace Vocaluxe.Screens
private CParticleEffect _StarsBlue; private CParticleEffect _StarsBlue;
private List<CCreditName> _CreditNames; private List<CCreditName> _CreditNames;
private List<CCreditTranslation> _Translations;
private int _NumTranslationTexts;
private Stopwatch _LogoTimer; private Stopwatch _LogoTimer;
private Stopwatch _CreditsTimer; private Stopwatch _CreditsTimer;
private Stopwatch _TranslationsTimer;
private Stopwatch _TextTimer; private Stopwatch _TextTimer;
private List<string[]> _Paragraphs; private List<string[]> _Paragraphs;
@@ -155,6 +225,7 @@ namespace Vocaluxe.Screens
_LogoTimer = new Stopwatch(); _LogoTimer = new Stopwatch();
_CreditsTimer = new Stopwatch(); _CreditsTimer = new Stopwatch();
_TranslationsTimer = new Stopwatch();
_TextTimer = new Stopwatch(); _TextTimer = new Stopwatch();
//Text for last part of credits. //Text for last part of credits.
@@ -278,6 +349,8 @@ namespace Vocaluxe.Screens
_AddNewCreditName(_TexNameBohning, 383, 54, false); _AddNewCreditName(_TexNameBohning, 383, 54, false);
_AddNewCreditName(_TexNameMesand, 525, 13, false); _AddNewCreditName(_TexNameMesand, 525, 13, false);
_AddNewCreditName(_TexNameBabene03, 33, 26, false); _AddNewCreditName(_TexNameBabene03, 33, 26, false);
_AddTranslations();
} }
public override void ReloadTheme(string xmlPath) {} public override void ReloadTheme(string xmlPath) {}
@@ -349,6 +422,42 @@ namespace Vocaluxe.Screens
_AddParticleEffect(particle); _AddParticleEffect(particle);
} }
private void _AddTranslations()
{
CCreditTranslation intro = _AddNewTranslation("A special thanks to all our translators", new List<string> { });
CCreditTranslation asturian = _AddNewTranslation("Asturian", new List<string> { "Puxarra" });
CCreditTranslation czech = _AddNewTranslation("Czech", new List<string> { "fri" });
CCreditTranslation dutch = _AddNewTranslation("Dutch", new List<string> { "thijsblaauw" });
CCreditTranslation french = _AddNewTranslation("French", new List<string> { "pinky007" });
CCreditTranslation hungarian = _AddNewTranslation("Hungarian", new List<string> { "warez" });
CCreditTranslation italian = _AddNewTranslation("Italian", new List<string> { "giuseppep", "LFactory" });
CCreditTranslation spanish = _AddNewTranslation("Spanish", new List<string> { "Pantero03", "RubenDjOn", "TeLiX", "karv" });
CCreditTranslation swedish = _AddNewTranslation("Swedish", new List<string> { "u28151" });
CCreditTranslation turkish = _AddNewTranslation("Turkish", new List<string> { "spirax", "Swertyy" });
_Translations = new List<CCreditTranslation> { intro, asturian, czech, dutch, french, hungarian, italian, spanish, swedish, turkish };
}
private CCreditTranslation _AddNewTranslation(string language, List<string> translators)
{
List<CText> texts = new List<CText>();
CText text = GetNewText(new CText(CSettings.RenderW / 2, CSettings.RenderH + 1, -4f, 30, -1, EAlignment.Center, EStyle.Bold, "Outline", new SColorF(1, 1, 1, 1), language));
_AddText(text);
texts.Add(text);
_NumTranslationTexts++;
float y = texts[0].Y;
foreach (string t in translators)
{
y += 30;
text = GetNewText(new CText(CSettings.RenderW / 2, y, -4f, 27, -1, EAlignment.Center, EStyle.Normal, "Outline", new SColorF(1, 1, 1, 1), t));
_AddText(text);
texts.Add(text);
_NumTranslationTexts++;
}
CCreditTranslation cct = new CCreditTranslation(language, texts);
return cct;
}
public override void OnShow() public override void OnShow()
{ {
base.OnShow(); base.OnShow();
@@ -368,10 +477,13 @@ namespace Vocaluxe.Screens
_Logo.Y = -270; _Logo.Y = -270;
_StarsRed.Y = _Logo.Y; _StarsRed.Y = _Logo.Y;
_StarsBlue.Y = _Logo.Y; _StarsBlue.Y = _Logo.Y;
foreach (CCreditTranslation translation in _Translations)
translation.Reset();
_TextTimer.Reset(); _TextTimer.Reset();
_LogoTimer.Reset(); _LogoTimer.Reset();
_CreditsTimer.Reset(); _CreditsTimer.Reset();
_TranslationsTimer.Reset();
} }
public override void OnShowFinish() public override void OnShowFinish()
@@ -447,9 +559,7 @@ namespace Vocaluxe.Screens
if (i == _CreditNames.Count - 1) if (i == _CreditNames.Count - 1)
{ {
_CreditsTimer.Stop(); _CreditsTimer.Stop();
_TextTimer.Start(); _TranslationsTimer.Start();
foreach (CText text in _ParagraphTexts)
text.Visible = true;
} }
} }
else if (_CreditNames[i].Y <= 360f) else if (_CreditNames[i].Y <= 360f)
@@ -463,9 +573,43 @@ namespace Vocaluxe.Screens
} }
} }
} }
if (_TranslationsTimer.IsRunning)
{
active = true;
for (int i = 0; i < _Translations.Count; i++)
{
if (i * 1500f < _TranslationsTimer.ElapsedMilliseconds)
{
if (_Translations[i].StartTime == -1)
_Translations[i].StartTime = _TranslationsTimer.ElapsedMilliseconds;
float newY = 720f - (520f / 5000f) * (_TranslationsTimer.ElapsedMilliseconds - _Translations[i].StartTime);
_Translations[i].Y = newY;
}
if (_Translations[i].Y <= 160f)
{
_Translations[i].Visible = false;
if (i == _Translations.Count - 1)
{
_TranslationsTimer.Stop();
_TextTimer.Start();
foreach (CText text in _ParagraphTexts)
text.Visible = true;
}
}
if (_Translations[i].Y <= 360f)
{
//Fade out
float alpha = ((360 - _Translations[i].Y) / 200).Clamp(0,1);
_Translations[i].Alpha = 1 - alpha;
}
}
}
if (_TextTimer.IsRunning) if (_TextTimer.IsRunning)
active = _TextTimer.ElapsedMilliseconds <= 500; active = _TextTimer.ElapsedMilliseconds <= 10000;
return active; return active;
} }
+5
View File
@@ -65,6 +65,11 @@ namespace Vocaluxe.Screens
private bool _AvatarsChanged; private bool _AvatarsChanged;
private bool _ProfilesChanged; private bool _ProfilesChanged;
public override EMusicType CurrentMusicType
{
get { return EMusicType.Preview; }
}
#region public methods #region public methods
public override void Init() public override void Init()
{ {
+1 -1
View File
@@ -134,7 +134,7 @@ namespace Vocaluxe.Screens
private void _SaveConfig() private void _SaveConfig()
{ {
CLanguage.LanguageId = _SelectSlides[_SelectSlideLanguage].Selection; CLanguage.LanguageId = _SelectSlides[_SelectSlideLanguage].Selection;
CConfig.Config.Game.Language = _SelectSlides[_SelectSlideLanguage].Value; CConfig.Config.Game.Language = _SelectSlides[_SelectSlideLanguage].SelectedValue;
CConfig.Config.Debug.DebugLevel = (EDebugLevel)_SelectSlides[_SelectSlideDebugLevel].Selection; CConfig.Config.Debug.DebugLevel = (EDebugLevel)_SelectSlides[_SelectSlideDebugLevel].Selection;
CConfig.Config.Game.SongMenu = (ESongMenu)_SelectSlides[_SelectSlideSongMenu].Selection; CConfig.Config.Game.SongMenu = (ESongMenu)_SelectSlides[_SelectSlideSongMenu].Selection;
CConfig.Config.Game.SongSorting = (ESongSorting)_SelectSlides[_SelectSlideSongSorting].Selection; CConfig.Config.Game.SongSorting = (ESongSorting)_SelectSlides[_SelectSlideSongSorting].Selection;
+1 -3
View File
@@ -65,7 +65,7 @@ namespace Vocaluxe.Screens
public override EMusicType CurrentMusicType public override EMusicType CurrentMusicType
{ {
get { return EMusicType.None; } get { return EMusicType.Game; }
} }
public override void Init() public override void Init()
@@ -303,7 +303,6 @@ namespace Vocaluxe.Screens
public override void OnShowFinish() public override void OnShowFinish()
{ {
base.OnShowFinish(); base.OnShowFinish();
CBackgroundMusic.Disabled = true;
} }
public override void Draw() public override void Draw()
@@ -332,7 +331,6 @@ namespace Vocaluxe.Screens
CRecord.Stop(); CRecord.Stop();
_DelayTest.Reset(); _DelayTest.Reset();
CBackgroundMusic.Disabled = false;
} }
private void _OnDeviceEvent() private void _OnDeviceEvent()
+5 -5
View File
@@ -171,15 +171,15 @@ namespace Vocaluxe.Screens
CConfig.SaveConfig(); CConfig.SaveConfig();
if (_OldCoverTheme != _SelectSlides[_SelectSlideCover].Value) if (_OldCoverTheme != _SelectSlides[_SelectSlideCover].SelectedValue)
CCover.ReloadCovers(); CCover.ReloadCovers();
} }
private void _OnChange() private void _OnChange()
{ {
if (CConfig.Config.Theme.Theme != _SelectSlides[_SelectSlideTheme].Value) if (CConfig.Config.Theme.Theme != _SelectSlides[_SelectSlideTheme].SelectedValue)
{ {
CConfig.Config.Theme.Theme = _SelectSlides[_SelectSlideTheme].Value; CConfig.Config.Theme.Theme = _SelectSlides[_SelectSlideTheme].SelectedValue;
CThemes.Reload(); CThemes.Reload();
CGraphics.ReloadTheme(); CGraphics.ReloadTheme();
@@ -188,9 +188,9 @@ namespace Vocaluxe.Screens
return; return;
} }
if (CConfig.Config.Theme.Skin != _SelectSlides[_SelectSlideSkin].Value) if (CConfig.Config.Theme.Skin != _SelectSlides[_SelectSlideSkin].SelectedValue)
{ {
CConfig.Config.Theme.Skin = _SelectSlides[_SelectSlideSkin].Value; CConfig.Config.Theme.Skin = _SelectSlides[_SelectSlideSkin].SelectedValue;
CThemes.ReloadSkin(); CThemes.ReloadSkin();
CGraphics.ReloadSkin(); CGraphics.ReloadSkin();
+29 -22
View File
@@ -20,6 +20,7 @@ using System.Windows.Forms;
using Vocaluxe.Base; using Vocaluxe.Base;
using VocaluxeLib; using VocaluxeLib;
using VocaluxeLib.Menu; using VocaluxeLib.Menu;
using VocaluxeLib.PartyModes;
namespace Vocaluxe.Screens namespace Vocaluxe.Screens
{ {
@@ -115,7 +116,7 @@ namespace Vocaluxe.Screens
_SelectSlides[_SelectSlideModes].Clear(); _SelectSlides[_SelectSlideModes].Clear();
foreach (SPartyModeInfos info in _PartyModeInfos) foreach (SPartyModeInfos info in _PartyModeInfos)
_SelectSlides[_SelectSlideModes].AddValue(info.Name, info.PartyModeID); _SelectSlides[_SelectSlideModes].AddValue(info.Name, info.ExtInfo.ID);
_SelectSlides[_SelectSlideModes].Selection = 0; _SelectSlides[_SelectSlideModes].Selection = 0;
_UpdateSelection(); _UpdateSelection();
@@ -134,42 +135,48 @@ namespace Vocaluxe.Screens
int index = _SelectSlides[_SelectSlideModes].Selection; int index = _SelectSlides[_SelectSlideModes].Selection;
if (index >= _PartyModeInfos.Count) if (index >= _PartyModeInfos.Count)
return; {
index = 0;
_SelectSlides[_SelectSlideModes].Selection = 0;
}
//Description //Description
_Texts[_TextDescription].Text = _PartyModeInfos[index].Description; SPartyModeInfos infos = _PartyModeInfos[index];
_Texts[_TextDescription].TranslationID = _PartyModeInfos[index].PartyModeID; IPartyModeInfo extInfo = infos.ExtInfo;
_Texts[_TextDescription].Text = infos.Description;
_Texts[_TextDescription].TranslationID = extInfo.ID;
//TargetAudience //TargetAudience
_Texts[_TextTargetAudience].TranslationID = _PartyModeInfos[index].PartyModeID; _Texts[_TextTargetAudience].TranslationID = extInfo.ID;
_Texts[_TextTargetAudience].Text = _PartyModeInfos[index].TargetAudience; _Texts[_TextTargetAudience].Text = infos.TargetAudience;
//NumTeams //NumTeams
if (_PartyModeInfos[index].MaxTeams == 0) if (extInfo.MaxTeams == 1)
_Texts[_TextNumTeams].Text = "TR_SCREENPARTY_NOTEAMS"; _Texts[_TextNumTeams].Text = "TR_SCREENPARTY_NOTEAMS";
else if (_PartyModeInfos[index].MaxTeams == _PartyModeInfos[index].MinTeams) else if (extInfo.MaxTeams == extInfo.MinTeams)
_Texts[_TextNumTeams].Text = _PartyModeInfos[index].MaxTeams.ToString(); _Texts[_TextNumTeams].Text = extInfo.MaxTeams.ToString();
else if (_PartyModeInfos[index].MaxTeams > _PartyModeInfos[index].MinTeams) else
_Texts[_TextNumTeams].Text = _PartyModeInfos[index].MinTeams + " - " + _PartyModeInfos[index].MaxTeams; _Texts[_TextNumTeams].Text = extInfo.MinTeams + " - " + extInfo.MaxTeams;
//NumPlayers //NumPlayers
if (_PartyModeInfos[index].MaxPlayers == _PartyModeInfos[index].MinPlayers) if (extInfo.MaxPlayers == extInfo.MinPlayers)
_Texts[_TextNumPlayers].Text = _PartyModeInfos[index].MaxTeams.ToString(); _Texts[_TextNumPlayers].Text = extInfo.MaxTeams.ToString();
else if (_PartyModeInfos[index].MaxPlayers > _PartyModeInfos[index].MinPlayers) else
_Texts[_TextNumPlayers].Text = _PartyModeInfos[index].MinPlayers + " - " + _PartyModeInfos[index].MaxPlayers; _Texts[_TextNumPlayers].Text = extInfo.MinPlayers + " - " + extInfo.MaxPlayers;
//Author //Author
_Texts[_TextAuthor].Text = _PartyModeInfos[index].Author; _Texts[_TextAuthor].Text = infos.Author;
_Texts[_TextAuthor].TranslationID = _PartyModeInfos[index].PartyModeID; _Texts[_TextAuthor].TranslationID = extInfo.ID;
//Version //Version
_Texts[_TextVersion].Text = _PartyModeInfos[index].VersionMajor + "." + _PartyModeInfos[index].VersionMinor; _Texts[_TextVersion].Text = infos.VersionMajor + "." + infos.VersionMinor;
_Texts[_TextVersion].TranslationID = _PartyModeInfos[index].PartyModeID; _Texts[_TextVersion].TranslationID = extInfo.ID;
if (CConfig.GetMaxNumMics() == 0) if (CConfig.GetMaxNumMics() < extInfo.MinMics)
{ {
_Buttons[_ButtonStart].Visible = false; _Buttons[_ButtonStart].Visible = false;
_Texts[_TextError].Text = "TR_SCREENPARTY_ERROR_MICS"; _Texts[_TextError].Text = CConfig.GetMaxNumMics() == 0
? "TR_SCREENPARTY_ERROR_MICS" : CLanguage.Translate("TR_SCREENPARTY_ERROR_MIC_NUM").Replace("%d", extInfo.MinMics.ToString());
_Texts[_TextError].Visible = true; _Texts[_TextError].Visible = true;
} }
else else
@@ -193,7 +200,7 @@ namespace Vocaluxe.Screens
return; return;
} }
CParty.SetPartyMode(_PartyModeInfos[index].PartyModeID); CParty.SetPartyMode(_PartyModeInfos[index].ExtInfo.ID);
CGraphics.FadeTo(CParty.GetStartScreen()); CGraphics.FadeTo(CParty.GetStartScreen());
} }
} }
+34 -47
View File
@@ -109,7 +109,7 @@ namespace Vocaluxe.Screens
break; break;
case EEditMode.PlayerName: case EEditMode.PlayerName:
_SelectSlides[_SelectSlideProfiles].RenameValue( _SelectSlides[_SelectSlideProfiles].RenameValue(
CProfiles.AddGetPlayerName(_SelectSlides[_SelectSlideProfiles].ValueIndex, keyEvent.Unicode)); CProfiles.AddGetPlayerName(_SelectSlides[_SelectSlideProfiles].SelectedTag, keyEvent.Unicode));
_ProfilesChanged = true; _ProfilesChanged = true;
break; break;
} }
@@ -155,7 +155,7 @@ namespace Vocaluxe.Screens
if (_EditMode == EEditMode.PlayerName) if (_EditMode == EEditMode.PlayerName)
{ {
_SelectSlides[_SelectSlideProfiles].RenameValue( _SelectSlides[_SelectSlideProfiles].RenameValue(
CProfiles.GetDeleteCharInPlayerName(_SelectSlides[_SelectSlideProfiles].ValueIndex)); CProfiles.GetDeleteCharInPlayerName(_SelectSlides[_SelectSlideProfiles].SelectedTag));
_ProfilesChanged = true; _ProfilesChanged = true;
} }
else else
@@ -168,22 +168,22 @@ namespace Vocaluxe.Screens
} }
if (_SelectSlides[_SelectSlideDifficulty].Selected) if (_SelectSlides[_SelectSlideDifficulty].Selected)
{ {
CProfiles.SetDifficulty(_SelectSlides[_SelectSlideProfiles].ValueIndex, CProfiles.SetDifficulty(_SelectSlides[_SelectSlideProfiles].SelectedTag,
(EGameDifficulty)_SelectSlides[_SelectSlideDifficulty].Selection); (EGameDifficulty)_SelectSlides[_SelectSlideDifficulty].Selection);
} }
else if (_SelectSlides[_SelectSlideAvatars].Selected) else if (_SelectSlides[_SelectSlideAvatars].Selected)
{ {
CProfiles.SetAvatar(_SelectSlides[_SelectSlideProfiles].ValueIndex, CProfiles.SetAvatar(_SelectSlides[_SelectSlideProfiles].SelectedTag,
_SelectSlides[_SelectSlideAvatars].ValueIndex); _SelectSlides[_SelectSlideAvatars].SelectedTag);
} }
else if (_SelectSlides[_SelectSlideUserRole].Selected) else if (_SelectSlides[_SelectSlideUserRole].Selected)
{ {
CProfiles.SetUserRoleProfile(_SelectSlides[_SelectSlideProfiles].ValueIndex, CProfiles.SetUserRoleProfile(_SelectSlides[_SelectSlideProfiles].SelectedTag,
(EUserRole)_SelectSlides[_SelectSlideUserRole].Selection); (EUserRole)_SelectSlides[_SelectSlideUserRole].Selection);
} }
else if (_SelectSlides[_SelectSlideActive].Selected) else if (_SelectSlides[_SelectSlideActive].Selected)
{ {
CProfiles.SetActive(_SelectSlides[_SelectSlideProfiles].ValueIndex, CProfiles.SetActive(_SelectSlides[_SelectSlideProfiles].SelectedTag,
(EOffOn)_SelectSlides[_SelectSlideActive].Selection); (EOffOn)_SelectSlides[_SelectSlideActive].Selection);
} }
} }
@@ -215,24 +215,24 @@ namespace Vocaluxe.Screens
} }
else if (_SelectSlides[_SelectSlideDifficulty].Selected) else if (_SelectSlides[_SelectSlideDifficulty].Selected)
{ {
CProfiles.SetDifficulty(_SelectSlides[_SelectSlideProfiles].ValueIndex, CProfiles.SetDifficulty(_SelectSlides[_SelectSlideProfiles].SelectedTag,
(EGameDifficulty)_SelectSlides[_SelectSlideDifficulty].Selection); (EGameDifficulty)_SelectSlides[_SelectSlideDifficulty].Selection);
} }
else if (_SelectSlides[_SelectSlideAvatars].Selected) else if (_SelectSlides[_SelectSlideAvatars].Selected)
{ {
CProfiles.SetAvatar(_SelectSlides[_SelectSlideProfiles].ValueIndex, CProfiles.SetAvatar(_SelectSlides[_SelectSlideProfiles].SelectedTag,
_SelectSlides[_SelectSlideAvatars].ValueIndex); _SelectSlides[_SelectSlideAvatars].SelectedTag);
if (CWebcam.IsDeviceAvailable() && _WebcamTexture != null) if (CWebcam.IsDeviceAvailable() && _WebcamTexture != null)
_OnDiscardSnapshot(); _OnDiscardSnapshot();
} }
else if (_SelectSlides[_SelectSlideUserRole].Selected) else if (_SelectSlides[_SelectSlideUserRole].Selected)
{ {
CProfiles.SetUserRoleProfile(_SelectSlides[_SelectSlideProfiles].ValueIndex, CProfiles.SetUserRoleProfile(_SelectSlides[_SelectSlideProfiles].SelectedTag,
(EUserRole)_SelectSlides[_SelectSlideUserRole].Selection); (EUserRole)_SelectSlides[_SelectSlideUserRole].Selection);
} }
else if (_SelectSlides[_SelectSlideActive].Selected) else if (_SelectSlides[_SelectSlideActive].Selected)
{ {
CProfiles.SetActive(_SelectSlides[_SelectSlideProfiles].ValueIndex, CProfiles.SetActive(_SelectSlides[_SelectSlideProfiles].SelectedTag,
(EOffOn)_SelectSlides[_SelectSlideActive].Selection); (EOffOn)_SelectSlides[_SelectSlideActive].Selection);
} }
else if (_Buttons[_ButtonWebcam].Selected) else if (_Buttons[_ButtonWebcam].Selected)
@@ -260,16 +260,16 @@ namespace Vocaluxe.Screens
if (_SelectSlides[_SelectSlideProfiles].Selection > -1) if (_SelectSlides[_SelectSlideProfiles].Selection > -1)
{ {
_Buttons[_ButtonPlayerName].Text.Text = CProfiles.GetPlayerName(_SelectSlides[_SelectSlideProfiles].ValueIndex); _Buttons[_ButtonPlayerName].Text.Text = CProfiles.GetPlayerName(_SelectSlides[_SelectSlideProfiles].SelectedTag);
if (_EditMode == EEditMode.PlayerName) if (_EditMode == EEditMode.PlayerName)
_Buttons[_ButtonPlayerName].Text.Text += "|"; _Buttons[_ButtonPlayerName].Text.Text += "|";
_SelectSlides[_SelectSlideDifficulty].Selection = (int)CProfiles.GetDifficulty(_SelectSlides[_SelectSlideProfiles].ValueIndex); _SelectSlides[_SelectSlideDifficulty].Selection = (int)CProfiles.GetDifficulty(_SelectSlides[_SelectSlideProfiles].SelectedTag);
_SelectSlides[_SelectSlideUserRole].Selection = (int)CProfiles.GetUserRoleProfile(_SelectSlides[_SelectSlideProfiles].ValueIndex); _SelectSlides[_SelectSlideUserRole].Selection = (int)CProfiles.GetUserRoleProfile(_SelectSlides[_SelectSlideProfiles].SelectedTag);
_SelectSlides[_SelectSlideActive].Selection = (int)CProfiles.GetActive(_SelectSlides[_SelectSlideProfiles].ValueIndex); _SelectSlides[_SelectSlideActive].Selection = (int)CProfiles.GetActive(_SelectSlides[_SelectSlideProfiles].SelectedTag);
int avatarID = CProfiles.GetAvatarID(_SelectSlides[_SelectSlideProfiles].ValueIndex); int avatarID = CProfiles.GetAvatarID(_SelectSlides[_SelectSlideProfiles].SelectedTag);
_SelectSlides[_SelectSlideAvatars].SetSelectionByValueIndex(avatarID); _SelectSlides[_SelectSlideAvatars].SelectedTag = avatarID;
if (_Snapshot == null) if (_Snapshot == null)
{ {
if (CWebcam.IsCapturing()) if (CWebcam.IsCapturing())
@@ -357,7 +357,7 @@ namespace Vocaluxe.Screens
_Buttons[_ButtonWebcam].Visible = CWebcam.IsDeviceAvailable(); _Buttons[_ButtonWebcam].Visible = CWebcam.IsDeviceAvailable();
int id = CProfiles.NewAvatar(file); int id = CProfiles.NewAvatar(file);
CProfiles.SetAvatar(_SelectSlides[_SelectSlideProfiles].ValueIndex, id); CProfiles.SetAvatar(_SelectSlides[_SelectSlideProfiles].SelectedTag, id);
_LoadAvatars(false); _LoadAvatars(false);
} }
@@ -381,10 +381,9 @@ namespace Vocaluxe.Screens
_EditMode = EEditMode.None; _EditMode = EEditMode.None;
int id = CProfiles.NewProfile(); int id = CProfiles.NewProfile();
_LoadProfiles(false); _LoadProfiles(false);
_SelectSlides[_SelectSlideProfiles].SetSelectionByValueIndex(id); _SelectSlides[_SelectSlideProfiles].SelectedTag = id;
CProfiles.SetAvatar(_SelectSlides[_SelectSlideProfiles].ValueIndex, CProfiles.SetAvatar(_SelectSlides[_SelectSlideProfiles].SelectedTag, _SelectSlides[_SelectSlideAvatars].SelectedTag);
_SelectSlides[_SelectSlideAvatars].ValueIndex);
_SelectElement(_Buttons[_ButtonPlayerName]); _SelectElement(_Buttons[_ButtonPlayerName]);
_EditMode = EEditMode.PlayerName; _EditMode = EEditMode.PlayerName;
@@ -400,7 +399,7 @@ namespace Vocaluxe.Screens
{ {
_EditMode = EEditMode.None; _EditMode = EEditMode.None;
CProfiles.DeleteProfile(_SelectSlides[_SelectSlideProfiles].ValueIndex); CProfiles.DeleteProfile(_SelectSlides[_SelectSlideProfiles].SelectedTag);
int selection = _SelectSlides[_SelectSlideProfiles].Selection; int selection = _SelectSlides[_SelectSlideProfiles].Selection;
if (_SelectSlides[_SelectSlideProfiles].NumValues - 1 > selection) if (_SelectSlides[_SelectSlideProfiles].NumValues - 1 > selection)
@@ -413,29 +412,23 @@ namespace Vocaluxe.Screens
{ {
string name = String.Empty; string name = String.Empty;
if (_EditMode == EEditMode.PlayerName) if (_EditMode == EEditMode.PlayerName)
name = CProfiles.GetPlayerName(_SelectSlides[_SelectSlideProfiles].ValueIndex); name = CProfiles.GetPlayerName(_SelectSlides[_SelectSlideProfiles].SelectedTag);
int selectedProfileID = _SelectSlides[_SelectSlideProfiles].ValueIndex; int selectedProfileID = _SelectSlides[_SelectSlideProfiles].SelectedTag;
_SelectSlides[_SelectSlideProfiles].Clear(); _SelectSlides[_SelectSlideProfiles].Clear();
CProfile[] profiles = CProfiles.GetProfiles(); CProfile[] profiles = CProfiles.GetProfiles();
foreach (CProfile profile in profiles) foreach (CProfile profile in profiles)
{ _SelectSlides[_SelectSlideProfiles].AddValue(profile.PlayerName, null, profile.ID);
_SelectSlides[_SelectSlideProfiles].AddValue(
profile.PlayerName,
null,
profile.ID,
-1);
}
if (CProfiles.NumProfiles > 0 && CProfiles.NumAvatars > 0) if (CProfiles.NumProfiles > 0 && CProfiles.NumAvatars > 0)
{ {
if (selectedProfileID != -1) if (selectedProfileID != -1)
_SelectSlides[_SelectSlideProfiles].SetSelectionByValueIndex(selectedProfileID); _SelectSlides[_SelectSlideProfiles].SelectedTag = selectedProfileID;
else else
{ {
_SelectSlides[_SelectSlideProfiles].Selection = 0; _SelectSlides[_SelectSlideProfiles].Selection = 0;
selectedProfileID = _SelectSlides[_SelectSlideProfiles].ValueIndex; selectedProfileID = _SelectSlides[_SelectSlideProfiles].SelectedTag;
} }
if (!keep) if (!keep)
@@ -443,39 +436,33 @@ namespace Vocaluxe.Screens
_SelectSlides[_SelectSlideDifficulty].Selection = (int)CProfiles.GetDifficulty(selectedProfileID); _SelectSlides[_SelectSlideDifficulty].Selection = (int)CProfiles.GetDifficulty(selectedProfileID);
_SelectSlides[_SelectSlideUserRole].Selection = (int)CProfiles.GetUserRoleProfile(selectedProfileID); _SelectSlides[_SelectSlideUserRole].Selection = (int)CProfiles.GetUserRoleProfile(selectedProfileID);
_SelectSlides[_SelectSlideActive].Selection = (int)CProfiles.GetActive(selectedProfileID); _SelectSlides[_SelectSlideActive].Selection = (int)CProfiles.GetActive(selectedProfileID);
_SelectSlides[_SelectSlideAvatars].SetSelectionByValueIndex(CProfiles.GetAvatarID(selectedProfileID)); _SelectSlides[_SelectSlideAvatars].SelectedTag = CProfiles.GetAvatarID(selectedProfileID);
} }
if (_EditMode == EEditMode.PlayerName) if (_EditMode == EEditMode.PlayerName)
CProfiles.SetPlayerName(_SelectSlides[_SelectSlideProfiles].ValueIndex, name); CProfiles.SetPlayerName(_SelectSlides[_SelectSlideProfiles].SelectedTag, name);
} }
_ProfilesChanged = false; _ProfilesChanged = false;
} }
private void _LoadAvatars(bool keep) private void _LoadAvatars(bool keep)
{ {
int selectedAvatarID = _SelectSlides[_SelectSlideAvatars].ValueIndex; int selectedAvatarID = _SelectSlides[_SelectSlideAvatars].SelectedTag;
_SelectSlides[_SelectSlideAvatars].Clear(); _SelectSlides[_SelectSlideAvatars].Clear();
IEnumerable<CAvatar> avatars = CProfiles.GetAvatars(); IEnumerable<CAvatar> avatars = CProfiles.GetAvatars();
if (avatars != null) if (avatars != null)
{ {
foreach (CAvatar avatar in avatars) foreach (CAvatar avatar in avatars)
{ _SelectSlides[_SelectSlideAvatars].AddValue(avatar.GetDisplayName(), null, avatar.ID);
_SelectSlides[_SelectSlideAvatars].AddValue(
avatar.GetDisplayName(),
null,
avatar.ID,
-1);
}
} }
if (keep) if (keep)
{ {
_SelectSlides[_SelectSlideAvatars].SetSelectionByValueIndex(selectedAvatarID); _SelectSlides[_SelectSlideAvatars].SelectedTag = selectedAvatarID;
CProfiles.SetAvatar(_SelectSlides[_SelectSlideProfiles].ValueIndex, selectedAvatarID); CProfiles.SetAvatar(_SelectSlides[_SelectSlideProfiles].SelectedTag, selectedAvatarID);
} }
else else
_SelectSlides[_SelectSlideAvatars].SetSelectionByValueIndex(CProfiles.GetAvatarID(_SelectSlides[_SelectSlideProfiles].ValueIndex)); _SelectSlides[_SelectSlideAvatars].SelectedTag = CProfiles.GetAvatarID(_SelectSlides[_SelectSlideProfiles].SelectedTag);
_AvatarsChanged = false; _AvatarsChanged = false;
} }
+8 -13
View File
@@ -124,8 +124,6 @@ namespace Vocaluxe.Screens
public override void OnShow() public override void OnShow()
{ {
CBackgroundMusic.Disabled = false;
base.OnShow(); base.OnShow();
//-1 --> Show average //-1 --> Show average
_Round = CGame.NumRounds > 1 ? -1 : 0; _Round = CGame.NumRounds > 1 ? -1 : 0;
@@ -187,26 +185,23 @@ namespace Vocaluxe.Screens
private static string _GetRating(double points) private static string _GetRating(double points)
{ {
string rating = String.Empty; string rating;
if (points >= 9800) if (points >= 9800)
{
//in case of the game names so:
rating = "TR_RATING_VOCAL_HERO"; rating = "TR_RATING_VOCAL_HERO";
} else if (points >= 8400)
else if (points < 9800 && points >= 8400)
rating = "TR_RATING_SUPERSTAR"; rating = "TR_RATING_SUPERSTAR";
else if (points < 8400 && points >= 7000) else if (points >= 7000)
rating = "TR_RATING_LEAD_SINGER"; rating = "TR_RATING_LEAD_SINGER";
else if (points < 7000 && points >= 5600) else if (points >= 5600)
rating = "TR_RATING_RISING_STAR"; rating = "TR_RATING_RISING_STAR";
else if (points < 5600 && points >= 4200) else if (points >= 4200)
rating = "TR_RATING_HOPEFUL"; rating = "TR_RATING_HOPEFUL";
else if (points < 4200 && points >= 2800) else if (points >= 2800)
rating = "TR_RATING_WANNABE"; rating = "TR_RATING_WANNABE";
else if (points < 2800 && points >= 1400) else if (points >= 1400)
rating = "TR_RATING_AMATEUR"; rating = "TR_RATING_AMATEUR";
else if (points < 1400) else
rating = "TR_RATING_TONE_DEAF"; rating = "TR_RATING_TONE_DEAF";
return rating; return rating;
+2 -4
View File
@@ -96,8 +96,7 @@ namespace Vocaluxe.Screens
private int _CurrentBeat; private int _CurrentBeat;
private int _CurrentStream = -1; private int _CurrentStream = -1;
private float _Length = -1f; private float _Length = -1f;
//private int _NextStream = -1;
private const int _Volume = 100;
private CVideoStream _CurrentVideo; private CVideoStream _CurrentVideo;
private EAspect _VideoAspect = EAspect.Crop; private EAspect _VideoAspect = EAspect.Crop;
private CTextureRef _CurrentWebcamFrameTexture; private CTextureRef _CurrentWebcamFrameTexture;
@@ -414,7 +413,6 @@ namespace Vocaluxe.Screens
public override void OnShowFinish() public override void OnShowFinish()
{ {
base.OnShowFinish(); base.OnShowFinish();
CBackgroundMusic.Disabled = true;
CGame.Start(); CGame.Start();
_LoadNextSong(); _LoadNextSong();
@@ -528,7 +526,7 @@ namespace Vocaluxe.Screens
_Texts[_TextSongName].Text = songname; _Texts[_TextSongName].Text = songname;
_CurrentStream = CSound.Load(song.GetMP3(), false, true); _CurrentStream = CSound.Load(song.GetMP3(), false, true);
CSound.SetStreamVolume(_CurrentStream, _Volume); CSound.SetStreamVolume(_CurrentStream, 100);
CSound.SetPosition(_CurrentStream, song.Start); CSound.SetPosition(_CurrentStream, song.Start);
_CurrentTime = song.Start; _CurrentTime = song.Start;
_FinishTime = song.Finish; _FinishTime = song.Finish;
+39 -43
View File
@@ -80,7 +80,6 @@ namespace Vocaluxe.Screens
private readonly List<string> _ButtonsJoker = new List<string>(); private readonly List<string> _ButtonsJoker = new List<string>();
private readonly List<string> _TextsPlayer = new List<string>(); private readonly List<string> _TextsPlayer = new List<string>();
private ESongOptionsView _CurSongOptionsView; private ESongOptionsView _CurSongOptionsView;
private bool _PlaylistActive;
private readonly List<EGameMode> _AvailableGameModes; private readonly List<EGameMode> _AvailableGameModes;
private SScreenSongOptions _Sso; private SScreenSongOptions _Sso;
@@ -163,15 +162,25 @@ namespace Vocaluxe.Screens
public override bool HandleInput(SKeyEvent keyEvent) public override bool HandleInput(SKeyEvent keyEvent)
{ {
base.HandleInput(keyEvent); if (_Playlist.Visible)
{
keyEvent.Handled = _Playlist.HandleInput(keyEvent);
if (keyEvent.Handled) if (keyEvent.Handled)
return true; return true;
if (!keyEvent.KeyPressed && keyEvent.Key == Keys.Escape)
if (_PlaylistActive)
{ {
_Playlist.HandleInput(keyEvent); _ClosePlaylist();
keyEvent.Handled = true;
return true; return true;
} }
}
// Playlist selection is handled below not in base!
_Playlist.Selectable = false;
base.HandleInput(keyEvent);
_Playlist.Selectable = true;
if (keyEvent.Handled)
return true;
if (_CurSongOptionsView == ESongOptionsView.None) if (_CurSongOptionsView == ESongOptionsView.None)
{ {
@@ -233,9 +242,8 @@ namespace Vocaluxe.Screens
case Keys.Tab: case Keys.Tab:
if (_Playlist.Visible) if (_Playlist.Visible)
{ {
_PlaylistActive = !_PlaylistActive; _Playlist.Selected = !_Playlist.Selected;
_Playlist.Selected = _PlaylistActive; _SongMenu.Selected = !_Playlist.Selected;
_SongMenu.Selected = !_PlaylistActive;
} }
break; break;
@@ -392,27 +400,18 @@ namespace Vocaluxe.Screens
_OldMousePosX = mouseEvent.X; _OldMousePosX = mouseEvent.X;
_OldMousePosY = mouseEvent.Y; _OldMousePosY = mouseEvent.Y;
if (_Playlist.Visible && _Playlist.IsMouseOver(mouseEvent)) if (_Playlist.Visible && _Playlist.Selected)
{ {
_PlaylistActive = true; _SongMenu.Selected = false;
_Playlist.Selected = _PlaylistActive;
_SongMenu.Selected = !_PlaylistActive;
_ToggleSongOptions(ESongOptionsView.None); _ToggleSongOptions(ESongOptionsView.None);
}
else if (CHelper.IsInBounds(_SongMenu.Rect, mouseEvent))
{
_PlaylistActive = false;
_Playlist.Selected = _PlaylistActive;
_SongMenu.Selected = !_PlaylistActive;
}
if (_Playlist.Visible && _PlaylistActive)
{
if (_Playlist.HandleMouse(mouseEvent)) if (_Playlist.HandleMouse(mouseEvent))
return true; return true;
} }
else if (CHelper.IsInBounds(_SongMenu.Rect, mouseEvent))
{
_Playlist.Selected = false;
_SongMenu.Selected = true;
}
if (mouseEvent.RB) if (mouseEvent.RB)
{ {
@@ -522,12 +521,12 @@ namespace Vocaluxe.Screens
_HandleSelectButton(); _HandleSelectButton();
return true; return true;
} }
else if (_SelectSlides[_SelectSlideOptionsPlaylistOpen].ValueSelected) else if (_SelectSlides[_SelectSlideOptionsPlaylistOpen].IsValueSelected)
{ {
_OpenPlaylist(_SelectSlides[_SelectSlideOptionsPlaylistOpen].Selection); _OpenPlaylist(_SelectSlides[_SelectSlideOptionsPlaylistOpen].Selection);
return true; return true;
} }
else if (_SelectSlides[_SelectSlideOptionsPlaylistAdd].ValueSelected) else if (_SelectSlides[_SelectSlideOptionsPlaylistAdd].IsValueSelected)
{ {
_OpenPlaylist(_SelectSlides[_SelectSlideOptionsPlaylistAdd].Selection - 1); _OpenPlaylist(_SelectSlides[_SelectSlideOptionsPlaylistAdd].Selection - 1);
return true; return true;
@@ -629,12 +628,13 @@ namespace Vocaluxe.Screens
_SongMenu.OnShow(); _SongMenu.OnShow();
if (_Sso.Selection.PartyMode) if (_Sso.Selection.PartyMode)
_PlaylistActive = false; {
_ClosePlaylist();
if (_Sso.Selection.PartyMode)
_ToggleSongOptions(ESongOptionsView.None); _ToggleSongOptions(ESongOptionsView.None);
_SelectElement(_Buttons[_ButtonStart]);
}
_SongMenu.Selected = !_PlaylistActive; _SongMenu.Selected = !_Playlist.Visible;
_SongMenu.SmallView = _Playlist.Visible; _SongMenu.SmallView = _Playlist.Visible;
if (_Playlist.ActivePlaylistID != -1) if (_Playlist.ActivePlaylistID != -1)
@@ -659,7 +659,7 @@ namespace Vocaluxe.Screens
public override bool UpdateGame() public override bool UpdateGame()
{ {
if (_PlaylistActive) if (_Playlist.Visible)
{ {
if (_Playlist.ActivePlaylistID == -1) if (_Playlist.ActivePlaylistID == -1)
_ClosePlaylist(); _ClosePlaylist();
@@ -1171,7 +1171,7 @@ namespace Vocaluxe.Screens
{ {
if (CSongs.VisibleSongs[_SongMenu.GetPreviewSongNr()].IsGameModeAvailable(gameMode)) if (CSongs.VisibleSongs[_SongMenu.GetPreviewSongNr()].IsGameModeAvailable(gameMode))
{ {
_SelectSlides[_SelectSlideOptionsMode].AddValue(Enum.GetName(typeof(EGameMode), gameMode)); _SelectSlides[_SelectSlideOptionsMode].AddValue(Enum.GetName(typeof(EGameMode), gameMode), null, (int)gameMode);
_AvailableGameModes.Add(gameMode); _AvailableGameModes.Add(gameMode);
} }
} }
@@ -1189,11 +1189,7 @@ namespace Vocaluxe.Screens
_CheckAndAddGameMode(EGameMode.TR_GAMEMODE_MEDLEY); _CheckAndAddGameMode(EGameMode.TR_GAMEMODE_MEDLEY);
//Set SelectSlide-Selection to last selected game-mode if possible //Set SelectSlide-Selection to last selected game-mode if possible
for (int i = 0; i < _AvailableGameModes.Count; i++) _SelectSlides[_SelectSlideOptionsMode].SelectedTag = (int)lastMode;
{
if (_AvailableGameModes[i] == lastMode)
_SelectSlides[_SelectSlideOptionsMode].SetSelectionByValueIndex(i);
}
_SelectSlides[_SelectSlideOptionsMode].Visible = true; _SelectSlides[_SelectSlideOptionsMode].Visible = true;
_SelectSlides[_SelectSlideOptionsPlaylistAdd].Visible = true; _SelectSlides[_SelectSlideOptionsPlaylistAdd].Visible = true;
_Buttons[_ButtonOptionsSing].Visible = true; _Buttons[_ButtonOptionsSing].Visible = true;
@@ -1242,9 +1238,9 @@ namespace Vocaluxe.Screens
_SelectSlides[_SelectSlideOptionsNumMedleySongs].AddValue(i.ToString()); _SelectSlides[_SelectSlideOptionsNumMedleySongs].AddValue(i.ToString());
} }
if (_SelectSlides[_SelectSlideOptionsNumMedleySongs].NumValues >= 5) if (_SelectSlides[_SelectSlideOptionsNumMedleySongs].NumValues >= 5)
_SelectSlides[_SelectSlideOptionsNumMedleySongs].SetSelectionByValueIndex(4); _SelectSlides[_SelectSlideOptionsNumMedleySongs].SelectedValue = "5";
else else
_SelectSlides[_SelectSlideOptionsNumMedleySongs].SetSelectionByValueIndex(_SelectSlides[_SelectSlideOptionsNumMedleySongs].NumValues - 1); _SelectSlides[_SelectSlideOptionsNumMedleySongs].SelectLastValue();
_SelectElement(_Buttons[_ButtonOptionsStartMedley]); _SelectElement(_Buttons[_ButtonOptionsStartMedley]);
} }
@@ -1260,12 +1256,12 @@ namespace Vocaluxe.Screens
private void _ClosePlaylist() private void _ClosePlaylist()
{ {
if (_Playlist.Visible || _PlaylistActive) if (_Playlist.Visible)
{ {
_SongMenu.SmallView = false; _SongMenu.SmallView = false;
_PlaylistActive = false; _Playlist.Visible = false;
_Playlist.Selected = _PlaylistActive; _Playlist.Selected = false;
_SongMenu.Selected = !_PlaylistActive; _SongMenu.Selected = false;
_Playlist.ClosePlaylist(); _Playlist.ClosePlaylist();
} }
} }
+3 -3
View File
@@ -80,7 +80,7 @@
"keyboardButtonShift": "Shift", "keyboardButtonShift": "Shift",
"keyboardButtonAlt": "Alt", "keyboardButtonAlt": "Alt",
"keyboardButtonCtrl": "Control", "keyboardButtonCtrl": "Control",
"keyboardButtonBackspace": "Backspace", "keyboardButtonBackspace": "Backsteg",
"keyboardAutoSend": "Auto send keys", "keyboardAutoSend": "Auto skicka knappar",
"keyboardButtonSend": "Send" "keyboardButtonSend": "Skicka"
} }
-1
View File
@@ -180,7 +180,6 @@ namespace VocaluxeLib
public enum EWebcamLib public enum EWebcamLib
{ {
OpenCV,
AForgeNet AForgeNet
} }
+12
View File
@@ -178,6 +178,18 @@ namespace VocaluxeLib
rect.Z); rect.Z);
} }
public static List<T> Shuffle<T>(this List<T> list)
{
for (int n = list.Count - 1; n >= 1; n--)
{
int k = CBase.Game.GetRandom(n);
T value = list[k];
list[k] = list[n];
list[n] = value;
}
return list;
}
public static Size GetSize(this Bitmap bmp) public static Size GetSize(this Bitmap bmp)
{ {
return new Size(bmp.Width, bmp.Height); return new Size(bmp.Width, bmp.Height);
+11 -10
View File
@@ -121,9 +121,9 @@ namespace VocaluxeLib
CTextureRef GetVideoTexture(); CTextureRef GetVideoTexture();
void LoadPreview(CSong song, float start = 0f); void LoadPreview(CSong song, float start = -1f);
void PlayPreview(float start = -1f);
void StopPreview(); void StopPreview();
void SetPlayingPreview(bool playPreview);
} }
public interface IDrawing public interface IDrawing
@@ -266,17 +266,18 @@ namespace VocaluxeLib
public interface ISound public interface ISound
{ {
int Load(string soundFile, bool loop = false, bool prescan = false); int Load(string soundFile, bool loop = false, bool prescan = false);
void SetPosition(int soundStream, float newPosition); void SetPosition(int streamID, float newPosition);
void Play(int soundStream); void Play(int streamID);
void Fade(int soundStream, int targetVolume, float duration, EStreamAction afterFadeAction = EStreamAction.Nothing); void Fade(int streamID, int targetVolume, float duration, EStreamAction afterFadeAction = EStreamAction.Nothing);
void Close(int soundStream); void Close(int streamID);
bool IsFinished(int soundStream); bool IsFinished(int streamID);
float GetPosition(int soundStream); float GetPosition(int streamID);
float GetLength(int soundStream); float GetLength(int streamID);
void SetStreamVolume(int soundStream, int volume); void SetStreamVolume(int streamID, int volume);
void SetGlobalVolume(int volume); void SetGlobalVolume(int volume);
bool IsPaused(int streamID);
} }
public interface ICover public interface ICover
+1 -5
View File
@@ -300,11 +300,6 @@ namespace VocaluxeLib.Menu
} }
} }
public void ProcessMouseMove(int x, int y)
{
Selected = CHelper.IsInBounds(Rect, x, y);
}
public void UnloadSkin() public void UnloadSkin()
{ {
if (!ThemeLoaded) if (!ThemeLoaded)
@@ -318,6 +313,7 @@ namespace VocaluxeLib.Menu
return; return;
Text = new CText(_Theme.Text, _PartyModeID); Text = new CText(_Theme.Text, _PartyModeID);
Text.LoadSkin(); Text.LoadSkin();
Text.Selected = Selected;
if (_Theme.SelText.HasValue) if (_Theme.SelText.HasValue)
{ {
+75 -120
View File
@@ -188,14 +188,12 @@ namespace VocaluxeLib.Menu
case ELyricStyle.Fill: case ELyricStyle.Fill:
_DrawFill(); _DrawFill();
break; break;
case ELyricStyle.Jump:
_DrawJump();
break;
case ELyricStyle.Slide: case ELyricStyle.Slide:
_DrawSlide(); _DrawSlide();
break; break;
case ELyricStyle.Zoom: case ELyricStyle.Zoom:
_DrawZoom(); case ELyricStyle.Jump:
_DrawZoomOrJump();
break; break;
default: default:
_DrawSlide(); _DrawSlide();
@@ -219,14 +217,15 @@ namespace VocaluxeLib.Menu
{ {
_Text.Color = _ColorProcessed; _Text.Color = _ColorProcessed;
int diff = note.EndBeat - note.StartBeat; int diff = note.Duration;
if (diff <= 0) if (diff <= 0)
_Text.Draw(0f, 1f); _Text.Draw(0f, 1f);
else else
{ {
_Text.Draw(0f, (_CurrentBeat - note.StartBeat) / diff); float p = (_CurrentBeat - note.StartBeat) / diff;
_Text.Draw(0f, p);
_Text.Color = _Color; _Text.Color = _Color;
_Text.Draw((_CurrentBeat - note.StartBeat) / diff, 1f); _Text.Draw(p, 1f);
} }
} }
else else
@@ -245,87 +244,6 @@ namespace VocaluxeLib.Menu
} }
} }
private void _DrawZoom()
{
float x = X - _Width / 2; // most left position
//find last active note
int lastNote = _Line.FindPreviousNote((int)_CurrentBeat);
int zoomNote = -1;
int endBeat = -1;
float zoomx = 0f;
for (int note = 0; note < _Line.Notes.Length; note++)
{
_Text.X = x;
_SetText(_Line.Notes[note]);
if (_CurrentBeat >= _Line.Notes[note].StartBeat)
{
int curEndBeat = _Line.Notes[note].EndBeat;
if (note < _Line.Notes.Length - 1)
curEndBeat = _Line.Notes[note + 1].StartBeat - 1;
if (_CurrentBeat <= curEndBeat)
{
zoomNote = note;
endBeat = curEndBeat;
zoomx = _Text.X;
}
else
{
// already passed
_Text.Color = note == lastNote ? _ColorProcessed : _Color;
_Text.Draw();
}
}
else
{
// not passed
_Text.Color = _Color;
_Text.Draw();
}
x += _Text.Rect.W;
}
if (zoomNote > -1)
{
_Text.X = zoomx;
_SetText(_Line.Notes[zoomNote]);
float diff = endBeat - _Line.Notes[zoomNote].StartBeat;
if (diff <= 0f)
diff = 1f;
float p = (_CurrentBeat - _Line.Notes[zoomNote].StartBeat) / diff;
if (p > 1f)
p = 1f;
p = 1f - p;
float ty = _Text.Y;
float th = _Text.Font.Height;
float tz = _Text.Z;
SRectF normalRect = _Text.Rect;
_Text.Font.Height *= 1f + p * 0.4f;
_Text.X -= (_Text.Rect.W - normalRect.W) / 2f;
_Text.Y -= (_Text.Rect.H - normalRect.H) / 2f;
_Text.Z -= 0.1f;
_Text.Color = _ColorProcessed;
_Text.Draw();
_Text.Y = ty;
_Text.Font.Height = th;
_Text.Z = tz;
}
}
private void _DrawFill() private void _DrawFill()
{ {
float x = X - _Width / 2; // most left position float x = X - _Width / 2; // most left position
@@ -351,37 +269,87 @@ namespace VocaluxeLib.Menu
} }
} }
private void _DrawJump() private void _DrawZoomedNote(CBaseNote zoomNote, int endBeat)
{
float diff = endBeat - zoomNote.StartBeat;
if (diff <= 0f)
diff = 1f;
float p = 1f - (_CurrentBeat - zoomNote.StartBeat) / diff;
if (p < 0)
p = 0;
float ty = _Text.Y;
float th = _Text.Font.Height;
float tz = _Text.Z;
SRectF normalRect = _Text.Rect;
_Text.Font.Height *= 1f + p * 0.4f;
_Text.X -= (_Text.Rect.W - normalRect.W) / 2f;
_Text.Y -= (_Text.Rect.H - normalRect.H) / 2f;
_Text.Z -= 0.1f;
_Text.Color = _ColorProcessed;
_Text.Draw();
_Text.Y = ty;
_Text.Font.Height = th;
_Text.Z = tz;
}
private void _DrawJumpingNode(CBaseNote jumpNote)
{
_Text.Color = _ColorProcessed;
int diff = jumpNote.Duration;
if (diff <= 0)
diff = 1;
float p = 1f - (_CurrentBeat - jumpNote.StartBeat) / diff;
if (p < 0.001)
_Text.Draw();
else
{
float y = _Text.Y;
_Text.Y -= _Text.Font.Height * 0.1f * p;
_Text.Draw();
_Text.Y = y;
}
}
private void _DrawZoomOrJump()
{ {
float x = X - _Width / 2; // most left position float x = X - _Width / 2; // most left position
//find last active note
int lastNote = _Line.FindPreviousNote((int)_CurrentBeat); int lastNote = _Line.FindPreviousNote((int)_CurrentBeat);
CSongNote highlightNote = null;
int jumpNote = -1; int hEndBeat = 0;
float jumpx = 0f; float hX = 0;
for (int note = 0; note < _Line.Notes.Length; note++) for (int note = 0; note < _Line.Notes.Length; note++)
{ {
_Text.X = x; _Text.X = x;
_SetText(_Line.Notes[note]); CSongNote curNote = _Line.Notes[note];
_SetText(curNote);
if (_CurrentBeat >= _Line.Notes[note].StartBeat) if (_CurrentBeat >= curNote.StartBeat)
{ {
int curEndBeat = _Line.Notes[note].EndBeat; int curEndBeat = curNote.EndBeat;
if (note < _Line.Notes.Length - 1) if (note < _Line.Notes.Length - 1)
curEndBeat = _Line.Notes[note + 1].StartBeat - 1; curEndBeat = _Line.Notes[note + 1].StartBeat - 1;
if (_CurrentBeat <= curEndBeat) if (_CurrentBeat <= curEndBeat)
{ {
jumpNote = note; highlightNote = curNote;
jumpx = _Text.X; hEndBeat = curEndBeat;
hX = x;
} }
else else
{ {
// already passed // already passed
_Text.Color = note == lastNote ? _ColorProcessed : _Color; _Text.Color = lastNote == note ? _ColorProcessed : _Color;
_Text.Draw(); _Text.Draw();
} }
} }
@@ -395,28 +363,15 @@ namespace VocaluxeLib.Menu
x += _Text.Rect.W; x += _Text.Rect.W;
} }
if (jumpNote < 0) // Draw the highlighted note after all others because we want it to be above those! (transparency won't work well otherwhise)
if (highlightNote == null)
return; return;
_SetText(highlightNote);
_Text.X = jumpx; _Text.X = hX;
_Text.Color = _ColorProcessed; if (LyricStyle == ELyricStyle.Jump)
_SetText(_Line.Notes[jumpNote]); _DrawJumpingNode(highlightNote);
int diff = _Line.Notes[jumpNote].EndBeat - _Line.Notes[jumpNote].StartBeat;
if (diff <= 0)
diff = 1;
float p = 1f - (_CurrentBeat - _Line.Notes[jumpNote].StartBeat) / diff;
if (Math.Abs(p) < float.Epsilon)
_Text.Draw();
else else
{ _DrawZoomedNote(highlightNote, hEndBeat);
float y = _Text.Y;
_Text.Y -= _Text.Font.Height * 0.1f * p;
_Text.Draw();
_Text.Y = y;
}
} }
#endregion draw #endregion draw
+28 -24
View File
@@ -137,6 +137,26 @@ namespace VocaluxeLib.Menu
} }
} }
private class CLoadThemeErrorHandler : CXmlDeserializer.CXmlDefaultErrorHandler
{
private static readonly string[] _AllowedMissing = new string[]
{
"Backgrounds", "Statics", "Texts", "Buttons", "SongMenus", "Lyrics", "SelectSlides", "SingNotes",
"NameSelections", "Equalizers", "Playlists", "ParticleEffects", "ScreenSettings"
};
public override void HandleError(CXmlException e)
{
CXmlMissingElementException missingEx = e as CXmlMissingElementException;
if (missingEx != null)
{
if (_AllowedMissing.Contains(missingEx.Field.Name))
return;
}
base.HandleError(e);
}
}
public virtual void LoadTheme(string xmlPath) public virtual void LoadTheme(string xmlPath)
{ {
if (CBase.Config.GetLoadOldThemeFiles()) if (CBase.Config.GetLoadOldThemeFiles())
@@ -149,26 +169,10 @@ namespace VocaluxeLib.Menu
string file = Path.Combine(xmlPath, ThemeName + ".xml"); string file = Path.Combine(xmlPath, ThemeName + ".xml");
Theme.Informations = new SScreenInformation();
Theme.Backgrounds = new List<SThemeBackground>();
Theme.Statics = new List<SThemeStatic>();
Theme.Texts = new List<SThemeText>();
Theme.Buttons = new List<SThemeButton>();
Theme.SongMenus = new List<SThemeSongMenu>();
Theme.Lyrics = new List<SThemeLyrics>();
Theme.SelectSlides = new List<SThemeSelectSlide>();
Theme.SingNotes = new List<SThemeSingBar>();
Theme.NameSelections = new List<SThemeNameSelection>();
Theme.Equalizers = new List<SThemeEqualizer>();
Theme.Playlists = new List<SThemePlaylist>();
Theme.ParticleEffects = new List<SThemeParticleEffect>();
Theme.ScreenSettings = new List<SThemeScreenSetting>();
try try
{ {
TextReader textReader = new StreamReader(file); CXmlDeserializer deserializer = new CXmlDeserializer(new CLoadThemeErrorHandler());
XmlSerializer deserializer = new XmlSerializer(typeof(SThemeScreen)); Theme = deserializer.Deserialize<SThemeScreen>(file);
Theme = (SThemeScreen)deserializer.Deserialize(textReader);
foreach (SThemeBackground bg in Theme.Backgrounds) foreach (SThemeBackground bg in Theme.Backgrounds)
_AddBackground(new CBackground(bg, PartyModeID), bg.Name); _AddBackground(new CBackground(bg, PartyModeID), bg.Name);
@@ -227,6 +231,10 @@ namespace VocaluxeLib.Menu
{ {
CBase.Log.LogError("Error while reading " + ThemeName + ".xml", true, true); CBase.Log.LogError("Error while reading " + ThemeName + ".xml", true, true);
} }
catch (CXmlException e)
{
CBase.Log.LogError("Error while reading " + ThemeName + ".xml: " + e, true, true);
}
catch (Exception e) catch (Exception e)
{ {
CBase.Log.LogError(e.Message + e.StackTrace, true, true); CBase.Log.LogError(e.Message + e.StackTrace, true, true);
@@ -308,12 +316,8 @@ namespace VocaluxeLib.Menu
try try
{ {
TextWriter textWriter = new StreamWriter(Path.Combine(ThemePath, ThemeName + ".xml")); CXmlSerializer serializer = new CXmlSerializer();
serializer.Serialize(Path.Combine(ThemePath, ThemeName + ".xml"), Theme);
XmlSerializer serializer = new XmlSerializer(typeof(SThemeScreen));
serializer.Serialize(textWriter, Theme);
textWriter.Close();
} }
catch (Exception e) catch (Exception e)
{ {
+24 -22
View File
@@ -29,8 +29,10 @@ namespace VocaluxeLib.Menu
get get
{ {
for (int team = 0; team < _NumTeams; team++) for (int team = 0; team < _NumTeams; team++)
{
if (_TeamList[team].Count < _NumPlayerTeams[team]) if (_TeamList[team].Count < _NumPlayerTeams[team])
return false; return false;
}
return true; return true;
} }
} }
@@ -147,7 +149,7 @@ namespace VocaluxeLib.Menu
{ {
if (!_ChangePlayerNumDynamic && _TeamList[_CurrentTeam].Count == _NumPlayerTeams[_CurrentTeam]) if (!_ChangePlayerNumDynamic && _TeamList[_CurrentTeam].Count == _NumPlayerTeams[_CurrentTeam])
resetSelection = true; resetSelection = true;
else if (_TeamList[_CurrentTeam].Count == _PartyMode.GetMaxPlayerPerTeam()) else if (_TeamList[_CurrentTeam].Count == _PartyMode.MaxPlayersPerTeam)
resetSelection = true; resetSelection = true;
} }
else if (!_SelectingFast) else if (!_SelectingFast)
@@ -344,13 +346,13 @@ namespace VocaluxeLib.Menu
if (numPressed > 0) if (numPressed > 0)
{ {
if (_ChangeTeamNumDynamic && numPressed < _PartyMode.GetMaxTeams() && numPressed > _SelectSlides[_SelectSlideTeams].NumValues) if (_ChangeTeamNumDynamic && numPressed < _PartyMode.MaxTeams && numPressed > _SelectSlides[_SelectSlideTeams].NumValues)
{ {
while (numPressed < _PartyMode.GetMaxTeams()) while (numPressed < _PartyMode.MaxTeams)
IncreaseTeamNum(); IncreaseTeamNum();
} }
if (numPressed <= _SelectSlides[_SelectSlideTeams].NumValues) if (numPressed <= _SelectSlides[_SelectSlideTeams].NumValues)
_SelectSlides[_SelectSlideTeams].SetSelectionByValueIndex(numPressed - 1); _SelectSlides[_SelectSlideTeams].SelectedTag = numPressed;
} }
} }
if (_SelectingFastPlayerNr > 0 && _SelectingFastPlayerNr <= _NumPlayerTeams[_CurrentTeam]) if (_SelectingFastPlayerNr > 0 && _SelectingFastPlayerNr <= _NumPlayerTeams[_CurrentTeam])
@@ -433,7 +435,7 @@ namespace VocaluxeLib.Menu
if (!_ChangePlayerNumDynamic && _TeamList[_CurrentTeam].Count == _NumPlayerTeams[_CurrentTeam]) if (!_ChangePlayerNumDynamic && _TeamList[_CurrentTeam].Count == _NumPlayerTeams[_CurrentTeam])
stopSelectingFast = true; stopSelectingFast = true;
else if (_TeamList[_CurrentTeam].Count == _PartyMode.GetMaxPlayerPerTeam()) else if (_TeamList[_CurrentTeam].Count == _PartyMode.MaxPlayersPerTeam)
stopSelectingFast = true; stopSelectingFast = true;
} }
else else
@@ -488,7 +490,7 @@ namespace VocaluxeLib.Menu
else if (mouseEvent.RB) else if (mouseEvent.RB)
{ {
bool exit = true; bool exit = true;
if (_SelectSlides[_SelectSlidePlayer].Selected && _TeamList[_CurrentTeam].Count > 0) if (_SelectSlides[_SelectSlidePlayer].Selected && _TeamList[_CurrentTeam].Count > _SelectSlides[_SelectSlidePlayer].Selection)
{ {
int currentSelection = _SelectSlides[_SelectSlidePlayer].Selection; int currentSelection = _SelectSlides[_SelectSlidePlayer].Selection;
int id = _TeamList[_CurrentTeam][currentSelection]; int id = _TeamList[_CurrentTeam][currentSelection];
@@ -505,7 +507,7 @@ namespace VocaluxeLib.Menu
{ {
if (!_ChangePlayerNumDynamic && _TeamList[_CurrentTeam].Count == _NumPlayerTeams[_CurrentTeam]) if (!_ChangePlayerNumDynamic && _TeamList[_CurrentTeam].Count == _NumPlayerTeams[_CurrentTeam])
stopSelectingFast = true; stopSelectingFast = true;
else if (_TeamList[_CurrentTeam].Count == _PartyMode.GetMaxPlayerPerTeam()) else if (_TeamList[_CurrentTeam].Count == _PartyMode.MaxPlayersPerTeam)
stopSelectingFast = true; stopSelectingFast = true;
} }
else if (mouseEvent.MB) else if (mouseEvent.MB)
@@ -539,8 +541,8 @@ namespace VocaluxeLib.Menu
public override void LoadTheme(string xmlPath) public override void LoadTheme(string xmlPath)
{ {
base.LoadTheme(xmlPath); base.LoadTheme(xmlPath);
_SelectSlides[_SelectSlidePlayer].WithTextures = true; _SelectSlides[_SelectSlidePlayer].DrawTextures = true;
_SelectSlides[_SelectSlidePlayer].SelectionByHover = true; _SelectSlides[_SelectSlidePlayer].SelectByHovering = true;
_AddStatic(_ChooseAvatarStatic); _AddStatic(_ChooseAvatarStatic);
} }
@@ -571,7 +573,7 @@ namespace VocaluxeLib.Menu
if (!_AllowChangeTeamNum) if (!_AllowChangeTeamNum)
return; return;
if (_NumTeams + 1 <= _PartyMode.GetMaxTeams()) if (_NumTeams + 1 <= _PartyMode.MaxTeams)
{ {
_NumTeams++; _NumTeams++;
int[] numPlayerTeams = _NumPlayerTeams; int[] numPlayerTeams = _NumPlayerTeams;
@@ -600,7 +602,7 @@ namespace VocaluxeLib.Menu
if (!_AllowChangeTeamNum) if (!_AllowChangeTeamNum)
return; return;
if (_NumTeams - 1 >= _PartyMode.GetMinTeams()) if (_NumTeams - 1 >= _PartyMode.MinTeams)
_NumTeams--; _NumTeams--;
_UpdateButtonState(); _UpdateButtonState();
} }
@@ -611,7 +613,7 @@ namespace VocaluxeLib.Menu
return; return;
if (_NumPlayerTeams.Length > team) if (_NumPlayerTeams.Length > team)
{ {
if (_NumPlayerTeams[team] + 1 <= _PartyMode.GetMaxPlayerPerTeam()) if (_NumPlayerTeams[team] + 1 <= _PartyMode.MaxPlayersPerTeam)
_NumPlayerTeams[team]++; _NumPlayerTeams[team]++;
_UpdatePlayerSlide(); _UpdatePlayerSlide();
} }
@@ -624,7 +626,7 @@ namespace VocaluxeLib.Menu
return; return;
if (_NumPlayerTeams.Length > team) if (_NumPlayerTeams.Length > team)
{ {
if (_NumPlayerTeams[team] - 1 >= _PartyMode.GetMinPlayerPerTeam()) if (_NumPlayerTeams[team] - 1 >= _PartyMode.MinPlayersPerTeam)
_NumPlayerTeams[team]--; _NumPlayerTeams[team]--;
if (_TeamList[team].Count > _NumPlayerTeams[team]) if (_TeamList[team].Count > _NumPlayerTeams[team])
_RemovePlayerByIndex(team, _NumPlayerTeams[team] - 1); _RemovePlayerByIndex(team, _NumPlayerTeams[team] - 1);
@@ -684,7 +686,7 @@ namespace VocaluxeLib.Menu
_SelectSlides[_SelectSlidePlayer].AddValue("", _NameSelections[_NameSelection].TextureEmptyTile); _SelectSlides[_SelectSlidePlayer].AddValue("", _NameSelections[_NameSelection].TextureEmptyTile);
if (selection >= _TeamList[_CurrentTeam].Count) if (selection >= _TeamList[_CurrentTeam].Count)
selection = _TeamList[_CurrentTeam].Count - 1; selection = _TeamList[_CurrentTeam].Count - 1;
_SelectSlides[_SelectSlidePlayer].SetSelectionByValueIndex(selection); _SelectSlides[_SelectSlidePlayer].Selection = selection;
} }
private void _UpdateTeamSlide() private void _UpdateTeamSlide()
@@ -692,25 +694,25 @@ namespace VocaluxeLib.Menu
_SelectSlides[_SelectSlideTeams].Visible = _Teams; _SelectSlides[_SelectSlideTeams].Visible = _Teams;
_SelectSlides[_SelectSlideTeams].Clear(); _SelectSlides[_SelectSlideTeams].Clear();
for (int i = 1; i <= _NumTeams; i++) for (int i = 1; i <= _NumTeams; i++)
_SelectSlides[_SelectSlideTeams].AddValue("Team " + i); _SelectSlides[_SelectSlideTeams].AddValue("Team " + i, null, i);
} }
private void _UpdateButtonVisibility() private void _UpdateButtonVisibility()
{ {
_Buttons[_ButtonIncreaseTeams].Visible = _AllowChangePlayerNum && _Teams && _PartyMode.GetMinTeams() != _PartyMode.GetMaxTeams(); _Buttons[_ButtonIncreaseTeams].Visible = _AllowChangePlayerNum && _Teams && _PartyMode.MinTeams != _PartyMode.MaxTeams;
_Buttons[_ButtonDecreaseTeams].Visible = _AllowChangePlayerNum && _Teams && _PartyMode.GetMinTeams() != _PartyMode.GetMaxTeams(); _Buttons[_ButtonDecreaseTeams].Visible = _AllowChangePlayerNum && _Teams && _PartyMode.MinTeams != _PartyMode.MaxTeams;
_Buttons[_ButtonIncreasePlayer].Visible = _AllowChangePlayerNum; _Buttons[_ButtonIncreasePlayer].Visible = _AllowChangePlayerNum;
_Buttons[_ButtonDecreasePlayer].Visible = _AllowChangePlayerNum; _Buttons[_ButtonDecreasePlayer].Visible = _AllowChangePlayerNum;
} }
private void _UpdateButtonState() private void _UpdateButtonState()
{ {
_Buttons[_ButtonIncreaseTeams].Selectable = _NumTeams < _PartyMode.GetMaxTeams(); _Buttons[_ButtonIncreaseTeams].Selectable = _NumTeams < _PartyMode.MaxTeams;
_Buttons[_ButtonDecreaseTeams].Selectable = _NumTeams > _PartyMode.GetMinTeams(); _Buttons[_ButtonDecreaseTeams].Selectable = _NumTeams > _PartyMode.MinTeams;
if (_NumPlayerTeams != null && _NumPlayerTeams.Length > _CurrentTeam) if (_NumPlayerTeams != null && _NumPlayerTeams.Length > _CurrentTeam)
{ {
_Buttons[_ButtonIncreasePlayer].Selectable = _NumPlayerTeams[_CurrentTeam] < _PartyMode.GetMaxPlayerPerTeam(); _Buttons[_ButtonIncreasePlayer].Selectable = _NumPlayerTeams[_CurrentTeam] < _PartyMode.MaxPlayersPerTeam;
_Buttons[_ButtonDecreasePlayer].Selectable = _NumPlayerTeams[_CurrentTeam] > _PartyMode.GetMinPlayerPerTeam(); _Buttons[_ButtonDecreasePlayer].Selectable = _NumPlayerTeams[_CurrentTeam] > _PartyMode.MinPlayersPerTeam;
} }
else else
{ {
@@ -723,7 +725,7 @@ namespace VocaluxeLib.Menu
{ {
if (_NumPlayerTeams[team] == _TeamList[team].Count && !_ChangePlayerNumDynamic) if (_NumPlayerTeams[team] == _TeamList[team].Count && !_ChangePlayerNumDynamic)
return; return;
if (_NumPlayerTeams[team] == _PartyMode.GetMaxPlayerPerTeam()) if (_NumPlayerTeams[team] == _PartyMode.MaxPlayersPerTeam)
return; return;
_NameSelections[_NameSelection].UseProfile(profileID); _NameSelections[_NameSelection].UseProfile(profileID);
+9
View File
@@ -91,6 +91,15 @@ namespace VocaluxeLib.Menu
private void _SetSelected(int newSelection) private void _SetSelected(int newSelection)
{ {
IMenuElement el = _GetElement(_Selection); IMenuElement el = _GetElement(_Selection);
if (newSelection == _Selection)
{
// Don't change current selection
if (el == null)
_Selection = -1;
else if (!el.Selected)
el.Selected = true;
return;
}
if (el != null) if (el != null)
el.Selected = false; el.Selected = false;
_Selection = newSelection; _Selection = newSelection;
+20 -11
View File
@@ -169,15 +169,16 @@ namespace VocaluxeLib.Menu
private readonly CStatic _StaticPlaylistHeader; private readonly CStatic _StaticPlaylistHeader;
private readonly CStatic _StaticPlaylistFooter; private readonly CStatic _StaticPlaylistFooter;
private bool _Selected;
public SRectF Rect public SRectF Rect
{ {
get { return MaxRect; } get { return MaxRect; }
} }
public SRectF MaxRect { get; set; } public SRectF MaxRect { get; set; }
private bool _Selectable = true;
public bool Selectable public bool Selectable
{ {
get { return Visible; } get { return Visible && _Selectable; }
set { _Selectable = value; }
} }
public bool Visible public bool Visible
{ {
@@ -185,6 +186,7 @@ namespace VocaluxeLib.Menu
set { _Active = value; } set { _Active = value; }
} }
public bool Highlighted { get; set; } public bool Highlighted { get; set; }
private bool _Selected;
public bool Selected public bool Selected
{ {
get { return _Selected; } get { return _Selected; }
@@ -204,6 +206,8 @@ namespace VocaluxeLib.Menu
_ChangeOrderElement = null; _ChangeOrderElement = null;
_EditMode = EEditMode.None; _EditMode = EEditMode.None;
} }
else if (_CurrentPlaylistElement == -1 && _PlaylistElements.Count > 0)
_SelectElement(_PlaylistElements[0].SelectSlide);
} }
} }
@@ -420,7 +424,7 @@ namespace VocaluxeLib.Menu
public override bool HandleInput(SKeyEvent keyEvent) public override bool HandleInput(SKeyEvent keyEvent)
{ {
if (!Selected) if (!Selected)
return true; return false;
//Active EditMode ignores other input! //Active EditMode ignores other input!
if (_EditMode == EEditMode.PlaylistName) if (_EditMode == EEditMode.PlaylistName)
{ {
@@ -446,6 +450,8 @@ namespace VocaluxeLib.Menu
if (!String.IsNullOrEmpty(_ButtonPlaylistName.Text.Text)) if (!String.IsNullOrEmpty(_ButtonPlaylistName.Text.Text))
_ButtonPlaylistName.Text.Text = _ButtonPlaylistName.Text.Text.Remove(_ButtonPlaylistName.Text.Text.Length - 1); _ButtonPlaylistName.Text.Text = _ButtonPlaylistName.Text.Text.Remove(_ButtonPlaylistName.Text.Text.Length - 1);
break; break;
default:
return false;
} }
} }
return true; return true;
@@ -453,10 +459,10 @@ namespace VocaluxeLib.Menu
if (_CurrentPlaylistElement == -1 || _PlaylistElementContents.Count == 0) if (_CurrentPlaylistElement == -1 || _PlaylistElementContents.Count == 0)
{ {
//no song is selected //no song is selected
base.HandleInput(keyEvent); bool handled = base.HandleInput(keyEvent);
_CurrentPlaylistElement = _GetSelectedElementNr(); _CurrentPlaylistElement = _GetSelectedElementNr();
if (_CurrentPlaylistElement != -1) if (_CurrentPlaylistElement != -1 || handled)
return true; return true;
} }
else if (_CurrentPlaylistElement != -1) else if (_CurrentPlaylistElement != -1)
@@ -669,6 +675,8 @@ namespace VocaluxeLib.Menu
UpdatePlaylist(); UpdatePlaylist();
} }
break; break;
default:
return false;
} }
return true; return true;
} }
@@ -720,6 +728,8 @@ namespace VocaluxeLib.Menu
case Keys.PageUp: case Keys.PageUp:
_SetSelectionToFirstEntry(); _SetSelectionToFirstEntry();
break; break;
default:
return false;
} }
return true; return true;
} }
@@ -1037,6 +1047,7 @@ namespace VocaluxeLib.Menu
Cover = new CStatic(_Theme.StaticCover, _PartyModeID) Cover = new CStatic(_Theme.StaticCover, _PartyModeID)
}; };
en.Cover.LoadSkin();
en.Cover.Y += Rect.Y + (i * _Theme.EntryHeight); en.Cover.Y += Rect.Y + (i * _Theme.EntryHeight);
en.Cover.X += Rect.X; en.Cover.X += Rect.X;
@@ -1045,6 +1056,7 @@ namespace VocaluxeLib.Menu
en.Text1.Y += Rect.Y + (i * _Theme.EntryHeight); en.Text1.Y += Rect.Y + (i * _Theme.EntryHeight);
en.SelectSlide = new CSelectSlide(_SelectSlideGameMode); en.SelectSlide = new CSelectSlide(_SelectSlideGameMode);
en.SelectSlide.LoadSkin();
en.SelectSlide.X += Rect.X; en.SelectSlide.X += Rect.X;
en.SelectSlide.Y += Rect.Y + (i * _Theme.EntryHeight); en.SelectSlide.Y += Rect.Y + (i * _Theme.EntryHeight);
@@ -1145,12 +1157,9 @@ namespace VocaluxeLib.Menu
string t1 = CBase.Language.Translate(_Text1.Text).Replace("%a", song.Artist).Replace("%t", song.Title); string t1 = CBase.Language.Translate(_Text1.Text).Replace("%a", song.Artist).Replace("%t", song.Title);
_PlaylistElements[i].Text1.Text = /*(Offset + i + 1) + ") " + */ t1; //TODO: Add text field for the number _PlaylistElements[i].Text1.Text = /*(Offset + i + 1) + ") " + */ t1; //TODO: Add text field for the number
_PlaylistElements[i].SelectSlide.Clear(); _PlaylistElements[i].SelectSlide.Clear();
for (int g = 0; g < pec.Modes.Count; g++) foreach (EGameMode gm in pec.Modes)
{ _PlaylistElements[i].SelectSlide.AddValue(Enum.GetName(typeof(EGameMode), gm), null, (int)gm);
_PlaylistElements[i].SelectSlide.AddValue(Enum.GetName(typeof(EGameMode), pec.Modes[g])); _PlaylistElements[i].SelectSlide.SelectedTag = (int)pec.Mode;
if (pec.Modes[g] == pec.Mode)
_PlaylistElements[i].SelectSlide.SetSelectionByValueIndex(g);
}
} }
else else
{ {
+192 -186
View File
@@ -17,6 +17,8 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics;
using System.Drawing; using System.Drawing;
using System.Xml.Serialization; using System.Xml.Serialization;
using VocaluxeLib.Draw; using VocaluxeLib.Draw;
@@ -51,8 +53,8 @@ namespace VocaluxeLib.Menu
public SThemeColor TextSelColor; public SThemeColor TextSelColor;
public float TextH; public float TextH;
public float TextRelativeX; [DefaultValue(0.0f)] public float TextRelativeX;
public float TextRelativeY; [DefaultValue(0.0f)] public float TextRelativeY;
public float TextMaxW; public float TextMaxW;
public string TextFont; public string TextFont;
@@ -61,8 +63,23 @@ namespace VocaluxeLib.Menu
public int NumVisible; public int NumVisible;
} }
public sealed class CSelectSlide : CMenuElementBase, IMenuElement, ICloneable, IThemeable public sealed class CSelectSlide : CMenuElementBase, IMenuElement, IThemeable
{ {
private struct SValue
{
public string Text;
public int TranslationId;
public int Tag;
public CTextureRef Texture;
}
private class CElement
{
public CText Text;
public CStatic Img;
public SRectF Bounds;
}
private readonly int _PartyModeID; private readonly int _PartyModeID;
private SThemeSelectSlide _Theme; private SThemeSelectSlide _Theme;
@@ -138,52 +155,52 @@ namespace VocaluxeLib.Menu
} }
} }
} }
public bool ValueSelected public bool IsValueSelected
{ {
get { return Selected && !_ArrowLeftSelected && !_ArrowRightSelected; } get { return Selected && !_ArrowLeftSelected && !_ArrowRightSelected; }
} }
public bool SelectionByHover;
private bool _ArrowLeftSelected; private bool _ArrowLeftSelected;
private bool _ArrowRightSelected; private bool _ArrowRightSelected;
private readonly List<string> _ValueNames; public bool SelectByHovering;
private readonly List<int> _ValuePartyModeIDs; public bool DrawTextures;
private readonly List<CTextureRef> _Textures;
private readonly List<int> _ValueIndexes;
private readonly List<SRectF> _ValueBounds = new List<SRectF>();
public bool WithTextures;
private int _Selection = -1; private int _Selection = -1;
public int Selection public int Selection
{ {
get { return _Selection; } get { return _Selection; }
set { _Selection = value.Clamp(0, _ValueNames.Count - 1, false); } set
{
value = value.Clamp(0, _Values.Count - 1, false);
if (value == _Selection)
return;
_Selection = value;
_Invalidate();
}
} }
public string Value public string SelectedValue
{ {
get { return (_Selection >= 0 && _Selection < _ValueNames.Count) ? _ValueNames[_Selection] : null; } get { return _Selection >= 0 ? _Values[_Selection].Text : null; }
set { Selection = _Values.FindIndex(val => val.Text == value); }
} }
public int ValueIndex public int SelectedTag
{ {
get get { return _Selection >= 0 ? _Values[_Selection].Tag : -1; }
{ set { Selection = _Values.FindIndex(val => val.Tag == value); }
if (_Selection >= 0 && _ValueIndexes.Count > _Selection)
return _ValueIndexes[_Selection];
return -1;
}
} }
public int NumValues public int NumValues
{ {
get { return _ValueNames.Count; } get { return _Values.Count; }
} }
private readonly List<SValue> _Values = new List<SValue>();
private readonly List<CElement> _VisibleElements = new List<CElement>();
private bool _NeedsRevalidate = true;
private int _NumVisible = -1; private int _NumVisible = -1;
private CTextureRef _Texture; private CTextureRef _Texture;
private CTextureRef _TextureArrowLeft; private CTextureRef _TextureArrowLeft;
@@ -197,10 +214,11 @@ namespace VocaluxeLib.Menu
get { return _NumVisible; } get { return _NumVisible; }
set set
{ {
if (value > 0) if (value <= 0 || value == _NumVisible)
return;
_NumVisible = value; _NumVisible = value;
_ValueBounds.Clear(); _Invalidate();
} }
} }
@@ -210,11 +228,6 @@ namespace VocaluxeLib.Menu
ThemeLoaded = false; ThemeLoaded = false;
_TextH = 1f; _TextH = 1f;
_MaxW = 0f; _MaxW = 0f;
_Textures = new List<CTextureRef>();
_ValueIndexes = new List<int>();
_ValueNames = new List<string>();
_ValuePartyModeIDs = new List<int>();
} }
public CSelectSlide(CSelectSlide slide) public CSelectSlide(CSelectSlide slide)
@@ -241,15 +254,11 @@ namespace VocaluxeLib.Menu
_TextRelativeY = slide._TextRelativeY; _TextRelativeY = slide._TextRelativeY;
_MaxW = slide._MaxW; _MaxW = slide._MaxW;
_Textures = new List<CTextureRef>(slide._Textures); _Values.AddRange(slide._Values);
_ValueIndexes = new List<int>(slide._ValueIndexes);
_ValueNames = new List<string>(slide._ValueNames);
_ValueBounds = new List<SRectF>(slide._ValueBounds);
_ValuePartyModeIDs = new List<int>(slide._ValuePartyModeIDs);
_Selection = slide._Selection; _Selection = slide._Selection;
_NumVisible = slide._NumVisible; _NumVisible = slide._NumVisible;
WithTextures = slide.WithTextures; DrawTextures = slide.DrawTextures;
Visible = slide.Visible; Visible = slide.Visible;
} }
@@ -258,11 +267,6 @@ namespace VocaluxeLib.Menu
_PartyModeID = partyModeID; _PartyModeID = partyModeID;
_Theme = theme; _Theme = theme;
_Textures = new List<CTextureRef>();
_ValueIndexes = new List<int>();
_ValueNames = new List<string>();
_ValuePartyModeIDs = new List<int>();
ThemeLoaded = true; ThemeLoaded = true;
} }
@@ -382,58 +386,73 @@ namespace VocaluxeLib.Menu
return ThemeLoaded; return ThemeLoaded;
} }
public void AddValue(string value) private void _Invalidate()
{ {
AddValue(value, _PartyModeID); _NeedsRevalidate = true;
} }
public void AddValue(string value, int partyModeID) /// <summary>
/// Adds an integer to the slide setting its tag to the value and its text to the text representation of the tag
/// </summary>
/// <param name="tag">Value to add</param>
public void AddValue(int tag)
{ {
AddValue(value, null, _ValueIndexes.Count, partyModeID); AddValue(tag.ToString(), null, tag);
} }
public void AddValue(string value, CTextureRef texture) /// <summary>
/// Adds an entry to the slide.
/// </summary>
/// <param name="text">Label to show</param>
/// <param name="texture">Texture to show</param>
/// <param name="tag">User value (e.g. id of entry)</param>
public void AddValue(string text, CTextureRef texture = null, int tag = 0)
{ {
AddValue(value, texture, _ValueIndexes.Count, _PartyModeID); AddValue(text, _PartyModeID, texture, tag);
} }
private void _AddValue(string value, CTextureRef texture, int valueIndex) /// <summary>
/// Adds an entry to the slide.
/// </summary>
/// <param name="text">Label to show</param>
/// <param name="translationId">Translation id to use for the text</param>
/// <param name="texture">Texture to show</param>
/// <param name="tag">User value (e.g. id of entry)</param>
public void AddValue(string text, int translationId, CTextureRef texture = null, int tag = 0)
{ {
AddValue(value, texture, valueIndex, _PartyModeID); SValue value = new SValue {Text = text, TranslationId = translationId, Tag = tag, Texture = texture};
}
public void AddValue(string value, CTextureRef texture, int valueIndex, int partyModeID) _Values.Add(value);
{
_ValueNames.Add(value);
_Textures.Add(texture);
_ValueIndexes.Add(valueIndex);
_ValuePartyModeIDs.Add(partyModeID);
if (Selection == -1) if (Selection < 0)
Selection = 0; Selection = 0;
_ValueBounds.Clear(); _Invalidate();
} }
public void AddValues(IEnumerable<string> values) public void AddValues(IEnumerable<string> values)
{ {
foreach (string value in values) foreach (string value in values)
_AddValue(value, null, _PartyModeID); AddValue(value);
_ValueBounds.Clear();
} }
public void AddValues(string[] values, CTextureRef[] textures) public void AddValues(string[] values, CTextureRef[] textures)
{ {
if (values.Length != textures.Length) Debug.Assert(values.Length == textures.Length);
return;
for (int i = 0; i < values.Length; i++) for (int i = 0; i < values.Length; i++)
AddValue(values[i], textures[i]); AddValue(values[i], textures[i]);
if (Selection == -1) }
Selection = 0;
_ValueBounds.Clear(); public void RemoveValue(string text)
{
int idx = _Values.FindIndex(val => val.Text == text);
if (idx < 0)
return;
_Values.RemoveAt(idx);
if (Selection >= idx)
Selection--;
_Invalidate();
} }
public void SetValues<T>(int selection) public void SetValues<T>(int selection)
@@ -447,31 +466,20 @@ namespace VocaluxeLib.Menu
RenameValue(Selection, newName); RenameValue(Selection, newName);
} }
public void RenameValue(int selection, string newName, CTextureRef newTexture = null) public void RenameValue(int index, string newName, CTextureRef newTexture = null)
{ {
if (selection < 0 && selection >= _ValueNames.Count) if (index < 0 && index >= _Values.Count)
return; return;
_ValueNames[selection] = newName; SValue value = _Values[index];
_Textures[selection] = newTexture; value.Text = newName;
} value.Texture = newTexture;
_Values[index] = value;
public bool SetSelectionByValueIndex(int valueIndex)
{
for (int i = 0; i < _ValueIndexes.Count; i++)
{
if (_ValueIndexes[i] == valueIndex)
{
Selection = i;
return true;
}
}
return false;
} }
public bool SelectNextValue() public bool SelectNextValue()
{ {
if (Selection < _ValueNames.Count - 1) if (Selection < _Values.Count - 1)
{ {
Selection++; Selection++;
return true; return true;
@@ -491,50 +499,46 @@ namespace VocaluxeLib.Menu
public void SelectFirstValue() public void SelectFirstValue()
{ {
if (_ValueNames.Count > 0) if (_Values.Count > 0)
Selection = 0; Selection = 0;
} }
public void SelectLastValue() public void SelectLastValue()
{ {
if (_ValueNames.Count > 0) if (_Values.Count > 0)
Selection = _ValueNames.Count - 1; Selection = _Values.Count - 1;
} }
public void Clear() public void Clear()
{ {
_Values.Clear();
_Selection = -1; _Selection = -1;
_ValueNames.Clear(); _Invalidate();
_Textures.Clear(); }
_ValueBounds.Clear();
_ValueIndexes.Clear(); private int _GetCurOffset()
{
int offset = _Selection - _NumVisible / 2;
return offset.Clamp(0, _Values.Count - _NumVisible, true);
}
private void _SelectAtPos(int x, int y)
{
if (_NeedsRevalidate)
_Revalidate();
int index = _VisibleElements.FindIndex(el => CHelper.IsInBounds(el.Bounds, x, y));
if (index < 0)
return;
Selection = index + _GetCurOffset();
} }
public void ProcessMouseMove(int x, int y) public void ProcessMouseMove(int x, int y)
{ {
_ArrowLeftSelected = CHelper.IsInBounds(RectArrowLeft, x, y) && _Selection > 0; _ArrowLeftSelected = CHelper.IsInBounds(RectArrowLeft, x, y) && _Selection > 0;
_ArrowRightSelected = CHelper.IsInBounds(RectArrowRight, x, y) && _Selection < _ValueNames.Count - 1; _ArrowRightSelected = CHelper.IsInBounds(RectArrowRight, x, y) && _Selection < _Values.Count - 1;
if (SelectionByHover) if (SelectByHovering)
{ _SelectAtPos(x, y);
for (int i = 0; i < _ValueBounds.Count; i++)
{
if (CHelper.IsInBounds(_ValueBounds[i], x, y))
{
int offset = _Selection - _NumVisible / 2;
if (_ValueNames.Count - _NumVisible - offset < 0)
offset = _ValueNames.Count - _NumVisible;
if (offset < 0)
offset = 0;
Selection = i + offset;
_ValueBounds.Clear();
break;
}
}
}
} }
public void ProcessMouseLBClick(int x, int y) public void ProcessMouseLBClick(int x, int y)
@@ -547,21 +551,78 @@ namespace VocaluxeLib.Menu
if (_ArrowRightSelected) if (_ArrowRightSelected)
SelectNextValue(); SelectNextValue();
for (int i = 0; i < _ValueBounds.Count; i++) _SelectAtPos(x, y);
}
private void _Revalidate()
{ {
if (CHelper.IsInBounds(_ValueBounds[i], x, y)) if (!_NeedsRevalidate)
return;
_NeedsRevalidate = false;
int numvis = Math.Min(_NumVisible, _Values.Count);
if (numvis != _VisibleElements.Count)
{ {
int offset = _Selection - _NumVisible / 2; _VisibleElements.Clear();
for (int i = 0; i < numvis; i++)
{
var el = new CElement
{
Text = new CText(0, 0, 0, _TextH, _MaxW, EAlignment.Center, _Theme.TextStyle, _Theme.TextFont, _TextColor, "T", _PartyModeID),
Img = new CStatic(_PartyModeID)
};
_VisibleElements.Add(el);
}
}
if (numvis == 0)
return;
if (_ValueNames.Count - _NumVisible - offset < 0) float elWidth = (Rect.W - _TextRelativeX * 2) / numvis;
offset = _ValueNames.Count - _NumVisible; //Center point of the first entry
float xStart = Rect.X + _TextRelativeX + elWidth / 2f;
if (offset < 0) int offset = _GetCurOffset();
offset = 0;
Selection = i + offset; for (int i = 0; i < numvis; i++)
_ValueBounds.Clear(); {
break; CText text = _VisibleElements[i].Text;
RectangleF textBounds;
float curX = xStart + elWidth * i;
if (String.IsNullOrEmpty(_Values[i + offset].Text))
{
text.Visible = false;
textBounds = new RectangleF();
}
else
{
text.Visible = true;
text.Text = _Values[i + offset].Text;
text.TranslationID = _Values[i + offset].TranslationId;
text.Color = (i + offset == Selection) ? _SelTextColor : _TextColor;
textBounds = CBase.Fonts.GetTextBounds(text);
text.X = curX;
text.Z = Rect.Z;
}
CStatic img = _VisibleElements[i].Img;
if (!DrawTextures || _Values[i + offset].Texture == null)
{
if (text.Visible)
text.Y = Rect.Y + (Rect.H - textBounds.Height) / 2 - _TextRelativeY;
img.Visible = false;
_VisibleElements[i].Bounds = new SRectF(text.X - textBounds.Width / 2f, text.Y, textBounds.Width, textBounds.Height, Rect.Z);
}
else
{
text.Y = (int)(Rect.Y + Rect.H - textBounds.Height - _TextRelativeY);
img.Texture = _Values[i + offset].Texture;
float alpha = (i + offset == _Selection) ? 1f : 0.35f;
img.Color = new SColorF(1f, 1f, 1f, alpha);
float size = Rect.H - textBounds.Height - 2 * _TextRelativeY;
if (size > elWidth)
size = elWidth;
var imgRect = new SRectF(curX - size / 2, Rect.Y + _TextRelativeY, size, size, Rect.Z);
img.MaxRect = imgRect;
_VisibleElements[i].Bounds = imgRect;
} }
} }
} }
@@ -584,7 +645,7 @@ namespace VocaluxeLib.Menu
CBase.Drawing.DrawTexture(_TextureArrowLeft, RectArrowLeft, _ColorArrow); CBase.Drawing.DrawTexture(_TextureArrowLeft, RectArrowLeft, _ColorArrow);
} }
if (_Selection < _ValueNames.Count - 1 || CBase.Settings.GetProgramState() == EProgramState.EditTheme) if (_Selection < _Values.Count - 1 || CBase.Settings.GetProgramState() == EProgramState.EditTheme)
{ {
if (_ArrowRightSelected) if (_ArrowRightSelected)
CBase.Drawing.DrawTexture(_SelTextureArrowRight, RectArrowRight, _SelColorArrow); CBase.Drawing.DrawTexture(_SelTextureArrowRight, RectArrowRight, _SelColorArrow);
@@ -592,63 +653,12 @@ namespace VocaluxeLib.Menu
CBase.Drawing.DrawTexture(_TextureArrowRight, RectArrowRight, _ColorArrow); CBase.Drawing.DrawTexture(_TextureArrowRight, RectArrowRight, _ColorArrow);
} }
if (_NumVisible < 1 || _ValueNames.Count == 0) if (_NeedsRevalidate)
return; _Revalidate();
foreach (CElement element in _VisibleElements)
float x = Rect.X + (Rect.W - _TextRelativeX) * 0.1f;
float dx = (Rect.W - _TextRelativeX) * 0.8f / _NumVisible;
//float y = Rect.Y + (Rect.H - TextH);
int offset = _Selection - _NumVisible / 2;
if (_ValueNames.Count - _NumVisible - offset < 0)
offset = _ValueNames.Count - _NumVisible;
if (offset < 0)
offset = 0;
int numvis = _NumVisible;
if (_ValueNames.Count < numvis)
numvis = _ValueNames.Count;
_ValueBounds.Clear();
for (int i = 0; i < numvis; i++)
{ {
var text = new CText(0, 0, 0, _TextH, _MaxW, EAlignment.Center, _Theme.TextStyle, _Theme.TextFont, _TextColor, "T", element.Text.Draw();
_ValuePartyModeIDs[i + offset]); element.Img.Draw();
if (_ValueNames[i + offset] != "")
text.Text = _ValueNames[i + offset];
else
text.Visible = false;
var alpha = new SColorF(1f, 1f, 1f, 0.35f);
if (i + offset == _Selection)
{
text.Color = _SelTextColor;
alpha = new SColorF(1f, 1f, 1f, 1f);
}
RectangleF bounds = CBase.Fonts.GetTextBounds(text);
text.X = (x + dx / 2f + dx * i) + _TextRelativeX;
if (!WithTextures)
text.Y = (int)((Rect.Y + (Rect.H - bounds.Height) / 2) + _TextRelativeY);
else
text.Y = (int)((Rect.Y + (Rect.H - bounds.Height)) + _TextRelativeY);
text.Z = Rect.Z;
text.Draw();
if (WithTextures)
{
float dh = text.Y - Rect.Y - Rect.H * 0.1f;
var rect = new SRectF(text.X - dh / 2, Rect.Y + Rect.H * 0.05f, dh, dh, Rect.Z);
CBase.Drawing.DrawTexture(_Textures[i + offset], rect, alpha, rect);
_ValueBounds.Add(rect);
}
else
_ValueBounds.Add(new SRectF(text.X - bounds.Width / 2f, text.Y, bounds.Width, bounds.Height, Rect.Z));
} }
} }
@@ -686,6 +696,7 @@ namespace VocaluxeLib.Menu
_SelTexture = CBase.Themes.GetSkinTexture(_Theme.SkinSelected, _PartyModeID); _SelTexture = CBase.Themes.GetSkinTexture(_Theme.SkinSelected, _PartyModeID);
_SelTextureArrowLeft = CBase.Themes.GetSkinTexture(_Theme.SkinArrowLeftSelected, _PartyModeID); _SelTextureArrowLeft = CBase.Themes.GetSkinTexture(_Theme.SkinArrowLeftSelected, _PartyModeID);
_SelTextureArrowRight = CBase.Themes.GetSkinTexture(_Theme.SkinArrowRightSelected, _PartyModeID); _SelTextureArrowRight = CBase.Themes.GetSkinTexture(_Theme.SkinArrowRightSelected, _PartyModeID);
_Invalidate();
} }
public void ReloadSkin() public void ReloadSkin()
@@ -694,11 +705,6 @@ namespace VocaluxeLib.Menu
LoadSkin(); LoadSkin();
} }
public object Clone()
{
return MemberwiseClone();
}
#region ThemeEdit #region ThemeEdit
public void MoveElement(int stepX, int stepY) public void MoveElement(int stepX, int stepY)
{ {
+24
View File
@@ -17,6 +17,8 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Xml.Serialization; using System.Xml.Serialization;
using VocaluxeLib.Xml; using VocaluxeLib.Xml;
@@ -56,6 +58,12 @@ namespace VocaluxeLib.Menu.SingNotes
public readonly List<CNoteBars> PlayerNotes = new List<CNoteBars>(); public readonly List<CNoteBars> PlayerNotes = new List<CNoteBars>();
private SRectF _Rect;
public override SRectF Rect
{
get { return _Rect; }
}
public bool Selectable public bool Selectable
{ {
get { return false; } get { return false; }
@@ -143,6 +151,16 @@ namespace VocaluxeLib.Menu.SingNotes
PlayerNotes.Clear(); PlayerNotes.Clear();
for (int p = 0; p < numPlayers; p++) for (int p = 0; p < numPlayers; p++)
PlayerNotes.Add(new CNoteBars(_PartyModeID, p, _BarPos[p, numPlayers - 1], _Theme)); PlayerNotes.Add(new CNoteBars(_PartyModeID, p, _BarPos[p, numPlayers - 1], _Theme));
if (numPlayers == 0)
_Rect = new SRectF(0, 0, 0, 0, Rect.Z);
else
{
_Rect.X = PlayerNotes.Select(bp => bp.Rect.X).Min();
_Rect.Y = PlayerNotes.Select(bp => bp.Rect.X).Min();
_Rect.Right = PlayerNotes.Select(bp => bp.Rect.Right).Max();
_Rect.Bottom = PlayerNotes.Select(bp => bp.Rect.Bottom).Max();
_Rect.Z = PlayerNotes.Select(bp => bp.Rect.Z).Average();
}
} }
public void Draw() public void Draw()
@@ -155,6 +173,12 @@ namespace VocaluxeLib.Menu.SingNotes
public void LoadSkin() public void LoadSkin()
{ {
Debug.Assert(_Theme.BarPos.Length > 0);
X = _Theme.BarPos.Select(bp => bp.Rect.X).Min();
Y = _Theme.BarPos.Select(bp => bp.Rect.X).Min();
W = X - _Theme.BarPos.Select(bp => bp.Rect.Right).Max();
H = Y - _Theme.BarPos.Select(bp => bp.Rect.Bottom).Max();
Z = _Theme.BarPos.Select(bp => bp.Rect.Z).Average();
foreach (SBarPosition bp in _Theme.BarPos) foreach (SBarPosition bp in _Theme.BarPos)
{ {
int n = Int32.Parse(bp.Name.Substring(3, 1)) - 1; int n = Int32.Parse(bp.Name.Substring(3, 1)) - 1;
@@ -121,7 +121,7 @@ namespace VocaluxeLib.Menu.SongMenu
else if (value >= CBase.Songs.GetNumCategories()) else if (value >= CBase.Songs.GetNumCategories())
{ {
value = -1; value = -1;
CBase.BackgroundMusic.Stop(); CBase.BackgroundMusic.SetPlayingPreview(false);
} }
_PreviewNrInternal = value; _PreviewNrInternal = value;
@@ -371,7 +371,7 @@ namespace VocaluxeLib.Menu.SongMenu
return; return;
CBase.BackgroundMusic.StopPreview(); CBase.BackgroundMusic.StopPreview();
CBase.Sound.SetGlobalVolume(CBase.Config.GetMusicVolume(EMusicType.Background));
if (playBGagain) if (playBGagain)
CBase.BackgroundMusic.Play(); CBase.BackgroundMusic.Play();
@@ -99,7 +99,7 @@ namespace VocaluxeLib.Menu.SongMenu
if (value == base._PreviewNr) if (value == base._PreviewNr)
{ {
if (!CBase.BackgroundMusic.IsPlaying() && value != -1) if (!CBase.BackgroundMusic.IsPlaying() && value != -1)
CBase.BackgroundMusic.PlayPreview(); CBase.BackgroundMusic.Play();
return; return;
} }
base._PreviewNr = value; base._PreviewNr = value;
+31 -61
View File
@@ -16,21 +16,20 @@
#endregion #endregion
using System.Collections.Generic; using System.Collections.Generic;
using System.Diagnostics;
using VocaluxeLib.Menu; using VocaluxeLib.Menu;
namespace VocaluxeLib.PartyModes namespace VocaluxeLib.PartyModes
{ {
public abstract class CPartyMode : IPartyMode public abstract class CPartyMode : IPartyMode
{ {
private readonly string _Folder;
private readonly int _ID; private readonly int _ID;
protected SScreenSongOptions _ScreenSongOptions = new SScreenSongOptions {Selection = new SSelectionOptions(), Sorting = new SSortingOptions()}; protected SScreenSongOptions _ScreenSongOptions = new SScreenSongOptions {Selection = new SSelectionOptions(), Sorting = new SSortingOptions()};
protected readonly Dictionary<string, CMenuParty> _Screens = new Dictionary<string, CMenuParty>(); protected readonly Dictionary<string, CMenuParty> _Screens = new Dictionary<string, CMenuParty>();
protected CPartyMode(int id, string folder) protected CPartyMode(int id)
{ {
_ID = id; _ID = id;
_Folder = folder;
} }
#region Implementation #region Implementation
@@ -39,7 +38,15 @@ namespace VocaluxeLib.PartyModes
get { return _ID; } get { return _ID; }
} }
public abstract bool Init(); public int NumPlayers { get; set; }
public int NumTeams { get; set; }
public virtual bool Init()
{
Debug.Assert(MinPlayers > 0 && MinPlayers <= MaxPlayers);
Debug.Assert(MinTeams > 0 && MinTeams <= MaxTeams);
return true;
}
public void LoadTheme() public void LoadTheme()
{ {
@@ -75,61 +82,6 @@ namespace VocaluxeLib.PartyModes
entry.Value.SaveTheme(); entry.Value.SaveTheme();
} }
public virtual void UpdateGame() {}
public abstract IMenu GetStartScreen();
public virtual SScreenSongOptions GetScreenSongOptions()
{
return new SScreenSongOptions();
}
public virtual void OnSongChange(int songIndex, ref SScreenSongOptions screenSongOptions) {}
public virtual void OnCategoryChange(int categoryIndex, ref SScreenSongOptions screenSongOptions) {}
public virtual int GetMaxPlayer()
{
return 6;
}
public virtual int GetMinPlayer()
{
return 1;
}
public virtual int GetMaxTeams()
{
return 0;
}
public virtual int GetMinTeams()
{
return 0;
}
public virtual int GetMinPlayerPerTeam()
{
return GetMinPlayer();
}
public virtual int GetMaxPlayerPerTeam()
{
return GetMaxPlayer();
}
public virtual int GetMaxNumRounds()
{
return 1;
}
public string GetFolder()
{
return _Folder;
}
public virtual void SetSearchString(string searchString, bool visible) {}
public virtual void JokerUsed(int teamNr) public virtual void JokerUsed(int teamNr)
{ {
if (_ScreenSongOptions.Selection.NumJokers == null) if (_ScreenSongOptions.Selection.NumJokers == null)
@@ -142,8 +94,6 @@ namespace VocaluxeLib.PartyModes
_ScreenSongOptions.Selection.NumJokers[teamNr]--; _ScreenSongOptions.Selection.NumJokers[teamNr]--;
} }
public abstract void SongSelected(int songID);
public virtual void FinishedSinging() public virtual void FinishedSinging()
{ {
CBase.Graphics.FadeTo(EScreen.Score); CBase.Graphics.FadeTo(EScreen.Score);
@@ -159,5 +109,25 @@ namespace VocaluxeLib.PartyModes
CBase.Graphics.FadeTo(EScreen.Song); CBase.Graphics.FadeTo(EScreen.Song);
} }
#endregion Implementation #endregion Implementation
#region Abstract members
public abstract int MinMics { get; }
public abstract int MaxMics { get; }
public abstract int MinPlayers { get; }
public abstract int MaxPlayers { get; }
public abstract int MinTeams { get; }
public abstract int MaxTeams { get; }
public abstract int MinPlayersPerTeam { get; }
public abstract int MaxPlayersPerTeam { get; }
public abstract void UpdateGame();
public abstract IMenu GetStartScreen();
public abstract SScreenSongOptions GetScreenSongOptions();
public abstract void OnSongChange(int songIndex, ref SScreenSongOptions screenSongOptions);
public abstract void OnCategoryChange(int categoryIndex, ref SScreenSongOptions screenSongOptions);
public abstract void SetSearchString(string searchString, bool visible);
public abstract void SongSelected(int songID);
#endregion Abstract members
} }
} }
@@ -20,10 +20,42 @@ using VocaluxeLib.Menu;
namespace VocaluxeLib.PartyModes namespace VocaluxeLib.PartyModes
{ {
public class CPartyModeNone : CPartyMode public class CPartyModeNormal : CPartyMode
{ {
//just a dummy for normal game mode public override int MinMics
public CPartyModeNone(int id, string folder) : base(id, folder) {
get { return 1; }
}
public override int MaxMics
{
get { return CBase.Config.GetMaxNumMics(); }
}
public override int MinPlayers
{
get { return 1; }
}
public override int MaxPlayers
{
get { return CBase.Settings.GetMaxNumPlayer(); }
}
public override int MinTeams
{
get { return 1; }
}
public override int MaxTeams
{
get { return 1; }
}
public override int MinPlayersPerTeam
{
get { return MinPlayers; }
}
public override int MaxPlayersPerTeam
{
get { return MaxPlayers; }
}
public CPartyModeNormal(int id) : base(id)
{ {
_ScreenSongOptions.Selection.RandomOnly = false; _ScreenSongOptions.Selection.RandomOnly = false;
_ScreenSongOptions.Selection.PartyMode = false; _ScreenSongOptions.Selection.PartyMode = false;
@@ -42,6 +74,8 @@ namespace VocaluxeLib.PartyModes
return true; return true;
} }
public override void UpdateGame() {}
public override IMenu GetStartScreen() public override IMenu GetStartScreen()
{ {
return CBase.Graphics.GetScreen(EScreen.Names); return CBase.Graphics.GetScreen(EScreen.Names);
@@ -60,6 +94,10 @@ namespace VocaluxeLib.PartyModes
return _ScreenSongOptions; return _ScreenSongOptions;
} }
public override void OnSongChange(int songIndex, ref SScreenSongOptions screenSongOptions) {}
public override void OnCategoryChange(int categoryIndex, ref SScreenSongOptions screenSongOptions) {}
public override void SetSearchString(string searchString, bool visible) public override void SetSearchString(string searchString, bool visible)
{ {
_ScreenSongOptions.Sorting.SearchString = searchString; _ScreenSongOptions.Sorting.SearchString = searchString;
+16 -9
View File
@@ -79,9 +79,24 @@ namespace VocaluxeLib.PartyModes
} }
#endregion Structs #endregion Structs
public interface IPartyMode public interface IPartyModeInfo
{ {
int ID { get; } int ID { get; }
int MinMics { get; }
int MaxMics { get; }
int MinPlayers { get; }
int MaxPlayers { get; }
int MinTeams { get; }
int MaxTeams { get; }
int MinPlayersPerTeam { get; }
int MaxPlayersPerTeam { get; }
}
public interface IPartyMode : IPartyModeInfo
{
int NumPlayers { get; set; }
int NumTeams { get; set; }
bool Init(); bool Init();
void LoadTheme(); void LoadTheme();
@@ -99,14 +114,6 @@ namespace VocaluxeLib.PartyModes
void OnSongChange(int songIndex, ref SScreenSongOptions screenSongOptions); void OnSongChange(int songIndex, ref SScreenSongOptions screenSongOptions);
void OnCategoryChange(int categoryIndex, ref SScreenSongOptions screenSongOptions); void OnCategoryChange(int categoryIndex, ref SScreenSongOptions screenSongOptions);
int GetMaxPlayer();
int GetMinPlayer();
int GetMaxTeams();
int GetMinTeams();
int GetMinPlayerPerTeam();
int GetMaxPlayerPerTeam();
int GetMaxNumRounds();
void SetSearchString(string searchString, bool visible); void SetSearchString(string searchString, bool visible);
void JokerUsed(int teamNr); void JokerUsed(int teamNr);
+2 -2
View File
@@ -75,10 +75,10 @@ namespace VocaluxeLib.Songs
#region Methods #region Methods
/// <summary> /// <summary>
/// Find last note with StartBeat /// Find last note with StartBeat &lt;= beat
/// </summary> /// </summary>
/// <param name="beat"></param> /// <param name="beat"></param>
/// <returns>Note index of last note with StartBeat or -1 if all notes start after beat</returns> /// <returns>Note index of last note with StartBeat &lt;= beat or -1 if all notes start after beat</returns>
public int FindPreviousNote(int beat) public int FindPreviousNote(int beat)
{ {
//If no notes -> No previous note //If no notes -> No previous note
+7
View File
@@ -186,6 +186,7 @@ namespace VocaluxeLib
public float Z; public float Z;
[XmlIgnore] public float Rotation; //0..360° [XmlIgnore] public float Rotation; //0..360°
[XmlIgnore]
public float Right public float Right
{ {
get { return X + W; } get { return X + W; }
@@ -195,6 +196,8 @@ namespace VocaluxeLib
Debug.Assert(W >= 0); Debug.Assert(W >= 0);
} }
} }
[XmlIgnore]
public float Bottom public float Bottom
{ {
get { return Y + H; } get { return Y + H; }
@@ -204,10 +207,14 @@ namespace VocaluxeLib
Debug.Assert(H >= 0); Debug.Assert(H >= 0);
} }
} }
[XmlIgnore]
public Size SizeI public Size SizeI
{ {
get { return new Size((int)W, (int)H); } get { return new Size((int)W, (int)H); }
} }
[XmlIgnore]
public SizeF Size public SizeF Size
{ {
get { return new SizeF(W, H); } get { return new SizeF(W, H); }
@@ -0,0 +1,157 @@
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
namespace VocaluxeLib.Utils.Combinatorics
{
/// <summary>
/// Calculates all combinations (without repetition) of a given input sequence <br />
/// Example: {A B C}, select 2 --> {A B}, {A C}, {B C}
/// </summary>
/// <typeparam name="T">Type of the input elements</typeparam>
public class CCombinations<T> : IEnumerable<List<T>>
{
private readonly List<T> _Values;
private readonly int _NumSelected;
private readonly int _Count;
/// <summary>
/// Construct combinations for the input sequence when selecting numSelected elements <br />
/// The values should not contain duplicates as this will result in duplicates in the output
/// </summary>
/// <param name="values">Input sequence</param>
/// <param name="numSelected">Number of elements to select</param>
public CCombinations(List<T> values, int numSelected)
{
_Values = values;
_NumSelected = numSelected;
// This also acts as a parameter check
_Count = Count(_Values.Count, _NumSelected);
}
/// <summary>
/// Calculates how many combinations are possible when k out of n elements are selected
/// </summary>
/// <param name="n">Number of elements</param>
/// <param name="k">Number of selected elements</param>
/// <returns></returns>
public static int Count(int n, int k)
{
if (n < 0 || k < 0)
throw new ArgumentException("Parameters must not be negative");
if (n < k)
return 0;
// Try to optimize because (n k) = (n n-k)
if (n - k < k)
k = n - k;
if (k == 0) // or k == n but both are the same after the optimization above
return 1;
long result = n;
for (long i = 1; i < k; i++)
{
checked
{
result = result * (n - i) / (i + 1);
}
}
return (int)result;
}
/// <summary>
/// Gets the number of combinations that are generated
/// </summary>
/// <returns></returns>
public int Count()
{
return _Count;
}
/// <summary>
/// Gets all possible combinations as a list
/// </summary>
/// <returns></returns>
public List<List<T>> GetAll()
{
List<List<T>> result = new List<List<T>>(Count());
result.AddRange(this);
return result;
}
public IEnumerator<List<T>> GetEnumerator()
{
return new CEnumerator(this);
}
IEnumerator IEnumerable.GetEnumerator()
{
return GetEnumerator();
}
private class CEnumerator : IEnumerator<List<T>>
{
private readonly int _N;
private readonly int _K;
private readonly CCombinations<T> _Parent;
private int[] _CurSet;
public CEnumerator(CCombinations<T> parent)
{
_N = parent._Values.Count;
_K = parent._NumSelected;
_Parent = parent;
Debug.Assert(_N >= 0 && _K >= 0);
}
public void Dispose() {}
public bool MoveNext()
{
if (_N < _K)
return false;
if (_CurSet == null)
{
_CurSet = new int[_K];
for (int i = 0; i < _K; i++)
_CurSet[i] = i;
return true;
}
// Check if we reached the end
if (_K == 0 || _CurSet[0] == _N - _K)
return false;
// Search for element to increment
int idx = _K - 1;
while (idx > 0 && _CurSet[idx] == _N - _K + idx)
idx--;
_CurSet[idx]++;
// Increment all elements "right" of this to 1+their left neighbour
for (int j = idx; j < _K - 1; j++)
_CurSet[j + 1] = _CurSet[j] + 1;
return true;
}
public void Reset()
{
_CurSet = null;
}
public List<T> Current
{
get
{
List<T> result = new List<T>(_K);
result.AddRange(_CurSet.Select(i => _Parent._Values[i]));
return result;
}
}
object IEnumerator.Current
{
get { return Current; }
}
}
}
}
+74 -73
View File
@@ -39,28 +39,32 @@ namespace VocaluxeLib.Utils.Player
_VideoEnabled = value; _VideoEnabled = value;
if (_VideoEnabled) if (_VideoEnabled)
_LoadVideo(); _LoadVideo();
else if (_Video != null) else
CBase.Video.Close(ref _Video); _CloseVideo();
} }
} }
public int SongID public int SongID
{ {
get { return _Song == null ? -1 : _Song.ID; } get { return _Song == null ? -1 : _Song.ID; }
} }
public bool SongHasVideo
{
get { return _Song != null && File.Exists(Path.Combine(_Song.Folder, _Song.VideoFileName)); }
}
public string ArtistAndTitle public bool SongHasVideo
{ {
get get
{ {
if (_Song == null) return _Song != null && !String.IsNullOrEmpty(_Song.Folder) && !String.IsNullOrEmpty(_Song.VideoFileName) &&
return ""; File.Exists(Path.Combine(_Song.Folder, _Song.VideoFileName));
if (_Song.Artist != "" && _Song.Title != "") }
}
public override string ArtistAndTitle
{
get
{
if (_Song != null && !String.IsNullOrEmpty(_Song.Artist) && !String.IsNullOrEmpty(_Song.Title))
return _Song.Artist + " - " + _Song.Title; return _Song.Artist + " - " + _Song.Title;
return Path.GetFileNameWithoutExtension(_Song.MP3FileName); return base.ArtistAndTitle;
} }
} }
@@ -69,26 +73,8 @@ namespace VocaluxeLib.Utils.Player
get { return _Song == null ? CBase.Cover.GetNoCover() : _Song.CoverTextureBig; } get { return _Song == null ? CBase.Cover.GetNoCover() : _Song.CoverTextureBig; }
} }
public bool SongLoaded
{
get { return _StreamID != -1; }
}
public CSongPlayer(bool loop = false) : base(loop) {} public CSongPlayer(bool loop = false) : base(loop) {}
public CSongPlayer(CSong song, bool loop = false, float position = 0f, bool autoplay = false)
: base(Path.Combine(song.Folder, song.MP3FileName), loop, position, autoplay)
{
_Song = song;
_LoadVideo();
}
public CSongPlayer(string file, bool loop = false, float position = 0f, bool autoplay = false)
: base(file, loop, position, autoplay)
{
_Song = null;
}
public CTextureRef GetVideoTexture() public CTextureRef GetVideoTexture()
{ {
if (_Video == null || _Song == null) if (_Video == null || _Song == null)
@@ -110,49 +96,11 @@ namespace VocaluxeLib.Utils.Player
public void Load(CSong song, float position = 0f, bool autoplay = false) public void Load(CSong song, float position = 0f, bool autoplay = false)
{ {
if (song == null) if (song == null)
return; throw new ArgumentNullException("song");
Stop(); Load(song.GetMP3(), position, autoplay);
_Song = song;
Load(Path.Combine(song.Folder, song.MP3FileName), position, autoplay);
_LoadVideo(); _LoadVideo();
_Song = song;
if (autoplay)
Play();
}
public void LoadFile(string file, float position = 0f, bool autoplay = false)
{
if (String.IsNullOrEmpty(file))
return;
Stop();
Load(file, position, autoplay);
}
public override void Stop()
{
base.Stop();
_Song = null;
if (_Video != null)
CBase.Video.Close(ref _Video);
}
public override void TogglePause()
{
if (IsPlaying && _Video != null)
{
CBase.Video.Pause(_Video);
CBase.Video.Skip(_Video, CBase.Sound.GetPosition(_StreamID) + _FadeTime, _Song.VideoGap);
}
else if (_Video != null)
CBase.Video.Resume(_Video);
base.TogglePause();
} }
private void _LoadVideo() private void _LoadVideo()
@@ -160,11 +108,13 @@ namespace VocaluxeLib.Utils.Player
if (_Song == null) if (_Song == null)
return; return;
string videoFilePath = Path.Combine(_Song.Folder, _Song.VideoFileName); if (_Video != null || !SongHasVideo)
if (_Video != null || String.IsNullOrEmpty(videoFilePath))
return; return;
string videoFilePath = Path.Combine(_Song.Folder, _Song.VideoFileName);
_Video = CBase.Video.Load(videoFilePath); _Video = CBase.Video.Load(videoFilePath);
CBase.Video.Skip(_Video, 0f, _Song.VideoGap); //Use gap, otherwhise we will overwrite position in GetVideoTexture if (_Video == null)
return;
_VideoFading = new CFading(0f, 1f, 3f); _VideoFading = new CFading(0f, 1f, 3f);
if (IsPlaying) if (IsPlaying)
@@ -172,6 +122,57 @@ namespace VocaluxeLib.Utils.Player
CBase.Video.Skip(_Video, Position, _Song.VideoGap); CBase.Video.Skip(_Video, Position, _Song.VideoGap);
CBase.Video.Resume(_Video); CBase.Video.Resume(_Video);
} }
else
CBase.Video.Skip(_Video, 0f, _Song.VideoGap);
}
public override bool Play()
{
if (!base.Play())
return false;
if (_Video != null)
{
CBase.Video.Skip(_Video, Position, _Song.VideoGap);
CBase.Video.Resume(_Video);
}
return true;
}
public override bool Pause()
{
if (!base.Pause())
return false;
if (_Video != null)
CBase.Video.Pause(_Video);
return true;
}
public override bool Stop()
{
if (!base.Stop())
return false;
if (_Video != null)
{
CBase.Video.Pause(_Video);
CBase.Video.Skip(_Video, 0f, _Song.VideoGap);
}
return true;
}
private void _CloseVideo()
{
if (_Video != null)
CBase.Video.Close(ref _Video);
}
public override void Close()
{
base.Close();
_Song = null;
_CloseVideo();
} }
} }
} }
+79 -83
View File
@@ -15,58 +15,52 @@
// along with Vocaluxe. If not, see <http://www.gnu.org/licenses/>. // along with Vocaluxe. If not, see <http://www.gnu.org/licenses/>.
#endregion #endregion
using System.IO;
namespace VocaluxeLib.Utils.Player namespace VocaluxeLib.Utils.Player
{ {
public class CSoundPlayer public class CSoundPlayer
{ {
protected int _StreamID = -1; protected int _StreamID = -1;
protected int _Volume = 100;
protected float _StartPosition;
protected readonly float _FadeTime = CBase.Settings.GetSoundPlayerFadeTime(); protected readonly float _FadeTime = CBase.Settings.GetSoundPlayerFadeTime();
public string FilePath { get; private set; }
public int Volume
{
set
{
_Volume = value;
_ApplyVolume();
}
get { return _Volume; }
}
public bool Loop; public bool Loop;
/// <summary>
/// Gets the current stream position or sets it
/// </summary>
public float Position public float Position
{ {
set set
{ {
if (_StreamID == -1) if (!SoundLoaded)
return; return;
_StartPosition = value; CBase.Sound.SetPosition(_StreamID, value);
}
get
{
if (_StreamID == -1)
return -1;
return CBase.Sound.GetPosition(_StreamID);
} }
get { return !SoundLoaded ? -1 : CBase.Sound.GetPosition(_StreamID); }
} }
public float Length public float Length
{ {
get get { return !SoundLoaded ? -1 : CBase.Sound.GetLength(_StreamID); }
{
if (_StreamID == -1)
return 0;
return CBase.Sound.GetLength(_StreamID);
}
} }
public bool RepeatSong; public bool IsPlaying { get; private set; }
public bool IsPlaying { get; protected set; }
public bool IsFinished public bool IsFinished
{ {
get { return !RepeatSong && CBase.Sound.IsFinished(_StreamID); } get { return !Loop && CBase.Sound.IsFinished(_StreamID); }
}
public bool SoundLoaded
{
get { return _StreamID != -1; }
}
public virtual string ArtistAndTitle
{
get { return string.IsNullOrEmpty(FilePath) ? "" : Path.GetFileNameWithoutExtension(FilePath); }
} }
public CSoundPlayer(bool loop = false) public CSoundPlayer(bool loop = false)
@@ -74,95 +68,97 @@ namespace VocaluxeLib.Utils.Player
Loop = loop; Loop = loop;
} }
public CSoundPlayer(string file, bool loop = false, float position = 0f, bool autoplay = false) public void Load(string file, float position = -1f, bool autoplay = false)
{ {
_StreamID = CBase.Sound.Load(file, false, true); Close();
if (position > 0f)
Position = position;
Loop = loop;
if (autoplay)
Play();
}
public void Load(string file, float position = 0f, bool autoplay = false)
{
if (IsPlaying)
Stop();
_StreamID = CBase.Sound.Load(file, false, true); _StreamID = CBase.Sound.Load(file, false, true);
if (position > 0f) if (_StreamID < 0)
Position = position;
if (autoplay)
Play();
}
public void Play()
{
if (_StreamID == -1 || IsPlaying)
return; return;
FilePath = file;
if (position > 0f)
Position = position;
if (autoplay)
Play();
}
/// <summary>
/// Starts or resumes the player
/// </summary>
/// <returns>True if state changed, false if nothing loaded or already playing</returns>
public virtual bool Play()
{
if (!SoundLoaded || IsPlaying)
return false;
CBase.Sound.SetPosition(_StreamID, _StartPosition);
CBase.Sound.SetStreamVolume(_StreamID, 0); CBase.Sound.SetStreamVolume(_StreamID, 0);
CBase.Sound.Fade(_StreamID, Volume, _FadeTime); CBase.Sound.Fade(_StreamID, 100, _FadeTime);
CBase.Sound.Play(_StreamID); CBase.Sound.Play(_StreamID);
IsPlaying = true; IsPlaying = true;
return true;
} }
public virtual void TogglePause() /// <summary>
/// Pauses the player
/// </summary>
/// <returns>True if state changed, false if nothing loaded or already paused</returns>
public virtual bool Pause()
{ {
if (_StreamID == -1) if (!SoundLoaded || CBase.Sound.IsPaused(_StreamID))
return; return false;
if (IsPlaying)
CBase.Sound.Fade(_StreamID, 0, _FadeTime, EStreamAction.Pause); CBase.Sound.Fade(_StreamID, 0, _FadeTime, EStreamAction.Pause);
else IsPlaying = false;
{ return true;
CBase.Sound.Fade(_StreamID, Volume, _FadeTime);
CBase.Sound.Play(_StreamID);
} }
IsPlaying = !IsPlaying; /// <summary>
/// Stops the player (no playback and position is set to start)
/// </summary>
/// <returns>True if playback was stopped</returns>
public virtual bool Stop()
{
if (!SoundLoaded)
return false;
CBase.Sound.Fade(_StreamID, 0, _FadeTime, EStreamAction.Stop);
IsPlaying = false;
return true;
} }
public virtual void Stop() public virtual void Close()
{ {
if (_StreamID == -1 || !IsPlaying) if (!SoundLoaded)
return; return;
CBase.Sound.Fade(_StreamID, 0, _FadeTime, EStreamAction.Close); CBase.Sound.Fade(_StreamID, 0, _FadeTime, EStreamAction.Close);
_StreamID = -1; _StreamID = -1;
FilePath = "";
IsPlaying = false; IsPlaying = false;
} }
public void Update() public void Update()
{ {
if (_StreamID == -1 || !IsPlaying) if (!IsPlaying)
return; return;
bool finished = CBase.Sound.IsFinished(_StreamID);
if (Loop)
{
if (finished)
{
// Restart
Stop();
Play();
}
return;
}
float len = CBase.Sound.GetLength(_StreamID); float len = CBase.Sound.GetLength(_StreamID);
float timeToPlay = (len > 0f) ? len - CBase.Sound.GetPosition(_StreamID) : _FadeTime + 1f; float timeToPlay = (len > 0f) ? len - CBase.Sound.GetPosition(_StreamID) : _FadeTime + 1f;
bool finished = CBase.Sound.IsFinished(_StreamID);
if (timeToPlay <= _FadeTime || finished) if (timeToPlay <= _FadeTime || finished)
{
if (RepeatSong)
{
//Set to false for restarting
IsPlaying = false;
Play();
}
else
Stop(); Stop();
} }
} }
private void _ApplyVolume()
{
if (_StreamID == -1)
return;
CBase.Sound.SetStreamVolume(_StreamID, Volume);
}
}
} }
+2 -1
View File
@@ -108,6 +108,7 @@
<Compile Include="Draw\CTextureRef.cs" /> <Compile Include="Draw\CTextureRef.cs" />
<Compile Include="Menu\IThemeable.cs" /> <Compile Include="Menu\IThemeable.cs" />
<Compile Include="Menu\SingNotes\CNoteBars.cs" /> <Compile Include="Menu\SingNotes\CNoteBars.cs" />
<Compile Include="Utils\Combinatorics\CCombinations.cs" />
<Compile Include="XmlStructs.cs" /> <Compile Include="XmlStructs.cs" />
<Compile Include="Xml\CTypeExtensions.cs" /> <Compile Include="Xml\CTypeExtensions.cs" />
<Compile Include="Xml\CXmlDeserializer.cs" /> <Compile Include="Xml\CXmlDeserializer.cs" />
@@ -138,7 +139,7 @@
<Compile Include="Songs\CSongLoader.cs" /> <Compile Include="Songs\CSongLoader.cs" />
<Compile Include="Structs.cs" /> <Compile Include="Structs.cs" />
<Compile Include="PartyModes\CPartyMode.cs" /> <Compile Include="PartyModes\CPartyMode.cs" />
<Compile Include="PartyModes\CPartyModeNone.cs" /> <Compile Include="PartyModes\CPartyModeNormal.cs" />
<Compile Include="PartyModes\IPartyMode.cs" /> <Compile Include="PartyModes\IPartyMode.cs" />
<Compile Include="Properties\AssemblyInfo.cs" /> <Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Utils\CWavFile.cs" /> <Compile Include="Utils\CWavFile.cs" />
+17 -7
View File
@@ -86,14 +86,14 @@ namespace VocaluxeLib.Xml
} }
#endregion Debug Helpers #endregion Debug Helpers
private readonly XmlNode _Node; public readonly XmlNode Node;
public readonly bool IsError; public readonly bool IsError;
public CXmlException(string msg, XmlNode node, bool isError = true) public CXmlException(string msg, XmlNode node, bool isError = true)
: base(msg) : base(msg)
{ {
IsError = isError; IsError = isError;
_Node = node; Node = node;
} }
public override string Message public override string Message
@@ -103,12 +103,22 @@ namespace VocaluxeLib.Xml
public override String ToString() public override String ToString()
{ {
string xPath = _Node == null ? "" : _GetXPath(_Node); string xPath = Node == null ? "" : _GetXPath(Node);
string type = IsError ? "Error" : "Warning"; string type = IsError ? "Error" : "Warning";
return type + ": " + base.Message.Replace("%n", xPath); return type + ": " + base.Message.Replace("%n", xPath);
} }
} }
public class CXmlMissingElementException : CXmlException
{
public readonly SFieldInfo Field;
public CXmlMissingElementException(XmlNode parent, SFieldInfo field, bool isError = true) : base("Element: " + field.Name + " is missing in %n", parent, isError)
{
Field = field;
}
}
public class CXmlInvalidValueException : CXmlException public class CXmlInvalidValueException : CXmlException
{ {
private readonly string _Value; private readonly string _Value;
@@ -157,9 +167,9 @@ namespace VocaluxeLib.Xml
public class CXmlDeserializer public class CXmlDeserializer
{ {
private class CXmlDefaultErrorHandler : IXmlErrorHandler public class CXmlDefaultErrorHandler : IXmlErrorHandler
{ {
public void HandleError(CXmlException e) public virtual void HandleError(CXmlException e)
{ {
if (e.IsError) if (e.IsError)
throw e; throw e;
@@ -421,7 +431,7 @@ namespace VocaluxeLib.Xml
Dictionary<string, Tuple<SFieldInfo, List<object>>> embLists = new Dictionary<string, Tuple<SFieldInfo, List<object>>>(); Dictionary<string, Tuple<SFieldInfo, List<object>>> embLists = new Dictionary<string, Tuple<SFieldInfo, List<object>>>();
foreach (XmlNode node in nodes) foreach (XmlNode node in nodes)
{ {
if (node is XmlComment) if (node is XmlComment || node.LocalName == "xsd" || node.LocalName == "xsi")
continue; continue;
SFieldInfo field = new SFieldInfo(); SFieldInfo field = new SFieldInfo();
@@ -505,7 +515,7 @@ namespace VocaluxeLib.Xml
if (!_CheckAndSetDefaultValue(o, field)) if (!_CheckAndSetDefaultValue(o, field))
{ {
if (parent != null) if (parent != null)
_ErrorHandler.HandleError(new CXmlException("element: " + field.Name + " is missing in %n", parent)); _ErrorHandler.HandleError(new CXmlMissingElementException(parent, field));
object value = _GetValue(null, field.Type, field.ArrayItemName, field.GetValue(o)); object value = _GetValue(null, field.Type, field.ArrayItemName, field.GetValue(o));
if (value != null) if (value != null)
field.SetValue(o, value); field.SetValue(o, value);
+7 -1
View File
@@ -63,7 +63,7 @@ namespace VocaluxeLib.Xml
/// <param name="type">Type of the value</param> /// <param name="type">Type of the value</param>
/// <param name="value">Object to write</param> /// <param name="value">Object to write</param>
/// <param name="isAttribute">When true, value will be written as an attribute to the currently open node, otherwhise it will create a new node</param> /// <param name="isAttribute">When true, value will be written as an attribute to the currently open node, otherwhise it will create a new node</param>
/// <param name="arrayItemName">>Name of the sub nodes for array types(Array,List,Dictionary), can be set by XmlArrayItemAttribute and defaults to the type name</param> /// <param name="arrayItemName">Name of the sub nodes for array types(Array,List,Dictionary), can be set by XmlArrayItemAttribute and defaults to the type name</param>
/// <param name="nameAttribute">If set, an attribute 'name' with this value will be written</param> /// <param name="nameAttribute">If set, an attribute 'name' with this value will be written</param>
private void _WriteValue(XmlWriter writer, string name, Type type, object value, bool isAttribute, string arrayItemName = null, string nameAttribute = null) private void _WriteValue(XmlWriter writer, string name, Type type, object value, bool isAttribute, string arrayItemName = null, string nameAttribute = null)
{ {
@@ -165,8 +165,14 @@ namespace VocaluxeLib.Xml
if (field.IsEmbeddedList) if (field.IsEmbeddedList)
{ {
IEnumerable values = (IEnumerable)value; IEnumerable values = (IEnumerable)value;
bool empty = true;
foreach (object subValue in values) foreach (object subValue in values)
{
_WriteValue(writer, field.Name, field.SubType, subValue, field.IsAttribute); _WriteValue(writer, field.Name, field.SubType, subValue, field.IsAttribute);
empty = false;
}
if (empty && _WriteDefaults)
writer.WriteElementString(field.Name, "");
} }
else if (field.IsByteArray) else if (field.IsByteArray)
writer.WriteElementString(field.Name, Convert.ToBase64String((byte[])value)); writer.WriteElementString(field.Name, Convert.ToBase64String((byte[])value));
+21
View File
@@ -0,0 +1,21 @@
using System;
using Microsoft.VisualStudio.TestTools.UnitTesting;
namespace VocaluxeTests
{
static class CTestHelpers
{
public static void AssertFail<T>(Action test) where T : Exception
{
try
{
test.Invoke();
Assert.Fail("Exception " + typeof(T).Name + " not thrown!");
}
catch (Exception e)
{
Assert.IsInstanceOfType(e, typeof(T));
}
}
}
}
+75
View File
@@ -0,0 +1,75 @@
using System;
using System.Collections.Generic;
using System.Linq;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using VocaluxeLib.Utils.Combinatorics;
namespace VocaluxeTests
{
[TestClass]
public class CCombinatoricsTest
{
[TestMethod]
public void TestCounts()
{
Assert.AreEqual(4, CCombinations<int>.Count(4, 3));
Assert.AreEqual(6, CCombinations<int>.Count(4, 2));
Assert.AreEqual(66, CCombinations<int>.Count(12, 2));
// Corner cases
for (int i = 1; i < 12; i++)
{
Assert.AreEqual(1, CCombinations<int>.Count(i, 0));
Assert.AreEqual(1, CCombinations<int>.Count(i, i));
Assert.AreEqual(0, CCombinations<int>.Count(i, i + 1));
}
// Check identity (n k) = (n n-k)
for (int i = 0; i <= 12; i++)
Assert.AreEqual(CCombinations<int>.Count(12, i), CCombinations<int>.Count(12, 12 - i));
CTestHelpers.AssertFail<ArgumentException>(() => CCombinations<int>.Count(-1, -1));
CTestHelpers.AssertFail<ArgumentException>(() => CCombinations<int>.Count(-1, 1));
CTestHelpers.AssertFail<ArgumentException>(() => CCombinations<int>.Count(1, -1));
}
// ReSharper disable UnusedParameter.Local
private static void _CheckResults<T>(CCombinations<T> combs, List<T> input)
// ReSharper restore UnusedParameter.Local
{
List<List<T>> results = new List<List<T>>();
foreach (List<T> comb in combs)
{
foreach (List<T> other in results)
Assert.IsFalse(other.SequenceEqual(comb), "Result must be unique");
for (int i = 0; i < comb.Count - 1; i++)
{
Assert.IsTrue(comb.IndexOf(comb[i], i + 1) < 0, "Repetition not allowed");
Assert.IsTrue(input.Contains(comb[i]), "Output must be in input sequence");
}
results.Add(comb);
}
Assert.AreEqual(combs.Count(), results.Count);
List<List<T>> results2 = combs.GetAll();
Assert.AreEqual(results.Count, results2.Count);
for (int i = 0; i < results2.Count; i++)
Assert.IsTrue(results[i].SequenceEqual(results2[i]));
}
[TestMethod]
public void TestResults()
{
Random rand = new Random();
for (int n = 0; n < 8; n++)
{
for (int k = 0; k <= n; k++)
{
List<int> collection = new List<int>(n);
int r = rand.Next(1000);
for (int i = 0; i < n; i++)
collection.Add(i + r);
CCombinations<int> combs = new CCombinations<int>(collection, k);
Assert.AreEqual(CCombinations<int>.Count(n, k), combs.Count());
_CheckResults(combs, collection);
}
}
}
}
}
+72
View File
@@ -0,0 +1,72 @@
using System;
using System.Collections.Generic;
using System.Linq;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Vocaluxe.Base;
using VocaluxeLib;
using VocaluxeLib.PartyModes.Challenge;
namespace VocaluxeTests
{
[TestClass]
public class CPartyModeTests
{
[TestMethod]
public void TestRoundBoundaries()
{
// ReSharper disable ObjectCreationAsStatement
new CChallengeRounds(1, 1, 1); // Should succeed
// ReSharper restore ObjectCreationAsStatement
for (int inv = -1; inv <= 0; inv++)
{
int invL = inv;
CTestHelpers.AssertFail<ArgumentException>(() => new CChallengeRounds(invL, 1, 1));
CTestHelpers.AssertFail<ArgumentException>(() => new CChallengeRounds(1, invL, 1));
CTestHelpers.AssertFail<ArgumentException>(() => new CChallengeRounds(1, 1, invL));
}
}
private static void _CheckRounds(CChallengeRounds rounds, int numPlayer)
{
List<int> numSongs = new List<int>(numPlayer);
for (int i = 0; i < numPlayer; i++)
numSongs.Add(0);
for (int i = 0; i < rounds.Count; i++)
{
foreach (int player in rounds[i].Players)
{
Assert.IsTrue(player >= 0 && player < numPlayer);
numSongs[player]++;
}
}
Assert.IsTrue(numSongs.Min() == numSongs.Max(), "Some players have more songs than others");
}
[TestMethod]
public void TestRoundGeneration()
{
CBase.Game = new CBGame();
CLog.Init();
CBase.Log = new CBlog();
for (int i = 0; i < 10; i++)
{
for (int numPlayer = 1; numPlayer <= 20; numPlayer++)
{
for (int numMic = 1; numMic <= 6; numMic++)
{
int roundFactor = (numPlayer % numMic == 0) ? numPlayer / numMic : numPlayer;
for (int numRounds = roundFactor; numRounds <= 100 && numRounds <= roundFactor * 5; numRounds += roundFactor)
{
CChallengeRounds rounds = new CChallengeRounds(numRounds, numPlayer, numMic);
Assert.IsTrue(rounds.Count >= numRounds);
_CheckRounds(rounds, numPlayer);
if (rounds.Count != numRounds)
CBase.Log.LogDebug("Number of rounds does not match. Expected: " + numRounds + ", Is: " + rounds.Count + " for " + numPlayer + "/" +
((numPlayer < numMic) ? numPlayer : numMic));
}
}
}
}
}
}
}
+7
View File
@@ -70,10 +70,17 @@
</Otherwise> </Otherwise>
</Choose> </Choose>
<ItemGroup> <ItemGroup>
<Compile Include="CTestHelpers.cs" />
<Compile Include="Properties\AssemblyInfo.cs" /> <Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="CombinatoricsTest.cs" />
<Compile Include="PartyModeTests.cs" />
<Compile Include="XmlSerializerTest.cs" /> <Compile Include="XmlSerializerTest.cs" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\PartyModes\PartyModeChallenge\PartyModeChallenge.csproj">
<Project>{5a4053f1-5ad5-441f-b254-d97a088127b6}</Project>
<Name>PartyModeChallenge</Name>
</ProjectReference>
<ProjectReference Include="..\VocaluxeLib\VocaluxeLib.csproj"> <ProjectReference Include="..\VocaluxeLib\VocaluxeLib.csproj">
<Project>{d2b6ddef-e0e1-4ddf-a73a-e6acef5c95ec}</Project> <Project>{d2b6ddef-e0e1-4ddf-a73a-e6acef5c95ec}</Project>
<Name>VocaluxeLib</Name> <Name>VocaluxeLib</Name>
+15 -16
View File
@@ -91,8 +91,7 @@ namespace VocaluxeTests
private struct SDefaultSub private struct SDefaultSub
{ {
[DefaultValue(111)] [DefaultValue(111)] public int I;
public int I;
} }
private struct SDefault private struct SDefault
@@ -107,23 +106,10 @@ namespace VocaluxeTests
#pragma warning restore 169 #pragma warning restore 169
#pragma warning restore 649 #pragma warning restore 649
private static void _AssertFail<T>(Action test) where T : Exception
{
try
{
test.Invoke();
Assert.Fail("Exception " + typeof(T).Name + " not thrown!");
}
catch (Exception e)
{
Assert.IsInstanceOfType(e, typeof(T));
}
}
private static void _AssertFail<T, T2>(String xmlString) where T2 : Exception where T : new() private static void _AssertFail<T, T2>(String xmlString) where T2 : Exception where T : new()
{ {
var deserializer = new CXmlDeserializer(); var deserializer = new CXmlDeserializer();
_AssertFail<T2>(() => deserializer.DeserializeString<T>(xmlString)); CTestHelpers.AssertFail<T2>(() => deserializer.DeserializeString<T>(xmlString));
} }
private static T _AssertSerDeserMatch<T>(string xmlString) where T : new() private static T _AssertSerDeserMatch<T>(string xmlString) where T : new()
@@ -315,6 +301,11 @@ namespace VocaluxeTests
<I>2</I> <I>2</I>
<J>3</J> <J>3</J>
</root>"; </root>";
private const string _XmlListEmb4 = _Head + @"<root>
<I>2</I>
<Entry />
<J>3</J>
</root>";
[TestMethod] [TestMethod]
public void TestListEmbedded() public void TestListEmbedded()
@@ -335,6 +326,10 @@ namespace VocaluxeTests
Assert.AreEqual(foo.Ints.Count, 0, "Deserialization failed"); Assert.AreEqual(foo.Ints.Count, 0, "Deserialization failed");
res = ser.Serialize(foo); res = ser.Serialize(foo);
Assert.AreEqual(_XmlListEmb3, res, "Serialization failed"); Assert.AreEqual(_XmlListEmb3, res, "Serialization failed");
ser = new CXmlSerializer(true);
foo.Ints.Clear();
res = ser.Serialize(foo);
Assert.AreEqual(_XmlListEmb4, res, "Serialization failed");
_AssertFail<SListEmb, CXmlException>(_Empty); _AssertFail<SListEmb, CXmlException>(_Empty);
} }
@@ -357,6 +352,10 @@ namespace VocaluxeTests
Assert.AreEqual(foo.Ints.Length, 0, "Deserialization failed"); Assert.AreEqual(foo.Ints.Length, 0, "Deserialization failed");
res = ser.Serialize(foo); res = ser.Serialize(foo);
Assert.AreEqual(_XmlListEmb3, res, "Serialization failed"); Assert.AreEqual(_XmlListEmb3, res, "Serialization failed");
ser = new CXmlSerializer(true);
foo.Ints = new SEntry[0];
res = ser.Serialize(foo);
Assert.AreEqual(_XmlListEmb4, res, "Serialization failed");
_AssertFail<SArrayEmb, CXmlException>(_Empty); _AssertFail<SArrayEmb, CXmlException>(_Empty);
} }