package jrummikub.control.network; import java.awt.Color; import java.util.UUID; import jrummikub.control.RoundControl.InvalidTurnInfo; import jrummikub.model.IRoundState; import jrummikub.model.ITable; import jrummikub.util.GameData; import jrummikub.util.IEvent; import jrummikub.util.IEvent1; import jrummikub.util.IEvent2; import jrummikub.util.MockEvent; import jrummikub.util.MockEvent1; import jrummikub.util.MockEvent2; import jrummikub.view.LoginError; /** */ public class MockConnectionControl implements IConnectionControl { /** */ public String nickname; /** */ public MockEvent connectedEvent = new MockEvent(); /** */ public MockEvent1 connectionFailedEvent = new MockEvent1(); /** */ public MockEvent1 gameOfferEvent = new MockEvent1(); /** */ public MockEvent1 gameWithdrawalEvent = new MockEvent1(); /** */ public MockEvent1 gameJoinEvent = new MockEvent1(); /** */ public MockEvent1 gameLeaveEvent = new MockEvent1(); /** */ public MockEvent1 gameJoinAckEvent = new MockEvent1(); /** */ public MockEvent2 changeColorEvent = new MockEvent2(); /** */ public MockEvent gameStartEvent = new MockEvent(); /** */ public MockEvent roundStartEvent = new MockEvent(); /** */ public MockEvent1 tableUpdateEvent = new MockEvent1(); /** */ public MockEvent2 turnEndEvent = new MockEvent2(); /** */ public MockEvent1 roundStateUpdateEvent = new MockEvent1(); /** */ public MockEvent nextPlayerEvent = new MockEvent(); /** */ public MockEvent turnStartEvent = new MockEvent(); /** */ public GameData currentGame; /** */ public GameData offeredGame; /** */ public boolean connected; /** */ public boolean failOnConnect; /** */ public GameData joinedGame; /** */ public Color playerColor; /** */ public boolean turnStarted; /** */ public boolean turnEnded; @Override public String getNickname() { return nickname; } @Override public void connect() { if (failOnConnect) { connectionFailedEvent.emit(LoginError.UNKNOWN_ERROR); } else { connected = true; connectedEvent.emit(); } } @Override public void disconnect() { connected = false; } @Override public IEvent getConnectedEvent() { return connectedEvent; } @Override public IEvent1 getConnectionFailedEvent() { return connectionFailedEvent; } @Override public IEvent1 getGameOfferEvent() { return gameOfferEvent; } @Override public IEvent1 getGameWithdrawalEvent() { return gameWithdrawalEvent; } @Override public IEvent1 getGameJoinEvent() { return gameJoinEvent; } @Override public IEvent1 getGameLeaveEvent() { return gameLeaveEvent; } @Override public IEvent1 getGameJoinAckEvent() { return gameJoinAckEvent; } @Override public IEvent2 getChangeColorEvent() { return changeColorEvent; } @Override public IEvent getGameStartEvent() { return gameStartEvent; } @Override public IEvent getRoundStartEvent() { return roundStartEvent; } @Override public IEvent1 getTableUpdateEvent() { return tableUpdateEvent; } @Override public IEvent2 getTurnEndEvent() { return turnEndEvent; } @Override public IEvent getTurnStartEvent() { return turnStartEvent; } @Override public IEvent1 getRoundStateUpdateEvent() { return roundStateUpdateEvent; } @Override public IEvent getNextPlayerEvent() { return nextPlayerEvent; } @Override public void offerGame(GameData data) { offeredGame = data; } @Override public void withdrawGame() { // TODO Auto-generated method stub } @Override public GameData getCurrentGame() { return currentGame; } @Override public void setCurrentGame(GameData game) { currentGame = game; } @Override public void joinGame(GameData game) { currentGame = game; joinedGame = game; } @Override public void leaveGame() { // TODO Auto-generated method stub } @Override public void ackJoinGame(String recipient, boolean ack) { // TODO Auto-generated method stub } @Override public void changeColor(Color color) { playerColor = color; } @Override public void startGame() { // TODO Auto-generated method stub } @Override public void updateTable(ITable table) { // TODO Auto-generated method stub } @Override public void endTurn(IRoundState state, InvalidTurnInfo invalidTurnInfo) { turnEnded = true; } @Override public void startTurn() { turnStarted = true; } @Override public void startRound() { // TODO Auto-generated method stub } @Override public void updateRoundState(IRoundState roundState) { // TODO Auto-generated method stub } @Override public void nextPlayer() { // TODO Auto-generated method stub } }