Inheritance: MonoBehaviour
Esempio n. 1
0
    void Start()
    {
        easyHighScores   = HighScoreHelper.LoadHighScores(Difficulty.EASY);
        normalHighScores = HighScoreHelper.LoadHighScores(Difficulty.NORMAL);
        hardHighScores   = HighScoreHelper.LoadHighScores(Difficulty.HARD);

        SwitchHighScoreTab(PlayerPrefs.GetInt("Difficulty"));
    }
    private void Start()
    {
        var highScoreLevel1Path = HighScoreHelper.GetHighScorePath(false, 1);
        var highScoreLevel2Path = HighScoreHelper.GetHighScorePath(false, 2);

        var highScoreLevel1 = HighScoreHelper.ReadHighScores(highScoreLevel1Path)[0].Score;
        var highScoreLevel2 = HighScoreHelper.ReadHighScores(highScoreLevel2Path)[0].Score;

        Level1Score.text = "BEST SCORE: " + highScoreLevel1;
        Level2Score.text = "BEST SCORE: " + highScoreLevel2;
    }
Esempio n. 3
0
    public void SaveHighScore()
    {
        Difficulty savedDifficulty = (Difficulty)PlayerPrefs.GetInt("Difficulty");

        TimerController timerController = FindObjectOfType <TimerController>();
        string          userName        = userNameField.text;

        int score = HighScoreHelper.CalculateHighScore(Mathf.FloorToInt(timerController.GameTime), movesCount, savedDifficulty);

        HighScores hs           = HighScoreHelper.LoadHighScores(savedDifficulty);
        ScoreEntry newHighScore = new ScoreEntry(userName, score);

        HighScoreHelper.AddHighScore(hs, newHighScore);
        HighScoreHelper.SaveHighScore(hs, savedDifficulty);

        SceneManager.LoadScene(SceneManager.GetActiveScene().buildIndex - 1);
    }
Esempio n. 4
0
    private void Start()
    {
        var highScoreText      = HighScoreText.GetComponent <Text>();
        var highScoreDailyText = HighScoreDailyText.GetComponent <Text>();

        HighScorePath = HighScoreHelper.GetHighScorePath(false, PlayerSettings.LastLevel);
        var nameScoreLines = HighScoreHelper.ReadHighScores(HighScorePath);
        var newHighScores  = HighScoreHelper.WriteHighScore(nameScoreLines, PlayerSettings.LastScore, HighScorePath);

        highScoreText.text = newHighScores;

        HighScorePathDaily = HighScoreHelper.GetHighScorePath(true, PlayerSettings.LastLevel);
        HighScoreHelper.CheckDailyScores(HighScorePathDaily);
        var nameScoreLinesDaily = HighScoreHelper.ReadHighScores(HighScorePathDaily);
        var newHighScoresDaily  = HighScoreHelper.WriteHighScore(nameScoreLinesDaily, PlayerSettings.LastScore, HighScorePathDaily);

        highScoreDailyText.text = newHighScoresDaily;
    }