Ejemplo n.º 1
0
        public void SelectionChanged(IPreviewBeatmapLevel beatmap)
        {
            if (_levelCollectionTableView == null)
            {
                _levelCollectionTableView = Resources.FindObjectsOfTypeAll <LevelCollectionTableView>().FirstOrDefault();
            }
            if (_database == null)
            {
                _database = SongDataCore.Plugin.Songs;
            }
            var hash = beatmap == null ? "" : beatmap.levelID.Replace("custom_level_", "").ToLower();

            if (SongDataCore.Plugin.Songs.IsDataAvailable() && _database.Data.Songs.ContainsKey(hash))
            {
                var song = _database.Data.Songs[hash];
                MapActive    = true;
                MapNotActive = false;

                Key       = song.key;
                Rating    = song.rating.ToString();
                Downloads = song.downloadCount.ToString();
                Upvotes   = song.upVotes.ToString();
                Downvotes = song.downVotes.ToString();
            }
            else
            {
                MapActive    = false;
                MapNotActive = true;
                parserParams.EmitEvent("close-desc");
            }
        }
Ejemplo n.º 2
0
        public void OnMenuSceneLoadedFresh()
        {
            // get view controller which will contain our buttons
            RectTransform viewControllersContainer = FindObjectsOfType <RectTransform>().First(x => x.name == "ViewControllers");

            _levelCollectionTableView          = viewControllersContainer.GetComponentInChildren <LevelCollectionTableView>(true);
            LevelSelectionNavigationController = viewControllersContainer.GetComponentInChildren <LevelSelectionNavigationController>(true);

            Button soloFreePlayButton  = Resources.FindObjectsOfTypeAll <Button>().First(x => x.name == "SoloFreePlayButton");
            Button partyFreePlayButton = Resources.FindObjectsOfTypeAll <Button>().First(x => x.name == "PartyFreePlayButton");
            Button campaignButton      = Resources.FindObjectsOfTypeAll <Button>().First(x => x.name == "CampaignButton");

            soloFreePlayButton.onClick.AddListener(() => OnModeSelection(FreePlayMode.Solo));
            partyFreePlayButton.onClick.AddListener(() => OnModeSelection(FreePlayMode.Party));
            campaignButton.onClick.AddListener(() => OnModeSelection(FreePlayMode.Campaign));

            if (SongBrowserTweaks.ModLoaded)
            {
                // delay building UI until SongBrowser elements are built (after the user selects mode)
            }
            else if (!PluginConfig.DisableSearch || !PluginConfig.DisableFilters)
            {
                Logger.log.Debug("Creating button panel");
                InitializeButtonPanel(true);
            }
            else
            {
                Logger.log.Debug("Disabling button panel");
                ButtonPanel.instance.DisablePanel();
            }

            LevelSelectionNavigationController.didActivateEvent   += (_, __) => ButtonPanel.instance.ShowPanel();
            LevelSelectionNavigationController.didDeactivateEvent += (_) => ButtonPanel.instance.HidePanel();
        }
Ejemplo n.º 3
0
 public static void ReloadSongList()
 {
     if (IsValid)
     {
         LevelCollectionTableView?.GetPrivateField <TableView>("_tableView")?.RefreshCellsContent();
     }
 }
