PartyNames: Added button for selecting random.
This commit is contained in:
1 parent
2427f40bc6
commit
4b4c8aa8f2
4 files changed
+111
-1
No files matched your search
@@ -24,6 +24,7 @@
|
|||||||
<string name="TR_SCREENNAMES_TITLE">Tic-Tac-Toe: Choose Player</string>
|
<string name="TR_SCREENNAMES_TITLE">Tic-Tac-Toe: Choose Player</string>
|
||||||
<string name="TR_SCREENNAMES_TEAM1">Team 1</string>
|
<string name="TR_SCREENNAMES_TEAM1">Team 1</string>
|
||||||
<string name="TR_SCREENNAMES_TEAM2">Team 2</string>
|
<string name="TR_SCREENNAMES_TEAM2">Team 2</string>
|
||||||
|
<string name="TR_SCREENNAMES_BUTTON_RANDOM">Select random</string>
|
||||||
<string name="TR_SCREENMAIN_TITLE">Tic-Tac-Toe</string>
|
<string name="TR_SCREENMAIN_TITLE">Tic-Tac-Toe</string>
|
||||||
<string name="TR_SCREENMAIN_TEAM_CHOOSE">Choose a field.</string>
|
<string name="TR_SCREENMAIN_TEAM_CHOOSE">Choose a field.</string>
|
||||||
<string name="TR_SCREENMAIN_NEXT_PLAYER">Next player</string>
|
<string name="TR_SCREENMAIN_NEXT_PLAYER">Next player</string>
|
||||||
|
|||||||
@@ -172,6 +172,63 @@
|
|||||||
<Height>26</Height>
|
<Height>26</Height>
|
||||||
</SReflection>
|
</SReflection>
|
||||||
</ButtonBack>
|
</ButtonBack>
|
||||||
|
<ButtonRandom>
|
||||||
|
<!--<Skin>: Texture name-->
|
||||||
|
<Skin>Button</Skin>
|
||||||
|
<!--<SkinSelected>: Texture name for selected button-->
|
||||||
|
<SkinSelected>Button</SkinSelected>
|
||||||
|
<!--<X>, <Y>, <Z>, <W>, <H>: Button position, width and height-->
|
||||||
|
<X>565</X>
|
||||||
|
<Y>625</Y>
|
||||||
|
<Z>0,00</Z>
|
||||||
|
<W>150</W>
|
||||||
|
<H>50</H>
|
||||||
|
<!--<Color>: Button color from ColorScheme (high priority)-->
|
||||||
|
<!--or <R>, <G>, <B>, <A> (lower priority)-->
|
||||||
|
<Color>ButtonColor</Color>
|
||||||
|
<!--<SColor>: Selected button color from ColorScheme (high priority)-->
|
||||||
|
<!--or <SR>, <SG>, <SB>, <SA> (lower priority)-->
|
||||||
|
<SColor>ButtonSColor</SColor>
|
||||||
|
<Text>
|
||||||
|
<!--<X>, <Y>: Text position-->
|
||||||
|
<X>75</X>
|
||||||
|
<Y>10</Y>
|
||||||
|
<!--<H>: Text height-->
|
||||||
|
<H>27</H>
|
||||||
|
<!--<MaxW>: Maximum text width (if exists)-->
|
||||||
|
<MaxW>142</MaxW>
|
||||||
|
<!--<Color>: Text color from ColorScheme (high priority)-->
|
||||||
|
<!--or <R>, <G>, <B>, <A> (lower priority)-->
|
||||||
|
<Color>ButtonTextColor</Color>
|
||||||
|
<!--<SColor>: Selected Text color from ColorScheme (high priority)-->
|
||||||
|
<!--or <SR>, <SG>, <SB>, <SA> (lower priority)-->
|
||||||
|
<SColor>ButtonTextSColor</SColor>
|
||||||
|
<!--<Align>: Text align horizontal: Left, Center, Right-->
|
||||||
|
<Align>Center</Align>
|
||||||
|
<!--<HAlign>: Text align vertical (on downsizing): Top, Center, Bottom-->
|
||||||
|
<HAlign>Center</HAlign>
|
||||||
|
<!--<Style>: Text style: Normal, Italic, Bold, BoldItalic-->
|
||||||
|
<Style>Bold</Style>
|
||||||
|
<!--<Font>: Text font name-->
|
||||||
|
<Font>Outline</Font>
|
||||||
|
<!--<Text>: Nothing or translation tag-->
|
||||||
|
<Text>TR_SCREENNAMES_BUTTON_RANDOM</Text>
|
||||||
|
</Text>
|
||||||
|
<!--<Reflection> If exists:-->
|
||||||
|
<!-- <Space>: Reflection Space-->
|
||||||
|
<!-- <Height>: Reflection Height-->
|
||||||
|
<Reflection>
|
||||||
|
<Space>10</Space>
|
||||||
|
<Height>26</Height>
|
||||||
|
</Reflection>
|
||||||
|
<!--<SReflection> If exists:-->
|
||||||
|
<!-- <Space>: Reflection Space of selected button-->
|
||||||
|
<!-- <Height>: Reflection Height of selected button-->
|
||||||
|
<SReflection>
|
||||||
|
<Space>10</Space>
|
||||||
|
<Height>26</Height>
|
||||||
|
</SReflection>
|
||||||
|
</ButtonRandom>
|
||||||
<ButtonIncreasePlayer>
|
<ButtonIncreasePlayer>
|
||||||
<!--<Skin>: Texture name-->
|
<!--<Skin>: Texture name-->
|
||||||
<Skin>Plus</Skin>
|
<Skin>Plus</Skin>
|
||||||
|
|||||||
@@ -56,6 +56,7 @@ namespace VocaluxeLib.Menu
|
|||||||
|
|
||||||
private const string _ButtonNext = "ButtonNext";
|
private const string _ButtonNext = "ButtonNext";
|
||||||
private const string _ButtonBack = "ButtonBack";
|
private const string _ButtonBack = "ButtonBack";
|
||||||
|
private const string _ButtonRandom = "ButtonRandom";
|
||||||
private const string _ButtonIncreaseTeams = "ButtonIncreaseTeams";
|
private const string _ButtonIncreaseTeams = "ButtonIncreaseTeams";
|
||||||
private const string _ButtonDecreaseTeams = "ButtonDecreaseTeams";
|
private const string _ButtonDecreaseTeams = "ButtonDecreaseTeams";
|
||||||
private const string _ButtonIncreasePlayer = "ButtonIncreasePlayer";
|
private const string _ButtonIncreasePlayer = "ButtonIncreasePlayer";
|
||||||
@@ -69,7 +70,7 @@ namespace VocaluxeLib.Menu
|
|||||||
public override void Init()
|
public override void Init()
|
||||||
{
|
{
|
||||||
base.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 };
|
_ThemeSelectSlides = new string[] { _SelectSlideTeams, _SelectSlidePlayer };
|
||||||
_ThemeNameSelections = new string[] { _NameSelection };
|
_ThemeNameSelections = new string[] { _NameSelection };
|
||||||
|
|
||||||
@@ -184,6 +185,9 @@ namespace VocaluxeLib.Menu
|
|||||||
if (_Buttons[_ButtonNext].Selected)
|
if (_Buttons[_ButtonNext].Selected)
|
||||||
Next();
|
Next();
|
||||||
|
|
||||||
|
if (_Buttons[_ButtonRandom].Selected)
|
||||||
|
_SelectRandom();
|
||||||
|
|
||||||
if (_Buttons[_ButtonIncreaseTeams].Selected)
|
if (_Buttons[_ButtonIncreaseTeams].Selected)
|
||||||
IncreaseTeamNum();
|
IncreaseTeamNum();
|
||||||
|
|
||||||
@@ -320,6 +324,9 @@ namespace VocaluxeLib.Menu
|
|||||||
if (_Buttons[_ButtonNext].Selected)
|
if (_Buttons[_ButtonNext].Selected)
|
||||||
Next();
|
Next();
|
||||||
|
|
||||||
|
if (_Buttons[_ButtonRandom].Selected)
|
||||||
|
_SelectRandom();
|
||||||
|
|
||||||
if (_Buttons[_ButtonIncreaseTeams].Selected)
|
if (_Buttons[_ButtonIncreaseTeams].Selected)
|
||||||
IncreaseTeamNum();
|
IncreaseTeamNum();
|
||||||
|
|
||||||
@@ -621,6 +628,17 @@ namespace VocaluxeLib.Menu
|
|||||||
_UpdatePlayerSlide();
|
_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)
|
private void _RemovePlayerByIndex(int team, int index)
|
||||||
{
|
{
|
||||||
if (_TeamList[team].Count > index)
|
if (_TeamList[team].Count > index)
|
||||||
@@ -637,6 +655,19 @@ namespace VocaluxeLib.Menu
|
|||||||
_NameSelections[_NameSelection].RemoveUsedProfile(profileID);
|
_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
|
#endregion
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -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()
|
private void _PrepareTiles()
|
||||||
{
|
{
|
||||||
_Tiles.Clear();
|
_Tiles.Clear();
|
||||||
|
|||||||
Reference in new issue
Block a user