HUGE update to the GUI refactoring, fixing most known bugs and making everything run a lot faster and smoother.

Fixed: exceptions during combat, display of face-down cards, searching libraries, mindslaver effects, and more.
This commit is contained in:
elcnesh
2014-09-11 15:46:33 +00:00
parent fbcc8dbf1c
commit 1ba2cb498b
25 changed files with 308 additions and 175 deletions

View File

@@ -182,7 +182,7 @@ public class CardDetailPanel extends SkinnedPanel {
final CardStateView state = card.getState(isInAltState);
if (state.getManaCost().isNoCost()) {
this.nameCostLabel.setText(state.getName());
this.nameCostLabel.setText(CardDetailUtil.formatCardName(state));
} else {
final String manaCost;
if (card.isSplitCard() && card.hasAltState()) {
@@ -190,7 +190,7 @@ public class CardDetailPanel extends SkinnedPanel {
} else {
manaCost = state.getManaCost().toString();
}
this.nameCostLabel.setText(FSkin.encodeSymbols(state.getName() + " - " + manaCost, true));
this.nameCostLabel.setText(FSkin.encodeSymbols(CardDetailUtil.formatCardName(state) + " - " + manaCost, true));
}
this.typeLabel.setText(CardDetailUtil.formatCardType(state));

View File

@@ -208,8 +208,15 @@ public class GuiChoose {
@Override
public void valueChanged(final ListSelectionEvent ev) {
final T sel = list.getSelectedValue();
final CardView card;
if (sel instanceof CardStateView) {
final CardView card = ((CardStateView) sel).getCard();
card = ((CardStateView) sel).getCard();
} else if (sel instanceof CardView) {
card = (CardView) sel;
} else {
card = null;
}
if (card != null) {
CMatchUI.SINGLETON_INSTANCE.setCard(card);
GuiUtils.clearPanelSelections();

View File

@@ -168,7 +168,7 @@ public enum CMatchUI implements ICDoc, IMenuProvider {
int i = 0;
for (final PlayerView p : sortedPlayers) {
if (localPlayer == null || p.getLobbyPlayer() == localPlayer) {
if (p.getLobbyPlayer().equals(localPlayer) || !p.getHandCards().isEmpty()) {
VHand newHand = new VHand(EDocID.Hands[i], p);
newHand.getLayoutControl().initialize();
hands.add(newHand);

View File

@@ -158,6 +158,7 @@ public enum CDock implements ICDoc {
/** Attack with everyone. */
public void alphaStrike() {
game.alphaStrike();
/* TODO: rewrite this!
final Player p = this.findAffectedPlayer();
final Combat combat = FControl.instance.getObservedGame().getCombat();

View File

@@ -119,12 +119,12 @@ public class PlayerDetailsPanel extends JPanel {
* @param p0   {@link forge.game.player.Player}
*/
public void updateZones() {
this.getLblHand().setText("" + player.getHandCards().size());
this.getLblHand().setText("" + player.getnHandCards());
final String handMaxToolTip = player.hasUnlimitedHandSize()
? "no maximum hand size" : String.valueOf(player.getMaxHandSize());
this.getLblHand().setToolTipText("Cards in hand (max: " + handMaxToolTip + ")");
this.getLblGraveyard().setText("" + player.getGraveCards().size());
this.getLblLibrary().setText("" + player.getLibraryCards().size());
this.getLblLibrary().setText("" + player.getnLibraryCards());
this.getLblFlashback().setText("" + player.getFlashbackCards().size());
this.getLblExile().setText("" + player.getExileCards().size());
}

View File

@@ -609,22 +609,19 @@ public class PlayArea extends CardPanelContainer implements CardPanelMouseListen
for (final CardPanel cpa : getCardPanels()) {
oldCards.add(cpa.getCard());
}
final List<CardView> toDelete = Lists.newArrayList(oldCards);
final List<CardView> toReplace = Lists.newArrayList();
// delete all cards that differ in timestamp (they have been blinked)
final List<CardView> toDelete = Lists.newArrayList(oldCards);
final List<CardView> notToDelete = Lists.newLinkedList();
for (final CardView c : modelCopy) {
for (int i = 0; i < toDelete.size(); i++) {
final CardView c2 = toDelete.get(i);
if (c.getId() == c2.getId()) {
if (c.getTimestamp() == c2.getTimestamp()) {
toDelete.remove(c2);
} else {
toReplace.add(c);
}
notToDelete.add(c2);
}
}
}
toDelete.removeAll(notToDelete);
if (toDelete.size() == getCardPanels().size()) {
clear();
} else {
@@ -635,7 +632,6 @@ public class PlayArea extends CardPanelContainer implements CardPanelMouseListen
final List<CardView> toAdd = new ArrayList<CardView>(modelCopy);
toAdd.removeAll(oldCards);
toAdd.addAll(toReplace);
final List<CardPanel> newPanels = new ArrayList<CardPanel>();
for (final CardView card : toAdd) {

View File

@@ -28,8 +28,8 @@ public class LobbyPlayerForTests extends LobbyPlayer implements IGameEntitiesFac
@Override
public Player createIngamePlayer( Game gameState ) {
Player dummyPlayer = new Player( getName(), gameState );
public Player createIngamePlayer(Game gameState, final int id) {
Player dummyPlayer = new Player(getName(), gameState, id);
dummyPlayer.setFirstController( createControllerFor( dummyPlayer ) );
return dummyPlayer;
}