de.jadv.client
Class GameData

java.lang.Object
  |
  +--de.jadv.client.GameData

public class GameData
extends java.lang.Object

Application that starts the JAdventure game. The JAdvClient forwards the events it handles to its GameData object and the DrawThread makes sure the GameCanvas updates properly.

Author:
neitzel, jbisso

Field Summary
private  java.util.Collection _availableSpecies
           
private  DataLevelBackground _background
           
private  JAdvClient _client
           
private  GameWindow _gameWindow
           
private  java.util.Map _levelsMap
           
private  java.util.Map _objectsMap
           
private  ImageStore _pics
           
protected  boolean dirty
           
 
Constructor Summary
GameData(JAdvClient client)
          Constructor for GameData.
 
Method Summary
 java.util.Collection getAvailableSpecies()
           
 DataLevelBackground getBackground()
           
protected  long getDescription(int x, int y)
           
 java.util.Map getObjects()
           
 ImageStore getPictures()
           
private  JAdvEvent insertLevelData(LevelInformationEvent lie)
           
 void loadLevel(java.io.File level)
          Loads the specified level from disk, puts it in the levels map, and sets the current level.
 void loadLevels()
          Loading levels blows away what was loaded previously, if anything.
 void loadStaticObject(java.io.File file)
           
 void loadStaticObjects(java.lang.String forLevelName)
          Reloads all the static objects for a cached level.
 JAdvEvent nextEvent(AvailableRacesEvent event)
           
 JAdvEvent nextEvent(InNewLevelEvent event)
           
 JAdvEvent nextEvent(JAdvEvent event)
          Generic method for JAdvEvents that are handled yet.
 JAdvEvent nextEvent(LevelInformationEvent event)
           
 JAdvEvent nextEvent(NeedLevelEvent event)
           
 JAdvEvent nextEvent(ObjectEvent event)
           
 JAdvEvent nextEvent(ObjectOutOfSightEvent event)
           
 void saveLevel(java.lang.String key, DataLevelBackground level)
           
 void saveLevels()
          Saves all the level-data in individual serialized DataLevelBackground files.
 void saveStaticObject(DataObject dataObject)
          Caches the specified data object to the local disk.
 void saveStaticObjects()
          Caches all static data objects for the current level to local disk.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

dirty

protected boolean dirty

_client

private JAdvClient _client

_gameWindow

private GameWindow _gameWindow

_background

private DataLevelBackground _background

_availableSpecies

private java.util.Collection _availableSpecies

_levelsMap

private java.util.Map _levelsMap

_objectsMap

private java.util.Map _objectsMap

_pics

private ImageStore _pics
Constructor Detail

GameData

public GameData(JAdvClient client)
Constructor for GameData.

Method Detail

nextEvent

public JAdvEvent nextEvent(JAdvEvent event)
Generic method for JAdvEvents that are handled yet.


nextEvent

public JAdvEvent nextEvent(LevelInformationEvent event)

nextEvent

public JAdvEvent nextEvent(NeedLevelEvent event)

nextEvent

public JAdvEvent nextEvent(InNewLevelEvent event)

nextEvent

public JAdvEvent nextEvent(ObjectEvent event)

nextEvent

public JAdvEvent nextEvent(ObjectOutOfSightEvent event)

nextEvent

public JAdvEvent nextEvent(AvailableRacesEvent event)

getBackground

public DataLevelBackground getBackground()

getObjects

public java.util.Map getObjects()

getPictures

public ImageStore getPictures()

getAvailableSpecies

public java.util.Collection getAvailableSpecies()

loadLevels

public void loadLevels()
Loading levels blows away what was loaded previously, if anything.


loadLevel

public void loadLevel(java.io.File level)
Loads the specified level from disk, puts it in the levels map, and sets the current level.


saveLevels

public void saveLevels()
Saves all the level-data in individual serialized DataLevelBackground files.


saveLevel

public void saveLevel(java.lang.String key,
                      DataLevelBackground level)

saveStaticObjects

public void saveStaticObjects()
Caches all static data objects for the current level to local disk.


saveStaticObject

public void saveStaticObject(DataObject dataObject)
Caches the specified data object to the local disk.


loadStaticObjects

public void loadStaticObjects(java.lang.String forLevelName)
Reloads all the static objects for a cached level.


loadStaticObject

public void loadStaticObject(java.io.File file)

getDescription

protected long getDescription(int x,
                              int y)

insertLevelData

private JAdvEvent insertLevelData(LevelInformationEvent lie)