/// <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); } }
public void Inits(ShareItemInfo info) { rankLb.text = info.rank.ToString(); winerObj.SetActive(info.rank == 1); headIcon.sprite = info.headIcon; nameLb.text = info.name; winCountLb.text = "胜局:" + info.winCount; scoreLb.text = info.score > 0 ? "+" + info.score + "分" : info.score + "分"; bg.sprite = BundleManager.Instance.GetSprite(info.rank == 1 ? "yuepai/weixinyuepai_panel_yunwenhuang" : "yuepai/weixinyuepai_panel_yunwenqianhuang"); }