Ejemplo n.º 1
0
  /** @param index */
  private void createPlayerTypeOptions() {
    radioHuman = new FRadioButton("Human");
    radioAi = new FRadioButton("AI");
    radioOpen = new FRadioButton("Open");

    final JPopupMenu menu = new JPopupMenu();
    radioAiUseSimulation = new JCheckBoxMenuItem("Use Simulation");
    menu.add(radioAiUseSimulation);
    radioAiUseSimulation.addActionListener(
        new ActionListener() {
          @Override
          public final void actionPerformed(final ActionEvent e) {
            lobby.firePlayerChangeListener(index);
          }
        });
    radioAi.setComponentPopupMenu(menu);

    radioHuman.addMouseListener(radioMouseAdapter(radioHuman, LobbySlotType.LOCAL));
    radioAi.addMouseListener(radioMouseAdapter(radioAi, LobbySlotType.AI));
    radioOpen.addMouseListener(radioMouseAdapter(radioOpen, LobbySlotType.OPEN));

    final ButtonGroup tempBtnGroup = new ButtonGroup();
    tempBtnGroup.add(radioHuman);
    tempBtnGroup.add(radioAi);
    tempBtnGroup.add(radioOpen);
  }
Ejemplo n.º 2
0
 public void setRemote(final boolean remote) {
   if (remote) {
     setType(LobbySlotType.REMOTE);
     radioHuman.setSelected(false);
     radioAi.setSelected(false);
     radioOpen.setSelected(false);
   } else {
     setType(LobbySlotType.OPEN);
   }
 }
Ejemplo n.º 3
0
  void update() {
    avatarLabel.setEnabled(mayEdit);
    avatarLabel.setIcon(
        FSkin.getAvatars().get(Integer.valueOf(type == LobbySlotType.OPEN ? -1 : avatarIndex)));
    avatarLabel.repaintSelf();

    txtPlayerName.setEnabled(mayEdit);
    txtPlayerName.setText(type == LobbySlotType.OPEN ? StringUtils.EMPTY : playerName);
    nameRandomiser.setEnabled(mayEdit);
    deckLabel.setVisible(mayEdit);
    deckBtn.setVisible(mayEdit);
    chkReady.setVisible(type == LobbySlotType.LOCAL || type == LobbySlotType.REMOTE);
    chkReady.setEnabled(mayEdit);

    closeBtn.setVisible(mayRemove);

    if (mayRemove) {
      radioHuman.setEnabled(mayControl);
      radioAi.setEnabled(mayControl);
      radioOpen.setEnabled(mayControl);
    } else {
      radioHuman.setVisible(mayControl);
      radioAi.setVisible(mayControl);
      radioOpen.setVisible(mayControl);
    }

    radioHuman.setSelected(type == LobbySlotType.LOCAL);
    radioAi.setSelected(type == LobbySlotType.AI);
    radioOpen.setSelected(type == LobbySlotType.OPEN);

    updateVariantControlsVisibility();
  }
Ejemplo n.º 4
0
 public void setType(final LobbySlotType type) {
   this.type = type;
   switch (type) {
     case LOCAL:
       radioHuman.setSelected(true);
       break;
     case AI:
       radioAi.setSelected(true);
       break;
     case OPEN:
       radioOpen.setSelected(true);
       break;
     case REMOTE:
       break;
   }
   update();
 }
Ejemplo n.º 5
0
 private boolean isSimulatedAi() {
   return radioAi.isSelected() && radioAiUseSimulation.isSelected();
 }