|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectes.ucm.fdi.hysteria.gui.Controller
public class Controller
This class provides an interface to communicate a given Game with any number of GUIs. It also provides with methods to represent the old Commands.
Field Summary | |
---|---|
protected java.util.Properties |
_config
|
protected java.util.Deque<Game> |
_future
|
protected Game |
_game
|
protected java.util.Set<GUIHandler> |
_guis
|
protected java.util.Deque<Game> |
_history
|
protected Item |
_key
|
protected Message |
_lastMessage
|
protected boolean |
_online
|
protected java.io.ObjectInputStream |
_onlineIos
|
protected java.io.ObjectOutputStream |
_onlineOos
|
protected java.net.Socket |
_socket
|
Constructor Summary | |
---|---|
Controller(Game theGame,
GUIHandler gui)
Builds a controller with a given game and an initial GUI |
|
Controller(Game theGame,
java.util.Properties config,
GUIHandler gui)
Creates a controller with a given game, a given config and an initial GUI |
Method Summary | |
---|---|
void |
addGUI(GUIHandler gui)
Adds a new gui to the list of guis |
void |
clearEvents()
|
void |
commandClose(GUIHandler owner,
Game.Direction dir)
Tries to close an obstacle in a given direction |
void |
commandCloseWith(GUIHandler owner,
Game.Direction dir,
Item item)
Tries to close an obstacle in a given direction with a given item |
void |
commandDrop(Item item)
Tries to drop an item |
void |
commandGo(GUIHandler owner,
Game.Direction dir)
Tries to move in a given direction |
void |
commandOpen(GUIHandler owner,
Game.Direction dir)
Tries to open an obstacle in a given direction |
void |
commandOpenWith(GUIHandler owner,
Game.Direction dir,
Item item)
Tries to open an obstacle in a given direction with a given item |
void |
commandPresent(GUIHandler owner,
Item item)
|
void |
commandRedo(GUIHandler owner)
Tries to redo an action |
void |
commandTake(GUIHandler owner,
Item item)
Tries to take an item |
void |
commandTalk(java.lang.String topic)
|
void |
commandUndo(GUIHandler owner)
Tries to undo an action |
void |
commandUse(GUIHandler owner,
Item item)
|
void |
commandUseWith(GUIHandler owner,
Item item1,
Item item2)
|
void |
connect(java.lang.String user,
java.lang.String pass)
|
void |
disconnect()
|
java.lang.String |
getEvents()
|
java.lang.String |
getGameTitle()
|
java.lang.String |
getInfo()
|
java.util.Vector<java.lang.String> |
getTopics()
|
java.util.Vector<UserFileData> |
getUserFilesVector()
|
boolean |
hasEvents()
|
boolean |
isOnline()
|
boolean |
loadGame(java.lang.String path)
Loads a new game |
boolean |
saveGame(java.lang.String path)
Tries to save the game |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected Game _game
protected java.util.Properties _config
protected java.util.Set<GUIHandler> _guis
protected Item _key
protected java.net.Socket _socket
protected boolean _online
protected java.io.ObjectOutputStream _onlineOos
protected java.io.ObjectInputStream _onlineIos
protected Message _lastMessage
protected java.util.Deque<Game> _history
protected java.util.Deque<Game> _future
Constructor Detail |
---|
public Controller(Game theGame, GUIHandler gui)
theGame
- The gamegui
- The Guipublic Controller(Game theGame, java.util.Properties config, GUIHandler gui)
theGame
- The gameconfig
- The configgui
- The GuiMethod Detail |
---|
public void addGUI(GUIHandler gui)
gui
- The new guipublic boolean hasEvents()
public java.lang.String getEvents()
public void clearEvents()
public boolean isOnline()
public boolean saveGame(java.lang.String path)
path
- The path where to save the gamepublic boolean loadGame(java.lang.String path)
path
- The path to the savegamepublic void connect(java.lang.String user, java.lang.String pass)
public void disconnect()
public java.util.Vector<UserFileData> getUserFilesVector() throws java.io.IOException, java.lang.ClassNotFoundException
java.io.IOException
java.lang.ClassNotFoundException
public java.lang.String getGameTitle()
public java.lang.String getInfo()
public void commandGo(GUIHandler owner, Game.Direction dir)
owner
- The GUI owner of the commanddir
- The directionpublic void commandOpen(GUIHandler owner, Game.Direction dir)
owner
- The GUI owner of the commanddir
- The directionpublic void commandOpenWith(GUIHandler owner, Game.Direction dir, Item item)
owner
- The GUI owner of the commanddir
- The directionitem
- The itempublic void commandClose(GUIHandler owner, Game.Direction dir)
owner
- The GUI owner of the commanddir
- The directionpublic void commandCloseWith(GUIHandler owner, Game.Direction dir, Item item)
owner
- The GUI owner of the commanddir
- The directionitem
- The itempublic void commandUndo(GUIHandler owner)
owner
- The GUI owner of the commandpublic void commandRedo(GUIHandler owner)
owner
- The GUI owner of the commandpublic void commandTake(GUIHandler owner, Item item)
owner
- The GUI owner of the commanditem
- The itempublic void commandDrop(Item item)
item
- The itempublic void commandUse(GUIHandler owner, Item item)
public void commandUseWith(GUIHandler owner, Item item1, Item item2)
public java.util.Vector<java.lang.String> getTopics()
public void commandTalk(java.lang.String topic)
public void commandPresent(GUIHandler owner, Item item)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |