Index: ps/trunk/binaries/data/mods/public/gui/aiconfig/aiconfig.xml
===================================================================
--- ps/trunk/binaries/data/mods/public/gui/aiconfig/aiconfig.xml (revision 10145)
+++ ps/trunk/binaries/data/mods/public/gui/aiconfig/aiconfig.xml (revision 10146)
@@ -1,58 +1,54 @@
-
+
-
Index: ps/trunk/binaries/data/mods/public/gui/pregame/mainmenu.js
===================================================================
--- ps/trunk/binaries/data/mods/public/gui/pregame/mainmenu.js (revision 10145)
+++ ps/trunk/binaries/data/mods/public/gui/pregame/mainmenu.js (revision 10146)
@@ -1,203 +1,249 @@
var userReportEnabledText; // contains the original version with "$status" placeholder
var currentSubmenu; // contains placeholder submenu
const MARGIN = 4;
function init()
{
global.curr_music = newRandomSound("music", "menu");
if (global.curr_music)
global.curr_music.loop();
userReportEnabledText = getGUIObjectByName("userReportEnabledText").caption;
currentSubmenu = "submenuSinglePlayer";
}
var t0 = new Date;
function scrollBackgrounds()
{
var layer1 = getGUIObjectByName("backgroundLayer1");
var layer2 = getGUIObjectByName("backgroundLayer2");
var layer3 = getGUIObjectByName("backgroundLayer3");
var screen = layer1.parent.getComputedSize();
var h = screen.bottom - screen.top; // height of screen
var w = h*16/9; // width of background image
// Offset the layers by oscillating amounts
var t = (t0 - new Date) / 1000;
var speed = 1/10;
var off1 = 0.10 * w * (1+Math.cos(t*speed));
var off2 = 0.18 * w * (1+Math.cos(t*speed)) - h*6/9;
var off3 = 0.20 * w * (1+Math.cos(t*speed));
var left = screen.right - w * (1 + Math.ceil(screen.right / w));
layer1.size = new GUISize(left + off1, screen.top, screen.right + off1, screen.bottom);
layer2.size = new GUISize(screen.right - h + off2, screen.top, screen.right + off2, screen.bottom);
layer3.size = new GUISize(screen.right - h + off3, screen.top, screen.right + off3, screen.bottom);
}
function submitUserReportMessage()
{
var input = getGUIObjectByName("userReportMessageInput");
var msg = input.caption;
if (msg.length)
Engine.SubmitUserReport("message", 1, msg);
input.caption = "";
}
function formatUserReportStatus(status)
{
var d = status.split(/:/, 3);
if (d[0] == "disabled")
return "disabled";
if (d[0] == "connecting")
return "connecting to server";
if (d[0] == "sending")
{
var done = d[1];
return "uploading (" + Math.floor(100*done) + "%)";
}
if (d[0] == "completed")
{
var httpCode = d[1];
if (httpCode == 200)
return "upload succeeded";
else
return "upload failed (" + httpCode + ")";
}
if (d[0] == "failed")
{
var errCode = d[1];
var errMessage = d[2];
return "upload failed (" + errMessage + ")";
}
return "unknown";
}
function onTick()
{
+ // Animate backgrounds
scrollBackgrounds();
+ // Animate submenu
+ updateMenuPosition();
+
if (Engine.IsUserReportEnabled())
{
getGUIObjectByName("userReportDisabled").hidden = true;
getGUIObjectByName("userReportEnabled").hidden = false;
getGUIObjectByName("userReportEnabledText").caption =
userReportEnabledText.replace(/\$status/,
formatUserReportStatus(Engine.GetUserReportStatus()));
}
else
{
getGUIObjectByName("userReportDisabled").hidden = false;
getGUIObjectByName("userReportEnabled").hidden = true;
}
}
-// 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;
-
+
// switch to new submenu
currentSubmenu = newSubmenu;
getGUIObjectByName(currentSubmenu).hidden = false;
// set position of new submenu
var submenu = getGUIObjectByName("submenu");
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;
+}
+
+// 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%";
}
-// Helper function that enables the dark background mask, then reveals a given subwindow object.
+// 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)
{
// Hide the other tabs.
for (i = 1; i <= 3; i++)
{
switch (i)
{
case 1:
var tmpName = "pgOptionsAudio";
break;
case 2:
var tmpName = "pgOptionsVideo";
break;
case 3:
var tmpName = "pgOptionsGame";
break;
default:
break;
}
if (tmpName != tabName)
{
getGUIObjectByName (tmpName + "Window").hidden = true;
getGUIObjectByName (tmpName + "Button").enabled = true;
}
}
// Make given tab visible.
getGUIObjectByName (tabName + "Window").hidden = false;
getGUIObjectByName (tabName + "Button").enabled = false;
}
// Move the credits up the screen.
function updateCredits()
{
// If there are still credit lines to remove, remove them.
if (getNumItems("pgCredits") > 0)
removeItem ("pgCredits", 0);
else
{
// When we've run out of credit,
// Stop the increment timer if it's still active.
cancelInterval();
// Close the credits screen and return.
closeMainMenuSubWindow ("pgCredits");
guiUnHide ("pg");
}
}
Index: ps/trunk/binaries/data/mods/public/gui/pregame/mainmenu.xml
===================================================================
--- ps/trunk/binaries/data/mods/public/gui/pregame/mainmenu.xml (revision 10145)
+++ ps/trunk/binaries/data/mods/public/gui/pregame/mainmenu.xml (revision 10146)
@@ -1,1683 +1,1701 @@
onTick();
tooltipText
[font="serif-bold-16"]Help improve 0 A.D.![/font]
You can automatically send us anonymous feedback that will help us fix bugs, and improve performance and compatibility.
Enable feedback
Engine.SetUserReportEnabled(true);
Technical details
Engine.PushGuiPage("page_manual.xml", { "page": "userreport" });
[font="serif-bold-16"]Thank you for helping improve 0 A.D.![/font]
Anonymous feedback is currently enabled.
Status: $status.
If you want to send a message to the developers, you can enter one here:
Send Message
submitUserReportMessage();
Disable feedback
Engine.SetUserReportEnabled(false);
Technical details
Engine.PushGuiPage("page_manual.xml", { "page": "userreport" });
+
+
+
+
+ closeMenu();
+
+
+
+
+
+
+
+ Matches
+
+ closeMenu();
+ Engine.PushGuiPage("page_gamesetup.xml", { type: "offline" });
+
+
+
+
+ Campaigns
+
+ closeMenu();
+
+
+
+
+
+
+
+
+ Join Game
+
+ closeMenu();
+ // Open Multiplayer connection window with join option.
+ Engine.PushGuiPage("page_gamesetup_mp.xml", "join");
+
+
+
+
+ Host Game
+
+ closeMenu();
+ // Open Multiplayer connection window with host option.
+ Engine.PushGuiPage("page_gamesetup_mp.xml", "host");
+
+
+
+
+
+
+
+
+ Options
+
+ closeMenu();
+
+
+
+
+
+ Scenario Editor
+
+ closeMenu();
+
+
+
+
+
+
+
-
+
+
+
+
+ closeMenu();
+
+
+
-
+
Learn To Play
- getGUIObjectByName("submenu").hidden = true;
+ closeMenu();
Single Player
-
+ closeMenu();
+ openMenu("submenuSinglePlayer", (this.parent.size.top+this.size.top), (this.size.bottom-this.size.top), 2);
Multiplayer
-
+ closeMenu();
+ openMenu("submenuMultiplayer", (this.parent.size.top+this.size.top), (this.size.bottom-this.size.top), 2);
Tools Options
-
+ closeMenu();
+ openMenu("submenuToolsAndOptions", (this.parent.size.top+this.size.top), (this.size.bottom-this.size.top), 2);
History
- getGUIObjectByName("submenu").hidden = true;
+ closeMenu();
Exit
- getGUIObjectByName("submenu").hidden = true;
+ closeMenu();
[font="serif-bold-18"]Alpha Version[/font]
WARNING: This is an early development version of the game. Many features have not been added yet.
Get involved at: wildfiregames.com/0ad
Website
IRC
WILDFIRE GAMES
-
-
-
-
-
- getGUIObjectByName("submenu").hidden = true;
- getGUIObjectByName("MainMenuPanelRightBorderTop").size = "100%-2 0 100% 100%";
-
-
-
-
-
-
-
- Matches
-
-
-
-
- Campaigns
-
-
-
-
-
-
- Join Game
-
-
-
-
- Host Game
-
-
-
-
-
-
-
-
- Options
-
-
-
-
- Scenario Editor
-
-
-
-
-
Index: ps/trunk/binaries/data/mods/public/gui/session/menu.js
===================================================================
--- ps/trunk/binaries/data/mods/public/gui/session/menu.js (revision 10145)
+++ ps/trunk/binaries/data/mods/public/gui/session/menu.js (revision 10146)
@@ -1,90 +1,140 @@
+/*
+ * 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;
+ getGUIObjectByName("menuScreen").hidden = false;
}
+// Closes the menu and resets position
function closeMenu()
{
- getGUIObjectByName("menuScreen").hidden = true;
- getGUIObjectByName("menu").hidden = true;
+ getGUIObjectByName("menuScreen").hidden = true;
+ getGUIObjectByName("menu").size = INITIAL_MENU_POSITION;
}
function openSettings()
{
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;
-
+
}
function closeChat()
{
getGUIObjectByName("chatInput").caption = ""; // Clear chat input
getGUIObjectByName("chatDialogPanel").hidden = true;
}
function toggleChatWindow()
{
closeSettings();
-
+
var chatWindow = getGUIObjectByName("chatDialogPanel");
var chatInput = getGUIObjectByName("chatInput");
if (chatWindow.hidden)
chatInput.focus(); // Grant focus to the input area
else
chatInput.caption = ""; // Clear chat input
chatWindow.hidden = !chatWindow.hidden;
}
function togglePause()
{
closeMenu();
closeChat();
closeSettings();
-
+
var pauseOverlay = getGUIObjectByName("pauseOverlay");
if (pauseOverlay.hidden)
{
setPaused(true);
getGUIObjectByName("pauseButtonText").caption = "Unpause";
}
else
{
setPaused(false);
getGUIObjectByName("pauseButtonText").caption = "Pause";
}
pauseOverlay.hidden = !pauseOverlay.hidden;
}
function toggleDeveloperOverlay()
{
var devCommands = getGUIObjectByName("devCommands");
var text = devCommands.hidden? "opened." : "closed.";
submitChatDirectly("The Developer Overlay was " + text);
devCommands.hidden = !devCommands.hidden;
}
function escapeKeyAction()
{
closeMenu();
closeChat();
closeSettings();
}
\ No newline at end of file
Index: ps/trunk/binaries/data/mods/public/gui/session/messages.js
===================================================================
--- ps/trunk/binaries/data/mods/public/gui/session/messages.js (revision 10145)
+++ ps/trunk/binaries/data/mods/public/gui/session/messages.js (revision 10146)
@@ -1,218 +1,218 @@
// Chat data
const CHAT_TIMEOUT = 30000;
const MAX_NUM_CHAT_LINES = 20;
var chatMessages = [];
var chatTimers = [];
// Notification Data
const NOTIFICATION_TIMEOUT = 10000;
const MAX_NUM_NOTIFICATION_LINES = 3;
var notifications = [];
var notificationsTimers = [];
// Notifications
function handleNotifications()
{
var notification = Engine.GuiInterfaceCall("GetNextNotification");
if (!notification)
return;
// Handle chat notifications specially
if (notification.type == "chat")
{
addChatMessage({
"type": "message",
"guid": findGuidForPlayerID(g_PlayerAssignments, notification.player),
"text": notification.message
});
}
else
{
// Only display notifications directed to this player
if (notification.player == Engine.GetPlayerID())
{
notifications.push(notification);
notificationsTimers.push(setTimeout(removeOldNotifications, NOTIFICATION_TIMEOUT));
if (notifications.length > MAX_NUM_NOTIFICATION_LINES)
removeOldNotifications();
else
displayNotifications();
}
}
}
function removeOldNotifications()
{
clearTimeout(notificationsTimers[0]); // The timer only needs to be cleared when new notifications bump old notifications off
notificationsTimers.shift();
notifications.shift();
displayNotifications();
}
function displayNotifications()
{
var messages = [];
for each (var n in notifications)
messages.push(n.message);
getGUIObjectByName("notificationText").caption = messages.join("\n");
}
// Messages
function handleNetMessage(message)
{
log("Net message: "+uneval(message));
switch (message.type)
{
case "netstatus":
var obj = getGUIObjectByName("netStatus");
switch (message.status)
{
case "waiting_for_players":
obj.caption = "Waiting for other players to connect...";
obj.hidden = false;
break;
case "active":
obj.caption = "";
obj.hidden = true;
break;
case "connected":
obj.caption = "Connected to the server.";
obj.hidden = false;
case "authenticated":
obj.caption = "Connection to the server has been authenticated.";
obj.hidden = false;
case "disconnected":
obj.caption = "Connection to the server has been lost.\n\nThe game has ended.";
obj.hidden = false;
getGUIObjectByName("disconnectedExitButton").hidden = false;
break;
default:
error("Unrecognised netstatus type "+message.status);
break;
}
break;
case "players":
// Find and report all leavings
for (var host in g_PlayerAssignments)
{
if (! message.hosts[host])
{
// Tell the user about the disconnection
addChatMessage({ "type": "disconnect", "guid": host });
// Update the cached player data, so we can display the disconnection status
updatePlayerDataRemove(g_Players, host);
}
}
// Find and report all joinings
for (var host in message.hosts)
{
if (! g_PlayerAssignments[host])
{
// Update the cached player data, so we can display the correct name
updatePlayerDataAdd(g_Players, host, message.hosts[host]);
}
}
g_PlayerAssignments = message.hosts;
break;
case "chat":
addChatMessage({ "type": "message", "guid": message.guid, "text": message.text });
break;
-
+
// To prevent errors, ignore these message types that occur during autostart
case "gamesetup":
case "start":
break;
default:
error("Unrecognised net message type "+message.type);
}
}
function submitChatDirectly(text)
{
if (text.length)
{
if (g_IsNetworked)
Engine.SendNetworkChat(text);
else
addChatMessage({ "type": "message", "guid": "local", "text": text });
}
}
function submitChatInput()
{
var input = getGUIObjectByName("chatInput");
var text = input.caption;
if (text.length)
{
if (g_IsNetworked)
Engine.SendNetworkChat(text);
else
addChatMessage({ "type": "message", "guid": "local", "text": text });
input.caption = ""; // Clear chat input
}
input.blur(); // Remove focus
-
+
toggleChatWindow();
}
function addChatMessage(msg)
{
var playerColor, username;
if (g_PlayerAssignments[msg.guid])
{
var n = g_PlayerAssignments[msg.guid].player;
playerColor = g_Players[n].color.r + " " + g_Players[n].color.g + " " + g_Players[n].color.b;
username = escapeText(g_PlayerAssignments[msg.guid].name);
}
else
{
playerColor = "255 255 255";
username = "Unknown player";
}
var message = escapeText(msg.text);
-
+
var formatted;
switch (msg.type)
{
case "disconnect":
formatted = "[color=\"" + playerColor + "\"]" + username + "[/color] has left the game.";
break;
case "message":
console.write("<" + username + "> " + message);
formatted = "<[color=\"" + playerColor + "\"]" + username + "[/color]> " + message;
break;
default:
error("Invalid chat message '" + uneval(msg) + "'");
return;
}
chatMessages.push(formatted);
chatTimers.push(setTimeout(removeOldChatMessages, CHAT_TIMEOUT));
if (chatMessages.length > MAX_NUM_CHAT_LINES)
removeOldChatMessages();
else
getGUIObjectByName("chatText").caption = chatMessages.join("\n");
}
function removeOldChatMessages()
{
clearTimeout(chatTimers[0]); // The timer only needs to be cleared when new messages bump old messages off
chatTimers.shift();
chatMessages.shift();
getGUIObjectByName("chatText").caption = chatMessages.join("\n");
}
Index: ps/trunk/binaries/data/mods/public/gui/session/session.xml
===================================================================
--- ps/trunk/binaries/data/mods/public/gui/session/session.xml (revision 10145)
+++ ps/trunk/binaries/data/mods/public/gui/session/session.xml (revision 10146)
@@ -1,755 +1,769 @@
onTick();
onSimulationUpdate();
this.hidden = !this.hidden;
escapeKeyAction();
toggleChatWindow();
- openMenuDialog();
+ openMenu();
togglePause();
performCommand(g_Selection.toList()[0], "delete");
setCameraFollow(g_Selection.toList()[0]);
findIdleUnit(["Hero", "Super", "CitizenSoldier", "Siege", "Warship"]);
toggleDeveloperOverlay();
Control all units
g_DevSettings.controlAll = this.checked;
Engine.PostNetworkCommand( {"type": "control-all", "flag": this.checked} );
Display selection state
Pathfinder overlay
Engine.GuiInterfaceCall("SetPathfinderDebugOverlay", this.checked);
Obstruction overlay
Engine.GuiInterfaceCall("SetObstructionDebugOverlay", this.checked);
Unit motion overlay
g_Selection.SetMotionDebugOverlay(this.checked);
Range overlay
Engine.GuiInterfaceCall("SetRangeDebugOverlay", this.checked);
Restrict camera
gameView.constrainCamera = this.checked;
Reveal map
Engine.PostNetworkCommand({"type": "reveal-map", "enable": this.checked});
Enable time warp
Engine.EnableTimeWarpRecording(this.checked ? 10 : 0);
Promote selected units
Engine.PostNetworkCommand({"type": "promote", "entities": g_Selection.toList()});
Game Paused
togglePause();
submitChatInput();
Cancel
closeChat();
Send
submitChatInput();
+
+
+
+
+ Settings
+
+
+
+
+ Enable Shadows
+
+ if (renderer.shadows) this.checked = true; else this.checked = false;
+ renderer.shadows = this.checked;
+
+
+
+ Enable Shadow Filtering
+
+ if (renderer.shadowPCF) this.checked = true; else this.checked = false;
+ renderer.shadowPCF = this.checked;
+
+
+
+ Enable Water Reflections
+
+ if (renderer.fancyWater) this.checked = true; else this.checked = false;
+ renderer.fancyWater = this.checked;
+
+
+
+ Enable Music
+
+ if (this.checked) startMusic(); else stopMusic();
+
+
+
+ Developer Overlay
+
+ toggleDeveloperOverlay();
+
+
+
+
+
+ Close
+ this.parent.hidden = true
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ ALPHA VI : Fortuna
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ MENU
+
+ openMenu();
+
+
+
+
+
-
+
closeMenu();
Settings
+ closeMenu();
openSettings();
Chat
+ closeMenu();
openChat();
Pause
+ closeMenu();
togglePause();
Exit
- escapeKeyAction();
+
+ closeMenu();
+ escapeKeyAction();
+
+
-
-
-
-
-
- Settings
-
+
+
+
+
+
+
+
+
+
+
+
-
+
+
+
+
+
+
+
+
+
-
- Enable Shadows
-
- if (renderer.shadows) this.checked = true; else this.checked = false;
- renderer.shadows = this.checked;
+
+ handleMinimapEvent(arguments[0]);
-
- Enable Shadow Filtering
-
- if (renderer.shadowPCF) this.checked = true; else this.checked = false;
- renderer.shadowPCF = this.checked;
+
+
+
+
+
+
+
+ findIdleUnit(["Worker", "Trade", "CitizenSoldier"]);
+
+
-
- Enable Water Reflections
-
- if (renderer.fancyWater) this.checked = true; else this.checked = false;
- renderer.fancyWater = this.checked;
+
+
+
+
+
+
+
+
+
+
+
+
+
-
- Enable Music
-
- if (this.checked) startMusic(); else stopMusic();
+
+
+
+
+
+
+
+
+
-
- Developer Overlay
-
- toggleDeveloperOverlay();
+
+
+
+
+
+
+
+
+
-
-
+
+
+
- Close
- this.parent.hidden = true
-
-
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- ALPHA VI : Fortuna
-
-
-
-
-
-
-
-
-
-
-
- MENU
- openMenu();
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
-
-
-
-
-
- handleMinimapEvent(arguments[0]);
-
+
+
+
+
+
+
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
- findIdleUnit(["Worker", "Trade", "CitizenSoldier"]);
-
-
-
+
+
+
-
-
-
-
+
+
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
+
-
-
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
+
+
-
-
-
-
-
-
-
-
-
-
-
+ [research commands]
+
- [research commands]
-
+
+
+
+
+
+
+
+
+
+
+
-
-
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
-
+
-
+
Return to Main Menu
leaveGame()
Index: ps/trunk/binaries/data/mods/public/gui/session/sprites.xml
===================================================================
--- ps/trunk/binaries/data/mods/public/gui/session/sprites.xml (revision 10145)
+++ ps/trunk/binaries/data/mods/public/gui/session/sprites.xml (revision 10146)
@@ -1,647 +1,655 @@
-
+
+
+
+
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
Index: ps/trunk/binaries/data/mods/public/gui/session/session.js
===================================================================
--- ps/trunk/binaries/data/mods/public/gui/session/session.js (revision 10145)
+++ ps/trunk/binaries/data/mods/public/gui/session/session.js (revision 10146)
@@ -1,306 +1,309 @@
// Network Mode
var g_IsNetworked = false;
// Cache the basic player data (name, civ, color)
var g_Players = [];
// Cache the useful civ data
var g_CivData = {};
var g_PlayerAssignments = { "local": { "name": "You", "player": 1 } };
// Cache dev-mode settings that are frequently or widely used
var g_DevSettings = {
controlAll: false
};
// Indicate when one of the current player's training queues is blocked
// (this is used to support population counter blinking)
var g_IsTrainingQueueBlocked = false;
// Cache EntityStates
var g_EntityStates = {}; // {id:entState}
// Whether the player has lost/won and reached the end of their game
var g_GameEnded = false;
function GetEntityState(entId)
{
if (!(entId in g_EntityStates))
{
var entState = Engine.GuiInterfaceCall("GetEntityState", entId);
g_EntityStates[entId] = entState;
}
return g_EntityStates[entId];
}
// Cache TemplateData
var g_TemplateData = {}; // {id:template}
function GetTemplateData(templateName)
{
if (!(templateName in g_TemplateData))
{
var template = Engine.GuiInterfaceCall("GetTemplateData", templateName);
g_TemplateData[templateName] = template;
}
return g_TemplateData[templateName];
}
// Init
function init(initData, hotloadData)
{
if (initData)
{
g_IsNetworked = initData.isNetworked; // Set network mode
g_PlayerAssignments = initData.playerAssignments;
// Cache the player data
// (This may be updated at runtime by handleNetMessage)
g_Players = getPlayerData(g_PlayerAssignments);
}
else // Needed for autostart loading option
{
- g_Players = getPlayerData(null);
+ g_Players = getPlayerData(null);
}
-
+
// Cache civ data
g_CivData = loadCivData();
g_CivData["gaia"] = { "Code": "gaia", "Name": "Gaia" };
getGUIObjectByName("civIcon").sprite = "stretched:"+g_CivData[g_Players[Engine.GetPlayerID()].civ].Emblem;
if (hotloadData)
{
g_Selection.selected = hotloadData.selection;
}
- else
+ else
{
startMusic(g_CivData[g_Players[Engine.GetPlayerID()].civ].Music); // Starting for the first time:
}
onSimulationUpdate();
// Report the performance after 5 seconds (when we're still near
// the initial camera view) and a minute (when the profiler will
// have settled down if framerates as very low), to give some
// extremely rough indications of performance
setTimeout(function() { reportPerformance(5); }, 5000);
setTimeout(function() { reportPerformance(60); }, 60000);
}
function reportPerformance(time)
{
var settings = Engine.GetMapSettings();
var data = {
time: time,
map: settings.Name,
seed: settings.Seed, // only defined for random maps
size: settings.Size, // only defined for random maps
profiler: Engine.GetProfilerState()
};
-
+
Engine.SubmitUserReport("profile", 3, JSON.stringify(data));
}
function leaveGame()
{
var extendedSimState = Engine.GuiInterfaceCall("GetExtendedSimulationState");
var playerState = extendedSimState.players[Engine.GetPlayerID()];
var gameResult;
if (playerState.state == "won")
{
gameResult = "You have won the battle!";
}
else if (playerState.state == "defeated")
{
gameResult = "You have been defeated...";
}
else // "active"
{
gameResult = "You have abandoned the game.";
// Tell other players that we have given up and
// been defeated
Engine.PostNetworkCommand({
"type": "defeat-player",
"playerId": Engine.GetPlayerID()
});
-
+
}
stopMusic();
endGame();
-
- Engine.SwitchGuiPage("page_summary.xml",
- { "gameResult" : gameResult,
- "timeElapsed" : extendedSimState.timeElapsed,
- "playerStates": extendedSimState.players
+
+ Engine.SwitchGuiPage("page_summary.xml",
+ { "gameResult" : gameResult,
+ "timeElapsed" : extendedSimState.timeElapsed,
+ "playerStates": extendedSimState.players
});
}
// Return some data that we'll use when hotloading this file after changes
function getHotloadData()
{
return { selection: g_Selection.selected };
}
function onTick()
{
checkPlayerState();
while (true)
{
var message = Engine.PollNetworkClient();
if (!message)
break;
handleNetMessage(message);
}
updateCursor();
// If the selection changed, we need to regenerate the sim display
if (g_Selection.dirty)
{
onSimulationUpdate();
// Display rally points for selected buildings
Engine.GuiInterfaceCall("DisplayRallyPoint", { "entities": g_Selection.toList() });
}
// 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";
else
getGUIObjectByName("resourcePop").textcolor = "white";
-
+
// Clear renamed entities list
Engine.GuiInterfaceCall("ClearRenamedEntities", {});
}
function checkPlayerState()
{
var simState = Engine.GuiInterfaceCall("GetSimulationState");
var playerState = simState.players[Engine.GetPlayerID()];
-
+
if (!g_GameEnded)
{
if (playerState.state == "defeated")
{
g_GameEnded = true;
switchMusic("loss_1", 0.0);
g_SessionDialog.open("Defeat", "You have been defeated...\nDo you want to leave the game now?", null, 320, 160, leaveGame);
}
else if (playerState.state == "won")
{
g_GameEnded = true;
switchMusic("win_1", 0.0);
-
+
if (!getGUIObjectByName("devCommandsRevealMap").checked)
getGUIObjectByName("devCommandsRevealMap").checked = true;
-
+
g_SessionDialog.open("Victory", "You have won the battle!\nDo you want to leave the game now?", null, 320, 160, leaveGame);
}
}
}
function onSimulationUpdate()
{
g_Selection.dirty = false;
g_EntityStates = {};
g_TemplateData = {};
-
+
var simState = Engine.GuiInterfaceCall("GetSimulationState");
// If we're called during init when the game is first loading, there will be no simulation yet, so do nothing
if (!simState)
return;
handleNotifications();
updateGroups();
updateDebug(simState);
updatePlayerDisplay(simState);
updateSelectionDetails();
updateBuildingPlacementPreview();
}
function updateGroups()
{
var guiName = "Group";
g_Groups.update();
for (var i = 0; i < 10; i++)
{
var button = getGUIObjectByName("unit"+guiName+"Button["+i+"]");
var label = getGUIObjectByName("unit"+guiName+"Label["+i+"]").caption = i;
if (g_Groups.groups[i].getTotalCount() == 0)
button.hidden = true;
else
button.hidden = false;
button.onpress = (function(i) { return function() { performGroup("select", i); } })(i);
button.ondoublepress = (function(i) { return function() { performGroup("snap", i); } })(i);
}
var numButtons = i;
var rowLength = 1;
var numRows = Math.ceil(numButtons / rowLength);
var buttonSideLength = getGUIObjectByName("unit"+guiName+"Button[0]").size.bottom;
var buttonSpacer = buttonSideLength+1;
for (var i = 0; i < numRows; i++)
layoutButtonRow(i, guiName, buttonSideLength, buttonSpacer, rowLength*i, rowLength*(i+1) );
}
function updateDebug(simState)
{
var debug = getGUIObjectByName("debug");
if (getGUIObjectByName("devDisplayState").checked)
{
debug.hidden = false;
}
else
{
debug.hidden = true;
return;
}
var conciseSimState = deepcopy(simState);
conciseSimState.players = "<<>>";
var text = "simulation: " + uneval(conciseSimState);
-
+
var selection = g_Selection.toList();
if (selection.length)
{
var entState = GetEntityState(selection[0]);
if (entState)
{
var template = GetTemplateData(entState.template);
text += "\n\nentity: {\n";
for (var k in entState)
text += " "+k+":"+uneval(entState[k])+"\n";
text += "}\n\ntemplate: " + uneval(template);
}
}
debug.caption = text;
}
function updatePlayerDisplay(simState)
{
var playerState = simState.players[Engine.GetPlayerID()];
if (!playerState)
return;
getGUIObjectByName("resourceFood").caption = playerState.resourceCounts.food;
getGUIObjectByName("resourceWood").caption = playerState.resourceCounts.wood;
getGUIObjectByName("resourceStone").caption = playerState.resourceCounts.stone;
getGUIObjectByName("resourceMetal").caption = playerState.resourceCounts.metal;
getGUIObjectByName("resourcePop").caption = playerState.popCount + "/" + playerState.popLimit;
-
+
g_IsTrainingQueueBlocked = playerState.trainingQueueBlocked;
}
Index: ps/trunk/binaries/data/mods/public/gui/gamesetup/gamesetup.xml
===================================================================
--- ps/trunk/binaries/data/mods/public/gui/gamesetup/gamesetup.xml (revision 10145)
+++ ps/trunk/binaries/data/mods/public/gui/gamesetup/gamesetup.xml (revision 10146)
@@ -1,200 +1,202 @@
Loading
Loading map data. Please wait...
-
+
onTick();
Match Setup
-
+
Match Type:
Map Filter:
selectMapType(this.list_data[this.selected]);
selectMapFilter(this.list[this.selected]);
selectMap(this.list_data[this.selected]);
-
+
Number of Players
selectNumPlayers(this.list_data[this.selected]);
-
+
Player Name
Civilization
Team
c
-
+
Map size:
Victory condition:
Reveal map:
Teams locked:
-
+
submitChatInput();
Send
submitChatInput();
-
+
[Tooltip text]
+
Cancel
+
Start game!
launchGame();
Index: ps/trunk/binaries/data/mods/public/gui/summary/summary.xml
===================================================================
--- ps/trunk/binaries/data/mods/public/gui/summary/summary.xml (revision 10145)
+++ ps/trunk/binaries/data/mods/public/gui/summary/summary.xml (revision 10146)
@@ -1,188 +1,188 @@
Summary
selectPanel(0);
Units/buildings
selectPanel(1);
Conquest
selectPanel(2);
Resources
Player name
Units
trained
Units
lost
Enemy units
killed
Buildings
constructed
Buildings
lost
Enemy
buildings
destroyed
Player name
Civ centres
built
Enemy
civ centres
destroyed
Map
exploration
Player name
Food
gathered
Vegetarian
ratio
Wood
gathered
Metal
gathered
Stone
gathered
Treasures
collected
Main Menu
Index: ps/trunk/binaries/data/mods/public/gui/page_aiconfig.xml
===================================================================
--- ps/trunk/binaries/data/mods/public/gui/page_aiconfig.xml (revision 10145)
+++ ps/trunk/binaries/data/mods/public/gui/page_aiconfig.xml (revision 10146)
@@ -1,7 +1,11 @@
common/setup.xml
common/sprite1.xml
common/styles.xml
+
+common/common_sprites.xml
+common/common_styles.xml
+
aiconfig/aiconfig.xml