us.asciiroth.client.store
Class GearsStore

java.lang.Object
  extended by us.asciiroth.client.store.GearsStore
All Implemented Interfaces:
Store

public class GearsStore
extends java.lang.Object
implements Store

It's nothing fancy but it works.


Constructor Summary
GearsStore()
           
 
Method Summary
 void deleteBoard(java.lang.String name, java.lang.String boardID)
           
 void deleteGame(java.lang.String name, com.google.gwt.user.client.Command callback)
          Delete the game with this name.
 void deletePlayer(java.lang.String name)
           
 void getSavedGames(NamesCallback callback)
          Get a list of names for all the current saved games.
 void loadBoard(java.lang.String name, java.lang.String boardID, StoreLoadCallback callback)
          Load the board for the saved game indicated, with the given URL (this is the URL as specified in the map data, relative to the root directory of the game).
 void loadGame(java.lang.String name, StoreLoadCallback callback)
          Loads the player's JSON data from persistence and provides it to the callback instance.
 void loadScenario(StoreLoadCallback callback)
          A bit of a hack...
 void saveGame(java.lang.String newName, java.lang.String currentName, java.lang.String player, java.util.Map<java.lang.String,java.lang.String> boards, com.google.gwt.user.client.Command callback)
          Save the game, including the player and any changed but unsaved maps.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GearsStore

public GearsStore()
Method Detail

deleteBoard

public void deleteBoard(java.lang.String name,
                        java.lang.String boardID)

deleteGame

public void deleteGame(java.lang.String name,
                       com.google.gwt.user.client.Command callback)
Description copied from interface: Store
Delete the game with this name.

Specified by:
deleteGame in interface Store

deletePlayer

public void deletePlayer(java.lang.String name)

getSavedGames

public void getSavedGames(NamesCallback callback)
Description copied from interface: Store
Get a list of names for all the current saved games.

Specified by:
getSavedGames in interface Store
Parameters:
callback - to receive saved game names

loadBoard

public void loadBoard(java.lang.String name,
                      java.lang.String boardID,
                      StoreLoadCallback callback)
Description copied from interface: Store
Load the board for the saved game indicated, with the given URL (this is the URL as specified in the map data, relative to the root directory of the game). Loads the board's JSON data from persistence and provides it to the callback instance.

Specified by:
loadBoard in interface Store
Parameters:
name - the name of the saved game
boardID - the url of the board (

loadGame

public void loadGame(java.lang.String name,
                     StoreLoadCallback callback)
Description copied from interface: Store
Loads the player's JSON data from persistence and provides it to the callback instance.

Specified by:
loadGame in interface Store
Parameters:
name - the name of the saved game
callback - an optional callback to execute after the game loads

loadScenario

public void loadScenario(StoreLoadCallback callback)
Description copied from interface: Store
A bit of a hack... in AIR, this presents a directory browsing dialog, and the callback is passed not JSON, but a file path to a directory which can then be used to attempt to load a scenario from disk.

Specified by:
loadScenario in interface Store
Parameters:
callback - will be passed the file path to a directory, not a JSON blob

saveGame

public void saveGame(java.lang.String newName,
                     java.lang.String currentName,
                     java.lang.String player,
                     java.util.Map<java.lang.String,java.lang.String> boards,
                     com.google.gwt.user.client.Command callback)
Description copied from interface: Store
Save the game, including the player and any changed but unsaved maps. Once the save is completed, the optional callback instance will be executed.

Specified by:
saveGame in interface Store
Parameters:
newName - the name of the game
currentName - the current name of the player
player - the player instance for this game
boards - a map of boards keyed by their URLs that have changed
callback - an optional callback command

0.7

© 2009 Alx Dark