#include "ui/menudef.h"

#define CHOICE_SIZE_X			150
#define CHOICE_SIZE_Y			22

#define CHOICE_X_START			0
#define CHOICE_Y_START			34

#define CHOICE_SEP_OFFSET_Y		-2

#define CHOICE_GROUP			"xboxlive_lobby"

#include "ui_mp/menustyle.inc"
#include "ui/choices_setup_common.menu"
 #include "ui_mp/stats_info.inc"

#define PLAYERLIST_WIDTH 		270
#define ORIGIN_PLAYERLIST 		(- (PLAYERLIST_WIDTH - RIGHTITEM_OFFSET)) 38
#define ORIGIN_STATUS			(- (PLAYERLIST_WIDTH - RIGHTITEM_OFFSET)) 0

#define ORIGIN_DESCRIPTION		(CHOICE_X_START + 15) 158
#define COLOR_DESC_TEXT			1 1 1 0.7

#define MENU_FONT_SIZE			TEXTSIZE_DEFAULT
#define HIGHLIGHT_SIZE			142 22
#define MENU_FONT_COLOR			1 1 1 0.5
#define MENU_FONT_COLOR2		1 1 1 0.5
#define MENU_LOCKED_COLOR		0.25 0.25 0.25 1



#define PC
//-------------------------------------

#define ORIGIN_BUTTON_BACK		52 438

// ============= init dvars ==============
#define INDEX_HEADSHOTS 2308
#define STATTODVAR_HEADSHOTS execNow "statGetInDvar 2308 ui_stat_headshots"
#define INDEX_DEATHS 2305
#define STATTODVAR_DEATHS execNow "statGetInDvar 2305 ui_stat_deaths"
#define INDEX_KILLS 2303
#define STATTODVAR_KILLS execNow "statGetInDvar 2303 ui_stat_kills"
#define INDEX_SCORE 2302
#define STATTODVAR_SCORE execNow "statGetInDvar 2302 ui_stat_score"
#define INDEX_RANKXP 2301
#define STATTODVAR_RANKXP execNow "statGetInDvar 2301 ui_stat_rankxp"
#define INDEX_MELEEKILLS 2354
#define STATTODVAR_MELEEKILLS execNow "statGetInDvar 2354 ui_stat_melee"
#define INDEX_PISTOLKILLS 2355
#define STATTODVAR_PISTOLKILLS execNow "statGetInDvar 2355 ui_stat_pistol"
#define INDEX_KILLEDJUMPERS 2356
#define STATTODVAR_KILLEDJUMPERS execNow "statGetInDvar 2356 ui_stat_jumpers"
#define INDEX_KILLEDACTIVATORS 2357
#define STATTODVAR_KILLEDACTIVATORS execNow "statGetInDvar 2357 ui_stat_activators"
//---------

#define STAT_UPDATE \
	STATTODVAR_TIME_PLAYED_OTHER; \
	STATTODVAR_TIME_PLAYED_OPFOR; \
	STATTODVAR_TIME_PLAYED_ALLIES; \
	STATTODVAR_TEAMKILLS; \
	STATTODVAR_HEADSHOTS; \
	STATTODVAR_ASSISTS; \
	STATTODVAR_DEATH_STREAK; \
	STATTODVAR_DEATHS; \
	STATTODVAR_KILL_STREAK; \
	STATTODVAR_KILLS; \
	STATTODVAR_SCORE; \
	STATTODVAR_MELEEKILLS; \
	STATTODVAR_PISTOLKILLS; \
	STATTODVAR_KILLEDJUMPERS; \
	STATTODVAR_KILLEDACTIVATORS; \
	STATTODVAR_RANKXP;

#include "ui_mp/common_macro.inc"




