Example #1
0
        /// <summary>
        /// 显示排行榜
        /// </summary>
        void ShowRank()
        {
            transform.Find("Rank").gameObject.SetActive(true);
            Transform content = transform.Find("Rank/Viewport/Content");

            for (int i = 0; i < content.childCount; i++)
            {
                Transform node = content.GetChild(i);
                if (node.name == "Node")
                {
                    continue;
                }
                Destroy(node.gameObject);
            }

            List <IDataNode> datas = L_RankManager.Instance.GetRankData("TestRank").ChildrenIDataNode;

            for (int i = 0; i < datas.Count; i++)
            {
                IDataNode  data    = datas[i];
                GameObject newNode = GameObject.Instantiate <GameObject>(mNode, mNode.transform.parent);
                newNode.name = "Node" + (i + 1);
                newNode.GetComponent <Text>().text = "No." + (i + 1) + "\t" + data.GetKey() + "\t" + data.GetValue <int>();
                newNode.SetActive(true);
            }
        }