Ejemplo n.º 1
0
        private void OnFreePlayFlowCoordinatorFinished(FlowCoordinator unused)
        {
            if (_freePlayFlowCoordinator is SoloFreePlayFlowCoordinator)
            {
                (_freePlayFlowCoordinator as SoloFreePlayFlowCoordinator).didFinishEvent -= OnFreePlayFlowCoordinatorFinished;
            }
            else if (_freePlayFlowCoordinator is PartyFreePlayFlowCoordinator)
            {
                (_freePlayFlowCoordinator as PartyFreePlayFlowCoordinator).didFinishEvent -= OnFreePlayFlowCoordinatorFinished;
            }
            else if (_freePlayFlowCoordinator is CampaignFlowCoordinator)
            {
                (_freePlayFlowCoordinator as CampaignFlowCoordinator).didFinishEvent -= OnFreePlayFlowCoordinatorFinished;
            }

            // unapply filters before leaving the screen
            if (FilterList.AnyApplied == true)
            {
                UnapplyFilters();

                SongBrowserTweaks.FiltersUnapplied();
            }

            _freePlayFlowCoordinator = null;
        }
        private void FilterViewControllerFiltersUnapplied()
        {
            LevelsViewController.SetData(_lastPack);

            if (!SongBrowserTweaks.ModLoaded)
            {
                FilterButton.SetButtonText(FilterButtonText);
                FilterButton.SetButtonTextSize(3f);

                // if the clear button is shown, then that was pressed to clear filters
                // therefore, it should currently be highlighted
                if ((ClearButton as NoTransitionsButton).selectionState == NoTransitionsButton.SelectionState.Highlighted)
                {
                    ClearButton.SetButtonText(ClearFilterButtonHighlightedText);
                }
                else
                {
                    ClearButton.SetButtonText(ClearFilterButtonText);
                }
            }
            else
            {
                SongBrowserTweaks.FiltersUnapplied();
            }
        }
        private void OnFreePlayFlowCoordinatorFinished(FlowCoordinator unused)
        {
            if (_freePlayFlowCoordinator is SoloFreePlayFlowCoordinator)
            {
                (_freePlayFlowCoordinator as SoloFreePlayFlowCoordinator).didFinishEvent -= OnFreePlayFlowCoordinatorFinished;
            }
            else if (_freePlayFlowCoordinator is PartyFreePlayFlowCoordinator)
            {
                (_freePlayFlowCoordinator as PartyFreePlayFlowCoordinator).didFinishEvent -= OnFreePlayFlowCoordinatorFinished;
            }
            else if (_freePlayFlowCoordinator is CampaignFlowCoordinator)
            {
                (_freePlayFlowCoordinator as CampaignFlowCoordinator).didFinishEvent -= OnFreePlayFlowCoordinatorFinished;
            }

            ToggleButtonsActive(false);
            BeatSaverDownloaderTweaks.HideTopButtons();

            // unapply filters before leaving the screen
            if (_filterViewController?.IsFilterApplied == true)
            {
                UnapplyFilters();

                SongBrowserTweaks.FiltersUnapplied();
            }

            _freePlayFlowCoordinator = null;
        }
        private void LevelPackSelected(LevelPacksViewController viewController, IBeatmapLevelPack levelPack)
        {
            var previousPack = _lastPack;

            if (levelPack.packName != FilteredSongsPackName)
            {
                _lastPack = levelPack;
            }

            if (SongBrowserTweaks.ModLoaded && SongBrowserTweaks.Initialized)
            {
                // on the new version of SongBrowser, selecting the same level pack should have no changes to what is shown
                // unless it is an OST song pack (which we then clear the filter)
                IPreviewBeatmapLevel[] levels = levelPack.beatmapLevelCollection.beatmapLevels;
                if (previousPack != levelPack || (levels.Length > 0 && !(levels[0] is CustomPreviewBeatmapLevel)))
                {
                    if (_filterViewController != null)
                    {
                        _filterViewController.UnapplyFilters(false);
                    }
                    SongBrowserTweaks.FiltersUnapplied();
                }
            }
            else
            {
                UnapplyFilters();
            }
        }
Ejemplo n.º 5
0
        private void FilterFlowCoordinatorFiltersUnapplied()
        {
            if (SongBrowserTweaks.ModLoaded)
            {
                SongBrowserTweaks.FiltersUnapplied();
            }
            else
            {
                if (_lastPack != null)
                {
                    if (!SongSortModule.IsDefaultSort)
                    {
                        _levelsToApply = _sortedLevelsLevelPack.SetupFromLevelCollection(_lastPack);
                    }
                    else
                    {
                        _levelsToApply = _lastPack;
                    }
                }
                else        // this should never happen (_lastPack should always be defined by this point)
                {
                    Logger.log.Warn("Unable to unapply filters (could not find previous level pack)");
                }

                ButtonPanel.instance.SetFilterStatus(false);
            }
        }