{



	menuDef
	{
		name			"team_select"
		rect			0 0 640 480
		focuscolor		COLOR_FOCUSED
		style			WINDOW_STYLE_EMPTY
		blurWorld		7.0
		legacySplitScreenScale
		//soundloop 		"music_mainmenu_mp"
		onOpen
		{
			STAT_UPDATE;
			//focusFirst;
			//exec "selectStringTableEntryInDvar mp/didyouknow.csv 0 didyouknow";
		}
		onClose
		{
		}
		onEsc
		{
			close self;
		}
		
		// ------------------  statics ------------------------
		//#include "ui/blurredbg.inc"
		itemDef
		{
			style			WINDOW_STYLE_SHADER
			rect			FULLSCREEN_WIDE
			background		"deathrun"
			visible			1
			decoration
		}
		#include "ui_mp/sidepanels.inc"

		CHOICE_MENU_TITLE( "Death Run Mod" )
		// --------------------- lobby players count -----------------------
		/*itemDef	{
			type			ITEM_TYPE_TEXT
			rect			-30 0 PLAYERLIST_WIDTH 0 RIGHTITEM_ALIGN VERTICAL_ALIGN_TOP
			origin			ORIGIN_PLAYERLIST
			forecolor		CHOICE_TEXTCOLOR
			dvar			"party_playerCount"
			textfont		UI_FONT_DEFAULT
			textscale		TEXTSIZE_SMALL
			textaligny		-6
			textalign		ITEM_ALIGN_RIGHT
			visible			1
			decoration
		}*/

		// --------- button ----------
		itemDef
		{
			rect			-140 -4 0 0 HORIZONTAL_ALIGN_CENTER VERTICAL_ALIGN_BOTTOM
			origin			0 0
			text			"@BRAXI_MOTD"
			textfont		UI_FONT_NORMAL
			textscale		TEXTSIZE_SMALL
			textalign		ITEM_ALIGN_BOTTOM_LEFT
			visible			1
			decoration
		}		
		#include "ui_mp/navcontrols.inc"

		#include "ui_mp/perm_bans.inc"

		// ----------------------------map images------------------------------------
		#include "ui_mp/game_info.inc"
		
		GAME_INFO( "$levelBriefing", dvarString( ui_map_name ), gametypename(), 1 )
		//GAME_INFO( "loadscreen_" + dvarString (ui_map_name), dvarString( ui_map_name ), gametypename(), 1 )
		//GAME_INFO( dvarString(si_mapname) + , dvarString( si_mapname ), gametypename(), 1 )
		
		//=========================================================
		//===================== MENU SELECTION ====================
		//=========================================================

		#define CLEARUIHINT	exec "set ui_hint_text @NULL_EMPTY"

		#define SETUP_ACTION_AUTOASSIGN \				
				scriptMenuResponse "autoassign";
		#define SETUP_ACTION_SPECTATE \				
				scriptMenuResponse "spectator";

		CHOICE_BUTTON_FOCUS_VIS( 1, "@DRM_PLAY", scriptMenuResponse "autoassign";, exec "set ui_hint_text @DRM_PLAY_DESC", CLEARUIHINT, when(1) )
		CHOICE_BUTTON_FOCUS_VIS( 2, "@DRM_SPECTATE", scriptMenuResponse "spectator";, exec "set ui_hint_text @DRM_SPECTATE_DESC", CLEARUIHINT, when(1) )
		//CHOICE_BUTTON_FOCUS_VIS( 3, "@DRM_CHARACTER", open "ocd_popup_cac_secondary";, exec "set ui_hint_text @DRM_CHARACTER_DESC", CLEARUIHINT, when(1) )
		CHOICE_BUTTON_FOCUS_VIS( 3, "@DRM_CHARACTER", scriptMenuResponse "character_menu";, exec "set ui_hint_text @DRM_CHARACTER_DESC", CLEARUIHINT, when(1) )
		
		CHOICE_BUTTON_FOCUS_VIS( 4, "@DRM_HELP", close self; open dr_help;, exec "set ui_hint_text @DRM_HELP_DESC", CLEARUIHINT, when(1) )
		CHOICE_BUTTON_FOCUS_VIS( 5, "@DRM_OPTIONS", close self; open dr_options;, exec "set ui_hint_text @DRM_OPTIONS_DESC", CLEARUIHINT, when(1) )
		CHOICE_BUTTON_FOCUS_VIS( 6, "@MENU_LEAVE_GAME", open popup_endgame, exec "set ui_hint_text Disconnect from server.", CLEARUIHINT, when(1) )
		
		// ---------------------- menu selection description -------------------------
		itemDef	{
			name			desc_arrow
			style			WINDOW_STYLE_SHADER
			rect			0 28 10 10 CHOICE_HORIZONTAL_ALIGN VERTICAL_ALIGN_TOP
			origin			ORIGIN_DESCRIPTION
			background		"ui_arrow_right"
			forecolor		1 1 1 0.25
			visible			1
			decoration
		}
		itemDef	{
			name			description_choice
			type			ITEM_TYPE_TEXT
			rect			12 25 210 36 CHOICE_HORIZONTAL_ALIGN VERTICAL_ALIGN_TOP
			origin			ORIGIN_DESCRIPTION
			exp				text( dvarString( ui_hint_text ) )
			textfont		UI_FONT_DEFAULT
			textscale		TEXTSIZE_SMALL
			textaligny		16
			forecolor		COLOR_DESC_TEXT
			visible			1
			autowrapped
			decoration
		}


		// ---------------------- player list -------------------------
		#include "ui_mp/player_info.inc"

		/*itemDef 
		{
			name			maplist
			visible			1
			rect			CHOICE_X( 40 ) 52 200 270 CHOICE_HORIZONTAL_ALIGN CHOICE_VERTICAL_ALIGN
			forecolor		COLOR_UNFOCUSED
			style			WINDOW_STYLE_FILLED
			type			ITEM_TYPE_LISTBOX
			textscale		CHOICE_TEXTSIZE
			textstyle		ITEM_TEXTSTYLE_SHADOWED
			textfont		UI_FONT_NORMAL
			elementtype		LISTBOX_TEXT
			elementwidth	120
			elementheight	24
			textalignx 		6
			textaligny 		0
			forecolor 		CHOICE_TEXTCOLOR
			backcolor 		0 0 0 0
			border			1
			bordersize		1
			bordercolor		1 1 1 0.15
			outlinecolor 	1 1 1 0.2
			feeder			FEEDER_PLAYER_LIST
			columns			1 2 190 25
			mouseEnter 		{ setitemcolor maplist bordercolor 1 1 1 0.55 }
			mouseExit 		{ setitemcolor maplist bordercolor 1 1 1 0.15 }
		}*/

		#include "ui/safearea.menu"
		#include "ui/popup_background.inc"
	}
}


	
