Beispiel #1
0
    public void InfoInit(int r, object param, Game_City gameType, object outer, int self)
    {
        GameHistory.Instance.outer_info  = outer;
        GameHistory.Instance.game_type   = gameType;
        GameHistory.Instance.round_local = r + 1;

        round.text = string.Format("{0}", r + 1);

        //南昌麻将 红中麻将 牛牛...
        if (param.GetType().Equals(typeof(RoundRecordScoreInfo)))
        {
            RoundRecordScoreInfo item = (RoundRecordScoreInfo)param;
            int len = item.playerScoreList.Count;
            for (int i = 0; i < playerScores.Length; i++)
            {
                if (i < len)
                {
                    playerScores[i].text = string.Format("{0}", item.playerScoreList[i]);
                    if (item.playerScoreList[i] >= 0)
                    {
                        playerScores[i].color = new Color(209 / 255f, 89 / 255f, 0f);
                    }
                    else if (item.playerScoreList[i] < 0)
                    {
                        playerScores[i].color = Color.red;
                    }

                    if (i == self)
                    {
                        playerScores[i].color = new Color(1f, 126 / 255f, 0f);;
                    }
                }
                else
                {
                    playerScores[i].text = "";
                }
            }

            UIEventListener.Get(backplayBtn.gameObject).onClick = obj =>
            {
                long id = item.playbackRecordID;
                Debug.Log("playbackRecordID:" + id);
                //发送协议通讯
                CMDAskHandle.Instance.GetRecordDetailAsk(id);
            };
        }
        //十三水
        if (param.GetType().Equals(typeof(RoundPlayRecordScore)))
        {
            RoundPlayRecordScore item = (RoundPlayRecordScore)param;
            int len = item.playerScores.Count;
            for (int i = 0; i < playerScores.Length; i++)
            {
                if (i < len)
                {
                    playerScores[i].text = string.Format("{0}", item.playerScores[i]);
                    if (item.playerScores[i] >= 0)
                    {
                        playerScores[i].color = new Color(209 / 255f, 89 / 255f, 0f);
                    }
                    else if (item.playerScores[i] < 0)
                    {
                        playerScores[i].color = Color.red;
                    }
                    if (i == self)
                    {
                        playerScores[i].color = new Color(1f, 126 / 255f, 0f);;
                    }
                }
                else
                {
                    playerScores[i].text = "";
                }
            }
            UIEventListener.Get(backplayBtn.gameObject).onClick = obj =>
            {
                long id = item.playbackRecordID;
                Debug.Log("playbackRecordID:" + id);
                //发送协议通讯
                CMDAskHandle.Instance.GetRecordDetailAsk(id);
            };
        }
    }
