@Test
  public void getResourceClassInfoByResource_nonExistentReferences_shouldFail() {
    authenticateSystemResource();

    final char[] password = generateUniquePassword();
    final Resource accessorResource = generateAuthenticatableResource(password);

    generateResourceClass(false, false);

    // authenticate and verify
    accessControlContext.authenticate(accessorResource, PasswordCredentials.newInstance(password));

    try {
      accessControlContext.getResourceClassInfoByResource(Resources.getInstance(-999L));
      fail("getting resource class info by resource for non-existent resource should have failed");
    } catch (IllegalArgumentException e) {
      assertThat(e.getMessage().toLowerCase(), containsString("not found"));
    }
    try {
      accessControlContext.getResourceClassInfoByResource(Resources.getInstance("invalid"));
      fail(
          "getting resource class info by resource for non-existent external resource reference should have failed");
    } catch (IllegalArgumentException e) {
      assertThat(e.getMessage().toLowerCase(), containsString("not found"));
    }
    try {
      accessControlContext.getResourceClassInfoByResource(Resources.getInstance(-999L, "invalid"));
      fail(
          "getting resource class info by resource for mismatched internal/external resource ids should have failed");
    } catch (IllegalArgumentException e) {
      assertThat(e.getMessage().toLowerCase(), containsString("not resolve"));
    }
  }
  @Test
  public void getResourceClassInfoByResource_nulls() {
    final char[] password = generateUniquePassword();
    final Resource accessorResource = generateAuthenticatableResource(password);

    generateResourceClass(false, false);

    // authenticate and verify
    accessControlContext.authenticate(accessorResource, PasswordCredentials.newInstance(password));

    try {
      accessControlContext.getResourceClassInfoByResource(null);
      fail("getting resource class info by resource for null resource should have failed");
    } catch (NullPointerException e) {
      assertThat(e.getMessage().toLowerCase(), containsString("resource required"));
    }
    try {
      accessControlContext.getResourceClassInfoByResource(Resources.getInstance(null));
      fail(
          "getting resource class info by resource for null internal/external resource ids should have failed");
    } catch (IllegalArgumentException e) {
      assertThat(
          e.getMessage().toLowerCase(),
          containsString("resource id and/or external id is required"));
    }
  }
  @Test
  public void getResourceClassInfoByResource_withExtId() {
    authenticateSystemResource();

    generateUnauthenticatableResource();
    final String resourceClassName = generateResourceClass(true, false);
    final String externalId = generateUniqueExternalId();
    accessControlContext.createResource(
        resourceClassName,
        accessControlContext.getDomainNameByResource(SYS_RESOURCE),
        externalId,
        PasswordCredentials.newInstance(generateUniquePassword()));

    // verify
    final ResourceClassInfo resourceClassInfo =
        accessControlContext.getResourceClassInfoByResource(Resources.getInstance(externalId));
    assertThat(resourceClassInfo, is(not(nullValue())));
    assertThat(resourceClassInfo.getResourceClassName(), is(resourceClassName));
    assertThat(resourceClassInfo.isAuthenticatable(), is(true));
    assertThat(resourceClassInfo.isUnauthenticatedCreateAllowed(), is(false));
  }
예제 #4
0
public class ApplicationActions implements ActionListener {

  /**
   * ************************************************************************* Action-Listener =
   * Programm-Logik *****************************************
   */
  private Config cfg = Config.getInstance();

  private Jan gui = cfg.getInstanceOfGUI();
  private StatusBar statusBar = StatusBar.getInstance();
  private Sound snd = Sound.getInstance();
  private Resources res = Resources.getInstance();
  private static ApplicationActions instance;
  private static LoginDialog lD = null;
  private SwingWorker<String, Void> workerWait;
  private SwingWorker<String, Void> workerLogin;
  private Wait wt = null;
  private static String act_dst = "";
  private static Destination_List dl = null;

  public static synchronized ApplicationActions getInstance() {
    if (instance == null) {
      instance = new ApplicationActions();
    }
    return instance;
  }

  private ApplicationActions() {
    this.setGuiInstance();
  }

  final void setGuiInstance() {
    gui = cfg.getInstanceOfGUI();
  }

  @Override
  public void actionPerformed(ActionEvent event) {

    String cmd = event.getActionCommand();
    statusBar.setStatus("Befehl " + cmd + " wird ausgefuehrt...");
    System.out.println(cmd);
    if (cfg.useCmd_log()) {
      SendToServer.info("Action:" + cmd);
    }

    /*
     * Aufruf einer "Unterfunktion" in separatem thread:
     *
     * !!! Setzt aber voraus, daß der ActionListener in einem separaten
     * "NichtSwingThread" läuft!
     *
     * SwingUtilities.invokeLater(new Runnable() {
     *
     * public void run() { jIntKfzLb lb = new jIntKfzLb(); MyEventListener
     * el = new MyEventListener(); lb.addMyEventListener(el);
     * lb.setVisible(true); dp.add(lb); } }); }
     */

    /*
     * LOGIN mit Aufbau Vbdg.
     */
    if (cmd.equals("Anmeldung")) {
      this.cfg.initLDAP();
      this.gui.initMenu();
      this.cfg.setDst_list(null);
      System.out.println("Starte Anmelde-Prozess...");
      lD = LoginDialog.getInstance();
    }

    if (cmd.equals("USER")) {

      String user = LoginDialog.getInstance().getUserName();
      this.snd.play(Sound.SoundClip.KASSE);
      if (this.cfg.isDebug()) {
        System.out.println("USER: "******"LOGIN")) {

      if (this.cfg.isWaitPanel() && this.cfg.isUseSwingWorker()) {

        this.workerWait =
            new SwingWorker<String, Void>() {
              @Override
              protected String doInBackground() {
                wt = new Wait("WARTE", "Anmeldung am System...");
                return "OK";
              }

              @Override
              protected void done() {}
            };
        workerLogin =
            new SwingWorker<String, Void>() {
              @Override
              protected String doInBackground() {
                gui.login2();
                return "OK";
              }

              @Override
              protected void done() {
                wt.stop();
              }
            };
        // bei Anmeldung wird versucht, LOG-Eintrag zu erstellen, auch
        // wenn eventuell vorher die Vbdg. zum CMD-Server ohne Erfolg war
        cfg.setCmd_log(true);
        workerWait.execute();
        workerLogin.execute();

      } else {

        CursorTools.startWaitCursor(gui);
        gui.login2();
        CursorTools.stopWaitCursor(gui);
      }
    }

    if (cmd.equals("ABBRUCH")) {
      if (lD != null) {
        System.out.println("Abbruch LOGIN- Bearbeitung...");
        lD.close();
        lD = null;
        cfg.initLDAP();
        cfg.setLogin_usr("");
        cfg.setLogin_pwd("");
        cfg.setLogin_ok(false);
        Jan.logger.info("===> Abbruch der Anmeldung ");
        snd.play(Sound.SoundClip.LASER);
        gui.setTitle(cfg.getTitle() + " <NICHT ANGEMELDET>");
      }
    }

    // mit VM verbinden
    if (cmd.equals("CVM")) {

      if (cfg.isLogin_ok()) {

        act_dst = "";
        dl = LdapEntry_Parser.parse_protocol(cfg.getLdap_vm().trim());
        if (dl != null) {
          if (dl.getEntryNum() > 1) {
            SelectDestination sd = new SelectDestination();
            act_dst = sd.getDestination(dl);
          } else if (dl.getEntryNum() == 1) {
            act_dst = dl.getDstList().get(0).getDestinationTitle();
          } else {
            System.out.println("CVM: destination list is empty!!!");
          }
        } else {
          System.out.println("CVM: destination list is NULL!!!");
        }

        if (cfg.isDebug()) {
          System.out.print("selected destination: " + act_dst + "\n");
        }

        StartClientReturnCode rc = Destination_Hub.startThis(act_dst);

      } else {
        String msg = "\n Sie sind nicht erfolgreich angemeldet! \n\n";
        if (cfg.isInternalFrames()) {
          JOptionPane.showInternalMessageDialog(
              gui.getContentPane(), msg, "FEHLER", JOptionPane.ERROR_MESSAGE);
        } else {
          JOptionPane.showMessageDialog(gui, msg, "FEHLER", JOptionPane.ERROR_MESSAGE);
        }
      }
    }
    // Info/Version
    if (cmd.equals("VERSION")) {
      snd.play(Sound.SoundClip.TAB);
      String msg =
          "\n Titel: "
              + cfg.getTitle()
              + "\n Version: "
              + cfg.getVersion()
              + "\n\n Autor: "
              + cfg.getAutor()
              + "\n\n Info: "
              + cfg.getInfo()
              + "\n\n";
      if (cfg.isInternalFrames()) {
        JOptionPane.showInternalMessageDialog(
            gui.getContentPane(), msg, "Info", JOptionPane.INFORMATION_MESSAGE);
      } else {
        JOptionPane.showMessageDialog(gui, msg, "Info", JOptionPane.INFORMATION_MESSAGE);
      }
    }
    // Info/Umgebung
    if (cmd.equals("ENV")) {

      String param;
      snd.play(Sound.SoundClip.TAB);
      if (cfg.getLdap_vm().length() > 77) {
        param = cfg.getLdap_vm().substring(1, 77) + "...";
      } else {
        param = cfg.getLdap_vm();
      }
      String msg =
          "\n"
              + cfg.getTitle()
              + "\n"
              + cfg.getVersion()
              + "\n\n Host: "
              + cfg.getLocal_HostName()
              + "\n IP: "
              + cfg.getLocal_IP()
              + "\n MAC: "
              + cfg.getLocal_MAC()
              + "\n java version: "
              + cfg.getLocal_java_version()
              + "\n os name: "
              + cfg.getLocal_os_name()
              + "\n linux Rel.: "
              + cfg.getLinuxRelease()
              + "\n jvm version: "
              + cfg.getLocal_jvm_version()
              + "\n\n user: "******"\n context: "
              + cfg.getLogin_context()
              + "\n PARAM: "
              + param
              + "\n eMail: "
              + cfg.getLdap_mail()
              + "\n fullName: "
              + cfg.getLdap_fullName()
              + "\n last login time: "
              + Tools.t2s(cfg.getLdap_loginTime())
              + "\n login exp. time: "
              + Tools.t2s(cfg.getLdap_passwordExpirationTime())
              + "\n login disabled : "
              + cfg.getLdap_loginDisabled()
              + "\n login grace limit     : "
              + cfg.getLdap_loginGraceLimit()
              + "\n login grace remaining : "
              + cfg.getLdap_loginGraceRemaining()
              + "\n passwordMinimumLength : "
              + cfg.getLdap_passwordMinimumLength()
              + "\n passwordUniqueRequired: "
              + cfg.getLdap_passwordUniqueRequired()
              + "\n\n";
      if (cfg.isInternalFrames()) {
        JOptionPane.showInternalMessageDialog(
            gui.getContentPane(), msg, "Umgebung", JOptionPane.INFORMATION_MESSAGE);
      } else {
        JOptionPane.showMessageDialog(gui, msg, "Umgebung", JOptionPane.INFORMATION_MESSAGE);
      }
    }

    // Info/Uhr
    if (cmd.equals("UHR")) {
      JDialog f = new JDialog();
      f.setTitle("Uhr-Zeit");
      f.setIconImage(res.clockIcon);
      f.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
      f.setResizable(false);
      f.getContentPane().add(new Clock());
      f.pack();
      f.setLocationRelativeTo(null);
      f.setAlwaysOnTop(true);
      f.setResizable(false);
      f.setVisible(true);
    }

    // Hilfe001
    if (cmd.equals("HELP001")) {
      Calendar cal = Calendar.getInstance();
      int day = cal.get(Calendar.DAY_OF_MONTH);
      int month = cal.get(Calendar.MONTH);

      if (day == 7 && month == 9) { // 7. October
        Help00x.show();
      } else {
        Help000.show();
      }
    }

    // CountDown via ProgressMonitor
    if (cmd.equals("CNTDWN")) {
      final JDialog f = new JDialog();
      f.setTitle("FRAGE");
      f.setResizable(false);
      f.setIconImage(res.clockIcon);
      f.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
      f.setSize(290, 220);

      JLabel l1 = new JLabel("Start-Befehl wurde gesendet.");
      JLabel l2 = new JLabel(" Was soll ich jetzt tun?");
      final JButton ok = new JButton("VERBINDEN");
      ok.setMnemonic('v');
      ok.setIcon(res.computerImageIcon);
      ok.setToolTipText("Verbindung wird erneut versucht.");
      ok.addActionListener(
          new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
              gui.getInstance().startRHEV(true);
              f.dispose();
            }
          });

      final JButton cancel = new JButton("Abbruch");
      cancel.setMnemonic('a');
      cancel.setIcon(res.cancelImageIcon);
      cancel.setToolTipText("Funktion abbrechen.");
      cancel.addActionListener(
          new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
              f.dispose();
            }
          });

      JPanel p = new JPanel();
      p.setLayout(new BorderLayout());
      JPanel p_north = new JPanel();
      JPanel p_south = new JPanel();
      JPanel p_center = new JPanel();
      JPanel p_east = new JPanel();
      JPanel p_west = new JPanel();
      p_center.setBorder(BorderFactory.createEtchedBorder(EtchedBorder.RAISED));

      p_north.add(l1);
      p_center.add(l2);
      p_south.add(ok);
      p_south.add(cancel);

      p.add(BorderLayout.NORTH, p_north);
      p.add(BorderLayout.SOUTH, p_south);
      p.add(BorderLayout.CENTER, p_center);
      p.add(BorderLayout.EAST, p_east);
      p.add(BorderLayout.WEST, p_west);

      CountDown cd = new CountDown(cfg.getRhevCntDwnVMstart());
      // p.add(cd);

      f.add(p);
      f.pack();
      f.setLocationRelativeTo(null);
      f.setVisible(true);

      cd.start();
    }

    // Senden
    if (cmd.equals("SENDEN")) {

      if (cfg.isLogin_ok()) {
        System.out.println("starte Sende-Dialog!");
        int result = ImportSelector.selectFiles();
        if (result > 0) {
          System.out.println("" + result + " Dateien übertragen");
        } else {
          System.out.println("Fehler " + result + " beim Senden der Dateien aufgetreten.");
        }

      } else {
        String msg = "\n Sie sind nicht erfolgreich angemeldet! \n\n";
        if (cfg.isInternalFrames()) {
          JOptionPane.showInternalMessageDialog(
              gui.getContentPane(), msg, "FEHLER", JOptionPane.ERROR_MESSAGE);
        } else {
          JOptionPane.showMessageDialog(gui, msg, "FEHLER", JOptionPane.ERROR_MESSAGE);
        }
      }
    }

    // Empfangen
    if (cmd.equals("EMPFANGEN")) {
      if (cfg.isLogin_ok()) {

        System.out.println("starte Empfang-Dialog!");
        int result = ExportSelector.selectFiles();
        if (result > 0) {
          System.out.println("" + result + " Dateien kopiert");
        } else {
          System.out.println("Fehler " + result + " beim Empfang der Dateien aufgetreten.");
        }

      } else {
        String msg = "\n Sie sind nicht erfolgreich angemeldet! \n\n";
        if (cfg.isInternalFrames()) {
          JOptionPane.showInternalMessageDialog(
              gui.getContentPane(), msg, "FEHLER", JOptionPane.ERROR_MESSAGE);
        } else {
          JOptionPane.showMessageDialog(gui, msg, "FEHLER", JOptionPane.ERROR_MESSAGE);
        }
      }
    }

    // Programm-Ende
    if (cmd.equals("ENDE")) {
      gui.sac();
    }

    // Computer ausschalten
    if (cmd.equals("SHUTDOWN")) {
      System.out.println("Starte Shutdown-Prozess...");
      gui.shutdownClient();
    }

    statusBar.setStatus("Befehl " + cmd + " beendet.");
  }
}
예제 #5
0
  public GameScreen(Game game, Array<Integer> playerList, Array<Integer> cpuList) {
    super(game);
    Gdx.input.setCatchBackKey(true);
    Gdx.input.setInputProcessor(this);

    cam = new OrthographicCamera(width, height);

    cam.position.x = 400;
    cam.position.y = 240;
    cam.update();

    numPlayers = playerList.size;

    if (numPlayers == 1) {
      touchAreaP1 =
          new BoundingBox(
              new Vector3(-((this.width - 800) / 2), -((this.height - 480) / 2), 0),
              new Vector3(
                  -((this.width - 800) / 2) + (this.width),
                  -((this.height - 480) / 2) + this.height,
                  0));
    } else if (numPlayers == 2) {
      touchAreaP1 =
          new BoundingBox(
              new Vector3(-((this.width - 800) / 2), -((this.height - 480) / 2), 0),
              new Vector3(
                  -((this.width - 800) / 2) + (this.width / 2),
                  -((this.height - 480) / 2) + this.height,
                  0));
      touchAreaP2 =
          new BoundingBox(
              new Vector3(
                  -((this.width - 800) / 2) + (this.width / 2), -((this.height - 480) / 2), 0),
              new Vector3(
                  -((this.width - 800) / 2) + this.width,
                  -((this.height - 480) / 2) + this.height,
                  0));
    } else if (numPlayers == 3) {
      touchAreaP1 =
          new BoundingBox(
              new Vector3(-((this.width - 800) / 2), -((this.height - 480) / 2), 0),
              new Vector3(
                  -((this.width - 800) / 2) + (this.width / 2),
                  -((this.height - 480) / 2) + (this.height / 2),
                  0));
      touchAreaP2 =
          new BoundingBox(
              new Vector3(
                  -((this.width - 800) / 2), -((this.height - 480) / 2) + (this.height / 2), 0),
              new Vector3(
                  -((this.width - 800) / 2) + (this.width / 2),
                  -((this.height - 480) / 2) + this.height,
                  0));
      touchAreaP3 =
          new BoundingBox(
              new Vector3(
                  -((this.width - 800) / 2) + (this.width / 2), -((this.height - 480) / 2), 0),
              new Vector3(
                  -((this.width - 800) / 2) + this.width,
                  -((this.height - 480) / 2) + this.height,
                  0));
    } else if (numPlayers == 4) {
      touchAreaP1 =
          new BoundingBox(
              new Vector3(-((this.width - 800) / 2), -((this.height - 480) / 2), 0),
              new Vector3(
                  -((this.width - 800) / 2) + (this.width / 2),
                  -((this.height - 480) / 2) + (this.height / 2),
                  0));
      touchAreaP2 =
          new BoundingBox(
              new Vector3(
                  -((this.width - 800) / 2), -((this.height - 480) / 2) + (this.height / 2), 0),
              new Vector3(
                  -((this.width - 800) / 2) + (this.width / 2),
                  -((this.height - 480) / 2) + this.height,
                  0));
      touchAreaP3 =
          new BoundingBox(
              new Vector3(
                  -((this.width - 800) / 2) + (this.width / 2), -((this.height - 480) / 2), 0),
              new Vector3(
                  -((this.width - 800) / 2) + this.width,
                  -((this.height - 480) / 2) + (this.height / 2),
                  0));
      touchAreaP4 =
          new BoundingBox(
              new Vector3(
                  -((this.width - 800) / 2) + (this.width / 2),
                  -((this.height - 480) / 2) + (this.height / 2),
                  0),
              new Vector3(
                  -((this.width - 800) / 2) + this.width,
                  -((this.height - 480) / 2) + this.height,
                  0));
    }

    //		camera = new OrthographicCamera(800, 480);
    //		camera.translate(400, 240, 0);

    if (playerList.size + cpuList.size != 3) {
      POSITIONS.add(new Vector2(150, 180));
      POSITIONS.add(new Vector2(450, 180));
      POSITIONS.add(new Vector2(300, 335));
      POSITIONS.add(new Vector2(300, 25));
    } else {
      POSITIONS.add(new Vector2(170, 92));
      POSITIONS.add(new Vector2(432, 100));
      POSITIONS.add(new Vector2(300, 335));
    }

    // Fade
    blackFade = Resources.getInstance().blackFade;
    fadeBatch = new SpriteBatch();
    fadeBatch.getProjectionMatrix().setToOrtho2D(0, 0, 2, 2);

    stouchAreaP1 = Resources.getInstance().touchArea1;
    stouchAreaP2 = Resources.getInstance().touchArea2;
    stouchAreaP3 = Resources.getInstance().touchArea3;
    stouchAreaP4 = Resources.getInstance().touchArea4;

    if (playerList.size > 0 && playerList.get(0) == 1) {
      p1 = Resources.getInstance().factoryP1Small;
    } else if (playerList.size > 0 && playerList.get(0) == 2) {
      p1 = Resources.getInstance().factoryP2Small;
    } else if (playerList.size > 0 && playerList.get(0) == 3) {
      p1 = Resources.getInstance().factoryP3Small;
    } else if (playerList.size > 0 && playerList.get(0) == 4) {
      p1 = Resources.getInstance().factoryP4Small;
    }

    if (playerList.size > 1 && playerList.get(1) == 1) {
      p2 = Resources.getInstance().factoryP1Small;
    } else if (playerList.size > 1 && playerList.get(1) == 2) {
      p2 = Resources.getInstance().factoryP2Small;
    } else if (playerList.size > 1 && playerList.get(1) == 3) {
      p2 = Resources.getInstance().factoryP3Small;
    } else if (playerList.size > 1 && playerList.get(1) == 4) {
      p2 = Resources.getInstance().factoryP4Small;
    }

    if (playerList.size > 2 && playerList.get(2) == 1) {
      p3 = Resources.getInstance().factoryP1Small;
    } else if (playerList.size > 2 && playerList.get(2) == 2) {
      p3 = Resources.getInstance().factoryP2Small;
    } else if (playerList.size > 2 && playerList.get(2) == 3) {
      p3 = Resources.getInstance().factoryP3Small;
    } else if (playerList.size > 2 && playerList.get(2) == 4) {
      p3 = Resources.getInstance().factoryP4Small;
    }

    if (playerList.size > 3 && playerList.get(3) == 1) {
      p4 = Resources.getInstance().factoryP1Small;
    } else if (playerList.size > 3 && playerList.get(3) == 2) {
      p4 = Resources.getInstance().factoryP2Small;
    } else if (playerList.size > 3 && playerList.get(3) == 3) {
      p4 = Resources.getInstance().factoryP3Small;
    } else if (playerList.size > 3 && playerList.get(3) == 4) {
      p4 = Resources.getInstance().factoryP4Small;
    }

    if (playerList.size > 0) p1.setScale(.2f);
    if (playerList.size > 1) p2.setScale(.2f);
    if (playerList.size > 2) p3.setScale(.2f);
    if (playerList.size > 3) p4.setScale(.2f);

    if (playerList.size > 0) p1.rotate(-90);
    if (playerList.size > 1) p2.rotate(90);
    if (playerList.size > 2) p3.rotate(-90);
    if (playerList.size > 3) p4.rotate(90);

    stouchAreaP1.setRotation(-90);
    stouchAreaP2.setRotation(90);
    stouchAreaP1.setRotation(-90);
    stouchAreaP2.setRotation(90);

    gameBatch = new SpriteBatch();
    gameBatch.getProjectionMatrix().set(cam.combined);

    // init player positions
    //		Array<Vector2> positons = generatePositions(numPlayers + 1);

    int currentPos = 0;

    for (int i = 0; i < playerList.size; ++i) {
      Vector2 temp1 = new Vector2(POSITIONS.get(currentPos).x, POSITIONS.get(currentPos).y);
      Vector2 temp2 = new Vector2(POSITIONS.get(currentPos).x, POSITIONS.get(currentPos).y);
      Vector2 facing = new Vector2(-temp1.sub(CENTER).y, temp2.sub(CENTER).x).nor();
      playerProduction = new PlayerProduction(playerList.get(i), POSITIONS.get(currentPos), facing);
      GameInstance.getInstance().factorys.add(playerProduction);
      ++currentPos;
    }

    for (int i = 0; i < cpuList.size; ++i) {
      Vector2 temp1 = new Vector2(POSITIONS.get(currentPos).x, POSITIONS.get(currentPos).y);
      Vector2 temp2 = new Vector2(POSITIONS.get(currentPos).x, POSITIONS.get(currentPos).y);
      Vector2 facing = new Vector2(-temp1.sub(CENTER).y, temp2.sub(CENTER).x).nor();
      if (GameInstance.getInstance().difficultyConfig == 0) {
        enemyProduction =
            new EasyEnemyProduction(cpuList.get(i), POSITIONS.get(currentPos), facing);
      } else if (GameInstance.getInstance().difficultyConfig == 1) {
        enemyProduction =
            new MediumEnemyProduction(cpuList.get(i), POSITIONS.get(currentPos), facing);
      } else {
        enemyProduction =
            new HardEnemyProduction(cpuList.get(i), POSITIONS.get(currentPos), facing);
      }
      GameInstance.getInstance().factorys.add(enemyProduction);
      ++currentPos;
    }

    //		// add cpu if only one player plays
    //		if (idP2 == -1) {
    //			temp1 = new Vector2(POSITIONS.get(1).x, POSITIONS.get(1).y);
    //			temp2 = new Vector2(POSITIONS.get(1).x, POSITIONS.get(1).y);
    //			facing = new Vector2(-temp1.sub(CENTER).y, temp2.sub(CENTER).x).nor();
    //			if(GameInstance.getInstance().difficultyConfig == 0) {
    //				enemyProduction = new EasyEnemyProduction((idP1+1)%4, POSITIONS.get(1), facing);
    //			} else if(GameInstance.getInstance().difficultyConfig == 1) {
    //				enemyProduction = new MediumEnemyProduction((idP1+1)%4, POSITIONS.get(1), facing);
    //			} else {
    //				enemyProduction = new HardEnemyProduction((idP1+1)%4, POSITIONS.get(1), facing);
    //			}
    //			GameInstance.getInstance().factorys.add(enemyProduction);
    //			touchedP2 = true;
    //			touchFadeP2 = 0;
    //
    //			temp1 = new Vector2(POSITIONS.get(2).x, POSITIONS.get(2).y);
    //			temp2 = new Vector2(POSITIONS.get(2).x, POSITIONS.get(2).y);
    //			facing = new Vector2(-temp1.sub(CENTER).y, temp2.sub(CENTER).x).nor();
    //			if(GameInstance.getInstance().difficultyConfig == 0) {
    //				enemyProduction = new EasyEnemyProduction((idP1+2)%4, POSITIONS.get(2), facing);
    //			} else if(GameInstance.getInstance().difficultyConfig == 1) {
    //				enemyProduction = new MediumEnemyProduction((idP1+2)%4, POSITIONS.get(2), facing);
    //			} else {
    //				enemyProduction = new HardEnemyProduction((idP1+2)%4, POSITIONS.get(2), facing);
    //			}
    //			GameInstance.getInstance().factorys.add(enemyProduction);
    //			touchedP2 = true;
    //			touchFadeP2 = 0;
    //
    //			temp1 = new Vector2(POSITIONS.get(3).x, POSITIONS.get(3).y);
    //			temp2 = new Vector2(POSITIONS.get(3).x, POSITIONS.get(3).y);
    //			facing = new Vector2(-temp1.sub(CENTER).y, temp2.sub(CENTER).x).nor();
    //			if(GameInstance.getInstance().difficultyConfig == 0) {
    //				enemyProduction = new EasyEnemyProduction((idP1+3)%4, POSITIONS.get(3), facing);
    //			} else if(GameInstance.getInstance().difficultyConfig == 1) {
    //				enemyProduction = new MediumEnemyProduction((idP1+3)%4, POSITIONS.get(3), facing);
    //			} else {
    //				enemyProduction = new HardEnemyProduction((idP1+3)%4, POSITIONS.get(3), facing);
    //			}
    //			GameInstance.getInstance().factorys.add(enemyProduction);
    //			touchedP2 = true;
    //			touchFadeP2 = 0;
    //		} else {
    //			temp1 = new Vector2(POSITIONS.get(1).x, POSITIONS.get(1).y);
    //			temp2 = new Vector2(POSITIONS.get(1).x, POSITIONS.get(1).y);
    //			facing = new Vector2(-temp1.sub(CENTER).y, temp2.sub(CENTER).x).nor();
    //			playerProduction = new PlayerProduction(idP2, POSITIONS.get(1), facing);
    //			GameInstance.getInstance().factorys.add(playerProduction);
    //		}

    Gdx.gl.glDisable(GL20.GL_CULL_FACE);
    Gdx.gl.glDisable(GL20.GL_DEPTH_TEST);
  }