using System; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Linq; using CustomUI.BeatSaber; using CustomUI.Utilities; using HMUI; using IPA.Updating.BeatMods; using TMPro; using UnityEngine; using UnityEngine.UI; using VRUI; namespace BSIPA_ModList.UI.ViewControllers { // originally ripped verbatim from Andruzz's BeatSaverDownloader internal class DownloadProgressViewController : VRUIViewController, TableView.IDataSource { private TextMeshProUGUI _titleText; private Button _checkForUpdates; private Button _downloadUpdates; private Button _restartGame; private TableView _currentlyUpdatingTableView; private LevelListTableCell _songListTableCellInstance; private Button _pageUpButton; private Button _pageDownButton; private const float TableXOffset = -20f; private const float ButtonXOffset = 36f; private static readonly Vector2 ButtonSize = new Vector2(40f, 10f); protected override void DidActivate(bool firstActivation, ActivationType type) { if (firstActivation && type == ActivationType.AddedToHierarchy) { DownloadController.Instance.OnDownloaderListChanged -= Refresh; DownloadController.Instance.OnDownloadStateChanged -= DownloaderStateChanged; _songListTableCellInstance = Resources.FindObjectsOfTypeAll().First(x => (x.name == "LevelListTableCell")); _titleText = BeatSaberUI.CreateText(rectTransform, "DOWNLOAD QUEUE", new Vector2(0f, 35f)); _titleText.alignment = TextAlignmentOptions.Top; _titleText.fontSize = 6f; _pageUpButton = Instantiate(Resources.FindObjectsOfTypeAll