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