Esempio n. 1
0
 private void OnEnable()
 {
     for (int i = 0; i < 10; i++)
     {
         lstscores[i] = PlayerPrefsX.GetFloatArray("ScoresLast")[i];
     }
 }
Esempio n. 2
0
    private void Update()
    {
        if (Input.GetMouseButtonDown(1))
        {
            float[] leaderboard        = PlayerPrefsX.GetFloatArray("Leaderboard");
            float[] updatedLeaderboard = new float[leaderboard.Length + 1];
            for (int i = 0; i < leaderboard.Length; i++)
            {
                updatedLeaderboard[i] = leaderboard[i];
            }
            updatedLeaderboard[updatedLeaderboard.Length - 1] = 10.00f;
            PlayerPrefsX.SetFloatArray("Leaderboard", updatedLeaderboard);
            m_leaderboard.text = "";
            foreach (float f in updatedLeaderboard)
            {
                m_leaderboard.text += f.ToString("00.00\n");
            }
        }

        if (Input.GetButtonDown("Reload"))
        {
            float[] reset = new float[0];
            PlayerPrefsX.SetFloatArray("Leaderboard", reset);
            m_leaderboard.text = "";
        }
    }
Esempio n. 3
0
    public Text listeScores;                            //Text pour la liste des scores
    //variable à transformer en % NiveauOxygene



    void Start()
    {
        //ChangementScenePortail.leNomDuJoueur = "Kim";
        //ControlerPersonnage.NiveauOxygene=10;

        PlayerPrefs.DeleteKey("FichierScores");                  //Effacer les données précédemment enregistrées
        PlayerPrefs.DeleteKey("FichierNoms");                    //Effacer les données précédemment enregistrées

        bool infoExisteDeja = PlayerPrefs.HasKey("FichierNoms"); //Regarde si valeurs présentes

        //si valeurs trouvées on affiche
        if (infoExisteDeja == true)
        {
            //lecture des données
            tableauValeursScore = PlayerPrefsX.GetFloatArray("FichierScores");
            tableauNoms         = PlayerPrefsX.GetStringArray("FichierNoms");
        }

        tableauNoms[3] = ChangementScenePortail.leNomDuJoueur;

        tableauValeursScore[3] = ControlerPersonnage.NiveauOxygene;
        //listeScores.text = tableauValeursScore[0].ToString();

        //Trier le tableau selon le score
        System.Array.Sort(tableauValeursScore, tableauNoms);
        System.Array.Reverse(tableauValeursScore); //
        System.Array.Reverse(tableauNoms);         //

        AfficherElements();
        //Écriture des données
        PlayerPrefsX.SetFloatArray("FichierScores", tableauValeursScore);
        PlayerPrefsX.SetStringArray("FichierNoms", tableauNoms);
    }
Esempio n. 4
0
    // Use this for initialization

    void Start()
    {
        i         = 0;
        Ghosttime = PlayerPrefsX.GetFloatArray("timeX");
        Ghostkey  = PlayerPrefsX.GetIntArray("keyX");

        Debug.Log("OK");
        Debug.Log(Ghosttime);
    }
Esempio n. 5
0
    void LoadList()
    {
        string[] names;

        float[] playertimes;

        names       = PlayerPrefsX.GetStringArray("PlayerNames");
        playertimes = PlayerPrefsX.GetFloatArray("PlayerTimes");
    }
Esempio n. 6
0
 private void Start()
 {
     float[] leaderboard = PlayerPrefsX.GetFloatArray("Leaderboard");
     Array.Sort(leaderboard);
     foreach (float f in leaderboard)
     {
         m_leaderboard.text += f.ToString("00.00\n");
     }
 }
