Merge pull request #4689 from spjspj/master

Add 'Choose Matching' to deck editor
This commit is contained in:
spjspj 2018-03-31 18:06:44 +11:00 committed by GitHub
commit cdc68e3323
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1083,6 +1083,22 @@ public class DragCardGrid extends JPanel implements DragCardSource, DragCardTarg
}
repaint();
}
private void chooseMatching() {
Collection<CardView> toMatch = dragCardList();
for (DragCardGridListener l : listeners) {
for (CardView card : allCards) {
for (CardView aMatch : toMatch) {
if (card.getName().equals(aMatch.getName())) {
card.setSelected(true);
cardViews.get(card.getId()).update(card);
}
}
}
}
repaint();
}
private void showAll() {
for (DragCardGridListener l : listeners) {
@ -1704,6 +1720,10 @@ public class DragCardGrid extends JPanel implements DragCardSource, DragCardTarg
JMenuItem invertSelection = new JMenuItem("Invert Selection");
invertSelection.addActionListener(e2 -> invertSelection());
menu.add(invertSelection);
JMenuItem chooseMatching = new JMenuItem("Choose Matching");
chooseMatching.addActionListener(e2 -> chooseMatching());
menu.add(chooseMatching);
// Show 'Duplicate Selection' for FREE_BUILDING
if (this.mode == Constants.DeckEditorMode.FREE_BUILDING) {