require( "scripts/style.lua" );

ScreenColor = Color(255,255,255,255);

MetricsMode(9);

HeaderFont = {
  standardFont,
  70,
  Color(0,0,0,100)
};

timeX = 8
timeY = 12

GameModeFont = {
  standardFont,
  45,
  ScreenColor
};

TableInfoFont = {
  standardFont,
  25,
  ScreenColor
};

ConnectingToServerFont = {
	standardFont,
	18,
	ScreenColor
};

TableHeaderFont = {
  standardFont,
  30,
  ScreenColor
};

ScoreInfoFont = {
  standardFont,
  18,
  ScreenColor
};


ScoreFont = {
  standardFont,
  24,
  ScreenColor
};

RankFont = {
  standardFont,
  26,
  ScreenColor
};

ChangeViewFont = {
  standardFont,
  20,
  BlackColor
};

LeftButtonGraphics = {
	"buttons/arrowleft_up.png",
	"buttons/arrowleft_down.png",
	"buttons/arrowleft_over.png"
};

RightButtonGraphics = {
	"buttons/arrowright_up.png",
	"buttons/arrowright_down.png",
	"buttons/arrowright_over.png"
};

BlueLeftButtonGraphics = {
	"buttons/bluearrowleft_up.png",
	"buttons/bluearrowleft_down.png",
	"buttons/bluearrowleft_over.png"
};

BlueRightButtonGraphics = {
	"buttons/bluearrowright_up.png",
	"buttons/bluearrowright_down.png",
	"buttons/bluearrowright_over.png"
};

BlueUpButtonGraphics = {
	"buttons/bluearrowup_up.png",
	"buttons/bluearrowup_down.png",
	"buttons/bluearrowup_over.png"
};

BlueDownButtonGraphics = {
	"buttons/bluearrowdown_up.png",
	"buttons/bluearrowdown_down.png",
	"buttons/bluearrowdown_over.png"
};

ChangeViewButtonGraphics = {
	"buttons/long_button_up.png",
	"buttons/long_button_down.png",
	"buttons/long_button_over.png"
};


kScoreRowSpace = 21;
kRowY = 80; -- was 95
kNumberX = 30;
kNameX = 47;
kScoreX = 330;
kP1X = kNumberX + 1;
kHiX = 0;
kHiY = kRowY-3;

