mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-17 11:18:01 +00:00
Clean up some code to avoid duplication.
This commit is contained in:
@@ -114,11 +114,11 @@ public class FDeckChooser extends JPanel implements IDecksComboBoxListener {
|
|||||||
|
|
||||||
public DeckManager getLstDecks() { return lstDecks; }
|
public DeckManager getLstDecks() { return lstDecks; }
|
||||||
|
|
||||||
private void updateCustom() {
|
private void updateDecks(final Iterable<DeckProxy> decks, final ItemManagerConfig config) {
|
||||||
lstDecks.setAllowMultipleSelections(false);
|
lstDecks.setAllowMultipleSelections(false);
|
||||||
|
|
||||||
lstDecks.setPool(DeckProxy.getAllConstructedDecks());
|
lstDecks.setPool(decks);
|
||||||
lstDecks.setup(ItemManagerConfig.CONSTRUCTED_DECKS);
|
lstDecks.setup(config);
|
||||||
|
|
||||||
btnRandom.setText("Random Deck");
|
btnRandom.setText("Random Deck");
|
||||||
btnRandom.setCommand(new UiCommand() {
|
btnRandom.setCommand(new UiCommand() {
|
||||||
@@ -131,6 +131,10 @@ public class FDeckChooser extends JPanel implements IDecksComboBoxListener {
|
|||||||
lstDecks.setSelectedIndex(0);
|
lstDecks.setSelectedIndex(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void updateCustom() {
|
||||||
|
updateDecks(DeckProxy.getAllConstructedDecks(), ItemManagerConfig.CONSTRUCTED_DECKS);
|
||||||
|
}
|
||||||
|
|
||||||
private void updateColors() {
|
private void updateColors() {
|
||||||
lstDecks.setAllowMultipleSelections(true);
|
lstDecks.setAllowMultipleSelections(true);
|
||||||
|
|
||||||
@@ -150,90 +154,26 @@ public class FDeckChooser extends JPanel implements IDecksComboBoxListener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void updateThemes() {
|
private void updateThemes() {
|
||||||
lstDecks.setAllowMultipleSelections(false);
|
updateDecks(DeckProxy.getAllThemeDecks(), ItemManagerConfig.STRING_ONLY);
|
||||||
|
|
||||||
lstDecks.setPool(DeckProxy.getAllThemeDecks());
|
|
||||||
lstDecks.setup(ItemManagerConfig.STRING_ONLY);
|
|
||||||
|
|
||||||
btnRandom.setText("Random Deck");
|
|
||||||
btnRandom.setCommand(new UiCommand() {
|
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
DeckgenUtil.randomSelect(lstDecks);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
lstDecks.setSelectedIndex(0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updatePrecons() {
|
private void updatePrecons() {
|
||||||
lstDecks.setAllowMultipleSelections(false);
|
updateDecks(DeckProxy.getAllPreconstructedDecks(QuestController.getPrecons()), ItemManagerConfig.PRECON_DECKS);
|
||||||
|
|
||||||
lstDecks.setPool(DeckProxy.getAllPreconstructedDecks(QuestController.getPrecons()));
|
|
||||||
lstDecks.setup(ItemManagerConfig.PRECON_DECKS);
|
|
||||||
|
|
||||||
btnRandom.setText("Random Deck");
|
|
||||||
btnRandom.setCommand(new UiCommand() {
|
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
DeckgenUtil.randomSelect(lstDecks);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
lstDecks.setSelectedIndex(0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateQuestEvents() {
|
private void updateQuestEvents() {
|
||||||
lstDecks.setAllowMultipleSelections(false);
|
updateDecks(DeckProxy.getAllQuestEventAndChallenges(), ItemManagerConfig.QUEST_EVENT_DECKS);
|
||||||
|
|
||||||
lstDecks.setPool(DeckProxy.getAllQuestEventAndChallenges());
|
|
||||||
lstDecks.setup(ItemManagerConfig.QUEST_EVENT_DECKS);
|
|
||||||
|
|
||||||
btnRandom.setText("Random Deck");
|
|
||||||
btnRandom.setCommand(new UiCommand() {
|
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
DeckgenUtil.randomSelect(lstDecks);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
lstDecks.setSelectedIndex(0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateRandom() {
|
private void updateRandom() {
|
||||||
lstDecks.setAllowMultipleSelections(false);
|
updateDecks(RandomDeckGenerator.getRandomDecks(lstDecks, isAi), ItemManagerConfig.STRING_ONLY);
|
||||||
|
|
||||||
lstDecks.setPool(RandomDeckGenerator.getRandomDecks(lstDecks, isAi));
|
|
||||||
lstDecks.setup(ItemManagerConfig.STRING_ONLY);
|
|
||||||
|
|
||||||
btnViewDeck.setVisible(false);
|
|
||||||
btnRandom.setText("Random Deck");
|
|
||||||
btnRandom.setCommand(new UiCommand() {
|
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
DeckgenUtil.randomSelect(lstDecks);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateNetDecks() {
|
private void updateNetDecks() {
|
||||||
if (netDeckCategory != null) {
|
if (netDeckCategory != null) {
|
||||||
decksComboBox.setText(netDeckCategory.getDeckType());
|
decksComboBox.setText(netDeckCategory.getDeckType());
|
||||||
}
|
}
|
||||||
lstDecks.setAllowMultipleSelections(false);
|
updateDecks(DeckProxy.getNetDecks(netDeckCategory), ItemManagerConfig.NET_DECKS);
|
||||||
|
|
||||||
lstDecks.setPool(DeckProxy.getNetDecks(netDeckCategory));
|
|
||||||
lstDecks.setup(ItemManagerConfig.NET_DECKS);
|
|
||||||
|
|
||||||
btnRandom.setText("Random Deck");
|
|
||||||
btnRandom.setCommand(new UiCommand() {
|
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
DeckgenUtil.randomSelect(lstDecks);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
lstDecks.setSelectedIndex(0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public Deck getDeck() {
|
public Deck getDeck() {
|
||||||
|
|||||||
Reference in New Issue
Block a user