


static function AddScore(name : String, score : int){
   var newScore : int;
   var newName : String;
   var oldScore : int;
   var oldName : String;
   newScore = score;
   newName = name;
   for(i=0;i<10;i++){
      if(PlayerPrefs.HasKey(i+"HScore")){
         if(PlayerPrefs.GetInt(i+"HScore")<newScore){ 
            // new score is higher than the stored score
            oldScore = PlayerPrefs.GetInt(i+"HScore");
            oldName = PlayerPrefs.GetString(i+"HScoreName");
            PlayerPrefs.SetInt(i+"HScore",newScore);
            PlayerPrefs.SetString(i+"HScoreName",newName);
            newScore = oldScore;
            newName = oldName;
         }
      }else{
         PlayerPrefs.SetInt(i+"HScore",newScore);
         PlayerPrefs.SetString(i+"HScoreName",newName);
         newScore = 0;
         newName = "";
      }
   }
}

static function InitScore(){
var tempHScore:int[]=[100000,80000,60000,40000,20000,10000,5000,3000,1000,100];
var tempName:String[]=["AAA","BBB","CCC","DDD","EEE","FFF","GGG","HHH","III","JJJ"];
  if(PlayerPrefs.HasKey(0+"HScore")){
	for(i=0;i<10;i++){
      

             PlayerPrefs.SetInt(i+"HScore",tempHScore[i]);  
             PlayerPrefs.SetString(i+"HScoreName",tempName[i]);



		
	}	
  }
}






static function PrintScore(){
var HScore:int;
var Name:String;

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

		   HScore=PlayerPrefs.GetInt(i+"HScore");
           Name=PlayerPrefs.GetString(i+"HScoreName");

            print("HScore"+i +"="+HScore);
			print("Name"+i +"="+Name);
		}
}
}
