private void Dispose() { if (!mDisposed) { try { mDisposed = true; mCycleEnded = true; OtanixEnvironment.GetGame().GetRoomManager().QueueActiveRoomRemove(mRoomData); using (var dbClient = OtanixEnvironment.GetDatabaseManager().getQueryreactor()) { GetRoomItemHandler().SaveFurniture(dbClient); saveBots(); } WorkRoomServerMessageThread(); WorkRoomChatServerMessageThread(); ClearMute(); UsersWithRights.Clear(); Bans.Clear(); foreach (var item in GetRoomItemHandler().mFloorItems.Values) { item.Destroy(); } foreach (var item in GetRoomItemHandler().mWallItems.Values) { item.Destroy(); } roomUserManager.Destroy(); roomUserManager = null; chatMessageManager.Destroy(); chatMessageManager = null; roomItemHandling.Destroy(); roomItemHandling = null; if (GetGameManager() != null) { GetGameManager().Destroy(); games = null; } if (GotSoccer()) { GetSoccer().Destroy(); soccer = null; } if (GotWired()) { GetWiredHandler().Destroy(); wiredHandler = null; } if (GotMusicController()) { GetRoomMusicController().Destroy(); musicController = null; } if (GetGameMap() != null) { GetGameMap().Destroy(); gamemap = null; } } catch (Exception e) { Logging.LogCriticalException("Unload of room " + e); } } }