Skip to content

Commit

Permalink
Implemented EntityRemoveMessages in client, it appears to be working
Browse files Browse the repository at this point in the history
  • Loading branch information
bazola committed Sep 19, 2014
1 parent 2541d82 commit 3189478
Showing 1 changed file with 12 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import com.cardshifter.server.incoming.UseAbilityMessage;
import com.cardshifter.server.messages.Message;
import com.cardshifter.server.outgoing.CardInfoMessage;
import com.cardshifter.server.outgoing.EntityRemoveMessage;
import com.cardshifter.server.outgoing.NewGameMessage;
import com.cardshifter.server.outgoing.PlayerMessage;
import com.cardshifter.server.outgoing.UpdateMessage;
Expand Down Expand Up @@ -205,6 +206,8 @@ private void processMessageFromServer(Message message) {
this.processUpdateMessage((UpdateMessage)message);
} else if (message instanceof ZoneChangeMessage) {
this.processZoneChangeMessage((ZoneChangeMessage)message);
} else if (message instanceof EntityRemoveMessage) {
this.processEntityRemoveMessage((EntityRemoveMessage)message);
}
}

Expand Down Expand Up @@ -302,7 +305,7 @@ private void processUseableActionMessage(UseableActionMessage message) {
int maxActions = 8;
double actionWidth = paneWidth / maxActions;

if (message.getAction().equals("End Turn")) {
if (!message.getAction().equals("Play")) {
ActionButton actionButton = new ActionButton(message, this, actionWidth, paneHeight);
actionBox.getChildren().add(actionButton);
}
Expand Down Expand Up @@ -356,6 +359,14 @@ private void processZoneChangeMessage(ZoneChangeMessage message) {
}
}

private void processEntityRemoveMessage(EntityRemoveMessage message) {
for (ZoneView zoneView : this.zoneViewMap.values()) {
if (zoneView.getAllIds().contains(message.getEntity())) {
zoneView.removePane(message.getEntity());
}
}
}

private void repaintStatBox(Pane statBox, Map<String, Integer> playerMap) {
statBox.getChildren().clear();
for (Map.Entry<String, Integer> entry : playerMap.entrySet()) {
Expand Down

0 comments on commit 3189478

Please sign in to comment.