protected override void DidActivate() { log.Log("Activated!"); ui = BeatSaverUI._instance; _songLoader = FindObjectOfType <SongLoader>(); UpdateAlreadyDownloadedSongs(); if (_songListViewController == null) { _songListViewController = ui.CreateViewController <BeatSaverSongListViewController>(); _songListViewController.rectTransform.anchorMin = new Vector2(0.3f, 0f); _songListViewController.rectTransform.anchorMax = new Vector2(0.7f, 1f); PushViewController(_songListViewController, true); } else { if (_viewControllers.IndexOf(_songListViewController) < 0) { PushViewController(_songListViewController, true); } } _songListViewController.SelectTopButtons(TopButtonsState.Select); if (_backButton == null) { _backButton = ui.CreateBackButton(rectTransform); _backButton.onClick.AddListener(delegate() { try { _songLoader.RefreshSongs(); } catch (Exception e) { log.Exception("Can't refresh songs! EXCEPTION: " + e); } DismissModalViewController(null, false); }); } GetPage(0); base.DidActivate(); }
protected override void DidActivate() { ui = BeatSaverUI._instance; _songLoader = FindObjectOfType <SongLoader>(); UpdateAlreadyDownloadedSongs(); if (_songPreviewPlayer == null) { ObjectProvider[] providers = Resources.FindObjectsOfTypeAll <ObjectProvider>().Where(x => x.name == "SongPreviewPlayerProvider").ToArray(); if (providers.Length > 0) { _songPreviewPlayer = providers[0].GetProvidedObject <SongPreviewPlayer>(); } } if (_songListViewController == null) { _songListViewController = ui.CreateViewController <BeatSaverSongListViewController>(); _songListViewController.rectTransform.anchorMin = new Vector2(0.3f, 0f); _songListViewController.rectTransform.anchorMax = new Vector2(0.7f, 1f); PushViewController(_songListViewController, true); } else { if (_viewControllers.IndexOf(_songListViewController) < 0) { PushViewController(_songListViewController, true); } } _songListViewController.SelectTopButtons(TopButtonsState.Select); if (_backButton == null) { _backButton = ui.CreateBackButton(rectTransform); _backButton.onClick.AddListener(delegate() { if (!_loading) { if (_songPreviewPlayer != null) { _songPreviewPlayer.CrossfadeToDefault(); } try { _songLoader.RefreshSongs(); _notUpdatedSongs.Clear(); } catch (Exception e) { log.Exception("Can't refresh songs! EXCEPTION: " + e); } DismissModalViewController(null, false); } }); } GetPage(_songListViewController._currentPage); base.DidActivate(); }