Ticket #4284: restart-menu.patch
File restart-menu.patch, 2.6 KB (added by , 8 years ago) |
---|
-
gui/session/menu.js
2 2 const MARGIN = 4; 3 3 4 4 // Includes the main menu button 5 const NUM_BUTTONS = 9;5 const NUM_BUTTONS = 10; 6 6 7 7 // Regular menu buttons 8 8 const BUTTON_HEIGHT = 32; … … 105 105 togglePause(); 106 106 } 107 107 108 function restartMenuButton() 109 { 110 closeOpenDialogs(); 111 pauseGame(); 112 113 messageBox( 114 400, 200, 115 translate("Are you sure you want to restart the game?"), 116 translate("Confirmation"), 117 [translate("No"), translate("Yes")], 118 [resumeGame, restartGame] 119 ); 120 } 121 108 122 function resignMenuButton() 109 123 { 110 124 closeOpenDialogs(); -
gui/session/menu.xml
77 77 <action on="Press">togglePause();</action> 78 78 </object> 79 79 80 <!-- Restart button --> 81 <object type="button" 82 name="menuRestartButton" 83 style="StoneButtonFancy" 84 size="0 192 100% 220" 85 tooltip_style="sessionToolTip" 86 > 87 <translatableAttribute id="caption">Restart</translatableAttribute> 88 <action on="Press">restartMenuButton();</action> 89 </object> 90 80 91 <!-- Resign button --> 81 92 <object type="button" 82 93 name="menuResignButton" 83 94 style="StoneButtonFancy" 84 size="0 192 100% 220"95 size="0 224 100% 252" 85 96 tooltip_style="sessionToolTip" 86 97 > 87 98 <translatableAttribute id="caption">Resign</translatableAttribute> … … 92 103 <object type="button" 93 104 name="menuExitButton" 94 105 style="StoneButtonFancy" 95 size="0 2 24 100% 252"106 size="0 256 100% 284" 96 107 tooltip_style="sessionToolTip" 97 108 > 98 109 <translatableAttribute id="caption">Exit</translatableAttribute> -
gui/session/session.js
520 520 * Resign a player. 521 521 * @param leaveGameAfterResign If player is quitting after resignation. 522 522 */ 523 524 function restartGame() 525 { 526 let playerId = Engine.GetPlayerID(); 527 let gameAttributes = g_GameAttributes; 528 gameAttributes.settings.Seed = Math.floor(Math.random() * Math.pow(2, 32)); 529 Engine.EndGame(); 530 Engine.StartGame(gameAttributes, playerId); 531 Engine.SwitchGuiPage("page_loading.xml", { 532 "attribs": gameAttributes, 533 "isNetworked" : g_IsNetworked, 534 "playerAssignments": g_PlayerAssignments 535 }); 536 } 537 523 538 function resignGame(leaveGameAfterResign) 524 539 { 525 540 if (g_IsObserver || g_Disconnected)