public class HostMenu extends NewGameMenu implements InternalServer.InternalServerListener
Modifier and Type | Class and Description |
---|---|
private class |
HostMenu.HostPanel
Special player panel that cannot be removed.
|
private class |
HostMenu.RemotePanel
Special player panel that cannot be removed or edited.
|
NewGameMenu.PlayerPanel
Modifier and Type | Field and Description |
---|---|
private java.lang.String |
error
Error message, if any.
|
private static java.lang.String |
lastHostName
Last name used by the host.
|
private InternalServer |
server
The multiplayer server.
|
p1, p2, p3, p4, showDecomp
BOTTOM_OFFSET, BOX_HEADER_HEIGHT, BOX_INSETS, BOX_SPACING, BOX_TEXT_OFFSET, SIDE_OFFSET, SPACING, TOP_MIDDLE_OFFSET, TOP_MIDDLE_TEXT_OFFSET, TOP_MIDDLE_WIDTH, TOP_OFFSET, TOP_SIDE_TRIANGLE, TOP_SPACE
Constructor and Description |
---|
HostMenu(ConvexMerger context)
Constructs a new host menu with the given game context.
|
Modifier and Type | Method and Description |
---|---|
protected boolean |
canStart()
Checks if enough players are configured to start (at least 1).
|
protected java.lang.String |
getButtonMessage()
Gets the status message to display on the start button.
|
protected java.lang.String |
getMenuTitle()
Gets the title of this menu.
|
void |
handleException(java.lang.Exception e)
Called when the server encountered a fatal exception
while accepting incoming player connections.
|
protected void |
handleLeftButtonClick()
Handles the bottom left button being clicked.
|
void |
handleMouseRelease(java.awt.geom.Point2D loc,
int width,
int height)
Handles a mouse button release on this screen.
|
void |
handlePlayerJoin(Player player)
Called when a new player joined the server.
|
protected void |
handleStart(java.util.List<Player> players,
PlayfieldGenerator gen)
Handles the start of the actual game given the
player and playfield generator configuration.
|
getLeftButtonText, getRightButtonText, handleKeyPressed, handleKeyReleased, handleRightButtonClick, isLeftButtonEnabled, isRightButtonEnabled, onFocusLost, onTextChange, render, reset, update
computeBox, drawBox, drawButton, drawTitle, drawTitledBox, fillText, getContext, getMaxWidth, handleMouseDrag, handleMouseMove, handleMousePress, render, renderMainInterface, renderMenuTitle, switchScene
private static java.lang.String lastHostName
private InternalServer server
private java.lang.String error
public HostMenu(ConvexMerger context)
context
- The game context.protected void handleStart(java.util.List<Player> players, PlayfieldGenerator gen)
NewGameMenu
handleStart
in class NewGameMenu
players
- The participating players.gen
- The playfield generator to use.public void handlePlayerJoin(Player player)
InternalServer.InternalServerListener
handlePlayerJoin
in interface InternalServer.InternalServerListener
player
- The player that joined.protected void handleLeftButtonClick()
Screen
handleLeftButtonClick
in class NewGameMenu
public void handleException(java.lang.Exception e)
InternalServer.InternalServerListener
handleException
in interface InternalServer.InternalServerListener
e
- The exception that occurred.protected java.lang.String getButtonMessage()
NewGameMenu
getButtonMessage
in class NewGameMenu
protected boolean canStart()
NewGameMenu
canStart
in class NewGameMenu
public void handleMouseRelease(java.awt.geom.Point2D loc, int width, int height)
Screen
handleMouseRelease
in class NewGameMenu
loc
- The location that was clicked.width
- The width of the screen.height
- The height of the screen.protected java.lang.String getMenuTitle()
NewGameMenu
getMenuTitle
in class NewGameMenu