コード例 #1
0
ファイル: HistroyGradeRoom.cs プロジェクト: vampire801/anhui
        void UpdateChildrenCallback(int index_, Transform trans)
        {
            HistroyGradeRound round = trans.GetComponent <HistroyGradeRound>();

            round.RoundData = Grade_RoundData_[index_];
            round.UpdateShow(index_ + 1);
        }
コード例 #2
0
ファイル: HistroyGradeRoom.cs プロジェクト: vampire801/anhui
        public void SpwanHistroyGrade_Round()
        {
            // Debug.LogError("开始产生对应的战绩预置体");

            UIMainView.Instance.HistroyGradePanel.GradeRect_Round.transform.Find("Content").GetComponent <GridLayoutGroup>().enabled   = true;
            UIMainView.Instance.HistroyGradePanel.GradeRect_Round.transform.Find("Content").GetComponent <ContentSizeFitter>().enabled = true;
            int count = Grade_RoundData_.Count;

            if (count <= 0)
            {
                MahjongCommonMethod.Instance.ShowRemindFrame("本条记录没有战绩");
                return;
            }

            if (count > 5)
            {
                HistroyGradePanelData hgpd = GameData.Instance.HistroyGradePanelData;
                for (int i = 0; i < 5; i++)
                {
                    GameObject go = Instantiate(Resources.Load <GameObject>("Lobby/HistroyGrade/HistroyGrade_Round"));
                    go.transform.SetParent(UIMainView.Instance.HistroyGradePanel.GradeRect_Round.transform.Find("Content"));
                    go.transform.localEulerAngles = Vector3.zero;
                    go.transform.localPosition    = new Vector3(go.transform.localPosition.x, go.transform.localPosition.y, 0);
                    go.transform.localScale       = Vector3.one;
                    go.name = "HistroyGrade_Round_" + i;
                    UIMainView.Instance.HistroyGradePanel.GradeRect_Round.transform.Find("Content").
                    GetComponent <InfinityGridLayoutGroup>().children.Add(go.GetComponent <RectTransform>());
                    // Debug.Log ("go.name:" + go.name);
                }

                //初始化数据列表;
                infinityGridLayoutGroup = UIMainView.Instance.HistroyGradePanel.GradeRect_Round.transform.Find("Content").GetComponent <InfinityGridLayoutGroup>();
                infinityGridLayoutGroup.Init();
                infinityGridLayoutGroup.SetAmount(Grade_RoundData_.Count);
                infinityGridLayoutGroup.updateChildrenCallback = UpdateChildrenCallback;
            }
            else
            {
                for (int i = 0; i < count; i++)
                {
                    GameObject go = Instantiate(Resources.Load <GameObject>("Lobby/HistroyGrade/HistroyGrade_Round"));
                    go.transform.SetParent(UIMainView.Instance.HistroyGradePanel.GradeRect_Round.transform.Find("Content"));
                    go.transform.localEulerAngles = Vector3.zero;
                    go.transform.localPosition    = new Vector3(go.transform.localPosition.x, go.transform.localPosition.y, 0);
                    go.transform.localScale       = Vector3.one;
                    go.name = "HistroyGrade_Round_" + i;
                    HistroyGradeRound round = go.GetComponent <HistroyGradeRound>();
                    round.RoundData = Grade_RoundData_[i];
                    round.UpdateShow(i + 1);
                }

                //初始化数据列表;
                infinityGridLayoutGroup = UIMainView.Instance.HistroyGradePanel.GradeRect_Round.transform.Find("Content").GetComponent <InfinityGridLayoutGroup>();
                infinityGridLayoutGroup.Init();
                infinityGridLayoutGroup.SetAmount(Grade_RoundData_.Count);
                infinityGridLayoutGroup.updateChildrenCallback = UpdateChildrenCallback;
            }
        }