Back to project page game_guess_lib.
The source code is released under:
MIT License
If you think the Android project game_guess_lib listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package com.wkmf.guess.lib.structure; /*from w w w .j av a2 s . c om*/ import org.codehaus.jackson.annotate.JsonIgnoreProperties; import org.codehaus.jackson.annotate.JsonProperty; import java.util.ArrayList; import java.util.List; import java.util.UUID; /** * Created by ernestofndz on 9/02/14. */ @JsonIgnoreProperties(ignoreUnknown = true) public class GuessGame { private static final int LIVES_START = 10; public static final int LIVES_AMOUNT_GET_TAG = 1; public static final int LIVES_AMOUNT_REVEAL_PART_OF_ANSWER = 2; public static final int LIVES_AMOUNT_REVEAL_ANSWER = 3; @JsonProperty("appId") private String appId; @JsonProperty("levels") private List<GuessLevel> levels = new ArrayList<GuessLevel>(); @JsonProperty("lives") private int lives; @JsonProperty("payload") private String payload; // constructor public GuessGame(String appId, List<GuessLevel> levels) { this.appId = appId; this.lives = LIVES_START; // filtramos los niveles for (GuessLevel level : levels) { if (level.isInProduction()) { this.levels.add(level); } } generatePayload(); } public GuessGame() { } // control de vidas public void addLives(int lives) { this.lives += lives; } public void removeLives(int lives) { this.lives -= lives; } // generar payload (deberia ser una sola vez) private void generatePayload() { this.payload = String.valueOf(UUID.randomUUID()); } // get/set public List<GuessLevel> getLevels() { return levels; } public void setLevels(List<GuessLevel> levels) { this.levels = levels; } public String getAppId() { return appId; } public void setAppId(String appId) { this.appId = appId; } public int getLives() { return lives; } public void setLives(int lives) { this.lives = lives; } public String getPayload() { return payload; } }