diff --git a/Output/PartyModes/TicTacToe/Languages/English.xml b/Output/PartyModes/TicTacToe/Languages/English.xml
index fe20f8ea..0f499d1e 100644
--- a/Output/PartyModes/TicTacToe/Languages/English.xml
+++ b/Output/PartyModes/TicTacToe/Languages/English.xml
@@ -24,6 +24,7 @@
Tic-Tac-Toe: Choose Player
Team 1
Team 2
+ Select random
Tic-Tac-Toe
Choose a field.
Next player
diff --git a/Output/PartyModes/TicTacToe/Screens/PartyScreenTicTacToeNames.xml b/Output/PartyModes/TicTacToe/Screens/PartyScreenTicTacToeNames.xml
index f2fd787a..a968b115 100644
--- a/Output/PartyModes/TicTacToe/Screens/PartyScreenTicTacToeNames.xml
+++ b/Output/PartyModes/TicTacToe/Screens/PartyScreenTicTacToeNames.xml
@@ -172,6 +172,63 @@
26
+
+
+ Button
+
+ Button
+
+ 565
+ 625
+ 0,00
+ 150
+ 50
+
+
+ ButtonColor
+
+
+ ButtonSColor
+
+
+ 75
+ 10
+
+ 27
+
+ 142
+
+
+ ButtonTextColor
+
+
+ ButtonTextSColor
+
+ Center
+
+ Center
+
+
+
+ Outline
+
+ TR_SCREENNAMES_BUTTON_RANDOM
+
+
+
+
+
+ 10
+ 26
+
+
+
+
+
+ 10
+ 26
+
+
Plus
diff --git a/VocaluxeLib/Menu/CMenuPartyNameSelection.cs b/VocaluxeLib/Menu/CMenuPartyNameSelection.cs
index 5b0bb03a..f012eb1f 100644
--- a/VocaluxeLib/Menu/CMenuPartyNameSelection.cs
+++ b/VocaluxeLib/Menu/CMenuPartyNameSelection.cs
@@ -56,6 +56,7 @@ namespace VocaluxeLib.Menu
private const string _ButtonNext = "ButtonNext";
private const string _ButtonBack = "ButtonBack";
+ private const string _ButtonRandom = "ButtonRandom";
private const string _ButtonIncreaseTeams = "ButtonIncreaseTeams";
private const string _ButtonDecreaseTeams = "ButtonDecreaseTeams";
private const string _ButtonIncreasePlayer = "ButtonIncreasePlayer";
@@ -69,7 +70,7 @@ namespace VocaluxeLib.Menu
public override void Init()
{
base.Init();
- _ThemeButtons = new string[] { _ButtonBack, _ButtonNext, _ButtonIncreaseTeams, _ButtonDecreaseTeams, _ButtonIncreasePlayer, _ButtonDecreasePlayer };
+ _ThemeButtons = new string[] { _ButtonBack, _ButtonNext, _ButtonRandom, _ButtonIncreaseTeams, _ButtonDecreaseTeams, _ButtonIncreasePlayer, _ButtonDecreasePlayer };
_ThemeSelectSlides = new string[] { _SelectSlideTeams, _SelectSlidePlayer };
_ThemeNameSelections = new string[] { _NameSelection };
@@ -184,6 +185,9 @@ namespace VocaluxeLib.Menu
if (_Buttons[_ButtonNext].Selected)
Next();
+ if (_Buttons[_ButtonRandom].Selected)
+ _SelectRandom();
+
if (_Buttons[_ButtonIncreaseTeams].Selected)
IncreaseTeamNum();
@@ -320,6 +324,9 @@ namespace VocaluxeLib.Menu
if (_Buttons[_ButtonNext].Selected)
Next();
+ if (_Buttons[_ButtonRandom].Selected)
+ _SelectRandom();
+
if (_Buttons[_ButtonIncreaseTeams].Selected)
IncreaseTeamNum();
@@ -621,6 +628,17 @@ namespace VocaluxeLib.Menu
_UpdatePlayerSlide();
}
+ private void _RemoveAllPlayer()
+ {
+ for (int t = 0; t < _TeamList.Length; t++)
+ {
+ for (int p = 0; p < _TeamList[t].Count; p++)
+ {
+ _RemovePlayerByIndex(t, p);
+ }
+ }
+ }
+
private void _RemovePlayerByIndex(int team, int index)
{
if (_TeamList[team].Count > index)
@@ -637,6 +655,19 @@ namespace VocaluxeLib.Menu
_NameSelections[_NameSelection].RemoveUsedProfile(profileID);
}
+ private void _SelectRandom()
+ {
+ _RemoveAllPlayer();
+ for (int t = 0; t < _NumPlayerTeams.Length; t++)
+ {
+ for (int p = 0; p < _NumPlayerTeams[t]; p++)
+ {
+ int profileID = _NameSelections[_NameSelection].GetRandomUnusedProfile();
+ _AddPlayer(t, profileID);
+ }
+ }
+ }
+
#endregion
}
}
diff --git a/VocaluxeLib/Menu/CNameSelection.cs b/VocaluxeLib/Menu/CNameSelection.cs
index f41b42a0..e8943cd0 100644
--- a/VocaluxeLib/Menu/CNameSelection.cs
+++ b/VocaluxeLib/Menu/CNameSelection.cs
@@ -503,6 +503,27 @@ namespace VocaluxeLib.Menu
}
}
+ public int GetRandomUnusedProfile()
+ {
+ int id = -1;
+
+ if (_VisibleProfiles.Count == 0)
+ return id;
+
+ if (_VisibleProfiles.Count == _UsedProfiles.Count)
+ return id;
+
+ while(id == -1)
+ {
+ int rand = CBase.Game.GetRandom(_VisibleProfiles.Count);
+ if (_UsedProfiles.Contains(_VisibleProfiles[rand]))
+ continue;
+ id = _VisibleProfiles[rand];
+ }
+
+ return id;
+ }
+
private void _PrepareTiles()
{
_Tiles.Clear();