Merge branch 'develop_cc' into develop

This commit is contained in:
Alexander Eckart committed 2013-04-04 21:10:55 +02:00
commit 0cf658bce9
191 files changed
+14001 -12929

No files matched your search

+19 -14
View File
@@ -3,32 +3,37 @@ Output/Songs
*.mp4
*.pdb
/Output/Benchmark.log
/Output/CoverDB.sqlite
/Output/HighscoreDB.sqlite
/Output/PartyModes/*/Code/*
/Output/Vocaluxe.exe*
/Output/Vocaluxe.vshost.exe*
/Output/VocaluxeLib.dll
*.psess
/*.vsp
/*.ctl
/Output/Registration.xml
/Vocaluxe.suo
/Vocaluxe/Vocaluxe.csproj.user
/Output/Config.xml
*.ipch
*.log
/Output/Playlists/*.xml
/Output/x64/gstreamer/GstreamerHelper.dll
*.tlog
*.suo
*.obj
*.lastbuildstate
*.pch
*.idb
*.exp
*.ilk
*.lib
*.opensdf
*.sdf
*.codeanalysis*
*.nativecodeanalysis*
*.lastcodeanalysissucceeded
/PartyModes/*/*/*.dll
*.Cache
+50
View File
@@ -0,0 +1,50 @@
<?xml version="1.0" encoding="utf-8"?>
<RuleSet Name="Kopie von &quot;Microsoft Extended Correctness Rules&quot;" Description="These rules expand on the basic correctness rules to maximize the logic and framework usage errors that are reported. Extra emphasis is placed on specific scenarios such as COM interop and mobile applications. Consider including this rule set if one of these scenarios applies to your project or to find additional problems in your project." ToolsVersion="10.0">
<Include Path="basiccorrectnessrules.ruleset" Action="Default" />
<Rules AnalyzerId="Microsoft.Analyzers.ManagedCodeAnalysis" RuleNamespace="Microsoft.Rules.Managed">
<Rule Id="CA1032" Action="Warning" />
<Rule Id="CA1054" Action="Warning" />
<Rule Id="CA1055" Action="Warning" />
<Rule Id="CA1056" Action="Warning" />
<Rule Id="CA1057" Action="Warning" />
<Rule Id="CA1060" Action="None" />
<Rule Id="CA1301" Action="None" />
<Rule Id="CA1303" Action="None" />
<Rule Id="CA1308" Action="None" />
<Rule Id="CA1401" Action="None" />
<Rule Id="CA1402" Action="Warning" />
<Rule Id="CA1406" Action="Warning" />
<Rule Id="CA1407" Action="Warning" />
<Rule Id="CA1408" Action="Warning" />
<Rule Id="CA1409" Action="Warning" />
<Rule Id="CA1411" Action="Warning" />
<Rule Id="CA1412" Action="Warning" />
<Rule Id="CA1413" Action="Warning" />
<Rule Id="CA1414" Action="Warning" />
<Rule Id="CA1600" Action="Warning" />
<Rule Id="CA1601" Action="Warning" />
<Rule Id="CA1821" Action="Warning" />
<Rule Id="CA1824" Action="Warning" />
<Rule Id="CA2001" Action="Warning" />
<Rule Id="CA2003" Action="Warning" />
<Rule Id="CA2101" Action="None" />
<Rule Id="CA2135" Action="Warning" />
<Rule Id="CA2136" Action="Warning" />
<Rule Id="CA2139" Action="Warning" />
<Rule Id="CA2142" Action="Warning" />
<Rule Id="CA2143" Action="Warning" />
<Rule Id="CA2144" Action="Warning" />
<Rule Id="CA2145" Action="Warning" />
<Rule Id="CA2204" Action="Warning" />
<Rule Id="CA2211" Action="Warning" />
<Rule Id="CA2217" Action="Warning" />
<Rule Id="CA2218" Action="Warning" />
<Rule Id="CA2219" Action="Warning" />
<Rule Id="CA2225" Action="Warning" />
<Rule Id="CA2228" Action="Warning" />
<Rule Id="CA2230" Action="Warning" />
<Rule Id="CA2233" Action="Warning" />
<Rule Id="CA2234" Action="Warning" />
<Rule Id="CA2243" Action="Warning" />
</Rules>
</RuleSet>
-2
View File
@@ -1540,8 +1540,6 @@ yyGrowStack(pParser);
sqlite3IdListDelete( pParse.db, ref ( yypminor.yy90 ).b );
//#line 1473 "parse.c"
}
break;
default:
break; /* If no destructor action specified: do nothing */
}
}
+2 -2
View File
@@ -227,14 +227,14 @@ void GstreamerAudioStream::FadeAndPause(float TargetVolume, float Seconds)
{
PauseStreamAfterFade = true;
Fade(TargetVolume, FadeTime);
Fade(TargetVolume, Seconds);
}
void GstreamerAudioStream::FadeAndStop(float TargetVolume, float Seconds)
{
CloseStreamAfterFade = true;
Fade(TargetVolume, FadeTime);
Fade(TargetVolume, Seconds);
}
bool GstreamerAudioStream::IsPlaying()
+1
View File
@@ -77,6 +77,7 @@
<OutDir>..\Output\x64\gstreamer\</OutDir>
<IncludePath>$(MSBuildProjectDirectory)\x64\lib\glib-2.0\include;$(MSBuildProjectDirectory)\x64\include\gstreamer-1.0;$(MSBuildProjectDirectory)\x64\include\glib-2.0;$(MSBuildProjectDirectory)\x64\include;$(IncludePath)</IncludePath>
<LibraryPath>$(MSBuildProjectDirectory)\x64\lib;$(LibraryPath)</LibraryPath>
<CodeAnalysisRuleSet>..\CheckingRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='ReleaseWin|Win32'">
<LinkIncremental>false</LinkIncremental>
+8 -1
View File
@@ -65,7 +65,7 @@ DllExport bool CloseVideo(int Stream)
DllExport int GetVideoNumStreams()
{
return VideoStreams.size();
return (int) VideoStreams.size();
}
DllExport float GetVideoLength(int Stream)
@@ -85,6 +85,13 @@ DllExport struct ApplicationFrame GetFrame(int Stream, float Time)
{
return it->second->GetFrame(Time);
}
struct ApplicationFrame returnFrame;
returnFrame.size=0;
returnFrame.width=0;
returnFrame.height=0;
returnFrame.data=NULL;
returnFrame.videotime=0;
return returnFrame;
}
DllExport bool Skip(int Stream, float Start, float Gap)
+2 -2
View File
@@ -180,7 +180,7 @@ struct ApplicationFrame GstreamerVideoStream::GetFrame(float Time)
gst_buffer_map(Buffer, &Mapinfo, GST_MAP_READ);
Size = Mapinfo.size;
Size = (int) Mapinfo.size;
gst_structure_get_int (BufferStructure, "width", &Width);
gst_structure_get_int (BufferStructure, "height", &Height);
VideoTime = (float) (Buffer->pts / GST_SECOND);
@@ -210,7 +210,7 @@ struct ApplicationFrame GstreamerVideoStream::GetFrame(float Time)
bool GstreamerVideoStream::Skip(float Start, float Gap)
{
if(!gst_element_seek_simple(Element, GST_FORMAT_TIME, (GstSeekFlags)(GST_SEEK_FLAG_FLUSH | GST_SEEK_FLAG_ACCURATE), (Start + Gap) * GST_SECOND))
if(!gst_element_seek_simple(Element, GST_FORMAT_TIME, (GstSeekFlags)(GST_SEEK_FLAG_FLUSH | GST_SEEK_FLAG_ACCURATE), (gint64)((Start + Gap) * GST_SECOND)))
{
LogVideoError("Seek failed");
return true;
+1 -1
View File
@@ -57,7 +57,7 @@ private:
volatile gboolean Copying;
gboolean Paused;
gboolean Finished;
bool Finished;
gfloat Duration;
Binary file not shown.
+28 -26
View File
@@ -1,29 +1,31 @@
<?xml version="1.0" encoding="UTF-8"?>
<root>
<Font1>
<Name>Normal</Name>
<Outline>0,00</Outline>
<OutlineColorR>0,00</OutlineColorR>
<OutlineColorG>0,00</OutlineColorG>
<OutlineColorB>0,00</OutlineColorB>
<OutlineColorA>1,00</OutlineColorA>
<Folder>FreeSans</Folder>
<FileNormal>FreeSans.ttf</FileNormal>
<FileBold>FreeSansBold.ttf</FileBold>
<FileItalic>FreeSansOblique.ttf</FileItalic>
<FileBoldItalic>FreeSansBoldOblique.ttf</FileBoldItalic>
</Font1>
<Font2>
<Name>Outline</Name>
<Outline>0,10</Outline>
<OutlineColorR>0,00</OutlineColorR>
<OutlineColorG>0,00</OutlineColorG>
<OutlineColorB>0,00</OutlineColorB>
<OutlineColorA>1,00</OutlineColorA>
<Folder>FreeSans</Folder>
<FileNormal>FreeSans.ttf</FileNormal>
<FileBold>FreeSansBold.ttf</FileBold>
<FileItalic>FreeSansOblique.ttf</FileItalic>
<FileBoldItalic>FreeSansBoldOblique.ttf</FileBoldItalic>
</Font2>
<Fonts>
<Font1>
<Name>Normal</Name>
<Outline>0,00</Outline>
<OutlineColorR>0,00</OutlineColorR>
<OutlineColorG>0,00</OutlineColorG>
<OutlineColorB>0,00</OutlineColorB>
<OutlineColorA>1,00</OutlineColorA>
<Folder>FreeSans</Folder>
<FileNormal>FreeSans.ttf</FileNormal>
<FileBold>FreeSansBold.ttf</FileBold>
<FileItalic>FreeSansOblique.ttf</FileItalic>
<FileBoldItalic>FreeSansBoldOblique.ttf</FileBoldItalic>
</Font1>
<Font2>
<Name>Outline</Name>
<Outline>0,10</Outline>
<OutlineColorR>0,00</OutlineColorR>
<OutlineColorG>0,00</OutlineColorG>
<OutlineColorB>0,00</OutlineColorB>
<OutlineColorA>1,00</OutlineColorA>
<Folder>FreeSans</Folder>
<FileNormal>FreeSans.ttf</FileNormal>
<FileBold>FreeSansBold.ttf</FileBold>
<FileItalic>FreeSansOblique.ttf</FileItalic>
<FileBoldItalic>FreeSansBoldOblique.ttf</FileBoldItalic>
</Font2>
</Fonts>
</root>
+1
View File
@@ -112,6 +112,7 @@
<string name="TR_SCREENSONG_BUTTON_SINGALL">Sing all songs</string>
<string name="TR_SCREENSONG_BUTTON_SINGALLVISIBLE">Sing all visible songs</string>
<string name="TR_SCREENSONG_BUTTON_OPENPLAYLIST">Open playlist</string>
<string name="TR_SCREENSONG_BUTTON_OPEN_SELECTED_ITEM">Select</string>
<string name="TR_SCREENSONG_BUTTON_RANDOMMEDLEY">Sing a random medley</string>
<string name="TR_SCREENSONG_BUTTON_STARTMEDLEY">Sing medley-songs</string>
<string name="TR_SCREENSONG_NEWPLAYLIST">New Playlist</string>
+1
View File
@@ -112,6 +112,7 @@
<string name="TR_SCREENSONG_BUTTON_SINGALL">Alle Songs singen</string>
<string name="TR_SCREENSONG_BUTTON_SINGALLVISIBLE">Alle sichtbaren Songs singen</string>
<string name="TR_SCREENSONG_BUTTON_OPENPLAYLIST">Playlist öffnen</string>
<string name="TR_SCREENSONG_BUTTON_OPEN_SELECTED_ITEM">Auswählen</string>
<string name="TR_SCREENSONG_BUTTON_RANDOMMEDLEY">Zufälliges Medley singen</string>
<string name="TR_SCREENSONG_BUTTON_STARTMEDLEY">Medley-Songs singen</string>
<string name="TR_SCREENSONG_NEWPLAYLIST">Neue Playlist</string>
@@ -1,29 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<root>
<Font1>
<Name>Normal</Name>
<Outline>0,00</Outline>
<OutlineColorR>0,00</OutlineColorR>
<OutlineColorG>0,00</OutlineColorG>
<OutlineColorB>0,00</OutlineColorB>
<OutlineColorA>1,00</OutlineColorA>
<Folder>FreeSans</Folder>
<FileNormal>FreeSans.ttf</FileNormal>
<FileBold>FreeSansBold.ttf</FileBold>
<FileItalic>FreeSansOblique.ttf</FileItalic>
<FileBoldItalic>FreeSansBoldOblique.ttf</FileBoldItalic>
</Font1>
<Font2>
<Name>Outline</Name>
<Outline>0,10</Outline>
<OutlineColorR>0,00</OutlineColorR>
<OutlineColorG>0,00</OutlineColorG>
<OutlineColorB>0,00</OutlineColorB>
<OutlineColorA>1,00</OutlineColorA>
<Folder>FreeSans</Folder>
<FileNormal>FreeSans.ttf</FileNormal>
<FileBold>FreeSansBold.ttf</FileBold>
<FileItalic>FreeSansOblique.ttf</FileItalic>
<FileBoldItalic>FreeSansBoldOblique.ttf</FileBoldItalic>
</Font2>
</root>
@@ -1,40 +0,0 @@
Congratulations, you have successfully downloaded font file!
This font is provided to you by Fonts2u.com – the largest online
repository of free fonts for Windows and Mac.
How to install this font on your computer?
For Windows 7 / Vista users:
- Right-click the font file(s) and choose "Install".
For users of the previous Windows versions:
- Copy the included file(s) into a default Windows font folder
(usually C:\WINDOWS\FONTS or C:\WINNT\FONTS)
For Mac users:
Mac OS X 10.3 or above (including the FontBook)
- Double-click the font file and hit "Install font" button at
the bottom of the preview.
Mac OS X
- Either copy the font file(s) to /Library/Fonts (for all users),
or to /Users/Your_username/Library/Fonts (for you only).
Mac OS 9 or earlier
- You have to convert the font file(s) you have downloaded.
Drag the font suitcases into the System folder. The system
will propose you to add them to the Fonts folder.
For Linux users:
- Copy the font file(s) to /USR/SHARE/FONTS
+4 -4
View File
@@ -6,14 +6,14 @@
<Author>brunzel</Author>
<Description>TR_PARTYMODE_DESCRIPTION</Description>
<Folder>ChallengeMedley</Folder>
<PartyModeFile>PartyModeChallenge</PartyModeFile>
<PartyModeFile>PartyModeChallengeMedley</PartyModeFile>
<PartyModeVersionMajor>0</PartyModeVersionMajor>
<PartyModeVersionMinor>1</PartyModeVersionMinor>
<TargetAudience>TR_PARTYMODE_AUDIENCE</TargetAudience>
</Info>
<PartyScreens>
<ScreenFile>PartyScreenChallengeMain</ScreenFile>
<ScreenFile>PartyScreenChallengeConfig</ScreenFile>
<ScreenFile>PartyScreenChallengeNames</ScreenFile>
<ScreenFile>PartyScreenChallengeMedleyMain</ScreenFile>
<ScreenFile>PartyScreenChallengeMedleyConfig</ScreenFile>
<ScreenFile>PartyScreenChallengeMedleyNames</ScreenFile>
</PartyScreens>
</root>
@@ -1,29 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<root>
<Font1>
<Name>Normal</Name>
<Outline>0,00</Outline>
<OutlineColorR>0,00</OutlineColorR>
<OutlineColorG>0,00</OutlineColorG>
<OutlineColorB>0,00</OutlineColorB>
<OutlineColorA>1,00</OutlineColorA>
<Folder>FreeSans</Folder>
<FileNormal>FreeSans.ttf</FileNormal>
<FileBold>FreeSansBold.ttf</FileBold>
<FileItalic>FreeSansOblique.ttf</FileItalic>
<FileBoldItalic>FreeSansBoldOblique.ttf</FileBoldItalic>
</Font1>
<Font2>
<Name>Outline</Name>
<Outline>0,10</Outline>
<OutlineColorR>0,00</OutlineColorR>
<OutlineColorG>0,00</OutlineColorG>
<OutlineColorB>0,00</OutlineColorB>
<OutlineColorA>1,00</OutlineColorA>
<Folder>FreeSans</Folder>
<FileNormal>FreeSans.ttf</FileNormal>
<FileBold>FreeSansBold.ttf</FileBold>
<FileItalic>FreeSansOblique.ttf</FileItalic>
<FileBoldItalic>FreeSansBoldOblique.ttf</FileBoldItalic>
</Font2>
</root>
@@ -1,40 +0,0 @@
Congratulations, you have successfully downloaded font file!
This font is provided to you by Fonts2u.com – the largest online
repository of free fonts for Windows and Mac.
How to install this font on your computer?
For Windows 7 / Vista users:
- Right-click the font file(s) and choose "Install".
For users of the previous Windows versions:
- Copy the included file(s) into a default Windows font folder
(usually C:\WINDOWS\FONTS or C:\WINNT\FONTS)
For Mac users:
Mac OS X 10.3 or above (including the FontBook)
- Double-click the font file and hit "Install font" button at
the bottom of the preview.
Mac OS X
- Either copy the font file(s) to /Library/Fonts (for all users),
or to /Users/Your_username/Library/Fonts (for you only).
Mac OS 9 or earlier
- You have to convert the font file(s) you have downloaded.
Drag the font suitcases into the System folder. The system
will propose you to add them to the Fonts folder.
For Linux users:
- Copy the font file(s) to /USR/SHARE/FONTS
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<PartyScreenChallengeConfig>
<PartyScreenChallengeMedleyConfig>
<ScreenVersion>1</ScreenVersion>
<Background1>
<!--<Type>: Background type: None, Color, Texture, Video-->
@@ -454,5 +454,5 @@
<!--<NumVisible>: Number of visible elements in the slide-->
<NumVisible>10</NumVisible>
</SelectSlideNumRounds>
</PartyScreenChallengeConfig>
</PartyScreenChallengeMedleyConfig>
</root>
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<PartyScreenChallengeMain>
<PartyScreenChallengeMedleyMain>
<ScreenVersion>1</ScreenVersion>
<Background1>
<!--<Type>: Background type: None, Color, Texture, Video-->
@@ -981,5 +981,5 @@
<!-- <Space>: Reflection Space of selected button-->
<!-- <Height>: Reflection Height of selected button-->
</ButtonRoundsScrollDown>
</PartyScreenChallengeMain>
</PartyScreenChallengeMedleyMain>
</root>
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<PartyScreenChallengeNames>
<PartyScreenChallengeMedleyNames>
<ScreenVersion>1</ScreenVersion>
<Background1>
<!--<Type>: Background type: None, Color, Texture, Video-->
@@ -270,5 +270,5 @@
<!-- <Space>: Reflection Space of selected button-->
<!-- <Height>: Reflection Height of selected button-->
</ButtonPlayerChoose>
</PartyScreenChallengeNames>
</PartyScreenChallengeMedleyNames>
</root>
@@ -1,29 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<root>
<Font1>
<Name>Normal</Name>
<Outline>0,00</Outline>
<OutlineColorR>0,00</OutlineColorR>
<OutlineColorG>0,00</OutlineColorG>
<OutlineColorB>0,00</OutlineColorB>
<OutlineColorA>1,00</OutlineColorA>
<Folder>FreeSans</Folder>
<FileNormal>FreeSans.ttf</FileNormal>
<FileBold>FreeSansBold.ttf</FileBold>
<FileItalic>FreeSansOblique.ttf</FileItalic>
<FileBoldItalic>FreeSansBoldOblique.ttf</FileBoldItalic>
</Font1>
<Font2>
<Name>Outline</Name>
<Outline>0,10</Outline>
<OutlineColorR>0,00</OutlineColorR>
<OutlineColorG>0,00</OutlineColorG>
<OutlineColorB>0,00</OutlineColorB>
<OutlineColorA>1,00</OutlineColorA>
<Folder>FreeSans</Folder>
<FileNormal>FreeSans.ttf</FileNormal>
<FileBold>FreeSansBold.ttf</FileBold>
<FileItalic>FreeSansOblique.ttf</FileItalic>
<FileBoldItalic>FreeSansBoldOblique.ttf</FileBoldItalic>
</Font2>
</root>
@@ -1,40 +0,0 @@
Congratulations, you have successfully downloaded font file!
This font is provided to you by Fonts2u.com – the largest online
repository of free fonts for Windows and Mac.
How to install this font on your computer?
For Windows 7 / Vista users:
- Right-click the font file(s) and choose "Install".
For users of the previous Windows versions:
- Copy the included file(s) into a default Windows font folder
(usually C:\WINDOWS\FONTS or C:\WINNT\FONTS)
For Mac users:
Mac OS X 10.3 or above (including the FontBook)
- Double-click the font file and hit "Install font" button at
the bottom of the preview.
Mac OS X
- Either copy the font file(s) to /Library/Fonts (for all users),
or to /Users/Your_username/Library/Fonts (for you only).
Mac OS 9 or earlier
- You have to convert the font file(s) you have downloaded.
Drag the font suitcases into the System folder. The system
will propose you to add them to the Fonts folder.
For Linux users:
- Copy the font file(s) to /USR/SHARE/FONTS
+19 -17
View File
@@ -109,39 +109,41 @@ Vocaluxe.exe -ConfigFile MyConfig.xml -ScoreFile C:\Vocaluxe\Highscores\MyHighsc
=================================
= 4. Controls =
=================================
[Mouse] to navigate through the screens: Left button: select/manipulate elements,
Right button: go to previous screen.
[Cursor] to navigate through the screens.
[Enter] to confirm
[Mouse] to navigate through the screens: Left button: select/manipulate elements,
Right button: go to previous screen.
[Cursor] to navigate through the screens.
[Enter] to confirm
[Escape] or [Back] to go to the previous screen.
[ALT] + [P] to take a ScreenShot. Screenshots are saved in the directory "Screenshots".
[ALT] + [P] to take a ScreenShot. Screenshots are saved in the directory "Screenshots".
[ALT] + [ENTER] to toggle full screen mode.
[SHIFT] + [F1] to toggle theme edit mode. The theme edit mode is experimental. It allows you
to change the size and position of the element on the screens. You can save
your changes with [S] before leaving the theme edit mode.
[TAB] to open the background music controls (not on all screens).
[TAB] to open the background music controls (not on all screens).
[SHIFT] + [+] to increase volume
[SHIFT] + [-] to decrease volume
Song screen
[F3] to open/close the song search menu
[SPACE] to open/close the song menu
[CTRL] + [R] to select a random song
[F3] to open/close the song search menu
[A] to sing all songs
[SHIFT] + [A] to sing all songs from a category
[SPACE] to open/close the song menu
[CTRL] + [A] to sing all songs
[CTRL] + [V] to sing all songs from a category
[NUM_1]..[NUM_6] to use a Joker for team 1..6
[A]..[Z] to jump to category/song title starting with that letter
Name selection screen
[1]..[6] to activate player selection.
[Cursor] to select a profile.
[Enter] to confirm a selection.
[1]..[6] to activate player selection.
[Cursor] to select a profile.
[Enter] to confirm a selection.
Sing screen
[P] to toggle pause.
[P] to toggle pause.
[CTRL] + [S] to skip a song if there is another one in the playlist.
[T] to change the time format of the timer.
[I] to change view of player information.
[W] to activate the configured webcam.
[T] to change the time format of the timer.
[I] to change view of player information.
[W] to activate the configured webcam.
=================================
+10 -10
View File
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<ScreenSong>
<ScreenVersion>4</ScreenVersion>
<ScreenVersion>5</ScreenVersion>
<Background1>
<!--<Type>: Background type: None, Color, Texture, Video-->
<Type>Video</Type>
@@ -954,7 +954,7 @@
<SkinSelected>Button</SkinSelected>
<!--<X>, <Y>, <Z>, <W>, <H>: Button position, width and height-->
<X>40</X>
<Y>135</Y>
<Y>225</Y>
<Z>-2,11</Z>
<W>360</W>
<H>40</H>
@@ -1003,7 +1003,7 @@
<SkinSelected>Button</SkinSelected>
<!--<X>, <Y>, <Z>, <W>, <H>: Button position, width and height-->
<X>40</X>
<Y>180</Y>
<Y>270</Y>
<Z>-2,11</Z>
<W>360</W>
<H>40</H>
@@ -1045,14 +1045,14 @@
<!-- <Space>: Reflection Space of selected button-->
<!-- <Height>: Reflection Height of selected button-->
</ButtonOptionsSingAllVisible>
<ButtonOptionsOpenPlaylist>
<ButtonOptionsOpenSelectedItem>
<!--<Skin>: Texture name-->
<Skin>Button</Skin>
<!--<SkinSelected>: Texture name for selected button-->
<SkinSelected>Button</SkinSelected>
<!--<X>, <Y>, <Z>, <W>, <H>: Button position, width and height-->
<X>40</X>
<Y>270</Y>
<Y>135</Y>
<Z>-2,11</Z>
<W>360</W>
<H>40</H>
@@ -1085,7 +1085,7 @@
<!--<Font>: Text font name-->
<Font>Outline</Font>
<!--<Text>: Nothing or translation tag-->
<Text>TR_SCREENSONG_BUTTON_OPENPLAYLIST</Text>
<Text>TR_SCREENSONG_BUTTON_OPEN_SELECTED_ITEM</Text>
</Text>
<!--<Reflection> If exists:-->
<!-- <Space>: Reflection Space-->
@@ -1093,7 +1093,7 @@
<!--<SReflection> If exists:-->
<!-- <Space>: Reflection Space of selected button-->
<!-- <Height>: Reflection Height of selected button-->
</ButtonOptionsOpenPlaylist>
</ButtonOptionsOpenSelectedItem>
<ButtonOpenOptions>
<!--<Skin>: Texture name-->
<Skin>Invisible</Skin>
@@ -1449,19 +1449,19 @@
<SkinHighlighted>SelectSlide</SkinHighlighted>
<!--<X>, <Y>, <Z>, <W>, <H>: SelectSlide position, width and height-->
<X>40</X>
<Y>225</Y>
<Y>180</Y>
<Z>-2,11</Z>
<W>360</W>
<H>40</H>
<!--<ArrowLeftX>, <ArrowLeftY>, <ArrowLeftZ>, <ArrowLeftW>, <ArrowLeftH>: Left arrow position, width and height-->
<ArrowLeftX>45</ArrowLeftX>
<ArrowLeftY>235</ArrowLeftY>
<ArrowLeftY>190</ArrowLeftY>
<ArrowLeftZ>-2,12</ArrowLeftZ>
<ArrowLeftW>30</ArrowLeftW>
<ArrowLeftH>30</ArrowLeftH>
<!--<ArrowRightX>, <ArrowRightY>, <ArrowRightZ>, <ArrowRightW>, <ArrowRightH>: Right arrow position, width and height-->
<ArrowRightX>365</ArrowRightX>
<ArrowRightY>235</ArrowRightY>
<ArrowRightY>190</ArrowRightY>
<ArrowRightZ>-2,12</ArrowRightZ>
<ArrowRightW>30</ArrowRightW>
<ArrowRightH>30</ArrowRightH>
@@ -1,5 +1,13 @@
ScreenSong
++++++++++
Version 5:
Add:
<ButtonOptionsOpenSelectedItem>
Remove:
ButtonOptionsOpenPlaylist
++++++++++
Version 4:
Binary file not shown.
+1
View File
@@ -0,0 +1 @@
GlobalSuppressions.cs
@@ -1,22 +1,19 @@
using System;
using System.Collections.Generic;
using System.Text;
using Vocaluxe.Menu;
namespace Vocaluxe.PartyModes
namespace VocaluxeLib.PartyModes.Challenge
{
public class ChallengeRounds
{
private Random _Rand;
private int _NumPlayer;
private readonly Random _Rand;
private readonly int _NumPlayer;
public List<Combination> Rounds;
public ChallengeRounds(int NumRounds, int NumPlayer, int NumPlayerAtOnce)
{
Rounds = new List<Combination>();
_Rand = new Random(System.DateTime.Now.Millisecond);
_Rand = new Random(DateTime.Now.Millisecond);
if (NumPlayerAtOnce < 1 || NumRounds < 1 || NumPlayer == 0)
_NumPlayer = 0;
@@ -41,26 +38,19 @@ namespace Vocaluxe.PartyModes
Rounds.Add(Combinations.GetNextCombination(null));
for (int i = 1; i < NumRounds; i++)
{
Rounds.Add(Combinations.GetNextCombination(GetPlayerDemand(i)));
}
}
private List<int> GetPlayerDemand(int RoundIndex)
{
List<int> NumPlayed = new List<int>(_NumPlayer);
for (int i = 0; i < _NumPlayer; i++)
{
NumPlayed.Add(0);
}
for (int i = 0; i < RoundIndex; i++)
{
foreach (int PlayerIndex in Rounds[i].Player)
{
NumPlayed[PlayerIndex]++;
}
}
int max = 0;
@@ -95,7 +85,6 @@ namespace Vocaluxe.PartyModes
}
else
last.Add(i);
}
}
@@ -129,17 +118,17 @@ namespace Vocaluxe.PartyModes
class Combinations
{
private List<Combination> _Combs;
private Random _Rand;
private int _NumPlayer;
private int _NumMics;
private readonly List<Combination> _Combs;
private readonly Random _Rand;
private readonly int _NumPlayer;
private readonly int _NumMics;
public Combinations(int NumPlayer, int NumMics, Random Rand)
{
_Combs = new List<Combination>();
_NumMics = NumMics;
_NumPlayer = NumPlayer;
_Rand = Rand;
_Rand = Rand;
}
public Combination GetNextCombination(List<int> PlayerNrDemand)
@@ -150,9 +139,7 @@ namespace Vocaluxe.PartyModes
Combination combs = new Combination();
if (_NumPlayer == _NumMics)
{
return _Combs[0];
}
//filter against PlayerNrDemand
List<Combination> combsFiltered = new List<Combination>();
@@ -179,18 +166,14 @@ namespace Vocaluxe.PartyModes
if (combsFiltered.Count == 0)
{
for (int i = 0; i < _Combs.Count; i++)
{
combsFiltered.Add(_Combs[i]);
}
}
int num = combsFiltered.Count;
int rand = _Rand.Next(num);
Combination c = new Combination();
for (int i = 0; i < combsFiltered[rand].Player.Count; i++)
{
c.Player.Add(combsFiltered[rand].Player[i]);
}
_Combs.Remove(combsFiltered[rand]);
return combsFiltered[rand];
@@ -209,9 +192,7 @@ namespace Vocaluxe.PartyModes
for (int j = 0; j < _NumPlayer; j++)
{
if ((i & (1 << j)) > 0)
{
c.Player.Add(j);
}
}
if (c.Player.Count == _NumMics)
@@ -243,9 +224,7 @@ namespace Vocaluxe.PartyModes
{
bool result = true;
foreach (int p in PlayerIndices)
{
result &= IsAvailable(p);
}
return result;
}
@@ -253,10 +232,8 @@ namespace Vocaluxe.PartyModes
{
bool result = false;
foreach (int p in PlayerIndices)
{
result |= IsAvailable(p);
}
return result;
}
}
}
}
Binary file not shown.
@@ -1,12 +1,15 @@
using System;
using System.Collections.Generic;
using System.Text;
using System.Runtime.InteropServices;
using VocaluxeLib.Menu;
using Vocaluxe.Menu;
[assembly: ComVisible(false)]
namespace Vocaluxe.PartyModes
namespace VocaluxeLib.PartyModes.Challenge
{
#region Communication
#region ToScreen
public struct DataToScreenConfig
{
@@ -52,9 +55,7 @@ namespace Vocaluxe.PartyModes
{
res = row.NumSingPoints.CompareTo(NumSingPoints);
if (res == 0)
{
res = row.NumWon.CompareTo(NumWon);
}
}
return res;
}
@@ -62,7 +63,6 @@ namespace Vocaluxe.PartyModes
throw new ArgumentException("object is not a ResultTableRow");
}
}
#endregion ToScreen
#region FromScreen
@@ -93,6 +93,7 @@ namespace Vocaluxe.PartyModes
public bool FadeToNameSelection;
}
#endregion FromScreen
#endregion Communication
public sealed class PartyModeChallenge : CPartyMode
@@ -103,7 +104,7 @@ namespace Vocaluxe.PartyModes
private const int MinTeams = 0;
private const int MaxNumRounds = 100;
enum EStage
private enum EStage
{
NotStarted,
Config,
@@ -112,7 +113,7 @@ namespace Vocaluxe.PartyModes
Singing
}
struct Data
private struct Data
{
public int NumPlayer;
public int NumPlayerAtOnce;
@@ -128,7 +129,7 @@ namespace Vocaluxe.PartyModes
public int[] CatSongIndices;
}
struct Stats
private struct Stats
{
public int ProfileID;
public int SingPoints;
@@ -148,13 +149,13 @@ namespace Vocaluxe.PartyModes
_ScreenSongOptions.Selection.RandomOnly = false;
_ScreenSongOptions.Selection.PartyMode = true;
_ScreenSongOptions.Selection.CategoryChangeAllowed = true;
_ScreenSongOptions.Selection.NumJokers = new int[] { 5, 5 };
_ScreenSongOptions.Selection.TeamNames = new string[] { "foo", "bar" };
_ScreenSongOptions.Selection.NumJokers = new int[] {5, 5};
_ScreenSongOptions.Selection.TeamNames = new string[] {"foo", "bar"};
_ScreenSongOptions.Sorting.SearchString = String.Empty;
_ScreenSongOptions.Sorting.SearchActive = false;
_ScreenSongOptions.Sorting.ShowDuetSongs = false;
_ScreenSongOptions.Sorting.DuetOptions = EDuetOptions.NoDuets;
_Stage = EStage.NotStarted;
ToScreenConfig = new DataToScreenConfig();
@@ -195,7 +196,7 @@ namespace Vocaluxe.PartyModes
switch (ScreenName)
{
case "PartyScreenChallengeConfig":
try
{
data = (DataFromScreen)Data;
@@ -327,10 +328,8 @@ namespace Vocaluxe.PartyModes
Screen.DataToScreen(ToScreenMain);
}
break;
default:
break;
}
return Screen;
}
@@ -441,7 +440,6 @@ namespace Vocaluxe.PartyModes
public override void SongSelected(int SongID)
{
EGameMode gm = EGameMode.TR_GAMEMODE_NORMAL;
CBase.Game.Reset();
@@ -503,30 +501,30 @@ namespace Vocaluxe.PartyModes
switch (GameData.NumPlayerAtOnce)
{
case 1:
_ScreenSongOptions.Selection.NumJokers = new int[] { 10 };
_ScreenSongOptions.Selection.NumJokers = new int[] {10};
break;
case 2:
_ScreenSongOptions.Selection.NumJokers = new int[] { 5, 5 };
_ScreenSongOptions.Selection.NumJokers = new int[] {5, 5};
break;
case 3:
_ScreenSongOptions.Selection.NumJokers = new int[] { 4, 4, 4 };
_ScreenSongOptions.Selection.NumJokers = new int[] {4, 4, 4};
break;
case 4:
_ScreenSongOptions.Selection.NumJokers = new int[] { 3, 3, 3, 3 };
_ScreenSongOptions.Selection.NumJokers = new int[] {3, 3, 3, 3};
break;
case 5:
_ScreenSongOptions.Selection.NumJokers = new int[] { 2, 2, 2, 2, 2 };
_ScreenSongOptions.Selection.NumJokers = new int[] {2, 2, 2, 2, 2};
break;
case 6:
_ScreenSongOptions.Selection.NumJokers = new int[] { 2, 2, 2, 2, 2, 2 };
_ScreenSongOptions.Selection.NumJokers = new int[] {2, 2, 2, 2, 2, 2};
break;
default:
_ScreenSongOptions.Selection.NumJokers = new int[] { 5, 5 };
_ScreenSongOptions.Selection.NumJokers = new int[] {5, 5};
break;
}
}
@@ -537,16 +535,16 @@ namespace Vocaluxe.PartyModes
if (profiles == null)
{
_ScreenSongOptions.Selection.TeamNames = new string[] { "foo", "bar" };
_ScreenSongOptions.Selection.TeamNames = new string[] {"foo", "bar"};
return;
}
if (GameData.NumPlayerAtOnce < 1 || GameData.ProfileIDs.Count < GameData.NumPlayerAtOnce || profiles.Length < GameData.NumPlayerAtOnce)
{
_ScreenSongOptions.Selection.TeamNames = new string[] { "foo", "bar" };
_ScreenSongOptions.Selection.TeamNames = new string[] {"foo", "bar"};
return;
}
_ScreenSongOptions.Selection.TeamNames = new string[GameData.NumPlayerAtOnce];
Combination c = GameData.Rounds.GetRound(GameData.CurrentRoundNr - 1);
@@ -580,13 +578,11 @@ namespace Vocaluxe.PartyModes
GameData.ResultTable.Add(row);
}
GameData.Results = new int[GameData.NumRounds, GameData.NumPlayerAtOnce];
GameData.Results = new int[GameData.NumRounds,GameData.NumPlayerAtOnce];
for (int i = 0; i < GameData.NumRounds; i++)
{
for (int j = 0; j < GameData.NumPlayerAtOnce; j++)
{
GameData.Results[i, j] = 0;
}
}
}
else
@@ -599,9 +595,7 @@ namespace Vocaluxe.PartyModes
return;
for (int j = 0; j < GameData.NumPlayerAtOnce; j++)
{
GameData.Results[GameData.CurrentRoundNr - 2, j] = (int)Math.Round(results[j].Points);
}
List<Stats> points = GetPointsForPlayer(results);
@@ -609,13 +603,13 @@ namespace Vocaluxe.PartyModes
{
int index = -1;
for (int j = 0; j < GameData.ResultTable.Count; j++)
{
{
if (points[i].ProfileID == GameData.ResultTable[j].PlayerID)
{
index = j;
break;
}
}
}
if (index != -1)
{
@@ -638,7 +632,7 @@ namespace Vocaluxe.PartyModes
int pos = 1;
int lastPoints = 0;
int lastSingPoints = 0;
for (int i = 0; i < GameData.ResultTable.Count; i++ )
for (int i = 0; i < GameData.ResultTable.Count; i++)
{
if (lastPoints > GameData.ResultTable[i].NumGamePoints || lastSingPoints > GameData.ResultTable[i].NumSingPoints)
pos++;
@@ -651,7 +645,7 @@ namespace Vocaluxe.PartyModes
private List<Stats> GetPointsForPlayer(SPlayer[] Results)
{
List<Stats> result = new List<Stats>();
for(int i = 0; i < GameData.NumPlayerAtOnce; i++)
for (int i = 0; i < GameData.NumPlayerAtOnce; i++)
{
Stats stat = new Stats();
stat.ProfileID = Results[i].ProfileID;
@@ -698,7 +692,6 @@ namespace Vocaluxe.PartyModes
}
return result;
}
@@ -708,11 +701,9 @@ namespace Vocaluxe.PartyModes
{
GameData.CatSongIndices = new int[CBase.Songs.GetNumCategories()];
for (int i = 0; i < GameData.CatSongIndices.Length; i++)
{
GameData.CatSongIndices[i] = -1;
}
}
if (CBase.Songs.GetNumCategories() == 0 || _ScreenSongOptions.Sorting.Tabs == EOffOn.TR_CONFIG_OFF)
GameData.CatSongIndices = null;
}
@@ -8,8 +8,8 @@
<ProjectGuid>{5A4053F1-5AD5-441F-B254-D97A088127B6}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>PartyModeChallenge</RootNamespace>
<AssemblyName>PartyModeChallenge</AssemblyName>
<RootNamespace>VocaluxeLib.PartyModes.Challenge</RootNamespace>
<AssemblyName>Challenge</AssemblyName>
<TargetFrameworkVersion>v2.0</TargetFrameworkVersion>
<TargetFrameworkProfile>
</TargetFrameworkProfile>
@@ -20,7 +20,7 @@
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>..\..\Output\PartyModes\Challenge\Code</OutputPath>
<OutputPath>bin</OutputPath>
<DefineConstants>TRACE;DEBUG;WIN</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
@@ -30,7 +30,7 @@
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugType>none</DebugType>
<Optimize>true</Optimize>
<OutputPath>..\..\Output\PartyModes\Challenge\Code</OutputPath>
<OutputPath>bin</OutputPath>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<UseVSHostingProcess>false</UseVSHostingProcess>
@@ -42,17 +42,18 @@
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>..\..\Output\PartyModes\Challenge\Code</OutputPath>
<OutputPath>bin</OutputPath>
<DefineConstants>TRACE;DEBUG;WIN</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<GenerateSerializationAssemblies>Off</GenerateSerializationAssemblies>
<CodeAnalysisRuleSet>..\..\CheckingRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'ReleaseWin|x64'">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugType>none</DebugType>
<Optimize>true</Optimize>
<OutputPath>..\..\Output\PartyModes\Challenge\Code</OutputPath>
<OutputPath>bin</OutputPath>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<UseVSHostingProcess>false</UseVSHostingProcess>
@@ -64,7 +65,7 @@
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>..\..\Output\PartyModes\Challenge\Code</OutputPath>
<OutputPath>bin</OutputPath>
<DefineConstants>TRACE;DEBUG;LINUX</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
@@ -74,7 +75,7 @@
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugType>none</DebugType>
<Optimize>true</Optimize>
<OutputPath>..\..\Output\PartyModes\Challenge\Code</OutputPath>
<OutputPath>bin</OutputPath>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<UseVSHostingProcess>false</UseVSHostingProcess>
@@ -86,7 +87,7 @@
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>..\..\Output\PartyModes\Challenge\Code</OutputPath>
<OutputPath>bin</OutputPath>
<DefineConstants>TRACE;DEBUG;LINUX</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
@@ -96,7 +97,7 @@
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugType>none</DebugType>
<Optimize>true</Optimize>
<OutputPath>..\..\Output\PartyModes\Challenge\Code</OutputPath>
<OutputPath>bin</OutputPath>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<UseVSHostingProcess>false</UseVSHostingProcess>
@@ -107,21 +108,12 @@
<StartupObject />
</PropertyGroup>
<ItemGroup>
<Compile Include="ChallengeRounds.cs">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Compile>
<Compile Include="PartyModeChallenge.cs">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Compile>
<Compile Include="PartyScreenChallengeConfig.cs">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Compile>
<Compile Include="PartyScreenChallengeMain.cs">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Compile>
<Compile Include="PartyScreenChallengeNames.cs">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Compile>
<Compile Include="ChallengeRounds.cs" />
<Compile Include="GlobalSuppressions.cs" />
<Compile Include="PartyModeChallenge.cs" />
<Compile Include="PartyScreenChallengeConfig.cs" />
<Compile Include="PartyScreenChallengeMain.cs" />
<Compile Include="PartyScreenChallengeNames.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\VocaluxeLib\VocaluxeLib.csproj">
@@ -137,7 +129,14 @@
<Reference Include="System.Windows.Forms" />
<Reference Include="System.XML" />
</ItemGroup>
<ItemGroup>
<Folder Include="Properties\" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<PropertyGroup>
<PostBuildEvent>cd $(SolutionDir)Partymodes\
xcopy "$(ProjectDir)*.cs" "$(SolutionDir)Output\PartyModes\$(TargetName)\Code\" /EXCLUDE:Excludes.txt /I /Y</PostBuildEvent>
</PropertyGroup>
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
@@ -1,41 +1,35 @@
using System;
using System.Collections.Generic;
using System.Text;
using System.Windows.Forms;
using VocaluxeLib.Menu;
using Vocaluxe.Menu;
namespace Vocaluxe.PartyModes
namespace VocaluxeLib.PartyModes.Challenge
{
public class PartyScreenChallengeConfig : CMenuParty
{
// Version number for theme files. Increment it, if you've changed something on the theme files!
const int ScreenVersion = 1;
protected override int _ScreenVersion
{
get { return 1; }
}
const string SelectSlideNumPlayers = "SelectSlideNumPlayers";
const string SelectSlideNumMics = "SelectSlideNumMics";
const string SelectSlideNumRounds = "SelectSlideNumRounds";
const string ButtonNext = "ButtonNext";
const string ButtonBack = "ButtonBack";
private const string SelectSlideNumPlayers = "SelectSlideNumPlayers";
private const string SelectSlideNumMics = "SelectSlideNumMics";
private const string SelectSlideNumRounds = "SelectSlideNumRounds";
private const string ButtonNext = "ButtonNext";
private const string ButtonBack = "ButtonBack";
private int _MaxNumMics = 2;
private int _MaxNumRounds = 100;
private int _RoundSteps = 1;
DataFromScreen Data;
private DataFromScreen Data;
public PartyScreenChallengeConfig()
{
}
protected override void Init()
public override void Init()
{
base.Init();
_ThemeName = "PartyScreenChallengeConfig";
_ThemeSelectSlides = new string[] { SelectSlideNumPlayers, SelectSlideNumMics, SelectSlideNumRounds };
_ThemeButtons = new string[] { ButtonNext, ButtonBack };
_ScreenVersion = ScreenVersion;
_ThemeSelectSlides = new string[] {SelectSlideNumPlayers, SelectSlideNumMics, SelectSlideNumRounds};
_ThemeButtons = new string[] {ButtonNext, ButtonBack};
Data = new DataFromScreen();
FromScreenConfig config = new FromScreenConfig();
@@ -45,11 +39,6 @@ namespace Vocaluxe.PartyModes
Data.ScreenConfig = config;
}
public override void LoadTheme(string XmlPath)
{
base.LoadTheme(XmlPath);
}
public override void DataToScreen(object ReceivedData)
{
DataToScreenConfig config = new DataToScreenConfig();
@@ -63,22 +52,18 @@ namespace Vocaluxe.PartyModes
}
catch (Exception e)
{
CBase.Log.LogError("Error in party mode screen challenge config. Can't cast received data from game mode " + _ThemeName + ". " + e.Message);;
CBase.Log.LogError("Error in party mode screen challenge config. Can't cast received data from game mode " + ThemeName + ". " + e.Message);
}
}
public override bool HandleInput(KeyEvent KeyEvent)
public override bool HandleInput(KeyEvent keyEvent)
{
base.HandleInput(KeyEvent);
base.HandleInput(keyEvent);
if (KeyEvent.KeyPressed)
{
}
if (keyEvent.KeyPressed) {}
else
{
switch (KeyEvent.Key)
switch (keyEvent.Key)
{
case Keys.Back:
case Keys.Escape:
@@ -88,10 +73,10 @@ namespace Vocaluxe.PartyModes
case Keys.Enter:
UpdateSlides();
if (Buttons[htButtons(ButtonBack)].Selected)
if (Buttons[ButtonBack].Selected)
Back();
if (Buttons[htButtons(ButtonNext)].Selected)
if (Buttons[ButtonNext].Selected)
Next();
break;
@@ -107,24 +92,22 @@ namespace Vocaluxe.PartyModes
return true;
}
public override bool HandleMouse(MouseEvent MouseEvent)
public override bool HandleMouse(MouseEvent mouseEvent)
{
base.HandleMouse(MouseEvent);
base.HandleMouse(mouseEvent);
if (MouseEvent.LB && IsMouseOver(MouseEvent))
if (mouseEvent.LB && IsMouseOver(mouseEvent))
{
UpdateSlides();
if (Buttons[htButtons(ButtonBack)].Selected)
if (Buttons[ButtonBack].Selected)
Back();
if (Buttons[htButtons(ButtonNext)].Selected)
if (Buttons[ButtonNext].Selected)
Next();
}
if (MouseEvent.RB)
{
if (mouseEvent.RB)
Back();
}
return true;
}
@@ -153,33 +136,26 @@ namespace Vocaluxe.PartyModes
return true;
}
public override void OnClose()
{
base.OnClose();
}
private void RebuildSlides()
{
// build num player slide (min player ... max player);
SelectSlides[htSelectSlides(SelectSlideNumPlayers)].Clear();
SelectSlides[SelectSlideNumPlayers].Clear();
for (int i = _PartyMode.GetMinPlayer(); i <= _PartyMode.GetMaxPlayer(); i++)
{
SelectSlides[htSelectSlides(SelectSlideNumPlayers)].AddValue(i.ToString());
}
SelectSlides[htSelectSlides(SelectSlideNumPlayers)].Selection = Data.ScreenConfig.NumPlayer - _PartyMode.GetMinPlayer();
SelectSlides[SelectSlideNumPlayers].AddValue(i.ToString());
SelectSlides[SelectSlideNumPlayers].Selection = Data.ScreenConfig.NumPlayer - _PartyMode.GetMinPlayer();
UpdateMicsAtOnce();
SetRoundSteps();
UpdateSlideRounds();
}
}
private void UpdateSlides()
{
int player = Data.ScreenConfig.NumPlayer;
int mics = Data.ScreenConfig.NumPlayerAtOnce;
Data.ScreenConfig.NumPlayer = SelectSlides[htSelectSlides(SelectSlideNumPlayers)].Selection + _PartyMode.GetMinPlayer();
Data.ScreenConfig.NumPlayerAtOnce = SelectSlides[htSelectSlides(SelectSlideNumMics)].Selection + _PartyMode.GetMinPlayer();
Data.ScreenConfig.NumRounds = (SelectSlides[htSelectSlides(SelectSlideNumRounds)].Selection + 1) * _RoundSteps;
Data.ScreenConfig.NumPlayer = SelectSlides[SelectSlideNumPlayers].Selection + _PartyMode.GetMinPlayer();
Data.ScreenConfig.NumPlayerAtOnce = SelectSlides[SelectSlideNumMics].Selection + _PartyMode.GetMinPlayer();
Data.ScreenConfig.NumRounds = (SelectSlides[SelectSlideNumRounds].Selection + 1) * _RoundSteps;
UpdateMicsAtOnce();
SetRoundSteps();
@@ -188,13 +164,11 @@ namespace Vocaluxe.PartyModes
{
int num = CHelper.nCk(Data.ScreenConfig.NumPlayer, Data.ScreenConfig.NumPlayerAtOnce);
while (num > _MaxNumRounds)
{
num -= _RoundSteps;
}
Data.ScreenConfig.NumRounds = num;
}
UpdateSlideRounds();
UpdateSlideRounds();
}
private void UpdateMicsAtOnce()
@@ -208,23 +182,19 @@ namespace Vocaluxe.PartyModes
Data.ScreenConfig.NumPlayerAtOnce = MaxNum;
// build mics at once slide
SelectSlides[htSelectSlides(SelectSlideNumMics)].Clear();
SelectSlides[SelectSlideNumMics].Clear();
for (int i = 1; i <= MaxNum; i++)
{
SelectSlides[htSelectSlides(SelectSlideNumMics)].AddValue(i.ToString());
}
SelectSlides[htSelectSlides(SelectSlideNumMics)].Selection = Data.ScreenConfig.NumPlayerAtOnce - _PartyMode.GetMinPlayer();
SelectSlides[SelectSlideNumMics].AddValue(i.ToString());
SelectSlides[SelectSlideNumMics].Selection = Data.ScreenConfig.NumPlayerAtOnce - _PartyMode.GetMinPlayer();
}
private void UpdateSlideRounds()
{
// build num rounds slide
SelectSlides[htSelectSlides(SelectSlideNumRounds)].Clear();
SelectSlides[SelectSlideNumRounds].Clear();
for (int i = _RoundSteps; i <= _MaxNumRounds; i += _RoundSteps)
{
SelectSlides[htSelectSlides(SelectSlideNumRounds)].AddValue(i.ToString());
}
SelectSlides[htSelectSlides(SelectSlideNumRounds)].Selection = Data.ScreenConfig.NumRounds / _RoundSteps - 1;
SelectSlides[SelectSlideNumRounds].AddValue(i.ToString());
SelectSlides[SelectSlideNumRounds].Selection = Data.ScreenConfig.NumRounds / _RoundSteps - 1;
}
private void SetRoundSteps()
@@ -241,7 +211,7 @@ namespace Vocaluxe.PartyModes
if (mod == 0)
_RoundSteps = res;
else
_RoundSteps = Data.ScreenConfig.NumPlayer;
_RoundSteps = Data.ScreenConfig.NumPlayer;
}
private void Back()
@@ -251,7 +221,7 @@ namespace Vocaluxe.PartyModes
private void Next()
{
_PartyMode.DataFromScreen(_ThemeName, Data);
_PartyMode.DataFromScreen(ThemeName, Data);
}
}
}
}
@@ -1,11 +1,9 @@
using System;
using System.Collections.Generic;
using System.Text;
using System.Windows.Forms;
using VocaluxeLib.Menu;
using Vocaluxe.Menu;
namespace Vocaluxe.PartyModes
namespace VocaluxeLib.PartyModes.Challenge
{
struct TableRow
{
@@ -24,41 +22,43 @@ namespace Vocaluxe.PartyModes
public List<CText> TextScores;
}
public class PartyScreenChallengeMain : CMenuParty
{
// Version number for theme files. Increment it, if you've changed something on the theme files!
const int ScreenVersion = 1;
protected override int _ScreenVersion
{
get { return 1; }
}
const string TextPosition = "TextPosition";
const string TextPlayerName = "TextPlayerName";
const string TextNumPlayed = "TextNumPlayed";
const string TextWon = "TextWon";
const string TextSingPoints = "TextSingPoints";
const string TextGamePoints = "TextGamePoints";
const string TextNextPlayer = "TextNextPlayer";
const string TextPopupReallyExit = "TextPopupReallyExit";
const string TextRoundPlayer = "TextRoundPlayer";
const string TextRoundScore = "TextRoundScore";
const string TextRoundNumber = "TextRoundNumber";
const string TextFinishMessage = "TextFinishMessage";
const string TextFinishPlayerWin = "TextFinishPlayerWin";
const string TextNextPlayerMessage = "TextNextPlayerMessage";
private const string TextPosition = "TextPosition";
private const string TextPlayerName = "TextPlayerName";
private const string TextNumPlayed = "TextNumPlayed";
private const string TextWon = "TextWon";
private const string TextSingPoints = "TextSingPoints";
private const string TextGamePoints = "TextGamePoints";
private const string TextNextPlayer = "TextNextPlayer";
private const string TextPopupReallyExit = "TextPopupReallyExit";
private const string TextRoundPlayer = "TextRoundPlayer";
private const string TextRoundScore = "TextRoundScore";
private const string TextRoundNumber = "TextRoundNumber";
private const string TextFinishMessage = "TextFinishMessage";
private const string TextFinishPlayerWin = "TextFinishPlayerWin";
private const string TextNextPlayerMessage = "TextNextPlayerMessage";
const string ButtonNextRound = "ButtonNextRound";
const string ButtonBack = "ButtonBack";
const string ButtonExit = "ButtonExit";
const string ButtonPopupYes = "ButtonPopupYes";
const string ButtonPopupNo = "ButtonPopupNo";
const string ButtonPlayerScrollUp = "ButtonPlayerScrollUp";
const string ButtonPlayerScrollDown = "ButtonPlayerScrollDown";
const string ButtonRoundsScrollUp = "ButtonRoundsScrollUp";
const string ButtonRoundsScrollDown = "ButtonRoundsScrollDown";
private const string ButtonNextRound = "ButtonNextRound";
private const string ButtonBack = "ButtonBack";
private const string ButtonExit = "ButtonExit";
private const string ButtonPopupYes = "ButtonPopupYes";
private const string ButtonPopupNo = "ButtonPopupNo";
private const string ButtonPlayerScrollUp = "ButtonPlayerScrollUp";
private const string ButtonPlayerScrollDown = "ButtonPlayerScrollDown";
private const string ButtonRoundsScrollUp = "ButtonRoundsScrollUp";
private const string ButtonRoundsScrollDown = "ButtonRoundsScrollDown";
const string StaticPopupBG = "StaticPopupBG";
const string StaticNextPlayer = "StaticNextPlayer";
private const string StaticPopupBG = "StaticPopupBG";
private const string StaticNextPlayer = "StaticNextPlayer";
private bool ExitPopupVisible = false;
private bool ExitPopupVisible;
private DataFromScreen Data;
private DataToScreenMain GameState;
@@ -70,8 +70,8 @@ namespace Vocaluxe.PartyModes
private SRectF RoundsTableScrollArea;
private SRectF PlayerTableScrollArea;
private int RoundsTableOffset = 0;
private int PlayerTableOffset = 0;
private int RoundsTableOffset;
private int PlayerTableOffset;
private int NumPlayerVisible = 10;
private int NumRoundsVisible = 3;
@@ -81,20 +81,23 @@ namespace Vocaluxe.PartyModes
Data.ScreenMain = new FromScreenMain();
}
protected override void Init()
public override void Init()
{
base.Init();
_ThemeName = "PartyScreenChallengeMain";
_ThemeTexts = new string[] { TextPosition, TextPlayerName, TextNumPlayed, TextWon, TextSingPoints, TextGamePoints, TextNextPlayer, TextPopupReallyExit, TextRoundNumber, TextRoundPlayer, TextRoundScore, TextFinishMessage, TextFinishPlayerWin, TextNextPlayerMessage };
_ThemeButtons = new string[] { ButtonNextRound, ButtonBack, ButtonExit, ButtonPopupYes, ButtonPopupNo, ButtonPlayerScrollDown, ButtonPlayerScrollUp, ButtonRoundsScrollDown, ButtonRoundsScrollUp };
_ThemeStatics = new string[] { StaticPopupBG, StaticNextPlayer };
_ScreenVersion = ScreenVersion;
_ThemeTexts = new string[]
{
TextPosition, TextPlayerName, TextNumPlayed, TextWon, TextSingPoints, TextGamePoints, TextNextPlayer, TextPopupReallyExit, TextRoundNumber, TextRoundPlayer,
TextRoundScore, TextFinishMessage, TextFinishPlayerWin, TextNextPlayerMessage
};
_ThemeButtons = new string[]
{ButtonNextRound, ButtonBack, ButtonExit, ButtonPopupYes, ButtonPopupNo, ButtonPlayerScrollDown, ButtonPlayerScrollUp, ButtonRoundsScrollDown, ButtonRoundsScrollUp};
_ThemeStatics = new string[] {StaticPopupBG, StaticNextPlayer};
}
public override void LoadTheme(string XmlPath)
{
base.LoadTheme(XmlPath);
base.LoadTheme(XmlPath);
GameState = new DataToScreenMain();
BuildPlayerTable();
@@ -104,9 +107,9 @@ namespace Vocaluxe.PartyModes
for (int i = 0; i < _PartyMode.GetMaxPlayer(); i++)
{
NextPlayerTexts.Add(GetNewText(Texts[htTexts(TextNextPlayer)]));
NextPlayerTexts.Add(GetNewText(Texts[TextNextPlayer]));
AddText(NextPlayerTexts[NextPlayerTexts.Count - 1]);
NextPlayerStatics.Add(GetNewStatic(Statics[htStatics(StaticNextPlayer)]));
NextPlayerStatics.Add(GetNewStatic(Statics[StaticNextPlayer]));
AddStatic(NextPlayerStatics[NextPlayerStatics.Count - 1]);
}
}
@@ -122,30 +125,28 @@ namespace Vocaluxe.PartyModes
}
catch (Exception e)
{
CBase.Log.LogError("Error in party mode screen challenge main. Can't cast received data from game mode " + _ThemeName + ". " + e.Message); ;
CBase.Log.LogError("Error in party mode screen challenge main. Can't cast received data from game mode " + ThemeName + ". " + e.Message);
}
}
public override bool HandleInput(KeyEvent KeyEvent)
public override bool HandleInput(KeyEvent keyEvent)
{
base.HandleInput(KeyEvent);
base.HandleInput(keyEvent);
if (KeyEvent.KeyPressed)
{
}
if (keyEvent.KeyPressed) {}
else
{
switch (KeyEvent.Key)
switch (keyEvent.Key)
{
case Keys.Back:
case Keys.Escape:
if (!ExitPopupVisible)
{
if (GameState.CurrentRoundNr == 1)
Back();
else
ShowPopup(true);
}
else
ShowPopup(false);
break;
@@ -153,26 +154,26 @@ namespace Vocaluxe.PartyModes
case Keys.Enter:
if (!ExitPopupVisible)
{
if (Buttons[htButtons(ButtonNextRound)].Selected)
if (Buttons[ButtonNextRound].Selected)
NextRound();
if (Buttons[htButtons(ButtonBack)].Selected && GameState.CurrentRoundNr == 1)
if (Buttons[ButtonBack].Selected && GameState.CurrentRoundNr == 1)
Back();
if (Buttons[htButtons(ButtonExit)].Selected && GameState.CurrentRoundNr > 1)
if (Buttons[ButtonExit].Selected && GameState.CurrentRoundNr > 1)
ShowPopup(true);
if (Buttons[htButtons(ButtonPlayerScrollUp)].Selected)
if (Buttons[ButtonPlayerScrollUp].Selected)
ScrollPlayerTable(-1);
if (Buttons[htButtons(ButtonPlayerScrollDown)].Selected)
if (Buttons[ButtonPlayerScrollDown].Selected)
ScrollPlayerTable(1);
if (Buttons[htButtons(ButtonRoundsScrollUp)].Selected)
if (Buttons[ButtonRoundsScrollUp].Selected)
ScrollRoundsTable(-1);
if (Buttons[htButtons(ButtonRoundsScrollDown)].Selected)
if (Buttons[ButtonRoundsScrollDown].Selected)
ScrollRoundsTable(1);
}
else
{
if (Buttons[htButtons(ButtonPopupYes)].Selected)
if (Buttons[ButtonPopupYes].Selected)
EndParty();
if (Buttons[htButtons(ButtonPopupNo)].Selected)
if (Buttons[ButtonPopupNo].Selected)
ShowPopup(false);
}
break;
@@ -181,55 +182,57 @@ namespace Vocaluxe.PartyModes
return true;
}
public override bool HandleMouse(MouseEvent MouseEvent)
public override bool HandleMouse(MouseEvent mouseEvent)
{
base.HandleMouse(MouseEvent);
base.HandleMouse(mouseEvent);
if (MouseEvent.LB && IsMouseOver(MouseEvent))
if (mouseEvent.LB && IsMouseOver(mouseEvent))
{
if (!ExitPopupVisible)
{
if (Buttons[htButtons(ButtonNextRound)].Selected)
if (Buttons[ButtonNextRound].Selected)
NextRound();
if (Buttons[htButtons(ButtonBack)].Selected && GameState.CurrentRoundNr == 1)
if (Buttons[ButtonBack].Selected && GameState.CurrentRoundNr == 1)
Back();
if (Buttons[htButtons(ButtonExit)].Selected && GameState.CurrentRoundNr > 1)
if (Buttons[ButtonExit].Selected && GameState.CurrentRoundNr > 1)
ShowPopup(true);
if (Buttons[htButtons(ButtonPlayerScrollUp)].Selected)
if (Buttons[ButtonPlayerScrollUp].Selected)
ScrollPlayerTable(-1);
if (Buttons[htButtons(ButtonPlayerScrollDown)].Selected)
if (Buttons[ButtonPlayerScrollDown].Selected)
ScrollPlayerTable(1);
if (Buttons[htButtons(ButtonRoundsScrollUp)].Selected)
if (Buttons[ButtonRoundsScrollUp].Selected)
ScrollRoundsTable(-1);
if (Buttons[htButtons(ButtonRoundsScrollDown)].Selected)
if (Buttons[ButtonRoundsScrollDown].Selected)
ScrollRoundsTable(1);
}
else
{
if (Buttons[htButtons(ButtonPopupYes)].Selected)
if (Buttons[ButtonPopupYes].Selected)
EndParty();
if (Buttons[htButtons(ButtonPopupNo)].Selected)
if (Buttons[ButtonPopupNo].Selected)
ShowPopup(false);
}
}
if (MouseEvent.RB)
if (mouseEvent.RB)
{
if (!ExitPopupVisible)
{
if (GameState.CurrentRoundNr == 1)
Back();
else
ShowPopup(true);
}
else
ShowPopup(false);
}
if (MouseEvent.Wheel != 0)
if (mouseEvent.Wheel != 0)
{
if(CHelper.IsInBounds(RoundsTableScrollArea, MouseEvent))
ScrollRoundsTable(MouseEvent.Wheel);
if(CHelper.IsInBounds(PlayerTableScrollArea, MouseEvent))
ScrollPlayerTable(MouseEvent.Wheel);
if (CHelper.IsInBounds(RoundsTableScrollArea, mouseEvent))
ScrollRoundsTable(mouseEvent.Wheel);
if (CHelper.IsInBounds(PlayerTableScrollArea, mouseEvent))
ScrollPlayerTable(mouseEvent.Wheel);
}
return true;
@@ -253,29 +256,29 @@ namespace Vocaluxe.PartyModes
if (GameState.CurrentRoundNr == 1)
{
Buttons[htButtons(ButtonBack)].Visible = true;
Buttons[htButtons(ButtonExit)].Visible = false;
Buttons[ButtonBack].Visible = true;
Buttons[ButtonExit].Visible = false;
}
else
{
Buttons[htButtons(ButtonBack)].Visible = false;
Buttons[htButtons(ButtonExit)].Visible = true;
Buttons[ButtonBack].Visible = false;
Buttons[ButtonExit].Visible = true;
}
if (GameState.CurrentRoundNr <= GameState.Combs.Count)
{
Buttons[htButtons(ButtonNextRound)].Visible = true;
Texts[htTexts(TextFinishMessage)].Visible = false;
Texts[htTexts(TextFinishPlayerWin)].Visible = false;
SetInteractionToButton(Buttons[htButtons(ButtonNextRound)]);
Buttons[ButtonNextRound].Visible = true;
Texts[TextFinishMessage].Visible = false;
Texts[TextFinishPlayerWin].Visible = false;
SetInteractionToButton(Buttons[ButtonNextRound]);
}
else
{
Buttons[htButtons(ButtonNextRound)].Visible = false;
Texts[htTexts(TextFinishMessage)].Visible = true;
Texts[htTexts(TextFinishPlayerWin)].Visible = true;
Texts[htTexts(TextFinishPlayerWin)].Text = GetPlayerWinString();
SetInteractionToButton(Buttons[htButtons(ButtonExit)]);
Buttons[ButtonNextRound].Visible = false;
Texts[TextFinishMessage].Visible = true;
Texts[TextFinishPlayerWin].Visible = true;
Texts[TextFinishPlayerWin].Text = GetPlayerWinString();
SetInteractionToButton(Buttons[ButtonExit]);
}
ShowPopup(false);
@@ -292,16 +295,11 @@ namespace Vocaluxe.PartyModes
return true;
}
public override void OnClose()
{
base.OnClose();
}
private void NextRound()
{
Data.ScreenMain.FadeToNameSelection = false;
Data.ScreenMain.FadeToSongSelection = true;
_PartyMode.DataFromScreen(_ThemeName, Data);
_PartyMode.DataFromScreen(ThemeName, Data);
}
private void EndParty()
@@ -313,25 +311,25 @@ namespace Vocaluxe.PartyModes
{
ExitPopupVisible = Visible;
Statics[htStatics(StaticPopupBG)].Visible = ExitPopupVisible;
Texts[htTexts(TextPopupReallyExit)].Visible = ExitPopupVisible;
Buttons[htButtons(ButtonPopupYes)].Visible = ExitPopupVisible;
Buttons[htButtons(ButtonPopupNo)].Visible = ExitPopupVisible;
Statics[StaticPopupBG].Visible = ExitPopupVisible;
Texts[TextPopupReallyExit].Visible = ExitPopupVisible;
Buttons[ButtonPopupYes].Visible = ExitPopupVisible;
Buttons[ButtonPopupNo].Visible = ExitPopupVisible;
if (ExitPopupVisible)
SetInteractionToButton(Buttons[htButtons(ButtonPopupNo)]);
SetInteractionToButton(Buttons[ButtonPopupNo]);
}
private void Back()
{
Data.ScreenMain.FadeToNameSelection = true;
Data.ScreenMain.FadeToSongSelection = false;
_PartyMode.DataFromScreen(_ThemeName, Data);
_PartyMode.DataFromScreen(ThemeName, Data);
}
private void UpdateNextPlayerPositions()
{
float x = CBase.Settings.GetRenderW()/2 - ((GameState.NumPlayerAtOnce * Statics[htStatics(StaticNextPlayer)].Rect.W) + ((GameState.NumPlayerAtOnce-1) * 15))/2;
float x = CBase.Settings.GetRenderW() / 2 - ((GameState.NumPlayerAtOnce * Statics[StaticNextPlayer].Rect.W) + ((GameState.NumPlayerAtOnce - 1) * 15)) / 2;
float static_y = 590;
float text_y = 550;
for (int i = 0; i < GameState.NumPlayerAtOnce; i++)
@@ -341,11 +339,11 @@ namespace Vocaluxe.PartyModes
NextPlayerStatics[i].Rect.Y = static_y;
NextPlayerStatics[i].Visible = true;
//text
NextPlayerTexts[i].X = x + Statics[htStatics(StaticNextPlayer)].Rect.W / 2;
NextPlayerTexts[i].X = x + Statics[StaticNextPlayer].Rect.W / 2;
NextPlayerTexts[i].Y = text_y;
NextPlayerTexts[i].Visible = true;
x += Statics[htStatics(StaticNextPlayer)].Rect.W + 15;
x += Statics[StaticNextPlayer].Rect.W + 15;
}
for (int i = GameState.NumPlayerAtOnce; i < _PartyMode.GetMaxPlayer(); i++)
{
@@ -358,19 +356,19 @@ namespace Vocaluxe.PartyModes
{
if (GameState.CurrentRoundNr <= GameState.Combs.Count)
{
Texts[htTexts(TextNextPlayerMessage)].Visible = true;
Texts[TextNextPlayerMessage].Visible = true;
SProfile[] profiles = CBase.Profiles.GetProfiles();
for (int i = 0; i < GameState.NumPlayerAtOnce; i++)
{
int pid = GameState.Combs[GameState.CurrentRoundNr - 1].Player[i];
NextPlayerStatics[i].Texture = profiles[GameState.ProfileIDs[pid]].Avatar.Texture;
NextPlayerTexts[i].Text = profiles[GameState.ProfileIDs[pid]].PlayerName;
NextPlayerTexts[i].Color = CBase.Theme.GetPlayerColor((i + 1));
NextPlayerTexts[i].Color = CBase.Theme.GetPlayerColor(i + 1);
}
}
else
{
Texts[htTexts(TextNextPlayerMessage)].Visible = false;
Texts[TextNextPlayerMessage].Visible = false;
for (int i = 0; i < GameState.NumPlayerAtOnce; i++)
{
NextPlayerStatics[i].Visible = false;
@@ -394,7 +392,7 @@ namespace Vocaluxe.PartyModes
for (int round = 0; round < RoundsTable.Count; round++)
{
//Round-number
CText text = GetNewText(Texts[htTexts(TextRoundNumber)]);
CText text = GetNewText(Texts[TextRoundNumber]);
AddText(text);
RoundsTable[round].Number = text;
for (int row = 0; row < 2; row++)
@@ -402,11 +400,11 @@ namespace Vocaluxe.PartyModes
for (int column = 0; column < 3; column++)
{
//Player
text = GetNewText(Texts[htTexts(TextRoundPlayer)]);
text = GetNewText(Texts[TextRoundPlayer]);
AddText(text);
RoundsTable[round].TextPlayer.Add(text);
//Score
text = GetNewText(Texts[htTexts(TextRoundScore)]);
text = GetNewText(Texts[TextRoundScore]);
AddText(text);
RoundsTable[round].TextScores.Add(text);
}
@@ -427,14 +425,14 @@ namespace Vocaluxe.PartyModes
if (NumRoundsVisible > GameState.Combs.Count)
NumRoundsVisible = GameState.Combs.Count;
float x = Texts[htTexts(TextRoundNumber)].X;
float y = Texts[htTexts(TextRoundNumber)].Y;
float x = Texts[TextRoundNumber].X;
float y = Texts[TextRoundNumber].Y;
RoundsTableScrollArea.X = x;
RoundsTableScrollArea.Y = y;
RoundsTableScrollArea.W = CBase.Settings.GetRenderW() - Texts[htTexts(TextRoundNumber)].X - 20;
RoundsTableScrollArea.W = CBase.Settings.GetRenderW() - Texts[TextRoundNumber].X - 20;
float delta = Texts[htTexts(TextRoundNumber)].Height;
float delta = Texts[TextRoundNumber].Height;
//Update statics and texts for rounds
for (int round = 0; round < RoundsTable.Count; round++)
@@ -455,8 +453,9 @@ namespace Vocaluxe.PartyModes
for (int column = row * NumPlayerInOneRow; column < num; column++)
{
//Player
float _x = x + 15 + (CBase.Settings.GetRenderW() - Texts[htTexts(TextRoundNumber)].X - 20) / NumPlayerInThisRow * (column - row * NumPlayerInOneRow) + ((CBase.Settings.GetRenderW() - Texts[htTexts(TextRoundNumber)].X - 20) / NumPlayerInThisRow) / 2;
float maxw = ((CBase.Settings.GetRenderW() - Texts[htTexts(TextRoundNumber)].X - 20) / NumPlayerInThisRow) / 2 - 5;
float _x = x + 15 + (CBase.Settings.GetRenderW() - Texts[TextRoundNumber].X - 20) / NumPlayerInThisRow * (column - row * NumPlayerInOneRow) +
((CBase.Settings.GetRenderW() - Texts[TextRoundNumber].X - 20) / NumPlayerInThisRow) / 2;
float maxw = ((CBase.Settings.GetRenderW() - Texts[TextRoundNumber].X - 20) / NumPlayerInThisRow) / 2 - 5;
RoundsTable[round].TextPlayer[column].X = _x;
RoundsTable[round].TextPlayer[column].Y = y;
RoundsTable[round].TextPlayer[column].MaxWidth = maxw;
@@ -478,7 +477,7 @@ namespace Vocaluxe.PartyModes
SProfile[] profile = CBase.Profiles.GetProfiles();
for (int i = 0; i < RoundsTable.Count; i++)
{
for(int p = 0; p < RoundsTable[i].TextPlayer.Count; p++)
for (int p = 0; p < RoundsTable[i].TextPlayer.Count; p++)
{
if (GameState.Combs.Count > i + RoundsTableOffset && GameState.Combs[i + RoundsTableOffset].Player.Count > p)
{
@@ -506,23 +505,23 @@ namespace Vocaluxe.PartyModes
{
RoundsTable[i].TextPlayer[p].Visible = false;
RoundsTable[i].TextScores[p].Visible = false;
}
}
}
}
Buttons[htButtons(ButtonRoundsScrollUp)].Visible = RoundsTableOffset > 0;
Buttons[htButtons(ButtonRoundsScrollDown)].Visible = GameState.Combs.Count - NumRoundsVisible - RoundsTableOffset > 0;
Buttons[ButtonRoundsScrollUp].Visible = RoundsTableOffset > 0;
Buttons[ButtonRoundsScrollDown].Visible = GameState.Combs.Count - NumRoundsVisible - RoundsTableOffset > 0;
}
private void BuildPlayerTable()
{
PlayerTableScrollArea = new SRectF();
PlayerTableScrollArea.X = Texts[htTexts(TextPosition)].X;
PlayerTableScrollArea.Y = Texts[htTexts(TextPosition)].Y;
PlayerTableScrollArea.W = Texts[htTexts(TextGamePoints)].X - Texts[htTexts(TextPosition)].X;
PlayerTableScrollArea.X = Texts[TextPosition].X;
PlayerTableScrollArea.Y = Texts[TextPosition].Y;
PlayerTableScrollArea.W = Texts[TextGamePoints].X - Texts[TextPosition].X;
PlayerTable = new List<TableRow>();
float delta = Texts[htTexts(TextPosition)].Height * 1.2f;
float delta = Texts[TextPosition].Height * 1.2f;
float h = 0;
@@ -530,12 +529,12 @@ namespace Vocaluxe.PartyModes
{
TableRow row = new TableRow();
row.Pos = GetNewText(Texts[htTexts(TextPosition)]);
row.Name = GetNewText(Texts[htTexts(TextPlayerName)]);
row.Rounds = GetNewText(Texts[htTexts(TextNumPlayed)]);
row.Won = GetNewText(Texts[htTexts(TextWon)]);
row.SingPoints = GetNewText(Texts[htTexts(TextSingPoints)]);
row.GamePoints = GetNewText(Texts[htTexts(TextGamePoints)]);
row.Pos = GetNewText(Texts[TextPosition]);
row.Name = GetNewText(Texts[TextPlayerName]);
row.Rounds = GetNewText(Texts[TextNumPlayed]);
row.Won = GetNewText(Texts[TextWon]);
row.SingPoints = GetNewText(Texts[TextSingPoints]);
row.GamePoints = GetNewText(Texts[TextGamePoints]);
row.Pos.Y += delta * (i + 1);
row.Name.Y += delta * (i + 1);
@@ -575,7 +574,7 @@ namespace Vocaluxe.PartyModes
{
TableRow row = PlayerTable[i];
if (i+PlayerTableOffset < GameState.ResultTable.Count)
if (i + PlayerTableOffset < GameState.ResultTable.Count)
{
row.Pos.Visible = true;
row.Name.Visible = true;
@@ -585,11 +584,11 @@ namespace Vocaluxe.PartyModes
row.GamePoints.Visible = true;
row.Pos.Text = GameState.ResultTable[i + PlayerTableOffset].Position.ToString() + ".";
row.Name.Text = profiles[GameState.ResultTable[i+PlayerTableOffset].PlayerID].PlayerName;
row.Rounds.Text = GameState.ResultTable[i+PlayerTableOffset].NumRounds.ToString();
row.Won.Text = GameState.ResultTable[i+PlayerTableOffset].NumWon.ToString();
row.SingPoints.Text = GameState.ResultTable[i+PlayerTableOffset].NumSingPoints.ToString();
row.GamePoints.Text = GameState.ResultTable[i+PlayerTableOffset].NumGamePoints.ToString();
row.Name.Text = profiles[GameState.ResultTable[i + PlayerTableOffset].PlayerID].PlayerName;
row.Rounds.Text = GameState.ResultTable[i + PlayerTableOffset].NumRounds.ToString();
row.Won.Text = GameState.ResultTable[i + PlayerTableOffset].NumWon.ToString();
row.SingPoints.Text = GameState.ResultTable[i + PlayerTableOffset].NumSingPoints.ToString();
row.GamePoints.Text = GameState.ResultTable[i + PlayerTableOffset].NumGamePoints.ToString();
}
else
{
@@ -602,8 +601,8 @@ namespace Vocaluxe.PartyModes
}
}
Buttons[htButtons(ButtonPlayerScrollUp)].Visible = PlayerTableOffset > 0;
Buttons[htButtons(ButtonPlayerScrollDown)].Visible = GameState.ProfileIDs.Count - NumPlayerVisible - PlayerTableOffset > 0;
Buttons[ButtonPlayerScrollUp].Visible = PlayerTableOffset > 0;
Buttons[ButtonPlayerScrollDown].Visible = GameState.ProfileIDs.Count - NumPlayerVisible - PlayerTableOffset > 0;
}
private void ScrollPlayerTable(int Offset)
@@ -658,4 +657,4 @@ namespace Vocaluxe.PartyModes
return s;
}
}
}
}
@@ -1,21 +1,22 @@
using System;
using System.Collections.Generic;
using System.Text;
using System.Windows.Forms;
using VocaluxeLib.Menu;
using Vocaluxe.Menu;
namespace Vocaluxe.PartyModes
namespace VocaluxeLib.PartyModes.Challenge
{
public class PartyScreenChallengeNames : CMenuParty
{
// Version number for theme files. Increment it, if you've changed something on the theme files!
const int ScreenVersion = 1;
protected override int _ScreenVersion
{
get { return 1; }
}
const string ButtonNext = "ButtonNext";
const string ButtonBack = "ButtonBack";
const string ButtonPlayerDestination = "ButtonPlayerDestination";
const string ButtonPlayerChoose = "ButtonPlayerChoose";
private const string ButtonNext = "ButtonNext";
private const string ButtonBack = "ButtonBack";
private const string ButtonPlayerDestination = "ButtonPlayerDestination";
private const string ButtonPlayerChoose = "ButtonPlayerChoose";
private List<CPlayerChooseButton> PlayerChooseButtons;
private List<CButton> PlayerDestinationButtons;
@@ -37,14 +38,14 @@ namespace Vocaluxe.PartyModes
private int PlayerChooseButtonsOffset = 0;
private CStatic chooseAvatarStatic;
private bool SelectingMouseActive = false;
private int OldMouseX = 0;
private int OldMouseY = 0;
private bool SelectingMouseActive;
private int OldMouseX;
private int OldMouseY;
private int SelectedPlayerNr = -1;
private bool ButtonsAdded = false;
private bool ButtonsAdded;
private int NumPlayer = 4;
private DataFromScreen Data;
private class CPlayerChooseButton
@@ -53,11 +54,7 @@ namespace Vocaluxe.PartyModes
public int ProfileID;
}
public PartyScreenChallengeNames()
{
}
protected override void Init()
public override void Init()
{
base.Init();
@@ -68,10 +65,8 @@ namespace Vocaluxe.PartyModes
Data.ScreenNames.ProfileIDs = new List<int>();
_ThemeName = "PartyScreenChallengeNames";
List<string> buttons = new List<string>();
_ThemeButtons = new string[] { ButtonBack, ButtonNext, ButtonPlayerDestination, ButtonPlayerChoose };
_ScreenVersion = ScreenVersion;
_ThemeButtons = new string[] {ButtonBack, ButtonNext, ButtonPlayerDestination, ButtonPlayerChoose};
Data = new DataFromScreen();
FromScreenNames names = new FromScreenNames();
@@ -81,11 +76,6 @@ namespace Vocaluxe.PartyModes
Data.ScreenNames = names;
}
public override void LoadTheme(string XmlPath)
{
base.LoadTheme(XmlPath);
}
public override void DataToScreen(object ReceivedData)
{
DataToScreenNames config = new DataToScreenNames();
@@ -100,58 +90,50 @@ namespace Vocaluxe.PartyModes
NumPlayer = config.NumPlayer;
while (Data.ScreenNames.ProfileIDs.Count > NumPlayer)
{
Data.ScreenNames.ProfileIDs.RemoveAt(Data.ScreenNames.ProfileIDs.Count - 1);
}
}
catch (Exception e)
{
CBase.Log.LogError("Error in party mode screen challenge names. Can't cast received data from game mode " + _ThemeName + ". " + e.Message); ;
CBase.Log.LogError("Error in party mode screen challenge names. Can't cast received data from game mode " + ThemeName + ". " + e.Message);
}
}
public override bool HandleInput(KeyEvent KeyEvent)
public override bool HandleInput(KeyEvent keyEvent)
{
base.HandleInput(KeyEvent);
base.HandleInput(keyEvent);
if (KeyEvent.KeyPressed)
if (keyEvent.KeyPressed) {}
else
{
switch (keyEvent.Key)
{
case Keys.Back:
case Keys.Escape:
Back();
break;
}
else
{
switch (KeyEvent.Key)
{
case Keys.Back:
case Keys.Escape:
case Keys.Enter:
if (Buttons[ButtonBack].Selected)
Back();
break;
case Keys.Enter:
if (Buttons[htButtons(ButtonBack)].Selected)
Back();
if (Buttons[ButtonNext].Selected)
Next();
if (Buttons[htButtons(ButtonNext)].Selected)
Next();
if (!OnAdd())
OnRemove();
break;
case Keys.Delete:
if (!OnAdd())
OnRemove();
break;
}
break;
case Keys.Delete:
OnRemove();
break;
}
}
return true;
}
public override bool HandleMouse(MouseEvent MouseEvent)
public override bool HandleMouse(MouseEvent mouseEvent)
{
base.HandleMouse(MouseEvent);
base.HandleMouse(mouseEvent);
/*
//Check if LeftButton is hold and Select-Mode inactive
@@ -182,15 +164,15 @@ namespace Vocaluxe.PartyModes
}*/
//Check if LeftButton is hold and Select-Mode active
if (MouseEvent.LBH && SelectingMouseActive)
if (mouseEvent.LBH && SelectingMouseActive)
{
//Update coords for Drag/Drop-Texture
chooseAvatarStatic.Rect.X += (MouseEvent.X - OldMouseX);
chooseAvatarStatic.Rect.Y += (MouseEvent.Y - OldMouseY);
OldMouseX = MouseEvent.X;
OldMouseY = MouseEvent.Y;
chooseAvatarStatic.Rect.X += mouseEvent.X - OldMouseX;
chooseAvatarStatic.Rect.Y += mouseEvent.Y - OldMouseY;
OldMouseX = mouseEvent.X;
OldMouseY = mouseEvent.Y;
}
// LeftButton isn't hold anymore, but Selec-Mode is still active -> "Drop" of Avatar
// LeftButton isn't hold anymore, but Selec-Mode is still active -> "Drop" of Avatar
else if (SelectingMouseActive)
{
//Check if really a player was selected
@@ -200,10 +182,10 @@ namespace Vocaluxe.PartyModes
for (int i = 0; i < PlayerDestinationButtons.Count; i++)
{
//Check first, if area is "active"
if (PlayerDestinationButtons[i].Visible == true)
if (PlayerDestinationButtons[i].Visible)
{
//Check if Mouse is in area
if (CHelper.IsInBounds(PlayerDestinationButtons[i].Rect, MouseEvent))
if (CHelper.IsInBounds(PlayerDestinationButtons[i].Rect, mouseEvent))
{
int added = -1;
//Add Player-ID to list.
@@ -236,22 +218,20 @@ namespace Vocaluxe.PartyModes
chooseAvatarStatic.Visible = false;
}
if (MouseEvent.LB && IsMouseOver(MouseEvent))
if (mouseEvent.LB && IsMouseOver(mouseEvent))
{
if (Buttons[htButtons(ButtonBack)].Selected)
if (Buttons[ButtonBack].Selected)
Back();
if (Buttons[htButtons(ButtonNext)].Selected)
if (Buttons[ButtonNext].Selected)
Next();
if (!OnAdd())
OnRemove();
}
if (MouseEvent.RB)
{
if (mouseEvent.RB)
Back();
}
return true;
}
@@ -286,20 +266,15 @@ namespace Vocaluxe.PartyModes
return true;
}
public override void OnClose()
{
base.OnClose();
}
private void AddButtonPlayerDestination()
{
Buttons[htButtons(ButtonPlayerDestination)].Visible = false;
Buttons[ButtonPlayerDestination].Visible = false;
PlayerDestinationButtons = new List<CButton>();
int row = 0;
int column = 0;
for (int i = 1; i <= _PartyMode.GetMaxPlayer(); i++)
{
CButton b = GetNewButton(Buttons[htButtons(ButtonPlayerDestination)]);
CButton b = GetNewButton(Buttons[ButtonPlayerDestination]);
b.Rect.X = PlayerDestinationButtonsFirstX + column * (b.Rect.W + PlayerDestinationButtonsSpaceH);
b.Rect.Y = PlayerDestinationButtonsFirstY + row * (b.Rect.H + PlayerDestinationButtonsSpaceW);
PlayerDestinationButtons.Add(b);
@@ -317,13 +292,13 @@ namespace Vocaluxe.PartyModes
private void AddButtonPlayerChoose()
{
Buttons[htButtons(ButtonPlayerChoose)].Visible = false;
Buttons[ButtonPlayerChoose].Visible = false;
PlayerChooseButtons = new List<CPlayerChooseButton>();
int row = 0;
int column = 0;
for (int i = 1; i <= PlayerChooseButtonsNumH * PlayerChooseButtonsNumW; i++)
{
CButton b = GetNewButton(Buttons[htButtons(ButtonPlayerChoose)]);
CButton b = GetNewButton(Buttons[ButtonPlayerChoose]);
b.Rect.X = PlayerChooseButtonsFirstX + column * (b.Rect.W + PlayerChooseButtonsSpaceH);
b.Rect.Y = PlayerChooseButtonsFirstY + row * (b.Rect.H + PlayerChooseButtonsSpaceW);
CPlayerChooseButton pcb = new CPlayerChooseButton();
@@ -345,14 +320,11 @@ namespace Vocaluxe.PartyModes
private void UpdateButtonPlayerChoose()
{
UpdateVisibleProfiles();
if ((PlayerChooseButtonsNumW * PlayerChooseButtonsNumH) * (PlayerChooseButtonsOffset + 1) - PlayerChooseButtonsVisibleProfiles.Count >= (PlayerChooseButtonsNumW * PlayerChooseButtonsNumH) * PlayerChooseButtonsOffset)
{
if ((PlayerChooseButtonsNumW * PlayerChooseButtonsNumH) * (PlayerChooseButtonsOffset + 1) - PlayerChooseButtonsVisibleProfiles.Count >=
(PlayerChooseButtonsNumW * PlayerChooseButtonsNumH) * PlayerChooseButtonsOffset)
UpdateButtonPlayerChoose(PlayerChooseButtonsOffset - 1);
}
else
{
UpdateButtonPlayerChoose(PlayerChooseButtonsOffset);
}
}
private void UpdateButtonPlayerChoose(int Offset)
@@ -379,10 +351,10 @@ namespace Vocaluxe.PartyModes
{
PlayerChooseButtons[i].ProfileID = -1;
PlayerChooseButtons[i].Button.Text.Text = String.Empty;
PlayerChooseButtons[i].Button.Texture = Buttons[htButtons(ButtonPlayerChoose)].Texture;
PlayerChooseButtons[i].Button.STexture = Buttons[htButtons(ButtonPlayerChoose)].STexture;
PlayerChooseButtons[i].Button.Color = Buttons[htButtons(ButtonPlayerChoose)].Color;
PlayerChooseButtons[i].Button.SColor = Buttons[htButtons(ButtonPlayerChoose)].SColor;
PlayerChooseButtons[i].Button.Texture = Buttons[ButtonPlayerChoose].Texture;
PlayerChooseButtons[i].Button.STexture = Buttons[ButtonPlayerChoose].STexture;
PlayerChooseButtons[i].Button.Color = Buttons[ButtonPlayerChoose].Color;
PlayerChooseButtons[i].Button.SColor = Buttons[ButtonPlayerChoose].SColor;
PlayerChooseButtons[i].Button.Enabled = false;
}
}
@@ -411,9 +383,7 @@ namespace Vocaluxe.PartyModes
}
}
if (visible)
{
PlayerChooseButtonsVisibleProfiles.Add(i);
}
}
}
@@ -448,10 +418,10 @@ namespace Vocaluxe.PartyModes
}
else
{
PlayerDestinationButtons[i].Color = Buttons[htButtons(ButtonPlayerDestination)].Color;
PlayerDestinationButtons[i].SColor = Buttons[htButtons(ButtonPlayerDestination)].SColor;
PlayerDestinationButtons[i].Texture = Buttons[htButtons(ButtonPlayerDestination)].Texture;
PlayerDestinationButtons[i].STexture = Buttons[htButtons(ButtonPlayerDestination)].STexture;
PlayerDestinationButtons[i].Color = Buttons[ButtonPlayerDestination].Color;
PlayerDestinationButtons[i].SColor = Buttons[ButtonPlayerDestination].SColor;
PlayerDestinationButtons[i].Texture = Buttons[ButtonPlayerDestination].Texture;
PlayerDestinationButtons[i].STexture = Buttons[ButtonPlayerDestination].STexture;
PlayerDestinationButtons[i].Text.Text = String.Empty;
PlayerDestinationButtons[i].Enabled = false;
}
@@ -462,11 +432,11 @@ namespace Vocaluxe.PartyModes
{
if (Data.ScreenNames.ProfileIDs.Count == NumPlayer)
{
Buttons[htButtons(ButtonNext)].Visible = true;
SetInteractionToButton(Buttons[htButtons(ButtonNext)]);
Buttons[ButtonNext].Visible = true;
SetInteractionToButton(Buttons[ButtonNext]);
}
else
Buttons[htButtons(ButtonNext)].Visible = false;
Buttons[ButtonNext].Visible = false;
}
private bool OnAdd()
@@ -521,14 +491,14 @@ namespace Vocaluxe.PartyModes
{
Data.ScreenNames.FadeToConfig = true;
Data.ScreenNames.FadeToMain = false;
_PartyMode.DataFromScreen(_ThemeName, Data);
_PartyMode.DataFromScreen(ThemeName, Data);
}
private void Next()
{
Data.ScreenNames.FadeToConfig = false;
Data.ScreenNames.FadeToMain = true;
_PartyMode.DataFromScreen(_ThemeName, Data);
_PartyMode.DataFromScreen(ThemeName, Data);
}
}
}
}
@@ -0,0 +1,809 @@
<StyleCopSettings Version="105">
<Analyzers>
<Analyzer AnalyzerId="StyleCop.CSharp.DocumentationRules">
<Rules>
<Rule Name="ElementsMustBeDocumented">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="PartialElementsMustBeDocumented">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="EnumerationItemsMustBeDocumented">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="DocumentationMustContainValidXml">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="ElementDocumentationMustHaveSummary">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="PartialElementDocumentationMustHaveSummary">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="ElementDocumentationMustHaveSummaryText">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="PartialElementDocumentationMustHaveSummaryText">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="ElementDocumentationMustNotHaveDefaultSummary">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="ElementParametersMustBeDocumented">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="ElementParameterDocumentationMustMatchElementParameters">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="ElementParameterDocumentationMustDeclareParameterName">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="ElementParameterDocumentationMustHaveText">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="ElementReturnValueMustBeDocumented">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="ElementReturnValueDocumentationMustHaveText">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="VoidReturnValueMustNotBeDocumented">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="GenericTypeParametersMustBeDocumented">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="GenericTypeParametersMustBeDocumentedPartialClass">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="GenericTypeParameterDocumentationMustMatchTypeParameters">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="GenericTypeParameterDocumentationMustDeclareParameterName">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="GenericTypeParameterDocumentationMustHaveText">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="PropertySummaryDocumentationMustMatchAccessors">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="PropertySummaryDocumentationMustOmitSetAccessorWithRestrictedAccess">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="ElementDocumentationMustNotBeCopiedAndPasted">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="SingleLineCommentsMustNotUseDocumentationStyleSlashes">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="DocumentationTextMustNotBeEmpty">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="DocumentationTextMustContainWhitespace">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="DocumentationMustMeetCharacterPercentage">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="ConstructorSummaryDocumentationMustBeginWithStandardText">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="DestructorSummaryDocumentationMustBeginWithStandardText">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="DocumentationHeadersMustNotContainBlankLines">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="IncludedDocumentationXPathDoesNotExist">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="IncludeNodeDoesNotContainValidFileAndPath">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="InheritDocMustBeUsedWithInheritingClass">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="ElementDocumentationMustBeSpelledCorrectly">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="FileMustHaveHeader">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="FileHeaderMustShowCopyright">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="FileHeaderMustHaveCopyrightText">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="FileHeaderMustContainFileName">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="FileHeaderFileNameDocumentationMustMatchFileName">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="FileHeaderMustHaveValidCompanyText">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="FileHeaderFileNameDocumentationMustMatchTypeName">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
</Rules>
<AnalyzerSettings />
</Analyzer>
<Analyzer AnalyzerId="StyleCop.CSharp.NamingRules">
<Rules>
<Rule Name="FieldNamesMustNotBeginWithUnderscore">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="ElementMustBeginWithUpperCaseLetter">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="ElementMustBeginWithLowerCaseLetter">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="InterfaceNamesMustBeginWithI">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="ConstFieldNamesMustBeginWithUpperCaseLetter">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="NonPrivateReadonlyFieldsMustBeginWithUpperCaseLetter">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="FieldNamesMustNotUseHungarianNotation">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="FieldNamesMustBeginWithLowerCaseLetter">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="AccessibleFieldsMustBeginWithUpperCaseLetter">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="VariableNamesMustNotBePrefixed">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="FieldNamesMustNotContainUnderscore">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="StaticReadonlyFieldsMustBeginWithUpperCaseLetter">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
</Rules>
<AnalyzerSettings />
</Analyzer>
<Analyzer AnalyzerId="StyleCop.CSharp.LayoutRules">
<Rules>
<Rule Name="CurlyBracketsForMultiLineStatementsMustNotShareLine">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="StatementMustNotBeOnSingleLine">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="ElementMustNotBeOnSingleLine">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="CurlyBracketsMustNotBeOmitted">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="AllAccessorsMustBeMultiLineOrSingleLine">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="OpeningCurlyBracketsMustNotBeFollowedByBlankLine">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="ElementDocumentationHeadersMustNotBeFollowedByBlankLine">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="CodeMustNotContainMultipleBlankLinesInARow">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="ClosingCurlyBracketsMustNotBePrecededByBlankLine">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="OpeningCurlyBracketsMustNotBePrecededByBlankLine">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="ChainedStatementBlocksMustNotBePrecededByBlankLine">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="WhileDoFooterMustNotBePrecededByBlankLine">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="SingleLineCommentsMustNotBeFollowedByBlankLine">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="ClosingCurlyBracketMustBeFollowedByBlankLine">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="ElementDocumentationHeaderMustBePrecededByBlankLine">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="SingleLineCommentMustBePrecededByBlankLine">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="ElementsMustBeSeparatedByBlankLine">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="CodeMustNotContainBlankLinesAtStartOfFile">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="CodeMustNotContainBlankLinesAtEndOfFile">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
</Rules>
<AnalyzerSettings />
</Analyzer>
<Analyzer AnalyzerId="StyleCop.CSharp.MaintainabilityRules">
<Rules>
<Rule Name="AccessModifierMustBeDeclared">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="FieldsMustBePrivate">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="CodeAnalysisSuppressionMustHaveJustification">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="DebugAssertMustProvideMessageText">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="DebugFailMustProvideMessageText">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="FileMayOnlyContainASingleClass">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="FileMayOnlyContainASingleNamespace">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="StatementMustNotUseUnnecessaryParenthesis">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="ArithmeticExpressionsMustDeclarePrecedence">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="ConditionalExpressionsMustDeclarePrecedence">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="RemoveDelegateParenthesisWhenPossible">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="AttributeConstructorMustNotUseUnnecessaryParenthesis">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="RemoveUnnecessaryCode">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
</Rules>
<AnalyzerSettings />
</Analyzer>
<Analyzer AnalyzerId="StyleCop.CSharp.OrderingRules">
<Rules>
<Rule Name="UsingDirectivesMustBePlacedWithinNamespace">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="ElementsMustAppearInTheCorrectOrder">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="ElementsMustBeOrderedByAccess">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="ConstantsMustAppearBeforeFields">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="StaticElementsMustAppearBeforeInstanceElements">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="DeclarationKeywordsMustFollowOrder">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="ProtectedMustComeBeforeInternal">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="PropertyAccessorsMustFollowOrder">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="EventAccessorsMustFollowOrder">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="StaticReadonlyElementsMustAppearBeforeStaticNonReadonlyElements">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="InstanceReadonlyElementsMustAppearBeforeInstanceNonReadonlyElements">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="SystemUsingDirectivesMustBePlacedBeforeOtherUsingDirectives">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="UsingAliasDirectivesMustBePlacedAfterOtherUsingDirectives">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="UsingDirectivesMustBeOrderedAlphabeticallyByNamespace">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="UsingAliasDirectivesMustBeOrderedAlphabeticallyByAliasName">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
</Rules>
<AnalyzerSettings />
</Analyzer>
<Analyzer AnalyzerId="StyleCop.CSharp.ReadabilityRules">
<Rules>
<Rule Name="CommentsMustContainText">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="DoNotPrefixCallsWithBaseUnlessLocalImplementationExists">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="PrefixLocalCallsWithThis">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="PrefixCallsCorrectly">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="OpeningParenthesisMustBeOnDeclarationLine">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="ClosingParenthesisMustBeOnLineOfLastParameter">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="ClosingParenthesisMustBeOnLineOfOpeningParenthesis">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="CommaMustBeOnSameLineAsPreviousParameter">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="ParameterListMustFollowDeclaration">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="ParameterMustFollowComma">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="SplitParametersMustStartOnLineAfterDeclaration">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="ParametersMustBeOnSameLineOrSeparateLines">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="ParameterMustNotSpanMultipleLines">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="QueryClauseMustFollowPreviousClause">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="QueryClausesMustBeOnSeparateLinesOrAllOnOneLine">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="QueryClauseMustBeginOnNewLineWhenPreviousClauseSpansMultipleLines">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="QueryClausesSpanningMultipleLinesMustBeginOnOwnLine">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="DoNotPlaceRegionsWithinElements">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="CodeMustNotContainEmptyStatements">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="CodeMustNotContainMultipleStatementsOnOneLine">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="BlockStatementsMustNotContainEmbeddedComments">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="BlockStatementsMustNotContainEmbeddedRegions">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="UseStringEmptyForEmptyStrings">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="UseBuiltInTypeAlias">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="UseShorthandForNullableTypes">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
</Rules>
<AnalyzerSettings />
</Analyzer>
<Analyzer AnalyzerId="StyleCop.CSharp.SpacingRules">
<Rules>
<Rule Name="KeywordsMustBeSpacedCorrectly">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="CommasMustBeSpacedCorrectly">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="SemicolonsMustBeSpacedCorrectly">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="SymbolsMustBeSpacedCorrectly">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="DocumentationLinesMustBeginWithSingleSpace">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="SingleLineCommentsMustBeginWithSingleSpace">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="PreprocessorKeywordsMustNotBePrecededBySpace">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="OperatorKeywordMustBeFollowedBySpace">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="OpeningParenthesisMustBeSpacedCorrectly">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="ClosingParenthesisMustBeSpacedCorrectly">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="OpeningSquareBracketsMustBeSpacedCorrectly">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="ClosingSquareBracketsMustBeSpacedCorrectly">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="OpeningCurlyBracketsMustBeSpacedCorrectly">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="ClosingCurlyBracketsMustBeSpacedCorrectly">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="OpeningGenericBracketsMustBeSpacedCorrectly">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="ClosingGenericBracketsMustBeSpacedCorrectly">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="OpeningAttributeBracketsMustBeSpacedCorrectly">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="ClosingAttributeBracketsMustBeSpacedCorrectly">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="NullableTypeSymbolsMustNotBePrecededBySpace">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="MemberAccessSymbolsMustBeSpacedCorrectly">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="IncrementDecrementSymbolsMustBeSpacedCorrectly">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="NegativeSignsMustBeSpacedCorrectly">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="PositiveSignsMustBeSpacedCorrectly">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="DereferenceAndAccessOfSymbolsMustBeSpacedCorrectly">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="ColonsMustBeSpacedCorrectly">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="CodeMustNotContainMultipleWhitespaceInARow">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="CodeMustNotContainSpaceAfterNewKeywordInImplicitlyTypedArrayAllocation">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="TabsMustNotBeUsed">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
</Rules>
<AnalyzerSettings />
</Analyzer>
</Analyzers>
</StyleCopSettings>
@@ -1,22 +1,19 @@
using System;
using System.Collections.Generic;
using System.Text;
using Vocaluxe.Menu;
namespace Vocaluxe.PartyModes
namespace VocaluxeLib.PartyModes.ChallengeMedley
{
public class ChallengeRounds
{
private Random _Rand;
private int _NumPlayer;
private readonly Random _Rand;
private readonly int _NumPlayer;
public List<Combination> Rounds;
public ChallengeRounds(int NumRounds, int NumPlayer, int NumPlayerAtOnce)
{
Rounds = new List<Combination>();
_Rand = new Random(System.DateTime.Now.Millisecond);
_Rand = new Random(DateTime.Now.Millisecond);
if (NumPlayerAtOnce < 1 || NumRounds < 1 || NumPlayer == 0)
_NumPlayer = 0;
@@ -41,26 +38,19 @@ namespace Vocaluxe.PartyModes
Rounds.Add(Combinations.GetNextCombination(null));
for (int i = 1; i < NumRounds; i++)
{
Rounds.Add(Combinations.GetNextCombination(GetPlayerDemand(i)));
}
}
private List<int> GetPlayerDemand(int RoundIndex)
{
List<int> NumPlayed = new List<int>(_NumPlayer);
for (int i = 0; i < _NumPlayer; i++)
{
NumPlayed.Add(0);
}
for (int i = 0; i < RoundIndex; i++)
{
foreach (int PlayerIndex in Rounds[i].Player)
{
NumPlayed[PlayerIndex]++;
}
}
int max = 0;
@@ -95,7 +85,6 @@ namespace Vocaluxe.PartyModes
}
else
last.Add(i);
}
}
@@ -129,17 +118,17 @@ namespace Vocaluxe.PartyModes
class Combinations
{
private List<Combination> _Combs;
private Random _Rand;
private int _NumPlayer;
private int _NumMics;
private readonly List<Combination> _Combs;
private readonly Random _Rand;
private readonly int _NumPlayer;
private readonly int _NumMics;
public Combinations(int NumPlayer, int NumMics, Random Rand)
{
_Combs = new List<Combination>();
_NumMics = NumMics;
_NumPlayer = NumPlayer;
_Rand = Rand;
_Rand = Rand;
}
public Combination GetNextCombination(List<int> PlayerNrDemand)
@@ -150,9 +139,7 @@ namespace Vocaluxe.PartyModes
Combination combs = new Combination();
if (_NumPlayer == _NumMics)
{
return _Combs[0];
}
//filter against PlayerNrDemand
List<Combination> combsFiltered = new List<Combination>();
@@ -179,18 +166,14 @@ namespace Vocaluxe.PartyModes
if (combsFiltered.Count == 0)
{
for (int i = 0; i < _Combs.Count; i++)
{
combsFiltered.Add(_Combs[i]);
}
}
int num = combsFiltered.Count;
int rand = _Rand.Next(num);
Combination c = new Combination();
for (int i = 0; i < combsFiltered[rand].Player.Count; i++)
{
c.Player.Add(combsFiltered[rand].Player[i]);
}
_Combs.Remove(combsFiltered[rand]);
return combsFiltered[rand];
@@ -209,9 +192,7 @@ namespace Vocaluxe.PartyModes
for (int j = 0; j < _NumPlayer; j++)
{
if ((i & (1 << j)) > 0)
{
c.Player.Add(j);
}
}
if (c.Player.Count == _NumMics)
@@ -243,9 +224,7 @@ namespace Vocaluxe.PartyModes
{
bool result = true;
foreach (int p in PlayerIndices)
{
result &= IsAvailable(p);
}
return result;
}
@@ -253,10 +232,8 @@ namespace Vocaluxe.PartyModes
{
bool result = false;
foreach (int p in PlayerIndices)
{
result |= IsAvailable(p);
}
return result;
}
}
}
}
@@ -1,13 +1,16 @@
using System;
using System.Collections.Generic;
using System.Text;
using System.Runtime.InteropServices;
using VocaluxeLib.Menu;
using VocaluxeLib.Menu.SongMenu;
using Vocaluxe.Menu;
using Vocaluxe.Menu.SongMenu;
[assembly: ComVisible(false)]
namespace Vocaluxe.PartyModes
namespace VocaluxeLib.PartyModes.ChallengeMedley
{
#region Communication
#region ToScreen
public struct DataToScreenConfig
{
@@ -53,9 +56,7 @@ namespace Vocaluxe.PartyModes
{
res = row.NumSingPoints.CompareTo(NumSingPoints);
if (res == 0)
{
res = row.NumWon.CompareTo(NumWon);
}
}
return res;
}
@@ -63,7 +64,6 @@ namespace Vocaluxe.PartyModes
throw new ArgumentException("object is not a ResultTableRow");
}
}
#endregion ToScreen
#region FromScreen
@@ -94,9 +94,10 @@ namespace Vocaluxe.PartyModes
public bool FadeToNameSelection;
}
#endregion FromScreen
#endregion Communication
public sealed class PartyModeChallenge : CPartyMode
public sealed class PartyModeChallengeMedley : CPartyMode
{
private const int MaxPlayer = 12;
private const int MinPlayer = 1;
@@ -105,7 +106,7 @@ namespace Vocaluxe.PartyModes
private const int MaxNumRounds = 100;
private const int NumSongs = 5;
enum EStage
private enum EStage
{
NotStarted,
Config,
@@ -114,7 +115,7 @@ namespace Vocaluxe.PartyModes
Singing
}
struct Data
private struct Data
{
public int NumPlayer;
public int NumPlayerAtOnce;
@@ -130,7 +131,7 @@ namespace Vocaluxe.PartyModes
public int[] CatSongIndices;
}
struct Stats
private struct Stats
{
public int ProfileID;
public int SingPoints;
@@ -145,18 +146,18 @@ namespace Vocaluxe.PartyModes
private Data GameData;
private EStage _Stage;
public PartyModeChallenge()
public PartyModeChallengeMedley()
{
_ScreenSongOptions.Selection.RandomOnly = false;
_ScreenSongOptions.Selection.PartyMode = true;
_ScreenSongOptions.Selection.CategoryChangeAllowed = true;
_ScreenSongOptions.Selection.NumJokers = new int[] { 5, 5 };
_ScreenSongOptions.Selection.TeamNames = new string[] { "foo", "bar" };
_ScreenSongOptions.Selection.NumJokers = new int[] {5, 5};
_ScreenSongOptions.Selection.TeamNames = new string[] {"foo", "bar"};
_ScreenSongOptions.Sorting.SearchString = String.Empty;
_ScreenSongOptions.Sorting.SearchActive = false;
_ScreenSongOptions.Sorting.ShowDuetSongs = false;
_ScreenSongOptions.Sorting.DuetOptions = EDuetOptions.NoDuets;
_Stage = EStage.NotStarted;
ToScreenConfig = new DataToScreenConfig();
@@ -188,7 +189,7 @@ namespace Vocaluxe.PartyModes
ToScreenMain.ResultTable = new List<ResultTableRow>();
GameData.ResultTable = new List<ResultTableRow>();
CBase.Songs.SortSongs(ESongSorting.TR_CONFIG_NONE, EOffOn.TR_CONFIG_OFF, EOffOn.TR_CONFIG_OFF, String.Empty, false);
CBase.Songs.SortSongs(ESongSorting.TR_CONFIG_NONE, EOffOn.TR_CONFIG_OFF, EOffOn.TR_CONFIG_OFF, String.Empty, EDuetOptions.NoDuets);
CBase.Songs.SetCategory(0);
return true;
@@ -199,8 +200,8 @@ namespace Vocaluxe.PartyModes
DataFromScreen data = new DataFromScreen();
switch (ScreenName)
{
case "PartyScreenChallengeConfig":
case "PartyScreenChallengeMedleyConfig":
try
{
data = (DataFromScreen)Data;
@@ -217,7 +218,7 @@ namespace Vocaluxe.PartyModes
}
break;
case "PartyScreenChallengeNames":
case "PartyScreenChallengeMedleyNames":
try
{
data = (DataFromScreen)Data;
@@ -237,7 +238,7 @@ namespace Vocaluxe.PartyModes
}
break;
case "PartyScreenChallengeMain":
case "PartyScreenChallengeMedleyMain":
try
{
data = (DataFromScreen)Data;
@@ -281,7 +282,7 @@ namespace Vocaluxe.PartyModes
switch (_Stage)
{
case EStage.NotStarted:
_Screens.TryGetValue("PartyScreenChallengeConfig", out Screen);
_Screens.TryGetValue("PartyScreenChallengeMedleyConfig", out Screen);
if (_Screens != null)
{
ToScreenConfig.NumPlayer = GameData.NumPlayer;
@@ -291,7 +292,7 @@ namespace Vocaluxe.PartyModes
}
break;
case EStage.Config:
_Screens.TryGetValue("PartyScreenChallengeNames", out Screen);
_Screens.TryGetValue("PartyScreenChallengeMedleyNames", out Screen);
if (_Screens != null)
{
ToScreenNames.NumPlayer = GameData.NumPlayer;
@@ -300,7 +301,7 @@ namespace Vocaluxe.PartyModes
}
break;
case EStage.Names:
_Screens.TryGetValue("PartyScreenChallengeMain", out Screen);
_Screens.TryGetValue("PartyScreenChallengeMedleyMain", out Screen);
if (_Screens != null)
{
CBase.Songs.ResetPartySongSung();
@@ -322,7 +323,7 @@ namespace Vocaluxe.PartyModes
//nothing to do
break;
case EStage.Singing:
_Screens.TryGetValue("PartyScreenChallengeMain", out Screen);
_Screens.TryGetValue("PartyScreenChallengeMedleyMain", out Screen);
if (_Screens != null)
{
UpdateScores();
@@ -332,10 +333,8 @@ namespace Vocaluxe.PartyModes
Screen.DataToScreen(ToScreenMain);
}
break;
default:
break;
}
return Screen;
}
@@ -444,9 +443,7 @@ namespace Vocaluxe.PartyModes
_ScreenSongOptions.Selection.CategoryChangeAllowed = false;
}
public override void SongSelected(int SongID)
{
}
public override void SongSelected(int SongID) {}
public override void LeavingHighscore()
{
@@ -506,7 +503,7 @@ namespace Vocaluxe.PartyModes
#region SongQueque
if (CBase.Songs.GetNumVisibleSongs() < NumSongs)
CBase.Songs.ResetPartySongSung();
EGameMode gm = EGameMode.TR_GAMEMODE_MEDLEY;
List<int> IDs = new List<int>();
@@ -517,7 +514,7 @@ namespace Vocaluxe.PartyModes
CBase.Graphics.FadeTo(EScreens.ScreenParty);
return false;
}
for (int i = 0; i < VisSongs.Length; i++)
{
foreach (EGameMode mode in VisSongs[i].AvailableGameModes)
@@ -525,7 +522,6 @@ namespace Vocaluxe.PartyModes
if (mode == EGameMode.TR_GAMEMODE_MEDLEY)
IDs.Add(VisSongs[i].ID);
}
}
if (IDs.Count == 0)
@@ -544,7 +540,7 @@ namespace Vocaluxe.PartyModes
IDs.Remove(SongID);
s++;
}
return true;
return true;
#endregion SongQueque
}
@@ -553,30 +549,30 @@ namespace Vocaluxe.PartyModes
switch (GameData.NumPlayerAtOnce)
{
case 1:
_ScreenSongOptions.Selection.NumJokers = new int[] { 10 };
_ScreenSongOptions.Selection.NumJokers = new int[] {10};
break;
case 2:
_ScreenSongOptions.Selection.NumJokers = new int[] { 5, 5 };
_ScreenSongOptions.Selection.NumJokers = new int[] {5, 5};
break;
case 3:
_ScreenSongOptions.Selection.NumJokers = new int[] { 4, 4, 4 };
_ScreenSongOptions.Selection.NumJokers = new int[] {4, 4, 4};
break;
case 4:
_ScreenSongOptions.Selection.NumJokers = new int[] { 3, 3, 3, 3 };
_ScreenSongOptions.Selection.NumJokers = new int[] {3, 3, 3, 3};
break;
case 5:
_ScreenSongOptions.Selection.NumJokers = new int[] { 2, 2, 2, 2, 2 };
_ScreenSongOptions.Selection.NumJokers = new int[] {2, 2, 2, 2, 2};
break;
case 6:
_ScreenSongOptions.Selection.NumJokers = new int[] { 2, 2, 2, 2, 2, 2 };
_ScreenSongOptions.Selection.NumJokers = new int[] {2, 2, 2, 2, 2, 2};
break;
default:
_ScreenSongOptions.Selection.NumJokers = new int[] { 5, 5 };
_ScreenSongOptions.Selection.NumJokers = new int[] {5, 5};
break;
}
}
@@ -587,16 +583,16 @@ namespace Vocaluxe.PartyModes
if (profiles == null)
{
_ScreenSongOptions.Selection.TeamNames = new string[] { "foo", "bar" };
_ScreenSongOptions.Selection.TeamNames = new string[] {"foo", "bar"};
return;
}
if (GameData.NumPlayerAtOnce < 1 || GameData.ProfileIDs.Count < GameData.NumPlayerAtOnce || profiles.Length < GameData.NumPlayerAtOnce)
{
_ScreenSongOptions.Selection.TeamNames = new string[] { "foo", "bar" };
_ScreenSongOptions.Selection.TeamNames = new string[] {"foo", "bar"};
return;
}
_ScreenSongOptions.Selection.TeamNames = new string[GameData.NumPlayerAtOnce];
Combination c = GameData.Rounds.GetRound(GameData.CurrentRoundNr - 1);
@@ -630,13 +626,11 @@ namespace Vocaluxe.PartyModes
GameData.ResultTable.Add(row);
}
GameData.Results = new int[GameData.NumRounds, GameData.NumPlayerAtOnce];
GameData.Results = new int[GameData.NumRounds,GameData.NumPlayerAtOnce];
for (int i = 0; i < GameData.NumRounds; i++)
{
for (int j = 0; j < GameData.NumPlayerAtOnce; j++)
{
GameData.Results[i, j] = 0;
}
}
}
else
@@ -659,9 +653,7 @@ namespace Vocaluxe.PartyModes
{
SPlayer[] temp = GamePoints.GetPlayer(i, GameData.NumPlayerAtOnce);
for (int p = 0; p < GameData.NumPlayerAtOnce; p++)
{
results[p].Points += temp[p].Points;
}
}
for (int j = 0; j < GameData.NumPlayerAtOnce; j++)
@@ -676,13 +668,13 @@ namespace Vocaluxe.PartyModes
{
int index = -1;
for (int j = 0; j < GameData.ResultTable.Count; j++)
{
{
if (points[i].ProfileID == GameData.ResultTable[j].PlayerID)
{
index = j;
break;
}
}
}
if (index != -1)
{
@@ -705,7 +697,7 @@ namespace Vocaluxe.PartyModes
int pos = 1;
int lastPoints = 0;
int lastSingPoints = 0;
for (int i = 0; i < GameData.ResultTable.Count; i++ )
for (int i = 0; i < GameData.ResultTable.Count; i++)
{
if (lastPoints > GameData.ResultTable[i].NumGamePoints || lastSingPoints > GameData.ResultTable[i].NumSingPoints)
pos++;
@@ -718,7 +710,7 @@ namespace Vocaluxe.PartyModes
private List<Stats> GetPointsForPlayer(SPlayer[] Results)
{
List<Stats> result = new List<Stats>();
for(int i = 0; i < GameData.NumPlayerAtOnce; i++)
for (int i = 0; i < GameData.NumPlayerAtOnce; i++)
{
Stats stat = new Stats();
stat.ProfileID = Results[i].ProfileID;
@@ -765,7 +757,6 @@ namespace Vocaluxe.PartyModes
}
return result;
}
@@ -775,11 +766,9 @@ namespace Vocaluxe.PartyModes
{
GameData.CatSongIndices = new int[CBase.Songs.GetNumCategories()];
for (int i = 0; i < GameData.CatSongIndices.Length; i++)
{
GameData.CatSongIndices[i] = -1;
}
}
if (CBase.Songs.GetNumCategories() == 0 || _ScreenSongOptions.Sorting.Tabs == EOffOn.TR_CONFIG_OFF)
GameData.CatSongIndices = null;
}
@@ -8,8 +8,8 @@
<ProjectGuid>{6F3E1874-F28A-40E9-AFBD-31934D593678}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>PartyModeChallenge</RootNamespace>
<AssemblyName>PartyModeChallenge</AssemblyName>
<RootNamespace>VocaluxeLib.PartyModes.ChallengeMedley</RootNamespace>
<AssemblyName>ChallengeMedley</AssemblyName>
<TargetFrameworkVersion>v2.0</TargetFrameworkVersion>
<TargetFrameworkProfile>
</TargetFrameworkProfile>
@@ -20,7 +20,7 @@
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>..\..\Output\PartyModes\ChallengeMedley\Code</OutputPath>
<OutputPath>bin</OutputPath>
<DefineConstants>TRACE;DEBUG;WIN</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
@@ -30,7 +30,7 @@
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugType>none</DebugType>
<Optimize>true</Optimize>
<OutputPath>..\..\Output\PartyModes\ChallengeMedley\Code</OutputPath>
<OutputPath>bin</OutputPath>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<UseVSHostingProcess>false</UseVSHostingProcess>
@@ -42,17 +42,18 @@
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>..\..\Output\PartyModes\ChallengeMedley\Code</OutputPath>
<OutputPath>bin</OutputPath>
<DefineConstants>TRACE;DEBUG;WIN</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<GenerateSerializationAssemblies>Off</GenerateSerializationAssemblies>
<CodeAnalysisRuleSet>..\..\CheckingRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'ReleaseWin|x64'">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugType>none</DebugType>
<Optimize>true</Optimize>
<OutputPath>..\..\Output\PartyModes\ChallengeMedley\Code</OutputPath>
<OutputPath>bin</OutputPath>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<UseVSHostingProcess>false</UseVSHostingProcess>
@@ -64,7 +65,7 @@
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>..\..\Output\PartyModes\ChallengeMedley\Code</OutputPath>
<OutputPath>bin</OutputPath>
<DefineConstants>TRACE;DEBUG;LINUX</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
@@ -74,7 +75,7 @@
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugType>none</DebugType>
<Optimize>true</Optimize>
<OutputPath>..\..\Output\PartyModes\ChallengeMedley\Code</OutputPath>
<OutputPath>bin</OutputPath>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<UseVSHostingProcess>false</UseVSHostingProcess>
@@ -86,7 +87,7 @@
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>..\..\Output\PartyModes\ChallengeMedley\Code</OutputPath>
<OutputPath>bin</OutputPath>
<DefineConstants>TRACE;DEBUG;LINUX</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
@@ -96,7 +97,7 @@
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugType>none</DebugType>
<Optimize>true</Optimize>
<OutputPath>..\..\Output\PartyModes\ChallengeMedley\Code</OutputPath>
<OutputPath>bin</OutputPath>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<UseVSHostingProcess>false</UseVSHostingProcess>
@@ -107,21 +108,12 @@
<StartupObject />
</PropertyGroup>
<ItemGroup>
<Compile Include="ChallengeRounds.cs">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Compile>
<Compile Include="PartyModeChallenge.cs">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Compile>
<Compile Include="PartyScreenChallengeConfig.cs">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Compile>
<Compile Include="PartyScreenChallengeMain.cs">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Compile>
<Compile Include="PartyScreenChallengeNames.cs">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Compile>
<Compile Include="ChallengeRounds.cs" />
<Compile Include="GlobalSuppressions.cs" />
<Compile Include="PartyModeChallengeMedley.cs" />
<Compile Include="PartyScreenChallengeMedleyConfig.cs" />
<Compile Include="PartyScreenChallengeMedleyMain.cs" />
<Compile Include="PartyScreenChallengeMedleyNames.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\VocaluxeLib\VocaluxeLib.csproj">
@@ -137,7 +129,14 @@
<Reference Include="System.Windows.Forms" />
<Reference Include="System.XML" />
</ItemGroup>
<ItemGroup>
<Folder Include="Properties\" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<PropertyGroup>
<PostBuildEvent>cd $(SolutionDir)Partymodes\
xcopy "$(ProjectDir)*.cs" "$(SolutionDir)Output\PartyModes\$(TargetName)\Code\" /EXCLUDE:Excludes.txt /I /Y</PostBuildEvent>
</PropertyGroup>
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
@@ -1,41 +1,35 @@
using System;
using System.Collections.Generic;
using System.Text;
using System.Windows.Forms;
using VocaluxeLib.Menu;
using Vocaluxe.Menu;
namespace Vocaluxe.PartyModes
namespace VocaluxeLib.PartyModes.ChallengeMedley
{
public class PartyScreenChallengeConfig : CMenuParty
public class PartyScreenChallengeMedleyConfig : CMenuParty
{
// Version number for theme files. Increment it, if you've changed something on the theme files!
const int ScreenVersion = 1;
protected override int _ScreenVersion
{
get { return 1; }
}
const string SelectSlideNumPlayers = "SelectSlideNumPlayers";
const string SelectSlideNumMics = "SelectSlideNumMics";
const string SelectSlideNumRounds = "SelectSlideNumRounds";
const string ButtonNext = "ButtonNext";
const string ButtonBack = "ButtonBack";
private const string SelectSlideNumPlayers = "SelectSlideNumPlayers";
private const string SelectSlideNumMics = "SelectSlideNumMics";
private const string SelectSlideNumRounds = "SelectSlideNumRounds";
private const string ButtonNext = "ButtonNext";
private const string ButtonBack = "ButtonBack";
private int _MaxNumMics = 2;
private int _MaxNumRounds = 100;
private int _RoundSteps = 1;
DataFromScreen Data;
private DataFromScreen Data;
public PartyScreenChallengeConfig()
{
}
protected override void Init()
public override void Init()
{
base.Init();
_ThemeName = "PartyScreenChallengeConfig";
_ThemeSelectSlides = new string[] { SelectSlideNumPlayers, SelectSlideNumMics, SelectSlideNumRounds };
_ThemeButtons = new string[] { ButtonNext, ButtonBack };
_ScreenVersion = ScreenVersion;
_ThemeSelectSlides = new string[] {SelectSlideNumPlayers, SelectSlideNumMics, SelectSlideNumRounds};
_ThemeButtons = new string[] {ButtonNext, ButtonBack};
Data = new DataFromScreen();
FromScreenConfig config = new FromScreenConfig();
@@ -45,11 +39,6 @@ namespace Vocaluxe.PartyModes
Data.ScreenConfig = config;
}
public override void LoadTheme(string XmlPath)
{
base.LoadTheme(XmlPath);
}
public override void DataToScreen(object ReceivedData)
{
DataToScreenConfig config = new DataToScreenConfig();
@@ -63,22 +52,18 @@ namespace Vocaluxe.PartyModes
}
catch (Exception e)
{
CBase.Log.LogError("Error in party mode screen challenge config. Can't cast received data from game mode " + _ThemeName + ". " + e.Message);;
CBase.Log.LogError("Error in party mode screen challenge config. Can't cast received data from game mode " + ThemeName + ". " + e.Message);
}
}
public override bool HandleInput(KeyEvent KeyEvent)
public override bool HandleInput(KeyEvent keyEvent)
{
base.HandleInput(KeyEvent);
base.HandleInput(keyEvent);
if (KeyEvent.KeyPressed)
{
}
if (keyEvent.KeyPressed) {}
else
{
switch (KeyEvent.Key)
switch (keyEvent.Key)
{
case Keys.Back:
case Keys.Escape:
@@ -88,10 +73,10 @@ namespace Vocaluxe.PartyModes
case Keys.Enter:
UpdateSlides();
if (Buttons[htButtons(ButtonBack)].Selected)
if (Buttons[ButtonBack].Selected)
Back();
if (Buttons[htButtons(ButtonNext)].Selected)
if (Buttons[ButtonNext].Selected)
Next();
break;
@@ -107,24 +92,22 @@ namespace Vocaluxe.PartyModes
return true;
}
public override bool HandleMouse(MouseEvent MouseEvent)
public override bool HandleMouse(MouseEvent mouseEvent)
{
base.HandleMouse(MouseEvent);
base.HandleMouse(mouseEvent);
if (MouseEvent.LB && IsMouseOver(MouseEvent))
if (mouseEvent.LB && IsMouseOver(mouseEvent))
{
UpdateSlides();
if (Buttons[htButtons(ButtonBack)].Selected)
if (Buttons[ButtonBack].Selected)
Back();
if (Buttons[htButtons(ButtonNext)].Selected)
if (Buttons[ButtonNext].Selected)
Next();
}
if (MouseEvent.RB)
{
if (mouseEvent.RB)
Back();
}
return true;
}
@@ -153,33 +136,26 @@ namespace Vocaluxe.PartyModes
return true;
}
public override void OnClose()
{
base.OnClose();
}
private void RebuildSlides()
{
// build num player slide (min player ... max player);
SelectSlides[htSelectSlides(SelectSlideNumPlayers)].Clear();
SelectSlides[SelectSlideNumPlayers].Clear();
for (int i = _PartyMode.GetMinPlayer(); i <= _PartyMode.GetMaxPlayer(); i++)
{
SelectSlides[htSelectSlides(SelectSlideNumPlayers)].AddValue(i.ToString());
}
SelectSlides[htSelectSlides(SelectSlideNumPlayers)].Selection = Data.ScreenConfig.NumPlayer - _PartyMode.GetMinPlayer();
SelectSlides[SelectSlideNumPlayers].AddValue(i.ToString());
SelectSlides[SelectSlideNumPlayers].Selection = Data.ScreenConfig.NumPlayer - _PartyMode.GetMinPlayer();
UpdateMicsAtOnce();
SetRoundSteps();
UpdateSlideRounds();
}
}
private void UpdateSlides()
{
int player = Data.ScreenConfig.NumPlayer;
int mics = Data.ScreenConfig.NumPlayerAtOnce;
Data.ScreenConfig.NumPlayer = SelectSlides[htSelectSlides(SelectSlideNumPlayers)].Selection + _PartyMode.GetMinPlayer();
Data.ScreenConfig.NumPlayerAtOnce = SelectSlides[htSelectSlides(SelectSlideNumMics)].Selection + _PartyMode.GetMinPlayer();
Data.ScreenConfig.NumRounds = (SelectSlides[htSelectSlides(SelectSlideNumRounds)].Selection + 1) * _RoundSteps;
Data.ScreenConfig.NumPlayer = SelectSlides[SelectSlideNumPlayers].Selection + _PartyMode.GetMinPlayer();
Data.ScreenConfig.NumPlayerAtOnce = SelectSlides[SelectSlideNumMics].Selection + _PartyMode.GetMinPlayer();
Data.ScreenConfig.NumRounds = (SelectSlides[SelectSlideNumRounds].Selection + 1) * _RoundSteps;
UpdateMicsAtOnce();
SetRoundSteps();
@@ -188,13 +164,11 @@ namespace Vocaluxe.PartyModes
{
int num = CHelper.nCk(Data.ScreenConfig.NumPlayer, Data.ScreenConfig.NumPlayerAtOnce);
while (num > _MaxNumRounds)
{
num -= _RoundSteps;
}
Data.ScreenConfig.NumRounds = num;
}
UpdateSlideRounds();
UpdateSlideRounds();
}
private void UpdateMicsAtOnce()
@@ -208,23 +182,19 @@ namespace Vocaluxe.PartyModes
Data.ScreenConfig.NumPlayerAtOnce = MaxNum;
// build mics at once slide
SelectSlides[htSelectSlides(SelectSlideNumMics)].Clear();
SelectSlides[SelectSlideNumMics].Clear();
for (int i = 1; i <= MaxNum; i++)
{
SelectSlides[htSelectSlides(SelectSlideNumMics)].AddValue(i.ToString());
}
SelectSlides[htSelectSlides(SelectSlideNumMics)].Selection = Data.ScreenConfig.NumPlayerAtOnce - _PartyMode.GetMinPlayer();
SelectSlides[SelectSlideNumMics].AddValue(i.ToString());
SelectSlides[SelectSlideNumMics].Selection = Data.ScreenConfig.NumPlayerAtOnce - _PartyMode.GetMinPlayer();
}
private void UpdateSlideRounds()
{
// build num rounds slide
SelectSlides[htSelectSlides(SelectSlideNumRounds)].Clear();
SelectSlides[SelectSlideNumRounds].Clear();
for (int i = _RoundSteps; i <= _MaxNumRounds; i += _RoundSteps)
{
SelectSlides[htSelectSlides(SelectSlideNumRounds)].AddValue(i.ToString());
}
SelectSlides[htSelectSlides(SelectSlideNumRounds)].Selection = Data.ScreenConfig.NumRounds / _RoundSteps - 1;
SelectSlides[SelectSlideNumRounds].AddValue(i.ToString());
SelectSlides[SelectSlideNumRounds].Selection = Data.ScreenConfig.NumRounds / _RoundSteps - 1;
}
private void SetRoundSteps()
@@ -241,7 +211,7 @@ namespace Vocaluxe.PartyModes
if (mod == 0)
_RoundSteps = res;
else
_RoundSteps = Data.ScreenConfig.NumPlayer;
_RoundSteps = Data.ScreenConfig.NumPlayer;
}
private void Back()
@@ -251,7 +221,7 @@ namespace Vocaluxe.PartyModes
private void Next()
{
_PartyMode.DataFromScreen(_ThemeName, Data);
_PartyMode.DataFromScreen(ThemeName, Data);
}
}
}
}
@@ -1,11 +1,9 @@
using System;
using System.Collections.Generic;
using System.Text;
using System.Windows.Forms;
using VocaluxeLib.Menu;
using Vocaluxe.Menu;
namespace Vocaluxe.PartyModes
namespace VocaluxeLib.PartyModes.ChallengeMedley
{
struct TableRow
{
@@ -24,41 +22,43 @@ namespace Vocaluxe.PartyModes
public List<CText> TextScores;
}
public class PartyScreenChallengeMain : CMenuParty
public class PartyScreenChallengeMedleyMain : CMenuParty
{
// Version number for theme files. Increment it, if you've changed something on the theme files!
const int ScreenVersion = 1;
protected override int _ScreenVersion
{
get { return 1; }
}
const string TextPosition = "TextPosition";
const string TextPlayerName = "TextPlayerName";
const string TextNumPlayed = "TextNumPlayed";
const string TextWon = "TextWon";
const string TextSingPoints = "TextSingPoints";
const string TextGamePoints = "TextGamePoints";
const string TextNextPlayer = "TextNextPlayer";
const string TextPopupReallyExit = "TextPopupReallyExit";
const string TextRoundPlayer = "TextRoundPlayer";
const string TextRoundScore = "TextRoundScore";
const string TextRoundNumber = "TextRoundNumber";
const string TextFinishMessage = "TextFinishMessage";
const string TextFinishPlayerWin = "TextFinishPlayerWin";
const string TextNextPlayerMessage = "TextNextPlayerMessage";
private const string TextPosition = "TextPosition";
private const string TextPlayerName = "TextPlayerName";
private const string TextNumPlayed = "TextNumPlayed";
private const string TextWon = "TextWon";
private const string TextSingPoints = "TextSingPoints";
private const string TextGamePoints = "TextGamePoints";
private const string TextNextPlayer = "TextNextPlayer";
private const string TextPopupReallyExit = "TextPopupReallyExit";
private const string TextRoundPlayer = "TextRoundPlayer";
private const string TextRoundScore = "TextRoundScore";
private const string TextRoundNumber = "TextRoundNumber";
private const string TextFinishMessage = "TextFinishMessage";
private const string TextFinishPlayerWin = "TextFinishPlayerWin";
private const string TextNextPlayerMessage = "TextNextPlayerMessage";
const string ButtonNextRound = "ButtonNextRound";
const string ButtonBack = "ButtonBack";
const string ButtonExit = "ButtonExit";
const string ButtonPopupYes = "ButtonPopupYes";
const string ButtonPopupNo = "ButtonPopupNo";
const string ButtonPlayerScrollUp = "ButtonPlayerScrollUp";
const string ButtonPlayerScrollDown = "ButtonPlayerScrollDown";
const string ButtonRoundsScrollUp = "ButtonRoundsScrollUp";
const string ButtonRoundsScrollDown = "ButtonRoundsScrollDown";
private const string ButtonNextRound = "ButtonNextRound";
private const string ButtonBack = "ButtonBack";
private const string ButtonExit = "ButtonExit";
private const string ButtonPopupYes = "ButtonPopupYes";
private const string ButtonPopupNo = "ButtonPopupNo";
private const string ButtonPlayerScrollUp = "ButtonPlayerScrollUp";
private const string ButtonPlayerScrollDown = "ButtonPlayerScrollDown";
private const string ButtonRoundsScrollUp = "ButtonRoundsScrollUp";
private const string ButtonRoundsScrollDown = "ButtonRoundsScrollDown";
const string StaticPopupBG = "StaticPopupBG";
const string StaticNextPlayer = "StaticNextPlayer";
private const string StaticPopupBG = "StaticPopupBG";
private const string StaticNextPlayer = "StaticNextPlayer";
private bool ExitPopupVisible = false;
private bool ExitPopupVisible;
private DataFromScreen Data;
private DataToScreenMain GameState;
@@ -70,31 +70,34 @@ namespace Vocaluxe.PartyModes
private SRectF RoundsTableScrollArea;
private SRectF PlayerTableScrollArea;
private int RoundsTableOffset = 0;
private int PlayerTableOffset = 0;
private int RoundsTableOffset;
private int PlayerTableOffset;
private int NumPlayerVisible = 10;
private int NumRoundsVisible = 3;
public PartyScreenChallengeMain()
public PartyScreenChallengeMedleyMain()
{
Data = new DataFromScreen();
Data.ScreenMain = new FromScreenMain();
}
protected override void Init()
public override void Init()
{
base.Init();
_ThemeName = "PartyScreenChallengeMain";
_ThemeTexts = new string[] { TextPosition, TextPlayerName, TextNumPlayed, TextWon, TextSingPoints, TextGamePoints, TextNextPlayer, TextPopupReallyExit, TextRoundNumber, TextRoundPlayer, TextRoundScore, TextFinishMessage, TextFinishPlayerWin, TextNextPlayerMessage };
_ThemeButtons = new string[] { ButtonNextRound, ButtonBack, ButtonExit, ButtonPopupYes, ButtonPopupNo, ButtonPlayerScrollDown, ButtonPlayerScrollUp, ButtonRoundsScrollDown, ButtonRoundsScrollUp };
_ThemeStatics = new string[] { StaticPopupBG, StaticNextPlayer };
_ScreenVersion = ScreenVersion;
_ThemeTexts = new string[]
{
TextPosition, TextPlayerName, TextNumPlayed, TextWon, TextSingPoints, TextGamePoints, TextNextPlayer, TextPopupReallyExit, TextRoundNumber, TextRoundPlayer,
TextRoundScore, TextFinishMessage, TextFinishPlayerWin, TextNextPlayerMessage
};
_ThemeButtons = new string[]
{ButtonNextRound, ButtonBack, ButtonExit, ButtonPopupYes, ButtonPopupNo, ButtonPlayerScrollDown, ButtonPlayerScrollUp, ButtonRoundsScrollDown, ButtonRoundsScrollUp};
_ThemeStatics = new string[] {StaticPopupBG, StaticNextPlayer};
}
public override void LoadTheme(string XmlPath)
{
base.LoadTheme(XmlPath);
base.LoadTheme(XmlPath);
GameState = new DataToScreenMain();
BuildPlayerTable();
@@ -104,9 +107,9 @@ namespace Vocaluxe.PartyModes
for (int i = 0; i < _PartyMode.GetMaxPlayer(); i++)
{
NextPlayerTexts.Add(GetNewText(Texts[htTexts(TextNextPlayer)]));
NextPlayerTexts.Add(GetNewText(Texts[TextNextPlayer]));
AddText(NextPlayerTexts[NextPlayerTexts.Count - 1]);
NextPlayerStatics.Add(GetNewStatic(Statics[htStatics(StaticNextPlayer)]));
NextPlayerStatics.Add(GetNewStatic(Statics[StaticNextPlayer]));
AddStatic(NextPlayerStatics[NextPlayerStatics.Count - 1]);
}
}
@@ -122,30 +125,28 @@ namespace Vocaluxe.PartyModes
}
catch (Exception e)
{
CBase.Log.LogError("Error in party mode screen challenge main. Can't cast received data from game mode " + _ThemeName + ". " + e.Message); ;
CBase.Log.LogError("Error in party mode screen challenge main. Can't cast received data from game mode " + ThemeName + ". " + e.Message);
}
}
public override bool HandleInput(KeyEvent KeyEvent)
public override bool HandleInput(KeyEvent keyEvent)
{
base.HandleInput(KeyEvent);
base.HandleInput(keyEvent);
if (KeyEvent.KeyPressed)
{
}
if (keyEvent.KeyPressed) {}
else
{
switch (KeyEvent.Key)
switch (keyEvent.Key)
{
case Keys.Back:
case Keys.Escape:
if (!ExitPopupVisible)
{
if (GameState.CurrentRoundNr == 1)
Back();
else
ShowPopup(true);
}
else
ShowPopup(false);
break;
@@ -153,26 +154,26 @@ namespace Vocaluxe.PartyModes
case Keys.Enter:
if (!ExitPopupVisible)
{
if (Buttons[htButtons(ButtonNextRound)].Selected)
if (Buttons[ButtonNextRound].Selected)
NextRound();
if (Buttons[htButtons(ButtonBack)].Selected && GameState.CurrentRoundNr == 1)
if (Buttons[ButtonBack].Selected && GameState.CurrentRoundNr == 1)
Back();
if (Buttons[htButtons(ButtonExit)].Selected && GameState.CurrentRoundNr > 1)
if (Buttons[ButtonExit].Selected && GameState.CurrentRoundNr > 1)
ShowPopup(true);
if (Buttons[htButtons(ButtonPlayerScrollUp)].Selected)
if (Buttons[ButtonPlayerScrollUp].Selected)
ScrollPlayerTable(-1);
if (Buttons[htButtons(ButtonPlayerScrollDown)].Selected)
if (Buttons[ButtonPlayerScrollDown].Selected)
ScrollPlayerTable(1);
if (Buttons[htButtons(ButtonRoundsScrollUp)].Selected)
if (Buttons[ButtonRoundsScrollUp].Selected)
ScrollRoundsTable(-1);
if (Buttons[htButtons(ButtonRoundsScrollDown)].Selected)
if (Buttons[ButtonRoundsScrollDown].Selected)
ScrollRoundsTable(1);
}
else
{
if (Buttons[htButtons(ButtonPopupYes)].Selected)
if (Buttons[ButtonPopupYes].Selected)
EndParty();
if (Buttons[htButtons(ButtonPopupNo)].Selected)
if (Buttons[ButtonPopupNo].Selected)
ShowPopup(false);
}
break;
@@ -181,55 +182,57 @@ namespace Vocaluxe.PartyModes
return true;
}
public override bool HandleMouse(MouseEvent MouseEvent)
public override bool HandleMouse(MouseEvent mouseEvent)
{
base.HandleMouse(MouseEvent);
base.HandleMouse(mouseEvent);
if (MouseEvent.LB && IsMouseOver(MouseEvent))
if (mouseEvent.LB && IsMouseOver(mouseEvent))
{
if (!ExitPopupVisible)
{
if (Buttons[htButtons(ButtonNextRound)].Selected)
if (Buttons[ButtonNextRound].Selected)
NextRound();
if (Buttons[htButtons(ButtonBack)].Selected && GameState.CurrentRoundNr == 1)
if (Buttons[ButtonBack].Selected && GameState.CurrentRoundNr == 1)
Back();
if (Buttons[htButtons(ButtonExit)].Selected && GameState.CurrentRoundNr > 1)
if (Buttons[ButtonExit].Selected && GameState.CurrentRoundNr > 1)
ShowPopup(true);
if (Buttons[htButtons(ButtonPlayerScrollUp)].Selected)
if (Buttons[ButtonPlayerScrollUp].Selected)
ScrollPlayerTable(-1);
if (Buttons[htButtons(ButtonPlayerScrollDown)].Selected)
if (Buttons[ButtonPlayerScrollDown].Selected)
ScrollPlayerTable(1);
if (Buttons[htButtons(ButtonRoundsScrollUp)].Selected)
if (Buttons[ButtonRoundsScrollUp].Selected)
ScrollRoundsTable(-1);
if (Buttons[htButtons(ButtonRoundsScrollDown)].Selected)
if (Buttons[ButtonRoundsScrollDown].Selected)
ScrollRoundsTable(1);
}
else
{
if (Buttons[htButtons(ButtonPopupYes)].Selected)
if (Buttons[ButtonPopupYes].Selected)
EndParty();
if (Buttons[htButtons(ButtonPopupNo)].Selected)
if (Buttons[ButtonPopupNo].Selected)
ShowPopup(false);
}
}
if (MouseEvent.RB)
if (mouseEvent.RB)
{
if (!ExitPopupVisible)
{
if (GameState.CurrentRoundNr == 1)
Back();
else
ShowPopup(true);
}
else
ShowPopup(false);
}
if (MouseEvent.Wheel != 0)
if (mouseEvent.Wheel != 0)
{
if(CHelper.IsInBounds(RoundsTableScrollArea, MouseEvent))
ScrollRoundsTable(MouseEvent.Wheel);
if(CHelper.IsInBounds(PlayerTableScrollArea, MouseEvent))
ScrollPlayerTable(MouseEvent.Wheel);
if (CHelper.IsInBounds(RoundsTableScrollArea, mouseEvent))
ScrollRoundsTable(mouseEvent.Wheel);
if (CHelper.IsInBounds(PlayerTableScrollArea, mouseEvent))
ScrollPlayerTable(mouseEvent.Wheel);
}
return true;
@@ -253,29 +256,29 @@ namespace Vocaluxe.PartyModes
if (GameState.CurrentRoundNr == 1)
{
Buttons[htButtons(ButtonBack)].Visible = true;
Buttons[htButtons(ButtonExit)].Visible = false;
Buttons[ButtonBack].Visible = true;
Buttons[ButtonExit].Visible = false;
}
else
{
Buttons[htButtons(ButtonBack)].Visible = false;
Buttons[htButtons(ButtonExit)].Visible = true;
Buttons[ButtonBack].Visible = false;
Buttons[ButtonExit].Visible = true;
}
if (GameState.CurrentRoundNr <= GameState.Combs.Count)
{
Buttons[htButtons(ButtonNextRound)].Visible = true;
Texts[htTexts(TextFinishMessage)].Visible = false;
Texts[htTexts(TextFinishPlayerWin)].Visible = false;
SetInteractionToButton(Buttons[htButtons(ButtonNextRound)]);
Buttons[ButtonNextRound].Visible = true;
Texts[TextFinishMessage].Visible = false;
Texts[TextFinishPlayerWin].Visible = false;
SetInteractionToButton(Buttons[ButtonNextRound]);
}
else
{
Buttons[htButtons(ButtonNextRound)].Visible = false;
Texts[htTexts(TextFinishMessage)].Visible = true;
Texts[htTexts(TextFinishPlayerWin)].Visible = true;
Texts[htTexts(TextFinishPlayerWin)].Text = GetPlayerWinString();
SetInteractionToButton(Buttons[htButtons(ButtonExit)]);
Buttons[ButtonNextRound].Visible = false;
Texts[TextFinishMessage].Visible = true;
Texts[TextFinishPlayerWin].Visible = true;
Texts[TextFinishPlayerWin].Text = GetPlayerWinString();
SetInteractionToButton(Buttons[ButtonExit]);
}
ShowPopup(false);
@@ -292,16 +295,11 @@ namespace Vocaluxe.PartyModes
return true;
}
public override void OnClose()
{
base.OnClose();
}
private void NextRound()
{
Data.ScreenMain.FadeToNameSelection = false;
Data.ScreenMain.FadeToSongSelection = true;
_PartyMode.DataFromScreen(_ThemeName, Data);
_PartyMode.DataFromScreen(ThemeName, Data);
}
private void EndParty()
@@ -313,25 +311,25 @@ namespace Vocaluxe.PartyModes
{
ExitPopupVisible = Visible;
Statics[htStatics(StaticPopupBG)].Visible = ExitPopupVisible;
Texts[htTexts(TextPopupReallyExit)].Visible = ExitPopupVisible;
Buttons[htButtons(ButtonPopupYes)].Visible = ExitPopupVisible;
Buttons[htButtons(ButtonPopupNo)].Visible = ExitPopupVisible;
Statics[StaticPopupBG].Visible = ExitPopupVisible;
Texts[TextPopupReallyExit].Visible = ExitPopupVisible;
Buttons[ButtonPopupYes].Visible = ExitPopupVisible;
Buttons[ButtonPopupNo].Visible = ExitPopupVisible;
if (ExitPopupVisible)
SetInteractionToButton(Buttons[htButtons(ButtonPopupNo)]);
SetInteractionToButton(Buttons[ButtonPopupNo]);
}
private void Back()
{
Data.ScreenMain.FadeToNameSelection = true;
Data.ScreenMain.FadeToSongSelection = false;
_PartyMode.DataFromScreen(_ThemeName, Data);
_PartyMode.DataFromScreen(ThemeName, Data);
}
private void UpdateNextPlayerPositions()
{
float x = CBase.Settings.GetRenderW()/2 - ((GameState.NumPlayerAtOnce * Statics[htStatics(StaticNextPlayer)].Rect.W) + ((GameState.NumPlayerAtOnce-1) * 15))/2;
float x = CBase.Settings.GetRenderW() / 2 - ((GameState.NumPlayerAtOnce * Statics[StaticNextPlayer].Rect.W) + ((GameState.NumPlayerAtOnce - 1) * 15)) / 2;
float static_y = 590;
float text_y = 550;
for (int i = 0; i < GameState.NumPlayerAtOnce; i++)
@@ -341,11 +339,11 @@ namespace Vocaluxe.PartyModes
NextPlayerStatics[i].Rect.Y = static_y;
NextPlayerStatics[i].Visible = true;
//text
NextPlayerTexts[i].X = x + Statics[htStatics(StaticNextPlayer)].Rect.W / 2;
NextPlayerTexts[i].X = x + Statics[StaticNextPlayer].Rect.W / 2;
NextPlayerTexts[i].Y = text_y;
NextPlayerTexts[i].Visible = true;
x += Statics[htStatics(StaticNextPlayer)].Rect.W + 15;
x += Statics[StaticNextPlayer].Rect.W + 15;
}
for (int i = GameState.NumPlayerAtOnce; i < _PartyMode.GetMaxPlayer(); i++)
{
@@ -358,19 +356,19 @@ namespace Vocaluxe.PartyModes
{
if (GameState.CurrentRoundNr <= GameState.Combs.Count)
{
Texts[htTexts(TextNextPlayerMessage)].Visible = true;
Texts[TextNextPlayerMessage].Visible = true;
SProfile[] profiles = CBase.Profiles.GetProfiles();
for (int i = 0; i < GameState.NumPlayerAtOnce; i++)
{
int pid = GameState.Combs[GameState.CurrentRoundNr - 1].Player[i];
NextPlayerStatics[i].Texture = profiles[GameState.ProfileIDs[pid]].Avatar.Texture;
NextPlayerTexts[i].Text = profiles[GameState.ProfileIDs[pid]].PlayerName;
NextPlayerTexts[i].Color = CBase.Theme.GetPlayerColor((i + 1));
NextPlayerTexts[i].Color = CBase.Theme.GetPlayerColor(i + 1);
}
}
else
{
Texts[htTexts(TextNextPlayerMessage)].Visible = false;
Texts[TextNextPlayerMessage].Visible = false;
for (int i = 0; i < GameState.NumPlayerAtOnce; i++)
{
NextPlayerStatics[i].Visible = false;
@@ -394,7 +392,7 @@ namespace Vocaluxe.PartyModes
for (int round = 0; round < RoundsTable.Count; round++)
{
//Round-number
CText text = GetNewText(Texts[htTexts(TextRoundNumber)]);
CText text = GetNewText(Texts[TextRoundNumber]);
AddText(text);
RoundsTable[round].Number = text;
for (int row = 0; row < 2; row++)
@@ -402,11 +400,11 @@ namespace Vocaluxe.PartyModes
for (int column = 0; column < 3; column++)
{
//Player
text = GetNewText(Texts[htTexts(TextRoundPlayer)]);
text = GetNewText(Texts[TextRoundPlayer]);
AddText(text);
RoundsTable[round].TextPlayer.Add(text);
//Score
text = GetNewText(Texts[htTexts(TextRoundScore)]);
text = GetNewText(Texts[TextRoundScore]);
AddText(text);
RoundsTable[round].TextScores.Add(text);
}
@@ -427,14 +425,14 @@ namespace Vocaluxe.PartyModes
if (NumRoundsVisible > GameState.Combs.Count)
NumRoundsVisible = GameState.Combs.Count;
float x = Texts[htTexts(TextRoundNumber)].X;
float y = Texts[htTexts(TextRoundNumber)].Y;
float x = Texts[TextRoundNumber].X;
float y = Texts[TextRoundNumber].Y;
RoundsTableScrollArea.X = x;
RoundsTableScrollArea.Y = y;
RoundsTableScrollArea.W = CBase.Settings.GetRenderW() - Texts[htTexts(TextRoundNumber)].X - 20;
RoundsTableScrollArea.W = CBase.Settings.GetRenderW() - Texts[TextRoundNumber].X - 20;
float delta = Texts[htTexts(TextRoundNumber)].Height;
float delta = Texts[TextRoundNumber].Height;
//Update statics and texts for rounds
for (int round = 0; round < RoundsTable.Count; round++)
@@ -455,8 +453,9 @@ namespace Vocaluxe.PartyModes
for (int column = row * NumPlayerInOneRow; column < num; column++)
{
//Player
float _x = x + 15 + (CBase.Settings.GetRenderW() - Texts[htTexts(TextRoundNumber)].X - 20) / NumPlayerInThisRow * (column - row * NumPlayerInOneRow) + ((CBase.Settings.GetRenderW() - Texts[htTexts(TextRoundNumber)].X - 20) / NumPlayerInThisRow) / 2;
float maxw = ((CBase.Settings.GetRenderW() - Texts[htTexts(TextRoundNumber)].X - 20) / NumPlayerInThisRow) / 2 - 5;
float _x = x + 15 + (CBase.Settings.GetRenderW() - Texts[TextRoundNumber].X - 20) / NumPlayerInThisRow * (column - row * NumPlayerInOneRow) +
((CBase.Settings.GetRenderW() - Texts[TextRoundNumber].X - 20) / NumPlayerInThisRow) / 2;
float maxw = ((CBase.Settings.GetRenderW() - Texts[TextRoundNumber].X - 20) / NumPlayerInThisRow) / 2 - 5;
RoundsTable[round].TextPlayer[column].X = _x;
RoundsTable[round].TextPlayer[column].Y = y;
RoundsTable[round].TextPlayer[column].MaxWidth = maxw;
@@ -478,7 +477,7 @@ namespace Vocaluxe.PartyModes
SProfile[] profile = CBase.Profiles.GetProfiles();
for (int i = 0; i < RoundsTable.Count; i++)
{
for(int p = 0; p < RoundsTable[i].TextPlayer.Count; p++)
for (int p = 0; p < RoundsTable[i].TextPlayer.Count; p++)
{
if (GameState.Combs.Count > i + RoundsTableOffset && GameState.Combs[i + RoundsTableOffset].Player.Count > p)
{
@@ -506,23 +505,23 @@ namespace Vocaluxe.PartyModes
{
RoundsTable[i].TextPlayer[p].Visible = false;
RoundsTable[i].TextScores[p].Visible = false;
}
}
}
}
Buttons[htButtons(ButtonRoundsScrollUp)].Visible = RoundsTableOffset > 0;
Buttons[htButtons(ButtonRoundsScrollDown)].Visible = GameState.Combs.Count - NumRoundsVisible - RoundsTableOffset > 0;
Buttons[ButtonRoundsScrollUp].Visible = RoundsTableOffset > 0;
Buttons[ButtonRoundsScrollDown].Visible = GameState.Combs.Count - NumRoundsVisible - RoundsTableOffset > 0;
}
private void BuildPlayerTable()
{
PlayerTableScrollArea = new SRectF();
PlayerTableScrollArea.X = Texts[htTexts(TextPosition)].X;
PlayerTableScrollArea.Y = Texts[htTexts(TextPosition)].Y;
PlayerTableScrollArea.W = Texts[htTexts(TextGamePoints)].X - Texts[htTexts(TextPosition)].X;
PlayerTableScrollArea.X = Texts[TextPosition].X;
PlayerTableScrollArea.Y = Texts[TextPosition].Y;
PlayerTableScrollArea.W = Texts[TextGamePoints].X - Texts[TextPosition].X;
PlayerTable = new List<TableRow>();
float delta = Texts[htTexts(TextPosition)].Height * 1.2f;
float delta = Texts[TextPosition].Height * 1.2f;
float h = 0;
@@ -530,12 +529,12 @@ namespace Vocaluxe.PartyModes
{
TableRow row = new TableRow();
row.Pos = GetNewText(Texts[htTexts(TextPosition)]);
row.Name = GetNewText(Texts[htTexts(TextPlayerName)]);
row.Rounds = GetNewText(Texts[htTexts(TextNumPlayed)]);
row.Won = GetNewText(Texts[htTexts(TextWon)]);
row.SingPoints = GetNewText(Texts[htTexts(TextSingPoints)]);
row.GamePoints = GetNewText(Texts[htTexts(TextGamePoints)]);
row.Pos = GetNewText(Texts[TextPosition]);
row.Name = GetNewText(Texts[TextPlayerName]);
row.Rounds = GetNewText(Texts[TextNumPlayed]);
row.Won = GetNewText(Texts[TextWon]);
row.SingPoints = GetNewText(Texts[TextSingPoints]);
row.GamePoints = GetNewText(Texts[TextGamePoints]);
row.Pos.Y += delta * (i + 1);
row.Name.Y += delta * (i + 1);
@@ -575,7 +574,7 @@ namespace Vocaluxe.PartyModes
{
TableRow row = PlayerTable[i];
if (i+PlayerTableOffset < GameState.ResultTable.Count)
if (i + PlayerTableOffset < GameState.ResultTable.Count)
{
row.Pos.Visible = true;
row.Name.Visible = true;
@@ -585,11 +584,11 @@ namespace Vocaluxe.PartyModes
row.GamePoints.Visible = true;
row.Pos.Text = GameState.ResultTable[i + PlayerTableOffset].Position.ToString() + ".";
row.Name.Text = profiles[GameState.ResultTable[i+PlayerTableOffset].PlayerID].PlayerName;
row.Rounds.Text = GameState.ResultTable[i+PlayerTableOffset].NumRounds.ToString();
row.Won.Text = GameState.ResultTable[i+PlayerTableOffset].NumWon.ToString();
row.SingPoints.Text = GameState.ResultTable[i+PlayerTableOffset].NumSingPoints.ToString();
row.GamePoints.Text = GameState.ResultTable[i+PlayerTableOffset].NumGamePoints.ToString();
row.Name.Text = profiles[GameState.ResultTable[i + PlayerTableOffset].PlayerID].PlayerName;
row.Rounds.Text = GameState.ResultTable[i + PlayerTableOffset].NumRounds.ToString();
row.Won.Text = GameState.ResultTable[i + PlayerTableOffset].NumWon.ToString();
row.SingPoints.Text = GameState.ResultTable[i + PlayerTableOffset].NumSingPoints.ToString();
row.GamePoints.Text = GameState.ResultTable[i + PlayerTableOffset].NumGamePoints.ToString();
}
else
{
@@ -602,8 +601,8 @@ namespace Vocaluxe.PartyModes
}
}
Buttons[htButtons(ButtonPlayerScrollUp)].Visible = PlayerTableOffset > 0;
Buttons[htButtons(ButtonPlayerScrollDown)].Visible = GameState.ProfileIDs.Count - NumPlayerVisible - PlayerTableOffset > 0;
Buttons[ButtonPlayerScrollUp].Visible = PlayerTableOffset > 0;
Buttons[ButtonPlayerScrollDown].Visible = GameState.ProfileIDs.Count - NumPlayerVisible - PlayerTableOffset > 0;
}
private void ScrollPlayerTable(int Offset)
@@ -658,4 +657,4 @@ namespace Vocaluxe.PartyModes
return s;
}
}
}
}
@@ -1,21 +1,22 @@
using System;
using System.Collections.Generic;
using System.Text;
using System.Windows.Forms;
using VocaluxeLib.Menu;
using Vocaluxe.Menu;
namespace Vocaluxe.PartyModes
namespace VocaluxeLib.PartyModes.ChallengeMedley
{
public class PartyScreenChallengeNames : CMenuParty
public class PartyScreenChallengeMedleyNames : CMenuParty
{
// Version number for theme files. Increment it, if you've changed something on the theme files!
const int ScreenVersion = 1;
protected override int _ScreenVersion
{
get { return 1; }
}
const string ButtonNext = "ButtonNext";
const string ButtonBack = "ButtonBack";
const string ButtonPlayerDestination = "ButtonPlayerDestination";
const string ButtonPlayerChoose = "ButtonPlayerChoose";
private const string ButtonNext = "ButtonNext";
private const string ButtonBack = "ButtonBack";
private const string ButtonPlayerDestination = "ButtonPlayerDestination";
private const string ButtonPlayerChoose = "ButtonPlayerChoose";
private List<CPlayerChooseButton> PlayerChooseButtons;
private List<CButton> PlayerDestinationButtons;
@@ -37,14 +38,14 @@ namespace Vocaluxe.PartyModes
private int PlayerChooseButtonsOffset = 0;
private CStatic chooseAvatarStatic;
private bool SelectingMouseActive = false;
private int OldMouseX = 0;
private int OldMouseY = 0;
private bool SelectingMouseActive;
private int OldMouseX;
private int OldMouseY;
private int SelectedPlayerNr = -1;
private bool ButtonsAdded = false;
private bool ButtonsAdded;
private int NumPlayer = 4;
private DataFromScreen Data;
private class CPlayerChooseButton
@@ -53,11 +54,7 @@ namespace Vocaluxe.PartyModes
public int ProfileID;
}
public PartyScreenChallengeNames()
{
}
protected override void Init()
public override void Init()
{
base.Init();
@@ -68,10 +65,8 @@ namespace Vocaluxe.PartyModes
Data.ScreenNames.ProfileIDs = new List<int>();
_ThemeName = "PartyScreenChallengeNames";
List<string> buttons = new List<string>();
_ThemeButtons = new string[] { ButtonBack, ButtonNext, ButtonPlayerDestination, ButtonPlayerChoose };
_ScreenVersion = ScreenVersion;
_ThemeButtons = new string[] {ButtonBack, ButtonNext, ButtonPlayerDestination, ButtonPlayerChoose};
Data = new DataFromScreen();
FromScreenNames names = new FromScreenNames();
@@ -81,11 +76,6 @@ namespace Vocaluxe.PartyModes
Data.ScreenNames = names;
}
public override void LoadTheme(string XmlPath)
{
base.LoadTheme(XmlPath);
}
public override void DataToScreen(object ReceivedData)
{
DataToScreenNames config = new DataToScreenNames();
@@ -100,58 +90,50 @@ namespace Vocaluxe.PartyModes
NumPlayer = config.NumPlayer;
while (Data.ScreenNames.ProfileIDs.Count > NumPlayer)
{
Data.ScreenNames.ProfileIDs.RemoveAt(Data.ScreenNames.ProfileIDs.Count - 1);
}
}
catch (Exception e)
{
CBase.Log.LogError("Error in party mode screen challenge names. Can't cast received data from game mode " + _ThemeName + ". " + e.Message); ;
CBase.Log.LogError("Error in party mode screen challenge names. Can't cast received data from game mode " + ThemeName + ". " + e.Message);
}
}
public override bool HandleInput(KeyEvent KeyEvent)
public override bool HandleInput(KeyEvent keyEvent)
{
base.HandleInput(KeyEvent);
base.HandleInput(keyEvent);
if (KeyEvent.KeyPressed)
if (keyEvent.KeyPressed) {}
else
{
switch (keyEvent.Key)
{
case Keys.Back:
case Keys.Escape:
Back();
break;
}
else
{
switch (KeyEvent.Key)
{
case Keys.Back:
case Keys.Escape:
case Keys.Enter:
if (Buttons[ButtonBack].Selected)
Back();
break;
case Keys.Enter:
if (Buttons[htButtons(ButtonBack)].Selected)
Back();
if (Buttons[ButtonNext].Selected)
Next();
if (Buttons[htButtons(ButtonNext)].Selected)
Next();
if (!OnAdd())
OnRemove();
break;
case Keys.Delete:
if (!OnAdd())
OnRemove();
break;
}
break;
case Keys.Delete:
OnRemove();
break;
}
}
return true;
}
public override bool HandleMouse(MouseEvent MouseEvent)
public override bool HandleMouse(MouseEvent mouseEvent)
{
base.HandleMouse(MouseEvent);
base.HandleMouse(mouseEvent);
/*
//Check if LeftButton is hold and Select-Mode inactive
@@ -182,15 +164,15 @@ namespace Vocaluxe.PartyModes
}*/
//Check if LeftButton is hold and Select-Mode active
if (MouseEvent.LBH && SelectingMouseActive)
if (mouseEvent.LBH && SelectingMouseActive)
{
//Update coords for Drag/Drop-Texture
chooseAvatarStatic.Rect.X += (MouseEvent.X - OldMouseX);
chooseAvatarStatic.Rect.Y += (MouseEvent.Y - OldMouseY);
OldMouseX = MouseEvent.X;
OldMouseY = MouseEvent.Y;
chooseAvatarStatic.Rect.X += mouseEvent.X - OldMouseX;
chooseAvatarStatic.Rect.Y += mouseEvent.Y - OldMouseY;
OldMouseX = mouseEvent.X;
OldMouseY = mouseEvent.Y;
}
// LeftButton isn't hold anymore, but Selec-Mode is still active -> "Drop" of Avatar
// LeftButton isn't hold anymore, but Selec-Mode is still active -> "Drop" of Avatar
else if (SelectingMouseActive)
{
//Check if really a player was selected
@@ -200,10 +182,10 @@ namespace Vocaluxe.PartyModes
for (int i = 0; i < PlayerDestinationButtons.Count; i++)
{
//Check first, if area is "active"
if (PlayerDestinationButtons[i].Visible == true)
if (PlayerDestinationButtons[i].Visible)
{
//Check if Mouse is in area
if (CHelper.IsInBounds(PlayerDestinationButtons[i].Rect, MouseEvent))
if (CHelper.IsInBounds(PlayerDestinationButtons[i].Rect, mouseEvent))
{
int added = -1;
//Add Player-ID to list.
@@ -236,22 +218,20 @@ namespace Vocaluxe.PartyModes
chooseAvatarStatic.Visible = false;
}
if (MouseEvent.LB && IsMouseOver(MouseEvent))
if (mouseEvent.LB && IsMouseOver(mouseEvent))
{
if (Buttons[htButtons(ButtonBack)].Selected)
if (Buttons[ButtonBack].Selected)
Back();
if (Buttons[htButtons(ButtonNext)].Selected)
if (Buttons[ButtonNext].Selected)
Next();
if (!OnAdd())
OnRemove();
}
if (MouseEvent.RB)
{
if (mouseEvent.RB)
Back();
}
return true;
}
@@ -286,20 +266,15 @@ namespace Vocaluxe.PartyModes
return true;
}
public override void OnClose()
{
base.OnClose();
}
private void AddButtonPlayerDestination()
{
Buttons[htButtons(ButtonPlayerDestination)].Visible = false;
Buttons[ButtonPlayerDestination].Visible = false;
PlayerDestinationButtons = new List<CButton>();
int row = 0;
int column = 0;
for (int i = 1; i <= _PartyMode.GetMaxPlayer(); i++)
{
CButton b = GetNewButton(Buttons[htButtons(ButtonPlayerDestination)]);
CButton b = GetNewButton(Buttons[ButtonPlayerDestination]);
b.Rect.X = PlayerDestinationButtonsFirstX + column * (b.Rect.W + PlayerDestinationButtonsSpaceH);
b.Rect.Y = PlayerDestinationButtonsFirstY + row * (b.Rect.H + PlayerDestinationButtonsSpaceW);
PlayerDestinationButtons.Add(b);
@@ -317,13 +292,13 @@ namespace Vocaluxe.PartyModes
private void AddButtonPlayerChoose()
{
Buttons[htButtons(ButtonPlayerChoose)].Visible = false;
Buttons[ButtonPlayerChoose].Visible = false;
PlayerChooseButtons = new List<CPlayerChooseButton>();
int row = 0;
int column = 0;
for (int i = 1; i <= PlayerChooseButtonsNumH * PlayerChooseButtonsNumW; i++)
{
CButton b = GetNewButton(Buttons[htButtons(ButtonPlayerChoose)]);
CButton b = GetNewButton(Buttons[ButtonPlayerChoose]);
b.Rect.X = PlayerChooseButtonsFirstX + column * (b.Rect.W + PlayerChooseButtonsSpaceH);
b.Rect.Y = PlayerChooseButtonsFirstY + row * (b.Rect.H + PlayerChooseButtonsSpaceW);
CPlayerChooseButton pcb = new CPlayerChooseButton();
@@ -345,14 +320,11 @@ namespace Vocaluxe.PartyModes
private void UpdateButtonPlayerChoose()
{
UpdateVisibleProfiles();
if ((PlayerChooseButtonsNumW * PlayerChooseButtonsNumH) * (PlayerChooseButtonsOffset + 1) - PlayerChooseButtonsVisibleProfiles.Count >= (PlayerChooseButtonsNumW * PlayerChooseButtonsNumH) * PlayerChooseButtonsOffset)
{
if ((PlayerChooseButtonsNumW * PlayerChooseButtonsNumH) * (PlayerChooseButtonsOffset + 1) - PlayerChooseButtonsVisibleProfiles.Count >=
(PlayerChooseButtonsNumW * PlayerChooseButtonsNumH) * PlayerChooseButtonsOffset)
UpdateButtonPlayerChoose(PlayerChooseButtonsOffset - 1);
}
else
{
UpdateButtonPlayerChoose(PlayerChooseButtonsOffset);
}
}
private void UpdateButtonPlayerChoose(int Offset)
@@ -379,10 +351,10 @@ namespace Vocaluxe.PartyModes
{
PlayerChooseButtons[i].ProfileID = -1;
PlayerChooseButtons[i].Button.Text.Text = String.Empty;
PlayerChooseButtons[i].Button.Texture = Buttons[htButtons(ButtonPlayerChoose)].Texture;
PlayerChooseButtons[i].Button.STexture = Buttons[htButtons(ButtonPlayerChoose)].STexture;
PlayerChooseButtons[i].Button.Color = Buttons[htButtons(ButtonPlayerChoose)].Color;
PlayerChooseButtons[i].Button.SColor = Buttons[htButtons(ButtonPlayerChoose)].SColor;
PlayerChooseButtons[i].Button.Texture = Buttons[ButtonPlayerChoose].Texture;
PlayerChooseButtons[i].Button.STexture = Buttons[ButtonPlayerChoose].STexture;
PlayerChooseButtons[i].Button.Color = Buttons[ButtonPlayerChoose].Color;
PlayerChooseButtons[i].Button.SColor = Buttons[ButtonPlayerChoose].SColor;
PlayerChooseButtons[i].Button.Enabled = false;
}
}
@@ -411,9 +383,7 @@ namespace Vocaluxe.PartyModes
}
}
if (visible)
{
PlayerChooseButtonsVisibleProfiles.Add(i);
}
}
}
@@ -448,10 +418,10 @@ namespace Vocaluxe.PartyModes
}
else
{
PlayerDestinationButtons[i].Color = Buttons[htButtons(ButtonPlayerDestination)].Color;
PlayerDestinationButtons[i].SColor = Buttons[htButtons(ButtonPlayerDestination)].SColor;
PlayerDestinationButtons[i].Texture = Buttons[htButtons(ButtonPlayerDestination)].Texture;
PlayerDestinationButtons[i].STexture = Buttons[htButtons(ButtonPlayerDestination)].STexture;
PlayerDestinationButtons[i].Color = Buttons[ButtonPlayerDestination].Color;
PlayerDestinationButtons[i].SColor = Buttons[ButtonPlayerDestination].SColor;
PlayerDestinationButtons[i].Texture = Buttons[ButtonPlayerDestination].Texture;
PlayerDestinationButtons[i].STexture = Buttons[ButtonPlayerDestination].STexture;
PlayerDestinationButtons[i].Text.Text = String.Empty;
PlayerDestinationButtons[i].Enabled = false;
}
@@ -462,11 +432,11 @@ namespace Vocaluxe.PartyModes
{
if (Data.ScreenNames.ProfileIDs.Count == NumPlayer)
{
Buttons[htButtons(ButtonNext)].Visible = true;
SetInteractionToButton(Buttons[htButtons(ButtonNext)]);
Buttons[ButtonNext].Visible = true;
SetInteractionToButton(Buttons[ButtonNext]);
}
else
Buttons[htButtons(ButtonNext)].Visible = false;
Buttons[ButtonNext].Visible = false;
}
private bool OnAdd()
@@ -521,14 +491,14 @@ namespace Vocaluxe.PartyModes
{
Data.ScreenNames.FadeToConfig = true;
Data.ScreenNames.FadeToMain = false;
_PartyMode.DataFromScreen(_ThemeName, Data);
_PartyMode.DataFromScreen(ThemeName, Data);
}
private void Next()
{
Data.ScreenNames.FadeToConfig = false;
Data.ScreenNames.FadeToMain = true;
_PartyMode.DataFromScreen(_ThemeName, Data);
_PartyMode.DataFromScreen(ThemeName, Data);
}
}
}
}
@@ -0,0 +1,809 @@
<StyleCopSettings Version="105">
<Analyzers>
<Analyzer AnalyzerId="StyleCop.CSharp.DocumentationRules">
<Rules>
<Rule Name="ElementsMustBeDocumented">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="PartialElementsMustBeDocumented">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="EnumerationItemsMustBeDocumented">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="DocumentationMustContainValidXml">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="ElementDocumentationMustHaveSummary">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="PartialElementDocumentationMustHaveSummary">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="ElementDocumentationMustHaveSummaryText">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="PartialElementDocumentationMustHaveSummaryText">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="ElementDocumentationMustNotHaveDefaultSummary">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="ElementParametersMustBeDocumented">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="ElementParameterDocumentationMustMatchElementParameters">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="ElementParameterDocumentationMustDeclareParameterName">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="ElementParameterDocumentationMustHaveText">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="ElementReturnValueMustBeDocumented">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="ElementReturnValueDocumentationMustHaveText">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="VoidReturnValueMustNotBeDocumented">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="GenericTypeParametersMustBeDocumented">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="GenericTypeParametersMustBeDocumentedPartialClass">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="GenericTypeParameterDocumentationMustMatchTypeParameters">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="GenericTypeParameterDocumentationMustDeclareParameterName">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="GenericTypeParameterDocumentationMustHaveText">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="PropertySummaryDocumentationMustMatchAccessors">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="PropertySummaryDocumentationMustOmitSetAccessorWithRestrictedAccess">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="ElementDocumentationMustNotBeCopiedAndPasted">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="SingleLineCommentsMustNotUseDocumentationStyleSlashes">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="DocumentationTextMustNotBeEmpty">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="DocumentationTextMustContainWhitespace">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="DocumentationMustMeetCharacterPercentage">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="ConstructorSummaryDocumentationMustBeginWithStandardText">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="DestructorSummaryDocumentationMustBeginWithStandardText">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="DocumentationHeadersMustNotContainBlankLines">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="IncludedDocumentationXPathDoesNotExist">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="IncludeNodeDoesNotContainValidFileAndPath">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="InheritDocMustBeUsedWithInheritingClass">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="ElementDocumentationMustBeSpelledCorrectly">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="FileMustHaveHeader">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="FileHeaderMustShowCopyright">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="FileHeaderMustHaveCopyrightText">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="FileHeaderMustContainFileName">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="FileHeaderFileNameDocumentationMustMatchFileName">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="FileHeaderMustHaveValidCompanyText">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="FileHeaderFileNameDocumentationMustMatchTypeName">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
</Rules>
<AnalyzerSettings />
</Analyzer>
<Analyzer AnalyzerId="StyleCop.CSharp.LayoutRules">
<Rules>
<Rule Name="CurlyBracketsForMultiLineStatementsMustNotShareLine">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="StatementMustNotBeOnSingleLine">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="ElementMustNotBeOnSingleLine">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="CurlyBracketsMustNotBeOmitted">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="AllAccessorsMustBeMultiLineOrSingleLine">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="OpeningCurlyBracketsMustNotBeFollowedByBlankLine">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="ElementDocumentationHeadersMustNotBeFollowedByBlankLine">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="CodeMustNotContainMultipleBlankLinesInARow">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="ClosingCurlyBracketsMustNotBePrecededByBlankLine">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="OpeningCurlyBracketsMustNotBePrecededByBlankLine">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="ChainedStatementBlocksMustNotBePrecededByBlankLine">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="WhileDoFooterMustNotBePrecededByBlankLine">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="SingleLineCommentsMustNotBeFollowedByBlankLine">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="ClosingCurlyBracketMustBeFollowedByBlankLine">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="ElementDocumentationHeaderMustBePrecededByBlankLine">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="SingleLineCommentMustBePrecededByBlankLine">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="ElementsMustBeSeparatedByBlankLine">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="CodeMustNotContainBlankLinesAtStartOfFile">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="CodeMustNotContainBlankLinesAtEndOfFile">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
</Rules>
<AnalyzerSettings />
</Analyzer>
<Analyzer AnalyzerId="StyleCop.CSharp.MaintainabilityRules">
<Rules>
<Rule Name="AccessModifierMustBeDeclared">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="FieldsMustBePrivate">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="CodeAnalysisSuppressionMustHaveJustification">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="DebugAssertMustProvideMessageText">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="DebugFailMustProvideMessageText">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="FileMayOnlyContainASingleClass">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="FileMayOnlyContainASingleNamespace">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="StatementMustNotUseUnnecessaryParenthesis">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="ArithmeticExpressionsMustDeclarePrecedence">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="ConditionalExpressionsMustDeclarePrecedence">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="RemoveDelegateParenthesisWhenPossible">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="AttributeConstructorMustNotUseUnnecessaryParenthesis">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="RemoveUnnecessaryCode">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
</Rules>
<AnalyzerSettings />
</Analyzer>
<Analyzer AnalyzerId="StyleCop.CSharp.NamingRules">
<Rules>
<Rule Name="ElementMustBeginWithUpperCaseLetter">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="ElementMustBeginWithLowerCaseLetter">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="InterfaceNamesMustBeginWithI">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="ConstFieldNamesMustBeginWithUpperCaseLetter">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="NonPrivateReadonlyFieldsMustBeginWithUpperCaseLetter">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="FieldNamesMustNotUseHungarianNotation">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="FieldNamesMustBeginWithLowerCaseLetter">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="AccessibleFieldsMustBeginWithUpperCaseLetter">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="VariableNamesMustNotBePrefixed">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="FieldNamesMustNotBeginWithUnderscore">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="FieldNamesMustNotContainUnderscore">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="StaticReadonlyFieldsMustBeginWithUpperCaseLetter">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
</Rules>
<AnalyzerSettings />
</Analyzer>
<Analyzer AnalyzerId="StyleCop.CSharp.OrderingRules">
<Rules>
<Rule Name="UsingDirectivesMustBePlacedWithinNamespace">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="ElementsMustAppearInTheCorrectOrder">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="ElementsMustBeOrderedByAccess">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="ConstantsMustAppearBeforeFields">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="StaticElementsMustAppearBeforeInstanceElements">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="DeclarationKeywordsMustFollowOrder">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="ProtectedMustComeBeforeInternal">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="PropertyAccessorsMustFollowOrder">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="EventAccessorsMustFollowOrder">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="StaticReadonlyElementsMustAppearBeforeStaticNonReadonlyElements">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="InstanceReadonlyElementsMustAppearBeforeInstanceNonReadonlyElements">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="SystemUsingDirectivesMustBePlacedBeforeOtherUsingDirectives">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="UsingAliasDirectivesMustBePlacedAfterOtherUsingDirectives">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="UsingDirectivesMustBeOrderedAlphabeticallyByNamespace">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="UsingAliasDirectivesMustBeOrderedAlphabeticallyByAliasName">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
</Rules>
<AnalyzerSettings />
</Analyzer>
<Analyzer AnalyzerId="StyleCop.CSharp.ReadabilityRules">
<Rules>
<Rule Name="CommentsMustContainText">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="DoNotPrefixCallsWithBaseUnlessLocalImplementationExists">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="PrefixLocalCallsWithThis">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="PrefixCallsCorrectly">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="OpeningParenthesisMustBeOnDeclarationLine">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="ClosingParenthesisMustBeOnLineOfLastParameter">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="ClosingParenthesisMustBeOnLineOfOpeningParenthesis">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="CommaMustBeOnSameLineAsPreviousParameter">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="ParameterListMustFollowDeclaration">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="ParameterMustFollowComma">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="SplitParametersMustStartOnLineAfterDeclaration">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="ParametersMustBeOnSameLineOrSeparateLines">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="ParameterMustNotSpanMultipleLines">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="QueryClauseMustFollowPreviousClause">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="QueryClausesMustBeOnSeparateLinesOrAllOnOneLine">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="QueryClauseMustBeginOnNewLineWhenPreviousClauseSpansMultipleLines">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="QueryClausesSpanningMultipleLinesMustBeginOnOwnLine">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="DoNotPlaceRegionsWithinElements">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="CodeMustNotContainEmptyStatements">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="CodeMustNotContainMultipleStatementsOnOneLine">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="BlockStatementsMustNotContainEmbeddedComments">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="BlockStatementsMustNotContainEmbeddedRegions">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="UseStringEmptyForEmptyStrings">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="UseBuiltInTypeAlias">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="UseShorthandForNullableTypes">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
</Rules>
<AnalyzerSettings />
</Analyzer>
<Analyzer AnalyzerId="StyleCop.CSharp.SpacingRules">
<Rules>
<Rule Name="KeywordsMustBeSpacedCorrectly">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="CommasMustBeSpacedCorrectly">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="SemicolonsMustBeSpacedCorrectly">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="SymbolsMustBeSpacedCorrectly">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="DocumentationLinesMustBeginWithSingleSpace">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="SingleLineCommentsMustBeginWithSingleSpace">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="PreprocessorKeywordsMustNotBePrecededBySpace">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="OperatorKeywordMustBeFollowedBySpace">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="OpeningParenthesisMustBeSpacedCorrectly">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="ClosingParenthesisMustBeSpacedCorrectly">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="OpeningSquareBracketsMustBeSpacedCorrectly">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="ClosingSquareBracketsMustBeSpacedCorrectly">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="OpeningCurlyBracketsMustBeSpacedCorrectly">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="ClosingCurlyBracketsMustBeSpacedCorrectly">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="OpeningGenericBracketsMustBeSpacedCorrectly">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="ClosingGenericBracketsMustBeSpacedCorrectly">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="OpeningAttributeBracketsMustBeSpacedCorrectly">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="ClosingAttributeBracketsMustBeSpacedCorrectly">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="NullableTypeSymbolsMustNotBePrecededBySpace">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="MemberAccessSymbolsMustBeSpacedCorrectly">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="IncrementDecrementSymbolsMustBeSpacedCorrectly">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="NegativeSignsMustBeSpacedCorrectly">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="PositiveSignsMustBeSpacedCorrectly">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="DereferenceAndAccessOfSymbolsMustBeSpacedCorrectly">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="ColonsMustBeSpacedCorrectly">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="CodeMustNotContainMultipleWhitespaceInARow">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="CodeMustNotContainSpaceAfterNewKeywordInImplicitlyTypedArrayAllocation">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="TabsMustNotBeUsed">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
</Rules>
<AnalyzerSettings />
</Analyzer>
</Analyzers>
</StyleCopSettings>
Binary file not shown.
@@ -1,10 +1,11 @@
using System;
using System.Collections.Generic;
using System.Text;
using System.Runtime.InteropServices;
using VocaluxeLib.Menu;
using Vocaluxe.Menu;
[assembly: ComVisible(false)]
namespace Vocaluxe.PartyModes
namespace VocaluxeLib.PartyModes.TicTacToe
{
public enum ESongSource
{
@@ -30,7 +31,9 @@ namespace Vocaluxe.PartyModes
public int Winner;
public bool Finished = false;
}
#region Communication
#region ToScreen
public struct DataToScreenConfig
{
@@ -105,6 +108,7 @@ namespace Vocaluxe.PartyModes
public List<int> Songs;
}
#endregion FromScreen
#endregion Communication
public sealed class PartyModeTicTacToe : CPartyMode
@@ -115,7 +119,7 @@ namespace Vocaluxe.PartyModes
private const int MinTeams = 2;
private const int NumFields = 9;
enum EStage
private enum EStage
{
NotStarted,
Config,
@@ -124,7 +128,7 @@ namespace Vocaluxe.PartyModes
Singing
}
struct Data
private struct Data
{
public int NumPlayerTeam1;
public int NumPlayerTeam2;
@@ -163,13 +167,13 @@ namespace Vocaluxe.PartyModes
_ScreenSongOptions.Selection.RandomOnly = false;
_ScreenSongOptions.Selection.PartyMode = true;
_ScreenSongOptions.Selection.CategoryChangeAllowed = true;
_ScreenSongOptions.Selection.NumJokers = new int[] { 5, 5 };
_ScreenSongOptions.Selection.TeamNames = new string[] { "foo", "bar" };
_ScreenSongOptions.Selection.NumJokers = new int[] {5, 5};
_ScreenSongOptions.Selection.TeamNames = new string[] {"foo", "bar"};
_ScreenSongOptions.Sorting.SearchString = String.Empty;
_ScreenSongOptions.Sorting.SearchActive = false;
_ScreenSongOptions.Sorting.ShowDuetSongs = false;
_ScreenSongOptions.Sorting.DuetOptions = EDuetOptions.NoDuets;
_Stage = EStage.NotStarted;
ToScreenConfig = new DataToScreenConfig();
@@ -225,7 +229,7 @@ namespace Vocaluxe.PartyModes
switch (ScreenName)
{
case "PartyScreenTicTacToeConfig":
try
{
data = (DataFromScreen)Data;
@@ -285,9 +289,7 @@ namespace Vocaluxe.PartyModes
GameData.PlayerTeam2 = data.ScreenMain.PlayerTeam2;
}
if (data.ScreenMain.FadeToNameSelection)
{
_Stage = EStage.Config;
}
}
catch (Exception e)
{
@@ -407,10 +409,8 @@ namespace Vocaluxe.PartyModes
Screen.DataToScreen(ToScreenMain);
}
break;
default:
break;
}
return Screen;
}
@@ -474,9 +474,7 @@ namespace Vocaluxe.PartyModes
return NumFields;
}
public override void JokerUsed(int TeamNr)
{
}
public override void JokerUsed(int TeamNr) {}
public override void SongSelected(int SongID)
{
@@ -531,14 +529,19 @@ namespace Vocaluxe.PartyModes
int num = 0;
int random = 0;
//Add IDs to team-list
while (GameData.PlayerTeam1.Count < GameData.NumFields + GameData.NumJokerRetry[0] && IDs1.Count == 0 && GameData.PlayerTeam2.Count < GameData.NumFields + GameData.NumJokerRetry[1] && IDs2.Count == 0)
while (GameData.PlayerTeam1.Count < GameData.NumFields + GameData.NumJokerRetry[0] && IDs1.Count == 0 &&
GameData.PlayerTeam2.Count < GameData.NumFields + GameData.NumJokerRetry[1] && IDs2.Count == 0)
{
if (IDs1.Count == 0)
{
for (int i = 0; i < GameData.NumPlayerTeam1; i++)
IDs1.Add(i);
}
if (IDs2.Count == 0)
{
for (int i = 0; i < GameData.NumPlayerTeam2; i++)
IDs2.Add(i);
}
if (GameData.PlayerTeam1.Count < GameData.NumFields + GameData.NumJokerRetry[0])
{
random = CBase.Game.GetRandom((IDs1.Count - 1) * 10);
@@ -569,8 +572,10 @@ namespace Vocaluxe.PartyModes
while (GameData.PlayerTeam1.Count < GameData.NumFields + GameData.NumJokerRetry[0] && IDs.Count == 0)
{
if (IDs.Count == 0)
{
for (int i = 0; i < GameData.NumPlayerTeam1; i++)
IDs.Add(i);
}
if (GameData.PlayerTeam1.Count < GameData.NumFields + GameData.NumJokerRetry[0])
{
random = CBase.Game.GetRandom((IDs.Count - 1) * 10);
@@ -592,8 +597,10 @@ namespace Vocaluxe.PartyModes
while (GameData.PlayerTeam2.Count < GameData.NumFields + GameData.NumJokerRetry[1] && IDs.Count == 0)
{
if (IDs.Count == 0)
{
for (int i = 0; i < GameData.NumPlayerTeam2; i++)
IDs.Add(i);
}
if (GameData.PlayerTeam2.Count < GameData.NumFields + GameData.NumJokerRetry[1])
{
random = CBase.Game.GetRandom((IDs.Count - 1) * 20);
@@ -626,7 +633,8 @@ namespace Vocaluxe.PartyModes
break;
}
while(GameData.Songs.Count < (GameData.NumFields + GameData.NumJokerRandom[0] + GameData.NumJokerRandom[1])){
while (GameData.Songs.Count < (GameData.NumFields + GameData.NumJokerRandom[0] + GameData.NumJokerRandom[1]))
{
List<int> Songs = new List<int>();
switch (GameData.SongSource)
{
@@ -635,8 +643,10 @@ namespace Vocaluxe.PartyModes
{
int id = CBase.Playlist.GetPlaylistSong(GameData.PlaylistID, i).SongID;
foreach (EGameMode mode in CBase.Songs.GetSongByID(id).AvailableGameModes)
if (mode == gm)
{
if (mode == gm)
Songs.Add(id);
}
}
break;
@@ -644,8 +654,10 @@ namespace Vocaluxe.PartyModes
for (int i = 0; i < CBase.Songs.GetNumSongs(); i++)
{
foreach (EGameMode mode in CBase.Songs.GetSongByID(i).AvailableGameModes)
if (mode == gm)
{
if (mode == gm)
Songs.Add(i);
}
}
break;
@@ -653,14 +665,16 @@ namespace Vocaluxe.PartyModes
CBase.Songs.SetCategory(GameData.CategoryID);
for (int i = 0; i < CBase.Songs.NumSongsInCategory(GameData.CategoryID); i++)
{
foreach(EGameMode mode in CBase.Songs.GetVisibleSong(i).AvailableGameModes)
if(mode == gm)
foreach (EGameMode mode in CBase.Songs.GetVisibleSong(i).AvailableGameModes)
{
if (mode == gm)
Songs.Add(CBase.Songs.GetVisibleSong(i).ID);
}
}
CBase.Songs.SetCategory(-1);
break;
}
while(Songs.Count > 0)
while (Songs.Count > 0)
{
GameData.Songs.Add(Songs[CBase.Game.GetRandom(Songs.Count - 1)]);
Songs.Remove(GameData.Songs[GameData.Songs.Count - 1]);
@@ -776,13 +790,9 @@ namespace Vocaluxe.PartyModes
GameData.Rounds[GameData.SingRoundNr].PointsTeam2 = (int)Math.Round(results[1].Points);
GameData.Rounds[GameData.SingRoundNr].Finished = true;
if (GameData.Rounds[GameData.SingRoundNr].PointsTeam1 < GameData.Rounds[GameData.SingRoundNr].PointsTeam2)
{
GameData.Rounds[GameData.SingRoundNr].Winner = 2;
}
else if (GameData.Rounds[GameData.SingRoundNr].PointsTeam1 > GameData.Rounds[GameData.SingRoundNr].PointsTeam2)
{
GameData.Rounds[GameData.SingRoundNr].Winner = 1;
}
else
{
GameData.Rounds[GameData.SingRoundNr].Finished = false;
@@ -8,8 +8,8 @@
<ProjectGuid>{6F3E1874-F28A-40E9-AFBD-31934D593679}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>PartyModeTicTacToe</RootNamespace>
<AssemblyName>PartyModeTicTacToe</AssemblyName>
<RootNamespace>VocaluxeLib.PartyModes.TicTacToe</RootNamespace>
<AssemblyName>TicTacToe</AssemblyName>
<TargetFrameworkVersion>v2.0</TargetFrameworkVersion>
<TargetFrameworkProfile>
</TargetFrameworkProfile>
@@ -20,7 +20,7 @@
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>..\..\Output\PartyModes\TicTacToe\Code</OutputPath>
<OutputPath>bin</OutputPath>
<DefineConstants>TRACE;DEBUG;WIN</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
@@ -30,7 +30,7 @@
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugType>none</DebugType>
<Optimize>true</Optimize>
<OutputPath>..\..\Output\PartyModes\TicTacToe\Code</OutputPath>
<OutputPath>bin</OutputPath>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<UseVSHostingProcess>false</UseVSHostingProcess>
@@ -42,17 +42,18 @@
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>..\..\Output\PartyModes\TicTacToe\Code</OutputPath>
<OutputPath>bin</OutputPath>
<DefineConstants>TRACE;DEBUG;WIN</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<GenerateSerializationAssemblies>Off</GenerateSerializationAssemblies>
<CodeAnalysisRuleSet>..\..\CheckingRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'ReleaseWin|x64'">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugType>none</DebugType>
<Optimize>true</Optimize>
<OutputPath>..\..\Output\PartyModes\TicTacToe\Code</OutputPath>
<OutputPath>bin</OutputPath>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<UseVSHostingProcess>false</UseVSHostingProcess>
@@ -64,7 +65,7 @@
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>..\..\Output\PartyModes\TicTacToe\Code</OutputPath>
<OutputPath>bin</OutputPath>
<DefineConstants>TRACE;DEBUG;LINUX</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
@@ -74,7 +75,7 @@
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugType>none</DebugType>
<Optimize>true</Optimize>
<OutputPath>..\..\Output\PartyModes\TicTacToe\Code</OutputPath>
<OutputPath>bin</OutputPath>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<UseVSHostingProcess>false</UseVSHostingProcess>
@@ -86,7 +87,7 @@
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>..\..\Output\PartyModes\TicTacToe\Code</OutputPath>
<OutputPath>bin</OutputPath>
<DefineConstants>TRACE;DEBUG;LINUX</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
@@ -96,7 +97,7 @@
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugType>none</DebugType>
<Optimize>true</Optimize>
<OutputPath>..\..\Output\PartyModes\TicTacToe\Code</OutputPath>
<OutputPath>bin</OutputPath>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<UseVSHostingProcess>false</UseVSHostingProcess>
@@ -107,18 +108,11 @@
<StartupObject />
</PropertyGroup>
<ItemGroup>
<Compile Include="PartyModeTicTacToe.cs">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Compile>
<Compile Include="PartyScreenTicTacToeConfig.cs">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Compile>
<Compile Include="PartyScreenTicTacToeMain.cs">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Compile>
<Compile Include="PartyScreenTicTacToeNames.cs">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Compile>
<Compile Include="GlobalSuppressions.cs" />
<Compile Include="PartyModeTicTacToe.cs" />
<Compile Include="PartyScreenTicTacToeConfig.cs" />
<Compile Include="PartyScreenTicTacToeMain.cs" />
<Compile Include="PartyScreenTicTacToeNames.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\VocaluxeLib\VocaluxeLib.csproj">
@@ -134,7 +128,14 @@
<Reference Include="System.Windows.Forms" />
<Reference Include="System.XML" />
</ItemGroup>
<ItemGroup>
<Folder Include="Properties\" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<PropertyGroup>
<PostBuildEvent>cd $(SolutionDir)Partymodes\
xcopy "$(ProjectDir)*.cs" "$(SolutionDir)Output\PartyModes\$(TargetName)\Code\" /EXCLUDE:Excludes.txt /I /Y</PostBuildEvent>
</PropertyGroup>
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
@@ -1,43 +1,38 @@
using System;
using System.Collections.Generic;
using System.Text;
using System.Windows.Forms;
using VocaluxeLib.Menu;
using Vocaluxe.Menu;
namespace Vocaluxe.PartyModes
namespace VocaluxeLib.PartyModes.TicTacToe
{
public class PartyScreenTicTacToeConfig : CMenuParty
{
// Version number for theme files. Increment it, if you've changed something on the theme files!
const int ScreenVersion = 1;
protected override int _ScreenVersion
{
get { return 1; }
}
const string SelectSlideNumPlayerTeam1 = "SelectSlideNumPlayerTeam1";
const string SelectSlideNumPlayerTeam2 = "SelectSlideNumPlayerTeam2";
const string SelectSlideNumFields = "SelectSlideNumFields";
const string SelectSlideSongSource = "SelectSlideSongSource";
const string SelectSlidePlaylist = "SelectSlidePlaylist";
const string SelectSlideCategory = "SelectSlideCategory";
const string SelectSlideGameMode = "SelectSlideGameMode";
const string ButtonNext = "ButtonNext";
const string ButtonBack = "ButtonBack";
private const string SelectSlideNumPlayerTeam1 = "SelectSlideNumPlayerTeam1";
private const string SelectSlideNumPlayerTeam2 = "SelectSlideNumPlayerTeam2";
private const string SelectSlideNumFields = "SelectSlideNumFields";
private const string SelectSlideSongSource = "SelectSlideSongSource";
private const string SelectSlidePlaylist = "SelectSlidePlaylist";
private const string SelectSlideCategory = "SelectSlideCategory";
private const string SelectSlideGameMode = "SelectSlideGameMode";
private const string ButtonNext = "ButtonNext";
private const string ButtonBack = "ButtonBack";
private bool ConfigOk = true;
DataFromScreen Data;
private DataFromScreen Data;
public PartyScreenTicTacToeConfig()
{
}
protected override void Init()
public override void Init()
{
base.Init();
_ThemeName = "PartyScreenTicTacToeConfig";
_ThemeSelectSlides = new string[] { SelectSlideNumPlayerTeam1, SelectSlideNumPlayerTeam2, SelectSlideNumFields, SelectSlideSongSource, SelectSlidePlaylist, SelectSlideCategory, SelectSlideGameMode };
_ThemeButtons = new string[] { ButtonNext, ButtonBack };
_ScreenVersion = ScreenVersion;
_ThemeSelectSlides = new string[]
{SelectSlideNumPlayerTeam1, SelectSlideNumPlayerTeam2, SelectSlideNumFields, SelectSlideSongSource, SelectSlidePlaylist, SelectSlideCategory, SelectSlideGameMode};
_ThemeButtons = new string[] {ButtonNext, ButtonBack};
Data = new DataFromScreen();
FromScreenConfig config = new FromScreenConfig();
@@ -51,11 +46,6 @@ namespace Vocaluxe.PartyModes
Data.ScreenConfig = config;
}
public override void LoadTheme(string XmlPath)
{
base.LoadTheme(XmlPath);
}
public override void DataToScreen(object ReceivedData)
{
DataToScreenConfig config = new DataToScreenConfig();
@@ -73,22 +63,18 @@ namespace Vocaluxe.PartyModes
}
catch (Exception e)
{
CBase.Log.LogError("Error in party mode screen TicTacToe config. Can't cast received data from game mode " + _ThemeName + ". " + e.Message);;
CBase.Log.LogError("Error in party mode screen TicTacToe config. Can't cast received data from game mode " + ThemeName + ". " + e.Message);
}
}
public override bool HandleInput(KeyEvent KeyEvent)
public override bool HandleInput(KeyEvent keyEvent)
{
base.HandleInput(KeyEvent);
base.HandleInput(keyEvent);
if (KeyEvent.KeyPressed)
{
}
if (keyEvent.KeyPressed) {}
else
{
switch (KeyEvent.Key)
switch (keyEvent.Key)
{
case Keys.Back:
case Keys.Escape:
@@ -98,10 +84,10 @@ namespace Vocaluxe.PartyModes
case Keys.Enter:
UpdateSlides();
if (Buttons[htButtons(ButtonBack)].Selected)
if (Buttons[ButtonBack].Selected)
Back();
if (Buttons[htButtons(ButtonNext)].Selected)
if (Buttons[ButtonNext].Selected)
Next();
break;
@@ -117,24 +103,22 @@ namespace Vocaluxe.PartyModes
return true;
}
public override bool HandleMouse(MouseEvent MouseEvent)
public override bool HandleMouse(MouseEvent mouseEvent)
{
base.HandleMouse(MouseEvent);
base.HandleMouse(mouseEvent);
if (MouseEvent.LB && IsMouseOver(MouseEvent))
if (mouseEvent.LB && IsMouseOver(mouseEvent))
{
UpdateSlides();
if (Buttons[htButtons(ButtonBack)].Selected)
if (Buttons[ButtonBack].Selected)
Back();
if (Buttons[htButtons(ButtonNext)].Selected)
if (Buttons[ButtonNext].Selected)
Next();
}
if (MouseEvent.RB)
{
if (mouseEvent.RB)
Back();
}
return true;
}
@@ -152,7 +136,7 @@ namespace Vocaluxe.PartyModes
public override bool UpdateGame()
{
Buttons[htButtons(ButtonNext)].Visible = ConfigOk;
Buttons[ButtonNext].Visible = ConfigOk;
return true;
}
@@ -162,86 +146,75 @@ namespace Vocaluxe.PartyModes
return true;
}
public override void OnClose()
{
base.OnClose();
}
private void FillSlides()
{
// build num player slide (min player ... max player);
SelectSlides[htSelectSlides(SelectSlideNumPlayerTeam1)].Clear();
for (int i = _PartyMode.GetMinPlayer()/2; i <= _PartyMode.GetMaxPlayer() / 2; i++)
{
SelectSlides[htSelectSlides(SelectSlideNumPlayerTeam1)].AddValue(i.ToString());
}
SelectSlides[htSelectSlides(SelectSlideNumPlayerTeam1)].Selection = Data.ScreenConfig.NumPlayerTeam1 - (_PartyMode.GetMinPlayer()/2);
SelectSlides[SelectSlideNumPlayerTeam1].Clear();
for (int i = _PartyMode.GetMinPlayer() / 2; i <= _PartyMode.GetMaxPlayer() / 2; i++)
SelectSlides[SelectSlideNumPlayerTeam1].AddValue(i.ToString());
SelectSlides[SelectSlideNumPlayerTeam1].Selection = Data.ScreenConfig.NumPlayerTeam1 - (_PartyMode.GetMinPlayer() / 2);
SelectSlides[htSelectSlides(SelectSlideNumPlayerTeam2)].Clear();
for (int i = _PartyMode.GetMinPlayer()/2; i <= _PartyMode.GetMaxPlayer() / 2; i++)
{
SelectSlides[htSelectSlides(SelectSlideNumPlayerTeam2)].AddValue(i.ToString());
}
SelectSlides[htSelectSlides(SelectSlideNumPlayerTeam2)].Selection = Data.ScreenConfig.NumPlayerTeam2 -( _PartyMode.GetMinPlayer()/2);
SelectSlides[SelectSlideNumPlayerTeam2].Clear();
for (int i = _PartyMode.GetMinPlayer() / 2; i <= _PartyMode.GetMaxPlayer() / 2; i++)
SelectSlides[SelectSlideNumPlayerTeam2].AddValue(i.ToString());
SelectSlides[SelectSlideNumPlayerTeam2].Selection = Data.ScreenConfig.NumPlayerTeam2 - (_PartyMode.GetMinPlayer() / 2);
SelectSlides[htSelectSlides(SelectSlideNumFields)].Clear();
SelectSlides[htSelectSlides(SelectSlideNumFields)].AddValue("9");
SelectSlides[htSelectSlides(SelectSlideNumFields)].AddValue("16");
SelectSlides[htSelectSlides(SelectSlideNumFields)].AddValue("25");
SelectSlides[SelectSlideNumFields].Clear();
SelectSlides[SelectSlideNumFields].AddValue("9");
SelectSlides[SelectSlideNumFields].AddValue("16");
SelectSlides[SelectSlideNumFields].AddValue("25");
if (Data.ScreenConfig.NumFields == 9)
SelectSlides[htSelectSlides(SelectSlideNumFields)].Selection = 0;
SelectSlides[SelectSlideNumFields].Selection = 0;
else if (Data.ScreenConfig.NumFields == 16)
SelectSlides[htSelectSlides(SelectSlideNumFields)].Selection = 1;
SelectSlides[SelectSlideNumFields].Selection = 1;
else if (Data.ScreenConfig.NumFields == 25)
SelectSlides[htSelectSlides(SelectSlideNumFields)].Selection = 2;
SelectSlides[SelectSlideNumFields].Selection = 2;
SelectSlides[htSelectSlides(SelectSlideSongSource)].Clear();
SelectSlides[htSelectSlides(SelectSlideSongSource)].SetValues<ESongSource>((int)Data.ScreenConfig.SongSource);
SelectSlides[SelectSlideSongSource].Clear();
SelectSlides[SelectSlideSongSource].SetValues<ESongSource>((int)Data.ScreenConfig.SongSource);
string[] _Playlists = CBase.Playlist.GetPlaylistNames();
SelectSlides[htSelectSlides(SelectSlidePlaylist)].Clear();
SelectSlides[SelectSlidePlaylist].Clear();
for (int i = 0; i < _Playlists.Length; i++)
{
string value = _Playlists[i] + " (" + CBase.Playlist.GetPlaylistSongCount(i) + " " + CBase.Language.Translate("TR_SONGS", _PartyModeID) + ")";
SelectSlides[htSelectSlides(SelectSlidePlaylist)].AddValue(value);
SelectSlides[SelectSlidePlaylist].AddValue(value);
}
SelectSlides[htSelectSlides(SelectSlidePlaylist)].Selection = Data.ScreenConfig.PlaylistID;
SelectSlides[htSelectSlides(SelectSlidePlaylist)].Visible = Data.ScreenConfig.SongSource == ESongSource.TR_PLAYLIST;
SelectSlides[SelectSlidePlaylist].Selection = Data.ScreenConfig.PlaylistID;
SelectSlides[SelectSlidePlaylist].Visible = Data.ScreenConfig.SongSource == ESongSource.TR_PLAYLIST;
string[] _Categories = new string[CBase.Songs.GetNumCategories()];
for (int i = 0; i < CBase.Songs.GetNumCategories(); i++ )
{
for (int i = 0; i < CBase.Songs.GetNumCategories(); i++)
_Categories[i] = CBase.Songs.GetCategory(i).Name;
}
SelectSlides[htSelectSlides(SelectSlideCategory)].Clear();
SelectSlides[SelectSlideCategory].Clear();
for (int i = 0; i < _Categories.Length; i++)
{
string value = _Categories[i] + " (" + CBase.Songs.NumSongsInCategory(i) + " " + CBase.Language.Translate("TR_SONGS", _PartyModeID) + ")";
SelectSlides[htSelectSlides(SelectSlideCategory)].AddValue(value);
SelectSlides[SelectSlideCategory].AddValue(value);
}
SelectSlides[htSelectSlides(SelectSlideCategory)].Selection = Data.ScreenConfig.CategoryID;
SelectSlides[htSelectSlides(SelectSlideCategory)].Visible = Data.ScreenConfig.SongSource == ESongSource.TR_CATEGORY;
SelectSlides[SelectSlideCategory].Selection = Data.ScreenConfig.CategoryID;
SelectSlides[SelectSlideCategory].Visible = Data.ScreenConfig.SongSource == ESongSource.TR_CATEGORY;
SelectSlides[htSelectSlides(SelectSlideGameMode)].Visible = true;
SelectSlides[htSelectSlides(SelectSlideGameMode)].SetValues<EPartyGameMode>((int)Data.ScreenConfig.GameMode);
SelectSlides[SelectSlideGameMode].Visible = true;
SelectSlides[SelectSlideGameMode].SetValues<EPartyGameMode>((int)Data.ScreenConfig.GameMode);
}
private void UpdateSlides()
{
Data.ScreenConfig.NumPlayerTeam1 = SelectSlides[htSelectSlides(SelectSlideNumPlayerTeam1)].Selection + (_PartyMode.GetMinPlayer()/2);
Data.ScreenConfig.NumPlayerTeam2 = SelectSlides[htSelectSlides(SelectSlideNumPlayerTeam2)].Selection + (_PartyMode.GetMinPlayer()/2);
Data.ScreenConfig.NumPlayerTeam1 = SelectSlides[SelectSlideNumPlayerTeam1].Selection + (_PartyMode.GetMinPlayer() / 2);
Data.ScreenConfig.NumPlayerTeam2 = SelectSlides[SelectSlideNumPlayerTeam2].Selection + (_PartyMode.GetMinPlayer() / 2);
if (SelectSlides[htSelectSlides(SelectSlideNumFields)].Selection == 0)
if (SelectSlides[SelectSlideNumFields].Selection == 0)
Data.ScreenConfig.NumFields = 9;
else if (SelectSlides[htSelectSlides(SelectSlideNumFields)].Selection == 1)
else if (SelectSlides[SelectSlideNumFields].Selection == 1)
Data.ScreenConfig.NumFields = 16;
else if (SelectSlides[htSelectSlides(SelectSlideNumFields)].Selection == 2)
else if (SelectSlides[SelectSlideNumFields].Selection == 2)
Data.ScreenConfig.NumFields = 25;
Data.ScreenConfig.SongSource = (ESongSource)SelectSlides[htSelectSlides(SelectSlideSongSource)].Selection;
Data.ScreenConfig.PlaylistID = SelectSlides[htSelectSlides(SelectSlidePlaylist)].Selection;
Data.ScreenConfig.CategoryID = SelectSlides[htSelectSlides(SelectSlideCategory)].Selection;
Data.ScreenConfig.GameMode = (EPartyGameMode)SelectSlides[htSelectSlides(SelectSlideGameMode)].Selection;
Data.ScreenConfig.SongSource = (ESongSource)SelectSlides[SelectSlideSongSource].Selection;
Data.ScreenConfig.PlaylistID = SelectSlides[SelectSlidePlaylist].Selection;
Data.ScreenConfig.CategoryID = SelectSlides[SelectSlideCategory].Selection;
Data.ScreenConfig.GameMode = (EPartyGameMode)SelectSlides[SelectSlideGameMode].Selection;
EGameMode gm = EGameMode.TR_GAMEMODE_NORMAL;
@@ -263,6 +236,7 @@ namespace Vocaluxe.PartyModes
if (Data.ScreenConfig.SongSource == ESongSource.TR_PLAYLIST)
{
if (CBase.Playlist.GetNumPlaylists() > 0)
{
if (CBase.Playlist.GetPlaylistSongCount(Data.ScreenConfig.PlaylistID) > 0)
{
ConfigOk = false;
@@ -270,23 +244,27 @@ namespace Vocaluxe.PartyModes
{
int id = CBase.Playlist.GetPlaylistSong(Data.ScreenConfig.PlaylistID, i).SongID;
foreach (EGameMode mode in CBase.Songs.GetSongByID(id).AvailableGameModes)
{
if (mode == gm)
{
ConfigOk = true;
break;
}
}
if (ConfigOk)
break;
}
}
else
ConfigOk = false;
}
else
ConfigOk = false;
}
if (Data.ScreenConfig.SongSource == ESongSource.TR_CATEGORY)
{
if (CBase.Songs.GetNumCategories() > 0)
{
if (CBase.Songs.NumSongsInCategory(Data.ScreenConfig.CategoryID) > 0)
{
CBase.Songs.SetCategory(Data.ScreenConfig.CategoryID);
@@ -294,11 +272,13 @@ namespace Vocaluxe.PartyModes
for (int i = 0; i < CBase.Songs.NumSongsInCategory(Data.ScreenConfig.CategoryID); i++)
{
foreach (EGameMode mode in CBase.Songs.GetVisibleSong(i).AvailableGameModes)
{
if (mode == gm)
{
ConfigOk = true;
break;
}
}
if (ConfigOk)
break;
}
@@ -306,6 +286,7 @@ namespace Vocaluxe.PartyModes
}
else
ConfigOk = false;
}
else
ConfigOk = false;
}
@@ -316,11 +297,13 @@ namespace Vocaluxe.PartyModes
for (int i = 0; i < CBase.Songs.GetNumSongs(); i++)
{
foreach (EGameMode mode in CBase.Songs.GetSongByID(i).AvailableGameModes)
{
if (mode == gm)
{
ConfigOk = true;
break;
}
}
if (ConfigOk)
break;
}
@@ -328,9 +311,9 @@ namespace Vocaluxe.PartyModes
else
ConfigOk = false;
}
SelectSlides[htSelectSlides(SelectSlideCategory)].Visible = Data.ScreenConfig.SongSource == ESongSource.TR_CATEGORY;
SelectSlides[htSelectSlides(SelectSlidePlaylist)].Visible = Data.ScreenConfig.SongSource == ESongSource.TR_PLAYLIST;
}
SelectSlides[SelectSlideCategory].Visible = Data.ScreenConfig.SongSource == ESongSource.TR_CATEGORY;
SelectSlides[SelectSlidePlaylist].Visible = Data.ScreenConfig.SongSource == ESongSource.TR_PLAYLIST;
}
private void Back()
{
@@ -339,7 +322,7 @@ namespace Vocaluxe.PartyModes
private void Next()
{
_PartyMode.DataFromScreen(_ThemeName, Data);
_PartyMode.DataFromScreen(ThemeName, Data);
}
}
}
}
@@ -1,11 +1,10 @@
using System;
using System.Collections.Generic;
using System.Text;
using System.Windows.Forms;
using VocaluxeLib.Menu;
using VocaluxeLib.Menu.SongMenu;
using Vocaluxe.Menu;
namespace Vocaluxe.PartyModes
namespace VocaluxeLib.PartyModes.TicTacToe
{
public class Field
{
@@ -24,34 +23,36 @@ namespace Vocaluxe.PartyModes
public class PartyScreenTicTacToeMain : CMenuParty
{
// Version number for theme files. Increment it, if you've changed something on the theme files!
const int ScreenVersion = 1;
protected override int _ScreenVersion
{
get { return 1; }
}
const string TextPopupReallyExit = "TextPopupReallyExit";
const string TextTeamChoosing = "TextTeamChoosing";
const string TextFinishMessage = "TextFinishMessage";
const string TextNextPlayerT1 = "TextNextPlayerT1";
const string TextNextPlayerT2 = "TextNextPlayerT2";
const string TextNextPlayerNameT1 = "TextNextPlayerNameT1";
const string TextNextPlayerNameT2 = "TextNextPlayerNameT2";
private const string TextPopupReallyExit = "TextPopupReallyExit";
private const string TextTeamChoosing = "TextTeamChoosing";
private const string TextFinishMessage = "TextFinishMessage";
private const string TextNextPlayerT1 = "TextNextPlayerT1";
private const string TextNextPlayerT2 = "TextNextPlayerT2";
private const string TextNextPlayerNameT1 = "TextNextPlayerNameT1";
private const string TextNextPlayerNameT2 = "TextNextPlayerNameT2";
const string ButtonNextRound = "ButtonNextRound";
const string ButtonBack = "ButtonBack";
const string ButtonExit = "ButtonExit";
const string ButtonPopupYes = "ButtonPopupYes";
const string ButtonPopupNo = "ButtonPopupNo";
const string ButtonField = "ButtonField";
private const string ButtonNextRound = "ButtonNextRound";
private const string ButtonBack = "ButtonBack";
private const string ButtonExit = "ButtonExit";
private const string ButtonPopupYes = "ButtonPopupYes";
private const string ButtonPopupNo = "ButtonPopupNo";
private const string ButtonField = "ButtonField";
const string ButtonJokerRandomT1 = "ButtonJokerRandomT1";
const string ButtonJokerRandomT2 = "ButtonJokerRandomT2";
const string ButtonJokerRetryT1 = "ButtonJokerRetryT1";
const string ButtonJokerRetryT2 = "ButtonJokerRetryT2";
private const string ButtonJokerRandomT1 = "ButtonJokerRandomT1";
private const string ButtonJokerRandomT2 = "ButtonJokerRandomT2";
private const string ButtonJokerRetryT1 = "ButtonJokerRetryT1";
private const string ButtonJokerRetryT2 = "ButtonJokerRetryT2";
private const string StaticPopupBG = "StaticPopupBG";
private const string StaticAvatarT1 = "StaticAvatarT1";
private const string StaticAvatarT2 = "StaticAvatarT2";
const string StaticPopupBG = "StaticPopupBG";
const string StaticAvatarT1 = "StaticAvatarT1";
const string StaticAvatarT2 = "StaticAvatarT2";
private bool ExitPopupVisible = false;
private bool ExitPopupVisible;
private DataFromScreen Data;
private DataToScreenMain GameData;
@@ -69,19 +70,17 @@ namespace Vocaluxe.PartyModes
private int[,] Possibilities;
private EStatus Status;
public PartyScreenTicTacToeMain()
{
}
protected override void Init()
public override void Init()
{
base.Init();
_ThemeName = "PartyScreenTicTacToeMain";
_ThemeTexts = new string[] { TextPopupReallyExit, TextTeamChoosing, TextFinishMessage, TextNextPlayerT1, TextNextPlayerT2, TextNextPlayerNameT1, TextNextPlayerNameT2 };
_ThemeButtons = new string[] { ButtonNextRound, ButtonBack, ButtonExit, ButtonPopupYes, ButtonPopupNo, ButtonField, ButtonJokerRandomT1, ButtonJokerRandomT2, ButtonJokerRetryT1, ButtonJokerRetryT2 };
_ThemeStatics = new string[] { StaticPopupBG, StaticAvatarT1, StaticAvatarT2 };
_ScreenVersion = ScreenVersion;
_ThemeTexts = new string[] {TextPopupReallyExit, TextTeamChoosing, TextFinishMessage, TextNextPlayerT1, TextNextPlayerT2, TextNextPlayerNameT1, TextNextPlayerNameT2};
_ThemeButtons = new string[]
{
ButtonNextRound, ButtonBack, ButtonExit, ButtonPopupYes, ButtonPopupNo, ButtonField, ButtonJokerRandomT1, ButtonJokerRandomT2, ButtonJokerRetryT1,
ButtonJokerRetryT2
};
_ThemeStatics = new string[] {StaticPopupBG, StaticAvatarT1, StaticAvatarT2};
Data = new DataFromScreen();
FromScreenMain config = new FromScreenMain();
@@ -100,10 +99,10 @@ namespace Vocaluxe.PartyModes
public override void LoadTheme(string XmlPath)
{
base.LoadTheme(XmlPath);
base.LoadTheme(XmlPath);
CreateFields();
Buttons[htButtons(ButtonField)].Visible = false;
Buttons[ButtonField].Visible = false;
}
public override void DataToScreen(object ReceivedData)
@@ -117,32 +116,30 @@ namespace Vocaluxe.PartyModes
}
catch (Exception e)
{
CBase.Log.LogError("Error in party mode screen TicTacToe main. Can't cast received data from game mode " + _ThemeName + ". " + e.Message); ;
CBase.Log.LogError("Error in party mode screen TicTacToe main. Can't cast received data from game mode " + ThemeName + ". " + e.Message);
}
}
public override bool HandleInput(KeyEvent KeyEvent)
public override bool HandleInput(KeyEvent keyEvent)
{
base.HandleInput(KeyEvent);
base.HandleInput(keyEvent);
if (KeyEvent.KeyPressed)
{
}
if (keyEvent.KeyPressed) {}
else
{
switch (KeyEvent.Key)
switch (keyEvent.Key)
{
case Keys.Back:
case Keys.Escape:
if (!ExitPopupVisible)
{
if (GameData.CurrentRoundNr == 1 && Status != EStatus.FieldSelected)
Back();
else if(Status == EStatus.None)
else if (Status == EStatus.None)
EndParty();
else
ShowPopup(true);
}
else
ShowPopup(false);
break;
@@ -150,11 +147,11 @@ namespace Vocaluxe.PartyModes
case Keys.Enter:
if (!ExitPopupVisible)
{
if (Buttons[htButtons(ButtonNextRound)].Selected)
if (Buttons[ButtonNextRound].Selected)
NextRound();
if (Buttons[htButtons(ButtonBack)].Selected && GameData.CurrentRoundNr == 1 && Status != EStatus.FieldSelected)
if (Buttons[ButtonBack].Selected && GameData.CurrentRoundNr == 1 && Status != EStatus.FieldSelected)
Back();
if (Buttons[htButtons(ButtonExit)].Selected && (GameData.CurrentRoundNr > 1 || Status == EStatus.FieldSelected) && Status != EStatus.None)
if (Buttons[ButtonExit].Selected && (GameData.CurrentRoundNr > 1 || Status == EStatus.FieldSelected) && Status != EStatus.None)
ShowPopup(true);
else if (Status == EStatus.None)
EndParty();
@@ -181,21 +178,21 @@ namespace Vocaluxe.PartyModes
}
if (Status == EStatus.FieldSelected)
{
if (Buttons[htButtons(ButtonJokerRandomT1)].Selected)
if (Buttons[ButtonJokerRandomT1].Selected)
UseJoker(0, 0);
if (Buttons[htButtons(ButtonJokerRandomT2)].Selected)
if (Buttons[ButtonJokerRandomT2].Selected)
UseJoker(1, 0);
if (Buttons[htButtons(ButtonJokerRetryT1)].Selected)
if (Buttons[ButtonJokerRetryT1].Selected)
UseJoker(0, 1);
if (Buttons[htButtons(ButtonJokerRetryT2)].Selected)
if (Buttons[ButtonJokerRetryT2].Selected)
UseJoker(1, 1);
}
}
else
{
if (Buttons[htButtons(ButtonPopupYes)].Selected)
if (Buttons[ButtonPopupYes].Selected)
EndParty();
if (Buttons[htButtons(ButtonPopupNo)].Selected)
if (Buttons[ButtonPopupNo].Selected)
ShowPopup(false);
}
break;
@@ -204,23 +201,25 @@ namespace Vocaluxe.PartyModes
return true;
}
public override bool HandleMouse(MouseEvent MouseEvent)
public override bool HandleMouse(MouseEvent mouseEvent)
{
base.HandleMouse(MouseEvent);
base.HandleMouse(mouseEvent);
if (MouseEvent.LB && IsMouseOver(MouseEvent))
if (mouseEvent.LB && IsMouseOver(mouseEvent))
{
if (!ExitPopupVisible)
{
if (Buttons[htButtons(ButtonNextRound)].Selected)
if (Buttons[ButtonNextRound].Selected)
NextRound();
if (Buttons[htButtons(ButtonBack)].Selected)
if (Buttons[ButtonBack].Selected)
Back();
if (Buttons[htButtons(ButtonExit)].Selected)
if (Buttons[ButtonExit].Selected)
{
if (Status == EStatus.None)
EndParty();
else
ShowPopup(true);
}
for (int i = 0; i < GameData.NumFields; i++)
{
switch (Status)
@@ -242,44 +241,43 @@ namespace Vocaluxe.PartyModes
break;
}
}
if(Status == EStatus.FieldSelected)
if (Status == EStatus.FieldSelected)
{
if (Buttons[htButtons(ButtonJokerRandomT1)].Selected)
if (Buttons[ButtonJokerRandomT1].Selected)
UseJoker(0, 0);
if (Buttons[htButtons(ButtonJokerRandomT2)].Selected)
if (Buttons[ButtonJokerRandomT2].Selected)
UseJoker(1, 0);
if (Buttons[htButtons(ButtonJokerRetryT1)].Selected)
if (Buttons[ButtonJokerRetryT1].Selected)
UseJoker(0, 1);
if (Buttons[htButtons(ButtonJokerRetryT2)].Selected)
if (Buttons[ButtonJokerRetryT2].Selected)
UseJoker(1, 1);
}
}
else
{
if (Buttons[htButtons(ButtonPopupYes)].Selected)
if (Buttons[ButtonPopupYes].Selected)
EndParty();
if (Buttons[htButtons(ButtonPopupNo)].Selected)
if (Buttons[ButtonPopupNo].Selected)
ShowPopup(false);
}
}
if (MouseEvent.RB)
if (mouseEvent.RB)
{
if (!ExitPopupVisible)
{
if (GameData.CurrentRoundNr == 1 && Status != EStatus.FieldSelected)
Back();
else if(Status == EStatus.None)
else if (Status == EStatus.None)
EndParty();
else
ShowPopup(true);
}
else
ShowPopup(false);
}
if (MouseEvent.Wheel != 0)
{
}
if (mouseEvent.Wheel != 0) {}
return true;
}
@@ -292,17 +290,17 @@ namespace Vocaluxe.PartyModes
if (GameData.CurrentRoundNr == 1)
{
BuildWinnerPossibilities();
BuildWinnerPossibilities();
SelectedField = -1;
Buttons[htButtons(ButtonBack)].Visible = true;
Buttons[htButtons(ButtonExit)].Visible = false;
SetInteractionToButton(Buttons[htButtons(ButtonBack)]);
Buttons[ButtonBack].Visible = true;
Buttons[ButtonExit].Visible = false;
SetInteractionToButton(Buttons[ButtonBack]);
}
else
{
Buttons[htButtons(ButtonBack)].Visible = false;
Buttons[htButtons(ButtonExit)].Visible = true;
SetInteractionToButton(Buttons[htButtons(ButtonExit)]);
Buttons[ButtonBack].Visible = false;
Buttons[ButtonExit].Visible = true;
SetInteractionToButton(Buttons[ButtonExit]);
}
Status = EStatus.FieldChoosing;
@@ -314,36 +312,37 @@ namespace Vocaluxe.PartyModes
if (GameData.CurrentRoundNr <= GameData.NumFields && Winner == 0)
{
UpdateTeamChoosingMessage();
Texts[htTexts(TextNextPlayerT1)].Visible = false;
Texts[htTexts(TextNextPlayerT2)].Visible = false;
Texts[htTexts(TextNextPlayerNameT1)].Visible = false;
Texts[htTexts(TextNextPlayerNameT2)].Visible = false;
Statics[htStatics(StaticAvatarT1)].Visible = false;
Statics[htStatics(StaticAvatarT2)].Visible = false;
Buttons[htButtons(ButtonJokerRandomT1)].Visible = false;
Buttons[htButtons(ButtonJokerRandomT2)].Visible = false;
Buttons[htButtons(ButtonJokerRetryT1)].Visible = false;
Buttons[htButtons(ButtonJokerRetryT2)].Visible = false;
Buttons[htButtons(ButtonNextRound)].Visible = false;
Texts[htTexts(TextFinishMessage)].Visible = false;
Texts[TextNextPlayerT1].Visible = false;
Texts[TextNextPlayerT2].Visible = false;
Texts[TextNextPlayerNameT1].Visible = false;
Texts[TextNextPlayerNameT2].Visible = false;
Statics[StaticAvatarT1].Visible = false;
Statics[StaticAvatarT2].Visible = false;
Buttons[ButtonJokerRandomT1].Visible = false;
Buttons[ButtonJokerRandomT2].Visible = false;
Buttons[ButtonJokerRetryT1].Visible = false;
Buttons[ButtonJokerRetryT2].Visible = false;
Buttons[ButtonNextRound].Visible = false;
Texts[TextFinishMessage].Visible = false;
}
else
{
Status = EStatus.None;
Buttons[htButtons(ButtonNextRound)].Visible = false;
Texts[htTexts(TextFinishMessage)].Visible = true;
Texts[htTexts(TextTeamChoosing)].Visible = false;
Buttons[ButtonNextRound].Visible = false;
Texts[TextFinishMessage].Visible = true;
Texts[TextTeamChoosing].Visible = false;
if (Winner > 0)
{
Texts[htTexts(TextFinishMessage)].Color = CBase.Theme.GetPlayerColor(Winner);
Texts[htTexts(TextFinishMessage)].Text = CBase.Language.Translate("TR_SCREENMAIN_WINNER", _PartyModeID) + " " + CBase.Language.Translate("TR_TEAM", _PartyModeID) + " " + Winner;
Texts[TextFinishMessage].Color = CBase.Theme.GetPlayerColor(Winner);
Texts[TextFinishMessage].Text = CBase.Language.Translate("TR_SCREENMAIN_WINNER", _PartyModeID) + " " + CBase.Language.Translate("TR_TEAM", _PartyModeID) + " " +
Winner;
}
else
{
Texts[htTexts(TextFinishMessage)].Color = new SColorF(1, 1, 1, 1);
Texts[htTexts(TextFinishMessage)].Text = CBase.Language.Translate("TR_SCREENMAIN_NOWINNER", _PartyModeID);
Texts[TextFinishMessage].Color = new SColorF(1, 1, 1, 1);
Texts[TextFinishMessage].Text = CBase.Language.Translate("TR_SCREENMAIN_NOWINNER", _PartyModeID);
}
SetInteractionToButton(Buttons[htButtons(ButtonExit)]);
SetInteractionToButton(Buttons[ButtonExit]);
}
ShowPopup(false);
@@ -372,7 +371,7 @@ namespace Vocaluxe.PartyModes
for (int i = 0; i < 25; i++)
{
Field f = new Field();
f.Button = GetNewButton(Buttons[htButtons(ButtonField)]);
f.Button = GetNewButton(Buttons[ButtonField]);
f.Button.Visible = false;
f.Content = new Round();
AddButton(f.Button);
@@ -382,7 +381,7 @@ namespace Vocaluxe.PartyModes
private void UpdateFields()
{
int NumOneRow = (int)Math.Sqrt((double)GameData.NumFields);
int NumOneRow = (int)Math.Sqrt(GameData.NumFields);
float FieldSizeY = (CBase.Settings.GetRenderH() - 150 - NumOneRow * FieldSpace) / NumOneRow;
float FieldSizeX = (CBase.Settings.GetRenderW() - 300 - NumOneRow * FieldSpace) / NumOneRow;
if (FieldSizeX < FieldSizeY)
@@ -406,7 +405,7 @@ namespace Vocaluxe.PartyModes
Fields[i].Button.Visible = true;
Fields[i].Button.Enabled = true;
column++;
if ((i+1) >= NumOneRow * (row+1))
if ((i + 1) >= NumOneRow * (row + 1))
{
column = 0;
row++;
@@ -429,9 +428,9 @@ namespace Vocaluxe.PartyModes
for (int i = 0; i < GameData.Rounds.Count; i++)
{
Fields[i].Button.Enabled = true;
Fields[i].Button.Texture = Buttons[htButtons(ButtonField)].Texture;
Fields[i].Button.Color = Buttons[htButtons(ButtonField)].Color;
Fields[i].Button.SColor = Buttons[htButtons(ButtonField)].SColor;
Fields[i].Button.Texture = Buttons[ButtonField].Texture;
Fields[i].Button.Color = Buttons[ButtonField].Color;
Fields[i].Button.SColor = Buttons[ButtonField].SColor;
Fields[i].Content = GameData.Rounds[i];
if (Fields[i].Content.Finished)
{
@@ -449,17 +448,13 @@ namespace Vocaluxe.PartyModes
}
if (Status == EStatus.JokerRetry && Fields[i].Content.Finished)
{
Fields[i].Button.SColor = CBase.Theme.GetPlayerColor(GameData.Team+1);
Fields[i].Button.SColor = CBase.Theme.GetPlayerColor(GameData.Team + 1);
Fields[i].Button.Enabled = true;
}
if (Status == EStatus.JokerRetry && !Fields[i].Content.Finished)
{
Fields[i].Button.Enabled = false;
}
if(Status == EStatus.FieldSelected)
{
if (Status == EStatus.FieldSelected)
Fields[i].Button.Enabled = false;
}
}
}
@@ -484,7 +479,7 @@ namespace Vocaluxe.PartyModes
SingerTeam2 = GameData.PlayerTeam2[0];
GameData.PlayerTeam2.RemoveAt(0);
}
Menu.SongMenu.CSong Song = CBase.Songs.GetSongByID(SongID);
CSong Song = CBase.Songs.GetSongByID(SongID);
CBase.BackgroundMusic.SetStatus(true);
@@ -500,31 +495,31 @@ namespace Vocaluxe.PartyModes
GameData.Rounds[SelectedField].SingerTeam2 = SingerTeam2;
UpdateFieldContents();
Texts[htTexts(TextNextPlayerT1)].Visible = true;
Texts[htTexts(TextNextPlayerT2)].Visible = true;
Texts[htTexts(TextNextPlayerNameT1)].Visible = true;
Texts[htTexts(TextNextPlayerNameT2)].Visible = true;
SProfile[] profiles = CBase.Profiles.GetProfiles();
Texts[htTexts(TextNextPlayerNameT1)].Text = profiles[GameData.ProfileIDsTeam1[GameData.Rounds[SelectedField].SingerTeam1]].PlayerName;
Texts[htTexts(TextNextPlayerNameT2)].Text = profiles[GameData.ProfileIDsTeam2[GameData.Rounds[SelectedField].SingerTeam2]].PlayerName;
Statics[htStatics(StaticAvatarT1)].Visible = true;
Statics[htStatics(StaticAvatarT2)].Visible = true;
Statics[htStatics(StaticAvatarT1)].Texture = profiles[GameData.ProfileIDsTeam1[GameData.Rounds[SelectedField].SingerTeam1]].Avatar.Texture;
Statics[htStatics(StaticAvatarT2)].Texture = profiles[GameData.ProfileIDsTeam2[GameData.Rounds[SelectedField].SingerTeam2]].Avatar.Texture;
Texts[TextNextPlayerT1].Visible = true;
Texts[TextNextPlayerT2].Visible = true;
Texts[TextNextPlayerNameT1].Visible = true;
Texts[TextNextPlayerNameT2].Visible = true;
SProfile[] profiles = CBase.Profiles.GetProfiles();
Texts[TextNextPlayerNameT1].Text = profiles[GameData.ProfileIDsTeam1[GameData.Rounds[SelectedField].SingerTeam1]].PlayerName;
Texts[TextNextPlayerNameT2].Text = profiles[GameData.ProfileIDsTeam2[GameData.Rounds[SelectedField].SingerTeam2]].PlayerName;
Statics[StaticAvatarT1].Visible = true;
Statics[StaticAvatarT2].Visible = true;
Statics[StaticAvatarT1].Texture = profiles[GameData.ProfileIDsTeam1[GameData.Rounds[SelectedField].SingerTeam1]].Avatar.Texture;
Statics[StaticAvatarT2].Texture = profiles[GameData.ProfileIDsTeam2[GameData.Rounds[SelectedField].SingerTeam2]].Avatar.Texture;
UpdateJokerButtons();
Buttons[htButtons(ButtonNextRound)].Visible = true;
Buttons[htButtons(ButtonExit)].Visible = true;
Buttons[htButtons(ButtonBack)].Visible = false;
Buttons[ButtonNextRound].Visible = true;
Buttons[ButtonExit].Visible = true;
Buttons[ButtonBack].Visible = false;
SetInteractionToButton(Buttons[htButtons(ButtonNextRound)]);
SetInteractionToButton(Buttons[ButtonNextRound]);
}
private void FieldSelectedAgain()
{
int SongID = Fields[SelectedField].Content.SongID;
Menu.SongMenu.CSong Song = CBase.Songs.GetSongByID(SongID);
CSong Song = CBase.Songs.GetSongByID(SongID);
CBase.BackgroundMusic.SetStatus(true);
PreviewStream = CBase.Sound.Load(Song.GetMP3(), false);
@@ -539,32 +534,32 @@ namespace Vocaluxe.PartyModes
GameData.Rounds[SelectedField].SingerTeam2 = GameData.Rounds[OldSelectedField].SingerTeam2;
UpdateFieldContents();
Texts[htTexts(TextNextPlayerT1)].Visible = true;
Texts[htTexts(TextNextPlayerT2)].Visible = true;
Texts[htTexts(TextNextPlayerNameT1)].Visible = true;
Texts[htTexts(TextNextPlayerNameT2)].Visible = true;
Texts[TextNextPlayerT1].Visible = true;
Texts[TextNextPlayerT2].Visible = true;
Texts[TextNextPlayerNameT1].Visible = true;
Texts[TextNextPlayerNameT2].Visible = true;
SProfile[] profiles = CBase.Profiles.GetProfiles();
Texts[htTexts(TextNextPlayerNameT1)].Text = profiles[GameData.ProfileIDsTeam1[GameData.Rounds[SelectedField].SingerTeam1]].PlayerName;
Texts[htTexts(TextNextPlayerNameT2)].Text = profiles[GameData.ProfileIDsTeam2[GameData.Rounds[SelectedField].SingerTeam2]].PlayerName;
Statics[htStatics(StaticAvatarT1)].Visible = true;
Statics[htStatics(StaticAvatarT2)].Visible = true;
Statics[htStatics(StaticAvatarT1)].Texture = profiles[GameData.ProfileIDsTeam1[GameData.Rounds[SelectedField].SingerTeam1]].Avatar.Texture;
Statics[htStatics(StaticAvatarT2)].Texture = profiles[GameData.ProfileIDsTeam2[GameData.Rounds[SelectedField].SingerTeam2]].Avatar.Texture;
Texts[TextNextPlayerNameT1].Text = profiles[GameData.ProfileIDsTeam1[GameData.Rounds[SelectedField].SingerTeam1]].PlayerName;
Texts[TextNextPlayerNameT2].Text = profiles[GameData.ProfileIDsTeam2[GameData.Rounds[SelectedField].SingerTeam2]].PlayerName;
Statics[StaticAvatarT1].Visible = true;
Statics[StaticAvatarT2].Visible = true;
Statics[StaticAvatarT1].Texture = profiles[GameData.ProfileIDsTeam1[GameData.Rounds[SelectedField].SingerTeam1]].Avatar.Texture;
Statics[StaticAvatarT2].Texture = profiles[GameData.ProfileIDsTeam2[GameData.Rounds[SelectedField].SingerTeam2]].Avatar.Texture;
UpdateJokerButtons();
Buttons[htButtons(ButtonNextRound)].Visible = true;
Buttons[htButtons(ButtonExit)].Visible = true;
Buttons[htButtons(ButtonBack)].Visible = false;
Buttons[ButtonNextRound].Visible = true;
Buttons[ButtonExit].Visible = true;
Buttons[ButtonBack].Visible = false;
SetInteractionToButton(Buttons[htButtons(ButtonNextRound)]);
SetInteractionToButton(Buttons[ButtonNextRound]);
}
private void UseJoker(int TeamNr, int JokerNum)
{
switch (JokerNum)
{
//Random-Joker
//Random-Joker
case 0:
if (GameData.NumJokerRandom[TeamNr] > 0)
{
@@ -575,7 +570,7 @@ namespace Vocaluxe.PartyModes
}
break;
//Retry-Joker
//Retry-Joker
case 1:
if (GameData.NumJokerRetry[TeamNr] > 0 && GameData.CurrentRoundNr > 1)
{
@@ -595,28 +590,29 @@ namespace Vocaluxe.PartyModes
private void UpdateTeamChoosingMessage()
{
Texts[htTexts(TextTeamChoosing)].Color = CBase.Theme.GetPlayerColor(GameData.Team + 1);
Texts[htTexts(TextTeamChoosing)].Text = CBase.Language.Translate("TR_TEAM", _PartyModeID) + " " + (GameData.Team + 1) + "! " + CBase.Language.Translate("TR_SCREENMAIN_TEAM_CHOOSE", _PartyModeID);
Texts[TextTeamChoosing].Color = CBase.Theme.GetPlayerColor(GameData.Team + 1);
Texts[TextTeamChoosing].Text = CBase.Language.Translate("TR_TEAM", _PartyModeID) + " " + (GameData.Team + 1) + "! " +
CBase.Language.Translate("TR_SCREENMAIN_TEAM_CHOOSE", _PartyModeID);
if (Status == EStatus.JokerRetry || Status == EStatus.FieldChoosing)
Texts[htTexts(TextTeamChoosing)].Visible = true;
Texts[TextTeamChoosing].Visible = true;
else
Texts[htTexts(TextTeamChoosing)].Visible = false;
Texts[TextTeamChoosing].Visible = false;
}
private void UpdateJokerButtons()
{
Buttons[htButtons(ButtonJokerRandomT1)].Visible = true;
Buttons[htButtons(ButtonJokerRandomT2)].Visible = true;
Buttons[htButtons(ButtonJokerRandomT1)].Text.Text = GameData.NumJokerRandom[0].ToString();
Buttons[htButtons(ButtonJokerRandomT2)].Text.Text = GameData.NumJokerRandom[1].ToString();
Buttons[htButtons(ButtonJokerRandomT1)].Enabled = GameData.NumJokerRandom[0] > 0;
Buttons[htButtons(ButtonJokerRandomT2)].Enabled = GameData.NumJokerRandom[1] > 0;
Buttons[htButtons(ButtonJokerRetryT1)].Visible = true;
Buttons[htButtons(ButtonJokerRetryT2)].Visible = true;
Buttons[htButtons(ButtonJokerRetryT1)].Text.Text = GameData.NumJokerRetry[0].ToString();
Buttons[htButtons(ButtonJokerRetryT2)].Text.Text = GameData.NumJokerRetry[1].ToString();
Buttons[htButtons(ButtonJokerRetryT1)].Enabled = GameData.NumJokerRetry[0] > 0;
Buttons[htButtons(ButtonJokerRetryT2)].Enabled = GameData.NumJokerRetry[1] > 0;
Buttons[ButtonJokerRandomT1].Visible = true;
Buttons[ButtonJokerRandomT2].Visible = true;
Buttons[ButtonJokerRandomT1].Text.Text = GameData.NumJokerRandom[0].ToString();
Buttons[ButtonJokerRandomT2].Text.Text = GameData.NumJokerRandom[1].ToString();
Buttons[ButtonJokerRandomT1].Enabled = GameData.NumJokerRandom[0] > 0;
Buttons[ButtonJokerRandomT2].Enabled = GameData.NumJokerRandom[1] > 0;
Buttons[ButtonJokerRetryT1].Visible = true;
Buttons[ButtonJokerRetryT2].Visible = true;
Buttons[ButtonJokerRetryT1].Text.Text = GameData.NumJokerRetry[0].ToString();
Buttons[ButtonJokerRetryT2].Text.Text = GameData.NumJokerRetry[1].ToString();
Buttons[ButtonJokerRetryT1].Enabled = GameData.NumJokerRetry[0] > 0;
Buttons[ButtonJokerRetryT2].Enabled = GameData.NumJokerRetry[1] > 0;
}
private void NextRound()
@@ -629,7 +625,7 @@ namespace Vocaluxe.PartyModes
Data.ScreenMain.SingRoundNr = SelectedField;
Data.ScreenMain.PlayerTeam1 = GameData.PlayerTeam1;
Data.ScreenMain.PlayerTeam2 = GameData.PlayerTeam2;
_PartyMode.DataFromScreen(_ThemeName, Data);
_PartyMode.DataFromScreen(ThemeName, Data);
}
private void EndParty()
@@ -642,13 +638,13 @@ namespace Vocaluxe.PartyModes
{
ExitPopupVisible = Visible;
Statics[htStatics(StaticPopupBG)].Visible = ExitPopupVisible;
Texts[htTexts(TextPopupReallyExit)].Visible = ExitPopupVisible;
Buttons[htButtons(ButtonPopupYes)].Visible = ExitPopupVisible;
Buttons[htButtons(ButtonPopupNo)].Visible = ExitPopupVisible;
Statics[StaticPopupBG].Visible = ExitPopupVisible;
Texts[TextPopupReallyExit].Visible = ExitPopupVisible;
Buttons[ButtonPopupYes].Visible = ExitPopupVisible;
Buttons[ButtonPopupNo].Visible = ExitPopupVisible;
if (ExitPopupVisible)
SetInteractionToButton(Buttons[htButtons(ButtonPopupNo)]);
SetInteractionToButton(Buttons[ButtonPopupNo]);
}
private void Back()
@@ -657,41 +653,34 @@ namespace Vocaluxe.PartyModes
Data.ScreenMain.FadeToNameSelection = true;
Data.ScreenMain.FadeToSinging = false;
Data.ScreenMain.SingRoundNr = SelectedField;
_PartyMode.DataFromScreen(_ThemeName, Data);
_PartyMode.DataFromScreen(ThemeName, Data);
}
private int BuildWinnerPossibilities()
{
int NumOneRow = (int)Math.Sqrt((double)GameData.NumFields);
Possibilities = new int[(NumOneRow * 2) + 2, NumOneRow];
int NumOneRow = (int)Math.Sqrt(GameData.NumFields);
Possibilities = new int[(NumOneRow * 2) + 2,NumOneRow];
for (int i = 0; i < Possibilities.GetLength(0); i++)
{
if (i < NumOneRow)
{
for(int c = 0; c < NumOneRow; c++){
for (int c = 0; c < NumOneRow; c++)
Possibilities[i, c] = i * NumOneRow + c;
}
}
else if (i < NumOneRow * 2)
{
for (int c = 0; c < NumOneRow; c++)
{
Possibilities[i, c] = (i-NumOneRow) + (c*NumOneRow);
}
Possibilities[i, c] = (i - NumOneRow) + (c * NumOneRow);
}
else if( i == Possibilities.GetLength(0) - 2)
else if (i == Possibilities.GetLength(0) - 2)
{
for (int c = 0; c < NumOneRow;c++)
{
for (int c = 0; c < NumOneRow; c++)
Possibilities[i, c] = (NumOneRow + 1) * c;
}
}
else if (i == Possibilities.GetLength(0) - 1)
{
for (int c = 0; c < NumOneRow; c++)
{
Possibilities[i, c] = (NumOneRow - 1) * c + (NumOneRow - 1);
}
}
}
return 0;
@@ -719,4 +708,4 @@ namespace Vocaluxe.PartyModes
return 0;
}
}
}
}
@@ -1,23 +1,24 @@
using System;
using System.Collections.Generic;
using System.Text;
using System.Windows.Forms;
using VocaluxeLib.Menu;
using Vocaluxe.Menu;
namespace Vocaluxe.PartyModes
namespace VocaluxeLib.PartyModes.TicTacToe
{
public class PartyScreenTicTacToeNames : CMenuParty
{
// Version number for theme files. Increment it, if you've changed something on the theme files!
const int ScreenVersion = 1;
protected override int _ScreenVersion
{
get { return 1; }
}
const string ButtonNext = "ButtonNext";
const string ButtonBack = "ButtonBack";
const string ButtonPlayerDestination = "ButtonPlayerDestination";
const string ButtonPlayerChoose = "ButtonPlayerChoose";
const string ButtonPlayerChooseScrollUp = "ButtonPlayerChooseScrollUp";
const string ButtonPlayerChooseScrollDown = "ButtonPlayerChooseScrollDown";
private const string ButtonNext = "ButtonNext";
private const string ButtonBack = "ButtonBack";
private const string ButtonPlayerDestination = "ButtonPlayerDestination";
private const string ButtonPlayerChoose = "ButtonPlayerChoose";
private const string ButtonPlayerChooseScrollUp = "ButtonPlayerChooseScrollUp";
private const string ButtonPlayerChooseScrollDown = "ButtonPlayerChooseScrollDown";
private List<CPlayerChooseButton> PlayerChooseButtons;
private List<CButton> PlayerDestinationButtons;
@@ -36,18 +37,18 @@ namespace Vocaluxe.PartyModes
private const int PlayerChooseButtonsFirstY = 105;
private const int PlayerChooseButtonsSpaceH = 15;
private const int PlayerChooseButtonsSpaceW = 25;
private int PlayerChooseButtonsOffset = 0;
private int PlayerChooseButtonsOffset;
private CStatic chooseAvatarStatic;
private bool SelectingMouseActive = false;
private int OldMouseX = 0;
private int OldMouseY = 0;
private bool SelectingMouseActive;
private int OldMouseX;
private int OldMouseY;
private int SelectedPlayerNr = -1;
private bool ButtonsAdded = false;
private bool ButtonsAdded;
private int NumPlayerTeam1 = 2;
private int NumPlayerTeam2 = 2;
private DataFromScreen Data;
private class CPlayerChooseButton
@@ -56,11 +57,7 @@ namespace Vocaluxe.PartyModes
public int ProfileID;
}
public PartyScreenTicTacToeNames()
{
}
protected override void Init()
public override void Init()
{
base.Init();
@@ -72,10 +69,8 @@ namespace Vocaluxe.PartyModes
Data.ScreenNames.ProfileIDsTeam1 = new List<int>();
Data.ScreenNames.ProfileIDsTeam2 = new List<int>();
_ThemeName = "PartyScreenTicTacToeNames";
List<string> buttons = new List<string>();
_ThemeButtons = new string[] { ButtonBack, ButtonNext, ButtonPlayerDestination, ButtonPlayerChoose, ButtonPlayerChooseScrollUp, ButtonPlayerChooseScrollDown };
_ScreenVersion = ScreenVersion;
_ThemeButtons = new string[] {ButtonBack, ButtonNext, ButtonPlayerDestination, ButtonPlayerChoose, ButtonPlayerChooseScrollUp, ButtonPlayerChooseScrollDown};
Data = new DataFromScreen();
FromScreenNames names = new FromScreenNames();
@@ -86,11 +81,6 @@ namespace Vocaluxe.PartyModes
Data.ScreenNames = names;
}
public override void LoadTheme(string XmlPath)
{
base.LoadTheme(XmlPath);
}
public override void DataToScreen(object ReceivedData)
{
DataToScreenNames config = new DataToScreenNames();
@@ -109,75 +99,65 @@ namespace Vocaluxe.PartyModes
NumPlayerTeam2 = config.NumPlayerTeam2;
while (Data.ScreenNames.ProfileIDsTeam1.Count > NumPlayerTeam1)
{
Data.ScreenNames.ProfileIDsTeam1.RemoveAt(Data.ScreenNames.ProfileIDsTeam1.Count - 1);
}
while (Data.ScreenNames.ProfileIDsTeam2.Count > NumPlayerTeam2)
{
Data.ScreenNames.ProfileIDsTeam2.RemoveAt(Data.ScreenNames.ProfileIDsTeam2.Count - 1);
}
}
catch (Exception e)
{
CBase.Log.LogError("Error in party mode screen TicTacToe names. Can't cast received data from game mode " + _ThemeName + ". " + e.Message); ;
CBase.Log.LogError("Error in party mode screen TicTacToe names. Can't cast received data from game mode " + ThemeName + ". " + e.Message);
}
}
public override bool HandleInput(KeyEvent KeyEvent)
public override bool HandleInput(KeyEvent keyEvent)
{
base.HandleInput(KeyEvent);
base.HandleInput(keyEvent);
if (KeyEvent.KeyPressed)
if (keyEvent.KeyPressed) {}
else
{
switch (keyEvent.Key)
{
case Keys.Back:
case Keys.Escape:
Back();
break;
}
else
{
switch (KeyEvent.Key)
{
case Keys.Back:
case Keys.Escape:
case Keys.Enter:
if (Buttons[ButtonBack].Selected)
Back();
break;
case Keys.Enter:
if (Buttons[htButtons(ButtonBack)].Selected)
Back();
if (Buttons[ButtonNext].Selected)
Next();
if (Buttons[htButtons(ButtonNext)].Selected)
Next();
if (Buttons[ButtonPlayerChooseScrollUp].Selected)
Scroll(-1);
if (Buttons[htButtons(ButtonPlayerChooseScrollUp)].Selected)
Scroll(-1);
if (Buttons[ButtonPlayerChooseScrollDown].Selected)
Scroll(1);
if (Buttons[htButtons(ButtonPlayerChooseScrollDown)].Selected)
Scroll(1);
if (!OnAdd())
OnRemove();
break;
case Keys.Delete:
if (!OnAdd())
OnRemove();
break;
}
break;
case Keys.Delete:
OnRemove();
break;
}
}
return true;
}
public override bool HandleMouse(MouseEvent MouseEvent)
public override bool HandleMouse(MouseEvent mouseEvent)
{
base.HandleMouse(MouseEvent);
base.HandleMouse(mouseEvent);
//Check if LeftButton is hold and Select-Mode inactive
if (MouseEvent.LBH && !SelectingMouseActive)
if (mouseEvent.LBH && !SelectingMouseActive)
{
//Save mouse-coords
OldMouseX = MouseEvent.X;
OldMouseY = MouseEvent.Y;
OldMouseX = mouseEvent.X;
OldMouseY = mouseEvent.Y;
//Check if mouse if over tile
for (int i = 0; i < PlayerChooseButtons.Count; i++)
{
@@ -199,19 +179,19 @@ namespace Vocaluxe.PartyModes
}
return true;
}
//Check if LeftButton is hold and Select-Mode active
if (MouseEvent.LBH && SelectingMouseActive)
if (mouseEvent.LBH && SelectingMouseActive)
{
//Update coords for Drag/Drop-Texture
chooseAvatarStatic.Rect.X += (MouseEvent.X - OldMouseX);
chooseAvatarStatic.Rect.Y += (MouseEvent.Y - OldMouseY);
OldMouseX = MouseEvent.X;
OldMouseY = MouseEvent.Y;
chooseAvatarStatic.Rect.X += mouseEvent.X - OldMouseX;
chooseAvatarStatic.Rect.Y += mouseEvent.Y - OldMouseY;
OldMouseX = mouseEvent.X;
OldMouseY = mouseEvent.Y;
return true;
}
// LeftButton isn't hold anymore, but Selec-Mode is still active -> "Drop" of Avatar
// LeftButton isn't hold anymore, but Selec-Mode is still active -> "Drop" of Avatar
else if (SelectingMouseActive)
{
//Check if really a player was selected
@@ -221,10 +201,10 @@ namespace Vocaluxe.PartyModes
for (int i = 0; i < PlayerDestinationButtons.Count; i++)
{
//Check first, if area is "active"
if (PlayerDestinationButtons[i].Visible == true)
if (PlayerDestinationButtons[i].Visible)
{
//Check if Mouse is in area
if (CHelper.IsInBounds(PlayerDestinationButtons[i].Rect, MouseEvent))
if (CHelper.IsInBounds(PlayerDestinationButtons[i].Rect, mouseEvent))
{
int added = -1;
//Add Player-ID to list.
@@ -275,30 +255,30 @@ namespace Vocaluxe.PartyModes
return true;
}
if (MouseEvent.LB && IsMouseOver(MouseEvent))
if (mouseEvent.LB && IsMouseOver(mouseEvent))
{
if (Buttons[htButtons(ButtonBack)].Selected)
if (Buttons[ButtonBack].Selected)
Back();
if (Buttons[htButtons(ButtonNext)].Selected)
if (Buttons[ButtonNext].Selected)
Next();
if (Buttons[htButtons(ButtonPlayerChooseScrollUp)].Selected)
if (Buttons[ButtonPlayerChooseScrollUp].Selected)
Scroll(-1);
if (Buttons[htButtons(ButtonPlayerChooseScrollDown)].Selected)
if (Buttons[ButtonPlayerChooseScrollDown].Selected)
Scroll(1);
}
if(MouseEvent.LD && IsMouseOver(MouseEvent))
if (mouseEvent.LD && IsMouseOver(mouseEvent))
{
if (!OnAdd())
OnRemove();
if (MouseEvent.RB)
{
Back();
}
if (mouseEvent.RB)
Back();
return true;
}
@@ -332,11 +312,6 @@ namespace Vocaluxe.PartyModes
return true;
}
public override void OnClose()
{
base.OnClose();
}
private void Scroll(int Offset)
{
if (Offset < 0 && PlayerChooseButtonsOffset > 0)
@@ -344,23 +319,22 @@ namespace Vocaluxe.PartyModes
PlayerChooseButtonsOffset += Offset;
UpdateButtonPlayerChoose();
}
else if (PlayerChooseButtonsVisibleProfiles.Count < PlayerChooseButtons.Count + (PlayerChooseButtonsOffset + Offset) * PlayerChooseButtonsNumH)
else if (PlayerChooseButtonsVisibleProfiles.Count < PlayerChooseButtons.Count + (PlayerChooseButtonsOffset + Offset) * PlayerChooseButtonsNumH)
{
PlayerChooseButtonsOffset += Offset;
UpdateButtonPlayerChoose();
}
}
private void AddButtonPlayerDestination()
{
Buttons[htButtons(ButtonPlayerDestination)].Visible = false;
Buttons[ButtonPlayerDestination].Visible = false;
PlayerDestinationButtons = new List<CButton>();
int row = 0;
int column = 0;
for (int i = 1; i <= _PartyMode.GetMaxPlayer(); i++)
{
CButton b = GetNewButton(Buttons[htButtons(ButtonPlayerDestination)]);
CButton b = GetNewButton(Buttons[ButtonPlayerDestination]);
b.Rect.X = PlayerDestinationButtonsFirstX + column * (b.Rect.W + PlayerDestinationButtonsSpaceH);
b.Rect.Y = PlayerDestinationButtonsFirstY + row * (b.Rect.H + PlayerDestinationButtonsSpaceW);
PlayerDestinationButtons.Add(b);
@@ -378,13 +352,13 @@ namespace Vocaluxe.PartyModes
private void AddButtonPlayerChoose()
{
Buttons[htButtons(ButtonPlayerChoose)].Visible = false;
Buttons[ButtonPlayerChoose].Visible = false;
PlayerChooseButtons = new List<CPlayerChooseButton>();
int row = 0;
int column = 0;
for (int i = 1; i <= PlayerChooseButtonsNumH * PlayerChooseButtonsNumW; i++)
{
CButton b = GetNewButton(Buttons[htButtons(ButtonPlayerChoose)]);
CButton b = GetNewButton(Buttons[ButtonPlayerChoose]);
b.Rect.X = PlayerChooseButtonsFirstX + column * (b.Rect.W + PlayerChooseButtonsSpaceH);
b.Rect.Y = PlayerChooseButtonsFirstY + row * (b.Rect.H + PlayerChooseButtonsSpaceW);
CPlayerChooseButton pcb = new CPlayerChooseButton();
@@ -406,16 +380,14 @@ namespace Vocaluxe.PartyModes
private void UpdateButtonPlayerChoose()
{
UpdateVisibleProfiles();
if ((PlayerChooseButtonsNumW * PlayerChooseButtonsNumH) * (PlayerChooseButtonsOffset + 1) - PlayerChooseButtonsVisibleProfiles.Count >= (PlayerChooseButtonsNumW * PlayerChooseButtonsNumH) * PlayerChooseButtonsOffset)
{
if ((PlayerChooseButtonsNumW * PlayerChooseButtonsNumH) * (PlayerChooseButtonsOffset + 1) - PlayerChooseButtonsVisibleProfiles.Count >=
(PlayerChooseButtonsNumW * PlayerChooseButtonsNumH) * PlayerChooseButtonsOffset)
UpdateButtonPlayerChoose(PlayerChooseButtonsOffset - 1);
}
else
{
UpdateButtonPlayerChoose(PlayerChooseButtonsOffset);
}
Buttons[htButtons(ButtonPlayerChooseScrollUp)].Enabled = PlayerChooseButtonsOffset > 0;
Buttons[htButtons(ButtonPlayerChooseScrollDown)].Enabled = PlayerChooseButtonsVisibleProfiles.Count > PlayerChooseButtons.Count + PlayerChooseButtonsOffset * PlayerChooseButtonsNumH;
Buttons[ButtonPlayerChooseScrollUp].Enabled = PlayerChooseButtonsOffset > 0;
Buttons[ButtonPlayerChooseScrollDown].Enabled = PlayerChooseButtonsVisibleProfiles.Count >
PlayerChooseButtons.Count + PlayerChooseButtonsOffset * PlayerChooseButtonsNumH;
}
private void UpdateButtonPlayerChoose(int Offset)
@@ -442,10 +414,10 @@ namespace Vocaluxe.PartyModes
{
PlayerChooseButtons[i].ProfileID = -1;
PlayerChooseButtons[i].Button.Text.Text = String.Empty;
PlayerChooseButtons[i].Button.Texture = Buttons[htButtons(ButtonPlayerChoose)].Texture;
PlayerChooseButtons[i].Button.STexture = Buttons[htButtons(ButtonPlayerChoose)].STexture;
PlayerChooseButtons[i].Button.Color = Buttons[htButtons(ButtonPlayerChoose)].Color;
PlayerChooseButtons[i].Button.SColor = Buttons[htButtons(ButtonPlayerChoose)].SColor;
PlayerChooseButtons[i].Button.Texture = Buttons[ButtonPlayerChoose].Texture;
PlayerChooseButtons[i].Button.STexture = Buttons[ButtonPlayerChoose].STexture;
PlayerChooseButtons[i].Button.Color = Buttons[ButtonPlayerChoose].Color;
PlayerChooseButtons[i].Button.SColor = Buttons[ButtonPlayerChoose].SColor;
PlayerChooseButtons[i].Button.Enabled = false;
}
}
@@ -484,9 +456,7 @@ namespace Vocaluxe.PartyModes
}
}
if (visible)
{
PlayerChooseButtonsVisibleProfiles.Add(i);
}
}
}
@@ -534,10 +504,10 @@ namespace Vocaluxe.PartyModes
}
else
{
PlayerDestinationButtons[i].Color = Buttons[htButtons(ButtonPlayerDestination)].Color;
PlayerDestinationButtons[i].SColor = Buttons[htButtons(ButtonPlayerDestination)].SColor;
PlayerDestinationButtons[i].Texture = Buttons[htButtons(ButtonPlayerDestination)].Texture;
PlayerDestinationButtons[i].STexture = Buttons[htButtons(ButtonPlayerDestination)].STexture;
PlayerDestinationButtons[i].Color = Buttons[ButtonPlayerDestination].Color;
PlayerDestinationButtons[i].SColor = Buttons[ButtonPlayerDestination].SColor;
PlayerDestinationButtons[i].Texture = Buttons[ButtonPlayerDestination].Texture;
PlayerDestinationButtons[i].STexture = Buttons[ButtonPlayerDestination].STexture;
PlayerDestinationButtons[i].Text.Text = String.Empty;
PlayerDestinationButtons[i].Enabled = false;
}
@@ -558,10 +528,10 @@ namespace Vocaluxe.PartyModes
}
else
{
PlayerDestinationButtons[i + PlayerDestinationButtonsNumH].Color = Buttons[htButtons(ButtonPlayerDestination)].Color;
PlayerDestinationButtons[i + PlayerDestinationButtonsNumH].SColor = Buttons[htButtons(ButtonPlayerDestination)].SColor;
PlayerDestinationButtons[i + PlayerDestinationButtonsNumH].Texture = Buttons[htButtons(ButtonPlayerDestination)].Texture;
PlayerDestinationButtons[i + PlayerDestinationButtonsNumH].STexture = Buttons[htButtons(ButtonPlayerDestination)].STexture;
PlayerDestinationButtons[i + PlayerDestinationButtonsNumH].Color = Buttons[ButtonPlayerDestination].Color;
PlayerDestinationButtons[i + PlayerDestinationButtonsNumH].SColor = Buttons[ButtonPlayerDestination].SColor;
PlayerDestinationButtons[i + PlayerDestinationButtonsNumH].Texture = Buttons[ButtonPlayerDestination].Texture;
PlayerDestinationButtons[i + PlayerDestinationButtonsNumH].STexture = Buttons[ButtonPlayerDestination].STexture;
PlayerDestinationButtons[i + PlayerDestinationButtonsNumH].Text.Text = String.Empty;
PlayerDestinationButtons[i + PlayerDestinationButtonsNumH].Enabled = false;
}
@@ -572,11 +542,11 @@ namespace Vocaluxe.PartyModes
{
if (Data.ScreenNames.ProfileIDsTeam1.Count == NumPlayerTeam1 && Data.ScreenNames.ProfileIDsTeam2.Count == NumPlayerTeam2)
{
Buttons[htButtons(ButtonNext)].Visible = true;
SetInteractionToButton(Buttons[htButtons(ButtonNext)]);
Buttons[ButtonNext].Visible = true;
SetInteractionToButton(Buttons[ButtonNext]);
}
else
Buttons[htButtons(ButtonNext)].Visible = false;
Buttons[ButtonNext].Visible = false;
}
private bool OnAdd()
@@ -641,11 +611,11 @@ namespace Vocaluxe.PartyModes
}
}
}
for (int i = PlayerDestinationButtonsNumH; i < PlayerDestinationButtonsNumH*2; i++)
for (int i = PlayerDestinationButtonsNumH; i < PlayerDestinationButtonsNumH * 2; i++)
{
if (PlayerDestinationButtons[i].Selected)
{
if (((i-PlayerDestinationButtonsNumH) + 1) <= Data.ScreenNames.ProfileIDsTeam2.Count)
if (((i - PlayerDestinationButtonsNumH) + 1) <= Data.ScreenNames.ProfileIDsTeam2.Count)
{
Data.ScreenNames.ProfileIDsTeam2.RemoveAt(i - PlayerDestinationButtonsNumH);
UpdateButtonNext();
@@ -663,14 +633,14 @@ namespace Vocaluxe.PartyModes
{
Data.ScreenNames.FadeToConfig = true;
Data.ScreenNames.FadeToMain = false;
_PartyMode.DataFromScreen(_ThemeName, Data);
_PartyMode.DataFromScreen(ThemeName, Data);
}
private void Next()
{
Data.ScreenNames.FadeToConfig = false;
Data.ScreenNames.FadeToMain = true;
_PartyMode.DataFromScreen(_ThemeName, Data);
_PartyMode.DataFromScreen(ThemeName, Data);
}
}
}
}
@@ -0,0 +1,809 @@
<StyleCopSettings Version="105">
<Analyzers>
<Analyzer AnalyzerId="StyleCop.CSharp.DocumentationRules">
<Rules>
<Rule Name="ElementsMustBeDocumented">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="PartialElementsMustBeDocumented">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="EnumerationItemsMustBeDocumented">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="DocumentationMustContainValidXml">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="ElementDocumentationMustHaveSummary">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="PartialElementDocumentationMustHaveSummary">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="ElementDocumentationMustHaveSummaryText">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="PartialElementDocumentationMustHaveSummaryText">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="ElementDocumentationMustNotHaveDefaultSummary">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="ElementParametersMustBeDocumented">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="ElementParameterDocumentationMustMatchElementParameters">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="ElementParameterDocumentationMustDeclareParameterName">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="ElementParameterDocumentationMustHaveText">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="ElementReturnValueMustBeDocumented">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="ElementReturnValueDocumentationMustHaveText">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="VoidReturnValueMustNotBeDocumented">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="GenericTypeParametersMustBeDocumented">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="GenericTypeParametersMustBeDocumentedPartialClass">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="GenericTypeParameterDocumentationMustMatchTypeParameters">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="GenericTypeParameterDocumentationMustDeclareParameterName">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="GenericTypeParameterDocumentationMustHaveText">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="PropertySummaryDocumentationMustMatchAccessors">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="PropertySummaryDocumentationMustOmitSetAccessorWithRestrictedAccess">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="ElementDocumentationMustNotBeCopiedAndPasted">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="SingleLineCommentsMustNotUseDocumentationStyleSlashes">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="DocumentationTextMustNotBeEmpty">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="DocumentationTextMustContainWhitespace">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="DocumentationMustMeetCharacterPercentage">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="ConstructorSummaryDocumentationMustBeginWithStandardText">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="DestructorSummaryDocumentationMustBeginWithStandardText">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="DocumentationHeadersMustNotContainBlankLines">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="IncludedDocumentationXPathDoesNotExist">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="IncludeNodeDoesNotContainValidFileAndPath">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="InheritDocMustBeUsedWithInheritingClass">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="ElementDocumentationMustBeSpelledCorrectly">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="FileMustHaveHeader">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="FileHeaderMustShowCopyright">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="FileHeaderMustHaveCopyrightText">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="FileHeaderMustContainFileName">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="FileHeaderFileNameDocumentationMustMatchFileName">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="FileHeaderMustHaveValidCompanyText">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="FileHeaderFileNameDocumentationMustMatchTypeName">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
</Rules>
<AnalyzerSettings />
</Analyzer>
<Analyzer AnalyzerId="StyleCop.CSharp.LayoutRules">
<Rules>
<Rule Name="CurlyBracketsForMultiLineStatementsMustNotShareLine">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="StatementMustNotBeOnSingleLine">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="ElementMustNotBeOnSingleLine">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="CurlyBracketsMustNotBeOmitted">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="AllAccessorsMustBeMultiLineOrSingleLine">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="OpeningCurlyBracketsMustNotBeFollowedByBlankLine">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="ElementDocumentationHeadersMustNotBeFollowedByBlankLine">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="CodeMustNotContainMultipleBlankLinesInARow">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="ClosingCurlyBracketsMustNotBePrecededByBlankLine">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="OpeningCurlyBracketsMustNotBePrecededByBlankLine">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="ChainedStatementBlocksMustNotBePrecededByBlankLine">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="WhileDoFooterMustNotBePrecededByBlankLine">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="SingleLineCommentsMustNotBeFollowedByBlankLine">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="ClosingCurlyBracketMustBeFollowedByBlankLine">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="ElementDocumentationHeaderMustBePrecededByBlankLine">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="SingleLineCommentMustBePrecededByBlankLine">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="ElementsMustBeSeparatedByBlankLine">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="CodeMustNotContainBlankLinesAtStartOfFile">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="CodeMustNotContainBlankLinesAtEndOfFile">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
</Rules>
<AnalyzerSettings />
</Analyzer>
<Analyzer AnalyzerId="StyleCop.CSharp.MaintainabilityRules">
<Rules>
<Rule Name="AccessModifierMustBeDeclared">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="FieldsMustBePrivate">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="CodeAnalysisSuppressionMustHaveJustification">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="DebugAssertMustProvideMessageText">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="DebugFailMustProvideMessageText">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="FileMayOnlyContainASingleClass">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="FileMayOnlyContainASingleNamespace">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="StatementMustNotUseUnnecessaryParenthesis">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="ArithmeticExpressionsMustDeclarePrecedence">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="ConditionalExpressionsMustDeclarePrecedence">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="RemoveDelegateParenthesisWhenPossible">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="AttributeConstructorMustNotUseUnnecessaryParenthesis">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="RemoveUnnecessaryCode">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
</Rules>
<AnalyzerSettings />
</Analyzer>
<Analyzer AnalyzerId="StyleCop.CSharp.NamingRules">
<Rules>
<Rule Name="ElementMustBeginWithUpperCaseLetter">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="ElementMustBeginWithLowerCaseLetter">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="InterfaceNamesMustBeginWithI">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="ConstFieldNamesMustBeginWithUpperCaseLetter">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="NonPrivateReadonlyFieldsMustBeginWithUpperCaseLetter">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="FieldNamesMustNotUseHungarianNotation">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="FieldNamesMustBeginWithLowerCaseLetter">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="AccessibleFieldsMustBeginWithUpperCaseLetter">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="VariableNamesMustNotBePrefixed">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="FieldNamesMustNotBeginWithUnderscore">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="FieldNamesMustNotContainUnderscore">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="StaticReadonlyFieldsMustBeginWithUpperCaseLetter">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
</Rules>
<AnalyzerSettings />
</Analyzer>
<Analyzer AnalyzerId="StyleCop.CSharp.OrderingRules">
<Rules>
<Rule Name="UsingDirectivesMustBePlacedWithinNamespace">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="ElementsMustAppearInTheCorrectOrder">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="ElementsMustBeOrderedByAccess">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="ConstantsMustAppearBeforeFields">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="StaticElementsMustAppearBeforeInstanceElements">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="DeclarationKeywordsMustFollowOrder">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="ProtectedMustComeBeforeInternal">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="PropertyAccessorsMustFollowOrder">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="EventAccessorsMustFollowOrder">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="StaticReadonlyElementsMustAppearBeforeStaticNonReadonlyElements">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="InstanceReadonlyElementsMustAppearBeforeInstanceNonReadonlyElements">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="SystemUsingDirectivesMustBePlacedBeforeOtherUsingDirectives">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="UsingAliasDirectivesMustBePlacedAfterOtherUsingDirectives">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="UsingDirectivesMustBeOrderedAlphabeticallyByNamespace">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="UsingAliasDirectivesMustBeOrderedAlphabeticallyByAliasName">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
</Rules>
<AnalyzerSettings />
</Analyzer>
<Analyzer AnalyzerId="StyleCop.CSharp.ReadabilityRules">
<Rules>
<Rule Name="CommentsMustContainText">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="DoNotPrefixCallsWithBaseUnlessLocalImplementationExists">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="PrefixLocalCallsWithThis">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="PrefixCallsCorrectly">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="OpeningParenthesisMustBeOnDeclarationLine">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="ClosingParenthesisMustBeOnLineOfLastParameter">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="ClosingParenthesisMustBeOnLineOfOpeningParenthesis">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="CommaMustBeOnSameLineAsPreviousParameter">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="ParameterListMustFollowDeclaration">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="ParameterMustFollowComma">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="SplitParametersMustStartOnLineAfterDeclaration">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="ParametersMustBeOnSameLineOrSeparateLines">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="ParameterMustNotSpanMultipleLines">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="QueryClauseMustFollowPreviousClause">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="QueryClausesMustBeOnSeparateLinesOrAllOnOneLine">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="QueryClauseMustBeginOnNewLineWhenPreviousClauseSpansMultipleLines">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="QueryClausesSpanningMultipleLinesMustBeginOnOwnLine">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="DoNotPlaceRegionsWithinElements">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="CodeMustNotContainEmptyStatements">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="CodeMustNotContainMultipleStatementsOnOneLine">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="BlockStatementsMustNotContainEmbeddedComments">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="BlockStatementsMustNotContainEmbeddedRegions">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="UseStringEmptyForEmptyStrings">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="UseBuiltInTypeAlias">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="UseShorthandForNullableTypes">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
</Rules>
<AnalyzerSettings />
</Analyzer>
<Analyzer AnalyzerId="StyleCop.CSharp.SpacingRules">
<Rules>
<Rule Name="KeywordsMustBeSpacedCorrectly">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="CommasMustBeSpacedCorrectly">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="SemicolonsMustBeSpacedCorrectly">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="SymbolsMustBeSpacedCorrectly">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="DocumentationLinesMustBeginWithSingleSpace">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="SingleLineCommentsMustBeginWithSingleSpace">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="PreprocessorKeywordsMustNotBePrecededBySpace">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="OperatorKeywordMustBeFollowedBySpace">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="OpeningParenthesisMustBeSpacedCorrectly">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="ClosingParenthesisMustBeSpacedCorrectly">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="OpeningSquareBracketsMustBeSpacedCorrectly">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="ClosingSquareBracketsMustBeSpacedCorrectly">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="OpeningCurlyBracketsMustBeSpacedCorrectly">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="ClosingCurlyBracketsMustBeSpacedCorrectly">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="OpeningGenericBracketsMustBeSpacedCorrectly">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="ClosingGenericBracketsMustBeSpacedCorrectly">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="OpeningAttributeBracketsMustBeSpacedCorrectly">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="ClosingAttributeBracketsMustBeSpacedCorrectly">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="NullableTypeSymbolsMustNotBePrecededBySpace">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="MemberAccessSymbolsMustBeSpacedCorrectly">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="IncrementDecrementSymbolsMustBeSpacedCorrectly">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="NegativeSignsMustBeSpacedCorrectly">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="PositiveSignsMustBeSpacedCorrectly">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="DereferenceAndAccessOfSymbolsMustBeSpacedCorrectly">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="ColonsMustBeSpacedCorrectly">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="CodeMustNotContainMultipleWhitespaceInARow">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="CodeMustNotContainSpaceAfterNewKeywordInImplicitlyTypedArrayAllocation">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="TabsMustNotBeUsed">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
</Rules>
<AnalyzerSettings />
</Analyzer>
</Analyzers>
</StyleCopSettings>
+44
View File
@@ -0,0 +1,44 @@
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
<s:String x:Key="/Default/CodeInspection/Highlighting/AnalysisEnabled/@EntryValue">SOLUTION</s:String>
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=RedundantExplicitArrayCreation/@EntryIndexedValue">DO_NOT_SHOW</s:String>
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=SpecifyACultureInStringConversionExplicitly/@EntryIndexedValue">DO_NOT_SHOW</s:String>
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=SuggestUseVarKeywordEverywhere/@EntryIndexedValue">DO_NOT_SHOW</s:String>
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=SuggestUseVarKeywordEvident/@EntryIndexedValue">DO_NOT_SHOW</s:String>
<s:String x:Key="/Default/CodeStyle/CodeCleanup/Profiles/=Cleanup/@EntryIndexedValue">&lt;?xml version="1.0" encoding="utf-16"?&gt;&lt;Profile name="Cleanup"&gt;&lt;CSArrangeThisQualifier&gt;True&lt;/CSArrangeThisQualifier&gt;&lt;CSRemoveCodeRedundancies&gt;True&lt;/CSRemoveCodeRedundancies&gt;&lt;CSMakeFieldReadonly&gt;True&lt;/CSMakeFieldReadonly&gt;&lt;CSUseVar&gt;&lt;BehavourStyle&gt;CAN_CHANGE_TO_EXPLICIT&lt;/BehavourStyle&gt;&lt;LocalVariableStyle&gt;ALWAYS_EXPLICIT&lt;/LocalVariableStyle&gt;&lt;ForeachVariableStyle&gt;ALWAYS_EXPLICIT&lt;/ForeachVariableStyle&gt;&lt;/CSUseVar&gt;&lt;CSOptimizeUsings&gt;&lt;OptimizeUsings&gt;False&lt;/OptimizeUsings&gt;&lt;EmbraceInRegion&gt;False&lt;/EmbraceInRegion&gt;&lt;RegionName&gt;&lt;/RegionName&gt;&lt;/CSOptimizeUsings&gt;&lt;CSReformatCode&gt;True&lt;/CSReformatCode&gt;&lt;CSharpFormatDocComments&gt;True&lt;/CSharpFormatDocComments&gt;&lt;CSShortenReferences&gt;True&lt;/CSShortenReferences&gt;&lt;StyleCop.Documentation&gt;&lt;SA1600ElementsMustBeDocumented&gt;False&lt;/SA1600ElementsMustBeDocumented&gt;&lt;SA1604ElementDocumentationMustHaveSummary&gt;False&lt;/SA1604ElementDocumentationMustHaveSummary&gt;&lt;SA1609PropertyDocumentationMustHaveValueDocumented&gt;False&lt;/SA1609PropertyDocumentationMustHaveValueDocumented&gt;&lt;SA1611ElementParametersMustBeDocumented&gt;False&lt;/SA1611ElementParametersMustBeDocumented&gt;&lt;SA1615ElementReturnValueMustBeDocumented&gt;False&lt;/SA1615ElementReturnValueMustBeDocumented&gt;&lt;SA1617VoidReturnValueMustNotBeDocumented&gt;False&lt;/SA1617VoidReturnValueMustNotBeDocumented&gt;&lt;SA1618GenericTypeParametersMustBeDocumented&gt;False&lt;/SA1618GenericTypeParametersMustBeDocumented&gt;&lt;SA1626SingleLineCommentsMustNotUseDocumentationStyleSlashes&gt;False&lt;/SA1626SingleLineCommentsMustNotUseDocumentationStyleSlashes&gt;&lt;SA1628DocumentationTextMustBeginWithACapitalLetter&gt;False&lt;/SA1628DocumentationTextMustBeginWithACapitalLetter&gt;&lt;SA1629DocumentationTextMustEndWithAPeriod&gt;False&lt;/SA1629DocumentationTextMustEndWithAPeriod&gt;&lt;SA1633SA1641UpdateFileHeader&gt;Ignore&lt;/SA1633SA1641UpdateFileHeader&gt;&lt;SA1639FileHeaderMustHaveSummary&gt;False&lt;/SA1639FileHeaderMustHaveSummary&gt;&lt;SA1642ConstructorSummaryDocumentationMustBeginWithStandardText&gt;False&lt;/SA1642ConstructorSummaryDocumentationMustBeginWithStandardText&gt;&lt;SA1643DestructorSummaryDocumentationMustBeginWithStandardText&gt;False&lt;/SA1643DestructorSummaryDocumentationMustBeginWithStandardText&gt;&lt;SA1644DocumentationHeadersMustNotContainBlankLines&gt;False&lt;/SA1644DocumentationHeadersMustNotContainBlankLines&gt;&lt;/StyleCop.Documentation&gt;&lt;StyleCop.Layout&gt;&lt;SA1500CurlyBracketsForMultiLineStatementsMustNotShareLine&gt;False&lt;/SA1500CurlyBracketsForMultiLineStatementsMustNotShareLine&gt;&lt;SA1509OpeningCurlyBracketsMustNotBePrecededByBlankLine&gt;True&lt;/SA1509OpeningCurlyBracketsMustNotBePrecededByBlankLine&gt;&lt;SA1510ChainedStatementBlocksMustNotBePrecededByBlankLine&gt;True&lt;/SA1510ChainedStatementBlocksMustNotBePrecededByBlankLine&gt;&lt;SA1511WhileDoFooterMustNotBePrecededByBlankLine&gt;True&lt;/SA1511WhileDoFooterMustNotBePrecededByBlankLine&gt;&lt;SA1512SingleLineCommentsMustNotBeFollowedByBlankLine&gt;True&lt;/SA1512SingleLineCommentsMustNotBeFollowedByBlankLine&gt;&lt;SA1513ClosingCurlyBracketMustBeFollowedByBlankLine&gt;False&lt;/SA1513ClosingCurlyBracketMustBeFollowedByBlankLine&gt;&lt;SA1514ElementDocumentationHeaderMustBePrecededByBlankLine&gt;False&lt;/SA1514ElementDocumentationHeaderMustBePrecededByBlankLine&gt;&lt;SA1515SingleLineCommentMustBeProceededByBlankLine&gt;False&lt;/SA1515SingleLineCommentMustBeProceededByBlankLine&gt;&lt;/StyleCop.Layout&gt;&lt;StyleCop.Readability&gt;&lt;SA1100DoNotPrefixCallsWithBaseUnlessLocalImplementationExists&gt;True&lt;/SA1100DoNotPrefixCallsWithBaseUnlessLocalImplementationExists&gt;&lt;SA1106CodeMustNotContainEmptyStatements&gt;True&lt;/SA1106CodeMustNotContainEmptyStatements&gt;&lt;SA1108BlockStatementsMustNotContainEmbeddedComments&gt;True&lt;/SA1108BlockStatementsMustNotContainEmbeddedComments&gt;&lt;SA1109BlockStatementsMustNotContainEmbeddedRegions&gt;True&lt;/SA1109BlockStatementsMustNotContainEmbeddedRegions&gt;&lt;SA1120CommentsMustContainText&gt;False&lt;/SA1120CommentsMustContainText&gt;&lt;SA1121UseBuiltInTypeAlias&gt;False&lt;/SA1121UseBuiltInTypeAlias&gt;&lt;SA1122UseStringEmptyForEmptyStrings&gt;False&lt;/SA1122UseStringEmptyForEmptyStrings&gt;&lt;SA1123DoNotPlaceRegionsWithinElements&gt;False&lt;/SA1123DoNotPlaceRegionsWithinElements&gt;&lt;SA1124CodeMustNotContainEmptyRegions&gt;True&lt;/SA1124CodeMustNotContainEmptyRegions&gt;&lt;/StyleCop.Readability&gt;&lt;StyleCop.Spacing&gt;&lt;SA1001CommasMustBeSpacedCorrectly&gt;False&lt;/SA1001CommasMustBeSpacedCorrectly&gt;&lt;SA1005SingleLineCommentsMustBeginWithSingleSpace&gt;False&lt;/SA1005SingleLineCommentsMustBeginWithSingleSpace&gt;&lt;SA1006PreprocessorKeywordsMustNotBePrecededBySpaLine truncated
<s:String x:Key="/Default/CodeStyle/CodeCleanup/Profiles/=Simple_0020Reformat/@EntryIndexedValue">&lt;?xml version="1.0" encoding="utf-16"?&gt;&lt;Profile name="Simple Reformat"&gt;&lt;CSOptimizeUsings&gt;&lt;OptimizeUsings&gt;False&lt;/OptimizeUsings&gt;&lt;EmbraceInRegion&gt;False&lt;/EmbraceInRegion&gt;&lt;RegionName&gt;&lt;/RegionName&gt;&lt;/CSOptimizeUsings&gt;&lt;CSReformatCode&gt;True&lt;/CSReformatCode&gt;&lt;StyleCop.Documentation&gt;&lt;SA1600ElementsMustBeDocumented&gt;False&lt;/SA1600ElementsMustBeDocumented&gt;&lt;SA1604ElementDocumentationMustHaveSummary&gt;False&lt;/SA1604ElementDocumentationMustHaveSummary&gt;&lt;SA1609PropertyDocumentationMustHaveValueDocumented&gt;False&lt;/SA1609PropertyDocumentationMustHaveValueDocumented&gt;&lt;SA1611ElementParametersMustBeDocumented&gt;False&lt;/SA1611ElementParametersMustBeDocumented&gt;&lt;SA1615ElementReturnValueMustBeDocumented&gt;False&lt;/SA1615ElementReturnValueMustBeDocumented&gt;&lt;SA1617VoidReturnValueMustNotBeDocumented&gt;False&lt;/SA1617VoidReturnValueMustNotBeDocumented&gt;&lt;SA1618GenericTypeParametersMustBeDocumented&gt;False&lt;/SA1618GenericTypeParametersMustBeDocumented&gt;&lt;SA1626SingleLineCommentsMustNotUseDocumentationStyleSlashes&gt;False&lt;/SA1626SingleLineCommentsMustNotUseDocumentationStyleSlashes&gt;&lt;SA1628DocumentationTextMustBeginWithACapitalLetter&gt;False&lt;/SA1628DocumentationTextMustBeginWithACapitalLetter&gt;&lt;SA1629DocumentationTextMustEndWithAPeriod&gt;False&lt;/SA1629DocumentationTextMustEndWithAPeriod&gt;&lt;SA1633SA1641UpdateFileHeader&gt;Ignore&lt;/SA1633SA1641UpdateFileHeader&gt;&lt;SA1639FileHeaderMustHaveSummary&gt;False&lt;/SA1639FileHeaderMustHaveSummary&gt;&lt;SA1642ConstructorSummaryDocumentationMustBeginWithStandardText&gt;False&lt;/SA1642ConstructorSummaryDocumentationMustBeginWithStandardText&gt;&lt;SA1643DestructorSummaryDocumentationMustBeginWithStandardText&gt;False&lt;/SA1643DestructorSummaryDocumentationMustBeginWithStandardText&gt;&lt;SA1644DocumentationHeadersMustNotContainBlankLines&gt;False&lt;/SA1644DocumentationHeadersMustNotContainBlankLines&gt;&lt;/StyleCop.Documentation&gt;&lt;StyleCop.Spacing&gt;&lt;SA1001CommasMustBeSpacedCorrectly&gt;False&lt;/SA1001CommasMustBeSpacedCorrectly&gt;&lt;SA1005SingleLineCommentsMustBeginWithSingleSpace&gt;False&lt;/SA1005SingleLineCommentsMustBeginWithSingleSpace&gt;&lt;SA1006PreprocessorKeywordsMustNotBePrecededBySpace&gt;True&lt;/SA1006PreprocessorKeywordsMustNotBePrecededBySpace&gt;&lt;SA1021NegativeSignsMustBeSpacedCorrectly&gt;True&lt;/SA1021NegativeSignsMustBeSpacedCorrectly&gt;&lt;SA1022PositiveSignsMustBeSpacedCorrectly&gt;True&lt;/SA1022PositiveSignsMustBeSpacedCorrectly&gt;&lt;SA1025CodeMustNotContainMultipleWhitespaceInARow&gt;True&lt;/SA1025CodeMustNotContainMultipleWhitespaceInARow&gt;&lt;/StyleCop.Spacing&gt;&lt;StyleCop.Readability&gt;&lt;SA1100DoNotPrefixCallsWithBaseUnlessLocalImplementationExists&gt;True&lt;/SA1100DoNotPrefixCallsWithBaseUnlessLocalImplementationExists&gt;&lt;SA1106CodeMustNotContainEmptyStatements&gt;True&lt;/SA1106CodeMustNotContainEmptyStatements&gt;&lt;SA1108BlockStatementsMustNotContainEmbeddedComments&gt;True&lt;/SA1108BlockStatementsMustNotContainEmbeddedComments&gt;&lt;SA1109BlockStatementsMustNotContainEmbeddedRegions&gt;True&lt;/SA1109BlockStatementsMustNotContainEmbeddedRegions&gt;&lt;SA1120CommentsMustContainText&gt;False&lt;/SA1120CommentsMustContainText&gt;&lt;SA1121UseBuiltInTypeAlias&gt;False&lt;/SA1121UseBuiltInTypeAlias&gt;&lt;SA1122UseStringEmptyForEmptyStrings&gt;False&lt;/SA1122UseStringEmptyForEmptyStrings&gt;&lt;SA1123DoNotPlaceRegionsWithinElements&gt;False&lt;/SA1123DoNotPlaceRegionsWithinElements&gt;&lt;SA1124CodeMustNotContainEmptyRegions&gt;True&lt;/SA1124CodeMustNotContainEmptyRegions&gt;&lt;/StyleCop.Readability&gt;&lt;StyleCop.Layout&gt;&lt;SA1500CurlyBracketsForMultiLineStatementsMustNotShareLine&gt;False&lt;/SA1500CurlyBracketsForMultiLineStatementsMustNotShareLine&gt;&lt;SA1509OpeningCurlyBracketsMustNotBePrecededByBlankLine&gt;True&lt;/SA1509OpeningCurlyBracketsMustNotBePrecededByBlankLine&gt;&lt;SA1510ChainedStatementBlocksMustNotBePrecededByBlankLine&gt;True&lt;/SA1510ChainedStatementBlocksMustNotBePrecededByBlankLine&gt;&lt;SA1511WhileDoFooterMustNotBePrecededByBlankLine&gt;True&lt;/SA1511WhileDoFooterMustNotBePrecededByBlankLine&gt;&lt;SA1512SingleLineCommentsMustNotBeFollowedByBlankLine&gt;True&lt;/SA1512SingleLineCommentsMustNotBeFollowedByBlankLine&gt;&lt;SA1513ClosingCurlyBracketMustBeFollowedByBlankLine&gt;False&lt;/SA1513ClosingCurlyBracketMustBeFollowedByBlankLine&gt;&lt;SA1514ElementDocumentationHeaderMustBePrecededByBlankLine&gt;False&lt;/SA1514ElementDocumentationHeaderMustBePrecededByBlankLine&gt;&lt;SA1515SingleLineCommentMustBeProceededByBlankLine&gt;False&lt;/SA1515SingleLineCommentMustBeProceededByBlankLine&gt;&lt;/StyleCop.Layout&gt;&lt;StyleCop.Ordering&gt;&lt;AlphabeticalUsingDirectives&gt;Ignore&lt;/AlphabeticalUsingDirectives&gt;&lt;ExpandUsingDirectiLine truncated
<s:String x:Key="/Default/CodeStyle/CodeCleanup/RecentlyUsedProfile/@EntryValue">Cleanup</s:String>
<s:String x:Key="/Default/CodeStyle/CodeCleanup/SilentCleanupProfile/@EntryValue">Simple Reformat</s:String>
<s:Int64 x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/BLANK_LINES_AROUND_FIELD/@EntryValue">0</s:Int64>
<s:Int64 x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/BLANK_LINES_INSIDE_REGION/@EntryValue">0</s:Int64>
<s:String x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/EMPTY_BLOCK_STYLE/@EntryValue">TOGETHER_SAME_LINE</s:String>
<s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/EXPLICIT_INTERNAL_MODIFIER/@EntryValue">False</s:Boolean>
<s:String x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/FORCE_ATTRIBUTE_STYLE/@EntryValue">JOIN</s:String>
<s:String x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/FORCE_FIXED_BRACES_STYLE/@EntryValue">ONLY_FOR_MULTILINE</s:String>
<s:String x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/FORCE_FOR_BRACES_STYLE/@EntryValue">ONLY_FOR_MULTILINE</s:String>
<s:String x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/FORCE_FOREACH_BRACES_STYLE/@EntryValue">ONLY_FOR_MULTILINE</s:String>
<s:String x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/FORCE_IFELSE_BRACES_STYLE/@EntryValue">ONLY_FOR_MULTILINE</s:String>
<s:String x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/FORCE_USING_BRACES_STYLE/@EntryValue">ONLY_FOR_MULTILINE</s:String>
<s:String x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/FORCE_WHILE_BRACES_STYLE/@EntryValue">ONLY_FOR_MULTILINE</s:String>
<s:Int64 x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/KEEP_BLANK_LINES_IN_DECLARATIONS/@EntryValue">1</s:Int64>
<s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/PLACE_COMPLEX_ACCESSOR_ATTRIBUTE_ON_SAME_LINE/@EntryValue">True</s:Boolean>
<s:String x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/SIMPLE_EMBEDDED_STATEMENT_STYLE/@EntryValue">LINE_BREAK</s:String>
<s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/SPACE_AFTER_TYPECAST_PARENTHESES/@EntryValue">False</s:Boolean>
<s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/SPACE_AROUND_MULTIPLICATIVE_OP/@EntryValue">True</s:Boolean>
<s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/SPACE_BEFORE_SIZEOF_PARENTHESES/@EntryValue">False</s:Boolean>
<s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/SPACE_BEFORE_TYPEOF_PARENTHESES/@EntryValue">False</s:Boolean>
<s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/STICK_COMMENT/@EntryValue">False</s:Boolean>
<s:String x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/WRAP_FOR_STMT_HEADER_STYLE/@EntryValue">WRAP_IF_LONG</s:String>
<s:Int64 x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/WRAP_LIMIT/@EntryValue">180</s:Int64>
<s:String x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/WRAP_MULTIPLE_DECLARATION_STYLE/@EntryValue">WRAP_IF_LONG</s:String>
<s:String x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/WRAP_TERNARY_EXPR_STYLE/@EntryValue">WRAP_IF_LONG</s:String>
<s:Boolean x:Key="/Default/CodeStyle/CSharpUsing/AllowAlias/@EntryValue">False</s:Boolean>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/PredefinedNamingRules/=EnumMember/@EntryIndexedValue">&lt;Policy Inspect="True" Prefix="" Suffix="" Style="AaBb" /&gt;</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/PredefinedNamingRules/=PrivateConstants/@EntryIndexedValue">&lt;Policy Inspect="True" Prefix="_" Suffix="" Style="AaBb" /&gt;</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/PredefinedNamingRules/=PrivateInstanceFields/@EntryIndexedValue">&lt;Policy Inspect="True" Prefix="_" Suffix="" Style="AaBb" /&gt;</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/PredefinedNamingRules/=PrivateStaticFields/@EntryIndexedValue">&lt;Policy Inspect="True" Prefix="_" Suffix="" Style="AaBb" /&gt;</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/PredefinedNamingRules/=PrivateStaticReadonly/@EntryIndexedValue">&lt;Policy Inspect="True" Prefix="_" Suffix="" Style="AaBb" /&gt;</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/PredefinedNamingRules/=PublicFields/@EntryIndexedValue">&lt;Policy Inspect="True" Prefix="" Suffix="" Style="AaBb" /&gt;</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/UserRules/=27c8359b_002D97bf_002D4e1d_002Db126_002D4f613028bcc5/@EntryIndexedValue">&lt;Policy&gt;&lt;Descriptor Staticness="Static, Instance" AccessRightKinds="Private, Protected, ProtectedInternal, Internal, Public" Description="Enums"&gt;&lt;ElementKinds&gt;&lt;Kind Name="ENUM" /&gt;&lt;/ElementKinds&gt;&lt;/Descriptor&gt;&lt;Policy Inspect="True" Prefix="E" Suffix="" Style="AaBb" /&gt;&lt;/Policy&gt;</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/UserRules/=8cff90ce_002Def0d_002D436d_002Db8f2_002D5b5bdb923d3b/@EntryIndexedValue">&lt;Policy&gt;&lt;Descriptor Staticness="Static, Instance" AccessRightKinds="Private, Protected, ProtectedInternal, Internal, Public" Description="Classes"&gt;&lt;ElementKinds&gt;&lt;Kind Name="CLASS" /&gt;&lt;/ElementKinds&gt;&lt;/Descriptor&gt;&lt;Policy Inspect="True" Prefix="C" Suffix="" Style="AaBb" /&gt;&lt;/Policy&gt;</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/UserRules/=da335a8d_002D4b6e_002D4df6_002D8434_002D29ffe5e2547b/@EntryIndexedValue">&lt;Policy&gt;&lt;Descriptor Staticness="Static, Instance" AccessRightKinds="Private, Protected, ProtectedInternal, Internal, Public" Description="Structs"&gt;&lt;ElementKinds&gt;&lt;Kind Name="STRUCT" /&gt;&lt;/ElementKinds&gt;&lt;/Descriptor&gt;&lt;Policy Inspect="True" Prefix="S" Suffix="" Style="AaBb" /&gt;&lt;/Policy&gt;</s:String>
</wpf:ResourceDictionary>
-1
View File
@@ -3,7 +3,6 @@ Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 2012
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Vocaluxe", "Vocaluxe\Vocaluxe.csproj", "{2A1E0F2D-5392-4BB7-B0A1-A9DFA13E79FF}"
ProjectSection(ProjectDependencies) = postProject
{6F3E1874-F28A-40E9-AFBD-31934D593679} = {6F3E1874-F28A-40E9-AFBD-31934D593679}
{ED007796-367F-4142-AA55-5450C7645C2C} = {ED007796-367F-4142-AA55-5450C7645C2C}
{D2B6DDEF-E0E1-4DDF-A73A-E6ACEF5C95EC} = {D2B6DDEF-E0E1-4DDF-A73A-E6ACEF5C95EC}
EndProjectSection
+50 -90
View File
@@ -1,34 +1,29 @@
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Text;
using System.IO;
using Vocaluxe.Base;
using System.Diagnostics;
using Vocaluxe.Lib.Draw;
using Vocaluxe.Menu;
using Vocaluxe.Menu.SongMenu;
using System.IO;
using Vocaluxe.Base;
using VocaluxeLib.Menu;
using VocaluxeLib.Menu.SongMenu;
namespace Vocaluxe.Base
{
static class CBackgroundMusic
{
private static int _CurrentMusicStream = -1;
private static int _PreviousMusicIndex = 0;
private static int _PreviousMusicIndex;
private static PlaylistElement _CurrentPlaylistElement = new PlaylistElement();
private static List<PlaylistElement> _AllFileNames = new List<PlaylistElement>();
private static List<PlaylistElement> _NotPlayedFileNames = new List<PlaylistElement>();
private static List<PlaylistElement> _BGMusicFileNames = new List<PlaylistElement>();
private static List<PlaylistElement> _PreviousFileNames = new List<PlaylistElement>();
private static readonly List<PlaylistElement> _AllFileNames = new List<PlaylistElement>();
private static readonly List<PlaylistElement> _NotPlayedFileNames = new List<PlaylistElement>();
private static readonly List<PlaylistElement> _BGMusicFileNames = new List<PlaylistElement>();
private static readonly List<PlaylistElement> _PreviousFileNames = new List<PlaylistElement>();
private static int _Video = -1;
private static STexture _CurrentVideoTexture = new STexture(-1);
private static Stopwatch _FadeTimer = new Stopwatch();
private static readonly Stopwatch _FadeTimer = new Stopwatch();
private static bool _VideoEnabled;
private static bool _OwnMusicAdded;
private static bool _BackgroundMusicAdded;
private static bool _Playing;
@@ -38,17 +33,14 @@ namespace Vocaluxe.Base
public static bool VideoEnabled
{
get
{
return _VideoEnabled;
}
get { return _VideoEnabled; }
set
{
if (_VideoEnabled && value)
return;
if (!_VideoEnabled && !value)
return;
if(_VideoEnabled && !value)
if (_VideoEnabled && !value)
ToggleVideo();
if (!_VideoEnabled && value)
ToggleVideo();
@@ -58,23 +50,13 @@ namespace Vocaluxe.Base
public static bool CanSing
{
get
{
return _CanSing;
}
set
{
_CanSing = value;
}
get { return _CanSing; }
set { _CanSing = value; }
}
public static bool Disabled
{
get
{
return _Disabled;
}
get { return _Disabled; }
set
{
_Disabled = value;
@@ -87,53 +69,35 @@ namespace Vocaluxe.Base
public static bool RepeatSong
{
get
{
return _RepeatSong;
}
set
{
_RepeatSong = value;
}
get { return _RepeatSong; }
set { _RepeatSong = value; }
}
public static int SongID
{
get
{
return _CurrentPlaylistElement.SongID;
}
get { return _CurrentPlaylistElement.SongID; }
}
public static bool Duet
{
get
{
return _CurrentPlaylistElement.Duet;
}
get { return _CurrentPlaylistElement.Duet; }
}
public static bool SongHasVideo
{
get
{
return File.Exists(_CurrentPlaylistElement.VideoFilePath);
}
get { return File.Exists(_CurrentPlaylistElement.VideoFilePath); }
}
public static bool Playing
{
get
{
return _Playing;
}
get { return _Playing; }
}
public static string ArtistAndTitle
{
get
{
if (_CurrentPlaylistElement.Artist != "" && _CurrentPlaylistElement.Title != "")
if (_CurrentPlaylistElement.Artist.Length > 0 && _CurrentPlaylistElement.Title.Length > 0)
return _CurrentPlaylistElement.Artist + " - " + _CurrentPlaylistElement.Title;
else
return Path.GetFileNameWithoutExtension(_CurrentPlaylistElement.MusicFilePath);
@@ -142,27 +106,20 @@ namespace Vocaluxe.Base
public static STexture Cover
{
get
{
return _CurrentPlaylistElement.Cover;
}
get { return _CurrentPlaylistElement.Cover; }
}
public static void Init()
{
List<string> templist = new List<string>();
foreach(string ending in CSettings.MusicFileTypes)
{
foreach (string ending in CSettings.MusicFileTypes)
templist.AddRange(CHelper.ListFiles(CSettings.sFolderBackgroundMusic, ending, true, true));
}
foreach (string path in templist)
{
_BGMusicFileNames.Add(new PlaylistElement(path));
}
if(CConfig.BackgroundMusicSource != EBackgroundMusicSource.TR_CONFIG_ONLY_OWN_MUSIC)
if (CConfig.BackgroundMusicSource != EBackgroundMusicSource.TR_CONFIG_ONLY_OWN_MUSIC)
AddBackgroundMusic();
if (CConfig.VideoBackgrounds == EOffOn.TR_CONFIG_ON)
_VideoEnabled = true;
@@ -235,7 +192,7 @@ namespace Vocaluxe.Base
if (_AllFileNames.Count > 0 && _CurrentMusicStream != -1)
{
float timeToPlay;
if(_CurrentPlaylistElement.Finish == 0f) //No End-Tag defined
if (_CurrentPlaylistElement.Finish == 0f) //No End-Tag defined
timeToPlay = CSound.GetLength(_CurrentMusicStream) - CSound.GetPosition(_CurrentMusicStream);
else //End-Tag found
timeToPlay = _CurrentPlaylistElement.Finish - CSound.GetPosition(_CurrentMusicStream);
@@ -251,10 +208,12 @@ namespace Vocaluxe.Base
else
CSound.SetPosition(_CurrentMusicStream, 0);
if (_VideoEnabled && _Video != -1)
{
if (_CurrentPlaylistElement.Start != 0f && CConfig.BackgroundMusicUseStart == EOffOn.TR_CONFIG_ON)
CVideo.VdSkip(_Video, _CurrentPlaylistElement.Start, _CurrentPlaylistElement.VideoGap);
else
CVideo.VdSkip(_Video, 0f, _CurrentPlaylistElement.VideoGap);
}
}
else
Next();
@@ -266,8 +225,9 @@ namespace Vocaluxe.Base
{
if (_AllFileNames.Count > 0)
{
if (_PreviousMusicIndex == _PreviousFileNames.Count - 1 || _PreviousFileNames.Count == 0) //We are not currently in the previous list
if (_PreviousMusicIndex == _PreviousFileNames.Count - 1 || _PreviousFileNames.Count == 0)
{
//We are not currently in the previous list
Stop();
if (_NotPlayedFileNames.Count == 0)
_NotPlayedFileNames.AddRange(_AllFileNames);
@@ -278,8 +238,9 @@ namespace Vocaluxe.Base
_PreviousFileNames.Add(_CurrentPlaylistElement);
_PreviousMusicIndex = _PreviousFileNames.Count - 1;
}
else if(_PreviousFileNames.Count > 0) //We are in the previous list
else if (_PreviousFileNames.Count > 0)
{
//We are in the previous list
Stop();
_PreviousMusicIndex++;
@@ -314,10 +275,12 @@ namespace Vocaluxe.Base
else
CSound.SetPosition(_CurrentMusicStream, 0);
if (_VideoEnabled && _Video != -1)
{
if (_CurrentPlaylistElement.Start != 0f && CConfig.BackgroundMusicUseStart == EOffOn.TR_CONFIG_ON)
CVideo.VdSkip(_Video, _CurrentPlaylistElement.Start, _CurrentPlaylistElement.VideoGap);
else
CVideo.VdSkip(_Video, 0f, _CurrentPlaylistElement.VideoGap);
}
}
else
{
@@ -344,16 +307,18 @@ namespace Vocaluxe.Base
else
CSound.SetPosition(_CurrentMusicStream, 0);
if (_VideoEnabled && _Video != -1)
{
if (_CurrentPlaylistElement.Start != 0f && CConfig.BackgroundMusicUseStart == EOffOn.TR_CONFIG_ON)
CVideo.VdSkip(_Video, _CurrentPlaylistElement.Start, _CurrentPlaylistElement.VideoGap);
else
CVideo.VdSkip(_Video, 0f, _CurrentPlaylistElement.VideoGap);
}
}
}
public static void ApplyVolume()
{
CSound.SetStreamVolumeMax(_CurrentMusicStream, CConfig.BackgroundMusicVolume);
CSound.SetStreamVolumeMax(_CurrentMusicStream, CConfig.BackgroundMusicVolume);
}
public static void AddOwnMusic()
@@ -490,9 +455,7 @@ namespace Vocaluxe.Base
float vtime = 0f;
CVideo.VdGetFrame(_Video, ref _CurrentVideoTexture, CSound.GetPosition(_CurrentMusicStream), ref vtime);
if (_FadeTimer.ElapsedMilliseconds <= 3000L)
{
_CurrentVideoTexture.color.A = (_FadeTimer.ElapsedMilliseconds / 3000f);
}
_CurrentVideoTexture.color.A = _FadeTimer.ElapsedMilliseconds / 3000f;
else
{
_CurrentVideoTexture.color.A = 1f;
@@ -532,9 +495,9 @@ namespace Vocaluxe.Base
class PlaylistElement
{
private CSong _Song = null;
private readonly CSong _Song;
private int _SongID;
private readonly int _SongID;
public int SongID
{
get { return _SongID; }
@@ -548,14 +511,11 @@ class PlaylistElement
{
if (_Song != null)
return _Song.GetMP3();
return _MusicFilePath;
}
set
{
_MusicFilePath = value;
}
set { _MusicFilePath = value; }
}
public string VideoFilePath
@@ -564,7 +524,7 @@ class PlaylistElement
{
if (_Song != null)
return _Song.GetVideo();
return string.Empty;
}
}
@@ -575,7 +535,7 @@ class PlaylistElement
{
if (_Song != null)
return _Song.Title;
return "";
}
}
@@ -586,7 +546,7 @@ class PlaylistElement
{
if (_Song != null)
return _Song.Artist;
return "";
}
}
@@ -619,7 +579,7 @@ class PlaylistElement
{
if (_Song != null)
return _Song.CoverTextureSmall;
return CCover.NoCover;
}
}
@@ -630,7 +590,7 @@ class PlaylistElement
{
if (_Song != null)
return _Song.VideoGap;
return 0;
}
}
@@ -641,7 +601,7 @@ class PlaylistElement
{
if (_Song != null)
return _Song.IsDuet;
return false;
}
}
@@ -665,4 +625,4 @@ class PlaylistElement
MusicFilePath = string.Empty;
_SongID = -1;
}
}
}
+336 -391
View File
File diff suppressed because it is too large. Load diff
+25 -40
View File
@@ -3,9 +3,7 @@ using System.Collections.Generic;
using System.IO;
using System.Text;
using System.Xml;
using Vocaluxe.Lib.Draw;
using Vocaluxe.Menu;
using VocaluxeLib.Menu;
namespace Vocaluxe.Base
{
@@ -25,12 +23,12 @@ namespace Vocaluxe.Base
abstract class CCover
{
private static XmlWriterSettings _settings = new XmlWriterSettings();
private static List<SCover> _Cover = new List<SCover>();
private static List<SCoverTheme> _CoverThemes = new List<SCoverTheme>();
private static readonly XmlWriterSettings _settings = new XmlWriterSettings();
private static readonly List<SCover> _Cover = new List<SCover>();
private static readonly List<SCoverTheme> _CoverThemes = new List<SCoverTheme>();
private static STexture _NoCover = new STexture(-1);
private static Object _MutexCover = new Object();
private static readonly Object _MutexCover = new Object();
public static STexture NoCover
{
@@ -48,7 +46,7 @@ namespace Vocaluxe.Base
}
/// <summary>
/// Returns an array of CoverThemes-Names
/// Returns an array of CoverThemes-Names
/// </summary>
public static string[] CoverThemes
{
@@ -56,16 +54,14 @@ namespace Vocaluxe.Base
{
List<string> CoverThemes = new List<string>();
for (int i = 0; i < _CoverThemes.Count; i++)
{
CoverThemes.Add(_CoverThemes[i].Name);
}
return CoverThemes.ToArray();
}
}
/// <summary>
/// Returns the current cover theme index
/// Returns the current cover theme index
/// </summary>
/// <returns></returns>
public static int GetCoverThemeIndex()
@@ -73,16 +69,14 @@ namespace Vocaluxe.Base
for (int i = 0; i < _CoverThemes.Count; i++)
{
if (_CoverThemes[i].Name == CConfig.CoverTheme)
{
return i;
}
}
return -1;
}
/// <summary>
/// Returns a STexture for a given cover name. Returns "NoCover" if the cover does not exist.
/// </summary>
/// <summary>
/// Returns a STexture for a given cover name. Returns "NoCover" if the cover does not exist.
/// </summary>
public static STexture Cover(string Name)
{
STexture cov = _NoCover;
@@ -101,7 +95,7 @@ namespace Vocaluxe.Base
}
/// <summary>
/// Returns true if a cover with the given name exists.
/// Returns true if a cover with the given name exists.
/// </summary>
public static bool CoverExists(string Name)
{
@@ -111,16 +105,14 @@ namespace Vocaluxe.Base
foreach (SCover cover in _Cover)
{
if (cover.Name == Name)
{
return true;
}
}
}
return false;
}
/// <summary>
/// Reloads cover to use a new cover-theme
/// Reloads cover to use a new cover-theme
/// </summary>
public static void ReloadCover()
{
@@ -134,7 +126,7 @@ namespace Vocaluxe.Base
}
/// <summary>
/// Returns a SCoverTheme by cover-theme-name
/// Returns a SCoverTheme by cover-theme-name
/// </summary>
private static SCoverTheme CoverTheme(string coverThemeName)
{
@@ -151,7 +143,7 @@ namespace Vocaluxe.Base
}
/// <summary>
/// Loads all cover-themes to list.
/// Loads all cover-themes to list.
/// </summary>
private static void LoadCoverThemes()
{
@@ -162,7 +154,7 @@ namespace Vocaluxe.Base
foreach (string file in files)
{
CXMLReader xmlReader = CXMLReader.OpenFile((Path.Combine(path, file)));
CXMLReader xmlReader = CXMLReader.OpenFile(Path.Combine(path, file));
if (xmlReader != null)
{
@@ -171,7 +163,7 @@ namespace Vocaluxe.Base
xmlReader.GetValue("//root/Info/Name", ref coverTheme.Name, String.Empty);
xmlReader.GetValue("//root/Info/Folder", ref coverTheme.Folder, String.Empty);
if (coverTheme.Folder != String.Empty && coverTheme.Name != String.Empty)
if (coverTheme.Folder.Length > 0 && coverTheme.Name.Length > 0)
{
coverTheme.File = file;
@@ -180,20 +172,19 @@ namespace Vocaluxe.Base
}
}
}
/// <summary>
/// Loads all cover which are defined in the cover config file.
/// </summary>
/// <summary>
/// Loads all cover which are defined in the cover config file.
/// </summary>
private static void LoadCover(string coverThemeName)
{
SCoverTheme coverTheme = new SCoverTheme();
coverTheme = CoverTheme(coverThemeName);
if (coverTheme.Name != String.Empty)
if (coverTheme.Name.Length > 0)
{
CXMLReader xmlReader = CXMLReader.OpenFile((Path.Combine(CSettings.sFolderCover, coverTheme.File)));
CXMLReader xmlReader = CXMLReader.OpenFile(Path.Combine(CSettings.sFolderCover, coverTheme.File));
if (xmlReader != null)
{
@@ -209,22 +200,16 @@ namespace Vocaluxe.Base
xmlReader.GetValue("//root/Cover/" + cover[i] + "/Name", ref name, String.Empty);
xmlReader.GetValue("//root/Cover/" + cover[i] + "/Path", ref value, String.Empty);
sk.Name = name;
sk.Value = Path.Combine(coverTheme.Folder,value);
sk.Value = Path.Combine(coverTheme.Folder, value);
if (File.Exists(Path.Combine(CSettings.sFolderCover, Path.Combine(coverTheme.Folder, value))))
{
sk.Texture = CDraw.AddTexture(Path.Combine(CSettings.sFolderCover, Path.Combine(coverTheme.Folder, value)));
}
else
{
sk.Texture = _NoCover;
}
_Cover.Add(sk);
if (sk.Name == "NoCover")
{
_NoCover = sk.Texture;
}
}
}
}
@@ -248,7 +233,7 @@ namespace Vocaluxe.Base
string value = String.Empty;
sk.Name = name;
sk.Value = Path.Combine(coverTheme.Folder,Path.GetFileName(file));
sk.Value = Path.Combine(coverTheme.Folder, Path.GetFileName(file));
sk.Texture = CDraw.AddTexture(Path.Combine(CSettings.sFolderCover, sk.Value));
@@ -258,4 +243,4 @@ namespace Vocaluxe.Base
}
}
}
}
}
+994 -1200
View File
File diff suppressed because it is too large. Load diff
+32 -32
View File
@@ -1,20 +1,16 @@
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Drawing;
using System.Text;
using System.IO;
using System.Windows.Forms;
using Vocaluxe.Base;
using Vocaluxe.Lib.Draw;
using Vocaluxe.Menu;
using VocaluxeLib.Menu;
namespace Vocaluxe.Base
{
static class CDraw
{
private static IDraw _Draw = null;
private static IDraw _Draw;
public static void InitDraw()
{
switch (CConfig.Renderer)
@@ -31,9 +27,9 @@ namespace Vocaluxe.Base
catch (Exception e)
{
MessageBox.Show(e.Message + " - Error in initializing of OpenGL. Please check whether" +
" your graphic card drivers are up to date.");
" your graphic card drivers are up to date.");
CLog.LogError(e.Message + " - Error in initializing of OpenGL. Please check whether" +
" your graphic card drivers are up to date.");
" your graphic card drivers are up to date.");
Environment.Exit(Environment.ExitCode);
}
break;
@@ -47,12 +43,12 @@ namespace Vocaluxe.Base
catch (Exception e)
{
MessageBox.Show(e.Message + " - Error in initializing of Direct3D. Please check if " +
"your DirectX redistributables and graphic card drivers are up to date. You can " +
"download the DirectX runtimes at http://www.microsoft.com/download/en/details.aspx?id=8109",
CSettings.sProgramName, MessageBoxButtons.OK, MessageBoxIcon.Error);
"your DirectX redistributables and graphic card drivers are up to date. You can " +
"download the DirectX runtimes at http://www.microsoft.com/download/en/details.aspx?id=8109",
CSettings.sProgramName, MessageBoxButtons.OK, MessageBoxIcon.Error);
CLog.LogError(e.Message + " - Error in initializing of Direct3D. Please check if " +
"your DirectX redistributables and graphic card drivers are up to date. You can " +
"download the DirectX runtimes at http://www.microsoft.com/download/en/details.aspx?id=8109");
"your DirectX redistributables and graphic card drivers are up to date. You can " +
"download the DirectX runtimes at http://www.microsoft.com/download/en/details.aspx?id=8109");
Environment.Exit(Environment.ExitCode);
}
break;
@@ -73,7 +69,9 @@ namespace Vocaluxe.Base
public static bool Unload()
{
return _Draw.Unload();
bool result = _Draw.Unload();
_Draw = null;
return result;
}
public static int GetScreenWidth()
@@ -141,7 +139,7 @@ namespace Vocaluxe.Base
{
_Draw.MakeScreenShot();
}
// Draw Basic Text (must be deleted later)
public static void DrawText(string Text, int x, int y, int h)
{
@@ -163,23 +161,25 @@ namespace Vocaluxe.Base
if (MaxSize == 0)
return _Draw.AddTexture(TexturePath);
if (!System.IO.File.Exists(TexturePath))
if (!File.Exists(TexturePath))
return new STexture(-1);
Bitmap origin = new Bitmap(TexturePath);
int w = MaxSize;
int h = MaxSize;
using (Bitmap origin = new Bitmap(TexturePath))
{
int w = MaxSize;
int h = MaxSize;
if (origin.Width >= origin.Height && origin.Width > w)
h = (int)Math.Round((float)w / origin.Width * origin.Height);
else if (origin.Height > origin.Width && origin.Height > h)
w = (int)Math.Round((float)h / origin.Height * origin.Width);
if (origin.Width >= origin.Height && origin.Width > w)
h = (int)Math.Round((float)w / origin.Width * origin.Height);
else if (origin.Height > origin.Width && origin.Height > h)
w = (int)Math.Round((float)h / origin.Height * origin.Width);
Bitmap bmp = new Bitmap(origin, w, h);
STexture tex = _Draw.AddTexture(bmp);
bmp.Dispose();
origin.Dispose();
return tex;
using (Bitmap bmp = new Bitmap(origin, w, h))
{
STexture tex = _Draw.AddTexture(bmp);
return tex;
}
}
}
public static STexture AddTexture(int W, int H, IntPtr Data)
@@ -257,7 +257,7 @@ namespace Vocaluxe.Base
CHelper.SetRect(bounds, ref rect, rect.Width / rect.Height, Aspect);
DrawTexture(Texture, new SRectF(rect.X, rect.Y, rect.Width, rect.Height, StaticBounds.Rect.Z),
Texture.color, new SRectF(bounds.X, bounds.Y, bounds.Width, bounds.Height, 0f), false);
Texture.color, new SRectF(bounds.X, bounds.Y, bounds.Width, bounds.Height, 0f), false);
}
public static void DrawTextureReflection(STexture Texture, SRectF rect, SColorF color, SRectF bounds, float space, float height)
@@ -270,4 +270,4 @@ namespace Vocaluxe.Base
return _Draw.TextureCount();
}
}
}
}
+238 -431
View File
@@ -1,23 +1,19 @@
using System;
using System.Collections;
using System.Collections.Generic;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Drawing.Imaging;
using System.Drawing.Text;
using System.IO;
using System.Text;
using System.Windows.Forms;
using System.Xml;
using Vocaluxe.Lib.Draw;
using Vocaluxe.Menu;
using VocaluxeLib.Menu;
namespace Vocaluxe.Base
{
{
class CGlyph
{
private float _SIZEh = 50f;
private readonly float _SIZEh = 50f;
public float SIZEh
{
get { return _SIZEh; }
@@ -26,77 +22,79 @@ namespace Vocaluxe.Base
public STexture Texture;
public char Chr;
public int width;
public CGlyph(char chr, float MaxHigh)
{
_SIZEh = MaxHigh;
float outline = CFonts.Outline;
TextFormatFlags flags = TextFormatFlags.NoPadding | TextFormatFlags.NoPrefix;
float factor = GetFactor(chr, flags);
CFonts.Height = SIZEh * factor;
Bitmap bmp = new Bitmap(10, 10);
System.Drawing.Graphics g = System.Drawing.Graphics.FromImage(bmp);
Font fo;
Size sizeB;
SizeF size;
using (Graphics g = Graphics.FromHwnd(IntPtr.Zero))
{
fo = CFonts.GetFont();
sizeB = TextRenderer.MeasureText(g, chr.ToString(), fo, new Size(int.MaxValue, int.MaxValue), flags);
Font fo = CFonts.GetFont();
Size sizeB = TextRenderer.MeasureText(g, chr.ToString(), fo, new Size(int.MaxValue, int.MaxValue), flags);
size = g.MeasureString(chr.ToString(), fo);
}
SizeF size = g.MeasureString(chr.ToString(), fo);
g.Dispose();
bmp.Dispose();
using (Bitmap bmp = new Bitmap((int)(sizeB.Width * 2f), sizeB.Height))
{
Graphics g = Graphics.FromImage(bmp);
g.Clear(Color.Transparent);
bmp = new Bitmap((int)(sizeB.Width * 2f), sizeB.Height);
g = System.Drawing.Graphics.FromImage(bmp);
g.Clear(System.Drawing.Color.Transparent);
g.SmoothingMode = SmoothingMode.AntiAlias;
g.InterpolationMode = InterpolationMode.HighQualityBicubic;
g.TextRenderingHint = TextRenderingHint.ClearTypeGridFit;
CFonts.Height = SIZEh;
fo = CFonts.GetFont();
g.SmoothingMode = SmoothingMode.AntiAlias;
g.InterpolationMode = InterpolationMode.HighQualityBicubic;
g.TextRenderingHint = System.Drawing.Text.TextRenderingHint.ClearTypeGridFit;
CFonts.Height = SIZEh;
fo = CFonts.GetFont();
PointF point = new PointF(
PointF point = new PointF(
outline * Math.Abs(sizeB.Width - size.Width) + (sizeB.Width - size.Width) / 2f + SIZEh / 5f,
(sizeB.Height - size.Height - (size.Height + SIZEh/4f) * (1f - factor)) / 2f);
(sizeB.Height - size.Height - (size.Height + SIZEh / 4f) * (1f - factor)) / 2f);
GraphicsPath path = new GraphicsPath();
path.AddString(
chr.ToString(),
fo.FontFamily,
(int)fo.Style,
SIZEh,
point,
new StringFormat());
using (GraphicsPath path = new GraphicsPath())
{
path.AddString(
chr.ToString(),
fo.FontFamily,
(int)fo.Style,
SIZEh,
point,
new StringFormat());
Pen pen = new Pen(
Color.FromArgb(
(int)CFonts.OutlineColor.A * 255,
(int)CFonts.OutlineColor.R * 255,
(int)CFonts.OutlineColor.G * 255,
(int)CFonts.OutlineColor.B * 255),
SIZEh * outline);
using (Pen pen = new Pen(
Color.FromArgb(
(int)CFonts.OutlineColor.A * 255,
(int)CFonts.OutlineColor.R * 255,
(int)CFonts.OutlineColor.G * 255,
(int)CFonts.OutlineColor.B * 255),
SIZEh * outline))
{
pen.LineJoin = LineJoin.Round;
g.DrawPath(pen, path);
g.FillPath(Brushes.White, path);
}
}
pen.LineJoin = LineJoin.Round;
g.DrawPath(pen, path);
g.FillPath(Brushes.White, path);
/*
g.DrawString(
chr.ToString(),
fo,
Brushes.White,
point);
* */
Texture = CDraw.AddTexture(bmp);
//bmp.Save("test.png", ImageFormat.Png);
Chr = chr;
width = (int)((1f + outline / 2f) * sizeB.Width * Texture.width/factor / bmp.Width);
bmp.Dispose();
g.Dispose();
/*
g.DrawString(
chr.ToString(),
fo,
Brushes.White,
point);
* */
Texture = CDraw.AddTexture(bmp);
//bmp.Save("test.png", ImageFormat.Png);
Chr = chr;
width = (int)((1f + outline / 2f) * sizeB.Width * Texture.width / factor / bmp.Width);
g.Dispose();
}
fo.Dispose();
}
@@ -114,63 +112,40 @@ namespace Vocaluxe.Base
CFonts.Style = EStyle.Normal;
CFonts.Height = SIZEh;
Bitmap bmp = new Bitmap(10, 10);
System.Drawing.Graphics g = System.Drawing.Graphics.FromImage(bmp);
Font fo = CFonts.GetFont();
Size sizeB = TextRenderer.MeasureText(g, chr.ToString(), fo, new Size(int.MaxValue, int.MaxValue), flags);
//SizeF size = g.MeasureString(chr.ToString(), fo);
float h_normal = sizeB.Height;
float h_style, h_normal;
using (Graphics g = Graphics.FromHwnd(IntPtr.Zero))
{
Font fo = CFonts.GetFont();
Size sizeB = TextRenderer.MeasureText(g, chr.ToString(), fo, new Size(int.MaxValue, int.MaxValue), flags);
//SizeF size = g.MeasureString(chr.ToString(), fo);
h_normal = sizeB.Height;
}
CFonts.Style = style;
bmp = new Bitmap(10, 10);
g = System.Drawing.Graphics.FromImage(bmp);
fo = CFonts.GetFont();
sizeB = TextRenderer.MeasureText(g, chr.ToString(), fo, new Size(int.MaxValue, int.MaxValue), flags);
//size = g.MeasureString(chr.ToString(), fo);
float h_style = sizeB.Height;
g.Dispose();
using (Graphics g = Graphics.FromHwnd(IntPtr.Zero))
{
Font fo = CFonts.GetFont();
Size sizeB = TextRenderer.MeasureText(g, chr.ToString(), fo, new Size(int.MaxValue, int.MaxValue), flags);
//size = g.MeasureString(chr.ToString(), fo);
h_style = sizeB.Height;
}
return h_normal / h_style;
}
}
class CFont
class CFont : IDisposable
{
private List<CGlyph> _Glyphs;
private Hashtable _htGlyphs;
private readonly Dictionary<char, CGlyph> _Glyphs;
private PrivateFontCollection fonts;
private FontFamily family;
private float SIZEh;
private readonly float SIZEh;
public string FilePath;
public Font GetFont()
{
if (fonts == null)
{
fonts = new PrivateFontCollection();
try
{
fonts.AddFontFile(FilePath);
family = fonts.Families[0];
}
catch (Exception e)
{
CLog.LogError("Error opening font file " + FilePath + ": " + e.Message);
}
}
return new Font(family, CFonts.Height, CFonts.GetFontStyle(), GraphicsUnit.Pixel);
}
public CFont(string File)
{
FilePath = File;
_Glyphs = new List<CGlyph>();
_htGlyphs = new Hashtable();
_Glyphs = new Dictionary<char, CGlyph>();
switch (CConfig.TextureQuality)
{
@@ -195,79 +170,109 @@ namespace Vocaluxe.Base
}
}
public void DrawGlyph(char chr, float x, float y, float h, float z, SColorF color)
public Font GetFont()
{
AddGlyph(chr);
if (fonts == null)
{
fonts = new PrivateFontCollection();
try
{
fonts.AddFontFile(FilePath);
family = fonts.Families[0];
}
catch (Exception e)
{
CLog.LogError("Error opening font file " + FilePath + ": " + e.Message);
}
}
CFonts.Height = h;
CGlyph glyph = _Glyphs[(int)_htGlyphs[chr]];
float factor = h / glyph.Texture.height;
float d = glyph.SIZEh / 5f * factor;
CDraw.DrawTexture(glyph.Texture, new SRectF(x - d, y, glyph.Texture.width * factor, h, z), color);
return new Font(family, CFonts.Height, CFonts.GetFontStyle(), GraphicsUnit.Pixel);
}
public void DrawGlyphReflection(char chr, float x, float y, float h, float z, SColorF color, float rspace, float rheight)
public void DrawGlyph(char chr, float x, float y, float h, float z, SColorF color)
{
AddGlyph(chr);
CFonts.Height = h;
CGlyph glyph = _Glyphs[(int)_htGlyphs[chr]];
float factor = h / glyph.Texture.height;
float d = glyph.SIZEh / 5f * factor;
SRectF rect = new SRectF(x - d, y, glyph.Texture.width * factor, h, z);
CDraw.DrawTextureReflection(glyph.Texture, rect, color, rect, rspace, rheight);
STexture texture;
SRectF rect;
_GetGlyphTextureAndRect(chr, x, y, z, h, out texture, out rect);
CDraw.DrawTexture(texture, rect, color);
}
public void DrawGlyph(char chr, float x, float y, float h, float z, SColorF color, float begin, float end)
{
STexture texture;
SRectF rect;
_GetGlyphTextureAndRect(chr, x, y, z, h, out texture, out rect);
CDraw.DrawTexture(texture, rect, color, begin, end);
}
public void DrawGlyphReflection(char chr, float x, float y, float h, float z, SColorF color, float rspace, float rheight)
{
STexture texture;
SRectF rect;
_GetGlyphTextureAndRect(chr, x, y, z, h, out texture, out rect);
CDraw.DrawTextureReflection(texture, rect, color, rect, rspace, rheight);
}
private void _GetGlyphTextureAndRect(char chr, float x, float y, float z, float h, out STexture texture, out SRectF rect)
{
AddGlyph(chr);
CFonts.Height = h;
CGlyph glyph = _Glyphs[(int)_htGlyphs[chr]];
float factor = h / glyph.Texture.height;
float width = glyph.Texture.width * factor;
CGlyph glyph = _Glyphs[chr];
texture = glyph.Texture;
float factor = h / texture.height;
float width = texture.width * factor;
float d = glyph.SIZEh / 5f * factor;
CDraw.DrawTexture(glyph.Texture, new SRectF(x - d, y, width, h, z), color, begin, end);
rect = new SRectF(x - d, y, width, h, z);
}
public float GetWidth(char chr)
{
AddGlyph(chr);
CGlyph glyph = _Glyphs[(int)_htGlyphs[chr]];
CGlyph glyph = _Glyphs[chr];
float factor = CFonts.Height / glyph.Texture.height;
return glyph.width * factor;
}
public float GetHeight(char chr)
{
return CFonts.Height;
/*WTF???
AddGlyph(chr);
CGlyph glyph = _Glyphs[(int)_htGlyphs[chr]];
CGlyph glyph = _Glyphs[chr];
float factor = CFonts.Height / glyph.Texture.height;
return glyph.Texture.height * factor;
return glyph.Texture.height * factor;*/
}
public void AddGlyph(char chr)
{
if (_htGlyphs.ContainsKey(chr))
if (_Glyphs.ContainsKey(chr))
return;
float h = CFonts.Height;
_Glyphs.Add(new CGlyph(chr, SIZEh));
_htGlyphs.Add(chr, _Glyphs.Count - 1);
_Glyphs.Add(chr, new CGlyph(chr, SIZEh));
CFonts.Height = h;
}
public void UnloadAllGlyphs()
{
foreach (CGlyph glyph in _Glyphs)
{
foreach (CGlyph glyph in _Glyphs.Values)
glyph.UnloadTexture();
}
_Glyphs.Clear();
}
public void Dispose()
{
if (fonts != null)
{
fonts.Dispose();
fonts = null;
UnloadAllGlyphs();
}
GC.SuppressFinalize(this);
}
}
struct SFont
@@ -284,7 +289,7 @@ namespace Vocaluxe.Base
public string FileBold;
public string FileBoldItalic;
public float Outline; //0..1, 0=not outline 1=100% outline
public float Outline; //0..1, 0=not outline 1=100% outline
public SColorF OutlineColor;
public CFont Normal;
@@ -295,14 +300,13 @@ namespace Vocaluxe.Base
static class CFonts
{
private static XmlWriterSettings _settings = new XmlWriterSettings();
private static readonly XmlWriterSettings _settings = new XmlWriterSettings();
private static List<SFont> _Fonts;
private static int _CurrentFont;
private static float _Height = 1f;
public static int PartyModeID
{ get; set; }
public static int PartyModeID { get; set; }
public static EStyle Style = EStyle.Normal;
@@ -354,14 +358,14 @@ namespace Vocaluxe.Base
public static void Init()
{
_settings.Indent = true;
_settings.Encoding = System.Text.Encoding.UTF8;
_settings.Encoding = Encoding.UTF8;
_settings.ConformanceLevel = ConformanceLevel.Document;
_CurrentFont = 0;
PartyModeID = -1;
BuildFonts();
}
public static void BuildFonts()
{
_Fonts = new List<SFont>();
@@ -371,22 +375,25 @@ namespace Vocaluxe.Base
}
public static Font GetFont()
{
return _GetCurrentFont().GetFont();
}
private static CFont _GetCurrentFont()
{
switch (Style)
{
case EStyle.Normal:
return _Fonts[_CurrentFont].Normal.GetFont();
return _Fonts[_CurrentFont].Normal;
case EStyle.Italic:
return _Fonts[_CurrentFont].Italic.GetFont();
return _Fonts[_CurrentFont].Italic;
case EStyle.Bold:
return _Fonts[_CurrentFont].Bold.GetFont();
return _Fonts[_CurrentFont].Bold;
case EStyle.BoldItalic:
return _Fonts[_CurrentFont].BoldItalic.GetFont();
default:
break;
return _Fonts[_CurrentFont].BoldItalic;
}
// should never happen...
return null;
//Just in case...
return _Fonts[_CurrentFont].Normal;
}
#region DrawText
@@ -405,35 +412,17 @@ namespace Vocaluxe.Base
if (h <= 0f)
return;
if (Text == String.Empty)
if (Text.Length == 0)
return;
Height = h;
CFont Font = _GetCurrentFont();
float dx = x;
foreach (char chr in Text)
{
switch (Style)
{
case EStyle.Normal:
_Fonts[_CurrentFont].Normal.DrawGlyph(chr, dx, y, Height, z, color);
dx += _Fonts[_CurrentFont].Normal.GetWidth(chr);
break;
case EStyle.Italic:
_Fonts[_CurrentFont].Italic.DrawGlyph(chr, dx, y, Height, z, color);
dx += _Fonts[_CurrentFont].Italic.GetWidth(chr);
break;
case EStyle.Bold:
_Fonts[_CurrentFont].Bold.DrawGlyph(chr, dx, y, Height, z, color);
dx += _Fonts[_CurrentFont].Bold.GetWidth(chr);
break;
case EStyle.BoldItalic:
_Fonts[_CurrentFont].BoldItalic.DrawGlyph(chr, dx, y, Height, z, color);
dx += _Fonts[_CurrentFont].BoldItalic.GetWidth(chr);
break;
default:
break;
}
Font.DrawGlyph(chr, dx, y, Height, z, color);
dx += Font.GetWidth(chr);
}
}
@@ -442,35 +431,17 @@ namespace Vocaluxe.Base
if (h <= 0f)
return;
if (Text == String.Empty)
if (Text.Length == 0)
return;
Height = h;
CFont Font = _GetCurrentFont();
float dx = x;
foreach (char chr in Text)
{
switch (Style)
{
case EStyle.Normal:
_Fonts[_CurrentFont].Normal.DrawGlyphReflection(chr, dx, y, Height, z, color, rspace, rheight);
dx += _Fonts[_CurrentFont].Normal.GetWidth(chr);
break;
case EStyle.Italic:
_Fonts[_CurrentFont].Italic.DrawGlyphReflection(chr, dx, y, Height, z, color, rspace, rheight);
dx += _Fonts[_CurrentFont].Italic.GetWidth(chr);
break;
case EStyle.Bold:
_Fonts[_CurrentFont].Bold.DrawGlyphReflection(chr, dx, y, Height, z, color, rspace, rheight);
dx += _Fonts[_CurrentFont].Bold.GetWidth(chr);
break;
case EStyle.BoldItalic:
_Fonts[_CurrentFont].BoldItalic.DrawGlyphReflection(chr, dx, y, Height, z, color, rspace, rheight);
dx += _Fonts[_CurrentFont].BoldItalic.GetWidth(chr);
break;
default:
break;
}
Font.DrawGlyphReflection(chr, dx, y, Height, z, color, rspace, rheight);
dx += Font.GetWidth(chr);
}
}
@@ -479,7 +450,7 @@ namespace Vocaluxe.Base
if (h <= 0f)
return;
if (Text == String.Empty)
if (Text.Length == 0)
return;
Height = h;
@@ -492,56 +463,23 @@ namespace Vocaluxe.Base
float x1 = x + w * begin;
float x2 = x + w * end;
CFont Font = _GetCurrentFont();
foreach (char chr in Text)
{
float w2 = 0f;
switch (Style)
{
case EStyle.Normal:
w2 = _Fonts[_CurrentFont].Normal.GetWidth(chr);
break;
case EStyle.Italic:
w2 = _Fonts[_CurrentFont].Italic.GetWidth(chr);
break;
case EStyle.Bold:
w2 = _Fonts[_CurrentFont].Bold.GetWidth(chr);
break;
case EStyle.BoldItalic:
w2 = _Fonts[_CurrentFont].BoldItalic.GetWidth(chr);
break;
default:
break;
}
float w2 = Font.GetWidth(chr);
float b = (x1 - dx) / w2;
if (b < 0f)
b = 0f;
if (b < 1f)
{
if (b < 0f)
b = 0f;
float e = (x2 - dx) / w2;
if (e > 1f)
e = 1f;
if (e > 0f)
{
switch (Style)
{
case EStyle.Normal:
_Fonts[_CurrentFont].Normal.DrawGlyph(chr, dx, y, Height, z, color, b, e);
break;
case EStyle.Italic:
_Fonts[_CurrentFont].Italic.DrawGlyph(chr, dx, y, Height, z, color, b, e);
break;
case EStyle.Bold:
_Fonts[_CurrentFont].Bold.DrawGlyph(chr, dx, y, Height, z, color, b, e);
break;
case EStyle.BoldItalic:
_Fonts[_CurrentFont].BoldItalic.DrawGlyph(chr, dx, y, Height, z, color, b, e);
break;
default:
break;
}
if (e > 1f)
e = 1f;
Font.DrawGlyph(chr, dx, y, Height, z, color, b, e);
}
}
dx += w2;
@@ -566,8 +504,8 @@ namespace Vocaluxe.Base
}
}
public static void SetFont(string FontName)
{
public static void SetFont(string FontName)
{
int Index = -1;
if (PartyModeID != -1)
@@ -597,7 +535,7 @@ namespace Vocaluxe.Base
return;
}
}
}
}
public static RectangleF GetTextBounds(CText text)
{
@@ -607,32 +545,16 @@ namespace Vocaluxe.Base
public static RectangleF GetTextBounds(CText text, float height)
{
Height = height;
return new RectangleF(text.X, text.Y, GetTextWidth(CLanguage.Translate(text.Text, text.TranslationID)), GetTextHeight(CLanguage.Translate(text.Text, text.TranslationID)));
return new RectangleF(text.X, text.Y, GetTextWidth(CLanguage.Translate(text.Text, text.TranslationID)),
GetTextHeight(CLanguage.Translate(text.Text, text.TranslationID)));
}
public static float GetTextWidth(string text)
{
float dx = 0;
CFont Font = _GetCurrentFont();
foreach (char chr in text)
{
switch (Style)
{
case EStyle.Normal:
dx += _Fonts[_CurrentFont].Normal.GetWidth(chr);
break;
case EStyle.Italic:
dx += _Fonts[_CurrentFont].Italic.GetWidth(chr);
break;
case EStyle.Bold:
dx += _Fonts[_CurrentFont].Bold.GetWidth(chr);
break;
case EStyle.BoldItalic:
dx += _Fonts[_CurrentFont].BoldItalic.GetWidth(chr);
break;
default:
break;
}
}
dx += Font.GetWidth(chr);
return dx;
}
@@ -640,102 +562,17 @@ namespace Vocaluxe.Base
{
//return TextRenderer.MeasureText(text, GetFont()).Height;
float h = 0f;
CFont Font = _GetCurrentFont();
foreach (char chr in text)
{
float hh = 0f;
switch (Style)
{
case EStyle.Normal:
hh = _Fonts[_CurrentFont].Normal.GetHeight(chr);
break;
case EStyle.Italic:
hh = _Fonts[_CurrentFont].Italic.GetHeight(chr);
break;
case EStyle.Bold:
hh = _Fonts[_CurrentFont].Bold.GetHeight(chr);
break;
case EStyle.BoldItalic:
hh = _Fonts[_CurrentFont].BoldItalic.GetHeight(chr);
break;
default:
break;
}
if (hh>h)
float hh = Font.GetHeight(chr);
if (hh > h)
h = hh;
}
return h;
}
/// <summary>
/// Load default fonts
/// </summary>
/// <returns></returns>
private static bool LoadFontList()
{
CXMLReader xmlReader = CXMLReader.OpenFile(System.IO.Path.Combine(CSettings.sFolderFonts, CSettings.sFileFonts));
if (xmlReader == null)
return false;
_Fonts.Clear();
string value = string.Empty;
int i = 1;
while (xmlReader.GetValue("//root/Font" + i.ToString() + "/Folder", ref value, value))
{
string Folder = value;
xmlReader.GetValue("//root/Font" + i.ToString() + "/FileNormal", ref value, value);
value = Path.Combine(Directory.GetCurrentDirectory(),
Path.Combine(CSettings.sFolderFonts, Path.Combine(Folder, value)));
CFont f = new CFont(value);
SFont sf = new SFont();
sf.Normal = f;
string name = String.Empty;
xmlReader.GetValue("//root/Font" + i.ToString() + "/Name", ref name, value);
sf.Name = name;
sf.IsThemeFont = false;
sf.ThemeName = String.Empty;
sf.PartyModeID = -1;
xmlReader.GetValue("//root/Font" + i.ToString() + "/FileItalic", ref value, value);
value = Path.Combine(Directory.GetCurrentDirectory(),
Path.Combine(CSettings.sFolderFonts, Path.Combine(Folder, value)));
f = new CFont(value);
sf.Italic = f;
xmlReader.GetValue("//root/Font" + i.ToString() + "/FileBold", ref value, value);
value = Path.Combine(Directory.GetCurrentDirectory(),
Path.Combine(CSettings.sFolderFonts, Path.Combine(Folder, value)));
f = new CFont(value);
sf.Bold = f;
xmlReader.GetValue("//root/Font" + i.ToString() + "/FileBoldItalic", ref value, value);
value = Path.Combine(Directory.GetCurrentDirectory(),
Path.Combine(CSettings.sFolderFonts, Path.Combine(Folder, value)));
f = new CFont(value);
sf.BoldItalic = f;
sf.Outline = 0f;
xmlReader.TryGetFloatValue("//root/Font" + i.ToString() + "/Outline", ref sf.Outline);
sf.OutlineColor = new SColorF(0f, 0f, 0f, 1f);
xmlReader.TryGetFloatValue("//root/Font" + i.ToString() + "/OutlineColorR", ref sf.OutlineColor.R);
xmlReader.TryGetFloatValue("//root/Font" + i.ToString() + "/OutlineColorG", ref sf.OutlineColor.G);
xmlReader.TryGetFloatValue("//root/Font" + i.ToString() + "/OutlineColorB", ref sf.OutlineColor.B);
xmlReader.TryGetFloatValue("//root/Font" + i.ToString() + "/OutlineColorA", ref sf.OutlineColor.A);
_Fonts.Add(sf);
i++;
}
return true;
}
/// <summary>
/// Loads theme fonts from skin file
/// </summary>
public static void LoadThemeFonts(string ThemeName, string FontFolder, CXMLReader xmlReader)
private static void _LoadFontFiles(CXMLReader xmlReader, string FontFolder, string ThemeName = "", int PartyModeId = -1)
{
string value = string.Empty;
int i = 1;
@@ -743,23 +580,22 @@ namespace Vocaluxe.Base
{
SFont sf = new SFont();
sf.Folder = value;
sf.IsThemeFont = true;
sf.IsThemeFont = ThemeName.Length > 0;
sf.ThemeName = ThemeName;
sf.PartyModeID = -1;
sf.PartyModeID = PartyModeId;
bool ok = true;
string name = String.Empty;
ok &= xmlReader.GetValue("//root/Fonts/Font" + i.ToString() + "/Name", ref name, value);
sf.Name = name;
ok &= xmlReader.GetValue("//root/Fonts/Font" + i.ToString() + "/FileNormal", ref value, value);
sf.FileNormal = value;
value = Path.Combine(FontFolder, Path.Combine(sf.Folder, value));
CFont f = new CFont(value);
sf.Normal = f;
string name = String.Empty;
ok &= xmlReader.GetValue("//root/Fonts/Font" + i.ToString() + "/Name", ref name, value);
sf.Name = name;
ok &= xmlReader.GetValue("//root/Fonts/Font" + i.ToString() + "/FileItalic", ref value, value);
sf.FileItalic = value;
value = Path.Combine(FontFolder, Path.Combine(sf.Folder, value));
@@ -791,11 +627,52 @@ namespace Vocaluxe.Base
_Fonts.Add(sf);
else
{
CLog.LogError("Error loading theme fonts for theme \"" + ThemeName + "\": Error in Font" + i.ToString());
string fontTypes;
if (PartyModeId >= 0)
fontTypes = "theme fonts for party mode";
else if (ThemeName.Length > 0)
fontTypes = "theme fonts for theme \"" + ThemeName + "\"";
else
fontTypes = "basic fonts";
CLog.LogError("Error loading " + fontTypes + ": Error in Font" + i.ToString());
}
i++;
}
}
/// <summary>
/// Load default fonts
/// </summary>
/// <returns></returns>
private static bool LoadFontList()
{
CXMLReader xmlReader = CXMLReader.OpenFile(Path.Combine(CSettings.sFolderFonts, CSettings.sFileFonts));
if (xmlReader == null)
return false;
_Fonts.Clear();
_LoadFontFiles(xmlReader, Path.Combine(Directory.GetCurrentDirectory(), CSettings.sFolderFonts));
return true;
}
/// <summary>
/// Loads theme fonts from skin file
/// </summary>
public static void LoadThemeFonts(string ThemeName, string FontFolder, CXMLReader xmlReader)
{
_LoadFontFiles(xmlReader, FontFolder, ThemeName);
CLog.StartBenchmark(1, "BuildGlyphs");
BuildGlyphs();
CLog.StopBenchmark(1, "BuildGlyphs");
}
/// <summary>
/// Loads party mode fonts from skin file
/// </summary>
public static void LoadPartyModeFonts(int PartyModeID, string FontFolder, CXMLReader xmlReader)
{
_LoadFontFiles(xmlReader, FontFolder, "", PartyModeID);
CLog.StartBenchmark(1, "BuildGlyphs");
BuildGlyphs();
CLog.StopBenchmark(1, "BuildGlyphs");
@@ -867,78 +744,9 @@ namespace Vocaluxe.Base
}
}
/// <summary>
/// Loads party mode fonts from skin file
/// </summary>
public static void LoadPartyModeFonts(int PartyModeID, string FontFolder, CXMLReader xmlReader)
{
string value = string.Empty;
int i = 1;
while (xmlReader.GetValue("//root/Fonts/Font" + i.ToString() + "/Folder", ref value, value))
{
SFont sf = new SFont();
sf.Folder = value;
sf.IsThemeFont = false;
sf.ThemeName = String.Empty;
sf.PartyModeID = PartyModeID;
bool ok = true;
ok &= xmlReader.GetValue("//root/Fonts/Font" + i.ToString() + "/FileNormal", ref value, value);
sf.FileNormal = value;
value = Path.Combine(FontFolder, Path.Combine(sf.Folder, value));
CFont f = new CFont(value);
sf.Normal = f;
string name = String.Empty;
ok &= xmlReader.GetValue("//root/Fonts/Font" + i.ToString() + "/Name", ref name, value);
sf.Name = name;
ok &= xmlReader.GetValue("//root/Fonts/Font" + i.ToString() + "/FileItalic", ref value, value);
sf.FileItalic = value;
value = Path.Combine(FontFolder, Path.Combine(sf.Folder, value));
f = new CFont(value);
sf.Italic = f;
ok &= xmlReader.GetValue("//root/Fonts/Font" + i.ToString() + "/FileBold", ref value, value);
sf.FileBold = value;
value = Path.Combine(FontFolder, Path.Combine(sf.Folder, value));
f = new CFont(value);
sf.Bold = f;
ok &= xmlReader.GetValue("//root/Fonts/Font" + i.ToString() + "/FileBoldItalic", ref value, value);
sf.FileBoldItalic = value;
value = Path.Combine(FontFolder, Path.Combine(sf.Folder, value));
f = new CFont(value);
sf.BoldItalic = f;
sf.Outline = 0f;
ok &= xmlReader.TryGetFloatValue("//root/Fonts/Font" + i.ToString() + "/Outline", ref sf.Outline);
sf.OutlineColor = new SColorF(0f, 0f, 0f, 1f);
ok &= xmlReader.TryGetFloatValue("//root/Fonts/Font" + i.ToString() + "/OutlineColorR", ref sf.OutlineColor.R);
ok &= xmlReader.TryGetFloatValue("//root/Fonts/Font" + i.ToString() + "/OutlineColorG", ref sf.OutlineColor.G);
ok &= xmlReader.TryGetFloatValue("//root/Fonts/Font" + i.ToString() + "/OutlineColorB", ref sf.OutlineColor.B);
ok &= xmlReader.TryGetFloatValue("//root/Fonts/Font" + i.ToString() + "/OutlineColorA", ref sf.OutlineColor.A);
if (ok)
_Fonts.Add(sf);
else
{
CLog.LogError("Error loading theme fonts for party mode from Folder \"" + FontFolder + "\": Error in Font" + i.ToString());
}
i++;
}
CLog.StartBenchmark(1, "BuildGlyphs");
BuildGlyphs();
CLog.StopBenchmark(1, "BuildGlyphs");
}
private static int GetFontIndex(string ThemeName, string FontName)
{
if (ThemeName == String.Empty || FontName == String.Empty)
if (ThemeName.Length == 0 || FontName.Length == 0)
return -1;
for (int i = 0; i < _Fonts.Count; i++)
@@ -952,7 +760,7 @@ namespace Vocaluxe.Base
private static int GetFontIndexParty(int PartyModeID, string FontName)
{
if (PartyModeID == -1 || FontName == String.Empty)
if (PartyModeID == -1 || FontName.Length == 0)
return -1;
for (int i = 0; i < _Fonts.Count; i++)
@@ -986,7 +794,6 @@ namespace Vocaluxe.Base
}
Style = EStyle.Normal;
SetFont("Normal");
}
}
}
}
+17 -38
View File
@@ -1,14 +1,9 @@
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Text;
using Vocaluxe.GameModes;
using Vocaluxe.Lib.Draw;
using Vocaluxe.Menu;
using Vocaluxe.Menu.SingNotes;
using Vocaluxe.Menu.SongMenu;
using VocaluxeLib.Menu;
using VocaluxeLib.Menu.SingNotes;
using VocaluxeLib.Menu.SongMenu;
namespace Vocaluxe.Base
{
@@ -18,13 +13,13 @@ namespace Vocaluxe.Base
private static SPlayer[] _Player;
private static int _NumPlayer = CConfig.NumPlayer;
private static float _Beat = 0f;
private static int _CurrentBeat = 0;
private static float _Beat;
private static int _CurrentBeat;
private static float _MidBeatD = 0f;
private static int _CurrentBeatD = 0;
private static int _OldBeatD = 0;
private static Random _Rand = new Random();
private static float _MidBeatD;
private static int _CurrentBeatD;
private static int _OldBeatD;
private static readonly Random _Rand = new Random();
public static Random Rand
{
@@ -221,26 +216,23 @@ namespace Vocaluxe.Base
_Beat = b;
_CurrentBeat = (int)Math.Floor(_Beat);
_MidBeatD = -0.5f + GetBeatFromTime(Time, song.BPM, song.Gap + CConfig.MicDelay/1000f);
_MidBeatD = -0.5f + GetBeatFromTime(Time, song.BPM, song.Gap + CConfig.MicDelay / 1000f);
_CurrentBeatD = (int)Math.Floor(_MidBeatD);
for (int p = 0; p < _NumPlayer; p++)
{
CSound.AnalyzeBuffer(p);
}
if (_OldBeatD >= _CurrentBeatD)
return;
for (int p = 0; p < _NumPlayer; p++)
{
for (int beat = _OldBeatD + 1; beat <= _CurrentBeatD; beat++)
{
if ((_GameMode.GetCurrentGameMode() == EGameMode.TR_GAMEMODE_MEDLEY && song.Medley.EndBeat == beat) ||
(_GameMode.GetCurrentGameMode() == EGameMode.TR_GAMEMODE_SHORTSONG && song.ShortEnd == beat))
_Player[p].SongFinished = true;
CLine[] lines = song.Notes.GetLines(_Player[p].LineNr).Line;
int Line = -1;
@@ -261,9 +253,7 @@ namespace Vocaluxe.Base
_Player[p].CurrentLine = Line;
while (_Player[p].SingLine.Count <= Line)
{
_Player[p].SingLine.Add(new CLine());
}
CNote[] notes = lines[Line].Notes;
int Note = -1;
@@ -304,12 +294,13 @@ namespace Vocaluxe.Base
TonePlayer = Tone;
_Player[p].NoteDiff = Math.Abs(Tone - TonePlayer);
bool Hit=_Player[p].NoteDiff <= (2 - (int)_Player[p].Difficulty);
bool Hit = _Player[p].NoteDiff <= (2 - (int)_Player[p].Difficulty);
if (Hit)
{
// valid
//CSound.RecordSetTone(p, Tone);
double points = (CSettings.MaxScore - CSettings.LinebonusScore) * (double)notes[Note].PointsForBeat / (double)song.Notes.GetLines(_Player[p].LineNr).Points;
double points = (CSettings.MaxScore - CSettings.LinebonusScore) * (double)notes[Note].PointsForBeat /
song.Notes.GetLines(_Player[p].LineNr).Points;
if (notes[Note].NoteType == ENoteType.Golden)
_Player[p].PointsGoldenNotes += points;
@@ -322,14 +313,10 @@ namespace Vocaluxe.Base
if (notes[Note].StartBeat == beat || nt.EndBeat + 1 != beat || nt.Tone != Tone || !nt.Hit)
_Player[p].SingLine[Line].AddNote(new CNote(beat, 1, Tone, String.Empty, true, notes[Note].NoteType));
else
{
_Player[p].SingLine[Line].IncLastNoteLength();
}
}
else
{
_Player[p].SingLine[Line].AddNote(new CNote(beat, 1, Tone, String.Empty, true, notes[Note].NoteType));
}
_Player[p].SingLine[Line].LastNote.IsPerfect(notes[Note]);
_Player[p].SingLine[Line].IsPerfect(lines[Line]);
@@ -340,19 +327,12 @@ namespace Vocaluxe.Base
{
CNote nt = _Player[p].SingLine[Line].LastNote;
if (nt.Tone == TonePlayer && nt.EndBeat + 1 == beat && !nt.Hit)
{
_Player[p].SingLine[Line].IncLastNoteLength();
}
else
{
_Player[p].SingLine[Line].AddNote(new CNote(beat, 1, TonePlayer, String.Empty, false, ENoteType.Freestyle));
}
}
else
{
_Player[p].SingLine[Line].AddNote(new CNote(beat, 1, TonePlayer, String.Empty, false, ENoteType.Freestyle));
}
}
}
@@ -362,7 +342,7 @@ namespace Vocaluxe.Base
{
if (notes[Note].EndBeat == beat && lines[Line].Points > 0f)
{
double factor = (double)_Player[p].SingLine[Line].Points / (double)lines[Line].Points;
double factor = _Player[p].SingLine[Line].Points / (double)lines[Line].Points;
if (factor < 0.4)
factor = 0.0;
else if (factor > 0.9)
@@ -374,17 +354,16 @@ namespace Vocaluxe.Base
factor *= factor;
}
double points = CSettings.LinebonusScore * factor * 1f / NumLinesWithPoints;
double points = CSettings.LinebonusScore * factor * 1f / NumLinesWithPoints;
_Player[p].Points += points;
_Player[p].PointsLineBonus += points;
}
}
}
}
}
}
_OldBeatD = _CurrentBeatD;
}
}
}
}
+43 -71
View File
@@ -2,12 +2,10 @@
using System.Collections.Generic;
using System.Diagnostics;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using Vocaluxe.Menu;
using Vocaluxe.PartyModes;
using Vocaluxe.Screens;
using VocaluxeLib.Menu;
using VocaluxeLib.PartyModes;
namespace Vocaluxe.Base
{
@@ -21,19 +19,19 @@ namespace Vocaluxe.Base
class CCursor
{
private Stopwatch _CursorFadingTimer;
private readonly Stopwatch _CursorFadingTimer;
private float _CursorTargetAlpha;
private float _CursorStartAlpha;
private float _CursorFadingTime;
private STexture _Cursor;
private string _CursorName = String.Empty;
private readonly string _CursorName = String.Empty;
private Stopwatch _Movetimer;
private readonly Stopwatch _Movetimer;
public bool ShowCursor;
public bool Visible = true;
public bool CursorVisible = true;
public int X
{
get { return (int)_Cursor.rect.X; }
@@ -162,7 +160,7 @@ namespace Vocaluxe.Base
static class CGraphics
{
private static bool _Fading = false;
private static bool _Fading;
private static Stopwatch _FadingTimer;
private static CCursor _Cursor;
private static float _GlobalAlpha;
@@ -173,11 +171,11 @@ namespace Vocaluxe.Base
private static EScreens _NextScreen;
private static EPopupScreens _CurrentPopupScreen;
private static List<IMenu> _Screens = new List<IMenu>();
private static List<IMenu> _PopupScreens = new List<IMenu>();
private static readonly List<IMenu> _Screens = new List<IMenu>();
private static readonly List<IMenu> _PopupScreens = new List<IMenu>();
private static Stopwatch _VolumePopupTimer;
private static bool CursorOverVolumeControl = false;
private static bool CursorOverVolumeControl;
public static float GlobalAlpha
{
@@ -224,13 +222,13 @@ namespace Vocaluxe.Base
_PopupScreens.Add(new CPopupScreenVolumeControl());
CLog.StopBenchmark(1, "Build Screen List");
_CurrentScreen = EScreens.ScreenLoad;
_NextScreen = EScreens.ScreenNull;
_CurrentPopupScreen = EPopupScreens.NoPopup;
_FadingTimer = new Stopwatch();
_VolumePopupTimer = new Stopwatch();
_GlobalAlpha = 1f;
_ZOffset = 0f;
@@ -251,58 +249,46 @@ namespace Vocaluxe.Base
for (int i = 0; i < _Screens.Count; i++)
{
CLog.StartBenchmark(1, "Load Theme " + Enum.GetNames(typeof(EScreens))[i]);
_Screens[i].Initialize();
_Screens[i].Init();
_Screens[i].LoadTheme(CTheme.GetThemeScreensPath(-1));
CLog.StopBenchmark(1, "Load Theme " + Enum.GetNames(typeof(EScreens))[i]);
}
for (int i = 0; i < _PopupScreens.Count; i++)
{
_PopupScreens[i].Initialize();
{
_PopupScreens[i].Init();
_PopupScreens[i].LoadTheme(CTheme.GetThemeScreensPath(-1));
}
}
}
public static void ReloadTheme()
{
ReloadCursor();
for (int i = 0; i < _Screens.Count; i++)
{
_Screens[i].ReloadTheme(CTheme.GetThemeScreensPath(-1));
}
for (int i = 0; i < _PopupScreens.Count; i++)
{
_PopupScreens[i].ReloadTheme(CTheme.GetThemeScreensPath(-1));
}
}
public static void ReloadSkin()
{
ReloadCursor();
for (int i = 0; i < _Screens.Count; i++)
{
_Screens[i].ReloadTextures();
}
for (int i = 0; i < _PopupScreens.Count; i++)
{
_PopupScreens[i].ReloadTextures();
}
_PopupScreens[i].ReloadTextures();
}
public static void SaveTheme()
{
CTheme.SaveTheme();
for (int i = 0; i < _Screens.Count; i++)
{
_Screens[i].SaveTheme();
}
for (int i = 0; i < _PopupScreens.Count; i++)
{
_PopupScreens[i].SaveTheme();
}
}
public static void InitFirstScreen()
@@ -325,7 +311,7 @@ namespace Vocaluxe.Base
CInput.Update();
if (CConfig.CoverLoading == ECoverLoading.TR_CONFIG_COVERLOADING_DYNAMIC && _CurrentScreen != EScreens.ScreenSing)
CSongs.LoadCover();
CSongs.LoadCover(30, 1);
if (CSettings.GameState != EGameState.EditTheme)
{
@@ -374,8 +360,8 @@ namespace Vocaluxe.Base
float factor = (float)ms / FadeTime;
_GlobalAlpha = 1f;// -factor / 100f;
_ZOffset = CSettings.zFar/2;
_GlobalAlpha = 1f; // -factor / 100f;
_ZOffset = CSettings.zFar / 2;
if (_CurrentScreen == EScreens.ScreenPartyDummy)
{
@@ -407,7 +393,7 @@ namespace Vocaluxe.Base
GC.Collect();
_CurrentScreen = _NextScreen;
_NextScreen = EScreens.ScreenNull;
if(CBackgroundMusic.Playing)
if (CBackgroundMusic.Playing)
CBackgroundMusic.Play();
_Screens[(int)_CurrentScreen].OnShowFinish();
_Screens[(int)_CurrentScreen].ProcessMouseMove(_Cursor.X, _Cursor.Y);
@@ -440,9 +426,7 @@ namespace Vocaluxe.Base
}
for (int i = 0; i < _PopupScreens.Count; i++)
{
_PopupScreens[i].Draw();
}
_Cursor.Draw();
DrawDebugInfos();
@@ -463,10 +447,10 @@ namespace Vocaluxe.Base
}
_Screens[(int)EScreens.ScreenPartyDummy] = scr;
}
_NextScreen = Screen;
}
public static void ShowPopup(EPopupScreens PopupScreen)
{
_PopupScreens[(int)PopupScreen].OnShow();
@@ -492,7 +476,6 @@ namespace Vocaluxe.Base
{
_Cursor.ShowCursor = true;
}
#endregion public methods
#region private stuff
@@ -504,12 +487,13 @@ namespace Vocaluxe.Base
MouseEvent InputMouseEvent = new MouseEvent();
bool PopupPlayerControlAllowed = _CurrentScreen != EScreens.ScreenOptionsRecord && _CurrentScreen != EScreens.ScreenSing &&
(_CurrentScreen != EScreens.ScreenSong || (_CurrentScreen == EScreens.ScreenSong && CSongs.Category == -1 && CConfig.Tabs ==EOffOn.TR_CONFIG_ON))
&& _CurrentScreen != EScreens.ScreenCredits && !CBackgroundMusic.Disabled;
(_CurrentScreen != EScreens.ScreenSong ||
(_CurrentScreen == EScreens.ScreenSong && !CSongs.IsInCategory && CConfig.Tabs == EOffOn.TR_CONFIG_ON))
&& _CurrentScreen != EScreens.ScreenCredits && !CBackgroundMusic.Disabled;
bool PopupVolumeControlAllowed = _CurrentScreen != EScreens.ScreenCredits && _CurrentScreen != EScreens.ScreenOptionsRecord;
//Hide volume control for bg-music if bg-music is disabled
if (PopupVolumeControlAllowed && (_CurrentScreen != EScreens.ScreenSong || (_CurrentScreen == EScreens.ScreenSong && CSongs.Category == -1))
if (PopupVolumeControlAllowed && (_CurrentScreen != EScreens.ScreenSong || (_CurrentScreen == EScreens.ScreenSong && CSongs.Category == -1))
&& _CurrentScreen != EScreens.ScreenSing && CConfig.BackgroundMusic == EOffOn.TR_CONFIG_OFF)
PopupVolumeControlAllowed = false;
@@ -528,7 +512,7 @@ namespace Vocaluxe.Base
CSettings.MouseInactive();
_Cursor.FadeOut();
}
if (PopupPlayerControlAllowed && KeyEvent.Key == Keys.Tab)
{
if (_CurrentPopupScreen == EPopupScreens.NoPopup && CConfig.BackgroundMusic == EOffOn.TR_CONFIG_ON)
@@ -557,15 +541,16 @@ namespace Vocaluxe.Base
int Diff = 0;
if ((KeyEvent.ModSHIFT && (KeyEvent.Key == Keys.Add || KeyEvent.Key == Keys.PageUp)) || (KeyEvent.Sender == ESender.WiiMote && KeyEvent.Key == Keys.Add))
Diff = 5;
else if ((KeyEvent.ModSHIFT && (KeyEvent.Key == Keys.Subtract || KeyEvent.Key == Keys.PageDown)) || (KeyEvent.Sender == ESender.WiiMote && KeyEvent.Key == Keys.Subtract))
else if ((KeyEvent.ModSHIFT && (KeyEvent.Key == Keys.Subtract || KeyEvent.Key == Keys.PageDown)) ||
(KeyEvent.Sender == ESender.WiiMote && KeyEvent.Key == Keys.Subtract))
Diff = -5;
if (Diff != 0)
{
switch (CGraphics.CurrentScreen)
switch (CurrentScreen)
{
case EScreens.ScreenSong:
if (CSongs.Category != -1)
if (CSongs.IsInCategory)
{
CConfig.PreviewMusicVolume += Diff;
_Screens[(int)_CurrentScreen].ApplyVolume();
@@ -601,17 +586,11 @@ namespace Vocaluxe.Base
}
if (KeyEvent.ModSHIFT && (KeyEvent.Key == Keys.F1))
{
CSettings.GameState = EGameState.EditTheme;
}
else if (KeyEvent.ModALT && (KeyEvent.Key == Keys.Enter ))
{
else if (KeyEvent.ModALT && (KeyEvent.Key == Keys.Enter))
CSettings.bFullScreen = !CSettings.bFullScreen;
}
else if (KeyEvent.ModALT && (KeyEvent.Key == Keys.P))
{
CDraw.MakeScreenShot();
}
else
{
if (!_Fading)
@@ -619,7 +598,7 @@ namespace Vocaluxe.Base
bool handled = false;
if (_CurrentPopupScreen != EPopupScreens.NoPopup)
handled = _PopupScreens[(int)_CurrentPopupScreen].HandleInput(KeyEvent);
if (!handled)
Resume &= _Screens[(int)_CurrentScreen].HandleInput(KeyEvent);
}
@@ -644,17 +623,17 @@ namespace Vocaluxe.Base
UpdateMousePosition(MouseEvent.X, MouseEvent.Y);
bool isOverPopupPlayerControl = CHelper.IsInBounds(_PopupScreens[(int)EPopupScreens.PopupPlayerControl].GetScreenArea(), MouseEvent);
bool isOverPopupPlayerControl = CHelper.IsInBounds(_PopupScreens[(int)EPopupScreens.PopupPlayerControl].ScreenArea, MouseEvent);
if (PopupPlayerControlAllowed && isOverPopupPlayerControl)
{
if (_CurrentPopupScreen == EPopupScreens.NoPopup && CConfig.BackgroundMusic == EOffOn.TR_CONFIG_ON)
ShowPopup(EPopupScreens.PopupPlayerControl);
}
if (!isOverPopupPlayerControl && _CurrentPopupScreen == EPopupScreens.PopupPlayerControl)
HidePopup(EPopupScreens.PopupPlayerControl);
bool isOverPopupVolumeControl = CHelper.IsInBounds(_PopupScreens[(int)EPopupScreens.PopupVolumeControl].GetScreenArea(), MouseEvent);
bool isOverPopupVolumeControl = CHelper.IsInBounds(_PopupScreens[(int)EPopupScreens.PopupVolumeControl].ScreenArea, MouseEvent);
if (PopupVolumeControlAllowed && isOverPopupVolumeControl)
{
if (_CurrentPopupScreen == EPopupScreens.NoPopup)
@@ -684,8 +663,8 @@ namespace Vocaluxe.Base
_Screens[(int)_CurrentScreen].ApplyVolume();
if (!handled && !_Fading && (_Cursor.IsActive || MouseEvent.LB || MouseEvent.RB || MouseEvent.MB))
Resume &= _Screens[(int)_CurrentScreen].HandleMouse(MouseEvent);
Resume &= _Screens[(int)_CurrentScreen].HandleMouse(MouseEvent);
if (!EventsAvailable)
InputEventsAvailable = CInput.PollMouseEvent(ref InputMouseEvent);
}
@@ -705,13 +684,9 @@ namespace Vocaluxe.Base
_Screens[(int)_CurrentScreen].NextInteraction();
}
else if (KeyEvent.ModALT && (KeyEvent.Key == Keys.Enter))
{
CSettings.bFullScreen = !CSettings.bFullScreen;
}
else if (KeyEvent.ModALT && (KeyEvent.Key == Keys.P))
{
CDraw.MakeScreenShot();
}
else
{
if (!_Fading)
@@ -724,7 +699,7 @@ namespace Vocaluxe.Base
if (!_Fading)
_Screens[(int)_CurrentScreen].HandleMouseThemeEditor(MouseEvent);
UpdateMousePosition(MouseEvent.X, MouseEvent.Y);
UpdateMousePosition(MouseEvent.X, MouseEvent.Y);
}
return true;
}
@@ -736,16 +711,14 @@ namespace Vocaluxe.Base
private static bool Update()
{
if(_VolumePopupTimer.IsRunning && _VolumePopupTimer.ElapsedMilliseconds >= 1500 && _CurrentPopupScreen == EPopupScreens.PopupVolumeControl)
if (_VolumePopupTimer.IsRunning && _VolumePopupTimer.ElapsedMilliseconds >= 1500 && _CurrentPopupScreen == EPopupScreens.PopupVolumeControl)
{
_VolumePopupTimer.Reset();
HidePopup(EPopupScreens.PopupVolumeControl);
}
if (_VolumePopupTimer.IsRunning)
{
_Cursor.FadeIn();
}
if (_CurrentPopupScreen != EPopupScreens.NoPopup)
_PopupScreens[(int)_CurrentPopupScreen].UpdateGame();
@@ -754,7 +727,6 @@ namespace Vocaluxe.Base
private static void DrawDebugInfos()
{
string txt = String.Empty;
CFonts.Style = EStyle.Normal;
CFonts.SetFont("Normal");
@@ -881,7 +853,7 @@ namespace Vocaluxe.Base
{
_Cursor.UnloadTextures();
if (CTheme.Cursor.color != string.Empty)
if (CTheme.Cursor.color.Length > 0)
{
SColorF color;
color = CTheme.GetColor(CTheme.Cursor.color, -1);
@@ -900,4 +872,4 @@ namespace Vocaluxe.Base
}
#endregion private stuff
}
}
}
+5 -8
View File
@@ -1,16 +1,12 @@
using System;
using System.Collections.Generic;
using System.Text;
using Vocaluxe.Lib.Input;
using Vocaluxe.Lib.Input;
using Vocaluxe.Lib.Input.WiiMote;
using Vocaluxe.Menu;
using VocaluxeLib.Menu;
namespace Vocaluxe.Base
{
static class CInput
{
static IInput _Input;
private static IInput _Input;
public static void Init()
{
@@ -22,6 +18,7 @@ namespace Vocaluxe.Base
public static void Close()
{
_Input.Close();
_Input = null;
}
public static bool Connect()
@@ -59,4 +56,4 @@ namespace Vocaluxe.Base
_Input.SetRumble(Duration);
}
}
}
}
+73 -157
View File
@@ -1,11 +1,9 @@
using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Text;
using System.Xml;
using Vocaluxe.Menu;
using VocaluxeLib.Menu;
namespace Vocaluxe.Base
{
@@ -14,24 +12,24 @@ namespace Vocaluxe.Base
public string Name;
public string LanguageFilePath;
public Hashtable Texts;
public Dictionary<string, string> Texts;
public List<SPartyLanguage> PartyModeTexts;
}
struct SPartyLanguage
{
public int PartyModeID;
public Hashtable Texts;
public Dictionary<string, string> Texts;
}
static class CLanguage
{
private static XmlWriterSettings _settings = new XmlWriterSettings();
private static readonly XmlWriterSettings _settings = new XmlWriterSettings();
private static List<SLanguage> _Languages;
private static int _CurrentLanguage = 0;
private static int _FallbackLanguage = 0;
private static int _CurrentLanguage;
private static int _FallbackLanguage;
public static int Language
public static int LanguageId
{
get { return _CurrentLanguage; }
set
@@ -41,14 +39,17 @@ namespace Vocaluxe.Base
}
}
public static List<string> GetLanguages()
public static string GetLanguageName(int lang)
{
List<string> Languages = new List<string>();
return _Languages[lang].Name;
}
public static string[] GetLanguageNames()
{
string[] Languages = new string[_Languages.Count];
for (int i = 0; i < _Languages.Count; i++)
{
Languages.Add(_Languages[i].Name);
}
Languages[i] = _Languages[i].Name;
return Languages;
}
@@ -57,16 +58,14 @@ namespace Vocaluxe.Base
{
_Languages = new List<SLanguage>();
_settings.Indent = true;
_settings.Encoding = System.Text.Encoding.UTF8;
_settings.Encoding = Encoding.UTF8;
_settings.ConformanceLevel = ConformanceLevel.Document;
List<string> files = new List<string>();
files.AddRange(CHelper.ListFiles(CSettings.sFolderLanguages, "*.xml", true, true));
foreach (string file in files)
{
LoadLanguageFile(file);
}
LoadLanguageFile(file);
}
public static bool SetLanguage(string Language)
@@ -100,128 +99,54 @@ namespace Vocaluxe.Base
if (KeyWord == null)
return "Error";
if (KeyWord.Length < 3)
if (KeyWord.Length < 3 || KeyWord.Substring(0, 3) != "TR_")
return KeyWord;
string tag = KeyWord.Substring(0, 3);
if (tag != "TR_")
return KeyWord;
string result = null;
int PartyModeNr = GetPartyModeNr(PartyModeID, _CurrentLanguage);
string result;
if (PartyModeID != -1)
{
if (PartyModeNr != -1)
{
try
{
result = (string)_Languages[_CurrentLanguage].PartyModeTexts[PartyModeNr].Texts[KeyWord];
}
catch { }
}
int PartyModeNr = GetPartyModeNr(PartyModeID, _CurrentLanguage);
if (PartyModeNr != -1 && _Languages[_CurrentLanguage].PartyModeTexts[PartyModeNr].Texts.TryGetValue(KeyWord, out result))
return result;
if (result == null && (PartyModeNr = GetPartyModeNr(PartyModeID, _FallbackLanguage)) != -1)
{
try
{
result = (string)_Languages[_FallbackLanguage].PartyModeTexts[PartyModeNr].Texts[KeyWord];
}
catch { }
}
PartyModeNr = GetPartyModeNr(PartyModeID, _FallbackLanguage);
if (PartyModeNr != -1 && _Languages[_CurrentLanguage].PartyModeTexts[PartyModeNr].Texts.TryGetValue(KeyWord, out result))
return result;
}
if (_Languages[_CurrentLanguage].Texts.TryGetValue(KeyWord, out result))
return result;
if (_Languages[_FallbackLanguage].Texts.TryGetValue(KeyWord, out result))
return result;
if (result == null)
{
try
{
result = (string)_Languages[_CurrentLanguage].Texts[KeyWord];
}
catch { }
}
if (result == null)
{
// keyword not found, try fallback-language
try
{
result = (string)_Languages[_FallbackLanguage].Texts[KeyWord];
}
catch { }
if (result == null)
return KeyWord;
}
return result;
return KeyWord;
}
public static bool TranslationExists(string KeyWord)
{
return TranslationExists(KeyWord, -1);
}
public static bool TranslationExists(string KeyWord, int PartyModeID)
public static bool TranslationExists(string KeyWord, int PartyModeID = -1)
{
if (KeyWord == null)
return false;
if (KeyWord.Length < 3)
if (KeyWord.Length < 3 || KeyWord.Substring(0, 3) != "TR_")
return false;
string tag = KeyWord.Substring(0, 3);
if (tag != "TR_")
return false;
string result = String.Empty;
int PartyModeNr = GetPartyModeNr(PartyModeID, _CurrentLanguage);
if (PartyModeID != -1)
{
if (PartyModeNr != -1)
{
try
{
result = (string)_Languages[_CurrentLanguage].PartyModeTexts[PartyModeNr].Texts[KeyWord];
}
catch { }
}
int PartyModeNr = GetPartyModeNr(PartyModeID, _CurrentLanguage);
if (PartyModeNr != -1 && _Languages[_CurrentLanguage].PartyModeTexts[PartyModeNr].Texts.ContainsKey(KeyWord))
return true;
if (result == null && (PartyModeNr = GetPartyModeNr(PartyModeID, _FallbackLanguage)) != -1)
{
try
{
result = (string)_Languages[_FallbackLanguage].PartyModeTexts[PartyModeNr].Texts[KeyWord];
}
catch { }
}
PartyModeNr = GetPartyModeNr(PartyModeID, _FallbackLanguage);
if (PartyModeNr != -1 && _Languages[_CurrentLanguage].PartyModeTexts[PartyModeNr].Texts.ContainsKey(KeyWord))
return true;
}
if (_Languages[_CurrentLanguage].Texts.ContainsKey(KeyWord))
return true;
if (_Languages[_FallbackLanguage].Texts.ContainsKey(KeyWord))
return true;
if (result == null)
{
try
{
result = (string)_Languages[_CurrentLanguage].Texts[KeyWord];
}
catch { }
}
if (result == null)
{
// keyword not found, try fallback-language
try
{
result = (string)_Languages[_FallbackLanguage].Texts[KeyWord];
}
catch { }
if (result == null)
return false;
}
return true;
return false;
}
public static bool LoadPartyLanguageFiles(int PartyModeID, string Path)
@@ -237,6 +162,29 @@ namespace Vocaluxe.Base
return true;
}
private static bool _LoadLanguageEntries(CXMLReader xmlReader, ref Dictionary<string, string> Texts)
{
Texts = new Dictionary<string, string>();
List<string> names = xmlReader.GetAttributes("resources", "name");
string value = string.Empty;
foreach (string name in names)
{
if (xmlReader.GetValue("//resources/string[@name='" + name + "']", ref value, ""))
{
try
{
Texts.Add(name, value);
}
catch (Exception e)
{
CLog.LogError("Error reading language file " + xmlReader.FileName + ": " + e.Message);
return false;
}
}
}
return true;
}
private static bool LoadPartyLanguageFile(int PartyModeID, string file)
{
CXMLReader xmlReader = CXMLReader.OpenFile(file);
@@ -253,25 +201,9 @@ namespace Vocaluxe.Base
SPartyLanguage lang = new SPartyLanguage();
lang.PartyModeID = PartyModeID;
lang.Texts = new Hashtable();
if (!_LoadLanguageEntries(xmlReader, ref lang.Texts))
return false;
List<string> texts = xmlReader.GetAttributes("resources", "name");
for (int i = 0; i < texts.Count; i++)
{
if (xmlReader.GetValue("//resources/string[@name='" + texts[i] + "']", ref value, value))
{
try
{
lang.Texts.Add(texts[i], value);
}
catch (Exception e)
{
CLog.LogError("Error reading Party Language File " + file + ": " + e.Message);
return false;
}
}
}
_Languages[nr].PartyModeTexts.Add(lang);
return true;
}
@@ -299,25 +231,9 @@ namespace Vocaluxe.Base
if (lang.Name == CSettings.FallbackLanguage)
_FallbackLanguage = _Languages.Count;
lang.Texts = new Hashtable();
lang.PartyModeTexts = new List<SPartyLanguage>();
List<string> texts = xmlReader.GetAttributes("resources", "name");
for (int i = 0; i < texts.Count; i++)
{
if (xmlReader.GetValue("//resources/string[@name='" + texts[i] + "']", ref value, value))
{
try
{
lang.Texts.Add(texts[i], value);
}
catch (Exception e)
{
CLog.LogError("Error reading Language File " + FileName + ": " + e.Message);
}
}
}
_LoadLanguageEntries(xmlReader, ref lang.Texts);
_Languages.Add(lang);
}
@@ -326,11 +242,11 @@ namespace Vocaluxe.Base
private static int GetPartyModeNr(int PartyModeID, int Language)
{
for (int i = 0; i < _Languages[Language].PartyModeTexts.Count; i++)
{
{
if (_Languages[Language].PartyModeTexts[i].PartyModeID == PartyModeID)
return i;
}
}
return -1;
}
}
}
}
+20 -21
View File
@@ -1,15 +1,14 @@
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Text;
namespace Vocaluxe.Base
{
class Log
class Log : IDisposable
{
private string _LogFileName;
private string _LogName;
private readonly string _LogFileName;
private readonly string _LogName;
private StreamWriter _LogFile;
public Log(string FileName, string LogName)
@@ -27,9 +26,7 @@ namespace Vocaluxe.Base
_LogFile.Flush();
_LogFile.Close();
}
catch (Exception)
{
}
catch (Exception) {}
}
}
@@ -43,9 +40,7 @@ namespace Vocaluxe.Base
_LogFile.WriteLine(Text);
_LogFile.Flush();
}
catch (Exception)
{
}
catch (Exception) {}
}
private void Open()
@@ -56,6 +51,16 @@ namespace Vocaluxe.Base
_LogFile.WriteLine("----------------------------------------");
_LogFile.WriteLine();
}
public void Dispose()
{
if (_LogFile != null)
{
_LogFile.Dispose();
_LogFile = null;
}
GC.SuppressFinalize(this);
}
}
static class CLog
@@ -68,8 +73,8 @@ namespace Vocaluxe.Base
private static int _NumErrors;
private static Stopwatch[] _BenchmarkTimer;
private static double nanosecPerTick = (1000.0 * 1000.0 * 1000.0) / Stopwatch.Frequency;
private static readonly double nanosecPerTick = (1000.0 * 1000.0 * 1000.0) / Stopwatch.Frequency;
public static void Init()
{
_ErrorLog = new Log(CSettings.sFileErrorLog, "ErrorLog");
@@ -79,9 +84,7 @@ namespace Vocaluxe.Base
_NumErrors = 0;
_BenchmarkTimer = new Stopwatch[MAXBenchmarks];
for (int i = 0; i < _BenchmarkTimer.Length; i++)
{
_BenchmarkTimer[i] = new Stopwatch();
}
}
public static void CloseAll()
@@ -119,9 +122,7 @@ namespace Vocaluxe.Base
string space = String.Empty;
for (int i = 0; i < BenchmarkNr; i++)
{
space += " ";
}
space += " ";
_BenchmarkLog.Add(space + "Start " + Text);
_BenchmarkTimer[BenchmarkNr].Start();
@@ -136,15 +137,13 @@ namespace Vocaluxe.Base
string space = String.Empty;
for (int i = 0; i < BenchmarkNr; i++)
{
space += " ";
}
float ms;
if (Stopwatch.IsHighResolution && nanosecPerTick != 0.0)
ms = (float)((nanosecPerTick * _BenchmarkTimer[BenchmarkNr].ElapsedTicks) / (1000.0 * 1000.0));
else
ms = (float)_BenchmarkTimer[BenchmarkNr].ElapsedMilliseconds;
ms = _BenchmarkTimer[BenchmarkNr].ElapsedMilliseconds;
_BenchmarkLog.Add(space + "Stop " + Text + ", Elapsed Time: " + ms.ToString("0.000") + "ms");
_BenchmarkLog.Add(String.Empty);
@@ -152,4 +151,4 @@ namespace Vocaluxe.Base
}
#endregion LogBenchmark
}
}
}
+12 -34
View File
@@ -1,11 +1,8 @@
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Text;
using Vocaluxe.GameModes;
using Vocaluxe.Menu;
using Vocaluxe.Menu.SongMenu;
using VocaluxeLib.Menu;
using VocaluxeLib.Menu.SongMenu;
namespace Vocaluxe.Base
{
@@ -35,7 +32,7 @@ namespace Vocaluxe.Base
public static void Init()
{
CBase.Assign(Config, Settings, Theme, Helper, Log, BackgroundMusic, Draw, Graphics, Fonts, Language,
Game, Profiles, Record, Songs, Video, Sound, Cover, DataBase, Input, Playlist);
Game, Profiles, Record, Songs, Video, Sound, Cover, DataBase, Input, Playlist);
}
}
@@ -247,9 +244,9 @@ namespace Vocaluxe.Base
return CTheme.GetColor(ColorName, PartyModeID);
}
public bool GetColor(string ColorName, int SkinIndex, ref SColorF Color)
public bool GetColor(string ColorName, int SkinIndex, out SColorF Color)
{
return CTheme.GetColor(ColorName, SkinIndex, ref Color);
return CTheme.GetColor(ColorName, SkinIndex, out Color);
}
public SColorF GetPlayerColor(int PlayerNr)
@@ -276,12 +273,9 @@ namespace Vocaluxe.Base
{
CTheme.LoadTheme();
}
}
class BHelper : IHelper
{
}
class BHelper : IHelper {}
class BBackgroundMusic : IBackgroundMusic
{
@@ -330,7 +324,6 @@ namespace Vocaluxe.Base
CBackgroundMusic.Play();
}
public void ApplyVolume()
{
CBackgroundMusic.ApplyVolume();
@@ -585,12 +578,12 @@ namespace Vocaluxe.Base
public EOffOn GetTabs()
{
return CSongs.Tabs;
return CSongs.Categorizer.Tabs;
}
public string GetSearchFilter()
{
return CSongs.SearchFilter;
return CSongs.Filter.SearchString;
}
public void SetCategory(int CategoryIndex)
@@ -605,23 +598,11 @@ namespace Vocaluxe.Base
public CSong GetVisibleSong(int VisibleIndex)
{
if (VisibleIndex >= CSongs.NumVisibleSongs)
return null;
CSong song = CSongs.VisibleSongs[VisibleIndex];
//Flamefire: Why copy the song-instance??? Cover and stuff will be loaded twice!
//And for unknown reason causes no-big-cover bug if covers are not loaded on startup
return song;
//if (song == null)
// return null;
//return new CSong(song);
return CSongs.GetVisibleSongByIndex(VisibleIndex);
}
public CSong GetSongByID(int SongID)
{
//Flamefire: Why copy?
//return new CSong(CSongs.GetSong(SongID));
return CSongs.GetSong(SongID);
}
@@ -658,9 +639,9 @@ namespace Vocaluxe.Base
CSongs.ResetPartySongSung(CatIndex);
}
public void SortSongs(ESongSorting Sorting, EOffOn Tabs, EOffOn IgnoreArticles, String SearchString, bool ShowDuetSongs)
public void SortSongs(ESongSorting Sorting, EOffOn Tabs, EOffOn IgnoreArticles, String SearchString, EDuetOptions DuetOptions)
{
CSongs.Sort(Sorting, Tabs, IgnoreArticles, SearchString, ShowDuetSongs);
CSongs.Sort(Sorting, Tabs, IgnoreArticles, SearchString, DuetOptions);
}
public void NextCategory()
@@ -700,7 +681,6 @@ namespace Vocaluxe.Base
{
return CVideo.VdClose(VideoStream);
}
}
class BSound : ISound
@@ -812,8 +792,6 @@ namespace Vocaluxe.Base
return CPlaylists.NumPlaylists;
}
public void AddPlaylistSong(int PlaylistID, int SongID)
{
CPlaylists.AddPlaylistSong(PlaylistID, SongID);
@@ -859,4 +837,4 @@ namespace Vocaluxe.Base
return CPlaylists.GetPlaylistSong(PlaylistID, SongIndex);
}
}
}
}
+21
View File
@@ -0,0 +1,21 @@
using System;
namespace Vocaluxe.Base
{
class CObservable
{
public event EventHandler ObjectChanged = delegate { };
protected bool _Changed = true;
protected void NotifyObservers()
{
ObjectChanged.Invoke(this, null);
}
protected void _SetChanged()
{
_Changed = true;
NotifyObservers();
}
}
}
+35 -41
View File
@@ -3,13 +3,12 @@ using System.CodeDom.Compiler;
using System.Collections.Generic;
using System.IO;
using System.Reflection;
using System.Text;
using Vocaluxe.Menu;
using Vocaluxe.PartyModes;
using VocaluxeLib.Menu;
using VocaluxeLib.PartyModes;
namespace Vocaluxe.Base
{
#region Structs
struct SPartyMode
{
@@ -29,10 +28,9 @@ namespace Vocaluxe.Base
}
#endregion Structs
static class CParty
{
const int PartyModeSystemVersion = 1;
private const int PartyModeSystemVersion = 1;
private static Dictionary<int, SPartyMode> _PartyModes;
private static Queue<int> _IDs;
@@ -83,7 +81,7 @@ namespace Vocaluxe.Base
{
List<SPartyModeInfos> infos = new List<SPartyModeInfos>();
int[] UsedKeys = new int[_PartyModes.Count];
int[] UsedKeys = new int[_PartyModes.Count];
_PartyModes.Keys.CopyTo(UsedKeys, 0);
for (int i = 0; i < UsedKeys.Length; i++)
@@ -117,7 +115,7 @@ namespace Vocaluxe.Base
}
return infos;
}
public static void SetNormalGameMode()
{
CSongs.ResetPartySongSung();
@@ -166,7 +164,7 @@ namespace Vocaluxe.Base
public static void OnCategoryChange(int CategoryIndex, ref ScreenSongOptions ScreenSongOptions)
{
_CurrentPartyMode.PartyMode.OnCategoryChange(CategoryIndex, ref ScreenSongOptions);
_CurrentPartyMode.PartyMode.OnCategoryChange(CategoryIndex, ref ScreenSongOptions);
}
public static void SetSearchString(string SearchString, bool Visible)
@@ -215,7 +213,7 @@ namespace Vocaluxe.Base
private static SPartyMode LoadPartyMode(string file)
{
SPartyMode pm = new SPartyMode();
SPartyMode pm = new SPartyMode();
pm.PartyModeID = _IDs.Dequeue();
pm.ScreenFiles = new List<string>();
pm.NoErrors = false;
@@ -228,7 +226,7 @@ namespace Vocaluxe.Base
bool loaded = true;
loaded &= xmlReader.TryGetIntValue("//root/PartyModeSystemVersion", ref pm.PartyModeSystemVersion);
loaded &= xmlReader.TryGetIntValue("//root/PartyModeSystemVersion", ref pm.PartyModeSystemVersion);
loaded &= xmlReader.GetValue("//root/Info/Name", ref pm.Name, "ERROR Name");
loaded &= xmlReader.GetValue("//root/Info/Description", ref pm.Description, "ERROR Description");
loaded &= xmlReader.GetValue("//root/Info/Author", ref pm.Author, "ERROR Author");
@@ -261,7 +259,7 @@ namespace Vocaluxe.Base
List<string> FilesToCompile = new List<string>();
FilesToCompile.AddRange(CHelper.ListFiles(PathToCode, "*.cs", false, true));
Assembly Output = CompileFiles(FilesToCompile.ToArray());
if (Output == null)
return pm;
@@ -272,7 +270,7 @@ namespace Vocaluxe.Base
return pm;
}
object Instance = Output.CreateInstance("Vocaluxe.PartyModes." + pm.PartyModeFile);
object Instance = Output.CreateInstance(typeof(IPartyMode).Namespace + "." + pm.Folder + "." + pm.PartyModeFile);
if (Instance == null)
{
CLog.LogError("Error creating Instance of PartyMode file: " + file);
@@ -306,15 +304,11 @@ namespace Vocaluxe.Base
foreach (string screenfile in pm.ScreenFiles)
{
string XmlPath = Path.Combine(Path.Combine(CSettings.sFolderPartyModes, pm.Folder), CSettings.sFolderPartyModeScreens);
CMenuParty Screen = GetPartyScreenInstance(
Output,
screenfile,
Path.Combine(Path.Combine(CSettings.sFolderPartyModes, pm.Folder), CSettings.sFolderPartyModeScreens)
);
CMenuParty Screen = GetPartyScreenInstance(Output, screenfile, pm.Folder);
if (Screen != null)
{
Screen.Initialize();
Screen.Init();
Screen.AssingPartyMode(pm.PartyMode);
Screen.SetPartyModeID(pm.PartyModeID);
Screen.LoadTheme(XmlPath);
@@ -344,36 +338,36 @@ namespace Vocaluxe.Base
Params.IncludeDebugInformation = true;
#endif
CodeDomProvider CDP = CodeDomProvider.CreateProvider("CSharp");
CompilerResults CompileResult = null;
using (CodeDomProvider CDP = CodeDomProvider.CreateProvider("CSharp"))
{
CompilerResults CompileResult = null;
try
{
CompileResult = CDP.CompileAssemblyFromFile(Params, files);
}
catch (Exception e)
{
CLog.LogError("Error Compiling Source (" + CHelper.ListStrings(files) + "): " + e.Message);
return null;
}
if (CompileResult.Errors.Count > 0)
{
for (int i = 0; i < CompileResult.Errors.Count; i++)
try
{
CLog.LogError("Error Compiling Source (" + CHelper.ListStrings(files) + "): " + CompileResult.Errors[i].ErrorText);
}
return null;
CompileResult = CDP.CompileAssemblyFromFile(Params, files);
}
catch (Exception e)
{
CLog.LogError("Error Compiling Source (" + CHelper.ListStrings(files) + "): " + e.Message);
return null;
}
if (CompileResult.Errors.Count > 0)
{
foreach (CompilerError e in CompileResult.Errors)
CLog.LogError("Error Compiling Source (" + CHelper.ListStrings(files) + "): " + e.ErrorText + " in '" + e.FileName + "' (" + e.Line + ")");
return null;
}
return CompileResult.CompiledAssembly;
}
return CompileResult.CompiledAssembly;
}
private static CMenuParty GetPartyScreenInstance(Assembly Assembly, string ScreenName, string XmlPath)
private static CMenuParty GetPartyScreenInstance(Assembly Assembly, string ScreenName, string partyModeName)
{
if (Assembly == null)
return null;
object Instance = Assembly.CreateInstance("Vocaluxe.PartyModes." + ScreenName);
object Instance = Assembly.CreateInstance(typeof(IPartyMode).Namespace + "." + partyModeName + "." + ScreenName);
if (Instance == null)
{
CLog.LogError("Error creating Instance of PartyScreen: " + ScreenName);
@@ -394,4 +388,4 @@ namespace Vocaluxe.Base
}
#endregion private stuff
}
}
}
+35 -48
View File
@@ -2,16 +2,12 @@
using System.Collections.Generic;
using System.IO;
using System.Text;
using System.Text.RegularExpressions;
using Vocaluxe.Lib.Playlist;
using Vocaluxe.GameModes;
using Vocaluxe.Menu;
using Vocaluxe.Menu.SongMenu;
using VocaluxeLib.Menu;
using VocaluxeLib.Menu.SongMenu;
namespace Vocaluxe.Base
{
static class CPlaylists
{
private static List<CPlaylistFile> _Playlists;
@@ -23,13 +19,11 @@ namespace Vocaluxe.Base
public static string[] PlaylistNames
{
get
get
{
List<string> names = new List<string>();
for (int i = 0; i < _Playlists.Count; i++)
{
for (int i = 0; i < _Playlists.Count; i++)
names.Add(_Playlists[i].PlaylistName);
}
return names.ToArray();
}
}
@@ -86,9 +80,7 @@ namespace Vocaluxe.Base
List<string> result = new List<string>();
foreach (CPlaylistFile playlist in _Playlists)
{
result.Add(playlist.PlaylistName);
}
result.Add(playlist.PlaylistName);
return result.ToArray();
}
@@ -105,7 +97,7 @@ namespace Vocaluxe.Base
{
if (PlaylistID < 0 || PlaylistID >= _Playlists.Count)
return;
if (_Playlists[PlaylistID].PlaylistFile != String.Empty)
if (_Playlists[PlaylistID].PlaylistFile.Length > 0)
{
try
{
@@ -131,11 +123,9 @@ namespace Vocaluxe.Base
CPlaylistFile pl = new CPlaylistFile();
pl.PlaylistName = "New Playlist";
_Playlists.Add(pl);
return (_Playlists.Count - 1);
return _Playlists.Count - 1;
}
public static void AddPlaylistSong(int PlaylistID, int SongID)
{
if (PlaylistID >= _Playlists.Count || PlaylistID < 0)
@@ -232,56 +222,53 @@ namespace Vocaluxe.Base
StreamReader sr;
try
{
sr = new StreamReader(file, Encoding.Default, true);
int pos = -1;
string line;
while((line = sr.ReadLine()) != null)
using (sr = new StreamReader(file, Encoding.Default, true))
{
pos = line.IndexOf(":");
if (pos > 0)
int pos = -1;
string line;
while ((line = sr.ReadLine()) != null)
{
//Name or comment
if (line[0] == '#')
pos = line.IndexOf(":");
if (pos > 0)
{
string Identifier = line.Substring(1, pos - 1).Trim();
string Value = line.Substring(pos + 1, line.Length - pos - 1).Trim();
if (Identifier.ToUpper() == "NAME")
//Name or comment
if (line[0] == '#')
{
pl.PlaylistName = Value;
string Identifier = line.Substring(1, pos - 1).Trim();
string Value = line.Substring(pos + 1, line.Length - pos - 1).Trim();
if (Identifier.ToUpper() == "NAME")
pl.PlaylistName = Value;
}
}
//Song
else
{
string Artist = line.Substring(0, pos - 1).Trim();
string Title = line.Substring(pos + 1, line.Length - pos - 1).Trim();
bool found = false;
for (int s = 0; s < AllSongs.Length; s++)
//Song
else
{
if (AllSongs[s].Artist == Artist && AllSongs[s].Title == Title)
string Artist = line.Substring(0, pos - 1).Trim();
string Title = line.Substring(pos + 1, line.Length - pos - 1).Trim();
bool found = false;
for (int s = 0; s < AllSongs.Length; s++)
{
pl.AddSong(AllSongs[s].ID);
found = true;
break;
if (AllSongs[s].Artist == Artist && AllSongs[s].Title == Title)
{
pl.AddSong(AllSongs[s].ID);
found = true;
break;
}
}
if (!found)
CLog.LogError("Can't find song '" + Title + "' from '" + Artist + "' in playlist file: " + file);
}
if (!found)
CLog.LogError("Can't find song '" + Title + "' from '" + Artist + "' in playlist file: " + file);
}
}
}
sr.Close();
File.Delete(file);
}
catch
{
return null;
}
}
return pl;
}
#endregion
}
}
}
+40 -52
View File
@@ -3,17 +3,15 @@ using System.Collections.Generic;
using System.IO;
using System.Text;
using System.Xml;
using Vocaluxe.Lib.Draw;
using Vocaluxe.Menu;
using VocaluxeLib.Menu;
namespace Vocaluxe.Base
{
{
static class CProfiles
{
private static XmlWriterSettings _settings = new XmlWriterSettings();
private static readonly XmlWriterSettings _settings = new XmlWriterSettings();
private static List<SProfile> _Profiles;
private static List<SAvatar> _Avatars = new List<SAvatar>();
private static readonly List<SAvatar> _Avatars = new List<SAvatar>();
public static SProfile[] Profiles
{
@@ -34,11 +32,11 @@ namespace Vocaluxe.Base
{
get { return _Avatars.Count; }
}
public static void Init()
{
_settings.Indent = true;
_settings.Encoding = System.Text.Encoding.UTF8;
_settings.Encoding = Encoding.UTF8;
_settings.ConformanceLevel = ConformanceLevel.Document;
LoadAvatars();
@@ -59,15 +57,15 @@ namespace Vocaluxe.Base
profile.Avatar = new SAvatar(-1);
profile.GuestProfile = EOffOn.TR_CONFIG_OFF;
profile.Active = EOffOn.TR_CONFIG_ON;
if (FileName != String.Empty)
if (FileName.Length > 0)
profile.ProfileFile = Path.Combine(CSettings.sFolderProfiles, FileName);
else
profile.ProfileFile = String.Empty;
if (File.Exists(profile.ProfileFile))
return -1;
_Profiles.Add(profile);
return _Profiles.Count - 1;
}
@@ -75,9 +73,7 @@ namespace Vocaluxe.Base
public static void SaveProfiles()
{
for (int i = 0; i < _Profiles.Count; i++)
{
SaveProfile(i);
}
LoadProfiles();
}
@@ -88,9 +84,7 @@ namespace Vocaluxe.Base
files.AddRange(CHelper.ListFiles(CSettings.sFolderProfiles, "*.xml", true, true));
foreach (string file in files)
{
LoadProfile(file);
}
SortProfilesByName();
}
@@ -213,7 +207,7 @@ namespace Vocaluxe.Base
public static bool IsGuestProfile(int ProfileNr)
{
if (ProfileNr < 0 || ProfileNr >= _Profiles.Count)
return true; // this will prevent from saving dummy profiles to highscore db
return true; // this will prevent from saving dummy profiles to highscore db
return _Profiles[ProfileNr].GuestProfile == EOffOn.TR_CONFIG_ON;
}
@@ -253,7 +247,7 @@ namespace Vocaluxe.Base
{
if (ProfileID < 0 || ProfileID >= _Profiles.Count)
return;
if (_Profiles[ProfileID].ProfileFile != String.Empty)
if (_Profiles[ProfileID].ProfileFile.Length > 0)
{
try
{
@@ -293,7 +287,7 @@ namespace Vocaluxe.Base
if (ProfileID < 0 || ProfileID >= _Profiles.Count)
return;
if (_Profiles[ProfileID].ProfileFile == String.Empty)
if (_Profiles[ProfileID].ProfileFile.Length == 0)
{
string filename = string.Empty;
foreach (char chr in _Profiles[ProfileID].PlayerName)
@@ -302,17 +296,15 @@ namespace Vocaluxe.Base
filename += chr.ToString();
}
if (filename == String.Empty)
if (filename.Length == 0)
filename = "1";
int i = 0;
while(File.Exists(Path.Combine(CSettings.sFolderProfiles, filename + ".xml")))
while (File.Exists(Path.Combine(CSettings.sFolderProfiles, filename + ".xml")))
{
i++;
if(!File.Exists(Path.Combine(CSettings.sFolderProfiles, filename + i + ".xml")))
{
if (!File.Exists(Path.Combine(CSettings.sFolderProfiles, filename + i + ".xml")))
filename += i;
}
}
SProfile profile = _Profiles[ProfileID];
@@ -330,29 +322,29 @@ namespace Vocaluxe.Base
CLog.LogError("Error creating/opening Profile File " + _Profiles[ProfileID].ProfileFile + ": " + e.Message);
return;
}
if (writer == null)
try
{
CLog.LogError("Error creating/opening Profile File " + _Profiles[ProfileID].ProfileFile);
return;
writer.WriteStartDocument();
writer.WriteStartElement("root");
writer.WriteStartElement("Info");
writer.WriteElementString("PlayerName", _Profiles[ProfileID].PlayerName);
writer.WriteElementString("Difficulty", Enum.GetName(typeof(EGameDifficulty), _Profiles[ProfileID].Difficulty));
writer.WriteElementString("Avatar", _Profiles[ProfileID].Avatar.FileName);
writer.WriteElementString("GuestProfile", Enum.GetName(typeof(EOffOn), _Profiles[ProfileID].GuestProfile));
writer.WriteElementString("Active", Enum.GetName(typeof(EOffOn), _Profiles[ProfileID].Active));
writer.WriteEndElement();
writer.WriteEndElement(); //end of root
writer.WriteEndDocument();
writer.Flush();
}
finally
{
writer.Close();
writer = null;
}
writer.WriteStartDocument();
writer.WriteStartElement("root");
writer.WriteStartElement("Info");
writer.WriteElementString("PlayerName", _Profiles[ProfileID].PlayerName);
writer.WriteElementString("Difficulty", Enum.GetName(typeof(EGameDifficulty), _Profiles[ProfileID].Difficulty));
writer.WriteElementString("Avatar", _Profiles[ProfileID].Avatar.FileName);
writer.WriteElementString("GuestProfile", Enum.GetName(typeof(EOffOn), _Profiles[ProfileID].GuestProfile));
writer.WriteElementString("Active", Enum.GetName(typeof(EOffOn), _Profiles[ProfileID].Active));
writer.WriteEndElement();
writer.WriteEndElement(); //end of root
writer.WriteEndDocument();
writer.Flush();
writer.Close();
}
private static void LoadProfile(string FileName)
@@ -370,27 +362,23 @@ namespace Vocaluxe.Base
profile.PlayerName = value;
profile.Difficulty = EGameDifficulty.TR_CONFIG_EASY;
xmlReader.TryGetEnumValue<EGameDifficulty>("//root/Info/Difficulty", ref profile.Difficulty);
xmlReader.TryGetEnumValue("//root/Info/Difficulty", ref profile.Difficulty);
profile.Avatar = new SAvatar(-1);
if (xmlReader.GetValue("//root/Info/Avatar", ref value, value))
{
profile.Avatar = GetAvatar(value);
}
profile.GuestProfile = EOffOn.TR_CONFIG_OFF;
xmlReader.TryGetEnumValue<EOffOn>("//root/Info/GuestProfile", ref profile.GuestProfile);
xmlReader.TryGetEnumValue("//root/Info/GuestProfile", ref profile.GuestProfile);
profile.Active = EOffOn.TR_CONFIG_ON;
xmlReader.TryGetEnumValue<EOffOn>("//root/Info/Active", ref profile.Active);
xmlReader.TryGetEnumValue("//root/Info/Active", ref profile.Active);
_Profiles.Add(profile);
}
else
{
CLog.LogError("Can't find PlayerName in Profile File: " + FileName);
}
}
#endregion private methods
}
}
}
+22 -25
View File
@@ -1,9 +1,7 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Text;
using Vocaluxe.Menu;
using VocaluxeLib.Menu;
namespace Vocaluxe.Base
{
@@ -31,23 +29,21 @@ namespace Vocaluxe.Base
public const EArch ARCH = EArch.x64;
#endif
public static EGameState GameState = EGameState.Start;
public const string sProgramName = "Vocaluxe";
public const string sProgramCodeName = "Shining Heaven";
public const int iVersionMajor = 0;
public const int iVersionMinor = 3; // milestones
public const int iVersionSub = 0; // patches
public const int iVersionMinor = 3; // milestones
public const int iVersionSub = 0; // patches
public const ERevision VersionRevision = ERevision.Alpha;
public const int iBuild = 76; // Increase on every published version! Never Reset!
public const int iBuild = 76; // Increase on every published version! Never Reset!
public const int iDatabaseHighscoreVersion = 2;
public const int iDatabaseCoverVersion = 1;
public const int iDatabaseCreditsRessourcesVersion = 1;
public static int iRenderW = 1280;
public static int iRenderH = 720;
@@ -91,7 +87,6 @@ namespace Vocaluxe.Base
public const string sFolderBackgroundMusic = "BackgroundMusic";
public static string sFolderPlaylists = "Playlists";
public static string sFolderPartyModes = "PartyModes";
public const string sFolderPartyModeCode = "Code";
public const string sFolderPartyModeScreens = "Screens";
@@ -105,7 +100,7 @@ namespace Vocaluxe.Base
public const int NumNoteLines = 11;
public static int MouseMoveDiffMin = 2;
public const float MouseMoveOffTime = 3f;
public const int MaxNumPlayer = 6;
public const int MaxScore = 10000;
public const int LinebonusScore = 1000;
@@ -124,17 +119,20 @@ namespace Vocaluxe.Base
public const float BackgroundMusicFadeTime = 0.5f;
public static List<string> MusicFileTypes = new List<string>()
{
"*.mp3","*.wma","*.ogg","*.wav"
};
public static List<string> MusicFileTypes = new List<string>
{
"*.mp3",
"*.wma",
"*.ogg",
"*.wav"
};
public static string GetVersionText()
{
string sVersion = "v" + iVersionMajor.ToString() + "." +
iVersionMinor.ToString() + "." +
iVersionSub.ToString() + " (" + Enum.GetName(typeof(EArch), ARCH) + ")";
iVersionMinor.ToString() + "." +
iVersionSub.ToString() + " (" + Enum.GetName(typeof(EArch), ARCH) + ")";
if (VersionRevision != ERevision.Release)
sVersion += " " + GetVersionStatus() + String.Format(" ({0:0000)}", iBuild);
@@ -145,7 +143,7 @@ namespace Vocaluxe.Base
{
string sVersion = sProgramName;
if (sProgramCodeName != String.Empty)
if (sProgramCodeName.Length > 0)
sVersion += " \"" + sProgramCodeName + "\"";
return sVersion += " " + GetVersionText();
@@ -163,7 +161,7 @@ namespace Vocaluxe.Base
public static float GetRenderAspect()
{
return (float)iRenderW / (float)iRenderH;
return iRenderW / (float)iRenderH;
}
public static void MouseInactive()
@@ -192,15 +190,14 @@ namespace Vocaluxe.Base
foreach (string folder in Folders)
{
string path = Path.Combine(Environment.CurrentDirectory, folder);
if (!Directory.Exists(path))
Directory.CreateDirectory(path);
}
CreateFolder(path);
}
}
public static void CreateFolder(string path)
{
if (!Directory.Exists(path))
Directory.CreateDirectory(path);
Directory.CreateDirectory(path);
}
}
}
}
+171
View File
@@ -0,0 +1,171 @@
using System;
using System.Collections.Generic;
using System.Text;
using VocaluxeLib.Menu;
using VocaluxeLib.Menu.SongMenu;
namespace Vocaluxe.Base
{
class CSongCategorizer : CObservable
{
private readonly List<CCategory> _Categories = new List<CCategory>();
private EOffOn _Tabs = CConfig.Tabs;
public CSongCategorizer()
{
CSongs.Filter.ObjectChanged += HandleSortedSongsChanged;
}
public List<CCategory> Categories
{
get
{
_FillCategories();
return _Categories;
}
}
public EOffOn Tabs
{
get { return _Tabs; }
set
{
if (value != _Tabs)
{
_Tabs = value;
_SetChanged();
}
}
}
private void HandleSortedSongsChanged(object sender, EventArgs args)
{
_SetChanged();
}
private void _CreateCategoriesLetter()
{
string category = "";
int NotLetterCat = -1;
for (int i = 0; i < CSongs.Sorter.SortedSongs.Length; i++)
{
Char firstLetter = Char.ToUpper(CSongs.Sorter.SortedSongs[i].SortString.Normalize(NormalizationForm.FormD)[0]);
if (!Char.IsLetter(firstLetter))
firstLetter = '#';
if (firstLetter.ToString() != category)
{
if (firstLetter != '#' || NotLetterCat == -1)
{
category = firstLetter.ToString();
_Categories.Add(new CCategory(category));
CSongs.Sorter.SortedSongs[i].CatIndex = _Categories.Count - 1;
if (firstLetter == '#')
NotLetterCat = CSongs.Sorter.SortedSongs[i].CatIndex;
}
else
CSongs.Sorter.SortedSongs[i].CatIndex = NotLetterCat;
}
else
CSongs.Sorter.SortedSongs[i].CatIndex = _Categories.Count - 1;
}
}
private void _CreateCategoriesNormal(string NoCategoryName)
{
string category = "";
int NoCategoryIndex = -1;
for (int i = 0; i < CSongs.Sorter.SortedSongs.Length; i++)
{
if (CSongs.Sorter.SortedSongs[i].SortString.Length > 0)
{
if (CSongs.Sorter.SortedSongs[i].SortString != category)
{
category = CSongs.Sorter.SortedSongs[i].SortString;
_Categories.Add(new CCategory(category));
}
CSongs.Sorter.SortedSongs[i].CatIndex = _Categories.Count - 1;
}
else
{
if (NoCategoryIndex < 0)
{
category = NoCategoryName;
_Categories.Add(new CCategory(category));
NoCategoryIndex = _Categories.Count - 1;
}
CSongs.Sorter.SortedSongs[i].CatIndex = NoCategoryIndex;
}
}
}
private void _CreateCategories()
{
string NoCategoryName = "";
ESongSorting Sorting = CSongs.Sorter.SongSorting;
switch (Sorting)
{
case ESongSorting.TR_CONFIG_EDITION:
NoCategoryName = CLanguage.Translate("TR_SCREENSONG_NOEDITION");
break;
case ESongSorting.TR_CONFIG_GENRE:
NoCategoryName = CLanguage.Translate("TR_SCREENSONG_NOGENRE");
break;
case ESongSorting.TR_CONFIG_DECADE:
case ESongSorting.TR_CONFIG_YEAR:
NoCategoryName = CLanguage.Translate("TR_SCREENSONG_NOYEAR");
break;
case ESongSorting.TR_CONFIG_LANGUAGE:
NoCategoryName = CLanguage.Translate("TR_SCREENSONG_NOLANGUAGE");
break;
case ESongSorting.TR_CONFIG_NONE:
NoCategoryName = CLanguage.Translate("TR_SCREENSONG_ALLSONGS");
break;
}
if (Sorting == ESongSorting.TR_CONFIG_ARTIST_LETTER || Sorting == ESongSorting.TR_CONFIG_TITLE_LETTER)
_CreateCategoriesLetter();
else
{
if (Sorting == ESongSorting.TR_CONFIG_DECADE)
{
for (int i = 0; i < CSongs.Sorter.SortedSongs.Length; i++)
{
string Year = CSongs.Sorter.SortedSongs[i].SortString;
if (Year.Length > 0)
{
Year = Year.Substring(0, 3);
CSongs.Sorter.SortedSongs[i].SortString = Year + "0 - " + Year + "9";
}
}
}
_CreateCategoriesNormal(NoCategoryName);
}
}
private void _FillCategories()
{
if (!_Changed)
return;
_Categories.Clear();
if (_Tabs == EOffOn.TR_CONFIG_OFF)
{
//No categories. So don't create them!
_Categories.Add(new CCategory(""));
for (int i = 0; i < CSongs.Sorter.SortedSongs.Length; i++)
CSongs.Sorter.SortedSongs[i].CatIndex = 0;
}
else
_CreateCategories();
foreach (CCategory cat in _Categories)
cat.CoverTextureSmall = CCover.Cover(cat.Name);
_Changed = false;
}
}
}
+93
View File
@@ -0,0 +1,93 @@
using System;
using System.Collections.Generic;
using VocaluxeLib.Menu;
using VocaluxeLib.Menu.SongMenu;
namespace Vocaluxe.Base
{
class CSongFilter : CObservable
{
private readonly List<CSong> _FilteredSongs = new List<CSong>();
private String _SearchString = String.Empty;
private EDuetOptions _DuetOptions = EDuetOptions.All;
public List<CSong> FilteredSongs
{
get
{
_FilterSongs();
return _FilteredSongs;
}
}
public String SearchString
{
get { return _SearchString; }
set
{
if (value != _SearchString)
{
_SetChanged();
_SearchString = value;
}
}
}
public EDuetOptions DuetOptions
{
get { return _DuetOptions; }
set
{
if (value != _DuetOptions)
{
_SetChanged();
_DuetOptions = value;
}
}
}
public void SetOptions(String searchString, EDuetOptions duetOptions)
{
if (searchString != _SearchString || duetOptions != _DuetOptions)
{
_SearchString = searchString;
_DuetOptions = duetOptions;
_SetChanged();
}
}
private void _FilterSongs()
{
if (!_Changed)
return;
_FilteredSongs.Clear();
string[] searchStrings = null;
if (_SearchString.Length > 0)
searchStrings = _SearchString.ToUpper().Split(new char[] {' '});
foreach (CSong song in CSongs.Songs)
{
if ((song.IsDuet && _DuetOptions != EDuetOptions.NoDuets) || (!song.IsDuet && _DuetOptions != EDuetOptions.Duets))
{
if (searchStrings == null)
_FilteredSongs.Add(song);
else
{
string search = song.Title.ToUpper() + " " + song.Artist.ToUpper() + " " + song.FolderName.ToUpper() + " " + song.FileName.ToUpper();
bool contains = true;
foreach (string str in searchStrings)
contains &= search.Contains(str);
if (contains)
_FilteredSongs.Add(song);
}
}
}
_Changed = false;
}
}
}
+196
View File
@@ -0,0 +1,196 @@
using System;
using System.Collections.Generic;
using System.Reflection;
using VocaluxeLib.Menu;
using VocaluxeLib.Menu.SongMenu;
namespace Vocaluxe.Base
{
class CSongSorter : CObservable
{
private SongPointer[] _SortedSongs = new SongPointer[0];
private EOffOn _IgnoreArticles = CConfig.IgnoreArticles;
private ESongSorting _SongSorting = CConfig.SongSorting;
public CSongSorter()
{
CSongs.Filter.ObjectChanged += HandleFilteredSongsChanged;
}
public SongPointer[] SortedSongs
{
get
{
_SortSongs();
return _SortedSongs;
}
}
public EOffOn IgnoreArticles
{
get { return _IgnoreArticles; }
set
{
if (value != _IgnoreArticles)
{
_IgnoreArticles = value;
_SetChanged();
}
}
}
public ESongSorting SongSorting
{
get { return _SongSorting; }
set
{
if (value != _SongSorting)
{
_SongSorting = value;
_SetChanged();
}
}
}
public void SetOptions(ESongSorting songSorting, EOffOn ignoreArticles)
{
if (songSorting != _SongSorting || ignoreArticles != _IgnoreArticles)
{
_SongSorting = songSorting;
_IgnoreArticles = ignoreArticles;
_SetChanged();
}
}
private void HandleFilteredSongsChanged(object sender, EventArgs args)
{
_SetChanged();
}
private int _SortByFieldArtistTitle(SongPointer s1, SongPointer s2)
{
int res = s1.SortString.ToUpper().CompareTo(s2.SortString.ToUpper());
if (res == 0)
{
if (_IgnoreArticles == EOffOn.TR_CONFIG_ON)
{
res = CSongs.Songs[s1.SongID].ArtistSorting.ToUpper().CompareTo(CSongs.Songs[s2.SongID].ArtistSorting.ToUpper());
if (res == 0)
return CSongs.Songs[s1.SongID].TitleSorting.ToUpper().CompareTo(CSongs.Songs[s2.SongID].TitleSorting.ToUpper());
return res;
}
else
{
res = CSongs.Songs[s1.SongID].Artist.ToUpper().CompareTo(CSongs.Songs[s2.SongID].Artist.ToUpper());
if (res == 0)
return CSongs.Songs[s1.SongID].Title.ToUpper().CompareTo(CSongs.Songs[s2.SongID].Title.ToUpper());
return res;
}
}
return res;
}
private int _SortByFieldTitle(SongPointer s1, SongPointer s2)
{
int res = s1.SortString.ToUpper().CompareTo(s2.SortString.ToUpper());
if (res == 0)
{
if (_IgnoreArticles == EOffOn.TR_CONFIG_ON)
return CSongs.Songs[s1.SongID].TitleSorting.ToUpper().CompareTo(CSongs.Songs[s2.SongID].TitleSorting.ToUpper());
else
return CSongs.Songs[s1.SongID].Title.ToUpper().CompareTo(CSongs.Songs[s2.SongID].Title.ToUpper());
}
return res;
}
private List<SongPointer> _CreateSortList(string fieldName)
{
FieldInfo field = null;
bool isString = false;
List<SongPointer> SortList = new List<SongPointer>();
if (fieldName.Length == 0)
CSongs.Filter.FilteredSongs.ForEach((song) => SortList.Add(new SongPointer(song.ID, "")));
else
{
field = typeof(CSong).GetField(fieldName, BindingFlags.Instance | BindingFlags.DeclaredOnly | BindingFlags.Public);
isString = field.FieldType == typeof(string);
if (!isString && field.FieldType != typeof(List<String>))
throw new Exception("Unkown sort field type");
foreach (CSong song in CSongs.Filter.FilteredSongs)
{
object value = field.GetValue(song);
if (isString)
SortList.Add(new SongPointer(song.ID, (String)value));
else
{
List<String> values = (List<String>)value;
if (values.Count == 0)
SortList.Add(new SongPointer(song.ID, ""));
else
{
foreach (String sortString in (List<String>)value)
SortList.Add(new SongPointer(song.ID, sortString));
}
}
}
}
return SortList;
}
private void _SortSongs()
{
if (!_Changed)
return;
String fieldName;
switch (_SongSorting)
{
case ESongSorting.TR_CONFIG_EDITION:
fieldName = "Edition";
break;
case ESongSorting.TR_CONFIG_GENRE:
fieldName = "Genre";
break;
case ESongSorting.TR_CONFIG_FOLDER:
fieldName = "FolderName";
break;
case ESongSorting.TR_CONFIG_ARTIST_LETTER:
case ESongSorting.TR_CONFIG_ARTIST:
if (_IgnoreArticles == EOffOn.TR_CONFIG_ON)
fieldName = "ArtistSorting";
else
fieldName = "Artist";
break;
case ESongSorting.TR_CONFIG_TITLE_LETTER:
if (_IgnoreArticles == EOffOn.TR_CONFIG_ON)
fieldName = "TitleSorting";
else
fieldName = "Title";
break;
case ESongSorting.TR_CONFIG_YEAR:
case ESongSorting.TR_CONFIG_DECADE:
fieldName = "Year";
break;
case ESongSorting.TR_CONFIG_LANGUAGE:
fieldName = "Language";
break;
default:
fieldName = "";
break;
}
List<SongPointer> SortList = _CreateSortList(fieldName);
switch (_SongSorting)
{
case ESongSorting.TR_CONFIG_ARTIST_LETTER:
case ESongSorting.TR_CONFIG_ARTIST:
case ESongSorting.TR_CONFIG_NONE:
SortList.Sort(_SortByFieldTitle);
break;
default:
SortList.Sort(_SortByFieldArtistTitle);
break;
}
_SortedSongs = SortList.ToArray();
_Changed = false;
}
}
}
+106 -415
View File
@@ -1,17 +1,8 @@
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Globalization;
using System.IO;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading;
using System.Reflection;
using Vocaluxe.Lib.Draw;
using Vocaluxe.Menu;
using Vocaluxe.Menu.SongMenu;
using VocaluxeLib.Menu;
using VocaluxeLib.Menu.SongMenu;
namespace Vocaluxe.Base
{
@@ -36,53 +27,24 @@ namespace Vocaluxe.Base
static class CSongs
{
private static List<CSong> _Songs = new List<CSong>();
private static List<CSong> _FilteredSongs = new List<CSong>();
private static SongPointer[] _SongsSortList = new SongPointer[0];
private static List<CSong> _SongsForRandom = new List<CSong>();
private static readonly List<CSong> _Songs = new List<CSong>();
private static readonly List<CSong> _SongsForRandom = new List<CSong>();
private static bool _SongsLoaded = false;
private static bool _CoverLoaded = false;
private static int _CoverLoadIndex = -1;
private static bool _SongsLoaded;
private static bool _CoverLoaded;
private static int _CoverLoadIndex;
private static int _CatIndex = -1;
private static bool _Init = false;
private static List<CCategory> _Categories = new List<CCategory>();
private static List<CCategory> _CategoriesForRandom = new List<CCategory>();
private static readonly List<CCategory> _CategoriesForRandom = new List<CCategory>();
private static Stopwatch _CoverLoadTimer = new Stopwatch();
private static readonly Stopwatch _CoverLoadTimer = new Stopwatch();
private static string _SearchFilter = String.Empty;
private static EOffOn _Tabs = CConfig.Tabs;
private static EOffOn _IgnoreArticles = CConfig.IgnoreArticles;
private static ESongSorting _SongSorting = CConfig.SongSorting;
private static bool _ShowDuetSongs = true;
public static CSongFilter Filter = new CSongFilter();
public static CSongSorter Sorter = new CSongSorter();
public static CSongCategorizer Categorizer = new CSongCategorizer();
private static Thread _CoverLoaderThread = null;
public static string SearchFilter
public static List<CSong> Songs
{
get { return _SearchFilter; }
set
{
if (value != String.Empty)
{
_Sort(_SongSorting, EOffOn.TR_CONFIG_OFF, _IgnoreArticles, value, false, _ShowDuetSongs);
}
else
{
_Sort(_SongSorting, _Tabs, _IgnoreArticles, value, false, _ShowDuetSongs);
}
}
}
public static EOffOn Tabs
{
get { return _Tabs; }
}
public static EOffOn IgnoreArticles
{
get { return _IgnoreArticles; }
get { return _Songs; }
}
public static bool SongsLoaded
@@ -92,7 +54,7 @@ namespace Vocaluxe.Base
public static bool CoverLoaded
{
get
get
{
if (_SongsLoaded && NumAllSongs == 0)
_CoverLoaded = true;
@@ -110,7 +72,7 @@ namespace Vocaluxe.Base
get
{
int Result = 0;
foreach (SongPointer sp in _SongsSortList)
foreach (SongPointer sp in Sorter.SortedSongs)
{
if (sp.Visible)
Result++;
@@ -121,7 +83,7 @@ namespace Vocaluxe.Base
public static int NumCategories
{
get { return _Categories.Count; }
get { return Categorizer.Categories.Count; }
}
public static int Category
@@ -129,32 +91,35 @@ namespace Vocaluxe.Base
get { return _CatIndex; }
set
{
if ((_Categories.Count > value) && (value >= -1))
if (value >= -1 && value < Categorizer.Categories.Count)
{
_CatIndex = value;
for (int i = 0; i < _SongsSortList.Length; i++)
{
_SongsSortList[i].Visible = (_SongsSortList[i].CatIndex == _CatIndex && !_SongsSortList[i].PartyHidden);
}
for (int i = 0; i < Sorter.SortedSongs.Length; i++)
Sorter.SortedSongs[i].Visible = Sorter.SortedSongs[i].CatIndex == _CatIndex && !Sorter.SortedSongs[i].PartyHidden;
}
}
}
public static bool IsInCategory
{
get { return _CatIndex >= 0; }
}
/// <summary>
/// Returns the number of song in the category specified with CatIndex
/// Returns the number of song in the category specified with CatIndex
/// </summary>
/// <param name="CatIndex">Category index</param>
/// <returns></returns>
public static int NumSongsInCategory(int CatIndex)
{
if (_Categories.Count <= CatIndex || CatIndex < 0)
if (Categorizer.Categories.Count <= CatIndex || CatIndex < 0)
return 0;
int num = 0;
for (int i = 0; i < _SongsSortList.Length; i++)
for (int i = 0; i < Sorter.SortedSongs.Length; i++)
{
if (_SongsSortList[i].CatIndex == CatIndex && !_SongsSortList[i].PartyHidden)
if (Sorter.SortedSongs[i].CatIndex == CatIndex && !Sorter.SortedSongs[i].PartyHidden)
num++;
}
return num;
@@ -162,15 +127,16 @@ namespace Vocaluxe.Base
public static void NextCategory()
{
if (Category == _Categories.Count - 1)
if (Category == Categorizer.Categories.Count - 1)
Category = 0;
else
Category++;
}
public static void PrevCategory()
{
if (Category == 0)
Category = _Categories.Count - 1;
Category = Categorizer.Categories.Count - 1;
else
Category--;
}
@@ -180,18 +146,19 @@ namespace Vocaluxe.Base
if (!SongsLoaded)
return -1;
if (_Songs.Count > _CoverLoadIndex + 1)
if (_CoverLoadIndex < _Songs.Count)
{
_CoverLoadIndex++;
Song = _Songs[_CoverLoadIndex];
_CoverLoadIndex++;
return _CoverLoadIndex;
}
return -2;
}
public static int NumSongsWithCoverLoaded
{
get { return _CoverLoadIndex + 1; }
get { return _CoverLoadIndex; }
}
public static void SetCoverSmall(int SongIndex, STexture Texture)
@@ -200,31 +167,22 @@ namespace Vocaluxe.Base
return;
if (SongIndex < _Songs.Count)
{
_Songs[SongIndex].CoverTextureSmall = Texture;
if (SongIndex == _Songs.Count - 1)
_CoverLoaded = true;
}
}
public static void SetCoverBig(int SongIndex, STexture Texture)
{
if (!_SongsLoaded)
return;
if (SongIndex < _Songs.Count)
{
_Songs[SongIndex].CoverTextureBig = Texture;
if (SongIndex == _Songs.Count - 1)
_CoverLoaded = true;
}
}
public static string GetCurrentCategoryName()
{
if ((_Categories.Count > 0) && (_CatIndex >= 0) && (_Categories.Count > _CatIndex))
return _Categories[_CatIndex].Name;
if ((Categorizer.Categories.Count > 0) && (_CatIndex >= 0) && (Categorizer.Categories.Count > _CatIndex))
return Categorizer.Categories[_CatIndex].Name;
else
return String.Empty;
}
@@ -242,13 +200,13 @@ namespace Vocaluxe.Base
public static void AddPartySongSung(int SongID)
{
int cat = -1;
for (int i = 0; i < _SongsSortList.Length; i++)
for (int i = 0; i < Sorter.SortedSongs.Length; i++)
{
if (SongID == _SongsSortList[i].SongID)
if (SongID == Sorter.SortedSongs[i].SongID)
{
_SongsSortList[i].PartyHidden = true;
_SongsSortList[i].Visible = false;
cat = _SongsSortList[i].CatIndex;
Sorter.SortedSongs[i].PartyHidden = true;
Sorter.SortedSongs[i].Visible = false;
cat = Sorter.SortedSongs[i].CatIndex;
break;
}
}
@@ -262,21 +220,21 @@ namespace Vocaluxe.Base
public static void ResetPartySongSung()
{
for (int i = 0; i < _SongsSortList.Length; i++)
for (int i = 0; i < Sorter.SortedSongs.Length; i++)
{
_SongsSortList[i].PartyHidden = false;
_SongsSortList[i].Visible = (_SongsSortList[i].CatIndex == _CatIndex && !_SongsSortList[i].PartyHidden);
Sorter.SortedSongs[i].PartyHidden = false;
Sorter.SortedSongs[i].Visible = Sorter.SortedSongs[i].CatIndex == _CatIndex && !Sorter.SortedSongs[i].PartyHidden;
}
}
public static void ResetPartySongSung(int CatIndex)
{
for (int i = 0; i < _SongsSortList.Length; i++)
for (int i = 0; i < Sorter.SortedSongs.Length; i++)
{
if (_SongsSortList[i].CatIndex == CatIndex)
if (Sorter.SortedSongs[i].CatIndex == CatIndex)
{
_SongsSortList[i].PartyHidden = false;
_SongsSortList[i].Visible = (_SongsSortList[i].CatIndex == _CatIndex && !_SongsSortList[i].PartyHidden);
Sorter.SortedSongs[i].PartyHidden = false;
Sorter.SortedSongs[i].Visible = Sorter.SortedSongs[i].CatIndex == _CatIndex && !Sorter.SortedSongs[i].PartyHidden;
}
}
}
@@ -296,14 +254,12 @@ namespace Vocaluxe.Base
public static int GetRandomSong()
{
if (_SongsForRandom.Count == 0)
{
UpdateRandomSongList();
}
if (_SongsForRandom.Count == 0)
return -1;
CSong song = _SongsForRandom[CGame.Rand.Next(0, _SongsForRandom.Count-1)];
CSong song = _SongsForRandom[CGame.Rand.Next(0, _SongsForRandom.Count - 1)];
_SongsForRandom.Remove(song);
return GetVisibleSongNumber(song.ID);
}
@@ -350,10 +306,10 @@ namespace Vocaluxe.Base
public static CSong[] SongsNotSung
{
get
get
{
List<CSong> songs = new List<CSong>();
foreach (SongPointer sp in _SongsSortList)
foreach (SongPointer sp in Sorter.SortedSongs)
{
if (sp.Visible)
songs.Add(_Songs[sp.SongID]);
@@ -367,7 +323,7 @@ namespace Vocaluxe.Base
get
{
List<CSong> songs = new List<CSong>();
foreach (SongPointer sp in _SongsSortList)
foreach (SongPointer sp in Sorter.SortedSongs)
{
if (sp.Visible)
songs.Add(_Songs[sp.SongID]);
@@ -378,323 +334,39 @@ namespace Vocaluxe.Base
public static CCategory[] Categories
{
get { return _Categories.ToArray(); }
get { return Categorizer.Categories.ToArray(); }
}
private static void _FilterSongs(String SearchFilter, bool ShowDuetSongs)
public static CSong GetVisibleSongByIndex(int index)
{
if (_Init && _SearchFilter == SearchFilter && _ShowDuetSongs == ShowDuetSongs)
return;
if (index < 0)
return null;
_Init = true;
_SearchFilter = SearchFilter;
_ShowDuetSongs = ShowDuetSongs;
_FilteredSongs.Clear();
string[] searchStrings = null;
if (_SearchFilter != String.Empty)
searchStrings = _SearchFilter.ToUpper().Split(new char[] { ' ' });
foreach (CSong song in _Songs)
foreach (SongPointer sp in Sorter.SortedSongs)
{
if (!song.IsDuet || _ShowDuetSongs)
if (sp.Visible)
{
if (_SearchFilter == String.Empty)
_FilteredSongs.Add(song);
else if (searchStrings != null)
{
string search = song.Title.ToUpper() + " " + song.Artist.ToUpper() + " " + song.FolderName.ToUpper() + " " + song.FileName.ToUpper();
bool contains = true;
foreach (string str in searchStrings)
{
contains &= search.Contains(str);
}
if (contains)
_FilteredSongs.Add(song);
}
if (index == 0)
return _Songs[sp.SongID];
index--;
}
}
return null;
}
private static int _SortByFieldArtistTitle(SongPointer s1, SongPointer s2)
private static void HandleCategoriesChanged(object sender, EventArgs args)
{
int res = s1.SortString.ToUpper().CompareTo(s2.SortString.ToUpper());
if (res == 0)
{
if (_IgnoreArticles == EOffOn.TR_CONFIG_ON)
{
res = _Songs[s1.SongID].ArtistSorting.ToUpper().CompareTo(_Songs[s2.SongID].ArtistSorting.ToUpper());
if (res == 0)
{
return _Songs[s1.SongID].TitleSorting.ToUpper().CompareTo(_Songs[s2.SongID].TitleSorting.ToUpper());
}
return res;
}
else
{
res = _Songs[s1.SongID].Artist.ToUpper().CompareTo(_Songs[s2.SongID].Artist.ToUpper());
if (res == 0)
{
return _Songs[s1.SongID].Title.ToUpper().CompareTo(_Songs[s2.SongID].Title.ToUpper());
}
return res;
}
}
return res;
}
private static int _SortByFieldTitle(SongPointer s1, SongPointer s2)
{
int res = s1.SortString.ToUpper().CompareTo(s2.SortString.ToUpper());
if (res == 0)
{
if (_IgnoreArticles == EOffOn.TR_CONFIG_ON)
return _Songs[s1.SongID].TitleSorting.ToUpper().CompareTo(_Songs[s2.SongID].TitleSorting.ToUpper());
else
return _Songs[s1.SongID].Title.ToUpper().CompareTo(_Songs[s2.SongID].Title.ToUpper());
}
return res;
}
private static List<SongPointer> _CreateSortList(string fieldName)
{
FieldInfo field = null;
bool isString = false;
List<SongPointer> SortList = new List<SongPointer>();
if (fieldName == String.Empty)
_FilteredSongs.ForEach((song) => SortList.Add(new SongPointer(song.ID, "")));
{
field = Type.GetType("Vocaluxe.Menu.SongMenu.CSong,VocaluxeLib").GetField(fieldName, BindingFlags.Instance | BindingFlags.DeclaredOnly | BindingFlags.Public);
isString = field.FieldType == typeof(string);
if (!isString && field.FieldType != typeof(List<String>))
throw new Exception("Unkown sort field type");
foreach (CSong song in _FilteredSongs)
{
object value = field.GetValue(song);
if (isString)
SortList.Add(new SongPointer(song.ID, (String)value));
else
{
List<String> values = (List<String>)value;
if (values.Count == 0)
{
SortList.Add(new SongPointer(song.ID, ""));
}
else
{
foreach (String sortString in (List<String>)value)
{
SortList.Add(new SongPointer(song.ID, sortString));
}
}
}
}
}
return SortList;
}
private static void SortSongs()
{
String fieldName;
switch (_SongSorting)
{
case ESongSorting.TR_CONFIG_EDITION:
fieldName = "Edition";
break;
case ESongSorting.TR_CONFIG_GENRE:
fieldName = "Genre";
break;
case ESongSorting.TR_CONFIG_FOLDER:
fieldName = "FolderName";
break;
case ESongSorting.TR_CONFIG_ARTIST_LETTER:
case ESongSorting.TR_CONFIG_ARTIST:
if (_IgnoreArticles == EOffOn.TR_CONFIG_ON)
fieldName = "ArtistSorting";
else
fieldName = "Artist";
break;
case ESongSorting.TR_CONFIG_TITLE_LETTER:
if (_IgnoreArticles == EOffOn.TR_CONFIG_ON)
fieldName = "TitleSorting";
else
fieldName = "Title";
break;
case ESongSorting.TR_CONFIG_YEAR:
case ESongSorting.TR_CONFIG_DECADE:
fieldName = "Year";
break;
case ESongSorting.TR_CONFIG_LANGUAGE:
fieldName = "Language";
break;
default:
fieldName = "";
break;
}
List<SongPointer> SortList = _CreateSortList(fieldName);
switch (_SongSorting)
{
case ESongSorting.TR_CONFIG_ARTIST_LETTER:
case ESongSorting.TR_CONFIG_ARTIST:
case ESongSorting.TR_CONFIG_NONE:
SortList.Sort(_SortByFieldTitle);
break;
default:
SortList.Sort(_SortByFieldArtistTitle);
break;
}
_SongsSortList = SortList.ToArray();
}
private static void _CreateCategoriesLetter()
{
string category = "";
int NotLetterCat = -1;
for (int i = 0; i < _SongsSortList.Length; i++)
{
Char firstLetter = Char.ToUpper(_SongsSortList[i].SortString.Normalize(NormalizationForm.FormD)[0]);
if (!Char.IsLetter(firstLetter))
{
firstLetter = '#';
}
if (firstLetter.ToString() != category)
{
if (firstLetter != '#' || NotLetterCat == -1)
{
category = firstLetter.ToString();
_Categories.Add(new CCategory(category));
_SongsSortList[i].CatIndex = _Categories.Count - 1;
if (firstLetter == '#')
NotLetterCat = _SongsSortList[i].CatIndex;
}
else
_SongsSortList[i].CatIndex = NotLetterCat;
}
else
_SongsSortList[i].CatIndex = _Categories.Count - 1;
}
}
private static void _CreateCategoriesNormal(string NoCategoryName)
{
string category = "";
int NoCategoryIndex = -1;
for (int i = 0; i < _SongsSortList.Length; i++)
{
if (_SongsSortList[i].SortString.Length > 0)
{
if (_SongsSortList[i].SortString != category)
{
category = _SongsSortList[i].SortString;
_Categories.Add(new CCategory(category));
}
_SongsSortList[i].CatIndex = _Categories.Count - 1;
}
else
{
if (NoCategoryIndex < 0)
{
category = NoCategoryName;
_Categories.Add(new CCategory(category));
NoCategoryIndex = _Categories.Count - 1;
}
_SongsSortList[i].CatIndex = NoCategoryIndex;
}
}
}
private static void _FillCategories()
{
string NoCategoryName = "";
switch (_SongSorting)
{
case ESongSorting.TR_CONFIG_EDITION:
NoCategoryName = CLanguage.Translate("TR_SCREENSONG_NOEDITION");
break;
case ESongSorting.TR_CONFIG_GENRE:
NoCategoryName = CLanguage.Translate("TR_SCREENSONG_NOGENRE");
break;
case ESongSorting.TR_CONFIG_DECADE:
case ESongSorting.TR_CONFIG_YEAR:
NoCategoryName = CLanguage.Translate("TR_SCREENSONG_NOYEAR");
break;
case ESongSorting.TR_CONFIG_LANGUAGE:
NoCategoryName = CLanguage.Translate("TR_SCREENSONG_NOLANGUAGE");
break;
case ESongSorting.TR_CONFIG_NONE:
NoCategoryName = CLanguage.Translate("TR_SCREENSONG_ALLSONGS");
break;
}
if (_SongSorting == ESongSorting.TR_CONFIG_ARTIST_LETTER || _SongSorting == ESongSorting.TR_CONFIG_TITLE_LETTER)
_CreateCategoriesLetter();
else
{
if(_SongSorting==ESongSorting.TR_CONFIG_DECADE)
for (int i = 0; i < _SongsSortList.Length; i++)
{
string Year = _SongsSortList[i].SortString;
if (Year != "")
{
Year = Year.Substring(0, 3);
_SongsSortList[i].SortString = Year + "0 - " + Year + "9";
}
}
_CreateCategoriesNormal(NoCategoryName);
}
}
public static void Sort(ESongSorting Sorting, EOffOn Tabs, EOffOn IgnoreArticles, String SearchString)
{
_Sort(Sorting, Tabs, IgnoreArticles, SearchString, false, _ShowDuetSongs);
}
public static void Sort(ESongSorting Sorting, EOffOn Tabs, EOffOn IgnoreArticles, String SearchString, bool ShowDuetSongs)
{
_Sort(Sorting, Tabs, IgnoreArticles, SearchString, false, ShowDuetSongs);
}
private static void _Sort(ESongSorting Sorting, EOffOn Tabs, EOffOn IgnoreArticles, string SearchString, bool force, bool ShowDuetSongs)
{
if (_Songs.Count == 0)
return;
if (!force && Sorting == _SongSorting && Tabs == _Tabs && IgnoreArticles == _IgnoreArticles && SearchString == _SearchFilter && ShowDuetSongs == _ShowDuetSongs)
return; //nothing to do
_IgnoreArticles = IgnoreArticles;
_SongSorting = Sorting;
_Tabs = Tabs;
_FilterSongs(SearchString, ShowDuetSongs);
SortSongs();
_Categories.Clear();
if (_Tabs == EOffOn.TR_CONFIG_OFF)
{
//No categories. So don't create them!
_Categories.Add(new CCategory(""));
for (int i = 0; i < _SongsSortList.Length; i++)
{
_SongsSortList[i].CatIndex = 0;
}
}else
_FillCategories();
foreach (CCategory cat in _Categories)
{
cat.CoverTextureSmall = CCover.Cover(cat.Name);
}
_CategoriesForRandom.Clear();
Category = _CatIndex;
}
public static void Sort(ESongSorting Sorting, EOffOn Tabs, EOffOn IgnoreArticles, String SearchString, EDuetOptions DuetOptions)
{
Filter.SetOptions(SearchString, DuetOptions);
Sorter.SetOptions(Sorting, IgnoreArticles);
Categorizer.Tabs = Tabs;
}
public static void LoadSongs()
{
CLog.StartBenchmark(1, "Load Songs");
@@ -727,7 +399,10 @@ namespace Vocaluxe.Base
CLog.StopBenchmark(2, "Read TXTs");
CLog.StartBenchmark(2, "Sort Songs");
_Sort(CConfig.SongSorting, CConfig.Tabs, CConfig.IgnoreArticles, String.Empty, true, true);
Sorter.SongSorting = CConfig.SongSorting;
Sorter.IgnoreArticles = CConfig.IgnoreArticles;
Categorizer.Tabs = CConfig.Tabs;
Categorizer.ObjectChanged += HandleCategoriesChanged;
CLog.StopBenchmark(2, "Sort Songs");
Category = -1;
_SongsLoaded = true;
@@ -735,34 +410,50 @@ namespace Vocaluxe.Base
if (CConfig.CoverLoading == ECoverLoading.TR_CONFIG_COVERLOADING_ATSTART)
{
CLog.StartBenchmark(2, "Load Covers/Notes");
_LoadCover();
_LoadCoverAndNotes();
CLog.StopBenchmark(2, "Load Covers/Notes");
}
CLog.StopBenchmark(1, "Load Songs ");
GC.Collect();
}
public static void LoadCover()
public static void LoadCover(int WaitTime, int NumLoads)
{
if (CConfig.Renderer == ERenderer.TR_CONFIG_SOFTWARE)
return;
return; //should be removed as soon as the other renderer are ready for queque
if (!SongsLoaded || CoverLoaded)
return;
if (_CoverLoaderThread == null)
if (!_CoverLoadTimer.IsRunning)
{
_CoverLoaderThread = new Thread(new ThreadStart(_LoadCover));
_CoverLoaderThread.Name = "CoverLoader";
_CoverLoaderThread.Priority = ThreadPriority.BelowNormal;
_CoverLoaderThread.IsBackground = true;
_CoverLoaderThread.Start();
_CoverLoadTimer.Reset();
_CoverLoadTimer.Start();
}
if (_CoverLoadTimer.ElapsedMilliseconds >= WaitTime)
{
for (int i = 0; i < NumLoads; i++)
{
CSong song = null;
int n = GetNextSongWithoutCover(ref song);
if (n < 0)
return;
song.LoadSmallCover();
if (n == NumAllSongs)
CDataBase.CommitCovers();
}
_CoverLoadTimer.Reset();
_CoverLoadTimer.Start();
}
}
private static void _LoadCover()
private static void _LoadCoverAndNotes()
{
foreach(CSong song in _Songs)
foreach (CSong song in _Songs)
{
song.ReadNotes();
song.LoadSmallCover();
@@ -773,4 +464,4 @@ namespace Vocaluxe.Base
CDataBase.CommitCovers();
}
}
}
}
+64 -73
View File
@@ -1,11 +1,8 @@
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Text;
using Vocaluxe.Lib.Sound;
using Vocaluxe.Menu;
using VocaluxeLib.Menu;
namespace Vocaluxe.Base
{
@@ -17,7 +14,7 @@ namespace Vocaluxe.Base
static class CSound
{
#region Playback
private static IPlayback _Playback = null;
private static IPlayback _Playback;
public static bool PlaybackInit()
{
@@ -152,8 +149,8 @@ namespace Vocaluxe.Base
{
_Playback.SetPosition(Stream, Position);
}
#endregion Stream Handling
#endregion Playback
#region Sounds
@@ -165,23 +162,21 @@ namespace Vocaluxe.Base
case ESounds.T440:
file = Path.Combine(file, CSettings.sSoundT440);
break;
default:
break;
}
if (file == String.Empty)
if (file.Length == 0)
return -1;
int stream = CSound.Load(file);
float length = CSound.GetLength(stream);
CSound.Play(stream);
CSound.FadeAndStop(stream, 100f, length);
int stream = Load(file);
float length = GetLength(stream);
Play(stream);
FadeAndStop(stream, 100f, length);
return stream;
}
#endregion Sounds
#region Record
private static IRecord _Record = null;
private static IRecord _Record;
public static bool RecordInit()
{
@@ -201,7 +196,7 @@ namespace Vocaluxe.Base
_Record = new CPortAudioRecord();
break;
}
return true;
}
@@ -213,7 +208,7 @@ namespace Vocaluxe.Base
public static bool RecordStart()
{
SRecordDevice[] devices = RecordGetDevices();
return _Record.Start(devices);
}
@@ -265,23 +260,23 @@ namespace Vocaluxe.Base
public static SRecordDevice[] RecordGetDevices()
{
SRecordDevice[] devices = _Record.RecordDevices();
if (devices != null)
{
for (int dev = 0; dev < devices.Length; dev++)
{
for (int inp = 0; inp < devices[dev].Inputs.Count; inp++)
{
SInput input = devices[dev].Inputs[inp];
input.PlayerChannel1 = GetPlayerFromMicConfig(devices[dev].Name, devices[dev].Driver, input.Name, 1);
input.PlayerChannel2 = GetPlayerFromMicConfig(devices[dev].Name, devices[dev].Driver, input.Name, 2);
devices[dev].Inputs[inp] = input;
}
}
return devices;
}
if (devices != null)
{
for (int dev = 0; dev < devices.Length; dev++)
{
for (int inp = 0; inp < devices[dev].Inputs.Count; inp++)
{
SInput input = devices[dev].Inputs[inp];
input.PlayerChannel1 = GetPlayerFromMicConfig(devices[dev].Name, devices[dev].Driver, input.Name, 1);
input.PlayerChannel2 = GetPlayerFromMicConfig(devices[dev].Name, devices[dev].Driver, input.Name, 2);
devices[dev].Inputs[inp] = input;
}
}
return devices;
}
return null;
}
@@ -295,39 +290,35 @@ namespace Vocaluxe.Base
CConfig.MicConfig[p].DeviceDriver == devicedriver &&
CConfig.MicConfig[p].InputName == input &&
CConfig.MicConfig[p].Channel == channel)
{
return p + 1;
}
}
return 0;
}
#endregion Record
}
class CBuffer
class CBuffer : IDisposable
{
private const double _BaseToneFreq = 65.4064;
private const int _NumHalfTones = 47;
private float[] _ToneWeigth;
private readonly float[] _ToneWeigth;
private Int16[] _AnalysisBuffer = new Int16[4096];
private Object _AnalysisBufferLock = new Object();
private readonly Object _AnalysisBufferLock = new Object();
private bool _ToneValid = false;
private int _Tone = 0;
private int _ToneAbs = 0;
private double _MaxVolume = 0.0;
private bool _ToneValid;
private int _Tone;
private int _ToneAbs;
private double _MaxVolume;
private bool _NewSamples;
private MemoryStream _Stream; // full buffer
private MemoryStream _Stream; // full buffer
public CBuffer()
{
_ToneWeigth = new float[_NumHalfTones];
for (int i = 0; i < _ToneWeigth.Length; i++)
{
_ToneWeigth[i] = 0.99f;
}
_Stream = new MemoryStream();
_NewSamples = false;
}
@@ -339,12 +330,12 @@ namespace Vocaluxe.Base
public int ToneAbs
{
get
get
{
lock (_AnalysisBufferLock)
{
return _ToneAbs;
}
return _ToneAbs;
}
}
}
@@ -426,14 +417,12 @@ namespace Vocaluxe.Base
public void ProcessNewBuffer(byte[] buffer)
{
// apply software boost
//BoostBuffer(Buffer, BufferSize);
// voice passthrough (send data to playback-device)
//if (assigned(fVoiceStream)) then
//fVoiceStream.WriteData(Buffer, BufferSize);
lock (_AnalysisBufferLock)
{
Add(buffer);
@@ -473,7 +462,7 @@ namespace Vocaluxe.Base
_MaxVolume = 0;
for (int i = 0; i < _AnalysisBuffer.Length / 4; i++)
{
float Volume = Math.Abs((float)_AnalysisBuffer[i]) / (float)Int16.MaxValue;
float Volume = Math.Abs((float)_AnalysisBuffer[i]) / Int16.MaxValue;
if (Volume > MaxVolume)
_MaxVolume = Volume;
}
@@ -482,12 +471,8 @@ namespace Vocaluxe.Base
AnalyzeByAutocorrelation(true);
else
AnalyzeByAutocorrelation(false);
}
catch (Exception)
{
}
catch (Exception) {}
}
private void AnalyzeByAutocorrelation(bool valid)
@@ -504,7 +489,6 @@ namespace Vocaluxe.Base
// Note: at the lowest tone (~65Hz) and a buffer-size of 4096
// at 44.1 (or 48kHz) only 6 (or 5) samples are compared, this might be
// too few samples -> use a bigger buffer-size
for (int ToneIndex = 0; ToneIndex < _NumHalfTones; ToneIndex++)
{
double CurFreq = _BaseToneFreq * Math.Pow(HalftoneBase, ToneIndex);
@@ -525,9 +509,7 @@ namespace Vocaluxe.Base
if (valid && MaxWeight - MinWeight > 0.01)
{
for (int i = 0; i < Weigth.Length; i++)
{
_ToneWeigth[i] = Weigth[i];
}
_ToneAbs = MaxTone;
_Tone = MaxTone % 12;
@@ -539,18 +521,18 @@ namespace Vocaluxe.Base
private double AnalyzeAutocorrelationFreq(double Freq)
{
int SampleIndex = 0; // index of sample to analyze
int SamplesPerPeriod = (int)Math.Round(44100.0 / Freq); // samples in one period
int CorrelatingSampleIndex = SampleIndex + SamplesPerPeriod; // index of sample one period ahead
int SampleIndex = 0; // index of sample to analyze
int SamplesPerPeriod = (int)Math.Round(44100.0 / Freq); // samples in one period
int CorrelatingSampleIndex = SampleIndex + SamplesPerPeriod; // index of sample one period ahead
double AccumDist = 0.0; // accumulated distances
double AccumDist = 0.0; // accumulated distances
// compare correlating samples
while (CorrelatingSampleIndex < _AnalysisBuffer.Length)
{
// calc distance (correlation: 1-dist) to corresponding sample in next period
// distance (0=equal .. 1=totally different) between correlated samples
double Dist = Math.Abs((double)_AnalysisBuffer[SampleIndex] - _AnalysisBuffer[CorrelatingSampleIndex]) / (double)Int16.MaxValue;
double Dist = Math.Abs((double)_AnalysisBuffer[SampleIndex] - _AnalysisBuffer[CorrelatingSampleIndex]) / Int16.MaxValue;
AccumDist += Dist;
SampleIndex++;
CorrelatingSampleIndex++;
@@ -558,14 +540,24 @@ namespace Vocaluxe.Base
return 1 - AccumDist / _AnalysisBuffer.Length;
}
public void Dispose()
{
if (_Stream != null)
{
_Stream.Dispose();
_Stream = null;
}
GC.SuppressFinalize(this);
}
}
class CSyncTimer
{
private PT1 _ExternTime;
private Stopwatch _Timer;
private readonly PT1 _ExternTime;
private readonly Stopwatch _Timer;
private float _SetValue;
public float Time
{
get
@@ -620,7 +612,6 @@ namespace Vocaluxe.Base
_SetValue -= 0.000025f;
}
//Console.WriteLine(diff.ToString());
return dt;
}
@@ -642,9 +633,9 @@ namespace Vocaluxe.Base
private float _CurrentTime;
private float _OldTime;
private Stopwatch _STimer;
private float _K;
private float _T;
private readonly Stopwatch _STimer;
private readonly float _K;
private readonly float _T;
public float Time
{
@@ -692,7 +683,7 @@ namespace Vocaluxe.Base
if (Stopwatch.IsHighResolution && ticks != 0)
dt = (float)(ticks * nanosecPerTick / 1000000000.0);
float Ts = 0f;
if (dt > 0)
Ts = 1 / (_T / dt + 1);
@@ -716,4 +707,4 @@ namespace Vocaluxe.Base
_STimer.Start();
}
}
}
}
+96 -136
View File
@@ -4,15 +4,11 @@ using System.IO;
using System.Text;
using System.Windows.Forms;
using System.Xml;
using Vocaluxe.Lib.Draw;
using Vocaluxe.Menu;
using Vocaluxe.Menu.SingNotes;
using Vocaluxe.Menu.SongMenu;
using Vocaluxe.Screens;
using VocaluxeLib.Menu;
namespace Vocaluxe.Base
{
#region Structs
struct Theme
{
@@ -84,15 +80,15 @@ namespace Vocaluxe.Base
static class CTheme
{
// Version number for main theme and skin files. Increment it, if you've changed something on the theme files!
const int ThemeSystemVersion = 5;
const int SkinSystemVersion = 3;
private const int ThemeSystemVersion = 5;
private const int SkinSystemVersion = 3;
#region Vars
private static XmlWriterSettings _settings = new XmlWriterSettings();
private static List<Theme> _Themes = new List<Theme>();
private static readonly XmlWriterSettings _settings = new XmlWriterSettings();
private static readonly List<Theme> _Themes = new List<Theme>();
public static string[] ThemeNames
{
get
get
{
List<string> names = new List<string>();
foreach (Theme th in _Themes)
@@ -104,7 +100,7 @@ namespace Vocaluxe.Base
}
}
private static List<Skin> _Skins = new List<Skin>();
private static readonly List<Skin> _Skins = new List<Skin>();
public static string[] SkinNames
{
get
@@ -125,7 +121,7 @@ namespace Vocaluxe.Base
#region Theme and Skin loading and writing
public static void InitTheme()
{
_settings.Indent = true;
_settings.Indent = true;
_settings.Encoding = Encoding.UTF8;
_settings.ConformanceLevel = ConformanceLevel.Document;
@@ -277,8 +273,8 @@ namespace Vocaluxe.Base
else
{
CFonts.LoadPartyModeFonts(_Themes[ThemeIndex].PartyModeID,
Path.Combine(_Themes[ThemeIndex].Path, CSettings.sFolderPartyModeFonts),
xmlReader);
Path.Combine(_Themes[ThemeIndex].Path, CSettings.sFolderPartyModeFonts),
xmlReader);
}
return true;
}
@@ -291,46 +287,47 @@ namespace Vocaluxe.Base
{
if (_Themes[i].Name == CConfig.Theme && _Themes[i].PartyModeID == -1 || _Themes[i].PartyModeID != -1)
SaveTheme(i);
}
}
}
private static void SaveTheme(int ThemeIndex)
{
#region ThemeMainFile
XmlWriter writer = XmlWriter.Create(Path.Combine(_Themes[ThemeIndex].Path, _Themes[ThemeIndex].FileName), _settings);
writer.WriteStartDocument();
writer.WriteStartElement("root");
using (XmlWriter writer = XmlWriter.Create(Path.Combine(_Themes[ThemeIndex].Path, _Themes[ThemeIndex].FileName), _settings))
{
writer.WriteStartDocument();
writer.WriteStartElement("root");
// ThemeSystemVersion
writer.WriteElementString("ThemeSystemVersion", ThemeSystemVersion.ToString());
// ThemeSystemVersion
writer.WriteElementString("ThemeSystemVersion", ThemeSystemVersion.ToString());
#region Info
writer.WriteStartElement("Info");
#region Info
writer.WriteStartElement("Info");
writer.WriteElementString("Name", _Themes[ThemeIndex].Name);
writer.WriteElementString("Author", _Themes[ThemeIndex].Author);
writer.WriteElementString("SkinFolder", _Themes[ThemeIndex].SkinFolder);
writer.WriteElementString("ThemeVersionMajor", _Themes[ThemeIndex].ThemeVersionMajor.ToString());
writer.WriteElementString("ThemeVersionMinor", _Themes[ThemeIndex].ThemeVersionMinor.ToString());
writer.WriteElementString("Name", _Themes[ThemeIndex].Name);
writer.WriteElementString("Author", _Themes[ThemeIndex].Author);
writer.WriteElementString("SkinFolder", _Themes[ThemeIndex].SkinFolder);
writer.WriteElementString("ThemeVersionMajor", _Themes[ThemeIndex].ThemeVersionMajor.ToString());
writer.WriteElementString("ThemeVersionMinor", _Themes[ThemeIndex].ThemeVersionMinor.ToString());
writer.WriteEndElement();
#endregion Info
writer.WriteEndElement();
#endregion Info
// Cursor
if (_Themes[ThemeIndex].PartyModeID == -1)
SaveCursor(writer);
// Cursor
if (_Themes[ThemeIndex].PartyModeID == -1)
SaveCursor(writer);
// save fonts
if (_Themes[ThemeIndex].PartyModeID == -1)
CFonts.SaveThemeFonts(_Themes[ThemeIndex].Name, writer);
// save fonts
if (_Themes[ThemeIndex].PartyModeID == -1)
CFonts.SaveThemeFonts(_Themes[ThemeIndex].Name, writer);
// End of File
writer.WriteEndElement(); //end of root
writer.WriteEndDocument();
// End of File
writer.WriteEndElement(); //end of root
writer.WriteEndDocument();
writer.Flush();
writer.Close();
writer.Flush();
}
#endregion ThemeMainFile
}
@@ -338,53 +335,50 @@ namespace Vocaluxe.Base
{
for (int SkinIndex = 0; SkinIndex < _Skins.Count; SkinIndex++)
{
XmlWriter writer = XmlWriter.Create(Path.Combine(_Skins[SkinIndex].Path, _Skins[SkinIndex].FileName), _settings);
writer.WriteStartDocument();
writer.WriteStartElement("root");
// ThemeSystemVersion
writer.WriteElementString("SkinSystemVersion", SkinSystemVersion.ToString());
#region Info
writer.WriteStartElement("Info");
writer.WriteElementString("Name", _Skins[SkinIndex].Name);
writer.WriteElementString("Author", _Skins[SkinIndex].Author);
writer.WriteElementString("SkinVersionMajor", _Skins[SkinIndex].SkinVersionMajor.ToString());
writer.WriteElementString("SkinVersionMinor", _Skins[SkinIndex].SkinVersionMinor.ToString());
writer.WriteEndElement();
#endregion Info
// save colors
SaveColors(writer, SkinIndex);
#region Skins
writer.WriteStartElement("Skins");
foreach (SkinElement element in _Skins[SkinIndex].SkinList.Values)
using (XmlWriter writer = XmlWriter.Create(Path.Combine(_Skins[SkinIndex].Path, _Skins[SkinIndex].FileName), _settings))
{
writer.WriteElementString(element.Name, element.Value);
writer.WriteStartDocument();
writer.WriteStartElement("root");
// ThemeSystemVersion
writer.WriteElementString("SkinSystemVersion", SkinSystemVersion.ToString());
#region Info
writer.WriteStartElement("Info");
writer.WriteElementString("Name", _Skins[SkinIndex].Name);
writer.WriteElementString("Author", _Skins[SkinIndex].Author);
writer.WriteElementString("SkinVersionMajor", _Skins[SkinIndex].SkinVersionMajor.ToString());
writer.WriteElementString("SkinVersionMinor", _Skins[SkinIndex].SkinVersionMinor.ToString());
writer.WriteEndElement();
#endregion Info
// save colors
SaveColors(writer, SkinIndex);
#region Skins
writer.WriteStartElement("Skins");
foreach (SkinElement element in _Skins[SkinIndex].SkinList.Values)
writer.WriteElementString(element.Name, element.Value);
writer.WriteEndElement();
#endregion Skins
#region Videos
writer.WriteStartElement("Videos");
foreach (SkinElement element in _Skins[SkinIndex].VideoList)
writer.WriteElementString(element.Name, element.Value);
writer.WriteEndElement();
#endregion Videos
// End of File
writer.WriteEndElement(); //end of root
writer.WriteEndDocument();
writer.Flush();
}
writer.WriteEndElement();
#endregion Skins
#region Videos
writer.WriteStartElement("Videos");
foreach (SkinElement element in _Skins[SkinIndex].VideoList)
{
writer.WriteElementString(element.Name, element.Value);
}
writer.WriteEndElement();
#endregion Videos
// End of File
writer.WriteEndElement(); //end of root
writer.WriteEndDocument();
writer.Flush();
writer.Close();
}
}
@@ -396,9 +390,7 @@ namespace Vocaluxe.Base
List<string> files = CHelper.ListFiles(path, "*.xml", false);
foreach (string file in files)
{
AddTheme(Path.Combine(path, file), -1);
}
}
public static bool AddTheme(string FilePath, int PartyModeID)
@@ -415,7 +407,7 @@ namespace Vocaluxe.Base
if (version == ThemeSystemVersion)
{
xmlReader.GetValue("//root/Info/Name", ref theme.Name, String.Empty);
if (theme.Name != String.Empty)
if (theme.Name.Length > 0)
{
xmlReader.GetValue("//root/Info/Author", ref theme.Author, String.Empty);
xmlReader.GetValue("//root/Info/SkinFolder", ref theme.SkinFolder, String.Empty);
@@ -436,7 +428,7 @@ namespace Vocaluxe.Base
else
msg += "the file is for newer program versions! ";
msg += "Current ThemeSystemVersion is " + ThemeSystemVersion.ToString();
msg += "Current ThemeSystemVersion is " + ThemeSystemVersion.ToString() + " but found " + version;
CLog.LogError(msg);
}
return true;
@@ -452,7 +444,7 @@ namespace Vocaluxe.Base
CLog.LogError("Error List Skins. Can't find Theme: " + CConfig.Theme);
return;
}
ListSkins(themeIndex);
ListSkins(themeIndex);
}
public static void ListSkins(int ThemeIndex)
@@ -482,7 +474,7 @@ namespace Vocaluxe.Base
if (version == SkinSystemVersion)
{
xmlReader.GetValue("//root/Info/Name", ref skin.Name, String.Empty);
if (skin.Name != String.Empty)
if (skin.Name.Length > 0)
{
xmlReader.GetValue("//root/Info/Author", ref skin.Author, String.Empty);
xmlReader.TryGetIntValue("//root/Info/SkinVersionMajor", ref skin.SkinVersionMajor);
@@ -536,15 +528,11 @@ namespace Vocaluxe.Base
for (int i = 0; i < _Skins.Count; i++)
{
if (PartyModeID != -1 && _Skins[i].PartyModeID == PartyModeID)
{
return i;
}
else if (PartyModeID == -1 && _Skins[i].Name == CConfig.Skin)
{
return i;
}
}
return -1;
}
@@ -553,13 +541,9 @@ namespace Vocaluxe.Base
for (int i = 0; i < _Themes.Count; i++)
{
if (PartyModeID != -1 && _Themes[i].PartyModeID == PartyModeID)
{
return i;
}
else if (PartyModeID == -1 && _Themes[i].Name == CConfig.Theme)
{
return i;
}
}
return -1;
@@ -585,9 +569,7 @@ namespace Vocaluxe.Base
{
int SkinIndex = GetSkinIndex(PartyModeID);
if (SkinIndex != -1 && TextureName != null && _Skins[SkinIndex].SkinList.ContainsKey(TextureName))
{
return _Skins[SkinIndex].SkinList[TextureName].Texture;
}
return new STexture(-1);
}
@@ -766,7 +748,7 @@ namespace Vocaluxe.Base
{
string value = String.Empty;
xmlReader.GetValue("//root/Cursor/Skin", ref Cursor.SkinName, value);
xmlReader.TryGetFloatValue("//root/Cursor/W", ref Cursor.w);
xmlReader.TryGetFloatValue("//root/Cursor/H", ref Cursor.h);
@@ -834,10 +816,8 @@ namespace Vocaluxe.Base
writer.WriteElementString("W", Cursor.w.ToString("#0.000"));
writer.WriteElementString("H", Cursor.h.ToString("#0.000"));
if (Cursor.color != String.Empty)
{
if (Cursor.color.Length > 0)
writer.WriteElementString("Color", Cursor.color);
}
else
{
writer.WriteElementString("R", Cursor.r.ToString("#0.000"));
@@ -853,25 +833,15 @@ namespace Vocaluxe.Base
#region Color Handling
public static SColorF GetColor(string ColorName, int PartyModeID)
{
SColorF color = new SColorF(1f, 1f, 1f, 1f);
SColorF color;
int SkinIndex = GetSkinIndex(PartyModeID);
foreach (SColorScheme scheme in _Skins[SkinIndex].ThemeColors.ColorSchemes)
{
if (scheme.Name == ColorName)
{
color.R = scheme.Color.R;
color.G = scheme.Color.G;
color.B = scheme.Color.B;
color.A = scheme.Color.A;
return color;
}
}
return GetPlayerColor(ColorName);
GetColor(ColorName, SkinIndex, out color);
return color;
}
public static bool GetColor(string ColorName, int SkinIndex, ref SColorF Color)
public static bool GetColor(string ColorName, int SkinIndex, out SColorF Color)
{
foreach (SColorScheme scheme in _Skins[SkinIndex].ThemeColors.ColorSchemes)
{
@@ -883,7 +853,7 @@ namespace Vocaluxe.Base
}
bool success;
GetPlayerColor(ColorName, GetSkinIndex(-1), out success);
Color = GetPlayerColor(ColorName, GetSkinIndex(-1), out success);
return success;
}
@@ -907,19 +877,9 @@ namespace Vocaluxe.Base
public static SColorF GetPlayerColor(string PlayerNrString, int SkinIndex, out bool success)
{
SColorF color = new SColorF(1f, 1f, 1f, 1f);
if (_Skins[SkinIndex].PartyModeID != -1)
SkinIndex = GetSkinIndex(-1);
int selection = -1;
for (int i = 0; i < _Skins[SkinIndex].ThemeColors.Player.Length; i++)
{
if (PlayerNrString == "Player" + (i + 1).ToString())
{
selection = i + 1;
break;
}
}
int selection = 0;
if (PlayerNrString.StartsWith("Player"))
int.TryParse(PlayerNrString.Substring(6), out selection);
return GetPlayerColor(selection, SkinIndex, out success);
}
@@ -945,4 +905,4 @@ namespace Vocaluxe.Base
}
#endregion Color Handling
}
}
}
+35 -56
View File
@@ -1,22 +1,16 @@
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Drawing;
using System.Globalization;
using System.IO;
using System.Text;
using System.Windows.Forms;
using Vocaluxe.Lib.Draw;
using Vocaluxe.Menu;
using VocaluxeLib.Menu;
namespace Vocaluxe.Base
{
static class CTime
{
private static Stopwatch _Stopwatch = new Stopwatch();
private static float _fps = 0.0f;
private static double nanosecPerTick = (1000.0 * 1000.0 * 1000.0) / Stopwatch.Frequency;
private static readonly Stopwatch _Stopwatch = new Stopwatch();
private static float _fps;
private static readonly double nanosecPerTick = (1000.0 * 1000.0 * 1000.0) / Stopwatch.Frequency;
public static void Reset()
{
@@ -28,7 +22,6 @@ namespace Vocaluxe.Base
_Stopwatch.Start();
}
public static void Restart()
{
Reset();
@@ -48,7 +41,7 @@ namespace Vocaluxe.Base
if (Stopwatch.IsHighResolution && ticks != 0)
return (float)((nanosecPerTick * ticks) / (1000.0 * 1000.0));
else
return (float)_Stopwatch.ElapsedMilliseconds;
return _Stopwatch.ElapsedMilliseconds;
}
else
return 0f;
@@ -59,14 +52,11 @@ namespace Vocaluxe.Base
float ms = GetMilliseconds();
if (ms > 0)
{
_fps = 1 / ms;
}
return _fps * 1000f;
}
public static double GetFPS()
{
return _fps * 1000f;
@@ -75,10 +65,10 @@ namespace Vocaluxe.Base
class CKeys
{
private List<KeyEvent> _KeysPool;
private List<KeyEvent> _ActualPool;
private readonly List<KeyEvent> _KeysPool;
private readonly List<KeyEvent> _ActualPool;
private Object _CopyLock = new Object();
private readonly Object _CopyLock = new Object();
private bool _ModALT;
private bool _ModCTRL;
@@ -86,8 +76,7 @@ namespace Vocaluxe.Base
private bool _KeyPressed;
private Keys _Keys;
private Char _char;
private System.Diagnostics.Stopwatch _timer;
private readonly Stopwatch _timer;
public CKeys()
{
@@ -100,7 +89,7 @@ namespace Vocaluxe.Base
_KeysPool = new List<KeyEvent>();
_ActualPool = new List<KeyEvent>();
_timer = new System.Diagnostics.Stopwatch();
_timer = new Stopwatch();
}
private void Add(bool alt, bool shift, bool ctrl, bool pressed, char unicode, Keys key)
@@ -121,12 +110,9 @@ namespace Vocaluxe.Base
{
_KeysPool.Add(pool);
}
catch (Exception)
{
}
catch (Exception) {}
}
_timer.Reset();
_timer.Start();
}
@@ -141,11 +127,10 @@ namespace Vocaluxe.Base
{
Keys keys = Control.ModifierKeys;
_ModSHIFT = ((keys & Keys.Shift) == Keys.Shift);
_ModALT = ((keys & Keys.Alt) == Keys.Alt);
_ModCTRL = ((keys & Keys.Control) == Keys.Control);
_ModSHIFT = (keys & Keys.Shift) == Keys.Shift;
_ModALT = (keys & Keys.Alt) == Keys.Alt;
_ModCTRL = (keys & Keys.Control) == Keys.Control;
}
public void KeyDown(KeyEventArgs e)
{
@@ -168,7 +153,7 @@ namespace Vocaluxe.Base
public void KeyPress(KeyPressEventArgs e)
{
CheckModifiers();
Add(_ModALT, _ModSHIFT, _ModCTRL, true, e.KeyChar, Keys.None);
_char = e.KeyChar;
_KeyPressed = true;
@@ -188,7 +173,8 @@ namespace Vocaluxe.Base
Del(0);
return true;
}
else return false;
else
return false;
}
public void CopyEvents()
@@ -196,30 +182,27 @@ namespace Vocaluxe.Base
lock (_CopyLock)
{
foreach (KeyEvent e in _KeysPool)
{
_ActualPool.Add(e);
}
_KeysPool.Clear();
}
}
}
class CMouse
{
private List<MouseEvent> _EventsPool;
private List<MouseEvent> _CurrentPool;
private readonly List<MouseEvent> _EventsPool;
private readonly List<MouseEvent> _CurrentPool;
private int _x = 0;
private int _y = 0;
private Object _CopyLock = new Object();
private int _x;
private int _y;
private readonly Object _CopyLock = new Object();
private bool _ModALT;
private bool _ModCTRL;
private bool _ModSHIFT;
private System.Diagnostics.Stopwatch _timer;
private readonly Stopwatch _timer;
public int X
{
@@ -242,19 +225,19 @@ namespace Vocaluxe.Base
_EventsPool = new List<MouseEvent>();
_CurrentPool = new List<MouseEvent>();
_timer = new System.Diagnostics.Stopwatch();
_timer = new Stopwatch();
}
private void Add(bool alt, bool shift, bool ctrl, int x, int y, bool lb, bool ld, bool rb, int wheel, bool lbh, bool rbh, bool mb, bool mbh)
{
x = (int)((float)x * (float)CSettings.iRenderW / (float)CDraw.GetScreenWidth());
y = (int)((float)y * (float)CSettings.iRenderH / (float)CDraw.GetScreenHeight());
x = (int)(x * (float)CSettings.iRenderW / CDraw.GetScreenWidth());
y = (int)(y * (float)CSettings.iRenderH / CDraw.GetScreenHeight());
MouseEvent pool = new MouseEvent(ESender.Mouse, alt, shift, ctrl, x, y, lb, ld, rb, -wheel / 120, lbh, rbh, mb, mbh);
lock (_CopyLock)
{
_EventsPool.Add(pool);
_EventsPool.Add(pool);
}
_x = x;
_y = y;
@@ -269,9 +252,9 @@ namespace Vocaluxe.Base
{
Keys keys = Control.ModifierKeys;
_ModSHIFT = ((keys & Keys.Shift) == Keys.Shift);
_ModALT = ((keys & Keys.Alt) == Keys.Alt);
_ModCTRL = ((keys & Keys.Control) == Keys.Control);
_ModSHIFT = (keys & Keys.Shift) == Keys.Shift;
_ModALT = (keys & Keys.Alt) == Keys.Alt;
_ModCTRL = (keys & Keys.Control) == Keys.Control;
}
public void MouseMove(MouseEventArgs e)
@@ -308,9 +291,7 @@ namespace Vocaluxe.Base
}
}
else
{
_timer.Reset();
}
Add(_ModALT, _ModSHIFT, _ModCTRL, e.X, e.Y, lb, ld, e.Button == MouseButtons.Right, e.Delta, false, false,
e.Button == MouseButtons.Middle, false);
@@ -330,7 +311,8 @@ namespace Vocaluxe.Base
Del(0);
return true;
}
else return false;
else
return false;
}
public void CopyEvents()
@@ -338,12 +320,9 @@ namespace Vocaluxe.Base
lock (_CopyLock)
{
foreach (MouseEvent e in _EventsPool)
{
_CurrentPool.Add(e);
}
_EventsPool.Clear();
}
}
}
}
}
+4 -10
View File
@@ -1,11 +1,7 @@
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Diagnostics;
using System.Drawing;
using System.Text;
using Vocaluxe.Menu;
using Vocaluxe.Lib.Video;
using VocaluxeLib.Menu;
namespace Vocaluxe.Base
{
@@ -99,7 +95,6 @@ namespace Vocaluxe.Base
{
_VideoDecoder.Update();
}
#endregion Interface
#endregion VideoDecoder
@@ -109,7 +104,7 @@ namespace Vocaluxe.Base
{
private STexture _VideoTexture;
private int _VideoStream;
private Stopwatch _VideoTimer;
private readonly Stopwatch _VideoTimer;
private bool _Finished;
private bool _Loaded;
@@ -159,7 +154,6 @@ namespace Vocaluxe.Base
{
if (!_Finished)
{
float VideoTime = _VideoTimer.ElapsedMilliseconds / 1000f;
_Finished = CVideo.VdFinished(_VideoStream);
@@ -200,4 +194,4 @@ namespace Vocaluxe.Base
_VideoTimer.Reset();
}
}
}
}
+3 -9
View File
@@ -1,12 +1,6 @@
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Text;
using System.Drawing;
using Vocaluxe.Lib.Webcam;
using Vocaluxe.Lib.Draw;
using Vocaluxe.Menu;
using VocaluxeLib.Menu;
namespace Vocaluxe.Base
{
@@ -74,4 +68,4 @@ namespace Vocaluxe.Base
return _Webcam.GetDevices();
}
}
}
}
+7 -14
View File
@@ -1,10 +1,7 @@
using System;
using System.Collections.Generic;
using System.Text;
using System.Collections.Generic;
using Vocaluxe.Base;
using Vocaluxe.Menu;
using Vocaluxe.Menu.SongMenu;
using VocaluxeLib.Menu;
using VocaluxeLib.Menu.SongMenu;
namespace Vocaluxe.GameModes
{
@@ -37,9 +34,7 @@ namespace Vocaluxe.GameModes
public virtual EGameMode GetCurrentGameMode()
{
if (_CurrentSong >= 0 && _CurrentSong < _SongQueque.Count)
{
return _SongQueque[_CurrentSong].GameMode;
}
return EGameMode.TR_GAMEMODE_NORMAL;
}
@@ -153,7 +148,7 @@ namespace Vocaluxe.GameModes
public virtual bool IsFinished()
{
return (_CurrentSong == _SongQueque.Count || _SongQueque.Count == 0);
return _CurrentSong == _SongQueque.Count || _SongQueque.Count == 0;
}
public virtual int GetCurrentRoundNr()
@@ -210,7 +205,7 @@ namespace Vocaluxe.GameModes
public virtual EGameMode GetGameMode(int Num)
{
if(Num - 1 < _SongQueque.Count && Num > -1)
if (Num - 1 < _SongQueque.Count && Num > -1)
return _SongQueque[Num].GameMode;
return EGameMode.TR_GAMEMODE_NORMAL;
@@ -222,8 +217,6 @@ namespace Vocaluxe.GameModes
}
#endregion Implementation
protected virtual void SongManipulation(int SongIndex)
{
}
protected virtual void SongManipulation(int SongIndex) {}
}
}
}
+2 -6
View File
@@ -1,8 +1,4 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace Vocaluxe.GameModes
namespace Vocaluxe.GameModes
{
// Nomal singing
class CGameModeNormal : CGameMode
@@ -14,4 +10,4 @@ namespace Vocaluxe.GameModes
_Initialized = true;
}
}
}
}
+4 -9
View File
@@ -1,10 +1,5 @@
using System;
using System.Collections.Generic;
using System.Text;
using Vocaluxe.Base;
using Vocaluxe.Menu;
using Vocaluxe.Menu.SongMenu;
using VocaluxeLib.Menu;
using VocaluxeLib.Menu.SongMenu;
namespace Vocaluxe.GameModes
{
@@ -25,7 +20,7 @@ namespace Vocaluxe.GameModes
void NextRound(SPlayer[] Player);
bool IsFinished();
int GetCurrentRoundNr();
CPoints GetPoints();
int GetNumSongs();
@@ -33,4 +28,4 @@ namespace Vocaluxe.GameModes
CSong GetSong(int Num);
EGameMode GetGameMode(int Num);
}
}
}
+59
View File
@@ -0,0 +1,59 @@
// Diese Datei wird von der Codeanalyse zur Wartung der SuppressMessage-
// Attribute verwendet, die auf dieses Projekt angewendet werden.
// Unterdrückungen auf Projektebene haben entweder kein Ziel oder
// erhalten ein spezifisches Ziel mit Namespace-, Typ-, Memberbereich usw.
//
// Wenn Sie dieser Datei eine Unterdrückung hinzufügen möchten, klicken Sie mit der
// rechten Maustaste auf die Meldung in der Fehlerliste, zeigen Sie auf
// "Meldung(en) unterdrücken", und klicken Sie auf "In Projektunterdrückungsdatei".
// Sie müssen dieser Datei nicht manuell Unterdrückungen hinzufügen.
using System.Diagnostics.CodeAnalysis;
[assembly:
SuppressMessage("Microsoft.Reliability", "CA2001:AvoidCallingProblematicMethods", MessageId = "System.Reflection.Assembly.LoadFrom", Scope = "member",
Target = "Vocaluxe.MainProgram.#AssemblyResolver(System.Object,System.ResolveEventArgs)")]
[assembly:
SuppressMessage("Microsoft.Reliability", "CA2000:Objekte verwerfen, bevor Bereich verloren geht", Scope = "member",
Target = "Vocaluxe.Lib.Draw.CDrawWinForm.#ColorizeBitmap(System.Drawing.Bitmap,Vocaluxe.Menu.SColorF)")]
[assembly:
SuppressMessage("Microsoft.Reliability", "CA2000:Objekte verwerfen, bevor Bereich verloren geht", Scope = "member",
Target = "Vocaluxe.Lib.Draw.CDrawWinForm.#CopyScreen(Vocaluxe.Menu.STexture&)")]
[assembly:
SuppressMessage("Microsoft.Reliability", "CA2000:Objekte verwerfen, bevor Bereich verloren geht", Scope = "member",
Target = "Vocaluxe.Base.CGlyph.#.ctor(System.Char,System.Single)")]
[assembly:
SuppressMessage("Microsoft.Reliability", "CA2000:Objekte verwerfen, bevor Bereich verloren geht", Scope = "member",
Target = "Vocaluxe.Lib.Draw.CDirect3D.#AddTexture(System.Drawing.Bitmap,System.String)")]
[assembly:
SuppressMessage("Microsoft.Reliability", "CA2000:Objekte verwerfen, bevor Bereich verloren geht", Scope = "member",
Target = "Vocaluxe.Lib.Draw.CDirect3D.#AddTexture(System.Int32,System.Int32,System.Byte[]&)")]
[assembly: SuppressMessage("Microsoft.Reliability", "CA2000:Objekte verwerfen, bevor Bereich verloren geht", Scope = "member", Target = "Vocaluxe.Lib.Draw.CDirect3D.#CopyScreen()")
]
[assembly: SuppressMessage("Microsoft.Design", "CA1008:EnumsShouldHaveZeroValue", Scope = "type", Target = "Vocaluxe.Lib.Input.WiiMote.InputReport")]
[assembly: SuppressMessage("Microsoft.Design", "CA1008:EnumsShouldHaveZeroValue", Scope = "type", Target = "PortAudioSharp.PortAudio+PaDeviceIndex")]
[assembly: SuppressMessage("Microsoft.Design", "CA1008:EnumsShouldHaveZeroValue", Scope = "type", Target = "PortAudioSharp.PortAudio+PaSampleFormat")]
[assembly: SuppressMessage("Microsoft.Design", "CA1008:EnumsShouldHaveZeroValue", Scope = "type", Target = "PortAudioSharp.PortAudio+PaStreamCallbackFlags")]
[assembly:
SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Scope = "member",
Target = "Vocaluxe.Lib.Video.Gstreamer.CGstreamerVideoWrapper.#GetFrame(System.Int32,System.Single)")]
[assembly:
SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Scope = "member",
Target = "Vocaluxe.Lib.Input.CHIDAPI.#ReadTimeout(System.IntPtr,System.Byte[]&,System.Int32,System.Int32)")]
[assembly:
SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Scope = "member",
Target = "Vocaluxe.Lib.Input.CHIDAPI.#Read(System.IntPtr,System.Byte[]&,System.Int32)")]
[assembly: SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Scope = "member", Target = "PortAudioSharp.PortAudio.#Pa_GetVersionText()")]
[assembly:
SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Scope = "member",
Target = "PortAudioSharp.PortAudio.#Pa_GetErrorText(PortAudioSharp.PortAudio+PaError)")]
[assembly:
SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Scope = "member",
Target = "PortAudioSharp.PortAudio.#Pa_GetHostApiInfo(System.Int32)")]
[assembly:
SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Scope = "member", Target = "PortAudioSharp.PortAudio.#Pa_GetLastHostErrorInfo()")]
[assembly:
SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Scope = "member",
Target = "PortAudioSharp.PortAudio.#Pa_GetDeviceInfo(System.Int32)")]
[assembly:
SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Scope = "member",
Target = "PortAudioSharp.PortAudio.#Pa_GetStreamInfo(System.IntPtr)")]
File diff suppressed because it is too large. Load diff
+83 -111
View File
@@ -1,65 +1,64 @@
using System;
using System.ComponentModel;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Drawing.Imaging;
using System.IO;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading;
using System.Windows.Forms;
using Vocaluxe.Base;
using Vocaluxe.Menu;
using VocaluxeLib.Menu;
namespace Vocaluxe.Lib.Draw
{
class CDrawWinForm : Form, IDraw
{
private bool _Run;
private Bitmap _backbuffer;
private Graphics _g;
private bool _fullscreen = false;
private CKeys _Keys;
private CMouse _Mouse;
private readonly Bitmap _backbuffer;
private readonly Graphics _g;
private bool _fullscreen;
private readonly CKeys _Keys;
private readonly CMouse _Mouse;
private FormBorderStyle _brdStyle;
private bool _topMost;
private Rectangle _bounds;
private List<STexture> _Textures;
private List<Bitmap> _Bitmaps;
private Color ClearColor = Color.DarkBlue;
private readonly List<STexture> _Textures;
private readonly List<Bitmap> _Bitmaps;
private readonly Color ClearColor = Color.DarkBlue;
public CDrawWinForm()
{
this.Icon = new System.Drawing.Icon(Path.Combine(System.Environment.CurrentDirectory, CSettings.sIcon));
Icon = new Icon(Path.Combine(Environment.CurrentDirectory, CSettings.sIcon));
_Textures = new List<STexture>();
_Bitmaps = new List<Bitmap>();
_Keys = new CKeys();
_Mouse = new CMouse();
this.ClientSize = new Size(1280, 720);
ClientSize = new Size(1280, 720);
this.SetStyle(ControlStyles.AllPaintingInWmPaint | ControlStyles.UserPaint | ControlStyles.OptimizedDoubleBuffer | ControlStyles.Opaque, true);
SetStyle(ControlStyles.AllPaintingInWmPaint | ControlStyles.UserPaint | ControlStyles.OptimizedDoubleBuffer | ControlStyles.Opaque, true);
// Create the backbuffer
_backbuffer = new Bitmap(CSettings.iRenderW, CSettings.iRenderH);
_g = Graphics.FromImage(_backbuffer);
_g.Clear(Color.DarkBlue);
this.Paint += new PaintEventHandler(this.OnPaintEvent);
this.Closing += new CancelEventHandler(this.OnClosingEvent);
this.KeyDown += new KeyEventHandler(this.OnKeyDownEvent);
this.KeyPress += new KeyPressEventHandler(this.OnKeyPressEvent);
this.KeyUp += new KeyEventHandler(this.OnKeyUpEvent);
this.Resize += new EventHandler(this.OnResizeEvent);
Paint += OnPaintEvent;
Closing += OnClosingEvent;
KeyDown += OnKeyDownEvent;
KeyPress += OnKeyPressEvent;
KeyUp += OnKeyUpEvent;
Resize += OnResizeEvent;
this.MouseMove += new MouseEventHandler(this.OnMouseMove);
this.MouseDown += new MouseEventHandler(this.OnMouseDown);
this.MouseUp += new MouseEventHandler(this.OnMouseUp);
MouseMove += OnMouseMove;
MouseDown += OnMouseDown;
MouseUp += OnMouseUp;
FlipBuffer();
Cursor.Show();
@@ -73,33 +72,29 @@ namespace Vocaluxe.Lib.Draw
private void DrawBuffer()
{
Graphics gFrontBuffer = Graphics.FromHwnd(this.Handle);
int h = this.ClientSize.Height;
int w = this.ClientSize.Width;
Graphics gFrontBuffer = Graphics.FromHwnd(Handle);
int h = ClientSize.Height;
int w = ClientSize.Width;
int y = 0;
int x = 0;
if ((float)this.ClientSize.Width / (float)this.ClientSize.Height > CSettings.GetRenderAspect())
if (ClientSize.Width / (float)ClientSize.Height > CSettings.GetRenderAspect())
{
w = (int)Math.Round((float)this.ClientSize.Height * CSettings.GetRenderAspect());
x = (this.ClientSize.Width - w) / 2;
w = (int)Math.Round(ClientSize.Height * CSettings.GetRenderAspect());
x = (ClientSize.Width - w) / 2;
}
else
{
h = (int)Math.Round((float)this.ClientSize.Width / CSettings.GetRenderAspect());
y = (this.ClientSize.Height - h) / 2;
h = (int)Math.Round(ClientSize.Width / CSettings.GetRenderAspect());
y = (ClientSize.Height - h) / 2;
}
gFrontBuffer.DrawImage(_backbuffer, new Rectangle(x, y, w, h), new Rectangle(0, 0, _backbuffer.Width, _backbuffer.Height), GraphicsUnit.Pixel);
}
private void OnPaintEvent(object sender, PaintEventArgs e)
{
}
private void OnPaintEvent(object sender, PaintEventArgs e) {}
#region FullScreenStuff
private void ToggleFullScreen()
{
if (!_fullscreen)
@@ -144,7 +139,7 @@ namespace Vocaluxe.Lib.Draw
private void OnResizeEvent(object sender, EventArgs e)
{
Graphics gFrontBuffer = Graphics.FromHwnd(this.Handle);
Graphics gFrontBuffer = Graphics.FromHwnd(Handle);
gFrontBuffer.Clear(Color.Black);
}
@@ -174,17 +169,17 @@ namespace Vocaluxe.Lib.Draw
}
}
private void OnKeyDownEvent(object sender, System.Windows.Forms.KeyEventArgs e)
private void OnKeyDownEvent(object sender, KeyEventArgs e)
{
_Keys.KeyDown(e);
}
private void OnKeyPressEvent(object sender, System.Windows.Forms.KeyPressEventArgs e)
private void OnKeyPressEvent(object sender, KeyPressEventArgs e)
{
_Keys.KeyPress(e);
}
private void OnKeyUpEvent(object sender, System.Windows.Forms.KeyEventArgs e)
private void OnKeyUpEvent(object sender, KeyEventArgs e)
{
_Keys.KeyUp(e);
}
@@ -208,7 +203,7 @@ namespace Vocaluxe.Lib.Draw
public bool Init()
{
this.Text = CSettings.GetFullVersionText();
Text = CSettings.GetFullVersionText();
return true;
}
@@ -216,7 +211,7 @@ namespace Vocaluxe.Lib.Draw
{
_Run = true;
int delay = 0;
this.Show();
Show();
if (CConfig.FullScreen == EOffOn.TR_CONFIG_ON)
{
@@ -232,7 +227,7 @@ namespace Vocaluxe.Lib.Draw
{
_Run = _Run && CGraphics.Draw();
_Run = CGraphics.UpdateGameLogic(_Keys, _Mouse);
FlipBuffer();
FlipBuffer();
if ((CSettings.bFullScreen && !_fullscreen) || (!CSettings.bFullScreen && _fullscreen))
ToggleFullScreen();
@@ -241,30 +236,29 @@ namespace Vocaluxe.Lib.Draw
delay = (int)Math.Floor(CConfig.CalcCycleTime() - CTime.GetMilliseconds());
if (delay >= 1)
System.Threading.Thread.Sleep(delay);
Thread.Sleep(delay);
CTime.CalculateFPS();
CTime.Restart();
}
else
this.Close();
}
Close();
}
public bool Unload()
{
this.Dispose();
Dispose();
return true;
}
public int GetScreenWidth()
{
return this.ClientSize.Width;
return ClientSize.Width;
}
public int GetScreenHeight()
{
return this.ClientSize.Height;
return ClientSize.Height;
}
public RectangleF GetTextBounds(CText text)
@@ -275,7 +269,7 @@ namespace Vocaluxe.Lib.Draw
public RectangleF GetTextBounds(CText text, float Height)
{
CFonts.Height = Height;
CFonts.SetFont(text.Fon);
CFonts.SetFont(text.Font);
CFonts.Style = text.Style;
return new RectangleF(text.X, text.Y, CFonts.GetTextWidth(CLanguage.Translate(text.Text)), CFonts.GetTextHeight(CLanguage.Translate(text.Text)));
}
@@ -312,16 +306,14 @@ namespace Vocaluxe.Lib.Draw
Texture = CopyScreen();
}
else
{
_Bitmaps[Texture.index] = new Bitmap(_backbuffer);
}
}
public void MakeScreenShot()
{
string file = "Screenshot_";
string path = Path.Combine(Environment.CurrentDirectory, CSettings.sFolderScreenshots);
int i = 0;
while (File.Exists(Path.Combine(path, file + i.ToString("00000") + ".png")))
i++;
@@ -346,16 +338,9 @@ namespace Vocaluxe.Lib.Draw
CFonts.DrawText(Text, h, x, y, z, new SColorF(1, 1, 1, 1));
}
public void DrawColor(SColorF color, SRectF rect) {}
public void DrawColor(SColorF color, SRectF rect)
{
}
public void DrawColorReflection(SColorF color, SRectF rect, float space, float height)
{
}
public void DrawColorReflection(SColorF color, SRectF rect, float space, float height) {}
public STexture AddTexture(Bitmap bmp)
{
@@ -381,10 +366,10 @@ namespace Vocaluxe.Lib.Draw
public STexture AddTexture(string TexturePath)
{
STexture texture = new STexture();
if (System.IO.File.Exists(TexturePath))
if (File.Exists(TexturePath))
{
bool found = false;
foreach(STexture tex in _Textures)
foreach (STexture tex in _Textures)
{
if (tex.TexturePath == TexturePath)
{
@@ -396,11 +381,11 @@ namespace Vocaluxe.Lib.Draw
if (!found)
{
Bitmap bmp = new Bitmap(TexturePath);
return AddTexture(bmp);
using (Bitmap bmp = new Bitmap(TexturePath))
return AddTexture(bmp);
}
}
return texture;
}
@@ -433,11 +418,13 @@ namespace Vocaluxe.Lib.Draw
public STexture AddTexture(int W, int H, ref byte[] Data)
{
Bitmap bmp = new Bitmap(W, H);
BitmapData bmp_data = bmp.LockBits(new Rectangle(0, 0, bmp.Width, bmp.Height), ImageLockMode.ReadWrite, System.Drawing.Imaging.PixelFormat.Format32bppArgb);
Marshal.Copy(Data, 0, bmp_data.Scan0, Data.Length);
bmp.UnlockBits(bmp_data);
return AddTexture(bmp);
using (Bitmap bmp = new Bitmap(W, H))
{
BitmapData bmp_data = bmp.LockBits(new Rectangle(0, 0, bmp.Width, bmp.Height), ImageLockMode.ReadWrite, PixelFormat.Format32bppArgb);
Marshal.Copy(Data, 0, bmp_data.Scan0, Data.Length);
bmp.UnlockBits(bmp_data);
return AddTexture(bmp);
}
}
public bool UpdateTexture(ref STexture Texture, IntPtr Data)
@@ -450,7 +437,7 @@ namespace Vocaluxe.Lib.Draw
if ((Texture.index >= 0) && (_Textures.Count > 0) && (_Bitmaps.Count > Texture.index))
{
BitmapData bmp_data = _Bitmaps[Texture.index].LockBits(new Rectangle(0, 0, _Bitmaps[Texture.index].Width, _Bitmaps[Texture.index].Height),
ImageLockMode.ReadWrite, System.Drawing.Imaging.PixelFormat.Format32bppArgb);
ImageLockMode.ReadWrite, PixelFormat.Format32bppArgb);
Marshal.Copy(Data, 0, bmp_data.Scan0, Data.Length);
_Bitmaps[Texture.index].UnlockBits(bmp_data);
}
@@ -460,41 +447,31 @@ namespace Vocaluxe.Lib.Draw
public void DrawTexture(STexture Texture)
{
if ((Texture.index >= 0) && (_Textures.Count > 0) && (_Bitmaps.Count > Texture.index))
{
DrawTexture(Texture, Texture.rect, Texture.color);
}
DrawTexture(Texture, Texture.rect, Texture.color);
}
public void DrawTexture(STexture Texture, SRectF rect)
{
if ((Texture.index >= 0) && (_Textures.Count > 0) && (_Bitmaps.Count > Texture.index))
{
DrawTexture(Texture, rect, Texture.color);
}
}
public void DrawTexture(STexture Texture, SRectF rect, SColorF color)
{
if ((Texture.index >= 0) && (_Textures.Count > 0) && (_Bitmaps.Count > Texture.index))
{
DrawTexture(Texture, rect, color, rect, false);
}
DrawTexture(Texture, rect, color, rect, false);
}
public void DrawTexture(STexture Texture, SRectF rect, SColorF color, SRectF bounds)
{
if ((Texture.index >= 0) && (_Textures.Count > 0) && (_Bitmaps.Count > Texture.index))
{
DrawTexture(Texture, rect, color, bounds, false);
}
}
public void DrawTexture(STexture Texture, SRectF rect, SColorF color, bool mirrored)
{
if ((Texture.index >= 0) && (_Textures.Count > 0) && (_Bitmaps.Count > Texture.index))
{
DrawTexture(Texture, rect, color, rect, mirrored);
}
}
public void DrawTexture(STexture Texture, SRectF rect, SColorF color, SRectF bounds, bool mirrored)
@@ -507,14 +484,9 @@ namespace Vocaluxe.Lib.Draw
}
}
public void DrawTexture(STexture Texture, SRectF rect, SColorF color, float begin, float end)
{
public void DrawTexture(STexture Texture, SRectF rect, SColorF color, float begin, float end) {}
}
public void DrawTextureReflection(STexture Texture, SRectF rect, SColorF color, SRectF bounds, float space, float height)
{
}
public void DrawTextureReflection(STexture Texture, SRectF rect, SColorF color, SRectF bounds, float space, float height) {}
public int TextureCount()
{
@@ -525,25 +497,25 @@ namespace Vocaluxe.Lib.Draw
{
Bitmap newBitmap = new Bitmap(original.Width, original.Height);
Graphics g = Graphics.FromImage(newBitmap);
using (Graphics g = Graphics.FromImage(newBitmap))
{
ColorMatrix cm = new ColorMatrix();
cm.Matrix33 = color.A;
cm.Matrix00 = color.R;
cm.Matrix11 = color.G;
cm.Matrix22 = color.B;
cm.Matrix44 = 1;
ColorMatrix cm = new ColorMatrix();
cm.Matrix33 = color.A;
cm.Matrix00 = color.R;
cm.Matrix11 = color.G;
cm.Matrix22 = color.B;
cm.Matrix44 = 1;
using (ImageAttributes ia = new ImageAttributes())
{
ia.SetColorMatrix(cm);
ImageAttributes ia = new ImageAttributes();
ia.SetColorMatrix(cm);
g.DrawImage(original, new Rectangle(0, 0, original.Width, original.Height),
0, 0, original.Width, original.Height, GraphicsUnit.Pixel, ia);
ia.Dispose();
g.Dispose();
g.DrawImage(original, new Rectangle(0, 0, original.Width, original.Height),
0, 0, original.Width, original.Height, GraphicsUnit.Pixel, ia);
}
}
return newBitmap;
}
}
}
}
File diff suppressed because it is too large. Load diff
+4 -8
View File
@@ -1,10 +1,6 @@
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Text;
using Vocaluxe.Base;
using Vocaluxe.Menu;
using VocaluxeLib.Menu;
namespace Vocaluxe.Lib.Draw
{
@@ -19,7 +15,7 @@ namespace Vocaluxe.Lib.Draw
RectangleF GetTextBounds(CText text);
RectangleF GetTextBounds(CText text, float Height);
// Basic Draw Methods
void DrawLine(int a, int r, int g, int b, int w, int x1, int y1, int x2, int y2);
void DrawColor(SColorF color, SRectF rect);
@@ -40,7 +36,7 @@ namespace Vocaluxe.Lib.Draw
STexture QuequeTexture(int W, int H, ref byte[] Data);
bool UpdateTexture(ref STexture Texture, ref byte[] Data);
bool UpdateTexture(ref STexture Texture, IntPtr Data);
void RemoveTexture(ref STexture Texture);
void DrawTexture(STexture Texture);
void DrawTexture(STexture Texture, SRectF rect);
@@ -55,4 +51,4 @@ namespace Vocaluxe.Lib.Draw
int TextureCount();
}
}
}
+35 -20
View File
@@ -1,9 +1,5 @@
using System;
using System.Collections.Generic;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading;
using Vocaluxe.Base;
namespace Vocaluxe.Lib.Input
@@ -11,8 +7,7 @@ namespace Vocaluxe.Lib.Input
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct HIDDeviceInfo
{
[MarshalAsAttribute(UnmanagedType.LPTStr)]
public String Path;
[MarshalAs(UnmanagedType.LPTStr)] public String Path;
public ushort VendorString;
public ushort ProductID;
public String SerialNumber;
@@ -22,8 +17,9 @@ namespace Vocaluxe.Lib.Input
public ushort UsagePage;
public ushort Usage;
public int InterfaceNumber;
public IntPtr Next;
internal IntPtr Next;
}
public static class CHIDAPI
{
#if ARCH_X86
@@ -46,9 +42,9 @@ namespace Vocaluxe.Lib.Input
#endif
#endif
[DllImport(HIDapiDll, ExactSpelling = false, CallingConvention = CallingConvention.Cdecl, EntryPoint = "hid_init", CharSet = CharSet.Unicode)]
private static extern int hid_init();
public static bool Init()
{
int result = -1;
@@ -56,12 +52,12 @@ namespace Vocaluxe.Lib.Input
{
result = hid_init();
}
catch(Exception e)
catch (Exception e)
{
CLog.LogError("Error CHIDAPI.Init(): " + e.ToString());
CLog.LogError("Error CHIDAPI.Init(): " + e);
return false;
}
if (result == 0)
return true;
@@ -70,6 +66,7 @@ namespace Vocaluxe.Lib.Input
[DllImport(HIDapiDll, ExactSpelling = false, CallingConvention = CallingConvention.Cdecl, EntryPoint = "hid_exit", CharSet = CharSet.Unicode)]
private static extern int hid_exit();
public static bool Exit()
{
int result = -1;
@@ -79,7 +76,7 @@ namespace Vocaluxe.Lib.Input
}
catch (Exception e)
{
CLog.LogError("Error CHIDAPI.Exit(): " + e.ToString());
CLog.LogError("Error CHIDAPI.Exit(): " + e);
return false;
}
@@ -88,15 +85,20 @@ namespace Vocaluxe.Lib.Input
return false;
}
[DllImport(HIDapiDll, ExactSpelling = false, CallingConvention = CallingConvention.Cdecl, EntryPoint = "hid_enumerate", CharSet = CharSet.Ansi)]
private static extern IntPtr hid_enumerate(ushort VendorID, ushort ProductID); //HIDDeviceInfo
public static IntPtr Enumerate(ushort VendorID, ushort ProductID) //HIDDeviceInfo
private static extern IntPtr hid_enumerate(ushort VendorID, ushort ProductID);
//HIDDeviceInfo
public static IntPtr Enumerate(ushort VendorID, ushort ProductID)
{
//HIDDeviceInfo
return hid_enumerate(VendorID, ProductID);
}
[DllImport(HIDapiDll, ExactSpelling = false, CallingConvention = CallingConvention.Cdecl, EntryPoint = "hid_free_enumeration", CharSet = CharSet.Unicode)]
private static extern void hid_free_enumeration(HIDDeviceInfo devs);
public static void FreeEnumeration(HIDDeviceInfo devs)
{
hid_free_enumeration(devs);
@@ -104,6 +106,7 @@ namespace Vocaluxe.Lib.Input
[DllImport(HIDapiDll, ExactSpelling = false, CallingConvention = CallingConvention.Cdecl, EntryPoint = "hid_open", CharSet = CharSet.Unicode)]
private static extern IntPtr hid_open(ushort VendorID, ushort ProductID, IntPtr SerialNumber);
public static bool Open(ushort VendorID, ushort ProductID, out IntPtr Handle)
{
Handle = IntPtr.Zero;
@@ -113,7 +116,7 @@ namespace Vocaluxe.Lib.Input
}
catch (Exception e)
{
CLog.LogError("Error CHIDAPI.Open(): " + e.ToString());
CLog.LogError("Error CHIDAPI.Open(): " + e);
return false;
}
@@ -121,11 +124,11 @@ namespace Vocaluxe.Lib.Input
return true;
return false;
}
[DllImport(HIDapiDll, ExactSpelling = false, CallingConvention = CallingConvention.Cdecl, EntryPoint = "hid_open_path", CharSet = CharSet.Unicode)]
private static extern IntPtr hid_open_path(string Path);
public static IntPtr OpenPath(string Path)
{
return hid_open_path(Path);
@@ -133,6 +136,7 @@ namespace Vocaluxe.Lib.Input
[DllImport(HIDapiDll, ExactSpelling = false, CallingConvention = CallingConvention.Cdecl, EntryPoint = "hid_write", CharSet = CharSet.Unicode)]
private static extern int hid_write(IntPtr device, byte[] data, int length);
public static int Write(IntPtr Device, byte[] Data)
{
return hid_write(Device, Data, Data.Length);
@@ -140,6 +144,7 @@ namespace Vocaluxe.Lib.Input
[DllImport(HIDapiDll, ExactSpelling = false, CallingConvention = CallingConvention.Cdecl, EntryPoint = "hid_read_timeout", CharSet = CharSet.Unicode)]
private static extern int hid_read_timeout(IntPtr device, IntPtr data, int length, int milliseconds);
public static int ReadTimeout(IntPtr Device, out byte[] Data, int length, int milliseconds)
{
Data = new byte[length];
@@ -153,7 +158,7 @@ namespace Vocaluxe.Lib.Input
catch (Exception e)
{
result = -1;
CLog.LogError("Error CHIDAPI.ReadTimeout(): " + e.ToString());
CLog.LogError("Error CHIDAPI.ReadTimeout(): " + e);
}
if (result != -1)
@@ -167,6 +172,7 @@ namespace Vocaluxe.Lib.Input
[DllImport(HIDapiDll, ExactSpelling = false, CallingConvention = CallingConvention.Cdecl, EntryPoint = "hid_read", CharSet = CharSet.Unicode)]
private static extern int hid_read(IntPtr device, IntPtr data, int length);
public static int Read(IntPtr Device, out byte[] Data, int length)
{
Data = new byte[length];
@@ -180,7 +186,7 @@ namespace Vocaluxe.Lib.Input
catch (Exception e)
{
result = -1;
CLog.LogError("Error CHIDAPI.Read(): " + e.ToString());
CLog.LogError("Error CHIDAPI.Read(): " + e);
}
if (result != -1)
@@ -194,6 +200,7 @@ namespace Vocaluxe.Lib.Input
[DllImport(HIDapiDll, ExactSpelling = false, CallingConvention = CallingConvention.Cdecl, EntryPoint = "hid_set_nonblocking", CharSet = CharSet.Unicode)]
private static extern int hid_set_nonblocking(IntPtr device, bool nonblock);
public static int Read(IntPtr Device, bool Nonblocking)
{
return hid_set_nonblocking(Device, Nonblocking);
@@ -201,6 +208,7 @@ namespace Vocaluxe.Lib.Input
[DllImport(HIDapiDll, ExactSpelling = false, CallingConvention = CallingConvention.Cdecl, EntryPoint = "hid_send_feature_report", CharSet = CharSet.Unicode)]
private static extern int hid_send_feature_report(IntPtr device, string data, int length);
public static int SendFeatureReport(IntPtr Device, string Data)
{
return hid_send_feature_report(Device, Data, Data.Length);
@@ -208,6 +216,7 @@ namespace Vocaluxe.Lib.Input
[DllImport(HIDapiDll, ExactSpelling = false, CallingConvention = CallingConvention.Cdecl, EntryPoint = "hid_get_feature_report", CharSet = CharSet.Unicode)]
private static extern int hid_get_feature_report(IntPtr device, string Data, int length);
public static int GetFeatureReport(IntPtr Device, string Data)
{
return hid_get_feature_report(Device, Data, Data.Length);
@@ -215,6 +224,7 @@ namespace Vocaluxe.Lib.Input
[DllImport(HIDapiDll, ExactSpelling = false, CallingConvention = CallingConvention.Cdecl, EntryPoint = "hid_close", CharSet = CharSet.Unicode)]
private static extern void hid_close(IntPtr device);
public static bool Close(IntPtr Device)
{
try
@@ -223,7 +233,7 @@ namespace Vocaluxe.Lib.Input
}
catch (Exception e)
{
CLog.LogError("Error CHIDAPI.Close(): " + e.ToString());
CLog.LogError("Error CHIDAPI.Close(): " + e);
return false;
}
return true;
@@ -231,6 +241,7 @@ namespace Vocaluxe.Lib.Input
[DllImport(HIDapiDll, ExactSpelling = false, CallingConvention = CallingConvention.Cdecl, EntryPoint = "hid_get_manufacturer_string", CharSet = CharSet.Unicode)]
private static extern int hid_get_manufacturer_string(IntPtr device, string Data, int maxlength);
public static int GetManufacturerString(IntPtr Device, string Data, int MaxLength)
{
return hid_get_manufacturer_string(Device, Data, MaxLength);
@@ -238,6 +249,7 @@ namespace Vocaluxe.Lib.Input
[DllImport(HIDapiDll, ExactSpelling = false, CallingConvention = CallingConvention.Cdecl, EntryPoint = "hid_get_product_string", CharSet = CharSet.Unicode)]
private static extern int hid_get_product_string(IntPtr device, string Data, int maxlength);
public static int GetProductString(IntPtr Device, string Data, int MaxLength)
{
return hid_get_product_string(Device, Data, MaxLength);
@@ -245,6 +257,7 @@ namespace Vocaluxe.Lib.Input
[DllImport(HIDapiDll, ExactSpelling = false, CallingConvention = CallingConvention.Cdecl, EntryPoint = "hid_get_serial_number_string", CharSet = CharSet.Unicode)]
private static extern int hid_get_serial_number_string(IntPtr device, string Data, int maxlength);
public static int GetSerialNumberString(IntPtr Device, string Data, int MaxLength)
{
return hid_get_serial_number_string(Device, Data, MaxLength);
@@ -252,6 +265,7 @@ namespace Vocaluxe.Lib.Input
[DllImport(HIDapiDll, ExactSpelling = false, CallingConvention = CallingConvention.Cdecl, EntryPoint = "hid_get_indexed_string", CharSet = CharSet.Unicode)]
private static extern int hid_get_indexed_string(IntPtr device, string Data, int maxlength);
public static int GetIndexedString(IntPtr Device, string Data, int MaxLength)
{
return hid_get_indexed_string(Device, Data, MaxLength);
@@ -259,9 +273,10 @@ namespace Vocaluxe.Lib.Input
[DllImport(HIDapiDll, ExactSpelling = false, CallingConvention = CallingConvention.Cdecl, EntryPoint = "hid_error", CharSet = CharSet.Unicode)]
private static extern string hid_error(IntPtr device);
public static string Error(IntPtr Device)
{
return hid_error(Device);
}
}
}
}
+5 -9
View File
@@ -1,11 +1,7 @@
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Drawing;
using System.Text;
using Vocaluxe.Base;
using Vocaluxe.Menu;
using VocaluxeLib.Menu;
namespace Vocaluxe.Lib.Input
{
@@ -35,7 +31,7 @@ namespace Vocaluxe.Lib.Input
class RumbleTimer
{
private Stopwatch _timer;
private readonly Stopwatch _timer;
private float _duration;
public bool ShouldStart
@@ -90,8 +86,8 @@ namespace Vocaluxe.Lib.Input
class CGesture
{
Point _Begin;
bool _locked;
private Point _Begin;
private bool _locked;
public CGesture()
{
@@ -143,4 +139,4 @@ namespace Vocaluxe.Lib.Input
return EGesture.None;
}
}
}
}
Loaded 100 of 191 files, more files were not shown because too many files have changed in this diff. Show more