Esempio n. 1
0
    /// <summary>
    /// 保存分数
    /// </summary>
    public void SaveScore()
    {
        int highestScore = PlayerPrefUtil.GetNowMapLevelScore();

        if (nowScore > highestScore)
        {
            PlayerPrefUtil.SetNowMapLevelHighestScore(nowScore); //保存一下最高分
        }
    }
Esempio n. 2
0
    private GameObject scoreNum;        //成绩的数字

    /// <summary>
    /// 唤醒的时候
    /// </summary>
    private void Awake()
    {
        sInstance = this;
        highScore = transform.parent.Find("HighScore").gameObject; //得到最高分
        highNum   = highScore.transform.Find("num").gameObject;    //最高分数字
        scoreNum  = transform.Find("num").gameObject;              //存放数字的地方

        int highestScore = PlayerPrefUtil.GetNowMapLevelScore();

        if (highestScore != 0)
        {
            highScore.SetActive(true);                               //可见
            AddScoreImage(highestScore, highNum.transform, -25, 10); //加到最高分上
        }
        else
        {
            highScore.SetActive(false); //不可见
        }
    }