Beispiel #1
0
  @Override
  public void render(GameContainer container, StateBasedGame game, Graphics g) {

    if (!esperando) {
      super.render(container, game, g);

      if (((InfoRed.getInstance().getId() != (InfoJuego.getInstance().getJugadorMinijuego1() + 1))
              && (InfoRed.getInstance().getId()
                  != (InfoJuego.getInstance().getJugadorMinijuego2() + 1)))
          && mostrarLetras
          && !mostrarUnMomento) {
        RecursosComunes.getInstance().getFuente().drawString(300, 300, "Espectador");
      } else if (mostrarUnMomento) {
        RecursosComunes.getInstance().getFuente().drawString(300, 300, "Un momento...");
      }
    } else RecursosComunes.getInstance().getFuente().drawString(230, 300, "Esperando Jugadores...");
  }
Beispiel #2
0
  @Override
  public void cambiarEstado(final int estado) {
    InfoRed.getInstance().getCliente().setGameStateActual(null);
    InfoRed.getInstance().getCliente().flush();

    mostrarUnMomento = true;

    int delay = 3000;
    Timer timer2 = new Timer();
    timer2.schedule(
        new TimerTask() {
          public void run() {
            procesaCambiarEstado(estado);
          }
        },
        delay);
  }
Beispiel #3
0
  public void keyPressed(int key, char c) {

    if (key == Input.KEY_ESCAPE) {
      System.exit(0);
    } else {
      if (!esperando) {
        if (((estado.isFinJuego() && key == Input.KEY_SPACE)
            || ((InfoJuego.getInstance().getJugadorMinijuego1() + 1)
                    == InfoRed.getInstance().getId()
                && estado.getTurno() == 1)
            || ((InfoJuego.getInstance().getJugadorMinijuego2() + 1)
                    == InfoRed.getInstance().getId()
                && estado.getTurno() == 2))) {
          InfoRed.getInstance().getCliente().keyPressed(key, c);
        }
      }
    }
  }
Beispiel #4
0
  public void enter(GameContainer container, StateBasedGame game) {
    esperando = true;
    InfoRed.getInstance().getCliente().setGameStateActual(this);
    InfoRed.getInstance().getCliente().jugadorEsperando();

    if (((InfoRed.getInstance().getId() != (InfoJuego.getInstance().getJugadorMinijuego1() + 1))
        && (InfoRed.getInstance().getId()
            != (InfoJuego.getInstance().getJugadorMinijuego2() + 1)))) {
      timer.scheduleAtFixedRate(
          new TimerTask() {
            public void run() {
              mostrarLetras = !mostrarLetras;
            }
          },
          1000,
          1000);
    }

    super.enter(container, game);
  }
Beispiel #5
0
 @Override
 public synchronized void procesaSyncEstado(Estado estado) {
   if (InfoRed.getInstance().getId() != 1) this.estado = (EstadoPasarela) estado;
 }
Beispiel #6
0
  public void leave(GameContainer container, StateBasedGame game) {
    InfoRed.getInstance().getCliente().setGameStateActual(null);
    timer.cancel();

    super.leave(container, game);
  }