Esempio n. 1
0
    private void ApplyEditModeText(string editModeText, bool undoable)
    {
        // Map edit-mode text to lyrics of notes
        string text = ShowWhiteSpaceText.ReplaceVisibleCharactersWithWhiteSpace(editModeText);

        MapEditModeTextToNotes(text);
        songMetaChangeEventStream.OnNext(new LyricsChangedEvent {
            Undoable = undoable
        });
    }
Esempio n. 2
0
    private void OnEndEdit(string inputFieldText)
    {
        string newText = ShowWhiteSpaceText.ReplaceVisibleCharactersWithWhiteSpace(inputFieldText);

        if (!IsOnlyWhitespace(inputFieldText))
        {
            uiEditorNote.Note.SetText(newText);
            uiEditorNote.SetLyrics(newText);

            songMetaChangeEventStream.OnNext(new LyricsChangedEvent());
        }

        inputField.onValidateInput -= OnValidateInput;

        Destroy(gameObject);
    }
Esempio n. 3
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();
    }