Ejemplo n.º 1
0
    public void SetScore(int level, Text best, Text now, Text bestClear, Text nowClear)
    {
        levelNow       = level;
        bestScore      = best;
        nowScore       = now;
        bestScoreClear = bestClear;
        nowScoreClear  = nowClear;

        BestScore      = PlayerPrefs.GetInt("Level" + levelNow.ToString(), 0);
        NowScore       = 0;
        nowScore.text  = NowScore.ToString();
        bestScore.text = BestScore.ToString();
    }
Ejemplo n.º 2
0
    public void CalculateScore()
    {
        if (Score > LastScore)
        {
            PlayerPrefs.SetInt("Score", Score);
        }

        EndUI.SetActive(true);
        //只有物体显示后才能获取到对象,否则为抛出空指针异常
        NowScore  = GameObject.Find("NowScore");
        HighScore = GameObject.Find("HighScore");
        NowScore.GetComponent <Text>().text  = Score.ToString();
        HighScore.GetComponent <Text>().text = LastScore.ToString();
        if (Input.GetKey(KeyCode.Mouse0))
        {
            SceneManager.LoadScene("UI");
        }
    }
Ejemplo n.º 3
0
 public void CalculateScore()
 {
     if (Score > LastScore)
     {
         PlayerPrefs.SetInt("Score", Score);
     }
     if (EndUI == null)
     {
         return;
     }
     EndUI.SetActive(true);
     NowScore  = GameObject.Find("NowScore");
     HighScore = GameObject.Find("HighScore");
     NowScore.GetComponent <Text>().text  = Score.ToString();
     HighScore.GetComponent <Text>().text = LastScore.ToString();
     GameObject.Find("Text").GetComponent <Text>().text = string.Format("Score\r\n{0}\n\nHigh score\n{1}", Score.ToString(), LastScore.ToString());
     if (Input.GetKey(KeyCode.Mouse0))
     {
         SceneManager.LoadScene("UI");
     }
 }