Esempio n. 7
0
    // Use this for initialization
    void Start()
    {
        ResetColorsButton = false;
        colors            = PlayerPrefsX.GetColorArray(colorsKey);
        times             = PlayerPrefsX.GetFloatArray(timeKey);
        currentDay        = PlayerPrefs.GetInt(currentDayKey);

        if (!cam)
        {
            cam = FindObjectOfType <Camera>();
        }

        if (colors.Length < 1 || times.Length < 1)
        {
            Debug.Log("Initializing Colors!");
            colors = new Color[365];
            times  = new float[365];
            for (int i = 0; i < 365; i++)
            {
                colors[i] = new Color(1, 1, 1);
                times[i]  = 0;
            }
            currentDay = 0;
            PlayerPrefsX.SetColorArray(colorsKey, colors);
            PlayerPrefsX.SetFloatArray(timeKey, times);
            PlayerPrefs.SetInt(currentDayKey, 0);
        }

        //printColors();

        //visController.enabled = false;

        //printColors();

        //float bonus = 0.1f;

        //float RMin = 0.7f + bonus;
        //float RMax = 0.9f + bonus;
        //float GMin = 0.32f + bonus;
        //float GMax = 0.6f + bonus;
        //float BMin = 0.0f + bonus;
        //float BMax = 0.39f + bonus;

        //for (int j = 0; j < colors.Length; j++)
        //{
        //    if (j % 2 == 0)
        //        colors[j] = new Color(Random.Range(RMin, RMax), Random.Range(GMin, GMax), Random.Range(BMin, BMax), 1);
        //    else
        //        colors[j] = new Color(Random.Range(1 - RMin, 1 - RMax), Random.Range(1 - GMin, 1 - GMax), Random.Range(1 - BMin, 1 - BMax), 1);
        //}

        //for (int i = 0; i < times.Length; i++)
        //{
        //    times[i] = Random.Range(240, 375);
        //}
    }
Esempio n. 8
0
 public static void ClearRank()
 {
     float[] data = PlayerPrefsX.GetFloatArray("Rank", 0, 10);
     for (int i = 0; i < data.Length; i++)
     {
         data[i] = 0f;
     }
     PlayerPrefsX.SetFloatArray("Rank", data);
     Debug.Log("Complete! ");
 }
Esempio n. 9
0
 public void Save()
 {
     float[] leaderboard        = PlayerPrefsX.GetFloatArray("Leaderboard");
     float[] updatedLeaderboard = new float[leaderboard.Length + 1];
     for (int i = 0; i < leaderboard.Length; i++)
     {
         updatedLeaderboard[i] = leaderboard[i];
     }
     updatedLeaderboard[updatedLeaderboard.Length - 1] = float.Parse(m_timeScore.text);
     PlayerPrefsX.SetFloatArray("Leaderboard", updatedLeaderboard);
 }
Esempio n. 10
0
    // Start is called before the first frame update
    void Start()
    {
        playerHSList = new List <playerHighScores>();
        gm           = GameObject.Find("GameManager").GetComponent <GameManager>();
        names        = PlayerPrefsX.GetStringArray("Names", "", 1);
        scores       = PlayerPrefsX.GetIntArray("Scores", 0, 1);
        times        = PlayerPrefsX.GetFloatArray("Times", 0f, 1);

        if (names[0] == "")
        {
            names[0]  = gm.username;
            scores[0] = gm.score;
            times[0]  = gm.time;

            PlayerPrefsX.SetStringArray("Names", names);
            PlayerPrefsX.SetIntArray("Scores", scores);
            PlayerPrefsX.SetFloatArray("Times", times);
        }
        else
        {
            playerHS = new playerHighScores();
            for (int i = 0; i < names.Length; i++)
            {
                playerHS   = new playerHighScores();
                playerHS.n = names[i];
                playerHS.s = scores[i];
                playerHS.t = times[i];
                playerHSList.Add(playerHS);
            }



            playerHS   = new playerHighScores();
            playerHS.n = gm.username;
            playerHS.s = gm.score;
            playerHS.t = gm.time;

            playerHSList.Add(playerHS);

            System.Array.Resize(ref names, names.Length + 1);
            System.Array.Resize(ref scores, scores.Length + 1);
            System.Array.Resize(ref times, times.Length + 1);

            names[names.Length - 1]   = gm.username;
            scores[scores.Length - 1] = gm.score;
            times[times.Length - 1]   = gm.time;

            PlayerPrefsX.SetStringArray("Names", names);
            PlayerPrefsX.SetIntArray("Scores", scores);
            PlayerPrefsX.SetFloatArray("Times", times);
        }
        sortList();
        Scoreboard();
    }
