Skip to content

Commit

Permalink
Fixed sendWords, added round argument, commented sendEvaluations (wil…
Browse files Browse the repository at this point in the history
…l focus on auto now)
  • Loading branch information
NoxArt committed Nov 19, 2013
1 parent 7592cd6 commit 26eba47
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 8 deletions.
6 changes: 4 additions & 2 deletions src/cz/fit/tam/model/Game.java
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ public void leave() {
stopped = true;
}

public void sendWords(String[] words) {
public void sendWords(Integer round, String[] words) {
if (isConnected()) {
throw new IllegalStateException();
}
Expand All @@ -131,9 +131,10 @@ public void sendWords(String[] words) {
throw new GameIsStoppedException();
}

client.sendWords(words);
client.sendWords(round, words);
}

/*
public void sendEvaluations(Map<String, String[]> evaluations) {
if (isConnected()) {
throw new IllegalStateException();
Expand All @@ -145,5 +146,6 @@ public void sendEvaluations(Map<String, String[]> evaluations) {
client.sendEvaluation(evaluations);
}
*/

}
22 changes: 16 additions & 6 deletions src/cz/fit/tam/model/GameClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -168,13 +168,18 @@ public void leave(Integer gameId) {
}
}

public void sendWords(String[] words) {
public void sendWords(Integer round, String[] words) {
Map<String, String> arguments = new HashMap<String, String>();
arguments.put("command", GameClient.COMMAND_POST_MESSAGE);
arguments.put("game_id", gameId.toString());
arguments.put("token", player.getToken().getValue());
arguments.put("action", GameClient.ACTION_SEND_WORDS);
arguments.put("words", combine(words));
arguments.put("token", player.getToken().getValue());

Map<String, String> data = new HashMap<String, String>();
data.put("action", GameClient.ACTION_SEND_WORDS);
data.put("round", round.toString());
data.put("words", combine(words));

arguments.put("data", (new JSONObject(data)).toString());

try {
messaging.sendMessage(arguments);
Expand All @@ -186,13 +191,17 @@ public void sendWords(String[] words) {
}
}

/*
public void sendEvaluation(Map<String, String[]> evaluations) {
Map<String, String> arguments = new HashMap<String, String>();
arguments.put("command", GameClient.COMMAND_POST_MESSAGE);
arguments.put("game_id", gameId.toString());
arguments.put("token", player.getToken().getValue());
arguments.put("action", GameClient.ACTION_SEND_EVALUATION);
arguments.put("evaluations", combine(evaluations));
Map<String, String> data = new HashMap<String, String>();
data.put("action", GameClient.ACTION_SEND_EVALUATION);
data.put("evaluations", combine(evaluations));
try {
messaging.sendMessage(arguments);
Expand All @@ -203,6 +212,7 @@ public void sendEvaluation(Map<String, String[]> evaluations) {
throw new CommandFailedException(ex);
}
}
*/

public List<GameProperties> getGames() {
return getGames(null);
Expand Down

0 comments on commit 26eba47

Please sign in to comment.