public class RunGameInSameJVM extends java.lang.Thread implements IGameRunner, INotifyWebServer
Modifier and Type | Field and Description |
---|---|
private static WebClient |
initiatingWebClient |
private static java.util.logging.Logger |
LOGGER |
private Options |
presetOptions
To exchange data between us and the GetPlayersWeb dialog
when game is started locally
|
private IStartHandler |
startHandler |
private java.lang.String |
username |
private WebClient |
webClient |
private WhatNextManager |
whatNextManager |
ALL_CLIENTS_CONNECTED, GAME_STARTUP_COMPLETED, GAME_STARTUP_FAILED
Constructor and Description |
---|
RunGameInSameJVM(GameInfo gi,
WhatNextManager whatNextMgr,
java.lang.String username,
WebClient webClient) |
Modifier and Type | Method and Description |
---|---|
void |
allClientsConnected() |
void |
gameStartupCompleted() |
void |
gameStartupFailed(java.lang.String reason) |
java.lang.String |
getHostingHost() |
java.lang.String |
getHostingPlayerName() |
int |
getHostingPort() |
static WebClient |
getInitiatingWebClient()
if a Game Server game was started locally on players computer,
then GameServerSide queries the starting web client from here.
|
private WebClient |
getWebClient() |
void |
gotClient(java.lang.String playerName,
boolean remote) |
boolean |
isActive() |
boolean |
makeRunningGame() |
void |
readyToAcceptClients() |
void |
run() |
void |
runGameInSameJVM() |
(package private) void |
runGetPlayersDialogAndWait(Options presetOptions,
WhatNextManager whatNextManager) |
void |
serverStoppedRunning() |
void |
setServerNull() |
static void |
sleepFor(long millis) |
void |
tellServerToInformOtherPlayers() |
boolean |
tryToStart() |
boolean |
waitUntilGameStartedSuccessfully(int timeout) |
boolean |
waitUntilReadyToAcceptClients(int timeout)
Waits until socket is up, i.e.
|
activeCount, checkAccess, clone, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, toString, yield
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
start
private static final java.util.logging.Logger LOGGER
private final Options presetOptions
private final WebClient webClient
private final WhatNextManager whatNextManager
private static WebClient initiatingWebClient
private final java.lang.String username
private final IStartHandler startHandler
public RunGameInSameJVM(GameInfo gi, WhatNextManager whatNextMgr, java.lang.String username, WebClient webClient)
public void run()
run
in interface java.lang.Runnable
run
in class java.lang.Thread
public void runGameInSameJVM()
void runGetPlayersDialogAndWait(Options presetOptions, WhatNextManager whatNextManager)
public void tellServerToInformOtherPlayers()
public static void sleepFor(long millis)
private WebClient getWebClient()
public static WebClient getInitiatingWebClient()
public java.lang.String getHostingPlayerName()
public java.lang.String getHostingHost()
getHostingHost
in interface IGameRunner
public int getHostingPort()
getHostingPort
in interface IGameRunner
public boolean makeRunningGame()
makeRunningGame
in interface IGameRunner
public boolean tryToStart()
tryToStart
in interface IGameRunner
public void setServerNull()
public boolean waitUntilGameStartedSuccessfully(int timeout)
waitUntilGameStartedSuccessfully
in interface IGameRunner
public boolean waitUntilReadyToAcceptClients(int timeout)
IGameRunner
waitUntilReadyToAcceptClients
in interface IGameRunner
public boolean isActive()
isActive
in interface INotifyWebServer
public void readyToAcceptClients()
readyToAcceptClients
in interface INotifyWebServer
public void gotClient(java.lang.String playerName, boolean remote)
gotClient
in interface INotifyWebServer
public void allClientsConnected()
allClientsConnected
in interface INotifyWebServer
public void gameStartupCompleted()
gameStartupCompleted
in interface INotifyWebServer
public void gameStartupFailed(java.lang.String reason)
gameStartupFailed
in interface INotifyWebServer
public void serverStoppedRunning()
serverStoppedRunning
in interface INotifyWebServer