require( "scripts/style.lua" );


kImageY = 5;
kButtonX = 40;
kButtonY = 70;
kButtonSpacing = 50;
kTextX = 0;

kHeaderY = 30;
kLevelX = 10;
kLevelWidth = 100;
kRatingX = 135;
kRatingWidth = 350;
kStatusX = 525;
kStatusWidth = 100;

HeaderFont = {
	standardFont,
	24,
	DarkGreenColor
};

TitleFont = {
	standardFont,
	36,
	BlackColor
};
EntryFont = {
	proportionalFont,
	16,
	BlackColor
};

SlotButtonGraphics = {
	"",
	"map/secret_levels_highlight_window",
	"map/secret_levels_highlight_window"
};


function GameSlot(n)
	return Group {

			
		Button
		{
			name = 'gamebutton_'..n,
			x = kButtonX, y = kButtonY+kButtonSpacing*(n-1),
			graphics=SlotButtonGraphics,
			
		
		
			Text
			{
				font = EntryFont,
				name = 'leveltext_'..n,
				x= kLevelX, y = 5,
				w=kLevelWidth, h=kMax,
				flags=kHAlignLeft+kVAlignTop,
				label= '',
				padding = 0,
			},
			
			Text
			{
				font = EntryFont,
				name = 'descriptiontext_'..n,
				x= kRatingX, y = 5,
				w=kRatingWidth, h=kMax,
				flags=kHAlignLeft+kVAlignTop,
				label= '',
				padding = 0,
			},
			
			Text
			{
				font = EntryFont,
				name = 'statustext_'..n,
				x= kStatusX, y = 5,
				w=kStatusWidth, h=kMax,
				flags=kHAlignLeft+kVAlignTop,
				label= '',
				padding = 0,
			},
			command=
				function()
					if (not IsButtonLocked(n-1)) then
						SetTopModalOnly(false);
						SetLevelMode(1);
						SetCurrentRestaurant(0);
						SetCurrentLevel(0);
						SetCurrentGameMode(0);
						SetDownloadLevelName(GetFullLevelName(n-1));
						SetDownloadLevelDescription(GetDescription(n-1));
						SetLevelInfoToDownloadLevel();
						ReleaseMapAssets();
						PopModal();
						PopModal();
						SwapToModalSetName("scripts/game.lua");
					end
				end
		},
	}
end

function GameSlots()
	t= {}
	for i = 1,5 do
		table.insert(t,GameSlot(i))
	end
	return Group(t)
end




MakeDialog
{
	Bitmap
	{
		name="backgroundimage",
		image="backgrounds/fullscreendialog",
		x=0,y=0,w=kMax,h=kMax,

		Text
		{
			font = TitleFont,
			label="lockedlevels",
			x=kCenter,
			y=20,
			w=kMax,
			h=50,
			flags = kHAlignCenter + kVAlignTop,
			padding = 0
		},

		
		Bitmap
		{
			image="map/secret_levels_window",
			x = kCenter, y =kCenter,
			
			Text
			{
				font = HeaderFont,
				label="contentlevel",
				x=kLevelX+kButtonX,
				y=kHeaderY,
				w=kLevelWidth,
				h=25,
				flags = kHAlignLeft + kVAlignTop,
				padding = 0
			},
			
			Text
			{
				font = HeaderFont,
				label="contentdescription",
				x=kRatingX+kButtonX,
				y=kHeaderY,
				w=kRatingWidth,
				h=25,
				flags = kHAlignCenter + kVAlignTop,
				padding = 0
			},
			
			Text
			{
				font = HeaderFont,
				label="contentstatus",
				x=kStatusX+kButtonX,
				y=kHeaderY,
				w=kStatusWidth,
				h=25,
				flags = kHAlignLeft + kVAlignTop,
				padding = 0
			},
			LockedLevels
			{
				x = 0, y = 0, w=kMax, h=kMax,
				GameSlots();
			};
		};
		
			
		
		SetStyle(StandardButtonStyle);
		Button
		{
			x=kCenter,
			y=520,
			name="back",
			label="back",
			command=
				function()
					SetTopModalOnly(false);
					PopModal();
				end
		},
		SetStyle(DefaultStyle);
		
			
	},
	
};

SetTopModalOnly(true);