Пример #1
0
  public ClientManager() {
    try {
      this.server = new ServerSocket(Config.get().port());
      clientListener =
          new Thread(
              new Runnable() {
                public void run() {
                  while (!Thread.interrupted()) {
                    try {
                      Socket client = server.accept();

                      clients.add(new MessageHandler(client));
                      clients.get(clients.size() - 1).owner = "SERVER";
                      addressToIndex.put(client.getPort(), clients.size() - 1);
                    } catch (IOException e) {
                      Logger.exception(e);
                    }
                  }
                }
              },
              "ClientManager");
      clientListener.start();
    } catch (IOException e1) {
      __otherServerExists = true;
      Logger.info(
          "SERVER: Failure to start. If this isn't the host machine, then this message is harmless.");
    }
  }
Пример #2
0
  private static BaseEnemy generateCreature(ActorType actorType) {
    if (actorType.is(Aigilas.Actors.Wrath)) {
      return new Wrath();
    }
    if (actorType.is(Aigilas.Actors.Hand)) {
      return new Hand();
    }
    if (actorType.is(Aigilas.Actors.Pride)) {
      return new Pride();
    }
    if (actorType.is(Aigilas.Actors.Envy)) {
      return new Envy();
    }
    if (actorType.is(Aigilas.Actors.Gluttony)) {
      return new Gluttony();
    }
    if (actorType.is(Aigilas.Actors.Lust)) {
      return new Lust();
    }
    if (actorType.is(Aigilas.Actors.Sloth)) {
      return new Sloth();
    }
    if (actorType.is(Aigilas.Actors.Greed)) {
      return new Greed();
    }
    if (actorType.is(Aigilas.Actors.Serpent)) {
      return new Serpent();
    }
    if (actorType.is(Aigilas.Actors.Breaking_Wheel)) {
      return new BreakingWheel();
    }
    if (actorType.is(Aigilas.Actors.Wrath_Acolyte)) {
      return new WrathEnemyAcolyte();
    }
    if (actorType.is(Aigilas.Actors.Pride_Acolyte)) {
      return new PrideEnemyAcolyte();
    }
    if (actorType.is(Aigilas.Actors.Envy_Acolyte)) {
      return new EnvyEnemyAcolyte();
    }
    if (actorType.is(Aigilas.Actors.Gluttony_Acolyte)) {
      return new GluttonyEnemyAcolyte();
    }
    if (actorType.is(Aigilas.Actors.Lust_Acolyte)) {
      return new LustEnemyAcolyte();
    }
    if (actorType.is(Aigilas.Actors.Sloth_Acolyte)) {
      return new SlothEnemyAcolyte();
    }
    if (actorType.is(Aigilas.Actors.Greed_Acolyte)) {
      return new GreedEnemyAcolyte();
    }
    if (actorType.is(Aigilas.Actors.Dummy)) {
      return new Dummy();
    }

    Logger.error("Unknown actorType passed into CreatureFactory: " + actorType.Name);
    return null;
  }
Пример #3
0
  @Override
  public void render() {
    try {
      // $$$ Logger.devConsole("" + Gdx.graphics.getFramesPerSecond() + ": " +
      // Gdx.graphics.getDeltaTime());

      // Update
      Input.get().update();
      if (Input.get()
          .isActive(
              sps.bridge.Commands.get(Commands.ToggleDevConsole),
              Client.get().getFirstPlayerIndex())) {
        DevConsole.get().toggle();
      }
      if (Input.get()
          .isActive(sps.bridge.Commands.get(Commands.Back), Client.get().getFirstPlayerIndex())) {
        StateManager.loadState(new MainMenuState());
      }
      if (Input.get()
          .isActive(sps.bridge.Commands.get(Commands.Music), Client.get().getFirstPlayerIndex())) {
        MusicPlayer.get().toggle();
      }
      if (Input.get()
          .isActive(
              sps.bridge.Commands.get(Commands.ToggleFullScreen),
              Client.get().getFirstPlayerIndex())) {
        Renderer.get().toggleFullScreen();
      }

      StateManager.asyncUpdate();

      if (Client.get().nextTurn()) {
        ParticleEngine.update();
        StateManager.update();
        Client.get().prepareForNextTurn();
      } else {
        Client.get().heartBeat();
      }
      if (!IsRunning) {
        System.exit(0);
      }

      TextPool.get().update();

      // Render
      Renderer.get().begin();
      StateManager.draw();
      ParticleEngine.draw();
      HudRenderer.get().draw();
      TextPool.get().draw();
      DevConsole.get().draw();
      Renderer.get().end();
    } catch (Exception e) {
      Logger.exception(e);
    }
  }