Cancels all promises on the api as well as our async channel
Saves the game
Filters the input (keybindings)
Returns the html element of the state
Should return whether to fade out the game state. This will then apply the right css classes for the fadeout and wait the delay before moving states
Should return how many mulliseconds to fade in / out the state. Not recommended to override!
Time in milliseconds to fade out
Returns the states key
Goes back to the menu state
Goes to the achievements state
Goes to the perks state
Goes back to the settings state
Cleans up all click detectors
Internal callback when entering the state. Do not override!
Arbitrary data passed from the state which we are transferring from
Whether to call the onEnter callback
Internal method to compute the time to fade in / out
time to fade in / out in ms
Internal method to get the HTML of the game state.
Internal callback when the state is left. Do not override!
Internal app pause callback
Internal app resume callback
Internal callback before the state is left. Also is called on page unload
Internal callback from the manager. Do not override!
Returns if this state is currently in the gameover animation
Helper method to figure out if we are currently in multiplayer
Transfers to a new state
The id of the new state
Callback when the app got resumed (on android, this means in foreground again)
Handles the back button of the device (on desktop: escape key)
Called when the game somehow failed to initialize. Resets everything to basic state and then goes to the main menu, showing the error
Moves to a state outside of the game
Shows a language chooser dialog
The final stage where this game is running and updating regulary.
Creates the game core instance, and thus the root
Initializes a new empty game
Resumes an existing game
Waits until all other players are joined and we get the confirmation to load further
Sends the loading finished packet to the gameserver and waits until the server sends the initial dump
Performs the first game update on the game which initializes most caches and thus
Call the post load hook, this means that we have loaded the game, and all systems can operate and start to work now.
This makes the game idle and draw for a while, because we run most code this way the V8 engine can already start to optimize it. Also this makes sure the resources are in the VRAM and we have a smooth experience once we start.
This stage destroys the whole game, used to cleanup
The animation of the playerbase getting destroyed
This stage is entered once the game is lost (only singleplayer)
This stage is entered once the game is lost (only multiplayer)
When leaving the game
Switches the game into another sub-state
Tracks clicks on a given element and calls the given callback on this state. If you want to call another function wrap it inside a lambda.
The element to track clicks on
The handler to call
Click detector arguments