示例#1
0
 /**
  * Deserialize a LobbyPlayer object out of a Json representation. This is done on the client side,
  * so aClient is null here.
  *
  * @param j The Json representation of the LobbyPlayer
  */
 public LobbyPlayer(final LobbyState state, final Json j) {
   aLobbyState = state;
   aClient = null;
   aColor = j.getStringAttribute("color");
   aIsAdmin = j.getBooleanAttribute("admin");
   aNickname = j.getStringAttribute("nickname");
   aRace = j.getStringAttribute("race");
   aIsReady = j.getBooleanAttribute("ready");
 }
示例#2
0
 /**
  * Json constructor of SpriteData; can either be just a string ("icons/stuff.png") or an object
  * {sprite: "icons/stuff.png", x: 10, y: 12, scale: 1.5}
  *
  * @param j The Json representation
  */
 public SpriteData(final Json j) {
   if (j.isString()) {
     sprite = j.getString();
     x = 0;
     y = 0;
     scale = sDefaultSpriteScale;
   } else {
     sprite = j.getStringAttribute("sprite");
     x = j.getIntAttribute("x");
     y = j.getIntAttribute("y");
     scale = j.getFloatAttribute("scale");
   }
 }