mirror of
https://github.com/correl/mage.git
synced 2024-11-15 19:19:33 +00:00
merge
This commit is contained in:
commit
237ffabafb
10 changed files with 706 additions and 85 deletions
|
@ -60,6 +60,16 @@
|
|||
<artifactId>jetlang</artifactId>
|
||||
<version>0.2.4</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.jgoodies</groupId>
|
||||
<artifactId>forms</artifactId>
|
||||
<version>1.2.1</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.intellij</groupId>
|
||||
<artifactId>forms_rt</artifactId>
|
||||
<version>7.0.3</version>
|
||||
</dependency>
|
||||
<!--
|
||||
<dependency>
|
||||
<groupId>junit</groupId>
|
||||
|
|
|
@ -71,10 +71,7 @@ import javax.swing.UIManager;
|
|||
|
||||
import mage.client.cards.CardsStorage;
|
||||
import mage.client.components.MageComponents;
|
||||
import mage.client.dialog.AboutDialog;
|
||||
import mage.client.dialog.CombatDialog;
|
||||
import mage.client.dialog.ConnectDialog;
|
||||
import mage.client.dialog.PickNumberDialog;
|
||||
import mage.client.dialog.*;
|
||||
import mage.client.plugins.impl.Plugins;
|
||||
import mage.client.remote.Session;
|
||||
import mage.client.util.EDTExceptionHandler;
|
||||
|
@ -341,10 +338,12 @@ public class MageFrame extends javax.swing.JFrame {
|
|||
deckEditorPane = new mage.client.deckeditor.DeckEditorPane();
|
||||
mageToolbar = new javax.swing.JToolBar();
|
||||
btnConnect = new javax.swing.JButton();
|
||||
jSeparator4 = new javax.swing.JToolBar.Separator();
|
||||
jSeparator5 = new javax.swing.JToolBar.Separator();
|
||||
btnGames = new javax.swing.JButton();
|
||||
jSeparator3 = new javax.swing.JToolBar.Separator();
|
||||
jSeparator4 = new javax.swing.JToolBar.Separator();
|
||||
btnDeckEditor = new javax.swing.JButton();
|
||||
jSeparator3 = new javax.swing.JToolBar.Separator();
|
||||
btnPreferences = new javax.swing.JButton();
|
||||
jSeparator2 = new javax.swing.JToolBar.Separator();
|
||||
btnAbout = new javax.swing.JButton();
|
||||
jSeparator1 = new javax.swing.JToolBar.Separator();
|
||||
|
@ -418,6 +417,19 @@ public class MageFrame extends javax.swing.JFrame {
|
|||
});
|
||||
mageToolbar.add(btnDeckEditor);
|
||||
mageToolbar.add(jSeparator2);
|
||||
|
||||
btnPreferences.setText("Preferences");
|
||||
btnPreferences.setBorder(javax.swing.BorderFactory.createEmptyBorder(1, 1, 1, 1));
|
||||
btnPreferences.setFocusable(false);
|
||||
btnPreferences.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
|
||||
btnPreferences.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
|
||||
btnPreferences.addActionListener(new java.awt.event.ActionListener() {
|
||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||
btnPreferencesActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
mageToolbar.add(btnPreferences);
|
||||
mageToolbar.add(jSeparator5);
|
||||
|
||||
btnAbout.setText("About");
|
||||
btnAbout.setBorder(javax.swing.BorderFactory.createEmptyBorder(1, 1, 1, 1));
|
||||
|
@ -473,6 +485,10 @@ public class MageFrame extends javax.swing.JFrame {
|
|||
this.deckEditorPane.showTables();
|
||||
}//GEN-LAST:event_btnDeckEditorActionPerformed
|
||||
|
||||
private void btnPreferencesActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnDeckEditorActionPerformed
|
||||
PhasesDialog.main(new String[]{});
|
||||
}
|
||||
|
||||
private void btnGamesActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnGamesActionPerformed
|
||||
this.gamePane.setVisible(false);
|
||||
this.deckEditorPane.setVisible(false);
|
||||
|
@ -570,6 +586,7 @@ public class MageFrame extends javax.swing.JFrame {
|
|||
private javax.swing.JButton btnAbout;
|
||||
private javax.swing.JButton btnConnect;
|
||||
private javax.swing.JButton btnDeckEditor;
|
||||
private javax.swing.JButton btnPreferences;
|
||||
private javax.swing.JButton btnExit;
|
||||
private javax.swing.JButton btnGames;
|
||||
private mage.client.deckeditor.DeckEditorPane deckEditorPane;
|
||||
|
@ -579,6 +596,7 @@ public class MageFrame extends javax.swing.JFrame {
|
|||
private javax.swing.JToolBar.Separator jSeparator2;
|
||||
private javax.swing.JToolBar.Separator jSeparator3;
|
||||
private javax.swing.JToolBar.Separator jSeparator4;
|
||||
private javax.swing.JToolBar.Separator jSeparator5;
|
||||
private javax.swing.JLabel lblStatus;
|
||||
private javax.swing.JToolBar mageToolbar;
|
||||
private mage.client.table.TablesPane tablesPane;
|
||||
|
|
|
@ -42,6 +42,7 @@ import java.util.logging.Logger;
|
|||
import javax.swing.JOptionPane;
|
||||
import mage.cards.decks.DeckCardLists;
|
||||
import mage.client.remote.Session;
|
||||
import mage.client.util.PhaseManager;
|
||||
import mage.util.Logging;
|
||||
|
||||
/**
|
||||
|
@ -136,6 +137,7 @@ public class JoinTableDialog extends MageDialog {
|
|||
private void btnOKActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnOKActionPerformed
|
||||
Session session = MageFrame.getSession();
|
||||
try {
|
||||
PhaseManager.getInstance().setName(this.newPlayerPanel.getPlayerName());
|
||||
joined = session.joinTable(roomId, tableId, this.newPlayerPanel.getPlayerName(), DeckCardLists.load(this.newPlayerPanel.getDeckFile()));
|
||||
} catch (Exception ex) {
|
||||
handleError(ex);
|
||||
|
|
326
Mage.Client/src/main/java/mage/client/dialog/PhasesDialog.form
Normal file
326
Mage.Client/src/main/java/mage/client/dialog/PhasesDialog.form
Normal file
|
@ -0,0 +1,326 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<form xmlns="http://www.intellij.com/uidesigner/form/" version="1" bind-to-class="mage.client.dialog.PhasesDialog">
|
||||
<grid id="27dc6" binding="panel1" default-binding="true" layout-manager="FormLayout">
|
||||
<rowspec value="center:d:noGrow"/>
|
||||
<rowspec value="top:4dlu:noGrow"/>
|
||||
<rowspec value="center:258px:noGrow"/>
|
||||
<rowspec value="top:4dlu:noGrow"/>
|
||||
<rowspec value="center:max(d;4px):noGrow"/>
|
||||
<colspec value="fill:324px:noGrow"/>
|
||||
<constraints>
|
||||
<xy x="20" y="20" width="338" height="328"/>
|
||||
</constraints>
|
||||
<properties>
|
||||
<preferredSize width="324" height="324"/>
|
||||
</properties>
|
||||
<border type="none"/>
|
||||
<children>
|
||||
<component id="9fb3d" class="javax.swing.JLabel">
|
||||
<constraints>
|
||||
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
|
||||
<forms top="5" left="10" bottom="0" right="0"/>
|
||||
</constraints>
|
||||
<properties>
|
||||
<maximumSize width="88" height="20"/>
|
||||
<minimumSize width="88" height="20"/>
|
||||
<preferredSize width="88" height="20"/>
|
||||
<text value="Stop on (yes/no)"/>
|
||||
</properties>
|
||||
</component>
|
||||
<grid id="fdb69" layout-manager="GridLayoutManager" row-count="8" column-count="3" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
|
||||
<margin top="0" left="0" bottom="0" right="0"/>
|
||||
<constraints>
|
||||
<grid row="2" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="9" fill="0" indent="1" use-parent-layout="false"/>
|
||||
<forms top="0" left="18" bottom="0" right="0" defaultalign-horz="false" defaultalign-vert="false"/>
|
||||
</constraints>
|
||||
<properties>
|
||||
<minimumSize width="0" height="0"/>
|
||||
<preferredSize width="300" height="250"/>
|
||||
</properties>
|
||||
<border type="none"/>
|
||||
<children>
|
||||
<component id="7d72e" class="javax.swing.JLabel">
|
||||
<constraints>
|
||||
<grid row="1" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false">
|
||||
<preferred-size width="107" height="16"/>
|
||||
</grid>
|
||||
</constraints>
|
||||
<properties>
|
||||
<text value="Upkeep:"/>
|
||||
</properties>
|
||||
</component>
|
||||
<component id="1c51d" class="javax.swing.JLabel">
|
||||
<constraints>
|
||||
<grid row="2" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false">
|
||||
<preferred-size width="107" height="16"/>
|
||||
</grid>
|
||||
</constraints>
|
||||
<properties>
|
||||
<text value="Draw:"/>
|
||||
</properties>
|
||||
</component>
|
||||
<component id="223" class="javax.swing.JLabel">
|
||||
<constraints>
|
||||
<grid row="3" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false">
|
||||
<preferred-size width="107" height="16"/>
|
||||
</grid>
|
||||
</constraints>
|
||||
<properties>
|
||||
<text value="Main:"/>
|
||||
</properties>
|
||||
</component>
|
||||
<component id="af314" class="javax.swing.JLabel">
|
||||
<constraints>
|
||||
<grid row="4" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false">
|
||||
<preferred-size width="107" height="16"/>
|
||||
</grid>
|
||||
</constraints>
|
||||
<properties>
|
||||
<text value="Before combat:"/>
|
||||
</properties>
|
||||
</component>
|
||||
<component id="466d5" class="javax.swing.JLabel">
|
||||
<constraints>
|
||||
<grid row="5" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false">
|
||||
<preferred-size width="107" height="16"/>
|
||||
</grid>
|
||||
</constraints>
|
||||
<properties>
|
||||
<text value="End of combat:"/>
|
||||
</properties>
|
||||
</component>
|
||||
<component id="9f357" class="javax.swing.JLabel">
|
||||
<constraints>
|
||||
<grid row="6" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false">
|
||||
<preferred-size width="107" height="16"/>
|
||||
</grid>
|
||||
</constraints>
|
||||
<properties>
|
||||
<text value="Main 2:"/>
|
||||
</properties>
|
||||
</component>
|
||||
<component id="8b3cb" class="javax.swing.JLabel">
|
||||
<constraints>
|
||||
<grid row="7" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false">
|
||||
<preferred-size width="107" height="16"/>
|
||||
</grid>
|
||||
</constraints>
|
||||
<properties>
|
||||
<text value="End of turn:"/>
|
||||
</properties>
|
||||
</component>
|
||||
<component id="f062b" class="javax.swing.JCheckBox" binding="checkBoxUpkeepYou" default-binding="true">
|
||||
<constraints>
|
||||
<grid row="1" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="0" fill="0" indent="0" use-parent-layout="false">
|
||||
<preferred-size width="10" height="21"/>
|
||||
</grid>
|
||||
</constraints>
|
||||
<properties>
|
||||
<selected value="true"/>
|
||||
<text value=""/>
|
||||
</properties>
|
||||
</component>
|
||||
<component id="d1440" class="javax.swing.JCheckBox" binding="checkBoxDrawYou">
|
||||
<constraints>
|
||||
<grid row="2" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="0" fill="0" indent="0" use-parent-layout="false">
|
||||
<preferred-size width="10" height="21"/>
|
||||
</grid>
|
||||
</constraints>
|
||||
<properties>
|
||||
<selected value="true"/>
|
||||
<text value=""/>
|
||||
</properties>
|
||||
</component>
|
||||
<component id="155dc" class="javax.swing.JCheckBox" binding="checkBoxMainYou">
|
||||
<constraints>
|
||||
<grid row="3" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="0" fill="0" indent="0" use-parent-layout="false">
|
||||
<preferred-size width="10" height="21"/>
|
||||
</grid>
|
||||
</constraints>
|
||||
<properties>
|
||||
<selected value="true"/>
|
||||
<text value=""/>
|
||||
</properties>
|
||||
</component>
|
||||
<component id="88fe1" class="javax.swing.JCheckBox" binding="checkBoxBeforeCYou">
|
||||
<constraints>
|
||||
<grid row="4" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="0" fill="0" indent="0" use-parent-layout="false">
|
||||
<preferred-size width="10" height="21"/>
|
||||
</grid>
|
||||
</constraints>
|
||||
<properties>
|
||||
<selected value="true"/>
|
||||
<text value=""/>
|
||||
</properties>
|
||||
</component>
|
||||
<component id="7b4cb" class="javax.swing.JCheckBox" binding="checkBoxEndCYou">
|
||||
<constraints>
|
||||
<grid row="5" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="0" fill="0" indent="0" use-parent-layout="false">
|
||||
<preferred-size width="10" height="21"/>
|
||||
</grid>
|
||||
</constraints>
|
||||
<properties>
|
||||
<selected value="true"/>
|
||||
<text value=""/>
|
||||
</properties>
|
||||
</component>
|
||||
<component id="97db2" class="javax.swing.JCheckBox" binding="checkBoxMain2You">
|
||||
<constraints>
|
||||
<grid row="6" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="0" fill="0" indent="0" use-parent-layout="false">
|
||||
<preferred-size width="10" height="21"/>
|
||||
</grid>
|
||||
</constraints>
|
||||
<properties>
|
||||
<selected value="true"/>
|
||||
<text value=""/>
|
||||
</properties>
|
||||
</component>
|
||||
<component id="8cc2a" class="javax.swing.JCheckBox" binding="checkBoxEndTurnYou">
|
||||
<constraints>
|
||||
<grid row="7" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="0" fill="0" indent="0" use-parent-layout="false">
|
||||
<preferred-size width="10" height="21"/>
|
||||
</grid>
|
||||
</constraints>
|
||||
<properties>
|
||||
<selected value="true"/>
|
||||
<text value=""/>
|
||||
</properties>
|
||||
</component>
|
||||
<component id="b48fc" class="javax.swing.JCheckBox" binding="checkBoxUpkeepOthers">
|
||||
<constraints>
|
||||
<grid row="1" column="2" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="0" fill="0" indent="0" use-parent-layout="false">
|
||||
<preferred-size width="10" height="21"/>
|
||||
</grid>
|
||||
</constraints>
|
||||
<properties>
|
||||
<selected value="true"/>
|
||||
<text value=""/>
|
||||
</properties>
|
||||
</component>
|
||||
<component id="55967" class="javax.swing.JCheckBox" binding="checkBoxDrawOthers">
|
||||
<constraints>
|
||||
<grid row="2" column="2" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="0" fill="0" indent="0" use-parent-layout="false">
|
||||
<preferred-size width="10" height="21"/>
|
||||
</grid>
|
||||
</constraints>
|
||||
<properties>
|
||||
<selected value="true"/>
|
||||
<text value=""/>
|
||||
</properties>
|
||||
</component>
|
||||
<component id="f142a" class="javax.swing.JCheckBox" binding="checkBoxMainOthers">
|
||||
<constraints>
|
||||
<grid row="3" column="2" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="0" fill="0" indent="0" use-parent-layout="false">
|
||||
<preferred-size width="10" height="21"/>
|
||||
</grid>
|
||||
</constraints>
|
||||
<properties>
|
||||
<selected value="true"/>
|
||||
<text value=""/>
|
||||
</properties>
|
||||
</component>
|
||||
<component id="a600b" class="javax.swing.JCheckBox" binding="checkBoxBeforeCOthers">
|
||||
<constraints>
|
||||
<grid row="4" column="2" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="0" fill="0" indent="0" use-parent-layout="false">
|
||||
<preferred-size width="10" height="21"/>
|
||||
</grid>
|
||||
</constraints>
|
||||
<properties>
|
||||
<selected value="true"/>
|
||||
<text value=""/>
|
||||
</properties>
|
||||
</component>
|
||||
<component id="e145c" class="javax.swing.JCheckBox" binding="checkBoxEndCOthers">
|
||||
<constraints>
|
||||
<grid row="5" column="2" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="0" fill="0" indent="0" use-parent-layout="false">
|
||||
<preferred-size width="10" height="21"/>
|
||||
</grid>
|
||||
</constraints>
|
||||
<properties>
|
||||
<selected value="true"/>
|
||||
<text value=""/>
|
||||
</properties>
|
||||
</component>
|
||||
<component id="2c120" class="javax.swing.JCheckBox" binding="checkBoxMain2Others">
|
||||
<constraints>
|
||||
<grid row="6" column="2" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="0" fill="0" indent="0" use-parent-layout="false">
|
||||
<preferred-size width="10" height="21"/>
|
||||
</grid>
|
||||
</constraints>
|
||||
<properties>
|
||||
<selected value="true"/>
|
||||
<text value=""/>
|
||||
</properties>
|
||||
</component>
|
||||
<component id="167d6" class="javax.swing.JCheckBox" binding="checkBoxEndTurnOthers">
|
||||
<constraints>
|
||||
<grid row="7" column="2" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="0" fill="0" indent="0" use-parent-layout="false">
|
||||
<preferred-size width="10" height="21"/>
|
||||
</grid>
|
||||
</constraints>
|
||||
<properties>
|
||||
<selected value="true"/>
|
||||
<text value=""/>
|
||||
</properties>
|
||||
</component>
|
||||
<component id="e8c16" class="javax.swing.JLabel">
|
||||
<constraints>
|
||||
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false">
|
||||
<preferred-size width="107" height="0"/>
|
||||
</grid>
|
||||
</constraints>
|
||||
<properties>
|
||||
<text value=""/>
|
||||
</properties>
|
||||
</component>
|
||||
<component id="dd6f6" class="javax.swing.JLabel">
|
||||
<constraints>
|
||||
<grid row="0" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="0" fill="0" indent="0" use-parent-layout="false">
|
||||
<preferred-size width="61" height="16"/>
|
||||
</grid>
|
||||
</constraints>
|
||||
<properties>
|
||||
<horizontalTextPosition value="0"/>
|
||||
<text value="Your turn"/>
|
||||
</properties>
|
||||
</component>
|
||||
<component id="75ed" class="javax.swing.JLabel">
|
||||
<constraints>
|
||||
<grid row="0" column="2" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="0" fill="0" indent="0" use-parent-layout="false">
|
||||
<preferred-size width="61" height="16"/>
|
||||
</grid>
|
||||
</constraints>
|
||||
<properties>
|
||||
<horizontalTextPosition value="0"/>
|
||||
<text value="Others turn"/>
|
||||
</properties>
|
||||
</component>
|
||||
</children>
|
||||
</grid>
|
||||
<grid id="576d2" layout-manager="FlowLayout" hgap="5" vgap="5" flow-align="2">
|
||||
<constraints>
|
||||
<grid row="4" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
|
||||
<forms/>
|
||||
</constraints>
|
||||
<properties/>
|
||||
<border type="none"/>
|
||||
<children>
|
||||
<component id="322f" class="javax.swing.JButton" binding="OKButton" default-binding="true">
|
||||
<constraints/>
|
||||
<properties>
|
||||
<inheritsPopupMenu value="true"/>
|
||||
<label value="Save"/>
|
||||
<text value="Save"/>
|
||||
</properties>
|
||||
</component>
|
||||
<component id="5adbd" class="javax.swing.JButton" binding="cancelButton" default-binding="true">
|
||||
<constraints/>
|
||||
<properties>
|
||||
<text value="&Cancel"/>
|
||||
</properties>
|
||||
</component>
|
||||
</children>
|
||||
</grid>
|
||||
</children>
|
||||
</grid>
|
||||
</form>
|
|
@ -1,55 +1,265 @@
|
|||
package mage.client.dialog;
|
||||
|
||||
import java.awt.Dialog;
|
||||
import java.awt.Frame;
|
||||
import com.intellij.uiDesigner.core.GridConstraints;
|
||||
import com.intellij.uiDesigner.core.GridLayoutManager;
|
||||
import com.jgoodies.forms.layout.CellConstraints;
|
||||
import com.jgoodies.forms.layout.FormLayout;
|
||||
import mage.client.MageFrame;
|
||||
|
||||
import javax.swing.JButton;
|
||||
import javax.swing.JCheckBox;
|
||||
import javax.swing.JFrame;
|
||||
import javax.swing.JLabel;
|
||||
import static mage.client.util.PhaseManager.*;
|
||||
|
||||
public class PhasesDialog extends Dialog {
|
||||
|
||||
public PhasesDialog(Frame owner) {
|
||||
super(owner);
|
||||
initComponents();
|
||||
}
|
||||
|
||||
public void showDialog() {
|
||||
this.setSize(300, 300);
|
||||
this.setLocation(100, 100);
|
||||
this.setResizable(false);
|
||||
this.setTitle("Configure phase stops");
|
||||
this.setVisible(true);
|
||||
}
|
||||
|
||||
private void initComponents() {
|
||||
|
||||
label = new JLabel("Stop on:");
|
||||
upkeepPhase = new JCheckBox("Upkeep", true);
|
||||
drawPhase = new JCheckBox("Draw", true);
|
||||
main2Phase = new JCheckBox("Main 2", true);
|
||||
|
||||
setLayout(null);
|
||||
|
||||
add(label);
|
||||
label.setBounds(20, 30, 100, 20);
|
||||
|
||||
add(upkeepPhase);
|
||||
upkeepPhase.setBounds(35, 50, 150, 30);
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
import java.util.prefs.BackingStoreException;
|
||||
import java.util.prefs.Preferences;
|
||||
|
||||
add(drawPhase);
|
||||
drawPhase.setBounds(35, 80, 150, 30);
|
||||
|
||||
add(main2Phase);
|
||||
main2Phase.setBounds(35, 110, 150, 30);
|
||||
|
||||
pack();
|
||||
}
|
||||
|
||||
private JLabel label;
|
||||
private JCheckBox upkeepPhase;
|
||||
private JCheckBox drawPhase;
|
||||
private JCheckBox main2Phase;
|
||||
/**
|
||||
* Created by IntelliJ IDEA.
|
||||
* User: Администратор
|
||||
* Date: 12.12.10
|
||||
* Time: 13:48
|
||||
* To change this template use File | Settings | File Templates.
|
||||
*/
|
||||
public class PhasesDialog {
|
||||
private JPanel panel1;
|
||||
private JCheckBox checkBoxUpkeepYou;
|
||||
private JCheckBox checkBoxUpkeepOthers;
|
||||
private JCheckBox checkBoxDrawYou;
|
||||
private JCheckBox checkBoxMainYou;
|
||||
private JCheckBox checkBoxBeforeCYou;
|
||||
private JCheckBox checkBoxEndCYou;
|
||||
private JCheckBox checkBoxMain2You;
|
||||
private JCheckBox checkBoxEndTurnYou;
|
||||
private JCheckBox checkBoxDrawOthers;
|
||||
private JCheckBox checkBoxMainOthers;
|
||||
private JCheckBox checkBoxBeforeCOthers;
|
||||
private JCheckBox checkBoxEndCOthers;
|
||||
private JCheckBox checkBoxMain2Others;
|
||||
private JCheckBox checkBoxEndTurnOthers;
|
||||
private JButton OKButton;
|
||||
private JButton cancelButton;
|
||||
|
||||
private static final JFrame fInstance = new JFrame("PhasesDialog");
|
||||
private static final PhasesDialog dialog = new PhasesDialog();
|
||||
|
||||
static {
|
||||
fInstance.setContentPane(dialog.panel1);
|
||||
fInstance.setDefaultCloseOperation(JFrame.HIDE_ON_CLOSE);
|
||||
fInstance.setLocation(300, 200);
|
||||
fInstance.setResizable(false);
|
||||
fInstance.setTitle("Configure phase stops");
|
||||
fInstance.pack();
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
if (!fInstance.isVisible()) {
|
||||
Preferences prefs = MageFrame.getPreferences();
|
||||
load(prefs, dialog.checkBoxUpkeepYou, UPKEEP_YOU);
|
||||
load(prefs, dialog.checkBoxDrawYou, DRAW_YOU);
|
||||
load(prefs, dialog.checkBoxMainYou, MAIN_YOU);
|
||||
load(prefs, dialog.checkBoxBeforeCYou, BEFORE_COMBAT_YOU);
|
||||
load(prefs, dialog.checkBoxEndCYou, END_OF_COMBAT_YOU);
|
||||
load(prefs, dialog.checkBoxMain2You, MAIN_2_YOU);
|
||||
load(prefs, dialog.checkBoxEndTurnYou, END_OF_TURN_YOU);
|
||||
|
||||
load(prefs, dialog.checkBoxUpkeepOthers, UPKEEP_OTHERS);
|
||||
load(prefs, dialog.checkBoxDrawOthers, DRAW_OTHERS);
|
||||
load(prefs, dialog.checkBoxMainOthers, MAIN_OTHERS);
|
||||
load(prefs, dialog.checkBoxBeforeCOthers, BEFORE_COMBAT_OTHERS);
|
||||
load(prefs, dialog.checkBoxEndCOthers, END_OF_COMBAT_OTHERS);
|
||||
load(prefs, dialog.checkBoxMain2Others, MAIN_2_OTHERS);
|
||||
load(prefs, dialog.checkBoxEndTurnOthers, END_OF_TURN_OTHERS);
|
||||
fInstance.setVisible(true);
|
||||
} else {
|
||||
fInstance.requestFocus();
|
||||
}
|
||||
}
|
||||
|
||||
private static void load(Preferences prefs, JCheckBox checkBox, String propName) {
|
||||
String prop = prefs.get(propName, PHASE_ON);
|
||||
checkBox.setSelected(prop.equals(PHASE_ON));
|
||||
}
|
||||
|
||||
private static void save(Preferences prefs, JCheckBox checkBox, String propName) {
|
||||
prefs.put(propName, checkBox.isSelected() ? PHASE_ON : PHASE_OFF);
|
||||
}
|
||||
|
||||
public PhasesDialog() {
|
||||
OKButton.addActionListener(new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
Preferences prefs = MageFrame.getPreferences();
|
||||
save(prefs, dialog.checkBoxUpkeepYou, "upkeepYou");
|
||||
save(prefs, dialog.checkBoxDrawYou, "drawYou");
|
||||
save(prefs, dialog.checkBoxMainYou, "mainYou");
|
||||
save(prefs, dialog.checkBoxBeforeCYou, "beforeCombatYou");
|
||||
save(prefs, dialog.checkBoxEndCYou, "endOfCombatYou");
|
||||
save(prefs, dialog.checkBoxMain2You, "main2You");
|
||||
save(prefs, dialog.checkBoxEndTurnYou, "endOfTurnYou");
|
||||
|
||||
save(prefs, dialog.checkBoxUpkeepOthers, UPKEEP_OTHERS);
|
||||
save(prefs, dialog.checkBoxDrawOthers, DRAW_OTHERS);
|
||||
save(prefs, dialog.checkBoxMainOthers, MAIN_OTHERS);
|
||||
save(prefs, dialog.checkBoxBeforeCOthers, BEFORE_COMBAT_OTHERS);
|
||||
save(prefs, dialog.checkBoxEndCOthers, END_OF_COMBAT_OTHERS);
|
||||
save(prefs, dialog.checkBoxMain2Others, MAIN_2_OTHERS);
|
||||
save(prefs, dialog.checkBoxEndTurnOthers, END_OF_TURN_OTHERS);
|
||||
try {
|
||||
prefs.flush();
|
||||
} catch (BackingStoreException ex) {
|
||||
ex.printStackTrace();
|
||||
JOptionPane.showMessageDialog(null, "Error: couldn't save phase stops. Please try again.");
|
||||
}
|
||||
fInstance.setVisible(false);
|
||||
}
|
||||
});
|
||||
cancelButton.addActionListener(new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
fInstance.setVisible(false);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
{
|
||||
// GUI initializer generated by IntelliJ IDEA GUI Designer
|
||||
// >>> IMPORTANT!! <<<
|
||||
// DO NOT EDIT OR ADD ANY CODE HERE!
|
||||
$$$setupUI$$$();
|
||||
}
|
||||
|
||||
/**
|
||||
* Method generated by IntelliJ IDEA GUI Designer
|
||||
* >>> IMPORTANT!! <<<
|
||||
* DO NOT edit this method OR call it in your code!
|
||||
*
|
||||
* @noinspection ALL
|
||||
*/
|
||||
private void $$$setupUI$$$() {
|
||||
panel1 = new JPanel();
|
||||
panel1.setLayout(new FormLayout("fill:324px:noGrow", "center:d:noGrow,top:4dlu:noGrow,center:258px:noGrow,top:4dlu:noGrow,center:max(d;4px):noGrow"));
|
||||
panel1.setPreferredSize(new Dimension(324, 324));
|
||||
final JLabel label1 = new JLabel();
|
||||
label1.setMaximumSize(new Dimension(88, 20));
|
||||
label1.setMinimumSize(new Dimension(88, 20));
|
||||
label1.setPreferredSize(new Dimension(88, 20));
|
||||
label1.setText("Stop on (yes/no)");
|
||||
CellConstraints cc = new CellConstraints();
|
||||
panel1.add(label1, new CellConstraints(1, 1, 1, 1, CellConstraints.DEFAULT, CellConstraints.DEFAULT, new Insets(5, 10, 0, 0)));
|
||||
final JPanel panel2 = new JPanel();
|
||||
panel2.setLayout(new GridLayoutManager(8, 3, new Insets(0, 0, 0, 0), -1, -1));
|
||||
panel2.setMinimumSize(new Dimension(0, 0));
|
||||
panel2.setPreferredSize(new Dimension(300, 250));
|
||||
panel1.add(panel2, new CellConstraints(1, 3, 1, 1, CellConstraints.LEFT, CellConstraints.TOP, new Insets(0, 18, 0, 0)));
|
||||
final JLabel label2 = new JLabel();
|
||||
label2.setText("Upkeep:");
|
||||
panel2.add(label2, new GridConstraints(1, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(107, 16), null, 0, false));
|
||||
final JLabel label3 = new JLabel();
|
||||
label3.setText("Draw:");
|
||||
panel2.add(label3, new GridConstraints(2, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(107, 16), null, 0, false));
|
||||
final JLabel label4 = new JLabel();
|
||||
label4.setText("Main:");
|
||||
panel2.add(label4, new GridConstraints(3, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(107, 16), null, 0, false));
|
||||
final JLabel label5 = new JLabel();
|
||||
label5.setText("Before combat:");
|
||||
panel2.add(label5, new GridConstraints(4, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(107, 16), null, 0, false));
|
||||
final JLabel label6 = new JLabel();
|
||||
label6.setText("End of combat:");
|
||||
panel2.add(label6, new GridConstraints(5, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(107, 16), null, 0, false));
|
||||
final JLabel label7 = new JLabel();
|
||||
label7.setText("Main 2:");
|
||||
panel2.add(label7, new GridConstraints(6, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(107, 16), null, 0, false));
|
||||
final JLabel label8 = new JLabel();
|
||||
label8.setText("End of turn:");
|
||||
panel2.add(label8, new GridConstraints(7, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(107, 16), null, 0, false));
|
||||
checkBoxUpkeepYou = new JCheckBox();
|
||||
checkBoxUpkeepYou.setSelected(true);
|
||||
checkBoxUpkeepYou.setText("");
|
||||
panel2.add(checkBoxUpkeepYou, new GridConstraints(1, 1, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(10, 21), null, 0, false));
|
||||
checkBoxDrawYou = new JCheckBox();
|
||||
checkBoxDrawYou.setSelected(true);
|
||||
checkBoxDrawYou.setText("");
|
||||
panel2.add(checkBoxDrawYou, new GridConstraints(2, 1, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(10, 21), null, 0, false));
|
||||
checkBoxMainYou = new JCheckBox();
|
||||
checkBoxMainYou.setSelected(true);
|
||||
checkBoxMainYou.setText("");
|
||||
panel2.add(checkBoxMainYou, new GridConstraints(3, 1, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(10, 21), null, 0, false));
|
||||
checkBoxBeforeCYou = new JCheckBox();
|
||||
checkBoxBeforeCYou.setSelected(true);
|
||||
checkBoxBeforeCYou.setText("");
|
||||
panel2.add(checkBoxBeforeCYou, new GridConstraints(4, 1, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(10, 21), null, 0, false));
|
||||
checkBoxEndCYou = new JCheckBox();
|
||||
checkBoxEndCYou.setSelected(true);
|
||||
checkBoxEndCYou.setText("");
|
||||
panel2.add(checkBoxEndCYou, new GridConstraints(5, 1, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(10, 21), null, 0, false));
|
||||
checkBoxMain2You = new JCheckBox();
|
||||
checkBoxMain2You.setSelected(true);
|
||||
checkBoxMain2You.setText("");
|
||||
panel2.add(checkBoxMain2You, new GridConstraints(6, 1, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(10, 21), null, 0, false));
|
||||
checkBoxEndTurnYou = new JCheckBox();
|
||||
checkBoxEndTurnYou.setSelected(true);
|
||||
checkBoxEndTurnYou.setText("");
|
||||
panel2.add(checkBoxEndTurnYou, new GridConstraints(7, 1, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(10, 21), null, 0, false));
|
||||
checkBoxUpkeepOthers = new JCheckBox();
|
||||
checkBoxUpkeepOthers.setSelected(true);
|
||||
checkBoxUpkeepOthers.setText("");
|
||||
panel2.add(checkBoxUpkeepOthers, new GridConstraints(1, 2, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(10, 21), null, 0, false));
|
||||
checkBoxDrawOthers = new JCheckBox();
|
||||
checkBoxDrawOthers.setSelected(true);
|
||||
checkBoxDrawOthers.setText("");
|
||||
panel2.add(checkBoxDrawOthers, new GridConstraints(2, 2, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(10, 21), null, 0, false));
|
||||
checkBoxMainOthers = new JCheckBox();
|
||||
checkBoxMainOthers.setSelected(true);
|
||||
checkBoxMainOthers.setText("");
|
||||
panel2.add(checkBoxMainOthers, new GridConstraints(3, 2, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(10, 21), null, 0, false));
|
||||
checkBoxBeforeCOthers = new JCheckBox();
|
||||
checkBoxBeforeCOthers.setSelected(true);
|
||||
checkBoxBeforeCOthers.setText("");
|
||||
panel2.add(checkBoxBeforeCOthers, new GridConstraints(4, 2, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(10, 21), null, 0, false));
|
||||
checkBoxEndCOthers = new JCheckBox();
|
||||
checkBoxEndCOthers.setSelected(true);
|
||||
checkBoxEndCOthers.setText("");
|
||||
panel2.add(checkBoxEndCOthers, new GridConstraints(5, 2, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(10, 21), null, 0, false));
|
||||
checkBoxMain2Others = new JCheckBox();
|
||||
checkBoxMain2Others.setSelected(true);
|
||||
checkBoxMain2Others.setText("");
|
||||
panel2.add(checkBoxMain2Others, new GridConstraints(6, 2, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(10, 21), null, 0, false));
|
||||
checkBoxEndTurnOthers = new JCheckBox();
|
||||
checkBoxEndTurnOthers.setSelected(true);
|
||||
checkBoxEndTurnOthers.setText("");
|
||||
panel2.add(checkBoxEndTurnOthers, new GridConstraints(7, 2, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(10, 21), null, 0, false));
|
||||
final JLabel label9 = new JLabel();
|
||||
label9.setText("");
|
||||
panel2.add(label9, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(107, 0), null, 0, false));
|
||||
final JLabel label10 = new JLabel();
|
||||
label10.setHorizontalTextPosition(0);
|
||||
label10.setText("Your turn");
|
||||
panel2.add(label10, new GridConstraints(0, 1, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(61, 16), null, 0, false));
|
||||
final JLabel label11 = new JLabel();
|
||||
label11.setHorizontalTextPosition(0);
|
||||
label11.setText("Others turn");
|
||||
panel2.add(label11, new GridConstraints(0, 2, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(61, 16), null, 0, false));
|
||||
final JPanel panel3 = new JPanel();
|
||||
panel3.setLayout(new FlowLayout(FlowLayout.RIGHT, 5, 5));
|
||||
panel1.add(panel3, cc.xy(1, 5));
|
||||
OKButton = new JButton();
|
||||
OKButton.setInheritsPopupMenu(true);
|
||||
OKButton.setLabel("Save");
|
||||
OKButton.setText("Save");
|
||||
panel3.add(OKButton);
|
||||
cancelButton = new JButton();
|
||||
cancelButton.setText("Cancel");
|
||||
cancelButton.setMnemonic('C');
|
||||
cancelButton.setDisplayedMnemonicIndex(0);
|
||||
panel3.add(cancelButton);
|
||||
}
|
||||
|
||||
/**
|
||||
* @noinspection ALL
|
||||
*/
|
||||
public JComponent $$$getRootComponent$$$() {
|
||||
return panel1;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -114,6 +114,10 @@ public class FeedbackPanel extends javax.swing.JPanel {
|
|||
startModal();
|
||||
}
|
||||
|
||||
public void doClick() {
|
||||
this.btnRight.doClick();
|
||||
}
|
||||
|
||||
public void clear() {
|
||||
stopModal();
|
||||
this.btnLeft.setVisible(false);
|
||||
|
|
|
@ -59,6 +59,7 @@ import mage.client.game.FeedbackPanel.FeedbackMode;
|
|||
import mage.client.plugins.impl.Plugins;
|
||||
import mage.client.remote.Session;
|
||||
import mage.client.util.Config;
|
||||
import mage.client.util.PhaseManager;
|
||||
import mage.client.util.gui.ArrowBuilder;
|
||||
import mage.util.Logging;
|
||||
import mage.view.AbilityPickerView;
|
||||
|
@ -355,6 +356,9 @@ public class GamePanel extends javax.swing.JPanel {
|
|||
public void select(String message, GameView gameView) {
|
||||
updateGame(gameView);
|
||||
this.feedbackPanel.getFeedback(FeedbackMode.SELECT, message, false, gameView.getSpecial());
|
||||
if (PhaseManager.getInstance().isSkip(gameView, message)) {
|
||||
this.feedbackPanel.doClick();
|
||||
}
|
||||
}
|
||||
|
||||
public void playMana(String message, GameView gameView) {
|
||||
|
|
|
@ -40,14 +40,9 @@ import java.util.UUID;
|
|||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import javax.swing.JDesktopPane;
|
||||
import javax.swing.JLayeredPane;
|
||||
|
||||
import mage.cards.decks.DeckCardLists;
|
||||
import mage.client.MageFrame;
|
||||
import mage.client.cards.BigCard;
|
||||
import mage.client.components.MageComponents;
|
||||
import mage.client.dialog.PhasesDialog;
|
||||
import mage.view.PlayerView;
|
||||
|
||||
/**
|
||||
|
@ -58,7 +53,6 @@ public class PlayAreaPanel extends javax.swing.JPanel {
|
|||
|
||||
UUID playerId;
|
||||
UUID gameId;
|
||||
PhasesDialog phasesDialog;
|
||||
|
||||
/** Creates new form PlayAreaPanel */
|
||||
public PlayAreaPanel() {
|
||||
|
@ -111,7 +105,6 @@ public class PlayAreaPanel extends javax.swing.JPanel {
|
|||
playerPanel = new mage.client.game.PlayerPanel();
|
||||
manaPool = new mage.client.game.ManaPool();
|
||||
btnCheat = new javax.swing.JButton();
|
||||
btnPhases = new javax.swing.JButton();
|
||||
jScrollPane1 = new javax.swing.JScrollPane();
|
||||
battlefieldPanel = new mage.client.game.BattlefieldPanel(jScrollPane1);
|
||||
|
||||
|
@ -123,13 +116,7 @@ public class PlayAreaPanel extends javax.swing.JPanel {
|
|||
btnCheatActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
|
||||
btnPhases.setText("Phases");
|
||||
btnPhases.addActionListener(new java.awt.event.ActionListener() {
|
||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||
btnPhasesActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
|
||||
jPanel1.setLayout(jPanel1Layout);
|
||||
|
@ -138,7 +125,6 @@ public class PlayAreaPanel extends javax.swing.JPanel {
|
|||
.addComponent(manaPool, javax.swing.GroupLayout.DEFAULT_SIZE, 116, Short.MAX_VALUE)
|
||||
.addComponent(playerPanel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||
.addComponent(btnCheat, javax.swing.GroupLayout.DEFAULT_SIZE, 116, Short.MAX_VALUE)
|
||||
.addComponent(btnPhases, javax.swing.GroupLayout.DEFAULT_SIZE, 116, Short.MAX_VALUE)
|
||||
);
|
||||
jPanel1Layout.setVerticalGroup(
|
||||
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
|
@ -147,9 +133,7 @@ public class PlayAreaPanel extends javax.swing.JPanel {
|
|||
.addGap(0, 0, 0)
|
||||
.addComponent(manaPool, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 17, Short.MAX_VALUE)
|
||||
.addComponent(btnCheat)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 17, Short.MAX_VALUE)
|
||||
.addComponent(btnPhases))
|
||||
.addComponent(btnCheat))
|
||||
);
|
||||
|
||||
jScrollPane1.setViewportView(battlefieldPanel);
|
||||
|
@ -182,17 +166,6 @@ public class PlayAreaPanel extends javax.swing.JPanel {
|
|||
}
|
||||
}//GEN-LAST:event_btnCheatActionPerformed
|
||||
|
||||
private void btnPhasesActionPerformed(java.awt.event.ActionEvent evt) {
|
||||
if (phasesDialog == null) {
|
||||
synchronized (this) {
|
||||
if (phasesDialog == null) {
|
||||
phasesDialog = new PhasesDialog(null);
|
||||
}
|
||||
}
|
||||
}
|
||||
phasesDialog.showDialog();
|
||||
}
|
||||
|
||||
// Variables declaration - do not modify//GEN-BEGIN:variables
|
||||
private mage.client.game.BattlefieldPanel battlefieldPanel;
|
||||
private javax.swing.JButton btnCheat;
|
||||
|
@ -200,7 +173,6 @@ public class PlayAreaPanel extends javax.swing.JPanel {
|
|||
private javax.swing.JScrollPane jScrollPane1;
|
||||
private mage.client.game.ManaPool manaPool;
|
||||
private mage.client.game.PlayerPanel playerPanel;
|
||||
private javax.swing.JButton btnPhases;
|
||||
// End of variables declaration//GEN-END:variables
|
||||
|
||||
}
|
||||
|
|
75
Mage.Client/src/main/java/mage/client/util/PhaseManager.java
Normal file
75
Mage.Client/src/main/java/mage/client/util/PhaseManager.java
Normal file
|
@ -0,0 +1,75 @@
|
|||
package mage.client.util;
|
||||
|
||||
import mage.client.MageFrame;
|
||||
import mage.view.GameView;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.prefs.Preferences;
|
||||
|
||||
public class PhaseManager {
|
||||
|
||||
private static final PhaseManager fInstance = new PhaseManager();
|
||||
|
||||
public static String DEFAULT_PLAYER_NAME = "player";
|
||||
|
||||
public static String PHASE_ON = "on";
|
||||
public static String PHASE_OFF = "off";
|
||||
public static String UPKEEP_YOU = "upkeepYou";
|
||||
public static String DRAW_YOU = "drawYou";
|
||||
public static String MAIN_YOU = "mainYou";
|
||||
public static String BEFORE_COMBAT_YOU = "beforeCombatYou";
|
||||
public static String END_OF_COMBAT_YOU = "endOfCombatYou";
|
||||
public static String MAIN_2_YOU = "main2You";
|
||||
public static String END_OF_TURN_YOU = "endOfTurnYou";
|
||||
|
||||
public static String UPKEEP_OTHERS = "upkeepOthers";
|
||||
public static String DRAW_OTHERS = "drawOthers";
|
||||
public static String MAIN_OTHERS = "mainOthers";
|
||||
public static String BEFORE_COMBAT_OTHERS = "beforeCombatOthers";
|
||||
public static String END_OF_COMBAT_OTHERS = "endOfCombatOthers";
|
||||
public static String MAIN_2_OTHERS = "main2Others";
|
||||
public static String END_OF_TURN_OTHERS = "endOfTurnOthers";
|
||||
|
||||
private static Map<String, String> mapYou = new HashMap<String, String>() {{
|
||||
put("Upkeep - play instants and activated abilities.", UPKEEP_YOU);
|
||||
put("Draw - play instants and activated abilities.", DRAW_YOU);
|
||||
put("Precombat Main - play spells and sorceries.", MAIN_YOU);
|
||||
put("Begin Combat - play instants and activated abilities.", BEFORE_COMBAT_YOU);
|
||||
put("End Combat - play instants and activated abilities.", END_OF_COMBAT_YOU);
|
||||
put("Postcombat Main - play spells and sorceries.", MAIN_2_YOU);
|
||||
put("End Turn - play instants and activated abilities.", END_OF_TURN_YOU);
|
||||
}};
|
||||
|
||||
private static Map<String, String> mapOthers = new HashMap<String, String>() {{
|
||||
put("Upkeep - play instants and activated abilities.", UPKEEP_OTHERS);
|
||||
put("Draw - play instants and activated abilities.", DRAW_OTHERS);
|
||||
put("Precombat Main - play spells and sorceries.", MAIN_OTHERS);
|
||||
put("Begin Combat - play instants and activated abilities.", BEFORE_COMBAT_OTHERS);
|
||||
put("End Combat - play instants and activated abilities.", END_OF_COMBAT_OTHERS);
|
||||
put("Postcombat Main - play spells and sorceries.", MAIN_2_OTHERS);
|
||||
put("End Turn - play instants and activated abilities.", END_OF_TURN_OTHERS);
|
||||
}};
|
||||
|
||||
private String yourName;
|
||||
|
||||
public static PhaseManager getInstance() {
|
||||
return fInstance;
|
||||
}
|
||||
|
||||
public void setName(String yourName) {
|
||||
this.yourName = yourName;
|
||||
}
|
||||
|
||||
public boolean isSkip(GameView gameView, String message) {
|
||||
Map<String, String> map = gameView.getActivePlayerName().equals(DEFAULT_PLAYER_NAME) ? mapYou : mapOthers;
|
||||
for (Map.Entry<String, String> entry : map.entrySet()) {
|
||||
if (message.equals(entry.getKey())) {
|
||||
Preferences prefs = MageFrame.getPreferences();
|
||||
String prop = prefs.get(entry.getValue(), PHASE_ON);
|
||||
return !prop.equals(PHASE_ON);
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
|
@ -698,7 +698,7 @@ public abstract class GameImpl<T extends GameImpl<T>> implements Game, Serializa
|
|||
if (this.canPlaySorcery(playerId))
|
||||
message += " - play spells and sorceries.";
|
||||
else
|
||||
message += " - play instants and activated abilites.";
|
||||
message += " - play instants and activated abilities.";
|
||||
|
||||
playerQueryEventSource.select(playerId, message);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue