Ejemplo n.º 1
0
    public void UpdateLyrics()
    {
        string text = (lyricsAreaMode == LyricsAreaMode.ViewMode)
            ? GetViewModeText()
            : GetEditModeText();
        string newInputFieldText = ShowWhiteSpaceText.ReplaceWhiteSpaceWithVisibleCharacters(text);

        SetInputFieldText(newInputFieldText);
    }
Ejemplo n.º 2
0
    private void OnValueChanged(string newInputFieldText)
    {
        string newSimpleText = ShowWhiteSpaceText.ReplaceWhiteSpaceWithVisibleCharacters(newInputFieldText);

        if (ShowWhiteSpaceText.ReplaceWhiteSpaceWithVisibleCharacters(inputField.text) != newSimpleText)
        {
            inputField.text = ShowWhiteSpaceText.ReplaceWhiteSpaceWithVisibleCharacters(newSimpleText);
        }
    }
Ejemplo n.º 3
0
    private void OnEndEdit(string newText)
    {
        ApplyEditModeText(newText, true);

        string newInputFieldText = ShowWhiteSpaceText.ReplaceWhiteSpaceWithVisibleCharacters(GetViewModeText());

        SetInputFieldText(newInputFieldText);

        lyricsAreaMode = LyricsAreaMode.ViewMode;
    }
Ejemplo n.º 4
0
    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;
    }
Ejemplo n.º 5
0
    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();
    }
Ejemplo n.º 6
0
 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);
 }
Ejemplo n.º 7
0
 public void UpdateLyrics()
 {
     lyrics          = GetLyrics();
     inputField.text = ShowWhiteSpaceText.ReplaceWhiteSpaceWithVisibleCharacters(lyrics);
 }