[Commander] Display Commander in client

This commit is contained in:
Plopman 2013-07-17 20:35:52 +02:00
parent 930e70fbbb
commit e6847a472d
3 changed files with 25 additions and 11 deletions

View file

@ -651,7 +651,7 @@ public class PlayerPanelExt extends javax.swing.JPanel {
}
private void btnCommandZoneActionPerformed(java.awt.event.ActionEvent evt) {
DialogManager.getManager(gameId).showEmblemsDialog(CardsViewUtil.convertEmblems(player.getEmblemList()), bigCard, gameId);
DialogManager.getManager(gameId).showEmblemsDialog(CardsViewUtil.convertCommandObject(player.getCommadObjectList()), bigCard, gameId);
}
private void btnCheatActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnCheatActionPerformed

View file

@ -28,13 +28,12 @@
package mage.client.util;
import java.util.List;
import mage.cards.Card;
import mage.cards.repository.CardInfo;
import mage.cards.repository.CardRepository;
import mage.view.*;
import java.util.List;
/**
*
* @author BetaSteward_at_googlemail.com
@ -55,12 +54,17 @@ public class CardsViewUtil {
return cards;
}
public static CardsView convertEmblems(List<EmblemView> view) {
public static CardsView convertCommandObject(List<CommandObjectView> view) {
CardsView cards = new CardsView();
for (EmblemView emblem : view) {
CardView cardView = new CardView(emblem);
cards.put(emblem.getId(), cardView);
for (CommandObjectView commandObject : view) {
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);
}
}
return cards;

View file

@ -39,6 +39,7 @@ import mage.players.Player;
import java.io.Serializable;
import java.util.*;
import mage.game.command.Commander;
/**
*
@ -61,7 +62,7 @@ public class PlayerView implements Serializable {
private Map<UUID, PermanentView> battlefield = new LinkedHashMap<UUID, PermanentView>();
private CardView topCard;
private UserDataView userDataView;
private List<EmblemView> emblemList = new ArrayList<EmblemView>();
private List<CommandObjectView> commandList = new ArrayList<CommandObjectView>();
private List<UUID> attachments = new ArrayList<UUID>();
private int statesSavedSize;
private int priorityTimeLeft;
@ -100,7 +101,16 @@ public class PlayerView implements Serializable {
if (emblem.getControllerId().equals(this.playerId)) {
Card sourceCard = game.getCard(((CommandObject)emblem).getSourceId());
if (sourceCard != null) {
emblemList.add(new EmblemView(emblem, sourceCard));
commandList.add(new EmblemView(emblem, sourceCard));
}
}
}
else if(commandObject instanceof Commander){
Commander commander = (Commander)commandObject;
if(commander.getControllerId().equals(this.playerId)){
Card sourceCard = game.getCard(commander.getSourceId());
if(sourceCard != null){
commandList.add(new CommanderView(commander, sourceCard));
}
}
}
@ -180,8 +190,8 @@ public class PlayerView implements Serializable {
return this.userDataView;
}
public List<EmblemView> getEmblemList() {
return emblemList;
public List<CommandObjectView> getCommadObjectList() {
return commandList;
}
public List<UUID> getAttachments() {