Ejemplo n.º 4
0
        /// <summary>
        /// Constructor.  Acquire all necessary BeatSaberUi elements.
        /// </summary>
        /// <param name="flowCoordinator"></param>
        public BeatSaberUIController(LevelSelectionFlowCoordinator flowCoordinator)
        {
            Logger.Debug("Collecting all BeatSaberUI Elements...");

            LevelSelectionFlowCoordinator = flowCoordinator;

            // gather flow coordinator elements
            LevelSelectionNavigationController = LevelSelectionFlowCoordinator.GetField <LevelSelectionNavigationController, LevelSelectionFlowCoordinator>("levelSelectionNavigationController");
            Logger.Debug("Acquired LevelSelectionNavigationController [{0}]", LevelSelectionNavigationController.GetInstanceID());

            LevelFilteringNavigationController = LevelSelectionNavigationController.GetField <LevelFilteringNavigationController, LevelSelectionNavigationController>("_levelFilteringNavigationController");
            Logger.Debug("Acquired LevelFilteringNavigationController [{0}]", LevelFilteringNavigationController.GetInstanceID());

            LevelCollectionNavigationController = LevelSelectionNavigationController.GetField <LevelCollectionNavigationController, LevelSelectionNavigationController>("_levelCollectionNavigationController");
            Logger.Debug("Acquired LevelCollectionNavigationController [{0}]", LevelCollectionNavigationController.GetInstanceID());

            LevelCollectionViewController = LevelCollectionNavigationController.GetField <LevelCollectionViewController, LevelCollectionNavigationController>("_levelCollectionViewController");
            Logger.Debug("Acquired LevelPackLevelsViewController [{0}]", LevelCollectionViewController.GetInstanceID());

            LevelDetailViewController = LevelCollectionNavigationController.GetField <StandardLevelDetailViewController, LevelCollectionNavigationController>("_levelDetailViewController");
            Logger.Debug("Acquired StandardLevelDetailViewController [{0}]", LevelDetailViewController.GetInstanceID());

            LevelCollectionTableView = this.LevelCollectionViewController.GetField <LevelCollectionTableView, LevelCollectionViewController>("_levelCollectionTableView");
            Logger.Debug("Acquired LevelPackLevelsTableView [{0}]", LevelCollectionTableView.GetInstanceID());

            StandardLevelDetailView = LevelDetailViewController.GetField <StandardLevelDetailView, StandardLevelDetailViewController>("_standardLevelDetailView");
            Logger.Debug("Acquired StandardLevelDetailView [{0}]", StandardLevelDetailView.GetInstanceID());

            BeatmapCharacteristicSelectionViewController = StandardLevelDetailView.GetField <BeatmapCharacteristicSegmentedControlController, StandardLevelDetailView>("_beatmapCharacteristicSegmentedControlController");
            Logger.Debug("Acquired BeatmapCharacteristicSegmentedControlController [{0}]", BeatmapCharacteristicSelectionViewController.GetInstanceID());

            LevelDifficultyViewController = StandardLevelDetailView.GetField <BeatmapDifficultySegmentedControlController, StandardLevelDetailView>("_beatmapDifficultySegmentedControlController");
            Logger.Debug("Acquired BeatmapDifficultySegmentedControlController [{0}]", LevelDifficultyViewController.GetInstanceID());

            LevelCollectionTableViewTransform = LevelCollectionTableView.transform as RectTransform;
            Logger.Debug("Acquired TableViewRectTransform from LevelPackLevelsTableView [{0}]", LevelCollectionTableViewTransform.GetInstanceID());

            AnnotatedBeatmapLevelCollectionsViewController = LevelFilteringNavigationController.GetField <AnnotatedBeatmapLevelCollectionsViewController, LevelFilteringNavigationController>("_annotatedBeatmapLevelCollectionsViewController");
            Logger.Debug("Acquired AnnotatedBeatmapLevelCollectionsViewController from LevelFilteringNavigationController [{0}]", AnnotatedBeatmapLevelCollectionsViewController.GetInstanceID());

            TableView  tableView  = LevelCollectionTableView.GetField <TableView, LevelCollectionTableView>("_tableView");
            ScrollView scrollView = tableView.GetField <ScrollView, TableView>("_scrollView");

            TableViewPageUpButton   = scrollView.GetField <Button, ScrollView>("_pageUpButton");
            TableViewPageDownButton = scrollView.GetField <Button, ScrollView>("_pageDownButton");
            Logger.Debug("Acquired Page Up and Down buttons...");

            ActionButtons = StandardLevelDetailView.GetComponentsInChildren <RectTransform>().First(x => x.name == "ActionButtons");
            Logger.Debug("Acquired ActionButtons [{0}]", ActionButtons.GetInstanceID());

            ScreenSystem = Resources.FindObjectsOfTypeAll <ScreenSystem>().Last();
            Logger.Debug("Acquired ScreenSystem [{0}]", ScreenSystem.GetInstanceID());

            SimpleDialogPromptViewControllerPrefab = Resources.FindObjectsOfTypeAll <SimpleDialogPromptViewController>().Last();
            Logger.Debug("Acquired SimpleDialogPromptViewControllerPrefab [{0}]", SimpleDialogPromptViewControllerPrefab.GetInstanceID());

            BeatmapLevelsModel = Resources.FindObjectsOfTypeAll <BeatmapLevelsModel>().Last();
            Logger.Debug("Acquired BeatmapLevelsModel [{0}]", BeatmapLevelsModel);
        }
Ejemplo n.º 5
0
 private static void Prefix(LevelCollectionTableView tableView, IPreviewBeatmapLevel level)
 {
     if (level is CustomPreviewBeatmapLevel customLevel)
     {
         Collections.AddSong(Hashing.GetCustomLevelHash(customLevel), customLevel.customLevelPath);
         Collections.SaveExtraSongData();
     }
 }
Ejemplo n.º 6
0
        public void Constractor(LevelCollectionViewController levelView)
        {
            this._levelCollectionViewController = levelView;

            this.levelCollectionTableView = this._levelCollectionViewController.GetField <LevelCollectionTableView, LevelCollectionViewController>("_levelCollectionTableView");
            this.levelCollectionTableView.didSelectLevelEvent += this.TableView_didSelectLevelEvent;
            Loader.OnLevelPacksRefreshed += this.Loader_OnLevelPacksRefreshed;
        }
Ejemplo n.º 7
0
        public void OnEarlyMenuSceneLoadedFresh()
        {
            // get view controller which will contain our buttons
            RectTransform viewControllersContainer = FindObjectsOfType <RectTransform>().First(x => x.name == "ViewControllers");

            _levelCollectionTableView          = viewControllersContainer.GetComponentInChildren <LevelCollectionTableView>(true);
            LevelSelectionNavigationController = viewControllersContainer.GetComponentInChildren <LevelSelectionNavigationController>(true);
        }
Ejemplo n.º 8
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="installedMap"></param>
        private void OnLevelPacksRefreshedSelect(CustomPreviewBeatmapLevel installedMap)
        {
            int installedLevelIndex = Array.FindIndex(randomSongsFolder.LevelPack.beatmapLevelCollection.beatmapLevels, x => (x.levelID == installedMap.levelID));

            LevelCollectionTableView levelCollectionTable = Resources.FindObjectsOfTypeAll <LevelCollectionTableView>().First();
            var tableView = levelCollectionTable.GetPrivateField <HMUI.TableView>("_tableView");

            tableView.ScrollToCellWithIdx(installedLevelIndex + 1, HMUI.TableView.ScrollPositionType.Center, true);
            tableView.SelectCellWithIdx(installedLevelIndex + 1, true);
        }
Ejemplo n.º 9
0
 public LevelDetailButtonsViewController(StandardLevelDetailViewController standardLevelDetailViewController, LevelCollectionViewController levelCollectionViewController, LevelCollectionNavigationController levelCollectionNavigationController,
                                         AddPlaylistModalController addPlaylistController, PopupModalsController popupModalsController, DifficultyHighlighter difficultyHighlighter)
 {
     this.standardLevelDetailViewController = standardLevelDetailViewController;
     levelCollectionTableView = Accessors.LevelCollectionTableViewAccessor(ref levelCollectionViewController);
     this.levelCollectionNavigationController = levelCollectionNavigationController;
     this.addPlaylistController = addPlaylistController;
     this.popupModalsController = popupModalsController;
     this.difficultyHighlighter = difficultyHighlighter;
 }
Ejemplo n.º 10
0
        public static void ScrollViewPatcherStock(LevelCollectionTableView lctv)
        {
            TableView  tv = lctv.GetField <TableView, LevelCollectionTableView>("_tableView");
            ScrollView sv = tv.GetComponent <ScrollView>();

            if (sv.transform.parent.gameObject.name == "LevelsTableView")
            {
                sv.SetField("_joystickScrollSpeed", m_fStockScrollSpeed);
            }
        }
Ejemplo n.º 11
0
        /// <summary>
        /// Constructor.  Acquire all necessary BeatSaberUi elements.
        /// </summary>
        /// <param name="flowCoordinator"></param>
        public BeatSaberUIController(FlowCoordinator flowCoordinator)
        {
            Logger.Debug("Collecting all BeatSaberUI Elements...");

            LevelSelectionFlowCoordinator = flowCoordinator;

            // gather flow coordinator elements
            LevelSelectionNavigationController = LevelSelectionFlowCoordinator.GetPrivateField <LevelSelectionNavigationController>("_levelSelectionNavigationController");
            Logger.Debug("Acquired LevelSelectionNavigationController [{0}]", LevelSelectionNavigationController.GetInstanceID());

            // this is loaded late but available early, grab globally.
            LevelFilteringNavigationController = Resources.FindObjectsOfTypeAll <LevelFilteringNavigationController>().First();
            //LevelSelectionFlowCoordinator.GetPrivateField<LevelFilteringNavigationController>("_levelFilteringNavigationController");
            Logger.Debug("Acquired LevelFilteringNavigationController [{0}]", LevelFilteringNavigationController.GetInstanceID());

            // grab nav controller elements
            LevelCollectionViewController = LevelSelectionNavigationController.GetPrivateField <LevelCollectionViewController>("_levelCollectionViewController");
            Logger.Debug("Acquired LevelPackLevelsViewController [{0}]", LevelCollectionViewController.GetInstanceID());

            LevelDetailViewController = LevelSelectionNavigationController.GetPrivateField <StandardLevelDetailViewController>("_levelDetailViewController");
            Logger.Debug("Acquired StandardLevelDetailViewController [{0}]", LevelDetailViewController.GetInstanceID());

            // grab level collection view controller elements
            LevelCollectionTableView = this.LevelCollectionViewController.GetPrivateField <LevelCollectionTableView>("_levelCollectionTableView");
            Logger.Debug("Acquired LevelPackLevelsTableView [{0}]", LevelCollectionTableView.GetInstanceID());

            // grab letel detail view
            StandardLevelDetailView = LevelDetailViewController.GetPrivateField <StandardLevelDetailView>("_standardLevelDetailView");
            Logger.Debug("Acquired StandardLevelDetailView [{0}]", StandardLevelDetailView.GetInstanceID());

            BeatmapCharacteristicSelectionViewController = Resources.FindObjectsOfTypeAll <BeatmapCharacteristicSegmentedControlController>().First();
            Logger.Debug("Acquired BeatmapCharacteristicSegmentedControlController [{0}]", BeatmapCharacteristicSelectionViewController.GetInstanceID());

            LevelDifficultyViewController = StandardLevelDetailView.GetPrivateField <BeatmapDifficultySegmentedControlController>("_beatmapDifficultySegmentedControlController");
            Logger.Debug("Acquired BeatmapDifficultySegmentedControlController [{0}]", LevelDifficultyViewController.GetInstanceID());

            LevelCollectionTableViewTransform = LevelCollectionTableView.transform as RectTransform;
            Logger.Debug("Acquired TableViewRectTransform from LevelPackLevelsTableView [{0}]", LevelCollectionTableViewTransform.GetInstanceID());

            TableView tableView = LevelCollectionTableView.GetPrivateField <TableView>("_tableView");

            TableViewPageUpButton   = tableView.GetPrivateField <Button>("_pageUpButton");
            TableViewPageDownButton = tableView.GetPrivateField <Button>("_pageDownButton");
            Logger.Debug("Acquired Page Up and Down buttons...");

            PlayContainer = StandardLevelDetailView.GetComponentsInChildren <RectTransform>().First(x => x.name == "PlayContainer");
            PlayButtons   = PlayContainer.GetComponentsInChildren <RectTransform>().First(x => x.name == "PlayButtons");

            PlayButton     = Resources.FindObjectsOfTypeAll <Button>().First(x => x.name == "PlayButton");
            PracticeButton = PlayButtons.GetComponentsInChildren <Button>().First(x => x.name == "PracticeButton");

            SimpleDialogPromptViewControllerPrefab = Resources.FindObjectsOfTypeAll <SimpleDialogPromptViewController>().First();

            BeatmapLevelsModel = Resources.FindObjectsOfTypeAll <BeatmapLevelsModel>().First();
        }
Ejemplo n.º 12
0
 static void Postfix(LevelCollectionTableView __instance)
 {
     if (FasterScrollController.FasterScrollMode == FasterScrollController.FasterScrollModeEnum.Constant)
     {
         FasterScrollController.ScrollViewPatcherConstant(__instance);
     }
     else if (FasterScrollController.FasterScrollMode == FasterScrollController.FasterScrollModeEnum.Stock)
     {
         FasterScrollController.ScrollViewPatcherStock(__instance); // Repatching to stock if previously was on Constant
     }
 }
Ejemplo n.º 13
0
 //      public static OverrideClasses.CustomLevel previouslySelectedSong = null;
 static void Prefix(LevelCollectionTableView tableView, IPreviewBeatmapLevel level)
 {
     if (level is CustomPreviewBeatmapLevel)
     {
         var customLevel = level as CustomPreviewBeatmapLevel;
         if (customLevel != null)
         {
             //       Logging.Log(Utilities.Hashing.GetCustomLevelHash(customLevel));
             SongCore.Collections.AddSong(Utilities.Hashing.GetCustomLevelHash(customLevel), customLevel.customLevelPath);
             SongCore.Collections.SaveExtraSongData();
         }
     }
 }
Ejemplo n.º 14
0
 private void TableView_didSelectLevelEvent(LevelCollectionTableView arg1, IPreviewBeatmapLevel arg2) => this.CurrentPreviewBeatmapLevel = arg2;
Ejemplo n.º 15
0
        public static void ReloadSongList()
        {
            var levelCollection = LevelCollectionTableView.GetPrivateField <TableView>("_tableView");

            levelCollection.RefreshCellsContent();
        }