The Screen Manager keeps track of active screens and has some helper functions to show and hide screens. It also has an optional modal overlay to allow for clicking / tapping outside of a screen to close it. The best way to get this manager into your own game is to create a template of the one in Doodle Safari.
The Screen Manager expects each screen to have a Screen Data
in a Database, so please make sure you understand how to set that up.
The Screen Templates themselves can be built using the UI system. Check out the UI Controller page to see how that works.
We offer a couple of scripts to help open screens.
Open Screen - Add this script to an Entity and fill in the “Screen Data Id” to let a Player open a screen by interacting with the Entity. Doodle Safari uses this to open the Doodle Dex and Costume Store.
Open Screen On Data Amount Changed - Add this script to an Entity to have a screen show when the Player has a specific amount of a data. Doodle Safari is using this to show a “New Doodle Screen” the first time you find each type of Doodle.
You can show and hide screens in your own scripts by using the following:
// Show a screen
this.game.sendEventToTag(“screen_manager”, “showScreen”, “My Screen Data Id”);
// Hide a screen
this.game.sendEventToTag(“screen_manager”, “hideScreen”, myScreenEntity);
// Hide all screens
this.game.sendEventToTag(“screen_manager”, “hideAllScreens”);
If you add the screen_manager_listener
tag to your Entity you can also get screen events:
// Called when a screen has been added / shown
onScreenAdded(screendataId: string, screenEntity: Entity) {}
// Called when a screen has been removed / hidden
onScreenRemoved(screenDataId: string, screenEntity: Entity) {}