Added check on PartyNameSelection if all player are selected, otherwise Vocaluxe would crash.

This commit is contained in:
Florian Küpper committed 2014-12-05 16:52:20 +01:00
1 parent 7fa3a5b195
commit ca5d607937
1 file changed
+23
@@ -24,6 +24,17 @@ namespace VocaluxeLib.Menu
{ {
public abstract class CMenuPartyNameSelection : CMenuParty public abstract class CMenuPartyNameSelection : CMenuParty
{ {
private bool _AllPlayerSelected
{
get
{
for (int team = 0; team < _NumTeams; team++)
if (_TeamList[team].Count < _NumPlayerTeams[team])
return false;
return true;
}
}
private bool _Teams; private bool _Teams;
protected int _NumTeams = -1; protected int _NumTeams = -1;
protected int _NumPlayer = -1; protected int _NumPlayer = -1;
@@ -99,6 +110,7 @@ namespace VocaluxeLib.Menu
_LoadProfiles(); _LoadProfiles();
_UpdateButtonVisibility(); _UpdateButtonVisibility();
_UpdateButtonState(); _UpdateButtonState();
_UpdateNextButtonVisibility();
} }
public void SetPartyModeProfiles(List<int>[] teamProfiles) public void SetPartyModeProfiles(List<int>[] teamProfiles)
@@ -547,6 +559,7 @@ namespace VocaluxeLib.Menu
_UpdateButtonVisibility(); _UpdateButtonVisibility();
_UpdateButtonState(); _UpdateButtonState();
_UpdateNextButtonVisibility();
} }
public abstract void Back(); public abstract void Back();
@@ -715,6 +728,7 @@ namespace VocaluxeLib.Menu
_TeamList[team].Add(profileID); _TeamList[team].Add(profileID);
_UpdatePlayerSlide(); _UpdatePlayerSlide();
_UpdateNextButtonVisibility();
} }
private void _RemoveAllPlayer() private void _RemoveAllPlayer()
@@ -736,12 +750,16 @@ namespace VocaluxeLib.Menu
_TeamList[team].RemoveAt(index); _TeamList[team].RemoveAt(index);
_NameSelections[_NameSelection].RemoveUsedProfile(id); _NameSelections[_NameSelection].RemoveUsedProfile(id);
} }
_UpdateNextButtonVisibility();
} }
private void _RemovePlayer(int team, int profileID) private void _RemovePlayer(int team, int profileID)
{ {
_TeamList[team].Remove(profileID); _TeamList[team].Remove(profileID);
_NameSelections[_NameSelection].RemoveUsedProfile(profileID); _NameSelections[_NameSelection].RemoveUsedProfile(profileID);
_UpdateNextButtonVisibility();
} }
private void _SelectRandom() private void _SelectRandom()
@@ -756,6 +774,11 @@ namespace VocaluxeLib.Menu
} }
} }
} }
private void _UpdateNextButtonVisibility()
{
_Buttons[_ButtonNext].Visible = _AllPlayerSelected;
}
#endregion #endregion
} }
} }