Used object initializers

This commit is contained in:
Flamefire committed 2013-04-23 22:11:32 +02:00
1 parent 477b023520
commit b8fe334153
47 files changed
+289 -515

No files matched your search

@@ -178,14 +178,7 @@ namespace VocaluxeLib.PartyModes.Challenge
_ToScreenNames = new SDataToScreenNames(); _ToScreenNames = new SDataToScreenNames();
_ToScreenMain = new SDataToScreenMain(); _ToScreenMain = new SDataToScreenMain();
_GameData = new SData(); _GameData = new SData {NumPlayer = 4, NumPlayerAtOnce = 2, NumRounds = 2, CurrentRoundNr = 1, ProfileIDs = new List<int>(), CatSongIndices = null, Results = null};
_GameData.NumPlayer = 4;
_GameData.NumPlayerAtOnce = 2;
_GameData.NumRounds = 2;
_GameData.CurrentRoundNr = 1;
_GameData.ProfileIDs = new List<int>();
_GameData.CatSongIndices = null;
_GameData.Results = null;
} }
public override bool Init() public override bool Init()
@@ -657,15 +650,11 @@ namespace VocaluxeLib.PartyModes.Challenge
List<SStats> result = new List<SStats>(); List<SStats> result = new List<SStats>();
for (int i = 0; i < _GameData.NumPlayerAtOnce; i++) for (int i = 0; i < _GameData.NumPlayerAtOnce; i++)
{ {
SStats stat = new SStats(); SStats stat = new SStats {ProfileID = results[i].ProfileID, SingPoints = (int)Math.Round(results[i].Points), Won = 0, GamePoints = 0};
stat.ProfileID = results[i].ProfileID;
stat.SingPoints = (int)Math.Round(results[i].Points);
stat.Won = 0;
stat.GamePoints = 0;
result.Add(stat); result.Add(stat);
} }
result.Sort(delegate(SStats s1, SStats s2) { return s1.SingPoints.CompareTo(s2.SingPoints); }); result.Sort((s1, s2) => s1.SingPoints.CompareTo(s2.SingPoints));
int current = result[result.Count - 1].SingPoints; int current = result[result.Count - 1].SingPoints;
int points = result.Count; int points = result.Count;
@@ -53,10 +53,7 @@ namespace VocaluxeLib.PartyModes.Challenge
_ThemeButtons = new string[] {_ButtonNext, _ButtonBack}; _ThemeButtons = new string[] {_ButtonNext, _ButtonBack};
_Data = new SDataFromScreen(); _Data = new SDataFromScreen();
SFromScreenConfig config = new SFromScreenConfig(); SFromScreenConfig config = new SFromScreenConfig {NumPlayer = 4, NumPlayerAtOnce = 2, NumRounds = 12};
config.NumPlayer = 4;
config.NumPlayerAtOnce = 2;
config.NumRounds = 12;
_Data.ScreenConfig = config; _Data.ScreenConfig = config;
} }
@@ -227,10 +224,7 @@ namespace VocaluxeLib.PartyModes.Challenge
int res = _Data.ScreenConfig.NumPlayer / _Data.ScreenConfig.NumPlayerAtOnce; int res = _Data.ScreenConfig.NumPlayer / _Data.ScreenConfig.NumPlayerAtOnce;
int mod = _Data.ScreenConfig.NumPlayer % _Data.ScreenConfig.NumPlayerAtOnce; int mod = _Data.ScreenConfig.NumPlayer % _Data.ScreenConfig.NumPlayerAtOnce;
if (mod == 0) _RoundSteps = mod == 0 ? res : _Data.ScreenConfig.NumPlayer;
_RoundSteps = res;
else
_RoundSteps = _Data.ScreenConfig.NumPlayer;
} }
private void _Back() private void _Back()
@@ -98,8 +98,7 @@ namespace VocaluxeLib.PartyModes.Challenge
public CPartyScreenChallengeMain() public CPartyScreenChallengeMain()
{ {
_Data = new SDataFromScreen(); _Data = new SDataFromScreen {ScreenMain = new SFromScreenMain()};
_Data.ScreenMain = new SFromScreenMain();
} }
public override void Init() public override void Init()
@@ -406,9 +405,7 @@ namespace VocaluxeLib.PartyModes.Challenge
_RoundsTable = new List<CRoundsTableRow>(); _RoundsTable = new List<CRoundsTableRow>();
for (int i = 0; i < 5; i++) for (int i = 0; i < 5; i++)
{ {
CRoundsTableRow rtr = new CRoundsTableRow(); CRoundsTableRow rtr = new CRoundsTableRow {TextPlayer = new List<CText>(), TextScores = new List<CText>()};
rtr.TextPlayer = new List<CText>();
rtr.TextScores = new List<CText>();
_RoundsTable.Add(rtr); _RoundsTable.Add(rtr);
} }
//Create statics and texts for rounds //Create statics and texts for rounds
@@ -438,11 +435,8 @@ namespace VocaluxeLib.PartyModes.Challenge
{ {
_RoundsTableScrollArea = new SRectF(); _RoundsTableScrollArea = new SRectF();
int numPlayerInOneRow = 3; const int numPlayerInOneRow = 3;
if (_GameState.NumPlayerAtOnce <= numPlayerInOneRow) _NumRoundsVisible = _GameState.NumPlayerAtOnce <= numPlayerInOneRow ? 5 : 3;
_NumRoundsVisible = 5;
else
_NumRoundsVisible = 3;
if (_NumRoundsVisible > _GameState.Combs.Count) if (_NumRoundsVisible > _GameState.Combs.Count)
_NumRoundsVisible = _GameState.Combs.Count; _NumRoundsVisible = _GameState.Combs.Count;
@@ -536,10 +530,7 @@ namespace VocaluxeLib.PartyModes.Challenge
private void _BuildPlayerTable() private void _BuildPlayerTable()
{ {
_PlayerTableScrollArea = new SRectF(); _PlayerTableScrollArea = new SRectF {X = _Texts[_TextPosition].X, Y = _Texts[_TextPosition].Y, W = _Texts[_TextGamePoints].X - _Texts[_TextPosition].X};
_PlayerTableScrollArea.X = _Texts[_TextPosition].X;
_PlayerTableScrollArea.Y = _Texts[_TextPosition].Y;
_PlayerTableScrollArea.W = _Texts[_TextGamePoints].X - _Texts[_TextPosition].X;
_PlayerTable = new List<STableRow>(); _PlayerTable = new List<STableRow>();
float delta = _Texts[_TextPosition].Height * 1.2f; float delta = _Texts[_TextPosition].Height * 1.2f;
@@ -548,14 +539,15 @@ namespace VocaluxeLib.PartyModes.Challenge
for (int i = 0; i < 10; i++) for (int i = 0; i < 10; i++)
{ {
STableRow row = new STableRow(); STableRow row = new STableRow
{
row.Pos = GetNewText(_Texts[_TextPosition]); Pos = GetNewText(_Texts[_TextPosition]),
row.Name = GetNewText(_Texts[_TextPlayerName]); Name = GetNewText(_Texts[_TextPlayerName]),
row.Rounds = GetNewText(_Texts[_TextNumPlayed]); Rounds = GetNewText(_Texts[_TextNumPlayed]),
row.Won = GetNewText(_Texts[_TextWon]); Won = GetNewText(_Texts[_TextWon]),
row.SingPoints = GetNewText(_Texts[_TextSingPoints]); SingPoints = GetNewText(_Texts[_TextSingPoints]),
row.GamePoints = GetNewText(_Texts[_TextGamePoints]); GamePoints = GetNewText(_Texts[_TextGamePoints])
};
row.Pos.Y += delta * (i + 1); row.Pos.Y += delta * (i + 1);
row.Name.Y += delta * (i + 1); row.Name.Y += delta * (i + 1);
@@ -182,14 +182,7 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley
_ToScreenNames = new SDataToScreenNames(); _ToScreenNames = new SDataToScreenNames();
_ToScreenMain = new SDataToScreenMain(); _ToScreenMain = new SDataToScreenMain();
_GameData = new SData(); _GameData = new SData {NumPlayer = 4, NumPlayerAtOnce = 2, NumRounds = 2, CurrentRoundNr = 1, ProfileIDs = new List<int>(), CatSongIndices = null, Results = null};
_GameData.NumPlayer = 4;
_GameData.NumPlayerAtOnce = 2;
_GameData.NumRounds = 2;
_GameData.CurrentRoundNr = 1;
_GameData.ProfileIDs = new List<int>();
_GameData.CatSongIndices = null;
_GameData.Results = null;
} }
public override bool Init() public override bool Init()
@@ -637,13 +630,7 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley
{ {
for (int i = 0; i < _GameData.NumPlayer; i++) for (int i = 0; i < _GameData.NumPlayer; i++)
{ {
CResultTableRow row = new CResultTableRow(); CResultTableRow row = new CResultTableRow {PlayerID = _GameData.ProfileIDs[i], NumPlayed = 0, NumRounds = 0, NumWon = 0, NumSingPoints = 0, NumGamePoints = 0};
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);
} }
@@ -732,15 +719,11 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley
List<SStats> result = new List<SStats>(); List<SStats> result = new List<SStats>();
for (int i = 0; i < _GameData.NumPlayerAtOnce; i++) for (int i = 0; i < _GameData.NumPlayerAtOnce; i++)
{ {
SStats stat = new SStats(); SStats stat = new SStats {ProfileID = results[i].ProfileID, SingPoints = (int)Math.Round(results[i].Points), Won = 0, GamePoints = 0};
stat.ProfileID = results[i].ProfileID;
stat.SingPoints = (int)Math.Round(results[i].Points);
stat.Won = 0;
stat.GamePoints = 0;
result.Add(stat); result.Add(stat);
} }
result.Sort(delegate(SStats s1, SStats s2) { return s1.SingPoints.CompareTo(s2.SingPoints); }); result.Sort((s1, s2) => s1.SingPoints.CompareTo(s2.SingPoints));
int current = result[result.Count - 1].SingPoints; int current = result[result.Count - 1].SingPoints;
int points = result.Count; int points = result.Count;
@@ -53,10 +53,7 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley
_ThemeButtons = new string[] {_ButtonNext, _ButtonBack}; _ThemeButtons = new string[] {_ButtonNext, _ButtonBack};
_Data = new SDataFromScreen(); _Data = new SDataFromScreen();
SFromScreenConfig config = new SFromScreenConfig(); SFromScreenConfig config = new SFromScreenConfig {NumPlayer = 4, NumPlayerAtOnce = 2, NumRounds = 12};
config.NumPlayer = 4;
config.NumPlayerAtOnce = 2;
config.NumRounds = 12;
_Data.ScreenConfig = config; _Data.ScreenConfig = config;
} }
@@ -227,10 +224,7 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley
int res = _Data.ScreenConfig.NumPlayer / _Data.ScreenConfig.NumPlayerAtOnce; int res = _Data.ScreenConfig.NumPlayer / _Data.ScreenConfig.NumPlayerAtOnce;
int mod = _Data.ScreenConfig.NumPlayer % _Data.ScreenConfig.NumPlayerAtOnce; int mod = _Data.ScreenConfig.NumPlayer % _Data.ScreenConfig.NumPlayerAtOnce;
if (mod == 0) _RoundSteps = mod == 0 ? res : _Data.ScreenConfig.NumPlayer;
_RoundSteps = res;
else
_RoundSteps = _Data.ScreenConfig.NumPlayer;
} }
private void _Back() private void _Back()
@@ -98,8 +98,7 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley
public CPartyScreenChallengeMedleyMain() public CPartyScreenChallengeMedleyMain()
{ {
_Data = new SDataFromScreen(); _Data = new SDataFromScreen {ScreenMain = new SFromScreenMain()};
_Data.ScreenMain = new SFromScreenMain();
} }
public override void Init() public override void Init()
@@ -406,9 +405,7 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley
_RoundsTable = new List<CRoundsTableRow>(); _RoundsTable = new List<CRoundsTableRow>();
for (int i = 0; i < 5; i++) for (int i = 0; i < 5; i++)
{ {
CRoundsTableRow rtr = new CRoundsTableRow(); CRoundsTableRow rtr = new CRoundsTableRow {TextPlayer = new List<CText>(), TextScores = new List<CText>()};
rtr.TextPlayer = new List<CText>();
rtr.TextScores = new List<CText>();
_RoundsTable.Add(rtr); _RoundsTable.Add(rtr);
} }
//Create statics and texts for rounds //Create statics and texts for rounds
@@ -438,11 +435,8 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley
{ {
_RoundsTableScrollArea = new SRectF(); _RoundsTableScrollArea = new SRectF();
int numPlayerInOneRow = 3; const int numPlayerInOneRow = 3;
if (_GameState.NumPlayerAtOnce <= numPlayerInOneRow) _NumRoundsVisible = _GameState.NumPlayerAtOnce <= numPlayerInOneRow ? 5 : 3;
_NumRoundsVisible = 5;
else
_NumRoundsVisible = 3;
if (_NumRoundsVisible > _GameState.Combs.Count) if (_NumRoundsVisible > _GameState.Combs.Count)
_NumRoundsVisible = _GameState.Combs.Count; _NumRoundsVisible = _GameState.Combs.Count;
@@ -536,10 +530,7 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley
private void _BuildPlayerTable() private void _BuildPlayerTable()
{ {
_PlayerTableScrollArea = new SRectF(); _PlayerTableScrollArea = new SRectF {X = _Texts[_TextPosition].X, Y = _Texts[_TextPosition].Y, W = _Texts[_TextGamePoints].X - _Texts[_TextPosition].X};
_PlayerTableScrollArea.X = _Texts[_TextPosition].X;
_PlayerTableScrollArea.Y = _Texts[_TextPosition].Y;
_PlayerTableScrollArea.W = _Texts[_TextGamePoints].X - _Texts[_TextPosition].X;
_PlayerTable = new List<STableRow>(); _PlayerTable = new List<STableRow>();
float delta = _Texts[_TextPosition].Height * 1.2f; float delta = _Texts[_TextPosition].Height * 1.2f;
@@ -548,14 +539,15 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley
for (int i = 0; i < 10; i++) for (int i = 0; i < 10; i++)
{ {
STableRow row = new STableRow(); STableRow row = new STableRow
{
row.Pos = GetNewText(_Texts[_TextPosition]); Pos = GetNewText(_Texts[_TextPosition]),
row.Name = GetNewText(_Texts[_TextPlayerName]); Name = GetNewText(_Texts[_TextPlayerName]),
row.Rounds = GetNewText(_Texts[_TextNumPlayed]); Rounds = GetNewText(_Texts[_TextNumPlayed]),
row.Won = GetNewText(_Texts[_TextWon]); Won = GetNewText(_Texts[_TextWon]),
row.SingPoints = GetNewText(_Texts[_TextSingPoints]); SingPoints = GetNewText(_Texts[_TextSingPoints]),
row.GamePoints = GetNewText(_Texts[_TextGamePoints]); GamePoints = GetNewText(_Texts[_TextGamePoints])
};
row.Pos.Y += delta * (i + 1); row.Pos.Y += delta * (i + 1);
row.Name.Y += delta * (i + 1); row.Name.Y += delta * (i + 1);
@@ -88,10 +88,7 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley
_ThemeButtons = new string[] {_ButtonBack, _ButtonNext, _ButtonPlayerDestination, _ButtonPlayerChoose}; _ThemeButtons = new string[] {_ButtonBack, _ButtonNext, _ButtonPlayerDestination, _ButtonPlayerChoose};
_Data = new SDataFromScreen(); _Data = new SDataFromScreen();
SFromScreenNames names = new SFromScreenNames(); SFromScreenNames names = new SFromScreenNames {FadeToConfig = false, FadeToMain = false, ProfileIDs = new List<int>()};
names.FadeToConfig = false;
names.FadeToMain = false;
names.ProfileIDs = new List<int>();
_Data.ScreenNames = names; _Data.ScreenNames = names;
} }
@@ -316,9 +313,7 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley
CButton b = GetNewButton(_Buttons[_ButtonPlayerChoose]); CButton b = GetNewButton(_Buttons[_ButtonPlayerChoose]);
b.Rect.X = _PlayerChooseButtonsFirstX + column * (b.Rect.W + _PlayerChooseButtonsSpaceH); b.Rect.X = _PlayerChooseButtonsFirstX + column * (b.Rect.W + _PlayerChooseButtonsSpaceH);
b.Rect.Y = _PlayerChooseButtonsFirstY + row * (b.Rect.H + _PlayerChooseButtonsSpaceW); b.Rect.Y = _PlayerChooseButtonsFirstY + row * (b.Rect.H + _PlayerChooseButtonsSpaceW);
CPlayerChooseButton pcb = new CPlayerChooseButton(); CPlayerChooseButton pcb = new CPlayerChooseButton {Button = b, ProfileID = -1};
pcb.Button = b;
pcb.ProfileID = -1;
_PlayerChooseButtons.Add(pcb); _PlayerChooseButtons.Add(pcb);
column++; column++;
if (column >= _PlayerChooseButtonsNumH) if (column >= _PlayerChooseButtonsNumH)
@@ -203,24 +203,26 @@ namespace VocaluxeLib.PartyModes.TicTacToe
_ToScreenNames = new SDataToScreenNames(); _ToScreenNames = new SDataToScreenNames();
_ToScreenMain = new SDataToScreenMain(); _ToScreenMain = new SDataToScreenMain();
_GameData = new SData(); _GameData = new SData
_GameData.NumFields = 9; {
_GameData.NumPlayerTeam1 = 2; NumFields = 9,
_GameData.NumPlayerTeam2 = 2; NumPlayerTeam1 = 2,
_GameData.ProfileIDsTeam1 = new List<int>(); NumPlayerTeam2 = 2,
_GameData.ProfileIDsTeam2 = new List<int>(); ProfileIDsTeam1 = new List<int>(),
_GameData.PlayerTeam1 = new List<int>(); ProfileIDsTeam2 = new List<int>(),
_GameData.PlayerTeam2 = new List<int>(); PlayerTeam1 = new List<int>(),
_GameData.CurrentRoundNr = 0; PlayerTeam2 = new List<int>(),
_GameData.SingRoundNr = 0; CurrentRoundNr = 0,
_GameData.SongSource = ESongSource.TR_ALLSONGS; SingRoundNr = 0,
_GameData.PlaylistID = 0; SongSource = ESongSource.TR_ALLSONGS,
_GameData.CategoryID = 0; PlaylistID = 0,
_GameData.GameMode = EPartyGameMode.TR_GAMEMODE_NORMAL; CategoryID = 0,
_GameData.Rounds = new List<CRound>(); GameMode = EPartyGameMode.TR_GAMEMODE_NORMAL,
_GameData.Songs = new List<int>(); Rounds = new List<CRound>(),
_GameData.NumJokerRandom = new int[2]; Songs = new List<int>(),
_GameData.NumJokerRetry = new int[2]; NumJokerRandom = new int[2],
NumJokerRetry = new int[2]
};
} }
public override bool Init() public override bool Init()
@@ -281,10 +283,7 @@ namespace VocaluxeLib.PartyModes.TicTacToe
_Stage = EStage.NotStarted; _Stage = EStage.NotStarted;
else else
{ {
if (CBase.Game.GetRandom(100) < 50) _GameData.Team = CBase.Game.GetRandom(100) < 50 ? 0 : 1;
_GameData.Team = 0;
else
_GameData.Team = 1;
_GameData.ProfileIDsTeam1 = dataFrom.ScreenNames.ProfileIDsTeam1; _GameData.ProfileIDsTeam1 = dataFrom.ScreenNames.ProfileIDsTeam1;
_GameData.ProfileIDsTeam2 = dataFrom.ScreenNames.ProfileIDsTeam2; _GameData.ProfileIDsTeam2 = dataFrom.ScreenNames.ProfileIDsTeam2;
_Stage = EStage.Names; _Stage = EStage.Names;
@@ -377,10 +376,7 @@ namespace VocaluxeLib.PartyModes.TicTacToe
_Screens.TryGetValue("CPartyScreenTicTacToeMain", out screen); _Screens.TryGetValue("CPartyScreenTicTacToeMain", out screen);
if (screen != null) if (screen != null)
{ {
if (_GameData.Team == 1) _GameData.Team = _GameData.Team == 1 ? 0 : 1;
_GameData.Team = 0;
else
_GameData.Team = 1;
CBase.Songs.ResetPartySongSung(); CBase.Songs.ResetPartySongSung();
_GameData.CurrentRoundNr = 1; _GameData.CurrentRoundNr = 1;
_ToScreenMain.CurrentRoundNr = 1; _ToScreenMain.CurrentRoundNr = 1;
@@ -410,10 +406,7 @@ namespace VocaluxeLib.PartyModes.TicTacToe
_Screens.TryGetValue("CPartyScreenTicTacToeMain", out screen); _Screens.TryGetValue("CPartyScreenTicTacToeMain", out screen);
if (screen != null) if (screen != null)
{ {
if (_GameData.Team == 1) _GameData.Team = _GameData.Team == 1 ? 0 : 1;
_GameData.Team = 0;
else
_GameData.Team = 1;
_UpdateSongList(); _UpdateSongList();
_UpdatePlayerList(); _UpdatePlayerList();
_ToScreenMain.CurrentRoundNr = _GameData.CurrentRoundNr; _ToScreenMain.CurrentRoundNr = _GameData.CurrentRoundNr;
@@ -388,8 +388,7 @@ namespace VocaluxeLib.PartyModes.TicTacToe
{ {
for (int i = 0; i < 25; i++) for (int i = 0; i < 25; i++)
{ {
CField f = new CField(); CField f = new CField {Button = GetNewButton(_Buttons[_ButtonField])};
f.Button = GetNewButton(_Buttons[_ButtonField]);
f.Button.Visible = false; f.Button.Visible = false;
f.Content = new CRound(); f.Content = new CRound();
_AddButton(f.Button); _AddButton(f.Button);
@@ -93,11 +93,7 @@ namespace VocaluxeLib.PartyModes.TicTacToe
_ThemeButtons = new string[] {_ButtonBack, _ButtonNext, _ButtonPlayerDestination, _ButtonPlayerChoose, _ButtonPlayerChooseScrollUp, _ButtonPlayerChooseScrollDown}; _ThemeButtons = new string[] {_ButtonBack, _ButtonNext, _ButtonPlayerDestination, _ButtonPlayerChoose, _ButtonPlayerChooseScrollUp, _ButtonPlayerChooseScrollDown};
_Data = new SDataFromScreen(); _Data = new SDataFromScreen();
SFromScreenNames names = new SFromScreenNames(); SFromScreenNames names = new SFromScreenNames {FadeToConfig = false, FadeToMain = false, ProfileIDsTeam1 = new List<int>(), ProfileIDsTeam2 = new List<int>()};
names.FadeToConfig = false;
names.FadeToMain = false;
names.ProfileIDsTeam1 = new List<int>();
names.ProfileIDsTeam2 = new List<int>();
_Data.ScreenNames = names; _Data.ScreenNames = names;
} }
@@ -378,9 +374,7 @@ namespace VocaluxeLib.PartyModes.TicTacToe
CButton b = GetNewButton(_Buttons[_ButtonPlayerChoose]); CButton b = GetNewButton(_Buttons[_ButtonPlayerChoose]);
b.Rect.X = _PlayerChooseButtonsFirstX + column * (b.Rect.W + _PlayerChooseButtonsSpaceH); b.Rect.X = _PlayerChooseButtonsFirstX + column * (b.Rect.W + _PlayerChooseButtonsSpaceH);
b.Rect.Y = _PlayerChooseButtonsFirstY + row * (b.Rect.H + _PlayerChooseButtonsSpaceW); b.Rect.Y = _PlayerChooseButtonsFirstY + row * (b.Rect.H + _PlayerChooseButtonsSpaceW);
CPlayerChooseButton pcb = new CPlayerChooseButton(); CPlayerChooseButton pcb = new CPlayerChooseButton {Button = b, ProfileID = -1};
pcb.Button = b;
pcb.ProfileID = -1;
_PlayerChooseButtons.Add(pcb); _PlayerChooseButtons.Add(pcb);
column++; column++;
if (column >= _PlayerChooseButtonsNumH) if (column >= _PlayerChooseButtonsNumH)
+1 -4
View File
@@ -161,10 +161,7 @@ namespace Vocaluxe.Base
else else
Next(); Next();
if (!_IsBackgroundFile(_CurrentPlaylistElement)) _CanSing = !_IsBackgroundFile(_CurrentPlaylistElement);
_CanSing = true;
else
_CanSing = false;
} }
} }
} }
+1 -1
View File
@@ -164,7 +164,7 @@ namespace Vocaluxe.Base
_CoverThemes.Clear(); _CoverThemes.Clear();
const string path = CSettings.FolderCover; const string path = CSettings.FolderCover;
List<string> files = CHelper.ListFiles(path, "*.xml", false); List<string> files = CHelper.ListFiles(path, "*.xml");
foreach (string file in files) foreach (string file in files)
{ {
+28 -43
View File
@@ -73,15 +73,17 @@ namespace Vocaluxe.Base
public static int AddScore(string playerName, int score, int lineNr, long date, int medley, int duet, int shortSong, int diff, 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) string artist, string title, int numPlayed, string filePath)
{ {
SPlayer player = new SPlayer(); SPlayer player = new SPlayer
player.Name = playerName; {
player.Points = score; Name = playerName,
player.LineNr = lineNr; Points = score,
player.DateTicks = date; LineNr = lineNr,
player.Medley = medley == 1; DateTicks = date,
player.Duet = duet == 1; Medley = medley == 1,
player.ShortSong = shortSong == 1; Duet = duet == 1,
player.Difficulty = (EGameDifficulty)diff; ShortSong = shortSong == 1,
Difficulty = (EGameDifficulty)diff
};
using (SQLiteConnection connection = new SQLiteConnection()) using (SQLiteConnection connection = new SQLiteConnection())
{ {
@@ -252,13 +254,15 @@ namespace Vocaluxe.Base
{ {
while (reader.Read()) while (reader.Read())
{ {
SScores score = new SScores(); SScores score = new SScores
score.Name = reader.GetString(0); {
score.Score = reader.GetInt32(1); Name = reader.GetString(0),
score.Date = new DateTime(reader.GetInt64(2)).ToString("dd/MM/yyyy"); Score = reader.GetInt32(1),
score.Difficulty = (EGameDifficulty)reader.GetInt32(3); Date = new DateTime(reader.GetInt64(2)).ToString("dd/MM/yyyy"),
score.LineNr = reader.GetInt32(4); Difficulty = (EGameDifficulty)reader.GetInt32(3),
score.ID = reader.GetInt32(5); LineNr = reader.GetInt32(4),
ID = reader.GetInt32(5)
};
scores.Add(score); scores.Add(score);
} }
@@ -633,9 +637,7 @@ namespace Vocaluxe.Base
{ {
while (reader.Read()) while (reader.Read())
{ {
SData data = new SData(); SData data = new SData {Id = reader.GetInt32(0), Str1 = reader.GetString(1)};
data.Id = reader.GetInt32(0);
data.Str1 = reader.GetString(1);
Int64 ticks = 0; Int64 ticks = 0;
try try
@@ -659,10 +661,7 @@ namespace Vocaluxe.Base
{ {
while (reader.Read()) while (reader.Read())
{ {
SData data = new SData(); SData data = new SData {Id = reader.GetInt32(0), Str1 = reader.GetString(1), Str2 = reader.GetString(2)};
data.Id = reader.GetInt32(0);
data.Str1 = reader.GetString(1);
data.Str2 = reader.GetString(2);
songs.Add(data); songs.Add(data);
} }
} }
@@ -793,21 +792,13 @@ namespace Vocaluxe.Base
while (Sqlite3.sqlite3_step(stmt) == Sqlite3.SQLITE_ROW) while (Sqlite3.sqlite3_step(stmt) == Sqlite3.SQLITE_ROW)
{ {
SData data = new SData(); SData data = new SData {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 = bytes != null ? utf8.GetString(Encoding.Convert(cp1252, utf8, bytes)) : "Someone";
data.Str1 = utf8.GetString(Encoding.Convert(cp1252, utf8, bytes));
else
data.Str1 = "Someone";
bytes = Sqlite3.sqlite3_column_rawbytes(stmt, 2); bytes = Sqlite3.sqlite3_column_rawbytes(stmt, 2);
if (bytes != null) data.Str2 = bytes != null ? utf8.GetString(Encoding.Convert(cp1252, utf8, bytes)) : "Someone";
data.Str2 = utf8.GetString(Encoding.Convert(cp1252, utf8, bytes));
else
data.Str2 = "Someone";
songs.Add(data); songs.Add(data);
} }
@@ -831,15 +822,10 @@ namespace Vocaluxe.Base
while (Sqlite3.sqlite3_step(stmt) == Sqlite3.SQLITE_ROW) while (Sqlite3.sqlite3_step(stmt) == Sqlite3.SQLITE_ROW)
{ {
SData data = new SData(); SData data = new SData {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 = bytes != null ? utf8.GetString(Encoding.Convert(cp1252, utf8, bytes)) : "Someone";
data.Str1 = utf8.GetString(Encoding.Convert(cp1252, utf8, bytes));
else
data.Str1 = "Someone";
if (dateExists) if (dateExists)
data.Ticks = _UnixTimeToTicks(Sqlite3.sqlite3_column_int(stmt, 2)); data.Ticks = _UnixTimeToTicks(Sqlite3.sqlite3_column_int(stmt, 2));
@@ -986,8 +972,7 @@ namespace Vocaluxe.Base
if (_ConnectionCover == null) if (_ConnectionCover == null)
{ {
_ConnectionCover = new SQLiteConnection(); _ConnectionCover = new SQLiteConnection {ConnectionString = "Data Source=" + _CoverFilePath};
_ConnectionCover.ConnectionString = "Data Source=" + _CoverFilePath;
_ConnectionCover.Open(); _ConnectionCover.Open();
} }
+1 -5
View File
@@ -577,11 +577,7 @@ namespace Vocaluxe.Base
int i = 1; int i = 1;
while (xmlReader.GetValue("//root/Fonts/Font" + i + "/Folder", out value, value)) while (xmlReader.GetValue("//root/Fonts/Font" + i + "/Folder", out value, value))
{ {
SFont sf = new SFont(); SFont sf = new SFont {Folder = value, IsThemeFont = themeName != "", ThemeName = themeName, PartyModeID = partyModeId};
sf.Folder = value;
sf.IsThemeFont = themeName != "";
sf.ThemeName = themeName;
sf.PartyModeID = partyModeId;
bool ok = true; bool ok = true;
+1 -2
View File
@@ -748,8 +748,7 @@ namespace Vocaluxe.Base
if (CConfig.DebugLevel == EDebugLevel.TR_CONFIG_OFF) if (CConfig.DebugLevel == EDebugLevel.TR_CONFIG_OFF)
return; return;
List<String> debugOutput = new List<string>(); List<String> debugOutput = new List<string> {CTime.GetFPS().ToString("FPS: 000")};
debugOutput.Add(CTime.GetFPS().ToString("FPS: 000"));
if (CConfig.DebugLevel >= EDebugLevel.TR_CONFIG_LEVEL1) if (CConfig.DebugLevel >= EDebugLevel.TR_CONFIG_LEVEL1)
{ {
+2 -4
View File
@@ -212,8 +212,7 @@ namespace Vocaluxe.Base
if (nr == -1) if (nr == -1)
return true; return true;
SPartyLanguage lang = new SPartyLanguage(); SPartyLanguage lang = new SPartyLanguage {PartyModeID = partyModeID};
lang.PartyModeID = partyModeID;
if (!_LoadLanguageEntries(xmlReader, out lang.Texts)) if (!_LoadLanguageEntries(xmlReader, out lang.Texts))
return false; return false;
@@ -226,8 +225,7 @@ namespace Vocaluxe.Base
private static void _LoadLanguageFile(string fileName) private static void _LoadLanguageFile(string fileName)
{ {
SLanguage lang = new SLanguage(); SLanguage lang = new SLanguage {LanguageFilePath = Path.Combine(CSettings.FolderLanguages, fileName)};
lang.LanguageFilePath = Path.Combine(CSettings.FolderLanguages, fileName);
CXMLReader xmlReader = CXMLReader.OpenFile(lang.LanguageFilePath); CXMLReader xmlReader = CXMLReader.OpenFile(lang.LanguageFilePath);
if (xmlReader == null) if (xmlReader == null)
+2 -7
View File
@@ -67,9 +67,7 @@ namespace Vocaluxe.Base
_IDs.Enqueue(i); _IDs.Enqueue(i);
//add dummy normal game mode and set it as default //add dummy normal game mode and set it as default
SPartyMode pm = new SPartyMode(); SPartyMode pm = new SPartyMode {PartyMode = new CPartyModeNone(), ScreenFiles = new List<string>()};
pm.PartyMode = new CPartyModeNone();
pm.ScreenFiles = new List<string>();
pm.PartyMode.Initialize(); pm.PartyMode.Initialize();
pm.PartyModeID = _IDs.Dequeue(); pm.PartyModeID = _IDs.Dequeue();
_NormalGameModeID = pm.PartyModeID; _NormalGameModeID = pm.PartyModeID;
@@ -231,10 +229,7 @@ namespace Vocaluxe.Base
private static SPartyMode _LoadPartyMode(string file) private static SPartyMode _LoadPartyMode(string file)
{ {
SPartyMode pm = new SPartyMode(); SPartyMode pm = new SPartyMode {PartyModeID = _IDs.Dequeue(), ScreenFiles = new List<string>(), NoErrors = false};
pm.PartyModeID = _IDs.Dequeue();
pm.ScreenFiles = new List<string>();
pm.NoErrors = false;
CXMLReader xmlReader = CXMLReader.OpenFile(file); CXMLReader xmlReader = CXMLReader.OpenFile(file);
+1 -2
View File
@@ -139,8 +139,7 @@ namespace Vocaluxe.Base
public static int NewPlaylist() public static int NewPlaylist()
{ {
CPlaylistFile pl = new CPlaylistFile(); CPlaylistFile pl = new CPlaylistFile {PlaylistName = "New Playlist"};
pl.PlaylistName = "New Playlist";
_Playlists.Add(pl); _Playlists.Add(pl);
return _Playlists.Count - 1; return _Playlists.Count - 1;
} }
+11 -17
View File
@@ -69,18 +69,15 @@ namespace Vocaluxe.Base
public static int NewProfile(string fileName) public static int NewProfile(string fileName)
{ {
SProfile profile = new SProfile(); SProfile profile = new SProfile
{
profile.PlayerName = String.Empty; PlayerName = String.Empty,
profile.Difficulty = EGameDifficulty.TR_CONFIG_EASY; Difficulty = EGameDifficulty.TR_CONFIG_EASY,
profile.Avatar = new SAvatar(-1); Avatar = new SAvatar(-1),
profile.GuestProfile = EOffOn.TR_CONFIG_OFF; GuestProfile = EOffOn.TR_CONFIG_OFF,
profile.Active = EOffOn.TR_CONFIG_ON; Active = EOffOn.TR_CONFIG_ON,
ProfileFile = fileName != "" ? Path.Combine(CSettings.FolderProfiles, fileName) : String.Empty
if (fileName != "") };
profile.ProfileFile = Path.Combine(CSettings.FolderProfiles, fileName);
else
profile.ProfileFile = String.Empty;
if (File.Exists(profile.ProfileFile)) if (File.Exists(profile.ProfileFile))
return -1; return -1;
@@ -129,9 +126,7 @@ namespace Vocaluxe.Base
if (tex.Index != -1) if (tex.Index != -1)
{ {
SAvatar avatar = new SAvatar(); SAvatar avatar = new SAvatar {Texture = tex, FileName = Path.GetFileName(file)};
avatar.Texture = tex;
avatar.FileName = Path.GetFileName(file);
_Avatars.Add(avatar); _Avatars.Add(avatar);
} }
} }
@@ -367,8 +362,7 @@ namespace Vocaluxe.Base
private static void _LoadProfile(string fileName) private static void _LoadProfile(string fileName)
{ {
SProfile profile = new SProfile(); SProfile profile = new SProfile {ProfileFile = Path.Combine(CSettings.FolderProfiles, fileName)};
profile.ProfileFile = Path.Combine(CSettings.FolderProfiles, fileName);
CXMLReader xmlReader = CXMLReader.OpenFile(profile.ProfileFile); CXMLReader xmlReader = CXMLReader.OpenFile(profile.ProfileFile);
if (xmlReader == null) if (xmlReader == null)
+1 -10
View File
@@ -197,16 +197,7 @@ namespace Vocaluxe.Base
public static void CreateFolders() public static void CreateFolders()
{ {
List<string> folders = new List<string>(); List<string> folders = new List<string> {FolderCover, FolderFonts, FolderProfiles, FolderSongs, FolderScreenshots, FolderBackgroundMusic, FolderSounds, FolderPlaylists};
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)
{ {
+8 -5
View File
@@ -486,16 +486,19 @@ namespace Vocaluxe.Base
_MaxVolume = volume; _MaxVolume = volume;
} }
if (_MaxVolume >= 0.02f) _AnalyzeByAutocorrelation(_MaxVolume >= 0.02f);
_AnalyzeByAutocorrelation(true);
else
_AnalyzeByAutocorrelation(false);
} }
catch (Exception) {} catch (Exception) {}
} }
private void _AnalyzeByAutocorrelation(bool valid) private void _AnalyzeByAutocorrelation(bool valid)
{ {
if (!valid)
{
_ToneValid = false;
return;
}
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 // prepare to analyze
@@ -525,7 +528,7 @@ namespace Vocaluxe.Base
weigth[toneIndex] = (float)curWeight; weigth[toneIndex] = (float)curWeight;
} }
if (valid && maxWeight - minWeight > 0.01) if (maxWeight - minWeight > 0.01)
{ {
for (int i = 0; i < weigth.Length; i++) for (int i = 0; i < weigth.Length; i++)
_ToneWeigth[i] = weigth[i]; _ToneWeigth[i] = weigth[i];
+7 -15
View File
@@ -197,9 +197,7 @@ namespace Vocaluxe.Base
try try
{ {
xmlReader.GetValue("//root/Videos/" + _Skins[skinIndex].VideoList[i].Name, out value, String.Empty); xmlReader.GetValue("//root/Videos/" + _Skins[skinIndex].VideoList[i].Name, out value, String.Empty);
SSkinElement sk = new SSkinElement(); SSkinElement sk = new SSkinElement {Name = _Skins[skinIndex].VideoList[i].Name, Value = value};
sk.Name = _Skins[skinIndex].VideoList[i].Name;
sk.Value = value;
sk.VideoIndex = CVideo.VdLoad(Path.Combine(_Skins[skinIndex].Path, sk.Value)); sk.VideoIndex = CVideo.VdLoad(Path.Combine(_Skins[skinIndex].Path, sk.Value));
CVideo.VdSetLoop(sk.VideoIndex, true); CVideo.VdSetLoop(sk.VideoIndex, true);
CVideo.VdPause(sk.VideoIndex); CVideo.VdPause(sk.VideoIndex);
@@ -406,7 +404,7 @@ namespace Vocaluxe.Base
_Themes.Clear(); _Themes.Clear();
string path = Path.Combine(Directory.GetCurrentDirectory(), CSettings.FolderThemes); string path = Path.Combine(Directory.GetCurrentDirectory(), CSettings.FolderThemes);
List<string> files = CHelper.ListFiles(path, "*.xml", false); List<string> files = CHelper.ListFiles(path, "*.xml");
foreach (string file in files) foreach (string file in files)
AddTheme(Path.Combine(path, file), -1); AddTheme(Path.Combine(path, file), -1);
@@ -477,7 +475,7 @@ namespace Vocaluxe.Base
STheme theme = _Themes[themeIndex]; STheme theme = _Themes[themeIndex];
string path = Path.Combine(theme.Path, theme.SkinFolder); string path = Path.Combine(theme.Path, theme.SkinFolder);
List<string> files = CHelper.ListFiles(path, "*.xml", false); List<string> files = CHelper.ListFiles(path, "*.xml");
foreach (string file in files) foreach (string file in files)
{ {
@@ -508,9 +506,7 @@ namespace Vocaluxe.Base
List<string> names = xmlReader.GetValues("Skins"); List<string> names = xmlReader.GetValues("Skins");
foreach (string str in names) foreach (string str in names)
{ {
SSkinElement sk = new SSkinElement(); SSkinElement sk = new SSkinElement {Name = str, Value = String.Empty};
sk.Name = str;
sk.Value = String.Empty;
skin.SkinList[str] = sk; skin.SkinList[str] = sk;
} }
@@ -518,9 +514,7 @@ namespace Vocaluxe.Base
names = xmlReader.GetValues("Videos"); names = xmlReader.GetValues("Videos");
foreach (string str in names) foreach (string str in names)
{ {
SSkinElement sk = new SSkinElement(); SSkinElement sk = new SSkinElement {Name = str, Value = String.Empty};
sk.Name = str;
sk.Value = String.Empty;
skin.VideoList.Add(sk); skin.VideoList.Add(sk);
} }
_Skins.Add(skin); _Skins.Add(skin);
@@ -711,9 +705,8 @@ namespace Vocaluxe.Base
int i = 1; int i = 1;
while (xmlReader.TryGetFloatValue("//root/Colors/Player" + i + "/R", ref value)) while (xmlReader.TryGetFloatValue("//root/Colors/Player" + i + "/R", ref value))
{ {
SColorF color = new SColorF(); SColorF color = new SColorF {R = value};
color.R = value;
xmlReader.TryGetFloatValue("//root/Colors/Player" + i + "/G", ref color.G); xmlReader.TryGetFloatValue("//root/Colors/Player" + i + "/G", ref color.G);
xmlReader.TryGetFloatValue("//root/Colors/Player" + i + "/B", ref color.B); xmlReader.TryGetFloatValue("//root/Colors/Player" + i + "/B", ref color.B);
xmlReader.TryGetFloatValue("//root/Colors/Player" + i + "/A", ref color.A); xmlReader.TryGetFloatValue("//root/Colors/Player" + i + "/A", ref color.A);
@@ -728,8 +721,7 @@ namespace Vocaluxe.Base
List<string> names = xmlReader.GetValues("ColorSchemes"); List<string> names = xmlReader.GetValues("ColorSchemes");
foreach (string str in names) foreach (string str in names)
{ {
SColorScheme scheme = new SColorScheme(); SColorScheme scheme = new SColorScheme {Name = str};
scheme.Name = str;
xmlReader.TryGetFloatValue("//root/ColorSchemes/" + str + "/R", ref scheme.Color.R); xmlReader.TryGetFloatValue("//root/ColorSchemes/" + str + "/R", ref scheme.Color.R);
xmlReader.TryGetFloatValue("//root/ColorSchemes/" + str + "/G", ref scheme.Color.G); xmlReader.TryGetFloatValue("//root/ColorSchemes/" + str + "/G", ref scheme.Color.G);
+1 -4
View File
@@ -158,10 +158,7 @@ namespace Vocaluxe.Base
if (!_Timer.IsRunning || (_Timer.ElapsedMilliseconds > 75) || !repeat) if (!_Timer.IsRunning || (_Timer.ElapsedMilliseconds > 75) || !repeat)
{ {
_Keys = e.KeyCode; _Keys = e.KeyCode;
if (repeat) _Add(_ModAlt, _ModShift, _ModCtrl, _KeyPressed, repeat ? _Char : Char.MinValue, _Keys);
_Add(_ModAlt, _ModShift, _ModCtrl, _KeyPressed, _Char, _Keys);
else
_Add(_ModAlt, _ModShift, _ModCtrl, _KeyPressed, Char.MinValue, _Keys);
} }
} }
+1 -2
View File
@@ -176,8 +176,7 @@ namespace Vocaluxe.Base
float videoTime = _VideoTimer.ElapsedMilliseconds / 1000f; float videoTime = _VideoTimer.ElapsedMilliseconds / 1000f;
_Finished = CVideo.VdFinished(_VideoStream); _Finished = CVideo.VdFinished(_VideoStream);
STexture tex = new STexture(-1); STexture tex = new STexture(-1) {Height = 0f};
tex.Height = 0f;
CVideo.VdGetFrame(_VideoStream, ref tex, videoTime, out videoTime); CVideo.VdGetFrame(_VideoStream, ref tex, videoTime, out videoTime);
if (tex.Height > 0) if (tex.Height > 0)
+2 -13
View File
@@ -359,15 +359,9 @@ namespace Vocaluxe.Lib.Draw
{ {
Bitmap bmp2 = new Bitmap(bmp); Bitmap bmp2 = new Bitmap(bmp);
_Bitmaps.Add(bmp2); _Bitmaps.Add(bmp2);
STexture texture = new STexture(); STexture texture = new STexture {Index = _Bitmaps.Count - 1, Width = bmp.Width, Height = bmp.Height, Color = new SColorF(1f, 1f, 1f, 1f)};
texture.Index = _Bitmaps.Count - 1;
texture.Width = bmp.Width;
texture.Height = bmp.Height;
// Add to Texture List // Add to Texture List
texture.Color = new SColorF(1f, 1f, 1f, 1f);
texture.Rect = new SRectF(0f, 0f, texture.Width, texture.Height, 0f); texture.Rect = new SRectF(0f, 0f, texture.Width, texture.Height, 0f);
texture.TexturePath = String.Empty; texture.TexturePath = String.Empty;
@@ -512,12 +506,7 @@ namespace Vocaluxe.Lib.Draw
using (Graphics g = Graphics.FromImage(newBitmap)) using (Graphics g = Graphics.FromImage(newBitmap))
{ {
ColorMatrix cm = new ColorMatrix(); ColorMatrix cm = new ColorMatrix {Matrix33 = color.A, Matrix00 = color.R, Matrix11 = color.G, Matrix22 = color.B, Matrix44 = 1};
cm.Matrix33 = color.A;
cm.Matrix00 = color.R;
cm.Matrix11 = color.G;
cm.Matrix22 = color.B;
cm.Matrix44 = 1;
using (ImageAttributes ia = new ImageAttributes()) using (ImageAttributes ia = new ImageAttributes())
{ {
+3 -11
View File
@@ -154,8 +154,7 @@ namespace Vocaluxe.Lib.Playlist
xmlReader.GetValue("//root/Songs/" + song + "/Title", out title, String.Empty); xmlReader.GetValue("//root/Songs/" + song + "/Title", out title, String.Empty);
xmlReader.TryGetEnumValue("//root/Songs/" + song + "/GameMode", ref gm); xmlReader.TryGetEnumValue("//root/Songs/" + song + "/GameMode", ref gm);
CPlaylistSong playlistSong = new CPlaylistSong(); CPlaylistSong playlistSong = new CPlaylistSong {SongID = -1};
playlistSong.SongID = -1;
CSong[] allSongs = CSongs.AllSongs; CSong[] allSongs = CSongs.AllSongs;
foreach (CSong curSong in allSongs) foreach (CSong curSong in allSongs)
@@ -181,21 +180,14 @@ namespace Vocaluxe.Lib.Playlist
public void AddSong(int songID) public void AddSong(int songID)
{ {
CPlaylistSong song = new CPlaylistSong(); CPlaylistSong song = new CPlaylistSong {SongID = songID, GameMode = CSongs.GetSong(songID).IsDuet ? EGameMode.TR_GAMEMODE_DUET : EGameMode.TR_GAMEMODE_NORMAL};
song.SongID = songID;
if (CSongs.GetSong(songID).IsDuet)
song.GameMode = EGameMode.TR_GAMEMODE_DUET;
else
song.GameMode = EGameMode.TR_GAMEMODE_NORMAL;
Songs.Add(song); Songs.Add(song);
} }
public void AddSong(int songID, EGameMode gm) public void AddSong(int songID, EGameMode gm)
{ {
CPlaylistSong song = new CPlaylistSong(); CPlaylistSong song = new CPlaylistSong {SongID = songID, GameMode = gm};
song.SongID = songID;
song.GameMode = gm;
Songs.Add(song); Songs.Add(song);
} }
+5 -15
View File
@@ -55,15 +55,9 @@ namespace Vocaluxe.Lib.Sound
{ {
using (DirectSoundCapture ds = new DirectSoundCapture(dev.DriverGuid)) using (DirectSoundCapture ds = new DirectSoundCapture(dev.DriverGuid))
{ {
SRecordDevice device = new SRecordDevice(); SRecordDevice device = new SRecordDevice {Driver = dev.DriverGuid.ToString(), ID = id, Name = dev.Description, Inputs = new List<SInput>()};
device.Driver = dev.DriverGuid.ToString();
device.ID = id;
device.Name = dev.Description;
device.Inputs = new List<SInput>();
SInput inp = new SInput(); SInput inp = new SInput {Name = "Default", Channels = ds.Capabilities.Channels};
inp.Name = "Default";
inp.Channels = ds.Capabilities.Channels;
if (inp.Channels > 2) if (inp.Channels > 2)
inp.Channels = 2; //more are not supported in vocaluxe inp.Channels = 2; //more are not supported in vocaluxe
@@ -120,8 +114,7 @@ namespace Vocaluxe.Lib.Sound
{ {
if (active[i]) if (active[i])
{ {
CSoundCardSource source = new CSoundCardSource(guid[i], channels[i]); CSoundCardSource source = new CSoundCardSource(guid[i], channels[i]) {SampleRateKhz = 44.1};
source.SampleRateKhz = 44.1;
source.SampleDataReady += _OnDataReady; source.SampleDataReady += _OnDataReady;
source.Start(); source.Start();
@@ -336,9 +329,7 @@ namespace Vocaluxe.Lib.Sound
for (int i = 0; i < _BufferPortionCount; i++) for (int i = 0; i < _BufferPortionCount; i++)
{ {
NotificationPosition notification = new NotificationPosition(); NotificationPosition notification = new NotificationPosition {Offset = _BufferPortionCount - 1 + (_BufferPortionSize * i), Event = new AutoResetEvent(false)};
notification.Offset = _BufferPortionCount - 1 + (_BufferPortionSize * i);
notification.Event = new AutoResetEvent(false);
_Notifications.Add(notification); _Notifications.Add(notification);
} }
@@ -348,8 +339,7 @@ namespace Vocaluxe.Lib.Sound
for (int i = 0; i < _Notifications.Count; i++) for (int i = 0; i < _Notifications.Count; i++)
_WaitHandles[i] = _Notifications[i].Event; _WaitHandles[i] = _Notifications[i].Event;
_CaptureThread = new Thread(_DoCapture); _CaptureThread = new Thread(_DoCapture) {IsBackground = true};
_CaptureThread.IsBackground = true;
_Running = true; _Running = true;
_CaptureThread.Start(); _CaptureThread.Start();
+7 -5
View File
@@ -603,11 +603,13 @@ namespace Vocaluxe.Lib.Sound
IntPtr data = new IntPtr(0); IntPtr data = new IntPtr(0);
CPortAudio.SPaStreamParameters outputParams = new CPortAudio.SPaStreamParameters(); CPortAudio.SPaStreamParameters outputParams = new CPortAudio.SPaStreamParameters
outputParams.ChannelCount = format.ChannelCount; {
outputParams.Device = _ApiInfo.DefaultOutputDevice; ChannelCount = format.ChannelCount,
outputParams.SampleFormat = CPortAudio.EPaSampleFormat.PaInt16; Device = _ApiInfo.DefaultOutputDevice,
outputParams.SuggestedLatency = _OutputDeviceInfo.DefaultLowOutputLatency; SampleFormat = CPortAudio.EPaSampleFormat.PaInt16,
SuggestedLatency = _OutputDeviceInfo.DefaultLowOutputLatency
};
uint bufsize = (uint)CConfig.AudioBufferSize; uint bufsize = (uint)CConfig.AudioBufferSize;
lock (_Mutex) lock (_Mutex)
+9 -14
View File
@@ -73,17 +73,10 @@ namespace Vocaluxe.Lib.Sound
CPortAudio.SPaDeviceInfo info = CPortAudio.PaGetDeviceInfo(i); CPortAudio.SPaDeviceInfo info = CPortAudio.PaGetDeviceInfo(i);
if (info.HostApi == hostAPI && info.MaxInputChannels > 0) if (info.HostApi == hostAPI && info.MaxInputChannels > 0)
{ {
SRecordDevice dev = new SRecordDevice(); SRecordDevice dev = new SRecordDevice {ID = i, Name = info.Name, Driver = info.Name + i, Inputs = new List<SInput>()};
dev.ID = i; SInput inp = new SInput {Name = "Default", Channels = info.MaxInputChannels};
dev.Name = info.Name;
dev.Driver = info.Name + i;
dev.Inputs = new List<SInput>();
SInput inp = new SInput();
inp.Name = "Default";
inp.Channels = info.MaxInputChannels;
if (inp.Channels > 2) if (inp.Channels > 2)
inp.Channels = 2; //more are not supported in vocaluxe inp.Channels = 2; //more are not supported in vocaluxe
@@ -156,11 +149,13 @@ namespace Vocaluxe.Lib.Sound
{ {
if (active[i]) if (active[i])
{ {
CPortAudio.SPaStreamParameters inputParams = new CPortAudio.SPaStreamParameters(); CPortAudio.SPaStreamParameters inputParams = new CPortAudio.SPaStreamParameters
inputParams.ChannelCount = _DeviceConfig[i].Inputs[0].Channels; {
inputParams.Device = _DeviceConfig[i].ID; ChannelCount = _DeviceConfig[i].Inputs[0].Channels,
inputParams.SampleFormat = CPortAudio.EPaSampleFormat.PaInt16; Device = _DeviceConfig[i].ID,
inputParams.SuggestedLatency = CPortAudio.PaGetDeviceInfo(_DeviceConfig[i].ID).DefaultLowInputLatency; SampleFormat = CPortAudio.EPaSampleFormat.PaInt16,
SuggestedLatency = CPortAudio.PaGetDeviceInfo(_DeviceConfig[i].ID).DefaultLowInputLatency
};
if (_ErrorCheck("OpenStream (rec)", CPortAudio.Pa_OpenStream( if (_ErrorCheck("OpenStream (rec)", CPortAudio.Pa_OpenStream(
out _RecHandle[i], out _RecHandle[i],
+1 -2
View File
@@ -291,8 +291,7 @@ namespace Vocaluxe.Screens
CStatic image = GetNewStatic(texture, new SColorF(1, 1, 1, 1), new SRectF(-1, -1, 400, 120, -4)); CStatic image = GetNewStatic(texture, new SColorF(1, 1, 1, 1), new SRectF(-1, -1, 400, 120, -4));
SRectF particleRect = new SRectF(-1, -1, partRectSize, partRectSize, -6); SRectF particleRect = new SRectF(-1, -1, partRectSize, partRectSize, -6);
SRectF imgDotRect = new SRectF(particleRect); SRectF imgDotRect = new SRectF(particleRect) {Z = -5};
imgDotRect.Z = -5;
CStatic imgDot = GetNewStatic(texDot, new SColorF(1, 1, 1, 1), imgDotRect); CStatic imgDot = GetNewStatic(texDot, new SColorF(1, 1, 1, 1), imgDotRect);
CParticleEffect particle = _GetStarParticles(partCount, isRight, particleRect, bigParticles); CParticleEffect particle = _GetStarParticles(partCount, isRight, particleRect, bigParticles);
+2 -7
View File
@@ -53,9 +53,7 @@ namespace Vocaluxe.Screens
{ {
base.Init(); base.Init();
List<string> texts = new List<string>(); List<string> texts = new List<string> {_TextSongName, _TextSongMode};
texts.Add(_TextSongName);
texts.Add(_TextSongMode);
_TextNumber = new string[_NumEntrys]; _TextNumber = new string[_NumEntrys];
for (int i = 0; i < _NumEntrys; i++) for (int i = 0; i < _NumEntrys; i++)
@@ -176,10 +174,7 @@ namespace Vocaluxe.Screens
_Texts[_TextScore[p]].Text = _Scores[_Round][_Pos + p].Score.ToString("00000"); _Texts[_TextScore[p]].Text = _Scores[_Round][_Pos + p].Score.ToString("00000");
_Texts[_TextDate[p]].Text = _Scores[_Round][_Pos + p].Date; _Texts[_TextDate[p]].Text = _Scores[_Round][_Pos + p].Date;
if (_IsNewEntry(_Scores[_Round][_Pos + p].ID)) _ParticleEffects[_ParticleEffectNew[p]].Visible = _IsNewEntry(_Scores[_Round][_Pos + p].ID);
_ParticleEffects[_ParticleEffectNew[p]].Visible = true;
else
_ParticleEffects[_ParticleEffectNew[p]].Visible = false;
} }
else else
{ {
+3 -10
View File
@@ -76,8 +76,7 @@ namespace Vocaluxe.Screens
statics.Add(_StaticWarningProfiles); statics.Add(_StaticWarningProfiles);
_ThemeStatics = statics.ToArray(); _ThemeStatics = statics.ToArray();
List<string> texts = new List<string>(); List<string> texts = new List<string> {_SelectSlidePlayerNumber};
texts.Add(_SelectSlidePlayerNumber);
texts.AddRange(_SelectSlideDuetPlayer); texts.AddRange(_SelectSlideDuetPlayer);
_ThemeSelectSlides = texts.ToArray(); _ThemeSelectSlides = texts.ToArray();
@@ -597,16 +596,10 @@ namespace Vocaluxe.Screens
if (CGame.GetNumSongs() == 1 && CGame.GetSong(1).IsDuet) if (CGame.GetNumSongs() == 1 && CGame.GetSong(1).IsDuet)
{ {
_SelectSlides[_SelectSlideDuetPlayer[i]].Clear(); _SelectSlides[_SelectSlideDuetPlayer[i]].Clear();
if (i + 1 <= CGame.NumPlayer) _SelectSlides[_SelectSlideDuetPlayer[i]].Visible = i + 1 <= CGame.NumPlayer;
_SelectSlides[_SelectSlideDuetPlayer[i]].Visible = true;
else
_SelectSlides[_SelectSlideDuetPlayer[i]].Visible = false;
_SelectSlides[_SelectSlideDuetPlayer[i]].AddValue(CGame.GetSong(1).DuetPart1); _SelectSlides[_SelectSlideDuetPlayer[i]].AddValue(CGame.GetSong(1).DuetPart1);
_SelectSlides[_SelectSlideDuetPlayer[i]].AddValue(CGame.GetSong(1).DuetPart2); _SelectSlides[_SelectSlideDuetPlayer[i]].AddValue(CGame.GetSong(1).DuetPart2);
if ((i + 1) % 2 == 0) _SelectSlides[_SelectSlideDuetPlayer[i]].Selection = i % 2;
_SelectSlides[_SelectSlideDuetPlayer[i]].Selection = 1;
else
_SelectSlides[_SelectSlideDuetPlayer[i]].Selection = 0;
} }
else else
_SelectSlides[_SelectSlideDuetPlayer[i]].Visible = false; _SelectSlides[_SelectSlideDuetPlayer[i]].Visible = false;
+1 -2
View File
@@ -75,8 +75,7 @@ namespace Vocaluxe.Screens
{ {
base.Init(); base.Init();
List<string> values = new List<string>(); List<string> values = new List<string> {_StaticWarning};
values.Add(_StaticWarning);
values.AddRange(_StaticEnergyChannel); values.AddRange(_StaticEnergyChannel);
_ThemeStatics = values.ToArray(); _ThemeStatics = values.ToArray();
+19 -28
View File
@@ -118,36 +118,30 @@ namespace Vocaluxe.Screens
{ {
base.Init(); base.Init();
List<string> texts = new List<string>(); List<string> texts = new List<string> {_TextSongName, _TextTime, _TextPause, _TextDuetName1, _TextDuetName2};
texts.Add(_TextSongName);
texts.Add(_TextTime);
texts.Add(_TextPause);
texts.Add(_TextDuetName1);
texts.Add(_TextDuetName2);
_BuildTextStrings(ref texts); _BuildTextStrings(ref texts);
_ThemeTexts = texts.ToArray(); _ThemeTexts = texts.ToArray();
List<string> statics = new List<string>(); List<string> statics = new List<string>
statics.Add(_StaticSongText); {
statics.Add(_StaticLyrics); _StaticSongText,
statics.Add(_StaticLyricsDuet); _StaticLyrics,
statics.Add(_StaticLyricsTop); _StaticLyricsDuet,
statics.Add(_StaticTimeBar); _StaticLyricsTop,
statics.Add(_StaticTimeLine); _StaticTimeBar,
statics.Add(_StaticTimeLineExpandedNormal); _StaticTimeLine,
statics.Add(_StaticTimeLineExpandedHighlighted); _StaticTimeLineExpandedNormal,
statics.Add(_StaticTimePointer); _StaticTimeLineExpandedHighlighted,
statics.Add(_StaticLyricHelper); _StaticTimePointer,
statics.Add(_StaticLyricHelperDuet); _StaticLyricHelper,
statics.Add(_StaticLyricHelperTop); _StaticLyricHelperDuet,
statics.Add(_StaticPauseBG); _StaticLyricHelperTop,
_StaticPauseBG
};
_BuildStaticStrings(ref statics); _BuildStaticStrings(ref statics);
_ThemeStatics = statics.ToArray(); _ThemeStatics = statics.ToArray();
List<string> buttons = new List<string>(); List<string> buttons = new List<string> {_ButtonCancel, _ButtonContinue, _ButtonSkip};
buttons.Add(_ButtonCancel);
buttons.Add(_ButtonContinue);
buttons.Add(_ButtonSkip);
_ThemeButtons = buttons.ToArray(); _ThemeButtons = buttons.ToArray();
_ThemeLyrics = new string[] {_LyricMain, _LyricSub, _LyricMainDuet, _LyricSubDuet, _LyricMainTop, _LyricSubTop}; _ThemeLyrics = new string[] {_LyricMain, _LyricSub, _LyricMainDuet, _LyricSubDuet, _LyricMainTop, _LyricSubTop};
@@ -638,10 +632,7 @@ namespace Vocaluxe.Screens
{ {
for (int i = 0; i < CGame.NumPlayer; i++) for (int i = 0; i < CGame.NumPlayer; i++)
{ {
if ((i % 2) == 0) CGame.Player[i].LineNr = (i+1) % 2;
CGame.Player[i].LineNr = 1;
else
CGame.Player[i].LineNr = 0;
} }
} }
else else
+2 -8
View File
@@ -803,10 +803,7 @@ namespace Vocaluxe.Screens
gm = _AvailableGameModes[_SelectSlides[_SelectSlideOptionsMode].Selection]; gm = _AvailableGameModes[_SelectSlides[_SelectSlideOptionsMode].Selection];
else else
{ {
if (CSongs.VisibleSongs[songNr].IsDuet) gm = CSongs.VisibleSongs[songNr].IsDuet ? EGameMode.TR_GAMEMODE_DUET : EGameMode.TR_GAMEMODE_NORMAL;
gm = EGameMode.TR_GAMEMODE_DUET;
else
gm = EGameMode.TR_GAMEMODE_NORMAL;
} }
CGame.Reset(); CGame.Reset();
@@ -823,10 +820,7 @@ namespace Vocaluxe.Screens
if (CSongs.Category >= 0 && songNr >= 0 && CSongs.NumVisibleSongs > songNr) if (CSongs.Category >= 0 && songNr >= 0 && CSongs.NumVisibleSongs > songNr)
{ {
EGameMode gm; EGameMode gm;
if (CSongs.VisibleSongs[songNr].IsDuet) gm = CSongs.VisibleSongs[songNr].IsDuet ? EGameMode.TR_GAMEMODE_DUET : EGameMode.TR_GAMEMODE_NORMAL;
gm = EGameMode.TR_GAMEMODE_DUET;
else
gm = EGameMode.TR_GAMEMODE_NORMAL;
CGame.Reset(); CGame.Reset();
CGame.ClearSongs(); CGame.ClearSongs();
+10 -17
View File
@@ -117,11 +117,13 @@ namespace VocaluxeLib.Menu
public CButton(CButton button) public CButton(CButton button)
{ {
_PartyModeID = button._PartyModeID; _PartyModeID = button._PartyModeID;
_Theme = new SThemeButton(); _Theme = new SThemeButton
_Theme.ColorName = button._Theme.ColorName; {
_Theme.SelColorName = button._Theme.SelColorName; ColorName = button._Theme.ColorName,
_Theme.TextureName = button._Theme.TextureName; SelColorName = button._Theme.SelColorName,
_Theme.SelTextureName = button._Theme.SelTextureName; TextureName = button._Theme.TextureName,
SelTextureName = button._Theme.SelTextureName
};
Rect = new SRectF(button.Rect); Rect = new SRectF(button.Rect);
Color = new SColorF(button.Color); Color = new SColorF(button.Color);
@@ -303,10 +305,7 @@ namespace VocaluxeLib.Menu
if (!Selected && !Pressed || !Enabled) if (!Selected && !Pressed || !Enabled)
{ {
if (Texture.Index != -1) texture = Texture.Index != -1 ? Texture : CBase.Theme.GetSkinTexture(_Theme.TextureName, _PartyModeID);
texture = Texture;
else
texture = CBase.Theme.GetSkinTexture(_Theme.TextureName, _PartyModeID);
CBase.Drawing.DrawTexture(texture, Rect, Color); CBase.Drawing.DrawTexture(texture, Rect, Color);
@@ -320,10 +319,7 @@ namespace VocaluxeLib.Menu
} }
else if (!IsSelText) else if (!IsSelText)
{ {
if (Texture.Index != -1) texture = Texture.Index != -1 ? Texture : CBase.Theme.GetSkinTexture(_Theme.SelTextureName, _PartyModeID);
texture = Texture;
else
texture = CBase.Theme.GetSkinTexture(_Theme.SelTextureName, _PartyModeID);
CBase.Drawing.DrawTexture(texture, Rect, SelColor); CBase.Drawing.DrawTexture(texture, Rect, SelColor);
@@ -337,10 +333,7 @@ namespace VocaluxeLib.Menu
} }
else if (IsSelText) else if (IsSelText)
{ {
if (SelTexture.Index != -1) texture = SelTexture.Index != -1 ? SelTexture : CBase.Theme.GetSkinTexture(_Theme.SelTextureName, _PartyModeID);
texture = SelTexture;
else
texture = CBase.Theme.GetSkinTexture(_Theme.SelTextureName, _PartyModeID);
CBase.Drawing.DrawTexture(texture, Rect, SelColor); CBase.Drawing.DrawTexture(texture, Rect, SelColor);
+4 -4
View File
@@ -106,10 +106,10 @@ namespace VocaluxeLib.Menu
{ {
_PrepareTiles(); _PrepareTiles();
_PlayerSelector = new CStatic(_PartyModeID); _PlayerSelector = new CStatic(_PartyModeID) {
_PlayerSelector.Texture = _TextureTileSelected; Texture = _TextureTileSelected,
_PlayerSelector.Rect = new SRectF(0, 0, _TileW + 6, _TileH + 6, Rect.Z - 0.5f); Rect = new SRectF(0, 0, _TileW + 6, _TileH + 6, Rect.Z - 0.5f),
_PlayerSelector.Visible = false; Visible = false};
_UpdateVisibleProfiles(); _UpdateVisibleProfiles();
+2 -4
View File
@@ -320,9 +320,7 @@ namespace VocaluxeLib.Menu
_Interactions[i].Type == EType.SongMenu || _Interactions[i].Type == EType.SongMenu ||
_Interactions[i].Type == EType.Equalizer)) _Interactions[i].Type == EType.Equalizer))
{ {
SZSort zs = new SZSort(); SZSort zs = new SZSort {ID = i, Z = _GetZValue(i)};
zs.ID = i;
zs.Z = _GetZValue(i);
items.Add(zs); items.Add(zs);
} }
} }
@@ -331,7 +329,7 @@ namespace VocaluxeLib.Menu
return; return;
items.Sort(delegate(SZSort s1, SZSort s2) { return s2.Z.CompareTo(s1.Z); }); items.Sort((s1, s2) => s2.Z.CompareTo(s1.Z));
for (int i = 0; i < items.Count; i++) for (int i = 0; i < items.Count; i++)
_DrawInteraction(items[i].ID); _DrawInteraction(items[i].ID);
+30 -34
View File
@@ -203,17 +203,19 @@ namespace VocaluxeLib.Menu
public CPlaylist(int partyModeID) public CPlaylist(int partyModeID)
{ {
_PartyModeID = partyModeID; _PartyModeID = partyModeID;
_Theme = new SThemePlaylist(); _Theme = new SThemePlaylist
_Theme.Text1 = new CText(_PartyModeID); {
_Theme.StaticCover = new CStatic(_PartyModeID); Text1 = new CText(_PartyModeID),
_Theme.StaticPlaylistFooter = new CStatic(_PartyModeID); StaticCover = new CStatic(_PartyModeID),
_Theme.StaticPlaylistHeader = new CStatic(_PartyModeID); StaticPlaylistFooter = new CStatic(_PartyModeID),
_Theme.ButtonPlaylistName = new CButton(_PartyModeID); StaticPlaylistHeader = new CStatic(_PartyModeID),
_Theme.ButtonPlaylistClose = new CButton(_PartyModeID); ButtonPlaylistName = new CButton(_PartyModeID),
_Theme.ButtonPlaylistDelete = new CButton(_PartyModeID); ButtonPlaylistClose = new CButton(_PartyModeID),
_Theme.ButtonPlaylistSave = new CButton(_PartyModeID); ButtonPlaylistDelete = new CButton(_PartyModeID),
_Theme.ButtonPlaylistSing = new CButton(_PartyModeID); ButtonPlaylistSave = new CButton(_PartyModeID),
_Theme.SelectSlideGameMode = new CSelectSlide(_PartyModeID); ButtonPlaylistSing = new CButton(_PartyModeID),
SelectSlideGameMode = new CSelectSlide(_PartyModeID)
};
CompleteRect = new SRectF(); CompleteRect = new SRectF();
Rect = new SRectF(); Rect = new SRectF();
@@ -626,8 +628,7 @@ namespace VocaluxeLib.Menu
CBase.Playlist.MovePlaylistSongUp(ActivePlaylistID, CurrentPlaylistElement + Offset); CBase.Playlist.MovePlaylistSongUp(ActivePlaylistID, CurrentPlaylistElement + Offset);
UpdatePlaylist(); UpdatePlaylist();
SKeyEvent key = new SKeyEvent(); SKeyEvent key = new SKeyEvent {Key = Keys.Up};
key.Key = Keys.Up;
if (CurrentPlaylistElement > scrollLimit) if (CurrentPlaylistElement > scrollLimit)
{ {
@@ -656,8 +657,7 @@ namespace VocaluxeLib.Menu
CBase.Playlist.MovePlaylistSongDown(ActivePlaylistID, CurrentPlaylistElement + Offset); CBase.Playlist.MovePlaylistSongDown(ActivePlaylistID, CurrentPlaylistElement + Offset);
UpdatePlaylist(); UpdatePlaylist();
SKeyEvent key = new SKeyEvent(); SKeyEvent key = new SKeyEvent {Key = Keys.Down};
key.Key = Keys.Down;
if (CurrentPlaylistElement >= scrollLimit) if (CurrentPlaylistElement >= scrollLimit)
{ {
@@ -795,10 +795,7 @@ namespace VocaluxeLib.Menu
return; return;
int off = _PlaylistElementContents.Count - _PlaylistElements.Count; int off = _PlaylistElementContents.Count - _PlaylistElements.Count;
if (off >= 0) Offset = off >= 0 ? off : 0;
Offset = off;
else
Offset = 0;
Update(); Update();
@@ -839,10 +836,7 @@ namespace VocaluxeLib.Menu
return; return;
int off = _PlaylistElementContents.Count - _PlaylistElements.Count; int off = _PlaylistElementContents.Count - _PlaylistElements.Count;
if (off >= 0) Offset = off >= 0 ? off : 0;
Offset = off;
else
Offset = 0;
Update(); Update();
} }
@@ -1100,12 +1094,13 @@ namespace VocaluxeLib.Menu
for (int i = 0; i < Math.Floor(Rect.H / _Theme.EntryHeight); i++) for (int i = 0; i < Math.Floor(Rect.H / _Theme.EntryHeight); i++)
{ {
CPlaylistElement en = new CPlaylistElement(); CPlaylistElement en = new CPlaylistElement
{
Background = new CStatic(_PartyModeID, _Theme.TextureBackgroundName, BackgroundColor,
new SRectF(Rect.X, Rect.Y + (i * _Theme.EntryHeight), Rect.W, _Theme.EntryHeight, Rect.Z)),
Cover = new CStatic(_Theme.StaticCover)
};
en.Background = new CStatic(_PartyModeID, _Theme.TextureBackgroundName, BackgroundColor,
new SRectF(Rect.X, Rect.Y + (i * _Theme.EntryHeight), Rect.W, _Theme.EntryHeight, Rect.Z));
en.Cover = new CStatic(_Theme.StaticCover);
en.Cover.Rect.Y += Rect.Y + (i * _Theme.EntryHeight); en.Cover.Rect.Y += Rect.Y + (i * _Theme.EntryHeight);
en.Cover.Rect.X += Rect.X; en.Cover.Rect.X += Rect.X;
@@ -1140,10 +1135,12 @@ namespace VocaluxeLib.Menu
_PlaylistElementContents.Clear(); _PlaylistElementContents.Clear();
for (int i = 0; i < CBase.Playlist.GetPlaylistSongCount(ActivePlaylistID); i++) for (int i = 0; i < CBase.Playlist.GetPlaylistSongCount(ActivePlaylistID); i++)
{ {
CPlaylistElementContent pec = new CPlaylistElementContent(); CPlaylistElementContent pec = new CPlaylistElementContent
pec.SongID = CBase.Playlist.GetPlaylistSong(ActivePlaylistID, i).SongID; {
pec.Modes = CBase.Songs.GetSongByID(CBase.Playlist.GetPlaylistSong(ActivePlaylistID, i).SongID).AvailableGameModes; SongID = CBase.Playlist.GetPlaylistSong(ActivePlaylistID, i).SongID,
pec.Mode = CBase.Playlist.GetPlaylistSong(ActivePlaylistID, i).GameMode; Modes = CBase.Songs.GetSongByID(CBase.Playlist.GetPlaylistSong(ActivePlaylistID, i).SongID).AvailableGameModes,
Mode = CBase.Playlist.GetPlaylistSong(ActivePlaylistID, i).GameMode
};
_PlaylistElementContents.Add(pec); _PlaylistElementContents.Add(pec);
} }
Update(); Update();
@@ -1157,8 +1154,7 @@ namespace VocaluxeLib.Menu
_PlaylistElementContents.Clear(); _PlaylistElementContents.Clear();
for (int i = 0; i < CBase.Playlist.GetPlaylistSongCount(ActivePlaylistID); i++) for (int i = 0; i < CBase.Playlist.GetPlaylistSongCount(ActivePlaylistID); i++)
{ {
CPlaylistElementContent pec = new CPlaylistElementContent(); CPlaylistElementContent pec = new CPlaylistElementContent {SongID = CBase.Playlist.GetPlaylistSong(ActivePlaylistID, i).SongID};
pec.SongID = CBase.Playlist.GetPlaylistSong(ActivePlaylistID, i).SongID;
pec.Modes = CBase.Songs.GetSongByID(pec.SongID).AvailableGameModes; pec.Modes = CBase.Songs.GetSongByID(pec.SongID).AvailableGameModes;
pec.Mode = CBase.Playlist.GetPlaylistSong(ActivePlaylistID, i).GameMode; pec.Mode = CBase.Playlist.GetPlaylistSong(ActivePlaylistID, i).GameMode;
_PlaylistElementContents.Add(pec); _PlaylistElementContents.Add(pec);
+18 -23
View File
@@ -187,29 +187,24 @@ namespace VocaluxeLib.Menu
public CSelectSlide(CSelectSlide slide) public CSelectSlide(CSelectSlide slide)
{ {
_PartyModeID = slide._PartyModeID; _PartyModeID = slide._PartyModeID;
_Theme = new SThemeSelectSlide(); _Theme = new SThemeSelectSlide
{
_Theme.TextureArrowLeftName = slide._Theme.TextureArrowLeftName; TextureArrowLeftName = slide._Theme.TextureArrowLeftName,
_Theme.TextureArrowRightName = slide._Theme.TextureArrowRightName; TextureArrowRightName = slide._Theme.TextureArrowRightName,
SelTextureName = slide._Theme.SelTextureName,
_Theme.SelTextureName = slide._Theme.SelTextureName; SelTextureArrowLeftName = slide._Theme.SelTextureArrowLeftName,
_Theme.SelTextureArrowLeftName = slide._Theme.SelTextureArrowLeftName; SelTextureArrowRightName = slide._Theme.SelTextureArrowRightName,
_Theme.SelTextureArrowRightName = slide._Theme.SelTextureArrowRightName; HighlightTextureName = slide._Theme.HighlightTextureName,
ColorName = slide._Theme.ColorName,
_Theme.HighlightTextureName = slide._Theme.HighlightTextureName; SelColorName = slide._Theme.SelColorName,
HighlightColorName = slide._Theme.HighlightColorName,
_Theme.ColorName = slide._Theme.ColorName; ArrowColorName = slide._Theme.ArrowColorName,
_Theme.SelColorName = slide._Theme.SelColorName; SelArrowColorName = slide._Theme.SelArrowColorName,
_Theme.HighlightColorName = slide._Theme.HighlightColorName; TextColorName = slide._Theme.TextColorName,
SelTextColorName = slide._Theme.SelTextColorName,
_Theme.ArrowColorName = slide._Theme.ArrowColorName; TextFont = slide._Theme.TextFont,
_Theme.SelArrowColorName = slide._Theme.SelArrowColorName; TextStyle = slide._Theme.TextStyle
};
_Theme.TextColorName = slide._Theme.TextColorName;
_Theme.SelTextColorName = slide._Theme.SelTextColorName;
_Theme.TextFont = slide._Theme.TextFont;
_Theme.TextStyle = slide._Theme.TextStyle;
_ThemeLoaded = false; _ThemeLoaded = false;
+2 -7
View File
@@ -121,8 +121,7 @@ namespace VocaluxeLib.Menu
public CStatic(int partyModeID, string textureSkinName, SColorF color, SRectF rect) public CStatic(int partyModeID, string textureSkinName, SColorF color, SRectF rect)
{ {
_PartyModeID = partyModeID; _PartyModeID = partyModeID;
_Theme = new SThemeStatic(); _Theme = new SThemeStatic {TextureName = textureSkinName};
_Theme.TextureName = textureSkinName;
_ThemeLoaded = false; _ThemeLoaded = false;
_Texture = new STexture(-1); _Texture = new STexture(-1);
@@ -244,11 +243,7 @@ namespace VocaluxeLib.Menu
public void Draw(float scale, float z, EAspect aspect, bool forceDraw) public void Draw(float scale, float z, EAspect aspect, bool forceDraw)
{ {
STexture texture; STexture texture = _Texture.Index != -1 ? _Texture : CBase.Theme.GetSkinTexture(_Theme.TextureName, _PartyModeID);
if (_Texture.Index != -1)
texture = _Texture;
else
texture = CBase.Theme.GetSkinTexture(_Theme.TextureName, _PartyModeID);
SRectF bounds = new SRectF( SRectF bounds = new SRectF(
Rect.X - Rect.W * (scale - 1f), Rect.X - Rect.W * (scale - 1f),
+1 -4
View File
@@ -577,10 +577,7 @@ namespace VocaluxeLib.Menu
writer.WriteElementString("Font", Font); writer.WriteElementString("Font", Font);
writer.WriteComment("<Text>: Nothing or translation tag"); writer.WriteComment("<Text>: Nothing or translation tag");
if (CBase.Language.TranslationExists(_Theme.Text)) writer.WriteElementString("Text", CBase.Language.TranslationExists(_Theme.Text) ? _Theme.Text : string.Empty);
writer.WriteElementString("Text", _Theme.Text);
else
writer.WriteElementString("Text", string.Empty);
if (!_ButtonText) if (!_ButtonText)
{ {
+1 -2
View File
@@ -678,8 +678,7 @@ namespace VocaluxeLib.Menu.SingNotes
if (lineIndex < 0) if (lineIndex < 0)
{ {
//Note is before ALL lines //Note is before ALL lines
CLine line = new CLine(); CLine line = new CLine {StartBeat = note.StartBeat};
line.StartBeat = note.StartBeat;
line.AddNote(note); line.AddNote(note);
_Lines.Insert(0, line); _Lines.Insert(0, line);
} }
+1 -2
View File
@@ -397,8 +397,7 @@ namespace VocaluxeLib.Menu.SingNotes
if (note.EndBeat >= CBase.Game.GetCurrentBeatD() && note.Hit && note.NoteType == ENoteType.Golden) if (note.EndBeat >= CBase.Game.GetCurrentBeatD() && note.Hit && note.NoteType == ENoteType.Golden)
{ {
SRectF re = new SRectF(rect); SRectF re = new SRectF(rect) {W = (CBase.Game.GetMidBeatD() - note.StartBeat) / beats * w};
re.W = (CBase.Game.GetMidBeatD() - note.StartBeat) / beats * w;
_AddFlare(re, n); _AddFlare(re, n);
} }
+16 -22
View File
@@ -217,17 +217,13 @@ namespace VocaluxeLib.Menu.SongMenu
public List<string> Language = new List<string>(); public List<string> Language = new List<string>();
// Notes // Notes
public CNotes Notes = new CNotes(); public readonly CNotes Notes = new CNotes();
public EGameMode[] AvailableGameModes public EGameMode[] AvailableGameModes
{ {
get get
{ {
List<EGameMode> gms = new List<EGameMode>(); List<EGameMode> gms = new List<EGameMode> {IsDuet ? EGameMode.TR_GAMEMODE_DUET : EGameMode.TR_GAMEMODE_NORMAL};
if (IsDuet)
gms.Add(EGameMode.TR_GAMEMODE_DUET);
else
gms.Add(EGameMode.TR_GAMEMODE_NORMAL);
if (Medley.Source != EMedleySource.None) if (Medley.Source != EMedleySource.None)
gms.Add(EGameMode.TR_GAMEMODE_MEDLEY); gms.Add(EGameMode.TR_GAMEMODE_MEDLEY);
gms.Add(EGameMode.TR_GAMEMODE_SHORTSONG); gms.Add(EGameMode.TR_GAMEMODE_SHORTSONG);
@@ -250,12 +246,14 @@ namespace VocaluxeLib.Menu.SongMenu
_CoverTextureSmall = song._CoverTextureSmall; _CoverTextureSmall = song._CoverTextureSmall;
_CoverTextureBig = song._CoverTextureBig; _CoverTextureBig = song._CoverTextureBig;
Medley = new SMedley(); Medley = new SMedley
Medley.Source = song.Medley.Source; {
Medley.StartBeat = song.Medley.StartBeat; Source = song.Medley.Source,
Medley.EndBeat = song.Medley.EndBeat; StartBeat = song.Medley.StartBeat,
Medley.FadeInTime = song.Medley.FadeInTime; EndBeat = song.Medley.EndBeat,
Medley.FadeOutTime = song.Medley.FadeOutTime; FadeInTime = song.Medley.FadeInTime,
FadeOutTime = song.Medley.FadeOutTime
};
CalculateMedley = song.CalculateMedley; CalculateMedley = song.CalculateMedley;
PreviewStart = song.PreviewStart; PreviewStart = song.PreviewStart;
@@ -806,8 +804,7 @@ namespace VocaluxeLib.Menu.SongMenu
private void _NewSentence(int player, int start) private void _NewSentence(int player, int start)
{ {
CLines lines = Notes.GetLines(player); CLines lines = Notes.GetLines(player);
CLine line = new CLine(); CLine line = new CLine {StartBeat = start};
line.StartBeat = start;
lines.AddLine(line); lines.AddLine(line);
} }
@@ -830,8 +827,8 @@ namespace VocaluxeLib.Menu.SongMenu
{ {
if (CoverFileName == "") if (CoverFileName == "")
{ {
List<string> files = CHelper.ListFiles(Folder, "*.jpg", false); List<string> files = CHelper.ListFiles(Folder, "*.jpg");
files.AddRange(CHelper.ListFiles(Folder, "*.png", false)); files.AddRange(CHelper.ListFiles(Folder, "*.png"));
foreach (String file in files) foreach (String file in files)
{ {
if (Regex.IsMatch(file, @".[CO].", RegexOptions.IgnoreCase) && if (Regex.IsMatch(file, @".[CO].", RegexOptions.IgnoreCase) &&
@@ -842,8 +839,8 @@ namespace VocaluxeLib.Menu.SongMenu
if (BackgroundFileName == "") if (BackgroundFileName == "")
{ {
List<string> files = CHelper.ListFiles(Folder, "*.jpg", false); List<string> files = CHelper.ListFiles(Folder, "*.jpg");
files.AddRange(CHelper.ListFiles(Folder, "*.png", false)); files.AddRange(CHelper.ListFiles(Folder, "*.png"));
foreach (String file in files) foreach (String file in files)
{ {
if (Regex.IsMatch(file, @".[BG].", RegexOptions.IgnoreCase) && if (Regex.IsMatch(file, @".[BG].", RegexOptions.IgnoreCase) &&
@@ -885,10 +882,7 @@ namespace VocaluxeLib.Menu.SongMenu
List<string> sentences = new List<string>(); List<string> sentences = new List<string>();
foreach (CLine line in lines.Line) foreach (CLine line in lines.Line)
{ {
if (line.Points != 0) sentences.Add(line.Points != 0 ? line.Lyrics : String.Empty);
sentences.Add(line.Lyrics);
else
sentences.Add(String.Empty);
} }
// find equal sentences series // find equal sentences series
+15 -12
View File
@@ -237,18 +237,21 @@ namespace VocaluxeLib.Menu.SongMenu
public CSongMenuFramework(int partyModeID) public CSongMenuFramework(int partyModeID)
{ {
_PartyModeID = partyModeID; _PartyModeID = partyModeID;
_Theme = new SThemeSongMenu(); _Theme = new SThemeSongMenu
{
_Theme.SongMenuTileBoard.TextArtist = new CText(_PartyModeID); SongMenuTileBoard =
_Theme.SongMenuTileBoard.TextTitle = new CText(_PartyModeID); {
_Theme.SongMenuTileBoard.TextSongLength = new CText(_PartyModeID); TextArtist = new CText(_PartyModeID),
TextTitle = new CText(_PartyModeID),
_Theme.SongMenuTileBoard.StaticCoverBig = new CStatic(_PartyModeID); TextSongLength = new CText(_PartyModeID),
_Theme.SongMenuTileBoard.StaticTextBG = new CStatic(_PartyModeID); StaticCoverBig = new CStatic(_PartyModeID),
_Theme.SongMenuTileBoard.StaticDuetIcon = new CStatic(_PartyModeID); StaticTextBG = new CStatic(_PartyModeID),
_Theme.SongMenuTileBoard.StaticVideoIcon = new CStatic(_PartyModeID); StaticDuetIcon = new CStatic(_PartyModeID),
_Theme.SongMenuTileBoard.StaticMedleyCalcIcon = new CStatic(_PartyModeID); StaticVideoIcon = new CStatic(_PartyModeID),
_Theme.SongMenuTileBoard.StaticMedleyTagIcon = new CStatic(_PartyModeID); StaticMedleyCalcIcon = new CStatic(_PartyModeID),
StaticMedleyTagIcon = new CStatic(_PartyModeID)
}
};
_ThemeLoaded = false; _ThemeLoaded = false;
} }
+2 -6
View File
@@ -26,16 +26,12 @@ namespace VocaluxeLib.PartyModes
public abstract class CPartyMode : IPartyMode public abstract class CPartyMode : IPartyMode
{ {
protected SScreenSongOptions _ScreenSongOptions; protected SScreenSongOptions _ScreenSongOptions;
protected Dictionary<string, CMenuParty> _Screens; protected readonly Dictionary<string, CMenuParty> _Screens;
protected string _Folder;
public CPartyMode() public CPartyMode()
{ {
_Screens = new Dictionary<string, CMenuParty>(); _Screens = new Dictionary<string, CMenuParty>();
_Folder = String.Empty; _ScreenSongOptions = new SScreenSongOptions {Selection = new SSelectionOptions(), Sorting = new SSortingOptions()};
_ScreenSongOptions = new SScreenSongOptions();
_ScreenSongOptions.Selection = new SSelectionOptions();
_ScreenSongOptions.Sorting = new SSortingOptions();
} }
#region Implementation #region Implementation