public void Dismiss(bool immediately)
        {
            MoreSongsFlowCoordinator thisCoordinator = (MoreSongsFlowCoordinator)this;

            if (SongDetailViewController(ref thisCoordinator).isInViewControllerHierarchy)
            {
                PopViewControllersFromNavigationController(MoreSongsNavigationController(ref thisCoordinator), 1, null, true);
            }
            MoreSongsView(ref thisCoordinator).Cleanup();
            AbortAllDownloadsMethod.Invoke(DownloadQueueView(ref thisCoordinator), null);

            ParentFlowCoordinator.DismissFlowCoordinator(this, null, immediately);
        }
        public void SetContent(MoreSongsFlowCoordinator sender, Song newSongInfo)
        {
            _currentSong = newSongInfo;

            songNameText.text = newSongInfo.songName;

            downloadsText.text           = newSongInfo.downloads;
            _levelDetails.bpm            = float.Parse(newSongInfo.plays);
            _levelDetails.notesCount     = int.Parse(newSongInfo.beatsPerMinute);
            _levelDetails.obstaclesCount = int.Parse(newSongInfo.upvotes);
            _levelDetails.bombsCount     = int.Parse(newSongInfo.downvotes);

            difficulty1Text.text = (newSongInfo.difficultyLevels.Where(x => (x.difficulty == "Expert" || x.difficulty == "ExpertPlus")).Count() > 0) ? "Yes" : "No";
            difficulty2Text.text = (newSongInfo.difficultyLevels.Where(x => x.difficulty == "Hard").Count() > 0) ? "Yes" : "No";
            difficulty3Text.text = (newSongInfo.difficultyLevels.Where(x => (x.difficulty == "Easy" || x.difficulty == "Normal")).Count() > 0) ? "Yes" : "No";

            SetFavoriteState(PluginConfig.favoriteSongs.Any(x => x.Contains(newSongInfo.hash)));
            SetDownloadState((SongDownloader.Instance.IsSongDownloaded(newSongInfo) ? DownloadState.Downloaded : (sender.IsDownloadingSong(newSongInfo) ? DownloadState.Downloading : DownloadState.NotDownloaded)));
        }
예제 #3
0
        public void SetContent(MoreSongsFlowCoordinator sender, Song newSongInfo)
        {
            _currentSong = newSongInfo;

            songNameText.text = _currentSong.songName;

            downloadsText.text          = _currentSong.downloads;
            _levelParams.bpm            = float.Parse(_currentSong.plays);
            _levelParams.notesCount     = int.Parse(_currentSong.beatsPerMinute);
            _levelParams.obstaclesCount = int.Parse(_currentSong.upvotes);
            _levelParams.bombsCount     = int.Parse(_currentSong.downvotes);

            difficulty1Text.text = (_currentSong.difficultyLevels.Where(x => (x.difficulty == "Expert" || x.difficulty == "ExpertPlus")).Count() > 0) ? "Yes" : "No";
            difficulty2Text.text = (_currentSong.difficultyLevels.Where(x => x.difficulty == "Hard").Count() > 0) ? "Yes" : "No";
            difficulty3Text.text = (_currentSong.difficultyLevels.Where(x => (x.difficulty == "Easy" || x.difficulty == "Normal")).Count() > 0) ? "Yes" : "No";

            StartCoroutine(LoadScripts.LoadSpriteCoroutine(_currentSong.coverUrl, (cover) => { coverImage.sprite = cover; }));

            SetFavoriteState(PluginConfig.favoriteSongs.Any(x => x.Contains(_currentSong.hash)));
            SetDownloadState((SongDownloader.Instance.IsSongDownloaded(_currentSong) ? DownloadState.Downloaded : (sender.IsDownloadingSong(_currentSong) ? DownloadState.Downloading : DownloadState.NotDownloaded)));
        }
