Пример #1
0
    /// <summary>
    /// 加载分享信息
    /// </summary>
    /// <param name="playerInfos"></param>
    /// <param name="info"></param>
    void LoadShareInfos()
    {
        shareInfos.Clear();
        //1.名次排序
        playerInfos.Sort((a, b) =>
        {
            return(-a.allResult.CompareTo(b.allResult));
        });

        //2.加载基础信息 name headIcon score rank
        for (int i = 0; i < playerInfos.Count; i++)
        {
            ShareItemInfo itemInfo = new ShareItemInfo();
            itemInfo.name     = playerInfos[i].nickname;
            itemInfo.headIcon = playerInfos[i].headIconSpr;
            itemInfo.score    = playerInfos[i].allResult;
            itemInfo.rank     = i + 1;

            itemInfo.winCount = 0;
            //3.加载赢的局数
            for (int j = 0; j < curYuepaiTable.yuePaiLog.Count; j++)
            {
                YuePaiOther other = curYuepaiTable.yuePaiLog[j].YuePaiOther.Find(p => p.userId == playerInfos[i].userId);
                if (other.score > 0)
                {
                    itemInfo.winCount++;
                }
            }

            shareInfos.Add(itemInfo);
        }
    }
Пример #2
0
    public void Inits(YuePaiTable info, CallBack <YuePaiTable> chakanCall)
    {
        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"));
        gameTypeLb.text = info.type;
        jushuLb.text    = info.round.ToString();

        for (int i = 0; i < info.yuePaiLog[0].YuePaiOther.Count; i++)
        {
            if (info.yuePaiLog[0].YuePaiOther[i].userId != UserInfoModel.userInfo.userId)
            {
                continue;
            }
            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;
                    }
                }
            }
            myResultLb.text = allRessult > 0 ? "+" + allRessult + "分" : allRessult + "分";
        }
        otherPlayersLb.text = info.other_user;
        UGUIEventListener.Get(chakanBtn).onClick = delegate { chakanCall(info); };
    }
Пример #3
0
    void Load(YuePaiTable info)
    {
        //加载总体
        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;
                    }
                }
            }
            CardResultShowNode.YuepaiLogPlayerInfo logInfo = new CardResultShowNode.YuepaiLogPlayerInfo();
            logInfo.userId    = playerInfo.userId;
            logInfo.nickname  = playerInfo.userName;
            logInfo.allResult = allRessult; print(playerInfo.icon);
            logInfo.headIcon  = playerInfo.icon;
            playerInfos.Add(logInfo);
        }
        CardResultShowNode.YuepaiLogPlayerInfo maxInfos = ArrayHelper.Max <CardResultShowNode.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);
        }
    }
Пример #4
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;
    }