1
0
forked from 0ad/0ad

GUI update (first music implementation, a little Status Orb improvement).

This was SVN commit r1335.
This commit is contained in:
Acumen 2004-11-16 00:44:10 +00:00
parent 884dbf281c
commit b5655265da
9 changed files with 65 additions and 12 deletions

View File

@ -23,6 +23,9 @@
<script file="gui/test/functions_utility_debug.js"><![CDATA[
]]></script>
<script file="gui/test/functions_utility_music.js"><![CDATA[
]]></script>
<script file="gui/test/functions_test.js"><![CDATA[
]]></script>

View File

@ -11,6 +11,10 @@
-->
<object type="empty" name="pregame_gui" size="0 0 100% 100%" z="1" hidden="false">
<action on="Load"><![CDATA[
// Play main 0 A.D. theme when the main menu starts.
curr_music = new Sound("audio/music/menu_track.ogg"); curr_music.loop();
]]></action>
<object type="image" name="pregame-mainmenu-background-image" sprite="pregame-mainmenu-background" size="0 0 100% 100%" z="100" hidden="false" />
@ -20,6 +24,7 @@
GUIObjectUnhide("session_gui");
GUIObjectHide("pregame_gui");
FlipGUI(GUIType);
curr_music.free(); // Close main theme when starting game session.
]]></action>
<action on="MouseEnter"><![CDATA[
tooltipObject = getGUIObjectByName("pregame-mainmenu-tooltip");

View File

@ -633,21 +633,20 @@
]]></action>
<!-- STATUS ORB BACKGROUND -->
<object type="button" name="session_panel_status_bg" sprite="session_panel_status_bg-top" textcolor="255 255 255" text-align="left" text-valign="top" z="70" ghost="true" hidden="false">
<object type="button" name="session_panel_status_bg" z="70" ghost="true" hidden="false">
<action on="Load"><![CDATA[
AddSizeString(this.name,
"0% 0% 0%+184 0%+184",
"0% 100%-184 0%+184 100%");
AddSizeCoord(this.name,
crd_status_orb_bkg_x, crd_status_orb_bkg_y, crd_status_orb_bkg_x+crd_status_orb_bkg_width, crd_status_orb_bkg_y+crd_status_orb_bkg_height, left_screen, top_screen, left_screen, top_screen,
crd_status_orb_bkg_x, -crd_status_orb_bkg_y-crd_status_orb_bkg_height, crd_status_orb_bkg_x+crd_status_orb_bkg_width, -crd_status_orb_bkg_y, left_screen, bottom_screen, left_screen, bottom_screen);
]]></action>
</object>
<!-- SELECTED UNIT LARGE PORTRAIT -->
<object type="button" name="session_panel_status_portrait" style="portrait" z="70" hidden="false">
<action on="Load"><![CDATA[
AddSizeString(this.name,
"0%+4 0%+116 0%+68 0%+180",
"0%+4 100%-180 0%+68 100%-116");
setPortrait(this.name, "unit_dude");
AddSizeCoord(this.name,
crd_status_orb_portrait_x, crd_status_orb_portrait_y, crd_status_orb_portrait_x+crd_status_orb_portrait_width, crd_status_orb_portrait_y+crd_status_orb_portrait_height, left_screen, top_screen, left_screen, top_screen,
crd_status_orb_portrait_x, -crd_status_orb_bkg_y-crd_status_orb_bkg_height+crd_status_orb_portrait_y, crd_status_orb_portrait_x+crd_status_orb_portrait_width, -crd_status_orb_bkg_y-crd_status_orb_bkg_height+crd_status_orb_portrait_y+crd_status_orb_portrait_height, left_screen, bottom_screen, left_screen, bottom_screen);
]]></action>
</object>
@ -990,8 +989,6 @@
==========================================
-->
<!--
==========================================
- DEBUG -

View File

