|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Object | +--VASSAL.build.module.GameState
The GameState represents the state of the game currently being played. Only one game can be open at once.
GameModule.getGameState()| Nested Class Summary | |
static class |
GameState.SetupCommand
|
| Field Summary | |
protected javax.swing.JMenuItem |
closeGame
|
protected java.util.Vector |
gameComponents
|
protected java.lang.String |
lastSave
|
protected javax.swing.JMenuItem |
loadGame
|
protected javax.swing.JMenuItem |
newGame
|
protected java.util.Hashtable |
pieces
|
protected javax.swing.JMenuItem |
saveGame
|
| Constructor Summary | |
GameState()
|
|
| Method Summary | |
void |
addGameComponent(GameComponent theComponent)
Add a GameComponent to the list of objects that will
be notified when a game is started/ended |
void |
addPiece(GamePiece p)
Add a GamePiece to the current game. |
void |
addTo(GameModule mod)
Expects to be added to a GameModule. |
java.util.Enumeration |
getGameComponentsEnum()
|
java.lang.String |
getNewPieceId()
|
GamePiece |
getPieceForId(java.lang.String id)
|
java.util.Enumeration |
getPieces()
|
abstract Command |
getRestoreCommand()
Return a GameState.SetupCommand that, when executed, will restore the
game to its current state. |
boolean |
isGameStarted()
|
boolean |
isModified()
|
abstract void |
loadContinuation(java.io.File f)
|
void |
loadGame()
Read the game from a savefile. |
abstract void |
loadGame(java.io.File f)
|
void |
removeGameComponent(GameComponent theComponent)
Remove a GameComponent from the list of objects that will
be notified when a game is started/ended |
void |
removePiece(java.lang.String id)
Remove a GamePiece from the current game |
void |
saveGame()
Prompts the user for a file into which to save the game |
abstract void |
saveGame(java.io.File f)
|
protected java.lang.String |
saveString()
|
void |
setModified(boolean modified)
|
void |
setup(boolean gameStarting)
Start/end a game. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
protected java.util.Hashtable pieces
protected java.util.Vector gameComponents
protected javax.swing.JMenuItem loadGame
protected javax.swing.JMenuItem saveGame
protected javax.swing.JMenuItem newGame
protected javax.swing.JMenuItem closeGame
protected java.lang.String lastSave
| Constructor Detail |
public GameState()
| Method Detail |
public void addTo(GameModule mod)
New,
Load, Close, and Save
entries to the File menu of the controls window
public boolean isModified()
public void addGameComponent(GameComponent theComponent)
GameComponent to the list of objects that will
be notified when a game is started/ended
public void removeGameComponent(GameComponent theComponent)
GameComponent from the list of objects that will
be notified when a game is started/ended
public java.util.Enumeration getGameComponentsEnum()
GameComponent objects
that have been added to this GameStatepublic void setup(boolean gameStarting)
GameComponent.setup(boolean)
on all registered GameComponent objects
public boolean isGameStarted()
public void loadGame()
GameModule.decode(java.lang.String) and translated into a
GameState.SetupCommand, which is then executed. The command read from the
file should be that returned by getRestoreCommand()
protected java.lang.String saveString()
public abstract Command getRestoreCommand()
GameState.SetupCommand that, when executed, will restore the
game to its current state. Invokes GameComponent.getRestoreCommand()
on each registered GameComponent
public void saveGame()
public void setModified(boolean modified)
public void addPiece(GamePiece p)
GamePiece to the current game.
The GameState keeps track of all GamePieces in the system,
regardless of which Map they belong to (if any)
public GamePiece getPieceForId(java.lang.String id)
GamePiece in the current game with the given idpublic void removePiece(java.lang.String id)
GamePiece from the current game
public java.lang.String getNewPieceId()
GamePiece.getId()
public abstract void loadGame(java.io.File f)
throws java.io.IOException
java.io.IOException
public abstract void saveGame(java.io.File f)
throws java.io.IOException
java.io.IOException
public abstract void loadContinuation(java.io.File f)
throws java.io.IOException
java.io.IOExceptionpublic java.util.Enumeration getPieces()
GamePieces in the game.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||