Add a button to the gamesetup to reset the selected civilizations of all players to random.

Code by Sandarac, icon by Lionkanzen, fixes #3805.

This was SVN commit r18239.
This commit is contained in:
elexis 2016-05-26 22:58:30 +00:00
parent 30e7b3bf25
commit 78accf3d97
4 changed files with 37 additions and 0 deletions

Binary file not shown.

View File

@ -196,6 +196,20 @@
/>
</sprite>
<sprite name="iconResetGold">
<effect add_color="237 227 167" />
<image texture="global/icon/reset.png"
size="0 3 100% 100%+3"
/>
</sprite>
<sprite name="iconResetWhite">
<effect add_color="255 255 255" />
<image texture="global/icon/reset.png"
size="0 3 100% 100%+3"
/>
</sprite>
<!--
==========================================

View File

@ -1396,6 +1396,8 @@ function updateGUIObjects()
"exploreMap", "disableTreasures", "lockTeams"])
hideControl(ctrl, ctrl + "Text", notScenario);
Engine.GetGUIObjectByName("civResetButton").hidden = !notScenario;
for (let i = 0; i < g_MaxPlayers; ++i)
{
Engine.GetGUIObjectByName("playerBox["+i+"]").hidden = (i >= numPlayers);
@ -1816,6 +1818,14 @@ function showMoreOptions(show)
Engine.GetGUIObjectByName("moreOptions").hidden = !show;
}
function resetCivilizations()
{
for (let i in g_GameAttributes.settings.PlayerData)
g_GameAttributes.settings.PlayerData[i].Civ = "random";
updateGameAttributes();
}
function toggleReady()
{
g_IsReady = !g_IsReady;

View File

@ -65,6 +65,16 @@
Engine.PushGuiPage("page_civinfo.xml");
]]></action>
</object>
<object name="civResetButton"
type="button"
sprite="iconResetGold"
sprite_over="iconResetWhite"
size="67.5%+93 0 67.5%+109 16"
tooltip_style="onscreenToolTip"
>
<translatableAttribute id="tooltip">Reset any civilizations that have been selected to the default (random)</translatableAttribute>
<action on="Press">resetCivilizations();</action>
</object>
<object name="playerTeamHeading" type="text" style="ModernLabelText" size="85%+5 0 100%-5 100%">
<translatableAttribute id="caption">Team</translatableAttribute>
</object>