|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Object
|
+--java.awt.Component
|
+--java.awt.Container
|
+--java.awt.Window
|
+--java.awt.Frame
|
+--javax.swing.JFrame
|
+--gecco.client.Game
This is the main game class. It contains the complete client for an arbitrary game.
| Inner Class Summary | |
(package private) class |
Game.ActionMenuItem
A menu item of the action menu. |
| Inner classes inherited from class javax.swing.JFrame |
JFrame.AccessibleJFrame |
| Inner classes inherited from class java.awt.Frame |
Frame.AccessibleAWTFrame |
| Inner classes inherited from class java.awt.Window |
Window.AccessibleAWTWindow |
| Inner classes inherited from class java.awt.Container |
Container.AccessibleAWTContainer |
| Inner classes inherited from class java.awt.Component |
Component.AccessibleAWTComponent, Component.AWTTreeLock |
| Field Summary | |
(package private) Hashtable |
actionExecutingPieces
The pieces that are currenlty executing some actions. |
(package private) Hashtable |
actionIds
The action id of the currenlty executing action for some piece. |
(package private) JPopupMenu |
actionMenu
The menu that is displayed with piece actions, ghost pieces or ghost actions. |
(package private) ActionListener |
actionMenuListener
The listener that handles selections in the menu that displays the actions of a piece. |
(package private) Board |
board
Description of the Field |
(package private) MouseListener |
boardClicks
The listener that handles clicks on the board. |
(package private) MouseMotionListener |
boardDrags
The listener that handles drags on the board. |
(package private) String |
gameTitle
The title of the game, shown as title in window. |
(package private) JPopupMenu |
ghostActionMenu
The menu that contains the actions of a ghost piece (so far only remove. |
(package private) Point |
ghostMenuClick
The point that was clicked on the board to bring up the ghost menu. |
(package private) int |
lastExtraPieceId
The handle of the ghost or explosion that was added last. |
(package private) HostPort |
lastHost
Description of the Field |
(package private) Map |
map
Description of the Field |
(package private) PieceInfoPanel |
pieceInfoPanel
Description of the Field |
(package private) TreeMap |
pieces
The pieces that are currenlty in the game, hashed on piece handle. |
(package private) Action |
selectedAction
Description of the Field |
(package private) Piece |
selectedPiece
Description of the Field |
(package private) Server |
server
Description of the Field |
(package private) boolean |
useGhosts
All things that has to do with ghost pieces are turned on or off by this flag. |
| Fields inherited from class javax.swing.JFrame |
accessibleContext, defaultCloseOperation, EXIT_ON_CLOSE, rootPane, rootPaneCheckingEnabled |
| Fields inherited from class java.awt.Frame |
base, CROSSHAIR_CURSOR, DEFAULT_CURSOR, E_RESIZE_CURSOR, frameSerializedDataVersion, HAND_CURSOR, icon, ICONIFIED, mbManagement, menuBar, MOVE_CURSOR, N_RESIZE_CURSOR, nameCounter, NE_RESIZE_CURSOR, NORMAL, NW_RESIZE_CURSOR, ownedWindows, resizable, S_RESIZE_CURSOR, SE_RESIZE_CURSOR, serialVersionUID, state, SW_RESIZE_CURSOR, TEXT_CURSOR, title, W_RESIZE_CURSOR, WAIT_CURSOR, weakThis |
| Fields inherited from class java.awt.Window |
active, dbg, focusMgr, inputContext, inputContextLock, OPENED, ownedWindowList, warningString, windowListener, windowSerializedDataVersion |
| Fields inherited from class java.awt.Container |
component, containerListener, containerSerializedDataVersion, dispatcher, layoutMgr, listeningBoundsChildren, listeningChildren, maxSize, ncomponents, printing, printingThreads |
| Fields inherited from interface javax.swing.WindowConstants |
DISPOSE_ON_CLOSE, DO_NOTHING_ON_CLOSE, HIDE_ON_CLOSE |
| Fields inherited from interface java.awt.image.ImageObserver |
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH |
| Constructor Summary | |
Game(String gameTitle)
Constructor for the Game object |
|
| Method Summary | |
void |
abortExecutingAction(Piece p)
Aborts the currently executing action of the given piece. |
void |
abortExecutingAction(Piece p,
boolean abortAll)
Aborts the currently executing action of the given piece. |
void |
actionReply(long id,
boolean ok,
String message)
Description of the Method |
(package private) Piece |
addGhostPiece(Position pos,
String type)
Adds a ghost piece with the specified properties. |
void |
addPiece(int handle,
String name,
Position pos,
Enumeration actions,
Enumeration properties,
String type)
Adds the specified piece, as described in Client.java. |
void |
addPieceAction(int handle,
Action a)
Adds a feature to the PieceAction attribute of the Game object |
void |
animationDone(AnimatedPiece p)
Description of the Method |
void |
connectionLost()
Description of the Method |
(package private) void |
connectToGame()
Description of the Method |
(package private) JPopupMenu |
createActionMenu(Piece p)
Creates the menu that displays the actions of a piece. |
void |
destroyPiece(int handle)
Description of the Method |
(package private) void |
destroyPiece(int handle,
boolean animateExplosion)
Removes the piece with the given handle (if any) from the game. |
(package private) void |
disconnectFromGame()
Description of the Method |
(package private) void |
executeNextAction(Piece p)
Description of the Method |
(package private) JPopupMenu |
getGhostActionMenu()
Returns the menu that contains actions for the ghosts. |
(package private) JPopupMenu |
getGhostMenu()
Returns the menu that displays all ghost pieces that are available. |
Piece |
getPieceAt(Point point)
Returns the piece at the given point of the board, or null if no such piece exists. |
Enumeration |
getPiecesIntersecting(Rectangle rect)
Returns all pieces of the game that intersect the given rectangle. |
Position |
getPreferredCenter()
Returns the preferred center of the board. |
Enumeration |
getSelectedPiecePositions()
Returns the positions of the queued actions (and the currently executing action) of the selected piece, or NULL if no piece is selected. |
void |
invisibilizeMapPoint(Point p)
Description of the Method |
void |
invisibilizeMapPoints(Point[] points)
Description of the Method |
static void |
main(String[] argv)
Main method for program start. |
void |
mapLoadingProgressUpdate(double progress)
Description of the Method |
void |
mapUpdate(Point[] points,
int[] colors)
Description of the Method |
void |
mapUpdate(Point p,
int color)
Description of the Method |
(package private) void |
quit()
Description of the Method |
void |
removePiece(int handle)
Description of the Method |
void |
removePieceAction(int handle,
Action a)
Description of the Method |
void |
repaintAnimation(AnimatedPiece p)
Description of the Method |
(package private) void |
selectAction(Action a)
Description of the Method |
(package private) void |
selectPiece(Piece p)
Description of the Method |
void |
unitMessage(int handle,
String message)
Description of the Method |
(package private) void |
unselectAction()
Description of the Method |
(package private) void |
unselectPiece()
Description of the Method |
void |
updatePiece(int handle,
Position newPosition)
Description of the Method |
void |
updatePiece(int handle,
Property[] newProperties)
Description of the Method |
| Methods inherited from class java.awt.Frame |
|
| Methods inherited from class java.lang.Object |
clone, equals, getClass, hashCode, notify, notifyAll, registerNatives, wait, wait, wait |
| Methods inherited from interface java.awt.MenuContainer |
getFont, postEvent |
| Field Detail |
String gameTitle
Server server
HostPort lastHost
Board board
Map map
PieceInfoPanel pieceInfoPanel
TreeMap pieces
Hashtable actionExecutingPieces
Hashtable actionIds
int lastExtraPieceId
Piece selectedPiece
Action selectedAction
ActionListener actionMenuListener
MouseListener boardClicks
MouseMotionListener boardDrags
JPopupMenu actionMenu
JPopupMenu ghostActionMenu
Point ghostMenuClick
boolean useGhosts
| Constructor Detail |
public Game(String gameTitle)
gameTitle - Description of Parameter| Method Detail |
public Piece getPieceAt(Point point)
point - Description of Parameterpublic Enumeration getPiecesIntersecting(Rectangle rect)
rect - Description of Parameterpublic Position getPreferredCenter()
public Enumeration getSelectedPiecePositions()
public void mapUpdate(Point[] points,
int[] colors)
mapUpdate in interface Clientpoints - Description of Parametercolors - Description of Parameter
public void mapUpdate(Point p,
int color)
mapUpdate in interface Clientp - Description of Parametercolor - Description of Parameterpublic void invisibilizeMapPoints(Point[] points)
invisibilizeMapPoints in interface Clientpoints - Description of Parameterpublic void invisibilizeMapPoint(Point p)
invisibilizeMapPoint in interface Clientp - Description of Parameter
public void unitMessage(int handle,
String message)
unitMessage in interface Clienthandle - Description of Parametermessage - Description of Parameter
public void addPiece(int handle,
String name,
Position pos,
Enumeration actions,
Enumeration properties,
String type)
addPiece in interface Clienthandle - The feature to be added to the Piece attributename - The feature to be added to the Piece attributepos - The feature to be added to the Piece attributeactions - The feature to be added to the Piece attributeproperties - The feature to be added to the Piece attributetype - The feature to be added to the Piece attribute
public void updatePiece(int handle,
Property[] newProperties)
updatePiece in interface Clienthandle - Description of ParameternewProperties - Description of Parameter
public void updatePiece(int handle,
Position newPosition)
updatePiece in interface Clienthandle - Description of ParameternewPosition - Description of Parameterpublic void removePiece(int handle)
removePiece in interface Clienthandle - Description of Parameterpublic void destroyPiece(int handle)
destroyPiece in interface Clienthandle - Description of Parameter
public void addPieceAction(int handle,
Action a)
addPieceAction in interface Clienthandle - The feature to be added to the PieceAction attributea - The feature to be added to the PieceAction attribute
public void removePieceAction(int handle,
Action a)
removePieceAction in interface Clienthandle - Description of Parametera - Description of Parameter
public void actionReply(long id,
boolean ok,
String message)
actionReply in interface Clientid - Description of Parameterok - Description of Parametermessage - Description of Parameterpublic void connectionLost()
connectionLost in interface Clientpublic void mapLoadingProgressUpdate(double progress)
mapLoadingProgressUpdate in interface Clientprogress - Description of Parameterpublic void repaintAnimation(AnimatedPiece p)
repaintAnimation in interface Animatorp - Description of Parameterpublic void animationDone(AnimatedPiece p)
animationDone in interface Animatorp - Description of Parameter
public void abortExecutingAction(Piece p,
boolean abortAll)
p - The piece.abortAll - Indiactes whether or not all executing actions should
be aborted.public void abortExecutingAction(Piece p)
p - Description of ParameterJPopupMenu getGhostMenu()
JPopupMenu getGhostActionMenu()
void executeNextAction(Piece p)
p - Description of Parametervoid selectPiece(Piece p)
p - Description of Parametervoid unselectPiece()
void selectAction(Action a)
a - Description of Parametervoid unselectAction()
void destroyPiece(int handle,
boolean animateExplosion)
animateExplosion - Should there be an explosion?handle - Description of Parameter
Piece addGhostPiece(Position pos,
String type)
pos - The feature to be added to the GhostPiece attributetype - The feature to be added to the GhostPiece attributeJPopupMenu createActionMenu(Piece p)
p - Description of Parametervoid quit()
void disconnectFromGame()
void connectToGame()
public static void main(String[] argv)
argv - The command line arguments
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||