<?xml version="1.0" encoding="utf-8"?>

<objects>
	<script file="gui/common/music.js"/>
	<script file="gui/common/functions_utility_error.js"/>
	<script file="gui/pregame/mainmenu.js"/>


	<!--
	==========================================
	- MAIN MENU
	==========================================
	-->
	<object	name="mainMenuPage">

		<action on="Tick">
			onTick();
		</action>

		<object	name="backgroundHele1-1"
			type="image"
			sprite="background-hellenes1-1"
			hidden="true"
			ghost="true"
		/>
		<object	name="backgroundHele1-2"
			type="image"
			sprite="background-hellenes1-2"
			hidden="true"
			ghost="true"
		/>
		<object	name="backgroundHele1-3"
			type="image"
			sprite="background-hellenes1-3"
			hidden="true"
			ghost="true"
		/>
		
		<object	name="backgroundPers1-1"
			type="image"
			sprite="background-persians1-1"
			hidden="true"
			ghost="true"
		/>
		<object	name="backgroundPers1-2"
			type="image"
			sprite="background-persians1-2"
			hidden="true"
			ghost="true"
		/>
		<object	name="backgroundPers1-3"
			type="image"
			sprite="background-persians1-3"
			hidden="true"
			ghost="true"
		/>
		<object	name="backgroundPers1-4"
			type="image"
			sprite="background-persians1-4"
			hidden="true"
			ghost="true"
		/>

		<!--
		==========================================
		- MAIN MENU - STATIC TOOLTIP WINDOW
		==========================================
		-->

		<object	name="pgToolTip"
			style="TranslucentPanel"
			type="text"
			hidden="true"
			size="70% 5% 100% 15%"
			ghost="true"
		>tooltipText
		</object>

		<!--
		==========================================
		- MAIN MENU - USER REPORT
		==========================================
		-->

		<object
			name="userReportDisabled"
			size="100%-304 100%-154 100%-4 100%-4"
			type="image"
			style="userReportPanel"
		>
			<object
				type="text"
				style="userReportText"
