diff --git a/Output/Languages/English.xml b/Output/Languages/English.xml
index 3c758738..b6d55298 100644
--- a/Output/Languages/English.xml
+++ b/Output/Languages/English.xml
@@ -156,6 +156,8 @@
Stop singing
Continue
Skip this song
+ Restart round
+ Restart game
Scores
Rating
Points
diff --git a/Output/Profiles/guest1.xml b/Output/Profiles/guest1.xml
index 92f0b29d..a3c68568 100644
--- a/Output/Profiles/guest1.xml
+++ b/Output/Profiles/guest1.xml
@@ -1,5 +1,6 @@
+ 600352d6-d975-4945-9758-e6b379972a12
Guest 1
TR_CONFIG_EASY
TR_USERROLE_GUEST
diff --git a/Output/Profiles/guest2.xml b/Output/Profiles/guest2.xml
index 55c2c971..c4e6e421 100644
--- a/Output/Profiles/guest2.xml
+++ b/Output/Profiles/guest2.xml
@@ -1,5 +1,6 @@
+ abeb987f-bf44-4d6d-b922-e5deb608a1ab
Guest 2
TR_CONFIG_EASY
TR_USERROLE_GUEST
diff --git a/Output/Profiles/guest3.xml b/Output/Profiles/guest3.xml
index f8b196f8..9cb86c18 100644
--- a/Output/Profiles/guest3.xml
+++ b/Output/Profiles/guest3.xml
@@ -1,5 +1,6 @@
+ fd433fc4-60c0-4521-87ef-53aa7d252337
Guest 3
TR_CONFIG_EASY
TR_USERROLE_GUEST
diff --git a/Output/Themes/Changelog/Changelog_ScreenSing.txt b/Output/Themes/Changelog/Changelog_ScreenSing.txt
index 0a87c825..d86c8747 100644
--- a/Output/Themes/Changelog/Changelog_ScreenSing.txt
+++ b/Output/Themes/Changelog/Changelog_ScreenSing.txt
@@ -4,7 +4,9 @@ ScreenSing
Version 9
Add:
-
+
+
+
+++++++++
Version 8
diff --git a/Output/Themes/Genius/01_Standard.xml b/Output/Themes/Genius/01_Standard.xml
index bc2c91a0..8147bbdf 100644
--- a/Output/Themes/Genius/01_Standard.xml
+++ b/Output/Themes/Genius/01_Standard.xml
@@ -296,6 +296,12 @@
0.027
1.000
+
+ 1.000
+ 1.000
+ 1.000
+ 0.900
+
BG_Default.png
@@ -329,7 +335,7 @@
Score.png
Star.png
SongMenu.png
- Pause.png
+ PauseBG.png
EnergyBeam.png
SearchBar.png
PlaylistBG.png
diff --git a/Output/Themes/Genius/02_Ice_Blue.xml b/Output/Themes/Genius/02_Ice_Blue.xml
index 0f61be86..0e9d9806 100644
--- a/Output/Themes/Genius/02_Ice_Blue.xml
+++ b/Output/Themes/Genius/02_Ice_Blue.xml
@@ -296,6 +296,12 @@
0.027
1.000
+
+ 1.000
+ 1.000
+ 1.000
+ 0.900
+
BG_Default.png
@@ -329,7 +335,7 @@
Score.png
Star.png
SongMenu.png
- Pause.png
+ PauseBG.png
EnergyBeam.png
SearchBar.png
PlaylistBG.png
diff --git a/Output/Themes/Genius/03_Crimson_Red.xml b/Output/Themes/Genius/03_Crimson_Red.xml
index d9b61b8a..aa3f4cfb 100644
--- a/Output/Themes/Genius/03_Crimson_Red.xml
+++ b/Output/Themes/Genius/03_Crimson_Red.xml
@@ -296,6 +296,12 @@
0.027
1.000
+
+ 1.000
+ 1.000
+ 1.000
+ 0.900
+
BG_Default.png
@@ -329,7 +335,7 @@
Score.png
Star.png
SongMenu.png
- Pause.png
+ PauseBG.png
EnergyBeam.png
SearchBar.png
PlaylistBG.png
diff --git a/Output/Themes/Genius/Pause.png b/Output/Themes/Genius/Pause.png
deleted file mode 100644
index 2ea49e27..00000000
Binary files a/Output/Themes/Genius/Pause.png and /dev/null differ
diff --git a/Output/Themes/Genius/PauseBG.png b/Output/Themes/Genius/PauseBG.png
new file mode 100644
index 00000000..4d9ddba6
Binary files /dev/null and b/Output/Themes/Genius/PauseBG.png differ
diff --git a/Output/Themes/Genius/Screens/ScreenSing.xml b/Output/Themes/Genius/Screens/ScreenSing.xml
index 57c09eec..821093fb 100644
--- a/Output/Themes/Genius/Screens/ScreenSing.xml
+++ b/Output/Themes/Genius/Screens/ScreenSing.xml
@@ -657,11 +657,11 @@
640
- 350
+ 450
-2.11
- 40
+ 100
0
-
+
Center
Center
@@ -1302,8 +1302,8 @@
Button
Button
- 775
- 450
+ 985
+ 600
150
50
-2.11
@@ -1337,8 +1337,8 @@
Button
Button
- 355
- 450
+ 145
+ 600
150
50
-2.11
@@ -1372,8 +1372,8 @@
Button
Button
- 565
- 450
+ 355
+ 600
150
50
-2.11
@@ -1403,6 +1403,76 @@
10
+
+
diff --git a/PartyModes/PartyModeChallenge/CPartyModeChallenge.cs b/PartyModes/PartyModeChallenge/CPartyModeChallenge.cs
index b37636e3..ce808dec 100644
--- a/PartyModes/PartyModeChallenge/CPartyModeChallenge.cs
+++ b/PartyModes/PartyModeChallenge/CPartyModeChallenge.cs
@@ -30,7 +30,7 @@ namespace VocaluxeLib.PartyModes.Challenge
public class CResultTableRow : IComparable
{
public int Position;
- public int PlayerID;
+ public Guid PlayerID;
public int NumPlayed;
public int NumWon;
public int NumSingPoints;
@@ -121,7 +121,7 @@ namespace VocaluxeLib.PartyModes.Challenge
public int NumJokers;
public bool RefillJokers;
public int[] Jokers;
- public List ProfileIDs;
+ public List ProfileIDs;
public ESongSource SongSource;
public ESongSorting Sorting;
@@ -143,7 +143,7 @@ namespace VocaluxeLib.PartyModes.Challenge
private struct SStats
{
- public int ProfileID;
+ public Guid ProfileID;
public int SingPoints;
public int GamePoints;
public int Won;
@@ -173,7 +173,7 @@ namespace VocaluxeLib.PartyModes.Challenge
NumJokers = 5,
RefillJokers = true,
CurrentRoundNr = 1,
- ProfileIDs = new List(),
+ ProfileIDs = new List(),
Sorting = CBase.Config.GetSongSorting(),
SongSource = ESongSource.TR_SONGSOURCE_ALLSONGS,
PlaylistID = 0,
@@ -479,7 +479,7 @@ namespace VocaluxeLib.PartyModes.Challenge
if (c != null)
players[i].ProfileID = GameData.ProfileIDs[c.Players[i]];
else
- players[i].ProfileID = -1;
+ players[i].ProfileID = Guid.Empty;
}
#endregion PlayerNames
diff --git a/PartyModes/PartyModeChallenge/CPartyScreenChallengeMain.cs b/PartyModes/PartyModeChallenge/CPartyScreenChallengeMain.cs
index 77a5eb88..39b6fd51 100644
--- a/PartyModes/PartyModeChallenge/CPartyScreenChallengeMain.cs
+++ b/PartyModes/PartyModeChallenge/CPartyScreenChallengeMain.cs
@@ -341,7 +341,7 @@ namespace VocaluxeLib.PartyModes.Challenge
_Texts[_TextNextPlayerMessage].Visible = true;
for (int i = 0; i < _PartyMode.GameData.NumPlayerAtOnce; i++)
{
- int id = _PartyMode.GameData.ProfileIDs[_PartyMode.GameData.Rounds[_PartyMode.GameData.CurrentRoundNr - 1].Players[i]];
+ Guid id = _PartyMode.GameData.ProfileIDs[_PartyMode.GameData.Rounds[_PartyMode.GameData.CurrentRoundNr - 1].Players[i]];
_NextPlayerStatics[i].Texture = CBase.Profiles.GetAvatar(id);
_NextPlayerTexts[i].Text = CBase.Profiles.GetPlayerName(id);
_NextPlayerTexts[i].Color = CBase.Themes.GetPlayerColor(i + 1);
diff --git a/PartyModes/PartyModeChallenge/CPartyScreenChallengeNames.cs b/PartyModes/PartyModeChallenge/CPartyScreenChallengeNames.cs
index 46d354aa..bddb2940 100644
--- a/PartyModes/PartyModeChallenge/CPartyScreenChallengeNames.cs
+++ b/PartyModes/PartyModeChallenge/CPartyScreenChallengeNames.cs
@@ -15,6 +15,7 @@
// along with Vocaluxe. If not, see .
#endregion
+using System;
using System.Collections.Generic;
using VocaluxeLib.Menu;
@@ -47,7 +48,7 @@ namespace VocaluxeLib.PartyModes.Challenge
while (_PartyMode.GameData.ProfileIDs.Count > _NumPlayer)
_PartyMode.GameData.ProfileIDs.RemoveAt(_PartyMode.GameData.ProfileIDs.Count - 1);
- List[] ids = new List[] {_PartyMode.GameData.ProfileIDs};
+ List[] ids = new List[] {_PartyMode.GameData.ProfileIDs};
SetPartyModeProfiles(ids);
}
diff --git a/PartyModes/PartyModeChallenge/PartyModeChallenge.csproj b/PartyModes/PartyModeChallenge/PartyModeChallenge.csproj
index c2ecf5b3..0d1764d8 100644
--- a/PartyModes/PartyModeChallenge/PartyModeChallenge.csproj
+++ b/PartyModes/PartyModeChallenge/PartyModeChallenge.csproj
@@ -1,5 +1,5 @@
-
+
DebugWin
AnyCPU
@@ -10,8 +10,9 @@
Properties
VocaluxeLib.PartyModes.Challenge
Challenge
- v4.0
- Client
+ v4.7.1
+
+
512
@@ -25,6 +26,7 @@
4
Off
..\..\CheckingRules.ruleset
+ false
AnyCPU
@@ -36,6 +38,7 @@
false
WIN
Off
+ false
AnyCPU
@@ -47,6 +50,7 @@
prompt
4
Off
+ false
AnyCPU
@@ -58,6 +62,7 @@
false
LINUX
Off
+ false
bin
@@ -68,6 +73,7 @@
Off
prompt
ManagedMinimumRules.ruleset
+ false
diff --git a/PartyModes/PartyModeTicTacToe/CPartyModeTicTacToe.cs b/PartyModes/PartyModeTicTacToe/CPartyModeTicTacToe.cs
index fa99918c..b8f3c757 100644
--- a/PartyModes/PartyModeTicTacToe/CPartyModeTicTacToe.cs
+++ b/PartyModes/PartyModeTicTacToe/CPartyModeTicTacToe.cs
@@ -104,8 +104,8 @@ namespace VocaluxeLib.PartyModes.TicTacToe
public int NumPlayerTeam2;
public int NumFields;
public int Team;
- public List ProfileIDsTeam1;
- public List ProfileIDsTeam2;
+ public List ProfileIDsTeam1;
+ public List ProfileIDsTeam2;
public List PlayerTeam1;
public List PlayerTeam2;
@@ -148,8 +148,8 @@ namespace VocaluxeLib.PartyModes.TicTacToe
NumPlayerTeam1 = 2,
NumPlayerTeam2 = 2,
NumFields = 9,
- ProfileIDsTeam1 = new List(),
- ProfileIDsTeam2 = new List(),
+ ProfileIDsTeam1 = new List(),
+ ProfileIDsTeam2 = new List(),
PlayerTeam1 = new List(),
PlayerTeam2 = new List(),
CurrentRoundNr = 0,
@@ -491,7 +491,7 @@ namespace VocaluxeLib.PartyModes.TicTacToe
for (int i = 0; i < 2; i++)
{
//default values
- players[i].ProfileID = -1;
+ players[i].ProfileID = Guid.Empty;
}
//try to fill with the right data
diff --git a/PartyModes/PartyModeTicTacToe/CPartyScreenTicTacToeNames.cs b/PartyModes/PartyModeTicTacToe/CPartyScreenTicTacToeNames.cs
index 8d0e6cae..c0e7cc1c 100644
--- a/PartyModes/PartyModeTicTacToe/CPartyScreenTicTacToeNames.cs
+++ b/PartyModes/PartyModeTicTacToe/CPartyScreenTicTacToeNames.cs
@@ -15,6 +15,7 @@
// along with Vocaluxe. If not, see .
#endregion
+using System;
using System.Collections.Generic;
using VocaluxeLib.Menu;
@@ -49,7 +50,7 @@ namespace VocaluxeLib.PartyModes.TicTacToe
SetPartyModeData(2, _PartyMode.GameData.NumPlayerTeam1 + _PartyMode.GameData.NumPlayerTeam2,
new int[] {_PartyMode.GameData.NumPlayerTeam1, _PartyMode.GameData.NumPlayerTeam2});
- List[] ids = new List[] {_PartyMode.GameData.ProfileIDsTeam1, _PartyMode.GameData.ProfileIDsTeam2};
+ List[] ids = new List[] {_PartyMode.GameData.ProfileIDsTeam1, _PartyMode.GameData.ProfileIDsTeam2};
SetPartyModeProfiles(ids);
}
diff --git a/PartyModes/PartyModeTicTacToe/PartyModeTicTacToe.csproj b/PartyModes/PartyModeTicTacToe/PartyModeTicTacToe.csproj
index 2c6f46d4..6e812ce8 100644
--- a/PartyModes/PartyModeTicTacToe/PartyModeTicTacToe.csproj
+++ b/PartyModes/PartyModeTicTacToe/PartyModeTicTacToe.csproj
@@ -1,5 +1,5 @@
-
+
DebugWin
AnyCPU
@@ -10,8 +10,9 @@
Properties
VocaluxeLib.PartyModes.TicTacToe
TicTacToe
- v4.0
- Client
+ v4.7.1
+
+
512
@@ -25,6 +26,7 @@
4
Off
..\..\CheckingRules.ruleset
+ false
AnyCPU
@@ -36,6 +38,7 @@
false
WIN
Off
+ false
AnyCPU
@@ -47,6 +50,7 @@
prompt
4
Off
+ false
AnyCPU
@@ -58,6 +62,7 @@
false
LINUX
Off
+ false
bin
@@ -68,6 +73,7 @@
Off
prompt
ManagedMinimumRules.ruleset
+ false
diff --git a/Vocaluxe/Base/CConfig.cs b/Vocaluxe/Base/CConfig.cs
index f3b776a3..a552974b 100644
--- a/Vocaluxe/Base/CConfig.cs
+++ b/Vocaluxe/Base/CConfig.cs
@@ -837,7 +837,7 @@ namespace Vocaluxe.Base
for (int j = 0; j < CSettings.MaxNumPlayer; j++)
{
- CGame.Players[j].ProfileID = -1;
+ CGame.Players[j].ProfileID = Guid.Empty;
if (string.IsNullOrEmpty(Config.Game.Players[j]))
continue;
diff --git a/Vocaluxe/Base/CMain.cs b/Vocaluxe/Base/CMain.cs
index 6038c266..61bfcf69 100644
--- a/Vocaluxe/Base/CMain.cs
+++ b/Vocaluxe/Base/CMain.cs
@@ -656,17 +656,22 @@ namespace Vocaluxe.Base
return CProfiles.GetProfiles();
}
- public EGameDifficulty GetDifficulty(int profileID)
+ public int GetNum()
+ {
+ return CProfiles.NumProfiles;
+ }
+
+ public EGameDifficulty GetDifficulty(Guid profileID)
{
return CProfiles.GetDifficulty(profileID);
}
- public string GetPlayerName(int profileID, int playerNum = 0)
+ public string GetPlayerName(Guid profileID, int playerNum = 0)
{
return CProfiles.GetPlayerName(profileID, playerNum);
}
- public CTextureRef GetAvatar(int profileID)
+ public CTextureRef GetAvatar(Guid profileID)
{
return CProfiles.GetAvatarTextureFromProfile(profileID);
}
@@ -676,12 +681,12 @@ namespace Vocaluxe.Base
return CProfiles.GetAvatarByFilename(fileName);
}
- public bool IsProfileIDValid(int profileID)
+ public bool IsProfileIDValid(Guid profileID)
{
return CProfiles.IsProfileIDValid(profileID);
}
- public bool IsGuest(int profileID)
+ public bool IsGuest(Guid profileID)
{
return CProfiles.IsGuestProfile(profileID);
}
diff --git a/Vocaluxe/Base/CProfiles.cs b/Vocaluxe/Base/CProfiles.cs
index 43841704..9e454ffe 100644
--- a/Vocaluxe/Base/CProfiles.cs
+++ b/Vocaluxe/Base/CProfiles.cs
@@ -45,13 +45,12 @@ namespace Vocaluxe.Base
public CProfile Profile;
public CAvatar Avatar;
public EAction Action;
- public int ProfileID;
+ public Guid ProfileID;
}
#endregion enums and structs
#region private vars
- private static Dictionary _Profiles;
- private static Queue _ProfileIDs;
+ private static Dictionary _Profiles;
private static Dictionary _Avatars;
private static Queue _AvatarIDs;
@@ -84,10 +83,7 @@ namespace Vocaluxe.Base
for (int i = 0; i < 1000; i++)
_AvatarIDs.Enqueue(i);
- _Profiles = new Dictionary();
- _ProfileIDs = new Queue(100);
- for (int i = 0; i < 100; i++)
- _ProfileIDs.Enqueue(i);
+ _Profiles = new Dictionary();
LoadProfiles();
}
@@ -117,7 +113,7 @@ namespace Vocaluxe.Base
if (newProf == null)
break;
- newProf.ID = _ProfileIDs.Dequeue();
+ newProf.ID = Guid.NewGuid();
if (newProf.Avatar == null)
newProf.Avatar = _Avatars.Values.First();
else if (newProf.Avatar.ID < 0)
@@ -256,7 +252,7 @@ namespace Vocaluxe.Base
}
}
- public static void DeleteProfile(int profileID)
+ public static void DeleteProfile(Guid profileID)
{
if (!IsProfileIDValid(profileID))
return;
@@ -305,7 +301,7 @@ namespace Vocaluxe.Base
return list.ToArray();
}
- public static CProfile GetProfile(int profileID)
+ public static CProfile GetProfile(Guid profileID)
{
if (!IsProfileIDValid(profileID))
return null;
@@ -324,7 +320,7 @@ namespace Vocaluxe.Base
return result;
}
- public static int NewProfile(string fileName = "")
+ public static Guid NewProfile(string fileName = "")
{
var profile = new CProfile
{
@@ -332,9 +328,9 @@ namespace Vocaluxe.Base
};
if (File.Exists(profile.FilePath))
- return -1;
+ return Guid.Empty;
- profile.ID = _ProfileIDs.Dequeue();
+ profile.ID = Guid.NewGuid();
_Profiles.Add(profile.ID, profile);
_ProfilesChanged = true;
return profile.ID;
@@ -354,11 +350,11 @@ namespace Vocaluxe.Base
public static void SaveProfiles()
{
- foreach (int id in _Profiles.Keys)
+ foreach (Guid id in _Profiles.Keys)
_Profiles[id].SaveProfile();
}
- public static bool IsProfileIDValid(int profileID)
+ public static bool IsProfileIDValid(Guid profileID)
{
return _Profiles.ContainsKey(profileID);
}
@@ -370,7 +366,7 @@ namespace Vocaluxe.Base
#endregion public methods
#region profile properties
- public static string GetPlayerName(int profileID, int playerNum = 0)
+ public static string GetPlayerName(Guid profileID, int playerNum = 0)
{
if (IsProfileIDValid(profileID))
return _Profiles[profileID].PlayerName;
@@ -381,7 +377,7 @@ namespace Vocaluxe.Base
return playerName;
}
- public static void SetPlayerName(int profileID, string playerName)
+ public static void SetPlayerName(Guid profileID, string playerName)
{
if (!IsProfileIDValid(profileID))
return;
@@ -389,7 +385,7 @@ namespace Vocaluxe.Base
_Profiles[profileID].PlayerName = playerName;
}
- public static string GetProfileFileName(int profileID)
+ public static string GetProfileFileName(Guid profileID)
{
if (!IsProfileIDValid(profileID))
return String.Empty;
@@ -397,7 +393,7 @@ namespace Vocaluxe.Base
return Path.GetFileName(_Profiles[profileID].FilePath);
}
- public static string AddGetPlayerName(int profileID, char chr)
+ public static string AddGetPlayerName(Guid profileID, char chr)
{
if (!IsProfileIDValid(profileID))
return String.Empty;
@@ -406,7 +402,7 @@ namespace Vocaluxe.Base
return _Profiles[profileID].PlayerName;
}
- public static string GetDeleteCharInPlayerName(int profileID)
+ public static string GetDeleteCharInPlayerName(Guid profileID)
{
if (!IsProfileIDValid(profileID))
return String.Empty;
@@ -418,12 +414,12 @@ namespace Vocaluxe.Base
return profile.PlayerName;
}
- public static EGameDifficulty GetDifficulty(int profileID)
+ public static EGameDifficulty GetDifficulty(Guid profileID)
{
return IsProfileIDValid(profileID) ? _Profiles[profileID].Difficulty : EGameDifficulty.TR_CONFIG_NORMAL;
}
- public static void SetDifficulty(int profileID, EGameDifficulty difficulty)
+ public static void SetDifficulty(Guid profileID, EGameDifficulty difficulty)
{
if (!IsProfileIDValid(profileID))
return;
@@ -431,12 +427,12 @@ namespace Vocaluxe.Base
_Profiles[profileID].Difficulty = difficulty;
}
- public static EUserRole GetUserRoleProfile(int profileID)
+ public static EUserRole GetUserRoleProfile(Guid profileID)
{
return IsProfileIDValid(profileID) ? _Profiles[profileID].UserRole : EUserRole.TR_USERROLE_GUEST;
}
- public static void SetUserRoleProfile(int profileID, EUserRole option)
+ public static void SetUserRoleProfile(Guid profileID, EUserRole option)
{
if (!IsProfileIDValid(profileID))
return;
@@ -446,12 +442,12 @@ namespace Vocaluxe.Base
_Profiles[profileID].UserRole = (_Profiles[profileID].UserRole & ~mask) | option;
}
- public static EOffOn GetActive(int profileID)
+ public static EOffOn GetActive(Guid profileID)
{
return IsProfileIDValid(profileID) ? _Profiles[profileID].Active : EOffOn.TR_CONFIG_OFF;
}
- public static void SetActive(int profileID, EOffOn option)
+ public static void SetActive(Guid profileID, EOffOn option)
{
if (!IsProfileIDValid(profileID))
return;
@@ -459,7 +455,7 @@ namespace Vocaluxe.Base
_Profiles[profileID].Active = option;
}
- public static bool IsGuestProfile(int profileID)
+ public static bool IsGuestProfile(Guid profileID)
{
if (!IsProfileIDValid(profileID))
return true; // this will prevent from saving dummy profiles to highscore db
@@ -467,14 +463,14 @@ namespace Vocaluxe.Base
return _Profiles[profileID].UserRole <= EUserRole.TR_USERROLE_GUEST;
}
- public static bool IsActive(int profileID)
+ public static bool IsActive(Guid profileID)
{
if (!IsProfileIDValid(profileID))
return false;
return _Profiles[profileID].Active == EOffOn.TR_CONFIG_ON;
}
- public static void SetAvatar(int profileID, int avatarID)
+ public static void SetAvatar(Guid profileID, int avatarID)
{
if (!IsProfileIDValid(profileID) || !IsAvatarIDValid(avatarID))
return;
@@ -482,7 +478,7 @@ namespace Vocaluxe.Base
_Profiles[profileID].Avatar = _Avatars[avatarID];
}
- public static int GetAvatarID(int profileID)
+ public static int GetAvatarID(Guid profileID)
{
if (!IsProfileIDValid(profileID) || _Profiles[profileID].Avatar == null)
return -1;
@@ -490,7 +486,7 @@ namespace Vocaluxe.Base
return _Profiles[profileID].Avatar.ID;
}
- public static CAvatar GetAvatar(int profileID)
+ public static CAvatar GetAvatar(Guid profileID)
{
if (!IsProfileIDValid(profileID))
return null;
@@ -498,7 +494,8 @@ namespace Vocaluxe.Base
return _Profiles[profileID].Avatar;
}
- public static int GetProfileID(int num)
+ //TODO: Remove this?
+ public static Guid GetProfileID(Guid num)
{
return _Profiles[num].ID;
}
@@ -513,7 +510,7 @@ namespace Vocaluxe.Base
return _Avatars[avatarID].Texture;
}
- public static CTextureRef GetAvatarTextureFromProfile(int profileID)
+ public static CTextureRef GetAvatarTextureFromProfile(Guid profileID)
{
if (!IsProfileIDValid(profileID) || _Profiles[profileID].Avatar == null)
return null;
@@ -530,9 +527,9 @@ namespace Vocaluxe.Base
var knownFiles = new List();
if (_Profiles.Count > 0)
{
- var ids = new int[_Profiles.Keys.Count];
+ var ids = new Guid[_Profiles.Keys.Count];
_Profiles.Keys.CopyTo(ids, 0);
- foreach (int id in ids)
+ foreach (Guid id in ids)
{
if (_Profiles[id].LoadProfile())
knownFiles.Add(Path.GetFileName(_Profiles[id].FilePath));
@@ -554,10 +551,7 @@ namespace Vocaluxe.Base
var profile = new CProfile();
if (profile.LoadProfile(file))
- {
- profile.ID = _ProfileIDs.Dequeue();
_Profiles.Add(profile.ID, profile);
- }
}
_ProfilesChanged = true;
}
@@ -597,7 +591,7 @@ namespace Vocaluxe.Base
_ProfilesChanged = true;
}
- private static void _DeleteProfile(int profileID)
+ private static void _DeleteProfile(Guid profileID)
{
if (!IsProfileIDValid(profileID))
return;
@@ -625,10 +619,8 @@ namespace Vocaluxe.Base
//Check if profile is selected in game
for (int i = 0; i < CGame.Players.Length; i++)
{
- if (CGame.Players[i].ProfileID > profileID)
- CGame.Players[i].ProfileID--;
- else if (CGame.Players[i].ProfileID == profileID)
- CGame.Players[i].ProfileID = -1;
+ if (CGame.Players[i].ProfileID == profileID)
+ CGame.Players[i].ProfileID = Guid.Empty;
}
}
catch (Exception)
@@ -638,7 +630,7 @@ namespace Vocaluxe.Base
_ProfilesChanged = true;
}
- private static void _RemoveProfile(int profileID)
+ private static void _RemoveProfile(Guid profileID)
{
if (!IsProfileIDValid(profileID))
return;
diff --git a/Vocaluxe/Base/Server/CVocaluxeServer.cs b/Vocaluxe/Base/Server/CVocaluxeServer.cs
index 477713b6..a377245c 100644
--- a/Vocaluxe/Base/Server/CVocaluxeServer.cs
+++ b/Vocaluxe/Base/Server/CVocaluxeServer.cs
@@ -388,7 +388,7 @@ namespace Vocaluxe.Base.Server
}
#region profile
- public static SProfileData GetProfileData(int profileId, bool isReadonly)
+ public static SProfileData GetProfileData(Guid profileId, bool isReadonly)
{
CProfile profile = CProfiles.GetProfile(profileId);
if (profile == null)
@@ -807,7 +807,7 @@ namespace Vocaluxe.Base.Server
#endregion
#region user management
- public static bool ValidatePassword(int profileId, string password)
+ public static bool ValidatePassword(Guid profileId, string password)
{
CProfile profile = CProfiles.GetProfile(profileId);
if (profile == null)
@@ -824,7 +824,7 @@ namespace Vocaluxe.Base.Server
return _Hash((new UTF8Encoding()).GetBytes(password), salt).SequenceEqual(profile.PasswordHash);
}
- public static bool ValidatePassword(int profileId, byte[] hashedPassword)
+ public static bool ValidatePassword(Guid profileId, byte[] hashedPassword)
{
CProfile profile = CProfiles.GetProfile(profileId);
if (profile == null)
@@ -841,7 +841,7 @@ namespace Vocaluxe.Base.Server
return hashedPassword.SequenceEqual(profile.PasswordHash);
}
- private static byte[] _GetPasswordSalt(int profileId)
+ private static byte[] _GetPasswordSalt(Guid profileId)
{
CProfile profile = CProfiles.GetProfile(profileId);
if (profile == null)
@@ -853,7 +853,7 @@ namespace Vocaluxe.Base.Server
return profile.PasswordSalt;
}
- public static int GetUserRole(int profileId)
+ public static int GetUserRole(Guid profileId)
{
CProfile profile = CProfiles.GetProfile(profileId);
if (profile == null)
@@ -865,7 +865,7 @@ namespace Vocaluxe.Base.Server
return (int)(profile.UserRole);
}
- public static void SetUserRole(int profileId, int userRole)
+ public static void SetUserRole(Guid profileId, int userRole)
{
CProfile profile = CProfiles.GetProfile(profileId);
if (profile == null)
@@ -884,9 +884,9 @@ namespace Vocaluxe.Base.Server
CProfiles.SaveProfiles();
}
- public static int GetUserIdFromUsername(string username)
+ public static Guid GetUserIdFromUsername(string username)
{
- IEnumerable playerIds = (from p in CProfiles.GetProfiles()
+ IEnumerable playerIds = (from p in CProfiles.GetProfiles()
where String.Equals(p.PlayerName, username, StringComparison.OrdinalIgnoreCase)
select p.ID);
try
diff --git a/Vocaluxe/Base/Server/CWebservice.cs b/Vocaluxe/Base/Server/CWebservice.cs
index 471caf34..e44606a1 100644
--- a/Vocaluxe/Base/Server/CWebservice.cs
+++ b/Vocaluxe/Base/Server/CWebservice.cs
@@ -61,7 +61,7 @@ namespace Vocaluxe.Base.Server
}
#region profile
- public int GetOwnProfileId()
+ public Guid GetOwnProfileId()
{
Guid sessionKey = _GetSession();
if (sessionKey == Guid.Empty)
@@ -71,17 +71,17 @@ namespace Vocaluxe.Base.Server
WebOperationContext.Current.OutgoingResponse.StatusCode = HttpStatusCode.Forbidden;
WebOperationContext.Current.OutgoingResponse.StatusDescription = "No session";
}
- return -1;
+ return Guid.Empty;
}
- int profileId = CSessionControl.GetUserIdFromSession(sessionKey);
- if (profileId < 0)
+ Guid profileId = CSessionControl.GetUserIdFromSession(sessionKey);
+ if (profileId == Guid.Empty)
{
if (WebOperationContext.Current != null)
{
WebOperationContext.Current.OutgoingResponse.StatusCode = HttpStatusCode.Forbidden;
WebOperationContext.Current.OutgoingResponse.StatusDescription = "No session";
}
- return -1;
+ return Guid.Empty;
}
return profileId;
}
@@ -90,7 +90,7 @@ namespace Vocaluxe.Base.Server
{
Guid sessionKey = _GetSession();
- if (profile.ProfileId != -1) //-1 is the id for a new profile
+ if (profile.ProfileId != Guid.Empty) //-1 is the id for a new profile
{
if (CSessionControl.GetUserIdFromSession(sessionKey) != profile.ProfileId
&& !(_CheckRight(EUserRights.EditAllProfiles)))
@@ -100,7 +100,7 @@ namespace Vocaluxe.Base.Server
CVocaluxeServer.DoTask(CVocaluxeServer.SendProfileData, profile);
}
- public SProfileData GetProfile(int profileId)
+ public SProfileData GetProfile(Guid profileId)
{
Guid sessionKey = _GetSession();
if (CSessionControl.GetUserIdFromSession(sessionKey) == profileId || _CheckRight(EUserRights.ViewOtherProfiles))
@@ -146,7 +146,7 @@ namespace Vocaluxe.Base.Server
public void Logout()
{
Guid sessionKey = _GetSession();
- CSessionControl.InvalidateSessions(sessionKey);
+ CSessionControl.InvalidateSessionByID(sessionKey);
}
public Stream Index()
@@ -501,12 +501,12 @@ namespace Vocaluxe.Base.Server
#endregion
#region user management
- public int GetUserRole(int profileId)
+ public int GetUserRole(Guid profileId)
{
return CVocaluxeServer.DoTask(CVocaluxeServer.GetUserRole, profileId);
}
- public void SetUserRole(int profileId, int userRole)
+ public void SetUserRole(Guid profileId, int userRole)
{
if (_CheckRight(EUserRights.EditAllProfiles))
CVocaluxeServer.DoTaskWithoutReturn(CVocaluxeServer.SetUserRole, profileId, userRole);
diff --git a/Vocaluxe/Base/Server/ICWebservice.cs b/Vocaluxe/Base/Server/ICWebservice.cs
index c34c12de..62fdb3d5 100644
--- a/Vocaluxe/Base/Server/ICWebservice.cs
+++ b/Vocaluxe/Base/Server/ICWebservice.cs
@@ -39,7 +39,7 @@ namespace Vocaluxe.Base.Server
[OperationContract, WebInvoke(Method = "GET",
ResponseFormat = WebMessageFormat.Json,
UriTemplate = "/getOwnProfileId")]
- int GetOwnProfileId();
+ Guid GetOwnProfileId();
[OperationContract, WebInvoke(Method = "POST",
ResponseFormat = WebMessageFormat.Json,
@@ -49,7 +49,7 @@ namespace Vocaluxe.Base.Server
[OperationContract, WebInvoke(Method = "GET",
ResponseFormat = WebMessageFormat.Json,
UriTemplate = "/getProfile?profileId={profileId}")]
- SProfileData GetProfile(int profileId);
+ SProfileData GetProfile(Guid profileId);
[OperationContract, WebInvoke(Method = "GET",
ResponseFormat = WebMessageFormat.Json,
@@ -195,12 +195,12 @@ namespace Vocaluxe.Base.Server
[OperationContract, WebInvoke(Method = "GET",
ResponseFormat = WebMessageFormat.Json,
UriTemplate = "/getUserRole?profileId={profileId}")]
- int GetUserRole(int profileId);
+ int GetUserRole(Guid profileId);
[OperationContract, WebInvoke(Method = "GET",
ResponseFormat = WebMessageFormat.Json,
UriTemplate = "/setUserRole?profileId={profileId}&userRole={userRole}")]
- void SetUserRole(int profileId, int userRole);
+ void SetUserRole(Guid profileId, int userRole);
[OperationContract, WebInvoke(Method = "GET",
ResponseFormat = WebMessageFormat.Json,
diff --git a/Vocaluxe/Base/Server/Session.cs b/Vocaluxe/Base/Server/Session.cs
index b2493d4c..43ff2ae8 100644
--- a/Vocaluxe/Base/Server/Session.cs
+++ b/Vocaluxe/Base/Server/Session.cs
@@ -27,8 +27,8 @@ namespace Vocaluxe.Base.Server
get { return _ID; }
}
- private readonly int _ProfileId;
- public int ProfileId
+ private readonly Guid _ProfileId;
+ public Guid ProfileId
{
get { return _ProfileId; }
}
@@ -46,7 +46,7 @@ namespace Vocaluxe.Base.Server
internal set { _LastSeen = value; }
}
- public CSession(Guid id, int profileId, EUserRoles roles)
+ public CSession(Guid id, Guid profileId, EUserRoles roles)
{
_ID = id;
_ProfileId = profileId;
diff --git a/Vocaluxe/Base/Server/SessionControl.cs b/Vocaluxe/Base/Server/SessionControl.cs
index 13d674b2..e0ee47db 100644
--- a/Vocaluxe/Base/Server/SessionControl.cs
+++ b/Vocaluxe/Base/Server/SessionControl.cs
@@ -44,7 +44,7 @@ namespace Vocaluxe.Base.Server
foreach (var sessionToRemove in sessionIdsToRemove)
{
- InvalidateSessions(sessionToRemove);
+ InvalidateSessionByID(sessionToRemove);
}
}
@@ -54,7 +54,7 @@ namespace Vocaluxe.Base.Server
return Guid.Empty;
Guid newId = Guid.NewGuid();
- int id = _GetProfileIdFormUsername(userName);
+ Guid id = _GetProfileIdFormUsername(userName);
EUserRoles roles = _GetUserRoles(id);
CSession session = new CSession(newId, id, roles);
//InvalidateSessions(id);
@@ -68,17 +68,17 @@ namespace Vocaluxe.Base.Server
return CVocaluxeServer.ValidatePassword(_GetProfileIdFormUsername(userName), password);
}
- private static int _GetProfileIdFormUsername(string username)
+ private static Guid _GetProfileIdFormUsername(string username)
{
return CVocaluxeServer.GetUserIdFromUsername(username);
}
- private static EUserRoles _GetUserRoles(int profileId)
+ private static EUserRoles _GetUserRoles(Guid profileId)
{
return (EUserRoles)CVocaluxeServer.GetUserRole(profileId);
}
- internal static void InvalidateSessions(int profileId)
+ internal static void InvalidateSessionByProfile(Guid profileId)
{
foreach (KeyValuePair s in (from kv in _ActiveSessions
where kv.Value.ProfileId == profileId
@@ -86,7 +86,7 @@ namespace Vocaluxe.Base.Server
_ActiveSessions.Remove(s.Key);
}
- internal static void InvalidateSessions(Guid sessionId)
+ internal static void InvalidateSessionByID(Guid sessionId)
{
if (_ActiveSessions.ContainsKey(sessionId))
{
@@ -100,10 +100,10 @@ namespace Vocaluxe.Base.Server
.HasFlag(requestedRight)));
}
- internal static int GetUserIdFromSession(Guid sessionId)
+ internal static Guid GetUserIdFromSession(Guid sessionId)
{
if (!_ActiveSessions.ContainsKey(sessionId))
- return -1;
+ return Guid.Empty;
return _ActiveSessions[sessionId].ProfileId;
}
diff --git a/Vocaluxe/Base/Server/VocaluxeStructs.cs b/Vocaluxe/Base/Server/VocaluxeStructs.cs
index 9cc5b327..3467f81d 100644
--- a/Vocaluxe/Base/Server/VocaluxeStructs.cs
+++ b/Vocaluxe/Base/Server/VocaluxeStructs.cs
@@ -56,7 +56,7 @@ namespace Vocaluxe.Base.Server
[DataMember]
public int Difficulty;
[DataMember]
- public int ProfileId;
+ public Guid ProfileId;
[DataMember]
public bool IsEditable;
[DataMember]
diff --git a/Vocaluxe/Screens/CScreenNames.cs b/Vocaluxe/Screens/CScreenNames.cs
index 3d573d35..3dd334a9 100644
--- a/Vocaluxe/Screens/CScreenNames.cs
+++ b/Vocaluxe/Screens/CScreenNames.cs
@@ -61,7 +61,7 @@ namespace Vocaluxe.Screens
private bool _SelectingFast;
private int _SelectingSwitchNr = -1;
private int _SelectingFastPlayerNr;
- private int _SelectedProfileID = -1;
+ private Guid _SelectedProfileID = Guid.Empty;
private bool _AvatarsChanged;
private bool _ProfilesChanged;
@@ -177,9 +177,9 @@ namespace Vocaluxe.Screens
{
case Keys.Enter:
//Check, if a player is selected
- if (_NameSelections[_NameSelection].Selection > -1)
+ if (_NameSelections[_NameSelection].SelectedID != Guid.Empty)
{
- _SelectedProfileID = _NameSelections[_NameSelection].Selection;
+ _SelectedProfileID = _NameSelections[_NameSelection].SelectedID;
if (!CProfiles.IsProfileIDValid(_SelectedProfileID))
return true;
@@ -359,7 +359,7 @@ namespace Vocaluxe.Screens
base.HandleMouse(mouseEvent);
//Check if LeftButton is hold and Select-Mode inactive
- if (mouseEvent.LBH && _SelectedProfileID < 0 && !_SelectingFast)
+ if (mouseEvent.LBH && _SelectedProfileID == Guid.Empty && !_SelectingFast)
{
//Save mouse-coords
_OldMouseX = mouseEvent.X;
@@ -368,8 +368,8 @@ namespace Vocaluxe.Screens
if (_NameSelections[_NameSelection].IsOverTile(mouseEvent))
{
//Get player-number of tile
- _SelectedProfileID = _NameSelections[_NameSelection].TilePlayerNr(mouseEvent);
- if (_SelectedProfileID != -1)
+ _SelectedProfileID = _NameSelections[_NameSelection].TilePlayerID(mouseEvent);
+ if (_SelectedProfileID != Guid.Empty)
{
//Update of Drag/Drop-Texture
CStatic selectedPlayer = _NameSelections[_NameSelection].TilePlayerAvatar(mouseEvent);
@@ -402,7 +402,7 @@ namespace Vocaluxe.Screens
}
//Check if LeftButton is hold and Select-Mode active
- if (mouseEvent.LBH && _SelectedProfileID >= 0 && !_SelectingFast)
+ if (mouseEvent.LBH && _SelectedProfileID != Guid.Empty && !_SelectingFast)
{
//Update coords for Drag/Drop-Texture
_ChooseAvatarStatic.X += mouseEvent.X - _OldMouseX;
@@ -411,7 +411,7 @@ namespace Vocaluxe.Screens
_OldMouseY = mouseEvent.Y;
}
// LeftButton isn't hold anymore, but Select-Mode is still active -> "Drop" of Avatar
- else if (_SelectedProfileID >= 0 && !_SelectingFast)
+ else if (_SelectedProfileID != Guid.Empty && !_SelectingFast)
{
//Foreach Drop-Area
for (int i = 0; i < _StaticPlayer.Length; i++)
@@ -422,7 +422,7 @@ namespace Vocaluxe.Screens
//Check if Mouse is in area
if (CHelper.IsInBounds(_Statics[_StaticPlayer[i]].Rect, mouseEvent))
{
- if (_SelectingSwitchNr > -1 && CGame.Players[i].ProfileID > -1)
+ if (_SelectingSwitchNr > -1 && CGame.Players[i].ProfileID != Guid.Empty)
_UpdateSelectedProfile(_SelectingSwitchNr, CGame.Players[i].ProfileID);
else if (_SelectingSwitchNr > -1)
_ResetPlayerSelection(_SelectingSwitchNr);
@@ -438,7 +438,7 @@ namespace Vocaluxe.Screens
_ResetPlayerSelection(_SelectingSwitchNr);
}
_SelectingSwitchNr = -1;
- _SelectedProfileID = -1;
+ _SelectedProfileID = Guid.Empty;
//Reset variables
_ChooseAvatarStatic.Visible = false;
}
@@ -448,8 +448,8 @@ namespace Vocaluxe.Screens
if (_NameSelections[_NameSelection].IsOverTile(mouseEvent))
{
//Get player-number of tile
- _SelectedProfileID = _NameSelections[_NameSelection].TilePlayerNr(mouseEvent);
- if (_SelectedProfileID != -1)
+ _SelectedProfileID = _NameSelections[_NameSelection].TilePlayerID(mouseEvent);
+ if (_SelectedProfileID != Guid.Empty)
{
if (!CProfiles.IsProfileIDValid(_SelectedProfileID))
return true;
@@ -480,12 +480,12 @@ namespace Vocaluxe.Screens
if (mouseEvent.LD && _NameSelections[_NameSelection].IsOverTile(mouseEvent) && !_SelectingFast)
{
- _SelectedProfileID = _NameSelections[_NameSelection].TilePlayerNr(mouseEvent);
- if (_SelectedProfileID > -1)
+ _SelectedProfileID = _NameSelections[_NameSelection].TilePlayerID(mouseEvent);
+ if (_SelectedProfileID != Guid.Empty)
{
for (int i = 0; i < CGame.NumPlayers; i++)
{
- if (CGame.Players[i].ProfileID == -1)
+ if (CGame.Players[i].ProfileID == Guid.Empty)
{
if (!CProfiles.IsProfileIDValid(_SelectedProfileID))
return true;
@@ -657,7 +657,7 @@ namespace Vocaluxe.Screens
_Statics["StaticPlayerAvatar" + i].Visible = true;
_Texts["TextPlayer" + i].Visible = true;
if (_Texts["TextPlayer" + i].Text == "")
- _Texts["TextPlayer" + i].Text = CProfiles.GetPlayerName(-1, i);
+ _Texts["TextPlayer" + i].Text = CProfiles.GetPlayerName(Guid.Empty, i);
_Equalizers["EqualizerPlayer" + i].Visible = true;
if (CGame.GetNumSongs() == 1 && CGame.GetSong(0).IsDuet)
_SelectSlides["SelectSlideDuetPlayer" + i].Visible = true;
@@ -677,7 +677,7 @@ namespace Vocaluxe.Screens
_CheckPlayers();
}
- private void _UpdateSelectedProfile(int playerNum, int profileId)
+ private void _UpdateSelectedProfile(int playerNum, Guid profileId)
{
_NameSelections[_NameSelection].RemoveUsedProfile(CGame.Players[playerNum].ProfileID);
_NameSelections[_NameSelection].UseProfile(profileId);
@@ -700,12 +700,12 @@ namespace Vocaluxe.Screens
for (int i = 0; i < CGame.NumPlayers; i++)
{
_NameSelections[_NameSelection].RemoveUsedProfile(CGame.Players[i].ProfileID);
- CGame.Players[i].ProfileID = -1;
+ CGame.Players[i].ProfileID = Guid.Empty;
//Update config for default players.
CConfig.Config.Game.Players[i] = String.Empty;
//Update texture and name
_Statics[_StaticPlayerAvatar[i]].Texture = _OriginalPlayerAvatarTextures[i];
- _Texts[_TextPlayer[i]].Text = CProfiles.GetPlayerName(-1, i + 1);
+ _Texts[_TextPlayer[i]].Text = CProfiles.GetPlayerName(Guid.Empty, i + 1);
}
_NameSelections[_NameSelection].UpdateList();
CConfig.SaveConfig();
@@ -714,13 +714,13 @@ namespace Vocaluxe.Screens
private void _ResetPlayerSelection(int playerNum)
{
_NameSelections[_NameSelection].RemoveUsedProfile(CGame.Players[playerNum].ProfileID);
- CGame.Players[playerNum].ProfileID = -1;
+ CGame.Players[playerNum].ProfileID = Guid.Empty;
//Update config for default players.
CConfig.Config.Game.Players[playerNum] = String.Empty;
CConfig.SaveConfig();
//Update texture and name
_Statics[_StaticPlayerAvatar[playerNum]].Texture = _OriginalPlayerAvatarTextures[playerNum];
- _Texts[_TextPlayer[playerNum]].Text = CProfiles.GetPlayerName(-1, playerNum + 1);
+ _Texts[_TextPlayer[playerNum]].Text = CProfiles.GetPlayerName(Guid.Empty, playerNum + 1);
//Update profile-warning
_CheckPlayers();
//Update Tiles-List
@@ -770,7 +770,7 @@ namespace Vocaluxe.Screens
var playerWithoutProfile = new List();
for (int player = 0; player < CConfig.Config.Game.NumPlayers; player++)
{
- if (CGame.Players[player].ProfileID < 0)
+ if (CGame.Players[player].ProfileID == Guid.Empty)
playerWithoutProfile.Add(player + 1);
}
diff --git a/Vocaluxe/Screens/CScreenProfiles.cs b/Vocaluxe/Screens/CScreenProfiles.cs
index f98a3c2e..a7365c0d 100644
--- a/Vocaluxe/Screens/CScreenProfiles.cs
+++ b/Vocaluxe/Screens/CScreenProfiles.cs
@@ -16,6 +16,7 @@
#endregion
using System;
+using System.Linq;
using System.Collections.Generic;
using System.Drawing;
using System.Drawing.Imaging;
@@ -62,6 +63,8 @@ namespace Vocaluxe.Screens
private bool _ProfilesChanged;
private bool _AvatarsChanged;
+ private Dictionary _SelectSlideGuids = new Dictionary();
+
private EEditMode _EditMode;
private CTextureRef _WebcamTexture;
@@ -109,7 +112,7 @@ namespace Vocaluxe.Screens
break;
case EEditMode.PlayerName:
_SelectSlides[_SelectSlideProfiles].RenameValue(
- CProfiles.AddGetPlayerName(_SelectSlides[_SelectSlideProfiles].SelectedTag, keyEvent.Unicode));
+ CProfiles.AddGetPlayerName(_GetIdFromTag(_SelectSlides[_SelectSlideProfiles].SelectedTag), keyEvent.Unicode));
_ProfilesChanged = true;
break;
}
@@ -155,7 +158,7 @@ namespace Vocaluxe.Screens
if (_EditMode == EEditMode.PlayerName)
{
_SelectSlides[_SelectSlideProfiles].RenameValue(
- CProfiles.GetDeleteCharInPlayerName(_SelectSlides[_SelectSlideProfiles].SelectedTag));
+ CProfiles.GetDeleteCharInPlayerName(_GetIdFromTag(_SelectSlides[_SelectSlideProfiles].SelectedTag)));
_ProfilesChanged = true;
}
else
@@ -168,22 +171,22 @@ namespace Vocaluxe.Screens
}
if (_SelectSlides[_SelectSlideDifficulty].Selected)
{
- CProfiles.SetDifficulty(_SelectSlides[_SelectSlideProfiles].SelectedTag,
+ CProfiles.SetDifficulty(_GetIdFromTag(_SelectSlides[_SelectSlideProfiles].SelectedTag),
(EGameDifficulty)_SelectSlides[_SelectSlideDifficulty].Selection);
}
else if (_SelectSlides[_SelectSlideAvatars].Selected)
{
- CProfiles.SetAvatar(_SelectSlides[_SelectSlideProfiles].SelectedTag,
+ CProfiles.SetAvatar(_GetIdFromTag(_SelectSlides[_SelectSlideProfiles].SelectedTag),
_SelectSlides[_SelectSlideAvatars].SelectedTag);
}
else if (_SelectSlides[_SelectSlideUserRole].Selected)
{
- CProfiles.SetUserRoleProfile(_SelectSlides[_SelectSlideProfiles].SelectedTag,
+ CProfiles.SetUserRoleProfile(_GetIdFromTag(_SelectSlides[_SelectSlideProfiles].SelectedTag),
(EUserRole)_SelectSlides[_SelectSlideUserRole].Selection);
}
else if (_SelectSlides[_SelectSlideActive].Selected)
{
- CProfiles.SetActive(_SelectSlides[_SelectSlideProfiles].SelectedTag,
+ CProfiles.SetActive(_GetIdFromTag(_SelectSlides[_SelectSlideProfiles].SelectedTag),
(EOffOn)_SelectSlides[_SelectSlideActive].Selection);
}
}
@@ -215,24 +218,24 @@ namespace Vocaluxe.Screens
}
else if (_SelectSlides[_SelectSlideDifficulty].Selected)
{
- CProfiles.SetDifficulty(_SelectSlides[_SelectSlideProfiles].SelectedTag,
+ CProfiles.SetDifficulty(_GetIdFromTag(_SelectSlides[_SelectSlideProfiles].SelectedTag),
(EGameDifficulty)_SelectSlides[_SelectSlideDifficulty].Selection);
}
else if (_SelectSlides[_SelectSlideAvatars].Selected)
{
- CProfiles.SetAvatar(_SelectSlides[_SelectSlideProfiles].SelectedTag,
+ CProfiles.SetAvatar(_GetIdFromTag(_SelectSlides[_SelectSlideProfiles].SelectedTag),
_SelectSlides[_SelectSlideAvatars].SelectedTag);
if (CWebcam.IsDeviceAvailable() && _WebcamTexture != null)
_OnDiscardSnapshot();
}
else if (_SelectSlides[_SelectSlideUserRole].Selected)
{
- CProfiles.SetUserRoleProfile(_SelectSlides[_SelectSlideProfiles].SelectedTag,
+ CProfiles.SetUserRoleProfile(_GetIdFromTag(_SelectSlides[_SelectSlideProfiles].SelectedTag),
(EUserRole)_SelectSlides[_SelectSlideUserRole].Selection);
}
else if (_SelectSlides[_SelectSlideActive].Selected)
{
- CProfiles.SetActive(_SelectSlides[_SelectSlideProfiles].SelectedTag,
+ CProfiles.SetActive(_GetIdFromTag(_SelectSlides[_SelectSlideProfiles].SelectedTag),
(EOffOn)_SelectSlides[_SelectSlideActive].Selection);
}
else if (_Buttons[_ButtonWebcam].Selected)
@@ -260,15 +263,15 @@ namespace Vocaluxe.Screens
if (_SelectSlides[_SelectSlideProfiles].Selection > -1)
{
- _Buttons[_ButtonPlayerName].Text.Text = CProfiles.GetPlayerName(_SelectSlides[_SelectSlideProfiles].SelectedTag);
+ _Buttons[_ButtonPlayerName].Text.Text = CProfiles.GetPlayerName(_GetIdFromTag(_SelectSlides[_SelectSlideProfiles].SelectedTag));
if (_EditMode == EEditMode.PlayerName)
_Buttons[_ButtonPlayerName].Text.Text += "|";
- _SelectSlides[_SelectSlideDifficulty].Selection = (int)CProfiles.GetDifficulty(_SelectSlides[_SelectSlideProfiles].SelectedTag);
- _SelectSlides[_SelectSlideUserRole].Selection = (int)CProfiles.GetUserRoleProfile(_SelectSlides[_SelectSlideProfiles].SelectedTag);
- _SelectSlides[_SelectSlideActive].Selection = (int)CProfiles.GetActive(_SelectSlides[_SelectSlideProfiles].SelectedTag);
+ _SelectSlides[_SelectSlideDifficulty].Selection = (int)CProfiles.GetDifficulty(_GetIdFromTag(_SelectSlides[_SelectSlideProfiles].SelectedTag));
+ _SelectSlides[_SelectSlideUserRole].Selection = (int)CProfiles.GetUserRoleProfile(_GetIdFromTag(_SelectSlides[_SelectSlideProfiles].SelectedTag));
+ _SelectSlides[_SelectSlideActive].Selection = (int)CProfiles.GetActive(_GetIdFromTag(_SelectSlides[_SelectSlideProfiles].SelectedTag));
- int avatarID = CProfiles.GetAvatarID(_SelectSlides[_SelectSlideProfiles].SelectedTag);
+ int avatarID = CProfiles.GetAvatarID(_GetIdFromTag(_SelectSlides[_SelectSlideProfiles].SelectedTag));
_SelectSlides[_SelectSlideAvatars].SelectedTag = avatarID;
if (_Snapshot == null)
{
@@ -363,7 +366,7 @@ namespace Vocaluxe.Screens
_Buttons[_ButtonWebcam].Visible = CWebcam.IsDeviceAvailable();
int id = CProfiles.NewAvatar(file);
- CProfiles.SetAvatar(_SelectSlides[_SelectSlideProfiles].SelectedTag, id);
+ CProfiles.SetAvatar(_GetIdFromTag(_SelectSlides[_SelectSlideProfiles].SelectedTag), id);
_LoadAvatars(false);
_SelectElement(_Buttons[_ButtonSave]);
@@ -389,11 +392,13 @@ namespace Vocaluxe.Screens
private void _NewProfile()
{
_EditMode = EEditMode.None;
- int id = CProfiles.NewProfile();
+ Guid id = CProfiles.NewProfile();
_LoadProfiles(false);
- _SelectSlides[_SelectSlideProfiles].SelectedTag = id;
+ int num = CProfiles.NumProfiles;
+ _SelectSlides[_SelectSlideProfiles].SelectedTag = num;
+ _SelectSlideGuids.Add(num, id);
- CProfiles.SetAvatar(_SelectSlides[_SelectSlideProfiles].SelectedTag, _SelectSlides[_SelectSlideAvatars].SelectedTag);
+ CProfiles.SetAvatar(id, _SelectSlides[_SelectSlideAvatars].SelectedTag);
_SelectElement(_Buttons[_ButtonPlayerName]);
_EditMode = EEditMode.PlayerName;
@@ -409,7 +414,8 @@ namespace Vocaluxe.Screens
{
_EditMode = EEditMode.None;
- CProfiles.DeleteProfile(_SelectSlides[_SelectSlideProfiles].SelectedTag);
+ CProfiles.DeleteProfile(_GetIdFromTag(_SelectSlides[_SelectSlideProfiles].SelectedTag));
+ _SelectSlideGuids.Remove(_SelectSlides[_SelectSlideProfiles].SelectedTag);
int selection = _SelectSlides[_SelectSlideProfiles].Selection;
if (_SelectSlides[_SelectSlideProfiles].NumValues - 1 > selection)
@@ -422,23 +428,29 @@ namespace Vocaluxe.Screens
{
string name = String.Empty;
if (_EditMode == EEditMode.PlayerName)
- name = CProfiles.GetPlayerName(_SelectSlides[_SelectSlideProfiles].SelectedTag);
+ name = CProfiles.GetPlayerName(_GetIdFromTag(_SelectSlides[_SelectSlideProfiles].SelectedTag));
- int selectedProfileID = _SelectSlides[_SelectSlideProfiles].SelectedTag;
+ Guid selectedProfileID = _GetIdFromTag(_SelectSlides[_SelectSlideProfiles].SelectedTag);
_SelectSlides[_SelectSlideProfiles].Clear();
+ _SelectSlideGuids.Clear();
CProfile[] profiles = CProfiles.GetProfiles();
+ int i = 0;
foreach (CProfile profile in profiles)
- _SelectSlides[_SelectSlideProfiles].AddValue(profile.PlayerName, null, profile.ID);
+ {
+ _SelectSlides[_SelectSlideProfiles].AddValue(profile.PlayerName, null, i);
+ _SelectSlideGuids.Add(i, profile.ID);
+ i++;
+ }
if (CProfiles.NumProfiles > 0 && CProfiles.NumAvatars > 0)
{
- if (selectedProfileID != -1)
- _SelectSlides[_SelectSlideProfiles].SelectedTag = selectedProfileID;
+ if (selectedProfileID != Guid.Empty)
+ _SelectSlides[_SelectSlideProfiles].SelectedTag = _SelectSlideGuids.FirstOrDefault(x => x.Value.Equals(selectedProfileID)).Key;
else
{
_SelectSlides[_SelectSlideProfiles].Selection = 0;
- selectedProfileID = _SelectSlides[_SelectSlideProfiles].SelectedTag;
+ selectedProfileID = _GetIdFromTag(_SelectSlides[_SelectSlideProfiles].SelectedTag);
}
if (!keep)
@@ -450,7 +462,7 @@ namespace Vocaluxe.Screens
}
if (_EditMode == EEditMode.PlayerName)
- CProfiles.SetPlayerName(_SelectSlides[_SelectSlideProfiles].SelectedTag, name);
+ CProfiles.SetPlayerName(_GetIdFromTag(_SelectSlides[_SelectSlideProfiles].SelectedTag), name);
}
_ProfilesChanged = false;
}
@@ -469,12 +481,20 @@ namespace Vocaluxe.Screens
if (keep)
{
_SelectSlides[_SelectSlideAvatars].SelectedTag = selectedAvatarID;
- CProfiles.SetAvatar(_SelectSlides[_SelectSlideProfiles].SelectedTag, selectedAvatarID);
+ CProfiles.SetAvatar(_GetIdFromTag(_SelectSlides[_SelectSlideProfiles].SelectedTag), selectedAvatarID);
}
else
- _SelectSlides[_SelectSlideAvatars].SelectedTag = CProfiles.GetAvatarID(_SelectSlides[_SelectSlideProfiles].SelectedTag);
+ _SelectSlides[_SelectSlideAvatars].SelectedTag = CProfiles.GetAvatarID(_GetIdFromTag(_SelectSlides[_SelectSlideProfiles].SelectedTag));
_AvatarsChanged = false;
}
+
+ private Guid _GetIdFromTag(int tag)
+ {
+ if (tag == -1 || !_SelectSlideGuids.ContainsKey(tag))
+ return Guid.Empty;
+ else
+ return _SelectSlideGuids[tag];
+ }
}
}
\ No newline at end of file
diff --git a/Vocaluxe/Screens/CScreenSing.cs b/Vocaluxe/Screens/CScreenSing.cs
index d2e4f120..d55e6bc3 100644
--- a/Vocaluxe/Screens/CScreenSing.cs
+++ b/Vocaluxe/Screens/CScreenSing.cs
@@ -78,6 +78,8 @@ namespace Vocaluxe.Screens
private const string _ButtonCancel = "ButtonCancel";
private const string _ButtonContinue = "ButtonContinue";
+ private const string _ButtonRestartRound = "ButtonRestartRound";
+ private const string _ButtonRestartGame = "ButtonRestartGame";
private const string _ButtonSkip = "ButtonSkip";
private const string _LyricMain = "LyricMain";
@@ -170,7 +172,7 @@ namespace Vocaluxe.Screens
_CreateProgressBars();
_AssignPlayerElements();
- _ThemeButtons = new string[] { _ButtonCancel, _ButtonContinue, _ButtonSkip };
+ _ThemeButtons = new string[] { _ButtonCancel, _ButtonContinue, _ButtonRestartGame, _ButtonRestartRound, _ButtonSkip };
_ThemeLyrics = new string[] { _LyricMain, _LyricSub, _LyricMainDuet, _LyricSubDuet, _LyricMainTop, _LyricSubTop };
_ThemeSingNotes = new string[] { _SingBars };
@@ -260,6 +262,10 @@ namespace Vocaluxe.Screens
_SetPause(false);
if (_Buttons[_ButtonCancel].Selected)
_Stop();
+ if (_Buttons[_ButtonRestartGame].Selected)
+ _RestartGame();
+ if (_Buttons[_ButtonRestartRound].Selected)
+ _RestartRound();
if (_Buttons[_ButtonSkip].Selected)
{
_NextSong();
@@ -301,10 +307,18 @@ namespace Vocaluxe.Screens
{
if (_Buttons[_ButtonContinue].Selected)
_SetPause(false);
-
if (_Buttons[_ButtonCancel].Selected)
_Stop();
-
+ if (_Buttons[_ButtonRestartGame].Selected)
+ {
+ _RestartGame();
+ _SetPause(false);
+ }
+ if (_Buttons[_ButtonRestartRound].Selected)
+ {
+ _RestartRound();
+ _SetPause(false);
+ }
if (_Buttons[_ButtonSkip].Selected)
{
_NextSong();
@@ -312,10 +326,76 @@ namespace Vocaluxe.Screens
}
}
-
return true;
}
+ #region screen-handling
+ public override void OnShow()
+ {
+ base.OnShow();
+
+ _InitiatePlayerStatics();
+ _InitiatePlayerStrings();
+ _InitiateProgressBars();
+ if (_StaticsExtra == null)
+ _CreateExtraStatics();
+ if (_TextsExtra == null)
+ _CreateExtraTexts();
+
+ _FadeOut = false;
+
+ _CurrentVideo = null;
+ _CurrentWebcamFrameTexture = null;
+ _CurrentBeat = -100;
+ _CurrentTime = 0f;
+ _FinishTime = 0f;
+ _Length = -1f;
+ _TimeToFirstNote = 0f;
+ _TimeToFirstNoteDuet = 0f;
+ _SetPause(false);
+
+ _TimeRects.Clear();
+
+ _SingNotes[_SingBars].Init(0);
+ _AssignPlayerElements();
+
+ foreach (CLyric lyric in _Lyrics)
+ lyric.LyricStyle = CConfig.Config.Theme.LyricStyle;
+
+ for (int p = 0; p < CGame.NumPlayers; p++)
+ {
+ _Statics[_PlayerStaticAvatar[p]].Aspect = EAspect.Crop;
+ _Texts[_PlayerTextScore[p]].Color = new SColorF(CBase.Themes.GetPlayerColor(p + 1), _Texts[_PlayerTextScore[p]].Color.A);
+ }
+
+ _SetVisibility();
+
+ _UpdateAvatars();
+ _UpdateNames();
+
+ _CloseSong();
+ }
+
+ public override void OnShowFinish()
+ {
+ base.OnShowFinish();
+
+ CGame.Start();
+ _NextSong();
+ }
+
+ public override void OnClose()
+ {
+ base.OnClose();
+ _CloseSong();
+ if (_Webcam)
+ CWebcam.Stop();
+ CBackgroundMusic.Disabled = false;
+ }
+ #endregion
+
+ #region update game
+
public override bool UpdateGame()
{
bool finish = false;
@@ -412,364 +492,6 @@ namespace Vocaluxe.Screens
return true;
}
- public override void OnShow()
- {
- base.OnShow();
-
- _InitiatePlayerStatics();
- _InitiatePlayerStrings();
- _InitiateProgressBars();
- if (_StaticsExtra == null)
- _CreateExtraStatics();
- if (_TextsExtra == null)
- _CreateExtraTexts();
-
- _FadeOut = false;
-
- _CurrentVideo = null;
- _CurrentWebcamFrameTexture = null;
- _CurrentBeat = -100;
- _CurrentTime = 0f;
- _FinishTime = 0f;
- _Length = -1f;
- _TimeToFirstNote = 0f;
- _TimeToFirstNoteDuet = 0f;
- _SetPause(false);
-
- _TimeRects.Clear();
-
- _SingNotes[_SingBars].Init(0);
- _AssignPlayerElements();
-
- foreach (CLyric lyric in _Lyrics)
- lyric.LyricStyle = CConfig.Config.Theme.LyricStyle;
-
- for (int p = 0; p < CGame.NumPlayers; p++)
- {
- _Statics[_PlayerStaticAvatar[p]].Aspect = EAspect.Crop;
- _Texts[_PlayerTextScore[p]].Color = new SColorF(CBase.Themes.GetPlayerColor(p + 1), _Texts[_PlayerTextScore[p]].Color.A);
- }
-
- _SetVisibility();
-
- _UpdateAvatars();
- _UpdateNames();
-
- _CloseSong();
- }
-
- public override void OnShowFinish()
- {
- base.OnShowFinish();
-
- CGame.Start();
- _NextSong();
- }
-
- public override void Draw()
- {
- if (_Active)
- {
- CTextureRef background;
- var aspect = EAspect.Crop;
- if (_CurrentVideo != null && CConfig.Config.Video.VideosInSongs == EOffOn.TR_CONFIG_ON && !_Webcam)
- {
- background = _CurrentVideo.Texture;
- aspect = _VideoAspect;
- }
- else if (_Webcam)
- {
- background = _CurrentWebcamFrameTexture;
- aspect = _VideoAspect;
- }
- else
- background = _Background;
- if (background != null)
- {
- SRectF bounds = CSettings.RenderRect;
- SRectF rect = CHelper.FitInBounds(bounds, background.OrigAspect, aspect);
- CDraw.DrawTexture(background, rect, background.Color, bounds);
- }
- else if (_SlideShow != null)
- _SlideShow.Draw();
- }
-
- base.Draw();
-
- switch (CConfig.Config.Theme.TimerLook)
- {
- case ETimerLook.TR_CONFIG_TIMERLOOK_NORMAL:
- CDraw.DrawTexture(_Statics[_StaticTimeLine].Texture, _Statics[_StaticTimeLine].Rect, new SColorF(1, 1, 1, 1), _TimeLineRect);
- break;
- case ETimerLook.TR_CONFIG_TIMERLOOK_EXPANDED:
- for (int i = 0; i < _TimeRects.Count; i++)
- CDraw.DrawTexture(_TimeRects[i].Rect.Texture, _Statics[_StaticTimeLine].Rect, _TimeRects[i].Rect.Color, _TimeRects[i].Rect.Rect);
- break;
- }
-
- _DrawLyricHelper();
- }
-
- public override void OnClose()
- {
- base.OnClose();
- _CloseSong();
- if (_Webcam)
- CWebcam.Stop();
- CBackgroundMusic.Disabled = false;
- }
-
- private void _CloseSong()
- {
- if (_CurrentStream > -1)
- {
- CSound.FadeAndClose(_CurrentStream, 0, 0.5f);
- _CurrentStream = -1;
- }
- CRecord.Stop();
- if (_CurrentVideo != null)
- CVideo.Close(ref _CurrentVideo);
- CDraw.RemoveTexture(ref _Background);
-
- if (_SlideShow != null)
- _SlideShow.RemoveSlideShowTextures();
-
- _Lyrics[_LyricMain].Clear();
- _Lyrics[_LyricSub].Clear();
- _Lyrics[_LyricMainDuet].Clear();
- _Lyrics[_LyricSubDuet].Clear();
- _Lyrics[_LyricMainTop].Clear();
- _Lyrics[_LyricSubTop].Clear();
- _Texts[_TextSongName].Text = String.Empty;
- _Texts[_TextDuetName1].Text = String.Empty;
- _Texts[_TextDuetName2].Text = String.Empty;
- _Texts[_TextMedleyCountdown].Visible = false;
- _Texts[_TextMedleyCountdown].Text = String.Empty;
- }
-
- private void _RestartRound()
- {
- _CloseSong();
-
- CGame.ResetPlayer();
- _LoadCurrentSong();
-
- _StartSong();
- }
-
- private void _RestartGame()
- {
- _CloseSong();
-
- CGame.Reset();
- CGame.ResetPlayer();
- CGame.NextRound();
- _LoadCurrentSong();
-
- _StartSong();
- }
-
- private void _NextSong()
- {
- _CloseSong();
-
- CGame.NextRound();
- _LoadCurrentSong();
-
- _StartSong();
- }
-
- private void _LoadCurrentSong()
- {
- if (CGame.IsFinished())
- {
- _FinishedSinging();
- return;
- }
-
- CSong song = CGame.GetSong();
-
- if (song == null)
- {
- CLog.LogError("Critical Error! ScreenSing.LoadNextSong() song is null!");
- return;
- }
-
- string songname = song.Artist + " - " + song.Title;
- int rounds = CGame.GetNumSongs();
- if (rounds > 1)
- songname += " (" + CGame.RoundNr + "/" + rounds + ")";
- _Texts[_TextSongName].Text = songname;
-
- _CurrentStream = CSound.Load(song.GetMP3(), false, true, CConfig.Config.Sound.KaraokeEffect == EOffOn.TR_CONFIG_ON ? EAudioEffect.Karaoke : EAudioEffect.None);
- CSound.SetStreamVolume(_CurrentStream, 100);
- CSound.SetPosition(_CurrentStream, song.Start);
- _CurrentTime = song.Start;
- _FinishTime = song.Finish;
- _TimeToFirstNote = 0f;
- _TimeToFirstNoteDuet = 0f;
- _Length = -1f;
- var voiceAssignments = new int[CGame.NumPlayers];
- if (song.IsDuet)
- {
- //Save duet-assignment before resetting
- for (int i = 0; i < voiceAssignments.Length; i++)
- voiceAssignments[i] = CGame.Players[i].VoiceNr;
- }
- CGame.ResetPlayer();
-
- if (!String.IsNullOrEmpty(song.VideoFileName))
- {
- _CurrentVideo = CVideo.Load(Path.Combine(song.Folder, song.VideoFileName));
- CVideo.Skip(_CurrentVideo, song.Start, song.VideoGap);
- _VideoAspect = song.VideoAspect;
- }
-
- CDraw.RemoveTexture(ref _Background);
- if (song.BackgroundFileNames.Count > 1)
- {
- _SlideShow = GetNewBackground();
- foreach (string bgFile in song.BackgroundFileNames)
- _SlideShow.AddSlideShowTexture(Path.Combine(song.Folder, bgFile));
- }
- else if (song.BackgroundFileNames.Count == 1)
- {
- if (!String.IsNullOrEmpty(song.BackgroundFileNames[0]))
- _Background = CDraw.AddTexture(Path.Combine(song.Folder, song.BackgroundFileNames[0]));
- }
-
- if (song.IsDuet)
- {
- //TODO: Show more than 2 voicenames
- _Texts[_TextDuetName1].Text = song.Notes.VoiceNames[0];
- _Texts[_TextDuetName2].Text = song.Notes.VoiceNames[1];
- //More than one song: Player is not assigned to line by user
- //Otherwise, this is done by CScreenNames
- if (CGame.GetNumSongs() > 1)
- {
- for (int i = 0; i < CGame.NumPlayers; i++)
- CGame.Players[i].VoiceNr = (i + 1) % 2;
- }
- else
- {
- for (int i = 0; i < CGame.NumPlayers; i++)
- CGame.Players[i].VoiceNr = voiceAssignments[i];
- }
- }
-
- //Attention: This needs to be done after player-assignment!
- _SingNotes[_SingBars].Init(CGame.NumPlayers, CConfig.Config.Graphics.NumScreens);
-
- _DynamicLyricsTop = false;
- _DynamicLyricsBottom = false;
-
- foreach (CNoteBars notes in _SingNotes[_SingBars].PlayerNotes)
- {
- if (notes.Rect.Bottom >= CSettings.RenderH / 2)
- _DynamicLyricsBottom = true;
- else
- _DynamicLyricsTop = true;
- }
-
- for (int p = 0; p < CGame.NumPlayers; p++)
- _ProgressBars[_PlayerProgressBarRating[p]].Reset();
-
- _SetNormalLyricsVisibility();
-
- _TimerSongText.Reset();
- _TimerDuetText1.Reset();
- _TimerDuetText2.Reset();
-
- if (!song.IsDuet)
- _TimerSongText.Start();
- }
-
- private void _SetNormalLyricsVisibility()
- {
- bool bottomLyricsVisible = CConfig.Config.Game.LyricsPosition == ELyricsPosition.TR_CONFIG_LYRICSPOSITION_BOTTOM
- || CConfig.Config.Game.LyricsPosition == ELyricsPosition.TR_CONFIG_LYRICSPOSITION_BOTH
- || (CConfig.Config.Game.LyricsPosition == ELyricsPosition.TR_CONFIG_LYRICSPOSITION_DYNAMIC && _DynamicLyricsBottom);
-
- bool topLyricsVisible = CConfig.Config.Game.LyricsPosition == ELyricsPosition.TR_CONFIG_LYRICSPOSITION_TOP
- || CConfig.Config.Game.LyricsPosition == ELyricsPosition.TR_CONFIG_LYRICSPOSITION_BOTH
- || (CConfig.Config.Game.LyricsPosition == ELyricsPosition.TR_CONFIG_LYRICSPOSITION_DYNAMIC && _DynamicLyricsTop);
-
- bool duetLyricsVisible = false;
-
- if (CGame.GetSong() != null && CGame.GetSong().IsDuet)
- {
- bottomLyricsVisible = true;
- topLyricsVisible = false;
- duetLyricsVisible = true;
- }
-
- _Lyrics[_LyricMain].Visible = bottomLyricsVisible;
- _Lyrics[_LyricSub].Visible = bottomLyricsVisible;
- _Statics[_StaticLyrics].Visible = bottomLyricsVisible;
-
- _Lyrics[_LyricMainTop].Visible = topLyricsVisible;
- _Lyrics[_LyricSubTop].Visible = topLyricsVisible;
- _Statics[_StaticLyricsTop].Visible = topLyricsVisible;
-
- _Lyrics[_LyricMainDuet].Visible = duetLyricsVisible;
- _Lyrics[_LyricSubDuet].Visible = duetLyricsVisible;
- _Statics[_StaticLyricsDuet].Visible = duetLyricsVisible;
- }
-
- private void _StartSong()
- {
- _PrepareTimeLine();
- CSound.Play(_CurrentStream);
- CRecord.Start();
- if (_Webcam)
- CWebcam.Start();
- }
-
- private void _Stop()
- {
- //Need this to set other songs to points-var
- while (!CGame.IsFinished())
- {
- CGame.NextRound();
- CGame.ResetPlayer();
- }
-
- _FinishedSinging();
- }
-
- private void _FinishedSinging()
- {
- _FadeOut = true;
- CParty.FinishedSinging();
-
- if (_Webcam)
- CWebcam.Stop();
- }
-
- private int _FindCurrentLine(CVoice voice, CSongLine[] lines, CSong song)
- {
- 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!
- int j = voice.FindPreviousLine(_CurrentBeat);
- for (; j >= 0; j--)
- {
- float firstNoteTime = CGame.GetTimeFromBeats(lines[j].FirstNoteBeat, song.BPM);
- //Earlist possible line break is 10s before first note
- if (firstNoteTime <= currentTime + 10f)
- {
- //First line has no predecessor or line has to be shown
- if (j == 0 || firstNoteTime - CConfig.Config.Game.MinLineBreakTime <= currentTime)
- return j;
- float lastNoteTime = CGame.GetTimeFromBeats(lines[j - 1].LastNoteBeat, song.BPM);
- //No line break if last line is not fully evaluated (with 50% tolerance -> tested so notes are drawn)
- if (lastNoteTime + CConfig.Config.Record.MicDelay / 1000f * 1.5f >= currentTime)
- return j - 1;
- return j;
- }
- }
- return -1;
- }
-
private void _UpdateLyrics()
{
if (_FadeOut)
@@ -860,392 +582,6 @@ namespace Vocaluxe.Screens
}
}
-
- private void _TogglePause()
- {
- _SetPause(!_Pause);
- }
-
- private void _SetPause(bool paused)
- {
- _Pause = paused;
-
- foreach(String s in _StaticsPause)
- _Statics[s].Visible = _Pause;
-
- foreach(String s in _TextsPause)
- _Texts[s].Visible = _Pause;
-
- _Buttons[_ButtonCancel].Visible = _Pause;
- _Buttons[_ButtonContinue].Visible = _Pause;
- _Buttons[_ButtonSkip].Visible = _Pause && CGame.NumRounds > CGame.RoundNr && CGame.NumRounds > 1;
-
- if (_Pause)
- CSound.Pause(_CurrentStream);
- else
- CSound.Play(_CurrentStream);
- }
-
- private void _BuildTextStrings(List texts)
- {
- _TextScores = new string[CSettings.MaxNumScreens, CSettings.MaxNumPlayer, CSettings.MaxNumPlayer];
- _TextNames = new string[CSettings.MaxNumScreens, CSettings.MaxNumPlayer, CSettings.MaxNumPlayer];
-
- for (int numplayer = 0; numplayer < CSettings.MaxNumPlayer; numplayer++)
- {
- for (int player = 0; player < CSettings.MaxNumPlayer; player++)
- {
- if (player <= numplayer)
- {
- string target = "P" + (player + 1) + "N" + (numplayer + 1);
- for (int screen = 0; screen < CSettings.MaxNumScreens; screen++)
- {
- _TextScores[screen, player, numplayer] = "TextScoreS" + (screen + 1) + target;
- _TextNames[screen, player, numplayer] = "TextNameS" + (screen + 1) + target;
- }
- texts.Add("TextScore" + target);
- texts.Add("TextName" + target);
-
- }
- }
- }
- }
-
- private void _CreatePlayerStrings()
- {
- for (int screen = 0; screen < CSettings.MaxNumScreens; screen++)
- {
- for (int numplayer = 0; numplayer < CSettings.MaxNumPlayer; numplayer++)
- {
- for (int player = 0; player < CSettings.MaxNumPlayer; player++)
- {
- if (player <= numplayer)
- {
- string target = "P" + (player + 1) + "N" + (numplayer + 1);
- _AddText(GetNewText(), "TextScoreS" + (screen + 1) + "P" + (player + 1) + "N" + (numplayer + 1));
- _AddText(GetNewText(), "TextNameS" + (screen + 1) + "P" + (player + 1) + "N" + (numplayer + 1));
- }
- }
- }
- }
- }
-
- private void _InitiatePlayerStrings()
- {
- for (int screen = 0; screen < CSettings.MaxNumScreens; screen++)
- {
- for (int numplayer = 0; numplayer < CSettings.MaxNumPlayer; numplayer++)
- {
- for (int player = 0; player < CSettings.MaxNumPlayer; player++)
- {
- if (player <= numplayer)
- {
- string target = "P" + (player + 1) + "N" + (numplayer + 1);
- _Texts["TextName" + target].Visible = false;
- _Texts["TextNameS" + (screen + 1) + target] = GetNewText(_Texts["TextName" + target]);
- _Texts["TextNameS" + (screen + 1) + target].X += screen * CSettings.RenderW;
-
- _Texts["TextScore" + target].Visible = false;
- _Texts["TextScoreS" + (screen + 1) + target] = GetNewText(_Texts["TextScore" + target]);
- _Texts["TextScoreS" + (screen + 1) + target].X += screen * CSettings.RenderW;
- }
- }
- }
- }
- }
-
- private void _BuildStaticStrings(ref List statics)
- {
- _StaticScores = new string[CSettings.MaxNumScreens, CSettings.MaxNumPlayer, CSettings.MaxNumPlayer];
- _StaticAvatars = new string[CSettings.MaxNumScreens, CSettings.MaxNumPlayer, CSettings.MaxNumPlayer];
-
- for (int numplayer = 0; numplayer < CSettings.MaxNumPlayer; numplayer++)
- {
- for (int player = 0; player < CSettings.MaxNumPlayer; player++)
- {
- if (player <= numplayer)
- {
- string target = "P" + (player + 1) + "N" + (numplayer + 1);
- for (int screen = 0; screen < CSettings.MaxNumScreens; screen++)
- {
- _StaticScores[screen, player, numplayer] = "StaticScoreS" + (screen + 1) + target;
- _StaticAvatars[screen, player, numplayer] = "StaticAvatarS" + (screen + 1) + target;
- }
- statics.Add("StaticScore" + target);
- statics.Add("StaticAvatar" + target);
-
- }
- }
- }
- }
-
- private void _CreatePlayerStatics()
- {
- for (int screen = 0; screen < CSettings.MaxNumScreens; screen++)
- {
- for (int numplayer = 0; numplayer < CSettings.MaxNumPlayer; numplayer++)
- {
- for (int player = 0; player < CSettings.MaxNumPlayer; player++)
- {
- if (player <= numplayer)
- {
- string target = "P" + (player + 1) + "N" + (numplayer + 1);
- _AddStatic(GetNewStatic(), "StaticScoreS" + (screen + 1) + "P" + (player + 1) + "N" + (numplayer + 1));
- _AddStatic(GetNewStatic(), "StaticAvatarS" + (screen + 1) + "P" + (player + 1) + "N" + (numplayer + 1));
- }
- }
- }
- }
- }
-
- private void _InitiatePlayerStatics()
- {
- for (int screen = 0; screen < CSettings.MaxNumScreens; screen++)
- {
- for (int numplayer = 0; numplayer < CSettings.MaxNumPlayer; numplayer++)
- {
- for (int player = 0; player < CSettings.MaxNumPlayer; player++)
- {
- if (player <= numplayer)
- {
- string target = "P" + (player + 1) + "N" + (numplayer + 1);
- _Statics["StaticAvatar" + target].Visible = false;
- _Statics["StaticAvatarS" + (screen + 1) + target] = GetNewStatic(_Statics["StaticAvatar" + target]);
- _Statics["StaticAvatarS" + (screen + 1) + target].X += screen * CSettings.RenderW;
-
- _Statics["StaticScore" + target].Visible = false;
- _Statics["StaticScoreS" + (screen + 1) + target] = GetNewStatic(_Statics["StaticScore" + target]);
- _Statics["StaticScoreS" + (screen + 1) + target].X += screen * CSettings.RenderW;
- }
- }
- }
- }
- }
-
- private void _BuildProgressBarStrings(ref List progressbars)
- {
- _ProgressBarsRating = new string[CSettings.MaxNumScreens, CSettings.MaxNumPlayer, CSettings.MaxNumPlayer];
- for (int screen = 0; screen < CSettings.MaxNumScreens; screen++)
- {
- for (int numplayer = 0; numplayer < CSettings.MaxNumPlayer; numplayer++)
- {
- for (int player = 0; player < CSettings.MaxNumPlayer; player++)
- {
- if (player <= numplayer)
- {
- string target = "P" + (player + 1) + "N" + (numplayer + 1);
- _ProgressBarsRating[screen, player, numplayer] = "ProgressBarRatingS" + (screen + 1) + target;
- progressbars.Add("ProgressBarRating" + target);
- }
- }
- }
- }
- }
-
- private void _CreateProgressBars()
- {
- for (int screen = 0; screen < CSettings.MaxNumScreens; screen++)
- {
- for (int numplayer = 0; numplayer < CSettings.MaxNumPlayer; numplayer++)
- {
- for (int player = 0; player < CSettings.MaxNumPlayer; player++)
- {
- if (player <= numplayer)
- {
- string target = "P" + (player + 1) + "N" + (numplayer + 1);
- _AddProgressBar(GetNewProgressBar(), "ProgressBarRatingS" + (screen + 1) + "P" + (player + 1) + "N" + (numplayer + 1));
- }
- }
- }
- }
- }
-
- private void _InitiateProgressBars()
- {
- for (int screen = 0; screen < CSettings.MaxNumScreens; screen++)
- {
- for (int numplayer = 0; numplayer < CSettings.MaxNumPlayer; numplayer++)
- {
- for (int player = 0; player < CSettings.MaxNumPlayer; player++)
- {
- if (player <= numplayer)
- {
- string target = "P" + (player + 1) + "N" + (numplayer + 1);
- _ProgressBars["ProgressBarRating" + target].Visible = false;
- _ProgressBars["ProgressBarRatingS" + (screen + 1) + target] = GetNewProgressBar(_ProgressBars["ProgressBarRating" + target]);
- _ProgressBars["ProgressBarRatingS" + (screen + 1) + target].X += screen * CSettings.RenderW;
- }
- }
- }
- }
- }
-
- private void _CreateExtraStatics()
- {
- _StaticsExtra = new List[CSettings.MaxNumScreens];
-
- List extraStatics = new List();
-
- foreach (CStatic se in _Statics)
- {
- if (se.GetThemeName() != null && se.GetThemeName().StartsWith("StaticExtra"))
- {
- extraStatics.Add(se.GetThemeName());
- _Statics[se.GetThemeName()].Visible = false;
- }
- }
-
- for (int screen = 0; screen < CSettings.MaxNumScreens; screen++)
- {
- _StaticsExtra[screen] = new List();
- foreach (string es in extraStatics)
- {
- string name = "S" + (screen + 1) + es;
- _AddStatic(GetNewStatic(), name);
- _Statics[name] = GetNewStatic(_Statics[es]);
- _Statics[name].X += screen * CSettings.RenderW;
- _Statics[name].AllMonitors = false;
- _StaticsExtra[screen].Add(name);
- }
-
- }
- }
-
- private void _CreateExtraTexts()
- {
- _TextsExtra = new List[CSettings.MaxNumScreens];
-
- List extraTexts = new List();
-
- foreach (CText te in _Texts)
- {
- if (te.GetThemeName() != null && te.GetThemeName().StartsWith("TextExtra"))
- {
- extraTexts.Add(te.GetThemeName());
- _Texts[te.GetThemeName()].Visible = false;
- }
- }
-
- for (int screen = 0; screen < CSettings.MaxNumScreens; screen++)
- {
- _TextsExtra[screen] = new List();
- foreach (string et in extraTexts)
- {
- string name = "S" + (screen + 1) + et;
- _AddText(GetNewText(), name);
- _Texts[name] = GetNewText(_Texts[et]);
- _Texts[name].X += screen * CSettings.RenderW;
- _Texts[name].AllMonitors = false;
- _TextsExtra[screen].Add(name);
- }
-
- }
- }
-
- private void _SetVisibility()
- {
- _Statics[_StaticLyricsDuet].Visible = false;
- _Statics[_StaticLyricHelper].Visible = false;
- _Statics[_StaticLyricHelperDuet].Visible = false;
- _Statics[_StaticLyricHelperTop].Visible = false;
- _Lyrics[_LyricMainDuet].Visible = false;
- _Lyrics[_LyricSubDuet].Visible = false;
-
- _Statics[_StaticSongText].Visible = false;
- _Texts[_TextSongName].Visible = false;
- _Texts[_TextDuetName1].Visible = false;
- _Texts[_TextDuetName2].Visible = false;
-
- int screenPlayers = CGame.NumPlayers / CConfig.GetNumScreens();
- int remainingScreenPlayers = CGame.NumPlayers - (screenPlayers * CConfig.GetNumScreens());
-
- for (int screen = 0; screen < CSettings.MaxNumScreens; screen++)
- {
- int currentScreenPlayers = screenPlayers;
-
- if (remainingScreenPlayers > 0)
- {
- currentScreenPlayers++;
- remainingScreenPlayers--;
- }
-
- string curN = "N" + currentScreenPlayers;
- string curS = "S" + (screen + 1);
-
- foreach (string se in _StaticsExtra[screen])
- {
- string n = se.Substring(se.Length - 2);
- string s = se.Substring(0, 2);
- //Make StaticExtra elements with matching player number and active screen visible
- if (n == curN && s == curS && screen < CConfig.GetNumScreens())
- _Statics[se].Visible = true;
- else
- _Statics[se].Visible = false;
- }
-
- foreach (string te in _TextsExtra[screen])
- {
- string n = te.Substring(te.Length - 2);
- string s = te.Substring(0, 2);
- //Make TextExtra elements with matching player number and active screen visible
- if (n == curN && s == curS && screen < CConfig.GetNumScreens())
- _Texts[te].Visible = true;
- else
- _Texts[te].Visible = false;
- }
-
- for (int numplayer = 0; numplayer < CSettings.MaxNumPlayer; numplayer++)
- {
- for (int player = 0; player < CSettings.MaxNumPlayer && player <= numplayer; player++)
- {
- _Texts[_TextScores[screen, player, numplayer]].AllMonitors = false;
- _Texts[_TextScores[screen, player, numplayer]].Visible = false;
- _Texts[_TextNames[screen, player, numplayer]].AllMonitors = false;
- _Texts[_TextNames[screen, player, numplayer]].Visible = false;
- _Statics[_StaticScores[screen, player, numplayer]].AllMonitors = false;
- _Statics[_StaticScores[screen, player, numplayer]].Visible = false;
- _Statics[_StaticAvatars[screen, player, numplayer]].AllMonitors = false;
- _Statics[_StaticAvatars[screen, player, numplayer]].Visible = false;
- _ProgressBars[_ProgressBarsRating[screen, player, numplayer]].AllMonitors = false;
- _ProgressBars[_ProgressBarsRating[screen, player, numplayer]].Visible = false;
- }
- }
- }
-
- for (int player = 0; player < CGame.NumPlayers; player++)
- {
- _Texts[_PlayerTextScore[player]].Visible = true;
- _Texts[_PlayerTextName[player]].Visible = (CConfig.Config.Theme.PlayerInfo == EPlayerInfo.TR_CONFIG_PLAYERINFO_BOTH ||
- CConfig.Config.Theme.PlayerInfo == EPlayerInfo.TR_CONFIG_PLAYERINFO_NAME);
- _Statics[_PlayerStaticScore[player]].Visible = true;
- _Statics[_PlayerStaticAvatar[player]].Visible = (CConfig.Config.Theme.PlayerInfo == EPlayerInfo.TR_CONFIG_PLAYERINFO_BOTH ||
- CConfig.Config.Theme.PlayerInfo == EPlayerInfo.TR_CONFIG_PLAYERINFO_AVATAR);
- _ProgressBars[_PlayerProgressBarRating[player]].Visible = true;
- }
-
- _Lyrics[_LyricMain].Alpha = 0f;
- _Lyrics[_LyricSub].Alpha = 0f;
-
- _Lyrics[_LyricMainTop].Alpha = 0f;
- _Lyrics[_LyricSubTop].Alpha = 0f;
-
- _Statics[_StaticLyrics].Alpha = 0f;
- _Statics[_StaticLyricsTop].Alpha = 0f;
-
- _Statics[_StaticLyricHelper].Alpha = 0f;
- _Statics[_StaticLyricHelperTop].Alpha = 0f;
-
- _Lyrics[_LyricMainDuet].Alpha = 0f;
- _Lyrics[_LyricSubDuet].Alpha = 0f;
-
- _Statics[_StaticLyricsDuet].Alpha = 0f;
- _Statics[_StaticLyricHelperDuet].Alpha = 0f;
-
- _Statics[_StaticTimeLine].Visible = CConfig.Config.Theme.TimerLook == ETimerLook.TR_CONFIG_TIMERLOOK_NORMAL;
- _Statics[_StaticTimeLineExpandedHighlighted].Visible = false;
- _Statics[_StaticTimeLineExpandedNormal].Visible = false;
- }
-
private void _UpdateMedleyCountdown()
{
CSong song = CGame.GetSong();
@@ -1271,189 +607,6 @@ namespace Vocaluxe.Screens
_Texts[_TextMedleyCountdown].Visible = false;
}
- private void _DrawLyricHelper()
- {
- if (_FadeOut)
- return;
-
- if (!CSound.IsPlaying(_CurrentStream) && !CSound.IsPaused(_CurrentStream))
- return;
-
- CSong song = CGame.GetSong();
-
- if (song == null)
- return;
-
- float alpha = (float)((Math.Cos(_CurrentTime * Math.PI * 2) + 1) / 2.0) / 2f + 0.5f;
-
- if (_TimeToFirstNote > CSettings.LyricHelperMinTime && _RemainingTimeToFirstNote > 0f && _RemainingTimeToFirstNote < CSettings.LyricHelperEnableTime)
- {
- float time = _RemainingTimeToFirstNote;
- float totaltime = CSettings.LyricHelperMoveTime;
-
- if (totaltime > _TimeToFirstNote)
- totaltime = _TimeToFirstNote;
-
- if (time > totaltime)
- time = totaltime;
-
- if (_Statics[_StaticLyrics].Visible)
- {
- SRectF rect = _Statics[_StaticLyricHelper].Rect;
- var color = new SColorF(
- _Statics[_StaticLyricHelper].Color.R,
- _Statics[_StaticLyricHelper].Color.G,
- _Statics[_StaticLyricHelper].Color.B,
- _Statics[_StaticLyricHelper].Color.A * _Statics[_StaticLyricHelper].Alpha * alpha);
-
- float distance = _Lyrics[_LyricMain].GetCurrentLyricPosX() - rect.X - rect.W;
- CDraw.DrawTexture(_Statics[_StaticLyricHelper].Texture,
- new SRectF(rect.X + distance * (1f - time / totaltime), rect.Y, rect.W, rect.H, rect.Z), color);
- }
-
- if (_Statics[_StaticLyricsTop].Visible)
- {
- SRectF rect = _Statics[_StaticLyricHelperTop].Rect;
- var color = new SColorF(
- _Statics[_StaticLyricHelperTop].Color.R,
- _Statics[_StaticLyricHelperTop].Color.G,
- _Statics[_StaticLyricHelperTop].Color.B,
- _Statics[_StaticLyricHelperTop].Color.A * _Statics[_StaticLyricHelper].Alpha * alpha);
-
- float distance = _Lyrics[_LyricMainTop].GetCurrentLyricPosX() - rect.X - rect.W;
- CDraw.DrawTexture(_Statics[_StaticLyricHelperTop].Texture,
- new SRectF(rect.X + distance * (1f - time / totaltime), rect.Y, rect.W, rect.H, rect.Z), color);
- }
- }
-
- if (song.IsDuet)
- {
- if (_TimeToFirstNoteDuet > CSettings.LyricHelperMinTime && _RemainingTimeToFirstNoteDuet > 0f && _RemainingTimeToFirstNoteDuet < CSettings.LyricHelperEnableTime)
- {
- float time = _RemainingTimeToFirstNoteDuet;
- float totaltime = CSettings.LyricHelperMoveTime;
-
- if (totaltime > _TimeToFirstNoteDuet)
- totaltime = _TimeToFirstNoteDuet;
-
- if (time > totaltime)
- time = totaltime;
-
- SRectF rect = _Statics[_StaticLyricHelperDuet].Rect;
-
- var color = new SColorF(
- _Statics[_StaticLyricHelperDuet].Color.R,
- _Statics[_StaticLyricHelperDuet].Color.G,
- _Statics[_StaticLyricHelperDuet].Color.B,
- _Statics[_StaticLyricHelperDuet].Color.A * _Statics[_StaticLyricHelperDuet].Alpha * alpha);
-
- float distance = _Lyrics[_LyricMainDuet].GetCurrentLyricPosX() - rect.X - rect.W;
- CDraw.DrawTexture(_Statics[_StaticLyricHelperDuet].Texture,
- new SRectF(rect.X + distance * (1f - time / totaltime), rect.Y, rect.W, rect.H, rect.Z),
- color);
- }
- }
- }
-
- private float[] _CalcFadingAlpha()
- {
- const float dt = 4f;
- const float rt = dt * 0.8f;
-
- CSong song = CGame.GetSong();
- if (song == null || !song.NotesLoaded)
- return null;
-
- var alpha = new float[song.Notes.VoiceCount * 2];
- float currentTime = _CurrentTime - song.Gap;
-
- for (int i = 0; i < song.Notes.VoiceCount; i++)
- {
- CVoice voice = song.Notes.GetVoice(i);
- CSongLine[] lines = voice.Lines;
-
- // find current line for lyric sub fading
- int currentLineSub = _FindCurrentLine(voice, lines, song);
-
- // find current line for lyric main fading
- int currentLine = 0;
- for (int j = 0; j < lines.Length; j++)
- {
- if (lines[j].FirstNoteBeat <= _CurrentBeat)
- currentLine = j;
- }
-
- // default values
- alpha[i * 2] = 1f;
- alpha[i * 2 + 1] = 1f;
-
- // main line alpha
- if (currentLine == 0 && currentTime < CGame.GetTimeFromBeats(lines[currentLine].FirstNoteBeat, song.BPM))
- {
- // first main line and fist note is not reached
- // => fade in
- float diff = CGame.GetTimeFromBeats(lines[currentLine].FirstNoteBeat, song.BPM) - currentTime;
- if (diff > dt)
- alpha[i * 2] = 1f - (diff - dt) / rt;
- }
- else if (currentLine < lines.Length - 1 && CGame.GetTimeFromBeats(lines[currentLine].LastNoteBeat, song.BPM) < currentTime &&
- CGame.GetTimeFromBeats(lines[currentLine + 1].FirstNoteBeat, song.BPM) > currentTime)
- {
- // current position is between two lines
-
- // time between the to lines
- float diff = CGame.GetTimeFromBeats(lines[currentLine + 1].FirstNoteBeat, song.BPM) -
- CGame.GetTimeFromBeats(lines[currentLine].LastNoteBeat, song.BPM);
-
- // fade only if there is enough time for fading
- if (diff > 3.3f * dt)
- {
- // time elapsed since last line
- float last = currentTime - CGame.GetTimeFromBeats(lines[currentLine].LastNoteBeat, song.BPM);
-
- // time to next line
- float next = CGame.GetTimeFromBeats(lines[currentLine + 1].FirstNoteBeat, song.BPM) - currentTime;
-
- if (last < next)
- {
- // fade out
- alpha[i * 2] = 1f - last / rt;
- }
- else
- {
- // fade in if it is time for
- if (next > dt)
- alpha[i * 2] = 1f - (next - dt) / rt;
- }
- }
- }
- else if (currentLine == lines.Length - 1 && CGame.GetTimeFromBeats(lines[currentLine].LastNoteBeat, song.BPM) < currentTime)
- {
- // last main line and last note was reached
- // => fade out
- float diff = currentTime - CGame.GetTimeFromBeats(lines[currentLine].LastNoteBeat, song.BPM);
- alpha[i * 2] = 1f - diff / rt;
- }
-
- // sub
- if (currentLineSub < lines.Length - 2)
- {
- float diff = CGame.GetTimeFromBeats(lines[currentLineSub + 1].FirstNoteBeat, song.BPM) - currentTime;
-
- if (diff > dt)
- alpha[i * 2 + 1] = 1f - (diff - dt) / rt;
- }
-
- if (alpha[i * 2] < 0f)
- alpha[i * 2] = 0f;
-
- if (alpha[i * 2 + 1] < 0f)
- alpha[i * 2 + 1] = 0f;
- }
-
- return alpha;
- }
-
private void _UpdateSongText()
{
if (_TimerSongText.IsRunning && !_Lyrics[_LyricMainDuet].Visible && !_Lyrics[_LyricMainTop].Visible)
@@ -1620,6 +773,919 @@ namespace Vocaluxe.Screens
}
}
+ private void _UpdateRatingBars()
+ {
+ for (int i = 0; i < CGame.NumPlayers; i++)
+ {
+ _ProgressBars[_PlayerProgressBarRating[i]].Progress = (float)CGame.Players[i].Rating;
+ }
+ }
+
+ #endregion
+
+ #region drawing
+ public override void Draw()
+ {
+ if (_Active)
+ {
+ CTextureRef background;
+ var aspect = EAspect.Crop;
+ if (_CurrentVideo != null && CConfig.Config.Video.VideosInSongs == EOffOn.TR_CONFIG_ON && !_Webcam)
+ {
+ background = _CurrentVideo.Texture;
+ aspect = _VideoAspect;
+ }
+ else if (_Webcam)
+ {
+ background = _CurrentWebcamFrameTexture;
+ aspect = _VideoAspect;
+ }
+ else
+ background = _Background;
+ if (background != null)
+ {
+ SRectF bounds = CSettings.RenderRect;
+ SRectF rect = CHelper.FitInBounds(bounds, background.OrigAspect, aspect);
+ CDraw.DrawTexture(background, rect, background.Color, bounds);
+ }
+ else if (_SlideShow != null)
+ _SlideShow.Draw();
+ }
+
+ base.Draw();
+
+ switch (CConfig.Config.Theme.TimerLook)
+ {
+ case ETimerLook.TR_CONFIG_TIMERLOOK_NORMAL:
+ CDraw.DrawTexture(_Statics[_StaticTimeLine].Texture, _Statics[_StaticTimeLine].Rect, new SColorF(1, 1, 1, 1), _TimeLineRect);
+ break;
+ case ETimerLook.TR_CONFIG_TIMERLOOK_EXPANDED:
+ for (int i = 0; i < _TimeRects.Count; i++)
+ CDraw.DrawTexture(_TimeRects[i].Rect.Texture, _Statics[_StaticTimeLine].Rect, _TimeRects[i].Rect.Color, _TimeRects[i].Rect.Rect);
+ break;
+ }
+
+ _DrawLyricHelper();
+ }
+
+ private void _DrawLyricHelper()
+ {
+ if (_FadeOut)
+ return;
+
+ if (!CSound.IsPlaying(_CurrentStream) && !CSound.IsPaused(_CurrentStream))
+ return;
+
+ CSong song = CGame.GetSong();
+
+ if (song == null)
+ return;
+
+ float alpha = (float)((Math.Cos(_CurrentTime * Math.PI * 2) + 1) / 2.0) / 2f + 0.5f;
+
+ if (_TimeToFirstNote > CSettings.LyricHelperMinTime && _RemainingTimeToFirstNote > 0f && _RemainingTimeToFirstNote < CSettings.LyricHelperEnableTime)
+ {
+ float time = _RemainingTimeToFirstNote;
+ float totaltime = CSettings.LyricHelperMoveTime;
+
+ if (totaltime > _TimeToFirstNote)
+ totaltime = _TimeToFirstNote;
+
+ if (time > totaltime)
+ time = totaltime;
+
+ if (_Statics[_StaticLyrics].Visible)
+ {
+ SRectF rect = _Statics[_StaticLyricHelper].Rect;
+ var color = new SColorF(
+ _Statics[_StaticLyricHelper].Color.R,
+ _Statics[_StaticLyricHelper].Color.G,
+ _Statics[_StaticLyricHelper].Color.B,
+ _Statics[_StaticLyricHelper].Color.A * _Statics[_StaticLyricHelper].Alpha * alpha);
+
+ float distance = _Lyrics[_LyricMain].GetCurrentLyricPosX() - rect.X - rect.W;
+ CDraw.DrawTexture(_Statics[_StaticLyricHelper].Texture,
+ new SRectF(rect.X + distance * (1f - time / totaltime), rect.Y, rect.W, rect.H, rect.Z), color);
+ }
+
+ if (_Statics[_StaticLyricsTop].Visible)
+ {
+ SRectF rect = _Statics[_StaticLyricHelperTop].Rect;
+ var color = new SColorF(
+ _Statics[_StaticLyricHelperTop].Color.R,
+ _Statics[_StaticLyricHelperTop].Color.G,
+ _Statics[_StaticLyricHelperTop].Color.B,
+ _Statics[_StaticLyricHelperTop].Color.A * _Statics[_StaticLyricHelper].Alpha * alpha);
+
+ float distance = _Lyrics[_LyricMainTop].GetCurrentLyricPosX() - rect.X - rect.W;
+ CDraw.DrawTexture(_Statics[_StaticLyricHelperTop].Texture,
+ new SRectF(rect.X + distance * (1f - time / totaltime), rect.Y, rect.W, rect.H, rect.Z), color);
+ }
+ }
+
+ if (song.IsDuet)
+ {
+ if (_TimeToFirstNoteDuet > CSettings.LyricHelperMinTime && _RemainingTimeToFirstNoteDuet > 0f && _RemainingTimeToFirstNoteDuet < CSettings.LyricHelperEnableTime)
+ {
+ float time = _RemainingTimeToFirstNoteDuet;
+ float totaltime = CSettings.LyricHelperMoveTime;
+
+ if (totaltime > _TimeToFirstNoteDuet)
+ totaltime = _TimeToFirstNoteDuet;
+
+ if (time > totaltime)
+ time = totaltime;
+
+ SRectF rect = _Statics[_StaticLyricHelperDuet].Rect;
+
+ var color = new SColorF(
+ _Statics[_StaticLyricHelperDuet].Color.R,
+ _Statics[_StaticLyricHelperDuet].Color.G,
+ _Statics[_StaticLyricHelperDuet].Color.B,
+ _Statics[_StaticLyricHelperDuet].Color.A * _Statics[_StaticLyricHelperDuet].Alpha * alpha);
+
+ float distance = _Lyrics[_LyricMainDuet].GetCurrentLyricPosX() - rect.X - rect.W;
+ CDraw.DrawTexture(_Statics[_StaticLyricHelperDuet].Texture,
+ new SRectF(rect.X + distance * (1f - time / totaltime), rect.Y, rect.W, rect.H, rect.Z),
+ color);
+ }
+ }
+ }
+ #endregion
+
+ #region game-handling
+
+ ///
+ /// Start recording and playing current loaded song.
+ ///
+ private void _StartSong()
+ {
+ _PrepareTimeLine();
+ CSound.Play(_CurrentStream);
+ CRecord.Start();
+ if (_Webcam)
+ CWebcam.Start();
+ }
+
+ ///
+ /// Stop singing and skip all possible unsung songs.
+ ///
+ private void _Stop()
+ {
+ _CloseSong();
+
+ //Need this to set other songs to points-var
+ while (!CGame.IsFinished())
+ {
+ CGame.NextRound();
+ CGame.ResetPlayer();
+ }
+
+ _FinishedSinging();
+ }
+
+ ///
+ /// Singing is finished, stop webcam and call PartyMode method.
+ ///
+ private void _FinishedSinging()
+ {
+ _FadeOut = true;
+ CParty.FinishedSinging();
+
+ if (_Webcam)
+ CWebcam.Stop();
+ }
+
+ ///
+ /// Restart current round: Only sing current song again.
+ ///
+ private void _RestartRound()
+ {
+ _CloseSong();
+
+ CGame.ResetPlayer();
+ _LoadCurrentSong();
+
+ _StartSong();
+ }
+
+ ///
+ /// Restart complete game: If there is more than one song, sing every song again.
+ ///
+ private void _RestartGame()
+ {
+ _CloseSong();
+
+ CGame.Reset();
+ CGame.ResetPlayer();
+ CGame.NextRound();
+
+ _LoadCurrentSong();
+
+ _StartSong();
+ }
+
+ ///
+ /// Load next song.
+ ///
+ private void _NextSong()
+ {
+ _CloseSong();
+
+ CGame.NextRound();
+ CGame.ResetPlayer();
+
+ _LoadCurrentSong();
+
+ _StartSong();
+ }
+ private void _TogglePause()
+ {
+ _SetPause(!_Pause);
+ }
+
+ private void _SetPause(bool paused)
+ {
+ _Pause = paused;
+
+ foreach (String s in _StaticsPause)
+ _Statics[s].Visible = _Pause;
+
+ foreach (String s in _TextsPause)
+ _Texts[s].Visible = _Pause;
+
+ _Buttons[_ButtonCancel].Visible = _Pause;
+ _Buttons[_ButtonContinue].Visible = _Pause;
+ _Buttons[_ButtonSkip].Visible = _Pause && CGame.NumRounds > CGame.RoundNr && CGame.NumRounds > 1;
+ _Buttons[_ButtonRestartGame].Visible = _Pause;
+ _Buttons[_ButtonRestartRound].Visible = _Pause && CGame.NumRounds > 1;
+
+ if (_Pause)
+ CSound.Pause(_CurrentStream);
+ else
+ CSound.Play(_CurrentStream);
+ }
+ #endregion
+
+ #region song-handling
+ ///
+ /// Prepare streams and screen for current song.
+ ///
+ private void _LoadCurrentSong()
+ {
+ if (CGame.IsFinished())
+ {
+ _FinishedSinging();
+ return;
+ }
+
+ CSong song = CGame.GetSong();
+
+ if (song == null)
+ {
+ CLog.LogError("Critical Error! ScreenSing.LoadNextSong() song is null!");
+ return;
+ }
+
+ string songname = song.Artist + " - " + song.Title;
+ int rounds = CGame.GetNumSongs();
+ if (rounds > 1)
+ songname += " (" + CGame.RoundNr + "/" + rounds + ")";
+ _Texts[_TextSongName].Text = songname;
+
+ _CurrentStream = CSound.Load(song.GetMP3(), false, true, CConfig.Config.Sound.KaraokeEffect == EOffOn.TR_CONFIG_ON ? EAudioEffect.Karaoke : EAudioEffect.None);
+ CSound.SetStreamVolume(_CurrentStream, 100);
+ CSound.SetPosition(_CurrentStream, song.Start);
+ _CurrentTime = song.Start;
+ _FinishTime = song.Finish;
+ _TimeToFirstNote = 0f;
+ _TimeToFirstNoteDuet = 0f;
+ _Length = -1f;
+ var voiceAssignments = new int[CGame.NumPlayers];
+ if (song.IsDuet)
+ {
+ //Save duet-assignment before resetting
+ for (int i = 0; i < voiceAssignments.Length; i++)
+ voiceAssignments[i] = CGame.Players[i].VoiceNr;
+ }
+
+ if (!String.IsNullOrEmpty(song.VideoFileName))
+ {
+ _CurrentVideo = CVideo.Load(Path.Combine(song.Folder, song.VideoFileName));
+ CVideo.Skip(_CurrentVideo, song.Start, song.VideoGap);
+ _VideoAspect = song.VideoAspect;
+ }
+
+ CDraw.RemoveTexture(ref _Background);
+ if (song.BackgroundFileNames.Count > 1)
+ {
+ _SlideShow = GetNewBackground();
+ foreach (string bgFile in song.BackgroundFileNames)
+ _SlideShow.AddSlideShowTexture(Path.Combine(song.Folder, bgFile));
+ }
+ else if (song.BackgroundFileNames.Count == 1)
+ {
+ if (!String.IsNullOrEmpty(song.BackgroundFileNames[0]))
+ _Background = CDraw.AddTexture(Path.Combine(song.Folder, song.BackgroundFileNames[0]));
+ }
+
+ if (song.IsDuet)
+ {
+ //TODO: Show more than 2 voicenames
+ _Texts[_TextDuetName1].Text = song.Notes.VoiceNames[0];
+ _Texts[_TextDuetName2].Text = song.Notes.VoiceNames[1];
+ //More than one song: Player is not assigned to line by user
+ //Otherwise, this is done by CScreenNames
+ if (CGame.GetNumSongs() > 1)
+ {
+ for (int i = 0; i < CGame.NumPlayers; i++)
+ CGame.Players[i].VoiceNr = (i + 1) % 2;
+ }
+ else
+ {
+ for (int i = 0; i < CGame.NumPlayers; i++)
+ CGame.Players[i].VoiceNr = voiceAssignments[i];
+ }
+ }
+
+ //Attention: This needs to be done after player-assignment!
+ _SingNotes[_SingBars].Init(CGame.NumPlayers, CConfig.Config.Graphics.NumScreens);
+
+ _DynamicLyricsTop = false;
+ _DynamicLyricsBottom = false;
+
+ foreach (CNoteBars notes in _SingNotes[_SingBars].PlayerNotes)
+ {
+ if (notes.Rect.Bottom >= CSettings.RenderH / 2)
+ _DynamicLyricsBottom = true;
+ else
+ _DynamicLyricsTop = true;
+ }
+
+ for (int p = 0; p < CGame.NumPlayers; p++)
+ _ProgressBars[_PlayerProgressBarRating[p]].Reset();
+
+ _SetNormalLyricsVisibility();
+
+ _TimerSongText.Reset();
+ _TimerDuetText1.Reset();
+ _TimerDuetText2.Reset();
+
+ if (!song.IsDuet)
+ _TimerSongText.Start();
+ }
+
+ ///
+ /// Stop playing audio/video, recording and clear some ui-elements.
+ ///
+ private void _CloseSong()
+ {
+ if (_CurrentStream > -1)
+ {
+ CSound.FadeAndClose(_CurrentStream, 0, 0.5f);
+ _CurrentStream = -1;
+ }
+ CRecord.Stop();
+ if (_CurrentVideo != null)
+ CVideo.Close(ref _CurrentVideo);
+ CDraw.RemoveTexture(ref _Background);
+
+ if (_SlideShow != null)
+ _SlideShow.RemoveSlideShowTextures();
+
+ _Lyrics[_LyricMain].Clear();
+ _Lyrics[_LyricSub].Clear();
+ _Lyrics[_LyricMainDuet].Clear();
+ _Lyrics[_LyricSubDuet].Clear();
+ _Lyrics[_LyricMainTop].Clear();
+ _Lyrics[_LyricSubTop].Clear();
+ _Texts[_TextSongName].Text = String.Empty;
+ _Texts[_TextDuetName1].Text = String.Empty;
+ _Texts[_TextDuetName2].Text = String.Empty;
+ _Texts[_TextMedleyCountdown].Visible = false;
+ _Texts[_TextMedleyCountdown].Text = String.Empty;
+ }
+ #endregion
+
+ #region visibility and fading
+ private void _SetNormalLyricsVisibility()
+ {
+ bool bottomLyricsVisible = CConfig.Config.Game.LyricsPosition == ELyricsPosition.TR_CONFIG_LYRICSPOSITION_BOTTOM
+ || CConfig.Config.Game.LyricsPosition == ELyricsPosition.TR_CONFIG_LYRICSPOSITION_BOTH
+ || (CConfig.Config.Game.LyricsPosition == ELyricsPosition.TR_CONFIG_LYRICSPOSITION_DYNAMIC && _DynamicLyricsBottom);
+
+ bool topLyricsVisible = CConfig.Config.Game.LyricsPosition == ELyricsPosition.TR_CONFIG_LYRICSPOSITION_TOP
+ || CConfig.Config.Game.LyricsPosition == ELyricsPosition.TR_CONFIG_LYRICSPOSITION_BOTH
+ || (CConfig.Config.Game.LyricsPosition == ELyricsPosition.TR_CONFIG_LYRICSPOSITION_DYNAMIC && _DynamicLyricsTop);
+
+ bool duetLyricsVisible = false;
+
+ if (CGame.GetSong() != null && CGame.GetSong().IsDuet)
+ {
+ bottomLyricsVisible = true;
+ topLyricsVisible = false;
+ duetLyricsVisible = true;
+ }
+
+ _Lyrics[_LyricMain].Visible = bottomLyricsVisible;
+ _Lyrics[_LyricSub].Visible = bottomLyricsVisible;
+ _Statics[_StaticLyrics].Visible = bottomLyricsVisible;
+
+ _Lyrics[_LyricMainTop].Visible = topLyricsVisible;
+ _Lyrics[_LyricSubTop].Visible = topLyricsVisible;
+ _Statics[_StaticLyricsTop].Visible = topLyricsVisible;
+
+ _Lyrics[_LyricMainDuet].Visible = duetLyricsVisible;
+ _Lyrics[_LyricSubDuet].Visible = duetLyricsVisible;
+ _Statics[_StaticLyricsDuet].Visible = duetLyricsVisible;
+ }
+
+ private void _SetVisibility()
+ {
+ _Statics[_StaticLyricsDuet].Visible = false;
+ _Statics[_StaticLyricHelper].Visible = false;
+ _Statics[_StaticLyricHelperDuet].Visible = false;
+ _Statics[_StaticLyricHelperTop].Visible = false;
+ _Lyrics[_LyricMainDuet].Visible = false;
+ _Lyrics[_LyricSubDuet].Visible = false;
+
+ _Statics[_StaticSongText].Visible = false;
+ _Texts[_TextSongName].Visible = false;
+ _Texts[_TextDuetName1].Visible = false;
+ _Texts[_TextDuetName2].Visible = false;
+
+ int screenPlayers = CGame.NumPlayers / CConfig.GetNumScreens();
+ int remainingScreenPlayers = CGame.NumPlayers - (screenPlayers * CConfig.GetNumScreens());
+
+ for (int screen = 0; screen < CSettings.MaxNumScreens; screen++)
+ {
+ int currentScreenPlayers = screenPlayers;
+
+ if (remainingScreenPlayers > 0)
+ {
+ currentScreenPlayers++;
+ remainingScreenPlayers--;
+ }
+
+ string curN = "N" + currentScreenPlayers;
+ string curS = "S" + (screen + 1);
+
+ foreach (string se in _StaticsExtra[screen])
+ {
+ string n = se.Substring(se.Length - 2);
+ string s = se.Substring(0, 2);
+ //Make StaticExtra elements with matching player number and active screen visible
+ if (n == curN && s == curS && screen < CConfig.GetNumScreens())
+ _Statics[se].Visible = true;
+ else
+ _Statics[se].Visible = false;
+ }
+
+ foreach (string te in _TextsExtra[screen])
+ {
+ string n = te.Substring(te.Length - 2);
+ string s = te.Substring(0, 2);
+ //Make TextExtra elements with matching player number and active screen visible
+ if (n == curN && s == curS && screen < CConfig.GetNumScreens())
+ _Texts[te].Visible = true;
+ else
+ _Texts[te].Visible = false;
+ }
+
+ for (int numplayer = 0; numplayer < CSettings.MaxNumPlayer; numplayer++)
+ {
+ for (int player = 0; player < CSettings.MaxNumPlayer && player <= numplayer; player++)
+ {
+ _Texts[_TextScores[screen, player, numplayer]].AllMonitors = false;
+ _Texts[_TextScores[screen, player, numplayer]].Visible = false;
+ _Texts[_TextNames[screen, player, numplayer]].AllMonitors = false;
+ _Texts[_TextNames[screen, player, numplayer]].Visible = false;
+ _Statics[_StaticScores[screen, player, numplayer]].AllMonitors = false;
+ _Statics[_StaticScores[screen, player, numplayer]].Visible = false;
+ _Statics[_StaticAvatars[screen, player, numplayer]].AllMonitors = false;
+ _Statics[_StaticAvatars[screen, player, numplayer]].Visible = false;
+ _ProgressBars[_ProgressBarsRating[screen, player, numplayer]].AllMonitors = false;
+ _ProgressBars[_ProgressBarsRating[screen, player, numplayer]].Visible = false;
+ }
+ }
+ }
+
+ for (int player = 0; player < CGame.NumPlayers; player++)
+ {
+ _Texts[_PlayerTextScore[player]].Visible = true;
+ _Texts[_PlayerTextName[player]].Visible = (CConfig.Config.Theme.PlayerInfo == EPlayerInfo.TR_CONFIG_PLAYERINFO_BOTH ||
+ CConfig.Config.Theme.PlayerInfo == EPlayerInfo.TR_CONFIG_PLAYERINFO_NAME);
+ _Statics[_PlayerStaticScore[player]].Visible = true;
+ _Statics[_PlayerStaticAvatar[player]].Visible = (CConfig.Config.Theme.PlayerInfo == EPlayerInfo.TR_CONFIG_PLAYERINFO_BOTH ||
+ CConfig.Config.Theme.PlayerInfo == EPlayerInfo.TR_CONFIG_PLAYERINFO_AVATAR);
+ _ProgressBars[_PlayerProgressBarRating[player]].Visible = true;
+ }
+
+ _Lyrics[_LyricMain].Alpha = 0f;
+ _Lyrics[_LyricSub].Alpha = 0f;
+
+ _Lyrics[_LyricMainTop].Alpha = 0f;
+ _Lyrics[_LyricSubTop].Alpha = 0f;
+
+ _Statics[_StaticLyrics].Alpha = 0f;
+ _Statics[_StaticLyricsTop].Alpha = 0f;
+
+ _Statics[_StaticLyricHelper].Alpha = 0f;
+ _Statics[_StaticLyricHelperTop].Alpha = 0f;
+
+ _Lyrics[_LyricMainDuet].Alpha = 0f;
+ _Lyrics[_LyricSubDuet].Alpha = 0f;
+
+ _Statics[_StaticLyricsDuet].Alpha = 0f;
+ _Statics[_StaticLyricHelperDuet].Alpha = 0f;
+
+ _Statics[_StaticTimeLine].Visible = CConfig.Config.Theme.TimerLook == ETimerLook.TR_CONFIG_TIMERLOOK_NORMAL;
+ _Statics[_StaticTimeLineExpandedHighlighted].Visible = false;
+ _Statics[_StaticTimeLineExpandedNormal].Visible = false;
+ }
+
+ private float[] _CalcFadingAlpha()
+ {
+ const float dt = 4f;
+ const float rt = dt * 0.8f;
+
+ CSong song = CGame.GetSong();
+ if (song == null || !song.NotesLoaded)
+ return null;
+
+ var alpha = new float[song.Notes.VoiceCount * 2];
+ float currentTime = _CurrentTime - song.Gap;
+
+ for (int i = 0; i < song.Notes.VoiceCount; i++)
+ {
+ CVoice voice = song.Notes.GetVoice(i);
+ CSongLine[] lines = voice.Lines;
+
+ // find current line for lyric sub fading
+ int currentLineSub = _FindCurrentLine(voice, lines, song);
+
+ // find current line for lyric main fading
+ int currentLine = 0;
+ for (int j = 0; j < lines.Length; j++)
+ {
+ if (lines[j].FirstNoteBeat <= _CurrentBeat)
+ currentLine = j;
+ }
+
+ // default values
+ alpha[i * 2] = 1f;
+ alpha[i * 2 + 1] = 1f;
+
+ // main line alpha
+ if (currentLine == 0 && currentTime < CGame.GetTimeFromBeats(lines[currentLine].FirstNoteBeat, song.BPM))
+ {
+ // first main line and fist note is not reached
+ // => fade in
+ float diff = CGame.GetTimeFromBeats(lines[currentLine].FirstNoteBeat, song.BPM) - currentTime;
+ if (diff > dt)
+ alpha[i * 2] = 1f - (diff - dt) / rt;
+ }
+ else if (currentLine < lines.Length - 1 && CGame.GetTimeFromBeats(lines[currentLine].LastNoteBeat, song.BPM) < currentTime &&
+ CGame.GetTimeFromBeats(lines[currentLine + 1].FirstNoteBeat, song.BPM) > currentTime)
+ {
+ // current position is between two lines
+
+ // time between the to lines
+ float diff = CGame.GetTimeFromBeats(lines[currentLine + 1].FirstNoteBeat, song.BPM) -
+ CGame.GetTimeFromBeats(lines[currentLine].LastNoteBeat, song.BPM);
+
+ // fade only if there is enough time for fading
+ if (diff > 3.3f * dt)
+ {
+ // time elapsed since last line
+ float last = currentTime - CGame.GetTimeFromBeats(lines[currentLine].LastNoteBeat, song.BPM);
+
+ // time to next line
+ float next = CGame.GetTimeFromBeats(lines[currentLine + 1].FirstNoteBeat, song.BPM) - currentTime;
+
+ if (last < next)
+ {
+ // fade out
+ alpha[i * 2] = 1f - last / rt;
+ }
+ else
+ {
+ // fade in if it is time for
+ if (next > dt)
+ alpha[i * 2] = 1f - (next - dt) / rt;
+ }
+ }
+ }
+ else if (currentLine == lines.Length - 1 && CGame.GetTimeFromBeats(lines[currentLine].LastNoteBeat, song.BPM) < currentTime)
+ {
+ // last main line and last note was reached
+ // => fade out
+ float diff = currentTime - CGame.GetTimeFromBeats(lines[currentLine].LastNoteBeat, song.BPM);
+ alpha[i * 2] = 1f - diff / rt;
+ }
+
+ // sub
+ if (currentLineSub < lines.Length - 2)
+ {
+ float diff = CGame.GetTimeFromBeats(lines[currentLineSub + 1].FirstNoteBeat, song.BPM) - currentTime;
+
+ if (diff > dt)
+ alpha[i * 2 + 1] = 1f - (diff - dt) / rt;
+ }
+
+ if (alpha[i * 2] < 0f)
+ alpha[i * 2] = 0f;
+
+ if (alpha[i * 2 + 1] < 0f)
+ alpha[i * 2 + 1] = 0f;
+ }
+
+ return alpha;
+ }
+ #endregion
+
+ #region theme loading
+ private void _BuildTextStrings(List texts)
+ {
+ _TextScores = new string[CSettings.MaxNumScreens, CSettings.MaxNumPlayer, CSettings.MaxNumPlayer];
+ _TextNames = new string[CSettings.MaxNumScreens, CSettings.MaxNumPlayer, CSettings.MaxNumPlayer];
+
+ for (int numplayer = 0; numplayer < CSettings.MaxNumPlayer; numplayer++)
+ {
+ for (int player = 0; player < CSettings.MaxNumPlayer; player++)
+ {
+ if (player <= numplayer)
+ {
+ string target = "P" + (player + 1) + "N" + (numplayer + 1);
+ for (int screen = 0; screen < CSettings.MaxNumScreens; screen++)
+ {
+ _TextScores[screen, player, numplayer] = "TextScoreS" + (screen + 1) + target;
+ _TextNames[screen, player, numplayer] = "TextNameS" + (screen + 1) + target;
+ }
+ texts.Add("TextScore" + target);
+ texts.Add("TextName" + target);
+
+ }
+ }
+ }
+ }
+
+ private void _CreatePlayerStrings()
+ {
+ for (int screen = 0; screen < CSettings.MaxNumScreens; screen++)
+ {
+ for (int numplayer = 0; numplayer < CSettings.MaxNumPlayer; numplayer++)
+ {
+ for (int player = 0; player < CSettings.MaxNumPlayer; player++)
+ {
+ if (player <= numplayer)
+ {
+ string target = "S" + (screen + 1) + "P" + (player + 1) + "N" + (numplayer + 1);
+ _AddText(GetNewText(), "TextScore" + target);
+ _AddText(GetNewText(), "TextName" + target);
+ }
+ }
+ }
+ }
+ }
+
+ private void _InitiatePlayerStrings()
+ {
+ for (int screen = 0; screen < CSettings.MaxNumScreens; screen++)
+ {
+ for (int numplayer = 0; numplayer < CSettings.MaxNumPlayer; numplayer++)
+ {
+ for (int player = 0; player < CSettings.MaxNumPlayer; player++)
+ {
+ if (player <= numplayer)
+ {
+ string target = "P" + (player + 1) + "N" + (numplayer + 1);
+ _Texts["TextName" + target].Visible = false;
+ _Texts["TextNameS" + (screen + 1) + target] = GetNewText(_Texts["TextName" + target]);
+ _Texts["TextNameS" + (screen + 1) + target].X += screen * CSettings.RenderW;
+
+ _Texts["TextScore" + target].Visible = false;
+ _Texts["TextScoreS" + (screen + 1) + target] = GetNewText(_Texts["TextScore" + target]);
+ _Texts["TextScoreS" + (screen + 1) + target].X += screen * CSettings.RenderW;
+ }
+ }
+ }
+ }
+ }
+
+ private void _BuildStaticStrings(ref List statics)
+ {
+ _StaticScores = new string[CSettings.MaxNumScreens, CSettings.MaxNumPlayer, CSettings.MaxNumPlayer];
+ _StaticAvatars = new string[CSettings.MaxNumScreens, CSettings.MaxNumPlayer, CSettings.MaxNumPlayer];
+
+ for (int numplayer = 0; numplayer < CSettings.MaxNumPlayer; numplayer++)
+ {
+ for (int player = 0; player < CSettings.MaxNumPlayer; player++)
+ {
+ if (player <= numplayer)
+ {
+ string target = "P" + (player + 1) + "N" + (numplayer + 1);
+ for (int screen = 0; screen < CSettings.MaxNumScreens; screen++)
+ {
+ _StaticScores[screen, player, numplayer] = "StaticScoreS" + (screen + 1) + target;
+ _StaticAvatars[screen, player, numplayer] = "StaticAvatarS" + (screen + 1) + target;
+ }
+ statics.Add("StaticScore" + target);
+ statics.Add("StaticAvatar" + target);
+
+ }
+ }
+ }
+ }
+
+ private void _CreatePlayerStatics()
+ {
+ for (int screen = 0; screen < CSettings.MaxNumScreens; screen++)
+ {
+ for (int numplayer = 0; numplayer < CSettings.MaxNumPlayer; numplayer++)
+ {
+ for (int player = 0; player < CSettings.MaxNumPlayer; player++)
+ {
+ if (player <= numplayer)
+ {
+ string target = "S" + (screen + 1) + "P" + (player + 1) + "N" + (numplayer + 1);
+ _AddStatic(GetNewStatic(), "StaticScore" + target);
+ _AddStatic(GetNewStatic(), "StaticAvatar" + target);
+ }
+ }
+ }
+ }
+ }
+
+ private void _InitiatePlayerStatics()
+ {
+ for (int screen = 0; screen < CSettings.MaxNumScreens; screen++)
+ {
+ for (int numplayer = 0; numplayer < CSettings.MaxNumPlayer; numplayer++)
+ {
+ for (int player = 0; player < CSettings.MaxNumPlayer; player++)
+ {
+ if (player <= numplayer)
+ {
+ string target = "P" + (player + 1) + "N" + (numplayer + 1);
+ _Statics["StaticAvatar" + target].Visible = false;
+ _Statics["StaticAvatarS" + (screen + 1) + target] = GetNewStatic(_Statics["StaticAvatar" + target]);
+ _Statics["StaticAvatarS" + (screen + 1) + target].X += screen * CSettings.RenderW;
+
+ _Statics["StaticScore" + target].Visible = false;
+ _Statics["StaticScoreS" + (screen + 1) + target] = GetNewStatic(_Statics["StaticScore" + target]);
+ _Statics["StaticScoreS" + (screen + 1) + target].X += screen * CSettings.RenderW;
+ }
+ }
+ }
+ }
+ }
+
+ private void _BuildProgressBarStrings(ref List progressbars)
+ {
+ _ProgressBarsRating = new string[CSettings.MaxNumScreens, CSettings.MaxNumPlayer, CSettings.MaxNumPlayer];
+ for (int screen = 0; screen < CSettings.MaxNumScreens; screen++)
+ {
+ for (int numplayer = 0; numplayer < CSettings.MaxNumPlayer; numplayer++)
+ {
+ for (int player = 0; player < CSettings.MaxNumPlayer; player++)
+ {
+ if (player <= numplayer)
+ {
+ string target = "P" + (player + 1) + "N" + (numplayer + 1);
+ _ProgressBarsRating[screen, player, numplayer] = "ProgressBarRatingS" + (screen + 1) + target;
+ progressbars.Add("ProgressBarRating" + target);
+ }
+ }
+ }
+ }
+ }
+
+ private void _CreateProgressBars()
+ {
+ for (int screen = 0; screen < CSettings.MaxNumScreens; screen++)
+ {
+ for (int numplayer = 0; numplayer < CSettings.MaxNumPlayer; numplayer++)
+ {
+ for (int player = 0; player < CSettings.MaxNumPlayer; player++)
+ {
+ if (player <= numplayer)
+ {
+ string target = "S" + (screen + 1) + "P" + (player + 1) + "N" + (numplayer + 1);
+ _AddProgressBar(GetNewProgressBar(), "ProgressBarRating" + target);
+ }
+ }
+ }
+ }
+ }
+
+ private void _InitiateProgressBars()
+ {
+ for (int screen = 0; screen < CSettings.MaxNumScreens; screen++)
+ {
+ for (int numplayer = 0; numplayer < CSettings.MaxNumPlayer; numplayer++)
+ {
+ for (int player = 0; player < CSettings.MaxNumPlayer; player++)
+ {
+ if (player <= numplayer)
+ {
+ string target = "P" + (player + 1) + "N" + (numplayer + 1);
+ _ProgressBars["ProgressBarRating" + target].Visible = false;
+ _ProgressBars["ProgressBarRatingS" + (screen + 1) + target] = GetNewProgressBar(_ProgressBars["ProgressBarRating" + target]);
+ _ProgressBars["ProgressBarRatingS" + (screen + 1) + target].X += screen * CSettings.RenderW;
+ }
+ }
+ }
+ }
+ }
+
+ private void _CreateExtraStatics()
+ {
+ _StaticsExtra = new List[CSettings.MaxNumScreens];
+
+ List extraStatics = new List();
+
+ foreach (CStatic se in _Statics)
+ {
+ if (se.GetThemeName() != null && se.GetThemeName().StartsWith("StaticExtra"))
+ {
+ extraStatics.Add(se.GetThemeName());
+ _Statics[se.GetThemeName()].Visible = false;
+ }
+ }
+
+ for (int screen = 0; screen < CSettings.MaxNumScreens; screen++)
+ {
+ _StaticsExtra[screen] = new List();
+ foreach (string es in extraStatics)
+ {
+ string name = "S" + (screen + 1) + es;
+ _AddStatic(GetNewStatic(), name);
+ _Statics[name] = GetNewStatic(_Statics[es]);
+ _Statics[name].X += screen * CSettings.RenderW;
+ _Statics[name].AllMonitors = false;
+ _StaticsExtra[screen].Add(name);
+ }
+
+ }
+ }
+
+ private void _CreateExtraTexts()
+ {
+ _TextsExtra = new List[CSettings.MaxNumScreens];
+
+ List extraTexts = new List();
+
+ foreach (CText te in _Texts)
+ {
+ if (te.GetThemeName() != null && te.GetThemeName().StartsWith("TextExtra"))
+ {
+ extraTexts.Add(te.GetThemeName());
+ _Texts[te.GetThemeName()].Visible = false;
+ }
+ }
+
+ for (int screen = 0; screen < CSettings.MaxNumScreens; screen++)
+ {
+ _TextsExtra[screen] = new List();
+ foreach (string et in extraTexts)
+ {
+ string name = "S" + (screen + 1) + et;
+ _AddText(GetNewText(), name);
+ _Texts[name] = GetNewText(_Texts[et]);
+ _Texts[name].X += screen * CSettings.RenderW;
+ _Texts[name].AllMonitors = false;
+ _TextsExtra[screen].Add(name);
+ }
+
+ }
+ }
+ #endregion
+
+ private int _FindCurrentLine(CVoice voice, CSongLine[] lines, CSong song)
+ {
+ 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!
+ int j = voice.FindPreviousLine(_CurrentBeat);
+ for (; j >= 0; j--)
+ {
+ float firstNoteTime = CGame.GetTimeFromBeats(lines[j].FirstNoteBeat, song.BPM);
+ //Earlist possible line break is 10s before first note
+ if (firstNoteTime <= currentTime + 10f)
+ {
+ //First line has no predecessor or line has to be shown
+ if (j == 0 || firstNoteTime - CConfig.Config.Game.MinLineBreakTime <= currentTime)
+ return j;
+ float lastNoteTime = CGame.GetTimeFromBeats(lines[j - 1].LastNoteBeat, song.BPM);
+ //No line break if last line is not fully evaluated (with 50% tolerance -> tested so notes are drawn)
+ if (lastNoteTime + CConfig.Config.Record.MicDelay / 1000f * 1.5f >= currentTime)
+ return j - 1;
+ return j;
+ }
+ }
+ return -1;
+ }
+
private void _PrepareTimeLine()
{
CStatic stat = _Statics[_StaticTimeLine];
@@ -1747,13 +1813,5 @@ namespace Vocaluxe.Screens
}
}
}
-
- private void _UpdateRatingBars()
- {
- for (int i = 0; i < CGame.NumPlayers; i++)
- {
- _ProgressBars[_PlayerProgressBarRating[i]].Progress = (float)CGame.Players[i].Rating;
- }
- }
}
}
\ No newline at end of file
diff --git a/Vocaluxe/Vocaluxe.csproj b/Vocaluxe/Vocaluxe.csproj
index 248e7a46..e98af8cd 100644
--- a/Vocaluxe/Vocaluxe.csproj
+++ b/Vocaluxe/Vocaluxe.csproj
@@ -1,5 +1,5 @@
-
+
DebugWin
x86
@@ -10,7 +10,7 @@
Properties
Vocaluxe
Vocaluxe
- v4.0
+ v4.7.1
512
false
Vocaluxe.CMainProgram
@@ -43,6 +43,7 @@
prompt
4
Off
+ false
x86
@@ -54,6 +55,7 @@
false
WIN;ARCH_X86
Off
+ false
x64
@@ -66,6 +68,7 @@
4
Off
..\CheckingRules.ruleset
+ false
x64
@@ -77,6 +80,7 @@
false
WIN;ARCH_X64
Off
+ false
x86
@@ -88,6 +92,7 @@
prompt
4
Off
+ false
x86
@@ -99,6 +104,7 @@
false
LINUX;ARCH_X86
Off
+ false
x64
@@ -110,6 +116,7 @@
prompt
4
Off
+ false
x64
@@ -121,6 +128,7 @@
false
LINUX;ARCH_X64
Off
+ false
x86
@@ -132,6 +140,7 @@
false
WIN;ARCH_X86;INSTALLER
Off
+ false
x64
@@ -143,6 +152,7 @@
false
WIN;ARCH_X64;INSTALLER
Off
+ false
diff --git a/Vocaluxe/app.config b/Vocaluxe/app.config
index d1480e79..bdab2be4 100644
--- a/Vocaluxe/app.config
+++ b/Vocaluxe/app.config
@@ -1,11 +1,11 @@
-
+
-
+