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
+10976 -9904

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.
+2
View File
@@ -1,5 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<root>
<Fonts>
<Font1>
<Name>Normal</Name>
<Outline>0,00</Outline>
@@ -26,4 +27,5 @@
<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
+5 -3
View File
@@ -125,11 +125,13 @@ Vocaluxe.exe -ConfigFile MyConfig.xml -ScoreFile C:\Vocaluxe\Highscores\MyHighsc
[SHIFT] + [-] to decrease volume
Song screen
[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] + [R] to select a random song
[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.
+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,27 +38,20 @@ 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;
foreach (int p in NumPlayed)
@@ -95,7 +85,6 @@ namespace Vocaluxe.PartyModes
}
else
last.Add(i);
}
}
@@ -129,10 +118,10 @@ 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)
{
@@ -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,10 +192,8 @@ namespace Vocaluxe.PartyModes
for (int j = 0; j < _NumPlayer; j++)
{
if ((i & (1 << j)) > 0)
{
c.Player.Add(j);
}
}
if (c.Player.Count == _NumMics)
_Combs.Add(c);
@@ -243,9 +224,7 @@ namespace Vocaluxe.PartyModes
{
bool result = true;
foreach (int p in PlayerIndices)
{
result &= IsAvailable(p);
}
return result;
}
@@ -253,9 +232,7 @@ 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,17 +55,14 @@ namespace Vocaluxe.PartyModes
{
res = row.NumSingPoints.CompareTo(NumSingPoints);
if (res == 0)
{
res = row.NumWon.CompareTo(NumWon);
}
}
return res;
}
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,12 +149,12 @@ 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;
@@ -327,8 +328,6 @@ 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,13 +535,13 @@ 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;
}
@@ -580,15 +578,13 @@ 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
{
SPlayer[] results = CBase.Game.GetPlayer();
@@ -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);
@@ -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,10 +701,8 @@ 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,20 +136,13 @@ 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();
@@ -177,9 +153,9 @@ namespace Vocaluxe.PartyModes
{
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,9 +164,7 @@ namespace Vocaluxe.PartyModes
{
int num = CHelper.nCk(Data.ScreenConfig.NumPlayer, Data.ScreenConfig.NumPlayerAtOnce);
while (num > _MaxNumRounds)
{
num -= _RoundSteps;
}
Data.ScreenConfig.NumRounds = num;
}
@@ -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()
@@ -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,15 +81,18 @@ 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)
@@ -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)
{
@@ -510,19 +509,19 @@ namespace Vocaluxe.PartyModes
}
}
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)
@@ -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,11 +38,11 @@ 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;
@@ -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,30 +90,22 @@ 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)
switch (keyEvent.Key)
{
case Keys.Back:
case Keys.Escape:
@@ -131,10 +113,10 @@ namespace Vocaluxe.PartyModes
break;
case Keys.Enter:
if (Buttons[htButtons(ButtonBack)].Selected)
if (Buttons[ButtonBack].Selected)
Back();
if (Buttons[htButtons(ButtonNext)].Selected)
if (Buttons[ButtonNext].Selected)
Next();
if (!OnAdd())
@@ -149,9 +131,9 @@ namespace Vocaluxe.PartyModes
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,13 +164,13 @@ 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
else if (SelectingMouseActive)
@@ -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,15 +320,12 @@ 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,11 +383,9 @@ namespace Vocaluxe.PartyModes
}
}
if (visible)
{
PlayerChooseButtonsVisibleProfiles.Add(i);
}
}
}
private void UpdateButtonPlayerDestination()
{
@@ -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,27 +38,20 @@ 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;
foreach (int p in NumPlayed)
@@ -95,7 +85,6 @@ namespace Vocaluxe.PartyModes
}
else
last.Add(i);
}
}
@@ -129,10 +118,10 @@ 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)
{
@@ -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,10 +192,8 @@ namespace Vocaluxe.PartyModes
for (int j = 0; j < _NumPlayer; j++)
{
if ((i & (1 << j)) > 0)
{
c.Player.Add(j);
}
}
if (c.Player.Count == _NumMics)
_Combs.Add(c);
@@ -243,9 +224,7 @@ namespace Vocaluxe.PartyModes
{
bool result = true;
foreach (int p in PlayerIndices)
{
result &= IsAvailable(p);
}
return result;
}
@@ -253,9 +232,7 @@ 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,17 +56,14 @@ namespace Vocaluxe.PartyModes
{
res = row.NumSingPoints.CompareTo(NumSingPoints);
if (res == 0)
{
res = row.NumWon.CompareTo(NumWon);
}
}
return res;
}
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,17 +146,17 @@ 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;
@@ -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,7 +200,7 @@ namespace Vocaluxe.PartyModes
DataFromScreen data = new DataFromScreen();
switch (ScreenName)
{
case "PartyScreenChallengeConfig":
case "PartyScreenChallengeMedleyConfig":
try
{
@@ -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,8 +333,6 @@ 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()
{
@@ -525,7 +522,6 @@ namespace Vocaluxe.PartyModes
if (mode == EGameMode.TR_GAMEMODE_MEDLEY)
IDs.Add(VisSongs[i].ID);
}
}
if (IDs.Count == 0)
@@ -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,13 +583,13 @@ 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;
}
@@ -630,15 +626,13 @@ 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
{
CPoints GamePoints = CBase.Game.GetPoints();
@@ -659,10 +653,8 @@ 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++)
{
@@ -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,10 +766,8 @@ 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,20 +136,13 @@ 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();
@@ -177,9 +153,9 @@ namespace Vocaluxe.PartyModes
{
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,9 +164,7 @@ namespace Vocaluxe.PartyModes
{
int num = CHelper.nCk(Data.ScreenConfig.NumPlayer, Data.ScreenConfig.NumPlayerAtOnce);
while (num > _MaxNumRounds)
{
num -= _RoundSteps;
}
Data.ScreenConfig.NumRounds = num;
}
@@ -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()
@@ -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,26 +70,29 @@ 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)
@@ -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)
{
@@ -510,19 +509,19 @@ namespace Vocaluxe.PartyModes
}
}
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)
@@ -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,11 +38,11 @@ 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;
@@ -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,30 +90,22 @@ 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)
switch (keyEvent.Key)
{
case Keys.Back:
case Keys.Escape:
@@ -131,10 +113,10 @@ namespace Vocaluxe.PartyModes
break;
case Keys.Enter:
if (Buttons[htButtons(ButtonBack)].Selected)
if (Buttons[ButtonBack].Selected)
Back();
if (Buttons[htButtons(ButtonNext)].Selected)
if (Buttons[ButtonNext].Selected)
Next();
if (!OnAdd())
@@ -149,9 +131,9 @@ namespace Vocaluxe.PartyModes
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,13 +164,13 @@ 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
else if (SelectingMouseActive)
@@ -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,15 +320,12 @@ 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,11 +383,9 @@ namespace Vocaluxe.PartyModes
}
}
if (visible)
{
PlayerChooseButtonsVisibleProfiles.Add(i);
}
}
}
private void UpdateButtonPlayerDestination()
{
@@ -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,12 +167,12 @@ 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;
@@ -285,10 +289,8 @@ namespace Vocaluxe.PartyModes
GameData.PlayerTeam2 = data.ScreenMain.PlayerTeam2;
}
if (data.ScreenMain.FadeToNameSelection)
{
_Stage = EStage.Config;
}
}
catch (Exception e)
{
CBase.Log.LogError("Error in party mode TicTacToe. Can't cast received data from screen " + ScreenName + ". " + e.Message);
@@ -407,8 +409,6 @@ 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,32 +643,38 @@ namespace Vocaluxe.PartyModes
{
int id = CBase.Playlist.GetPlaylistSong(GameData.PlaylistID, i).SongID;
foreach (EGameMode mode in CBase.Songs.GetSongByID(id).AvailableGameModes)
{
if (mode == gm)
Songs.Add(id);
}
}
break;
case ESongSource.TR_ALLSONGS:
for (int i = 0; i < CBase.Songs.GetNumSongs(); i++)
{
foreach (EGameMode mode in CBase.Songs.GetSongByID(i).AvailableGameModes)
{
if (mode == gm)
Songs.Add(i);
}
}
break;
case ESongSource.TR_CATEGORY:
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,8 +311,8 @@ 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();
@@ -103,7 +102,7 @@ namespace Vocaluxe.PartyModes
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;
}
@@ -294,15 +292,15 @@ namespace Vocaluxe.PartyModes
{
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,19 +448,15 @@ 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;
}
}
}
private void FieldSelected()
{
@@ -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;
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 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,25 +534,25 @@ 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)
@@ -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,43 +653,36 @@ 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)
{
for (int c = 0; c < NumOneRow;c++)
else if (i == Possibilities.GetLength(0) - 2)
{
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;
}
@@ -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,14 +37,14 @@ 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;
@@ -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,34 +99,24 @@ 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)
switch (keyEvent.Key)
{
case Keys.Back:
case Keys.Escape:
@@ -144,16 +124,16 @@ namespace Vocaluxe.PartyModes
break;
case Keys.Enter:
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 (!OnAdd())
@@ -168,16 +148,16 @@ namespace Vocaluxe.PartyModes
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++)
{
@@ -201,13 +181,13 @@ 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;
return true;
}
@@ -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)
@@ -349,18 +324,17 @@ namespace Vocaluxe.PartyModes
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,11 +456,9 @@ namespace Vocaluxe.PartyModes
}
}
if (visible)
{
PlayerChooseButtonsVisibleProfiles.Add(i);
}
}
}
private void UpdateButtonPlayerDestination()
{
@@ -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
+40 -80
View File
@@ -1,32 +1,27 @@
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;
@@ -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,11 +208,13 @@ 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,11 +275,13 @@ 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
{
Stop();
@@ -344,12 +307,14 @@ 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()
{
@@ -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; }
@@ -552,10 +515,7 @@ class PlaylistElement
return _MusicFilePath;
}
set
{
_MusicFilePath = value;
}
set { _MusicFilePath = value; }
}
public string VideoFilePath
+64 -119
View File
@@ -1,23 +1,19 @@
using System;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.IO;
using System.Text;
using System.Text.RegularExpressions;
using System.Windows.Forms;
using System.Xml;
using OpenTK.Platform;
using Vocaluxe.Lib.Sound;
using Vocaluxe.Lib.Webcam;
using Vocaluxe.Menu;
using VocaluxeLib.Menu;
namespace Vocaluxe.Base
{
static class CConfig
{
private static XmlWriterSettings _settings = new XmlWriterSettings();
private static readonly XmlWriterSettings _settings = new XmlWriterSettings();
// Debug
public static EDebugLevel DebugLevel = EDebugLevel.TR_CONFIG_OFF;
@@ -97,11 +93,11 @@ namespace Vocaluxe.Base
public static SWebcamConfig WebcamConfig;
//Lists to save parameters and values
private static List<string> _Params = new List<string>();
private static List<string> _Values = new List<string>();
private static readonly List<string> _Params = new List<string>();
private static readonly List<string> _Values = new List<string>();
//Variables to save old values for commandline-parameters
private static List<string> SongFolderOld = new List<string>();
private static readonly List<string> SongFolderOld = new List<string>();
public static void Init()
{
@@ -128,22 +124,21 @@ namespace Vocaluxe.Base
string value = string.Empty;
#region Debug
xmlReader.TryGetEnumValue<EDebugLevel>("//root/Debug/DebugLevel", ref DebugLevel);
#endregion Debug
xmlReader.TryGetEnumValue("//root/Debug/DebugLevel", ref DebugLevel);
#region Graphics
xmlReader.TryGetEnumValue<ERenderer>("//root/Graphics/Renderer", ref Renderer);
xmlReader.TryGetEnumValue<ETextureQuality>("//root/Graphics/TextureQuality", ref TextureQuality);
xmlReader.TryGetEnumValue("//root/Graphics/Renderer", ref Renderer);
xmlReader.TryGetEnumValue("//root/Graphics/TextureQuality", ref TextureQuality);
xmlReader.TryGetIntValueRange("//root/Graphics/CoverSize", ref CoverSize, 32, 1024);
xmlReader.TryGetIntValue("//root/Graphics/ScreenW", ref ScreenW);
xmlReader.TryGetIntValue("//root/Graphics/ScreenH", ref ScreenH);
xmlReader.TryGetEnumValue<EAntiAliasingModes>("//root/Graphics/AAMode", ref AAMode);
xmlReader.TryGetEnumValue<EColorDeep>("//root/Graphics/Colors", ref Colors);
xmlReader.TryGetEnumValue("//root/Graphics/AAMode", ref AAMode);
xmlReader.TryGetEnumValue("//root/Graphics/Colors", ref Colors);
xmlReader.TryGetFloatValue("//root/Graphics/MaxFPS", ref MaxFPS);
xmlReader.TryGetEnumValue<EOffOn>("//root/Graphics/VSync", ref VSync);
xmlReader.TryGetEnumValue<EOffOn>("//root/Graphics/FullScreen", ref FullScreen);
xmlReader.TryGetEnumValue("//root/Graphics/VSync", ref VSync);
xmlReader.TryGetEnumValue("//root/Graphics/FullScreen", ref FullScreen);
xmlReader.TryGetFloatValue("//root/Graphics/FadeTime", ref FadeTime);
#endregion Graphics
@@ -161,16 +156,16 @@ namespace Vocaluxe.Base
#endregion Theme
#region Sound
xmlReader.TryGetEnumValue<EPlaybackLib>("//root/Sound/PlayBackLib", ref PlayBackLib);
xmlReader.TryGetEnumValue<ERecordLib>("//root/Sound/RecordLib", ref RecordLib);
xmlReader.TryGetEnumValue<EBufferSize>("//root/Sound/AudioBufferSize", ref AudioBufferSize);
xmlReader.TryGetEnumValue("//root/Sound/PlayBackLib", ref PlayBackLib);
xmlReader.TryGetEnumValue("//root/Sound/RecordLib", ref RecordLib);
xmlReader.TryGetEnumValue("//root/Sound/AudioBufferSize", ref AudioBufferSize);
xmlReader.TryGetIntValueRange("//root/Sound/AudioLatency", ref AudioLatency, -500, 500);
xmlReader.TryGetEnumValue("//root/Sound/BackgroundMusic", ref BackgroundMusic);
xmlReader.TryGetIntValueRange("//root/Sound/BackgroundMusicVolume", ref BackgroundMusicVolume);
xmlReader.TryGetEnumValue("//root/Sound/BackgroundMusicSource", ref BackgroundMusicSource);
xmlReader.TryGetEnumValue<EOffOn>("//root/Sound/BackgroundMusicUseStart", ref BackgroundMusicUseStart);
xmlReader.TryGetEnumValue("//root/Sound/BackgroundMusicUseStart", ref BackgroundMusicUseStart);
xmlReader.TryGetIntValueRange("//root/Sound/PreviewMusicVolume", ref PreviewMusicVolume);
xmlReader.TryGetIntValueRange("//root/Sound/GameMusicVolume", ref GameMusicVolume);
#endregion Sound
@@ -189,21 +184,19 @@ namespace Vocaluxe.Base
i++;
}
xmlReader.TryGetEnumValue<ESongMenu>("//root/Game/SongMenu", ref SongMenu);
xmlReader.TryGetEnumValue<ESongSorting>("//root/Game/SongSorting", ref SongSorting);
xmlReader.TryGetEnumValue<EOffOn>("//root/Game/IgnoreArticles", ref IgnoreArticles);
xmlReader.TryGetEnumValue("//root/Game/SongMenu", ref SongMenu);
xmlReader.TryGetEnumValue("//root/Game/SongSorting", ref SongSorting);
xmlReader.TryGetEnumValue("//root/Game/IgnoreArticles", ref IgnoreArticles);
xmlReader.TryGetFloatValue("//root/Game/ScoreAnimationTime", ref ScoreAnimationTime);
xmlReader.TryGetEnumValue<ETimerMode>("//root/Game/TimerMode", ref TimerMode);
xmlReader.TryGetEnumValue("//root/Game/TimerMode", ref TimerMode);
xmlReader.TryGetIntValue("//root/Game/NumPlayer", ref NumPlayer);
xmlReader.TryGetEnumValue("//root/Game/Tabs", ref Tabs);
xmlReader.GetValue("//root/Game/Language", ref Language, Language);
xmlReader.TryGetEnumValue<EOffOn>("//root/Game/LyricsOnTop", ref LyricsOnTop);
xmlReader.TryGetEnumValue("//root/Game/LyricsOnTop", ref LyricsOnTop);
xmlReader.TryGetFloatValue("//root/Game/MinLineBreakTime", ref MinLineBreakTime);
if ((ScoreAnimationTime > 0 && ScoreAnimationTime < 1) || ScoreAnimationTime < 0)
{
ScoreAnimationTime = 1;
}
if (MinLineBreakTime < 0)
MinLineBreakTime = 0.1f;
@@ -211,42 +204,25 @@ namespace Vocaluxe.Base
if (NumPlayer < 1 || NumPlayer > CSettings.MaxNumPlayer)
NumPlayer = 2;
List<string> _Languages = new List<string>();
_Languages = CLanguage.GetLanguages();
bool _LangExists = false;
for (i = 0; i < _Languages.Count; i++)
{
if (_Languages[i] == Language)
{
_LangExists = true;
}
}
bool _LangExists = CLanguage.SetLanguage(Language);
//TODO: What should we do, if English not exists?
if(_LangExists == false){
if (_LangExists == false)
Language = "English";
}
CLanguage.SetLanguage(Language);
//Read players from config
for (i = 1; i <= CSettings.MaxNumPlayer; i++)
{
xmlReader.GetValue("//root/Game/Players/Player" + i.ToString(), ref Players[i - 1], string.Empty);
}
#endregion Game
#region Video
xmlReader.TryGetEnumValue<EVideoDecoder>("//root/Video/VideoDecoder", ref VideoDecoder);
xmlReader.TryGetEnumValue<EOffOn>("//root/Video/VideoBackgrounds", ref VideoBackgrounds);
xmlReader.TryGetEnumValue<EOffOn>("//root/Video/VideoPreview", ref VideoPreview);
xmlReader.TryGetEnumValue<EOffOn>("//root/Video/VideosInSongs", ref VideosInSongs);
xmlReader.TryGetEnumValue<EOffOn>("//root/Video/VideosToBackground", ref VideosToBackground);
xmlReader.TryGetEnumValue("//root/Video/VideoDecoder", ref VideoDecoder);
xmlReader.TryGetEnumValue("//root/Video/VideoBackgrounds", ref VideoBackgrounds);
xmlReader.TryGetEnumValue("//root/Video/VideoPreview", ref VideoPreview);
xmlReader.TryGetEnumValue("//root/Video/VideosInSongs", ref VideosInSongs);
xmlReader.TryGetEnumValue("//root/Video/VideosToBackground", ref VideosToBackground);
xmlReader.TryGetEnumValue<EWebcamLib>("//root/Video/WebcamLib", ref WebcamLib);
xmlReader.TryGetEnumValue("//root/Video/WebcamLib", ref WebcamLib);
WebcamConfig = new SWebcamConfig();
xmlReader.GetValue("//root/Video/WebcamConfig/MonikerString", ref WebcamConfig.MonikerString, String.Empty);
xmlReader.TryGetIntValue("//root/Video/WebcamConfig/Framerate", ref WebcamConfig.Framerate);
@@ -275,27 +251,28 @@ namespace Vocaluxe.Base
public static bool SaveConfig()
{
XmlWriter writer = XmlWriter.Create(CSettings.sFileConfig, _settings);
XmlWriter writer = null;
try
{
writer = XmlWriter.Create(CSettings.sFileConfig, _settings);
writer.WriteStartDocument();
writer.WriteStartElement("root");
#region Info
writer.WriteStartElement("Info");
writer.WriteElementString("Version", CSettings.GetFullVersionText());
writer.WriteElementString("Time", System.DateTime.Now.ToString());
writer.WriteElementString("Platform", System.Environment.OSVersion.Platform.ToString());
writer.WriteElementString("OSVersion", System.Environment.OSVersion.ToString());
writer.WriteElementString("ProcessorCount", System.Environment.ProcessorCount.ToString());
writer.WriteElementString("Time", DateTime.Now.ToString());
writer.WriteElementString("Platform", Environment.OSVersion.Platform.ToString());
writer.WriteElementString("OSVersion", Environment.OSVersion.ToString());
writer.WriteElementString("ProcessorCount", Environment.ProcessorCount.ToString());
writer.WriteElementString("Screens", Screen.AllScreens.Length.ToString());
writer.WriteElementString("PrimaryScreenResolution", Screen.PrimaryScreen.Bounds.Size.ToString());
writer.WriteElementString("Directory", System.Environment.CurrentDirectory.ToString());
writer.WriteElementString("Directory", Environment.CurrentDirectory);
writer.WriteEndElement();
#endregion Info
#region Debug
writer.WriteStartElement("Debug");
@@ -402,13 +379,15 @@ namespace Vocaluxe.Base
writer.WriteComment("Background Music Source");
writer.WriteElementString("BackgroundMusicSource", Enum.GetName(typeof(EBackgroundMusicSource), BackgroundMusicSource));
writer.WriteComment("Background Music use start-tag of songs");
writer.WriteElementString("BackgroundMusicUseStart", Enum.GetName(typeof(EOffOn), BackgroundMusicUseStart));
writer.WriteComment("Preview Volume from 0 to 100");
writer.WriteElementString("PreviewMusicVolume", PreviewMusicVolume.ToString());
writer.WriteComment("Preview Volume from 0 to 100");
writer.WriteElementString("PreviewMusicVolume", PreviewMusicVolume.ToString());
writer.WriteComment("Game Volume from 0 to 100");
writer.WriteElementString("GameMusicVolume", GameMusicVolume.ToString());
@@ -428,19 +407,15 @@ namespace Vocaluxe.Base
//Write "old" song-folders to config.
writer.WriteComment("SongFolder: SongFolder1, SongFolder2, SongFolder3, ...");
for (int i = 0; i < SongFolderOld.Count; i++)
{
writer.WriteElementString("SongFolder" + (i + 1).ToString(), SongFolderOld[i]);
}
}
else
{
//Write "normal" song-folders to config.
writer.WriteComment("SongFolder: SongFolder1, SongFolder2, SongFolder3, ...");
for (int i = 0; i < SongFolder.Count; i++)
{
writer.WriteElementString("SongFolder" + (i + 1).ToString(), SongFolder[i]);
}
}
writer.WriteComment("SongMenu: " + CHelper.ListStrings(Enum.GetNames(typeof(ESongMenu))));
writer.WriteElementString("SongMenu", Enum.GetName(typeof(ESongMenu), SongMenu));
@@ -472,9 +447,7 @@ namespace Vocaluxe.Base
writer.WriteComment("Default profile for players 1..." + CSettings.MaxNumPlayer.ToString() + ":");
writer.WriteStartElement("Players");
for (int i = 1; i <= CSettings.MaxNumPlayer; i++)
{
writer.WriteElementString("Player" + i.ToString(), Path.GetFileName(Players[i - 1]));
}
writer.WriteEndElement();
writer.WriteEndElement();
@@ -518,7 +491,7 @@ namespace Vocaluxe.Base
for (int p = 1; p <= CSettings.MaxNumPlayer; p++)
{
if (MicConfig[p - 1].DeviceName != String.Empty && MicConfig[p - 1].InputName != String.Empty && MicConfig[p - 1].Channel > 0)
if (MicConfig[p - 1].DeviceName.Length > 0 && MicConfig[p - 1].InputName.Length > 0 && MicConfig[p - 1].Channel > 0)
{
writer.WriteStartElement("MicConfig" + p.ToString());
@@ -540,9 +513,16 @@ namespace Vocaluxe.Base
// End of File
writer.WriteEndElement(); //end of root
writer.WriteEndDocument();
writer.Flush();
writer.Close();
writer = null;
}
catch (Exception)
{
if (writer != null)
writer.Close();
return false;
}
return true;
}
@@ -551,7 +531,7 @@ namespace Vocaluxe.Base
/// </summary>
public static float CalcCycleTime()
{
return (1f / MaxFPS)*1000f;
return (1f / MaxFPS) * 1000f;
}
/// <summary>
@@ -569,11 +549,9 @@ namespace Vocaluxe.Base
for (int inp = 0; inp < Devices[dev].Inputs.Count; inp++)
{
if (Devices[dev].Inputs[inp].PlayerChannel1 != 0 || Devices[dev].Inputs[inp].PlayerChannel2 != 0)
{
return true;
}
}
}
return false;
}
@@ -595,10 +573,8 @@ namespace Vocaluxe.Base
for (int inp = 0; inp < Devices[dev].Inputs.Count; inp++)
{
if (Devices[dev].Inputs[inp].PlayerChannel1 == player || Devices[dev].Inputs[inp].PlayerChannel2 == player)
{
return true;
}
}
}
return false;
}
@@ -652,7 +628,6 @@ namespace Vocaluxe.Base
//Check if there are inputs.
if (Devices[dev].Inputs.Count >= 1)
{
bool micfound = false;
//Check if there is one or more channels
if (Devices[dev].Inputs[0].Channels >= 1)
{
@@ -662,8 +637,6 @@ namespace Vocaluxe.Base
MicConfig[0].InputName = Devices[dev].Inputs[0].Name;
MicConfig[0].Channel = 1;
micfound = true;
}
if (Devices[dev].Inputs[0].Channels >= 2)
{
//Set this device to player 2
@@ -672,15 +645,12 @@ namespace Vocaluxe.Base
MicConfig[1].InputName = Devices[dev].Inputs[0].Name;
MicConfig[1].Channel = 2;
micfound = true;
}
if (micfound)
{
return true;
}
}
}
}
}
return false;
}
@@ -696,9 +666,7 @@ namespace Vocaluxe.Base
//Complete argument string
string arguments = string.Empty;
foreach (string arg in args)
{
arguments += arg + " ";
}
args = SpliterParam.Split(arguments);
@@ -714,10 +682,9 @@ namespace Vocaluxe.Base
switch (parts.Length)
{
//Only found a parameter
case 1:
if (!Regex.IsMatch(parts[0], @"\s") && parts[0] != string.Empty)
if (!Regex.IsMatch(parts[0], @"\s") && parts[0].Length > 0)
{
//Add parameter
_Params.Add(parts[0]);
@@ -730,7 +697,7 @@ namespace Vocaluxe.Base
//Found parameter and value
case 2:
if (!Regex.IsMatch(parts[0], @"\s") && parts[0] != string.Empty)
if (!Regex.IsMatch(parts[0], @"\s") && parts[0].Length > 0)
{
//Add parameter
_Params.Add(parts[0]);
@@ -746,8 +713,8 @@ namespace Vocaluxe.Base
/// <summary>
/// Apply command-line-parameters (before reading config.xml)
/// </summary>
public static void UseCommandLineParamsBefore(){
public static void UseCommandLineParamsBefore()
{
//Check each parameter
for (int i = 0; i < _Params.Count; i++)
{
@@ -763,17 +730,13 @@ namespace Vocaluxe.Base
case "configfile":
//Check if value is valid
if (CheckFile(value))
{
CSettings.sFileConfig = value;
}
break;
case "scorefile":
//Check if value is valid
if (CheckFile(value))
{
CSettings.sFileHighscoreDB = value;
}
break;
case "playlistfolder":
@@ -794,7 +757,6 @@ namespace Vocaluxe.Base
/// </summary>
public static void UseCommandLineParamsAfter()
{
//Check each parameter
for (int i = 0; i < _Params.Count; i++)
{
@@ -808,17 +770,6 @@ namespace Vocaluxe.Base
switch (param)
{
case "songfolder":
//Check if SongFolders from config.xml are saved
if (SongFolderOld.Count == 0)
{
SongFolderOld.Clear();
SongFolderOld.AddRange(SongFolder);
SongFolder.Clear();
}
//Add parameter-value to SongFolder
SongFolder.Add(value);
break;
case "songpath":
//Check if SongFolders from config.xml are saved
if (SongFolderOld.Count == 0)
@@ -836,20 +787,16 @@ namespace Vocaluxe.Base
private static bool CheckFile(string value)
{
char [] chars = Path.GetInvalidPathChars();
for(int i=0; i<chars.Length; i++){
if(value.Contains(chars[i].ToString())){
return false;
}
}
if (Path.GetFileName(value) == string.Empty)
char[] chars = Path.GetInvalidPathChars();
for (int i = 0; i < chars.Length; i++)
{
if (value.Contains(chars[i].ToString()))
return false;
}
if (Path.GetFileName(value).Length == 0)
return false;
if (!Path.HasExtension(value))
{
return false;
}
return true;
}
@@ -862,7 +809,7 @@ namespace Vocaluxe.Base
{
for (int j = 0; j < CSettings.MaxNumPlayer; j++)
{
if (Players[j] != string.Empty)
if (Players[j].Length > 0)
{
if (Path.GetFileName(CProfiles.Profiles[i].ProfileFile) == Players[j] && CProfiles.Profiles[i].Active == EOffOn.TR_CONFIG_ON)
{
@@ -873,11 +820,9 @@ namespace Vocaluxe.Base
}
}
else
{
CGame.Player[j].ProfileID = -1;
}
}
}
}
}
}
+11 -26
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
{
@@ -56,9 +54,7 @@ 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();
}
@@ -73,10 +69,8 @@ namespace Vocaluxe.Base
for (int i = 0; i < _CoverThemes.Count; i++)
{
if (_CoverThemes[i].Name == CConfig.CoverTheme)
{
return i;
}
}
return -1;
}
@@ -111,11 +105,9 @@ namespace Vocaluxe.Base
foreach (SCover cover in _Cover)
{
if (cover.Name == Name)
{
return true;
}
}
}
return false;
}
@@ -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;
@@ -190,10 +182,9 @@ namespace Vocaluxe.Base
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,25 +200,19 @@ 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;
}
}
}
}
List<string> files = new List<string>();
@@ -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));
+257 -463
View File
File diff suppressed because it is too large. Load diff
+13 -13
View File
@@ -1,19 +1,15 @@
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()
{
@@ -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()
@@ -163,10 +161,11 @@ 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);
using (Bitmap origin = new Bitmap(TexturePath))
{
int w = MaxSize;
int h = MaxSize;
@@ -175,12 +174,13 @@ namespace Vocaluxe.Base
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);
using (Bitmap bmp = new Bitmap(origin, w, h))
{
STexture tex = _Draw.AddTexture(bmp);
bmp.Dispose();
origin.Dispose();
return tex;
}
}
}
public static STexture AddTexture(int W, int H, IntPtr Data)
{
+191 -384
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; }
@@ -36,32 +32,34 @@ namespace Vocaluxe.Base
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();
bmp = new Bitmap((int)(sizeB.Width * 2f), sizeB.Height);
g = System.Drawing.Graphics.FromImage(bmp);
g.Clear(System.Drawing.Color.Transparent);
using (Bitmap bmp = new Bitmap((int)(sizeB.Width * 2f), sizeB.Height))
{
Graphics g = Graphics.FromImage(bmp);
g.Clear(Color.Transparent);
g.SmoothingMode = SmoothingMode.AntiAlias;
g.InterpolationMode = InterpolationMode.HighQualityBicubic;
g.TextRenderingHint = System.Drawing.Text.TextRenderingHint.ClearTypeGridFit;
g.TextRenderingHint = TextRenderingHint.ClearTypeGridFit;
CFonts.Height = SIZEh;
fo = CFonts.GetFont();
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();
using (GraphicsPath path = new GraphicsPath())
{
path.AddString(
chr.ToString(),
fo.FontFamily,
@@ -70,17 +68,19 @@ namespace Vocaluxe.Base
point,
new StringFormat());
Pen pen = new Pen(
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);
SIZEh * outline))
{
pen.LineJoin = LineJoin.Round;
g.DrawPath(pen, path);
g.FillPath(Brushes.White, path);
}
}
/*
g.DrawString(
@@ -89,14 +89,12 @@ namespace Vocaluxe.Base
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();
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);
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);
float h_normal = sizeB.Height;
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);
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);
float h_style = sizeB.Height;
g.Dispose();
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);
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);
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);
}
}
public void DrawGlyphReflection(char chr, float x, float y, float h, float z, SColorF color, float rspace, float rheight)
{
AddGlyph(chr);
return new Font(family, CFonts.Height, CFonts.GetFontStyle(), GraphicsUnit.Pixel);
}
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);
public void DrawGlyph(char chr, float x, float y, float h, float z, SColorF color)
{
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
@@ -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,7 +358,7 @@ 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;
@@ -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;
@@ -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");
}
}
}
+14 -35
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,20 +216,17 @@ 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) ||
@@ -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,20 +327,13 @@ 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));
}
}
}
// Line Bonus
@@ -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)
@@ -381,7 +361,6 @@ namespace Vocaluxe.Base
}
}
}
}
}
_OldBeatD = _CurrentBeatD;
+26 -54
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,14 +19,14 @@ 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;
@@ -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
{
@@ -251,14 +249,14 @@ 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));
}
}
@@ -267,43 +265,31 @@ namespace Vocaluxe.Base
{
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();
}
}
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();
@@ -492,7 +476,6 @@ namespace Vocaluxe.Base
{
_Cursor.ShowCursor = true;
}
#endregion public methods
#region private stuff
@@ -504,7 +487,8 @@ 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.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;
@@ -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)
@@ -644,7 +623,7 @@ 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)
@@ -654,7 +633,7 @@ namespace Vocaluxe.Base
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)
@@ -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)
@@ -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);
+4 -7
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()
+70 -154
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,17 +58,15 @@ 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);
}
}
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 { }
}
if (result == null && (PartyModeNr = GetPartyModeNr(PartyModeID, _FallbackLanguage)) != -1)
{
try
{
result = (string)_Languages[_FallbackLanguage].PartyModeTexts[PartyModeNr].Texts[KeyWord];
}
catch { }
}
}
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;
}
int PartyModeNr = GetPartyModeNr(PartyModeID, _CurrentLanguage);
if (PartyModeNr != -1 && _Languages[_CurrentLanguage].PartyModeTexts[PartyModeNr].Texts.TryGetValue(KeyWord, out result))
return result;
PartyModeNr = GetPartyModeNr(PartyModeID, _FallbackLanguage);
if (PartyModeNr != -1 && _Languages[_CurrentLanguage].PartyModeTexts[PartyModeNr].Texts.TryGetValue(KeyWord, out result))
return result;
}
public static bool TranslationExists(string KeyWord)
{
return TranslationExists(KeyWord, -1);
if (_Languages[_CurrentLanguage].Texts.TryGetValue(KeyWord, out result))
return result;
if (_Languages[_FallbackLanguage].Texts.TryGetValue(KeyWord, out result))
return result;
return KeyWord;
}
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 { }
}
if (result == null && (PartyModeNr = GetPartyModeNr(PartyModeID, _FallbackLanguage)) != -1)
{
try
{
result = (string)_Languages[_FallbackLanguage].PartyModeTexts[PartyModeNr].Texts[KeyWord];
}
catch { }
}
}
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;
}
int PartyModeNr = GetPartyModeNr(PartyModeID, _CurrentLanguage);
if (PartyModeNr != -1 && _Languages[_CurrentLanguage].PartyModeTexts[PartyModeNr].Texts.ContainsKey(KeyWord))
return true;
PartyModeNr = GetPartyModeNr(PartyModeID, _FallbackLanguage);
if (PartyModeNr != -1 && _Languages[_CurrentLanguage].PartyModeTexts[PartyModeNr].Texts.ContainsKey(KeyWord))
return true;
}
if (_Languages[_CurrentLanguage].Texts.ContainsKey(KeyWord))
return true;
if (_Languages[_FallbackLanguage].Texts.ContainsKey(KeyWord))
return true;
return false;
}
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();
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);
if (!_LoadLanguageEntries(xmlReader, ref lang.Texts))
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);
}
+17 -18
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,7 +73,7 @@ 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()
{
@@ -79,10 +84,8 @@ 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 += " ";
}
_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);
+10 -32
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
{
@@ -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);
+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();
}
}
}
+14 -20
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;
@@ -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,7 +338,8 @@ namespace Vocaluxe.Base
Params.IncludeDebugInformation = true;
#endif
CodeDomProvider CDP = CodeDomProvider.CreateProvider("CSharp");
using (CodeDomProvider CDP = CodeDomProvider.CreateProvider("CSharp"))
{
CompilerResults CompileResult = null;
try
@@ -359,21 +354,20 @@ namespace Vocaluxe.Base
if (CompileResult.Errors.Count > 0)
{
for (int i = 0; i < CompileResult.Errors.Count; i++)
{
CLog.LogError("Error Compiling Source (" + CHelper.ListStrings(files) + "): " + CompileResult.Errors[i].ErrorText);
}
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;
}
}
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);
+8 -21
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;
@@ -27,9 +23,7 @@ namespace Vocaluxe.Base
{
List<string> names = new List<string>();
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);
}
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,12 +222,11 @@ namespace Vocaluxe.Base
StreamReader sr;
try
{
sr = new StreamReader(file, Encoding.Default, true);
using (sr = new StreamReader(file, Encoding.Default, true))
{
int pos = -1;
string line;
while((line = sr.ReadLine()) != null)
while ((line = sr.ReadLine()) != null)
{
pos = line.IndexOf(":");
if (pos > 0)
@@ -248,10 +237,8 @@ namespace Vocaluxe.Base
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
{
@@ -272,7 +259,7 @@ namespace Vocaluxe.Base
}
}
}
sr.Close();
}
File.Delete(file);
}
catch
+19 -31
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
{
@@ -38,7 +36,7 @@ namespace Vocaluxe.Base
public static void Init()
{
_settings.Indent = true;
_settings.Encoding = System.Text.Encoding.UTF8;
_settings.Encoding = Encoding.UTF8;
_settings.ConformanceLevel = ConformanceLevel.Document;
LoadAvatars();
@@ -60,7 +58,7 @@ namespace Vocaluxe.Base
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;
@@ -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();
}
@@ -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,18 +296,16 @@ 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];
profile.ProfileFile = Path.Combine(CSettings.sFolderProfiles, filename + ".xml");
@@ -330,13 +322,8 @@ 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");
@@ -352,7 +339,12 @@ namespace Vocaluxe.Base
writer.WriteEndDocument();
writer.Flush();
}
finally
{
writer.Close();
writer = null;
}
}
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
}
}
+9 -12
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,7 +29,6 @@ namespace Vocaluxe.Base
public const EArch ARCH = EArch.x64;
#endif
public static EGameState GameState = EGameState.Start;
public const string sProgramName = "Vocaluxe";
@@ -48,7 +45,6 @@ namespace Vocaluxe.Base
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";
@@ -124,9 +119,12 @@ namespace Vocaluxe.Base
public const float BackgroundMusicFadeTime = 0.5f;
public static List<string> MusicFileTypes = new List<string>()
public static List<string> MusicFileTypes = new List<string>
{
"*.mp3","*.wma","*.ogg","*.wav"
"*.mp3",
"*.wma",
"*.ogg",
"*.wav"
};
public static string GetVersionText()
@@ -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,8 +190,7 @@ namespace Vocaluxe.Base
foreach (string folder in Folders)
{
string path = Path.Combine(Environment.CurrentDirectory, folder);
if (!Directory.Exists(path))
Directory.CreateDirectory(path);
CreateFolder(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;
}
}
}
+102 -411
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
@@ -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,16 +91,19 @@ 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++)
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
{
_SongsSortList[i].Visible = (_SongsSortList[i].CatIndex == _CatIndex && !_SongsSortList[i].PartyHidden);
}
}
}
get { return _CatIndex >= 0; }
}
/// <summary>
@@ -148,13 +113,13 @@ namespace Vocaluxe.Base
/// <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);
}
@@ -353,7 +309,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]);
@@ -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();
+34 -43
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()
{
@@ -295,28 +290,26 @@ 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
@@ -325,9 +318,7 @@ namespace Vocaluxe.Base
{
_ToneWeigth = new float[_NumHalfTones];
for (int i = 0; i < _ToneWeigth.Length; i++)
{
_ToneWeigth[i] = 0.99f;
}
_Stream = new MemoryStream();
_NewSamples = false;
}
@@ -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;
@@ -550,7 +532,7 @@ namespace Vocaluxe.Base
{
// 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,12 +540,22 @@ 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
@@ -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
{
+24 -64
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,12 +80,12 @@ 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
@@ -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
@@ -297,7 +293,8 @@ namespace Vocaluxe.Base
private static void SaveTheme(int ThemeIndex)
{
#region ThemeMainFile
XmlWriter writer = XmlWriter.Create(Path.Combine(_Themes[ThemeIndex].Path, _Themes[ThemeIndex].FileName), _settings);
using (XmlWriter writer = XmlWriter.Create(Path.Combine(_Themes[ThemeIndex].Path, _Themes[ThemeIndex].FileName), _settings))
{
writer.WriteStartDocument();
writer.WriteStartElement("root");
@@ -330,7 +327,7 @@ namespace Vocaluxe.Base
writer.WriteEndDocument();
writer.Flush();
writer.Close();
}
#endregion ThemeMainFile
}
@@ -338,7 +335,8 @@ namespace Vocaluxe.Base
{
for (int SkinIndex = 0; SkinIndex < _Skins.Count; SkinIndex++)
{
XmlWriter writer = XmlWriter.Create(Path.Combine(_Skins[SkinIndex].Path, _Skins[SkinIndex].FileName), _settings);
using (XmlWriter writer = XmlWriter.Create(Path.Combine(_Skins[SkinIndex].Path, _Skins[SkinIndex].FileName), _settings))
{
writer.WriteStartDocument();
writer.WriteStartElement("root");
@@ -363,9 +361,7 @@ namespace Vocaluxe.Base
writer.WriteStartElement("Skins");
foreach (SkinElement element in _Skins[SkinIndex].SkinList.Values)
{
writer.WriteElementString(element.Name, element.Value);
}
writer.WriteEndElement();
#endregion Skins
@@ -373,9 +369,7 @@ namespace Vocaluxe.Base
writer.WriteStartElement("Videos");
foreach (SkinElement element in _Skins[SkinIndex].VideoList)
{
writer.WriteElementString(element.Name, element.Value);
}
writer.WriteEndElement();
#endregion Videos
@@ -384,7 +378,7 @@ namespace Vocaluxe.Base
writer.WriteEndDocument();
writer.Flush();
writer.Close();
}
}
}
@@ -396,10 +390,8 @@ 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;
@@ -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,14 +528,10 @@ 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,14 +541,10 @@ 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);
}
@@ -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;
GetColor(ColorName, SkinIndex, out color);
return color;
}
}
return GetPlayerColor(ColorName);
}
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);
}
+30 -51
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,10 +110,7 @@ namespace Vocaluxe.Base
{
_KeysPool.Add(pool);
}
catch (Exception)
{
}
catch (Exception) {}
}
_timer.Reset();
@@ -141,12 +127,11 @@ 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)
{
CheckModifiers();
@@ -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 int _x;
private int _y;
private Object _CopyLock = new Object();
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,13 +225,13 @@ 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);
@@ -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();
}
}
}
}
+3 -9
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);
+2 -8
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
{
+6 -13
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) {}
}
}
+1 -5
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
+2 -7
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
{
+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)")]
+245 -294
View File
@@ -1,62 +1,57 @@
using System;
using System.Collections.Generic;
using System.Text;
using Vocaluxe.Base;
using Vocaluxe.Menu;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Threading;
using SlimDX;
using SlimDX.Direct3D9;
using System.Windows.Forms;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Drawing.Imaging;
using System.IO;
using System.Runtime.InteropServices;
using SlimDX.Windows;
using System.Windows.Forms;
using Vocaluxe.Base;
using VocaluxeLib.Menu;
namespace Vocaluxe.Lib.Draw
{
class CDirect3D : Form, IDraw
{
#region private vars
private CKeys _Keys;
private CMouse _Mouse;
private readonly CKeys _Keys;
private readonly CMouse _Mouse;
private bool _Run;
private Direct3D _D3D;
private Device _Device;
private PresentParameters _PresentParameters;
private readonly Direct3D _D3D;
private readonly Device _Device;
private readonly PresentParameters _PresentParameters;
private bool _fullscreen = false;
private bool _fullscreen;
private Size _OldSize;
private Size _SizeBeforeMinimize;
private Dictionary<int, STexture> _Textures;
private Dictionary<int, Texture> _D3DTextures;
private List<STextureQueque> _Queque;
private Queue<int> _IDs;
private readonly Dictionary<int, STexture> _Textures;
private readonly Dictionary<int, Texture> _D3DTextures;
private readonly List<STextureQueque> _Queque;
private readonly Queue<int> _IDs;
private Object MutexTexture = new Object();
private readonly Object MutexTexture = new Object();
private VertexBuffer _VertexBuffer;
private IndexBuffer _IndexBuffer;
private int h = 1;
private int w = 1;
private int y = 0;
private int x = 0;
private int y;
private int x;
private STexture _BlankTexture;
private Queue<TexturedColoredVertex> _Vertices;
private Queue<Texture> _VerticesTextures;
private Queue<Matrix> _VerticesRotationMatrices;
private bool _NonPowerOf2TextureSupported;
private readonly Queue<TexturedColoredVertex> _Vertices;
private readonly Queue<Texture> _VerticesTextures;
private readonly Queue<SlimDX.Matrix> _VerticesRotationMatrices;
private readonly bool _NonPowerOf2TextureSupported;
#endregion private vars
/// <summary>
@@ -64,7 +59,7 @@ namespace Vocaluxe.Lib.Draw
/// </summary>
public CDirect3D()
{
this.Icon = new System.Drawing.Icon(Path.Combine(System.Environment.CurrentDirectory, CSettings.sIcon));
Icon = new Icon(Path.Combine(Environment.CurrentDirectory, CSettings.sIcon));
_Textures = new Dictionary<int, STexture>();
_D3DTextures = new Dictionary<int, Texture>();
_Queque = new List<STextureQueque>();
@@ -76,7 +71,7 @@ namespace Vocaluxe.Lib.Draw
_Vertices = new Queue<TexturedColoredVertex>();
_VerticesTextures = new Queue<Texture>();
_VerticesRotationMatrices = new Queue<Matrix>();
_VerticesRotationMatrices = new Queue<SlimDX.Matrix>();
_Keys = new CKeys();
try
@@ -92,24 +87,24 @@ namespace Vocaluxe.Lib.Draw
Environment.Exit(Environment.ExitCode);
}
this.Paint += new PaintEventHandler(this.OnPaintEvent);
this.Closing += new CancelEventHandler(this.OnClosingEvent);
this.Resize += new EventHandler(this.OnResizeEvent);
Paint += OnPaintEvent;
Closing += OnClosingEvent;
Resize += OnResizeEvent;
this.KeyDown += new KeyEventHandler(this.OnKeyDown);
this.PreviewKeyDown += new PreviewKeyDownEventHandler(this.OnPreviewKeyDown);
this.KeyPress += new KeyPressEventHandler(this.OnKeyPress);
this.KeyUp += new KeyEventHandler(this.OnKeyUp);
KeyDown += OnKeyDown;
PreviewKeyDown += OnPreviewKeyDown;
KeyPress += OnKeyPress;
KeyUp += OnKeyUp;
_Mouse = new CMouse();
this.MouseMove += new MouseEventHandler(this.OnMouseMove);
this.MouseWheel += new MouseEventHandler(this.OnMouseWheel);
this.MouseDown += new MouseEventHandler(this.OnMouseDown);
this.MouseUp += new MouseEventHandler(this.OnMouseUp);
this.MouseLeave += new EventHandler(this.OnMouseLeave);
this.MouseEnter += new EventHandler(this.OnMouseEnter);
MouseMove += OnMouseMove;
MouseWheel += OnMouseWheel;
MouseDown += OnMouseDown;
MouseUp += OnMouseUp;
MouseLeave += OnMouseLeave;
MouseEnter += OnMouseEnter;
this.ClientSize = new Size(CConfig.ScreenW, CConfig.ScreenH);
ClientSize = new Size(CConfig.ScreenW, CConfig.ScreenH);
_SizeBeforeMinimize = ClientSize;
_PresentParameters = new PresentParameters();
@@ -123,52 +118,39 @@ namespace Vocaluxe.Lib.Draw
//Apply antialiasing and check if antialiasing mode is supported
#region Antialiasing
int quality = 0;
if (CConfig.AAMode == EAntiAliasingModes.x0)
int quality = 1;
MultisampleType msType;
switch (CConfig.AAMode)
{
_PresentParameters.Multisample = MultisampleType.None;
_PresentParameters.MultisampleQuality = quality;
case EAntiAliasingModes.x2:
msType = MultisampleType.TwoSamples;
break;
case EAntiAliasingModes.x4:
msType = MultisampleType.FourSamples;
break;
case EAntiAliasingModes.x8:
msType = MultisampleType.EightSamples;
break;
case EAntiAliasingModes.x16:
case EAntiAliasingModes.x32: //x32 is not supported, fallback to x16
msType = MultisampleType.SixteenSamples;
break;
default:
msType = MultisampleType.None;
break;
}
else if (CConfig.AAMode == EAntiAliasingModes.x2)
if (
!_D3D.CheckDeviceMultisampleType(_D3D.Adapters.DefaultAdapter.Adapter, DeviceType.Hardware, _D3D.Adapters.DefaultAdapter.CurrentDisplayMode.Format, false, msType,
out quality))
{
if (_D3D.CheckDeviceMultisampleType(_D3D.Adapters.DefaultAdapter.Adapter, DeviceType.Hardware, _D3D.Adapters.DefaultAdapter.CurrentDisplayMode.Format, false, MultisampleType.TwoSamples, out quality))
{
_PresentParameters.Multisample = MultisampleType.TwoSamples;
_PresentParameters.MultisampleQuality = quality - 1;
}
else
CLog.LogError("[Direct3D] This AAMode is not supported by this device or driver, fallback to no AA");
msType = MultisampleType.None;
quality = 1;
}
else if (CConfig.AAMode == EAntiAliasingModes.x4)
{
if (_D3D.CheckDeviceMultisampleType(_D3D.Adapters.DefaultAdapter.Adapter, DeviceType.Hardware, _D3D.Adapters.DefaultAdapter.CurrentDisplayMode.Format, false, MultisampleType.FourSamples, out quality))
{
_PresentParameters.Multisample = MultisampleType.FourSamples;
_PresentParameters.Multisample = msType;
_PresentParameters.MultisampleQuality = quality - 1;
}
else
CLog.LogError("[Direct3D] This AAMode is not supported by this device or driver, fallback to no AA");
}
else if (CConfig.AAMode == EAntiAliasingModes.x8)
{
if (_D3D.CheckDeviceMultisampleType(_D3D.Adapters.DefaultAdapter.Adapter, DeviceType.Hardware, _D3D.Adapters.DefaultAdapter.CurrentDisplayMode.Format, false, MultisampleType.EightSamples, out quality))
{
_PresentParameters.Multisample = MultisampleType.EightSamples;
_PresentParameters.MultisampleQuality = quality - 1;
}
else
CLog.LogError("[Direct3D] This AAMode is not supported by this device or driver, fallback to no AA");
}
else if (CConfig.AAMode == EAntiAliasingModes.x16 || CConfig.AAMode == EAntiAliasingModes.x32) //x32 is not supported, fallback to x16
{
if (_D3D.CheckDeviceMultisampleType(_D3D.Adapters.DefaultAdapter.Adapter, DeviceType.Hardware, _D3D.Adapters.DefaultAdapter.CurrentDisplayMode.Format, false, MultisampleType.SixteenSamples, out quality))
{
_PresentParameters.Multisample = MultisampleType.SixteenSamples;
_PresentParameters.MultisampleQuality = quality - 1;
}
else
CLog.LogError("[Direct3D] This AAMode is not supported by this device or driver, fallback to no AA");
}
#endregion Antialiasing
//Apply the VSync configuration
@@ -195,14 +177,6 @@ namespace Vocaluxe.Lib.Draw
{
_Device = new Device(_D3D, _D3D.Adapters.DefaultAdapter.Adapter, DeviceType.Hardware, Handle, flags, _PresentParameters);
}
catch (Exception e)
{
MessageBox.Show("Something went wrong during device creating, 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);
CLog.LogError(e.Message + " - Something went wrong during device creating, please check if your DirectX redistributables and grafic 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);
}
finally
{
if (_Device == null || _Device.Disposed)
@@ -210,24 +184,19 @@ namespace Vocaluxe.Lib.Draw
MessageBox.Show("Something went wrong during device creating, 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);
CLog.LogError("Something went wrong during device creating, please check if your DirectX redistributables and grafic card drivers are up to date. You can download the DirectX runtimes at http://www.microsoft.com/download/en/details.aspx?id=8109");
CLog.LogError(
"Something went wrong during device creating, please check if your DirectX redistributables and grafic 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);
}
}
this.CenterToScreen();
CenterToScreen();
}
#region form events
private void OnPaintEvent(object sender, PaintEventArgs e)
{
private void OnPaintEvent(object sender, PaintEventArgs e) {}
}
private void OnResizeEvent(object sender, EventArgs e)
{
}
private void OnResizeEvent(object sender, EventArgs e) {}
private void OnClosingEvent(object sender, CancelEventArgs e)
{
@@ -275,9 +244,7 @@ namespace Vocaluxe.Lib.Draw
{
// The window was minimized, so restore it to the last known size
if (ClientSize.Width == 0 || ClientSize.Height == 0)
{
ClientSize = _SizeBeforeMinimize;
}
if (_Run)
{
h = ClientSize.Height;
@@ -285,16 +252,16 @@ namespace Vocaluxe.Lib.Draw
y = 0;
x = 0;
if ((float)w / (float)h > CSettings.GetRenderAspect())
if (w / (float)h > CSettings.GetRenderAspect())
{
//The windows's width is too big
w = (int)Math.Round((float)h * CSettings.GetRenderAspect());
w = (int)Math.Round(h * CSettings.GetRenderAspect());
x = (ClientSize.Width - w) / 2;
}
else
{
//The windows's height is too big
h = (int)Math.Round((float)w / CSettings.GetRenderAspect());
h = (int)Math.Round(w / CSettings.GetRenderAspect());
y = (ClientSize.Height - h) / 2;
}
@@ -322,40 +289,41 @@ namespace Vocaluxe.Lib.Draw
//This currently not using real fullscreen mode but a borderless window
//Real fullscreen could be gained setting _PresentParameters.Windowed = true
//And calling Reset() and Init() after
_OldSize = this.ClientSize;
_OldSize = ClientSize;
int ScreenNr = 0;
for (int i = 0; i < Screen.AllScreens.Length; i++)
{
Screen scr = Screen.AllScreens[i];
if (scr.Bounds.Top <= this.Top && scr.Bounds.Left <= this.Left)
if (scr.Bounds.Top <= Top && scr.Bounds.Left <= Left)
ScreenNr = i;
}
this.ClientSize = new Size(Screen.AllScreens[ScreenNr].Bounds.Width, Screen.AllScreens[ScreenNr].Bounds.Height);
this.FormBorderStyle = FormBorderStyle.None;
ClientSize = new Size(Screen.AllScreens[ScreenNr].Bounds.Width, Screen.AllScreens[ScreenNr].Bounds.Height);
FormBorderStyle = FormBorderStyle.None;
CenterToScreen();
_fullscreen = true;
CConfig.FullScreen = EOffOn.TR_CONFIG_ON;
if (this.WindowState == FormWindowState.Maximized)
if (WindowState == FormWindowState.Maximized)
{
this.WindowState = FormWindowState.Normal;
WindowState = FormWindowState.Normal;
RResize();
this.WindowState = FormWindowState.Maximized;
WindowState = FormWindowState.Maximized;
}
else
RResize();
CConfig.SaveConfig();
}
/// <summary>
/// Triggers the windowed mode
/// </summary>
private void LeaveFullScreen()
{
this.ClientSize = _OldSize;
this.FormBorderStyle = FormBorderStyle.Sizable;
ClientSize = _OldSize;
FormBorderStyle = FormBorderStyle.Sizable;
CenterToScreen();
_fullscreen = false;
CConfig.FullScreen = EOffOn.TR_CONFIG_OFF;
@@ -399,30 +367,29 @@ namespace Vocaluxe.Lib.Draw
#endregion
#region keyboard event handlers
private void OnPreviewKeyDown(object sender, System.Windows.Forms.PreviewKeyDownEventArgs e)
private void OnPreviewKeyDown(object sender, PreviewKeyDownEventArgs e)
{
OnKeyDown(sender, new KeyEventArgs(e.KeyData));
}
private void OnKeyDown(object sender, System.Windows.Forms.KeyEventArgs e)
private void OnKeyDown(object sender, KeyEventArgs e)
{
_Keys.KeyDown(e);
}
private void OnKeyPress(object sender, System.Windows.Forms.KeyPressEventArgs e)
private void OnKeyPress(object sender, KeyPressEventArgs e)
{
_Keys.KeyPress(e);
}
private void OnKeyUp(object sender, System.Windows.Forms.KeyEventArgs e)
private void OnKeyUp(object sender, KeyEventArgs e)
{
_Keys.KeyUp(e);
}
#endregion keyboard event handlers
#region implementation
#region main stuff
/// <summary>
/// Inits the Device
@@ -432,48 +399,50 @@ namespace Vocaluxe.Lib.Draw
{
if (!_Device.Disposed)
{
this.Text = CSettings.GetFullVersionText();
Matrix translate = Matrix.Translation(new Vector3(-CSettings.iRenderW / 2, CSettings.iRenderH / 2, 0));
Matrix projection = Matrix.OrthoOffCenterLH(-CSettings.iRenderW / 2, CSettings.iRenderW / 2, -CSettings.iRenderH / 2, CSettings.iRenderH / 2, CSettings.zNear, CSettings.zFar);
_VertexBuffer = new VertexBuffer(_Device, CSettings.iVertexBufferElements * (4 * Marshal.SizeOf(typeof(TexturedColoredVertex))), Usage.WriteOnly | Usage.Dynamic, VertexFormat.Position | VertexFormat.Texture1 | VertexFormat.Diffuse, Pool.Default);
Text = CSettings.GetFullVersionText();
SlimDX.Matrix translate = SlimDX.Matrix.Translation(new Vector3(-CSettings.iRenderW / 2, CSettings.iRenderH / 2, 0));
SlimDX.Matrix projection = SlimDX.Matrix.OrthoOffCenterLH(-CSettings.iRenderW / 2, CSettings.iRenderW / 2, -CSettings.iRenderH / 2, CSettings.iRenderH / 2,
CSettings.zNear, CSettings.zFar);
_VertexBuffer = new VertexBuffer(_Device, CSettings.iVertexBufferElements * (4 * Marshal.SizeOf(typeof(TexturedColoredVertex))), Usage.WriteOnly | Usage.Dynamic,
VertexFormat.Position | VertexFormat.Texture1 | VertexFormat.Diffuse, Pool.Default);
if (_Device.SetStreamSource(0, _VertexBuffer, 0, Marshal.SizeOf(typeof(TexturedColoredVertex))).IsFailure)
CLog.LogError("Failed to set stream source");
_Device.VertexDeclaration = TexturedColoredVertex.GetDeclaration(_Device);
if(_Device.SetTransform(TransformState.Projection, projection).IsFailure)
if (_Device.SetTransform(TransformState.Projection, projection).IsFailure)
CLog.LogError("Failed to set orthogonal matrix");
if(_Device.SetTransform(TransformState.World, translate).IsFailure)
if (_Device.SetTransform(TransformState.World, translate).IsFailure)
CLog.LogError("Failed to set translation matrix");
if(_Device.SetRenderState(RenderState.CullMode, Cull.None).IsFailure)
if (_Device.SetRenderState(RenderState.CullMode, Cull.None).IsFailure)
CLog.LogError("Failed to set cull mode");
if(_Device.SetRenderState(RenderState.AlphaBlendEnable, true).IsFailure)
if (_Device.SetRenderState(RenderState.AlphaBlendEnable, true).IsFailure)
CLog.LogError("Failed to enable alpha blending");
if(_Device.SetRenderState(RenderState.Lighting, false).IsFailure)
if (_Device.SetRenderState(RenderState.Lighting, false).IsFailure)
CLog.LogError("Failed to disable lighting");
if(_Device.SetRenderState(RenderState.DestinationBlend, Blend.InverseSourceAlpha).IsFailure)
if (_Device.SetRenderState(RenderState.DestinationBlend, SlimDX.Direct3D9.Blend.InverseSourceAlpha).IsFailure)
CLog.LogError("Failed to set destination blend");
if(_Device.SetRenderState(RenderState.SourceBlend, Blend.SourceAlpha).IsFailure)
if (_Device.SetRenderState(RenderState.SourceBlend, SlimDX.Direct3D9.Blend.SourceAlpha).IsFailure)
CLog.LogError("Failed to set source blend");
if (_PresentParameters.Multisample != MultisampleType.None)
{
if(_Device.SetRenderState(RenderState.MultisampleAntialias, true).IsFailure)
if (_Device.SetRenderState(RenderState.MultisampleAntialias, true).IsFailure)
CLog.LogError("Failed to set antialiasing");
}
if(_Device.SetSamplerState(0, SamplerState.MinFilter, TextureFilter.Linear).IsFailure)
if (_Device.SetSamplerState(0, SamplerState.MinFilter, TextureFilter.Linear).IsFailure)
CLog.LogError("Failed to set min filter");
if(_Device.SetSamplerState(0, SamplerState.MagFilter, TextureFilter.Linear).IsFailure)
if (_Device.SetSamplerState(0, SamplerState.MagFilter, TextureFilter.Linear).IsFailure)
CLog.LogError("Failed to set mag filter");
if(_Device.SetSamplerState(0, SamplerState.MipFilter, TextureFilter.Linear).IsFailure)
if (_Device.SetSamplerState(0, SamplerState.MipFilter, TextureFilter.Linear).IsFailure)
CLog.LogError("Failed to set mip filter");
if(_Device.SetSamplerState(0, SamplerState.AddressU, TextureAddress.Clamp).IsFailure)
if (_Device.SetSamplerState(0, SamplerState.AddressU, TextureAddress.Clamp).IsFailure)
CLog.LogError("Failed to set clamping on u");
if(_Device.SetSamplerState(0, SamplerState.AddressV, TextureAddress.Clamp).IsFailure)
if (_Device.SetSamplerState(0, SamplerState.AddressV, TextureAddress.Clamp).IsFailure)
CLog.LogError("Failed to set claming on v");
if(_Device.SetTextureStageState(0, TextureStage.AlphaArg1, TextureArgument.Texture).IsFailure)
if (_Device.SetTextureStageState(0, TextureStage.AlphaArg1, TextureArgument.Texture).IsFailure)
CLog.LogError("Failed to set alpha argument 1");
if(_Device.SetTextureStageState(0, TextureStage.AlphaArg2, TextureArgument.Diffuse).IsFailure)
if (_Device.SetTextureStageState(0, TextureStage.AlphaArg2, TextureArgument.Diffuse).IsFailure)
CLog.LogError("Failed to set alpha argument 2");
if(_Device.SetTextureStageState(0, TextureStage.AlphaOperation, TextureOperation.Modulate).IsFailure)
if (_Device.SetTextureStageState(0, TextureStage.AlphaOperation, TextureOperation.Modulate).IsFailure)
CLog.LogError("Failed to set alpha operation");
Int16[] indices = new Int16[6];
@@ -493,18 +462,19 @@ namespace Vocaluxe.Lib.Draw
//This creates a new white texture and adds it to the texture pool
//This texture is used for the DrawRect method
Bitmap blankMap = new Bitmap(1, 1);
using (Bitmap blankMap = new Bitmap(1, 1))
{
Graphics g = Graphics.FromImage(blankMap);
g.Clear(Color.White);
g.Dispose();
_BlankTexture = AddTexture(blankMap);
blankMap.Dispose();
}
return true;
}
else
return false;
}
/// <summary>
/// Starts the rendering
/// </summary>
@@ -512,7 +482,7 @@ namespace Vocaluxe.Lib.Draw
{
_Run = true;
int delay = 0;
this.Show();
Show();
if (CConfig.FullScreen == EOffOn.TR_CONFIG_ON)
{
@@ -521,7 +491,7 @@ namespace Vocaluxe.Lib.Draw
}
//Resize window if aspect ratio is incorrect
if ((float)w / (float)h != CSettings.GetRenderAspect())
if (w / (float)h != CSettings.GetRenderAspect())
RResize();
while (_Run)
@@ -560,7 +530,7 @@ namespace Vocaluxe.Lib.Draw
}
}
//Apply fullscreen mode
if ((CSettings.bFullScreen && !_fullscreen) || (!CSettings.bFullScreen && _fullscreen))
if (CSettings.bFullScreen != _fullscreen)
{
if (!_fullscreen)
EnterFullScreen();
@@ -571,14 +541,13 @@ namespace Vocaluxe.Lib.Draw
delay = (int)Math.Floor(CConfig.CalcCycleTime() - CTime.GetMilliseconds());
if (delay >= 1 && CConfig.VSync == EOffOn.TR_CONFIG_OFF)
System.Threading.Thread.Sleep(delay);
Thread.Sleep(delay);
//Calculate the FPS Rate and restart the timer after a frame
CTime.CalculateFPS();
CTime.Restart();
}
else
this.Close();
}
Close();
}
/// <summary>
@@ -604,10 +573,8 @@ namespace Vocaluxe.Lib.Draw
foreach (KeyValuePair<int, Texture> p in _D3DTextures)
{
if (p.Value != null)
{
p.Value.Dispose();
}
}
TexturedColoredVertex.GetDeclaration(_Device).Dispose();
_VertexBuffer.Dispose();
@@ -654,7 +621,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)));
}
@@ -665,7 +632,7 @@ namespace Vocaluxe.Lib.Draw
/// <param name="vertices">A TexturedColoredVertex array containg 4 vertices</param>
/// <param name="tex">The texture the vertex should be textured with</param>
/// <param name="rotation">The vertices' rotation</param>
private void AddToVertexBuffer(TexturedColoredVertex[] vertices, Texture tex, Matrix rotation)
private void AddToVertexBuffer(TexturedColoredVertex[] vertices, Texture tex, SlimDX.Matrix rotation)
{
//The vertexbuffer is full, so we need to flush it before we can continue
if (_Vertices.Count >= CSettings.iVertexBufferElements)
@@ -687,7 +654,7 @@ namespace Vocaluxe.Lib.Draw
{
//The vertex buffer locks are slow actions, its better to lock once per frame and write all vertices to the buffer at once
DataStream stream = _VertexBuffer.Lock(0, _Vertices.Count * Marshal.SizeOf(typeof(TexturedColoredVertex)), LockFlags.Discard);
stream.WriteRange<TexturedColoredVertex>(_Vertices.ToArray());
stream.WriteRange(_Vertices.ToArray());
_VertexBuffer.Unlock();
stream.Dispose();
@@ -709,10 +676,9 @@ namespace Vocaluxe.Lib.Draw
_VerticesRotationMatrices.Clear();
}
}
#endregion main stuff
#endregion main stuff
#region Basic Draw Methods
/// <summary>
/// Removes all textures from the screen
/// </summary>
@@ -734,6 +700,8 @@ namespace Vocaluxe.Lib.Draw
Surface textureSurface = tex.GetSurfaceLevel(0);
Surface.FromSurface(textureSurface, backbufferSurface, Filter.Default, 0);
backbufferSurface.Dispose();
lock (MutexTexture)
{
_D3DTextures.Add(_IDs.Peek(), tex);
texture.color = new SColorF(1f, 1f, 1f, 1f);
@@ -744,8 +712,6 @@ namespace Vocaluxe.Lib.Draw
texture.h2 = CheckForNextPowerOf2(texture.height);
texture.index = _IDs.Dequeue();
lock (MutexTexture)
{
_Textures[texture.index] = texture;
}
return texture;
@@ -857,11 +823,11 @@ namespace Vocaluxe.Lib.Draw
{
DrawTextureReflection(_BlankTexture, rect, color, rect, space, height);
}
#endregion Basic Draw Methods
#region Textures
#region adding
#region Textures
#region adding
/// <summary>
/// Adds a texture and stores it in the VRam
/// </summary>
@@ -869,7 +835,7 @@ namespace Vocaluxe.Lib.Draw
/// <returns>A STexture object containing the added texture</returns>
public STexture AddTexture(string TexturePath)
{
if (System.IO.File.Exists(TexturePath))
if (File.Exists(TexturePath))
{
Bitmap bmp;
try
@@ -881,8 +847,15 @@ namespace Vocaluxe.Lib.Draw
CLog.LogError("Error loading Texture: " + TexturePath);
return new STexture(-1);
}
STexture s = AddTexture(bmp, TexturePath);
STexture s;
try
{
s = AddTexture(bmp, TexturePath);
}
finally
{
bmp.Dispose();
}
return s;
}
CLog.LogError("Can't find File: " + TexturePath);
@@ -892,14 +865,13 @@ namespace Vocaluxe.Lib.Draw
/// <summary>
/// Adds a texture and stores it in the Vram
/// </summary>
/// <param name="bmp">The Bitmap of which the texute will be created from</param>
/// <param name="bmp">The Bitmap of which the texure will be created from</param>
/// <param name="TexturePath">The path to the texture</param>
/// <returns>A STexture object containing the added texture</returns>
public STexture AddTexture(Bitmap bmp, string TexturePath)
{
STexture texture = new STexture(-1);
if (bmp.Height == 0 || bmp.Width == 0)
return texture;
return new STexture(-1);
int MaxSize;
//Apply the right max size
switch (CConfig.TextureQuality)
@@ -927,7 +899,7 @@ namespace Vocaluxe.Lib.Draw
int w = bmp.Width;
int h = bmp.Height;
if (w > MaxSize)
if (w > MaxSize && w > h)
{
h = (int)Math.Round((float)MaxSize / bmp.Width * bmp.Height);
w = MaxSize;
@@ -939,68 +911,46 @@ namespace Vocaluxe.Lib.Draw
h = MaxSize;
}
texture.width = w;
texture.height = h;
//Older graphics card can only handle textures with sizes being powers of two
texture.w2 = (float)CheckForNextPowerOf2(w);
texture.h2 = (float)CheckForNextPowerOf2(h);
w = (int)CheckForNextPowerOf2(w);
h = (int)CheckForNextPowerOf2(h);
if (texture.w2 != bmp.Width || texture.h2 != bmp.Height)
Bitmap bmp2 = null;
byte[] Data;
try
{
if (w != bmp.Width || h != bmp.Height)
{
//Create a new Bitmap with the new sizes
Bitmap bmp2 = new Bitmap((int)texture.w2, (int)texture.h2);
bmp2 = new Bitmap(w, h);
//Scale the texture
Graphics g = Graphics.FromImage(bmp2);
g.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.HighQualityBicubic;
g.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.HighQuality;
g.InterpolationMode = InterpolationMode.HighQualityBicubic;
g.SmoothingMode = SmoothingMode.HighQuality;
g.DrawImage(bmp, new Rectangle(0, 0, bmp2.Width, bmp2.Height));
g.Dispose();
bmp = bmp2;
}
texture.width_ratio = 1f;
texture.height_ratio = 1f;
//Fill the new Bitmap with the texture data
BitmapData bmp_data = bmp.LockBits(new Rectangle(0, 0, (int)texture.w2, (int)texture.h2), ImageLockMode.ReadOnly, System.Drawing.Imaging.PixelFormat.Format32bppArgb);
byte[] Data = new byte[4 * (int)texture.w2 * (int)texture.h2];
BitmapData bmp_data = bmp.LockBits(new Rectangle(0, 0, w, h), ImageLockMode.ReadOnly, PixelFormat.Format32bppArgb);
Data = new byte[4 * w * h];
Marshal.Copy(bmp_data.Scan0, Data, 0, Data.Length);
bmp.UnlockBits(bmp_data);
//Create a new texture in the managed pool, which does not need to be recreated on a lost device
//because a copy of the texture is hold in the Ram
Texture t = new Texture(_Device, (int)texture.w2, (int)texture.h2, 0, Usage.AutoGenerateMipMap, Format.A8R8G8B8, Pool.Managed);
//Lock the texture and fill it with the data
DataRectangle rect = t.LockRectangle(0, LockFlags.Discard);
for (int i = 0; i < Data.Length; )
{
rect.Data.Write(Data, i, 4 * (int)texture.w2);
i += 4 * (int)texture.w2;
rect.Data.Position = rect.Data.Position - 4 * (int)texture.w2;
rect.Data.Position += rect.Pitch;
}
t.UnlockRectangle(0);
bmp_data = null;
// Add to Texture List
texture.color = new SColorF(1f, 1f, 1f, 1f);
texture.rect = new SRectF(0f, 0f, texture.width, texture.height, 0f);
texture.TexturePath = String.Empty;
lock (MutexTexture)
finally
{
_D3DTextures.Add(_IDs.Peek(), t);
texture.index = _IDs.Dequeue();
_Textures[texture.index] = texture;
if (bmp2 != null)
bmp2.Dispose();
}
return texture;
return AddTexture(w, h, ref Data);
}
/// <summary>
/// Adds a texture and stores it in the Vram
/// </summary>
/// <param name="bmp">The Bitmap of which the texute will be created from</param>
/// <param name="bmp">The Bitmap of which the texure will be created from</param>
/// <returns>A STexture object containing the added texture</returns>
public STexture AddTexture(Bitmap bmp)
{
@@ -1014,6 +964,59 @@ namespace Vocaluxe.Lib.Draw
return AddTexture(W, H, ref PointerData);
}
public STexture AddTexture(int W, int H, ref byte[] Data)
{
STexture texture = new STexture(-1);
Texture t = _CreateTexture(W, H, ref Data, ref texture);
lock (MutexTexture)
{
_D3DTextures.Add(_IDs.Peek(), t);
texture.index = _IDs.Dequeue();
_Textures[texture.index] = texture;
}
return texture;
}
private Texture _CreateTexture(int W, int H, ref byte[] Data, ref STexture sTexture)
{
sTexture.width = W;
sTexture.height = H;
sTexture.w2 = CheckForNextPowerOf2(W);
sTexture.h2 = CheckForNextPowerOf2(H);
sTexture.width_ratio = W / sTexture.w2;
sTexture.height_ratio = H / sTexture.h2;
//Create a new texture in the managed pool, which does not need to be recreated on a lost device
//because a copy of the texture is hold in the Ram
Texture t = null;
try
{
t = new Texture(_Device, (int)sTexture.w2, (int)sTexture.h2, 0, Usage.AutoGenerateMipMap, Format.A8R8G8B8, Pool.Managed);
//Lock the texture and fill it with the data
DataRectangle rect = t.LockRectangle(0, LockFlags.Discard);
for (int i = 0; i < Data.Length; i += 4 * W)
{
rect.Data.Write(Data, i, 4 * (int)sTexture.w2);
rect.Data.Position = rect.Data.Position - 4 * (int)sTexture.w2;
rect.Data.Position += rect.Pitch;
}
t.UnlockRectangle(0);
sTexture.color = new SColorF(1f, 1f, 1f, 1f);
sTexture.rect = new SRectF(0f, 0f, sTexture.width, sTexture.height, 0f);
sTexture.TexturePath = String.Empty;
}
catch (Exception)
{
if (t != null)
t.Dispose();
throw;
}
return t;
}
public STexture QuequeTexture(int W, int H, ref byte[] Data)
{
STexture texture = new STexture(-1);
@@ -1035,40 +1038,6 @@ namespace Vocaluxe.Lib.Draw
}
return texture;
}
public STexture AddTexture(int W, int H, ref byte[] Data)
{
STexture texture = new STexture(-1);
texture.width = W;
texture.height = H;
texture.w2 = CheckForNextPowerOf2(texture.width);
texture.h2 = CheckForNextPowerOf2(texture.height);
texture.width_ratio = texture.width / texture.w2;
texture.height_ratio = texture.height / texture.h2;
Texture t = new Texture(_Device, (int)texture.w2, (int)texture.h2, 0, Usage.AutoGenerateMipMap, Format.A8R8G8B8, Pool.Managed);
DataRectangle rect = t.LockRectangle(0, LockFlags.Discard);
for (int i = 0; i < Data.Length; )
{
rect.Data.Write(Data, i, 4 * W);
i += 4 * W;
rect.Data.Position = rect.Data.Position - 4 * W;
rect.Data.Position += rect.Pitch;
}
t.UnlockRectangle(0);
texture.color = new SColorF(1f, 1f, 1f, 1f);
texture.rect = new SRectF(0f, 0f, texture.width, texture.height, 0f);
texture.TexturePath = String.Empty;
lock (MutexTexture)
{
_D3DTextures.Add(_IDs.Peek(), t);
texture.index = _IDs.Dequeue();
_Textures[texture.index] = texture;
}
return texture;
}
#endregion adding
#region updating
@@ -1096,18 +1065,22 @@ namespace Vocaluxe.Lib.Draw
{
if ((Texture.index >= 0) && (_Textures.Count > 0) && _TextureExists(ref Texture))
{
DataRectangle rect = _D3DTextures[Texture.index].LockRectangle(0, LockFlags.Discard);
for (int i = 0; i < Data.Length; )
lock (MutexTexture)
{
rect.Data.Write(Data, i, 4 * (int)Texture.width);
i += 4 * (int)Texture.width;
rect.Data.Position = rect.Data.Position - 4 * (int)Texture.width;
DataRectangle rect = _D3DTextures[Texture.index].LockRectangle(0, LockFlags.Discard);
int W = (int)Texture.width;
for (int i = 0; i < Data.Length; i += 4 * W)
{
rect.Data.Write(Data, i, 4 * W);
rect.Data.Position -= 4 * W;
rect.Data.Position += rect.Pitch;
}
_D3DTextures[Texture.index].UnlockRectangle(0);
}
Texture.height_ratio = Texture.height / CheckForNextPowerOf2(Texture.height);
Texture.width_ratio = Texture.width / CheckForNextPowerOf2(Texture.width);
//Flamefire: Unneccesary as height can not be changed by this! (Texture gets copied)
//Texture.height_ratio = Texture.height / CheckForNextPowerOf2(Texture.height);
//Texture.width_ratio = Texture.width / CheckForNextPowerOf2(Texture.width);
return true;
/*Surface s = _D3DTextures[Texture.index].GetSurfaceLevel(0);
@@ -1325,7 +1298,6 @@ namespace Vocaluxe.Lib.Draw
/// <param name="color">A SColorF struct containing a color which the texture will be colored in</param>
/// <param name="begin">A Value ranging from 0 to 1 containing the beginning of the texture</param>
/// <param name="end">A Value ranging from 0 to 1 containing the ending of the texture</param>
public void DrawTexture(STexture Texture, SRectF rect, SColorF color, float begin, float end)
{
if (_TextureExists(ref Texture))
@@ -1453,37 +1425,15 @@ namespace Vocaluxe.Lib.Draw
return;
STextureQueque q = _Queque[0];
STexture texture = new STexture(-1);
STexture texture;
if (_Textures.ContainsKey(q.ID))
texture = _Textures[q.ID];
if (texture.index < 0)
else
return;
texture.width = q.width;
texture.height = q.height;
texture.w2 = CheckForNextPowerOf2(texture.width);
texture.h2 = CheckForNextPowerOf2(texture.height);
texture.width_ratio = texture.width / texture.w2;
texture.height_ratio = texture.height / texture.h2;
Texture t = new Texture(_Device, (int)texture.w2, (int)texture.h2, 0, Usage.AutoGenerateMipMap, Format.A8R8G8B8, Pool.Managed);
DataRectangle rect = t.LockRectangle(0, LockFlags.Discard);
for (int i = 0; i < q.data.Length; )
{
rect.Data.Write(q.data, i, 4 * q.width);
i += 4 * q.width;
rect.Data.Position = rect.Data.Position - 4 * q.width;
rect.Data.Position += rect.Pitch;
}
t.UnlockRectangle(0);
Texture t = _CreateTexture(q.width, q.height, ref q.data, ref texture);
_D3DTextures[q.ID] = t;
// Add to Texture List
texture.color = new SColorF(1f, 1f, 1f, 1f);
texture.rect = new SRectF(0f, 0f, texture.width, texture.height, 0f);
texture.TexturePath = String.Empty;
_Textures[texture.index] = texture;
_Queque.RemoveAt(0);
}
@@ -1498,6 +1448,7 @@ namespace Vocaluxe.Lib.Draw
return _Textures.Count;
}
#endregion Textures
#endregion implementation
#region utility
@@ -1510,30 +1461,32 @@ namespace Vocaluxe.Lib.Draw
{
if (!_NonPowerOf2TextureSupported)
{
if (n < 0) throw new ArgumentOutOfRangeException("n", "Must be positive.");
return (float)System.Math.Pow(2, System.Math.Ceiling(System.Math.Log((double)n, 2)));
if (n < 0)
throw new ArgumentOutOfRangeException("n", "Must be positive.");
return (float)Math.Pow(2, Math.Ceiling(Math.Log(n, 2)));
}
else return n;
else
return n;
}
private Matrix CalculateRotationMatrix(float rot, float rx1, float rx2, float ry1, float ry2)
private SlimDX.Matrix CalculateRotationMatrix(float rot, float rx1, float rx2, float ry1, float ry2)
{
Matrix originTranslation = Matrix.Translation(new Vector3(-CSettings.iRenderW / 2, CSettings.iRenderH / 2, 0));
SlimDX.Matrix originTranslation = SlimDX.Matrix.Translation(new Vector3(-CSettings.iRenderW / 2, CSettings.iRenderH / 2, 0));
if (rot != 0)
{
float rotation = rot * (float)Math.PI / 180;
float centerX = (rx1 + rx2) / 2f;
float centerY = -(ry1 + ry2) / 2f;
Matrix translationA = Matrix.Translation(-centerX, -centerY, 0);
Matrix rotationMat = Matrix.RotationZ(-rotation);
Matrix translationB = Matrix.Translation(centerX, centerY, 0);
SlimDX.Matrix translationA = SlimDX.Matrix.Translation(-centerX, -centerY, 0);
SlimDX.Matrix rotationMat = SlimDX.Matrix.RotationZ(-rotation);
SlimDX.Matrix translationB = SlimDX.Matrix.Translation(centerX, centerY, 0);
//Multiplicate the matrices to get the real world matrix,
//First shift the texture into the center
//Rotate it and shift it back to the origin position
//Apply the originTranslation after
Matrix result = translationA * rotationMat * translationB * originTranslation;
SlimDX.Matrix result = translationA * rotationMat * translationB * originTranslation;
return result;
}
return originTranslation;
@@ -1547,8 +1500,8 @@ namespace Vocaluxe.Lib.Draw
public static VertexElement[] Elements =
{
new VertexElement(0, 0, DeclarationType.Float3, DeclarationMethod.Default, DeclarationUsage.Position, 0),
new VertexElement(0, sizeof(float) *3, DeclarationType.Float2, DeclarationMethod.Default, DeclarationUsage.TextureCoordinate, 0),
new VertexElement(0, sizeof(float) * 3 + sizeof(float)*2, DeclarationType.Color, DeclarationMethod.Default, DeclarationUsage.Color, 0),
new VertexElement(0, sizeof(float) * 3, DeclarationType.Float2, DeclarationMethod.Default, DeclarationUsage.TextureCoordinate, 0),
new VertexElement(0, sizeof(float) * 3 + sizeof(float) * 2, DeclarationType.Color, DeclarationMethod.Default, DeclarationUsage.Color, 0),
VertexElement.VertexDeclarationEnd
};
@@ -1558,17 +1511,15 @@ namespace Vocaluxe.Lib.Draw
public TexturedColoredVertex(Vector3 position, Vector2 texture, int color)
{
this.Position = position;
this.Texture = texture;
this.Color = color;
Position = position;
Texture = texture;
Color = color;
}
public static VertexDeclaration GetDeclaration(Device device)
{
if (sDeclaration == null || sDeclaration.Disposed)
{
sDeclaration = new VertexDeclaration(device, Elements);
}
return sDeclaration;
}
+62 -90
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 readonly Bitmap _backbuffer;
private readonly Graphics _g;
private bool _fullscreen;
private CKeys _Keys;
private CMouse _Mouse;
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 readonly List<STexture> _Textures;
private readonly List<Bitmap> _Bitmaps;
private Color ClearColor = Color.DarkBlue;
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)
{
@@ -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,10 +306,8 @@ namespace Vocaluxe.Lib.Draw
Texture = CopyScreen();
}
else
{
_Bitmaps[Texture.index] = new Bitmap(_backbuffer);
}
}
public void MakeScreenShot()
{
@@ -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,7 +381,7 @@ namespace Vocaluxe.Lib.Draw
if (!found)
{
Bitmap bmp = new Bitmap(TexturePath);
using (Bitmap bmp = new Bitmap(TexturePath))
return AddTexture(bmp);
}
}
@@ -433,12 +418,14 @@ 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);
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,42 +447,32 @@ 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);
}
}
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);
}
}
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,8 +497,8 @@ 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;
@@ -534,14 +506,14 @@ namespace Vocaluxe.Lib.Draw
cm.Matrix22 = color.B;
cm.Matrix44 = 1;
ImageAttributes ia = new ImageAttributes();
using (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();
}
}
return newBitmap;
}
File diff suppressed because it is too large. Load diff
+1 -5
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
{
+33 -18
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,9 +52,9 @@ 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;
}
@@ -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,6 +273,7 @@ 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);
+4 -8
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()
{
Loaded 100 of 191 files, more files were not shown because too many files have changed in this diff. Show more