diff --git a/.gitignore b/.gitignore
index b02f4019..cd58e0f8 100644
--- a/.gitignore
+++ b/.gitignore
@@ -37,3 +37,4 @@ Output/Songs
/PartyModes/*/*/*.dll
*.Cache
+/Output/x86/gstreamer/GstreamerHelper.dll
diff --git a/GstreamerHelper/GstreamerHelper.vcxproj b/GstreamerHelper/GstreamerHelper.vcxproj
index 8e692fe5..42933149 100644
--- a/GstreamerHelper/GstreamerHelper.vcxproj
+++ b/GstreamerHelper/GstreamerHelper.vcxproj
@@ -27,13 +27,13 @@
DynamicLibrary
true
- v110
+ v110_xp
Unicode
DynamicLibrary
true
- v110
+ v110_xp
Unicode
@@ -149,11 +149,13 @@
Level3
Use
- MaxSpeed
+ Full
true
true
WIN32;NDEBUG;_WINDOWS;_USRDLL;GSTREAMERHELPER_EXPORTS;%(PreprocessorDefinitions)
true
+ true
+ Speed
Windows
diff --git a/Output/PartyModes/Challenge.xml b/Output/PartyModes/Challenge.xml
index c5fe5c94..9a609eb3 100644
--- a/Output/PartyModes/Challenge.xml
+++ b/Output/PartyModes/Challenge.xml
@@ -6,14 +6,14 @@
brunzel
TR_PARTYMODE_DESCRIPTION
Challenge
- PartyModeChallenge
+ CPartyModeChallenge
0
1
TR_PARTYMODE_AUDIENCE
- PartyScreenChallengeMain
- PartyScreenChallengeConfig
- PartyScreenChallengeNames
+ CPartyScreenChallengeMain
+ CPartyScreenChallengeConfig
+ CPartyScreenChallengeNames
\ No newline at end of file
diff --git a/Output/PartyModes/ChallengeMedley.xml b/Output/PartyModes/ChallengeMedley.xml
index 7e1d6605..3f1063dc 100644
--- a/Output/PartyModes/ChallengeMedley.xml
+++ b/Output/PartyModes/ChallengeMedley.xml
@@ -6,14 +6,14 @@
brunzel
TR_PARTYMODE_DESCRIPTION
ChallengeMedley
- PartyModeChallengeMedley
+ CPartyModeChallengeMedley
0
1
TR_PARTYMODE_AUDIENCE
- PartyScreenChallengeMedleyMain
- PartyScreenChallengeMedleyConfig
- PartyScreenChallengeMedleyNames
+ CPartyScreenChallengeMedleyMain
+ CPartyScreenChallengeMedleyConfig
+ CPartyScreenChallengeMedleyNames
\ No newline at end of file
diff --git a/Output/PartyModes/TicTacToe.xml b/Output/PartyModes/TicTacToe.xml
index 5ddf43da..0b877ed7 100644
--- a/Output/PartyModes/TicTacToe.xml
+++ b/Output/PartyModes/TicTacToe.xml
@@ -6,14 +6,14 @@
flokuep
TR_PARTYMODE_DESCRIPTION
TicTacToe
- PartyModeTicTacToe
+ CPartyModeTicTacToe
0
1
TR_PARTYMODE_AUDIENCE
- PartyScreenTicTacToeMain
- PartyScreenTicTacToeConfig
- PartyScreenTicTacToeNames
+ CPartyScreenTicTacToeMain
+ CPartyScreenTicTacToeConfig
+ CPartyScreenTicTacToeNames
diff --git a/Output/PartyModes/TicTacToe/Screens/PartyScreenTicTacToeConfig.xml b/Output/PartyModes/TicTacToe/Screens/PartyScreenTicTacToeConfig.xml
index d9330b71..d3b98d11 100644
--- a/Output/PartyModes/TicTacToe/Screens/PartyScreenTicTacToeConfig.xml
+++ b/Output/PartyModes/TicTacToe/Screens/PartyScreenTicTacToeConfig.xml
@@ -82,7 +82,7 @@
Outline
- TR_SCREENCONFIG_NUMPLAYERT1
+ TR_SCREENCONFIG_NUMPLAYERST1
@@ -111,7 +111,7 @@
Outline
- TR_SCREENCONFIG_NUMPLAYERT2
+ TR_SCREENCONFIG_NUMPLAYERST2
diff --git a/PartyModes/PartyModeChallenge/PartyModeChallenge.cs b/PartyModes/PartyModeChallenge/CPartyModeChallenge.cs
similarity index 55%
rename from PartyModes/PartyModeChallenge/PartyModeChallenge.cs
rename to PartyModes/PartyModeChallenge/CPartyModeChallenge.cs
index 2b248af1..5cf89c15 100644
--- a/PartyModes/PartyModeChallenge/PartyModeChallenge.cs
+++ b/PartyModes/PartyModeChallenge/CPartyModeChallenge.cs
@@ -11,30 +11,30 @@ namespace VocaluxeLib.PartyModes.Challenge
#region Communication
#region ToScreen
- public struct DataToScreenConfig
+ public struct SDataToScreenConfig
{
public int NumPlayer;
public int NumPlayerAtOnce;
public int NumRounds;
}
- public struct DataToScreenNames
+ public struct SDataToScreenNames
{
public int NumPlayer;
public List ProfileIDs;
}
- public struct DataToScreenMain
+ public struct SDataToScreenMain
{
public int CurrentRoundNr;
public int NumPlayerAtOnce;
- public List Combs;
+ public List Combs;
public int[,] Results;
- public List ResultTable;
+ public List ResultTable;
public List ProfileIDs;
}
- public class ResultTableRow : IComparable
+ public class CResultTableRow : IComparable
{
public int Position;
public int PlayerID;
@@ -46,9 +46,9 @@ namespace VocaluxeLib.PartyModes.Challenge
public int CompareTo(object obj)
{
- if (obj is ResultTableRow)
+ if (obj is CResultTableRow)
{
- ResultTableRow row = (ResultTableRow)obj;
+ CResultTableRow row = (CResultTableRow)obj;
int res = row.NumGamePoints.CompareTo(NumGamePoints);
if (res == 0)
@@ -66,28 +66,28 @@ namespace VocaluxeLib.PartyModes.Challenge
#endregion ToScreen
#region FromScreen
- public struct DataFromScreen
+ public struct SDataFromScreen
{
- public FromScreenConfig ScreenConfig;
- public FromScreenNames ScreenNames;
- public FromScreenMain ScreenMain;
+ public SFromScreenConfig ScreenConfig;
+ public SFromScreenNames ScreenNames;
+ public SFromScreenMain ScreenMain;
}
- public struct FromScreenConfig
+ public struct SFromScreenConfig
{
public int NumPlayer;
public int NumPlayerAtOnce;
public int NumRounds;
}
- public struct FromScreenNames
+ public struct SFromScreenNames
{
public bool FadeToConfig;
public bool FadeToMain;
public List ProfileIDs;
}
- public struct FromScreenMain
+ public struct SFromScreenMain
{
public bool FadeToSongSelection;
public bool FadeToNameSelection;
@@ -96,13 +96,13 @@ namespace VocaluxeLib.PartyModes.Challenge
#endregion Communication
- public sealed class PartyModeChallenge : CPartyMode
+ public sealed class CPartyModeChallenge : CPartyMode
{
- private const int MaxPlayer = 12;
- private const int MinPlayer = 1;
- private const int MaxTeams = 0;
- private const int MinTeams = 0;
- private const int MaxNumRounds = 100;
+ private const int _MaxPlayer = 12;
+ private const int _MinPlayer = 1;
+ private const int _MaxTeams = 0;
+ private const int _MinTeams = 0;
+ private const int _MaxNumRounds = 100;
private enum EStage
{
@@ -113,15 +113,15 @@ namespace VocaluxeLib.PartyModes.Challenge
Singing
}
- private struct Data
+ private struct SData
{
public int NumPlayer;
public int NumPlayerAtOnce;
public int NumRounds;
public List ProfileIDs;
- public ChallengeRounds Rounds;
- public List ResultTable;
+ public CChallengeRounds Rounds;
+ public List ResultTable;
public int[,] Results;
public int CurrentRoundNr;
@@ -129,7 +129,7 @@ namespace VocaluxeLib.PartyModes.Challenge
public int[] CatSongIndices;
}
- private struct Stats
+ private struct SStats
{
public int ProfileID;
public int SingPoints;
@@ -137,14 +137,14 @@ namespace VocaluxeLib.PartyModes.Challenge
public int Won;
}
- private DataToScreenConfig ToScreenConfig;
- private DataToScreenNames ToScreenNames;
- private DataToScreenMain ToScreenMain;
+ private SDataToScreenConfig _ToScreenConfig;
+ private SDataToScreenNames _ToScreenNames;
+ private SDataToScreenMain _ToScreenMain;
- private Data GameData;
+ private SData _GameData;
private EStage _Stage;
- public PartyModeChallenge()
+ public CPartyModeChallenge()
{
_ScreenSongOptions.Selection.RandomOnly = false;
_ScreenSongOptions.Selection.PartyMode = true;
@@ -158,18 +158,18 @@ namespace VocaluxeLib.PartyModes.Challenge
_Stage = EStage.NotStarted;
- ToScreenConfig = new DataToScreenConfig();
- ToScreenNames = new DataToScreenNames();
- ToScreenMain = new DataToScreenMain();
+ _ToScreenConfig = new SDataToScreenConfig();
+ _ToScreenNames = new SDataToScreenNames();
+ _ToScreenMain = new SDataToScreenMain();
- GameData = new Data();
- GameData.NumPlayer = 4;
- GameData.NumPlayerAtOnce = 2;
- GameData.NumRounds = 2;
- GameData.CurrentRoundNr = 1;
- GameData.ProfileIDs = new List();
- GameData.CatSongIndices = null;
- GameData.Results = null;
+ _GameData = new SData();
+ _GameData.NumPlayer = 4;
+ _GameData.NumPlayerAtOnce = 2;
+ _GameData.NumRounds = 2;
+ _GameData.CurrentRoundNr = 1;
+ _GameData.ProfileIDs = new List();
+ _GameData.CatSongIndices = null;
+ _GameData.Results = null;
}
public override bool Init()
@@ -184,44 +184,44 @@ namespace VocaluxeLib.PartyModes.Challenge
if (CBase.Config.GetTabs() == EOffOn.TR_CONFIG_ON && _ScreenSongOptions.Sorting.SongSorting != ESongSorting.TR_CONFIG_NONE)
_ScreenSongOptions.Sorting.Tabs = EOffOn.TR_CONFIG_ON;
- ToScreenMain.ResultTable = new List();
- GameData.ResultTable = new List();
+ _ToScreenMain.ResultTable = new List();
+ _GameData.ResultTable = new List();
return true;
}
- public override void DataFromScreen(string ScreenName, Object Data)
+ public override void DataFromScreen(string screenName, Object data)
{
- DataFromScreen data = new DataFromScreen();
- switch (ScreenName)
+ SDataFromScreen dataFrom = new SDataFromScreen();
+ switch (screenName)
{
case "PartyScreenChallengeConfig":
try
{
- data = (DataFromScreen)Data;
- GameData.NumPlayer = data.ScreenConfig.NumPlayer;
- GameData.NumPlayerAtOnce = data.ScreenConfig.NumPlayerAtOnce;
- GameData.NumRounds = data.ScreenConfig.NumRounds;
+ dataFrom = (SDataFromScreen)data;
+ _GameData.NumPlayer = dataFrom.ScreenConfig.NumPlayer;
+ _GameData.NumPlayerAtOnce = dataFrom.ScreenConfig.NumPlayerAtOnce;
+ _GameData.NumRounds = dataFrom.ScreenConfig.NumRounds;
_Stage = EStage.Config;
CBase.Graphics.FadeTo(EScreens.ScreenPartyDummy);
}
catch (Exception e)
{
- CBase.Log.LogError("Error in party mode challenge. Can't cast received data from screen " + ScreenName + ". " + e.Message);
+ CBase.Log.LogError("Error in party mode challenge. Can't cast received data from screen " + screenName + ". " + e.Message);
}
break;
case "PartyScreenChallengeNames":
try
{
- data = (DataFromScreen)Data;
- if (data.ScreenNames.FadeToConfig)
+ dataFrom = (SDataFromScreen)data;
+ if (dataFrom.ScreenNames.FadeToConfig)
_Stage = EStage.NotStarted;
else
{
- GameData.ProfileIDs = data.ScreenNames.ProfileIDs;
+ _GameData.ProfileIDs = dataFrom.ScreenNames.ProfileIDs;
_Stage = EStage.Names;
}
@@ -229,33 +229,33 @@ namespace VocaluxeLib.PartyModes.Challenge
}
catch (Exception e)
{
- CBase.Log.LogError("Error in party mode challenge. Can't cast received data from screen " + ScreenName + ". " + e.Message);
+ CBase.Log.LogError("Error in party mode challenge. Can't cast received data from screen " + screenName + ". " + e.Message);
}
break;
case "PartyScreenChallengeMain":
try
{
- data = (DataFromScreen)Data;
- if (data.ScreenMain.FadeToSongSelection)
+ dataFrom = (SDataFromScreen)data;
+ if (dataFrom.ScreenMain.FadeToSongSelection)
_Stage = EStage.Singing;
- if (data.ScreenMain.FadeToNameSelection)
+ if (dataFrom.ScreenMain.FadeToNameSelection)
_Stage = EStage.Config;
}
catch (Exception e)
{
- CBase.Log.LogError("Error in party mode challenge. Can't cast received data from screen " + ScreenName + ". " + e.Message);
+ CBase.Log.LogError("Error in party mode challenge. Can't cast received data from screen " + screenName + ". " + e.Message);
}
if (_Stage == EStage.Singing)
- StartNextRound();
+ _StartNextRound();
if (_Stage == EStage.Config)
CBase.Graphics.FadeTo(EScreens.ScreenPartyDummy);
break;
default:
- CBase.Log.LogError("Error in party mode challenge. Wrong screen is sending: " + ScreenName);
+ CBase.Log.LogError("Error in party mode challenge. Wrong screen is sending: " + screenName);
break;
}
}
@@ -269,68 +269,68 @@ namespace VocaluxeLib.PartyModes.Challenge
_ScreenSongOptions.Selection.RandomOnly = false;*/
}
- public override CMenuParty GetNextPartyScreen(out EScreens AlternativeScreen)
+ public override CMenuParty GetNextPartyScreen(out EScreens alternativeScreen)
{
- CMenuParty Screen = null;
- AlternativeScreen = EScreens.ScreenSong;
+ CMenuParty screen = null;
+ alternativeScreen = EScreens.ScreenSong;
switch (_Stage)
{
case EStage.NotStarted:
- _Screens.TryGetValue("PartyScreenChallengeConfig", out Screen);
- if (_Screens != null)
+ _Screens.TryGetValue("CPartyScreenChallengeConfig", out screen);
+ if (screen != null)
{
- ToScreenConfig.NumPlayer = GameData.NumPlayer;
- ToScreenConfig.NumPlayerAtOnce = GameData.NumPlayerAtOnce;
- ToScreenConfig.NumRounds = GameData.NumRounds;
- Screen.DataToScreen(ToScreenConfig);
+ _ToScreenConfig.NumPlayer = _GameData.NumPlayer;
+ _ToScreenConfig.NumPlayerAtOnce = _GameData.NumPlayerAtOnce;
+ _ToScreenConfig.NumRounds = _GameData.NumRounds;
+ screen.DataToScreen(_ToScreenConfig);
}
break;
case EStage.Config:
- _Screens.TryGetValue("PartyScreenChallengeNames", out Screen);
- if (_Screens != null)
+ _Screens.TryGetValue("CPartyScreenChallengeNames", out screen);
+ if (screen != null)
{
- ToScreenNames.NumPlayer = GameData.NumPlayer;
- ToScreenNames.ProfileIDs = GameData.ProfileIDs;
- Screen.DataToScreen(ToScreenNames);
+ _ToScreenNames.NumPlayer = _GameData.NumPlayer;
+ _ToScreenNames.ProfileIDs = _GameData.ProfileIDs;
+ screen.DataToScreen(_ToScreenNames);
}
break;
case EStage.Names:
- _Screens.TryGetValue("PartyScreenChallengeMain", out Screen);
- if (_Screens != null)
+ _Screens.TryGetValue("CPartyScreenChallengeMain", out screen);
+ if (screen != null)
{
CBase.Songs.ResetPartySongSung();
- ToScreenMain.ResultTable = new List();
- GameData.ResultTable = new List();
- GameData.Rounds = new ChallengeRounds(GameData.NumRounds, GameData.NumPlayer, GameData.NumPlayerAtOnce);
- GameData.CurrentRoundNr = 1;
- ToScreenMain.CurrentRoundNr = 1;
- ToScreenMain.NumPlayerAtOnce = GameData.NumPlayerAtOnce;
- ToScreenMain.Combs = GameData.Rounds.Rounds;
- ToScreenMain.ProfileIDs = GameData.ProfileIDs;
- UpdateScores();
- ToScreenMain.ResultTable = GameData.ResultTable;
- ToScreenMain.Results = GameData.Results;
- Screen.DataToScreen(ToScreenMain);
+ _ToScreenMain.ResultTable = new List();
+ _GameData.ResultTable = new List();
+ _GameData.Rounds = new CChallengeRounds(_GameData.NumRounds, _GameData.NumPlayer, _GameData.NumPlayerAtOnce);
+ _GameData.CurrentRoundNr = 1;
+ _ToScreenMain.CurrentRoundNr = 1;
+ _ToScreenMain.NumPlayerAtOnce = _GameData.NumPlayerAtOnce;
+ _ToScreenMain.Combs = _GameData.Rounds.Rounds;
+ _ToScreenMain.ProfileIDs = _GameData.ProfileIDs;
+ _UpdateScores();
+ _ToScreenMain.ResultTable = _GameData.ResultTable;
+ _ToScreenMain.Results = _GameData.Results;
+ screen.DataToScreen(_ToScreenMain);
}
break;
case EStage.Main:
//nothing to do
break;
case EStage.Singing:
- _Screens.TryGetValue("PartyScreenChallengeMain", out Screen);
- if (_Screens != null)
+ _Screens.TryGetValue("CPartyScreenChallengeMain", out screen);
+ if (screen != null)
{
- UpdateScores();
- ToScreenMain.CurrentRoundNr = GameData.CurrentRoundNr;
- ToScreenMain.Combs = GameData.Rounds.Rounds;
- ToScreenMain.Results = GameData.Results;
- Screen.DataToScreen(ToScreenMain);
+ _UpdateScores();
+ _ToScreenMain.CurrentRoundNr = _GameData.CurrentRoundNr;
+ _ToScreenMain.Combs = _GameData.Rounds.Rounds;
+ _ToScreenMain.Results = _GameData.Results;
+ screen.DataToScreen(_ToScreenMain);
}
break;
}
- return Screen;
+ return screen;
}
public override EScreens GetStartScreen()
@@ -343,7 +343,7 @@ namespace VocaluxeLib.PartyModes.Challenge
return EScreens.ScreenPartyDummy;
}
- public override ScreenSongOptions GetScreenSongOptions()
+ public override SScreenSongOptions GetScreenSongOptions()
{
_ScreenSongOptions.Sorting.SongSorting = CBase.Config.GetSongSorting();
_ScreenSongOptions.Sorting.Tabs = CBase.Config.GetTabs();
@@ -352,112 +352,112 @@ namespace VocaluxeLib.PartyModes.Challenge
return _ScreenSongOptions;
}
- public override void OnSongChange(int SongIndex, ref ScreenSongOptions ScreenSongOptions)
+ public override void OnSongChange(int songIndex, ref SScreenSongOptions screenSongOptions)
{
if (_ScreenSongOptions.Selection.SongIndex != -1)
_ScreenSongOptions.Selection.SongIndex = -1;
- if (_ScreenSongOptions.Selection.SelectNextRandomSong && SongIndex != -1)
+ if (_ScreenSongOptions.Selection.SelectNextRandomSong && songIndex != -1)
{
_ScreenSongOptions.Selection.SelectNextRandomSong = false;
- CreateCatSongIndices();
+ _CreateCatSongIndices();
- if (GameData.CatSongIndices != null)
+ if (_GameData.CatSongIndices != null)
{
- if (GameData.CatSongIndices[CBase.Songs.GetCurrentCategoryIndex()] == -1)
- GameData.CatSongIndices[CBase.Songs.GetCurrentCategoryIndex()] = SongIndex;
+ if (_GameData.CatSongIndices[CBase.Songs.GetCurrentCategoryIndex()] == -1)
+ _GameData.CatSongIndices[CBase.Songs.GetCurrentCategoryIndex()] = songIndex;
}
}
- ScreenSongOptions = _ScreenSongOptions;
+ screenSongOptions = _ScreenSongOptions;
}
- public override void OnCategoryChange(int CategoryIndex, ref ScreenSongOptions ScreenSongOptions)
+ public override void OnCategoryChange(int categoryIndex, ref SScreenSongOptions screenSongOptions)
{
- if (GameData.CatSongIndices != null && CategoryIndex != -1)
+ if (_GameData.CatSongIndices != null && categoryIndex != -1)
{
- if (GameData.CatSongIndices[CategoryIndex] == -1)
+ if (_GameData.CatSongIndices[categoryIndex] == -1)
_ScreenSongOptions.Selection.SelectNextRandomSong = true;
else
- _ScreenSongOptions.Selection.SongIndex = GameData.CatSongIndices[CategoryIndex];
+ _ScreenSongOptions.Selection.SongIndex = _GameData.CatSongIndices[categoryIndex];
}
- if (GameData.CatSongIndices == null && CategoryIndex != -1)
+ if (_GameData.CatSongIndices == null && categoryIndex != -1)
_ScreenSongOptions.Selection.SelectNextRandomSong = true;
- if (CategoryIndex == -1)
+ if (categoryIndex == -1)
_ScreenSongOptions.Selection.RandomOnly = false;
- if (_ScreenSongOptions.Sorting.Tabs == EOffOn.TR_CONFIG_OFF || CategoryIndex != -1)
+ if (_ScreenSongOptions.Sorting.Tabs == EOffOn.TR_CONFIG_OFF || categoryIndex != -1)
_ScreenSongOptions.Selection.RandomOnly = true;
- ScreenSongOptions = _ScreenSongOptions;
+ screenSongOptions = _ScreenSongOptions;
}
- public override void SetSearchString(string SearchString, bool Visible)
+ public override void SetSearchString(string searchString, bool visible)
{
- _ScreenSongOptions.Sorting.SearchString = SearchString;
- _ScreenSongOptions.Sorting.SearchActive = Visible;
+ _ScreenSongOptions.Sorting.SearchString = searchString;
+ _ScreenSongOptions.Sorting.SearchActive = visible;
}
public override int GetMaxPlayer()
{
- return MaxPlayer;
+ return _MaxPlayer;
}
public override int GetMinPlayer()
{
- return MinPlayer;
+ return _MinPlayer;
}
public override int GetMaxTeams()
{
- return MaxTeams;
+ return _MaxTeams;
}
public override int GetMinTeams()
{
- return MinTeams;
+ return _MinTeams;
}
public override int GetMaxNumRounds()
{
- return MaxNumRounds;
+ return _MaxNumRounds;
}
- public override void JokerUsed(int TeamNr)
+ public override void JokerUsed(int teamNr)
{
if (_ScreenSongOptions.Selection.NumJokers == null)
return;
- if (TeamNr >= _ScreenSongOptions.Selection.NumJokers.Length)
+ if (teamNr >= _ScreenSongOptions.Selection.NumJokers.Length)
return;
- _ScreenSongOptions.Selection.NumJokers[TeamNr]--;
+ _ScreenSongOptions.Selection.NumJokers[teamNr]--;
_ScreenSongOptions.Selection.RandomOnly = true;
_ScreenSongOptions.Selection.CategoryChangeAllowed = false;
}
- public override void SongSelected(int SongID)
+ public override void SongSelected(int songID)
{
EGameMode gm = EGameMode.TR_GAMEMODE_NORMAL;
CBase.Game.Reset();
CBase.Game.ClearSongs();
- CBase.Game.AddSong(SongID, gm);
- CBase.Game.SetNumPlayer(GameData.NumPlayerAtOnce);
+ CBase.Game.AddSong(songID, gm);
+ CBase.Game.SetNumPlayer(_GameData.NumPlayerAtOnce);
SPlayer[] player = CBase.Game.GetPlayer();
if (player == null)
return;
- if (player.Length < GameData.NumPlayerAtOnce)
+ if (player.Length < _GameData.NumPlayerAtOnce)
return;
SProfile[] profiles = CBase.Profiles.GetProfiles();
- Combination c = GameData.Rounds.GetRound(GameData.CurrentRoundNr - 1);
+ CCombination c = _GameData.Rounds.GetRound(_GameData.CurrentRoundNr - 1);
- for (int i = 0; i < GameData.NumPlayerAtOnce; i++)
+ for (int i = 0; i < _GameData.NumPlayerAtOnce; i++)
{
//default values
player[i].Name = "foobar";
@@ -467,38 +467,38 @@ namespace VocaluxeLib.PartyModes.Challenge
//try to fill with the right data
if (c != null)
{
- if (GameData.ProfileIDs[c.Player[i]] < profiles.Length)
+ if (_GameData.ProfileIDs[c.Player[i]] < profiles.Length)
{
- player[i].Name = profiles[GameData.ProfileIDs[c.Player[i]]].PlayerName;
- player[i].Difficulty = profiles[GameData.ProfileIDs[c.Player[i]]].Difficulty;
- player[i].ProfileID = GameData.ProfileIDs[c.Player[i]];
+ player[i].Name = profiles[_GameData.ProfileIDs[c.Player[i]]].PlayerName;
+ player[i].Difficulty = profiles[_GameData.ProfileIDs[c.Player[i]]].Difficulty;
+ player[i].ProfileID = _GameData.ProfileIDs[c.Player[i]];
}
}
}
- CBase.Songs.AddPartySongSung(SongID);
+ CBase.Songs.AddPartySongSung(songID);
CBase.Graphics.FadeTo(EScreens.ScreenSing);
}
public override void LeavingHighscore()
{
- GameData.CurrentRoundNr++;
+ _GameData.CurrentRoundNr++;
CBase.Graphics.FadeTo(EScreens.ScreenPartyDummy);
}
- private void StartNextRound()
+ private void _StartNextRound()
{
_ScreenSongOptions.Selection.RandomOnly = _ScreenSongOptions.Sorting.Tabs != EOffOn.TR_CONFIG_ON;
_ScreenSongOptions.Selection.CategoryChangeAllowed = _ScreenSongOptions.Sorting.Tabs == EOffOn.TR_CONFIG_ON;
- SetNumJokers();
- SetTeamNames();
- GameData.CatSongIndices = null;
+ _SetNumJokers();
+ _SetTeamNames();
+ _GameData.CatSongIndices = null;
CBase.Graphics.FadeTo(EScreens.ScreenSong);
}
- private void SetNumJokers()
+ private void _SetNumJokers()
{
- switch (GameData.NumPlayerAtOnce)
+ switch (_GameData.NumPlayerAtOnce)
{
case 1:
_ScreenSongOptions.Selection.NumJokers = new int[] {10};
@@ -529,7 +529,7 @@ namespace VocaluxeLib.PartyModes.Challenge
}
}
- private void SetTeamNames()
+ private void _SetTeamNames()
{
SProfile[] profiles = CBase.Profiles.GetProfiles();
@@ -539,21 +539,21 @@ namespace VocaluxeLib.PartyModes.Challenge
return;
}
- if (GameData.NumPlayerAtOnce < 1 || GameData.ProfileIDs.Count < GameData.NumPlayerAtOnce || profiles.Length < GameData.NumPlayerAtOnce)
+ if (_GameData.NumPlayerAtOnce < 1 || _GameData.ProfileIDs.Count < _GameData.NumPlayerAtOnce || profiles.Length < _GameData.NumPlayerAtOnce)
{
_ScreenSongOptions.Selection.TeamNames = new string[] {"foo", "bar"};
return;
}
- _ScreenSongOptions.Selection.TeamNames = new string[GameData.NumPlayerAtOnce];
- Combination c = GameData.Rounds.GetRound(GameData.CurrentRoundNr - 1);
+ _ScreenSongOptions.Selection.TeamNames = new string[_GameData.NumPlayerAtOnce];
+ CCombination c = _GameData.Rounds.GetRound(_GameData.CurrentRoundNr - 1);
- for (int i = 0; i < GameData.NumPlayerAtOnce; i++)
+ for (int i = 0; i < _GameData.NumPlayerAtOnce; i++)
{
if (c != null)
{
- if (GameData.ProfileIDs[c.Player[i]] < profiles.Length)
- _ScreenSongOptions.Selection.TeamNames[i] = profiles[GameData.ProfileIDs[c.Player[i]]].PlayerName;
+ if (_GameData.ProfileIDs[c.Player[i]] < profiles.Length)
+ _ScreenSongOptions.Selection.TeamNames[i] = profiles[_GameData.ProfileIDs[c.Player[i]]].PlayerName;
else
_ScreenSongOptions.Selection.TeamNames[i] = "foobar";
}
@@ -562,27 +562,27 @@ namespace VocaluxeLib.PartyModes.Challenge
}
}
- private void UpdateScores()
+ private void _UpdateScores()
{
- if (GameData.ResultTable.Count == 0)
+ if (_GameData.ResultTable.Count == 0)
{
- for (int i = 0; i < GameData.NumPlayer; i++)
+ for (int i = 0; i < _GameData.NumPlayer; i++)
{
- ResultTableRow row = new ResultTableRow();
- row.PlayerID = GameData.ProfileIDs[i];
+ CResultTableRow row = new CResultTableRow();
+ row.PlayerID = _GameData.ProfileIDs[i];
row.NumPlayed = 0;
row.NumRounds = 0;
row.NumWon = 0;
row.NumSingPoints = 0;
row.NumGamePoints = 0;
- GameData.ResultTable.Add(row);
+ _GameData.ResultTable.Add(row);
}
- GameData.Results = new int[GameData.NumRounds,GameData.NumPlayerAtOnce];
- for (int i = 0; i < GameData.NumRounds; i++)
+ _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;
+ for (int j = 0; j < _GameData.NumPlayerAtOnce; j++)
+ _GameData.Results[i, j] = 0;
}
}
else
@@ -591,20 +591,20 @@ namespace VocaluxeLib.PartyModes.Challenge
if (results == null)
return;
- if (results.Length < GameData.NumPlayerAtOnce)
+ if (results.Length < _GameData.NumPlayerAtOnce)
return;
- for (int j = 0; j < GameData.NumPlayerAtOnce; j++)
- GameData.Results[GameData.CurrentRoundNr - 2, j] = (int)Math.Round(results[j].Points);
+ for (int j = 0; j < _GameData.NumPlayerAtOnce; j++)
+ _GameData.Results[_GameData.CurrentRoundNr - 2, j] = (int)Math.Round(results[j].Points);
- List points = GetPointsForPlayer(results);
+ List points = _GetPointsForPlayer(results);
- for (int i = 0; i < GameData.NumPlayerAtOnce; i++)
+ for (int i = 0; i < _GameData.NumPlayerAtOnce; i++)
{
int index = -1;
- for (int j = 0; j < GameData.ResultTable.Count; j++)
+ for (int j = 0; j < _GameData.ResultTable.Count; j++)
{
- if (points[i].ProfileID == GameData.ResultTable[j].PlayerID)
+ if (points[i].ProfileID == _GameData.ResultTable[j].PlayerID)
{
index = j;
break;
@@ -613,7 +613,7 @@ namespace VocaluxeLib.PartyModes.Challenge
if (index != -1)
{
- ResultTableRow row = GameData.ResultTable[index];
+ CResultTableRow row = _GameData.ResultTable[index];
row.NumPlayed++;
row.NumWon += points[i].Won;
@@ -621,41 +621,41 @@ namespace VocaluxeLib.PartyModes.Challenge
row.NumSingPoints += points[i].SingPoints;
row.NumGamePoints += points[i].GamePoints;
- GameData.ResultTable[index] = row;
+ _GameData.ResultTable[index] = row;
}
}
}
- GameData.ResultTable.Sort();
+ _GameData.ResultTable.Sort();
//Update position-number
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)
+ if (lastPoints > _GameData.ResultTable[i].NumGamePoints || lastSingPoints > _GameData.ResultTable[i].NumSingPoints)
pos++;
- GameData.ResultTable[i].Position = pos;
- lastPoints = GameData.ResultTable[i].NumGamePoints;
- lastSingPoints = GameData.ResultTable[i].NumSingPoints;
+ _GameData.ResultTable[i].Position = pos;
+ lastPoints = _GameData.ResultTable[i].NumGamePoints;
+ lastSingPoints = _GameData.ResultTable[i].NumSingPoints;
}
}
- private List GetPointsForPlayer(SPlayer[] Results)
+ private List _GetPointsForPlayer(SPlayer[] results)
{
- List result = new List();
- for (int i = 0; i < GameData.NumPlayerAtOnce; i++)
+ List result = new List();
+ for (int i = 0; i < _GameData.NumPlayerAtOnce; i++)
{
- Stats stat = new Stats();
- stat.ProfileID = Results[i].ProfileID;
- stat.SingPoints = (int)Math.Round(Results[i].Points);
+ SStats stat = new SStats();
+ stat.ProfileID = results[i].ProfileID;
+ stat.SingPoints = (int)Math.Round(results[i].Points);
stat.Won = 0;
stat.GamePoints = 0;
result.Add(stat);
}
- result.Sort(delegate(Stats s1, Stats s2) { return s1.SingPoints.CompareTo(s2.SingPoints); });
+ result.Sort(delegate(SStats s1, SStats s2) { return s1.SingPoints.CompareTo(s2.SingPoints); });
int current = result[result.Count - 1].SingPoints;
int points = result.Count;
@@ -663,7 +663,7 @@ namespace VocaluxeLib.PartyModes.Challenge
for (int i = result.Count - 1; i >= 0; i--)
{
- Stats res = result[i];
+ SStats res = result[i];
if (i < result.Count - 1)
{
@@ -695,17 +695,17 @@ namespace VocaluxeLib.PartyModes.Challenge
return result;
}
- private void CreateCatSongIndices()
+ private void _CreateCatSongIndices()
{
- if (GameData.CatSongIndices == null && CBase.Songs.GetNumCategories() > 0 && _ScreenSongOptions.Sorting.Tabs == EOffOn.TR_CONFIG_ON)
+ if (_GameData.CatSongIndices == null && CBase.Songs.GetNumCategories() > 0 && _ScreenSongOptions.Sorting.Tabs == EOffOn.TR_CONFIG_ON)
{
- GameData.CatSongIndices = new int[CBase.Songs.GetNumCategories()];
- for (int i = 0; i < GameData.CatSongIndices.Length; i++)
- GameData.CatSongIndices[i] = -1;
+ _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;
+ _GameData.CatSongIndices = null;
}
}
}
\ No newline at end of file
diff --git a/PartyModes/PartyModeChallenge/CPartyScreenChallengeConfig.cs b/PartyModes/PartyModeChallenge/CPartyScreenChallengeConfig.cs
new file mode 100644
index 00000000..2351bd79
--- /dev/null
+++ b/PartyModes/PartyModeChallenge/CPartyScreenChallengeConfig.cs
@@ -0,0 +1,227 @@
+using System;
+using System.Windows.Forms;
+using VocaluxeLib.Menu;
+
+namespace VocaluxeLib.PartyModes.Challenge
+{
+ public class CPartyScreenChallengeConfig : CMenuParty
+ {
+ // Version number for theme files. Increment it, if you've changed something on the theme files!
+ protected override int _ScreenVersion
+ {
+ get { return 1; }
+ }
+
+ 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;
+
+ private SDataFromScreen _Data;
+
+ public override void Init()
+ {
+ base.Init();
+
+ _ThemeSelectSlides = new string[] {_SelectSlideNumPlayers, _SelectSlideNumMics, _SelectSlideNumRounds};
+ _ThemeButtons = new string[] {_ButtonNext, _ButtonBack};
+
+ _Data = new SDataFromScreen();
+ SFromScreenConfig config = new SFromScreenConfig();
+ config.NumPlayer = 4;
+ config.NumPlayerAtOnce = 2;
+ config.NumRounds = 12;
+ _Data.ScreenConfig = config;
+ }
+
+ public override void DataToScreen(object receivedData)
+ {
+ SDataToScreenConfig config = new SDataToScreenConfig();
+
+ try
+ {
+ config = (SDataToScreenConfig)receivedData;
+ _Data.ScreenConfig.NumPlayer = config.NumPlayer;
+ _Data.ScreenConfig.NumPlayerAtOnce = config.NumPlayerAtOnce;
+ _Data.ScreenConfig.NumRounds = config.NumRounds;
+ }
+ catch (Exception e)
+ {
+ 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(SKeyEvent keyEvent)
+ {
+ base.HandleInput(keyEvent);
+
+ if (keyEvent.KeyPressed) {}
+ else
+ {
+ switch (keyEvent.Key)
+ {
+ case Keys.Back:
+ case Keys.Escape:
+ _Back();
+ break;
+
+ case Keys.Enter:
+ _UpdateSlides();
+
+ if (Buttons[_ButtonBack].Selected)
+ _Back();
+
+ if (Buttons[_ButtonNext].Selected)
+ _Next();
+ break;
+
+ case Keys.Left:
+ _UpdateSlides();
+ break;
+
+ case Keys.Right:
+ _UpdateSlides();
+ break;
+ }
+ }
+ return true;
+ }
+
+ public override bool HandleMouse(SMouseEvent mouseEvent)
+ {
+ base.HandleMouse(mouseEvent);
+
+ if (mouseEvent.LB && IsMouseOver(mouseEvent))
+ {
+ _UpdateSlides();
+ if (Buttons[_ButtonBack].Selected)
+ _Back();
+
+ if (Buttons[_ButtonNext].Selected)
+ _Next();
+ }
+
+ if (mouseEvent.RB)
+ _Back();
+
+ return true;
+ }
+
+ public override void OnShow()
+ {
+ base.OnShow();
+
+ _MaxNumMics = CBase.Config.GetMaxNumMics();
+ if (_MaxNumMics > 6)
+ _MaxNumMics = 6;
+
+ _MaxNumRounds = _PartyMode.GetMaxNumRounds();
+
+ _RebuildSlides();
+ }
+
+ public override bool UpdateGame()
+ {
+ return true;
+ }
+
+ public override bool Draw()
+ {
+ base.Draw();
+ return true;
+ }
+
+ private void _RebuildSlides()
+ {
+ // build num player slide (min player ... max player);
+ SelectSlides[_SelectSlideNumPlayers].Clear();
+ for (int i = _PartyMode.GetMinPlayer(); i <= _PartyMode.GetMaxPlayer(); i++)
+ SelectSlides[_SelectSlideNumPlayers].AddValue(i.ToString());
+ SelectSlides[_SelectSlideNumPlayers].Selection = _Data.ScreenConfig.NumPlayer - _PartyMode.GetMinPlayer();
+
+ _UpdateMicsAtOnce();
+ _SetRoundSteps();
+ _UpdateSlideRounds();
+ }
+
+ private void _UpdateSlides()
+ {
+ int player = _Data.ScreenConfig.NumPlayer;
+ int mics = _Data.ScreenConfig.NumPlayerAtOnce;
+ _Data.ScreenConfig.NumPlayer = SelectSlides[_SelectSlideNumPlayers].Selection + _PartyMode.GetMinPlayer();
+ _Data.ScreenConfig.NumPlayerAtOnce = SelectSlides[_SelectSlideNumMics].Selection + _PartyMode.GetMinPlayer();
+ _Data.ScreenConfig.NumRounds = (SelectSlides[_SelectSlideNumRounds].Selection + 1) * _RoundSteps;
+
+ _UpdateMicsAtOnce();
+ _SetRoundSteps();
+
+ if (player != _Data.ScreenConfig.NumPlayer || mics != _Data.ScreenConfig.NumPlayerAtOnce)
+ {
+ int num = CHelper.CombinationCount(_Data.ScreenConfig.NumPlayer, _Data.ScreenConfig.NumPlayerAtOnce);
+ while (num > _MaxNumRounds)
+ num -= _RoundSteps;
+ _Data.ScreenConfig.NumRounds = num;
+ }
+
+ _UpdateSlideRounds();
+ }
+
+ private void _UpdateMicsAtOnce()
+ {
+ //Data.ScreenConfig.NumPlayerAtOnce
+ int maxNum = _MaxNumMics;
+ if (_Data.ScreenConfig.NumPlayer < _MaxNumMics)
+ maxNum = _Data.ScreenConfig.NumPlayer;
+
+ if (_Data.ScreenConfig.NumPlayerAtOnce > maxNum)
+ _Data.ScreenConfig.NumPlayerAtOnce = maxNum;
+
+ // build mics at once slide
+ SelectSlides[_SelectSlideNumMics].Clear();
+ for (int i = 1; i <= maxNum; i++)
+ SelectSlides[_SelectSlideNumMics].AddValue(i.ToString());
+ SelectSlides[_SelectSlideNumMics].Selection = _Data.ScreenConfig.NumPlayerAtOnce - _PartyMode.GetMinPlayer();
+ }
+
+ private void _UpdateSlideRounds()
+ {
+ // build num rounds slide
+ SelectSlides[_SelectSlideNumRounds].Clear();
+ for (int i = _RoundSteps; i <= _MaxNumRounds; i += _RoundSteps)
+ SelectSlides[_SelectSlideNumRounds].AddValue(i.ToString());
+ SelectSlides[_SelectSlideNumRounds].Selection = _Data.ScreenConfig.NumRounds / _RoundSteps - 1;
+ }
+
+ private void _SetRoundSteps()
+ {
+ if (_Data.ScreenConfig.NumPlayerAtOnce < 1 || _Data.ScreenConfig.NumPlayer < 1 || _Data.ScreenConfig.NumPlayerAtOnce > _Data.ScreenConfig.NumPlayer)
+ {
+ _RoundSteps = 1;
+ return;
+ }
+
+ int res = _Data.ScreenConfig.NumPlayer / _Data.ScreenConfig.NumPlayerAtOnce;
+ int mod = _Data.ScreenConfig.NumPlayer % _Data.ScreenConfig.NumPlayerAtOnce;
+
+ if (mod == 0)
+ _RoundSteps = res;
+ else
+ _RoundSteps = _Data.ScreenConfig.NumPlayer;
+ }
+
+ private void _Back()
+ {
+ _FadeTo(EScreens.ScreenParty);
+ }
+
+ private void _Next()
+ {
+ _PartyMode.DataFromScreen(ThemeName, _Data);
+ }
+ }
+}
\ No newline at end of file
diff --git a/PartyModes/PartyModeChallenge/CPartyScreenChallengeMain.cs b/PartyModes/PartyModeChallenge/CPartyScreenChallengeMain.cs
new file mode 100644
index 00000000..26d04c1d
--- /dev/null
+++ b/PartyModes/PartyModeChallenge/CPartyScreenChallengeMain.cs
@@ -0,0 +1,660 @@
+using System;
+using System.Collections.Generic;
+using System.Windows.Forms;
+using VocaluxeLib.Menu;
+
+namespace VocaluxeLib.PartyModes.Challenge
+{
+ struct STableRow
+ {
+ public CText Pos;
+ public CText Name;
+ public CText Rounds;
+ public CText Won;
+ public CText SingPoints;
+ public CText GamePoints;
+ }
+
+ class CRoundsTableRow
+ {
+ public CText Number;
+ public List TextPlayer;
+ public List TextScores;
+ }
+
+ public class CPartyScreenChallengeMain : CMenuParty
+ {
+ // Version number for theme files. Increment it, if you've changed something on the theme files!
+ protected override int _ScreenVersion
+ {
+ get { return 1; }
+ }
+
+ 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";
+
+ 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";
+
+ private const string _StaticPopupBG = "StaticPopupBG";
+ private const string _StaticNextPlayer = "StaticNextPlayer";
+
+ private bool _ExitPopupVisible;
+
+ private SDataFromScreen _Data;
+ private SDataToScreenMain _GameState;
+ private List _PlayerTable;
+ private List _RoundsTable;
+
+ private List _NextPlayerTexts;
+ private List _NextPlayerStatics;
+
+ private SRectF _RoundsTableScrollArea;
+ private SRectF _PlayerTableScrollArea;
+ private int _RoundsTableOffset;
+ private int _PlayerTableOffset;
+ private int _NumPlayerVisible = 10;
+ private int _NumRoundsVisible = 3;
+
+ public CPartyScreenChallengeMain()
+ {
+ _Data = new SDataFromScreen();
+ _Data.ScreenMain = new SFromScreenMain();
+ }
+
+ public override void Init()
+ {
+ base.Init();
+
+ _ThemeTexts = new string[]
+ {
+ _TextPosition, _TextPlayerName, _TextNumPlayed, _TextWon, _TextSingPoints, _TextGamePoints, _TextNextPlayer, _TextPopupReallyExit, _TextRoundNumber, _TextRoundPlayer,
+ _TextRoundScore, _TextFinishMessage, _TextFinishPlayerWin, _TextNextPlayerMessage
+ };
+ _ThemeButtons = new string[]
+ {_ButtonNextRound, _ButtonBack, _ButtonExit, _ButtonPopupYes, _ButtonPopupNo, _ButtonPlayerScrollDown, _ButtonPlayerScrollUp, _ButtonRoundsScrollDown, _ButtonRoundsScrollUp};
+ _ThemeStatics = new string[] {_StaticPopupBG, _StaticNextPlayer};
+ }
+
+ public override void LoadTheme(string xmlPath)
+ {
+ base.LoadTheme(xmlPath);
+
+ _GameState = new SDataToScreenMain();
+ _BuildPlayerTable();
+ _CreateRoundsTable();
+ _NextPlayerTexts = new List();
+ _NextPlayerStatics = new List();
+
+ for (int i = 0; i < _PartyMode.GetMaxPlayer(); i++)
+ {
+ _NextPlayerTexts.Add(GetNewText(Texts[_TextNextPlayer]));
+ AddText(_NextPlayerTexts[_NextPlayerTexts.Count - 1]);
+ _NextPlayerStatics.Add(GetNewStatic(Statics[_StaticNextPlayer]));
+ AddStatic(_NextPlayerStatics[_NextPlayerStatics.Count - 1]);
+ }
+ }
+
+ public override void DataToScreen(object receivedData)
+ {
+ SDataToScreenMain data = new SDataToScreenMain();
+
+ try
+ {
+ data = (SDataToScreenMain)receivedData;
+ _GameState = data;
+ }
+ catch (Exception e)
+ {
+ 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(SKeyEvent keyEvent)
+ {
+ base.HandleInput(keyEvent);
+
+ if (keyEvent.KeyPressed) {}
+ else
+ {
+ switch (keyEvent.Key)
+ {
+ case Keys.Back:
+ case Keys.Escape:
+ if (!_ExitPopupVisible)
+ {
+ if (_GameState.CurrentRoundNr == 1)
+ _Back();
+ else
+ _ShowPopup(true);
+ }
+ else
+ _ShowPopup(false);
+ break;
+
+ case Keys.Enter:
+ if (!_ExitPopupVisible)
+ {
+ if (Buttons[_ButtonNextRound].Selected)
+ _NextRound();
+ if (Buttons[_ButtonBack].Selected && _GameState.CurrentRoundNr == 1)
+ _Back();
+ if (Buttons[_ButtonExit].Selected && _GameState.CurrentRoundNr > 1)
+ _ShowPopup(true);
+ if (Buttons[_ButtonPlayerScrollUp].Selected)
+ _ScrollPlayerTable(-1);
+ if (Buttons[_ButtonPlayerScrollDown].Selected)
+ _ScrollPlayerTable(1);
+ if (Buttons[_ButtonRoundsScrollUp].Selected)
+ _ScrollRoundsTable(-1);
+ if (Buttons[_ButtonRoundsScrollDown].Selected)
+ _ScrollRoundsTable(1);
+ }
+ else
+ {
+ if (Buttons[_ButtonPopupYes].Selected)
+ _EndParty();
+ if (Buttons[_ButtonPopupNo].Selected)
+ _ShowPopup(false);
+ }
+ break;
+ }
+ }
+ return true;
+ }
+
+ public override bool HandleMouse(SMouseEvent mouseEvent)
+ {
+ base.HandleMouse(mouseEvent);
+
+ if (mouseEvent.LB && IsMouseOver(mouseEvent))
+ {
+ if (!_ExitPopupVisible)
+ {
+ if (Buttons[_ButtonNextRound].Selected)
+ _NextRound();
+ if (Buttons[_ButtonBack].Selected && _GameState.CurrentRoundNr == 1)
+ _Back();
+ if (Buttons[_ButtonExit].Selected && _GameState.CurrentRoundNr > 1)
+ _ShowPopup(true);
+ if (Buttons[_ButtonPlayerScrollUp].Selected)
+ _ScrollPlayerTable(-1);
+ if (Buttons[_ButtonPlayerScrollDown].Selected)
+ _ScrollPlayerTable(1);
+ if (Buttons[_ButtonRoundsScrollUp].Selected)
+ _ScrollRoundsTable(-1);
+ if (Buttons[_ButtonRoundsScrollDown].Selected)
+ _ScrollRoundsTable(1);
+ }
+ else
+ {
+ if (Buttons[_ButtonPopupYes].Selected)
+ _EndParty();
+ if (Buttons[_ButtonPopupNo].Selected)
+ _ShowPopup(false);
+ }
+ }
+
+ if (mouseEvent.RB)
+ {
+ if (!_ExitPopupVisible)
+ {
+ if (_GameState.CurrentRoundNr == 1)
+ _Back();
+ else
+ _ShowPopup(true);
+ }
+ else
+ _ShowPopup(false);
+ }
+
+ if (mouseEvent.Wheel != 0)
+ {
+ if (CHelper.IsInBounds(_RoundsTableScrollArea, mouseEvent))
+ _ScrollRoundsTable(mouseEvent.Wheel);
+ if (CHelper.IsInBounds(_PlayerTableScrollArea, mouseEvent))
+ _ScrollPlayerTable(mouseEvent.Wheel);
+ }
+
+ return true;
+ }
+
+ public override void OnShow()
+ {
+ base.OnShow();
+
+ _PlayerTableOffset = 0;
+ _RoundsTableOffset = 0;
+
+ _UpdatePlayerTable();
+ _UpdateNextPlayerPositions();
+ _UpdateNextPlayerContents();
+ if (_GameState.CurrentRoundNr == 1)
+ _BuildRoundsTable();
+ else
+ _ScrollRoundsTable(_GameState.CurrentRoundNr - 2);
+ _UpdateRoundsTable();
+
+ if (_GameState.CurrentRoundNr == 1)
+ {
+ Buttons[_ButtonBack].Visible = true;
+ Buttons[_ButtonExit].Visible = false;
+ }
+ else
+ {
+ Buttons[_ButtonBack].Visible = false;
+ Buttons[_ButtonExit].Visible = true;
+ }
+
+ if (_GameState.CurrentRoundNr <= _GameState.Combs.Count)
+ {
+ Buttons[_ButtonNextRound].Visible = true;
+ Texts[_TextFinishMessage].Visible = false;
+ Texts[_TextFinishPlayerWin].Visible = false;
+ SetInteractionToButton(Buttons[_ButtonNextRound]);
+ }
+ else
+ {
+ Buttons[_ButtonNextRound].Visible = false;
+ Texts[_TextFinishMessage].Visible = true;
+ Texts[_TextFinishPlayerWin].Visible = true;
+ Texts[_TextFinishPlayerWin].Text = _GetPlayerWinString();
+ SetInteractionToButton(Buttons[_ButtonExit]);
+ }
+
+ _ShowPopup(false);
+ }
+
+ public override bool UpdateGame()
+ {
+ return true;
+ }
+
+ public override bool Draw()
+ {
+ base.Draw();
+ return true;
+ }
+
+ private void _NextRound()
+ {
+ _Data.ScreenMain.FadeToNameSelection = false;
+ _Data.ScreenMain.FadeToSongSelection = true;
+ _PartyMode.DataFromScreen(ThemeName, _Data);
+ }
+
+ private void _EndParty()
+ {
+ _FadeTo(EScreens.ScreenParty);
+ }
+
+ private void _ShowPopup(bool visible)
+ {
+ _ExitPopupVisible = visible;
+
+ Statics[_StaticPopupBG].Visible = _ExitPopupVisible;
+ Texts[_TextPopupReallyExit].Visible = _ExitPopupVisible;
+ Buttons[_ButtonPopupYes].Visible = _ExitPopupVisible;
+ Buttons[_ButtonPopupNo].Visible = _ExitPopupVisible;
+
+ if (_ExitPopupVisible)
+ SetInteractionToButton(Buttons[_ButtonPopupNo]);
+ }
+
+ private void _Back()
+ {
+ _Data.ScreenMain.FadeToNameSelection = true;
+ _Data.ScreenMain.FadeToSongSelection = false;
+ _PartyMode.DataFromScreen(ThemeName, _Data);
+ }
+
+ private void _UpdateNextPlayerPositions()
+ {
+ float x = CBase.Settings.GetRenderW() / 2 - ((_GameState.NumPlayerAtOnce * Statics[_StaticNextPlayer].Rect.W) + ((_GameState.NumPlayerAtOnce - 1) * 15)) / 2;
+ float staticY = 590;
+ float textY = 550;
+ for (int i = 0; i < _GameState.NumPlayerAtOnce; i++)
+ {
+ //static
+ _NextPlayerStatics[i].Rect.X = x;
+ _NextPlayerStatics[i].Rect.Y = staticY;
+ _NextPlayerStatics[i].Visible = true;
+ //text
+ _NextPlayerTexts[i].X = x + Statics[_StaticNextPlayer].Rect.W / 2;
+ _NextPlayerTexts[i].Y = textY;
+ _NextPlayerTexts[i].Visible = true;
+
+ x += Statics[_StaticNextPlayer].Rect.W + 15;
+ }
+ for (int i = _GameState.NumPlayerAtOnce; i < _PartyMode.GetMaxPlayer(); i++)
+ {
+ _NextPlayerStatics[i].Visible = false;
+ _NextPlayerTexts[i].Visible = false;
+ }
+ }
+
+ private void _UpdateNextPlayerContents()
+ {
+ if (_GameState.CurrentRoundNr <= _GameState.Combs.Count)
+ {
+ 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);
+ }
+ }
+ else
+ {
+ Texts[_TextNextPlayerMessage].Visible = false;
+ for (int i = 0; i < _GameState.NumPlayerAtOnce; i++)
+ {
+ _NextPlayerStatics[i].Visible = false;
+ _NextPlayerTexts[i].Visible = false;
+ }
+ }
+ }
+
+ private void _CreateRoundsTable()
+ {
+ //Create lists
+ _RoundsTable = new List();
+ for (int i = 0; i < 5; i++)
+ {
+ CRoundsTableRow rtr = new CRoundsTableRow();
+ rtr.TextPlayer = new List();
+ rtr.TextScores = new List();
+ _RoundsTable.Add(rtr);
+ }
+ //Create statics and texts for rounds
+ for (int round = 0; round < _RoundsTable.Count; round++)
+ {
+ //Round-number
+ CText text = GetNewText(Texts[_TextRoundNumber]);
+ AddText(text);
+ _RoundsTable[round].Number = text;
+ for (int row = 0; row < 2; row++)
+ {
+ for (int column = 0; column < 3; column++)
+ {
+ //Player
+ text = GetNewText(Texts[_TextRoundPlayer]);
+ AddText(text);
+ _RoundsTable[round].TextPlayer.Add(text);
+ //Score
+ text = GetNewText(Texts[_TextRoundScore]);
+ AddText(text);
+ _RoundsTable[round].TextScores.Add(text);
+ }
+ }
+ }
+ }
+
+ private void _BuildRoundsTable()
+ {
+ _RoundsTableScrollArea = new SRectF();
+
+ int numPlayerInOneRow = 3;
+ if (_GameState.NumPlayerAtOnce <= numPlayerInOneRow)
+ _NumRoundsVisible = 5;
+ else
+ _NumRoundsVisible = 3;
+
+ if (_NumRoundsVisible > _GameState.Combs.Count)
+ _NumRoundsVisible = _GameState.Combs.Count;
+
+ float numberX = Texts[_TextRoundNumber].X;
+ float numberY = Texts[_TextRoundNumber].Y;
+
+ _RoundsTableScrollArea.X = numberX;
+ _RoundsTableScrollArea.Y = numberY;
+ _RoundsTableScrollArea.W = CBase.Settings.GetRenderW() - Texts[_TextRoundNumber].X - 20;
+
+ float delta = Texts[_TextRoundNumber].Height;
+
+ //Update statics and texts for rounds
+ for (int round = 0; round < _RoundsTable.Count; round++)
+ {
+ //Round-number
+ _RoundsTable[round].Number.X = numberX;
+ _RoundsTable[round].Number.Y = numberY;
+ int numInnerRows = (int)Math.Ceiling(_GameState.NumPlayerAtOnce / ((double)numPlayerInOneRow));
+ for (int row = 0; row < numInnerRows; row++)
+ {
+ int num = (row + 1) * numPlayerInOneRow;
+ int numPlayerInThisRow = numPlayerInOneRow;
+ if (num > _GameState.NumPlayerAtOnce)
+ {
+ num = _GameState.NumPlayerAtOnce;
+ numPlayerInThisRow = _GameState.NumPlayerAtOnce - (row * numPlayerInOneRow);
+ }
+ for (int column = row * numPlayerInOneRow; column < num; column++)
+ {
+ //Player
+ 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;
+ //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;
+ }
+ numberY = numberY + delta + delta;
+ }
+ numberY = numberY + delta / 2;
+ }
+ _RoundsTableScrollArea.H = numberY - _RoundsTableScrollArea.Y;
+ }
+
+ private void _UpdateRoundsTable()
+ {
+ SProfile[] profile = CBase.Profiles.GetProfiles();
+ for (int i = 0; i < _RoundsTable.Count; i++)
+ {
+ for (int p = 0; p < _RoundsTable[i].TextPlayer.Count; p++)
+ {
+ if (_GameState.Combs.Count > i + _RoundsTableOffset && _GameState.Combs[i + _RoundsTableOffset].Player.Count > p)
+ {
+ _RoundsTable[i].Number.Visible = true;
+ _RoundsTable[i].TextPlayer[p].Visible = true;
+ _RoundsTable[i].TextScores[p].Visible = true;
+ _RoundsTable[i].Number.Text = (i + 1 + _RoundsTableOffset).ToString() + ")";
+ int pID = _GameState.ProfileIDs[_GameState.Combs[i + _RoundsTableOffset].Player[p]];
+ _RoundsTable[i].TextPlayer[p].Text = profile[pID].PlayerName;
+ if ((_GameState.CurrentRoundNr - 1) > i + _RoundsTableOffset)
+ _RoundsTable[i].TextScores[p].Text = _GameState.Results[i + _RoundsTableOffset, p].ToString();
+ else
+ _RoundsTable[i].TextScores[p].Text = "";
+ }
+ else
+ {
+ _RoundsTable[i].TextPlayer[p].Visible = false;
+ _RoundsTable[i].TextScores[p].Visible = false;
+ }
+ }
+ if (_GameState.Combs.Count < i + _RoundsTableOffset || i + 1 > _NumRoundsVisible)
+ {
+ _RoundsTable[i].Number.Visible = false;
+ for (int p = 0; p < _RoundsTable[i].TextPlayer.Count; p++)
+ {
+ _RoundsTable[i].TextPlayer[p].Visible = false;
+ _RoundsTable[i].TextScores[p].Visible = false;
+ }
+ }
+ }
+
+ Buttons[_ButtonRoundsScrollUp].Visible = _RoundsTableOffset > 0;
+ Buttons[_ButtonRoundsScrollDown].Visible = _GameState.Combs.Count - _NumRoundsVisible - _RoundsTableOffset > 0;
+ }
+
+ private void _BuildPlayerTable()
+ {
+ _PlayerTableScrollArea = new SRectF();
+ _PlayerTableScrollArea.X = Texts[_TextPosition].X;
+ _PlayerTableScrollArea.Y = Texts[_TextPosition].Y;
+ _PlayerTableScrollArea.W = Texts[_TextGamePoints].X - Texts[_TextPosition].X;
+
+ _PlayerTable = new List();
+ float delta = Texts[_TextPosition].Height * 1.2f;
+
+ float h = 0;
+
+ for (int i = 0; i < 10; i++)
+ {
+ STableRow row = new STableRow();
+
+ 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);
+ row.Rounds.Y += delta * (i + 1);
+ row.Won.Y += delta * (i + 1);
+ row.SingPoints.Y += delta * (i + 1);
+ row.GamePoints.Y += delta * (i + 1);
+
+ row.Pos.Text = (i + 1).ToString() + ".";
+
+ row.Pos.Visible = false;
+ row.Name.Visible = false;
+ row.Rounds.Visible = false;
+ row.Won.Visible = false;
+ row.SingPoints.Visible = false;
+ row.GamePoints.Visible = false;
+
+ AddText(row.Pos);
+ AddText(row.Name);
+ AddText(row.Rounds);
+ AddText(row.Won);
+ AddText(row.SingPoints);
+ AddText(row.GamePoints);
+
+ _PlayerTable.Add(row);
+
+ h = delta * (i + 1);
+ }
+ _PlayerTableScrollArea.H = h + delta;
+ }
+
+ private void _UpdatePlayerTable()
+ {
+ SProfile[] profiles = CBase.Profiles.GetProfiles();
+
+ for (int i = 0; i < _PlayerTable.Count; i++)
+ {
+ STableRow row = _PlayerTable[i];
+
+ if (i + _PlayerTableOffset < _GameState.ResultTable.Count)
+ {
+ row.Pos.Visible = true;
+ row.Name.Visible = true;
+ row.Rounds.Visible = true;
+ row.Won.Visible = true;
+ row.SingPoints.Visible = true;
+ 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();
+ }
+ else
+ {
+ row.Pos.Visible = false;
+ row.Name.Visible = false;
+ row.Rounds.Visible = false;
+ row.Won.Visible = false;
+ row.SingPoints.Visible = false;
+ row.GamePoints.Visible = false;
+ }
+ }
+
+ Buttons[_ButtonPlayerScrollUp].Visible = _PlayerTableOffset > 0;
+ Buttons[_ButtonPlayerScrollDown].Visible = _GameState.ProfileIDs.Count - _NumPlayerVisible - _PlayerTableOffset > 0;
+ }
+
+ private void _ScrollPlayerTable(int offset)
+ {
+ if (_GameState.ProfileIDs.Count <= _NumPlayerVisible)
+ _PlayerTableOffset = 0;
+ else if (offset < 0 && _PlayerTableOffset + offset >= 0)
+ _PlayerTableOffset += offset;
+ else if (offset < 0 && _PlayerTableOffset + offset < 0)
+ _PlayerTableOffset = 0;
+ else if (offset > 0 && _PlayerTableOffset + offset <= _GameState.ProfileIDs.Count - _NumPlayerVisible)
+ _PlayerTableOffset += offset;
+ else if (offset > 0 && _PlayerTableOffset + offset > _GameState.ProfileIDs.Count - _NumPlayerVisible)
+ _PlayerTableOffset = _GameState.ProfileIDs.Count - _NumPlayerVisible;
+
+ _UpdatePlayerTable();
+ }
+
+ private void _ScrollRoundsTable(int offset)
+ {
+ if (_GameState.Combs.Count <= _NumRoundsVisible)
+ _RoundsTableOffset = 0;
+ else if (offset < 0 && _RoundsTableOffset + offset >= 0)
+ _RoundsTableOffset += offset;
+ else if (offset < 0 && _RoundsTableOffset + offset < 0)
+ _RoundsTableOffset = 0;
+ else if (offset > 0 && _RoundsTableOffset + offset <= _GameState.Combs.Count - _NumRoundsVisible)
+ _RoundsTableOffset += offset;
+ else if (offset > 0 && _RoundsTableOffset + offset > _GameState.Combs.Count - _NumRoundsVisible)
+ _RoundsTableOffset = _GameState.Combs.Count - _NumRoundsVisible;
+
+ _UpdateRoundsTable();
+ }
+
+ private string _GetPlayerWinString()
+ {
+ string s = "";
+ SProfile[] profiles = CBase.Profiles.GetProfiles();
+
+ for (int i = 0; i < _GameState.ResultTable.Count; i++)
+ {
+ if (_GameState.ResultTable[i].Position == 1)
+ {
+ if (i > 0)
+ s += ", ";
+ s += profiles[_GameState.ResultTable[i].PlayerID].PlayerName;
+ }
+ else
+ break;
+ }
+
+ return s;
+ }
+ }
+}
\ No newline at end of file
diff --git a/PartyModes/PartyModeChallenge/CPartyScreenChallengeNames.cs b/PartyModes/PartyModeChallenge/CPartyScreenChallengeNames.cs
new file mode 100644
index 00000000..573f5430
--- /dev/null
+++ b/PartyModes/PartyModeChallenge/CPartyScreenChallengeNames.cs
@@ -0,0 +1,504 @@
+using System;
+using System.Collections.Generic;
+using System.Windows.Forms;
+using VocaluxeLib.Menu;
+
+namespace VocaluxeLib.PartyModes.Challenge
+{
+ public class CPartyScreenChallengeNames : CMenuParty
+ {
+ // Version number for theme files. Increment it, if you've changed something on the theme files!
+ protected override int _ScreenVersion
+ {
+ get { return 1; }
+ }
+
+ private const string _ButtonNext = "ButtonNext";
+ private const string _ButtonBack = "ButtonBack";
+ private const string _ButtonPlayerDestination = "ButtonPlayerDestination";
+ private const string _ButtonPlayerChoose = "ButtonPlayerChoose";
+
+ private List _PlayerChooseButtons;
+ private List _PlayerDestinationButtons;
+ //PlayerDestinationButtons-Option
+ private const int _PlayerDestinationButtonsNumH = 3;
+ private const int _PlayerDestinationButtonsNumW = 4;
+ private const int _PlayerDestinationButtonsFirstX = 900;
+ private const int _PlayerDestinationButtonsFirstY = 105;
+ private const int _PlayerDestinationButtonsSpaceH = 15;
+ private const int _PlayerDestinationButtonsSpaceW = 25;
+ //PlayerChooseButtons-Option
+ private List _PlayerChooseButtonsVisibleProfiles;
+ private const int _PlayerChooseButtonsNumH = 7;
+ private const int _PlayerChooseButtonsNumW = 4;
+ private const int _PlayerChooseButtonsFirstX = 52;
+ private const int _PlayerChooseButtonsFirstY = 105;
+ private const int _PlayerChooseButtonsSpaceH = 15;
+ private const int _PlayerChooseButtonsSpaceW = 25;
+ private int _PlayerChooseButtonsOffset = 0;
+
+ private CStatic _ChooseAvatarStatic;
+ private bool _SelectingMouseActive;
+ private int _OldMouseX;
+ private int _OldMouseY;
+ private int _SelectedPlayerNr = -1;
+ private bool _ButtonsAdded;
+
+ private int _NumPlayer = 4;
+
+ private SDataFromScreen _Data;
+
+ private class CPlayerChooseButton
+ {
+ public CButton Button;
+ public int ProfileID;
+ }
+
+ public override void Init()
+ {
+ base.Init();
+
+ _ChooseAvatarStatic = GetNewStatic();
+ _ChooseAvatarStatic.Visible = false;
+
+ _PlayerChooseButtonsVisibleProfiles = new List();
+
+ _Data.ScreenNames.ProfileIDs = new List();
+
+ List buttons = new List();
+ _ThemeButtons = new string[] {_ButtonBack, _ButtonNext, _ButtonPlayerDestination, _ButtonPlayerChoose};
+
+ _Data = new SDataFromScreen();
+ SFromScreenNames names = new SFromScreenNames();
+ names.FadeToConfig = false;
+ names.FadeToMain = false;
+ names.ProfileIDs = new List();
+ _Data.ScreenNames = names;
+ }
+
+ public override void DataToScreen(object receivedData)
+ {
+ SDataToScreenNames config = new SDataToScreenNames();
+
+ try
+ {
+ config = (SDataToScreenNames)receivedData;
+ _Data.ScreenNames.ProfileIDs = config.ProfileIDs;
+ if (_Data.ScreenNames.ProfileIDs == null)
+ _Data.ScreenNames.ProfileIDs = new List();
+
+ _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);
+ }
+ }
+
+ public override bool HandleInput(SKeyEvent keyEvent)
+ {
+ base.HandleInput(keyEvent);
+
+ if (keyEvent.KeyPressed) {}
+ else
+ {
+ switch (keyEvent.Key)
+ {
+ case Keys.Back:
+ case Keys.Escape:
+ _Back();
+ break;
+
+ case Keys.Enter:
+ if (Buttons[_ButtonBack].Selected)
+ _Back();
+
+ if (Buttons[_ButtonNext].Selected)
+ _Next();
+
+ if (!_OnAdd())
+ _OnRemove();
+ break;
+
+ case Keys.Delete:
+ _OnRemove();
+ break;
+ }
+ }
+ return true;
+ }
+
+ public override bool HandleMouse(SMouseEvent mouseEvent)
+ {
+ base.HandleMouse(mouseEvent);
+
+ /*
+ //Check if LeftButton is hold and Select-Mode inactive
+ if (MouseEvent.LBH && !SelectingMouseActive)
+ {
+ //Save mouse-coords
+ 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)
+ {
+ SelectedPlayerNr = PlayerChooseButtons[i].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.Z = -100;
+ chooseAvatarStatic.Color = new SColorF(1, 1, 1, 1);
+ chooseAvatarStatic.Texture = CBase.Profiles.GetProfiles()[SelectedPlayerNr].Avatar.Texture;
+ }
+ }
+ }
+ }*/
+
+ //Check if LeftButton is hold and Select-Mode active
+ 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;
+ }
+ // LeftButton isn't hold anymore, but Selec-Mode is still active -> "Drop" of Avatar
+ else if (_SelectingMouseActive)
+ {
+ //Check if really a player was selected
+ if (_SelectedPlayerNr != -1)
+ {
+ //Foreach Drop-Area
+ for (int i = 0; i < _PlayerDestinationButtons.Count; i++)
+ {
+ //Check first, if area is "active"
+ if (_PlayerDestinationButtons[i].Visible)
+ {
+ //Check if Mouse is in area
+ if (CHelper.IsInBounds(_PlayerDestinationButtons[i].Rect, mouseEvent))
+ {
+ int added = -1;
+ //Add Player-ID to list.
+ if (_Data.ScreenNames.ProfileIDs.Count < (i + 1))
+ {
+ _Data.ScreenNames.ProfileIDs.Add(_SelectedPlayerNr);
+ added = _Data.ScreenNames.ProfileIDs.Count - 1;
+ }
+ else if (_Data.ScreenNames.ProfileIDs.Count >= (i + 1))
+ {
+ _Data.ScreenNames.ProfileIDs[i] = _SelectedPlayerNr;
+ added = i;
+ }
+ _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 = _ChooseAvatarStatic.Texture;
+ _PlayerDestinationButtons[added].SelTexture = _ChooseAvatarStatic.Texture;
+ _PlayerDestinationButtons[added].Text.Text = CBase.Profiles.GetProfiles()[_SelectedPlayerNr].PlayerName;
+ //Update Tiles-List
+ _UpdateButtonPlayerChoose();
+ }
+ }
+ }
+ _SelectedPlayerNr = -1;
+ }
+ //Reset variables
+ _SelectingMouseActive = false;
+ _ChooseAvatarStatic.Visible = false;
+ }
+
+ if (mouseEvent.LB && IsMouseOver(mouseEvent))
+ {
+ if (Buttons[_ButtonBack].Selected)
+ _Back();
+
+ if (Buttons[_ButtonNext].Selected)
+ _Next();
+
+ if (!_OnAdd())
+ _OnRemove();
+ }
+
+ if (mouseEvent.RB)
+ _Back();
+
+ return true;
+ }
+
+ public override void OnShow()
+ {
+ base.OnShow();
+
+ if (!_ButtonsAdded)
+ {
+ _AddButtonPlayerDestination();
+ _AddButtonPlayerChoose();
+ _ButtonsAdded = true;
+ }
+
+ _UpdateButtonPlayerDestination();
+ _UpdateButtonPlayerChoose();
+
+ _UpdateButtonNext();
+ }
+
+ public override bool UpdateGame()
+ {
+ return true;
+ }
+
+ public override bool Draw()
+ {
+ base.Draw();
+ if (_ChooseAvatarStatic.Visible)
+ _ChooseAvatarStatic.Draw();
+ return true;
+ }
+
+ private void _AddButtonPlayerDestination()
+ {
+ Buttons[_ButtonPlayerDestination].Visible = false;
+ _PlayerDestinationButtons = new List();
+ int row = 0;
+ int column = 0;
+ for (int i = 1; i <= _PartyMode.GetMaxPlayer(); i++)
+ {
+ 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);
+ column++;
+ if (column >= _PlayerDestinationButtonsNumH)
+ {
+ row++;
+ column = 0;
+ }
+ b.Visible = true;
+ b.Enabled = false;
+ AddButton(b);
+ }
+ }
+
+ private void _AddButtonPlayerChoose()
+ {
+ Buttons[_ButtonPlayerChoose].Visible = false;
+ _PlayerChooseButtons = new List();
+ int row = 0;
+ int column = 0;
+ for (int i = 1; i <= _PlayerChooseButtonsNumH * _PlayerChooseButtonsNumW; i++)
+ {
+ 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();
+ pcb.Button = b;
+ pcb.ProfileID = -1;
+ _PlayerChooseButtons.Add(pcb);
+ column++;
+ if (column >= _PlayerChooseButtonsNumH)
+ {
+ row++;
+ column = 0;
+ }
+ b.Visible = true;
+ b.Enabled = false;
+ AddButton(b);
+ }
+ }
+
+ private void _UpdateButtonPlayerChoose()
+ {
+ _UpdateVisibleProfiles();
+ if ((_PlayerChooseButtonsNumW * _PlayerChooseButtonsNumH) * (_PlayerChooseButtonsOffset + 1) - _PlayerChooseButtonsVisibleProfiles.Count >=
+ (_PlayerChooseButtonsNumW * _PlayerChooseButtonsNumH) * _PlayerChooseButtonsOffset)
+ _UpdateButtonPlayerChoose(_PlayerChooseButtonsOffset - 1);
+ else
+ _UpdateButtonPlayerChoose(_PlayerChooseButtonsOffset);
+ }
+
+ private void _UpdateButtonPlayerChoose(int offset)
+ {
+ int numButtonPlayerChoose = _PlayerChooseButtonsNumW * _PlayerChooseButtonsNumH;
+ if (offset < 0)
+ offset = 0;
+
+ if (numButtonPlayerChoose * (offset + 1) - _PlayerChooseButtonsVisibleProfiles.Count <= numButtonPlayerChoose)
+ {
+ for (int i = 0; i < numButtonPlayerChoose; i++)
+ {
+ if ((i + offset * numButtonPlayerChoose) < _PlayerChooseButtonsVisibleProfiles.Count)
+ {
+ _PlayerChooseButtons[i].ProfileID = _PlayerChooseButtonsVisibleProfiles[i + offset * numButtonPlayerChoose];
+ _PlayerChooseButtons[i].Button.Text.Text = CBase.Profiles.GetProfiles()[_PlayerChooseButtonsVisibleProfiles[i + offset * numButtonPlayerChoose]].PlayerName;
+ _PlayerChooseButtons[i].Button.Texture = CBase.Profiles.GetProfiles()[_PlayerChooseButtonsVisibleProfiles[i + offset * numButtonPlayerChoose]].Avatar.Texture;
+ _PlayerChooseButtons[i].Button.SelTexture = CBase.Profiles.GetProfiles()[_PlayerChooseButtonsVisibleProfiles[i + offset * numButtonPlayerChoose]].Avatar.Texture;
+ _PlayerChooseButtons[i].Button.Color = new SColorF(1, 1, 1, 0.6f);
+ _PlayerChooseButtons[i].Button.SelColor = new SColorF(1, 1, 1, 1);
+ _PlayerChooseButtons[i].Button.Enabled = true;
+ }
+ else
+ {
+ _PlayerChooseButtons[i].ProfileID = -1;
+ _PlayerChooseButtons[i].Button.Text.Text = String.Empty;
+ _PlayerChooseButtons[i].Button.Texture = Buttons[_ButtonPlayerChoose].Texture;
+ _PlayerChooseButtons[i].Button.SelTexture = Buttons[_ButtonPlayerChoose].SelTexture;
+ _PlayerChooseButtons[i].Button.Color = Buttons[_ButtonPlayerChoose].Color;
+ _PlayerChooseButtons[i].Button.SelColor = Buttons[_ButtonPlayerChoose].SelColor;
+ _PlayerChooseButtons[i].Button.Enabled = false;
+ }
+ }
+ }
+ }
+
+ private void _UpdateVisibleProfiles()
+ {
+ _PlayerChooseButtonsVisibleProfiles.Clear();
+ for (int i = 0; i < CBase.Profiles.GetProfiles().Length; i++)
+ {
+ bool visible = false;
+ //Show profile only if active
+ if (CBase.Profiles.GetProfiles()[i].Active == EOffOn.TR_CONFIG_ON)
+ {
+ visible = true;
+
+ for (int p = 0; p < _Data.ScreenNames.ProfileIDs.Count; p++)
+ {
+ //Don't show profile if is selected
+ if (_Data.ScreenNames.ProfileIDs[p] == i)
+ {
+ visible = false;
+ break;
+ }
+ }
+ }
+ if (visible)
+ _PlayerChooseButtonsVisibleProfiles.Add(i);
+ }
+ }
+
+ private void _UpdateButtonPlayerDestination()
+ {
+ for (int i = 0; i < _PlayerDestinationButtons.Count; i++)
+ {
+ if (_NumPlayer > i)
+ {
+ _PlayerDestinationButtons[i].Visible = true;
+ _PlayerDestinationButtons[i].Enabled = true;
+ }
+ else
+ {
+ _PlayerDestinationButtons[i].Visible = false;
+ _PlayerDestinationButtons[i].Enabled = false;
+ }
+ }
+ for (int i = 0; i < _NumPlayer; i++)
+ {
+ if (i < _Data.ScreenNames.ProfileIDs.Count)
+ {
+ if (_Data.ScreenNames.ProfileIDs[i] != -1)
+ {
+ _PlayerDestinationButtons[i].Color = new SColorF(1, 1, 1, 0.6f);
+ _PlayerDestinationButtons[i].SelColor = new SColorF(1, 1, 1, 1);
+ _PlayerDestinationButtons[i].Texture = CBase.Profiles.GetProfiles()[_Data.ScreenNames.ProfileIDs[i]].Avatar.Texture;
+ _PlayerDestinationButtons[i].SelTexture = CBase.Profiles.GetProfiles()[_Data.ScreenNames.ProfileIDs[i]].Avatar.Texture;
+ _PlayerDestinationButtons[i].Text.Text = CBase.Profiles.GetProfiles()[_Data.ScreenNames.ProfileIDs[i]].PlayerName;
+ _PlayerDestinationButtons[i].Enabled = true;
+ }
+ }
+ else
+ {
+ _PlayerDestinationButtons[i].Color = Buttons[_ButtonPlayerDestination].Color;
+ _PlayerDestinationButtons[i].SelColor = Buttons[_ButtonPlayerDestination].SelColor;
+ _PlayerDestinationButtons[i].Texture = Buttons[_ButtonPlayerDestination].Texture;
+ _PlayerDestinationButtons[i].SelTexture = Buttons[_ButtonPlayerDestination].SelTexture;
+ _PlayerDestinationButtons[i].Text.Text = String.Empty;
+ _PlayerDestinationButtons[i].Enabled = false;
+ }
+ }
+ }
+
+ private void _UpdateButtonNext()
+ {
+ if (_Data.ScreenNames.ProfileIDs.Count == _NumPlayer)
+ {
+ Buttons[_ButtonNext].Visible = true;
+ SetInteractionToButton(Buttons[_ButtonNext]);
+ }
+ else
+ Buttons[_ButtonNext].Visible = false;
+ }
+
+ private bool _OnAdd()
+ {
+ for (int i = 0; i < _PlayerChooseButtons.Count; i++)
+ {
+ if (_PlayerChooseButtons[i].Button.Selected && _PlayerChooseButtons[i].ProfileID != -1)
+ {
+ if (_Data.ScreenNames.ProfileIDs.Count < _NumPlayer)
+ {
+ _Data.ScreenNames.ProfileIDs.Add(_PlayerChooseButtons[i].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].Enabled = true;
+ //Update Tiles-List
+ _UpdateButtonPlayerChoose();
+ CheckInteraction();
+ return true;
+ }
+ }
+ }
+ return false;
+ }
+
+ private bool _OnRemove()
+ {
+ for (int i = 0; i < _PlayerDestinationButtons.Count; i++)
+ {
+ if (_PlayerDestinationButtons[i].Selected)
+ {
+ if ((i + 1) <= _Data.ScreenNames.ProfileIDs.Count)
+ {
+ _Data.ScreenNames.ProfileIDs.RemoveAt(i);
+ _UpdateButtonNext();
+ _UpdateButtonPlayerDestination();
+ _UpdateButtonPlayerChoose();
+ CheckInteraction();
+ return true;
+ }
+ }
+ }
+ return false;
+ }
+
+ private void _Back()
+ {
+ _Data.ScreenNames.FadeToConfig = true;
+ _Data.ScreenNames.FadeToMain = false;
+ _PartyMode.DataFromScreen(ThemeName, _Data);
+ }
+
+ private void _Next()
+ {
+ _Data.ScreenNames.FadeToConfig = false;
+ _Data.ScreenNames.FadeToMain = true;
+ _PartyMode.DataFromScreen(ThemeName, _Data);
+ }
+ }
+}
\ No newline at end of file
diff --git a/PartyModes/PartyModeChallenge/ChallengeRounds.cs b/PartyModes/PartyModeChallenge/ChallengeRounds.cs
index 908c1fa8..080084c4 100644
--- a/PartyModes/PartyModeChallenge/ChallengeRounds.cs
+++ b/PartyModes/PartyModeChallenge/ChallengeRounds.cs
@@ -3,58 +3,58 @@ using System.Collections.Generic;
namespace VocaluxeLib.PartyModes.Challenge
{
- public class ChallengeRounds
+ public class CChallengeRounds
{
private readonly Random _Rand;
private readonly int _NumPlayer;
- public List Rounds;
+ public List Rounds;
- public ChallengeRounds(int NumRounds, int NumPlayer, int NumPlayerAtOnce)
+ public CChallengeRounds(int numRounds, int numPlayer, int numPlayerAtOnce)
{
- Rounds = new List();
+ Rounds = new List();
_Rand = new Random(DateTime.Now.Millisecond);
- if (NumPlayerAtOnce < 1 || NumRounds < 1 || NumPlayer == 0)
+ if (numPlayerAtOnce < 1 || numRounds < 1 || numPlayer == 0)
_NumPlayer = 0;
else
{
- _NumPlayer = NumPlayer;
- BuildRounds(NumRounds, NumPlayerAtOnce, _Rand);
+ _NumPlayer = numPlayer;
+ _BuildRounds(numRounds, numPlayerAtOnce, _Rand);
}
}
- public Combination GetRound(int RoundNr)
+ public CCombination GetRound(int roundNr)
{
- if (RoundNr >= Rounds.Count || _NumPlayer == 0 || Rounds.Count == 0)
+ if (roundNr >= Rounds.Count || _NumPlayer == 0 || Rounds.Count == 0)
return null;
- return Rounds[RoundNr];
+ return Rounds[roundNr];
}
- private void BuildRounds(int NumRounds, int NumPlayerAtOnce, Random Rand)
+ private void _BuildRounds(int numRounds, int numPlayerAtOnce, Random rand)
{
- Combinations Combinations = new Combinations(_NumPlayer, NumPlayerAtOnce, Rand);
- Rounds.Add(Combinations.GetNextCombination(null));
+ CCombinations combinations = new CCombinations(_NumPlayer, numPlayerAtOnce, rand);
+ Rounds.Add(combinations.GetNextCombination(null));
- for (int i = 1; i < NumRounds; i++)
- Rounds.Add(Combinations.GetNextCombination(GetPlayerDemand(i)));
+ for (int i = 1; i < numRounds; i++)
+ Rounds.Add(combinations.GetNextCombination(_GetPlayerDemand(i)));
}
- private List GetPlayerDemand(int RoundIndex)
+ private List _GetPlayerDemand(int roundIndex)
{
- List NumPlayed = new List(_NumPlayer);
+ List numPlayed = new List(_NumPlayer);
for (int i = 0; i < _NumPlayer; i++)
- NumPlayed.Add(0);
+ numPlayed.Add(0);
- for (int i = 0; i < RoundIndex; i++)
+ for (int i = 0; i < roundIndex; i++)
{
- foreach (int PlayerIndex in Rounds[i].Player)
- NumPlayed[PlayerIndex]++;
+ foreach (int playerIndex in Rounds[i].Player)
+ numPlayed[playerIndex]++;
}
int max = 0;
- foreach (int p in NumPlayed)
+ foreach (int p in numPlayed)
{
if (p > max)
max = p;
@@ -65,20 +65,20 @@ namespace VocaluxeLib.PartyModes.Challenge
List other = new List();
List last = new List();
- for (int i = 0; i < NumPlayed.Count; i++)
+ for (int i = 0; i < numPlayed.Count; i++)
{
- if (RoundIndex == 0 || NumPlayed[i] < max)
+ if (roundIndex == 0 || numPlayed[i] < max)
{
- if (RoundIndex == 0 || RoundIndex > 0 && NumPlayed[i] < max && !Rounds[RoundIndex - 1].IsAvailable(i))
+ if (roundIndex == 0 || roundIndex > 0 && numPlayed[i] < max && !Rounds[roundIndex - 1].IsAvailable(i))
result.Add(i);
- else if (NumPlayed[i] < max)
+ else if (numPlayed[i] < max)
other.Add(i);
}
else
{
- if (RoundIndex > 0)
+ if (roundIndex > 0)
{
- if (!Rounds[RoundIndex - 1].IsAvailable(i))
+ if (!Rounds[roundIndex - 1].IsAvailable(i))
other.Add(i);
else
last.Add(i);
@@ -116,48 +116,48 @@ namespace VocaluxeLib.PartyModes.Challenge
}
}
- class Combinations
+ class CCombinations
{
- private readonly List _Combs;
+ private readonly List _Combs;
private readonly Random _Rand;
private readonly int _NumPlayer;
private readonly int _NumMics;
- public Combinations(int NumPlayer, int NumMics, Random Rand)
+ public CCombinations(int numPlayer, int numMics, Random rand)
{
- _Combs = new List();
- _NumMics = NumMics;
- _NumPlayer = NumPlayer;
- _Rand = Rand;
+ _Combs = new List();
+ _NumMics = numMics;
+ _NumPlayer = numPlayer;
+ _Rand = rand;
}
- public Combination GetNextCombination(List PlayerNrDemand)
+ public CCombination GetNextCombination(List playerNrDemand)
{
if (_Combs.Count == 0)
- Create();
+ _Create();
- Combination combs = new Combination();
+ CCombination combs = new CCombination();
if (_NumPlayer == _NumMics)
return _Combs[0];
//filter against PlayerNrDemand
- List combsFiltered = new List();
- if (PlayerNrDemand != null)
+ List combsFiltered = new List();
+ if (playerNrDemand != null)
{
for (int i = 0; i < _Combs.Count; i++)
{
- if (_Combs[i].IsAvailableAll(PlayerNrDemand))
+ if (_Combs[i].IsAvailableAll(playerNrDemand))
combsFiltered.Add(_Combs[i]);
}
}
//1st fallback
- if (PlayerNrDemand != null && combsFiltered.Count == 0)
+ if (playerNrDemand != null && combsFiltered.Count == 0)
{
for (int i = 0; i < _Combs.Count; i++)
{
- if (_Combs[i].IsAvailableSomeone(PlayerNrDemand))
+ if (_Combs[i].IsAvailableSomeone(playerNrDemand))
combsFiltered.Add(_Combs[i]);
}
}
@@ -171,7 +171,7 @@ namespace VocaluxeLib.PartyModes.Challenge
int num = combsFiltered.Count;
int rand = _Rand.Next(num);
- Combination c = new Combination();
+ CCombination c = new CCombination();
for (int i = 0; i < combsFiltered[rand].Player.Count; i++)
c.Player.Add(combsFiltered[rand].Player[i]);
_Combs.Remove(combsFiltered[rand]);
@@ -179,7 +179,7 @@ namespace VocaluxeLib.PartyModes.Challenge
return combsFiltered[rand];
}
- private void Create()
+ private void _Create()
{
_Combs.Clear();
@@ -187,7 +187,7 @@ namespace VocaluxeLib.PartyModes.Challenge
for (int i = 1; i <= num; i++)
{
- Combination c = new Combination();
+ CCombination c = new CCombination();
for (int j = 0; j < _NumPlayer; j++)
{
@@ -201,37 +201,37 @@ namespace VocaluxeLib.PartyModes.Challenge
}
}
- public class Combination
+ public class CCombination
{
public List Player;
- public Combination()
+ public CCombination()
{
Player = new List();
}
- public bool IsAvailable(int PlayerIndex)
+ public bool IsAvailable(int playerIndex)
{
foreach (int p in Player)
{
- if (p == PlayerIndex)
+ if (p == playerIndex)
return true;
}
return false;
}
- public bool IsAvailableAll(List PlayerIndices)
+ public bool IsAvailableAll(List playerIndices)
{
bool result = true;
- foreach (int p in PlayerIndices)
+ foreach (int p in playerIndices)
result &= IsAvailable(p);
return result;
}
- public bool IsAvailableSomeone(List PlayerIndices)
+ public bool IsAvailableSomeone(List playerIndices)
{
bool result = false;
- foreach (int p in PlayerIndices)
+ foreach (int p in playerIndices)
result |= IsAvailable(p);
return result;
}
diff --git a/PartyModes/PartyModeChallenge/PartyModeChallenge.csproj b/PartyModes/PartyModeChallenge/PartyModeChallenge.csproj
index 725cc119..edc62696 100644
--- a/PartyModes/PartyModeChallenge/PartyModeChallenge.csproj
+++ b/PartyModes/PartyModeChallenge/PartyModeChallenge.csproj
@@ -109,10 +109,10 @@
-
-
-
-
+
+
+
+
@@ -123,10 +123,7 @@
-
-
-
diff --git a/PartyModes/PartyModeChallenge/PartyScreenChallengeConfig.cs b/PartyModes/PartyModeChallenge/PartyScreenChallengeConfig.cs
deleted file mode 100644
index 1c4d409c..00000000
--- a/PartyModes/PartyModeChallenge/PartyScreenChallengeConfig.cs
+++ /dev/null
@@ -1,227 +0,0 @@
-using System;
-using System.Windows.Forms;
-using VocaluxeLib.Menu;
-
-namespace VocaluxeLib.PartyModes.Challenge
-{
- public class PartyScreenChallengeConfig : CMenuParty
- {
- // Version number for theme files. Increment it, if you've changed something on the theme files!
- protected override int _ScreenVersion
- {
- get { return 1; }
- }
-
- 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;
-
- private DataFromScreen Data;
-
- public override void Init()
- {
- base.Init();
-
- _ThemeSelectSlides = new string[] {SelectSlideNumPlayers, SelectSlideNumMics, SelectSlideNumRounds};
- _ThemeButtons = new string[] {ButtonNext, ButtonBack};
-
- Data = new DataFromScreen();
- FromScreenConfig config = new FromScreenConfig();
- config.NumPlayer = 4;
- config.NumPlayerAtOnce = 2;
- config.NumRounds = 12;
- Data.ScreenConfig = config;
- }
-
- public override void DataToScreen(object ReceivedData)
- {
- DataToScreenConfig config = new DataToScreenConfig();
-
- try
- {
- config = (DataToScreenConfig)ReceivedData;
- Data.ScreenConfig.NumPlayer = config.NumPlayer;
- Data.ScreenConfig.NumPlayerAtOnce = config.NumPlayerAtOnce;
- Data.ScreenConfig.NumRounds = config.NumRounds;
- }
- catch (Exception e)
- {
- 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)
- {
- base.HandleInput(keyEvent);
-
- if (keyEvent.KeyPressed) {}
- else
- {
- switch (keyEvent.Key)
- {
- case Keys.Back:
- case Keys.Escape:
- Back();
- break;
-
- case Keys.Enter:
- UpdateSlides();
-
- if (Buttons[ButtonBack].Selected)
- Back();
-
- if (Buttons[ButtonNext].Selected)
- Next();
- break;
-
- case Keys.Left:
- UpdateSlides();
- break;
-
- case Keys.Right:
- UpdateSlides();
- break;
- }
- }
- return true;
- }
-
- public override bool HandleMouse(MouseEvent mouseEvent)
- {
- base.HandleMouse(mouseEvent);
-
- if (mouseEvent.LB && IsMouseOver(mouseEvent))
- {
- UpdateSlides();
- if (Buttons[ButtonBack].Selected)
- Back();
-
- if (Buttons[ButtonNext].Selected)
- Next();
- }
-
- if (mouseEvent.RB)
- Back();
-
- return true;
- }
-
- public override void OnShow()
- {
- base.OnShow();
-
- _MaxNumMics = CBase.Config.GetMaxNumMics();
- if (_MaxNumMics > 6)
- _MaxNumMics = 6;
-
- _MaxNumRounds = _PartyMode.GetMaxNumRounds();
-
- RebuildSlides();
- }
-
- public override bool UpdateGame()
- {
- return true;
- }
-
- public override bool Draw()
- {
- base.Draw();
- return true;
- }
-
- private void RebuildSlides()
- {
- // build num player slide (min player ... max player);
- SelectSlides[SelectSlideNumPlayers].Clear();
- for (int i = _PartyMode.GetMinPlayer(); i <= _PartyMode.GetMaxPlayer(); i++)
- SelectSlides[SelectSlideNumPlayers].AddValue(i.ToString());
- SelectSlides[SelectSlideNumPlayers].Selection = Data.ScreenConfig.NumPlayer - _PartyMode.GetMinPlayer();
-
- UpdateMicsAtOnce();
- SetRoundSteps();
- UpdateSlideRounds();
- }
-
- private void UpdateSlides()
- {
- int player = Data.ScreenConfig.NumPlayer;
- int mics = Data.ScreenConfig.NumPlayerAtOnce;
- Data.ScreenConfig.NumPlayer = SelectSlides[SelectSlideNumPlayers].Selection + _PartyMode.GetMinPlayer();
- Data.ScreenConfig.NumPlayerAtOnce = SelectSlides[SelectSlideNumMics].Selection + _PartyMode.GetMinPlayer();
- Data.ScreenConfig.NumRounds = (SelectSlides[SelectSlideNumRounds].Selection + 1) * _RoundSteps;
-
- UpdateMicsAtOnce();
- SetRoundSteps();
-
- if (player != Data.ScreenConfig.NumPlayer || mics != Data.ScreenConfig.NumPlayerAtOnce)
- {
- int num = CHelper.nCk(Data.ScreenConfig.NumPlayer, Data.ScreenConfig.NumPlayerAtOnce);
- while (num > _MaxNumRounds)
- num -= _RoundSteps;
- Data.ScreenConfig.NumRounds = num;
- }
-
- UpdateSlideRounds();
- }
-
- private void UpdateMicsAtOnce()
- {
- //Data.ScreenConfig.NumPlayerAtOnce
- int MaxNum = _MaxNumMics;
- if (Data.ScreenConfig.NumPlayer < _MaxNumMics)
- MaxNum = Data.ScreenConfig.NumPlayer;
-
- if (Data.ScreenConfig.NumPlayerAtOnce > MaxNum)
- Data.ScreenConfig.NumPlayerAtOnce = MaxNum;
-
- // build mics at once slide
- SelectSlides[SelectSlideNumMics].Clear();
- for (int i = 1; i <= MaxNum; i++)
- SelectSlides[SelectSlideNumMics].AddValue(i.ToString());
- SelectSlides[SelectSlideNumMics].Selection = Data.ScreenConfig.NumPlayerAtOnce - _PartyMode.GetMinPlayer();
- }
-
- private void UpdateSlideRounds()
- {
- // build num rounds slide
- SelectSlides[SelectSlideNumRounds].Clear();
- for (int i = _RoundSteps; i <= _MaxNumRounds; i += _RoundSteps)
- SelectSlides[SelectSlideNumRounds].AddValue(i.ToString());
- SelectSlides[SelectSlideNumRounds].Selection = Data.ScreenConfig.NumRounds / _RoundSteps - 1;
- }
-
- private void SetRoundSteps()
- {
- if (Data.ScreenConfig.NumPlayerAtOnce < 1 || Data.ScreenConfig.NumPlayer < 1 || Data.ScreenConfig.NumPlayerAtOnce > Data.ScreenConfig.NumPlayer)
- {
- _RoundSteps = 1;
- return;
- }
-
- int res = Data.ScreenConfig.NumPlayer / Data.ScreenConfig.NumPlayerAtOnce;
- int mod = Data.ScreenConfig.NumPlayer % Data.ScreenConfig.NumPlayerAtOnce;
-
- if (mod == 0)
- _RoundSteps = res;
- else
- _RoundSteps = Data.ScreenConfig.NumPlayer;
- }
-
- private void Back()
- {
- FadeTo(EScreens.ScreenParty);
- }
-
- private void Next()
- {
- _PartyMode.DataFromScreen(ThemeName, Data);
- }
- }
-}
\ No newline at end of file
diff --git a/PartyModes/PartyModeChallenge/PartyScreenChallengeMain.cs b/PartyModes/PartyModeChallenge/PartyScreenChallengeMain.cs
deleted file mode 100644
index f6fa899f..00000000
--- a/PartyModes/PartyModeChallenge/PartyScreenChallengeMain.cs
+++ /dev/null
@@ -1,660 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Windows.Forms;
-using VocaluxeLib.Menu;
-
-namespace VocaluxeLib.PartyModes.Challenge
-{
- struct TableRow
- {
- public CText Pos;
- public CText Name;
- public CText Rounds;
- public CText Won;
- public CText SingPoints;
- public CText GamePoints;
- }
-
- class RoundsTableRow
- {
- public CText Number;
- public List TextPlayer;
- public List TextScores;
- }
-
- public class PartyScreenChallengeMain : CMenuParty
- {
- // Version number for theme files. Increment it, if you've changed something on the theme files!
- protected override int _ScreenVersion
- {
- get { return 1; }
- }
-
- 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";
-
- 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";
-
- private const string StaticPopupBG = "StaticPopupBG";
- private const string StaticNextPlayer = "StaticNextPlayer";
-
- private bool ExitPopupVisible;
-
- private DataFromScreen Data;
- private DataToScreenMain GameState;
- private List PlayerTable;
- private List RoundsTable;
-
- private List NextPlayerTexts;
- private List NextPlayerStatics;
-
- private SRectF RoundsTableScrollArea;
- private SRectF PlayerTableScrollArea;
- private int RoundsTableOffset;
- private int PlayerTableOffset;
- private int NumPlayerVisible = 10;
- private int NumRoundsVisible = 3;
-
- public PartyScreenChallengeMain()
- {
- Data = new DataFromScreen();
- Data.ScreenMain = new FromScreenMain();
- }
-
- public override void Init()
- {
- base.Init();
-
- _ThemeTexts = new string[]
- {
- TextPosition, TextPlayerName, TextNumPlayed, TextWon, TextSingPoints, TextGamePoints, TextNextPlayer, TextPopupReallyExit, TextRoundNumber, TextRoundPlayer,
- TextRoundScore, TextFinishMessage, TextFinishPlayerWin, TextNextPlayerMessage
- };
- _ThemeButtons = new string[]
- {ButtonNextRound, ButtonBack, ButtonExit, ButtonPopupYes, ButtonPopupNo, ButtonPlayerScrollDown, ButtonPlayerScrollUp, ButtonRoundsScrollDown, ButtonRoundsScrollUp};
- _ThemeStatics = new string[] {StaticPopupBG, StaticNextPlayer};
- }
-
- public override void LoadTheme(string XmlPath)
- {
- base.LoadTheme(XmlPath);
-
- GameState = new DataToScreenMain();
- BuildPlayerTable();
- CreateRoundsTable();
- NextPlayerTexts = new List();
- NextPlayerStatics = new List();
-
- for (int i = 0; i < _PartyMode.GetMaxPlayer(); i++)
- {
- NextPlayerTexts.Add(GetNewText(Texts[TextNextPlayer]));
- AddText(NextPlayerTexts[NextPlayerTexts.Count - 1]);
- NextPlayerStatics.Add(GetNewStatic(Statics[StaticNextPlayer]));
- AddStatic(NextPlayerStatics[NextPlayerStatics.Count - 1]);
- }
- }
-
- public override void DataToScreen(object ReceivedData)
- {
- DataToScreenMain data = new DataToScreenMain();
-
- try
- {
- data = (DataToScreenMain)ReceivedData;
- GameState = data;
- }
- catch (Exception e)
- {
- 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)
- {
- base.HandleInput(keyEvent);
-
- if (keyEvent.KeyPressed) {}
- else
- {
- switch (keyEvent.Key)
- {
- case Keys.Back:
- case Keys.Escape:
- if (!ExitPopupVisible)
- {
- if (GameState.CurrentRoundNr == 1)
- Back();
- else
- ShowPopup(true);
- }
- else
- ShowPopup(false);
- break;
-
- case Keys.Enter:
- if (!ExitPopupVisible)
- {
- if (Buttons[ButtonNextRound].Selected)
- NextRound();
- if (Buttons[ButtonBack].Selected && GameState.CurrentRoundNr == 1)
- Back();
- if (Buttons[ButtonExit].Selected && GameState.CurrentRoundNr > 1)
- ShowPopup(true);
- if (Buttons[ButtonPlayerScrollUp].Selected)
- ScrollPlayerTable(-1);
- if (Buttons[ButtonPlayerScrollDown].Selected)
- ScrollPlayerTable(1);
- if (Buttons[ButtonRoundsScrollUp].Selected)
- ScrollRoundsTable(-1);
- if (Buttons[ButtonRoundsScrollDown].Selected)
- ScrollRoundsTable(1);
- }
- else
- {
- if (Buttons[ButtonPopupYes].Selected)
- EndParty();
- if (Buttons[ButtonPopupNo].Selected)
- ShowPopup(false);
- }
- break;
- }
- }
- return true;
- }
-
- public override bool HandleMouse(MouseEvent mouseEvent)
- {
- base.HandleMouse(mouseEvent);
-
- if (mouseEvent.LB && IsMouseOver(mouseEvent))
- {
- if (!ExitPopupVisible)
- {
- if (Buttons[ButtonNextRound].Selected)
- NextRound();
- if (Buttons[ButtonBack].Selected && GameState.CurrentRoundNr == 1)
- Back();
- if (Buttons[ButtonExit].Selected && GameState.CurrentRoundNr > 1)
- ShowPopup(true);
- if (Buttons[ButtonPlayerScrollUp].Selected)
- ScrollPlayerTable(-1);
- if (Buttons[ButtonPlayerScrollDown].Selected)
- ScrollPlayerTable(1);
- if (Buttons[ButtonRoundsScrollUp].Selected)
- ScrollRoundsTable(-1);
- if (Buttons[ButtonRoundsScrollDown].Selected)
- ScrollRoundsTable(1);
- }
- else
- {
- if (Buttons[ButtonPopupYes].Selected)
- EndParty();
- if (Buttons[ButtonPopupNo].Selected)
- ShowPopup(false);
- }
- }
-
- if (mouseEvent.RB)
- {
- if (!ExitPopupVisible)
- {
- if (GameState.CurrentRoundNr == 1)
- Back();
- else
- ShowPopup(true);
- }
- else
- ShowPopup(false);
- }
-
- if (mouseEvent.Wheel != 0)
- {
- if (CHelper.IsInBounds(RoundsTableScrollArea, mouseEvent))
- ScrollRoundsTable(mouseEvent.Wheel);
- if (CHelper.IsInBounds(PlayerTableScrollArea, mouseEvent))
- ScrollPlayerTable(mouseEvent.Wheel);
- }
-
- return true;
- }
-
- public override void OnShow()
- {
- base.OnShow();
-
- PlayerTableOffset = 0;
- RoundsTableOffset = 0;
-
- UpdatePlayerTable();
- UpdateNextPlayerPositions();
- UpdateNextPlayerContents();
- if (GameState.CurrentRoundNr == 1)
- BuildRoundsTable();
- else
- ScrollRoundsTable(GameState.CurrentRoundNr - 2);
- UpdateRoundsTable();
-
- if (GameState.CurrentRoundNr == 1)
- {
- Buttons[ButtonBack].Visible = true;
- Buttons[ButtonExit].Visible = false;
- }
- else
- {
- Buttons[ButtonBack].Visible = false;
- Buttons[ButtonExit].Visible = true;
- }
-
- if (GameState.CurrentRoundNr <= GameState.Combs.Count)
- {
- Buttons[ButtonNextRound].Visible = true;
- Texts[TextFinishMessage].Visible = false;
- Texts[TextFinishPlayerWin].Visible = false;
- SetInteractionToButton(Buttons[ButtonNextRound]);
- }
- else
- {
- Buttons[ButtonNextRound].Visible = false;
- Texts[TextFinishMessage].Visible = true;
- Texts[TextFinishPlayerWin].Visible = true;
- Texts[TextFinishPlayerWin].Text = GetPlayerWinString();
- SetInteractionToButton(Buttons[ButtonExit]);
- }
-
- ShowPopup(false);
- }
-
- public override bool UpdateGame()
- {
- return true;
- }
-
- public override bool Draw()
- {
- base.Draw();
- return true;
- }
-
- private void NextRound()
- {
- Data.ScreenMain.FadeToNameSelection = false;
- Data.ScreenMain.FadeToSongSelection = true;
- _PartyMode.DataFromScreen(ThemeName, Data);
- }
-
- private void EndParty()
- {
- FadeTo(EScreens.ScreenParty);
- }
-
- private void ShowPopup(bool Visible)
- {
- ExitPopupVisible = Visible;
-
- Statics[StaticPopupBG].Visible = ExitPopupVisible;
- Texts[TextPopupReallyExit].Visible = ExitPopupVisible;
- Buttons[ButtonPopupYes].Visible = ExitPopupVisible;
- Buttons[ButtonPopupNo].Visible = ExitPopupVisible;
-
- if (ExitPopupVisible)
- SetInteractionToButton(Buttons[ButtonPopupNo]);
- }
-
- private void Back()
- {
- Data.ScreenMain.FadeToNameSelection = true;
- Data.ScreenMain.FadeToSongSelection = false;
- _PartyMode.DataFromScreen(ThemeName, Data);
- }
-
- private void UpdateNextPlayerPositions()
- {
- 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++)
- {
- //static
- NextPlayerStatics[i].Rect.X = x;
- NextPlayerStatics[i].Rect.Y = static_y;
- NextPlayerStatics[i].Visible = true;
- //text
- NextPlayerTexts[i].X = x + Statics[StaticNextPlayer].Rect.W / 2;
- NextPlayerTexts[i].Y = text_y;
- NextPlayerTexts[i].Visible = true;
-
- x += Statics[StaticNextPlayer].Rect.W + 15;
- }
- for (int i = GameState.NumPlayerAtOnce; i < _PartyMode.GetMaxPlayer(); i++)
- {
- NextPlayerStatics[i].Visible = false;
- NextPlayerTexts[i].Visible = false;
- }
- }
-
- private void UpdateNextPlayerContents()
- {
- if (GameState.CurrentRoundNr <= GameState.Combs.Count)
- {
- 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);
- }
- }
- else
- {
- Texts[TextNextPlayerMessage].Visible = false;
- for (int i = 0; i < GameState.NumPlayerAtOnce; i++)
- {
- NextPlayerStatics[i].Visible = false;
- NextPlayerTexts[i].Visible = false;
- }
- }
- }
-
- private void CreateRoundsTable()
- {
- //Create lists
- RoundsTable = new List();
- for (int i = 0; i < 5; i++)
- {
- RoundsTableRow rtr = new RoundsTableRow();
- rtr.TextPlayer = new List();
- rtr.TextScores = new List();
- RoundsTable.Add(rtr);
- }
- //Create statics and texts for rounds
- for (int round = 0; round < RoundsTable.Count; round++)
- {
- //Round-number
- CText text = GetNewText(Texts[TextRoundNumber]);
- AddText(text);
- RoundsTable[round].Number = text;
- for (int row = 0; row < 2; row++)
- {
- for (int column = 0; column < 3; column++)
- {
- //Player
- text = GetNewText(Texts[TextRoundPlayer]);
- AddText(text);
- RoundsTable[round].TextPlayer.Add(text);
- //Score
- text = GetNewText(Texts[TextRoundScore]);
- AddText(text);
- RoundsTable[round].TextScores.Add(text);
- }
- }
- }
- }
-
- private void BuildRoundsTable()
- {
- RoundsTableScrollArea = new SRectF();
-
- int NumPlayerInOneRow = 3;
- if (GameState.NumPlayerAtOnce <= NumPlayerInOneRow)
- NumRoundsVisible = 5;
- else
- NumRoundsVisible = 3;
-
- if (NumRoundsVisible > GameState.Combs.Count)
- NumRoundsVisible = GameState.Combs.Count;
-
- float x = Texts[TextRoundNumber].X;
- float y = Texts[TextRoundNumber].Y;
-
- RoundsTableScrollArea.X = x;
- RoundsTableScrollArea.Y = y;
- RoundsTableScrollArea.W = CBase.Settings.GetRenderW() - Texts[TextRoundNumber].X - 20;
-
- float delta = Texts[TextRoundNumber].Height;
-
- //Update statics and texts for rounds
- for (int round = 0; round < RoundsTable.Count; round++)
- {
- //Round-number
- RoundsTable[round].Number.X = x;
- RoundsTable[round].Number.Y = y;
- int NumInnerRows = (int)Math.Ceiling(GameState.NumPlayerAtOnce / ((double)NumPlayerInOneRow));
- for (int row = 0; row < NumInnerRows; row++)
- {
- int num = (row + 1) * NumPlayerInOneRow;
- int NumPlayerInThisRow = NumPlayerInOneRow;
- if (num > GameState.NumPlayerAtOnce)
- {
- num = GameState.NumPlayerAtOnce;
- NumPlayerInThisRow = GameState.NumPlayerAtOnce - (row * NumPlayerInOneRow);
- }
- for (int column = row * NumPlayerInOneRow; column < num; column++)
- {
- //Player
- 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;
- //Score
- RoundsTable[round].TextScores[column] = RoundsTable[round].TextScores[column];
- RoundsTable[round].TextScores[column].X = _x;
- RoundsTable[round].TextScores[column].Y = y + delta;
- RoundsTable[round].TextScores[column].MaxWidth = maxw;
- }
- y = y + delta + delta;
- }
- y = y + delta / 2;
- }
- RoundsTableScrollArea.H = y - RoundsTableScrollArea.Y;
- }
-
- private void UpdateRoundsTable()
- {
- SProfile[] profile = CBase.Profiles.GetProfiles();
- for (int i = 0; i < RoundsTable.Count; i++)
- {
- for (int p = 0; p < RoundsTable[i].TextPlayer.Count; p++)
- {
- if (GameState.Combs.Count > i + RoundsTableOffset && GameState.Combs[i + RoundsTableOffset].Player.Count > p)
- {
- RoundsTable[i].Number.Visible = true;
- RoundsTable[i].TextPlayer[p].Visible = true;
- RoundsTable[i].TextScores[p].Visible = true;
- RoundsTable[i].Number.Text = (i + 1 + RoundsTableOffset).ToString() + ")";
- int pID = GameState.ProfileIDs[GameState.Combs[i + RoundsTableOffset].Player[p]];
- RoundsTable[i].TextPlayer[p].Text = profile[pID].PlayerName;
- if ((GameState.CurrentRoundNr - 1) > i + RoundsTableOffset)
- RoundsTable[i].TextScores[p].Text = GameState.Results[i + RoundsTableOffset, p].ToString();
- else
- RoundsTable[i].TextScores[p].Text = "";
- }
- else
- {
- RoundsTable[i].TextPlayer[p].Visible = false;
- RoundsTable[i].TextScores[p].Visible = false;
- }
- }
- if (GameState.Combs.Count < i + RoundsTableOffset || i + 1 > NumRoundsVisible)
- {
- RoundsTable[i].Number.Visible = false;
- for (int p = 0; p < RoundsTable[i].TextPlayer.Count; p++)
- {
- RoundsTable[i].TextPlayer[p].Visible = false;
- RoundsTable[i].TextScores[p].Visible = false;
- }
- }
- }
-
- Buttons[ButtonRoundsScrollUp].Visible = RoundsTableOffset > 0;
- Buttons[ButtonRoundsScrollDown].Visible = GameState.Combs.Count - NumRoundsVisible - RoundsTableOffset > 0;
- }
-
- private void BuildPlayerTable()
- {
- PlayerTableScrollArea = new SRectF();
- PlayerTableScrollArea.X = Texts[TextPosition].X;
- PlayerTableScrollArea.Y = Texts[TextPosition].Y;
- PlayerTableScrollArea.W = Texts[TextGamePoints].X - Texts[TextPosition].X;
-
- PlayerTable = new List();
- float delta = Texts[TextPosition].Height * 1.2f;
-
- float h = 0;
-
- for (int i = 0; i < 10; i++)
- {
- TableRow row = new TableRow();
-
- 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);
- row.Rounds.Y += delta * (i + 1);
- row.Won.Y += delta * (i + 1);
- row.SingPoints.Y += delta * (i + 1);
- row.GamePoints.Y += delta * (i + 1);
-
- row.Pos.Text = (i + 1).ToString() + ".";
-
- row.Pos.Visible = false;
- row.Name.Visible = false;
- row.Rounds.Visible = false;
- row.Won.Visible = false;
- row.SingPoints.Visible = false;
- row.GamePoints.Visible = false;
-
- AddText(row.Pos);
- AddText(row.Name);
- AddText(row.Rounds);
- AddText(row.Won);
- AddText(row.SingPoints);
- AddText(row.GamePoints);
-
- PlayerTable.Add(row);
-
- h = delta * (i + 1);
- }
- PlayerTableScrollArea.H = h + delta;
- }
-
- private void UpdatePlayerTable()
- {
- SProfile[] profiles = CBase.Profiles.GetProfiles();
-
- for (int i = 0; i < PlayerTable.Count; i++)
- {
- TableRow row = PlayerTable[i];
-
- if (i + PlayerTableOffset < GameState.ResultTable.Count)
- {
- row.Pos.Visible = true;
- row.Name.Visible = true;
- row.Rounds.Visible = true;
- row.Won.Visible = true;
- row.SingPoints.Visible = true;
- 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();
- }
- else
- {
- row.Pos.Visible = false;
- row.Name.Visible = false;
- row.Rounds.Visible = false;
- row.Won.Visible = false;
- row.SingPoints.Visible = false;
- row.GamePoints.Visible = false;
- }
- }
-
- Buttons[ButtonPlayerScrollUp].Visible = PlayerTableOffset > 0;
- Buttons[ButtonPlayerScrollDown].Visible = GameState.ProfileIDs.Count - NumPlayerVisible - PlayerTableOffset > 0;
- }
-
- private void ScrollPlayerTable(int Offset)
- {
- if (GameState.ProfileIDs.Count <= NumPlayerVisible)
- PlayerTableOffset = 0;
- else if (Offset < 0 && PlayerTableOffset + Offset >= 0)
- PlayerTableOffset += Offset;
- else if (Offset < 0 && PlayerTableOffset + Offset < 0)
- PlayerTableOffset = 0;
- else if (Offset > 0 && PlayerTableOffset + Offset <= GameState.ProfileIDs.Count - NumPlayerVisible)
- PlayerTableOffset += Offset;
- else if (Offset > 0 && PlayerTableOffset + Offset > GameState.ProfileIDs.Count - NumPlayerVisible)
- PlayerTableOffset = GameState.ProfileIDs.Count - NumPlayerVisible;
-
- UpdatePlayerTable();
- }
-
- private void ScrollRoundsTable(int Offset)
- {
- if (GameState.Combs.Count <= NumRoundsVisible)
- RoundsTableOffset = 0;
- else if (Offset < 0 && RoundsTableOffset + Offset >= 0)
- RoundsTableOffset += Offset;
- else if (Offset < 0 && RoundsTableOffset + Offset < 0)
- RoundsTableOffset = 0;
- else if (Offset > 0 && RoundsTableOffset + Offset <= GameState.Combs.Count - NumRoundsVisible)
- RoundsTableOffset += Offset;
- else if (Offset > 0 && RoundsTableOffset + Offset > GameState.Combs.Count - NumRoundsVisible)
- RoundsTableOffset = GameState.Combs.Count - NumRoundsVisible;
-
- UpdateRoundsTable();
- }
-
- private string GetPlayerWinString()
- {
- string s = "";
- SProfile[] profiles = CBase.Profiles.GetProfiles();
-
- for (int i = 0; i < GameState.ResultTable.Count; i++)
- {
- if (GameState.ResultTable[i].Position == 1)
- {
- if (i > 0)
- s += ", ";
- s += profiles[GameState.ResultTable[i].PlayerID].PlayerName;
- }
- else
- break;
- }
-
- return s;
- }
- }
-}
\ No newline at end of file
diff --git a/PartyModes/PartyModeChallenge/PartyScreenChallengeNames.cs b/PartyModes/PartyModeChallenge/PartyScreenChallengeNames.cs
deleted file mode 100644
index 60811c80..00000000
--- a/PartyModes/PartyModeChallenge/PartyScreenChallengeNames.cs
+++ /dev/null
@@ -1,504 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Windows.Forms;
-using VocaluxeLib.Menu;
-
-namespace VocaluxeLib.PartyModes.Challenge
-{
- public class PartyScreenChallengeNames : CMenuParty
- {
- // Version number for theme files. Increment it, if you've changed something on the theme files!
- protected override int _ScreenVersion
- {
- get { return 1; }
- }
-
- private const string ButtonNext = "ButtonNext";
- private const string ButtonBack = "ButtonBack";
- private const string ButtonPlayerDestination = "ButtonPlayerDestination";
- private const string ButtonPlayerChoose = "ButtonPlayerChoose";
-
- private List PlayerChooseButtons;
- private List PlayerDestinationButtons;
- //PlayerDestinationButtons-Option
- private const int PlayerDestinationButtonsNumH = 3;
- private const int PlayerDestinationButtonsNumW = 4;
- private const int PlayerDestinationButtonsFirstX = 900;
- private const int PlayerDestinationButtonsFirstY = 105;
- private const int PlayerDestinationButtonsSpaceH = 15;
- private const int PlayerDestinationButtonsSpaceW = 25;
- //PlayerChooseButtons-Option
- private List PlayerChooseButtonsVisibleProfiles;
- private const int PlayerChooseButtonsNumH = 7;
- private const int PlayerChooseButtonsNumW = 4;
- private const int PlayerChooseButtonsFirstX = 52;
- private const int PlayerChooseButtonsFirstY = 105;
- private const int PlayerChooseButtonsSpaceH = 15;
- private const int PlayerChooseButtonsSpaceW = 25;
- private int PlayerChooseButtonsOffset = 0;
-
- private CStatic chooseAvatarStatic;
- private bool SelectingMouseActive;
- private int OldMouseX;
- private int OldMouseY;
- private int SelectedPlayerNr = -1;
- private bool ButtonsAdded;
-
- private int NumPlayer = 4;
-
- private DataFromScreen Data;
-
- private class CPlayerChooseButton
- {
- public CButton Button;
- public int ProfileID;
- }
-
- public override void Init()
- {
- base.Init();
-
- chooseAvatarStatic = GetNewStatic();
- chooseAvatarStatic.Visible = false;
-
- PlayerChooseButtonsVisibleProfiles = new List();
-
- Data.ScreenNames.ProfileIDs = new List();
-
- List buttons = new List();
- _ThemeButtons = new string[] {ButtonBack, ButtonNext, ButtonPlayerDestination, ButtonPlayerChoose};
-
- Data = new DataFromScreen();
- FromScreenNames names = new FromScreenNames();
- names.FadeToConfig = false;
- names.FadeToMain = false;
- names.ProfileIDs = new List();
- Data.ScreenNames = names;
- }
-
- public override void DataToScreen(object ReceivedData)
- {
- DataToScreenNames config = new DataToScreenNames();
-
- try
- {
- config = (DataToScreenNames)ReceivedData;
- Data.ScreenNames.ProfileIDs = config.ProfileIDs;
- if (Data.ScreenNames.ProfileIDs == null)
- Data.ScreenNames.ProfileIDs = new List();
-
- 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);
- }
- }
-
- public override bool HandleInput(KeyEvent keyEvent)
- {
- base.HandleInput(keyEvent);
-
- if (keyEvent.KeyPressed) {}
- else
- {
- switch (keyEvent.Key)
- {
- case Keys.Back:
- case Keys.Escape:
- Back();
- break;
-
- case Keys.Enter:
- if (Buttons[ButtonBack].Selected)
- Back();
-
- if (Buttons[ButtonNext].Selected)
- Next();
-
- if (!OnAdd())
- OnRemove();
- break;
-
- case Keys.Delete:
- OnRemove();
- break;
- }
- }
- return true;
- }
-
- public override bool HandleMouse(MouseEvent mouseEvent)
- {
- base.HandleMouse(mouseEvent);
-
- /*
- //Check if LeftButton is hold and Select-Mode inactive
- if (MouseEvent.LBH && !SelectingMouseActive)
- {
- //Save mouse-coords
- 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)
- {
- SelectedPlayerNr = PlayerChooseButtons[i].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.Z = -100;
- chooseAvatarStatic.Color = new SColorF(1, 1, 1, 1);
- chooseAvatarStatic.Texture = CBase.Profiles.GetProfiles()[SelectedPlayerNr].Avatar.Texture;
- }
- }
- }
- }*/
-
- //Check if LeftButton is hold and Select-Mode active
- 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;
- }
- // LeftButton isn't hold anymore, but Selec-Mode is still active -> "Drop" of Avatar
- else if (SelectingMouseActive)
- {
- //Check if really a player was selected
- if (SelectedPlayerNr != -1)
- {
- //Foreach Drop-Area
- for (int i = 0; i < PlayerDestinationButtons.Count; i++)
- {
- //Check first, if area is "active"
- if (PlayerDestinationButtons[i].Visible)
- {
- //Check if Mouse is in area
- if (CHelper.IsInBounds(PlayerDestinationButtons[i].Rect, mouseEvent))
- {
- int added = -1;
- //Add Player-ID to list.
- if (Data.ScreenNames.ProfileIDs.Count < (i + 1))
- {
- Data.ScreenNames.ProfileIDs.Add(SelectedPlayerNr);
- added = Data.ScreenNames.ProfileIDs.Count - 1;
- }
- else if (Data.ScreenNames.ProfileIDs.Count >= (i + 1))
- {
- Data.ScreenNames.ProfileIDs[i] = SelectedPlayerNr;
- added = i;
- }
- UpdateButtonNext();
- //Update texture and name
- PlayerDestinationButtons[added].Color = new SColorF(1, 1, 1, 0.6f);
- PlayerDestinationButtons[added].SColor = new SColorF(1, 1, 1, 1);
- PlayerDestinationButtons[added].Texture = chooseAvatarStatic.Texture;
- PlayerDestinationButtons[added].STexture = chooseAvatarStatic.Texture;
- PlayerDestinationButtons[added].Text.Text = CBase.Profiles.GetProfiles()[SelectedPlayerNr].PlayerName;
- //Update Tiles-List
- UpdateButtonPlayerChoose();
- }
- }
- }
- SelectedPlayerNr = -1;
- }
- //Reset variables
- SelectingMouseActive = false;
- chooseAvatarStatic.Visible = false;
- }
-
- if (mouseEvent.LB && IsMouseOver(mouseEvent))
- {
- if (Buttons[ButtonBack].Selected)
- Back();
-
- if (Buttons[ButtonNext].Selected)
- Next();
-
- if (!OnAdd())
- OnRemove();
- }
-
- if (mouseEvent.RB)
- Back();
-
- return true;
- }
-
- public override void OnShow()
- {
- base.OnShow();
-
- if (!ButtonsAdded)
- {
- AddButtonPlayerDestination();
- AddButtonPlayerChoose();
- ButtonsAdded = true;
- }
-
- UpdateButtonPlayerDestination();
- UpdateButtonPlayerChoose();
-
- UpdateButtonNext();
- }
-
- public override bool UpdateGame()
- {
- return true;
- }
-
- public override bool Draw()
- {
- base.Draw();
- if (chooseAvatarStatic.Visible)
- chooseAvatarStatic.Draw();
- return true;
- }
-
- private void AddButtonPlayerDestination()
- {
- Buttons[ButtonPlayerDestination].Visible = false;
- PlayerDestinationButtons = new List();
- int row = 0;
- int column = 0;
- for (int i = 1; i <= _PartyMode.GetMaxPlayer(); i++)
- {
- 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);
- column++;
- if (column >= PlayerDestinationButtonsNumH)
- {
- row++;
- column = 0;
- }
- b.Visible = true;
- b.Enabled = false;
- AddButton(b);
- }
- }
-
- private void AddButtonPlayerChoose()
- {
- Buttons[ButtonPlayerChoose].Visible = false;
- PlayerChooseButtons = new List();
- int row = 0;
- int column = 0;
- for (int i = 1; i <= PlayerChooseButtonsNumH * PlayerChooseButtonsNumW; i++)
- {
- 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();
- pcb.Button = b;
- pcb.ProfileID = -1;
- PlayerChooseButtons.Add(pcb);
- column++;
- if (column >= PlayerChooseButtonsNumH)
- {
- row++;
- column = 0;
- }
- b.Visible = true;
- b.Enabled = false;
- AddButton(b);
- }
- }
-
- private void UpdateButtonPlayerChoose()
- {
- UpdateVisibleProfiles();
- if ((PlayerChooseButtonsNumW * PlayerChooseButtonsNumH) * (PlayerChooseButtonsOffset + 1) - PlayerChooseButtonsVisibleProfiles.Count >=
- (PlayerChooseButtonsNumW * PlayerChooseButtonsNumH) * PlayerChooseButtonsOffset)
- UpdateButtonPlayerChoose(PlayerChooseButtonsOffset - 1);
- else
- UpdateButtonPlayerChoose(PlayerChooseButtonsOffset);
- }
-
- private void UpdateButtonPlayerChoose(int Offset)
- {
- int NumButtonPlayerChoose = PlayerChooseButtonsNumW * PlayerChooseButtonsNumH;
- if (Offset < 0)
- Offset = 0;
-
- if (NumButtonPlayerChoose * (Offset + 1) - PlayerChooseButtonsVisibleProfiles.Count <= NumButtonPlayerChoose)
- {
- for (int i = 0; i < NumButtonPlayerChoose; i++)
- {
- if ((i + Offset * NumButtonPlayerChoose) < PlayerChooseButtonsVisibleProfiles.Count)
- {
- PlayerChooseButtons[i].ProfileID = PlayerChooseButtonsVisibleProfiles[i + Offset * NumButtonPlayerChoose];
- PlayerChooseButtons[i].Button.Text.Text = CBase.Profiles.GetProfiles()[PlayerChooseButtonsVisibleProfiles[i + Offset * NumButtonPlayerChoose]].PlayerName;
- PlayerChooseButtons[i].Button.Texture = CBase.Profiles.GetProfiles()[PlayerChooseButtonsVisibleProfiles[i + Offset * NumButtonPlayerChoose]].Avatar.Texture;
- PlayerChooseButtons[i].Button.STexture = CBase.Profiles.GetProfiles()[PlayerChooseButtonsVisibleProfiles[i + Offset * NumButtonPlayerChoose]].Avatar.Texture;
- PlayerChooseButtons[i].Button.Color = new SColorF(1, 1, 1, 0.6f);
- PlayerChooseButtons[i].Button.SColor = new SColorF(1, 1, 1, 1);
- PlayerChooseButtons[i].Button.Enabled = true;
- }
- else
- {
- PlayerChooseButtons[i].ProfileID = -1;
- PlayerChooseButtons[i].Button.Text.Text = String.Empty;
- 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;
- }
- }
- }
- }
-
- private void UpdateVisibleProfiles()
- {
- PlayerChooseButtonsVisibleProfiles.Clear();
- for (int i = 0; i < CBase.Profiles.GetProfiles().Length; i++)
- {
- bool visible = false;
- //Show profile only if active
- if (CBase.Profiles.GetProfiles()[i].Active == EOffOn.TR_CONFIG_ON)
- {
- visible = true;
-
- for (int p = 0; p < Data.ScreenNames.ProfileIDs.Count; p++)
- {
- //Don't show profile if is selected
- if (Data.ScreenNames.ProfileIDs[p] == i)
- {
- visible = false;
- break;
- }
- }
- }
- if (visible)
- PlayerChooseButtonsVisibleProfiles.Add(i);
- }
- }
-
- private void UpdateButtonPlayerDestination()
- {
- for (int i = 0; i < PlayerDestinationButtons.Count; i++)
- {
- if (NumPlayer > i)
- {
- PlayerDestinationButtons[i].Visible = true;
- PlayerDestinationButtons[i].Enabled = true;
- }
- else
- {
- PlayerDestinationButtons[i].Visible = false;
- PlayerDestinationButtons[i].Enabled = false;
- }
- }
- for (int i = 0; i < NumPlayer; i++)
- {
- if (i < Data.ScreenNames.ProfileIDs.Count)
- {
- if (Data.ScreenNames.ProfileIDs[i] != -1)
- {
- PlayerDestinationButtons[i].Color = new SColorF(1, 1, 1, 0.6f);
- PlayerDestinationButtons[i].SColor = new SColorF(1, 1, 1, 1);
- PlayerDestinationButtons[i].Texture = CBase.Profiles.GetProfiles()[Data.ScreenNames.ProfileIDs[i]].Avatar.Texture;
- PlayerDestinationButtons[i].STexture = CBase.Profiles.GetProfiles()[Data.ScreenNames.ProfileIDs[i]].Avatar.Texture;
- PlayerDestinationButtons[i].Text.Text = CBase.Profiles.GetProfiles()[Data.ScreenNames.ProfileIDs[i]].PlayerName;
- PlayerDestinationButtons[i].Enabled = true;
- }
- }
- else
- {
- 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;
- }
- }
- }
-
- private void UpdateButtonNext()
- {
- if (Data.ScreenNames.ProfileIDs.Count == NumPlayer)
- {
- Buttons[ButtonNext].Visible = true;
- SetInteractionToButton(Buttons[ButtonNext]);
- }
- else
- Buttons[ButtonNext].Visible = false;
- }
-
- private bool OnAdd()
- {
- for (int i = 0; i < PlayerChooseButtons.Count; i++)
- {
- if (PlayerChooseButtons[i].Button.Selected && PlayerChooseButtons[i].ProfileID != -1)
- {
- if (Data.ScreenNames.ProfileIDs.Count < NumPlayer)
- {
- Data.ScreenNames.ProfileIDs.Add(PlayerChooseButtons[i].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].SColor = new SColorF(1, 1, 1, 1);
- PlayerDestinationButtons[added].Texture = CBase.Profiles.GetProfiles()[PlayerChooseButtons[i].ProfileID].Avatar.Texture;
- PlayerDestinationButtons[added].STexture = CBase.Profiles.GetProfiles()[PlayerChooseButtons[i].ProfileID].Avatar.Texture;
- PlayerDestinationButtons[added].Text.Text = CBase.Profiles.GetProfiles()[PlayerChooseButtons[i].ProfileID].PlayerName;
- PlayerDestinationButtons[added].Enabled = true;
- //Update Tiles-List
- UpdateButtonPlayerChoose();
- CheckInteraction();
- return true;
- }
- }
- }
- return false;
- }
-
- private bool OnRemove()
- {
- for (int i = 0; i < PlayerDestinationButtons.Count; i++)
- {
- if (PlayerDestinationButtons[i].Selected)
- {
- if ((i + 1) <= Data.ScreenNames.ProfileIDs.Count)
- {
- Data.ScreenNames.ProfileIDs.RemoveAt(i);
- UpdateButtonNext();
- UpdateButtonPlayerDestination();
- UpdateButtonPlayerChoose();
- CheckInteraction();
- return true;
- }
- }
- }
- return false;
- }
-
- private void Back()
- {
- Data.ScreenNames.FadeToConfig = true;
- Data.ScreenNames.FadeToMain = false;
- _PartyMode.DataFromScreen(ThemeName, Data);
- }
-
- private void Next()
- {
- Data.ScreenNames.FadeToConfig = false;
- Data.ScreenNames.FadeToMain = true;
- _PartyMode.DataFromScreen(ThemeName, Data);
- }
- }
-}
\ No newline at end of file
diff --git a/PartyModes/PartyModeChallengeMedley/ChallengeRounds.cs b/PartyModes/PartyModeChallengeMedley/CChallengeRounds.cs
similarity index 58%
rename from PartyModes/PartyModeChallengeMedley/ChallengeRounds.cs
rename to PartyModes/PartyModeChallengeMedley/CChallengeRounds.cs
index eef9c250..37ff59f5 100644
--- a/PartyModes/PartyModeChallengeMedley/ChallengeRounds.cs
+++ b/PartyModes/PartyModeChallengeMedley/CChallengeRounds.cs
@@ -3,58 +3,58 @@ using System.Collections.Generic;
namespace VocaluxeLib.PartyModes.ChallengeMedley
{
- public class ChallengeRounds
+ public class CChallengeRounds
{
private readonly Random _Rand;
private readonly int _NumPlayer;
- public List Rounds;
+ public List Rounds;
- public ChallengeRounds(int NumRounds, int NumPlayer, int NumPlayerAtOnce)
+ public CChallengeRounds(int numRounds, int numPlayer, int numPlayerAtOnce)
{
- Rounds = new List();
+ Rounds = new List();
_Rand = new Random(DateTime.Now.Millisecond);
- if (NumPlayerAtOnce < 1 || NumRounds < 1 || NumPlayer == 0)
+ if (numPlayerAtOnce < 1 || numRounds < 1 || numPlayer == 0)
_NumPlayer = 0;
else
{
- _NumPlayer = NumPlayer;
- BuildRounds(NumRounds, NumPlayerAtOnce, _Rand);
+ _NumPlayer = numPlayer;
+ _BuildRounds(numRounds, numPlayerAtOnce, _Rand);
}
}
- public Combination GetRound(int RoundNr)
+ public CCombination GetRound(int roundNr)
{
- if (RoundNr >= Rounds.Count || _NumPlayer == 0 || Rounds.Count == 0)
+ if (roundNr >= Rounds.Count || _NumPlayer == 0 || Rounds.Count == 0)
return null;
- return Rounds[RoundNr];
+ return Rounds[roundNr];
}
- private void BuildRounds(int NumRounds, int NumPlayerAtOnce, Random Rand)
+ private void _BuildRounds(int numRounds, int numPlayerAtOnce, Random rand)
{
- Combinations Combinations = new Combinations(_NumPlayer, NumPlayerAtOnce, Rand);
- Rounds.Add(Combinations.GetNextCombination(null));
+ CCombinations combinations = new CCombinations(_NumPlayer, numPlayerAtOnce, rand);
+ Rounds.Add(combinations.GetNextCombination(null));
- for (int i = 1; i < NumRounds; i++)
- Rounds.Add(Combinations.GetNextCombination(GetPlayerDemand(i)));
+ for (int i = 1; i < numRounds; i++)
+ Rounds.Add(combinations.GetNextCombination(_GetPlayerDemand(i)));
}
- private List GetPlayerDemand(int RoundIndex)
+ private List _GetPlayerDemand(int roundIndex)
{
- List NumPlayed = new List(_NumPlayer);
+ List numPlayed = new List(_NumPlayer);
for (int i = 0; i < _NumPlayer; i++)
- NumPlayed.Add(0);
+ numPlayed.Add(0);
- for (int i = 0; i < RoundIndex; i++)
+ for (int i = 0; i < roundIndex; i++)
{
- foreach (int PlayerIndex in Rounds[i].Player)
- NumPlayed[PlayerIndex]++;
+ foreach (int playerIndex in Rounds[i].Player)
+ numPlayed[playerIndex]++;
}
int max = 0;
- foreach (int p in NumPlayed)
+ foreach (int p in numPlayed)
{
if (p > max)
max = p;
@@ -65,20 +65,20 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley
List other = new List();
List last = new List();
- for (int i = 0; i < NumPlayed.Count; i++)
+ for (int i = 0; i < numPlayed.Count; i++)
{
- if (RoundIndex == 0 || NumPlayed[i] < max)
+ if (roundIndex == 0 || numPlayed[i] < max)
{
- if (RoundIndex == 0 || RoundIndex > 0 && NumPlayed[i] < max && !Rounds[RoundIndex - 1].IsAvailable(i))
+ if (roundIndex == 0 || roundIndex > 0 && numPlayed[i] < max && !Rounds[roundIndex - 1].IsAvailable(i))
result.Add(i);
- else if (NumPlayed[i] < max)
+ else if (numPlayed[i] < max)
other.Add(i);
}
else
{
- if (RoundIndex > 0)
+ if (roundIndex > 0)
{
- if (!Rounds[RoundIndex - 1].IsAvailable(i))
+ if (!Rounds[roundIndex - 1].IsAvailable(i))
other.Add(i);
else
last.Add(i);
@@ -116,48 +116,48 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley
}
}
- class Combinations
+ class CCombinations
{
- private readonly List _Combs;
+ private readonly List _Combs;
private readonly Random _Rand;
private readonly int _NumPlayer;
private readonly int _NumMics;
- public Combinations(int NumPlayer, int NumMics, Random Rand)
+ public CCombinations(int numPlayer, int numMics, Random rand)
{
- _Combs = new List();
- _NumMics = NumMics;
- _NumPlayer = NumPlayer;
- _Rand = Rand;
+ _Combs = new List();
+ _NumMics = numMics;
+ _NumPlayer = numPlayer;
+ _Rand = rand;
}
- public Combination GetNextCombination(List PlayerNrDemand)
+ public CCombination GetNextCombination(List playerNrDemand)
{
if (_Combs.Count == 0)
- Create();
+ _Create();
- Combination combs = new Combination();
+ CCombination combs = new CCombination();
if (_NumPlayer == _NumMics)
return _Combs[0];
//filter against PlayerNrDemand
- List combsFiltered = new List();
- if (PlayerNrDemand != null)
+ List combsFiltered = new List();
+ if (playerNrDemand != null)
{
for (int i = 0; i < _Combs.Count; i++)
{
- if (_Combs[i].IsAvailableAll(PlayerNrDemand))
+ if (_Combs[i].IsAvailableAll(playerNrDemand))
combsFiltered.Add(_Combs[i]);
}
}
//1st fallback
- if (PlayerNrDemand != null && combsFiltered.Count == 0)
+ if (playerNrDemand != null && combsFiltered.Count == 0)
{
for (int i = 0; i < _Combs.Count; i++)
{
- if (_Combs[i].IsAvailableSomeone(PlayerNrDemand))
+ if (_Combs[i].IsAvailableSomeone(playerNrDemand))
combsFiltered.Add(_Combs[i]);
}
}
@@ -171,7 +171,7 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley
int num = combsFiltered.Count;
int rand = _Rand.Next(num);
- Combination c = new Combination();
+ CCombination c = new CCombination();
for (int i = 0; i < combsFiltered[rand].Player.Count; i++)
c.Player.Add(combsFiltered[rand].Player[i]);
_Combs.Remove(combsFiltered[rand]);
@@ -179,7 +179,7 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley
return combsFiltered[rand];
}
- private void Create()
+ private void _Create()
{
_Combs.Clear();
@@ -187,7 +187,7 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley
for (int i = 1; i <= num; i++)
{
- Combination c = new Combination();
+ CCombination c = new CCombination();
for (int j = 0; j < _NumPlayer; j++)
{
@@ -201,37 +201,37 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley
}
}
- public class Combination
+ public class CCombination
{
public List Player;
- public Combination()
+ public CCombination()
{
Player = new List();
}
- public bool IsAvailable(int PlayerIndex)
+ public bool IsAvailable(int playerIndex)
{
foreach (int p in Player)
{
- if (p == PlayerIndex)
+ if (p == playerIndex)
return true;
}
return false;
}
- public bool IsAvailableAll(List PlayerIndices)
+ public bool IsAvailableAll(List playerIndices)
{
bool result = true;
- foreach (int p in PlayerIndices)
+ foreach (int p in playerIndices)
result &= IsAvailable(p);
return result;
}
- public bool IsAvailableSomeone(List PlayerIndices)
+ public bool IsAvailableSomeone(List playerIndices)
{
bool result = false;
- foreach (int p in PlayerIndices)
+ foreach (int p in playerIndices)
result |= IsAvailable(p);
return result;
}
diff --git a/PartyModes/PartyModeChallengeMedley/PartyModeChallengeMedley.cs b/PartyModes/PartyModeChallengeMedley/CPartyModeChallengeMedley.cs
similarity index 54%
rename from PartyModes/PartyModeChallengeMedley/PartyModeChallengeMedley.cs
rename to PartyModes/PartyModeChallengeMedley/CPartyModeChallengeMedley.cs
index 36e54e63..5bfb505e 100644
--- a/PartyModes/PartyModeChallengeMedley/PartyModeChallengeMedley.cs
+++ b/PartyModes/PartyModeChallengeMedley/CPartyModeChallengeMedley.cs
@@ -12,30 +12,30 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley
#region Communication
#region ToScreen
- public struct DataToScreenConfig
+ public struct SDataToScreenConfig
{
public int NumPlayer;
public int NumPlayerAtOnce;
public int NumRounds;
}
- public struct DataToScreenNames
+ public struct SDataToScreenNames
{
public int NumPlayer;
public List ProfileIDs;
}
- public struct DataToScreenMain
+ public struct SDataToScreenMain
{
public int CurrentRoundNr;
public int NumPlayerAtOnce;
- public List Combs;
+ public List Combs;
public int[,] Results;
- public List ResultTable;
+ public List ResultTable;
public List ProfileIDs;
}
- public class ResultTableRow : IComparable
+ public class CResultTableRow : IComparable
{
public int Position;
public int PlayerID;
@@ -47,9 +47,9 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley
public int CompareTo(object obj)
{
- if (obj is ResultTableRow)
+ if (obj is CResultTableRow)
{
- ResultTableRow row = (ResultTableRow)obj;
+ CResultTableRow row = (CResultTableRow)obj;
int res = row.NumGamePoints.CompareTo(NumGamePoints);
if (res == 0)
@@ -67,28 +67,28 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley
#endregion ToScreen
#region FromScreen
- public struct DataFromScreen
+ public struct SDataFromScreen
{
- public FromScreenConfig ScreenConfig;
- public FromScreenNames ScreenNames;
- public FromScreenMain ScreenMain;
+ public SFromScreenConfig ScreenConfig;
+ public SFromScreenNames ScreenNames;
+ public SFromScreenMain ScreenMain;
}
- public struct FromScreenConfig
+ public struct SFromScreenConfig
{
public int NumPlayer;
public int NumPlayerAtOnce;
public int NumRounds;
}
- public struct FromScreenNames
+ public struct SFromScreenNames
{
public bool FadeToConfig;
public bool FadeToMain;
public List ProfileIDs;
}
- public struct FromScreenMain
+ public struct SFromScreenMain
{
public bool FadeToSongSelection;
public bool FadeToNameSelection;
@@ -97,14 +97,14 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley
#endregion Communication
- public sealed class PartyModeChallengeMedley : CPartyMode
+ public sealed class CPartyModeChallengeMedley : CPartyMode
{
- private const int MaxPlayer = 12;
- private const int MinPlayer = 1;
- private const int MaxTeams = 0;
- private const int MinTeams = 0;
- private const int MaxNumRounds = 100;
- private const int NumSongs = 5;
+ private const int _MaxPlayer = 12;
+ private const int _MinPlayer = 1;
+ private const int _MaxTeams = 0;
+ private const int _MinTeams = 0;
+ private const int _MaxNumRounds = 100;
+ private const int _NumSongs = 5;
private enum EStage
{
@@ -115,15 +115,15 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley
Singing
}
- private struct Data
+ private struct SData
{
public int NumPlayer;
public int NumPlayerAtOnce;
public int NumRounds;
public List ProfileIDs;
- public ChallengeRounds Rounds;
- public List ResultTable;
+ public CChallengeRounds Rounds;
+ public List ResultTable;
public int[,] Results;
public int CurrentRoundNr;
@@ -131,7 +131,7 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley
public int[] CatSongIndices;
}
- private struct Stats
+ private struct SStats
{
public int ProfileID;
public int SingPoints;
@@ -139,14 +139,14 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley
public int Won;
}
- private DataToScreenConfig ToScreenConfig;
- private DataToScreenNames ToScreenNames;
- private DataToScreenMain ToScreenMain;
+ private SDataToScreenConfig _ToScreenConfig;
+ private SDataToScreenNames _ToScreenNames;
+ private SDataToScreenMain _ToScreenMain;
- private Data GameData;
+ private SData _GameData;
private EStage _Stage;
- public PartyModeChallengeMedley()
+ public CPartyModeChallengeMedley()
{
_ScreenSongOptions.Selection.RandomOnly = false;
_ScreenSongOptions.Selection.PartyMode = true;
@@ -160,18 +160,18 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley
_Stage = EStage.NotStarted;
- ToScreenConfig = new DataToScreenConfig();
- ToScreenNames = new DataToScreenNames();
- ToScreenMain = new DataToScreenMain();
+ _ToScreenConfig = new SDataToScreenConfig();
+ _ToScreenNames = new SDataToScreenNames();
+ _ToScreenMain = new SDataToScreenMain();
- GameData = new Data();
- GameData.NumPlayer = 4;
- GameData.NumPlayerAtOnce = 2;
- GameData.NumRounds = 2;
- GameData.CurrentRoundNr = 1;
- GameData.ProfileIDs = new List();
- GameData.CatSongIndices = null;
- GameData.Results = null;
+ _GameData = new SData();
+ _GameData.NumPlayer = 4;
+ _GameData.NumPlayerAtOnce = 2;
+ _GameData.NumRounds = 2;
+ _GameData.CurrentRoundNr = 1;
+ _GameData.ProfileIDs = new List();
+ _GameData.CatSongIndices = null;
+ _GameData.Results = null;
}
public override bool Init()
@@ -186,8 +186,8 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley
if (CBase.Config.GetTabs() == EOffOn.TR_CONFIG_ON && _ScreenSongOptions.Sorting.SongSorting != ESongSorting.TR_CONFIG_NONE)
_ScreenSongOptions.Sorting.Tabs = EOffOn.TR_CONFIG_ON;
- ToScreenMain.ResultTable = new List();
- GameData.ResultTable = new List();
+ _ToScreenMain.ResultTable = new List();
+ _GameData.ResultTable = new List();
CBase.Songs.SortSongs(ESongSorting.TR_CONFIG_NONE, EOffOn.TR_CONFIG_OFF, EOffOn.TR_CONFIG_OFF, String.Empty, EDuetOptions.NoDuets);
CBase.Songs.SetCategory(0);
@@ -195,38 +195,38 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley
return true;
}
- public override void DataFromScreen(string ScreenName, Object Data)
+ public override void DataFromScreen(string screenName, Object data)
{
- DataFromScreen data = new DataFromScreen();
- switch (ScreenName)
+ SDataFromScreen dataFrom = new SDataFromScreen();
+ switch (screenName)
{
case "PartyScreenChallengeMedleyConfig":
try
{
- data = (DataFromScreen)Data;
- GameData.NumPlayer = data.ScreenConfig.NumPlayer;
- GameData.NumPlayerAtOnce = data.ScreenConfig.NumPlayerAtOnce;
- GameData.NumRounds = data.ScreenConfig.NumRounds;
+ dataFrom = (SDataFromScreen)data;
+ _GameData.NumPlayer = dataFrom.ScreenConfig.NumPlayer;
+ _GameData.NumPlayerAtOnce = dataFrom.ScreenConfig.NumPlayerAtOnce;
+ _GameData.NumRounds = dataFrom.ScreenConfig.NumRounds;
_Stage = EStage.Config;
CBase.Graphics.FadeTo(EScreens.ScreenPartyDummy);
}
catch (Exception e)
{
- CBase.Log.LogError("Error in party mode challenge. Can't cast received data from screen " + ScreenName + ". " + e.Message);
+ CBase.Log.LogError("Error in party mode challenge. Can't cast received data from screen " + screenName + ". " + e.Message);
}
break;
case "PartyScreenChallengeMedleyNames":
try
{
- data = (DataFromScreen)Data;
- if (data.ScreenNames.FadeToConfig)
+ dataFrom = (SDataFromScreen)data;
+ if (dataFrom.ScreenNames.FadeToConfig)
_Stage = EStage.NotStarted;
else
{
- GameData.ProfileIDs = data.ScreenNames.ProfileIDs;
+ _GameData.ProfileIDs = dataFrom.ScreenNames.ProfileIDs;
_Stage = EStage.Names;
}
@@ -234,33 +234,33 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley
}
catch (Exception e)
{
- CBase.Log.LogError("Error in party mode challenge. Can't cast received data from screen " + ScreenName + ". " + e.Message);
+ CBase.Log.LogError("Error in party mode challenge. Can't cast received data from screen " + screenName + ". " + e.Message);
}
break;
case "PartyScreenChallengeMedleyMain":
try
{
- data = (DataFromScreen)Data;
- if (data.ScreenMain.FadeToSongSelection)
+ dataFrom = (SDataFromScreen)data;
+ if (dataFrom.ScreenMain.FadeToSongSelection)
_Stage = EStage.Singing;
- if (data.ScreenMain.FadeToNameSelection)
+ if (dataFrom.ScreenMain.FadeToNameSelection)
_Stage = EStage.Config;
}
catch (Exception e)
{
- CBase.Log.LogError("Error in party mode challenge. Can't cast received data from screen " + ScreenName + ". " + e.Message);
+ CBase.Log.LogError("Error in party mode challenge. Can't cast received data from screen " + screenName + ". " + e.Message);
}
if (_Stage == EStage.Singing)
- StartNextRound();
+ _StartNextRound();
if (_Stage == EStage.Config)
CBase.Graphics.FadeTo(EScreens.ScreenPartyDummy);
break;
default:
- CBase.Log.LogError("Error in party mode challenge. Wrong screen is sending: " + ScreenName);
+ CBase.Log.LogError("Error in party mode challenge. Wrong screen is sending: " + screenName);
break;
}
}
@@ -274,68 +274,68 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley
_ScreenSongOptions.Selection.RandomOnly = false;*/
}
- public override CMenuParty GetNextPartyScreen(out EScreens AlternativeScreen)
+ public override CMenuParty GetNextPartyScreen(out EScreens alternativeScreen)
{
- CMenuParty Screen = null;
- AlternativeScreen = EScreens.ScreenSong;
+ CMenuParty screen = null;
+ alternativeScreen = EScreens.ScreenSong;
switch (_Stage)
{
case EStage.NotStarted:
- _Screens.TryGetValue("PartyScreenChallengeMedleyConfig", out Screen);
- if (_Screens != null)
+ _Screens.TryGetValue("CPartyScreenChallengeMedleyConfig", out screen);
+ if (screen != null)
{
- ToScreenConfig.NumPlayer = GameData.NumPlayer;
- ToScreenConfig.NumPlayerAtOnce = GameData.NumPlayerAtOnce;
- ToScreenConfig.NumRounds = GameData.NumRounds;
- Screen.DataToScreen(ToScreenConfig);
+ _ToScreenConfig.NumPlayer = _GameData.NumPlayer;
+ _ToScreenConfig.NumPlayerAtOnce = _GameData.NumPlayerAtOnce;
+ _ToScreenConfig.NumRounds = _GameData.NumRounds;
+ screen.DataToScreen(_ToScreenConfig);
}
break;
case EStage.Config:
- _Screens.TryGetValue("PartyScreenChallengeMedleyNames", out Screen);
- if (_Screens != null)
+ _Screens.TryGetValue("CPartyScreenChallengeMedleyNames", out screen);
+ if (screen != null)
{
- ToScreenNames.NumPlayer = GameData.NumPlayer;
- ToScreenNames.ProfileIDs = GameData.ProfileIDs;
- Screen.DataToScreen(ToScreenNames);
+ _ToScreenNames.NumPlayer = _GameData.NumPlayer;
+ _ToScreenNames.ProfileIDs = _GameData.ProfileIDs;
+ screen.DataToScreen(_ToScreenNames);
}
break;
case EStage.Names:
- _Screens.TryGetValue("PartyScreenChallengeMedleyMain", out Screen);
- if (_Screens != null)
+ _Screens.TryGetValue("CPartyScreenChallengeMedleyMain", out screen);
+ if (screen != null)
{
CBase.Songs.ResetPartySongSung();
- ToScreenMain.ResultTable = new List();
- GameData.ResultTable = new List();
- GameData.Rounds = new ChallengeRounds(GameData.NumRounds, GameData.NumPlayer, GameData.NumPlayerAtOnce);
- GameData.CurrentRoundNr = 1;
- ToScreenMain.CurrentRoundNr = 1;
- ToScreenMain.NumPlayerAtOnce = GameData.NumPlayerAtOnce;
- ToScreenMain.Combs = GameData.Rounds.Rounds;
- ToScreenMain.ProfileIDs = GameData.ProfileIDs;
- UpdateScores();
- ToScreenMain.ResultTable = GameData.ResultTable;
- ToScreenMain.Results = GameData.Results;
- Screen.DataToScreen(ToScreenMain);
+ _ToScreenMain.ResultTable = new List();
+ _GameData.ResultTable = new List();
+ _GameData.Rounds = new CChallengeRounds(_GameData.NumRounds, _GameData.NumPlayer, _GameData.NumPlayerAtOnce);
+ _GameData.CurrentRoundNr = 1;
+ _ToScreenMain.CurrentRoundNr = 1;
+ _ToScreenMain.NumPlayerAtOnce = _GameData.NumPlayerAtOnce;
+ _ToScreenMain.Combs = _GameData.Rounds.Rounds;
+ _ToScreenMain.ProfileIDs = _GameData.ProfileIDs;
+ _UpdateScores();
+ _ToScreenMain.ResultTable = _GameData.ResultTable;
+ _ToScreenMain.Results = _GameData.Results;
+ screen.DataToScreen(_ToScreenMain);
}
break;
case EStage.Main:
//nothing to do
break;
case EStage.Singing:
- _Screens.TryGetValue("PartyScreenChallengeMedleyMain", out Screen);
- if (_Screens != null)
+ _Screens.TryGetValue("CPartyScreenChallengeMedleyMain", out screen);
+ if (screen != null)
{
- UpdateScores();
- ToScreenMain.CurrentRoundNr = GameData.CurrentRoundNr;
- ToScreenMain.Combs = GameData.Rounds.Rounds;
- ToScreenMain.Results = GameData.Results;
- Screen.DataToScreen(ToScreenMain);
+ _UpdateScores();
+ _ToScreenMain.CurrentRoundNr = _GameData.CurrentRoundNr;
+ _ToScreenMain.Combs = _GameData.Rounds.Rounds;
+ _ToScreenMain.Results = _GameData.Results;
+ screen.DataToScreen(_ToScreenMain);
}
break;
}
- return Screen;
+ return screen;
}
public override EScreens GetStartScreen()
@@ -348,7 +348,7 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley
return EScreens.ScreenPartyDummy;
}
- public override ScreenSongOptions GetScreenSongOptions()
+ public override SScreenSongOptions GetScreenSongOptions()
{
_ScreenSongOptions.Sorting.SongSorting = CBase.Config.GetSongSorting();
_ScreenSongOptions.Sorting.Tabs = CBase.Config.GetTabs();
@@ -357,130 +357,130 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley
return _ScreenSongOptions;
}
- public override void OnSongChange(int SongIndex, ref ScreenSongOptions ScreenSongOptions)
+ public override void OnSongChange(int songIndex, ref SScreenSongOptions screenSongOptions)
{
if (_ScreenSongOptions.Selection.SongIndex != -1)
_ScreenSongOptions.Selection.SongIndex = -1;
- if (_ScreenSongOptions.Selection.SelectNextRandomSong && SongIndex != -1)
+ if (_ScreenSongOptions.Selection.SelectNextRandomSong && songIndex != -1)
{
_ScreenSongOptions.Selection.SelectNextRandomSong = false;
- CreateCatSongIndices();
+ _CreateCatSongIndices();
- if (GameData.CatSongIndices != null)
+ if (_GameData.CatSongIndices != null)
{
- if (GameData.CatSongIndices[CBase.Songs.GetCurrentCategoryIndex()] == -1)
- GameData.CatSongIndices[CBase.Songs.GetCurrentCategoryIndex()] = SongIndex;
+ if (_GameData.CatSongIndices[CBase.Songs.GetCurrentCategoryIndex()] == -1)
+ _GameData.CatSongIndices[CBase.Songs.GetCurrentCategoryIndex()] = songIndex;
}
}
- ScreenSongOptions = _ScreenSongOptions;
+ screenSongOptions = _ScreenSongOptions;
}
- public override void OnCategoryChange(int CategoryIndex, ref ScreenSongOptions ScreenSongOptions)
+ public override void OnCategoryChange(int categoryIndex, ref SScreenSongOptions screenSongOptions)
{
- if (GameData.CatSongIndices != null && CategoryIndex != -1)
+ if (_GameData.CatSongIndices != null && categoryIndex != -1)
{
- if (GameData.CatSongIndices[CategoryIndex] == -1)
+ if (_GameData.CatSongIndices[categoryIndex] == -1)
_ScreenSongOptions.Selection.SelectNextRandomSong = true;
else
- _ScreenSongOptions.Selection.SongIndex = GameData.CatSongIndices[CategoryIndex];
+ _ScreenSongOptions.Selection.SongIndex = _GameData.CatSongIndices[categoryIndex];
}
- if (GameData.CatSongIndices == null && CategoryIndex != -1)
+ if (_GameData.CatSongIndices == null && categoryIndex != -1)
_ScreenSongOptions.Selection.SelectNextRandomSong = true;
- if (CategoryIndex == -1)
+ if (categoryIndex == -1)
_ScreenSongOptions.Selection.RandomOnly = false;
- if (_ScreenSongOptions.Sorting.Tabs == EOffOn.TR_CONFIG_OFF || CategoryIndex != -1)
+ if (_ScreenSongOptions.Sorting.Tabs == EOffOn.TR_CONFIG_OFF || categoryIndex != -1)
_ScreenSongOptions.Selection.RandomOnly = true;
- ScreenSongOptions = _ScreenSongOptions;
+ screenSongOptions = _ScreenSongOptions;
}
- public override void SetSearchString(string SearchString, bool Visible)
+ public override void SetSearchString(string searchString, bool visible)
{
- _ScreenSongOptions.Sorting.SearchString = SearchString;
- _ScreenSongOptions.Sorting.SearchActive = Visible;
+ _ScreenSongOptions.Sorting.SearchString = searchString;
+ _ScreenSongOptions.Sorting.SearchActive = visible;
}
public override int GetMaxPlayer()
{
- return MaxPlayer;
+ return _MaxPlayer;
}
public override int GetMinPlayer()
{
- return MinPlayer;
+ return _MinPlayer;
}
public override int GetMaxTeams()
{
- return MaxTeams;
+ return _MaxTeams;
}
public override int GetMinTeams()
{
- return MinTeams;
+ return _MinTeams;
}
public override int GetMaxNumRounds()
{
- return MaxNumRounds;
+ return _MaxNumRounds;
}
- public override void JokerUsed(int TeamNr)
+ public override void JokerUsed(int teamNr)
{
if (_ScreenSongOptions.Selection.NumJokers == null)
return;
- if (TeamNr >= _ScreenSongOptions.Selection.NumJokers.Length)
+ if (teamNr >= _ScreenSongOptions.Selection.NumJokers.Length)
return;
- _ScreenSongOptions.Selection.NumJokers[TeamNr]--;
+ _ScreenSongOptions.Selection.NumJokers[teamNr]--;
_ScreenSongOptions.Selection.RandomOnly = true;
_ScreenSongOptions.Selection.CategoryChangeAllowed = false;
}
- public override void SongSelected(int SongID) {}
+ public override void SongSelected(int songID) {}
public override void LeavingHighscore()
{
- GameData.CurrentRoundNr++;
+ _GameData.CurrentRoundNr++;
CBase.Graphics.FadeTo(EScreens.ScreenPartyDummy);
}
- private void StartNextRound()
+ private void _StartNextRound()
{
_ScreenSongOptions.Selection.RandomOnly = _ScreenSongOptions.Sorting.Tabs != EOffOn.TR_CONFIG_ON;
_ScreenSongOptions.Selection.CategoryChangeAllowed = _ScreenSongOptions.Sorting.Tabs == EOffOn.TR_CONFIG_ON;
- SetNumJokers();
- SetTeamNames();
- GameData.CatSongIndices = null;
+ _SetNumJokers();
+ _SetTeamNames();
+ _GameData.CatSongIndices = null;
- if (RandomizeSongs())
+ if (_RandomizeSongs())
CBase.Graphics.FadeTo(EScreens.ScreenSing);
}
- private bool RandomizeSongs()
+ private bool _RandomizeSongs()
{
CBase.Game.Reset();
CBase.Game.ClearSongs();
#region PlayerNames
- CBase.Game.SetNumPlayer(GameData.NumPlayerAtOnce);
+ CBase.Game.SetNumPlayer(_GameData.NumPlayerAtOnce);
SPlayer[] player = CBase.Game.GetPlayer();
if (player == null)
return false;
- if (player.Length < GameData.NumPlayerAtOnce)
+ if (player.Length < _GameData.NumPlayerAtOnce)
return false;
SProfile[] profiles = CBase.Profiles.GetProfiles();
- Combination c = GameData.Rounds.GetRound(GameData.CurrentRoundNr - 1);
+ CCombination c = _GameData.Rounds.GetRound(_GameData.CurrentRoundNr - 1);
- for (int i = 0; i < GameData.NumPlayerAtOnce; i++)
+ for (int i = 0; i < _GameData.NumPlayerAtOnce; i++)
{
//default values
player[i].Name = "foobar";
@@ -490,63 +490,63 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley
//try to fill with the right data
if (c != null)
{
- if (GameData.ProfileIDs[c.Player[i]] < profiles.Length)
+ if (_GameData.ProfileIDs[c.Player[i]] < profiles.Length)
{
- player[i].Name = profiles[GameData.ProfileIDs[c.Player[i]]].PlayerName;
- player[i].Difficulty = profiles[GameData.ProfileIDs[c.Player[i]]].Difficulty;
- player[i].ProfileID = GameData.ProfileIDs[c.Player[i]];
+ player[i].Name = profiles[_GameData.ProfileIDs[c.Player[i]]].PlayerName;
+ player[i].Difficulty = profiles[_GameData.ProfileIDs[c.Player[i]]].Difficulty;
+ player[i].ProfileID = _GameData.ProfileIDs[c.Player[i]];
}
}
}
#endregion PlayerNames
#region SongQueque
- if (CBase.Songs.GetNumVisibleSongs() < NumSongs)
+ if (CBase.Songs.GetNumVisibleSongs() < _NumSongs)
CBase.Songs.ResetPartySongSung();
EGameMode gm = EGameMode.TR_GAMEMODE_MEDLEY;
- List IDs = new List();
+ List iDs = new List();
- CSong[] VisSongs = CBase.Songs.GetSongsNotSung();
- if (VisSongs == null)
+ CSong[] visSongs = CBase.Songs.GetSongsNotSung();
+ if (visSongs == null)
{
- CBase.Log.LogError("PartyChallengeMedleyMode Error: There are no songs!");
+ CBase.Log.LogError("CPartyChallengeMedleyMode Error: There are no songs!");
CBase.Graphics.FadeTo(EScreens.ScreenParty);
return false;
}
- for (int i = 0; i < VisSongs.Length; i++)
+ for (int i = 0; i < visSongs.Length; i++)
{
- foreach (EGameMode mode in VisSongs[i].AvailableGameModes)
+ foreach (EGameMode mode in visSongs[i].AvailableGameModes)
{
if (mode == EGameMode.TR_GAMEMODE_MEDLEY)
- IDs.Add(VisSongs[i].ID);
+ iDs.Add(visSongs[i].ID);
}
}
- if (IDs.Count == 0)
+ if (iDs.Count == 0)
{
- CBase.Log.LogError("PartyChallengeMedleyMode Error: There are no medley songs!");
+ CBase.Log.LogError("CPartyChallengeMedleyMode Error: There are no medley songs!");
CBase.Graphics.FadeTo(EScreens.ScreenParty);
return false;
}
int s = 0;
- while (s < NumSongs && IDs.Count > 0)
+ while (s < _NumSongs && iDs.Count > 0)
{
- int SongID = IDs[CBase.Game.GetRandom(IDs.Count)];
- CBase.Game.AddSong(SongID, gm);
- CBase.Songs.AddPartySongSung(SongID);
- IDs.Remove(SongID);
+ int songID = iDs[CBase.Game.GetRandom(iDs.Count)];
+ CBase.Game.AddSong(songID, gm);
+ CBase.Songs.AddPartySongSung(songID);
+ iDs.Remove(songID);
s++;
}
return true;
#endregion SongQueque
}
- private void SetNumJokers()
+ private void _SetNumJokers()
{
- switch (GameData.NumPlayerAtOnce)
+ switch (_GameData.NumPlayerAtOnce)
{
case 1:
_ScreenSongOptions.Selection.NumJokers = new int[] {10};
@@ -577,7 +577,7 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley
}
}
- private void SetTeamNames()
+ private void _SetTeamNames()
{
SProfile[] profiles = CBase.Profiles.GetProfiles();
@@ -587,21 +587,21 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley
return;
}
- if (GameData.NumPlayerAtOnce < 1 || GameData.ProfileIDs.Count < GameData.NumPlayerAtOnce || profiles.Length < GameData.NumPlayerAtOnce)
+ if (_GameData.NumPlayerAtOnce < 1 || _GameData.ProfileIDs.Count < _GameData.NumPlayerAtOnce || profiles.Length < _GameData.NumPlayerAtOnce)
{
_ScreenSongOptions.Selection.TeamNames = new string[] {"foo", "bar"};
return;
}
- _ScreenSongOptions.Selection.TeamNames = new string[GameData.NumPlayerAtOnce];
- Combination c = GameData.Rounds.GetRound(GameData.CurrentRoundNr - 1);
+ _ScreenSongOptions.Selection.TeamNames = new string[_GameData.NumPlayerAtOnce];
+ CCombination c = _GameData.Rounds.GetRound(_GameData.CurrentRoundNr - 1);
- for (int i = 0; i < GameData.NumPlayerAtOnce; i++)
+ for (int i = 0; i < _GameData.NumPlayerAtOnce; i++)
{
if (c != null)
{
- if (GameData.ProfileIDs[c.Player[i]] < profiles.Length)
- _ScreenSongOptions.Selection.TeamNames[i] = profiles[GameData.ProfileIDs[c.Player[i]]].PlayerName;
+ if (_GameData.ProfileIDs[c.Player[i]] < profiles.Length)
+ _ScreenSongOptions.Selection.TeamNames[i] = profiles[_GameData.ProfileIDs[c.Player[i]]].PlayerName;
else
_ScreenSongOptions.Selection.TeamNames[i] = "foobar";
}
@@ -610,66 +610,66 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley
}
}
- private void UpdateScores()
+ private void _UpdateScores()
{
- if (GameData.ResultTable.Count == 0)
+ if (_GameData.ResultTable.Count == 0)
{
- for (int i = 0; i < GameData.NumPlayer; i++)
+ for (int i = 0; i < _GameData.NumPlayer; i++)
{
- ResultTableRow row = new ResultTableRow();
- row.PlayerID = GameData.ProfileIDs[i];
+ CResultTableRow row = new CResultTableRow();
+ row.PlayerID = _GameData.ProfileIDs[i];
row.NumPlayed = 0;
row.NumRounds = 0;
row.NumWon = 0;
row.NumSingPoints = 0;
row.NumGamePoints = 0;
- GameData.ResultTable.Add(row);
+ _GameData.ResultTable.Add(row);
}
- GameData.Results = new int[GameData.NumRounds,GameData.NumPlayerAtOnce];
- for (int i = 0; i < GameData.NumRounds; i++)
+ _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;
+ for (int j = 0; j < _GameData.NumPlayerAtOnce; j++)
+ _GameData.Results[i, j] = 0;
}
}
else
{
- CPoints GamePoints = CBase.Game.GetPoints();
- if (GamePoints == null || GamePoints.NumPlayer < GameData.NumPlayerAtOnce)
+ CPoints gamePoints = CBase.Game.GetPoints();
+ if (gamePoints == null || gamePoints.NumPlayer < _GameData.NumPlayerAtOnce)
return;
- SPlayer[] results = GamePoints.GetPlayer(0, GameData.NumPlayerAtOnce);
+ SPlayer[] results = gamePoints.GetPlayer(0, _GameData.NumPlayerAtOnce);
if (results == null)
return;
- if (results.Length < GameData.NumPlayerAtOnce)
+ if (results.Length < _GameData.NumPlayerAtOnce)
return;
- if (GamePoints.NumRounds == 0)
+ if (gamePoints.NumRounds == 0)
return;
- for (int i = 1; i < GamePoints.NumRounds; i++)
+ for (int i = 1; i < gamePoints.NumRounds; i++)
{
- SPlayer[] temp = GamePoints.GetPlayer(i, GameData.NumPlayerAtOnce);
- for (int p = 0; p < GameData.NumPlayerAtOnce; p++)
+ 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++)
+ for (int j = 0; j < _GameData.NumPlayerAtOnce; j++)
{
- results[j].Points = results[j].Points / GamePoints.NumRounds;
- GameData.Results[GameData.CurrentRoundNr - 2, j] = (int)Math.Round(results[j].Points);
+ results[j].Points = results[j].Points / gamePoints.NumRounds;
+ _GameData.Results[_GameData.CurrentRoundNr - 2, j] = (int)Math.Round(results[j].Points);
}
- List points = GetPointsForPlayer(results);
+ List points = _GetPointsForPlayer(results);
- for (int i = 0; i < GameData.NumPlayerAtOnce; i++)
+ for (int i = 0; i < _GameData.NumPlayerAtOnce; i++)
{
int index = -1;
- for (int j = 0; j < GameData.ResultTable.Count; j++)
+ for (int j = 0; j < _GameData.ResultTable.Count; j++)
{
- if (points[i].ProfileID == GameData.ResultTable[j].PlayerID)
+ if (points[i].ProfileID == _GameData.ResultTable[j].PlayerID)
{
index = j;
break;
@@ -678,7 +678,7 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley
if (index != -1)
{
- ResultTableRow row = GameData.ResultTable[index];
+ CResultTableRow row = _GameData.ResultTable[index];
row.NumPlayed++;
row.NumWon += points[i].Won;
@@ -686,41 +686,41 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley
row.NumSingPoints += points[i].SingPoints;
row.NumGamePoints += points[i].GamePoints;
- GameData.ResultTable[index] = row;
+ _GameData.ResultTable[index] = row;
}
}
}
- GameData.ResultTable.Sort();
+ _GameData.ResultTable.Sort();
//Update position-number
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)
+ if (lastPoints > _GameData.ResultTable[i].NumGamePoints || lastSingPoints > _GameData.ResultTable[i].NumSingPoints)
pos++;
- GameData.ResultTable[i].Position = pos;
- lastPoints = GameData.ResultTable[i].NumGamePoints;
- lastSingPoints = GameData.ResultTable[i].NumSingPoints;
+ _GameData.ResultTable[i].Position = pos;
+ lastPoints = _GameData.ResultTable[i].NumGamePoints;
+ lastSingPoints = _GameData.ResultTable[i].NumSingPoints;
}
}
- private List GetPointsForPlayer(SPlayer[] Results)
+ private List _GetPointsForPlayer(SPlayer[] results)
{
- List result = new List();
- for (int i = 0; i < GameData.NumPlayerAtOnce; i++)
+ List result = new List();
+ for (int i = 0; i < _GameData.NumPlayerAtOnce; i++)
{
- Stats stat = new Stats();
- stat.ProfileID = Results[i].ProfileID;
- stat.SingPoints = (int)Math.Round(Results[i].Points);
+ SStats stat = new SStats();
+ stat.ProfileID = results[i].ProfileID;
+ stat.SingPoints = (int)Math.Round(results[i].Points);
stat.Won = 0;
stat.GamePoints = 0;
result.Add(stat);
}
- result.Sort(delegate(Stats s1, Stats s2) { return s1.SingPoints.CompareTo(s2.SingPoints); });
+ result.Sort(delegate(SStats s1, SStats s2) { return s1.SingPoints.CompareTo(s2.SingPoints); });
int current = result[result.Count - 1].SingPoints;
int points = result.Count;
@@ -728,7 +728,7 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley
for (int i = result.Count - 1; i >= 0; i--)
{
- Stats res = result[i];
+ SStats res = result[i];
if (i < result.Count - 1)
{
@@ -760,17 +760,17 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley
return result;
}
- private void CreateCatSongIndices()
+ private void _CreateCatSongIndices()
{
- if (GameData.CatSongIndices == null && CBase.Songs.GetNumCategories() > 0 && _ScreenSongOptions.Sorting.Tabs == EOffOn.TR_CONFIG_ON)
+ if (_GameData.CatSongIndices == null && CBase.Songs.GetNumCategories() > 0 && _ScreenSongOptions.Sorting.Tabs == EOffOn.TR_CONFIG_ON)
{
- GameData.CatSongIndices = new int[CBase.Songs.GetNumCategories()];
- for (int i = 0; i < GameData.CatSongIndices.Length; i++)
- GameData.CatSongIndices[i] = -1;
+ _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;
+ _GameData.CatSongIndices = null;
}
}
}
\ No newline at end of file
diff --git a/PartyModes/PartyModeChallengeMedley/CPartyScreenChallengeMedleyConfig.cs b/PartyModes/PartyModeChallengeMedley/CPartyScreenChallengeMedleyConfig.cs
new file mode 100644
index 00000000..111049b5
--- /dev/null
+++ b/PartyModes/PartyModeChallengeMedley/CPartyScreenChallengeMedleyConfig.cs
@@ -0,0 +1,227 @@
+using System;
+using System.Windows.Forms;
+using VocaluxeLib.Menu;
+
+namespace VocaluxeLib.PartyModes.ChallengeMedley
+{
+ public class CPartyScreenChallengeMedleyConfig : CMenuParty
+ {
+ // Version number for theme files. Increment it, if you've changed something on the theme files!
+ protected override int _ScreenVersion
+ {
+ get { return 1; }
+ }
+
+ 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;
+
+ private SDataFromScreen _Data;
+
+ public override void Init()
+ {
+ base.Init();
+
+ _ThemeSelectSlides = new string[] {_SelectSlideNumPlayers, _SelectSlideNumMics, _SelectSlideNumRounds};
+ _ThemeButtons = new string[] {_ButtonNext, _ButtonBack};
+
+ _Data = new SDataFromScreen();
+ SFromScreenConfig config = new SFromScreenConfig();
+ config.NumPlayer = 4;
+ config.NumPlayerAtOnce = 2;
+ config.NumRounds = 12;
+ _Data.ScreenConfig = config;
+ }
+
+ public override void DataToScreen(object receivedData)
+ {
+ SDataToScreenConfig config = new SDataToScreenConfig();
+
+ try
+ {
+ config = (SDataToScreenConfig)receivedData;
+ _Data.ScreenConfig.NumPlayer = config.NumPlayer;
+ _Data.ScreenConfig.NumPlayerAtOnce = config.NumPlayerAtOnce;
+ _Data.ScreenConfig.NumRounds = config.NumRounds;
+ }
+ catch (Exception e)
+ {
+ 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(SKeyEvent keyEvent)
+ {
+ base.HandleInput(keyEvent);
+
+ if (keyEvent.KeyPressed) {}
+ else
+ {
+ switch (keyEvent.Key)
+ {
+ case Keys.Back:
+ case Keys.Escape:
+ _Back();
+ break;
+
+ case Keys.Enter:
+ _UpdateSlides();
+
+ if (Buttons[_ButtonBack].Selected)
+ _Back();
+
+ if (Buttons[_ButtonNext].Selected)
+ _Next();
+ break;
+
+ case Keys.Left:
+ _UpdateSlides();
+ break;
+
+ case Keys.Right:
+ _UpdateSlides();
+ break;
+ }
+ }
+ return true;
+ }
+
+ public override bool HandleMouse(SMouseEvent mouseEvent)
+ {
+ base.HandleMouse(mouseEvent);
+
+ if (mouseEvent.LB && IsMouseOver(mouseEvent))
+ {
+ _UpdateSlides();
+ if (Buttons[_ButtonBack].Selected)
+ _Back();
+
+ if (Buttons[_ButtonNext].Selected)
+ _Next();
+ }
+
+ if (mouseEvent.RB)
+ _Back();
+
+ return true;
+ }
+
+ public override void OnShow()
+ {
+ base.OnShow();
+
+ _MaxNumMics = CBase.Config.GetMaxNumMics();
+ if (_MaxNumMics > 6)
+ _MaxNumMics = 6;
+
+ _MaxNumRounds = _PartyMode.GetMaxNumRounds();
+
+ _RebuildSlides();
+ }
+
+ public override bool UpdateGame()
+ {
+ return true;
+ }
+
+ public override bool Draw()
+ {
+ base.Draw();
+ return true;
+ }
+
+ private void _RebuildSlides()
+ {
+ // build num player slide (min player ... max player);
+ SelectSlides[_SelectSlideNumPlayers].Clear();
+ for (int i = _PartyMode.GetMinPlayer(); i <= _PartyMode.GetMaxPlayer(); i++)
+ SelectSlides[_SelectSlideNumPlayers].AddValue(i.ToString());
+ SelectSlides[_SelectSlideNumPlayers].Selection = _Data.ScreenConfig.NumPlayer - _PartyMode.GetMinPlayer();
+
+ _UpdateMicsAtOnce();
+ _SetRoundSteps();
+ _UpdateSlideRounds();
+ }
+
+ private void _UpdateSlides()
+ {
+ int player = _Data.ScreenConfig.NumPlayer;
+ int mics = _Data.ScreenConfig.NumPlayerAtOnce;
+ _Data.ScreenConfig.NumPlayer = SelectSlides[_SelectSlideNumPlayers].Selection + _PartyMode.GetMinPlayer();
+ _Data.ScreenConfig.NumPlayerAtOnce = SelectSlides[_SelectSlideNumMics].Selection + _PartyMode.GetMinPlayer();
+ _Data.ScreenConfig.NumRounds = (SelectSlides[_SelectSlideNumRounds].Selection + 1) * _RoundSteps;
+
+ _UpdateMicsAtOnce();
+ _SetRoundSteps();
+
+ if (player != _Data.ScreenConfig.NumPlayer || mics != _Data.ScreenConfig.NumPlayerAtOnce)
+ {
+ int num = CHelper.CombinationCount(_Data.ScreenConfig.NumPlayer, _Data.ScreenConfig.NumPlayerAtOnce);
+ while (num > _MaxNumRounds)
+ num -= _RoundSteps;
+ _Data.ScreenConfig.NumRounds = num;
+ }
+
+ _UpdateSlideRounds();
+ }
+
+ private void _UpdateMicsAtOnce()
+ {
+ //Data.ScreenConfig.NumPlayerAtOnce
+ int maxNum = _MaxNumMics;
+ if (_Data.ScreenConfig.NumPlayer < _MaxNumMics)
+ maxNum = _Data.ScreenConfig.NumPlayer;
+
+ if (_Data.ScreenConfig.NumPlayerAtOnce > maxNum)
+ _Data.ScreenConfig.NumPlayerAtOnce = maxNum;
+
+ // build mics at once slide
+ SelectSlides[_SelectSlideNumMics].Clear();
+ for (int i = 1; i <= maxNum; i++)
+ SelectSlides[_SelectSlideNumMics].AddValue(i.ToString());
+ SelectSlides[_SelectSlideNumMics].Selection = _Data.ScreenConfig.NumPlayerAtOnce - _PartyMode.GetMinPlayer();
+ }
+
+ private void _UpdateSlideRounds()
+ {
+ // build num rounds slide
+ SelectSlides[_SelectSlideNumRounds].Clear();
+ for (int i = _RoundSteps; i <= _MaxNumRounds; i += _RoundSteps)
+ SelectSlides[_SelectSlideNumRounds].AddValue(i.ToString());
+ SelectSlides[_SelectSlideNumRounds].Selection = _Data.ScreenConfig.NumRounds / _RoundSteps - 1;
+ }
+
+ private void _SetRoundSteps()
+ {
+ if (_Data.ScreenConfig.NumPlayerAtOnce < 1 || _Data.ScreenConfig.NumPlayer < 1 || _Data.ScreenConfig.NumPlayerAtOnce > _Data.ScreenConfig.NumPlayer)
+ {
+ _RoundSteps = 1;
+ return;
+ }
+
+ int res = _Data.ScreenConfig.NumPlayer / _Data.ScreenConfig.NumPlayerAtOnce;
+ int mod = _Data.ScreenConfig.NumPlayer % _Data.ScreenConfig.NumPlayerAtOnce;
+
+ if (mod == 0)
+ _RoundSteps = res;
+ else
+ _RoundSteps = _Data.ScreenConfig.NumPlayer;
+ }
+
+ private void _Back()
+ {
+ _FadeTo(EScreens.ScreenParty);
+ }
+
+ private void _Next()
+ {
+ _PartyMode.DataFromScreen(ThemeName, _Data);
+ }
+ }
+}
\ No newline at end of file
diff --git a/PartyModes/PartyModeChallengeMedley/CPartyScreenChallengeMedleyMain.cs b/PartyModes/PartyModeChallengeMedley/CPartyScreenChallengeMedleyMain.cs
new file mode 100644
index 00000000..4a0dd98f
--- /dev/null
+++ b/PartyModes/PartyModeChallengeMedley/CPartyScreenChallengeMedleyMain.cs
@@ -0,0 +1,660 @@
+using System;
+using System.Collections.Generic;
+using System.Windows.Forms;
+using VocaluxeLib.Menu;
+
+namespace VocaluxeLib.PartyModes.ChallengeMedley
+{
+ struct STableRow
+ {
+ public CText Pos;
+ public CText Name;
+ public CText Rounds;
+ public CText Won;
+ public CText SingPoints;
+ public CText GamePoints;
+ }
+
+ class CRoundsTableRow
+ {
+ public CText Number;
+ public List TextPlayer;
+ public List TextScores;
+ }
+
+ public class CPartyScreenChallengeMedleyMain : CMenuParty
+ {
+ // Version number for theme files. Increment it, if you've changed something on the theme files!
+ protected override int _ScreenVersion
+ {
+ get { return 1; }
+ }
+
+ 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";
+
+ 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";
+
+ private const string _StaticPopupBG = "StaticPopupBG";
+ private const string _StaticNextPlayer = "StaticNextPlayer";
+
+ private bool _ExitPopupVisible;
+
+ private SDataFromScreen _Data;
+ private SDataToScreenMain _GameState;
+ private List _PlayerTable;
+ private List _RoundsTable;
+
+ private List _NextPlayerTexts;
+ private List _NextPlayerStatics;
+
+ private SRectF _RoundsTableScrollArea;
+ private SRectF _PlayerTableScrollArea;
+ private int _RoundsTableOffset;
+ private int _PlayerTableOffset;
+ private int _NumPlayerVisible = 10;
+ private int _NumRoundsVisible = 3;
+
+ public CPartyScreenChallengeMedleyMain()
+ {
+ _Data = new SDataFromScreen();
+ _Data.ScreenMain = new SFromScreenMain();
+ }
+
+ public override void Init()
+ {
+ base.Init();
+
+ _ThemeTexts = new string[]
+ {
+ _TextPosition, _TextPlayerName, _TextNumPlayed, _TextWon, _TextSingPoints, _TextGamePoints, _TextNextPlayer, _TextPopupReallyExit, _TextRoundNumber, _TextRoundPlayer,
+ _TextRoundScore, _TextFinishMessage, _TextFinishPlayerWin, _TextNextPlayerMessage
+ };
+ _ThemeButtons = new string[]
+ {_ButtonNextRound, _ButtonBack, _ButtonExit, _ButtonPopupYes, _ButtonPopupNo, _ButtonPlayerScrollDown, _ButtonPlayerScrollUp, _ButtonRoundsScrollDown, _ButtonRoundsScrollUp};
+ _ThemeStatics = new string[] {_StaticPopupBG, _StaticNextPlayer};
+ }
+
+ public override void LoadTheme(string xmlPath)
+ {
+ base.LoadTheme(xmlPath);
+
+ _GameState = new SDataToScreenMain();
+ _BuildPlayerTable();
+ _CreateRoundsTable();
+ _NextPlayerTexts = new List();
+ _NextPlayerStatics = new List();
+
+ for (int i = 0; i < _PartyMode.GetMaxPlayer(); i++)
+ {
+ _NextPlayerTexts.Add(GetNewText(Texts[_TextNextPlayer]));
+ AddText(_NextPlayerTexts[_NextPlayerTexts.Count - 1]);
+ _NextPlayerStatics.Add(GetNewStatic(Statics[_StaticNextPlayer]));
+ AddStatic(_NextPlayerStatics[_NextPlayerStatics.Count - 1]);
+ }
+ }
+
+ public override void DataToScreen(object receivedData)
+ {
+ SDataToScreenMain data = new SDataToScreenMain();
+
+ try
+ {
+ data = (SDataToScreenMain)receivedData;
+ _GameState = data;
+ }
+ catch (Exception e)
+ {
+ 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(SKeyEvent keyEvent)
+ {
+ base.HandleInput(keyEvent);
+
+ if (keyEvent.KeyPressed) {}
+ else
+ {
+ switch (keyEvent.Key)
+ {
+ case Keys.Back:
+ case Keys.Escape:
+ if (!_ExitPopupVisible)
+ {
+ if (_GameState.CurrentRoundNr == 1)
+ _Back();
+ else
+ _ShowPopup(true);
+ }
+ else
+ _ShowPopup(false);
+ break;
+
+ case Keys.Enter:
+ if (!_ExitPopupVisible)
+ {
+ if (Buttons[_ButtonNextRound].Selected)
+ _NextRound();
+ if (Buttons[_ButtonBack].Selected && _GameState.CurrentRoundNr == 1)
+ _Back();
+ if (Buttons[_ButtonExit].Selected && _GameState.CurrentRoundNr > 1)
+ _ShowPopup(true);
+ if (Buttons[_ButtonPlayerScrollUp].Selected)
+ _ScrollPlayerTable(-1);
+ if (Buttons[_ButtonPlayerScrollDown].Selected)
+ _ScrollPlayerTable(1);
+ if (Buttons[_ButtonRoundsScrollUp].Selected)
+ _ScrollRoundsTable(-1);
+ if (Buttons[_ButtonRoundsScrollDown].Selected)
+ _ScrollRoundsTable(1);
+ }
+ else
+ {
+ if (Buttons[_ButtonPopupYes].Selected)
+ _EndParty();
+ if (Buttons[_ButtonPopupNo].Selected)
+ _ShowPopup(false);
+ }
+ break;
+ }
+ }
+ return true;
+ }
+
+ public override bool HandleMouse(SMouseEvent mouseEvent)
+ {
+ base.HandleMouse(mouseEvent);
+
+ if (mouseEvent.LB && IsMouseOver(mouseEvent))
+ {
+ if (!_ExitPopupVisible)
+ {
+ if (Buttons[_ButtonNextRound].Selected)
+ _NextRound();
+ if (Buttons[_ButtonBack].Selected && _GameState.CurrentRoundNr == 1)
+ _Back();
+ if (Buttons[_ButtonExit].Selected && _GameState.CurrentRoundNr > 1)
+ _ShowPopup(true);
+ if (Buttons[_ButtonPlayerScrollUp].Selected)
+ _ScrollPlayerTable(-1);
+ if (Buttons[_ButtonPlayerScrollDown].Selected)
+ _ScrollPlayerTable(1);
+ if (Buttons[_ButtonRoundsScrollUp].Selected)
+ _ScrollRoundsTable(-1);
+ if (Buttons[_ButtonRoundsScrollDown].Selected)
+ _ScrollRoundsTable(1);
+ }
+ else
+ {
+ if (Buttons[_ButtonPopupYes].Selected)
+ _EndParty();
+ if (Buttons[_ButtonPopupNo].Selected)
+ _ShowPopup(false);
+ }
+ }
+
+ if (mouseEvent.RB)
+ {
+ if (!_ExitPopupVisible)
+ {
+ if (_GameState.CurrentRoundNr == 1)
+ _Back();
+ else
+ _ShowPopup(true);
+ }
+ else
+ _ShowPopup(false);
+ }
+
+ if (mouseEvent.Wheel != 0)
+ {
+ if (CHelper.IsInBounds(_RoundsTableScrollArea, mouseEvent))
+ _ScrollRoundsTable(mouseEvent.Wheel);
+ if (CHelper.IsInBounds(_PlayerTableScrollArea, mouseEvent))
+ _ScrollPlayerTable(mouseEvent.Wheel);
+ }
+
+ return true;
+ }
+
+ public override void OnShow()
+ {
+ base.OnShow();
+
+ _PlayerTableOffset = 0;
+ _RoundsTableOffset = 0;
+
+ _UpdatePlayerTable();
+ _UpdateNextPlayerPositions();
+ _UpdateNextPlayerContents();
+ if (_GameState.CurrentRoundNr == 1)
+ _BuildRoundsTable();
+ else
+ _ScrollRoundsTable(_GameState.CurrentRoundNr - 2);
+ _UpdateRoundsTable();
+
+ if (_GameState.CurrentRoundNr == 1)
+ {
+ Buttons[_ButtonBack].Visible = true;
+ Buttons[_ButtonExit].Visible = false;
+ }
+ else
+ {
+ Buttons[_ButtonBack].Visible = false;
+ Buttons[_ButtonExit].Visible = true;
+ }
+
+ if (_GameState.CurrentRoundNr <= _GameState.Combs.Count)
+ {
+ Buttons[_ButtonNextRound].Visible = true;
+ Texts[_TextFinishMessage].Visible = false;
+ Texts[_TextFinishPlayerWin].Visible = false;
+ SetInteractionToButton(Buttons[_ButtonNextRound]);
+ }
+ else
+ {
+ Buttons[_ButtonNextRound].Visible = false;
+ Texts[_TextFinishMessage].Visible = true;
+ Texts[_TextFinishPlayerWin].Visible = true;
+ Texts[_TextFinishPlayerWin].Text = _GetPlayerWinString();
+ SetInteractionToButton(Buttons[_ButtonExit]);
+ }
+
+ _ShowPopup(false);
+ }
+
+ public override bool UpdateGame()
+ {
+ return true;
+ }
+
+ public override bool Draw()
+ {
+ base.Draw();
+ return true;
+ }
+
+ private void _NextRound()
+ {
+ _Data.ScreenMain.FadeToNameSelection = false;
+ _Data.ScreenMain.FadeToSongSelection = true;
+ _PartyMode.DataFromScreen(ThemeName, _Data);
+ }
+
+ private void _EndParty()
+ {
+ _FadeTo(EScreens.ScreenParty);
+ }
+
+ private void _ShowPopup(bool visible)
+ {
+ _ExitPopupVisible = visible;
+
+ Statics[_StaticPopupBG].Visible = _ExitPopupVisible;
+ Texts[_TextPopupReallyExit].Visible = _ExitPopupVisible;
+ Buttons[_ButtonPopupYes].Visible = _ExitPopupVisible;
+ Buttons[_ButtonPopupNo].Visible = _ExitPopupVisible;
+
+ if (_ExitPopupVisible)
+ SetInteractionToButton(Buttons[_ButtonPopupNo]);
+ }
+
+ private void _Back()
+ {
+ _Data.ScreenMain.FadeToNameSelection = true;
+ _Data.ScreenMain.FadeToSongSelection = false;
+ _PartyMode.DataFromScreen(ThemeName, _Data);
+ }
+
+ private void _UpdateNextPlayerPositions()
+ {
+ float x = CBase.Settings.GetRenderW() / 2 - ((_GameState.NumPlayerAtOnce * Statics[_StaticNextPlayer].Rect.W) + ((_GameState.NumPlayerAtOnce - 1) * 15)) / 2;
+ float staticY = 590;
+ float textY = 550;
+ for (int i = 0; i < _GameState.NumPlayerAtOnce; i++)
+ {
+ //static
+ _NextPlayerStatics[i].Rect.X = x;
+ _NextPlayerStatics[i].Rect.Y = staticY;
+ _NextPlayerStatics[i].Visible = true;
+ //text
+ _NextPlayerTexts[i].X = x + Statics[_StaticNextPlayer].Rect.W / 2;
+ _NextPlayerTexts[i].Y = textY;
+ _NextPlayerTexts[i].Visible = true;
+
+ x += Statics[_StaticNextPlayer].Rect.W + 15;
+ }
+ for (int i = _GameState.NumPlayerAtOnce; i < _PartyMode.GetMaxPlayer(); i++)
+ {
+ _NextPlayerStatics[i].Visible = false;
+ _NextPlayerTexts[i].Visible = false;
+ }
+ }
+
+ private void _UpdateNextPlayerContents()
+ {
+ if (_GameState.CurrentRoundNr <= _GameState.Combs.Count)
+ {
+ 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);
+ }
+ }
+ else
+ {
+ Texts[_TextNextPlayerMessage].Visible = false;
+ for (int i = 0; i < _GameState.NumPlayerAtOnce; i++)
+ {
+ _NextPlayerStatics[i].Visible = false;
+ _NextPlayerTexts[i].Visible = false;
+ }
+ }
+ }
+
+ private void _CreateRoundsTable()
+ {
+ //Create lists
+ _RoundsTable = new List();
+ for (int i = 0; i < 5; i++)
+ {
+ CRoundsTableRow rtr = new CRoundsTableRow();
+ rtr.TextPlayer = new List();
+ rtr.TextScores = new List();
+ _RoundsTable.Add(rtr);
+ }
+ //Create statics and texts for rounds
+ for (int round = 0; round < _RoundsTable.Count; round++)
+ {
+ //Round-number
+ CText text = GetNewText(Texts[_TextRoundNumber]);
+ AddText(text);
+ _RoundsTable[round].Number = text;
+ for (int row = 0; row < 2; row++)
+ {
+ for (int column = 0; column < 3; column++)
+ {
+ //Player
+ text = GetNewText(Texts[_TextRoundPlayer]);
+ AddText(text);
+ _RoundsTable[round].TextPlayer.Add(text);
+ //Score
+ text = GetNewText(Texts[_TextRoundScore]);
+ AddText(text);
+ _RoundsTable[round].TextScores.Add(text);
+ }
+ }
+ }
+ }
+
+ private void _BuildRoundsTable()
+ {
+ _RoundsTableScrollArea = new SRectF();
+
+ int numPlayerInOneRow = 3;
+ if (_GameState.NumPlayerAtOnce <= numPlayerInOneRow)
+ _NumRoundsVisible = 5;
+ else
+ _NumRoundsVisible = 3;
+
+ if (_NumRoundsVisible > _GameState.Combs.Count)
+ _NumRoundsVisible = _GameState.Combs.Count;
+
+ float numberX = Texts[_TextRoundNumber].X;
+ float numberY = Texts[_TextRoundNumber].Y;
+
+ _RoundsTableScrollArea.X = numberX;
+ _RoundsTableScrollArea.Y = numberY;
+ _RoundsTableScrollArea.W = CBase.Settings.GetRenderW() - Texts[_TextRoundNumber].X - 20;
+
+ float delta = Texts[_TextRoundNumber].Height;
+
+ //Update statics and texts for rounds
+ for (int round = 0; round < _RoundsTable.Count; round++)
+ {
+ //Round-number
+ _RoundsTable[round].Number.X = numberX;
+ _RoundsTable[round].Number.Y = numberY;
+ int numInnerRows = (int)Math.Ceiling(_GameState.NumPlayerAtOnce / ((double)numPlayerInOneRow));
+ for (int row = 0; row < numInnerRows; row++)
+ {
+ int num = (row + 1) * numPlayerInOneRow;
+ int numPlayerInThisRow = numPlayerInOneRow;
+ if (num > _GameState.NumPlayerAtOnce)
+ {
+ num = _GameState.NumPlayerAtOnce;
+ numPlayerInThisRow = _GameState.NumPlayerAtOnce - (row * numPlayerInOneRow);
+ }
+ for (int column = row * numPlayerInOneRow; column < num; column++)
+ {
+ //Player
+ 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;
+ //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;
+ }
+ numberY = numberY + delta + delta;
+ }
+ numberY = numberY + delta / 2;
+ }
+ _RoundsTableScrollArea.H = numberY - _RoundsTableScrollArea.Y;
+ }
+
+ private void _UpdateRoundsTable()
+ {
+ SProfile[] profile = CBase.Profiles.GetProfiles();
+ for (int i = 0; i < _RoundsTable.Count; i++)
+ {
+ for (int p = 0; p < _RoundsTable[i].TextPlayer.Count; p++)
+ {
+ if (_GameState.Combs.Count > i + _RoundsTableOffset && _GameState.Combs[i + _RoundsTableOffset].Player.Count > p)
+ {
+ _RoundsTable[i].Number.Visible = true;
+ _RoundsTable[i].TextPlayer[p].Visible = true;
+ _RoundsTable[i].TextScores[p].Visible = true;
+ _RoundsTable[i].Number.Text = (i + 1 + _RoundsTableOffset).ToString() + ")";
+ int pID = _GameState.ProfileIDs[_GameState.Combs[i + _RoundsTableOffset].Player[p]];
+ _RoundsTable[i].TextPlayer[p].Text = profile[pID].PlayerName;
+ if ((_GameState.CurrentRoundNr - 1) > i + _RoundsTableOffset)
+ _RoundsTable[i].TextScores[p].Text = _GameState.Results[i + _RoundsTableOffset, p].ToString();
+ else
+ _RoundsTable[i].TextScores[p].Text = "";
+ }
+ else
+ {
+ _RoundsTable[i].TextPlayer[p].Visible = false;
+ _RoundsTable[i].TextScores[p].Visible = false;
+ }
+ }
+ if (_GameState.Combs.Count < i + _RoundsTableOffset || i + 1 > _NumRoundsVisible)
+ {
+ _RoundsTable[i].Number.Visible = false;
+ for (int p = 0; p < _RoundsTable[i].TextPlayer.Count; p++)
+ {
+ _RoundsTable[i].TextPlayer[p].Visible = false;
+ _RoundsTable[i].TextScores[p].Visible = false;
+ }
+ }
+ }
+
+ Buttons[_ButtonRoundsScrollUp].Visible = _RoundsTableOffset > 0;
+ Buttons[_ButtonRoundsScrollDown].Visible = _GameState.Combs.Count - _NumRoundsVisible - _RoundsTableOffset > 0;
+ }
+
+ private void _BuildPlayerTable()
+ {
+ _PlayerTableScrollArea = new SRectF();
+ _PlayerTableScrollArea.X = Texts[_TextPosition].X;
+ _PlayerTableScrollArea.Y = Texts[_TextPosition].Y;
+ _PlayerTableScrollArea.W = Texts[_TextGamePoints].X - Texts[_TextPosition].X;
+
+ _PlayerTable = new List();
+ float delta = Texts[_TextPosition].Height * 1.2f;
+
+ float h = 0;
+
+ for (int i = 0; i < 10; i++)
+ {
+ STableRow row = new STableRow();
+
+ 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);
+ row.Rounds.Y += delta * (i + 1);
+ row.Won.Y += delta * (i + 1);
+ row.SingPoints.Y += delta * (i + 1);
+ row.GamePoints.Y += delta * (i + 1);
+
+ row.Pos.Text = (i + 1).ToString() + ".";
+
+ row.Pos.Visible = false;
+ row.Name.Visible = false;
+ row.Rounds.Visible = false;
+ row.Won.Visible = false;
+ row.SingPoints.Visible = false;
+ row.GamePoints.Visible = false;
+
+ AddText(row.Pos);
+ AddText(row.Name);
+ AddText(row.Rounds);
+ AddText(row.Won);
+ AddText(row.SingPoints);
+ AddText(row.GamePoints);
+
+ _PlayerTable.Add(row);
+
+ h = delta * (i + 1);
+ }
+ _PlayerTableScrollArea.H = h + delta;
+ }
+
+ private void _UpdatePlayerTable()
+ {
+ SProfile[] profiles = CBase.Profiles.GetProfiles();
+
+ for (int i = 0; i < _PlayerTable.Count; i++)
+ {
+ STableRow row = _PlayerTable[i];
+
+ if (i + _PlayerTableOffset < _GameState.ResultTable.Count)
+ {
+ row.Pos.Visible = true;
+ row.Name.Visible = true;
+ row.Rounds.Visible = true;
+ row.Won.Visible = true;
+ row.SingPoints.Visible = true;
+ 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();
+ }
+ else
+ {
+ row.Pos.Visible = false;
+ row.Name.Visible = false;
+ row.Rounds.Visible = false;
+ row.Won.Visible = false;
+ row.SingPoints.Visible = false;
+ row.GamePoints.Visible = false;
+ }
+ }
+
+ Buttons[_ButtonPlayerScrollUp].Visible = _PlayerTableOffset > 0;
+ Buttons[_ButtonPlayerScrollDown].Visible = _GameState.ProfileIDs.Count - _NumPlayerVisible - _PlayerTableOffset > 0;
+ }
+
+ private void _ScrollPlayerTable(int offset)
+ {
+ if (_GameState.ProfileIDs.Count <= _NumPlayerVisible)
+ _PlayerTableOffset = 0;
+ else if (offset < 0 && _PlayerTableOffset + offset >= 0)
+ _PlayerTableOffset += offset;
+ else if (offset < 0 && _PlayerTableOffset + offset < 0)
+ _PlayerTableOffset = 0;
+ else if (offset > 0 && _PlayerTableOffset + offset <= _GameState.ProfileIDs.Count - _NumPlayerVisible)
+ _PlayerTableOffset += offset;
+ else if (offset > 0 && _PlayerTableOffset + offset > _GameState.ProfileIDs.Count - _NumPlayerVisible)
+ _PlayerTableOffset = _GameState.ProfileIDs.Count - _NumPlayerVisible;
+
+ _UpdatePlayerTable();
+ }
+
+ private void _ScrollRoundsTable(int offset)
+ {
+ if (_GameState.Combs.Count <= _NumRoundsVisible)
+ _RoundsTableOffset = 0;
+ else if (offset < 0 && _RoundsTableOffset + offset >= 0)
+ _RoundsTableOffset += offset;
+ else if (offset < 0 && _RoundsTableOffset + offset < 0)
+ _RoundsTableOffset = 0;
+ else if (offset > 0 && _RoundsTableOffset + offset <= _GameState.Combs.Count - _NumRoundsVisible)
+ _RoundsTableOffset += offset;
+ else if (offset > 0 && _RoundsTableOffset + offset > _GameState.Combs.Count - _NumRoundsVisible)
+ _RoundsTableOffset = _GameState.Combs.Count - _NumRoundsVisible;
+
+ _UpdateRoundsTable();
+ }
+
+ private string _GetPlayerWinString()
+ {
+ string s = "";
+ SProfile[] profiles = CBase.Profiles.GetProfiles();
+
+ for (int i = 0; i < _GameState.ResultTable.Count; i++)
+ {
+ if (_GameState.ResultTable[i].Position == 1)
+ {
+ if (i > 0)
+ s += ", ";
+ s += profiles[_GameState.ResultTable[i].PlayerID].PlayerName;
+ }
+ else
+ break;
+ }
+
+ return s;
+ }
+ }
+}
\ No newline at end of file
diff --git a/PartyModes/PartyModeChallengeMedley/CPartyScreenChallengeMedleyNames.cs b/PartyModes/PartyModeChallengeMedley/CPartyScreenChallengeMedleyNames.cs
new file mode 100644
index 00000000..45626757
--- /dev/null
+++ b/PartyModes/PartyModeChallengeMedley/CPartyScreenChallengeMedleyNames.cs
@@ -0,0 +1,504 @@
+using System;
+using System.Collections.Generic;
+using System.Windows.Forms;
+using VocaluxeLib.Menu;
+
+namespace VocaluxeLib.PartyModes.ChallengeMedley
+{
+ public class CPartyScreenChallengeMedleyNames : CMenuParty
+ {
+ // Version number for theme files. Increment it, if you've changed something on the theme files!
+ protected override int _ScreenVersion
+ {
+ get { return 1; }
+ }
+
+ private const string _ButtonNext = "ButtonNext";
+ private const string _ButtonBack = "ButtonBack";
+ private const string _ButtonPlayerDestination = "ButtonPlayerDestination";
+ private const string _ButtonPlayerChoose = "ButtonPlayerChoose";
+
+ private List _PlayerChooseButtons;
+ private List _PlayerDestinationButtons;
+ //PlayerDestinationButtons-Option
+ private const int _PlayerDestinationButtonsNumH = 3;
+ private const int _PlayerDestinationButtonsNumW = 4;
+ private const int _PlayerDestinationButtonsFirstX = 900;
+ private const int _PlayerDestinationButtonsFirstY = 105;
+ private const int _PlayerDestinationButtonsSpaceH = 15;
+ private const int _PlayerDestinationButtonsSpaceW = 25;
+ //PlayerChooseButtons-Option
+ private List _PlayerChooseButtonsVisibleProfiles;
+ private const int _PlayerChooseButtonsNumH = 7;
+ private const int _PlayerChooseButtonsNumW = 4;
+ private const int _PlayerChooseButtonsFirstX = 52;
+ private const int _PlayerChooseButtonsFirstY = 105;
+ private const int _PlayerChooseButtonsSpaceH = 15;
+ private const int _PlayerChooseButtonsSpaceW = 25;
+ private int _PlayerChooseButtonsOffset = 0;
+
+ private CStatic _ChooseAvatarStatic;
+ private bool _SelectingMouseActive;
+ private int _OldMouseX;
+ private int _OldMouseY;
+ private int _SelectedPlayerNr = -1;
+ private bool _ButtonsAdded;
+
+ private int _NumPlayer = 4;
+
+ private SDataFromScreen _Data;
+
+ private class CPlayerChooseButton
+ {
+ public CButton Button;
+ public int ProfileID;
+ }
+
+ public override void Init()
+ {
+ base.Init();
+
+ _ChooseAvatarStatic = GetNewStatic();
+ _ChooseAvatarStatic.Visible = false;
+
+ _PlayerChooseButtonsVisibleProfiles = new List();
+
+ _Data.ScreenNames.ProfileIDs = new List();
+
+ List buttons = new List();
+ _ThemeButtons = new string[] {_ButtonBack, _ButtonNext, _ButtonPlayerDestination, _ButtonPlayerChoose};
+
+ _Data = new SDataFromScreen();
+ SFromScreenNames names = new SFromScreenNames();
+ names.FadeToConfig = false;
+ names.FadeToMain = false;
+ names.ProfileIDs = new List();
+ _Data.ScreenNames = names;
+ }
+
+ public override void DataToScreen(object receivedData)
+ {
+ SDataToScreenNames config = new SDataToScreenNames();
+
+ try
+ {
+ config = (SDataToScreenNames)receivedData;
+ _Data.ScreenNames.ProfileIDs = config.ProfileIDs;
+ if (_Data.ScreenNames.ProfileIDs == null)
+ _Data.ScreenNames.ProfileIDs = new List();
+
+ _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);
+ }
+ }
+
+ public override bool HandleInput(SKeyEvent keyEvent)
+ {
+ base.HandleInput(keyEvent);
+
+ if (keyEvent.KeyPressed) {}
+ else
+ {
+ switch (keyEvent.Key)
+ {
+ case Keys.Back:
+ case Keys.Escape:
+ _Back();
+ break;
+
+ case Keys.Enter:
+ if (Buttons[_ButtonBack].Selected)
+ _Back();
+
+ if (Buttons[_ButtonNext].Selected)
+ _Next();
+
+ if (!_OnAdd())
+ _OnRemove();
+ break;
+
+ case Keys.Delete:
+ _OnRemove();
+ break;
+ }
+ }
+ return true;
+ }
+
+ public override bool HandleMouse(SMouseEvent mouseEvent)
+ {
+ base.HandleMouse(mouseEvent);
+
+ /*
+ //Check if LeftButton is hold and Select-Mode inactive
+ if (MouseEvent.LBH && !SelectingMouseActive)
+ {
+ //Save mouse-coords
+ 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)
+ {
+ SelectedPlayerNr = PlayerChooseButtons[i].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.Z = -100;
+ chooseAvatarStatic.Color = new SColorF(1, 1, 1, 1);
+ chooseAvatarStatic.Texture = CBase.Profiles.GetProfiles()[SelectedPlayerNr].Avatar.Texture;
+ }
+ }
+ }
+ }*/
+
+ //Check if LeftButton is hold and Select-Mode active
+ 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;
+ }
+ // LeftButton isn't hold anymore, but Selec-Mode is still active -> "Drop" of Avatar
+ else if (_SelectingMouseActive)
+ {
+ //Check if really a player was selected
+ if (_SelectedPlayerNr != -1)
+ {
+ //Foreach Drop-Area
+ for (int i = 0; i < _PlayerDestinationButtons.Count; i++)
+ {
+ //Check first, if area is "active"
+ if (_PlayerDestinationButtons[i].Visible)
+ {
+ //Check if Mouse is in area
+ if (CHelper.IsInBounds(_PlayerDestinationButtons[i].Rect, mouseEvent))
+ {
+ int added = -1;
+ //Add Player-ID to list.
+ if (_Data.ScreenNames.ProfileIDs.Count < (i + 1))
+ {
+ _Data.ScreenNames.ProfileIDs.Add(_SelectedPlayerNr);
+ added = _Data.ScreenNames.ProfileIDs.Count - 1;
+ }
+ else if (_Data.ScreenNames.ProfileIDs.Count >= (i + 1))
+ {
+ _Data.ScreenNames.ProfileIDs[i] = _SelectedPlayerNr;
+ added = i;
+ }
+ _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 = _ChooseAvatarStatic.Texture;
+ _PlayerDestinationButtons[added].SelTexture = _ChooseAvatarStatic.Texture;
+ _PlayerDestinationButtons[added].Text.Text = CBase.Profiles.GetProfiles()[_SelectedPlayerNr].PlayerName;
+ //Update Tiles-List
+ _UpdateButtonPlayerChoose();
+ }
+ }
+ }
+ _SelectedPlayerNr = -1;
+ }
+ //Reset variables
+ _SelectingMouseActive = false;
+ _ChooseAvatarStatic.Visible = false;
+ }
+
+ if (mouseEvent.LB && IsMouseOver(mouseEvent))
+ {
+ if (Buttons[_ButtonBack].Selected)
+ _Back();
+
+ if (Buttons[_ButtonNext].Selected)
+ _Next();
+
+ if (!_OnAdd())
+ _OnRemove();
+ }
+
+ if (mouseEvent.RB)
+ _Back();
+
+ return true;
+ }
+
+ public override void OnShow()
+ {
+ base.OnShow();
+
+ if (!_ButtonsAdded)
+ {
+ _AddButtonPlayerDestination();
+ _AddButtonPlayerChoose();
+ _ButtonsAdded = true;
+ }
+
+ _UpdateButtonPlayerDestination();
+ _UpdateButtonPlayerChoose();
+
+ _UpdateButtonNext();
+ }
+
+ public override bool UpdateGame()
+ {
+ return true;
+ }
+
+ public override bool Draw()
+ {
+ base.Draw();
+ if (_ChooseAvatarStatic.Visible)
+ _ChooseAvatarStatic.Draw();
+ return true;
+ }
+
+ private void _AddButtonPlayerDestination()
+ {
+ Buttons[_ButtonPlayerDestination].Visible = false;
+ _PlayerDestinationButtons = new List();
+ int row = 0;
+ int column = 0;
+ for (int i = 1; i <= _PartyMode.GetMaxPlayer(); i++)
+ {
+ 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);
+ column++;
+ if (column >= _PlayerDestinationButtonsNumH)
+ {
+ row++;
+ column = 0;
+ }
+ b.Visible = true;
+ b.Enabled = false;
+ AddButton(b);
+ }
+ }
+
+ private void _AddButtonPlayerChoose()
+ {
+ Buttons[_ButtonPlayerChoose].Visible = false;
+ _PlayerChooseButtons = new List();
+ int row = 0;
+ int column = 0;
+ for (int i = 1; i <= _PlayerChooseButtonsNumH * _PlayerChooseButtonsNumW; i++)
+ {
+ 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();
+ pcb.Button = b;
+ pcb.ProfileID = -1;
+ _PlayerChooseButtons.Add(pcb);
+ column++;
+ if (column >= _PlayerChooseButtonsNumH)
+ {
+ row++;
+ column = 0;
+ }
+ b.Visible = true;
+ b.Enabled = false;
+ AddButton(b);
+ }
+ }
+
+ private void _UpdateButtonPlayerChoose()
+ {
+ _UpdateVisibleProfiles();
+ if ((_PlayerChooseButtonsNumW * _PlayerChooseButtonsNumH) * (_PlayerChooseButtonsOffset + 1) - _PlayerChooseButtonsVisibleProfiles.Count >=
+ (_PlayerChooseButtonsNumW * _PlayerChooseButtonsNumH) * _PlayerChooseButtonsOffset)
+ _UpdateButtonPlayerChoose(_PlayerChooseButtonsOffset - 1);
+ else
+ _UpdateButtonPlayerChoose(_PlayerChooseButtonsOffset);
+ }
+
+ private void _UpdateButtonPlayerChoose(int offset)
+ {
+ int numButtonPlayerChoose = _PlayerChooseButtonsNumW * _PlayerChooseButtonsNumH;
+ if (offset < 0)
+ offset = 0;
+
+ if (numButtonPlayerChoose * (offset + 1) - _PlayerChooseButtonsVisibleProfiles.Count <= numButtonPlayerChoose)
+ {
+ for (int i = 0; i < numButtonPlayerChoose; i++)
+ {
+ if ((i + offset * numButtonPlayerChoose) < _PlayerChooseButtonsVisibleProfiles.Count)
+ {
+ _PlayerChooseButtons[i].ProfileID = _PlayerChooseButtonsVisibleProfiles[i + offset * numButtonPlayerChoose];
+ _PlayerChooseButtons[i].Button.Text.Text = CBase.Profiles.GetProfiles()[_PlayerChooseButtonsVisibleProfiles[i + offset * numButtonPlayerChoose]].PlayerName;
+ _PlayerChooseButtons[i].Button.Texture = CBase.Profiles.GetProfiles()[_PlayerChooseButtonsVisibleProfiles[i + offset * numButtonPlayerChoose]].Avatar.Texture;
+ _PlayerChooseButtons[i].Button.SelTexture = CBase.Profiles.GetProfiles()[_PlayerChooseButtonsVisibleProfiles[i + offset * numButtonPlayerChoose]].Avatar.Texture;
+ _PlayerChooseButtons[i].Button.Color = new SColorF(1, 1, 1, 0.6f);
+ _PlayerChooseButtons[i].Button.SelColor = new SColorF(1, 1, 1, 1);
+ _PlayerChooseButtons[i].Button.Enabled = true;
+ }
+ else
+ {
+ _PlayerChooseButtons[i].ProfileID = -1;
+ _PlayerChooseButtons[i].Button.Text.Text = String.Empty;
+ _PlayerChooseButtons[i].Button.Texture = Buttons[_ButtonPlayerChoose].Texture;
+ _PlayerChooseButtons[i].Button.SelTexture = Buttons[_ButtonPlayerChoose].SelTexture;
+ _PlayerChooseButtons[i].Button.Color = Buttons[_ButtonPlayerChoose].Color;
+ _PlayerChooseButtons[i].Button.SelColor = Buttons[_ButtonPlayerChoose].SelColor;
+ _PlayerChooseButtons[i].Button.Enabled = false;
+ }
+ }
+ }
+ }
+
+ private void _UpdateVisibleProfiles()
+ {
+ _PlayerChooseButtonsVisibleProfiles.Clear();
+ for (int i = 0; i < CBase.Profiles.GetProfiles().Length; i++)
+ {
+ bool visible = false;
+ //Show profile only if active
+ if (CBase.Profiles.GetProfiles()[i].Active == EOffOn.TR_CONFIG_ON)
+ {
+ visible = true;
+
+ for (int p = 0; p < _Data.ScreenNames.ProfileIDs.Count; p++)
+ {
+ //Don't show profile if is selected
+ if (_Data.ScreenNames.ProfileIDs[p] == i)
+ {
+ visible = false;
+ break;
+ }
+ }
+ }
+ if (visible)
+ _PlayerChooseButtonsVisibleProfiles.Add(i);
+ }
+ }
+
+ private void _UpdateButtonPlayerDestination()
+ {
+ for (int i = 0; i < _PlayerDestinationButtons.Count; i++)
+ {
+ if (_NumPlayer > i)
+ {
+ _PlayerDestinationButtons[i].Visible = true;
+ _PlayerDestinationButtons[i].Enabled = true;
+ }
+ else
+ {
+ _PlayerDestinationButtons[i].Visible = false;
+ _PlayerDestinationButtons[i].Enabled = false;
+ }
+ }
+ for (int i = 0; i < _NumPlayer; i++)
+ {
+ if (i < _Data.ScreenNames.ProfileIDs.Count)
+ {
+ if (_Data.ScreenNames.ProfileIDs[i] != -1)
+ {
+ _PlayerDestinationButtons[i].Color = new SColorF(1, 1, 1, 0.6f);
+ _PlayerDestinationButtons[i].SelColor = new SColorF(1, 1, 1, 1);
+ _PlayerDestinationButtons[i].Texture = CBase.Profiles.GetProfiles()[_Data.ScreenNames.ProfileIDs[i]].Avatar.Texture;
+ _PlayerDestinationButtons[i].SelTexture = CBase.Profiles.GetProfiles()[_Data.ScreenNames.ProfileIDs[i]].Avatar.Texture;
+ _PlayerDestinationButtons[i].Text.Text = CBase.Profiles.GetProfiles()[_Data.ScreenNames.ProfileIDs[i]].PlayerName;
+ _PlayerDestinationButtons[i].Enabled = true;
+ }
+ }
+ else
+ {
+ _PlayerDestinationButtons[i].Color = Buttons[_ButtonPlayerDestination].Color;
+ _PlayerDestinationButtons[i].SelColor = Buttons[_ButtonPlayerDestination].SelColor;
+ _PlayerDestinationButtons[i].Texture = Buttons[_ButtonPlayerDestination].Texture;
+ _PlayerDestinationButtons[i].SelTexture = Buttons[_ButtonPlayerDestination].SelTexture;
+ _PlayerDestinationButtons[i].Text.Text = String.Empty;
+ _PlayerDestinationButtons[i].Enabled = false;
+ }
+ }
+ }
+
+ private void _UpdateButtonNext()
+ {
+ if (_Data.ScreenNames.ProfileIDs.Count == _NumPlayer)
+ {
+ Buttons[_ButtonNext].Visible = true;
+ SetInteractionToButton(Buttons[_ButtonNext]);
+ }
+ else
+ Buttons[_ButtonNext].Visible = false;
+ }
+
+ private bool _OnAdd()
+ {
+ for (int i = 0; i < _PlayerChooseButtons.Count; i++)
+ {
+ if (_PlayerChooseButtons[i].Button.Selected && _PlayerChooseButtons[i].ProfileID != -1)
+ {
+ if (_Data.ScreenNames.ProfileIDs.Count < _NumPlayer)
+ {
+ _Data.ScreenNames.ProfileIDs.Add(_PlayerChooseButtons[i].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].Enabled = true;
+ //Update Tiles-List
+ _UpdateButtonPlayerChoose();
+ CheckInteraction();
+ return true;
+ }
+ }
+ }
+ return false;
+ }
+
+ private bool _OnRemove()
+ {
+ for (int i = 0; i < _PlayerDestinationButtons.Count; i++)
+ {
+ if (_PlayerDestinationButtons[i].Selected)
+ {
+ if ((i + 1) <= _Data.ScreenNames.ProfileIDs.Count)
+ {
+ _Data.ScreenNames.ProfileIDs.RemoveAt(i);
+ _UpdateButtonNext();
+ _UpdateButtonPlayerDestination();
+ _UpdateButtonPlayerChoose();
+ CheckInteraction();
+ return true;
+ }
+ }
+ }
+ return false;
+ }
+
+ private void _Back()
+ {
+ _Data.ScreenNames.FadeToConfig = true;
+ _Data.ScreenNames.FadeToMain = false;
+ _PartyMode.DataFromScreen(ThemeName, _Data);
+ }
+
+ private void _Next()
+ {
+ _Data.ScreenNames.FadeToConfig = false;
+ _Data.ScreenNames.FadeToMain = true;
+ _PartyMode.DataFromScreen(ThemeName, _Data);
+ }
+ }
+}
\ No newline at end of file
diff --git a/PartyModes/PartyModeChallengeMedley/PartyModeChallengeMedley.csproj b/PartyModes/PartyModeChallengeMedley/PartyModeChallengeMedley.csproj
index 0990e176..9a03d28d 100644
--- a/PartyModes/PartyModeChallengeMedley/PartyModeChallengeMedley.csproj
+++ b/PartyModes/PartyModeChallengeMedley/PartyModeChallengeMedley.csproj
@@ -107,12 +107,12 @@
-
+
-
-
-
-
+
+
+
+
@@ -123,10 +123,7 @@
-
-
-
diff --git a/PartyModes/PartyModeChallengeMedley/PartyScreenChallengeMedleyConfig.cs b/PartyModes/PartyModeChallengeMedley/PartyScreenChallengeMedleyConfig.cs
deleted file mode 100644
index 4bdecc8d..00000000
--- a/PartyModes/PartyModeChallengeMedley/PartyScreenChallengeMedleyConfig.cs
+++ /dev/null
@@ -1,227 +0,0 @@
-using System;
-using System.Windows.Forms;
-using VocaluxeLib.Menu;
-
-namespace VocaluxeLib.PartyModes.ChallengeMedley
-{
- public class PartyScreenChallengeMedleyConfig : CMenuParty
- {
- // Version number for theme files. Increment it, if you've changed something on the theme files!
- protected override int _ScreenVersion
- {
- get { return 1; }
- }
-
- 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;
-
- private DataFromScreen Data;
-
- public override void Init()
- {
- base.Init();
-
- _ThemeSelectSlides = new string[] {SelectSlideNumPlayers, SelectSlideNumMics, SelectSlideNumRounds};
- _ThemeButtons = new string[] {ButtonNext, ButtonBack};
-
- Data = new DataFromScreen();
- FromScreenConfig config = new FromScreenConfig();
- config.NumPlayer = 4;
- config.NumPlayerAtOnce = 2;
- config.NumRounds = 12;
- Data.ScreenConfig = config;
- }
-
- public override void DataToScreen(object ReceivedData)
- {
- DataToScreenConfig config = new DataToScreenConfig();
-
- try
- {
- config = (DataToScreenConfig)ReceivedData;
- Data.ScreenConfig.NumPlayer = config.NumPlayer;
- Data.ScreenConfig.NumPlayerAtOnce = config.NumPlayerAtOnce;
- Data.ScreenConfig.NumRounds = config.NumRounds;
- }
- catch (Exception e)
- {
- 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)
- {
- base.HandleInput(keyEvent);
-
- if (keyEvent.KeyPressed) {}
- else
- {
- switch (keyEvent.Key)
- {
- case Keys.Back:
- case Keys.Escape:
- Back();
- break;
-
- case Keys.Enter:
- UpdateSlides();
-
- if (Buttons[ButtonBack].Selected)
- Back();
-
- if (Buttons[ButtonNext].Selected)
- Next();
- break;
-
- case Keys.Left:
- UpdateSlides();
- break;
-
- case Keys.Right:
- UpdateSlides();
- break;
- }
- }
- return true;
- }
-
- public override bool HandleMouse(MouseEvent mouseEvent)
- {
- base.HandleMouse(mouseEvent);
-
- if (mouseEvent.LB && IsMouseOver(mouseEvent))
- {
- UpdateSlides();
- if (Buttons[ButtonBack].Selected)
- Back();
-
- if (Buttons[ButtonNext].Selected)
- Next();
- }
-
- if (mouseEvent.RB)
- Back();
-
- return true;
- }
-
- public override void OnShow()
- {
- base.OnShow();
-
- _MaxNumMics = CBase.Config.GetMaxNumMics();
- if (_MaxNumMics > 6)
- _MaxNumMics = 6;
-
- _MaxNumRounds = _PartyMode.GetMaxNumRounds();
-
- RebuildSlides();
- }
-
- public override bool UpdateGame()
- {
- return true;
- }
-
- public override bool Draw()
- {
- base.Draw();
- return true;
- }
-
- private void RebuildSlides()
- {
- // build num player slide (min player ... max player);
- SelectSlides[SelectSlideNumPlayers].Clear();
- for (int i = _PartyMode.GetMinPlayer(); i <= _PartyMode.GetMaxPlayer(); i++)
- SelectSlides[SelectSlideNumPlayers].AddValue(i.ToString());
- SelectSlides[SelectSlideNumPlayers].Selection = Data.ScreenConfig.NumPlayer - _PartyMode.GetMinPlayer();
-
- UpdateMicsAtOnce();
- SetRoundSteps();
- UpdateSlideRounds();
- }
-
- private void UpdateSlides()
- {
- int player = Data.ScreenConfig.NumPlayer;
- int mics = Data.ScreenConfig.NumPlayerAtOnce;
- Data.ScreenConfig.NumPlayer = SelectSlides[SelectSlideNumPlayers].Selection + _PartyMode.GetMinPlayer();
- Data.ScreenConfig.NumPlayerAtOnce = SelectSlides[SelectSlideNumMics].Selection + _PartyMode.GetMinPlayer();
- Data.ScreenConfig.NumRounds = (SelectSlides[SelectSlideNumRounds].Selection + 1) * _RoundSteps;
-
- UpdateMicsAtOnce();
- SetRoundSteps();
-
- if (player != Data.ScreenConfig.NumPlayer || mics != Data.ScreenConfig.NumPlayerAtOnce)
- {
- int num = CHelper.nCk(Data.ScreenConfig.NumPlayer, Data.ScreenConfig.NumPlayerAtOnce);
- while (num > _MaxNumRounds)
- num -= _RoundSteps;
- Data.ScreenConfig.NumRounds = num;
- }
-
- UpdateSlideRounds();
- }
-
- private void UpdateMicsAtOnce()
- {
- //Data.ScreenConfig.NumPlayerAtOnce
- int MaxNum = _MaxNumMics;
- if (Data.ScreenConfig.NumPlayer < _MaxNumMics)
- MaxNum = Data.ScreenConfig.NumPlayer;
-
- if (Data.ScreenConfig.NumPlayerAtOnce > MaxNum)
- Data.ScreenConfig.NumPlayerAtOnce = MaxNum;
-
- // build mics at once slide
- SelectSlides[SelectSlideNumMics].Clear();
- for (int i = 1; i <= MaxNum; i++)
- SelectSlides[SelectSlideNumMics].AddValue(i.ToString());
- SelectSlides[SelectSlideNumMics].Selection = Data.ScreenConfig.NumPlayerAtOnce - _PartyMode.GetMinPlayer();
- }
-
- private void UpdateSlideRounds()
- {
- // build num rounds slide
- SelectSlides[SelectSlideNumRounds].Clear();
- for (int i = _RoundSteps; i <= _MaxNumRounds; i += _RoundSteps)
- SelectSlides[SelectSlideNumRounds].AddValue(i.ToString());
- SelectSlides[SelectSlideNumRounds].Selection = Data.ScreenConfig.NumRounds / _RoundSteps - 1;
- }
-
- private void SetRoundSteps()
- {
- if (Data.ScreenConfig.NumPlayerAtOnce < 1 || Data.ScreenConfig.NumPlayer < 1 || Data.ScreenConfig.NumPlayerAtOnce > Data.ScreenConfig.NumPlayer)
- {
- _RoundSteps = 1;
- return;
- }
-
- int res = Data.ScreenConfig.NumPlayer / Data.ScreenConfig.NumPlayerAtOnce;
- int mod = Data.ScreenConfig.NumPlayer % Data.ScreenConfig.NumPlayerAtOnce;
-
- if (mod == 0)
- _RoundSteps = res;
- else
- _RoundSteps = Data.ScreenConfig.NumPlayer;
- }
-
- private void Back()
- {
- FadeTo(EScreens.ScreenParty);
- }
-
- private void Next()
- {
- _PartyMode.DataFromScreen(ThemeName, Data);
- }
- }
-}
\ No newline at end of file
diff --git a/PartyModes/PartyModeChallengeMedley/PartyScreenChallengeMedleyMain.cs b/PartyModes/PartyModeChallengeMedley/PartyScreenChallengeMedleyMain.cs
deleted file mode 100644
index fcd47460..00000000
--- a/PartyModes/PartyModeChallengeMedley/PartyScreenChallengeMedleyMain.cs
+++ /dev/null
@@ -1,660 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Windows.Forms;
-using VocaluxeLib.Menu;
-
-namespace VocaluxeLib.PartyModes.ChallengeMedley
-{
- struct TableRow
- {
- public CText Pos;
- public CText Name;
- public CText Rounds;
- public CText Won;
- public CText SingPoints;
- public CText GamePoints;
- }
-
- class RoundsTableRow
- {
- public CText Number;
- public List TextPlayer;
- public List TextScores;
- }
-
- public class PartyScreenChallengeMedleyMain : CMenuParty
- {
- // Version number for theme files. Increment it, if you've changed something on the theme files!
- protected override int _ScreenVersion
- {
- get { return 1; }
- }
-
- 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";
-
- 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";
-
- private const string StaticPopupBG = "StaticPopupBG";
- private const string StaticNextPlayer = "StaticNextPlayer";
-
- private bool ExitPopupVisible;
-
- private DataFromScreen Data;
- private DataToScreenMain GameState;
- private List PlayerTable;
- private List RoundsTable;
-
- private List NextPlayerTexts;
- private List NextPlayerStatics;
-
- private SRectF RoundsTableScrollArea;
- private SRectF PlayerTableScrollArea;
- private int RoundsTableOffset;
- private int PlayerTableOffset;
- private int NumPlayerVisible = 10;
- private int NumRoundsVisible = 3;
-
- public PartyScreenChallengeMedleyMain()
- {
- Data = new DataFromScreen();
- Data.ScreenMain = new FromScreenMain();
- }
-
- public override void Init()
- {
- base.Init();
-
- _ThemeTexts = new string[]
- {
- TextPosition, TextPlayerName, TextNumPlayed, TextWon, TextSingPoints, TextGamePoints, TextNextPlayer, TextPopupReallyExit, TextRoundNumber, TextRoundPlayer,
- TextRoundScore, TextFinishMessage, TextFinishPlayerWin, TextNextPlayerMessage
- };
- _ThemeButtons = new string[]
- {ButtonNextRound, ButtonBack, ButtonExit, ButtonPopupYes, ButtonPopupNo, ButtonPlayerScrollDown, ButtonPlayerScrollUp, ButtonRoundsScrollDown, ButtonRoundsScrollUp};
- _ThemeStatics = new string[] {StaticPopupBG, StaticNextPlayer};
- }
-
- public override void LoadTheme(string XmlPath)
- {
- base.LoadTheme(XmlPath);
-
- GameState = new DataToScreenMain();
- BuildPlayerTable();
- CreateRoundsTable();
- NextPlayerTexts = new List();
- NextPlayerStatics = new List();
-
- for (int i = 0; i < _PartyMode.GetMaxPlayer(); i++)
- {
- NextPlayerTexts.Add(GetNewText(Texts[TextNextPlayer]));
- AddText(NextPlayerTexts[NextPlayerTexts.Count - 1]);
- NextPlayerStatics.Add(GetNewStatic(Statics[StaticNextPlayer]));
- AddStatic(NextPlayerStatics[NextPlayerStatics.Count - 1]);
- }
- }
-
- public override void DataToScreen(object ReceivedData)
- {
- DataToScreenMain data = new DataToScreenMain();
-
- try
- {
- data = (DataToScreenMain)ReceivedData;
- GameState = data;
- }
- catch (Exception e)
- {
- 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)
- {
- base.HandleInput(keyEvent);
-
- if (keyEvent.KeyPressed) {}
- else
- {
- switch (keyEvent.Key)
- {
- case Keys.Back:
- case Keys.Escape:
- if (!ExitPopupVisible)
- {
- if (GameState.CurrentRoundNr == 1)
- Back();
- else
- ShowPopup(true);
- }
- else
- ShowPopup(false);
- break;
-
- case Keys.Enter:
- if (!ExitPopupVisible)
- {
- if (Buttons[ButtonNextRound].Selected)
- NextRound();
- if (Buttons[ButtonBack].Selected && GameState.CurrentRoundNr == 1)
- Back();
- if (Buttons[ButtonExit].Selected && GameState.CurrentRoundNr > 1)
- ShowPopup(true);
- if (Buttons[ButtonPlayerScrollUp].Selected)
- ScrollPlayerTable(-1);
- if (Buttons[ButtonPlayerScrollDown].Selected)
- ScrollPlayerTable(1);
- if (Buttons[ButtonRoundsScrollUp].Selected)
- ScrollRoundsTable(-1);
- if (Buttons[ButtonRoundsScrollDown].Selected)
- ScrollRoundsTable(1);
- }
- else
- {
- if (Buttons[ButtonPopupYes].Selected)
- EndParty();
- if (Buttons[ButtonPopupNo].Selected)
- ShowPopup(false);
- }
- break;
- }
- }
- return true;
- }
-
- public override bool HandleMouse(MouseEvent mouseEvent)
- {
- base.HandleMouse(mouseEvent);
-
- if (mouseEvent.LB && IsMouseOver(mouseEvent))
- {
- if (!ExitPopupVisible)
- {
- if (Buttons[ButtonNextRound].Selected)
- NextRound();
- if (Buttons[ButtonBack].Selected && GameState.CurrentRoundNr == 1)
- Back();
- if (Buttons[ButtonExit].Selected && GameState.CurrentRoundNr > 1)
- ShowPopup(true);
- if (Buttons[ButtonPlayerScrollUp].Selected)
- ScrollPlayerTable(-1);
- if (Buttons[ButtonPlayerScrollDown].Selected)
- ScrollPlayerTable(1);
- if (Buttons[ButtonRoundsScrollUp].Selected)
- ScrollRoundsTable(-1);
- if (Buttons[ButtonRoundsScrollDown].Selected)
- ScrollRoundsTable(1);
- }
- else
- {
- if (Buttons[ButtonPopupYes].Selected)
- EndParty();
- if (Buttons[ButtonPopupNo].Selected)
- ShowPopup(false);
- }
- }
-
- if (mouseEvent.RB)
- {
- if (!ExitPopupVisible)
- {
- if (GameState.CurrentRoundNr == 1)
- Back();
- else
- ShowPopup(true);
- }
- else
- ShowPopup(false);
- }
-
- if (mouseEvent.Wheel != 0)
- {
- if (CHelper.IsInBounds(RoundsTableScrollArea, mouseEvent))
- ScrollRoundsTable(mouseEvent.Wheel);
- if (CHelper.IsInBounds(PlayerTableScrollArea, mouseEvent))
- ScrollPlayerTable(mouseEvent.Wheel);
- }
-
- return true;
- }
-
- public override void OnShow()
- {
- base.OnShow();
-
- PlayerTableOffset = 0;
- RoundsTableOffset = 0;
-
- UpdatePlayerTable();
- UpdateNextPlayerPositions();
- UpdateNextPlayerContents();
- if (GameState.CurrentRoundNr == 1)
- BuildRoundsTable();
- else
- ScrollRoundsTable(GameState.CurrentRoundNr - 2);
- UpdateRoundsTable();
-
- if (GameState.CurrentRoundNr == 1)
- {
- Buttons[ButtonBack].Visible = true;
- Buttons[ButtonExit].Visible = false;
- }
- else
- {
- Buttons[ButtonBack].Visible = false;
- Buttons[ButtonExit].Visible = true;
- }
-
- if (GameState.CurrentRoundNr <= GameState.Combs.Count)
- {
- Buttons[ButtonNextRound].Visible = true;
- Texts[TextFinishMessage].Visible = false;
- Texts[TextFinishPlayerWin].Visible = false;
- SetInteractionToButton(Buttons[ButtonNextRound]);
- }
- else
- {
- Buttons[ButtonNextRound].Visible = false;
- Texts[TextFinishMessage].Visible = true;
- Texts[TextFinishPlayerWin].Visible = true;
- Texts[TextFinishPlayerWin].Text = GetPlayerWinString();
- SetInteractionToButton(Buttons[ButtonExit]);
- }
-
- ShowPopup(false);
- }
-
- public override bool UpdateGame()
- {
- return true;
- }
-
- public override bool Draw()
- {
- base.Draw();
- return true;
- }
-
- private void NextRound()
- {
- Data.ScreenMain.FadeToNameSelection = false;
- Data.ScreenMain.FadeToSongSelection = true;
- _PartyMode.DataFromScreen(ThemeName, Data);
- }
-
- private void EndParty()
- {
- FadeTo(EScreens.ScreenParty);
- }
-
- private void ShowPopup(bool Visible)
- {
- ExitPopupVisible = Visible;
-
- Statics[StaticPopupBG].Visible = ExitPopupVisible;
- Texts[TextPopupReallyExit].Visible = ExitPopupVisible;
- Buttons[ButtonPopupYes].Visible = ExitPopupVisible;
- Buttons[ButtonPopupNo].Visible = ExitPopupVisible;
-
- if (ExitPopupVisible)
- SetInteractionToButton(Buttons[ButtonPopupNo]);
- }
-
- private void Back()
- {
- Data.ScreenMain.FadeToNameSelection = true;
- Data.ScreenMain.FadeToSongSelection = false;
- _PartyMode.DataFromScreen(ThemeName, Data);
- }
-
- private void UpdateNextPlayerPositions()
- {
- 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++)
- {
- //static
- NextPlayerStatics[i].Rect.X = x;
- NextPlayerStatics[i].Rect.Y = static_y;
- NextPlayerStatics[i].Visible = true;
- //text
- NextPlayerTexts[i].X = x + Statics[StaticNextPlayer].Rect.W / 2;
- NextPlayerTexts[i].Y = text_y;
- NextPlayerTexts[i].Visible = true;
-
- x += Statics[StaticNextPlayer].Rect.W + 15;
- }
- for (int i = GameState.NumPlayerAtOnce; i < _PartyMode.GetMaxPlayer(); i++)
- {
- NextPlayerStatics[i].Visible = false;
- NextPlayerTexts[i].Visible = false;
- }
- }
-
- private void UpdateNextPlayerContents()
- {
- if (GameState.CurrentRoundNr <= GameState.Combs.Count)
- {
- 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);
- }
- }
- else
- {
- Texts[TextNextPlayerMessage].Visible = false;
- for (int i = 0; i < GameState.NumPlayerAtOnce; i++)
- {
- NextPlayerStatics[i].Visible = false;
- NextPlayerTexts[i].Visible = false;
- }
- }
- }
-
- private void CreateRoundsTable()
- {
- //Create lists
- RoundsTable = new List();
- for (int i = 0; i < 5; i++)
- {
- RoundsTableRow rtr = new RoundsTableRow();
- rtr.TextPlayer = new List();
- rtr.TextScores = new List();
- RoundsTable.Add(rtr);
- }
- //Create statics and texts for rounds
- for (int round = 0; round < RoundsTable.Count; round++)
- {
- //Round-number
- CText text = GetNewText(Texts[TextRoundNumber]);
- AddText(text);
- RoundsTable[round].Number = text;
- for (int row = 0; row < 2; row++)
- {
- for (int column = 0; column < 3; column++)
- {
- //Player
- text = GetNewText(Texts[TextRoundPlayer]);
- AddText(text);
- RoundsTable[round].TextPlayer.Add(text);
- //Score
- text = GetNewText(Texts[TextRoundScore]);
- AddText(text);
- RoundsTable[round].TextScores.Add(text);
- }
- }
- }
- }
-
- private void BuildRoundsTable()
- {
- RoundsTableScrollArea = new SRectF();
-
- int NumPlayerInOneRow = 3;
- if (GameState.NumPlayerAtOnce <= NumPlayerInOneRow)
- NumRoundsVisible = 5;
- else
- NumRoundsVisible = 3;
-
- if (NumRoundsVisible > GameState.Combs.Count)
- NumRoundsVisible = GameState.Combs.Count;
-
- float x = Texts[TextRoundNumber].X;
- float y = Texts[TextRoundNumber].Y;
-
- RoundsTableScrollArea.X = x;
- RoundsTableScrollArea.Y = y;
- RoundsTableScrollArea.W = CBase.Settings.GetRenderW() - Texts[TextRoundNumber].X - 20;
-
- float delta = Texts[TextRoundNumber].Height;
-
- //Update statics and texts for rounds
- for (int round = 0; round < RoundsTable.Count; round++)
- {
- //Round-number
- RoundsTable[round].Number.X = x;
- RoundsTable[round].Number.Y = y;
- int NumInnerRows = (int)Math.Ceiling(GameState.NumPlayerAtOnce / ((double)NumPlayerInOneRow));
- for (int row = 0; row < NumInnerRows; row++)
- {
- int num = (row + 1) * NumPlayerInOneRow;
- int NumPlayerInThisRow = NumPlayerInOneRow;
- if (num > GameState.NumPlayerAtOnce)
- {
- num = GameState.NumPlayerAtOnce;
- NumPlayerInThisRow = GameState.NumPlayerAtOnce - (row * NumPlayerInOneRow);
- }
- for (int column = row * NumPlayerInOneRow; column < num; column++)
- {
- //Player
- 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;
- //Score
- RoundsTable[round].TextScores[column] = RoundsTable[round].TextScores[column];
- RoundsTable[round].TextScores[column].X = _x;
- RoundsTable[round].TextScores[column].Y = y + delta;
- RoundsTable[round].TextScores[column].MaxWidth = maxw;
- }
- y = y + delta + delta;
- }
- y = y + delta / 2;
- }
- RoundsTableScrollArea.H = y - RoundsTableScrollArea.Y;
- }
-
- private void UpdateRoundsTable()
- {
- SProfile[] profile = CBase.Profiles.GetProfiles();
- for (int i = 0; i < RoundsTable.Count; i++)
- {
- for (int p = 0; p < RoundsTable[i].TextPlayer.Count; p++)
- {
- if (GameState.Combs.Count > i + RoundsTableOffset && GameState.Combs[i + RoundsTableOffset].Player.Count > p)
- {
- RoundsTable[i].Number.Visible = true;
- RoundsTable[i].TextPlayer[p].Visible = true;
- RoundsTable[i].TextScores[p].Visible = true;
- RoundsTable[i].Number.Text = (i + 1 + RoundsTableOffset).ToString() + ")";
- int pID = GameState.ProfileIDs[GameState.Combs[i + RoundsTableOffset].Player[p]];
- RoundsTable[i].TextPlayer[p].Text = profile[pID].PlayerName;
- if ((GameState.CurrentRoundNr - 1) > i + RoundsTableOffset)
- RoundsTable[i].TextScores[p].Text = GameState.Results[i + RoundsTableOffset, p].ToString();
- else
- RoundsTable[i].TextScores[p].Text = "";
- }
- else
- {
- RoundsTable[i].TextPlayer[p].Visible = false;
- RoundsTable[i].TextScores[p].Visible = false;
- }
- }
- if (GameState.Combs.Count < i + RoundsTableOffset || i + 1 > NumRoundsVisible)
- {
- RoundsTable[i].Number.Visible = false;
- for (int p = 0; p < RoundsTable[i].TextPlayer.Count; p++)
- {
- RoundsTable[i].TextPlayer[p].Visible = false;
- RoundsTable[i].TextScores[p].Visible = false;
- }
- }
- }
-
- Buttons[ButtonRoundsScrollUp].Visible = RoundsTableOffset > 0;
- Buttons[ButtonRoundsScrollDown].Visible = GameState.Combs.Count - NumRoundsVisible - RoundsTableOffset > 0;
- }
-
- private void BuildPlayerTable()
- {
- PlayerTableScrollArea = new SRectF();
- PlayerTableScrollArea.X = Texts[TextPosition].X;
- PlayerTableScrollArea.Y = Texts[TextPosition].Y;
- PlayerTableScrollArea.W = Texts[TextGamePoints].X - Texts[TextPosition].X;
-
- PlayerTable = new List();
- float delta = Texts[TextPosition].Height * 1.2f;
-
- float h = 0;
-
- for (int i = 0; i < 10; i++)
- {
- TableRow row = new TableRow();
-
- 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);
- row.Rounds.Y += delta * (i + 1);
- row.Won.Y += delta * (i + 1);
- row.SingPoints.Y += delta * (i + 1);
- row.GamePoints.Y += delta * (i + 1);
-
- row.Pos.Text = (i + 1).ToString() + ".";
-
- row.Pos.Visible = false;
- row.Name.Visible = false;
- row.Rounds.Visible = false;
- row.Won.Visible = false;
- row.SingPoints.Visible = false;
- row.GamePoints.Visible = false;
-
- AddText(row.Pos);
- AddText(row.Name);
- AddText(row.Rounds);
- AddText(row.Won);
- AddText(row.SingPoints);
- AddText(row.GamePoints);
-
- PlayerTable.Add(row);
-
- h = delta * (i + 1);
- }
- PlayerTableScrollArea.H = h + delta;
- }
-
- private void UpdatePlayerTable()
- {
- SProfile[] profiles = CBase.Profiles.GetProfiles();
-
- for (int i = 0; i < PlayerTable.Count; i++)
- {
- TableRow row = PlayerTable[i];
-
- if (i + PlayerTableOffset < GameState.ResultTable.Count)
- {
- row.Pos.Visible = true;
- row.Name.Visible = true;
- row.Rounds.Visible = true;
- row.Won.Visible = true;
- row.SingPoints.Visible = true;
- 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();
- }
- else
- {
- row.Pos.Visible = false;
- row.Name.Visible = false;
- row.Rounds.Visible = false;
- row.Won.Visible = false;
- row.SingPoints.Visible = false;
- row.GamePoints.Visible = false;
- }
- }
-
- Buttons[ButtonPlayerScrollUp].Visible = PlayerTableOffset > 0;
- Buttons[ButtonPlayerScrollDown].Visible = GameState.ProfileIDs.Count - NumPlayerVisible - PlayerTableOffset > 0;
- }
-
- private void ScrollPlayerTable(int Offset)
- {
- if (GameState.ProfileIDs.Count <= NumPlayerVisible)
- PlayerTableOffset = 0;
- else if (Offset < 0 && PlayerTableOffset + Offset >= 0)
- PlayerTableOffset += Offset;
- else if (Offset < 0 && PlayerTableOffset + Offset < 0)
- PlayerTableOffset = 0;
- else if (Offset > 0 && PlayerTableOffset + Offset <= GameState.ProfileIDs.Count - NumPlayerVisible)
- PlayerTableOffset += Offset;
- else if (Offset > 0 && PlayerTableOffset + Offset > GameState.ProfileIDs.Count - NumPlayerVisible)
- PlayerTableOffset = GameState.ProfileIDs.Count - NumPlayerVisible;
-
- UpdatePlayerTable();
- }
-
- private void ScrollRoundsTable(int Offset)
- {
- if (GameState.Combs.Count <= NumRoundsVisible)
- RoundsTableOffset = 0;
- else if (Offset < 0 && RoundsTableOffset + Offset >= 0)
- RoundsTableOffset += Offset;
- else if (Offset < 0 && RoundsTableOffset + Offset < 0)
- RoundsTableOffset = 0;
- else if (Offset > 0 && RoundsTableOffset + Offset <= GameState.Combs.Count - NumRoundsVisible)
- RoundsTableOffset += Offset;
- else if (Offset > 0 && RoundsTableOffset + Offset > GameState.Combs.Count - NumRoundsVisible)
- RoundsTableOffset = GameState.Combs.Count - NumRoundsVisible;
-
- UpdateRoundsTable();
- }
-
- private string GetPlayerWinString()
- {
- string s = "";
- SProfile[] profiles = CBase.Profiles.GetProfiles();
-
- for (int i = 0; i < GameState.ResultTable.Count; i++)
- {
- if (GameState.ResultTable[i].Position == 1)
- {
- if (i > 0)
- s += ", ";
- s += profiles[GameState.ResultTable[i].PlayerID].PlayerName;
- }
- else
- break;
- }
-
- return s;
- }
- }
-}
\ No newline at end of file
diff --git a/PartyModes/PartyModeChallengeMedley/PartyScreenChallengeMedleyNames.cs b/PartyModes/PartyModeChallengeMedley/PartyScreenChallengeMedleyNames.cs
deleted file mode 100644
index 700bbcaa..00000000
--- a/PartyModes/PartyModeChallengeMedley/PartyScreenChallengeMedleyNames.cs
+++ /dev/null
@@ -1,504 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Windows.Forms;
-using VocaluxeLib.Menu;
-
-namespace VocaluxeLib.PartyModes.ChallengeMedley
-{
- public class PartyScreenChallengeMedleyNames : CMenuParty
- {
- // Version number for theme files. Increment it, if you've changed something on the theme files!
- protected override int _ScreenVersion
- {
- get { return 1; }
- }
-
- private const string ButtonNext = "ButtonNext";
- private const string ButtonBack = "ButtonBack";
- private const string ButtonPlayerDestination = "ButtonPlayerDestination";
- private const string ButtonPlayerChoose = "ButtonPlayerChoose";
-
- private List PlayerChooseButtons;
- private List PlayerDestinationButtons;
- //PlayerDestinationButtons-Option
- private const int PlayerDestinationButtonsNumH = 3;
- private const int PlayerDestinationButtonsNumW = 4;
- private const int PlayerDestinationButtonsFirstX = 900;
- private const int PlayerDestinationButtonsFirstY = 105;
- private const int PlayerDestinationButtonsSpaceH = 15;
- private const int PlayerDestinationButtonsSpaceW = 25;
- //PlayerChooseButtons-Option
- private List PlayerChooseButtonsVisibleProfiles;
- private const int PlayerChooseButtonsNumH = 7;
- private const int PlayerChooseButtonsNumW = 4;
- private const int PlayerChooseButtonsFirstX = 52;
- private const int PlayerChooseButtonsFirstY = 105;
- private const int PlayerChooseButtonsSpaceH = 15;
- private const int PlayerChooseButtonsSpaceW = 25;
- private int PlayerChooseButtonsOffset = 0;
-
- private CStatic chooseAvatarStatic;
- private bool SelectingMouseActive;
- private int OldMouseX;
- private int OldMouseY;
- private int SelectedPlayerNr = -1;
- private bool ButtonsAdded;
-
- private int NumPlayer = 4;
-
- private DataFromScreen Data;
-
- private class CPlayerChooseButton
- {
- public CButton Button;
- public int ProfileID;
- }
-
- public override void Init()
- {
- base.Init();
-
- chooseAvatarStatic = GetNewStatic();
- chooseAvatarStatic.Visible = false;
-
- PlayerChooseButtonsVisibleProfiles = new List();
-
- Data.ScreenNames.ProfileIDs = new List();
-
- List buttons = new List();
- _ThemeButtons = new string[] {ButtonBack, ButtonNext, ButtonPlayerDestination, ButtonPlayerChoose};
-
- Data = new DataFromScreen();
- FromScreenNames names = new FromScreenNames();
- names.FadeToConfig = false;
- names.FadeToMain = false;
- names.ProfileIDs = new List();
- Data.ScreenNames = names;
- }
-
- public override void DataToScreen(object ReceivedData)
- {
- DataToScreenNames config = new DataToScreenNames();
-
- try
- {
- config = (DataToScreenNames)ReceivedData;
- Data.ScreenNames.ProfileIDs = config.ProfileIDs;
- if (Data.ScreenNames.ProfileIDs == null)
- Data.ScreenNames.ProfileIDs = new List();
-
- 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);
- }
- }
-
- public override bool HandleInput(KeyEvent keyEvent)
- {
- base.HandleInput(keyEvent);
-
- if (keyEvent.KeyPressed) {}
- else
- {
- switch (keyEvent.Key)
- {
- case Keys.Back:
- case Keys.Escape:
- Back();
- break;
-
- case Keys.Enter:
- if (Buttons[ButtonBack].Selected)
- Back();
-
- if (Buttons[ButtonNext].Selected)
- Next();
-
- if (!OnAdd())
- OnRemove();
- break;
-
- case Keys.Delete:
- OnRemove();
- break;
- }
- }
- return true;
- }
-
- public override bool HandleMouse(MouseEvent mouseEvent)
- {
- base.HandleMouse(mouseEvent);
-
- /*
- //Check if LeftButton is hold and Select-Mode inactive
- if (MouseEvent.LBH && !SelectingMouseActive)
- {
- //Save mouse-coords
- 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)
- {
- SelectedPlayerNr = PlayerChooseButtons[i].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.Z = -100;
- chooseAvatarStatic.Color = new SColorF(1, 1, 1, 1);
- chooseAvatarStatic.Texture = CBase.Profiles.GetProfiles()[SelectedPlayerNr].Avatar.Texture;
- }
- }
- }
- }*/
-
- //Check if LeftButton is hold and Select-Mode active
- 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;
- }
- // LeftButton isn't hold anymore, but Selec-Mode is still active -> "Drop" of Avatar
- else if (SelectingMouseActive)
- {
- //Check if really a player was selected
- if (SelectedPlayerNr != -1)
- {
- //Foreach Drop-Area
- for (int i = 0; i < PlayerDestinationButtons.Count; i++)
- {
- //Check first, if area is "active"
- if (PlayerDestinationButtons[i].Visible)
- {
- //Check if Mouse is in area
- if (CHelper.IsInBounds(PlayerDestinationButtons[i].Rect, mouseEvent))
- {
- int added = -1;
- //Add Player-ID to list.
- if (Data.ScreenNames.ProfileIDs.Count < (i + 1))
- {
- Data.ScreenNames.ProfileIDs.Add(SelectedPlayerNr);
- added = Data.ScreenNames.ProfileIDs.Count - 1;
- }
- else if (Data.ScreenNames.ProfileIDs.Count >= (i + 1))
- {
- Data.ScreenNames.ProfileIDs[i] = SelectedPlayerNr;
- added = i;
- }
- UpdateButtonNext();
- //Update texture and name
- PlayerDestinationButtons[added].Color = new SColorF(1, 1, 1, 0.6f);
- PlayerDestinationButtons[added].SColor = new SColorF(1, 1, 1, 1);
- PlayerDestinationButtons[added].Texture = chooseAvatarStatic.Texture;
- PlayerDestinationButtons[added].STexture = chooseAvatarStatic.Texture;
- PlayerDestinationButtons[added].Text.Text = CBase.Profiles.GetProfiles()[SelectedPlayerNr].PlayerName;
- //Update Tiles-List
- UpdateButtonPlayerChoose();
- }
- }
- }
- SelectedPlayerNr = -1;
- }
- //Reset variables
- SelectingMouseActive = false;
- chooseAvatarStatic.Visible = false;
- }
-
- if (mouseEvent.LB && IsMouseOver(mouseEvent))
- {
- if (Buttons[ButtonBack].Selected)
- Back();
-
- if (Buttons[ButtonNext].Selected)
- Next();
-
- if (!OnAdd())
- OnRemove();
- }
-
- if (mouseEvent.RB)
- Back();
-
- return true;
- }
-
- public override void OnShow()
- {
- base.OnShow();
-
- if (!ButtonsAdded)
- {
- AddButtonPlayerDestination();
- AddButtonPlayerChoose();
- ButtonsAdded = true;
- }
-
- UpdateButtonPlayerDestination();
- UpdateButtonPlayerChoose();
-
- UpdateButtonNext();
- }
-
- public override bool UpdateGame()
- {
- return true;
- }
-
- public override bool Draw()
- {
- base.Draw();
- if (chooseAvatarStatic.Visible)
- chooseAvatarStatic.Draw();
- return true;
- }
-
- private void AddButtonPlayerDestination()
- {
- Buttons[ButtonPlayerDestination].Visible = false;
- PlayerDestinationButtons = new List();
- int row = 0;
- int column = 0;
- for (int i = 1; i <= _PartyMode.GetMaxPlayer(); i++)
- {
- 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);
- column++;
- if (column >= PlayerDestinationButtonsNumH)
- {
- row++;
- column = 0;
- }
- b.Visible = true;
- b.Enabled = false;
- AddButton(b);
- }
- }
-
- private void AddButtonPlayerChoose()
- {
- Buttons[ButtonPlayerChoose].Visible = false;
- PlayerChooseButtons = new List();
- int row = 0;
- int column = 0;
- for (int i = 1; i <= PlayerChooseButtonsNumH * PlayerChooseButtonsNumW; i++)
- {
- 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();
- pcb.Button = b;
- pcb.ProfileID = -1;
- PlayerChooseButtons.Add(pcb);
- column++;
- if (column >= PlayerChooseButtonsNumH)
- {
- row++;
- column = 0;
- }
- b.Visible = true;
- b.Enabled = false;
- AddButton(b);
- }
- }
-
- private void UpdateButtonPlayerChoose()
- {
- UpdateVisibleProfiles();
- if ((PlayerChooseButtonsNumW * PlayerChooseButtonsNumH) * (PlayerChooseButtonsOffset + 1) - PlayerChooseButtonsVisibleProfiles.Count >=
- (PlayerChooseButtonsNumW * PlayerChooseButtonsNumH) * PlayerChooseButtonsOffset)
- UpdateButtonPlayerChoose(PlayerChooseButtonsOffset - 1);
- else
- UpdateButtonPlayerChoose(PlayerChooseButtonsOffset);
- }
-
- private void UpdateButtonPlayerChoose(int Offset)
- {
- int NumButtonPlayerChoose = PlayerChooseButtonsNumW * PlayerChooseButtonsNumH;
- if (Offset < 0)
- Offset = 0;
-
- if (NumButtonPlayerChoose * (Offset + 1) - PlayerChooseButtonsVisibleProfiles.Count <= NumButtonPlayerChoose)
- {
- for (int i = 0; i < NumButtonPlayerChoose; i++)
- {
- if ((i + Offset * NumButtonPlayerChoose) < PlayerChooseButtonsVisibleProfiles.Count)
- {
- PlayerChooseButtons[i].ProfileID = PlayerChooseButtonsVisibleProfiles[i + Offset * NumButtonPlayerChoose];
- PlayerChooseButtons[i].Button.Text.Text = CBase.Profiles.GetProfiles()[PlayerChooseButtonsVisibleProfiles[i + Offset * NumButtonPlayerChoose]].PlayerName;
- PlayerChooseButtons[i].Button.Texture = CBase.Profiles.GetProfiles()[PlayerChooseButtonsVisibleProfiles[i + Offset * NumButtonPlayerChoose]].Avatar.Texture;
- PlayerChooseButtons[i].Button.STexture = CBase.Profiles.GetProfiles()[PlayerChooseButtonsVisibleProfiles[i + Offset * NumButtonPlayerChoose]].Avatar.Texture;
- PlayerChooseButtons[i].Button.Color = new SColorF(1, 1, 1, 0.6f);
- PlayerChooseButtons[i].Button.SColor = new SColorF(1, 1, 1, 1);
- PlayerChooseButtons[i].Button.Enabled = true;
- }
- else
- {
- PlayerChooseButtons[i].ProfileID = -1;
- PlayerChooseButtons[i].Button.Text.Text = String.Empty;
- 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;
- }
- }
- }
- }
-
- private void UpdateVisibleProfiles()
- {
- PlayerChooseButtonsVisibleProfiles.Clear();
- for (int i = 0; i < CBase.Profiles.GetProfiles().Length; i++)
- {
- bool visible = false;
- //Show profile only if active
- if (CBase.Profiles.GetProfiles()[i].Active == EOffOn.TR_CONFIG_ON)
- {
- visible = true;
-
- for (int p = 0; p < Data.ScreenNames.ProfileIDs.Count; p++)
- {
- //Don't show profile if is selected
- if (Data.ScreenNames.ProfileIDs[p] == i)
- {
- visible = false;
- break;
- }
- }
- }
- if (visible)
- PlayerChooseButtonsVisibleProfiles.Add(i);
- }
- }
-
- private void UpdateButtonPlayerDestination()
- {
- for (int i = 0; i < PlayerDestinationButtons.Count; i++)
- {
- if (NumPlayer > i)
- {
- PlayerDestinationButtons[i].Visible = true;
- PlayerDestinationButtons[i].Enabled = true;
- }
- else
- {
- PlayerDestinationButtons[i].Visible = false;
- PlayerDestinationButtons[i].Enabled = false;
- }
- }
- for (int i = 0; i < NumPlayer; i++)
- {
- if (i < Data.ScreenNames.ProfileIDs.Count)
- {
- if (Data.ScreenNames.ProfileIDs[i] != -1)
- {
- PlayerDestinationButtons[i].Color = new SColorF(1, 1, 1, 0.6f);
- PlayerDestinationButtons[i].SColor = new SColorF(1, 1, 1, 1);
- PlayerDestinationButtons[i].Texture = CBase.Profiles.GetProfiles()[Data.ScreenNames.ProfileIDs[i]].Avatar.Texture;
- PlayerDestinationButtons[i].STexture = CBase.Profiles.GetProfiles()[Data.ScreenNames.ProfileIDs[i]].Avatar.Texture;
- PlayerDestinationButtons[i].Text.Text = CBase.Profiles.GetProfiles()[Data.ScreenNames.ProfileIDs[i]].PlayerName;
- PlayerDestinationButtons[i].Enabled = true;
- }
- }
- else
- {
- 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;
- }
- }
- }
-
- private void UpdateButtonNext()
- {
- if (Data.ScreenNames.ProfileIDs.Count == NumPlayer)
- {
- Buttons[ButtonNext].Visible = true;
- SetInteractionToButton(Buttons[ButtonNext]);
- }
- else
- Buttons[ButtonNext].Visible = false;
- }
-
- private bool OnAdd()
- {
- for (int i = 0; i < PlayerChooseButtons.Count; i++)
- {
- if (PlayerChooseButtons[i].Button.Selected && PlayerChooseButtons[i].ProfileID != -1)
- {
- if (Data.ScreenNames.ProfileIDs.Count < NumPlayer)
- {
- Data.ScreenNames.ProfileIDs.Add(PlayerChooseButtons[i].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].SColor = new SColorF(1, 1, 1, 1);
- PlayerDestinationButtons[added].Texture = CBase.Profiles.GetProfiles()[PlayerChooseButtons[i].ProfileID].Avatar.Texture;
- PlayerDestinationButtons[added].STexture = CBase.Profiles.GetProfiles()[PlayerChooseButtons[i].ProfileID].Avatar.Texture;
- PlayerDestinationButtons[added].Text.Text = CBase.Profiles.GetProfiles()[PlayerChooseButtons[i].ProfileID].PlayerName;
- PlayerDestinationButtons[added].Enabled = true;
- //Update Tiles-List
- UpdateButtonPlayerChoose();
- CheckInteraction();
- return true;
- }
- }
- }
- return false;
- }
-
- private bool OnRemove()
- {
- for (int i = 0; i < PlayerDestinationButtons.Count; i++)
- {
- if (PlayerDestinationButtons[i].Selected)
- {
- if ((i + 1) <= Data.ScreenNames.ProfileIDs.Count)
- {
- Data.ScreenNames.ProfileIDs.RemoveAt(i);
- UpdateButtonNext();
- UpdateButtonPlayerDestination();
- UpdateButtonPlayerChoose();
- CheckInteraction();
- return true;
- }
- }
- }
- return false;
- }
-
- private void Back()
- {
- Data.ScreenNames.FadeToConfig = true;
- Data.ScreenNames.FadeToMain = false;
- _PartyMode.DataFromScreen(ThemeName, Data);
- }
-
- private void Next()
- {
- Data.ScreenNames.FadeToConfig = false;
- Data.ScreenNames.FadeToMain = true;
- _PartyMode.DataFromScreen(ThemeName, Data);
- }
- }
-}
\ No newline at end of file
diff --git a/PartyModes/PartyModeTicTacToe/CPartyModeTicTacToe.cs b/PartyModes/PartyModeTicTacToe/CPartyModeTicTacToe.cs
new file mode 100644
index 00000000..9adddc16
--- /dev/null
+++ b/PartyModes/PartyModeTicTacToe/CPartyModeTicTacToe.cs
@@ -0,0 +1,807 @@
+using System;
+using System.Collections.Generic;
+using System.Runtime.InteropServices;
+using VocaluxeLib.Menu;
+
+[assembly: ComVisible(false)]
+
+namespace VocaluxeLib.PartyModes.TicTacToe
+{
+ public enum ESongSource
+ {
+ // ReSharper disable InconsistentNaming
+ TR_ALLSONGS,
+ TR_CATEGORY,
+ TR_PLAYLIST
+ // ReSharper restore InconsistentNaming
+ }
+
+ public enum EPartyGameMode
+ {
+ // ReSharper disable InconsistentNaming
+ TR_GAMEMODE_NORMAL,
+ TR_GAMEMODE_SHORTSONG,
+ TR_GAMEMODE_DUET
+ // ReSharper restore InconsistentNaming
+ }
+
+ public class CRound
+ {
+ public int SongID;
+ public int SingerTeam1;
+ public int SingerTeam2;
+ public int PointsTeam1;
+ public int PointsTeam2;
+ public int Winner;
+ public bool Finished = false;
+ }
+
+ #region Communication
+
+ #region ToScreen
+ public struct SDataToScreenConfig
+ {
+ public int NumPlayerTeam1;
+ public int NumPlayerTeam2;
+ public int NumFields;
+ public ESongSource SongSource;
+ public int CategoryID;
+ public int PlaylistID;
+ public EPartyGameMode GameMode;
+ }
+
+ public struct SDataToScreenNames
+ {
+ public int NumPlayerTeam1;
+ public int NumPlayerTeam2;
+ public List ProfileIDsTeam1;
+ public List ProfileIDsTeam2;
+ }
+
+ public struct SDataToScreenMain
+ {
+ public int CurrentRoundNr;
+ public int Team;
+ public int NumPlayerTeam1;
+ public int NumPlayerTeam2;
+ public int NumFields;
+ public List Rounds;
+ public List Songs;
+ public List ProfileIDsTeam1;
+ public List ProfileIDsTeam2;
+ public List PlayerTeam1;
+ public List PlayerTeam2;
+ public int[] NumJokerRandom;
+ public int[] NumJokerRetry;
+ }
+
+ public struct SDataFromScreen
+ {
+ public SFromScreenConfig ScreenConfig;
+ public SFromScreenNames ScreenNames;
+ public SFromScreenMain ScreenMain;
+ }
+
+ public struct SFromScreenConfig
+ {
+ public int NumPlayerTeam1;
+ public int NumPlayerTeam2;
+ public int NumFields;
+ public ESongSource SongSource;
+ public int CategoryID;
+ public int PlaylistID;
+ public EPartyGameMode GameMode;
+ }
+
+ public struct SFromScreenNames
+ {
+ public bool FadeToConfig;
+ public bool FadeToMain;
+ public List ProfileIDsTeam1;
+ public List ProfileIDsTeam2;
+ }
+
+ public struct SFromScreenMain
+ {
+ public bool FadeToSinging;
+ public bool FadeToNameSelection;
+ public List PlayerTeam1;
+ public List PlayerTeam2;
+ public List Rounds;
+ public int SingRoundNr;
+ public List Songs;
+ }
+ #endregion FromScreen
+
+ #endregion Communication
+
+ public sealed class CPartyModeTicTacToe : CPartyMode
+ {
+ private const int _MaxPlayer = 20;
+ private const int _MinPlayer = 2;
+ private const int _MaxTeams = 2;
+ private const int _MinTeams = 2;
+ private const int _NumFields = 9;
+
+ private enum EStage
+ {
+ NotStarted,
+ Config,
+ Names,
+ Main,
+ Singing
+ }
+
+ private struct SData
+ {
+ public int NumPlayerTeam1;
+ public int NumPlayerTeam2;
+ public int NumFields;
+ public int Team;
+ public List ProfileIDsTeam1;
+ public List ProfileIDsTeam2;
+ public List PlayerTeam1;
+ public List PlayerTeam2;
+
+ public ESongSource SongSource;
+ public int CategoryID;
+ public int PlaylistID;
+
+ public EPartyGameMode GameMode;
+
+ public List Rounds;
+ public List Songs;
+
+ public int CurrentRoundNr;
+ public int SingRoundNr;
+
+ public int[] NumJokerRandom;
+ public int[] NumJokerRetry;
+ }
+
+ private SDataToScreenConfig _ToScreenConfig;
+ private SDataToScreenNames _ToScreenNames;
+ private SDataToScreenMain _ToScreenMain;
+
+ private SData _GameData;
+ private EStage _Stage;
+
+ public CPartyModeTicTacToe()
+ {
+ _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.Sorting.SearchString = String.Empty;
+ _ScreenSongOptions.Sorting.SearchActive = false;
+ _ScreenSongOptions.Sorting.DuetOptions = EDuetOptions.NoDuets;
+
+ _Stage = EStage.NotStarted;
+
+ _ToScreenConfig = new SDataToScreenConfig();
+ _ToScreenNames = new SDataToScreenNames();
+ _ToScreenMain = new SDataToScreenMain();
+
+ _GameData = new SData();
+ _GameData.NumFields = 9;
+ _GameData.NumPlayerTeam1 = 2;
+ _GameData.NumPlayerTeam2 = 2;
+ _GameData.ProfileIDsTeam1 = new List();
+ _GameData.ProfileIDsTeam2 = new List();
+ _GameData.PlayerTeam1 = new List();
+ _GameData.PlayerTeam2 = new List();
+ _GameData.CurrentRoundNr = 0;
+ _GameData.SingRoundNr = 0;
+ _GameData.SongSource = ESongSource.TR_ALLSONGS;
+ _GameData.PlaylistID = 0;
+ _GameData.CategoryID = 0;
+ _GameData.GameMode = EPartyGameMode.TR_GAMEMODE_NORMAL;
+ _GameData.Rounds = new List();
+ _GameData.Songs = new List();
+ _GameData.NumJokerRandom = new int[2];
+ _GameData.NumJokerRetry = new int[2];
+ }
+
+ public override bool Init()
+ {
+ _Stage = EStage.NotStarted;
+
+ _ScreenSongOptions.Sorting.IgnoreArticles = CBase.Config.GetIgnoreArticles();
+ _ScreenSongOptions.Sorting.SongSorting = CBase.Config.GetSongSorting();
+ _ScreenSongOptions.Sorting.Tabs = EOffOn.TR_CONFIG_OFF;
+ _ScreenSongOptions.Selection.SongIndex = -1;
+
+ if (CBase.Config.GetTabs() == EOffOn.TR_CONFIG_ON && _ScreenSongOptions.Sorting.SongSorting != ESongSorting.TR_CONFIG_NONE)
+ _ScreenSongOptions.Sorting.Tabs = EOffOn.TR_CONFIG_ON;
+
+ _ToScreenMain.Rounds = new List();
+ _ToScreenMain.Songs = new List();
+ _ToScreenMain.PlayerTeam1 = new List();
+ _ToScreenMain.PlayerTeam2 = new List();
+ _GameData.Songs = new List();
+ _GameData.Rounds = new List();
+ _GameData.PlayerTeam1 = new List();
+ _GameData.PlayerTeam2 = new List();
+ return true;
+ }
+
+ public override void DataFromScreen(string screenName, Object data)
+ {
+ SDataFromScreen dataFrom = new SDataFromScreen();
+ switch (screenName)
+ {
+ case "PartyScreenTicTacToeConfig":
+
+ try
+ {
+ dataFrom = (SDataFromScreen)data;
+ _GameData.NumPlayerTeam1 = dataFrom.ScreenConfig.NumPlayerTeam1;
+ _GameData.NumPlayerTeam2 = dataFrom.ScreenConfig.NumPlayerTeam2;
+ _GameData.NumFields = dataFrom.ScreenConfig.NumFields;
+ _GameData.SongSource = dataFrom.ScreenConfig.SongSource;
+ _GameData.CategoryID = dataFrom.ScreenConfig.CategoryID;
+ _GameData.PlaylistID = dataFrom.ScreenConfig.PlaylistID;
+ _GameData.GameMode = dataFrom.ScreenConfig.GameMode;
+
+ _Stage = EStage.Config;
+ CBase.Graphics.FadeTo(EScreens.ScreenPartyDummy);
+ }
+ catch (Exception e)
+ {
+ CBase.Log.LogError("Error in party mode TicTacToe. Can't cast received data from screen " + screenName + ". " + e.Message);
+ }
+ break;
+
+ case "PartyScreenTicTacToeNames":
+ try
+ {
+ dataFrom = (SDataFromScreen)data;
+ if (dataFrom.ScreenNames.FadeToConfig)
+ _Stage = EStage.NotStarted;
+ else
+ {
+ if (CBase.Game.GetRandom(100) < 50)
+ _GameData.Team = 0;
+ else
+ _GameData.Team = 1;
+ _GameData.ProfileIDsTeam1 = dataFrom.ScreenNames.ProfileIDsTeam1;
+ _GameData.ProfileIDsTeam2 = dataFrom.ScreenNames.ProfileIDsTeam2;
+ _Stage = EStage.Names;
+ }
+
+ CBase.Graphics.FadeTo(EScreens.ScreenPartyDummy);
+ }
+ catch (Exception e)
+ {
+ CBase.Log.LogError("Error in party mode TicTacToe. Can't cast received data from screen " + screenName + ". " + e.Message);
+ }
+ break;
+
+ case "PartyScreenTicTacToeMain":
+ try
+ {
+ dataFrom = (SDataFromScreen)data;
+ if (dataFrom.ScreenMain.FadeToSinging)
+ {
+ _Stage = EStage.Singing;
+ _GameData.Rounds = dataFrom.ScreenMain.Rounds;
+ _GameData.SingRoundNr = dataFrom.ScreenMain.SingRoundNr;
+ _GameData.Songs = dataFrom.ScreenMain.Songs;
+ _GameData.PlayerTeam1 = dataFrom.ScreenMain.PlayerTeam1;
+ _GameData.PlayerTeam2 = dataFrom.ScreenMain.PlayerTeam2;
+ }
+ if (dataFrom.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);
+ }
+
+
+ if (_Stage == EStage.Singing)
+ _StartRound(dataFrom.ScreenMain.SingRoundNr);
+ if (_Stage == EStage.Config)
+ CBase.Graphics.FadeTo(EScreens.ScreenPartyDummy);
+ break;
+
+ default:
+ CBase.Log.LogError("Error in party mode TicTacToe. Wrong screen is sending: " + screenName);
+ break;
+ }
+ }
+
+ public override void UpdateGame()
+ {
+ /*
+ if (CBase.Songs.GetCurrentCategoryIndex() != -1 || _ScreenSongOptions.Sorting.Tabs == EOffOn.TR_CONFIG_OFF)
+ _ScreenSongOptions.Selection.RandomOnly = true;
+ else
+ _ScreenSongOptions.Selection.RandomOnly = false;*/
+ }
+
+ public override CMenuParty GetNextPartyScreen(out EScreens alternativeScreen)
+ {
+ CMenuParty screen = null;
+ alternativeScreen = EScreens.ScreenSong;
+
+ switch (_Stage)
+ {
+ case EStage.NotStarted:
+ _Screens.TryGetValue("CPartyScreenTicTacToeConfig", out screen);
+ if (screen != null)
+ {
+ _ToScreenConfig.NumPlayerTeam1 = _GameData.NumPlayerTeam1;
+ _ToScreenConfig.NumPlayerTeam2 = _GameData.NumPlayerTeam2;
+ _ToScreenConfig.NumFields = _GameData.NumFields;
+ _ToScreenConfig.SongSource = _GameData.SongSource;
+ _ToScreenConfig.CategoryID = _GameData.CategoryID;
+ _ToScreenConfig.PlaylistID = _GameData.PlaylistID;
+ _ToScreenConfig.GameMode = _GameData.GameMode;
+ screen.DataToScreen(_ToScreenConfig);
+ }
+ break;
+ case EStage.Config:
+ _Screens.TryGetValue("CPartyScreenTicTacToeNames", out screen);
+ if (screen != null)
+ {
+ _ToScreenNames.NumPlayerTeam1 = _GameData.NumPlayerTeam1;
+ _ToScreenNames.NumPlayerTeam2 = _GameData.NumPlayerTeam2;
+ _ToScreenNames.ProfileIDsTeam1 = _GameData.ProfileIDsTeam1;
+ _ToScreenNames.ProfileIDsTeam2 = _GameData.ProfileIDsTeam2;
+ screen.DataToScreen(_ToScreenNames);
+ }
+ break;
+ case EStage.Names:
+ _Screens.TryGetValue("CPartyScreenTicTacToeMain", out screen);
+ if (screen != null)
+ {
+ if (_GameData.Team == 1)
+ _GameData.Team = 0;
+ else
+ _GameData.Team = 1;
+ CBase.Songs.ResetPartySongSung();
+ _GameData.CurrentRoundNr = 1;
+ _ToScreenMain.CurrentRoundNr = 1;
+ _ToScreenMain.NumPlayerTeam1 = _GameData.NumPlayerTeam1;
+ _ToScreenMain.NumPlayerTeam2 = _GameData.NumPlayerTeam2;
+ _ToScreenMain.NumFields = _GameData.NumFields;
+ _ToScreenMain.ProfileIDsTeam1 = _GameData.ProfileIDsTeam1;
+ _ToScreenMain.ProfileIDsTeam2 = _GameData.ProfileIDsTeam2;
+ _CreateRounds();
+ _SetNumJokers();
+ _PreparePlayerList(0);
+ _PrepareSongList();
+ _ToScreenMain.Rounds = _GameData.Rounds;
+ _ToScreenMain.Songs = _GameData.Songs;
+ _ToScreenMain.PlayerTeam1 = _GameData.PlayerTeam1;
+ _ToScreenMain.PlayerTeam1 = _GameData.PlayerTeam2;
+ _ToScreenMain.NumJokerRandom = _GameData.NumJokerRandom;
+ _ToScreenMain.NumJokerRetry = _GameData.NumJokerRetry;
+ _ToScreenMain.Team = _GameData.Team;
+ screen.DataToScreen(_ToScreenMain);
+ }
+ break;
+ case EStage.Main:
+ //nothing to do
+ break;
+ case EStage.Singing:
+ _Screens.TryGetValue("CPartyScreenTicTacToeMain", out screen);
+ if (screen != null)
+ {
+ if (_GameData.Team == 1)
+ _GameData.Team = 0;
+ else
+ _GameData.Team = 1;
+ _UpdateSongList();
+ _UpdatePlayerList();
+ _ToScreenMain.CurrentRoundNr = _GameData.CurrentRoundNr;
+ _ToScreenMain.NumPlayerTeam1 = _GameData.NumPlayerTeam1;
+ _ToScreenMain.NumPlayerTeam2 = _GameData.NumPlayerTeam2;
+ _ToScreenMain.NumFields = _GameData.NumFields;
+ _ToScreenMain.ProfileIDsTeam1 = _GameData.ProfileIDsTeam1;
+ _ToScreenMain.ProfileIDsTeam2 = _GameData.ProfileIDsTeam2;
+ _ToScreenMain.Rounds = _GameData.Rounds;
+ _ToScreenMain.Songs = _GameData.Songs;
+ _ToScreenMain.PlayerTeam1 = _GameData.PlayerTeam1;
+ _ToScreenMain.PlayerTeam2 = _GameData.PlayerTeam2;
+ _ToScreenMain.NumJokerRandom = _GameData.NumJokerRandom;
+ _ToScreenMain.NumJokerRetry = _GameData.NumJokerRetry;
+ _ToScreenMain.Team = _GameData.Team;
+ screen.DataToScreen(_ToScreenMain);
+ }
+ break;
+ }
+
+ return screen;
+ }
+
+ public override EScreens GetStartScreen()
+ {
+ return EScreens.ScreenPartyDummy;
+ }
+
+ public override EScreens GetMainScreen()
+ {
+ return EScreens.ScreenPartyDummy;
+ }
+
+ public override SScreenSongOptions GetScreenSongOptions()
+ {
+ _ScreenSongOptions.Sorting.SongSorting = CBase.Config.GetSongSorting();
+ _ScreenSongOptions.Sorting.Tabs = CBase.Config.GetTabs();
+ _ScreenSongOptions.Sorting.IgnoreArticles = CBase.Config.GetIgnoreArticles();
+
+ return _ScreenSongOptions;
+ }
+
+ public override void OnSongChange(int songIndex, ref SScreenSongOptions screenSongOptions)
+ {
+ screenSongOptions = _ScreenSongOptions;
+ }
+
+ public override void OnCategoryChange(int categoryIndex, ref SScreenSongOptions screenSongOptions)
+ {
+ screenSongOptions = _ScreenSongOptions;
+ }
+
+ public override void SetSearchString(string searchString, bool visible)
+ {
+ _ScreenSongOptions.Sorting.SearchString = searchString;
+ _ScreenSongOptions.Sorting.SearchActive = visible;
+ }
+
+ public override int GetMaxPlayer()
+ {
+ return _MaxPlayer;
+ }
+
+ public override int GetMinPlayer()
+ {
+ return _MinPlayer;
+ }
+
+ public override int GetMaxTeams()
+ {
+ return _MaxTeams;
+ }
+
+ public override int GetMinTeams()
+ {
+ return _MinTeams;
+ }
+
+ public override int GetMaxNumRounds()
+ {
+ return _NumFields;
+ }
+
+ public override void JokerUsed(int teamNr) {}
+
+ public override void SongSelected(int songID)
+ {
+ EGameMode gm = EGameMode.TR_GAMEMODE_NORMAL;
+
+ switch (_GameData.GameMode)
+ {
+ case EPartyGameMode.TR_GAMEMODE_NORMAL:
+ gm = EGameMode.TR_GAMEMODE_NORMAL;
+ break;
+
+ case EPartyGameMode.TR_GAMEMODE_DUET:
+ gm = EGameMode.TR_GAMEMODE_DUET;
+ break;
+
+ case EPartyGameMode.TR_GAMEMODE_SHORTSONG:
+ gm = EGameMode.TR_GAMEMODE_SHORTSONG;
+ break;
+ }
+ CBase.Game.AddSong(songID, gm);
+
+ CBase.Songs.AddPartySongSung(songID);
+ CBase.Graphics.FadeTo(EScreens.ScreenSing);
+ }
+
+ public override void LeavingHighscore()
+ {
+ _UpdateScores();
+ CBase.Graphics.FadeTo(EScreens.ScreenPartyDummy);
+ }
+
+ private void _CreateRounds()
+ {
+ _GameData.Rounds = new List();
+ for (int i = 0; i < _GameData.NumFields; i++)
+ {
+ CRound r = new CRound();
+ _GameData.Rounds.Add(r);
+ }
+ }
+
+ private void _PreparePlayerList(int team)
+ {
+ if (team == 0)
+ {
+ _GameData.PlayerTeam1 = new List();
+ _GameData.PlayerTeam2 = new List();
+
+ //Prepare Player-IDs
+ List iDs1 = new List();
+ List iDs2 = new List();
+ 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)
+ {
+ 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);
+ num = (int)Math.Round((double)random / 10);
+ if (num >= iDs1.Count)
+ num = iDs1.Count - 1;
+ _GameData.PlayerTeam1.Add(iDs1[num]);
+ iDs1.RemoveAt(num);
+ }
+ if (_GameData.PlayerTeam2.Count < _GameData.NumFields + _GameData.NumJokerRetry[1])
+ {
+ random = CBase.Game.GetRandom((iDs2.Count - 1) * 20);
+ num = (int)Math.Round((double)random / 20);
+ if (num >= iDs2.Count)
+ num = iDs2.Count - 1;
+ _GameData.PlayerTeam2.Add(iDs2[num]);
+ iDs2.RemoveAt(num);
+ }
+ }
+ }
+ else if (team == 1)
+ {
+ //Prepare Player-IDs
+ List iDs = new List();
+ int num = 0;
+ int random = 0;
+ //Add IDs to team-list
+ 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);
+ num = (int)Math.Round((double)random / 10);
+ if (num >= iDs.Count)
+ num = iDs.Count - 1;
+ _GameData.PlayerTeam1.Add(iDs[num]);
+ iDs.RemoveAt(num);
+ }
+ }
+ }
+ else if (team == 2)
+ {
+ //Prepare Player-IDs
+ List iDs = new List();
+ int num = 0;
+ int random = 0;
+ //Add IDs to team-list
+ 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);
+ num = (int)Math.Round((double)random / 20);
+ if (num >= iDs.Count)
+ num = iDs.Count - 1;
+ _GameData.PlayerTeam2.Add(iDs[num]);
+ iDs.RemoveAt(num);
+ }
+ }
+ }
+ }
+
+ private void _PrepareSongList()
+ {
+ EGameMode gm = EGameMode.TR_GAMEMODE_NORMAL;
+
+ switch (_GameData.GameMode)
+ {
+ case EPartyGameMode.TR_GAMEMODE_NORMAL:
+ gm = EGameMode.TR_GAMEMODE_NORMAL;
+ break;
+
+ case EPartyGameMode.TR_GAMEMODE_DUET:
+ gm = EGameMode.TR_GAMEMODE_DUET;
+ break;
+
+ case EPartyGameMode.TR_GAMEMODE_SHORTSONG:
+ gm = EGameMode.TR_GAMEMODE_SHORTSONG;
+ break;
+ }
+
+ while (_GameData.Songs.Count < (_GameData.NumFields + _GameData.NumJokerRandom[0] + _GameData.NumJokerRandom[1]))
+ {
+ List songs = new List();
+ switch (_GameData.SongSource)
+ {
+ case ESongSource.TR_PLAYLIST:
+ for (int i = 0; i < CBase.Playlist.GetPlaylistSongCount(_GameData.PlaylistID); i++)
+ {
+ 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)
+ songs.Add(CBase.Songs.GetVisibleSong(i).ID);
+ }
+ }
+ CBase.Songs.SetCategory(-1);
+ break;
+ }
+ while (songs.Count > 0)
+ {
+ _GameData.Songs.Add(songs[CBase.Game.GetRandom(songs.Count - 1)]);
+ songs.Remove(_GameData.Songs[_GameData.Songs.Count - 1]);
+ }
+ }
+ }
+
+ private void _UpdatePlayerList()
+ {
+ if (_GameData.PlayerTeam1.Count == 0)
+ _PreparePlayerList(1);
+ if (_GameData.PlayerTeam2.Count == 0)
+ _PreparePlayerList(2);
+ }
+
+ private void _UpdateSongList()
+ {
+ if (_GameData.Songs.Count == 0)
+ _PrepareSongList();
+ }
+
+ private void _StartRound(int roundNr)
+ {
+ CBase.Game.Reset();
+ CBase.Game.ClearSongs();
+
+ CBase.Game.SetNumPlayer(2);
+
+ SPlayer[] player = CBase.Game.GetPlayer();
+ if (player == null)
+ return;
+
+ if (player.Length < 2)
+ return;
+
+ SProfile[] profiles = CBase.Profiles.GetProfiles();
+ CRound r = _GameData.Rounds[roundNr];
+ bool isDuet = CBase.Songs.GetSongByID(r.SongID).IsDuet;
+
+ for (int i = 0; i < 2; i++)
+ {
+ //default values
+ player[i].Name = "foobar";
+ player[i].Difficulty = EGameDifficulty.TR_CONFIG_EASY;
+ player[i].ProfileID = -1;
+ }
+
+ //try to fill with the right data
+ if (r != null)
+ {
+ if (_GameData.ProfileIDsTeam1[r.SingerTeam1] < profiles.Length)
+ {
+ player[0].Name = profiles[_GameData.ProfileIDsTeam1[r.SingerTeam1]].PlayerName;
+ player[0].Difficulty = profiles[_GameData.ProfileIDsTeam1[r.SingerTeam1]].Difficulty;
+ player[0].ProfileID = _GameData.ProfileIDsTeam1[r.SingerTeam1];
+ if (isDuet)
+ player[0].LineNr = 0;
+ }
+ if (_GameData.ProfileIDsTeam2[r.SingerTeam2] < profiles.Length)
+ {
+ player[1].Name = profiles[_GameData.ProfileIDsTeam2[r.SingerTeam2]].PlayerName;
+ player[1].Difficulty = profiles[_GameData.ProfileIDsTeam2[r.SingerTeam2]].Difficulty;
+ player[1].ProfileID = _GameData.ProfileIDsTeam2[r.SingerTeam2];
+ if (isDuet)
+ player[1].LineNr = 1;
+ }
+ SongSelected(r.SongID);
+ }
+ else
+ return;
+ }
+
+ private void _SetNumJokers()
+ {
+ switch (_GameData.NumFields)
+ {
+ case 9:
+ _GameData.NumJokerRandom[0] = 1;
+ _GameData.NumJokerRandom[1] = 1;
+ _GameData.NumJokerRetry[0] = 0;
+ _GameData.NumJokerRetry[1] = 0;
+ break;
+
+ case 16:
+ _GameData.NumJokerRandom[0] = 2;
+ _GameData.NumJokerRandom[1] = 2;
+ _GameData.NumJokerRetry[0] = 1;
+ _GameData.NumJokerRetry[1] = 1;
+ break;
+
+ case 25:
+ _GameData.NumJokerRandom[0] = 3;
+ _GameData.NumJokerRandom[1] = 3;
+ _GameData.NumJokerRetry[0] = 2;
+ _GameData.NumJokerRetry[1] = 2;
+ break;
+ }
+ }
+
+ private void _UpdateScores()
+ {
+ if (!_GameData.Rounds[_GameData.SingRoundNr].Finished)
+ _GameData.CurrentRoundNr++;
+
+ SPlayer[] results = CBase.Game.GetPlayer();
+ if (results == null)
+ return;
+
+ if (results.Length < 2)
+ return;
+
+ _GameData.Rounds[_GameData.SingRoundNr].PointsTeam1 = (int)Math.Round(results[0].Points);
+ _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;
+ _GameData.CurrentRoundNr--;
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/PartyModes/PartyModeTicTacToe/CPartyScreenTicTacToeConfig.cs b/PartyModes/PartyModeTicTacToe/CPartyScreenTicTacToeConfig.cs
new file mode 100644
index 00000000..a1af9b1b
--- /dev/null
+++ b/PartyModes/PartyModeTicTacToe/CPartyScreenTicTacToeConfig.cs
@@ -0,0 +1,328 @@
+using System;
+using System.Windows.Forms;
+using VocaluxeLib.Menu;
+
+namespace VocaluxeLib.PartyModes.TicTacToe
+{
+ public class CPartyScreenTicTacToeConfig : CMenuParty
+ {
+ // Version number for theme files. Increment it, if you've changed something on the theme files!
+ protected override int _ScreenVersion
+ {
+ get { return 1; }
+ }
+
+ 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;
+
+ private SDataFromScreen _Data;
+
+ public override void Init()
+ {
+ base.Init();
+
+ _ThemeSelectSlides = new string[]
+ {_SelectSlideNumPlayerTeam1, _SelectSlideNumPlayerTeam2, _SelectSlideNumFields, _SelectSlideSongSource, _SelectSlidePlaylist, _SelectSlideCategory, _SelectSlideGameMode};
+ _ThemeButtons = new string[] {_ButtonNext, _ButtonBack};
+
+ _Data = new SDataFromScreen();
+ SFromScreenConfig config = new SFromScreenConfig();
+ config.PlaylistID = 0;
+ config.NumFields = 9;
+ config.NumPlayerTeam1 = 2;
+ config.NumPlayerTeam2 = 2;
+ config.GameMode = EPartyGameMode.TR_GAMEMODE_NORMAL;
+ config.CategoryID = 0;
+ config.SongSource = ESongSource.TR_ALLSONGS;
+ _Data.ScreenConfig = config;
+ }
+
+ public override void DataToScreen(object receivedData)
+ {
+ SDataToScreenConfig config = new SDataToScreenConfig();
+
+ try
+ {
+ config = (SDataToScreenConfig)receivedData;
+ _Data.ScreenConfig.NumFields = config.NumFields;
+ _Data.ScreenConfig.NumPlayerTeam1 = config.NumPlayerTeam1;
+ _Data.ScreenConfig.NumPlayerTeam2 = config.NumPlayerTeam2;
+ _Data.ScreenConfig.PlaylistID = config.PlaylistID;
+ _Data.ScreenConfig.CategoryID = config.CategoryID;
+ _Data.ScreenConfig.SongSource = config.SongSource;
+ _Data.ScreenConfig.GameMode = config.GameMode;
+ }
+ catch (Exception e)
+ {
+ 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(SKeyEvent keyEvent)
+ {
+ base.HandleInput(keyEvent);
+
+ if (keyEvent.KeyPressed) {}
+ else
+ {
+ switch (keyEvent.Key)
+ {
+ case Keys.Back:
+ case Keys.Escape:
+ _Back();
+ break;
+
+ case Keys.Enter:
+ _UpdateSlides();
+
+ if (Buttons[_ButtonBack].Selected)
+ _Back();
+
+ if (Buttons[_ButtonNext].Selected)
+ _Next();
+ break;
+
+ case Keys.Left:
+ _UpdateSlides();
+ break;
+
+ case Keys.Right:
+ _UpdateSlides();
+ break;
+ }
+ }
+ return true;
+ }
+
+ public override bool HandleMouse(SMouseEvent mouseEvent)
+ {
+ base.HandleMouse(mouseEvent);
+
+ if (mouseEvent.LB && IsMouseOver(mouseEvent))
+ {
+ _UpdateSlides();
+ if (Buttons[_ButtonBack].Selected)
+ _Back();
+
+ if (Buttons[_ButtonNext].Selected)
+ _Next();
+ }
+
+ if (mouseEvent.RB)
+ _Back();
+
+ return true;
+ }
+
+ public override void OnShow()
+ {
+ base.OnShow();
+
+ if (CBase.Config.GetMaxNumMics() >= 2)
+ _ConfigOk = true;
+
+ _FillSlides();
+ _UpdateSlides();
+ }
+
+ public override bool UpdateGame()
+ {
+ Buttons[_ButtonNext].Visible = _ConfigOk;
+ return true;
+ }
+
+ public override bool Draw()
+ {
+ base.Draw();
+ return true;
+ }
+
+ private void _FillSlides()
+ {
+ // build num player slide (min player ... max player);
+ 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[_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[_SelectSlideNumFields].Clear();
+ SelectSlides[_SelectSlideNumFields].AddValue("9");
+ SelectSlides[_SelectSlideNumFields].AddValue("16");
+ SelectSlides[_SelectSlideNumFields].AddValue("25");
+ if (_Data.ScreenConfig.NumFields == 9)
+ SelectSlides[_SelectSlideNumFields].Selection = 0;
+ else if (_Data.ScreenConfig.NumFields == 16)
+ SelectSlides[_SelectSlideNumFields].Selection = 1;
+ else if (_Data.ScreenConfig.NumFields == 25)
+ SelectSlides[_SelectSlideNumFields].Selection = 2;
+
+ SelectSlides[_SelectSlideSongSource].Clear();
+ SelectSlides[_SelectSlideSongSource].SetValues((int)_Data.ScreenConfig.SongSource);
+
+ string[] playlists = CBase.Playlist.GetPlaylistNames();
+ 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[_SelectSlidePlaylist].AddValue(value);
+ }
+ 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++)
+ categories[i] = CBase.Songs.GetCategory(i).Name;
+ 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[_SelectSlideCategory].AddValue(value);
+ }
+ SelectSlides[_SelectSlideCategory].Selection = _Data.ScreenConfig.CategoryID;
+ SelectSlides[_SelectSlideCategory].Visible = _Data.ScreenConfig.SongSource == ESongSource.TR_CATEGORY;
+
+ SelectSlides[_SelectSlideGameMode].Visible = true;
+ SelectSlides[_SelectSlideGameMode].SetValues((int)_Data.ScreenConfig.GameMode);
+ }
+
+ private void _UpdateSlides()
+ {
+ _Data.ScreenConfig.NumPlayerTeam1 = SelectSlides[_SelectSlideNumPlayerTeam1].Selection + (_PartyMode.GetMinPlayer() / 2);
+ _Data.ScreenConfig.NumPlayerTeam2 = SelectSlides[_SelectSlideNumPlayerTeam2].Selection + (_PartyMode.GetMinPlayer() / 2);
+
+ if (SelectSlides[_SelectSlideNumFields].Selection == 0)
+ _Data.ScreenConfig.NumFields = 9;
+ else if (SelectSlides[_SelectSlideNumFields].Selection == 1)
+ _Data.ScreenConfig.NumFields = 16;
+ else if (SelectSlides[_SelectSlideNumFields].Selection == 2)
+ _Data.ScreenConfig.NumFields = 25;
+
+ _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;
+
+ switch (_Data.ScreenConfig.GameMode)
+ {
+ case EPartyGameMode.TR_GAMEMODE_NORMAL:
+ gm = EGameMode.TR_GAMEMODE_NORMAL;
+ break;
+
+ case EPartyGameMode.TR_GAMEMODE_DUET:
+ gm = EGameMode.TR_GAMEMODE_DUET;
+ break;
+
+ case EPartyGameMode.TR_GAMEMODE_SHORTSONG:
+ gm = EGameMode.TR_GAMEMODE_SHORTSONG;
+ break;
+ }
+
+ if (_Data.ScreenConfig.SongSource == ESongSource.TR_PLAYLIST)
+ {
+ if (CBase.Playlist.GetNumPlaylists() > 0)
+ {
+ if (CBase.Playlist.GetPlaylistSongCount(_Data.ScreenConfig.PlaylistID) > 0)
+ {
+ _ConfigOk = false;
+ for (int i = 0; i < CBase.Playlist.GetPlaylistSongCount(_Data.ScreenConfig.PlaylistID); i++)
+ {
+ 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);
+ _ConfigOk = false;
+ 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;
+ }
+ CBase.Songs.SetCategory(-1);
+ }
+ else
+ _ConfigOk = false;
+ }
+ else
+ _ConfigOk = false;
+ }
+ if (_Data.ScreenConfig.SongSource == ESongSource.TR_ALLSONGS)
+ {
+ if (CBase.Songs.GetNumSongs() > 0)
+ {
+ 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;
+ }
+ }
+ else
+ _ConfigOk = false;
+ }
+ SelectSlides[_SelectSlideCategory].Visible = _Data.ScreenConfig.SongSource == ESongSource.TR_CATEGORY;
+ SelectSlides[_SelectSlidePlaylist].Visible = _Data.ScreenConfig.SongSource == ESongSource.TR_PLAYLIST;
+ }
+
+ private void _Back()
+ {
+ _FadeTo(EScreens.ScreenParty);
+ }
+
+ private void _Next()
+ {
+ _PartyMode.DataFromScreen(ThemeName, _Data);
+ }
+ }
+}
\ No newline at end of file
diff --git a/PartyModes/PartyModeTicTacToe/CPartyScreenTicTacToeMain.cs b/PartyModes/PartyModeTicTacToe/CPartyScreenTicTacToeMain.cs
new file mode 100644
index 00000000..3e2fe436
--- /dev/null
+++ b/PartyModes/PartyModeTicTacToe/CPartyScreenTicTacToeMain.cs
@@ -0,0 +1,711 @@
+using System;
+using System.Collections.Generic;
+using System.Windows.Forms;
+using VocaluxeLib.Menu;
+using VocaluxeLib.Menu.SongMenu;
+
+namespace VocaluxeLib.PartyModes.TicTacToe
+{
+ public class CField
+ {
+ public CRound Content;
+ public CButton Button;
+ }
+
+ public enum EStatus
+ {
+ FieldChoosing,
+ JokerRetry,
+ FieldSelected,
+ None
+ }
+
+ public class CPartyScreenTicTacToeMain : CMenuParty
+ {
+ // Version number for theme files. Increment it, if you've changed something on the theme files!
+ protected override int _ScreenVersion
+ {
+ get { return 1; }
+ }
+
+ 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";
+
+ 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";
+
+ 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";
+
+ private bool _ExitPopupVisible;
+
+ private SDataFromScreen _Data;
+ private SDataToScreenMain _GameData;
+
+ private List _Fields;
+ private float _FieldFirstX = 25;
+ private float _FieldFirstY = 25;
+ private int _FieldSpace = 10;
+ private float _FieldSize = 100;
+
+ private int _PreviewStream = -1;
+ private int _SelectedField = -1;
+ private int _OldSelectedField = -1;
+
+ private int[,] _Possibilities;
+ private EStatus _Status;
+
+ public override void Init()
+ {
+ base.Init();
+
+ _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 SDataFromScreen();
+ SFromScreenMain config = new SFromScreenMain();
+ _GameData = new SDataToScreenMain();
+ config.SingRoundNr = 1;
+ config.Rounds = new List();
+ config.Songs = new List();
+ config.PlayerTeam1 = new List();
+ config.PlayerTeam2 = new List();
+ config.FadeToNameSelection = false;
+ config.FadeToSinging = false;
+ _Data.ScreenMain = config;
+
+ _Fields = new List();
+ }
+
+ public override void LoadTheme(string xmlPath)
+ {
+ base.LoadTheme(xmlPath);
+
+ _CreateFields();
+ Buttons[_ButtonField].Visible = false;
+ }
+
+ public override void DataToScreen(object receivedData)
+ {
+ SDataToScreenMain config = new SDataToScreenMain();
+
+ try
+ {
+ config = (SDataToScreenMain)receivedData;
+ _GameData = config;
+ }
+ catch (Exception e)
+ {
+ 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(SKeyEvent keyEvent)
+ {
+ base.HandleInput(keyEvent);
+
+ if (keyEvent.KeyPressed) {}
+ else
+ {
+ switch (keyEvent.Key)
+ {
+ case Keys.Back:
+ case Keys.Escape:
+ if (!_ExitPopupVisible)
+ {
+ if (_GameData.CurrentRoundNr == 1 && _Status != EStatus.FieldSelected)
+ _Back();
+ else if (_Status == EStatus.None)
+ _EndParty();
+ else
+ _ShowPopup(true);
+ }
+ else
+ _ShowPopup(false);
+ break;
+
+ case Keys.Enter:
+ if (!_ExitPopupVisible)
+ {
+ if (Buttons[_ButtonNextRound].Selected)
+ _NextRound();
+ if (Buttons[_ButtonBack].Selected && _GameData.CurrentRoundNr == 1 && _Status != EStatus.FieldSelected)
+ _Back();
+ if (Buttons[_ButtonExit].Selected && (_GameData.CurrentRoundNr > 1 || _Status == EStatus.FieldSelected) && _Status != EStatus.None)
+ _ShowPopup(true);
+ else if (_Status == EStatus.None)
+ _EndParty();
+ for (int i = 0; i < _GameData.NumFields; i++)
+ {
+ switch (_Status)
+ {
+ case EStatus.FieldChoosing:
+ if (_Fields[i].Button.Selected)
+ {
+ _SelectedField = i;
+ _FieldSelected();
+ }
+ break;
+
+ case EStatus.JokerRetry:
+ if (_Fields[i].Button.Selected)
+ {
+ _SelectedField = i;
+ _FieldSelectedAgain();
+ }
+ break;
+ }
+ }
+ if (_Status == EStatus.FieldSelected)
+ {
+ if (Buttons[_ButtonJokerRandomT1].Selected)
+ _UseJoker(0, 0);
+ if (Buttons[_ButtonJokerRandomT2].Selected)
+ _UseJoker(1, 0);
+ if (Buttons[_ButtonJokerRetryT1].Selected)
+ _UseJoker(0, 1);
+ if (Buttons[_ButtonJokerRetryT2].Selected)
+ _UseJoker(1, 1);
+ }
+ }
+ else
+ {
+ if (Buttons[_ButtonPopupYes].Selected)
+ _EndParty();
+ if (Buttons[_ButtonPopupNo].Selected)
+ _ShowPopup(false);
+ }
+ break;
+ }
+ }
+ return true;
+ }
+
+ public override bool HandleMouse(SMouseEvent mouseEvent)
+ {
+ base.HandleMouse(mouseEvent);
+
+ if (mouseEvent.LB && IsMouseOver(mouseEvent))
+ {
+ if (!_ExitPopupVisible)
+ {
+ if (Buttons[_ButtonNextRound].Selected)
+ _NextRound();
+ if (Buttons[_ButtonBack].Selected)
+ _Back();
+ if (Buttons[_ButtonExit].Selected)
+ {
+ if (_Status == EStatus.None)
+ _EndParty();
+ else
+ _ShowPopup(true);
+ }
+ for (int i = 0; i < _GameData.NumFields; i++)
+ {
+ switch (_Status)
+ {
+ case EStatus.FieldChoosing:
+ if (_Fields[i].Button.Selected)
+ {
+ _SelectedField = i;
+ _FieldSelected();
+ }
+ break;
+
+ case EStatus.JokerRetry:
+ if (_Fields[i].Button.Selected)
+ {
+ _SelectedField = i;
+ _FieldSelectedAgain();
+ }
+ break;
+ }
+ }
+ if (_Status == EStatus.FieldSelected)
+ {
+ if (Buttons[_ButtonJokerRandomT1].Selected)
+ _UseJoker(0, 0);
+ if (Buttons[_ButtonJokerRandomT2].Selected)
+ _UseJoker(1, 0);
+ if (Buttons[_ButtonJokerRetryT1].Selected)
+ _UseJoker(0, 1);
+ if (Buttons[_ButtonJokerRetryT2].Selected)
+ _UseJoker(1, 1);
+ }
+ }
+ else
+ {
+ if (Buttons[_ButtonPopupYes].Selected)
+ _EndParty();
+ if (Buttons[_ButtonPopupNo].Selected)
+ _ShowPopup(false);
+ }
+ }
+
+ if (mouseEvent.RB)
+ {
+ if (!_ExitPopupVisible)
+ {
+ if (_GameData.CurrentRoundNr == 1 && _Status != EStatus.FieldSelected)
+ _Back();
+ else if (_Status == EStatus.None)
+ _EndParty();
+ else
+ _ShowPopup(true);
+ }
+ else
+ _ShowPopup(false);
+ }
+
+ if (mouseEvent.Wheel != 0) {}
+
+ return true;
+ }
+
+ public override void OnShow()
+ {
+ base.OnShow();
+
+ _PreviewStream = -1;
+
+ if (_GameData.CurrentRoundNr == 1)
+ {
+ _BuildWinnerPossibilities();
+ _SelectedField = -1;
+ Buttons[_ButtonBack].Visible = true;
+ Buttons[_ButtonExit].Visible = false;
+ SetInteractionToButton(Buttons[_ButtonBack]);
+ }
+ else
+ {
+ Buttons[_ButtonBack].Visible = false;
+ Buttons[_ButtonExit].Visible = true;
+ SetInteractionToButton(Buttons[_ButtonExit]);
+ }
+
+ _Status = EStatus.FieldChoosing;
+
+ _UpdateFields();
+ _UpdateFieldContents();
+
+ int winner = _GetWinner();
+ if (_GameData.CurrentRoundNr <= _GameData.NumFields && winner == 0)
+ {
+ _UpdateTeamChoosingMessage();
+ 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[_ButtonNextRound].Visible = false;
+ Texts[_TextFinishMessage].Visible = true;
+ Texts[_TextTeamChoosing].Visible = false;
+ if (winner > 0)
+ {
+ 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[_TextFinishMessage].Color = new SColorF(1, 1, 1, 1);
+ Texts[_TextFinishMessage].Text = CBase.Language.Translate("TR_SCREENMAIN_NOWINNER", _PartyModeID);
+ }
+ SetInteractionToButton(Buttons[_ButtonExit]);
+ }
+
+ _ShowPopup(false);
+ }
+
+ public override bool UpdateGame()
+ {
+ return true;
+ }
+
+ public override bool Draw()
+ {
+ base.Draw();
+ return true;
+ }
+
+ public override void OnClose()
+ {
+ base.OnClose();
+ CBase.BackgroundMusic.SetStatus(false);
+ CBase.Sound.FadeAndStop(_PreviewStream, 0f, 0.5f);
+ }
+
+ private void _CreateFields()
+ {
+ for (int i = 0; i < 25; i++)
+ {
+ CField f = new CField();
+ f.Button = GetNewButton(Buttons[_ButtonField]);
+ f.Button.Visible = false;
+ f.Content = new CRound();
+ AddButton(f.Button);
+ _Fields.Add(f);
+ }
+ }
+
+ private void _UpdateFields()
+ {
+ 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)
+ _FieldSize = fieldSizeX;
+ else
+ _FieldSize = fieldSizeY;
+ _FieldFirstX = CBase.Settings.GetRenderW() / 2 - (numOneRow * _FieldSize + (numOneRow - 1) * _FieldSpace) / 2;
+ _FieldFirstY = 140 + (CBase.Settings.GetRenderH() - 140) / 2 - (numOneRow * _FieldSize + numOneRow * _FieldSpace) / 2;
+ int row = 0;
+ int column = 0;
+ float x = _FieldFirstX;
+ float y = _FieldFirstY;
+ for (int i = 0; i < _Fields.Count; i++)
+ {
+ if (i < _GameData.NumFields)
+ {
+ _Fields[i].Button.Rect.W = _FieldSize;
+ _Fields[i].Button.Rect.H = _FieldSize;
+ _Fields[i].Button.Rect.X = x;
+ _Fields[i].Button.Rect.Y = y;
+ _Fields[i].Button.Visible = true;
+ _Fields[i].Button.Enabled = true;
+ column++;
+ if ((i + 1) >= numOneRow * (row + 1))
+ {
+ column = 0;
+ row++;
+ y = _FieldFirstY + _FieldSize * row + _FieldSpace * row;
+ x = _FieldFirstX;
+ }
+ else
+ x = _FieldFirstX + _FieldSize * column + _FieldSpace * column;
+ }
+ else
+ {
+ _Fields[i].Button.Visible = false;
+ _Fields[i].Button.Enabled = false;
+ }
+ }
+ }
+
+ private void _UpdateFieldContents()
+ {
+ for (int i = 0; i < _GameData.Rounds.Count; i++)
+ {
+ _Fields[i].Button.Enabled = true;
+ _Fields[i].Button.Texture = Buttons[_ButtonField].Texture;
+ _Fields[i].Button.Color = Buttons[_ButtonField].Color;
+ _Fields[i].Button.SelColor = Buttons[_ButtonField].SelColor;
+ _Fields[i].Content = _GameData.Rounds[i];
+ if (_Fields[i].Content.Finished)
+ {
+ _Fields[i].Button.Enabled = false;
+ _Fields[i].Button.Texture = CBase.Songs.GetSongByID(_Fields[i].Content.SongID).CoverTextureBig;
+ _Fields[i].Button.Color = CBase.Theme.GetPlayerColor(_Fields[i].Content.Winner);
+ _Fields[i].Button.SelColor = CBase.Theme.GetPlayerColor(_Fields[i].Content.Winner);
+ }
+ if (_Status == EStatus.FieldSelected && _SelectedField == i)
+ {
+ _Fields[i].Button.Texture = CBase.Songs.GetSongByID(_Fields[i].Content.SongID).CoverTextureBig;
+ _Fields[i].Button.Color = new SColorF(1, 1, 1, 1);
+ _Fields[i].Button.SelColor = new SColorF(1, 1, 1, 1);
+ _Fields[i].Button.Enabled = false;
+ }
+ if (_Status == EStatus.JokerRetry && _Fields[i].Content.Finished)
+ {
+ _Fields[i].Button.SelColor = 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)
+ _Fields[i].Button.Enabled = false;
+ }
+ }
+
+ private void _FieldSelected()
+ {
+ int songID = 0;
+ int singerTeam1 = 0;
+ int singerTeam2 = 0;
+ if (_GameData.Songs.Count > 0)
+ {
+ songID = _GameData.Songs[0];
+ _GameData.Songs.RemoveAt(0);
+ }
+ if (_GameData.PlayerTeam1.Count > 0)
+ {
+ singerTeam1 = _GameData.PlayerTeam1[0];
+ _GameData.PlayerTeam1.RemoveAt(0);
+ }
+
+ if (_GameData.PlayerTeam2.Count > 0)
+ {
+ singerTeam2 = _GameData.PlayerTeam2[0];
+ _GameData.PlayerTeam2.RemoveAt(0);
+ }
+ CSong song = CBase.Songs.GetSongByID(songID);
+
+ CBase.BackgroundMusic.SetStatus(true);
+
+ _PreviewStream = CBase.Sound.Load(song.GetMP3(), false);
+ CBase.Sound.SetPosition(_PreviewStream, song.PreviewStart);
+ CBase.Sound.SetStreamVolume(_PreviewStream, 0f);
+ CBase.Sound.Play(_PreviewStream);
+ CBase.Sound.Fade(_PreviewStream, CBase.Config.GetBackgroundMusicVolume(), 1f);
+ _Status = EStatus.FieldSelected;
+ _Fields[_SelectedField].Content.SongID = songID;
+ _GameData.Rounds[_SelectedField].SongID = songID;
+ _GameData.Rounds[_SelectedField].SingerTeam1 = singerTeam1;
+ _GameData.Rounds[_SelectedField].SingerTeam2 = singerTeam2;
+ _UpdateFieldContents();
+
+ Texts[_TextNextPlayerT1].Visible = true;
+ Texts[_TextNextPlayerT2].Visible = true;
+ Texts[_TextNextPlayerNameT1].Visible = true;
+ Texts[_TextNextPlayerNameT2].Visible = true;
+ SProfile[] profiles = CBase.Profiles.GetProfiles();
+ Texts[_TextNextPlayerNameT1].Text = profiles[_GameData.ProfileIDsTeam1[_GameData.Rounds[_SelectedField].SingerTeam1]].PlayerName;
+ Texts[_TextNextPlayerNameT2].Text = profiles[_GameData.ProfileIDsTeam2[_GameData.Rounds[_SelectedField].SingerTeam2]].PlayerName;
+ Statics[_StaticAvatarT1].Visible = true;
+ Statics[_StaticAvatarT2].Visible = true;
+ Statics[_StaticAvatarT1].Texture = profiles[_GameData.ProfileIDsTeam1[_GameData.Rounds[_SelectedField].SingerTeam1]].Avatar.Texture;
+ Statics[_StaticAvatarT2].Texture = profiles[_GameData.ProfileIDsTeam2[_GameData.Rounds[_SelectedField].SingerTeam2]].Avatar.Texture;
+
+ _UpdateJokerButtons();
+
+ Buttons[_ButtonNextRound].Visible = true;
+ Buttons[_ButtonExit].Visible = true;
+ Buttons[_ButtonBack].Visible = false;
+
+ SetInteractionToButton(Buttons[_ButtonNextRound]);
+ }
+
+ private void _FieldSelectedAgain()
+ {
+ int songID = _Fields[_SelectedField].Content.SongID;
+ CSong song = CBase.Songs.GetSongByID(songID);
+ CBase.BackgroundMusic.SetStatus(true);
+
+ _PreviewStream = CBase.Sound.Load(song.GetMP3(), false);
+ CBase.Sound.SetPosition(_PreviewStream, song.PreviewStart);
+ CBase.Sound.SetStreamVolume(_PreviewStream, 0f);
+ CBase.Sound.Play(_PreviewStream);
+ CBase.Sound.Fade(_PreviewStream, CBase.Config.GetBackgroundMusicVolume(), 1f);
+ _Status = EStatus.FieldSelected;
+ _Fields[_SelectedField].Content.SongID = songID;
+ _GameData.Rounds[_SelectedField].SongID = songID;
+ _GameData.Rounds[_SelectedField].SingerTeam1 = _GameData.Rounds[_OldSelectedField].SingerTeam1;
+ _GameData.Rounds[_SelectedField].SingerTeam2 = _GameData.Rounds[_OldSelectedField].SingerTeam2;
+ _UpdateFieldContents();
+
+ Texts[_TextNextPlayerT1].Visible = true;
+ Texts[_TextNextPlayerT2].Visible = true;
+ Texts[_TextNextPlayerNameT1].Visible = true;
+ Texts[_TextNextPlayerNameT2].Visible = true;
+ SProfile[] profiles = CBase.Profiles.GetProfiles();
+ Texts[_TextNextPlayerNameT1].Text = profiles[_GameData.ProfileIDsTeam1[_GameData.Rounds[_SelectedField].SingerTeam1]].PlayerName;
+ Texts[_TextNextPlayerNameT2].Text = profiles[_GameData.ProfileIDsTeam2[_GameData.Rounds[_SelectedField].SingerTeam2]].PlayerName;
+ Statics[_StaticAvatarT1].Visible = true;
+ Statics[_StaticAvatarT2].Visible = true;
+ Statics[_StaticAvatarT1].Texture = profiles[_GameData.ProfileIDsTeam1[_GameData.Rounds[_SelectedField].SingerTeam1]].Avatar.Texture;
+ Statics[_StaticAvatarT2].Texture = profiles[_GameData.ProfileIDsTeam2[_GameData.Rounds[_SelectedField].SingerTeam2]].Avatar.Texture;
+
+ _UpdateJokerButtons();
+
+ Buttons[_ButtonNextRound].Visible = true;
+ Buttons[_ButtonExit].Visible = true;
+ Buttons[_ButtonBack].Visible = false;
+
+ SetInteractionToButton(Buttons[_ButtonNextRound]);
+ }
+
+ private void _UseJoker(int teamNr, int jokerNum)
+ {
+ switch (jokerNum)
+ {
+ //Random-Joker
+ case 0:
+ if (_GameData.NumJokerRandom[teamNr] > 0)
+ {
+ _GameData.NumJokerRandom[teamNr]--;
+ if (!CBase.Sound.IsFinished(_PreviewStream))
+ CBase.Sound.FadeAndStop(_PreviewStream, 0, 1);
+ _FieldSelected();
+ }
+ break;
+
+ //Retry-Joker
+ case 1:
+ if (_GameData.NumJokerRetry[teamNr] > 0 && _GameData.CurrentRoundNr > 1)
+ {
+ _GameData.NumJokerRetry[teamNr]--;
+ _GameData.Team = teamNr;
+ if (!CBase.Sound.IsFinished(_PreviewStream))
+ CBase.Sound.FadeAndStop(_PreviewStream, 0, 1);
+ _Status = EStatus.JokerRetry;
+ _OldSelectedField = _SelectedField;
+ _SelectedField = -1;
+ _UpdateFieldContents();
+ }
+ break;
+ }
+ _UpdateJokerButtons();
+ }
+
+ private void _UpdateTeamChoosingMessage()
+ {
+ 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[_TextTeamChoosing].Visible = true;
+ else
+ Texts[_TextTeamChoosing].Visible = false;
+ }
+
+ private void _UpdateJokerButtons()
+ {
+ 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()
+ {
+ CBase.Sound.FadeAndStop(_PreviewStream, 0f, 0.5f);
+ _Data.ScreenMain.Rounds = _GameData.Rounds;
+ _Data.ScreenMain.FadeToNameSelection = false;
+ _Data.ScreenMain.FadeToSinging = true;
+ _Data.ScreenMain.Songs = _GameData.Songs;
+ _Data.ScreenMain.SingRoundNr = _SelectedField;
+ _Data.ScreenMain.PlayerTeam1 = _GameData.PlayerTeam1;
+ _Data.ScreenMain.PlayerTeam2 = _GameData.PlayerTeam2;
+ _PartyMode.DataFromScreen(ThemeName, _Data);
+ }
+
+ private void _EndParty()
+ {
+ CBase.Sound.FadeAndStop(_PreviewStream, 0f, 0.5f);
+ _FadeTo(EScreens.ScreenParty);
+ }
+
+ private void _ShowPopup(bool visible)
+ {
+ _ExitPopupVisible = visible;
+
+ Statics[_StaticPopupBG].Visible = _ExitPopupVisible;
+ Texts[_TextPopupReallyExit].Visible = _ExitPopupVisible;
+ Buttons[_ButtonPopupYes].Visible = _ExitPopupVisible;
+ Buttons[_ButtonPopupNo].Visible = _ExitPopupVisible;
+
+ if (_ExitPopupVisible)
+ SetInteractionToButton(Buttons[_ButtonPopupNo]);
+ }
+
+ private void _Back()
+ {
+ CBase.Sound.FadeAndStop(_PreviewStream, 0f, 0.5f);
+ _Data.ScreenMain.FadeToNameSelection = true;
+ _Data.ScreenMain.FadeToSinging = false;
+ _Data.ScreenMain.SingRoundNr = _SelectedField;
+ _PartyMode.DataFromScreen(ThemeName, _Data);
+ }
+
+ private int _BuildWinnerPossibilities()
+ {
+ 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++)
+ _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);
+ }
+ 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;
+ }
+
+ private int _GetWinner()
+ {
+ for (int i = 0; i < _Possibilities.GetLength(0); i++)
+ {
+ List check = new List();
+ for (int j = 0; j < _Possibilities.GetLength(1); j++)
+ {
+ if (_Fields[_Possibilities[i, j]].Content.Winner > 0)
+ check.Add(_Fields[_Possibilities[i, j]].Content.Winner);
+ }
+ if (check.Count == _Possibilities.GetLength(1))
+ {
+ //Check for winner
+ if (check.Contains(1) && !check.Contains(2))
+ return 1;
+ else if (check.Contains(2) && !check.Contains(1))
+ return 2;
+ }
+ }
+ return 0;
+ }
+ }
+}
\ No newline at end of file
diff --git a/PartyModes/PartyModeTicTacToe/CPartyScreenTicTacToeNames.cs b/PartyModes/PartyModeTicTacToe/CPartyScreenTicTacToeNames.cs
new file mode 100644
index 00000000..05d5eb5b
--- /dev/null
+++ b/PartyModes/PartyModeTicTacToe/CPartyScreenTicTacToeNames.cs
@@ -0,0 +1,646 @@
+using System;
+using System.Collections.Generic;
+using System.Windows.Forms;
+using VocaluxeLib.Menu;
+
+namespace VocaluxeLib.PartyModes.TicTacToe
+{
+ public class CPartyScreenTicTacToeNames : CMenuParty
+ {
+ // Version number for theme files. Increment it, if you've changed something on the theme files!
+ protected override int _ScreenVersion
+ {
+ get { return 1; }
+ }
+
+ 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 _PlayerChooseButtons;
+ private List _PlayerDestinationButtons;
+ //PlayerDestinationButtons-Option
+ private const int _PlayerDestinationButtonsNumH = 10;
+ private const int _PlayerDestinationButtonsNumW = 2;
+ private const int _PlayerDestinationButtonsFirstX = 58;
+ private const int _PlayerDestinationButtonsFirstY = 380;
+ private const int _PlayerDestinationButtonsSpaceH = 15;
+ private const int _PlayerDestinationButtonsSpaceW = 25;
+ //PlayerChooseButtons-Option
+ private List _PlayerChooseButtonsVisibleProfiles;
+ private const int _PlayerChooseButtonsNumH = 10;
+ private const int _PlayerChooseButtonsNumW = 2;
+ private const int _PlayerChooseButtonsFirstX = 58;
+ private const int _PlayerChooseButtonsFirstY = 105;
+ private const int _PlayerChooseButtonsSpaceH = 15;
+ private const int _PlayerChooseButtonsSpaceW = 25;
+ private int _PlayerChooseButtonsOffset;
+
+ private CStatic _ChooseAvatarStatic;
+ private bool _SelectingMouseActive;
+ private int _OldMouseX;
+ private int _OldMouseY;
+ private int _SelectedPlayerNr = -1;
+ private bool _ButtonsAdded;
+
+ private int _NumPlayerTeam1 = 2;
+ private int _NumPlayerTeam2 = 2;
+
+ private SDataFromScreen _Data;
+
+ private class CPlayerChooseButton
+ {
+ public CButton Button;
+ public int ProfileID;
+ }
+
+ public override void Init()
+ {
+ base.Init();
+
+ _ChooseAvatarStatic = GetNewStatic();
+ _ChooseAvatarStatic.Visible = false;
+
+ _PlayerChooseButtonsVisibleProfiles = new List();
+
+ _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();
+ SFromScreenNames names = new SFromScreenNames();
+ names.FadeToConfig = false;
+ names.FadeToMain = false;
+ names.ProfileIDsTeam1 = new List();
+ names.ProfileIDsTeam2 = new List();
+ _Data.ScreenNames = names;
+ }
+
+ public override void DataToScreen(object receivedData)
+ {
+ SDataToScreenNames config = new SDataToScreenNames();
+
+ try
+ {
+ config = (SDataToScreenNames)receivedData;
+ _Data.ScreenNames.ProfileIDsTeam1 = config.ProfileIDsTeam1;
+ _Data.ScreenNames.ProfileIDsTeam2 = config.ProfileIDsTeam2;
+ if (_Data.ScreenNames.ProfileIDsTeam1 == null)
+ _Data.ScreenNames.ProfileIDsTeam1 = new List();
+ if (_Data.ScreenNames.ProfileIDsTeam2 == null)
+ _Data.ScreenNames.ProfileIDsTeam2 = new List();
+
+ _NumPlayerTeam1 = config.NumPlayerTeam1;
+ _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);
+ }
+ }
+
+ public override bool HandleInput(SKeyEvent keyEvent)
+ {
+ base.HandleInput(keyEvent);
+
+ if (keyEvent.KeyPressed) {}
+ else
+ {
+ switch (keyEvent.Key)
+ {
+ case Keys.Back:
+ case Keys.Escape:
+ _Back();
+ break;
+
+ case Keys.Enter:
+ if (Buttons[_ButtonBack].Selected)
+ _Back();
+
+ if (Buttons[_ButtonNext].Selected)
+ _Next();
+
+ if (Buttons[_ButtonPlayerChooseScrollUp].Selected)
+ _Scroll(-1);
+
+ if (Buttons[_ButtonPlayerChooseScrollDown].Selected)
+ _Scroll(1);
+
+ if (!_OnAdd())
+ _OnRemove();
+ break;
+
+ case Keys.Delete:
+ _OnRemove();
+ break;
+ }
+ }
+ return true;
+ }
+
+ public override bool HandleMouse(SMouseEvent mouseEvent)
+ {
+ base.HandleMouse(mouseEvent);
+
+ //Check if LeftButton is hold and Select-Mode inactive
+ if (mouseEvent.LBH && !_SelectingMouseActive)
+ {
+ //Save mouse-coords
+ _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)
+ {
+ _SelectedPlayerNr = _PlayerChooseButtons[i].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.Z = -100;
+ _ChooseAvatarStatic.Color = new SColorF(1, 1, 1, 1);
+ _ChooseAvatarStatic.Texture = CBase.Profiles.GetProfiles()[_SelectedPlayerNr].Avatar.Texture;
+ }
+ }
+ }
+ return true;
+ }
+
+ //Check if LeftButton is hold and Select-Mode active
+ 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;
+
+ return true;
+ }
+ // LeftButton isn't hold anymore, but Selec-Mode is still active -> "Drop" of Avatar
+ else if (_SelectingMouseActive)
+ {
+ //Check if really a player was selected
+ if (_SelectedPlayerNr != -1)
+ {
+ //Foreach Drop-Area
+ for (int i = 0; i < _PlayerDestinationButtons.Count; i++)
+ {
+ //Check first, if area is "active"
+ if (_PlayerDestinationButtons[i].Visible)
+ {
+ //Check if Mouse is in area
+ if (CHelper.IsInBounds(_PlayerDestinationButtons[i].Rect, mouseEvent))
+ {
+ int added = -1;
+ //Add Player-ID to list.
+ if (i - _PlayerDestinationButtonsNumH < 0)
+ {
+ if (_Data.ScreenNames.ProfileIDsTeam1.Count < (i + 1))
+ {
+ _Data.ScreenNames.ProfileIDsTeam1.Add(_SelectedPlayerNr);
+ added = _Data.ScreenNames.ProfileIDsTeam1.Count - 1;
+ }
+ else if (_Data.ScreenNames.ProfileIDsTeam1.Count >= (i + 1))
+ {
+ _Data.ScreenNames.ProfileIDsTeam1[i] = _SelectedPlayerNr;
+ added = i;
+ }
+ }
+ else if (i - _PlayerDestinationButtonsNumH >= 0)
+ {
+ if (_Data.ScreenNames.ProfileIDsTeam2.Count < ((i - _PlayerDestinationButtonsNumH) + 1))
+ {
+ _Data.ScreenNames.ProfileIDsTeam2.Add(_SelectedPlayerNr);
+ added = _Data.ScreenNames.ProfileIDsTeam2.Count - 1 + _PlayerDestinationButtonsNumH;
+ }
+ else if (_Data.ScreenNames.ProfileIDsTeam2.Count >= ((i - _PlayerDestinationButtonsNumH) + 1))
+ {
+ _Data.ScreenNames.ProfileIDsTeam2[i - _PlayerDestinationButtonsNumH] = _SelectedPlayerNr;
+ added = i;
+ }
+ }
+ _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 = _ChooseAvatarStatic.Texture;
+ _PlayerDestinationButtons[added].SelTexture = _ChooseAvatarStatic.Texture;
+ _PlayerDestinationButtons[added].Text.Text = CBase.Profiles.GetProfiles()[_SelectedPlayerNr].PlayerName;
+ _PlayerDestinationButtons[added].Enabled = true;
+ //Update Tiles-List
+ _UpdateButtonPlayerChoose();
+ }
+ }
+ }
+ _SelectedPlayerNr = -1;
+ }
+ //Reset variables
+ _SelectingMouseActive = false;
+ _ChooseAvatarStatic.Visible = false;
+ return true;
+ }
+
+ if (mouseEvent.LB && IsMouseOver(mouseEvent))
+ {
+ if (Buttons[_ButtonBack].Selected)
+ _Back();
+
+ if (Buttons[_ButtonNext].Selected)
+ _Next();
+
+ if (Buttons[_ButtonPlayerChooseScrollUp].Selected)
+ _Scroll(-1);
+
+ if (Buttons[_ButtonPlayerChooseScrollDown].Selected)
+ _Scroll(1);
+ }
+
+ if (mouseEvent.LD && IsMouseOver(mouseEvent))
+ {
+ if (!_OnAdd())
+ _OnRemove();
+ }
+
+ if (mouseEvent.RB)
+ _Back();
+
+ return true;
+ }
+
+ public override void OnShow()
+ {
+ base.OnShow();
+
+ if (!_ButtonsAdded)
+ {
+ _AddButtonPlayerDestination();
+ _AddButtonPlayerChoose();
+ _ButtonsAdded = true;
+ }
+
+ _UpdateButtonPlayerDestination();
+ _UpdateButtonPlayerChoose();
+
+ _UpdateButtonNext();
+ }
+
+ public override bool UpdateGame()
+ {
+ return true;
+ }
+
+ public override bool Draw()
+ {
+ base.Draw();
+ if (_ChooseAvatarStatic.Visible)
+ _ChooseAvatarStatic.Draw();
+ return true;
+ }
+
+ private void _Scroll(int offset)
+ {
+ if (offset < 0 && _PlayerChooseButtonsOffset > 0)
+ {
+ _PlayerChooseButtonsOffset += offset;
+ _UpdateButtonPlayerChoose();
+ }
+ else if (_PlayerChooseButtonsVisibleProfiles.Count < _PlayerChooseButtons.Count + (_PlayerChooseButtonsOffset + offset) * _PlayerChooseButtonsNumH)
+ {
+ _PlayerChooseButtonsOffset += offset;
+ _UpdateButtonPlayerChoose();
+ }
+ }
+
+ private void _AddButtonPlayerDestination()
+ {
+ Buttons[_ButtonPlayerDestination].Visible = false;
+ _PlayerDestinationButtons = new List();
+ int row = 0;
+ int column = 0;
+ for (int i = 1; i <= _PartyMode.GetMaxPlayer(); i++)
+ {
+ 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);
+ column++;
+ if (column >= _PlayerDestinationButtonsNumH)
+ {
+ row++;
+ column = 0;
+ }
+ b.Visible = true;
+ b.Enabled = false;
+ AddButton(b);
+ }
+ }
+
+ private void _AddButtonPlayerChoose()
+ {
+ Buttons[_ButtonPlayerChoose].Visible = false;
+ _PlayerChooseButtons = new List();
+ int row = 0;
+ int column = 0;
+ for (int i = 1; i <= _PlayerChooseButtonsNumH * _PlayerChooseButtonsNumW; i++)
+ {
+ 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();
+ pcb.Button = b;
+ pcb.ProfileID = -1;
+ _PlayerChooseButtons.Add(pcb);
+ column++;
+ if (column >= _PlayerChooseButtonsNumH)
+ {
+ row++;
+ column = 0;
+ }
+ b.Visible = true;
+ b.Enabled = false;
+ AddButton(b);
+ }
+ }
+
+ private void _UpdateButtonPlayerChoose()
+ {
+ _UpdateVisibleProfiles();
+ if ((_PlayerChooseButtonsNumW * _PlayerChooseButtonsNumH) * (_PlayerChooseButtonsOffset + 1) - _PlayerChooseButtonsVisibleProfiles.Count >=
+ (_PlayerChooseButtonsNumW * _PlayerChooseButtonsNumH) * _PlayerChooseButtonsOffset)
+ _UpdateButtonPlayerChoose(_PlayerChooseButtonsOffset - 1);
+ else
+ _UpdateButtonPlayerChoose(_PlayerChooseButtonsOffset);
+ Buttons[_ButtonPlayerChooseScrollUp].Enabled = _PlayerChooseButtonsOffset > 0;
+ Buttons[_ButtonPlayerChooseScrollDown].Enabled = _PlayerChooseButtonsVisibleProfiles.Count >
+ _PlayerChooseButtons.Count + _PlayerChooseButtonsOffset * _PlayerChooseButtonsNumH;
+ }
+
+ private void _UpdateButtonPlayerChoose(int offset)
+ {
+ int numButtonPlayerChoose = _PlayerChooseButtonsNumW * _PlayerChooseButtonsNumH;
+ if (offset < 0)
+ offset = 0;
+
+ if (numButtonPlayerChoose * (offset + 1) - _PlayerChooseButtonsVisibleProfiles.Count <= numButtonPlayerChoose)
+ {
+ for (int i = 0; i < numButtonPlayerChoose; i++)
+ {
+ if ((i + offset * numButtonPlayerChoose) < _PlayerChooseButtonsVisibleProfiles.Count)
+ {
+ _PlayerChooseButtons[i].ProfileID = _PlayerChooseButtonsVisibleProfiles[i + offset * numButtonPlayerChoose];
+ _PlayerChooseButtons[i].Button.Text.Text = CBase.Profiles.GetProfiles()[_PlayerChooseButtonsVisibleProfiles[i + offset * numButtonPlayerChoose]].PlayerName;
+ _PlayerChooseButtons[i].Button.Texture = CBase.Profiles.GetProfiles()[_PlayerChooseButtonsVisibleProfiles[i + offset * numButtonPlayerChoose]].Avatar.Texture;
+ _PlayerChooseButtons[i].Button.SelTexture = CBase.Profiles.GetProfiles()[_PlayerChooseButtonsVisibleProfiles[i + offset * numButtonPlayerChoose]].Avatar.Texture;
+ _PlayerChooseButtons[i].Button.Color = new SColorF(1, 1, 1, 0.6f);
+ _PlayerChooseButtons[i].Button.SelColor = new SColorF(1, 1, 1, 1);
+ _PlayerChooseButtons[i].Button.Enabled = true;
+ }
+ else
+ {
+ _PlayerChooseButtons[i].ProfileID = -1;
+ _PlayerChooseButtons[i].Button.Text.Text = String.Empty;
+ _PlayerChooseButtons[i].Button.Texture = Buttons[_ButtonPlayerChoose].Texture;
+ _PlayerChooseButtons[i].Button.SelTexture = Buttons[_ButtonPlayerChoose].SelTexture;
+ _PlayerChooseButtons[i].Button.Color = Buttons[_ButtonPlayerChoose].Color;
+ _PlayerChooseButtons[i].Button.SelColor = Buttons[_ButtonPlayerChoose].SelColor;
+ _PlayerChooseButtons[i].Button.Enabled = false;
+ }
+ }
+ }
+ }
+
+ private void _UpdateVisibleProfiles()
+ {
+ _PlayerChooseButtonsVisibleProfiles.Clear();
+ for (int i = 0; i < CBase.Profiles.GetProfiles().Length; i++)
+ {
+ bool visible = false;
+ //Show profile only if active
+ if (CBase.Profiles.GetProfiles()[i].Active == EOffOn.TR_CONFIG_ON)
+ {
+ visible = true;
+
+ for (int p = 0; p < _Data.ScreenNames.ProfileIDsTeam1.Count; p++)
+ {
+ //Don't show profile if is selected
+ if (_Data.ScreenNames.ProfileIDsTeam1[p] == i)
+ {
+ visible = false;
+ break;
+ }
+ }
+
+ for (int p = 0; p < _Data.ScreenNames.ProfileIDsTeam2.Count; p++)
+ {
+ //Don't show profile if is selected
+ if (_Data.ScreenNames.ProfileIDsTeam2[p] == i)
+ {
+ visible = false;
+ break;
+ }
+ }
+ }
+ if (visible)
+ _PlayerChooseButtonsVisibleProfiles.Add(i);
+ }
+ }
+
+ private void _UpdateButtonPlayerDestination()
+ {
+ for (int i = 0; i < _PlayerDestinationButtons.Count / 2; i++)
+ {
+ if (_NumPlayerTeam1 > i)
+ {
+ _PlayerDestinationButtons[i].Visible = true;
+ _PlayerDestinationButtons[i].Enabled = true;
+ }
+ else
+ {
+ _PlayerDestinationButtons[i].Visible = false;
+ _PlayerDestinationButtons[i].Enabled = false;
+ }
+ }
+ for (int i = 0; i < _PlayerDestinationButtons.Count / 2; i++)
+ {
+ if (_NumPlayerTeam2 > i)
+ {
+ _PlayerDestinationButtons[i + _PlayerDestinationButtonsNumH].Visible = true;
+ _PlayerDestinationButtons[i + _PlayerDestinationButtonsNumH].Enabled = true;
+ }
+ else
+ {
+ _PlayerDestinationButtons[i + _PlayerDestinationButtonsNumH].Visible = false;
+ _PlayerDestinationButtons[i + _PlayerDestinationButtonsNumH].Enabled = false;
+ }
+ }
+ for (int i = 0; i < _NumPlayerTeam1; i++)
+ {
+ if (i < _Data.ScreenNames.ProfileIDsTeam1.Count)
+ {
+ if (_Data.ScreenNames.ProfileIDsTeam1[i] != -1)
+ {
+ _PlayerDestinationButtons[i].Color = new SColorF(1, 1, 1, 0.6f);
+ _PlayerDestinationButtons[i].SelColor = new SColorF(1, 1, 1, 1);
+ _PlayerDestinationButtons[i].Texture = CBase.Profiles.GetProfiles()[_Data.ScreenNames.ProfileIDsTeam1[i]].Avatar.Texture;
+ _PlayerDestinationButtons[i].SelTexture = CBase.Profiles.GetProfiles()[_Data.ScreenNames.ProfileIDsTeam1[i]].Avatar.Texture;
+ _PlayerDestinationButtons[i].Text.Text = CBase.Profiles.GetProfiles()[_Data.ScreenNames.ProfileIDsTeam1[i]].PlayerName;
+ _PlayerDestinationButtons[i].Enabled = true;
+ }
+ }
+ else
+ {
+ _PlayerDestinationButtons[i].Color = Buttons[_ButtonPlayerDestination].Color;
+ _PlayerDestinationButtons[i].SelColor = Buttons[_ButtonPlayerDestination].SelColor;
+ _PlayerDestinationButtons[i].Texture = Buttons[_ButtonPlayerDestination].Texture;
+ _PlayerDestinationButtons[i].SelTexture = Buttons[_ButtonPlayerDestination].SelTexture;
+ _PlayerDestinationButtons[i].Text.Text = String.Empty;
+ _PlayerDestinationButtons[i].Enabled = false;
+ }
+ }
+ for (int i = 0; i < _NumPlayerTeam2; i++)
+ {
+ if (i < _Data.ScreenNames.ProfileIDsTeam2.Count)
+ {
+ if (_Data.ScreenNames.ProfileIDsTeam2[i] != -1)
+ {
+ _PlayerDestinationButtons[i + _PlayerDestinationButtonsNumH].Color = new SColorF(1, 1, 1, 0.6f);
+ _PlayerDestinationButtons[i + _PlayerDestinationButtonsNumH].SelColor = new SColorF(1, 1, 1, 1);
+ _PlayerDestinationButtons[i + _PlayerDestinationButtonsNumH].Texture = CBase.Profiles.GetProfiles()[_Data.ScreenNames.ProfileIDsTeam2[i]].Avatar.Texture;
+ _PlayerDestinationButtons[i + _PlayerDestinationButtonsNumH].SelTexture = CBase.Profiles.GetProfiles()[_Data.ScreenNames.ProfileIDsTeam2[i]].Avatar.Texture;
+ _PlayerDestinationButtons[i + _PlayerDestinationButtonsNumH].Text.Text = CBase.Profiles.GetProfiles()[_Data.ScreenNames.ProfileIDsTeam2[i]].PlayerName;
+ _PlayerDestinationButtons[i + _PlayerDestinationButtonsNumH].Enabled = true;
+ }
+ }
+ else
+ {
+ _PlayerDestinationButtons[i + _PlayerDestinationButtonsNumH].Color = Buttons[_ButtonPlayerDestination].Color;
+ _PlayerDestinationButtons[i + _PlayerDestinationButtonsNumH].SelColor = Buttons[_ButtonPlayerDestination].SelColor;
+ _PlayerDestinationButtons[i + _PlayerDestinationButtonsNumH].Texture = Buttons[_ButtonPlayerDestination].Texture;
+ _PlayerDestinationButtons[i + _PlayerDestinationButtonsNumH].SelTexture = Buttons[_ButtonPlayerDestination].SelTexture;
+ _PlayerDestinationButtons[i + _PlayerDestinationButtonsNumH].Text.Text = String.Empty;
+ _PlayerDestinationButtons[i + _PlayerDestinationButtonsNumH].Enabled = false;
+ }
+ }
+ }
+
+ private void _UpdateButtonNext()
+ {
+ if (_Data.ScreenNames.ProfileIDsTeam1.Count == _NumPlayerTeam1 && _Data.ScreenNames.ProfileIDsTeam2.Count == _NumPlayerTeam2)
+ {
+ Buttons[_ButtonNext].Visible = true;
+ SetInteractionToButton(Buttons[_ButtonNext]);
+ }
+ else
+ Buttons[_ButtonNext].Visible = false;
+ }
+
+ private bool _OnAdd()
+ {
+ for (int i = 0; i < _PlayerChooseButtons.Count; i++)
+ {
+ if (_PlayerChooseButtons[i].Button.Selected && _PlayerChooseButtons[i].ProfileID != -1)
+ {
+ if (_Data.ScreenNames.ProfileIDsTeam1.Count < _NumPlayerTeam1)
+ {
+ _Data.ScreenNames.ProfileIDsTeam1.Add(_PlayerChooseButtons[i].ProfileID);
+ int added = _Data.ScreenNames.ProfileIDsTeam1.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].Enabled = true;
+ //Update Tiles-List
+ _UpdateButtonPlayerChoose();
+ CheckInteraction();
+ return true;
+ }
+ else if (_Data.ScreenNames.ProfileIDsTeam2.Count < _NumPlayerTeam2)
+ {
+ _Data.ScreenNames.ProfileIDsTeam2.Add(_PlayerChooseButtons[i].ProfileID);
+ int added = (_Data.ScreenNames.ProfileIDsTeam2.Count - 1) + _PlayerDestinationButtonsNumH;
+ _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].Enabled = true;
+ //Update Tiles-List
+ _UpdateButtonPlayerChoose();
+ CheckInteraction();
+ return true;
+ }
+ }
+ }
+ return false;
+ }
+
+ private bool _OnRemove()
+ {
+ for (int i = 0; i < _PlayerDestinationButtonsNumH; i++)
+ {
+ if (_PlayerDestinationButtons[i].Selected)
+ {
+ if ((i + 1) <= _Data.ScreenNames.ProfileIDsTeam1.Count)
+ {
+ _Data.ScreenNames.ProfileIDsTeam1.RemoveAt(i);
+ _UpdateButtonNext();
+ _UpdateButtonPlayerDestination();
+ _UpdateButtonPlayerChoose();
+ CheckInteraction();
+ return true;
+ }
+ }
+ }
+ for (int i = _PlayerDestinationButtonsNumH; i < _PlayerDestinationButtonsNumH * 2; i++)
+ {
+ if (_PlayerDestinationButtons[i].Selected)
+ {
+ if (((i - _PlayerDestinationButtonsNumH) + 1) <= _Data.ScreenNames.ProfileIDsTeam2.Count)
+ {
+ _Data.ScreenNames.ProfileIDsTeam2.RemoveAt(i - _PlayerDestinationButtonsNumH);
+ _UpdateButtonNext();
+ _UpdateButtonPlayerDestination();
+ _UpdateButtonPlayerChoose();
+ CheckInteraction();
+ return true;
+ }
+ }
+ }
+ return false;
+ }
+
+ private void _Back()
+ {
+ _Data.ScreenNames.FadeToConfig = true;
+ _Data.ScreenNames.FadeToMain = false;
+ _PartyMode.DataFromScreen(ThemeName, _Data);
+ }
+
+ private void _Next()
+ {
+ _Data.ScreenNames.FadeToConfig = false;
+ _Data.ScreenNames.FadeToMain = true;
+ _PartyMode.DataFromScreen(ThemeName, _Data);
+ }
+ }
+}
\ No newline at end of file
diff --git a/PartyModes/PartyModeTicTacToe/PartyModeTicTacToe.cs b/PartyModes/PartyModeTicTacToe/PartyModeTicTacToe.cs
deleted file mode 100644
index 52118f69..00000000
--- a/PartyModes/PartyModeTicTacToe/PartyModeTicTacToe.cs
+++ /dev/null
@@ -1,803 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Runtime.InteropServices;
-using VocaluxeLib.Menu;
-
-[assembly: ComVisible(false)]
-
-namespace VocaluxeLib.PartyModes.TicTacToe
-{
- public enum ESongSource
- {
- TR_ALLSONGS,
- TR_CATEGORY,
- TR_PLAYLIST
- }
-
- public enum EPartyGameMode
- {
- TR_GAMEMODE_NORMAL,
- TR_GAMEMODE_SHORTSONG,
- TR_GAMEMODE_DUET
- }
-
- public class Round
- {
- public int SongID;
- public int SingerTeam1;
- public int SingerTeam2;
- public int PointsTeam1;
- public int PointsTeam2;
- public int Winner;
- public bool Finished = false;
- }
-
- #region Communication
-
- #region ToScreen
- public struct DataToScreenConfig
- {
- public int NumPlayerTeam1;
- public int NumPlayerTeam2;
- public int NumFields;
- public ESongSource SongSource;
- public int CategoryID;
- public int PlaylistID;
- public EPartyGameMode GameMode;
- }
-
- public struct DataToScreenNames
- {
- public int NumPlayerTeam1;
- public int NumPlayerTeam2;
- public List ProfileIDsTeam1;
- public List ProfileIDsTeam2;
- }
-
- public struct DataToScreenMain
- {
- public int CurrentRoundNr;
- public int Team;
- public int NumPlayerTeam1;
- public int NumPlayerTeam2;
- public int NumFields;
- public List Rounds;
- public List Songs;
- public List ProfileIDsTeam1;
- public List ProfileIDsTeam2;
- public List PlayerTeam1;
- public List PlayerTeam2;
- public int[] NumJokerRandom;
- public int[] NumJokerRetry;
- }
-
- public struct DataFromScreen
- {
- public FromScreenConfig ScreenConfig;
- public FromScreenNames ScreenNames;
- public FromScreenMain ScreenMain;
- }
-
- public struct FromScreenConfig
- {
- public int NumPlayerTeam1;
- public int NumPlayerTeam2;
- public int NumFields;
- public ESongSource SongSource;
- public int CategoryID;
- public int PlaylistID;
- public EPartyGameMode GameMode;
- }
-
- public struct FromScreenNames
- {
- public bool FadeToConfig;
- public bool FadeToMain;
- public List ProfileIDsTeam1;
- public List ProfileIDsTeam2;
- }
-
- public struct FromScreenMain
- {
- public bool FadeToSinging;
- public bool FadeToNameSelection;
- public List PlayerTeam1;
- public List PlayerTeam2;
- public List Rounds;
- public int SingRoundNr;
- public List Songs;
- }
- #endregion FromScreen
-
- #endregion Communication
-
- public sealed class PartyModeTicTacToe : CPartyMode
- {
- private const int MaxPlayer = 20;
- private const int MinPlayer = 2;
- private const int MaxTeams = 2;
- private const int MinTeams = 2;
- private const int NumFields = 9;
-
- private enum EStage
- {
- NotStarted,
- Config,
- Names,
- Main,
- Singing
- }
-
- private struct Data
- {
- public int NumPlayerTeam1;
- public int NumPlayerTeam2;
- public int NumFields;
- public int Team;
- public List ProfileIDsTeam1;
- public List ProfileIDsTeam2;
- public List PlayerTeam1;
- public List PlayerTeam2;
-
- public ESongSource SongSource;
- public int CategoryID;
- public int PlaylistID;
-
- public EPartyGameMode GameMode;
-
- public List Rounds;
- public List Songs;
-
- public int CurrentRoundNr;
- public int SingRoundNr;
-
- public int[] NumJokerRandom;
- public int[] NumJokerRetry;
- }
-
- private DataToScreenConfig ToScreenConfig;
- private DataToScreenNames ToScreenNames;
- private DataToScreenMain ToScreenMain;
-
- private Data GameData;
- private EStage _Stage;
-
- public PartyModeTicTacToe()
- {
- _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.Sorting.SearchString = String.Empty;
- _ScreenSongOptions.Sorting.SearchActive = false;
- _ScreenSongOptions.Sorting.DuetOptions = EDuetOptions.NoDuets;
-
- _Stage = EStage.NotStarted;
-
- ToScreenConfig = new DataToScreenConfig();
- ToScreenNames = new DataToScreenNames();
- ToScreenMain = new DataToScreenMain();
-
- GameData = new Data();
- GameData.NumFields = 9;
- GameData.NumPlayerTeam1 = 2;
- GameData.NumPlayerTeam2 = 2;
- GameData.ProfileIDsTeam1 = new List();
- GameData.ProfileIDsTeam2 = new List();
- GameData.PlayerTeam1 = new List();
- GameData.PlayerTeam2 = new List();
- GameData.CurrentRoundNr = 0;
- GameData.SingRoundNr = 0;
- GameData.SongSource = ESongSource.TR_ALLSONGS;
- GameData.PlaylistID = 0;
- GameData.CategoryID = 0;
- GameData.GameMode = EPartyGameMode.TR_GAMEMODE_NORMAL;
- GameData.Rounds = new List();
- GameData.Songs = new List();
- GameData.NumJokerRandom = new int[2];
- GameData.NumJokerRetry = new int[2];
- }
-
- public override bool Init()
- {
- _Stage = EStage.NotStarted;
-
- _ScreenSongOptions.Sorting.IgnoreArticles = CBase.Config.GetIgnoreArticles();
- _ScreenSongOptions.Sorting.SongSorting = CBase.Config.GetSongSorting();
- _ScreenSongOptions.Sorting.Tabs = EOffOn.TR_CONFIG_OFF;
- _ScreenSongOptions.Selection.SongIndex = -1;
-
- if (CBase.Config.GetTabs() == EOffOn.TR_CONFIG_ON && _ScreenSongOptions.Sorting.SongSorting != ESongSorting.TR_CONFIG_NONE)
- _ScreenSongOptions.Sorting.Tabs = EOffOn.TR_CONFIG_ON;
-
- ToScreenMain.Rounds = new List();
- ToScreenMain.Songs = new List();
- ToScreenMain.PlayerTeam1 = new List();
- ToScreenMain.PlayerTeam2 = new List();
- GameData.Songs = new List();
- GameData.Rounds = new List();
- GameData.PlayerTeam1 = new List();
- GameData.PlayerTeam2 = new List();
- return true;
- }
-
- public override void DataFromScreen(string ScreenName, Object Data)
- {
- DataFromScreen data = new DataFromScreen();
- switch (ScreenName)
- {
- case "PartyScreenTicTacToeConfig":
-
- try
- {
- data = (DataFromScreen)Data;
- GameData.NumPlayerTeam1 = data.ScreenConfig.NumPlayerTeam1;
- GameData.NumPlayerTeam2 = data.ScreenConfig.NumPlayerTeam2;
- GameData.NumFields = data.ScreenConfig.NumFields;
- GameData.SongSource = data.ScreenConfig.SongSource;
- GameData.CategoryID = data.ScreenConfig.CategoryID;
- GameData.PlaylistID = data.ScreenConfig.PlaylistID;
- GameData.GameMode = data.ScreenConfig.GameMode;
-
- _Stage = EStage.Config;
- CBase.Graphics.FadeTo(EScreens.ScreenPartyDummy);
- }
- catch (Exception e)
- {
- CBase.Log.LogError("Error in party mode TicTacToe. Can't cast received data from screen " + ScreenName + ". " + e.Message);
- }
- break;
-
- case "PartyScreenTicTacToeNames":
- try
- {
- data = (DataFromScreen)Data;
- if (data.ScreenNames.FadeToConfig)
- _Stage = EStage.NotStarted;
- else
- {
- if (CBase.Game.GetRandom(100) < 50)
- GameData.Team = 0;
- else
- GameData.Team = 1;
- GameData.ProfileIDsTeam1 = data.ScreenNames.ProfileIDsTeam1;
- GameData.ProfileIDsTeam2 = data.ScreenNames.ProfileIDsTeam2;
- _Stage = EStage.Names;
- }
-
- CBase.Graphics.FadeTo(EScreens.ScreenPartyDummy);
- }
- catch (Exception e)
- {
- CBase.Log.LogError("Error in party mode TicTacToe. Can't cast received data from screen " + ScreenName + ". " + e.Message);
- }
- break;
-
- case "PartyScreenTicTacToeMain":
- try
- {
- data = (DataFromScreen)Data;
- if (data.ScreenMain.FadeToSinging)
- {
- _Stage = EStage.Singing;
- GameData.Rounds = data.ScreenMain.Rounds;
- GameData.SingRoundNr = data.ScreenMain.SingRoundNr;
- GameData.Songs = data.ScreenMain.Songs;
- GameData.PlayerTeam1 = data.ScreenMain.PlayerTeam1;
- 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);
- }
-
-
- if (_Stage == EStage.Singing)
- StartRound(data.ScreenMain.SingRoundNr);
- if (_Stage == EStage.Config)
- CBase.Graphics.FadeTo(EScreens.ScreenPartyDummy);
- break;
-
- default:
- CBase.Log.LogError("Error in party mode TicTacToe. Wrong screen is sending: " + ScreenName);
- break;
- }
- }
-
- public override void UpdateGame()
- {
- /*
- if (CBase.Songs.GetCurrentCategoryIndex() != -1 || _ScreenSongOptions.Sorting.Tabs == EOffOn.TR_CONFIG_OFF)
- _ScreenSongOptions.Selection.RandomOnly = true;
- else
- _ScreenSongOptions.Selection.RandomOnly = false;*/
- }
-
- public override CMenuParty GetNextPartyScreen(out EScreens AlternativeScreen)
- {
- CMenuParty Screen = null;
- AlternativeScreen = EScreens.ScreenSong;
-
- switch (_Stage)
- {
- case EStage.NotStarted:
- _Screens.TryGetValue("PartyScreenTicTacToeConfig", out Screen);
- if (_Screens != null)
- {
- ToScreenConfig.NumPlayerTeam1 = GameData.NumPlayerTeam1;
- ToScreenConfig.NumPlayerTeam2 = GameData.NumPlayerTeam2;
- ToScreenConfig.NumFields = GameData.NumFields;
- ToScreenConfig.SongSource = GameData.SongSource;
- ToScreenConfig.CategoryID = GameData.CategoryID;
- ToScreenConfig.PlaylistID = GameData.PlaylistID;
- ToScreenConfig.GameMode = GameData.GameMode;
- Screen.DataToScreen(ToScreenConfig);
- }
- break;
- case EStage.Config:
- _Screens.TryGetValue("PartyScreenTicTacToeNames", out Screen);
- if (_Screens != null)
- {
- ToScreenNames.NumPlayerTeam1 = GameData.NumPlayerTeam1;
- ToScreenNames.NumPlayerTeam2 = GameData.NumPlayerTeam2;
- ToScreenNames.ProfileIDsTeam1 = GameData.ProfileIDsTeam1;
- ToScreenNames.ProfileIDsTeam2 = GameData.ProfileIDsTeam2;
- Screen.DataToScreen(ToScreenNames);
- }
- break;
- case EStage.Names:
- _Screens.TryGetValue("PartyScreenTicTacToeMain", out Screen);
- if (_Screens != null)
- {
- if (GameData.Team == 1)
- GameData.Team = 0;
- else
- GameData.Team = 1;
- CBase.Songs.ResetPartySongSung();
- GameData.CurrentRoundNr = 1;
- ToScreenMain.CurrentRoundNr = 1;
- ToScreenMain.NumPlayerTeam1 = GameData.NumPlayerTeam1;
- ToScreenMain.NumPlayerTeam2 = GameData.NumPlayerTeam2;
- ToScreenMain.NumFields = GameData.NumFields;
- ToScreenMain.ProfileIDsTeam1 = GameData.ProfileIDsTeam1;
- ToScreenMain.ProfileIDsTeam2 = GameData.ProfileIDsTeam2;
- CreateRounds();
- SetNumJokers();
- PreparePlayerList(0);
- PrepareSongList();
- ToScreenMain.Rounds = GameData.Rounds;
- ToScreenMain.Songs = GameData.Songs;
- ToScreenMain.PlayerTeam1 = GameData.PlayerTeam1;
- ToScreenMain.PlayerTeam1 = GameData.PlayerTeam2;
- ToScreenMain.NumJokerRandom = GameData.NumJokerRandom;
- ToScreenMain.NumJokerRetry = GameData.NumJokerRetry;
- ToScreenMain.Team = GameData.Team;
- Screen.DataToScreen(ToScreenMain);
- }
- break;
- case EStage.Main:
- //nothing to do
- break;
- case EStage.Singing:
- _Screens.TryGetValue("PartyScreenTicTacToeMain", out Screen);
- if (_Screens != null)
- {
- if (GameData.Team == 1)
- GameData.Team = 0;
- else
- GameData.Team = 1;
- UpdateSongList();
- UpdatePlayerList();
- ToScreenMain.CurrentRoundNr = GameData.CurrentRoundNr;
- ToScreenMain.NumPlayerTeam1 = GameData.NumPlayerTeam1;
- ToScreenMain.NumPlayerTeam2 = GameData.NumPlayerTeam2;
- ToScreenMain.NumFields = GameData.NumFields;
- ToScreenMain.ProfileIDsTeam1 = GameData.ProfileIDsTeam1;
- ToScreenMain.ProfileIDsTeam2 = GameData.ProfileIDsTeam2;
- ToScreenMain.Rounds = GameData.Rounds;
- ToScreenMain.Songs = GameData.Songs;
- ToScreenMain.PlayerTeam1 = GameData.PlayerTeam1;
- ToScreenMain.PlayerTeam2 = GameData.PlayerTeam2;
- ToScreenMain.NumJokerRandom = GameData.NumJokerRandom;
- ToScreenMain.NumJokerRetry = GameData.NumJokerRetry;
- ToScreenMain.Team = GameData.Team;
- Screen.DataToScreen(ToScreenMain);
- }
- break;
- }
-
- return Screen;
- }
-
- public override EScreens GetStartScreen()
- {
- return EScreens.ScreenPartyDummy;
- }
-
- public override EScreens GetMainScreen()
- {
- return EScreens.ScreenPartyDummy;
- }
-
- public override ScreenSongOptions GetScreenSongOptions()
- {
- _ScreenSongOptions.Sorting.SongSorting = CBase.Config.GetSongSorting();
- _ScreenSongOptions.Sorting.Tabs = CBase.Config.GetTabs();
- _ScreenSongOptions.Sorting.IgnoreArticles = CBase.Config.GetIgnoreArticles();
-
- return _ScreenSongOptions;
- }
-
- public override void OnSongChange(int SongIndex, ref ScreenSongOptions ScreenSongOptions)
- {
- ScreenSongOptions = _ScreenSongOptions;
- }
-
- public override void OnCategoryChange(int CategoryIndex, ref ScreenSongOptions ScreenSongOptions)
- {
- ScreenSongOptions = _ScreenSongOptions;
- }
-
- public override void SetSearchString(string SearchString, bool Visible)
- {
- _ScreenSongOptions.Sorting.SearchString = SearchString;
- _ScreenSongOptions.Sorting.SearchActive = Visible;
- }
-
- public override int GetMaxPlayer()
- {
- return MaxPlayer;
- }
-
- public override int GetMinPlayer()
- {
- return MinPlayer;
- }
-
- public override int GetMaxTeams()
- {
- return MaxTeams;
- }
-
- public override int GetMinTeams()
- {
- return MinTeams;
- }
-
- public override int GetMaxNumRounds()
- {
- return NumFields;
- }
-
- public override void JokerUsed(int TeamNr) {}
-
- public override void SongSelected(int SongID)
- {
- EGameMode gm = EGameMode.TR_GAMEMODE_NORMAL;
-
- switch (GameData.GameMode)
- {
- case EPartyGameMode.TR_GAMEMODE_NORMAL:
- gm = EGameMode.TR_GAMEMODE_NORMAL;
- break;
-
- case EPartyGameMode.TR_GAMEMODE_DUET:
- gm = EGameMode.TR_GAMEMODE_DUET;
- break;
-
- case EPartyGameMode.TR_GAMEMODE_SHORTSONG:
- gm = EGameMode.TR_GAMEMODE_SHORTSONG;
- break;
- }
- CBase.Game.AddSong(SongID, gm);
-
- CBase.Songs.AddPartySongSung(SongID);
- CBase.Graphics.FadeTo(EScreens.ScreenSing);
- }
-
- public override void LeavingHighscore()
- {
- UpdateScores();
- CBase.Graphics.FadeTo(EScreens.ScreenPartyDummy);
- }
-
- private void CreateRounds()
- {
- GameData.Rounds = new List();
- for (int i = 0; i < GameData.NumFields; i++)
- {
- Round r = new Round();
- GameData.Rounds.Add(r);
- }
- }
-
- private void PreparePlayerList(int Team)
- {
- if (Team == 0)
- {
- GameData.PlayerTeam1 = new List();
- GameData.PlayerTeam2 = new List();
-
- //Prepare Player-IDs
- List IDs1 = new List();
- List IDs2 = new List();
- 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)
- {
- 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);
- num = (int)Math.Round((double)random / 10);
- if (num >= IDs1.Count)
- num = IDs1.Count - 1;
- GameData.PlayerTeam1.Add(IDs1[num]);
- IDs1.RemoveAt(num);
- }
- if (GameData.PlayerTeam2.Count < GameData.NumFields + GameData.NumJokerRetry[1])
- {
- random = CBase.Game.GetRandom((IDs2.Count - 1) * 20);
- num = (int)Math.Round((double)random / 20);
- if (num >= IDs2.Count)
- num = IDs2.Count - 1;
- GameData.PlayerTeam2.Add(IDs2[num]);
- IDs2.RemoveAt(num);
- }
- }
- }
- else if (Team == 1)
- {
- //Prepare Player-IDs
- List IDs = new List();
- int num = 0;
- int random = 0;
- //Add IDs to team-list
- 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);
- num = (int)Math.Round((double)random / 10);
- if (num >= IDs.Count)
- num = IDs.Count - 1;
- GameData.PlayerTeam1.Add(IDs[num]);
- IDs.RemoveAt(num);
- }
- }
- }
- else if (Team == 2)
- {
- //Prepare Player-IDs
- List IDs = new List();
- int num = 0;
- int random = 0;
- //Add IDs to team-list
- 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);
- num = (int)Math.Round((double)random / 20);
- if (num >= IDs.Count)
- num = IDs.Count - 1;
- GameData.PlayerTeam2.Add(IDs[num]);
- IDs.RemoveAt(num);
- }
- }
- }
- }
-
- private void PrepareSongList()
- {
- EGameMode gm = EGameMode.TR_GAMEMODE_NORMAL;
-
- switch (GameData.GameMode)
- {
- case EPartyGameMode.TR_GAMEMODE_NORMAL:
- gm = EGameMode.TR_GAMEMODE_NORMAL;
- break;
-
- case EPartyGameMode.TR_GAMEMODE_DUET:
- gm = EGameMode.TR_GAMEMODE_DUET;
- break;
-
- case EPartyGameMode.TR_GAMEMODE_SHORTSONG:
- gm = EGameMode.TR_GAMEMODE_SHORTSONG;
- break;
- }
-
- while (GameData.Songs.Count < (GameData.NumFields + GameData.NumJokerRandom[0] + GameData.NumJokerRandom[1]))
- {
- List Songs = new List();
- switch (GameData.SongSource)
- {
- case ESongSource.TR_PLAYLIST:
- for (int i = 0; i < CBase.Playlist.GetPlaylistSongCount(GameData.PlaylistID); i++)
- {
- 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)
- Songs.Add(CBase.Songs.GetVisibleSong(i).ID);
- }
- }
- CBase.Songs.SetCategory(-1);
- break;
- }
- while (Songs.Count > 0)
- {
- GameData.Songs.Add(Songs[CBase.Game.GetRandom(Songs.Count - 1)]);
- Songs.Remove(GameData.Songs[GameData.Songs.Count - 1]);
- }
- }
- }
-
- private void UpdatePlayerList()
- {
- if (GameData.PlayerTeam1.Count == 0)
- PreparePlayerList(1);
- if (GameData.PlayerTeam2.Count == 0)
- PreparePlayerList(2);
- }
-
- private void UpdateSongList()
- {
- if (GameData.Songs.Count == 0)
- PrepareSongList();
- }
-
- private void StartRound(int RoundNr)
- {
- CBase.Game.Reset();
- CBase.Game.ClearSongs();
-
- CBase.Game.SetNumPlayer(2);
-
- SPlayer[] player = CBase.Game.GetPlayer();
- if (player == null)
- return;
-
- if (player.Length < 2)
- return;
-
- SProfile[] profiles = CBase.Profiles.GetProfiles();
- Round r = GameData.Rounds[RoundNr];
- bool isDuet = CBase.Songs.GetSongByID(r.SongID).IsDuet;
-
- for (int i = 0; i < 2; i++)
- {
- //default values
- player[i].Name = "foobar";
- player[i].Difficulty = EGameDifficulty.TR_CONFIG_EASY;
- player[i].ProfileID = -1;
- }
-
- //try to fill with the right data
- if (r != null)
- {
- if (GameData.ProfileIDsTeam1[r.SingerTeam1] < profiles.Length)
- {
- player[0].Name = profiles[GameData.ProfileIDsTeam1[r.SingerTeam1]].PlayerName;
- player[0].Difficulty = profiles[GameData.ProfileIDsTeam1[r.SingerTeam1]].Difficulty;
- player[0].ProfileID = GameData.ProfileIDsTeam1[r.SingerTeam1];
- if (isDuet)
- player[0].LineNr = 0;
- }
- if (GameData.ProfileIDsTeam2[r.SingerTeam2] < profiles.Length)
- {
- player[1].Name = profiles[GameData.ProfileIDsTeam2[r.SingerTeam2]].PlayerName;
- player[1].Difficulty = profiles[GameData.ProfileIDsTeam2[r.SingerTeam2]].Difficulty;
- player[1].ProfileID = GameData.ProfileIDsTeam2[r.SingerTeam2];
- if (isDuet)
- player[1].LineNr = 1;
- }
- SongSelected(r.SongID);
- }
- else
- return;
- }
-
- private void SetNumJokers()
- {
- switch (GameData.NumFields)
- {
- case 9:
- GameData.NumJokerRandom[0] = 1;
- GameData.NumJokerRandom[1] = 1;
- GameData.NumJokerRetry[0] = 0;
- GameData.NumJokerRetry[1] = 0;
- break;
-
- case 16:
- GameData.NumJokerRandom[0] = 2;
- GameData.NumJokerRandom[1] = 2;
- GameData.NumJokerRetry[0] = 1;
- GameData.NumJokerRetry[1] = 1;
- break;
-
- case 25:
- GameData.NumJokerRandom[0] = 3;
- GameData.NumJokerRandom[1] = 3;
- GameData.NumJokerRetry[0] = 2;
- GameData.NumJokerRetry[1] = 2;
- break;
- }
- }
-
- private void UpdateScores()
- {
- if (!GameData.Rounds[GameData.SingRoundNr].Finished)
- GameData.CurrentRoundNr++;
-
- SPlayer[] results = CBase.Game.GetPlayer();
- if (results == null)
- return;
-
- if (results.Length < 2)
- return;
-
- GameData.Rounds[GameData.SingRoundNr].PointsTeam1 = (int)Math.Round(results[0].Points);
- 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;
- GameData.CurrentRoundNr--;
- }
- }
- }
-}
\ No newline at end of file
diff --git a/PartyModes/PartyModeTicTacToe/PartyModeTicTacToe.csproj b/PartyModes/PartyModeTicTacToe/PartyModeTicTacToe.csproj
index ecb9f603..d061ae8d 100644
--- a/PartyModes/PartyModeTicTacToe/PartyModeTicTacToe.csproj
+++ b/PartyModes/PartyModeTicTacToe/PartyModeTicTacToe.csproj
@@ -108,10 +108,10 @@
-
-
-
-
+
+
+
+
@@ -122,10 +122,7 @@
-
-
-
diff --git a/PartyModes/PartyModeTicTacToe/PartyScreenTicTacToeConfig.cs b/PartyModes/PartyModeTicTacToe/PartyScreenTicTacToeConfig.cs
deleted file mode 100644
index 5e4012ab..00000000
--- a/PartyModes/PartyModeTicTacToe/PartyScreenTicTacToeConfig.cs
+++ /dev/null
@@ -1,328 +0,0 @@
-using System;
-using System.Windows.Forms;
-using VocaluxeLib.Menu;
-
-namespace VocaluxeLib.PartyModes.TicTacToe
-{
- public class PartyScreenTicTacToeConfig : CMenuParty
- {
- // Version number for theme files. Increment it, if you've changed something on the theme files!
- protected override int _ScreenVersion
- {
- get { return 1; }
- }
-
- 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;
-
- private DataFromScreen Data;
-
- public override void Init()
- {
- base.Init();
-
- _ThemeSelectSlides = new string[]
- {SelectSlideNumPlayerTeam1, SelectSlideNumPlayerTeam2, SelectSlideNumFields, SelectSlideSongSource, SelectSlidePlaylist, SelectSlideCategory, SelectSlideGameMode};
- _ThemeButtons = new string[] {ButtonNext, ButtonBack};
-
- Data = new DataFromScreen();
- FromScreenConfig config = new FromScreenConfig();
- config.PlaylistID = 0;
- config.NumFields = 9;
- config.NumPlayerTeam1 = 2;
- config.NumPlayerTeam2 = 2;
- config.GameMode = EPartyGameMode.TR_GAMEMODE_NORMAL;
- config.CategoryID = 0;
- config.SongSource = ESongSource.TR_ALLSONGS;
- Data.ScreenConfig = config;
- }
-
- public override void DataToScreen(object ReceivedData)
- {
- DataToScreenConfig config = new DataToScreenConfig();
-
- try
- {
- config = (DataToScreenConfig)ReceivedData;
- Data.ScreenConfig.NumFields = config.NumFields;
- Data.ScreenConfig.NumPlayerTeam1 = config.NumPlayerTeam1;
- Data.ScreenConfig.NumPlayerTeam2 = config.NumPlayerTeam2;
- Data.ScreenConfig.PlaylistID = config.PlaylistID;
- Data.ScreenConfig.CategoryID = config.CategoryID;
- Data.ScreenConfig.SongSource = config.SongSource;
- Data.ScreenConfig.GameMode = config.GameMode;
- }
- catch (Exception e)
- {
- 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)
- {
- base.HandleInput(keyEvent);
-
- if (keyEvent.KeyPressed) {}
- else
- {
- switch (keyEvent.Key)
- {
- case Keys.Back:
- case Keys.Escape:
- Back();
- break;
-
- case Keys.Enter:
- UpdateSlides();
-
- if (Buttons[ButtonBack].Selected)
- Back();
-
- if (Buttons[ButtonNext].Selected)
- Next();
- break;
-
- case Keys.Left:
- UpdateSlides();
- break;
-
- case Keys.Right:
- UpdateSlides();
- break;
- }
- }
- return true;
- }
-
- public override bool HandleMouse(MouseEvent mouseEvent)
- {
- base.HandleMouse(mouseEvent);
-
- if (mouseEvent.LB && IsMouseOver(mouseEvent))
- {
- UpdateSlides();
- if (Buttons[ButtonBack].Selected)
- Back();
-
- if (Buttons[ButtonNext].Selected)
- Next();
- }
-
- if (mouseEvent.RB)
- Back();
-
- return true;
- }
-
- public override void OnShow()
- {
- base.OnShow();
-
- if (CBase.Config.GetMaxNumMics() >= 2)
- ConfigOk = true;
-
- FillSlides();
- UpdateSlides();
- }
-
- public override bool UpdateGame()
- {
- Buttons[ButtonNext].Visible = ConfigOk;
- return true;
- }
-
- public override bool Draw()
- {
- base.Draw();
- return true;
- }
-
- private void FillSlides()
- {
- // build num player slide (min player ... max player);
- 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[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[SelectSlideNumFields].Clear();
- SelectSlides[SelectSlideNumFields].AddValue("9");
- SelectSlides[SelectSlideNumFields].AddValue("16");
- SelectSlides[SelectSlideNumFields].AddValue("25");
- if (Data.ScreenConfig.NumFields == 9)
- SelectSlides[SelectSlideNumFields].Selection = 0;
- else if (Data.ScreenConfig.NumFields == 16)
- SelectSlides[SelectSlideNumFields].Selection = 1;
- else if (Data.ScreenConfig.NumFields == 25)
- SelectSlides[SelectSlideNumFields].Selection = 2;
-
- SelectSlides[SelectSlideSongSource].Clear();
- SelectSlides[SelectSlideSongSource].SetValues((int)Data.ScreenConfig.SongSource);
-
- string[] _Playlists = CBase.Playlist.GetPlaylistNames();
- 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[SelectSlidePlaylist].AddValue(value);
- }
- 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++)
- _Categories[i] = CBase.Songs.GetCategory(i).Name;
- 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[SelectSlideCategory].AddValue(value);
- }
- SelectSlides[SelectSlideCategory].Selection = Data.ScreenConfig.CategoryID;
- SelectSlides[SelectSlideCategory].Visible = Data.ScreenConfig.SongSource == ESongSource.TR_CATEGORY;
-
- SelectSlides[SelectSlideGameMode].Visible = true;
- SelectSlides[SelectSlideGameMode].SetValues((int)Data.ScreenConfig.GameMode);
- }
-
- private void UpdateSlides()
- {
- Data.ScreenConfig.NumPlayerTeam1 = SelectSlides[SelectSlideNumPlayerTeam1].Selection + (_PartyMode.GetMinPlayer() / 2);
- Data.ScreenConfig.NumPlayerTeam2 = SelectSlides[SelectSlideNumPlayerTeam2].Selection + (_PartyMode.GetMinPlayer() / 2);
-
- if (SelectSlides[SelectSlideNumFields].Selection == 0)
- Data.ScreenConfig.NumFields = 9;
- else if (SelectSlides[SelectSlideNumFields].Selection == 1)
- Data.ScreenConfig.NumFields = 16;
- else if (SelectSlides[SelectSlideNumFields].Selection == 2)
- Data.ScreenConfig.NumFields = 25;
-
- 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;
-
- switch (Data.ScreenConfig.GameMode)
- {
- case EPartyGameMode.TR_GAMEMODE_NORMAL:
- gm = EGameMode.TR_GAMEMODE_NORMAL;
- break;
-
- case EPartyGameMode.TR_GAMEMODE_DUET:
- gm = EGameMode.TR_GAMEMODE_DUET;
- break;
-
- case EPartyGameMode.TR_GAMEMODE_SHORTSONG:
- gm = EGameMode.TR_GAMEMODE_SHORTSONG;
- break;
- }
-
- if (Data.ScreenConfig.SongSource == ESongSource.TR_PLAYLIST)
- {
- if (CBase.Playlist.GetNumPlaylists() > 0)
- {
- if (CBase.Playlist.GetPlaylistSongCount(Data.ScreenConfig.PlaylistID) > 0)
- {
- ConfigOk = false;
- for (int i = 0; i < CBase.Playlist.GetPlaylistSongCount(Data.ScreenConfig.PlaylistID); i++)
- {
- 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);
- ConfigOk = false;
- 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;
- }
- CBase.Songs.SetCategory(-1);
- }
- else
- ConfigOk = false;
- }
- else
- ConfigOk = false;
- }
- if (Data.ScreenConfig.SongSource == ESongSource.TR_ALLSONGS)
- {
- if (CBase.Songs.GetNumSongs() > 0)
- {
- 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;
- }
- }
- else
- ConfigOk = false;
- }
- SelectSlides[SelectSlideCategory].Visible = Data.ScreenConfig.SongSource == ESongSource.TR_CATEGORY;
- SelectSlides[SelectSlidePlaylist].Visible = Data.ScreenConfig.SongSource == ESongSource.TR_PLAYLIST;
- }
-
- private void Back()
- {
- FadeTo(EScreens.ScreenParty);
- }
-
- private void Next()
- {
- _PartyMode.DataFromScreen(ThemeName, Data);
- }
- }
-}
\ No newline at end of file
diff --git a/PartyModes/PartyModeTicTacToe/PartyScreenTicTacToeMain.cs b/PartyModes/PartyModeTicTacToe/PartyScreenTicTacToeMain.cs
deleted file mode 100644
index ece24122..00000000
--- a/PartyModes/PartyModeTicTacToe/PartyScreenTicTacToeMain.cs
+++ /dev/null
@@ -1,711 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Windows.Forms;
-using VocaluxeLib.Menu;
-using VocaluxeLib.Menu.SongMenu;
-
-namespace VocaluxeLib.PartyModes.TicTacToe
-{
- public class Field
- {
- public Round Content;
- public CButton Button;
- }
-
- public enum EStatus
- {
- FieldChoosing,
- JokerRetry,
- FieldSelected,
- None
- }
-
- public class PartyScreenTicTacToeMain : CMenuParty
- {
- // Version number for theme files. Increment it, if you've changed something on the theme files!
- protected override int _ScreenVersion
- {
- get { return 1; }
- }
-
- 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";
-
- 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";
-
- 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";
-
- private bool ExitPopupVisible;
-
- private DataFromScreen Data;
- private DataToScreenMain GameData;
-
- private List Fields;
- private float FieldFirstX = 25;
- private float FieldFirstY = 25;
- private int FieldSpace = 10;
- private float FieldSize = 100;
-
- private int PreviewStream = -1;
- private int SelectedField = -1;
- private int OldSelectedField = -1;
-
- private int[,] Possibilities;
- private EStatus Status;
-
- public override void Init()
- {
- base.Init();
-
- _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();
- GameData = new DataToScreenMain();
- config.SingRoundNr = 1;
- config.Rounds = new List();
- config.Songs = new List();
- config.PlayerTeam1 = new List();
- config.PlayerTeam2 = new List();
- config.FadeToNameSelection = false;
- config.FadeToSinging = false;
- Data.ScreenMain = config;
-
- Fields = new List();
- }
-
- public override void LoadTheme(string XmlPath)
- {
- base.LoadTheme(XmlPath);
-
- CreateFields();
- Buttons[ButtonField].Visible = false;
- }
-
- public override void DataToScreen(object ReceivedData)
- {
- DataToScreenMain config = new DataToScreenMain();
-
- try
- {
- config = (DataToScreenMain)ReceivedData;
- GameData = config;
- }
- catch (Exception e)
- {
- 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)
- {
- base.HandleInput(keyEvent);
-
- if (keyEvent.KeyPressed) {}
- else
- {
- switch (keyEvent.Key)
- {
- case Keys.Back:
- case Keys.Escape:
- if (!ExitPopupVisible)
- {
- if (GameData.CurrentRoundNr == 1 && Status != EStatus.FieldSelected)
- Back();
- else if (Status == EStatus.None)
- EndParty();
- else
- ShowPopup(true);
- }
- else
- ShowPopup(false);
- break;
-
- case Keys.Enter:
- if (!ExitPopupVisible)
- {
- if (Buttons[ButtonNextRound].Selected)
- NextRound();
- if (Buttons[ButtonBack].Selected && GameData.CurrentRoundNr == 1 && Status != EStatus.FieldSelected)
- Back();
- if (Buttons[ButtonExit].Selected && (GameData.CurrentRoundNr > 1 || Status == EStatus.FieldSelected) && Status != EStatus.None)
- ShowPopup(true);
- else if (Status == EStatus.None)
- EndParty();
- for (int i = 0; i < GameData.NumFields; i++)
- {
- switch (Status)
- {
- case EStatus.FieldChoosing:
- if (Fields[i].Button.Selected)
- {
- SelectedField = i;
- FieldSelected();
- }
- break;
-
- case EStatus.JokerRetry:
- if (Fields[i].Button.Selected)
- {
- SelectedField = i;
- FieldSelectedAgain();
- }
- break;
- }
- }
- if (Status == EStatus.FieldSelected)
- {
- if (Buttons[ButtonJokerRandomT1].Selected)
- UseJoker(0, 0);
- if (Buttons[ButtonJokerRandomT2].Selected)
- UseJoker(1, 0);
- if (Buttons[ButtonJokerRetryT1].Selected)
- UseJoker(0, 1);
- if (Buttons[ButtonJokerRetryT2].Selected)
- UseJoker(1, 1);
- }
- }
- else
- {
- if (Buttons[ButtonPopupYes].Selected)
- EndParty();
- if (Buttons[ButtonPopupNo].Selected)
- ShowPopup(false);
- }
- break;
- }
- }
- return true;
- }
-
- public override bool HandleMouse(MouseEvent mouseEvent)
- {
- base.HandleMouse(mouseEvent);
-
- if (mouseEvent.LB && IsMouseOver(mouseEvent))
- {
- if (!ExitPopupVisible)
- {
- if (Buttons[ButtonNextRound].Selected)
- NextRound();
- if (Buttons[ButtonBack].Selected)
- Back();
- if (Buttons[ButtonExit].Selected)
- {
- if (Status == EStatus.None)
- EndParty();
- else
- ShowPopup(true);
- }
- for (int i = 0; i < GameData.NumFields; i++)
- {
- switch (Status)
- {
- case EStatus.FieldChoosing:
- if (Fields[i].Button.Selected)
- {
- SelectedField = i;
- FieldSelected();
- }
- break;
-
- case EStatus.JokerRetry:
- if (Fields[i].Button.Selected)
- {
- SelectedField = i;
- FieldSelectedAgain();
- }
- break;
- }
- }
- if (Status == EStatus.FieldSelected)
- {
- if (Buttons[ButtonJokerRandomT1].Selected)
- UseJoker(0, 0);
- if (Buttons[ButtonJokerRandomT2].Selected)
- UseJoker(1, 0);
- if (Buttons[ButtonJokerRetryT1].Selected)
- UseJoker(0, 1);
- if (Buttons[ButtonJokerRetryT2].Selected)
- UseJoker(1, 1);
- }
- }
- else
- {
- if (Buttons[ButtonPopupYes].Selected)
- EndParty();
- if (Buttons[ButtonPopupNo].Selected)
- ShowPopup(false);
- }
- }
-
- if (mouseEvent.RB)
- {
- if (!ExitPopupVisible)
- {
- if (GameData.CurrentRoundNr == 1 && Status != EStatus.FieldSelected)
- Back();
- else if (Status == EStatus.None)
- EndParty();
- else
- ShowPopup(true);
- }
- else
- ShowPopup(false);
- }
-
- if (mouseEvent.Wheel != 0) {}
-
- return true;
- }
-
- public override void OnShow()
- {
- base.OnShow();
-
- PreviewStream = -1;
-
- if (GameData.CurrentRoundNr == 1)
- {
- BuildWinnerPossibilities();
- SelectedField = -1;
- Buttons[ButtonBack].Visible = true;
- Buttons[ButtonExit].Visible = false;
- SetInteractionToButton(Buttons[ButtonBack]);
- }
- else
- {
- Buttons[ButtonBack].Visible = false;
- Buttons[ButtonExit].Visible = true;
- SetInteractionToButton(Buttons[ButtonExit]);
- }
-
- Status = EStatus.FieldChoosing;
-
- UpdateFields();
- UpdateFieldContents();
-
- int Winner = GetWinner();
- if (GameData.CurrentRoundNr <= GameData.NumFields && Winner == 0)
- {
- UpdateTeamChoosingMessage();
- 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[ButtonNextRound].Visible = false;
- Texts[TextFinishMessage].Visible = true;
- Texts[TextTeamChoosing].Visible = false;
- if (Winner > 0)
- {
- 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[TextFinishMessage].Color = new SColorF(1, 1, 1, 1);
- Texts[TextFinishMessage].Text = CBase.Language.Translate("TR_SCREENMAIN_NOWINNER", _PartyModeID);
- }
- SetInteractionToButton(Buttons[ButtonExit]);
- }
-
- ShowPopup(false);
- }
-
- public override bool UpdateGame()
- {
- return true;
- }
-
- public override bool Draw()
- {
- base.Draw();
- return true;
- }
-
- public override void OnClose()
- {
- base.OnClose();
- CBase.BackgroundMusic.SetStatus(false);
- CBase.Sound.FadeAndStop(PreviewStream, 0f, 0.5f);
- }
-
- private void CreateFields()
- {
- for (int i = 0; i < 25; i++)
- {
- Field f = new Field();
- f.Button = GetNewButton(Buttons[ButtonField]);
- f.Button.Visible = false;
- f.Content = new Round();
- AddButton(f.Button);
- Fields.Add(f);
- }
- }
-
- private void UpdateFields()
- {
- 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)
- FieldSize = FieldSizeX;
- else
- FieldSize = FieldSizeY;
- FieldFirstX = CBase.Settings.GetRenderW() / 2 - (NumOneRow * FieldSize + (NumOneRow - 1) * FieldSpace) / 2;
- FieldFirstY = 140 + (CBase.Settings.GetRenderH() - 140) / 2 - (NumOneRow * FieldSize + NumOneRow * FieldSpace) / 2;
- int row = 0;
- int column = 0;
- float x = FieldFirstX;
- float y = FieldFirstY;
- for (int i = 0; i < Fields.Count; i++)
- {
- if (i < GameData.NumFields)
- {
- Fields[i].Button.Rect.W = FieldSize;
- Fields[i].Button.Rect.H = FieldSize;
- Fields[i].Button.Rect.X = x;
- Fields[i].Button.Rect.Y = y;
- Fields[i].Button.Visible = true;
- Fields[i].Button.Enabled = true;
- column++;
- if ((i + 1) >= NumOneRow * (row + 1))
- {
- column = 0;
- row++;
- y = FieldFirstY + FieldSize * row + FieldSpace * row;
- x = FieldFirstX;
- }
- else
- x = FieldFirstX + FieldSize * column + FieldSpace * column;
- }
- else
- {
- Fields[i].Button.Visible = false;
- Fields[i].Button.Enabled = false;
- }
- }
- }
-
- private void UpdateFieldContents()
- {
- for (int i = 0; i < GameData.Rounds.Count; i++)
- {
- Fields[i].Button.Enabled = true;
- 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)
- {
- Fields[i].Button.Enabled = false;
- Fields[i].Button.Texture = CBase.Songs.GetSongByID(Fields[i].Content.SongID).CoverTextureBig;
- Fields[i].Button.Color = CBase.Theme.GetPlayerColor(Fields[i].Content.Winner);
- Fields[i].Button.SColor = CBase.Theme.GetPlayerColor(Fields[i].Content.Winner);
- }
- if (Status == EStatus.FieldSelected && SelectedField == i)
- {
- Fields[i].Button.Texture = CBase.Songs.GetSongByID(Fields[i].Content.SongID).CoverTextureBig;
- Fields[i].Button.Color = new SColorF(1, 1, 1, 1);
- Fields[i].Button.SColor = new SColorF(1, 1, 1, 1);
- Fields[i].Button.Enabled = false;
- }
- if (Status == EStatus.JokerRetry && Fields[i].Content.Finished)
- {
- 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)
- Fields[i].Button.Enabled = false;
- }
- }
-
- private void FieldSelected()
- {
- int SongID = 0;
- int SingerTeam1 = 0;
- int SingerTeam2 = 0;
- if (GameData.Songs.Count > 0)
- {
- SongID = GameData.Songs[0];
- GameData.Songs.RemoveAt(0);
- }
- if (GameData.PlayerTeam1.Count > 0)
- {
- SingerTeam1 = GameData.PlayerTeam1[0];
- GameData.PlayerTeam1.RemoveAt(0);
- }
-
- if (GameData.PlayerTeam2.Count > 0)
- {
- SingerTeam2 = GameData.PlayerTeam2[0];
- GameData.PlayerTeam2.RemoveAt(0);
- }
- CSong Song = CBase.Songs.GetSongByID(SongID);
-
- CBase.BackgroundMusic.SetStatus(true);
-
- PreviewStream = CBase.Sound.Load(Song.GetMP3(), false);
- CBase.Sound.SetPosition(PreviewStream, Song.PreviewStart);
- CBase.Sound.SetStreamVolume(PreviewStream, 0f);
- CBase.Sound.Play(PreviewStream);
- CBase.Sound.Fade(PreviewStream, CBase.Config.GetBackgroundMusicVolume(), 1f);
- Status = EStatus.FieldSelected;
- Fields[SelectedField].Content.SongID = SongID;
- GameData.Rounds[SelectedField].SongID = SongID;
- GameData.Rounds[SelectedField].SingerTeam1 = SingerTeam1;
- GameData.Rounds[SelectedField].SingerTeam2 = SingerTeam2;
- UpdateFieldContents();
-
- Texts[TextNextPlayerT1].Visible = true;
- Texts[TextNextPlayerT2].Visible = true;
- Texts[TextNextPlayerNameT1].Visible = true;
- Texts[TextNextPlayerNameT2].Visible = true;
- SProfile[] profiles = CBase.Profiles.GetProfiles();
- Texts[TextNextPlayerNameT1].Text = profiles[GameData.ProfileIDsTeam1[GameData.Rounds[SelectedField].SingerTeam1]].PlayerName;
- Texts[TextNextPlayerNameT2].Text = profiles[GameData.ProfileIDsTeam2[GameData.Rounds[SelectedField].SingerTeam2]].PlayerName;
- Statics[StaticAvatarT1].Visible = true;
- Statics[StaticAvatarT2].Visible = true;
- Statics[StaticAvatarT1].Texture = profiles[GameData.ProfileIDsTeam1[GameData.Rounds[SelectedField].SingerTeam1]].Avatar.Texture;
- Statics[StaticAvatarT2].Texture = profiles[GameData.ProfileIDsTeam2[GameData.Rounds[SelectedField].SingerTeam2]].Avatar.Texture;
-
- UpdateJokerButtons();
-
- Buttons[ButtonNextRound].Visible = true;
- Buttons[ButtonExit].Visible = true;
- Buttons[ButtonBack].Visible = false;
-
- SetInteractionToButton(Buttons[ButtonNextRound]);
- }
-
- private void FieldSelectedAgain()
- {
- int SongID = Fields[SelectedField].Content.SongID;
- CSong Song = CBase.Songs.GetSongByID(SongID);
- CBase.BackgroundMusic.SetStatus(true);
-
- PreviewStream = CBase.Sound.Load(Song.GetMP3(), false);
- CBase.Sound.SetPosition(PreviewStream, Song.PreviewStart);
- CBase.Sound.SetStreamVolume(PreviewStream, 0f);
- CBase.Sound.Play(PreviewStream);
- CBase.Sound.Fade(PreviewStream, CBase.Config.GetBackgroundMusicVolume(), 1f);
- Status = EStatus.FieldSelected;
- Fields[SelectedField].Content.SongID = SongID;
- GameData.Rounds[SelectedField].SongID = SongID;
- GameData.Rounds[SelectedField].SingerTeam1 = GameData.Rounds[OldSelectedField].SingerTeam1;
- GameData.Rounds[SelectedField].SingerTeam2 = GameData.Rounds[OldSelectedField].SingerTeam2;
- UpdateFieldContents();
-
- Texts[TextNextPlayerT1].Visible = true;
- Texts[TextNextPlayerT2].Visible = true;
- Texts[TextNextPlayerNameT1].Visible = true;
- Texts[TextNextPlayerNameT2].Visible = true;
- SProfile[] profiles = CBase.Profiles.GetProfiles();
- Texts[TextNextPlayerNameT1].Text = profiles[GameData.ProfileIDsTeam1[GameData.Rounds[SelectedField].SingerTeam1]].PlayerName;
- Texts[TextNextPlayerNameT2].Text = profiles[GameData.ProfileIDsTeam2[GameData.Rounds[SelectedField].SingerTeam2]].PlayerName;
- Statics[StaticAvatarT1].Visible = true;
- Statics[StaticAvatarT2].Visible = true;
- Statics[StaticAvatarT1].Texture = profiles[GameData.ProfileIDsTeam1[GameData.Rounds[SelectedField].SingerTeam1]].Avatar.Texture;
- Statics[StaticAvatarT2].Texture = profiles[GameData.ProfileIDsTeam2[GameData.Rounds[SelectedField].SingerTeam2]].Avatar.Texture;
-
- UpdateJokerButtons();
-
- Buttons[ButtonNextRound].Visible = true;
- Buttons[ButtonExit].Visible = true;
- Buttons[ButtonBack].Visible = false;
-
- SetInteractionToButton(Buttons[ButtonNextRound]);
- }
-
- private void UseJoker(int TeamNr, int JokerNum)
- {
- switch (JokerNum)
- {
- //Random-Joker
- case 0:
- if (GameData.NumJokerRandom[TeamNr] > 0)
- {
- GameData.NumJokerRandom[TeamNr]--;
- if (!CBase.Sound.IsFinished(PreviewStream))
- CBase.Sound.FadeAndStop(PreviewStream, 0, 1);
- FieldSelected();
- }
- break;
-
- //Retry-Joker
- case 1:
- if (GameData.NumJokerRetry[TeamNr] > 0 && GameData.CurrentRoundNr > 1)
- {
- GameData.NumJokerRetry[TeamNr]--;
- GameData.Team = TeamNr;
- if (!CBase.Sound.IsFinished(PreviewStream))
- CBase.Sound.FadeAndStop(PreviewStream, 0, 1);
- Status = EStatus.JokerRetry;
- OldSelectedField = SelectedField;
- SelectedField = -1;
- UpdateFieldContents();
- }
- break;
- }
- UpdateJokerButtons();
- }
-
- private void UpdateTeamChoosingMessage()
- {
- 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[TextTeamChoosing].Visible = true;
- else
- Texts[TextTeamChoosing].Visible = false;
- }
-
- private void UpdateJokerButtons()
- {
- 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()
- {
- CBase.Sound.FadeAndStop(PreviewStream, 0f, 0.5f);
- Data.ScreenMain.Rounds = GameData.Rounds;
- Data.ScreenMain.FadeToNameSelection = false;
- Data.ScreenMain.FadeToSinging = true;
- Data.ScreenMain.Songs = GameData.Songs;
- Data.ScreenMain.SingRoundNr = SelectedField;
- Data.ScreenMain.PlayerTeam1 = GameData.PlayerTeam1;
- Data.ScreenMain.PlayerTeam2 = GameData.PlayerTeam2;
- _PartyMode.DataFromScreen(ThemeName, Data);
- }
-
- private void EndParty()
- {
- CBase.Sound.FadeAndStop(PreviewStream, 0f, 0.5f);
- FadeTo(EScreens.ScreenParty);
- }
-
- private void ShowPopup(bool Visible)
- {
- ExitPopupVisible = Visible;
-
- Statics[StaticPopupBG].Visible = ExitPopupVisible;
- Texts[TextPopupReallyExit].Visible = ExitPopupVisible;
- Buttons[ButtonPopupYes].Visible = ExitPopupVisible;
- Buttons[ButtonPopupNo].Visible = ExitPopupVisible;
-
- if (ExitPopupVisible)
- SetInteractionToButton(Buttons[ButtonPopupNo]);
- }
-
- private void Back()
- {
- CBase.Sound.FadeAndStop(PreviewStream, 0f, 0.5f);
- Data.ScreenMain.FadeToNameSelection = true;
- Data.ScreenMain.FadeToSinging = false;
- Data.ScreenMain.SingRoundNr = SelectedField;
- _PartyMode.DataFromScreen(ThemeName, Data);
- }
-
- private int BuildWinnerPossibilities()
- {
- 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++)
- 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);
- }
- 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;
- }
-
- private int GetWinner()
- {
- for (int i = 0; i < Possibilities.GetLength(0); i++)
- {
- List Check = new List();
- for (int j = 0; j < Possibilities.GetLength(1); j++)
- {
- if (Fields[Possibilities[i, j]].Content.Winner > 0)
- Check.Add(Fields[Possibilities[i, j]].Content.Winner);
- }
- if (Check.Count == Possibilities.GetLength(1))
- {
- //Check for winner
- if (Check.Contains(1) && !Check.Contains(2))
- return 1;
- else if (Check.Contains(2) && !Check.Contains(1))
- return 2;
- }
- }
- return 0;
- }
- }
-}
\ No newline at end of file
diff --git a/PartyModes/PartyModeTicTacToe/PartyScreenTicTacToeNames.cs b/PartyModes/PartyModeTicTacToe/PartyScreenTicTacToeNames.cs
deleted file mode 100644
index d83987d7..00000000
--- a/PartyModes/PartyModeTicTacToe/PartyScreenTicTacToeNames.cs
+++ /dev/null
@@ -1,646 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Windows.Forms;
-using VocaluxeLib.Menu;
-
-namespace VocaluxeLib.PartyModes.TicTacToe
-{
- public class PartyScreenTicTacToeNames : CMenuParty
- {
- // Version number for theme files. Increment it, if you've changed something on the theme files!
- protected override int _ScreenVersion
- {
- get { return 1; }
- }
-
- 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 PlayerChooseButtons;
- private List PlayerDestinationButtons;
- //PlayerDestinationButtons-Option
- private const int PlayerDestinationButtonsNumH = 10;
- private const int PlayerDestinationButtonsNumW = 2;
- private const int PlayerDestinationButtonsFirstX = 58;
- private const int PlayerDestinationButtonsFirstY = 380;
- private const int PlayerDestinationButtonsSpaceH = 15;
- private const int PlayerDestinationButtonsSpaceW = 25;
- //PlayerChooseButtons-Option
- private List PlayerChooseButtonsVisibleProfiles;
- private const int PlayerChooseButtonsNumH = 10;
- private const int PlayerChooseButtonsNumW = 2;
- private const int PlayerChooseButtonsFirstX = 58;
- private const int PlayerChooseButtonsFirstY = 105;
- private const int PlayerChooseButtonsSpaceH = 15;
- private const int PlayerChooseButtonsSpaceW = 25;
- private int PlayerChooseButtonsOffset;
-
- private CStatic chooseAvatarStatic;
- private bool SelectingMouseActive;
- private int OldMouseX;
- private int OldMouseY;
- private int SelectedPlayerNr = -1;
- private bool ButtonsAdded;
-
- private int NumPlayerTeam1 = 2;
- private int NumPlayerTeam2 = 2;
-
- private DataFromScreen Data;
-
- private class CPlayerChooseButton
- {
- public CButton Button;
- public int ProfileID;
- }
-
- public override void Init()
- {
- base.Init();
-
- chooseAvatarStatic = GetNewStatic();
- chooseAvatarStatic.Visible = false;
-
- PlayerChooseButtonsVisibleProfiles = new List();
-
- 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 DataFromScreen();
- FromScreenNames names = new FromScreenNames();
- names.FadeToConfig = false;
- names.FadeToMain = false;
- names.ProfileIDsTeam1 = new List();
- names.ProfileIDsTeam2 = new List();
- Data.ScreenNames = names;
- }
-
- public override void DataToScreen(object ReceivedData)
- {
- DataToScreenNames config = new DataToScreenNames();
-
- try
- {
- config = (DataToScreenNames)ReceivedData;
- Data.ScreenNames.ProfileIDsTeam1 = config.ProfileIDsTeam1;
- Data.ScreenNames.ProfileIDsTeam2 = config.ProfileIDsTeam2;
- if (Data.ScreenNames.ProfileIDsTeam1 == null)
- Data.ScreenNames.ProfileIDsTeam1 = new List();
- if (Data.ScreenNames.ProfileIDsTeam2 == null)
- Data.ScreenNames.ProfileIDsTeam2 = new List();
-
- NumPlayerTeam1 = config.NumPlayerTeam1;
- 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);
- }
- }
-
- public override bool HandleInput(KeyEvent keyEvent)
- {
- base.HandleInput(keyEvent);
-
- if (keyEvent.KeyPressed) {}
- else
- {
- switch (keyEvent.Key)
- {
- case Keys.Back:
- case Keys.Escape:
- Back();
- break;
-
- case Keys.Enter:
- if (Buttons[ButtonBack].Selected)
- Back();
-
- if (Buttons[ButtonNext].Selected)
- Next();
-
- if (Buttons[ButtonPlayerChooseScrollUp].Selected)
- Scroll(-1);
-
- if (Buttons[ButtonPlayerChooseScrollDown].Selected)
- Scroll(1);
-
- if (!OnAdd())
- OnRemove();
- break;
-
- case Keys.Delete:
- OnRemove();
- break;
- }
- }
- return true;
- }
-
- public override bool HandleMouse(MouseEvent mouseEvent)
- {
- base.HandleMouse(mouseEvent);
-
- //Check if LeftButton is hold and Select-Mode inactive
- if (mouseEvent.LBH && !SelectingMouseActive)
- {
- //Save mouse-coords
- 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)
- {
- SelectedPlayerNr = PlayerChooseButtons[i].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.Z = -100;
- chooseAvatarStatic.Color = new SColorF(1, 1, 1, 1);
- chooseAvatarStatic.Texture = CBase.Profiles.GetProfiles()[SelectedPlayerNr].Avatar.Texture;
- }
- }
- }
- return true;
- }
-
- //Check if LeftButton is hold and Select-Mode active
- 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;
-
- return true;
- }
- // LeftButton isn't hold anymore, but Selec-Mode is still active -> "Drop" of Avatar
- else if (SelectingMouseActive)
- {
- //Check if really a player was selected
- if (SelectedPlayerNr != -1)
- {
- //Foreach Drop-Area
- for (int i = 0; i < PlayerDestinationButtons.Count; i++)
- {
- //Check first, if area is "active"
- if (PlayerDestinationButtons[i].Visible)
- {
- //Check if Mouse is in area
- if (CHelper.IsInBounds(PlayerDestinationButtons[i].Rect, mouseEvent))
- {
- int added = -1;
- //Add Player-ID to list.
- if (i - PlayerDestinationButtonsNumH < 0)
- {
- if (Data.ScreenNames.ProfileIDsTeam1.Count < (i + 1))
- {
- Data.ScreenNames.ProfileIDsTeam1.Add(SelectedPlayerNr);
- added = Data.ScreenNames.ProfileIDsTeam1.Count - 1;
- }
- else if (Data.ScreenNames.ProfileIDsTeam1.Count >= (i + 1))
- {
- Data.ScreenNames.ProfileIDsTeam1[i] = SelectedPlayerNr;
- added = i;
- }
- }
- else if (i - PlayerDestinationButtonsNumH >= 0)
- {
- if (Data.ScreenNames.ProfileIDsTeam2.Count < ((i - PlayerDestinationButtonsNumH) + 1))
- {
- Data.ScreenNames.ProfileIDsTeam2.Add(SelectedPlayerNr);
- added = Data.ScreenNames.ProfileIDsTeam2.Count - 1 + PlayerDestinationButtonsNumH;
- }
- else if (Data.ScreenNames.ProfileIDsTeam2.Count >= ((i - PlayerDestinationButtonsNumH) + 1))
- {
- Data.ScreenNames.ProfileIDsTeam2[i - PlayerDestinationButtonsNumH] = SelectedPlayerNr;
- added = i;
- }
- }
- UpdateButtonNext();
- //Update texture and name
- PlayerDestinationButtons[added].Color = new SColorF(1, 1, 1, 0.6f);
- PlayerDestinationButtons[added].SColor = new SColorF(1, 1, 1, 1);
- PlayerDestinationButtons[added].Texture = chooseAvatarStatic.Texture;
- PlayerDestinationButtons[added].STexture = chooseAvatarStatic.Texture;
- PlayerDestinationButtons[added].Text.Text = CBase.Profiles.GetProfiles()[SelectedPlayerNr].PlayerName;
- PlayerDestinationButtons[added].Enabled = true;
- //Update Tiles-List
- UpdateButtonPlayerChoose();
- }
- }
- }
- SelectedPlayerNr = -1;
- }
- //Reset variables
- SelectingMouseActive = false;
- chooseAvatarStatic.Visible = false;
- return true;
- }
-
- if (mouseEvent.LB && IsMouseOver(mouseEvent))
- {
- if (Buttons[ButtonBack].Selected)
- Back();
-
- if (Buttons[ButtonNext].Selected)
- Next();
-
- if (Buttons[ButtonPlayerChooseScrollUp].Selected)
- Scroll(-1);
-
- if (Buttons[ButtonPlayerChooseScrollDown].Selected)
- Scroll(1);
- }
-
- if (mouseEvent.LD && IsMouseOver(mouseEvent))
- {
- if (!OnAdd())
- OnRemove();
- }
-
- if (mouseEvent.RB)
- Back();
-
- return true;
- }
-
- public override void OnShow()
- {
- base.OnShow();
-
- if (!ButtonsAdded)
- {
- AddButtonPlayerDestination();
- AddButtonPlayerChoose();
- ButtonsAdded = true;
- }
-
- UpdateButtonPlayerDestination();
- UpdateButtonPlayerChoose();
-
- UpdateButtonNext();
- }
-
- public override bool UpdateGame()
- {
- return true;
- }
-
- public override bool Draw()
- {
- base.Draw();
- if (chooseAvatarStatic.Visible)
- chooseAvatarStatic.Draw();
- return true;
- }
-
- private void Scroll(int Offset)
- {
- if (Offset < 0 && PlayerChooseButtonsOffset > 0)
- {
- PlayerChooseButtonsOffset += Offset;
- UpdateButtonPlayerChoose();
- }
- else if (PlayerChooseButtonsVisibleProfiles.Count < PlayerChooseButtons.Count + (PlayerChooseButtonsOffset + Offset) * PlayerChooseButtonsNumH)
- {
- PlayerChooseButtonsOffset += Offset;
- UpdateButtonPlayerChoose();
- }
- }
-
- private void AddButtonPlayerDestination()
- {
- Buttons[ButtonPlayerDestination].Visible = false;
- PlayerDestinationButtons = new List();
- int row = 0;
- int column = 0;
- for (int i = 1; i <= _PartyMode.GetMaxPlayer(); i++)
- {
- 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);
- column++;
- if (column >= PlayerDestinationButtonsNumH)
- {
- row++;
- column = 0;
- }
- b.Visible = true;
- b.Enabled = false;
- AddButton(b);
- }
- }
-
- private void AddButtonPlayerChoose()
- {
- Buttons[ButtonPlayerChoose].Visible = false;
- PlayerChooseButtons = new List();
- int row = 0;
- int column = 0;
- for (int i = 1; i <= PlayerChooseButtonsNumH * PlayerChooseButtonsNumW; i++)
- {
- 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();
- pcb.Button = b;
- pcb.ProfileID = -1;
- PlayerChooseButtons.Add(pcb);
- column++;
- if (column >= PlayerChooseButtonsNumH)
- {
- row++;
- column = 0;
- }
- b.Visible = true;
- b.Enabled = false;
- AddButton(b);
- }
- }
-
- private void UpdateButtonPlayerChoose()
- {
- UpdateVisibleProfiles();
- if ((PlayerChooseButtonsNumW * PlayerChooseButtonsNumH) * (PlayerChooseButtonsOffset + 1) - PlayerChooseButtonsVisibleProfiles.Count >=
- (PlayerChooseButtonsNumW * PlayerChooseButtonsNumH) * PlayerChooseButtonsOffset)
- UpdateButtonPlayerChoose(PlayerChooseButtonsOffset - 1);
- else
- UpdateButtonPlayerChoose(PlayerChooseButtonsOffset);
- Buttons[ButtonPlayerChooseScrollUp].Enabled = PlayerChooseButtonsOffset > 0;
- Buttons[ButtonPlayerChooseScrollDown].Enabled = PlayerChooseButtonsVisibleProfiles.Count >
- PlayerChooseButtons.Count + PlayerChooseButtonsOffset * PlayerChooseButtonsNumH;
- }
-
- private void UpdateButtonPlayerChoose(int Offset)
- {
- int NumButtonPlayerChoose = PlayerChooseButtonsNumW * PlayerChooseButtonsNumH;
- if (Offset < 0)
- Offset = 0;
-
- if (NumButtonPlayerChoose * (Offset + 1) - PlayerChooseButtonsVisibleProfiles.Count <= NumButtonPlayerChoose)
- {
- for (int i = 0; i < NumButtonPlayerChoose; i++)
- {
- if ((i + Offset * NumButtonPlayerChoose) < PlayerChooseButtonsVisibleProfiles.Count)
- {
- PlayerChooseButtons[i].ProfileID = PlayerChooseButtonsVisibleProfiles[i + Offset * NumButtonPlayerChoose];
- PlayerChooseButtons[i].Button.Text.Text = CBase.Profiles.GetProfiles()[PlayerChooseButtonsVisibleProfiles[i + Offset * NumButtonPlayerChoose]].PlayerName;
- PlayerChooseButtons[i].Button.Texture = CBase.Profiles.GetProfiles()[PlayerChooseButtonsVisibleProfiles[i + Offset * NumButtonPlayerChoose]].Avatar.Texture;
- PlayerChooseButtons[i].Button.STexture = CBase.Profiles.GetProfiles()[PlayerChooseButtonsVisibleProfiles[i + Offset * NumButtonPlayerChoose]].Avatar.Texture;
- PlayerChooseButtons[i].Button.Color = new SColorF(1, 1, 1, 0.6f);
- PlayerChooseButtons[i].Button.SColor = new SColorF(1, 1, 1, 1);
- PlayerChooseButtons[i].Button.Enabled = true;
- }
- else
- {
- PlayerChooseButtons[i].ProfileID = -1;
- PlayerChooseButtons[i].Button.Text.Text = String.Empty;
- 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;
- }
- }
- }
- }
-
- private void UpdateVisibleProfiles()
- {
- PlayerChooseButtonsVisibleProfiles.Clear();
- for (int i = 0; i < CBase.Profiles.GetProfiles().Length; i++)
- {
- bool visible = false;
- //Show profile only if active
- if (CBase.Profiles.GetProfiles()[i].Active == EOffOn.TR_CONFIG_ON)
- {
- visible = true;
-
- for (int p = 0; p < Data.ScreenNames.ProfileIDsTeam1.Count; p++)
- {
- //Don't show profile if is selected
- if (Data.ScreenNames.ProfileIDsTeam1[p] == i)
- {
- visible = false;
- break;
- }
- }
-
- for (int p = 0; p < Data.ScreenNames.ProfileIDsTeam2.Count; p++)
- {
- //Don't show profile if is selected
- if (Data.ScreenNames.ProfileIDsTeam2[p] == i)
- {
- visible = false;
- break;
- }
- }
- }
- if (visible)
- PlayerChooseButtonsVisibleProfiles.Add(i);
- }
- }
-
- private void UpdateButtonPlayerDestination()
- {
- for (int i = 0; i < PlayerDestinationButtons.Count / 2; i++)
- {
- if (NumPlayerTeam1 > i)
- {
- PlayerDestinationButtons[i].Visible = true;
- PlayerDestinationButtons[i].Enabled = true;
- }
- else
- {
- PlayerDestinationButtons[i].Visible = false;
- PlayerDestinationButtons[i].Enabled = false;
- }
- }
- for (int i = 0; i < PlayerDestinationButtons.Count / 2; i++)
- {
- if (NumPlayerTeam2 > i)
- {
- PlayerDestinationButtons[i + PlayerDestinationButtonsNumH].Visible = true;
- PlayerDestinationButtons[i + PlayerDestinationButtonsNumH].Enabled = true;
- }
- else
- {
- PlayerDestinationButtons[i + PlayerDestinationButtonsNumH].Visible = false;
- PlayerDestinationButtons[i + PlayerDestinationButtonsNumH].Enabled = false;
- }
- }
- for (int i = 0; i < NumPlayerTeam1; i++)
- {
- if (i < Data.ScreenNames.ProfileIDsTeam1.Count)
- {
- if (Data.ScreenNames.ProfileIDsTeam1[i] != -1)
- {
- PlayerDestinationButtons[i].Color = new SColorF(1, 1, 1, 0.6f);
- PlayerDestinationButtons[i].SColor = new SColorF(1, 1, 1, 1);
- PlayerDestinationButtons[i].Texture = CBase.Profiles.GetProfiles()[Data.ScreenNames.ProfileIDsTeam1[i]].Avatar.Texture;
- PlayerDestinationButtons[i].STexture = CBase.Profiles.GetProfiles()[Data.ScreenNames.ProfileIDsTeam1[i]].Avatar.Texture;
- PlayerDestinationButtons[i].Text.Text = CBase.Profiles.GetProfiles()[Data.ScreenNames.ProfileIDsTeam1[i]].PlayerName;
- PlayerDestinationButtons[i].Enabled = true;
- }
- }
- else
- {
- 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;
- }
- }
- for (int i = 0; i < NumPlayerTeam2; i++)
- {
- if (i < Data.ScreenNames.ProfileIDsTeam2.Count)
- {
- if (Data.ScreenNames.ProfileIDsTeam2[i] != -1)
- {
- PlayerDestinationButtons[i + PlayerDestinationButtonsNumH].Color = new SColorF(1, 1, 1, 0.6f);
- PlayerDestinationButtons[i + PlayerDestinationButtonsNumH].SColor = new SColorF(1, 1, 1, 1);
- PlayerDestinationButtons[i + PlayerDestinationButtonsNumH].Texture = CBase.Profiles.GetProfiles()[Data.ScreenNames.ProfileIDsTeam2[i]].Avatar.Texture;
- PlayerDestinationButtons[i + PlayerDestinationButtonsNumH].STexture = CBase.Profiles.GetProfiles()[Data.ScreenNames.ProfileIDsTeam2[i]].Avatar.Texture;
- PlayerDestinationButtons[i + PlayerDestinationButtonsNumH].Text.Text = CBase.Profiles.GetProfiles()[Data.ScreenNames.ProfileIDsTeam2[i]].PlayerName;
- PlayerDestinationButtons[i + PlayerDestinationButtonsNumH].Enabled = true;
- }
- }
- else
- {
- 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;
- }
- }
- }
-
- private void UpdateButtonNext()
- {
- if (Data.ScreenNames.ProfileIDsTeam1.Count == NumPlayerTeam1 && Data.ScreenNames.ProfileIDsTeam2.Count == NumPlayerTeam2)
- {
- Buttons[ButtonNext].Visible = true;
- SetInteractionToButton(Buttons[ButtonNext]);
- }
- else
- Buttons[ButtonNext].Visible = false;
- }
-
- private bool OnAdd()
- {
- for (int i = 0; i < PlayerChooseButtons.Count; i++)
- {
- if (PlayerChooseButtons[i].Button.Selected && PlayerChooseButtons[i].ProfileID != -1)
- {
- if (Data.ScreenNames.ProfileIDsTeam1.Count < NumPlayerTeam1)
- {
- Data.ScreenNames.ProfileIDsTeam1.Add(PlayerChooseButtons[i].ProfileID);
- int added = Data.ScreenNames.ProfileIDsTeam1.Count - 1;
- UpdateButtonNext();
- //Update texture and name
- PlayerDestinationButtons[added].Color = new SColorF(1, 1, 1, 0.6f);
- PlayerDestinationButtons[added].SColor = new SColorF(1, 1, 1, 1);
- PlayerDestinationButtons[added].Texture = CBase.Profiles.GetProfiles()[PlayerChooseButtons[i].ProfileID].Avatar.Texture;
- PlayerDestinationButtons[added].STexture = CBase.Profiles.GetProfiles()[PlayerChooseButtons[i].ProfileID].Avatar.Texture;
- PlayerDestinationButtons[added].Text.Text = CBase.Profiles.GetProfiles()[PlayerChooseButtons[i].ProfileID].PlayerName;
- PlayerDestinationButtons[added].Enabled = true;
- //Update Tiles-List
- UpdateButtonPlayerChoose();
- CheckInteraction();
- return true;
- }
- else if (Data.ScreenNames.ProfileIDsTeam2.Count < NumPlayerTeam2)
- {
- Data.ScreenNames.ProfileIDsTeam2.Add(PlayerChooseButtons[i].ProfileID);
- int added = (Data.ScreenNames.ProfileIDsTeam2.Count - 1) + PlayerDestinationButtonsNumH;
- UpdateButtonNext();
- //Update texture and name
- PlayerDestinationButtons[added].Color = new SColorF(1, 1, 1, 0.6f);
- PlayerDestinationButtons[added].SColor = new SColorF(1, 1, 1, 1);
- PlayerDestinationButtons[added].Texture = CBase.Profiles.GetProfiles()[PlayerChooseButtons[i].ProfileID].Avatar.Texture;
- PlayerDestinationButtons[added].STexture = CBase.Profiles.GetProfiles()[PlayerChooseButtons[i].ProfileID].Avatar.Texture;
- PlayerDestinationButtons[added].Text.Text = CBase.Profiles.GetProfiles()[PlayerChooseButtons[i].ProfileID].PlayerName;
- PlayerDestinationButtons[added].Enabled = true;
- //Update Tiles-List
- UpdateButtonPlayerChoose();
- CheckInteraction();
- return true;
- }
- }
- }
- return false;
- }
-
- private bool OnRemove()
- {
- for (int i = 0; i < PlayerDestinationButtonsNumH; i++)
- {
- if (PlayerDestinationButtons[i].Selected)
- {
- if ((i + 1) <= Data.ScreenNames.ProfileIDsTeam1.Count)
- {
- Data.ScreenNames.ProfileIDsTeam1.RemoveAt(i);
- UpdateButtonNext();
- UpdateButtonPlayerDestination();
- UpdateButtonPlayerChoose();
- CheckInteraction();
- return true;
- }
- }
- }
- for (int i = PlayerDestinationButtonsNumH; i < PlayerDestinationButtonsNumH * 2; i++)
- {
- if (PlayerDestinationButtons[i].Selected)
- {
- if (((i - PlayerDestinationButtonsNumH) + 1) <= Data.ScreenNames.ProfileIDsTeam2.Count)
- {
- Data.ScreenNames.ProfileIDsTeam2.RemoveAt(i - PlayerDestinationButtonsNumH);
- UpdateButtonNext();
- UpdateButtonPlayerDestination();
- UpdateButtonPlayerChoose();
- CheckInteraction();
- return true;
- }
- }
- }
- return false;
- }
-
- private void Back()
- {
- Data.ScreenNames.FadeToConfig = true;
- Data.ScreenNames.FadeToMain = false;
- _PartyMode.DataFromScreen(ThemeName, Data);
- }
-
- private void Next()
- {
- Data.ScreenNames.FadeToConfig = false;
- Data.ScreenNames.FadeToMain = true;
- _PartyMode.DataFromScreen(ThemeName, Data);
- }
- }
-}
\ No newline at end of file
diff --git a/Re#Settings.DotSettings b/Re#Settings.DotSettings
index e20afa3a..0ca89a5f 100644
--- a/Re#Settings.DotSettings
+++ b/Re#Settings.DotSettings
@@ -1,10 +1,15 @@

+ Default
+ NotCompiledCode
+ True
+ True
SOLUTION
+ DO_NOT_SHOW
DO_NOT_SHOW
DO_NOT_SHOW
DO_NOT_SHOW
DO_NOT_SHOW
- <?xml version="1.0" encoding="utf-16"?><Profile name="Cleanup"><CSArrangeThisQualifier>True</CSArrangeThisQualifier><CSRemoveCodeRedundancies>True</CSRemoveCodeRedundancies><CSMakeFieldReadonly>True</CSMakeFieldReadonly><CSUseVar><BehavourStyle>CAN_CHANGE_TO_EXPLICIT</BehavourStyle><LocalVariableStyle>ALWAYS_EXPLICIT</LocalVariableStyle><ForeachVariableStyle>ALWAYS_EXPLICIT</ForeachVariableStyle></CSUseVar><CSOptimizeUsings><OptimizeUsings>False</OptimizeUsings><EmbraceInRegion>False</EmbraceInRegion><RegionName></RegionName></CSOptimizeUsings><CSReformatCode>True</CSReformatCode><CSharpFormatDocComments>True</CSharpFormatDocComments><CSShortenReferences>True</CSShortenReferences><StyleCop.Documentation><SA1600ElementsMustBeDocumented>False</SA1600ElementsMustBeDocumented><SA1604ElementDocumentationMustHaveSummary>False</SA1604ElementDocumentationMustHaveSummary><SA1609PropertyDocumentationMustHaveValueDocumented>False</SA1609PropertyDocumentationMustHaveValueDocumented><SA1611ElementParametersMustBeDocumented>False</SA1611ElementParametersMustBeDocumented><SA1615ElementReturnValueMustBeDocumented>False</SA1615ElementReturnValueMustBeDocumented><SA1617VoidReturnValueMustNotBeDocumented>False</SA1617VoidReturnValueMustNotBeDocumented><SA1618GenericTypeParametersMustBeDocumented>False</SA1618GenericTypeParametersMustBeDocumented><SA1626SingleLineCommentsMustNotUseDocumentationStyleSlashes>False</SA1626SingleLineCommentsMustNotUseDocumentationStyleSlashes><SA1628DocumentationTextMustBeginWithACapitalLetter>False</SA1628DocumentationTextMustBeginWithACapitalLetter><SA1629DocumentationTextMustEndWithAPeriod>False</SA1629DocumentationTextMustEndWithAPeriod><SA1633SA1641UpdateFileHeader>Ignore</SA1633SA1641UpdateFileHeader><SA1639FileHeaderMustHaveSummary>False</SA1639FileHeaderMustHaveSummary><SA1642ConstructorSummaryDocumentationMustBeginWithStandardText>False</SA1642ConstructorSummaryDocumentationMustBeginWithStandardText><SA1643DestructorSummaryDocumentationMustBeginWithStandardText>False</SA1643DestructorSummaryDocumentationMustBeginWithStandardText><SA1644DocumentationHeadersMustNotContainBlankLines>False</SA1644DocumentationHeadersMustNotContainBlankLines></StyleCop.Documentation><StyleCop.Layout><SA1500CurlyBracketsForMultiLineStatementsMustNotShareLine>False</SA1500CurlyBracketsForMultiLineStatementsMustNotShareLine><SA1509OpeningCurlyBracketsMustNotBePrecededByBlankLine>True</SA1509OpeningCurlyBracketsMustNotBePrecededByBlankLine><SA1510ChainedStatementBlocksMustNotBePrecededByBlankLine>True</SA1510ChainedStatementBlocksMustNotBePrecededByBlankLine><SA1511WhileDoFooterMustNotBePrecededByBlankLine>True</SA1511WhileDoFooterMustNotBePrecededByBlankLine><SA1512SingleLineCommentsMustNotBeFollowedByBlankLine>True</SA1512SingleLineCommentsMustNotBeFollowedByBlankLine><SA1513ClosingCurlyBracketMustBeFollowedByBlankLine>False</SA1513ClosingCurlyBracketMustBeFollowedByBlankLine><SA1514ElementDocumentationHeaderMustBePrecededByBlankLine>False</SA1514ElementDocumentationHeaderMustBePrecededByBlankLine><SA1515SingleLineCommentMustBeProceededByBlankLine>False</SA1515SingleLineCommentMustBeProceededByBlankLine></StyleCop.Layout><StyleCop.Readability><SA1100DoNotPrefixCallsWithBaseUnlessLocalImplementationExists>True</SA1100DoNotPrefixCallsWithBaseUnlessLocalImplementationExists><SA1106CodeMustNotContainEmptyStatements>True</SA1106CodeMustNotContainEmptyStatements><SA1108BlockStatementsMustNotContainEmbeddedComments>True</SA1108BlockStatementsMustNotContainEmbeddedComments><SA1109BlockStatementsMustNotContainEmbeddedRegions>True</SA1109BlockStatementsMustNotContainEmbeddedRegions><SA1120CommentsMustContainText>False</SA1120CommentsMustContainText><SA1121UseBuiltInTypeAlias>False</SA1121UseBuiltInTypeAlias><SA1122UseStringEmptyForEmptyStrings>False</SA1122UseStringEmptyForEmptyStrings><SA1123DoNotPlaceRegionsWithinElements>False</SA1123DoNotPlaceRegionsWithinElements><SA1124CodeMustNotContainEmptyRegions>True</SA1124CodeMustNotContainEmptyRegions></StyleCop.Readability><StyleCop.Spacing><SA1001CommasMustBeSpacedCorrectly>False</SA1001CommasMustBeSpacedCorrectly><SA1005SingleLineCommentsMustBeginWithSingleSpace>False</SA1005SingleLineCommentsMustBeginWithSingleSpace><SA1006PreprocessorKeywordsMustNotBePrecededBySpace>True</SA1006PreprocessorKeywordsMustNotBePrecededBySpace><SA1021NegativeSignsMustBeSpacedCorrectly>True</SA1021NegativeSignsMustBeSpacedCorrectly><SA1022PositiveSignsMustBeSpacedCorrectly>True</SA1022PositiveSignsMustBeSpacedCorrectly><SA1025CodeMustNotContainMultipleWhitespaceInARow>True</SA1025CodeMustNotContainMultipleWhitespaceInARow></StyleCop.Spacing><StyleCop.Ordering><AlphabeticalUsingDirectives>Ignore</AlphabeticalUsingDirectives><ExpandUsingDirectives>Ignore</ExpandUsingDirectives><SA1212PropertyAccessorsMustFollowOrder>True</SA1212PropertyAccessorsMustFollowOrder><SA1213EventAccessorsMustFollowOrder>True</SA1213EventAccessorsMustFollowOrder></StyleCop.Ordering></Profile>
+ <?xml version="1.0" encoding="utf-16"?><Profile name="Cleanup"><CSArrangeThisQualifier>True</CSArrangeThisQualifier><CSRemoveCodeRedundancies>True</CSRemoveCodeRedundancies><CSMakeFieldReadonly>True</CSMakeFieldReadonly><CSUseVar><BehavourStyle>CAN_CHANGE_TO_EXPLICIT</BehavourStyle><LocalVariableStyle>ALWAYS_EXPLICIT</LocalVariableStyle><ForeachVariableStyle>ALWAYS_EXPLICIT</ForeachVariableStyle></CSUseVar><CSOptimizeUsings><OptimizeUsings>False</OptimizeUsings><EmbraceInRegion>False</EmbraceInRegion><RegionName></RegionName></CSOptimizeUsings><CSReformatCode>True</CSReformatCode><CSharpFormatDocComments>True</CSharpFormatDocComments><CSShortenReferences>True</CSShortenReferences><StyleCop.Documentation><SA1600ElementsMustBeDocumented>False</SA1600ElementsMustBeDocumented><SA1604ElementDocumentationMustHaveSummary>False</SA1604ElementDocumentationMustHaveSummary><SA1609PropertyDocumentationMustHaveValueDocumented>False</SA1609PropertyDocumentationMustHaveValueDocumented><SA1611ElementParametersMustBeDocumented>False</SA1611ElementParametersMustBeDocumented><SA1615ElementReturnValueMustBeDocumented>False</SA1615ElementReturnValueMustBeDocumented><SA1617VoidReturnValueMustNotBeDocumented>False</SA1617VoidReturnValueMustNotBeDocumented><SA1618GenericTypeParametersMustBeDocumented>False</SA1618GenericTypeParametersMustBeDocumented><SA1626SingleLineCommentsMustNotUseDocumentationStyleSlashes>False</SA1626SingleLineCommentsMustNotUseDocumentationStyleSlashes><SA1628DocumentationTextMustBeginWithACapitalLetter>False</SA1628DocumentationTextMustBeginWithACapitalLetter><SA1629DocumentationTextMustEndWithAPeriod>False</SA1629DocumentationTextMustEndWithAPeriod><SA1633SA1641UpdateFileHeader>Ignore</SA1633SA1641UpdateFileHeader><SA1639FileHeaderMustHaveSummary>False</SA1639FileHeaderMustHaveSummary><SA1642ConstructorSummaryDocumentationMustBeginWithStandardText>False</SA1642ConstructorSummaryDocumentationMustBeginWithStandardText><SA1643DestructorSummaryDocumentationMustBeginWithStandardText>False</SA1643DestructorSummaryDocumentationMustBeginWithStandardText><SA1644DocumentationHeadersMustNotContainBlankLines>False</SA1644DocumentationHeadersMustNotContainBlankLines></StyleCop.Documentation><StyleCop.Layout><SA1500CurlyBracketsForMultiLineStatementsMustNotShareLine>False</SA1500CurlyBracketsForMultiLineStatementsMustNotShareLine><SA1509OpeningCurlyBracketsMustNotBePrecededByBlankLine>True</SA1509OpeningCurlyBracketsMustNotBePrecededByBlankLine><SA1510ChainedStatementBlocksMustNotBePrecededByBlankLine>True</SA1510ChainedStatementBlocksMustNotBePrecededByBlankLine><SA1511WhileDoFooterMustNotBePrecededByBlankLine>True</SA1511WhileDoFooterMustNotBePrecededByBlankLine><SA1512SingleLineCommentsMustNotBeFollowedByBlankLine>True</SA1512SingleLineCommentsMustNotBeFollowedByBlankLine><SA1513ClosingCurlyBracketMustBeFollowedByBlankLine>False</SA1513ClosingCurlyBracketMustBeFollowedByBlankLine><SA1514ElementDocumentationHeaderMustBePrecededByBlankLine>False</SA1514ElementDocumentationHeaderMustBePrecededByBlankLine><SA1515SingleLineCommentMustBeProceededByBlankLine>False</SA1515SingleLineCommentMustBeProceededByBlankLine></StyleCop.Layout><StyleCop.Readability><SA1100DoNotPrefixCallsWithBaseUnlessLocalImplementationExists>True</SA1100DoNotPrefixCallsWithBaseUnlessLocalImplementationExists><SA1106CodeMustNotContainEmptyStatements>True</SA1106CodeMustNotContainEmptyStatements><SA1108BlockStatementsMustNotContainEmbeddedComments>True</SA1108BlockStatementsMustNotContainEmbeddedComments><SA1109BlockStatementsMustNotContainEmbeddedRegions>True</SA1109BlockStatementsMustNotContainEmbeddedRegions><SA1120CommentsMustContainText>False</SA1120CommentsMustContainText><SA1121UseBuiltInTypeAlias>False</SA1121UseBuiltInTypeAlias><SA1122UseStringEmptyForEmptyStrings>False</SA1122UseStringEmptyForEmptyStrings><SA1123DoNotPlaceRegionsWithinElements>False</SA1123DoNotPlaceRegionsWithinElements><SA1124CodeMustNotContainEmptyRegions>True</SA1124CodeMustNotContainEmptyRegions></StyleCop.Readability><StyleCop.Spacing><SA1001CommasMustBeSpacedCorrectly>False</SA1001CommasMustBeSpacedCorrectly><SA1005SingleLineCommentsMustBeginWithSingleSpace>False</SA1005SingleLineCommentsMustBeginWithSingleSpace><SA1006PreprocessorKeywordsMustNotBePrecededBySpace>True</SA1006PreprocessorKeywordsMustNotBePrecededBySpace><SA1021NegativeSignsMustBeSpacedCorrectly>True</SA1021NegativeSignsMustBeSpacedCorrectly><SA1022PositiveSignsMustBeSpacedCorrectly>True</SA1022PositiveSignsMustBeSpacedCorrectly><SA1025CodeMustNotContainMultipleWhitespaceInARow>True</SA1025CodeMustNotContainMultipleWhitespaceInARow></StyleCop.Spacing><StyleCop.Ordering><AlphabeticalUsingDirectives>Ignore</AlphabeticalUsingDirectives><ExpandUsingDirectives>Ignore</ExpandUsingDirectives><SA1212PropertyAccessorsMustFollowOrder>True</SA1212PropertyAccessorsMustFollowOrder><SA1213EventAccessorsMustFollowOrder>True</SA1213EventAccessorsMustFollowOrder></StyleCop.Ordering><CSUpdateFileHeader>True</CSUpdateFileHeader></Profile>
<?xml version="1.0" encoding="utf-16"?><Profile name="Simple Reformat"><CSOptimizeUsings><OptimizeUsings>False</OptimizeUsings><EmbraceInRegion>False</EmbraceInRegion><RegionName></RegionName></CSOptimizeUsings><CSReformatCode>True</CSReformatCode><StyleCop.Documentation><SA1600ElementsMustBeDocumented>False</SA1600ElementsMustBeDocumented><SA1604ElementDocumentationMustHaveSummary>False</SA1604ElementDocumentationMustHaveSummary><SA1609PropertyDocumentationMustHaveValueDocumented>False</SA1609PropertyDocumentationMustHaveValueDocumented><SA1611ElementParametersMustBeDocumented>False</SA1611ElementParametersMustBeDocumented><SA1615ElementReturnValueMustBeDocumented>False</SA1615ElementReturnValueMustBeDocumented><SA1617VoidReturnValueMustNotBeDocumented>False</SA1617VoidReturnValueMustNotBeDocumented><SA1618GenericTypeParametersMustBeDocumented>False</SA1618GenericTypeParametersMustBeDocumented><SA1626SingleLineCommentsMustNotUseDocumentationStyleSlashes>False</SA1626SingleLineCommentsMustNotUseDocumentationStyleSlashes><SA1628DocumentationTextMustBeginWithACapitalLetter>False</SA1628DocumentationTextMustBeginWithACapitalLetter><SA1629DocumentationTextMustEndWithAPeriod>False</SA1629DocumentationTextMustEndWithAPeriod><SA1633SA1641UpdateFileHeader>Ignore</SA1633SA1641UpdateFileHeader><SA1639FileHeaderMustHaveSummary>False</SA1639FileHeaderMustHaveSummary><SA1642ConstructorSummaryDocumentationMustBeginWithStandardText>False</SA1642ConstructorSummaryDocumentationMustBeginWithStandardText><SA1643DestructorSummaryDocumentationMustBeginWithStandardText>False</SA1643DestructorSummaryDocumentationMustBeginWithStandardText><SA1644DocumentationHeadersMustNotContainBlankLines>False</SA1644DocumentationHeadersMustNotContainBlankLines></StyleCop.Documentation><StyleCop.Spacing><SA1001CommasMustBeSpacedCorrectly>False</SA1001CommasMustBeSpacedCorrectly><SA1005SingleLineCommentsMustBeginWithSingleSpace>False</SA1005SingleLineCommentsMustBeginWithSingleSpace><SA1006PreprocessorKeywordsMustNotBePrecededBySpace>True</SA1006PreprocessorKeywordsMustNotBePrecededBySpace><SA1021NegativeSignsMustBeSpacedCorrectly>True</SA1021NegativeSignsMustBeSpacedCorrectly><SA1022PositiveSignsMustBeSpacedCorrectly>True</SA1022PositiveSignsMustBeSpacedCorrectly><SA1025CodeMustNotContainMultipleWhitespaceInARow>True</SA1025CodeMustNotContainMultipleWhitespaceInARow></StyleCop.Spacing><StyleCop.Readability><SA1100DoNotPrefixCallsWithBaseUnlessLocalImplementationExists>True</SA1100DoNotPrefixCallsWithBaseUnlessLocalImplementationExists><SA1106CodeMustNotContainEmptyStatements>True</SA1106CodeMustNotContainEmptyStatements><SA1108BlockStatementsMustNotContainEmbeddedComments>True</SA1108BlockStatementsMustNotContainEmbeddedComments><SA1109BlockStatementsMustNotContainEmbeddedRegions>True</SA1109BlockStatementsMustNotContainEmbeddedRegions><SA1120CommentsMustContainText>False</SA1120CommentsMustContainText><SA1121UseBuiltInTypeAlias>False</SA1121UseBuiltInTypeAlias><SA1122UseStringEmptyForEmptyStrings>False</SA1122UseStringEmptyForEmptyStrings><SA1123DoNotPlaceRegionsWithinElements>False</SA1123DoNotPlaceRegionsWithinElements><SA1124CodeMustNotContainEmptyRegions>True</SA1124CodeMustNotContainEmptyRegions></StyleCop.Readability><StyleCop.Layout><SA1500CurlyBracketsForMultiLineStatementsMustNotShareLine>False</SA1500CurlyBracketsForMultiLineStatementsMustNotShareLine><SA1509OpeningCurlyBracketsMustNotBePrecededByBlankLine>True</SA1509OpeningCurlyBracketsMustNotBePrecededByBlankLine><SA1510ChainedStatementBlocksMustNotBePrecededByBlankLine>True</SA1510ChainedStatementBlocksMustNotBePrecededByBlankLine><SA1511WhileDoFooterMustNotBePrecededByBlankLine>True</SA1511WhileDoFooterMustNotBePrecededByBlankLine><SA1512SingleLineCommentsMustNotBeFollowedByBlankLine>True</SA1512SingleLineCommentsMustNotBeFollowedByBlankLine><SA1513ClosingCurlyBracketMustBeFollowedByBlankLine>False</SA1513ClosingCurlyBracketMustBeFollowedByBlankLine><SA1514ElementDocumentationHeaderMustBePrecededByBlankLine>False</SA1514ElementDocumentationHeaderMustBePrecededByBlankLine><SA1515SingleLineCommentMustBeProceededByBlankLine>False</SA1515SingleLineCommentMustBeProceededByBlankLine></StyleCop.Layout><StyleCop.Ordering><AlphabeticalUsingDirectives>Ignore</AlphabeticalUsingDirectives><ExpandUsingDirectives>Ignore</ExpandUsingDirectives><SA1212PropertyAccessorsMustFollowOrder>True</SA1212PropertyAccessorsMustFollowOrder><SA1213EventAccessorsMustFollowOrder>True</SA1213EventAccessorsMustFollowOrder></StyleCop.Ordering></Profile>
Cleanup
Simple Reformat
@@ -32,13 +37,80 @@
WRAP_IF_LONG
WRAP_IF_LONG
False
+ license
+ /*
+ This file is part of $SOLUTION$.
+
+ $SOLUTION$ is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ $SOLUTION$ is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with $SOLUTION$. If not, see <http://www.gnu.org/licenses/>.
+ */
+ AA
+ AC
+ AL
+ ALSA
+ API
+ ASIO
+ BG
+ BGR
+ BPM
+ CV
+ DB
+ DX
+ DY
+ FG
+ FPS
+ GL
+ HID
+ HPI
+ ID
+ IO
+ IR
+ JACK
+ LB
+ LBH
+ LD
+ LE
+ LED
+ MB
+ MBH
+ MME
+ MP
+ OS
+ OSS
+ PBO
+ PID
+ RB
+ RBH
+ RC
+ RGB
+ RGBA
+ USDX
+ WASAPI
+ WDMKS
+ XML
+ <Policy Inspect="True" Prefix="" Suffix="" Style="AaBb" />
<Policy Inspect="True" Prefix="" Suffix="" Style="AaBb" />
+ <Policy Inspect="True" Prefix="" Suffix="" Style="AaBb" />
+ <Policy Inspect="True" Prefix="" Suffix="" Style="aaBb" />
<Policy Inspect="True" Prefix="_" Suffix="" Style="AaBb" />
<Policy Inspect="True" Prefix="_" Suffix="" Style="AaBb" />
<Policy Inspect="True" Prefix="_" Suffix="" Style="AaBb" />
<Policy Inspect="True" Prefix="_" Suffix="" Style="AaBb" />
<Policy Inspect="True" Prefix="" Suffix="" Style="AaBb" />
+ <Policy Inspect="True" Prefix="T" Suffix="" Style="AaBb" />
+ <Policy Inspect="True" Prefix="" Suffix="" Style="AaBb" />
<Policy><Descriptor Staticness="Static, Instance" AccessRightKinds="Private, Protected, ProtectedInternal, Internal, Public" Description="Enums"><ElementKinds><Kind Name="ENUM" /></ElementKinds></Descriptor><Policy Inspect="True" Prefix="E" Suffix="" Style="AaBb" /></Policy>
<Policy><Descriptor Staticness="Static, Instance" AccessRightKinds="Private, Protected, ProtectedInternal, Internal, Public" Description="Classes"><ElementKinds><Kind Name="CLASS" /></ElementKinds></Descriptor><Policy Inspect="True" Prefix="C" Suffix="" Style="AaBb" /></Policy>
+ <Policy><Descriptor Staticness="Static, Instance" AccessRightKinds="Private, Protected" Description="Fields (not public)"><ElementKinds><Kind Name="FIELD" /><Kind Name="READONLY_FIELD" /><Kind Name="METHOD" /><Kind Name="PROPERTY" /></ElementKinds></Descriptor><Policy Inspect="True" Prefix="_" Suffix="" Style="AaBb" /></Policy>
<Policy><Descriptor Staticness="Static, Instance" AccessRightKinds="Private, Protected, ProtectedInternal, Internal, Public" Description="Structs"><ElementKinds><Kind Name="STRUCT" /></ElementKinds></Descriptor><Policy Inspect="True" Prefix="S" Suffix="" Style="AaBb" /></Policy>
\ No newline at end of file
diff --git a/Vocaluxe/Base/CBackgroundMusic.cs b/Vocaluxe/Base/CBackgroundMusic.cs
index 3f4f502f..ece1cd16 100644
--- a/Vocaluxe/Base/CBackgroundMusic.cs
+++ b/Vocaluxe/Base/CBackgroundMusic.cs
@@ -12,12 +12,12 @@ namespace Vocaluxe.Base
{
private static int _CurrentMusicStream = -1;
private static int _PreviousMusicIndex;
- private static PlaylistElement _CurrentPlaylistElement = new PlaylistElement();
+ private static CPlaylistElement _CurrentPlaylistElement = new CPlaylistElement();
- private static readonly List _AllFileNames = new List();
- private static readonly List _NotPlayedFileNames = new List();
- private static readonly List _BGMusicFileNames = new List();
- private static readonly List _PreviousFileNames = new List();
+ private static readonly List _AllFileNames = new List();
+ private static readonly List _NotPlayedFileNames = new List();
+ private static readonly List _BGMusicFileNames = new List();
+ private static readonly List _PreviousFileNames = new List();
private static int _Video = -1;
private static STexture _CurrentVideoTexture = new STexture(-1);
@@ -114,10 +114,10 @@ namespace Vocaluxe.Base
List templist = new List();
foreach (string ending in CSettings.MusicFileTypes)
- templist.AddRange(CHelper.ListFiles(CSettings.sFolderBackgroundMusic, ending, true, true));
+ templist.AddRange(CHelper.ListFiles(CSettings.FolderBackgroundMusic, ending, true, true));
foreach (string path in templist)
- _BGMusicFileNames.Add(new PlaylistElement(path));
+ _BGMusicFileNames.Add(new CPlaylistElement(path));
if (CConfig.BackgroundMusicSource != EBackgroundMusicSource.TR_CONFIG_ONLY_OWN_MUSIC)
AddBackgroundMusic();
@@ -147,7 +147,7 @@ namespace Vocaluxe.Base
else
Next();
- if (!IsBackgroundFile(_CurrentPlaylistElement))
+ if (!_IsBackgroundFile(_CurrentPlaylistElement))
_CanSing = true;
else
_CanSing = false;
@@ -169,7 +169,7 @@ namespace Vocaluxe.Base
CSound.FadeAndStop(_CurrentMusicStream, 0f, CSettings.BackgroundMusicFadeTime);
_CurrentMusicStream = -1;
- _CurrentPlaylistElement = new PlaylistElement();
+ _CurrentPlaylistElement = new CPlaylistElement();
_Playing = false;
}
@@ -254,7 +254,7 @@ namespace Vocaluxe.Base
CSound.SetPosition(_CurrentMusicStream, _CurrentPlaylistElement.Start);
if (_VideoEnabled)
- LoadVideo();
+ _LoadVideo();
CSound.SetStreamVolume(_CurrentMusicStream, 0f);
Play();
}
@@ -294,7 +294,7 @@ namespace Vocaluxe.Base
_CurrentMusicStream = CSound.Load(_CurrentPlaylistElement.MusicFilePath);
CSound.SetStreamVolumeMax(_CurrentMusicStream, CConfig.BackgroundMusicVolume);
if (_VideoEnabled)
- LoadVideo();
+ _LoadVideo();
CSound.SetStreamVolume(_CurrentMusicStream, 0f);
Play();
}
@@ -327,8 +327,8 @@ namespace Vocaluxe.Base
{
foreach (CSong song in CSongs.AllSongs)
{
- _AllFileNames.Add(new PlaylistElement(song));
- _NotPlayedFileNames.Add(new PlaylistElement(song));
+ _AllFileNames.Add(new CPlaylistElement(song));
+ _NotPlayedFileNames.Add(new CPlaylistElement(song));
}
}
_OwnMusicAdded = true;
@@ -345,7 +345,7 @@ namespace Vocaluxe.Base
_NotPlayedFileNames.AddRange(_BGMusicFileNames);
}
- if (Playing && !IsBackgroundFile(_CurrentPlaylistElement) || _AllFileNames.Count == 0)
+ if (Playing && !_IsBackgroundFile(_CurrentPlaylistElement) || _AllFileNames.Count == 0)
Next();
_OwnMusicAdded = false;
@@ -370,18 +370,18 @@ namespace Vocaluxe.Base
AddOwnMusic();
_BackgroundMusicAdded = false;
- if (Playing && IsBackgroundFile(_CurrentPlaylistElement) || _AllFileNames.Count == 0)
+ if (Playing && _IsBackgroundFile(_CurrentPlaylistElement) || _AllFileNames.Count == 0)
Next();
}
}
- public static void CheckAndApplyConfig(EOffOn NewOnOff, EBackgroundMusicSource NewSource, float NewVolume)
+ public static void CheckAndApplyConfig(EOffOn newOnOff, EBackgroundMusicSource newSource, float newVolume)
{
- if (CConfig.BackgroundMusicSource != NewSource || (NewOnOff == EOffOn.TR_CONFIG_ON && !_OwnMusicAdded && !_BackgroundMusicAdded))
+ if (CConfig.BackgroundMusicSource != newSource || (newOnOff == EOffOn.TR_CONFIG_ON && !_OwnMusicAdded && !_BackgroundMusicAdded))
{
- CConfig.BackgroundMusicSource = NewSource;
+ CConfig.BackgroundMusicSource = newSource;
- switch (NewSource)
+ switch (newSource)
{
case EBackgroundMusicSource.TR_CONFIG_NO_OWN_MUSIC:
if (!_BackgroundMusicAdded)
@@ -406,18 +406,18 @@ namespace Vocaluxe.Base
}
}
- if (CConfig.BackgroundMusic != NewOnOff)
+ if (CConfig.BackgroundMusic != newOnOff)
{
- CConfig.BackgroundMusic = NewOnOff;
- if (NewOnOff == EOffOn.TR_CONFIG_ON)
+ CConfig.BackgroundMusic = newOnOff;
+ if (newOnOff == EOffOn.TR_CONFIG_ON)
Play();
else
Pause();
}
- if (CConfig.BackgroundMusicVolume != NewVolume)
+ if (CConfig.BackgroundMusicVolume != newVolume)
{
- CConfig.BackgroundMusicVolume = (int)NewVolume;
+ CConfig.BackgroundMusicVolume = (int)newVolume;
ApplyVolume();
}
@@ -445,7 +445,7 @@ namespace Vocaluxe.Base
}
}
else
- LoadVideo();
+ _LoadVideo();
}
public static STexture GetVideoTexture()
@@ -455,10 +455,10 @@ 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;
+ _CurrentVideoTexture.Color.A = 1f;
_FadeTimer.Stop();
}
return _CurrentVideoTexture;
@@ -466,9 +466,9 @@ namespace Vocaluxe.Base
return new STexture(-1);
}
- private static bool IsBackgroundFile(PlaylistElement element)
+ private static bool _IsBackgroundFile(CPlaylistElement element)
{
- foreach (PlaylistElement elements in _BGMusicFileNames)
+ foreach (CPlaylistElement elements in _BGMusicFileNames)
{
if (elements.MusicFilePath == element.MusicFilePath)
return true;
@@ -476,7 +476,7 @@ namespace Vocaluxe.Base
return false;
}
- private static void LoadVideo()
+ private static void _LoadVideo()
{
if (_Video == -1)
{
@@ -493,7 +493,7 @@ namespace Vocaluxe.Base
}
}
-class PlaylistElement
+class CPlaylistElement
{
private readonly CSong _Song;
@@ -606,7 +606,7 @@ class PlaylistElement
}
}
- public PlaylistElement(CSong song)
+ public CPlaylistElement(CSong song)
{
MusicFilePath = string.Empty;
_SongID = song.ID;
@@ -614,13 +614,13 @@ class PlaylistElement
_Song = song;
}
- public PlaylistElement(string FilePath)
+ public CPlaylistElement(string filePath)
{
- MusicFilePath = FilePath;
+ MusicFilePath = filePath;
_SongID = -1;
}
- public PlaylistElement()
+ public CPlaylistElement()
{
MusicFilePath = string.Empty;
_SongID = -1;
diff --git a/Vocaluxe/Base/CConfig.cs b/Vocaluxe/Base/CConfig.cs
index ad686f43..9ee47abf 100644
--- a/Vocaluxe/Base/CConfig.cs
+++ b/Vocaluxe/Base/CConfig.cs
@@ -13,7 +13,7 @@ namespace Vocaluxe.Base
{
static class CConfig
{
- private static readonly XmlWriterSettings _settings = new XmlWriterSettings();
+ private static readonly XmlWriterSettings _Settings = new XmlWriterSettings();
// Debug
public static EDebugLevel DebugLevel = EDebugLevel.TR_CONFIG_OFF;
@@ -31,7 +31,7 @@ namespace Vocaluxe.Base
public static int ScreenW = 1024;
public static int ScreenH = 576;
- public static EAntiAliasingModes AAMode = EAntiAliasingModes.x0;
+ public static EAntiAliasingModes AAMode = EAntiAliasingModes.X0;
public static EColorDeep Colors = EColorDeep.Bit32;
public static EOffOn VSync = EOffOn.TR_CONFIG_ON;
@@ -55,7 +55,7 @@ namespace Vocaluxe.Base
// Sound
public static EPlaybackLib PlayBackLib = EPlaybackLib.Gstreamer;
public static ERecordLib RecordLib = ERecordLib.PortAudio;
- public static EBufferSize AudioBufferSize = EBufferSize.b2048;
+ public static EBufferSize AudioBufferSize = EBufferSize.B2048;
public static int AudioLatency = 0;
public static int BackgroundMusicVolume = 30;
public static EOffOn BackgroundMusic = EOffOn.TR_CONFIG_ON;
@@ -97,20 +97,20 @@ namespace Vocaluxe.Base
private static readonly List _Values = new List();
//Variables to save old values for commandline-parameters
- private static readonly List SongFolderOld = new List();
+ private static readonly List _SongFolderOld = new List();
public static void Init()
{
- _settings.Indent = true;
- _settings.Encoding = Encoding.UTF8;
- _settings.ConformanceLevel = ConformanceLevel.Document;
+ _Settings.Indent = true;
+ _Settings.Encoding = Encoding.UTF8;
+ _Settings.ConformanceLevel = ConformanceLevel.Document;
- SongFolder.Add(Path.Combine(Directory.GetCurrentDirectory(), CSettings.sFolderSongs));
+ SongFolder.Add(Path.Combine(Directory.GetCurrentDirectory(), CSettings.FolderSongs));
MicConfig = new SMicConfig[CSettings.MaxNumPlayer];
// Init config file
- if (!File.Exists(CSettings.sFileConfig))
+ if (!File.Exists(CSettings.FileConfig))
SaveConfig();
LoadConfig();
@@ -118,7 +118,7 @@ namespace Vocaluxe.Base
public static bool LoadConfig()
{
- CXMLReader xmlReader = CXMLReader.OpenFile(CSettings.sFileConfig);
+ CXMLReader xmlReader = CXMLReader.OpenFile(CSettings.FileConfig);
if (xmlReader == null)
return false;
@@ -204,10 +204,10 @@ namespace Vocaluxe.Base
if (NumPlayer < 1 || NumPlayer > CSettings.MaxNumPlayer)
NumPlayer = 2;
- bool _LangExists = CLanguage.SetLanguage(Language);
+ bool langExists = CLanguage.SetLanguage(Language);
//TODO: What should we do, if English not exists?
- if (_LangExists == false)
+ if (langExists == false)
Language = "English";
//Read players from config
@@ -254,7 +254,7 @@ namespace Vocaluxe.Base
XmlWriter writer = null;
try
{
- writer = XmlWriter.Create(CSettings.sFileConfig, _settings);
+ writer = XmlWriter.Create(CSettings.FileConfig, _Settings);
writer.WriteStartDocument();
writer.WriteStartElement("root");
@@ -402,12 +402,12 @@ namespace Vocaluxe.Base
// SongFolder
// Check, if program was started with songfolder-parameters
- if (SongFolderOld.Count > 0)
+ if (_SongFolderOld.Count > 0)
{
//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]);
+ for (int i = 0; i < _SongFolderOld.Count; i++)
+ writer.WriteElementString("SongFolder" + (i + 1).ToString(), _SongFolderOld[i]);
}
else
{
@@ -540,15 +540,15 @@ namespace Vocaluxe.Base
///
public static bool IsMicConfig()
{
- SRecordDevice[] Devices = CSound.RecordGetDevices();
- if (Devices == null)
+ SRecordDevice[] devices = CSound.RecordGetDevices();
+ if (devices == null)
return false;
- for (int dev = 0; dev < Devices.Length; dev++)
+ for (int dev = 0; dev < devices.Length; dev++)
{
- for (int inp = 0; inp < Devices[dev].Inputs.Count; inp++)
+ for (int inp = 0; inp < devices[dev].Inputs.Count; inp++)
{
- if (Devices[dev].Inputs[inp].PlayerChannel1 != 0 || Devices[dev].Inputs[inp].PlayerChannel2 != 0)
+ if (devices[dev].Inputs[inp].PlayerChannel1 != 0 || devices[dev].Inputs[inp].PlayerChannel2 != 0)
return true;
}
}
@@ -562,17 +562,17 @@ namespace Vocaluxe.Base
///
public static bool IsMicConfig(int player)
{
- SRecordDevice[] Devices = CSound.RecordGetDevices();
- if (Devices == null)
+ SRecordDevice[] devices = CSound.RecordGetDevices();
+ if (devices == null)
return false;
- if (Devices != null)
+ if (devices != null)
{
- for (int dev = 0; dev < Devices.Length; dev++)
+ for (int dev = 0; dev < devices.Length; dev++)
{
- for (int inp = 0; inp < Devices[dev].Inputs.Count; inp++)
+ for (int inp = 0; inp < devices[dev].Inputs.Count; inp++)
{
- if (Devices[dev].Inputs[inp].PlayerChannel1 == player || Devices[dev].Inputs[inp].PlayerChannel2 == player)
+ if (devices[dev].Inputs[inp].PlayerChannel1 == player || devices[dev].Inputs[inp].PlayerChannel2 == player)
return true;
}
}
@@ -588,30 +588,30 @@ namespace Vocaluxe.Base
{
//Look for (usb-)mic
//SRecordDevice[] Devices = new SRecordDevice[CSound.RecordGetDevices().Length];
- SRecordDevice[] Devices = CSound.RecordGetDevices();
- if (Devices == null)
+ SRecordDevice[] devices = CSound.RecordGetDevices();
+ if (devices == null)
return false;
- for (int dev = 0; dev < Devices.Length; dev++)
+ for (int dev = 0; dev < devices.Length; dev++)
{
//Has Device some signal-names in name -> This could be a (usb-)mic
- if (Regex.IsMatch(Devices[dev].Name, @"Usb|Wireless", RegexOptions.IgnoreCase))
+ if (Regex.IsMatch(devices[dev].Name, @"ReplacedStr:::0:::", RegexOptions.IgnoreCase))
{
//Check if there are inputs.
- if (Devices[dev].Inputs.Count >= 1)
+ if (devices[dev].Inputs.Count >= 1)
{
//Check if there is one or more channels
- if (Devices[dev].Inputs[0].Channels >= 2)
+ if (devices[dev].Inputs[0].Channels >= 2)
{
//Set this device to player 1
- MicConfig[0].DeviceName = Devices[dev].Name;
- MicConfig[0].DeviceDriver = Devices[dev].Driver;
- MicConfig[0].InputName = Devices[dev].Inputs[0].Name;
+ MicConfig[0].DeviceName = devices[dev].Name;
+ MicConfig[0].DeviceDriver = devices[dev].Driver;
+ MicConfig[0].InputName = devices[dev].Inputs[0].Name;
MicConfig[0].Channel = 1;
//Set this device to player 2
- MicConfig[1].DeviceName = Devices[dev].Name;
- MicConfig[1].DeviceDriver = Devices[dev].Driver;
- MicConfig[1].InputName = Devices[dev].Inputs[0].Name;
+ MicConfig[1].DeviceName = devices[dev].Name;
+ MicConfig[1].DeviceDriver = devices[dev].Driver;
+ MicConfig[1].InputName = devices[dev].Inputs[0].Name;
MicConfig[1].Channel = 2;
return true;
@@ -619,30 +619,30 @@ namespace Vocaluxe.Base
}
}
}
- //If no usb-mics found -> Look for Devices with "mic" or "mik"
- for (int dev = 0; dev < Devices.Length; dev++)
+ //If no usb-mics found -> Look for Devices with "ReplacedStr:::1:::" or "ReplacedStr:::2:::"
+ for (int dev = 0; dev < devices.Length; dev++)
{
//Has Device some signal-names in name -> This could be a mic
- if (Regex.IsMatch(Devices[dev].Name, @"Mic|Mik", RegexOptions.IgnoreCase))
+ if (Regex.IsMatch(devices[dev].Name, @"ReplacedStr:::3:::", RegexOptions.IgnoreCase))
{
//Check if there are inputs.
- if (Devices[dev].Inputs.Count >= 1)
+ if (devices[dev].Inputs.Count >= 1)
{
//Check if there is one or more channels
- if (Devices[dev].Inputs[0].Channels >= 1)
+ if (devices[dev].Inputs[0].Channels >= 1)
{
//Set this device to player 1
- MicConfig[0].DeviceName = Devices[dev].Name;
- MicConfig[0].DeviceDriver = Devices[dev].Driver;
- MicConfig[0].InputName = Devices[dev].Inputs[0].Name;
+ MicConfig[0].DeviceName = devices[dev].Name;
+ MicConfig[0].DeviceDriver = devices[dev].Driver;
+ MicConfig[0].InputName = devices[dev].Inputs[0].Name;
MicConfig[0].Channel = 1;
- if (Devices[dev].Inputs[0].Channels >= 2)
+ if (devices[dev].Inputs[0].Channels >= 2)
{
//Set this device to player 2
- MicConfig[1].DeviceName = Devices[dev].Name;
- MicConfig[1].DeviceDriver = Devices[dev].Driver;
- MicConfig[1].InputName = Devices[dev].Inputs[0].Name;
+ MicConfig[1].DeviceName = devices[dev].Name;
+ MicConfig[1].DeviceDriver = devices[dev].Driver;
+ MicConfig[1].InputName = devices[dev].Inputs[0].Name;
MicConfig[1].Channel = 2;
return true;
@@ -661,30 +661,30 @@ namespace Vocaluxe.Base
/// Parameters
public static void LoadCommandLineParams(string[] args)
{
- Regex SpliterParam = new Regex(@"-{1,2}|\/", RegexOptions.IgnoreCase);
+ Regex spliterParam = new Regex(@"ReplacedStr:::0:::", RegexOptions.IgnoreCase);
//Complete argument string
string arguments = string.Empty;
foreach (string arg in args)
arguments += arg + " ";
- args = SpliterParam.Split(arguments);
+ args = spliterParam.Split(arguments);
foreach (string text in args)
{
- Regex SpliterVal = new Regex(@"\s", RegexOptions.IgnoreCase);
+ Regex spliterVal = new Regex(@"ReplacedStr:::2:::", RegexOptions.IgnoreCase);
//Array for parts of an arg
string[] parts;
//split arg with Spilter-Regex and save in parts
- parts = SpliterVal.Split(text, 2);
+ parts = spliterVal.Split(text, 2);
switch (parts.Length)
{
//Only found a parameter
case 1:
- if (!Regex.IsMatch(parts[0], @"\s") && parts[0].Length > 0)
+ if (!Regex.IsMatch(parts[0], @"ReplacedStr:::3:::") && parts[0].Length > 0)
{
//Add parameter
_Params.Add(parts[0]);
@@ -697,7 +697,7 @@ namespace Vocaluxe.Base
//Found parameter and value
case 2:
- if (!Regex.IsMatch(parts[0], @"\s") && parts[0].Length > 0)
+ if (!Regex.IsMatch(parts[0], @"ReplacedStr:::5:::") && parts[0].Length > 0)
{
//Add parameter
_Params.Add(parts[0]);
@@ -729,24 +729,24 @@ namespace Vocaluxe.Base
{
case "configfile":
//Check if value is valid
- if (CheckFile(value))
- CSettings.sFileConfig = value;
+ if (_CheckFile(value))
+ CSettings.FileConfig = value;
break;
case "scorefile":
//Check if value is valid
- if (CheckFile(value))
- CSettings.sFileHighscoreDB = value;
+ if (_CheckFile(value))
+ CSettings.FileHighscoreDB = value;
break;
case "playlistfolder":
CSettings.CreateFolder(value);
- CSettings.sFolderPlaylists = value;
+ CSettings.FolderPlaylists = value;
break;
case "profilefolder":
CSettings.CreateFolder(value);
- CSettings.sFolderProfiles = value;
+ CSettings.FolderProfiles = value;
break;
}
}
@@ -772,10 +772,10 @@ namespace Vocaluxe.Base
case "songfolder":
case "songpath":
//Check if SongFolders from config.xml are saved
- if (SongFolderOld.Count == 0)
+ if (_SongFolderOld.Count == 0)
{
- SongFolderOld.Clear();
- SongFolderOld.AddRange(SongFolder);
+ _SongFolderOld.Clear();
+ _SongFolderOld.AddRange(SongFolder);
SongFolder.Clear();
}
//Add parameter-value to SongFolder
@@ -785,7 +785,7 @@ namespace Vocaluxe.Base
}
}
- private static bool CheckFile(string value)
+ private static bool _CheckFile(string value)
{
char[] chars = Path.GetInvalidPathChars();
for (int i = 0; i < chars.Length; i++)
diff --git a/Vocaluxe/Base/CCover.cs b/Vocaluxe/Base/CCover.cs
index 9dc14b3b..962815ae 100644
--- a/Vocaluxe/Base/CCover.cs
+++ b/Vocaluxe/Base/CCover.cs
@@ -23,7 +23,7 @@ namespace Vocaluxe.Base
abstract class CCover
{
- private static readonly XmlWriterSettings _settings = new XmlWriterSettings();
+ private static readonly XmlWriterSettings _Settings = new XmlWriterSettings();
private static readonly List _Cover = new List();
private static readonly List _CoverThemes = new List();
private static STexture _NoCover = new STexture(-1);
@@ -37,12 +37,12 @@ namespace Vocaluxe.Base
public static void Init()
{
- _settings.Indent = true;
- _settings.Encoding = Encoding.UTF8;
- _settings.ConformanceLevel = ConformanceLevel.Document;
+ _Settings.Indent = true;
+ _Settings.Encoding = Encoding.UTF8;
+ _Settings.ConformanceLevel = ConformanceLevel.Document;
- LoadCoverThemes();
- LoadCover(CConfig.CoverTheme);
+ _LoadCoverThemes();
+ _LoadCover(CConfig.CoverTheme);
}
///
@@ -52,11 +52,11 @@ namespace Vocaluxe.Base
{
get
{
- List CoverThemes = new List();
+ List coverThemes = new List();
for (int i = 0; i < _CoverThemes.Count; i++)
- CoverThemes.Add(_CoverThemes[i].Name);
+ coverThemes.Add(_CoverThemes[i].Name);
- return CoverThemes.ToArray();
+ return coverThemes.ToArray();
}
}
@@ -77,14 +77,14 @@ namespace Vocaluxe.Base
///
/// Returns a STexture for a given cover name. Returns "NoCover" if the cover does not exist.
///
- public static STexture Cover(string Name)
+ public static STexture Cover(string name)
{
STexture cov = _NoCover;
lock (_MutexCover)
{
foreach (SCover cover in _Cover)
{
- if (cover.Name == Name)
+ if (cover.Name == name)
{
cov = cover.Texture;
break;
@@ -97,14 +97,14 @@ namespace Vocaluxe.Base
///
/// Returns true if a cover with the given name exists.
///
- public static bool CoverExists(string Name)
+ public static bool CoverExists(string name)
{
STexture cov = _NoCover;
lock (_MutexCover)
{
foreach (SCover cover in _Cover)
{
- if (cover.Name == Name)
+ if (cover.Name == name)
return true;
}
}
@@ -122,13 +122,13 @@ namespace Vocaluxe.Base
CDraw.RemoveTexture(ref texture);
}
_Cover.Clear();
- LoadCover(CConfig.CoverTheme);
+ _LoadCover(CConfig.CoverTheme);
}
///
/// Returns a SCoverTheme by cover-theme-name
///
- private static SCoverTheme CoverTheme(string coverThemeName)
+ private static SCoverTheme _CoverTheme(string coverThemeName)
{
SCoverTheme coverTheme = new SCoverTheme();
for (int i = 0; i < _CoverThemes.Count; i++)
@@ -145,11 +145,11 @@ namespace Vocaluxe.Base
///
/// Loads all cover-themes to list.
///
- private static void LoadCoverThemes()
+ private static void _LoadCoverThemes()
{
_CoverThemes.Clear();
- string path = CSettings.sFolderCover;
+ string path = CSettings.FolderCover;
List files = CHelper.ListFiles(path, "*.xml", false);
foreach (string file in files)
@@ -176,15 +176,15 @@ namespace Vocaluxe.Base
///
/// Loads all cover which are defined in the cover config file.
///
- private static void LoadCover(string coverThemeName)
+ private static void _LoadCover(string coverThemeName)
{
SCoverTheme coverTheme = new SCoverTheme();
- coverTheme = CoverTheme(coverThemeName);
+ coverTheme = _CoverTheme(coverThemeName);
if (coverTheme.Name.Length > 0)
{
- CXMLReader xmlReader = CXMLReader.OpenFile(Path.Combine(CSettings.sFolderCover, coverTheme.File));
+ CXMLReader xmlReader = CXMLReader.OpenFile(Path.Combine(CSettings.FolderCover, coverTheme.File));
if (xmlReader != null)
{
@@ -201,8 +201,8 @@ namespace Vocaluxe.Base
xmlReader.GetValue("//root/Cover/" + cover[i] + "/Path", ref value, String.Empty);
sk.Name = name;
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)));
+ if (File.Exists(Path.Combine(CSettings.FolderCover, Path.Combine(coverTheme.Folder, value))))
+ sk.Texture = CDraw.AddTexture(Path.Combine(CSettings.FolderCover, Path.Combine(coverTheme.Folder, value)));
else
sk.Texture = _NoCover;
@@ -216,10 +216,10 @@ namespace Vocaluxe.Base
List files = new List();
- files.AddRange(CHelper.ListFiles(Path.Combine(CSettings.sFolderCover, coverTheme.Folder), "*.png", true, true));
- files.AddRange(CHelper.ListFiles(Path.Combine(CSettings.sFolderCover, coverTheme.Folder), "*.jpg", true, true));
- files.AddRange(CHelper.ListFiles(Path.Combine(CSettings.sFolderCover, coverTheme.Folder), "*.jpeg", true, true));
- files.AddRange(CHelper.ListFiles(Path.Combine(CSettings.sFolderCover, coverTheme.Folder), "*.bmp", true, true));
+ files.AddRange(CHelper.ListFiles(Path.Combine(CSettings.FolderCover, coverTheme.Folder), "*.png", true, true));
+ files.AddRange(CHelper.ListFiles(Path.Combine(CSettings.FolderCover, coverTheme.Folder), "*.jpg", true, true));
+ files.AddRange(CHelper.ListFiles(Path.Combine(CSettings.FolderCover, coverTheme.Folder), "*.jpeg", true, true));
+ files.AddRange(CHelper.ListFiles(Path.Combine(CSettings.FolderCover, coverTheme.Folder), "*.bmp", true, true));
foreach (string file in files)
@@ -235,7 +235,7 @@ namespace Vocaluxe.Base
sk.Name = name;
sk.Value = Path.Combine(coverTheme.Folder, Path.GetFileName(file));
- sk.Texture = CDraw.AddTexture(Path.Combine(CSettings.sFolderCover, sk.Value));
+ sk.Texture = CDraw.AddTexture(Path.Combine(CSettings.FolderCover, sk.Value));
_Cover.Add(sk);
}
diff --git a/Vocaluxe/Base/CDataBase.cs b/Vocaluxe/Base/CDataBase.cs
index a06203b4..9df5747c 100644
--- a/Vocaluxe/Base/CDataBase.cs
+++ b/Vocaluxe/Base/CDataBase.cs
@@ -25,10 +25,10 @@ namespace Vocaluxe.Base
{
private struct SData
{
- public int id;
- public long ticks;
- public string str1;
- public string str2;
+ public int Id;
+ public long Ticks;
+ public string Str1;
+ public string Str2;
}
private static string _HighscoreFilePath;
@@ -40,33 +40,33 @@ namespace Vocaluxe.Base
public static void Init()
{
- _HighscoreFilePath = Path.Combine(Environment.CurrentDirectory, CSettings.sFileHighscoreDB);
- _CoverFilePath = Path.Combine(Environment.CurrentDirectory, CSettings.sFileCoverDB);
- _CreditsRessourcesFilePath = Path.Combine(Environment.CurrentDirectory, CSettings.sFileCreditsRessourcesDB);
+ _HighscoreFilePath = Path.Combine(Environment.CurrentDirectory, CSettings.FileHighscoreDB);
+ _CoverFilePath = Path.Combine(Environment.CurrentDirectory, CSettings.FileCoverDB);
+ _CreditsRessourcesFilePath = Path.Combine(Environment.CurrentDirectory, CSettings.FileCreditsRessourcesDB);
- InitHighscoreDB();
- InitCoverDB();
- InitCreditsRessourcesDB();
+ _InitHighscoreDB();
+ _InitCoverDB();
+ _InitCreditsRessourcesDB();
GC.Collect();
}
#region Highscores
- public static int AddScore(string PlayerName, int Score, int LineNr, long Date, int Medley, int Duet, int ShortSong, int Diff,
- string Artist, string Title, int NumPlayed, string FilePath)
+ public static int AddScore(string playerName, int score, int lineNr, long date, int medley, int duet, int shortSong, int diff,
+ string artist, string title, int numPlayed, string filePath)
{
SPlayer player = new SPlayer();
- player.Name = PlayerName;
- player.Points = Score;
- player.LineNr = LineNr;
- player.DateTicks = Date;
- player.Medley = Medley == 1;
- player.Duet = Duet == 1;
- player.ShortSong = ShortSong == 1;
- player.Difficulty = (EGameDifficulty)Diff;
+ player.Name = playerName;
+ player.Points = score;
+ player.LineNr = lineNr;
+ player.DateTicks = date;
+ player.Medley = medley == 1;
+ player.Duet = duet == 1;
+ player.ShortSong = shortSong == 1;
+ player.Difficulty = (EGameDifficulty)diff;
using (SQLiteConnection connection = new SQLiteConnection())
{
- connection.ConnectionString = "Data Source=" + FilePath;
+ connection.ConnectionString = "Data Source=" + filePath;
try
{
@@ -79,8 +79,8 @@ namespace Vocaluxe.Base
using (SQLiteCommand command = new SQLiteCommand(connection))
{
- int DataBaseSongID = GetDataBaseSongID(Artist, Title, NumPlayed, command);
- int result = AddScore(player, command, DataBaseSongID);
+ int dataBaseSongID = _GetDataBaseSongID(artist, title, numPlayed, command);
+ int result = _AddScore(player, command, dataBaseSongID);
return result;
}
}
@@ -103,42 +103,42 @@ namespace Vocaluxe.Base
using (SQLiteCommand command = new SQLiteCommand(connection))
{
- int DataBaseSongID = GetDataBaseSongID(player, command);
- int result = AddScore(player, command, DataBaseSongID);
+ int dataBaseSongID = _GetDataBaseSongID(player, command);
+ int result = _AddScore(player, command, dataBaseSongID);
return result;
}
}
}
- private static int AddScore(SPlayer player, SQLiteCommand command, int DataBaseSongID)
+ private static int _AddScore(SPlayer player, SQLiteCommand command, int dataBaseSongID)
{
int lastInsertID = -1;
- if (DataBaseSongID >= 0)
+ if (dataBaseSongID >= 0)
{
- int Medley = 0;
+ int medley = 0;
if (player.Medley)
- Medley = 1;
+ medley = 1;
- int Duet = 0;
+ int duet = 0;
if (player.Duet)
- Duet = 1;
+ duet = 1;
- int ShortSong = 0;
+ int shortSong = 0;
if (player.ShortSong)
- ShortSong = 1;
+ shortSong = 1;
command.CommandText = "SELECT id FROM Scores WHERE SongID = @SongID AND PlayerName = @PlayerName AND Score = @Score AND " +
"LineNr = @LineNr AND Date = @Date AND Medley = @Medley AND Duet = @Duet AND ShortSong = @ShortSong AND Difficulty = @Difficulty";
- command.Parameters.Add("@SongID", DbType.Int32, 0).Value = DataBaseSongID;
+ command.Parameters.Add("@SongID", DbType.Int32, 0).Value = dataBaseSongID;
command.Parameters.Add("@PlayerName", DbType.String, 0).Value = player.Name;
command.Parameters.Add("@Score", DbType.Int32, 0).Value = (int)Math.Round(player.Points);
command.Parameters.Add("@LineNr", DbType.Int32, 0).Value = player.LineNr;
command.Parameters.Add("@Date", DbType.Int64, 0).Value = player.DateTicks;
- command.Parameters.Add("@Medley", DbType.Int32, 0).Value = Medley;
- command.Parameters.Add("@Duet", DbType.Int32, 0).Value = Duet;
- command.Parameters.Add("@ShortSong", DbType.Int32, 0).Value = ShortSong;
+ command.Parameters.Add("@Medley", DbType.Int32, 0).Value = medley;
+ command.Parameters.Add("@Duet", DbType.Int32, 0).Value = duet;
+ command.Parameters.Add("@ShortSong", DbType.Int32, 0).Value = shortSong;
command.Parameters.Add("@Difficulty", DbType.Int32, 0).Value = (int)player.Difficulty;
SQLiteDataReader reader = null;
@@ -162,14 +162,14 @@ namespace Vocaluxe.Base
command.CommandText = "INSERT INTO Scores (SongID, PlayerName, Score, LineNr, Date, Medley, Duet, ShortSong, Difficulty) " +
"VALUES (@SongID, @PlayerName, @Score, @LineNr, @Date, @Medley, @Duet, @ShortSong, @Difficulty)";
- command.Parameters.Add("@SongID", DbType.Int32, 0).Value = DataBaseSongID;
+ command.Parameters.Add("@SongID", DbType.Int32, 0).Value = dataBaseSongID;
command.Parameters.Add("@PlayerName", DbType.String, 0).Value = player.Name;
command.Parameters.Add("@Score", DbType.Int32, 0).Value = (int)Math.Round(player.Points);
command.Parameters.Add("@LineNr", DbType.Int32, 0).Value = player.LineNr;
command.Parameters.Add("@Date", DbType.Int64, 0).Value = player.DateTicks;
- command.Parameters.Add("@Medley", DbType.Int32, 0).Value = Medley;
- command.Parameters.Add("@Duet", DbType.Int32, 0).Value = Duet;
- command.Parameters.Add("@ShortSong", DbType.Int32, 0).Value = ShortSong;
+ command.Parameters.Add("@Medley", DbType.Int32, 0).Value = medley;
+ command.Parameters.Add("@Duet", DbType.Int32, 0).Value = duet;
+ command.Parameters.Add("@ShortSong", DbType.Int32, 0).Value = shortSong;
command.Parameters.Add("@Difficulty", DbType.Int32, 0).Value = (int)player.Difficulty;
command.ExecuteNonQuery();
@@ -189,13 +189,13 @@ namespace Vocaluxe.Base
return lastInsertID;
}
- public static void LoadScore(ref List Score, SPlayer player)
+ public static void LoadScore(ref List scores, SPlayer player)
{
using (SQLiteConnection connection = new SQLiteConnection())
{
connection.ConnectionString = "Data Source=" + _HighscoreFilePath;
- Score = new List();
+ scores = new List();
try
{
@@ -208,28 +208,28 @@ namespace Vocaluxe.Base
using (SQLiteCommand command = new SQLiteCommand(connection))
{
- int Medley = 0;
+ int medley = 0;
if (player.Medley)
- Medley = 1;
+ medley = 1;
- int Duet = 0;
+ int duet = 0;
if (player.Duet)
- Duet = 1;
+ duet = 1;
- int ShortSong = 0;
+ int shortSong = 0;
if (player.ShortSong)
- ShortSong = 1;
+ shortSong = 1;
- int DataBaseSongID = GetDataBaseSongID(player, command);
- if (DataBaseSongID >= 0)
+ int dataBaseSongID = _GetDataBaseSongID(player, command);
+ if (dataBaseSongID >= 0)
{
command.CommandText = "SELECT PlayerName, Score, Date, Difficulty, LineNr, id FROM Scores " +
"WHERE [SongID] = @SongID AND [Medley] = @Medley AND [Duet] = @Duet AND [ShortSong] = @ShortSong " +
"ORDER BY [Score] DESC";
- command.Parameters.Add("@SongID", DbType.Int32, 0).Value = DataBaseSongID;
- command.Parameters.Add("@Medley", DbType.Int32, 0).Value = Medley;
- command.Parameters.Add("@Duet", DbType.Int32, 0).Value = Duet;
- command.Parameters.Add("@ShortSong", DbType.Int32, 0).Value = ShortSong;
+ command.Parameters.Add("@SongID", DbType.Int32, 0).Value = dataBaseSongID;
+ command.Parameters.Add("@Medley", DbType.Int32, 0).Value = medley;
+ command.Parameters.Add("@Duet", DbType.Int32, 0).Value = duet;
+ command.Parameters.Add("@ShortSong", DbType.Int32, 0).Value = shortSong;
SQLiteDataReader reader = command.ExecuteReader();
if (reader != null && reader.HasRows)
@@ -244,7 +244,7 @@ namespace Vocaluxe.Base
score.LineNr = reader.GetInt32(4);
score.ID = reader.GetInt32(5);
- Score.Add(score);
+ scores.Add(score);
}
reader.Dispose();
}
@@ -253,21 +253,21 @@ namespace Vocaluxe.Base
}
}
- private static int GetDataBaseSongID(SPlayer player, SQLiteCommand command)
+ private static int _GetDataBaseSongID(SPlayer player, SQLiteCommand command)
{
CSong song = CSongs.GetSong(player.SongID);
if (song == null)
return -1;
- return GetDataBaseSongID(song.Artist, song.Title, 0, command);
+ return _GetDataBaseSongID(song.Artist, song.Title, 0, command);
}
- private static int GetDataBaseSongID(string Artist, string Title, string FilePath, int DefNumPlayed)
+ private static int _GetDataBaseSongID(string artist, string title, string filePath, int defNumPlayed)
{
using (SQLiteConnection connection = new SQLiteConnection())
{
- connection.ConnectionString = "Data Source=" + FilePath;
+ connection.ConnectionString = "Data Source=" + filePath;
try
{
@@ -279,15 +279,15 @@ namespace Vocaluxe.Base
}
using (SQLiteCommand command = new SQLiteCommand(connection))
- return GetDataBaseSongID(Artist, Title, DefNumPlayed, command);
+ return _GetDataBaseSongID(artist, title, defNumPlayed, command);
}
}
- private static int GetDataBaseSongID(string Artist, string Title, int DefNumPlayed, SQLiteCommand command)
+ private static int _GetDataBaseSongID(string artist, string title, int defNumPlayed, SQLiteCommand command)
{
command.CommandText = "SELECT id FROM Songs WHERE [Title] = @title AND [Artist] = @artist";
- command.Parameters.Add("@title", DbType.String, 0).Value = Title;
- command.Parameters.Add("@artist", DbType.String, 0).Value = Artist;
+ command.Parameters.Add("@title", DbType.String, 0).Value = title;
+ command.Parameters.Add("@artist", DbType.String, 0).Value = artist;
SQLiteDataReader reader = command.ExecuteReader();
@@ -305,14 +305,14 @@ namespace Vocaluxe.Base
command.CommandText = "INSERT INTO Songs (Title, Artist, NumPlayed) " +
"VALUES (@title, @artist, @numplayed)";
- command.Parameters.Add("@title", DbType.String, 0).Value = Title;
- command.Parameters.Add("@artist", DbType.String, 0).Value = Artist;
- command.Parameters.Add("@numplayed", DbType.Int32, 0).Value = DefNumPlayed;
+ command.Parameters.Add("@title", DbType.String, 0).Value = title;
+ command.Parameters.Add("@artist", DbType.String, 0).Value = artist;
+ command.Parameters.Add("@numplayed", DbType.Int32, 0).Value = defNumPlayed;
command.ExecuteNonQuery();
command.CommandText = "SELECT id FROM Songs WHERE [Title] = @title AND [Artist] = @artist";
- command.Parameters.Add("@title", DbType.String, 0).Value = Title;
- command.Parameters.Add("@artist", DbType.String, 0).Value = Artist;
+ command.Parameters.Add("@title", DbType.String, 0).Value = title;
+ command.Parameters.Add("@artist", DbType.String, 0).Value = artist;
reader = command.ExecuteReader();
@@ -331,15 +331,15 @@ namespace Vocaluxe.Base
return -1;
}
- private static bool GetDataBaseSongInfos(int SongID, out string Artist, out string Title, out int NumPlayed, string FilePath)
+ private static bool _GetDataBaseSongInfos(int songID, out string artist, out string title, out int numPlayed, string filePath)
{
- Artist = String.Empty;
- Title = String.Empty;
- NumPlayed = 0;
+ artist = String.Empty;
+ title = String.Empty;
+ numPlayed = 0;
using (SQLiteConnection connection = new SQLiteConnection())
{
- connection.ConnectionString = "Data Source=" + FilePath;
+ connection.ConnectionString = "Data Source=" + filePath;
try
{
@@ -353,7 +353,7 @@ namespace Vocaluxe.Base
using (SQLiteCommand command = new SQLiteCommand(connection))
{
command.CommandText = "SELECT Artist, Title, NumPlayed FROM Songs WHERE [id] = @id";
- command.Parameters.Add("@id", DbType.String, 0).Value = SongID;
+ command.Parameters.Add("@id", DbType.String, 0).Value = songID;
SQLiteDataReader reader = null;
try
@@ -368,9 +368,9 @@ namespace Vocaluxe.Base
if (reader != null && reader.HasRows)
{
reader.Read();
- Artist = reader.GetString(0);
- Title = reader.GetString(1);
- NumPlayed = reader.GetInt32(2);
+ artist = reader.GetString(0);
+ title = reader.GetString(1);
+ numPlayed = reader.GetInt32(2);
reader.Dispose();
return true;
}
@@ -382,35 +382,35 @@ namespace Vocaluxe.Base
return false;
}
- private static void InitHighscoreDB()
+ private static void _InitHighscoreDB()
{
- string OldDBFilePath = Path.Combine(Environment.CurrentDirectory, CSettings.sFileOldHighscoreDB);
- if (File.Exists(OldDBFilePath))
+ string oldDBFilePath = Path.Combine(Environment.CurrentDirectory, CSettings.FileOldHighscoreDB);
+ if (File.Exists(oldDBFilePath))
{
if (File.Exists(_HighscoreFilePath))
{
- CreateOrConvert(OldDBFilePath);
- CreateOrConvert(_HighscoreFilePath);
- ImportData(OldDBFilePath, _HighscoreFilePath);
+ _CreateOrConvert(oldDBFilePath);
+ _CreateOrConvert(_HighscoreFilePath);
+ _ImportData(oldDBFilePath, _HighscoreFilePath);
- File.Delete(OldDBFilePath);
+ File.Delete(oldDBFilePath);
}
else
{
- File.Copy(OldDBFilePath, _HighscoreFilePath);
- CreateOrConvert(_HighscoreFilePath);
- File.Delete(OldDBFilePath);
+ File.Copy(oldDBFilePath, _HighscoreFilePath);
+ _CreateOrConvert(_HighscoreFilePath);
+ File.Delete(oldDBFilePath);
}
}
else
- CreateOrConvert(_HighscoreFilePath);
+ _CreateOrConvert(_HighscoreFilePath);
}
- private static void CreateHighscoreDB(string FilePath)
+ private static void _CreateHighscoreDB(string filePath)
{
using (SQLiteConnection connection = new SQLiteConnection())
{
- connection.ConnectionString = "Data Source=" + FilePath;
+ connection.ConnectionString = "Data Source=" + filePath;
try
{
@@ -427,7 +427,7 @@ namespace Vocaluxe.Base
command.ExecuteNonQuery();
command.CommandText = "INSERT INTO Version (id, Value) VALUES(NULL, @Value)";
- command.Parameters.Add("@Value", DbType.Int32).Value = CSettings.iDatabaseHighscoreVersion;
+ command.Parameters.Add("@Value", DbType.Int32).Value = CSettings.DatabaseHighscoreVersion;
command.ExecuteNonQuery();
command.CommandText = "CREATE TABLE IF NOT EXISTS Songs ( id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, " +
@@ -442,11 +442,11 @@ namespace Vocaluxe.Base
}
}
- private static void CreateHighscoreDBV1(string FilePath)
+ private static void _CreateHighscoreDBV1(string filePath)
{
using (SQLiteConnection connection = new SQLiteConnection())
{
- connection.ConnectionString = "Data Source=" + FilePath;
+ connection.ConnectionString = "Data Source=" + filePath;
try
{
@@ -480,13 +480,13 @@ namespace Vocaluxe.Base
///
/// Creates a new Vocaluxe Database if no file exists. Converts an existing old Ultrastar Deluxe highscore database into vocaluxe format.
///
- /// Database file path
+ /// Database file path
///
- private static bool CreateOrConvert(string FilePath)
+ private static bool _CreateOrConvert(string filePath)
{
using (SQLiteConnection connection = new SQLiteConnection())
{
- connection.ConnectionString = "Data Source=" + FilePath;
+ connection.ConnectionString = "Data Source=" + filePath;
try
{
@@ -531,19 +531,19 @@ namespace Vocaluxe.Base
if (version == 1)
{
//Check for USDX 1.1 DB
- CreateHighscoreDBV1(FilePath);
- ConvertFrom110(FilePath);
- UpdateDatabase(1, connection);
+ _CreateHighscoreDBV1(filePath);
+ _ConvertFrom110(filePath);
+ _UpdateDatabase(1, connection);
}
else if (version == 0 && scoresTableExists)
{
//Check for USDX 1.01 or CMD Mod DB
- CreateHighscoreDBV1(FilePath);
- ConvertFrom101(FilePath);
- UpdateDatabase(1, connection);
+ _CreateHighscoreDBV1(filePath);
+ _ConvertFrom101(filePath);
+ _UpdateDatabase(1, connection);
}
else
- CreateHighscoreDB(FilePath);
+ _CreateHighscoreDB(filePath);
}
else if (reader.FieldCount == 0)
{
@@ -551,28 +551,28 @@ namespace Vocaluxe.Base
if (version == 1)
{
//Check for USDX 1.1 DB
- CreateHighscoreDBV1(FilePath);
- ConvertFrom110(FilePath);
- UpdateDatabase(1, connection);
+ _CreateHighscoreDBV1(filePath);
+ _ConvertFrom110(filePath);
+ _UpdateDatabase(1, connection);
}
else if (version == 0 && scoresTableExists)
{
//Check for USDX 1.01 or CMD Mod DB
- CreateHighscoreDBV1(FilePath);
- ConvertFrom101(FilePath);
- UpdateDatabase(1, connection);
+ _CreateHighscoreDBV1(filePath);
+ _ConvertFrom101(filePath);
+ _UpdateDatabase(1, connection);
}
else
- CreateHighscoreDB(FilePath);
+ _CreateHighscoreDB(filePath);
}
else
{
reader.Read();
- int CurrentVersion = reader.GetInt32(0);
- if (CurrentVersion < CSettings.iDatabaseHighscoreVersion)
+ int currentVersion = reader.GetInt32(0);
+ if (currentVersion < CSettings.DatabaseHighscoreVersion)
{
// update database
- UpdateDatabase(CurrentVersion, connection);
+ _UpdateDatabase(currentVersion, connection);
}
}
@@ -587,13 +587,13 @@ namespace Vocaluxe.Base
///
/// Converts a USDX 1.1 database into the Vocaluxe format
///
- /// Database file path
+ /// Database file path
/// True if succeeded
- private static bool ConvertFrom110(string FilePath)
+ private static bool _ConvertFrom110(string filePath)
{
using (SQLiteConnection connection = new SQLiteConnection())
{
- connection.ConnectionString = "Data Source=" + FilePath;
+ connection.ConnectionString = "Data Source=" + filePath;
try
{
@@ -633,8 +633,8 @@ namespace Vocaluxe.Base
while (reader.Read())
{
SData data = new SData();
- data.id = reader.GetInt32(0);
- data.str1 = reader.GetString(1);
+ data.Id = reader.GetInt32(0);
+ data.Str1 = reader.GetString(1);
Int64 ticks = 0;
try
@@ -643,7 +643,7 @@ namespace Vocaluxe.Base
}
catch {}
- data.ticks = UnixTimeToTicks((int)ticks);
+ data.Ticks = _UnixTimeToTicks((int)ticks);
scores.Add(data);
}
@@ -659,9 +659,9 @@ namespace Vocaluxe.Base
while (reader.Read())
{
SData data = new SData();
- data.id = reader.GetInt32(0);
- data.str1 = reader.GetString(1);
- data.str2 = reader.GetString(2);
+ data.Id = reader.GetInt32(0);
+ data.Str1 = reader.GetString(1);
+ data.Str2 = reader.GetString(2);
songs.Add(data);
}
}
@@ -669,14 +669,14 @@ namespace Vocaluxe.Base
if (reader != null)
reader.Dispose();
- SQLiteTransaction _Transaction = connection.BeginTransaction();
+ SQLiteTransaction transaction = connection.BeginTransaction();
// update Title and Artist strings
foreach (SData data in songs)
{
command.CommandText = "UPDATE Songs SET [Artist] = @artist, [Title] = @title WHERE [ID] = @id";
- command.Parameters.Add("@title", DbType.String, 0).Value = data.str2;
- command.Parameters.Add("@artist", DbType.String, 0).Value = data.str1;
- command.Parameters.Add("@id", DbType.Int32, 0).Value = data.id;
+ command.Parameters.Add("@title", DbType.String, 0).Value = data.Str2;
+ command.Parameters.Add("@artist", DbType.String, 0).Value = data.Str1;
+ command.Parameters.Add("@id", DbType.Int32, 0).Value = data.Id;
command.ExecuteNonQuery();
}
@@ -684,12 +684,12 @@ namespace Vocaluxe.Base
foreach (SData data in scores)
{
command.CommandText = "UPDATE Scores SET [PlayerName] = @player, [Date] = @date WHERE [id] = @id";
- command.Parameters.Add("@player", DbType.String, 0).Value = data.str1;
- command.Parameters.Add("@date", DbType.Int64, 0).Value = data.ticks;
- command.Parameters.Add("@id", DbType.Int32, 0).Value = data.id;
+ command.Parameters.Add("@player", DbType.String, 0).Value = data.Str1;
+ command.Parameters.Add("@date", DbType.Int64, 0).Value = data.Ticks;
+ command.Parameters.Add("@id", DbType.Int32, 0).Value = data.Id;
command.ExecuteNonQuery();
}
- _Transaction.Commit();
+ transaction.Commit();
//Delete old tables after conversion
command.CommandText = "DROP TABLE US_Scores;";
@@ -713,13 +713,13 @@ namespace Vocaluxe.Base
///
/// Converts a USDX 1.01 or CMD 1.01 database to Vocaluxe format
///
- /// Database file path
+ /// Database file path
/// True if succeeded
- private static bool ConvertFrom101(string FilePath)
+ private static bool _ConvertFrom101(string filePath)
{
using (SQLiteConnection connection = new SQLiteConnection())
{
- connection.ConnectionString = "Data Source=" + FilePath;
+ connection.ConnectionString = "Data Source=" + filePath;
try
{
@@ -772,93 +772,93 @@ namespace Vocaluxe.Base
List scores = new List();
List songs = new List();
- Sqlite3.sqlite3 OldDB;
- int res = Sqlite3.sqlite3_open(FilePath, out OldDB);
+ Sqlite3.sqlite3 oldDB;
+ int res = Sqlite3.sqlite3_open(filePath, out oldDB);
if (res != Sqlite3.SQLITE_OK)
- CLog.LogError("Error opening Database: " + FilePath + " (" + Sqlite3.sqlite3_errmsg(OldDB) + ")");
+ CLog.LogError("Error opening Database: " + filePath + " (" + Sqlite3.sqlite3_errmsg(oldDB) + ")");
else
{
- Sqlite3.Vdbe Stmt = new Sqlite3.Vdbe();
- res = Sqlite3.sqlite3_prepare_v2(OldDB, "SELECT id, Artist, Title FROM Songs", -1, ref Stmt, 0);
+ Sqlite3.Vdbe stmt = new Sqlite3.Vdbe();
+ res = Sqlite3.sqlite3_prepare_v2(oldDB, "SELECT id, Artist, Title FROM Songs", -1, ref stmt, 0);
if (res != Sqlite3.SQLITE_OK)
- CLog.LogError("Error query Database: " + FilePath + " (" + Sqlite3.sqlite3_errmsg(OldDB) + ")");
+ CLog.LogError("Error query Database: " + filePath + " (" + Sqlite3.sqlite3_errmsg(oldDB) + ")");
else
{
//Sqlite3.sqlite3_step(Stmt);
- Encoding UTF8 = Encoding.UTF8;
- Encoding CP1252 = Encoding.GetEncoding(1252);
+ Encoding utf8 = Encoding.UTF8;
+ Encoding cp1252 = Encoding.GetEncoding(1252);
- while (Sqlite3.sqlite3_step(Stmt) == Sqlite3.SQLITE_ROW)
+ while (Sqlite3.sqlite3_step(stmt) == Sqlite3.SQLITE_ROW)
{
SData data = new SData();
- data.id = Sqlite3.sqlite3_column_int(Stmt, 0);
+ data.Id = Sqlite3.sqlite3_column_int(stmt, 0);
- byte[] bytes = Sqlite3.sqlite3_column_rawbytes(Stmt, 1);
+ byte[] bytes = Sqlite3.sqlite3_column_rawbytes(stmt, 1);
if (bytes != null)
- data.str1 = UTF8.GetString(Encoding.Convert(CP1252, UTF8, bytes));
+ data.Str1 = utf8.GetString(Encoding.Convert(cp1252, utf8, bytes));
else
- data.str1 = "Someone";
+ data.Str1 = "Someone";
- bytes = Sqlite3.sqlite3_column_rawbytes(Stmt, 2);
+ bytes = Sqlite3.sqlite3_column_rawbytes(stmt, 2);
if (bytes != null)
- data.str2 = UTF8.GetString(Encoding.Convert(CP1252, UTF8, bytes));
+ data.Str2 = utf8.GetString(Encoding.Convert(cp1252, utf8, bytes));
else
- data.str2 = "Someone";
+ data.Str2 = "Someone";
songs.Add(data);
}
- Sqlite3.sqlite3_finalize(Stmt);
+ Sqlite3.sqlite3_finalize(stmt);
}
- Stmt = new Sqlite3.Vdbe();
+ stmt = new Sqlite3.Vdbe();
if (!dateExists)
- res = Sqlite3.sqlite3_prepare_v2(OldDB, "SELECT id, PlayerName FROM Scores", -1, ref Stmt, 0);
+ res = Sqlite3.sqlite3_prepare_v2(oldDB, "SELECT id, PlayerName FROM Scores", -1, ref stmt, 0);
else
- res = Sqlite3.sqlite3_prepare_v2(OldDB, "SELECT id, PlayerName, Date FROM Scores", -1, ref Stmt, 0);
+ res = Sqlite3.sqlite3_prepare_v2(oldDB, "SELECT id, PlayerName, Date FROM Scores", -1, ref stmt, 0);
if (res != Sqlite3.SQLITE_OK)
- CLog.LogError("Error query Database: " + FilePath + " (" + Sqlite3.sqlite3_errmsg(OldDB) + ")");
+ CLog.LogError("Error query Database: " + filePath + " (" + Sqlite3.sqlite3_errmsg(oldDB) + ")");
else
{
//Sqlite3.sqlite3_step(Stmt);
- Encoding UTF8 = Encoding.UTF8;
- Encoding CP1252 = Encoding.GetEncoding(1252);
+ Encoding utf8 = Encoding.UTF8;
+ Encoding cp1252 = Encoding.GetEncoding(1252);
- while (Sqlite3.sqlite3_step(Stmt) == Sqlite3.SQLITE_ROW)
+ while (Sqlite3.sqlite3_step(stmt) == Sqlite3.SQLITE_ROW)
{
SData data = new SData();
- data.id = Sqlite3.sqlite3_column_int(Stmt, 0);
+ data.Id = Sqlite3.sqlite3_column_int(stmt, 0);
- byte[] bytes = Sqlite3.sqlite3_column_rawbytes(Stmt, 1);
+ byte[] bytes = Sqlite3.sqlite3_column_rawbytes(stmt, 1);
if (bytes != null)
- data.str1 = UTF8.GetString(Encoding.Convert(CP1252, UTF8, bytes));
+ data.Str1 = utf8.GetString(Encoding.Convert(cp1252, utf8, bytes));
else
- data.str1 = "Someone";
+ data.Str1 = "Someone";
if (dateExists)
- data.ticks = UnixTimeToTicks(Sqlite3.sqlite3_column_int(Stmt, 2));
+ data.Ticks = _UnixTimeToTicks(Sqlite3.sqlite3_column_int(stmt, 2));
scores.Add(data);
}
- Sqlite3.sqlite3_finalize(Stmt);
+ Sqlite3.sqlite3_finalize(stmt);
}
}
- Sqlite3.sqlite3_close(OldDB);
+ Sqlite3.sqlite3_close(oldDB);
- SQLiteTransaction _Transaction = connection.BeginTransaction();
+ SQLiteTransaction transaction = connection.BeginTransaction();
// update Title and Artist strings
foreach (SData data in songs)
{
command.CommandText = "UPDATE Songs SET [Artist] = @artist, [Title] = @title WHERE [ID] = @id";
- command.Parameters.Add("@title", DbType.String, 0).Value = data.str2;
- command.Parameters.Add("@artist", DbType.String, 0).Value = data.str1;
- command.Parameters.Add("@id", DbType.Int32, 0).Value = data.id;
+ command.Parameters.Add("@title", DbType.String, 0).Value = data.Str2;
+ command.Parameters.Add("@artist", DbType.String, 0).Value = data.Str1;
+ command.Parameters.Add("@id", DbType.Int32, 0).Value = data.Id;
command.ExecuteNonQuery();
}
@@ -870,13 +870,13 @@ namespace Vocaluxe.Base
else
{
command.CommandText = "UPDATE Scores SET [PlayerName] = @player, [Date] = @date WHERE [id] = @id";
- command.Parameters.Add("@date", DbType.Int64, 0).Value = data.ticks;
+ command.Parameters.Add("@date", DbType.Int64, 0).Value = data.Ticks;
}
- command.Parameters.Add("@player", DbType.String, 0).Value = data.str1;
- command.Parameters.Add("@id", DbType.Int32, 0).Value = data.id;
+ command.Parameters.Add("@player", DbType.String, 0).Value = data.Str1;
+ command.Parameters.Add("@id", DbType.Int32, 0).Value = data.Id;
command.ExecuteNonQuery();
}
- _Transaction.Commit();
+ transaction.Commit();
//Delete old tables after conversion
command.CommandText = "DROP TABLE US_Scores;";
@@ -890,15 +890,15 @@ namespace Vocaluxe.Base
return true;
}
- private static bool UpdateDatabase(int CurrentVersion, SQLiteConnection connection)
+ private static bool _UpdateDatabase(int currentVersion, SQLiteConnection connection)
{
bool updated = true;
- if (CurrentVersion < 2)
- updated &= ConvertV1toV2(connection);
+ if (currentVersion < 2)
+ updated &= _ConvertV1toV2(connection);
return updated;
}
- private static bool ConvertV1toV2(SQLiteConnection connection)
+ private static bool _ConvertV1toV2(SQLiteConnection connection)
{
using (SQLiteCommand command = new SQLiteCommand(connection))
{
@@ -915,12 +915,12 @@ namespace Vocaluxe.Base
return true;
}
- private static bool ImportData(string SourceDBPath, string DestinationDBPath)
+ private static bool _ImportData(string sourceDBPath, string destinationDBPath)
{
#region open db
using (SQLiteConnection connSource = new SQLiteConnection())
{
- connSource.ConnectionString = "Data Source=" + SourceDBPath;
+ connSource.ConnectionString = "Data Source=" + sourceDBPath;
try
{
@@ -928,47 +928,47 @@ namespace Vocaluxe.Base
}
catch (Exception e)
{
- CLog.LogError("Error on import high score data. Can't open source database \"" + SourceDBPath + "\" (" + e.Message + ")");
+ CLog.LogError("Error on import high score data. Can't open source database \"" + sourceDBPath + "\" (" + e.Message + ")");
return false;
}
#endregion open db
using (SQLiteCommand cmdSource = new SQLiteCommand(connSource))
{
- SQLiteDataReader rSource;
+ SQLiteDataReader source;
#region import table scores
cmdSource.CommandText = "SELECT SongID, PlayerName, Score, LineNr, Date, Medley, Duet, ShortSong, Difficulty FROM Scores";
- rSource = cmdSource.ExecuteReader();
- if (rSource == null)
+ source = cmdSource.ExecuteReader();
+ if (source == null)
return false;
- if (rSource.FieldCount == 0)
+ if (source.FieldCount == 0)
{
- rSource.Close();
+ source.Close();
return true;
}
- while (rSource.Read())
+ while (source.Read())
{
- int songid = rSource.GetInt32(0);
- string player = rSource.GetString(1);
- int score = rSource.GetInt32(2);
- int linenr = rSource.GetInt32(3);
- long date = rSource.GetInt64(4);
- int medley = rSource.GetInt32(5);
- int duet = rSource.GetInt32(6);
- int shortsong = rSource.GetInt32(7);
- int diff = rSource.GetInt32(8);
+ int songid = source.GetInt32(0);
+ string player = source.GetString(1);
+ int score = source.GetInt32(2);
+ int linenr = source.GetInt32(3);
+ long date = source.GetInt64(4);
+ int medley = source.GetInt32(5);
+ int duet = source.GetInt32(6);
+ int shortsong = source.GetInt32(7);
+ int diff = source.GetInt32(8);
string artist, title;
int numplayed;
- if (GetDataBaseSongInfos(songid, out artist, out title, out numplayed, SourceDBPath))
+ if (_GetDataBaseSongInfos(songid, out artist, out title, out numplayed, sourceDBPath))
AddScore(player, score, linenr, date, medley, duet, shortsong, diff, artist, title, numplayed, _HighscoreFilePath);
}
#endregion import table scores
- rSource.Close();
+ source.Close();
}
}
@@ -977,11 +977,11 @@ namespace Vocaluxe.Base
#endregion Highscores
#region Cover
- public static bool GetCover(string CoverPath, ref STexture tex, int MaxSize)
+ public static bool GetCover(string coverPath, ref STexture tex, int maxSize)
{
- if (!File.Exists(CoverPath))
+ if (!File.Exists(coverPath))
{
- CLog.LogError("Can't find File: " + CoverPath);
+ CLog.LogError("Can't find File: " + coverPath);
return false;
}
@@ -995,7 +995,7 @@ namespace Vocaluxe.Base
using (SQLiteCommand command = new SQLiteCommand(_ConnectionCover))
{
command.CommandText = "SELECT id, width, height FROM Cover WHERE [Path] = @path";
- command.Parameters.Add("@path", DbType.String, 0).Value = CoverPath;
+ command.Parameters.Add("@path", DbType.String, 0).Value = coverPath;
SQLiteDataReader reader = command.ExecuteReader();
@@ -1014,7 +1014,7 @@ namespace Vocaluxe.Base
if (reader.HasRows)
{
reader.Read();
- byte[] data = GetBytes(reader);
+ byte[] data = _GetBytes(reader);
reader.Dispose();
tex = CDraw.QuequeTexture(w, h, ref data);
return true;
@@ -1031,16 +1031,16 @@ namespace Vocaluxe.Base
Bitmap origin;
try
{
- origin = new Bitmap(CoverPath);
+ origin = new Bitmap(coverPath);
}
catch (Exception)
{
- CLog.LogError("Error loading Texture: " + CoverPath);
+ CLog.LogError("Error loading Texture: " + coverPath);
return false;
}
- int w = MaxSize;
- int h = MaxSize;
+ int w = maxSize;
+ int h = maxSize;
byte[] data;
try
@@ -1056,9 +1056,9 @@ namespace Vocaluxe.Base
g.DrawImage(origin, new Rectangle(0, 0, w, h));
data = new byte[w * h * 4];
- BitmapData bmp_data = bmp.LockBits(new Rectangle(0, 0, bmp.Width, bmp.Height), ImageLockMode.ReadOnly, PixelFormat.Format32bppArgb);
- Marshal.Copy(bmp_data.Scan0, data, 0, w * h * 4);
- bmp.UnlockBits(bmp_data);
+ BitmapData bmpData = bmp.LockBits(new Rectangle(0, 0, bmp.Width, bmp.Height), ImageLockMode.ReadOnly, PixelFormat.Format32bppArgb);
+ Marshal.Copy(bmpData.Scan0, data, 0, w * h * 4);
+ bmp.UnlockBits(bmpData);
}
}
finally
@@ -1071,11 +1071,11 @@ namespace Vocaluxe.Base
command.CommandText = "INSERT INTO Cover (Path, width, height) VALUES (@path, @w, @h)";
command.Parameters.Add("@w", DbType.Int32).Value = w;
command.Parameters.Add("@h", DbType.Int32).Value = h;
- command.Parameters.Add("@path", DbType.String, 0).Value = CoverPath;
+ command.Parameters.Add("@path", DbType.String, 0).Value = coverPath;
command.ExecuteNonQuery();
command.CommandText = "SELECT id FROM Cover WHERE [Path] = @path";
- command.Parameters.Add("@path", DbType.String, 0).Value = CoverPath;
+ command.Parameters.Add("@path", DbType.String, 0).Value = coverPath;
reader = command.ExecuteReader();
if (reader != null)
@@ -1117,7 +1117,7 @@ namespace Vocaluxe.Base
}
}
- private static bool InitCoverDB()
+ private static bool _InitCoverDB()
{
using (SQLiteConnection connection = new SQLiteConnection())
{
@@ -1147,18 +1147,18 @@ namespace Vocaluxe.Base
if (reader == null)
{
// create new database/tables
- CreateCoverDB();
+ _CreateCoverDB();
}
else if (reader.FieldCount == 0)
{
// create new database/tables
- CreateCoverDB();
+ _CreateCoverDB();
}
else
{
reader.Read();
- if (reader.GetInt32(0) < CSettings.iDatabaseHighscoreVersion)
+ if (reader.GetInt32(0) < CSettings.DatabaseHighscoreVersion)
{
// update database
}
@@ -1170,7 +1170,7 @@ namespace Vocaluxe.Base
return true;
}
- private static void CreateCoverDB()
+ private static void _CreateCoverDB()
{
using (SQLiteConnection connection = new SQLiteConnection())
{
@@ -1191,7 +1191,7 @@ namespace Vocaluxe.Base
command.ExecuteNonQuery();
command.CommandText = "INSERT INTO Version (id, Value) VALUES(NULL, @Value)";
- command.Parameters.Add("@Value", DbType.Int32).Value = CSettings.iDatabaseCoverVersion;
+ command.Parameters.Add("@Value", DbType.Int32).Value = CSettings.DatabaseCoverVersion;
command.ExecuteNonQuery();
command.CommandText = "CREATE TABLE IF NOT EXISTS Cover ( id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, " +
@@ -1207,7 +1207,7 @@ namespace Vocaluxe.Base
#endregion Cover
#region CreditsRessources
- public static bool GetCreditsRessource(string FileName, ref STexture tex)
+ public static bool GetCreditsRessource(string fileName, ref STexture tex)
{
bool result = false;
@@ -1225,7 +1225,7 @@ namespace Vocaluxe.Base
using (SQLiteCommand command = new SQLiteCommand(connection))
{
command.CommandText = "SELECT id, width, height FROM Images WHERE [Path] = @path";
- command.Parameters.Add("@path", DbType.String, 0).Value = FileName;
+ command.Parameters.Add("@path", DbType.String, 0).Value = fileName;
SQLiteDataReader reader = command.ExecuteReader();
@@ -1245,7 +1245,7 @@ namespace Vocaluxe.Base
{
result = true;
reader.Read();
- byte[] data = GetBytes(reader);
+ byte[] data = _GetBytes(reader);
tex = CDraw.AddTexture(w, h, ref data);
}
}
@@ -1259,11 +1259,11 @@ namespace Vocaluxe.Base
}
//If you want to add an image to db, call this method!
- private static bool AddImageToCreditsDB(String ImagePath)
+ private static bool _AddImageToCreditsDB(String imagePath)
{
bool result = false;
- if (File.Exists(ImagePath))
+ if (File.Exists(imagePath))
{
using (SQLiteConnection connection = new SQLiteConnection())
{
@@ -1281,11 +1281,11 @@ namespace Vocaluxe.Base
Bitmap origin;
try
{
- origin = new Bitmap(ImagePath);
+ origin = new Bitmap(imagePath);
}
catch (Exception)
{
- CLog.LogError("Error loading Texture: " + ImagePath);
+ CLog.LogError("Error loading Texture: " + imagePath);
return false;
}
int w = origin.Width;
@@ -1296,18 +1296,18 @@ namespace Vocaluxe.Base
{
data = new byte[w * h * 4];
- BitmapData bmp_data = origin.LockBits(new Rectangle(0, 0, w, h), ImageLockMode.ReadOnly, PixelFormat.Format32bppArgb);
- Marshal.Copy(bmp_data.Scan0, data, 0, w * h * 4);
- origin.UnlockBits(bmp_data);
+ BitmapData bmpData = origin.LockBits(new Rectangle(0, 0, w, h), ImageLockMode.ReadOnly, PixelFormat.Format32bppArgb);
+ Marshal.Copy(bmpData.Scan0, data, 0, w * h * 4);
+ origin.UnlockBits(bmpData);
command.CommandText = "INSERT INTO Images (Path, width, height) VALUES (@path, @w, @h)";
- command.Parameters.Add("@path", DbType.String, 0).Value = Path.GetFileName(ImagePath);
+ command.Parameters.Add("@path", DbType.String, 0).Value = Path.GetFileName(imagePath);
command.Parameters.Add("@w", DbType.Int32, 0).Value = w;
command.Parameters.Add("@h", DbType.Int32, 0).Value = h;
command.ExecuteNonQuery();
command.CommandText = "SELECT id FROM Images WHERE [Path] = @path";
- command.Parameters.Add("@path", DbType.String, 0).Value = Path.GetFileName(ImagePath);
+ command.Parameters.Add("@path", DbType.String, 0).Value = Path.GetFileName(imagePath);
SQLiteDataReader reader = command.ExecuteReader();
if (reader != null)
@@ -1333,7 +1333,7 @@ namespace Vocaluxe.Base
return result;
}
- private static bool InitCreditsRessourcesDB()
+ private static bool _InitCreditsRessourcesDB()
{
using (SQLiteConnection connection = new SQLiteConnection())
{
@@ -1374,7 +1374,7 @@ namespace Vocaluxe.Base
{
reader.Read();
- if (reader.GetInt32(0) < CSettings.iDatabaseHighscoreVersion)
+ if (reader.GetInt32(0) < CSettings.DatabaseHighscoreVersion)
{
// update database
}
@@ -1387,7 +1387,7 @@ namespace Vocaluxe.Base
return true;
}
- private static void CreateCreditsRessourcesDB()
+ private static void _CreateCreditsRessourcesDB()
{
using (SQLiteConnection connection = new SQLiteConnection())
{
@@ -1408,7 +1408,7 @@ namespace Vocaluxe.Base
command.ExecuteNonQuery();
command.CommandText = "INSERT INTO Version (id, Value) VALUES(NULL, @Value)";
- command.Parameters.Add("@Value", DbType.Int32).Value = CSettings.iDatabaseCreditsRessourcesVersion;
+ command.Parameters.Add("@Value", DbType.Int32).Value = CSettings.DatabaseCreditsRessourcesVersion;
command.ExecuteNonQuery();
command.CommandText = "CREATE TABLE IF NOT EXISTS Images ( id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, " +
@@ -1423,10 +1423,10 @@ namespace Vocaluxe.Base
}
#endregion CreditsRessources
- private static byte[] GetBytes(SQLiteDataReader reader)
+ private static byte[] _GetBytes(SQLiteDataReader reader)
{
- const int CHUNK_SIZE = 2 * 1024;
- byte[] buffer = new byte[CHUNK_SIZE];
+ const int chunkSize = 2 * 1024;
+ byte[] buffer = new byte[chunkSize];
long bytesRead;
long fieldOffset = 0;
using (MemoryStream stream = new MemoryStream())
@@ -1442,10 +1442,10 @@ namespace Vocaluxe.Base
}
}
- private static long UnixTimeToTicks(int UnixTime)
+ private static long _UnixTimeToTicks(int unixTime)
{
DateTime t70 = new DateTime(1970, 1, 1, 0, 0, 0, 0);
- t70 = t70.AddSeconds(UnixTime);
+ t70 = t70.AddSeconds(unixTime);
return t70.Ticks;
}
}
diff --git a/Vocaluxe/Base/CDraw.cs b/Vocaluxe/Base/CDraw.cs
index 46dac4cd..feb52eae 100644
--- a/Vocaluxe/Base/CDraw.cs
+++ b/Vocaluxe/Base/CDraw.cs
@@ -45,7 +45,7 @@ namespace Vocaluxe.Base
MessageBox.Show(e.Message + " - Error in initializing of Direct3D. Please check if " +
"your DirectX redistributables and graphic card drivers are up to date. You can " +
"download the DirectX runtimes at http://www.microsoft.com/download/en/details.aspx?id=8109",
- CSettings.sProgramName, MessageBoxButtons.OK, MessageBoxIcon.Error);
+ CSettings.ProgramName, MessageBoxButtons.OK, MessageBoxIcon.Error);
CLog.LogError(e.Message + " - Error in initializing of Direct3D. Please check if " +
"your DirectX redistributables and graphic card drivers are up to date. You can " +
"download the DirectX runtimes at http://www.microsoft.com/download/en/details.aspx?id=8109");
@@ -89,9 +89,9 @@ namespace Vocaluxe.Base
return _Draw.GetTextBounds(text);
}
- public static RectangleF GetTextBounds(CText text, float Height)
+ public static RectangleF GetTextBounds(CText text, float height)
{
- return _Draw.GetTextBounds(text, Height);
+ return _Draw.GetTextBounds(text, height);
}
public static void DrawLine(int a, int r, int g, int b, int w, int x1, int y1, int x2, int y2)
@@ -99,15 +99,15 @@ namespace Vocaluxe.Base
_Draw.DrawLine(a, r, g, b, w, x1, y1, x2, y2);
}
- public static void DrawRect(SColorF Color, SRectF Rect, float Thickness)
+ public static void DrawRect(SColorF color, SRectF rect, float thickness)
{
- if (Thickness <= 0f)
+ if (thickness <= 0f)
return;
- _Draw.DrawColor(Color, new SRectF(Rect.X - Thickness / 2, Rect.Y - Thickness / 2, Rect.W + Thickness, Thickness, Rect.Z));
- _Draw.DrawColor(Color, new SRectF(Rect.X - Thickness / 2, Rect.Y + Rect.H - Thickness / 2, Rect.W + Thickness, Thickness, Rect.Z));
- _Draw.DrawColor(Color, new SRectF(Rect.X - Thickness / 2, Rect.Y - Thickness / 2, Thickness, Rect.H + Thickness, Rect.Z));
- _Draw.DrawColor(Color, new SRectF(Rect.X + Rect.W - Thickness / 2, Rect.Y - Thickness / 2, Thickness, Rect.H + Thickness, Rect.Z));
+ _Draw.DrawColor(color, new SRectF(rect.X - thickness / 2, rect.Y - thickness / 2, rect.W + thickness, thickness, rect.Z));
+ _Draw.DrawColor(color, new SRectF(rect.X - thickness / 2, rect.Y + rect.H - thickness / 2, rect.W + thickness, thickness, rect.Z));
+ _Draw.DrawColor(color, new SRectF(rect.X - thickness / 2, rect.Y - thickness / 2, thickness, rect.H + thickness, rect.Z));
+ _Draw.DrawColor(color, new SRectF(rect.X + rect.W - thickness / 2, rect.Y - thickness / 2, thickness, rect.H + thickness, rect.Z));
}
public static void DrawColor(SColorF color, SRectF rect)
@@ -130,9 +130,9 @@ namespace Vocaluxe.Base
return _Draw.CopyScreen();
}
- public static void CopyScreen(ref STexture Texture)
+ public static void CopyScreen(ref STexture texture)
{
- _Draw.CopyScreen(ref Texture);
+ _Draw.CopyScreen(ref texture);
}
public static void MakeScreenShot()
@@ -141,33 +141,33 @@ namespace Vocaluxe.Base
}
// Draw Basic Text (must be deleted later)
- public static void DrawText(string Text, int x, int y, int h)
+ public static void DrawText(string text, int x, int y, int h)
{
- _Draw.DrawText(Text, x, y, h);
+ _Draw.DrawText(text, x, y, h);
}
- public static STexture AddTexture(Bitmap Bitmap)
+ public static STexture AddTexture(Bitmap bitmap)
{
- return _Draw.AddTexture(Bitmap);
+ return _Draw.AddTexture(bitmap);
}
- public static STexture AddTexture(string TexturePath)
+ public static STexture AddTexture(string texturePath)
{
- return _Draw.AddTexture(TexturePath);
+ return _Draw.AddTexture(texturePath);
}
- public static STexture AddTexture(string TexturePath, int MaxSize)
+ public static STexture AddTexture(string texturePath, int maxSize)
{
- if (MaxSize == 0)
- return _Draw.AddTexture(TexturePath);
+ if (maxSize == 0)
+ return _Draw.AddTexture(texturePath);
- if (!File.Exists(TexturePath))
+ if (!File.Exists(texturePath))
return new STexture(-1);
- using (Bitmap origin = new Bitmap(TexturePath))
+ using (Bitmap origin = new Bitmap(texturePath))
{
- int w = MaxSize;
- int h = MaxSize;
+ int w = maxSize;
+ int h = maxSize;
if (origin.Width >= origin.Height && origin.Width > w)
h = (int)Math.Round((float)w / origin.Width * origin.Height);
@@ -182,87 +182,87 @@ namespace Vocaluxe.Base
}
}
- public static STexture AddTexture(int W, int H, IntPtr Data)
+ public static STexture AddTexture(int w, int h, IntPtr data)
{
- return _Draw.AddTexture(W, H, Data);
+ return _Draw.AddTexture(w, h, data);
}
- public static STexture AddTexture(int W, int H, ref byte[] Data)
+ public static STexture AddTexture(int w, int h, ref byte[] data)
{
- return _Draw.AddTexture(W, H, ref Data);
+ return _Draw.AddTexture(w, h, ref data);
}
- public static STexture QuequeTexture(int W, int H, ref byte[] Data)
+ public static STexture QuequeTexture(int w, int h, ref byte[] data)
{
- return _Draw.QuequeTexture(W, H, ref Data);
+ return _Draw.QuequeTexture(w, h, ref data);
}
- public static bool UpdateTexture(ref STexture Texture, ref byte[] Data)
+ public static bool UpdateTexture(ref STexture texture, ref byte[] data)
{
- return _Draw.UpdateTexture(ref Texture, ref Data);
+ return _Draw.UpdateTexture(ref texture, ref data);
}
- public static bool UpdateTexture(ref STexture Texture, IntPtr Data)
+ public static bool UpdateTexture(ref STexture texture, IntPtr data)
{
- return _Draw.UpdateTexture(ref Texture, Data);
+ return _Draw.UpdateTexture(ref texture, data);
}
- public static void RemoveTexture(ref STexture Texture)
+ public static void RemoveTexture(ref STexture texture)
{
- _Draw.RemoveTexture(ref Texture);
+ _Draw.RemoveTexture(ref texture);
}
- public static void DrawTexture(STexture Texture)
+ public static void DrawTexture(STexture texture)
{
- _Draw.DrawTexture(Texture);
+ _Draw.DrawTexture(texture);
}
- public static void DrawTexture(STexture Texture, SRectF rect)
+ public static void DrawTexture(STexture texture, SRectF rect)
{
- _Draw.DrawTexture(Texture, rect);
+ _Draw.DrawTexture(texture, rect);
}
- public static void DrawTexture(STexture Texture, SRectF rect, SColorF color)
+ public static void DrawTexture(STexture texture, SRectF rect, SColorF color)
{
- _Draw.DrawTexture(Texture, rect, color);
+ _Draw.DrawTexture(texture, rect, color);
}
- public static void DrawTexture(STexture Texture, SRectF rect, SColorF color, SRectF bounds)
+ public static void DrawTexture(STexture texture, SRectF rect, SColorF color, SRectF bounds)
{
- _Draw.DrawTexture(Texture, rect, color, bounds);
+ _Draw.DrawTexture(texture, rect, color, bounds);
}
- public static void DrawTexture(STexture Texture, SRectF rect, SColorF color, bool mirrored)
+ public static void DrawTexture(STexture texture, SRectF rect, SColorF color, bool mirrored)
{
- _Draw.DrawTexture(Texture, rect, color, mirrored);
+ _Draw.DrawTexture(texture, rect, color, mirrored);
}
- public static void DrawTexture(STexture Texture, SRectF rect, SColorF color, SRectF bounds, bool mirrored)
+ public static void DrawTexture(STexture texture, SRectF rect, SColorF color, SRectF bounds, bool mirrored)
{
- _Draw.DrawTexture(Texture, rect, color, bounds, mirrored);
+ _Draw.DrawTexture(texture, rect, color, bounds, mirrored);
}
- public static void DrawTexture(STexture Texture, SRectF rect, SColorF color, float begin, float end)
+ public static void DrawTexture(STexture texture, SRectF rect, SColorF color, float begin, float end)
{
- _Draw.DrawTexture(Texture, rect, color, begin, end);
+ _Draw.DrawTexture(texture, rect, color, begin, end);
}
- public static void DrawTexture(CStatic StaticBounds, STexture Texture, EAspect Aspect)
+ public static void DrawTexture(CStatic staticBounds, STexture texture, EAspect aspect)
{
- RectangleF bounds = new RectangleF(StaticBounds.Rect.X, StaticBounds.Rect.Y, StaticBounds.Rect.W, StaticBounds.Rect.H);
- RectangleF rect = new RectangleF(0f, 0f, Texture.width, Texture.height);
+ RectangleF bounds = new RectangleF(staticBounds.Rect.X, staticBounds.Rect.Y, staticBounds.Rect.W, staticBounds.Rect.H);
+ RectangleF rect = new RectangleF(0f, 0f, texture.Width, texture.Height);
if (rect.Height <= 0f)
return;
- CHelper.SetRect(bounds, ref rect, rect.Width / rect.Height, Aspect);
- DrawTexture(Texture, new SRectF(rect.X, rect.Y, rect.Width, rect.Height, StaticBounds.Rect.Z),
- Texture.color, new SRectF(bounds.X, bounds.Y, bounds.Width, bounds.Height, 0f), false);
+ CHelper.SetRect(bounds, ref rect, rect.Width / rect.Height, aspect);
+ DrawTexture(texture, new SRectF(rect.X, rect.Y, rect.Width, rect.Height, staticBounds.Rect.Z),
+ texture.Color, new SRectF(bounds.X, bounds.Y, bounds.Width, bounds.Height, 0f), false);
}
- public static void DrawTextureReflection(STexture Texture, SRectF rect, SColorF color, SRectF bounds, float space, float height)
+ public static void DrawTextureReflection(STexture texture, SRectF rect, SColorF color, SRectF bounds, float space, float height)
{
- _Draw.DrawTextureReflection(Texture, rect, color, bounds, space, height);
+ _Draw.DrawTextureReflection(texture, rect, color, bounds, space, height);
}
public static int TextureCount()
diff --git a/Vocaluxe/Base/CFont.cs b/Vocaluxe/Base/CFont.cs
index b0403dda..3cc030d6 100644
--- a/Vocaluxe/Base/CFont.cs
+++ b/Vocaluxe/Base/CFont.cs
@@ -13,25 +13,25 @@ namespace Vocaluxe.Base
{
class CGlyph
{
- private readonly float _SIZEh = 50f;
- public float SIZEh
+ private readonly float _Sizeh = 50f;
+ public float Sizeh
{
- get { return _SIZEh; }
+ get { return _Sizeh; }
}
public STexture Texture;
public char Chr;
- public int width;
+ public int Width;
- public CGlyph(char chr, float MaxHigh)
+ public CGlyph(char chr, float maxHigh)
{
- _SIZEh = MaxHigh;
+ _Sizeh = maxHigh;
float outline = CFonts.Outline;
TextFormatFlags flags = TextFormatFlags.NoPadding | TextFormatFlags.NoPrefix;
- float factor = GetFactor(chr, flags);
- CFonts.Height = SIZEh * factor;
+ float factor = _GetFactor(chr, flags);
+ CFonts.Height = Sizeh * factor;
Font fo;
Size sizeB;
SizeF size;
@@ -51,12 +51,12 @@ namespace Vocaluxe.Base
g.SmoothingMode = SmoothingMode.AntiAlias;
g.InterpolationMode = InterpolationMode.HighQualityBicubic;
g.TextRenderingHint = TextRenderingHint.ClearTypeGridFit;
- CFonts.Height = SIZEh;
+ 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);
+ 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);
using (GraphicsPath path = new GraphicsPath())
{
@@ -64,7 +64,7 @@ namespace Vocaluxe.Base
chr.ToString(),
fo.FontFamily,
(int)fo.Style,
- SIZEh,
+ Sizeh,
point,
new StringFormat());
@@ -74,7 +74,7 @@ namespace Vocaluxe.Base
(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);
@@ -92,7 +92,7 @@ namespace Vocaluxe.Base
Texture = CDraw.AddTexture(bmp);
//bmp.Save("test.png", ImageFormat.Png);
Chr = chr;
- width = (int)((1f + outline / 2f) * sizeB.Width * Texture.width / factor / bmp.Width);
+ Width = (int)((1f + outline / 2f) * sizeB.Width * Texture.Width / factor / bmp.Width);
g.Dispose();
}
fo.Dispose();
@@ -103,7 +103,7 @@ namespace Vocaluxe.Base
CDraw.RemoveTexture(ref Texture);
}
- private float GetFactor(char chr, TextFormatFlags flags)
+ private float _GetFactor(char chr, TextFormatFlags flags)
{
if (CFonts.Style == EStyle.Normal)
return 1f;
@@ -111,14 +111,14 @@ namespace Vocaluxe.Base
EStyle style = CFonts.Style;
CFonts.Style = EStyle.Normal;
- CFonts.Height = SIZEh;
- float h_style, h_normal;
+ CFonts.Height = Sizeh;
+ float hStyle, hNormal;
using (Graphics g = Graphics.FromHwnd(IntPtr.Zero))
{
Font fo = CFonts.GetFont();
Size sizeB = TextRenderer.MeasureText(g, chr.ToString(), fo, new Size(int.MaxValue, int.MaxValue), flags);
//SizeF size = g.MeasureString(chr.ToString(), fo);
- h_normal = sizeB.Height;
+ hNormal = sizeB.Height;
}
CFonts.Style = style;
using (Graphics g = Graphics.FromHwnd(IntPtr.Zero))
@@ -126,59 +126,59 @@ namespace Vocaluxe.Base
Font fo = CFonts.GetFont();
Size sizeB = TextRenderer.MeasureText(g, chr.ToString(), fo, new Size(int.MaxValue, int.MaxValue), flags);
//size = g.MeasureString(chr.ToString(), fo);
- h_style = sizeB.Height;
+ hStyle = sizeB.Height;
}
- return h_normal / h_style;
+ return hNormal / hStyle;
}
}
class CFont : IDisposable
{
private readonly Dictionary _Glyphs;
- private PrivateFontCollection fonts;
- private FontFamily family;
- private readonly float SIZEh;
+ private PrivateFontCollection _Fonts;
+ private FontFamily _Family;
+ private readonly float _Sizeh;
public string FilePath;
- public CFont(string File)
+ public CFont(string file)
{
- FilePath = File;
+ FilePath = file;
_Glyphs = new Dictionary();
switch (CConfig.TextureQuality)
{
case ETextureQuality.TR_CONFIG_TEXTURE_LOWEST:
- SIZEh = 25f;
+ _Sizeh = 25f;
break;
case ETextureQuality.TR_CONFIG_TEXTURE_LOW:
- SIZEh = 50f;
+ _Sizeh = 50f;
break;
case ETextureQuality.TR_CONFIG_TEXTURE_MEDIUM:
- SIZEh = 100f;
+ _Sizeh = 100f;
break;
case ETextureQuality.TR_CONFIG_TEXTURE_HIGH:
- SIZEh = 200f;
+ _Sizeh = 200f;
break;
case ETextureQuality.TR_CONFIG_TEXTURE_HIGHEST:
- SIZEh = 400f;
+ _Sizeh = 400f;
break;
default:
- SIZEh = 100f;
+ _Sizeh = 100f;
break;
}
}
public Font GetFont()
{
- if (fonts == null)
+ if (_Fonts == null)
{
- fonts = new PrivateFontCollection();
+ _Fonts = new PrivateFontCollection();
try
{
- fonts.AddFontFile(FilePath);
- family = fonts.Families[0];
+ _Fonts.AddFontFile(FilePath);
+ _Family = _Fonts.Families[0];
}
catch (Exception e)
{
@@ -186,7 +186,7 @@ namespace Vocaluxe.Base
}
}
- return new Font(family, CFonts.Height, CFonts.GetFontStyle(), GraphicsUnit.Pixel);
+ return new Font(_Family, CFonts.Height, CFonts.GetFontStyle(), GraphicsUnit.Pixel);
}
public void DrawGlyph(char chr, float x, float y, float h, float z, SColorF color)
@@ -220,9 +220,9 @@ namespace Vocaluxe.Base
CFonts.Height = h;
CGlyph glyph = _Glyphs[chr];
texture = glyph.Texture;
- float factor = h / texture.height;
- float width = texture.width * factor;
- float d = glyph.SIZEh / 5f * factor;
+ float factor = h / texture.Height;
+ float width = texture.Width * factor;
+ float d = glyph.Sizeh / 5f * factor;
rect = new SRectF(x - d, y, width, h, z);
}
@@ -231,8 +231,8 @@ namespace Vocaluxe.Base
AddGlyph(chr);
CGlyph glyph = _Glyphs[chr];
- float factor = CFonts.Height / glyph.Texture.height;
- return glyph.width * factor;
+ float factor = CFonts.Height / glyph.Texture.Height;
+ return glyph.Width * factor;
}
public float GetHeight(char chr)
@@ -252,7 +252,7 @@ namespace Vocaluxe.Base
return;
float h = CFonts.Height;
- _Glyphs.Add(chr, new CGlyph(chr, SIZEh));
+ _Glyphs.Add(chr, new CGlyph(chr, _Sizeh));
CFonts.Height = h;
}
@@ -265,10 +265,10 @@ namespace Vocaluxe.Base
public void Dispose()
{
- if (fonts != null)
+ if (_Fonts != null)
{
- fonts.Dispose();
- fonts = null;
+ _Fonts.Dispose();
+ _Fonts = null;
UnloadAllGlyphs();
}
GC.SuppressFinalize(this);
@@ -300,7 +300,7 @@ namespace Vocaluxe.Base
static class CFonts
{
- private static readonly XmlWriterSettings _settings = new XmlWriterSettings();
+ private static readonly XmlWriterSettings _Settings = new XmlWriterSettings();
private static List _Fonts;
private static int _CurrentFont;
@@ -357,9 +357,9 @@ namespace Vocaluxe.Base
public static void Init()
{
- _settings.Indent = true;
- _settings.Encoding = Encoding.UTF8;
- _settings.ConformanceLevel = ConformanceLevel.Document;
+ _Settings.Indent = true;
+ _Settings.Encoding = Encoding.UTF8;
+ _Settings.ConformanceLevel = ConformanceLevel.Document;
_CurrentFont = 0;
PartyModeID = -1;
@@ -371,7 +371,7 @@ namespace Vocaluxe.Base
_Fonts = new List();
_CurrentFont = 0;
- LoadFontList();
+ _LoadFontList();
}
public static Font GetFont()
@@ -397,77 +397,77 @@ namespace Vocaluxe.Base
}
#region DrawText
- public static void DrawText(string Text, int x, int y, int h)
+ public static void DrawText(string text, int x, int y, int h)
{
- DrawText(Text, h, x, y, 0f, new SColorF(0f, 0f, 0f, 1f));
+ DrawText(text, h, x, y, 0f, new SColorF(0f, 0f, 0f, 1f));
}
- public static void DrawText(string Text, float x, float y, float z)
+ public static void DrawText(string text, float x, float y, float z)
{
- DrawText(Text, Height, x, y, z, new SColorF(0f, 0f, 0f, 1f));
+ DrawText(text, Height, x, y, z, new SColorF(0f, 0f, 0f, 1f));
}
- public static void DrawText(string Text, float h, float x, float y, float z, SColorF color)
+ public static void DrawText(string text, float h, float x, float y, float z, SColorF color)
{
if (h <= 0f)
return;
- if (Text.Length == 0)
+ if (text.Length == 0)
return;
Height = h;
- CFont Font = _GetCurrentFont();
+ CFont font = _GetCurrentFont();
float dx = x;
- foreach (char chr in Text)
+ foreach (char chr in text)
{
- Font.DrawGlyph(chr, dx, y, Height, z, color);
- dx += Font.GetWidth(chr);
+ font.DrawGlyph(chr, dx, y, Height, z, color);
+ dx += font.GetWidth(chr);
}
}
- public static void DrawTextReflection(string Text, float h, float x, float y, float z, SColorF color, float rspace, float rheight)
+ public static void DrawTextReflection(string text, float h, float x, float y, float z, SColorF color, float rspace, float rheight)
{
if (h <= 0f)
return;
- if (Text.Length == 0)
+ if (text.Length == 0)
return;
Height = h;
- CFont Font = _GetCurrentFont();
+ CFont font = _GetCurrentFont();
float dx = x;
- foreach (char chr in Text)
+ foreach (char chr in text)
{
- Font.DrawGlyphReflection(chr, dx, y, Height, z, color, rspace, rheight);
- dx += Font.GetWidth(chr);
+ font.DrawGlyphReflection(chr, dx, y, Height, z, color, rspace, rheight);
+ dx += font.GetWidth(chr);
}
}
- public static void DrawText(string Text, float h, float x, float y, float z, SColorF color, float begin, float end)
+ public static void DrawText(string text, float h, float x, float y, float z, SColorF color, float begin, float end)
{
if (h <= 0f)
return;
- if (Text.Length == 0)
+ if (text.Length == 0)
return;
Height = h;
float dx = x;
- float w = GetTextWidth(Text);
+ float w = GetTextWidth(text);
if (w <= 0f)
return;
float x1 = x + w * begin;
float x2 = x + w * end;
- CFont Font = _GetCurrentFont();
+ CFont font = _GetCurrentFont();
- foreach (char chr in Text)
+ foreach (char chr in text)
{
- float w2 = Font.GetWidth(chr);
+ float w2 = font.GetWidth(chr);
float b = (x1 - dx) / w2;
if (b < 1f)
@@ -479,7 +479,7 @@ namespace Vocaluxe.Base
{
if (e > 1f)
e = 1f;
- Font.DrawGlyph(chr, dx, y, Height, z, color, b, e);
+ font.DrawGlyph(chr, dx, y, Height, z, color, b, e);
}
}
dx += w2;
@@ -504,32 +504,32 @@ namespace Vocaluxe.Base
}
}
- public static void SetFont(string FontName)
+ public static void SetFont(string fontName)
{
- int Index = -1;
+ int index = -1;
if (PartyModeID != -1)
{
- Index = GetFontIndexParty(PartyModeID, FontName);
+ index = _GetFontIndexParty(PartyModeID, fontName);
- if (Index >= 0 && Index < _Fonts.Count)
+ if (index >= 0 && index < _Fonts.Count)
{
- _CurrentFont = Index;
+ _CurrentFont = index;
return;
}
}
- Index = GetFontIndex(CConfig.Theme, FontName);
+ index = _GetFontIndex(CConfig.Theme, fontName);
- if (Index >= 0 && Index < _Fonts.Count)
+ if (index >= 0 && index < _Fonts.Count)
{
- _CurrentFont = Index;
+ _CurrentFont = index;
return;
}
for (int i = 0; i < _Fonts.Count; i++)
{
- if (!_Fonts[i].IsThemeFont && _Fonts[i].Name == FontName)
+ if (!_Fonts[i].IsThemeFont && _Fonts[i].Name == fontName)
{
_CurrentFont = i;
return;
@@ -552,9 +552,9 @@ namespace Vocaluxe.Base
public static float GetTextWidth(string text)
{
float dx = 0;
- CFont Font = _GetCurrentFont();
+ CFont font = _GetCurrentFont();
foreach (char chr in text)
- dx += Font.GetWidth(chr);
+ dx += font.GetWidth(chr);
return dx;
}
@@ -562,17 +562,17 @@ namespace Vocaluxe.Base
{
//return TextRenderer.MeasureText(text, GetFont()).Height;
float h = 0f;
- CFont Font = _GetCurrentFont();
+ CFont font = _GetCurrentFont();
foreach (char chr in text)
{
- float hh = Font.GetHeight(chr);
+ float hh = font.GetHeight(chr);
if (hh > h)
h = hh;
}
return h;
}
- private static void _LoadFontFiles(CXMLReader xmlReader, string FontFolder, string ThemeName = "", int PartyModeId = -1)
+ private static void _LoadFontFiles(CXMLReader xmlReader, string fontFolder, string themeName = "", int partyModeId = -1)
{
string value = string.Empty;
int i = 1;
@@ -580,9 +580,9 @@ namespace Vocaluxe.Base
{
SFont sf = new SFont();
sf.Folder = value;
- sf.IsThemeFont = ThemeName.Length > 0;
- sf.ThemeName = ThemeName;
- sf.PartyModeID = PartyModeId;
+ sf.IsThemeFont = themeName.Length > 0;
+ sf.ThemeName = themeName;
+ sf.PartyModeID = partyModeId;
bool ok = true;
@@ -592,25 +592,25 @@ namespace Vocaluxe.Base
ok &= xmlReader.GetValue("//root/Fonts/Font" + i.ToString() + "/FileNormal", ref value, value);
sf.FileNormal = value;
- value = Path.Combine(FontFolder, Path.Combine(sf.Folder, value));
+ value = Path.Combine(fontFolder, Path.Combine(sf.Folder, value));
CFont f = new CFont(value);
sf.Normal = f;
ok &= xmlReader.GetValue("//root/Fonts/Font" + i.ToString() + "/FileItalic", ref value, value);
sf.FileItalic = value;
- value = Path.Combine(FontFolder, Path.Combine(sf.Folder, 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));
+ 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));
+ value = Path.Combine(fontFolder, Path.Combine(sf.Folder, value));
f = new CFont(value);
sf.BoldItalic = f;
@@ -628,10 +628,10 @@ namespace Vocaluxe.Base
else
{
string fontTypes;
- if (PartyModeId >= 0)
+ if (partyModeId >= 0)
fontTypes = "theme fonts for party mode";
- else if (ThemeName.Length > 0)
- fontTypes = "theme fonts for theme \"" + ThemeName + "\"";
+ 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());
@@ -644,143 +644,143 @@ namespace Vocaluxe.Base
/// Load default fonts
///
///
- private static bool LoadFontList()
+ private static bool _LoadFontList()
{
- CXMLReader xmlReader = CXMLReader.OpenFile(Path.Combine(CSettings.sFolderFonts, CSettings.sFileFonts));
+ CXMLReader xmlReader = CXMLReader.OpenFile(Path.Combine(CSettings.FolderFonts, CSettings.FileFonts));
if (xmlReader == null)
return false;
_Fonts.Clear();
- _LoadFontFiles(xmlReader, Path.Combine(Directory.GetCurrentDirectory(), CSettings.sFolderFonts));
+ _LoadFontFiles(xmlReader, Path.Combine(Directory.GetCurrentDirectory(), CSettings.FolderFonts));
return true;
}
///
/// Loads theme fonts from skin file
///
- public static void LoadThemeFonts(string ThemeName, string FontFolder, CXMLReader xmlReader)
+ public static void LoadThemeFonts(string themeName, string fontFolder, CXMLReader xmlReader)
{
- _LoadFontFiles(xmlReader, FontFolder, ThemeName);
+ _LoadFontFiles(xmlReader, fontFolder, themeName);
CLog.StartBenchmark(1, "BuildGlyphs");
- BuildGlyphs();
+ _BuildGlyphs();
CLog.StopBenchmark(1, "BuildGlyphs");
}
///
/// Loads party mode fonts from skin file
///
- public static void LoadPartyModeFonts(int PartyModeID, string FontFolder, CXMLReader xmlReader)
+ public static void LoadPartyModeFonts(int partyModeID, string fontFolder, CXMLReader xmlReader)
{
- _LoadFontFiles(xmlReader, FontFolder, "", PartyModeID);
+ _LoadFontFiles(xmlReader, fontFolder, "", partyModeID);
CLog.StartBenchmark(1, "BuildGlyphs");
- BuildGlyphs();
+ _BuildGlyphs();
CLog.StopBenchmark(1, "BuildGlyphs");
}
- public static void SaveThemeFonts(string ThemeName, XmlWriter writer)
+ public static void SaveThemeFonts(string themeName, XmlWriter writer)
{
if (_Fonts.Count == 0)
return;
- int Index = 0;
- int FontNr = 1;
- bool SetStart = false;
- while (Index < _Fonts.Count)
+ int index = 0;
+ int fontNr = 1;
+ bool setStart = false;
+ while (index < _Fonts.Count)
{
- if (_Fonts[Index].IsThemeFont && _Fonts[Index].ThemeName == ThemeName)
+ if (_Fonts[index].IsThemeFont && _Fonts[index].ThemeName == themeName)
{
- if (!SetStart)
+ if (!setStart)
{
writer.WriteStartElement("Fonts");
- SetStart = true;
+ setStart = true;
}
- writer.WriteStartElement("Font" + FontNr.ToString());
+ writer.WriteStartElement("Font" + fontNr.ToString());
- writer.WriteElementString("Name", _Fonts[Index].Name);
- writer.WriteElementString("Folder", _Fonts[Index].Folder);
+ writer.WriteElementString("Name", _Fonts[index].Name);
+ writer.WriteElementString("Folder", _Fonts[index].Folder);
- writer.WriteElementString("Outline", _Fonts[Index].Outline.ToString("#0.00"));
- writer.WriteElementString("OutlineColorR", _Fonts[Index].OutlineColor.R.ToString("#0.00"));
- writer.WriteElementString("OutlineColorG", _Fonts[Index].OutlineColor.G.ToString("#0.00"));
- writer.WriteElementString("OutlineColorB", _Fonts[Index].OutlineColor.B.ToString("#0.00"));
- writer.WriteElementString("OutlineColorA", _Fonts[Index].OutlineColor.A.ToString("#0.00"));
+ writer.WriteElementString("Outline", _Fonts[index].Outline.ToString("#0.00"));
+ writer.WriteElementString("OutlineColorR", _Fonts[index].OutlineColor.R.ToString("#0.00"));
+ writer.WriteElementString("OutlineColorG", _Fonts[index].OutlineColor.G.ToString("#0.00"));
+ writer.WriteElementString("OutlineColorB", _Fonts[index].OutlineColor.B.ToString("#0.00"));
+ writer.WriteElementString("OutlineColorA", _Fonts[index].OutlineColor.A.ToString("#0.00"));
- writer.WriteElementString("FileNormal", _Fonts[Index].FileNormal);
- writer.WriteElementString("FileBold", _Fonts[Index].FileBold);
- writer.WriteElementString("FileItalic", _Fonts[Index].FileItalic);
- writer.WriteElementString("FileBoldItalic", _Fonts[Index].FileBoldItalic);
+ writer.WriteElementString("FileNormal", _Fonts[index].FileNormal);
+ writer.WriteElementString("FileBold", _Fonts[index].FileBold);
+ writer.WriteElementString("FileItalic", _Fonts[index].FileItalic);
+ writer.WriteElementString("FileBoldItalic", _Fonts[index].FileBoldItalic);
writer.WriteEndElement();
- FontNr++;
+ fontNr++;
}
- Index++;
+ index++;
}
- if (SetStart)
+ if (setStart)
writer.WriteEndElement();
}
- public static void UnloadThemeFonts(string ThemeName)
+ public static void UnloadThemeFonts(string themeName)
{
if (_Fonts.Count == 0)
return;
- int Index = 0;
- while (Index < _Fonts.Count)
+ int index = 0;
+ while (index < _Fonts.Count)
{
- if (_Fonts[Index].IsThemeFont && _Fonts[Index].ThemeName == ThemeName)
+ if (_Fonts[index].IsThemeFont && _Fonts[index].ThemeName == themeName)
{
- _Fonts[Index].Normal.UnloadAllGlyphs();
- _Fonts[Index].Italic.UnloadAllGlyphs();
- _Fonts[Index].Bold.UnloadAllGlyphs();
- _Fonts[Index].BoldItalic.UnloadAllGlyphs();
- _Fonts.RemoveAt(Index);
+ _Fonts[index].Normal.UnloadAllGlyphs();
+ _Fonts[index].Italic.UnloadAllGlyphs();
+ _Fonts[index].Bold.UnloadAllGlyphs();
+ _Fonts[index].BoldItalic.UnloadAllGlyphs();
+ _Fonts.RemoveAt(index);
}
else
- Index++;
+ index++;
}
}
- private static int GetFontIndex(string ThemeName, string FontName)
+ private static int _GetFontIndex(string themeName, string fontName)
{
- if (ThemeName.Length == 0 || FontName.Length == 0)
+ if (themeName.Length == 0 || fontName.Length == 0)
return -1;
for (int i = 0; i < _Fonts.Count; i++)
{
- if (_Fonts[i].IsThemeFont && _Fonts[i].Name == FontName && _Fonts[i].ThemeName == ThemeName)
+ if (_Fonts[i].IsThemeFont && _Fonts[i].Name == fontName && _Fonts[i].ThemeName == themeName)
return i;
}
return -1;
}
- private static int GetFontIndexParty(int PartyModeID, string FontName)
+ private static int _GetFontIndexParty(int partyModeID, string fontName)
{
- if (PartyModeID == -1 || FontName.Length == 0)
+ if (partyModeID == -1 || fontName.Length == 0)
return -1;
for (int i = 0; i < _Fonts.Count; i++)
{
- if (!_Fonts[i].IsThemeFont && _Fonts[i].Name == FontName && _Fonts[i].PartyModeID == PartyModeID)
+ if (!_Fonts[i].IsThemeFont && _Fonts[i].Name == fontName && _Fonts[i].PartyModeID == partyModeID)
return i;
}
return -1;
}
- private static void BuildGlyphs()
+ private static void _BuildGlyphs()
{
- string Text = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPGRSTUVWGXZ1234567890";
+ string text = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPGRSTUVWGXZ1234567890";
for (int i = 0; i < _Fonts.Count; i++)
{
CurrentFont = i;
- foreach (char chr in Text)
+ foreach (char chr in text)
{
Style = EStyle.Normal;
_Fonts[_CurrentFont].Normal.AddGlyph(chr);
diff --git a/Vocaluxe/Base/CGame.cs b/Vocaluxe/Base/CGame.cs
index fd6b6917..c741659d 100644
--- a/Vocaluxe/Base/CGame.cs
+++ b/Vocaluxe/Base/CGame.cs
@@ -26,15 +26,15 @@ namespace Vocaluxe.Base
get { return _Rand; }
}
- public static float GetBeatFromTime(float Time, float BPM, float Gap)
+ public static float GetBeatFromTime(float time, float bpm, float gap)
{
- return BPM / 60 * (Time - Gap);
+ return bpm / 60 * (time - gap);
}
- public static float GetTimeFromBeats(float Beats, float BPM)
+ public static float GetTimeFromBeats(float beats, float bpm)
{
- if (BPM > 0f)
- return Beats / BPM * 60f;
+ if (bpm > 0f)
+ return beats / bpm * 60f;
return 0f;
}
@@ -85,24 +85,24 @@ namespace Vocaluxe.Base
get { return _GameMode.GetCurrentGameMode(); }
}
- public static bool AddVisibleSong(int VisibleIndex, EGameMode GameMode)
+ public static bool AddVisibleSong(int visibleIndex, EGameMode gameMode)
{
- return _GameMode.AddVisibleSong(VisibleIndex, GameMode);
+ return _GameMode.AddVisibleSong(visibleIndex, gameMode);
}
- public static bool AddSong(int AbsoluteIndex, EGameMode GameMode)
+ public static bool AddSong(int absoluteIndex, EGameMode gameMode)
{
- return _GameMode.AddSong(AbsoluteIndex, GameMode);
+ return _GameMode.AddSong(absoluteIndex, gameMode);
}
- public static bool RemoveVisibleSong(int VisibleIndex)
+ public static bool RemoveVisibleSong(int visibleIndex)
{
- return _GameMode.RemoveVisibleSong(VisibleIndex);
+ return _GameMode.RemoveVisibleSong(visibleIndex);
}
- public static bool RemoveSong(int AbsoluteIndex)
+ public static bool RemoveSong(int absoluteIndex)
{
- return _GameMode.RemoveSong(AbsoluteIndex);
+ return _GameMode.RemoveSong(absoluteIndex);
}
public static void ClearSongs()
@@ -140,14 +140,14 @@ namespace Vocaluxe.Base
return _GameMode.GetSong();
}
- public static CSong GetSong(int Num)
+ public static CSong GetSong(int num)
{
- return _GameMode.GetSong(Num);
+ return _GameMode.GetSong(num);
}
- public static EGameMode GetGameMode(int Num)
+ public static EGameMode GetGameMode(int num)
{
- return _GameMode.GetGameMode(Num);
+ return _GameMode.GetGameMode(num);
}
public static int GetNumSongs()
@@ -200,23 +200,23 @@ namespace Vocaluxe.Base
_CurrentBeatD = -100;
}
- public static void UpdatePoints(float Time)
+ public static void UpdatePoints(float time)
{
- bool DEBUG_HIT = false;
+ bool debugHit = false;
CSong song = _GameMode.GetSong();
if (song == null)
return;
- float b = GetBeatFromTime(Time, song.BPM, song.Gap);
+ float b = GetBeatFromTime(time, song.BPM, song.Gap);
if (b <= _Beat)
return;
_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++)
@@ -234,115 +234,115 @@ namespace Vocaluxe.Base
_Player[p].SongFinished = true;
CLine[] lines = song.Notes.GetLines(_Player[p].LineNr).Line;
- int Line = -1;
+ int line = -1;
for (int j = 0; j < lines.Length; j++)
{
if (beat >= lines[j].StartBeat && beat <= lines[j].EndBeat)
{
- Line = j;
+ line = j;
break;
}
}
- if (Line >= 0)
+ if (line >= 0)
{
- if (Line != _Player[p].CurrentLine)
+ if (line != _Player[p].CurrentLine)
_Player[p].CurrentNote = -1;
- _Player[p].CurrentLine = Line;
+ _Player[p].CurrentLine = line;
- while (_Player[p].SingLine.Count <= Line)
+ while (_Player[p].SingLine.Count <= line)
_Player[p].SingLine.Add(new CLine());
- CNote[] notes = lines[Line].Notes;
- int Note = -1;
+ CNote[] notes = lines[line].Notes;
+ int note = -1;
for (int j = 0; j < notes.Length; j++)
{
if (beat >= notes[j].StartBeat && beat <= notes[j].EndBeat)
{
- Note = j;
+ note = j;
break;
}
}
- if (Note >= 0)
+ if (note >= 0)
{
- _Player[p].CurrentNote = Note;
+ _Player[p].CurrentNote = note;
- if (Line == lines.Length - 1)
+ if (line == lines.Length - 1)
{
- if (Note == lines[Line].NoteCount - 1)
+ if (note == lines[line].NoteCount - 1)
{
- if (notes[Note].EndBeat == beat)
+ if (notes[note].EndBeat == beat)
_Player[p].SongFinished = true;
}
}
- if (notes[Note].PointsForBeat > 0 && (CSound.RecordToneValid(p) || DEBUG_HIT))
+ if (notes[note].PointsForBeat > 0 && (CSound.RecordToneValid(p) || debugHit))
{
- int Tone = notes[Note].Tone;
- int TonePlayer = CSound.RecordGetTone(p);
+ int tone = notes[note].Tone;
+ int tonePlayer = CSound.RecordGetTone(p);
- while (TonePlayer - Tone > 6)
- TonePlayer -= 12;
+ while (tonePlayer - tone > 6)
+ tonePlayer -= 12;
- while (TonePlayer - Tone < -6)
- TonePlayer += 12;
+ while (tonePlayer - tone < -6)
+ tonePlayer += 12;
- if (DEBUG_HIT)
- TonePlayer = Tone;
+ if (debugHit)
+ tonePlayer = tone;
- _Player[p].NoteDiff = Math.Abs(Tone - TonePlayer);
- bool Hit = _Player[p].NoteDiff <= (2 - (int)_Player[p].Difficulty);
- if (Hit)
+ _Player[p].NoteDiff = Math.Abs(tone - tonePlayer);
+ 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 points = (CSettings.MaxScore - CSettings.LinebonusScore) * (double)notes[note].PointsForBeat /
song.Notes.GetLines(_Player[p].LineNr).Points;
- if (notes[Note].NoteType == ENoteType.Golden)
+ if (notes[note].NoteType == ENoteType.Golden)
_Player[p].PointsGoldenNotes += points;
_Player[p].Points += points;
// update player notes (sung notes)
- if (_Player[p].SingLine[Line].NoteCount > 0)
+ if (_Player[p].SingLine[line].NoteCount > 0)
{
- CNote nt = _Player[p].SingLine[Line].LastNote;
- 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));
+ CNote nt = _Player[p].SingLine[line].LastNote;
+ 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();
+ _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].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]);
+ _Player[p].SingLine[line].LastNote.IsPerfect(notes[note]);
+ _Player[p].SingLine[line].IsPerfect(lines[line]);
}
else
{
- if (_Player[p].SingLine[Line].NoteCount > 0)
+ if (_Player[p].SingLine[line].NoteCount > 0)
{
- CNote nt = _Player[p].SingLine[Line].LastNote;
- if (nt.Tone == TonePlayer && nt.EndBeat + 1 == beat && !nt.Hit)
- _Player[p].SingLine[Line].IncLastNoteLength();
+ 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));
+ _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));
+ _Player[p].SingLine[line].AddNote(new CNote(beat, 1, tonePlayer, String.Empty, false, ENoteType.Freestyle));
}
}
// Line Bonus
- int NumLinesWithPoints = song.Notes.GetNumLinesWithPoints(_Player[p].LineNr);
- if (Note == lines[Line].NoteCount - 1 && NumLinesWithPoints > 0)
+ int numLinesWithPoints = song.Notes.GetNumLinesWithPoints(_Player[p].LineNr);
+ if (note == lines[line].NoteCount - 1 && numLinesWithPoints > 0)
{
- if (notes[Note].EndBeat == beat && lines[Line].Points > 0f)
+ if (notes[note].EndBeat == beat && lines[line].Points > 0f)
{
- double factor = _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)
@@ -354,7 +354,7 @@ namespace Vocaluxe.Base
factor *= factor;
}
- double points = CSettings.LinebonusScore * factor * 1f / NumLinesWithPoints;
+ double points = CSettings.LinebonusScore * factor * 1f / numLinesWithPoints;
_Player[p].Points += points;
_Player[p].PointsLineBonus += points;
}
diff --git a/Vocaluxe/Base/CGraphics.cs b/Vocaluxe/Base/CGraphics.cs
index b06a93b9..860fbf15 100644
--- a/Vocaluxe/Base/CGraphics.cs
+++ b/Vocaluxe/Base/CGraphics.cs
@@ -34,14 +34,14 @@ namespace Vocaluxe.Base
public int X
{
- get { return (int)_Cursor.rect.X; }
- set { UpdatePosition(value, (int)_Cursor.rect.Y); }
+ get { return (int)_Cursor.Rect.X; }
+ set { UpdatePosition(value, (int)_Cursor.Rect.Y); }
}
public int Y
{
- get { return (int)_Cursor.rect.Y; }
- set { UpdatePosition((int)_Cursor.rect.X, value); }
+ get { return (int)_Cursor.Rect.Y; }
+ set { UpdatePosition((int)_Cursor.Rect.X, value); }
}
public bool IsActive
@@ -60,10 +60,10 @@ namespace Vocaluxe.Base
_CursorName = textureName;
_Cursor = CDraw.AddTexture(CTheme.GetSkinFilePath(_CursorName, -1));
- _Cursor.color = color;
- _Cursor.rect.W = w;
- _Cursor.rect.H = h;
- _Cursor.rect.Z = z;
+ _Cursor.Color = color;
+ _Cursor.Rect.W = w;
+ _Cursor.Rect.H = h;
+ _Cursor.Rect.Z = z;
_Movetimer = new Stopwatch();
}
@@ -73,7 +73,7 @@ namespace Vocaluxe.Base
if (_Movetimer.IsRunning && _Movetimer.ElapsedMilliseconds / 1000f > CSettings.MouseMoveOffTime)
{
_Movetimer.Stop();
- Fade(0f, 0.5f);
+ _Fade(0f, 0.5f);
}
@@ -83,14 +83,14 @@ namespace Vocaluxe.Base
if (t < _CursorFadingTime)
{
if (_CursorTargetAlpha >= _CursorStartAlpha)
- _Cursor.color.A = _CursorStartAlpha + (_CursorTargetAlpha - _CursorStartAlpha) * t / _CursorFadingTime;
+ _Cursor.Color.A = _CursorStartAlpha + (_CursorTargetAlpha - _CursorStartAlpha) * t / _CursorFadingTime;
else
- _Cursor.color.A = (_CursorStartAlpha - _CursorTargetAlpha) * (1f - t / _CursorFadingTime);
+ _Cursor.Color.A = (_CursorStartAlpha - _CursorTargetAlpha) * (1f - t / _CursorFadingTime);
}
else
{
_CursorFadingTimer.Stop();
- _Cursor.color.A = _CursorTargetAlpha;
+ _Cursor.Color.A = _CursorTargetAlpha;
}
}
@@ -100,19 +100,19 @@ namespace Vocaluxe.Base
public void UpdatePosition(int x, int y)
{
- if (Math.Abs(_Cursor.rect.X - x) > CSettings.MouseMoveDiffMin ||
- Math.Abs(_Cursor.rect.Y - y) > CSettings.MouseMoveDiffMin)
+ if (Math.Abs(_Cursor.Rect.X - x) > CSettings.MouseMoveDiffMin ||
+ Math.Abs(_Cursor.Rect.Y - y) > CSettings.MouseMoveDiffMin)
{
if (_CursorTargetAlpha == 0f)
- Fade(1f, 0.2f);
+ _Fade(1f, 0.2f);
_Movetimer.Reset();
_Movetimer.Start();
CSettings.MouseActive();
}
- _Cursor.rect.X = x;
- _Cursor.rect.Y = y;
+ _Cursor.Rect.X = x;
+ _Cursor.Rect.Y = y;
}
public void UnloadTextures()
@@ -130,17 +130,17 @@ namespace Vocaluxe.Base
public void FadeOut()
{
_Movetimer.Stop();
- Fade(0f, 0.5f);
+ _Fade(0f, 0.5f);
}
public void FadeIn()
{
_Movetimer.Reset();
_Movetimer.Start();
- Fade(1f, 0.2f);
+ _Fade(1f, 0.2f);
}
- private void Fade(float targetAlpha, float time)
+ private void _Fade(float targetAlpha, float time)
{
_CursorFadingTimer.Stop();
_CursorFadingTimer.Reset();
@@ -153,7 +153,7 @@ namespace Vocaluxe.Base
if (time >= 0f)
_CursorFadingTime = time;
- _CursorStartAlpha = _Cursor.color.A;
+ _CursorStartAlpha = _Cursor.Color.A;
_CursorFadingTimer.Start();
}
}
@@ -175,7 +175,7 @@ namespace Vocaluxe.Base
private static readonly List _PopupScreens = new List();
private static Stopwatch _VolumePopupTimer;
- private static bool CursorOverVolumeControl;
+ private static bool _CursorOverVolumeControl;
public static float GlobalAlpha
{
@@ -241,10 +241,10 @@ namespace Vocaluxe.Base
{
_Cursor = new CCursor(
CTheme.Cursor.SkinName,
- new SColorF(CTheme.Cursor.r, CTheme.Cursor.g, CTheme.Cursor.b, CTheme.Cursor.a),
- CTheme.Cursor.w,
- CTheme.Cursor.h,
- CSettings.zNear);
+ new SColorF(CTheme.Cursor.R, CTheme.Cursor.G, CTheme.Cursor.B, CTheme.Cursor.A),
+ CTheme.Cursor.W,
+ CTheme.Cursor.H,
+ CSettings.ZNear);
for (int i = 0; i < _Screens.Count; i++)
{
@@ -263,7 +263,7 @@ namespace Vocaluxe.Base
public static void ReloadTheme()
{
- ReloadCursor();
+ _ReloadCursor();
for (int i = 0; i < _Screens.Count; i++)
_Screens[i].ReloadTheme(CTheme.GetThemeScreensPath(-1));
@@ -273,7 +273,7 @@ namespace Vocaluxe.Base
public static void ReloadSkin()
{
- ReloadCursor();
+ _ReloadCursor();
for (int i = 0; i < _Screens.Count; i++)
_Screens[i].ReloadTextures();
@@ -297,13 +297,13 @@ namespace Vocaluxe.Base
_Screens[(int)_CurrentScreen].OnShowFinish();
}
- public static bool UpdateGameLogic(CKeys Keys, CMouse Mouse)
+ public static bool UpdateGameLogic(CKeys keys, CMouse mouse)
{
- bool _Run = true;
- _Cursor.CursorVisible = Mouse.Visible;
+ bool run = true;
+ _Cursor.CursorVisible = mouse.Visible;
- Mouse.CopyEvents();
- Keys.CopyEvents();
+ mouse.CopyEvents();
+ keys.CopyEvents();
CVideo.Update();
CSound.Update();
@@ -315,17 +315,17 @@ namespace Vocaluxe.Base
if (CSettings.GameState != EGameState.EditTheme)
{
- _Run &= HandleInputs(Keys, Mouse);
- _Run &= Update();
+ run &= _HandleInputs(keys, mouse);
+ run &= _Update();
CParty.UpdateGame();
}
else
{
- _Run &= HandleInputThemeEditor(Keys, Mouse);
- _Run &= Update();
+ run &= _HandleInputThemeEditor(keys, mouse);
+ run &= _Update();
}
- return _Run;
+ return run;
}
public static bool Draw()
@@ -350,18 +350,18 @@ namespace Vocaluxe.Base
if (_Fading)
{
- long FadeTime = (long)(CConfig.FadeTime * 1000);
+ long fadeTime = (long)(CConfig.FadeTime * 1000);
- if ((_FadingTimer.ElapsedMilliseconds < FadeTime) && (CConfig.FadeTime > 0))
+ if ((_FadingTimer.ElapsedMilliseconds < fadeTime) && (CConfig.FadeTime > 0))
{
long ms = 1;
if (_FadingTimer.ElapsedMilliseconds > 0)
ms = _FadingTimer.ElapsedMilliseconds;
- float factor = (float)ms / FadeTime;
+ float factor = (float)ms / fadeTime;
_GlobalAlpha = 1f; // -factor / 100f;
- _ZOffset = CSettings.zFar / 2;
+ _ZOffset = CSettings.ZFar / 2;
if (_CurrentScreen == EScreens.ScreenPartyDummy)
{
@@ -429,14 +429,14 @@ namespace Vocaluxe.Base
_PopupScreens[i].Draw();
_Cursor.Draw();
- DrawDebugInfos();
+ _DrawDebugInfos();
return true;
}
- public static void FadeTo(EScreens Screen)
+ public static void FadeTo(EScreens screen)
{
- if (Screen == EScreens.ScreenPartyDummy)
+ if (screen == EScreens.ScreenPartyDummy)
{
EScreens alt;
CMenu scr = CParty.GetNextPartyScreen(out alt);
@@ -448,22 +448,22 @@ namespace Vocaluxe.Base
_Screens[(int)EScreens.ScreenPartyDummy] = scr;
}
- _NextScreen = Screen;
+ _NextScreen = screen;
}
- public static void ShowPopup(EPopupScreens PopupScreen)
+ public static void ShowPopup(EPopupScreens popupScreen)
{
- _PopupScreens[(int)PopupScreen].OnShow();
- _PopupScreens[(int)PopupScreen].OnShowFinish();
- _CurrentPopupScreen = PopupScreen;
+ _PopupScreens[(int)popupScreen].OnShow();
+ _PopupScreens[(int)popupScreen].OnShowFinish();
+ _CurrentPopupScreen = popupScreen;
}
- public static void HidePopup(EPopupScreens PopupScreen)
+ public static void HidePopup(EPopupScreens popupScreen)
{
- if (_CurrentPopupScreen != PopupScreen)
+ if (_CurrentPopupScreen != popupScreen)
return;
- _PopupScreens[(int)PopupScreen].OnClose();
+ _PopupScreens[(int)popupScreen].OnClose();
_CurrentPopupScreen = EPopupScreens.NoPopup;
}
@@ -479,41 +479,41 @@ namespace Vocaluxe.Base
#endregion public methods
#region private stuff
- private static bool HandleInputs(CKeys keys, CMouse Mouse)
+ private static bool _HandleInputs(CKeys keys, CMouse mouse)
{
- KeyEvent KeyEvent = new KeyEvent();
- MouseEvent MouseEvent = new MouseEvent();
- KeyEvent InputKeyEvent = new KeyEvent();
- MouseEvent InputMouseEvent = new MouseEvent();
+ SKeyEvent keyEvent = new SKeyEvent();
+ SMouseEvent mouseEvent = new SMouseEvent();
+ SKeyEvent inputKeyEvent = new SKeyEvent();
+ SMouseEvent inputMouseEvent = new SMouseEvent();
- bool PopupPlayerControlAllowed = _CurrentScreen != EScreens.ScreenOptionsRecord && _CurrentScreen != EScreens.ScreenSing &&
+ bool popupPlayerControlAllowed = _CurrentScreen != EScreens.ScreenOptionsRecord && _CurrentScreen != EScreens.ScreenSing &&
(_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;
+ bool popupVolumeControlAllowed = _CurrentScreen != EScreens.ScreenCredits && _CurrentScreen != EScreens.ScreenOptionsRecord;
//Hide volume control for bg-music if bg-music is disabled
- if (PopupVolumeControlAllowed && (_CurrentScreen != EScreens.ScreenSong || (_CurrentScreen == EScreens.ScreenSong && CSongs.Category == -1))
+ if (popupVolumeControlAllowed && (_CurrentScreen != EScreens.ScreenSong || (_CurrentScreen == EScreens.ScreenSong && CSongs.Category == -1))
&& _CurrentScreen != EScreens.ScreenSing && CConfig.BackgroundMusic == EOffOn.TR_CONFIG_OFF)
- PopupVolumeControlAllowed = false;
+ popupVolumeControlAllowed = false;
- bool Resume = true;
- bool EventsAvailable = false;
- bool InputEventsAvailable = CInput.PollKeyEvent(ref InputKeyEvent);
+ bool resume = true;
+ bool eventsAvailable = false;
+ bool inputEventsAvailable = CInput.PollKeyEvent(ref inputKeyEvent);
- while ((EventsAvailable = keys.PollEvent(ref KeyEvent)) || InputEventsAvailable)
+ while ((eventsAvailable = keys.PollEvent(ref keyEvent)) || inputEventsAvailable)
{
- if (!EventsAvailable)
- KeyEvent = InputKeyEvent;
+ if (!eventsAvailable)
+ keyEvent = inputKeyEvent;
- if (KeyEvent.Key == Keys.Left || KeyEvent.Key == Keys.Right || KeyEvent.Key == Keys.Up || KeyEvent.Key == Keys.Down)
+ if (keyEvent.Key == Keys.Left || keyEvent.Key == Keys.Right || keyEvent.Key == Keys.Up || keyEvent.Key == Keys.Down)
{
CSettings.MouseInactive();
_Cursor.FadeOut();
}
- if (PopupPlayerControlAllowed && KeyEvent.Key == Keys.Tab)
+ if (popupPlayerControlAllowed && keyEvent.Key == Keys.Tab)
{
if (_CurrentPopupScreen == EPopupScreens.NoPopup && CConfig.BackgroundMusic == EOffOn.TR_CONFIG_ON)
ShowPopup(EPopupScreens.PopupPlayerControl);
@@ -521,13 +521,13 @@ namespace Vocaluxe.Base
HidePopup(EPopupScreens.PopupPlayerControl);
}
- if (PopupPlayerControlAllowed && CConfig.BackgroundMusic == EOffOn.TR_CONFIG_ON)
+ if (popupPlayerControlAllowed && CConfig.BackgroundMusic == EOffOn.TR_CONFIG_ON)
{
- if (KeyEvent.Key == Keys.MediaNextTrack)
+ if (keyEvent.Key == Keys.MediaNextTrack)
CMain.BackgroundMusic.Next();
- else if (KeyEvent.Key == Keys.MediaPreviousTrack)
+ else if (keyEvent.Key == Keys.MediaPreviousTrack)
CMain.BackgroundMusic.Previous();
- else if (KeyEvent.Key == Keys.MediaPlayPause)
+ else if (keyEvent.Key == Keys.MediaPlayPause)
{
if (CMain.BackgroundMusic.IsPlaying())
CMain.BackgroundMusic.Pause();
@@ -536,46 +536,46 @@ namespace Vocaluxe.Base
}
}
- if (PopupVolumeControlAllowed)
+ if (popupVolumeControlAllowed)
{
- 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))
- Diff = -5;
+ 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))
+ diff = -5;
- if (Diff != 0)
+ if (diff != 0)
{
switch (CurrentScreen)
{
case EScreens.ScreenSong:
if (CSongs.IsInCategory)
{
- CConfig.PreviewMusicVolume += Diff;
+ CConfig.PreviewMusicVolume += diff;
_Screens[(int)_CurrentScreen].ApplyVolume();
}
else
{
- CConfig.BackgroundMusicVolume += Diff;
+ CConfig.BackgroundMusicVolume += diff;
CBackgroundMusic.ApplyVolume();
}
break;
case EScreens.ScreenSing:
- CConfig.GameMusicVolume += Diff;
+ CConfig.GameMusicVolume += diff;
_Screens[(int)_CurrentScreen].ApplyVolume();
break;
default:
- CConfig.BackgroundMusicVolume += Diff;
+ CConfig.BackgroundMusicVolume += diff;
CBackgroundMusic.ApplyVolume();
break;
}
CConfig.SaveConfig();
}
- if (_CurrentPopupScreen == EPopupScreens.NoPopup && Diff != 0)
+ if (_CurrentPopupScreen == EPopupScreens.NoPopup && diff != 0)
{
ShowPopup(EPopupScreens.PopupVolumeControl);
_VolumePopupTimer.Reset();
@@ -585,11 +585,11 @@ namespace Vocaluxe.Base
CMain.BackgroundMusic.ApplyVolume();
}
- if (KeyEvent.ModSHIFT && (KeyEvent.Key == Keys.F1))
+ if (keyEvent.ModShift && (keyEvent.Key == Keys.F1))
CSettings.GameState = EGameState.EditTheme;
- else if (KeyEvent.ModALT && (KeyEvent.Key == Keys.Enter))
- CSettings.bFullScreen = !CSettings.bFullScreen;
- else if (KeyEvent.ModALT && (KeyEvent.Key == Keys.P))
+ else if (keyEvent.ModAlt && (keyEvent.Key == Keys.Enter))
+ CSettings.IsFullScreen = !CSettings.IsFullScreen;
+ else if (keyEvent.ModAlt && (keyEvent.Key == Keys.P))
CDraw.MakeScreenShot();
else
{
@@ -597,34 +597,34 @@ namespace Vocaluxe.Base
{
bool handled = false;
if (_CurrentPopupScreen != EPopupScreens.NoPopup)
- handled = _PopupScreens[(int)_CurrentPopupScreen].HandleInput(KeyEvent);
+ handled = _PopupScreens[(int)_CurrentPopupScreen].HandleInput(keyEvent);
if (!handled)
- Resume &= _Screens[(int)_CurrentScreen].HandleInput(KeyEvent);
+ resume &= _Screens[(int)_CurrentScreen].HandleInput(keyEvent);
}
}
- if (!EventsAvailable)
- InputEventsAvailable = CInput.PollKeyEvent(ref InputKeyEvent);
+ if (!eventsAvailable)
+ inputEventsAvailable = CInput.PollKeyEvent(ref inputKeyEvent);
}
- InputEventsAvailable = CInput.PollMouseEvent(ref InputMouseEvent);
+ inputEventsAvailable = CInput.PollMouseEvent(ref inputMouseEvent);
- while ((EventsAvailable = Mouse.PollEvent(ref MouseEvent)) || InputEventsAvailable)
+ while ((eventsAvailable = mouse.PollEvent(ref mouseEvent)) || inputEventsAvailable)
{
- if (!EventsAvailable)
- MouseEvent = InputMouseEvent;
+ if (!eventsAvailable)
+ mouseEvent = inputMouseEvent;
- if (MouseEvent.Wheel != 0)
+ if (mouseEvent.Wheel != 0)
{
CSettings.MouseActive();
_Cursor.FadeIn();
}
- UpdateMousePosition(MouseEvent.X, MouseEvent.Y);
+ _UpdateMousePosition(mouseEvent.X, mouseEvent.Y);
- bool isOverPopupPlayerControl = CHelper.IsInBounds(_PopupScreens[(int)EPopupScreens.PopupPlayerControl].ScreenArea, MouseEvent);
- if (PopupPlayerControlAllowed && isOverPopupPlayerControl)
+ bool isOverPopupPlayerControl = CHelper.IsInBounds(_PopupScreens[(int)EPopupScreens.PopupPlayerControl].ScreenArea, mouseEvent);
+ if (popupPlayerControlAllowed && isOverPopupPlayerControl)
{
if (_CurrentPopupScreen == EPopupScreens.NoPopup && CConfig.BackgroundMusic == EOffOn.TR_CONFIG_ON)
ShowPopup(EPopupScreens.PopupPlayerControl);
@@ -633,8 +633,8 @@ namespace Vocaluxe.Base
if (!isOverPopupPlayerControl && _CurrentPopupScreen == EPopupScreens.PopupPlayerControl)
HidePopup(EPopupScreens.PopupPlayerControl);
- bool isOverPopupVolumeControl = CHelper.IsInBounds(_PopupScreens[(int)EPopupScreens.PopupVolumeControl].ScreenArea, MouseEvent);
- if (PopupVolumeControlAllowed && isOverPopupVolumeControl)
+ bool isOverPopupVolumeControl = CHelper.IsInBounds(_PopupScreens[(int)EPopupScreens.PopupVolumeControl].ScreenArea, mouseEvent);
+ if (popupVolumeControlAllowed && isOverPopupVolumeControl)
{
if (_CurrentPopupScreen == EPopupScreens.NoPopup)
{
@@ -644,7 +644,7 @@ namespace Vocaluxe.Base
}
}
- if (CursorOverVolumeControl && !isOverPopupVolumeControl)
+ if (_CursorOverVolumeControl && !isOverPopupVolumeControl)
{
if (_CurrentPopupScreen == EPopupScreens.PopupVolumeControl)
{
@@ -652,64 +652,64 @@ namespace Vocaluxe.Base
_VolumePopupTimer.Reset();
}
}
- CursorOverVolumeControl = isOverPopupVolumeControl;
+ _CursorOverVolumeControl = isOverPopupVolumeControl;
bool handled = false;
if (_CurrentPopupScreen != EPopupScreens.NoPopup)
- handled = _PopupScreens[(int)_CurrentPopupScreen].HandleMouse(MouseEvent);
+ handled = _PopupScreens[(int)_CurrentPopupScreen].HandleMouse(mouseEvent);
if (handled && _CurrentPopupScreen == EPopupScreens.PopupVolumeControl)
_Screens[(int)_CurrentScreen].ApplyVolume();
- if (!handled && !_Fading && (_Cursor.IsActive || MouseEvent.LB || MouseEvent.RB || MouseEvent.MB))
- Resume &= _Screens[(int)_CurrentScreen].HandleMouse(MouseEvent);
+ if (!handled && !_Fading && (_Cursor.IsActive || mouseEvent.LB || mouseEvent.RB || mouseEvent.MB))
+ resume &= _Screens[(int)_CurrentScreen].HandleMouse(mouseEvent);
- if (!EventsAvailable)
- InputEventsAvailable = CInput.PollMouseEvent(ref InputMouseEvent);
+ if (!eventsAvailable)
+ inputEventsAvailable = CInput.PollMouseEvent(ref inputMouseEvent);
}
- return Resume;
+ return resume;
}
- private static bool HandleInputThemeEditor(CKeys keys, CMouse Mouse)
+ private static bool _HandleInputThemeEditor(CKeys keys, CMouse mouse)
{
- KeyEvent KeyEvent = new KeyEvent();
- MouseEvent MouseEvent = new MouseEvent();
+ SKeyEvent keyEvent = new SKeyEvent();
+ SMouseEvent mouseEvent = new SMouseEvent();
- while (keys.PollEvent(ref KeyEvent))
+ while (keys.PollEvent(ref keyEvent))
{
- if (KeyEvent.ModSHIFT && (KeyEvent.Key == Keys.F1))
+ if (keyEvent.ModShift && (keyEvent.Key == Keys.F1))
{
CSettings.GameState = EGameState.Normal;
_Screens[(int)_CurrentScreen].NextInteraction();
}
- else if (KeyEvent.ModALT && (KeyEvent.Key == Keys.Enter))
- CSettings.bFullScreen = !CSettings.bFullScreen;
- else if (KeyEvent.ModALT && (KeyEvent.Key == Keys.P))
+ else if (keyEvent.ModAlt && (keyEvent.Key == Keys.Enter))
+ CSettings.IsFullScreen = !CSettings.IsFullScreen;
+ else if (keyEvent.ModAlt && (keyEvent.Key == Keys.P))
CDraw.MakeScreenShot();
else
{
if (!_Fading)
- _Screens[(int)_CurrentScreen].HandleInputThemeEditor(KeyEvent);
+ _Screens[(int)_CurrentScreen].HandleInputThemeEditor(keyEvent);
}
}
- while (Mouse.PollEvent(ref MouseEvent))
+ while (mouse.PollEvent(ref mouseEvent))
{
if (!_Fading)
- _Screens[(int)_CurrentScreen].HandleMouseThemeEditor(MouseEvent);
+ _Screens[(int)_CurrentScreen].HandleMouseThemeEditor(mouseEvent);
- UpdateMousePosition(MouseEvent.X, MouseEvent.Y);
+ _UpdateMousePosition(mouseEvent.X, mouseEvent.Y);
}
return true;
}
- private static void UpdateMousePosition(int x, int y)
+ private static void _UpdateMousePosition(int x, int y)
{
_Cursor.UpdatePosition(x, y);
}
- private static bool Update()
+ private static bool _Update()
{
if (_VolumePopupTimer.IsRunning && _VolumePopupTimer.ElapsedMilliseconds >= 1500 && _CurrentPopupScreen == EPopupScreens.PopupVolumeControl)
{
@@ -725,22 +725,22 @@ namespace Vocaluxe.Base
return _Screens[(int)_CurrentScreen].UpdateGame();
}
- private static void DrawDebugInfos()
+ private static void _DrawDebugInfos()
{
string txt = String.Empty;
CFonts.Style = EStyle.Normal;
CFonts.SetFont("Normal");
- SColorF Gray = new SColorF(1f, 1f, 1f, 0.5f);
+ SColorF gray = new SColorF(1f, 1f, 1f, 0.5f);
float dy = 0;
if (CConfig.DebugLevel >= EDebugLevel.TR_CONFIG_ONLY_FPS)
{
txt = CTime.GetFPS().ToString("FPS: 000");
CFonts.Height = 30f;
- RectangleF rect = new RectangleF(CSettings.iRenderW - CFonts.GetTextWidth(txt), dy, CFonts.GetTextWidth(txt), CFonts.GetTextHeight(txt));
+ RectangleF rect = new RectangleF(CSettings.RenderW - CFonts.GetTextWidth(txt), dy, CFonts.GetTextWidth(txt), CFonts.GetTextHeight(txt));
- CDraw.DrawColor(Gray, new SRectF(rect.X, rect.Top, rect.Width, rect.Height, CSettings.zNear));
- CFonts.DrawText(txt, rect.X, rect.Y, CSettings.zNear);
+ CDraw.DrawColor(gray, new SRectF(rect.X, rect.Top, rect.Width, rect.Height, CSettings.ZNear));
+ CFonts.DrawText(txt, rect.X, rect.Y, CSettings.ZNear);
dy += rect.Height;
}
@@ -748,10 +748,10 @@ namespace Vocaluxe.Base
{
txt = CSound.GetStreamCount().ToString(CLanguage.Translate("TR_DEBUG_AUDIO_STREAMS") + ": 00");
- RectangleF rect = new RectangleF(CSettings.iRenderW - CFonts.GetTextWidth(txt), dy, CFonts.GetTextWidth(txt), CFonts.GetTextHeight(txt));
+ RectangleF rect = new RectangleF(CSettings.RenderW - CFonts.GetTextWidth(txt), dy, CFonts.GetTextWidth(txt), CFonts.GetTextHeight(txt));
- CDraw.DrawColor(Gray, new SRectF(rect.X, rect.Top, rect.Width, rect.Height, CSettings.zNear));
- CFonts.DrawText(txt, rect.X, rect.Y, CSettings.zNear);
+ CDraw.DrawColor(gray, new SRectF(rect.X, rect.Top, rect.Width, rect.Height, CSettings.ZNear));
+ CFonts.DrawText(txt, rect.X, rect.Y, CSettings.ZNear);
dy += rect.Height;
}
@@ -759,10 +759,10 @@ namespace Vocaluxe.Base
{
txt = CVideo.GetNumStreams().ToString(CLanguage.Translate("TR_DEBUG_VIDEO_STREAMS") + ": 00");
- RectangleF rect = new RectangleF(CSettings.iRenderW - CFonts.GetTextWidth(txt), dy, CFonts.GetTextWidth(txt), CFonts.GetTextHeight(txt));
+ RectangleF rect = new RectangleF(CSettings.RenderW - CFonts.GetTextWidth(txt), dy, CFonts.GetTextWidth(txt), CFonts.GetTextHeight(txt));
- CDraw.DrawColor(Gray, new SRectF(rect.X, rect.Top, rect.Width, rect.Height, CSettings.zNear));
- CFonts.DrawText(txt, rect.X, rect.Y, CSettings.zNear);
+ CDraw.DrawColor(gray, new SRectF(rect.X, rect.Top, rect.Width, rect.Height, CSettings.ZNear));
+ CFonts.DrawText(txt, rect.X, rect.Y, CSettings.ZNear);
dy += rect.Height;
}
@@ -770,10 +770,10 @@ namespace Vocaluxe.Base
{
txt = CDraw.TextureCount().ToString(CLanguage.Translate("TR_DEBUG_TEXTURES") + ": 00000");
- RectangleF rect = new RectangleF(CSettings.iRenderW - CFonts.GetTextWidth(txt), dy, CFonts.GetTextWidth(txt), CFonts.GetTextHeight(txt));
+ RectangleF rect = new RectangleF(CSettings.RenderW - CFonts.GetTextWidth(txt), dy, CFonts.GetTextWidth(txt), CFonts.GetTextHeight(txt));
- CDraw.DrawColor(Gray, new SRectF(rect.X, rect.Top, rect.Width, rect.Height, CSettings.zNear));
- CFonts.DrawText(txt, rect.X, rect.Y, CSettings.zNear);
+ CDraw.DrawColor(gray, new SRectF(rect.X, rect.Top, rect.Width, rect.Height, CSettings.ZNear));
+ CFonts.DrawText(txt, rect.X, rect.Y, CSettings.ZNear);
dy += rect.Height;
}
@@ -782,10 +782,10 @@ namespace Vocaluxe.Base
long memory = GC.GetTotalMemory(false);
txt = (memory / 1000000L).ToString(CLanguage.Translate("TR_DEBUG_MEMORY") + ": 00000 MB");
- RectangleF rect = new RectangleF(CSettings.iRenderW - CFonts.GetTextWidth(txt), dy, CFonts.GetTextWidth(txt), CFonts.GetTextHeight(txt));
+ RectangleF rect = new RectangleF(CSettings.RenderW - CFonts.GetTextWidth(txt), dy, CFonts.GetTextWidth(txt), CFonts.GetTextHeight(txt));
- CDraw.DrawColor(Gray, new SRectF(rect.X, rect.Top, rect.Width, rect.Height, CSettings.zNear));
- CFonts.DrawText(txt, rect.X, rect.Y, CSettings.zNear);
+ CDraw.DrawColor(gray, new SRectF(rect.X, rect.Top, rect.Width, rect.Height, CSettings.ZNear));
+ CFonts.DrawText(txt, rect.X, rect.Y, CSettings.ZNear);
dy += rect.Height;
}
@@ -793,36 +793,36 @@ namespace Vocaluxe.Base
{
txt = CSound.RecordGetToneAbs(0).ToString(CLanguage.Translate("TR_DEBUG_TONE_ABS") + " P1: 00");
- RectangleF rect = new RectangleF(CSettings.iRenderW - CFonts.GetTextWidth(txt), dy, CFonts.GetTextWidth(txt), CFonts.GetTextHeight(txt));
+ RectangleF rect = new RectangleF(CSettings.RenderW - CFonts.GetTextWidth(txt), dy, CFonts.GetTextWidth(txt), CFonts.GetTextHeight(txt));
- CDraw.DrawColor(Gray, new SRectF(rect.X, rect.Top, rect.Width, rect.Height, CSettings.zNear));
- CFonts.DrawText(txt, rect.X, rect.Y, CSettings.zNear);
+ CDraw.DrawColor(gray, new SRectF(rect.X, rect.Top, rect.Width, rect.Height, CSettings.ZNear));
+ CFonts.DrawText(txt, rect.X, rect.Y, CSettings.ZNear);
dy += rect.Height;
txt = CSound.RecordGetMaxVolume(0).ToString(CLanguage.Translate("TR_DEBUG_MAX_VOLUME") + " P1: 0.000");
- rect = new RectangleF(CSettings.iRenderW - CFonts.GetTextWidth(txt), dy, CFonts.GetTextWidth(txt), CFonts.GetTextHeight(txt));
+ rect = new RectangleF(CSettings.RenderW - CFonts.GetTextWidth(txt), dy, CFonts.GetTextWidth(txt), CFonts.GetTextHeight(txt));
- CDraw.DrawColor(Gray, new SRectF(rect.X, rect.Top, rect.Width, rect.Height, CSettings.zNear));
- CFonts.DrawText(txt, rect.X, rect.Y, CSettings.zNear);
+ CDraw.DrawColor(gray, new SRectF(rect.X, rect.Top, rect.Width, rect.Height, CSettings.ZNear));
+ CFonts.DrawText(txt, rect.X, rect.Y, CSettings.ZNear);
dy += rect.Height;
txt = CSound.RecordGetToneAbs(1).ToString(CLanguage.Translate("TR_DEBUG_TONE_ABS") + " P2: 00");
- rect = new RectangleF(CSettings.iRenderW - CFonts.GetTextWidth(txt), dy, CFonts.GetTextWidth(txt), CFonts.GetTextHeight(txt));
+ rect = new RectangleF(CSettings.RenderW - CFonts.GetTextWidth(txt), dy, CFonts.GetTextWidth(txt), CFonts.GetTextHeight(txt));
- CDraw.DrawColor(Gray, new SRectF(rect.X, rect.Top, rect.Width, rect.Height, CSettings.zNear));
- CFonts.DrawText(txt, rect.X, rect.Y, CSettings.zNear);
+ CDraw.DrawColor(gray, new SRectF(rect.X, rect.Top, rect.Width, rect.Height, CSettings.ZNear));
+ CFonts.DrawText(txt, rect.X, rect.Y, CSettings.ZNear);
dy += rect.Height;
txt = CSound.RecordGetMaxVolume(1).ToString(CLanguage.Translate("TR_DEBUG_MAX_VOLUME") + " P2: 0.000");
- rect = new RectangleF(CSettings.iRenderW - CFonts.GetTextWidth(txt), dy, CFonts.GetTextWidth(txt), CFonts.GetTextHeight(txt));
+ rect = new RectangleF(CSettings.RenderW - CFonts.GetTextWidth(txt), dy, CFonts.GetTextWidth(txt), CFonts.GetTextHeight(txt));
- CDraw.DrawColor(Gray, new SRectF(rect.X, rect.Top, rect.Width, rect.Height, CSettings.zNear));
- CFonts.DrawText(txt, rect.X, rect.Y, CSettings.zNear);
+ CDraw.DrawColor(gray, new SRectF(rect.X, rect.Top, rect.Width, rect.Height, CSettings.ZNear));
+ CFonts.DrawText(txt, rect.X, rect.Y, CSettings.ZNear);
dy += rect.Height;
}
@@ -830,10 +830,10 @@ namespace Vocaluxe.Base
{
txt = CSongs.NumSongsWithCoverLoaded.ToString(CLanguage.Translate("TR_DEBUG_SONGS") + ": 00000");
- RectangleF rect = new RectangleF(CSettings.iRenderW - CFonts.GetTextWidth(txt), dy, CFonts.GetTextWidth(txt), CFonts.GetTextHeight(txt));
+ RectangleF rect = new RectangleF(CSettings.RenderW - CFonts.GetTextWidth(txt), dy, CFonts.GetTextWidth(txt), CFonts.GetTextHeight(txt));
- CDraw.DrawColor(Gray, new SRectF(rect.X, rect.Top, rect.Width, rect.Height, CSettings.zNear));
- CFonts.DrawText(txt, rect.X, rect.Y, CSettings.zNear);
+ CDraw.DrawColor(gray, new SRectF(rect.X, rect.Top, rect.Width, rect.Height, CSettings.ZNear));
+ CFonts.DrawText(txt, rect.X, rect.Y, CSettings.ZNear);
dy += rect.Height;
}
@@ -841,34 +841,34 @@ namespace Vocaluxe.Base
{
txt = _Cursor.X.ToString(CLanguage.Translate("TR_DEBUG_MOUSE") + " : (0000/") + _Cursor.Y.ToString("0000)");
- RectangleF rect = new RectangleF(CSettings.iRenderW - CFonts.GetTextWidth(txt), dy, CFonts.GetTextWidth(txt), CFonts.GetTextHeight(txt));
+ RectangleF rect = new RectangleF(CSettings.RenderW - CFonts.GetTextWidth(txt), dy, CFonts.GetTextWidth(txt), CFonts.GetTextHeight(txt));
- CDraw.DrawColor(Gray, new SRectF(rect.X, rect.Top, rect.Width, rect.Height, CSettings.zNear));
- CFonts.DrawText(txt, rect.X, rect.Y, CSettings.zNear);
+ CDraw.DrawColor(gray, new SRectF(rect.X, rect.Top, rect.Width, rect.Height, CSettings.ZNear));
+ CFonts.DrawText(txt, rect.X, rect.Y, CSettings.ZNear);
dy += rect.Height;
}
}
- private static void ReloadCursor()
+ private static void _ReloadCursor()
{
_Cursor.UnloadTextures();
- if (CTheme.Cursor.color.Length > 0)
+ if (CTheme.Cursor.Color.Length > 0)
{
SColorF color;
- color = CTheme.GetColor(CTheme.Cursor.color, -1);
- CTheme.Cursor.r = color.R;
- CTheme.Cursor.g = color.G;
- CTheme.Cursor.b = color.B;
- CTheme.Cursor.a = color.A;
+ color = CTheme.GetColor(CTheme.Cursor.Color, -1);
+ CTheme.Cursor.R = color.R;
+ CTheme.Cursor.G = color.G;
+ CTheme.Cursor.B = color.B;
+ CTheme.Cursor.A = color.A;
}
_Cursor = new CCursor(
CTheme.Cursor.SkinName,
- new SColorF(CTheme.Cursor.r, CTheme.Cursor.g, CTheme.Cursor.b, CTheme.Cursor.a),
- CTheme.Cursor.w,
- CTheme.Cursor.h,
- CSettings.zNear);
+ new SColorF(CTheme.Cursor.R, CTheme.Cursor.G, CTheme.Cursor.B, CTheme.Cursor.A),
+ CTheme.Cursor.W,
+ CTheme.Cursor.H,
+ CSettings.ZNear);
}
#endregion private stuff
}
diff --git a/Vocaluxe/Base/CInput.cs b/Vocaluxe/Base/CInput.cs
index 380d9cee..8ba98ba9 100644
--- a/Vocaluxe/Base/CInput.cs
+++ b/Vocaluxe/Base/CInput.cs
@@ -41,19 +41,19 @@ namespace Vocaluxe.Base
_Input.Update();
}
- public static bool PollKeyEvent(ref KeyEvent KeyEvent)
+ public static bool PollKeyEvent(ref SKeyEvent keyEvent)
{
- return _Input.PollKeyEvent(ref KeyEvent);
+ return _Input.PollKeyEvent(ref keyEvent);
}
- public static bool PollMouseEvent(ref MouseEvent MouseEvent)
+ public static bool PollMouseEvent(ref SMouseEvent mouseEvent)
{
- return _Input.PollMouseEvent(ref MouseEvent);
+ return _Input.PollMouseEvent(ref mouseEvent);
}
- public static void SetRumble(float Duration)
+ public static void SetRumble(float duration)
{
- _Input.SetRumble(Duration);
+ _Input.SetRumble(duration);
}
}
}
\ No newline at end of file
diff --git a/Vocaluxe/Base/CLanguage.cs b/Vocaluxe/Base/CLanguage.cs
index b7800ab7..a4d30909 100644
--- a/Vocaluxe/Base/CLanguage.cs
+++ b/Vocaluxe/Base/CLanguage.cs
@@ -24,7 +24,7 @@ namespace Vocaluxe.Base
static class CLanguage
{
- private static readonly XmlWriterSettings _settings = new XmlWriterSettings();
+ private static readonly XmlWriterSettings _Settings = new XmlWriterSettings();
private static List _Languages;
private static int _CurrentLanguage;
private static int _FallbackLanguage;
@@ -46,31 +46,31 @@ namespace Vocaluxe.Base
public static string[] GetLanguageNames()
{
- string[] Languages = new string[_Languages.Count];
+ string[] languages = new string[_Languages.Count];
for (int i = 0; i < _Languages.Count; i++)
- Languages[i] = _Languages[i].Name;
+ languages[i] = _Languages[i].Name;
- return Languages;
+ return languages;
}
public static void Init()
{
_Languages = new List();
- _settings.Indent = true;
- _settings.Encoding = Encoding.UTF8;
- _settings.ConformanceLevel = ConformanceLevel.Document;
+ _Settings.Indent = true;
+ _Settings.Encoding = Encoding.UTF8;
+ _Settings.ConformanceLevel = ConformanceLevel.Document;
List files = new List();
- files.AddRange(CHelper.ListFiles(CSettings.sFolderLanguages, "*.xml", true, true));
+ files.AddRange(CHelper.ListFiles(CSettings.FolderLanguages, "*.xml", true, true));
foreach (string file in files)
- LoadLanguageFile(file);
+ _LoadLanguageFile(file);
}
- public static bool SetLanguage(string Language)
+ public static bool SetLanguage(string language)
{
- int nr = GetLanguageNr(Language);
+ int nr = GetLanguageNr(language);
if (nr != -1)
{
_CurrentLanguage = nr;
@@ -79,92 +79,92 @@ namespace Vocaluxe.Base
return false;
}
- public static int GetLanguageNr(string Language)
+ public static int GetLanguageNr(string language)
{
for (int i = 0; i < _Languages.Count; i++)
{
- if (_Languages[i].Name == Language)
+ if (_Languages[i].Name == language)
return i;
}
return -1;
}
- public static string Translate(string KeyWord)
+ public static string Translate(string keyWord)
{
- return Translate(KeyWord, -1);
+ return Translate(keyWord, -1);
}
- public static string Translate(string KeyWord, int PartyModeID)
+ public static string Translate(string keyWord, int partyModeID)
{
- if (KeyWord == null)
+ if (keyWord == null)
return "Error";
- if (KeyWord.Length < 3 || KeyWord.Substring(0, 3) != "TR_")
- return KeyWord;
+ if (keyWord.Length < 3 || keyWord.Substring(0, 3) != "TR_")
+ return keyWord;
string result;
- if (PartyModeID != -1)
+ if (partyModeID != -1)
{
- int PartyModeNr = GetPartyModeNr(PartyModeID, _CurrentLanguage);
- if (PartyModeNr != -1 && _Languages[_CurrentLanguage].PartyModeTexts[PartyModeNr].Texts.TryGetValue(KeyWord, out result))
+ 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))
+ partyModeNr = _GetPartyModeNr(partyModeID, _FallbackLanguage);
+ if (partyModeNr != -1 && _Languages[_CurrentLanguage].PartyModeTexts[partyModeNr].Texts.TryGetValue(keyWord, out result))
return result;
}
- if (_Languages[_CurrentLanguage].Texts.TryGetValue(KeyWord, out result))
+ if (_Languages[_CurrentLanguage].Texts.TryGetValue(keyWord, out result))
return result;
- if (_Languages[_FallbackLanguage].Texts.TryGetValue(KeyWord, out result))
+ if (_Languages[_FallbackLanguage].Texts.TryGetValue(keyWord, out result))
return result;
- return KeyWord;
+ return keyWord;
}
- public static bool TranslationExists(string KeyWord, int PartyModeID = -1)
+ public static bool TranslationExists(string keyWord, int partyModeID = -1)
{
- if (KeyWord == null)
+ if (keyWord == null)
return false;
- if (KeyWord.Length < 3 || KeyWord.Substring(0, 3) != "TR_")
+ if (keyWord.Length < 3 || keyWord.Substring(0, 3) != "TR_")
return false;
- if (PartyModeID != -1)
+ if (partyModeID != -1)
{
- int PartyModeNr = GetPartyModeNr(PartyModeID, _CurrentLanguage);
- if (PartyModeNr != -1 && _Languages[_CurrentLanguage].PartyModeTexts[PartyModeNr].Texts.ContainsKey(KeyWord))
+ 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))
+ partyModeNr = _GetPartyModeNr(partyModeID, _FallbackLanguage);
+ if (partyModeNr != -1 && _Languages[_CurrentLanguage].PartyModeTexts[partyModeNr].Texts.ContainsKey(keyWord))
return true;
}
- if (_Languages[_CurrentLanguage].Texts.ContainsKey(KeyWord))
+ if (_Languages[_CurrentLanguage].Texts.ContainsKey(keyWord))
return true;
- if (_Languages[_FallbackLanguage].Texts.ContainsKey(KeyWord))
+ if (_Languages[_FallbackLanguage].Texts.ContainsKey(keyWord))
return true;
return false;
}
- public static bool LoadPartyLanguageFiles(int PartyModeID, string Path)
+ public static bool LoadPartyLanguageFiles(int partyModeID, string path)
{
List files = new List();
- files.AddRange(CHelper.ListFiles(Path, "*.xml", true, true));
+ files.AddRange(CHelper.ListFiles(path, "*.xml", true, true));
foreach (string file in files)
{
- if (!LoadPartyLanguageFile(PartyModeID, file))
+ if (!_LoadPartyLanguageFile(partyModeID, file))
return false;
}
return true;
}
- private static bool _LoadLanguageEntries(CXMLReader xmlReader, ref Dictionary Texts)
+ private static bool _LoadLanguageEntries(CXMLReader xmlReader, ref Dictionary texts)
{
- Texts = new Dictionary();
+ texts = new Dictionary();
List names = xmlReader.GetAttributes("resources", "name");
string value = string.Empty;
foreach (string name in names)
@@ -173,7 +173,7 @@ namespace Vocaluxe.Base
{
try
{
- Texts.Add(name, value);
+ texts.Add(name, value);
}
catch (Exception e)
{
@@ -185,7 +185,7 @@ namespace Vocaluxe.Base
return true;
}
- private static bool LoadPartyLanguageFile(int PartyModeID, string file)
+ private static bool _LoadPartyLanguageFile(int partyModeID, string file)
{
CXMLReader xmlReader = CXMLReader.OpenFile(file);
if (xmlReader == null)
@@ -200,7 +200,7 @@ namespace Vocaluxe.Base
return true;
SPartyLanguage lang = new SPartyLanguage();
- lang.PartyModeID = PartyModeID;
+ lang.PartyModeID = partyModeID;
if (!_LoadLanguageEntries(xmlReader, ref lang.Texts))
return false;
@@ -214,10 +214,10 @@ namespace Vocaluxe.Base
}
}
- private static void LoadLanguageFile(string FileName)
+ private static void _LoadLanguageFile(string fileName)
{
SLanguage lang = new SLanguage();
- lang.LanguageFilePath = Path.Combine(CSettings.sFolderLanguages, FileName);
+ lang.LanguageFilePath = Path.Combine(CSettings.FolderLanguages, fileName);
CXMLReader xmlReader = CXMLReader.OpenFile(lang.LanguageFilePath);
if (xmlReader == null)
@@ -239,11 +239,11 @@ namespace Vocaluxe.Base
}
}
- private static int GetPartyModeNr(int PartyModeID, int Language)
+ private static int _GetPartyModeNr(int partyModeID, int language)
{
- for (int i = 0; i < _Languages[Language].PartyModeTexts.Count; i++)
+ for (int i = 0; i < _Languages[language].PartyModeTexts.Count; i++)
{
- if (_Languages[Language].PartyModeTexts[i].PartyModeID == PartyModeID)
+ if (_Languages[language].PartyModeTexts[i].PartyModeID == partyModeID)
return i;
}
return -1;
diff --git a/Vocaluxe/Base/CLog.cs b/Vocaluxe/Base/CLog.cs
index c78005f3..c72f6a86 100644
--- a/Vocaluxe/Base/CLog.cs
+++ b/Vocaluxe/Base/CLog.cs
@@ -5,49 +5,48 @@ using System.Text;
namespace Vocaluxe.Base
{
- class Log : IDisposable
+ class CLogFile : IDisposable
{
private readonly string _LogFileName;
private readonly string _LogName;
private StreamWriter _LogFile;
- public Log(string FileName, string LogName)
+ public CLogFile(string fileName, string logName)
{
- _LogName = LogName;
- _LogFileName = FileName;
+ _LogName = logName;
+ _LogFileName = fileName;
}
public void Close()
{
- if (_LogFile != null)
+ if (_LogFile == null)
+ return;
+ try
{
- try
- {
- _LogFile.Flush();
- _LogFile.Close();
- }
- catch (Exception) {}
+ _LogFile.Flush();
+ _LogFile.Close();
}
+ catch (Exception) {}
}
- public void Add(string Text)
+ public void Add(string text)
{
if (_LogFile == null)
- Open();
+ _Open();
try
{
- _LogFile.WriteLine(Text);
+ _LogFile.WriteLine(text);
_LogFile.Flush();
}
catch (Exception) {}
}
- private void Open()
+ private void _Open()
{
_LogFile = new StreamWriter(Path.Combine(Environment.CurrentDirectory, _LogFileName), false, Encoding.UTF8);
- _LogFile.WriteLine(_LogName + " " + CSettings.GetFullVersionText() + " " + DateTime.Now.ToString());
+ _LogFile.WriteLine(_LogName + " " + CSettings.GetFullVersionText() + " " + DateTime.Now);
_LogFile.WriteLine("----------------------------------------");
_LogFile.WriteLine();
}
@@ -65,24 +64,24 @@ namespace Vocaluxe.Base
static class CLog
{
- private const int MAXBenchmarks = 10;
+ private const int _MaxBenchmarks = 10;
- private static Log _ErrorLog;
- private static Log _PerformanceLog;
- private static Log _BenchmarkLog;
+ private static CLogFile _ErrorLog;
+ private static CLogFile _PerformanceLog;
+ private static CLogFile _BenchmarkLog;
private static int _NumErrors;
private static Stopwatch[] _BenchmarkTimer;
- private static readonly double nanosecPerTick = (1000.0 * 1000.0 * 1000.0) / Stopwatch.Frequency;
+ private static readonly double _NanosecPerTick = (1000.0 * 1000.0 * 1000.0) / Stopwatch.Frequency;
public static void Init()
{
- _ErrorLog = new Log(CSettings.sFileErrorLog, "ErrorLog");
- _PerformanceLog = new Log(CSettings.sFilePerformanceLog, "PerformanceLog");
- _BenchmarkLog = new Log(CSettings.sFileBenchmarkLog, "BenchmarkLog");
+ _ErrorLog = new CLogFile(CSettings.FileErrorLog, "ErrorLog");
+ _PerformanceLog = new CLogFile(CSettings.FilePerformanceLog, "PerformanceLog");
+ _BenchmarkLog = new CLogFile(CSettings.FileBenchmarkLog, "BenchmarkLog");
_NumErrors = 0;
- _BenchmarkTimer = new Stopwatch[MAXBenchmarks];
+ _BenchmarkTimer = new Stopwatch[_MaxBenchmarks];
for (int i = 0; i < _BenchmarkTimer.Length; i++)
_BenchmarkTimer[i] = new Stopwatch();
}
@@ -95,57 +94,57 @@ namespace Vocaluxe.Base
}
#region LogError
- public static void LogError(string ErrorText)
+ public static void LogError(string errorText)
{
_NumErrors++;
- _ErrorLog.Add(_NumErrors.ToString() + ") " + ErrorText);
+ _ErrorLog.Add(_NumErrors + ") " + errorText);
_ErrorLog.Add(String.Empty);
}
#endregion LogError
#region LogPerformance
- public static void LogPerformance(string Text)
+ public static void LogPerformance(string text)
{
- _PerformanceLog.Add(Text);
+ _PerformanceLog.Add(text);
_PerformanceLog.Add("-------------------------------");
}
#endregion LogPerformance
#region LogBenchmark
- public static void StartBenchmark(int BenchmarkNr, string Text)
+ public static void StartBenchmark(int benchmarkNr, string text)
{
- if (BenchmarkNr >= 0 && BenchmarkNr < MAXBenchmarks)
+ if (benchmarkNr >= 0 && benchmarkNr < _MaxBenchmarks)
{
- _BenchmarkTimer[BenchmarkNr].Stop();
- _BenchmarkTimer[BenchmarkNr].Reset();
+ _BenchmarkTimer[benchmarkNr].Stop();
+ _BenchmarkTimer[benchmarkNr].Reset();
string space = String.Empty;
- for (int i = 0; i < BenchmarkNr; i++)
+ for (int i = 0; i < benchmarkNr; i++)
space += " ";
- _BenchmarkLog.Add(space + "Start " + Text);
+ _BenchmarkLog.Add(space + "Start " + text);
- _BenchmarkTimer[BenchmarkNr].Start();
+ _BenchmarkTimer[benchmarkNr].Start();
}
}
- public static void StopBenchmark(int BenchmarkNr, string Text)
+ public static void StopBenchmark(int benchmarkNr, string text)
{
- if (BenchmarkNr >= 0 && BenchmarkNr < MAXBenchmarks)
+ if (benchmarkNr >= 0 && benchmarkNr < _MaxBenchmarks)
{
- _BenchmarkTimer[BenchmarkNr].Stop();
+ _BenchmarkTimer[benchmarkNr].Stop();
string space = String.Empty;
- for (int i = 0; i < BenchmarkNr; i++)
+ 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));
+ if (Stopwatch.IsHighResolution && _NanosecPerTick != 0.0)
+ ms = (float)((_NanosecPerTick * _BenchmarkTimer[benchmarkNr].ElapsedTicks) / (1000.0 * 1000.0));
else
- ms = _BenchmarkTimer[BenchmarkNr].ElapsedMilliseconds;
+ ms = _BenchmarkTimer[benchmarkNr].ElapsedMilliseconds;
- _BenchmarkLog.Add(space + "Stop " + Text + ", Elapsed Time: " + ms.ToString("0.000") + "ms");
+ _BenchmarkLog.Add(space + "Stop " + text + ", Elapsed Time: " + ms.ToString("0.000") + "ms");
_BenchmarkLog.Add(String.Empty);
}
}
diff --git a/Vocaluxe/Base/CMain.cs b/Vocaluxe/Base/CMain.cs
index 6f4b41b9..1f0bc168 100644
--- a/Vocaluxe/Base/CMain.cs
+++ b/Vocaluxe/Base/CMain.cs
@@ -8,26 +8,26 @@ namespace Vocaluxe.Base
{
static class CMain
{
- public static IConfig Config = new BConfig();
- public static ISettings Settings = new BSettings();
- public static ITheme Theme = new BTheme();
- public static IHelper Helper = new BHelper();
- public static IBackgroundMusic BackgroundMusic = new BBackgroundMusic();
- public static IDrawing Draw = new BDraw();
- public static IGraphics Graphics = new BGraphics();
- public static ILog Log = new BLog();
- public static IFonts Fonts = new BFonts();
- public static ILanguage Language = new BLanguage();
- public static IGame Game = new BGame();
- public static IProfiles Profiles = new BProfiles();
- public static IRecording Record = new BRecord();
- public static ISongs Songs = new BSongs();
- public static IVideo Video = new BVideo();
- public static ISound Sound = new BSound();
- public static ICover Cover = new BCover();
- public static IDataBase DataBase = new BDataBase();
- public static IInputs Input = new BInputs();
- public static IPlaylist Playlist = new BPlaylist();
+ public static IConfig Config = new CBconfig();
+ public static ISettings Settings = new CBsettings();
+ public static ITheme Theme = new CBtheme();
+ public static IHelper Helper = new CBhelper();
+ public static IBackgroundMusic BackgroundMusic = new CBbackgroundMusic();
+ public static IDrawing Draw = new CBdraw();
+ public static IGraphics Graphics = new CBGraphics();
+ public static ILog Log = new CBlog();
+ public static IFonts Fonts = new CBfonts();
+ public static ILanguage Language = new CBlanguage();
+ public static IGame Game = new CBGame();
+ public static IProfiles Profiles = new CBprofiles();
+ public static IRecording Record = new CBrecord();
+ public static ISongs Songs = new CBsongs();
+ public static IVideo Video = new CBvideo();
+ public static ISound Sound = new CBsound();
+ public static ICover Cover = new CBcover();
+ public static IDataBase DataBase = new CBdataBase();
+ public static IInputs Input = new CBinputs();
+ public static IPlaylist Playlist = new CBplaylist();
public static void Init()
{
@@ -36,16 +36,16 @@ namespace Vocaluxe.Base
}
}
- class BConfig : IConfig
+ class CBconfig : IConfig
{
- public void SetBackgroundMusicVolume(int NewVolume)
+ public void SetBackgroundMusicVolume(int newVolume)
{
- if (NewVolume < 0)
+ if (newVolume < 0)
CConfig.BackgroundMusicVolume = 0;
- else if (NewVolume > 100)
+ else if (newVolume > 100)
CConfig.BackgroundMusicVolume = 100;
else
- CConfig.BackgroundMusicVolume = NewVolume;
+ CConfig.BackgroundMusicVolume = newVolume;
CConfig.SaveConfig();
}
@@ -115,9 +115,9 @@ namespace Vocaluxe.Base
return CConfig.IgnoreArticles;
}
- public bool IsMicConfigured(int PlayerNr)
+ public bool IsMicConfigured(int playerNr)
{
- return CConfig.IsMicConfig(PlayerNr);
+ return CConfig.IsMicConfig(playerNr);
}
public int GetMaxNumMics()
@@ -134,16 +134,16 @@ namespace Vocaluxe.Base
}
}
- class BSettings : ISettings
+ class CBsettings : ISettings
{
public int GetRenderW()
{
- return CSettings.iRenderW;
+ return CSettings.RenderW;
}
public int GetRenderH()
{
- return CSettings.iRenderH;
+ return CSettings.RenderH;
}
public bool IsTabNavigation()
@@ -153,12 +153,12 @@ namespace Vocaluxe.Base
public float GetZFar()
{
- return CSettings.zFar;
+ return CSettings.ZFar;
}
public float GetZNear()
{
- return CSettings.zNear;
+ return CSettings.ZNear;
}
public EGameState GetGameState()
@@ -207,51 +207,51 @@ namespace Vocaluxe.Base
}
}
- class BTheme : ITheme
+ class CBtheme : ITheme
{
- public string GetThemeScreensPath(int PartyModeID)
+ public string GetThemeScreensPath(int partyModeID)
{
- return CTheme.GetThemeScreensPath(PartyModeID);
+ return CTheme.GetThemeScreensPath(partyModeID);
}
- public int GetSkinIndex(int PartyModeID)
+ public int GetSkinIndex(int partyModeID)
{
- return CTheme.GetSkinIndex(PartyModeID);
+ return CTheme.GetSkinIndex(partyModeID);
}
- public STexture GetSkinTexture(string TextureName, int PartyModeID)
+ public STexture GetSkinTexture(string textureName, int partyModeID)
{
- return CTheme.GetSkinTexture(TextureName, PartyModeID);
+ return CTheme.GetSkinTexture(textureName, partyModeID);
}
- public STexture GetSkinVideoTexture(string VideoName, int PartyModeID)
+ public STexture GetSkinVideoTexture(string videoName, int partyModeID)
{
- return CTheme.GetSkinVideoTexture(VideoName, PartyModeID);
+ return CTheme.GetSkinVideoTexture(videoName, partyModeID);
}
- public void SkinVideoResume(string VideoName, int PartyModeID)
+ public void SkinVideoResume(string videoName, int partyModeID)
{
- CTheme.SkinVideoResume(VideoName, PartyModeID);
+ CTheme.SkinVideoResume(videoName, partyModeID);
}
- public void SkinVideoPause(string VideoName, int PartyModeID)
+ public void SkinVideoPause(string videoName, int partyModeID)
{
- CTheme.SkinVideoPause(VideoName, PartyModeID);
+ CTheme.SkinVideoPause(videoName, partyModeID);
}
- public SColorF GetColor(string ColorName, int PartyModeID)
+ public SColorF GetColor(string colorName, int partyModeID)
{
- return CTheme.GetColor(ColorName, PartyModeID);
+ return CTheme.GetColor(colorName, partyModeID);
}
- public bool GetColor(string ColorName, int SkinIndex, out SColorF Color)
+ public bool GetColor(string colorName, int skinIndex, out SColorF color)
{
- return CTheme.GetColor(ColorName, SkinIndex, out Color);
+ return CTheme.GetColor(colorName, skinIndex, out color);
}
- public SColorF GetPlayerColor(int PlayerNr)
+ public SColorF GetPlayerColor(int playerNr)
{
- return CTheme.GetPlayerColor(PlayerNr);
+ return CTheme.GetPlayerColor(playerNr);
}
public void UnloadSkins()
@@ -275,9 +275,9 @@ namespace Vocaluxe.Base
}
}
- class BHelper : IHelper {}
+ class CBhelper : IHelper {}
- class BBackgroundMusic : IBackgroundMusic
+ class CBbackgroundMusic : IBackgroundMusic
{
public bool IsDisabled()
{
@@ -299,9 +299,9 @@ namespace Vocaluxe.Base
return CBackgroundMusic.VideoEnabled;
}
- public void SetStatus(bool Disabled)
+ public void SetStatus(bool disabled)
{
- CBackgroundMusic.Disabled = Disabled;
+ CBackgroundMusic.Disabled = disabled;
}
public void Next()
@@ -335,55 +335,55 @@ namespace Vocaluxe.Base
}
}
- class BDraw : IDrawing
+ class CBdraw : IDrawing
{
public RectangleF GetTextBounds(CText text)
{
return CDraw.GetTextBounds(text);
}
- public void DrawTexture(STexture Texture, SRectF Rect)
+ public void DrawTexture(STexture texture, SRectF rect)
{
- CDraw.DrawTexture(Texture, Rect);
+ CDraw.DrawTexture(texture, rect);
}
- public void DrawTexture(STexture Texture, SRectF Rect, SColorF Color)
+ public void DrawTexture(STexture texture, SRectF rect, SColorF color)
{
- CDraw.DrawTexture(Texture, Rect, Color);
+ CDraw.DrawTexture(texture, rect, color);
}
- public void DrawTexture(STexture Texture, SRectF Rect, SColorF Color, SRectF Bounds)
+ public void DrawTexture(STexture texture, SRectF rect, SColorF color, SRectF bounds)
{
- CDraw.DrawTexture(Texture, Rect, Color, Bounds);
+ CDraw.DrawTexture(texture, rect, color, bounds);
}
- public void DrawTexture(STexture Texture, SRectF Rect, SColorF Color, SRectF Bounds, bool Mirrored)
+ public void DrawTexture(STexture texture, SRectF rect, SColorF color, SRectF bounds, bool mirrored)
{
- CDraw.DrawTexture(Texture, Rect, Color, Bounds, Mirrored);
+ CDraw.DrawTexture(texture, rect, color, bounds, mirrored);
}
- public void DrawTextureReflection(STexture Texture, SRectF Rect, SColorF Color, SRectF Bounds, float ReflectionSpace, float ReflectionHeight)
+ public void DrawTextureReflection(STexture texture, SRectF rect, SColorF color, SRectF bounds, float reflectionSpace, float reflectionHeight)
{
- CDraw.DrawTextureReflection(Texture, Rect, Color, Bounds, ReflectionSpace, ReflectionHeight);
+ CDraw.DrawTextureReflection(texture, rect, color, bounds, reflectionSpace, reflectionHeight);
}
- public void RemoveTexture(ref STexture Texture)
+ public void RemoveTexture(ref STexture texture)
{
- CDraw.RemoveTexture(ref Texture);
+ CDraw.RemoveTexture(ref texture);
}
- public void DrawColor(SColorF Color, SRectF Rect)
+ public void DrawColor(SColorF color, SRectF rect)
{
- CDraw.DrawColor(Color, Rect);
+ CDraw.DrawColor(color, rect);
}
- public void DrawColorReflection(SColorF Color, SRectF Rect, float Space, float Height)
+ public void DrawColorReflection(SColorF color, SRectF rect, float space, float height)
{
- CDraw.DrawColorReflection(Color, Rect, Space, Height);
+ CDraw.DrawColorReflection(color, rect, space, height);
}
}
- class BGraphics : IGraphics
+ class CBGraphics : IGraphics
{
public void ReloadTheme()
{
@@ -395,9 +395,9 @@ namespace Vocaluxe.Base
CGraphics.SaveTheme();
}
- public void FadeTo(EScreens NextScreen)
+ public void FadeTo(EScreens nextScreen)
{
- CGraphics.FadeTo(NextScreen);
+ CGraphics.FadeTo(nextScreen);
}
public float GetGlobalAlpha()
@@ -406,75 +406,75 @@ namespace Vocaluxe.Base
}
}
- class BLog : ILog
+ class CBlog : ILog
{
- public void LogError(string ErrorText)
+ public void LogError(string errorText)
{
- CLog.LogError(ErrorText);
+ CLog.LogError(errorText);
}
}
- class BFonts : IFonts
+ class CBfonts : IFonts
{
- public void SetFont(string FontName)
+ public void SetFont(string fontName)
{
- CFonts.SetFont(FontName);
+ CFonts.SetFont(fontName);
}
- public void SetStyle(EStyle FontStyle)
+ public void SetStyle(EStyle fontStyle)
{
- CFonts.Style = FontStyle;
+ CFonts.Style = fontStyle;
}
- public RectangleF GetTextBounds(CText Text, float TextHeight)
+ public RectangleF GetTextBounds(CText text, float textHeight)
{
- return CFonts.GetTextBounds(Text, TextHeight);
+ return CFonts.GetTextBounds(text, textHeight);
}
- public void DrawText(string Text, float TextHeight, float x, float y, float z, SColorF Color)
+ public void DrawText(string text, float textHeight, float x, float y, float z, SColorF color)
{
- CFonts.DrawText(Text, TextHeight, x, y, z, Color);
+ CFonts.DrawText(text, textHeight, x, y, z, color);
}
- public void DrawTextReflection(string Text, float TextHeight, float x, float y, float z, SColorF Color, float ReflectionSpace, float ReflectionHeight)
+ public void DrawTextReflection(string text, float textHeight, float x, float y, float z, SColorF color, float reflectionSpace, float reflectionHeight)
{
- CFonts.DrawTextReflection(Text, TextHeight, x, y, z, Color, ReflectionSpace, ReflectionHeight);
+ CFonts.DrawTextReflection(text, textHeight, x, y, z, color, reflectionSpace, reflectionHeight);
}
- public void DrawText(string Text, float TextHeight, float x, float y, float z, SColorF Color, float Begin, float End)
+ public void DrawText(string text, float textHeight, float x, float y, float z, SColorF color, float begin, float end)
{
- CFonts.DrawText(Text, TextHeight, x, y, z, Color, Begin, End);
+ CFonts.DrawText(text, textHeight, x, y, z, color, begin, end);
}
}
- class BLanguage : ILanguage
+ class CBlanguage : ILanguage
{
- public string Translate(string KeyWord)
+ public string Translate(string keyWord)
{
- return CLanguage.Translate(KeyWord);
+ return CLanguage.Translate(keyWord);
}
- public string Translate(string KeyWord, int PartyModeID)
+ public string Translate(string keyWord, int partyModeID)
{
- return CLanguage.Translate(KeyWord, PartyModeID);
+ return CLanguage.Translate(keyWord, partyModeID);
}
- public bool TranslationExists(string KeyWord)
+ public bool TranslationExists(string keyWord)
{
- return CLanguage.TranslationExists(KeyWord);
+ return CLanguage.TranslationExists(keyWord);
}
}
- class BGame : IGame
+ class CBGame : IGame
{
public int GetNumPlayer()
{
return CGame.NumPlayer;
}
- public void SetNumPlayer(int NumPlayer)
+ public void SetNumPlayer(int numPlayer)
{
- CGame.NumPlayer = NumPlayer;
+ CGame.NumPlayer = numPlayer;
}
public SPlayer[] GetPlayer()
@@ -497,9 +497,9 @@ namespace Vocaluxe.Base
return CGame.ActBeatD;
}
- public int GetRandom(int Max)
+ public int GetRandom(int max)
{
- return CGame.Rand.Next(Max);
+ return CGame.Rand.Next(max);
}
public double GetRandomDouble()
@@ -507,14 +507,14 @@ namespace Vocaluxe.Base
return CGame.Rand.NextDouble();
}
- public float GetTimeFromBeats(float Beat, float BPM)
+ public float GetTimeFromBeats(float beat, float bpm)
{
- return CGame.GetTimeFromBeats(Beat, BPM);
+ return CGame.GetTimeFromBeats(beat, bpm);
}
- public void AddSong(int SongID, EGameMode GameMode)
+ public void AddSong(int songID, EGameMode gameMode)
{
- CGame.AddSong(SongID, GameMode);
+ CGame.AddSong(songID, gameMode);
}
public void Reset()
@@ -533,7 +533,7 @@ namespace Vocaluxe.Base
}
}
- class BProfiles : IProfiles
+ class CBprofiles : IProfiles
{
public SProfile[] GetProfiles()
{
@@ -541,15 +541,15 @@ namespace Vocaluxe.Base
}
}
- class BRecord : IRecording
+ class CBrecord : IRecording
{
- public int GetToneAbs(int PlayerNr)
+ public int GetToneAbs(int playerNr)
{
- return CSound.RecordGetToneAbs(PlayerNr);
+ return CSound.RecordGetToneAbs(playerNr);
}
}
- class BSongs : ISongs
+ class CBsongs : ISongs
{
public int GetNumSongs()
{
@@ -566,9 +566,9 @@ namespace Vocaluxe.Base
return CSongs.NumCategories;
}
- public int NumSongsInCategory(int CategoryIndex)
+ public int NumSongsInCategory(int categoryIndex)
{
- return CSongs.NumSongsInCategory(CategoryIndex);
+ return CSongs.NumSongsInCategory(categoryIndex);
}
public int GetCurrentCategoryIndex()
@@ -586,9 +586,9 @@ namespace Vocaluxe.Base
return CSongs.Filter.SearchString;
}
- public void SetCategory(int CategoryIndex)
+ public void SetCategory(int categoryIndex)
{
- CSongs.Category = CategoryIndex;
+ CSongs.Category = categoryIndex;
}
public void UpdateRandomSongList()
@@ -596,14 +596,14 @@ namespace Vocaluxe.Base
CSongs.UpdateRandomSongList();
}
- public CSong GetVisibleSong(int VisibleIndex)
+ public CSong GetVisibleSong(int visibleIndex)
{
- return CSongs.GetVisibleSongByIndex(VisibleIndex);
+ return CSongs.GetVisibleSongByIndex(visibleIndex);
}
- public CSong GetSongByID(int SongID)
+ public CSong GetSongByID(int songID)
{
- return CSongs.GetSong(SongID);
+ return CSongs.GetSong(songID);
}
public CSong[] GetSongs()
@@ -616,17 +616,17 @@ namespace Vocaluxe.Base
return CSongs.SongsNotSung;
}
- public CCategory GetCategory(int Index)
+ public CCategory GetCategory(int index)
{
- if (Index >= CSongs.NumCategories)
+ if (index >= CSongs.NumCategories)
return null;
- return new CCategory(CSongs.Categories[Index]);
+ return new CCategory(CSongs.Categories[index]);
}
- public void AddPartySongSung(int SongID)
+ public void AddPartySongSung(int songID)
{
- CSongs.AddPartySongSung(SongID);
+ CSongs.AddPartySongSung(songID);
}
public void ResetPartySongSung()
@@ -634,14 +634,14 @@ namespace Vocaluxe.Base
CSongs.ResetPartySongSung();
}
- public void ResetPartySongSung(int CatIndex)
+ public void ResetPartySongSung(int catIndex)
{
- CSongs.ResetPartySongSung(CatIndex);
+ CSongs.ResetPartySongSung(catIndex);
}
- public void SortSongs(ESongSorting Sorting, EOffOn Tabs, EOffOn IgnoreArticles, String SearchString, EDuetOptions DuetOptions)
+ public void SortSongs(ESongSorting sorting, EOffOn tabs, EOffOn ignoreArticles, String searchString, EDuetOptions duetOptions)
{
- CSongs.Sort(Sorting, Tabs, IgnoreArticles, SearchString, DuetOptions);
+ CSongs.Sort(sorting, tabs, ignoreArticles, searchString, duetOptions);
}
public void NextCategory()
@@ -655,88 +655,88 @@ namespace Vocaluxe.Base
}
}
- class BVideo : IVideo
+ class CBvideo : IVideo
{
- public int Load(string VideoFileName)
+ public int Load(string videoFileName)
{
- return CVideo.VdLoad(VideoFileName);
+ return CVideo.VdLoad(videoFileName);
}
- public bool Skip(int VideoStream, float StartPosition, float VideoGap)
+ public bool Skip(int videoStream, float startPosition, float videoGap)
{
- return CVideo.VdSkip(VideoStream, StartPosition, VideoGap);
+ return CVideo.VdSkip(videoStream, startPosition, videoGap);
}
- public bool GetFrame(int VideoStream, ref STexture VideoTexture, float Time, ref float VideoTime)
+ public bool GetFrame(int videoStream, ref STexture videoTexture, float time, ref float videoTime)
{
- return CVideo.VdGetFrame(VideoStream, ref VideoTexture, Time, ref VideoTime);
+ return CVideo.VdGetFrame(videoStream, ref videoTexture, time, ref videoTime);
}
- public bool IsFinished(int VideoStream)
+ public bool IsFinished(int videoStream)
{
- return CVideo.VdFinished(VideoStream);
+ return CVideo.VdFinished(videoStream);
}
- public bool Close(int VideoStream)
+ public bool Close(int videoStream)
{
- return CVideo.VdClose(VideoStream);
+ return CVideo.VdClose(videoStream);
}
}
- class BSound : ISound
+ class CBsound : ISound
{
- public int Load(string SoundFile, bool Prescan)
+ public int Load(string soundFile, bool prescan)
{
- return CSound.Load(SoundFile, Prescan);
+ return CSound.Load(soundFile, prescan);
}
- public void SetPosition(int SoundStream, float NewPosition)
+ public void SetPosition(int soundStream, float newPosition)
{
- CSound.SetPosition(SoundStream, NewPosition);
+ CSound.SetPosition(soundStream, newPosition);
}
- public void Play(int SoundStream)
+ public void Play(int soundStream)
{
- CSound.Play(SoundStream);
+ CSound.Play(soundStream);
}
- public void Fade(int SoundStream, float TargetVolume, float Duration)
+ public void Fade(int soundStream, float targetVolume, float duration)
{
- CSound.Fade(SoundStream, TargetVolume, Duration);
+ CSound.Fade(soundStream, targetVolume, duration);
}
- public bool IsFinished(int SoundStream)
+ public bool IsFinished(int soundStream)
{
- return CSound.IsFinished(SoundStream);
+ return CSound.IsFinished(soundStream);
}
- public float GetPosition(int SoundStream)
+ public float GetPosition(int soundStream)
{
- return CSound.GetPosition(SoundStream);
+ return CSound.GetPosition(soundStream);
}
- public float GetLength(int SoundStream)
+ public float GetLength(int soundStream)
{
- return CSound.GetLength(SoundStream);
+ return CSound.GetLength(soundStream);
}
- public void FadeAndStop(int SoundStream, float TargetVolume, float Duration)
+ public void FadeAndStop(int soundStream, float targetVolume, float duration)
{
- CSound.FadeAndStop(SoundStream, TargetVolume, Duration);
+ CSound.FadeAndStop(soundStream, targetVolume, duration);
}
- public void SetStreamVolume(int SoundStream, float Volume)
+ public void SetStreamVolume(int soundStream, float volume)
{
- CSound.SetStreamVolume(SoundStream, Volume);
+ CSound.SetStreamVolume(soundStream, volume);
}
- public void SetStreamVolumeMax(int SoundStream, float MaxVolume)
+ public void SetStreamVolumeMax(int soundStream, float maxVolume)
{
- CSound.SetStreamVolumeMax(SoundStream, MaxVolume);
+ CSound.SetStreamVolumeMax(soundStream, maxVolume);
}
}
- class BCover : ICover
+ class CBcover : ICover
{
public STexture GetNoCover()
{
@@ -744,27 +744,27 @@ namespace Vocaluxe.Base
}
}
- class BDataBase : IDataBase
+ class CBdataBase : IDataBase
{
- public bool GetCover(string FileName, ref STexture Texture, int CoverSize)
+ public bool GetCover(string fileName, ref STexture texture, int coverSize)
{
- return CDataBase.GetCover(FileName, ref Texture, CoverSize);
+ return CDataBase.GetCover(fileName, ref texture, coverSize);
}
}
- class BInputs : IInputs
+ class CBinputs : IInputs
{
- public void SetRumble(float Duration)
+ public void SetRumble(float duration)
{
- CInput.SetRumble(Duration);
+ CInput.SetRumble(duration);
}
}
- class BPlaylist : IPlaylist
+ class CBplaylist : IPlaylist
{
- public void SetPlaylistName(int PlaylistID, string Name)
+ public void SetPlaylistName(int playlistID, string name)
{
- CPlaylists.SetPlaylistName(PlaylistID, Name);
+ CPlaylists.SetPlaylistName(playlistID, name);
}
public string[] GetPlaylistNames()
@@ -772,19 +772,19 @@ namespace Vocaluxe.Base
return CPlaylists.GetPlaylistNames();
}
- public string GetPlaylistName(int PlaylistID)
+ public string GetPlaylistName(int playlistID)
{
- return CPlaylists.GetPlaylistName(PlaylistID);
+ return CPlaylists.GetPlaylistName(playlistID);
}
- public void DeletePlaylist(int PlaylistID)
+ public void DeletePlaylist(int playlistID)
{
- CPlaylists.DeletePlaylist(PlaylistID);
+ CPlaylists.DeletePlaylist(playlistID);
}
- public void SavePlaylist(int PlaylistID)
+ public void SavePlaylist(int playlistID)
{
- CPlaylists.SavePlaylist(PlaylistID);
+ CPlaylists.SavePlaylist(playlistID);
}
public int GetNumPlaylists()
@@ -792,49 +792,49 @@ namespace Vocaluxe.Base
return CPlaylists.NumPlaylists;
}
- public void AddPlaylistSong(int PlaylistID, int SongID)
+ public void AddPlaylistSong(int playlistID, int songID)
{
- CPlaylists.AddPlaylistSong(PlaylistID, SongID);
+ CPlaylists.AddPlaylistSong(playlistID, songID);
}
- public void AddPlaylistSong(int PlaylistID, int SongID, EGameMode GameMode)
+ public void AddPlaylistSong(int playlistID, int songID, EGameMode gameMode)
{
- CPlaylists.AddPlaylistSong(PlaylistID, SongID, GameMode);
+ CPlaylists.AddPlaylistSong(playlistID, songID, gameMode);
}
- public void InsertPlaylistSong(int PlaylistID, int PositionIndex, int SongID, EGameMode GameMode)
+ public void InsertPlaylistSong(int playlistID, int positionIndex, int songID, EGameMode gameMode)
{
- CPlaylists.InsertPlaylistSong(PlaylistID, PositionIndex, SongID, GameMode);
+ CPlaylists.InsertPlaylistSong(playlistID, positionIndex, songID, gameMode);
}
- public void MovePlaylistSong(int PlaylistID, int SourceIndex, int DestIndex)
+ public void MovePlaylistSong(int playlistID, int sourceIndex, int destIndex)
{
- CPlaylists.MovePlaylistSong(PlaylistID, SourceIndex, DestIndex);
+ CPlaylists.MovePlaylistSong(playlistID, sourceIndex, destIndex);
}
- public void MovePlaylistSongDown(int PlaylistID, int SongIndex)
+ public void MovePlaylistSongDown(int playlistID, int songIndex)
{
- CPlaylists.MovePlaylistSongDown(PlaylistID, SongIndex);
+ CPlaylists.MovePlaylistSongDown(playlistID, songIndex);
}
- public void MovePlaylistSongUp(int PlaylistID, int SongIndex)
+ public void MovePlaylistSongUp(int playlistID, int songIndex)
{
- CPlaylists.MovePlaylistSongUp(PlaylistID, SongIndex);
+ CPlaylists.MovePlaylistSongUp(playlistID, songIndex);
}
- public void DeletePlaylistSong(int PlaylistID, int SongIndex)
+ public void DeletePlaylistSong(int playlistID, int songIndex)
{
- CPlaylists.DeletePlaylistSong(PlaylistID, SongIndex);
+ CPlaylists.DeletePlaylistSong(playlistID, songIndex);
}
- public int GetPlaylistSongCount(int PlaylistID)
+ public int GetPlaylistSongCount(int playlistID)
{
- return CPlaylists.GetPlaylistSongCount(PlaylistID);
+ return CPlaylists.GetPlaylistSongCount(playlistID);
}
- public CPlaylistSong GetPlaylistSong(int PlaylistID, int SongIndex)
+ public CPlaylistSong GetPlaylistSong(int playlistID, int songIndex)
{
- return CPlaylists.GetPlaylistSong(PlaylistID, SongIndex);
+ return CPlaylists.GetPlaylistSong(playlistID, songIndex);
}
}
}
\ No newline at end of file
diff --git a/Vocaluxe/Base/CObservable.cs b/Vocaluxe/Base/CObservable.cs
index d548e92e..5308ab84 100644
--- a/Vocaluxe/Base/CObservable.cs
+++ b/Vocaluxe/Base/CObservable.cs
@@ -7,7 +7,7 @@ namespace Vocaluxe.Base
public event EventHandler ObjectChanged = delegate { };
protected bool _Changed = true;
- protected void NotifyObservers()
+ protected void _NotifyObservers()
{
ObjectChanged.Invoke(this, null);
}
@@ -15,7 +15,7 @@ namespace Vocaluxe.Base
protected void _SetChanged()
{
_Changed = true;
- NotifyObservers();
+ _NotifyObservers();
}
}
}
\ No newline at end of file
diff --git a/Vocaluxe/Base/CParty.cs b/Vocaluxe/Base/CParty.cs
index 4f974b1d..8328f42c 100644
--- a/Vocaluxe/Base/CParty.cs
+++ b/Vocaluxe/Base/CParty.cs
@@ -30,7 +30,7 @@ namespace Vocaluxe.Base
static class CParty
{
- private const int PartyModeSystemVersion = 1;
+ private const int _PartyModeSystemVersion = 1;
private static Dictionary _PartyModes;
private static Queue _IDs;
@@ -58,7 +58,7 @@ namespace Vocaluxe.Base
_CurrentPartyMode = pm;
//load other party modes
- LoadPartyModes();
+ _LoadPartyModes();
}
public static int CurrentPartyModeID
@@ -81,15 +81,15 @@ namespace Vocaluxe.Base
{
List infos = new List();
- int[] UsedKeys = new int[_PartyModes.Count];
- _PartyModes.Keys.CopyTo(UsedKeys, 0);
+ int[] usedKeys = new int[_PartyModes.Count];
+ _PartyModes.Keys.CopyTo(usedKeys, 0);
- for (int i = 0; i < UsedKeys.Length; i++)
+ for (int i = 0; i < usedKeys.Length; i++)
{
- if (UsedKeys[i] != _NormalGameModeID)
+ if (usedKeys[i] != _NormalGameModeID)
{
SPartyMode mode = new SPartyMode();
- _PartyModes.TryGetValue(UsedKeys[i], out mode);
+ _PartyModes.TryGetValue(usedKeys[i], out mode);
if (mode.PartyMode != null)
{
@@ -122,17 +122,17 @@ namespace Vocaluxe.Base
SetPartyMode(_NormalGameModeID);
}
- public static void SetPartyMode(int PartyModeID)
+ public static void SetPartyMode(int partyModeID)
{
- if (!_PartyModes.TryGetValue(PartyModeID, out _CurrentPartyMode))
- CLog.LogError("CParty: Can't find party mode ID: " + PartyModeID.ToString());
+ if (!_PartyModes.TryGetValue(partyModeID, out _CurrentPartyMode))
+ CLog.LogError("CParty: Can't find party mode ID: " + partyModeID.ToString());
_CurrentPartyMode.PartyMode.Init();
}
- public static CMenu GetNextPartyScreen(out EScreens AlternativeScreen)
+ public static CMenu GetNextPartyScreen(out EScreens alternativeScreen)
{
- return _CurrentPartyMode.PartyMode.GetNextPartyScreen(out AlternativeScreen);
+ return _CurrentPartyMode.PartyMode.GetNextPartyScreen(out alternativeScreen);
}
#endregion public stuff
@@ -152,34 +152,34 @@ namespace Vocaluxe.Base
return _CurrentPartyMode.PartyMode.GetMainScreen();
}
- public static ScreenSongOptions GetSongSelectionOptions()
+ public static SScreenSongOptions GetSongSelectionOptions()
{
return _CurrentPartyMode.PartyMode.GetScreenSongOptions();
}
- public static void OnSongChange(int SongIndex, ref ScreenSongOptions ScreenSongOptions)
+ public static void OnSongChange(int songIndex, ref SScreenSongOptions screenSongOptions)
{
- _CurrentPartyMode.PartyMode.OnSongChange(SongIndex, ref ScreenSongOptions);
+ _CurrentPartyMode.PartyMode.OnSongChange(songIndex, ref screenSongOptions);
}
- public static void OnCategoryChange(int CategoryIndex, ref ScreenSongOptions ScreenSongOptions)
+ public static void OnCategoryChange(int categoryIndex, ref SScreenSongOptions screenSongOptions)
{
- _CurrentPartyMode.PartyMode.OnCategoryChange(CategoryIndex, ref ScreenSongOptions);
+ _CurrentPartyMode.PartyMode.OnCategoryChange(categoryIndex, ref screenSongOptions);
}
- public static void SetSearchString(string SearchString, bool Visible)
+ public static void SetSearchString(string searchString, bool visible)
{
- _CurrentPartyMode.PartyMode.SetSearchString(SearchString, Visible);
+ _CurrentPartyMode.PartyMode.SetSearchString(searchString, visible);
}
- public static void JokerUsed(int TeamNr)
+ public static void JokerUsed(int teamNr)
{
- _CurrentPartyMode.PartyMode.JokerUsed(TeamNr);
+ _CurrentPartyMode.PartyMode.JokerUsed(teamNr);
}
- public static void SongSelected(int SongID)
+ public static void SongSelected(int songID)
{
- _CurrentPartyMode.PartyMode.SongSelected(SongID);
+ _CurrentPartyMode.PartyMode.SongSelected(songID);
}
public static void FinishedSinging()
@@ -199,19 +199,19 @@ namespace Vocaluxe.Base
#endregion Interface
#region private stuff
- private static void LoadPartyModes()
+ private static void _LoadPartyModes()
{
List files = new List();
- files.AddRange(CHelper.ListFiles(CSettings.sFolderPartyModes, "*.xml", false, true));
+ files.AddRange(CHelper.ListFiles(CSettings.FolderPartyModes, "*.xml", false, true));
foreach (string file in files)
{
- SPartyMode pm = LoadPartyMode(file);
+ SPartyMode pm = _LoadPartyMode(file);
_PartyModes.Add(pm.PartyModeID, pm);
}
}
- private static SPartyMode LoadPartyMode(string file)
+ private static SPartyMode _LoadPartyMode(string file)
{
SPartyMode pm = new SPartyMode();
pm.PartyModeID = _IDs.Dequeue();
@@ -243,7 +243,7 @@ namespace Vocaluxe.Base
return pm;
}
- if (pm.PartyModeSystemVersion != PartyModeSystemVersion)
+ if (pm.PartyModeSystemVersion != _PartyModeSystemVersion)
{
CLog.LogError("Error loading PartyMode file (wrong PartyModeSystemVersion): " + file);
return pm;
@@ -255,23 +255,23 @@ namespace Vocaluxe.Base
return pm;
}
- string PathToCode = Path.Combine(Path.Combine(CSettings.sFolderPartyModes, pm.Folder), CSettings.sFolderPartyModeCode);
+ string pathToCode = Path.Combine(Path.Combine(CSettings.FolderPartyModes, pm.Folder), CSettings.FolderPartyModeCode);
- List FilesToCompile = new List();
- FilesToCompile.AddRange(CHelper.ListFiles(PathToCode, "*.cs", false, true));
+ List filesToCompile = new List();
+ filesToCompile.AddRange(CHelper.ListFiles(pathToCode, "*.cs", false, true));
- Assembly Output = CompileFiles(FilesToCompile.ToArray());
- if (Output == null)
+ Assembly output = _CompileFiles(filesToCompile.ToArray());
+ if (output == null)
return pm;
- if (!CLanguage.LoadPartyLanguageFiles(pm.PartyModeID, Path.Combine(Path.Combine(CSettings.sFolderPartyModes, pm.Folder), CSettings.sFolderPartyModeLanguages)))
+ if (!CLanguage.LoadPartyLanguageFiles(pm.PartyModeID, Path.Combine(Path.Combine(CSettings.FolderPartyModes, pm.Folder), CSettings.FolderPartyModeLanguages)))
{
CLog.LogError("Error loading language files for PartyMode: " + file);
return pm;
}
- object Instance = Output.CreateInstance(typeof(IPartyMode).Namespace + "." + pm.Folder + "." + pm.PartyModeFile);
- if (Instance == null)
+ object instance = output.CreateInstance(typeof(IPartyMode).Namespace + "." + pm.Folder + "." + pm.PartyModeFile);
+ if (instance == null)
{
CLog.LogError("Error creating Instance of PartyMode file: " + file);
return pm;
@@ -279,7 +279,7 @@ namespace Vocaluxe.Base
try
{
- pm.PartyMode = (IPartyMode)Instance;
+ pm.PartyMode = (IPartyMode)instance;
}
catch (Exception e)
{
@@ -288,31 +288,31 @@ namespace Vocaluxe.Base
}
pm.PartyMode.Initialize();
- if (!CTheme.AddTheme(Path.Combine(Directory.GetCurrentDirectory(), Path.Combine(Path.Combine(CSettings.sFolderPartyModes, pm.Folder), "Theme.xml")), pm.PartyModeID))
+ if (!CTheme.AddTheme(Path.Combine(Directory.GetCurrentDirectory(), Path.Combine(Path.Combine(CSettings.FolderPartyModes, pm.Folder), "Theme.xml")), pm.PartyModeID))
return pm;
- int ThemeIndex = CTheme.GetThemeIndex(pm.PartyModeID);
- CTheme.ListSkins(ThemeIndex);
- int SkinIndex = CTheme.GetSkinIndex(pm.PartyModeID);
+ int themeIndex = CTheme.GetThemeIndex(pm.PartyModeID);
+ CTheme.ListSkins(themeIndex);
+ int skinIndex = CTheme.GetSkinIndex(pm.PartyModeID);
- if (!CTheme.LoadSkin(SkinIndex))
+ if (!CTheme.LoadSkin(skinIndex))
return pm;
- if (!CTheme.LoadTheme(ThemeIndex))
+ if (!CTheme.LoadTheme(themeIndex))
return pm;
foreach (string screenfile in pm.ScreenFiles)
{
- string XmlPath = Path.Combine(Path.Combine(CSettings.sFolderPartyModes, pm.Folder), CSettings.sFolderPartyModeScreens);
- CMenuParty Screen = GetPartyScreenInstance(Output, screenfile, pm.Folder);
+ string xmlPath = Path.Combine(Path.Combine(CSettings.FolderPartyModes, pm.Folder), CSettings.FolderPartyModeScreens);
+ CMenuParty screen = _GetPartyScreenInstance(output, screenfile, pm.Folder);
- if (Screen != null)
+ if (screen != null)
{
- Screen.Init();
- Screen.AssingPartyMode(pm.PartyMode);
- Screen.SetPartyModeID(pm.PartyModeID);
- Screen.LoadTheme(XmlPath);
- pm.PartyMode.AddScreen(Screen, screenfile);
+ screen.Init();
+ screen.AssingPartyMode(pm.PartyMode);
+ screen.SetPartyModeID(pm.PartyModeID);
+ screen.LoadTheme(xmlPath);
+ pm.PartyMode.AddScreen(screen, screenfile);
}
else
return pm;
@@ -322,7 +322,7 @@ namespace Vocaluxe.Base
return pm;
}
- private static Assembly CompileFiles(string[] files)
+ private static Assembly _CompileFiles(string[] files)
{
if (files == null)
return null;
@@ -330,21 +330,21 @@ namespace Vocaluxe.Base
if (files.Length == 0)
return null;
- CompilerParameters Params = new CompilerParameters();
- Params.ReferencedAssemblies.Add("System.Windows.Forms.dll");
- Params.ReferencedAssemblies.Add("VocaluxeLib.dll");
- Params.GenerateInMemory = true;
+ CompilerParameters compilerParams = new CompilerParameters();
+ compilerParams.ReferencedAssemblies.Add("System.Windows.Forms.dll");
+ compilerParams.ReferencedAssemblies.Add("VocaluxeLib.dll");
+ compilerParams.GenerateInMemory = true;
#if DEBUG
- Params.IncludeDebugInformation = true;
+ compilerParams.IncludeDebugInformation = true;
#endif
- using (CodeDomProvider CDP = CodeDomProvider.CreateProvider("CSharp"))
+ using (CodeDomProvider cdp = CodeDomProvider.CreateProvider("CSharp"))
{
- CompilerResults CompileResult = null;
+ CompilerResults compileResult = null;
try
{
- CompileResult = CDP.CompileAssemblyFromFile(Params, files);
+ compileResult = cdp.CompileAssemblyFromFile(compilerParams, files);
}
catch (Exception e)
{
@@ -352,39 +352,39 @@ namespace Vocaluxe.Base
return null;
}
- if (CompileResult.Errors.Count > 0)
+ if (compileResult.Errors.Count > 0)
{
- foreach (CompilerError e in CompileResult.Errors)
+ foreach (CompilerError e in compileResult.Errors)
CLog.LogError("Error Compiling Source (" + CHelper.ListStrings(files) + "): " + e.ErrorText + " in '" + e.FileName + "' (" + e.Line + ")");
return null;
}
- return CompileResult.CompiledAssembly;
+ return compileResult.CompiledAssembly;
}
}
- private static CMenuParty GetPartyScreenInstance(Assembly Assembly, string ScreenName, string partyModeName)
+ private static CMenuParty _GetPartyScreenInstance(Assembly assembly, string screenName, string partyModeName)
{
- if (Assembly == null)
+ if (assembly == null)
return null;
- object Instance = Assembly.CreateInstance(typeof(IPartyMode).Namespace + "." + partyModeName + "." + ScreenName);
- if (Instance == null)
+ object instance = assembly.CreateInstance(typeof(IPartyMode).Namespace + "." + partyModeName + "." + screenName);
+ if (instance == null)
{
- CLog.LogError("Error creating Instance of PartyScreen: " + ScreenName);
+ CLog.LogError("Error creating Instance of PartyScreen: " + screenName);
return null;
}
- CMenuParty Screen = null;
+ CMenuParty screen = null;
try
{
- Screen = (CMenuParty)Instance;
+ screen = (CMenuParty)instance;
}
catch (Exception e)
{
- CLog.LogError("Error casting PartyScreen: " + ScreenName + "; " + e.Message);
+ CLog.LogError("Error casting PartyScreen: " + screenName + "; " + e.Message);
return null;
}
- return Screen;
+ return screen;
}
#endregion private stuff
}
diff --git a/Vocaluxe/Base/CPlaylists.cs b/Vocaluxe/Base/CPlaylists.cs
index 9c914e4e..03532e71 100644
--- a/Vocaluxe/Base/CPlaylists.cs
+++ b/Vocaluxe/Base/CPlaylists.cs
@@ -38,17 +38,17 @@ namespace Vocaluxe.Base
LoadPlaylists();
ConvertUSDXPlaylists();
- SortPlaylistsByName();
+ _SortPlaylistsByName();
}
public static void ConvertUSDXPlaylists()
{
List files = new List();
- files.AddRange(CHelper.ListFiles(CSettings.sFolderPlaylists, "*.upl", true, true));
+ files.AddRange(CHelper.ListFiles(CSettings.FolderPlaylists, "*.upl", true, true));
foreach (string file in files)
{
- CPlaylistFile playlist = ConvertUSDXPlaylist(file);
+ CPlaylistFile playlist = _ConvertUSDXPlaylist(file);
playlist.SavePlaylist();
_Playlists.Add(playlist);
}
@@ -58,7 +58,7 @@ namespace Vocaluxe.Base
{
_Playlists = new List();
List files = new List();
- files.AddRange(CHelper.ListFiles(CSettings.sFolderPlaylists, "*.xml", true, true));
+ files.AddRange(CHelper.ListFiles(CSettings.FolderPlaylists, "*.xml", true, true));
foreach (string file in files)
{
@@ -67,12 +67,12 @@ namespace Vocaluxe.Base
}
}
- public static string GetPlaylistName(int PlaylistID)
+ public static string GetPlaylistName(int playlistID)
{
- if (PlaylistID >= _Playlists.Count || PlaylistID < 0)
+ if (playlistID >= _Playlists.Count || playlistID < 0)
return "Error: Can't find Playlist";
- return _Playlists[PlaylistID].PlaylistName;
+ return _Playlists[playlistID].PlaylistName;
}
public static string[] GetPlaylistNames()
@@ -85,37 +85,37 @@ namespace Vocaluxe.Base
return result.ToArray();
}
- public static void SetPlaylistName(int PlaylistID, string Name)
+ public static void SetPlaylistName(int playlistID, string name)
{
- if (PlaylistID >= _Playlists.Count || PlaylistID < 0)
+ if (playlistID >= _Playlists.Count || playlistID < 0)
return;
- _Playlists[PlaylistID].PlaylistName = Name;
+ _Playlists[playlistID].PlaylistName = name;
}
- public static void DeletePlaylist(int PlaylistID)
+ public static void DeletePlaylist(int playlistID)
{
- if (PlaylistID < 0 || PlaylistID >= _Playlists.Count)
+ if (playlistID < 0 || playlistID >= _Playlists.Count)
return;
- if (_Playlists[PlaylistID].PlaylistFile.Length > 0)
+ if (_Playlists[playlistID].PlaylistFile.Length > 0)
{
try
{
- File.Delete(_Playlists[PlaylistID].PlaylistFile);
+ File.Delete(_Playlists[playlistID].PlaylistFile);
}
catch (Exception)
{
- CLog.LogError("Can't delete Playlist File " + _Playlists[PlaylistID].PlaylistFile + ".xml");
+ CLog.LogError("Can't delete Playlist File " + _Playlists[playlistID].PlaylistFile + ".xml");
}
}
- _Playlists.RemoveAt(PlaylistID);
+ _Playlists.RemoveAt(playlistID);
}
- public static void SavePlaylist(int PlaylistID)
+ public static void SavePlaylist(int playlistID)
{
- if (PlaylistID < 0 || PlaylistID >= _Playlists.Count)
+ if (playlistID < 0 || playlistID >= _Playlists.Count)
return;
- _Playlists[PlaylistID].SavePlaylist();
+ _Playlists[playlistID].SavePlaylist();
}
public static int NewPlaylist()
@@ -126,96 +126,96 @@ namespace Vocaluxe.Base
return _Playlists.Count - 1;
}
- public static void AddPlaylistSong(int PlaylistID, int SongID)
+ public static void AddPlaylistSong(int playlistID, int songID)
{
- if (PlaylistID >= _Playlists.Count || PlaylistID < 0)
+ if (playlistID >= _Playlists.Count || playlistID < 0)
return;
- _Playlists[PlaylistID].AddSong(SongID);
+ _Playlists[playlistID].AddSong(songID);
}
- public static void AddPlaylistSong(int PlaylistID, int SongID, EGameMode GameMode)
+ public static void AddPlaylistSong(int playlistID, int songID, EGameMode gameMode)
{
- if (PlaylistID >= _Playlists.Count || PlaylistID < 0)
+ if (playlistID >= _Playlists.Count || playlistID < 0)
return;
- _Playlists[PlaylistID].AddSong(SongID, GameMode);
+ _Playlists[playlistID].AddSong(songID, gameMode);
}
- public static void InsertPlaylistSong(int PlaylistID, int PositionIndex, int SongID, EGameMode GameMode)
+ public static void InsertPlaylistSong(int playlistID, int positionIndex, int songID, EGameMode gameMode)
{
- if (PlaylistID >= _Playlists.Count || PlaylistID < 0)
+ if (playlistID >= _Playlists.Count || playlistID < 0)
return;
- _Playlists[PlaylistID].SongInsert(PositionIndex, SongID, GameMode);
+ _Playlists[playlistID].SongInsert(positionIndex, songID, gameMode);
}
- public static void MovePlaylistSong(int PlaylistID, int SourceIndex, int DestIndex)
+ public static void MovePlaylistSong(int playlistID, int sourceIndex, int destIndex)
{
- if (PlaylistID >= _Playlists.Count || PlaylistID < 0)
+ if (playlistID >= _Playlists.Count || playlistID < 0)
return;
- _Playlists[PlaylistID].SongMove(SourceIndex, DestIndex);
+ _Playlists[playlistID].SongMove(sourceIndex, destIndex);
}
- public static void MovePlaylistSongDown(int PlaylistID, int SongIndex)
+ public static void MovePlaylistSongDown(int playlistID, int songIndex)
{
- if (PlaylistID >= _Playlists.Count || PlaylistID < 0)
+ if (playlistID >= _Playlists.Count || playlistID < 0)
return;
- _Playlists[PlaylistID].SongDown(SongIndex);
+ _Playlists[playlistID].SongDown(songIndex);
}
- public static void MovePlaylistSongUp(int PlaylistID, int SongIndex)
+ public static void MovePlaylistSongUp(int playlistID, int songIndex)
{
- if (PlaylistID >= _Playlists.Count || PlaylistID < 0)
+ if (playlistID >= _Playlists.Count || playlistID < 0)
return;
- _Playlists[PlaylistID].SongUp(SongIndex);
+ _Playlists[playlistID].SongUp(songIndex);
}
- public static void DeletePlaylistSong(int PlaylistID, int SongIndex)
+ public static void DeletePlaylistSong(int playlistID, int songIndex)
{
- if (PlaylistID >= _Playlists.Count || PlaylistID < 0)
+ if (playlistID >= _Playlists.Count || playlistID < 0)
return;
- _Playlists[PlaylistID].DeleteSong(SongIndex);
+ _Playlists[playlistID].DeleteSong(songIndex);
}
- public static int GetPlaylistSongCount(int PlaylistID)
+ public static int GetPlaylistSongCount(int playlistID)
{
- if (PlaylistID >= _Playlists.Count || PlaylistID < 0)
+ if (playlistID >= _Playlists.Count || playlistID < 0)
return 0;
- return _Playlists[PlaylistID].Songs.Count;
+ return _Playlists[playlistID].Songs.Count;
}
- public static CPlaylistSong GetPlaylistSong(int PlaylistID, int SongIndex)
+ public static CPlaylistSong GetPlaylistSong(int playlistID, int songIndex)
{
- if (PlaylistID >= _Playlists.Count || PlaylistID < 0)
+ if (playlistID >= _Playlists.Count || playlistID < 0)
return null;
- if (SongIndex >= _Playlists[PlaylistID].Songs.Count)
+ if (songIndex >= _Playlists[playlistID].Songs.Count)
return null;
- return _Playlists[PlaylistID].Songs[SongIndex];
+ return _Playlists[playlistID].Songs[songIndex];
}
#region private methods
- private static void SortPlaylistsByName()
+ private static void _SortPlaylistsByName()
{
- _Playlists.Sort(CompareByPlaylistName);
+ _Playlists.Sort(_CompareByPlaylistName);
}
- private static int CompareByPlaylistName(CPlaylistFile a, CPlaylistFile b)
+ private static int _CompareByPlaylistName(CPlaylistFile a, CPlaylistFile b)
{
return String.Compare(a.PlaylistName, b.PlaylistName);
}
- private static CPlaylistFile ConvertUSDXPlaylist(string file)
+ private static CPlaylistFile _ConvertUSDXPlaylist(string file)
{
CPlaylistFile pl = new CPlaylistFile();
- CSong[] AllSongs = CSongs.AllSongs;
+ CSong[] allSongs = CSongs.AllSongs;
if (!File.Exists(file))
return null;
@@ -234,28 +234,28 @@ namespace Vocaluxe.Base
//Name or comment
if (line[0] == '#')
{
- 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;
+ string identifier = line.Substring(1, pos - 1).Trim();
+ string value = line.Substring(pos + 1, line.Length - pos - 1).Trim();
+ if (identifier.ToUpper() == "NAME")
+ pl.PlaylistName = value;
}
//Song
else
{
- string Artist = line.Substring(0, pos - 1).Trim();
- string Title = line.Substring(pos + 1, line.Length - pos - 1).Trim();
+ 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++)
+ for (int s = 0; s < allSongs.Length; s++)
{
- if (AllSongs[s].Artist == Artist && AllSongs[s].Title == Title)
+ if (allSongs[s].Artist == artist && allSongs[s].Title == title)
{
- pl.AddSong(AllSongs[s].ID);
+ pl.AddSong(allSongs[s].ID);
found = true;
break;
}
}
if (!found)
- CLog.LogError("Can't find song '" + Title + "' from '" + Artist + "' in playlist file: " + file);
+ CLog.LogError("Can't find song '" + title + "' from '" + artist + "' in playlist file: " + file);
}
}
}
diff --git a/Vocaluxe/Base/CProfiles.cs b/Vocaluxe/Base/CProfiles.cs
index 93d4d657..176807e1 100644
--- a/Vocaluxe/Base/CProfiles.cs
+++ b/Vocaluxe/Base/CProfiles.cs
@@ -9,7 +9,7 @@ namespace Vocaluxe.Base
{
static class CProfiles
{
- private static readonly XmlWriterSettings _settings = new XmlWriterSettings();
+ private static readonly XmlWriterSettings _Settings = new XmlWriterSettings();
private static List _Profiles;
private static readonly List _Avatars = new List();
@@ -35,9 +35,9 @@ namespace Vocaluxe.Base
public static void Init()
{
- _settings.Indent = true;
- _settings.Encoding = Encoding.UTF8;
- _settings.ConformanceLevel = ConformanceLevel.Document;
+ _Settings.Indent = true;
+ _Settings.Encoding = Encoding.UTF8;
+ _Settings.ConformanceLevel = ConformanceLevel.Document;
LoadAvatars();
LoadProfiles();
@@ -48,7 +48,7 @@ namespace Vocaluxe.Base
return NewProfile(String.Empty);
}
- public static int NewProfile(string FileName)
+ public static int NewProfile(string fileName)
{
SProfile profile = new SProfile();
@@ -58,8 +58,8 @@ namespace Vocaluxe.Base
profile.GuestProfile = EOffOn.TR_CONFIG_OFF;
profile.Active = EOffOn.TR_CONFIG_ON;
- if (FileName.Length > 0)
- profile.ProfileFile = Path.Combine(CSettings.sFolderProfiles, FileName);
+ if (fileName.Length > 0)
+ profile.ProfileFile = Path.Combine(CSettings.FolderProfiles, fileName);
else
profile.ProfileFile = String.Empty;
@@ -73,7 +73,7 @@ namespace Vocaluxe.Base
public static void SaveProfiles()
{
for (int i = 0; i < _Profiles.Count; i++)
- SaveProfile(i);
+ _SaveProfile(i);
LoadProfiles();
}
@@ -81,12 +81,12 @@ namespace Vocaluxe.Base
{
_Profiles = new List();
List files = new List();
- files.AddRange(CHelper.ListFiles(CSettings.sFolderProfiles, "*.xml", true, true));
+ files.AddRange(CHelper.ListFiles(CSettings.FolderProfiles, "*.xml", true, true));
foreach (string file in files)
- LoadProfile(file);
+ _LoadProfile(file);
- SortProfilesByName();
+ _SortProfilesByName();
}
public static void LoadAvatars()
@@ -99,16 +99,16 @@ namespace Vocaluxe.Base
_Avatars.Clear();
List files = new List();
- files.AddRange(CHelper.ListFiles(CSettings.sFolderProfiles, "*.png", true, true));
- files.AddRange(CHelper.ListFiles(CSettings.sFolderProfiles, "*.jpg", true, true));
- files.AddRange(CHelper.ListFiles(CSettings.sFolderProfiles, "*.jpeg", true, true));
- files.AddRange(CHelper.ListFiles(CSettings.sFolderProfiles, "*.bmp", true, true));
+ files.AddRange(CHelper.ListFiles(CSettings.FolderProfiles, "*.png", true, true));
+ files.AddRange(CHelper.ListFiles(CSettings.FolderProfiles, "*.jpg", true, true));
+ files.AddRange(CHelper.ListFiles(CSettings.FolderProfiles, "*.jpeg", true, true));
+ files.AddRange(CHelper.ListFiles(CSettings.FolderProfiles, "*.bmp", true, true));
foreach (string file in files)
{
STexture tex = CDraw.AddTexture(file);
- if (tex.index != -1)
+ if (tex.Index != -1)
{
SAvatar avatar = new SAvatar();
avatar.Texture = tex;
@@ -118,179 +118,179 @@ namespace Vocaluxe.Base
}
}
- public static string AddGetPlayerName(int ProfileNr, char Chr)
+ public static string AddGetPlayerName(int profileNr, char chr)
{
- if (ProfileNr < 0 || ProfileNr >= _Profiles.Count)
+ if (profileNr < 0 || profileNr >= _Profiles.Count)
return String.Empty;
- SProfile profile = _Profiles[ProfileNr];
- profile.PlayerName += Chr;
- _Profiles[ProfileNr] = profile;
+ SProfile profile = _Profiles[profileNr];
+ profile.PlayerName += chr;
+ _Profiles[profileNr] = profile;
return profile.PlayerName;
}
- public static string GetPlayerName(int ProfileNr)
+ public static string GetPlayerName(int profileNr)
{
- if (ProfileNr < 0 || ProfileNr >= _Profiles.Count)
+ if (profileNr < 0 || profileNr >= _Profiles.Count)
return String.Empty;
- return _Profiles[ProfileNr].PlayerName;
+ return _Profiles[profileNr].PlayerName;
}
- public static string GetDeleteCharInPlayerName(int ProfileNr)
+ public static string GetDeleteCharInPlayerName(int profileNr)
{
- if (ProfileNr < 0 || ProfileNr >= _Profiles.Count)
+ if (profileNr < 0 || profileNr >= _Profiles.Count)
return String.Empty;
- SProfile profile = _Profiles[ProfileNr];
+ SProfile profile = _Profiles[profileNr];
if (profile.PlayerName.Length > 0)
profile.PlayerName = profile.PlayerName.Remove(profile.PlayerName.Length - 1);
- _Profiles[ProfileNr] = profile;
+ _Profiles[profileNr] = profile;
return profile.PlayerName;
}
- public static EGameDifficulty GetDifficulty(int ProfileNr)
+ public static EGameDifficulty GetDifficulty(int profileNr)
{
- if (ProfileNr < 0 || ProfileNr >= _Profiles.Count)
+ if (profileNr < 0 || profileNr >= _Profiles.Count)
return EGameDifficulty.TR_CONFIG_NORMAL;
- return _Profiles[ProfileNr].Difficulty;
+ return _Profiles[profileNr].Difficulty;
}
- public static void SetDifficulty(int ProfileNr, EGameDifficulty Difficulty)
+ public static void SetDifficulty(int profileNr, EGameDifficulty difficulty)
{
- if (ProfileNr < 0 || ProfileNr >= _Profiles.Count)
+ if (profileNr < 0 || profileNr >= _Profiles.Count)
return;
- SProfile profile = _Profiles[ProfileNr];
- profile.Difficulty = Difficulty;
- _Profiles[ProfileNr] = profile;
+ SProfile profile = _Profiles[profileNr];
+ profile.Difficulty = difficulty;
+ _Profiles[profileNr] = profile;
}
- public static EOffOn GetGuestProfile(int ProfileNr)
+ public static EOffOn GetGuestProfile(int profileNr)
{
- if (ProfileNr < 0 || ProfileNr >= _Profiles.Count)
+ if (profileNr < 0 || profileNr >= _Profiles.Count)
return EOffOn.TR_CONFIG_OFF;
- return _Profiles[ProfileNr].GuestProfile;
+ return _Profiles[profileNr].GuestProfile;
}
- public static EOffOn GetActive(int ProfileNr)
+ public static EOffOn GetActive(int profileNr)
{
- if (ProfileNr < 0 || ProfileNr >= _Profiles.Count)
+ if (profileNr < 0 || profileNr >= _Profiles.Count)
return EOffOn.TR_CONFIG_OFF;
- return _Profiles[ProfileNr].Active;
+ return _Profiles[profileNr].Active;
}
- public static void SetGuestProfile(int ProfileNr, EOffOn Option)
+ public static void SetGuestProfile(int profileNr, EOffOn option)
{
- if (ProfileNr < 0 || ProfileNr >= _Profiles.Count)
+ if (profileNr < 0 || profileNr >= _Profiles.Count)
return;
- SProfile profile = _Profiles[ProfileNr];
- profile.GuestProfile = Option;
- _Profiles[ProfileNr] = profile;
+ SProfile profile = _Profiles[profileNr];
+ profile.GuestProfile = option;
+ _Profiles[profileNr] = profile;
}
- public static void SetActive(int ProfileNr, EOffOn Option)
+ public static void SetActive(int profileNr, EOffOn option)
{
- if (ProfileNr < 0 || ProfileNr >= _Profiles.Count)
+ if (profileNr < 0 || profileNr >= _Profiles.Count)
return;
- SProfile profile = _Profiles[ProfileNr];
- profile.Active = Option;
- _Profiles[ProfileNr] = profile;
+ SProfile profile = _Profiles[profileNr];
+ profile.Active = option;
+ _Profiles[profileNr] = profile;
}
- public static bool IsGuestProfile(int ProfileNr)
+ public static bool IsGuestProfile(int profileNr)
{
- if (ProfileNr < 0 || ProfileNr >= _Profiles.Count)
+ if (profileNr < 0 || profileNr >= _Profiles.Count)
return true; // this will prevent from saving dummy profiles to highscore db
- return _Profiles[ProfileNr].GuestProfile == EOffOn.TR_CONFIG_ON;
+ return _Profiles[profileNr].GuestProfile == EOffOn.TR_CONFIG_ON;
}
- public static bool IsActive(int ProfileNr)
+ public static bool IsActive(int profileNr)
{
- if (ProfileNr < 0 || ProfileNr >= _Profiles.Count)
+ if (profileNr < 0 || profileNr >= _Profiles.Count)
return false;
- return _Profiles[ProfileNr].Active == EOffOn.TR_CONFIG_ON;
+ return _Profiles[profileNr].Active == EOffOn.TR_CONFIG_ON;
}
- public static void SetAvatar(int ProfileNr, int AvatarNr)
+ public static void SetAvatar(int profileNr, int avatarNr)
{
- if (ProfileNr < 0 || ProfileNr >= _Profiles.Count || AvatarNr < 0 || AvatarNr >= _Avatars.Count)
+ if (profileNr < 0 || profileNr >= _Profiles.Count || avatarNr < 0 || avatarNr >= _Avatars.Count)
return;
- SProfile profile = _Profiles[ProfileNr];
- profile.Avatar = _Avatars[AvatarNr];
- _Profiles[ProfileNr] = profile;
+ SProfile profile = _Profiles[profileNr];
+ profile.Avatar = _Avatars[avatarNr];
+ _Profiles[profileNr] = profile;
}
- public static int GetAvatarNr(int ProfileNr)
+ public static int GetAvatarNr(int profileNr)
{
- if (ProfileNr < 0 || ProfileNr >= _Profiles.Count)
+ if (profileNr < 0 || profileNr >= _Profiles.Count)
return 0;
for (int i = 0; i < _Avatars.Count; i++)
{
- if (_Profiles[ProfileNr].Avatar.FileName == _Avatars[i].FileName)
+ if (_Profiles[profileNr].Avatar.FileName == _Avatars[i].FileName)
return i;
}
return 0;
}
- public static void DeleteProfile(int ProfileID)
+ public static void DeleteProfile(int profileID)
{
- if (ProfileID < 0 || ProfileID >= _Profiles.Count)
+ if (profileID < 0 || profileID >= _Profiles.Count)
return;
- if (_Profiles[ProfileID].ProfileFile.Length > 0)
+ if (_Profiles[profileID].ProfileFile.Length > 0)
{
try
{
- File.Delete(_Profiles[ProfileID].ProfileFile);
- _Profiles.RemoveAt(ProfileID);
+ File.Delete(_Profiles[profileID].ProfileFile);
+ _Profiles.RemoveAt(profileID);
}
catch (Exception)
{
- CLog.LogError("Can't delete Profile File " + _Profiles[ProfileID].ProfileFile + ".xml");
+ CLog.LogError("Can't delete Profile File " + _Profiles[profileID].ProfileFile + ".xml");
}
}
}
- private static void SortProfilesByName()
+ private static void _SortProfilesByName()
{
- _Profiles.Sort(CompareByPlayerName);
+ _Profiles.Sort(_CompareByPlayerName);
}
- private static int CompareByPlayerName(SProfile a, SProfile b)
+ private static int _CompareByPlayerName(SProfile a, SProfile b)
{
return String.Compare(a.PlayerName, b.PlayerName);
}
#region private methods
- private static SAvatar GetAvatar(string FileName)
+ private static SAvatar _GetAvatar(string fileName)
{
foreach (SAvatar avatar in _Avatars)
{
- if (FileName == avatar.FileName)
+ if (fileName == avatar.FileName)
return avatar;
}
return new SAvatar(-1);
}
- private static void SaveProfile(int ProfileID)
+ private static void _SaveProfile(int profileID)
{
- if (ProfileID < 0 || ProfileID >= _Profiles.Count)
+ if (profileID < 0 || profileID >= _Profiles.Count)
return;
- if (_Profiles[ProfileID].ProfileFile.Length == 0)
+ if (_Profiles[profileID].ProfileFile.Length == 0)
{
string filename = string.Empty;
- foreach (char chr in _Profiles[ProfileID].PlayerName)
+ foreach (char chr in _Profiles[profileID].PlayerName)
{
if (char.IsLetter(chr))
filename += chr.ToString();
@@ -300,26 +300,26 @@ namespace Vocaluxe.Base
filename = "1";
int i = 0;
- while (File.Exists(Path.Combine(CSettings.sFolderProfiles, filename + ".xml")))
+ while (File.Exists(Path.Combine(CSettings.FolderProfiles, filename + ".xml")))
{
i++;
- if (!File.Exists(Path.Combine(CSettings.sFolderProfiles, filename + i + ".xml")))
+ if (!File.Exists(Path.Combine(CSettings.FolderProfiles, filename + i + ".xml")))
filename += i;
}
- SProfile profile = _Profiles[ProfileID];
- profile.ProfileFile = Path.Combine(CSettings.sFolderProfiles, filename + ".xml");
- _Profiles[ProfileID] = profile;
+ SProfile profile = _Profiles[profileID];
+ profile.ProfileFile = Path.Combine(CSettings.FolderProfiles, filename + ".xml");
+ _Profiles[profileID] = profile;
}
XmlWriter writer;
try
{
- writer = XmlWriter.Create(_Profiles[ProfileID].ProfileFile, _settings);
+ writer = XmlWriter.Create(_Profiles[profileID].ProfileFile, _Settings);
}
catch (Exception e)
{
- CLog.LogError("Error creating/opening Profile File " + _Profiles[ProfileID].ProfileFile + ": " + e.Message);
+ CLog.LogError("Error creating/opening Profile File " + _Profiles[profileID].ProfileFile + ": " + e.Message);
return;
}
try
@@ -328,11 +328,11 @@ namespace Vocaluxe.Base
writer.WriteStartElement("root");
writer.WriteStartElement("Info");
- writer.WriteElementString("PlayerName", _Profiles[ProfileID].PlayerName);
- writer.WriteElementString("Difficulty", Enum.GetName(typeof(EGameDifficulty), _Profiles[ProfileID].Difficulty));
- writer.WriteElementString("Avatar", _Profiles[ProfileID].Avatar.FileName);
- writer.WriteElementString("GuestProfile", Enum.GetName(typeof(EOffOn), _Profiles[ProfileID].GuestProfile));
- writer.WriteElementString("Active", Enum.GetName(typeof(EOffOn), _Profiles[ProfileID].Active));
+ writer.WriteElementString("PlayerName", _Profiles[profileID].PlayerName);
+ writer.WriteElementString("Difficulty", Enum.GetName(typeof(EGameDifficulty), _Profiles[profileID].Difficulty));
+ writer.WriteElementString("Avatar", _Profiles[profileID].Avatar.FileName);
+ writer.WriteElementString("GuestProfile", Enum.GetName(typeof(EOffOn), _Profiles[profileID].GuestProfile));
+ writer.WriteElementString("Active", Enum.GetName(typeof(EOffOn), _Profiles[profileID].Active));
writer.WriteEndElement();
writer.WriteEndElement(); //end of root
@@ -347,10 +347,10 @@ namespace Vocaluxe.Base
}
}
- private static void LoadProfile(string FileName)
+ private static void _LoadProfile(string fileName)
{
SProfile profile = new SProfile();
- profile.ProfileFile = Path.Combine(CSettings.sFolderProfiles, FileName);
+ profile.ProfileFile = Path.Combine(CSettings.FolderProfiles, fileName);
CXMLReader xmlReader = CXMLReader.OpenFile(profile.ProfileFile);
if (xmlReader == null)
@@ -366,7 +366,7 @@ namespace Vocaluxe.Base
profile.Avatar = new SAvatar(-1);
if (xmlReader.GetValue("//root/Info/Avatar", ref value, value))
- profile.Avatar = GetAvatar(value);
+ profile.Avatar = _GetAvatar(value);
profile.GuestProfile = EOffOn.TR_CONFIG_OFF;
xmlReader.TryGetEnumValue("//root/Info/GuestProfile", ref profile.GuestProfile);
@@ -377,7 +377,7 @@ namespace Vocaluxe.Base
_Profiles.Add(profile);
}
else
- CLog.LogError("Can't find PlayerName in Profile File: " + FileName);
+ CLog.LogError("Can't find PlayerName in Profile File: " + fileName);
}
#endregion private methods
}
diff --git a/Vocaluxe/Base/CSettings.cs b/Vocaluxe/Base/CSettings.cs
index 724171f2..47a957ac 100644
--- a/Vocaluxe/Base/CSettings.cs
+++ b/Vocaluxe/Base/CSettings.cs
@@ -13,85 +13,79 @@ namespace Vocaluxe.Base
Release
}
- enum EArch
- {
- x86,
- x64
- }
-
static class CSettings
{
#if ARCH_X86
- public const EArch ARCH = EArch.x86;
+ public const String Arch = "x86";
#endif
#if ARCH_X64
- public const EArch ARCH = EArch.x64;
+ public const String Arch = "x64";
#endif
public static EGameState GameState = EGameState.Start;
- public const string sProgramName = "Vocaluxe";
- public const string sProgramCodeName = "Shining Heaven";
+ public const string ProgramName = "Vocaluxe";
+ public const string ProgramCodeName = "Shining Heaven";
- public const int iVersionMajor = 0;
- public const int iVersionMinor = 3; // milestones
- public const int iVersionSub = 0; // patches
+ public const int VersionMajor = 0;
+ public const int VersionMinor = 3; // milestones
+ public const int VersionSub = 0; // patches
public const ERevision VersionRevision = ERevision.Alpha;
- public const int iBuild = 77; // Increase on every published version! Never Reset!
+ public const int Build = 77; // Increase on every published version! Never Reset!
- public const int iDatabaseHighscoreVersion = 2;
- public const int iDatabaseCoverVersion = 1;
- public const int iDatabaseCreditsRessourcesVersion = 1;
+ public const int DatabaseHighscoreVersion = 2;
+ public const int DatabaseCoverVersion = 1;
+ public const int DatabaseCreditsRessourcesVersion = 1;
- public static int iRenderW = 1280;
- public static int iRenderH = 720;
+ public static int RenderW = 1280;
+ public static int RenderH = 720;
- public static int zNear = -100;
- public static int zFar = 100;
+ public const int ZNear = -100;
+ public const int ZFar = 100;
- public static bool bFullScreen = false;
- public static int iVertexBufferElements = 10000;
+ public static bool IsFullScreen = false;
+ public static int VertexBufferElements = 10000;
- public const string sIcon = "Vocaluxe.ico";
- public const string sLogo = "Logo.png";
+ public const string Icon = "Vocaluxe.ico";
+ public const string Logo = "Logo.png";
public const string FallbackLanguage = "English";
- public static string sBassRegistration = "Registration.xml";
- public static string sFileConfig = "Config.xml";
- public const string sFileCover = "Cover.xml";
- public const string sFileFonts = "Fonts.xml";
+ public const string BassRegistration = "Registration.xml";
+ public static string FileConfig = "Config.xml";
+ public const string FileCover = "Cover.xml";
+ public const string FileFonts = "Fonts.xml";
- public const string sFileOldHighscoreDB = "Ultrastar.db";
- public static string sFileHighscoreDB = "HighscoreDB.sqlite";
- public const string sFileCoverDB = "CoverDB.sqlite";
- public const string sFileCreditsRessourcesDB = "CreditsRessourcesDB.sqlite";
- public const string sFilePerformanceLog = "Performance.log";
- public const string sFileErrorLog = "Error.log";
- public const string sFileBenchmarkLog = "Benchmark.log";
+ public const string FileOldHighscoreDB = "Ultrastar.db";
+ public static string FileHighscoreDB = "HighscoreDB.sqlite";
+ public const string FileCoverDB = "CoverDB.sqlite";
+ public const string FileCreditsRessourcesDB = "CreditsRessourcesDB.sqlite";
+ public const string FilePerformanceLog = "Performance.log";
+ public const string FileErrorLog = "Error.log";
+ public const string FileBenchmarkLog = "Benchmark.log";
- public const string sSoundT440 = "440Hz.mp3";
+ public const string SoundT440 = "440Hz.mp3";
- public const string sFolderCover = "Cover";
- public const string sFolderGraphics = "Graphics";
- public const string sFolderFonts = "Fonts";
- public const string sFolderThemes = "Themes";
- public const string sFolderSkins = "Skins";
- public const string sFolderThemeFonts = "Fonts";
- public const string sFolderScreens = "Screens";
- public static string sFolderProfiles = "Profiles";
- public const string sFolderSongs = "Songs";
- public const string sFolderSounds = "Sounds";
- public const string sFolderLanguages = "Languages";
- public const string sFolderScreenshots = "Screenshots";
- public const string sFolderBackgroundMusic = "BackgroundMusic";
- public static string sFolderPlaylists = "Playlists";
+ public const string FolderCover = "Cover";
+ public const string FolderGraphics = "Graphics";
+ public const string FolderFonts = "Fonts";
+ public const string FolderThemes = "Themes";
+ public const string FolderSkins = "Skins";
+ public const string FolderThemeFonts = "Fonts";
+ public const string FolderScreens = "Screens";
+ public static string FolderProfiles = "Profiles";
+ public const string FolderSongs = "Songs";
+ public const string FolderSounds = "Sounds";
+ public const string FolderLanguages = "Languages";
+ public const string FolderScreenshots = "Screenshots";
+ public const string FolderBackgroundMusic = "BackgroundMusic";
+ public static string FolderPlaylists = "Playlists";
- public static string sFolderPartyModes = "PartyModes";
- public const string sFolderPartyModeCode = "Code";
- public const string sFolderPartyModeScreens = "Screens";
- public const string sFolderPartyModeLanguages = "Languages";
- public const string sFolderPartyModeFonts = "Fonts";
+ public const string FolderPartyModes = "PartyModes";
+ public const string FolderPartyModeCode = "Code";
+ public const string FolderPartyModeScreens = "Screens";
+ public const string FolderPartyModeLanguages = "Languages";
+ public const string FolderPartyModeFonts = "Fonts";
//public const String[] ToneStrings = new String[]{ "C", "C#", "D", "D#", "E", "F", "F#", "G", "G#", "A", "A#", "B" };
public const int ToneMin = -36;
@@ -129,39 +123,39 @@ namespace Vocaluxe.Base
public static string GetVersionText()
{
- string sVersion = "v" + iVersionMajor.ToString() + "." +
- iVersionMinor.ToString() + "." +
- iVersionSub.ToString() + " (" + Enum.GetName(typeof(EArch), ARCH) + ")";
+ string version = "v" + VersionMajor.ToString() + "." +
+ VersionMinor.ToString() + "." +
+ VersionSub.ToString() + " (" + Arch + ")";
if (VersionRevision != ERevision.Release)
- sVersion += " " + GetVersionStatus() + String.Format(" ({0:0000)}", iBuild);
+ version += " " + GetVersionStatus() + String.Format(" ({0:0000)}", Build);
- return sVersion;
+ return version;
}
public static string GetFullVersionText()
{
- string sVersion = sProgramName;
+ string version = ProgramName;
- if (sProgramCodeName.Length > 0)
- sVersion += " \"" + sProgramCodeName + "\"";
+ if (ProgramCodeName.Length > 0)
+ version += " \"" + ProgramCodeName + "\"";
- return sVersion += " " + GetVersionText();
+ return version + " " + GetVersionText();
}
public static string GetVersionStatus()
{
- string _Result = String.Empty;
+ string result = String.Empty;
if (VersionRevision != ERevision.Release)
- _Result = Enum.GetName(typeof(ERevision), VersionRevision);
+ result = Enum.GetName(typeof(ERevision), VersionRevision);
- return _Result;
+ return result;
}
public static float GetRenderAspect()
{
- return iRenderW / (float)iRenderH;
+ return RenderW / (float)RenderH;
}
public static void MouseInactive()
@@ -176,18 +170,18 @@ namespace Vocaluxe.Base
public static void CreateFolders()
{
- List Folders = new List();
+ List folders = new List();
- Folders.Add(sFolderCover);
- Folders.Add(sFolderFonts);
- Folders.Add(sFolderProfiles);
- Folders.Add(sFolderSongs);
- Folders.Add(sFolderScreenshots);
- Folders.Add(sFolderBackgroundMusic);
- Folders.Add(sFolderSounds);
- Folders.Add(sFolderPlaylists);
+ folders.Add(FolderCover);
+ folders.Add(FolderFonts);
+ folders.Add(FolderProfiles);
+ folders.Add(FolderSongs);
+ folders.Add(FolderScreenshots);
+ folders.Add(FolderBackgroundMusic);
+ folders.Add(FolderSounds);
+ folders.Add(FolderPlaylists);
- foreach (string folder in Folders)
+ foreach (string folder in folders)
{
string path = Path.Combine(Environment.CurrentDirectory, folder);
CreateFolder(path);
diff --git a/Vocaluxe/Base/CSongCategorizer.cs b/Vocaluxe/Base/CSongCategorizer.cs
index 8ac25804..c51ab696 100644
--- a/Vocaluxe/Base/CSongCategorizer.cs
+++ b/Vocaluxe/Base/CSongCategorizer.cs
@@ -13,7 +13,7 @@ namespace Vocaluxe.Base
public CSongCategorizer()
{
- CSongs.Filter.ObjectChanged += HandleSortedSongsChanged;
+ CSongs.Filter.ObjectChanged += _HandleSortedSongsChanged;
}
public List Categories
@@ -38,7 +38,7 @@ namespace Vocaluxe.Base
}
}
- private void HandleSortedSongsChanged(object sender, EventArgs args)
+ private void _HandleSortedSongsChanged(object sender, EventArgs args)
{
_SetChanged();
}
@@ -46,7 +46,7 @@ namespace Vocaluxe.Base
private void _CreateCategoriesLetter()
{
string category = "";
- int NotLetterCat = -1;
+ 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]);
@@ -55,7 +55,7 @@ namespace Vocaluxe.Base
firstLetter = '#';
if (firstLetter.ToString() != category)
{
- if (firstLetter != '#' || NotLetterCat == -1)
+ if (firstLetter != '#' || notLetterCat == -1)
{
category = firstLetter.ToString();
_Categories.Add(new CCategory(category));
@@ -63,20 +63,20 @@ namespace Vocaluxe.Base
CSongs.Sorter.SortedSongs[i].CatIndex = _Categories.Count - 1;
if (firstLetter == '#')
- NotLetterCat = CSongs.Sorter.SortedSongs[i].CatIndex;
+ notLetterCat = CSongs.Sorter.SortedSongs[i].CatIndex;
}
else
- CSongs.Sorter.SortedSongs[i].CatIndex = NotLetterCat;
+ CSongs.Sorter.SortedSongs[i].CatIndex = notLetterCat;
}
else
CSongs.Sorter.SortedSongs[i].CatIndex = _Categories.Count - 1;
}
}
- private void _CreateCategoriesNormal(string NoCategoryName)
+ private void _CreateCategoriesNormal(string noCategoryName)
{
string category = "";
- int NoCategoryIndex = -1;
+ int noCategoryIndex = -1;
for (int i = 0; i < CSongs.Sorter.SortedSongs.Length; i++)
{
if (CSongs.Sorter.SortedSongs[i].SortString.Length > 0)
@@ -90,59 +90,59 @@ namespace Vocaluxe.Base
}
else
{
- if (NoCategoryIndex < 0)
+ if (noCategoryIndex < 0)
{
- category = NoCategoryName;
+ category = noCategoryName;
_Categories.Add(new CCategory(category));
- NoCategoryIndex = _Categories.Count - 1;
+ noCategoryIndex = _Categories.Count - 1;
}
- CSongs.Sorter.SortedSongs[i].CatIndex = NoCategoryIndex;
+ CSongs.Sorter.SortedSongs[i].CatIndex = noCategoryIndex;
}
}
}
private void _CreateCategories()
{
- string NoCategoryName = "";
+ string noCategoryName = "";
- ESongSorting Sorting = CSongs.Sorter.SongSorting;
+ ESongSorting sorting = CSongs.Sorter.SongSorting;
- switch (Sorting)
+ switch (sorting)
{
case ESongSorting.TR_CONFIG_EDITION:
- NoCategoryName = CLanguage.Translate("TR_SCREENSONG_NOEDITION");
+ noCategoryName = CLanguage.Translate("TR_SCREENSONG_NOEDITION");
break;
case ESongSorting.TR_CONFIG_GENRE:
- NoCategoryName = CLanguage.Translate("TR_SCREENSONG_NOGENRE");
+ noCategoryName = CLanguage.Translate("TR_SCREENSONG_NOGENRE");
break;
case ESongSorting.TR_CONFIG_DECADE:
case ESongSorting.TR_CONFIG_YEAR:
- NoCategoryName = CLanguage.Translate("TR_SCREENSONG_NOYEAR");
+ noCategoryName = CLanguage.Translate("TR_SCREENSONG_NOYEAR");
break;
case ESongSorting.TR_CONFIG_LANGUAGE:
- NoCategoryName = CLanguage.Translate("TR_SCREENSONG_NOLANGUAGE");
+ noCategoryName = CLanguage.Translate("TR_SCREENSONG_NOLANGUAGE");
break;
case ESongSorting.TR_CONFIG_NONE:
- NoCategoryName = CLanguage.Translate("TR_SCREENSONG_ALLSONGS");
+ noCategoryName = CLanguage.Translate("TR_SCREENSONG_ALLSONGS");
break;
}
- if (Sorting == ESongSorting.TR_CONFIG_ARTIST_LETTER || Sorting == ESongSorting.TR_CONFIG_TITLE_LETTER)
+ if (sorting == ESongSorting.TR_CONFIG_ARTIST_LETTER || sorting == ESongSorting.TR_CONFIG_TITLE_LETTER)
_CreateCategoriesLetter();
else
{
- if (Sorting == ESongSorting.TR_CONFIG_DECADE)
+ 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)
+ 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";
+ year = year.Substring(0, 3);
+ CSongs.Sorter.SortedSongs[i].SortString = year + "0 - " + year + "9";
}
}
}
- _CreateCategoriesNormal(NoCategoryName);
+ _CreateCategoriesNormal(noCategoryName);
}
}
diff --git a/Vocaluxe/Base/CSongSorter.cs b/Vocaluxe/Base/CSongSorter.cs
index 6687b79d..ec5a486b 100644
--- a/Vocaluxe/Base/CSongSorter.cs
+++ b/Vocaluxe/Base/CSongSorter.cs
@@ -8,16 +8,16 @@ namespace Vocaluxe.Base
{
class CSongSorter : CObservable
{
- private SongPointer[] _SortedSongs = new SongPointer[0];
+ private SSongPointer[] _SortedSongs = new SSongPointer[0];
private EOffOn _IgnoreArticles = CConfig.IgnoreArticles;
private ESongSorting _SongSorting = CConfig.SongSorting;
public CSongSorter()
{
- CSongs.Filter.ObjectChanged += HandleFilteredSongsChanged;
+ CSongs.Filter.ObjectChanged += _HandleFilteredSongsChanged;
}
- public SongPointer[] SortedSongs
+ public SSongPointer[] SortedSongs
{
get
{
@@ -62,12 +62,12 @@ namespace Vocaluxe.Base
}
}
- private void HandleFilteredSongsChanged(object sender, EventArgs args)
+ private void _HandleFilteredSongsChanged(object sender, EventArgs args)
{
_SetChanged();
}
- private int _SortByFieldArtistTitle(SongPointer s1, SongPointer s2)
+ private int _SortByFieldArtistTitle(SSongPointer s1, SSongPointer s2)
{
int res = s1.SortString.ToUpper().CompareTo(s2.SortString.ToUpper());
if (res == 0)
@@ -90,7 +90,7 @@ namespace Vocaluxe.Base
return res;
}
- private int _SortByFieldTitle(SongPointer s1, SongPointer s2)
+ private int _SortByFieldTitle(SSongPointer s1, SSongPointer s2)
{
int res = s1.SortString.ToUpper().CompareTo(s2.SortString.ToUpper());
if (res == 0)
@@ -103,13 +103,13 @@ namespace Vocaluxe.Base
return res;
}
- private List _CreateSortList(string fieldName)
+ private List _CreateSortList(string fieldName)
{
FieldInfo field = null;
bool isString = false;
- List SortList = new List();
+ List sortList = new List();
if (fieldName.Length == 0)
- CSongs.Filter.FilteredSongs.ForEach((song) => SortList.Add(new SongPointer(song.ID, "")));
+ CSongs.Filter.FilteredSongs.ForEach((song) => sortList.Add(new SSongPointer(song.ID, "")));
else
{
field = typeof(CSong).GetField(fieldName, BindingFlags.Instance | BindingFlags.DeclaredOnly | BindingFlags.Public);
@@ -120,21 +120,21 @@ namespace Vocaluxe.Base
{
object value = field.GetValue(song);
if (isString)
- SortList.Add(new SongPointer(song.ID, (String)value));
+ sortList.Add(new SSongPointer(song.ID, (String)value));
else
{
List values = (List)value;
if (values.Count == 0)
- SortList.Add(new SongPointer(song.ID, ""));
+ sortList.Add(new SSongPointer(song.ID, ""));
else
{
foreach (String sortString in (List)value)
- SortList.Add(new SongPointer(song.ID, sortString));
+ sortList.Add(new SSongPointer(song.ID, sortString));
}
}
}
}
- return SortList;
+ return sortList;
}
private void _SortSongs()
@@ -177,19 +177,19 @@ namespace Vocaluxe.Base
fieldName = "";
break;
}
- List SortList = _CreateSortList(fieldName);
+ List sortList = _CreateSortList(fieldName);
switch (_SongSorting)
{
case ESongSorting.TR_CONFIG_ARTIST_LETTER:
case ESongSorting.TR_CONFIG_ARTIST:
case ESongSorting.TR_CONFIG_NONE:
- SortList.Sort(_SortByFieldTitle);
+ sortList.Sort(_SortByFieldTitle);
break;
default:
- SortList.Sort(_SortByFieldArtistTitle);
+ sortList.Sort(_SortByFieldArtistTitle);
break;
}
- _SortedSongs = SortList.ToArray();
+ _SortedSongs = sortList.ToArray();
_Changed = false;
}
}
diff --git a/Vocaluxe/Base/CSongs.cs b/Vocaluxe/Base/CSongs.cs
index 53e30bba..8aa56dd6 100644
--- a/Vocaluxe/Base/CSongs.cs
+++ b/Vocaluxe/Base/CSongs.cs
@@ -8,7 +8,7 @@ using VocaluxeLib.Menu.SongMenu;
namespace Vocaluxe.Base
{
- public struct SongPointer
+ public struct SSongPointer
{
public int SongID;
public string SortString;
@@ -17,9 +17,9 @@ namespace Vocaluxe.Base
public bool Visible;
public bool PartyHidden;
- public SongPointer(int ID, string sortString)
+ public SSongPointer(int iD, string sortString)
{
- SongID = ID;
+ SongID = iD;
SortString = sortString;
CatIndex = -1;
Visible = false;
@@ -75,13 +75,13 @@ namespace Vocaluxe.Base
{
get
{
- int Result = 0;
- foreach (SongPointer sp in Sorter.SortedSongs)
+ int result = 0;
+ foreach (SSongPointer sp in Sorter.SortedSongs)
{
if (sp.Visible)
- Result++;
+ result++;
}
- return Result;
+ return result;
}
}
@@ -113,17 +113,17 @@ namespace Vocaluxe.Base
///
/// Returns the number of song in the category specified with CatIndex
///
- /// Category index
+ /// Category index
///
- public static int NumSongsInCategory(int CatIndex)
+ public static int NumSongsInCategory(int catIndex)
{
- if (Categorizer.Categories.Count <= CatIndex || CatIndex < 0)
+ if (Categorizer.Categories.Count <= catIndex || catIndex < 0)
return 0;
int num = 0;
for (int i = 0; i < Sorter.SortedSongs.Length; i++)
{
- if (Sorter.SortedSongs[i].CatIndex == CatIndex && !Sorter.SortedSongs[i].PartyHidden)
+ if (Sorter.SortedSongs[i].CatIndex == catIndex && !Sorter.SortedSongs[i].PartyHidden)
num++;
}
return num;
@@ -145,14 +145,14 @@ namespace Vocaluxe.Base
Category--;
}
- public static int GetNextSongWithoutCover(ref CSong Song)
+ public static int GetNextSongWithoutCover(ref CSong song)
{
if (!SongsLoaded)
return -1;
if (_CoverLoadIndex < _Songs.Count)
{
- Song = _Songs[_CoverLoadIndex];
+ song = _Songs[_CoverLoadIndex];
_CoverLoadIndex++;
return _CoverLoadIndex;
}
@@ -165,22 +165,22 @@ namespace Vocaluxe.Base
get { return _CoverLoadIndex; }
}
- public static void SetCoverSmall(int SongIndex, STexture Texture)
+ public static void SetCoverSmall(int songIndex, STexture texture)
{
if (!_SongsLoaded)
return;
- if (SongIndex < _Songs.Count)
- _Songs[SongIndex].CoverTextureSmall = Texture;
+ if (songIndex < _Songs.Count)
+ _Songs[songIndex].CoverTextureSmall = texture;
}
- public static void SetCoverBig(int SongIndex, STexture Texture)
+ public static void SetCoverBig(int songIndex, STexture texture)
{
if (!_SongsLoaded)
return;
- if (SongIndex < _Songs.Count)
- _Songs[SongIndex].CoverTextureBig = Texture;
+ if (songIndex < _Songs.Count)
+ _Songs[songIndex].CoverTextureBig = texture;
}
public static string GetCurrentCategoryName()
@@ -191,22 +191,22 @@ namespace Vocaluxe.Base
return String.Empty;
}
- public static CSong GetSong(int SongID)
+ public static CSong GetSong(int songID)
{
foreach (CSong song in _Songs)
{
- if (song.ID == SongID)
+ if (song.ID == songID)
return song;
}
return null;
}
- public static void AddPartySongSung(int SongID)
+ public static void AddPartySongSung(int songID)
{
int cat = -1;
for (int i = 0; i < Sorter.SortedSongs.Length; i++)
{
- if (SongID == Sorter.SortedSongs[i].SongID)
+ if (songID == Sorter.SortedSongs[i].SongID)
{
Sorter.SortedSongs[i].PartyHidden = true;
Sorter.SortedSongs[i].Visible = false;
@@ -231,11 +231,11 @@ namespace Vocaluxe.Base
}
}
- public static void ResetPartySongSung(int CatIndex)
+ public static void ResetPartySongSung(int catIndex)
{
for (int i = 0; i < Sorter.SortedSongs.Length; i++)
{
- if (Sorter.SortedSongs[i].CatIndex == CatIndex)
+ if (Sorter.SortedSongs[i].CatIndex == catIndex)
{
Sorter.SortedSongs[i].PartyHidden = false;
Sorter.SortedSongs[i].Visible = Sorter.SortedSongs[i].CatIndex == _CatIndex && !Sorter.SortedSongs[i].PartyHidden;
@@ -243,13 +243,13 @@ namespace Vocaluxe.Base
}
}
- public static int GetVisibleSongNumber(int SongID)
+ public static int GetVisibleSongNumber(int songID)
{
int i = -1;
foreach (CSong song in VisibleSongs)
{
i++;
- if (song.ID == SongID)
+ if (song.ID == songID)
return i;
}
return i;
@@ -284,7 +284,7 @@ namespace Vocaluxe.Base
CCategory category = _CategoriesForRandom[CGame.Rand.Next(0, _CategoriesForRandom.Count - 1)];
_CategoriesForRandom.Remove(category);
- return GetCategoryNumber(category);
+ return _GetCategoryNumber(category);
}
public static void UpdateRandomCategoryList()
@@ -293,7 +293,7 @@ namespace Vocaluxe.Base
_CategoriesForRandom.AddRange(Categories);
}
- private static int GetCategoryNumber(CCategory category)
+ private static int _GetCategoryNumber(CCategory category)
{
for (int i = 0; i < Categories.Length; i++)
{
@@ -313,7 +313,7 @@ namespace Vocaluxe.Base
get
{
List songs = new List();
- foreach (SongPointer sp in Sorter.SortedSongs)
+ foreach (SSongPointer sp in Sorter.SortedSongs)
{
if (sp.Visible)
songs.Add(_Songs[sp.SongID]);
@@ -327,7 +327,7 @@ namespace Vocaluxe.Base
get
{
List songs = new List();
- foreach (SongPointer sp in Sorter.SortedSongs)
+ foreach (SSongPointer sp in Sorter.SortedSongs)
{
if (sp.Visible)
songs.Add(_Songs[sp.SongID]);
@@ -346,7 +346,7 @@ namespace Vocaluxe.Base
if (index < 0)
return null;
- foreach (SongPointer sp in Sorter.SortedSongs)
+ foreach (SSongPointer sp in Sorter.SortedSongs)
{
if (sp.Visible)
{
@@ -358,17 +358,17 @@ namespace Vocaluxe.Base
return null;
}
- private static void HandleCategoriesChanged(object sender, EventArgs args)
+ private static void _HandleCategoriesChanged(object sender, EventArgs args)
{
_CategoriesForRandom.Clear();
Category = _CatIndex;
}
- public static void Sort(ESongSorting Sorting, EOffOn Tabs, EOffOn IgnoreArticles, String SearchString, EDuetOptions DuetOptions)
+ 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;
+ Filter.SetOptions(searchString, duetOptions);
+ Sorter.SetOptions(sorting, ignoreArticles);
+ Categorizer.Tabs = tabs;
}
public static void LoadSongs()
@@ -390,12 +390,12 @@ namespace Vocaluxe.Base
CLog.StartBenchmark(2, "Read TXTs");
foreach (string file in files)
{
- CSong Song = CSong.LoadSong(file);
- if (Song != null)
+ CSong song = CSong.LoadSong(file);
+ if (song != null)
{
- Song.ID = _Songs.Count;
- _Songs.Add(Song);
- Song.ReadNotes();
+ song.ID = _Songs.Count;
+ if(song.ReadNotes())
+ _Songs.Add(song);
}
}
CLog.StopBenchmark(2, "Read TXTs");
@@ -404,7 +404,7 @@ namespace Vocaluxe.Base
Sorter.SongSorting = CConfig.SongSorting;
Sorter.IgnoreArticles = CConfig.IgnoreArticles;
Categorizer.Tabs = CConfig.Tabs;
- Categorizer.ObjectChanged += HandleCategoriesChanged;
+ Categorizer.ObjectChanged += _HandleCategoriesChanged;
CLog.StopBenchmark(2, "Sort Songs");
Category = -1;
_SongsLoaded = true;
diff --git a/Vocaluxe/Base/CSound.cs b/Vocaluxe/Base/CSound.cs
index aa3c9874..2f5bf1cb 100644
--- a/Vocaluxe/Base/CSound.cs
+++ b/Vocaluxe/Base/CSound.cs
@@ -39,9 +39,9 @@ namespace Vocaluxe.Base
return true;
}
- public static void SetGlobalVolume(float Volume)
+ public static void SetGlobalVolume(float volume)
{
- _Playback.SetGlobalVolume(Volume);
+ _Playback.SetGlobalVolume(volume);
}
public static int GetStreamCount()
@@ -55,89 +55,89 @@ namespace Vocaluxe.Base
}
#region Stream Handling
- public static int Load(string Media)
+ public static int Load(string media)
{
- return _Playback.Load(Media);
+ return _Playback.Load(media);
}
- public static int Load(string Media, bool Prescan)
+ public static int Load(string media, bool prescan)
{
- return _Playback.Load(Media, Prescan);
+ return _Playback.Load(media, prescan);
}
- public static void Close(int Stream)
+ public static void Close(int stream)
{
- _Playback.Close(Stream);
+ _Playback.Close(stream);
}
- public static void Play(int Stream)
+ public static void Play(int stream)
{
- _Playback.Play(Stream);
+ _Playback.Play(stream);
}
- public static void Play(int Stream, bool Loop)
+ public static void Play(int stream, bool loop)
{
- _Playback.Play(Stream, Loop);
+ _Playback.Play(stream, loop);
}
- public static void Pause(int Stream)
+ public static void Pause(int stream)
{
- _Playback.Pause(Stream);
+ _Playback.Pause(stream);
}
- public static void Stop(int Stream)
+ public static void Stop(int stream)
{
- _Playback.Stop(Stream);
+ _Playback.Stop(stream);
}
- public static void Fade(int Stream, float TargetVolume, float Seconds)
+ public static void Fade(int stream, float targetVolume, float seconds)
{
- _Playback.Fade(Stream, TargetVolume, Seconds);
+ _Playback.Fade(stream, targetVolume, seconds);
}
- public static void FadeAndPause(int Stream, float TargetVolume, float Seconds)
+ public static void FadeAndPause(int stream, float targetVolume, float seconds)
{
- _Playback.FadeAndPause(Stream, TargetVolume, Seconds);
+ _Playback.FadeAndPause(stream, targetVolume, seconds);
}
- public static void FadeAndStop(int Stream, float TargetVolume, float Seconds)
+ public static void FadeAndStop(int stream, float targetVolume, float seconds)
{
- _Playback.FadeAndStop(Stream, TargetVolume, Seconds);
+ _Playback.FadeAndStop(stream, targetVolume, seconds);
}
- public static void SetStreamVolume(int Stream, float Volume)
+ public static void SetStreamVolume(int stream, float volume)
{
- _Playback.SetStreamVolume(Stream, Volume);
+ _Playback.SetStreamVolume(stream, volume);
}
- public static void SetStreamVolumeMax(int Stream, float Volume)
+ public static void SetStreamVolumeMax(int stream, float volume)
{
- _Playback.SetStreamVolumeMax(Stream, Volume);
+ _Playback.SetStreamVolumeMax(stream, volume);
}
- public static float GetLength(int Stream)
+ public static float GetLength(int stream)
{
- return _Playback.GetLength(Stream);
+ return _Playback.GetLength(stream);
}
- public static float GetPosition(int Stream)
+ public static float GetPosition(int stream)
{
- return _Playback.GetPosition(Stream);
+ return _Playback.GetPosition(stream);
}
- public static bool IsPlaying(int Stream)
+ public static bool IsPlaying(int stream)
{
- return _Playback.IsPlaying(Stream);
+ return _Playback.IsPlaying(stream);
}
- public static bool IsPaused(int Stream)
+ public static bool IsPaused(int stream)
{
- return _Playback.IsPaused(Stream);
+ return _Playback.IsPaused(stream);
}
- public static bool IsFinished(int Stream)
+ public static bool IsFinished(int stream)
{
- return _Playback.IsFinished(Stream);
+ return _Playback.IsFinished(stream);
}
public static void Update()
@@ -145,22 +145,22 @@ namespace Vocaluxe.Base
_Playback.Update();
}
- public static void SetPosition(int Stream, float Position)
+ public static void SetPosition(int stream, float position)
{
- _Playback.SetPosition(Stream, Position);
+ _Playback.SetPosition(stream, position);
}
#endregion Stream Handling
#endregion Playback
#region Sounds
- public static int PlaySound(ESounds Sound)
+ public static int PlaySound(ESounds sound)
{
- string file = Path.Combine(Environment.CurrentDirectory, CSettings.sFolderSounds);
- switch (Sound)
+ string file = Path.Combine(Environment.CurrentDirectory, CSettings.FolderSounds);
+ switch (sound)
{
case ESounds.T440:
- file = Path.Combine(file, CSettings.sSoundT440);
+ file = Path.Combine(file, CSettings.SoundT440);
break;
}
@@ -217,44 +217,44 @@ namespace Vocaluxe.Base
return _Record.Stop();
}
- public static void AnalyzeBuffer(int Player)
+ public static void AnalyzeBuffer(int player)
{
- _Record.AnalyzeBuffer(Player);
+ _Record.AnalyzeBuffer(player);
}
- public static int RecordGetToneAbs(int Player)
+ public static int RecordGetToneAbs(int player)
{
- return _Record.GetToneAbs(Player);
+ return _Record.GetToneAbs(player);
}
- public static int RecordGetTone(int Player)
+ public static int RecordGetTone(int player)
{
- return _Record.GetTone(Player);
+ return _Record.GetTone(player);
}
- public static void RecordSetTone(int Player, int Tone)
+ public static void RecordSetTone(int player, int tone)
{
- _Record.SetTone(Player, Tone);
+ _Record.SetTone(player, tone);
}
- public static bool RecordToneValid(int Player)
+ public static bool RecordToneValid(int player)
{
- return _Record.ToneValid(Player);
+ return _Record.ToneValid(player);
}
- public static float RecordGetMaxVolume(int Player)
+ public static float RecordGetMaxVolume(int player)
{
- return _Record.GetMaxVolume(Player);
+ return _Record.GetMaxVolume(player);
}
- public static int NumHalfTones(int Player)
+ public static int NumHalfTones(int player)
{
- return _Record.NumHalfTones(Player);
+ return _Record.NumHalfTones(player);
}
- public static float[] ToneWeigth(int Player)
+ public static float[] ToneWeigth(int player)
{
- return _Record.ToneWeigth(Player);
+ return _Record.ToneWeigth(player);
}
public static SRecordDevice[] RecordGetDevices()
@@ -269,8 +269,8 @@ namespace Vocaluxe.Base
{
SInput input = devices[dev].Inputs[inp];
- input.PlayerChannel1 = GetPlayerFromMicConfig(devices[dev].Name, devices[dev].Driver, input.Name, 1);
- input.PlayerChannel2 = GetPlayerFromMicConfig(devices[dev].Name, devices[dev].Driver, input.Name, 2);
+ input.PlayerChannel1 = _GetPlayerFromMicConfig(devices[dev].Name, devices[dev].Driver, input.Name, 1);
+ input.PlayerChannel2 = _GetPlayerFromMicConfig(devices[dev].Name, devices[dev].Driver, input.Name, 2);
devices[dev].Inputs[inp] = input;
}
@@ -281,7 +281,7 @@ namespace Vocaluxe.Base
return null;
}
- private static int GetPlayerFromMicConfig(string device, string devicedriver, string input, int channel)
+ private static int _GetPlayerFromMicConfig(string device, string devicedriver, string input, int channel)
{
for (int p = 0; p < CSettings.MaxNumPlayer; p++)
{
@@ -462,83 +462,83 @@ namespace Vocaluxe.Base
_MaxVolume = 0;
for (int i = 0; i < _AnalysisBuffer.Length / 4; i++)
{
- float Volume = Math.Abs((float)_AnalysisBuffer[i]) / Int16.MaxValue;
- if (Volume > MaxVolume)
- _MaxVolume = Volume;
+ float volume = Math.Abs((float)_AnalysisBuffer[i]) / Int16.MaxValue;
+ if (volume > MaxVolume)
+ _MaxVolume = volume;
}
if (_MaxVolume >= 0.02f)
- AnalyzeByAutocorrelation(true);
+ _AnalyzeByAutocorrelation(true);
else
- AnalyzeByAutocorrelation(false);
+ _AnalyzeByAutocorrelation(false);
}
catch (Exception) {}
}
- private void AnalyzeByAutocorrelation(bool valid)
+ private void _AnalyzeByAutocorrelation(bool valid)
{
- const double HalftoneBase = 1.05946309436; // 2^(1/12) -> HalftoneBase^12 = 2 (one octave)
+ const double halftoneBase = 1.05946309436; // 2^(1/12) -> HalftoneBase^12 = 2 (one octave)
// prepare to analyze
- double MaxWeight = -1.0;
- double MinWeight = 1.0;
- int MaxTone = -1;
- float[] Weigth = new float[_NumHalfTones];
+ double maxWeight = -1.0;
+ double minWeight = 1.0;
+ int maxTone = -1;
+ float[] weigth = new float[_NumHalfTones];
// analyze halftones
// 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++)
+ for (int toneIndex = 0; toneIndex < _NumHalfTones; toneIndex++)
{
- double CurFreq = _BaseToneFreq * Math.Pow(HalftoneBase, ToneIndex);
- double CurWeight = AnalyzeAutocorrelationFreq(CurFreq);
+ double curFreq = _BaseToneFreq * Math.Pow(halftoneBase, toneIndex);
+ double curWeight = _AnalyzeAutocorrelationFreq(curFreq);
- if (CurWeight > MaxWeight)
+ if (curWeight > maxWeight)
{
- MaxWeight = CurWeight;
- MaxTone = ToneIndex;
+ maxWeight = curWeight;
+ maxTone = toneIndex;
}
- if (CurWeight < MinWeight)
- MinWeight = CurWeight;
+ if (curWeight < minWeight)
+ minWeight = curWeight;
- Weigth[ToneIndex] = (float)CurWeight;
+ weigth[toneIndex] = (float)curWeight;
}
- if (valid && MaxWeight - MinWeight > 0.01)
+ if (valid && maxWeight - minWeight > 0.01)
{
- for (int i = 0; i < Weigth.Length; i++)
- _ToneWeigth[i] = Weigth[i];
+ for (int i = 0; i < weigth.Length; i++)
+ _ToneWeigth[i] = weigth[i];
- _ToneAbs = MaxTone;
- _Tone = MaxTone % 12;
+ _ToneAbs = maxTone;
+ _Tone = maxTone % 12;
_ToneValid = true;
}
else
_ToneValid = false;
}
- private double AnalyzeAutocorrelationFreq(double Freq)
+ private double _AnalyzeAutocorrelationFreq(double freq)
{
- int SampleIndex = 0; // index of sample to analyze
- int SamplesPerPeriod = (int)Math.Round(44100.0 / Freq); // samples in one period
- int CorrelatingSampleIndex = SampleIndex + SamplesPerPeriod; // index of sample one period ahead
+ int sampleIndex = 0; // index of sample to analyze
+ int samplesPerPeriod = (int)Math.Round(44100.0 / freq); // samples in one period
+ int correlatingSampleIndex = sampleIndex + samplesPerPeriod; // index of sample one period ahead
- double AccumDist = 0.0; // accumulated distances
+ double accumDist = 0.0; // accumulated distances
// compare correlating samples
- while (CorrelatingSampleIndex < _AnalysisBuffer.Length)
+ while (correlatingSampleIndex < _AnalysisBuffer.Length)
{
// calc distance (correlation: 1-dist) to corresponding sample in next period
// distance (0=equal .. 1=totally different) between correlated samples
- double Dist = Math.Abs((double)_AnalysisBuffer[SampleIndex] - _AnalysisBuffer[CorrelatingSampleIndex]) / Int16.MaxValue;
- AccumDist += Dist;
- SampleIndex++;
- CorrelatingSampleIndex++;
+ double dist = Math.Abs((double)_AnalysisBuffer[sampleIndex] - _AnalysisBuffer[correlatingSampleIndex]) / Int16.MaxValue;
+ accumDist += dist;
+ sampleIndex++;
+ correlatingSampleIndex++;
}
- return 1 - AccumDist / _AnalysisBuffer.Length;
+ return 1 - accumDist / _AnalysisBuffer.Length;
}
public void Dispose()
@@ -554,7 +554,7 @@ namespace Vocaluxe.Base
class CSyncTimer
{
- private readonly PT1 _ExternTime;
+ private readonly CPt1 _ExternTime;
private readonly Stopwatch _Timer;
private float _SetValue;
@@ -581,16 +581,16 @@ namespace Vocaluxe.Base
}
}
- public CSyncTimer(float CurrentTime, float K, float T)
+ public CSyncTimer(float currentTime, float k, float t)
{
- _ExternTime = new PT1(CurrentTime, K, T);
+ _ExternTime = new CPt1(currentTime, k, t);
_Timer = new Stopwatch();
- _SetValue = CurrentTime;
+ _SetValue = currentTime;
}
- public float Update(float NewTime)
+ public float Update(float newTime)
{
- float et = _ExternTime.Update(NewTime);
+ float et = _ExternTime.Update(newTime);
float dt = Time;
@@ -628,12 +628,12 @@ namespace Vocaluxe.Base
}
}
- class PT1
+ class CPt1
{
private float _CurrentTime;
private float _OldTime;
- private readonly Stopwatch _STimer;
+ private readonly Stopwatch _Timer;
private readonly float _K;
private readonly float _T;
@@ -642,8 +642,8 @@ namespace Vocaluxe.Base
get
{
double nanosecPerTick = (1000.0 * 1000.0 * 1000.0) / Stopwatch.Frequency;
- long ticks = _STimer.ElapsedTicks;
- float dt = _STimer.ElapsedMilliseconds / 1000f;
+ long ticks = _Timer.ElapsedTicks;
+ float dt = _Timer.ElapsedMilliseconds / 1000f;
if (Stopwatch.IsHighResolution && ticks != 0)
dt = (float)(ticks * nanosecPerTick / 1000000000.0);
@@ -658,53 +658,53 @@ namespace Vocaluxe.Base
_CurrentTime = value;
_OldTime = value;
- _STimer.Reset();
- _STimer.Start();
+ _Timer.Reset();
+ _Timer.Start();
}
}
- public PT1(float CurrentTime, float K, float T)
+ public CPt1(float currentTime, float k, float t)
{
- _CurrentTime = CurrentTime;
- _OldTime = CurrentTime;
+ _CurrentTime = currentTime;
+ _OldTime = currentTime;
- _STimer = new Stopwatch();
- _K = K;
- _T = T;
+ _Timer = new Stopwatch();
+ _K = k;
+ _T = t;
}
- public float Update(float NewTime)
+ public float Update(float newTime)
{
- _STimer.Stop();
+ _Timer.Stop();
double nanosecPerTick = (1000.0 * 1000.0 * 1000.0) / Stopwatch.Frequency;
- long ticks = _STimer.ElapsedTicks;
- float dt = _STimer.ElapsedMilliseconds / 1000f;
+ long ticks = _Timer.ElapsedTicks;
+ float dt = _Timer.ElapsedMilliseconds / 1000f;
if (Stopwatch.IsHighResolution && ticks != 0)
dt = (float)(ticks * nanosecPerTick / 1000000000.0);
- float Ts = 0f;
+ float ts = 0f;
if (dt > 0)
- Ts = 1 / (_T / dt + 1);
+ ts = 1 / (_T / dt + 1);
- _CurrentTime = Ts * (_K * NewTime - _OldTime) + _OldTime;
+ _CurrentTime = ts * (_K * newTime - _OldTime) + _OldTime;
_OldTime = _CurrentTime;
- _STimer.Reset();
- _STimer.Start();
+ _Timer.Reset();
+ _Timer.Start();
return _CurrentTime;
}
public void Pause()
{
- _STimer.Stop();
+ _Timer.Stop();
}
public void Resume()
{
- _STimer.Start();
+ _Timer.Start();
}
}
}
\ No newline at end of file
diff --git a/Vocaluxe/Base/CTheme.cs b/Vocaluxe/Base/CTheme.cs
index 97826aee..bd4ec83f 100644
--- a/Vocaluxe/Base/CTheme.cs
+++ b/Vocaluxe/Base/CTheme.cs
@@ -10,7 +10,7 @@ namespace Vocaluxe.Base
{
#region Structs
- struct Theme
+ struct STheme
{
public string Name;
public string Author;
@@ -23,7 +23,7 @@ namespace Vocaluxe.Base
public int PartyModeID;
}
- struct SkinElement
+ struct SSkinElement
{
public string Name;
public string Value;
@@ -32,7 +32,7 @@ namespace Vocaluxe.Base
public int VideoIndex;
}
- struct Skin
+ struct SSkin
{
public string Name;
public string Author;
@@ -43,8 +43,8 @@ namespace Vocaluxe.Base
public string FileName;
public int PartyModeID;
- public Dictionary SkinList;
- public List VideoList;
+ public Dictionary SkinList;
+ public List