コード例 #1
0
ファイル: PlayerPanel.java プロジェクト: diab0l/mtg-forge
  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();
  }
コード例 #2
0
ファイル: PlayerPanel.java プロジェクト: diab0l/mtg-forge
  public void setMayEdit(boolean mayEdit0) {
    if (mayEdit == mayEdit0) {
      return;
    }
    mayEdit = mayEdit0;
    avatarLabel.setEnabled(mayEdit);
    txtPlayerName.setEnabled(mayEdit);
    nameRandomiser.setEnabled(mayEdit);
    humanAiSwitch.setEnabled(mayEdit);
    updateVariantControlsVisibility();

    // if panel has height already, ensure height updated to account for button visibility changes
    if (getHeight() > 0) {
      screen.getPlayersScroll().revalidate();
    }
  }