1
0
forked from mirrors/0ad

Menu: removed autohiding, doubled speed, added sound effects. GUI art: changed gold titlebar back to bronze, made progressbar consistent with titlebar. Repositioned start game button.

This was SVN commit r10155.
This commit is contained in:
WhiteTreePaladin
2011-09-01 02:36:38 +00:00
parent 1389f11b6e
commit 142bd05380
19 changed files with 342 additions and 357 deletions
@@ -7,14 +7,14 @@
LOGOS
==========================================
-->
<sprite name="productLogo">
<image texture="pregame/shell/logo/0ad_logo.png"
real_texture_placement="0 0 256 128"
size="0 -5% 100% 105%"
/>
</sprite>
<sprite name="companyLogo">
<image texture="pregame/shell/logo/wfg_logo_white.png"
real_texture_placement="0 0 32 32"
@@ -65,7 +65,7 @@
<!-- Starting with top left corner continuing in a clockwise manner -->
<!-- Top border -->
<image backcolor="60 60 40"
size="0 0 100%-1 1"
size="0 0 100%-1 1"
/>
<!-- Right border -->
<image backcolor="120 120 80"
@@ -77,7 +77,7 @@
/>
<!-- Left border -->
<image backcolor="60 60 40"
size="0 0 1 100%-1"
size="0 0 1 100%-1"
/>
<!-- middle -->
<image backcolor="0 0 0 85"
@@ -117,23 +117,23 @@
<image backcolor="230 190 80"
size="0 0 2 100%"
/>-->
<!-- top -->
<image backcolor="230 190 80"
size="2 0 100%-2 2"
/>
<!-- bottom -->
<image backcolor="230 190 80"
size="2 100%-2 100%-2 100%"
/>
<!-- left -->
<image backcolor="230 190 80"
size="0 0 2 100%"
/>
</sprite>
<!-- MainMenuPanelRightBorder -->
<sprite name="MainMenuPanelRightBorder">
<!-- right -->
@@ -141,7 +141,7 @@
size="0 0 100% 100%"
/>
</sprite>
<!-- SubmenuPanel -->
<sprite name="SubmenuPanel">
<image texture="global/tile/stone_background.png"
@@ -216,7 +216,7 @@
<image texture="global/tile/stone_background.png"
real_texture_placement="0 0 312 312"
texture_size="0 0 256 256"
size="4 4 100%-4 100%-4"
size="4 4 100%-4 100%-4"
/>
<!-- sides -->
@@ -262,7 +262,7 @@
<sprite name="StonePanelThinBorder">
<image texture="global/tile/stone_background.png"
texture_size="0 0 512 512"
size="4 4 100%-4 100%-4"
size="4 4 100%-4 100%-4"
/>
<!-- sides -->
@@ -308,7 +308,7 @@
<!-- background -->
<image texture="global/tile/stone_background.png"
texture_size="0 0 512 512"
size="4 4 100%-4 100%-4"
size="4 4 100%-4 100%-4"
/>
<!-- sides -->
@@ -353,9 +353,15 @@
<!-- background -->
<image texture="global/tile/stone_background_light.png"
texture_size="0 0 512 512"
size="4 4 100%-4 100%-4"
size="4 4 100%-4 100%-4"
/>
<!-- shading -->
<image
texture="global/shading/gradient_wide.png"
size="0 0 100% 100%"
/>
<!-- thin sides -->
<image texture="global/border/line_horiz.png"
texture_size="0 0 64 4"
@@ -373,7 +379,7 @@
texture_size="0 0 4 64"
size="16 20 20 100%-20"
/>
<!-- thin corners -->
<image
texture="global/border/line_corner_top_right.png"
@@ -392,12 +398,6 @@
texture_size="0 0 4 4"
size="16 16 20 20"
/>
<!-- shading -->
<image
texture="global/shading/gradient_wide.png"
size="0 0 100% 100%"
/>
<!-- sides -->
<image texture="global/border/border-top.png"
@@ -444,7 +444,7 @@
/>
<image texture="global/titlebar/titlebar_middle.png"
real_texture_placement="0 0 64 32"
size="50%-64 0 50%+64 32"
size="50%-64 0 50%+64 32"
/>
<image texture="global/titlebar/titlebar_right.png"
real_texture_placement="0 0 64 32"
@@ -457,18 +457,18 @@
MENU CONTROL ELEMENT SPRITES
==========================================
-->
<sprite name="StoneButton">
<image texture="global/button/button_stone_unselected.png"
real_texture_placement="0 0 256 28"
size="0 0 100% 100%"
size="0 0 100% 100%"
/>
</sprite>
<sprite name="StoneButtonOver">
<image texture="global/button/button_stone_selected.png"
real_texture_placement="0 0 256 28"
size="0 0 100% 100%"
size="0 0 100% 100%"
/>
</sprite>
@@ -476,22 +476,22 @@
<effect add_color="60 42 42 0" />
<image texture="global/button/button_stone_selected.png"
real_texture_placement="0 0 256 28"
size="0 0 100% 100%"
size="0 0 100% 100%"
/>
</sprite>
<sprite name="StoneButtonFancyOver">
<image texture="global/button/button_stone_selected.png"
real_texture_placement="0 0 256 28"
size="0 0 100% 100%"
size="0 0 100% 100%"
/>
<image texture="global/button/button_stone_selected_left_trim.png"
real_texture_placement="0 0 32 28"
size="0 0 32 28"
size="0 0 32 28"
/>
<image texture="global/button/button_stone_selected_right_trim.png"
real_texture_placement="0 0 32 28"
size="100%-32 0 100% 28"
size="100%-32 0 100% 28"
/>
</sprite>
@@ -499,15 +499,15 @@
<effect add_color="60 42 42 0" />
<image texture="global/button/button_stone_selected.png"
real_texture_placement="0 0 256 28"
size="0 0 100% 100%"
size="0 0 100% 100%"
/>
<image texture="global/button/button_stone_selected_left_trim.png"
real_texture_placement="0 0 32 28"
size="0 0 32 28"
size="0 0 32 28"
/>
<image texture="global/button/button_stone_selected_right_trim.png"
real_texture_placement="0 0 32 28"
size="100%-32 0 100% 28"
size="100%-32 0 100% 28"
/>
</sprite>
@@ -515,86 +515,86 @@
<effect grayscale="" />
<image texture="global/button/button_stone_unselected.png"
real_texture_placement="0 0 256 28"
size="0 0 100% 100%"
size="0 0 100% 100%"
/>
</sprite>
<sprite name="StoneCheckBoxOpen">
<image texture="global/button/checkbox_open_gray.dds"
size="0 0 100% 100%"
size="0 0 100% 100%"
/>
</sprite>
<sprite name="StoneCheckBoxTick">
<image texture="global/button/checkbox_tick_gray.dds"
size="0 0 100% 100%"
size="0 0 100% 100%"
/>
</sprite>
<sprite name="StoneCheckBoxCross">
<image texture="global/button/checkbox_cross_gray.dds"
size="0 0 100% 100%"
size="0 0 100% 100%"
/>
</sprite>
<sprite name="StoneCheckBoxCrossOver">
<image texture="global/button/checkbox_cross_over_gray.dds"
size="0 0 100% 100%"
size="0 0 100% 100%"
/>
</sprite>
<!--
<sprite name="StoneArrowLeft">
<image texture="global/button/arrowbox_lt.png"
size="0 0 100% 100%"
size="0 0 100% 100%"
/>
</sprite>
<sprite name="StoneArrowLeftOver">
<image texture="global/button/arrowbox_lt_over.png"
size="0 0 100% 100%"
size="0 0 100% 100%"
/>
</sprite>
<sprite name="StoneArrowRight">
<image texture="global/button/arrowbox_rt.png"
size="0 0 100% 100%"
size="0 0 100% 100%"
/>
</sprite>
<sprite name="StoneArrowRightOver">
<image texture="global/button/arrowbox_rt_over.png"
size="0 0 100% 100%"
size="0 0 100% 100%"
/>
</sprite>
-->
<sprite name="StoneArrowUp">
<image texture="global/button/arrowbox_up.dds"
size="0 0 100% 100%"
size="0 0 100% 100%"
/>
</sprite>
<sprite name="StoneArrowUpOver">
<image texture="global/button/arrowbox_up_over.dds"
size="0 0 100% 100%"
size="0 0 100% 100%"
/>
</sprite>
<sprite name="StoneArrowDn">
<image texture="global/button/arrowbox_dn.dds"
size="0 0 100% 100%"
size="0 0 100% 100%"
/>
</sprite>
<sprite name="StoneArrowDnOver">
<image texture="global/button/arrowbox_dn_over.dds"
size="0 0 100% 100%"
size="0 0 100% 100%"
/>
</sprite>
<sprite name="StoneScrollSpriteBar">
<image texture="global/border/scrollbar.dds"
real_texture_placement="0 0 16 128"
size="0 0 100% 100%"
size="0 0 100% 100%"
/>
</sprite>
@@ -87,8 +87,8 @@
text_valign="center"
/>
<style name="SmallTitleText"
font="serif-9"
<style name="MediumTitleText"
font="serif-bold-12"
textcolor="white"
text_align="center"
text_valign="center"
@@ -170,12 +170,24 @@
size="100%-656 100%-64 100%-304 100%-16"
>[Tooltip text]</object>
<!-- Start Button -->
<object
name="startGame"
type="button"
style="StoneButton"
size="100%-304 100%-48 100%-164 100%-20"
tooltip_style="onscreenToolTip"
tooltip="Click this button to start a new game with the current settings."
>Start game!
<action on="Press">launchGame();</action>
</object>
<!-- Cancel Button -->
<object
name="cancelGame"
type="button"
style="StoneButton"
size="100%-304 100%-48 100%-164 100%-20"
size="100%-160 100%-48 100%-20 100%-20"
tooltip_style="onscreenToolTip"
tooltip="Click this button to return to the main menu."
>Cancel
@@ -185,18 +197,6 @@
]]></action>
</object>
<!-- Start Button -->
<object
name="startGame"
type="button"
style="StoneButton"
size="100%-160 100%-48 100%-20 100%-20"
tooltip_style="onscreenToolTip"
tooltip="Click this button to start a new game with the current settings."
>Start game!
<action on="Press">launchGame();</action>
</object>
</object>
</objects>
@@ -3,7 +3,7 @@ var g_Data;
function init(data)
{
g_Data = data;
// Set to "hourglass" cursor.
setCursor("cursor-wait");
@@ -15,7 +15,7 @@ function init(data)
// Set tip text
var tipTextFilePath = tipTextLoadingArray[getRandom (0, tipTextLoadingArray.length-1)];
var tipText = readFile(tipTextFilePath);
if (tipText)
{
var index = tipText.indexOf("\n");
@@ -39,7 +39,7 @@ function init(data)
// janwas: main loop now sets progress / description, but that won't
// happen until the first timeslice completes, so set initial values.
var loadingMapName = getGUIObjectByName ("loadingMapName");
if (data)
{
var mapName = data.attribs.settings.Name;
@@ -69,19 +69,21 @@ function init(data)
// ====================================================================
function displayProgress()
{
const END_PIECE_WIDTH = 16;
getGUIObjectByName("progressbar").caption = g_Progress; // display current progress
getGUIObjectByName("progressText").caption = g_LoadDescription; // display current progess details
// Keep curved right edge of progress bar in sync with the rest of the progress bar
var middle = getGUIObjectByName("progressbar");
var rightSide = getGUIObjectByName("progressbar_right");
var middleLength = middle.size.right - middle.size.left;
var middleLength = (middle.size.right - middle.size.left) - (END_PIECE_WIDTH / 2);
var increment = Math.round(g_Progress*middleLength/100);
var size = rightSide.size;
size.left = increment;
size.right = increment+12;
size.right = increment + END_PIECE_WIDTH;
rightSide.size = size;
}
@@ -97,7 +99,7 @@ function reallyStartGame()
// Switch GUI from loading screen to game session.
Engine.SwitchGuiPage("page_session.xml", g_Data);
// Restore default cursor.
setCursor("arrow-default");
}
@@ -12,10 +12,10 @@
<!-- LOADING SCREEN BACKGROUND -->
<object type="image" style="StonePanelLight"/>
<object size="50%-400 30 50%+400 150">
<object name="loadingMapName" size="0 0 100% 32" type="text" style="loadingPageTitleText"/>
<!-- LOADING SCREEN progressbar -->
<object size="50%-256 48 50%+256 80" type="image" sprite="loadingProgressBarBackground">
<object name="progressbar"
@@ -23,16 +23,16 @@
style="loadingProgressbar"
size="56 5 456 100%-5"
>
<object name="progressbar_left" size="0%-12 0 0 100%" type="image" sprite="loadingProgressbar_left"/>
<object name="progressbar_right" size="0 0 12 100%" type="image" sprite="loadingProgressbar_right"/>
<object name="progressbar_left" size="-8 0 8 100%" type="image" sprite="loadingProgressbar_left"/>
<object name="progressbar_right" size="8 0 24 100%" type="image" sprite="loadingProgressbar_right"/>
<action on="Progress">displayProgress();</action>
</object>
</object>
<!-- LOADING SCREEN TEXT -->
<object name="progressText" size="0 64 100% 100%" type="text" style="loadingBarText"/>
</object>
<!-- LOADING SCREEN TIP IMAGE-->
<object size="50%-452 50%-196 50%+68 50%+196" type="image" sprite="loadingTipImage">
<object name="tipImage" size="4 4 516 516" type="image">
@@ -60,15 +60,15 @@
<sprite name="loadingProgressBarBackground">
<image
texture="loading/progressbar/progressbar_background_left.png"
size="0%+0 0% 64 0%+32"
size="0%+0 0% 64 0%+32"
/>
<image
texture="loading/progressbar/progressbar_background_middle.png"
size="64 0% 100%-64 0%+32"
size="64 0% 100%-64 0%+32"
/>
<image
texture="loading/progressbar/progressbar_background_right.png"
size="100%-64 0% 100%+0 0%+32"
size="100%-64 0% 100%+0 0%+32"
/>
</sprite>
@@ -76,22 +76,22 @@
<sprite name="loadingProgressbar_left">
<image
texture="loading/progressbar/progressbar_left.png"
real_texture_placement="0 0 12 20"
size="0 0 100% 100%"
real_texture_placement="16 6 32 26"
size="0 0 100% 100%"
/>
</sprite>
<sprite name="loadingProgressbar_middle">
<image
texture="loading/progressbar/progressbar_middle.png"
real_texture_placement="0 0 1 20"
real_texture_placement="0 6 1 26"
size="0 0 100% 100%"
/>
</sprite>
<sprite name="loadingProgressbar_right">
<image
texture="loading/progressbar/progressbar_right.png"
real_texture_placement="4 0 16 20"
size="0 0 100% 100%"
real_texture_placement="0 6 16 26"
size="0 0 100% 100%"
/>
</sprite>
@@ -141,7 +141,7 @@
size="0 0 4 4"
/>
</sprite>
<!-- TIP IMAGE GRADIENT -->
<sprite name="loadingTipImageCover">
<image
@@ -113,10 +113,10 @@ function onTick()
// Slide menu
function updateMenuPosition()
{
if (getGUIObjectByName("submenuScreen").hidden == false)
{
var submenu = getGUIObjectByName("submenu");
var submenu = getGUIObjectByName("submenu");
if (submenu.hidden == false)
{
// 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
@@ -124,7 +124,7 @@ function updateMenuPosition()
// 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;
var OFFSET = 10;
if (submenu.size.left < getGUIObjectByName("mainMenu").size.right)
{
@@ -136,10 +136,13 @@ function updateMenuPosition()
// Opens the menu by revealing the screen which contains the menu
function openMenu(newSubmenu, position, buttonHeight, numButtons)
{
// remove old submenu
getGUIObjectByName(currentSubmenu).hidden = true;
var menuSound = new Sound("audio/attack/weapon/arrowfly_24.ogg");
if (menuSound)
{
menuSound.play(0);
}
// switch to new submenu
// switch to new submenu type
currentSubmenu = newSubmenu;
getGUIObjectByName(currentSubmenu).hidden = false;
@@ -153,16 +156,22 @@ function openMenu(newSubmenu, position, buttonHeight, numButtons)
blendSubmenuIntoMain(top, bottom);
// prepare to hide the submenu when the mouse moves off of the submenu
getGUIObjectByName("submenuScreen").hidden = false;
getGUIObjectByName("secondarySubmenuScreen").hidden = false;
getGUIObjectByName("submenu").hidden = false;
}
// Closes the menu and resets position
function closeMenu()
{
getGUIObjectByName("submenuScreen").hidden = true;
getGUIObjectByName("secondarySubmenuScreen").hidden = true;
// remove old submenu type
getGUIObjectByName(currentSubmenu).hidden = true;
// hide submenu
getGUIObjectByName("submenu").hidden = true;
// reset submenu position
getGUIObjectByName("submenu").size = getGUIObjectByName("mainMenu").size;
// reset main menu panel right border
getGUIObjectByName("MainMenuPanelRightBorderTop").size = "100%-2 0 100% 100%";
}
+127 -162
View File
@@ -151,150 +151,142 @@ Status: $status.
- SUBMENU
==========================================
-->
<object name="submenuScreen"
type="image"
<!-- submenu -->
<object name="submenu"
type="image"
style="SubmenuPanel"
size="60 50%-100 300 50%+100"
hidden="true"
>
<!-- hides the submenu when the mouse leaves the mainMenuButtons or submenu -->
<action on="MouseEnter">
closeMenu();
</action>
<!-- submenu -->
<object name="submenu"
<!-- submenuSinglePlayer -->
<object name="submenuSinglePlayer"
type="image"
style="SubmenuPanel"
size="60 50%-100 300 50%+100"
size="0 4 100%-4 100%-4"
tooltip_style="pgToolTip"
tooltip="The 0 A.D. Game Manual."
hidden="true"
>
<!-- submenuSinglePlayer -->
<object name="submenuSinglePlayer"
type="image"
size="0 4 100%-4 100%-4"
<object name="subMenuSinglePlayerButton"
type="button"
style="StoneButtonFancy"
size="0 0 100% 28"
tooltip_style="pgToolTip"
tooltip="The 0 A.D. Game Manual."
hidden="true"
tooltip="Click here to start a new single player game."
>
<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>
Matches
<action on="Press">
closeMenu();
Engine.PushGuiPage("page_gamesetup.xml", { type: "offline" });
</action>
</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"
<object name="subMenuCampaignButton"
type="button"
style="StoneButtonFancy"
size="0 32 100% 60"
tooltip_style="pgToolTip"
tooltip="The 0 A.D. Game Manual"
hidden="true"
tooltip="Relive history through historical military campaigns. [NOT YET IMPLEMENTED]"
enabled="false"
>
<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 &quot;-editor&quot;."
>
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>
Campaigns
<action on="Press">
closeMenu();
<![CDATA[
// Open Campaigns window.
// NOT IMPLEMENTED YET
]]>
</action>
</object>
</object><!-- end of submenu -->
</object><!-- end of submenu screen -->
</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 &quot;-editor&quot;."
>
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 -->
<!--
@@ -308,22 +300,6 @@ Status: $status.
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"
@@ -350,17 +326,6 @@ Status: $status.
size="8 156 100%-8 356"
ghost="false"
>
<!-- 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%"
ghost="false"
/>
<!-- LEARN TO PLAY BUTTON -->
<object name="menuLearnToPlayButton"
type="button"
@@ -527,7 +492,7 @@ Get involved at: wildfiregames.com/0ad
<!-- COMPANY NAME -->
<object type="text"
style="SmallTitleText"
style="MediumTitleText"
ghost="true"
size="50%-128 32 50%+128 48"
>WILDFIRE GAMES</object>
@@ -536,7 +501,7 @@ Get involved at: wildfiregames.com/0ad
<!-- VERSION -->
<object name="versionNumber"
type="text"
style="SmallTitleText"
style="MediumTitleText"
ghost="true"
size="50%-128 100%-36 50%+128 100%"
>
+16 -10
View File
@@ -6,7 +6,7 @@
const MARGIN = 4;
// Includes the main menu button
const NUM_BUTTONS = 5;
const NUM_BUTTONS = 6;
// Regular menu buttons
const BUTTON_HEIGHT = 32;
@@ -15,19 +15,19 @@ const BUTTON_HEIGHT = 32;
const END_MENU_POSITION = (BUTTON_HEIGHT * NUM_BUTTONS) + MARGIN;
// Menu starting position - bottom
const MENU_BOTTOM = 36;
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;
const INITIAL_MENU_POSITION = "100%-164 " + MENU_TOP + " 100% " + MENU_BOTTOM;
// Slide menu
function updateMenuPosition()
{
if (getGUIObjectByName("menuScreen").hidden == false)
if (getGUIObjectByName("menu").hidden == false)
{
var menu = getGUIObjectByName("menu");
@@ -36,13 +36,13 @@ function updateMenuPosition()
// 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;
// example is 196-36 = 160. We choose an offset of 16 because it
// divides into 160 evenly and provided the speed we wanted.
var OFFSET = 16;
if (menu.size.bottom < END_MENU_POSITION)
{
menu.size = "100%-" + END_MENU_POSITION + " " + (menu.size.top + OFFSET) + " 100% " + (menu.size.bottom + OFFSET);
menu.size = "100%-164 " + (menu.size.top + OFFSET) + " 100% " + (menu.size.bottom + OFFSET);
}
}
}
@@ -50,13 +50,19 @@ function updateMenuPosition()
// Opens the menu by revealing the screen which contains the menu
function openMenu()
{
getGUIObjectByName("menuScreen").hidden = false;
var menuSound = new Sound("audio/interface/ui/ui_button_longclick.ogg");
if (menuSound)
{
menuSound.play(0);
}
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;
}
@@ -352,83 +352,86 @@
<!-- ================================ ================================ -->
<!-- Menu -->
<!-- ================================ ================================ -->
<object name="menuScreen"
type="image"
<object name="menu"
style="StonePanelThinBorder"
type="image"
size="100%-164 -160 100% 36"
hidden="true"
size="0 0 100% 100%"
>
<!-- hides the menu when the mouse leaves the menu -->
<action on="MouseEnter">
closeMenu();
</action>
<object size="4 36 100%-4 50%+20">
<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>
<!-- 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>
<!-- 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>
<!-- 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();
closeOpenDialogs();
<![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>
<!-- Exit button -->
<object type="button"
name="menuExitButton"
style="StoneButtonFancy"
size="0 96 100% 124"
tooltip_style="sessionToolTip"
>
Exit
<action on="Press">
closeMenu();
closeOpenDialogs();
<![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>
<!-- Exit button -->
<object type="button"
name="menuCloseButton"
style="StoneButtonFancy"
size="0 128 100% 156"
tooltip_style="sessionToolTip"
>
Close
<action on="Press">
closeMenu();
</action>
</object>
</object>
</object>