Example #1
0
        private void DismissFilterFlowCoordinator()
        {
            _freePlayFlowCoordinator.InvokeMethod("DismissFlowCoordinator", _filterFlowCoordinator, null, false);
            ButtonPanel.instance.ShowPanel();

            // instead of applying filters inside the filter flow coordinator, apply the filters when the flow coordinator is dismissed
            // that way, we don't get the unity complaining about the LevelSelectionNavigationController being not active
            if (SongBrowserTweaks.Initialized && FilterList.AnyApplied)
            {
                SongBrowserTweaks.ApplyFilters();
            }
            else if (_levelsToApply != null)
            {
                // NOTE: levels should already be sorted
                LevelSelectionNavigationController.SetData(
                    _levelsToApply,
                    true,
                    LevelSelectionNavigationController.GetPrivateField <bool>("_showPlayerStatsInDetailView"),
                    LevelSelectionNavigationController.GetPrivateField <bool>("_showPracticeButtonInDetailView"),
                    null);
                _levelsToApply = null;

                if (_uiAdditions != null)
                {
                    _uiAdditions.RefreshPageButtons();
                }
            }
        }
Example #2
0
        private void ApplySearchFilter(string searchQuery)
        {
            if (string.IsNullOrEmpty(searchQuery))
            {
                _freePlayFlowCoordinator.InvokeMethod("DismissFlowCoordinator", _searchFlowCoordinator, null, false);
                return;
            }

            SearchFilter filter = FilterList.SearchFilter;

            if (filter == null)
            {
                // this should never happen
                Logger.log.Error("Unable to apply search filter (SearchFilter object doesn't exist)");
                return;
            }

            filter.QueryStagingValue        = searchQuery;
            filter.SplitQueryStagingValue   = PluginConfig.SplitQueryByWords;
            filter.SongFieldsStagingValue   = PluginConfig.SongFieldsToSearch;
            filter.StripSymbolsStagingValue = PluginConfig.StripSymbols;
            filter.ApplyStagingValues();

            if (_filterFlowCoordinator != null)
            {
                _filterFlowCoordinator.RefreshUI();
            }

            _freePlayFlowCoordinator.InvokeMethod("DismissFlowCoordinator", _searchFlowCoordinator, null, false);

            if (SongBrowserTweaks.Initialized)
            {
                SongBrowserTweaks.ApplyFilters();
            }
            else
            {
                ButtonPanel.instance.SetFilterStatus(true);
                ButtonPanel.instance.ShowPanel();

                _filteredLevelPack.SetupFromUnfilteredLevels(_lastPack.beatmapLevelCollection.beatmapLevels, _lastPack.coverImage, false);
                LevelSelectionNavigationController.SetData(
                    _filteredLevelPack,
                    true,
                    LevelSelectionNavigationController.GetPrivateField <bool>("_showPlayerStatsInDetailView"),
                    LevelSelectionNavigationController.GetPrivateField <bool>("_showPracticeButtonInDetailView"));

                _uiAdditions.RefreshPageButtons();
            }
        }