dd.net
Class TurnClient

java.lang.Object
  extended bydd.net.NetClient
      extended bydd.net.TurnClient
All Implemented Interfaces:
Chat, Client, java.lang.Runnable
Direct Known Subclasses:
ObserverClient

public class TurnClient
extends NetClient

This is the turn client for DLUG. It handles all of the local (client) logic for player actions during a turn. It's also the message handler, and mediates between the UI and the networking.

Author:
Seth McGinnis

Field Summary
protected  java.lang.String myPlayerID
           
 
Fields inherited from class dd.net.NetClient
ALIVE_PERIOD, DEFAULT_SERVER, DISCOVERY_URL, uiClient
 
Constructor Summary
TurnClient(UI ui, java.lang.String serverName)
           
 
Method Summary
 void amend(Proposal prop)
           
 void callForVote(java.lang.String proposalID)
           
 void createNewGame(java.lang.String gameName)
           
 void endBriefing()
           
 boolean gameListDirty()
           
 java.lang.String[] getGameList()
           
 GameRoot getRoot()
           
 void joinGame(java.lang.String gameName)
           
 void joinGame(java.lang.String playerName, int playerRequest)
           
 void joinGame(java.lang.String gameName, int playerRequest, java.lang.String playerName)
           
 void listGames()
           
 void opinion(java.lang.String proposalID, java.lang.String reasoning)
           
 void randomProposal()
           
 void rejoinGame(java.lang.String gameName, int playerRequest)
           
 void sendChatMessage(java.lang.String user, java.lang.String message)
          This overrides the Chat interface in NetClient to include role information in the chat message.
 void setupDefaultActions()
           
 void vote(int vote)
           
 void votingTimerExpired()
           
 void withdraw(java.lang.String proposalID)
           
 
Methods inherited from class dd.net.NetClient
addHandler, discoverVenues, getClientName, getReader, gotChatMessage, handleMessage, isRunning, main, run, sendMessage, setChatClient, setClientName, setGame, setUI, startRunning, stopRunning, waitUntilReady
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

myPlayerID

protected java.lang.String myPlayerID
Constructor Detail

TurnClient

public TurnClient(UI ui,
                  java.lang.String serverName)
           throws java.lang.Exception
Method Detail

getRoot

public GameRoot getRoot()

setupDefaultActions

public void setupDefaultActions()
Overrides:
setupDefaultActions in class NetClient

getGameList

public java.lang.String[] getGameList()

endBriefing

public void endBriefing()

randomProposal

public void randomProposal()

gameListDirty

public boolean gameListDirty()

listGames

public void listGames()

joinGame

public void joinGame(java.lang.String gameName)

rejoinGame

public void rejoinGame(java.lang.String gameName,
                       int playerRequest)

joinGame

public void joinGame(java.lang.String playerName,
                     int playerRequest)

joinGame

public void joinGame(java.lang.String gameName,
                     int playerRequest,
                     java.lang.String playerName)

createNewGame

public void createNewGame(java.lang.String gameName)

withdraw

public void withdraw(java.lang.String proposalID)

opinion

public void opinion(java.lang.String proposalID,
                    java.lang.String reasoning)

amend

public void amend(Proposal prop)

callForVote

public void callForVote(java.lang.String proposalID)

vote

public void vote(int vote)

votingTimerExpired

public void votingTimerExpired()

sendChatMessage

public void sendChatMessage(java.lang.String user,
                            java.lang.String message)
This overrides the Chat interface in NetClient to include role information in the chat message. NetClient implements this method when the user sends a chat message. Chat messages in DLUG should include role information as part of the chat. This overrieds that behavior by appending the role information to the user name.

Specified by:
sendChatMessage in interface Chat
Overrides:
sendChatMessage in class NetClient
Parameters:
user - user sending the chat message
message - the chat message that needs to be sent