Package com.poker.game

Examples of com.poker.game.Table


    @Inject
    private GameManager gameManager;

    @WebModelHandler(startsWith = "/notification")
    public void notification(@WebModel Map m, @WebParam("room") String room, RequestContext rc) {
        Table table = gameManager.getTable(room);
        List playerList = table.getPlayers();
        List playerList2 = new ArrayList();
        for (int i = 0; i < playerList.size(); i++) {
            Player player = (Player) playerList.get(i);
            Map playerMap = new HashMap();
            playerMap.put("pokerChip", player.getCash());
            playerMap.put("player", player.getName());
            Card[] handArr = player.getHand().getCards();
            List handList = new ArrayList();
            for (int j = 0; j < handArr.length; j++) {
                handList.add(handArr[j].toString());
            }
            playerMap.put("handCards", handList);
            playerMap.put("playerId", player.getId());
            playerMap.put("status", player.getAction() == null ? "" : player.getAction().getName());
            playerList2.add(playerMap);
            //
            if (player.getId().equals(rc.getReq().getSession().getAttribute("playerId"))) {
                List actionList = new ArrayList();
                actionList.add("Continue");
                actionList.add("Raise");
                actionList.add("Fold");
                playerMap.put("actions", actionList);
                m.put("requestPlayerStatus", playerMap);
            }
        }
        m.put("playersStatus", playerList2);
        m.put("poolPokerChip", table.getPot());
        List cardList = table.getBoard();
        List cardList2 = new ArrayList();
        for (int i = 0; i < cardList.size(); i++) {
            cardList2.add(cardList.get(i).toString());
        }
        m.put("communityCards", cardList2);
View Full Code Here


    }

    @WebActionHandler
    public void bet(@WebParam("room") String room, @WebParam("player") String player) {
        //todo need bet value
        Table table = gameManager.getTable(room);
        if (table != null) {
            Player actionPlayer = table.getPlayer(player);
            if (actionPlayer != null) {
                actionPlayer.act(table, Action.BET, -1, -1);
            }
        }
    }
View Full Code Here

        }
    }

    @WebActionHandler
    public void call(@WebParam("room") String room, @WebParam("player") String player) {
        Table table = gameManager.getTable(room);
        if (table != null) {
            Player actionPlayer = table.getPlayer(player);
            if (actionPlayer != null) {
                actionPlayer.act(table, Action.CALL, -1, -1);
            }
        }
    }
View Full Code Here

        }
    }

    @WebActionHandler
    public void fold(@WebParam("room") String room, @WebParam("player") String player) {
        Table table = gameManager.getTable(room);
        if (table != null) {
            Player actionPlayer = table.getPlayer(player);
            if (actionPlayer != null) {
                actionPlayer.act(table, Action.FOLD, -1, -1);
            }
        }
    }
View Full Code Here

        }
    }

    @WebActionHandler
    public void check(@WebParam("room") String room, @WebParam("player") String player) {
        Table table = gameManager.getTable(room);
        if (table != null) {
            Player actionPlayer = table.getPlayer(player);
            if (actionPlayer != null) {
                actionPlayer.act(table, Action.CHECK, -1, -1);
            }
        }
    }
View Full Code Here

        }
    }

    @WebActionHandler
    public void raise(@WebParam("room") String room, @WebParam("player") String player) {
        Table table = gameManager.getTable(room);
        if (table != null) {
            Player actionPlayer = table.getPlayer(player);
            if (actionPlayer != null) {
                actionPlayer.act(table, Action.RAISE, -1, -1);
            }
        }
View Full Code Here

public class MessageWebHandlers {
    @Inject
        private GameManager gameManager;
    @WebModelHandler(startsWith = "/message/getMessage")
    public void getMessage(@WebModel List<Message> ls, @WebParam("room") String room) {
        Table table = gameManager.getTable(room);
        ls.addAll(table.getMessages());
    }
View Full Code Here

TOP

Related Classes of com.poker.game.Table

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.