protected void RefreshPools(IEnumerable <BeatmapObject> data) { foreach (BeatmapObject unique in data.DistinctBy(x => x.beatmapType)) { BeatmapObjectContainerCollection collection = BeatmapObjectContainerCollection.GetCollectionForType(unique.beatmapType); collection.RefreshPool(true); if (collection is BPMChangesContainer con) { con.RefreshGridShaders(); } } }
public IEnumerator LoadObjects <T>(IEnumerable <T> objects) where T : BeatmapObject { if (!objects.Any()) { yield break; } BeatmapObjectContainerCollection collection = BeatmapObjectContainerCollection.GetCollectionForType(objects.First().beatmapType); if (collection == null) { yield break; } foreach (BeatmapObject obj in collection.LoadedObjects.ToArray()) { collection.DeleteObject(obj, false, false); } PersistentUI.Instance.LevelLoadSlider.gameObject.SetActive(true); collection.LoadedObjects = new SortedSet <BeatmapObject>(objects, new BeatmapObjectComparer()); collection.UnsortedObjects = collection.LoadedObjects.ToList(); UpdateSlider <T>(); if (typeof(T) == typeof(BeatmapNote) || typeof(T) == typeof(BeatmapObstacle)) { for (int i = 0; i < objects.Count(); i++) { BeatmapObject data = objects.ElementAt(i); if (data is BeatmapNote noteData) { if (noteData._lineIndex >= 1000 || noteData._lineIndex <= -1000 || noteData._lineLayer >= 1000 || noteData._lineLayer <= -1000) { continue; } if (2 - noteData._lineIndex > noteLaneSize) { noteLaneSize = 2 - noteData._lineIndex; } if (noteData._lineIndex - 1 > noteLaneSize) { noteLaneSize = noteData._lineIndex - 1; } if (noteData._lineLayer + 1 > noteLayerSize) { noteLayerSize = noteData._lineLayer + 1; } } else if (data is BeatmapObstacle obstacleData) { if (obstacleData._lineIndex >= 1000 || obstacleData._lineIndex <= -1000) { continue; } if (2 - obstacleData._lineIndex > noteLaneSize) { noteLaneSize = 2 - obstacleData._lineIndex; } if (obstacleData._lineIndex - 1 > noteLaneSize) { noteLaneSize = obstacleData._lineIndex - 1; } } } if (Settings.NonPersistentSettings.ContainsKey("NoteLanes")) { Settings.NonPersistentSettings["NoteLanes"] = (noteLaneSize * 2).ToString(); } else { Settings.NonPersistentSettings.Add("NoteLanes", (noteLaneSize * 2).ToString()); } noteLanesController.UpdateNoteLanes((noteLaneSize * 2).ToString()); } if (typeof(T) == typeof(MapEvent)) { manager.RefreshTracks(); EventsContainer events = collection as EventsContainer; events.AllRotationEvents = objects.Cast <MapEvent>().Where(x => x.IsRotationEvent).ToList(); events.AllBoostEvents = objects.Cast <MapEvent>().Where(x => x._type == MapEvent.EVENT_TYPE_BOOST_LIGHTS).ToList(); } collection.RefreshPool(true); }