using UnityEngine;
using System.Collections;
using System.Collections.Generic;

public class HighScoreViewer : MonoBehaviour
{
//		public HighScoreScrollItem itemPrefab;
		UIGrid grid;
			
		void Awake ()
		{
				grid = this.transform.Find ("Grid").GetComponent<UIGrid> ();
		}
		
		void OnEnable ()
		{
				/*
				SortedDictionary<int,string> highScores = HighScoreManager.LoadHighscores ();
				if (highScores.Count == 0) {
						this.transform.Find ("NoHighScores").gameObject.SetActive (true);
				} else {
						this.transform.Find ("NoHighScores").gameObject.SetActive (false);
				}
				
				int i = 0;
		
				foreach (KeyValuePair<int,string> highscore in highScores) {
						i++;
						HighScoreScrollItem item = NGUITools.AddChild (grid.gameObject, itemPrefab.gameObject).GetComponent<HighScoreScrollItem> ();
						UIWidget sprite = item.GetComponent<UIWidget> ();
						sprite.leftAnchor.target = this.transform;
						sprite.leftAnchor.relative = 0;
						sprite.rightAnchor.target = this.transform;
						sprite.rightAnchor.relative = 1;
						item.transform.localPosition = new Vector3 (0, 0, 0);
						item.rank = i;
						item.type = highscore.Value;
						item.score = highscore.Key;
						if (i % 2 == 0) {
								item.Darken ();
						}
				}
				grid.repositionNow = true;
				*/
		}
		
		void OnDisable ()
		{
				/*
				foreach (HighScoreScrollItem HighScoreScrollItem in this.GetComponentsInChildren<HighScoreScrollItem>(true)) {
						Destroy (HighScoreScrollItem.gameObject);
				}
				*/
		}
}
