- Delegate network game communication to a new GameProtocol class

- Rename a method to make it compatible with the new protocol
This commit is contained in:
elcnesh
2015-04-22 17:55:58 +00:00
parent 038ddbba67
commit 91d9987c1f
15 changed files with 237 additions and 242 deletions

View File

@@ -193,6 +193,9 @@ public final class CMatchUI
FThreads.invokeInEdtNowOrLater(new Runnable() {
@Override public final void run() {
for (final VField f : getFieldViews()) {
f.updateDetails();
f.updateZones();
f.updateManaPool();
f.getTabletop().update();
}
for (final VHand h : getHandViews()) {
@@ -457,29 +460,31 @@ public final class CMatchUI
}
@Override
public void updateSingleCard(final CardView c) {
final ZoneType zone = c.getZone();
if (zone == null) { return; }
public void updateCards(final Iterable<CardView> cards) {
for (final CardView c : cards) {
final ZoneType zone = c.getZone();
if (zone == null) { return; }
switch (zone) {
case Battlefield:
final VField battlefield = getFieldViewFor(c.getController());
if (battlefield != null) {
battlefield.getTabletop().updateCard(c, false);
}
break;
case Hand:
final VHand hand = getHandFor(c.getController());
if (hand != null) {
CardPanel cp = hand.getHandArea().getCardPanel(c.getId());
if (cp != null) {
cp.setCard(c); //ensure card view updated
cp.repaintOverlays();
switch (zone) {
case Battlefield:
final VField battlefield = getFieldViewFor(c.getController());
if (battlefield != null) {
battlefield.getTabletop().updateCard(c, false);
}
break;
case Hand:
final VHand hand = getHandFor(c.getController());
if (hand != null) {
final CardPanel cp = hand.getHandArea().getCardPanel(c.getId());
if (cp != null) {
cp.setCard(c); //ensure card view updated
cp.repaintOverlays();
}
}
break;
default:
break;
}
break;
default:
break;
}
}

View File

@@ -251,7 +251,7 @@ public class FButton extends SkinnedButton implements ILocalRepaint, IButton {
}
@Override
public void setTextColor(FSkinProp color) {
public void setImage(FSkinProp color) {
setForeground(FSkin.getColor(Colors.fromSkinProp(color)));
}

View File

@@ -644,7 +644,7 @@ public class FLabel extends SkinnedLabel implements ILocalRepaint, IButton {
}
@Override
public void setTextColor(FSkinProp color) {
public void setImage(FSkinProp color) {
setForeground(FSkin.getColor(Colors.fromSkinProp(color)));
}