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.
Resolve #2811
Implement a new type called AnimatedOverlay which is an extension of Overlay. I decided to go with a separate type, because there's a concern about keeping existing Overlay simple. Also, there's a number of cases where overlay is returned for a built-in object (such as speech text, portrait, etc), which probably should not have any extra functionalities in them.
AnimatedOverlay is declared as:
The
Animatecommand and properties are mostly mimicking existing Button example.The standing out parameter is "PauseWithGame". While Button animation do not pause when the game gets paused, because the GUI is not paused at all, but Overlays may be used for various purposes, and be created in room or screen layer. So I decided to make this a parameter passed when creating animated overlay.
Internally, AnimatedOverlay consists of a normal overlay itself, and a additional object which describes animation and controls its flow, connecting to overlay. The connection between these two is done using reference tables. This ensures that overlays own update is not affected performance-wise. Overlay animations are updated separately, and they just change referenced overlay's graphic value.
I'd like to hear any comments on the API. For instance, I might perhaps make "pause with gui" a enum, for better clarity.