/// <summary> /// 摧毁房间 /// </summary> /// <param name="roomId"></param> public void DestroyRoom(int roomId) { SelectRoom room; if (!RoomDict.TryGetValue(roomId, out room)) { return; } // 移除玩家id和房间id的映射 foreach (int item in room.TeamOneDict.Keys) { PlayerRoomDict.Remove(item); } foreach (int item in room.TeamTwoDict.Keys) { PlayerRoomDict.Remove(item); } // 移除房间id和房间的映射 RoomDict.Remove(roomId); // 清空房间内的数据 room.Clear(); // 回收 RoomQue.Enqueue(room); MobaServer.LogInfo("选人房间销毁了"); }
/// <summary> /// 摧毁指定房间 /// </summary> /// <param name="room"></param> public void DestroyRoom(int roomId) { BattleRoom room; if (!RoomDict.TryGetValue(roomId, out room)) { return; } // 移除玩家id和房间id的映射 foreach (DtoHero item in room.HerosArray) { PlayerRoomDict.Remove(item.Id); } // 移除房间id和房间的映射 RoomDict.Remove(roomId); // 清空房间内的数据 room.Clear(); // 回收 RoomQue.Enqueue(room); MobaServer.LogInfo("战斗房间销毁了"); }