mirror of
https://github.com/correl/mage.git
synced 2024-12-25 03:00:15 +00:00
Some minor changes.
This commit is contained in:
parent
d1fd69f685
commit
ea439505ce
2 changed files with 13 additions and 17 deletions
|
@ -6,7 +6,6 @@ import java.awt.event.KeyEvent;
|
||||||
import java.awt.event.MouseAdapter;
|
import java.awt.event.MouseAdapter;
|
||||||
import java.awt.event.MouseEvent;
|
import java.awt.event.MouseEvent;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.List;
|
|
||||||
import java.util.regex.Matcher;
|
import java.util.regex.Matcher;
|
||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
@ -23,7 +22,6 @@ import mage.client.constants.Constants;
|
||||||
import mage.client.dialog.PreferencesDialog;
|
import mage.client.dialog.PreferencesDialog;
|
||||||
import mage.client.plugins.impl.Plugins;
|
import mage.client.plugins.impl.Plugins;
|
||||||
import mage.client.util.*;
|
import mage.client.util.*;
|
||||||
import mage.client.util.Event;
|
|
||||||
import mage.constants.CardType;
|
import mage.constants.CardType;
|
||||||
import mage.constants.SuperType;
|
import mage.constants.SuperType;
|
||||||
import mage.util.RandomUtil;
|
import mage.util.RandomUtil;
|
||||||
|
@ -354,7 +352,7 @@ public class DragCardGrid extends JPanel implements DragCardSource, DragCardTarg
|
||||||
clearCardEventListeners();
|
clearCardEventListeners();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addCardEventListener(Listener<Event> listener) {
|
public void addCardEventListener(Listener<mage.client.util.Event> listener) {
|
||||||
eventSource.addListener(listener);
|
eventSource.addListener(listener);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -396,9 +394,9 @@ public class DragCardGrid extends JPanel implements DragCardSource, DragCardTarg
|
||||||
|
|
||||||
public DeckCardLayout getCardLayout() {
|
public DeckCardLayout getCardLayout() {
|
||||||
// 2D Array to put entries into
|
// 2D Array to put entries into
|
||||||
List<List<List<DeckCardInfo>>> info = new ArrayList<>();
|
java.util.List<java.util.List<java.util.List<DeckCardInfo>>> info = new ArrayList<>();
|
||||||
for (ArrayList<ArrayList<CardView>> gridRow : cardGrid) {
|
for (ArrayList<ArrayList<CardView>> gridRow : cardGrid) {
|
||||||
List<List<DeckCardInfo>> row = new ArrayList<>();
|
java.util.List<java.util.List<DeckCardInfo>> row = new ArrayList<>();
|
||||||
info.add(row);
|
info.add(row);
|
||||||
for (ArrayList<CardView> stack : gridRow) {
|
for (ArrayList<CardView> stack : gridRow) {
|
||||||
row.add(stack.stream()
|
row.add(stack.stream()
|
||||||
|
@ -566,7 +564,6 @@ public class DragCardGrid extends JPanel implements DragCardSource, DragCardTarg
|
||||||
JButton analyseButton;
|
JButton analyseButton;
|
||||||
JButton blingButton;
|
JButton blingButton;
|
||||||
|
|
||||||
|
|
||||||
// Popup for toolbar
|
// Popup for toolbar
|
||||||
final JPopupMenu filterPopup;
|
final JPopupMenu filterPopup;
|
||||||
JPopupMenu selectByTypePopup;
|
JPopupMenu selectByTypePopup;
|
||||||
|
@ -1138,7 +1135,6 @@ public class DragCardGrid extends JPanel implements DragCardSource, DragCardTarg
|
||||||
|
|
||||||
// avoids a null ref issue but only deals with symptom of problem. not sure how it gets to this state ever. see issue #3197
|
// avoids a null ref issue but only deals with symptom of problem. not sure how it gets to this state ever. see issue #3197
|
||||||
// if (selectionDragStartCards == null) return;
|
// if (selectionDragStartCards == null) return;
|
||||||
|
|
||||||
int curY = COUNT_LABEL_HEIGHT;
|
int curY = COUNT_LABEL_HEIGHT;
|
||||||
for (int rowIndex = 0; rowIndex < cardGrid.size(); ++rowIndex) {
|
for (int rowIndex = 0; rowIndex < cardGrid.size(); ++rowIndex) {
|
||||||
int stackStartIndex;
|
int stackStartIndex;
|
||||||
|
@ -1165,7 +1161,7 @@ public class DragCardGrid extends JPanel implements DragCardSource, DragCardTarg
|
||||||
boolean inBoundsY = (i >= stackStartIndex && i <= stackEndIndex);
|
boolean inBoundsY = (i >= stackStartIndex && i <= stackEndIndex);
|
||||||
boolean lastCard = (i == stack.size() - 1);
|
boolean lastCard = (i == stack.size() - 1);
|
||||||
boolean inSeletionDrag = inBoundsX && (inBoundsY || (lastCard && (y2 >= stackBottomBegin && y1 <= stackBottomEnd)));
|
boolean inSeletionDrag = inBoundsX && (inBoundsY || (lastCard && (y2 >= stackBottomBegin && y1 <= stackBottomEnd)));
|
||||||
if (inSeletionDrag || selectionDragStartCards.contains(card)) {
|
if (inSeletionDrag || selectionDragStartCards != null && selectionDragStartCards.contains(card)) {
|
||||||
if (!card.isSelected()) {
|
if (!card.isSelected()) {
|
||||||
card.setSelected(true);
|
card.setSelected(true);
|
||||||
view.update(card);
|
view.update(card);
|
||||||
|
@ -1493,7 +1489,7 @@ public class DragCardGrid extends JPanel implements DragCardSource, DragCardTarg
|
||||||
cardCriteria.setCodes(sets);
|
cardCriteria.setCodes(sets);
|
||||||
cardCriteria.name(card.getName());
|
cardCriteria.name(card.getName());
|
||||||
|
|
||||||
List<CardInfo> cardPool = CardRepository.instance.findCards(cardCriteria);
|
java.util.List<CardInfo> cardPool = CardRepository.instance.findCards(cardCriteria);
|
||||||
|
|
||||||
if (!cardPool.isEmpty()) {
|
if (!cardPool.isEmpty()) {
|
||||||
Card acard = cardPool.get(RandomUtil.nextInt(cardPool.size())).getMockCard();
|
Card acard = cardPool.get(RandomUtil.nextInt(cardPool.size())).getMockCard();
|
||||||
|
@ -1606,11 +1602,11 @@ public class DragCardGrid extends JPanel implements DragCardSource, DragCardTarg
|
||||||
// Now go through the layout and use it to build the cardGrid
|
// Now go through the layout and use it to build the cardGrid
|
||||||
cardGrid = new ArrayList<>();
|
cardGrid = new ArrayList<>();
|
||||||
maxStackSize = new ArrayList<>();
|
maxStackSize = new ArrayList<>();
|
||||||
for (List<List<DeckCardInfo>> row : layout.getCards()) {
|
for (java.util.List<java.util.List<DeckCardInfo>> row : layout.getCards()) {
|
||||||
ArrayList<ArrayList<CardView>> gridRow = new ArrayList<>();
|
ArrayList<ArrayList<CardView>> gridRow = new ArrayList<>();
|
||||||
int thisMaxStackSize = 0;
|
int thisMaxStackSize = 0;
|
||||||
cardGrid.add(gridRow);
|
cardGrid.add(gridRow);
|
||||||
for (List<DeckCardInfo> stack : row) {
|
for (java.util.List<DeckCardInfo> stack : row) {
|
||||||
ArrayList<CardView> gridStack = new ArrayList<>();
|
ArrayList<CardView> gridStack = new ArrayList<>();
|
||||||
gridRow.add(gridStack);
|
gridRow.add(gridStack);
|
||||||
for (DeckCardInfo info : stack) {
|
for (DeckCardInfo info : stack) {
|
||||||
|
|
|
@ -192,8 +192,8 @@ public final class CardImageUtils {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String generateTokenDescriptorImagePath(CardDownloadData card) {
|
public static String generateTokenDescriptorImagePath(CardDownloadData card) {
|
||||||
String useDefault = PreferencesDialog.getCachedValue(PreferencesDialog.KEY_CARD_IMAGES_USE_DEFAULT, "true");
|
// String useDefault = PreferencesDialog.getCachedValue(PreferencesDialog.KEY_CARD_IMAGES_USE_DEFAULT, "true");
|
||||||
String imagesPath = Objects.equals(useDefault, "true") ? null : PreferencesDialog.getCachedValue(PreferencesDialog.KEY_CARD_IMAGES_PATH, null);
|
// String imagesPath = Objects.equals(useDefault, "true") ? null : PreferencesDialog.getCachedValue(PreferencesDialog.KEY_CARD_IMAGES_PATH, null);
|
||||||
|
|
||||||
String straightImageFile = getTokenDescriptorImagePath(card);
|
String straightImageFile = getTokenDescriptorImagePath(card);
|
||||||
TFile file = new TFile(straightImageFile);
|
TFile file = new TFile(straightImageFile);
|
||||||
|
|
Loading…
Reference in a new issue