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 TextMeshProUGUI _manualDownloadText; private Button _checkForUpdates; private Button _downloadUpdates; private Button _restartGame; private TableView _currentlyUpdatingTableView; private LevelListTableCell _songListTableCellInstance; private Button _pageUpButton; private Button _pageDownButton; private TableViewScroller _scroller; private const float TableXOffset = 0f; 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; _manualDownloadText = BeatSaberUI.CreateText(rectTransform, "Manual Restart Required", new Vector2(37f, -3f)); _manualDownloadText.alignment = TextAlignmentOptions.Top; _manualDownloadText.fontSize = 4f; _manualDownloadText.gameObject.SetActive(false); _pageUpButton = Instantiate(Resources.FindObjectsOfTypeAll