private void rankInfo(MessageBean message) { if (message.statusCode == StatusCode.SUCCESS) { BLOKUSRankInfo bLOKUSRankInfo = ProtobufHelper.DederializerFromBytes <BLOKUSRankInfo>(message.data); GameObject.Find("UIController").SendMessage("updateRankInfo", bLOKUSRankInfo); } }
public void updateRankInfo(BLOKUSRankInfo rankInfo) { foreach (GameObject gameObject in fourPlayersRankInfoList) { Destroy(gameObject); } fourPlayersRankInfoList.Clear(); foreach (GameObject gameObject in twoPlayersRankInfoList) { Destroy(gameObject); } twoPlayersRankInfoList.Clear(); for (int i = 0; i < rankInfo.twoPlayersRankItems.Count; i++) { GameObject rankItemGameObject = Instantiate(rankItem, twoPlayersRankContent.transform, false); twoPlayersRankInfoList.Add(rankItemGameObject); BLOKUSRankItem bLOKUSRankItem = rankInfo.twoPlayersRankItems[i]; RankItemData rankItemData = rankItemGameObject.GetComponent <RankItemData>(); rankItemData.number = i + 1 + ""; rankItemData.account = bLOKUSRankItem.account; rankItemData.rankScore = bLOKUSRankItem.rankScore + ""; rankItemData.winCount = bLOKUSRankItem.winCount; rankItemData.loseCount = bLOKUSRankItem.loseCount; rankItemData.escapeCount = bLOKUSRankItem.escapeCount; rankItemData.ShowRankInfo(); rankItemGameObject.GetComponent <Button>().onClick.AddListener(delegate { onGoToProfilePanel(bLOKUSRankItem.account); }); } for (int i = 0; i < rankInfo.fourPlayersRankItems.Count; i++) { GameObject rankItemGameObject = Instantiate(rankItem, fourPlayersRankContent.transform, false); fourPlayersRankInfoList.Add(rankItemGameObject); BLOKUSRankItem bLOKUSRankItem = rankInfo.fourPlayersRankItems[i]; RankItemData rankItemData = rankItemGameObject.GetComponent <RankItemData>(); rankItemData.number = i + 1 + ""; rankItemData.account = bLOKUSRankItem.account; rankItemData.rankScore = bLOKUSRankItem.rankScore + ""; rankItemData.winCount = bLOKUSRankItem.winCount; rankItemData.loseCount = bLOKUSRankItem.loseCount; rankItemData.escapeCount = bLOKUSRankItem.escapeCount; rankItemData.ShowRankInfo(); rankItemGameObject.GetComponent <Button>().onClick.AddListener(delegate { onGoToProfilePanel(bLOKUSRankItem.account); }); } }