Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.huguesjohnson.tiamat
Class GameData

    java.lang.Object
      com.huguesjohnson.tiamat.GameData

All Implemented Interfaces:
  Storable

    public class GameData

extends java.lang.Object
implements Storable

GameData - contains global data for a game

Author:
  Hugues Johnson

Field Summary
`protected java.lang.String` | `absoluteDir` Absolute path to the directory where characters are saved.

Constructor Summary
`GameData()`

Method Summary
`void` | `addCharacter(java.lang.String characterPath, Formatter formatter)` Adds a Character to this game.
`ItemCollection` | `getAvailableItems()` Returns an ItemCollection representing all Items available in the game.
`Character` | `getCharacter(java.lang.String name)` Returns the character with the specified name.
`java.lang.String[]` | `getCharacterPaths()` Returns a list of all relative paths to Charaters.
`Character[]` | `getCharacters()` Returns all the Charaters available in this game.
`Item` | `getItem(java.lang.String path)` Returns the Item with the specified name if it exists, otherwise null.
`GameScript` | `getScript()` Returns the script for this game.
`void` | `onDeserialize(Formatter formatter, java.lang.String absoluteDir)` The onDeserialize event should be fired after an object is de-serialized.
`void` | `setAbsoluteDir(java.lang.String absoluteDir)` Sets the absolute path to the directory where characters are saved.
`void` | `setAvailableItems(ItemCollection availableItems)` Sets the collection of all Items available in the game.
`void` | `setCharacters(java.lang.String[] characterPaths, Formatter formatter)` Sets the Characters for this game.
`void` | `setScript(GameScript script)` Sets the script for this game.
`void` | `setScript(java.lang.String scriptPath, Formatter formatter)` Loads the script for this game.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### absoluteDir

    protected transient java.lang.String absoluteDir

  Absolute path to the directory where characters are saved.

Constructor Detail

### GameData

    public GameData()

Method Detail

### getAvailableItems

    public ItemCollection getAvailableItems()

  Returns an ItemCollection representing all Items available in the game.

  Returns:
    An ItemCollection representing all Items available in the game.

### setAvailableItems

    public void setAvailableItems(ItemCollection availableItems)

  Sets the collection of all Items available in the game.

  Parameters:
    `availableItems` - The collection of all Items available in the game.

### getScript

    public GameScript getScript()

  Returns the script for this game.

  Returns:
    The script for this game.

### setScript

    public void setScript(GameScript script)

  Sets the script for this game.

  Parameters:
    `script` - The script for this game.

### setScript

    public void setScript(java.lang.String scriptPath,
                          Formatter formatter)

  Loads the script for this game.

  Parameters:
    `scriptPath` - The path to the script file.
    `formatter` - The formatter to use to deserialize the Characters.

### getCharacters

    public Character[] getCharacters()

  Returns all the Charaters available in this game.

  Returns:
    All the Charaters available in this game.

### getCharacterPaths

    public java.lang.String[] getCharacterPaths()

  Returns a list of all relative paths to Charaters.

  Returns:
    a list of all relative paths to Charaters.

### setCharacters

    public void setCharacters(java.lang.String[] characterPaths,
                              Formatter formatter)

  Sets the Characters for this game.

  Parameters:
    `characterPaths` - The paths to the Character files.
    `formatter` - The formatter to use to deserialize the Characters.

### addCharacter

    public void addCharacter(java.lang.String characterPath,
                             Formatter formatter)

  Adds a Character to this game.

  Parameters:
    `characterPath` - The path to the Character file.
    `formatter` - The formatter to use to deserialize the Characters.

### setAbsoluteDir

    public void setAbsoluteDir(java.lang.String absoluteDir)

  Sets the absolute path to the directory where characters are saved.

  Parameters:
    `absoluteDir` - The absolute path to the directory where characters are saved.

### getCharacter

    public Character getCharacter(java.lang.String name)

  Returns the character with the specified name. Performs a case-insensitive search of character paths that end with name+".character.xml". Probably not the best way to do this

  Parameters:
    `name` - The name of the character to search for.
  Returns:
    The character with the specified name, null if not found.

### getItem

    public Item getItem(java.lang.String path)

  Returns the Item with the specified name if it exists, otherwise null.

  Parameters:
    `path` - The name of the Item to retreive.
  Returns:
    The Item with the specified name if it exists, otherwise null.

### onDeserialize

    public void onDeserialize(Formatter formatter,
                              java.lang.String absoluteDir)

  The onDeserialize event should be fired after an object is de-serialized. This allows objects to load transient members, set their working directory, and load Storable members if needed.

  Specified by:
    `onDeserialize` in interface `Storable`
  Parameters:
    `formatter` - the formatter to use to load any storable members
    `absoluteDir` - the working directory since all paths stored in the object should be relative

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD