public void SetAndSaveBestScore() { Debug.Log("Checking and setting best scores"); for (int i = 0; i < scores.Count; i++) { if (!scores [i].isFloat) { if (Crypting.DecryptInt(scores [i].score) > Crypting.DecryptInt(bestScores [i].score)) { bestScores [i].score = scores [i].score; if (scores[i].newBest != null) { scores [i].newBest.GetComponent <Blink> ().BlinkNewBest(); } } } else { if (Crypting.DecryptFloat(scores [i].score) > Crypting.DecryptFloat(bestScores [i].score)) { bestScores [i].score = scores [i].score; if (scores[i].newBest != null) { scores [i].newBest.GetComponent <Blink> ().BlinkNewBest(); } } } } //OVDE TREBA PRVO DA SE POSALJU SKOROVI LOCAL DB-u i SERVER API-ju App.local.PlayerSave(); //App.server.Save(); }
public void ScoreMinus(float amount, string name) { for (int i = 0; i < scores.Count; i++) { if (scores[i].scoreName.CompareTo(name) == 0) { scores[i].score = Crypting.EncryptFloat(Crypting.DecryptFloat(scores[i].score) - amount); foreach (UILabel labela in scores[i].scoreLabels) { labela.text = GetScore(scores[i].scoreName).ToString(); } } } }
public float GetBestScore(string name) { for (int i = 0; i < bestScores.Count; i++) { if (bestScores[i].scoreName.CompareTo(name) == 0) { if (bestScores[i].isFloat) { return(Crypting.DecryptFloat(bestScores[i].score)); } else { return((int)Crypting.DecryptFloat(bestScores[i].score)); } } } return(-1); }