mirror of
https://github.com/magefree/mage.git
synced 2025-12-22 11:32:00 -08:00
* Added possibility to allow other players to see hand cards of player.
This commit is contained in:
parent
d0e1107a3e
commit
7e145d2cfd
33 changed files with 1093 additions and 190 deletions
|
|
@ -92,6 +92,7 @@ import java.util.concurrent.Executors;
|
||||||
import java.util.concurrent.ScheduledExecutorService;
|
import java.util.concurrent.ScheduledExecutorService;
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
import java.util.prefs.Preferences;
|
import java.util.prefs.Preferences;
|
||||||
|
import mage.view.UserRequestMessage;
|
||||||
import net.java.truevfs.access.TArchiveDetector;
|
import net.java.truevfs.access.TArchiveDetector;
|
||||||
import net.java.truevfs.access.TConfig;
|
import net.java.truevfs.access.TConfig;
|
||||||
import net.java.truevfs.kernel.spec.FsAccessOption;
|
import net.java.truevfs.kernel.spec.FsAccessOption;
|
||||||
|
|
@ -1059,6 +1060,24 @@ public class MageFrame extends javax.swing.JFrame implements MageClient {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void showUserRequestDialog(final UserRequestMessage userRequestMessage) {
|
||||||
|
final UserRequestDialog userRequestDialog = new UserRequestDialog();
|
||||||
|
userRequestDialog.setLocation(100, 100);
|
||||||
|
desktopPane.add(userRequestDialog, JLayeredPane.MODAL_LAYER);
|
||||||
|
// ui.addComponent(MageComponents.DESKTOP_PANE, userRequestDialog);
|
||||||
|
if (SwingUtilities.isEventDispatchThread()) {
|
||||||
|
userRequestDialog.showDialog(userRequestMessage);
|
||||||
|
} else {
|
||||||
|
SwingUtilities.invokeLater(new Runnable() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
userRequestDialog.showDialog(userRequestMessage);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
public void showErrorDialog(final String title, final String message) {
|
public void showErrorDialog(final String title, final String message) {
|
||||||
if (SwingUtilities.isEventDispatchThread()) {
|
if (SwingUtilities.isEventDispatchThread()) {
|
||||||
errorDialog.showDialog(title, message);
|
errorDialog.showDialog(title, message);
|
||||||
|
|
|
||||||
|
|
@ -24,7 +24,6 @@
|
||||||
<Layout>
|
<Layout>
|
||||||
<DimensionLayout dim="0">
|
<DimensionLayout dim="0">
|
||||||
<Group type="103" groupAlignment="0" attributes="0">
|
<Group type="103" groupAlignment="0" attributes="0">
|
||||||
<Component id="tabsPanel" alignment="0" max="32767" attributes="0"/>
|
|
||||||
<Group type="102" alignment="1" attributes="0">
|
<Group type="102" alignment="1" attributes="0">
|
||||||
<EmptySpace max="32767" attributes="0"/>
|
<EmptySpace max="32767" attributes="0"/>
|
||||||
<Component id="saveButton" min="-2" max="-2" attributes="0"/>
|
<Component id="saveButton" min="-2" max="-2" attributes="0"/>
|
||||||
|
|
@ -32,6 +31,7 @@
|
||||||
<Component id="exitButton" min="-2" pref="55" max="-2" attributes="0"/>
|
<Component id="exitButton" min="-2" pref="55" max="-2" attributes="0"/>
|
||||||
<EmptySpace max="-2" attributes="0"/>
|
<EmptySpace max="-2" attributes="0"/>
|
||||||
</Group>
|
</Group>
|
||||||
|
<Component id="tabsPanel" alignment="0" max="32767" attributes="0"/>
|
||||||
</Group>
|
</Group>
|
||||||
</DimensionLayout>
|
</DimensionLayout>
|
||||||
<DimensionLayout dim="1">
|
<DimensionLayout dim="1">
|
||||||
|
|
@ -80,12 +80,12 @@
|
||||||
<Group type="103" groupAlignment="0" attributes="0">
|
<Group type="103" groupAlignment="0" attributes="0">
|
||||||
<Group type="102" alignment="0" attributes="0">
|
<Group type="102" alignment="0" attributes="0">
|
||||||
<EmptySpace max="-2" attributes="0"/>
|
<EmptySpace max="-2" attributes="0"/>
|
||||||
<Component id="main_card" min="-2" pref="99" max="-2" attributes="0"/>
|
<Component id="main_card" min="-2" max="-2" attributes="0"/>
|
||||||
<EmptySpace max="-2" attributes="0"/>
|
<EmptySpace max="-2" attributes="0"/>
|
||||||
<Component id="main_game" min="-2" max="-2" attributes="0"/>
|
<Component id="main_game" min="-2" max="-2" attributes="0"/>
|
||||||
<EmptySpace max="-2" attributes="0"/>
|
<EmptySpace max="-2" attributes="0"/>
|
||||||
<Component id="main_gamelog" min="-2" max="-2" attributes="0"/>
|
<Component id="main_gamelog" min="-2" max="-2" attributes="0"/>
|
||||||
<EmptySpace pref="145" max="32767" attributes="0"/>
|
<EmptySpace pref="120" max="32767" attributes="0"/>
|
||||||
</Group>
|
</Group>
|
||||||
</Group>
|
</Group>
|
||||||
</DimensionLayout>
|
</DimensionLayout>
|
||||||
|
|
@ -107,7 +107,39 @@
|
||||||
<Property name="AccessibleContext.accessibleName" type="java.lang.String" value="Game panel"/>
|
<Property name="AccessibleContext.accessibleName" type="java.lang.String" value="Game panel"/>
|
||||||
</AccessibilityProperties>
|
</AccessibilityProperties>
|
||||||
|
|
||||||
<Layout class="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout"/>
|
<Layout>
|
||||||
|
<DimensionLayout dim="0">
|
||||||
|
<Group type="103" groupAlignment="0" attributes="0">
|
||||||
|
<Group type="102" attributes="0">
|
||||||
|
<EmptySpace max="-2" attributes="0"/>
|
||||||
|
<Group type="103" groupAlignment="0" attributes="0">
|
||||||
|
<Group type="102" attributes="0">
|
||||||
|
<Component id="displayBigCardsInHand" max="32767" attributes="0"/>
|
||||||
|
<EmptySpace max="-2" attributes="0"/>
|
||||||
|
</Group>
|
||||||
|
<Group type="102" attributes="0">
|
||||||
|
<Group type="103" groupAlignment="0" attributes="0">
|
||||||
|
<Component id="showToolTipsInAnyZone" min="-2" max="-2" attributes="0"/>
|
||||||
|
<Component id="showCardName" alignment="0" min="-2" max="-2" attributes="0"/>
|
||||||
|
</Group>
|
||||||
|
<EmptySpace min="0" pref="0" max="32767" attributes="0"/>
|
||||||
|
</Group>
|
||||||
|
</Group>
|
||||||
|
</Group>
|
||||||
|
</Group>
|
||||||
|
</DimensionLayout>
|
||||||
|
<DimensionLayout dim="1">
|
||||||
|
<Group type="103" groupAlignment="0" attributes="0">
|
||||||
|
<Group type="102" alignment="0" attributes="0">
|
||||||
|
<Component id="displayBigCardsInHand" min="-2" max="-2" attributes="0"/>
|
||||||
|
<EmptySpace max="-2" attributes="0"/>
|
||||||
|
<Component id="showToolTipsInAnyZone" min="-2" max="-2" attributes="0"/>
|
||||||
|
<EmptySpace max="-2" attributes="0"/>
|
||||||
|
<Component id="showCardName" min="-2" max="-2" attributes="0"/>
|
||||||
|
</Group>
|
||||||
|
</Group>
|
||||||
|
</DimensionLayout>
|
||||||
|
</Layout>
|
||||||
<SubComponents>
|
<SubComponents>
|
||||||
<Component class="javax.swing.JCheckBox" name="displayBigCardsInHand">
|
<Component class="javax.swing.JCheckBox" name="displayBigCardsInHand">
|
||||||
<Properties>
|
<Properties>
|
||||||
|
|
@ -119,11 +151,6 @@
|
||||||
<Events>
|
<Events>
|
||||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="displayBigCardsInHandActionPerformed"/>
|
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="displayBigCardsInHandActionPerformed"/>
|
||||||
</Events>
|
</Events>
|
||||||
<Constraints>
|
|
||||||
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout" value="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout$BorderConstraintsDescription">
|
|
||||||
<BorderConstraints direction="First"/>
|
|
||||||
</Constraint>
|
|
||||||
</Constraints>
|
|
||||||
</Component>
|
</Component>
|
||||||
<Component class="javax.swing.JCheckBox" name="showToolTipsInAnyZone">
|
<Component class="javax.swing.JCheckBox" name="showToolTipsInAnyZone">
|
||||||
<Properties>
|
<Properties>
|
||||||
|
|
@ -138,11 +165,6 @@
|
||||||
<Events>
|
<Events>
|
||||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="showToolTipsInAnyZoneActionPerformed"/>
|
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="showToolTipsInAnyZoneActionPerformed"/>
|
||||||
</Events>
|
</Events>
|
||||||
<Constraints>
|
|
||||||
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout" value="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout$BorderConstraintsDescription">
|
|
||||||
<BorderConstraints direction="Center"/>
|
|
||||||
</Constraint>
|
|
||||||
</Constraints>
|
|
||||||
</Component>
|
</Component>
|
||||||
<Component class="javax.swing.JCheckBox" name="showCardName">
|
<Component class="javax.swing.JCheckBox" name="showCardName">
|
||||||
<Properties>
|
<Properties>
|
||||||
|
|
@ -157,11 +179,6 @@
|
||||||
<Events>
|
<Events>
|
||||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="showCardNameActionPerformed"/>
|
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="showCardNameActionPerformed"/>
|
||||||
</Events>
|
</Events>
|
||||||
<Constraints>
|
|
||||||
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout" value="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout$BorderConstraintsDescription">
|
|
||||||
<BorderConstraints direction="Last"/>
|
|
||||||
</Constraint>
|
|
||||||
</Constraints>
|
|
||||||
</Component>
|
</Component>
|
||||||
</SubComponents>
|
</SubComponents>
|
||||||
</Container>
|
</Container>
|
||||||
|
|
@ -178,7 +195,42 @@
|
||||||
</Property>
|
</Property>
|
||||||
</Properties>
|
</Properties>
|
||||||
|
|
||||||
<Layout class="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout"/>
|
<Layout>
|
||||||
|
<DimensionLayout dim="0">
|
||||||
|
<Group type="103" groupAlignment="0" attributes="0">
|
||||||
|
<Group type="102" attributes="0">
|
||||||
|
<EmptySpace max="-2" attributes="0"/>
|
||||||
|
<Group type="103" groupAlignment="0" attributes="0">
|
||||||
|
<Group type="102" attributes="0">
|
||||||
|
<Component id="cbAllowRequestToShowHandCards" min="-2" pref="546" max="-2" attributes="0"/>
|
||||||
|
<EmptySpace max="32767" attributes="0"/>
|
||||||
|
</Group>
|
||||||
|
<Group type="102" alignment="0" attributes="0">
|
||||||
|
<Group type="103" groupAlignment="1" max="-2" attributes="0">
|
||||||
|
<Component id="showPlayerNamesPermanently" alignment="0" max="32767" attributes="0"/>
|
||||||
|
<Component id="nonLandPermanentsInOnePile" alignment="0" max="32767" attributes="0"/>
|
||||||
|
<Component id="showAbilityPickerForced" alignment="0" min="-2" max="-2" attributes="0"/>
|
||||||
|
</Group>
|
||||||
|
<EmptySpace min="0" pref="0" max="32767" attributes="0"/>
|
||||||
|
</Group>
|
||||||
|
</Group>
|
||||||
|
</Group>
|
||||||
|
</Group>
|
||||||
|
</DimensionLayout>
|
||||||
|
<DimensionLayout dim="1">
|
||||||
|
<Group type="103" groupAlignment="0" attributes="0">
|
||||||
|
<Group type="102" attributes="0">
|
||||||
|
<Component id="nonLandPermanentsInOnePile" min="-2" max="-2" attributes="0"/>
|
||||||
|
<EmptySpace max="-2" attributes="0"/>
|
||||||
|
<Component id="showPlayerNamesPermanently" min="-2" max="-2" attributes="0"/>
|
||||||
|
<EmptySpace max="-2" attributes="0"/>
|
||||||
|
<Component id="showAbilityPickerForced" min="-2" max="-2" attributes="0"/>
|
||||||
|
<EmptySpace max="-2" attributes="0"/>
|
||||||
|
<Component id="cbAllowRequestToShowHandCards" min="-2" max="-2" attributes="0"/>
|
||||||
|
</Group>
|
||||||
|
</Group>
|
||||||
|
</DimensionLayout>
|
||||||
|
</Layout>
|
||||||
<SubComponents>
|
<SubComponents>
|
||||||
<Component class="javax.swing.JCheckBox" name="nonLandPermanentsInOnePile">
|
<Component class="javax.swing.JCheckBox" name="nonLandPermanentsInOnePile">
|
||||||
<Properties>
|
<Properties>
|
||||||
|
|
@ -191,11 +243,6 @@
|
||||||
<Events>
|
<Events>
|
||||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="nonLandPermanentsInOnePileActionPerformed"/>
|
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="nonLandPermanentsInOnePileActionPerformed"/>
|
||||||
</Events>
|
</Events>
|
||||||
<Constraints>
|
|
||||||
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout" value="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout$BorderConstraintsDescription">
|
|
||||||
<BorderConstraints direction="First"/>
|
|
||||||
</Constraint>
|
|
||||||
</Constraints>
|
|
||||||
</Component>
|
</Component>
|
||||||
<Component class="javax.swing.JCheckBox" name="showPlayerNamesPermanently">
|
<Component class="javax.swing.JCheckBox" name="showPlayerNamesPermanently">
|
||||||
<Properties>
|
<Properties>
|
||||||
|
|
@ -207,11 +254,6 @@
|
||||||
<Events>
|
<Events>
|
||||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="showPlayerNamesPermanentlyActionPerformed"/>
|
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="showPlayerNamesPermanentlyActionPerformed"/>
|
||||||
</Events>
|
</Events>
|
||||||
<Constraints>
|
|
||||||
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout" value="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout$BorderConstraintsDescription">
|
|
||||||
<BorderConstraints direction="Before"/>
|
|
||||||
</Constraint>
|
|
||||||
</Constraints>
|
|
||||||
</Component>
|
</Component>
|
||||||
<Component class="javax.swing.JCheckBox" name="showAbilityPickerForced">
|
<Component class="javax.swing.JCheckBox" name="showAbilityPickerForced">
|
||||||
<Properties>
|
<Properties>
|
||||||
|
|
@ -223,11 +265,17 @@
|
||||||
<Events>
|
<Events>
|
||||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="showAbilityPickerForcedActionPerformed"/>
|
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="showAbilityPickerForcedActionPerformed"/>
|
||||||
</Events>
|
</Events>
|
||||||
<Constraints>
|
</Component>
|
||||||
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout" value="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout$BorderConstraintsDescription">
|
<Component class="javax.swing.JCheckBox" name="cbAllowRequestToShowHandCards">
|
||||||
<BorderConstraints direction="Last"/>
|
<Properties>
|
||||||
</Constraint>
|
<Property name="selected" type="boolean" value="true"/>
|
||||||
</Constraints>
|
<Property name="text" type="java.lang.String" value="Allow requests from players and spectators to show your hand cards"/>
|
||||||
|
<Property name="toolTipText" type="java.lang.String" value="<html>This is the default setting used for your matches. If activated other players or spectators<br>
of your match can send a request so you can allow them to see your hand cards."/>
|
||||||
|
<Property name="horizontalAlignment" type="int" value="2"/>
|
||||||
|
</Properties>
|
||||||
|
<Events>
|
||||||
|
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="cbAllowRequestToShowHandCardsActionPerformed"/>
|
||||||
|
</Events>
|
||||||
</Component>
|
</Component>
|
||||||
</SubComponents>
|
</SubComponents>
|
||||||
</Container>
|
</Container>
|
||||||
|
|
@ -244,7 +292,22 @@
|
||||||
</Property>
|
</Property>
|
||||||
</Properties>
|
</Properties>
|
||||||
|
|
||||||
<Layout class="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout"/>
|
<Layout>
|
||||||
|
<DimensionLayout dim="0">
|
||||||
|
<Group type="103" groupAlignment="0" attributes="0">
|
||||||
|
<Group type="102" alignment="0" attributes="0">
|
||||||
|
<EmptySpace max="-2" attributes="0"/>
|
||||||
|
<Component id="cbGameLogAutoSave" min="-2" pref="528" max="-2" attributes="0"/>
|
||||||
|
<EmptySpace max="32767" attributes="0"/>
|
||||||
|
</Group>
|
||||||
|
</Group>
|
||||||
|
</DimensionLayout>
|
||||||
|
<DimensionLayout dim="1">
|
||||||
|
<Group type="103" groupAlignment="0" attributes="0">
|
||||||
|
<Component id="cbGameLogAutoSave" alignment="1" min="-2" max="-2" attributes="0"/>
|
||||||
|
</Group>
|
||||||
|
</DimensionLayout>
|
||||||
|
</Layout>
|
||||||
<SubComponents>
|
<SubComponents>
|
||||||
<Component class="javax.swing.JCheckBox" name="cbGameLogAutoSave">
|
<Component class="javax.swing.JCheckBox" name="cbGameLogAutoSave">
|
||||||
<Properties>
|
<Properties>
|
||||||
|
|
@ -255,11 +318,6 @@
|
||||||
<Events>
|
<Events>
|
||||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="cbGameLogAutoSaveActionPerformed"/>
|
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="cbGameLogAutoSaveActionPerformed"/>
|
||||||
</Events>
|
</Events>
|
||||||
<Constraints>
|
|
||||||
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout" value="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout$BorderConstraintsDescription">
|
|
||||||
<BorderConstraints direction="Center"/>
|
|
||||||
</Constraint>
|
|
||||||
</Constraints>
|
|
||||||
</Component>
|
</Component>
|
||||||
</SubComponents>
|
</SubComponents>
|
||||||
</Container>
|
</Container>
|
||||||
|
|
@ -1054,7 +1112,7 @@
|
||||||
<Layout>
|
<Layout>
|
||||||
<DimensionLayout dim="0">
|
<DimensionLayout dim="0">
|
||||||
<Group type="103" groupAlignment="0" attributes="0">
|
<Group type="103" groupAlignment="0" attributes="0">
|
||||||
<Component id="jScrollPane1" alignment="0" pref="582" max="32767" attributes="0"/>
|
<Component id="jScrollPane1" alignment="0" pref="598" max="32767" attributes="0"/>
|
||||||
</Group>
|
</Group>
|
||||||
</DimensionLayout>
|
</DimensionLayout>
|
||||||
<DimensionLayout dim="1">
|
<DimensionLayout dim="1">
|
||||||
|
|
|
||||||
|
|
@ -83,6 +83,7 @@ public class PreferencesDialog extends javax.swing.JDialog {
|
||||||
public static final String KEY_PERMANENTS_IN_ONE_PILE = "nonLandPermanentsInOnePile";
|
public static final String KEY_PERMANENTS_IN_ONE_PILE = "nonLandPermanentsInOnePile";
|
||||||
public static final String KEY_SHOW_PLAYER_NAMES_PERMANENTLY = "showPlayerNamesPermanently";
|
public static final String KEY_SHOW_PLAYER_NAMES_PERMANENTLY = "showPlayerNamesPermanently";
|
||||||
public static final String KEY_SHOW_ABILITY_PICKER_FORCED = "showAbilityPicker";
|
public static final String KEY_SHOW_ABILITY_PICKER_FORCED = "showAbilityPicker";
|
||||||
|
public static final String KEY_GAME_ALLOW_REQUEST_SHOW_HAND_CARDS = "gameAllowRequestShowHandCards";
|
||||||
public static final String KEY_GAME_LOG_AUTO_SAVE = "gameLogAutoSave";
|
public static final String KEY_GAME_LOG_AUTO_SAVE = "gameLogAutoSave";
|
||||||
|
|
||||||
public static final String KEY_CARD_IMAGES_USE_DEFAULT = "cardImagesUseDefault";
|
public static final String KEY_CARD_IMAGES_USE_DEFAULT = "cardImagesUseDefault";
|
||||||
|
|
@ -318,6 +319,7 @@ public class PreferencesDialog extends javax.swing.JDialog {
|
||||||
nonLandPermanentsInOnePile = new javax.swing.JCheckBox();
|
nonLandPermanentsInOnePile = new javax.swing.JCheckBox();
|
||||||
showPlayerNamesPermanently = new javax.swing.JCheckBox();
|
showPlayerNamesPermanently = new javax.swing.JCheckBox();
|
||||||
showAbilityPickerForced = new javax.swing.JCheckBox();
|
showAbilityPickerForced = new javax.swing.JCheckBox();
|
||||||
|
cbAllowRequestToShowHandCards = new javax.swing.JCheckBox();
|
||||||
main_gamelog = new javax.swing.JPanel();
|
main_gamelog = new javax.swing.JPanel();
|
||||||
cbGameLogAutoSave = new javax.swing.JCheckBox();
|
cbGameLogAutoSave = new javax.swing.JCheckBox();
|
||||||
tabPhases = new javax.swing.JPanel();
|
tabPhases = new javax.swing.JPanel();
|
||||||
|
|
@ -423,7 +425,6 @@ public class PreferencesDialog extends javax.swing.JDialog {
|
||||||
setTitle("Preferences");
|
setTitle("Preferences");
|
||||||
|
|
||||||
main_card.setBorder(javax.swing.BorderFactory.createTitledBorder(javax.swing.BorderFactory.createEtchedBorder(), "Card"));
|
main_card.setBorder(javax.swing.BorderFactory.createTitledBorder(javax.swing.BorderFactory.createEtchedBorder(), "Card"));
|
||||||
main_card.setLayout(new java.awt.BorderLayout());
|
|
||||||
|
|
||||||
displayBigCardsInHand.setText("Use big images (for high resolution screens)");
|
displayBigCardsInHand.setText("Use big images (for high resolution screens)");
|
||||||
displayBigCardsInHand.setToolTipText("Changes the size of the cards shown in hand. Switch this option off if you have a small screen size.");
|
displayBigCardsInHand.setToolTipText("Changes the size of the cards shown in hand. Switch this option off if you have a small screen size.");
|
||||||
|
|
@ -434,7 +435,6 @@ public class PreferencesDialog extends javax.swing.JDialog {
|
||||||
displayBigCardsInHandActionPerformed(evt);
|
displayBigCardsInHandActionPerformed(evt);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
main_card.add(displayBigCardsInHand, java.awt.BorderLayout.PAGE_START);
|
|
||||||
|
|
||||||
showToolTipsInAnyZone.setSelected(true);
|
showToolTipsInAnyZone.setSelected(true);
|
||||||
showToolTipsInAnyZone.setText("Show card tooltips while hoovering with the mouse pointer over a card");
|
showToolTipsInAnyZone.setText("Show card tooltips while hoovering with the mouse pointer over a card");
|
||||||
|
|
@ -446,7 +446,6 @@ public class PreferencesDialog extends javax.swing.JDialog {
|
||||||
showToolTipsInAnyZoneActionPerformed(evt);
|
showToolTipsInAnyZoneActionPerformed(evt);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
main_card.add(showToolTipsInAnyZone, java.awt.BorderLayout.CENTER);
|
|
||||||
|
|
||||||
showCardName.setSelected(true);
|
showCardName.setSelected(true);
|
||||||
showCardName.setText("Show card name on card panel");
|
showCardName.setText("Show card name on card panel");
|
||||||
|
|
@ -458,10 +457,34 @@ public class PreferencesDialog extends javax.swing.JDialog {
|
||||||
showCardNameActionPerformed(evt);
|
showCardNameActionPerformed(evt);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
main_card.add(showCardName, java.awt.BorderLayout.PAGE_END);
|
|
||||||
|
javax.swing.GroupLayout main_cardLayout = new javax.swing.GroupLayout(main_card);
|
||||||
|
main_card.setLayout(main_cardLayout);
|
||||||
|
main_cardLayout.setHorizontalGroup(
|
||||||
|
main_cardLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||||
|
.addGroup(main_cardLayout.createSequentialGroup()
|
||||||
|
.addContainerGap()
|
||||||
|
.addGroup(main_cardLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||||
|
.addGroup(main_cardLayout.createSequentialGroup()
|
||||||
|
.addComponent(displayBigCardsInHand, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||||
|
.addContainerGap())
|
||||||
|
.addGroup(main_cardLayout.createSequentialGroup()
|
||||||
|
.addGroup(main_cardLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||||
|
.addComponent(showToolTipsInAnyZone)
|
||||||
|
.addComponent(showCardName))
|
||||||
|
.addGap(0, 0, Short.MAX_VALUE))))
|
||||||
|
);
|
||||||
|
main_cardLayout.setVerticalGroup(
|
||||||
|
main_cardLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||||
|
.addGroup(main_cardLayout.createSequentialGroup()
|
||||||
|
.addComponent(displayBigCardsInHand)
|
||||||
|
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||||
|
.addComponent(showToolTipsInAnyZone)
|
||||||
|
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||||
|
.addComponent(showCardName))
|
||||||
|
);
|
||||||
|
|
||||||
main_game.setBorder(javax.swing.BorderFactory.createTitledBorder(javax.swing.BorderFactory.createEtchedBorder(), "Game"));
|
main_game.setBorder(javax.swing.BorderFactory.createTitledBorder(javax.swing.BorderFactory.createEtchedBorder(), "Game"));
|
||||||
main_game.setLayout(new java.awt.BorderLayout());
|
|
||||||
|
|
||||||
nonLandPermanentsInOnePile.setSelected(true);
|
nonLandPermanentsInOnePile.setSelected(true);
|
||||||
nonLandPermanentsInOnePile.setLabel("Put non-land permanents in one pile");
|
nonLandPermanentsInOnePile.setLabel("Put non-land permanents in one pile");
|
||||||
|
|
@ -470,8 +493,6 @@ public class PreferencesDialog extends javax.swing.JDialog {
|
||||||
nonLandPermanentsInOnePileActionPerformed(evt);
|
nonLandPermanentsInOnePileActionPerformed(evt);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
main_game.add(nonLandPermanentsInOnePile, java.awt.BorderLayout.PAGE_START);
|
|
||||||
nonLandPermanentsInOnePile.getAccessibleContext().setAccessibleName("nonLandPermanentsInOnePile");
|
|
||||||
|
|
||||||
showPlayerNamesPermanently.setSelected(true);
|
showPlayerNamesPermanently.setSelected(true);
|
||||||
showPlayerNamesPermanently.setText("Show player names on avatar permanently");
|
showPlayerNamesPermanently.setText("Show player names on avatar permanently");
|
||||||
|
|
@ -482,7 +503,6 @@ public class PreferencesDialog extends javax.swing.JDialog {
|
||||||
showPlayerNamesPermanentlyActionPerformed(evt);
|
showPlayerNamesPermanentlyActionPerformed(evt);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
main_game.add(showPlayerNamesPermanently, java.awt.BorderLayout.LINE_START);
|
|
||||||
|
|
||||||
showAbilityPickerForced.setSelected(true);
|
showAbilityPickerForced.setSelected(true);
|
||||||
showAbilityPickerForced.setText("Show ability picker for abilities or spells without costs");
|
showAbilityPickerForced.setText("Show ability picker for abilities or spells without costs");
|
||||||
|
|
@ -493,10 +513,49 @@ public class PreferencesDialog extends javax.swing.JDialog {
|
||||||
showAbilityPickerForcedActionPerformed(evt);
|
showAbilityPickerForcedActionPerformed(evt);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
main_game.add(showAbilityPickerForced, java.awt.BorderLayout.PAGE_END);
|
|
||||||
|
cbAllowRequestToShowHandCards.setSelected(true);
|
||||||
|
cbAllowRequestToShowHandCards.setText("Allow requests from players and spectators to show your hand cards");
|
||||||
|
cbAllowRequestToShowHandCards.setToolTipText("<html>This is the default setting used for your matches. If activated other players or spectators<br>\nof your match can send a request so you can allow them to see your hand cards.");
|
||||||
|
cbAllowRequestToShowHandCards.setHorizontalAlignment(javax.swing.SwingConstants.LEFT);
|
||||||
|
cbAllowRequestToShowHandCards.addActionListener(new java.awt.event.ActionListener() {
|
||||||
|
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||||
|
cbAllowRequestToShowHandCardsActionPerformed(evt);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
javax.swing.GroupLayout main_gameLayout = new javax.swing.GroupLayout(main_game);
|
||||||
|
main_game.setLayout(main_gameLayout);
|
||||||
|
main_gameLayout.setHorizontalGroup(
|
||||||
|
main_gameLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||||
|
.addGroup(main_gameLayout.createSequentialGroup()
|
||||||
|
.addContainerGap()
|
||||||
|
.addGroup(main_gameLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||||
|
.addGroup(main_gameLayout.createSequentialGroup()
|
||||||
|
.addComponent(cbAllowRequestToShowHandCards, javax.swing.GroupLayout.PREFERRED_SIZE, 546, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||||
|
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
|
||||||
|
.addGroup(main_gameLayout.createSequentialGroup()
|
||||||
|
.addGroup(main_gameLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
|
||||||
|
.addComponent(showPlayerNamesPermanently, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||||
|
.addComponent(nonLandPermanentsInOnePile, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||||
|
.addComponent(showAbilityPickerForced, javax.swing.GroupLayout.Alignment.LEADING))
|
||||||
|
.addGap(0, 0, Short.MAX_VALUE))))
|
||||||
|
);
|
||||||
|
main_gameLayout.setVerticalGroup(
|
||||||
|
main_gameLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||||
|
.addGroup(main_gameLayout.createSequentialGroup()
|
||||||
|
.addComponent(nonLandPermanentsInOnePile)
|
||||||
|
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||||
|
.addComponent(showPlayerNamesPermanently)
|
||||||
|
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||||
|
.addComponent(showAbilityPickerForced)
|
||||||
|
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||||
|
.addComponent(cbAllowRequestToShowHandCards))
|
||||||
|
);
|
||||||
|
|
||||||
|
nonLandPermanentsInOnePile.getAccessibleContext().setAccessibleName("nonLandPermanentsInOnePile");
|
||||||
|
|
||||||
main_gamelog.setBorder(javax.swing.BorderFactory.createTitledBorder(javax.swing.BorderFactory.createEtchedBorder(), "Game log"));
|
main_gamelog.setBorder(javax.swing.BorderFactory.createTitledBorder(javax.swing.BorderFactory.createEtchedBorder(), "Game log"));
|
||||||
main_gamelog.setLayout(new java.awt.BorderLayout());
|
|
||||||
|
|
||||||
cbGameLogAutoSave.setSelected(true);
|
cbGameLogAutoSave.setSelected(true);
|
||||||
cbGameLogAutoSave.setText("Auto save game logs (to \"../Mage.Client/gamelogs/\" directory)");
|
cbGameLogAutoSave.setText("Auto save game logs (to \"../Mage.Client/gamelogs/\" directory)");
|
||||||
|
|
@ -506,7 +565,20 @@ public class PreferencesDialog extends javax.swing.JDialog {
|
||||||
cbGameLogAutoSaveActionPerformed(evt);
|
cbGameLogAutoSaveActionPerformed(evt);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
main_gamelog.add(cbGameLogAutoSave, java.awt.BorderLayout.CENTER);
|
|
||||||
|
javax.swing.GroupLayout main_gamelogLayout = new javax.swing.GroupLayout(main_gamelog);
|
||||||
|
main_gamelog.setLayout(main_gamelogLayout);
|
||||||
|
main_gamelogLayout.setHorizontalGroup(
|
||||||
|
main_gamelogLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||||
|
.addGroup(main_gamelogLayout.createSequentialGroup()
|
||||||
|
.addContainerGap()
|
||||||
|
.addComponent(cbGameLogAutoSave, javax.swing.GroupLayout.PREFERRED_SIZE, 528, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||||
|
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
|
||||||
|
);
|
||||||
|
main_gamelogLayout.setVerticalGroup(
|
||||||
|
main_gamelogLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||||
|
.addComponent(cbGameLogAutoSave, javax.swing.GroupLayout.Alignment.TRAILING)
|
||||||
|
);
|
||||||
|
|
||||||
javax.swing.GroupLayout tabMainLayout = new javax.swing.GroupLayout(tabMain);
|
javax.swing.GroupLayout tabMainLayout = new javax.swing.GroupLayout(tabMain);
|
||||||
tabMain.setLayout(tabMainLayout);
|
tabMain.setLayout(tabMainLayout);
|
||||||
|
|
@ -524,12 +596,12 @@ public class PreferencesDialog extends javax.swing.JDialog {
|
||||||
tabMainLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
tabMainLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||||
.addGroup(tabMainLayout.createSequentialGroup()
|
.addGroup(tabMainLayout.createSequentialGroup()
|
||||||
.addContainerGap()
|
.addContainerGap()
|
||||||
.addComponent(main_card, javax.swing.GroupLayout.PREFERRED_SIZE, 99, javax.swing.GroupLayout.PREFERRED_SIZE)
|
.addComponent(main_card, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||||
.addComponent(main_game, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
.addComponent(main_game, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||||
.addComponent(main_gamelog, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
.addComponent(main_gamelog, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||||
.addContainerGap(145, Short.MAX_VALUE))
|
.addContainerGap(120, Short.MAX_VALUE))
|
||||||
);
|
);
|
||||||
|
|
||||||
main_card.getAccessibleContext().setAccessibleName("Game panel");
|
main_card.getAccessibleContext().setAccessibleName("Game panel");
|
||||||
|
|
@ -1282,7 +1354,7 @@ public class PreferencesDialog extends javax.swing.JDialog {
|
||||||
tabAvatars.setLayout(tabAvatarsLayout);
|
tabAvatars.setLayout(tabAvatarsLayout);
|
||||||
tabAvatarsLayout.setHorizontalGroup(
|
tabAvatarsLayout.setHorizontalGroup(
|
||||||
tabAvatarsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
tabAvatarsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||||
.addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 582, Short.MAX_VALUE)
|
.addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 598, Short.MAX_VALUE)
|
||||||
);
|
);
|
||||||
tabAvatarsLayout.setVerticalGroup(
|
tabAvatarsLayout.setVerticalGroup(
|
||||||
tabAvatarsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
tabAvatarsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||||
|
|
@ -1495,13 +1567,13 @@ public class PreferencesDialog extends javax.swing.JDialog {
|
||||||
getContentPane().setLayout(layout);
|
getContentPane().setLayout(layout);
|
||||||
layout.setHorizontalGroup(
|
layout.setHorizontalGroup(
|
||||||
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||||
.addComponent(tabsPanel)
|
|
||||||
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
|
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
|
||||||
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||||
.addComponent(saveButton)
|
.addComponent(saveButton)
|
||||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||||
.addComponent(exitButton, javax.swing.GroupLayout.PREFERRED_SIZE, 55, javax.swing.GroupLayout.PREFERRED_SIZE)
|
.addComponent(exitButton, javax.swing.GroupLayout.PREFERRED_SIZE, 55, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||||
.addContainerGap())
|
.addContainerGap())
|
||||||
|
.addComponent(tabsPanel)
|
||||||
);
|
);
|
||||||
layout.setVerticalGroup(
|
layout.setVerticalGroup(
|
||||||
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||||
|
|
@ -1527,6 +1599,7 @@ public class PreferencesDialog extends javax.swing.JDialog {
|
||||||
save(prefs, dialog.nonLandPermanentsInOnePile, KEY_PERMANENTS_IN_ONE_PILE, "true", "false", UPDATE_CACHE_POLICY);
|
save(prefs, dialog.nonLandPermanentsInOnePile, KEY_PERMANENTS_IN_ONE_PILE, "true", "false", UPDATE_CACHE_POLICY);
|
||||||
save(prefs, dialog.showPlayerNamesPermanently, KEY_SHOW_PLAYER_NAMES_PERMANENTLY, "true", "false", UPDATE_CACHE_POLICY);
|
save(prefs, dialog.showPlayerNamesPermanently, KEY_SHOW_PLAYER_NAMES_PERMANENTLY, "true", "false", UPDATE_CACHE_POLICY);
|
||||||
save(prefs, dialog.showAbilityPickerForced, KEY_SHOW_ABILITY_PICKER_FORCED, "true", "false", UPDATE_CACHE_POLICY);
|
save(prefs, dialog.showAbilityPickerForced, KEY_SHOW_ABILITY_PICKER_FORCED, "true", "false", UPDATE_CACHE_POLICY);
|
||||||
|
save(prefs, dialog.cbAllowRequestToShowHandCards, KEY_GAME_ALLOW_REQUEST_SHOW_HAND_CARDS, "true", "false", UPDATE_CACHE_POLICY);
|
||||||
save(prefs, dialog.cbGameLogAutoSave, KEY_GAME_LOG_AUTO_SAVE, "true", "false", UPDATE_CACHE_POLICY);
|
save(prefs, dialog.cbGameLogAutoSave, KEY_GAME_LOG_AUTO_SAVE, "true", "false", UPDATE_CACHE_POLICY);
|
||||||
|
|
||||||
// Phases
|
// Phases
|
||||||
|
|
@ -1591,6 +1664,7 @@ public class PreferencesDialog extends javax.swing.JDialog {
|
||||||
try {
|
try {
|
||||||
MageFrame.getSession().updatePreferencesForServer(
|
MageFrame.getSession().updatePreferencesForServer(
|
||||||
getSelectedAvatar(),
|
getSelectedAvatar(),
|
||||||
|
dialog.cbAllowRequestToShowHandCards.isSelected(),
|
||||||
dialog.showAbilityPickerForced.isSelected(),
|
dialog.showAbilityPickerForced.isSelected(),
|
||||||
getUserSkipPrioritySteps());
|
getUserSkipPrioritySteps());
|
||||||
|
|
||||||
|
|
@ -1835,6 +1909,10 @@ public class PreferencesDialog extends javax.swing.JDialog {
|
||||||
// TODO add your handling code here:
|
// TODO add your handling code here:
|
||||||
}//GEN-LAST:event_cbEnableSkipButtonsSoundsActionPerformed
|
}//GEN-LAST:event_cbEnableSkipButtonsSoundsActionPerformed
|
||||||
|
|
||||||
|
private void cbAllowRequestToShowHandCardsActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cbAllowRequestToShowHandCardsActionPerformed
|
||||||
|
// TODO add your handling code here:
|
||||||
|
}//GEN-LAST:event_cbAllowRequestToShowHandCardsActionPerformed
|
||||||
|
|
||||||
private void showProxySettings() {
|
private void showProxySettings() {
|
||||||
if (cbProxyType.getSelectedItem() == Connection.ProxyType.SOCKS) {
|
if (cbProxyType.getSelectedItem() == Connection.ProxyType.SOCKS) {
|
||||||
this.pnlProxy.setVisible(true);
|
this.pnlProxy.setVisible(true);
|
||||||
|
|
@ -1909,6 +1987,7 @@ public class PreferencesDialog extends javax.swing.JDialog {
|
||||||
load(prefs, dialog.nonLandPermanentsInOnePile, KEY_PERMANENTS_IN_ONE_PILE, "true");
|
load(prefs, dialog.nonLandPermanentsInOnePile, KEY_PERMANENTS_IN_ONE_PILE, "true");
|
||||||
load(prefs, dialog.showPlayerNamesPermanently, KEY_SHOW_PLAYER_NAMES_PERMANENTLY, "true");
|
load(prefs, dialog.showPlayerNamesPermanently, KEY_SHOW_PLAYER_NAMES_PERMANENTLY, "true");
|
||||||
load(prefs, dialog.showAbilityPickerForced, KEY_SHOW_ABILITY_PICKER_FORCED, "true");
|
load(prefs, dialog.showAbilityPickerForced, KEY_SHOW_ABILITY_PICKER_FORCED, "true");
|
||||||
|
load(prefs, dialog.cbAllowRequestToShowHandCards, KEY_GAME_ALLOW_REQUEST_SHOW_HAND_CARDS, "true");
|
||||||
load(prefs, dialog.cbGameLogAutoSave, KEY_GAME_LOG_AUTO_SAVE, "true");
|
load(prefs, dialog.cbGameLogAutoSave, KEY_GAME_LOG_AUTO_SAVE, "true");
|
||||||
|
|
||||||
load(prefs, dialog.checkBoxUpkeepYou, UPKEEP_YOU, "on","on");
|
load(prefs, dialog.checkBoxUpkeepYou, UPKEEP_YOU, "on","on");
|
||||||
|
|
@ -2243,6 +2322,7 @@ public class PreferencesDialog extends javax.swing.JDialog {
|
||||||
MageFrame.getSession().updatePreferencesForServer(
|
MageFrame.getSession().updatePreferencesForServer(
|
||||||
id,
|
id,
|
||||||
PreferencesDialog.getCachedValue(PreferencesDialog.KEY_SHOW_TOOLTIPS_ANY_ZONE, "true").equals("true"),
|
PreferencesDialog.getCachedValue(PreferencesDialog.KEY_SHOW_TOOLTIPS_ANY_ZONE, "true").equals("true"),
|
||||||
|
PreferencesDialog.getCachedValue(PreferencesDialog.KEY_GAME_ALLOW_REQUEST_SHOW_HAND_CARDS, "true").equals("true"),
|
||||||
getUserSkipPrioritySteps());
|
getUserSkipPrioritySteps());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -2255,6 +2335,7 @@ public class PreferencesDialog extends javax.swing.JDialog {
|
||||||
private javax.swing.JButton btnBrowseBackgroundImage;
|
private javax.swing.JButton btnBrowseBackgroundImage;
|
||||||
private javax.swing.JButton btnBrowseBattlefieldImage;
|
private javax.swing.JButton btnBrowseBattlefieldImage;
|
||||||
private javax.swing.JButton btnBrowseImageLocation;
|
private javax.swing.JButton btnBrowseImageLocation;
|
||||||
|
private javax.swing.JCheckBox cbAllowRequestToShowHandCards;
|
||||||
private javax.swing.JCheckBox cbCheckForNewImages;
|
private javax.swing.JCheckBox cbCheckForNewImages;
|
||||||
private javax.swing.JCheckBox cbEnableBattlefieldBGM;
|
private javax.swing.JCheckBox cbEnableBattlefieldBGM;
|
||||||
private javax.swing.JCheckBox cbEnableDraftSounds;
|
private javax.swing.JCheckBox cbEnableDraftSounds;
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,91 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8" ?>
|
||||||
|
|
||||||
|
<Form version="1.3" maxVersion="1.7" type="org.netbeans.modules.form.forminfo.JInternalFrameFormInfo">
|
||||||
|
<Properties>
|
||||||
|
<Property name="resizable" type="boolean" value="true"/>
|
||||||
|
<Property name="title" type="java.lang.String" value="UserRequestMessage"/>
|
||||||
|
</Properties>
|
||||||
|
<SyntheticProperties>
|
||||||
|
<SyntheticProperty name="formSizePolicy" type="int" value="1"/>
|
||||||
|
</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" alignment="1" attributes="0">
|
||||||
|
<EmptySpace max="-2" attributes="0"/>
|
||||||
|
<Group type="103" groupAlignment="1" attributes="0">
|
||||||
|
<Component id="lblText" max="32767" attributes="0"/>
|
||||||
|
<Group type="102" alignment="1" attributes="0">
|
||||||
|
<EmptySpace min="0" pref="289" max="32767" attributes="0"/>
|
||||||
|
<Component id="btn3" min="-2" pref="100" max="-2" attributes="0"/>
|
||||||
|
<EmptySpace max="-2" attributes="0"/>
|
||||||
|
<Component id="btn2" min="-2" pref="100" max="-2" attributes="0"/>
|
||||||
|
<EmptySpace max="-2" attributes="0"/>
|
||||||
|
<Component id="btn1" min="-2" pref="100" max="-2" attributes="0"/>
|
||||||
|
</Group>
|
||||||
|
</Group>
|
||||||
|
<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">
|
||||||
|
<EmptySpace max="-2" attributes="0"/>
|
||||||
|
<Component id="lblText" pref="96" max="32767" attributes="0"/>
|
||||||
|
<EmptySpace max="-2" attributes="0"/>
|
||||||
|
<Group type="103" groupAlignment="3" attributes="0">
|
||||||
|
<Component id="btn1" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||||
|
<Component id="btn2" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||||
|
<Component id="btn3" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||||
|
</Group>
|
||||||
|
<EmptySpace min="-2" pref="12" max="-2" attributes="0"/>
|
||||||
|
</Group>
|
||||||
|
</Group>
|
||||||
|
</DimensionLayout>
|
||||||
|
</Layout>
|
||||||
|
<SubComponents>
|
||||||
|
<Component class="javax.swing.JLabel" name="lblText">
|
||||||
|
<Properties>
|
||||||
|
<Property name="horizontalAlignment" type="int" value="0"/>
|
||||||
|
<Property name="text" type="java.lang.String" value="message to the user"/>
|
||||||
|
</Properties>
|
||||||
|
</Component>
|
||||||
|
<Component class="javax.swing.JButton" name="btn3">
|
||||||
|
<Properties>
|
||||||
|
<Property name="text" type="java.lang.String" value="btn3"/>
|
||||||
|
</Properties>
|
||||||
|
<Events>
|
||||||
|
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="btn3ActionPerformed"/>
|
||||||
|
</Events>
|
||||||
|
</Component>
|
||||||
|
<Component class="javax.swing.JButton" name="btn2">
|
||||||
|
<Properties>
|
||||||
|
<Property name="text" type="java.lang.String" value="btn2"/>
|
||||||
|
</Properties>
|
||||||
|
<Events>
|
||||||
|
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="btn2ActionPerformed"/>
|
||||||
|
</Events>
|
||||||
|
</Component>
|
||||||
|
<Component class="javax.swing.JButton" name="btn1">
|
||||||
|
<Properties>
|
||||||
|
<Property name="text" type="java.lang.String" value="btn1"/>
|
||||||
|
</Properties>
|
||||||
|
<Events>
|
||||||
|
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="btn1ActionPerformed"/>
|
||||||
|
</Events>
|
||||||
|
</Component>
|
||||||
|
</SubComponents>
|
||||||
|
</Form>
|
||||||
|
|
@ -0,0 +1,196 @@
|
||||||
|
/*
|
||||||
|
* 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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* ErrorDialog.java
|
||||||
|
*
|
||||||
|
* Created on Dec 23, 2009, 11:01:32 AM
|
||||||
|
*/
|
||||||
|
|
||||||
|
package mage.client.dialog;
|
||||||
|
|
||||||
|
import mage.client.MageFrame;
|
||||||
|
import mage.constants.PlayerAction;
|
||||||
|
import mage.remote.Session;
|
||||||
|
import mage.view.UserRequestMessage;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author BetaSteward_at_googlemail.com
|
||||||
|
*/
|
||||||
|
public class UserRequestDialog extends MageDialog {
|
||||||
|
|
||||||
|
private UserRequestMessage userRequestMessage;
|
||||||
|
|
||||||
|
/** Creates new form AskDialog */
|
||||||
|
public UserRequestDialog() {
|
||||||
|
initComponents();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void showDialog(UserRequestMessage userRequestMessage) {
|
||||||
|
this.userRequestMessage = userRequestMessage;
|
||||||
|
this.setTitle(userRequestMessage.getTitel());
|
||||||
|
String text = "<html><p style=\"text-align:center; margin-left:50px; margin-right:50px\">" + userRequestMessage.getMessage() + "</p></html>";
|
||||||
|
this.lblText.setText(text);
|
||||||
|
if (userRequestMessage.getButton1Text() != null) {
|
||||||
|
this.btn1.setText(userRequestMessage.getButton1Text());
|
||||||
|
} else {
|
||||||
|
this.btn1.setVisible(false);
|
||||||
|
}
|
||||||
|
if (userRequestMessage.getButton2Text() != null) {
|
||||||
|
this.btn2.setText(userRequestMessage.getButton2Text());
|
||||||
|
} else {
|
||||||
|
this.btn2.setVisible(false);
|
||||||
|
}
|
||||||
|
if (userRequestMessage.getButton3Text() != null) {
|
||||||
|
this.btn3.setText(userRequestMessage.getButton3Text());
|
||||||
|
} else {
|
||||||
|
this.btn3.setVisible(false);
|
||||||
|
}
|
||||||
|
this.pack();
|
||||||
|
this.revalidate();
|
||||||
|
this.repaint();
|
||||||
|
this.setModal(true);
|
||||||
|
this.setVisible(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 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() {
|
||||||
|
|
||||||
|
lblText = new javax.swing.JLabel();
|
||||||
|
btn3 = new javax.swing.JButton();
|
||||||
|
btn2 = new javax.swing.JButton();
|
||||||
|
btn1 = new javax.swing.JButton();
|
||||||
|
|
||||||
|
setResizable(true);
|
||||||
|
setTitle("UserRequestMessage");
|
||||||
|
|
||||||
|
lblText.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
|
||||||
|
lblText.setText("message to the user");
|
||||||
|
|
||||||
|
btn3.setText("btn3");
|
||||||
|
btn3.addActionListener(new java.awt.event.ActionListener() {
|
||||||
|
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||||
|
btn3ActionPerformed(evt);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
btn2.setText("btn2");
|
||||||
|
btn2.addActionListener(new java.awt.event.ActionListener() {
|
||||||
|
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||||
|
btn2ActionPerformed(evt);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
btn1.setText("btn1");
|
||||||
|
btn1.addActionListener(new java.awt.event.ActionListener() {
|
||||||
|
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||||
|
btn1ActionPerformed(evt);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
|
||||||
|
getContentPane().setLayout(layout);
|
||||||
|
layout.setHorizontalGroup(
|
||||||
|
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||||
|
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
|
||||||
|
.addContainerGap()
|
||||||
|
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
|
||||||
|
.addComponent(lblText, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||||
|
.addGroup(layout.createSequentialGroup()
|
||||||
|
.addGap(0, 289, Short.MAX_VALUE)
|
||||||
|
.addComponent(btn3, javax.swing.GroupLayout.PREFERRED_SIZE, 100, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||||
|
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||||
|
.addComponent(btn2, javax.swing.GroupLayout.PREFERRED_SIZE, 100, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||||
|
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||||
|
.addComponent(btn1, javax.swing.GroupLayout.PREFERRED_SIZE, 100, javax.swing.GroupLayout.PREFERRED_SIZE)))
|
||||||
|
.addContainerGap())
|
||||||
|
);
|
||||||
|
layout.setVerticalGroup(
|
||||||
|
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||||
|
.addGroup(layout.createSequentialGroup()
|
||||||
|
.addContainerGap()
|
||||||
|
.addComponent(lblText, javax.swing.GroupLayout.DEFAULT_SIZE, 96, Short.MAX_VALUE)
|
||||||
|
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||||
|
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
||||||
|
.addComponent(btn1)
|
||||||
|
.addComponent(btn2)
|
||||||
|
.addComponent(btn3))
|
||||||
|
.addGap(12, 12, 12))
|
||||||
|
);
|
||||||
|
|
||||||
|
pack();
|
||||||
|
}// </editor-fold>//GEN-END:initComponents
|
||||||
|
|
||||||
|
private void btn1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btn1ActionPerformed
|
||||||
|
if (userRequestMessage.getButton1Action() != null) {
|
||||||
|
sendUserReplay(userRequestMessage.getButton1Action());
|
||||||
|
}
|
||||||
|
this.removeDialog();
|
||||||
|
}//GEN-LAST:event_btn1ActionPerformed
|
||||||
|
|
||||||
|
private void btn2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btn2ActionPerformed
|
||||||
|
if (userRequestMessage.getButton2Action() != null) {
|
||||||
|
sendUserReplay(userRequestMessage.getButton2Action());
|
||||||
|
}
|
||||||
|
this.removeDialog();
|
||||||
|
}//GEN-LAST:event_btn2ActionPerformed
|
||||||
|
|
||||||
|
private void btn3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btn3ActionPerformed
|
||||||
|
if (userRequestMessage.getButton3Action() != null) {
|
||||||
|
sendUserReplay(userRequestMessage.getButton3Action());
|
||||||
|
}
|
||||||
|
this.removeDialog();
|
||||||
|
}//GEN-LAST:event_btn3ActionPerformed
|
||||||
|
|
||||||
|
private void sendUserReplay(PlayerAction playerAction) {
|
||||||
|
Session session = MageFrame.getSession();
|
||||||
|
switch(playerAction) {
|
||||||
|
case ADD_PERMISSION_TO_SEE_HAND_CARDS:
|
||||||
|
session.sendPlayerAction(playerAction, userRequestMessage.getGameId(), userRequestMessage.getRelatedUserId());
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
// not supported action
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Variables declaration - do not modify//GEN-BEGIN:variables
|
||||||
|
private javax.swing.JButton btn1;
|
||||||
|
private javax.swing.JButton btn2;
|
||||||
|
private javax.swing.JButton btn3;
|
||||||
|
private javax.swing.JLabel lblText;
|
||||||
|
// End of variables declaration//GEN-END:variables
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -299,7 +299,7 @@ public class FeedbackPanel extends javax.swing.JPanel {
|
||||||
}//GEN-LAST:event_btnSpecialActionPerformed
|
}//GEN-LAST:event_btnSpecialActionPerformed
|
||||||
|
|
||||||
private void btnUndoActionPerformed(java.awt.event.ActionEvent evt) {
|
private void btnUndoActionPerformed(java.awt.event.ActionEvent evt) {
|
||||||
session.sendPlayerAction(PlayerAction.UNDO, gameId);
|
session.sendPlayerAction(PlayerAction.UNDO, gameId, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setHelperPanel(HelperPanel helper) {
|
public void setHelperPanel(HelperPanel helper) {
|
||||||
|
|
|
||||||
|
|
@ -152,7 +152,7 @@ public final class GamePanel extends javax.swing.JPanel {
|
||||||
private boolean initialized = false;
|
private boolean initialized = false;
|
||||||
private int lastUpdatedTurn;
|
private int lastUpdatedTurn;
|
||||||
private boolean menuNameSet = false;
|
private boolean menuNameSet = false;
|
||||||
|
private boolean handCardsOfOpponentAvailable = false;
|
||||||
|
|
||||||
private Map<String, Card> loadedCards = new HashMap<>();
|
private Map<String, Card> loadedCards = new HashMap<>();
|
||||||
|
|
||||||
|
|
@ -388,17 +388,18 @@ public final class GamePanel extends javax.swing.JPanel {
|
||||||
this.feedbackPanel.init(gameId);
|
this.feedbackPanel.init(gameId);
|
||||||
this.feedbackPanel.clear();
|
this.feedbackPanel.clear();
|
||||||
|
|
||||||
|
|
||||||
this.btnConcede.setVisible(false);
|
this.btnConcede.setVisible(false);
|
||||||
this.btnStopWatching.setVisible(true);
|
this.btnStopWatching.setVisible(true);
|
||||||
this.btnSwitchHands.setVisible(false);
|
this.btnSwitchHands.setVisible(false);
|
||||||
|
this.chosenHandKey = "";
|
||||||
this.btnCancelSkip.setVisible(false);
|
this.btnCancelSkip.setVisible(false);
|
||||||
|
|
||||||
this.btnSkipToNextTurn.setVisible(false);
|
this.btnSkipToNextTurn.setVisible(false);
|
||||||
this.btnSkipToEndTurn.setVisible(false);
|
this.btnSkipToEndTurn.setVisible(false);
|
||||||
this.btnSkipToNextMain.setVisible(false);
|
this.btnSkipToNextMain.setVisible(false);
|
||||||
this.btnSkipStack.setVisible(false);
|
this.btnSkipStack.setVisible(false);
|
||||||
this.btnSkipToYourTurn.setVisible(false);
|
this.btnSkipToYourTurn.setVisible(false);
|
||||||
|
|
||||||
|
|
||||||
this.pnlReplay.setVisible(false);
|
this.pnlReplay.setVisible(false);
|
||||||
this.gameChatPanel.clear();
|
this.gameChatPanel.clear();
|
||||||
|
|
@ -530,45 +531,59 @@ public final class GamePanel extends javax.swing.JPanel {
|
||||||
}
|
}
|
||||||
|
|
||||||
public synchronized void updateGame(GameView game, Map<String, Serializable> options) {
|
public synchronized void updateGame(GameView game, Map<String, Serializable> options) {
|
||||||
if (playerId == null || game.getHand() == null) {
|
if (playerId == null && game.getWatchedHands() == null) {
|
||||||
this.handContainer.setVisible(false);
|
this.handContainer.setVisible(false);
|
||||||
} else {
|
} else {
|
||||||
|
this.handContainer.setVisible(true);
|
||||||
handCards.clear();
|
handCards.clear();
|
||||||
handCards.put(YOUR_HAND, game.getHand());
|
if (game.getWatchedHands() != null) {
|
||||||
|
for (Map.Entry<String, SimpleCardsView> hand: game.getWatchedHands().entrySet()) {
|
||||||
// Mark playable
|
|
||||||
if (game.getCanPlayInHand() != null) {
|
|
||||||
for (CardView card : handCards.get(YOUR_HAND).values()) {
|
|
||||||
if (game.getCanPlayInHand().contains(card.getId())) {
|
|
||||||
card.setPlayable(true);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Get opponents hand cards if available
|
|
||||||
if (game.getOpponentHands() != null) {
|
|
||||||
for (Map.Entry<String, SimpleCardsView> hand: game.getOpponentHands().entrySet()) {
|
|
||||||
handCards.put(hand.getKey(), CardsViewUtil.convertSimple(hand.getValue(), loadedCards));
|
handCards.put(hand.getKey(), CardsViewUtil.convertSimple(hand.getValue(), loadedCards));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (playerId != null) {
|
||||||
if (!handCards.containsKey(chosenHandKey)) {
|
handCards.put(YOUR_HAND, game.getHand());
|
||||||
chosenHandKey = YOUR_HAND;
|
// Mark playable
|
||||||
|
if (game.getCanPlayInHand() != null) {
|
||||||
|
for (CardView card : handCards.get(YOUR_HAND).values()) {
|
||||||
|
if (game.getCanPlayInHand().contains(card.getId())) {
|
||||||
|
card.setPlayable(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// Get opponents hand cards if available (only possible for players)
|
||||||
|
if (game.getOpponentHands() != null) {
|
||||||
|
for (Map.Entry<String, SimpleCardsView> hand: game.getOpponentHands().entrySet()) {
|
||||||
|
handCards.put(hand.getKey(), CardsViewUtil.convertSimple(hand.getValue(), loadedCards));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!handCards.containsKey(chosenHandKey)) {
|
||||||
|
chosenHandKey = YOUR_HAND;
|
||||||
|
}
|
||||||
|
} else if (chosenHandKey.isEmpty() && handCards.size() > 0) {
|
||||||
|
chosenHandKey = handCards.keySet().iterator().next();
|
||||||
|
}
|
||||||
|
if (chosenHandKey != null && handCards.containsKey(chosenHandKey)) {
|
||||||
|
handContainer.loadCards(handCards.get(chosenHandKey), bigCard, gameId);
|
||||||
}
|
}
|
||||||
handContainer.loadCards(handCards.get(chosenHandKey), bigCard, gameId);
|
|
||||||
|
|
||||||
hideAll();
|
hideAll();
|
||||||
|
|
||||||
// set visible only if we have any other hand visible than ours
|
|
||||||
boolean previous = btnSwitchHands.isVisible();
|
if (playerId != null) {
|
||||||
boolean visible = handCards.size() > 1;
|
// set visible only if we have any other hand visible than ours
|
||||||
if (previous != visible) {
|
btnSwitchHands.setVisible(handCards.size() > 1);
|
||||||
btnSwitchHands.setVisible(visible);
|
boolean change = (handCardsOfOpponentAvailable != (game.getOpponentHands() != null));
|
||||||
if (visible) {
|
if (change) {
|
||||||
JOptionPane.showMessageDialog(null, "You control other player's turn. \nUse \"Switch Hand\" button to switch between cards in different hands.");
|
handCardsOfOpponentAvailable = !handCardsOfOpponentAvailable;
|
||||||
} else {
|
if (handCardsOfOpponentAvailable) {
|
||||||
JOptionPane.showMessageDialog(null, "You lost control on other player's turn.");
|
JOptionPane.showMessageDialog(null, "You control other player's turn. \nUse \"Switch Hand\" button to switch between cards in different hands.");
|
||||||
|
} else {
|
||||||
|
JOptionPane.showMessageDialog(null, "You lost control on other player's turn.");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
btnSwitchHands.setVisible(!handCards.isEmpty());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1280,7 +1295,7 @@ public final class GamePanel extends javax.swing.JPanel {
|
||||||
btnStopWatching.setBorder(new EmptyBorder(0,0,0,0));
|
btnStopWatching.setBorder(new EmptyBorder(0,0,0,0));
|
||||||
btnStopWatching.setIcon(new ImageIcon(ImageManagerImpl.getInstance().getStopWatchButtonImage()));
|
btnStopWatching.setIcon(new ImageIcon(ImageManagerImpl.getInstance().getStopWatchButtonImage()));
|
||||||
btnStopWatching.setFocusable(false);
|
btnStopWatching.setFocusable(false);
|
||||||
btnSwitchHands.setToolTipText("Stop watching this game.");
|
btnStopWatching.setToolTipText("Stop watching this game.");
|
||||||
btnStopWatching.addMouseListener(new MouseAdapter() {
|
btnStopWatching.addMouseListener(new MouseAdapter() {
|
||||||
@Override
|
@Override
|
||||||
public void mouseClicked(MouseEvent evt) {
|
public void mouseClicked(MouseEvent evt) {
|
||||||
|
|
@ -1620,42 +1635,42 @@ public final class GamePanel extends javax.swing.JPanel {
|
||||||
|
|
||||||
private void btnConcedeActionPerformed(java.awt.event.ActionEvent evt) {
|
private void btnConcedeActionPerformed(java.awt.event.ActionEvent evt) {
|
||||||
if (modalQuestion("Are you sure you want to concede?", "Confirm concede") == JOptionPane.YES_OPTION) {
|
if (modalQuestion("Are you sure you want to concede?", "Confirm concede") == JOptionPane.YES_OPTION) {
|
||||||
session.sendPlayerAction(PlayerAction.CONCEDE, gameId);
|
session.sendPlayerAction(PlayerAction.CONCEDE, gameId, null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void btnEndTurnActionPerformed(java.awt.event.ActionEvent evt) {
|
private void btnEndTurnActionPerformed(java.awt.event.ActionEvent evt) {
|
||||||
session.sendPlayerAction(PlayerAction.PASS_PRIORITY_UNTIL_NEXT_TURN, gameId);
|
session.sendPlayerAction(PlayerAction.PASS_PRIORITY_UNTIL_NEXT_TURN, gameId, null);
|
||||||
AudioManager.playOnSkipButton();
|
AudioManager.playOnSkipButton();
|
||||||
updateSkipButtons(true, false, false, false, false);
|
updateSkipButtons(true, false, false, false, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void btnUntilEndOfTurnActionPerformed(java.awt.event.ActionEvent evt) {
|
private void btnUntilEndOfTurnActionPerformed(java.awt.event.ActionEvent evt) {
|
||||||
session.sendPlayerAction(PlayerAction.PASS_PRIORITY_UNTIL_TURN_END_STEP, gameId);
|
session.sendPlayerAction(PlayerAction.PASS_PRIORITY_UNTIL_TURN_END_STEP, gameId, null);
|
||||||
AudioManager.playOnSkipButton();
|
AudioManager.playOnSkipButton();
|
||||||
updateSkipButtons(false, true, false, false, false);
|
updateSkipButtons(false, true, false, false, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void btnUntilNextMainPhaseActionPerformed(java.awt.event.ActionEvent evt) {
|
private void btnUntilNextMainPhaseActionPerformed(java.awt.event.ActionEvent evt) {
|
||||||
session.sendPlayerAction(PlayerAction.PASS_PRIORITY_UNTIL_NEXT_MAIN_PHASE, gameId);
|
session.sendPlayerAction(PlayerAction.PASS_PRIORITY_UNTIL_NEXT_MAIN_PHASE, gameId, null);
|
||||||
AudioManager.playOnSkipButton();
|
AudioManager.playOnSkipButton();
|
||||||
updateSkipButtons(false, false, true, false, false);
|
updateSkipButtons(false, false, true, false, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void btnPassPriorityUntilNextYourTurnActionPerformed(java.awt.event.ActionEvent evt) {
|
private void btnPassPriorityUntilNextYourTurnActionPerformed(java.awt.event.ActionEvent evt) {
|
||||||
session.sendPlayerAction(PlayerAction.PASS_PRIORITY_UNTIL_MY_NEXT_TURN, gameId);
|
session.sendPlayerAction(PlayerAction.PASS_PRIORITY_UNTIL_MY_NEXT_TURN, gameId, null);
|
||||||
AudioManager.playOnSkipButton();
|
AudioManager.playOnSkipButton();
|
||||||
updateSkipButtons(false, false, false, true, false);
|
updateSkipButtons(false, false, false, true, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void btnPassPriorityUntilStackResolvedActionPerformed(java.awt.event.ActionEvent evt) {
|
private void btnPassPriorityUntilStackResolvedActionPerformed(java.awt.event.ActionEvent evt) {
|
||||||
session.sendPlayerAction(PlayerAction.PASS_PRIORITY_UNTIL_STACK_RESOLVED, gameId);
|
session.sendPlayerAction(PlayerAction.PASS_PRIORITY_UNTIL_STACK_RESOLVED, gameId, null);
|
||||||
AudioManager.playOnSkipButton();
|
AudioManager.playOnSkipButton();
|
||||||
updateSkipButtons(false, false, false, false, true);
|
updateSkipButtons(false, false, false, false, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void restorePriorityActionPerformed(java.awt.event.ActionEvent evt) {
|
private void restorePriorityActionPerformed(java.awt.event.ActionEvent evt) {
|
||||||
session.sendPlayerAction(PlayerAction.PASS_PRIORITY_CANCEL_ALL_ACTIONS, gameId);
|
session.sendPlayerAction(PlayerAction.PASS_PRIORITY_CANCEL_ALL_ACTIONS, gameId, null);
|
||||||
AudioManager.playOnSkipButtonCancel();
|
AudioManager.playOnSkipButtonCancel();
|
||||||
updateSkipButtons(false, false, false, false, false);
|
updateSkipButtons(false, false, false, false, false);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -64,7 +64,8 @@ public class PlayAreaPanel extends javax.swing.JPanel {
|
||||||
private UUID gameId;
|
private UUID gameId;
|
||||||
private boolean smallMode = false;
|
private boolean smallMode = false;
|
||||||
private boolean playingMode = true;
|
private boolean playingMode = true;
|
||||||
private GamePanel gamePanel;
|
private final GamePanel gamePanel;
|
||||||
|
private final boolean playerItself;
|
||||||
|
|
||||||
private JCheckBoxMenuItem manaPoolMenuItem;
|
private JCheckBoxMenuItem manaPoolMenuItem;
|
||||||
|
|
||||||
|
|
@ -72,23 +73,27 @@ public class PlayAreaPanel extends javax.swing.JPanel {
|
||||||
public static final int PANEL_HEIGHT_SMALL = 190;
|
public static final int PANEL_HEIGHT_SMALL = 190;
|
||||||
|
|
||||||
/** Creates new form PlayAreaPanel
|
/** Creates new form PlayAreaPanel
|
||||||
* @param isPlayer */
|
* @param player
|
||||||
public PlayAreaPanel(boolean isPlayer) {
|
* @param bigCard
|
||||||
|
* @param gameId
|
||||||
|
* @param isPlayer true if the client is a player / false if the client is a watcher
|
||||||
|
* @param playerItself true if it's the area of the player itself
|
||||||
|
* @param priorityTime
|
||||||
|
* @param gamePanel */
|
||||||
|
public PlayAreaPanel(PlayerView player, BigCard bigCard, UUID gameId, boolean playerItself, int priorityTime, boolean isPlayer, GamePanel gamePanel) {
|
||||||
|
//this(isPlayer);
|
||||||
|
this.playerItself = playerItself;
|
||||||
initComponents();
|
initComponents();
|
||||||
setOpaque(false);
|
setOpaque(false);
|
||||||
battlefieldPanel.setOpaque(false);
|
battlefieldPanel.setOpaque(false);
|
||||||
|
|
||||||
popupMenu = new JPopupMenu();
|
popupMenu = new JPopupMenu();
|
||||||
if (isPlayer) {
|
if (isPlayer) {
|
||||||
addPopupMenuPlayer();
|
addPopupMenuPlayer(player.getUserData().allowRequestShowHandCards());
|
||||||
} else {
|
} else {
|
||||||
addPopupMenuWatcher();
|
addPopupMenuWatcher();
|
||||||
}
|
}
|
||||||
this.add(popupMenu);
|
this.add(popupMenu);
|
||||||
}
|
|
||||||
|
|
||||||
public PlayAreaPanel(PlayerView player, BigCard bigCard, UUID gameId, boolean me, int priorityTime, boolean isPlayer, GamePanel gamePanel) {
|
|
||||||
this(isPlayer);
|
|
||||||
this.gamePanel = gamePanel;
|
this.gamePanel = gamePanel;
|
||||||
init(player, bigCard, gameId, priorityTime);
|
init(player, bigCard, gameId, priorityTime);
|
||||||
update(player);
|
update(player);
|
||||||
|
|
@ -125,7 +130,7 @@ public class PlayAreaPanel extends javax.swing.JPanel {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void addPopupMenuPlayer() {
|
private void addPopupMenuPlayer(boolean allowRequestToShowHandCards) {
|
||||||
|
|
||||||
JMenuItem menuItem;
|
JMenuItem menuItem;
|
||||||
|
|
||||||
|
|
@ -150,7 +155,7 @@ public class PlayAreaPanel extends javax.swing.JPanel {
|
||||||
menuItem.addActionListener(new ActionListener() {
|
menuItem.addActionListener(new ActionListener() {
|
||||||
@Override
|
@Override
|
||||||
public void actionPerformed(ActionEvent e) {
|
public void actionPerformed(ActionEvent e) {
|
||||||
gamePanel.getSession().sendPlayerAction(PlayerAction.PASS_PRIORITY_CANCEL_ALL_ACTIONS, gameId);
|
gamePanel.getSession().sendPlayerAction(PlayerAction.PASS_PRIORITY_CANCEL_ALL_ACTIONS, gameId, null);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
@ -163,7 +168,7 @@ public class PlayAreaPanel extends javax.swing.JPanel {
|
||||||
menuItem.addActionListener(new ActionListener() {
|
menuItem.addActionListener(new ActionListener() {
|
||||||
@Override
|
@Override
|
||||||
public void actionPerformed(ActionEvent e) {
|
public void actionPerformed(ActionEvent e) {
|
||||||
gamePanel.getSession().sendPlayerAction(PlayerAction.PASS_PRIORITY_UNTIL_NEXT_TURN, gameId);
|
gamePanel.getSession().sendPlayerAction(PlayerAction.PASS_PRIORITY_UNTIL_NEXT_TURN, gameId, null);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
@ -174,7 +179,7 @@ public class PlayAreaPanel extends javax.swing.JPanel {
|
||||||
menuItem.addActionListener(new ActionListener() {
|
menuItem.addActionListener(new ActionListener() {
|
||||||
@Override
|
@Override
|
||||||
public void actionPerformed(ActionEvent e) {
|
public void actionPerformed(ActionEvent e) {
|
||||||
gamePanel.getSession().sendPlayerAction(PlayerAction.PASS_PRIORITY_UNTIL_TURN_END_STEP, gameId);
|
gamePanel.getSession().sendPlayerAction(PlayerAction.PASS_PRIORITY_UNTIL_TURN_END_STEP, gameId, null);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
@ -185,7 +190,7 @@ public class PlayAreaPanel extends javax.swing.JPanel {
|
||||||
menuItem.addActionListener(new ActionListener() {
|
menuItem.addActionListener(new ActionListener() {
|
||||||
@Override
|
@Override
|
||||||
public void actionPerformed(ActionEvent e) {
|
public void actionPerformed(ActionEvent e) {
|
||||||
gamePanel.getSession().sendPlayerAction(PlayerAction.PASS_PRIORITY_UNTIL_NEXT_MAIN_PHASE, gameId);
|
gamePanel.getSession().sendPlayerAction(PlayerAction.PASS_PRIORITY_UNTIL_NEXT_MAIN_PHASE, gameId, null);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
menuItem = new JMenuItem("F9 - Skip everything until own next turn (stop on attack/block)");
|
menuItem = new JMenuItem("F9 - Skip everything until own next turn (stop on attack/block)");
|
||||||
|
|
@ -195,7 +200,7 @@ public class PlayAreaPanel extends javax.swing.JPanel {
|
||||||
menuItem.addActionListener(new ActionListener() {
|
menuItem.addActionListener(new ActionListener() {
|
||||||
@Override
|
@Override
|
||||||
public void actionPerformed(ActionEvent e) {
|
public void actionPerformed(ActionEvent e) {
|
||||||
gamePanel.getSession().sendPlayerAction(PlayerAction.PASS_PRIORITY_UNTIL_MY_NEXT_TURN, gameId);
|
gamePanel.getSession().sendPlayerAction(PlayerAction.PASS_PRIORITY_UNTIL_MY_NEXT_TURN, gameId, null);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
@ -212,7 +217,7 @@ public class PlayAreaPanel extends javax.swing.JPanel {
|
||||||
public void actionPerformed(ActionEvent e) {
|
public void actionPerformed(ActionEvent e) {
|
||||||
boolean manaPoolAutomatic = ((JCheckBoxMenuItem)e.getSource()).getState();
|
boolean manaPoolAutomatic = ((JCheckBoxMenuItem)e.getSource()).getState();
|
||||||
gamePanel.setMenuStates(manaPoolAutomatic);
|
gamePanel.setMenuStates(manaPoolAutomatic);
|
||||||
gamePanel.getSession().sendPlayerAction(manaPoolAutomatic ? PlayerAction.MANA_AUTO_PAYMENT_ON: PlayerAction.MANA_AUTO_PAYMENT_OFF, gameId);
|
gamePanel.getSession().sendPlayerAction(manaPoolAutomatic ? PlayerAction.MANA_AUTO_PAYMENT_ON: PlayerAction.MANA_AUTO_PAYMENT_OFF, gameId, null);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
@ -225,12 +230,53 @@ public class PlayAreaPanel extends javax.swing.JPanel {
|
||||||
menuItem.addActionListener(new ActionListener() {
|
menuItem.addActionListener(new ActionListener() {
|
||||||
@Override
|
@Override
|
||||||
public void actionPerformed(ActionEvent e) {
|
public void actionPerformed(ActionEvent e) {
|
||||||
gamePanel.getSession().sendPlayerAction(PlayerAction.RESET_AUTO_SELECT_REPLACEMENT_EFFECTS, gameId);
|
gamePanel.getSession().sendPlayerAction(PlayerAction.RESET_AUTO_SELECT_REPLACEMENT_EFFECTS, gameId, null);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
popupMenu.addSeparator();
|
popupMenu.addSeparator();
|
||||||
|
|
||||||
|
if (!playerItself) {
|
||||||
|
menuItem = new JMenuItem("Request permission to see hand cards");
|
||||||
|
popupMenu.add(menuItem);
|
||||||
|
|
||||||
|
// Request to see hand cards
|
||||||
|
menuItem.addActionListener(new ActionListener() {
|
||||||
|
@Override
|
||||||
|
public void actionPerformed(ActionEvent e) {
|
||||||
|
gamePanel.getSession().sendPlayerAction(PlayerAction.REQUEST_PERMISSION_TO_SEE_HAND_CARDS, gameId, playerId);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
menuItem = new JCheckBoxMenuItem("Allow requests to show your hand cards", allowRequestToShowHandCards);
|
||||||
|
menuItem.setMnemonic(KeyEvent.VK_A);
|
||||||
|
menuItem.setToolTipText("If activated watchers or other players can request to see your hand cards. If you grant this to a user, it's valid for the complete match.");
|
||||||
|
popupMenu.add(menuItem);
|
||||||
|
|
||||||
|
// Requests allowed
|
||||||
|
menuItem.addActionListener(new ActionListener() {
|
||||||
|
@Override
|
||||||
|
public void actionPerformed(ActionEvent e) {
|
||||||
|
boolean requestsAllowed = ((JCheckBoxMenuItem)e.getSource()).getState();
|
||||||
|
gamePanel.getSession().sendPlayerAction(requestsAllowed ? PlayerAction.PERMISSION_REQUESTS_ALLOWED_ON: PlayerAction.PERMISSION_REQUESTS_ALLOWED_OFF, gameId, null);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
menuItem = new JMenuItem("Revoke all permission(s) to see your hand cards");
|
||||||
|
menuItem.setMnemonic(KeyEvent.VK_P);
|
||||||
|
menuItem.setToolTipText("Revoke already granted permission for all spectators to see your hand cards.");
|
||||||
|
popupMenu.add(menuItem);
|
||||||
|
|
||||||
|
// revoke permissions to see hand cards
|
||||||
|
menuItem.addActionListener(new ActionListener() {
|
||||||
|
@Override
|
||||||
|
public void actionPerformed(ActionEvent e) {
|
||||||
|
gamePanel.getSession().sendPlayerAction(PlayerAction.REVOKE_PERMISSIONS_TO_SEE_HAND_CARDS, gameId, null);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
popupMenu.addSeparator();
|
||||||
|
|
||||||
menuItem = new JMenuItem("Concede game");
|
menuItem = new JMenuItem("Concede game");
|
||||||
popupMenu.add(menuItem);
|
popupMenu.add(menuItem);
|
||||||
|
|
||||||
|
|
@ -239,7 +285,7 @@ public class PlayAreaPanel extends javax.swing.JPanel {
|
||||||
@Override
|
@Override
|
||||||
public void actionPerformed(ActionEvent e) {
|
public void actionPerformed(ActionEvent e) {
|
||||||
if (JOptionPane.showConfirmDialog(PlayAreaPanel.this, "Are you sure you want to concede the game?", "Confirm concede game", JOptionPane.YES_NO_OPTION) == JOptionPane.YES_OPTION) {
|
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.getSession().sendPlayerAction(PlayerAction.CONCEDE, gameId);
|
MageFrame.getSession().sendPlayerAction(PlayerAction.CONCEDE, gameId, null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
@ -297,6 +343,18 @@ public class PlayAreaPanel extends javax.swing.JPanel {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
menuItem = new JMenuItem("Request permission to see hand cards");
|
||||||
|
popupMenu.add(menuItem);
|
||||||
|
|
||||||
|
// Request to see hand cards
|
||||||
|
menuItem.addActionListener(new ActionListener() {
|
||||||
|
@Override
|
||||||
|
public void actionPerformed(ActionEvent e) {
|
||||||
|
gamePanel.getSession().sendPlayerAction(PlayerAction.REQUEST_PERMISSION_TO_SEE_HAND_CARDS, gameId, playerId);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
battlefieldPanel.getMainPanel().addMouseListener(new MouseAdapter() {
|
battlefieldPanel.getMainPanel().addMouseListener(new MouseAdapter() {
|
||||||
@Override
|
@Override
|
||||||
public void mouseReleased(MouseEvent Me) {
|
public void mouseReleased(MouseEvent Me) {
|
||||||
|
|
|
||||||
|
|
@ -32,7 +32,6 @@ import java.util.UUID;
|
||||||
import javax.swing.JOptionPane;
|
import javax.swing.JOptionPane;
|
||||||
import javax.swing.SwingUtilities;
|
import javax.swing.SwingUtilities;
|
||||||
import mage.cards.decks.Deck;
|
import mage.cards.decks.Deck;
|
||||||
import mage.choices.Choice;
|
|
||||||
import mage.client.MageFrame;
|
import mage.client.MageFrame;
|
||||||
import mage.client.chat.ChatPanel;
|
import mage.client.chat.ChatPanel;
|
||||||
import static mage.client.chat.ChatPanel.ChatType.TABLES;
|
import static mage.client.chat.ChatPanel.ChatType.TABLES;
|
||||||
|
|
@ -62,6 +61,7 @@ import mage.view.GameClientMessage;
|
||||||
import mage.view.GameEndView;
|
import mage.view.GameEndView;
|
||||||
import mage.view.GameView;
|
import mage.view.GameView;
|
||||||
import mage.view.TableClientMessage;
|
import mage.view.TableClientMessage;
|
||||||
|
import mage.view.UserRequestMessage;
|
||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -252,7 +252,8 @@ public class CallbackClientImpl implements CallbackClient {
|
||||||
|
|
||||||
if (panel != null) {
|
if (panel != null) {
|
||||||
panel.getChoice(message.getChoice(), callback.getObjectId());
|
panel.getChoice(message.getChoice(), callback.getObjectId());
|
||||||
} break;
|
}
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
case "gamePlayMana":
|
case "gamePlayMana":
|
||||||
{
|
{
|
||||||
|
|
@ -260,7 +261,8 @@ public class CallbackClientImpl implements CallbackClient {
|
||||||
GamePanel panel = MageFrame.getGame(callback.getObjectId());
|
GamePanel panel = MageFrame.getGame(callback.getObjectId());
|
||||||
if (panel != null) {
|
if (panel != null) {
|
||||||
panel.playMana(message.getMessage(), message.getGameView(), callback.getMessageId());
|
panel.playMana(message.getMessage(), message.getGameView(), callback.getMessageId());
|
||||||
} break;
|
}
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
case "gamePlayXMana":
|
case "gamePlayXMana":
|
||||||
{
|
{
|
||||||
|
|
@ -268,7 +270,8 @@ public class CallbackClientImpl implements CallbackClient {
|
||||||
GamePanel panel = MageFrame.getGame(callback.getObjectId());
|
GamePanel panel = MageFrame.getGame(callback.getObjectId());
|
||||||
if (panel != null) {
|
if (panel != null) {
|
||||||
panel.playXMana(message.getMessage(), message.getGameView(), callback.getMessageId());
|
panel.playXMana(message.getMessage(), message.getGameView(), callback.getMessageId());
|
||||||
} break;
|
}
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
case "gameSelectAmount":
|
case "gameSelectAmount":
|
||||||
{
|
{
|
||||||
|
|
@ -346,7 +349,8 @@ public class CallbackClientImpl implements CallbackClient {
|
||||||
DraftPanel panel = MageFrame.getDraft(callback.getObjectId());
|
DraftPanel panel = MageFrame.getDraft(callback.getObjectId());
|
||||||
if (panel != null) {
|
if (panel != null) {
|
||||||
panel.loadBooster(message.getDraftPickView());
|
panel.loadBooster(message.getDraftPickView());
|
||||||
} break;
|
}
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
case "draftUpdate":
|
case "draftUpdate":
|
||||||
{
|
{
|
||||||
|
|
@ -364,17 +368,21 @@ public class CallbackClientImpl implements CallbackClient {
|
||||||
// } else {
|
// } else {
|
||||||
// logger.warn("message out of sequence - ignoring");
|
// logger.warn("message out of sequence - ignoring");
|
||||||
// }
|
// }
|
||||||
// break;
|
break;
|
||||||
case "draftInit":
|
case "draftInit":
|
||||||
{
|
{
|
||||||
DraftClientMessage message = (DraftClientMessage) callback.getData();
|
DraftClientMessage message = (DraftClientMessage) callback.getData();
|
||||||
DraftPanel panel = MageFrame.getDraft(callback.getObjectId());
|
DraftPanel panel = MageFrame.getDraft(callback.getObjectId());
|
||||||
if (panel != null) {
|
if (panel != null) {
|
||||||
panel.loadBooster(message.getDraftPickView());
|
panel.loadBooster(message.getDraftPickView());
|
||||||
} break;
|
}
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
case "tournamentInit":
|
case "tournamentInit":
|
||||||
break;
|
break;
|
||||||
|
case "userRequestDialog":
|
||||||
|
frame.showUserRequestDialog((UserRequestMessage) callback.getData());
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
messageId = callback.getMessageId();
|
messageId = callback.getMessageId();
|
||||||
} catch (Exception ex) {
|
} catch (Exception ex) {
|
||||||
|
|
|
||||||
|
|
@ -120,7 +120,7 @@ public interface MageServer {
|
||||||
void quitMatch(UUID gameId, String sessionId) throws MageException;
|
void quitMatch(UUID gameId, String sessionId) throws MageException;
|
||||||
GameView getGameView(UUID gameId, String sessionId, UUID playerId) throws MageException;
|
GameView getGameView(UUID gameId, String sessionId, UUID playerId) throws MageException;
|
||||||
// priority, undo, concede, mana pool
|
// priority, undo, concede, mana pool
|
||||||
void sendPlayerAction(PlayerAction playerAction, UUID gameId, String sessionId) throws MageException;
|
void sendPlayerAction(PlayerAction playerAction, UUID gameId, String sessionId, Object data) throws MageException;
|
||||||
|
|
||||||
//tournament methods
|
//tournament methods
|
||||||
boolean startTournament(String sessionId, UUID roomId, UUID tableId) throws MageException;
|
boolean startTournament(String sessionId, UUID roomId, UUID tableId) throws MageException;
|
||||||
|
|
|
||||||
|
|
@ -54,6 +54,7 @@ public class Connection {
|
||||||
|
|
||||||
private int avatarId;
|
private int avatarId;
|
||||||
private boolean showAbilityPickerForced;
|
private boolean showAbilityPickerForced;
|
||||||
|
private boolean allowRequestShowHandCards;
|
||||||
private UserSkipPrioritySteps userSkipPrioritySteps;
|
private UserSkipPrioritySteps userSkipPrioritySteps;
|
||||||
|
|
||||||
private static final String serialization = "?serializationtype=jboss";
|
private static final String serialization = "?serializationtype=jboss";
|
||||||
|
|
@ -231,6 +232,13 @@ public class Connection {
|
||||||
this.showAbilityPickerForced = showAbilityPickerForced;
|
this.showAbilityPickerForced = showAbilityPickerForced;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean allowRequestShowHandCards() {
|
||||||
|
return allowRequestShowHandCards;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAllowRequestShowHandCards(boolean allowRequestShowHandCards) {
|
||||||
|
this.allowRequestShowHandCards = allowRequestShowHandCards;
|
||||||
|
}
|
||||||
public UserSkipPrioritySteps getUserSkipPrioritySteps() {
|
public UserSkipPrioritySteps getUserSkipPrioritySteps() {
|
||||||
return userSkipPrioritySteps;
|
return userSkipPrioritySteps;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -273,6 +273,7 @@ public class SessionImpl implements Session {
|
||||||
if (connection.getPassword() == null) {
|
if (connection.getPassword() == null) {
|
||||||
UserDataView userDataView = new UserDataView(connection.getAvatarId(),
|
UserDataView userDataView = new UserDataView(connection.getAvatarId(),
|
||||||
connection.isShowAbilityPickerForced(),
|
connection.isShowAbilityPickerForced(),
|
||||||
|
connection.allowRequestShowHandCards(),
|
||||||
connection.getUserSkipPrioritySteps());
|
connection.getUserSkipPrioritySteps());
|
||||||
// for backward compatibility. don't remove twice call - first one does nothing but for version checking
|
// for backward compatibility. don't remove twice call - first one does nothing but for version checking
|
||||||
registerResult = server.registerClient(connection.getUsername(), sessionId, client.getVersion());
|
registerResult = server.registerClient(connection.getUsername(), sessionId, client.getVersion());
|
||||||
|
|
@ -1151,10 +1152,10 @@ public class SessionImpl implements Session {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean sendPlayerAction(PlayerAction passPriorityAction, UUID gameId) {
|
public boolean sendPlayerAction(PlayerAction passPriorityAction, UUID gameId, Object data) {
|
||||||
try {
|
try {
|
||||||
if (isConnected()) {
|
if (isConnected()) {
|
||||||
server.sendPlayerAction(passPriorityAction, gameId, sessionId);
|
server.sendPlayerAction(passPriorityAction, gameId, sessionId, data);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
} catch (MageException ex) {
|
} catch (MageException ex) {
|
||||||
|
|
@ -1355,10 +1356,10 @@ public class SessionImpl implements Session {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean updatePreferencesForServer(int avatarId, boolean showAbilityPickerForced, UserSkipPrioritySteps userSkipPrioritySteps) {
|
public boolean updatePreferencesForServer(int avatarId, boolean showAbilityPickerForced, boolean allowRequestShowHandCards, UserSkipPrioritySteps userSkipPrioritySteps) {
|
||||||
try {
|
try {
|
||||||
if (isConnected()) {
|
if (isConnected()) {
|
||||||
UserDataView userDataView = new UserDataView(avatarId, showAbilityPickerForced, userSkipPrioritySteps);
|
UserDataView userDataView = new UserDataView(avatarId, showAbilityPickerForced, allowRequestShowHandCards, userSkipPrioritySteps);
|
||||||
server.setUserData(connection.getUsername(), sessionId, userDataView);
|
server.setUserData(connection.getUsername(), sessionId, userDataView);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
|
|
||||||
|
|
@ -36,5 +36,5 @@ public interface ClientData {
|
||||||
|
|
||||||
String getUserName();
|
String getUserName();
|
||||||
|
|
||||||
boolean updatePreferencesForServer(int avatarId, boolean showAbilityPickerForced, UserSkipPrioritySteps userSkipPrioritySteps);
|
boolean updatePreferencesForServer(int avatarId, boolean showAbilityPickerForced, boolean allowRequestShowHandCards, UserSkipPrioritySteps userSkipPrioritySteps);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -80,6 +80,6 @@ public interface GamePlay {
|
||||||
* @param gameId
|
* @param gameId
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
boolean sendPlayerAction(PlayerAction passPriorityAction, UUID gameId);
|
boolean sendPlayerAction(PlayerAction passPriorityAction, UUID gameId, Object Data);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -66,7 +66,7 @@ public class GameEndView implements Serializable {
|
||||||
int winner = 0;
|
int winner = 0;
|
||||||
Player you = null;
|
Player you = null;
|
||||||
for (Player player: state.getPlayers().values()) {
|
for (Player player: state.getPlayers().values()) {
|
||||||
PlayerView playerView = new PlayerView(player, state, game, playerId);
|
PlayerView playerView = new PlayerView(player, state, game, playerId, null);
|
||||||
if (playerView.getPlayerId().equals(playerId)) {
|
if (playerView.getPlayerId().equals(playerId)) {
|
||||||
clientPlayer = playerView;
|
clientPlayer = playerView;
|
||||||
you = player;
|
you = player;
|
||||||
|
|
|
||||||
|
|
@ -65,6 +65,7 @@ public class GameView implements Serializable {
|
||||||
private CardsView hand;
|
private CardsView hand;
|
||||||
private Set<UUID> canPlayInHand;
|
private Set<UUID> canPlayInHand;
|
||||||
private Map<String, SimpleCardsView> opponentHands;
|
private Map<String, SimpleCardsView> opponentHands;
|
||||||
|
private Map<String, SimpleCardsView> watchedHands;
|
||||||
private final CardsView stack = new CardsView();
|
private final CardsView stack = new CardsView();
|
||||||
private final List<ExileView> exiles = new ArrayList<>();
|
private final List<ExileView> exiles = new ArrayList<>();
|
||||||
private final List<RevealedView> revealed = new ArrayList<>();
|
private final List<RevealedView> revealed = new ArrayList<>();
|
||||||
|
|
@ -80,11 +81,11 @@ public class GameView implements Serializable {
|
||||||
private final boolean isPlayer;
|
private final boolean isPlayer;
|
||||||
|
|
||||||
|
|
||||||
public GameView(GameState state, Game game, UUID createdForPlayerId) {
|
public GameView(GameState state, Game game, UUID createdForPlayerId, UUID watcherUserId) {
|
||||||
this.isPlayer = createdForPlayerId != null;
|
this.isPlayer = createdForPlayerId != null;
|
||||||
this.priorityTime = game.getPriorityTime();
|
this.priorityTime = game.getPriorityTime();
|
||||||
for (Player player: state.getPlayers().values()) {
|
for (Player player: state.getPlayers().values()) {
|
||||||
players.add(new PlayerView(player, state, game, createdForPlayerId));
|
players.add(new PlayerView(player, state, game, createdForPlayerId, watcherUserId));
|
||||||
}
|
}
|
||||||
for (StackObject stackObject: state.getStack()) {
|
for (StackObject stackObject: state.getStack()) {
|
||||||
if (stackObject instanceof StackAbility) {
|
if (stackObject instanceof StackAbility) {
|
||||||
|
|
@ -222,6 +223,14 @@ public class GameView implements Serializable {
|
||||||
this.opponentHands = opponentHands;
|
this.opponentHands = opponentHands;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Map<String, SimpleCardsView> getWatchedHands() {
|
||||||
|
return watchedHands;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setWatchedHands(Map<String, SimpleCardsView> watchedHands) {
|
||||||
|
this.watchedHands = watchedHands;
|
||||||
|
}
|
||||||
|
|
||||||
public TurnPhase getPhase() {
|
public TurnPhase getPhase() {
|
||||||
return phase;
|
return phase;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -28,6 +28,12 @@
|
||||||
|
|
||||||
package mage.view;
|
package mage.view;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.LinkedHashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.UUID;
|
||||||
import mage.cards.Card;
|
import mage.cards.Card;
|
||||||
import mage.counters.CounterType;
|
import mage.counters.CounterType;
|
||||||
import mage.game.ExileZone;
|
import mage.game.ExileZone;
|
||||||
|
|
@ -39,9 +45,6 @@ import mage.game.command.Emblem;
|
||||||
import mage.game.permanent.Permanent;
|
import mage.game.permanent.Permanent;
|
||||||
import mage.players.Player;
|
import mage.players.Player;
|
||||||
|
|
||||||
import java.io.Serializable;
|
|
||||||
import java.util.*;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @author BetaSteward_at_googlemail.com
|
* @author BetaSteward_at_googlemail.com
|
||||||
|
|
@ -74,7 +77,7 @@ public class PlayerView implements Serializable {
|
||||||
private final boolean passedUntilStackResolved; // F8
|
private final boolean passedUntilStackResolved; // F8
|
||||||
private final boolean passedAllTurns; // F9
|
private final boolean passedAllTurns; // F9
|
||||||
|
|
||||||
public PlayerView(Player player, GameState state, Game game, UUID createdForPlayerId) {
|
public PlayerView(Player player, GameState state, Game game, UUID createdForPlayerId, UUID watcherUserId) {
|
||||||
this.playerId = player.getId();
|
this.playerId = player.getId();
|
||||||
this.name = player.getName();
|
this.name = player.getName();
|
||||||
this.life = player.getLife();
|
this.life = player.getLife();
|
||||||
|
|
@ -106,7 +109,7 @@ public class PlayerView implements Serializable {
|
||||||
if (player.getUserData() != null) {
|
if (player.getUserData() != null) {
|
||||||
this.userDataView = new UserDataView(player.getUserData());
|
this.userDataView = new UserDataView(player.getUserData());
|
||||||
} else {
|
} else {
|
||||||
this.userDataView = new UserDataView(0, false, null);
|
this.userDataView = new UserDataView(0, false, false, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (CommandObject commandObject : game.getState().getCommand()) {
|
for (CommandObject commandObject : game.getState().getCommand()) {
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,7 @@
|
||||||
package mage.view;
|
package mage.view;
|
||||||
|
|
||||||
import mage.players.net.UserData;
|
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
import mage.players.net.UserData;
|
||||||
import mage.players.net.UserSkipPrioritySteps;
|
import mage.players.net.UserSkipPrioritySteps;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -15,11 +14,13 @@ public class UserDataView implements Serializable {
|
||||||
protected int avatarId;
|
protected int avatarId;
|
||||||
protected int userGroup;
|
protected int userGroup;
|
||||||
protected boolean showAbilityPickerForced;
|
protected boolean showAbilityPickerForced;
|
||||||
|
protected boolean allowRequestShowHandCards;
|
||||||
protected UserSkipPrioritySteps userSkipPrioritySteps;
|
protected UserSkipPrioritySteps userSkipPrioritySteps;
|
||||||
|
|
||||||
public UserDataView(int avatarId, boolean showAbilityPickerForced, UserSkipPrioritySteps userSkipPrioritySteps) {
|
public UserDataView(int avatarId, boolean showAbilityPickerForced, boolean allowRequestShowHandCards, UserSkipPrioritySteps userSkipPrioritySteps) {
|
||||||
this.avatarId = avatarId;
|
this.avatarId = avatarId;
|
||||||
this.showAbilityPickerForced = showAbilityPickerForced;
|
this.showAbilityPickerForced = showAbilityPickerForced;
|
||||||
|
this.allowRequestShowHandCards = allowRequestShowHandCards;
|
||||||
this.userSkipPrioritySteps = userSkipPrioritySteps;
|
this.userSkipPrioritySteps = userSkipPrioritySteps;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -36,6 +37,10 @@ public class UserDataView implements Serializable {
|
||||||
return showAbilityPickerForced;
|
return showAbilityPickerForced;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean allowRequestShowHandCards() {
|
||||||
|
return allowRequestShowHandCards;
|
||||||
|
}
|
||||||
|
|
||||||
public UserSkipPrioritySteps getUserSkipPrioritySteps() {
|
public UserSkipPrioritySteps getUserSkipPrioritySteps() {
|
||||||
return userSkipPrioritySteps;
|
return userSkipPrioritySteps;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
152
Mage.Common/src/mage/view/UserRequestMessage.java
Normal file
152
Mage.Common/src/mage/view/UserRequestMessage.java
Normal file
|
|
@ -0,0 +1,152 @@
|
||||||
|
/*
|
||||||
|
* 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.view;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.util.UUID;
|
||||||
|
import mage.constants.PlayerAction;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author LevelX2
|
||||||
|
*/
|
||||||
|
|
||||||
|
public class UserRequestMessage implements Serializable {
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
private final String titel;
|
||||||
|
private final String message;
|
||||||
|
private final PlayerAction requestAction;
|
||||||
|
private UUID relatedUserId;
|
||||||
|
private String relatedUserName;
|
||||||
|
private UUID matchId;
|
||||||
|
private UUID gameId;
|
||||||
|
|
||||||
|
private String button1Text;
|
||||||
|
private PlayerAction button1Action;
|
||||||
|
|
||||||
|
private String button2Text;
|
||||||
|
private PlayerAction button2Action;
|
||||||
|
|
||||||
|
private String button3Text;
|
||||||
|
private PlayerAction button3Action;
|
||||||
|
|
||||||
|
|
||||||
|
public UserRequestMessage(String titel, String message, PlayerAction requestAction) {
|
||||||
|
this.titel = titel;
|
||||||
|
this.message = message;
|
||||||
|
this.requestAction = requestAction;
|
||||||
|
this.button1Action = null;
|
||||||
|
this.button2Action = null;
|
||||||
|
this.button3Action = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMatchId(UUID matchId) {
|
||||||
|
this.matchId = matchId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setGameId(UUID gameId) {
|
||||||
|
this.gameId = gameId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRelatedUser(UUID userId, String name) {
|
||||||
|
this.relatedUserId = userId;
|
||||||
|
this.relatedUserName = name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setButton1(String text, PlayerAction buttonAction) {
|
||||||
|
this.button1Text = text;
|
||||||
|
this.button1Action = buttonAction;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setButton2(String text, PlayerAction buttonAction) {
|
||||||
|
this.button2Text = text;
|
||||||
|
this.button2Action = buttonAction;
|
||||||
|
}
|
||||||
|
public void setButton3(String text, PlayerAction buttonAction) {
|
||||||
|
this.button3Text = text;
|
||||||
|
this.button3Action = buttonAction;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getTitel() {
|
||||||
|
return titel;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static long getSerialVersionUID() {
|
||||||
|
return serialVersionUID;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getMessage() {
|
||||||
|
return message;
|
||||||
|
}
|
||||||
|
|
||||||
|
public PlayerAction getRequestAction() {
|
||||||
|
return requestAction;
|
||||||
|
}
|
||||||
|
|
||||||
|
public UUID getRelatedUserId() {
|
||||||
|
return relatedUserId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getRelatedUserName() {
|
||||||
|
return relatedUserName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public UUID getMatchId() {
|
||||||
|
return matchId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public UUID getGameId() {
|
||||||
|
return gameId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getButton1Text() {
|
||||||
|
return button1Text;
|
||||||
|
}
|
||||||
|
|
||||||
|
public PlayerAction getButton1Action() {
|
||||||
|
return button1Action;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getButton2Text() {
|
||||||
|
return button2Text;
|
||||||
|
}
|
||||||
|
|
||||||
|
public PlayerAction getButton2Action() {
|
||||||
|
return button2Action;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getButton3Text() {
|
||||||
|
return button3Text;
|
||||||
|
}
|
||||||
|
|
||||||
|
public PlayerAction getButton3Action() {
|
||||||
|
return button3Action;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -96,7 +96,7 @@ public class ComputerPlayer extends PlayerImpl implements Player {
|
||||||
public ComputerPlayer(String name, RangeOfInfluence range) {
|
public ComputerPlayer(String name, RangeOfInfluence range) {
|
||||||
super(name, range);
|
super(name, range);
|
||||||
human = false;
|
human = false;
|
||||||
userData = new UserData(UserGroup.COMPUTER, 64, false, null);
|
userData = new UserData(UserGroup.COMPUTER, 64, false, true, null);
|
||||||
pickedCards = new ArrayList<>();
|
pickedCards = new ArrayList<>();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -749,8 +749,8 @@ public class MageServerImpl implements MageServer {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void sendPlayerAction(final PlayerAction playerAction, final UUID gameId, final String sessionId) throws MageException {
|
public void sendPlayerAction(final PlayerAction playerAction, final UUID gameId, final String sessionId, final Object data) throws MageException {
|
||||||
execute("setdPlayerAction", sessionId, new Action() {
|
execute("sendPlayerAction", sessionId, new Action() {
|
||||||
@Override
|
@Override
|
||||||
public void execute() {
|
public void execute() {
|
||||||
Session session = SessionManager.getInstance().getSession(sessionId);
|
Session session = SessionManager.getInstance().getSession(sessionId);
|
||||||
|
|
@ -758,7 +758,7 @@ public class MageServerImpl implements MageServer {
|
||||||
logger.error("Session not found sessionId: "+ sessionId + " gameId:" + gameId);
|
logger.error("Session not found sessionId: "+ sessionId + " gameId:" + gameId);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
GameManager.getInstance().sendPlayerAction(playerAction, gameId, session.getUserId());
|
GameManager.getInstance().sendPlayerAction(playerAction, gameId, session.getUserId(), data);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -139,7 +139,7 @@ public class Session {
|
||||||
if (user == null) {
|
if (user == null) {
|
||||||
user = UserManager.getInstance().findUser("Admin");
|
user = UserManager.getInstance().findUser("Admin");
|
||||||
}
|
}
|
||||||
user.setUserData(new UserData(UserGroup.ADMIN, 0, false, null));
|
user.setUserData(new UserData(UserGroup.ADMIN, 0, false, false, null));
|
||||||
if (!UserManager.getInstance().connectToSession(sessionId, user.getId())) {
|
if (!UserManager.getInstance().connectToSession(sessionId, user.getId())) {
|
||||||
logger.info("Error connecting Admin!");
|
logger.info("Error connecting Admin!");
|
||||||
}
|
}
|
||||||
|
|
@ -151,7 +151,7 @@ public class Session {
|
||||||
if (user != null) {
|
if (user != null) {
|
||||||
UserData userData = user.getUserData();
|
UserData userData = user.getUserData();
|
||||||
if (userData == null) {
|
if (userData == null) {
|
||||||
userData = new UserData(UserGroup.PLAYER, userDataView.getAvatarId(), userDataView.isShowAbilityPickerForced(), userDataView.getUserSkipPrioritySteps());
|
userData = new UserData(UserGroup.PLAYER, userDataView.getAvatarId(), userDataView.isShowAbilityPickerForced(), userDataView.allowRequestShowHandCards(), userDataView.getUserSkipPrioritySteps());
|
||||||
user.setUserData(userData);
|
user.setUserData(userData);
|
||||||
} else {
|
} else {
|
||||||
if (userDataView.getAvatarId() == 51) { // Update special avatar if first avatar is selected
|
if (userDataView.getAvatarId() == 51) { // Update special avatar if first avatar is selected
|
||||||
|
|
@ -159,6 +159,7 @@ public class Session {
|
||||||
}
|
}
|
||||||
userData.setAvatarId(userDataView.getAvatarId());
|
userData.setAvatarId(userDataView.getAvatarId());
|
||||||
userData.setShowAbilityPickerForced(userDataView.isShowAbilityPickerForced());
|
userData.setShowAbilityPickerForced(userDataView.isShowAbilityPickerForced());
|
||||||
|
userData.setAllowRequestShowHandCards(userDataView.allowRequestShowHandCards());
|
||||||
userData.setUserSkipPrioritySteps(userDataView.getUserSkipPrioritySteps());
|
userData.setUserSkipPrioritySteps(userDataView.getUserSkipPrioritySteps());
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
|
|
||||||
|
|
@ -585,7 +585,9 @@ public class TableController {
|
||||||
user.removeConstructing(match.getPlayer(entry.getValue()).getPlayer().getId());
|
user.removeConstructing(match.getPlayer(entry.getValue()).getPlayer().getId());
|
||||||
GameManager.getInstance().joinGame(match.getGame().getId(), user.getId());
|
GameManager.getInstance().joinGame(match.getGame().getId(), user.getId());
|
||||||
logger.debug("Joined currently not connected user " + user.getName() + " matchId: " + match.getId());
|
logger.debug("Joined currently not connected user " + user.getName() + " matchId: " + match.getId());
|
||||||
}
|
}
|
||||||
|
Player player = match.getPlayer(entry.getValue()).getPlayer();
|
||||||
|
player.setRequestToShowHandCardsAllowed(user.getUserData().allowRequestShowHandCards());
|
||||||
user.gameStarted(match.getGame().getId(), entry.getValue());
|
user.gameStarted(match.getGame().getId(), entry.getValue());
|
||||||
|
|
||||||
if (creator == null) {
|
if (creator == null) {
|
||||||
|
|
|
||||||
|
|
@ -28,6 +28,24 @@
|
||||||
|
|
||||||
package mage.server.game;
|
package mage.server.game;
|
||||||
|
|
||||||
|
import java.io.BufferedOutputStream;
|
||||||
|
import java.io.FileOutputStream;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.io.ObjectOutput;
|
||||||
|
import java.io.ObjectOutputStream;
|
||||||
|
import java.io.OutputStream;
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.util.Collection;
|
||||||
|
import java.util.HashSet;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Map.Entry;
|
||||||
|
import java.util.Set;
|
||||||
|
import java.util.UUID;
|
||||||
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
|
import java.util.concurrent.ExecutorService;
|
||||||
|
import java.util.concurrent.Future;
|
||||||
|
import java.util.zip.GZIPOutputStream;
|
||||||
import mage.MageException;
|
import mage.MageException;
|
||||||
import mage.abilities.Ability;
|
import mage.abilities.Ability;
|
||||||
import mage.cards.Card;
|
import mage.cards.Card;
|
||||||
|
|
@ -36,7 +54,9 @@ import mage.cards.decks.Deck;
|
||||||
import mage.cards.decks.DeckCardLists;
|
import mage.cards.decks.DeckCardLists;
|
||||||
import mage.cards.repository.CardInfo;
|
import mage.cards.repository.CardInfo;
|
||||||
import mage.cards.repository.CardRepository;
|
import mage.cards.repository.CardRepository;
|
||||||
|
import mage.choices.Choice;
|
||||||
import mage.constants.ManaType;
|
import mage.constants.ManaType;
|
||||||
|
import mage.constants.PlayerAction;
|
||||||
import mage.constants.Zone;
|
import mage.constants.Zone;
|
||||||
import mage.game.Game;
|
import mage.game.Game;
|
||||||
import mage.game.GameException;
|
import mage.game.GameException;
|
||||||
|
|
@ -47,27 +67,25 @@ import mage.game.events.TableEvent;
|
||||||
import mage.game.permanent.Permanent;
|
import mage.game.permanent.Permanent;
|
||||||
import mage.interfaces.Action;
|
import mage.interfaces.Action;
|
||||||
import mage.players.Player;
|
import mage.players.Player;
|
||||||
import mage.server.*;
|
import mage.server.ChatManager;
|
||||||
|
import mage.server.Main;
|
||||||
|
import mage.server.TableManager;
|
||||||
|
import mage.server.User;
|
||||||
|
import mage.server.UserManager;
|
||||||
import mage.server.util.ConfigSettings;
|
import mage.server.util.ConfigSettings;
|
||||||
import mage.server.util.Splitter;
|
import mage.server.util.Splitter;
|
||||||
import mage.server.util.SystemUtil;
|
import mage.server.util.SystemUtil;
|
||||||
import mage.server.util.ThreadExecutor;
|
import mage.server.util.ThreadExecutor;
|
||||||
import mage.utils.timer.PriorityTimer;
|
import mage.utils.timer.PriorityTimer;
|
||||||
import mage.view.*;
|
import mage.view.AbilityPickerView;
|
||||||
|
import mage.view.CardsView;
|
||||||
|
import mage.view.ChatMessage;
|
||||||
import mage.view.ChatMessage.MessageColor;
|
import mage.view.ChatMessage.MessageColor;
|
||||||
import mage.view.ChatMessage.MessageType;
|
import mage.view.ChatMessage.MessageType;
|
||||||
|
import mage.view.GameView;
|
||||||
|
import mage.view.PermanentView;
|
||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
|
|
||||||
import java.io.*;
|
|
||||||
import java.util.*;
|
|
||||||
import java.util.Map.Entry;
|
|
||||||
import java.util.concurrent.ConcurrentHashMap;
|
|
||||||
import java.util.concurrent.ExecutorService;
|
|
||||||
import java.util.concurrent.Future;
|
|
||||||
import java.util.zip.GZIPOutputStream;
|
|
||||||
import mage.choices.Choice;
|
|
||||||
import mage.constants.PlayerAction;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @author BetaSteward_at_googlemail.com
|
* @author BetaSteward_at_googlemail.com
|
||||||
|
|
@ -389,7 +407,7 @@ public class GameController implements GameCallback {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void sendPlayerAction(PlayerAction playerAction, UUID userId) {
|
public void sendPlayerAction(PlayerAction playerAction, UUID userId, Object data) {
|
||||||
switch(playerAction) {
|
switch(playerAction) {
|
||||||
case UNDO:
|
case UNDO:
|
||||||
game.undo(getPlayerId(userId));
|
game.undo(getPlayerId(userId));
|
||||||
|
|
@ -403,11 +421,71 @@ public class GameController implements GameCallback {
|
||||||
case MANA_AUTO_PAYMENT_ON:
|
case MANA_AUTO_PAYMENT_ON:
|
||||||
game.setManaPoolMode(getPlayerId(userId), true);
|
game.setManaPoolMode(getPlayerId(userId), true);
|
||||||
break;
|
break;
|
||||||
|
case ADD_PERMISSION_TO_SEE_HAND_CARDS:
|
||||||
|
if (data instanceof UUID) {
|
||||||
|
UUID playerId = getPlayerId(userId);
|
||||||
|
if (playerId != null) {
|
||||||
|
Player player = game.getPlayer(playerId);
|
||||||
|
if (player != null) {
|
||||||
|
player.addPermissionToShowHandCards((UUID) data);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case REVOKE_PERMISSIONS_TO_SEE_HAND_CARDS:
|
||||||
|
UUID playerId = getPlayerId(userId);
|
||||||
|
if (playerId != null) {
|
||||||
|
Player player = game.getPlayer(playerId);
|
||||||
|
if (player != null) {
|
||||||
|
player.revokePermissionToSeeHandCards();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case REQUEST_PERMISSION_TO_SEE_HAND_CARDS:
|
||||||
|
if (data instanceof UUID) {
|
||||||
|
requestPermissionToSeeHandCards(userId, (UUID) data);
|
||||||
|
}
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
game.sendPlayerAction(playerAction, getPlayerId(userId));
|
game.sendPlayerAction(playerAction, getPlayerId(userId));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void requestPermissionToSeeHandCards(UUID userIdRequester, UUID userIdGranter) {
|
||||||
|
Player grantingPlayer = game.getPlayer(userIdGranter);
|
||||||
|
if (grantingPlayer != null) {
|
||||||
|
if (!grantingPlayer.getUsersAllowedToSeeHandCards().contains(userIdRequester)) {
|
||||||
|
if (grantingPlayer.isHuman()) {
|
||||||
|
GameSession gameSession = gameSessions.get(userIdGranter);
|
||||||
|
if (gameSession != null) {
|
||||||
|
UUID requestingPlayer = getPlayerId(userIdRequester);
|
||||||
|
if (requestingPlayer == null || !requestingPlayer.equals(grantingPlayer.getId())) { // don't allow request for your own cards
|
||||||
|
if (grantingPlayer.isRequestToShowHandCardsAllowed()) {
|
||||||
|
gameSession.requestPermissionToSeeHandCards(userIdRequester);
|
||||||
|
} else {
|
||||||
|
// player does not allow the request
|
||||||
|
User requester = UserManager.getInstance().getUser(userIdRequester);
|
||||||
|
if (requester != null) {
|
||||||
|
requester.showUserMessage("Request to show hand cards", "Player " + grantingPlayer.getName() + " does not allow to request to show hand cards!");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// Non Human players always allow to see the hand cards
|
||||||
|
grantingPlayer.addPermissionToShowHandCards(userIdRequester);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// user can already see the cards
|
||||||
|
User requester = UserManager.getInstance().getUser(userIdRequester);
|
||||||
|
if (requester != null) {
|
||||||
|
requester.showUserMessage("Request to show hand cards", "You can see already the hand cards of player " + grantingPlayer.getName() + "!");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
public void cheat(UUID userId, UUID playerId, DeckCardLists deckList) {
|
public void cheat(UUID userId, UUID playerId, DeckCardLists deckList) {
|
||||||
Deck deck;
|
Deck deck;
|
||||||
|
|
|
||||||
|
|
@ -114,10 +114,10 @@ public class GameManager {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void sendPlayerAction(PlayerAction playerAction, UUID gameId, UUID userId) {
|
public void sendPlayerAction(PlayerAction playerAction, UUID gameId, UUID userId, Object data) {
|
||||||
GameController gameController = gameControllers.get(gameId);
|
GameController gameController = gameControllers.get(gameId);
|
||||||
if (gameController != null) {
|
if (gameController != null) {
|
||||||
gameController.sendPlayerAction(playerAction, userId);
|
gameController.sendPlayerAction(playerAction, userId, data);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -28,9 +28,24 @@
|
||||||
|
|
||||||
package mage.server.game;
|
package mage.server.game;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Map.Entry;
|
||||||
|
import java.util.Set;
|
||||||
|
import java.util.UUID;
|
||||||
|
import java.util.concurrent.ExecutorService;
|
||||||
|
import java.util.concurrent.ScheduledExecutorService;
|
||||||
|
import java.util.concurrent.ScheduledFuture;
|
||||||
|
import java.util.concurrent.TimeUnit;
|
||||||
import mage.cards.Cards;
|
import mage.cards.Cards;
|
||||||
|
import mage.choices.Choice;
|
||||||
import mage.constants.ManaType;
|
import mage.constants.ManaType;
|
||||||
|
import mage.constants.PlayerAction;
|
||||||
import mage.game.Game;
|
import mage.game.Game;
|
||||||
|
import mage.game.Table;
|
||||||
import mage.interfaces.callback.ClientCallback;
|
import mage.interfaces.callback.ClientCallback;
|
||||||
import mage.players.Player;
|
import mage.players.Player;
|
||||||
import mage.players.net.UserData;
|
import mage.players.net.UserData;
|
||||||
|
|
@ -38,19 +53,15 @@ import mage.server.User;
|
||||||
import mage.server.UserManager;
|
import mage.server.UserManager;
|
||||||
import mage.server.util.ConfigSettings;
|
import mage.server.util.ConfigSettings;
|
||||||
import mage.server.util.ThreadExecutor;
|
import mage.server.util.ThreadExecutor;
|
||||||
import mage.view.*;
|
import mage.view.AbilityPickerView;
|
||||||
|
import mage.view.CardsView;
|
||||||
|
import mage.view.GameClientMessage;
|
||||||
|
import mage.view.GameView;
|
||||||
|
import mage.view.LookedAtView;
|
||||||
|
import mage.view.SimpleCardsView;
|
||||||
|
import mage.view.UserRequestMessage;
|
||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
|
|
||||||
import java.io.Serializable;
|
|
||||||
import java.util.*;
|
|
||||||
import java.util.Map.Entry;
|
|
||||||
import java.util.concurrent.ExecutorService;
|
|
||||||
import java.util.concurrent.ScheduledExecutorService;
|
|
||||||
import java.util.concurrent.ScheduledFuture;
|
|
||||||
import java.util.concurrent.TimeUnit;
|
|
||||||
import mage.choices.Choice;
|
|
||||||
import mage.game.Table;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @author BetaSteward_at_googlemail.com
|
* @author BetaSteward_at_googlemail.com
|
||||||
|
|
@ -173,6 +184,25 @@ public class GameSession extends GameWatcher {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void requestPermissionToSeeHandCards(UUID watcherId) {
|
||||||
|
if (!killed) {
|
||||||
|
User watcher = UserManager.getInstance().getUser(watcherId);
|
||||||
|
User user = UserManager.getInstance().getUser(userId);
|
||||||
|
if (user != null && watcher != null) {
|
||||||
|
UserRequestMessage userRequestMessage = new UserRequestMessage(
|
||||||
|
"User request",
|
||||||
|
"Allow user <b>" + watcher.getName() + "</b> for this match to see your hand cards?<br>" +
|
||||||
|
"(You can revoke this every time using related popup menu item of your battlefield.)"
|
||||||
|
, PlayerAction.REQUEST_PERMISSION_TO_SEE_HAND_CARDS);
|
||||||
|
userRequestMessage.setRelatedUser(watcherId, watcher.getName());
|
||||||
|
userRequestMessage.setGameId(game.getId());
|
||||||
|
userRequestMessage.setButton1("Accept", PlayerAction.ADD_PERMISSION_TO_SEE_HAND_CARDS);
|
||||||
|
userRequestMessage.setButton2("Reject", null);
|
||||||
|
user.fireCallback(new ClientCallback("userRequestDialog", game.getId(), userRequestMessage));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Reset the timeout counter after priority in game changed
|
* Reset the timeout counter after priority in game changed
|
||||||
*
|
*
|
||||||
|
|
@ -237,12 +267,12 @@ public class GameSession extends GameWatcher {
|
||||||
public GameView getGameView() {
|
public GameView getGameView() {
|
||||||
Player player = game.getPlayer(playerId);
|
Player player = game.getPlayer(playerId);
|
||||||
player.setUserData(this.userData);
|
player.setUserData(this.userData);
|
||||||
GameView gameView = new GameView(game.getState(), game, playerId);
|
GameView gameView = new GameView(game.getState(), game, playerId, null);
|
||||||
gameView.setHand(new CardsView(player.getHand().getCards(game)));
|
gameView.setHand(new CardsView(player.getHand().getCards(game)));
|
||||||
gameView.setCanPlayInHand(player.getPlayableInHand(game));
|
gameView.setCanPlayInHand(player.getPlayableInHand(game));
|
||||||
|
|
||||||
processControlledPlayers(player, gameView);
|
processControlledPlayers(player, gameView);
|
||||||
|
processWatchedHands(userId, gameView);
|
||||||
//TODO: should player who controls another player's turn be able to look at all these cards?
|
//TODO: should player who controls another player's turn be able to look at all these cards?
|
||||||
|
|
||||||
List<LookedAtView> list = new ArrayList<>();
|
List<LookedAtView> list = new ArrayList<>();
|
||||||
|
|
|
||||||
|
|
@ -28,15 +28,19 @@
|
||||||
|
|
||||||
package mage.server.game;
|
package mage.server.game;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
import mage.game.Game;
|
import mage.game.Game;
|
||||||
import mage.game.Table;
|
import mage.game.Table;
|
||||||
import mage.interfaces.callback.ClientCallback;
|
import mage.interfaces.callback.ClientCallback;
|
||||||
|
import mage.players.Player;
|
||||||
import mage.server.User;
|
import mage.server.User;
|
||||||
import mage.server.UserManager;
|
import mage.server.UserManager;
|
||||||
import mage.view.GameClientMessage;
|
import mage.view.GameClientMessage;
|
||||||
import mage.view.GameEndView;
|
import mage.view.GameEndView;
|
||||||
import mage.view.GameView;
|
import mage.view.GameView;
|
||||||
|
import mage.view.SimpleCardsView;
|
||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -71,10 +75,10 @@ public class GameWatcher {
|
||||||
|
|
||||||
public void update() {
|
public void update() {
|
||||||
if (!killed) {
|
if (!killed) {
|
||||||
User user = UserManager.getInstance().getUser(userId);
|
User user = UserManager.getInstance().getUser(userId);
|
||||||
if (user != null) {
|
if (user != null) {
|
||||||
user.fireCallback(new ClientCallback("gameUpdate", game.getId(), getGameView()));
|
user.fireCallback(new ClientCallback("gameUpdate", game.getId(), getGameView()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -120,9 +124,21 @@ public class GameWatcher {
|
||||||
}
|
}
|
||||||
|
|
||||||
public GameView getGameView() {
|
public GameView getGameView() {
|
||||||
return new GameView(game.getState(), game, null);
|
GameView gameView = new GameView(game.getState(), game, null, userId);
|
||||||
|
processWatchedHands(userId, gameView);
|
||||||
|
return gameView;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void processWatchedHands(UUID userId, GameView gameView) {
|
||||||
|
Map<String, SimpleCardsView> handCards = new HashMap<>();
|
||||||
|
for (Player player: game.getPlayers().values()) {
|
||||||
|
if (player.hasUserPermissionToSeeHand(userId)) {
|
||||||
|
handCards.put(player.getName(), new SimpleCardsView(player.getHand().getCards(game)));
|
||||||
|
gameView.setWatchedHands(handCards);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public GameEndView getGameEndView(UUID playerId, Table table) {
|
public GameEndView getGameEndView(UUID playerId, Table table) {
|
||||||
return new GameEndView(game.getState(), game, playerId, table);
|
return new GameEndView(game.getState(), game, playerId, table);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -54,7 +54,7 @@ public class ReplaySession implements GameCallback {
|
||||||
replay.start();
|
replay.start();
|
||||||
User user = UserManager.getInstance().getUser(userId);
|
User user = UserManager.getInstance().getUser(userId);
|
||||||
if (user != null) {
|
if (user != null) {
|
||||||
user.fireCallback(new ClientCallback("replayInit", replay.getGame().getId(), new GameView(replay.next(), replay.getGame(), null)));
|
user.fireCallback(new ClientCallback("replayInit", replay.getGame().getId(), new GameView(replay.next(), replay.getGame(), null, null)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -93,7 +93,7 @@ public class ReplaySession implements GameCallback {
|
||||||
else {
|
else {
|
||||||
User user = UserManager.getInstance().getUser(userId);
|
User user = UserManager.getInstance().getUser(userId);
|
||||||
if (user != null) {
|
if (user != null) {
|
||||||
user.fireCallback(new ClientCallback("replayUpdate", replay.getGame().getId(), new GameView(state, game, null)));
|
user.fireCallback(new ClientCallback("replayUpdate", replay.getGame().getId(), new GameView(state, game, null, null)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -43,5 +43,10 @@ public enum PlayerAction {
|
||||||
CONCEDE,
|
CONCEDE,
|
||||||
MANA_AUTO_PAYMENT_ON,
|
MANA_AUTO_PAYMENT_ON,
|
||||||
MANA_AUTO_PAYMENT_OFF,
|
MANA_AUTO_PAYMENT_OFF,
|
||||||
RESET_AUTO_SELECT_REPLACEMENT_EFFECTS
|
RESET_AUTO_SELECT_REPLACEMENT_EFFECTS,
|
||||||
|
REVOKE_PERMISSIONS_TO_SEE_HAND_CARDS,
|
||||||
|
REQUEST_PERMISSION_TO_SEE_HAND_CARDS,
|
||||||
|
ADD_PERMISSION_TO_SEE_HAND_CARDS,
|
||||||
|
PERMISSION_REQUESTS_ALLOWED_ON,
|
||||||
|
PERMISSION_REQUESTS_ALLOWED_OFF
|
||||||
}
|
}
|
||||||
|
|
@ -49,6 +49,7 @@ public class MatchPlayer {
|
||||||
private boolean doneSideboarding;
|
private boolean doneSideboarding;
|
||||||
private int priorityTimeLeft;
|
private int priorityTimeLeft;
|
||||||
|
|
||||||
|
|
||||||
public MatchPlayer(Player player, Deck deck) {
|
public MatchPlayer(Player player, Deck deck) {
|
||||||
this.player = player;
|
this.player = player;
|
||||||
this.deck = deck;
|
this.deck = deck;
|
||||||
|
|
|
||||||
|
|
@ -519,4 +519,13 @@ public interface Player extends MageItem, Copyable<Player> {
|
||||||
*/
|
*/
|
||||||
void setCastSourceIdWithoutMana(UUID sourceId);
|
void setCastSourceIdWithoutMana(UUID sourceId);
|
||||||
UUID getCastSourceIdWithoutMana();
|
UUID getCastSourceIdWithoutMana();
|
||||||
|
|
||||||
|
// permission handling to show hand cards
|
||||||
|
void addPermissionToShowHandCards(UUID watcherUserId);
|
||||||
|
boolean hasUserPermissionToSeeHand(UUID userId);
|
||||||
|
void revokePermissionToSeeHandCards();
|
||||||
|
void setRequestToShowHandCardsAllowed(boolean requestAllowed);
|
||||||
|
boolean isRequestToShowHandCardsAllowed();
|
||||||
|
Set<UUID> getUsersAllowedToSeeHandCards();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -200,6 +200,10 @@ public abstract class PlayerImpl implements Player, Serializable {
|
||||||
protected boolean isGameUnderControl = true;
|
protected boolean isGameUnderControl = true;
|
||||||
protected UUID turnController;
|
protected UUID turnController;
|
||||||
protected Set<UUID> playersUnderYourControl = new HashSet<>();
|
protected Set<UUID> playersUnderYourControl = new HashSet<>();
|
||||||
|
|
||||||
|
protected Set<UUID> usersAllowedToSeeHandCards = new HashSet<>();
|
||||||
|
protected boolean requestsAllowedToSeeHandCards = true;
|
||||||
|
|
||||||
protected List<UUID> attachments = new ArrayList<>();
|
protected List<UUID> attachments = new ArrayList<>();
|
||||||
|
|
||||||
protected boolean topCardRevealed = false;
|
protected boolean topCardRevealed = false;
|
||||||
|
|
@ -214,12 +218,12 @@ public abstract class PlayerImpl implements Player, Serializable {
|
||||||
|
|
||||||
protected UserData userData;
|
protected UserData userData;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* During some steps we can't play anything
|
* During some steps we can't play anything
|
||||||
*/
|
*/
|
||||||
protected final Map<PhaseStep, Step.StepPart> silentPhaseSteps = new HashMap<PhaseStep, Step.StepPart>() {{
|
protected final Map<PhaseStep, Step.StepPart> silentPhaseSteps = new HashMap<PhaseStep, Step.StepPart>()
|
||||||
put(PhaseStep.DECLARE_ATTACKERS, Step.StepPart.PRE);
|
{{ put(PhaseStep.DECLARE_ATTACKERS, Step.StepPart.PRE);}};
|
||||||
}};
|
|
||||||
|
|
||||||
public PlayerImpl(String name, RangeOfInfluence range) {
|
public PlayerImpl(String name, RangeOfInfluence range) {
|
||||||
this(UUID.randomUUID());
|
this(UUID.randomUUID());
|
||||||
|
|
@ -286,6 +290,9 @@ public abstract class PlayerImpl implements Player, Serializable {
|
||||||
this.topCardRevealed = player.topCardRevealed;
|
this.topCardRevealed = player.topCardRevealed;
|
||||||
this.playersUnderYourControl.clear();
|
this.playersUnderYourControl.clear();
|
||||||
this.playersUnderYourControl.addAll(player.playersUnderYourControl);
|
this.playersUnderYourControl.addAll(player.playersUnderYourControl);
|
||||||
|
this.usersAllowedToSeeHandCards.addAll(player.usersAllowedToSeeHandCards);
|
||||||
|
this.requestsAllowedToSeeHandCards = player.requestsAllowedToSeeHandCards;
|
||||||
|
|
||||||
this.isTestMode = player.isTestMode;
|
this.isTestMode = player.isTestMode;
|
||||||
this.isGameUnderControl = player.isGameUnderControl;
|
this.isGameUnderControl = player.isGameUnderControl;
|
||||||
|
|
||||||
|
|
@ -361,6 +368,9 @@ public abstract class PlayerImpl implements Player, Serializable {
|
||||||
this.priorityTimeLeft = player.getPriorityTimeLeft();
|
this.priorityTimeLeft = player.getPriorityTimeLeft();
|
||||||
this.reachedNextTurnAfterLeaving = player.hasReachedNextTurnAfterLeaving();
|
this.reachedNextTurnAfterLeaving = player.hasReachedNextTurnAfterLeaving();
|
||||||
this.castSourceIdWithoutMana = player.getCastSourceIdWithoutMana();
|
this.castSourceIdWithoutMana = player.getCastSourceIdWithoutMana();
|
||||||
|
|
||||||
|
this.usersAllowedToSeeHandCards.addAll(player.getUsersAllowedToSeeHandCards());
|
||||||
|
this.requestsAllowedToSeeHandCards = player.isRequestToShowHandCardsAllowed();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
@ -1771,6 +1781,13 @@ public abstract class PlayerImpl implements Player, Serializable {
|
||||||
passedUntilEndOfTurn = false;
|
passedUntilEndOfTurn = false;
|
||||||
passedUntilNextMain = false;
|
passedUntilNextMain = false;
|
||||||
passedUntilStackResolved = false;
|
passedUntilStackResolved = false;
|
||||||
|
break;
|
||||||
|
case PERMISSION_REQUESTS_ALLOWED_OFF:
|
||||||
|
this.setRequestToShowHandCardsAllowed(false);
|
||||||
|
break;
|
||||||
|
case PERMISSION_REQUESTS_ALLOWED_ON:
|
||||||
|
this.setRequestToShowHandCardsAllowed(true);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
logger.trace("PASS Priority: " + playerAction.toString());
|
logger.trace("PASS Priority: " + playerAction.toString());
|
||||||
}
|
}
|
||||||
|
|
@ -2721,5 +2738,35 @@ public abstract class PlayerImpl implements Player, Serializable {
|
||||||
public boolean getPassedUntilStackResolved() {
|
public boolean getPassedUntilStackResolved() {
|
||||||
return passedUntilStackResolved;
|
return passedUntilStackResolved;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void revokePermissionToSeeHandCards() {
|
||||||
|
usersAllowedToSeeHandCards.clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void addPermissionToShowHandCards(UUID watcherUserId) {
|
||||||
|
usersAllowedToSeeHandCards.add(watcherUserId);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setRequestToShowHandCardsAllowed(boolean requestAllowed) {
|
||||||
|
this.requestsAllowedToSeeHandCards = requestAllowed;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isRequestToShowHandCardsAllowed() {
|
||||||
|
return requestsAllowedToSeeHandCards;
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public boolean hasUserPermissionToSeeHand(UUID userId) {
|
||||||
|
return usersAllowedToSeeHandCards.contains(userId);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Set<UUID> getUsersAllowedToSeeHandCards() {
|
||||||
|
return usersAllowedToSeeHandCards;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -12,12 +12,14 @@ public class UserData implements Serializable {
|
||||||
protected int groupId;
|
protected int groupId;
|
||||||
protected int avatarId;
|
protected int avatarId;
|
||||||
protected boolean showAbilityPickerForced;
|
protected boolean showAbilityPickerForced;
|
||||||
|
protected boolean allowRequestShowHandCards;
|
||||||
protected UserSkipPrioritySteps userSkipPrioritySteps;
|
protected UserSkipPrioritySteps userSkipPrioritySteps;
|
||||||
|
|
||||||
public UserData(UserGroup userGroup, int avatarId, boolean showAbilityPickerForced, UserSkipPrioritySteps userSkipPrioritySteps) {
|
public UserData(UserGroup userGroup, int avatarId, boolean showAbilityPickerForced, boolean allowRequestShowHandCards, UserSkipPrioritySteps userSkipPrioritySteps) {
|
||||||
this.groupId = userGroup.getGroupId();
|
this.groupId = userGroup.getGroupId();
|
||||||
this.avatarId = avatarId;
|
this.avatarId = avatarId;
|
||||||
this.showAbilityPickerForced = showAbilityPickerForced;
|
this.showAbilityPickerForced = showAbilityPickerForced;
|
||||||
|
this.allowRequestShowHandCards = allowRequestShowHandCards;
|
||||||
this.userSkipPrioritySteps = userSkipPrioritySteps;
|
this.userSkipPrioritySteps = userSkipPrioritySteps;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -45,6 +47,14 @@ public class UserData implements Serializable {
|
||||||
this.showAbilityPickerForced = showAbilityPickerForced;
|
this.showAbilityPickerForced = showAbilityPickerForced;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setAllowRequestShowHandCards(boolean allowRequestShowHandCards) {
|
||||||
|
this.allowRequestShowHandCards = allowRequestShowHandCards;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean allowRequestShowHandCards() {
|
||||||
|
return allowRequestShowHandCards;
|
||||||
|
}
|
||||||
|
|
||||||
public UserSkipPrioritySteps getUserSkipPrioritySteps() {
|
public UserSkipPrioritySteps getUserSkipPrioritySteps() {
|
||||||
return userSkipPrioritySteps;
|
return userSkipPrioritySteps;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue