springroll.State Class

Defined in: springroll.State:13
Module: States

Defines the base functionality for a state used by the state manager

Constructor

springroll.State

(
  • panel
  • [options]
)

Defined in springroll.State:13

Parameters:

  • 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)

_internalCancel

()
protected

Defined in _internalCancel:683

Cancel the loading of this state

_internalEnter

(
  • proceed
)
protected

Defined in _internalEnter:653

Exit the state start, called by the State Manager

Parameters:

  • proceed Function

    The function to call after enter has been called

_internalEnterDone

()
private

Exit the state start, called by the State Manager

_internalEntering

(
  • proceed
)
protected

When the state is entering

Parameters:

  • proceed Function

    The function to call after enter has been called

_internalExit

()
protected

Defined in _internalExit:495

This is called by the State Manager to exit the state

_internalExitStart

()
protected

Exit the state start, called by the State Manager

_onLoaded

(
  • assets
)
private

Defined in _onLoaded:600

The internal call for on assets loaded

Parameters:

  • assets Object | Null

    The assets result of the load

destroy

()

Defined in destroy:713

Don't use the state object after this

loadingDone

(
  • [delay]
)
final

Defined in loadingDone:396

Manual call to signal the end of preloading

Parameters:

  • [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.

loadingStart

()
final

Defined in loadingStart:371

Manual call to signal the start of preloading

nextState

()
final

Defined in nextState:317

Goto the next state

onProgress

(
  • progress
)
private

Defined in onProgress:588

Handle the load progress and pass to the manager

Parameters:

  • progress Number

    The amount preloaded from zero to 1

previousState

()
final

Defined in previousState:344

Goto the previous state

_active

Boolean private

Defined in _active:151

If the manager considers this the active panel

_canceled

Boolean private

Defined in _canceled:165

If we canceled entering the state

_destroyed

Boolean private

Defined in _destroyed:144

If the state has been destroyed.

_enabled

Boolean private

Defined in _enabled:186

If the state is enabled, meaning that it is click ready

_isLoading

Boolean private

Defined in _isLoading:158

If we are pre-loading the state

_nextState

String | Function private

Defined in _nextState:193

Either the alias of the next state or a function to call when going to the next state.

_onEnterProceed

Function private

Defined in _onEnterProceed:172

When we're finishing loading

_onLoadingComplete

Function private

If we start doing a load in enter, assign the onEnterComplete here

_prevState

String | Function private

Defined in _prevState:201

Either the alias of the previous state or a function to call when going to the previous state.

active

Boolean

Defined in active:448

Get if this is the active state

app

Application

Defined in app:57

Reference to the main app

assets

Array | Object protected

Defined in assets:137

The collection of assets loaded

cancel

Function

Defined in cancel:293

Cancel the load, implementation-specific. This is where any async actions should be removed.

Default: null

canceled

Boolean

Defined in canceled:435

Status of whether the panel load was canceled

config

Object

Defined in config:78

Reference to the main config object

delayLoad

Int protected

Defined in delayLoad:209

The number of frames to delay the transition in after loading, to allow the framerate to stablize after heavy art instantiation.

destroyed

Boolean

Defined in destroyed:482

If the state has been destroyed.

enabled

Boolean

Defined in enabled:461

If the state is enabled, meaning that it is click ready

enter

Function

Defined in enter:301

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

Function

Defined in enterDone:309

When the state is visually entered fully - after the transition is done. Override this to begin your state's activities.

Default: null

exit

Function

Defined in exit:278

When the state is exited. Override this to provide state cleanup.

Default: null

exitStart

Function

Defined in exitStart:285

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

manager

springroll.StateManager

Defined in manager:111

A reference to the state manager

panel

createjs.Container | PIXI.DisplayObjectContainer

Defined in panel:117

The panel for the state.

preload

Array

Defined in preload:123

The assets to load each time

preloaded

Boolean protected

Defined in preloaded:129

Check to see if the assets have finished loading

scaling

springroll.ScaleManager

Defined in scaling:85

Reference to the scaling object, UI module required

scalingItems

Object

Defined in scalingItems:92

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

sound

springroll.Sound

Defined in sound:71

The instance of the Sound, Sound module required

stateId

String

Defined in stateId:105

The id reference

voPlayer

springroll.VOPlayer

Defined in voPlayer:64

The instance of the VOPlayer, Sound module required

cancel

Defined in cancel:240

Event when the loading of a state was canceled.

destroy

Defined in destroy:230

Event when the state is being destroyed.

enabled

Defined in enabled:269

Event when the state is enabled status changes. Enable is when the state is mouse enabled or not.

Event Payload:

  • enable Boolean

    The enabled status of the state

enterDone

Defined in enterDone:235

Event when the transition is finished the state is fully entered.

exit

Defined in exit:225

Event when the state finishes exiting. Nothing is showing at this point.

exitStart

Defined in exitStart:245

Event when the state starts exiting, everything is showing at this point.

loaded

Defined in loaded:250

Event when the preload of assets is finished. If no assets are loaded, the assets parameter is null.

Event Payload:

  • asset Object | Array | Null

    The collection of assets loaded

loading

Defined in loading:262

Event when the assets are starting to load.

Event Payload:

  • 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

Defined in progress:256

When there has been a change in how much has been preloaded

Event Payload:

  • percentage Number

    The amount preloaded from zero to 1