예제 #4
0
        public void SetContent(MoreSongsFlowCoordinator sender, Song newSongInfo)
        {
            selectedCharacteristic = null;
            currentDifficulties    = null;
            _currentSong           = newSongInfo;

            songNameText.text = _currentSong.songName;
            if (_characteristicSegmentedDisplay == null)
            {
                _characteristicSegmentedDisplay = BeatSaberUI.CreateIconSegmentedControl(rectTransform, new Vector2(-40, .2f), new Vector2(70, 9f),
                                                                                         delegate(int value) { SelectedCharacteristic(_currentSong.metadata.characteristics[value]); });
                SetupCharacteristicDisplay(_characteristicSegmentedDisplay, _currentSong);
            }
            else
            {
                SetupCharacteristicDisplay(_characteristicSegmentedDisplay, _currentSong);
            }



            if (_difficultySegmentedDisplay == null)
            {
                _difficultySegmentedDisplay = BeatSaberUI.CreateTextSegmentedControl(rectTransform, new Vector2(-40, -9f), new Vector2(85, 8f),
                                                                                     delegate(int value) { SelectedDifficulty(currentDifficulties[value]); });
                _difficultySegmentedDisplay.transform.localScale = new Vector3(.8f,
                                                                               _difficultySegmentedDisplay.transform.localScale.y, _difficultySegmentedDisplay.transform.localScale.z);
                SetupDifficultyDisplay(_difficultySegmentedDisplay, _currentSong);
            }
            else
            {
                SetupDifficultyDisplay(_difficultySegmentedDisplay, _currentSong);
            }

            downloadsText.text          = _currentSong.downloads.ToString();
            _levelParams.bpm            = (float)(_currentSong.plays);
            _levelParams.notesCount     = (int)_currentSong.bpm;
            _levelParams.obstaclesCount = _currentSong.upVotes;
            _levelParams.bombsCount     = _currentSong.downVotes;

            Polyglot.LocalizedTextMeshProUGUI localizer1 = difficulty1Title.GetComponentInChildren <Polyglot.LocalizedTextMeshProUGUI>();
            if (localizer1 != null)
            {
                GameObject.Destroy(localizer1);
            }
            Polyglot.LocalizedTextMeshProUGUI localizer2 = difficulty2Title.GetComponentInChildren <Polyglot.LocalizedTextMeshProUGUI>();
            if (localizer2 != null)
            {
                GameObject.Destroy(localizer2);
            }
            Polyglot.LocalizedTextMeshProUGUI localizer3 = difficulty3Title.GetComponentInChildren <Polyglot.LocalizedTextMeshProUGUI>();
            if (localizer3 != null)
            {
                GameObject.Destroy(localizer3);
            }
            difficulty1Title.text = "";
            difficulty2Title.text = "";
            difficulty3Title.text = "";
            difficulty1Text.text  = "";
            difficulty2Text.text  = "";
            difficulty3Text.text  = "";



            //       difficulty1Text.text = (_currentSong.metadata.difficulties.expert || _currentSong.metadata.difficulties.expertPlus) ? "Yes" : "No";
            //       difficulty2Text.text = (_currentSong.metadata.difficulties.hard) ? "Yes" : "No";
            //       difficulty3Text.text = (_currentSong.metadata.difficulties.easy || _currentSong.metadata.difficulties.normal) ? "Yes" : "No";

            StartCoroutine(LoadScripts.LoadSpriteCoroutine(_currentSong.coverURL, (cover) => { coverImage.texture = cover.texture; }));

            SetFavoriteState(PluginConfig.favoriteSongs.Any(x => x.Contains(_currentSong.hash)));
            SetDownloadState((SongDownloader.Instance.IsSongDownloaded(_currentSong) ? DownloadState.Downloaded : (sender.IsDownloadingSong(_currentSong) ? DownloadState.Downloading : DownloadState.NotDownloaded)));
            SetLoadingState(false);


            SelectedCharacteristic(_currentSong.metadata.characteristics[0]);
        }