
require( "menu/mainmenu.lua" );
require( "scripts/game_style.lua" );


mainmenu_group = 
{
	MainMenu
	{
		name="mainmenu",
		x= 0,
		y = 0,
		w = kMax,
		h = kMax,
		
		Bitmap
		{
			image=mainmenu_bg_board_params["image"];
			name=mainmenu_bg_board_params["name"];
			x=mainmenu_bg_board_params["x"];
			y=mainmenu_bg_board_params["y"];
			w=mainmenu_bg_board_params["w"];
			h=mainmenu_bg_board_params["h"];
		},
		
		Bitmap
		{
			name = mainmenu_win_menuframe_params["name"],
			image = mainmenu_win_menuframe_params["image"],
			x = mainmenu_win_menuframe_params["x"],
			y = mainmenu_win_menuframe_params["y"]				
		},
	
		-- Play
		MonopolyButton
		{
			name="btn.play",
			graphics = mainmenu_btn_play_01_params["graphics"],
			x = mainmenu_btn_play_01_params["x"],
			y = mainmenu_btn_play_01_params["y"],
			label ="",
			type = kPush,
			command=
				function()
					if HasNoHumanProfiles() then
						DisplayDialog {
							"scripts/generic_ok.lua",
							body = "profile.explainfirst",
							title = "menu/ico_createprofile"
						};
					end
					OnMainMenuButtonNew();
				end
		},
		
		-- Continue
		--[[
		Bitmap
		{
			name = "continuer_disable",
			image = "menu/btn_cnt_04",
			x = mainmenu_btn_cnt_params["x"],
			y = mainmenu_btn_cnt_params["y"]				
		},
		MonopolyButton
		{
			name="btn.continue",
			graphics = mainmenu_btn_cnt_params["graphics"],
			x = mainmenu_btn_cnt_params["x"],
			y = mainmenu_btn_cnt_params["y"],
			label ="",
			type = kPush,
			command=
				function()
					OnMainMenuButtonContinue();
					SwapToModal("scripts/monopoly_game.lua")
				end
		},
		--]]
		
		-- Load
		Bitmap
		{
			name = "load_disable",
			image = "menu/btn_load_04",
			x = mainmenu_btn_load_01_params["x"],
			y = mainmenu_btn_load_01_params["y"]				
		},		

		MonopolyButton
		{
			name="btn.load",
			graphics = mainmenu_btn_load_01_params["graphics"],
			x = mainmenu_btn_load_01_params["x"],
			y = mainmenu_btn_load_01_params["y"],
			label ="",
			type = kPush,
			command=
				function()
					OnMainMenuButtonLoad();
				end
		},
		
		-- Rules
		MonopolyButton
		{
			name="btn.rules",
			graphics = mainmenu_btn_rules_01_params["graphics"],
			x = mainmenu_btn_rules_01_params["x"],
			y = mainmenu_btn_rules_01_params["y"],
			label ="",
			type = kPush,
			command=
				function()
					OnMainMenuButtonRules();
				end
		},
		
		-- Options
		MonopolyButton
		{
			name="btn.options",
			graphics = mainmenu_btn_options_01_params["graphics"],
			x = mainmenu_btn_options_01_params["x"],
			y = mainmenu_btn_options_01_params["y"],
			label ="",
			type = kPush,
			command=
				function()
					OnMainMenuButtonOptions();
				end
		},
		
--[[			
-- Never to be visible in release build
		MonopolyButton
		{
			x = main_menu_btn_play_description["x"],
			y = main_menu_btn_play_description["y"]+40,
			name="btn_sandBox",
			label ="ui.btn.sandbox",
			type = kPush,
			command=
				function()
					if (CheckUsers()) then
						-- Tell TSettings what game mode we're entering
						SetCurrentGameMode(0);
						-- Switch to the appropriate screen
						SwapToModal("scripts/sandbox.lua")
					end
				end
		},
--]]

		-- Quit
		MonopolyButton
		{
			name="btn.quit",
			graphics = mainmenu_btn_quit_01_params["graphics"],
			x = mainmenu_btn_quit_01_params["x"],
			y = mainmenu_btn_quit_01_params["y"],
			label ="",
			type = kPush,
			command=
				function()
					result = DisplayDialog {
						"scripts/generic_yesno.lua",
						body = "ui.dialog.quit.confirm",
						title = "menu/ico_quit"
					};
					if (result=='yes') then
						PostMessage( CreateNamedMessage( kQuitNow, "Quit" ) );
					end
					-- CA MARCHE PAS CE TRUC : SendGameMessage pet les plombs
					--if (result=='no') then
					--	SendGameMessage( "SFX_CANCEL" );
					--end					
				end
		},
		
		Text
		{
			font = White15Font,
			name = "version",
			x=650,
			y=50,
			w=100,
			h=50,
			flags = kHAlignRight + kVAlignTop,
			label = ""
		},
		
		Text
		{
			font = White15Font,
			name = "game_saved",
			x=650,
			y=500,
			w=100,
			h=50,
			flags = kHAlignRight + kVAlignTop,
			label = "gamesaved"
		},

	}
}