require( "scripts/style.lua" );

gCurScreen = 0;

SetState("StoryModeSessionTime",0);
SetState("MainMenuScreenTime",0);
SetState("ComicScreenTime",0);
SetState("MetaMapTime",0);
SetState("HelpScreenTime",1);

function SetScreen( screen )

	if screen == 1 then
		EnableWindow("helpwindow1",true);
		EnableWindow("helpwindow2",false);
		EnableWindow("helpwindow3",false);
		EnableWindow("helpwindow4",false);
		EnableWindow("helpwindow5",false);
	elseif screen == 2 then
		EnableWindow("helpwindow1",false);
		EnableWindow("helpwindow2",true);
		EnableWindow("helpwindow3",false);
		EnableWindow("helpwindow4",false);
		EnableWindow("helpwindow5",false);
	elseif screen == 3 then
		EnableWindow("helpwindow1",false);
		EnableWindow("helpwindow2",false);
		EnableWindow("helpwindow3",true);
		EnableWindow("helpwindow4",false);
		EnableWindow("helpwindow5",false);
	elseif screen == 4 then
		EnableWindow("helpwindow1",false);
		EnableWindow("helpwindow2",false);
		EnableWindow("helpwindow3",false);
		EnableWindow("helpwindow4",true);
		EnableWindow("helpwindow5",false);
	elseif screen == 5 then
		EnableWindow("helpwindow1",false);
		EnableWindow("helpwindow2",false);
		EnableWindow("helpwindow3",false);
		EnableWindow("helpwindow4",false);
		EnableWindow("helpwindow5",true);
	end

	gCurScreen = screen ;
end


vHelp_PrevButtonGraphics=
{
	"buttons/btn_a_normal.png",
	"buttons/btn_a_down.png",
	"buttons/btn_a_over.png",
}
vHelp_NextButtonGraphics=
{
	"buttons/btn_a_normal.png",
	"buttons/btn_a_down.png",
	"buttons/btn_a_over.png",
}
vHelp_DoneButtonGraphics=
{
	"buttons/btn_a_normal.png",
	"buttons/btn_a_down.png",
	"buttons/btn_a_over.png",
}
vHelp_BackButtonGraphics=
{
	"buttons/btn_a_normal.png",
	"buttons/btn_a_down.png",
	"buttons/btn_a_over.png",
}

TextStyleTitle=
{
	parent	= DialogBodyText,
	font 	= { standardFont,
				24,
				BlackColor 
			  },
	flags	= kHAlignCenter + kVAlignCenter,
};

vHelpButtonFontStyle = { standardFont, 16, BlackColor };
vPageNumberFont      = { standardFont, 20, BlackColor };

TextStyle=
{
	parent	= DialogBodyText,
	font 	= { standardFont,
				17,
				BlackColor 
			  },
	flags	= kHAlignCenter + kVAlignCenter,
};

vBottomButtonMargin 	= 15;
vRightLeftButtonMargin 	= 200;

TextStyleTitle2=
{
	parent	= DialogBodyText,
	font 	= { standardFont,
				48,
				BlackColor 
			  },
	flags	= kHAlignCenter + kVAlignCenter,
};

