@Override public Message WriteBuffer() { CardsProtos.AI.Builder builder = CardsProtos.AI.newBuilder(); for (Card c : mSelectedCards) { builder.addSelectedCards((CardsProtos.Card) c.WriteBuffer()); } builder.setId(getIdentity().get().getId()); return builder.build(); }
@Override public void ReadBuffer(Message msg) { CardsProtos.AI ai = (CardsProtos.AI) msg; mSelectedCards.clear(); for (CardsProtos.Card protoCard : ai.getSelectedCardsList()) { mSelectedCards.add(Card.GetCard(protoCard)); } mIdentity = new Identity(ai.getId()); }