import DBase;		//Database functionality
import Highscore;		//Highscore functionality
public var header:GUISkin;	//Used for total title
public var content:GUISkin;	//Used for the list

function Start () {

}

function Update () {

}

function OnGUI(){
	GUI.skin = header;	//Setting up the GUI Skin.
	
	//Title
	GUI.Label(Rect(100,70,950,100),"Legends");
	
	GUI.skin = content;	//Setting up the GUI Skin.
	var db = new DBase();	//Creating a database instance
	var list:Array;	//This will keep all the scores
	list = db.getScores();	//Getting scores from database
	
	var height = 200;	//Position of elements of the list
	var pos = 1;	//position
	
	//For each item inside the list: show details
	for(var item : Highscore in list)
    {
    	GUI.Label(Rect(100,height,50,30),""+pos);	//Showing position
 		GUI.Label(Rect(150,height,200,30),item.getName());	//Showing player name
 		GUI.Label(Rect(250,height,200,30),""+item.getScore());	//Showing player score
 		height+= 30;	//Increment the hight for next player
 		pos++;	//Increment the position for next player
    }
    
    //Clicking this button will redirect the user to the main menu.
    if(GUI.Button(Rect(100,height,270,30),"Back")){
    	Application.LoadLevel(0);
    }
}