Skip to content

Possible usability improvement skipping text #12

@creffect

Description

@creffect

Hi Oleg,

I worked a bit with your dialog system and came up with an usability optimization, which you might want to consider to integrate.

Currently, if one skipps, the dialog it is immediatly stopped and the next dialog starts (=literally skipping).
For me, it felt better to handle the first skip key hit as a "show text immediatly / very fast" and the second key hit as really skipping it.

I think the user experience is nicer this way.

If you are interested, I implemented it like this:

public class DialogBehaviour : MonoBehaviour
{
    // EDIT
    private float _currentCharDelay;
    // END EDIT
    
    private IEnumerator WriteDialogTextRoutine(string text)
    {
        _isCurrentSentenceTyping = true;
        // EDIT
        _currentCharDelay = _dialogCharDelay;
        // END EDIT
        SentenceStarted?.Invoke();
        
        foreach (char textChar in text)
        {
            if (_isCurrentSentenceSkipped)
            {
                DialogTextSkipped?.Invoke(text);
                _isCurrentSentenceTyping = false;
                break;
            }
    
            DialogTextCharWrote?.Invoke();
    
            // EDIT
            yield return new WaitForSeconds(_currentCharDelay);
            // END EDIT
        }
        ...
    }
    
    private void HandleSentenceSkipping(InputAction.CallbackContext context)
    {
        if (!_isDialogStarted || !_isCanSkippingText)
            return;
        
        // EDIT
        if (_isCurrentSentenceTyping && _currentCharDelay > 0)
        {
            _currentCharDelay = 0;
            return;
        }
        // END EDUT

        if (!_isCurrentSentenceSkipped)
            _isCurrentSentenceSkipped = true;
    }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions