public int GetBestScore(string name) { for (int i = 0; i < bestScores.Count; i++) { if (bestScores[i].scoreName.CompareTo(name) == 0) { return(Crypting.DecryptInt2(bestScores[i].score)); } } return(-1); }
public void ScoreMinus(int amount, string name) { for (int i = 0; i < scores.Count; i++) { if (scores[i].scoreName.CompareTo(name) == 0) { scores[i].score = Crypting.EncryptInt2(Crypting.DecryptInt2(scores[i].score) - amount); foreach (Text labela in scores[i].scoreLabels) { labela.text = GetScore(scores[i].scoreName).ToString(); } } } }
public void SetAndSaveBestScores() { Debug.Log("Checking and setting best scores"); for (int i = 0; i < scores.Count; i++) { if (Crypting.DecryptInt2(scores[i].score) > Crypting.DecryptInt2(bestScores[i].score)) { bestScores[i].score = scores[i].score; foreach (Text label in bestScores[i].scoreLabels) { label.text = (Crypting.DecryptInt2(bestScores[i].score)).ToString(); } AddBestScoreToPlayer(bestScores[i].scoreName, bestScores[i].score); } } //todo: Save na server i lokal App.firebase.Save(); }