From 4b331355defb6bc255a6fa4347574706ec0385d8 Mon Sep 17 00:00:00 2001 From: Shaun Hannah Date: Mon, 26 Feb 2018 19:24:00 -0500 Subject: [PATCH] [WIP] SPIKE - gson @Expose --- .../src/main/java/mage/remote/ActionData.java | 6 ++++++ Mage.Common/src/main/java/mage/view/CardView.java | 9 ++++++++- .../main/java/mage/view/GameClientMessage.java | 15 ++++++++++++++- .../src/main/java/mage/view/SimpleCardView.java | 3 +++ 4 files changed, 31 insertions(+), 2 deletions(-) diff --git a/Mage.Common/src/main/java/mage/remote/ActionData.java b/Mage.Common/src/main/java/mage/remote/ActionData.java index 4fdd32ef06..d173535b14 100644 --- a/Mage.Common/src/main/java/mage/remote/ActionData.java +++ b/Mage.Common/src/main/java/mage/remote/ActionData.java @@ -34,14 +34,20 @@ import mage.remote.interfaces.*; import java.util.UUID; +import com.google.gson.annotations.Expose; import com.google.gson.ExclusionStrategy; import com.google.gson.FieldAttributes; public class ActionData { + @Expose public UUID gameId; + @Expose public String sessionId; + @Expose public String type; + @Expose public Object value; + @Expose public String message; public String toJson() { diff --git a/Mage.Common/src/main/java/mage/view/CardView.java b/Mage.Common/src/main/java/mage/view/CardView.java index d9154f7418..b2ed194eb8 100644 --- a/Mage.Common/src/main/java/mage/view/CardView.java +++ b/Mage.Common/src/main/java/mage/view/CardView.java @@ -53,6 +53,8 @@ import mage.target.Target; import mage.target.Targets; import mage.util.SubTypeList; +import com.google.gson.annotations.Expose; + /** * @author BetaSteward_at_googlemail.com */ @@ -61,11 +63,17 @@ public class CardView extends SimpleCardView { private static final long serialVersionUID = 1L; protected UUID parentId; + @Expose protected String name; + @Expose protected String displayName; + @Expose protected List rules; + @Expose protected String power; + @Expose protected String toughness; + @Expose protected String loyalty = ""; protected String startingLoyalty; protected EnumSet cardTypes; @@ -110,7 +118,6 @@ public class CardView extends SimpleCardView { protected ArtRect artRect = ArtRect.NORMAL; protected List targets; - protected UUID pairedCard; protected List bandedCards; protected boolean paid; diff --git a/Mage.Common/src/main/java/mage/view/GameClientMessage.java b/Mage.Common/src/main/java/mage/view/GameClientMessage.java index 8e8a8b93aa..1774c766f9 100644 --- a/Mage.Common/src/main/java/mage/view/GameClientMessage.java +++ b/Mage.Common/src/main/java/mage/view/GameClientMessage.java @@ -35,6 +35,8 @@ import java.util.UUID; import com.google.gson.Gson; import com.google.gson.GsonBuilder; +import com.google.gson.annotations.Expose; + import mage.choices.Choice; /** @@ -42,18 +44,29 @@ import mage.choices.Choice; * @author BetaSteward_at_googlemail.com */ public class GameClientMessage implements Serializable { + @Expose private static final long serialVersionUID = 1L; - + @Expose private GameView gameView; + @Expose private CardsView cardsView; + @Expose private CardsView cardsView2; + @Expose private String message; + @Expose private boolean flag; + @Expose private String[] strings; + @Expose private Set targets; + @Expose private int min; + @Expose private int max; + @Expose private Map options; + @Expose private Choice choice; public GameClientMessage(GameView gameView) { diff --git a/Mage.Common/src/main/java/mage/view/SimpleCardView.java b/Mage.Common/src/main/java/mage/view/SimpleCardView.java index 709e45ad83..a137f0ca0e 100644 --- a/Mage.Common/src/main/java/mage/view/SimpleCardView.java +++ b/Mage.Common/src/main/java/mage/view/SimpleCardView.java @@ -28,6 +28,8 @@ package mage.view; +import com.google.gson.annotations.Expose; + import java.io.Serializable; import java.util.UUID; @@ -36,6 +38,7 @@ import java.util.UUID; * @author BetaSteward_at_googlemail.com */ public class SimpleCardView implements Serializable { + @Expose protected UUID id; protected String expansionSetCode; protected String tokenSetCode;