>[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.
			</object>
			<object type="button" style="StoneButton" size="8 100%-36 146 100%-8">
				Enable feedback
				<action on="Press">EnableUserReport(true);</action>
			</object>
			<object type="button" style="StoneButton" size="100%-146 100%-36 100%-8 100%-8">
				Technical details
				<action on="Press">Engine.PushGuiPage("page_manual.xml", { "page": "userreport" });</action>
			</object>
		</object>

		<object
			name="userReportEnabled"
			size="100%-304 100%-154 100%-4 100%-4"
			type="image"
			style="userReportPanel"
		>
			<object
				name="userReportEnabledText"
				type="text"
				style="userReportText"
>[font="serif-bold-16"]Thank you for helping improve 0 A.D.![/font]

Anonymous feedback is currently enabled.
Status: $status.
                        </object>

			<object type="button" style="StoneButton" size="8 100%-36 146 100%-8">
				Disable feedback
				<action on="Press">EnableUserReport(false);</action>
			</object>
			<object type="button" style="StoneButton" size="100%-146 100%-36 100%-8 100%-8">
				Technical details
				<action on="Press">Engine.PushGuiPage("page_manual.xml", { "page": "userreport" });</action>
			</object>
		</object>


		<!--
		==========================================
		- SUBMENU
		==========================================
		-->

		<!-- hide submenu when user clicks on the background -->
		<object	name="subMenuScreen" type="button">
			<action on="Press">
				closeMenu();
			</action>
		</object>

		<!-- submenu -->
		<object name="submenu"
			type="image"
			style="SubmenuPanel"
			size="60 50%-100 300 50%+100"
			hidden="true"
		>
			<!-- submenuSinglePlayer -->
			<object name="submenuSinglePlayer"
				type="image"
				size="0 4 100%-4 100%-4"
				tooltip_style="pgToolTip"
				tooltip="The 0 A.D. Game Manual."
				hidden="true"
			>
				<object name="subMenuSinglePlayerButton"
					type="button"
					style="StoneButtonFancy"
					size="0 0 100% 28"
					tooltip_style="pgToolTip"
					tooltip="Click here to start a new single player game."
				>
					Matches
					<action on="Press">
						closeMenu();
						Engine.PushGuiPage("page_gamesetup.xml", { type: "offline" });
					</action>
				</object>

				<object name="subMenuCampaignButton"
					type="button"
					style="StoneButtonFancy"
					size="0 32 100% 60"
					tooltip_style="pgToolTip"
					tooltip="Relive history through historical military campaigns. [NOT YET IMPLEMENTED]"
					enabled="false"
				>
					Campaigns
					<action on="Press">
					closeMenu();
						<![CDATA[
							// Open Campaigns window.
							// NOT IMPLEMENTED YET
						]]>
					</action>
				</object>

				<object name="subMenuLoadButton"
					type="button"
					style="StoneButtonFancy"
					size="0 64 100% 92"
					tooltip_style="pgToolTip"
					tooltip="Click here to load a saved game."
				>
					Load Game
					<action on="Press">
						closeMenu();
						Engine.PushGuiPage("page_loadgame.xml", { type: "offline" });
					</action>
				</object>

			</object>

			<!-- submenuMultiplayer -->
			<object name="submenuMultiplayer"
				type="image"
				size="0 4 100%-4 100%-4"
				tooltip_style="pgToolTip"
				tooltip="The 0 A.D. Game Manual"
				hidden="true"
			>
				<object name="subMenuMultiplayerJoinButton"
					type="button"
					style="StoneButtonFancy"
					size="0 0 100% 28"
					tooltip_style="pgToolTip"
					tooltip="Joining an existing multiplayer game."
				>
					Join Game
					<action on="Press">
						closeMenu();
						// Open Multiplayer connection window with join option.
						Engine.PushGuiPage("page_gamesetup_mp.xml", "join");
					</action>
				</object>

				<object name="subMenuMultiplayerHostButton"
					type="button"
					style="StoneButtonFancy"
					size="0 32 100% 60"
					tooltip_style="pgToolTip"
					tooltip="Host a multiplayer game.\n\nRequires UDP port 20595 to be open."
				>
					Host Game
					<action on="Press">
						closeMenu();
						// Open Multiplayer connection window with host option.
						Engine.PushGuiPage("page_gamesetup_mp.xml", "host");
					</action>
				</object>
			</object>

			<!-- submenuToolsAndOptions -->
			<object name="submenuToolsAndOptions"
				type="image"
				size="0 4 100%-4 100%-4"
				tooltip_style="pgToolTip"
				tooltip="The 0 A.D. Game Manual"
				hidden="true"
			>
				<object name="submenuOptionsButton"
					style="StoneButtonFancy"
					type="button"
					size="0 0 100% 28"
					tooltip_style="pgToolTip"
					tooltip="Adjust game settings. [NOT YET IMPLEMENTED]"
					enabled="false"
				>
					Options
					<action on="Press">
						closeMenu();
						<![CDATA[
							// Open Options window.
							Engine.PushGuiPage("page_options.xml");
						]]>
					</action>
				</object>

				<object name="submenuEditorButton"
					style="StoneButtonFancy"
					type="button"
					size="0 32 100% 60"
					tooltip_style="pgToolTip"
					tooltip="Open the Atlas Scenario Editor in a new window. You can run this more reliably by starting the game with the command-line argument &quot;-editor&quot;."
				>
					Scenario Editor
					<action on="Press">
						closeMenu();
						<![CDATA[
							// Start Atlas
							if (Engine.AtlasIsAvailable())
							Engine.RestartInAtlas();
							else
							messageBox(400, 200, "The scenario editor is not available or failed to load.", "Error", 2);
						]]>
					</action>
				</object>
			</object>
		</object><!-- end of submenu -->


		<!--
		==========================================
		- MAIN MENU PANEL
		==========================================
		-->
		<object name="mainMenu"
			type="image"
			style="MainMenuPanel"
			size="60 -2 300 100%+2"
			z="50"
		>
			<!-- These are used to make the right side blend in with the submenu -->
			<object	name="MainMenuPanelRightBorderTop"
				type="image"
				sprite="MainMenuPanelRightBorder"
				ghost="true"
				size="100%-2 0 100% 100%"
			/>
			<object	name="MainMenuPanelRightBorderBottom"
				type="image"
				sprite="MainMenuPanelRightBorder"
				ghost="true"
				size="100%-2 0 100% 100%"
			/>

			<object	name="productLogo"
				type="image"
				sprite="productLogo"
				ghost="true"
				size="50%-110 30 50%+110 130"
			/>

			<object name="mainMenuButtons"
				type="image"
				size="8 156 100%-8 356"
				ghost="false"
			>
				<!-- LEARN TO PLAY BUTTON -->
				<object name="menuLearnToPlayButton"
					type="button"
					style="StoneButtonFancy"
					size="4 4 100%-4 32"
					tooltip_style="pgToolTip"
					tooltip="The 0 A.D. Game Manual"
				>
					Learn To Play
					<action on="Press">
						closeMenu();
						<![CDATA[
							Engine.PushGuiPage("page_manual.xml", { "page": "intro" });
						]]>
					</action>
				</object>

				<!-- SINGLEPLAYER BUTTON -->
				<object name="menuSinglePlayerButton"
					style="StoneButtonFancy"
					type="button"
					size="4 36 100%-4 64"
					tooltip_style="pgToolTip"
					tooltip="Challenge the computer player to a single player match."
				>
					Single Player
					<action on="Press">
						closeMenu();
						openMenu("submenuSinglePlayer", (this.parent.size.top+this.size.top), (this.size.bottom-this.size.top), 3);
					</action>
				</object>

				<!-- MULTIPLAYER BUTTON -->
				<object	name="menuMultiplayerButton"
					style="StoneButtonFancy"
					type="button"
					size="4 68 100%-4 96"
					tooltip_style="pgToolTip"
					tooltip="Fight against one or more human players in a multiplayer game."
				>
					Multiplayer
					<action on="Press">
						closeMenu();
						openMenu("submenuMultiplayer", (this.parent.size.top+this.size.top), (this.size.bottom-this.size.top), 2);
					</action>
				</object>

				<!-- TOOLS AND OPTIONS BUTTON -->
				<object name="menuToolsAndOptionsButton"
					style="StoneButtonFancy"
					type="button"
					size="4 100 100%-4 128"
					tooltip_style="pgToolTip"
					tooltip="Game options and scenario design tools."
				>
					Tools <![CDATA[&]]> Options
					<action on="Press">
						closeMenu();
						openMenu("submenuToolsAndOptions", (this.parent.size.top+this.size.top), (this.size.bottom-this.size.top), 2);
					</action>
				</object>

				<!-- HISTORY BUTTON -->
				<object name="menuHistoryButton"
					style="StoneButtonFancy"
					type="button"
					size="4 132 100%-4 160"
					tooltip_style="pgToolTip"
					tooltip="Learn about the many civilizations featured in 0 A.D."
				>
					History
					<action on="Press">
						closeMenu();
						<![CDATA[
							Engine.PushGuiPage("page_civinfo.xml");
						]]>
					</action>
				</object>

				<!-- EXIT BUTTON -->
				<object name="menuExitButton"
					type="button"
					style="StoneButtonFancy"
					size="4 164 100%-4 192"
					tooltip_style="pgToolTip"
					tooltip="Exit Game"
				>
					Exit
					<action on="Press">
						closeMenu();
						<![CDATA[
							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);
						]]>
					</action>
				</object>
			</object>

			<!-- PRE-RELEASE INFO -->
			<object size="8 100%-340 100%-8 100%-100"
				type="image"
				style="TranslucentPanelThinBorder"
			>

				<!-- PRE-RELEASE WARNING -->
				<object
					font="serif-14"
					type="text"
					textcolor="white"
					size="8 8 100%-8 100%-36"
                                        ghost="true"
				>
[font="serif-bold-16"]Alpha XII: Loucetios<!-- IMPORTANT: remember to update session/session.xml in sync with this -->[/font]

WARNING: This is an early development version of the game. Many features have not been added yet.

Get involved at: play0ad.com
				</object>

				<!-- CONTACT METHODS -->
				<object type="button"
					style="StoneButton"
					tooltip_style="pgToolTip"
					tooltip="Click to open play0ad.com in your web browser."
					size="8 100%-72 50%-4 100%-44"
				>
					Website
					<action on="Press"><![CDATA[
						var url = "http://play0ad.com/";
						Engine.OpenURL(url);
						messageBox(450, 200, "Opening "+url+"\n in default web browser. Please wait...", "Opening page", 2);
					]]></action>
				</object>

				<object type="button"
					style="StoneButton"
					tooltip_style="pgToolTip"
					tooltip="Click to open the 0 A.D. IRC chat in your browser. (#0ad on webchat.quakenet.org)"
					size="50%+4 100%-72 100%-8 100%-44"
				>
					Chat
					<action on="Press"><![CDATA[
						var url = "http://webchat.quakenet.org/?channels=0ad";
						Engine.OpenURL(url);
						messageBox(450, 200, "Opening "+url+"\n in default web browser. Please wait...", "Opening page", 2);
					]]></action>
				</object>

				<object type="button"
					style="StoneButton"
					tooltip_style="pgToolTip"
					tooltip="Click to visit 0 A.D. Trac to report a bug, crash, or error"
					size="8 100%-36 100%-8 100%-8"
				>
					Report a Bug
					<action on="Press"><![CDATA[
						var url = "http://trac.wildfiregames.com/wiki/ReportingErrors/";
						Engine.OpenURL(url);
						messageBox(450, 200, "Opening "+url+"\n in default web browser. Please wait...", "Opening page", 2);
					]]></action>
				</object>

			</object>

			<!-- LOGO AND BUILD VERSION -->
			<object
				size="4 100%-84 100%-4 100%-56"
				ghost="true"
			>

				<!-- COMPANY LOGO -->
				<object	name="companyLogo"
					type="image"
					sprite="companyLogo"
					ghost="true"
					size="50%-16 0 50%+16 32"
				/>

				<!-- COMPANY NAME -->
				<object type="text"
				        style="MediumTitleText"
					ghost="true"
					size="50%-128 32 50%+128 48"
				>WILDFIRE GAMES</object>
			</object>

			<!-- VERSION -->
			<object name="versionNumber"
				type="text"
				style="MediumTitleText"
				ghost="true"
				size="50%-128 100%-36 50%+128 100%"
			>
				<action on="Load"><![CDATA[
					this.caption = "Build: " + buildTime(0) + " - " + buildTime(2);
				]]></action>
			</object>
		</object>
	</object>

</objects>
