Package com.barrybecker4.common.geometry

Examples of com.barrybecker4.common.geometry.Location


        // 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(2, "chat message=" + cmd.getArgument());
                useUpdateTable = false;
                responses.add(cmd);
                break;
            case START_GAME:
                OnlineGameTable tableToStart = (OnlineGameTable) cmd.getArgument();
                startGame(tableToStart);
                useUpdateTable = false;
                tableManager.removeTable(tableToStart);
                break;
            case DO_ACTION :
View Full Code Here

    /**
     * Create the online game server to serve all online clients.
     */
    public GameTableManager() {

        tables_ = new OnlineGameTableList();
    }
View Full Code Here

        while (it.hasNext()) {
            OnlineGameTable table = it.next();
            // loop through the list of players and remove the player if the name matches
            Iterator<Player> pit = table.getPlayers().iterator();
            while (pit.hasNext()) {
                Player p = pit.next();
                if (p.getName().equals(playerName))  {
                    pit.remove();
                    break;
                }
            }
            if (table.hasNoHumanPlayers())  {
View Full Code Here

     * If the player at this new table is already sitting at another table,
     * remove him from the other tables(s) and delete those other tables (if no one else is there).
     */
    void joinTable(OnlineGameTable table) {

        Player p = table.getNewestHumanPlayer();

        tables_.removePlayer(p);
        tables_.join(table.getName(), p);
    }
View Full Code Here

        }
        controller_.reset();
        controller_.setPlayers(newPlayers);

        // if getFirstPlayer returns null, then it is not a turn based game
        Player firstPlayer = controller_.getPlayers().getFirstPlayer();
        if (firstPlayer != null && !firstPlayer.isHuman()) {
            controller_.computerMovesFirst();
        }
    }
View Full Code Here

     * @param responses at the least this will be the players action that we received, but it may contain robot
     *       actions for the robots on the server that play immediately after the player.
     */
    private void doPlayerAction(GameCommand cmd, List<GameCommand> responses) {

        PlayerAction action = (PlayerAction) cmd.getArgument();
        GameContext.log(0, "ServerCmdProc: doPlayerAction (" + action + "). Surrogates to handle");
        controller_.handlePlayerAction(action);

        responses.add(cmd);

View Full Code Here

    private void startGame(OnlineGameTable table) {

        GameContext.log(0, "Now starting game on Server! "+ table);

        // Create players from the table and start.
        PlayerList players = table.getPlayers();
        assert (players.size() == table.getNumPlayersNeeded());
        PlayerList newPlayers = new PlayerList();
        for (Player player : players) {
            if (player.isHuman()) {
                newPlayers.add(player.createSurrogate(controller_.getServerConnection()));
            } else {
                newPlayers.add(player);
            }
        }
        controller_.reset();
        controller_.setPlayers(newPlayers);
View Full Code Here

     * Factory method to create the game controller via reflection.
     * The server should not have a ui component.
     */
    private void createController(String gameName) {

        GamePlugin plugin = PluginManager.getInstance().getPlugin(gameName);
        GameContext.loadResources(gameName);

        // for now, also create a corresponding viewer. The server should really not have knowledge of a UI component.
        // fix this by doing plugin.getModelInstance, then getting the controller from that.
        GamePanel panel  = plugin.getPanelInstance();
        panel.init(null);
        GameBoardViewer viewer = panel.getViewer();

        controller_ = viewer.getController();
    }
View Full Code Here

        GamePlugin plugin = PluginManager.getInstance().getPlugin(gameName);
        GameContext.loadResources(gameName);

        // for now, also create a corresponding viewer. The server should really not have knowledge of a UI component.
        // fix this by doing plugin.getModelInstance, then getting the controller from that.
        GamePanel panel  = plugin.getPanelInstance();
        panel.init(null);
        GameBoardViewer viewer = panel.getViewer();

        controller_ = viewer.getController();
    }
View Full Code Here

TOP

Related Classes of com.barrybecker4.common.geometry.Location

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.