MakeDialog
{
	-- Name the modal dialog
	name="help",
	Bitmap
	{
		image	= "backgrounds/fullscreendialog",
		x		= kCenter,
		y		= kCenter,

		-- Help screen 1 --
		
		-- It's the same music like "Comic" screen, so we reuse the Window type here
		
		Window
		{
			name	= "helpwindow1",
			w		= kMax,
			h		= kMax,

			Bitmap
			{
				image	= "help/helpscreen1",
				x		= kCenter - 30,
				y		= kCenter,
			},
			SetStyle(TextStyleTitle2),
			Text
			{
				x		= kCenter,
				y		=  25,
				w		= 220,
				h		=  70,
				label	= "help",
			},
			
			SetStyle(TextStyleTitle),
			Text
			{
				x		= 510,
				y		=  100,
				w		= 220,
				h		=  40,
				label	= "help1_title_top",
			},
			Text
			{
				x		= 60,
				y		= 330,
				w		= 220,
				h		=  40,
				label	= "help1_title_bottom",
			},
			SetStyle(TextStyle),
			Text
			{
				x		=  65,
				y		=  80,
				w		= 190,
				h		= 122,
				label	= "help1_1",
			},
			Text
			{
				x		= 260,
				y		=  75,
				w		= 208,
				h		=  89,
				label	= "help1_2a",
			},
			Text
			{
				x		= 340,
				y		= 140,
				w		= 123,
				h		=  71,
				label	= "help1_2b",
			},
			Text
			{
				x		= 492,
				y		=  130,
				w		= 238,
				h		=  81,
				label	= "help1_3",
			},
			Text
			{
				x		=  38+30,
				y		= 340,
				w		= 158+30,
				h		= 130,
				label	= "help1_4",
				flags	= kHAlignLeft + kVAlignCenter,
			},
			Text
			{
				x		= 310,
				y		= 330,
				w		= 169,
				h		=  65,
				label	= "help1_5",
				flags	= kHAlignLeft + kVAlignCenter,
			},
			Text
			{
				x		= 581-30,
				y		= 350,
				w		= 158+30,
				h		= 103,
				label	= "help1_6",
				flags	= kHAlignLeft + kVAlignCenter,
			},
			Text
			{
				x		= kCenter,
				y		= 600-55,
				w		= 100,
				h		= 60,
				font	= vPageNumberFont,
				label	= "help_page_number_1",
				flags	= kHAlignCenter + kVAlignCenter,
			},
			SetStyle(ButtonStyle),
			Button
			{
				label	= "back",
				align	= kHAlignLeft+kVAlignBottom,
				x		= vRightLeftButtonMargin,
				y		= kMax-vBottomButtonMargin,
				graphics= vHelp_BackButtonGraphics,
				font	= vHelpButtonFontStyle,
				command	= function() 
							SendGameMessage("end_help");
							CloseWindow(); 
						  end;
			},
			Button
			{
				label	= "next",
				align	= kHAlignRight+kVAlignBottom,
				x		= kMax-vRightLeftButtonMargin,
				y		= kMax-vBottomButtonMargin,
				graphics= vHelp_NextButtonGraphics,
				font	= vHelpButtonFontStyle,
				hflip   = true,
				command	= function() 
							SetScreen( gCurScreen+1 ); 
						  end;
			},
		},
		
		
		-- Help screen 2 --
		Window
		{
			name	= "helpwindow2",
			w		= kMax,
			h		= kMax,

			Bitmap
			{
				image	= "help/helpscreen2",
				x		= kCenter - 30,
				y		= kCenter,
			},
			
			SetStyle(TextStyleTitle2),
			Text
			{
				x		= kCenter,
				y		=  25,
				w		= 220,
				h		=  70,
				label	= "help",
			},
			
			
			SetStyle(TextStyleTitle),
			Text
			{
				x		= 200,
				y		=  95,
				w		= 400,
				h		=  40,
				label	= "help2_title_top",
				flags	= kHAlignCenter + kVAlignCenter,
			},
			SetStyle(TextStyle),
			Text
			{
				x		= 100+20,
				y		= 135,
				w		= 300,
				h		=  90,
				label	= "help2_1",
				flags	= kHAlignLeft + kVAlignTop,
			},
			SetStyle(TextStyle),
			Text
			{
				x		= 560-80,
				y		= 135,
				w		= 181+50,
				h		=  96,
				label	= "help2_2",
				flags	= kHAlignLeft + kVAlignTop,
			},
			SetStyle(TextStyle),
			Text
			{
				x		= 120,
				y		= 340-50,
				w		= 180+20,
				h		=  98,
				label	= "help2_3",
				flags	= kHAlignLeft + kVAlignBottom,
			},
			
			SetStyle(TextStyle),
			Text
			{
				x		= 450,
				y		= 290,
				w		= 250,
				h		=  98,
				label	= "help2_4",
				flags	= kHAlignLeft + kVAlignBottom,
			},
			Text
			{
				x		= kCenter,
				y		= 600-55,
				w		= 100,
				h		= 60,
				font	= vPageNumberFont,
				label	= "help_page_number_2",
				flags	= kHAlignCenter + kVAlignCenter,
			},
			SetStyle(ButtonStyle),
			Button
			{
				label	= "prev",
				align	= kHAlignLeft+kVAlignBottom,
				x		= vRightLeftButtonMargin,
				y		= kMax-vBottomButtonMargin,
				graphics= vHelp_PrevButtonGraphics,
				font	= vHelpButtonFontStyle,
				command =function() 
							SetScreen( gCurScreen-1 ); 
						  end;
			},
			Button
			{
				label	= "next",
				align	= kHAlignRight+kVAlignBottom,
				x		= kMax-vRightLeftButtonMargin,
				y		= kMax-vBottomButtonMargin,
				graphics= vHelp_NextButtonGraphics,
				font	= vHelpButtonFontStyle,
				hflip   = true,
				command	= function() 
							SetScreen( gCurScreen+1 ); 
						  end;
			},
		},
		-- Help screen 3 --
		Window
		{
			name	= "helpwindow3",
			w		= kMax,
			h		= kMax,

			Bitmap
			{
				image	= "help/helpscreen3",
				x		= kCenter,
				y		= kCenter,
			},
			
			SetStyle(TextStyleTitle2),
			Text
			{
				x		= kCenter,
				y		=  25,
				w		= 220,
				h		=  70,
				label	= "help",
			},
			
			
			SetStyle(TextStyleTitle),
			Text
			{
				x		= 170-20,
				y		=  90,
				w		= 560,
				h		=  40,
				label	= "help3_title_top_right",
				flags	= kHAlignRight + kVAlignCenter,
			},
			Text
			{
				x		=  50+40,
				y		=  90,
				w		= 190,
				h		=  40,
				label	= "help3_title_top_left",
				flags	= kHAlignLeft + kVAlignCenter,
			},
			Text
			{
				x		= 200,
				y		= 326-10,
				w		= 274,
				h		=  40,
				label	= "help3_title_bottom_right",
				flags	= kHAlignRight + kVAlignCenter,
			},
			Text
			{
				x		=  80,
				y		= 326-10,
				w		= 274,
				h		=  40,
				label	= "help3_title_bottom_left",
				flags	= kHAlignLeft + kVAlignCenter,
			},
			
			Text
			{
				x		= 420,
				y		= 326-10,
				w		= 274,
				h		=  40,
				label	= "help3_title_bottom_right2",
				flags	= kHAlignRight + kVAlignCenter,
			},
			
			
			SetStyle(TextStyle),
			Text
			{
				x		=  54+2,
				y		=  125,
				w		= 202+30,
				h		=  86,
				label	= "help3_1",
			},
			Text
			{
				x		= 375-30,
				y		=  125,
				w		= 400-30,
				h		=  78,
				label	= "help3_2",
			},
			Text
			{
				x		= 55,
				y		= 340,
				w		= 150,
				h		=  97,
				label	= "help3_3",
			},
			Text
			{
				x		= 210,
				y		= 330,
				w		= 300,
				h		= 125,
				label	= "help3_4",
			},
			
			Text
			{
				x		= 530,
				y		= 330,
				w		= 200,
				h		= 125,
				label	= "help3_5",
			},
			
			
			Text
			{
				x		= kCenter,
				y		= 600-55,
				w		= 100,
				h		= 60,
				font	= vPageNumberFont,
				label	= "help_page_number_3",
				flags	= kHAlignCenter + kVAlignCenter,
			},
			SetStyle(ButtonStyle),
			Button
			{
				label	= "prev",
				align	= kHAlignLeft+kVAlignBottom,
				x		= vRightLeftButtonMargin,
				y		= kMax-vBottomButtonMargin,
				graphics= vHelp_PrevButtonGraphics,
				font	= vHelpButtonFontStyle,
				command =function() 
							SetScreen( gCurScreen-1 ); 
						  end;
			},
			Button
			{
				label	= "next",
				align	= kHAlignRight+kVAlignBottom,
				x		= kMax-vRightLeftButtonMargin,
				y		= kMax-vBottomButtonMargin,
				graphics= vHelp_NextButtonGraphics,
				font	= vHelpButtonFontStyle,
				hflip   = true,
				command	= function() 
							SetScreen( gCurScreen+1 ); 
						  end;
			},
		},
		-- Help screen 4 --
		Window
		{
			name	= "helpwindow4",
			w		= kMax,
			h		= kMax,

			Bitmap
			{
				image	= "help/helpscreen4",
				x		= kCenter,
				y		= kCenter,
			},
			
			SetStyle(TextStyleTitle2),
			Text
			{
				x		= kCenter,
				y		=  25,
				w		= 220,
				h		=  70,
				label	= "help",
			},
			
			
			SetStyle(TextStyleTitle),
			Text
			{
				x		= 270,
				y		=  90,
				w		= 275,
				h		=  40,
				label	= "help4_title_top",
			},
			SetStyle(TextStyle),
			Text
			{
				x		=  60,
				y		=  110,
				w		= 172,
				h		=  95,
				label	= "help4_1",
			},
			Text
			{
				x		= 240,
				y		=  110,
				w		= 172,
				h		=  95,
				label	= "help4_2",
			},
			Text
			{
				x		= 390,
				y		=  110,
				w		= 172,
				h		=  95,
				label	= "help4_3",
			},
			Text
			{
				x		= 550,
				y		=  110,
				w		= 172,
				h		=  95,
				label	= "help4_4",
			},		
			Text
			{
				x		=  60,
				y		= 330,
				w		= 172,
				h		=  95,
				label	= "help4_5",
			},
			Text
			{
				x		= 240,
				y		= 330,
				w		= 172,
				h		=  95,
				label	= "help4_6",
			},
			Text
			{
				x		= 390,
				y		= 330,
				w		= 172,
				h		=  95,
				label	= "help4_7",
			},
			Text
			{
				x		= 550,
				y		= 330,
				w		= 172,
				h		=  95,
				label	= "help4_8",
			},
			
			Text
			{
				x		= kCenter,
				y		= 600-55,
				w		= 100,
				h		= 60,
				font	= vPageNumberFont,
				label	= "help_page_number_4",
				flags	= kHAlignCenter + kVAlignCenter,
			},
			SetStyle(ButtonStyle),
			Button
			{
				label	= "prev",
				align	= kHAlignLeft+kVAlignBottom,
				x		= vRightLeftButtonMargin,
				y		= kMax-vBottomButtonMargin,
				graphics= vHelp_PrevButtonGraphics,
				font	= vHelpButtonFontStyle,
				command =function() 
							SetScreen( gCurScreen-1 ); 
						  end;
			},
			Button
			{
				label	= "next",
				align	= kHAlignRight+kVAlignBottom,
				x		= kMax-vRightLeftButtonMargin,
				y		= kMax-vBottomButtonMargin,
				graphics= vHelp_NextButtonGraphics,
				font	= vHelpButtonFontStyle,
				hflip   = true,
				command	= function() 
							SetScreen( gCurScreen+1 ); 
						  end;
			},
		},
		
		-- Help screen 5--
		Window
		{
			name	= "helpwindow5",
			w		= kMax,
			h		= kMax,

			Bitmap
			{
				image	= "help/helpscreen5",
				x		= kCenter,
				y		= kCenter,
			},
			
			SetStyle(TextStyleTitle2),
			Text
			{
				x		= kCenter,
				y		=  25,
				w		= 220,
				h		=  70,
				label	= "help",
			},
			
			SetStyle(TextStyleTitle),
			Text
			{
				x		= 270,
				y		=  90,
				w		= 275,
				h		=  40,
				label	= "help4_title_top",
			},
			
			SetStyle(TextStyle),
			Text
			{
				x		=  60,
				y		=  120,
				w		= 172,
				h		=  95,
				label	= "help5_1",
			},
			Text
			{
				x		=  312,
				y		=  120,
				w		= 172,
				h		=  95,
				label	= "help5_2",
			},
			Text
			{
				x		= 560,
				y		=  120,
				w		= 172,
				h		=  95,
				label	= "help5_3",
			},
			Text
			{
				x		= 190,
				y		= 330,
				w		= 172,
				h		=  95,
				label	= "help5_4",
			},
			Text
			{
				x		= 440,
				y		= 330,
				w		= 172,
				h		=  95,
				label	= "help5_5",
			},
			
			
			Text
			{
				x		= kCenter,
				y		= 600-55,
				w		= 100,
				h		= 60,
				font	= vPageNumberFont,
				label	= "help_page_number_5",
				flags	= kHAlignCenter + kVAlignCenter,
			},
			SetStyle(ButtonStyle),
			Button
			{
				label	= "prev",
				align	= kHAlignLeft+kVAlignBottom,
				x		= vRightLeftButtonMargin,
				y		= kMax-vBottomButtonMargin,
				graphics= vHelp_PrevButtonGraphics,
				font	= vHelpButtonFontStyle,
				command =function() 
							SetScreen( gCurScreen-1 ); 
						  end;
			},
			Button
			{
				label	= "done",
				align	= kHAlignRight+kVAlignBottom,
				x		= kMax-vRightLeftButtonMargin,
				y		= kMax-vBottomButtonMargin,
				graphics= vHelp_DoneButtonGraphics,
				font	= vHelpButtonFontStyle,
				hflip   = true,
				command	= function() 
							SendGameMessage("end_help");
							CloseWindow(); 
						  end;
			},
		},
	}
}

SetScreen(1);
