This commit is contained in:
BetaSteward 2010-05-02 15:07:05 +00:00
parent b1958d9761
commit cefc8a5963
4 changed files with 40 additions and 12 deletions

View file

@ -22,7 +22,9 @@
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="1" attributes="0">
<EmptySpace pref="106" max="32767" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="btnSpecial" min="-2" max="-2" attributes="0"/>
<EmptySpace pref="31" max="32767" attributes="0"/>
<Component id="btnLeft" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="btnRight" min="-2" max="-2" attributes="0"/>
@ -38,6 +40,7 @@
<Group type="103" groupAlignment="3" attributes="0">
<Component id="btnRight" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="btnLeft" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="btnSpecial" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
</Group>
</Group>
@ -92,5 +95,13 @@
</Component>
</SubComponents>
</Container>
<Component class="javax.swing.JButton" name="btnSpecial">
<Properties>
<Property name="text" type="java.lang.String" value="Special"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="btnSpecialActionPerformed"/>
</Events>
</Component>
</SubComponents>
</Form>

View file

@ -75,7 +75,7 @@ public class FeedbackPanel extends javax.swing.JPanel {
session = MageFrame.getSession();
}
public void getFeedback(FeedbackMode mode, String message, boolean modal) {
public void getFeedback(FeedbackMode mode, String message, boolean modal, boolean special) {
this.lblMessage.setText(message);
this.selected = false;
this.mode = mode;
@ -107,6 +107,7 @@ public class FeedbackPanel extends javax.swing.JPanel {
this.btnRight.setText("Done");
break;
}
this.btnSpecial.setVisible(special);
if (modal)
startModal();
this.revalidate();
@ -176,6 +177,7 @@ public class FeedbackPanel extends javax.swing.JPanel {
btnLeft = new javax.swing.JButton();
jScrollPane1 = new javax.swing.JScrollPane();
lblMessage = new javax.swing.JTextArea();
btnSpecial = new javax.swing.JButton();
setBackground(new java.awt.Color(204, 204, 204));
@ -205,12 +207,21 @@ public class FeedbackPanel extends javax.swing.JPanel {
lblMessage.setBorder(null);
jScrollPane1.setViewportView(lblMessage);
btnSpecial.setText("Special");
btnSpecial.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
btnSpecialActionPerformed(evt);
}
});
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
this.setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
.addContainerGap(106, Short.MAX_VALUE)
.addContainerGap()
.addComponent(btnSpecial)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 31, Short.MAX_VALUE)
.addComponent(btnLeft)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(btnRight))
@ -223,7 +234,8 @@ public class FeedbackPanel extends javax.swing.JPanel {
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(btnRight)
.addComponent(btnLeft)))
.addComponent(btnLeft)
.addComponent(btnSpecial)))
);
}// </editor-fold>//GEN-END:initComponents
@ -242,10 +254,15 @@ public class FeedbackPanel extends javax.swing.JPanel {
session.sendPlayerBoolean(gameId, true);
}//GEN-LAST:event_btnLeftActionPerformed
private void btnSpecialActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnSpecialActionPerformed
session.sendPlayerString(gameId, "special");
}//GEN-LAST:event_btnSpecialActionPerformed
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JButton btnLeft;
private javax.swing.JButton btnRight;
private javax.swing.JButton btnSpecial;
private javax.swing.JScrollPane jScrollPane1;
private javax.swing.JTextArea lblMessage;
// End of variables declaration//GEN-END:variables

View file

@ -63,7 +63,7 @@
<EmptySpace min="-2" pref="0" max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="pnlHand" max="32767" attributes="0"/>
<Component id="pnlBattlefield" alignment="0" pref="665" max="32767" attributes="0"/>
<Component id="pnlBattlefield" alignment="0" pref="715" max="32767" attributes="0"/>
</Group>
</Group>
</Group>
@ -399,7 +399,7 @@
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<Component id="hand" alignment="1" pref="661" max="32767" attributes="0"/>
<Component id="hand" alignment="1" pref="711" max="32767" attributes="0"/>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">

View file

@ -183,7 +183,7 @@ public class GamePanel extends javax.swing.JPanel {
}
public void ask(String question) {
this.feedbackPanel.getFeedback(FeedbackMode.QUESTION, question, true);
this.feedbackPanel.getFeedback(FeedbackMode.QUESTION, question, true, false);
}
public void inform(String information, CardsView cardView, GameView gameView) {
@ -191,7 +191,7 @@ public class GamePanel extends javax.swing.JPanel {
if (cardView != null && cardView.size() > 0) {
showCards(information, cardView);
}
this.feedbackPanel.getFeedback(FeedbackMode.INFORM, information, false);
this.feedbackPanel.getFeedback(FeedbackMode.INFORM, information, false, gameView.getSpecial());
}
public void cancel(String message, CardsView cardView, GameView gameView) {
@ -199,7 +199,7 @@ public class GamePanel extends javax.swing.JPanel {
if (cardView != null && cardView.size() > 0) {
showCards(message, cardView);
}
this.feedbackPanel.getFeedback(FeedbackMode.CANCEL, message, false);
this.feedbackPanel.getFeedback(FeedbackMode.CANCEL, message, false, gameView.getSpecial());
}
public void modalMessage(String message) {
@ -216,17 +216,17 @@ public class GamePanel extends javax.swing.JPanel {
public void select(String message, GameView gameView) {
updateGame(gameView);
this.feedbackPanel.getFeedback(FeedbackMode.SELECT, message, false);
this.feedbackPanel.getFeedback(FeedbackMode.SELECT, message, false, gameView.getSpecial());
}
public void playMana(String message, GameView gameView) {
updateGame(gameView);
this.feedbackPanel.getFeedback(FeedbackMode.CANCEL, message, false);
this.feedbackPanel.getFeedback(FeedbackMode.CANCEL, message, false, gameView.getSpecial());
}
public void playXMana(String message, GameView gameView) {
updateGame(gameView);
this.feedbackPanel.getFeedback(FeedbackMode.CONFIRM, message, false);
this.feedbackPanel.getFeedback(FeedbackMode.CONFIRM, message, false, gameView.getSpecial());
}
public void replayMessage(String message) {