コード例 #1
0
        private _DTO_room_info[] GetRoomDTOList(int from, int length)
        {
            Room[] rooms    = this._hallBiz.GetRoomList(from, length);
            int    count    = rooms.Length;
            var    roomDTOs = new _DTO_room_info[count];

            for (int i = 0; i < count; i++)
            {
                roomDTOs[i] = DTOHelper.GetRoomDTO(rooms[i]);
            }
            return(roomDTOs);
        }
コード例 #2
0
        private void CreateRoom(IUserToken token, string name)
        {
            string  userId = this._userBiz.GetUser(token).id;
            PResult result = this._roomBiz.Create(userId, name, out Room room);

            this.Reply(token, Module.HALL, Command.QCMD_CREATE_ROOM, result);
            if (result == PResult.SUCCESS)
            {
                BizFactory.HALL_BIZ.Brocast(ProtocolManager.PACKET_HALL_ACMD_BRO_ROOM_CREATED(DTOHelper.GetRoomDTO(room)));
                //把玩家放进房间
                result = this._roomBiz.Join(userId, room);
                if (result != PResult.SUCCESS)
                {
                    this.Reply(token, Module.HALL, Command.QCMD_CREATE_ROOM, result);
                }
                else
                {
                    token.CALL_HALL_ACMD_JOIN_ROOM(room.id);
                }
            }
        }