Esempio n. 11
0
    void SaveList()
    {
        highScoreList = new List <HighScore> {
        };
        gameManager   = FindObjectOfType <GameManager>();
        names         = PlayerPrefsX.GetStringArray("PlayerNames", "", 1);
        playtimes     = PlayerPrefsX.GetFloatArray("PlayerTimes", 0f, 1);


        if (names[0] == "")
        {
            names[0]     = gameManager.username;
            playtimes[0] = gameManager.time;


            PlayerPrefsX.SetStringArray("PlayerNames", names);
            PlayerPrefsX.SetFloatArray("PlayerTimes", playtimes);
        }
        else
        {
            myHighScores = new HighScore();
            for (int i = 0; i < names.Length; i++)
            {
                //Loading myHighScores with current saved playerPrefs
                myHighScores            = new HighScore();
                myHighScores.playername = names[i];
                myHighScores.playtime   = playtimes[i];
                highScoreList.Add(myHighScores);
            }
            //Adding new values to list
            myHighScores            = new HighScore();
            myHighScores.playername = gameManager.username;
            myHighScores.playtime   = gameManager.time;

            highScoreList.Add(myHighScores);

            //Resizing arrays to fit new data
            //print("BUG before resize" + names.Length);
            System.Array.Resize(ref names, names.Length + 1);
            //print("BUG after resize" + names.Length);
            System.Array.Resize(ref playtimes, playtimes.Length + 1);

            //Adding current vallues to array
            names[names.Length - 1]         = gameManager.username;
            playtimes[playtimes.Length - 1] = gameManager.time;

            //Overwritting playerprefs with new data
            PlayerPrefsX.SetStringArray("PlayerNames", names);
            PlayerPrefsX.SetFloatArray("PlayerTimes", playtimes);
        }
        SortList();
        DisplayData();
    }
Esempio n. 12
0
    void LoadList()
    {
        string[] names;
        float[]  playertimes;

        names       = PlayerPrefsX.GetStringArray("PlayerNames");
        playertimes = PlayerPrefsX.GetFloatArray("PlayerTimes");

        for (int i = 0; i < names.Length; i++)
        {
            myHighScores.Add(new HighScore(names[i], playertimes[i]));
        }
    }
Esempio n. 13
0
    private void Start()
    {
        for (int i = 0; i < 10; i++)
        {
            lastscores[i] = PlayerPrefsX.GetFloatArray("ScoresLast")[i];
        }


        if (!beingHandled)
        {
            Panel.SetActive(true);
            StartCoroutine(HandleIt());
        }
    }
Esempio n. 14
0
    void Start()
    {
        // Play menu music
        GameObject.FindGameObjectWithTag("Music").GetComponent <musicPlayer>().PlayMusic();
        highScores = PlayerPrefsX.GetFloatArray("highScore");
        Array.Sort(highScores);

        // Set text for highscores
        if (highScores.Length > 0)
        {
            score1.text = "#1 " + Mathf.Floor(highScores [0] / 60).ToString("00") + ":" + (highScores [0] % 60).ToString("00");
        }
        if (highScores.Length > 1)
        {
            score2.text = "#2 " + Mathf.Floor(highScores [1] / 60).ToString("00") + ":" + (highScores [1] % 60).ToString("00");
        }
        if (highScores.Length > 2)
        {
            score3.text = "#3 " + Mathf.Floor(highScores [2] / 60).ToString("00") + ":" + (highScores [2] % 60).ToString("00");
        }
        if (highScores.Length > 3)
        {
            score4.text = "#4 " + Mathf.Floor(highScores [3] / 60).ToString("00") + ":" + (highScores [3] % 60).ToString("00");
        }
        if (highScores.Length > 4)
        {
            score5.text = "#5 " + Mathf.Floor(highScores [4] / 60).ToString("00") + ":" + (highScores [4] % 60).ToString("00");
        }
        if (highScores.Length > 5)
        {
            score6.text = "#6 " + Mathf.Floor(highScores [5] / 60).ToString("00") + ":" + (highScores [5] % 60).ToString("00");
        }
        if (highScores.Length > 6)
        {
            score7.text = "#7 " + Mathf.Floor(highScores [6] / 60).ToString("00") + ":" + (highScores [6] % 60).ToString("00");
        }
        if (highScores.Length > 7)
        {
            score8.text = "#8 " + Mathf.Floor(highScores [7] / 60).ToString("00") + ":" + (highScores [7] % 60).ToString("00");
        }
        if (highScores.Length > 8)
        {
            score9.text = "#9 " + Mathf.Floor(highScores [8] / 60).ToString("00") + ":" + (highScores [8] % 60).ToString("00");
        }
    }
Esempio n. 15
0
 public override void initSaveGame()
 {
     Debug.Log("InitSaveGame" + PreviewLabs.PlayerPrefs.HasKey("_isMusicOff") + GM.Get().deleteSave);
     if (!PreviewLabs.PlayerPrefs.HasKey("_isMusicOff") || GM.Get().deleteSave)
     {
         if (GM.Get().deleteSave)
         {
             GM.Get().deleteSave = false;
         }
         resetSave();
         saveGame();
     }
     else
     {
         isMusicOff    = PlayerPrefsX.GetBool("_isMusicOff");
         highScoreName = PlayerPrefsX.GetStringArray("_highScoreName");
         highScore     = PlayerPrefsX.GetFloatArray("_highScore");
     }
 }
Esempio n. 16
0
    void cardComparison(List <int> list)
    {
        cardScript.canPlayCard = false;

        int x = 0;

        // if the 2 flipped cards are the same
        if (cards [list[0]].GetComponent <cardScript> ().cardValue == cards [list[1]].GetComponent <cardScript> ().cardValue)
        {
            x = 2;             // card are the same

            // Hide the cards
            (cards [list[0]]).transform.localScale = new Vector3(0, 0, 0);
            (cards [list[1]]).transform.localScale = new Vector3(0, 0, 0);

            GameObject.Find("musicManager").GetComponent <musicPlayer> ().matchSound.Play();
            _matches--;             // decrement left matches
            matchText.text = _matches.ToString();

            if (_matches == 0)               // game is over
            // Add highscore
            {
                var highScores = new List <float>();
                highScores = PlayerPrefsX.GetFloatList("highScore");
                highScores.Add(gameTime);
                PlayerPrefsX.SetFloatArray("highScore", highScores.ToArray());
                Debug.Log(((PlayerPrefsX.GetFloatArray("highScore")[0]).ToString()));

                // Load win scene
                SceneManager.LoadScene("winScene");
            }
        }

        for (int i = 0; i < list.Count; i++)
        {
            // if the the 2 cards are the same state = 2
            // Cards won't flip again
            // Else state = 0
            cards [list[i]].GetComponent <cardScript> ().state = x;
            cards [list [i]].GetComponent <cardScript> ().check();
        }
    }
    public bool CheckHighscore()
    {
        float[] highscores = new float[10] {
            0, 0, 0, 0, 0, 0, 0, 0, 0, 0
        };
        string[] highscoreNames = new string[10] {
            "", "", "", "", "", "", "", "", "", ""
        };
        if (PlayerPrefsX.GetFloatArray("Scores").Length == 0)
        {
            PlayerPrefsX.SetStringArray("Names", highscoreNames);
            PlayerPrefsX.SetFloatArray("Scores", highscores);
            showSubmit();
            return(true);
        }
        else
        {
            highscores     = PlayerPrefsX.GetFloatArray("Scores");
            highscoreNames = PlayerPrefsX.GetStringArray("Names");
            int index = -1;

            for (int i = 0; i < highscores.Length; i++)
            {
                if (Score > highscores [i])
                {
                    index = i;
                    break;
                }
            }

            if (index != -1)
            {
                showSubmit();
                return(true);
            }
            else
            {
                FillHighscoreList(PlayerPrefsX.GetStringArray("Names"), PlayerPrefsX.GetFloatArray("Scores"));
            }
        }
        return(false);
    }
Esempio n. 18
0
    void StopScrolling(int i)
    {
        float distance = PlayerPrefs.GetFloat("Farthest");

        if (distance < mileage)
        {
            PlayerPrefs.SetFloat("Farthest", mileage);
        }
        float[] data = PlayerPrefsX.GetFloatArray("Rank", 0, 10);
        for (int k = 0; k < data.Length; k++)
        {
            if (data[k] < mileage)
            {
                for (int j = data.Length - 1; j > k; j--)
                {
                    data[j] = data[j - 1];
                }
                data[k] = mileage;
                rank    = k + 1;
                Debug.Log("set rank");
                break;
            }
        }

        //for (int k = 0; k < data.Length; k++) {
        //    print(data[k]);
        //}
        PlayerPrefsX.SetFloatArray("Rank", data);
        if (i == 0)
        {
            Debug.Log("stop");
            StopAllCoroutines();
            curspeed = 0;
            SetSpeed(0);
        }
        else
        {
            StopAllCoroutines();
            StartCoroutine(ChangeSpeed(0f, 0.5f));
        }
    }
    public void SaveHighScore()
    {
        string PlayerName = nameText.text;

        float[]  highscores     = PlayerPrefsX.GetFloatArray("Scores");
        string[] highscoreNames = PlayerPrefsX.GetStringArray("Names");

        int index = -1;

        for (int i = 0; i < highscores.Length; i++)
        {
            if (Score > highscores [i])
            {
                index = i;
                break;
            }
        }

        if (index >= 0)
        {
            if (index == 9)
            {
                highscoreNames [index] = PlayerName;
                highscores [index]     = TotalScore;
            }
            else
            {
                for (int changeIndex = 8; changeIndex >= index; changeIndex--)
                {
                    highscoreNames [changeIndex + 1] = highscoreNames [changeIndex];
                    highscores [changeIndex + 1]     = highscores [changeIndex];
                }
                highscoreNames [index] = PlayerName;
                highscores [index]     = Score;
            }
        }
        PlayerPrefsX.SetStringArray("Names", highscoreNames);
        PlayerPrefsX.SetFloatArray("Scores", highscores);

        FillHighscoreList(highscoreNames, highscores);
    }
Esempio n. 20
0
 private IEnumerator DNAStart()
 {
     if (PlayerPrefs.HasKey("BestIA"))
     {
         bestiaturnDNA = PlayerPrefsX.GetFloatArray("BestIA");
         print("tem save");
     }
     for (int i = 0; i < karts; i++)
     {
         if (bestiaturnDNA.Length > 0)
         {
             //print("colocando o melhor");
             iaKarts[i].SetDNA(bestiaturnDNA);
         }
         else
         {
             iaKarts[i].CreateDNA();
         }
         yield return(new WaitForEndOfFrame());
     }
 }
Esempio n. 21
0
    public void RecordScore(int score)
    {
        List <float> highScores = new List <float>(PlayerPrefsX.GetFloatArray(HIGH_SCORE_KEY));

        highScores.Add(score);
        highScores.Sort((a, b) => - 1 * a.CompareTo(b));
        PlayerPrefsX.SetFloatArray(HIGH_SCORE_KEY, highScores.ToArray());
        for (int i = 0; i < highScoreTexts.Length; i++)
        {
            if (i < highScores.Count)
            {
                highScoreTexts[i].text = highScores[i].ToString();
            }
            else
            {
                highScoreTexts[i].text = "";
            }
        }

        scoreText.text = "Score: " + score.ToString();
        SetRankText(score);
    }
Esempio n. 22
0
    public void GenerateMark(float start)
    {
        float[] data = PlayerPrefsX.GetFloatArray("Rank", 0, 10);
        for (int i = 0; i < data.Length; i++)
        {
            if (data[i] != 0)
            {
                float mile = data[i] + startOffest;
                if (mile > start && mile < (start + length))
                {
                    GameObject line = Instantiate(Line, this.gameObject.transform);
                    float      relativePos;
                    if (data[i] > length)
                    {
                        relativePos = (int)data[i] % (int)length + 4;
                    }
                    else
                    {
                        relativePos = (int)data[i] + 4;
                    }
                    if (relativePos > length)
                    {
                        relativePos -= length;
                    }
                    line.transform.localPosition = new Vector3(0.1f, 0, relativePos);
                    line.name = data[i].ToString();
                    TextMesh[] tms = line.GetComponentsInChildren <TextMesh>();
                    foreach (TextMesh tm in tms)
                    {
                        tm.text = "No:" + (i + 1).ToString();
                    }

                    line.GetComponentInChildren <RankLine>().no = i + 1;
                    lines.Add(line);
                }
            }
        }
    }
Esempio n. 23
0
    public void SaveScore()
    {
        userTime = (EndUserTime - startUserTime);

        float[]  oldTime = PlayerPrefsX.GetFloatArray("HighscoresTimes", 900, 100);
        string[] oldName = PlayerPrefsX.GetStringArray("HighscoresNames", "AI 1.2", 100);

        for (int i = 0; i < oldTime.Length; i++)
        {
            float  oldT = oldTime[i];
            string oldN = oldName [i];
            if (userTime < oldTime[i])
            {
                oldTime[i]  = userTime;
                oldName [i] = userName;
                userTime    = oldT;
                userName    = oldN;
            }
        }

        PlayerPrefsX.SetFloatArray("HighscoresTimes", oldTime);
        PlayerPrefsX.SetStringArray("HighscoresNames", oldName);
    }
