
require( "menu/savegame.lua" );
require( "menu/btn_saveslot_export.lua" );
require( "scripts/game_style.lua" );

--savemenu_group = 
MakeDialog
{
	SaveMenu
	{
		name="savemenu",
		x= 0,
		y = 0,
		w = 800,
		h = 600,
		
		Bitmap
		{
			name = savegame_win_medframesg_params["name"],
			image = savegame_win_medframesg_params["image"],
			x = savegame_win_medframesg_params["x"],
			y = savegame_win_medframesg_params["y"]
		},
		
		Text
		{
			name = "title",
			font = Green17Font,
			x = savegame_txt_savegame_params["x"]-10,
			y = savegame_txt_savegame_params["y"]-10,
			w = savegame_txt_savegame_params["w"]+20,
			h = savegame_txt_savegame_params["h"]+20,
			flags = kHAlignCenter + kVAlignCenter,
			label = "savegame"
		},
	
		-- Save slot 1
		Bitmap
		{
			name="img.saveslot.01",
			image = "menu/btn_saveslot_04",
			x = savegame_btn_saveslot_01_params["x"],
			y = savegame_btn_saveslot_01_params["y"],
		},
		MonopolyButton
		{
			name="btn.saveslot.01",
			graphics = savegame_btn_saveslot_01_params["graphics"],
			x = savegame_btn_saveslot_01_params["x"],
			y = savegame_btn_saveslot_01_params["y"],
			label ="",
			type = kPush,
			sfxEx = "eINTERFACE_OK",
			command=
				function()
					SetConfirmSlot(0);
					if CheckForSaveSlotOverWrite(0) then
						result = DisplayDialog
						{
							"scripts/saveconfirm.lua"
						};
						if (result == 'yes') then
							OnSaveMenuBtnSaveSlot(0);
							OnGameQuit();
						end
					else
						OnSaveMenuBtnSaveSlot(0);
						OnGameQuit();
					end
				end
		},
		Window
		{
			name="btn.saveslot.01.contents",
			x = savegame_btn_saveslot_01_params["x"],
			y = savegame_btn_saveslot_01_params["y"]-2,
			w = savegame_btn_saveslot_01_params["w"],
			h = savegame_btn_saveslot_01_params["h"],
			
			Text
			{
				name = "saveslot.01.id",
				font = MonopolyFont_20B_Grey1,
				x = btn_saveslot_export_txt_1_params["x"]-5,
				y = btn_saveslot_export_txt_1_params["y"]-5,
				w = btn_saveslot_export_txt_1_params["w"]+10,
				h = btn_saveslot_export_txt_1_params["h"]+10,
				flags = kHAlignCenter + kVAlignCenter,
				label = ""
			},
			Text
			{
				name = "saveslot.01.names",
				font = MonopolyFont_12B_Grey2,
				x = btn_saveslot_export_txt_player01_params["x"],
				y = btn_saveslot_export_txt_player01_params["y"],
				w = btn_saveslot_export_txt_player01_params["w"],
				h = (btn_saveslot_export_txt_player01_params["h"]*5)+3,
				flags = kHAlignLeft + kVAlignTop,
				label = ""
			},
			Text
			{
				name = "saveslot.01.time",
				font = MonopolyFont_14B_Grey2,
				x = btn_saveslot_export_txt_playtime_params["x"]-5,
				y = btn_saveslot_export_txt_playtime_params["y"],
				w = btn_saveslot_export_txt_playtime_params["w"]+10,
				h = btn_saveslot_export_txt_playtime_params["h"]+10,
				flags = kHAlignRight + kVAlignTop,
				label = ""
			},
			Text
			{
				name = "saveslot.01.saved",
				font = MonopolyFont_14B_Grey2,
				x = btn_saveslot_export_txt_savetime_params["x"]-45,
				y = btn_saveslot_export_txt_savetime_params["y"],
				w = btn_saveslot_export_txt_savetime_params["w"]+50,
				h = btn_saveslot_export_txt_savetime_params["h"]+10,
				flags = kHAlignRight + kVAlignTop,
				label = ""
			},
			MonopolyButton
			{
				name="btn.delete.01",
				graphics = savegame_btn_delete_01_params["graphics"],
				x = btn_saveslot_export_stats_copy_params["x"],
				y = btn_saveslot_export_stats_copy_params["y"],
				label ="",
				type = kPush,
				sfxEx = "eINTERFACE_OK",
				command=
					function()
						SetConfirmSlot(0);
						result = DisplayDialog
						{
							"scripts/savedeleteconfirm.lua"
						};
						if (result == 'yes') then
							OnSaveMenuButtonDelete(0);
						end
					end
			},
		},

		-- Save slot 2
		Bitmap
		{
			name="img.saveslot.02",
			image = "menu/btn_saveslot_04",
			x = savegame_btn_saveslot_02_params["x"],
			y = savegame_btn_saveslot_02_params["y"],
		},
		MonopolyButton
		{
			name="btn.saveslot.02",
			graphics = savegame_btn_saveslot_02_params["graphics"],
			x = savegame_btn_saveslot_02_params["x"],
			y = savegame_btn_saveslot_02_params["y"],
			label ="",
			type = kPush,
			sfxEx = "eINTERFACE_OK",
			command=
				function()
					SetConfirmSlot(1);
					if CheckForSaveSlotOverWrite(1) then
						result = DisplayDialog
						{
							"scripts/saveconfirm.lua"
						};
						if (result == 'yes') then
							OnSaveMenuBtnSaveSlot(1);
							OnGameQuit();
						end
					else
						OnSaveMenuBtnSaveSlot(1);
						OnGameQuit();
					end
				end
		},
		Window
		{
			name="btn.saveslot.02.contents",
			x = savegame_btn_saveslot_02_params["x"],
			y = savegame_btn_saveslot_02_params["y"]-2,
			w = savegame_btn_saveslot_02_params["w"],
			h = savegame_btn_saveslot_02_params["h"],
			
			Text
			{
				name = "saveslot.02.id",
				font = MonopolyFont_20B_Grey1,
				x = btn_saveslot_export_txt_1_params["x"]-5,
				y = btn_saveslot_export_txt_1_params["y"]-5,
				w = btn_saveslot_export_txt_1_params["w"]+10,
				h = btn_saveslot_export_txt_1_params["h"]+10,
				flags = kHAlignCenter + kVAlignCenter,
				label = ""
			},
			Text
			{
				name = "saveslot.02.names",
				font = MonopolyFont_12B_Grey2,
				x = btn_saveslot_export_txt_player01_params["x"],
				y = btn_saveslot_export_txt_player01_params["y"],
				w = btn_saveslot_export_txt_player01_params["w"],
				h = (btn_saveslot_export_txt_player01_params["h"]*5)+3,
				flags = kHAlignLeft + kVAlignTop,
				label = ""
			},
			Text
			{
				name = "saveslot.02.time",
				font = MonopolyFont_14B_Grey2,
				x = btn_saveslot_export_txt_playtime_params["x"]-5,
				y = btn_saveslot_export_txt_playtime_params["y"],
				w = btn_saveslot_export_txt_playtime_params["w"]+10,
				h = btn_saveslot_export_txt_playtime_params["h"]+10,
				flags = kHAlignRight + kVAlignTop,
				label = ""
			},
			Text
			{
				name = "saveslot.02.saved",
				font = MonopolyFont_14B_Grey2,
				x = btn_saveslot_export_txt_savetime_params["x"]-45,
				y = btn_saveslot_export_txt_savetime_params["y"],
				w = btn_saveslot_export_txt_savetime_params["w"]+50,
				h = btn_saveslot_export_txt_savetime_params["h"]+10,
				flags = kHAlignRight + kVAlignTop,
				label = ""
			},
			MonopolyButton
			{
				name="btn.delete.02",
				graphics = savegame_btn_delete_01_params["graphics"],
				x = btn_saveslot_export_stats_copy_params["x"],
				y = btn_saveslot_export_stats_copy_params["y"],
				label ="",
				type = kPush,
				sfxEx = "eINTERFACE_OK",
				command=
					function()
						SetConfirmSlot(1);
						result = DisplayDialog
						{
							"scripts/savedeleteconfirm.lua"
						};
						if (result == 'yes') then
							OnSaveMenuButtonDelete(1);
						end
					end
			},
		},
		
		-- Save slot 3
		Bitmap
		{
			name="img.saveslot.03",
			image = "menu/btn_saveslot_04",
			x = savegame_btn_saveslot_02_params["x"],
			y = savegame_btn_saveslot_02_params["y"],
		},
		MonopolyButton
		{
			name="btn.saveslot.03",
			graphics = savegame_btn_saveslot_03_params["graphics"],
			x = savegame_btn_saveslot_03_params["x"],
			y = savegame_btn_saveslot_03_params["y"],
			label ="",
			type = kPush,
			sfxEx = "eINTERFACE_OK",
			command=
				function()
					SetConfirmSlot(2);
					if CheckForSaveSlotOverWrite(2) then
						result = DisplayDialog
						{
							"scripts/saveconfirm.lua"
						};
						if (result == 'yes') then
							OnSaveMenuBtnSaveSlot(2);
							OnGameQuit();
						end
					else
						OnSaveMenuBtnSaveSlot(2);
						OnGameQuit();
					end
				end
		},
		Window
		{
			name="btn.saveslot.03.contents",
			x = savegame_btn_saveslot_03_params["x"],
			y = savegame_btn_saveslot_03_params["y"]-2,
			w = savegame_btn_saveslot_03_params["w"],
			h = savegame_btn_saveslot_03_params["h"],
			
			Text
			{
				name = "saveslot.03.id",
				font = MonopolyFont_20B_Grey1,
				x = btn_saveslot_export_txt_1_params["x"]-5,
				y = btn_saveslot_export_txt_1_params["y"]-5,
				w = btn_saveslot_export_txt_1_params["w"]+10,
				h = btn_saveslot_export_txt_1_params["h"]+10,
				flags = kHAlignCenter + kVAlignCenter,
				label = ""
			},
			Text
			{
				name = "saveslot.03.names",
				font = MonopolyFont_12B_Grey2,
				x = btn_saveslot_export_txt_player01_params["x"],
				y = btn_saveslot_export_txt_player01_params["y"],
				w = btn_saveslot_export_txt_player01_params["w"],
				h = (btn_saveslot_export_txt_player01_params["h"]*5)+3,
				flags = kHAlignLeft + kVAlignTop,
				label = ""
			},
			Text
			{
				name = "saveslot.03.time",
				font = MonopolyFont_14B_Grey2,
				x = btn_saveslot_export_txt_playtime_params["x"]-45,
				y = btn_saveslot_export_txt_playtime_params["y"],
				w = btn_saveslot_export_txt_playtime_params["w"]+50,
				h = btn_saveslot_export_txt_playtime_params["h"]+10,
				flags = kHAlignRight + kVAlignTop,
				label = ""
			},
			Text
			{
				name = "saveslot.03.saved",
				font = MonopolyFont_14B_Grey2,
				x = btn_saveslot_export_txt_savetime_params["x"]-5,
				y = btn_saveslot_export_txt_savetime_params["y"],
				w = btn_saveslot_export_txt_savetime_params["w"]+10,
				h = btn_saveslot_export_txt_savetime_params["h"]+10,
				flags = kHAlignRight + kVAlignTop,
				label = ""
			},
			MonopolyButton
			{
				name="btn.delete.03",
				graphics = savegame_btn_delete_01_params["graphics"],
				x = btn_saveslot_export_stats_copy_params["x"],
				y = btn_saveslot_export_stats_copy_params["y"],
				label ="",
				type = kPush,
				sfxEx = "eINTERFACE_OK",
				command=
					function()
						SetConfirmSlot(2);
						result = DisplayDialog
						{
							"scripts/savedeleteconfirm.lua"
						};
						if (result == 'yes') then
							OnSaveMenuButtonDelete(2);
						end
					end
			},
		},
		
		-- Save slot 4
		Bitmap
		{
			name="img.saveslot.04",
			image = "menu/btn_saveslot_04",
			x = loadgame_btn_saveslot_04_params["x"],
			y = loadgame_btn_saveslot_04_params["y"],
		},
		MonopolyButton
		{
			name="btn.saveslot.04",
			graphics = savegame_btn_saveslot_04_params["graphics"],
			x = savegame_btn_saveslot_04_params["x"],
			y = savegame_btn_saveslot_04_params["y"],
			label ="",
			type = kPush,
			sfxEx = "eINTERFACE_OK",
			command=
				function()
					SetConfirmSlot(3);
					if CheckForSaveSlotOverWrite(3) then
						result = DisplayDialog
						{
							"scripts/saveconfirm.lua"
						};
						if (result == 'yes') then
							OnSaveMenuBtnSaveSlot(3);
							OnGameQuit();
						end
					else
						OnSaveMenuBtnSaveSlot(3);
						OnGameQuit();
					end
				end
		},
		Window
		{
			name="btn.saveslot.04.contents",
			x = savegame_btn_saveslot_04_params["x"],
			y = savegame_btn_saveslot_04_params["y"]-2,
			w = savegame_btn_saveslot_04_params["w"],
			h = savegame_btn_saveslot_04_params["h"],
			
			Text
			{
				name = "saveslot.04.id",
				font = MonopolyFont_20B_Grey1,
				x = btn_saveslot_export_txt_1_params["x"]-5,
				y = btn_saveslot_export_txt_1_params["y"]-5,
				w = btn_saveslot_export_txt_1_params["w"]+10,
				h = btn_saveslot_export_txt_1_params["h"]+10,
				flags = kHAlignCenter + kVAlignCenter,
				label = ""
			},
			Text
			{
				name = "saveslot.04.names",
				font = MonopolyFont_12B_Grey2,
				x = btn_saveslot_export_txt_player01_params["x"],
				y = btn_saveslot_export_txt_player01_params["y"],
				w = btn_saveslot_export_txt_player01_params["w"],
				h = (btn_saveslot_export_txt_player01_params["h"]*5)+3,
				flags = kHAlignLeft + kVAlignTop,
				label = ""
			},
			Text
			{
				name = "saveslot.04.time",
				font = MonopolyFont_14B_Grey2,
				x = btn_saveslot_export_txt_playtime_params["x"]-45,
				y = btn_saveslot_export_txt_playtime_params["y"],
				w = btn_saveslot_export_txt_playtime_params["w"]+50,
				h = btn_saveslot_export_txt_playtime_params["h"]+10,
				flags = kHAlignRight + kVAlignTop,
				label = ""
			},
			Text
			{
				name = "saveslot.04.saved",
				font = MonopolyFont_14B_Grey2,
				x = btn_saveslot_export_txt_savetime_params["x"]-5,
				y = btn_saveslot_export_txt_savetime_params["y"],
				w = btn_saveslot_export_txt_savetime_params["w"]+10,
				h = btn_saveslot_export_txt_savetime_params["h"]+10,
				flags = kHAlignRight + kVAlignTop,
				label = ""
			},
			MonopolyButton
			{
				name="btn.delete.04",
				graphics = savegame_btn_delete_01_params["graphics"],
				x = btn_saveslot_export_stats_copy_params["x"],
				y = btn_saveslot_export_stats_copy_params["y"],
				label ="",
				type = kPush,
				sfxEx = "eINTERFACE_OK",
				command=
					function()
						SetConfirmSlot(3);
						result = DisplayDialog
						{
							"scripts/savedeleteconfirm.lua"
						};
						if (result == 'yes') then
							OnSaveMenuButtonDelete(3);
						end
					end
			},
		},

		
		-- Save slot 5
		Bitmap
		{
			name="img.saveslot.05",
			image = "menu/btn_saveslot_04",
			x = loadgame_btn_saveslot_05_params["x"],
			y = loadgame_btn_saveslot_05_params["y"],
		},
		MonopolyButton
		{
			name="btn.saveslot.05",
			graphics = savegame_btn_saveslot_05_params["graphics"],
			x = savegame_btn_saveslot_05_params["x"],
			y = savegame_btn_saveslot_05_params["y"],
			label ="",
			type = kPush,
			sfxEx = "eINTERFACE_OK",
			command=
				function()
					SetConfirmSlot(4);
					if CheckForSaveSlotOverWrite(4) then
						result = DisplayDialog
						{
							"scripts/saveconfirm.lua"
						};
						if (result == 'yes') then
							OnSaveMenuBtnSaveSlot(4);
							OnGameQuit();
						end
					else
						OnSaveMenuBtnSaveSlot(4);
						OnGameQuit();
					end
				end
		},
		Window
		{
			name="btn.saveslot.05.contents",
			x = savegame_btn_saveslot_05_params["x"],
			y = savegame_btn_saveslot_05_params["y"]-2,
			w = savegame_btn_saveslot_05_params["w"],
			h = savegame_btn_saveslot_05_params["h"],
			
			Text
			{
				name = "saveslot.05.id",
				font = MonopolyFont_20B_Grey1,
				x = btn_saveslot_export_txt_1_params["x"]-5,
				y = btn_saveslot_export_txt_1_params["y"]-5,
				w = btn_saveslot_export_txt_1_params["w"]+10,
				h = btn_saveslot_export_txt_1_params["h"]+10,
				flags = kHAlignCenter + kVAlignCenter,
				label = ""
			},
			Text
			{
				name = "saveslot.05.names",
				font = MonopolyFont_12B_Grey2,
				x = btn_saveslot_export_txt_player01_params["x"],
				y = btn_saveslot_export_txt_player01_params["y"],
				w = btn_saveslot_export_txt_player01_params["w"],
				h = (btn_saveslot_export_txt_player01_params["h"]*5)+3,
				flags = kHAlignLeft + kVAlignTop,
				label = ""
			},
			Text
			{
				name = "saveslot.05.time",
				font = MonopolyFont_14B_Grey2,
				x = btn_saveslot_export_txt_playtime_params["x"]-45,
				y = btn_saveslot_export_txt_playtime_params["y"],
				w = btn_saveslot_export_txt_playtime_params["w"]+50,
				h = btn_saveslot_export_txt_playtime_params["h"]+10,
				flags = kHAlignRight + kVAlignTop,
				label = ""
			},
			Text
			{
				name = "saveslot.05.saved",
				font = MonopolyFont_14B_Grey2,
				x = btn_saveslot_export_txt_savetime_params["x"]-5,
				y = btn_saveslot_export_txt_savetime_params["y"],
				w = btn_saveslot_export_txt_savetime_params["w"]+10,
				h = btn_saveslot_export_txt_savetime_params["h"]+10,
				flags = kHAlignRight + kVAlignTop,
				label = ""
			},
			MonopolyButton
			{
				name="btn.delete.05",
				graphics = savegame_btn_delete_01_params["graphics"],
				x = btn_saveslot_export_stats_copy_params["x"],
				y = btn_saveslot_export_stats_copy_params["y"],
				label ="",
				type = kPush,
				sfxEx = "eINTERFACE_OK",
				command=
					function()
						SetConfirmSlot(4);
						result = DisplayDialog
						{
							"scripts/savedeleteconfirm.lua"
						};
						if (result == 'yes') then
							OnSaveMenuButtonDelete(4);
						end
					end
			},
		},
		
		-- Cancel
		MonopolyButton
		{
			name="btn.cancel",
			graphics = savegame_btn_menu_savecancel_params["graphics"],
			x = savegame_btn_menu_savecancel_params["x"],
			y = savegame_btn_menu_savecancel_params["y"],
			label ="common.cancel.label",
			font = White12Font,
			type = kPush,
			sfxEx = "eINTERFACE_CANCEL",
			command=
				function()
					OnSaveMenuButtonCancel();
					SwapToModal("scripts/options_ingame.lua");
				end
		},
		-- Quit
		MonopolyButton
		{
			name="btn.quitnosave",
			graphics = savegame_btn_menu_savequit_params["graphics"],
			x = savegame_btn_menu_savequit_params["x"],
			y = savegame_btn_menu_savequit_params["y"],
			label ="common.quit.label",
			font = White12Font,
			type = kPush,
			sfxEx = "eINTERFACE_OK",
			command=
				function()
					OnSaveMenuButtonCancel();
					PopModal("scripts/options_ingame.lua");
					OnGameQuit();
				end
		},
	}
}
