private void ShowPlayerSelectOverlay() { playerSelectOverlayContainer.ShowByDisplay(); UpdateInputLegend(); // Show lyrics for duet song bool hasMultipleVoices = SelectedSong.VoiceNames.Count > 1; leftLyricsOverlay.SetVisibleByDisplay(hasMultipleVoices); rightLyricsOverlay.SetVisibleByDisplay(hasMultipleVoices); if (hasMultipleVoices) { List <string> voiceNames = SelectedSong.VoiceNames.Values.ToList(); leftLyricsOverlay.Q <Label>(R.UxmlNames.voiceNameLabel).text = voiceNames[0]; leftLyricsOverlay.Q <Label>(R.UxmlNames.lyricsLabel).text = SongMetaUtils.GetLyrics(SelectedSong, Voice.firstVoiceName); rightLyricsOverlay.Q <Label>(R.UxmlNames.voiceNameLabel).text = voiceNames[1]; rightLyricsOverlay.Q <Label>(R.UxmlNames.lyricsLabel).text = SongMetaUtils.GetLyrics(SelectedSong, Voice.secondVoiceName); playerListControl.ShowVoiceSelection(SelectedSong); } else { playerListControl.HideVoiceSelection(); } // Focus start button, such that it can be triggered by keyboard StartCoroutine(CoroutineUtils.ExecuteAfterDelayInFrames(1, () => playerSelectOverlayContainer.Q <Button>(R.UxmlNames.startButton).Focus())); }
private void UpdateSongDetailsInOverlay() { songDetailOverlayScrollView.Clear(); SongMeta songMeta = SelectedSong; if (songMeta == null) { return; } Label CreateSongDetailLabel(string fieldName, object fieldValue) { Label label = new(); label.enableRichText = true; label.AddToClassList("songDetailOverlayLabel"); string fieldValueDisplayString = fieldValue?.ToString(); fieldValueDisplayString = fieldValueDisplayString.IsNullOrEmpty() ? "-" : fieldValueDisplayString; label.text = $"<b><u>{fieldName}</u></b>: {fieldValueDisplayString}"; return(label); } songDetailOverlayScrollView.Add(CreateSongDetailLabel("Artist", songMeta.Artist)); songDetailOverlayScrollView.Add(CreateSongDetailLabel("Title", songMeta.Title)); songDetailOverlayScrollView.Add(CreateSongDetailLabel("Genre", songMeta.Genre)); songDetailOverlayScrollView.Add(CreateSongDetailLabel("Year", songMeta.Year > 0 ? songMeta.Year : null)); songDetailOverlayScrollView.Add(CreateSongDetailLabel("Audio", songMeta.Mp3)); songDetailOverlayScrollView.Add(CreateSongDetailLabel("Gap", songMeta.Gap)); songDetailOverlayScrollView.Add(CreateSongDetailLabel("Bpm", songMeta.Bpm)); songDetailOverlayScrollView.Add(CreateSongDetailLabel("Video", songMeta.Video)); songDetailOverlayScrollView.Add(CreateSongDetailLabel("Video Gap", songMeta.VideoGap)); songDetailOverlayScrollView.Add(CreateSongDetailLabel("Cover", songMeta.Cover)); songDetailOverlayScrollView.Add(CreateSongDetailLabel("Language", songMeta.Language)); songDetailOverlayScrollView.Add(CreateSongDetailLabel("Edition", songMeta.Edition)); songDetailOverlayScrollView.Add(new Label("\n")); songMeta.VoiceNames.Keys.ForEach(voiceNameKey => { string lyrics = SongMetaUtils.GetLyrics(songMeta, voiceNameKey); if (lyrics.IsNullOrEmpty()) { return; } if (voiceNameKey != Voice.soloVoiceName) { Label voiceNameLabel = new(); voiceNameLabel.enableRichText = true; voiceNameLabel.AddToClassList("songDetailOverlayLabel"); string voiceName = songMeta.VoiceNames[voiceNameKey]; string voiceNameText = voiceName != voiceNameKey ? $" ({voiceName})" : ""; voiceNameLabel.text = $"<b>{voiceNameKey}{voiceNameText}</b>"; songDetailOverlayScrollView.Add(voiceNameLabel); } Label lyricsLabel = new(); lyricsLabel.AddToClassList("songDetailOverlayLabel"); lyricsLabel.text = lyrics; songDetailOverlayScrollView.Add(lyricsLabel); songDetailOverlayScrollView.Add(new Label("\n")); }); }