Converted menu hotkey and ai config to new style. Added basic sliding menus. (Need to evaluate potential performance issues here.)
This was SVN commit r10146.
This commit is contained in:
parent
b48c35c512
commit
9a00398e24
@ -5,54 +5,50 @@
|
||||
<script file="gui/aiconfig/aiconfig.js"/>
|
||||
|
||||
<!-- Add a translucent black background to fade out the menu page -->
|
||||
<object type="image" z="0" sprite="bkTranslucent"/>
|
||||
<object type="image" z="0" sprite="BackgroundTranslucent"/>
|
||||
|
||||
<object type="image" style="wheatWindow" size="50%-250 50%-100 50%+250 50%+100">
|
||||
<object type="image" style="StonePanelLight" size="50%-250 50%-100 50%+250 50%+100">
|
||||
|
||||
<object style="wheatWindowTitleBar" type="text">AI configuration</object>
|
||||
<object style="StoneDialogTitleBar" type="text" size="50%-128 -16 50%+128 16">AI Configuration</object>
|
||||
|
||||
<object type="button" style="wheatExit" tooltip_style="snToolTip">
|
||||
<object type="button" style="StoneExit" tooltip_style="snToolTip">
|
||||
<action on="Press"><![CDATA[
|
||||
Engine.PopGuiPage();
|
||||
]]></action>
|
||||
</object>
|
||||
|
||||
<object size="25 10 100%-25 40">
|
||||
<object
|
||||
type="text"
|
||||
font="serif-bold-18"
|
||||
text_align="right"
|
||||
size="0 0 100 100%">
|
||||
<object size="50%-128 46 50%+128 66">
|
||||
<object type="text" style="RightLabelText" size="0 0 100 100%">
|
||||
AI Player
|
||||
</object>
|
||||
|
||||
<object name="aiSelection" type="dropdown" style="wheatDropDown" size="110 0 310 30">
|
||||
<object name="aiSelection" type="dropdown" style="StoneDropDown" size="110 0 310 28">
|
||||
<action on="SelectionChange">selectAI(this.selected);</action>
|
||||
</object>
|
||||
</object>
|
||||
|
||||
<object size="25 50 100%-25 65%-5">
|
||||
<object size="50%-192 66 50%+192 100%-52">
|
||||
|
||||
<object name="aiDescription" type="text" size="0 0 100% 100%"/>
|
||||
<object name="aiDescription" type="text" style="CenteredLabelText" size="0 0 100% 100%"/>
|
||||
|
||||
<!-- TODO: we might want to add things like difficulty controls into here -->
|
||||
|
||||
</object>
|
||||
|
||||
<object type="button" style="wheatButton" size="100%-203 100%-33 100%-103 100%-3">
|
||||
OK
|
||||
<action on="Press"><![CDATA[
|
||||
returnAI();
|
||||
]]></action>
|
||||
</object>
|
||||
|
||||
<object type="button" style="wheatButton" size="100%-103 100%-33 100%-3 100%-3">
|
||||
<object type="button" style="StoneButton" size="100%-280 100%-48 100%-154 100%-20">
|
||||
Cancel
|
||||
<action on="Press"><![CDATA[
|
||||
Engine.PopGuiPage();
|
||||
]]></action>
|
||||
</object>
|
||||
|
||||
<object type="button" style="StoneButton" size="100%-146 100%-48 100%-20 100%-20">
|
||||
OK
|
||||
<action on="Press"><![CDATA[
|
||||
returnAI();
|
||||
]]></action>
|
||||
</object>
|
||||
|
||||
</object>
|
||||
|
||||
</objects>
|
||||
|
@ -23,7 +23,7 @@
|
||||
|
||||
</object>
|
||||
|
||||
<object type="image" style="StonePanelLight" size="0 16 100% 100%" hidden="true" name="setupWindow">
|
||||
<object type="image" style="StonePanelLight" size="24 24 100%-24 100%-24" hidden="true" name="setupWindow">
|
||||
|
||||
<action on="Tick">
|
||||
onTick();
|
||||
@ -34,7 +34,7 @@
|
||||
</object>
|
||||
|
||||
<!-- Map selection -->
|
||||
<object size="20 64 250 100%-20">
|
||||
<object size="20 64 300 100%-20">
|
||||
|
||||
<object size="0 0 40% 100%">
|
||||
<object name="mapTypeHeading" type="text" style="RightLabelText" size="0 0 100% 28">Match Type:</object>
|
||||
@ -76,7 +76,7 @@
|
||||
</object>
|
||||
|
||||
<!-- Player assignments -->
|
||||
<object name="numPlayersBox" size="260 28 100% 30" hidden="true">
|
||||
<object name="numPlayersBox" size="320 28 100% 30" hidden="true">
|
||||
<object name="numPlayersSelectionHeading" type="text" style="LeftLabelText" size="160 0 100% 32">Number of Players</object>
|
||||
<object name="numPlayersSelection"
|
||||
type="dropdown"
|
||||
@ -88,7 +88,7 @@
|
||||
</object>
|
||||
</object>
|
||||
|
||||
<object size="260 64 100%-20 100%-260" type="image" sprite="BackgroundIndentFillDark">
|
||||
<object size="320 64 100%-20 100%-260" type="image" sprite="BackgroundIndentFillDark">
|
||||
<object size="0 6 100% 30">
|
||||
<object name="playerNameHeading" type="text" style="CenteredLabelText" size="100 0 250 100%">Player Name</object>
|
||||
<object name="playerCivHeading" type="text" style="CenteredLabelText" size="250 0 400 100%">Civilization</object>
|
||||
@ -127,7 +127,7 @@
|
||||
|
||||
|
||||
<!-- Options -->
|
||||
<object name="gameOptionsBox" size="260 100%-260 100% 100%-190">
|
||||
<object name="gameOptionsBox" size="320 100%-260 100% 100%-190">
|
||||
<object size="2 2 100% 50%-2"> <!-- Top row -->
|
||||
<object name="mapSizeText" size="0 0 175 100%" type="text" style="LeftLabelText">Map size:</object>
|
||||
<object name="mapSize" size="75 -2 225 100%-6" type="dropdown" style="StoneDropDown" hidden="true" tooltip_style="onscreenToolTip" tooltip="Select map size (larger may reduce performance)"/>
|
||||
@ -144,7 +144,7 @@
|
||||
|
||||
|
||||
<!-- Chat window -->
|
||||
<object name="chatPanel" size="260 100%-190 100%-20 100%-58" type="image" sprite="BackgroundIndentFillDark">
|
||||
<object name="chatPanel" size="320 100%-190 100%-20 100%-64" type="image" sprite="BackgroundIndentFillDark">
|
||||
|
||||
<object name="chatText" size="3 1 100%-1 100%-25" type="text" style="chatPanel"/>
|
||||
|
||||
@ -160,16 +160,17 @@
|
||||
</object>
|
||||
|
||||
|
||||
<!-- Other things -->
|
||||
<!-- Tooltip -->
|
||||
<object name="onscreenToolTip"
|
||||
type="text"
|
||||
font="serif-14"
|
||||
textcolor="white"
|
||||
sprite="BackgroundTranslucent"
|
||||
hidden="true"
|
||||
size="260 100%-64 100%-310 100%-16"
|
||||
size="100%-656 100%-64 100%-304 100%-16"
|
||||
>[Tooltip text]</object>
|
||||
|
||||
<!-- Cancel Button -->
|
||||
<object
|
||||
name="cancelGame"
|
||||
type="button"
|
||||
@ -184,6 +185,7 @@
|
||||
]]></action>
|
||||
</object>
|
||||
|
||||
<!-- Start Button -->
|
||||
<object
|
||||
name="startGame"
|
||||
type="button"
|
||||
|
@ -3,5 +3,9 @@
|
||||
<include>common/setup.xml</include>
|
||||
<include>common/sprite1.xml</include>
|
||||
<include>common/styles.xml</include>
|
||||
|
||||
<include>common/common_sprites.xml</include>
|
||||
<include>common/common_styles.xml</include>
|
||||
|
||||
<include>aiconfig/aiconfig.xml</include>
|
||||
</page>
|
||||
|
@ -83,8 +83,12 @@ function formatUserReportStatus(status)
|
||||
|
||||
function onTick()
|
||||
{
|
||||
// Animate backgrounds
|
||||
scrollBackgrounds();
|
||||
|
||||
// Animate submenu
|
||||
updateMenuPosition();
|
||||
|
||||
if (Engine.IsUserReportEnabled())
|
||||
{
|
||||
getGUIObjectByName("userReportDisabled").hidden = true;
|
||||
@ -101,19 +105,36 @@ function onTick()
|
||||
}
|
||||
}
|
||||
|
||||
// Sizes right border on main menu panel to match the submenu
|
||||
function blendSubmenuIntoMain(topPosition, bottomPosition)
|
||||
{
|
||||
var topSprite = getGUIObjectByName("MainMenuPanelRightBorderTop");
|
||||
topSprite.size = "100%-2 0 100% " + (topPosition + MARGIN);
|
||||
console.write(topSprite.size);
|
||||
|
||||
var bottomSprite = getGUIObjectByName("MainMenuPanelRightBorderBottom");
|
||||
bottomSprite.size = "100%-2 " + (bottomPosition) + " 100% 100%";
|
||||
/*
|
||||
* MENU FUNCTIONS
|
||||
*/
|
||||
|
||||
// Slide menu
|
||||
function updateMenuPosition()
|
||||
{
|
||||
if (getGUIObjectByName("submenuScreen").hidden == false)
|
||||
{
|
||||
var submenu = getGUIObjectByName("submenu");
|
||||
|
||||
// The offset is the increment or number of units/pixels to move
|
||||
// the menu. An offset of one is always accurate, but it is too
|
||||
// slow. The offset must divide into the travel distance evenly
|
||||
// in order for the menu to end up at the right spot. The travel
|
||||
// distance is the max-initial. The travel distance in this
|
||||
// example is 300-60 = 240. We choose an offset of 5 because it
|
||||
// divides into 240 evenly and provided the speed we wanted.
|
||||
var OFFSET = 5;
|
||||
|
||||
if (submenu.size.left < getGUIObjectByName("mainMenu").size.right)
|
||||
{
|
||||
submenu.size = (submenu.size.left + OFFSET) + " " + submenu.size.top + " " + (submenu.size.right + OFFSET) + " " + submenu.size.bottom;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Update the submenu
|
||||
function updateSubmenu(newSubmenu, position, buttonHeight, numButtons)
|
||||
// Opens the menu by revealing the screen which contains the menu
|
||||
function openMenu(newSubmenu, position, buttonHeight, numButtons)
|
||||
{
|
||||
// remove old submenu
|
||||
getGUIObjectByName(currentSubmenu).hidden = true;
|
||||
@ -127,29 +148,54 @@ function updateSubmenu(newSubmenu, position, buttonHeight, numButtons)
|
||||
var top = position - MARGIN;
|
||||
var bottom = position + ((buttonHeight + MARGIN) * numButtons);
|
||||
submenu.size = submenu.size.left + " " + top + " " + submenu.size.right + " " + bottom;
|
||||
submenu.hidden = false;
|
||||
|
||||
// Blend in right border of main menu into the left border of the submenu
|
||||
blendSubmenuIntoMain(top, bottom);
|
||||
|
||||
// prepare to hide the submenu when the mouse moves off of the submenu
|
||||
getGUIObjectByName("submenuScreen").hidden = false;
|
||||
getGUIObjectByName("secondarySubmenuScreen").hidden = false;
|
||||
}
|
||||
|
||||
// Helper function that enables the dark background mask, then reveals a given subwindow object.
|
||||
// Closes the menu and resets position
|
||||
function closeMenu()
|
||||
{
|
||||
getGUIObjectByName("submenuScreen").hidden = true;
|
||||
getGUIObjectByName("secondarySubmenuScreen").hidden = true;
|
||||
getGUIObjectByName("submenu").size = getGUIObjectByName("mainMenu").size;
|
||||
getGUIObjectByName("MainMenuPanelRightBorderTop").size = "100%-2 0 100% 100%";
|
||||
}
|
||||
|
||||
// Sizes right border on main menu panel to match the submenu
|
||||
function blendSubmenuIntoMain(topPosition, bottomPosition)
|
||||
{
|
||||
var topSprite = getGUIObjectByName("MainMenuPanelRightBorderTop");
|
||||
topSprite.size = "100%-2 0 100% " + (topPosition + MARGIN);
|
||||
|
||||
var bottomSprite = getGUIObjectByName("MainMenuPanelRightBorderBottom");
|
||||
bottomSprite.size = "100%-2 " + (bottomPosition) + " 100% 100%";
|
||||
}
|
||||
|
||||
// Reveals submenu
|
||||
function openMainMenuSubWindow (windowName)
|
||||
{
|
||||
guiUnHide("pgSubWindow");
|
||||
guiUnHide(windowName);
|
||||
}
|
||||
|
||||
// Helper function that disables the dark background mask, then hides a given subwindow object.
|
||||
// Hides submenu
|
||||
function closeMainMenuSubWindow (windowName)
|
||||
{
|
||||
guiHide("pgSubWindow");
|
||||
guiHide(windowName);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* FUNCTIONS BELOW DO NOT WORK YET
|
||||
*/
|
||||
|
||||
// Switch to a given options tab window.
|
||||
function openOptionsTab(tabName)
|
||||
{
|
||||
|
@ -146,16 +146,184 @@ Status: $status.
|
||||
</object>
|
||||
</object>
|
||||
|
||||
<!--
|
||||
==========================================
|
||||
- SUBMENU
|
||||
==========================================
|
||||
-->
|
||||
<object name="submenuScreen"
|
||||
type="image"
|
||||
hidden="true"
|
||||
>
|
||||
<!-- hides the submenu when the mouse leaves the mainMenuButtons or submenu -->
|
||||
<action on="MouseEnter">
|
||||
closeMenu();
|
||||
</action>
|
||||
|
||||
<!-- submenu -->
|
||||
<object name="submenu"
|
||||
type="image"
|
||||
style="SubmenuPanel"
|
||||
size="60 50%-100 300 50%+100"
|
||||
>
|
||||
<!-- submenuSinglePlayer -->
|
||||
<object name="submenuSinglePlayer"
|
||||
type="image"
|
||||
size="0 4 100%-4 100%-4"
|
||||
tooltip_style="pgToolTip"
|
||||
tooltip="The 0 A.D. Game Manual."
|
||||
hidden="true"
|
||||
>
|
||||
<object name="subMenuSinglePlayerButton"
|
||||
type="button"
|
||||
style="StoneButtonFancy"
|
||||
size="0 0 100% 28"
|
||||
tooltip_style="pgToolTip"
|
||||
tooltip="Click here to start a new single player game."
|
||||
>
|
||||
Matches
|
||||
<action on="Press">
|
||||
closeMenu();
|
||||
Engine.PushGuiPage("page_gamesetup.xml", { type: "offline" });
|
||||
</action>
|
||||
</object>
|
||||
|
||||
<object name="subMenuCampaignButton"
|
||||
type="button"
|
||||
style="StoneButtonFancy"
|
||||
size="0 32 100% 60"
|
||||
tooltip_style="pgToolTip"
|
||||
tooltip="Relive history through historical military campaigns. [NOT YET IMPLEMENTED]"
|
||||
enabled="false"
|
||||
>
|
||||
Campaigns
|
||||
<action on="Press">
|
||||
closeMenu();
|
||||
<![CDATA[
|
||||
// Open Campaigns window.
|
||||
// NOT IMPLEMENTED YET
|
||||
]]>
|
||||
</action>
|
||||
</object>
|
||||
</object>
|
||||
|
||||
<!-- submenuMultiplayer -->
|
||||
<object name="submenuMultiplayer"
|
||||
type="image"
|
||||
size="0 4 100%-4 100%-4"
|
||||
tooltip_style="pgToolTip"
|
||||
tooltip="The 0 A.D. Game Manual"
|
||||
hidden="true"
|
||||
>
|
||||
<object name="subMenuMultiplayerJoinButton"
|
||||
type="button"
|
||||
style="StoneButtonFancy"
|
||||
size="0 0 100% 28"
|
||||
tooltip_style="pgToolTip"
|
||||
tooltip="Joining an existing multiplayer game."
|
||||
>
|
||||
Join Game
|
||||
<action on="Press">
|
||||
closeMenu();
|
||||
// Open Multiplayer connection window with join option.
|
||||
Engine.PushGuiPage("page_gamesetup_mp.xml", "join");
|
||||
</action>
|
||||
</object>
|
||||
|
||||
<object name="subMenuMultiplayerHostButton"
|
||||
type="button"
|
||||
style="StoneButtonFancy"
|
||||
size="0 32 100% 60"
|
||||
tooltip_style="pgToolTip"
|
||||
tooltip="Host a multiplayer game."
|
||||
>
|
||||
Host Game
|
||||
<action on="Press">
|
||||
closeMenu();
|
||||
// Open Multiplayer connection window with host option.
|
||||
Engine.PushGuiPage("page_gamesetup_mp.xml", "host");
|
||||
</action>
|
||||
</object>
|
||||
|
||||
</object>
|
||||
|
||||
<!-- submenuToolsAndOptions -->
|
||||
<object name="submenuToolsAndOptions"
|
||||
type="image"
|
||||
size="0 4 100%-4 100%-4"
|
||||
tooltip_style="pgToolTip"
|
||||
tooltip="The 0 A.D. Game Manual"
|
||||
hidden="true"
|
||||
>
|
||||
<object name="submenuOptionsButton"
|
||||
style="StoneButtonFancy"
|
||||
type="button"
|
||||
size="0 0 100% 28"
|
||||
tooltip_style="pgToolTip"
|
||||
tooltip="Adjust game settings. [NOT YET IMPLEMENTED]"
|
||||
enabled="false"
|
||||
>
|
||||
Options
|
||||
<action on="Press">
|
||||
closeMenu();
|
||||
<![CDATA[
|
||||
// Open Options window.
|
||||
Engine.PushGuiPage("page_options.xml");
|
||||
]]>
|
||||
</action>
|
||||
</object>
|
||||
|
||||
<object name="submenuEditorButton"
|
||||
style="StoneButtonFancy"
|
||||
type="button"
|
||||
size="0 32 100% 60"
|
||||
tooltip_style="pgToolTip"
|
||||
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"."
|
||||
>
|
||||
Scenario Editor
|
||||
<action on="Press">
|
||||
closeMenu();
|
||||
<![CDATA[
|
||||
// Start Atlas
|
||||
if (Engine.AtlasIsAvailable())
|
||||
Engine.RestartInAtlas();
|
||||
else
|
||||
messageBox(400, 200, "The scenario editor is not available or failed to load.", "Error", 2);
|
||||
]]>
|
||||
</action>
|
||||
</object>
|
||||
</object>
|
||||
</object><!-- end of submenu -->
|
||||
</object><!-- end of submenu screen -->
|
||||
|
||||
|
||||
<!--
|
||||
==========================================
|
||||
- MAIN MENU PANEL
|
||||
==========================================
|
||||
-->
|
||||
<object type="image"
|
||||
<object name="mainMenu"
|
||||
type="image"
|
||||
style="MainMenuPanel"
|
||||
size="60 -2 300 100%+2"
|
||||
z="50"
|
||||
>
|
||||
<!-- These hides the submenu if you move the mouse over
|
||||
the main menu panel. The regular submenu screen canot
|
||||
handle this because it must be below the main menu panel
|
||||
in order for the submenu to slide out from behind the
|
||||
main menu panel. -->
|
||||
<object name="secondarySubmenuScreen"
|
||||
type="image"
|
||||
hidden="true"
|
||||
size="0 0 100% 100%"
|
||||
>
|
||||
<!-- hides the submenu when the mouse leaves the mainMenuButtons or submenu -->
|
||||
<action on="MouseEnter">
|
||||
closeMenu();
|
||||
</action>
|
||||
</object>
|
||||
|
||||
<!-- These are used to make the right side blend in with the submenu -->
|
||||
<object name="MainMenuPanelRightBorderTop"
|
||||
type="image"
|
||||
@ -182,7 +350,11 @@ Status: $status.
|
||||
size="8 156 100%-8 356"
|
||||
ghost="false"
|
||||
>
|
||||
<!-- Allows sliding the mouse over to submenu without it closing automatically -->
|
||||
<!-- Allows sliding the mouse over to the submenu.
|
||||
Without this, the submenu will close automatically
|
||||
when the mouse encounters the "secondarySubmenuScreen"
|
||||
in the thin space between the main menu buttons
|
||||
and the submenu buttons. -->
|
||||
<object
|
||||
type="image"
|
||||
size="100% 0 100%+8 100%"
|
||||
@ -199,7 +371,7 @@ Status: $status.
|
||||
>
|
||||
Learn To Play
|
||||
<action on="Press">
|
||||
getGUIObjectByName("submenu").hidden = true;
|
||||
closeMenu();
|
||||
<![CDATA[
|
||||
Engine.PushGuiPage("page_manual.xml", { "page": "intro" });
|
||||
]]>
|
||||
@ -216,9 +388,8 @@ Status: $status.
|
||||
>
|
||||
Single Player
|
||||
<action on="Press">
|
||||
<![CDATA[
|
||||
updateSubmenu("submenuSinglePlayer", (this.parent.size.top+this.size.top), (this.size.bottom-this.size.top), 2);
|
||||
]]>
|
||||
closeMenu();
|
||||
openMenu("submenuSinglePlayer", (this.parent.size.top+this.size.top), (this.size.bottom-this.size.top), 2);
|
||||
</action>
|
||||
</object>
|
||||
|
||||
@ -232,9 +403,8 @@ Status: $status.
|
||||
>
|
||||
Multiplayer
|
||||
<action on="Press">
|
||||
<![CDATA[
|
||||
updateSubmenu("submenuMultiplayer", (this.parent.size.top+this.size.top), (this.size.bottom-this.size.top), 2);
|
||||
]]>
|
||||
closeMenu();
|
||||
openMenu("submenuMultiplayer", (this.parent.size.top+this.size.top), (this.size.bottom-this.size.top), 2);
|
||||
</action>
|
||||
</object>
|
||||
|
||||
@ -248,9 +418,8 @@ Status: $status.
|
||||
>
|
||||
Tools <![CDATA[&]]> Options
|
||||
<action on="Press">
|
||||
<![CDATA[
|
||||
updateSubmenu("submenuToolsAndOptions", (this.parent.size.top+this.size.top), (this.size.bottom-this.size.top), 2);
|
||||
]]>
|
||||
closeMenu();
|
||||
openMenu("submenuToolsAndOptions", (this.parent.size.top+this.size.top), (this.size.bottom-this.size.top), 2);
|
||||
</action>
|
||||
</object>
|
||||
|
||||
@ -264,7 +433,7 @@ Status: $status.
|
||||
>
|
||||
History
|
||||
<action on="Press">
|
||||
getGUIObjectByName("submenu").hidden = true;
|
||||
closeMenu();
|
||||
<![CDATA[
|
||||
Engine.PushGuiPage("page_civinfo.xml");
|
||||
]]>
|
||||
@ -281,7 +450,7 @@ Status: $status.
|
||||
>
|
||||
Exit
|
||||
<action on="Press">
|
||||
getGUIObjectByName("submenu").hidden = true;
|
||||
closeMenu();
|
||||
<![CDATA[
|
||||
var btCaptions = ["Yes", "No"];
|
||||
var btCode = [exit, null];
|
||||
@ -379,158 +548,7 @@ Get involved at: wildfiregames.com/0ad
|
||||
</object>
|
||||
|
||||
|
||||
<!--
|
||||
==========================================
|
||||
- SUBMENU
|
||||
==========================================
|
||||
-->
|
||||
|
||||
<object name="submenuScreen"
|
||||
type="image"
|
||||
hidden="true"
|
||||
>
|
||||
<!-- hides the submenu when the mouse leaves the mainMenuButtons or submenu -->
|
||||
<action on="MouseEnter">
|
||||
getGUIObjectByName("submenu").hidden = true;
|
||||
getGUIObjectByName("MainMenuPanelRightBorderTop").size = "100%-2 0 100% 100%";
|
||||
</action>
|
||||
|
||||
<!-- submenu -->
|
||||
<object name="submenu"
|
||||
type="image"
|
||||
style="SubmenuPanel"
|
||||
size="300 50%-100 536 50%+100"
|
||||
>
|
||||
<!-- submenuSinglePlayer -->
|
||||
<object name="submenuSinglePlayer"
|
||||
type="image"
|
||||
size="0 4 100%-4 100%-4"
|
||||
tooltip_style="pgToolTip"
|
||||
tooltip="The 0 A.D. Game Manual."
|
||||
hidden="true"
|
||||
>
|
||||
<object name="subMenuSinglePlayerButton"
|
||||
type="button"
|
||||
style="StoneButtonFancy"
|
||||
size="0 0 100% 28"
|
||||
tooltip_style="pgToolTip"
|
||||
tooltip="Click here to start a new single player game."
|
||||
>
|
||||
Matches
|
||||
<action on="Press"><![CDATA[
|
||||
// Hide submenu
|
||||
this.parent.parent.hidden = true;
|
||||
// Open Session Setup window.
|
||||
Engine.PushGuiPage("page_gamesetup.xml", { type: "offline" });
|
||||
]]></action>
|
||||
</object>
|
||||
|
||||
<object name="subMenuCampaignButton"
|
||||
type="button"
|
||||
style="StoneButtonFancy"
|
||||
size="0 32 100% 60"
|
||||
tooltip_style="pgToolTip"
|
||||
tooltip="Relive history through historical military campaigns. [NOT YET IMPLEMENTED]"
|
||||
enabled="false"
|
||||
>
|
||||
Campaigns
|
||||
<action on="Press"><![CDATA[
|
||||
// Hide submenu
|
||||
this.parent.parent.hidden = true;
|
||||
// Open Campaigns window.
|
||||
// NOT IMPLEMENTED YET
|
||||
]]></action>
|
||||
</object>
|
||||
</object>
|
||||
|
||||
<!-- submenuMultiplayer -->
|
||||
<object name="submenuMultiplayer"
|
||||
type="image"
|
||||
size="0 4 100%-4 100%-4"
|
||||
tooltip_style="pgToolTip"
|
||||
tooltip="The 0 A.D. Game Manual"
|
||||
hidden="true"
|
||||
>
|
||||
<object name="subMenuMultiplayerJoinButton"
|
||||
type="button"
|
||||
style="StoneButtonFancy"
|
||||
size="0 0 100% 28"
|
||||
tooltip_style="pgToolTip"
|
||||
tooltip="Joining an existing multiplayer game."
|
||||
>
|
||||
Join Game
|
||||
<action on="Press"><![CDATA[
|
||||
// Hide submenu
|
||||
this.parent.parent.hidden = true;
|
||||
// Open Multiplayer connection window with join option.
|
||||
Engine.PushGuiPage("page_gamesetup_mp.xml", "join");
|
||||
]]></action>
|
||||
</object>
|
||||
|
||||
<object name="subMenuMultiplayerHostButton"
|
||||
type="button"
|
||||
style="StoneButtonFancy"
|
||||
size="0 32 100% 60"
|
||||
tooltip_style="pgToolTip"
|
||||
tooltip="Host a multiplayer game."
|
||||
>
|
||||
Host Game
|
||||
<action on="Press"><![CDATA[
|
||||
// Hide submenu
|
||||
this.parent.parent.hidden = true;
|
||||
// Open Multiplayer connection window with host option.
|
||||
Engine.PushGuiPage("page_gamesetup_mp.xml", "host");
|
||||
]]></action>
|
||||
</object>
|
||||
|
||||
</object>
|
||||
|
||||
<!-- submenuToolsAndOptions -->
|
||||
<object name="submenuToolsAndOptions"
|
||||
type="image"
|
||||
size="0 4 100%-4 100%-4"
|
||||
tooltip_style="pgToolTip"
|
||||
tooltip="The 0 A.D. Game Manual"
|
||||
hidden="true"
|
||||
>
|
||||
<object name="submenuOptionsButton"
|
||||
style="StoneButtonFancy"
|
||||
type="button"
|
||||
size="0 0 100% 28"
|
||||
tooltip_style="pgToolTip"
|
||||
tooltip="Adjust game settings. [NOT YET IMPLEMENTED]"
|
||||
enabled="false"
|
||||
>
|
||||
Options
|
||||
<action on="Press"><![CDATA[
|
||||
// Hide submenu
|
||||
this.parent.parent.hidden = true;
|
||||
// Open Options window.
|
||||
Engine.PushGuiPage("page_options.xml");
|
||||
]]></action>
|
||||
</object>
|
||||
|
||||
<object name="submenuEditorButton"
|
||||
style="StoneButtonFancy"
|
||||
type="button"
|
||||
size="0 32 100% 60"
|
||||
tooltip_style="pgToolTip"
|
||||
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"."
|
||||
>
|
||||
Scenario Editor
|
||||
<action on="Press"><![CDATA[
|
||||
// Hide submenu
|
||||
this.parent.parent.hidden = true;
|
||||
// Start Atlas
|
||||
if (Engine.AtlasIsAvailable())
|
||||
Engine.RestartInAtlas();
|
||||
else
|
||||
messageBox(400, 200, "The scenario editor is not available or failed to load.", "Error", 2);
|
||||
]]></action>
|
||||
</object>
|
||||
</object>
|
||||
</object><!-- end of submenu -->
|
||||
</object><!-- end of submenu screen -->
|
||||
|
||||
|
||||
|
||||
|
@ -1,13 +1,63 @@
|
||||
/*
|
||||
* MENU POSITION CONSTANTS
|
||||
*/
|
||||
|
||||
// Menu / panel border size
|
||||
const MARGIN = 4;
|
||||
|
||||
// Includes the main menu button
|
||||
const NUM_BUTTONS = 5;
|
||||
|
||||
// Regular menu buttons
|
||||
const BUTTON_HEIGHT = 32;
|
||||
|
||||
// The position where the bottom of the menu will end up (currently 164)
|
||||
const END_MENU_POSITION = (BUTTON_HEIGHT * NUM_BUTTONS) + MARGIN;
|
||||
|
||||
// Menu starting position - bottom
|
||||
const MENU_BOTTOM = 36;
|
||||
|
||||
// Menu starting position - top
|
||||
const MENU_TOP = MENU_BOTTOM - END_MENU_POSITION;
|
||||
|
||||
// Menu starting position - overall
|
||||
const INITIAL_MENU_POSITION = "100%-" + END_MENU_POSITION + " " + MENU_TOP + " 100% " + MENU_BOTTOM;
|
||||
|
||||
|
||||
// Slide menu
|
||||
function updateMenuPosition()
|
||||
{
|
||||
if (getGUIObjectByName("menuScreen").hidden == false)
|
||||
{
|
||||
var menu = getGUIObjectByName("menu");
|
||||
|
||||
// The offset is the increment or number of units/pixels to move
|
||||
// the menu. An offset of one is always accurate, but it is too
|
||||
// slow. The offset must divide into the travel distance evenly
|
||||
// in order for the menu to end up at the right spot. The travel
|
||||
// distance is the max-initial. The travel distance in this
|
||||
// example is 164-36 = 128. We choose an offset of 8 because it
|
||||
// divides into 128 evenly and provided the speed we wanted.
|
||||
var OFFSET = 8;
|
||||
|
||||
if (menu.size.bottom < END_MENU_POSITION)
|
||||
{
|
||||
menu.size = "100%-" + END_MENU_POSITION + " " + (menu.size.top + OFFSET) + " 100% " + (menu.size.bottom + OFFSET);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Opens the menu by revealing the screen which contains the menu
|
||||
function openMenu()
|
||||
{
|
||||
getGUIObjectByName("menuScreen").hidden = false;
|
||||
getGUIObjectByName("menu").hidden = false;
|
||||
}
|
||||
|
||||
// Closes the menu and resets position
|
||||
function closeMenu()
|
||||
{
|
||||
getGUIObjectByName("menuScreen").hidden = true;
|
||||
getGUIObjectByName("menu").hidden = true;
|
||||
getGUIObjectByName("menu").size = INITIAL_MENU_POSITION;
|
||||
}
|
||||
|
||||
function openSettings()
|
||||
|
@ -174,6 +174,9 @@ function onTick()
|
||||
// Run timers
|
||||
updateTimers();
|
||||
|
||||
// Animate menu
|
||||
updateMenuPosition();
|
||||
|
||||
// When training is blocked, flash population (alternates colour every 500msec)
|
||||
if (g_IsTrainingQueueBlocked && (Date.now() % 1000) < 500)
|
||||
getGUIObjectByName("resourcePop").textcolor = "255 165 0";
|
||||
|
@ -52,7 +52,7 @@
|
||||
|
||||
<!-- Menu -->
|
||||
<object hotkey="menu.toggle">
|
||||
<action on="Press">openMenuDialog();</action>
|
||||
<action on="Press">openMenu();</action>
|
||||
</object>
|
||||
|
||||
<!-- Pause -->
|
||||
@ -195,83 +195,6 @@
|
||||
|
||||
</object>
|
||||
|
||||
<!-- ================================ ================================ -->
|
||||
<!-- Menu -->
|
||||
<!-- ================================ ================================ -->
|
||||
<object name="menuScreen"
|
||||
type="image"
|
||||
hidden="true"
|
||||
>
|
||||
<!-- hides the submenu when the mouse leaves the mainMenuButtons or submenu -->
|
||||
<action on="MouseEnter">
|
||||
closeMenu();
|
||||
</action>
|
||||
|
||||
<object name="menu"
|
||||
style="StonePanelThinBorder"
|
||||
type="image"
|
||||
size="100%-164 0 100% 164"
|
||||
hidden="true"
|
||||
>
|
||||
<object size="4 36 100%-4 50%+20">
|
||||
|
||||
<!-- Settings button -->
|
||||
<object type="button"
|
||||
name="settingsButton"
|
||||
style="StoneButtonFancy"
|
||||
size="0 0 100% 28"
|
||||
tooltip_style="sessionToolTip"
|
||||
>
|
||||
Settings
|
||||
<action on="Press">
|
||||
openSettings();
|
||||
</action>
|
||||
</object>
|
||||
|
||||
<!-- Chat button -->
|
||||
<object type="button"
|
||||
name="chatButton"
|
||||
style="StoneButtonFancy"
|
||||
size="0 32 100% 60"
|
||||
tooltip_style="sessionToolTip"
|
||||
>
|
||||
Chat
|
||||
<action on="Press">
|
||||
openChat();
|
||||
</action>
|
||||
</object>
|
||||
|
||||
<!-- Pause Button -->
|
||||
<object type="button"
|
||||
name="pauseButton"
|
||||
style="StoneButtonFancy"
|
||||
size="0 64 100% 92"
|
||||
tooltip_style="sessionToolTip"
|
||||
>
|
||||
<object name="pauseButtonText" type="text" style="CenteredButtonText" ghost="true">Pause</object>
|
||||
<action on="Press">
|
||||
togglePause();
|
||||
</action>
|
||||
</object>
|
||||
|
||||
<!-- Exit button -->
|
||||
<object type="button"
|
||||
name="menuExitButton"
|
||||
style="StoneButtonFancy"
|
||||
size="0 96 100% 124"
|
||||
tooltip_style="sessionToolTip"
|
||||
>
|
||||
Exit
|
||||
<action on="Press">escapeKeyAction();<![CDATA[
|
||||
var btCaptions = ["Yes", "No"];
|
||||
var btCode = [leaveGame, null];
|
||||
messageBox(400, 200, "Are you sure you want to quit?", "Confirmation", 0, btCaptions, btCode);
|
||||
]]></action>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
|
||||
<!-- ================================ ================================ -->
|
||||
<!-- Settings Window -->
|
||||
<!-- ================================ ================================ -->
|
||||
@ -412,13 +335,104 @@
|
||||
size="100%-164 4 100%-8 32"
|
||||
style="StoneButtonFancy"
|
||||
tooltip_style="sessionToolTip"
|
||||
z="50"
|
||||
>
|
||||
<object size="50%-32 50%-16 50%+32 50%+16" type="image" sprite="menuButton" name="menuButtonText" ghost="true">MENU</object>
|
||||
<action on="Press">openMenu();</action>
|
||||
</object> <!-- END OF MENU BUTTON -->
|
||||
<!-- This object covers up the text on the menu
|
||||
buttons as they slide by so that you don't see
|
||||
them on top of the main menu button -->
|
||||
<object size="0 -4 100% 0" type="image" sprite="horizontalThinBorder" ghost="true"/>
|
||||
|
||||
<object size="50%-32 50%-16 50%+32 50%+16" type="image" sprite="menuButton" ghost="true">MENU</object>
|
||||
<action on="Press">
|
||||
openMenu();
|
||||
</action>
|
||||
</object> <!-- END OF MENU BUTTON -->
|
||||
</object> <!-- END OF TOP PANEL -->
|
||||
|
||||
<!-- ================================ ================================ -->
|
||||
<!-- Menu -->
|
||||
<!-- ================================ ================================ -->
|
||||
<object name="menuScreen"
|
||||
type="image"
|
||||
hidden="true"
|
||||
size="0 0 100% 100%"
|
||||
>
|
||||
<!-- hides the menu when the mouse leaves the menu -->
|
||||
<action on="MouseEnter">
|
||||
closeMenu();
|
||||
</action>
|
||||
|
||||
<object name="menu"
|
||||
style="StonePanelThinBorder"
|
||||
type="image"
|
||||
size="100%-164 -128 100% 36"
|
||||
>
|
||||
<object size="4 36 100%-4 50%+20">
|
||||
|
||||
<!-- Settings button -->
|
||||
<object type="button"
|
||||
name="settingsButton"
|
||||
style="StoneButtonFancy"
|
||||
size="0 0 100% 28"
|
||||
tooltip_style="sessionToolTip"
|
||||
>
|
||||
Settings
|
||||
<action on="Press">
|
||||
closeMenu();
|
||||
openSettings();
|
||||
</action>
|
||||
</object>
|
||||
|
||||
<!-- Chat button -->
|
||||
<object type="button"
|
||||
name="chatButton"
|
||||
style="StoneButtonFancy"
|
||||
size="0 32 100% 60"
|
||||
tooltip_style="sessionToolTip"
|
||||
>
|
||||
Chat
|
||||
<action on="Press">
|
||||
closeMenu();
|
||||
openChat();
|
||||
</action>
|
||||
</object>
|
||||
|
||||
<!-- Pause Button -->
|
||||
<object type="button"
|
||||
name="pauseButton"
|
||||
style="StoneButtonFancy"
|
||||
size="0 64 100% 92"
|
||||
tooltip_style="sessionToolTip"
|
||||
>
|
||||
<object name="pauseButtonText" type="text" style="CenteredButtonText" ghost="true">Pause</object>
|
||||
<action on="Press">
|
||||
closeMenu();
|
||||
togglePause();
|
||||
</action>
|
||||
</object>
|
||||
|
||||
<!-- Exit button -->
|
||||
<object type="button"
|
||||
name="menuExitButton"
|
||||
style="StoneButtonFancy"
|
||||
size="0 96 100% 124"
|
||||
tooltip_style="sessionToolTip"
|
||||
>
|
||||
Exit
|
||||
<action on="Press">
|
||||
closeMenu();
|
||||
escapeKeyAction();
|
||||
<![CDATA[
|
||||
var btCaptions = ["Yes", "No"];
|
||||
var btCode = [leaveGame, null];
|
||||
messageBox(400, 200, "Are you sure you want to quit?", "Confirmation", 0, btCaptions, btCode);
|
||||
]]>
|
||||
</action>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
|
||||
<!-- ================================ ================================ -->
|
||||
<!-- Unit Selection Groups -->
|
||||
<!-- ================================ ================================ -->
|
||||
|
@ -50,7 +50,15 @@
|
||||
<sprite name="menuButton">
|
||||
<image
|
||||
texture="session/icons/single/menu.png"
|
||||
size="0 0 100% 100%"
|
||||
real_texture_placement="6 10 60 23"
|
||||
size="6 10 60 23"
|
||||
/>
|
||||
</sprite>
|
||||
|
||||
<sprite name="horizontalThinBorder">
|
||||
<image
|
||||
texture="global/border/line_horiz.png"
|
||||
texture_size="0 0 64 4"
|
||||
/>
|
||||
</sprite>
|
||||
|
||||
|
@ -13,7 +13,7 @@
|
||||
|
||||
<object type="image"
|
||||
style="StonePanelLight"
|
||||
size="25 35 100%-25 100%-25"
|
||||
size="24 24 100%-24 100%-24"
|
||||
>
|
||||
<object style="StoneDialogTitleBar" type="text" size="50%-128 0%-16 50%+128 16">
|
||||
Summary
|
||||
|
Loading…
Reference in New Issue
Block a user