Example #1
0
        /// <summary>
        /// 接收服务器的房间内容消息
        /// </summary>
        /// <param name="buffer"></param>
        public void com6210(ByteBuffer buffer)
        {
            while (buffer.Available > 0)
            {
                int      roomId   = buffer.readInt();
                string   roomName = buffer.readString();
                RoomForm room     = new RoomForm();
                room.SetRoomNum(roomId.ToString());
                room.SetRoomName(roomName);

                string password         = buffer.readString();
                int    playerInfoLength = buffer.readInt();
                if (playerInfoLength > 0)
                {
                    string userCname = buffer.readString();
                    int    roomPos   = buffer.readInt();    //每个房间的左右两个位置
                    string isHaveImg = buffer.readString(); //接受图片  “null”:没有
                    if (isHaveImg.Equals("null"))
                    {
                        isHaveImg = null;
                    }

                    room.SetUserName(userCname, isHaveImg, roomPos);
                    playerInfoLength--;
                }
                roomDic.Add(roomId.ToString(), room);
                hallForm.roomContainer.Controls.Add(room);
                //room.Parent = hallForm.roomContains;
            }
        }
Example #2
0
        /// <summary>
        /// 接收服务器消息, 更新大厅某个房间的信息变化
        /// </summary>
        /// <param name="buffer"></param>
        public void com6211(ByteBuffer buffer)
        {
            int    roomId   = buffer.readInt();
            string userName = buffer.readString();

            int    roomPos   = buffer.readInt();    //每个房间的左右两个位置
            string isHaveImg = buffer.readString(); //接受图片  “null”:没有

            if (isHaveImg.Equals("null"))
            {
                isHaveImg = null;
            }
            RoomForm room = roomDic[roomId.ToString()];

            room.SetUserName(userName, isHaveImg, roomPos);
        }