mirror of
https://github.com/magefree/mage.git
synced 2025-12-25 13:02:06 -08:00
Continuing implementation of Planechase.
This commit is contained in:
parent
dbbc5f255c
commit
c8b741f0bf
13 changed files with 77 additions and 25 deletions
|
|
@ -44,6 +44,8 @@
|
|||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="chkSpectatorsAllowed" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace min="-2" pref="13" max="-2" attributes="0"/>
|
||||
<Component id="chkPlaneChase" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace min="-2" pref="13" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<Group type="102" attributes="0">
|
||||
<Component id="txtName" min="-2" pref="178" max="-2" attributes="0"/>
|
||||
|
|
@ -156,6 +158,7 @@
|
|||
<Component id="lblFreeMulligans" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="chkRollbackTurnsAllowed" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="chkSpectatorsAllowed" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="chkPlaneChase" 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"/>
|
||||
|
|
@ -284,6 +287,12 @@
|
|||
<Property name="toolTipText" type="java.lang.String" value="Allow spectators to view your game."/>
|
||||
</Properties>
|
||||
</Component>
|
||||
<Component class="javax.swing.JCheckBox" name="chkPlaneChase">
|
||||
<Properties>
|
||||
<Property name="text" type="java.lang.String" value="Use PlaneChase"/>
|
||||
<Property name="toolTipText" type="java.lang.String" value="Use the PlaneChase variant for your game."/>
|
||||
</Properties>
|
||||
</Component>
|
||||
|
||||
<Component class="javax.swing.JSpinner" name="spnFreeMulligans">
|
||||
</Component>
|
||||
|
|
|
|||
|
|
@ -102,6 +102,7 @@ public class NewTableDialog extends MageDialog {
|
|||
cbGameType = new javax.swing.JComboBox();
|
||||
chkRollbackTurnsAllowed = new javax.swing.JCheckBox();
|
||||
chkSpectatorsAllowed = new javax.swing.JCheckBox();
|
||||
chkPlaneChase = new javax.swing.JCheckBox();
|
||||
chkRated = new javax.swing.JCheckBox();
|
||||
lblFreeMulligans = new javax.swing.JLabel();
|
||||
spnFreeMulligans = new javax.swing.JSpinner();
|
||||
|
|
@ -154,6 +155,9 @@ public class NewTableDialog extends MageDialog {
|
|||
chkSpectatorsAllowed.setText("Allow Spectators");
|
||||
chkSpectatorsAllowed.setToolTipText("<HTML>Allow spectators to watch.\n");
|
||||
|
||||
chkPlaneChase.setText("Use PlaneChase");
|
||||
chkPlaneChase.setToolTipText("<HTML>Use planechase variant (suitable for all game types).\n");
|
||||
|
||||
chkRated.setText("Rated");
|
||||
chkRated.setToolTipText("Indicates if matches will be rated.");
|
||||
|
||||
|
|
@ -236,7 +240,9 @@ public class NewTableDialog extends MageDialog {
|
|||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(spnFreeMulligans, javax.swing.GroupLayout.PREFERRED_SIZE, 50, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addGap(13, 13, 13)
|
||||
.addComponent(chkSpectatorsAllowed))
|
||||
.addComponent(chkSpectatorsAllowed)
|
||||
.addGap(13, 13, 13)
|
||||
.addComponent(chkPlaneChase))
|
||||
.addGroup(layout.createSequentialGroup()
|
||||
.addComponent(txtName, javax.swing.GroupLayout.PREFERRED_SIZE, 178, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
|
|
@ -331,7 +337,8 @@ public class NewTableDialog extends MageDialog {
|
|||
.addComponent(spnFreeMulligans, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addComponent(lblFreeMulligans)
|
||||
.addComponent(chkRollbackTurnsAllowed)
|
||||
.addComponent(chkSpectatorsAllowed))
|
||||
.addComponent(chkSpectatorsAllowed)
|
||||
.addComponent(chkPlaneChase))
|
||||
.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)))
|
||||
|
|
@ -408,6 +415,7 @@ public class NewTableDialog extends MageDialog {
|
|||
options.setWinsNeeded((Integer) this.spnNumWins.getValue());
|
||||
options.setRollbackTurnsAllowed(chkRollbackTurnsAllowed.isSelected());
|
||||
options.setSpectatorsAllowed(chkSpectatorsAllowed.isSelected());
|
||||
options.setPlaneChase(chkPlaneChase.isSelected());
|
||||
options.setRated(chkRated.isSelected());
|
||||
options.setFreeMulligans((Integer) this.spnFreeMulligans.getValue());
|
||||
options.setPassword(this.txtPassword.getText());
|
||||
|
|
@ -671,6 +679,7 @@ public class NewTableDialog extends MageDialog {
|
|||
this.spnNumWins.setValue(Integer.parseInt(PreferencesDialog.getCachedValue(PreferencesDialog.KEY_NEW_TABLE_NUMBER_OF_WINS + versionStr, "2")));
|
||||
this.chkRollbackTurnsAllowed.setSelected(PreferencesDialog.getCachedValue(PreferencesDialog.KEY_NEW_TABLE_ROLLBACK_TURNS_ALLOWED + versionStr, "Yes").equals("Yes"));
|
||||
this.chkSpectatorsAllowed.setSelected(PreferencesDialog.getCachedValue(PreferencesDialog.KEY_NEW_TABLE_SPECTATORS_ALLOWED + versionStr, "Yes").equals("Yes"));
|
||||
this.chkPlaneChase.setSelected(PreferencesDialog.getCachedValue(PreferencesDialog.KEY_NEW_TABLE_PLANECHASE + versionStr, "No").equals("Yes"));
|
||||
this.chkRated.setSelected(PreferencesDialog.getCachedValue(PreferencesDialog.KEY_NEW_TABLE_RATED + versionStr, "No").equals("Yes"));
|
||||
this.spnFreeMulligans.setValue(Integer.parseInt(PreferencesDialog.getCachedValue(PreferencesDialog.KEY_NEW_TABLE_NUMBER_OF_FREE_MULLIGANS + versionStr, "0")));
|
||||
|
||||
|
|
@ -729,6 +738,7 @@ public class NewTableDialog extends MageDialog {
|
|||
PreferencesDialog.saveValue(PreferencesDialog.KEY_NEW_TABLE_ATTACK_OPTION + versionStr, options.getAttackOption().toString());
|
||||
PreferencesDialog.saveValue(PreferencesDialog.KEY_NEW_TABLE_SKILL_LEVEL + versionStr, options.getSkillLevel().toString());
|
||||
PreferencesDialog.saveValue(PreferencesDialog.KEY_NEW_TABLE_SPECTATORS_ALLOWED + versionStr, options.isSpectatorsAllowed() ? "Yes" : "No");
|
||||
PreferencesDialog.saveValue(PreferencesDialog.KEY_NEW_TABLE_PLANECHASE + versionStr, options.isPlaneChase() ? "Yes" : "No");
|
||||
PreferencesDialog.saveValue(PreferencesDialog.KEY_NEW_TABLE_QUIT_RATIO + versionStr, Integer.toString(options.getQuitRatio()));
|
||||
StringBuilder playerTypesString = new StringBuilder();
|
||||
for (Object player : players) {
|
||||
|
|
@ -754,6 +764,7 @@ public class NewTableDialog extends MageDialog {
|
|||
private javax.swing.JComboBox cbTimeLimit;
|
||||
private javax.swing.JCheckBox chkRollbackTurnsAllowed;
|
||||
private javax.swing.JCheckBox chkSpectatorsAllowed;
|
||||
private javax.swing.JCheckBox chkPlaneChase;
|
||||
private javax.swing.JCheckBox chkRated;
|
||||
private javax.swing.JLabel jLabel1;
|
||||
private javax.swing.JLabel jLabel2;
|
||||
|
|
|
|||
|
|
@ -238,6 +238,7 @@ public class PreferencesDialog extends javax.swing.JDialog {
|
|||
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_SPECTATORS_ALLOWED = "newTableSpectatorsAllowed";
|
||||
public static final String KEY_NEW_TABLE_PLANECHASE = "newTablePlaneChase";
|
||||
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";
|
||||
|
|
|
|||
|
|
@ -24,8 +24,7 @@
|
|||
* 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.util;
|
||||
|
||||
import java.util.List;
|
||||
|
|
@ -44,7 +43,7 @@ public final class CardsViewUtil {
|
|||
public static CardsView convertSimple(SimpleCardsView view) {
|
||||
CardsView cards = new CardsView();
|
||||
|
||||
for (SimpleCardView simple: view.values()) {
|
||||
for (SimpleCardView simple : view.values()) {
|
||||
CardInfo cardInfo = CardRepository.instance.findCard(simple.getExpansionSetCode(), simple.getCardNumber());
|
||||
Card card = cardInfo != null ? cardInfo.getMockCard() : null;
|
||||
if (card != null) {
|
||||
|
|
@ -54,15 +53,14 @@ public final class CardsViewUtil {
|
|||
|
||||
return cards;
|
||||
}
|
||||
|
||||
|
||||
public static CardsView convertSimple(SimpleCardsView view, Map<String, Card> loadedCards) {
|
||||
CardsView cards = new CardsView();
|
||||
|
||||
for (SimpleCardView simple: view.values()) {
|
||||
for (SimpleCardView simple : view.values()) {
|
||||
String key = simple.getExpansionSetCode() + '_' + simple.getCardNumber();
|
||||
Card card = loadedCards.get(key);
|
||||
if(card == null)
|
||||
{
|
||||
if (card == null) {
|
||||
CardInfo cardInfo = CardRepository.instance.findCard(simple.getExpansionSetCode(), simple.getCardNumber());
|
||||
card = cardInfo != null ? cardInfo.getMockCard() : null;
|
||||
loadedCards.put(key, card);
|
||||
|
|
@ -79,12 +77,15 @@ public final class CardsViewUtil {
|
|||
CardsView cards = new CardsView();
|
||||
|
||||
for (CommandObjectView commandObject : view) {
|
||||
if(commandObject instanceof EmblemView ){
|
||||
CardView cardView = new CardView((EmblemView)commandObject);
|
||||
if (commandObject instanceof EmblemView) {
|
||||
CardView cardView = new CardView((EmblemView) commandObject);
|
||||
cards.put(commandObject.getId(), cardView);
|
||||
}
|
||||
else if(commandObject instanceof CommanderView ){
|
||||
cards.put(commandObject.getId(),(CommanderView)commandObject);
|
||||
} else if (commandObject instanceof PlaneView) {
|
||||
CardView cardView = null;
|
||||
cardView = new CardView((PlaneView) commandObject);
|
||||
cards.put(commandObject.getId(), cardView);
|
||||
} else if (commandObject instanceof CommanderView) {
|
||||
cards.put(commandObject.getId(), (CommanderView) commandObject);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue