Fix mini textbox not closing when it's expanding and another textbox is triggered#389
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Issue
When a mini textbox is expanding and the player triggers another textbox, the first one will stop expanding and stay on screen until retrying the level.
2021-10-13_22-06-46.mp4
Reason
Let's say we have mini textbox A and B, when A is expanding, the code is looping here in
MiniTextbox.Routine():Then the player triggers B, the game checks and closes them if there are other textboxes in the level, also in
MiniTextbox.Routine():Then
MiniTextbox.Close()routine is added to A, currently A hasMiniTextbox.Close()andMiniTextbox.Routine()routines running, after the routine is added, the code will loop here inMiniTextbox.Close():easeis increasing and decreasing by the same amount at the same time, causing A having a constant value of expanding progress, so it will stay on screen forever.Solution
Since
closingwill be set totrueinMiniTextbox.Close(), we can stop the display routine if the textbox is closing, so onlyMiniTextbox.Close()is running in A when B is triggered.while ((this.ease += Engine.DeltaTime * 4f) < 1f) { + if (this.closing) { + yield break; + } yield return null; }2021-10-13_23-30-39.mp4