mirror of
https://github.com/magefree/mage.git
synced 2025-12-25 13:02:06 -08:00
Merge branch 'master' into Network_Upgrade
Conflicts: Mage.Client/src/main/java/mage/client/MageFrame.java Mage.Client/src/main/java/mage/client/chat/ChatPanel.java Mage.Client/src/main/java/mage/client/dialog/PreferencesDialog.java Mage.Client/src/main/java/mage/client/dialog/TableWaitingDialog.java Mage.Client/src/main/java/mage/client/game/FeedbackPanel.java Mage.Client/src/main/java/mage/client/game/GamePanel.java Mage.Client/src/main/java/mage/client/game/PlayAreaPanel.java Mage.Client/src/main/java/mage/client/game/PlayerPanelExt.java Mage.Client/src/main/java/mage/client/tournament/TournamentPanel.java Mage.Common/src/mage/interfaces/MageServer.java Mage.Common/src/mage/remote/Connection.java Mage.Common/src/mage/remote/SessionImpl.java Mage.Server/src/main/java/mage/server/MageServerImpl.java Mage.Server/src/main/java/mage/server/Session.java Mage.Server/src/main/java/mage/server/SessionManager.java Mage.Server/src/main/java/mage/server/TableController.java Mage.Server/src/main/java/mage/server/User.java Mage.Server/src/main/java/mage/server/game/GamesRoomImpl.java Mage.Server/src/main/java/mage/server/tournament/TournamentController.java
This commit is contained in:
commit
88e30ee6e1
1364 changed files with 51978 additions and 7733 deletions
|
|
@ -87,6 +87,7 @@ import mage.cards.repository.ExpansionRepository;
|
|||
import mage.client.cards.BigCard;
|
||||
import mage.client.chat.ChatPanel;
|
||||
import mage.client.components.MageComponents;
|
||||
import mage.client.components.MageDesktopManager;
|
||||
import mage.client.components.MageJDesktop;
|
||||
import mage.client.components.MageRoundPane;
|
||||
import mage.client.components.MageUI;
|
||||
|
|
@ -248,6 +249,9 @@ public class MageFrame extends javax.swing.JFrame implements MageClient {
|
|||
Plugins.getInstance().loadPlugins();
|
||||
|
||||
initComponents();
|
||||
|
||||
desktopPane.setDesktopManager(new MageDesktopManager());
|
||||
|
||||
setSize(1024, 768);
|
||||
SettingsManager.getInstance().setScreenWidthAndHeight(1024, 768);
|
||||
DialogManager.updateParams(768, 1024, false);
|
||||
|
|
@ -573,7 +577,7 @@ public class MageFrame extends javax.swing.JFrame implements MageClient {
|
|||
}
|
||||
|
||||
public void btnSymbolsActionPerformed(java.awt.event.ActionEvent evt) {
|
||||
if (JOptionPane.showConfirmDialog(this, "Do you want to download mana symbols?") == JOptionPane.OK_OPTION) {
|
||||
if (JOptionPane.showConfirmDialog(this, "Do you want to download game symbols and additional image files?", "Download additional resources", JOptionPane.YES_NO_OPTION) == JOptionPane.OK_OPTION) {
|
||||
Plugins.getInstance().downloadSymbols();
|
||||
}
|
||||
}
|
||||
|
|
@ -600,7 +604,7 @@ public class MageFrame extends javax.swing.JFrame implements MageClient {
|
|||
if (frame instanceof GamePane) {
|
||||
ArrowBuilder.getBuilder().showPanel(((GamePane) frame).getGameId());
|
||||
MusicPlayer.playBGM();
|
||||
}else{
|
||||
} else {
|
||||
MusicPlayer.stopBGM();
|
||||
}
|
||||
}
|
||||
|
|
@ -633,11 +637,11 @@ public class MageFrame extends javax.swing.JFrame implements MageClient {
|
|||
return topmost;
|
||||
}
|
||||
|
||||
/**
|
||||
/**
|
||||
* Shows a game for a player of the game
|
||||
*
|
||||
*
|
||||
* @param gameId
|
||||
* @param playerId
|
||||
* @param playerId
|
||||
*/
|
||||
public void showGame(final UUID gameId, final UUID playerId) {
|
||||
SwingUtilities.invokeLater(new Runnable() {
|
||||
|
|
@ -713,7 +717,7 @@ public class MageFrame extends javax.swing.JFrame implements MageClient {
|
|||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
public void endDraft(UUID draftId) {
|
||||
// inform all open draft panes about
|
||||
for (JInternalFrame window : desktopPane.getAllFramesInLayer(JLayeredPane.DEFAULT_LAYER)) {
|
||||
|
|
@ -723,7 +727,7 @@ public class MageFrame extends javax.swing.JFrame implements MageClient {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void showTournament(final UUID tournamentId) {
|
||||
SwingUtilities.invokeLater(new Runnable() {
|
||||
@Override
|
||||
|
|
@ -846,9 +850,9 @@ public class MageFrame extends javax.swing.JFrame implements MageClient {
|
|||
connection.setProxyPort(proxyPort);
|
||||
connection.setProxyUsername(proxyUsername);
|
||||
connection.setProxyPassword(proxyPassword);
|
||||
|
||||
|
||||
setUserPrefsToConnection(connection);
|
||||
|
||||
|
||||
logger.debug("connecting (auto): " + proxyType + " " + proxyServer + " " + proxyPort + " " + proxyUsername);
|
||||
if (connect(connection)) {
|
||||
return true;
|
||||
|
|
@ -864,12 +868,11 @@ public class MageFrame extends javax.swing.JFrame implements MageClient {
|
|||
public void setUserPrefsToConnection(Connection connection) {
|
||||
connection.setUserData(PreferencesDialog.getUserData());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* This method is called from within the constructor to
|
||||
* initialize the form.
|
||||
* WARNING: Do NOT modify this code. The content of this method is
|
||||
* always regenerated by the Form Editor.
|
||||
* This method is called from within the constructor to initialize the form.
|
||||
* WARNING: Do NOT modify this code. The content of this method is always
|
||||
* regenerated by the Form Editor.
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
|
||||
|
|
@ -1043,7 +1046,7 @@ public class MageFrame extends javax.swing.JFrame implements MageClient {
|
|||
client.disconnect(false);
|
||||
tablesPane.clearChat();
|
||||
setWindowTitle();
|
||||
showMessage("Disconnected", "You have disconnected");
|
||||
showMessage("Disconnected", "You have disconnected");
|
||||
}
|
||||
} else {
|
||||
connectDialog.showDialog();
|
||||
|
|
@ -1094,7 +1097,7 @@ public class MageFrame extends javax.swing.JFrame implements MageClient {
|
|||
}
|
||||
}
|
||||
CardRepository.instance.closeDB();
|
||||
tablesPane.cleanUp();
|
||||
tablesPane.cleanUp();
|
||||
Plugins.getInstance().shutdown();
|
||||
dispose();
|
||||
System.exit(0);
|
||||
|
|
@ -1138,7 +1141,7 @@ public class MageFrame extends javax.swing.JFrame implements MageClient {
|
|||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
public void hideGames() {
|
||||
JInternalFrame[] windows = desktopPane.getAllFramesInLayer(JLayeredPane.DEFAULT_LAYER);
|
||||
for (JInternalFrame window : windows) {
|
||||
|
|
@ -1157,8 +1160,8 @@ public class MageFrame extends javax.swing.JFrame implements MageClient {
|
|||
// close & remove sideboarding or construction pane if open
|
||||
if (window instanceof DeckEditorPane) {
|
||||
DeckEditorPane deckEditorPane = (DeckEditorPane) window;
|
||||
if (deckEditorPane.getDeckEditorMode().equals(DeckEditorMode.LIMITED_BUILDING)
|
||||
|| deckEditorPane.getDeckEditorMode().equals(DeckEditorMode.SIDEBOARDING)){
|
||||
if (deckEditorPane.getDeckEditorMode().equals(DeckEditorMode.LIMITED_BUILDING)
|
||||
|| deckEditorPane.getDeckEditorMode().equals(DeckEditorMode.SIDEBOARDING)) {
|
||||
deckEditorPane.removeFrame();
|
||||
}
|
||||
}
|
||||
|
|
@ -1185,7 +1188,7 @@ public class MageFrame extends javax.swing.JFrame implements MageClient {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
try {
|
||||
DeckEditorPane deckEditorPane = new DeckEditorPane();
|
||||
desktopPane.add(deckEditorPane, JLayeredPane.DEFAULT_LAYER);
|
||||
|
|
@ -1261,7 +1264,7 @@ public class MageFrame extends javax.swing.JFrame implements MageClient {
|
|||
* @param args the command line arguments
|
||||
*/
|
||||
public static void main(final String args[]) {
|
||||
// Workaround for #451
|
||||
// Workaround for #451
|
||||
System.setProperty("java.util.Arrays.useLegacyMergeSort", "true");
|
||||
logger.info("Starting MAGE client version " + version);
|
||||
logger.info("Logging level: " + logger.getEffectiveLevel());
|
||||
|
|
@ -1299,7 +1302,7 @@ public class MageFrame extends javax.swing.JFrame implements MageClient {
|
|||
}
|
||||
instance = new MageFrame();
|
||||
instance.setVisible(true);
|
||||
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
@ -1363,7 +1366,6 @@ public class MageFrame extends javax.swing.JFrame implements MageClient {
|
|||
public static void removeGame(UUID gameId) {
|
||||
games.remove(gameId);
|
||||
}
|
||||
|
||||
|
||||
public static DraftPanel getDraft(UUID draftId) {
|
||||
return drafts.get(draftId);
|
||||
|
|
@ -1374,7 +1376,7 @@ public class MageFrame extends javax.swing.JFrame implements MageClient {
|
|||
if (draftPanel != null) {
|
||||
drafts.remove(draftId);
|
||||
draftPanel.hideDraft();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void addDraft(UUID draftId, DraftPanel draftPanel) {
|
||||
|
|
@ -1649,6 +1651,7 @@ public class MageFrame extends javax.swing.JFrame implements MageClient {
|
|||
}
|
||||
|
||||
class MagePaneMenuItem extends JCheckBoxMenuItem {
|
||||
|
||||
private final MagePane frame;
|
||||
|
||||
public MagePaneMenuItem(MagePane frame) {
|
||||
|
|
|
|||
|
|
@ -31,23 +31,33 @@
|
|||
*
|
||||
* Created on Dec 18, 2009, 10:40:12 AM
|
||||
*/
|
||||
|
||||
package mage.client.cards;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.awt.Component;
|
||||
import java.awt.Dimension;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
import java.util.Iterator;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.UUID;
|
||||
import javax.swing.border.Border;
|
||||
import javax.swing.border.EmptyBorder;
|
||||
import mage.cards.MageCard;
|
||||
import mage.client.plugins.impl.Plugins;
|
||||
import mage.client.util.CardsViewUtil;
|
||||
import mage.client.util.Config;
|
||||
import mage.view.*;
|
||||
import mage.view.CardView;
|
||||
import mage.view.CardsView;
|
||||
import mage.view.PermanentView;
|
||||
import mage.view.SimpleCardsView;
|
||||
import mage.view.StackAbilityView;
|
||||
import org.apache.log4j.Logger;
|
||||
import org.mage.card.arcane.CardPanel;
|
||||
|
||||
import javax.swing.border.Border;
|
||||
import javax.swing.border.EmptyBorder;
|
||||
import java.awt.*;
|
||||
import java.util.*;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author BetaSteward_at_googlemail.com
|
||||
|
|
@ -58,22 +68,24 @@ public class Cards extends javax.swing.JPanel {
|
|||
|
||||
private final Map<UUID, MageCard> cards = new LinkedHashMap<>();
|
||||
private boolean dontDisplayTapped = false;
|
||||
private static final int GAP_X = 5;
|
||||
private static final int GAP_X = 5; // needed for marking cards with coloured fram (e.g. on hand)
|
||||
private String zone;
|
||||
|
||||
private static final Border emptyBorder = new EmptyBorder(0,0,0,0);
|
||||
private static final Border emptyBorder = new EmptyBorder(0, 0, 0, 0);
|
||||
|
||||
private int minOffsetY = 0;
|
||||
|
||||
/**
|
||||
* Defines whether component should be visible whenever there is no objects within.
|
||||
* True by default.
|
||||
* Defines whether component should be visible whenever there is no objects
|
||||
* within. True by default.
|
||||
*/
|
||||
private boolean isVisibleIfEmpty = true;
|
||||
|
||||
private Dimension cardDimension;
|
||||
|
||||
/** Creates new form Cards */
|
||||
/**
|
||||
* Creates new form Cards
|
||||
*/
|
||||
public Cards() {
|
||||
this(false);
|
||||
}
|
||||
|
|
@ -82,7 +94,7 @@ public class Cards extends javax.swing.JPanel {
|
|||
initComponents(skipAddingScrollPane);
|
||||
setOpaque(false);
|
||||
//cardArea.setOpaque(false);
|
||||
setBackgroundColor(new Color(0,0,0,100));
|
||||
setBackgroundColor(new Color(0, 0, 0, 100));
|
||||
if (!skipAddingScrollPane) {
|
||||
jScrollPane1.setOpaque(false);
|
||||
jScrollPane1.getViewport().setOpaque(false);
|
||||
|
|
@ -94,10 +106,12 @@ public class Cards extends javax.swing.JPanel {
|
|||
cardArea.setBorder(emptyBorder);
|
||||
}
|
||||
|
||||
public void cleanUp() {}
|
||||
public void cleanUp() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets components background color
|
||||
*
|
||||
* @param color
|
||||
*/
|
||||
public void setBackgroundColor(Color color) {
|
||||
|
|
@ -140,14 +154,14 @@ public class Cards extends javax.swing.JPanel {
|
|||
if (cardsView.size() == 0 && countCards() > 0) {
|
||||
// problem happens with transformable cards
|
||||
logger.fatal("Card object on the cards panel was not removed");
|
||||
for (Component comp: cardArea.getComponents()) {
|
||||
for (Component comp : cardArea.getComponents()) {
|
||||
if (comp instanceof Card) {
|
||||
Card card = (Card)comp;
|
||||
Card card = (Card) comp;
|
||||
logger.fatal("Card name:" + card.getName() + " type:" + card.getType(null));
|
||||
} else if (comp instanceof MageCard) {
|
||||
MageCard mageCard = (MageCard)comp;
|
||||
MageCard mageCard = (MageCard) comp;
|
||||
logger.fatal("MageCard name:" + mageCard.getName() + " toolTiptext:" + mageCard.getToolTipText());
|
||||
} else {
|
||||
} else {
|
||||
logger.fatal("Unknown object:" + comp.getName() + " className:" + comp.getClass().getName());
|
||||
}
|
||||
cardArea.remove(comp);
|
||||
|
|
@ -156,24 +170,24 @@ public class Cards extends javax.swing.JPanel {
|
|||
|
||||
// order objects for display
|
||||
java.util.List<CardView> orderedList = new ArrayList<>();
|
||||
for (CardView card: cardsView.values()) {
|
||||
for (CardView card : cardsView.values()) {
|
||||
orderedList.add(0, card);
|
||||
}
|
||||
|
||||
// add objects to the panel
|
||||
for (CardView card: orderedList) {
|
||||
for (CardView card : orderedList) {
|
||||
if (dontDisplayTapped) {
|
||||
if (card instanceof PermanentView) {
|
||||
((PermanentView)card).overrideTapped(false);
|
||||
((PermanentView) card).overrideTapped(false);
|
||||
}
|
||||
}
|
||||
if (card instanceof StackAbilityView) {
|
||||
CardView tmp = ((StackAbilityView)card).getSourceCard();
|
||||
CardView tmp = ((StackAbilityView) card).getSourceCard();
|
||||
tmp.overrideRules(card.getRules());
|
||||
tmp.setIsAbility(true);
|
||||
tmp.overrideTargets(card.getTargets());
|
||||
tmp.overrideId(card.getId());
|
||||
tmp.setAbilityType(((StackAbilityView)card).getAbilityType());
|
||||
tmp.setAbilityType(((StackAbilityView) card).getAbilityType());
|
||||
card = tmp;
|
||||
} else {
|
||||
card.setAbilityType(null);
|
||||
|
|
@ -201,11 +215,15 @@ public class Cards extends javax.swing.JPanel {
|
|||
}
|
||||
|
||||
public void sizeCards(Dimension cardDimension) {
|
||||
cardArea.setPreferredSize(new Dimension((int)((cards.size()) * (cardDimension.getWidth() + GAP_X)) + 20, (int)(cardDimension.getHeight()) + 20));
|
||||
cardArea.setPreferredSize(new Dimension((int) ((cards.size()) * (cardDimension.getWidth() + GAP_X)) + 20, (int) (cardDimension.getHeight()) + 20));
|
||||
cardArea.revalidate();
|
||||
cardArea.repaint();
|
||||
}
|
||||
|
||||
public int getNumberOfCards() {
|
||||
return cards.size();
|
||||
}
|
||||
|
||||
private Dimension getCardDimension() {
|
||||
if (cardDimension == null) {
|
||||
cardDimension = new Dimension(Config.dimensions.frameWidth, Config.dimensions.frameHeight);
|
||||
|
|
@ -226,23 +244,23 @@ public class Cards extends javax.swing.JPanel {
|
|||
|
||||
private void definePosition(MageCard card) {
|
||||
int dx = 0;
|
||||
for (Component comp: cardArea.getComponents()) {
|
||||
for (Component comp : cardArea.getComponents()) {
|
||||
if (!comp.equals(card)) {
|
||||
dx = Math.max(dx, (int)comp.getLocation().getX());
|
||||
dx = Math.max(dx, (int) comp.getLocation().getX());
|
||||
}
|
||||
}
|
||||
dx += ((CardPanel)card).getCardWidth() + GAP_X;
|
||||
card.setLocation(dx, (int)card.getLocation().getY());
|
||||
dx += ((CardPanel) card).getCardWidth() + GAP_X;
|
||||
card.setLocation(dx, (int) card.getLocation().getY());
|
||||
}
|
||||
|
||||
private void removeCard(UUID cardId) {
|
||||
for (Component comp: cardArea.getComponents()) {
|
||||
for (Component comp : cardArea.getComponents()) {
|
||||
if (comp instanceof Card) {
|
||||
if (((Card)comp).getCardId().equals(cardId)) {
|
||||
if (((Card) comp).getCardId().equals(cardId)) {
|
||||
cardArea.remove(comp);
|
||||
}
|
||||
} else if (comp instanceof MageCard) {
|
||||
if (((MageCard)comp).getOriginal().getId().equals(cardId)) {
|
||||
if (((MageCard) comp).getOriginal().getId().equals(cardId)) {
|
||||
cardArea.remove(comp);
|
||||
}
|
||||
}
|
||||
|
|
@ -253,10 +271,10 @@ public class Cards extends javax.swing.JPanel {
|
|||
return cardArea.getComponentCount();
|
||||
}
|
||||
|
||||
/** This method is called from within the constructor to
|
||||
* initialize the form.
|
||||
* WARNING: Do NOT modify this code. The content of this method is
|
||||
* always regenerated by the Form Editor.
|
||||
/**
|
||||
* This method is called from within the constructor to initialize the form.
|
||||
* WARNING: Do NOT modify this code. The content of this method is always
|
||||
* regenerated by the Form Editor.
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
|
||||
|
|
@ -277,7 +295,6 @@ public class Cards extends javax.swing.JPanel {
|
|||
}
|
||||
}// </editor-fold>//GEN-END:initComponents
|
||||
|
||||
|
||||
// Variables declaration - do not modify//GEN-BEGIN:variables
|
||||
private javax.swing.JPanel cardArea;
|
||||
private javax.swing.JScrollPane jScrollPane1;
|
||||
|
|
@ -309,7 +326,7 @@ public class Cards extends javax.swing.JPanel {
|
|||
|
||||
for (Component component : cardArea.getComponents()) {
|
||||
if (component instanceof CardPanel) {
|
||||
cards.add((CardPanel)component);
|
||||
cards.add((CardPanel) component);
|
||||
}
|
||||
}
|
||||
Collections.sort(cards, new Comparator<CardPanel>() {
|
||||
|
|
|
|||
|
|
@ -66,7 +66,7 @@ import org.mage.network.Client;
|
|||
* @author BetaSteward_at_googlemail.com, nantuko
|
||||
*/
|
||||
public class ChatPanel extends javax.swing.JPanel {
|
||||
|
||||
|
||||
private UUID chatId;
|
||||
private Client client;
|
||||
private final List<String> players = new ArrayList<>();
|
||||
|
|
@ -74,7 +74,7 @@ public class ChatPanel extends javax.swing.JPanel {
|
|||
/**
|
||||
* Chat message color for opponents.
|
||||
*/
|
||||
private static final String OPPONENT_COLOR = "#FF7F50";
|
||||
private static final String OPPONENT_COLOR = "#FF7F50";
|
||||
/**
|
||||
* Chat message color for client player.
|
||||
*/
|
||||
|
|
@ -126,7 +126,7 @@ public class ChatPanel extends javax.swing.JPanel {
|
|||
private ChatType chatType = ChatType.DEFAULT;
|
||||
|
||||
private static final int[] defaultColumnsWidth = {20, 100, 100, 80};
|
||||
|
||||
|
||||
public enum ChatType {
|
||||
|
||||
DEFAULT, GAME, TABLES, TOURNAMENT
|
||||
|
|
@ -145,6 +145,7 @@ public class ChatPanel extends javax.swing.JPanel {
|
|||
*/
|
||||
/**
|
||||
* Creates new form ChatPanel
|
||||
*
|
||||
* @param addPlayersTab
|
||||
*/
|
||||
public ChatPanel(boolean addPlayersTab) {
|
||||
|
|
@ -154,10 +155,10 @@ public class ChatPanel extends javax.swing.JPanel {
|
|||
jTablePlayers.setBackground(new Color(0, 0, 0, ALPHA));
|
||||
jTablePlayers.setForeground(Color.white);
|
||||
jTablePlayers.setRowSorter(new MageTableRowSorter(userTableModel));
|
||||
|
||||
|
||||
TableUtil.setColumnWidthAndOrder(jTablePlayers, defaultColumnsWidth, KEY_USERS_COLUMNS_WIDTH, KEY_USERS_COLUMNS_ORDER);
|
||||
jTablePlayers.setDefaultRenderer(Icon.class, new CountryCellRenderer());
|
||||
|
||||
|
||||
if (jScrollPaneTxt != null) {
|
||||
jScrollPaneTxt.setBackground(new Color(0, 0, 0, ALPHA));
|
||||
jScrollPaneTxt.getViewport().setBackground(new Color(0, 0, 0, ALPHA));
|
||||
|
|
@ -172,7 +173,7 @@ public class ChatPanel extends javax.swing.JPanel {
|
|||
}
|
||||
|
||||
public void cleanUp() {
|
||||
TableUtil.saveColumnWidthAndOrderToPrefs(jTablePlayers, KEY_USERS_COLUMNS_WIDTH, KEY_USERS_COLUMNS_ORDER);
|
||||
TableUtil.saveColumnWidthAndOrderToPrefs(jTablePlayers, KEY_USERS_COLUMNS_WIDTH, KEY_USERS_COLUMNS_ORDER);
|
||||
}
|
||||
|
||||
public ChatType getChatType() {
|
||||
|
|
@ -275,7 +276,7 @@ public class ChatPanel extends javax.swing.JPanel {
|
|||
}
|
||||
if (username != null && !username.isEmpty()) {
|
||||
text.append(getColoredText(userColor, username + userSeparator));
|
||||
}
|
||||
}
|
||||
text.append(getColoredText(textColor, ManaSymbols.replaceSymbolsWithHTML(message, ManaSymbols.Type.PAY)));
|
||||
this.txtConversation.append(text.toString());
|
||||
}
|
||||
|
|
@ -318,6 +319,7 @@ public class ChatPanel extends javax.swing.JPanel {
|
|||
sb.append("</font>");
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
public String getText() {
|
||||
return txtConversation.getText();
|
||||
}
|
||||
|
|
@ -382,7 +384,7 @@ public class ChatPanel extends javax.swing.JPanel {
|
|||
|
||||
class UserTableModel extends AbstractTableModel {
|
||||
|
||||
private final String[] columnNames = new String[]{" ","Players", "Info", "Games", "Connection"};
|
||||
private final String[] columnNames = new String[]{"Loc", "Players", "Info", "Games", "Connection"};
|
||||
private UsersView[] players = new UsersView[0];
|
||||
|
||||
public void loadData(RoomUsersView roomUserInfo) throws MageRemoteException {
|
||||
|
|
@ -390,12 +392,12 @@ public class ChatPanel extends javax.swing.JPanel {
|
|||
this.players = roomUserInfo.getUsersView().toArray(new UsersView[0]);
|
||||
JTableHeader th = jTablePlayers.getTableHeader();
|
||||
TableColumnModel tcm = th.getColumnModel();
|
||||
|
||||
|
||||
tcm.getColumn(jTablePlayers.convertColumnIndexToView(1)).setHeaderValue("Players (" + this.players.length + ")");
|
||||
tcm.getColumn(jTablePlayers.convertColumnIndexToView(3)).setHeaderValue(
|
||||
"Games " + roomUserInfo.getNumberActiveGames() +
|
||||
(roomUserInfo.getNumberActiveGames() != roomUserInfo.getNumberGameThreads() ? " (T:" + roomUserInfo.getNumberGameThreads():" (") +
|
||||
" limit: " + roomUserInfo.getNumberMaxGames() + ")");
|
||||
"Games " + roomUserInfo.getNumberActiveGames()
|
||||
+ (roomUserInfo.getNumberActiveGames() != roomUserInfo.getNumberGameThreads() ? " (T:" + roomUserInfo.getNumberGameThreads() : " (")
|
||||
+ " limit: " + roomUserInfo.getNumberMaxGames() + ")");
|
||||
th.repaint();
|
||||
this.fireTableDataChanged();
|
||||
}
|
||||
|
|
@ -445,16 +447,14 @@ public class ChatPanel extends javax.swing.JPanel {
|
|||
return Icon.class;
|
||||
default:
|
||||
return String.class;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isCellEditable(int rowIndex, int columnIndex) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
public void clear() {
|
||||
|
|
@ -542,9 +542,9 @@ public class ChatPanel extends javax.swing.JPanel {
|
|||
layout.setVerticalGroup(
|
||||
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
|
||||
.addComponent(jScrollPaneTxt, javax.swing.GroupLayout.DEFAULT_SIZE, 294, Short.MAX_VALUE)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(txtMessage, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)));
|
||||
.addComponent(jScrollPaneTxt, javax.swing.GroupLayout.DEFAULT_SIZE, 294, Short.MAX_VALUE)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(txtMessage, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)));
|
||||
jTablePlayers = null;
|
||||
jScrollPanePlayers = null;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,12 +1,17 @@
|
|||
package mage.client.components;
|
||||
|
||||
import mage.client.util.Command;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
import java.awt.Color;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.Font;
|
||||
import java.awt.Graphics;
|
||||
import java.awt.Graphics2D;
|
||||
import java.awt.Image;
|
||||
import java.awt.Rectangle;
|
||||
import java.awt.event.MouseEvent;
|
||||
import java.awt.event.MouseListener;
|
||||
import java.awt.font.FontRenderContext;
|
||||
import javax.swing.JPanel;
|
||||
import mage.client.util.Command;
|
||||
|
||||
/**
|
||||
* Image button with hover.
|
||||
|
|
@ -48,6 +53,8 @@ public class HoverButton extends JPanel implements MouseListener {
|
|||
static final Font textSetFontBold = new Font("Arial", Font.BOLD, 14);
|
||||
private boolean useMiniFont = false;
|
||||
|
||||
private boolean alignTextLeft = false;
|
||||
|
||||
public HoverButton(String text, Image image, Rectangle size) {
|
||||
this(text, image, image, null, image, size);
|
||||
if (image == null) {
|
||||
|
|
@ -113,7 +120,7 @@ public class HoverButton extends JPanel implements MouseListener {
|
|||
}
|
||||
topTextOffsetX = calculateOffsetForTop(g2d, topText);
|
||||
g2d.setColor(textBGColor);
|
||||
g2d.drawString(topText, topTextOffsetX+1, 13);
|
||||
g2d.drawString(topText, topTextOffsetX + 1, 13);
|
||||
g2d.setColor(textColor);
|
||||
g2d.drawString(topText, topTextOffsetX, 12);
|
||||
}
|
||||
|
|
@ -148,7 +155,11 @@ public class HoverButton extends JPanel implements MouseListener {
|
|||
frc = g2d.getFontRenderContext();
|
||||
textWidth = (int) textFontMini.getStringBounds(text, frc).getWidth();
|
||||
}
|
||||
textOffsetX = (imageSize.width - textWidth) / 2;
|
||||
if (alignTextLeft) {
|
||||
textOffsetX = 0;
|
||||
} else {
|
||||
textOffsetX = (imageSize.width - textWidth) / 2;
|
||||
}
|
||||
}
|
||||
return textOffsetX;
|
||||
}
|
||||
|
|
@ -277,4 +288,8 @@ public class HoverButton extends JPanel implements MouseListener {
|
|||
this.textAlwaysVisible = textAlwaysVisible;
|
||||
}
|
||||
|
||||
public void setAlignTextLeft(boolean alignTextLeft) {
|
||||
this.alignTextLeft = alignTextLeft;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,64 @@
|
|||
/*
|
||||
* To change this license header, choose License Headers in Project Properties.
|
||||
* To change this template file, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
package mage.client.components;
|
||||
|
||||
import java.awt.BorderLayout;
|
||||
import javax.swing.DefaultDesktopManager;
|
||||
import javax.swing.DesktopManager;
|
||||
import javax.swing.JDesktopPane;
|
||||
import javax.swing.JFrame;
|
||||
import javax.swing.JInternalFrame;
|
||||
import javax.swing.SwingUtilities;
|
||||
import mage.client.dialog.CardInfoWindowDialog;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author LevelX2
|
||||
*/
|
||||
public class MageDesktopManager extends DefaultDesktopManager {
|
||||
|
||||
static final int DESKTOP_ICON_WIDTH = 250;
|
||||
|
||||
@Override
|
||||
public void iconifyFrame(JInternalFrame f) {
|
||||
super.iconifyFrame(f);
|
||||
if (f instanceof CardInfoWindowDialog) {
|
||||
JInternalFrame.JDesktopIcon icon = f.getDesktopIcon();
|
||||
icon.setBounds(f.getX() + (f.getWidth() - DESKTOP_ICON_WIDTH), f.getY(), DESKTOP_ICON_WIDTH, icon.getHeight());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deiconifyFrame(JInternalFrame f) {
|
||||
super.deiconifyFrame(f);
|
||||
if (f instanceof CardInfoWindowDialog) {
|
||||
JInternalFrame.JDesktopIcon icon = f.getDesktopIcon();
|
||||
f.setBounds(icon.getX() + (DESKTOP_ICON_WIDTH - f.getWidth()), icon.getY(), f.getWidth(), f.getHeight());
|
||||
}
|
||||
}
|
||||
|
||||
public static void main(String args[]) {
|
||||
SwingUtilities.invokeLater(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
JFrame frame = new JFrame();
|
||||
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
|
||||
|
||||
JDesktopPane desktopPane = new JDesktopPane();
|
||||
DesktopManager dm = new MageDesktopManager();
|
||||
desktopPane.setDesktopManager(dm);
|
||||
JInternalFrame internalFrame = new JInternalFrame("Test Internal Frame", true, false, true, true);
|
||||
internalFrame.setSize(200, 150);
|
||||
internalFrame.setVisible(true);
|
||||
desktopPane.add(internalFrame);
|
||||
|
||||
frame.add(desktopPane, BorderLayout.CENTER);
|
||||
frame.setSize(800, 600);
|
||||
frame.setVisible(true);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
@ -1,19 +1,16 @@
|
|||
package mage.client.components;
|
||||
|
||||
import java.awt.Color;
|
||||
import javax.swing.JEditorPane;
|
||||
import javax.swing.SwingUtilities;
|
||||
import org.mage.card.arcane.ManaSymbols;
|
||||
import org.mage.card.arcane.UI;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
import javax.swing.text.JTextComponent;
|
||||
|
||||
/**
|
||||
* Component for displaying text in mage.
|
||||
* Supports drawing mana symbols.
|
||||
* Component for displaying text in mage. Supports drawing mana symbols.
|
||||
*
|
||||
* @author nantuko
|
||||
*/
|
||||
|
||||
public class MageTextArea extends JEditorPane {
|
||||
|
||||
public MageTextArea() {
|
||||
|
|
@ -27,10 +24,10 @@ public class MageTextArea extends JEditorPane {
|
|||
|
||||
@Override
|
||||
public void setText(String text) {
|
||||
setText(text, 16);
|
||||
setText(text, 0);
|
||||
}
|
||||
|
||||
public void setText(String text, int fontSize) {
|
||||
public void setText(String text, final int panelWidth) {
|
||||
if (text == null) {
|
||||
return;
|
||||
}
|
||||
|
|
@ -38,23 +35,36 @@ public class MageTextArea extends JEditorPane {
|
|||
final StringBuilder buffer = new StringBuilder(512);
|
||||
// Dialog is a java logical font family, so it should work on all systems
|
||||
buffer.append("<html><body style='font-family:Dialog;font-size:");
|
||||
buffer.append(fontSize);
|
||||
buffer.append(16);
|
||||
buffer.append("pt;margin:3px 3px 3px 3px;color: #FFFFFF'><b><center>");
|
||||
|
||||
text = text.replaceAll("#([^#]+)#", "<i>$1</i>");
|
||||
// Don't know what it does (easy italc?) but it bugs with multiple #HTML color codes (LevelX2)
|
||||
//text = text.replaceAll("#([^#]+)#", "<i>$1</i>");
|
||||
//text = text.replaceAll("\\s*//\\s*", "<hr width='50%'>");
|
||||
text = text.replace("\r\n", "<div style='font-size:5pt'></div>");
|
||||
|
||||
final String basicText = ManaSymbols.replaceSymbolsWithHTML(text, ManaSymbols.Type.PAY);
|
||||
if (text.length() > 0) {
|
||||
buffer.append(ManaSymbols.replaceSymbolsWithHTML(text, ManaSymbols.Type.PAY));
|
||||
buffer.append(basicText);
|
||||
}
|
||||
|
||||
buffer.append("</b></center></body></html>");
|
||||
|
||||
SwingUtilities.invokeLater(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
MageTextArea.super.setText(buffer.toString());
|
||||
//System.out.println(buffer.toString());
|
||||
String promptText = buffer.toString();
|
||||
MageTextArea.super.setText(promptText);
|
||||
// in case the text don't fit in the panel a tooltip with the text is added
|
||||
if (panelWidth > 0 && MageTextArea.this.getPreferredSize().getWidth() > panelWidth) {
|
||||
// String tooltip = promptText
|
||||
// .replace("color: #FFFFFF'>", "color: #111111'><p width='400'>")
|
||||
// .replace("</body>", "</p></body>");
|
||||
String tooltip = "<html><center><body style='font-family:Dialog;font-size:14;color: #FFFFFF'><p width='500'>" + basicText + "</p></body></html>";
|
||||
MageTextArea.super.setToolTipText(tooltip);
|
||||
} else {
|
||||
MageTextArea.super.setToolTipText(null);
|
||||
}
|
||||
setCaretPosition(0);
|
||||
}
|
||||
});
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ import java.util.UUID;
|
|||
public class DialogManager extends JComponent implements MouseListener,
|
||||
MouseMotionListener {
|
||||
|
||||
private final static Map<UUID, DialogManager> dialogManagers = new HashMap<UUID, DialogManager>();
|
||||
private final static Map<UUID, DialogManager> dialogManagers = new HashMap<>();
|
||||
|
||||
public static DialogManager getManager(UUID gameId) {
|
||||
if (!dialogManagers.containsKey(gameId)) {
|
||||
|
|
|
|||
|
|
@ -1,30 +1,30 @@
|
|||
/*
|
||||
* Copyright 2011 BetaSteward_at_googlemail.com. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification, are
|
||||
* permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice, this list of
|
||||
* conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
|
||||
* of conditions and the following disclaimer in the documentation and/or other materials
|
||||
* provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
||||
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* The views and conclusions contained in the software and documentation are those of the
|
||||
* authors and should not be interpreted as representing official policies, either expressed
|
||||
* or implied, of BetaSteward_at_googlemail.com.
|
||||
*/
|
||||
* Copyright 2011 BetaSteward_at_googlemail.com. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification, are
|
||||
* permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice, this list of
|
||||
* conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
|
||||
* of conditions and the following disclaimer in the documentation and/or other materials
|
||||
* provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
||||
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* The views and conclusions contained in the software and documentation are those of the
|
||||
* authors and should not be interpreted as representing official policies, either expressed
|
||||
* or implied, of BetaSteward_at_googlemail.com.
|
||||
*/
|
||||
package mage.client.dialog;
|
||||
|
||||
import java.util.HashSet;
|
||||
|
|
@ -46,6 +46,7 @@ import mage.cards.repository.ExpansionRepository;
|
|||
import mage.client.MageFrame;
|
||||
import mage.client.constants.Constants.DeckEditorMode;
|
||||
import mage.constants.Rarity;
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
/**
|
||||
*
|
||||
|
|
@ -53,12 +54,16 @@ import mage.constants.Rarity;
|
|||
*/
|
||||
public class AddLandDialog extends MageDialog {
|
||||
|
||||
private static final Logger logger = Logger.getLogger(MageDialog.class);
|
||||
|
||||
private Deck deck;
|
||||
private final Set<String> setCodesland = new HashSet<>();
|
||||
|
||||
|
||||
private static final int DEFAULT_SEALED_DECK_CARD_NUMBER = 40;
|
||||
|
||||
/** Creates new form AddLandDialog */
|
||||
/**
|
||||
* Creates new form AddLandDialog
|
||||
*/
|
||||
public AddLandDialog() {
|
||||
initComponents();
|
||||
this.setModal(true);
|
||||
|
|
@ -69,7 +74,7 @@ public class AddLandDialog extends MageDialog {
|
|||
SortedSet<String> landSets = new TreeSet<>();
|
||||
if (!mode.equals(DeckEditorMode.FREE_BUILDING)) {
|
||||
// decide from which sets basic lands are taken from
|
||||
for (String setCode :deck.getExpansionSetCodes()) {
|
||||
for (String setCode : deck.getExpansionSetCodes()) {
|
||||
ExpansionInfo expansionInfo = ExpansionRepository.instance.getSetByCode(setCode);
|
||||
if (expansionInfo != null && expansionInfo.hasBasicLands()) {
|
||||
this.setCodesland.add(expansionInfo.getCode());
|
||||
|
|
@ -79,11 +84,11 @@ public class AddLandDialog extends MageDialog {
|
|||
|
||||
// if sets have no basic land, take land from block
|
||||
if (this.setCodesland.isEmpty()) {
|
||||
for (String setCode :deck.getExpansionSetCodes()) {
|
||||
for (String setCode : deck.getExpansionSetCodes()) {
|
||||
ExpansionInfo expansionInfo = ExpansionRepository.instance.getSetByCode(setCode);
|
||||
if (expansionInfo != null) {
|
||||
List<ExpansionInfo> blockSets = ExpansionRepository.instance.getSetsFromBlock(expansionInfo.getBlockName());
|
||||
for (ExpansionInfo blockSet: blockSets) {
|
||||
for (ExpansionInfo blockSet : blockSets) {
|
||||
if (blockSet.hasBasicLands()) {
|
||||
this.setCodesland.add(blockSet.getCode());
|
||||
landSets.add(blockSet.getName());
|
||||
|
|
@ -92,22 +97,22 @@ public class AddLandDialog extends MageDialog {
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// if still no set with lands found, add list of all available
|
||||
if (this.setCodesland.isEmpty()) {
|
||||
List<ExpansionInfo> basicLandSets = ExpansionRepository.instance.getSetsWithBasicLandsByReleaseDate();
|
||||
for (ExpansionInfo expansionInfo: basicLandSets) {
|
||||
for (ExpansionInfo expansionInfo : basicLandSets) {
|
||||
landSets.add(expansionInfo.getName());
|
||||
}
|
||||
}
|
||||
}
|
||||
if (landSets.isEmpty()) {
|
||||
throw new IllegalArgumentException("No set with basic land was found");
|
||||
}
|
||||
if(landSets.size() > 1) {
|
||||
if (landSets.size() > 1) {
|
||||
landSets.add("<Random lands>");
|
||||
}
|
||||
cbLandSet.setModel(new DefaultComboBoxModel(landSets.toArray()));
|
||||
|
||||
|
||||
MageFrame.getDesktop().add(this, JLayeredPane.PALETTE_LAYER);
|
||||
this.setVisible(true);
|
||||
}
|
||||
|
|
@ -115,7 +120,7 @@ public class AddLandDialog extends MageDialog {
|
|||
private void addLands(String landName, int number) {
|
||||
Random random = new Random();
|
||||
String landSetName = (String) cbLandSet.getSelectedItem();
|
||||
|
||||
|
||||
CardCriteria criteria = new CardCriteria();
|
||||
if (landSetName.equals("<Random lands>")) {
|
||||
criteria.setCodes(setCodesland.toArray(new String[setCodesland.size()]));
|
||||
|
|
@ -123,13 +128,17 @@ public class AddLandDialog extends MageDialog {
|
|||
ExpansionInfo expansionInfo = ExpansionRepository.instance.getSetByName(landSetName);
|
||||
if (expansionInfo == null) {
|
||||
throw new IllegalArgumentException("Code of Set " + landSetName + " not found");
|
||||
}
|
||||
criteria.setCodes(expansionInfo.getCode());
|
||||
}
|
||||
}
|
||||
criteria.setCodes(expansionInfo.getCode());
|
||||
}
|
||||
criteria.rarities(Rarity.LAND).name(landName);
|
||||
List<CardInfo> cards = CardRepository.instance.findCards(criteria);
|
||||
if (cards.isEmpty()) {
|
||||
throw new IllegalArgumentException("No basic lands found in Set: " + landSetName);
|
||||
logger.error("No basic lands found in Set: " + landSetName);
|
||||
criteria = new CardCriteria();
|
||||
criteria.rarities(Rarity.LAND).name(landName);
|
||||
criteria.setCodes("M15");
|
||||
cards = CardRepository.instance.findCards(criteria);
|
||||
}
|
||||
|
||||
for (int i = 0; i < number; i++) {
|
||||
|
|
@ -138,10 +147,10 @@ public class AddLandDialog extends MageDialog {
|
|||
}
|
||||
}
|
||||
|
||||
/** This method is called from within the constructor to
|
||||
* initialize the form.
|
||||
* WARNING: Do NOT modify this code. The content of this method is
|
||||
* always regenerated by the Form Editor.
|
||||
/**
|
||||
* This method is called from within the constructor to initialize the form.
|
||||
* WARNING: Do NOT modify this code. The content of this method is always
|
||||
* regenerated by the Form Editor.
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
|
||||
|
|
@ -298,11 +307,11 @@ public class AddLandDialog extends MageDialog {
|
|||
}//GEN-LAST:event_btnCancelActionPerformed
|
||||
|
||||
private void btnAddActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnAddActionPerformed
|
||||
int nForest = ((Number)spnForest.getValue()).intValue();
|
||||
int nIsland = ((Number)spnIsland.getValue()).intValue();
|
||||
int nMountain = ((Number)spnMountain.getValue()).intValue();
|
||||
int nPlains = ((Number)spnPlains.getValue()).intValue();
|
||||
int nSwamp = ((Number)spnSwamp.getValue()).intValue();
|
||||
int nForest = ((Number) spnForest.getValue()).intValue();
|
||||
int nIsland = ((Number) spnIsland.getValue()).intValue();
|
||||
int nMountain = ((Number) spnMountain.getValue()).intValue();
|
||||
int nPlains = ((Number) spnPlains.getValue()).intValue();
|
||||
int nSwamp = ((Number) spnSwamp.getValue()).intValue();
|
||||
|
||||
addLands("Forest", nForest);
|
||||
addLands("Island", nIsland);
|
||||
|
|
@ -316,7 +325,7 @@ public class AddLandDialog extends MageDialog {
|
|||
autoAddLands();
|
||||
}//GEN-LAST:event_btnAutoAddActionPerformed
|
||||
|
||||
private void autoAddLands(){
|
||||
private void autoAddLands() {
|
||||
int red = 0;
|
||||
int green = 0;
|
||||
int black = 0;
|
||||
|
|
@ -324,7 +333,9 @@ public class AddLandDialog extends MageDialog {
|
|||
int white = 0;
|
||||
Set<Card> cards = deck.getCards();
|
||||
int land_number = DEFAULT_SEALED_DECK_CARD_NUMBER - cards.size();
|
||||
if(land_number < 0) land_number = 0;
|
||||
if (land_number < 0) {
|
||||
land_number = 0;
|
||||
}
|
||||
for (Card cd : cards) {
|
||||
Mana m = cd.getManaCost().getMana();
|
||||
red += m.getRed();
|
||||
|
|
@ -334,14 +345,18 @@ public class AddLandDialog extends MageDialog {
|
|||
white += m.getWhite();
|
||||
}
|
||||
int total = red + green + black + blue + white;
|
||||
int redcards = Math.round(land_number*((float)red/(float)total));
|
||||
total -= red; land_number -= redcards;
|
||||
int greencards = Math.round(land_number*((float)green/(float)total));
|
||||
total -= green; land_number -= greencards;
|
||||
int blackcards = Math.round(land_number*((float)black/(float)total));
|
||||
total -= black; land_number -= blackcards;
|
||||
int bluecards = Math.round(land_number*((float)blue/(float)total));
|
||||
total -= blue; land_number -= bluecards;
|
||||
int redcards = Math.round(land_number * ((float) red / (float) total));
|
||||
total -= red;
|
||||
land_number -= redcards;
|
||||
int greencards = Math.round(land_number * ((float) green / (float) total));
|
||||
total -= green;
|
||||
land_number -= greencards;
|
||||
int blackcards = Math.round(land_number * ((float) black / (float) total));
|
||||
total -= black;
|
||||
land_number -= blackcards;
|
||||
int bluecards = Math.round(land_number * ((float) blue / (float) total));
|
||||
total -= blue;
|
||||
land_number -= bluecards;
|
||||
int whitecards = land_number;
|
||||
spnMountain.setValue(redcards);
|
||||
spnForest.setValue(greencards);
|
||||
|
|
@ -349,7 +364,7 @@ public class AddLandDialog extends MageDialog {
|
|||
spnIsland.setValue(bluecards);
|
||||
spnPlains.setValue(whitecards);
|
||||
}
|
||||
|
||||
|
||||
// Variables declaration - do not modify//GEN-BEGIN:variables
|
||||
private javax.swing.JButton btnAdd;
|
||||
private javax.swing.JButton btnAutoAdd;
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@
|
|||
<Layout>
|
||||
<DimensionLayout dim="0">
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Component id="cards" alignment="1" pref="418" max="32767" attributes="0"/>
|
||||
<Component id="cards" alignment="1" pref="239" max="32767" attributes="0"/>
|
||||
</Group>
|
||||
</DimensionLayout>
|
||||
<DimensionLayout dim="1">
|
||||
|
|
@ -0,0 +1,217 @@
|
|||
/*
|
||||
* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification, are
|
||||
* permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice, this list of
|
||||
* conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
|
||||
* of conditions and the following disclaimer in the documentation and/or other materials
|
||||
* provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
||||
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* The views and conclusions contained in the software and documentation are those of the
|
||||
* authors and should not be interpreted as representing official policies, either expressed
|
||||
* or implied, of BetaSteward_at_googlemail.com.
|
||||
*/
|
||||
|
||||
/*
|
||||
* CardInfoWindowDialog.java
|
||||
*
|
||||
* Created on Feb 1, 2010, 3:00:35 PM
|
||||
*/
|
||||
package mage.client.dialog;
|
||||
|
||||
import java.awt.Point;
|
||||
import java.beans.PropertyVetoException;
|
||||
import java.util.UUID;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
import javax.swing.ImageIcon;
|
||||
import javax.swing.SwingUtilities;
|
||||
import javax.swing.event.InternalFrameAdapter;
|
||||
import javax.swing.event.InternalFrameEvent;
|
||||
import mage.client.cards.BigCard;
|
||||
import mage.client.util.Config;
|
||||
import mage.client.util.ImageHelper;
|
||||
import mage.client.util.SettingsManager;
|
||||
import mage.client.util.gui.GuiDisplayUtil;
|
||||
import mage.view.CardsView;
|
||||
import mage.view.ExileView;
|
||||
import mage.view.SimpleCardsView;
|
||||
import org.mage.plugins.card.utils.impl.ImageManagerImpl;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author BetaSteward_at_googlemail.com
|
||||
*/
|
||||
public class CardInfoWindowDialog extends MageDialog {
|
||||
|
||||
public static enum ShowType {
|
||||
|
||||
REVEAL, REVEAL_TOP_LIBRARY, LOOKED_AT, EXILE, GRAVEYARD, OTHER
|
||||
};
|
||||
|
||||
private ShowType showType;
|
||||
private boolean positioned;
|
||||
private String name;
|
||||
|
||||
public CardInfoWindowDialog(ShowType showType, String name) {
|
||||
this.name = name;
|
||||
this.title = name;
|
||||
this.showType = showType;
|
||||
this.positioned = false;
|
||||
initComponents();
|
||||
|
||||
this.setModal(false);
|
||||
switch (this.showType) {
|
||||
case LOOKED_AT:
|
||||
this.setFrameIcon(new ImageIcon(ImageManagerImpl.getInstance().getLookedAtImage()));
|
||||
this.setClosable(true);
|
||||
break;
|
||||
case REVEAL:
|
||||
this.setFrameIcon(new ImageIcon(ImageManagerImpl.getInstance().getRevealedImage()));
|
||||
this.setClosable(true);
|
||||
break;
|
||||
case REVEAL_TOP_LIBRARY:
|
||||
this.setFrameIcon(new ImageIcon(ImageHelper.getImageFromResources("/info/library.png")));
|
||||
this.setClosable(true);
|
||||
break;
|
||||
case GRAVEYARD:
|
||||
this.setFrameIcon(new ImageIcon(ImageHelper.getImageFromResources("/info/grave.png")));
|
||||
this.setClosable(true);
|
||||
this.setDefaultCloseOperation(HIDE_ON_CLOSE);
|
||||
addInternalFrameListener(new InternalFrameAdapter() {
|
||||
@Override
|
||||
public void internalFrameClosing(InternalFrameEvent e) {
|
||||
CardInfoWindowDialog.this.hideDialog();
|
||||
}
|
||||
});
|
||||
break;
|
||||
case EXILE:
|
||||
this.setFrameIcon(new ImageIcon(ImageManagerImpl.getInstance().getExileImage()));
|
||||
break;
|
||||
default:
|
||||
// no icon yet
|
||||
}
|
||||
this.setTitelBarToolTip(name);
|
||||
}
|
||||
|
||||
public void cleanUp() {
|
||||
cards.cleanUp();
|
||||
}
|
||||
|
||||
public void loadCards(ExileView exile, BigCard bigCard, UUID gameId) {
|
||||
boolean changed = cards.loadCards(exile, bigCard, gameId, null);
|
||||
String titel = name + " (" + exile.size() + ")";
|
||||
setTitle(titel);
|
||||
this.setTitelBarToolTip(titel);
|
||||
if (exile.size() > 0) {
|
||||
show();
|
||||
if (changed) {
|
||||
try {
|
||||
this.setIcon(false);
|
||||
} catch (PropertyVetoException ex) {
|
||||
Logger.getLogger(CardInfoWindowDialog.class.getName()).log(Level.SEVERE, null, ex);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
this.hideDialog();
|
||||
}
|
||||
}
|
||||
|
||||
public void loadCards(SimpleCardsView showCards, BigCard bigCard, UUID gameId) {
|
||||
cards.loadCards(showCards, bigCard, gameId);
|
||||
showAndPositionWindow();
|
||||
}
|
||||
|
||||
public void loadCards(CardsView showCards, BigCard bigCard, UUID gameId) {
|
||||
cards.loadCards(showCards, bigCard, gameId, null);
|
||||
if (showType.equals(ShowType.GRAVEYARD)) {
|
||||
String titel = name + "'s Graveyard (" + showCards.size() + ")";
|
||||
setTitle(titel);
|
||||
this.setTitelBarToolTip(titel);
|
||||
}
|
||||
showAndPositionWindow();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void show() {
|
||||
if (showType.equals(ShowType.EXILE)) {
|
||||
if (cards == null || cards.getNumberOfCards() == 0) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
super.show();
|
||||
if (positioned) { // check if in frame rectangle
|
||||
showAndPositionWindow();
|
||||
}
|
||||
}
|
||||
|
||||
private void showAndPositionWindow() {
|
||||
SwingUtilities.invokeLater(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
int width = CardInfoWindowDialog.this.getWidth();
|
||||
int height = CardInfoWindowDialog.this.getHeight();
|
||||
if (width > 0 && height > 0) {
|
||||
Point centered = SettingsManager.getInstance().getComponentPosition(width, height);
|
||||
if (!positioned) {
|
||||
int xPos = centered.x / 2;
|
||||
int yPos = centered.y / 2;
|
||||
CardInfoWindowDialog.this.setLocation(xPos, yPos);
|
||||
show();
|
||||
positioned = true;
|
||||
}
|
||||
GuiDisplayUtil.keepComponentInsideFrame(centered.x, centered.y, CardInfoWindowDialog.this);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* This method is called from within the constructor to initialize the form.
|
||||
* WARNING: Do NOT modify this code. The content of this method is always
|
||||
* regenerated by the Form Editor.
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
|
||||
private void initComponents() {
|
||||
|
||||
cards = new mage.client.cards.Cards();
|
||||
|
||||
setIconifiable(true);
|
||||
setResizable(true);
|
||||
|
||||
cards.setPreferredSize(new java.awt.Dimension(Config.dimensions.frameWidth, Config.dimensions.frameHeight + 25));
|
||||
|
||||
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
|
||||
getContentPane().setLayout(layout);
|
||||
layout.setHorizontalGroup(
|
||||
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addComponent(cards, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 239, Short.MAX_VALUE)
|
||||
);
|
||||
layout.setVerticalGroup(
|
||||
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addComponent(cards, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
);
|
||||
|
||||
pack();
|
||||
}// </editor-fold>//GEN-END:initComponents
|
||||
|
||||
// Variables declaration - do not modify//GEN-BEGIN:variables
|
||||
private mage.client.cards.Cards cards;
|
||||
// End of variables declaration//GEN-END:variables
|
||||
|
||||
}
|
||||
|
|
@ -432,7 +432,7 @@ public class ConnectDialog extends MageDialog {
|
|||
BufferedReader in = null;
|
||||
try {
|
||||
|
||||
URL serverListURL = new URL(PreferencesDialog.getCachedValue(PreferencesDialog.KEY_CONNECTION_URL_SERVER_LIST, "http://176.31.186.181/files/server-list.txt"));
|
||||
URL serverListURL = new URL(PreferencesDialog.getCachedValue(PreferencesDialog.KEY_CONNECTION_URL_SERVER_LIST, "http://xmage.de/files/server-list.txt"));
|
||||
|
||||
Connection.ProxyType configProxyType = Connection.ProxyType.valueByText(PreferencesDialog.getCachedValue(PreferencesDialog.KEY_PROXY_TYPE, "None"));
|
||||
Proxy p = null;
|
||||
|
|
|
|||
|
|
@ -1,117 +0,0 @@
|
|||
/*
|
||||
* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification, are
|
||||
* permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice, this list of
|
||||
* conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
|
||||
* of conditions and the following disclaimer in the documentation and/or other materials
|
||||
* provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
||||
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* The views and conclusions contained in the software and documentation are those of the
|
||||
* authors and should not be interpreted as representing official policies, either expressed
|
||||
* or implied, of BetaSteward_at_googlemail.com.
|
||||
*/
|
||||
|
||||
/*
|
||||
* ExileZoneDialog.java
|
||||
*
|
||||
* Created on Feb 1, 2010, 3:00:35 PM
|
||||
*/
|
||||
|
||||
package mage.client.dialog;
|
||||
|
||||
import java.beans.PropertyVetoException;
|
||||
import java.util.UUID;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
import static javax.swing.WindowConstants.DISPOSE_ON_CLOSE;
|
||||
import mage.client.cards.BigCard;
|
||||
import mage.client.util.Config;
|
||||
import mage.view.ExileView;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author BetaSteward_at_googlemail.com
|
||||
*/
|
||||
public class ExileZoneDialog extends MageDialog {
|
||||
|
||||
/** Creates new form ExileZoneDialog */
|
||||
public ExileZoneDialog() {
|
||||
this.setDefaultCloseOperation(DISPOSE_ON_CLOSE);
|
||||
initComponents();
|
||||
this.setModal(false);
|
||||
}
|
||||
|
||||
public void cleanUp() {
|
||||
cards.cleanUp();
|
||||
}
|
||||
|
||||
public void loadCards(ExileView exile, BigCard bigCard, UUID gameId) {
|
||||
this.title = exile.getName();
|
||||
this.setTitelBarToolTip(exile.getName());
|
||||
boolean changed = cards.loadCards(exile, bigCard, gameId, null);
|
||||
if (exile.size() > 0) {
|
||||
show();
|
||||
if (changed) {
|
||||
try {
|
||||
this.setIcon(false);
|
||||
} catch (PropertyVetoException ex) {
|
||||
Logger.getLogger(ExileZoneDialog.class.getName()).log(Level.SEVERE, null, ex);
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
this.hideDialog();
|
||||
}
|
||||
}
|
||||
|
||||
/** This method is called from within the constructor to
|
||||
* initialize the form.
|
||||
* WARNING: Do NOT modify this code. The content of this method is
|
||||
* always regenerated by the Form Editor.
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
|
||||
private void initComponents() {
|
||||
|
||||
cards = new mage.client.cards.Cards();
|
||||
|
||||
setIconifiable(true);
|
||||
setResizable(true);
|
||||
|
||||
cards.setPreferredSize(new java.awt.Dimension(Config.dimensions.frameWidth, Config.dimensions.frameHeight + 25));
|
||||
|
||||
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
|
||||
getContentPane().setLayout(layout);
|
||||
layout.setHorizontalGroup(
|
||||
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addComponent(cards, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 418, Short.MAX_VALUE)
|
||||
);
|
||||
layout.setVerticalGroup(
|
||||
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addComponent(cards, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
);
|
||||
|
||||
pack();
|
||||
}// </editor-fold>//GEN-END:initComponents
|
||||
|
||||
|
||||
// Variables declaration - do not modify//GEN-BEGIN:variables
|
||||
private mage.client.cards.Cards cards;
|
||||
// End of variables declaration//GEN-END:variables
|
||||
|
||||
}
|
||||
|
|
@ -118,6 +118,7 @@
|
|||
</Group>
|
||||
</Group>
|
||||
<Component id="player1Panel" alignment="0" max="32767" attributes="0"/>
|
||||
<Component id="pnlRandomPacks" alignment="1" max="32767" attributes="0"/>
|
||||
</Group>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
</Group>
|
||||
|
|
@ -168,6 +169,8 @@
|
|||
<Group type="102" attributes="0">
|
||||
<Component id="pnlPacks" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="pnlRandomPacks" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Group type="103" groupAlignment="1" max="-2" attributes="0">
|
||||
<Group type="103" alignment="1" groupAlignment="3" attributes="0">
|
||||
<Component id="cbAllowSpectators" alignment="3" max="32767" attributes="0"/>
|
||||
|
|
@ -188,7 +191,7 @@
|
|||
</Group>
|
||||
</Group>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="player1Panel" pref="64" max="32767" attributes="0"/>
|
||||
<Component id="player1Panel" pref="61" max="32767" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="pnlPlayers" max="32767" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
|
|
@ -470,7 +473,7 @@
|
|||
</DimensionLayout>
|
||||
<DimensionLayout dim="1">
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Component id="pnlOtherPlayers" alignment="0" pref="7" max="32767" attributes="0"/>
|
||||
<Component id="pnlOtherPlayers" alignment="0" max="32767" attributes="0"/>
|
||||
</Group>
|
||||
</DimensionLayout>
|
||||
</Layout>
|
||||
|
|
@ -508,5 +511,21 @@
|
|||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="btnCancelActionPerformed"/>
|
||||
</Events>
|
||||
</Component>
|
||||
<Container class="javax.swing.JPanel" name="pnlRandomPacks">
|
||||
<Properties>
|
||||
<Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
|
||||
<Border info="org.netbeans.modules.form.compat2.border.EtchedBorderInfo">
|
||||
<EtchetBorder/>
|
||||
</Border>
|
||||
</Property>
|
||||
<Property name="toolTipText" type="java.lang.String" value=""/>
|
||||
</Properties>
|
||||
|
||||
<Layout class="org.netbeans.modules.form.compat2.layouts.DesignGridLayout">
|
||||
<Property name="columns" type="int" value="1"/>
|
||||
<Property name="horizontalGap" type="int" value="2"/>
|
||||
<Property name="rows" type="int" value="0"/>
|
||||
</Layout>
|
||||
</Container>
|
||||
</SubComponents>
|
||||
</Form>
|
||||
|
|
|
|||
|
|
@ -35,12 +35,15 @@
|
|||
package mage.client.dialog;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
import javax.swing.ComboBoxModel;
|
||||
import javax.swing.DefaultComboBoxModel;
|
||||
import javax.swing.JButton;
|
||||
import javax.swing.JComboBox;
|
||||
import javax.swing.JOptionPane;
|
||||
import javax.swing.JTextArea;
|
||||
import javax.swing.SpinnerNumberModel;
|
||||
import mage.cards.decks.importer.DeckImporterUtil;
|
||||
import mage.cards.repository.ExpansionInfo;
|
||||
|
|
@ -76,6 +79,8 @@ public class NewTournamentDialog extends MageDialog {
|
|||
private UUID roomId;
|
||||
private final Client client;
|
||||
private String lastSessionId;
|
||||
private RandomPacksSelectorDialog randomPackSelector;
|
||||
private JTextArea txtRandomPacks;
|
||||
private final List<TournamentPlayerPanel> players = new ArrayList<>();
|
||||
private final List<JComboBox> packs = new ArrayList<>();
|
||||
private final int CONSTRUCTION_TIME_MIN = 6;
|
||||
|
|
@ -171,6 +176,7 @@ public class NewTournamentDialog extends MageDialog {
|
|||
pnlOtherPlayers = new javax.swing.JPanel();
|
||||
btnOk = new javax.swing.JButton();
|
||||
btnCancel = new javax.swing.JButton();
|
||||
pnlRandomPacks = new javax.swing.JPanel();
|
||||
|
||||
setTitle("New Tournament");
|
||||
|
||||
|
|
@ -316,7 +322,7 @@ public class NewTournamentDialog extends MageDialog {
|
|||
);
|
||||
pnlPlayersLayout.setVerticalGroup(
|
||||
pnlPlayersLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addComponent(pnlOtherPlayers, javax.swing.GroupLayout.DEFAULT_SIZE, 7, Short.MAX_VALUE)
|
||||
.addComponent(pnlOtherPlayers, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||
);
|
||||
|
||||
btnOk.setText("OK");
|
||||
|
|
@ -333,6 +339,10 @@ public class NewTournamentDialog extends MageDialog {
|
|||
}
|
||||
});
|
||||
|
||||
pnlRandomPacks.setBorder(javax.swing.BorderFactory.createEtchedBorder());
|
||||
pnlRandomPacks.setToolTipText("");
|
||||
pnlRandomPacks.setLayout(new java.awt.GridLayout(0, 1, 2, 0));
|
||||
|
||||
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
|
||||
getContentPane().setLayout(layout);
|
||||
layout.setHorizontalGroup(
|
||||
|
|
@ -414,7 +424,8 @@ public class NewTournamentDialog extends MageDialog {
|
|||
.addComponent(lblPassword)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(txtPassword, javax.swing.GroupLayout.PREFERRED_SIZE, 56, javax.swing.GroupLayout.PREFERRED_SIZE)))))
|
||||
.addComponent(player1Panel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
|
||||
.addComponent(player1Panel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||
.addComponent(pnlRandomPacks, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
|
||||
.addContainerGap())
|
||||
);
|
||||
layout.setVerticalGroup(
|
||||
|
|
@ -457,6 +468,8 @@ public class NewTournamentDialog extends MageDialog {
|
|||
.addGroup(layout.createSequentialGroup()
|
||||
.addComponent(pnlPacks, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(pnlRandomPacks, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
||||
.addComponent(cbAllowSpectators, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||
|
|
@ -464,7 +477,7 @@ public class NewTournamentDialog extends MageDialog {
|
|||
.addComponent(lblNumRounds))
|
||||
.addComponent(lblNbrPlayers, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||
.addComponent(spnNumPlayers)
|
||||
.addComponent(pnlDraftOptions, javax.swing.GroupLayout.PREFERRED_SIZE, 0, Short.MAX_VALUE))
|
||||
.addComponent(pnlDraftOptions, javax.swing.GroupLayout.DEFAULT_SIZE, 0, Short.MAX_VALUE))
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(lblPlayer1, javax.swing.GroupLayout.PREFERRED_SIZE, 25, javax.swing.GroupLayout.PREFERRED_SIZE))
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
||||
|
|
@ -472,7 +485,7 @@ public class NewTournamentDialog extends MageDialog {
|
|||
.addComponent(lblConstructionTime)
|
||||
.addComponent(chkRollbackTurnsAllowed)))
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(player1Panel, javax.swing.GroupLayout.DEFAULT_SIZE, 64, Short.MAX_VALUE)
|
||||
.addComponent(player1Panel, javax.swing.GroupLayout.DEFAULT_SIZE, 61, Short.MAX_VALUE)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(pnlPlayers, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
|
|
@ -515,8 +528,12 @@ public class NewTournamentDialog extends MageDialog {
|
|||
}
|
||||
if (tournamentType.isLimited()) {
|
||||
tOptions.getLimitedOptions().setConstructionTime((Integer)this.spnConstructTime.getValue() * 60);
|
||||
tOptions.getLimitedOptions().setIsRandom(tournamentType.isRandom());
|
||||
if (tournamentType.isCubeBooster()) {
|
||||
tOptions.getLimitedOptions().setDraftCubeName(this.cbDraftCube.getSelectedItem().toString());
|
||||
} else if (tournamentType.isRandom()) {
|
||||
tOptions.getLimitedOptions().getSetCodes().clear();
|
||||
tOptions.getLimitedOptions().getSetCodes().addAll(randomPackSelector.getSelectedPacks());
|
||||
} else {
|
||||
for (JComboBox pack: packs) {
|
||||
tOptions.getLimitedOptions().getSetCodes().add(((ExpansionInfo) pack.getSelectedItem()).getCode());
|
||||
|
|
@ -629,7 +646,11 @@ public class NewTournamentDialog extends MageDialog {
|
|||
createPlayers((Integer) spnNumPlayers.getValue() - 1);
|
||||
|
||||
if (tournamentType.isLimited()) {
|
||||
createPacks(tournamentType.getNumBoosters());
|
||||
if (tournamentType.isRandom()){
|
||||
createRandomPacks();
|
||||
}else{
|
||||
createPacks(tournamentType.getNumBoosters());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -668,11 +689,19 @@ public class NewTournamentDialog extends MageDialog {
|
|||
this.cbDraftCube.setVisible(true);
|
||||
this.lblPacks.setVisible(false);
|
||||
this.pnlPacks.setVisible(false);
|
||||
this.pnlRandomPacks.setVisible(false);
|
||||
} else if (tournamentType.isRandom()){
|
||||
this.lblDraftCube.setVisible(false);
|
||||
this.cbDraftCube.setVisible(false);
|
||||
this.lblPacks.setVisible(true);
|
||||
this.pnlRandomPacks.setVisible(true);
|
||||
this.pnlPacks.setVisible(false);
|
||||
} else {
|
||||
this.lblDraftCube.setVisible(false);
|
||||
this.cbDraftCube.setVisible(false);
|
||||
this.lblPacks.setVisible(true);
|
||||
this.pnlPacks.setVisible(true);
|
||||
this.pnlRandomPacks.setVisible(false);
|
||||
}
|
||||
} else {
|
||||
// construced
|
||||
|
|
@ -680,9 +709,65 @@ public class NewTournamentDialog extends MageDialog {
|
|||
this.cbDraftCube.setVisible(false);
|
||||
this.pnlPacks.setVisible(false);
|
||||
this.pnlPacks.setVisible(false);
|
||||
this.pnlRandomPacks.setVisible(false);
|
||||
}
|
||||
}
|
||||
|
||||
private void createRandomPacks() {
|
||||
if (pnlRandomPacks.getComponentCount() == 0) {
|
||||
if (randomPackSelector == null) {
|
||||
randomPackSelector = new RandomPacksSelectorDialog();
|
||||
}
|
||||
txtRandomPacks = new JTextArea();
|
||||
txtRandomPacks.setEnabled(false);
|
||||
txtRandomPacks.setLineWrap(true);
|
||||
String randomPrefs = PreferencesDialog.getCachedValue(PreferencesDialog.KEY_NEW_TOURNAMENT_PACKS_RANDOM_DRAFT, "");
|
||||
if (randomPrefs.length() > 0) {
|
||||
txtRandomPacks.setText(randomPrefs);
|
||||
ArrayList<String> theList = new ArrayList<>();
|
||||
theList.addAll(Arrays.asList(randomPrefs.split(";")));
|
||||
randomPackSelector.setSelectedPacks(theList);
|
||||
} else {
|
||||
ExpansionInfo[] allExpansions = ExpansionRepository.instance.getWithBoostersSortedByReleaseDate();
|
||||
StringBuilder packList = new StringBuilder();
|
||||
for (ExpansionInfo exp : allExpansions) {
|
||||
packList.append(exp.getCode());
|
||||
packList.append(";");
|
||||
}
|
||||
txtRandomPacks.setText(packList.toString());
|
||||
}
|
||||
|
||||
pnlRandomPacks.add(txtRandomPacks);
|
||||
JButton btnSelectRandomPacks = new JButton();
|
||||
btnSelectRandomPacks.setText("Select packs to be included in the pool");
|
||||
btnSelectRandomPacks.setToolTipText(RandomPacksSelectorDialog.randomDraftDescription);
|
||||
btnSelectRandomPacks.addActionListener(new java.awt.event.ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||
showRandomPackSelectorDialog();
|
||||
|
||||
}
|
||||
});
|
||||
pnlRandomPacks.add(btnSelectRandomPacks);
|
||||
}
|
||||
this.pack();
|
||||
this.revalidate();
|
||||
this.repaint();
|
||||
}
|
||||
|
||||
private void showRandomPackSelectorDialog() {
|
||||
randomPackSelector.showDialog();
|
||||
StringBuilder packList = new StringBuilder();
|
||||
for (String str : randomPackSelector.getSelectedPacks()) {
|
||||
packList.append(str);
|
||||
packList.append(";");
|
||||
}
|
||||
this.txtRandomPacks.setText(packList.toString());
|
||||
this.pack();
|
||||
this.revalidate();
|
||||
this.repaint();
|
||||
}
|
||||
|
||||
private void createPacks(int numPacks) {
|
||||
while (packs.size() > numPacks) {
|
||||
pnlPacks.remove(packs.get(packs.size() - 1));
|
||||
|
|
@ -829,7 +914,9 @@ public class NewTournamentDialog extends MageDialog {
|
|||
if (tournamentType.isDraft()) {
|
||||
numPlayers = Integer.parseInt(PreferencesDialog.getCachedValue(PreferencesDialog.KEY_NEW_TOURNAMENT_PLAYERS_DRAFT, "4"));
|
||||
setTournamentOptions(numPlayers);
|
||||
loadBoosterPacks(PreferencesDialog.getCachedValue(PreferencesDialog.KEY_NEW_TOURNAMENT_PACKS_DRAFT, ""));
|
||||
if (!tournamentType.isRandom()){
|
||||
loadBoosterPacks(PreferencesDialog.getCachedValue(PreferencesDialog.KEY_NEW_TOURNAMENT_PACKS_DRAFT, ""));
|
||||
}
|
||||
|
||||
String draftTiming = PreferencesDialog.getCachedValue(PreferencesDialog.KEY_NEW_TOURNAMENT_DRAFT_TIMING, "REGULAR");
|
||||
for (TimingOption timingOption : DraftOptions.TimingOption.values()) {
|
||||
|
|
@ -896,12 +983,20 @@ public class NewTournamentDialog extends MageDialog {
|
|||
PreferencesDialog.saveValue(PreferencesDialog.KEY_NEW_TOURNAMENT_PLAYERS_DRAFT, Integer.toString(tOptions.getPlayerTypes().size()));
|
||||
PreferencesDialog.saveValue(PreferencesDialog.KEY_NEW_TOURNAMENT_DRAFT_TIMING, draftOptions.getTiming().name());
|
||||
}
|
||||
}
|
||||
if (tOptions.getTournamentType().startsWith("Booster")) {
|
||||
String deckFile = this.player1Panel.getDeckFile();
|
||||
if (deckFile != null && !deckFile.isEmpty()) {
|
||||
PreferencesDialog.saveValue(PreferencesDialog.KEY_NEW_TABLE_DECK_FILE, deckFile);
|
||||
}
|
||||
|
||||
if (tOptions.getLimitedOptions().getIsRandom()){
|
||||
// save random boosters to prefs
|
||||
StringBuilder packlist = new StringBuilder();
|
||||
for (String pack : this.randomPackSelector.getSelectedPacks()){
|
||||
packlist.append(pack);
|
||||
packlist.append(";");
|
||||
}
|
||||
PreferencesDialog.saveValue(PreferencesDialog.KEY_NEW_TOURNAMENT_PACKS_RANDOM_DRAFT, packlist.toString());
|
||||
}
|
||||
}
|
||||
PreferencesDialog.saveValue(PreferencesDialog.KEY_NEW_TOURNAMENT_ALLOW_SPECTATORS, (tOptions.isWatchingAllowed()?"Yes":"No"));
|
||||
PreferencesDialog.saveValue(PreferencesDialog.KEY_NEW_TOURNAMENT_ALLOW_ROLLBACKS, (tOptions.getMatchOptions().isRollbackTurnsAllowed()?"Yes":"No"));
|
||||
|
|
@ -946,6 +1041,7 @@ public class NewTournamentDialog extends MageDialog {
|
|||
private javax.swing.JPanel pnlOtherPlayers;
|
||||
private javax.swing.JPanel pnlPacks;
|
||||
private javax.swing.JPanel pnlPlayers;
|
||||
private javax.swing.JPanel pnlRandomPacks;
|
||||
private javax.swing.JSpinner spnConstructTime;
|
||||
private javax.swing.JSpinner spnFreeMulligans;
|
||||
private javax.swing.JSpinner spnNumPlayers;
|
||||
|
|
|
|||
|
|
@ -155,7 +155,7 @@
|
|||
<Component class="javax.swing.JCheckBox" name="showToolTipsInAnyZone">
|
||||
<Properties>
|
||||
<Property name="selected" type="boolean" value="true"/>
|
||||
<Property name="text" type="java.lang.String" value="Show card tooltips while hoovering with the mouse pointer over a card"/>
|
||||
<Property name="text" type="java.lang.String" value="Show card tooltips while hovering with the mouse pointer over a card"/>
|
||||
<Property name="toolTipText" type="java.lang.String" value=""/>
|
||||
<Property name="actionCommand" type="java.lang.String" value=""/>
|
||||
<Property name="cursor" type="java.awt.Cursor" editor="org.netbeans.modules.form.editors2.CursorEditor">
|
||||
|
|
@ -253,7 +253,7 @@
|
|||
<Properties>
|
||||
<Property name="selected" type="boolean" value="true"/>
|
||||
<Property name="text" type="java.lang.String" value="Show player names on avatar permanently"/>
|
||||
<Property name="toolTipText" type="java.lang.String" value="Instead showing the names only if you hoover over the avatar with the mouse, the name is shown all the time."/>
|
||||
<Property name="toolTipText" type="java.lang.String" value="Instead showing the names only if you hover over the avatar with the mouse, the name is shown all the time."/>
|
||||
<Property name="horizontalAlignment" type="int" value="2"/>
|
||||
</Properties>
|
||||
<Events>
|
||||
|
|
@ -1150,21 +1150,21 @@
|
|||
<Layout>
|
||||
<DimensionLayout dim="0">
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Component id="jScrollPane1" alignment="0" pref="590" max="32767" attributes="0"/>
|
||||
<Component id="avatarPane" alignment="0" pref="590" max="32767" attributes="0"/>
|
||||
</Group>
|
||||
</DimensionLayout>
|
||||
<DimensionLayout dim="1">
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Component id="jScrollPane1" alignment="0" pref="359" max="32767" attributes="0"/>
|
||||
<Component id="avatarPane" alignment="0" pref="359" max="32767" attributes="0"/>
|
||||
</Group>
|
||||
</DimensionLayout>
|
||||
</Layout>
|
||||
<SubComponents>
|
||||
<Container class="javax.swing.JScrollPane" name="jScrollPane1">
|
||||
<Container class="javax.swing.JScrollPane" name="avatarPane">
|
||||
|
||||
<Layout class="org.netbeans.modules.form.compat2.layouts.support.JScrollPaneSupportLayout"/>
|
||||
<SubComponents>
|
||||
<Container class="javax.swing.JPanel" name="jPanel9">
|
||||
<Container class="javax.swing.JPanel" name="avatarPanel">
|
||||
|
||||
<Layout>
|
||||
<DimensionLayout dim="0">
|
||||
|
|
@ -1256,6 +1256,14 @@
|
|||
</DimensionLayout>
|
||||
</Layout>
|
||||
<SubComponents>
|
||||
<Component class="javax.swing.JLabel" name="jLabel12">
|
||||
<Properties>
|
||||
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
|
||||
<Font name="Tahoma" size="11" style="1"/>
|
||||
</Property>
|
||||
<Property name="text" type="java.lang.String" value="Choose your avatar:"/>
|
||||
</Properties>
|
||||
</Component>
|
||||
<Container class="javax.swing.JPanel" name="jPanel10">
|
||||
<Properties>
|
||||
<Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
|
||||
|
|
@ -1328,14 +1336,6 @@
|
|||
</DimensionLayout>
|
||||
</Layout>
|
||||
</Container>
|
||||
<Component class="javax.swing.JLabel" name="jLabel12">
|
||||
<Properties>
|
||||
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
|
||||
<Font name="Tahoma" size="11" style="1"/>
|
||||
</Property>
|
||||
<Property name="text" type="java.lang.String" value="Choose your avatar:"/>
|
||||
</Properties>
|
||||
</Component>
|
||||
<Container class="javax.swing.JPanel" name="jPanel12">
|
||||
<Properties>
|
||||
<Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
|
||||
|
|
|
|||
|
|
@ -1,30 +1,30 @@
|
|||
/*
|
||||
* Copyright 2011 BetaSteward_at_googlemail.com. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification, are
|
||||
* permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice, this list of
|
||||
* conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
|
||||
* of conditions and the following disclaimer in the documentation and/or other materials
|
||||
* provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
||||
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* The views and conclusions contained in the software and documentation are those of the
|
||||
* authors and should not be interpreted as representing official policies, either expressed
|
||||
* or implied, of BetaSteward_at_googlemail.com.
|
||||
*/
|
||||
* Copyright 2011 BetaSteward_at_googlemail.com. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification, are
|
||||
* permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice, this list of
|
||||
* conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
|
||||
* of conditions and the following disclaimer in the documentation and/or other materials
|
||||
* provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
||||
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* The views and conclusions contained in the software and documentation are those of the
|
||||
* authors and should not be interpreted as representing official policies, either expressed
|
||||
* or implied, of BetaSteward_at_googlemail.com.
|
||||
*/
|
||||
|
||||
/*
|
||||
* PreferencesDialog.java
|
||||
|
|
@ -77,7 +77,7 @@ import org.apache.log4j.Logger;
|
|||
public class PreferencesDialog extends javax.swing.JDialog {
|
||||
|
||||
private static final transient Logger log = Logger.getLogger(PreferencesDialog.class);
|
||||
|
||||
|
||||
public static final String KEY_HAND_USE_BIG_CARDS = "handUseBigCards";
|
||||
public static final String KEY_SHOW_TOOLTIPS_ANY_ZONE = "showTooltipsInAnyZone";
|
||||
public static final String KEY_SHOW_CARD_NAMES = "showCardNames";
|
||||
|
|
@ -88,7 +88,7 @@ public class PreferencesDialog extends javax.swing.JDialog {
|
|||
public static final String KEY_GAME_SHOW_STORM_COUNTER = "gameShowStormCounter";
|
||||
public static final String KEY_GAME_CONFIRM_EMPTY_MANA_POOL = "gameConfirmEmptyManaPool";
|
||||
public static final String KEY_GAME_ASK_MOVE_TO_GRAVE_ORDER = "gameAskMoveToGraveORder";
|
||||
|
||||
|
||||
public static final String KEY_GAME_LOG_AUTO_SAVE = "gameLogAutoSave";
|
||||
|
||||
public static final String KEY_CARD_IMAGES_USE_DEFAULT = "cardImagesUseDefault";
|
||||
|
|
@ -96,12 +96,12 @@ public class PreferencesDialog extends javax.swing.JDialog {
|
|||
public static final String KEY_CARD_IMAGES_CHECK = "cardImagesCheck";
|
||||
public static final String KEY_CARD_IMAGES_SAVE_TO_ZIP = "cardImagesSaveToZip";
|
||||
public static final String KEY_CARD_IMAGES_PREF_LANGUAGE = "cardImagesPreferedImageLaguage";
|
||||
|
||||
|
||||
public static final String KEY_BACKGROUND_IMAGE = "backgroundImage";
|
||||
public static final String KEY_BATTLEFIELD_IMAGE = "battlefieldImage";
|
||||
public static final String KEY_BACKGROUND_IMAGE_DEFAULT = "backgroundImagedDefault";
|
||||
public static final String KEY_BATTLEFIELD_IMAGE_RANDOM = "battlefieldImagerandom";
|
||||
public static final String KEY_BATTLEFIELD_IMAGE_DEFAULT = "battlefieldImageDefault";
|
||||
public static final String KEY_BATTLEFIELD_IMAGE_DEFAULT = "battlefieldImageDefault";
|
||||
|
||||
public static final String KEY_SOUNDS_GAME_ON = "soundsOn";
|
||||
public static final String KEY_SOUNDS_DRAFT_ON = "soundsDraftOn";
|
||||
|
|
@ -112,7 +112,6 @@ public class PreferencesDialog extends javax.swing.JDialog {
|
|||
|
||||
public static final String KEY_BIG_CARD_TOGGLED = "bigCardToggled";
|
||||
|
||||
|
||||
// Phases
|
||||
public static final String UPKEEP_YOU = "upkeepYou";
|
||||
public static final String DRAW_YOU = "drawYou";
|
||||
|
|
@ -138,15 +137,15 @@ public class PreferencesDialog extends javax.swing.JDialog {
|
|||
// mana auto payment
|
||||
public static final String KEY_GAME_MANA_AUTOPAYMENT = "gameManaAutopayment";
|
||||
public static final String KEY_GAME_MANA_AUTOPAYMENT_ONLY_ONE = "gameManaAutopaymentOnlyOne";
|
||||
|
||||
|
||||
// Size of frame to check if divider locations should be used
|
||||
public static final String KEY_MAGE_PANEL_LAST_SIZE = "gamepanelLastSize";
|
||||
|
||||
|
||||
// pref settings of table settings and filtering
|
||||
public static final String KEY_TABLES_FILTER_SETTINGS = "tablePanelFilterSettings";
|
||||
public static final String KEY_TABLES_COLUMNS_WIDTH = "tablePanelColumnWidth";
|
||||
public static final String KEY_TABLES_COLUMNS_ORDER = "tablePanelColumnSort";
|
||||
|
||||
|
||||
// positions of divider bars
|
||||
public static final String KEY_TABLES_DIVIDER_LOCATION_1 = "tablePanelDividerLocation1";
|
||||
public static final String KEY_TABLES_DIVIDER_LOCATION_2 = "tablePanelDividerLocation2";
|
||||
|
|
@ -155,11 +154,20 @@ public class PreferencesDialog extends javax.swing.JDialog {
|
|||
// user list
|
||||
public static final String KEY_USERS_COLUMNS_WIDTH = "userPanelColumnWidth";
|
||||
public static final String KEY_USERS_COLUMNS_ORDER = "userPanelColumnSort";
|
||||
|
||||
// table waiting dialog
|
||||
public static final String KEY_TABLE_WAITING_WIDTH = "tableWaitingPanelWidth";
|
||||
public static final String KEY_TABLE_WAITING_HEIGHT = "tableWaitingPanelHeight";
|
||||
public static final String KEY_TABLE_WAITING_COLUMNS_WIDTH = "tableWaitingPanelColumnWidth";
|
||||
public static final String KEY_TABLE_WAITING_COLUMNS_ORDER = "tableWaitingPanelColumnSort";
|
||||
|
||||
public static final String KEY_GAMEPANEL_DIVIDER_LOCATION_0 = "gamepanelDividerLocation0";
|
||||
public static final String KEY_GAMEPANEL_DIVIDER_LOCATION_1 = "gamepanelDividerLocation1";
|
||||
public static final String KEY_GAMEPANEL_DIVIDER_LOCATION_2 = "gamepanelDividerLocation2";
|
||||
|
||||
public static final String KEY_TOURNAMENT_PLAYER_COLUMNS_WIDTH = "tournamentPlayerPanelColumnWidth";
|
||||
public static final String KEY_TOURNAMENT_PLAYER_COLUMNS_ORDER = "tournamentPlayerPanelColumnSort";
|
||||
public static final String KEY_TOURNAMENT_MATCH_COLUMNS_WIDTH = "tournamentMatchPanelColumnWidth";
|
||||
public static final String KEY_TOURNAMENT_MATCH_COLUMNS_ORDER = "tournamentMatchPanelColumnSort";
|
||||
public static final String KEY_TOURNAMENT_DIVIDER_LOCATION_1 = "tournamentPanelDividerLocation1";
|
||||
public static final String KEY_TOURNAMENT_DIVIDER_LOCATION_2 = "tournamentPanelDividerLocation2";
|
||||
|
||||
|
|
@ -190,6 +198,7 @@ public class PreferencesDialog extends javax.swing.JDialog {
|
|||
public static final String KEY_NEW_TOURNAMENT_NUMBER_OF_WINS = "newTournamentNumberOfWins";
|
||||
public static final String KEY_NEW_TOURNAMENT_PACKS_SEALED = "newTournamentPacksSealed";
|
||||
public static final String KEY_NEW_TOURNAMENT_PACKS_DRAFT = "newTournamentPacksDraft";
|
||||
public static final String KEY_NEW_TOURNAMENT_PACKS_RANDOM_DRAFT = "newTournamentPacksRandomDraft";
|
||||
public static final String KEY_NEW_TOURNAMENT_PLAYERS_SEALED = "newTournamentPlayersSealed";
|
||||
public static final String KEY_NEW_TOURNAMENT_PLAYERS_DRAFT = "newTournamentPlayersDraft";
|
||||
public static final String KEY_NEW_TOURNAMENT_DRAFT_TIMING = "newTournamentDraftTiming";
|
||||
|
|
@ -203,7 +212,7 @@ public class PreferencesDialog extends javax.swing.JDialog {
|
|||
|
||||
// used to save and restore the settings for the cardArea (draft, sideboarding, deck builder)
|
||||
public static final String KEY_DRAFT_VIEW = "draftView";
|
||||
|
||||
|
||||
public static final String KEY_DRAFT_SORT_BY = "draftSortBy";
|
||||
public static final String KEY_DRAFT_SORT_INDEX = "draftSortIndex";
|
||||
public static final String KEY_DRAFT_SORT_ASCENDING = "draftSortAscending";
|
||||
|
|
@ -233,10 +242,9 @@ public class PreferencesDialog extends javax.swing.JDialog {
|
|||
public static final String KEY_CONNECTION_URL_SERVER_LIST = "connectionURLServerList";
|
||||
|
||||
public static final String KEY_AVATAR = "selectedId";
|
||||
|
||||
|
||||
public static final String KEY_CONNECT_AUTO_CONNECT = "autoConnect";
|
||||
public static final String KEY_CONNECT_FLAG = "connectFlag";
|
||||
|
||||
|
||||
private static final Map<String, String> cache = new HashMap<>();
|
||||
|
||||
|
|
@ -277,38 +285,37 @@ public class PreferencesDialog extends javax.swing.JDialog {
|
|||
{
|
||||
fc.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
|
||||
}
|
||||
|
||||
|
||||
private final JFileChooser fc_i = new JFileChooser();
|
||||
|
||||
{
|
||||
fc_i.setAcceptAllFileFilterUsed(false);
|
||||
fc_i.addChoosableFileFilter(new ImageFileFilter());
|
||||
}
|
||||
|
||||
private static class ImageFileFilter extends FileFilter{
|
||||
|
||||
private static class ImageFileFilter extends FileFilter {
|
||||
|
||||
@Override
|
||||
public boolean accept(File f) {
|
||||
String filename = f.getName();
|
||||
if(f.isDirectory()){
|
||||
if (f.isDirectory()) {
|
||||
return true;
|
||||
}
|
||||
if(filename != null){
|
||||
if(filename.endsWith(".jpg") || filename.endsWith(".jpeg") ||
|
||||
filename.endsWith(".png") || filename.endsWith(".bmp")){
|
||||
return true;
|
||||
if (filename != null) {
|
||||
if (filename.endsWith(".jpg") || filename.endsWith(".jpeg")
|
||||
|| filename.endsWith(".png") || filename.endsWith(".bmp")) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String getDescription() {
|
||||
return "*.png | *.bmp |*.jpg | *.jpeg";
|
||||
}
|
||||
return "*.png | *.bmp |*.jpg | *.jpeg";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Creates new form PreferencesDialog
|
||||
*
|
||||
|
|
@ -321,15 +328,15 @@ public class PreferencesDialog extends javax.swing.JDialog {
|
|||
txtImageFolderPath.setEditable(false);
|
||||
cbProxyType.setModel(new DefaultComboBoxModel<>(Connection.ProxyType.values()));
|
||||
addAvatars();
|
||||
|
||||
cbPreferedImageLanguage.setModel(new DefaultComboBoxModel<>(new String[] {"en","de","fr","it","es","pt","jp","cn","ru","tw","ko"}));
|
||||
|
||||
|
||||
cbPreferedImageLanguage.setModel(new DefaultComboBoxModel<>(new String[]{"en", "de", "fr", "it", "es", "pt", "jp", "cn", "ru", "tw", "ko"}));
|
||||
|
||||
}
|
||||
|
||||
/** This method is called from within the constructor to
|
||||
* initialize the form.
|
||||
* WARNING: Do NOT modify this code. The content of this method is
|
||||
* always regenerated by the Form Editor.
|
||||
/**
|
||||
* This method is called from within the constructor to initialize the form.
|
||||
* WARNING: Do NOT modify this code. The content of this method is always
|
||||
* regenerated by the Form Editor.
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
|
||||
|
|
@ -412,12 +419,12 @@ public class PreferencesDialog extends javax.swing.JDialog {
|
|||
txtBattlefieldIBGMPath = new javax.swing.JTextField();
|
||||
btnBattlefieldBGMBrowse = new javax.swing.JButton();
|
||||
tabAvatars = new javax.swing.JPanel();
|
||||
jScrollPane1 = new javax.swing.JScrollPane();
|
||||
jPanel9 = new javax.swing.JPanel();
|
||||
avatarPane = new javax.swing.JScrollPane();
|
||||
avatarPanel = new javax.swing.JPanel();
|
||||
jLabel12 = new javax.swing.JLabel();
|
||||
jPanel10 = new javax.swing.JPanel();
|
||||
jPanel13 = new javax.swing.JPanel();
|
||||
jPanel11 = new javax.swing.JPanel();
|
||||
jLabel12 = new javax.swing.JLabel();
|
||||
jPanel12 = new javax.swing.JPanel();
|
||||
jPanel14 = new javax.swing.JPanel();
|
||||
jPanel15 = new javax.swing.JPanel();
|
||||
|
|
@ -466,7 +473,7 @@ public class PreferencesDialog extends javax.swing.JDialog {
|
|||
});
|
||||
|
||||
showToolTipsInAnyZone.setSelected(true);
|
||||
showToolTipsInAnyZone.setText("Show card tooltips while hoovering with the mouse pointer over a card");
|
||||
showToolTipsInAnyZone.setText("Show card tooltips while hovering with the mouse pointer over a card");
|
||||
showToolTipsInAnyZone.setToolTipText("");
|
||||
showToolTipsInAnyZone.setActionCommand("");
|
||||
showToolTipsInAnyZone.setCursor(new java.awt.Cursor(java.awt.Cursor.DEFAULT_CURSOR));
|
||||
|
|
@ -525,7 +532,7 @@ public class PreferencesDialog extends javax.swing.JDialog {
|
|||
|
||||
showPlayerNamesPermanently.setSelected(true);
|
||||
showPlayerNamesPermanently.setText("Show player names on avatar permanently");
|
||||
showPlayerNamesPermanently.setToolTipText("Instead showing the names only if you hoover over the avatar with the mouse, the name is shown all the time.");
|
||||
showPlayerNamesPermanently.setToolTipText("Instead showing the names only if you hover over the avatar with the mouse, the name is shown all the time.");
|
||||
showPlayerNamesPermanently.setHorizontalAlignment(javax.swing.SwingConstants.LEFT);
|
||||
showPlayerNamesPermanently.addActionListener(new java.awt.event.ActionListener() {
|
||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||
|
|
@ -1182,6 +1189,9 @@ public class PreferencesDialog extends javax.swing.JDialog {
|
|||
|
||||
tabsPanel.addTab("Sounds", tabSounds);
|
||||
|
||||
jLabel12.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N
|
||||
jLabel12.setText("Choose your avatar:");
|
||||
|
||||
jPanel10.setBorder(new javax.swing.border.LineBorder(new java.awt.Color(204, 204, 204), 1, true));
|
||||
|
||||
javax.swing.GroupLayout jPanel10Layout = new javax.swing.GroupLayout(jPanel10);
|
||||
|
|
@ -1221,9 +1231,6 @@ public class PreferencesDialog extends javax.swing.JDialog {
|
|||
.addGap(0, 100, Short.MAX_VALUE)
|
||||
);
|
||||
|
||||
jLabel12.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N
|
||||
jLabel12.setText("Choose your avatar:");
|
||||
|
||||
jPanel12.setBorder(new javax.swing.border.LineBorder(new java.awt.Color(204, 204, 204), 1, true));
|
||||
|
||||
javax.swing.GroupLayout jPanel12Layout = new javax.swing.GroupLayout(jPanel12);
|
||||
|
|
@ -1344,68 +1351,68 @@ public class PreferencesDialog extends javax.swing.JDialog {
|
|||
.addGap(0, 100, Short.MAX_VALUE)
|
||||
);
|
||||
|
||||
javax.swing.GroupLayout jPanel9Layout = new javax.swing.GroupLayout(jPanel9);
|
||||
jPanel9.setLayout(jPanel9Layout);
|
||||
jPanel9Layout.setHorizontalGroup(
|
||||
jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(jPanel9Layout.createSequentialGroup()
|
||||
.addGroup(jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(jPanel9Layout.createSequentialGroup()
|
||||
javax.swing.GroupLayout avatarPanelLayout = new javax.swing.GroupLayout(avatarPanel);
|
||||
avatarPanel.setLayout(avatarPanelLayout);
|
||||
avatarPanelLayout.setHorizontalGroup(
|
||||
avatarPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(avatarPanelLayout.createSequentialGroup()
|
||||
.addGroup(avatarPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(avatarPanelLayout.createSequentialGroup()
|
||||
.addContainerGap()
|
||||
.addComponent(jLabel12))
|
||||
.addGroup(jPanel9Layout.createSequentialGroup()
|
||||
.addGroup(jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(jPanel9Layout.createSequentialGroup()
|
||||
.addGroup(avatarPanelLayout.createSequentialGroup()
|
||||
.addGroup(avatarPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(avatarPanelLayout.createSequentialGroup()
|
||||
.addGap(30, 30, 30)
|
||||
.addGroup(jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
|
||||
.addGroup(avatarPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
|
||||
.addComponent(jPanel12, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addComponent(jPanel10, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addComponent(jPanel19, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
|
||||
.addGap(33, 33, 33)
|
||||
.addGroup(jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(avatarPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addComponent(jPanel13, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addComponent(jPanel14, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addComponent(jPanel20, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
|
||||
.addGroup(jPanel9Layout.createSequentialGroup()
|
||||
.addGroup(avatarPanelLayout.createSequentialGroup()
|
||||
.addContainerGap()
|
||||
.addGroup(jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(jPanel9Layout.createSequentialGroup()
|
||||
.addGroup(avatarPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(avatarPanelLayout.createSequentialGroup()
|
||||
.addGap(20, 20, 20)
|
||||
.addComponent(jPanel16, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addGap(33, 33, 33)
|
||||
.addComponent(jPanel17, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
|
||||
.addComponent(jLabel13))))
|
||||
.addGap(32, 32, 32)
|
||||
.addGroup(jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(avatarPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addComponent(jPanel18, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addComponent(jPanel21, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addComponent(jPanel15, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addComponent(jPanel11, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))))
|
||||
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
|
||||
);
|
||||
jPanel9Layout.setVerticalGroup(
|
||||
jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(jPanel9Layout.createSequentialGroup()
|
||||
avatarPanelLayout.setVerticalGroup(
|
||||
avatarPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(avatarPanelLayout.createSequentialGroup()
|
||||
.addContainerGap()
|
||||
.addComponent(jLabel12)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
|
||||
.addGroup(jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(avatarPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addComponent(jPanel11, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addComponent(jPanel13, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addComponent(jPanel10, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
|
||||
.addGap(26, 26, 26)
|
||||
.addGroup(jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(avatarPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addComponent(jPanel15, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addComponent(jPanel12, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addComponent(jPanel14, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
|
||||
.addGap(23, 23, 23)
|
||||
.addGroup(jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
|
||||
.addGroup(avatarPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
|
||||
.addComponent(jPanel19, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addComponent(jPanel20, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addComponent(jPanel21, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
|
||||
.addGap(18, 18, 18)
|
||||
.addGroup(jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
|
||||
.addGroup(jPanel9Layout.createSequentialGroup()
|
||||
.addGroup(avatarPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
|
||||
.addGroup(avatarPanelLayout.createSequentialGroup()
|
||||
.addComponent(jLabel13)
|
||||
.addGap(18, 18, 18)
|
||||
.addComponent(jPanel16, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
|
||||
|
|
@ -1414,17 +1421,17 @@ public class PreferencesDialog extends javax.swing.JDialog {
|
|||
.addGap(25, 25, 25))
|
||||
);
|
||||
|
||||
jScrollPane1.setViewportView(jPanel9);
|
||||
avatarPane.setViewportView(avatarPanel);
|
||||
|
||||
javax.swing.GroupLayout tabAvatarsLayout = new javax.swing.GroupLayout(tabAvatars);
|
||||
tabAvatars.setLayout(tabAvatarsLayout);
|
||||
tabAvatarsLayout.setHorizontalGroup(
|
||||
tabAvatarsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 590, Short.MAX_VALUE)
|
||||
.addComponent(avatarPane, javax.swing.GroupLayout.DEFAULT_SIZE, 590, Short.MAX_VALUE)
|
||||
);
|
||||
tabAvatarsLayout.setVerticalGroup(
|
||||
tabAvatarsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 359, Short.MAX_VALUE)
|
||||
.addComponent(avatarPane, javax.swing.GroupLayout.DEFAULT_SIZE, 359, Short.MAX_VALUE)
|
||||
);
|
||||
|
||||
tabsPanel.addTab("Avatars", tabAvatars);
|
||||
|
|
@ -1697,9 +1704,9 @@ public class PreferencesDialog extends javax.swing.JDialog {
|
|||
save(prefs, dialog.cbUseDefaultImageFolder, KEY_CARD_IMAGES_USE_DEFAULT, "true", "false", UPDATE_CACHE_POLICY);
|
||||
saveImagesPath(prefs);
|
||||
save(prefs, dialog.cbCheckForNewImages, KEY_CARD_IMAGES_CHECK, "true", "false", UPDATE_CACHE_POLICY);
|
||||
save(prefs, dialog.cbSaveToZipFiles, KEY_CARD_IMAGES_SAVE_TO_ZIP, "true", "false", UPDATE_CACHE_POLICY);
|
||||
save(prefs, dialog.cbSaveToZipFiles, KEY_CARD_IMAGES_SAVE_TO_ZIP, "true", "false", UPDATE_CACHE_POLICY);
|
||||
save(prefs, dialog.cbPreferedImageLanguage, KEY_CARD_IMAGES_PREF_LANGUAGE);
|
||||
|
||||
|
||||
save(prefs, dialog.cbUseDefaultBackground, KEY_BACKGROUND_IMAGE_DEFAULT, "true", "false", UPDATE_CACHE_POLICY);
|
||||
save(prefs, dialog.cbUseDefaultBattleImage, KEY_BATTLEFIELD_IMAGE_DEFAULT, "true", "false", UPDATE_CACHE_POLICY);
|
||||
save(prefs, dialog.cbUseRandomBattleImage, KEY_BATTLEFIELD_IMAGE_RANDOM, "true", "false", UPDATE_CACHE_POLICY);
|
||||
|
|
@ -1711,7 +1718,7 @@ public class PreferencesDialog extends javax.swing.JDialog {
|
|||
save(prefs, dialog.cbEnableOtherSounds, KEY_SOUNDS_OTHER_ON, "true", "false", UPDATE_CACHE_POLICY);
|
||||
save(prefs, dialog.cbEnableBattlefieldBGM, KEY_SOUNDS_MATCH_MUSIC_ON, "true", "false", UPDATE_CACHE_POLICY);
|
||||
saveSoundPath(prefs);
|
||||
|
||||
|
||||
// connection
|
||||
save(prefs, dialog.cbProxyType, KEY_PROXY_TYPE);
|
||||
save(prefs, dialog.txtProxyServer, KEY_PROXY_ADDRESS);
|
||||
|
|
@ -1769,7 +1776,7 @@ public class PreferencesDialog extends javax.swing.JDialog {
|
|||
|
||||
private void btnBrowseImageLocationActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnBrowseImageLocationActionPerformed
|
||||
int returnVal = fc.showOpenDialog(PreferencesDialog.this);
|
||||
|
||||
|
||||
if (returnVal == JFileChooser.APPROVE_OPTION) {
|
||||
File file = fc.getSelectedFile();
|
||||
txtImageFolderPath.setText(file.getAbsolutePath());
|
||||
|
|
@ -1802,101 +1809,101 @@ public class PreferencesDialog extends javax.swing.JDialog {
|
|||
}//GEN-LAST:event_cbEnableGameSoundsActionPerformed
|
||||
|
||||
private void cbEnableBattlefieldBGMActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cbEnableBattlefieldBGMActionPerformed
|
||||
if(cbEnableBattlefieldBGM.isSelected()){
|
||||
if (cbEnableBattlefieldBGM.isSelected()) {
|
||||
txtBattlefieldIBGMPath.setEnabled(true);
|
||||
btnBattlefieldBGMBrowse.setEnabled(true);
|
||||
}else{
|
||||
} else {
|
||||
txtBattlefieldIBGMPath.setEnabled(false);
|
||||
btnBattlefieldBGMBrowse.setEnabled(false);
|
||||
}
|
||||
}//GEN-LAST:event_cbEnableBattlefieldBGMActionPerformed
|
||||
|
||||
|
||||
private void cbUseDefaultBackgroundActionPerformed(java.awt.event.ActionEvent evt) {
|
||||
if(cbUseDefaultBackground.isSelected()){
|
||||
if (cbUseDefaultBackground.isSelected()) {
|
||||
useDefaultBackgroundImage();
|
||||
}else{
|
||||
} else {
|
||||
useSelectBackgroundImage();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void useDefaultBackgroundImage(){
|
||||
private void useDefaultBackgroundImage() {
|
||||
txtBackgroundImagePath.setEnabled(false);
|
||||
btnBrowseBackgroundImage.setEnabled(false);
|
||||
txtBackgroundImagePath.setText("");
|
||||
}
|
||||
|
||||
private void useSelectBackgroundImage(){
|
||||
|
||||
private void useSelectBackgroundImage() {
|
||||
String path = cache.get(KEY_BACKGROUND_IMAGE);
|
||||
dialog.txtBackgroundImagePath.setText(path);
|
||||
txtBackgroundImagePath.setEnabled(true);
|
||||
btnBrowseBackgroundImage.setEnabled(true);
|
||||
}
|
||||
|
||||
|
||||
private void cbUseDefaultBattleImageActionPerformed(java.awt.event.ActionEvent evt) {
|
||||
if(cbUseDefaultBattleImage.isSelected()){
|
||||
if (cbUseDefaultBattleImage.isSelected()) {
|
||||
useDefaultBattlefield();
|
||||
}else{
|
||||
} else {
|
||||
useSelectedOrRandom();
|
||||
}
|
||||
}
|
||||
|
||||
private void useDefaultBattlefield(){
|
||||
}
|
||||
|
||||
private void useDefaultBattlefield() {
|
||||
cbUseRandomBattleImage.setEnabled(false);
|
||||
txtBattlefieldImagePath.setEnabled(false);
|
||||
btnBrowseBattlefieldImage.setEnabled(false);
|
||||
}
|
||||
|
||||
private void useSelectedOrRandom(){
|
||||
|
||||
private void useSelectedOrRandom() {
|
||||
cbUseRandomBattleImage.setEnabled(true);
|
||||
String temp = cache.get(KEY_BATTLEFIELD_IMAGE_RANDOM);
|
||||
if(temp != null){
|
||||
if(temp.equals("true")){
|
||||
if (temp != null) {
|
||||
if (temp.equals("true")) {
|
||||
useRandomBattleField();
|
||||
cbUseRandomBattleImage.setSelected(true);
|
||||
}else{
|
||||
} else {
|
||||
useSelectedBattleField();
|
||||
cbUseRandomBattleImage.setSelected(false);
|
||||
}
|
||||
}else{
|
||||
useSelectedBattleField();
|
||||
cbUseRandomBattleImage.setSelected(false);
|
||||
} else {
|
||||
useSelectedBattleField();
|
||||
cbUseRandomBattleImage.setSelected(false);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void cbUseRandomBattleImageActionPerformed(java.awt.event.ActionEvent evt) {
|
||||
if(cbUseRandomBattleImage.isSelected()){
|
||||
if (cbUseRandomBattleImage.isSelected()) {
|
||||
useRandomBattleField();
|
||||
}else{
|
||||
} else {
|
||||
useSelectedBattleField();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void useRandomBattleField(){
|
||||
private void useRandomBattleField() {
|
||||
txtBattlefieldImagePath.setEnabled(false);
|
||||
btnBrowseBattlefieldImage.setEnabled(false);
|
||||
}
|
||||
|
||||
private void useSelectedBattleField(){
|
||||
|
||||
private void useSelectedBattleField() {
|
||||
txtBattlefieldImagePath.setEnabled(true);
|
||||
btnBrowseBattlefieldImage.setEnabled(true);
|
||||
}
|
||||
|
||||
|
||||
private void btnBrowseBackgroundImageActionPerformed(java.awt.event.ActionEvent evt) {
|
||||
int returnVal = fc_i.showOpenDialog(PreferencesDialog.this);
|
||||
int returnVal = fc_i.showOpenDialog(PreferencesDialog.this);
|
||||
if (returnVal == JFileChooser.APPROVE_OPTION) {
|
||||
File file = fc_i.getSelectedFile();
|
||||
txtBackgroundImagePath.setText(file.getAbsolutePath());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void btnBrowseBattlefieldImageActionPerformed(java.awt.event.ActionEvent evt) {
|
||||
int returnVal = fc_i.showOpenDialog(PreferencesDialog.this);
|
||||
int returnVal = fc_i.showOpenDialog(PreferencesDialog.this);
|
||||
if (returnVal == JFileChooser.APPROVE_OPTION) {
|
||||
File file = fc_i.getSelectedFile();
|
||||
txtBattlefieldImagePath.setText(file.getAbsolutePath());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void txtBackgroundImagePathActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_txtBackgroundImagePathActionPerformed
|
||||
// TODO add your handling code here:
|
||||
}//GEN-LAST:event_txtBackgroundImagePathActionPerformed
|
||||
|
|
@ -1994,12 +2001,10 @@ public class PreferencesDialog extends javax.swing.JDialog {
|
|||
if (cbProxyType.getSelectedItem() == Connection.ProxyType.SOCKS) {
|
||||
this.pnlProxy.setVisible(true);
|
||||
this.pnlProxySettings.setVisible(true);
|
||||
}
|
||||
else if (cbProxyType.getSelectedItem() == Connection.ProxyType.HTTP) {
|
||||
} else if (cbProxyType.getSelectedItem() == Connection.ProxyType.HTTP) {
|
||||
this.pnlProxy.setVisible(true);
|
||||
this.pnlProxySettings.setVisible(true);
|
||||
}
|
||||
else if (cbProxyType.getSelectedItem() == Connection.ProxyType.NONE) {
|
||||
} else if (cbProxyType.getSelectedItem() == Connection.ProxyType.NONE) {
|
||||
this.pnlProxy.setVisible(false);
|
||||
this.pnlProxySettings.setVisible(false);
|
||||
}
|
||||
|
|
@ -2058,7 +2063,7 @@ public class PreferencesDialog extends javax.swing.JDialog {
|
|||
}
|
||||
|
||||
private static void loadPhases(Preferences prefs) {
|
||||
load(prefs, dialog.displayBigCardsInHand, KEY_HAND_USE_BIG_CARDS, "true","true");
|
||||
load(prefs, dialog.displayBigCardsInHand, KEY_HAND_USE_BIG_CARDS, "true", "true");
|
||||
load(prefs, dialog.showToolTipsInAnyZone, KEY_SHOW_TOOLTIPS_ANY_ZONE, "true");
|
||||
load(prefs, dialog.showCardName, KEY_SHOW_CARD_NAMES, "true");
|
||||
load(prefs, dialog.nonLandPermanentsInOnePile, KEY_PERMANENTS_IN_ONE_PILE, "true");
|
||||
|
|
@ -2071,21 +2076,21 @@ public class PreferencesDialog extends javax.swing.JDialog {
|
|||
|
||||
load(prefs, dialog.cbGameLogAutoSave, KEY_GAME_LOG_AUTO_SAVE, "true");
|
||||
|
||||
load(prefs, dialog.checkBoxUpkeepYou, UPKEEP_YOU, "on","on");
|
||||
load(prefs, dialog.checkBoxDrawYou, DRAW_YOU, "on","on");
|
||||
load(prefs, dialog.checkBoxMainYou, MAIN_YOU, "on","on");
|
||||
load(prefs, dialog.checkBoxBeforeCYou, BEFORE_COMBAT_YOU, "on","on");
|
||||
load(prefs, dialog.checkBoxEndOfCYou, END_OF_COMBAT_YOU, "on","on");
|
||||
load(prefs, dialog.checkBoxMain2You, MAIN_2_YOU, "on","on");
|
||||
load(prefs, dialog.checkBoxEndTurnYou, END_OF_TURN_YOU, "on","on");
|
||||
load(prefs, dialog.checkBoxUpkeepYou, UPKEEP_YOU, "on", "on");
|
||||
load(prefs, dialog.checkBoxDrawYou, DRAW_YOU, "on", "on");
|
||||
load(prefs, dialog.checkBoxMainYou, MAIN_YOU, "on", "on");
|
||||
load(prefs, dialog.checkBoxBeforeCYou, BEFORE_COMBAT_YOU, "on", "on");
|
||||
load(prefs, dialog.checkBoxEndOfCYou, END_OF_COMBAT_YOU, "on", "on");
|
||||
load(prefs, dialog.checkBoxMain2You, MAIN_2_YOU, "on", "on");
|
||||
load(prefs, dialog.checkBoxEndTurnYou, END_OF_TURN_YOU, "on", "on");
|
||||
|
||||
load(prefs, dialog.checkBoxUpkeepOthers, UPKEEP_OTHERS, "on","on");
|
||||
load(prefs, dialog.checkBoxDrawOthers, DRAW_OTHERS, "on","on");
|
||||
load(prefs, dialog.checkBoxMainOthers, MAIN_OTHERS, "on","on");
|
||||
load(prefs, dialog.checkBoxBeforeCOthers, BEFORE_COMBAT_OTHERS, "on","on");
|
||||
load(prefs, dialog.checkBoxEndOfCOthers, END_OF_COMBAT_OTHERS, "on","on");
|
||||
load(prefs, dialog.checkBoxMain2Others, MAIN_2_OTHERS, "on","on");
|
||||
load(prefs, dialog.checkBoxEndTurnOthers, END_OF_TURN_OTHERS, "on","on");
|
||||
load(prefs, dialog.checkBoxUpkeepOthers, UPKEEP_OTHERS, "on", "on");
|
||||
load(prefs, dialog.checkBoxDrawOthers, DRAW_OTHERS, "on", "on");
|
||||
load(prefs, dialog.checkBoxMainOthers, MAIN_OTHERS, "on", "on");
|
||||
load(prefs, dialog.checkBoxBeforeCOthers, BEFORE_COMBAT_OTHERS, "on", "on");
|
||||
load(prefs, dialog.checkBoxEndOfCOthers, END_OF_COMBAT_OTHERS, "on", "on");
|
||||
load(prefs, dialog.checkBoxMain2Others, MAIN_2_OTHERS, "on", "on");
|
||||
load(prefs, dialog.checkBoxEndTurnOthers, END_OF_TURN_OTHERS, "on", "on");
|
||||
|
||||
load(prefs, dialog.cbStopAttack, KEY_STOP_ATTACK, "true", "true");
|
||||
load(prefs, dialog.cbStopBlock, KEY_STOP_BLOCK, "true", "true");
|
||||
|
|
@ -2109,13 +2114,13 @@ public class PreferencesDialog extends javax.swing.JDialog {
|
|||
load(prefs, dialog.cbCheckForNewImages, KEY_CARD_IMAGES_CHECK, "true");
|
||||
load(prefs, dialog.cbSaveToZipFiles, KEY_CARD_IMAGES_SAVE_TO_ZIP, "true");
|
||||
dialog.cbPreferedImageLanguage.setSelectedItem(MageFrame.getPreferences().get(KEY_CARD_IMAGES_PREF_LANGUAGE, "en"));
|
||||
|
||||
//add background load precedure
|
||||
|
||||
//add background load precedure
|
||||
prop = prefs.get(KEY_BACKGROUND_IMAGE_DEFAULT, "true");
|
||||
if(prop.equals("true")){
|
||||
if (prop.equals("true")) {
|
||||
dialog.cbUseDefaultBackground.setSelected(true);
|
||||
dialog.useDefaultBackgroundImage();
|
||||
}else{
|
||||
} else {
|
||||
dialog.cbUseDefaultBackground.setSelected(false);
|
||||
dialog.useSelectBackgroundImage();
|
||||
String path = prefs.get(KEY_BACKGROUND_IMAGE, "");
|
||||
|
|
@ -2123,27 +2128,27 @@ public class PreferencesDialog extends javax.swing.JDialog {
|
|||
updateCache(KEY_BACKGROUND_IMAGE, path);
|
||||
}
|
||||
prop = prefs.get(KEY_BATTLEFIELD_IMAGE_DEFAULT, "true");
|
||||
if(prop.equals("true")){
|
||||
if (prop.equals("true")) {
|
||||
dialog.cbUseDefaultBattleImage.setSelected(true);
|
||||
dialog.useDefaultBattlefield();
|
||||
}else{
|
||||
dialog.useDefaultBattlefield();
|
||||
} else {
|
||||
dialog.cbUseDefaultBattleImage.setSelected(false);
|
||||
dialog.useSelectedOrRandom();
|
||||
}
|
||||
prop = prefs.get(KEY_BATTLEFIELD_IMAGE_RANDOM, "true");
|
||||
|
||||
if(dialog.cbUseRandomBattleImage.isEnabled()) {
|
||||
if(prop.equals("true")){
|
||||
|
||||
if (dialog.cbUseRandomBattleImage.isEnabled()) {
|
||||
if (prop.equals("true")) {
|
||||
dialog.cbUseRandomBattleImage.setSelected(true);
|
||||
dialog.useRandomBattleField();
|
||||
}else{
|
||||
} else {
|
||||
dialog.cbUseRandomBattleImage.setSelected(false);
|
||||
dialog.useSelectedBattleField();
|
||||
String path = prefs.get(KEY_BATTLEFIELD_IMAGE, "");
|
||||
dialog.txtBattlefieldImagePath.setText(path);
|
||||
updateCache(KEY_BATTLEFIELD_IMAGE, path);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static void loadSoundSettings(Preferences prefs) {
|
||||
|
|
@ -2199,7 +2204,7 @@ public class PreferencesDialog extends javax.swing.JDialog {
|
|||
loadPhases(MageFrame.getPreferences());
|
||||
}
|
||||
UserSkipPrioritySteps userSkipPrioritySteps = new UserSkipPrioritySteps();
|
||||
|
||||
|
||||
userSkipPrioritySteps.getYourTurn().setUpkeep(dialog.checkBoxUpkeepYou.isSelected());
|
||||
userSkipPrioritySteps.getYourTurn().setDraw(dialog.checkBoxDrawYou.isSelected());
|
||||
userSkipPrioritySteps.getYourTurn().setMain1(dialog.checkBoxMainYou.isSelected());
|
||||
|
|
@ -2215,7 +2220,7 @@ public class PreferencesDialog extends javax.swing.JDialog {
|
|||
userSkipPrioritySteps.getOpponentTurn().setEndOfCombat(dialog.checkBoxEndOfCOthers.isSelected());
|
||||
userSkipPrioritySteps.getOpponentTurn().setMain2(dialog.checkBoxMain2Others.isSelected());
|
||||
userSkipPrioritySteps.getOpponentTurn().setEndOfTurn(dialog.checkBoxEndTurnOthers.isSelected());
|
||||
|
||||
|
||||
userSkipPrioritySteps.setStopOnDeclareAttackersDuringSkipActions(dialog.cbStopAttack.isSelected());
|
||||
userSkipPrioritySteps.setStopOnDeclareBlockerIfNoneAvailable(dialog.cbStopBlock.isSelected());
|
||||
userSkipPrioritySteps.setStopOnAllEndPhases(dialog.cbStopOnAllEnd.isSelected());
|
||||
|
|
@ -2234,7 +2239,6 @@ public class PreferencesDialog extends javax.swing.JDialog {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
private static void saveImagesPath(Preferences prefs) {
|
||||
if (!dialog.cbUseDefaultImageFolder.isSelected()) {
|
||||
String path = dialog.txtImageFolderPath.getText();
|
||||
|
|
@ -2242,19 +2246,19 @@ public class PreferencesDialog extends javax.swing.JDialog {
|
|||
updateCache(KEY_CARD_IMAGES_PATH, path);
|
||||
}
|
||||
// background path save precedure
|
||||
if(!dialog.cbUseDefaultBackground.isSelected()){
|
||||
if (!dialog.cbUseDefaultBackground.isSelected()) {
|
||||
String path = dialog.txtBackgroundImagePath.getText();
|
||||
prefs.put(KEY_BACKGROUND_IMAGE, path);
|
||||
updateCache(KEY_BACKGROUND_IMAGE, path);
|
||||
}
|
||||
if(!dialog.cbUseDefaultBattleImage.isSelected() && !dialog.cbUseRandomBattleImage.isSelected()){
|
||||
if (!dialog.cbUseDefaultBattleImage.isSelected() && !dialog.cbUseRandomBattleImage.isSelected()) {
|
||||
String path = dialog.txtBattlefieldImagePath.getText();
|
||||
prefs.put(KEY_BATTLEFIELD_IMAGE, path);
|
||||
updateCache(KEY_BATTLEFIELD_IMAGE, path);
|
||||
}
|
||||
}
|
||||
|
||||
private static void saveSoundPath(Preferences prefs){
|
||||
|
||||
private static void saveSoundPath(Preferences prefs) {
|
||||
String path = dialog.txtBattlefieldIBGMPath.getText();
|
||||
prefs.put(KEY_SOUNDS_MATCH_MUSIC_PATH, path);
|
||||
updateCache(KEY_SOUNDS_MATCH_MUSIC_PATH, path);
|
||||
|
|
@ -2293,13 +2297,14 @@ public class PreferencesDialog extends javax.swing.JDialog {
|
|||
}
|
||||
|
||||
public static void setPrefValue(String key, boolean value) {
|
||||
switch(key) {
|
||||
switch (key) {
|
||||
case KEY_GAME_ALLOW_REQUEST_SHOW_HAND_CARDS:
|
||||
dialog.cbAllowRequestToShowHandCards.setSelected(value);
|
||||
save(MageFrame.getPreferences(), dialog.cbAllowRequestToShowHandCards, KEY_GAME_ALLOW_REQUEST_SHOW_HAND_CARDS, "true", "false", UPDATE_CACHE_POLICY);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static void save(Preferences prefs, JCheckBox checkBox, String propName, String yesValue, String noValue, boolean updateCache) {
|
||||
prefs.put(propName, checkBox.isSelected() ? yesValue : noValue);
|
||||
if (updateCache) {
|
||||
|
|
@ -2355,7 +2360,7 @@ public class PreferencesDialog extends javax.swing.JDialog {
|
|||
try {
|
||||
addAvatar(jPanel10, 51, true, false);
|
||||
addAvatar(jPanel13, 13, false, false);
|
||||
addAvatar(jPanel11, 9, false, false);
|
||||
addAvatar(jPanel11, 9, false, false);
|
||||
addAvatar(jPanel12, 53, false, false);
|
||||
addAvatar(jPanel14, 10, false, false);
|
||||
addAvatar(jPanel15, 39, false, false);
|
||||
|
|
@ -2408,7 +2413,7 @@ public class PreferencesDialog extends javax.swing.JDialog {
|
|||
public void mousePressed(MouseEvent e) {
|
||||
if (selectedAvatarId != id) {
|
||||
setSelectedId(id);
|
||||
MageFrame.getClient().setPreferences(getUserData());
|
||||
MageFrame.getClient().setPreferences(getUserData());
|
||||
}
|
||||
}
|
||||
});
|
||||
|
|
@ -2426,8 +2431,10 @@ public class PreferencesDialog extends javax.swing.JDialog {
|
|||
PreferencesDialog.getCachedValue(PreferencesDialog.KEY_GAME_ASK_MOVE_TO_GRAVE_ORDER, "true").equals("true")
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
// Variables declaration - do not modify//GEN-BEGIN:variables
|
||||
private javax.swing.JScrollPane avatarPane;
|
||||
private javax.swing.JPanel avatarPanel;
|
||||
private javax.swing.JButton btnBattlefieldBGMBrowse;
|
||||
private javax.swing.JButton btnBrowseBackgroundImage;
|
||||
private javax.swing.JButton btnBrowseBattlefieldImage;
|
||||
|
|
@ -2500,8 +2507,6 @@ public class PreferencesDialog extends javax.swing.JDialog {
|
|||
private javax.swing.JPanel jPanel19;
|
||||
private javax.swing.JPanel jPanel20;
|
||||
private javax.swing.JPanel jPanel21;
|
||||
private javax.swing.JPanel jPanel9;
|
||||
private javax.swing.JScrollPane jScrollPane1;
|
||||
private javax.swing.JLabel labelPreferedImageLanguage;
|
||||
private javax.swing.JLabel lblProxyPassword;
|
||||
private javax.swing.JLabel lblProxyPort;
|
||||
|
|
|
|||
|
|
@ -0,0 +1,106 @@
|
|||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
|
||||
<Form version="1.3" maxVersion="1.9" type="org.netbeans.modules.form.forminfo.JDialogFormInfo">
|
||||
<Properties>
|
||||
<Property name="title" type="java.lang.String" value="Random Booster Draft Packs Selector"/>
|
||||
<Property name="modal" type="boolean" value="true"/>
|
||||
<Property name="modalExclusionType" type="java.awt.Dialog$ModalExclusionType" editor="org.netbeans.modules.form.editors.EnumEditor">
|
||||
<Value id="APPLICATION_EXCLUDE"/>
|
||||
</Property>
|
||||
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[600, 450]"/>
|
||||
</Property>
|
||||
<Property name="resizable" type="boolean" value="false"/>
|
||||
</Properties>
|
||||
<SyntheticProperties>
|
||||
<SyntheticProperty name="formSizePolicy" type="int" value="1"/>
|
||||
<SyntheticProperty name="generateCenter" type="boolean" value="false"/>
|
||||
</SyntheticProperties>
|
||||
<AuxValues>
|
||||
<AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="0"/>
|
||||
<AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/>
|
||||
<AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/>
|
||||
<AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/>
|
||||
<AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="false"/>
|
||||
<AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="1"/>
|
||||
<AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
|
||||
<AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
|
||||
<AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
|
||||
</AuxValues>
|
||||
|
||||
<Layout>
|
||||
<DimensionLayout dim="0">
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Group type="102" attributes="0">
|
||||
<Component id="pnlSelect" min="-2" pref="241" max="-2" attributes="0"/>
|
||||
<EmptySpace pref="300" max="32767" attributes="0"/>
|
||||
<Component id="pnlApply" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<Group type="102" attributes="0">
|
||||
<Component id="pnlPacks" max="32767" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
</DimensionLayout>
|
||||
<DimensionLayout dim="1">
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Group type="102" alignment="0" attributes="0">
|
||||
<Component id="pnlPacks" min="-2" pref="372" max="-2" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Component id="pnlApply" min="-2" pref="32" max="-2" attributes="0"/>
|
||||
<Component id="pnlSelect" min="-2" pref="32" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<EmptySpace max="32767" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
</DimensionLayout>
|
||||
</Layout>
|
||||
<SubComponents>
|
||||
<Container class="java.awt.Panel" name="pnlPacks">
|
||||
|
||||
<Layout class="org.netbeans.modules.form.compat2.layouts.DesignGridLayout">
|
||||
<Property name="columns" type="int" value="12"/>
|
||||
<Property name="rows" type="int" value="11"/>
|
||||
</Layout>
|
||||
</Container>
|
||||
<Container class="javax.swing.JPanel" name="pnlSelect">
|
||||
|
||||
<Layout class="org.netbeans.modules.form.compat2.layouts.DesignBoxLayout"/>
|
||||
<SubComponents>
|
||||
<Component class="javax.swing.JButton" name="btnNone">
|
||||
<Properties>
|
||||
<Property name="text" type="java.lang.String" value="Select none"/>
|
||||
<Property name="actionCommand" type="java.lang.String" value="none"/>
|
||||
</Properties>
|
||||
<Events>
|
||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="btnNoneActionPerformed"/>
|
||||
</Events>
|
||||
</Component>
|
||||
<Component class="javax.swing.JButton" name="btnAll">
|
||||
<Properties>
|
||||
<Property name="text" type="java.lang.String" value="Select all"/>
|
||||
</Properties>
|
||||
<Events>
|
||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="btnAllActionPerformed"/>
|
||||
</Events>
|
||||
</Component>
|
||||
</SubComponents>
|
||||
</Container>
|
||||
<Container class="javax.swing.JPanel" name="pnlApply">
|
||||
|
||||
<Layout class="org.netbeans.modules.form.compat2.layouts.DesignBoxLayout"/>
|
||||
<SubComponents>
|
||||
<Component class="javax.swing.JButton" name="btnApply">
|
||||
<Properties>
|
||||
<Property name="text" type="java.lang.String" value="Apply"/>
|
||||
<Property name="toolTipText" type="java.lang.String" value="At least two packs must be selected"/>
|
||||
</Properties>
|
||||
<Events>
|
||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="btnApplyActionPerformed"/>
|
||||
</Events>
|
||||
</Component>
|
||||
</SubComponents>
|
||||
</Container>
|
||||
</SubComponents>
|
||||
</Form>
|
||||
|
|
@ -0,0 +1,199 @@
|
|||
/*
|
||||
* To change this license header, choose License Headers in Project Properties.
|
||||
* To change this template file, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
package mage.client.dialog;
|
||||
|
||||
import java.awt.Component;
|
||||
import java.util.ArrayList;
|
||||
import javax.swing.JCheckBox;
|
||||
import mage.cards.repository.ExpansionInfo;
|
||||
import mage.cards.repository.ExpansionRepository;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author BrodyL
|
||||
*/
|
||||
public class RandomPacksSelectorDialog extends javax.swing.JDialog {
|
||||
|
||||
/**
|
||||
* Creates new form RandomPacksSelectorDialog
|
||||
*/
|
||||
private boolean boxesCreated;
|
||||
public final static String randomDraftDescription = ("The selected packs will be randomly distributed to players. Each player may open different packs. Duplicates will be avoided.");
|
||||
|
||||
public RandomPacksSelectorDialog() {
|
||||
initComponents();
|
||||
this.pnlApply.setToolTipText(randomDraftDescription);
|
||||
this.pnlSelect.setToolTipText(randomDraftDescription);
|
||||
boxesCreated = false;
|
||||
}
|
||||
|
||||
public void showDialog() {
|
||||
createCheckboxes();
|
||||
pnlPacks.setVisible(true);
|
||||
pnlPacks.revalidate();
|
||||
pnlPacks.repaint();
|
||||
this.pack();
|
||||
this.revalidate();
|
||||
this.repaint();
|
||||
this.setVisible(true);
|
||||
this.setModal(true);
|
||||
}
|
||||
|
||||
public void setSelectedPacks(ArrayList<String> packs){
|
||||
if (!boxesCreated){
|
||||
createCheckboxes();
|
||||
}
|
||||
for (Component pack : pnlPacks.getComponents()) {
|
||||
JCheckBox thePack = (JCheckBox) pack;
|
||||
if (packs.contains(thePack.getText())) {
|
||||
thePack.setSelected(true);
|
||||
} else{
|
||||
thePack.setSelected(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public ArrayList<String> getSelectedPacks() {
|
||||
ArrayList<String> returnVal = new ArrayList<>();
|
||||
for (Component pack: pnlPacks.getComponents()){
|
||||
JCheckBox thePack = (JCheckBox) pack;
|
||||
if (thePack.isSelected()){
|
||||
returnVal.add(thePack.getText());
|
||||
}
|
||||
}
|
||||
return returnVal;
|
||||
}
|
||||
|
||||
private void createCheckboxes() {
|
||||
if (!boxesCreated) {
|
||||
ExpansionInfo[] allExpansions = ExpansionRepository.instance.getWithBoostersSortedByReleaseDate();
|
||||
for (ExpansionInfo exp : allExpansions) {
|
||||
JCheckBox pack = new JCheckBox();
|
||||
pack.setSelected(true);
|
||||
pack.setText(exp.getCode());
|
||||
pack.setToolTipText(exp.getName());
|
||||
pnlPacks.add(pack);
|
||||
}
|
||||
pnlPacks.setVisible(true);
|
||||
this.pack();
|
||||
boxesCreated = true;
|
||||
pnlPacks.validate();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* This method is called from within the constructor to initialize the form.
|
||||
* WARNING: Do NOT modify this code. The content of this method is always
|
||||
* regenerated by the Form Editor.
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
|
||||
private void initComponents() {
|
||||
|
||||
pnlPacks = new java.awt.Panel();
|
||||
pnlSelect = new javax.swing.JPanel();
|
||||
btnNone = new javax.swing.JButton();
|
||||
btnAll = new javax.swing.JButton();
|
||||
pnlApply = new javax.swing.JPanel();
|
||||
btnApply = new javax.swing.JButton();
|
||||
|
||||
setTitle("Random Booster Draft Packs Selector");
|
||||
setModal(true);
|
||||
setModalExclusionType(java.awt.Dialog.ModalExclusionType.APPLICATION_EXCLUDE);
|
||||
setPreferredSize(new java.awt.Dimension(600, 450));
|
||||
setResizable(false);
|
||||
|
||||
pnlPacks.setLayout(new java.awt.GridLayout(11, 12));
|
||||
|
||||
pnlSelect.setLayout(new javax.swing.BoxLayout(pnlSelect, javax.swing.BoxLayout.LINE_AXIS));
|
||||
|
||||
btnNone.setText("Select none");
|
||||
btnNone.setActionCommand("none");
|
||||
btnNone.addActionListener(new java.awt.event.ActionListener() {
|
||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||
btnNoneActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
pnlSelect.add(btnNone);
|
||||
|
||||
btnAll.setText("Select all");
|
||||
btnAll.addActionListener(new java.awt.event.ActionListener() {
|
||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||
btnAllActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
pnlSelect.add(btnAll);
|
||||
|
||||
pnlApply.setLayout(new javax.swing.BoxLayout(pnlApply, javax.swing.BoxLayout.LINE_AXIS));
|
||||
|
||||
btnApply.setText("Apply");
|
||||
btnApply.setToolTipText("At least two packs must be selected");
|
||||
btnApply.addActionListener(new java.awt.event.ActionListener() {
|
||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||
btnApplyActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
pnlApply.add(btnApply);
|
||||
|
||||
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
|
||||
getContentPane().setLayout(layout);
|
||||
layout.setHorizontalGroup(
|
||||
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(layout.createSequentialGroup()
|
||||
.addComponent(pnlSelect, javax.swing.GroupLayout.PREFERRED_SIZE, 241, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 300, Short.MAX_VALUE)
|
||||
.addComponent(pnlApply, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
|
||||
.addGroup(layout.createSequentialGroup()
|
||||
.addComponent(pnlPacks, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||
.addContainerGap())
|
||||
);
|
||||
layout.setVerticalGroup(
|
||||
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(layout.createSequentialGroup()
|
||||
.addComponent(pnlPacks, javax.swing.GroupLayout.PREFERRED_SIZE, 372, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addComponent(pnlApply, javax.swing.GroupLayout.PREFERRED_SIZE, 32, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addComponent(pnlSelect, javax.swing.GroupLayout.PREFERRED_SIZE, 32, javax.swing.GroupLayout.PREFERRED_SIZE))
|
||||
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
|
||||
);
|
||||
|
||||
pack();
|
||||
}// </editor-fold>//GEN-END:initComponents
|
||||
|
||||
private void btnAllActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnAllActionPerformed
|
||||
setAllCheckBoxes(true);
|
||||
}//GEN-LAST:event_btnAllActionPerformed
|
||||
|
||||
private void btnNoneActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnNoneActionPerformed
|
||||
setAllCheckBoxes(false);
|
||||
}//GEN-LAST:event_btnNoneActionPerformed
|
||||
|
||||
private void btnApplyActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnApplyActionPerformed
|
||||
if (getSelectedPacks().size() < 2) {
|
||||
// at least 2 packs must be selected.
|
||||
} else {
|
||||
this.setVisible(false);
|
||||
}
|
||||
}//GEN-LAST:event_btnApplyActionPerformed
|
||||
|
||||
private void setAllCheckBoxes(boolean value) {
|
||||
for (Component pack : pnlPacks.getComponents()) {
|
||||
JCheckBox thePack = (JCheckBox) pack;
|
||||
thePack.setSelected(value);
|
||||
}
|
||||
}
|
||||
|
||||
// Variables declaration - do not modify//GEN-BEGIN:variables
|
||||
private javax.swing.JButton btnAll;
|
||||
private javax.swing.JButton btnApply;
|
||||
private javax.swing.JButton btnNone;
|
||||
private javax.swing.JPanel pnlApply;
|
||||
private java.awt.Panel pnlPacks;
|
||||
private javax.swing.JPanel pnlSelect;
|
||||
// End of variables declaration//GEN-END:variables
|
||||
}
|
||||
|
|
@ -34,6 +34,16 @@
|
|||
|
||||
package mage.client.dialog;
|
||||
|
||||
import java.awt.Component;
|
||||
import java.awt.Point;
|
||||
import java.awt.event.MouseEvent;
|
||||
import java.awt.event.MouseListener;
|
||||
import java.io.Serializable;
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
import javax.swing.ImageIcon;
|
||||
import javax.swing.JLayeredPane;
|
||||
import javax.swing.SwingUtilities;
|
||||
import mage.cards.CardDimensions;
|
||||
import mage.client.MageFrame;
|
||||
import mage.client.cards.BigCard;
|
||||
|
|
@ -44,29 +54,29 @@ import mage.client.util.gui.GuiDisplayUtil;
|
|||
import mage.view.CardsView;
|
||||
import mage.view.SimpleCardsView;
|
||||
import org.mage.card.arcane.CardPanel;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
import java.awt.event.MouseEvent;
|
||||
import java.awt.event.MouseListener;
|
||||
import java.io.Serializable;
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
import org.mage.plugins.card.utils.impl.ImageManagerImpl;
|
||||
|
||||
/**
|
||||
* @author BetaSteward_at_googlemail.com
|
||||
*/
|
||||
public class ShowCardsDialog extends MageDialog implements MouseListener {
|
||||
|
||||
private boolean reloaded = false;
|
||||
|
||||
|
||||
// remember if this dialog was already auto positioned, so don't do it after the first time
|
||||
private boolean positioned;
|
||||
|
||||
|
||||
/**
|
||||
* Creates new form ShowCardsDialog
|
||||
*/
|
||||
public ShowCardsDialog() {
|
||||
this.positioned = false;
|
||||
|
||||
this.setDefaultCloseOperation(DISPOSE_ON_CLOSE);
|
||||
initComponents();
|
||||
this.setModal(false);
|
||||
|
||||
}
|
||||
|
||||
public void cleanUp() {
|
||||
|
|
@ -88,7 +98,6 @@ public class ShowCardsDialog extends MageDialog implements MouseListener {
|
|||
}
|
||||
|
||||
public void loadCards(String name, CardsView showCards, BigCard bigCard, CardDimensions dimension, UUID gameId, boolean modal, Map<String, Serializable> options) {
|
||||
this.reloaded = true;
|
||||
this.title = name;
|
||||
this.setTitelBarToolTip(name);
|
||||
cardArea.loadCards(showCards, bigCard, dimension, gameId, this);
|
||||
|
|
@ -106,7 +115,7 @@ public class ShowCardsDialog extends MageDialog implements MouseListener {
|
|||
if (getParent() != MageFrame.getDesktop() /*|| this.isClosed*/) {
|
||||
MageFrame.getDesktop().add(this, JLayeredPane.DEFAULT_LAYER);
|
||||
}
|
||||
pack();
|
||||
pack();
|
||||
|
||||
this.revalidate();
|
||||
this.repaint();
|
||||
|
|
@ -115,26 +124,21 @@ public class ShowCardsDialog extends MageDialog implements MouseListener {
|
|||
SwingUtilities.invokeLater(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
int width = ShowCardsDialog.this.getWidth();
|
||||
int height = ShowCardsDialog.this.getWidth();
|
||||
if (width > 0 && height > 0) {
|
||||
Point centered = SettingsManager.getInstance().getComponentPosition(width, height);
|
||||
ShowCardsDialog.this.setLocation(centered.x, centered.y);
|
||||
GuiDisplayUtil.keepComponentInsideScreen(centered.x, centered.y, ShowCardsDialog.this);
|
||||
if (!positioned) {
|
||||
int width = ShowCardsDialog.this.getWidth();
|
||||
int height = ShowCardsDialog.this.getHeight();
|
||||
if (width > 0 && height > 0) {
|
||||
Point centered = SettingsManager.getInstance().getComponentPosition(width, height);
|
||||
ShowCardsDialog.this.setLocation(centered.x, centered.y);
|
||||
positioned = true;
|
||||
GuiDisplayUtil.keepComponentInsideScreen(centered.x, centered.y, ShowCardsDialog.this);
|
||||
}
|
||||
}
|
||||
ShowCardsDialog.this.setVisible(true);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public boolean isReloaded() {
|
||||
return this.reloaded;
|
||||
}
|
||||
|
||||
public void clearReloaded() {
|
||||
this.reloaded = false;
|
||||
}
|
||||
|
||||
private void initComponents() {
|
||||
|
||||
cardArea = new CardArea();
|
||||
|
|
|
|||
|
|
@ -1,51 +1,54 @@
|
|||
/*
|
||||
* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification, are
|
||||
* permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice, this list of
|
||||
* conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
|
||||
* of conditions and the following disclaimer in the documentation and/or other materials
|
||||
* provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
||||
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* The views and conclusions contained in the software and documentation are those of the
|
||||
* authors and should not be interpreted as representing official policies, either expressed
|
||||
* or implied, of BetaSteward_at_googlemail.com.
|
||||
*/
|
||||
* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification, are
|
||||
* permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice, this list of
|
||||
* conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
|
||||
* of conditions and the following disclaimer in the documentation and/or other materials
|
||||
* provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
||||
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* The views and conclusions contained in the software and documentation are those of the
|
||||
* authors and should not be interpreted as representing official policies, either expressed
|
||||
* or implied, of BetaSteward_at_googlemail.com.
|
||||
*/
|
||||
|
||||
/*
|
||||
* TableWaitingDialog.java
|
||||
*
|
||||
* Created on Dec 16, 2009, 10:27:44 AM
|
||||
*/
|
||||
|
||||
package mage.client.dialog;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
import java.util.concurrent.CancellationException;
|
||||
import java.util.concurrent.ExecutionException;
|
||||
import javax.swing.Icon;
|
||||
import javax.swing.SwingWorker;
|
||||
import javax.swing.table.AbstractTableModel;
|
||||
import mage.client.MageFrame;
|
||||
import mage.client.chat.ChatPanel;
|
||||
import mage.client.components.MageComponents;
|
||||
import mage.client.components.tray.MageTray;
|
||||
import static mage.client.dialog.PreferencesDialog.KEY_TABLE_WAITING_COLUMNS_ORDER;
|
||||
import static mage.client.dialog.PreferencesDialog.KEY_TABLE_WAITING_COLUMNS_WIDTH;
|
||||
import mage.client.util.audio.AudioManager;
|
||||
//import mage.remote.Session;
|
||||
import mage.client.util.gui.TableUtil;
|
||||
import mage.client.util.gui.countryBox.CountryCellRenderer;
|
||||
import mage.view.SeatView;
|
||||
import mage.view.TableView;
|
||||
import org.apache.log4j.Logger;
|
||||
|
|
@ -65,8 +68,11 @@ public class TableWaitingDialog extends MageDialog {
|
|||
private Client client;
|
||||
private final TableWaitModel tableWaitModel;
|
||||
private UpdateSeatsTask updateTask;
|
||||
private static final int[] defaultColumnsWidth = {20, 50, 100, 100};
|
||||
|
||||
/** Creates new form TableWaitingDialog */
|
||||
/**
|
||||
* Creates new form TableWaitingDialog
|
||||
*/
|
||||
public TableWaitingDialog() {
|
||||
|
||||
client = MageFrame.getClient();
|
||||
|
|
@ -74,8 +80,17 @@ public class TableWaitingDialog extends MageDialog {
|
|||
|
||||
initComponents();
|
||||
|
||||
int prefWidth = Integer.parseInt(PreferencesDialog.getCachedValue(PreferencesDialog.KEY_TABLE_WAITING_WIDTH, "500"));
|
||||
int prefHeight = Integer.parseInt(PreferencesDialog.getCachedValue(PreferencesDialog.KEY_TABLE_WAITING_HEIGHT, "400"));
|
||||
if (prefWidth > 40 && prefHeight > 40) {
|
||||
this.setSize(prefWidth, prefHeight);
|
||||
}
|
||||
|
||||
chatPanel.useExtendedView(ChatPanel.VIEW_MODE.NONE);
|
||||
tableSeats.createDefaultColumnsFromModel();
|
||||
TableUtil.setColumnWidthAndOrder(tableSeats, defaultColumnsWidth, KEY_TABLE_WAITING_COLUMNS_WIDTH, KEY_TABLE_WAITING_COLUMNS_ORDER);
|
||||
tableSeats.setDefaultRenderer(Icon.class, new CountryCellRenderer());
|
||||
|
||||
MageFrame.getUI().addButton(MageComponents.TABLE_WAITING_START_BUTTON, btnStart);
|
||||
}
|
||||
|
||||
|
|
@ -98,11 +113,14 @@ public class TableWaitingDialog extends MageDialog {
|
|||
return;
|
||||
}
|
||||
int row = this.tableSeats.getSelectedRow();
|
||||
if (getTitle().equals("Waiting for players")) {
|
||||
this.title = getTitle() + " - " + table.getDeckType() + " / " + table.getGameType();
|
||||
this.repaint();
|
||||
}
|
||||
tableWaitModel.loadData(table);
|
||||
this.tableSeats.repaint();
|
||||
this.tableSeats.getSelectionModel().setSelectionInterval(row, row);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
closeDialog();
|
||||
}
|
||||
} catch (Exception ex) {
|
||||
|
|
@ -132,8 +150,7 @@ public class TableWaitingDialog extends MageDialog {
|
|||
this.setModal(false);
|
||||
this.setLocation(100, 100);
|
||||
this.setVisible(true);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
closeDialog();
|
||||
}
|
||||
}
|
||||
|
|
@ -145,14 +162,15 @@ public class TableWaitingDialog extends MageDialog {
|
|||
this.chatPanel.disconnect();
|
||||
MageFrame.getUI().removeButton(MageComponents.TABLE_WAITING_START_BUTTON);
|
||||
this.removeDialog();
|
||||
TableUtil.saveColumnWidthAndOrderToPrefs(tableSeats, KEY_TABLE_WAITING_COLUMNS_WIDTH, KEY_TABLE_WAITING_COLUMNS_ORDER);
|
||||
PreferencesDialog.saveValue(PreferencesDialog.KEY_TABLE_WAITING_WIDTH, Integer.toString(getWidth()));
|
||||
PreferencesDialog.saveValue(PreferencesDialog.KEY_TABLE_WAITING_HEIGHT, Integer.toString(getHeight()));
|
||||
}
|
||||
|
||||
|
||||
|
||||
/** This method is called from within the constructor to
|
||||
* initialize the form.
|
||||
* WARNING: Do NOT modify this code. The content of this method is
|
||||
* always regenerated by the Form Editor.
|
||||
/**
|
||||
* This method is called from within the constructor to initialize the form.
|
||||
* WARNING: Do NOT modify this code. The content of this method is always
|
||||
* regenerated by the Form Editor.
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
|
||||
|
|
@ -249,12 +267,11 @@ public class TableWaitingDialog extends MageDialog {
|
|||
if (client.startMatch(roomId, tableId)) {
|
||||
closeDialog();
|
||||
}
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
if (client.startTournament(roomId, tableId)) {
|
||||
closeDialog();
|
||||
}
|
||||
}
|
||||
}
|
||||
}//GEN-LAST:event_btnStartActionPerformed
|
||||
|
||||
private void btnCancelActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnCancelActionPerformed
|
||||
|
|
@ -286,7 +303,6 @@ public class TableWaitingDialog extends MageDialog {
|
|||
}
|
||||
}//GEN-LAST:event_btnMoveUpActionPerformed
|
||||
|
||||
|
||||
// Variables declaration - do not modify//GEN-BEGIN:variables
|
||||
private javax.swing.JButton btnCancel;
|
||||
private javax.swing.JButton btnMoveDown;
|
||||
|
|
@ -301,7 +317,8 @@ public class TableWaitingDialog extends MageDialog {
|
|||
}
|
||||
|
||||
class TableWaitModel extends AbstractTableModel {
|
||||
private final String[] columnNames = new String[]{"Seat Num", "Player Name", "Player Type"};
|
||||
|
||||
private final String[] columnNames = new String[]{"Seat", "Loc", "Player Name", "Player Type"};
|
||||
private SeatView[] seats = new SeatView[0];
|
||||
|
||||
public void loadData(TableView table) {
|
||||
|
|
@ -325,14 +342,15 @@ class TableWaitModel extends AbstractTableModel {
|
|||
if (arg1 == 0) {
|
||||
return Integer.toString(arg0 + 1);
|
||||
}
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
switch (arg1) {
|
||||
case 0:
|
||||
return Integer.toString(arg0 + 1);
|
||||
case 1:
|
||||
return seats[arg0].getPlayerName();
|
||||
return seats[arg0].getFlagName();
|
||||
case 2:
|
||||
return seats[arg0].getPlayerName();
|
||||
case 3:
|
||||
return seats[arg0].getPlayerType();
|
||||
}
|
||||
}
|
||||
|
|
@ -351,8 +369,13 @@ class TableWaitModel extends AbstractTableModel {
|
|||
}
|
||||
|
||||
@Override
|
||||
public Class getColumnClass(int columnIndex){
|
||||
return String.class;
|
||||
public Class getColumnClass(int columnIndex) {
|
||||
switch (columnIndex) {
|
||||
case 1:
|
||||
return Icon.class;
|
||||
default:
|
||||
return String.class;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -414,7 +437,7 @@ class UpdateSeatsTask extends SwingWorker<Void, TableView> {
|
|||
private int getPlayersCount(TableView tableView) {
|
||||
int playerCount = 0;
|
||||
if (tableView != null) {
|
||||
for (SeatView seatView: tableView.getSeats()) {
|
||||
for (SeatView seatView : tableView.getSeats()) {
|
||||
if (seatView.getPlayerId() != null && seatView.getPlayerType().equals("Human")) {
|
||||
playerCount++;
|
||||
}
|
||||
|
|
@ -423,7 +446,6 @@ class UpdateSeatsTask extends SwingWorker<Void, TableView> {
|
|||
return playerCount;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected void done() {
|
||||
try {
|
||||
|
|
@ -432,7 +454,8 @@ class UpdateSeatsTask extends SwingWorker<Void, TableView> {
|
|||
logger.fatal("Update Seats Task error", ex);
|
||||
} catch (ExecutionException ex) {
|
||||
logger.fatal("Update Seats Task error", ex);
|
||||
} catch (CancellationException ex) {}
|
||||
} catch (CancellationException ex) {
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -153,9 +153,16 @@ public class DraftPanel extends javax.swing.JPanel {
|
|||
}
|
||||
|
||||
public void updateDraft(DraftView draftView) {
|
||||
this.txtPack1.setText(draftView.getSets().get(0));
|
||||
this.txtPack2.setText(draftView.getSets().get(1));
|
||||
this.txtPack3.setText(draftView.getSets().get(2));
|
||||
if (draftView.getSets().size() != 3){
|
||||
// Random draft
|
||||
this.txtPack1.setText("Random Boosters");
|
||||
this.txtPack2.setText("Random Boosters");
|
||||
this.txtPack3.setText("Random Boosters");
|
||||
}else{
|
||||
this.txtPack1.setText(draftView.getSets().get(0));
|
||||
this.txtPack2.setText(draftView.getSets().get(1));
|
||||
this.txtPack3.setText(draftView.getSets().get(2));
|
||||
}
|
||||
this.chkPack1.setSelected(draftView.getBoosterNum() > 0);
|
||||
this.chkPack2.setSelected(draftView.getBoosterNum() > 1);
|
||||
this.chkPack3.setSelected(draftView.getBoosterNum() > 2);
|
||||
|
|
|
|||
|
|
@ -1,37 +1,36 @@
|
|||
/*
|
||||
* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification, are
|
||||
* permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice, this list of
|
||||
* conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
|
||||
* of conditions and the following disclaimer in the documentation and/or other materials
|
||||
* provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
||||
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* The views and conclusions contained in the software and documentation are those of the
|
||||
* authors and should not be interpreted as representing official policies, either expressed
|
||||
* or implied, of BetaSteward_at_googlemail.com.
|
||||
*/
|
||||
* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification, are
|
||||
* permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice, this list of
|
||||
* conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
|
||||
* of conditions and the following disclaimer in the documentation and/or other materials
|
||||
* provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
||||
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* The views and conclusions contained in the software and documentation are those of the
|
||||
* authors and should not be interpreted as representing official policies, either expressed
|
||||
* or implied, of BetaSteward_at_googlemail.com.
|
||||
*/
|
||||
|
||||
/*
|
||||
* FeedbackPanel.java
|
||||
*
|
||||
* Created on 23-Dec-2009, 9:54:01 PM
|
||||
*/
|
||||
|
||||
package mage.client.game;
|
||||
|
||||
import java.awt.Component;
|
||||
|
|
@ -62,6 +61,7 @@ public class FeedbackPanel extends javax.swing.JPanel {
|
|||
private static final Logger logger = Logger.getLogger(FeedbackPanel.class);
|
||||
|
||||
public enum FeedbackMode {
|
||||
|
||||
INFORM, QUESTION, CONFIRM, CANCEL, SELECT, END
|
||||
}
|
||||
|
||||
|
|
@ -74,7 +74,9 @@ public class FeedbackPanel extends javax.swing.JPanel {
|
|||
|
||||
private static final ScheduledExecutorService worker = Executors.newSingleThreadScheduledExecutor();
|
||||
|
||||
/** Creates new form FeedbackPanel */
|
||||
/**
|
||||
* Creates new form FeedbackPanel
|
||||
*/
|
||||
public FeedbackPanel() {
|
||||
//initComponents();
|
||||
customInitComponents();
|
||||
|
|
@ -171,7 +173,7 @@ public class FeedbackPanel extends javax.swing.JPanel {
|
|||
while (c != null && !(c instanceof GamePane)) {
|
||||
c = c.getParent();
|
||||
}
|
||||
if (c != null && ((GamePane)c).isVisible()) { // check if GamePanel still visible
|
||||
if (c != null && ((GamePane) c).isVisible()) { // check if GamePanel still visible
|
||||
FeedbackPanel.this.btnRight.doClick();
|
||||
}
|
||||
}
|
||||
|
|
@ -182,8 +184,8 @@ public class FeedbackPanel extends javax.swing.JPanel {
|
|||
private void handleOptions(Map<String, Serializable> options) {
|
||||
if (options != null) {
|
||||
if (options.containsKey("UI.right.btn.text")) {
|
||||
this.btnRight.setText((String)options.get("UI.right.btn.text"));
|
||||
this.helper.setRight((String)options.get("UI.right.btn.text"), true);
|
||||
this.btnRight.setText((String) options.get("UI.right.btn.text"));
|
||||
this.helper.setRight((String) options.get("UI.right.btn.text"), true);
|
||||
}
|
||||
if (options.containsKey("dialog")) {
|
||||
connectedDialog = (MageDialog) options.get("dialog");
|
||||
|
|
@ -225,7 +227,7 @@ public class FeedbackPanel extends javax.swing.JPanel {
|
|||
btnUndo = new javax.swing.JButton();
|
||||
btnUndo.setVisible(true);
|
||||
|
||||
setBackground(new java.awt.Color(0,0,0,80));
|
||||
setBackground(new java.awt.Color(0, 0, 0, 80));
|
||||
|
||||
btnRight.setText("Cancel");
|
||||
btnRight.addActionListener(new java.awt.event.ActionListener() {
|
||||
|
|
@ -295,7 +297,7 @@ public class FeedbackPanel extends javax.swing.JPanel {
|
|||
client.sendPlayerString(gameId, "special");
|
||||
}//GEN-LAST:event_btnSpecialActionPerformed
|
||||
|
||||
private void btnUndoActionPerformed(java.awt.event.ActionEvent evt) {
|
||||
private void btnUndoActionPerformed(java.awt.event.ActionEvent evt) {
|
||||
client.sendPlayerAction(PlayerAction.UNDO, gameId, null);
|
||||
}
|
||||
|
||||
|
|
@ -310,7 +312,7 @@ public class FeedbackPanel extends javax.swing.JPanel {
|
|||
public void setConnectedChatPanel(ChatPanel chatPanel) {
|
||||
this.connectedChatPanel = chatPanel;
|
||||
}
|
||||
|
||||
|
||||
public void pressOKYesOrDone() {
|
||||
if (btnLeft.getText().equals("OK") || btnLeft.getText().equals("Yes")) {
|
||||
btnLeft.doClick();
|
||||
|
|
|
|||
|
|
@ -114,6 +114,16 @@ public class GamePane extends MagePane {
|
|||
return gameId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deactivated() {
|
||||
gamePanel.deactivated();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void activated() {
|
||||
gamePanel.activated();
|
||||
}
|
||||
|
||||
private mage.client.game.GamePanel gamePanel;
|
||||
private javax.swing.JScrollPane jScrollPane1;
|
||||
private UUID gameId;
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
|
|
@ -1,40 +1,43 @@
|
|||
/*
|
||||
* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification, are
|
||||
* permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice, this list of
|
||||
* conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
|
||||
* of conditions and the following disclaimer in the documentation and/or other materials
|
||||
* provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
||||
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* The views and conclusions contained in the software and documentation are those of the
|
||||
* authors and should not be interpreted as representing official policies, either expressed
|
||||
* or implied, of BetaSteward_at_googlemail.com.
|
||||
*/
|
||||
|
||||
* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification, are
|
||||
* permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice, this list of
|
||||
* conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
|
||||
* of conditions and the following disclaimer in the documentation and/or other materials
|
||||
* provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
||||
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* The views and conclusions contained in the software and documentation are those of the
|
||||
* authors and should not be interpreted as representing official policies, either expressed
|
||||
* or implied, of BetaSteward_at_googlemail.com.
|
||||
*/
|
||||
package mage.client.game;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.GridBagLayout;
|
||||
import java.awt.event.MouseAdapter;
|
||||
import java.awt.event.MouseEvent;
|
||||
import javax.swing.BoxLayout;
|
||||
import javax.swing.JButton;
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.SwingUtilities;
|
||||
import javax.swing.ToolTipManager;
|
||||
import javax.swing.UIManager;
|
||||
import mage.client.components.MageTextArea;
|
||||
|
||||
/**
|
||||
|
|
@ -58,11 +61,15 @@ public class HelperPanel extends JPanel {
|
|||
private javax.swing.JButton linkSpecial;
|
||||
private javax.swing.JButton linkUndo;
|
||||
|
||||
private final int defaultDismissTimeout = ToolTipManager.sharedInstance().getDismissDelay();
|
||||
private final Object tooltipBackground = UIManager.get("info");
|
||||
|
||||
public HelperPanel() {
|
||||
initComponents();
|
||||
}
|
||||
|
||||
private void initComponents() {
|
||||
|
||||
setBackground(new Color(0, 0, 0, 100));
|
||||
//setLayout(new GridBagLayout());
|
||||
setLayout(new BoxLayout(this, BoxLayout.PAGE_AXIS));
|
||||
|
|
@ -84,7 +91,7 @@ public class HelperPanel extends JPanel {
|
|||
add(jPanel);
|
||||
|
||||
add(container);
|
||||
|
||||
|
||||
btnSpecial = new JButton("Special");
|
||||
btnSpecial.setVisible(false);
|
||||
container.add(btnSpecial);
|
||||
|
|
@ -101,22 +108,24 @@ public class HelperPanel extends JPanel {
|
|||
btnLeft.addActionListener(new java.awt.event.ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||
if (linkLeft != null) {{
|
||||
Thread worker = new Thread(){
|
||||
@Override
|
||||
public void run(){
|
||||
SwingUtilities.invokeLater(new Runnable(){
|
||||
@Override
|
||||
public void run(){
|
||||
setState("",false,"",false);
|
||||
setSpecial("", false);
|
||||
linkLeft.doClick();
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
worker.start();
|
||||
}}
|
||||
if (linkLeft != null) {
|
||||
{
|
||||
Thread worker = new Thread() {
|
||||
@Override
|
||||
public void run() {
|
||||
SwingUtilities.invokeLater(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
setState("", false, "", false);
|
||||
setSpecial("", false);
|
||||
linkLeft.doClick();
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
worker.start();
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
|
@ -124,13 +133,13 @@ public class HelperPanel extends JPanel {
|
|||
@Override
|
||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||
if (linkRight != null) {
|
||||
Thread worker = new Thread(){
|
||||
Thread worker = new Thread() {
|
||||
@Override
|
||||
public void run(){
|
||||
SwingUtilities.invokeLater(new Runnable(){
|
||||
public void run() {
|
||||
SwingUtilities.invokeLater(new Runnable() {
|
||||
@Override
|
||||
public void run(){
|
||||
setState("",false,"",false);
|
||||
public void run() {
|
||||
setState("", false, "", false);
|
||||
setSpecial("", false);
|
||||
linkRight.doClick();
|
||||
}
|
||||
|
|
@ -145,42 +154,61 @@ public class HelperPanel extends JPanel {
|
|||
btnSpecial.addActionListener(new java.awt.event.ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||
if (linkSpecial != null) {{
|
||||
Thread worker = new Thread(){
|
||||
@Override
|
||||
public void run(){
|
||||
SwingUtilities.invokeLater(new Runnable(){
|
||||
@Override
|
||||
public void run(){
|
||||
setState("",false,"",false);
|
||||
setSpecial("", false);
|
||||
linkSpecial.doClick();
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
worker.start();
|
||||
}}
|
||||
if (linkSpecial != null) {
|
||||
{
|
||||
Thread worker = new Thread() {
|
||||
@Override
|
||||
public void run() {
|
||||
SwingUtilities.invokeLater(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
setState("", false, "", false);
|
||||
setSpecial("", false);
|
||||
linkSpecial.doClick();
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
worker.start();
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
btnUndo.addActionListener(new java.awt.event.ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||
if (linkUndo != null) {{
|
||||
Thread worker = new Thread(){
|
||||
@Override
|
||||
public void run(){
|
||||
SwingUtilities.invokeLater(new Runnable(){
|
||||
@Override
|
||||
public void run(){
|
||||
linkUndo.doClick();
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
worker.start();
|
||||
}}
|
||||
if (linkUndo != null) {
|
||||
{
|
||||
Thread worker = new Thread() {
|
||||
@Override
|
||||
public void run() {
|
||||
SwingUtilities.invokeLater(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
linkUndo.doClick();
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
worker.start();
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
textArea.addMouseListener(new MouseAdapter() {
|
||||
|
||||
@Override
|
||||
public void mouseEntered(MouseEvent me) {
|
||||
ToolTipManager.sharedInstance().setDismissDelay(100000);
|
||||
UIManager.put("info", Color.DARK_GRAY);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void mouseExited(MouseEvent me) {
|
||||
ToolTipManager.sharedInstance().setDismissDelay(defaultDismissTimeout);
|
||||
UIManager.put("info", tooltipBackground);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
@ -218,19 +246,20 @@ public class HelperPanel extends JPanel {
|
|||
this.linkSpecial = special;
|
||||
this.linkUndo = undo;
|
||||
}
|
||||
|
||||
|
||||
public void setMessage(String message) {
|
||||
if (message.startsWith("Use alternative cost")) {
|
||||
message = "Use alternative cost?";
|
||||
} else if (message.contains("Use ")) {
|
||||
if (message.length() < this.getWidth() / 10) {
|
||||
message = getSmallText(message);
|
||||
} else {
|
||||
message = "Use ability?" + getSmallText(message.substring(this.getWidth() / 10));
|
||||
}
|
||||
}
|
||||
textArea.setText(message);
|
||||
// if (message.startsWith("Use alternative cost")) {
|
||||
// message = "Use alternative cost?";
|
||||
// } else if (message.contains("Use ")) {
|
||||
// if (message.length() < this.getWidth() / 10) {
|
||||
// message = getSmallText(message);
|
||||
// } else {
|
||||
// message = "Use ability?" + getSmallText(message.substring(0, this.getWidth() / 10));
|
||||
// }
|
||||
// }
|
||||
textArea.setText(message, this.getWidth());
|
||||
}
|
||||
|
||||
protected String getSmallText(String text) {
|
||||
return "<div style='font-size:11pt'>" + text + "</div>";
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,30 +1,30 @@
|
|||
/*
|
||||
* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification, are
|
||||
* permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice, this list of
|
||||
* conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
|
||||
* of conditions and the following disclaimer in the documentation and/or other materials
|
||||
* provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
||||
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* The views and conclusions contained in the software and documentation are those of the
|
||||
* authors and should not be interpreted as representing official policies, either expressed
|
||||
* or implied, of BetaSteward_at_googlemail.com.
|
||||
*/
|
||||
* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification, are
|
||||
* permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice, this list of
|
||||
* conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
|
||||
* of conditions and the following disclaimer in the documentation and/or other materials
|
||||
* provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
||||
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* The views and conclusions contained in the software and documentation are those of the
|
||||
* authors and should not be interpreted as representing official policies, either expressed
|
||||
* or implied, of BetaSteward_at_googlemail.com.
|
||||
*/
|
||||
package mage.client.game;
|
||||
|
||||
import java.awt.Color;
|
||||
|
|
@ -37,7 +37,6 @@ import java.awt.event.MouseEvent;
|
|||
import java.awt.event.MouseListener;
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.UUID;
|
||||
|
||||
import javax.swing.BorderFactory;
|
||||
import javax.swing.GroupLayout;
|
||||
import javax.swing.GroupLayout.Alignment;
|
||||
|
|
@ -72,21 +71,23 @@ public class PlayAreaPanel extends javax.swing.JPanel {
|
|||
private boolean playingMode = true;
|
||||
private final GamePanel gamePanel;
|
||||
private final PlayAreaPanelOptions options;
|
||||
|
||||
|
||||
private JCheckBoxMenuItem manaPoolMenuItem1;
|
||||
private JCheckBoxMenuItem manaPoolMenuItem2;
|
||||
private JCheckBoxMenuItem allowViewHandCardsMenuItem;
|
||||
|
||||
|
||||
public static final int PANEL_HEIGHT = 242;
|
||||
public static final int PANEL_HEIGHT_SMALL = 190;
|
||||
|
||||
/** Creates new form PlayAreaPanel
|
||||
/**
|
||||
* Creates new form PlayAreaPanel
|
||||
*
|
||||
* @param player
|
||||
* @param bigCard
|
||||
* @param gameId
|
||||
* @param priorityTime
|
||||
* @param gamePanel
|
||||
* @param options
|
||||
* @param options
|
||||
*/
|
||||
public PlayAreaPanel(PlayerView player, BigCard bigCard, UUID gameId, int priorityTime, GamePanel gamePanel, PlayAreaPanelOptions options) {
|
||||
this.gamePanel = gamePanel;
|
||||
|
|
@ -97,7 +98,7 @@ public class PlayAreaPanel extends javax.swing.JPanel {
|
|||
|
||||
popupMenu = new JPopupMenu();
|
||||
if (options.isPlayer) {
|
||||
addPopupMenuPlayer(player.getUserData().allowRequestShowHandCards());
|
||||
addPopupMenuPlayer(player.getUserData().isAllowRequestShowHandCards());
|
||||
} else {
|
||||
addPopupMenuWatcher();
|
||||
}
|
||||
|
|
@ -109,15 +110,14 @@ public class PlayAreaPanel extends javax.swing.JPanel {
|
|||
public void CleanUp() {
|
||||
battlefieldPanel.cleanUp();
|
||||
playerPanel.cleanUp();
|
||||
|
||||
|
||||
for (ActionListener al : btnCheat.getActionListeners() ) {
|
||||
for (ActionListener al : btnCheat.getActionListeners()) {
|
||||
btnCheat.removeActionListener(al);
|
||||
}
|
||||
|
||||
|
||||
// Taken form : https://community.oracle.com/thread/2183145
|
||||
// removed the internal focus of a popupMenu data to allow GC before another popup menu is selected
|
||||
for(ChangeListener listener : MenuSelectionManager.defaultManager().getChangeListeners()) {
|
||||
for (ChangeListener listener : MenuSelectionManager.defaultManager().getChangeListeners()) {
|
||||
if (listener.getClass().getName().contains("MenuKeyboardHelper")) {
|
||||
try {
|
||||
Field field = listener.getClass().getDeclaredField("menuInputMap");
|
||||
|
|
@ -130,7 +130,7 @@ public class PlayAreaPanel extends javax.swing.JPanel {
|
|||
}
|
||||
}
|
||||
|
||||
for (MouseListener ml :battlefieldPanel.getMainPanel().getMouseListeners()) {
|
||||
for (MouseListener ml : battlefieldPanel.getMainPanel().getMouseListeners()) {
|
||||
battlefieldPanel.getMainPanel().removeMouseListener(ml);
|
||||
}
|
||||
popupMenu.getUI().uninstallUI(this);
|
||||
|
|
@ -170,11 +170,11 @@ public class PlayAreaPanel extends javax.swing.JPanel {
|
|||
case "F9": {
|
||||
gamePanel.getClient().sendPlayerAction(PlayerAction.PASS_PRIORITY_UNTIL_MY_NEXT_TURN, gameId, null);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
menuItem = new JMenuItem("<html><b>F2</b> - Confirm current request");
|
||||
menuItem.setActionCommand("F2");
|
||||
menuItem.setMnemonic(KeyEvent.VK_O);
|
||||
|
|
@ -187,11 +187,10 @@ public class PlayAreaPanel extends javax.swing.JPanel {
|
|||
popupMenu.add(menuItem);
|
||||
menuItem.addActionListener(skipListener);
|
||||
|
||||
|
||||
JMenu skipMenu = new JMenu("Skip");
|
||||
skipMenu.setMnemonic(KeyEvent.VK_S);
|
||||
popupMenu.add(skipMenu);
|
||||
|
||||
|
||||
String tooltipText = "<html>This skip actions stops if something goes to <br><b>stack</b> and if <b>attackers</b> or <b>blocker</b> have to be <b>declared</b>.";
|
||||
menuItem = new JMenuItem("<html><b>F4</b> - Phases until next turn");
|
||||
menuItem.setActionCommand("F4");
|
||||
|
|
@ -213,7 +212,7 @@ public class PlayAreaPanel extends javax.swing.JPanel {
|
|||
menuItem.setMnemonic(KeyEvent.VK_M);
|
||||
skipMenu.add(menuItem);
|
||||
menuItem.addActionListener(skipListener);
|
||||
|
||||
|
||||
menuItem = new JMenuItem("<html><b>F9</b> - Everything until your own next turn");
|
||||
menuItem.setActionCommand("F9");
|
||||
menuItem.setToolTipText(tooltipText);
|
||||
|
|
@ -222,24 +221,24 @@ public class PlayAreaPanel extends javax.swing.JPanel {
|
|||
menuItem.addActionListener(skipListener);
|
||||
|
||||
popupMenu.addSeparator();
|
||||
|
||||
|
||||
JMenu manaPoolMenu = new JMenu("Mana payment");
|
||||
manaPoolMenu.setMnemonic(KeyEvent.VK_M);
|
||||
manaPoolMenu.setMnemonic(KeyEvent.VK_M);
|
||||
popupMenu.add(manaPoolMenu);
|
||||
|
||||
|
||||
manaPoolMenuItem1 = new JCheckBoxMenuItem("Automatically", true);
|
||||
manaPoolMenuItem1.setMnemonic(KeyEvent.VK_A);
|
||||
manaPoolMenuItem1.setToolTipText("<html>If not active, produced mana goes only to the mana pool<br>"
|
||||
+ "and you have to click the type of mana you want to use <br>"
|
||||
+ "in the player mana pool panel for payment.");
|
||||
+ "and you have to click the type of mana you want to use <br>"
|
||||
+ "in the player mana pool panel for payment.");
|
||||
manaPoolMenu.add(manaPoolMenuItem1);
|
||||
|
||||
// Auto pay mana from mana pool
|
||||
manaPoolMenuItem1.addActionListener(new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
boolean manaPoolAutomatic = ((JCheckBoxMenuItem)e.getSource()).getState();
|
||||
PreferencesDialog.saveValue(KEY_GAME_MANA_AUTOPAYMENT, manaPoolAutomatic ? "true": "false");
|
||||
boolean manaPoolAutomatic = ((JCheckBoxMenuItem) e.getSource()).getState();
|
||||
PreferencesDialog.saveValue(KEY_GAME_MANA_AUTOPAYMENT, manaPoolAutomatic ? "true" : "false");
|
||||
gamePanel.setMenuStates(manaPoolAutomatic, manaPoolMenuItem2.getState());
|
||||
gamePanel.getClient().sendPlayerAction(manaPoolAutomatic ? PlayerAction.MANA_AUTO_PAYMENT_ON: PlayerAction.MANA_AUTO_PAYMENT_OFF, gameId, null);
|
||||
}
|
||||
|
|
@ -247,16 +246,16 @@ public class PlayAreaPanel extends javax.swing.JPanel {
|
|||
manaPoolMenuItem2 = new JCheckBoxMenuItem("No automatic usage for mana already in the pool", true);
|
||||
manaPoolMenuItem2.setMnemonic(KeyEvent.VK_N);
|
||||
manaPoolMenuItem2.setToolTipText("<html>Mana that is already in the mana pool as you start casting a spell or activating an ability<br>"
|
||||
+ " needs to be payed manually. So you use the mana in the pool only by clicking on the related<br>"
|
||||
+ " mana symbols of mana pool area.");
|
||||
+ " needs to be payed manually. So you use the mana in the pool only by clicking on the related<br>"
|
||||
+ " mana symbols of mana pool area.");
|
||||
manaPoolMenu.add(manaPoolMenuItem2);
|
||||
|
||||
// Auto pay mana from mana pool
|
||||
manaPoolMenuItem2.addActionListener(new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
boolean manaPoolAutomaticRestricted = ((JCheckBoxMenuItem)e.getSource()).getState();
|
||||
PreferencesDialog.saveValue(KEY_GAME_MANA_AUTOPAYMENT_ONLY_ONE, manaPoolAutomaticRestricted ? "true": "false");
|
||||
boolean manaPoolAutomaticRestricted = ((JCheckBoxMenuItem) e.getSource()).getState();
|
||||
PreferencesDialog.saveValue(KEY_GAME_MANA_AUTOPAYMENT_ONLY_ONE, manaPoolAutomaticRestricted ? "true" : "false");
|
||||
gamePanel.setMenuStates(manaPoolMenuItem1.getState(), manaPoolAutomaticRestricted);
|
||||
gamePanel.getClient().sendPlayerAction(manaPoolAutomaticRestricted ? PlayerAction.MANA_AUTO_PAYMENT_RESTRICTED_ON: PlayerAction.MANA_AUTO_PAYMENT_RESTRICTED_OFF, gameId, null);
|
||||
}
|
||||
|
|
@ -265,7 +264,7 @@ public class PlayAreaPanel extends javax.swing.JPanel {
|
|||
JMenu automaticConfirmsMenu = new JMenu("Automatic confirms");
|
||||
automaticConfirmsMenu.setMnemonic(KeyEvent.VK_U);
|
||||
popupMenu.add(automaticConfirmsMenu);
|
||||
|
||||
|
||||
menuItem = new JMenuItem("Replacement effects - reset auto select");
|
||||
menuItem.setMnemonic(KeyEvent.VK_R);
|
||||
menuItem.setToolTipText("Reset all effects that were added to the list of auto select replacement effects this game.");
|
||||
|
|
@ -281,7 +280,7 @@ public class PlayAreaPanel extends javax.swing.JPanel {
|
|||
JMenu handCardsMenu = new JMenu("Cards on hand");
|
||||
handCardsMenu.setMnemonic(KeyEvent.VK_H);
|
||||
popupMenu.add(handCardsMenu);
|
||||
|
||||
|
||||
if (!options.playerItself) {
|
||||
menuItem = new JMenuItem("Request permission to see the hand cards");
|
||||
menuItem.setMnemonic(KeyEvent.VK_P);
|
||||
|
|
@ -304,7 +303,7 @@ public class PlayAreaPanel extends javax.swing.JPanel {
|
|||
allowViewHandCardsMenuItem.addActionListener(new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
boolean requestsAllowed = ((JCheckBoxMenuItem)e.getSource()).getState();
|
||||
boolean requestsAllowed = ((JCheckBoxMenuItem) e.getSource()).getState();
|
||||
PreferencesDialog.setPrefValue(KEY_GAME_ALLOW_REQUEST_SHOW_HAND_CARDS, requestsAllowed);
|
||||
gamePanel.getClient().sendPlayerAction(requestsAllowed ? PlayerAction.PERMISSION_REQUESTS_ALLOWED_ON: PlayerAction.PERMISSION_REQUESTS_ALLOWED_OFF, gameId, null);
|
||||
}
|
||||
|
|
@ -323,7 +322,7 @@ public class PlayAreaPanel extends javax.swing.JPanel {
|
|||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
if (options.rollbackTurnsAllowed) {
|
||||
ActionListener rollBackActionListener = new ActionListener() {
|
||||
@Override
|
||||
|
|
@ -332,44 +331,42 @@ public class PlayAreaPanel extends javax.swing.JPanel {
|
|||
gamePanel.getClient().sendPlayerAction(PlayerAction.ROLLBACK_TURNS, gameId, turnsToRollBack);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
JMenu rollbackMainItem = new JMenu("Roll back");
|
||||
rollbackMainItem.setMnemonic(KeyEvent.VK_R);
|
||||
rollbackMainItem.setToolTipText("The game will be rolled back to the start of the requested turn if all players agree.");
|
||||
popupMenu.add(rollbackMainItem);
|
||||
|
||||
|
||||
menuItem = new JMenuItem("To the start of the current turn");
|
||||
menuItem.setMnemonic(KeyEvent.VK_C);
|
||||
menuItem.setActionCommand("0");
|
||||
menuItem.addActionListener(rollBackActionListener);
|
||||
menuItem.addActionListener(rollBackActionListener);
|
||||
rollbackMainItem.add(menuItem);
|
||||
|
||||
|
||||
menuItem = new JMenuItem("To the start of the previous turn");
|
||||
menuItem.setMnemonic(KeyEvent.VK_P);
|
||||
menuItem.setActionCommand("1");
|
||||
menuItem.addActionListener(rollBackActionListener);
|
||||
menuItem.addActionListener(rollBackActionListener);
|
||||
rollbackMainItem.add(menuItem);
|
||||
|
||||
menuItem = new JMenuItem("The current turn and the 2 turns before");
|
||||
menuItem.setMnemonic(KeyEvent.VK_2);
|
||||
menuItem.setActionCommand("2");
|
||||
menuItem.addActionListener(rollBackActionListener);
|
||||
menuItem.addActionListener(rollBackActionListener);
|
||||
rollbackMainItem.add(menuItem);
|
||||
|
||||
menuItem = new JMenuItem("The current turn and the 3 turns before");
|
||||
menuItem.setMnemonic(KeyEvent.VK_3);
|
||||
menuItem.setActionCommand("3");
|
||||
menuItem.addActionListener(rollBackActionListener);
|
||||
menuItem.addActionListener(rollBackActionListener);
|
||||
rollbackMainItem.add(menuItem);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
JMenu concedeMenu = new JMenu("Concede");
|
||||
concedeMenu.setMnemonic(KeyEvent.VK_C);
|
||||
popupMenu.add(concedeMenu);
|
||||
|
||||
|
||||
ActionListener concedeListener = new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
|
|
@ -377,19 +374,19 @@ public class PlayAreaPanel extends javax.swing.JPanel {
|
|||
case "Game": {
|
||||
if (JOptionPane.showConfirmDialog(PlayAreaPanel.this, "Are you sure you want to concede the game?", "Confirm concede game", JOptionPane.YES_NO_OPTION) == JOptionPane.YES_OPTION) {
|
||||
MageFrame.getClient().sendPlayerAction(PlayerAction.CONCEDE, gameId, null);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case "Match": {
|
||||
if (JOptionPane.showConfirmDialog(PlayAreaPanel.this, "Are you sure you want to concede the complete match?", "Confirm concede match", JOptionPane.YES_NO_OPTION) == JOptionPane.YES_OPTION) {
|
||||
MageFrame.getClient().quitMatch(gameId);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
// Concede Game
|
||||
menuItem = new JMenuItem("Game");
|
||||
menuItem.setMnemonic(KeyEvent.VK_G);
|
||||
|
|
@ -397,7 +394,7 @@ public class PlayAreaPanel extends javax.swing.JPanel {
|
|||
menuItem.setToolTipText("Concedes only the current game and after that the next game of the match is started if there is another game needed.");
|
||||
concedeMenu.add(menuItem);
|
||||
menuItem.addActionListener(concedeListener);
|
||||
|
||||
|
||||
// Concede Match
|
||||
menuItem = new JMenuItem("Match");
|
||||
menuItem.setMnemonic(KeyEvent.VK_M);
|
||||
|
|
@ -406,20 +403,19 @@ public class PlayAreaPanel extends javax.swing.JPanel {
|
|||
concedeMenu.add(menuItem);
|
||||
menuItem.addActionListener(concedeListener);
|
||||
|
||||
|
||||
battlefieldPanel.getMainPanel().addMouseListener(new MouseAdapter() {
|
||||
@Override
|
||||
public void mouseReleased(MouseEvent Me) {
|
||||
this.checkMenu(Me);
|
||||
}
|
||||
|
||||
|
||||
// neccessary for linux and mac systems
|
||||
@Override
|
||||
public void mousePressed(MouseEvent Me) {
|
||||
this.checkMenu(Me);
|
||||
}
|
||||
|
||||
private void checkMenu(MouseEvent Me){
|
||||
private void checkMenu(MouseEvent Me) {
|
||||
if (Me.isPopupTrigger() && playingMode) {
|
||||
popupMenu.show(Me.getComponent(), Me.getX(), Me.getY());
|
||||
}
|
||||
|
|
@ -461,13 +457,14 @@ public class PlayAreaPanel extends javax.swing.JPanel {
|
|||
public void mouseReleased(MouseEvent Me) {
|
||||
this.checkMenu(Me);
|
||||
}
|
||||
|
||||
// neccessary for linux and mac systems
|
||||
@Override
|
||||
public void mousePressed(MouseEvent Me) {
|
||||
this.checkMenu(Me);
|
||||
}
|
||||
|
||||
private void checkMenu(MouseEvent Me){
|
||||
private void checkMenu(MouseEvent Me) {
|
||||
if (Me.isPopupTrigger() && playingMode) {
|
||||
popupMenu.show(Me.getComponent(), Me.getX(), Me.getY());
|
||||
}
|
||||
|
|
@ -483,8 +480,7 @@ public class PlayAreaPanel extends javax.swing.JPanel {
|
|||
if (MageFrame.getClient().getServerState().isTestMode()) {
|
||||
this.playerId = player.getPlayerId();
|
||||
this.btnCheat.setVisible(true);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
this.btnCheat.setVisible(false);
|
||||
}
|
||||
}
|
||||
|
|
@ -493,7 +489,7 @@ public class PlayAreaPanel extends javax.swing.JPanel {
|
|||
this.playerPanel.update(player);
|
||||
this.battlefieldPanel.update(player.getBattlefield());
|
||||
if (this.allowViewHandCardsMenuItem != null) {
|
||||
this.allowViewHandCardsMenuItem.setSelected(player.getUserData().allowRequestShowHandCards());
|
||||
this.allowViewHandCardsMenuItem.setSelected(player.getUserData().isAllowRequestShowHandCards());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -506,7 +502,7 @@ public class PlayAreaPanel extends javax.swing.JPanel {
|
|||
}
|
||||
|
||||
private void initComponents() {
|
||||
setBorder(BorderFactory.createLineBorder(new Color(0,0,0,0)));
|
||||
setBorder(BorderFactory.createLineBorder(new Color(0, 0, 0, 0)));
|
||||
playerPanel = new PlayerPanelExt();
|
||||
btnCheat = new javax.swing.JButton();
|
||||
//jScrollPane1 = new javax.swing.JScrollPane();
|
||||
|
|
@ -525,16 +521,15 @@ public class PlayAreaPanel extends javax.swing.JPanel {
|
|||
//Border empty = new EmptyBorder(0,0,0,0);
|
||||
//jScrollPane1.setBorder(empty);
|
||||
//jScrollPane1.setViewportBorder(empty);
|
||||
|
||||
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
|
||||
layout.setHorizontalGroup(
|
||||
layout.createSequentialGroup()
|
||||
layout.createSequentialGroup()
|
||||
.addComponent(playerPanel, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
|
||||
.addPreferredGap(ComponentPlacement.RELATED)
|
||||
.addComponent(battlefieldPanel, 0, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||
);
|
||||
layout.setVerticalGroup(
|
||||
layout.createParallelGroup(Alignment.LEADING)
|
||||
layout.createParallelGroup(Alignment.LEADING)
|
||||
.addComponent(playerPanel, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
|
||||
.addComponent(battlefieldPanel, GroupLayout.DEFAULT_SIZE, 160, Short.MAX_VALUE)
|
||||
);
|
||||
|
|
@ -548,8 +543,7 @@ public class PlayAreaPanel extends javax.swing.JPanel {
|
|||
this.playerPanel.setPreferredSize(new Dimension(92, PANEL_HEIGHT_SMALL));
|
||||
//this.jScrollPane1.setPreferredSize(new Dimension(160, 160));
|
||||
this.battlefieldPanel.setPreferredSize(new Dimension(160, PANEL_HEIGHT_SMALL));
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
this.playerPanel.setPreferredSize(new Dimension(92, PANEL_HEIGHT));
|
||||
//this.jScrollPane1.setPreferredSize(new Dimension(160, 212));
|
||||
this.battlefieldPanel.setPreferredSize(new Dimension(160, PANEL_HEIGHT));
|
||||
|
|
@ -576,7 +570,7 @@ public class PlayAreaPanel extends javax.swing.JPanel {
|
|||
manaPoolMenuItem2.setSelected(manaPoolAutomaticRestricted);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private mage.client.game.BattlefieldPanel battlefieldPanel;
|
||||
private javax.swing.JButton btnCheat;
|
||||
//private javax.swing.JScrollPane jScrollPane1;
|
||||
|
|
|
|||
|
|
@ -1,61 +1,78 @@
|
|||
/*
|
||||
* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification, are
|
||||
* permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice, this list of
|
||||
* conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
|
||||
* of conditions and the following disclaimer in the documentation and/or other materials
|
||||
* provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
||||
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* The views and conclusions contained in the software and documentation are those of the
|
||||
* authors and should not be interpreted as representing official policies, either expressed
|
||||
* or implied, of BetaSteward_at_googlemail.com.
|
||||
*/
|
||||
* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification, are
|
||||
* permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice, this list of
|
||||
* conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
|
||||
* of conditions and the following disclaimer in the documentation and/or other materials
|
||||
* provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
||||
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* The views and conclusions contained in the software and documentation are those of the
|
||||
* authors and should not be interpreted as representing official policies, either expressed
|
||||
* or implied, of BetaSteward_at_googlemail.com.
|
||||
*/
|
||||
|
||||
/*
|
||||
* PlayerPanel.java
|
||||
*
|
||||
* Created on Nov 18, 2009, 3:01:31 PM
|
||||
*/
|
||||
|
||||
package mage.client.game;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.Font;
|
||||
import java.awt.GridLayout;
|
||||
import java.awt.Image;
|
||||
import java.awt.Rectangle;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
import java.awt.image.BufferedImage;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
import javax.swing.BorderFactory;
|
||||
import javax.swing.GroupLayout;
|
||||
import javax.swing.GroupLayout.Alignment;
|
||||
import javax.swing.ImageIcon;
|
||||
import javax.swing.JButton;
|
||||
import javax.swing.JLabel;
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.LayoutStyle.ComponentPlacement;
|
||||
import javax.swing.SwingConstants;
|
||||
import javax.swing.border.Border;
|
||||
import javax.swing.border.LineBorder;
|
||||
import mage.MageException;
|
||||
import mage.cards.MageCard;
|
||||
import mage.cards.action.ActionCallback;
|
||||
import mage.cards.decks.importer.DckDeckImporter;
|
||||
import mage.cards.repository.CardRepository;
|
||||
import mage.client.MageFrame;
|
||||
import mage.client.cards.BigCard;
|
||||
import mage.client.components.HoverButton;
|
||||
import mage.client.components.MageRoundPane;
|
||||
import mage.client.components.ext.dlg.DialogManager;
|
||||
import mage.client.dialog.PreferencesDialog;
|
||||
import mage.client.plugins.adapters.MageActionCallback;
|
||||
import mage.client.plugins.impl.Plugins;
|
||||
import mage.client.util.CardsViewUtil;
|
||||
import mage.client.util.Command;
|
||||
import mage.client.util.ImageHelper;
|
||||
import mage.client.util.gui.BufferedImageBuilder;
|
||||
import mage.client.util.gui.countryBox.CountryUtil;
|
||||
import mage.components.ImagePanel;
|
||||
import mage.constants.ManaType;
|
||||
//import mage.remote.Session;
|
||||
import mage.utils.timer.PriorityTimer;
|
||||
import mage.view.CardView;
|
||||
import mage.view.ManaPoolView;
|
||||
import mage.view.PlayerView;
|
||||
import org.mage.card.arcane.ManaSymbols;
|
||||
|
|
@ -90,26 +107,26 @@ public class PlayerPanelExt extends javax.swing.JPanel {
|
|||
private BigCard bigCard;
|
||||
|
||||
private static final int AVATAR_COUNT = 77;
|
||||
|
||||
|
||||
private static final String DEFAULT_AVATAR_PATH = "/avatars/51.jpg";
|
||||
|
||||
|
||||
private static final int PANEL_WIDTH = 94;
|
||||
private static final int PANEL_HEIGHT = 242;
|
||||
private static final int PANEL_HEIGHT_SMALL = 212;
|
||||
private static final int MANA_LABEL_SIZE_HORIZONTAL = 20;
|
||||
|
||||
|
||||
private static final Border greenBorder = new LineBorder(Color.green, 3);
|
||||
private static final Border redBorder = new LineBorder(Color.red, 2);
|
||||
private static final Border emptyBorder = BorderFactory.createEmptyBorder(0,0,0,0);
|
||||
private static final Border emptyBorder = BorderFactory.createEmptyBorder(0, 0, 0, 0);
|
||||
|
||||
private static final Dimension topCardDimension = new Dimension(40, 56);
|
||||
|
||||
private int avatarId = -1;
|
||||
private String flagName = "";
|
||||
|
||||
private PriorityTimer timer;
|
||||
|
||||
/** Creates new form PlayerPanel */
|
||||
/**
|
||||
* Creates new form PlayerPanel
|
||||
*/
|
||||
public PlayerPanelExt() {
|
||||
setPreferredSize(new Dimension(PANEL_WIDTH, PANEL_HEIGHT));
|
||||
initComponents();
|
||||
|
|
@ -151,7 +168,6 @@ public class PlayerPanelExt extends javax.swing.JPanel {
|
|||
if (timer != null) {
|
||||
this.timer.cancel();
|
||||
}
|
||||
topCardPanel.updateCallback(null, gameId);
|
||||
}
|
||||
|
||||
public void update(PlayerView player) {
|
||||
|
|
@ -236,6 +252,11 @@ public class PlayerPanelExt extends javax.swing.JPanel {
|
|||
BufferedImage resized = ImageHelper.getResizedImage(BufferedImageBuilder.bufferImage(image, BufferedImage.TYPE_INT_ARGB), r);
|
||||
this.avatar.update("player", resized, resized, resized, resized, r);
|
||||
}
|
||||
if (!player.getUserData().getFlagName().equals(flagName)) {
|
||||
flagName = player.getUserData().getFlagName();
|
||||
this.avatarFlag.setIcon(CountryUtil.getCountryFlagIcon(flagName));
|
||||
avatar.repaint();
|
||||
}
|
||||
}
|
||||
this.avatar.setText(player.getName());
|
||||
if (this.timer != null) {
|
||||
|
|
@ -264,26 +285,6 @@ public class PlayerPanelExt extends javax.swing.JPanel {
|
|||
this.avatar.setBorder(emptyBorder);
|
||||
this.btnPlayer.setBorder(emptyBorder);
|
||||
}
|
||||
|
||||
|
||||
synchronized (this) {
|
||||
if (player.getTopCard() != null) {
|
||||
if (topCard == null || !topCard.getId().equals(player.getTopCard().getId())) {
|
||||
if (topCard == null) {
|
||||
topCardPanel.setVisible(true);
|
||||
}
|
||||
topCard = player.getTopCard();
|
||||
topCardPanel.update(topCard);
|
||||
topCardPanel.updateImage();
|
||||
ActionCallback callback = Plugins.getInstance().getActionCallback();
|
||||
((MageActionCallback)callback).refreshSession();
|
||||
topCardPanel.updateCallback(callback, gameId);
|
||||
}
|
||||
} else if (topCard != null) {
|
||||
topCard = null;
|
||||
topCardPanel.setVisible(false);
|
||||
}
|
||||
}
|
||||
|
||||
update(player.getManaPool());
|
||||
}
|
||||
|
|
@ -297,7 +298,7 @@ public class PlayerPanelExt extends javax.swing.JPanel {
|
|||
int h = priorityTimeLeft / 3600;
|
||||
int m = (priorityTimeLeft % 3600) / 60;
|
||||
int s = priorityTimeLeft % 60;
|
||||
return (h < 10 ? "0" : "") + h + ":" + (m < 10 ? "0" : "") + m + ":" + (s < 10 ? "0" : "") + s;
|
||||
return (h < 10 ? "0" : "") + h + ":" + (m < 10 ? "0" : "") + m + ":" + (s < 10 ? "0" : "") + s;
|
||||
}
|
||||
|
||||
protected void update(ManaPoolView pool) {
|
||||
|
|
@ -309,10 +310,10 @@ public class PlayerPanelExt extends javax.swing.JPanel {
|
|||
manaLabels.get("X").setText(Integer.toString(pool.getColorless()));
|
||||
}
|
||||
|
||||
/** This method is called from within the constructor to
|
||||
* initialize the form.
|
||||
* WARNING: Do NOT modify this code. The content of this method is
|
||||
* always regenerated by the Form Editor.
|
||||
/**
|
||||
* This method is called from within the constructor to initialize the form.
|
||||
* WARNING: Do NOT modify this code. The content of this method is always
|
||||
* regenerated by the Form Editor.
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
private void initComponents() {
|
||||
|
|
@ -320,10 +321,12 @@ public class PlayerPanelExt extends javax.swing.JPanel {
|
|||
panelBackground = new MageRoundPane();
|
||||
panelBackground.setPreferredSize(new Dimension(PANEL_WIDTH - 2, PANEL_HEIGHT));
|
||||
Rectangle r = new Rectangle(80, 80);
|
||||
avatarFlag = new JLabel();
|
||||
timerLabel = new JLabel();
|
||||
lifeLabel = new JLabel();
|
||||
handLabel = new JLabel();
|
||||
poisonLabel = new JLabel();
|
||||
graveLabel = new JLabel();
|
||||
libraryLabel = new JLabel();
|
||||
setOpaque(false);
|
||||
|
||||
|
|
@ -334,12 +337,16 @@ public class PlayerPanelExt extends javax.swing.JPanel {
|
|||
// Avatar
|
||||
Image image = ImageHelper.getImageFromResources(DEFAULT_AVATAR_PATH);
|
||||
|
||||
topCardPanel = Plugins.getInstance().getMageCard(new CardView(CardRepository.instance.findCard("Forest").getMockCard()), bigCard, topCardDimension, gameId, true);
|
||||
topCardPanel.setVisible(false);
|
||||
panelBackground.add(topCardPanel);
|
||||
|
||||
BufferedImage resized = ImageHelper.getResizedImage(BufferedImageBuilder.bufferImage(image, BufferedImage.TYPE_INT_ARGB), r);
|
||||
avatar = new HoverButton("player", resized, resized, resized, r);
|
||||
avatar.setLayout(new GridLayout(4, 1, 0, 0));
|
||||
avatar.add(new JLabel());
|
||||
avatar.add(new JLabel());
|
||||
avatar.add(avatarFlag);
|
||||
avatar.setAlignTextLeft(true);
|
||||
avatarFlag.setHorizontalAlignment(JLabel.LEFT);
|
||||
avatarFlag.setVerticalAlignment(JLabel.BOTTOM);
|
||||
avatar.add(new JLabel());
|
||||
String showPlayerNamePermanently = MageFrame.getPreferences().get(PreferencesDialog.KEY_SHOW_PLAYER_NAMES_PERMANENTLY, "true");
|
||||
if (showPlayerNamePermanently.equals("true")) {
|
||||
avatar.setTextAlwaysVisible(true);
|
||||
|
|
@ -351,9 +358,10 @@ public class PlayerPanelExt extends javax.swing.JPanel {
|
|||
client.sendPlayerUUID(gameId, playerId);
|
||||
}
|
||||
});
|
||||
|
||||
// timer area /small layout)
|
||||
timerLabel.setToolTipText("Time left");
|
||||
timerLabel.setSize(80,12);
|
||||
timerLabel.setSize(80, 12);
|
||||
timerLabel.setHorizontalAlignment(SwingConstants.CENTER);
|
||||
|
||||
// life area
|
||||
|
|
@ -382,22 +390,29 @@ public class PlayerPanelExt extends javax.swing.JPanel {
|
|||
poison = new ImagePanel(resizedPoison, ImagePanel.ACTUAL);
|
||||
poison.setToolTipText("Poison");
|
||||
poison.setOpaque(false);
|
||||
|
||||
|
||||
// Library
|
||||
r = new Rectangle(19, 19);
|
||||
libraryLabel.setToolTipText("Library");
|
||||
Image imageLibrary = ImageHelper.getImageFromResources("/info/library.png");
|
||||
BufferedImage resizedLibrary = ImageHelper.getResizedImage(BufferedImageBuilder.bufferImage(imageLibrary, BufferedImage.TYPE_INT_ARGB), r);
|
||||
library = new ImagePanel(resizedLibrary, ImagePanel.ACTUAL);
|
||||
|
||||
library = new HoverButton(null, resizedLibrary, resizedLibrary, resizedLibrary, r);
|
||||
library.setToolTipText("Library");
|
||||
library.setOpaque(false);
|
||||
library.setObserver(new Command() {
|
||||
@Override
|
||||
public void execute() {
|
||||
btnLibraryActionPerformed(null);
|
||||
}
|
||||
});
|
||||
|
||||
// Grave count and open graveyard button
|
||||
graveLabel = new JLabel();
|
||||
r = new Rectangle(21, 21);
|
||||
graveLabel.setToolTipText("Graveyard");
|
||||
Image imageGrave = ImageHelper.getImageFromResources("/info/grave.png");
|
||||
BufferedImage resizedGrave = ImageHelper.getResizedImage(BufferedImageBuilder.bufferImage(imageGrave, BufferedImage.TYPE_INT_ARGB), r);
|
||||
|
||||
grave = new HoverButton(null, resizedGrave, resizedGrave, resizedGrave, r);
|
||||
grave.setToolTipText("Graveyard");
|
||||
grave.setOpaque(false);
|
||||
|
|
@ -572,195 +587,194 @@ public class PlayerPanelExt extends javax.swing.JPanel {
|
|||
GroupLayout gl_panelBackground = new GroupLayout(panelBackground);
|
||||
gl_panelBackground.setHorizontalGroup(
|
||||
gl_panelBackground.createParallelGroup(Alignment.LEADING)
|
||||
.addGroup(gl_panelBackground.createSequentialGroup()
|
||||
.addGap(9)
|
||||
.addComponent(life, GroupLayout.PREFERRED_SIZE, 18, GroupLayout.PREFERRED_SIZE)
|
||||
.addGap(3)
|
||||
.addGroup(gl_panelBackground.createParallelGroup(Alignment.LEADING)
|
||||
.addGroup(gl_panelBackground.createSequentialGroup()
|
||||
.addGap(18)
|
||||
.addComponent(hand, GroupLayout.PREFERRED_SIZE, 18, GroupLayout.PREFERRED_SIZE))
|
||||
.addComponent(lifeLabel, GroupLayout.PREFERRED_SIZE, 25, GroupLayout.PREFERRED_SIZE))
|
||||
.addGap(4)
|
||||
.addComponent(handLabel, GroupLayout.PREFERRED_SIZE, 20, GroupLayout.PREFERRED_SIZE))
|
||||
.addGroup(gl_panelBackground.createSequentialGroup()
|
||||
.addGap(9)
|
||||
.addGroup(gl_panelBackground.createParallelGroup(Alignment.LEADING)
|
||||
.addGroup(gl_panelBackground.createSequentialGroup()
|
||||
.addGap(3)
|
||||
.addComponent(poison, GroupLayout.PREFERRED_SIZE, 14, GroupLayout.PREFERRED_SIZE))
|
||||
.addGroup(gl_panelBackground.createSequentialGroup()
|
||||
.addGap(2)
|
||||
.addComponent(btnWhiteMana, GroupLayout.PREFERRED_SIZE, 15, GroupLayout.PREFERRED_SIZE))
|
||||
.addGroup(gl_panelBackground.createSequentialGroup()
|
||||
.addGap(2)
|
||||
.addComponent(btnBlueMana, GroupLayout.PREFERRED_SIZE, 15, GroupLayout.PREFERRED_SIZE))
|
||||
.addGroup(gl_panelBackground.createSequentialGroup()
|
||||
.addGap(2)
|
||||
.addComponent(btnBlackMana, GroupLayout.PREFERRED_SIZE, 15, GroupLayout.PREFERRED_SIZE))
|
||||
.addComponent(grave, GroupLayout.PREFERRED_SIZE, 21, GroupLayout.PREFERRED_SIZE)
|
||||
)
|
||||
.addGroup(gl_panelBackground.createParallelGroup(Alignment.LEADING)
|
||||
.addGroup(gl_panelBackground.createSequentialGroup()
|
||||
.addGroup(gl_panelBackground.createParallelGroup(Alignment.LEADING)
|
||||
.addGroup(gl_panelBackground.createSequentialGroup()
|
||||
.addGap(18)
|
||||
.addComponent(library, GroupLayout.PREFERRED_SIZE, 19, GroupLayout.PREFERRED_SIZE))
|
||||
.addComponent(poisonLabel, GroupLayout.PREFERRED_SIZE, 20, GroupLayout.PREFERRED_SIZE)
|
||||
.addGroup(gl_panelBackground.createSequentialGroup()
|
||||
.addGap(20)
|
||||
.addComponent(btnRedMana, GroupLayout.PREFERRED_SIZE, 15, GroupLayout.PREFERRED_SIZE))
|
||||
.addGroup(gl_panelBackground.createSequentialGroup()
|
||||
.addGap(1)
|
||||
.addComponent(manaCountLabelW, GroupLayout.PREFERRED_SIZE, MANA_LABEL_SIZE_HORIZONTAL, GroupLayout.PREFERRED_SIZE)))
|
||||
.addGap(3)
|
||||
.addComponent(manaCountLabelR, GroupLayout.PREFERRED_SIZE, MANA_LABEL_SIZE_HORIZONTAL, GroupLayout.PREFERRED_SIZE))
|
||||
.addGroup(gl_panelBackground.createSequentialGroup()
|
||||
.addGap(1)
|
||||
.addGroup(gl_panelBackground.createParallelGroup(Alignment.LEADING)
|
||||
.addComponent(manaCountLabelB, GroupLayout.PREFERRED_SIZE, MANA_LABEL_SIZE_HORIZONTAL, GroupLayout.PREFERRED_SIZE)
|
||||
.addGroup(gl_panelBackground.createSequentialGroup()
|
||||
.addGap(19)
|
||||
.addComponent(btnColorlessMana, GroupLayout.PREFERRED_SIZE, 15, GroupLayout.PREFERRED_SIZE)))
|
||||
.addGap(5)
|
||||
.addComponent(manaCountLabelX, GroupLayout.PREFERRED_SIZE, MANA_LABEL_SIZE_HORIZONTAL, GroupLayout.PREFERRED_SIZE))
|
||||
.addGroup(gl_panelBackground.createSequentialGroup()
|
||||
.addGap(20)
|
||||
.addComponent(btnGreenMana, GroupLayout.PREFERRED_SIZE, 15, GroupLayout.PREFERRED_SIZE))
|
||||
.addGroup(gl_panelBackground.createSequentialGroup()
|
||||
.addGap(40)
|
||||
.addComponent(manaCountLabelG, GroupLayout.PREFERRED_SIZE, MANA_LABEL_SIZE_HORIZONTAL, GroupLayout.PREFERRED_SIZE))
|
||||
.addGroup(gl_panelBackground.createSequentialGroup()
|
||||
.addGap(40)
|
||||
.addComponent(libraryLabel, GroupLayout.PREFERRED_SIZE, 25, GroupLayout.PREFERRED_SIZE))
|
||||
/*.addGroup(gl_panelBackground.createSequentialGroup()
|
||||
.addGap(18)
|
||||
.addComponent(cheat, GroupLayout.PREFERRED_SIZE, 25, GroupLayout.PREFERRED_SIZE))*/
|
||||
.addGroup(gl_panelBackground.createSequentialGroup()
|
||||
.addGap(18)
|
||||
.addComponent(exileZone, GroupLayout.PREFERRED_SIZE, 25, GroupLayout.PREFERRED_SIZE)
|
||||
)
|
||||
.addGroup(gl_panelBackground.createSequentialGroup()
|
||||
.addGap(5)
|
||||
.addComponent(graveLabel, GroupLayout.PREFERRED_SIZE, 25, GroupLayout.PREFERRED_SIZE))
|
||||
.addGroup(gl_panelBackground.createSequentialGroup()
|
||||
.addGap(40)
|
||||
.addComponent(exileLabel, GroupLayout.PREFERRED_SIZE, 25, GroupLayout.PREFERRED_SIZE))
|
||||
.addGroup(gl_panelBackground.createSequentialGroup()
|
||||
.addGap(1)
|
||||
.addComponent(manaCountLabelU, GroupLayout.PREFERRED_SIZE, MANA_LABEL_SIZE_HORIZONTAL, GroupLayout.PREFERRED_SIZE))))
|
||||
.addGroup(gl_panelBackground.createSequentialGroup()
|
||||
.addGap(6)
|
||||
.addGroup(gl_panelBackground.createParallelGroup(Alignment.LEADING)
|
||||
.addComponent(btnPlayer, Alignment.TRAILING, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||
.addComponent(timerLabel, Alignment.TRAILING, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||
.addComponent(avatar, Alignment.TRAILING, GroupLayout.DEFAULT_SIZE, 80, Short.MAX_VALUE))
|
||||
.addGap(14))
|
||||
|
||||
.addGroup(gl_panelBackground.createSequentialGroup()
|
||||
.addGap(6)
|
||||
.addComponent(zonesPanel, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE)
|
||||
.addGap(14))
|
||||
);
|
||||
gl_panelBackground.setVerticalGroup(
|
||||
gl_panelBackground.createParallelGroup(Alignment.LEADING)
|
||||
.addGroup(gl_panelBackground.createSequentialGroup()
|
||||
|
||||
.addGap(6)
|
||||
.addComponent(avatar, GroupLayout.PREFERRED_SIZE, 80, GroupLayout.PREFERRED_SIZE)
|
||||
.addPreferredGap(ComponentPlacement.RELATED)
|
||||
.addComponent(btnPlayer)
|
||||
.addComponent(timerLabel)
|
||||
.addGap(1)
|
||||
// Life & Hand
|
||||
.addGroup(gl_panelBackground.createParallelGroup(Alignment.LEADING)
|
||||
.addGroup(gl_panelBackground.createSequentialGroup()
|
||||
.addGap(1)
|
||||
.addComponent(life, GroupLayout.PREFERRED_SIZE, 18, GroupLayout.PREFERRED_SIZE))
|
||||
.addGroup(gl_panelBackground.createSequentialGroup()
|
||||
.addGap(1)
|
||||
.addComponent(hand, GroupLayout.PREFERRED_SIZE, 18, GroupLayout.PREFERRED_SIZE))
|
||||
.addComponent(lifeLabel, GroupLayout.PREFERRED_SIZE, 20, GroupLayout.PREFERRED_SIZE)
|
||||
.addComponent(handLabel, GroupLayout.PREFERRED_SIZE, 20, GroupLayout.PREFERRED_SIZE))
|
||||
.addGap(1)
|
||||
// Poison
|
||||
.addGroup(gl_panelBackground.createParallelGroup(Alignment.LEADING)
|
||||
.addGroup(gl_panelBackground.createSequentialGroup()
|
||||
.addGap(4)
|
||||
.addComponent(poison, GroupLayout.PREFERRED_SIZE, 14, GroupLayout.PREFERRED_SIZE)
|
||||
.addGap(4)
|
||||
.addComponent(btnWhiteMana, GroupLayout.PREFERRED_SIZE, 15, GroupLayout.PREFERRED_SIZE)
|
||||
.addGap(2)
|
||||
.addComponent(btnBlueMana, GroupLayout.PREFERRED_SIZE, 15, GroupLayout.PREFERRED_SIZE)
|
||||
.addGap(2)
|
||||
.addComponent(btnBlackMana, GroupLayout.PREFERRED_SIZE, 15, GroupLayout.PREFERRED_SIZE)
|
||||
.addGap(5)
|
||||
.addComponent(grave, GroupLayout.PREFERRED_SIZE, 21, GroupLayout.PREFERRED_SIZE)
|
||||
)
|
||||
|
||||
.addGroup(gl_panelBackground.createSequentialGroup()
|
||||
.addGroup(gl_panelBackground.createParallelGroup(Alignment.LEADING)
|
||||
.addGroup(gl_panelBackground.createSequentialGroup()
|
||||
.addGroup(gl_panelBackground.createParallelGroup(Alignment.LEADING)
|
||||
.addGroup(gl_panelBackground.createSequentialGroup()
|
||||
.addGap(1)
|
||||
.addComponent(library, GroupLayout.PREFERRED_SIZE, 19, GroupLayout.PREFERRED_SIZE))
|
||||
.addComponent(poisonLabel, GroupLayout.PREFERRED_SIZE, 20, GroupLayout.PREFERRED_SIZE))
|
||||
.addGap(2)
|
||||
.addComponent(btnRedMana, GroupLayout.PREFERRED_SIZE, 15, GroupLayout.PREFERRED_SIZE))
|
||||
.addGroup(gl_panelBackground.createSequentialGroup()
|
||||
.addGap(14)
|
||||
.addComponent(manaCountLabelW, GroupLayout.PREFERRED_SIZE, 30, GroupLayout.PREFERRED_SIZE))
|
||||
.addGroup(gl_panelBackground.createSequentialGroup()
|
||||
.addGap(14)
|
||||
.addComponent(manaCountLabelR, GroupLayout.PREFERRED_SIZE, 30, GroupLayout.PREFERRED_SIZE)))
|
||||
.addGap(4)
|
||||
.addGroup(gl_panelBackground.createParallelGroup(Alignment.LEADING)
|
||||
.addComponent(manaCountLabelB, GroupLayout.PREFERRED_SIZE, 30, GroupLayout.PREFERRED_SIZE)
|
||||
.addGroup(gl_panelBackground.createSequentialGroup()
|
||||
.addGap(8)
|
||||
.addComponent(btnColorlessMana, GroupLayout.PREFERRED_SIZE, 15, GroupLayout.PREFERRED_SIZE))
|
||||
.addComponent(manaCountLabelX, GroupLayout.PREFERRED_SIZE, 30, GroupLayout.PREFERRED_SIZE)))
|
||||
.addGroup(gl_panelBackground.createSequentialGroup()
|
||||
.addGap(39)
|
||||
.addComponent(btnGreenMana, GroupLayout.PREFERRED_SIZE, 15, GroupLayout.PREFERRED_SIZE))
|
||||
.addGroup(gl_panelBackground.createSequentialGroup()
|
||||
.addGap(31)
|
||||
.addComponent(manaCountLabelG, GroupLayout.PREFERRED_SIZE, 30, GroupLayout.PREFERRED_SIZE))
|
||||
.addComponent(libraryLabel, GroupLayout.PREFERRED_SIZE, 20, GroupLayout.PREFERRED_SIZE)
|
||||
/*.addGroup(gl_panelBackground.createSequentialGroup()
|
||||
.addGap(76)
|
||||
.addComponent(cheat, GroupLayout.PREFERRED_SIZE, 21, GroupLayout.PREFERRED_SIZE))*/
|
||||
.addGroup(gl_panelBackground.createSequentialGroup()
|
||||
.addGap(76)
|
||||
.addComponent(exileZone, GroupLayout.PREFERRED_SIZE, 21, GroupLayout.PREFERRED_SIZE)
|
||||
)
|
||||
.addGroup(gl_panelBackground.createSequentialGroup()
|
||||
.addGap(76)
|
||||
.addComponent(graveLabel, GroupLayout.PREFERRED_SIZE, 21, GroupLayout.PREFERRED_SIZE))
|
||||
.addGroup(gl_panelBackground.createSequentialGroup()
|
||||
.addGap(76)
|
||||
.addComponent(exileLabel, GroupLayout.PREFERRED_SIZE, 21, GroupLayout.PREFERRED_SIZE))
|
||||
.addGroup(gl_panelBackground.createSequentialGroup()
|
||||
.addGap(31)
|
||||
.addComponent(manaCountLabelU, GroupLayout.PREFERRED_SIZE, 30, GroupLayout.PREFERRED_SIZE)
|
||||
)
|
||||
)
|
||||
.addPreferredGap(ComponentPlacement.RELATED)
|
||||
.addComponent(zonesPanel, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE)
|
||||
.addGroup(gl_panelBackground.createSequentialGroup()
|
||||
.addGap(9)
|
||||
.addComponent(life, GroupLayout.PREFERRED_SIZE, 18, GroupLayout.PREFERRED_SIZE)
|
||||
.addGap(3)
|
||||
.addGroup(gl_panelBackground.createParallelGroup(Alignment.LEADING)
|
||||
.addGroup(gl_panelBackground.createSequentialGroup()
|
||||
.addGap(18)
|
||||
.addComponent(hand, GroupLayout.PREFERRED_SIZE, 18, GroupLayout.PREFERRED_SIZE))
|
||||
.addComponent(lifeLabel, GroupLayout.PREFERRED_SIZE, 25, GroupLayout.PREFERRED_SIZE))
|
||||
.addGap(4)
|
||||
.addComponent(handLabel, GroupLayout.PREFERRED_SIZE, 20, GroupLayout.PREFERRED_SIZE))
|
||||
.addGroup(gl_panelBackground.createSequentialGroup()
|
||||
.addGap(9)
|
||||
.addGroup(gl_panelBackground.createParallelGroup(Alignment.LEADING)
|
||||
.addGroup(gl_panelBackground.createSequentialGroup()
|
||||
.addGap(3)
|
||||
.addComponent(poison, GroupLayout.PREFERRED_SIZE, 14, GroupLayout.PREFERRED_SIZE))
|
||||
.addGroup(gl_panelBackground.createSequentialGroup()
|
||||
.addGap(2)
|
||||
.addComponent(btnWhiteMana, GroupLayout.PREFERRED_SIZE, 15, GroupLayout.PREFERRED_SIZE))
|
||||
.addGroup(gl_panelBackground.createSequentialGroup()
|
||||
.addGap(2)
|
||||
.addComponent(btnBlueMana, GroupLayout.PREFERRED_SIZE, 15, GroupLayout.PREFERRED_SIZE))
|
||||
.addGroup(gl_panelBackground.createSequentialGroup()
|
||||
.addGap(2)
|
||||
.addComponent(btnBlackMana, GroupLayout.PREFERRED_SIZE, 15, GroupLayout.PREFERRED_SIZE))
|
||||
.addComponent(grave, GroupLayout.PREFERRED_SIZE, 21, GroupLayout.PREFERRED_SIZE)
|
||||
)
|
||||
.addGroup(gl_panelBackground.createParallelGroup(Alignment.LEADING)
|
||||
.addGroup(gl_panelBackground.createSequentialGroup()
|
||||
.addGroup(gl_panelBackground.createParallelGroup(Alignment.LEADING)
|
||||
.addGroup(gl_panelBackground.createSequentialGroup()
|
||||
.addGap(18)
|
||||
.addComponent(library, GroupLayout.PREFERRED_SIZE, 19, GroupLayout.PREFERRED_SIZE))
|
||||
.addComponent(poisonLabel, GroupLayout.PREFERRED_SIZE, 20, GroupLayout.PREFERRED_SIZE)
|
||||
.addGroup(gl_panelBackground.createSequentialGroup()
|
||||
.addGap(20)
|
||||
.addComponent(btnRedMana, GroupLayout.PREFERRED_SIZE, 15, GroupLayout.PREFERRED_SIZE))
|
||||
.addGroup(gl_panelBackground.createSequentialGroup()
|
||||
.addGap(1)
|
||||
.addComponent(manaCountLabelW, GroupLayout.PREFERRED_SIZE, MANA_LABEL_SIZE_HORIZONTAL, GroupLayout.PREFERRED_SIZE)))
|
||||
.addGap(3)
|
||||
.addComponent(manaCountLabelR, GroupLayout.PREFERRED_SIZE, MANA_LABEL_SIZE_HORIZONTAL, GroupLayout.PREFERRED_SIZE))
|
||||
.addGroup(gl_panelBackground.createSequentialGroup()
|
||||
.addGap(1)
|
||||
.addGroup(gl_panelBackground.createParallelGroup(Alignment.LEADING)
|
||||
.addComponent(manaCountLabelB, GroupLayout.PREFERRED_SIZE, MANA_LABEL_SIZE_HORIZONTAL, GroupLayout.PREFERRED_SIZE)
|
||||
.addGroup(gl_panelBackground.createSequentialGroup()
|
||||
.addGap(19)
|
||||
.addComponent(btnColorlessMana, GroupLayout.PREFERRED_SIZE, 15, GroupLayout.PREFERRED_SIZE)))
|
||||
.addGap(5)
|
||||
.addComponent(manaCountLabelX, GroupLayout.PREFERRED_SIZE, MANA_LABEL_SIZE_HORIZONTAL, GroupLayout.PREFERRED_SIZE))
|
||||
.addGroup(gl_panelBackground.createSequentialGroup()
|
||||
.addGap(20)
|
||||
.addComponent(btnGreenMana, GroupLayout.PREFERRED_SIZE, 15, GroupLayout.PREFERRED_SIZE))
|
||||
.addGroup(gl_panelBackground.createSequentialGroup()
|
||||
.addGap(40)
|
||||
.addComponent(manaCountLabelG, GroupLayout.PREFERRED_SIZE, MANA_LABEL_SIZE_HORIZONTAL, GroupLayout.PREFERRED_SIZE))
|
||||
.addGroup(gl_panelBackground.createSequentialGroup()
|
||||
.addGap(40)
|
||||
.addComponent(libraryLabel, GroupLayout.PREFERRED_SIZE, 25, GroupLayout.PREFERRED_SIZE))
|
||||
/*.addGroup(gl_panelBackground.createSequentialGroup()
|
||||
.addGap(18)
|
||||
.addComponent(cheat, GroupLayout.PREFERRED_SIZE, 25, GroupLayout.PREFERRED_SIZE))*/
|
||||
.addGroup(gl_panelBackground.createSequentialGroup()
|
||||
.addGap(18)
|
||||
.addComponent(exileZone, GroupLayout.PREFERRED_SIZE, 25, GroupLayout.PREFERRED_SIZE)
|
||||
)
|
||||
.addGroup(gl_panelBackground.createSequentialGroup()
|
||||
.addGap(5)
|
||||
.addComponent(graveLabel, GroupLayout.PREFERRED_SIZE, 25, GroupLayout.PREFERRED_SIZE))
|
||||
.addGroup(gl_panelBackground.createSequentialGroup()
|
||||
.addGap(40)
|
||||
.addComponent(exileLabel, GroupLayout.PREFERRED_SIZE, 25, GroupLayout.PREFERRED_SIZE))
|
||||
.addGroup(gl_panelBackground.createSequentialGroup()
|
||||
.addGap(1)
|
||||
.addComponent(manaCountLabelU, GroupLayout.PREFERRED_SIZE, MANA_LABEL_SIZE_HORIZONTAL, GroupLayout.PREFERRED_SIZE))))
|
||||
.addGroup(gl_panelBackground.createSequentialGroup()
|
||||
.addGap(6)
|
||||
.addGroup(gl_panelBackground.createParallelGroup(Alignment.LEADING)
|
||||
.addComponent(btnPlayer, Alignment.TRAILING, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||
.addComponent(timerLabel, Alignment.TRAILING, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||
.addComponent(avatar, Alignment.TRAILING, GroupLayout.DEFAULT_SIZE, 80, Short.MAX_VALUE))
|
||||
// .addGroup(gl_panelBackground.createSequentialGroup()
|
||||
// .addComponent(avatarFlag, GroupLayout.PREFERRED_SIZE, 16, GroupLayout.PREFERRED_SIZE))
|
||||
.addGap(14))
|
||||
.addGroup(gl_panelBackground.createSequentialGroup()
|
||||
.addGap(6)
|
||||
.addComponent(zonesPanel, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE)
|
||||
.addGap(14))
|
||||
);
|
||||
gl_panelBackground.setVerticalGroup(
|
||||
gl_panelBackground.createParallelGroup(Alignment.LEADING)
|
||||
.addGroup(gl_panelBackground.createSequentialGroup()
|
||||
.addGap(6)
|
||||
.addComponent(avatar, GroupLayout.PREFERRED_SIZE, 80, GroupLayout.PREFERRED_SIZE)
|
||||
.addPreferredGap(ComponentPlacement.RELATED)
|
||||
.addComponent(btnPlayer)
|
||||
.addComponent(timerLabel)
|
||||
.addGap(1)
|
||||
// Life & Hand
|
||||
.addGroup(gl_panelBackground.createParallelGroup(Alignment.LEADING)
|
||||
.addGroup(gl_panelBackground.createSequentialGroup()
|
||||
.addGap(1)
|
||||
.addComponent(life, GroupLayout.PREFERRED_SIZE, 18, GroupLayout.PREFERRED_SIZE))
|
||||
.addGroup(gl_panelBackground.createSequentialGroup()
|
||||
.addGap(1)
|
||||
.addComponent(hand, GroupLayout.PREFERRED_SIZE, 18, GroupLayout.PREFERRED_SIZE))
|
||||
.addComponent(lifeLabel, GroupLayout.PREFERRED_SIZE, 20, GroupLayout.PREFERRED_SIZE)
|
||||
.addComponent(handLabel, GroupLayout.PREFERRED_SIZE, 20, GroupLayout.PREFERRED_SIZE))
|
||||
.addGap(1)
|
||||
// Poison
|
||||
.addGroup(gl_panelBackground.createParallelGroup(Alignment.LEADING)
|
||||
.addGroup(gl_panelBackground.createSequentialGroup()
|
||||
.addGap(4)
|
||||
.addComponent(poison, GroupLayout.PREFERRED_SIZE, 14, GroupLayout.PREFERRED_SIZE)
|
||||
.addGap(4)
|
||||
.addComponent(btnWhiteMana, GroupLayout.PREFERRED_SIZE, 15, GroupLayout.PREFERRED_SIZE)
|
||||
.addGap(2)
|
||||
.addComponent(btnBlueMana, GroupLayout.PREFERRED_SIZE, 15, GroupLayout.PREFERRED_SIZE)
|
||||
.addGap(2)
|
||||
.addComponent(btnBlackMana, GroupLayout.PREFERRED_SIZE, 15, GroupLayout.PREFERRED_SIZE)
|
||||
.addGap(5)
|
||||
.addComponent(grave, GroupLayout.PREFERRED_SIZE, 21, GroupLayout.PREFERRED_SIZE)
|
||||
)
|
||||
.addGroup(gl_panelBackground.createSequentialGroup()
|
||||
.addGroup(gl_panelBackground.createParallelGroup(Alignment.LEADING)
|
||||
.addGroup(gl_panelBackground.createSequentialGroup()
|
||||
.addGroup(gl_panelBackground.createParallelGroup(Alignment.LEADING)
|
||||
.addGroup(gl_panelBackground.createSequentialGroup()
|
||||
.addGap(1)
|
||||
.addComponent(library, GroupLayout.PREFERRED_SIZE, 19, GroupLayout.PREFERRED_SIZE))
|
||||
.addComponent(poisonLabel, GroupLayout.PREFERRED_SIZE, 20, GroupLayout.PREFERRED_SIZE))
|
||||
.addGap(2)
|
||||
.addComponent(btnRedMana, GroupLayout.PREFERRED_SIZE, 15, GroupLayout.PREFERRED_SIZE))
|
||||
.addGroup(gl_panelBackground.createSequentialGroup()
|
||||
.addGap(14)
|
||||
.addComponent(manaCountLabelW, GroupLayout.PREFERRED_SIZE, 30, GroupLayout.PREFERRED_SIZE))
|
||||
.addGroup(gl_panelBackground.createSequentialGroup()
|
||||
.addGap(14)
|
||||
.addComponent(manaCountLabelR, GroupLayout.PREFERRED_SIZE, 30, GroupLayout.PREFERRED_SIZE)))
|
||||
.addGap(4)
|
||||
.addGroup(gl_panelBackground.createParallelGroup(Alignment.LEADING)
|
||||
.addComponent(manaCountLabelB, GroupLayout.PREFERRED_SIZE, 30, GroupLayout.PREFERRED_SIZE)
|
||||
.addGroup(gl_panelBackground.createSequentialGroup()
|
||||
.addGap(8)
|
||||
.addComponent(btnColorlessMana, GroupLayout.PREFERRED_SIZE, 15, GroupLayout.PREFERRED_SIZE))
|
||||
.addComponent(manaCountLabelX, GroupLayout.PREFERRED_SIZE, 30, GroupLayout.PREFERRED_SIZE)))
|
||||
.addGroup(gl_panelBackground.createSequentialGroup()
|
||||
.addGap(39)
|
||||
.addComponent(btnGreenMana, GroupLayout.PREFERRED_SIZE, 15, GroupLayout.PREFERRED_SIZE))
|
||||
.addGroup(gl_panelBackground.createSequentialGroup()
|
||||
.addGap(31)
|
||||
.addComponent(manaCountLabelG, GroupLayout.PREFERRED_SIZE, 30, GroupLayout.PREFERRED_SIZE))
|
||||
.addComponent(libraryLabel, GroupLayout.PREFERRED_SIZE, 20, GroupLayout.PREFERRED_SIZE)
|
||||
/*.addGroup(gl_panelBackground.createSequentialGroup()
|
||||
.addGap(76)
|
||||
.addComponent(cheat, GroupLayout.PREFERRED_SIZE, 21, GroupLayout.PREFERRED_SIZE))*/
|
||||
.addGroup(gl_panelBackground.createSequentialGroup()
|
||||
.addGap(76)
|
||||
.addComponent(exileZone, GroupLayout.PREFERRED_SIZE, 21, GroupLayout.PREFERRED_SIZE)
|
||||
)
|
||||
.addGroup(gl_panelBackground.createSequentialGroup()
|
||||
.addGap(76)
|
||||
.addComponent(graveLabel, GroupLayout.PREFERRED_SIZE, 21, GroupLayout.PREFERRED_SIZE))
|
||||
.addGroup(gl_panelBackground.createSequentialGroup()
|
||||
.addGap(76)
|
||||
.addComponent(exileLabel, GroupLayout.PREFERRED_SIZE, 21, GroupLayout.PREFERRED_SIZE))
|
||||
.addGroup(gl_panelBackground.createSequentialGroup()
|
||||
.addGap(31)
|
||||
.addComponent(manaCountLabelU, GroupLayout.PREFERRED_SIZE, 30, GroupLayout.PREFERRED_SIZE)
|
||||
)
|
||||
)
|
||||
.addPreferredGap(ComponentPlacement.RELATED)
|
||||
.addComponent(zonesPanel, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE)
|
||||
)
|
||||
);
|
||||
panelBackground.setLayout(gl_panelBackground);
|
||||
GroupLayout groupLayout = new GroupLayout(this);
|
||||
groupLayout.setHorizontalGroup(
|
||||
groupLayout.createParallelGroup(Alignment.LEADING)
|
||||
.addGroup(groupLayout.createSequentialGroup()
|
||||
.addComponent(panelBackground, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE))
|
||||
.addGroup(groupLayout.createSequentialGroup()
|
||||
.addComponent(panelBackground, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE))
|
||||
);
|
||||
groupLayout.setVerticalGroup(
|
||||
groupLayout.createParallelGroup(Alignment.LEADING)
|
||||
.addGroup(groupLayout.createSequentialGroup()
|
||||
.addComponent(panelBackground, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE))
|
||||
.addGroup(groupLayout.createSequentialGroup()
|
||||
.addComponent(panelBackground, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE))
|
||||
);
|
||||
setLayout(groupLayout);
|
||||
|
||||
|
|
@ -769,13 +783,14 @@ public class PlayerPanelExt extends javax.swing.JPanel {
|
|||
protected void sizePlayerPanel(boolean smallMode) {
|
||||
if (smallMode) {
|
||||
avatar.setVisible(false);
|
||||
avatarFlag.setVisible(false);
|
||||
btnPlayer.setVisible(true);
|
||||
timerLabel.setVisible(true);
|
||||
panelBackground.setPreferredSize(new Dimension(PANEL_WIDTH - 2, PANEL_HEIGHT_SMALL));
|
||||
panelBackground.setBounds(0, 0, PANEL_WIDTH - 2, PANEL_HEIGHT_SMALL);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
avatar.setVisible(true);
|
||||
avatarFlag.setVisible(true);
|
||||
btnPlayer.setVisible(false);
|
||||
timerLabel.setVisible(false);
|
||||
panelBackground.setPreferredSize(new Dimension(PANEL_WIDTH - 2, PANEL_HEIGHT));
|
||||
|
|
@ -787,12 +802,12 @@ public class PlayerPanelExt extends javax.swing.JPanel {
|
|||
client.sendPlayerManaType(gameId, player.getPlayerId(), manaType);
|
||||
}
|
||||
|
||||
private void btnGraveActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnGraveActionPerformed
|
||||
/*if (graveyard == null) {
|
||||
graveyard = new ShowCardsDialog();
|
||||
}*/
|
||||
//graveyard.loadCards(player.getName() + " graveyard", player.getGraveyard(), bigCard, Config.dimensions, gameId, false);
|
||||
DialogManager.getManager(gameId).showGraveyardDialog(player.getGraveyard(), bigCard, gameId);
|
||||
private void btnGraveActionPerformed(java.awt.event.ActionEvent evt) {
|
||||
MageFrame.getGame(gameId).openGraveyardWindow(player.getName());
|
||||
}
|
||||
|
||||
private void btnLibraryActionPerformed(java.awt.event.ActionEvent evt) {
|
||||
MageFrame.getGame(gameId).openTopLibraryWindow(player.getName());
|
||||
}
|
||||
|
||||
private void btnCommandZoneActionPerformed(java.awt.event.ActionEvent evt) {
|
||||
|
|
@ -813,14 +828,13 @@ public class PlayerPanelExt extends javax.swing.JPanel {
|
|||
}
|
||||
|
||||
private HoverButton avatar;
|
||||
private JLabel avatarFlag;
|
||||
private JButton btnPlayer;
|
||||
private ImagePanel life;
|
||||
private ImagePanel poison;
|
||||
private ImagePanel hand;
|
||||
private HoverButton grave;
|
||||
private ImagePanel library;
|
||||
private CardView topCard;
|
||||
private MageCard topCardPanel;
|
||||
private HoverButton library;
|
||||
private JButton cheat;
|
||||
private MageRoundPane panelBackground;
|
||||
|
||||
|
|
|
|||
|
|
@ -389,7 +389,7 @@ public class MageActionCallback implements ActionCallback {
|
|||
|
||||
/**
|
||||
* Hides the text popup window
|
||||
*
|
||||
*
|
||||
*/
|
||||
@Override
|
||||
public void hidePopup() {
|
||||
|
|
@ -446,7 +446,7 @@ public class MageActionCallback implements ActionCallback {
|
|||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (notches < 0) {
|
||||
// move up - show normal image
|
||||
enlargeCard(EnlargeMode.NORMAL);
|
||||
|
|
@ -457,7 +457,7 @@ public class MageActionCallback implements ActionCallback {
|
|||
}
|
||||
|
||||
/**
|
||||
* Show the big card image on mouse position while hoovering over a card
|
||||
* Show the big card image on mouse position while hovering over a card
|
||||
*
|
||||
* @param showAlternative defines if the original image (if it's a copied card) or the opposite side of a transformable card will be shown
|
||||
*/
|
||||
|
|
@ -490,7 +490,7 @@ public class MageActionCallback implements ActionCallback {
|
|||
cardPreviewContainer.setVisible(false);
|
||||
cardPreviewContainer = MageFrame.getUI().getComponent(MageComponents.CARD_PREVIEW_CONTAINER_ROTATED);
|
||||
cardPreviewContainer.setVisible(false);
|
||||
|
||||
|
||||
} catch (InterruptedException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
|
@ -539,7 +539,7 @@ public class MageActionCallback implements ActionCallback {
|
|||
location.translate(-parentPoint.x, -parentPoint.y);
|
||||
popupContainer.setLocation(location);
|
||||
popupContainer.setVisible(true);
|
||||
|
||||
|
||||
MageCard mageCard = (MageCard) transferData.component;
|
||||
Image image = null;
|
||||
switch (enlargeMode) {
|
||||
|
|
|
|||
|
|
@ -31,7 +31,6 @@
|
|||
*
|
||||
* Created on 20-Jan-2011, 9:18:30 PM
|
||||
*/
|
||||
|
||||
package mage.client.tournament;
|
||||
|
||||
import java.awt.Component;
|
||||
|
|
@ -45,15 +44,21 @@ import java.util.concurrent.CancellationException;
|
|||
import java.util.concurrent.ExecutionException;
|
||||
import javax.swing.AbstractAction;
|
||||
import javax.swing.Action;
|
||||
import javax.swing.Icon;
|
||||
import javax.swing.JOptionPane;
|
||||
import javax.swing.SwingWorker;
|
||||
import javax.swing.table.AbstractTableModel;
|
||||
import mage.client.MageFrame;
|
||||
import mage.client.chat.ChatPanel;
|
||||
import mage.client.dialog.PreferencesDialog;
|
||||
import static mage.client.dialog.PreferencesDialog.KEY_TOURNAMENT_MATCH_COLUMNS_ORDER;
|
||||
import static mage.client.dialog.PreferencesDialog.KEY_TOURNAMENT_MATCH_COLUMNS_WIDTH;
|
||||
import static mage.client.dialog.PreferencesDialog.KEY_TOURNAMENT_PLAYER_COLUMNS_ORDER;
|
||||
import static mage.client.dialog.PreferencesDialog.KEY_TOURNAMENT_PLAYER_COLUMNS_WIDTH;
|
||||
import mage.client.util.ButtonColumn;
|
||||
import mage.client.util.Format;
|
||||
//import mage.remote.Session;
|
||||
import mage.client.util.gui.TableUtil;
|
||||
import mage.client.util.gui.countryBox.CountryCellRenderer;
|
||||
import mage.view.RoundView;
|
||||
import mage.view.TournamentGameView;
|
||||
import mage.view.TournamentPlayerView;
|
||||
|
|
@ -77,7 +82,12 @@ public class TournamentPanel extends javax.swing.JPanel {
|
|||
private UpdateTournamentTask updateTask;
|
||||
private final DateFormat df;
|
||||
|
||||
/** Creates new form TournamentPanel */
|
||||
private static final int[] defaultColumnsWidthPlayers = {30, 150, 150, 60, 400};
|
||||
private static final int[] defaultColumnsWidthMatches = {60, 140, 140, 400, 80};
|
||||
|
||||
/**
|
||||
* Creates new form TournamentPanel
|
||||
*/
|
||||
public TournamentPanel() {
|
||||
playersModel = new TournamentPlayersTableModel();
|
||||
matchesModel = new TournamentMatchesTableModel();
|
||||
|
|
@ -85,28 +95,29 @@ public class TournamentPanel extends javax.swing.JPanel {
|
|||
initComponents();
|
||||
this.restoreDividerLocations();
|
||||
btnQuitTournament.setVisible(false);
|
||||
|
||||
|
||||
df = DateFormat.getDateTimeInstance();
|
||||
|
||||
tablePlayers.createDefaultColumnsFromModel();
|
||||
TableUtil.setColumnWidthAndOrder(tablePlayers, defaultColumnsWidthPlayers, KEY_TOURNAMENT_PLAYER_COLUMNS_WIDTH, KEY_TOURNAMENT_PLAYER_COLUMNS_ORDER);
|
||||
tablePlayers.setDefaultRenderer(Icon.class, new CountryCellRenderer());
|
||||
|
||||
tableMatches.createDefaultColumnsFromModel();
|
||||
TableUtil.setColumnWidthAndOrder(tableMatches, defaultColumnsWidthMatches, KEY_TOURNAMENT_MATCH_COLUMNS_WIDTH, KEY_TOURNAMENT_MATCH_COLUMNS_ORDER);
|
||||
|
||||
chatPanel1.useExtendedView(ChatPanel.VIEW_MODE.NONE);
|
||||
chatPanel1.setChatType(ChatPanel.ChatType.TOURNAMENT);
|
||||
|
||||
Action action = new AbstractAction()
|
||||
{
|
||||
Action action = new AbstractAction() {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e)
|
||||
{
|
||||
int modelRow = Integer.valueOf( e.getActionCommand() );
|
||||
|
||||
String state = (String)tableMatches.getValueAt(modelRow, 2);
|
||||
String actionText = (String)tableMatches.getValueAt(modelRow, TournamentMatchesTableModel.ACTION_COLUMN);
|
||||
UUID tableId = UUID.fromString((String)matchesModel.getValueAt(modelRow, TournamentMatchesTableModel.ACTION_COLUMN +1));
|
||||
UUID gameId = UUID.fromString((String)matchesModel.getValueAt(modelRow, TournamentMatchesTableModel.ACTION_COLUMN +3));
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
int modelRow = Integer.valueOf(e.getActionCommand());
|
||||
|
||||
String state = (String) tableMatches.getValueAt(modelRow, 2);
|
||||
String actionText = (String) tableMatches.getValueAt(modelRow, TournamentMatchesTableModel.ACTION_COLUMN);
|
||||
UUID tableId = UUID.fromString((String) matchesModel.getValueAt(modelRow, TournamentMatchesTableModel.ACTION_COLUMN + 1));
|
||||
UUID gameId = UUID.fromString((String) matchesModel.getValueAt(modelRow, TournamentMatchesTableModel.ACTION_COLUMN + 3));
|
||||
|
||||
|
||||
// if (state.equals("Finished") && action.equals("Replay")) {
|
||||
// logger.info("Replaying game " + gameId);
|
||||
// session.replayGame(gameId);
|
||||
|
|
@ -128,6 +139,7 @@ public class TournamentPanel extends javax.swing.JPanel {
|
|||
if (this.chatPanel1 != null) {
|
||||
this.chatPanel1.disconnect();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void saveDividerLocations() {
|
||||
|
|
@ -168,8 +180,7 @@ public class TournamentPanel extends javax.swing.JPanel {
|
|||
startTasks();
|
||||
this.setVisible(true);
|
||||
this.repaint();
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
hideTournament();
|
||||
}
|
||||
|
||||
|
|
@ -183,12 +194,15 @@ public class TournamentPanel extends javax.swing.JPanel {
|
|||
stopTasks();
|
||||
this.chatPanel1.disconnect();
|
||||
this.saveDividerLocations();
|
||||
TableUtil.saveColumnWidthAndOrderToPrefs(tablePlayers, KEY_TOURNAMENT_PLAYER_COLUMNS_WIDTH, KEY_TOURNAMENT_PLAYER_COLUMNS_ORDER);
|
||||
TableUtil.saveColumnWidthAndOrderToPrefs(tableMatches, KEY_TOURNAMENT_MATCH_COLUMNS_WIDTH, KEY_TOURNAMENT_MATCH_COLUMNS_ORDER);
|
||||
|
||||
Component c = this.getParent();
|
||||
while (c != null && !(c instanceof TournamentPane)) {
|
||||
c = c.getParent();
|
||||
}
|
||||
if (c != null) {
|
||||
((TournamentPane)c).removeTournament();
|
||||
((TournamentPane) c).removeTournament();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -202,21 +216,21 @@ public class TournamentPanel extends javax.swing.JPanel {
|
|||
c = c.getParent();
|
||||
}
|
||||
if (c != null) {
|
||||
((TournamentPane)c).setTitle("Tournament [" + tournament.getTournamentName() +"]");
|
||||
((TournamentPane) c).setTitle("Tournament [" + tournament.getTournamentName() + "]");
|
||||
}
|
||||
txtName.setText(tournament.getTournamentName());
|
||||
txtType.setText(tournament.getTournamentType());
|
||||
|
||||
txtStartTime.setText(df.format(tournament.getStartTime()));
|
||||
txtEndTime.setText("running...");
|
||||
|
||||
|
||||
firstInitDone = true;
|
||||
}
|
||||
switch (tournament.getTournamentState()) {
|
||||
case "Constructing":
|
||||
String timeLeft = "";
|
||||
if (tournament.getStepStartTime() != null) {
|
||||
timeLeft = Format.getDuration(tournament.getConstructionTime() - (tournament.getServerTime().getTime() - tournament.getStepStartTime().getTime())/1000);
|
||||
timeLeft = Format.getDuration(tournament.getConstructionTime() - (tournament.getServerTime().getTime() - tournament.getStepStartTime().getTime()) / 1000);
|
||||
}
|
||||
txtTournamentState.setText(new StringBuilder(tournament.getTournamentState()).append(" (").append(timeLeft).append(")").toString());
|
||||
break;
|
||||
|
|
@ -224,7 +238,7 @@ public class TournamentPanel extends javax.swing.JPanel {
|
|||
case "Drafting":
|
||||
String usedTime = "";
|
||||
if (tournament.getStepStartTime() != null) {
|
||||
usedTime = Format.getDuration((tournament.getServerTime().getTime() - tournament.getStepStartTime().getTime())/1000);
|
||||
usedTime = Format.getDuration((tournament.getServerTime().getTime() - tournament.getStepStartTime().getTime()) / 1000);
|
||||
}
|
||||
txtTournamentState.setText(tournament.getTournamentState() + " (" + usedTime + ") " + tournament.getRunningInfo());
|
||||
break;
|
||||
|
|
@ -239,7 +253,7 @@ public class TournamentPanel extends javax.swing.JPanel {
|
|||
if (txtEndTime.getText().equals("running...") && tournament.getEndTime() != null) {
|
||||
txtEndTime.setText(df.format(tournament.getEndTime()));
|
||||
}
|
||||
|
||||
|
||||
playersModel.loadData(tournament);
|
||||
matchesModel.loadData(tournament);
|
||||
this.tablePlayers.repaint();
|
||||
|
|
@ -275,10 +289,10 @@ public class TournamentPanel extends javax.swing.JPanel {
|
|||
}
|
||||
}
|
||||
|
||||
/** This method is called from within the constructor to
|
||||
* initialize the form.
|
||||
* WARNING: Do NOT modify this code. The content of this method is
|
||||
* always regenerated by the Form Editor.
|
||||
/**
|
||||
* This method is called from within the constructor to initialize the form.
|
||||
* WARNING: Do NOT modify this code. The content of this method is always
|
||||
* regenerated by the Form Editor.
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
|
||||
|
|
@ -506,7 +520,6 @@ public class TournamentPanel extends javax.swing.JPanel {
|
|||
// TODO add your handling code here:
|
||||
}//GEN-LAST:event_txtNameActionPerformed
|
||||
|
||||
|
||||
// Variables declaration - do not modify//GEN-BEGIN:variables
|
||||
private javax.swing.JPanel actionPanel;
|
||||
private javax.swing.JButton btnCloseWindow;
|
||||
|
|
@ -533,7 +546,8 @@ public class TournamentPanel extends javax.swing.JPanel {
|
|||
}
|
||||
|
||||
class TournamentPlayersTableModel extends AbstractTableModel {
|
||||
private final String[] columnNames = new String[]{"Player Name", "State", "Points", "Results"};
|
||||
|
||||
private final String[] columnNames = new String[]{"Loc", "Player Name", "State", "Points", "Results"};
|
||||
private TournamentPlayerView[] players = new TournamentPlayerView[0];
|
||||
|
||||
public void loadData(TournamentView tournament) {
|
||||
|
|
@ -555,12 +569,14 @@ class TournamentPlayersTableModel extends AbstractTableModel {
|
|||
public Object getValueAt(int arg0, int arg1) {
|
||||
switch (arg1) {
|
||||
case 0:
|
||||
return players[arg0].getName();
|
||||
return players[arg0].getFlagName();
|
||||
case 1:
|
||||
return players[arg0].getState();
|
||||
return players[arg0].getName();
|
||||
case 2:
|
||||
return Integer.toString(players[arg0].getPoints());
|
||||
return players[arg0].getState();
|
||||
case 3:
|
||||
return Integer.toString(players[arg0].getPoints());
|
||||
case 4:
|
||||
return players[arg0].getResults();
|
||||
}
|
||||
return "";
|
||||
|
|
@ -578,8 +594,13 @@ class TournamentPlayersTableModel extends AbstractTableModel {
|
|||
}
|
||||
|
||||
@Override
|
||||
public Class getColumnClass(int columnIndex){
|
||||
return String.class;
|
||||
public Class getColumnClass(int columnIndex) {
|
||||
switch (columnIndex) {
|
||||
case 0:
|
||||
return Icon.class;
|
||||
default:
|
||||
return String.class;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -600,8 +621,8 @@ class TournamentMatchesTableModel extends AbstractTableModel {
|
|||
public void loadData(TournamentView tournament) {
|
||||
List<TournamentGameView> views = new ArrayList<>();
|
||||
watchingAllowed = tournament.isWatchingAllowed();
|
||||
for (RoundView round: tournament.getRounds()) {
|
||||
for (TournamentGameView game: round.getGames()) {
|
||||
for (RoundView round : tournament.getRounds()) {
|
||||
for (TournamentGameView game : round.getGames()) {
|
||||
views.add(game);
|
||||
}
|
||||
}
|
||||
|
|
@ -661,7 +682,7 @@ class TournamentMatchesTableModel extends AbstractTableModel {
|
|||
}
|
||||
|
||||
@Override
|
||||
public Class getColumnClass(int columnIndex){
|
||||
public Class getColumnClass(int columnIndex) {
|
||||
return String.class;
|
||||
}
|
||||
|
||||
|
|
@ -689,7 +710,7 @@ class UpdateTournamentTask extends SwingWorker<Void, TournamentView> {
|
|||
@Override
|
||||
protected Void doInBackground() throws Exception {
|
||||
while (!isCancelled()) {
|
||||
this.publish(client.getTournament(tournamentId));
|
||||
this.publish(client.getTournament(tournamentId));
|
||||
Thread.sleep(2000);
|
||||
}
|
||||
return null;
|
||||
|
|
@ -710,7 +731,8 @@ class UpdateTournamentTask extends SwingWorker<Void, TournamentView> {
|
|||
logger.fatal("Update Tournament Task error", ex);
|
||||
} catch (ExecutionException ex) {
|
||||
logger.fatal("Update Tournament Task error", ex);
|
||||
} catch (CancellationException ex) {}
|
||||
} catch (CancellationException ex) {
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,7 +1,21 @@
|
|||
package mage.client.util.gui;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.awt.Component;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.Font;
|
||||
import java.awt.GraphicsConfiguration;
|
||||
import java.awt.Insets;
|
||||
import java.awt.Point;
|
||||
import java.awt.Rectangle;
|
||||
import java.util.ArrayList;
|
||||
import javax.swing.JButton;
|
||||
import javax.swing.JLabel;
|
||||
import javax.swing.SwingConstants;
|
||||
import mage.client.MageFrame;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.MageObjectType;
|
||||
import mage.constants.Rarity;
|
||||
import mage.utils.CardUtil;
|
||||
import mage.view.CardView;
|
||||
import mage.view.CounterView;
|
||||
|
|
@ -10,39 +24,34 @@ import org.jdesktop.swingx.JXPanel;
|
|||
import org.mage.card.arcane.ManaSymbols;
|
||||
import org.mage.card.arcane.UI;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
import java.util.ArrayList;
|
||||
import mage.constants.Rarity;
|
||||
|
||||
public class GuiDisplayUtil {
|
||||
|
||||
private static final Font cardNameFont = new Font("Calibri", Font.BOLD, 15);
|
||||
private static final Insets DEFAULT_INSETS = new Insets(0, 0, 70, 25);
|
||||
private static final Insets COMPONENT_INSETS = new Insets(0, 0, 40, 40);
|
||||
|
||||
public static class TextLines {
|
||||
|
||||
|
||||
public int basicTextLength;
|
||||
public ArrayList<String> lines;
|
||||
}
|
||||
|
||||
|
||||
public static JXPanel getDescription(CardView card, int width, int height) {
|
||||
JXPanel descriptionPanel = new JXPanel();
|
||||
|
||||
//descriptionPanel.setAlpha(.8f);
|
||||
descriptionPanel.setBounds(0, 0, width, height);
|
||||
descriptionPanel.setBounds(0, 0, width, height);
|
||||
descriptionPanel.setVisible(false);
|
||||
descriptionPanel.setLayout(null);
|
||||
|
||||
//descriptionPanel.setBorder(BorderFactory.createLineBorder(Color.green));
|
||||
|
||||
JButton j = new JButton("");
|
||||
j.setBounds(0, 0, width, height);
|
||||
j.setBounds(0, 0, width, height);
|
||||
j.setBackground(Color.black);
|
||||
j.setLayout(null);
|
||||
|
||||
JLabel cardText = new JLabel();
|
||||
cardText.setBounds(5, 5, width - 10, height - 10);
|
||||
cardText.setBounds(5, 5, width - 10, height - 10);
|
||||
cardText.setForeground(Color.white);
|
||||
cardText.setFont(cardNameFont);
|
||||
cardText.setVerticalAlignment(SwingConstants.TOP);
|
||||
|
|
@ -70,31 +79,52 @@ public class GuiDisplayUtil {
|
|||
return out.toString().toLowerCase();
|
||||
}
|
||||
|
||||
public static void keepComponentInsideScreen(int centerX, int centerY, Component component) {
|
||||
Dimension screenDim = component.getToolkit().getScreenSize();
|
||||
GraphicsConfiguration g = component.getGraphicsConfiguration();
|
||||
|
||||
public static void keepComponentInsideScreen(int x, int y, Component c) {
|
||||
Dimension screenDim = c.getToolkit().getScreenSize();
|
||||
GraphicsConfiguration g = c.getGraphicsConfiguration();
|
||||
if (g != null) {
|
||||
Insets insets = c.getToolkit().getScreenInsets(g);
|
||||
|
||||
if (x + c.getWidth() > screenDim.width - insets.right) {
|
||||
x = (screenDim.width - insets.right) - c.getWidth();
|
||||
} else if (x < insets.left) {
|
||||
x = insets.left;
|
||||
Insets insets = component.getToolkit().getScreenInsets(g); // no usable space like toolbar
|
||||
boolean setLocation = false;
|
||||
if (centerX + component.getWidth() > screenDim.width - insets.right) {
|
||||
centerX = (screenDim.width - insets.right) - component.getWidth();
|
||||
setLocation = true;
|
||||
} else if (centerX < insets.left) {
|
||||
centerX = insets.left;
|
||||
setLocation = true;
|
||||
}
|
||||
|
||||
if (y + c.getHeight() > screenDim.height - insets.bottom) {
|
||||
y = (screenDim.height - insets.bottom) - c.getHeight();
|
||||
} else if (y < insets.top) {
|
||||
y = insets.top;
|
||||
if (centerY + component.getHeight() > screenDim.height - insets.bottom) {
|
||||
centerY = (screenDim.height - insets.bottom) - component.getHeight();
|
||||
setLocation = true;
|
||||
} else if (centerY < insets.top) {
|
||||
centerY = insets.top;
|
||||
setLocation = true;
|
||||
}
|
||||
if (setLocation) {
|
||||
component.setLocation(centerX, centerY);
|
||||
}
|
||||
|
||||
c.setLocation(x, y);
|
||||
} else {
|
||||
System.out.println("GuiDisplayUtil::keepComponentInsideScreen -> no GraphicsConfiguration");
|
||||
}
|
||||
}
|
||||
|
||||
static final int OVERLAP_LIMIT = 10;
|
||||
|
||||
public static void keepComponentInsideFrame(int centerX, int centerY, Component component) {
|
||||
Rectangle frameRec = MageFrame.getInstance().getBounds();
|
||||
boolean setLocation = false;
|
||||
if (component.getX() > (frameRec.width - OVERLAP_LIMIT)) {
|
||||
setLocation = true;
|
||||
}
|
||||
if (component.getY() > (frameRec.height - OVERLAP_LIMIT)) {
|
||||
setLocation = true;
|
||||
}
|
||||
if (setLocation) {
|
||||
component.setLocation(centerX, centerY);
|
||||
}
|
||||
}
|
||||
|
||||
public static Point keepComponentInsideParent(Point l, Point parentPoint, Component c, Component parent) {
|
||||
int dx = parentPoint.x + parent.getWidth() - DEFAULT_INSETS.right - COMPONENT_INSETS.right;
|
||||
if (l.x + c.getWidth() > dx) {
|
||||
|
|
@ -112,8 +142,8 @@ public class GuiDisplayUtil {
|
|||
public static TextLines getTextLinesfromCardView(CardView card) {
|
||||
TextLines textLines = new TextLines();
|
||||
textLines.lines = new ArrayList<>(card.getRules());
|
||||
for (String rule: card.getRules()) {
|
||||
textLines.basicTextLength +=rule.length();
|
||||
for (String rule : card.getRules()) {
|
||||
textLines.basicTextLength += rule.length();
|
||||
}
|
||||
if (card.getMageObjectType().equals(MageObjectType.PERMANENT)) {
|
||||
if (card.getPairedCard() != null) {
|
||||
|
|
@ -151,7 +181,7 @@ public class GuiDisplayUtil {
|
|||
}
|
||||
}
|
||||
if (card.getMageObjectType().isPermanent() && card instanceof PermanentView) {
|
||||
int damage = ((PermanentView)card).getDamage();
|
||||
int damage = ((PermanentView) card).getDamage();
|
||||
if (damage > 0) {
|
||||
textLines.lines.add("<span color='red'><b>Damage dealt:</b> " + damage + "</span>");
|
||||
textLines.basicTextLength += 50;
|
||||
|
|
@ -178,10 +208,10 @@ public class GuiDisplayUtil {
|
|||
|
||||
String fontFamily = "tahoma";
|
||||
/*if (prefs.fontFamily == CardFontFamily.arial)
|
||||
fontFamily = "arial";
|
||||
else if (prefs.fontFamily == CardFontFamily.verdana) {
|
||||
fontFamily = "verdana";
|
||||
}*/
|
||||
fontFamily = "arial";
|
||||
else if (prefs.fontFamily == CardFontFamily.verdana) {
|
||||
fontFamily = "verdana";
|
||||
}*/
|
||||
|
||||
final StringBuilder buffer = new StringBuilder(512);
|
||||
buffer.append("<html><body style='font-family:");
|
||||
|
|
@ -193,7 +223,7 @@ public class GuiDisplayUtil {
|
|||
buffer.append("<tr><td valign='top'><b>");
|
||||
buffer.append(card.getDisplayName());
|
||||
if (card.isGameObject()) {
|
||||
buffer.append(" [").append(card.getId().toString().substring(0,3)).append("]");
|
||||
buffer.append(" [").append(card.getId().toString().substring(0, 3)).append("]");
|
||||
}
|
||||
buffer.append("</b></td><td align='right' valign='top' style='width:");
|
||||
buffer.append(symbolCount * 11 + 1);
|
||||
|
|
@ -203,31 +233,31 @@ public class GuiDisplayUtil {
|
|||
}
|
||||
buffer.append("</td></tr></table>");
|
||||
buffer.append("<table cellspacing=0 cellpadding=0 border=0 width='100%'><tr><td style='margin-left: 1px'>");
|
||||
if(card.getColor().isWhite()) {
|
||||
if (card.getColor().isWhite()) {
|
||||
buffer.append("<img src='").append(getResourcePath("card/color_ind_white.png")).append("' alt='W'>");
|
||||
}
|
||||
if(card.getColor().isBlue()) {
|
||||
if (card.getColor().isBlue()) {
|
||||
buffer.append("<img src='").append(getResourcePath("card/color_ind_blue.png")).append("' alt='U'>");
|
||||
}
|
||||
if(card.getColor().isBlack()) {
|
||||
if (card.getColor().isBlack()) {
|
||||
buffer.append("<img src='").append(getResourcePath("card/color_ind_black.png")).append("' alt='B'>");
|
||||
}
|
||||
if(card.getColor().isRed()) {
|
||||
if (card.getColor().isRed()) {
|
||||
buffer.append("<img src='").append(getResourcePath("card/color_ind_red.png")).append("' alt='R'>");
|
||||
}
|
||||
if(card.getColor().isGreen()) {
|
||||
if (card.getColor().isGreen()) {
|
||||
buffer.append("<img src='").append(getResourcePath("card/color_ind_green.png")).append("' alt='G'>");
|
||||
}
|
||||
if(!card.getColor().isColorless()) {
|
||||
if (!card.getColor().isColorless()) {
|
||||
buffer.append(" ");
|
||||
}
|
||||
buffer.append(getTypes(card));
|
||||
buffer.append("</td><td align='right'>");
|
||||
String rarity ;
|
||||
String rarity;
|
||||
if (card.getRarity() == null) {
|
||||
rarity = Rarity.COMMON.getCode();
|
||||
buffer.append("<b color='black'>");
|
||||
}else {
|
||||
buffer.append("<b color='black'>");
|
||||
} else {
|
||||
switch (card.getRarity()) {
|
||||
case RARE:
|
||||
buffer.append("<b color='#FFBF00'>");
|
||||
|
|
@ -305,7 +335,7 @@ public class GuiDisplayUtil {
|
|||
if (textLine != null && !textLine.replace(".", "").trim().isEmpty()) {
|
||||
rule.append("<p style='margin: 2px'>").append(textLine).append("</p>");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
String legal = rule.toString();
|
||||
|
|
@ -314,12 +344,12 @@ public class GuiDisplayUtil {
|
|||
// legal = legal.replaceAll("#([^#]+)#", "<i>$1</i>");
|
||||
// legal = legal.replaceAll("\\s*//\\s*", "<hr width='50%'>");
|
||||
// legal = legal.replace("\r\n", "<div style='font-size:5pt'></div>");
|
||||
legal = legal.replaceAll("\\{this\\}", card.getName().isEmpty() ? "this":card.getName());
|
||||
legal = legal.replaceAll("\\{source\\}", card.getName().isEmpty() ? "this":card.getName());
|
||||
legal = legal.replaceAll("\\{this\\}", card.getName().isEmpty() ? "this" : card.getName());
|
||||
legal = legal.replaceAll("\\{source\\}", card.getName().isEmpty() ? "this" : card.getName());
|
||||
buffer.append(ManaSymbols.replaceSymbolsWithHTML(legal, ManaSymbols.Type.CARD));
|
||||
}
|
||||
|
||||
buffer.append("<br></body></html>");
|
||||
buffer.append("<br></body></html>");
|
||||
return buffer;
|
||||
}
|
||||
|
||||
|
|
@ -342,5 +372,5 @@ public class GuiDisplayUtil {
|
|||
types += subType + " ";
|
||||
}
|
||||
return types.trim();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,7 +8,6 @@ package mage.client.util.gui;
|
|||
import javax.swing.JTable;
|
||||
import javax.swing.table.TableColumn;
|
||||
import mage.client.dialog.PreferencesDialog;
|
||||
import org.mage.card.arcane.Util;
|
||||
|
||||
/**
|
||||
*
|
||||
|
|
@ -17,25 +16,29 @@ import org.mage.card.arcane.Util;
|
|||
public class TableUtil {
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @param table
|
||||
* @param defaultColumnsWidth
|
||||
* @param widthPrefKey
|
||||
* @param orderPrefKey
|
||||
* @param defaultColumnsWidth
|
||||
* @param widthPrefKey
|
||||
* @param orderPrefKey
|
||||
*/
|
||||
static public void setColumnWidthAndOrder(JTable table, int[] defaultColumnsWidth, String widthPrefKey, String orderPrefKey) {
|
||||
table.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
|
||||
|
||||
// set the column width from saved value or defaults
|
||||
// set the column width from saved value or defaults
|
||||
int[] widths = getIntArrayFromString(PreferencesDialog.getCachedValue(widthPrefKey, null));
|
||||
int i = 0;
|
||||
for (int width : defaultColumnsWidth) {
|
||||
if (widths != null && widths.length > i) {
|
||||
width = widths[i];
|
||||
}
|
||||
TableColumn column = table.getColumnModel().getColumn(i++);
|
||||
column.setWidth(width);
|
||||
column.setPreferredWidth(width);
|
||||
if (table.getColumnModel().getColumnCount() >= i) {
|
||||
TableColumn column = table.getColumnModel().getColumn(i++);
|
||||
column.setWidth(width);
|
||||
column.setPreferredWidth(width);
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// set the column order
|
||||
|
|
@ -47,7 +50,7 @@ public class TableUtil {
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
static public void saveColumnWidthAndOrderToPrefs(JTable table, String widthPrefKey, String orderPrefKey) {
|
||||
// Column width
|
||||
StringBuilder columnWidthSettings = new StringBuilder();
|
||||
|
|
@ -68,8 +71,7 @@ public class TableUtil {
|
|||
PreferencesDialog.saveValue(orderPrefKey, columnOrderSettings.toString());
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
public static int[] getIntArrayFromString(String stringData) {
|
||||
int[] intArray = null;
|
||||
if (stringData != null && !stringData.isEmpty()) {
|
||||
|
|
@ -79,9 +81,10 @@ public class TableUtil {
|
|||
for (int i = 0; i < lengthW; i++) {
|
||||
try {
|
||||
intArray[i] = Integer.parseInt(items[i]);
|
||||
} catch (NumberFormatException nfe) {}
|
||||
} catch (NumberFormatException nfe) {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return intArray;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -25,56 +25,28 @@
|
|||
* authors and should not be interpreted as representing official policies, either expressed
|
||||
* or implied, of BetaSteward_at_googlemail.com.
|
||||
*/
|
||||
|
||||
package mage.client.util.gui.countryBox;
|
||||
|
||||
import java.awt.Component;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import javax.swing.ImageIcon;
|
||||
import javax.swing.JLabel;
|
||||
import javax.swing.JTable;
|
||||
import javax.swing.table.DefaultTableCellRenderer;
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author LevelX2
|
||||
*/
|
||||
public class CountryCellRenderer extends DefaultTableCellRenderer {
|
||||
|
||||
private static final Logger logger = Logger.getLogger(CountryCellRenderer.class);
|
||||
private final Map<String, ImageIcon> flagIconCache = new HashMap<>();
|
||||
|
||||
private final Map<String, String> countryMap = new HashMap<>();
|
||||
|
||||
public CountryCellRenderer() {
|
||||
for( int i = 0; i <= CountryComboBox.countryList.length - 1; i++) {
|
||||
countryMap.put(CountryComboBox.countryList[i][1],CountryComboBox.countryList[i][0]);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) {
|
||||
JLabel label = (JLabel)super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column);
|
||||
if(table.convertColumnIndexToView(0) == column) {
|
||||
label.setToolTipText(countryMap.get((String)value));
|
||||
label.setIcon(getCountryFlagIcon((String)value));
|
||||
label.setText("");
|
||||
}
|
||||
return label;
|
||||
}
|
||||
|
||||
private ImageIcon getCountryFlagIcon(String countryCode) {
|
||||
ImageIcon flagIcon = flagIconCache.get(countryCode);
|
||||
if (flagIcon == null) {
|
||||
flagIcon = new javax.swing.ImageIcon(getClass().getResource("/flags/" + countryCode + (countryCode.endsWith(".png") ? "" :".png")));
|
||||
if (flagIcon.getImage() == null) {
|
||||
logger.warn("Country flag resource not found: " + countryCode);
|
||||
} else {
|
||||
flagIconCache.put(countryCode, flagIcon);
|
||||
}
|
||||
JLabel label = (JLabel) super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column);
|
||||
if (value == null || ((String) value).isEmpty()) {
|
||||
value = (String) "world";
|
||||
}
|
||||
return flagIcon;
|
||||
}
|
||||
label.setToolTipText(CountryUtil.getCountryName((String) value));
|
||||
label.setIcon(CountryUtil.getCountryFlagIcon((String) value));
|
||||
label.setText("");
|
||||
return label;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,49 @@
|
|||
/*
|
||||
* To change this license header, choose License Headers in Project Properties.
|
||||
* To change this template file, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
package mage.client.util.gui.countryBox;
|
||||
|
||||
import java.net.URL;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import javax.swing.ImageIcon;
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author LevelX2
|
||||
*/
|
||||
public class CountryUtil {
|
||||
|
||||
private static final Logger logger = Logger.getLogger(CountryUtil.class);
|
||||
private static final Map<String, ImageIcon> flagIconCache = new HashMap<>();
|
||||
private static final Map<String, String> countryMap = new HashMap<>();
|
||||
|
||||
public static ImageIcon getCountryFlagIcon(String countryCode) {
|
||||
ImageIcon flagIcon = flagIconCache.get(countryCode);
|
||||
if (flagIcon == null) {
|
||||
URL url = CountryUtil.class.getResource("/flags/" + countryCode + (countryCode.endsWith(".png") ? "" : ".png"));
|
||||
if (url != null) {
|
||||
flagIcon = new javax.swing.ImageIcon(url);
|
||||
}
|
||||
if (flagIcon == null || flagIcon.getImage() == null) {
|
||||
logger.warn("Country flag resource not found: " + countryCode);
|
||||
flagIconCache.put(countryCode, flagIcon);
|
||||
} else {
|
||||
flagIconCache.put(countryCode, flagIcon);
|
||||
}
|
||||
}
|
||||
return flagIcon;
|
||||
}
|
||||
|
||||
public static String getCountryName(String countryCode) {
|
||||
if (countryMap.isEmpty()) {
|
||||
for (int i = 0; i <= CountryComboBox.countryList.length - 1; i++) {
|
||||
countryMap.put(CountryComboBox.countryList[i][1], CountryComboBox.countryList[i][0]);
|
||||
}
|
||||
}
|
||||
return countryMap.get(countryCode);
|
||||
}
|
||||
}
|
||||
|
|
@ -99,12 +99,12 @@ public class CardPanel extends MagePermanent implements MouseListener, MouseMoti
|
|||
public JPanel buttonPanel;
|
||||
private JButton dayNightButton;
|
||||
|
||||
public JPanel copyIconPanel;
|
||||
public JPanel copyIconPanel;
|
||||
private JButton showCopySourceButton;
|
||||
|
||||
|
||||
public JPanel iconPanel;
|
||||
private JButton typeButton;
|
||||
|
||||
|
||||
public JPanel counterPanel;
|
||||
private JLabel loyaltyCounterLabel;
|
||||
private JLabel plusCounterLabel;
|
||||
|
|
@ -125,7 +125,7 @@ public class CardPanel extends MagePermanent implements MouseListener, MouseMoti
|
|||
private boolean isSelected;
|
||||
private boolean isPlayable;
|
||||
private boolean isChoosable;
|
||||
private boolean canAttack;
|
||||
private boolean canAttack;
|
||||
private boolean showCastingCost;
|
||||
private boolean hasImage = false;
|
||||
private float alpha = 1.0f;
|
||||
|
|
@ -151,7 +151,7 @@ public class CardPanel extends MagePermanent implements MouseListener, MouseMoti
|
|||
private JPanel cardArea;
|
||||
|
||||
private int yTextOffset = 10;
|
||||
|
||||
|
||||
public CardPanel(CardView newGameCard, UUID gameId, final boolean loadImage, ActionCallback callback, final boolean foil, Dimension dimension) {
|
||||
this.gameCard = newGameCard;
|
||||
this.callback = callback;
|
||||
|
|
@ -224,12 +224,12 @@ public class CardPanel extends MagePermanent implements MouseListener, MouseMoti
|
|||
if (AbilityType.TRIGGERED.equals(newGameCard.getAbilityType())) {
|
||||
setTypeIcon(ImageManagerImpl.getInstance().getTriggeredAbilityImage(),"Triggered Ability");
|
||||
} else if (AbilityType.ACTIVATED.equals(newGameCard.getAbilityType())) {
|
||||
setTypeIcon(ImageManagerImpl.getInstance().getActivatedAbilityImage(),"Activated Ability");
|
||||
}
|
||||
setTypeIcon(ImageManagerImpl.getInstance().getActivatedAbilityImage(),"Activated Ability");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (this.gameCard.isToken()) {
|
||||
setTypeIcon(ImageManagerImpl.getInstance().getTokenIconImage(),"Token Permanent");
|
||||
setTypeIcon(ImageManagerImpl.getInstance().getTokenIconImage(),"Token Permanent");
|
||||
}
|
||||
|
||||
// icon to inform about permanent is copying something
|
||||
|
|
@ -242,7 +242,7 @@ public class CardPanel extends MagePermanent implements MouseListener, MouseMoti
|
|||
showCopySourceButton = new JButton("");
|
||||
showCopySourceButton.setLocation(2, 2);
|
||||
showCopySourceButton.setSize(25, 25);
|
||||
showCopySourceButton.setToolTipText("This permanent is copying a target. To see original image, push this button or turn mouse wheel down while hoovering with the mouse pointer over the permanent.");
|
||||
showCopySourceButton.setToolTipText("This permanent is copying a target. To see original image, push this button or turn mouse wheel down while hovering with the mouse pointer over the permanent.");
|
||||
copyIconPanel.setVisible(((PermanentView) this.gameCard).isCopy());
|
||||
|
||||
showCopySourceButton.setIcon(new ImageIcon(ImageManagerImpl.getInstance().getCopyInformIconImage()));
|
||||
|
|
@ -265,7 +265,7 @@ public class CardPanel extends MagePermanent implements MouseListener, MouseMoti
|
|||
addMouseMotionListener(this);
|
||||
addMouseWheelListener(this);
|
||||
addComponentListener(this);
|
||||
|
||||
|
||||
displayTitleAnyway = PreferencesDialog.getCachedValue(PreferencesDialog.KEY_SHOW_CARD_NAMES, "true").equals("true");
|
||||
titleText = new GlowText();
|
||||
setText(gameCard);
|
||||
|
|
@ -274,7 +274,7 @@ public class CardPanel extends MagePermanent implements MouseListener, MouseMoti
|
|||
titleText.setGlow(Color.black, TEXT_GLOW_SIZE, TEXT_GLOW_INTENSITY);
|
||||
titleText.setWrap(true);
|
||||
add(titleText);
|
||||
|
||||
|
||||
ptText = new GlowText();
|
||||
if (CardUtil.isCreature(gameCard)) {
|
||||
ptText.setText(gameCard.getPower() + "/" + gameCard.getToughness());
|
||||
|
|
@ -350,9 +350,9 @@ public class CardPanel extends MagePermanent implements MouseListener, MouseMoti
|
|||
if (toolTipText != null) {
|
||||
typeButton.setToolTipText(toolTipText);
|
||||
}
|
||||
iconPanel.add(typeButton);
|
||||
iconPanel.add(typeButton);
|
||||
}
|
||||
|
||||
|
||||
public void cleanUp() {
|
||||
if (dayNightButton != null) {
|
||||
for(ActionListener al: dayNightButton.getActionListeners()) {
|
||||
|
|
@ -596,7 +596,7 @@ public class CardPanel extends MagePermanent implements MouseListener, MouseMoti
|
|||
int offsetX = Math.round((CARD_SIZE_FULL.width - cardWidth) / 10.0f);
|
||||
|
||||
ptText.setLocation(cardXOffset + ptX - TEXT_GLOW_SIZE / 2 - offsetX, cardYOffset + ptY - TEXT_GLOW_SIZE / 2);
|
||||
|
||||
|
||||
if (isAnimationPanel || cardWidth < 200) {
|
||||
imagePanel.setScalingType(ScalingType.nearestNeighbor);
|
||||
} else {
|
||||
|
|
@ -842,7 +842,7 @@ public class CardPanel extends MagePermanent implements MouseListener, MouseMoti
|
|||
dayNightButton.setIcon(new ImageIcon(transformIcon));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (counterPanel != null) {
|
||||
updateCounters(card);
|
||||
}
|
||||
|
|
@ -1161,7 +1161,7 @@ public class CardPanel extends MagePermanent implements MouseListener, MouseMoti
|
|||
this.gameCard = this.temporary;
|
||||
this.temporary = null;
|
||||
update(this.gameCard);
|
||||
}
|
||||
}
|
||||
}
|
||||
String temp = this.gameCard.getAlternateName();
|
||||
this.gameCard.setAlternateName(this.gameCard.getOriginalName());
|
||||
|
|
|
|||
|
|
@ -1,5 +1,21 @@
|
|||
package org.mage.plugins.card;
|
||||
|
||||
import java.awt.BorderLayout;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.Frame;
|
||||
import java.awt.Image;
|
||||
import java.awt.Rectangle;
|
||||
import java.awt.event.WindowAdapter;
|
||||
import java.awt.event.WindowEvent;
|
||||
import java.awt.image.BufferedImage;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
import javax.swing.JComponent;
|
||||
import javax.swing.JDialog;
|
||||
import javax.swing.JLayeredPane;
|
||||
import mage.cards.MagePermanent;
|
||||
import mage.cards.action.ActionCallback;
|
||||
import mage.constants.Rarity;
|
||||
|
|
@ -20,20 +36,13 @@ import org.mage.plugins.card.constants.Constants;
|
|||
import org.mage.plugins.card.dl.DownloadGui;
|
||||
import org.mage.plugins.card.dl.DownloadJob;
|
||||
import org.mage.plugins.card.dl.Downloader;
|
||||
import org.mage.plugins.card.dl.sources.CardFrames;
|
||||
import org.mage.plugins.card.dl.sources.DirectLinksForDownload;
|
||||
import org.mage.plugins.card.dl.sources.GathererSets;
|
||||
import org.mage.plugins.card.dl.sources.GathererSymbols;
|
||||
import org.mage.plugins.card.images.ImageCache;
|
||||
import org.mage.plugins.card.info.CardInfoPaneImpl;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
import java.awt.event.WindowAdapter;
|
||||
import java.awt.event.WindowEvent;
|
||||
import java.awt.image.BufferedImage;
|
||||
import java.util.*;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* {@link CardPlugin} implementation.
|
||||
*
|
||||
|
|
@ -496,6 +505,11 @@ public class CardPluginImpl implements CardPlugin {
|
|||
g.getDownloader().add(job);
|
||||
}
|
||||
|
||||
it = new CardFrames(imagesPath);
|
||||
for(DownloadJob job:it) {
|
||||
g.getDownloader().add(job);
|
||||
}
|
||||
|
||||
it = new DirectLinksForDownload(imagesPath);
|
||||
for(DownloadJob job:it) {
|
||||
g.getDownloader().add(job);
|
||||
|
|
|
|||
|
|
@ -15,12 +15,11 @@ import java.io.OutputStream;
|
|||
import java.net.Proxy;
|
||||
import java.net.URL;
|
||||
import java.net.URLConnection;
|
||||
|
||||
import javax.swing.BoundedRangeModel;
|
||||
import javax.swing.DefaultBoundedRangeModel;
|
||||
|
||||
import org.mage.plugins.card.dl.beans.properties.Property;
|
||||
import org.mage.plugins.card.dl.lm.AbstractLaternaBean;
|
||||
import org.mage.plugins.card.utils.CardImageUtils;
|
||||
|
||||
|
||||
/**
|
||||
|
|
@ -86,9 +85,11 @@ public class DownloadJob extends AbstractLaternaBean {
|
|||
*/
|
||||
public void setError(String message, Exception error) {
|
||||
if (message == null) {
|
||||
message = error.toString();
|
||||
|
||||
message = "Download of " + this.getName() + "from " + this.getSource().toString() + " caused error: " + error.toString();
|
||||
}
|
||||
log.warn(message, error);
|
||||
// log.warn(message, error);
|
||||
log.warn(message);
|
||||
this.state.setValue(State.ABORTED);
|
||||
this.error.setValue(error);
|
||||
this.message.setValue(message);
|
||||
|
|
@ -132,11 +133,11 @@ public class DownloadJob extends AbstractLaternaBean {
|
|||
}
|
||||
|
||||
public static Source fromURL(final String url) {
|
||||
return fromURL(null, url);
|
||||
return fromURL(CardImageUtils.getProxyFromPreferences(), url);
|
||||
}
|
||||
|
||||
public static Source fromURL(final URL url) {
|
||||
return fromURL(null, url);
|
||||
return fromURL(CardImageUtils.getProxyFromPreferences(), url);
|
||||
}
|
||||
|
||||
public static Source fromURL(final Proxy proxy, final String url) {
|
||||
|
|
@ -159,6 +160,12 @@ public class DownloadJob extends AbstractLaternaBean {
|
|||
public int length() throws IOException {
|
||||
return getConnection().getContentLength();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return proxy != null ? proxy.type().toString()+" " :"" + url;
|
||||
}
|
||||
|
||||
};
|
||||
}
|
||||
|
||||
|
|
@ -182,6 +189,11 @@ public class DownloadJob extends AbstractLaternaBean {
|
|||
public int length() throws IOException {
|
||||
return getConnection().getContentLength();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return proxy != null ? proxy.type().toString()+" " :"" + url;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@ import java.io.BufferedOutputStream;
|
|||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
import java.net.ConnectException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.ExecutorService;
|
||||
|
|
@ -158,6 +159,14 @@ public class Downloader extends AbstractLaternaBean implements Disposable {
|
|||
}
|
||||
}
|
||||
job.setState(State.FINISHED);
|
||||
} catch(ConnectException ex) {
|
||||
String message;
|
||||
if (ex.getMessage() != null) {
|
||||
message = ex.getMessage();
|
||||
} else {
|
||||
message = "Unknown error";
|
||||
}
|
||||
logger.warn("Error resource download " + job.getName() +" from "+ job.getSource().toString() + ": " + message);
|
||||
} catch(IOException ex) {
|
||||
job.setError(ex);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,100 @@
|
|||
/*
|
||||
* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification, are
|
||||
* permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice, this list of
|
||||
* conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
|
||||
* of conditions and the following disclaimer in the documentation and/or other materials
|
||||
* provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
||||
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* The views and conclusions contained in the software and documentation are those of the
|
||||
* authors and should not be interpreted as representing official policies, either expressed
|
||||
* or implied, of BetaSteward_at_googlemail.com.
|
||||
*/
|
||||
package org.mage.plugins.card.dl.sources;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import org.mage.plugins.card.dl.DownloadJob;
|
||||
import static org.mage.plugins.card.dl.DownloadJob.fromURL;
|
||||
import static org.mage.plugins.card.dl.DownloadJob.toFile;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author LevelX2
|
||||
*/
|
||||
|
||||
public class CardFrames implements Iterable<DownloadJob> {
|
||||
|
||||
private static final String FRAMES_PATH = File.separator + "frames";
|
||||
private static final File DEFAULT_OUT_DIR = new File("plugins" + File.separator + "images" + FRAMES_PATH);
|
||||
private static File outDir = DEFAULT_OUT_DIR;
|
||||
|
||||
static final String BASE_DOWNLOAD_URL = "http://ct-magefree.rhcloud.com/resources/img/";
|
||||
static final String TEXTURES_FOLDER = "textures";
|
||||
static final String PT_BOXES_FOLDER = "pt";
|
||||
|
||||
private static final String[] TEXTURES = {"U", "R", "G", "B", "W", "A",
|
||||
"BG_LAND", "BR_LAND", "WU_LAND", "WB_LAND", "UB_LAND", "GW_LAND", "RW_LAND",
|
||||
"RG_LAND", "GU_LAND", "UR_LAND"
|
||||
// NOT => "BW_LAND","BU_LAND","WG_LAND","WR_LAND",
|
||||
};
|
||||
private static final String[] PT_BOXES = {"U", "R", "G", "B", "W", "A"};
|
||||
|
||||
public CardFrames(String path) {
|
||||
if (path == null) {
|
||||
useDefaultDir();
|
||||
} else {
|
||||
changeOutDir(path);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Iterator<DownloadJob> iterator() {
|
||||
ArrayList<DownloadJob> jobs = new ArrayList<>();
|
||||
for (String texture : TEXTURES) {
|
||||
jobs.add(generateDownloadJob(TEXTURES_FOLDER, texture));
|
||||
}
|
||||
for (String pt_box : PT_BOXES) {
|
||||
jobs.add(generateDownloadJob(PT_BOXES_FOLDER, pt_box));
|
||||
}
|
||||
return jobs.iterator();
|
||||
}
|
||||
|
||||
private DownloadJob generateDownloadJob(String dirName, String name) {
|
||||
File dst = new File(outDir, name + ".png");
|
||||
String url = BASE_DOWNLOAD_URL + dirName + "/" + name + ".png";
|
||||
return new DownloadJob("frames-" + dirName + "-" + name, fromURL(url), toFile(dst));
|
||||
}
|
||||
|
||||
private void useDefaultDir() {
|
||||
outDir = DEFAULT_OUT_DIR;
|
||||
}
|
||||
|
||||
private void changeOutDir(String path) {
|
||||
File file = new File(path + FRAMES_PATH);
|
||||
if (file.exists()) {
|
||||
outDir = file;
|
||||
} else {
|
||||
file.mkdirs();
|
||||
if (file.exists()) {
|
||||
outDir = file;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -37,13 +37,15 @@ public class GathererSets implements Iterable<DownloadJob> {
|
|||
private static final String[] withMythics = {"M10", "M11", "M12", "M13", "M14", "M15", "ORI",
|
||||
"DDF", "DDG", "DDH", "DDI", "DDJ", "DDK", "DDL", "DDM", "DDN",
|
||||
"DD3", "DD3B", "DDO",
|
||||
"FVD", "FVE", "FVL", "FVR",
|
||||
"V12", "V13", "V14", "V15",
|
||||
"ALA", "CON", "ARB",
|
||||
"ZEN", "WWK", "ROE",
|
||||
"SOM", "MBS", "NPH",
|
||||
"CMD", "C13", "C14", "PC2",
|
||||
"ISD", "DKA", "AVR",
|
||||
"RTR", "GTC", "DGM",
|
||||
"MMA",
|
||||
"MMA", "MM2",
|
||||
"THS", "BNG", "JOU",
|
||||
"CNS", "VMA", "TPR",
|
||||
"KTK", "FRF", "DTK"};
|
||||
|
|
|
|||
|
|
@ -8,12 +8,10 @@ package org.mage.plugins.card.dl.sources;
|
|||
|
||||
|
||||
import com.google.common.collect.AbstractIterator;
|
||||
import org.mage.plugins.card.dl.DownloadJob;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.Iterator;
|
||||
|
||||
import static java.lang.String.format;
|
||||
import java.util.Iterator;
|
||||
import org.mage.plugins.card.dl.DownloadJob;
|
||||
import static org.mage.plugins.card.dl.DownloadJob.fromURL;
|
||||
import static org.mage.plugins.card.dl.DownloadJob.toFile;
|
||||
|
||||
|
|
@ -70,7 +68,9 @@ public class GathererSymbols implements Iterable<DownloadJob> {
|
|||
sym = "" + (numeric++);
|
||||
} else {
|
||||
sizeIndex++;
|
||||
if(sizeIndex == sizes.length) return endOfData();
|
||||
if(sizeIndex == sizes.length) {
|
||||
return endOfData();
|
||||
}
|
||||
|
||||
symIndex = 0;
|
||||
numeric = 0;
|
||||
|
|
@ -80,9 +80,17 @@ public class GathererSymbols implements Iterable<DownloadJob> {
|
|||
String symbol = sym.replaceAll("/", "");
|
||||
File dst = new File(dir, symbol + ".jpg");
|
||||
|
||||
if(symbol.equals("T")) symbol = "tap";
|
||||
else if(symbol.equals("Q")) symbol = "untap";
|
||||
else if(symbol.equals("S")) symbol = "snow";
|
||||
switch (symbol) {
|
||||
case "T":
|
||||
symbol = "tap";
|
||||
break;
|
||||
case "Q":
|
||||
symbol = "untap";
|
||||
break;
|
||||
case "S":
|
||||
symbol = "snow";
|
||||
break;
|
||||
}
|
||||
|
||||
String url = format(urlFmt, sizes[sizeIndex], symbol);
|
||||
|
||||
|
|
|
|||
|
|
@ -16,6 +16,15 @@ public class MagicCardsImageSource implements CardImageSource {
|
|||
|
||||
private static final Map<String, String> setNameTokenReplacement = new HashMap<String, String>() {
|
||||
{
|
||||
put("FVL", "from-the-vault-legends");
|
||||
put("FVD", "from-the-vault-dragons");
|
||||
put("FVE", "from-the-vault-exiled");
|
||||
put("FVR", "from-the-vault-relics");
|
||||
put("V12", "from-the-vault-realms");
|
||||
put("V13", "from-the-vault-twenty");
|
||||
put("V14", "from-the-vault-annihilation");
|
||||
put("V15", "from-the-vault-angels");
|
||||
put("CLASH", "clash-pack");
|
||||
put("TPR", "tempest-remastered");
|
||||
put("ORI", "magic-origins");
|
||||
put("MM2", "modern-masters-2015");
|
||||
|
|
|
|||
|
|
@ -138,6 +138,7 @@ public class WizardCardsImageSource implements CardImageSource {
|
|||
setsAliases.put("FUT", "Future Sight");
|
||||
setsAliases.put("FVD", "From the Vault: Dragons");
|
||||
setsAliases.put("FVE", "From the Vault: Exiled");
|
||||
setsAliases.put("FVL", "From the Vault: Legends");
|
||||
setsAliases.put("FVR", "From the Vault: Relics");
|
||||
setsAliases.put("GPT", "Guildpact");
|
||||
setsAliases.put("GPX", "Grand Prix");
|
||||
|
|
@ -214,6 +215,10 @@ public class WizardCardsImageSource implements CardImageSource {
|
|||
setsAliases.put("ULG", "Urza's Legacy");
|
||||
setsAliases.put("UNH", "Unhinged");
|
||||
setsAliases.put("USG", "Urza's Saga");
|
||||
setsAliases.put("V12", "From the Vault: Realms");
|
||||
setsAliases.put("V13", "From the Vault: Twenty");
|
||||
setsAliases.put("V14", "From the Vault: Annihilation (2014)");
|
||||
setsAliases.put("V15", "From the Vault: Angels (2015)");
|
||||
setsAliases.put("VG1", "Vanguard Set 1");
|
||||
setsAliases.put("VG2", "Vanguard Set 2");
|
||||
setsAliases.put("VG3", "Vanguard Set 3");
|
||||
|
|
|
|||
|
|
@ -1,8 +1,14 @@
|
|||
package org.mage.plugins.card.utils;
|
||||
|
||||
import java.net.InetSocketAddress;
|
||||
import java.net.Proxy;
|
||||
import java.util.HashMap;
|
||||
import java.util.prefs.Preferences;
|
||||
import mage.client.MageFrame;
|
||||
import mage.client.constants.Constants;
|
||||
import mage.client.dialog.PreferencesDialog;
|
||||
import mage.remote.Connection;
|
||||
import mage.remote.Connection.ProxyType;
|
||||
import net.java.truevfs.access.TFile;
|
||||
import org.apache.log4j.Logger;
|
||||
import org.mage.plugins.card.images.CardDownloadData;
|
||||
|
|
@ -150,4 +156,15 @@ public class CardImageUtils {
|
|||
|
||||
return imageDir + TFile.separator + imageName;
|
||||
}
|
||||
|
||||
public static Proxy getProxyFromPreferences() {
|
||||
Preferences prefs = MageFrame.getPreferences();
|
||||
Connection.ProxyType proxyType = Connection.ProxyType.valueByText(prefs.get("proxyType", "None"));
|
||||
if (!proxyType.equals(ProxyType.NONE)) {
|
||||
String proxyServer = prefs.get("proxyAddress", "");
|
||||
int proxyPort = Integer.parseInt(prefs.get("proxyPort", "0"));
|
||||
return new Proxy(Proxy.Type.HTTP, new InetSocketAddress(proxyServer, proxyPort));
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -15,6 +15,9 @@ public interface ImageManager {
|
|||
Image getTokenIconImage();
|
||||
Image getTriggeredAbilityImage();
|
||||
Image getActivatedAbilityImage();
|
||||
Image getLookedAtImage();
|
||||
Image getRevealedImage();
|
||||
Image getExileImage();
|
||||
Image getCopyInformIconImage();
|
||||
Image getCounterImageViolet();
|
||||
Image getCounterImageRed();
|
||||
|
|
|
|||
|
|
@ -110,6 +110,33 @@ public class ImageManagerImpl implements ImageManager {
|
|||
return imageTokenIcon;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Image getLookedAtImage() {
|
||||
if (lookedAtIcon == null) {
|
||||
Image image = getImageFromResourceTransparent("/game/looked_at.png", Color.WHITE, new Rectangle(20, 20));
|
||||
lookedAtIcon = BufferedImageBuilder.bufferImage(image, BufferedImage.TYPE_INT_ARGB);
|
||||
}
|
||||
return lookedAtIcon;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Image getRevealedImage() {
|
||||
if (revealedIcon == null) {
|
||||
Image image = getImageFromResourceTransparent("/game/revealed.png", Color.WHITE, new Rectangle(20, 20));
|
||||
revealedIcon = BufferedImageBuilder.bufferImage(image, BufferedImage.TYPE_INT_ARGB);
|
||||
}
|
||||
return revealedIcon;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Image getExileImage() {
|
||||
if (exileIcon == null) {
|
||||
Image image = getImageFromResourceTransparent("/info/exile.png", Color.WHITE, new Rectangle(20, 20));
|
||||
exileIcon = BufferedImageBuilder.bufferImage(image, BufferedImage.TYPE_INT_ARGB);
|
||||
}
|
||||
return exileIcon;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BufferedImage getTriggeredAbilityImage() {
|
||||
if (triggeredAbilityIcon == null) {
|
||||
|
|
@ -374,6 +401,9 @@ public class ImageManagerImpl implements ImageManager {
|
|||
private static BufferedImage imageTokenIcon;
|
||||
private static BufferedImage triggeredAbilityIcon;
|
||||
private static BufferedImage activatedAbilityIcon;
|
||||
private static BufferedImage lookedAtIcon;
|
||||
private static BufferedImage revealedIcon;
|
||||
private static BufferedImage exileIcon;
|
||||
private static BufferedImage imageCopyIcon;
|
||||
private static BufferedImage imageCounterGreen;
|
||||
private static BufferedImage imageCounterGrey;
|
||||
|
|
|
|||
|
|
@ -1,3 +1,20 @@
|
|||
#Generate|TOK:MM2|Eldrazi Spawn 1|
|
||||
#Generate|TOK:MM2|Eldrazi Spawn 2|
|
||||
#Generate|TOK:MM2|Eldrazi Spawn 3|
|
||||
#Generate|TOK:MM2|Elephant|
|
||||
#Generate|TOK:MM2|Faerie Rogue|
|
||||
#Generate|TOK:MM2|Germ|
|
||||
#Generate|TOK:MM2|Golem|
|
||||
#Generate|TOK:MM2|Insect|
|
||||
#Generate|TOK:MM2|Myr|
|
||||
#Generate|TOK:MM2|Saproling|
|
||||
#Generate|TOK:MM2|Snake|
|
||||
#Generate|TOK:MM2|Soldier|
|
||||
#Generate|TOK:MM2|Spirit|
|
||||
#Generate|TOK:MM2|Thrull|
|
||||
#Generate|TOK:MM2|Wolf|
|
||||
#Generate|TOK:MM2|Wurm|
|
||||
|
||||
#Generate|TOK:TPR|Goblin|
|
||||
#Generate|TOK:TPR|Pegasus|
|
||||
#Generate|TOK:TPR|Rat|
|
||||
|
|
|
|||
BIN
Mage.Client/src/main/resources/flags/computer.png
Normal file
BIN
Mage.Client/src/main/resources/flags/computer.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 3.7 KiB |
BIN
Mage.Client/src/main/resources/game/looked_at.png
Normal file
BIN
Mage.Client/src/main/resources/game/looked_at.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.2 KiB |
BIN
Mage.Client/src/main/resources/game/revealed.png
Normal file
BIN
Mage.Client/src/main/resources/game/revealed.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 3.2 KiB |
|
|
@ -64,6 +64,6 @@ ddd=gvl
|
|||
unh=uh
|
||||
dde=pvc
|
||||
# Remove setname as soon as the images can be downloaded
|
||||
ignore.urls=TOK,MMB
|
||||
ignore.urls=TOK,MM2,V15
|
||||
# sets ordered by release time (newest goes first)
|
||||
token.lookup.order=TPR,MPRP,DD3,DDO,ORI,MMB,PTC,DTK,FRF,KTK,M15,VMA,CNS,JOU,BNG,THS,DDL,M14,MMA,DGM,GTC,RTR,M13,AVR,DDI,DKA,ISD,M12,NPH,MBS,SOM,M11,ROE,DDE,WWK,ZEN,M10,GVL,ARB,DVD,CFX,JVC,ALA,EVE,SHM,EVG,MOR,LRW,10E,CLS,CHK,GRC
|
||||
token.lookup.order=FVD,FVE,FVL,FVR,V12,V13,V14,V15,TPR,MPRP,DD3,DDO,ORI,MM2,PTC,DTK,FRF,KTK,M15,VMA,CNS,JOU,BNG,THS,DDL,M14,MMA,DGM,GTC,RTR,M13,AVR,DDI,DKA,ISD,M12,NPH,MBS,SOM,M11,ROE,DDE,WWK,ZEN,M10,GVL,ARB,DVD,CFX,JVC,ALA,EVE,SHM,EVG,MOR,LRW,10E,CLS,CHK,GRC
|
||||
Loading…
Add table
Add a link
Reference in a new issue