Improve handling of profile-delete-action.
This commit is contained in:
1 parent
2dc2ac5c37
commit
3a12df643b
3 files changed
+31
-13
No files matched your search
@@ -804,12 +804,12 @@ namespace Vocaluxe.Base
|
||||
/// Use saved players from config now for games
|
||||
/// </summary>
|
||||
public static void UsePlayers()
|
||||
{
|
||||
for (int i = 0; i < CProfiles.Profiles.Length; i++)
|
||||
{
|
||||
for (int j = 0; j < CSettings.MaxNumPlayer; j++)
|
||||
{
|
||||
for (int j = 0; j < CSettings.MaxNumPlayer; j++)
|
||||
if (Players[j].Length > 0)
|
||||
{
|
||||
if (Players[j].Length > 0)
|
||||
for (int i = 0; i < CProfiles.Profiles.Length; i++)
|
||||
{
|
||||
if (Path.GetFileName(CProfiles.Profiles[i].ProfileFile) == Players[j] && CProfiles.Profiles[i].Active == EOffOn.TR_CONFIG_ON)
|
||||
{
|
||||
@@ -819,9 +819,9 @@ namespace Vocaluxe.Base
|
||||
CGame.Player[j].ProfileID = i;
|
||||
}
|
||||
}
|
||||
else
|
||||
CGame.Player[j].ProfileID = -1;
|
||||
}
|
||||
else
|
||||
CGame.Player[j].ProfileID = -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -251,8 +251,25 @@ namespace Vocaluxe.Base
|
||||
{
|
||||
try
|
||||
{
|
||||
//Check if profile saved in config
|
||||
for (int i = 0; i < CConfig.Players.Length; i++)
|
||||
{
|
||||
if (CConfig.Players[i] == _Profiles[profileID].ProfileFile)
|
||||
{
|
||||
CConfig.Players[i] = string.Empty;
|
||||
CConfig.SaveConfig();
|
||||
}
|
||||
}
|
||||
File.Delete(_Profiles[profileID].ProfileFile);
|
||||
_Profiles.RemoveAt(profileID);
|
||||
//Check if profile is selected in game
|
||||
for (int i = 0; i < CGame.Player.Length; i++)
|
||||
{
|
||||
if (CGame.Player[i].ProfileID > profileID)
|
||||
CGame.Player[i].ProfileID--;
|
||||
else if (CGame.Player[i].ProfileID == profileID)
|
||||
CGame.Player[i].ProfileID = -1;
|
||||
}
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
|
||||
@@ -577,14 +577,15 @@ namespace Vocaluxe.Screens
|
||||
|
||||
for (int i = 0; i < CSettings.MaxNumPlayer; i++)
|
||||
{
|
||||
//Update texture and name
|
||||
if (CConfig.Players[i].Length > 0)
|
||||
if (CGame.Player[i].ProfileID > -1 && CProfiles.NumProfiles > CGame.Player[i].ProfileID)
|
||||
{
|
||||
if (CGame.Player[i].ProfileID > -1 && CProfiles.NumProfiles > CGame.Player[i].ProfileID)
|
||||
{
|
||||
Statics[_StaticPlayerAvatar[i]].Texture = CProfiles.Profiles[CGame.Player[i].ProfileID].Avatar.Texture;
|
||||
Texts[_TextPlayer[i]].Text = CProfiles.Profiles[CGame.Player[i].ProfileID].PlayerName;
|
||||
}
|
||||
Statics[_StaticPlayerAvatar[i]].Texture = CProfiles.Profiles[CGame.Player[i].ProfileID].Avatar.Texture;
|
||||
Texts[_TextPlayer[i]].Text = CProfiles.Profiles[CGame.Player[i].ProfileID].PlayerName;
|
||||
}
|
||||
else
|
||||
{
|
||||
Statics[_StaticPlayerAvatar[i]].Texture = _OriginalPlayerAvatarTextures[i];
|
||||
Texts[_TextPlayer[i]].Text = CLanguage.Translate("TR_SCREENNAMES_PLAYER") + " " + (i + 1).ToString();
|
||||
}
|
||||
if (CGame.GetNumSongs() == 1 && CGame.GetSong(1).IsDuet)
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user