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(); }
public void updateVariantControlsVisibility() { boolean isCommanderApplied = false; boolean isTinyLeadersApplied = false; boolean isPlanechaseApplied = false; boolean isVanguardApplied = false; boolean isArchenemyApplied = false; boolean archenemyVisiblity = false; boolean isDeckBuildingAllowed = mayEdit; for (GameType variant : screen.getLobby().getAppliedVariants()) { switch (variant) { case Archenemy: isArchenemyApplied = true; if (isArchenemy()) { archenemyVisiblity = true; } break; case ArchenemyRumble: archenemyVisiblity = true; break; case Commander: isCommanderApplied = true; isDeckBuildingAllowed = false; // Commander deck replaces basic deck, so hide that break; case TinyLeaders: isTinyLeadersApplied = true; isDeckBuildingAllowed = false; // Tiny Leaders deck replaces basic deck, so hide that break; case Planechase: isPlanechaseApplied = true; break; case Vanguard: isVanguardApplied = true; break; default: if (variant.isAutoGenerated()) { isDeckBuildingAllowed = false; } break; } } btnDeck.setVisible(isDeckBuildingAllowed); btnCommanderDeck.setVisible(isCommanderApplied && mayEdit); btnTinyLeadersDeck.setVisible(isTinyLeadersApplied && mayEdit); btnSchemeDeck.setVisible(archenemyVisiblity && mayEdit); cbTeam.setVisible(!isArchenemyApplied); cbArchenemyTeam.setVisible(isArchenemyApplied); btnPlanarDeck.setVisible(isPlanechaseApplied && mayEdit); btnVanguardAvatar.setVisible(isVanguardApplied && mayEdit); }
private void updateVariantControlsVisibility() { final boolean isTinyLeaders = lobby.hasVariant(GameType.TinyLeaders); final boolean isCommanderApplied = mayEdit && (lobby.hasVariant(GameType.Commander) || isTinyLeaders); final boolean isPlanechaseApplied = mayEdit && lobby.hasVariant(GameType.Planechase); final boolean isVanguardApplied = mayEdit && lobby.hasVariant(GameType.Vanguard); final boolean isArchenemyApplied = mayEdit && lobby.hasVariant(GameType.Archenemy); final boolean archenemyVisiblity = mayEdit && lobby.hasVariant(GameType.ArchenemyRumble) || (isArchenemyApplied && isArchenemy()); // Commander deck building replaces normal one, so hide it final boolean isDeckBuildingAllowed = mayEdit && !isCommanderApplied && !lobby.hasVariant(GameType.MomirBasic); deckLabel.setVisible(isDeckBuildingAllowed); deckBtn.setVisible(isDeckBuildingAllowed); cmdDeckSelectorBtn.setVisible(isCommanderApplied); cmdDeckEditor.setText(isTinyLeaders ? "TL Deck Editor" : "Commander Deck Editor"); cmdDeckEditor.setVisible(isCommanderApplied); cmdLabel.setVisible(isCommanderApplied); scmDeckSelectorBtn.setVisible(archenemyVisiblity); scmDeckEditor.setVisible(archenemyVisiblity); scmLabel.setVisible(archenemyVisiblity); teamComboBox.setVisible(!isArchenemyApplied); aeTeamComboBox.setVisible(isArchenemyApplied); pchDeckSelectorBtn.setVisible(isPlanechaseApplied); pchDeckEditor.setVisible(isPlanechaseApplied); pchLabel.setVisible(isPlanechaseApplied); vgdSelectorBtn.setVisible(isVanguardApplied); vgdLabel.setVisible(isVanguardApplied); }