@Override
  public void update() {
    if (readyToConnect && !connectStarted) {
      Client.reset(new LanClient());
      Input.setup(Client.get());
      connectStarted = true;
    }
    if (Input.isActive(Commands.get(Aigilas.Commands.Start), 0)) {
      if (ipIn.getText() != null && !ipIn.getText().isEmpty()) {
        String[] contents = ipIn.getText().split(":");
        String address = contents[0];
        if (contents.length > 1) {
          int port = Parse.inte(contents[1]);
          Config.get().setPort(port);
        }

        label.setText(waitMessage);
        Config.get().setServerIp(address);
        readyToConnect = true;
        ipIn.setVisible(false);
      }
    }
    if (Client.get().isGameStarting()) {
      for (int ii = 0; ii < Client.get().getPlayerCount(); ii++) {
        Input.setContext(Contexts.get(Sps.Contexts.Free), ii);
      }
      StateManager.loadState(new LoadingState());
    }
  }
Example #2
0
 @Override
 public void create() {
   Sps.setup();
   Renderer.get().setWindowsBackground(Color.BLACK);
   Renderer.get().setStrategy(new FrameStrategy());
   Renderer.get().setRefreshInstance(this);
   Client.reset(new LocalClient());
   Input.get().setup(Client.get());
   SpriteSheetManager.setup(SpriteTypes.getDefs());
   StateManager.loadState(new MainMenuState());
   ParticleEngine.reset();
   MusicPlayer.get(new DefaultMusicPlayer());
   StateManager.loadContent();
 }