Ejemplo n.º 1
0
        private void JoinRoom(IUserToken token, int roomId)
        {
            string  userId = this._userBiz.GetUser(token).id;
            PResult result = this._roomBiz.Get(roomId, out Room room);

            if (result != PResult.SUCCESS)
            {
                this.Reply(token, Module.HALL, Command.QCMD_JOIN_ROOM, result);
            }
            else
            {
                result = this._roomBiz.Join(userId, room);
                if (result == PResult.SUCCESS)
                {
                    token.CALL_HALL_ACMD_JOIN_ROOM(room.id);
                    this._roomBiz.Brocast(room, ProtocolManager.PACKET_ROOM_ACMD_ROOM_INFO(DTOHelper.GetRoomInfoDTO(room)), token);
                }
            }
        }
Ejemplo n.º 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);
                }
            }
        }