mirror of
https://github.com/magefree/mage.git
synced 2025-12-25 21:12:04 -08:00
* Added optional rollback current turn and up to 3 previous turns to the battlefield menu. All other players have to agree to the rollback to let it happen.
This commit is contained in:
parent
5736efa103
commit
8acf28eed1
38 changed files with 661 additions and 252 deletions
|
|
@ -32,20 +32,22 @@
|
|||
<Component id="lblGameType" alignment="0" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<EmptySpace min="-2" pref="6" max="-2" attributes="0"/>
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Group type="102" alignment="0" attributes="0">
|
||||
<Component id="cbGameType" min="-2" pref="398" max="-2" attributes="1"/>
|
||||
<Group type="103" groupAlignment="0" max="-2" attributes="0">
|
||||
<Group type="102" attributes="0">
|
||||
<Component id="cbGameType" min="-2" pref="270" max="-2" attributes="1"/>
|
||||
<EmptySpace type="separate" max="-2" attributes="0"/>
|
||||
<Component id="chkRollbackTurnsAllowed" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace pref="13" max="32767" attributes="0"/>
|
||||
<Component id="lblFreeMulligans" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace max="32767" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="spnFreeMulligans" min="-2" pref="50" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<Group type="102" alignment="0" attributes="0">
|
||||
<Group type="103" groupAlignment="1" max="-2" attributes="0">
|
||||
<Component id="txtName" alignment="0" max="32767" attributes="0"/>
|
||||
<Component id="cbDeckType" alignment="0" pref="338" max="32767" attributes="1"/>
|
||||
<Group type="102" attributes="0">
|
||||
<Group type="103" groupAlignment="0" max="-2" attributes="0">
|
||||
<Component id="txtName" max="32767" attributes="0"/>
|
||||
<Component id="cbDeckType" pref="332" max="32767" attributes="1"/>
|
||||
</Group>
|
||||
<EmptySpace max="32767" attributes="0"/>
|
||||
<EmptySpace type="unrelated" max="-2" attributes="0"/>
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Component id="lbTimeLimit" alignment="1" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="lblPassword" alignment="1" min="-2" max="-2" attributes="0"/>
|
||||
|
|
@ -89,10 +91,10 @@
|
|||
<Component id="cbSkillLevel" min="-2" pref="148" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
<EmptySpace max="32767" attributes="0"/>
|
||||
<EmptySpace type="separate" max="-2" attributes="0"/>
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Component id="spnNumWins" min="-2" pref="50" max="-2" attributes="0"/>
|
||||
<Component id="lblNumWins" alignment="0" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="lblNumWins" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="spnNumWins" alignment="0" min="-2" pref="50" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
<Component id="jSeparator2" alignment="1" max="32767" attributes="0"/>
|
||||
|
|
@ -105,7 +107,7 @@
|
|||
<Group type="103" rootIndex="1" groupAlignment="0" attributes="0">
|
||||
<Group type="102" alignment="0" attributes="0">
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="jSeparator3" pref="606" max="32767" attributes="0"/>
|
||||
<Component id="jSeparator3" pref="586" max="32767" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
|
|
@ -133,6 +135,7 @@
|
|||
<Group type="103" alignment="0" groupAlignment="3" attributes="0">
|
||||
<Component id="spnFreeMulligans" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="lblFreeMulligans" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="chkRollbackTurnsAllowed" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<Group type="103" groupAlignment="3" attributes="0">
|
||||
<Component id="cbGameType" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
|
|
@ -147,11 +150,13 @@
|
|||
<Component id="spnNumPlayers" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<Group type="102" alignment="1" attributes="0">
|
||||
<Group type="103" groupAlignment="3" attributes="0">
|
||||
<Component id="lblRange" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="lblAttack" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Component id="lblSkillLevel" alignment="0" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="lblNumWins" alignment="0" min="-2" max="-2" attributes="0"/>
|
||||
<Group type="103" groupAlignment="3" attributes="0">
|
||||
<Component id="lblRange" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="lblAttack" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
<EmptySpace min="0" pref="0" max="-2" attributes="0"/>
|
||||
<Group type="103" groupAlignment="3" attributes="0">
|
||||
|
|
@ -171,8 +176,8 @@
|
|||
<EmptySpace min="-2" pref="16" max="-2" attributes="0"/>
|
||||
<Component id="jLabel2" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="pnlOtherPlayers" pref="113" max="32767" attributes="0"/>
|
||||
<EmptySpace pref="13" max="32767" attributes="0"/>
|
||||
<Component id="pnlOtherPlayers" pref="105" max="32767" attributes="0"/>
|
||||
<EmptySpace pref="7" max="32767" attributes="0"/>
|
||||
<Component id="jSeparator1" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Group type="103" groupAlignment="3" attributes="0">
|
||||
|
|
@ -185,7 +190,7 @@
|
|||
<Group type="102" alignment="0" attributes="0">
|
||||
<EmptySpace min="-2" pref="201" max="-2" attributes="0"/>
|
||||
<Component id="jSeparator3" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace pref="178" max="32767" attributes="0"/>
|
||||
<EmptySpace pref="167" max="32767" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
</Group>
|
||||
|
|
@ -237,6 +242,12 @@
|
|||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="cbGameTypeActionPerformed"/>
|
||||
</Events>
|
||||
</Component>
|
||||
<Component class="javax.swing.JCheckBox" name="chkRollbackTurnsAllowed">
|
||||
<Properties>
|
||||
<Property name="text" type="java.lang.String" value="Allow rollbacks"/>
|
||||
<Property name="toolTipText" type="java.lang.String" value="<HTML>Allow to rollback to the start of previous turns<br>
if all players agree.
"/>
|
||||
</Properties>
|
||||
</Component>
|
||||
<Component class="javax.swing.JLabel" name="lblFreeMulligans">
|
||||
<Properties>
|
||||
<Property name="text" type="java.lang.String" value="Free Mulligans:"/>
|
||||
|
|
|
|||
|
|
@ -101,6 +101,7 @@ public class NewTableDialog extends MageDialog {
|
|||
cbTimeLimit = new javax.swing.JComboBox();
|
||||
lblGameType = new javax.swing.JLabel();
|
||||
cbGameType = new javax.swing.JComboBox();
|
||||
chkRollbackTurnsAllowed = new javax.swing.JCheckBox();
|
||||
lblFreeMulligans = new javax.swing.JLabel();
|
||||
spnFreeMulligans = new javax.swing.JSpinner();
|
||||
lblNumPlayers = new javax.swing.JLabel();
|
||||
|
|
@ -144,6 +145,9 @@ public class NewTableDialog extends MageDialog {
|
|||
}
|
||||
});
|
||||
|
||||
chkRollbackTurnsAllowed.setText("Allow rollbacks");
|
||||
chkRollbackTurnsAllowed.setToolTipText("<HTML>Allow to rollback to the start of previous turns<br>\nif all players agree.\n");
|
||||
|
||||
lblFreeMulligans.setText("Free Mulligans:");
|
||||
lblFreeMulligans.setToolTipText("The number of mulligans a player can use without decreasing the number of drawn cards.");
|
||||
|
||||
|
|
@ -216,18 +220,20 @@ public class NewTableDialog extends MageDialog {
|
|||
.addComponent(lbDeckType)
|
||||
.addComponent(lblGameType))
|
||||
.addGap(6, 6, 6)
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
|
||||
.addGroup(layout.createSequentialGroup()
|
||||
.addComponent(cbGameType, javax.swing.GroupLayout.PREFERRED_SIZE, 398, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addComponent(cbGameType, javax.swing.GroupLayout.PREFERRED_SIZE, 270, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addGap(18, 18, 18)
|
||||
.addComponent(chkRollbackTurnsAllowed)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 13, Short.MAX_VALUE)
|
||||
.addComponent(lblFreeMulligans)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(spnFreeMulligans, javax.swing.GroupLayout.PREFERRED_SIZE, 50, javax.swing.GroupLayout.PREFERRED_SIZE))
|
||||
.addGroup(layout.createSequentialGroup()
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
|
||||
.addComponent(txtName, javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addComponent(cbDeckType, javax.swing.GroupLayout.Alignment.LEADING, 0, 338, Short.MAX_VALUE))
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
|
||||
.addComponent(txtName)
|
||||
.addComponent(cbDeckType, 0, 332, Short.MAX_VALUE))
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addComponent(lbTimeLimit, javax.swing.GroupLayout.Alignment.TRAILING)
|
||||
.addComponent(lblPassword, javax.swing.GroupLayout.Alignment.TRAILING))
|
||||
|
|
@ -260,10 +266,10 @@ public class NewTableDialog extends MageDialog {
|
|||
.addComponent(cbAttackOption, javax.swing.GroupLayout.PREFERRED_SIZE, 177, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(cbSkillLevel, javax.swing.GroupLayout.PREFERRED_SIZE, 148, javax.swing.GroupLayout.PREFERRED_SIZE)))
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||
.addGap(18, 18, 18)
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addComponent(spnNumWins, javax.swing.GroupLayout.PREFERRED_SIZE, 50, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addComponent(lblNumWins)))
|
||||
.addComponent(lblNumWins)
|
||||
.addComponent(spnNumWins, javax.swing.GroupLayout.PREFERRED_SIZE, 50, javax.swing.GroupLayout.PREFERRED_SIZE)))
|
||||
.addComponent(jSeparator2)
|
||||
.addComponent(player1Panel, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||
.addComponent(pnlOtherPlayers, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||
|
|
@ -272,7 +278,7 @@ public class NewTableDialog extends MageDialog {
|
|||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(layout.createSequentialGroup()
|
||||
.addContainerGap()
|
||||
.addComponent(jSeparator3, javax.swing.GroupLayout.DEFAULT_SIZE, 606, Short.MAX_VALUE)
|
||||
.addComponent(jSeparator3, javax.swing.GroupLayout.DEFAULT_SIZE, 586, Short.MAX_VALUE)
|
||||
.addContainerGap()))
|
||||
);
|
||||
layout.setVerticalGroup(
|
||||
|
|
@ -294,7 +300,8 @@ public class NewTableDialog extends MageDialog {
|
|||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
||||
.addComponent(spnFreeMulligans, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addComponent(lblFreeMulligans))
|
||||
.addComponent(lblFreeMulligans)
|
||||
.addComponent(chkRollbackTurnsAllowed))
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
||||
.addComponent(cbGameType, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addComponent(lblGameType)))
|
||||
|
|
@ -305,11 +312,12 @@ public class NewTableDialog extends MageDialog {
|
|||
.addGap(0, 0, 0)
|
||||
.addComponent(spnNumPlayers, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
|
||||
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
||||
.addComponent(lblRange)
|
||||
.addComponent(lblAttack)
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addComponent(lblSkillLevel)
|
||||
.addComponent(lblNumWins))
|
||||
.addComponent(lblNumWins)
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
||||
.addComponent(lblRange)
|
||||
.addComponent(lblAttack)))
|
||||
.addGap(0, 0, 0)
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
||||
.addComponent(cbRange, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
|
|
@ -325,8 +333,8 @@ public class NewTableDialog extends MageDialog {
|
|||
.addGap(16, 16, 16)
|
||||
.addComponent(jLabel2)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(pnlOtherPlayers, javax.swing.GroupLayout.DEFAULT_SIZE, 113, Short.MAX_VALUE)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 13, Short.MAX_VALUE)
|
||||
.addComponent(pnlOtherPlayers, javax.swing.GroupLayout.DEFAULT_SIZE, 105, Short.MAX_VALUE)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 7, Short.MAX_VALUE)
|
||||
.addComponent(jSeparator1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
||||
|
|
@ -337,7 +345,7 @@ public class NewTableDialog extends MageDialog {
|
|||
.addGroup(layout.createSequentialGroup()
|
||||
.addGap(201, 201, 201)
|
||||
.addComponent(jSeparator3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addContainerGap(178, Short.MAX_VALUE)))
|
||||
.addContainerGap(167, Short.MAX_VALUE)))
|
||||
);
|
||||
|
||||
pack();
|
||||
|
|
@ -363,6 +371,7 @@ public class NewTableDialog extends MageDialog {
|
|||
options.setSkillLevel((SkillLevel) this.cbSkillLevel.getSelectedItem());
|
||||
options.setRange((RangeOfInfluence) this.cbRange.getSelectedItem());
|
||||
options.setWinsNeeded((Integer)this.spnNumWins.getValue());
|
||||
options.setRollbackTurnsAllowed(chkRollbackTurnsAllowed.isSelected());
|
||||
options.setFreeMulligans((Integer)this.spnFreeMulligans.getValue());
|
||||
options.setPassword(this.txtPassword.getText());
|
||||
if (!checkMatchOptions(options)) {
|
||||
|
|
@ -597,6 +606,9 @@ public class NewTableDialog extends MageDialog {
|
|||
this.player1Panel.setDeckFile(deckFile);
|
||||
}
|
||||
this.spnNumWins.setValue(Integer.parseInt(PreferencesDialog.getCachedValue(PreferencesDialog.KEY_NEW_TABLE_NUMBER_OF_WINS, "2")));
|
||||
this.chkRollbackTurnsAllowed.setSelected(PreferencesDialog.getCachedValue(PreferencesDialog.KEY_NEW_TABLE_ROLLBACK_TURNS_ALLOWED, "Yes").equals("Yes"));
|
||||
|
||||
|
||||
int range = Integer.parseInt(PreferencesDialog.getCachedValue(PreferencesDialog.KEY_NEW_TABLE_RANGE, "1"));
|
||||
for (RangeOfInfluence roi :RangeOfInfluence.values()) {
|
||||
if (roi.getRange() == range) {
|
||||
|
|
@ -633,6 +645,8 @@ public class NewTableDialog extends MageDialog {
|
|||
PreferencesDialog.saveValue(PreferencesDialog.KEY_NEW_TABLE_TIME_LIMIT, Integer.toString(options.getPriorityTime()));
|
||||
PreferencesDialog.saveValue(PreferencesDialog.KEY_NEW_TABLE_GAME_TYPE, options.getGameType());
|
||||
PreferencesDialog.saveValue(PreferencesDialog.KEY_NEW_TABLE_NUMBER_OF_WINS, Integer.toString(options.getWinsNeeded()));
|
||||
PreferencesDialog.saveValue(PreferencesDialog.KEY_NEW_TABLE_ROLLBACK_TURNS_ALLOWED, options.isRollbackTurnsAllowed() ? "Yes": "No");
|
||||
PreferencesDialog.saveValue(PreferencesDialog.KEY_NEW_TABLE_NUMBER_OF_FREE_MULLIGANS, Integer.toString(options.getFreeMulligans()));
|
||||
PreferencesDialog.saveValue(PreferencesDialog.KEY_NEW_TABLE_DECK_FILE, deckFile);
|
||||
PreferencesDialog.saveValue(PreferencesDialog.KEY_NEW_TABLE_NUMBER_PLAYERS, spnNumPlayers.getValue().toString());
|
||||
PreferencesDialog.saveValue(PreferencesDialog.KEY_NEW_TABLE_RANGE, Integer.toString(options.getRange().getRange()));
|
||||
|
|
@ -659,6 +673,7 @@ public class NewTableDialog extends MageDialog {
|
|||
private javax.swing.JComboBox cbRange;
|
||||
private javax.swing.JComboBox cbSkillLevel;
|
||||
private javax.swing.JComboBox cbTimeLimit;
|
||||
private javax.swing.JCheckBox chkRollbackTurnsAllowed;
|
||||
private javax.swing.JLabel jLabel1;
|
||||
private javax.swing.JLabel jLabel2;
|
||||
private javax.swing.JSeparator jSeparator1;
|
||||
|
|
|
|||
|
|
@ -51,7 +51,11 @@
|
|||
</Group>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Component id="spnConstructTime" min="-2" pref="50" max="-2" attributes="0"/>
|
||||
<Group type="102" attributes="0">
|
||||
<Component id="spnConstructTime" min="-2" pref="50" max="-2" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="chkRollbackTurnsAllowed" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<Group type="102" attributes="0">
|
||||
<Component id="spnNumRounds" min="-2" pref="50" max="-2" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
|
|
@ -67,52 +71,49 @@
|
|||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="btnCancel" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<Group type="102" alignment="1" attributes="0">
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Group type="102" alignment="0" attributes="0">
|
||||
<Group type="103" groupAlignment="1" attributes="0">
|
||||
<Component id="lblDraftCube" max="-2" attributes="0"/>
|
||||
<Component id="lblTournamentType" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="lbDeckType" max="-2" attributes="0"/>
|
||||
<Component id="lblGameType" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Component id="cbDraftCube" min="-2" pref="290" max="-2" attributes="0"/>
|
||||
<Component id="cbDeckType" alignment="0" min="-2" pref="290" max="-2" attributes="1"/>
|
||||
<Component id="cbGameType" min="-2" pref="290" max="-2" attributes="1"/>
|
||||
<Group type="102" alignment="0" attributes="0">
|
||||
<Component id="cbTournamentType" min="-2" pref="290" max="-2" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="lblFreeMulligans" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="spnFreeMulligans" min="-2" pref="41" max="-2" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="lblNumWins" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="spnNumWins" min="-2" pref="50" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
<Group type="103" alignment="1" groupAlignment="0" attributes="0">
|
||||
<Group type="102" alignment="0" attributes="0">
|
||||
<Group type="103" groupAlignment="1" attributes="0">
|
||||
<Component id="lblDraftCube" max="-2" attributes="0"/>
|
||||
<Component id="lblTournamentType" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="lbDeckType" max="-2" attributes="0"/>
|
||||
<Component id="lblGameType" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<Group type="102" alignment="0" attributes="0">
|
||||
<Component id="lblName" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="txtName" min="-2" pref="124" max="-2" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="lbTimeLimit" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="cbTimeLimit" min="-2" pref="89" max="-2" attributes="1"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="lbSkillLevel" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="cbSkillLevel" min="-2" pref="112" max="-2" attributes="1"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="lblPassword" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="txtPassword" min="-2" pref="56" max="-2" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Component id="cbDraftCube" min="-2" pref="290" max="-2" attributes="0"/>
|
||||
<Component id="cbDeckType" alignment="0" min="-2" pref="290" max="-2" attributes="1"/>
|
||||
<Component id="cbGameType" min="-2" pref="290" max="-2" attributes="1"/>
|
||||
<Group type="102" alignment="0" attributes="0">
|
||||
<Component id="cbTournamentType" min="-2" pref="290" max="-2" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="lblFreeMulligans" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="spnFreeMulligans" min="-2" pref="41" max="-2" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="lblNumWins" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="spnNumWins" min="-2" pref="50" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
</Group>
|
||||
<EmptySpace min="0" pref="0" max="-2" attributes="0"/>
|
||||
<Group type="102" alignment="0" attributes="0">
|
||||
<Component id="lblName" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="txtName" min="-2" pref="124" max="-2" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="lbTimeLimit" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="cbTimeLimit" min="-2" pref="101" max="-2" attributes="1"/>
|
||||
<EmptySpace type="unrelated" max="-2" attributes="0"/>
|
||||
<Component id="lbSkillLevel" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace type="unrelated" max="-2" attributes="0"/>
|
||||
<Component id="cbSkillLevel" min="-2" pref="88" max="-2" attributes="1"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="lblPassword" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="txtPassword" min="-2" pref="56" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
</Group>
|
||||
</Group>
|
||||
|
|
@ -183,10 +184,11 @@
|
|||
<Group type="103" groupAlignment="3" attributes="0">
|
||||
<Component id="spnConstructTime" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="lblConstructionTime" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="chkRollbackTurnsAllowed" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="player1Panel" pref="62" max="32767" attributes="0"/>
|
||||
<Component id="player1Panel" pref="64" max="32767" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="pnlPlayers" max="32767" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
|
|
@ -440,6 +442,12 @@
|
|||
<Property name="text" type="java.lang.String" value="Construction Time (Minutes):"/>
|
||||
</Properties>
|
||||
</Component>
|
||||
<Component class="javax.swing.JCheckBox" name="chkRollbackTurnsAllowed">
|
||||
<Properties>
|
||||
<Property name="text" type="java.lang.String" value="Allow rollbacks"/>
|
||||
<Property name="toolTipText" type="java.lang.String" value="<HTML>Allow to rollback to the start of previous turns<br> if all players agree. "/>
|
||||
</Properties>
|
||||
</Component>
|
||||
<Component class="javax.swing.JSpinner" name="spnConstructTime">
|
||||
<Properties>
|
||||
<Property name="toolTipText" type="java.lang.String" value="The time players have to build their deck."/>
|
||||
|
|
@ -462,7 +470,7 @@
|
|||
</DimensionLayout>
|
||||
<DimensionLayout dim="1">
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Component id="pnlOtherPlayers" alignment="0" pref="5" max="32767" attributes="0"/>
|
||||
<Component id="pnlOtherPlayers" alignment="0" pref="7" max="32767" attributes="0"/>
|
||||
</Group>
|
||||
</DimensionLayout>
|
||||
</Layout>
|
||||
|
|
|
|||
|
|
@ -164,6 +164,7 @@ public class NewTournamentDialog extends MageDialog {
|
|||
cbAllowSpectators = new javax.swing.JCheckBox();
|
||||
lblPlayer1 = new javax.swing.JLabel();
|
||||
lblConstructionTime = new javax.swing.JLabel();
|
||||
chkRollbackTurnsAllowed = new javax.swing.JCheckBox();
|
||||
spnConstructTime = new javax.swing.JSpinner();
|
||||
player1Panel = new mage.client.table.NewPlayerPanel();
|
||||
pnlPlayers = new javax.swing.JPanel();
|
||||
|
|
@ -297,6 +298,9 @@ public class NewTournamentDialog extends MageDialog {
|
|||
|
||||
lblConstructionTime.setText("Construction Time (Minutes):");
|
||||
|
||||
chkRollbackTurnsAllowed.setText("Allow rollbacks");
|
||||
chkRollbackTurnsAllowed.setToolTipText("<HTML>Allow to rollback to the start of previous turns<br> if all players agree. ");
|
||||
|
||||
spnConstructTime.setToolTipText("The time players have to build their deck.");
|
||||
|
||||
player1Panel.setPreferredSize(new java.awt.Dimension(400, 44));
|
||||
|
|
@ -312,7 +316,7 @@ public class NewTournamentDialog extends MageDialog {
|
|||
);
|
||||
pnlPlayersLayout.setVerticalGroup(
|
||||
pnlPlayersLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addComponent(pnlOtherPlayers, javax.swing.GroupLayout.DEFAULT_SIZE, 5, Short.MAX_VALUE)
|
||||
.addComponent(pnlOtherPlayers, javax.swing.GroupLayout.DEFAULT_SIZE, 7, Short.MAX_VALUE)
|
||||
);
|
||||
|
||||
btnOk.setText("OK");
|
||||
|
|
@ -357,7 +361,10 @@ public class NewTournamentDialog extends MageDialog {
|
|||
.addComponent(lblConstructionTime)))
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addComponent(spnConstructTime, javax.swing.GroupLayout.PREFERRED_SIZE, 50, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addGroup(layout.createSequentialGroup()
|
||||
.addComponent(spnConstructTime, javax.swing.GroupLayout.PREFERRED_SIZE, 50, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(chkRollbackTurnsAllowed))
|
||||
.addGroup(layout.createSequentialGroup()
|
||||
.addComponent(spnNumRounds, javax.swing.GroupLayout.PREFERRED_SIZE, 50, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
|
|
@ -369,46 +376,44 @@ public class NewTournamentDialog extends MageDialog {
|
|||
.addComponent(btnOk)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(btnCancel))
|
||||
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(layout.createSequentialGroup()
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
|
||||
.addComponent(lblDraftCube)
|
||||
.addComponent(lblTournamentType)
|
||||
.addComponent(lbDeckType)
|
||||
.addComponent(lblGameType))
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addComponent(cbDraftCube, javax.swing.GroupLayout.PREFERRED_SIZE, 290, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addComponent(cbDeckType, javax.swing.GroupLayout.PREFERRED_SIZE, 290, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addComponent(cbGameType, javax.swing.GroupLayout.PREFERRED_SIZE, 290, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addGroup(layout.createSequentialGroup()
|
||||
.addComponent(cbTournamentType, javax.swing.GroupLayout.PREFERRED_SIZE, 290, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(lblFreeMulligans)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(spnFreeMulligans, javax.swing.GroupLayout.PREFERRED_SIZE, 41, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(lblNumWins)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(spnNumWins, javax.swing.GroupLayout.PREFERRED_SIZE, 50, javax.swing.GroupLayout.PREFERRED_SIZE))))
|
||||
.addGroup(layout.createSequentialGroup()
|
||||
.addComponent(lblName)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(txtName, javax.swing.GroupLayout.PREFERRED_SIZE, 124, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(lbTimeLimit)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(cbTimeLimit, javax.swing.GroupLayout.PREFERRED_SIZE, 89, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(lbSkillLevel)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(cbSkillLevel, javax.swing.GroupLayout.PREFERRED_SIZE, 112, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(lblPassword)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(txtPassword, javax.swing.GroupLayout.PREFERRED_SIZE, 56, javax.swing.GroupLayout.PREFERRED_SIZE)))
|
||||
.addGap(0, 0, 0))))
|
||||
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(layout.createSequentialGroup()
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
|
||||
.addComponent(lblDraftCube)
|
||||
.addComponent(lblTournamentType)
|
||||
.addComponent(lbDeckType)
|
||||
.addComponent(lblGameType))
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addComponent(cbDraftCube, javax.swing.GroupLayout.PREFERRED_SIZE, 290, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addComponent(cbDeckType, javax.swing.GroupLayout.PREFERRED_SIZE, 290, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addComponent(cbGameType, javax.swing.GroupLayout.PREFERRED_SIZE, 290, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addGroup(layout.createSequentialGroup()
|
||||
.addComponent(cbTournamentType, javax.swing.GroupLayout.PREFERRED_SIZE, 290, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(lblFreeMulligans)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(spnFreeMulligans, javax.swing.GroupLayout.PREFERRED_SIZE, 41, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(lblNumWins)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(spnNumWins, javax.swing.GroupLayout.PREFERRED_SIZE, 50, javax.swing.GroupLayout.PREFERRED_SIZE))))
|
||||
.addGroup(layout.createSequentialGroup()
|
||||
.addComponent(lblName)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(txtName, javax.swing.GroupLayout.PREFERRED_SIZE, 124, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(lbTimeLimit)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(cbTimeLimit, javax.swing.GroupLayout.PREFERRED_SIZE, 101, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
|
||||
.addComponent(lbSkillLevel)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
|
||||
.addComponent(cbSkillLevel, javax.swing.GroupLayout.PREFERRED_SIZE, 88, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(lblPassword)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(txtPassword, javax.swing.GroupLayout.PREFERRED_SIZE, 56, javax.swing.GroupLayout.PREFERRED_SIZE)))))
|
||||
.addComponent(player1Panel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
|
||||
.addContainerGap())
|
||||
);
|
||||
|
|
@ -464,9 +469,10 @@ public class NewTournamentDialog extends MageDialog {
|
|||
.addComponent(lblPlayer1, javax.swing.GroupLayout.PREFERRED_SIZE, 25, javax.swing.GroupLayout.PREFERRED_SIZE))
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
||||
.addComponent(spnConstructTime, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addComponent(lblConstructionTime)))
|
||||
.addComponent(lblConstructionTime)
|
||||
.addComponent(chkRollbackTurnsAllowed)))
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(player1Panel, javax.swing.GroupLayout.DEFAULT_SIZE, 62, Short.MAX_VALUE)
|
||||
.addComponent(player1Panel, javax.swing.GroupLayout.DEFAULT_SIZE, 64, Short.MAX_VALUE)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(pnlPlayers, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
|
|
@ -535,6 +541,7 @@ public class NewTournamentDialog extends MageDialog {
|
|||
tOptions.getMatchOptions().setFreeMulligans((Integer)this.spnFreeMulligans.getValue());
|
||||
tOptions.getMatchOptions().setAttackOption(MultiplayerAttackOption.LEFT);
|
||||
tOptions.getMatchOptions().setRange(RangeOfInfluence.ALL);
|
||||
tOptions.getMatchOptions().setRollbackTurnsAllowed(this.chkRollbackTurnsAllowed.isSelected());
|
||||
saveTournamentSettingsToPrefs(tOptions);
|
||||
|
||||
table = session.createTournamentTable(roomId, tOptions);
|
||||
|
|
@ -834,6 +841,7 @@ public class NewTournamentDialog extends MageDialog {
|
|||
}
|
||||
}
|
||||
this.cbAllowSpectators.setSelected(PreferencesDialog.getCachedValue(PreferencesDialog.KEY_NEW_TOURNAMENT_ALLOW_SPECTATORS, "Yes").equals("Yes"));
|
||||
this.chkRollbackTurnsAllowed.setSelected(PreferencesDialog.getCachedValue(PreferencesDialog.KEY_NEW_TOURNAMENT_ALLOW_ROLLBACKS, "Yes").equals("Yes"));
|
||||
}
|
||||
|
||||
private void loadBoosterPacks(String packString) {
|
||||
|
|
@ -896,6 +904,7 @@ public class NewTournamentDialog extends MageDialog {
|
|||
}
|
||||
}
|
||||
PreferencesDialog.saveValue(PreferencesDialog.KEY_NEW_TOURNAMENT_ALLOW_SPECTATORS, (tOptions.isWatchingAllowed()?"Yes":"No"));
|
||||
PreferencesDialog.saveValue(PreferencesDialog.KEY_NEW_TOURNAMENT_ALLOW_ROLLBACKS, (tOptions.getMatchOptions().isRollbackTurnsAllowed()?"Yes":"No"));
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -915,6 +924,7 @@ public class NewTournamentDialog extends MageDialog {
|
|||
private javax.swing.JComboBox cbSkillLevel;
|
||||
private javax.swing.JComboBox cbTimeLimit;
|
||||
private javax.swing.JComboBox cbTournamentType;
|
||||
private javax.swing.JCheckBox chkRollbackTurnsAllowed;
|
||||
private javax.swing.JLabel jLabel6;
|
||||
private javax.swing.JLabel lbDeckType;
|
||||
private javax.swing.JLabel lbSkillLevel;
|
||||
|
|
|
|||
|
|
@ -162,6 +162,7 @@ public class PreferencesDialog extends javax.swing.JDialog {
|
|||
public static final String KEY_NEW_TABLE_TIME_LIMIT = "newTableTimeLimit";
|
||||
public static final String KEY_NEW_TABLE_GAME_TYPE = "newTableGameType";
|
||||
public static final String KEY_NEW_TABLE_NUMBER_OF_WINS = "newTableNumberOfWins";
|
||||
public static final String KEY_NEW_TABLE_ROLLBACK_TURNS_ALLOWED = "newTableRollbackTurnsAllowed";
|
||||
public static final String KEY_NEW_TABLE_NUMBER_OF_FREE_MULLIGANS = "newTableNumberOfFreeMulligans";
|
||||
public static final String KEY_NEW_TABLE_DECK_FILE = "newTableDeckFile";
|
||||
public static final String KEY_NEW_TABLE_RANGE = "newTableRange";
|
||||
|
|
@ -184,6 +185,7 @@ public class PreferencesDialog extends javax.swing.JDialog {
|
|||
public static final String KEY_NEW_TOURNAMENT_PLAYERS_DRAFT = "newTournamentPlayersDraft";
|
||||
public static final String KEY_NEW_TOURNAMENT_DRAFT_TIMING = "newTournamentDraftTiming";
|
||||
public static final String KEY_NEW_TOURNAMENT_ALLOW_SPECTATORS = "newTournamentAllowSpectators";
|
||||
public static final String KEY_NEW_TOURNAMENT_ALLOW_ROLLBACKS = "newTournamentAllowRollbacks";
|
||||
public static final String KEY_NEW_TOURNAMENT_DECK_FILE = "newTournamentDeckFile";
|
||||
|
||||
// pref setting for deck generator
|
||||
|
|
|
|||
|
|
@ -177,12 +177,8 @@ public class UserRequestDialog extends MageDialog {
|
|||
|
||||
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
|
||||
if (session != null && playerAction != null) {
|
||||
session.sendPlayerAction(playerAction, userRequestMessage.getGameId(), userRequestMessage.getRelatedUserId());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -483,7 +483,8 @@ public final class GamePanel extends javax.swing.JPanel {
|
|||
}
|
||||
}
|
||||
PlayerView player = game.getPlayers().get(playerSeat);
|
||||
PlayAreaPanel sessionPlayer = new PlayAreaPanel(player, bigCard, gameId, true, game.getPriorityTime(), game.isPlayer(), this);
|
||||
PlayAreaPanel sessionPlayer = new PlayAreaPanel(player, bigCard, gameId, game.getPriorityTime(), this,
|
||||
new PlayAreaPanelOptions(game.isPlayer(), true, game.isRollbackTurnsAllowed()));
|
||||
players.put(player.getPlayerId(), sessionPlayer);
|
||||
GridBagConstraints c = new GridBagConstraints();
|
||||
c.fill = GridBagConstraints.BOTH;
|
||||
|
|
@ -515,7 +516,8 @@ public final class GamePanel extends javax.swing.JPanel {
|
|||
col = numColumns - 1;
|
||||
}
|
||||
player = game.getPlayers().get(playerNum);
|
||||
PlayAreaPanel playerPanel = new PlayAreaPanel(player, bigCard, gameId, false, game.getPriorityTime(), game.isPlayer(), this);
|
||||
PlayAreaPanel playerPanel = new PlayAreaPanel(player, bigCard, gameId, game.getPriorityTime(), this,
|
||||
new PlayAreaPanelOptions(game.isPlayer(), false, game.isRollbackTurnsAllowed()));
|
||||
players.put(player.getPlayerId(), playerPanel);
|
||||
c = new GridBagConstraints();
|
||||
c.fill = GridBagConstraints.BOTH;
|
||||
|
|
|
|||
|
|
@ -42,6 +42,7 @@ import javax.swing.BorderFactory;
|
|||
import javax.swing.GroupLayout;
|
||||
import javax.swing.GroupLayout.Alignment;
|
||||
import javax.swing.JCheckBoxMenuItem;
|
||||
import javax.swing.JMenu;
|
||||
import javax.swing.JMenuItem;
|
||||
import javax.swing.JOptionPane;
|
||||
import javax.swing.JPopupMenu;
|
||||
|
|
@ -69,8 +70,8 @@ public class PlayAreaPanel extends javax.swing.JPanel {
|
|||
private boolean smallMode = false;
|
||||
private boolean playingMode = true;
|
||||
private final GamePanel gamePanel;
|
||||
private final boolean playerItself;
|
||||
|
||||
private final PlayAreaPanelOptions options;
|
||||
|
||||
private JCheckBoxMenuItem manaPoolMenuItem;
|
||||
private JCheckBoxMenuItem allowViewHandCardsMenuItem;
|
||||
|
||||
|
|
@ -81,19 +82,18 @@ public class PlayAreaPanel extends javax.swing.JPanel {
|
|||
* @param player
|
||||
* @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;
|
||||
* @param gamePanel
|
||||
* @param options
|
||||
*/
|
||||
public PlayAreaPanel(PlayerView player, BigCard bigCard, UUID gameId, int priorityTime, GamePanel gamePanel, PlayAreaPanelOptions options) {
|
||||
this.options = options;
|
||||
initComponents();
|
||||
setOpaque(false);
|
||||
battlefieldPanel.setOpaque(false);
|
||||
|
||||
popupMenu = new JPopupMenu();
|
||||
if (isPlayer) {
|
||||
if (options.isPlayer) {
|
||||
addPopupMenuPlayer(player.getUserData().allowRequestShowHandCards());
|
||||
} else {
|
||||
addPopupMenuWatcher();
|
||||
|
|
@ -242,7 +242,7 @@ public class PlayAreaPanel extends javax.swing.JPanel {
|
|||
|
||||
popupMenu.addSeparator();
|
||||
|
||||
if (!playerItself) {
|
||||
if (!options.playerItself) {
|
||||
menuItem = new JMenuItem("Request permission to see hand cards");
|
||||
popupMenu.add(menuItem);
|
||||
|
||||
|
|
@ -283,6 +283,63 @@ public class PlayAreaPanel extends javax.swing.JPanel {
|
|||
});
|
||||
}
|
||||
popupMenu.addSeparator();
|
||||
|
||||
if (options.rollbackTurnsAllowed) {
|
||||
ActionListener rollBackActionListener = new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
int turnsToRollBack = Integer.parseInt(e.getActionCommand());
|
||||
gamePanel.getSession().sendPlayerAction(PlayerAction.ROLLBACK_TURNS, gameId, turnsToRollBack);
|
||||
}
|
||||
};
|
||||
|
||||
JMenu rollbackMainItem = new JMenu("Roll back");
|
||||
rollbackMainItem.setMnemonic(KeyEvent.VK_R);
|
||||
rollbackMainItem.setToolTipText("The game will be rolled back to the start of the requested turn if all players agree.");
|
||||
popupMenu.add(rollbackMainItem);
|
||||
|
||||
menuItem = new JMenuItem("to the start of the current turn");
|
||||
menuItem.setMnemonic(KeyEvent.VK_C);
|
||||
menuItem.setActionCommand("0");
|
||||
menuItem.addActionListener(rollBackActionListener);
|
||||
rollbackMainItem.add(menuItem);
|
||||
|
||||
menuItem = new JMenuItem("to the start of the previous turn");
|
||||
menuItem.setMnemonic(KeyEvent.VK_P);
|
||||
menuItem.setActionCommand("1");
|
||||
menuItem.addActionListener(rollBackActionListener);
|
||||
rollbackMainItem.add(menuItem);
|
||||
|
||||
menuItem = new JMenuItem("the current turn and the 2 turns before");
|
||||
menuItem.setMnemonic(KeyEvent.VK_2);
|
||||
menuItem.setActionCommand("2");
|
||||
menuItem.addActionListener(rollBackActionListener);
|
||||
rollbackMainItem.add(menuItem);
|
||||
|
||||
menuItem = new JMenuItem("the current turn and the 3 turns before");
|
||||
menuItem.setMnemonic(KeyEvent.VK_3);
|
||||
menuItem.setActionCommand("3");
|
||||
menuItem.addActionListener(rollBackActionListener);
|
||||
rollbackMainItem.add(menuItem);
|
||||
|
||||
popupMenu.addSeparator();
|
||||
|
||||
}
|
||||
|
||||
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");
|
||||
popupMenu.add(menuItem);
|
||||
|
|
|
|||
|
|
@ -0,0 +1,58 @@
|
|||
/*
|
||||
* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification, are
|
||||
* permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice, this list of
|
||||
* conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
|
||||
* of conditions and the following disclaimer in the documentation and/or other materials
|
||||
* provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
||||
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* The views and conclusions contained in the software and documentation are those of the
|
||||
* authors and should not be interpreted as representing official policies, either expressed
|
||||
* or implied, of BetaSteward_at_googlemail.com.
|
||||
*/
|
||||
package mage.client.game;
|
||||
|
||||
/**
|
||||
* Defines some options for the PlayAreaPanel
|
||||
*
|
||||
* @author LevelX2
|
||||
*/
|
||||
public class PlayAreaPanelOptions {
|
||||
|
||||
public PlayAreaPanelOptions(boolean isPlayer, boolean playerItself, boolean rollbackTurnsAllowed) {
|
||||
this.isPlayer = isPlayer;
|
||||
this.playerItself = playerItself;
|
||||
this.rollbackTurnsAllowed = rollbackTurnsAllowed;
|
||||
}
|
||||
|
||||
/**
|
||||
* true if the client is a player / false if the client is a watcher
|
||||
*/
|
||||
public boolean isPlayer = false;
|
||||
|
||||
/**
|
||||
* true if the player is the client player itself, false if the player is another player playing with the clinet player
|
||||
*/
|
||||
public boolean playerItself = false;
|
||||
|
||||
/**
|
||||
* true if the player can roll back turns if all players agree
|
||||
*/
|
||||
public boolean rollbackTurnsAllowed = false;
|
||||
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue