mirror of
https://github.com/correl/mage.git
synced 2024-12-26 11:09:27 +00:00
Merge pull request #4689 from spjspj/master
Add 'Choose Matching' to deck editor
This commit is contained in:
commit
cdc68e3323
1 changed files with 20 additions and 0 deletions
|
@ -1084,6 +1084,22 @@ public class DragCardGrid extends JPanel implements DragCardSource, DragCardTarg
|
||||||
repaint();
|
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() {
|
private void showAll() {
|
||||||
for (DragCardGridListener l : listeners) {
|
for (DragCardGridListener l : listeners) {
|
||||||
l.showAll();
|
l.showAll();
|
||||||
|
@ -1705,6 +1721,10 @@ public class DragCardGrid extends JPanel implements DragCardSource, DragCardTarg
|
||||||
invertSelection.addActionListener(e2 -> invertSelection());
|
invertSelection.addActionListener(e2 -> invertSelection());
|
||||||
menu.add(invertSelection);
|
menu.add(invertSelection);
|
||||||
|
|
||||||
|
JMenuItem chooseMatching = new JMenuItem("Choose Matching");
|
||||||
|
chooseMatching.addActionListener(e2 -> chooseMatching());
|
||||||
|
menu.add(chooseMatching);
|
||||||
|
|
||||||
// Show 'Duplicate Selection' for FREE_BUILDING
|
// Show 'Duplicate Selection' for FREE_BUILDING
|
||||||
if (this.mode == Constants.DeckEditorMode.FREE_BUILDING) {
|
if (this.mode == Constants.DeckEditorMode.FREE_BUILDING) {
|
||||||
JMenuItem duplicateSelection = new JMenuItem("Duplicate Selection");
|
JMenuItem duplicateSelection = new JMenuItem("Duplicate Selection");
|
||||||
|
|
Loading…
Reference in a new issue