public void Init(YuePaiLog info) { titleText.text = info.curr_round + "/" + info.round + "局"; for (int i = 0; i < info.YuePaiOther.Count; i++) { logText[i].text = (info.YuePaiOther[i].score > 0 ? "+" : "") + info.YuePaiOther[i].score; } }
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); } }
public void Init(YuePaiLog info) { jushuLb.text = info.curr_round + "/" + info.round + "局"; if (info.YuePaiOther.Count > 0) { player0Lb.text = info.YuePaiOther[0].score > 0 ? "+" + info.YuePaiOther[0].score : info.YuePaiOther[0].score.ToString(); } if (info.YuePaiOther.Count > 1) { player1Lb.text = info.YuePaiOther[1].score > 0 ? "+" + info.YuePaiOther[1].score : info.YuePaiOther[1].score.ToString(); } if (info.YuePaiOther.Count > 2) { player2Lb.text = info.YuePaiOther[2].score > 0 ? "+" + info.YuePaiOther[2].score : info.YuePaiOther[2].score.ToString(); } if (info.YuePaiOther.Count > 3) { player3Lb.text = info.YuePaiOther[3].score > 0 ? "+" + info.YuePaiOther[3].score : info.YuePaiOther[3].score.ToString(); } }
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; }
void LoadHorizontalResultItem(YuePaiLog resultInfo) { Instantiate(horizontal_prefab, horizontal_parent.transform).GetComponent <YuepaiHorizontalItem>().Init(resultInfo); }