using BS_Utils.Utilities; using HMUI; using System; using System.Collections.Generic; using System.Linq; using UnityEngine; using UnityEngine.UI; using Logger = SongBrowser.Logging.Logger; namespace SongBrowser.DataAccess { public class BeatSaberUIController { // Beat Saber UI Elements public FlowCoordinator LevelSelectionFlowCoordinator; public LevelSelectionNavigationController LevelSelectionNavigationController; public LevelFilteringNavigationController LevelFilteringNavigationController; public LevelCollectionNavigationController LevelCollectionNavigationController; public LevelCollectionViewController LevelCollectionViewController; public LevelCollectionTableView LevelCollectionTableView; public StandardLevelDetailViewController LevelDetailViewController; public StandardLevelDetailView StandardLevelDetailView; public BeatmapDifficultySegmentedControlController LevelDifficultyViewController; public BeatmapCharacteristicSegmentedControlController BeatmapCharacteristicSelectionViewController; public AnnotatedBeatmapLevelCollectionsViewController AnnotatedBeatmapLevelCollectionsViewController; public RectTransform LevelCollectionTableViewTransform; public Button TableViewPageUpButton; public Button TableViewPageDownButton; public RectTransform ActionButtons; public ScreenSystem ScreenSystem; public SimpleDialogPromptViewController SimpleDialogPromptViewControllerPrefab; /// /// Internal BeatSaber song model /// public BeatmapLevelsModel BeatmapLevelsModel; // Plugin Compat checks private bool _detectedTwitchPluginQueue = false; private bool _checkedForTwitchPlugin = false; /// /// Constructor. Acquire all necessary BeatSaberUi elements. /// /// public BeatSaberUIController(FlowCoordinator flowCoordinator) { Logger.Debug("Collecting all BeatSaberUI Elements..."); LevelSelectionFlowCoordinator = flowCoordinator; // gather flow coordinator elements LevelSelectionNavigationController = LevelSelectionFlowCoordinator.GetPrivateField("levelSelectionNavigationController"); Logger.Debug("Acquired LevelSelectionNavigationController [{0}]", LevelSelectionNavigationController.GetInstanceID()); LevelFilteringNavigationController = LevelSelectionNavigationController.GetPrivateField("_levelFilteringNavigationController"); Logger.Debug("Acquired LevelFilteringNavigationController [{0}]", LevelFilteringNavigationController.GetInstanceID()); LevelCollectionNavigationController = LevelSelectionNavigationController.GetPrivateField("_levelCollectionNavigationController"); Logger.Debug("Acquired LevelCollectionNavigationController [{0}]", LevelCollectionNavigationController.GetInstanceID()); LevelCollectionViewController = LevelCollectionNavigationController.GetPrivateField("_levelCollectionViewController"); Logger.Debug("Acquired LevelPackLevelsViewController [{0}]", LevelCollectionViewController.GetInstanceID()); LevelDetailViewController = LevelCollectionNavigationController.GetPrivateField("_levelDetailViewController"); Logger.Debug("Acquired StandardLevelDetailViewController [{0}]", LevelDetailViewController.GetInstanceID()); LevelCollectionTableView = this.LevelCollectionViewController.GetPrivateField("_levelCollectionTableView"); Logger.Debug("Acquired LevelPackLevelsTableView [{0}]", LevelCollectionTableView.GetInstanceID()); StandardLevelDetailView = LevelDetailViewController.GetPrivateField("_standardLevelDetailView"); Logger.Debug("Acquired StandardLevelDetailView [{0}]", StandardLevelDetailView.GetInstanceID()); BeatmapCharacteristicSelectionViewController = StandardLevelDetailView.GetPrivateField("_beatmapCharacteristicSegmentedControlController"); Logger.Debug("Acquired BeatmapCharacteristicSegmentedControlController [{0}]", BeatmapCharacteristicSelectionViewController.GetInstanceID()); LevelDifficultyViewController = StandardLevelDetailView.GetPrivateField("_beatmapDifficultySegmentedControlController"); Logger.Debug("Acquired BeatmapDifficultySegmentedControlController [{0}]", LevelDifficultyViewController.GetInstanceID()); LevelCollectionTableViewTransform = LevelCollectionTableView.transform as RectTransform; Logger.Debug("Acquired TableViewRectTransform from LevelPackLevelsTableView [{0}]", LevelCollectionTableViewTransform.GetInstanceID()); AnnotatedBeatmapLevelCollectionsViewController = LevelFilteringNavigationController.GetPrivateField("_annotatedBeatmapLevelCollectionsViewController"); Logger.Debug("Acquired AnnotatedBeatmapLevelCollectionsViewController from LevelFilteringNavigationController [{0}]", AnnotatedBeatmapLevelCollectionsViewController.GetInstanceID()); TableView tableView = LevelCollectionTableView.GetPrivateField("_tableView"); TableViewPageUpButton = tableView.GetPrivateField