|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object java.awt.MenuComponent java.awt.MenuItem java.awt.Menu java.awt.PopupMenu soc.client.SOCBoardPanel.BoardPopupMenu
private class SOCBoardPanel.BoardPopupMenu
This class creates a popup menu on the board, to trade or build or cancel building.
actionPerformed(ActionEvent)
usually calls
SOCBuildingPanel.clickBuildingButton(SOCGame, String, boolean)
to send messages to the server.
Nested Class Summary |
---|
Nested classes/interfaces inherited from class java.awt.PopupMenu |
---|
java.awt.PopupMenu.AccessibleAWTPopupMenu |
Nested classes/interfaces inherited from class java.awt.Menu |
---|
java.awt.Menu.AccessibleAWTMenu |
Nested classes/interfaces inherited from class java.awt.MenuItem |
---|
java.awt.MenuItem.AccessibleAWTMenuItem |
Nested classes/interfaces inherited from class java.awt.MenuComponent |
---|
java.awt.MenuComponent.AccessibleAWTMenuComponent |
Field Summary | |
---|---|
(package private) SOCBoardPanel |
bp
our parent boardpanel |
(package private) java.awt.MenuItem |
buildRoadItem
|
(package private) java.awt.MenuItem |
buildSettleItem
|
(package private) java.awt.MenuItem |
buildShipItem
Menu item to build or move a ship if SOCGame.hasSeaBoard , or null. |
(package private) java.awt.MenuItem |
cancelBuildItem
Menu item to cancel a build as we're placing it, or to cancel moving a ship. |
private int |
cancelBuildType
If allow cancel, type of building piece ( SOCPlayingPiece.ROAD , SETTLEMENT, ...) to cancel |
private int |
hoverCityID
hover city node ID, or 0, at menu-show time |
private int |
hoverRoadID
hover road edge ID, or 0, at menu-show time |
private int |
hoverSettlementID
hover settlement node ID, or 0, at menu-show time. |
private int |
hoverShipID
hover ship edge ID, or 0, at menu-show time. |
protected boolean |
isInitialPlacement
Will this be for initial placement (send putpiece right away), or for placement during game (send build, receive gamestate, send putpiece)? |
private boolean |
isShipMovable
True if we can move a ship, at menu-show time. |
private boolean |
isShipWarship
True if the ship is a warship, at menu-show time (scenario option _SC_PIRI ). |
private boolean |
menuPlayerIsCurrent
determined at menu-show time |
(package private) SOCHandPanel.ResourceTradePopupMenu |
portTradeSubmenu
determined at menu-show time, only over a useable port. |
(package private) java.awt.MenuItem |
upgradeCityItem
|
private boolean |
wantsCancel
determined at menu-show time |
Constructor Summary | |
---|---|
SOCBoardPanel.BoardPopupMenu(SOCBoardPanel bpanel)
create a new BoardPopupMenu on this board |
Method Summary | |
---|---|
void |
actionPerformed(java.awt.event.ActionEvent e)
Handling the menu items |
void |
confirmAttackPirateFortress()
Confirm with the user that they want to atack the pirate fortress and end their turn, in scenario _SC_PIRI . |
void |
showAtPirateFortress(int x,
int y,
SOCFortress ft)
Custom show method for hovering at a pirate fortress ( SOCFortress ),
giving the options to attack if it's our player's;
for scenario option _SC_PIRI . |
void |
showBuild(int x,
int y,
int hR,
int hSe,
int hC,
int hSh)
Custom show method that finds current game status and player status. |
void |
showCancelBuild(int buildType,
int x,
int y,
int hilightAt)
Custom 'cancel' show method for when placing a road/settlement/city, giving the build/cancel options for that type of piece. |
void |
tryAttackPirateFortress()
Send request to server to attack our player's pirate fortress, in scenario _SC_PIRI . |
(package private) void |
tryBuild(int ptype)
Send message to server to request placing this piece, if allowable. |
(package private) void |
tryCancel()
Cancel placing a building piece, or cancel moving a ship. |
private void |
tryMoveShipFromHere()
Set up the board so the player can click where they want the ship moved. |
Methods inherited from class java.awt.PopupMenu |
---|
addNotify, getAccessibleContext, getParent, show |
Methods inherited from class java.awt.Menu |
---|
add, add, addSeparator, countItems, getItem, getItemCount, insert, insert, insertSeparator, isTearOff, paramString, remove, remove, removeAll, removeNotify |
Methods inherited from class java.awt.MenuItem |
---|
addActionListener, deleteShortcut, disable, disableEvents, enable, enable, enableEvents, getActionCommand, getActionListeners, getLabel, getListeners, getShortcut, isEnabled, processActionEvent, processEvent, removeActionListener, setActionCommand, setEnabled, setLabel, setShortcut |
Methods inherited from class java.awt.MenuComponent |
---|
dispatchEvent, getFont, getName, getPeer, getTreeLock, postEvent, setFont, setName, toString |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Methods inherited from interface java.awt.MenuContainer |
---|
getFont, postEvent |
Field Detail |
---|
final SOCBoardPanel bp
final java.awt.MenuItem buildRoadItem
final java.awt.MenuItem buildSettleItem
final java.awt.MenuItem upgradeCityItem
final java.awt.MenuItem buildShipItem
SOCGame.hasSeaBoard
, or null.
final java.awt.MenuItem cancelBuildItem
cancelBuildType
.
SOCHandPanel.ResourceTradePopupMenu portTradeSubmenu
private boolean menuPlayerIsCurrent
private boolean wantsCancel
private int cancelBuildType
SOCPlayingPiece.ROAD
, SETTLEMENT, ...) to cancel
private int hoverRoadID
private int hoverSettlementID
buildSettleItem
's text will be "Attack Fortress" instead of "Build Settlement";
menu item will be disabled unless it's player's own fortress and SOCGame.canAttackPirateFortress()
.
private int hoverCityID
private int hoverShipID
private boolean isShipMovable
hoverShipID
must be != 0.
private boolean isShipWarship
_SC_PIRI
).
hoverShipID
must be != 0.
protected boolean isInitialPlacement
Constructor Detail |
---|
public SOCBoardPanel.BoardPopupMenu(SOCBoardPanel bpanel)
Method Detail |
---|
public void showCancelBuild(int buildType, int x, int y, int hilightAt)
buildType
- piece type (SOCPlayingPiece.ROAD, CITY, SETTLEMENT)x
- Mouse x-positiony
- Mouse y-positionhilightAt
- Current hover/hilight coordinates of piece being cancelled/placedpublic void showBuild(int x, int y, int hR, int hSe, int hC, int hSh)
x
- Mouse x-positiony
- Mouse y-positionhR
- Hover road ID, or 0hSe
- Hover settle ID, or 0hC
- Hover city ID, or 0hSh
- Hover ship ID, or 0; use negative if can move this currently placed ship.
hSh < 0 is the only time this method trusts the caller's
game state checks, instead of doing its own checking.public void showAtPirateFortress(int x, int y, SOCFortress ft)
SOCFortress
),
giving the options to attack if it's our player's;
for scenario option _SC_PIRI
.
x
- Mouse x-positiony
- Mouse y-positionft
- Fortress being hovered at (our player's or otherwise), or nullpublic void actionPerformed(java.awt.event.ActionEvent e)
actionPerformed
in interface java.awt.event.ActionListener
void tryBuild(int ptype)
hoverSettlementID
, hoverShipID
, etc
when tryBuild
is called.
Assumes player is current, and player is non-null, when called.
ptype
- Piece type, like SOCPlayingPiece.ROAD
public void confirmAttackPirateFortress()
_SC_PIRI
. If confirmed, will call
tryAttackPirateFortress()
.
public void tryAttackPirateFortress()
_SC_PIRI
.
void tryCancel()
SOCBuildingPanel.clickBuildingButton(SOCGame, String, boolean)
.
private void tryMoveShipFromHere()
SOCBoardPanel.MOVE_SHIP
and set SOCBoardPanel.moveShip_fromEdge
.
Assumes player is current, and the ship at hoverShipID
is movable, when called.
Repaints the board.
SOCBoardPanel.tryMoveShipToEdge()
,
SOCBoardPanel.setModeMoveShip(int)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |