Пример #1
0
    // Use this for initialization
    void Start()
    {
        Screen.SetResolution(800, 1280, true);
        popupCanvas.enabled = false;
        Player player = Player.getInstance();

        myScore.text = player.total_score.ToString();

        WWWManager wwwManager = WWWManager.getInstance();
        string     result     = wwwManager.GetRank(player.user_id, "total");

        if (result == "")
        {
            popupCanvas.enabled = true;
            popupText.text      = "서버접속실패!";
            return;
        }

        Result res = JsonUtility.FromJson <Result>(result);

        if (res.error == HTTPErrorCode.SUCCESS)
        {
            if (res.data != "")
            {
                myRank.text = (Int32.Parse(res.data) + 1).ToString();
            }
        }

        // 랭킹 1-10 GET
        result = wwwManager.GetAllRank("total");

        if (result == "")
        {
            popupCanvas.enabled = true;
            popupText.text      = "서버접속실패!";
            return;
        }

        res = JsonUtility.FromJson <Result>(result);

        if (res.error == HTTPErrorCode.SUCCESS)
        {
            Rank.list = JsonHelper.FromJson <Rank>(res.data);

            for (int i = 0; i < Rank.list.Length; i++)
            {
                id[Rank.list[i].rank - 1].text    = Rank.list[i].userId;
                score[Rank.list[i].rank - 1].text = Rank.list[i].score.ToString();
            }
        }
    }