예제 #1
0
    //Playerprefsからランキングを読みだす
    public void LoadLeaderBoard()
    {
        List <string[]> rank = new List <string[]>();

        isEnterPressed = false;
        try
        {
            rank = rankingController.GetRanking(nameField.GetComponent <InputField>().text, gameManager.timeLap);
            for (int i = 0; i < (rank.Count > 3 ? 3 : rank.Count); i++)
            {
                rankText[i].SetActive(true);
                rankText[i].GetComponent <Text>().text = "No." + (i + 1).ToString() + " : " + rank[i][0] + " : " + rank[i][1];
            }

            if (!nameField.GetComponent <InputField>().text.Equals(""))
            {
                if (rank.Count > 3 && gameManager.timeLap > float.Parse(rank[2][1]))
                {
                    current.SetActive(true);
                    current.GetComponent <Text>().text = "You" + " : " + gameManager.timeLap.ToString("N2");
                }
                nameField.GetComponent <InputField>().text = "";
                nameField.SetActive(false);
                SetInstructionText("Press 'R' to Restart Game");
            }
        }
        catch (Exception ex)
        {
            nameField.GetComponent <InputField>().text = "";
            SetInstructionText(ex.Message);
            throw ex;
        }
    }