MakeDialog
{
	
	Bitmap
	{ 
	x = 0,
				y = 0,
		name="hiscorescreen",
		image="backgrounds/fullscreendialog",
		
		HiscoreWindow
		{
			x=0,y=0,h=kMax,w=kMax,
			
			Text
			{
				font = HeaderFont,
				name = "header",
				x=0,y=10,w=kMax,h=kMax,
				flags = kHAlignCenter + kVAlignTop,
				label = "highscoreheader"
			};
			
			Text
			{
				font = GameModeFont,
				name = "gamemode",
				x=0,y=85,w=kMax,h=kMax,
				flags = kHAlignCenter + kVAlignTop,
				label = "GAMEMODE"
			};
			
			Bitmap
			{
				x = 95,
				y = 150,
				image="hiscore/global-hs-bb_large.png",	
				name="leftpanel",
				
				Text
				{
					font = TableHeaderFont,
					name = "local",
					x=0,y=20,w=396-40,h=kMax,
					flags = kHAlignCenter + kVAlignTop,
					label = "localhighscores"
				};
				
				
				Text
				{
					font = TableHeaderFont,
					name = "global",
					x=0,y=20,w=396-40,h=kMax,
					flags = kHAlignCenter + kVAlignTop,
					label = "globalhighscores"
				};
				
				Text
				{
					font = TableHeaderFont,
					name = "topplayers",
					x=0,y=30,w=kMax-20,h=kMax,
					flags = kHAlignCenter + kVAlignTop,
					label = "topplayers"
				};
				
				Bitmap
				{
					image = "hiscore/hi.jpg",
					name = "hi1",
					x=kHiX,y=kHiY
				};
				
				Text
				{
					font = ScoreFont,
					name = "1",
					x=0,y=kRowY,w=kNumberX,h=kMax,
					flags = kHAlignRight + kVAlignTop,
					label = "1."
				};
				
				Bitmap
				{
					image = "hiscore/p1icon.png",
					name = "pimage1",
					x=kP1X,y=kRowY
				};
				
				Text
				{
					font = ScoreFont,
					name = "name1",
					x=kNameX,y=kRowY,w=kMax,h=kMax,
					flags = kHAlignLeft + kVAlignTop,
					label = "name"
				};
				
				Text
				{
					font = ScoreFont,
					name = "score1",
					x=0,y=kRowY,w=kScoreX,h=kMax,
					flags = kHAlignRight + kVAlignTop,
					label = "12345"
				};
					
				Bitmap
				{
					image = "hiscore/hi.jpg",
					name = "hi2",
					x=kHiX,y=kHiY+(1*kScoreRowSpace)
				};
				
				Text
				{
					font = ScoreFont,
					name = "2",
					x=0,y=kRowY+(1*kScoreRowSpace),w=kNumberX,h=kMax,
					flags = kHAlignRight + kVAlignTop,
					label = "2."
				};
						
				Bitmap
				{
					image = "hiscore/p1icon.png",
					name = "pimage2",
					x=kP1X,y=kRowY+(1*kScoreRowSpace)
				};
					
				Text
				{
					font = ScoreFont,
					name = "name2",
					x=kNameX,y=kRowY+(1*kScoreRowSpace),w=kMax,h=kMax,
					flags = kHAlignLeft + kVAlignTop,
					label = "name"
				};
				
				Text
				{
					font = ScoreFont,
					name = "score2",
					x=0,y=kRowY+(1*kScoreRowSpace),w=kScoreX,h=kMax,
					flags = kHAlignRight + kVAlignTop,
					label = "12345"
				};
				
				Bitmap
				{
					image = "hiscore/hi.jpg",
					name = "hi3",
					x=kHiX,y=kHiY+(2*kScoreRowSpace)
				};				
				
				Text
				{
					font = ScoreFont,
					name = "3",
					x=0,y=kRowY+(2*kScoreRowSpace),w=kNumberX,h=kMax,
					flags = kHAlignRight + kVAlignTop,
					label = "3."
				};
				
				Bitmap
				{
					image = "hiscore/p1icon.png",
					name = "pimage3",
					x=kP1X,y=kRowY+(2*kScoreRowSpace)
				};
				
				Text
				{
					font = ScoreFont,
					name = "name3",
					x=kNameX,y=kRowY+(2*kScoreRowSpace),w=kMax,h=kMax,
					flags = kHAlignLeft + kVAlignTop,
					label = "name"
				};
				
				Text
				{
					font = ScoreFont,
					name = "score3",
					x=0,y=kRowY+(2*kScoreRowSpace),w=kScoreX,h=kMax,
					flags = kHAlignRight + kVAlignTop,
					label = "12345"
				};
				
				Bitmap
				{
					image = "hiscore/hi.jpg",
					name = "hi4",
					x=kHiX,y=kHiY+(3*kScoreRowSpace)
				};				
				
				Text
				{
					font = ScoreFont,
					name = "4",
					x=0,y=kRowY+(3*kScoreRowSpace),w=kNumberX,h=kMax,
					flags = kHAlignRight + kVAlignTop,
					label = "4."
				};
				
				Bitmap
				{
					image = "hiscore/p1icon.png",
					name = "pimage4",
					x=kP1X,y=kRowY+(3*kScoreRowSpace)
				};
				
				Text
				{
					font = ScoreFont,
					name = "name4",
					x=kNameX,y=kRowY+(3*kScoreRowSpace),w=kMax,h=kMax,
					flags = kHAlignLeft + kVAlignTop,
					label = "name"
				};
				
				Text
				{
					font = ScoreFont,
					name = "score4",
					x=0,y=kRowY+(3*kScoreRowSpace),w=kScoreX,h=kMax,
					flags = kHAlignRight + kVAlignTop,
					label = "12345"
				};
				
				Bitmap
				{
					image = "hiscore/hi.jpg",
					name = "hi5",
					x=kHiX,y=kHiY+(4*kScoreRowSpace)
				};
					
				Text
				{
					font = ScoreFont,
					name = "5",
					x=0,y=kRowY+(4*kScoreRowSpace),w=kNumberX,h=kMax,
					flags = kHAlignRight + kVAlignTop,
					label = "5."
				};
				
				Bitmap
				{
					image = "hiscore/p1icon.png",
					name = "pimage5",
					x=kP1X,y=kRowY+(4*kScoreRowSpace)
				};
							
				Text
				{
					font = ScoreFont,
					name = "name5",
					x=kNameX,y=kRowY+(4*kScoreRowSpace),w=kMax,h=kMax,
					flags = kHAlignLeft + kVAlignTop,
					label = "name"
				};
				
				Text
				{
					font = ScoreFont,
					name = "score5",
					x=0,y=kRowY+(4*kScoreRowSpace),w=kScoreX,h=kMax,
					flags = kHAlignRight + kVAlignTop,
					label = "12345"
				};
				
				Bitmap
				{
					image = "hiscore/hi.jpg",
					name = "hi6",
					x=kHiX,y=kHiY+(5*kScoreRowSpace)
				};
					
				Text
				{
					font = ScoreFont,
					name = "6",
					x=0,y=kRowY+(5*kScoreRowSpace),w=kNumberX,h=kMax,
					flags = kHAlignRight + kVAlignTop,
					label = "6."
				};
					
				Bitmap
				{
					image = "hiscore/p1icon.png",
					name = "pimage6",
					x=kP1X,y=kRowY+(5*kScoreRowSpace)
				};
						
				Text
				{
					font = ScoreFont,
					name = "name6",
					x=kNameX,y=kRowY+(5*kScoreRowSpace),w=kMax,h=kMax,
					flags = kHAlignLeft + kVAlignTop,
					label = "name"
				};
				
				Text
				{
					font = ScoreFont,
					name = "score6",
					x=0,y=kRowY+(5*kScoreRowSpace),w=kScoreX,h=kMax,
					flags = kHAlignRight + kVAlignTop,
					label = "12345"
				};
				
				Bitmap
				{
					image = "hiscore/hi.jpg",
					name = "hi7",
					x=kHiX,y=kHiY+(6*kScoreRowSpace)
				};
				
				Text
				{
					font = ScoreFont,
					name = "7",
					x=0,y=kRowY+(6*kScoreRowSpace),w=kNumberX,h=kMax,
					flags = kHAlignRight + kVAlignTop,
					label = "7."
				};
				
				Bitmap
				{
					image = "hiscore/p1icon.png",
					name = "pimage7",
					x=kP1X,y=kRowY+(6*kScoreRowSpace)
				};

				Text
				{
					font = ScoreFont,
					name = "name7",
					x=kNameX,y=kRowY+(6*kScoreRowSpace),w=kMax,h=kMax,
					flags = kHAlignLeft + kVAlignTop,
					label = "name"
				};
				
				Text
				{
					font = ScoreFont,
					name = "score7",
					x=0,y=kRowY+(6*kScoreRowSpace),w=kScoreX,h=kMax,
					flags = kHAlignRight + kVAlignTop,
					label = "12345"
				};
				
				Bitmap
				{
					image = "hiscore/hi.jpg",
					name = "hi8",
					x=kHiX,y=kHiY+(7*kScoreRowSpace)
				};
					
				Text
				{
					font = ScoreFont,
					name = "8",
					x=0,y=kRowY+(7*kScoreRowSpace),w=kNumberX,h=kMax,
					flags = kHAlignRight + kVAlignTop,
					label = "8."
				};
				
				Bitmap
				{
					image = "hiscore/p1icon.png",
					name = "pimage8",
					x=kP1X,y=kRowY+(7*kScoreRowSpace)
				};
							
				Text
				{
					font = ScoreFont,
					name = "name8",
					x=kNameX,y=kRowY+(7*kScoreRowSpace),w=kMax,h=kMax,
					flags = kHAlignLeft + kVAlignTop,
					label = "name"
				};
				
				Text
				{
					font = ScoreFont,
					name = "score8",
					x=0,y=kRowY+(7*kScoreRowSpace),w=kScoreX,h=kMax,
					flags = kHAlignRight + kVAlignTop,
					label = "12345"
				};
				
				Bitmap
				{
					image = "hiscore/hi.jpg",
					name = "hi9",
					x=kHiX,y=kHiY+(8*kScoreRowSpace)
				};
					
				Text
				{
					font = ScoreFont,
					name = "9",
					x=0,y=kRowY+(8*kScoreRowSpace),w=kNumberX,h=kMax,
					flags = kHAlignRight + kVAlignTop,
					label = "9."
				};
				
				Bitmap
				{
					image = "hiscore/p1icon.png",
					name = "pimage9",
					x=kP1X,y=kRowY+(8*kScoreRowSpace)
				};
							
				Text
				{
					font = ScoreFont,
					name = "name9",
					x=kNameX,y=kRowY+(8*kScoreRowSpace),w=kMax,h=kMax,
					flags = kHAlignLeft + kVAlignTop,
					label = "name"
				};
				
				Text
				{
					font = ScoreFont,
					name = "score9",
					x=0,y=kRowY+(8*kScoreRowSpace),w=kScoreX,h=kMax,
					flags = kHAlignRight + kVAlignTop,
					label = "12345"
				};
				
				Bitmap
				{
					image = "hiscore/hi.jpg",
					name = "hi10",
					x=kHiX,y=kHiY+(9*kScoreRowSpace)
				};				
				
				Text
				{
					font = ScoreFont,
					name = "10",
					x=0,y=kRowY+(9*kScoreRowSpace),w=kNumberX,h=kMax,
					flags = kHAlignRight + kVAlignTop,
					label = "10."
				};
				
				Bitmap
				{
					image = "hiscore/p1icon.png",
					name = "pimage10",
					x=kP1X,y=kRowY+(9*kScoreRowSpace)
				};
				
				Text
				{
					font = ScoreFont,
					name = "name10",
					x=kNameX,y=kRowY+(9*kScoreRowSpace),w=kMax,h=kMax,
					flags = kHAlignLeft + kVAlignTop,
					label = "name"
				};
				
				Text
				{
					font = ScoreFont,
					name = "score10",
					x=0,y=kRowY+(9*kScoreRowSpace),w=kScoreX,h=kMax,
					flags = kHAlignRight + kVAlignTop,
					label = "12345"
				};
				
			};
			
			Bitmap
			{
				x = 470,
				y = 150,
				image="hiscore/global-hs-bb_small.png",	
				name="rightpanelsmall",
				
				Text
				{
					font = ScoreInfoFont,
					name = "yourrankglobalinfo",
					x=38,y=55,w=kMax-30,h=kMax,
					flags = kHAlignCenter + kVAlignTop,
					label = "globalhighscoreinfo"
				};
				
				Text
				{
					font = RankFont,
					name = "yourrank",
					x=20,y=25,w=kMax-20,h=kMax,
					flags = kHAlignCenter + kVAlignTop,
					label = "yourrank"
				};
				
				Text
				{
					font = RankFont,
					name = "congratulations",
					x=30,y=60,w=kMax-30,h=kMax,
					flags = kHAlignCenter + kVAlignTop,
					label = "congratshighscore"
				};
				
				Text
				{
					font = RankFont,
					name = "dnq",
					x=30,y=50,w=kMax-30,h=kMax,
					flags = kHAlignCenter + kVAlignTop,
					label = "scorednq"
				};
			},
			
			
			Bitmap
			{
				x = 470,
				y = 150,
				image="hiscore/local-hs-bb.png",	
				name="rightpanel",
				
				Text
				{
					font = TableHeaderFont,
					name = "globalinfoheader",
					x=20,y=25,w=kMax-20,h=kMax,
					flags = kHAlignCenter + kVAlignTop,
					label = "globalhighscores"
				};
				
				Text
				{
					font = ScoreInfoFont,
					name = "info",
					x=20,y=70,w=kMax-20,h=kMax,
					flags = kHAlignCenter + kVAlignTop,
					label = "globalhighscoreinfo"
				};
					
				Button
				{
					x=65,
					y=150,
					font = StandardButtonFont,
					graphics = StandardButtonGraphics,
					name="moreinfo",
					label="moreinfo",
					type = kPush,
					command =
						function()
							DoModal("scripts/hiscoreinfo.lua");
						end
					
				};
				
				
				Text
				{
					font = TableInfoFont,
					name = "eligible",
					x=20,y=210,w=kMax-20,h=60,
					flags = kHAlignCenter + kVAlignTop,
					label = "eligible"
				};
			
					
				Button
				{
					x=65,
					y=265,
					font = StandardButtonFont,
					graphics = StandardButtonGraphics,
					name="submit",
					label="submit",
					type = kPush
				};
			};
			
			
			
			Text
			{
				font = ConnectingToServerFont,
				name = "server",
				x=485,y=362,w=258,h=130,
				flags = kHAlignCenter + kVAlignCenter,
				label = "connectingtoserver"
			};
			
			Text
			{
				font = ConnectingToServerFont,
				name = "error",
				x=505,y=362,w=200,h=130,
				flags = kHAlignCenter + kVAlignCenter,
				label = "Server error"
			};
			
			
			
			Text
			{
				font = ScoreFont,
				name = "category",
				x=163+timeX,y=192+timeY,w=201,h=40,
				flags = kHAlignCenter + kVAlignTop,
				label = "Category Name"
			};
			
			Button
			{
				font = StandardButtonFont,
				graphics = BlueLeftButtonGraphics, -- Was Not Blue
				name="gamemodeleft",
				label="",
				type = kPush,
				x=210,
				y=80,
				scale = 1.0
			};
			
			Button
			{
				font = StandardButtonFont,
				graphics = BlueRightButtonGraphics, -- Was Not Blue
				name="gamemoderight",
				label="",
				type = kPush,
				x=538,
				y=80,
				scale = 1.0
			};
			
			Button
			{
				font = StandardButtonFont,
				graphics = BlueLeftButtonGraphics,
				name="categoryleft",
				label="",
				type = kPush,
				x=160+timeX,
				y=188+timeY,
				scale = 0.5
			};
			
			Button
			{
				font = StandardButtonFont,
				graphics = BlueRightButtonGraphics,
				name="categoryright",
				label="",
				type = kPush,
				x=343+timeX,
				y=188+timeY,
				scale = 0.5
			};
			
			
			
			Button
			{
				font = StandardButtonFont,
				graphics = BlueUpButtonGraphics,
				name="scrollup",
				label="",
				type = kPush,
				x=402,
				y=201,
				scale = 0.5
			};
			
			Button
			{
				font = StandardButtonFont,
				graphics = BlueDownButtonGraphics,
				name="scrolldown",
				label="",
				type = kPush,
				x=402,
				y=443,
				scale = 0.5
			};
			
			
			
			
			Button
			{
				x=170,
				y=500,
				font = ChangeViewFont,
				graphics = ChangeViewButtonGraphics,
				name="view",
				label="viewglobal",
				type = kPush
			};
			
			Button
			{
				x=170,
				y=500,
				font = ChangeViewFont,
				graphics = ChangeViewButtonGraphics,
				name="viewlocal",
				label="viewlocal",
				type = kPush
			};
			
			Button
			{
				x=535,
				y=500,
				font = StandardButtonFont,
				graphics = StandardButtonGraphics,
				name="back",
				type = kPush,
				flags = kHAlignCenter + kVAlignCenter,
				label="back",
				command = 
					function()
						ClearLastScore();
						PopModal(); -- take off high score menu, restart game loop
					end
			};
		}
	}
}