Exemple #1
0
 //收到场中无座玩家信息
 public void OtherinfoShow(GameDicePositionPlayerInfoListDto roomPlayerBaseDtos)
 {
     //无座页面显示
     OtherinfoPanel.gameObject.SetActive(true);
     if (roomPlayerBaseDtos.playerList != null)
     {
         roomPlayerBasedtos = roomPlayerBaseDtos;
         OtherinfoPanel.GetChild(4).GetChild(0).GetComponent <Text>().text = roomPlayerBaseDtos.playerList.Count + "人";
         if (roomPlayerBaseDtos.playerList.Count != 0)
         {
             //获取要生成的预设物
             GameObject obj = Resources.Load <GameObject>("Prefabs/Game/WanRenChang/ranklist");
             //遍历发过来的信息链表
             for (int i = 0; i < roomPlayerBaseDtos.playerList.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.playerList[i].userName;
                             child.transform.GetChild(1).GetComponent <Text>().text =
                                 NumberConvert.ConvertW(roomPlayerBaseDtos.playerList[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.playerList[i].userName;
                             clone.transform.GetChild(1).GetComponent <Text>().text =
                                 NumberConvert.ConvertW(roomPlayerBaseDtos.playerList[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.playerList[i].userName;
                     clone.transform.GetChild(1).GetComponent <Text>().text =
                         NumberConvert.ConvertW(roomPlayerBaseDtos.playerList[i].gold);
                     int j = i;
                     clone.GetComponent <Button>().onClick.AddListener(delegate() { OtherPlayerOnclick(j); });
                 }
             }
         }
     }
     else
     {
         OtherinfoPanel.GetChild(4).GetChild(0).GetComponent <Text>().text = "0人";
     }
 }
 /// <summary>
 /// 当前房间没在位置上所有的人 ----> <<nowPlayPlayerList();回调>>
 /// </summary>
 public virtual void nowPlayPlayerList2CallBack(GameDicePositionPlayerInfoListDto callBackParam)
 {
 }
Exemple #3
0
    //所有无座玩家
    public override void nowPlayPlayerList2CallBack(GameDicePositionPlayerInfoListDto callBackParam)
    {
        DiceGameMove diceGameMove = MessageManager.GetInstance.GetUIDict <DiceGameMove>();

        diceGameMove.OtherinfoShow(callBackParam);
    }