def __init__(self): logging.debug("GameClient") self.board = Board() self.signalemitter = SignalEmitter() self.gameclientgui = GameClientGUI(self) self.serverMsg = None self.state = IDLE() self.fgpclient = FGPClient(self)
class GameClient(IFGPCInd, IGCReq): def __init__(self): logging.debug("GameClient") self.board = Board() self.signalemitter = SignalEmitter() self.gameclientgui = GameClientGUI(self) self.serverMsg = None self.state = IDLE() self.fgpclient = FGPClient(self) def getBoard(self): return self.board def getGameClientGui(self): return self.gameclientgui def getSignalEmitter(self): return self.signalemitter def getServerMsg(self): return self.serverMsg; def setServerMsg(self, serverMsg): self.setServerMsg(serverMsg) def getState(self): return self.state def setState(self, state): logging.debug(self.state.name() + " --> " + state.name()) self.state = state # Delegating incoming events to the states. # Interface IGCReq def play(self, host, port): self.state.play(self, host, port) # Interface IGCReq def move(self, x, y): self.state.move(self, x, y) # Interface IGCReq def quit_freedom(self): self.state.quit_freedom(self) # Interface IFGPCInd def update(self, msg): self.serverMsg = msg self.state.update(self) # Interface IFGPCInd def gameover(self, msg): self.serverMsg = msg self.state.gameover(self) # Interface IFGPCInd def drop(self, msg): self.serverMsg = msg self.state.drop(self)