예제 #1
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);
            }
        }
    }
예제 #2
0
    public void InfoInit(Record data)
    {
        for (int i = 0; i < playerinfos.Length; i++)
        {
            playerinfos[i].gameObject.SetActive(false);
        }
        item_his = null;

        switch ((Game_City)data.gameEnum)
        {
        case Game_City.NanChang:
        {
            gameName.text = "麻将--南昌麻将";
            OuterItem HisList = fastJSON.JSON.ToObject <OuterItem>(data.record);
            item_his    = HisList;
            roomId.text = HisList.room_info.room_id.ToString();
            DateTime dt = Util.StampToDateTime(HisList.room_info.game_end_time);
            timeTxt.text = string.Format("{0:yyyy-MM-dd}", dt) + "\n" + string.Format("{0:HH:mm:ss}", dt);

            for (int i = 0; i < HisList.player_info.Count; i++)
            {
                playerinfos[i].gameObject.SetActive(true);
                playerinfos[i].text = string.Format("{0}:{1}", HisList.player_info[i].name, HisList.player_info[i].score);
                if (HisList.player_info[i].player_id == Util.getSelfID())
                {
                    playerinfos[i].color = new Color(1f, 126 / 255f, 0f);
                }
            }
        }
        break;

        case Game_City.CowCow:
        {
            gameName.text = "扑克--牛牛";
            NiuNiuOuterItem HisList = fastJSON.JSON.ToObject <NiuNiuOuterItem>(data.record);
            item_his    = HisList;
            roomId.text = HisList.deskInfo.deskId.ToString();
            DateTime dt = Util.StampToDateTime(HisList.deskInfo.gameEndTime);
            timeTxt.text = string.Format("{0:yyyy-MM-dd}", dt) + "\n" + string.Format("{0:HH:mm:ss}", dt);

            for (int i = 0; i < HisList.playerInfoList.Count; i++)
            {
                playerinfos[i].gameObject.SetActive(true);
                playerinfos[i].text = string.Format("{0}:{1}", HisList.playerInfoList[i].name, HisList.playerInfoList[i].score);
                if (HisList.playerInfoList[i].playerId == Util.getSelfID())
                {
                    playerinfos[i].color = new Color(1f, 126 / 255f, 0f);
                }
            }
        }
        break;

        case Game_City.FuJian:
        {
            gameName.text = "扑克--十三水";
            WaterOuterItem HisList = fastJSON.JSON.ToObject <WaterOuterItem>(data.record);
            item_his    = HisList;
            roomId.text = HisList.deskInfo.deskId.ToString();
            DateTime dt = Util.StampToDateTime(HisList.deskInfo.gameEndTime);
            timeTxt.text = string.Format("{0:yyyy-MM-dd}", dt) + "\n" + string.Format("{0:HH:mm:ss}", dt);

            for (int i = 0; i < HisList.playerInfoList.Count; i++)
            {
                playerinfos[i].gameObject.SetActive(true);
                playerinfos[i].text = string.Format("{0}:{1}", HisList.playerInfoList[i].name, HisList.playerInfoList[i].score);
                if (HisList.playerInfoList[i].playerId == Util.getSelfID())
                {
                    playerinfos[i].color = new Color(1f, 126 / 255f, 0f);
                }
            }
        }
        break;

        case Game_City.Hhchz:
        {
            gameName.text = "跑胡子--扯胡子";
            PhzOuterItem HisList = fastJSON.JSON.ToObject <PhzOuterItem>(data.record);
            item_his    = HisList;
            roomId.text = HisList.room_info.room_id.ToString();
            DateTime dt = Util.StampToDateTime(HisList.room_info.game_end_time);
            timeTxt.text = string.Format("{0:yyyy-MM-dd}", dt) + "\n" + string.Format("{0:HH:mm:ss}", dt);

            for (int i = 0; i < HisList.player_info.Count; i++)
            {
                playerinfos[i].gameObject.SetActive(true);
                playerinfos[i].text = string.Format("{0}:{1}", HisList.player_info[i].name, HisList.player_info[i].score);
                if (HisList.player_info[i].player_id == Util.getSelfID())
                {
                    playerinfos[i].color = new Color(1f, 126 / 255f, 0f);
                }
            }
        }
        break;

        case Game_City.Hhlhq:
        {
            gameName.text = "跑胡子--六胡抢";
        }
        break;

        case Game_City.RedCenter:
        {
            gameName.text = "麻将--红中麻将";
            HZMJOuterItem HisList = fastJSON.JSON.ToObject <HZMJOuterItem>(data.record);
            item_his    = HisList;
            roomId.text = HisList.room_info.room_id.ToString();
            DateTime dt = Util.StampToDateTime(HisList.room_info.game_end_time);
            timeTxt.text = string.Format("{0:yyyy-MM-dd}", dt) + "\n" + string.Format("{0:HH:mm:ss}", dt);

            for (int i = 0; i < HisList.player_info.Count; i++)
            {
                playerinfos[i].gameObject.SetActive(true);
                playerinfos[i].text = string.Format("{0}:{1}", HisList.player_info[i].name, HisList.player_info[i].score);
                if (HisList.player_info[i].player_id == Util.getSelfID())
                {
                    playerinfos[i].color = new Color(1f, 126 / 255f, 0f);
                }
            }
        }
        break;

        default:
            break;
        }
    }