Package ch.sahits.game.event

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


            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

        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

            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

TOP

Related Classes of ch.sahits.game.event.NewGameEvent

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.