Exemplo n.º 1
0
    public void LoadRankList()
    {
        Dictionary <int, JSONObject> mapRankList = null;
        float fUnit          = 0.0f;
        float fStartYpos     = 0.0f;
        float fContentHeight = 0.0f;

        fUnit          = 50.0f;
        fStartYpos     = -20.0f;
        fContentHeight = 50.0f;
        mapRankList    = RankSingleton.GetInstance().GetRankerList(m_eCurrentTab);

        Debug.Log("RankListLength : " + mapRankList.Count.ToString());

        foreach (KeyValuePair <int, JSONObject> item in mapRankList)
        {
            int           nUserRank     = 0;
            RankCell      rankCell      = null;
            GameObject    objRankCell   = null;
            JSONObject    objUserInfo   = null;
            RectTransform rectTransform = null;

            nUserRank     = item.Key;
            objUserInfo   = item.Value;
            objRankCell   = RankCellPool.GetInstance().EnableObject();
            rankCell      = objRankCell.GetComponent <RankCell>();
            rectTransform = objRankCell.GetComponent <RectTransform>();

            rankCell.SetData(objUserInfo);
            objRankCell.transform.SetParent(transform);

            rectTransform.localPosition = new Vector2(0.0f, fStartYpos);
            rectTransform.offsetMin     = new Vector2(20.0f, fStartYpos);
            rectTransform.offsetMax     = new Vector2(-20.0f, fStartYpos);

            rectTransform.SetDefaultScale();
            rectTransform.SetHeight(40.0f);

            fStartYpos     -= fUnit;
            fContentHeight += fUnit;
        }

        GetComponent <RectTransform>().SetHeight(fContentHeight);
    }
Exemplo n.º 2
0
 private void LoadFriendRank()
 {
     RankSingleton.GetInstance().LoadFriendRank(UpdateDelegate);
 }