Examples of NewGameEvent


Examples of ch.sahits.game.event.NewGameEvent

        closeWindow();
      }
    }
    // New Game events
    if (e instanceof NewGameEvent){
      NewGameEvent newGame = (NewGameEvent) e;
      switch (newGame.getStartupEventType()) {
      case SINGELPLAYER:{
        if (eventNotice instanceof IPlayer){
          client = new Client((IPlayer) eventNotice);
          view.setClient(client);         
        } else if (eventNotice instanceof IGame){
          // notify server
          OpenPatricianServer server = new OpenPatricianServer((IGame) eventNotice);
          server.startStandaloneGame(this);
        } else {
          throw new IllegalArgumentException("Unknown notice: "+eventNotice);
        }
        break;
      }
      default:
        throw new IllegalArgumentException("New game Startup type "+newGame.getStartupEventType()+" is not implemented");
      }
    }
  }
View Full Code Here

Examples of ch.sahits.game.event.NewGameEvent

            RandomNameLoader shipLoader = new RandomNameLoader("shipnames.properties");
            IShip ship = ShipFactory.createCrayer(shipLoader.getRandomName(), EShipUpgrade.LEVEL1,3000); // TODO check the value
            player.addShip(ship);

            // Initialize the player
            new NewGameEvent(ENewGame.SINGELPLAYER).notify(player);
            // Initialize the game/server
            new NewGameEvent(ENewGame.SINGELPLAYER).notify(game);
            // Request the view change
            new ViewChangeRequestEvent(ChangeRequest.ALL).notify(EViewChangeEvent.START_GAME);
          } catch (IOException e) { // property file for city creation not available
            e.printStackTrace();
          }
View Full Code Here

Examples of ch.sahits.game.event.NewGameEvent

        closeWindow();
      }
    }
    // New Game events
    if (e instanceof NewGameEvent){
      NewGameEvent newGame = (NewGameEvent) e;
      switch (newGame.getStartupEventType()) {
      case SINGELPLAYER:{
        if (eventNotice instanceof IPlayer){
          client = new Client((IPlayer) eventNotice);
          view.setClient(client);         
        } else if (eventNotice instanceof IGame){
          // notify server
          OpenPatricianServer server = new OpenPatricianServer((IGame) eventNotice);
          server.startStandaloneGame(this);
        } else {
          throw new IllegalArgumentException("Unknown notice: "+eventNotice);
        }
        break;
      }
      default:
        throw new IllegalArgumentException("New game Startup type "+newGame.getStartupEventType()+" is not implemented");
      }
    }
  }
View Full Code Here

Examples of ch.sahits.game.event.NewGameEvent

            Difficulty diff = difficulity;
            EGameSpeed gameSpeed = EGameSpeed.values()[speed.getSelectedIndex()];
            int startyear = Integer.parseInt(startYear.getSelected());
            IGame game = GameFactory.createGame(gameMap, obj, diff, gameSpeed, startyear);
            // Initialize the player
            new NewGameEvent(ENewGame.SINGELPLAYER).notify(player);
            // Initialize the game/server
            new NewGameEvent(ENewGame.SINGELPLAYER).notify(game);
            // Request the view change
            new ViewChangeRequestEvent(ChangeRequest.ALL).notify(EViewChangeEvent.START_GAME);
          } catch (IOException e) { // property file for city creation not available
            e.printStackTrace();
          }
View Full Code Here

Examples of com.svanloon.game.wizard.client.event.NewGameEvent

      message = handleGameOver(event);
    }else if(we instanceof HandDealtEvent) {
      HandDealtEvent event = (HandDealtEvent) we;
      message = handleHandDealt(event);
    }else if(we instanceof NewGameEvent) {
      NewGameEvent event = (NewGameEvent) we;
      message = handleNewGame(event);
    } else if(we instanceof NewRoundEvent) {
      NewRoundEvent event = (NewRoundEvent) we;
      message = handleNewRound(event);
    } else if(we instanceof NewTrickEvent) {
View Full Code Here

Examples of com.svanloon.game.wizard.client.event.NewGameEvent

      int id = getPlayerId(mps);
      listener.handleHandDealt(new HandDealtEvent(id));
    } else if(mt.equals(MessageType.NEW_GAME)) {
      List<String> playerNames = getPlayerNames(mps);
      List<Integer> ids = getPlayerIds(mps);
      listener.handleNewGame(new NewGameEvent(ids, playerNames));
    } else if(mt.equals(MessageType.NEW_ROUND)) {
      int round = getInt(mps, MessageParamConstants.ROUND);
      listener.handleNewRound(new NewRoundEvent(round));
    } else if(mt.equals(MessageType.NEW_TRICK)) {
      listener.handleNewTrick(new NewTrickEvent());
View Full Code Here

Examples of com.svanloon.game.wizard.client.event.NewGameEvent

    List<Integer> playerIds = getPlayerId();
    List<String> playerNames = getPlayerNames();
    for (int i = 0; i < playerIds.size(); i++) {
      _game.addPlayer(playerIds.get(i).intValue(),  playerNames.get(i));
    }
    gameEventNotifier.notify(new NewGameEvent(playerIds,playerNames));
    for (int roundId = startRound; roundId < endRound + 1; roundId = roundId + inc) {
      dealer = (dealer + 1)% _playerCollection.size();
      lead = (dealer + 1)% _playerCollection.size();
      gameEventNotifier.notify(new NewRoundEvent(roundId));
      _game.newRound(roundId);
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.