Package com.barrybecker4.game.common.online

Examples of com.barrybecker4.game.common.online.GameCommand


            throw new RuntimeException(e);
        }

        try {
            // initial update to the game tables for someone entering the room.
            GameCommand cmd = new GameCommand(GameCommand.Name.UPDATE_TABLES, cmdProcessor.getTables());
            update(cmd);

            while (!stopped) {
                // receive the serialized commands that are sent and process them.
                cmd = (GameCommand) iStream.readObject();
View Full Code Here


            default:
                assert false : "Unhandled command: "+ cmd;
        }

        if (useUpdateTable) {
            GameCommand response = new GameCommand(GameCommand.Name.UPDATE_TABLES, getTables());
            responses.add(0, response)// add as first command in response.
        }

        return responses;
    }
View Full Code Here

        // get all robot player actions until the next human player
        List<PlayerAction> robotActions = ((MultiGameController)controller_).getRecentRobotActions();

        for (PlayerAction act : robotActions) {
            GameCommand robotCmd = new GameCommand(GameCommand.Name.DO_ACTION, act);
            GameContext.log(0, "adding response command for robot action on server :" + robotCmd);
            responses.add(robotCmd);
        }
    }
View Full Code Here

        GameContext.log(0, "UpdateWorker terminated.");
    }

    private void processNextCommand() throws IOException, ClassNotFoundException {

        GameCommand cmd = (GameCommand) inputStream.readObject();
        GameContext.log(0, "Client Connection: got an update from the server:" + cmd);

        boolean processed = false;
        int count = 0;
View Full Code Here

        if (e.getKeyChar() == '\n') {
            String txt = messageField_.getText();
            txt = txt.trim();
            if (txt.length() > 0) {
                messageField_.setText("");
                connection_.sendCommand(new GameCommand(GameCommand.Name.CHAT_MESSAGE, txt));
            }
        }
    }
View Full Code Here

    /**
     * Request an initial update when we enter the room with the game tables.
     */
    @Override
    public void enterRoom() {
        sendCommand(new GameCommand(GameCommand.Name.ENTER_ROOM, ""));
    }
View Full Code Here

     * Tell the server to add another game table to the list that is available.
     * @param newTable  to add.
     */
    @Override
    public void addGameTable(OnlineGameTable newTable) {
        sendCommand(new GameCommand(GameCommand.Name.ADD_TABLE, newTable));
    }
View Full Code Here

    }

    @Override
    public void nameChanged(String oldName, String newName) {
        String changer = oldName + GameCommand.CHANGE_TO + newName;
        sendCommand(new GameCommand(GameCommand.Name.CHANGE_NAME, changer));
    }
View Full Code Here

     * The server will look at the most recently added player to this table to determine who was added.
     */
    @Override
    public void joinTable(Player p, OnlineGameTable table) {
        table.addPlayer(p);
        sendCommand(new GameCommand(GameCommand.Name.JOIN_TABLE, table));
    }
View Full Code Here

        sendCommand(new GameCommand(GameCommand.Name.JOIN_TABLE, table));
    }

    @Override
    public void leaveRoom(String playerName) {
        sendCommand(new GameCommand(GameCommand.Name.LEAVE_ROOM, playerName));
    }
View Full Code Here

TOP

Related Classes of com.barrybecker4.game.common.online.GameCommand

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.