Split Notes, Lines and Voices into separate files/classes
This commit is contained in:
1 parent
84fc0fcb91
commit
44c78fad19
32 files changed
+884
-921
No files matched your search
@@ -21,7 +21,6 @@ using System;
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
using VocaluxeLib.Menu;
|
using VocaluxeLib.Menu;
|
||||||
using VocaluxeLib.Profile;
|
|
||||||
|
|
||||||
[assembly: ComVisible(false)]
|
[assembly: ComVisible(false)]
|
||||||
|
|
||||||
@@ -65,7 +64,7 @@ namespace VocaluxeLib.PartyModes.Challenge
|
|||||||
|
|
||||||
public int CompareTo(object obj)
|
public int CompareTo(object obj)
|
||||||
{
|
{
|
||||||
CResultTableRow row = obj as CResultTableRow;
|
var row = obj as CResultTableRow;
|
||||||
if (row != null)
|
if (row != null)
|
||||||
{
|
{
|
||||||
int res = row.NumGamePoints.CompareTo(NumGamePoints);
|
int res = row.NumGamePoints.CompareTo(NumGamePoints);
|
||||||
@@ -545,9 +544,7 @@ namespace VocaluxeLib.PartyModes.Challenge
|
|||||||
for (int i = 0; i < _GameData.NumPlayerAtOnce; i++)
|
for (int i = 0; i < _GameData.NumPlayerAtOnce; i++)
|
||||||
{
|
{
|
||||||
if (c != null)
|
if (c != null)
|
||||||
{
|
|
||||||
_ScreenSongOptions.Selection.TeamNames[i] = CBase.Profiles.GetPlayerName(_GameData.ProfileIDs[c.Player[i]]);
|
_ScreenSongOptions.Selection.TeamNames[i] = CBase.Profiles.GetPlayerName(_GameData.ProfileIDs[c.Player[i]]);
|
||||||
}
|
|
||||||
else
|
else
|
||||||
_ScreenSongOptions.Selection.TeamNames[i] = "foobar";
|
_ScreenSongOptions.Selection.TeamNames[i] = "foobar";
|
||||||
}
|
}
|
||||||
@@ -559,7 +556,7 @@ namespace VocaluxeLib.PartyModes.Challenge
|
|||||||
{
|
{
|
||||||
for (int i = 0; i < _GameData.NumPlayer; i++)
|
for (int i = 0; i < _GameData.NumPlayer; i++)
|
||||||
{
|
{
|
||||||
CResultTableRow row = new CResultTableRow {PlayerID = _GameData.ProfileIDs[i], NumPlayed = 0, NumWon = 0, NumSingPoints = 0, NumGamePoints = 0};
|
var row = new CResultTableRow {PlayerID = _GameData.ProfileIDs[i], NumPlayed = 0, NumWon = 0, NumSingPoints = 0, NumGamePoints = 0};
|
||||||
_GameData.ResultTable.Add(row);
|
_GameData.ResultTable.Add(row);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -627,10 +624,10 @@ namespace VocaluxeLib.PartyModes.Challenge
|
|||||||
|
|
||||||
private List<SStats> _GetPointsForPlayer(SPlayer[] results)
|
private List<SStats> _GetPointsForPlayer(SPlayer[] results)
|
||||||
{
|
{
|
||||||
List<SStats> result = new List<SStats>();
|
var result = new List<SStats>();
|
||||||
for (int i = 0; i < _GameData.NumPlayerAtOnce; i++)
|
for (int i = 0; i < _GameData.NumPlayerAtOnce; i++)
|
||||||
{
|
{
|
||||||
SStats stat = new SStats {ProfileID = results[i].ProfileID, SingPoints = (int)Math.Round(results[i].Points), Won = 0, GamePoints = 0};
|
var stat = new SStats {ProfileID = results[i].ProfileID, SingPoints = (int)Math.Round(results[i].Points), Won = 0, GamePoints = 0};
|
||||||
result.Add(stat);
|
result.Add(stat);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -21,7 +21,6 @@ using System;
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
using VocaluxeLib.Menu;
|
using VocaluxeLib.Menu;
|
||||||
using VocaluxeLib.Profile;
|
|
||||||
|
|
||||||
namespace VocaluxeLib.PartyModes.Challenge
|
namespace VocaluxeLib.PartyModes.Challenge
|
||||||
{
|
{
|
||||||
@@ -143,7 +142,7 @@ namespace VocaluxeLib.PartyModes.Challenge
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
SDataToScreenMain data = (SDataToScreenMain)receivedData;
|
var data = (SDataToScreenMain)receivedData;
|
||||||
_GameState = data;
|
_GameState = data;
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
@@ -405,7 +404,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 {TextPlayer = new List<CText>(), TextScores = new List<CText>()};
|
var rtr = new CRoundsTableRow {TextPlayer = new List<CText>(), TextScores = new List<CText>()};
|
||||||
_RoundsTable.Add(rtr);
|
_RoundsTable.Add(rtr);
|
||||||
}
|
}
|
||||||
//Create statics and texts for rounds
|
//Create statics and texts for rounds
|
||||||
@@ -457,7 +456,7 @@ namespace VocaluxeLib.PartyModes.Challenge
|
|||||||
//Round-number
|
//Round-number
|
||||||
roundRow.Number.X = numberX;
|
roundRow.Number.X = numberX;
|
||||||
roundRow.Number.Y = numberY;
|
roundRow.Number.Y = numberY;
|
||||||
int numInnerRows = (int)Math.Ceiling(_GameState.NumPlayerAtOnce / ((double)numPlayerInOneRow));
|
var numInnerRows = (int)Math.Ceiling(_GameState.NumPlayerAtOnce / ((double)numPlayerInOneRow));
|
||||||
for (int row = 0; row < numInnerRows; row++)
|
for (int row = 0; row < numInnerRows; row++)
|
||||||
{
|
{
|
||||||
int num = (row + 1) * numPlayerInOneRow;
|
int num = (row + 1) * numPlayerInOneRow;
|
||||||
@@ -541,7 +540,7 @@ namespace VocaluxeLib.PartyModes.Challenge
|
|||||||
|
|
||||||
for (int i = 0; i < 10; i++)
|
for (int i = 0; i < 10; i++)
|
||||||
{
|
{
|
||||||
STableRow row = new STableRow
|
var row = new STableRow
|
||||||
{
|
{
|
||||||
Pos = GetNewText(_Texts[_TextPosition]),
|
Pos = GetNewText(_Texts[_TextPosition]),
|
||||||
Name = GetNewText(_Texts[_TextPlayerName]),
|
Name = GetNewText(_Texts[_TextPlayerName]),
|
||||||
|
|||||||
@@ -22,6 +22,7 @@ using System.Collections.Generic;
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
using VocaluxeLib.Menu;
|
using VocaluxeLib.Menu;
|
||||||
|
using VocaluxeLib.Profile;
|
||||||
|
|
||||||
namespace VocaluxeLib.PartyModes.Challenge
|
namespace VocaluxeLib.PartyModes.Challenge
|
||||||
{
|
{
|
||||||
@@ -88,7 +89,7 @@ namespace VocaluxeLib.PartyModes.Challenge
|
|||||||
_ThemeButtons = new string[] {_ButtonBack, _ButtonNext, _ButtonPlayerDestination, _ButtonPlayerChoose};
|
_ThemeButtons = new string[] {_ButtonBack, _ButtonNext, _ButtonPlayerDestination, _ButtonPlayerChoose};
|
||||||
|
|
||||||
_Data = new SDataFromScreen();
|
_Data = new SDataFromScreen();
|
||||||
SFromScreenNames names = new SFromScreenNames {FadeBack = false, ProfileIDs = new List<int>()};
|
var names = new SFromScreenNames {FadeBack = false, ProfileIDs = new List<int>()};
|
||||||
_Data.ScreenNames = names;
|
_Data.ScreenNames = names;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -96,7 +97,7 @@ namespace VocaluxeLib.PartyModes.Challenge
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
SDataToScreenNames config = (SDataToScreenNames)receivedData;
|
var config = (SDataToScreenNames)receivedData;
|
||||||
_Data.ScreenNames.ProfileIDs = config.ProfileIDs ?? new List<int>();
|
_Data.ScreenNames.ProfileIDs = config.ProfileIDs ?? new List<int>();
|
||||||
|
|
||||||
_NumPlayer = config.NumPlayer;
|
_NumPlayer = config.NumPlayer;
|
||||||
@@ -247,7 +248,7 @@ namespace VocaluxeLib.PartyModes.Challenge
|
|||||||
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 {Button = b, ProfileID = -1};
|
var pcb = new CPlayerChooseButton {Button = b, ProfileID = -1};
|
||||||
_PlayerChooseButtons.Add(pcb);
|
_PlayerChooseButtons.Add(pcb);
|
||||||
column++;
|
column++;
|
||||||
if (column >= _PlayerChooseButtonsNumH)
|
if (column >= _PlayerChooseButtonsNumH)
|
||||||
@@ -309,15 +310,15 @@ namespace VocaluxeLib.PartyModes.Challenge
|
|||||||
private void _UpdateVisibleProfiles()
|
private void _UpdateVisibleProfiles()
|
||||||
{
|
{
|
||||||
_PlayerChooseButtonsVisibleProfiles.Clear();
|
_PlayerChooseButtonsVisibleProfiles.Clear();
|
||||||
Profile.CProfile[] profiles = CBase.Profiles.GetProfiles();
|
CProfile[] profiles = CBase.Profiles.GetProfiles();
|
||||||
for (int i = 0; i < profiles.Length; i++)
|
foreach (CProfile profile in profiles)
|
||||||
{
|
{
|
||||||
bool visible = false;
|
bool visible = false;
|
||||||
//Show profile only if active
|
//Show profile only if active
|
||||||
if (profiles[i].Active == EOffOn.TR_CONFIG_ON)
|
if (profile.Active == EOffOn.TR_CONFIG_ON)
|
||||||
visible = _Data.ScreenNames.ProfileIDs.All(profileID => profileID != profiles[i].ID);
|
visible = _Data.ScreenNames.ProfileIDs.All(profileID => profileID != profile.ID);
|
||||||
if (visible)
|
if (visible)
|
||||||
_PlayerChooseButtonsVisibleProfiles.Add(profiles[i].ID);
|
_PlayerChooseButtonsVisibleProfiles.Add(profile.ID);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -21,7 +21,6 @@ using System;
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
using VocaluxeLib.Menu;
|
using VocaluxeLib.Menu;
|
||||||
using VocaluxeLib.Profile;
|
|
||||||
|
|
||||||
namespace VocaluxeLib.PartyModes.ChallengeMedley
|
namespace VocaluxeLib.PartyModes.ChallengeMedley
|
||||||
{
|
{
|
||||||
@@ -143,7 +142,7 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
SDataToScreenMain data = (SDataToScreenMain)receivedData;
|
var data = (SDataToScreenMain)receivedData;
|
||||||
_GameState = data;
|
_GameState = data;
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
@@ -405,7 +404,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 {TextPlayer = new List<CText>(), TextScores = new List<CText>()};
|
var rtr = new CRoundsTableRow {TextPlayer = new List<CText>(), TextScores = new List<CText>()};
|
||||||
_RoundsTable.Add(rtr);
|
_RoundsTable.Add(rtr);
|
||||||
}
|
}
|
||||||
//Create statics and texts for rounds
|
//Create statics and texts for rounds
|
||||||
@@ -457,7 +456,7 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley
|
|||||||
//Round-number
|
//Round-number
|
||||||
roundRow.Number.X = numberX;
|
roundRow.Number.X = numberX;
|
||||||
roundRow.Number.Y = numberY;
|
roundRow.Number.Y = numberY;
|
||||||
int numInnerRows = (int)Math.Ceiling(_GameState.NumPlayerAtOnce / ((double)numPlayerInOneRow));
|
var numInnerRows = (int)Math.Ceiling(_GameState.NumPlayerAtOnce / ((double)numPlayerInOneRow));
|
||||||
for (int row = 0; row < numInnerRows; row++)
|
for (int row = 0; row < numInnerRows; row++)
|
||||||
{
|
{
|
||||||
int num = (row + 1) * numPlayerInOneRow;
|
int num = (row + 1) * numPlayerInOneRow;
|
||||||
@@ -541,7 +540,7 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley
|
|||||||
|
|
||||||
for (int i = 0; i < 10; i++)
|
for (int i = 0; i < 10; i++)
|
||||||
{
|
{
|
||||||
STableRow row = new STableRow
|
var row = new STableRow
|
||||||
{
|
{
|
||||||
Pos = GetNewText(_Texts[_TextPosition]),
|
Pos = GetNewText(_Texts[_TextPosition]),
|
||||||
Name = GetNewText(_Texts[_TextPlayerName]),
|
Name = GetNewText(_Texts[_TextPlayerName]),
|
||||||
|
|||||||
@@ -22,6 +22,7 @@ using System.Collections.Generic;
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
using VocaluxeLib.Menu;
|
using VocaluxeLib.Menu;
|
||||||
|
using VocaluxeLib.Profile;
|
||||||
|
|
||||||
namespace VocaluxeLib.PartyModes.ChallengeMedley
|
namespace VocaluxeLib.PartyModes.ChallengeMedley
|
||||||
{
|
{
|
||||||
@@ -85,10 +86,10 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley
|
|||||||
|
|
||||||
_Data.ScreenNames.ProfileIDs = new List<int>();
|
_Data.ScreenNames.ProfileIDs = new List<int>();
|
||||||
|
|
||||||
_ThemeButtons = new string[] { _ButtonBack, _ButtonNext, _ButtonPlayerDestination, _ButtonPlayerChoose };
|
_ThemeButtons = new string[] {_ButtonBack, _ButtonNext, _ButtonPlayerDestination, _ButtonPlayerChoose};
|
||||||
|
|
||||||
_Data = new SDataFromScreen();
|
_Data = new SDataFromScreen();
|
||||||
SFromScreenNames names = new SFromScreenNames { FadeToConfig = false, ProfileIDs = new List<int>() };
|
var names = new SFromScreenNames {FadeToConfig = false, ProfileIDs = new List<int>()};
|
||||||
_Data.ScreenNames = names;
|
_Data.ScreenNames = names;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -96,7 +97,7 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
SDataToScreenNames config = (SDataToScreenNames)receivedData;
|
var config = (SDataToScreenNames)receivedData;
|
||||||
_Data.ScreenNames.ProfileIDs = config.ProfileIDs ?? new List<int>();
|
_Data.ScreenNames.ProfileIDs = config.ProfileIDs ?? new List<int>();
|
||||||
|
|
||||||
_NumPlayer = config.NumPlayer;
|
_NumPlayer = config.NumPlayer;
|
||||||
@@ -114,7 +115,7 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley
|
|||||||
{
|
{
|
||||||
base.HandleInput(keyEvent);
|
base.HandleInput(keyEvent);
|
||||||
|
|
||||||
if (keyEvent.KeyPressed) { }
|
if (keyEvent.KeyPressed) {}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
switch (keyEvent.Key)
|
switch (keyEvent.Key)
|
||||||
@@ -156,7 +157,7 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley
|
|||||||
_OldMouseX = mouseEvent.X;
|
_OldMouseX = mouseEvent.X;
|
||||||
_OldMouseY = mouseEvent.Y;
|
_OldMouseY = mouseEvent.Y;
|
||||||
}
|
}
|
||||||
// LeftButton isn't hold anymore, but Selec-Mode is still active -> "Drop" of Avatar
|
// LeftButton isn't hold anymore, but Selec-Mode is still active -> "Drop" of Avatar
|
||||||
else if (_SelectingMouseActive)
|
else if (_SelectingMouseActive)
|
||||||
{
|
{
|
||||||
//Reset variables
|
//Reset variables
|
||||||
@@ -247,7 +248,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 { Button = b, ProfileID = -1 };
|
var pcb = new CPlayerChooseButton {Button = b, ProfileID = -1};
|
||||||
_PlayerChooseButtons.Add(pcb);
|
_PlayerChooseButtons.Add(pcb);
|
||||||
column++;
|
column++;
|
||||||
if (column >= _PlayerChooseButtonsNumH)
|
if (column >= _PlayerChooseButtonsNumH)
|
||||||
@@ -309,15 +310,15 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley
|
|||||||
private void _UpdateVisibleProfiles()
|
private void _UpdateVisibleProfiles()
|
||||||
{
|
{
|
||||||
_PlayerChooseButtonsVisibleProfiles.Clear();
|
_PlayerChooseButtonsVisibleProfiles.Clear();
|
||||||
Profile.CProfile[] profiles = CBase.Profiles.GetProfiles();
|
CProfile[] profiles = CBase.Profiles.GetProfiles();
|
||||||
for (int i = 0; i < profiles.Length; i++)
|
foreach (CProfile profile in profiles)
|
||||||
{
|
{
|
||||||
bool visible = false;
|
bool visible = false;
|
||||||
//Show profile only if active
|
//Show profile only if active
|
||||||
if (profiles[i].Active == EOffOn.TR_CONFIG_ON)
|
if (profile.Active == EOffOn.TR_CONFIG_ON)
|
||||||
visible = _Data.ScreenNames.ProfileIDs.All(profileID => profileID != profiles[i].ID);
|
visible = _Data.ScreenNames.ProfileIDs.All(profileID => profileID != profile.ID);
|
||||||
if (visible)
|
if (visible)
|
||||||
_PlayerChooseButtonsVisibleProfiles.Add(profiles[i].ID);
|
_PlayerChooseButtonsVisibleProfiles.Add(profile.ID);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -21,7 +21,6 @@ using System;
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
using VocaluxeLib.Menu;
|
using VocaluxeLib.Menu;
|
||||||
using VocaluxeLib.Profile;
|
|
||||||
|
|
||||||
[assembly: ComVisible(false)]
|
[assembly: ComVisible(false)]
|
||||||
|
|
||||||
@@ -248,7 +247,7 @@ namespace VocaluxeLib.PartyModes.TicTacToe
|
|||||||
|
|
||||||
public override void DataFromScreen(string screenName, Object data)
|
public override void DataFromScreen(string screenName, Object data)
|
||||||
{
|
{
|
||||||
SDataFromScreen dataFrom = new SDataFromScreen();
|
var dataFrom = new SDataFromScreen();
|
||||||
switch (screenName)
|
switch (screenName)
|
||||||
{
|
{
|
||||||
case "PartyScreenTicTacToeConfig":
|
case "PartyScreenTicTacToeConfig":
|
||||||
@@ -492,7 +491,7 @@ namespace VocaluxeLib.PartyModes.TicTacToe
|
|||||||
|
|
||||||
public override void SongSelected(int songID)
|
public override void SongSelected(int songID)
|
||||||
{
|
{
|
||||||
EGameMode gm = EGameMode.TR_GAMEMODE_NORMAL;
|
var gm = EGameMode.TR_GAMEMODE_NORMAL;
|
||||||
|
|
||||||
switch (_GameData.GameMode)
|
switch (_GameData.GameMode)
|
||||||
{
|
{
|
||||||
@@ -525,7 +524,7 @@ namespace VocaluxeLib.PartyModes.TicTacToe
|
|||||||
_GameData.Rounds = new List<CRound>();
|
_GameData.Rounds = new List<CRound>();
|
||||||
for (int i = 0; i < _GameData.NumFields; i++)
|
for (int i = 0; i < _GameData.NumFields; i++)
|
||||||
{
|
{
|
||||||
CRound r = new CRound();
|
var r = new CRound();
|
||||||
_GameData.Rounds.Add(r);
|
_GameData.Rounds.Add(r);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -540,11 +539,11 @@ namespace VocaluxeLib.PartyModes.TicTacToe
|
|||||||
_GameData.PlayerTeam2 = new List<int>();
|
_GameData.PlayerTeam2 = new List<int>();
|
||||||
|
|
||||||
//Prepare Player-IDs
|
//Prepare Player-IDs
|
||||||
List<int> ids1 = new List<int>();
|
var ids1 = new List<int>();
|
||||||
List<int> ids2 = new List<int>();
|
var ids2 = new List<int>();
|
||||||
//Add IDs to team-list
|
//Add IDs to team-list
|
||||||
while (_GameData.PlayerTeam1.Count < _GameData.NumFields + _GameData.NumJokerRetry[0] &&
|
while (_GameData.PlayerTeam1.Count < _GameData.NumFields + _GameData.NumJokerRetry[0] &&
|
||||||
_GameData.PlayerTeam2.Count < _GameData.NumFields + _GameData.NumJokerRetry[1] )
|
_GameData.PlayerTeam2.Count < _GameData.NumFields + _GameData.NumJokerRetry[1])
|
||||||
{
|
{
|
||||||
if (ids1.Count == 0)
|
if (ids1.Count == 0)
|
||||||
{
|
{
|
||||||
@@ -579,7 +578,7 @@ namespace VocaluxeLib.PartyModes.TicTacToe
|
|||||||
case 1:
|
case 1:
|
||||||
{
|
{
|
||||||
//Prepare Player-IDs
|
//Prepare Player-IDs
|
||||||
List<int> ids = new List<int>();
|
var ids = new List<int>();
|
||||||
//Add IDs to team-list
|
//Add IDs to team-list
|
||||||
while (_GameData.PlayerTeam1.Count < _GameData.NumFields + _GameData.NumJokerRetry[0] && ids.Count == 0)
|
while (_GameData.PlayerTeam1.Count < _GameData.NumFields + _GameData.NumJokerRetry[0] && ids.Count == 0)
|
||||||
{
|
{
|
||||||
@@ -602,7 +601,7 @@ namespace VocaluxeLib.PartyModes.TicTacToe
|
|||||||
case 2:
|
case 2:
|
||||||
{
|
{
|
||||||
//Prepare Player-IDs
|
//Prepare Player-IDs
|
||||||
List<int> ids = new List<int>();
|
var ids = new List<int>();
|
||||||
//Add IDs to team-list
|
//Add IDs to team-list
|
||||||
while (_GameData.PlayerTeam2.Count < _GameData.NumFields + _GameData.NumJokerRetry[1] && ids.Count == 0)
|
while (_GameData.PlayerTeam2.Count < _GameData.NumFields + _GameData.NumJokerRetry[1] && ids.Count == 0)
|
||||||
{
|
{
|
||||||
@@ -627,7 +626,7 @@ namespace VocaluxeLib.PartyModes.TicTacToe
|
|||||||
|
|
||||||
private void _PrepareSongList()
|
private void _PrepareSongList()
|
||||||
{
|
{
|
||||||
EGameMode gm = EGameMode.TR_GAMEMODE_NORMAL;
|
var gm = EGameMode.TR_GAMEMODE_NORMAL;
|
||||||
|
|
||||||
switch (_GameData.GameMode)
|
switch (_GameData.GameMode)
|
||||||
{
|
{
|
||||||
@@ -646,7 +645,7 @@ namespace VocaluxeLib.PartyModes.TicTacToe
|
|||||||
|
|
||||||
while (_GameData.Songs.Count < (_GameData.NumFields + _GameData.NumJokerRandom[0] + _GameData.NumJokerRandom[1]))
|
while (_GameData.Songs.Count < (_GameData.NumFields + _GameData.NumJokerRandom[0] + _GameData.NumJokerRandom[1]))
|
||||||
{
|
{
|
||||||
List<int> songs = new List<int>();
|
var songs = new List<int>();
|
||||||
switch (_GameData.SongSource)
|
switch (_GameData.SongSource)
|
||||||
{
|
{
|
||||||
case ESongSource.TR_PLAYLIST:
|
case ESongSource.TR_PLAYLIST:
|
||||||
@@ -741,11 +740,11 @@ namespace VocaluxeLib.PartyModes.TicTacToe
|
|||||||
{
|
{
|
||||||
players[0].ProfileID = _GameData.ProfileIDsTeam1[r.SingerTeam1];
|
players[0].ProfileID = _GameData.ProfileIDsTeam1[r.SingerTeam1];
|
||||||
if (isDuet)
|
if (isDuet)
|
||||||
players[0].LineNr = 0;
|
players[0].VoiceNr = 0;
|
||||||
|
|
||||||
players[1].ProfileID = _GameData.ProfileIDsTeam2[r.SingerTeam2];
|
players[1].ProfileID = _GameData.ProfileIDsTeam2[r.SingerTeam2];
|
||||||
if (isDuet)
|
if (isDuet)
|
||||||
players[1].LineNr = 1;
|
players[1].VoiceNr = 1;
|
||||||
|
|
||||||
SongSelected(r.SongID);
|
SongSelected(r.SongID);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -22,7 +22,6 @@ using System.Collections.Generic;
|
|||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
using VocaluxeLib.Menu;
|
using VocaluxeLib.Menu;
|
||||||
using VocaluxeLib.Songs;
|
using VocaluxeLib.Songs;
|
||||||
using VocaluxeLib.Profile;
|
|
||||||
|
|
||||||
namespace VocaluxeLib.PartyModes.TicTacToe
|
namespace VocaluxeLib.PartyModes.TicTacToe
|
||||||
{
|
{
|
||||||
@@ -104,7 +103,7 @@ namespace VocaluxeLib.PartyModes.TicTacToe
|
|||||||
_ThemeStatics = new string[] {_StaticPopupBG, _StaticAvatarT1, _StaticAvatarT2};
|
_ThemeStatics = new string[] {_StaticPopupBG, _StaticAvatarT1, _StaticAvatarT2};
|
||||||
|
|
||||||
_Data = new SDataFromScreen();
|
_Data = new SDataFromScreen();
|
||||||
SFromScreenMain config = new SFromScreenMain();
|
var config = new SFromScreenMain();
|
||||||
_GameData = new SDataToScreenMain();
|
_GameData = new SDataToScreenMain();
|
||||||
config.SingRoundNr = 1;
|
config.SingRoundNr = 1;
|
||||||
config.Rounds = new List<CRound>();
|
config.Rounds = new List<CRound>();
|
||||||
@@ -130,7 +129,7 @@ namespace VocaluxeLib.PartyModes.TicTacToe
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
SDataToScreenMain config = (SDataToScreenMain)receivedData;
|
var config = (SDataToScreenMain)receivedData;
|
||||||
_GameData = config;
|
_GameData = config;
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
@@ -389,7 +388,7 @@ namespace VocaluxeLib.PartyModes.TicTacToe
|
|||||||
{
|
{
|
||||||
for (int i = 0; i < 25; i++)
|
for (int i = 0; i < 25; i++)
|
||||||
{
|
{
|
||||||
CField f = new CField {Button = GetNewButton(_Buttons[_ButtonField])};
|
var f = new CField {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);
|
||||||
@@ -399,7 +398,7 @@ namespace VocaluxeLib.PartyModes.TicTacToe
|
|||||||
|
|
||||||
private void _UpdateFields()
|
private void _UpdateFields()
|
||||||
{
|
{
|
||||||
int numOneRow = (int)Math.Sqrt(_GameData.NumFields);
|
var numOneRow = (int)Math.Sqrt(_GameData.NumFields);
|
||||||
float fieldSizeY = ((float)CBase.Settings.GetRenderH() - 150 - numOneRow * _FieldSpace) / numOneRow;
|
float fieldSizeY = ((float)CBase.Settings.GetRenderH() - 150 - numOneRow * _FieldSpace) / numOneRow;
|
||||||
float fieldSizeX = ((float)CBase.Settings.GetRenderW() - 300 - numOneRow * _FieldSpace) / numOneRow;
|
float fieldSizeX = ((float)CBase.Settings.GetRenderW() - 300 - numOneRow * _FieldSpace) / numOneRow;
|
||||||
_FieldSize = Math.Min(fieldSizeX, fieldSizeY);
|
_FieldSize = Math.Min(fieldSizeX, fieldSizeY);
|
||||||
@@ -495,7 +494,6 @@ namespace VocaluxeLib.PartyModes.TicTacToe
|
|||||||
_GameData.Rounds[_SelectedField].SingerTeam2 = singerTeam2;
|
_GameData.Rounds[_SelectedField].SingerTeam2 = singerTeam2;
|
||||||
|
|
||||||
_UpdatePlayerInformation();
|
_UpdatePlayerInformation();
|
||||||
|
|
||||||
}
|
}
|
||||||
int songID = 0;
|
int songID = 0;
|
||||||
if (_GameData.Songs.Count > 0)
|
if (_GameData.Songs.Count > 0)
|
||||||
@@ -672,7 +670,7 @@ namespace VocaluxeLib.PartyModes.TicTacToe
|
|||||||
|
|
||||||
private int _BuildWinnerPossibilities()
|
private int _BuildWinnerPossibilities()
|
||||||
{
|
{
|
||||||
int numOneRow = (int)Math.Sqrt(_GameData.NumFields);
|
var numOneRow = (int)Math.Sqrt(_GameData.NumFields);
|
||||||
_Possibilities = new int[(numOneRow * 2) + 2,numOneRow];
|
_Possibilities = new int[(numOneRow * 2) + 2,numOneRow];
|
||||||
for (int i = 0; i < _Possibilities.GetLength(0); i++)
|
for (int i = 0; i < _Possibilities.GetLength(0); i++)
|
||||||
{
|
{
|
||||||
@@ -704,7 +702,7 @@ namespace VocaluxeLib.PartyModes.TicTacToe
|
|||||||
{
|
{
|
||||||
for (int i = 0; i < _Possibilities.GetLength(0); i++)
|
for (int i = 0; i < _Possibilities.GetLength(0); i++)
|
||||||
{
|
{
|
||||||
List<int> check = new List<int>();
|
var check = new List<int>();
|
||||||
for (int j = 0; j < _Possibilities.GetLength(1); j++)
|
for (int j = 0; j < _Possibilities.GetLength(1); j++)
|
||||||
{
|
{
|
||||||
if (_Fields[_Possibilities[i, j]].Content.Winner > 0)
|
if (_Fields[_Possibilities[i, j]].Content.Winner > 0)
|
||||||
|
|||||||
@@ -22,6 +22,7 @@ using System.Collections.Generic;
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
using VocaluxeLib.Menu;
|
using VocaluxeLib.Menu;
|
||||||
|
using VocaluxeLib.Profile;
|
||||||
|
|
||||||
namespace VocaluxeLib.PartyModes.TicTacToe
|
namespace VocaluxeLib.PartyModes.TicTacToe
|
||||||
{
|
{
|
||||||
@@ -93,7 +94,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 {FadeToConfig = false, ProfileIDsTeam1 = new List<int>(), ProfileIDsTeam2 = new List<int>()};
|
var names = new SFromScreenNames {FadeToConfig = false, ProfileIDsTeam1 = new List<int>(), ProfileIDsTeam2 = new List<int>()};
|
||||||
_Data.ScreenNames = names;
|
_Data.ScreenNames = names;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -101,7 +102,7 @@ namespace VocaluxeLib.PartyModes.TicTacToe
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
SDataToScreenNames config = (SDataToScreenNames)receivedData;
|
var config = (SDataToScreenNames)receivedData;
|
||||||
_Data.ScreenNames.ProfileIDsTeam1 = config.ProfileIDsTeam1;
|
_Data.ScreenNames.ProfileIDsTeam1 = config.ProfileIDsTeam1;
|
||||||
_Data.ScreenNames.ProfileIDsTeam2 = config.ProfileIDsTeam2;
|
_Data.ScreenNames.ProfileIDsTeam2 = config.ProfileIDsTeam2;
|
||||||
if (_Data.ScreenNames.ProfileIDsTeam1 == null)
|
if (_Data.ScreenNames.ProfileIDsTeam1 == null)
|
||||||
@@ -375,7 +376,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 {Button = b, ProfileID = -1};
|
var pcb = new CPlayerChooseButton {Button = b, ProfileID = -1};
|
||||||
_PlayerChooseButtons.Add(pcb);
|
_PlayerChooseButtons.Add(pcb);
|
||||||
column++;
|
column++;
|
||||||
if (column >= _PlayerChooseButtonsNumH)
|
if (column >= _PlayerChooseButtonsNumH)
|
||||||
@@ -440,15 +441,16 @@ namespace VocaluxeLib.PartyModes.TicTacToe
|
|||||||
private void _UpdateVisibleProfiles()
|
private void _UpdateVisibleProfiles()
|
||||||
{
|
{
|
||||||
_PlayerChooseButtonsVisibleProfiles.Clear();
|
_PlayerChooseButtonsVisibleProfiles.Clear();
|
||||||
Profile.CProfile[] profiles = CBase.Profiles.GetProfiles();
|
CProfile[] profiles = CBase.Profiles.GetProfiles();
|
||||||
for (int i = 0; i < profiles.Length; i++)
|
foreach (CProfile profile in profiles)
|
||||||
{
|
{
|
||||||
bool visible = false;
|
bool visible = false;
|
||||||
//Show profile only if active
|
//Show profile only if active
|
||||||
if (profiles[i].Active == EOffOn.TR_CONFIG_ON)
|
if (profile.Active == EOffOn.TR_CONFIG_ON)
|
||||||
visible = _Data.ScreenNames.ProfileIDsTeam1.All(profileID => profileID != profiles[i].ID) && _Data.ScreenNames.ProfileIDsTeam2.All(profileID => profileID != profiles[i].ID);
|
visible = _Data.ScreenNames.ProfileIDsTeam1.All(profileID => profileID != profile.ID) &&
|
||||||
|
_Data.ScreenNames.ProfileIDsTeam2.All(profileID => profileID != profile.ID);
|
||||||
if (visible)
|
if (visible)
|
||||||
_PlayerChooseButtonsVisibleProfiles.Add(profiles[i].ID);
|
_PlayerChooseButtonsVisibleProfiles.Add(profile.ID);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -114,7 +114,7 @@ namespace Vocaluxe.Base
|
|||||||
using (SQLiteCommand command = new SQLiteCommand(connection))
|
using (SQLiteCommand command = new SQLiteCommand(connection))
|
||||||
{
|
{
|
||||||
int dataBaseSongID = _GetDataBaseSongID(player, command);
|
int dataBaseSongID = _GetDataBaseSongID(player, command);
|
||||||
return _AddScore(CProfiles.GetPlayerName(player.ProfileID), (int)Math.Round(player.Points), player.LineNr, player.DateTicks, player.Medley ? 1 : 0,
|
return _AddScore(CProfiles.GetPlayerName(player.ProfileID), (int)Math.Round(player.Points), player.VoiceNr, player.DateTicks, player.Medley ? 1 : 0,
|
||||||
player.Duet ? 1 : 0, player.ShortSong ? 1 : 0, (int)CProfiles.GetDifficulty(player.ProfileID), dataBaseSongID, command);
|
player.Duet ? 1 : 0, player.ShortSong ? 1 : 0, (int)CProfiles.GetDifficulty(player.ProfileID), dataBaseSongID, command);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+78
-79
@@ -172,9 +172,9 @@ namespace Vocaluxe.Base
|
|||||||
Players[i].Points = 0f;
|
Players[i].Points = 0f;
|
||||||
Players[i].PointsLineBonus = 0f;
|
Players[i].PointsLineBonus = 0f;
|
||||||
Players[i].PointsGoldenNotes = 0f;
|
Players[i].PointsGoldenNotes = 0f;
|
||||||
Players[i].LineNr = 0;
|
Players[i].VoiceNr = 0;
|
||||||
Players[i].NoteDiff = 0;
|
Players[i].NoteDiff = 0;
|
||||||
Players[i].SingLine = new List<CLine>();
|
Players[i].SungLines = new List<CSungLine>();
|
||||||
Players[i].CurrentLine = -1;
|
Players[i].CurrentLine = -1;
|
||||||
Players[i].CurrentNote = -1;
|
Players[i].CurrentNote = -1;
|
||||||
Players[i].SongID = -1;
|
Players[i].SongID = -1;
|
||||||
@@ -221,7 +221,7 @@ namespace Vocaluxe.Base
|
|||||||
(_SongQueue.GetCurrentGameMode() == EGameMode.TR_GAMEMODE_SHORTSONG && song.ShortEnd == beat))
|
(_SongQueue.GetCurrentGameMode() == EGameMode.TR_GAMEMODE_SHORTSONG && song.ShortEnd == beat))
|
||||||
Players[p].SongFinished = true;
|
Players[p].SongFinished = true;
|
||||||
|
|
||||||
CLine[] lines = song.Notes.GetVoice(Players[p].LineNr).Lines;
|
CSongLine[] lines = song.Notes.GetVoice(Players[p].VoiceNr).Lines;
|
||||||
int line = -1;
|
int line = -1;
|
||||||
|
|
||||||
for (int j = 0; j < lines.Length; j++)
|
for (int j = 0; j < lines.Length; j++)
|
||||||
@@ -240,103 +240,102 @@ namespace Vocaluxe.Base
|
|||||||
|
|
||||||
Players[p].CurrentLine = line;
|
Players[p].CurrentLine = line;
|
||||||
|
|
||||||
while (Players[p].SingLine.Count <= line)
|
while (Players[p].SungLines.Count <= line)
|
||||||
Players[p].SingLine.Add(new CLine());
|
Players[p].SungLines.Add(new CSungLine());
|
||||||
|
|
||||||
CNote[] notes = lines[line].Notes;
|
CSongNote[] notes = lines[line].Notes;
|
||||||
int note = lines[line].FindPreviousNote(beat);
|
int note = lines[line].FindPreviousNote(beat);
|
||||||
if (note >= 0 && notes[note].EndBeat < beat)
|
if (note >= 0 && notes[note].EndBeat < beat)
|
||||||
note = -1;
|
note = -1;
|
||||||
|
|
||||||
if (note >= 0)
|
if (note < 0)
|
||||||
|
continue;
|
||||||
|
Players[p].CurrentNote = note;
|
||||||
|
|
||||||
|
if (line == lines.Length - 1)
|
||||||
{
|
{
|
||||||
Players[p].CurrentNote = note;
|
if (note == lines[line].NoteCount - 1)
|
||||||
|
|
||||||
if (line == lines.Length - 1)
|
|
||||||
{
|
{
|
||||||
if (note == lines[line].NoteCount - 1)
|
if (notes[note].EndBeat == beat)
|
||||||
{
|
Players[p].SongFinished = true;
|
||||||
if (notes[note].EndBeat == beat)
|
|
||||||
Players[p].SongFinished = true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (notes[note].PointsForBeat > 0 && CSound.RecordToneValid(p))
|
if (notes[note].PointsForBeat > 0 && CSound.RecordToneValid(p))
|
||||||
|
{
|
||||||
|
int tone = notes[note].Tone;
|
||||||
|
int tonePlayer = CSound.RecordGetTone(p);
|
||||||
|
|
||||||
|
while (tonePlayer - tone > 6)
|
||||||
|
tonePlayer -= 12;
|
||||||
|
|
||||||
|
while (tonePlayer - tone < -6)
|
||||||
|
tonePlayer += 12;
|
||||||
|
|
||||||
|
Players[p].NoteDiff = Math.Abs(tone - tonePlayer);
|
||||||
|
bool hit = Players[p].NoteDiff <= (2 - (int)CProfiles.GetDifficulty(Players[p].ProfileID));
|
||||||
|
if (hit)
|
||||||
{
|
{
|
||||||
int tone = notes[note].Tone;
|
// valid
|
||||||
int tonePlayer = CSound.RecordGetTone(p);
|
//CSound.RecordSetTone(p, Tone);
|
||||||
|
double points = (CSettings.MaxScore - CSettings.LinebonusScore) * (double)notes[note].PointsForBeat /
|
||||||
|
song.Notes.GetVoice(Players[p].VoiceNr).Points;
|
||||||
|
if (notes[note].NoteType == ENoteType.Golden)
|
||||||
|
Players[p].PointsGoldenNotes += points;
|
||||||
|
|
||||||
while (tonePlayer - tone > 6)
|
Players[p].Points += points;
|
||||||
tonePlayer -= 12;
|
|
||||||
|
|
||||||
while (tonePlayer - tone < -6)
|
// update player notes (sung notes)
|
||||||
tonePlayer += 12;
|
if (Players[p].SungLines[line].NoteCount > 0)
|
||||||
|
|
||||||
Players[p].NoteDiff = Math.Abs(tone - tonePlayer);
|
|
||||||
bool hit = Players[p].NoteDiff <= (2 - (int)CProfiles.GetDifficulty(Players[p].ProfileID));
|
|
||||||
if (hit)
|
|
||||||
{
|
{
|
||||||
// valid
|
CSungNote lastNote = Players[p].SungLines[line].LastNote;
|
||||||
//CSound.RecordSetTone(p, Tone);
|
if (notes[note].StartBeat == beat || lastNote.EndBeat + 1 != beat || lastNote.Tone != tone || !lastNote.Hit)
|
||||||
double points = (CSettings.MaxScore - CSettings.LinebonusScore) * (double)notes[note].PointsForBeat /
|
Players[p].SungLines[line].AddNote(new CSungNote(beat, 1, tone, notes[note]));
|
||||||
song.Notes.GetVoice(Players[p].LineNr).Points;
|
|
||||||
if (notes[note].NoteType == ENoteType.Golden)
|
|
||||||
Players[p].PointsGoldenNotes += points;
|
|
||||||
|
|
||||||
Players[p].Points += points;
|
|
||||||
|
|
||||||
// update player notes (sung notes)
|
|
||||||
if (Players[p].SingLine[line].NoteCount > 0)
|
|
||||||
{
|
|
||||||
CNote lastNote = Players[p].SingLine[line].LastNote;
|
|
||||||
if (notes[note].StartBeat == beat || lastNote.EndBeat + 1 != beat || lastNote.Tone != tone || !lastNote.Hit)
|
|
||||||
Players[p].SingLine[line].AddNote(new CNote(beat, 1, tone, String.Empty, true, notes[note].NoteType));
|
|
||||||
else
|
|
||||||
Players[p].SingLine[line].IncLastNoteLength();
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
Players[p].SingLine[line].AddNote(new CNote(beat, 1, tone, String.Empty, true, notes[note].NoteType));
|
Players[p].SungLines[line].IncLastNoteLength();
|
||||||
|
|
||||||
Players[p].SingLine[line].LastNote.IsPerfect(notes[note]);
|
|
||||||
Players[p].SingLine[line].IsPerfect(lines[line]);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
Players[p].SungLines[line].AddNote(new CSungNote(beat, 1, tone, notes[note]));
|
||||||
if (Players[p].SingLine[line].NoteCount > 0)
|
|
||||||
{
|
Players[p].SungLines[line].LastNote.CheckPerfect();
|
||||||
CNote lastNote = Players[p].SingLine[line].LastNote;
|
Players[p].SungLines[line].IsPerfect(lines[line]);
|
||||||
if (lastNote.Tone == tonePlayer && lastNote.EndBeat + 1 == beat && !lastNote.Hit)
|
|
||||||
Players[p].SingLine[line].IncLastNoteLength();
|
|
||||||
else
|
|
||||||
Players[p].SingLine[line].AddNote(new CNote(beat, 1, tonePlayer, String.Empty, false, ENoteType.Freestyle));
|
|
||||||
}
|
|
||||||
else
|
|
||||||
Players[p].SingLine[line].AddNote(new CNote(beat, 1, tonePlayer, String.Empty, false, ENoteType.Freestyle));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
else
|
||||||
// Line Bonus
|
|
||||||
int numLinesWithPoints = song.Notes.GetNumLinesWithPoints(Players[p].LineNr);
|
|
||||||
if (note == lines[line].NoteCount - 1 && numLinesWithPoints > 0)
|
|
||||||
{
|
{
|
||||||
if (notes[note].EndBeat == beat && lines[line].Points > 0f)
|
if (Players[p].SungLines[line].NoteCount > 0)
|
||||||
{
|
{
|
||||||
double factor = Players[p].SingLine[line].Points / (double)lines[line].Points;
|
CSungNote lastNote = Players[p].SungLines[line].LastNote;
|
||||||
if (factor < 0.4)
|
if (lastNote.Tone != tonePlayer || lastNote.EndBeat + 1 != beat || lastNote.Hit)
|
||||||
factor = 0.0;
|
Players[p].SungLines[line].AddNote(new CSungNote(beat, 1, tonePlayer));
|
||||||
else if (factor > 0.9)
|
|
||||||
factor = 1.0;
|
|
||||||
else
|
else
|
||||||
{
|
Players[p].SungLines[line].IncLastNoteLength();
|
||||||
factor -= 0.4;
|
|
||||||
factor *= 2;
|
|
||||||
factor *= factor;
|
|
||||||
}
|
|
||||||
|
|
||||||
double points = CSettings.LinebonusScore * factor * 1f / numLinesWithPoints;
|
|
||||||
Players[p].Points += points;
|
|
||||||
Players[p].PointsLineBonus += points;
|
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
Players[p].SungLines[line].AddNote(new CSungNote(beat, 1, tonePlayer));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Line Bonus
|
||||||
|
int numLinesWithPoints = song.Notes.GetNumLinesWithPoints(Players[p].VoiceNr);
|
||||||
|
if (note == lines[line].NoteCount - 1 && numLinesWithPoints > 0)
|
||||||
|
{
|
||||||
|
if (notes[note].EndBeat == beat && lines[line].Points > 0f)
|
||||||
|
{
|
||||||
|
double factor = Players[p].SungLines[line].Points / (double)lines[line].Points;
|
||||||
|
if (factor < 0.4)
|
||||||
|
factor = 0.0;
|
||||||
|
else if (factor > 0.9)
|
||||||
|
factor = 1.0;
|
||||||
|
else
|
||||||
|
{
|
||||||
|
factor -= 0.4;
|
||||||
|
factor *= 2;
|
||||||
|
factor *= factor;
|
||||||
|
}
|
||||||
|
|
||||||
|
double points = CSettings.LinebonusScore * factor * 1f / numLinesWithPoints;
|
||||||
|
Players[p].Points += points;
|
||||||
|
Players[p].PointsLineBonus += points;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,10 +1,7 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Security.Cryptography;
|
using System.Security.Cryptography;
|
||||||
|
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
|
|
||||||
namespace Vocaluxe.Base.Server
|
namespace Vocaluxe.Base.Server
|
||||||
@@ -25,7 +22,6 @@ namespace Vocaluxe.Base.Server
|
|||||||
public const int ResponseLoginFailed = 22;
|
public const int ResponseLoginFailed = 22;
|
||||||
public const int ResponseLoginOK = 23;
|
public const int ResponseLoginOK = 23;
|
||||||
|
|
||||||
|
|
||||||
public const int CommandSendKeyStroke = 100;
|
public const int CommandSendKeyStroke = 100;
|
||||||
public const int CommandSendKeyUp = 110;
|
public const int CommandSendKeyUp = 110;
|
||||||
public const int CommandSendKeyDown = 111;
|
public const int CommandSendKeyDown = 111;
|
||||||
@@ -45,7 +41,6 @@ namespace Vocaluxe.Base.Server
|
|||||||
public const int CommandSendAvatarPictureJpg = 501;
|
public const int CommandSendAvatarPictureJpg = 501;
|
||||||
|
|
||||||
public const int CommandSendProfile = 510;
|
public const int CommandSendProfile = 510;
|
||||||
|
|
||||||
#endregion Commands
|
#endregion Commands
|
||||||
|
|
||||||
#region General
|
#region General
|
||||||
@@ -58,7 +53,7 @@ namespace Vocaluxe.Base.Server
|
|||||||
#region Login
|
#region Login
|
||||||
public static byte[] CreateCommandLogin(string Password)
|
public static byte[] CreateCommandLogin(string Password)
|
||||||
{
|
{
|
||||||
SLoginData data = new SLoginData();
|
var data = new SLoginData();
|
||||||
data.SHA256 = SHA256.ComputeHash(Encoding.UTF8.GetBytes(Password));
|
data.SHA256 = SHA256.ComputeHash(Encoding.UTF8.GetBytes(Password));
|
||||||
|
|
||||||
return Serialize<SLoginData>(CommandLogin, data);
|
return Serialize<SLoginData>(CommandLogin, data);
|
||||||
@@ -71,13 +66,12 @@ namespace Vocaluxe.Base.Server
|
|||||||
#endregion Login
|
#endregion Login
|
||||||
|
|
||||||
#region Keyboard
|
#region Keyboard
|
||||||
|
|
||||||
#endregion Keyboard
|
#endregion Keyboard
|
||||||
|
|
||||||
#region Profiles
|
#region Profiles
|
||||||
public static byte[] CreateCommandSendAvatarPicture(int Width, int Height, byte[] data)
|
public static byte[] CreateCommandSendAvatarPicture(int Width, int Height, byte[] data)
|
||||||
{
|
{
|
||||||
SAvatarPicture ap = new SAvatarPicture();
|
var ap = new SAvatarPicture();
|
||||||
ap.Height = Height;
|
ap.Height = Height;
|
||||||
ap.Width = Width;
|
ap.Width = Width;
|
||||||
ap.data = new byte[data.Length];
|
ap.data = new byte[data.Length];
|
||||||
@@ -93,7 +87,7 @@ namespace Vocaluxe.Base.Server
|
|||||||
|
|
||||||
public static byte[] CreateCommandSendAvatarPictureJpg(byte[] AvatarJpgData)
|
public static byte[] CreateCommandSendAvatarPictureJpg(byte[] AvatarJpgData)
|
||||||
{
|
{
|
||||||
SAvatarPicture ap = new SAvatarPicture();
|
var ap = new SAvatarPicture();
|
||||||
ap.Height = 0;
|
ap.Height = 0;
|
||||||
ap.Width = 0;
|
ap.Width = 0;
|
||||||
ap.data = new byte[AvatarJpgData.Length];
|
ap.data = new byte[AvatarJpgData.Length];
|
||||||
@@ -104,13 +98,13 @@ namespace Vocaluxe.Base.Server
|
|||||||
|
|
||||||
public static byte[] CreateCommandSendProfile(byte[] AvatarJpgData, string PlayerName, int Difficulty)
|
public static byte[] CreateCommandSendProfile(byte[] AvatarJpgData, string PlayerName, int Difficulty)
|
||||||
{
|
{
|
||||||
SAvatarPicture ap = new SAvatarPicture();
|
var ap = new SAvatarPicture();
|
||||||
ap.Height = 0;
|
ap.Height = 0;
|
||||||
ap.Width = 0;
|
ap.Width = 0;
|
||||||
ap.data = new byte[AvatarJpgData.Length];
|
ap.data = new byte[AvatarJpgData.Length];
|
||||||
Array.Copy(AvatarJpgData, ap.data, AvatarJpgData.Length);
|
Array.Copy(AvatarJpgData, ap.data, AvatarJpgData.Length);
|
||||||
|
|
||||||
SProfile profile = new SProfile();
|
var profile = new SProfile();
|
||||||
profile.Avatar = ap;
|
profile.Avatar = ap;
|
||||||
profile.PlayerName = PlayerName;
|
profile.PlayerName = PlayerName;
|
||||||
profile.Difficulty = Difficulty;
|
profile.Difficulty = Difficulty;
|
||||||
@@ -122,7 +116,6 @@ namespace Vocaluxe.Base.Server
|
|||||||
{
|
{
|
||||||
return TryDeserialize<SProfile>(Message, out Profile);
|
return TryDeserialize<SProfile>(Message, out Profile);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion Profiles
|
#endregion Profiles
|
||||||
|
|
||||||
#region Serializing
|
#region Serializing
|
||||||
@@ -130,11 +123,11 @@ namespace Vocaluxe.Base.Server
|
|||||||
{
|
{
|
||||||
byte[] command = BitConverter.GetBytes(Command);
|
byte[] command = BitConverter.GetBytes(Command);
|
||||||
|
|
||||||
MemoryStream stream = new MemoryStream();
|
var stream = new MemoryStream();
|
||||||
stream.Write(command, 0, command.Length);
|
stream.Write(command, 0, command.Length);
|
||||||
|
|
||||||
byte[] data;
|
byte[] data;
|
||||||
using (MemoryStream ms = new MemoryStream())
|
using (var ms = new MemoryStream())
|
||||||
{
|
{
|
||||||
string json = JsonConvert.SerializeObject(obj);
|
string json = JsonConvert.SerializeObject(obj);
|
||||||
data = encoder.GetBytes(json);
|
data = encoder.GetBytes(json);
|
||||||
@@ -153,9 +146,9 @@ namespace Vocaluxe.Base.Server
|
|||||||
if (message.Length < 5)
|
if (message.Length < 5)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
byte[] data = new byte[message.Length - 4];
|
var data = new byte[message.Length - 4];
|
||||||
Array.Copy(message, 4, data, 0, data.Length);
|
Array.Copy(message, 4, data, 0, data.Length);
|
||||||
using (MemoryStream ms = new MemoryStream(data))
|
using (var ms = new MemoryStream(data))
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -22,9 +22,7 @@ using System.Collections.Generic;
|
|||||||
using System.Drawing;
|
using System.Drawing;
|
||||||
using System.Drawing.Imaging;
|
using System.Drawing.Imaging;
|
||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
using System.Linq;
|
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Text;
|
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
using ClientServerLib;
|
using ClientServerLib;
|
||||||
using Vocaluxe.Lib.Input;
|
using Vocaluxe.Lib.Input;
|
||||||
@@ -84,7 +82,7 @@ namespace Vocaluxe.Base.Server
|
|||||||
{
|
{
|
||||||
if (!_Clients.ContainsKey(connectionID))
|
if (!_Clients.ContainsKey(connectionID))
|
||||||
{
|
{
|
||||||
CClientHandler client = new CClientHandler(connectionID);
|
var client = new CClientHandler(connectionID);
|
||||||
_Clients.Add(connectionID, client);
|
_Clients.Add(connectionID, client);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -120,7 +118,7 @@ namespace Vocaluxe.Base.Server
|
|||||||
SAvatarPicture avatarPicture;
|
SAvatarPicture avatarPicture;
|
||||||
if (CCommands.DecodeCommandSendAvatarPicture(message, out avatarPicture))
|
if (CCommands.DecodeCommandSendAvatarPicture(message, out avatarPicture))
|
||||||
{
|
{
|
||||||
using (Bitmap bmp = new Bitmap(avatarPicture.Width, avatarPicture.Height))
|
using (var bmp = new Bitmap(avatarPicture.Width, avatarPicture.Height))
|
||||||
{
|
{
|
||||||
BitmapData bmpData = bmp.LockBits(new Rectangle(0, 0, bmp.Width, bmp.Height), ImageLockMode.WriteOnly, PixelFormat.Format32bppArgb);
|
BitmapData bmpData = bmp.LockBits(new Rectangle(0, 0, bmp.Width, bmp.Height), ImageLockMode.WriteOnly, PixelFormat.Format32bppArgb);
|
||||||
Marshal.Copy(avatarPicture.data, 0, bmpData.Scan0, avatarPicture.data.Length);
|
Marshal.Copy(avatarPicture.data, 0, bmpData.Scan0, avatarPicture.data.Length);
|
||||||
@@ -156,7 +154,7 @@ namespace Vocaluxe.Base.Server
|
|||||||
string avatarFilename = _AddAvatar(profile.Avatar.data);
|
string avatarFilename = _AddAvatar(profile.Avatar.data);
|
||||||
if (avatarFilename != String.Empty)
|
if (avatarFilename != String.Empty)
|
||||||
{
|
{
|
||||||
CProfile p = new CProfile
|
var p = new CProfile
|
||||||
{
|
{
|
||||||
Active = EOffOn.TR_CONFIG_ON,
|
Active = EOffOn.TR_CONFIG_ON,
|
||||||
AvatarFileName = avatarFilename,
|
AvatarFileName = avatarFilename,
|
||||||
@@ -193,7 +191,7 @@ namespace Vocaluxe.Base.Server
|
|||||||
fs.Flush();
|
fs.Flush();
|
||||||
fs.Close();
|
fs.Close();
|
||||||
|
|
||||||
CAvatar avatar = new CAvatar(-1);
|
var avatar = new CAvatar(-1);
|
||||||
if (avatar.LoadFromFile(filename))
|
if (avatar.LoadFromFile(filename))
|
||||||
{
|
{
|
||||||
CProfiles.AddAvatar(avatar);
|
CProfiles.AddAvatar(avatar);
|
||||||
|
|||||||
@@ -1,6 +1,4 @@
|
|||||||
using System;
|
namespace Vocaluxe.Base.Server
|
||||||
|
|
||||||
namespace Vocaluxe.Base.Server
|
|
||||||
{
|
{
|
||||||
public struct SLoginData
|
public struct SLoginData
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -24,7 +24,6 @@ using Vocaluxe.Base;
|
|||||||
using VocaluxeLib;
|
using VocaluxeLib;
|
||||||
using VocaluxeLib.Draw;
|
using VocaluxeLib.Draw;
|
||||||
using VocaluxeLib.Menu;
|
using VocaluxeLib.Menu;
|
||||||
using VocaluxeLib.Profile;
|
|
||||||
|
|
||||||
namespace Vocaluxe.Screens
|
namespace Vocaluxe.Screens
|
||||||
{
|
{
|
||||||
@@ -71,14 +70,14 @@ namespace Vocaluxe.Screens
|
|||||||
{
|
{
|
||||||
base.Init();
|
base.Init();
|
||||||
|
|
||||||
List<string> statics = new List<string>();
|
var statics = new List<string>();
|
||||||
statics.AddRange(_StaticPlayerAvatar);
|
statics.AddRange(_StaticPlayerAvatar);
|
||||||
statics.AddRange(_StaticPlayer);
|
statics.AddRange(_StaticPlayer);
|
||||||
statics.Add(_StaticWarningMics);
|
statics.Add(_StaticWarningMics);
|
||||||
statics.Add(_StaticWarningProfiles);
|
statics.Add(_StaticWarningProfiles);
|
||||||
_ThemeStatics = statics.ToArray();
|
_ThemeStatics = statics.ToArray();
|
||||||
|
|
||||||
List<string> texts = new List<string> {_SelectSlidePlayerNumber};
|
var texts = new List<string> {_SelectSlidePlayerNumber};
|
||||||
texts.AddRange(_SelectSlideDuetPlayer);
|
texts.AddRange(_SelectSlideDuetPlayer);
|
||||||
_ThemeSelectSlides = texts.ToArray();
|
_ThemeSelectSlides = texts.ToArray();
|
||||||
|
|
||||||
@@ -411,13 +410,9 @@ namespace Vocaluxe.Screens
|
|||||||
if (CHelper.IsInBounds(_Statics[_StaticPlayer[i]].Rect, mouseEvent))
|
if (CHelper.IsInBounds(_Statics[_StaticPlayer[i]].Rect, mouseEvent))
|
||||||
{
|
{
|
||||||
if (_SelectingSwitchNr > -1 && CGame.Players[i].ProfileID > -1)
|
if (_SelectingSwitchNr > -1 && CGame.Players[i].ProfileID > -1)
|
||||||
{
|
|
||||||
_UpdateSelectedProfile(_SelectingSwitchNr, CGame.Players[i].ProfileID);
|
_UpdateSelectedProfile(_SelectingSwitchNr, CGame.Players[i].ProfileID);
|
||||||
}
|
|
||||||
else if (_SelectingSwitchNr > -1)
|
else if (_SelectingSwitchNr > -1)
|
||||||
{
|
|
||||||
_ResetPlayerSelection(_SelectingSwitchNr);
|
_ResetPlayerSelection(_SelectingSwitchNr);
|
||||||
}
|
|
||||||
|
|
||||||
if (!CProfiles.IsProfileIDValid(_SelectedProfileID))
|
if (!CProfiles.IsProfileIDValid(_SelectedProfileID))
|
||||||
return true;
|
return true;
|
||||||
@@ -427,9 +422,7 @@ namespace Vocaluxe.Screens
|
|||||||
}
|
}
|
||||||
//Selected player is dropped out of area
|
//Selected player is dropped out of area
|
||||||
if (_SelectingSwitchNr > -1)
|
if (_SelectingSwitchNr > -1)
|
||||||
{
|
|
||||||
_ResetPlayerSelection(_SelectingSwitchNr);
|
_ResetPlayerSelection(_SelectingSwitchNr);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
_SelectingSwitchNr = -1;
|
_SelectingSwitchNr = -1;
|
||||||
_SelectedProfileID = -1;
|
_SelectedProfileID = -1;
|
||||||
@@ -633,7 +626,7 @@ namespace Vocaluxe.Screens
|
|||||||
for (int i = 0; i < CGame.NumPlayer; i++)
|
for (int i = 0; i < CGame.NumPlayer; i++)
|
||||||
{
|
{
|
||||||
if (CGame.GetNumSongs() == 1 && CGame.GetSong(1).IsDuet)
|
if (CGame.GetNumSongs() == 1 && CGame.GetSong(1).IsDuet)
|
||||||
CGame.Players[i].LineNr = _SelectSlides[_SelectSlideDuetPlayer[i]].Selection;
|
CGame.Players[i].VoiceNr = _SelectSlides[_SelectSlideDuetPlayer[i]].Selection;
|
||||||
}
|
}
|
||||||
|
|
||||||
CGraphics.FadeTo(EScreens.ScreenSing);
|
CGraphics.FadeTo(EScreens.ScreenSing);
|
||||||
@@ -726,7 +719,7 @@ namespace Vocaluxe.Screens
|
|||||||
|
|
||||||
private void _CheckMics()
|
private void _CheckMics()
|
||||||
{
|
{
|
||||||
List<int> playerWithoutMicro = new List<int>();
|
var playerWithoutMicro = new List<int>();
|
||||||
for (int player = 0; player < CConfig.NumPlayer; player++)
|
for (int player = 0; player < CConfig.NumPlayer; player++)
|
||||||
{
|
{
|
||||||
if (!CConfig.IsMicConfig(player + 1))
|
if (!CConfig.IsMicConfig(player + 1))
|
||||||
@@ -764,7 +757,7 @@ namespace Vocaluxe.Screens
|
|||||||
|
|
||||||
private void _CheckPlayers()
|
private void _CheckPlayers()
|
||||||
{
|
{
|
||||||
List<int> playerWithoutProfile = new List<int>();
|
var playerWithoutProfile = new List<int>();
|
||||||
for (int player = 0; player < CConfig.NumPlayer; player++)
|
for (int player = 0; player < CConfig.NumPlayer; player++)
|
||||||
{
|
{
|
||||||
if (CGame.Players[player].ProfileID < 0)
|
if (CGame.Players[player].ProfileID < 0)
|
||||||
|
|||||||
@@ -296,9 +296,9 @@ namespace Vocaluxe.Screens
|
|||||||
string name = CProfiles.GetPlayerName(players[p].ProfileID, p);
|
string name = CProfiles.GetPlayerName(players[p].ProfileID, p);
|
||||||
if (song != null && song.IsDuet)
|
if (song != null && song.IsDuet)
|
||||||
{
|
{
|
||||||
if (players[p].LineNr == 0 && song.DuetPart1 != "Part 1")
|
if (players[p].VoiceNr == 0 && song.DuetPart1 != "Part 1")
|
||||||
name += " (" + song.DuetPart1 + ")";
|
name += " (" + song.DuetPart1 + ")";
|
||||||
else if (players[p].LineNr == 1 && song.DuetPart2 != "Part 2")
|
else if (players[p].VoiceNr == 1 && song.DuetPart2 != "Part 2")
|
||||||
name += " (" + song.DuetPart2 + ")";
|
name += " (" + song.DuetPart2 + ")";
|
||||||
}
|
}
|
||||||
_Texts[_TextNames[p, CGame.NumPlayer - 1]].Text = name;
|
_Texts[_TextNames[p, CGame.NumPlayer - 1]].Text = name;
|
||||||
|
|||||||
@@ -125,11 +125,11 @@ namespace Vocaluxe.Screens
|
|||||||
{
|
{
|
||||||
base.Init();
|
base.Init();
|
||||||
|
|
||||||
List<string> texts = new List<string> {_TextSongName, _TextTime, _TextPause, _TextDuetName1, _TextDuetName2, _TextMedleyCountdown};
|
var texts = new List<string> {_TextSongName, _TextTime, _TextPause, _TextDuetName1, _TextDuetName2, _TextMedleyCountdown};
|
||||||
_BuildTextStrings(texts);
|
_BuildTextStrings(texts);
|
||||||
_ThemeTexts = texts.ToArray();
|
_ThemeTexts = texts.ToArray();
|
||||||
|
|
||||||
List<string> statics = new List<string>
|
var statics = new List<string>
|
||||||
{
|
{
|
||||||
_StaticSongText,
|
_StaticSongText,
|
||||||
_StaticLyrics,
|
_StaticLyrics,
|
||||||
@@ -148,7 +148,7 @@ namespace Vocaluxe.Screens
|
|||||||
_BuildStaticStrings(ref statics);
|
_BuildStaticStrings(ref statics);
|
||||||
_ThemeStatics = statics.ToArray();
|
_ThemeStatics = statics.ToArray();
|
||||||
|
|
||||||
List<string> buttons = new List<string> {_ButtonCancel, _ButtonContinue, _ButtonSkip};
|
var buttons = new List<string> {_ButtonCancel, _ButtonContinue, _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};
|
||||||
@@ -202,7 +202,7 @@ namespace Vocaluxe.Screens
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case Keys.T:
|
case Keys.T:
|
||||||
int mode = (int)CConfig.TimerMode;
|
var mode = (int)CConfig.TimerMode;
|
||||||
|
|
||||||
mode++;
|
mode++;
|
||||||
if (mode > Enum.GetNames(typeof(ETimerMode)).Length - 1)
|
if (mode > Enum.GetNames(typeof(ETimerMode)).Length - 1)
|
||||||
@@ -355,18 +355,18 @@ namespace Vocaluxe.Screens
|
|||||||
|
|
||||||
for (int p = 0; p < CGame.NumPlayer; p++)
|
for (int p = 0; p < CGame.NumPlayer; p++)
|
||||||
{
|
{
|
||||||
_SingNotes[_SingBars].SetAlpha(_NoteLines[p], alpha[CGame.Players[p].LineNr * 2]);
|
_SingNotes[_SingBars].SetAlpha(_NoteLines[p], alpha[CGame.Players[p].VoiceNr * 2]);
|
||||||
if (CConfig.FadePlayerInfo == EFadePlayerInfo.TR_CONFIG_FADEPLAYERINFO_INFO || CConfig.FadePlayerInfo == EFadePlayerInfo.TR_CONFIG_FADEPLAYERINFO_ALL)
|
if (CConfig.FadePlayerInfo == EFadePlayerInfo.TR_CONFIG_FADEPLAYERINFO_INFO || CConfig.FadePlayerInfo == EFadePlayerInfo.TR_CONFIG_FADEPLAYERINFO_ALL)
|
||||||
{
|
{
|
||||||
_Statics[_StaticAvatars[p, CGame.NumPlayer - 1]].Alpha = alpha[CGame.Players[p].LineNr * 2];
|
_Statics[_StaticAvatars[p, CGame.NumPlayer - 1]].Alpha = alpha[CGame.Players[p].VoiceNr * 2];
|
||||||
_Texts[_TextNames[p, CGame.NumPlayer - 1]].Alpha = alpha[CGame.Players[p].LineNr * 2];
|
_Texts[_TextNames[p, CGame.NumPlayer - 1]].Alpha = alpha[CGame.Players[p].VoiceNr * 2];
|
||||||
}
|
}
|
||||||
if (CConfig.FadePlayerInfo == EFadePlayerInfo.TR_CONFIG_FADEPLAYERINFO_ALL)
|
if (CConfig.FadePlayerInfo == EFadePlayerInfo.TR_CONFIG_FADEPLAYERINFO_ALL)
|
||||||
{
|
{
|
||||||
_Statics[_StaticScores[p, CGame.NumPlayer - 1]].Alpha = alpha[CGame.Players[p].LineNr * 2];
|
_Statics[_StaticScores[p, CGame.NumPlayer - 1]].Alpha = alpha[CGame.Players[p].VoiceNr * 2];
|
||||||
_Statics[_StaticAvatars[p, CGame.NumPlayer - 1]].Alpha = alpha[CGame.Players[p].LineNr * 2];
|
_Statics[_StaticAvatars[p, CGame.NumPlayer - 1]].Alpha = alpha[CGame.Players[p].VoiceNr * 2];
|
||||||
_Texts[_TextNames[p, CGame.NumPlayer - 1]].Alpha = alpha[CGame.Players[p].LineNr * 2];
|
_Texts[_TextNames[p, CGame.NumPlayer - 1]].Alpha = alpha[CGame.Players[p].VoiceNr * 2];
|
||||||
_Texts[_TextScores[p, CGame.NumPlayer - 1]].Alpha = alpha[CGame.Players[p].LineNr * 2];
|
_Texts[_TextScores[p, CGame.NumPlayer - 1]].Alpha = alpha[CGame.Players[p].VoiceNr * 2];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -459,7 +459,7 @@ namespace Vocaluxe.Screens
|
|||||||
if (_Active)
|
if (_Active)
|
||||||
{
|
{
|
||||||
CTexture background;
|
CTexture background;
|
||||||
EAspect aspect = EAspect.Crop;
|
var aspect = EAspect.Crop;
|
||||||
if (_CurrentVideo != -1 && CConfig.VideosInSongs == EOffOn.TR_CONFIG_ON && !_Webcam)
|
if (_CurrentVideo != -1 && CConfig.VideosInSongs == EOffOn.TR_CONFIG_ON && !_Webcam)
|
||||||
{
|
{
|
||||||
background = _CurrentVideoTexture;
|
background = _CurrentVideoTexture;
|
||||||
@@ -474,7 +474,7 @@ namespace Vocaluxe.Screens
|
|||||||
background = _Background;
|
background = _Background;
|
||||||
if (background != null)
|
if (background != null)
|
||||||
{
|
{
|
||||||
RectangleF bounds = new RectangleF(0, 0, CSettings.RenderW, CSettings.RenderH);
|
var bounds = new RectangleF(0, 0, CSettings.RenderW, CSettings.RenderH);
|
||||||
RectangleF rect;
|
RectangleF rect;
|
||||||
CHelper.SetRect(bounds, out rect, background.OrigAspect, aspect);
|
CHelper.SetRect(bounds, out rect, background.OrigAspect, aspect);
|
||||||
CDraw.DrawTexture(background, new SRectF(rect.X, rect.Y, rect.Width, rect.Height, 0f),
|
CDraw.DrawTexture(background, new SRectF(rect.X, rect.Y, rect.Width, rect.Height, 0f),
|
||||||
@@ -512,7 +512,7 @@ namespace Vocaluxe.Screens
|
|||||||
|
|
||||||
|
|
||||||
for (int i = 0; i < CGame.NumPlayer; i++)
|
for (int i = 0; i < CGame.NumPlayer; i++)
|
||||||
_SingNotes[_SingBars].Draw(_NoteLines[i], CGame.Players[i].SingLine, i);
|
_SingNotes[_SingBars].Draw(_NoteLines[i], CGame.Players[i].SungLines, i);
|
||||||
|
|
||||||
_DrawLyricHelper();
|
_DrawLyricHelper();
|
||||||
|
|
||||||
@@ -607,12 +607,12 @@ namespace Vocaluxe.Screens
|
|||||||
_FinishTime = song.Finish;
|
_FinishTime = song.Finish;
|
||||||
_TimeToFirstNote = 0f;
|
_TimeToFirstNote = 0f;
|
||||||
_TimeToFirstNoteDuet = 0f;
|
_TimeToFirstNoteDuet = 0f;
|
||||||
int[] duetPlayer = new int[CGame.NumPlayer];
|
var duetPlayer = new int[CGame.NumPlayer];
|
||||||
if (song.IsDuet)
|
if (song.IsDuet)
|
||||||
{
|
{
|
||||||
//Save duet-assignment before resetting
|
//Save duet-assignment before resetting
|
||||||
for (int i = 0; i < duetPlayer.Length; i++)
|
for (int i = 0; i < duetPlayer.Length; i++)
|
||||||
duetPlayer[i] = CGame.Players[i].LineNr;
|
duetPlayer[i] = CGame.Players[i].VoiceNr;
|
||||||
}
|
}
|
||||||
CGame.ResetPlayer();
|
CGame.ResetPlayer();
|
||||||
|
|
||||||
@@ -641,12 +641,12 @@ namespace Vocaluxe.Screens
|
|||||||
if (CGame.GetNumSongs() > 1)
|
if (CGame.GetNumSongs() > 1)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < CGame.NumPlayer; i++)
|
for (int i = 0; i < CGame.NumPlayer; i++)
|
||||||
CGame.Players[i].LineNr = (i + 1) % 2;
|
CGame.Players[i].VoiceNr = (i + 1) % 2;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
for (int i = 0; i < CGame.NumPlayer; i++)
|
for (int i = 0; i < CGame.NumPlayer; i++)
|
||||||
CGame.Players[i].LineNr = duetPlayer[i];
|
CGame.Players[i].VoiceNr = duetPlayer[i];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -745,7 +745,7 @@ namespace Vocaluxe.Screens
|
|||||||
CWebcam.Close();
|
CWebcam.Close();
|
||||||
}
|
}
|
||||||
|
|
||||||
private int _FindCurrentLine(CVoice voice, CLine[] lines, CSong song)
|
private int _FindCurrentLine(CVoice voice, CSongLine[] lines, CSong song)
|
||||||
{
|
{
|
||||||
float currentTime = _CurrentTime - song.Gap;
|
float currentTime = _CurrentTime - song.Gap;
|
||||||
//We are only interested in the last matching line, so either do not check further after line[j].StartBeat > _CurrentBeat or go backwards!
|
//We are only interested in the last matching line, so either do not check further after line[j].StartBeat > _CurrentBeat or go backwards!
|
||||||
@@ -787,7 +787,7 @@ namespace Vocaluxe.Screens
|
|||||||
break; // for later
|
break; // for later
|
||||||
|
|
||||||
CVoice voice = song.Notes.GetVoice(i);
|
CVoice voice = song.Notes.GetVoice(i);
|
||||||
CLine[] lines = voice.Lines;
|
CSongLine[] lines = voice.Lines;
|
||||||
|
|
||||||
// find current line
|
// find current line
|
||||||
int nr = _FindCurrentLine(voice, lines, song);
|
int nr = _FindCurrentLine(voice, lines, song);
|
||||||
@@ -796,7 +796,7 @@ namespace Vocaluxe.Screens
|
|||||||
{
|
{
|
||||||
for (int j = 0; j < CGame.NumPlayer; j++)
|
for (int j = 0; j < CGame.NumPlayer; j++)
|
||||||
{
|
{
|
||||||
if (CGame.Players[j].LineNr == i)
|
if (CGame.Players[j].VoiceNr == i)
|
||||||
_SingNotes[_SingBars].SetLines(_NoteLines[j], lines, nr);
|
_SingNotes[_SingBars].SetLines(_NoteLines[j], lines, nr);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -980,7 +980,7 @@ namespace Vocaluxe.Screens
|
|||||||
if (_CurrentTime < timeToFirstMedleyNote)
|
if (_CurrentTime < timeToFirstMedleyNote)
|
||||||
{
|
{
|
||||||
float timeDiff = timeToFirstMedleyNote - _CurrentTime + 1;
|
float timeDiff = timeToFirstMedleyNote - _CurrentTime + 1;
|
||||||
float fullSeconds = (float)Math.Truncate(timeDiff);
|
var fullSeconds = (float)Math.Truncate(timeDiff);
|
||||||
float partSeconds = timeDiff - fullSeconds;
|
float partSeconds = timeDiff - fullSeconds;
|
||||||
_Texts[_TextMedleyCountdown].Visible = true;
|
_Texts[_TextMedleyCountdown].Visible = true;
|
||||||
_Texts[_TextMedleyCountdown].Text = fullSeconds.ToString();
|
_Texts[_TextMedleyCountdown].Text = fullSeconds.ToString();
|
||||||
@@ -1025,7 +1025,7 @@ namespace Vocaluxe.Screens
|
|||||||
if (_Statics[_StaticLyrics].Visible)
|
if (_Statics[_StaticLyrics].Visible)
|
||||||
{
|
{
|
||||||
SRectF rect = _Statics[_StaticLyricHelper].Rect;
|
SRectF rect = _Statics[_StaticLyricHelper].Rect;
|
||||||
SColorF color = new SColorF(
|
var color = new SColorF(
|
||||||
_Statics[_StaticLyricHelper].Color.R,
|
_Statics[_StaticLyricHelper].Color.R,
|
||||||
_Statics[_StaticLyricHelper].Color.G,
|
_Statics[_StaticLyricHelper].Color.G,
|
||||||
_Statics[_StaticLyricHelper].Color.B,
|
_Statics[_StaticLyricHelper].Color.B,
|
||||||
@@ -1039,7 +1039,7 @@ namespace Vocaluxe.Screens
|
|||||||
if (_Statics[_StaticLyricsTop].Visible)
|
if (_Statics[_StaticLyricsTop].Visible)
|
||||||
{
|
{
|
||||||
SRectF rect = _Statics[_StaticLyricHelperTop].Rect;
|
SRectF rect = _Statics[_StaticLyricHelperTop].Rect;
|
||||||
SColorF color = new SColorF(
|
var color = new SColorF(
|
||||||
_Statics[_StaticLyricHelperTop].Color.R,
|
_Statics[_StaticLyricHelperTop].Color.R,
|
||||||
_Statics[_StaticLyricHelperTop].Color.G,
|
_Statics[_StaticLyricHelperTop].Color.G,
|
||||||
_Statics[_StaticLyricHelperTop].Color.B,
|
_Statics[_StaticLyricHelperTop].Color.B,
|
||||||
@@ -1066,7 +1066,7 @@ namespace Vocaluxe.Screens
|
|||||||
|
|
||||||
SRectF rect = _Statics[_StaticLyricHelperDuet].Rect;
|
SRectF rect = _Statics[_StaticLyricHelperDuet].Rect;
|
||||||
|
|
||||||
SColorF color = new SColorF(
|
var color = new SColorF(
|
||||||
_Statics[_StaticLyricHelperDuet].Color.R,
|
_Statics[_StaticLyricHelperDuet].Color.R,
|
||||||
_Statics[_StaticLyricHelperDuet].Color.G,
|
_Statics[_StaticLyricHelperDuet].Color.G,
|
||||||
_Statics[_StaticLyricHelperDuet].Color.B,
|
_Statics[_StaticLyricHelperDuet].Color.B,
|
||||||
@@ -1089,13 +1089,13 @@ namespace Vocaluxe.Screens
|
|||||||
if (song == null || !song.NotesLoaded)
|
if (song == null || !song.NotesLoaded)
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
float[] alpha = new float[song.Notes.Voices.Length * 2];
|
var alpha = new float[song.Notes.Voices.Length * 2];
|
||||||
float currentTime = _CurrentTime - song.Gap;
|
float currentTime = _CurrentTime - song.Gap;
|
||||||
|
|
||||||
for (int i = 0; i < song.Notes.LinesCount; i++)
|
for (int i = 0; i < song.Notes.LinesCount; i++)
|
||||||
{
|
{
|
||||||
CVoice voice = song.Notes.GetVoice(i);
|
CVoice voice = song.Notes.GetVoice(i);
|
||||||
CLine[] lines = voice.Lines;
|
CSongLine[] lines = voice.Lines;
|
||||||
|
|
||||||
// find current line for lyric sub fading
|
// find current line for lyric sub fading
|
||||||
int currentLineSub = _FindCurrentLine(voice, lines, song);
|
int currentLineSub = _FindCurrentLine(voice, lines, song);
|
||||||
@@ -1292,8 +1292,8 @@ namespace Vocaluxe.Screens
|
|||||||
switch (CConfig.TimerMode)
|
switch (CConfig.TimerMode)
|
||||||
{
|
{
|
||||||
case ETimerMode.TR_CONFIG_TIMERMODE_CURRENT:
|
case ETimerMode.TR_CONFIG_TIMERMODE_CURRENT:
|
||||||
int min = (int)Math.Floor(currentTime / 60f);
|
var min = (int)Math.Floor(currentTime / 60f);
|
||||||
int sec = (int)(currentTime - min * 60f);
|
var sec = (int)(currentTime - min * 60f);
|
||||||
_Texts[_TextTime].Text = min.ToString("00") + ":" + sec.ToString("00");
|
_Texts[_TextTime].Text = min.ToString("00") + ":" + sec.ToString("00");
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@@ -1368,9 +1368,9 @@ namespace Vocaluxe.Screens
|
|||||||
|
|
||||||
foreach (CVoice voice in song.Notes.Voices)
|
foreach (CVoice voice in song.Notes.Voices)
|
||||||
{
|
{
|
||||||
foreach (CLine line in voice.Lines.Where(line => line.VisibleInTimeLine))
|
foreach (CSongLine line in voice.Lines.Where(line => line.VisibleInTimeLine))
|
||||||
{
|
{
|
||||||
STimeRect trect = new STimeRect {StartBeat = line.FirstNoteBeat, EndBeat = line.EndBeat};
|
var trect = new STimeRect {StartBeat = line.FirstNoteBeat, EndBeat = line.EndBeat};
|
||||||
trect.Rect = GetNewStatic(null,
|
trect.Rect = GetNewStatic(null,
|
||||||
new SColorF(1f, 1f, 1f, 1f),
|
new SColorF(1f, 1f, 1f, 1f),
|
||||||
new SRectF(
|
new SRectF(
|
||||||
|
|||||||
@@ -51,7 +51,7 @@ namespace VocaluxeLib.Game
|
|||||||
for (int player = 0; player < players.Length; player++)
|
for (int player = 0; player < players.Length; player++)
|
||||||
{
|
{
|
||||||
_Rounds[round, player].SongID = songID;
|
_Rounds[round, player].SongID = songID;
|
||||||
_Rounds[round, player].LineNr = players[player].LineNr;
|
_Rounds[round, player].VoiceNr = players[player].VoiceNr;
|
||||||
_Rounds[round, player].Points = players[player].Points;
|
_Rounds[round, player].Points = players[player].Points;
|
||||||
_Rounds[round, player].PointsGoldenNotes = players[player].PointsGoldenNotes;
|
_Rounds[round, player].PointsGoldenNotes = players[player].PointsGoldenNotes;
|
||||||
_Rounds[round, player].PointsLineBonus = players[player].PointsLineBonus;
|
_Rounds[round, player].PointsLineBonus = players[player].PointsLineBonus;
|
||||||
@@ -88,7 +88,7 @@ namespace VocaluxeLib.Game
|
|||||||
players[p].PointsGoldenNotes = _Rounds[round, p].PointsGoldenNotes;
|
players[p].PointsGoldenNotes = _Rounds[round, p].PointsGoldenNotes;
|
||||||
players[p].PointsLineBonus = _Rounds[round, p].PointsLineBonus;
|
players[p].PointsLineBonus = _Rounds[round, p].PointsLineBonus;
|
||||||
players[p].SongID = _Rounds[round, p].SongID;
|
players[p].SongID = _Rounds[round, p].SongID;
|
||||||
players[p].LineNr = _Rounds[round, p].LineNr;
|
players[p].VoiceNr = _Rounds[round, p].VoiceNr;
|
||||||
players[p].Medley = _Rounds[round, p].Medley;
|
players[p].Medley = _Rounds[round, p].Medley;
|
||||||
players[p].Duet = _Rounds[round, p].Duet;
|
players[p].Duet = _Rounds[round, p].Duet;
|
||||||
players[p].ShortSong = _Rounds[round, p].ShortSong;
|
players[p].ShortSong = _Rounds[round, p].ShortSong;
|
||||||
|
|||||||
@@ -201,12 +201,12 @@ namespace VocaluxeLib.Menu
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SetLine(CLine line)
|
public void SetLine(CSongLine line)
|
||||||
{
|
{
|
||||||
_Notes.Clear();
|
_Notes.Clear();
|
||||||
|
|
||||||
_Width = 0f;
|
_Width = 0f;
|
||||||
foreach (CNote note in line.Notes)
|
foreach (CSongNote note in line.Notes)
|
||||||
{
|
{
|
||||||
SNote n = new SNote {Text = note.Text, StartBeat = note.StartBeat, EndBeat = note.EndBeat, Duration = note.Duration, Type = note.NoteType};
|
SNote n = new SNote {Text = note.Text, StartBeat = note.StartBeat, EndBeat = note.EndBeat, Duration = note.Duration, Type = note.NoteType};
|
||||||
|
|
||||||
|
|||||||
@@ -487,10 +487,10 @@ namespace VocaluxeLib.Menu
|
|||||||
{
|
{
|
||||||
for (int j = 0; j < _NumW; j++)
|
for (int j = 0; j < _NumW; j++)
|
||||||
{
|
{
|
||||||
SRectF rect = new SRectF(Rect.X + j * (_TileW + _SpaceW), Rect.Y + i * (_TileH + _SpaceH), _TileW, _TileH, Rect.Z);
|
var rect = new SRectF(Rect.X + j * (_TileW + _SpaceW), Rect.Y + i * (_TileH + _SpaceH), _TileW, _TileH, Rect.Z);
|
||||||
CStatic tileStatic = new CStatic(_PartyModeID, _TextureEmptyTile, ColorEmptyTile, rect) {Aspect = EAspect.Crop};
|
var tileStatic = new CStatic(_PartyModeID, _TextureEmptyTile, ColorEmptyTile, rect) {Aspect = EAspect.Crop};
|
||||||
CText tileText = new CText(rect.X + rect.W / 2, rect.Y + rect.H + _Theme.NameSpace, rect.Z, _Theme.NameHeight, rect.W, EAlignment.Center, _Theme.NameStyle,
|
var tileText = new CText(rect.X + rect.W / 2, rect.Y + rect.H + _Theme.NameSpace, rect.Z, _Theme.NameHeight, rect.W, EAlignment.Center, _Theme.NameStyle,
|
||||||
_Theme.NameFont, _Theme.NameColor, "");
|
_Theme.NameFont, _Theme.NameColor, "");
|
||||||
_Tiles.Add(new CTile(tileStatic, tileText, -1));
|
_Tiles.Add(new CTile(tileStatic, tileText, -1));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -501,21 +501,21 @@ namespace VocaluxeLib.Menu
|
|||||||
_VisibleProfiles.Clear();
|
_VisibleProfiles.Clear();
|
||||||
CProfile[] profiles = CBase.Profiles.GetProfiles();
|
CProfile[] profiles = CBase.Profiles.GetProfiles();
|
||||||
|
|
||||||
for (int i = 0; i < profiles.Length; i++)
|
foreach (CProfile profile in profiles)
|
||||||
{
|
{
|
||||||
bool visible = profiles[i].Active == EOffOn.TR_CONFIG_ON;
|
bool visible = profile.Active == EOffOn.TR_CONFIG_ON;
|
||||||
if (visible)
|
if (visible)
|
||||||
{
|
{
|
||||||
//Show profile only if active
|
//Show profile only if active
|
||||||
for (int p = 0; p < CBase.Game.GetNumPlayer(); p++)
|
for (int p = 0; p < CBase.Game.GetNumPlayer(); p++)
|
||||||
{
|
{
|
||||||
//Don't show profile if is selected, but if selected and guest
|
//Don't show profile if is selected, but if selected and guest
|
||||||
if (CBase.Game.GetPlayers()[p].ProfileID == profiles[i].ID && profiles[i].GuestProfile == EOffOn.TR_CONFIG_OFF)
|
if (CBase.Game.GetPlayers()[p].ProfileID == profile.ID && profile.GuestProfile == EOffOn.TR_CONFIG_OFF)
|
||||||
visible = false;
|
visible = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (visible)
|
if (visible)
|
||||||
_VisibleProfiles.Add(profiles[i].ID);
|
_VisibleProfiles.Add(profile.ID);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -205,11 +205,9 @@ namespace VocaluxeLib.Menu
|
|||||||
|
|
||||||
public void Draw(float scale, float z, EAspect aspect, bool forceDraw = false)
|
public void Draw(float scale, float z, EAspect aspect, bool forceDraw = false)
|
||||||
{
|
{
|
||||||
CTexture texture = Texture;
|
CTexture texture = Texture ?? new CTexture((int)Rect.W, (int)Rect.H);
|
||||||
if (texture == null)
|
|
||||||
texture = new CTexture((int)Rect.W, (int)Rect.H);
|
|
||||||
|
|
||||||
SRectF bounds = new SRectF(
|
var bounds = new SRectF(
|
||||||
Rect.X - Rect.W * (scale - 1f),
|
Rect.X - Rect.W * (scale - 1f),
|
||||||
Rect.Y - Rect.H * (scale - 1f),
|
Rect.Y - Rect.H * (scale - 1f),
|
||||||
Rect.W + 2 * Rect.W * (scale - 1f),
|
Rect.W + 2 * Rect.W * (scale - 1f),
|
||||||
@@ -220,7 +218,7 @@ namespace VocaluxeLib.Menu
|
|||||||
|
|
||||||
if (aspect != EAspect.Stretch)
|
if (aspect != EAspect.Stretch)
|
||||||
{
|
{
|
||||||
RectangleF bounds2 = new RectangleF(bounds.X, bounds.Y, bounds.W, bounds.H);
|
var bounds2 = new RectangleF(bounds.X, bounds.Y, bounds.W, bounds.H);
|
||||||
RectangleF rect2;
|
RectangleF rect2;
|
||||||
CHelper.SetRect(bounds2, out rect2, texture.OrigAspect, aspect);
|
CHelper.SetRect(bounds2, out rect2, texture.OrigAspect, aspect);
|
||||||
|
|
||||||
@@ -230,7 +228,7 @@ namespace VocaluxeLib.Menu
|
|||||||
rect.H = rect2.Height;
|
rect.H = rect2.Height;
|
||||||
}
|
}
|
||||||
|
|
||||||
SColorF color = new SColorF(Color.R, Color.G, Color.B, Color.A * Alpha);
|
var color = new SColorF(Color.R, Color.G, Color.B, Color.A * Alpha);
|
||||||
if (Visible || forceDraw || (CBase.Settings.GetGameState() == EGameState.EditTheme))
|
if (Visible || forceDraw || (CBase.Settings.GetGameState() == EGameState.EditTheme))
|
||||||
{
|
{
|
||||||
CBase.Drawing.DrawTexture(texture, rect, color, bounds);
|
CBase.Drawing.DrawTexture(texture, rect, color, bounds);
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ namespace VocaluxeLib.Menu.SingNotes
|
|||||||
public SRectF Rect;
|
public SRectF Rect;
|
||||||
public SColorF Color;
|
public SColorF Color;
|
||||||
public float Alpha;
|
public float Alpha;
|
||||||
public CLine[] Lines;
|
public CSongLine[] Lines;
|
||||||
public int LineNr;
|
public int LineNr;
|
||||||
public Stopwatch Timer;
|
public Stopwatch Timer;
|
||||||
public List<CParticleEffect> GoldenStars;
|
public List<CParticleEffect> GoldenStars;
|
||||||
@@ -205,7 +205,7 @@ namespace VocaluxeLib.Menu.SingNotes
|
|||||||
|
|
||||||
public int AddPlayer(SRectF rect, SColorF color, int playerNr)
|
public int AddPlayer(SRectF rect, SColorF color, int playerNr)
|
||||||
{
|
{
|
||||||
SPlayerNotes notes = new SPlayerNotes
|
var notes = new SPlayerNotes
|
||||||
{
|
{
|
||||||
Rect = rect,
|
Rect = rect,
|
||||||
Color = color,
|
Color = color,
|
||||||
@@ -226,7 +226,7 @@ namespace VocaluxeLib.Menu.SingNotes
|
|||||||
return notes.ID;
|
return notes.ID;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SetLines(int id, CLine[] lines, int lineNr)
|
public void SetLines(int id, CSongLine[] lines, int lineNr)
|
||||||
{
|
{
|
||||||
if (lines == null)
|
if (lines == null)
|
||||||
return;
|
return;
|
||||||
@@ -278,7 +278,7 @@ namespace VocaluxeLib.Menu.SingNotes
|
|||||||
Draw(id, null, player);
|
Draw(id, null, player);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Draw(int id, List<CLine> singLines, int player)
|
public void Draw(int id, List<CSungLine> sungLines, int player)
|
||||||
{
|
{
|
||||||
int n = _FindPlayerNotes(id);
|
int n = _FindPlayerNotes(id);
|
||||||
if (n == -1)
|
if (n == -1)
|
||||||
@@ -293,7 +293,7 @@ namespace VocaluxeLib.Menu.SingNotes
|
|||||||
if (_PlayerNotes[n].Lines.Length <= _PlayerNotes[n].LineNr)
|
if (_PlayerNotes[n].Lines.Length <= _PlayerNotes[n].LineNr)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
CLine line = _PlayerNotes[n].Lines[_PlayerNotes[n].LineNr];
|
CSongLine line = _PlayerNotes[n].Lines[_PlayerNotes[n].LineNr];
|
||||||
|
|
||||||
if (CBase.Config.GetDrawNoteLines() == EOffOn.TR_CONFIG_ON)
|
if (CBase.Config.GetDrawNoteLines() == EOffOn.TR_CONFIG_ON)
|
||||||
_DrawNoteLines(_PlayerNotes[n].Rect, new SColorF(0.5f, 0.5f, 0.5f, 0.5f * _PlayerNotes[n].Alpha));
|
_DrawNoteLines(_PlayerNotes[n].Rect, new SColorF(0.5f, 0.5f, 0.5f, 0.5f * _PlayerNotes[n].Alpha));
|
||||||
@@ -311,7 +311,7 @@ namespace VocaluxeLib.Menu.SingNotes
|
|||||||
if (beats < 1)
|
if (beats < 1)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
SColorF color = new SColorF(
|
var color = new SColorF(
|
||||||
_PlayerNotes[n].Color.R,
|
_PlayerNotes[n].Color.R,
|
||||||
_PlayerNotes[n].Color.G,
|
_PlayerNotes[n].Color.G,
|
||||||
_PlayerNotes[n].Color.B,
|
_PlayerNotes[n].Color.B,
|
||||||
@@ -319,13 +319,13 @@ namespace VocaluxeLib.Menu.SingNotes
|
|||||||
|
|
||||||
float baseLine = line.BaseLine;
|
float baseLine = line.BaseLine;
|
||||||
int nr = 1;
|
int nr = 1;
|
||||||
foreach (CNote note in line.Notes)
|
foreach (CSongNote note in line.Notes)
|
||||||
{
|
{
|
||||||
if (note.NoteType != ENoteType.Freestyle)
|
if (note.NoteType != ENoteType.Freestyle)
|
||||||
{
|
{
|
||||||
float width = note.Duration / beats * w;
|
float width = note.Duration / beats * w;
|
||||||
|
|
||||||
SRectF rect = new SRectF(
|
var rect = new SRectF(
|
||||||
_PlayerNotes[n].Rect.X + (note.StartBeat - line.FirstNoteBeat) / beats * w,
|
_PlayerNotes[n].Rect.X + (note.StartBeat - line.FirstNoteBeat) / beats * w,
|
||||||
_PlayerNotes[n].Rect.Y + (CBase.Settings.GetNumNoteLines() - 1 - (note.Tone - baseLine) / 2) / CBase.Settings.GetNumNoteLines() * h - dh,
|
_PlayerNotes[n].Rect.Y + (CBase.Settings.GetNumNoteLines() - 1 - (note.Tone - baseLine) / 2) / CBase.Settings.GetNumNoteLines() * h - dh,
|
||||||
width,
|
width,
|
||||||
@@ -359,7 +359,7 @@ namespace VocaluxeLib.Menu.SingNotes
|
|||||||
foreach (CParticleEffect perfline in _PlayerNotes[n].PerfectLineTwinkle)
|
foreach (CParticleEffect perfline in _PlayerNotes[n].PerfectLineTwinkle)
|
||||||
perfline.Draw();
|
perfline.Draw();
|
||||||
|
|
||||||
if (singLines == null || singLines.Count == 0 || CBase.Game.GetPlayers()[player].CurrentLine == -1 || singLines.Count <= CBase.Game.GetPlayers()[player].CurrentLine)
|
if (sungLines == null || sungLines.Count == 0 || CBase.Game.GetPlayers()[player].CurrentLine == -1 || sungLines.Count <= CBase.Game.GetPlayers()[player].CurrentLine)
|
||||||
{
|
{
|
||||||
foreach (CParticleEffect stars in _PlayerNotes[n].GoldenStars)
|
foreach (CParticleEffect stars in _PlayerNotes[n].GoldenStars)
|
||||||
{
|
{
|
||||||
@@ -369,48 +369,45 @@ namespace VocaluxeLib.Menu.SingNotes
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach (CNote note in singLines[CBase.Game.GetPlayers()[player].CurrentLine].Notes)
|
foreach (CSungNote note in sungLines[CBase.Game.GetPlayers()[player].CurrentLine].Notes)
|
||||||
{
|
{
|
||||||
if (note.StartBeat >= line.FirstNoteBeat && note.EndBeat <= line.LastNoteBeat)
|
float width = note.Duration / beats * w;
|
||||||
|
|
||||||
|
if (note.EndBeat == CBase.Game.GetCurrentBeatD())
|
||||||
|
width -= (1 - (CBase.Game.GetMidBeatD() - CBase.Game.GetCurrentBeatD())) / beats * w;
|
||||||
|
|
||||||
|
var rect = new SRectF(
|
||||||
|
_PlayerNotes[n].Rect.X + (note.StartBeat - line.FirstNoteBeat) / beats * w,
|
||||||
|
_PlayerNotes[n].Rect.Y + (CBase.Settings.GetNumNoteLines() - 1 - (note.Tone - baseLine) / 2) / CBase.Settings.GetNumNoteLines() * h - dh,
|
||||||
|
width,
|
||||||
|
h / CBase.Settings.GetNumNoteLines() + 2 * dh,
|
||||||
|
_PlayerNotes[n].Rect.Z
|
||||||
|
);
|
||||||
|
|
||||||
|
float f = (note.Hit) ? 0.7f : 0.4f;
|
||||||
|
|
||||||
|
_DrawNote(rect, color, f);
|
||||||
|
|
||||||
|
if (note.EndBeat >= CBase.Game.GetCurrentBeatD() && note.Hit && note.HitNote.NoteType == ENoteType.Golden)
|
||||||
{
|
{
|
||||||
float width = note.Duration / beats * w;
|
var re = new SRectF(rect) {W = (CBase.Game.GetMidBeatD() - note.StartBeat) / beats * w};
|
||||||
|
_AddFlare(re, n);
|
||||||
|
}
|
||||||
|
|
||||||
if (note.EndBeat == CBase.Game.GetCurrentBeatD())
|
if (note.Perfect && note.EndBeat < CBase.Game.GetCurrentBeatD())
|
||||||
width -= (1 - (CBase.Game.GetMidBeatD() - CBase.Game.GetCurrentBeatD())) / beats * w;
|
{
|
||||||
|
_AddPerfectNote(rect, n);
|
||||||
SRectF rect = new SRectF(
|
note.Perfect = false;
|
||||||
_PlayerNotes[n].Rect.X + (note.StartBeat - line.FirstNoteBeat) / beats * w,
|
|
||||||
_PlayerNotes[n].Rect.Y + (CBase.Settings.GetNumNoteLines() - 1 - (note.Tone - baseLine) / 2) / CBase.Settings.GetNumNoteLines() * h - dh,
|
|
||||||
width,
|
|
||||||
h / CBase.Settings.GetNumNoteLines() + 2 * dh,
|
|
||||||
_PlayerNotes[n].Rect.Z
|
|
||||||
);
|
|
||||||
|
|
||||||
float f = (note.Hit) ? 0.7f : 0.4f;
|
|
||||||
|
|
||||||
_DrawNote(rect, color, f);
|
|
||||||
|
|
||||||
if (note.EndBeat >= CBase.Game.GetCurrentBeatD() && note.Hit && note.NoteType == ENoteType.Golden)
|
|
||||||
{
|
|
||||||
SRectF re = new SRectF(rect) {W = (CBase.Game.GetMidBeatD() - note.StartBeat) / beats * w};
|
|
||||||
_AddFlare(re, n);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (note.Perfect && note.EndBeat < CBase.Game.GetCurrentBeatD())
|
|
||||||
{
|
|
||||||
_AddPerfectNote(rect, n);
|
|
||||||
note.Perfect = false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int currentLine = CBase.Game.GetPlayers()[player].SingLine.Count - 1;
|
int currentLine = CBase.Game.GetPlayers()[player].SungLines.Count - 1;
|
||||||
if (currentLine > 0)
|
if (currentLine > 0)
|
||||||
{
|
{
|
||||||
if (CBase.Game.GetPlayers()[player].SingLine[currentLine - 1].PerfectLine)
|
if (CBase.Game.GetPlayers()[player].SungLines[currentLine - 1].PerfectLine)
|
||||||
{
|
{
|
||||||
_AddPerfectLine(n);
|
_AddPerfectLine(n);
|
||||||
CBase.Game.GetPlayers()[player].SingLine[currentLine - 1].PerfectLine = false;
|
CBase.Game.GetPlayers()[player].SungLines[currentLine - 1].PerfectLine = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -475,7 +472,7 @@ namespace VocaluxeLib.Menu.SingNotes
|
|||||||
float dh = (1f - factor) * rect.H / 2;
|
float dh = (1f - factor) * rect.H / 2;
|
||||||
float dw = Math.Min(dh, rect.W / 2);
|
float dw = Math.Min(dh, rect.W / 2);
|
||||||
|
|
||||||
SRectF noteRect = new SRectF(rect.X + dw, rect.Y + dh, rect.W - 2 * dw, rect.H - 2 * dh, rect.Z);
|
var noteRect = new SRectF(rect.X + dw, rect.Y + dh, rect.W - 2 * dw, rect.H - 2 * dh, rect.Z);
|
||||||
|
|
||||||
CTexture noteBegin = CBase.Theme.GetSkinTexture(_Theme.SkinLeftName, _PartyModeID);
|
CTexture noteBegin = CBase.Theme.GetSkinTexture(_Theme.SkinLeftName, _PartyModeID);
|
||||||
CTexture noteMiddle = CBase.Theme.GetSkinTexture(_Theme.SkinMiddleName, _PartyModeID);
|
CTexture noteMiddle = CBase.Theme.GetSkinTexture(_Theme.SkinMiddleName, _PartyModeID);
|
||||||
@@ -487,7 +484,7 @@ namespace VocaluxeLib.Menu.SingNotes
|
|||||||
|
|
||||||
CBase.Drawing.DrawTexture(noteBegin, new SRectF(noteRect.X, noteRect.Y, endsW, noteRect.H, noteRect.Z), color);
|
CBase.Drawing.DrawTexture(noteBegin, new SRectF(noteRect.X, noteRect.Y, endsW, noteRect.H, noteRect.Z), color);
|
||||||
|
|
||||||
SRectF middleRect = new SRectF(noteRect.X + endsW, noteRect.Y, noteRect.W - 2 * endsW, noteRect.H, noteRect.Z);
|
var middleRect = new SRectF(noteRect.X + endsW, noteRect.Y, noteRect.W - 2 * endsW, noteRect.H, noteRect.Z);
|
||||||
if (noteRect.W >= 4 * endsW)
|
if (noteRect.W >= 4 * endsW)
|
||||||
CBase.Drawing.DrawTexture(noteMiddle, middleRect, color);
|
CBase.Drawing.DrawTexture(noteMiddle, middleRect, color);
|
||||||
else
|
else
|
||||||
@@ -516,7 +513,7 @@ namespace VocaluxeLib.Menu.SingNotes
|
|||||||
if (2 * dw > rect.W)
|
if (2 * dw > rect.W)
|
||||||
dw = rect.W / 2;
|
dw = rect.W / 2;
|
||||||
|
|
||||||
SRectF r = new SRectF(
|
var r = new SRectF(
|
||||||
rect.X + dw + spacing,
|
rect.X + dw + spacing,
|
||||||
rect.Y + d + spacing,
|
rect.Y + d + spacing,
|
||||||
rect.W - 2 * dw - 2 * spacing,
|
rect.W - 2 * dw - 2 * spacing,
|
||||||
@@ -532,7 +529,7 @@ namespace VocaluxeLib.Menu.SingNotes
|
|||||||
if (2 * dx > r.W)
|
if (2 * dx > r.W)
|
||||||
dx = r.W / 2;
|
dx = r.W / 2;
|
||||||
|
|
||||||
SColorF col = new SColorF(color.R, color.G, color.B, color.A * alpha);
|
var col = new SColorF(color.R, color.G, color.B, color.A * alpha);
|
||||||
|
|
||||||
CBase.Drawing.DrawTexture(noteBackgroundBegin, new SRectF(r.X, r.Y, dx, r.H, r.Z), col);
|
CBase.Drawing.DrawTexture(noteBackgroundBegin, new SRectF(r.X, r.Y, dx, r.H, r.Z), col);
|
||||||
|
|
||||||
@@ -565,7 +562,7 @@ namespace VocaluxeLib.Menu.SingNotes
|
|||||||
if (2 * dw > rect.W)
|
if (2 * dw > rect.W)
|
||||||
dw = rect.W / 2;
|
dw = rect.W / 2;
|
||||||
|
|
||||||
SRectF r = new SRectF(
|
var r = new SRectF(
|
||||||
rect.X + dw + spacing,
|
rect.X + dw + spacing,
|
||||||
rect.Y + d + spacing,
|
rect.Y + d + spacing,
|
||||||
rect.W - 2 * dw - 2 * spacing,
|
rect.W - 2 * dw - 2 * spacing,
|
||||||
@@ -573,8 +570,8 @@ namespace VocaluxeLib.Menu.SingNotes
|
|||||||
rect.Z
|
rect.Z
|
||||||
);
|
);
|
||||||
|
|
||||||
int numstars = (int)(r.W * 0.25f);
|
var numstars = (int)(r.W * 0.25f);
|
||||||
CParticleEffect stars = new CParticleEffect(_PartyModeID, numstars, new SColorF(1f, 1f, 0f, 1f), r, _Theme.SkinGoldenStarName, 20, EParticleType.Star);
|
var stars = new CParticleEffect(_PartyModeID, numstars, new SColorF(1f, 1f, 0f, 1f), r, _Theme.SkinGoldenStarName, 20, EParticleType.Star);
|
||||||
_PlayerNotes[n].GoldenStars.Add(stars);
|
_PlayerNotes[n].GoldenStars.Add(stars);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -589,7 +586,7 @@ namespace VocaluxeLib.Menu.SingNotes
|
|||||||
if (2 * dw > rect.W)
|
if (2 * dw > rect.W)
|
||||||
dw = rect.W / 2;
|
dw = rect.W / 2;
|
||||||
|
|
||||||
SRectF r = new SRectF(
|
var r = new SRectF(
|
||||||
rect.X + dw + spacing + rect.W - 2 * dw - 2 * spacing,
|
rect.X + dw + spacing + rect.W - 2 * dw - 2 * spacing,
|
||||||
rect.Y + d + spacing,
|
rect.Y + d + spacing,
|
||||||
0f,
|
0f,
|
||||||
@@ -597,7 +594,7 @@ namespace VocaluxeLib.Menu.SingNotes
|
|||||||
rect.Z
|
rect.Z
|
||||||
);
|
);
|
||||||
|
|
||||||
CParticleEffect flares = new CParticleEffect(_PartyModeID, 15, new SColorF(1f, 1f, 1f, 1f), r, _Theme.SkinGoldenStarName, 20, EParticleType.Flare);
|
var flares = new CParticleEffect(_PartyModeID, 15, new SColorF(1f, 1f, 1f, 1f), r, _Theme.SkinGoldenStarName, 20, EParticleType.Flare);
|
||||||
_PlayerNotes[n].Flares.Add(flares);
|
_PlayerNotes[n].Flares.Add(flares);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -611,7 +608,7 @@ namespace VocaluxeLib.Menu.SingNotes
|
|||||||
if (2 * dw > rect.W)
|
if (2 * dw > rect.W)
|
||||||
dw = rect.W / 2;
|
dw = rect.W / 2;
|
||||||
|
|
||||||
SRectF r = new SRectF(
|
var r = new SRectF(
|
||||||
rect.X + dw + spacing,
|
rect.X + dw + spacing,
|
||||||
rect.Y + d + spacing,
|
rect.Y + d + spacing,
|
||||||
rect.W - 2 * dw - 2 * spacing,
|
rect.W - 2 * dw - 2 * spacing,
|
||||||
@@ -632,14 +629,14 @@ namespace VocaluxeLib.Menu.SingNotes
|
|||||||
rect.Z
|
rect.Z
|
||||||
);
|
);
|
||||||
|
|
||||||
CParticleEffect stars = new CParticleEffect(_PartyModeID, CBase.Game.GetRandom(2) + 1, new SColorF(1f, 1f, 1f, 1f), r, _Theme.SkinPerfectNoteStarName, 35,
|
var stars = new CParticleEffect(_PartyModeID, CBase.Game.GetRandom(2) + 1, new SColorF(1f, 1f, 1f, 1f), r, _Theme.SkinPerfectNoteStarName, 35,
|
||||||
EParticleType.PerfNoteStar);
|
EParticleType.PerfNoteStar);
|
||||||
_PlayerNotes[n].PerfectNoteEffect.Add(stars);
|
_PlayerNotes[n].PerfectNoteEffect.Add(stars);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void _AddPerfectLine(int n)
|
private void _AddPerfectLine(int n)
|
||||||
{
|
{
|
||||||
CParticleEffect twinkle = new CParticleEffect(_PartyModeID, 200, _PlayerNotes[n].Color, _PlayerNotes[n].Rect, _Theme.SkinGoldenStarName, 25, EParticleType.Twinkle);
|
var twinkle = new CParticleEffect(_PartyModeID, 200, _PlayerNotes[n].Color, _PlayerNotes[n].Rect, _Theme.SkinGoldenStarName, 25, EParticleType.Twinkle);
|
||||||
_PlayerNotes[n].PerfectLineTwinkle.Add(twinkle);
|
_PlayerNotes[n].PerfectLineTwinkle.Add(twinkle);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -662,7 +659,7 @@ namespace VocaluxeLib.Menu.SingNotes
|
|||||||
offsetX = noteBounds.W;
|
offsetX = noteBounds.W;
|
||||||
|
|
||||||
float dy = noteBounds.H / CBase.Settings.GetNumNoteLines();
|
float dy = noteBounds.H / CBase.Settings.GetNumNoteLines();
|
||||||
SRectF drawRect = new SRectF(
|
var drawRect = new SRectF(
|
||||||
noteBounds.X - dy + offsetX,
|
noteBounds.X - dy + offsetX,
|
||||||
noteBounds.Y + dy * (CBase.Settings.GetNumNoteLines() - 1 - (tonePlayer - baseLine) / 2f),
|
noteBounds.Y + dy * (CBase.Settings.GetNumNoteLines() - 1 - (tonePlayer - baseLine) / 2f),
|
||||||
dy,
|
dy,
|
||||||
@@ -670,7 +667,7 @@ namespace VocaluxeLib.Menu.SingNotes
|
|||||||
noteBounds.Z
|
noteBounds.Z
|
||||||
);
|
);
|
||||||
|
|
||||||
SColorF color = new SColorF(
|
var color = new SColorF(
|
||||||
_PlayerNotes[n].Color.R,
|
_PlayerNotes[n].Color.R,
|
||||||
_PlayerNotes[n].Color.G,
|
_PlayerNotes[n].Color.G,
|
||||||
_PlayerNotes[n].Color.B,
|
_PlayerNotes[n].Color.B,
|
||||||
|
|||||||
@@ -0,0 +1,63 @@
|
|||||||
|
namespace VocaluxeLib.Songs
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Base class for all note types
|
||||||
|
/// </summary>
|
||||||
|
public abstract class CBaseNote
|
||||||
|
{
|
||||||
|
private int _Duration = 1;
|
||||||
|
private int _Tone;
|
||||||
|
|
||||||
|
#region Contructors
|
||||||
|
protected CBaseNote(CBaseNote note)
|
||||||
|
{
|
||||||
|
StartBeat = note.StartBeat;
|
||||||
|
_Duration = note._Duration;
|
||||||
|
_Tone = note._Tone;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected CBaseNote(int startBeat, int duration, int tone)
|
||||||
|
{
|
||||||
|
StartBeat = startBeat;
|
||||||
|
Duration = duration;
|
||||||
|
Tone = tone;
|
||||||
|
}
|
||||||
|
#endregion Constructors
|
||||||
|
|
||||||
|
#region Properties
|
||||||
|
public int StartBeat { get; set; }
|
||||||
|
|
||||||
|
public int EndBeat
|
||||||
|
{
|
||||||
|
get { return StartBeat + _Duration - 1; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public int Duration
|
||||||
|
{
|
||||||
|
get { return _Duration; }
|
||||||
|
set
|
||||||
|
{
|
||||||
|
if (value > 0)
|
||||||
|
_Duration = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public int Tone
|
||||||
|
{
|
||||||
|
get { return _Tone; }
|
||||||
|
set
|
||||||
|
{
|
||||||
|
if ((value >= CBase.Settings.GetToneMin()) && (value <= CBase.Settings.GetToneMax()))
|
||||||
|
_Tone = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public int Points
|
||||||
|
{
|
||||||
|
get { return PointsForBeat * Duration; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public abstract int PointsForBeat { get; }
|
||||||
|
#endregion Properties
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,135 @@
|
|||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
|
||||||
|
namespace VocaluxeLib.Songs
|
||||||
|
{
|
||||||
|
public class CLineBase<T> where T : CBaseNote
|
||||||
|
{
|
||||||
|
protected readonly List<T> _Notes = new List<T>();
|
||||||
|
|
||||||
|
#region Properties
|
||||||
|
public int FirstNoteBeat
|
||||||
|
{
|
||||||
|
get { return (_Notes.Count == 0) ? int.MaxValue : _Notes[0].StartBeat; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public int LastNoteBeat
|
||||||
|
{
|
||||||
|
get { return (_Notes.Count == 0) ? int.MinValue : _Notes[_Notes.Count - 1].EndBeat; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public int NoteCount
|
||||||
|
{
|
||||||
|
get { return _Notes.Count; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public T[] Notes
|
||||||
|
{
|
||||||
|
get { return _Notes.ToArray(); }
|
||||||
|
}
|
||||||
|
|
||||||
|
public T FirstNote
|
||||||
|
{
|
||||||
|
get { return _Notes.Count > 0 ? _Notes[0] : null; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public T LastNote
|
||||||
|
{
|
||||||
|
get { return _Notes.Count > 0 ? _Notes[_Notes.Count - 1] : null; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public int Points
|
||||||
|
{
|
||||||
|
get { return _Notes.Sum(note => note.Points); }
|
||||||
|
}
|
||||||
|
public int BaseLine
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
int min = int.MaxValue;
|
||||||
|
int max = int.MinValue;
|
||||||
|
foreach (T note in _Notes)
|
||||||
|
{
|
||||||
|
if (note.Tone < min)
|
||||||
|
min = note.Tone;
|
||||||
|
if (note.Tone > max)
|
||||||
|
max = note.Tone;
|
||||||
|
}
|
||||||
|
|
||||||
|
return min - (max - min) / 4;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endregion Properties
|
||||||
|
|
||||||
|
#region Methods
|
||||||
|
//Find last note with StartBeat<=Beat
|
||||||
|
public int FindPreviousNote(int beat)
|
||||||
|
{
|
||||||
|
//If no notes -> No previous note
|
||||||
|
if (_Notes.Count == 0)
|
||||||
|
return -1;
|
||||||
|
int start = 0;
|
||||||
|
int end = _Notes.Count - 1;
|
||||||
|
//Ensure that start.StartBeat<=Beat && end.StartBeat>Beat
|
||||||
|
if (_Notes[0].StartBeat > beat)
|
||||||
|
return -1;
|
||||||
|
if (_Notes[end].StartBeat <= beat)
|
||||||
|
return end;
|
||||||
|
//Binary search
|
||||||
|
while (end - start > 1)
|
||||||
|
{
|
||||||
|
int mid = (start + end) / 2;
|
||||||
|
if (_Notes[mid].StartBeat <= beat)
|
||||||
|
start = mid;
|
||||||
|
else
|
||||||
|
end = mid;
|
||||||
|
}
|
||||||
|
return start;
|
||||||
|
}
|
||||||
|
|
||||||
|
public virtual bool AddNote(T note)
|
||||||
|
{
|
||||||
|
if (_Notes.Count == 0)
|
||||||
|
_Notes.Add(note);
|
||||||
|
else
|
||||||
|
{
|
||||||
|
int insPos = FindPreviousNote(note.StartBeat);
|
||||||
|
_Notes.Insert(insPos + 1, note);
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool DeleteNote(int index)
|
||||||
|
{
|
||||||
|
if (_Notes.Count > index)
|
||||||
|
{
|
||||||
|
_Notes.RemoveAt(index);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool ReplaceNote(int index, T note)
|
||||||
|
{
|
||||||
|
if (_Notes.Count > index)
|
||||||
|
{
|
||||||
|
_Notes.RemoveAt(index);
|
||||||
|
return AddNote(note);
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool IncLastNoteLength()
|
||||||
|
{
|
||||||
|
if (_Notes.Count > 0)
|
||||||
|
_Notes[_Notes.Count - 1].Duration++;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void DeleteAllNotes()
|
||||||
|
{
|
||||||
|
_Notes.Clear();
|
||||||
|
}
|
||||||
|
#endregion Methods
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -17,9 +17,7 @@
|
|||||||
// */
|
// */
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
|
||||||
|
|
||||||
namespace VocaluxeLib.Songs
|
namespace VocaluxeLib.Songs
|
||||||
{
|
{
|
||||||
@@ -94,629 +92,4 @@ namespace VocaluxeLib.Songs
|
|||||||
voice.SetMedley(startBeat, endBeat);
|
voice.SetMedley(startBeat, endBeat);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public class CNote
|
|
||||||
{
|
|
||||||
private int _StartBeat;
|
|
||||||
private int _Duration;
|
|
||||||
private int _Tone;
|
|
||||||
private ENoteType _NoteType;
|
|
||||||
private string _Text;
|
|
||||||
private bool _Hit; // for drawing player notes
|
|
||||||
private bool _Perfect; // for drawing perfect note effect
|
|
||||||
|
|
||||||
#region Contructors
|
|
||||||
public CNote()
|
|
||||||
{
|
|
||||||
StartBeat = 0;
|
|
||||||
Duration = 1;
|
|
||||||
Tone = 0;
|
|
||||||
NoteType = ENoteType.Normal;
|
|
||||||
Text = String.Empty;
|
|
||||||
_Hit = false;
|
|
||||||
_Perfect = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
public CNote(CNote note)
|
|
||||||
{
|
|
||||||
_StartBeat = note._StartBeat;
|
|
||||||
_Duration = note._Duration;
|
|
||||||
_Tone = note._Tone;
|
|
||||||
_NoteType = note._NoteType;
|
|
||||||
_Text = note._Text;
|
|
||||||
_Hit = note._Hit;
|
|
||||||
_Perfect = note._Perfect;
|
|
||||||
}
|
|
||||||
|
|
||||||
public CNote(int startBeat, int duration, int tone, string text)
|
|
||||||
: this()
|
|
||||||
{
|
|
||||||
StartBeat = startBeat;
|
|
||||||
Duration = duration;
|
|
||||||
Tone = tone;
|
|
||||||
NoteType = ENoteType.Normal;
|
|
||||||
Text = text;
|
|
||||||
}
|
|
||||||
|
|
||||||
public CNote(int startBeat, int duration, int tone, string text, bool hit)
|
|
||||||
: this()
|
|
||||||
{
|
|
||||||
StartBeat = startBeat;
|
|
||||||
Duration = duration;
|
|
||||||
Tone = tone;
|
|
||||||
NoteType = ENoteType.Normal;
|
|
||||||
Text = text;
|
|
||||||
Hit = hit;
|
|
||||||
}
|
|
||||||
|
|
||||||
public CNote(int startBeat, int duration, int tone, string text, ENoteType noteType)
|
|
||||||
: this(startBeat, duration, tone, text)
|
|
||||||
{
|
|
||||||
NoteType = noteType;
|
|
||||||
}
|
|
||||||
|
|
||||||
public CNote(int startBeat, int duration, int tone, string text, bool hit, ENoteType noteType)
|
|
||||||
: this(startBeat, duration, tone, text)
|
|
||||||
{
|
|
||||||
NoteType = noteType;
|
|
||||||
Hit = hit;
|
|
||||||
}
|
|
||||||
#endregion Constructors
|
|
||||||
|
|
||||||
#region Properties
|
|
||||||
public bool Hit
|
|
||||||
{
|
|
||||||
get { return _Hit; }
|
|
||||||
set { _Hit = value; }
|
|
||||||
}
|
|
||||||
|
|
||||||
public bool Perfect
|
|
||||||
{
|
|
||||||
get { return _Perfect; }
|
|
||||||
set { _Perfect = value; }
|
|
||||||
}
|
|
||||||
|
|
||||||
public int StartBeat
|
|
||||||
{
|
|
||||||
get { return _StartBeat; }
|
|
||||||
set { _StartBeat = value; }
|
|
||||||
}
|
|
||||||
|
|
||||||
public int EndBeat
|
|
||||||
{
|
|
||||||
get { return _StartBeat + _Duration - 1; }
|
|
||||||
}
|
|
||||||
|
|
||||||
public int Duration
|
|
||||||
{
|
|
||||||
get { return _Duration; }
|
|
||||||
set
|
|
||||||
{
|
|
||||||
if (value > 0)
|
|
||||||
_Duration = value;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public int Tone
|
|
||||||
{
|
|
||||||
get { return _Tone; }
|
|
||||||
set
|
|
||||||
{
|
|
||||||
if ((value >= CBase.Settings.GetToneMin()) && (value <= CBase.Settings.GetToneMax()))
|
|
||||||
_Tone = value;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public ENoteType NoteType
|
|
||||||
{
|
|
||||||
get { return _NoteType; }
|
|
||||||
set { _NoteType = value; }
|
|
||||||
}
|
|
||||||
|
|
||||||
public string Text
|
|
||||||
{
|
|
||||||
get { return _Text; }
|
|
||||||
set { _Text = value; }
|
|
||||||
}
|
|
||||||
|
|
||||||
public int Points
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
switch (_NoteType)
|
|
||||||
{
|
|
||||||
case ENoteType.Normal:
|
|
||||||
return _Duration;
|
|
||||||
case ENoteType.Golden:
|
|
||||||
return _Duration * 2;
|
|
||||||
case ENoteType.Freestyle:
|
|
||||||
return 0;
|
|
||||||
default:
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public int PointsForBeat
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
switch (_NoteType)
|
|
||||||
{
|
|
||||||
case ENoteType.Normal:
|
|
||||||
return 1;
|
|
||||||
case ENoteType.Golden:
|
|
||||||
return 2;
|
|
||||||
case ENoteType.Freestyle:
|
|
||||||
return 0;
|
|
||||||
default:
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endregion Properties
|
|
||||||
|
|
||||||
#region Methods
|
|
||||||
public bool IsPerfect(CNote compareNote)
|
|
||||||
{
|
|
||||||
bool result = Hit;
|
|
||||||
|
|
||||||
if (StartBeat != compareNote.StartBeat)
|
|
||||||
result = false;
|
|
||||||
|
|
||||||
if (EndBeat != compareNote.EndBeat)
|
|
||||||
result = false;
|
|
||||||
|
|
||||||
if (Tone != compareNote.Tone)
|
|
||||||
result = false;
|
|
||||||
|
|
||||||
Perfect = result;
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
#endregion Methods
|
|
||||||
}
|
|
||||||
|
|
||||||
public class CLine
|
|
||||||
{
|
|
||||||
private int _StartBeat = int.MinValue;
|
|
||||||
private int _EndBeat = int.MinValue;
|
|
||||||
private bool _PerfectLine; // for drawing perfect line effect
|
|
||||||
private bool _VisibleInTimeLine = true;
|
|
||||||
|
|
||||||
private int _MinBeat = int.MaxValue;
|
|
||||||
private int _MaxBeat = int.MinValue;
|
|
||||||
private readonly List<CNote> _Notes = new List<CNote>();
|
|
||||||
|
|
||||||
#region Constructors
|
|
||||||
public CLine() {}
|
|
||||||
|
|
||||||
public CLine(CLine line)
|
|
||||||
{
|
|
||||||
foreach (CNote note in line._Notes)
|
|
||||||
_Notes.Add(new CNote(note));
|
|
||||||
_StartBeat = line._StartBeat;
|
|
||||||
_EndBeat = line._EndBeat;
|
|
||||||
_PerfectLine = line._PerfectLine;
|
|
||||||
_MinBeat = line._MinBeat;
|
|
||||||
_MaxBeat = line._MaxBeat;
|
|
||||||
_VisibleInTimeLine = line._VisibleInTimeLine;
|
|
||||||
}
|
|
||||||
#endregion Constructors
|
|
||||||
|
|
||||||
#region Properties
|
|
||||||
public bool VisibleInTimeLine
|
|
||||||
{
|
|
||||||
get { return _VisibleInTimeLine; }
|
|
||||||
set { _VisibleInTimeLine = value; }
|
|
||||||
}
|
|
||||||
|
|
||||||
public int StartBeat
|
|
||||||
{
|
|
||||||
get { return _StartBeat; }
|
|
||||||
set
|
|
||||||
{
|
|
||||||
if (value <= _MinBeat)
|
|
||||||
_StartBeat = value;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public int EndBeat
|
|
||||||
{
|
|
||||||
get { return _EndBeat; }
|
|
||||||
set
|
|
||||||
{
|
|
||||||
if (value >= _MaxBeat)
|
|
||||||
_EndBeat = value;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public bool PerfectLine
|
|
||||||
{
|
|
||||||
get { return _PerfectLine; }
|
|
||||||
set { _PerfectLine = value; }
|
|
||||||
}
|
|
||||||
|
|
||||||
public int FirstNoteBeat
|
|
||||||
{
|
|
||||||
get { return _MinBeat; }
|
|
||||||
}
|
|
||||||
|
|
||||||
public int LastNoteBeat
|
|
||||||
{
|
|
||||||
get { return _MaxBeat; }
|
|
||||||
}
|
|
||||||
|
|
||||||
public string Lyrics
|
|
||||||
{
|
|
||||||
get { return _Notes.Aggregate(String.Empty, (current, note) => current + note.Text); }
|
|
||||||
}
|
|
||||||
|
|
||||||
public int NoteCount
|
|
||||||
{
|
|
||||||
get { return _Notes.Count; }
|
|
||||||
}
|
|
||||||
|
|
||||||
public int Points
|
|
||||||
{
|
|
||||||
get { return _Notes.Sum(note => note.Points); }
|
|
||||||
}
|
|
||||||
|
|
||||||
public CNote[] Notes
|
|
||||||
{
|
|
||||||
get { return _Notes.ToArray(); }
|
|
||||||
}
|
|
||||||
|
|
||||||
public CNote FirstNote
|
|
||||||
{
|
|
||||||
get { return _Notes.Count > 0 ? _Notes[0] : null; }
|
|
||||||
}
|
|
||||||
|
|
||||||
public CNote LastNote
|
|
||||||
{
|
|
||||||
get { return _Notes.Count > 0 ? _Notes[_Notes.Count - 1] : null; }
|
|
||||||
}
|
|
||||||
|
|
||||||
public int BaseLine
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
int min = int.MaxValue;
|
|
||||||
int max = int.MinValue;
|
|
||||||
foreach (CNote note in _Notes)
|
|
||||||
{
|
|
||||||
if (note.Tone < min)
|
|
||||||
min = note.Tone;
|
|
||||||
if (note.Tone > max)
|
|
||||||
max = note.Tone;
|
|
||||||
}
|
|
||||||
|
|
||||||
return min - (max - min) / 4;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endregion Properties
|
|
||||||
|
|
||||||
#region Methods
|
|
||||||
public bool IsPerfect(CLine compareLine)
|
|
||||||
{
|
|
||||||
if (_Notes.Count == 0)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
if (_Notes.Count != compareLine.NoteCount)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
if (compareLine.Points == 0)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
_PerfectLine = Points == compareLine.Points;
|
|
||||||
return _PerfectLine;
|
|
||||||
}
|
|
||||||
|
|
||||||
//Find last note with StartBeat<=Beat
|
|
||||||
public int FindPreviousNote(int beat)
|
|
||||||
{
|
|
||||||
//If no notes -> No previous note
|
|
||||||
if (_Notes.Count == 0)
|
|
||||||
return -1;
|
|
||||||
int start = 0;
|
|
||||||
int end = _Notes.Count - 1;
|
|
||||||
//Ensure that start.StartBeat<=Beat && end.StartBeat>Beat
|
|
||||||
if (_Notes[0].StartBeat > beat)
|
|
||||||
return -1;
|
|
||||||
if (_Notes[end].StartBeat <= beat)
|
|
||||||
return end;
|
|
||||||
//Binary search
|
|
||||||
while (end - start > 1)
|
|
||||||
{
|
|
||||||
int mid = (start + end) / 2;
|
|
||||||
if (_Notes[mid].StartBeat <= beat)
|
|
||||||
start = mid;
|
|
||||||
else
|
|
||||||
end = mid;
|
|
||||||
}
|
|
||||||
return start;
|
|
||||||
}
|
|
||||||
|
|
||||||
public bool AddNote(CNote note)
|
|
||||||
{
|
|
||||||
if (_Notes.Count == 0)
|
|
||||||
_Notes.Add(note);
|
|
||||||
else
|
|
||||||
{
|
|
||||||
int insPos = FindPreviousNote(note.StartBeat);
|
|
||||||
//Flamefire: May be a performance hit as notes are also used for sung notes
|
|
||||||
//But for song loading this might be very helpful!
|
|
||||||
//Check for overlapping notes
|
|
||||||
/*if (insPos >= 0 && _Notes[insPos].EndBeat > Note.StartBeat)
|
|
||||||
return false;
|
|
||||||
if (insPos < _Notes.Count - 1 && _Notes[insPos+1].StartBeat > Note.EndBeat)
|
|
||||||
return false;
|
|
||||||
* */
|
|
||||||
_Notes.Insert(insPos + 1, note);
|
|
||||||
}
|
|
||||||
_UpdateMinMaxBeat(note);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
public bool DeleteNote(int index)
|
|
||||||
{
|
|
||||||
if (_Notes.Count > index)
|
|
||||||
{
|
|
||||||
_Notes.RemoveAt(index);
|
|
||||||
if (index == 0 || index == _Notes.Count - 1)
|
|
||||||
_UpdateMinMaxBeat();
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
public bool ReplaceNote(int index, CNote note)
|
|
||||||
{
|
|
||||||
if (_Notes.Count > index)
|
|
||||||
{
|
|
||||||
_Notes.RemoveAt(index);
|
|
||||||
return AddNote(note);
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
public bool IncLastNoteLength()
|
|
||||||
{
|
|
||||||
if (_Notes.Count > 0)
|
|
||||||
{
|
|
||||||
_Notes[_Notes.Count - 1].Duration++;
|
|
||||||
_MaxBeat++;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void DeleteAllNotes()
|
|
||||||
{
|
|
||||||
_Notes.Clear();
|
|
||||||
_UpdateMinMaxBeat();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void SetMedley(int startBeat, int endBeat)
|
|
||||||
{
|
|
||||||
foreach (CNote note in _Notes)
|
|
||||||
{
|
|
||||||
if (note.StartBeat < startBeat || note.EndBeat > endBeat)
|
|
||||||
note.NoteType = ENoteType.Freestyle;
|
|
||||||
}
|
|
||||||
|
|
||||||
_VisibleInTimeLine = _MinBeat >= startBeat && _MaxBeat <= endBeat;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void _UpdateMinMaxBeat(CNote note)
|
|
||||||
{
|
|
||||||
if (note.StartBeat < _MinBeat)
|
|
||||||
_MinBeat = note.StartBeat;
|
|
||||||
|
|
||||||
if (note.EndBeat > _MaxBeat)
|
|
||||||
_MaxBeat = note.EndBeat;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void _UpdateMinMaxBeat()
|
|
||||||
{
|
|
||||||
if (_Notes.Count > 0)
|
|
||||||
{
|
|
||||||
_MinBeat = _Notes[0].StartBeat;
|
|
||||||
_MaxBeat = _Notes[_Notes.Count - 1].EndBeat;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
_MinBeat = int.MaxValue;
|
|
||||||
_MaxBeat = int.MinValue;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endregion Methods
|
|
||||||
}
|
|
||||||
|
|
||||||
public class CVoice
|
|
||||||
{
|
|
||||||
private readonly List<CLine> _Lines = new List<CLine>();
|
|
||||||
|
|
||||||
public CVoice() {}
|
|
||||||
|
|
||||||
public CVoice(CVoice voice)
|
|
||||||
{
|
|
||||||
foreach (CLine line in voice._Lines)
|
|
||||||
_Lines.Add(new CLine(line));
|
|
||||||
}
|
|
||||||
|
|
||||||
public CLine[] Lines
|
|
||||||
{
|
|
||||||
get { return _Lines.ToArray(); }
|
|
||||||
}
|
|
||||||
public int NumLines
|
|
||||||
{
|
|
||||||
get { return _Lines.Count; }
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Total song length in beats
|
|
||||||
/// </summary>
|
|
||||||
public int Length
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
if (_Lines.Count == 0)
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
int startbeat = _Lines.Max(line => line.FirstNoteBeat);
|
|
||||||
int endbeat = _Lines.Min(line => line.LastNoteBeat);
|
|
||||||
|
|
||||||
int result = endbeat - startbeat;
|
|
||||||
return result > 0 ? result : 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public int Points
|
|
||||||
{
|
|
||||||
get { return _Lines.Sum(line => line.Points); }
|
|
||||||
}
|
|
||||||
|
|
||||||
public int NumLinesWithPoints
|
|
||||||
{
|
|
||||||
get { return _Lines.Count(line => line.Points > 0f); }
|
|
||||||
}
|
|
||||||
|
|
||||||
#region Methods
|
|
||||||
//Find last line with StartBeat<=Beat
|
|
||||||
public int FindPreviousLine(int beat)
|
|
||||||
{
|
|
||||||
//If no line -> No previous line
|
|
||||||
if (_Lines.Count == 0)
|
|
||||||
return -1;
|
|
||||||
int start = 0;
|
|
||||||
int end = _Lines.Count - 1;
|
|
||||||
//Ensure that start.StartBeat<=Beat && end.StartBeat>Beat
|
|
||||||
if (_Lines[0].StartBeat > beat)
|
|
||||||
return -1;
|
|
||||||
if (_Lines[end].StartBeat <= beat)
|
|
||||||
return end;
|
|
||||||
//Binary search
|
|
||||||
while (end - start > 1)
|
|
||||||
{
|
|
||||||
int mid = (start + end) / 2;
|
|
||||||
if (_Lines[mid].StartBeat <= beat)
|
|
||||||
start = mid;
|
|
||||||
else
|
|
||||||
end = mid;
|
|
||||||
}
|
|
||||||
return start;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void AddLine(CLine line)
|
|
||||||
{
|
|
||||||
if (_Lines.Count == 0)
|
|
||||||
_Lines.Add(line);
|
|
||||||
else
|
|
||||||
{
|
|
||||||
int insPos = FindPreviousLine(line.StartBeat);
|
|
||||||
_Lines.Insert(insPos + 1, line);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public bool DeleteLine(int index)
|
|
||||||
{
|
|
||||||
if (_Lines.Count > index)
|
|
||||||
{
|
|
||||||
_Lines.RemoveAt(index);
|
|
||||||
UpdateTimings();
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void DeleteAllLines()
|
|
||||||
{
|
|
||||||
_Lines.Clear();
|
|
||||||
}
|
|
||||||
|
|
||||||
public bool AddNote(CNote note, bool updateTimings = false)
|
|
||||||
{
|
|
||||||
int lineIndex = FindPreviousLine(note.StartBeat);
|
|
||||||
if (lineIndex < 0)
|
|
||||||
{
|
|
||||||
//Note is before ALL lines
|
|
||||||
CLine line = new CLine {StartBeat = note.StartBeat};
|
|
||||||
line.AddNote(note);
|
|
||||||
_Lines.Insert(0, line);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (!_Lines[lineIndex].AddNote(note))
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if (updateTimings)
|
|
||||||
UpdateTimings();
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
public bool InsertNote(CNote note, int lineIndex, bool updateTimings = false)
|
|
||||||
{
|
|
||||||
if (_Lines.Count > lineIndex && _Lines[lineIndex].StartBeat <= note.StartBeat)
|
|
||||||
{
|
|
||||||
_Lines[lineIndex].AddNote(note);
|
|
||||||
if (updateTimings)
|
|
||||||
UpdateTimings();
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void UpdateTimings()
|
|
||||||
{
|
|
||||||
CNote lastNote;
|
|
||||||
|
|
||||||
if (_Lines.Count > 0)
|
|
||||||
_Lines[0].StartBeat = -10000;
|
|
||||||
|
|
||||||
for (int i = 1; i < _Lines.Count; i++)
|
|
||||||
{
|
|
||||||
lastNote = _Lines[i - 1].LastNote;
|
|
||||||
CNote firstNote = _Lines[i].FirstNote;
|
|
||||||
|
|
||||||
if ((lastNote != null) && (firstNote != null))
|
|
||||||
{
|
|
||||||
int min = lastNote.EndBeat;
|
|
||||||
int max = firstNote.StartBeat;
|
|
||||||
|
|
||||||
int s;
|
|
||||||
switch (max - min)
|
|
||||||
{
|
|
||||||
case 0:
|
|
||||||
s = max;
|
|
||||||
break;
|
|
||||||
case 1:
|
|
||||||
s = max;
|
|
||||||
break;
|
|
||||||
case 2:
|
|
||||||
s = max - 1;
|
|
||||||
break;
|
|
||||||
case 3:
|
|
||||||
s = max - 2;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
s = min + 2;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
_Lines[i].StartBeat = s;
|
|
||||||
_Lines[i - 1].EndBeat = min;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
lastNote = _Lines[_Lines.Count - 1].LastNote;
|
|
||||||
if (lastNote != null)
|
|
||||||
_Lines[_Lines.Count - 1].EndBeat = lastNote.EndBeat;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void SetMedley(int startBeat, int endBeat)
|
|
||||||
{
|
|
||||||
foreach (CLine line in _Lines)
|
|
||||||
line.SetMedley(startBeat, endBeat);
|
|
||||||
}
|
|
||||||
#endregion Methods
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
@@ -725,7 +725,7 @@ namespace VocaluxeLib.Songs
|
|||||||
|
|
||||||
private bool _ParseNote(int player, ENoteType noteType, int start, int length, int tone, string text)
|
private bool _ParseNote(int player, ENoteType noteType, int start, int length, int tone, string text)
|
||||||
{
|
{
|
||||||
CNote note = new CNote(start, length, tone, text, noteType);
|
CSongNote note = new CSongNote(start, length, tone, text, noteType);
|
||||||
CVoice voice = Notes.GetVoice(player);
|
CVoice voice = Notes.GetVoice(player);
|
||||||
return voice.AddNote(note);
|
return voice.AddNote(note);
|
||||||
}
|
}
|
||||||
@@ -733,7 +733,7 @@ namespace VocaluxeLib.Songs
|
|||||||
private void _NewSentence(int player, int start)
|
private void _NewSentence(int player, int start)
|
||||||
{
|
{
|
||||||
CVoice voice = Notes.GetVoice(player);
|
CVoice voice = Notes.GetVoice(player);
|
||||||
CLine line = new CLine {StartBeat = start};
|
CSongLine line = new CSongLine {StartBeat = start};
|
||||||
voice.AddLine(line);
|
voice.AddLine(line);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -933,7 +933,7 @@ namespace VocaluxeLib.Songs
|
|||||||
}
|
}
|
||||||
|
|
||||||
//Check if stop is in line
|
//Check if stop is in line
|
||||||
foreach (CLine line in voice.Lines)
|
foreach (CSongLine line in voice.Lines)
|
||||||
{
|
{
|
||||||
if (line.FirstNoteBeat < stop && line.LastNoteBeat > stop)
|
if (line.FirstNoteBeat < stop && line.LastNoteBeat > stop)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -0,0 +1,86 @@
|
|||||||
|
using System;
|
||||||
|
using System.Linq;
|
||||||
|
|
||||||
|
namespace VocaluxeLib.Songs
|
||||||
|
{
|
||||||
|
public class CSongLine : CLineBase<CSongNote>
|
||||||
|
{
|
||||||
|
private int _StartBeat = int.MinValue;
|
||||||
|
private int _EndBeat = int.MinValue;
|
||||||
|
|
||||||
|
#region Constructors
|
||||||
|
public CSongLine()
|
||||||
|
{
|
||||||
|
VisibleInTimeLine = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public CSongLine(CSongLine line)
|
||||||
|
{
|
||||||
|
foreach (CSongNote note in line._Notes)
|
||||||
|
_Notes.Add(new CSongNote(note));
|
||||||
|
_StartBeat = line._StartBeat;
|
||||||
|
_EndBeat = line._EndBeat;
|
||||||
|
VisibleInTimeLine = line.VisibleInTimeLine;
|
||||||
|
}
|
||||||
|
#endregion Constructors
|
||||||
|
|
||||||
|
#region Properties
|
||||||
|
public bool VisibleInTimeLine { get; set; }
|
||||||
|
|
||||||
|
public int StartBeat
|
||||||
|
{
|
||||||
|
get { return _StartBeat; }
|
||||||
|
set
|
||||||
|
{
|
||||||
|
if (value <= FirstNoteBeat)
|
||||||
|
_StartBeat = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public int EndBeat
|
||||||
|
{
|
||||||
|
get { return _EndBeat; }
|
||||||
|
set
|
||||||
|
{
|
||||||
|
if (value >= LastNoteBeat)
|
||||||
|
_EndBeat = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public string Lyrics
|
||||||
|
{
|
||||||
|
get { return _Notes.Aggregate(String.Empty, (current, note) => current + note.Text); }
|
||||||
|
}
|
||||||
|
#endregion Properties
|
||||||
|
|
||||||
|
#region Methods
|
||||||
|
public override bool AddNote(CSongNote note)
|
||||||
|
{
|
||||||
|
if (_Notes.Count == 0)
|
||||||
|
_Notes.Add(note);
|
||||||
|
else
|
||||||
|
{
|
||||||
|
int insPos = FindPreviousNote(note.StartBeat);
|
||||||
|
//Check for overlapping notes
|
||||||
|
if (insPos >= 0 && _Notes[insPos].EndBeat > note.StartBeat)
|
||||||
|
return false;
|
||||||
|
if (insPos < _Notes.Count - 1 && _Notes[insPos + 1].StartBeat > note.EndBeat)
|
||||||
|
return false;
|
||||||
|
_Notes.Insert(insPos + 1, note);
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void SetMedley(int startBeat, int endBeat)
|
||||||
|
{
|
||||||
|
foreach (CSongNote note in _Notes)
|
||||||
|
{
|
||||||
|
if (note.StartBeat < startBeat || note.EndBeat > endBeat)
|
||||||
|
note.NoteType = ENoteType.Freestyle;
|
||||||
|
}
|
||||||
|
|
||||||
|
VisibleInTimeLine = FirstNoteBeat >= startBeat && LastNoteBeat <= endBeat;
|
||||||
|
}
|
||||||
|
#endregion Methods
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,52 @@
|
|||||||
|
namespace VocaluxeLib.Songs
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Class to represent a note in a song
|
||||||
|
/// </summary>
|
||||||
|
public class CSongNote : CBaseNote
|
||||||
|
{
|
||||||
|
#region Contructors
|
||||||
|
public CSongNote(CSongNote note) : base(note)
|
||||||
|
{
|
||||||
|
NoteType = note.NoteType;
|
||||||
|
Text = note.Text;
|
||||||
|
}
|
||||||
|
|
||||||
|
public CSongNote(int startBeat, int duration, int tone, string text) : base(startBeat, duration, tone)
|
||||||
|
{
|
||||||
|
NoteType = ENoteType.Normal;
|
||||||
|
Text = text;
|
||||||
|
}
|
||||||
|
|
||||||
|
public CSongNote(int startBeat, int duration, int tone, string text, ENoteType noteType)
|
||||||
|
: this(startBeat, duration, tone, text)
|
||||||
|
{
|
||||||
|
NoteType = noteType;
|
||||||
|
}
|
||||||
|
#endregion Constructors
|
||||||
|
|
||||||
|
#region Properties
|
||||||
|
public ENoteType NoteType { get; set; }
|
||||||
|
|
||||||
|
public string Text { get; set; }
|
||||||
|
|
||||||
|
public override int PointsForBeat
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
switch (NoteType)
|
||||||
|
{
|
||||||
|
case ENoteType.Normal:
|
||||||
|
return 1;
|
||||||
|
case ENoteType.Golden:
|
||||||
|
return 2;
|
||||||
|
case ENoteType.Freestyle:
|
||||||
|
return 0;
|
||||||
|
default:
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endregion Properties
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,18 @@
|
|||||||
|
using System.Linq;
|
||||||
|
|
||||||
|
namespace VocaluxeLib.Songs
|
||||||
|
{
|
||||||
|
public class CSungLine : CLineBase<CSungNote>
|
||||||
|
{
|
||||||
|
// for drawing perfect line effect
|
||||||
|
public bool PerfectLine { get; set; }
|
||||||
|
|
||||||
|
public bool IsPerfect(CSongLine compareLine)
|
||||||
|
{
|
||||||
|
PerfectLine = _Notes.Count > 0;
|
||||||
|
PerfectLine &= _Notes.Count == compareLine.NoteCount;
|
||||||
|
PerfectLine &= _Notes.All(note => note.Perfect);
|
||||||
|
return PerfectLine;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,63 @@
|
|||||||
|
namespace VocaluxeLib.Songs
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Note that was sung by a player
|
||||||
|
/// </summary>
|
||||||
|
public class CSungNote : CBaseNote
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Constructor for a sung note that was not hit
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="startBeat"></param>
|
||||||
|
/// <param name="duration"></param>
|
||||||
|
/// <param name="tone"></param>
|
||||||
|
public CSungNote(int startBeat, int duration, int tone) : base(startBeat, duration, tone)
|
||||||
|
{
|
||||||
|
Perfect = false;
|
||||||
|
HitNote = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Constructor for a sung note that hit the given note
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="startBeat"></param>
|
||||||
|
/// <param name="duration"></param>
|
||||||
|
/// <param name="tone"></param>
|
||||||
|
/// <param name="hitNote"></param>
|
||||||
|
public CSungNote(int startBeat, int duration, int tone, CSongNote hitNote) : this(startBeat, duration, tone)
|
||||||
|
{
|
||||||
|
HitNote = hitNote;
|
||||||
|
}
|
||||||
|
|
||||||
|
#region Properties
|
||||||
|
// for drawing player notes
|
||||||
|
public bool Hit
|
||||||
|
{
|
||||||
|
get { return HitNote != null; }
|
||||||
|
}
|
||||||
|
public CSongNote HitNote { get; set; }
|
||||||
|
// for drawing perfect note effect
|
||||||
|
public bool Perfect { get; set; }
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Methods
|
||||||
|
public void CheckPerfect()
|
||||||
|
{
|
||||||
|
bool result = HitNote != null;
|
||||||
|
if (result)
|
||||||
|
{
|
||||||
|
result = (StartBeat == HitNote.StartBeat);
|
||||||
|
result &= (EndBeat == HitNote.EndBeat);
|
||||||
|
result &= (Tone == HitNote.Tone);
|
||||||
|
}
|
||||||
|
|
||||||
|
Perfect = result;
|
||||||
|
}
|
||||||
|
#endregion Methods
|
||||||
|
|
||||||
|
public override int PointsForBeat
|
||||||
|
{
|
||||||
|
get { return (HitNote == null) ? 0 : HitNote.PointsForBeat; }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,194 @@
|
|||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
|
||||||
|
namespace VocaluxeLib.Songs
|
||||||
|
{
|
||||||
|
public class CVoice
|
||||||
|
{
|
||||||
|
private readonly List<CSongLine> _Lines = new List<CSongLine>();
|
||||||
|
|
||||||
|
public CVoice() {}
|
||||||
|
|
||||||
|
public CVoice(CVoice voice)
|
||||||
|
{
|
||||||
|
foreach (CSongLine line in voice._Lines)
|
||||||
|
_Lines.Add(new CSongLine(line));
|
||||||
|
}
|
||||||
|
|
||||||
|
public CSongLine[] Lines
|
||||||
|
{
|
||||||
|
get { return _Lines.ToArray(); }
|
||||||
|
}
|
||||||
|
public int NumLines
|
||||||
|
{
|
||||||
|
get { return _Lines.Count; }
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Total song length in beats
|
||||||
|
/// </summary>
|
||||||
|
public int Length
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
if (_Lines.Count == 0)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
int startbeat = _Lines.Max(line => line.FirstNoteBeat);
|
||||||
|
int endbeat = _Lines.Min(line => line.LastNoteBeat);
|
||||||
|
|
||||||
|
int result = endbeat - startbeat;
|
||||||
|
return result > 0 ? result : 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public int Points
|
||||||
|
{
|
||||||
|
get { return _Lines.Sum(line => line.Points); }
|
||||||
|
}
|
||||||
|
|
||||||
|
public int NumLinesWithPoints
|
||||||
|
{
|
||||||
|
get { return _Lines.Count(line => line.Points > 0f); }
|
||||||
|
}
|
||||||
|
|
||||||
|
#region Methods
|
||||||
|
//Find last line with StartBeat<=Beat
|
||||||
|
public int FindPreviousLine(int beat)
|
||||||
|
{
|
||||||
|
//If no line -> No previous line
|
||||||
|
if (_Lines.Count == 0)
|
||||||
|
return -1;
|
||||||
|
int start = 0;
|
||||||
|
int end = _Lines.Count - 1;
|
||||||
|
//Ensure that start.StartBeat<=Beat && end.StartBeat>Beat
|
||||||
|
if (_Lines[0].StartBeat > beat)
|
||||||
|
return -1;
|
||||||
|
if (_Lines[end].StartBeat <= beat)
|
||||||
|
return end;
|
||||||
|
//Binary search
|
||||||
|
while (end - start > 1)
|
||||||
|
{
|
||||||
|
int mid = (start + end) / 2;
|
||||||
|
if (_Lines[mid].StartBeat <= beat)
|
||||||
|
start = mid;
|
||||||
|
else
|
||||||
|
end = mid;
|
||||||
|
}
|
||||||
|
return start;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void AddLine(CSongLine line)
|
||||||
|
{
|
||||||
|
if (_Lines.Count == 0)
|
||||||
|
_Lines.Add(line);
|
||||||
|
else
|
||||||
|
{
|
||||||
|
int insPos = FindPreviousLine(line.StartBeat);
|
||||||
|
_Lines.Insert(insPos + 1, line);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool DeleteLine(int index)
|
||||||
|
{
|
||||||
|
if (_Lines.Count > index)
|
||||||
|
{
|
||||||
|
_Lines.RemoveAt(index);
|
||||||
|
UpdateTimings();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void DeleteAllLines()
|
||||||
|
{
|
||||||
|
_Lines.Clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool AddNote(CSongNote note, bool updateTimings = false)
|
||||||
|
{
|
||||||
|
int lineIndex = FindPreviousLine(note.StartBeat);
|
||||||
|
if (lineIndex < 0)
|
||||||
|
{
|
||||||
|
//Note is before ALL lines
|
||||||
|
CSongLine line = new CSongLine {StartBeat = note.StartBeat};
|
||||||
|
line.AddNote(note);
|
||||||
|
_Lines.Insert(0, line);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (!_Lines[lineIndex].AddNote(note))
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (updateTimings)
|
||||||
|
UpdateTimings();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool InsertNote(CSongNote note, int lineIndex, bool updateTimings = false)
|
||||||
|
{
|
||||||
|
if (_Lines.Count > lineIndex && _Lines[lineIndex].StartBeat <= note.StartBeat)
|
||||||
|
{
|
||||||
|
_Lines[lineIndex].AddNote(note);
|
||||||
|
if (updateTimings)
|
||||||
|
UpdateTimings();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void UpdateTimings()
|
||||||
|
{
|
||||||
|
CSongNote lastNote;
|
||||||
|
|
||||||
|
if (_Lines.Count > 0)
|
||||||
|
_Lines[0].StartBeat = -10000;
|
||||||
|
|
||||||
|
for (int i = 1; i < _Lines.Count; i++)
|
||||||
|
{
|
||||||
|
lastNote = _Lines[i - 1].LastNote;
|
||||||
|
CSongNote firstNote = _Lines[i].FirstNote;
|
||||||
|
|
||||||
|
if ((lastNote != null) && (firstNote != null))
|
||||||
|
{
|
||||||
|
int min = lastNote.EndBeat;
|
||||||
|
int max = firstNote.StartBeat;
|
||||||
|
|
||||||
|
int s;
|
||||||
|
switch (max - min)
|
||||||
|
{
|
||||||
|
case 0:
|
||||||
|
s = max;
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
s = max;
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
s = max - 1;
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
s = max - 2;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
s = min + 2;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
_Lines[i].StartBeat = s;
|
||||||
|
_Lines[i - 1].EndBeat = min;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
lastNote = _Lines[_Lines.Count - 1].LastNote;
|
||||||
|
if (lastNote != null)
|
||||||
|
_Lines[_Lines.Count - 1].EndBeat = lastNote.EndBeat;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void SetMedley(int startBeat, int endBeat)
|
||||||
|
{
|
||||||
|
foreach (CSongLine line in _Lines)
|
||||||
|
line.SetMedley(startBeat, endBeat);
|
||||||
|
}
|
||||||
|
#endregion Methods
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -186,8 +186,8 @@ namespace VocaluxeLib
|
|||||||
public double PointsLineBonus;
|
public double PointsLineBonus;
|
||||||
public double PointsGoldenNotes;
|
public double PointsGoldenNotes;
|
||||||
public int NoteDiff;
|
public int NoteDiff;
|
||||||
public int LineNr;
|
public int VoiceNr;
|
||||||
public List<CLine> SingLine;
|
public List<CSungLine> SungLines;
|
||||||
public int CurrentLine;
|
public int CurrentLine;
|
||||||
public int CurrentNote;
|
public int CurrentNote;
|
||||||
|
|
||||||
|
|||||||
@@ -138,6 +138,10 @@
|
|||||||
<Compile Include="Menu\IMenuElement.cs" />
|
<Compile Include="Menu\IMenuElement.cs" />
|
||||||
<Compile Include="Profile\CAvatar.cs" />
|
<Compile Include="Profile\CAvatar.cs" />
|
||||||
<Compile Include="Profile\CProfile.cs" />
|
<Compile Include="Profile\CProfile.cs" />
|
||||||
|
<Compile Include="Songs\CLineBase.cs" />
|
||||||
|
<Compile Include="Songs\CBaseNote.cs" />
|
||||||
|
<Compile Include="Songs\CSongLine.cs" />
|
||||||
|
<Compile Include="Songs\CSongNote.cs" />
|
||||||
<Compile Include="Songs\CNotes.cs" />
|
<Compile Include="Songs\CNotes.cs" />
|
||||||
<Compile Include="Menu\SingNotes\CSingNotes.cs" />
|
<Compile Include="Menu\SingNotes\CSingNotes.cs" />
|
||||||
<Compile Include="Menu\SingNotes\CSingNotesClassic.cs" />
|
<Compile Include="Menu\SingNotes\CSingNotesClassic.cs" />
|
||||||
@@ -150,6 +154,9 @@
|
|||||||
<Compile Include="Menu\SongMenu\CSongMenuList.cs" />
|
<Compile Include="Menu\SongMenu\CSongMenuList.cs" />
|
||||||
<Compile Include="Menu\SongMenu\CSongMenuTileBoard.cs" />
|
<Compile Include="Menu\SongMenu\CSongMenuTileBoard.cs" />
|
||||||
<Compile Include="Menu\SongMenu\ISongMenu.cs" />
|
<Compile Include="Menu\SongMenu\ISongMenu.cs" />
|
||||||
|
<Compile Include="Songs\CSungLine.cs" />
|
||||||
|
<Compile Include="Songs\CSungNote.cs" />
|
||||||
|
<Compile Include="Songs\CVoice.cs" />
|
||||||
<Compile Include="Structs.cs" />
|
<Compile Include="Structs.cs" />
|
||||||
<Compile Include="PartyModes\CPartyMode.cs" />
|
<Compile Include="PartyModes\CPartyMode.cs" />
|
||||||
<Compile Include="PartyModes\CPartyModeNone.cs" />
|
<Compile Include="PartyModes\CPartyModeNone.cs" />
|
||||||
|
|||||||
Reference in new issue
Block a user