/// <summary>
 /// 处理列出房间响应
 /// </summary>
 /// <param name="roomCount">房间个数</param>
 /// <param name="roomInfoList">房间信息列表</param>
 public void HandleListRoomResponse(int roomCount, List <RoomInfo> roomInfoList)
 {
     if (roomCount == 0)
     {
         Debug.Log("没有房间");
         //没有房间-更改标志位,后交给Update处理
         _roomListState = RoomListState.Empty;
     }
     else
     {
         Debug.Log("有房间");
         //有房间-赋值给该面板的roomInfoList-更改标志位,后交给Update处理
         this._roomInfoList = roomInfoList;
         _roomListState     = RoomListState.Have;
     }
 }
    void Update()
    {
        #region 列出房间列表的操作
        if (_roomListState == RoomListState.Have)
        {
            //有房间
            LoadRoomItem(_roomInfoList);
            //设置房间数量指示器
            SetRoomCountText(_roomInfoList.Count);
            _roomListState = RoomListState.Standby;
        }
        else if (_roomListState == RoomListState.Empty)
        {
            //没有房间-
            //先判断Layout下有无子物体,若有得清空。【不然会产生计数器显示0但有条目的BUG】
            if (_layout.transform.childCount > 0)
            {
                foreach (Transform roomItem in _layout.transform)
                {
                    roomItem.GetComponent <RoomItem>().DestroySelf();
                }
            }
            //设置房间数量指示器
            SetRoomCountText(0);
            _roomListState = RoomListState.Standby;
        }
        #endregion

        #region 加入房间的操作-非房主
        if (_joinRoomState == ActionState.Failed)
        {
            //给出提示信息-无法加入房间
            MessagePanel msgPanel = GameFacade.Instance.UiManager.PushPanel(PanelType.Message) as MessagePanel;
            msgPanel.ShowTipsMsg("无法加入房间");

            _joinRoomState = ActionState.StandBy;
        }
        else if (_joinRoomState == ActionState.Success)
        {
            //能够加入房间-开启房间面板,并设置房间信息
            RoomPanel roomPanel = GameFacade.Instance.UiManager.PushPanel(PanelType.Room) as RoomPanel;
            roomPanel.SetP1Info(_userListInRoom[0].Username, _scoreListInRoom[0].TotalCount, _scoreListInRoom[0].WinCount);
            roomPanel.SetP2Info(_userListInRoom[1].Username, _scoreListInRoom[1].TotalCount, _scoreListInRoom[1].WinCount);
            //作为P2玩家不可点击开始游戏-关闭该按钮的可交互性
            roomPanel.startGameBtn.interactable = false;

            _joinRoomState = ActionState.StandBy;
        }


        #endregion

        #region 游戏结束后更新战绩
        if (_updatePlayerInfoState == UpdatePlayerInfoState.Execute)
        {
            UpdateShowPlayerInfo(GameFacade.Instance.PlayerManager.currentLoginedUser.Id, GameFacade.Instance.PlayerManager.currentLoginedUser.Username, GameFacade.Instance.PlayerManager.currentUserScore.TotalCount, GameFacade.Instance.PlayerManager.currentUserScore.WinCount);

            _updatePlayerInfoState = UpdatePlayerInfoState.StandBy;
        }
        #endregion
    }