@ -18,7 +18,7 @@
<object type="button" name="exit_button" sprite="exit_sprite" sprite-over="exit_sprite-over" size="100%-18 2 100%-2 18" z="1000" hidden="false">
<action on="Press"><![CDATA[
btCaptions = new Array("Yes, let me out!", "Nooooo!");
btCode = new Array("exit();", "GUIObjectHide('mb_main');");
btCode = new Array("curr_music.free(); exit();", "GUIObjectHide('mb_main');");
messageBox(400, 200, "Do you really want to quit 0 A.D.? This will cause a sudden return to reality.", "Confirmation", 0, btCaptions, btCode);
]]></action>

View File

@ -52,6 +52,10 @@ function manualDisplay()
if (selection[0].traits.health.curr && selection[0].traits.health.hitpoints && selection[0].traits.health)
ManualRollover.caption += "Hitpoints: " + selection[0].traits.health.curr + "/" + selection[0].traits.health.hitpoints + "\n";
// Display rank.
if (selection[0].traits.id.rank)
ManualRollover.caption += "Rank: " + selection[0].traits.id.rank + "\n";
// Armour.
if (selection[0].traits.armour)
{
@ -129,6 +133,8 @@ function manualDisplay()
// Icon.
if (selection[0].traits.id.icon)
ManualRollover.caption += "Icon: " + selection[0].traits.id.icon + "\n";
if (selection[0].traits.id.icon_cell)
ManualRollover.caption += "Icon_Cell: " + selection[0].traits.id.icon_cell + "\n";
// Version.
if (selection[0].traits.id.version)

View File

@ -3,6 +3,7 @@ function initSession()
initCoord();
initGroupPane();
initResourcePool();
initStatusOrb();
}
// ====================================================================

View File

@ -14,8 +14,10 @@ function initCoord()
// Screen percentages.
top_screen = 0;
left_screen = 0;
mid_screen = 50;
bottom_screen = 100;
right_screen = 100;
// Small icons (eg Movement Rate, Food).
crd_mini_icon_width = 20;
@ -97,7 +99,7 @@ function FlipGUI(NewGUIType)
GUIObjectUnhide("always_on");
// Seek through all sizes created.
for (FlipGUILoop = 0; FlipGUILoop < SizeCoord.last-1; FlipGUILoop++)
for (FlipGUILoop = 0; FlipGUILoop <= SizeCoord.last-1; FlipGUILoop++)
{
// Set each object to the other size.
switch (GUIType)

View File

@ -1,3 +1,20 @@
function initStatusOrb()
{
// Status Orb background.
crd_status_orb_bkg_x = 0;
crd_status_orb_bkg_y = 0;
crd_status_orb_bkg_width = 184;
crd_status_orb_bkg_height = crd_status_orb_bkg_width;
// Status Orb large portrait.
crd_status_orb_portrait_x = 5;
crd_status_orb_portrait_y = 5;
crd_status_orb_portrait_width = crd_portrait_lrg_width;
crd_status_orb_portrait_height = crd_status_orb_portrait_width;
}
// ====================================================================
function UpdateStatusOrb()
{
// Update name text.
@ -43,6 +60,14 @@ function UpdateStatusOrb()
setPortrait("session_panel_status_portrait", selection[0].traits.id.icon);
}
// Update rank.
if (selection[0].traits.id.rank > 1)
{
getGUIObjectByName("session_panel_status_icon_rank").sprite = "statistic_rank" + (selection[0].traits.id.rank-1);
}
else
getGUIObjectByName("session_panel_status_icon_rank").sprite = "";
// Update hitpoints
if (selection[0].traits.health.curr & selection[0].traits.health.hitpoints)
{

View File

@ -0,0 +1,14 @@
// Audio functions (eg "pick a random sound from a list", "build a playlist") will go here.
// In the meantime, a quick run-down of the basic commands:
// Save the specified audio file to handle "s".
// s = new Sound( "audio/music/menu_track.ogg" );
// Play the sound stored at handle "s" one time (it'll be automatically freed when the playback ends):
// s.play();
// Play the sound stored at handle "s" continuously:
// s.loop();
// Close "s" and free it from memory (use in conjunction with loop()):
// s.free();