Пример #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...");
  }
Пример #2
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);
        }
      }
    }
  }
Пример #3
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);
  }
Пример #4
0
  public void init(GameContainer container, StateBasedGame game) throws SlickException {
    System.out.println("-- Juego: " + InfoJuego.getInstance().getJuego_aleatorio());

    super.init(container, game);
    timer = new Timer();
  }