Esempio n. 24
0
 private void LoadData()
 {
     GlobalValues.timedLevelsBeat     = PlayerPrefsX.GetBoolArray("Completed Timed Levels");
     GlobalValues.hasDisplayedWin1    = PlayerPrefs.GetInt("Has Displayed Win Message");
     GlobalValues.currentMaxLevel     = PlayerPrefs.GetInt("Levels Completed");
     GlobalValues.mainLevelsCompleted = PlayerPrefs.GetInt("Main Levels Completed");
     GlobalValues.topRecordedTimes    = PlayerPrefsX.GetFloatArray("Top Recorded Times");
     if (GlobalValues.topRecordedTimes.Length == 0)
     {
         GlobalValues.topRecordedTimes = new float[GlobalValues.totalLevelCount];
         topRecordedTimesNS            = new float[GlobalValues.totalLevelCount];
     }
     if (GlobalValues.topRecordedTimes.Length != 20)
     {
         GlobalValues.topRecordedTimes = new float[20];
     }
     if (GlobalValues.topRecordedTimes.Length == GlobalValues.totalLevelCount)
     {
         for (int i = 0; i < GlobalValues.totalLevelCount; i++)
         {
             if (GlobalValues.topRecordedTimes[i] == 0f)
             {
                 GlobalValues.topRecordedTimes[i] = timesToBeatP[i];
                 topRecordedTimesNS[i]            = timesToBeatP[i];
             }
             if (GlobalValues.topRecordedTimes[i] > timesToBeatP[i])
             {
                 GlobalValues.topRecordedTimes[i] = timesToBeatP[i];
                 topRecordedTimesNS[i]            = timesToBeatP[i];
             }
         }
     }
     if (GlobalValues.currentMaxLevel < 1)
     {
         GlobalValues.currentMaxLevel = 1;
     }
 }
Esempio n. 25
0
 static ScoreList()
 {
     scoreList = new List <float>(PlayerPrefsX.GetFloatArray("scores"));
 }
Esempio n. 26
0
    // Start is called before the first frame update
    void Start()
    {
        gameManager = GameObject.Find("GameManager").GetComponent <GameManager>();

        names = PlayerPrefsX.GetStringArray("names", "", 1);
        times = PlayerPrefsX.GetFloatArray("times", 0f, 1);

        if (names[0] == "")
        {
            names[0] = gameManager.playerName;
            times[0] = gameManager.completetimervalue;

            PlayerPrefsX.SetStringArray("names", names);
            PlayerPrefsX.SetFloatArray("times", times);

            winText.text = "You Win " + gameManager.playerName;;


            timerText.text = "You finished at: " + gameManager.completetimervalue;


            leaderboard1.text = names[0] + " " + times[0];
            leaderboard2.text = "No Users yet entered";
            leaderboard3.text = "No Users yet entered";
        }
        else
        {
            p = new PlayerScores();

            List <PlayerScores> playerScore = new List <PlayerScores>();

            for (int x = 0; x < names.Length; x++)
            {
                p         = new PlayerScores();
                p.playerN = names[x];
                p.timeN   = times[x];

                playerScore.Add(p);
                playerScore.Sort((p1, p2) => p1.timeN.CompareTo(p2.timeN));
            }

            p         = new PlayerScores();
            p.playerN = gameManager.playerName;
            p.timeN   = gameManager.completetimervalue;

            playerScore.Add(p);

            System.Array.Resize(ref names, names.Length + 1);
            System.Array.Resize(ref times, times.Length + 1);

            names[names.Length - 1] = gameManager.playerName;
            times[times.Length - 1] = gameManager.completetimervalue;

            PlayerPrefsX.SetStringArray("names", names);
            PlayerPrefsX.SetFloatArray("times", times);

            winText.text = "You Win " + p.playerN;

            timerText.text = "You finished at: " + p.timeN;


            if (names.Length <= 2)
            {
                playerScore.Sort((p1, p2) => p1.timeN.CompareTo(p2.timeN));

                leaderboard1.text = playerScore[0].playerN + " " + playerScore[0].timeN;
                leaderboard2.text = playerScore[1].playerN + " " + playerScore[1].timeN;
                leaderboard3.text = "No Users yet entered";
            }

            if (names.Length > 2)
            {
                playerScore.Sort((p1, p2) => p1.timeN.CompareTo(p2.timeN));

                leaderboard1.text = playerScore[0].playerN + " " + playerScore[0].timeN;
                leaderboard2.text = playerScore[1].playerN + " " + playerScore[1].timeN;
                leaderboard3.text = playerScore[2].playerN + " " + playerScore[2].timeN;
            }
        }
    }
Esempio n. 27
0
 // Load the color array and the currentDay value to the Player Prefs
 public void loadSettings()
 {
     currentDay = PlayerPrefs.GetInt(currentDayKey, 0);
     times      = PlayerPrefsX.GetFloatArray(timeKey);
     colors     = PlayerPrefsX.GetColorArray(colorsKey);
 }