// Use this for initialization void Start() { for (int i = 0; i < ranking.Length; i++) { ranking [i] = GameObject.Find((i + 1).ToString()); } dados = GerenciarDadosSalvos.gerenciadorDeDados; Jogador[] lista = ordenarRanking(dados.carregarDadosPlayer()); if (lista[0] != null) { for (int i = 0; i < ranking.Length; i++) { if (lista [i] != null) { ranking [i].GetComponentInChildren <Text> ().text = lista [i].getNick() + " " + lista [i].getPontos(); } else { ranking [i].GetComponentInChildren <Text> ().text = "Empty 0"; ranking [i].GetComponentInChildren <Text> ().color = Color.grey; } } } else { for (int i = 0; i < ranking.Length; i++) { ranking [i].GetComponentInChildren <Text> ().text = "Empty 0"; ranking [i].GetComponentInChildren <Text> ().color = Color.grey; } } }
void Awake() { if (gerenciadorDeDados == null) { gerenciadorDeDados = this; } else { Destroy(gameObject); } DontDestroyOnLoad(gameObject); for (int i = 0; i < 20; i++) { arquivoURL[i] = Application.persistentDataPath + "//p" + i + ".dat"; } }
// Use this for initialization void Start() { dados = GerenciarDadosSalvos.gerenciadorDeDados; Jogador[] listaJogadores = dados.carregarDadosPlayer(); int maior = 0; if (listaJogadores [0] != null) { for (int i = 0; i < dados.getNumeroDeJogadoresSalvos(); i++) { if (listaJogadores [i].getPontos() > maior) { maior = listaJogadores [i].getPontos(); nick = listaJogadores [i].getNick(); } } nickTxt.text = nick; this.GetComponent <Text> ().text = maior.ToString(); } }
void Start() { dados = GerenciarDadosSalvos.gerenciadorDeDados; }