/// <inheritdoc /> /// <summary> /// </summary> public override void Destroy() { BackgroundHelper.Loaded -= OnBackgroundLoaded; BackgroundHelper.Blurred -= OnBackgroundBlurred; MapsetBuffer.ForEach(x => x.Destroy()); base.Destroy(); }
/// <summary> /// Updates all the buttons in the buffer and makes it so that they display /// the correct display status. /// </summary> private void UpdateButtonSelectedStatus() => MapsetBuffer.ForEach(x => { if (x.MapsetIndex == SelectedMapsetIndex) { x.DisplayAsSelected(MapManager.Selected.Value); } else { x.DisplayAsDeselected(); } });
/// <summary> /// Initializes the container with new mapsets. /// </summary> public void InitializeWithNewSets() { lock (MapsetBuffer) { MapsetBuffer.ForEach(x => x.Destroy()); MapsetBuffer.Clear(); var selectedMapIndex = Screen.AvailableMapsets.FindIndex(x => x.Maps.Contains(MapManager.Selected.Value)); if (selectedMapIndex != -1) { SelectedMapsetIndex = selectedMapIndex; SetPoolStartingIndex(); if (View.ActiveContainer == SelectContainerStatus.Mapsets) { ClearAnimations(); X = Width; MoveToX(-28, Easing.OutBounce, 1200); } InitializeMapsetBuffer(); return; } if (Screen.AvailableMapsets.Count <= 0) { return; } SelectedMapsetIndex = 0; SetPoolStartingIndex(); if (View.ActiveContainer == SelectContainerStatus.Mapsets) { ClearAnimations(); X = Width; MoveToX(-28, Easing.OutBounce, 1200); } InitializeMapsetBuffer(); var mapset = Screen.AvailableMapsets[SelectedMapsetIndex]; SelectMap(SelectedMapsetIndex, mapset.PreferredMap ?? mapset.Maps.First(), true); } }