- Timestamp:
- 08/27/11 17:21:12 (13 years ago)
- Location:
- ps/trunk/binaries/data/mods/public/gui/pregame
- Files:
-
- 2 edited
-
mainmenu.js (modified) (3 diffs)
-
mainmenu.xml (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
ps/trunk/binaries/data/mods/public/gui/pregame/mainmenu.js
r10103 r10107 1 1 var userReportEnabledText; // contains the original version with "$status" placeholder 2 var currentSubmenu; // contains placeholdersubmenu 2 3 3 4 function init() … … 8 9 9 10 userReportEnabledText = getGUIObjectByName("userReportEnabledText").caption; 11 currentSubmenu = "submenuSinglePlayer"; 10 12 } 11 13 … … 100 102 101 103 // Update the submenu 102 var MARGIN = 4; 103 var currentSubmenu; 104 function updateSubmenu(buttonName, newSubmenu, numButtons) 104 function updateSubmenu(newSubmenu, position, buttonHeight, numButtons) 105 105 { 106 // hide old submenu if possible 107 if (null != currentSubmenu) 108 { 109 getGUIObjectByName(currentSubmenu).hidden = true; 110 } 106 const MARGIN = 4; 107 108 // remove old submenu 109 getGUIObjectByName(currentSubmenu).hidden = true; 111 110 112 // s avenew submenu111 // switch to new submenu 113 112 currentSubmenu = newSubmenu; 114 115 // unhide new submenu116 113 getGUIObjectByName(currentSubmenu).hidden = false; 117 118 // find position of new submenu 119 var sourceButton = getGUIObjectByName(buttonName); 120 var verticalOffset = getGUIObjectByName("mainMenuButtons").size.top; 121 var buttonHeight = sourceButton.size.bottom - sourceButton.size.top; 122 123 var top = verticalOffset + sourceButton.size.top - MARGIN; 124 var bottom = verticalOffset + sourceButton.size.bottom + buttonHeight * (numButtons-1) + MARGIN; 125 114 126 115 // set position of new submenu 127 116 var submenu = getGUIObjectByName("submenu"); 117 var top = position - MARGIN; 118 var bottom = position + (buttonHeight * numButtons) + MARGIN; 128 119 submenu.size = submenu.size.left + " " + top + " " + submenu.size.right + " " + bottom; 129 120 submenu.hidden = false; -
ps/trunk/binaries/data/mods/public/gui/pregame/mainmenu.xml
r10103 r10107 206 206 Single Player 207 207 <action on="Press"><![CDATA[ 208 updateSubmenu(" menuSinglePlayerButton", "submenuSinglePlayer", 3);208 updateSubmenu("submenuSinglePlayer", (this.parent.size.top+this.size.top), (this.size.bottom-this.size.top), 3); 209 209 ]]></action> 210 210 </object> … … 220 220 Multiplayer 221 221 <action on="Press"><![CDATA[ 222 updateSubmenu(" menuMultiplayerButton", "submenuMultiplayer", 2);222 updateSubmenu("submenuMultiplayer", (this.parent.size.top+this.size.top), (this.size.bottom-this.size.top), 2); 223 223 ]]></action> 224 224 </object> … … 234 234 Tools <![CDATA[&]]> Options 235 235 <action on="Press"><![CDATA[ 236 updateSubmenu(" menuToolsAndOptionsButton", "submenuToolsAndOptions", 2);236 updateSubmenu("submenuToolsAndOptions", (this.parent.size.top+this.size.top), (this.size.bottom-this.size.top), 2); 237 237 ]]></action> 238 238 </object> … … 362 362 <!-- 363 363 ========================================== 364 - MAIN MENU SIDE PANEL364 - SUBMENU 365 365 ========================================== 366 366 --> … … 371 371 hidden="true" 372 372 > 373 <!-- hides the submenu when the mouse leaves the mainMenuButtons or submenu --> 373 374 <action on="MouseEnter"> 374 <![CDATA[getGUIObjectByName("submenu").hidden = true; ;]]>375 <![CDATA[getGUIObjectByName("submenu").hidden = true;]]> 375 376 </action> 376 <object 377 name="submenu" 378 type="image" 379 style="MainMenuPanel" 380 size="298 50%-100 538 50%+100" 381 > 382 <object name="submenuSinglePlayer" 383 type="image" 384 size="4 4 100%-4 100%-4" 385 tooltip_style="pgToolTip" 386 tooltip="The 0 A.D. Game Manual" 387 hidden="true" 388 > 389 <object name="subMenuSinglePlayerButton" 390 type="button" 391 style="StoneButtonFancy" 392 size="0 0 100% 32" 377 378 <!-- submenu --> 379 <object 380 name="submenu" 381 type="image" 382 style="MainMenuPanel" 383 size="298 50%-100 538 50%+100" 384 > 385 <!-- submenuSinglePlayer --> 386 <object name="submenuSinglePlayer" 387 type="image" 388 size="4 4 100%-4 100%-4" 393 389 tooltip_style="pgToolTip" 394 tooltip="Click here to start a new single player game. (A very basic computer opponent is available for testing purposes.)" 390 tooltip="The 0 A.D. Game Manual" 391 hidden="true" 395 392 > 396 Single Player Matches 397 <action on="Press"><![CDATA[ 398 // Open Session Setup window. 399 Engine.PushGuiPage("page_gamesetup.xml", { type: "offline" }); 400 ]]></action> 393 <object name="subMenuSinglePlayerButton" 394 type="button" 395 style="StoneButtonFancy" 396 size="0 0 100% 32" 397 tooltip_style="pgToolTip" 398 tooltip="Click here to start a new single player game. (A very basic computer opponent is available for testing purposes.)" 399 > 400 Single Player Matches 401 <action on="Press"><![CDATA[ 402 // Open Session Setup window. 403 Engine.PushGuiPage("page_gamesetup.xml", { type: "offline" }); 404 ]]></action> 405 </object> 406 407 <object name="subMenuCampaignButton" 408 type="button" 409 style="StoneButtonFancy" 410 size="0 32 100% 64" 411 tooltip_style="pgToolTip" 412 tooltip="Want to play a campaign? Unfortunately you'll have to wait as they're not yet implemented." 413 enabled="false" 414 > 415 Historical Campaigns 416 <action on="Press"><![CDATA[ 417 openMainMenuSubWindow ("pgCampaigns"); 418 ]]></action> 419 </object> 401 420 </object> 402 421 403 < object name="subMenuCampaignButton"404 type="button"405 style="StoneButtonFancy"406 size=" 0 32 100% 64"422 <!-- submenuMultiplayer --> 423 <object name="submenuMultiplayer" 424 type="image" 425 size="4 4 100%-4 100%-4" 407 426 tooltip_style="pgToolTip" 408 tooltip=" Want to play a campaign? Unfortunately you'll have to wait as they're not yet implemented."409 enabled="false"427 tooltip="The 0 A.D. Game Manual" 428 hidden="true" 410 429 > 411 Historical Campaigns 412 <action on="Press"><![CDATA[ 413 openMainMenuSubWindow ("pgCampaigns"); 414 ]]></action> 430 <object name="subMenuMultiplayerJoinGameButton" 431 type="button" 432 style="StoneButtonFancy" 433 size="0 0 100% 32" 434 tooltip_style="pgToolTip" 435 tooltip="Tired of playing with yourself? Fight against one or more human players in a multiplayer game." 436 > 437 Multiplayer 438 <action on="Press"><![CDATA[ 439 // Open Multiplayer connection window. 440 Engine.PushGuiPage("page_gamesetup_mp.xml"); 441 ]]></action> 442 </object> 415 443 </object> 416 </object> 417 418 419 <object name="submenuMultiplayer" 420 type="image" 421 size="4 4 100%-4 100%-4" 422 tooltip_style="pgToolTip" 423 tooltip="The 0 A.D. Game Manual" 424 hidden="true" 425 > 426 <object name="subMenuMultiplayerJoinGameButton" 427 type="button" 428 style="StoneButtonFancy" 429 size="0 0 100% 32" 444 445 <!-- submenuToolsAndOptions --> 446 <object name="submenuToolsAndOptions" 447 type="image" 448 size="4 4 100%-4 100%-4" 430 449 tooltip_style="pgToolTip" 431 tooltip="Tired of playing with yourself? Fight against one or more human players in a multiplayer game." 450 tooltip="The 0 A.D. Game Manual" 451 hidden="true" 432 452 > 433 Multiplayer 434 <action on="Press"><![CDATA[ 435 // Open Multiplayer connection window. 436 Engine.PushGuiPage("page_gamesetup_mp.xml"); 437 ]]></action> 453 <object name="submenuOptionsButton" 454 style="StoneButtonFancy" 455 type="button" 456 size="0 0 100% 32" 457 tooltip_style="pgToolTip" 458 tooltip="This will take you to the options menu. It does not work now, but someday it will." 459 enabled="false" 460 > 461 Options 462 <action on="Press"><![CDATA[ 463 // Open Options window. 464 openMainMenuSubWindow ("pgOptions"); 465 ]]></action> 466 </object> 467 468 <object name="submenuEditorButton" 469 style="StoneButtonFancy" 470 type="button" 471 size="0 32 100% 64" 472 tooltip_style="pgToolTip" 473 tooltip="Open the Atlas Scenario Editor in a new window. You can run this more reliably by starting the game with the command-line argument "-editor"." 474 > 475 Scenario Editor 476 <action on="Press"><![CDATA[ 477 if (Engine.AtlasIsAvailable()) 478 Engine.RestartInAtlas(); 479 else 480 messageBox(400, 200, "The scenario editor is not available or failed to load.", "Error", 2); 481 ]]></action> 482 </object> 438 483 </object> 439 </object> 440 441 <object name="submenuToolsAndOptions" 442 type="image" 443 size="4 4 100%-4 100%-4" 444 tooltip_style="pgToolTip" 445 tooltip="The 0 A.D. Game Manual" 446 hidden="true" 447 > 448 <object name="submenuOptionsButton" 449 style="StoneButtonFancy" 450 type="button" 451 size="4 0 100%-4 32" 452 tooltip_style="pgToolTip" 453 tooltip="This will take you to the options menu. It does not work now, but someday it will." 454 enabled="false" 455 > 456 Options 457 <action on="Press"><![CDATA[ 458 // Open Options window. 459 openMainMenuSubWindow ("pgOptions"); 460 ]]></action> 461 </object> 462 463 <object name="submenuEditorButton" 464 style="StoneButtonFancy" 465 type="button" 466 size="4 32 100%-4 64" 467 tooltip_style="pgToolTip" 468 tooltip="Open the Atlas Scenario Editor in a new window. You can run this more reliably by starting the game with the command-line argument "-editor"." 469 > 470 Scenario Editor 471 <action on="Press"><![CDATA[ 472 if (Engine.AtlasIsAvailable()) 473 Engine.RestartInAtlas(); 474 else 475 messageBox(400, 200, "The scenario editor is not available or failed to load.", "Error", 2); 476 ]]></action> 477 </object> 478 </object> 479 </object> 480 481 </object> <!-- end of screen --> 484 </object><!-- end of submenu --> 485 </object><!-- end of submenu screen --> 482 486 483 487
Note:
See TracChangeset
for help on using the changeset viewer.
