Examples of GamePlayer


Examples of models.data.GamePlayer

        if (gameState.getCurrentDay() > gameState.getNumOfDays()) {
            game.setGameStatus(enums.GameStatusEnum.END.toString());
            game.save();
        }
        gameState.setGame(game);
        GamePlayer currentGamePlayer = game.getPlayerInGame(player);
        gameState.setCurrentPlayer(currentGamePlayer);
        if (currentGamePlayer != null) {
            gameState.setMyPortfolio(currentGamePlayer.getPortfolios());
        }
        gameState.setGameOwner(game.getPlayerInGame(game.getOwner()));
        return gameState;
    }
View Full Code Here

Examples of models.data.GamePlayer

        if (!game.canJoinGame(currentUser)) {
            return badRequest(game_playGame_cant_join.render(game, false));
        }

        GamePlayer gamePlayer = game.getPlayerInGame(currentUser);
        if (gamePlayer == null) {
            Logger.info("joining game");
            gamePlayer = game.joinGame(currentUser);
            if (gamePlayer != null) {
                Logger.info("Successfully joined game.");
View Full Code Here

Examples of models.data.GamePlayer

    public static Result buyStock(Integer gameId) {
        GameCheck gc = new GameCheck(gameId, false);
        if (gc.hasErrors) {
            return gc.getResult();
        }
        GamePlayer me = gc.currentGame.getPlayerInGame(UserManager.getCurrentLoggedInUser());
        Form<BuyStock> buyStockForm = Form.form(BuyStock.class).bindFromRequest();
        response().setContentType("application/json");
        if (buyStockForm.hasGlobalErrors()) {
            return badRequest(buyStockForm.errorsAsJson());
        } else {
            if (me.buyStock(buyStockForm.get().ticker, buyStockForm.get().quantity, buyStockForm.get().price)) {
                return ok(GameStateJSONFormatter.getGameStateJson(gameId));
            } else {
                return badRequest("{error: \"could not make purchase\"}");
            }
        }
View Full Code Here

Examples of models.data.GamePlayer

    public static Result sellStock(int gameId) {
        GameCheck gc = new GameCheck(gameId, false);
        if (gc.hasErrors) {
            return gc.getResult();
        }
        GamePlayer me = gc.currentGame.getPlayerInGame(UserManager.getCurrentLoggedInUser());
        Form<SellStock> sellStockForm = Form.form(SellStock.class).bindFromRequest();
        response().setContentType("application/json");
        if(sellStockForm.hasErrors()){
            return badRequest(sellStockForm.errorsAsJson());
        }else{
            SellStock sellStock = sellStockForm.get();
            //play.Logger.info("Price: "+sellStock.price);
            if(me.sellStock(sellStock.ticker, sellStock.quantity, sellStock.price)){
                return ok(GameStateJSONFormatter.getGameStateJson(gameId));
            }else{
                return badRequest("{error: \"could not make sale!\"}");
            }
        }
View Full Code Here

Examples of org.ggp.base.player.GamePlayer

      if (chosenGamerClass == null) {
        System.out.println("Could not find player class with that name. Available choices are: " + Arrays.toString(availableGamers.toArray()));
        return;
      }
      Gamer gamer = (Gamer) chosenGamerClass.newInstance();
    new GamePlayer(port, gamer).start();
  }
View Full Code Here

Examples of org.ggp.base.player.GamePlayer

          configPanel = gamer.getConfigPanel();

          gamer.addObserver(matchPanel);
          gamer.addObserver(detailPanel);

          GamePlayer player = new GamePlayer(port, gamer);
          player.addObserver(networkPanel);
          player.start();

          JTabbedPane tab = new JTabbedPane();
          tab.addTab("Match", matchPanel);
          tab.addTab("Network", networkPanel);
          tab.addTab("Configuration", configPanel);
          tab.addTab("Detail", detailPanel);
          playersTabbedPane.addTab(type + " (" + player.getGamerPort() + ")", tab);
          playersTabbedPane.setSelectedIndex(playersTabbedPane.getTabCount()-1);

          defaultPort++;
          portTextField.setText(defaultPort.toString());
        }
View Full Code Here

Examples of org.ggp.base.player.GamePlayer

        this.add(gamePanel, new GridBagConstraints(1, 0, 1, 1, 1.0, 1.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(5, 5, 5, 5), 5, 5));

        // Start up the gamers!
        try {
            theHumanGamer = new KioskGamer(theGUIPanel);
            theHumanPlayer = new GamePlayer(DEFAULT_HUMAN_PORT, theHumanGamer);
            theHumanPlayer.start();
        } catch(Exception e) {
            e.printStackTrace();
        }
View Full Code Here

Examples of org.ggp.base.player.GamePlayer

                    if(!playerComboBox.getSelectedItem().equals(remotePlayerString)) {
                        Class<?> gamerClass = gamers.get(playerComboBox.getSelectedIndex());
                        try {
                            gamer = (Gamer) gamerClass.newInstance();
                        } catch(Exception ex) { throw new RuntimeException(ex); }
                        theComputerPlayer = new GamePlayer(DEFAULT_COMPUTER_PORT, gamer);
                        theComputerPlayer.start();
                        System.out.println("Kiosk has started a gamer named " + theComputerPlayer.getGamer().getName() + ".");
                    }
                }
View Full Code Here

Examples of org.gojul.fourinaline.model.GamePlayer

  {
    Iterator<GamePlayer> it = currentPlayers.iterator();
   
    while (it.hasNext())
    {
      GamePlayer player = it.next();
     
      if (player.getPlayerMark().equals(mark))
        return player.getName();
    }
   
    return "";
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.