1
0
forked from 0ad/0ad

Started work on new dialogs for session GUI style

Resized quote area in loading screen

This was SVN commit r8713.
This commit is contained in:
WhiteTreePaladin 2010-11-27 17:06:32 +00:00
parent c1cc8d3a19
commit 3c318af2e0
6 changed files with 100 additions and 6 deletions

View File

@ -46,7 +46,7 @@
</object>
<!-- LOADING SCREEN QUOTE (needs increased z value to overcome the transparent area of the tip image above it -->
<object size="64 50%+230 50% 100%-16" z="20">
<object size="50%-448 50%+230 50%+448 100%-16" z="20">
<object name="loadingQuoteTitleText" size="0 0 100% 30" type="text" style="loadingTitleText">Quote of the Day:</object>
<object name="loadingQuoteText" size="0 30 100% 100%" type="text" style="loadingText"></object>
</object>

View File

@ -871,9 +871,7 @@ function performCommand(entity, commandName)
Engine.PostNetworkCommand({"type": "delete-entity", "entity": ent});
};
var btCaptions = ["Yes", "No"];
var btCode = [deleteFunction, null];
messageBox(320, 180, message, "Confirmation", 0, btCaptions, btCode);
g_SessionDialog.open("Delete", message, null, 170, 80, deleteFunction);
}
break;
case "unload-all":

View File

@ -57,7 +57,12 @@ function togglePause()
menu.hidden = true;
}
function escapeKeyAction() // runs multiple times, so always closes all for now...
function openExitGameDialog()
{
g_SessionDialog.open("Confirmation", "Do you really want to quit?", null, 160, 70, leaveGame);
}
function escapeKeyAction()
{
if (!menu.hidden)
{
@ -71,5 +76,6 @@ function escapeKeyAction() // runs multiple times, so always closes all for now.
else if (!settingsWindow.hidden)
{
settingsWindow.hidden = true;
console.write("test");
}
}

View File

@ -141,6 +141,32 @@
</object>
</object>
<!-- ================================ ================================ -->
<!-- Session Dialog -->
<!-- ================================ ================================ -->
<object name="sessionDialog"
sprite="genericPanel"
type="image"
size="50%-180 50%-200 50%+180 50%+50"
hidden="true"
>
<object name="sessionDialogTitle" size="0 0 100% 32" type="text" style="largeBoldCenteredText">Title</object >
<object name="sessionDialogMessage" size="10 10 100%-10 100%-48" type="text" style="dialogText"/>
<object name="sessionDialogPanel" size="10 10 100%-10 100%-48" type="image"/>
<object size="0 100%-48 100% 100%">
<object name="sessionDialogConfirm" size="32 100%-44 144 100%-12" type="button" style="wheatButton">
OK
<action on="Press"></action>
</object>
<object name="sessionDialogCancel" size="100%-144 100%-44 100%-32 100%-12" type="button" style="wheatButton">
Cancel
<action on="Press">g_SessionDialog.close();</action>
</object>
</object>
</object>
<!-- ================================ ================================ -->
<!-- Pause Overlay -->
<!-- ================================ ================================ -->
@ -245,7 +271,8 @@
<object size="0 0 100% 100%" type="text" style="centeredText" name="exitButtonText" ghost="true" font="serif-14">Quit</object>
<action on="Press">
toggleMenu();
<![CDATA[messageBox(400, 200, "Do you really want to quit?", "Confirmation", 0, ["Yes", "No!"], [leaveGame, null]);]]>
openExitGameDialog();
</action>
</object>

View File

@ -94,6 +94,13 @@
text_align="right"
text_valign="center"
/>
<style name="dialogText"
font="serif-16"
textcolor="white"
text_align="center"
text_valign="center"
/>
<!-- ================================ ================================ -->
<!-- Icon Styles -->

View File

@ -3,6 +3,62 @@ const FLORA = "flora";
const FAUNA = "fauna";
const SPECIAL = "special";
//-------------------------------- -------------------------------- --------------------------------
// Session Dialog (only one at a time)
//-------------------------------- -------------------------------- --------------------------------
var g_SessionDialog = new SessionDialog();
function SessionDialog()
{
this.panel = {};
}
SessionDialog.prototype.open = function(title, message, panel, x, y, confirmFunction)
{
getGUIObjectByName("sessionDialogTitle").caption = title;
if (message)
getGUIObjectByName("sessionDialogMessage").caption = message;
else
getGUIObjectByName("sessionDialogMessage").caption = "";
if(panel)
{
this.panel = panel;
panel.hidden = false;
}
if (confirmFunction)
{
var buttonFunction = function () {
this.close(panel); // "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%-44 144 100%-12";
getGUIObjectByName("sessionDialogCancel").size = "100%-144 100%-44 100%-32 100%-12";
}
else
{
getGUIObjectByName("sessionDialogConfirm").hidden = true;
getGUIObjectByName("sessionDialogCancel").size = "50%-56 100%-44 50%+56 100%-12";
}
getGUIObjectByName("sessionDialog").size = "50%-" + x + " 50%-" + y + " 50%+" + x + " 50%+" + y;
getGUIObjectByName("sessionDialog").hidden = false;
};
SessionDialog.prototype.close = function()
{
getGUIObjectByName("sessionDialog").hidden = true;
if (this.panel)
this.panel.hidden = true;
};
//-------------------------------- -------------------------------- --------------------------------
// Utility functions