You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The TextTyper has a couple bad smells that I'd like to get rid of:
It modifies the iterator (i) when applying tags in the loop
It modifies the displayedText member as it loops. This is critical for keeping track of what's been printed, but it can be cleaned up.
Instead I think we should add a function, SplitForTyping that would take a string and an index. It would return a struct that contains a string for the display text, a string for the hidden text, and a list of outstanding tags (which need to be applied but only if they haven't already been applied). Every loop the TextTyper would simply call this function, and act on the data accordingly.
It might not even be a function, but rather a complete class, and it should be unit tested.
The text was updated successfully, but these errors were encountered:
This adds a TypedTextGenerator that provides a pure function to return
the print string at a desired place in a line of dialogue. This
resolves some of the issues I had with mishandled state, namely
issue #7 and issue #5.
The TextTyper has a couple bad smells that I'd like to get rid of:
displayedText
member as it loops. This is critical for keeping track of what's been printed, but it can be cleaned up.Instead I think we should add a function,
SplitForTyping
that would take a string and an index. It would return a struct that contains a string for the display text, a string for the hidden text, and a list of outstanding tags (which need to be applied but only if they haven't already been applied). Every loop the TextTyper would simply call this function, and act on the data accordingly.It might not even be a function, but rather a complete class, and it should be unit tested.
The text was updated successfully, but these errors were encountered: