Class: OptionsManager

optionsmanager.OptionsManager(MainMenuManager)

The global manager for options.

Constructor

new OptionsManager(MainMenuManager)

Constructs an options storage HTML div using localStorage for previously stored options. This is literally where all the HTML is constructed, and there's a lot of it.
Parameters:
Name Type Description
MainMenuManager module:menumanager~MainMenuManager
Source:
To Do:
  • This could probably be pre-compiled.

Members

Reference to MainMenuManager.
Type:
  • module:menumanager~MainMenuManager
Source:

(private) bindingTarget :Object

The thing we're currently trying to bind.
Type:
  • Object
Source:

(private) currentOption

Currently selected option.
Source:

(private) enabledGames :Set:.<string:>

Set of games to allow play for.
Type:
  • Set:.<string:>
Source:

(readonly) enabledGames

Source:

onVolume

The internal callback for when the game's volume is set. Can only be set (not gotten)
Source:

(private) optionsSelect :HTMLElement

The currently selected options element.
Type:
  • HTMLElement
Source:

(private) optionsStorage :Object:.<string:, (Map:|string:)>

The list of options from localStorage. The keys are the folder IDs of games.
Type:
  • Object:.<string:, (Map:|string:)>
Source:

(private) selectPressed

Did we press a button to bind a key?
Source:

Methods

clearBindButton(game, bindingName, ev)

Called when the clear button gets pressed. Resets all the relevant bindings.
Parameters:
Name Type Description
game string Game ID
bindingName string Binding ID
ev Event The event that called the push to the clear button.
Source:

clearBindings(gameName, bindingName)

Clear ALL bindings.
Parameters:
Name Type Description
gameName string Game ID
bindingName string Binding ID
Source:

optionsSave()

Save the options to localStorage.
Source:

resetBindings(gameName, bindingName)

Make some calls to module:input~MicrogameInputManager to reset our current bindings. Update module:optionsmanager.OptionsManager#optionsStorage.
Parameters:
Name Type Description
gameName string Game ID
bindingName string Binding ID
Source:

startManagingOptions()

Add our current options to the selectables list in module:menumanager~MainMenuManager.
Source:

stopBinding()

Stop trying to find a key to bind for.
Source:

swapToOptions(gameName)

Select a game's options to swap to.
Parameters:
Name Type Description
gameName string Game ID.
Source:

updateBinding(game, bindingName, event)

Start binding a game's control.
Parameters:
Name Type Description
game string Game ID.
bindingName string Binding ID.
event Event The event that started this action.
Source:

updateBindingCapture(target, game, bindingName, bindingPressed)

Update a binding when we recieve a key press from module:input~MicrogameInputManager
Parameters:
Name Type Description
target HTMLElement The element we're displaying the key pressed on.
game string Game ID
bindingName string The direction we're binding to. Usually ArrowUp, ArrowDown, ArrowLeft, ArrowRight, or Space.
bindingPressed Object
Source:

updateEnabled(game, event)

Update whether or not a game has been enabled.
Parameters:
Name Type Description
game string Game ID.
event Event Event for the checkbox.
Source: