public void SelectedCharacteristic(ParsedBeatmapCharacteristic characteristic) { selectedCharacteristic = characteristic; var diffs = new List <ParsedBeatmapDifficulty>(); if (characteristic.difficulties.easy != null) { diffs.Add(characteristic.difficulties.easy); } if (characteristic.difficulties.normal != null) { diffs.Add(characteristic.difficulties.normal); } if (characteristic.difficulties.hard != null) { diffs.Add(characteristic.difficulties.hard); } if (characteristic.difficulties.expert != null) { diffs.Add(characteristic.difficulties.expert); } if (characteristic.difficulties.expertPlus != null) { diffs.Add(characteristic.difficulties.expertPlus); } currentDifficulties = diffs.ToArray(); // Plugin.log.Info("difficulties: " + currentDifficulties.Count()); if (_difficultySegmentedDisplay != null) { SetupDifficultyDisplay(_difficultySegmentedDisplay, _currentSong); } // else // Plugin.log.Info("null diff segmented"); }
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]); }