Index: gui/gamesetup/gamesetup.js
===================================================================
--- gui/gamesetup/gamesetup.js
+++ gui/gamesetup/gamesetup.js
@@ -244,6 +244,16 @@
var g_LastViewedAIPlayer = -1;
/**
+ * Time count before gamestart happen
+ */
+var g_StartTimerCount = 10;
+
+/**
+ * Timer object for gamestart
+ */
+var g_StartTimer = null;
+
+/**
* Initializes some globals without touching the GUI.
*
* @param {Object} attribs - context data sent by the lobby / mainmenu
@@ -1280,6 +1290,36 @@
updateGameAttributes();
}
+function launchGameToggle()
+{
+ if (!g_IsNetworked)
+ {
+ launchGame();
+ return;
+ }
+ if (g_StartTimer != null)
+ {
+ clearTimeout(g_StartTimer);
+ g_StartTimer = null;
+ Engine.GetGUIObjectByName("startGame").caption = "Start game!";
+ Engine.SendNetworkChat("Game start stopped");
+ g_StartTimerCount = 10;
+ return;
+ }
+ launchGameTimer();
+}
+
+function launchGameTimer()
+{
+ g_StartTimerCount -= 1;
+ Engine.GetGUIObjectByName("startGame").caption = "Stop timer!";
+ Engine.SendNetworkChat("Game starts in " + g_StartTimerCount + "");
+ if (g_StartTimerCount < 1)
+ launchGame();
+ else
+ g_StartTimer = setTimeout(launchGameTimer, 1000);
+}
+
function launchGame()
{
if (!g_IsController)
Index: gui/gamesetup/gamesetup.xml
===================================================================
--- gui/gamesetup/gamesetup.xml
+++ gui/gamesetup/gamesetup.xml
@@ -274,7 +274,7 @@
Start a new game with the current settings.
if (g_IsController)
- launchGame();
+ launchGameToggle();
else
toggleReady();