Defines the base functionality for a state used by the state manager
springroll.State
panel
[options]
panel
createjs.Container | PIXI.DisplayObjectContainer
The panel to associate with this state.
[options]
Object
optional
The list of options
[next=null]
String | Function
optional
The next state alias or function to call when going to the next state.
[previous=null]
String | Function
optional
The previous state alias to call when going to the previous state.
[delayLoad=0]
Int
optional
The number of frames to delay the loading for cases where heavy object instaniation slow the game dramatically.
[preload=[]]
Array
optional
The assets to preload before the state loads
[scaling=null]
Object | String
optional
The scaling items to use with the ScaleManager.
If options.scaling is "panel"
then the entire panel will be scaled as a title-safe
item. See ScaleManager.addItems
for more information about the
format of the scaling objects. (UI Module only)
_internalEnter
proceed
Exit the state start, called by the State Manager
proceed
Function
The function to call after enter has been called
_internalEntering
proceed
When the state is entering
proceed
Function
The function to call after enter has been called
_onLoaded
assets
The internal call for on assets loaded
assets
Object | Null
The assets result of the load
loadingDone
[delay]
Manual call to signal the end of preloading
[delay]
Int
optional
Frames to delay the load completion to allow the framerate to
stabilize. If not delay is set, defaults to the delayLoad
property.
onProgress
progress
Handle the load progress and pass to the manager
progress
Number
The amount preloaded from zero to 1
_nextState
Either the alias of the next state or a function to call when going to the next state.
_onLoadingComplete
If we start doing a load in enter, assign the onEnterComplete here
_prevState
Either the alias of the previous state or a function to call when going to the previous state.
cancel
Cancel the load, implementation-specific. This is where any async actions should be removed.
Default: null
delayLoad
The number of frames to delay the transition in after loading, to allow the framerate to stablize after heavy art instantiation.
enter
When the state is entered. Override this to start loading assets - call loadingStart() to tell the StateManager that that is going on.
Default: null
enterDone
When the state is visually entered fully - after the transition is done. Override this to begin your state's activities.
Default: null
exitStart
When the state has requested to be exit, pre-transition. Override this to ensure that animation/audio is stopped when leaving the state.
Default: null
scalingItems
The items to scale on the panel, see ScaleManager.addItems
for
more information. If no options are set in the State's constructor
then it will try to find an object on the app config on scaling
property
matching the same state alias. For instance config.scaling.title
if
title
is the state alias. If no scalingItems are set, will scale
and position the panal itself.
Default: null
enabled
Event when the state is enabled status changes. Enable is when the state is mouse enabled or not.
enable
Boolean
The enabled status of the state
loaded
Event when the preload of assets is finished. If no assets are loaded, the assets
parameter is null.
loading
Event when the assets are starting to load.
asset
Array
An empty array that additional assets can be added to, if needed. Any dynamic assets that are added need to be manually unloaded when the state exits.
progress
When there has been a change in how much has been preloaded
percentage
Number
The amount preloaded from zero to 1