diff --git a/Output/Themes/Ambient/Screens/ScreenSong.xml b/Output/Themes/Ambient/Screens/ScreenSong.xml
index e279174b..29173a81 100644
--- a/Output/Themes/Ambient/Screens/ScreenSong.xml
+++ b/Output/Themes/Ambient/Screens/ScreenSong.xml
@@ -1844,7 +1844,7 @@
Outline
-
+ %a - %t
diff --git a/PartyModes/PartyModeChallenge/CPartyModeChallenge.cs b/PartyModes/PartyModeChallenge/CPartyModeChallenge.cs
index fcdd4b98..e15974b2 100644
--- a/PartyModes/PartyModeChallenge/CPartyModeChallenge.cs
+++ b/PartyModes/PartyModeChallenge/CPartyModeChallenge.cs
@@ -643,13 +643,12 @@ namespace VocaluxeLib.PartyModes.Challenge
int pos = 1;
int lastPoints = 0;
int lastSingPoints = 0;
- for (int i = 0; i < _GameData.ResultTable.Count; i++)
- {
- if (lastPoints > _GameData.ResultTable[i].NumGamePoints || lastSingPoints > _GameData.ResultTable[i].NumSingPoints)
+ foreach (CResultTableRow resultRow in _GameData.ResultTable) {
+ if (lastPoints > resultRow.NumGamePoints || lastSingPoints > resultRow.NumSingPoints)
pos++;
- _GameData.ResultTable[i].Position = pos;
- lastPoints = _GameData.ResultTable[i].NumGamePoints;
- lastSingPoints = _GameData.ResultTable[i].NumSingPoints;
+ resultRow.Position = pos;
+ lastPoints = resultRow.NumGamePoints;
+ lastSingPoints = resultRow.NumSingPoints;
}
}
diff --git a/PartyModes/PartyModeChallenge/CPartyScreenChallengeMain.cs b/PartyModes/PartyModeChallenge/CPartyScreenChallengeMain.cs
index 82db58c1..87d6704a 100644
--- a/PartyModes/PartyModeChallenge/CPartyScreenChallengeMain.cs
+++ b/PartyModes/PartyModeChallenge/CPartyScreenChallengeMain.cs
@@ -412,12 +412,11 @@ namespace VocaluxeLib.PartyModes.Challenge
_RoundsTable.Add(rtr);
}
//Create statics and texts for rounds
- for (int round = 0; round < _RoundsTable.Count; round++)
- {
+ foreach (CRoundsTableRow roundRow in _RoundsTable) {
//Round-number
CText text = GetNewText(_Texts[_TextRoundNumber]);
_AddText(text);
- _RoundsTable[round].Number = text;
+ roundRow.Number = text;
for (int row = 0; row < 2; row++)
{
for (int column = 0; column < 3; column++)
@@ -425,11 +424,11 @@ namespace VocaluxeLib.PartyModes.Challenge
//Player
text = GetNewText(_Texts[_TextRoundPlayer]);
_AddText(text);
- _RoundsTable[round].TextPlayer.Add(text);
+ roundRow.TextPlayer.Add(text);
//Score
text = GetNewText(_Texts[_TextRoundScore]);
_AddText(text);
- _RoundsTable[round].TextScores.Add(text);
+ roundRow.TextScores.Add(text);
}
}
}
@@ -458,11 +457,10 @@ namespace VocaluxeLib.PartyModes.Challenge
float delta = _Texts[_TextRoundNumber].Height;
//Update statics and texts for rounds
- for (int round = 0; round < _RoundsTable.Count; round++)
- {
+ foreach (CRoundsTableRow roundRow in _RoundsTable) {
//Round-number
- _RoundsTable[round].Number.X = numberX;
- _RoundsTable[round].Number.Y = numberY;
+ roundRow.Number.X = numberX;
+ roundRow.Number.Y = numberY;
int numInnerRows = (int)Math.Ceiling(_GameState.NumPlayerAtOnce / ((double)numPlayerInOneRow));
for (int row = 0; row < numInnerRows; row++)
{
@@ -479,14 +477,14 @@ namespace VocaluxeLib.PartyModes.Challenge
float x = numberX + 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 = numberY;
- _RoundsTable[round].TextPlayer[column].MaxWidth = maxw;
+ roundRow.TextPlayer[column].X = x;
+ roundRow.TextPlayer[column].Y = numberY;
+ roundRow.TextPlayer[column].MaxWidth = maxw;
//Score
- _RoundsTable[round].TextScores[column] = _RoundsTable[round].TextScores[column];
- _RoundsTable[round].TextScores[column].X = x;
- _RoundsTable[round].TextScores[column].Y = numberY + delta;
- _RoundsTable[round].TextScores[column].MaxWidth = maxw;
+ roundRow.TextScores[column] = roundRow.TextScores[column];
+ roundRow.TextScores[column].X = x;
+ roundRow.TextScores[column].Y = numberY + delta;
+ roundRow.TextScores[column].MaxWidth = maxw;
}
numberY = numberY + delta + delta;
}
diff --git a/PartyModes/PartyModeChallengeMedley/CChallengeRounds.cs b/PartyModes/PartyModeChallengeMedley/CChallengeRounds.cs
index 1305ea98..ea149cdc 100644
--- a/PartyModes/PartyModeChallengeMedley/CChallengeRounds.cs
+++ b/PartyModes/PartyModeChallengeMedley/CChallengeRounds.cs
@@ -155,8 +155,6 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley
if (_Combs.Count == 0)
_Create();
- CCombination combs = new CCombination();
-
if (_NumPlayer == _NumMics)
return _Combs[0];
diff --git a/PartyModes/PartyModeChallengeMedley/CPartyModeChallengeMedley.cs b/PartyModes/PartyModeChallengeMedley/CPartyModeChallengeMedley.cs
index 7028f104..a9f76d23 100644
--- a/PartyModes/PartyModeChallengeMedley/CPartyModeChallengeMedley.cs
+++ b/PartyModes/PartyModeChallengeMedley/CPartyModeChallengeMedley.cs
@@ -718,13 +718,12 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley
int pos = 1;
int lastPoints = 0;
int lastSingPoints = 0;
- for (int i = 0; i < _GameData.ResultTable.Count; i++)
- {
- if (lastPoints > _GameData.ResultTable[i].NumGamePoints || lastSingPoints > _GameData.ResultTable[i].NumSingPoints)
+ foreach (CResultTableRow resultRow in _GameData.ResultTable) {
+ if (lastPoints > resultRow.NumGamePoints || lastSingPoints > resultRow.NumSingPoints)
pos++;
- _GameData.ResultTable[i].Position = pos;
- lastPoints = _GameData.ResultTable[i].NumGamePoints;
- lastSingPoints = _GameData.ResultTable[i].NumSingPoints;
+ resultRow.Position = pos;
+ lastPoints = resultRow.NumGamePoints;
+ lastSingPoints = resultRow.NumSingPoints;
}
}
diff --git a/PartyModes/PartyModeChallengeMedley/CPartyScreenChallengeMedleyMain.cs b/PartyModes/PartyModeChallengeMedley/CPartyScreenChallengeMedleyMain.cs
index ba0d258d..3ac5fc60 100644
--- a/PartyModes/PartyModeChallengeMedley/CPartyScreenChallengeMedleyMain.cs
+++ b/PartyModes/PartyModeChallengeMedley/CPartyScreenChallengeMedleyMain.cs
@@ -412,12 +412,11 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley
_RoundsTable.Add(rtr);
}
//Create statics and texts for rounds
- for (int round = 0; round < _RoundsTable.Count; round++)
- {
+ foreach (CRoundsTableRow roundRow in _RoundsTable) {
//Round-number
CText text = GetNewText(_Texts[_TextRoundNumber]);
_AddText(text);
- _RoundsTable[round].Number = text;
+ roundRow.Number = text;
for (int row = 0; row < 2; row++)
{
for (int column = 0; column < 3; column++)
@@ -425,11 +424,11 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley
//Player
text = GetNewText(_Texts[_TextRoundPlayer]);
_AddText(text);
- _RoundsTable[round].TextPlayer.Add(text);
+ roundRow.TextPlayer.Add(text);
//Score
text = GetNewText(_Texts[_TextRoundScore]);
_AddText(text);
- _RoundsTable[round].TextScores.Add(text);
+ roundRow.TextScores.Add(text);
}
}
}
@@ -458,11 +457,10 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley
float delta = _Texts[_TextRoundNumber].Height;
//Update statics and texts for rounds
- for (int round = 0; round < _RoundsTable.Count; round++)
- {
+ foreach (CRoundsTableRow roundRow in _RoundsTable) {
//Round-number
- _RoundsTable[round].Number.X = numberX;
- _RoundsTable[round].Number.Y = numberY;
+ roundRow.Number.X = numberX;
+ roundRow.Number.Y = numberY;
int numInnerRows = (int)Math.Ceiling(_GameState.NumPlayerAtOnce / ((double)numPlayerInOneRow));
for (int row = 0; row < numInnerRows; row++)
{
@@ -479,14 +477,14 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley
float x = numberX + 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 = numberY;
- _RoundsTable[round].TextPlayer[column].MaxWidth = maxw;
+ roundRow.TextPlayer[column].X = x;
+ roundRow.TextPlayer[column].Y = numberY;
+ roundRow.TextPlayer[column].MaxWidth = maxw;
//Score
- _RoundsTable[round].TextScores[column] = _RoundsTable[round].TextScores[column];
- _RoundsTable[round].TextScores[column].X = x;
- _RoundsTable[round].TextScores[column].Y = numberY + delta;
- _RoundsTable[round].TextScores[column].MaxWidth = maxw;
+ roundRow.TextScores[column] = roundRow.TextScores[column];
+ roundRow.TextScores[column].X = x;
+ roundRow.TextScores[column].Y = numberY + delta;
+ roundRow.TextScores[column].MaxWidth = maxw;
}
numberY = numberY + delta + delta;
}
diff --git a/PartyModes/PartyModeChallengeMedley/CPartyScreenChallengeMedleyNames.cs b/PartyModes/PartyModeChallengeMedley/CPartyScreenChallengeMedleyNames.cs
index af6cbc13..959dc7ec 100644
--- a/PartyModes/PartyModeChallengeMedley/CPartyScreenChallengeMedleyNames.cs
+++ b/PartyModes/PartyModeChallengeMedley/CPartyScreenChallengeMedleyNames.cs
@@ -85,7 +85,6 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley
_Data.ScreenNames.ProfileIDs = new List();
- List buttons = new List();
_ThemeButtons = new string[] {_ButtonBack, _ButtonNext, _ButtonPlayerDestination, _ButtonPlayerChoose};
_Data = new SDataFromScreen();
@@ -459,21 +458,20 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley
private bool _OnAdd()
{
- for (int i = 0; i < _PlayerChooseButtons.Count; i++)
- {
- if (_PlayerChooseButtons[i].Button.Selected && _PlayerChooseButtons[i].ProfileID != -1)
+ foreach (CPlayerChooseButton chooseButton in _PlayerChooseButtons) {
+ if (chooseButton.Button.Selected && chooseButton.ProfileID != -1)
{
if (_Data.ScreenNames.ProfileIDs.Count < _NumPlayer)
{
- _Data.ScreenNames.ProfileIDs.Add(_PlayerChooseButtons[i].ProfileID);
+ _Data.ScreenNames.ProfileIDs.Add(chooseButton.ProfileID);
int added = _Data.ScreenNames.ProfileIDs.Count - 1;
_UpdateButtonNext();
//Update texture and name
_PlayerDestinationButtons[added].Color = new SColorF(1, 1, 1, 0.6f);
_PlayerDestinationButtons[added].SelColor = new SColorF(1, 1, 1, 1);
- _PlayerDestinationButtons[added].Texture = CBase.Profiles.GetProfiles()[_PlayerChooseButtons[i].ProfileID].Avatar.Texture;
- _PlayerDestinationButtons[added].SelTexture = CBase.Profiles.GetProfiles()[_PlayerChooseButtons[i].ProfileID].Avatar.Texture;
- _PlayerDestinationButtons[added].Text.Text = CBase.Profiles.GetProfiles()[_PlayerChooseButtons[i].ProfileID].PlayerName;
+ _PlayerDestinationButtons[added].Texture = CBase.Profiles.GetProfiles()[chooseButton.ProfileID].Avatar.Texture;
+ _PlayerDestinationButtons[added].SelTexture = CBase.Profiles.GetProfiles()[chooseButton.ProfileID].Avatar.Texture;
+ _PlayerDestinationButtons[added].Text.Text = CBase.Profiles.GetProfiles()[chooseButton.ProfileID].PlayerName;
_PlayerDestinationButtons[added].Enabled = true;
//Update Tiles-List
_UpdateButtonPlayerChoose();
diff --git a/PartyModes/PartyModeTicTacToe/CPartyScreenTicTacToeNames.cs b/PartyModes/PartyModeTicTacToe/CPartyScreenTicTacToeNames.cs
index fb355443..eabff2aa 100644
--- a/PartyModes/PartyModeTicTacToe/CPartyScreenTicTacToeNames.cs
+++ b/PartyModes/PartyModeTicTacToe/CPartyScreenTicTacToeNames.cs
@@ -90,7 +90,6 @@ namespace VocaluxeLib.PartyModes.TicTacToe
_Data.ScreenNames.ProfileIDsTeam1 = new List();
_Data.ScreenNames.ProfileIDsTeam2 = new List();
- List buttons = new List();
_ThemeButtons = new string[] {_ButtonBack, _ButtonNext, _ButtonPlayerDestination, _ButtonPlayerChoose, _ButtonPlayerChooseScrollUp, _ButtonPlayerChooseScrollDown};
_Data = new SDataFromScreen();
@@ -178,18 +177,17 @@ namespace VocaluxeLib.PartyModes.TicTacToe
_OldMouseX = mouseEvent.X;
_OldMouseY = mouseEvent.Y;
//Check if mouse if over tile
- for (int i = 0; i < _PlayerChooseButtons.Count; i++)
- {
- if (_PlayerChooseButtons[i].Button.Selected)
+ foreach (CPlayerChooseButton chooseButton in _PlayerChooseButtons) {
+ if (chooseButton.Button.Selected)
{
- _SelectedPlayerNr = _PlayerChooseButtons[i].ProfileID;
+ _SelectedPlayerNr = chooseButton.ProfileID;
if (_SelectedPlayerNr != -1)
{
//Activate mouse-selecting
_SelectingMouseActive = true;
//Update of Drag/Drop-Texture
_ChooseAvatarStatic.Visible = true;
- _ChooseAvatarStatic.Rect = _PlayerChooseButtons[i].Button.Rect;
+ _ChooseAvatarStatic.Rect = chooseButton.Button.Rect;
_ChooseAvatarStatic.Rect.Z = -100;
_ChooseAvatarStatic.Color = new SColorF(1, 1, 1, 1);
_ChooseAvatarStatic.Texture = CBase.Profiles.GetProfiles()[_SelectedPlayerNr].Avatar.Texture;
diff --git a/Vocaluxe/Base/CBackgroundMusic.cs b/Vocaluxe/Base/CBackgroundMusic.cs
index bfd73230..5c645411 100644
--- a/Vocaluxe/Base/CBackgroundMusic.cs
+++ b/Vocaluxe/Base/CBackgroundMusic.cs
@@ -280,7 +280,6 @@ namespace Vocaluxe.Base
{
if (_PreviousFileNames.Count > 0 && _PreviousMusicIndex >= 0)
{
- float pos = CSound.GetPosition(_CurrentMusicStream);
if (CSound.GetPosition(_CurrentMusicStream) >= 1.5f)
{
//Seek to #Start-Tag, if found
diff --git a/Vocaluxe/Base/CDataBase.cs b/Vocaluxe/Base/CDataBase.cs
index fa0ee5cf..9a2f899f 100644
--- a/Vocaluxe/Base/CDataBase.cs
+++ b/Vocaluxe/Base/CDataBase.cs
@@ -401,7 +401,7 @@ namespace Vocaluxe.Base
{
_CreateOrConvert(oldDBFilePath);
_CreateOrConvert(_HighscoreFilePath);
- _ImportData(oldDBFilePath, _HighscoreFilePath);
+ _ImportData(oldDBFilePath);
File.Delete(oldDBFilePath);
}
@@ -916,7 +916,7 @@ namespace Vocaluxe.Base
return true;
}
- private static bool _ImportData(string sourceDBPath, string destinationDBPath)
+ private static bool _ImportData(string sourceDBPath)
{
#region open db
using (SQLiteConnection connSource = new SQLiteConnection())
@@ -936,11 +936,9 @@ namespace Vocaluxe.Base
using (SQLiteCommand cmdSource = new SQLiteCommand(connSource))
{
- SQLiteDataReader source;
-
#region import table scores
cmdSource.CommandText = "SELECT SongID, PlayerName, Score, LineNr, Date, Medley, Duet, ShortSong, Difficulty FROM Scores";
- source = cmdSource.ExecuteReader();
+ SQLiteDataReader source = cmdSource.ExecuteReader();
if (source == null)
return false;
@@ -1260,6 +1258,7 @@ namespace Vocaluxe.Base
}
//If you want to add an image to db, call this method!
+/*
private static bool _AddImageToCreditsDB(String imagePath)
{
bool result = false;
@@ -1333,6 +1332,7 @@ namespace Vocaluxe.Base
return result;
}
+*/
private static bool _InitCreditsRessourcesDB()
{
@@ -1388,6 +1388,7 @@ namespace Vocaluxe.Base
return true;
}
+/*
private static void _CreateCreditsRessourcesDB()
{
using (SQLiteConnection connection = new SQLiteConnection())
@@ -1422,6 +1423,7 @@ namespace Vocaluxe.Base
}
}
}
+*/
#endregion CreditsRessources
private static byte[] _GetBytes(SQLiteDataReader reader)
diff --git a/Vocaluxe/Base/CGraphics.cs b/Vocaluxe/Base/CGraphics.cs
index b3d62cdb..fb544ad4 100644
--- a/Vocaluxe/Base/CGraphics.cs
+++ b/Vocaluxe/Base/CGraphics.cs
@@ -273,41 +273,40 @@ namespace Vocaluxe.Base
CLog.StopBenchmark(1, "Load Theme " + Enum.GetNames(typeof(EScreens))[i]);
}
- for (int i = 0; i < _PopupScreens.Count; i++)
- {
- _PopupScreens[i].Init();
- _PopupScreens[i].LoadTheme(CTheme.GetThemeScreensPath(-1));
+ foreach (IMenu popup in _PopupScreens) {
+ popup.Init();
+ popup.LoadTheme(CTheme.GetThemeScreensPath(-1));
}
}
public static void ReloadTheme()
{
_ReloadCursor();
- for (int i = 0; i < _Screens.Count; i++)
- _Screens[i].ReloadTheme(CTheme.GetThemeScreensPath(-1));
+ foreach (IMenu screen in _Screens)
+ screen.ReloadTheme(CTheme.GetThemeScreensPath(-1));
- for (int i = 0; i < _PopupScreens.Count; i++)
- _PopupScreens[i].ReloadTheme(CTheme.GetThemeScreensPath(-1));
+ foreach (IMenu popup in _PopupScreens)
+ popup.ReloadTheme(CTheme.GetThemeScreensPath(-1));
}
public static void ReloadSkin()
{
_ReloadCursor();
- for (int i = 0; i < _Screens.Count; i++)
- _Screens[i].ReloadTextures();
+ foreach (IMenu menu in _Screens)
+ menu.ReloadTextures();
- for (int i = 0; i < _PopupScreens.Count; i++)
- _PopupScreens[i].ReloadTextures();
+ foreach (IMenu menu in _PopupScreens)
+ menu.ReloadTextures();
}
public static void SaveTheme()
{
CTheme.SaveTheme();
- for (int i = 0; i < _Screens.Count; i++)
- _Screens[i].SaveTheme();
+ foreach (IMenu screen in _Screens)
+ screen.SaveTheme();
- for (int i = 0; i < _PopupScreens.Count; i++)
- _PopupScreens[i].SaveTheme();
+ foreach (IMenu popup in _PopupScreens)
+ popup.SaveTheme();
}
public static void InitFirstScreen()
@@ -444,8 +443,8 @@ namespace Vocaluxe.Base
_OldScreen = _Screens[(int)_CurrentScreen];
}
- for (int i = 0; i < _PopupScreens.Count; i++)
- _PopupScreens[i].Draw();
+ foreach (IMenu popup in _PopupScreens)
+ popup.Draw();
_Cursor.Draw();
_DrawDebugInfos();
diff --git a/Vocaluxe/Base/CLanguage.cs b/Vocaluxe/Base/CLanguage.cs
index 9b7da582..1e7ec559 100644
--- a/Vocaluxe/Base/CLanguage.cs
+++ b/Vocaluxe/Base/CLanguage.cs
@@ -108,12 +108,7 @@ namespace Vocaluxe.Base
return -1;
}
- public static string Translate(string keyWord)
- {
- return Translate(keyWord, -1);
- }
-
- public static string Translate(string keyWord, int partyModeID)
+ public static string Translate(string keyWord, int partyModeID = -1)
{
if (keyWord == null)
return "Error";
diff --git a/Vocaluxe/Base/CParty.cs b/Vocaluxe/Base/CParty.cs
index 62c97b72..372046d2 100644
--- a/Vocaluxe/Base/CParty.cs
+++ b/Vocaluxe/Base/CParty.cs
@@ -100,33 +100,32 @@ namespace Vocaluxe.Base
{
List infos = new List();
- int[] usedKeys = new int[_PartyModes.Count];
- _PartyModes.Keys.CopyTo(usedKeys, 0);
+ int[] pmIDs = new int[_PartyModes.Count];
+ _PartyModes.Keys.CopyTo(pmIDs, 0);
- for (int i = 0; i < usedKeys.Length; i++)
- {
- if (usedKeys[i] != _NormalGameModeID)
+ foreach (int pmID in pmIDs) {
+ if (pmID != _NormalGameModeID)
{
SPartyMode mode;
- _PartyModes.TryGetValue(usedKeys[i], out mode);
+ _PartyModes.TryGetValue(pmID, out mode);
if (mode.PartyMode != null)
{
- SPartyModeInfos info = new SPartyModeInfos();
-
- info.Author = mode.Author;
- info.Description = mode.Description;
- info.Name = mode.Name;
- info.PartyModeID = mode.PartyModeID;
- info.Playable = mode.NoErrors;
- info.VersionMajor = mode.PartyModeVersionMajor;
- info.VersionMinor = mode.PartyModeVersionMinor;
-
- info.TargetAudience = mode.TargetAudience;
- info.MaxPlayers = mode.PartyMode.GetMaxPlayer();
- info.MinPlayers = mode.PartyMode.GetMinPlayer();
- info.MaxTeams = mode.PartyMode.GetMaxTeams();
- info.MinTeams = mode.PartyMode.GetMinTeams();
+ SPartyModeInfos info = new SPartyModeInfos
+ {
+ Author = mode.Author,
+ Description = mode.Description,
+ Name = mode.Name,
+ PartyModeID = mode.PartyModeID,
+ Playable = mode.NoErrors,
+ VersionMajor = mode.PartyModeVersionMajor,
+ VersionMinor = mode.PartyModeVersionMinor,
+ TargetAudience = mode.TargetAudience,
+ MaxPlayers = mode.PartyMode.GetMaxPlayer(),
+ MinPlayers = mode.PartyMode.GetMinPlayer(),
+ MaxTeams = mode.PartyMode.GetMaxTeams(),
+ MinTeams = mode.PartyMode.GetMinTeams()
+ };
infos.Add(info);
}
@@ -348,6 +347,7 @@ namespace Vocaluxe.Base
CompilerParameters compilerParams = new CompilerParameters();
compilerParams.ReferencedAssemblies.Add("System.Windows.Forms.dll");
+ compilerParams.ReferencedAssemblies.Add("System.Core.dll");
compilerParams.ReferencedAssemblies.Add("VocaluxeLib.dll");
compilerParams.GenerateInMemory = true;
#if DEBUG
diff --git a/Vocaluxe/Base/CPlaylists.cs b/Vocaluxe/Base/CPlaylists.cs
index 0b6903b7..1b547267 100644
--- a/Vocaluxe/Base/CPlaylists.cs
+++ b/Vocaluxe/Base/CPlaylists.cs
@@ -263,11 +263,10 @@ namespace Vocaluxe.Base
string artist = line.Substring(0, pos - 1).Trim();
string title = line.Substring(pos + 1, line.Length - pos - 1).Trim();
bool found = false;
- for (int s = 0; s < allSongs.Length; s++)
- {
- if (allSongs[s].Artist == artist && allSongs[s].Title == title)
+ foreach (CSong song in allSongs) {
+ if (song.Artist == artist && song.Title == title)
{
- pl.AddSong(allSongs[s].ID);
+ pl.AddSong(song.ID);
found = true;
break;
}
diff --git a/Vocaluxe/Base/CSongs.cs b/Vocaluxe/Base/CSongs.cs
index 6a2ecea7..39ae8467 100644
--- a/Vocaluxe/Base/CSongs.cs
+++ b/Vocaluxe/Base/CSongs.cs
@@ -35,9 +35,9 @@ namespace Vocaluxe.Base
public bool Visible;
public bool PartyHidden;
- public SSongPointer(int iD, string sortString)
+ public SSongPointer(int id, string sortString)
{
- SongID = iD;
+ SongID = id;
SortString = sortString;
CatIndex = -1;
Visible = false;
diff --git a/Vocaluxe/Base/CSound.cs b/Vocaluxe/Base/CSound.cs
index 6b09af30..61a664b3 100644
--- a/Vocaluxe/Base/CSound.cs
+++ b/Vocaluxe/Base/CSound.cs
@@ -35,7 +35,7 @@ namespace Vocaluxe.Base
#region Playback
private static IPlayback _Playback;
- public static bool PlaybackInit()
+ public static bool Init()
{
switch (CConfig.PlayBackLib)
{
@@ -55,7 +55,7 @@ namespace Vocaluxe.Base
_Playback = new CPortAudioPlay();
break;
}
- return true;
+ return _Playback.Init();
}
public static void SetGlobalVolume(float volume)
@@ -613,7 +613,7 @@ namespace Vocaluxe.Base
float dt = Time;
- float diff = _ExternTime.Time - dt;
+ float diff = et - dt;
if (Math.Abs(diff) > 0.05f)
{
_Timer.Reset();
diff --git a/Vocaluxe/Lib/Sound/CDirectSoundRecord.cs b/Vocaluxe/Lib/Sound/CDirectSoundRecord.cs
index 55ee2f89..cc38e414 100644
--- a/Vocaluxe/Lib/Sound/CDirectSoundRecord.cs
+++ b/Vocaluxe/Lib/Sound/CDirectSoundRecord.cs
@@ -96,8 +96,8 @@ namespace Vocaluxe.Lib.Sound
if (!_Initialized)
return false;
- for (int i = 0; i < _Buffer.Length; i++)
- _Buffer[i].Reset();
+ foreach (CBuffer buffer in _Buffer)
+ buffer.Reset();
_DeviceConfig = deviceConfig;
bool[] active = new bool[deviceConfig.Length];
@@ -373,8 +373,8 @@ namespace Vocaluxe.Lib.Sound
if (_Notifications != null)
{
- for (int i = 0; i < _Notifications.Count; i++)
- _Notifications[i].Event.Close();
+ foreach (NotificationPosition notification in _Notifications)
+ notification.Event.Close();
_Notifications.Clear();
_Notifications = null;
@@ -420,7 +420,7 @@ namespace Vocaluxe.Lib.Sound
}
// ReSharper disable InconsistentNaming
- protected virtual void Dispose(bool disposing)
+ protected void Dispose(bool disposing)
// ReSharper restore InconsistentNaming
{
if (disposing)
diff --git a/Vocaluxe/Lib/Sound/CGstreamerAudio.cs b/Vocaluxe/Lib/Sound/CGstreamerAudio.cs
index 4adc2bbc..0d033842 100644
--- a/Vocaluxe/Lib/Sound/CGstreamerAudio.cs
+++ b/Vocaluxe/Lib/Sound/CGstreamerAudio.cs
@@ -28,9 +28,8 @@ namespace Vocaluxe.Lib.Sound
//static float LastPosition;
#region log
- public CGstreamerAudioWrapper.LogCallback Log;
- private void _LogHandler(string text)
+ private static void _LogHandler(string text)
{
CLog.LogError(text);
}
@@ -38,11 +37,9 @@ namespace Vocaluxe.Lib.Sound
public CGstreamerAudio()
{
- Init();
- Log = _LogHandler;
//Is this really needed? CodaAnalyzer complains about it...
//GC.SuppressFinalize(Log);
- CGstreamerAudioWrapper.SetLogCallback(Log);
+ CGstreamerAudioWrapper.SetLogCallback(_LogHandler);
}
public bool Init()
diff --git a/Vocaluxe/Lib/Sound/COpenALPlay.cs b/Vocaluxe/Lib/Sound/COpenALPlay.cs
index f9616987..fffbd644 100644
--- a/Vocaluxe/Lib/Sound/COpenALPlay.cs
+++ b/Vocaluxe/Lib/Sound/COpenALPlay.cs
@@ -40,11 +40,6 @@ namespace Vocaluxe.Lib.Sound
private List _Streams;
- public COpenALPlay()
- {
- Init();
- }
-
public bool Init()
{
if (_Initialized)
@@ -335,15 +330,6 @@ namespace Vocaluxe.Lib.Sound
return -1;
}
- private void _EndSync(int handle, int stream, int data, IntPtr user)
- {
- if (_Initialized)
- {
- if (_AlreadyAdded(stream))
- Close(stream);
- }
- }
-
private void _CloseProc(int streamID)
{
if (_Initialized)
diff --git a/Vocaluxe/Lib/Sound/CPortAudioPlay.cs b/Vocaluxe/Lib/Sound/CPortAudioPlay.cs
index e5a92632..ab6ae222 100644
--- a/Vocaluxe/Lib/Sound/CPortAudioPlay.cs
+++ b/Vocaluxe/Lib/Sound/CPortAudioPlay.cs
@@ -21,6 +21,7 @@ using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
+using System.Linq;
using System.Runtime.InteropServices;
using System.Threading;
using Vocaluxe.Base;
@@ -40,11 +41,6 @@ namespace Vocaluxe.Lib.Sound
private List _Streams;
- public CPortAudioPlay()
- {
- Init();
- }
-
public bool Init()
{
if (_Initialized)
@@ -302,12 +298,7 @@ namespace Vocaluxe.Lib.Sound
private bool _AlreadyAdded(int stream)
{
- foreach (SAudioStreams st in _Streams)
- {
- if (st.Handle == stream)
- return true;
- }
- return false;
+ return _Streams.Any(st => st.Handle == stream);
}
private int _GetStreamIndex(int stream)
@@ -320,15 +311,6 @@ namespace Vocaluxe.Lib.Sound
return -1;
}
- private void _EndSync(int handle, int stream, int data, IntPtr user)
- {
- if (_Initialized)
- {
- if (_AlreadyAdded(stream))
- Close(stream);
- }
- }
-
private void _CloseProc(int streamID)
{
if (_Initialized)
diff --git a/Vocaluxe/Lib/Sound/CPortAudioRecord.cs b/Vocaluxe/Lib/Sound/CPortAudioRecord.cs
index fab75e12..612081a8 100644
--- a/Vocaluxe/Lib/Sound/CPortAudioRecord.cs
+++ b/Vocaluxe/Lib/Sound/CPortAudioRecord.cs
@@ -189,8 +189,8 @@ namespace Vocaluxe.Lib.Sound
if (!_Initialized)
return false;
- for (int i = 0; i < _RecHandle.Length; i++)
- CPortAudio.Pa_StopStream(_RecHandle[i]);
+ foreach (IntPtr handle in _RecHandle)
+ CPortAudio.Pa_StopStream(handle);
return true;
}
diff --git a/Vocaluxe/Lib/Sound/Decoder/CAudioDecoderFFmpeg.cs b/Vocaluxe/Lib/Sound/Decoder/CAudioDecoderFFmpeg.cs
index 6f40c539..bfe4fedf 100644
--- a/Vocaluxe/Lib/Sound/Decoder/CAudioDecoderFFmpeg.cs
+++ b/Vocaluxe/Lib/Sound/Decoder/CAudioDecoderFFmpeg.cs
@@ -38,7 +38,7 @@ namespace Vocaluxe.Lib.Sound.Decoder
public void Init() {}
- public void Open(string fileName, bool loop)
+ public void Open(string fileName)
{
_FileName = fileName;
diff --git a/Vocaluxe/Lib/Sound/Decoder/IAudioDecoder.cs b/Vocaluxe/Lib/Sound/Decoder/IAudioDecoder.cs
index 55c21761..5ebcda20 100644
--- a/Vocaluxe/Lib/Sound/Decoder/IAudioDecoder.cs
+++ b/Vocaluxe/Lib/Sound/Decoder/IAudioDecoder.cs
@@ -31,7 +31,7 @@ namespace Vocaluxe.Lib.Sound.Decoder
void Init();
void Close();
- void Open(string fileName, bool loop = false);
+ void Open(string fileName);
SFormatInfo GetFormatInfo();
float GetLength();
diff --git a/Vocaluxe/Lib/Sound/Portaudio/PortAudio.cs b/Vocaluxe/Lib/Sound/Portaudio/PortAudio.cs
index d80d4cac..e8329a1a 100644
--- a/Vocaluxe/Lib/Sound/Portaudio/PortAudio.cs
+++ b/Vocaluxe/Lib/Sound/Portaudio/PortAudio.cs
@@ -27,6 +27,7 @@ namespace Vocaluxe.Lib.Sound.PortAudio
PortAudio v.19 bindings for .NET
*/
+ // ReSharper disable UnusedMember.Global
public static class CPortAudio
{
@@ -550,4 +551,6 @@ namespace Vocaluxe.Lib.Sound.PortAudio
public static extern void Pa_Sleep(int msec);
#endregion
}
+ // ReSharper restore UnusedMember.Global
+
}
\ No newline at end of file
diff --git a/Vocaluxe/Lib/Video/CVideoDecoderGstreamer.cs b/Vocaluxe/Lib/Video/CVideoDecoderGstreamer.cs
index 2295e8b4..ac5b15cf 100644
--- a/Vocaluxe/Lib/Video/CVideoDecoderGstreamer.cs
+++ b/Vocaluxe/Lib/Video/CVideoDecoderGstreamer.cs
@@ -27,7 +27,7 @@ namespace Vocaluxe.Lib.Video
class CVideoDecoderGstreamer : IVideoDecoder
{
#region log
- private CGstreamerVideoWrapper.LogCallback Log;
+ private CGstreamerVideoWrapper.LogCallback _Log;
private void _LogHandler(string text)
{
@@ -38,10 +38,10 @@ namespace Vocaluxe.Lib.Video
public bool Init()
{
bool retval = CGstreamerVideoWrapper.InitVideo();
- Log = _LogHandler;
+ _Log = _LogHandler;
//Really needed? CodeAnalysis complains
//GC.SuppressFinalize(Log);
- CGstreamerVideoWrapper.SetVideoLogCallback(Log);
+ CGstreamerVideoWrapper.SetVideoLogCallback(_Log);
return retval;
}
diff --git a/Vocaluxe/Program.cs b/Vocaluxe/Program.cs
index 689bf2c5..539c2b3d 100644
--- a/Vocaluxe/Program.cs
+++ b/Vocaluxe/Program.cs
@@ -114,7 +114,7 @@ namespace Vocaluxe
// Init Playback
CLog.StartBenchmark(0, "Init Playback");
- CSound.PlaybackInit();
+ CSound.Init();
CLog.StopBenchmark(0, "Init Playback");
Application.DoEvents();
diff --git a/Vocaluxe/Screens/CScreenCredits.cs b/Vocaluxe/Screens/CScreenCredits.cs
index d47e1d43..4ef03bbb 100644
--- a/Vocaluxe/Screens/CScreenCredits.cs
+++ b/Vocaluxe/Screens/CScreenCredits.cs
@@ -204,35 +204,33 @@ namespace Vocaluxe.Screens
//Prepare Text
int lastY = 280;
- for (int i = 0; i < _Paragraphs.Count; i++)
- {
+ foreach (string[] paragraph in _Paragraphs) {
string line = "";
- for (int e = 0; e < _Paragraphs[i].Length; e++)
+ for (int e = 0; e < paragraph.Length; e++)
{
- if (_Paragraphs[i][e] != null)
+ if (paragraph[e] == null)
+ continue;
+ string newLine = " " + paragraph[e];
+ CText text = GetNewText(75, lastY, -2, 30, -1, EAlignment.Left, EStyle.Bold, "Outline", new SColorF(1, 1, 1, 1), line);
+ if (CDraw.GetTextBounds(text).Width < (CSettings.RenderW - 220))
{
- string newline = line + " " + _Paragraphs[i][e];
- CText text = GetNewText(75, lastY, -2, 30, -1, EAlignment.Left, EStyle.Bold, "Outline", new SColorF(1, 1, 1, 1), line);
- if (CDraw.GetTextBounds(text).Width < (CSettings.RenderW - 220))
- {
- line = line + " " + _Paragraphs[i][e];
+ line += newLine;
- //Check if all words are used
- if ((e + 1) == _Paragraphs[i].Length)
- {
- text.Text = line;
- _ParagraphTexts.Add(text);
- line = "";
- lastY += 40;
- }
- }
- else
+ //Check if all words are used
+ if ((e + 1) == paragraph.Length)
{
+ text.Text = line;
_ParagraphTexts.Add(text);
- line = " " + _Paragraphs[i][e];
- lastY += 27;
+ line = "";
+ lastY += 40;
}
}
+ else
+ {
+ _ParagraphTexts.Add(text);
+ line = newLine;
+ lastY += 27;
+ }
}
}
}
@@ -276,7 +274,7 @@ namespace Vocaluxe.Screens
return true;
}
- public CParticleEffect GetStarParticles(int numStars, bool isRed, SRectF rect, bool bigParticles)
+ private CParticleEffect _GetStarParticles(int numStars, bool isRed, SRectF rect, bool bigParticles)
{
SColorF partColor = isRed ? new SColorF(1, 0, 0, 1) : new SColorF(0.149f, 0.415f, 0.819f, 1);
int partSize = bigParticles ? 35 : 25;
@@ -296,7 +294,7 @@ namespace Vocaluxe.Screens
SRectF imgDotRect = new SRectF(particleRect);
imgDotRect.Z = -5;
CStatic imgDot = GetNewStatic(texDot, new SColorF(1, 1, 1, 1), imgDotRect);
- CParticleEffect particle = GetStarParticles(partCount, isRight, particleRect, bigParticles);
+ CParticleEffect particle = _GetStarParticles(partCount, isRight, particleRect, bigParticles);
CCreditName credit = new CCreditName(image, imgDot, particle, particleOffsetX, particleOffsetY);
@@ -324,8 +322,8 @@ namespace Vocaluxe.Screens
//Little stars for logo
int numstars = (int)(_Logo.Rect.W * 0.25f / 2f);
SRectF partRect = new SRectF(_Logo.Rect.X, _Logo.Rect.Y, _Logo.Rect.W, _Logo.Rect.H, -1);
- _StarsRed = GetStarParticles(numstars, true, partRect, true);
- _StarsBlue = GetStarParticles(numstars, false, partRect, true);
+ _StarsRed = _GetStarParticles(numstars, true, partRect, true);
+ _StarsBlue = _GetStarParticles(numstars, false, partRect, true);
//Credit names
_CreditNames = new List();
@@ -371,8 +369,8 @@ namespace Vocaluxe.Screens
//Draw Text
if (_TextTimer.IsRunning)
{
- for (int i = 0; i < _ParagraphTexts.Count; i++)
- _ParagraphTexts[i].Draw();
+ foreach (CText text in _ParagraphTexts)
+ text.Draw();
}
return true;
}
diff --git a/Vocaluxe/Screens/CScreenHighscore.cs b/Vocaluxe/Screens/CScreenHighscore.cs
index bd2481ed..95421bda 100644
--- a/Vocaluxe/Screens/CScreenHighscore.cs
+++ b/Vocaluxe/Screens/CScreenHighscore.cs
@@ -257,7 +257,6 @@ namespace Vocaluxe.Screens
{
_IsDuet = false;
CPoints points = CGame.GetPoints();
- SPlayer player = points.GetPlayer(_Round, CGame.NumPlayer)[0];
CSong song = CGame.GetSong(_Round + 1);
if (song == null)
return;
diff --git a/Vocaluxe/Screens/CScreenSing.cs b/Vocaluxe/Screens/CScreenSing.cs
index 361c5f6d..e6434090 100644
--- a/Vocaluxe/Screens/CScreenSing.cs
+++ b/Vocaluxe/Screens/CScreenSing.cs
@@ -654,10 +654,7 @@ namespace Vocaluxe.Screens
for (int p = 0; p < CGame.NumPlayer; p++)
{
- _NoteLines[p] = _SingNotes[_SingBars].AddPlayer(
- _SingNotes[_SingBars].BarPos[p, CGame.NumPlayer - 1],
- CTheme.GetPlayerColor(p + 1),
- p);
+ _NoteLines[p] = _SingNotes[_SingBars].AddPlayer(_SingNotes[_SingBars].BarPos[p, CGame.NumPlayer - 1],CTheme.GetPlayerColor(p + 1),p);
}
/*
diff --git a/VocaluxeLib/Menu/CButton.cs b/VocaluxeLib/Menu/CButton.cs
index 9c74f8e1..8a46c185 100644
--- a/VocaluxeLib/Menu/CButton.cs
+++ b/VocaluxeLib/Menu/CButton.cs
@@ -294,17 +294,7 @@ namespace VocaluxeLib.Menu
return false;
}
- public void Draw()
- {
- Draw(false);
- }
-
- public void ForceDraw()
- {
- Draw(true);
- }
-
- public void Draw(bool forceDraw)
+ public void Draw(bool forceDraw = false)
{
if (!Visible && CBase.Settings.GetGameState() != EGameState.EditTheme && !forceDraw)
return;
diff --git a/VocaluxeLib/Menu/CHelper.cs b/VocaluxeLib/Menu/CHelper.cs
index 95048f07..bdf1a007 100644
--- a/VocaluxeLib/Menu/CHelper.cs
+++ b/VocaluxeLib/Menu/CHelper.cs
@@ -139,17 +139,7 @@ namespace VocaluxeLib.Menu
rect = new RectangleF(left, upper, rigth - left, lower - upper);
}
- public static List ListFiles(string path, string cast)
- {
- return ListFiles(path, cast, false, false);
- }
-
- public static List ListFiles(string path, string cast, bool recursive)
- {
- return ListFiles(path, cast, recursive, false);
- }
-
- public static List ListFiles(string path, string cast, bool recursive, bool fullpath)
+ public static List ListFiles(string path, string cast, bool recursive = false, bool fullpath = false)
{
List files = new List();
DirectoryInfo dir = new DirectoryInfo(path);
diff --git a/VocaluxeLib/Menu/CMenuParty.cs b/VocaluxeLib/Menu/CMenuParty.cs
index dd537744..2cd1fa5c 100644
--- a/VocaluxeLib/Menu/CMenuParty.cs
+++ b/VocaluxeLib/Menu/CMenuParty.cs
@@ -36,11 +36,6 @@ namespace VocaluxeLib.Menu
_PartyModeID = partyModeID;
}
- public int GetPartyModeID()
- {
- return _PartyModeID;
- }
-
public void AssingPartyMode(IPartyMode partyMode)
{
_PartyMode = partyMode;
diff --git a/VocaluxeLib/Menu/CNameSelection.cs b/VocaluxeLib/Menu/CNameSelection.cs
index c09387f9..f3b34313 100644
--- a/VocaluxeLib/Menu/CNameSelection.cs
+++ b/VocaluxeLib/Menu/CNameSelection.cs
@@ -244,16 +244,6 @@ namespace VocaluxeLib.Menu
}
public void Draw()
- {
- Draw(false);
- }
-
- public void ForceDraw()
- {
- Draw(true);
- }
-
- public void Draw(bool forceDraw)
{
int i = 0;
foreach (CTile tile in _Tiles)
diff --git a/VocaluxeLib/Menu/CPlaylist.cs b/VocaluxeLib/Menu/CPlaylist.cs
index ed2bff99..367f9ec9 100644
--- a/VocaluxeLib/Menu/CPlaylist.cs
+++ b/VocaluxeLib/Menu/CPlaylist.cs
@@ -412,17 +412,7 @@ namespace VocaluxeLib.Menu
return false;
}
- public void Draw()
- {
- Draw(false);
- }
-
- public void ForceDraw()
- {
- Draw(true);
- }
-
- public void Draw(bool forceDraw)
+ public void Draw(bool forceDraw = false)
{
if (_PlaylistElements.Count <= 0)
LoadPlaylist(0);
@@ -1226,7 +1216,7 @@ namespace VocaluxeLib.Menu
CSong song = CBase.Songs.GetSongByID(pec.SongID);
_PlaylistElements[i].Cover.Texture = song.CoverTextureSmall;
string t1 = _Theme.Text1.Text.Replace("%a", song.Artist).Replace("%t", song.Title);
- _PlaylistElements[i].Text1.Text = /*(Offset + i + 1) + ") " + */ song.Artist + " - " + song.Title; //TODO: Add text field for the number
+ _PlaylistElements[i].Text1.Text = /*(Offset + i + 1) + ") " + */ t1; //TODO: Add text field for the number
_PlaylistElements[i].SelectSlide.Clear();
for (int g = 0; g < pec.Modes.Length; g++)
{
diff --git a/VocaluxeLib/Menu/CText.cs b/VocaluxeLib/Menu/CText.cs
index e148d062..0edc1510 100644
--- a/VocaluxeLib/Menu/CText.cs
+++ b/VocaluxeLib/Menu/CText.cs
@@ -693,17 +693,12 @@ namespace VocaluxeLib.Menu
CBase.Drawing.DrawColor(new SColorF(0.5f, 1f, 0.5f, 0.5f), new SRectF(x, Y, bounds.Width, bounds.Height, Z));
}
- public void DrawRelative(float x, float y)
- {
- DrawRelative(x, y, false, 0f, 0f, 0f);
- }
-
public void DrawRelative(float x, float y, float reflectionSpace, float reflectionHeigth, float rectHeight)
{
DrawRelative(x, y, true, reflectionSpace, reflectionHeigth, rectHeight);
}
- public void DrawRelative(float rx, float ry, bool reflection, float reflectionSpace, float reflectionHeight, float rectHeight)
+ public void DrawRelative(float rx, float ry, bool reflection = false, float reflectionSpace = 0f, float reflectionHeight = 0f, float rectHeight = 0f)
{
// Update Text
Text = Text;
diff --git a/VocaluxeLib/Menu/Enums.cs b/VocaluxeLib/Menu/Enums.cs
index 5c40785a..b42b9ec1 100644
--- a/VocaluxeLib/Menu/Enums.cs
+++ b/VocaluxeLib/Menu/Enums.cs
@@ -36,8 +36,7 @@ namespace VocaluxeLib.Menu
{
Mouse,
Keyboard,
- WiiMote,
- Gamepad
+ WiiMote
}
#endregion Inputs
@@ -126,7 +125,9 @@ namespace VocaluxeLib.Menu
// ReSharper disable InconsistentNaming
// don't change the order!
TR_CONFIG_OFF, //no debug infos
+// ReSharper disable UnusedMember.Global
TR_CONFIG_ONLY_FPS,
+// ReSharper restore UnusedMember.Global
TR_CONFIG_LEVEL1,
TR_CONFIG_LEVEL2,
TR_CONFIG_LEVEL3,
@@ -213,7 +214,9 @@ namespace VocaluxeLib.Menu
public enum ECoverLoading
{
// ReSharper disable InconsistentNaming
+// ReSharper disable UnusedMember.Global
TR_CONFIG_COVERLOADING_ONDEMAND,
+// ReSharper restore UnusedMember.Global
TR_CONFIG_COVERLOADING_ATSTART,
TR_CONFIG_COVERLOADING_DYNAMIC
// ReSharper restore InconsistentNaming
@@ -222,9 +225,11 @@ namespace VocaluxeLib.Menu
public enum EGameDifficulty
{
// ReSharper disable InconsistentNaming
+ // ReSharper disable UnusedMember.Global
TR_CONFIG_EASY,
TR_CONFIG_NORMAL,
TR_CONFIG_HARD
+// ReSharper restore UnusedMember.Global
// ReSharper restore InconsistentNaming
}
@@ -260,7 +265,9 @@ namespace VocaluxeLib.Menu
TR_CONFIG_PLAYERINFO_BOTH,
TR_CONFIG_PLAYERINFO_NAME,
TR_CONFIG_PLAYERINFO_AVATAR,
+// ReSharper disable UnusedMember.Global
TR_CONFIG_PLAYERINFO_OFF
+// ReSharper restore UnusedMember.Global
// ReSharper restore InconsistentNaming
}
diff --git a/VocaluxeLib/Menu/SingNotes/CSingNotes.cs b/VocaluxeLib/Menu/SingNotes/CSingNotes.cs
index 474ac07a..79a8d87a 100644
--- a/VocaluxeLib/Menu/SingNotes/CSingNotes.cs
+++ b/VocaluxeLib/Menu/SingNotes/CSingNotes.cs
@@ -59,26 +59,20 @@ namespace VocaluxeLib.Menu.SingNotes
public abstract class CSingNotes : IMenuElement
{
- protected int _PartyModeID;
+ protected readonly int _PartyModeID;
private SThemeSingBar _Theme;
private bool _ThemeLoaded;
private readonly List _PlayerNotes;
private int _ActID;
- private SRectF[,] _BarPos;
-
///
/// Player bar positions
///
///
/// first index = player number; second index = num players seen on screen
///
- public SRectF[,] BarPos
- {
- get { return _BarPos; }
- set { _BarPos = value; }
- }
+ public SRectF[,] BarPos { get; set; }
public CSingNotes(int partyModeID)
{
@@ -112,20 +106,20 @@ namespace VocaluxeLib.Menu.SingNotes
_ThemeLoaded &= xmlReader.GetValue(item + "/SkinToneHelper", out _Theme.SkinToneHelperName, String.Empty);
_ThemeLoaded &= xmlReader.GetValue(item + "/SkinPerfectNoteStar", out _Theme.SkinPerfectNoteStarName, String.Empty);
- _BarPos = new SRectF[CBase.Settings.GetMaxNumPlayer(),CBase.Settings.GetMaxNumPlayer()];
+ BarPos = new SRectF[CBase.Settings.GetMaxNumPlayer(),CBase.Settings.GetMaxNumPlayer()];
for (int numplayer = 0; numplayer < CBase.Settings.GetMaxNumPlayer(); numplayer++)
{
for (int player = 0; player < CBase.Settings.GetMaxNumPlayer(); player++)
{
if (player <= numplayer)
{
- _BarPos[player, numplayer] = new SRectF();
+ BarPos[player, numplayer] = new SRectF();
string target = "/BarPositions/P" + (player + 1) + "N" + (numplayer + 1);
- _ThemeLoaded &= xmlReader.TryGetFloatValue(item + target + "X", ref _BarPos[player, numplayer].X);
- _ThemeLoaded &= xmlReader.TryGetFloatValue(item + target + "Y", ref _BarPos[player, numplayer].Y);
- _ThemeLoaded &= xmlReader.TryGetFloatValue(item + target + "Z", ref _BarPos[player, numplayer].Z);
- _ThemeLoaded &= xmlReader.TryGetFloatValue(item + target + "W", ref _BarPos[player, numplayer].W);
- _ThemeLoaded &= xmlReader.TryGetFloatValue(item + target + "H", ref _BarPos[player, numplayer].H);
+ _ThemeLoaded &= xmlReader.TryGetFloatValue(item + target + "X", ref BarPos[player, numplayer].X);
+ _ThemeLoaded &= xmlReader.TryGetFloatValue(item + target + "Y", ref BarPos[player, numplayer].Y);
+ _ThemeLoaded &= xmlReader.TryGetFloatValue(item + target + "Z", ref BarPos[player, numplayer].Z);
+ _ThemeLoaded &= xmlReader.TryGetFloatValue(item + target + "W", ref BarPos[player, numplayer].W);
+ _ThemeLoaded &= xmlReader.TryGetFloatValue(item + target + "H", ref BarPos[player, numplayer].H);
}
}
}
@@ -180,16 +174,15 @@ namespace VocaluxeLib.Menu.SingNotes
{
for (int player = 0; player < CBase.Settings.GetMaxNumPlayer(); player++)
{
- if (player <= numplayer)
- {
- string target = "P" + (player + 1) + "N" + (numplayer + 1);
+ if (player > numplayer)
+ continue;
+ string target = "P" + (player + 1) + "N" + (numplayer + 1);
- writer.WriteElementString(target + "X", _BarPos[player, numplayer].X.ToString("#0"));
- writer.WriteElementString(target + "Y", _BarPos[player, numplayer].Y.ToString("#0"));
- writer.WriteElementString(target + "Z", _BarPos[player, numplayer].Z.ToString("#0.00"));
- writer.WriteElementString(target + "W", _BarPos[player, numplayer].W.ToString("#0"));
- writer.WriteElementString(target + "H", _BarPos[player, numplayer].H.ToString("#0"));
- }
+ writer.WriteElementString(target + "X", BarPos[player, numplayer].X.ToString("#0"));
+ writer.WriteElementString(target + "Y", BarPos[player, numplayer].Y.ToString("#0"));
+ writer.WriteElementString(target + "Z", BarPos[player, numplayer].Z.ToString("#0.00"));
+ writer.WriteElementString(target + "W", BarPos[player, numplayer].W.ToString("#0"));
+ writer.WriteElementString(target + "H", BarPos[player, numplayer].H.ToString("#0"));
}
}
writer.WriteEndElement(); //BarPositions
@@ -210,33 +203,35 @@ namespace VocaluxeLib.Menu.SingNotes
public virtual int AddPlayer(SRectF rect, SColorF color, int playerNr)
{
- SPlayerNotes notes = new SPlayerNotes();
+ SPlayerNotes notes = new SPlayerNotes
+ {
+ Rect = rect,
+ Color = color,
+ Alpha = 1f,
+ ID = ++_ActID,
+ Lines = null,
+ LineNr = -1,
+ PlayerNr = playerNr,
+ Timer = new Stopwatch(),
+ GoldenStars = new List(),
+ Flares = new List(),
+ PerfectNoteEffect = new List(),
+ PerfectLineTwinkle = new List()
+ };
- notes.Rect = rect;
- notes.Color = color;
- notes.Alpha = 1f;
- notes.ID = ++_ActID;
- notes.Lines = null;
- notes.LineNr = -1;
- notes.PlayerNr = playerNr;
- notes.Timer = new Stopwatch();
- notes.GoldenStars = new List();
- notes.Flares = new List();
- notes.PerfectNoteEffect = new List();
- notes.PerfectLineTwinkle = new List();
_PlayerNotes.Add(notes);
return notes.ID;
}
- public virtual void RemovePlayer(int iD) {}
+ public virtual void RemovePlayer(int id) {}
- public virtual void AddLine(int iD, CLine[] line, int lineNr, int player)
+ public virtual void AddLine(int id, CLine[] line, int lineNr, int player)
{
if (line == null)
return;
- int n = _FindPlayerLine(iD);
+ int n = _FindPlayerLine(id);
if (n == -1)
return;
@@ -258,13 +253,13 @@ namespace VocaluxeLib.Menu.SingNotes
_PlayerNotes.Add(notes);
}
- public virtual void RemoveLine(int iD) {}
+ public virtual void RemoveLine(int id) {}
- public virtual void AddNote(int iD, CNote note) {}
+ public virtual void AddNote(int id, CNote note) {}
- public virtual void SetAlpha(int iD, float alpha)
+ public virtual void SetAlpha(int id, float alpha)
{
- int n = _FindPlayerLine(iD);
+ int n = _FindPlayerLine(id);
if (n == -1)
return;
@@ -273,23 +268,23 @@ namespace VocaluxeLib.Menu.SingNotes
_PlayerNotes[n] = pn;
}
- public virtual float GetAlpha(int iD)
+ public virtual float GetAlpha(int id)
{
- int n = _FindPlayerLine(iD);
+ int n = _FindPlayerLine(id);
if (n == -1)
return 0f;
return _PlayerNotes[n].Alpha;
}
- public virtual void Draw(int iD, int player)
+ public virtual void Draw(int id, int player)
{
- Draw(iD, null, player);
+ Draw(id, null, player);
}
- public virtual void Draw(int iD, List singLine, int player)
+ public virtual void Draw(int id, List singLine, int player)
{
- int n = _FindPlayerLine(iD);
+ int n = _FindPlayerLine(id);
if (n == -1)
return;
@@ -467,30 +462,21 @@ namespace VocaluxeLib.Menu.SingNotes
LoadTextures();
}
- private int _FindPlayerLine(int iD)
+ private int _FindPlayerLine(int id)
{
- if (iD < 0 || iD > _PlayerNotes.Count)
+ if (id < 0 || id > _PlayerNotes.Count)
return -1;
- int n = -1;
for (int i = 0; i < _PlayerNotes.Count; i++)
{
- if (_PlayerNotes[i].ID == iD)
- {
- n = i;
- break;
- }
+ if (_PlayerNotes[i].ID == id)
+ return i;
}
- return n;
+ return -1;
}
- private void _DrawNote(SRectF rect, SColorF color)
- {
- _DrawNote(rect, color, 1f);
- }
-
- private void _DrawNote(SRectF rect, SColorF color, float factor)
+ private void _DrawNote(SRectF rect, SColorF color, float factor = 1f)
{
const int spacing = 0;
@@ -584,12 +570,7 @@ namespace VocaluxeLib.Menu.SingNotes
}
}
- private void _AddGoldenNote(SRectF rect, int n, int nr)
- {
- _AddGoldenNote(rect, n, nr, 1f);
- }
-
- private void _AddGoldenNote(SRectF rect, int n, int nr, float factor)
+ private void _AddGoldenNote(SRectF rect, int n, int nr, float factor = 1f)
{
const int spacing = 0;
@@ -615,12 +596,7 @@ namespace VocaluxeLib.Menu.SingNotes
}
}
- private void _AddFlare(SRectF rect, int n)
- {
- _AddFlare(rect, n, 1f);
- }
-
- private void _AddFlare(SRectF rect, int n, float factor)
+ private void _AddFlare(SRectF rect, int n, float factor = 1f)
{
const int spacing = 0;
@@ -642,12 +618,7 @@ namespace VocaluxeLib.Menu.SingNotes
_PlayerNotes[n].Flares.Add(flares);
}
- private void _AddPerfectNote(SRectF rect, int n)
- {
- _AddPerfectNote(rect, n, 1f);
- }
-
- private void _AddPerfectNote(SRectF rect, int n, float factor)
+ private void _AddPerfectNote(SRectF rect, int n, float factor = 1f)
{
const int spacing = 0;
diff --git a/VocaluxeLib/Menu/SongMenu/CSong.cs b/VocaluxeLib/Menu/SongMenu/CSong.cs
index 38f5dc4a..d7931f16 100644
--- a/VocaluxeLib/Menu/SongMenu/CSong.cs
+++ b/VocaluxeLib/Menu/SongMenu/CSong.cs
@@ -1027,10 +1027,5 @@ namespace VocaluxeLib.Menu.SongMenu
ShortEnd = stop;
}
-
- public object Clone()
- {
- return MemberwiseClone();
- }
}
}
\ No newline at end of file