Adventure.js Docs Downloads
Score: 0 Moves: 0

Class: SaveManager

Defined in: adventure/SaveManager.js, line 10

Todos: Save to adventurejs.com web server.

SaveManager manages the job of saving games. It contains all the methods needed to create the Save pop-up screen. SaveManager can save a game to a local save file, to browser cookies, or to the adventurejs.com web server.

SaveManager is created automatically by Game. This is an internal class that authors should not need to construct or modify. However, if you'd like to try, you can find styles for the Save & Restore pop-ups in adventurejs.css. All relevant styles are prefixed with '.save_' or '.restore_'.

Private Constructor:

var foo = new adventurejs.SaveManager(game)

Parameters:

  • game Game
    A reference to the game instance.
Inherited Overrides
IndexMethodsProperties

Methods Collapse all  |  Expand all

clickButton_Browser()

Defined in: adventure/SaveManager.js, line 579

Save game to browser cookie.

Player can name their save however they want. However, we always prepend the game name because local storage applies to all pages on a given domain, meaning that all saves for all games played at, i.e., adventurejs.com will be saved in the same local storage. And, local storage appears not to have any method for nesting data, so we can't have a parent object or 'folder'. Instead, we need to name them in such a way that we can identify them by game.
clickButton_Close()

Defined in: adventure/SaveManager.js, line 530

Function that gets called by the Close button.
clickButton_Server()

Defined in: adventure/SaveManager.js, line 618

Todos: Everything.

Save game to server.
clickSaveButton_File()

Defined in: adventure/SaveManager.js, line 544

Todos: Investigate FileSaver.js

Save to file.
closeDisplay()

Defined in: adventure/SaveManager.js, line 514

Close the Save pop-up window.
openDisplay()

Defined in: adventure/SaveManager.js, line 496

Open the Save pop-up window.
sanitizeInputFileName()

Defined in: adventure/SaveManager.js, line 655

Sanitize input file name. Permitted characters are a-z, A-Z, 0-9, accented vowels áéíóúñü, _underscore, and -hyphen.
selectTab()

Defined in: adventure/SaveManager.js, line 680

Make a selected tab active.
set(props) → {adventurejs.SaveManager}

Defined in: adventure/SaveManager.js, line 704

Parameters:

  • props Object
    A generic object containing properties to copy to the DisplayObject instance.
Provides a chainable shortcut method for setting a number of properties on the instance.

Returns:

adventurejs.SaveManager Returns the instance the method is called on (useful for chaining calls.)

Properties Collapse all  |  Expand all

game :Object

Defined in: adventure/SaveManager.js, line 36

Default value: {}

A reference back to the main Game object.
restoreClose :HTMLElement

Defined in: adventure/SaveManager.js, line 89

Default value: {}

Button element to close the Save pop-up.
saveButtons :Array

Defined in: adventure/SaveManager.js, line 59

Default value: []

Collection of HTML elements: the action buttons for the different save methods.
saveDisplayTitle :HTMLElement

Defined in: adventure/SaveManager.js, line 110

Default value: {}

P element to close the Save pop-up's title bar.
savePane_Browser :HTMLElement

Defined in: adventure/SaveManager.js, line 364

Default value: {}

Div element to contain 'Save to Browser' pane.
savePane_File :HTMLElement

Defined in: adventure/SaveManager.js, line 264

Default value: {}

Div element to contain 'Save to File' pane.
savePane_Server :HTMLElement

Defined in: adventure/SaveManager.js, line 431

Default value: {}

Div element to contain 'Save to Server' pane.
savePanes :Array

Defined in: adventure/SaveManager.js, line 51

Default value: []

Collection of HTML elements: the panes containing the different save methods.
saveRowInput :HTMLElement

Defined in: adventure/SaveManager.js, line 124

Default value: {}

Div element to contain the Save row input.
saveRowPanes :HTMLElement

Defined in: adventure/SaveManager.js, line 250

Default value: {}

Div element to contain Save panes.
saveRowTabs :HTMLElement

Defined in: adventure/SaveManager.js, line 155

Default value: {}

Div element to contain the Save pop-up's tabs.
saveTab_Browser :HTMLElement

Defined in: adventure/SaveManager.js, line 195

Default value: {}

Button element to navigate to 'Save to Browser' option.
saveTab_File :HTMLElement

Defined in: adventure/SaveManager.js, line 168

Default value: {}

Button element to navigate to 'Save to File' option.
saveTab_Server :HTMLElement

Defined in: adventure/SaveManager.js, line 222

Default value: {}

Button element to navigate to 'Save to Server' option.
saveTabs :Array

Defined in: adventure/SaveManager.js, line 43

Default value: []

Collection of HTML elements: the tabs used to navigate between the different save methods.
Documentation generated by JSDoc 3.6.11 on Mon Nov 20 2023 18:02:30 GMT-0800 (Pacific Standard Time)
Found a problem or error in the docs? Report it to docs@adventurejs.com.