private void Leave(IUserToken token) { string userId = this._userBiz.GetUser(token).id; List <string> kickedUsers = new List <string>(); this._roomBiz.GetUserRoom(userId, out Room room); PResult result = this._roomBiz.Leave(userId, kickedUsers, out int destroiedRoomId); if (result == PResult.SUCCESS) { int count = kickedUsers.Count; for (int i = 0; i < count; i++) { IUserToken mToken = this._userBiz.GetToken(kickedUsers[i]); mToken.CALL_ROOM_ACMD_LEAVE_ROOM(); } this.BrocastRoomInfo(room); } this.Reply(token, Module.ROOM, Command.QCMD_LEAVE_ROOM, result); if (result == PResult.SUCCESS && destroiedRoomId != -1) { this._hallBiz.Brocast(ProtocolManager.PACKET_HALL_ACMD_BRO_ROOM_DESTROIED(destroiedRoomId)); } }
public void ClientClose(IUserToken token) { User user = this._userBiz.GetUser(token); if (user == null) { return; } if (!this._roomBiz.IsUserInRoom(user.id)) { return; } List <string> kickedUsers = new List <string>(); this._roomBiz.GetUserRoom(user.id, out Room room); PResult result = this._roomBiz.Leave(user.id, kickedUsers, out int destroiedRoomId); if (result == PResult.SUCCESS) { int count = kickedUsers.Count; for (int i = 0; i < count; i++) { IUserToken mToken = this._userBiz.GetToken(kickedUsers[i]); mToken.CALL_ROOM_ACMD_LEAVE_ROOM(); } this.BrocastRoomInfo(room); if (destroiedRoomId != -1) { this._hallBiz.Brocast(ProtocolManager.PACKET_HALL_ACMD_BRO_ROOM_DESTROIED(destroiedRoomId)); } } }