// Use this for initialization void Start() { namePanel.SetActive(false); lbPanel.SetActive(false); int playerscore = PlayerPrefs.GetInt("score"); bool isHighScore = GameScoreServer .getHighScores() .Count(score => score.score >= playerscore) <= 10; if (isHighScore) { namePanel.SetActive(true); } else { var scores = GameScoreServer .getHighScores() .OrderByDescending(highscore => highscore.score) .ToList(); FillTable(scores); lbPanel.SetActive(true); } }
private void ReplaceInHS(string name, int score) { var topscores = GameScoreServer.getHighScores().OrderByDescending(highscore => highscore.score).ToList(); if (topscores.Count == 0) { namePanel.SetActive(true); topscores.Add(new PlayerScore(nsm, score)); } else if (topscores.Count > 0 && topscores[topscores.Count - 1].score < score) { namePanel.SetActive(true); topscores.Add(new PlayerScore(nsm, score)); } else { topscores = topscores.OrderByDescending(highscore => highscore.score).ToList(); lbPanel.SetActive(true); } topscores = topscores.OrderByDescending(highscore => highscore.score).ToList(); FillTable(topscores); }
public void OnEditEnd() { GameScoreServer.SendGameScoreToServer(inputField.text, PlayerPrefs.GetInt("score")); // ReplaceInHS(inputField.text, PlayerPrefs.GetInt("score")); nsm = inputField.text; namePanel.SetActive(false); lbPanel.SetActive(true); ReplaceInHS(inputField.text, PlayerPrefs.GetInt("score")); }
public IEnumerator DIE() { Time.timeScale = 0f; PlayerPrefs.SetInt("score", GoldTracker.Gold); GameScoreServer.getHighScores(); StartCoroutine(FadeToBlack(4.0f)); // yield return new WaitUntil(() => Input.GetKeyDown(KeyCode.Return)); GameObject.FindGameObjectWithTag("deathscreen").GetComponentInChildren <Text>(true).enabled = false; Time.timeScale = 1f; SceneManager.LoadScene("Deaf"); // Application.Quit(); //TODO: BAD STUFF yield break; }
public void GetScores() { var topscores = GameScoreServer.getHighScores().Take(10).OrderByDescending(highscore => highscore.score).ToList(); for (int i = 0; i < textlines.Count; i++) { var texts = textlines[i].GetComponentsInChildren <Text>(); if (i >= topscores.Count) { texts[0].text = (i + 1) + ". -"; texts[1].text = " - "; } else { texts[0].text = (i + 1) + ". " + topscores[i].username.Trim('\"'); texts[1].text = topscores[i].score.ToString(); } } }
/* IEnumerator getScores() * { * * var hs = GameScoreServer.getHighScores(); * * // yield return new WaitForSeconds(6.0f); * * * bool isHighScore = hs.Count(score => score.score >= PlayerPrefs.GetInt("score")) < 10; * * if (isHighScore) * { * namePanel.SetActive(true); * } * else * { * lbPanel.SetActive(true); * } * * }*/ bool GetScoreNowIsInLB(int pScore) { return((GameScoreServer.getHighScores().Count(score => score.score >= pScore)) <= 10); }
// Use this for initialization void Start() { //GameScoreServer.SendGameScoreToServer("user1", 100); GameScoreServer.getHighScores(); AudioManager.instance.Play(backGroundMusic, isLooping: true); }