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

<objects>

	<script file="gui/common/functions_civinfo.js"/>
	<script file="gui/common/functions_global_object.js"/>
	<script file="gui/common/functions_utility.js"/>
	<script file="gui/common/network.js"/>
	<script file="gui/common/settings.js"/>

	<!-- After settings.js, which defines g_Settings -->
	<script file="gui/gamesetup/gamesetup.js"/>

	<!-- Add a translucent black background to fade out the menu page -->
	<object type="image" style="ModernWindow" size="0 0 100% 100%">

		<object style="TitleText" type="text" size="50%-128 4 50%+128 36">
			<translatableAttribute id="caption">Match Setup</translatableAttribute>
		</object>

		<object type="image" style="ModernDialog" size="50%-190 50%-80 50%+190 50%+80" name="loadingWindow">

			<object type="text" style="TitleText" size="50%-128 0%-16 50%+128 16">
				<translatableAttribute id="caption">Loading</translatableAttribute>
			</object>

			<object type="text" style="ModernLabelText">
				<translatableAttribute id="caption">Loading map data. Please wait...</translatableAttribute>
			</object>

		</object>

		<object hidden="true" name="setupWindow">

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

			<!-- Player assignments -->
			<object size="24 49 100%-440 345" type="image" sprite="ModernDarkBoxGold" name="playerAssignmentsPanel">
				<object size="0 6 100% 30">
					<object name="playerNameHeading" type="text" style="ModernLabelText" size="0 0 22% 100%">
						<translatableAttribute id="caption">Player Name</translatableAttribute>
					</object>
					<object name="playerColorHeading" type="text" style="ModernLabelText" size="22%+5 0 22%+40 100%">
						<translatableAttribute id="caption">Color</translatableAttribute>
					</object>
					<object name="playerPlacementHeading" type="text" style="ModernLabelText" size="22%+45 0 50%+35 100%">
						<translatableAttribute id="caption">Player Placement</translatableAttribute>
					</object>
					<object name="playerCivHeading" type="text" style="ModernLabelText" size="50%+65 0 85%-26 100%">
						<translatableAttribute id="caption">Civilization</translatableAttribute>
					</object>
					<object name="civInfoButton"
						type="button"
						sprite="iconInfoGold"
						sprite_over="iconInfoWhite"
						size="67.5%+68 0 67.5%+84 16"
						tooltip_style="onscreenToolTip"
					>
						<translatableAttribute id="tooltip">View civilization info</translatableAttribute>
						<action on="Press"><![CDATA[
							Engine.PushGuiPage("page_civinfo.xml");
						]]></action>
					</object>
					<object name="playerTeamHeading" type="text" style="ModernLabelText" size="85%+5 0 100%-5 100%">
						<translatableAttribute id="caption">Team</translatableAttribute>
					</object>
				</object>
				<object size="1 36 100%-1 100%">
					<repeat count="8">
						<object name="playerBox[n]" size="0 0 100% 32" hidden="true">
							<object name="playerColor[n]" type="image" size="0 0 100% 100%"/>
							<object name="playerName[n]" type="text" style="ModernLabelText" size="0 2 22% 30"/>
							<object name="playerColorPicker[n]" type="dropdown" style="ModernDropDown" size="22%+5 2 22%+33 30" sprite="" scrollbar="false" button_width="22" font="sans-stroke-14" tooltip_style="onscreenToolTip">
								<translatableAttribute id="tooltip">Pick a color.</translatableAttribute>
							</object>
							<object name="playerAssignment[n]" type="dropdown" style="ModernDropDown" size="22%+37 2 50%+35 30" tooltip_style="onscreenToolTip">
								<translatableAttribute id="tooltip">Select player.</translatableAttribute>
							</object>
							<object name="playerAssignmentText[n]" type="text" style="ModernLabelText" size="22%+5 0 50%+35 30"/>
							<object name="playerConfig[n]" type="button" style="StoneButton" size="50%+40 4 50%+64 28"
								tooltip_style="onscreenToolTip"
								font="sans-bold-stroke-12"
								sprite="ModernGear"
								sprite_over="ModernGearHover"
								sprite_pressed="ModernGearPressed"
							>
								<translatableAttribute id="tooltip">Configure AI settings.</translatableAttribute>
							</object>
							<object name="playerCiv[n]" type="dropdown" style="ModernDropDown" size="50%+69 2 85% 30" tooltip_style="onscreenToolTip">
								<translatableAttribute id="tooltip">Select player's civilization.</translatableAttribute>
							</object>
							<object name="playerCivText[n]" type="text" style="ModernLabelText" size="50%+65 0 85% 30"/>
							<object name="playerTeam[n]" type="dropdown" style="ModernDropDown" size="85%+5 2 100%-5 30" tooltip_style="onscreenToolTip">
								<translatableAttribute id="tooltip">Select player's team.</translatableAttribute>
							</object>
							<object name="playerTeamText[n]" type="text" style="ModernLabelText" size="85%+5 0 100%-5 100%"/>
						</object>
					</repeat>
				</object>
			</object>
			<object size="24 64 100%-460 358" type="image" sprite="CoverFillDark" name="playerAssignmentsPanelCover" hidden="true"/>
			<!-- Map selection -->

			<object size="100%-425 355 100%-285 470" name="mapTypeSelectionTooltip">
				<object type="text" style="ModernRightLabelText" size="0 0 100% 30">
					<translatableAttribute id="caption">Map Type:</translatableAttribute>
				</object>
				<object type="text" style="ModernRightLabelText" size="0 32 100% 62">
					<translatableAttribute id="caption">Map Filter:</translatableAttribute>
				</object>
				<object type="text" style="ModernRightLabelText" size="0 64 100% 94">
					<translatableAttribute id="caption">Select Map:</translatableAttribute>
				</object>
				<object type="text" style="ModernRightLabelText" size="0 96 100% 126">
					<translatableAttribute id="caption">Number of Players:</translatableAttribute>
				</object>
				<object name="mapSizeDesc" type="text" style="ModernRightLabelText" size="0 128 100% 158">
					<translatableAttribute id="caption">Map Size:</translatableAttribute>
				</object>
			</object>


			<object size="100%-275 355 100%-25 470" name="mapFilterSelectionTooltip">
				<object name="mapTypeText" type="text" style="ModernLeftLabelText" size="0 0 100% 30"  hidden="true"/>
				<object name="mapFilterText" type="text" style="ModernLeftLabelText" size="0 32 100% 62"  hidden="true"/>
				<object name="mapSelectionText" type="text" style="ModernLeftLabelText" size="0 64 100% 94"  hidden="true"/>
				<object name="mapSizeText" type="text" style="ModernLeftLabelText" size="0 128 100% 158" hidden="true"/>
			</object>

			<object name="mapTypeSelection"
				type="dropdown"
				style="ModernDropDown"
				size="100%-275 355 100%-25 383"
				tooltip_style="onscreenToolTip">
				<translatableAttribute id="tooltip">Select a map type.</translatableAttribute>
				<action on="SelectionChange">selectMapType(this.list_data[this.selected]);</action>
			</object>

			<object name="mapFilterSelection"
				type="dropdown"
				style="ModernDropDown"
				size="100%-275 387 100%-25 415"
				tooltip_style="onscreenToolTip">
				<translatableAttribute id="tooltip">Select a map filter.</translatableAttribute>
				<action on="SelectionChange">selectMapFilter(this.list_data[this.selected]);</action>
			</object>

			<object size="100%-275 419 100%-25 447" name="mapSelectionPannel">
				<object name="mapSelection"
					style="ModernDropDown"
					type="dropdown"
					size="0 0 100% 100%"
					tooltip_style="onscreenToolTip">
					<translatableAttribute id="tooltip">Select a map to play on.</translatableAttribute>
					<action on="SelectionChange">
						if (this.list_data[this.selected]) 
							selectMap(this.list_data[this.selected]);
					</action>
				</object>
			</object>

			<object name="numPlayersText" size="100%-275 451 100%-25 483" type="text" style="ModernLeftLabelText"/>
				<object name="numPlayersSelection"
					type="dropdown"
					style="ModernDropDown"
					size="100%-275 451 100%-25 479"
					tooltip_style="onscreenToolTip">
				<translatableAttribute id="tooltip">Select number of players.</translatableAttribute>
				<action on="SelectionChange">selectNumPlayers(this.list_data[this.selected]);</action>
			</object>

			<object name="mapSize" size="100%-275 483 100%-25 511" type="dropdown" style="ModernDropDown" hidden="true" tooltip_style="onscreenToolTip">
				<translatableAttribute id="tooltip">Select map size. (Larger sizes may reduce performance.)</translatableAttribute>
			</object>

			<!-- Map Preview -->
			<object  type="image" sprite="ModernDarkBoxGold" name="gamePreviewBox" size="100%-426 49 100%-24 345">
				<object type="image" sprite="snMapPreview" size="1 1 401 294" name="mapPreview"/>
			</object>

			<!-- Map Description -->
			<object size="100%-425 529 100%-25 100%-60">
				<object name="mapInfoName" type="text" style="ModernLeftLabelText" size="0 0 100%-120 30"/> 
				<object type="image" sprite="ModernDarkBoxGold" size="0 30 100% 100%">
					<object name="mapInfoDescription" type="text" style="MapDescription" size="0 0 100% 100%"/>
				</object>
			</object>

			<!-- Chat window -->
			<object name="chatPanel" size="24 355 100%-440 100%-58" type="image" sprite="ModernDarkBoxGold">
				<object name="chatText" size="2 2 100%-2 100%-26" type="text" style="ChatPanel"/>

				<object name="chatInput" size="4 100%-24 100%-76 100%-4" type="input" style="ModernInput">
					<action on="Press">submitChatInput();</action>
					<action on="Tab">
						var players = [];
						for (var player in g_PlayerAssignments)
							players.push(g_PlayerAssignments[player]);
						autoCompleteNick("chatInput", players);
					</action>
				</object>

				<object size="100%-72 100%-24 100%-4 100%-4" type="button" style="StoneButton">
					<translatableAttribute id="caption">Send</translatableAttribute>
					<action on="Press">submitChatInput();</action>
				</object>
			</object>

			<!-- Tooltip -->
			<object name="onscreenToolTip"
				type="text"
				font="sans-14"
				textcolor="white"
				sprite="BackgroundTranslucent"
				hidden="true"
				size="20 100%-56 100%-312 100%-24"
			/>

			<!-- Cheat Warning Text -->
			<object size="0 100%-52 100%-320 100%-24" hidden="true" name="cheatWarningText">
				<object type="text" textcolor="red" style="ModernRightLabelText" size="0 0 100% 30">
					<translatableAttribute id="caption">Cheats enabled.</translatableAttribute>
				</object>
			</object>

			<!-- Start/Ready Button -->
			<object
				name="startGame"
				type="button"
				style="StoneButton"
				size="100%-164 100%-52 100%-24 100%-24"
				tooltip_style="onscreenToolTip"
				enabled="false"
			>
				<translatableAttribute id="caption">Start game!</translatableAttribute>
				<translatableAttribute id="tooltip">Start a new game with the current settings.</translatableAttribute>
				<action on="Press">
					if (g_IsController)
						launchGame();
					else
						toggleReady();
				</action>
			</object>

			<!-- Cancel Button -->
			<object
				name="cancelGame"
				type="button"
				style="StoneButton"
				size="100%-308 100%-52 100%-168 100%-24"
				tooltip_style="onscreenToolTip"
			>
				<translatableAttribute id="caption">Back</translatableAttribute>
				<action on="Press">cancelSetup();</action>
			</object>

			<!-- Options -->
			<object name="gameOptionsBox" size="100%-425 529 100%-25 525">
				<!-- More Options Button -->
				<object
					name="showMoreOptions"
					type="button"
					style="StoneButton"
					size="100%-120 0 100% 28"
					tooltip_style="onscreenToolTip"
				>
					<translatableAttribute id="caption">More Options</translatableAttribute>
					<translatableAttribute id="tooltip">See more game options</translatableAttribute>
					<action on="Press">showMoreOptions(true);</action>
				</object>

			<!-- End Options -->
			</object>

			<!-- More Options -->
			<object hidden="true" name="moreOptionsFade" type="image" z="60" sprite="ModernFade"/>
			<object name="moreOptions" type="image" sprite="ModernDialog" size="50%-200 50%-195 50%+200 50%+250" z="70" hidden="true">
				<object style="ModernLabelText" type="text" size="50%-128 -18 50%+128 14">
					<translatableAttribute id="caption">More Options</translatableAttribute>
				</object>

				<object size="14 38 94% 66">
					<object size="0 0 40% 28" type="text" style="ModernRightLabelText">
						<translatableAttribute id="caption">Game Speed:</translatableAttribute>
					</object>
					<object name="gameSpeedText" size="40% 0 100% 100%" type="text" style="ModernLeftLabelText"/>
					<object name="gameSpeed" size="40%+10 0 100% 28" type="dropdown" style="ModernDropDown" hidden="true" tooltip_style="onscreenToolTip">
						<translatableAttribute id="tooltip">Select game speed.</translatableAttribute>
					</object>
				</object>

				<object size="14 68 94% 96">
					<object size="0 0 40% 28" type="text" style="ModernRightLabelText">
						<translatableAttribute id="caption">Victory Condition:</translatableAttribute>
					</object>
					<object name="victoryConditionText" size="40% 0 100% 100%" type="text" style="ModernLeftLabelText"/>
					<object name="victoryCondition" size="40%+10 0 100% 28" type="dropdown" style="ModernDropDown" hidden="true" tooltip_style="onscreenToolTip">
						<translatableAttribute id="tooltip">Select victory condition.</translatableAttribute>
					</object>
				</object>

				<object size="14 98 94% 126">
					<object size="0 0 40% 28" type="text" style="ModernRightLabelText">
						<translatableAttribute id="caption">Population Cap:</translatableAttribute>
					</object>
					<object name="populationCapText" size="40% 0 100% 100%" type="text" style="ModernLeftLabelText"/>
					<object name="populationCap" size="40%+10 0 100% 28" type="dropdown" style="ModernDropDown" hidden="true" tooltip_style="onscreenToolTip">
						<translatableAttribute id="tooltip">Select population cap.</translatableAttribute>
					</object>
				</object>

				<object size="14 128 94% 156">
					<object size="0 0 40% 28" type="text" style="ModernRightLabelText">
						<translatableAttribute id="caption">Starting Resources:</translatableAttribute>
					</object>
					<object name="startingResourcesText" size="40% 0 100% 100%" type="text" style="ModernLeftLabelText"/>
					<object name="startingResources" size="40%+10 0 100% 28" type="dropdown" style="ModernDropDown" hidden="true" tooltip_style="onscreenToolTip">
						<translatableAttribute id="tooltip">Select the game's starting resources.</translatableAttribute>
					</object>
				</object>

				<object size="14 158 94% 186">
					<object size="0 0 40% 28" type="text" style="ModernRightLabelText">
						<translatableAttribute id="caption">Ceasefire:</translatableAttribute>
					</object>
					<object name="ceasefireText" size="40% 0 100% 100%" type="text" style="ModernLeftLabelText"/>
					<object name="ceasefire" size="40%+10 0 100% 28" type="dropdown" style="ModernDropDown" hidden="true" tooltip_style="onscreenToolTip">
						<translatableAttribute id="tooltip">Set time where no attacks are possible.</translatableAttribute>
					</object>
				</object>

				<object size="14 188 94% 216">
					<object size="0 0 40% 28" type="text" style="ModernRightLabelText">
						<translatableAttribute id="caption" comment="Make sure to differentiate between the revealed map and explored map options!">Revealed Map:</translatableAttribute>
					</object>
					<object name="revealMapText" size="40% 0 100% 28" type="text" style="ModernLeftLabelText"/>
					<object name="revealMap" size="40%+10 5 40%+30 100%-5" type="checkbox" style="ModernTickBox" hidden="true" tooltip_style="onscreenToolTip">
						<translatableAttribute id="tooltip" comment="Make sure to differentiate between the revealed map and explored map options!">Toggle revealed map (see everything).</translatableAttribute>
					</object>
				</object>

				<object size="14 218 94% 246">
					<object size="0 0 40% 28" type="text" style="ModernRightLabelText">
						<translatableAttribute id="caption" comment="Make sure to differentiate between the revealed map and explored map options!">Explored Map:</translatableAttribute>
					</object>
					<object name="exploreMapText" size="40% 0 100% 28" type="text" style="ModernLeftLabelText"/>
					<object name="exploreMap" size="40%+10 5 40%+30 100%-5" type="checkbox" style="ModernTickBox" hidden="true" tooltip_style="onscreenToolTip">
						<translatableAttribute id="tooltip" comment="Make sure to differentiate between the revealed map and explored map options!">Toggle explored map (see initial map).</translatableAttribute>
					</object>
				</object>

				<object size="14 248 94% 276">
					<object size="0 0 40% 28" type="text" style="ModernRightLabelText">
						<translatableAttribute id="caption">Disable Treasures:</translatableAttribute>
					</object>
					<object name="disableTreasuresText" size="40% 0 100% 28" type="text" style="ModernLeftLabelText"/>
					<object name="disableTreasures" size="40%+10 5 40%+30 100%-5" type="checkbox" style="ModernTickBox" hidden="true" tooltip_style="onscreenToolTip">
						<translatableAttribute id="tooltip">Disable all treasures on the map.</translatableAttribute>
					</object>
				</object>

				<object size="14 278 94% 306">
					<object size="0 0 40% 28" type="text" style="ModernRightLabelText">
						<translatableAttribute id="caption">Teams Locked:</translatableAttribute>
					</object>
					<object name="lockTeamsText" size="40% 0 100% 28" type="text" style="ModernLeftLabelText"/>
					<object name="lockTeams" size="40%+10 5 40%+30 100%-5" type="checkbox" style="ModernTickBox" hidden="true" tooltip_style="onscreenToolTip">
						<translatableAttribute id="tooltip">Toggle locked teams.</translatableAttribute>
					</object>
				</object>

				<object name="optionCheats" size="14 308 94% 336" hidden="true">
					<object size="0 0 40% 28" type="text" style="ModernRightLabelText">
						<translatableAttribute id="caption">Cheats:</translatableAttribute>
					</object>
					<object name="enableCheatsText" size="40% 0 100% 28" type="text" style="ModernLeftLabelText"/>
					<object name="enableCheats" size="40%+10 5 40%+30 100%-5" type="checkbox" style="ModernTickBox" hidden="true" tooltip_style="onscreenToolTip">
						<translatableAttribute id="tooltip">Toggle the usability of cheats.</translatableAttribute>
					</object>
				</object>

				<object name="optionRating" size="14 338 94% 366" hidden="true">
					<object size="0 0 40% 28" hidden="false" type="text" style="ModernRightLabelText">
						<translatableAttribute id="caption">Rated Game:</translatableAttribute>
					</object>
					<object name="enableRatingText" size="40% 0 100% 28" type="text" style="ModernLeftLabelText"/>
					<object name="enableRating" size="40%+10 5 40%+30 100%-5" type="checkbox" style="ModernTickBox" hidden="true" tooltip_style="onscreenToolTip">
						<translatableAttribute id="tooltip">Toggle if this game will be rated for the leaderboard.</translatableAttribute>
					</object>
				</object>

				<object name="optionObserverLateJoin" size="14 368 94% 396" hidden="true">
					<object size="0 0 40% 28" type="text" hidden="false" style="ModernRightLabelText">
						<translatableAttribute id="caption">Late Observer Joins:</translatableAttribute>
					</object>
					<object name="observerLateJoinText" size="40% 0 100% 28" type="text" style="ModernLeftLabelText"/>
					<object name="observerLateJoin" size="40%+10 5 40%+30 100%-5" type="checkbox" style="ModernTickBox" hidden="true" tooltip_style="onscreenToolTip">
						<translatableAttribute id="tooltip">Allow observers to join after the game started.</translatableAttribute>
					</object>
				</object>

				<!-- Hide More Options Button -->
				<object
					name="hideMoreOptions"
					type="button"
					style="StoneButton"
					size="50%-70 400 50%+70 426"
					tooltip_style="onscreenToolTip"
					hotkey="cancel"
				>
					<translatableAttribute id="caption">OK</translatableAttribute>
					<translatableAttribute id="tooltip">Close more game options window</translatableAttribute>
					<action on="Press">showMoreOptions(false);</action>
				</object>
			<!-- End More Options -->
			</object>
		</object>
	</object>
</objects>
