Ejemplo n.º 1
0
    public void Inits(YuePaiTable info)
    {
        if (info == null)
        {
            //请求约牌记录
            SocketClient.Instance.AddSendMessageQueue(new C2GMessage()
            {
                msgid = MessageId.C2G_YuePaiTable
            });
            return;
        }
        curYuepaiTable  = info;
        gameTypeLb.text = info.type;
        roomInfoLb.text = "房卡房<color=#01AEFA>" + info.yuePaiLog[info.yuePaiLog.Count - 1].curr_round + "</color>" + "次对局";

        GetCodeTextrue();

        DateTime dataTime = MiscUtils.GetDateTimeByTimeStamp(info.playat / 1000);

        timeLb.text = string.Format("{0}月{1}日{2}:{3}", dataTime.Month.ToString("D2"), dataTime.Day.ToString("D2"), dataTime.Hour.ToString("D2"), dataTime.Minute.ToString("D2"));
        //加载总体
        UIUtils.DestroyChildren(vertical_parent);
        for (int i = 0; i < info.yuePaiLog[0].YuePaiOther.Count; i++)
        {
            YuePaiOther playerInfo = info.yuePaiLog[0].YuePaiOther[i];
            int         allRessult = 0;
            for (int j = 0; j < info.yuePaiLog.Count; j++)
            {
                for (int k = 0; k < info.yuePaiLog[j].YuePaiOther.Count; k++)
                {
                    if (info.yuePaiLog[j].YuePaiOther[k].userId == playerInfo.userId)
                    {
                        allRessult += info.yuePaiLog[j].YuePaiOther[k].score;
                    }
                }
            }
            YuepaiLogPlayerInfo logInfo = new YuepaiLogPlayerInfo();
            logInfo.userId    = playerInfo.userId;
            logInfo.nickname  = playerInfo.userName;
            logInfo.allResult = allRessult; print(playerInfo.icon);
            logInfo.headIcon  = playerInfo.icon;
            playerInfos.Add(logInfo);
        }
        YuepaiLogPlayerInfo maxInfos = ArrayHelper.Max <YuepaiLogPlayerInfo, int>(playerInfos.ToArray(), p => p.allResult);

        maxInfos.isMax = true;
        for (int i = 0; i < playerInfos.Count; i++)
        {
            LoadVerticalResultItem(playerInfos[i]);
        }

        info.yuePaiLog.Sort((a, b) =>
        {
            return(a.curr_round.CompareTo(b.curr_round));
        });
        //加载详情
        for (int i = 0; i < info.yuePaiLog.Count; i++)
        {
            YuePaiLog result = info.yuePaiLog[i];
            LoadHorizontalResultItem(result);
        }
        horizontal_parent.spacing = 427 / horizontal_parent.transform.childCount;
    }
Ejemplo n.º 2
0
 void LoadVerticalResultItem(YuepaiLogPlayerInfo info)
 {
     Instantiate(vertical_prefab, vertical_parent).GetComponent <YuepaiResultItem>().Inits(info);
 }