Affichage des mots dans le score (non testé).
This commit is contained in:
parent
664035a4bf
commit
ed100a21db
|
@ -1,7 +1,9 @@
|
|||
package org.pticlic;
|
||||
|
||||
import org.pticlic.exception.PtiClicException;
|
||||
import org.pticlic.games.BaseGame;
|
||||
import org.pticlic.model.Constant;
|
||||
import org.pticlic.model.DownloadedBaseGame;
|
||||
import org.pticlic.model.Match;
|
||||
import org.pticlic.model.Network;
|
||||
import org.pticlic.model.Network.Mode;
|
||||
|
@ -85,15 +87,44 @@ public class BaseScore extends Activity implements OnClickListener{
|
|||
|
||||
this.networkStuff();
|
||||
|
||||
((TextView)findViewById(R.id.total)).setText("42");
|
||||
// TODO : Attention, le cast en (BaseGame) n'est pas sûr !
|
||||
((TextView)findViewById(R.id.scoreRel1)).setText("Foo1");
|
||||
((TextView)findViewById(R.id.scoreRel2)).setText("Foo2");
|
||||
((TextView)findViewById(R.id.scoreRel3)).setText("Foo3");
|
||||
((TextView)findViewById(R.id.scoreRel4)).setText("Foo4");
|
||||
DownloadedBaseGame bg = (DownloadedBaseGame)gamePlayed.getGame();
|
||||
((TextView)findViewById(R.id.total)).setText(String.valueOf(sr.getScoreTotal()));
|
||||
((TextView)findViewById(R.id.scoreRel1)).setText(bg.getCatString(1));
|
||||
((TextView)findViewById(R.id.scoreRel2)).setText(bg.getCatString(2));
|
||||
((TextView)findViewById(R.id.scoreRel3)).setText(bg.getCatString(3));
|
||||
((TextView)findViewById(R.id.scoreRel4)).setText(bg.getCatString(4));
|
||||
|
||||
String res;
|
||||
res = "";
|
||||
for (int i : gamePlayed.getRelation1()) {
|
||||
res += bg.getWordInCloud(i).getName();
|
||||
res += " (" + String.valueOf(sr.getScoreOfWord(i)) + "), ";
|
||||
}
|
||||
((TextView)findViewById(R.id.scoreWords1)).setText(res);
|
||||
|
||||
res = "";
|
||||
for (int i : gamePlayed.getRelation2()) {
|
||||
res += bg.getWordInCloud(i).getName();
|
||||
res += " (" + String.valueOf(sr.getScoreOfWord(i)) + "), ";
|
||||
}
|
||||
((TextView)findViewById(R.id.scoreWords2)).setText(res);
|
||||
|
||||
res = "";
|
||||
for (int i : gamePlayed.getRelation3()) {
|
||||
res += bg.getWordInCloud(i).getName();
|
||||
res += " (" + String.valueOf(sr.getScoreOfWord(i)) + "), ";
|
||||
}
|
||||
((TextView)findViewById(R.id.scoreWords3)).setText(res);
|
||||
|
||||
res = "";
|
||||
for (int i : gamePlayed.getRelation4()) {
|
||||
res += bg.getWordInCloud(i).getName();
|
||||
res += " (" + String.valueOf(sr.getScoreOfWord(i)) + "), ";
|
||||
}
|
||||
((TextView)findViewById(R.id.scoreWords4)).setText(res);
|
||||
|
||||
((Button)findViewById(R.id.saw)).setOnClickListener(this);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -79,7 +79,9 @@ public class DownloadedBaseGame extends DownloadedGame {
|
|||
}
|
||||
|
||||
public String getCatString(int numCat) {
|
||||
return Relation.getInstance().getRelationName(this.getCat(numCat));
|
||||
return String.format(
|
||||
Relation.getInstance().getRelationName(this.getCat(numCat)),
|
||||
center.getName());
|
||||
}
|
||||
|
||||
public int getCat1() {
|
||||
|
|
|
@ -29,11 +29,18 @@ import com.google.gson.stream.JsonReader;
|
|||
public class Network {
|
||||
|
||||
public static class ScoreResponse {
|
||||
private int score;
|
||||
private int scoreTotal;
|
||||
private int[] scores;
|
||||
private String newGame;
|
||||
public ScoreResponse() {}
|
||||
public int getScore() {
|
||||
return score;
|
||||
public int[] getScores() {
|
||||
return scores;
|
||||
}
|
||||
public int getScoreOfWord(int i) {
|
||||
return scores[i];
|
||||
}
|
||||
public int getScoreTotal() {
|
||||
return scoreTotal;
|
||||
}
|
||||
public String getNewGame() {
|
||||
return newGame;
|
||||
|
|
|
@ -547,7 +547,7 @@ function setGame($user, $pgid, $gid, $answers)
|
|||
while ($row = $res->fetchArray())
|
||||
{
|
||||
$num = intval($row['num']);
|
||||
$nbScores = max($nbScores, $num);
|
||||
$nbScores++;
|
||||
if (!isset($answers[$num])) {
|
||||
throw new Exception("Cette requête \"Set partie\" ne donne pas de réponse (une relation) pour le mot numéro $num de la partie.", 5);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user