From e9339863519d4897efff0aa76bf2ffd5a6d60b4e Mon Sep 17 00:00:00 2001 From: WhiteTreePaladin Date: Sat, 27 Aug 2011 22:44:08 +0000 Subject: [PATCH] removed session dialog, updated ingame menu This was SVN commit r10114. --- .../data/mods/public/gui/pregame/mainmenu.xml | 62 ++-- binaries/data/mods/public/gui/session/menu.js | 57 ++-- .../data/mods/public/gui/session/session.xml | 323 ++++++++++-------- .../public/gui/session/utility_functions.js | 67 +--- 4 files changed, 241 insertions(+), 268 deletions(-) diff --git a/binaries/data/mods/public/gui/pregame/mainmenu.xml b/binaries/data/mods/public/gui/pregame/mainmenu.xml index 2296fdc0a0..8aa636b2b2 100644 --- a/binaries/data/mods/public/gui/pregame/mainmenu.xml +++ b/binaries/data/mods/public/gui/pregame/mainmenu.xml @@ -186,12 +186,12 @@ Status: $status. tooltip="The 0 A.D. Game Manual" > Learn To Play - getGUIObjectByName("submenu").hidden = true; - // open game manual dialog - Engine.PushGuiPage("page_manual.xml", { "page": "intro" }); - ]]> + + @@ -202,10 +202,12 @@ Status: $status. tooltip_style="pgToolTip" tooltip="Challenge the computer player to a single player match." > - Single Player - + Single Player + + + @@ -217,9 +219,11 @@ Status: $status. tooltip="Fight against one or more human players in a multiplayer game." > Multiplayer - + + + @@ -231,9 +235,11 @@ Status: $status. tooltip="Game options and scenario design tools." > Tools Options - + + + @@ -245,12 +251,12 @@ Status: $status. tooltip="Learn about the six civilizations featured in 0 A.D." > History - getGUIObjectByName("submenu").hidden = true; - // open history dialog - Engine.PushGuiPage("page_civinfo.xml"); - ]]> + + @@ -261,15 +267,15 @@ Status: $status. tooltip_style="pgToolTip" tooltip="Exit Game" > - Exit - getGUIObjectByName("submenu").hidden = true; - // open exit dialog - var btCaptions = ["Yes", "No"]; - var btCode = [exit, null]; - messageBox(400, 200, "Are you sure you want to quit 0 A.D.?", "Confirmation", 0, btCaptions, btCode); - ]]> + + diff --git a/binaries/data/mods/public/gui/session/menu.js b/binaries/data/mods/public/gui/session/menu.js index 7c13448579..4969d1d1c8 100644 --- a/binaries/data/mods/public/gui/session/menu.js +++ b/binaries/data/mods/public/gui/session/menu.js @@ -1,39 +1,46 @@ -function toggleDeveloperOverlay() +function openMenu() { - var devCommands = getGUIObjectByName("devCommands"); - var text = devCommands.hidden? "opened." : "closed."; - submitChatDirectly("The Developer Overlay was " + text); - devCommands.hidden = !devCommands.hidden; + getGUIObjectByName("menuScreen").hidden = false; + getGUIObjectByName("menu").hidden = false; } -function openMenuDialog() +function closeMenu() { - var menu = getGUIObjectByName("menuDialogPanel"); - g_SessionDialog.open("Menu", null, menu, 204, 224, null); + getGUIObjectByName("menuScreen").hidden = true; + getGUIObjectByName("menu").hidden = true; } -function openSettingsDialog() +function openSettings() { - var settings = getGUIObjectByName("settingsDialogPanel"); - g_SessionDialog.open("Settings", null, settings, 340, 252, null); + closeMenu(); + closeChat(); + getGUIObjectByName("settingsDialogPanel").hidden = false; +} + +function closeSettings() +{ + getGUIObjectByName("settingsDialogPanel").hidden = true; } function openChat() { + closeMenu(); + closeSettings(); getGUIObjectByName("chatInput").focus(); // Grant focus to the input area getGUIObjectByName("chatDialogPanel").hidden = false; - g_SessionDialog.close(); + } function closeChat() { getGUIObjectByName("chatInput").caption = ""; // Clear chat input getGUIObjectByName("chatDialogPanel").hidden = true; - g_SessionDialog.close(); } function toggleChatWindow() { + closeSettings(); + var chatWindow = getGUIObjectByName("chatDialogPanel"); var chatInput = getGUIObjectByName("chatInput"); @@ -43,11 +50,14 @@ function toggleChatWindow() chatInput.caption = ""; // Clear chat input chatWindow.hidden = !chatWindow.hidden; - g_SessionDialog.close(); } function togglePause() { + closeMenu(); + closeChat(); + closeSettings(); + var pauseOverlay = getGUIObjectByName("pauseOverlay"); if (pauseOverlay.hidden) @@ -62,20 +72,19 @@ function togglePause() } pauseOverlay.hidden = !pauseOverlay.hidden; - g_SessionDialog.close(); } -function openExitGameDialog() +function toggleDeveloperOverlay() { - g_SessionDialog.open("Exit Game", "Do you really want to quit?", null, 320, 140, leaveGame); + var devCommands = getGUIObjectByName("devCommands"); + var text = devCommands.hidden? "opened." : "closed."; + submitChatDirectly("The Developer Overlay was " + text); + devCommands.hidden = !devCommands.hidden; } function escapeKeyAction() { - var sessionDialog = getGUIObjectByName("sessionDialog"); - - if (!sessionDialog.hidden) - g_SessionDialog.close(); - else - getGUIObjectByName("chatDialogPanel").hidden = true; -} + closeMenu(); + closeChat(); + closeSettings(); +} \ No newline at end of file diff --git a/binaries/data/mods/public/gui/session/session.xml b/binaries/data/mods/public/gui/session/session.xml index 4670c43466..29a7c707da 100644 --- a/binaries/data/mods/public/gui/session/session.xml +++ b/binaries/data/mods/public/gui/session/session.xml @@ -29,20 +29,6 @@ this.hidden = !this.hidden; - - - - - - - ALPHA VI : Fortuna - - - - - - - @@ -103,7 +89,7 @@ /> - - - - - - - @@ -344,7 +350,7 @@ @@ -353,33 +359,33 @@ size="0 0 500 100%" > - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + @@ -393,18 +399,35 @@ + + + + + + + + ALPHA VI : Fortuna + + + + + + + + - MENU - openMenuDialog(); - + MENU + openMenu(); + @@ -668,7 +691,7 @@ @@ -696,7 +719,7 @@ diff --git a/binaries/data/mods/public/gui/session/utility_functions.js b/binaries/data/mods/public/gui/session/utility_functions.js index a25ee949e8..1f6809ea11 100644 --- a/binaries/data/mods/public/gui/session/utility_functions.js +++ b/binaries/data/mods/public/gui/session/utility_functions.js @@ -3,71 +3,6 @@ const FLORA = "flora"; const FAUNA = "fauna"; const SPECIAL = "special"; -//-------------------------------- -------------------------------- -------------------------------- -// Session Dialog (only one at a time) -//-------------------------------- -------------------------------- -------------------------------- -var g_SessionDialog = new SessionDialog(); - -function SessionDialog() -{ - this.referencedPanel = {}; -} - -SessionDialog.prototype.open = function(title, message, referencedPanel, x, y, confirmFunction) -{ - // hide previous panel referencedPanel if applicable - if (this.referencedPanel) - this.referencedPanel.hidden = true - - // set dialog title if applicable - getGUIObjectByName("sessionDialogTitle").caption = title? title : ""; - - // set dialog message if applicable - getGUIObjectByName("sessionDialogMessage").caption = message? message : ""; - - // set panel reference if applicable - if(referencedPanel) - { - referencedPanel.size = "50%-" + ((x/2)-30) + " 50%-" + ((y/2)-30) + " 50%+" + ((x/2)-30) + " 50%+" + ((y/2)-72); - referencedPanel.hidden = false; - this.referencedPanel = referencedPanel; - } - - // set confirm function if applicable - if (confirmFunction) - { - var buttonFunction = function () { - this.close(referencedPanel); // "this" is defined as SessionDialog in this context - confirmFunction(); - }; - - var dialog = this; - var confirmButton = getGUIObjectByName("sessionDialogConfirm"); - confirmButton.onpress = function() { buttonFunction.call(dialog); }; - confirmButton.hidden = false; - confirmButton.size = "32 100%-56 144 100%-24"; - getGUIObjectByName("sessionDialogCancel").size = "100%-144 100%-56 100%-32 100%-24"; - getGUIObjectByName("sessionDialogCancel").caption = "Cancel"; - } - else - { - getGUIObjectByName("sessionDialogConfirm").hidden = true; - getGUIObjectByName("sessionDialogCancel").size = "50%-72 100%-56 50%+72 100%-24"; - getGUIObjectByName("sessionDialogCancel").caption = "Close"; - } - - getGUIObjectByName("sessionDialog").size = "50%-" + x/2 + " 50%-" + y/2 + " 50%+" + x/2 + " 50%+" + y/2; - getGUIObjectByName("sessionDialog").hidden = false; -}; - - -SessionDialog.prototype.close = function() -{ - getGUIObjectByName("sessionDialog").hidden = true; - if (this.referencedPanel) - this.referencedPanel.hidden = true; -}; - //-------------------------------- -------------------------------- -------------------------------- // Utility functions //-------------------------------- -------------------------------- -------------------------------- @@ -96,7 +31,7 @@ function getPlayerData(playerAssignments) "team": playerState.team, "state": playerState.state, "guid": undefined, // network guid for players controlled by hosts - "disconnected": false, // flag for host-controlled players who have left the game + "disconnected": false // flag for host-controlled players who have left the game }; players.push(player); }