public void UpdateLyrics() { string text = (lyricsAreaMode == LyricsAreaMode.ViewMode) ? GetViewModeText() : GetEditModeText(); string newInputFieldText = ShowWhiteSpaceText.ReplaceWhiteSpaceWithVisibleCharacters(text); SetInputFieldText(newInputFieldText); }
private void OnValueChanged(string newInputFieldText) { string newSimpleText = ShowWhiteSpaceText.ReplaceWhiteSpaceWithVisibleCharacters(newInputFieldText); if (ShowWhiteSpaceText.ReplaceWhiteSpaceWithVisibleCharacters(inputField.text) != newSimpleText) { inputField.text = ShowWhiteSpaceText.ReplaceWhiteSpaceWithVisibleCharacters(newSimpleText); } }
private void OnEndEdit(string newText) { ApplyEditModeText(newText, true); string newInputFieldText = ShowWhiteSpaceText.ReplaceWhiteSpaceWithVisibleCharacters(GetViewModeText()); SetInputFieldText(newInputFieldText); lyricsAreaMode = LyricsAreaMode.ViewMode; }
private void OnBeginEdit() { // Map lyrics of notes to edit-mode text. lastEditModeText = null; string editModeText = GetEditModeText(); string newInputFieldText = ShowWhiteSpaceText.ReplaceWhiteSpaceWithVisibleCharacters(editModeText); SetInputFieldText(newInputFieldText); lyricsAreaMode = LyricsAreaMode.EditMode; }
public void OnInjectionFinished() { BackslashReplacingTextFieldControl backslashReplacingTextFieldControl = null; voice = songMeta.GetVoices()[0]; UpdateLyrics(); textField.RegisterCallback <FocusEvent>(evt => { OnBeginEdit(); }); textField.RegisterCallback <BlurEvent>(evt => { if (lyricsAreaMode == LyricsAreaMode.EditMode) { OnEndEdit(backslashReplacingTextFieldControl.UnescapeBackslashes(textField.text)); } }); songMetaChangeEventStream.Subscribe(OnSongMetaChanged); textField.doubleClickSelectsWord = true; textField.tripleClickSelectsLine = true; backslashReplacingTextFieldControl = new BackslashReplacingTextFieldControl(textField); // Replace white space with visible characters when in edit mode backslashReplacingTextFieldControl.ValueChangedEventStream .Subscribe(newValue => { if (lyricsAreaMode == LyricsAreaMode.EditMode) { string normalText = ShowWhiteSpaceText.ReplaceVisibleCharactersWithWhiteSpace(newValue); string visibleWhiteSpaceText = ShowWhiteSpaceText.ReplaceWhiteSpaceWithVisibleCharacters(normalText); textField.SetValueWithoutNotify(visibleWhiteSpaceText); } }); lyricsAreaVoice1Button.RegisterCallbackButtonTriggered(() => Voice = songMeta.GetVoice(Voice.firstVoiceName)); lyricsAreaVoice2Button.RegisterCallbackButtonTriggered(() => Voice = songMeta.GetVoice(Voice.secondVoiceName)); UpdateVoiceButtons(); }
private void OnEndEdit(string newText) { // TODO: Change the lyrics if only the lyrics for a single note changed // Ignore new lyrics for now. inputField.text = ShowWhiteSpaceText.ReplaceWhiteSpaceWithVisibleCharacters(lyrics); }
public void UpdateLyrics() { lyrics = GetLyrics(); inputField.text = ShowWhiteSpaceText.ReplaceWhiteSpaceWithVisibleCharacters(lyrics); }