コード例 #1
0
    public static void AddNewScoreTest1(int score)
    {
        completedTest1 = true;
        scoreTest1     = score;
        if (score > highScoreTest1)
        {
            highScoreTest1 = score;
        }
        if (currUser != "GUEST")
        {
            PlayGamesController.PostToLeaderboardTest1((long)score);
        }

        for (int i = 1; i <= 10; ++i)
        {
            string keyStr = "test1Score" + i;
            if (!PlayerPrefs.HasKey(keyStr))
            {
                PlayerPrefs.SetInt(keyStr, score);
                return;
            }
        }

        for (int i = 1; i < 10; ++i)
        {
            string keyStr1 = "test1Score" + i;
            string keyStr2 = "test1Score" + (i + 1);
            PlayerPrefs.SetInt(keyStr1, PlayerPrefs.GetInt(keyStr2));
        }
        PlayerPrefs.SetInt("test1Score10", score);
    }