Beispiel #2
0
    public void InitSubList(object param)
    {
        if (param == null)
        {
            Debug.Log("战绩数据不可用");
            return;
        }
        for (int i = 0; i < SubItemObj.Count; i++)
        {
            Destroy(SubItemObj[i].gameObject);
        }
        SubItemObj.Clear();

        for (int i = 0; i < panel2playerNames.Length; i++)
        {
            panel2playerNames[i].color = new Color(150 / 255f, 77 / 255f, 9 / 255f);
        }

        panel1.gameObject.SetActive(false);
        panel2.gameObject.SetActive(true);
        closeBtn.gameObject.SetActive(false);
        backBtn.gameObject.SetActive(true);

        if (param.GetType().Equals(typeof(OuterItem)))
        {
            Debug.Log("南昌");

            int       selfline = 0;
            OuterItem his      = (OuterItem)param;
            int       len      = his.player_info.Count;
            for (int i = 0; i < panel2playerNames.Length; i++)
            {
                if (i < len)
                {
                    panel2playerNames[i].text = string.Format("{0}", his.player_info[i].name);
                    if (his.player_info[i].player_id == Util.getSelfID())
                    {
                        selfline = i;
                        panel2playerNames[i].color = new Color(1f, 157 / 255f, 16 / 255f);
                    }
                }
                else
                {
                    panel2playerNames[i].text = "";
                }
            }

            for (int i = 0; i < his.round_play_record_scores.Count; i++)
            {
                RoundPlayRecordScore fo   = his.round_play_record_scores[i];
                SubHistoryItem       item = Instantiate(item2, parent2.transform).GetComponent <SubHistoryItem>();
                item.gameObject.transform.localPosition = Vector3.zero;
                item.gameObject.transform.localRotation = Quaternion.identity;
                item.gameObject.transform.localScale    = Vector3.one;
                item.InfoInit(i, fo, Game_City.RedCenter, his, selfline);
                SubItemObj.Add(item);
            }
        }
        if (param.GetType().Equals(typeof(WaterOuterItem)))
        {
            Debug.Log("十三水");
            int            selfline = 0;
            WaterOuterItem his      = (WaterOuterItem)param;
            int            len      = his.playerInfoList.Count;
            for (int i = 0; i < panel2playerNames.Length; i++)
            {
                if (i < len)
                {
                    panel2playerNames[i].text = string.Format("{0}", his.playerInfoList[i].name);
                    if (his.playerInfoList[i].playerId == Util.getSelfID())
                    {
                        selfline = i;
                        panel2playerNames[i].color = new Color(1f, 157 / 255f, 16 / 255f);
                    }
                }
                else
                {
                    panel2playerNames[i].text = "";
                }
            }

            for (int i = 0; i < his.roundRecordScoreList.Count; i++)
            {
                RoundRecordScoreInfo fo   = his.roundRecordScoreList[i];
                SubHistoryItem       item = Instantiate(item2, parent2.transform).GetComponent <SubHistoryItem>();
                item.gameObject.transform.localPosition = Vector3.zero;
                item.gameObject.transform.localRotation = Quaternion.identity;
                item.gameObject.transform.localScale    = Vector3.one;
                item.InfoInit(i, fo, Game_City.FuJian, his, selfline);
                SubItemObj.Add(item);
            }
        }
        if (param.GetType().Equals(typeof(HZMJOuterItem)))
        {
            Debug.Log("红中");

            int           selfline = 0;
            HZMJOuterItem his      = (HZMJOuterItem)param;
            int           len      = his.player_info.Count;
            for (int i = 0; i < panel2playerNames.Length; i++)
            {
                if (i < len)
                {
                    panel2playerNames[i].text = string.Format("{0}", his.player_info[i].name);
                    if (his.player_info[i].player_id == Util.getSelfID())
                    {
                        selfline = i;
                        panel2playerNames[i].color = new Color(1f, 157 / 255f, 16 / 255f);
                    }
                }
                else
                {
                    panel2playerNames[i].text = "";
                }
            }

            for (int i = 0; i < his.round_play_record_scores.Count; i++)
            {
                RoundPlayRecordScore fo   = his.round_play_record_scores[i];
                SubHistoryItem       item = Instantiate(item2, parent2.transform).GetComponent <SubHistoryItem>();
                item.gameObject.transform.localPosition = Vector3.zero;
                item.gameObject.transform.localRotation = Quaternion.identity;
                item.gameObject.transform.localScale    = Vector3.one;
                item.InfoInit(i, fo, Game_City.RedCenter, his, selfline);
                SubItemObj.Add(item);
            }
        }
        if (param.GetType().Equals(typeof(NiuNiuOuterItem)))
        {
            Debug.Log("牛牛");

            int             selfline = 0;
            NiuNiuOuterItem his      = (NiuNiuOuterItem)param;
            int             len      = his.playerInfoList.Count;
            for (int i = 0; i < panel2playerNames.Length; i++)
            {
                if (i < len)
                {
                    panel2playerNames[i].text = string.Format("{0}", his.playerInfoList[i].name);
                    if (his.playerInfoList[i].playerId == Util.getSelfID())
                    {
                        selfline = i;
                        panel2playerNames[i].color = new Color(1f, 157 / 255f, 16 / 255f);
                    }
                }
                else
                {
                    panel2playerNames[i].text = "";
                }
            }

            for (int i = 0; i < his.roundRecordScoreList.Count; i++)
            {
                RoundRecordScoreInfo fo   = his.roundRecordScoreList[i];
                SubHistoryItem       item = Instantiate(item2, parent2.transform).GetComponent <SubHistoryItem>();
                item.gameObject.transform.localPosition = Vector3.zero;
                item.gameObject.transform.localRotation = Quaternion.identity;
                item.gameObject.transform.localScale    = Vector3.one;
                item.InfoInit(i, fo, Game_City.CowCow, his, selfline);
                SubItemObj.Add(item);
            }
        }
        if (param.GetType().Equals(typeof(PhzOuterItem)))
        {
            Debug.Log("跑胡子");

            int          selfline = 0;
            PhzOuterItem his      = (PhzOuterItem)param;
            int          len      = his.player_info.Count;
            for (int i = 0; i < panel2playerNames.Length; i++)
            {
                if (i < len)
                {
                    panel2playerNames[i].text = string.Format("{0}", his.player_info[i].name);
                    if (his.player_info[i].player_id == Util.getSelfID())
                    {
                        selfline = i;
                        panel2playerNames[i].color = new Color(1f, 157 / 255f, 16 / 255f);
                    }
                }
                else
                {
                    panel2playerNames[i].text = "";
                }
            }

            for (int i = 0; i < his.round_play_record_scores.Count; i++)
            {
                RoundPlayRecordScore fo   = his.round_play_record_scores[i];
                SubHistoryItem       item = Instantiate(item2, parent2.transform).GetComponent <SubHistoryItem>();
                item.gameObject.transform.localPosition = Vector3.zero;
                item.gameObject.transform.localRotation = Quaternion.identity;
                item.gameObject.transform.localScale    = Vector3.one;
                item.InfoInit(i, fo, Game_City.RedCenter, his, selfline);
                SubItemObj.Add(item);
            }
        }
    }