require( "scripts/style.lua" );


local yes="yes" ;
local yesname="yes" ;
local no="no" ;	
local noname="no" ;	
local name="yesnobox";
local yesfunction=function()end; --using this default 'yesfunction' because gDialogTable.yes might be overwriten if another yesno dialog is pushed on top of this one (like clicking on 'exit to main menu' and then clicking on the window 'X' close button)
local nofunction=function()end;

if (gDialogTable.yeslabel) then
	yes = gDialogTable.yeslabel ;
end
if (gDialogTable.nolabel) then
	no = gDialogTable.nolabel ;
end
if (gDialogTable.yesname) then
	yesname = gDialogTable.yesname;
end
if (gDialogTable.noname) then
	noname = gDialogTable.noname;
end

if (gDialogTable.name) then
	name = gDialogTable.name;
end
if (gDialogTable.yes) then
	yesfunction = gDialogTable.yes;
end
if (gDialogTable.no) then
	nofunction = gDialogTable.no;
end


MakeDialog
{
	name=name, -- Remember, this is like saying table['name']=name, so it works.
    
    FaderWindow
	{
			wait=0,
			duration=100,
			fit = true,
			startalpha = 0,
			finalalpha = 1,
			skip = false,
    
		Bitmap
		{
			image="backgrounds/shade",
			alpha = 0.99,
		},
		
		Bitmap
		{
			image="backgrounds/dialog",
			x=306,
			y=226,

			SetStyle(DialogTitleText),
			Text
			{
				name = "yesnotitle",
				label= gDialogTable.title,
			};

			SetStyle(DialogBodyText),
			Text
			{
				name = "yesnobody",
				label= gDialogTable.body,
			},
			SetStyle(EmptyButtonStyle),
			Button
			{
				clickSound = "audio/sfx/buttons/default_click.ogg",
				command=yesfunction,
				label = "#<outline color=\"0c2263\" size='2'>"..GetString(yes).."</outline>",
				font = 
				{
					stdLegibleFont,
					30,
					WhiteColor,
				},
				graphics = 
				{
					"buttons/blueidle",
					"buttons/bluedown",
					"buttons/blueover",
				},
				name = yesname,
				close = true,
				x = 90,
				y = 210,
			},
			
			Button
			{
				clickSound = "audio/sfx/buttons/default_click.ogg",
				command=nofunction,
				label = "#<outline color=\"be5b1d\" size='2'>"..GetString(no).."</outline>",
				font = 
				{
					stdLegibleFont,
					30,
					WhiteColor,
				},
				graphics = 
				{
					"buttons/removeidle",
					"buttons/removedown",
					"buttons/removeover",
				},
				name = noname,
				close = true,
				x = 240,
				y = 210,
			}
		},
	},
	
} -- MakeDialog
PlayPopupSound();
