


var  rankText:GUIText[];

private var Stage:int=1;
private var rankAnimFlag:boolean=true;

function Start(){
var HScore:String[]=["100000","80000","60000","40000","20000","10000","5000","3000","1000","100"];
var Name:String[]=["AAA","BBB","CCC","DDD","EEE","FFF","GGG","HHH","III","JJJ"];


         ScoreScript.InitScore();
           ScoreScript.PrintScore();
		   
         
	       for(i=0;i<10;i++){
                if(PlayerPrefs.HasKey(i+"HScore")){

				var tempScore:int=PlayerPrefs.GetInt(i+"HScore");
				var tempName:String=PlayerPrefs.GetString(i+"HScoreName");
             
				if (tempScore<=9){
				HScore[i]="     " + tempScore ;
				}
				else if (tempScore>99){
				HScore[i]="   " +tempScore ;
				}
				else if (tempScore>999){
				HScore[i]="  " + tempScore;
				}
				else if (tempScore>9999){
				HScore[i]=" " + tempScore;
				}
				else if (tempScore>99999){
				HScore[i]=tempScore  +"";
				}
                  
				   Name[i]=tempName;

		
	          }	
		 
          }

        rankText[0].text=String.Format("1ST             {0}    {1, -8}          0{2}       20",Name[0],HScore[0],Stage);
		rankText[1].text=String.Format("2ND            {0}    {1, -8}          0{2}       20",Name[1],HScore[1],Stage);
		rankText[2].text=String.Format("3RD            {0}    {1, -8}          0{2}       20",Name[2],HScore[2],Stage);
        rankText[3].text=String.Format("4TH            {0}    {1, -8}          0{2}       20",Name[3],HScore[3],Stage);
        rankText[4].text=String.Format("5Th            {0}    {1, -8}          0{2}       20",Name[4],HScore[4],Stage);
        rankText[5].text=String.Format("6TH            {0}    {1, -8}          0{2}       20",Name[5],HScore[5],Stage);
        rankText[6].text=String.Format("7TH            {0}    {1, -8}          0{2}       20",Name[6],HScore[6],Stage);
        rankText[7].text=String.Format("8TH            {0}    {1, -8}          0{2}       20",Name[7],HScore[7],Stage);
        rankText[8].text=String.Format("9TH            {0}    {1, -8}          0{2}       20",Name[8],HScore[8],Stage);
        rankText[9].text=String.Format("10TH           {0}    {1, -8}          0{2}       20",Name[9],HScore[9],Stage);
       
	
		

}

function Update () {

        if(rankAnimFlag==true){
		rankAnim();
		}
		
		 if(Input.anyKeyDown){
		 Application.LoadLevel("Title");
		 }



}

function rankAnim(){



var add:float=0;
                rankAnimFlag=false;

				 rankText[0].pixelOffset =Vector2(-1200,0);
				 rankText[1].pixelOffset =Vector2(1200,0);
				 rankText[2].pixelOffset =Vector2(-1200,0);
				 rankText[3].pixelOffset =Vector2(1200,0);
				 rankText[4].pixelOffset =Vector2(-1200,0);
				 rankText[5].pixelOffset =Vector2(1200,0);
				 rankText[6].pixelOffset =Vector2(-1200,0);
				 rankText[7].pixelOffset =Vector2(1200,0);
				 rankText[8].pixelOffset =Vector2(-1200,0);
				 rankText[9].pixelOffset =Vector2(1200,0);

			   yield WaitForSeconds(1.0);



                 while(1200 >= add){
				 
				 rankText[0].pixelOffset=Vector2(-1200+add,0);
				 rankText[1].pixelOffset=Vector2(1200-add,0);
				 rankText[2].pixelOffset=Vector2(-1200+add,0);
				 rankText[3].pixelOffset=Vector2(1200-add,0);
				 rankText[4].pixelOffset=Vector2(-1200+add,0);
				 rankText[5].pixelOffset=Vector2(1200-add,0);
				 rankText[6].pixelOffset=Vector2(-1200+add,0);
				 rankText[7].pixelOffset=Vector2(1200-add,0);
				 rankText[8].pixelOffset=Vector2(-1200+add,0);
				 rankText[9].pixelOffset=Vector2(1200-add,0);
				 
				 add +=30.0;
				yield;
				 }
	
	
            

}