Exemplo n.º 1
0
        private IEnumerator LoadDetailView()
        {
            while (GameObject.Find("PlayButton") == null)
            {
                yield return(null);
            }

            _videoDetailViewController.Init();
            _videoDetailViewController.backButtonPressed            += DetailViewBackPressed;
            _videoDetailViewController.addOffsetPressed             += DetailViewAddOffsetPressed;
            _videoDetailViewController.subOffsetPressed             += DetailViewSubOffsetPressed;
            _videoDetailViewController.changeOffsetMagnitudePressed += DetailsViewChangeMagnitudePressed;
            _videoDetailViewController.previewButtonPressed         += DetailViewPreviewPressed;
            _videoDetailViewController.loopButtonPressed            += DetailViewLoopPressed;
            _videoDetailViewController.listButtonPressed            += DetailViewSearchPressed;
            _videoDetailViewController.downloadDeleteButtonPressed  += DetailViewDownloadDeletePressed;
        }
        protected override void DidActivate(bool firstActivation, ActivationType activationType)
        {
            title = "Video - " + selectedLevel.songName;

            if (_videoDetailViewController == null)
            {
                _videoDetailViewController = BeatSaberUI.CreateViewController <VideoDetailViewController>();
                _videoDetailViewController.Init();
                _videoDetailViewController.backButtonPressed           += DetailViewBackPressed;
                _videoDetailViewController.addOffsetPressed            += DetailViewAddOffsetPressed;
                _videoDetailViewController.subOffsetPressed            += DetailViewSubOffsetPressed;
                _videoDetailViewController.previewButtonPressed        += DetailViewPreviewPressed;
                _videoDetailViewController.loopButtonPressed           += DetailViewLoopPressed;
                _videoDetailViewController.listButtonPressed           += DetailViewSearchPressed;
                _videoDetailViewController.downloadDeleteButtonPressed += DetailViewDownloadDeletePressed;
            }
            if (_videoListViewController == null)
            {
                _videoListViewController = BeatSaberUI.CreateViewController <VideoListViewController>();
                _videoListViewController.backButtonPressed     += ListViewBackPressed;
                _videoListViewController.downloadButtonPressed += ListViewDownloadPressed;
                _videoListViewController.searchButtonPressed   += ListViewSearchPressed;
            }
            if (_simpleDialog == null)
            {
                _simpleDialog = Resources.FindObjectsOfTypeAll <SimpleDialogPromptViewController>().First();
                _simpleDialog = Instantiate(_simpleDialog.gameObject, _simpleDialog.transform.parent).GetComponent <SimpleDialogPromptViewController>();
            }
            if (activationType == FlowCoordinator.ActivationType.AddedToHierarchy)
            {
                Console.WriteLine("selectedLevelVideo = " + selectedLevelVideo != null);
                Console.WriteLine("_videoDetailViewController = " + _videoDetailViewController != null);
                Console.WriteLine("_videoListViewController = " + _videoListViewController != null);
                Console.WriteLine("_simpleDialog = " + _simpleDialog != null);
                _videoDetailViewController.SetContent(selectedLevelVideo);
                previewPlaying = false;
                _videoDetailViewController.SetPreviewState(previewPlaying);
                if (selectedLevelVideo != null)
                {
                    ScreenManager.Instance.ShowScreen();
                }
                ProvideInitialViewControllers(_videoDetailViewController, null, null);
            }
        }