1
0
forked from 0ad/0ad
0ad/binaries/data/mods/official/gui/test/hello.xml
Acumen bc669568f9 Updated GUI for Cavalry Dude.
This was SVN commit r1205.
2004-10-01 09:40:25 +00:00

481 lines
23 KiB
XML
Executable File

<?xml version="1.0" encoding="iso-8859-1" standalone="no" ?>
<!DOCTYPE objects SYSTEM "../gui.dtd">
<objects>
<!--
==========================================
- GLOBAL SCRIPTS -
==========================================
-->
<script file="gui/test/basefunctions.js"><![CDATA[
writeConsole("GUI file loading");
function MakeUnit(x, y, z, MakeUnitName) {
DudeSpawnPoint = new Vector3D(x, y, z);
new Entity(getEntityTemplate(MakeUnitName), DudeSpawnPoint, 1.0);
writeConsole(MakeUnitName + " created at " + DudeSpawnPoint);
}
function selected()
{
if( selection.length > 0 )
return( selection[0] );
return( null );
}
function updateOrbital()
{
if( !getGUIObjectByName( 'arena' ).hidden )
{
g_ballx += g_balldx;
g_bally += g_balldy;
if (g_ballx > 600) {
g_balldx *= -0.9;
g_ballx = 600-(g_ballx-600);
}
else if (g_ballx < 0) {
g_balldx *= -0.9;
g_ballx = -g_ballx;
}
if (g_bally > 400) {
g_balldy *= -0.9;
g_bally = 400-(g_bally-400);
}
else if (g_bally < 0) {
g_balldy *= -0.9;
g_bally = -g_bally;
}
// Gravitate towards the mouse
var vect_x = g_ballx-g_mousex;
var vect_y = g_bally-g_mousey;
var dsquared = vect_x*vect_x + vect_y*vect_y;
if (dsquared < 1000) dsquared = 1000;
var force = 10000.0 / dsquared;
var mag = Math.sqrt(dsquared);
vect_x /= mag; vect_y /= mag;
g_balldx -= force * vect_x;
g_balldy -= force * vect_y;
var ball = getGUIObjectByName('ball');
var r=5;
ball.size = new GUISize(g_ballx-r, g_bally-r, g_ballx+r, g_bally+r);
}
}
function StartGame()
{
var gameAttribs=new Object();
gameAttribs.mapFile="test_01.pmp";
startGame(gameAttribs);
}
]]></script>
<!--
==========================================
- GLOBAL OBJECTS -
==========================================
-->
<object type="empty" name="all_gui" size="0 0 100% 100%" z="1" hidden="false">
<object type="empty" name="always_on" size="0 0 100% 100%" z="1" hidden="false">
<!--
==========================================
- EXIT BUTTON -
==========================================
-->
<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="Load"><![CDATA[
writeConsole("(GUI) Exit button successfully loaded.");
]]></action>
<action on="Press"><![CDATA[
exit();
]]></action>
<!-- START temporary code
This code only applies to the main menu, I don't know how it'll behave ingame. It is temporary and should be removed as soon as we got proper
tooltip support implemented. -->
<action on="MouseEnter"><![CDATA[
tooltipObject = getGUIObjectByName("pregame-mainmenu-tooltip");
tooltipObject.caption = "Tired of 0 A.D. ? Click here to leave and reenter the real world.";
GUIObjectUnhide("pregame-mainmenu-tooltip");
]]></action>
<action on="MouseLeave"><![CDATA[
GUIObjectHide("pregame-mainmenu-tooltip");
]]></action>
<!-- END temporary code -->
</object>
</object>
<!--
==========================================
- MAIN MENU -
==========================================
-->
<object type="empty" name="pregame_gui" size="0 0 100% 100%" z="1" hidden="false">
<object type="image" name="pregame-mainmenu-background-image" sprite="pregame-mainmenu-background" size="0 0 100% 100%" z="100" hidden="false" />
<object type="button" name="pregame-mainmenu-sp-button" sprite-over="pregame-mainmenu-spbt" size="52.9296875% 23.95833333% 67.578125% 42.317708333%" z="101" hidden="false">
<action on="Press"><![CDATA[
startGame();
GUIObjectUnhide("session_gui");
GUIObjectHide("pregame_gui")
GUIObjectUnhide("End_Game_Button")
]]></action>
<action on="MouseEnter"><![CDATA[
tooltipObject = getGUIObjectByName("pregame-mainmenu-tooltip");
tooltipObject.caption = "Want to move some Dudes around or test something ? Click here to start a new game on the default map.";
GUIObjectUnhide("pregame-mainmenu-tooltip");
]]></action>
<action on="MouseLeave"><![CDATA[
GUIObjectHide("pregame-mainmenu-tooltip");
]]></action>
</object>
<object type="image" name="pregame-mainmenu-0ad-logo" sprite="pregame-mainmenu-0ad-logo-480x218" size="21.1914062% 3.125% 68.0664062% 31.5104166%" z="102" hidden="false" ghost="true">
</object>
<object type="text" name="pregame-mainmenu-versionnumber" size="43% 24% 43%+282 24%+25" z="103" textcolor="237 227 167" font="prospero16" hidden="false" ghost="true">
{buildTime}
<action on="Load"><![CDATA[
this.caption = "Build: " + buildTime(0) + " " + getLanguageID();
]]></action>
</object>
<object type="text" name="pregame-mainmenu-tooltip" sprite="tooltip-background" size="69% 6.3802% 97.0703125% 28.125%" font="prospero16" textcolor="255 255 255" z="104" hidden="true" ghost="true">
tooltipText
</object>
<object type="image" name="pregame-mainmenu-wfg-logo" sprite="pregame-mainmenu-wfg-logo-256x64" size="10 91.666666%-30 25.9765% 100%-30" z="102" hidden="false">
<action on="MouseEnter"><![CDATA[
tooltipObject = getGUIObjectByName("pregame-mainmenu-tooltip");
tooltipObject.caption = "These are the guys who made this game. Visit them at http://www.wildfiregames.com/0ad/";
GUIObjectUnhide("pregame-mainmenu-tooltip");
]]></action>
<action on="MouseLeave"><![CDATA[
GUIObjectHide("pregame-mainmenu-tooltip");
]]></action>
</object>
</object>
<!-- TEMPORARY END GAME BUTTON; REMOVE WHEN GAME MENU IMPLEMENTED; BUTTON IS OUTSIDE OF pregame_gui IN ORDER TO BE VISIBLE DURING GAME -->
<object type="button" name="End_Game_Button" sprite="sprite1" sprite-over="sprite1-over" sprite-pressed="sprite1-pressed" size="100%-150 32 100%-30 53" z="105" textcolor="0 0 0" hidden="true">
End Game
<action on="Press"><![CDATA[
endGame();
GUIObjectHide("session_gui");
GUIObjectHide("End_Game_Button");
GUIObjectUnhide("pregame_gui");
]]></action>
</object>
<object type="empty" name="session_gui" size="0 0 100% 100%" z="1" hidden="true">
<!--
==========================================
- DUDE PRODUCTION BUTTONS -
==========================================
-->
<object type="button" name="Dude_Production_Button_random" hotkey="dudemachine.random" sprite="sprite1" sprite-over="sprite1-over" sprite-pressed="sprite1-pressed" size="100%-288 32 100%-160 53" z="100" textcolor="0 0 0" text-align="center" text-valign="center">
Make random dude
<action on="Press"><![CDATA[
// Generate random numbers
rand_x = Math.round(Math.random()*100);
rand_y = Math.round(Math.random()*100);
rand_z = Math.round(Math.random()*100);
MakeUnit(rand_x, rand_y, rand_z, "Prometheus Dude");
]]></action>
</object>
<object type="empty" name="top_bar" size="0 0 100% 100%" z="1" hidden="false">
<!--
==========================================
- RESOURCE ICONS -
==========================================
-->
<!-- FOOD -->
<!-- icon/background/text -->
<object type="text" name="resource_food" sprite="resource_food" size="100%-456 4 20 20" z="100" hidden="false"></object>
<object type="text" name="resource_food_counter" sprite="resource_counter" size="100%-436 5 1 1" z="90" hidden="false"></object>
<object type="text" name="resource_food_text" size="100%-438 -3 1 1" font="prospero16" textcolor="255 255 255" z="100" hidden="false"> 123,456</object>
<!-- WOOD -->
<!-- icon/background/text -->
<object type="text" name="resource_wood" sprite="resource_wood" size="100%-376 4 20 20" z="100" hidden="false"></object>
<object type="text" name="resource_wood_counter" sprite="resource_counter" size="100%-356 5 1 1" z="90" hidden="false"></object>
<object type="text" name="resource_wood_text" size="100%-358 -3 1 1" font="prospero16" textcolor="255 255 255" z="100" hidden="false"> 789,012</object>
<!-- STONE -->
<!-- icon/background/text -->
<object type="text" name="resource_stone" sprite="resource_stone" size="100%-296 4 20 20" z="100" hidden="false"></object>
<object type="text" name="resource_stone_counter" sprite="resource_counter" size="100%-276 5 1 1" z="90" hidden="false"></object>
<object type="text" name="resource_stone_text" size="100%-278 -3 1 1" font="prospero16" textcolor="255 255 255" z="100" hidden="false"> 345,678</object>
<!-- ORE -->
<!-- icon/background/text -->
<object type="text" name="resource_ore" sprite="resource_ore" size="100%-216 4 20 20" z="100" hidden="false"></object>
<object type="text" name="resource_ore_counter" sprite="resource_counter" size="100%-196 5 1 1" z="90" hidden="false"></object>
<object type="text" name="resource_ore_text" size="100%-198 -3 1 1" font="prospero16" textcolor="255 255 255" z="100" hidden="false"> 910,123</object>
<!-- POPULATION -->
<!-- icon/background/text -->
<object type="text" name="resource_population" sprite="resource_population" size="100%-136 4 20 20" z="100" hidden="false"></object>
<object type="text" name="resource_population_counter" sprite="resource_counter_long" size="100%-116 5 1 1" z="90" hidden="false"></object>
<object type="text" name="resource_population_text" size="100%-118 -3 1 1" font="prospero16" textcolor="255 255 255" z="100" hidden="false"> 100/150</object>
<!--
==========================================
- PHASE BANNER -
==========================================
ATTENTION: This is temporary code. We will have a nice-looking graphical banner here later.
-->
<object type="button" name="phase_banner" sprite="white-border" size="50%-50 2 50%+50 23" z="50" textcolor="255 255 255" text-align="center" text-valign="center">Village
<action on="Press"><![CDATA[
ObjectPhaseBanner = getGUIObjectByName("phase_banner");
switch (ObjectPhaseBanner.caption)
{
case ("Village"):
ObjectPhaseBanner.caption = "Town";
break;
case ("Town"):
ObjectPhaseBanner.caption = "City";
break;
case ("City"):
ObjectPhaseBanner.caption = "Village";
break;
default:
break;
}
]]></action>
</object>
</object>
<!--
==========================================
- MISCELLANEOUS -
==========================================
There's always MISC :) This is mainly temporary fun-stuff.
-->
<object type="text" name="wfg_logo" sprite="wfg_logo_128" size="20 20 148 148" z="100" hidden="false" />
<!--
==========================================
- BOTTOM PANEL IN SESSION UI -
==========================================
-->
<object type="text" name="session_panel" hidden="false">
<!-- PANEL BACKGROUND -->
<object type="text" name="session_panel_bg_left" sprite="session_panel_bg_left" size="0 100%-161 258 100%" z="50" hidden="false" />
<object type="text" name="session_panel_minimap_bg" sprite="session_panel_minimap_bg" size="0 100%-179 100% 100%" z="60" hidden="false" />
<object type="text" name="session_panel_bg_middle" sprite="session_panel_bg_middle" size="50%-257 100%-161 50%+274 100%" z="50" hidden="false">
<action on="Tick"><![CDATA[
getGUIGlobal().GUIUpdateObjectInfo();
]]></action>
</object>
<object type="text" name="session_panel_bg_right" sprite="session_panel_bg_right" size="100%-241 100%-161 100% 100%" z="50" hidden="false" />
<!-- MINIMAP - TEMP: Insert real minimap here later. -->
<object type="text" name="session_panel_minimap_dummy" sprite="session_panel_minimap_dummy" size="9 100%-169 100% 100%" z="60" hidden="false" />
<!--
==========================================
- INFO PANEL -
==========================================
-->
<!-- Entity info objects -->
<object type="text" name="selection_portrait_test" sprite="portrait_unit_dude_lrg" size="50%-250 100%-130 64 64" z="60" hidden="true" />
<object type="text" name="selection_name_test" size="50%-180 100%-140 50%+200 100%-120" font="prospero24b" textcolor="255 255 255" z="60" hidden="false" />
<object type="text" name="selection_pos_test" size="50%-250 100%-60 50%+200 100%-95" textcolor="255 255 255" z="60" hidden="false" />
<object type="text" name="selection_speed_test" size="50%+200 100%-43 100%-241 0" textcolor="255 255 255" z="60" hidden="false" />
<!-- / Entity info objects -->
<!-- Entity Statistics -->
<object type="text" name="statistic_attack" sprite="statistic_attack" size="50%+75 100%-110 20 20" z="100" hidden="false"></object>
<object type="text" name="statistic_hack" sprite="statistic_hack" size="50%+75 100%-75 20 20" z="100" hidden="false"></object>
<object type="text" name="statistic_pierce" sprite="statistic_pierce" size="50%+75 100%-40 20 20" z="100" hidden="false"></object>
<object type="text" name="statistic_accuracy" sprite="statistic_accuracy" size="50%+175 100%-110 20 20" z="100" hidden="false"></object>
<object type="text" name="statistic_los" sprite="statistic_los" size="50%+175 100%-75 20 20" z="100" hidden="false"></object>
<object type="text" name="statistic_speed" sprite="statistic_speed" size="50%+175 100%-40 20 20" z="100" hidden="false"></object>
<!-- / Entity Statistics -->
<!-- TABS - Background -->
<object type="text" name="session_panel_tabs_bg_left" sprite="session_panel_tabs_bg1" size="100%-235 100%-152 100%-176 100%-7" z="60" hidden="false" />
<object type="text" name="session_panel_tabs_bg_right" sprite="session_panel_tabs_bg2" size="100%-197 100%-152 100%-7 100%-7" z="61" hidden="false" />
<!-- TABS MAIN -->
<!-- TAB: [1] COMMAND -->
<object type="button" name="session_panel_tabs_command_activebg" sprite="session_panel_tabs_activetabbg"
size="100%-235 100%-152 100%-195 100%-112" z="62" hidden="false">
<!-- DUDEMAKER BUTTONS -->
<object type="button" name="normal_mode_button_dude" sprite="portrait_unit_dude_sml" sprite-over="portrait_unit_dude_sml_over" size="100%-190 100%-143 100%-158 100%-111" z="64" hidden="false">
<action on="Press"><![CDATA[
MakeUnit(15,0,15,"Prometheus Dude");
]]></action>
</object>
<object type="button" name="normal_mode_button_dudette" sprite="portrait_unit_dudette_sml" sprite-over="portrait_unit_dudette_sml_over" size="100%-150 100%-143 100%-117 100%-111" z="64" hidden="false">
<action on="Press"><![CDATA[
MakeUnit(15,0,15,"Prometheus Dudette");
]]></action>
</object>
<object type="button" name="normal_mode_button_cavalrydude" sprite="portrait_unit_cavalrydude_sml" sprite-over="portrait_unit_cavalrydude_sml_over" size="100%-110 100%-143 100%-77 100%-111" z="64" hidden="false">
<action on="Press"><![CDATA[
MakeUnit(15,0,15,"Cavalry Dude");
]]></action>
</object>
</object>
<!-- TAB: [2] BUILD CIVIL -->
<object type="button" name="session_panel_tabs_buildcivil_activebg" sprite="session_panel_tabs_activetabbg"
size="100%-235 100%-117 100%-195 100%-77" z="62" hidden="true">
</object>
<!-- TAB: [3] BUILD MILITARY -->
<object type="button" name="session_panel_tabs_buildmil_activebg" sprite="session_panel_tabs_activetabbg"
size="100%-235 100%-82 100%-195 100%-42" z="62" hidden="true">
</object>
<!-- TAB: [4] FORMATIONS -->
<object type="button" name="session_panel_tabs_formations_activebg" sprite="session_panel_tabs_activetabbg"
size="100%-235 100%-47 100%-195 100%-7" z="62" hidden="true">
</object>
<!-- / TABS MAIN -->
<!-- TABS - Tab Buttons -->
<!-- BUTTON: [1] Command -->
<object type="button" name="session_panel_tabs_command_bt" sprite="icon_command" size="100%-230 100%-147 100%-198 100%-115" z="63" hidden="false">
<action on="Press"><![CDATA[
GUIObjectUnhide("session_panel_tabs_command_activebg");
GUIObjectHide("session_panel_tabs_buildcivil_activebg");
GUIObjectHide("session_panel_tabs_buildmil_activebg");
GUIObjectHide("session_panel_tabs_formations_activebg");
]]></action>
</object>
<!-- BUTTON: [2] Build Civil -->
<object type="button" name="session_panel_tabs_buildcivil_bt" sprite="icon_buildcivil" size="100%-230 100%-112 100%-198 100%-80" z="63" hidden="false">
<action on="Press"><![CDATA[
GUIObjectUnhide("session_panel_tabs_buildcivil_activebg");
GUIObjectHide("session_panel_tabs_command_activebg");
GUIObjectHide("session_panel_tabs_buildmil_activebg");
GUIObjectHide("session_panel_tabs_formations_activebg");
]]></action>
</object>
<!-- BUTTON: [3] Build Military -->
<object type="button" name="session_panel_tabs_buildmil_bt" sprite="icon_buildmil" size="100%-230 100%-77 100%-198 100%-45" z="63" hidden="false">
<action on="Press"><![CDATA[
GUIObjectUnhide("session_panel_tabs_buildmil_activebg");
GUIObjectHide("session_panel_tabs_command_activebg");
GUIObjectHide("session_panel_tabs_buildcivil_activebg");
GUIObjectHide("session_panel_tabs_formations_activebg");
]]></action>
</object>
<!-- BUTTON: [4] Formations -->
<object type="button" name="session_panel_tabs_formations_bt" sprite="icon_formations" size="100%-230 100%-42 100%-198 100%-10" z="63" hidden="false">
<action on="Press"><![CDATA[
GUIObjectUnhide("session_panel_tabs_formations_activebg");
GUIObjectHide("session_panel_tabs_command_activebg");
GUIObjectHide("session_panel_tabs_buildcivil_activebg");
GUIObjectHide("session_panel_tabs_buildmil_activebg");
]]></action>
</object>
</object>
<!--
==========================================
- FPS COUNTER -
==========================================
-->
<object type="text" name="FPS_Counter" size="18 100%-35 200 100%" z="100" hotkey="hotkey.fps.toggle" textcolor="200 200 0" font="verdana16" hidden="false">
<action on="Load"><![CDATA[
setInterval(UpdateFPSCounter, 50);
]]></action>
</object>
<!--
==========================================
- ORBITAL BALL ARENA OBJECTS -
==========================================
These were the first things ever in the 0 A.D. GUI, and they are kept more or less for nostalgia reasons ;)
-->
<object type="text" name="arena" sprite="sprite1" size="0 0 600 500" z="100" hidden="true" textcolor="127 0 0">
<!-- stress-test the text renderer -->
Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Integer nisl libero, ornare sit amet, feugiat sit amet, pretium vitae, tellus. Etiam tempor est vel neque rutrum congue. Quisque sed elit. Suspendisse vel tellus consectetuer lacus blandit varius. Etiam pretium malesuada turpis. Pellentesque urna justo, facilisis sodales, ultrices eget, pretium vestibulum, nibh. Mauris vulputate. Aliquam luctus feugiat felis. In venenatis, nulla eu suscipit auctor, turpis purus tincidunt arcu, non mattis pede urna nec est. Quisque sodales dolor sit amet odio. Suspendisse rutrum tellus ut sem. Vestibulum consequat est.
Sed nec quam sit amet mi blandit ornare. Phasellus condimentum varius urna. Suspendisse velit leo, feugiat sit amet, mattis quis, adipiscing placerat, enim. Vivamus dapibus. Fusce porta felis ac diam. Vestibulum mollis augue non quam. Vestibulum id sapien. Donec ornare felis non eros. Curabitur eget dui. Suspendisse potenti. Phasellus ultrices, sem ac consequat aliquet, felis tellus mollis dui, vitae imperdiet mi arcu eu augue. Duis libero neque, tristique eu, pellentesque et, facilisis sit amet, est. Vestibulum vehicula aliquam enim. Maecenas hendrerit nunc in orci sagittis ullamcorper. Donec cursus, sapien eget luctus tincidunt, mi ante accumsan leo, non fermentum diam ipsum ac tellus. Pellentesque ipsum sapien, mollis a, viverra eget, malesuada id, est. Sed nec tellus nec velit posuere euismod. Aenean turpis. Donec eu nibh. Fusce in libero.
Nunc bibendum metus a tellus. Nulla lorem metus, convallis id, lobortis eu, elementum ut, tellus. Suspendisse et risus sit amet arcu volutpat volutpat. Maecenas vel tortor id lectus suscipit suscipit. Maecenas condimentum ipsum eu augue. Nunc nisl. Etiam libero augue, gravida ac, imperdiet vel, sollicitudin ac, dui. Sed ullamcorper faucibus libero. Etiam egestas tellus vel justo. Etiam venenatis metus in pede. Pellentesque quam tellus, elementum eu, elementum ut, auctor a, velit. Suspendisse potenti. Quisque fermentum justo ut pede. Donec adipiscing, dolor ut consequat eleifend, neque nunc iaculis arcu, et nonummy elit tortor sed enim. Cras ultricies nunc ac massa. Ut turpis massa, sodales et, tincidunt vel, elementum eu, dolor.
<action on="Load"><![CDATA[
g_ballx = 300;
g_bally = 200;
g_balldx = 0;
g_balldy = 0;
g_mousex = 0;
g_mousey = 0;
setInterval( updateOrbital, 100 );
]]></action>
<action on="MouseOver"><![CDATA[
g_mousex = mouse.x;
g_mousey = mouse.y;
]]></action>
</object>
<object type="button" name="ball" sprite="sprite1" size="0 0 1 1" z="120" hotkey="orbital.cheat">
<action on="Press"><![CDATA[
writeConsole(mouse);
g_balldx = 0;
g_balldy = 0;
]]></action>
</object>
<object type="button" name="arena-button" sprite="sprite1" size="710 32 726 48" z="200" hotkey="orbital.toggle" font="prospero14" text-align="center" text-valign="center">v
<action on="Press"><![CDATA[
var arena = getGUIObjectByName('arena');
arena.hidden = !arena.hidden;
this.caption = arena.hidden ? 'v' : '^';
]]></action>
</object>
<!--
==========================================
- / ORBITAL BALL ARENA OBJECTS -
==========================================
-->
<!-- / SESSION GUI -->
</object>
<!-- TEST -->
<object type="image" name="darkening_test" sprite="tooltip-background" size="0 0 100% 100%" z="1000" hidden="true">
</object>
<!-- / ALL GUI -->
</object>
</objects>