InGameState
Extends:
Constructor Summary
| Public Constructor | ||
| public |
|
|
Member Summary
| Public Members | ||
| public |
|
|
| public |
|
|
| public |
|
|
| public |
Whether we are currently saving the game @TODO: This doesn't realy fit here |
|
| public |
|
|
| public |
|
|
| public |
|
|
| public |
|
|
| public |
syncer: * |
|
| public |
|
|
Method Summary
| Public Methods | ||
| public |
doSave(): * Saves the game |
|
| public |
filterInput(): * Filters the input (keybindings) |
|
| public |
|
|
| public |
|
|
| public |
|
|
| public |
|
|
| public |
getThemeMusic(): * |
|
| public |
Goes back to the menu state |
|
| public |
Goes back to the settings state |
|
| public |
Goes back to the settings state |
|
| public |
|
|
| public |
|
|
| public |
onBackgroundTick(dt: *) |
|
| public |
|
|
| public |
onEnter(payload: GameCreationPayload) |
|
| public |
Called when the game somehow failed to initialize. |
|
| public |
onLeave() |
|
| public |
Render callback |
|
| public |
onResized(w: *, h: *) |
|
| public |
saveThenGoToState(stateId: string, payload: any=) Moves to a state outside of the game |
|
| public |
The final stage where this game is running and updating regulary. |
|
| public |
Creates the game core instance, and thus the root |
|
| public |
Initializes a new empty game |
|
| public |
Resumes an existing game |
|
| public |
Performs the first game update on the game which initializes most caches |
|
| public |
Call the post load hook, this means that we have loaded the game, and all systems can operate and start to work now. |
|
| public |
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. |
|
| public |
This stage destroys the whole game, used to cleanup |
|
| public |
When leaving the game |
|
| public |
switchStage(stage: string): boolean Switches the game into another sub-state |
|
Inherited Summary
| From class GameState | ||
| public |
|
|
| public |
asyncChannel: * |
|
| public |
|
|
| public |
|
|
| public |
htmlElement: * |
|
| public |
|
|
| public |
key: * |
|
| public |
|
|
| public |
Cancels all promises on the api as well as our async channel |
|
| public |
getDivElement(): HTMLElement Returns the html element of the state |
|
| public |
Should return whether to fade in the game state. |
|
| public |
Should return whether to fade out the game state. |
|
| public |
Returns if the state has an unload confirmation, this is the "Are you sure you want to leave the page" message. |
|
| public |
Should return how many mulliseconds to fade in / out the state. |
|
| public |
Should return the html code of the state. |
|
| public |
Returns the states key |
|
| public |
Returns if this state should get paused if it does not have focus |
|
| public |
getThemeMusic(): string | null Should return the theme music for this state |
|
| public |
Cleans up all click detectors |
|
| public |
internalEnterCallback(payload: any, callCallback: boolean) Internal callback when entering the state. |
|
| public |
Internal method to compute the time to fade in / out |
|
| public |
Internal method to get the HTML of the game state. |
|
| public |
Internal callback when the state is left. |
|
| public |
Internal app pause callback |
|
| public |
Internal app resume callback |
|
| public |
Internal callback before the state is left. |
|
| public |
internalRegisterCallback(stateManager: StateManager) Internal callback from the manager. |
|
| public |
moveToState(stateKey: string) Transfers to a new state |
|
| public |
Callback when the app got paused (on android, this means in background) |
|
| public |
Callback when the app got resumed (on android, this means in foreground again) |
|
| public |
Internal backbutton handler, called when the hardware back button is pressed or the escape key is pressed |
|
| public |
onBackgroundTick(dt: number) Background tick callback, called while the game is inactiev |
|
| public |
Callback before leaving the game state or when the page is unloaded |
|
| public |
onEnter(payload: any) Callback when entering the state, to be overriddemn |
|
| public |
onLeave() Callback when leaving the state |
|
| public |
Render callback |
|
| public |
Called when the screen resized |
|
| public |
trackClicks(element: Element, handler: function(): void, args: import("./click_detector").ClickDetectorConstructorArgs=) Tracks clicks on a given element and calls the given callback on this state. |
|
| public |
watchAdAndMoveToState(nextStateId: string, nextStatePayload: object=) |
|
Public Constructors
Public Members
public boundInputFilter: * source
public creationPayload: GameCreationPayload source
public currentSavePromise: * source
Whether we are currently saving the game @TODO: This doesn't realy fit here
public keyActionMapper: KeyActionMapper source
public loadingOverlay: GameLoadingOverlay source
public syncer: * source
public warmupTimeSeconds: * source
Public Methods
public getHasFadeIn(): boolean source
Should return whether to fade in the game state. This will then apply the right css classes for the fadein.
Override:
GameState#getHasFadeInpublic getHasUnloadConfirmation(): boolean source
Returns if the state has an unload confirmation, this is the "Are you sure you want to leave the page" message.
Override:
GameState#getHasUnloadConfirmationpublic getInnerHTML(): string source
Should return the html code of the state.
Override:
GameState#getInnerHTMLpublic getPauseOnFocusLost(): boolean source
Returns if this state should get paused if it does not have focus
Override:
GameState#getPauseOnFocusLostpublic getThemeMusic(): * source
Should return the theme music for this state
Override:
GameState#getThemeMusicReturn:
| * |
public onAppPause() source
Callback when the app got paused (on android, this means in background)
Override:
GameState#onAppPausepublic onBackButton() source
Internal backbutton handler, called when the hardware back button is pressed or the escape key is pressed
Override:
GameState#onBackButtonpublic onBackgroundTick(dt: *) source
Background tick callback, called while the game is inactiev
Override:
GameState#onBackgroundTickParams:
| Name | Type | Attribute | Description |
| dt | * |
public onBeforeExit() source
Callback before leaving the game state or when the page is unloaded
Override:
GameState#onBeforeExitpublic onEnter(payload: GameCreationPayload) source
Callback when entering the state, to be overriddemn
Override:
GameState#onEnterParams:
| Name | Type | Attribute | Description |
| payload | GameCreationPayload |
public onInitializationFailure(err: string) source
Called when the game somehow failed to initialize. Resets everything to basic state and then goes to the main menu, showing the error
Params:
| Name | Type | Attribute | Description |
| err | string |
public onRender(dt: number) source
Render callback
Override:
GameState#onRenderParams:
| Name | Type | Attribute | Description |
| dt | number |
public onResized(w: *, h: *) source
Called when the screen resized
Override:
GameState#onResizedParams:
| Name | Type | Attribute | Description |
| w | * | ||
| h | * |
public saveThenGoToState(stateId: string, payload: any=) source
Moves to a state outside of the game
Params:
| Name | Type | Attribute | Description |
| stateId | string | ||
| payload | any= |
public stage10GameRunning() source
The final stage where this game is running and updating regulary.
public stage5FirstUpdate() source
Performs the first game update on the game which initializes most caches
public stage6PostLoadHook() source
Call the post load hook, this means that we have loaded the game, and all systems can operate and start to work now.
public stage7Warmup() source
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.
