//收到场中所有玩家信息 public override void playPlayerList2CallBack(Game2PositionPlayerInfoListDto callBackParam) { if (callBackParam != null) { GameMove gameMove = MessageManager.GetInstance.GetUIDict <GameMove>(); gameMove.OtherinfoShow(callBackParam); } }
//收到上庄列表 public override void bankerList2CallBack(Game2PositionPlayerInfoListDto callBackParam) { if (callBackParam != null) { GameMove gameMove = MessageManager.GetInstance.GetUIDict <GameMove>(); Game2PositionPlayerInfoListDto toRoomBankerListDto = callBackParam; gameMove.WaitierBankerList(toRoomBankerListDto); } }
//收到上庄列表 public void WaitierBankerList(Game2PositionPlayerInfoListDto tORoomBankerListDto) { if (tORoomBankerListDto.list != null) { for (int i = 0; i < WaiterListShow.childCount; i++) { Destroy(WaiterListShow.GetChild(i).gameObject); } bankerQuquenum.text = "排队人数:" + tORoomBankerListDto.list.Count + "人"; //根据链表中元素数量生成对应的表格 for (int i = 0; i < tORoomBankerListDto.list.Count; i++) { GameObject go = Instantiate(WaiterBankerlist, WaiterListShow); go.transform.GetChild(2).GetComponent <Text>().text = tORoomBankerListDto.list[i].userName; go.transform.GetChild(3).GetComponent <Text>().text = tORoomBankerListDto.list[i].gold.ToString(); } } }
//收到场中玩家信息 public void OtherinfoShow(Game2PositionPlayerInfoListDto roomPlayerBaseDtos) { //隐藏无座玩家信息 for (int i = 0; i < OtherinfoPanel.GetChild(1).GetChild(0).childCount; i++) { OtherinfoPanel.GetChild(1).GetChild(0).GetChild(i).GetComponent <Button>().onClick.RemoveAllListeners(); OtherinfoPanel.GetChild(1).GetChild(0).GetChild(i).gameObject.SetActive(false); } //玩家页面显示 OtherinfoPanel.gameObject.SetActive(true); if (roomPlayerBaseDtos.list != null) { roomPlayerBasedtos = roomPlayerBaseDtos; OtherinfoPanel.GetChild(3).GetChild(0).GetComponent <Text>().text = roomPlayerBaseDtos.list.Count + "人"; if (roomPlayerBaseDtos.list.Count != 0) { //获取要生成的预设物 GameObject obj = Resources.Load <GameObject>("Prefabs/Game/WanRenChang/ranklist"); //遍历发过来的信息链表 for (int i = 0; i < roomPlayerBaseDtos.list.Count; i++) { //判断父物体有没有生成的预设物 if (OtherinfoPanel.GetChild(1).GetChild(0).childCount > 0) { //遍历子物体 for (int j = 0; j < OtherinfoPanel.GetChild(1).GetChild(0).childCount; j++) { GameObject child = OtherinfoPanel.GetChild(1).GetChild(0).GetChild(j).gameObject; //如果是隐藏 if (child.activeSelf == false) { //更改其信息并显示 child.transform.GetChild(0).GetComponent <Text>().text = roomPlayerBaseDtos.list[i].userName; child.transform.GetChild(1).GetComponent <Text>().text = NumberConvert.ConvertW(roomPlayerBaseDtos.list[i].gold); child.gameObject.SetActive(true); //绑定点击事件 int a = i; child.GetComponent <Button>().onClick.AddListener(delegate() { OtherPlayerOnclick(a); }); break; }//不是隐藏并且是最后一个 else if (j == OtherinfoPanel.GetChild(1).GetChild(0).childCount - 1) { //生成预设物 GameObject clone = Instantiate(obj, OtherinfoPanel.GetChild(1).GetChild(0).transform); clone.transform.GetChild(0).GetComponent <Text>().text = roomPlayerBaseDtos.list[i].userName; clone.transform.GetChild(1).GetComponent <Text>().text = NumberConvert.ConvertW(roomPlayerBaseDtos.list[i].gold); int x = i; clone.GetComponent <Button>().onClick.AddListener(delegate() { OtherPlayerOnclick(x); }); break; } } } else { //生成预设物 GameObject clone = Instantiate(obj, OtherinfoPanel.GetChild(1).GetChild(0).transform); clone.transform.GetChild(0).GetComponent <Text>().text = roomPlayerBaseDtos.list[i].userName; clone.transform.GetChild(1).GetComponent <Text>().text = NumberConvert.ConvertW(roomPlayerBaseDtos.list[i].gold); int j = i; clone.GetComponent <Button>().onClick.AddListener(delegate() { OtherPlayerOnclick(j); }); } } } } else { OtherinfoPanel.GetChild(3).GetChild(0).GetComponent <Text>().text = "0人"; } }
/// <summary> /// ----> <<bankerList();回调>> /// </summary> public virtual void bankerList2CallBack(Game2PositionPlayerInfoListDto callBackParam) { }