public void RemoveRoom(ProceduralRoom room) { m_rooms.Remove(room.RoomID); m_roomTree.RemoveProxy(room.m_aabbProxyID); if (m_roomsSafeOrder[m_roomsSafeOrder.Count - 1] == room) { m_roomsSafeOrder.RemoveAt(m_roomsSafeOrder.Count - 1); } else { m_roomsSafeOrder.Remove(room); Logger.Warning("Possibly unsafe removal of room not at end of safe list"); } foreach (var k in room.MountPoints) { foreach (var p in k.MountLocations) { if (!m_mountPoints.Remove(p)) { Logger.Warning("Failed to remove room; mount point wasn't registered"); } } } room.Orphan(); using (room.Part.LockSharedUsing()) BlockSetInfo.SubtractFromSelf(room.Part.BlockSetInfo); RoomRemoved?.Invoke(room); }
/// <summary> /// Удалить номер по идентификатору /// </summary> /// <param name="roomKey"></param> public void RemoveRoom(int roomKey) { _rooms.Remove(roomKey); //Генерируем событие о том, что номер удалён RoomRemoved?.Invoke(roomKey, EventArgs.Empty); //Получаем список сведений о поселении в номер var settlementsForRoom = Settlements.Where(s => s.Room.Number == roomKey).ToList(); for (int i = 0; i < settlementsForRoom.Count; i++) { //Удаляем сведения о поселении в номер RemoveSettlement(settlementsForRoom[i]); } }
internal void RemoveRoom(Room room) { if (room == null) { return; } if (!_rooms.TryRemove(room.Guid, out var removed)) { Debug.LogWarning($"Tried to remove {removed}, but it wasn't in the list of rooms"); //we'll still send messages and stuff regarding this, just in case people didn't get it. or something. } else if (removed != room) { Debug.LogError($"Removed {removed}, but we were attempting to remove {room}"); } try { RoomRemoved?.Invoke(room); } catch (Exception e) { Debug.LogException(e); } var msg = GetMessage(18); msg.Write(RpcUtils.GetHeader(ReliabilityMode.Ordered, BroadcastMode.Server, MsgType.Internal)); msg.Write(DandRRpcs.RoomRemove); msg.Write(room.Guid); SendToOtherRooms(room, msg, ReliabilityMode.Ordered); Player[] players; lock (_players) players = _players.Values; foreach (var player in players) { if (player == null) { continue; } if (player.SwitchingToRoom == room.Guid) { player.OnSwitchingToRoomInvalidated(); } } }
private void RemoveRoom(Room room) { if (room == null) { return; } Room removed; _rooms.TryRemove(room.Guid, out removed); if (removed != room) { Debug.LogError($"Removed {removed}, but we were attempting to remove {room}"); } try { RoomRemoved?.Invoke(removed); } catch (Exception e) { Debug.LogException(e); } var msg = GetMessage(18); msg.Write(RpcUtils.GetHeader(ReliabilityMode.Ordered, BroadcastMode.Server, MsgType.Internal)); msg.Write(DandRRpcs.RoomRemove); msg.Write(removed.Guid); removed.SendMessageToOthers(msg, ReliabilityMode.Ordered); Player[] players; lock (_players) players = _players.Values; foreach (var player in players) { if (player == null) { continue; } if (player.SwitchingToRoom == removed.Guid) { player.OnSwitchingToRoomInvalidated(); } } }
private static void OnRoomRemoved(RoomManager roomManager, Room room) { RoomRemoved?.Invoke(roomManager, new RoomEventArgs(room)); }