mirror of
https://github.com/correl/mage.git
synced 2024-11-28 11:09:54 +00:00
* Deactivated macro button, becuase it's not working correctly (#2147).
This commit is contained in:
parent
94994dd3ec
commit
400bbba8e1
3 changed files with 92 additions and 76 deletions
|
@ -305,7 +305,7 @@ public final class GamePanel extends javax.swing.JPanel {
|
|||
this.players.clear();
|
||||
this.playersWhoLeft.clear();
|
||||
|
||||
if (jLayeredPane!= null) {
|
||||
if (jLayeredPane != null) {
|
||||
jLayeredPane.remove(abilityPicker);
|
||||
jLayeredPane.remove(DialogManager.getManager(gameId));
|
||||
}
|
||||
|
@ -1439,8 +1439,7 @@ public final class GamePanel extends javax.swing.JPanel {
|
|||
bigCard.setBorder(new LineBorder(Color.black, 1, true));
|
||||
|
||||
int c = JComponent.WHEN_IN_FOCUSED_WINDOW;
|
||||
|
||||
|
||||
|
||||
btnToggleMacro.setContentAreaFilled(false);
|
||||
btnToggleMacro.setBorder(new EmptyBorder(BORDER_SIZE, BORDER_SIZE, BORDER_SIZE, BORDER_SIZE));
|
||||
btnToggleMacro.setIcon(new ImageIcon(ImageManagerImpl.instance.getToggleRecordMacroButtonImage()));
|
||||
|
@ -1804,24 +1803,24 @@ public final class GamePanel extends javax.swing.JPanel {
|
|||
pnlReplay.setLayout(gl_pnlReplay);
|
||||
gl_pnlReplay.setHorizontalGroup(
|
||||
gl_pnlReplay.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(gl_pnlReplay.createSequentialGroup()
|
||||
.addComponent(btnPreviousPlay, javax.swing.GroupLayout.PREFERRED_SIZE, 41, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(btnPlay, javax.swing.GroupLayout.PREFERRED_SIZE, 35, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||
.addComponent(btnStopReplay, javax.swing.GroupLayout.PREFERRED_SIZE, 38, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(btnNextPlay, javax.swing.GroupLayout.PREFERRED_SIZE, 36, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(btnSkipForward, javax.swing.GroupLayout.PREFERRED_SIZE, 39, javax.swing.GroupLayout.PREFERRED_SIZE))
|
||||
.addGroup(gl_pnlReplay.createSequentialGroup()
|
||||
.addComponent(btnPreviousPlay, javax.swing.GroupLayout.PREFERRED_SIZE, 41, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(btnPlay, javax.swing.GroupLayout.PREFERRED_SIZE, 35, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||
.addComponent(btnStopReplay, javax.swing.GroupLayout.PREFERRED_SIZE, 38, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(btnNextPlay, javax.swing.GroupLayout.PREFERRED_SIZE, 36, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(btnSkipForward, javax.swing.GroupLayout.PREFERRED_SIZE, 39, javax.swing.GroupLayout.PREFERRED_SIZE))
|
||||
);
|
||||
gl_pnlReplay.setVerticalGroup(
|
||||
gl_pnlReplay.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addComponent(btnSkipForward, 0, 0, Short.MAX_VALUE)
|
||||
.addComponent(btnNextPlay, 0, 0, Short.MAX_VALUE)
|
||||
.addComponent(btnStopReplay, 0, 0, Short.MAX_VALUE)
|
||||
.addComponent(btnPlay, 0, 0, Short.MAX_VALUE)
|
||||
.addComponent(btnPreviousPlay, javax.swing.GroupLayout.PREFERRED_SIZE, 31, Short.MAX_VALUE)
|
||||
.addComponent(btnSkipForward, 0, 0, Short.MAX_VALUE)
|
||||
.addComponent(btnNextPlay, 0, 0, Short.MAX_VALUE)
|
||||
.addComponent(btnStopReplay, 0, 0, Short.MAX_VALUE)
|
||||
.addComponent(btnPlay, 0, 0, Short.MAX_VALUE)
|
||||
.addComponent(btnPreviousPlay, javax.swing.GroupLayout.PREFERRED_SIZE, 31, Short.MAX_VALUE)
|
||||
);
|
||||
|
||||
// Game info panel (buttons on the right panel)
|
||||
|
@ -1837,9 +1836,9 @@ public final class GamePanel extends javax.swing.JPanel {
|
|||
.addComponent(btnSkipToEndStepBeforeYourTurn)
|
||||
)
|
||||
.addGroup(gl_pnlShortCuts.createSequentialGroup()
|
||||
.addComponent(btnToggleMacro)
|
||||
.addComponent(txtHoldPriority)
|
||||
.addComponent(txtSpellsCast)
|
||||
/* .addComponent(btnToggleMacro)*/
|
||||
.addComponent(btnSwitchHands)
|
||||
.addComponent(btnCancelSkip)
|
||||
.addComponent(btnConcede)
|
||||
|
@ -1935,46 +1934,46 @@ public final class GamePanel extends javax.swing.JPanel {
|
|||
javax.swing.GroupLayout gl_helperHandButtonsStackArea = new javax.swing.GroupLayout(pnlHelperHandButtonsStackArea);
|
||||
gl_helperHandButtonsStackArea.setHorizontalGroup(
|
||||
gl_helperHandButtonsStackArea.createParallelGroup(Alignment.LEADING)
|
||||
.addGroup(gl_helperHandButtonsStackArea.createSequentialGroup()
|
||||
// .addGap(0)
|
||||
.addGroup(gl_helperHandButtonsStackArea.createParallelGroup(Alignment.LEADING)
|
||||
.addGroup(gl_helperHandButtonsStackArea.createSequentialGroup()
|
||||
.addGroup(gl_helperHandButtonsStackArea.createParallelGroup(Alignment.LEADING)
|
||||
.addComponent(helper, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||
.addComponent(handContainer, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||
.addGroup(gl_helperHandButtonsStackArea.createSequentialGroup()
|
||||
// .addGap(0)
|
||||
.addGroup(gl_helperHandButtonsStackArea.createParallelGroup(Alignment.LEADING)
|
||||
.addGroup(gl_helperHandButtonsStackArea.createSequentialGroup()
|
||||
.addGroup(gl_helperHandButtonsStackArea.createParallelGroup(Alignment.LEADING)
|
||||
.addComponent(helper, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||
.addComponent(handContainer, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||
)
|
||||
.addGroup(gl_helperHandButtonsStackArea.createParallelGroup(Alignment.LEADING)
|
||||
.addComponent(pnlShortCuts, 410, GroupLayout.PREFERRED_SIZE, Short.MAX_VALUE)
|
||||
.addComponent(stackObjects, 410, GroupLayout.PREFERRED_SIZE, Short.MAX_VALUE)
|
||||
)
|
||||
)
|
||||
.addGroup(gl_helperHandButtonsStackArea.createParallelGroup(Alignment.LEADING)
|
||||
.addComponent(pnlShortCuts, 410, GroupLayout.PREFERRED_SIZE, Short.MAX_VALUE)
|
||||
.addComponent(stackObjects, 410, GroupLayout.PREFERRED_SIZE, Short.MAX_VALUE)
|
||||
)
|
||||
)
|
||||
.addGap(0)
|
||||
//.addComponent(jPhases, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||
.addGroup(gl_helperHandButtonsStackArea.createSequentialGroup()
|
||||
.addComponent(pnlBattlefield, GroupLayout.DEFAULT_SIZE, 200, Short.MAX_VALUE)
|
||||
.addComponent(phasesContainer, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
|
||||
)))
|
||||
.addGap(0)
|
||||
//.addComponent(jPhases, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||
.addGroup(gl_helperHandButtonsStackArea.createSequentialGroup()
|
||||
.addComponent(pnlBattlefield, GroupLayout.DEFAULT_SIZE, 200, Short.MAX_VALUE)
|
||||
.addComponent(phasesContainer, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
|
||||
)))
|
||||
);
|
||||
gl_helperHandButtonsStackArea.setVerticalGroup(
|
||||
gl_helperHandButtonsStackArea.createParallelGroup(Alignment.TRAILING)
|
||||
.addGroup(gl_helperHandButtonsStackArea.createSequentialGroup()
|
||||
.addGroup(gl_helperHandButtonsStackArea.createParallelGroup(Alignment.LEADING)
|
||||
.addComponent(pnlBattlefield, GroupLayout.DEFAULT_SIZE, 200, Short.MAX_VALUE)
|
||||
.addComponent(phasesContainer, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
|
||||
)
|
||||
//.addPreferredGap(ComponentPlacement.RELATED)
|
||||
.addGroup(gl_helperHandButtonsStackArea.createParallelGroup(Alignment.LEADING)
|
||||
.addGroup(gl_helperHandButtonsStackArea.createSequentialGroup()
|
||||
.addGap(2)
|
||||
.addComponent(pnlShortCuts, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
|
||||
.addComponent(stackObjects, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
|
||||
.addGroup(gl_helperHandButtonsStackArea.createSequentialGroup()
|
||||
.addGroup(gl_helperHandButtonsStackArea.createParallelGroup(Alignment.LEADING)
|
||||
.addComponent(pnlBattlefield, GroupLayout.DEFAULT_SIZE, 200, Short.MAX_VALUE)
|
||||
.addComponent(phasesContainer, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
|
||||
)
|
||||
.addGroup(gl_helperHandButtonsStackArea.createSequentialGroup()
|
||||
.addComponent(helper, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
|
||||
.addComponent(handContainer, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
|
||||
//.addPreferredGap(ComponentPlacement.RELATED)
|
||||
.addGroup(gl_helperHandButtonsStackArea.createParallelGroup(Alignment.LEADING)
|
||||
.addGroup(gl_helperHandButtonsStackArea.createSequentialGroup()
|
||||
.addGap(2)
|
||||
.addComponent(pnlShortCuts, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
|
||||
.addComponent(stackObjects, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
|
||||
)
|
||||
.addGroup(gl_helperHandButtonsStackArea.createSequentialGroup()
|
||||
.addComponent(helper, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
|
||||
.addComponent(handContainer, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
);
|
||||
pnlHelperHandButtonsStackArea.setLayout(gl_helperHandButtonsStackArea);
|
||||
|
||||
|
@ -2007,11 +2006,11 @@ public final class GamePanel extends javax.swing.JPanel {
|
|||
this.setLayout(layout);
|
||||
layout.setHorizontalGroup(
|
||||
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addComponent(jSplitPane0, javax.swing.GroupLayout.DEFAULT_SIZE, 1078, Short.MAX_VALUE)
|
||||
.addComponent(jSplitPane0, javax.swing.GroupLayout.DEFAULT_SIZE, 1078, Short.MAX_VALUE)
|
||||
);
|
||||
layout.setVerticalGroup(
|
||||
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addComponent(jSplitPane0, javax.swing.GroupLayout.DEFAULT_SIZE, 798, Short.MAX_VALUE)
|
||||
.addComponent(jSplitPane0, javax.swing.GroupLayout.DEFAULT_SIZE, 798, Short.MAX_VALUE)
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -2103,7 +2102,7 @@ public final class GamePanel extends javax.swing.JPanel {
|
|||
message.setGameId(gameId);
|
||||
MageFrame.getInstance().showUserRequestDialog(message);
|
||||
}
|
||||
|
||||
|
||||
private void btnToggleMacroActionPerformed(java.awt.event.ActionEvent evt) {
|
||||
SessionHandler.sendPlayerAction(PlayerAction.TOGGLE_RECORD_MACRO, gameId, null);
|
||||
AudioManager.playOnSkipButton();
|
||||
|
|
|
@ -87,7 +87,6 @@ public class HumanPlayer extends PlayerImpl {
|
|||
protected static FilterAttackingCreature filterAttack = new FilterAttackingCreature();
|
||||
protected static FilterBlockingCreature filterBlock = new FilterBlockingCreature();
|
||||
protected final Choice replacementEffectChoice;
|
||||
|
||||
private static final Logger logger = Logger.getLogger(HumanPlayer.class);
|
||||
|
||||
protected HashSet<String> autoSelectReplacementEffects = new HashSet<>();
|
||||
|
@ -119,9 +118,26 @@ public class HumanPlayer extends PlayerImpl {
|
|||
|
||||
public HumanPlayer(final HumanPlayer player) {
|
||||
super(player);
|
||||
this.replacementEffectChoice = player.replacementEffectChoice;
|
||||
this.autoSelectReplacementEffects.addAll(autoSelectReplacementEffects);
|
||||
this.currentlyUnpaidMana = player.currentlyUnpaidMana;
|
||||
this.replacementEffectChoice = player.replacementEffectChoice;
|
||||
|
||||
this.triggerAutoOrderAbilityFirst.addAll(player.triggerAutoOrderAbilityFirst);
|
||||
this.triggerAutoOrderAbilityLast.addAll(player.triggerAutoOrderAbilityLast);
|
||||
this.triggerAutoOrderNameFirst.addAll(player.triggerAutoOrderNameFirst);
|
||||
this.triggerAutoOrderNameLast.addAll(player.triggerAutoOrderNameLast);
|
||||
|
||||
this.requestAutoAnswerId.putAll(player.requestAutoAnswerId);
|
||||
this.requestAutoAnswerText.putAll(player.requestAutoAnswerText);
|
||||
|
||||
this.holdingPriority = player.holdingPriority;
|
||||
|
||||
this.actionQueue.addAll(player.actionQueue);
|
||||
this.actionQueueSaved.addAll(player.actionQueueSaved);
|
||||
this.actionIterations = player.actionIterations;
|
||||
this.recordingMacro = player.recordingMacro;
|
||||
this.macroTriggeredSelectionFlag = player.macroTriggeredSelectionFlag;
|
||||
this.activatingMacro = player.activatingMacro;
|
||||
}
|
||||
|
||||
protected boolean isExecutingMacro() {
|
||||
|
@ -134,6 +150,7 @@ public class HumanPlayer extends PlayerImpl {
|
|||
if (actionQueue.isEmpty() && actionIterations > 0 && !actionQueueSaved.isEmpty()) {
|
||||
actionQueue = new LinkedList(actionQueueSaved);
|
||||
actionIterations--;
|
||||
// logger.info("MACRO iteration: " + actionIterations);
|
||||
}
|
||||
PlayerResponse action = actionQueue.poll();
|
||||
if (action != null) {
|
||||
|
@ -158,6 +175,11 @@ public class HumanPlayer extends PlayerImpl {
|
|||
protected void waitForResponse(Game game) {
|
||||
if (isExecutingMacro()) {
|
||||
pullResponseFromQueue(game);
|
||||
// logger.info("MACRO pull from queue: " + response.toString());
|
||||
// try {
|
||||
// TimeUnit.MILLISECONDS.sleep(1000);
|
||||
// } catch (InterruptedException e) {
|
||||
// }
|
||||
return;
|
||||
}
|
||||
response.clear();
|
||||
|
@ -166,7 +188,7 @@ public class HumanPlayer extends PlayerImpl {
|
|||
synchronized (response) {
|
||||
try {
|
||||
response.wait();
|
||||
logger.debug("Got response from player: " + getId());
|
||||
logger.info("Got response from player: " + response.toString());
|
||||
} catch (InterruptedException ex) {
|
||||
logger.error("Response error for player " + getName() + " gameId: " + game.getId(), ex);
|
||||
} finally {
|
||||
|
@ -174,7 +196,7 @@ public class HumanPlayer extends PlayerImpl {
|
|||
}
|
||||
}
|
||||
if (recordingMacro && !macroTriggeredSelectionFlag) {
|
||||
logger.debug("Adding an action " + response);
|
||||
// logger.info("Adding an action " + response);
|
||||
actionQueueSaved.add(new PlayerResponse(response));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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.player.human;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
@ -44,29 +43,25 @@ public class PlayerResponse implements Serializable {
|
|||
private Integer responseInteger;
|
||||
private ManaType responseManaType;
|
||||
private UUID responseManaTypePlayerId;
|
||||
|
||||
|
||||
public PlayerResponse() {
|
||||
clear();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return new StringBuilder((responseString == null) ? "null" : responseString)
|
||||
.append(',')
|
||||
.append(responseUUID)
|
||||
.append(',')
|
||||
.append(responseBoolean)
|
||||
.append(',')
|
||||
.append(responseInteger)
|
||||
.append(',')
|
||||
.append(responseManaType)
|
||||
.append(',')
|
||||
.append(responseManaTypePlayerId).toString();
|
||||
return ((responseString == null) ? "null" : responseString)
|
||||
+ ',' + responseUUID
|
||||
+ ',' + responseBoolean
|
||||
+ ',' + responseInteger
|
||||
+ ',' + responseManaType
|
||||
+ ',' + responseManaTypePlayerId;
|
||||
}
|
||||
|
||||
|
||||
public PlayerResponse(PlayerResponse other) {
|
||||
copy(other);
|
||||
}
|
||||
|
||||
|
||||
public void copy(PlayerResponse other) {
|
||||
responseString = other.responseString;
|
||||
responseUUID = other.responseUUID;
|
||||
|
|
Loading…
Reference in a new issue