commit c2bc073f8bfba9d0515898e01dc95b37860fdb1f
parent 21d9758520f36b21cd8c829c400e40867550f9bf
Author: root <root@home.(none)>
Date: Thu, 17 Mar 2011 11:21:20 +0100
Merge branch 'master' of https://github.com/jsmaniac/2011-m1s2-ter
Diffstat:
6 files changed, 96 insertions(+), 134 deletions(-)
diff --git a/code/PtiClic/res/layout/score.xml b/code/PtiClic/res/layout/score.xml
@@ -1,24 +1,76 @@
<?xml version="1.0" encoding="utf-8"?>
-<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
-android:layout_height="fill_parent" android:orientation="vertical"
-android:id="@+id/LinearLayout01" android:layout_gravity="center" android:layout_width="fill_parent">
- <LinearLayout android:layout_width="fill_parent" android:layout_height="wrap_content" android:id="@+id/linearLayout2" android:orientation="vertical" android:layout_weight="2">
- <TextView android:layout_width="fill_parent" android:id="@+id/textView1" android:layout_height="wrap_content" android:text="Votre score est de :" android:gravity="center" android:layout_weight="1"></TextView>
- <TextView android:layout_width="fill_parent" android:id="@+id/total" android:layout_height="wrap_content" android:text="@+id/total" android:textStyle="bold" android:textSize="25px" android:layout_weight="1" android:gravity="center|top"></TextView>
- <TextView android:layout_height="wrap_content" android:id="@+id/scoreRel1" android:text="@+id/scoreRel1" android:layout_width="fill_parent"></TextView>
- <TextView android:layout_height="wrap_content" android:id="@+id/scoreWords1" android:layout_width="fill_parent" android:paddingLeft="40dip" android:text="@+id/scoreWords1"></TextView>
- <TextView android:layout_height="wrap_content" android:id="@+id/scoreRel2" android:text="@+id/scoreRel2" android:layout_width="fill_parent"></TextView>
- <TextView android:layout_height="wrap_content" android:id="@+id/scoreWords2" android:text="@+id/scoreWords2" android:layout_width="fill_parent" android:paddingLeft="40dip"></TextView>
- <TextView android:layout_height="wrap_content" android:id="@+id/scoreRel3" android:text="@+id/scoreRel3" android:layout_width="fill_parent"></TextView>
- <TextView android:layout_height="wrap_content" android:id="@+id/scoreWords3" android:text="@+id/scoreWords3" android:layout_width="fill_parent" android:paddingLeft="40dip"></TextView>
- <TextView android:layout_height="wrap_content" android:id="@+id/scoreRel4" android:text="@+id/scoreRel4" android:layout_width="fill_parent"></TextView>
- <TextView android:layout_height="wrap_content" android:id="@+id/scoreWords4" android:text="@+id/scoreWords4" android:layout_width="fill_parent" android:paddingLeft="40dip"></TextView>
- </LinearLayout>
-<LinearLayout android:id="@+id/linearLayout1" android:layout_weight="1" android:layout_height="wrap_content" android:layout_width="fill_parent" android:gravity="center_horizontal" android:paddingTop="20dip">
- <Button android:id="@+id/saw" android:text="J'ai vu !" android:layout_height="wrap_content" android:layout_gravity="top" android:layout_width="150dip"></Button>
-</LinearLayout>
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_height="fill_parent" android:orientation="vertical"
+ android:id="@+id/LinearLayout01" android:layout_gravity="center"
+ android:layout_width="fill_parent">
+ <LinearLayout android:layout_width="fill_parent"
+ android:layout_height="wrap_content" android:id="@+id/linearLayout2"
+ android:orientation="vertical" android:layout_weight="2">
+
+ <TextView android:layout_width="fill_parent" android:id="@+id/textView1"
+ android:layout_height="wrap_content" android:text="@string/score_your_score"
+ android:gravity="center|bottom" android:layout_weight="1" android:textSize="25dip"
+ android:textStyle="bold"></TextView>
+
+ <TextView android:layout_width="fill_parent" android:id="@+id/total"
+ android:layout_height="wrap_content" android:text="@+id/total"
+ android:textStyle="bold" android:textSize="25dip"
+ android:layout_weight="1" android:gravity="center|top"></TextView>
+
+ <TextView android:layout_width="fill_parent" android:id="@+id/textView1"
+ android:layout_height="wrap_content" android:text="@string/score_your_answers"
+ android:gravity="center|bottom" android:layout_weight="0.1"
+ android:textSize="25dip" android:textStyle="bold"></TextView>
+
+ <TextView android:layout_width="fill_parent" android:id="@+id/textView1"
+ android:layout_height="wrap_content" android:text="@string/score_explanation"
+ android:gravity="center|top" android:layout_weight="1"
+ android:textSize="15dip"></TextView>
+
+ <TextView android:layout_height="wrap_content" android:id="@+id/scoreRel1"
+ android:text="@+id/scoreRel1" android:layout_width="fill_parent"
+ android:textStyle="bold" android:paddingLeft="10dip"></TextView>
+
+ <TextView android:layout_height="wrap_content" android:id="@+id/scoreWords1"
+ android:layout_width="fill_parent" android:paddingLeft="30dip"
+ android:text="@+id/scoreWords1" android:paddingBottom="5dip"></TextView>
+
+ <TextView android:layout_height="wrap_content" android:id="@+id/scoreRel2"
+ android:text="@+id/scoreRel2" android:layout_width="fill_parent"
+ android:textStyle="bold" android:paddingLeft="10dip"></TextView>
+
+ <TextView android:layout_height="wrap_content" android:id="@+id/scoreWords2"
+ android:text="@+id/scoreWords2" android:layout_width="fill_parent"
+ android:paddingLeft="30dip" android:paddingBottom="5dip"></TextView>
+
+ <TextView android:layout_height="wrap_content" android:id="@+id/scoreRel3"
+ android:text="@+id/scoreRel3" android:layout_width="fill_parent"
+ android:textStyle="bold" android:paddingLeft="10dip"></TextView>
+
+ <TextView android:layout_height="wrap_content" android:id="@+id/scoreWords3"
+ android:text="@+id/scoreWords3" android:layout_width="fill_parent"
+ android:paddingLeft="30dip" android:paddingBottom="5dip"></TextView>
+
+ <TextView android:layout_height="wrap_content" android:id="@+id/scoreRel4"
+ android:text="@+id/scoreRel4" android:layout_width="fill_parent"
+ android:textStyle="bold" android:paddingLeft="10dip"></TextView>
+
+ <TextView android:layout_height="wrap_content" android:id="@+id/scoreWords4"
+ android:text="@+id/scoreWords4" android:layout_width="fill_parent"
+ android:paddingLeft="30dip" android:paddingBottom="5dip"></TextView>
+
+ </LinearLayout>
+
+ <LinearLayout android:id="@+id/linearLayout1"
+ android:layout_weight="1" android:layout_height="wrap_content"
+ android:layout_width="fill_parent" android:gravity="center_horizontal"
+ android:paddingTop="20dip">
+ <Button android:id="@+id/saw" android:text="J'ai vu !"
+ android:layout_height="wrap_content" android:layout_gravity="top"
+ android:layout_width="150dip"></Button>
+ </LinearLayout>
</LinearLayout>
diff --git a/code/PtiClic/res/values/strings.xml b/code/PtiClic/res/values/strings.xml
@@ -17,4 +17,8 @@
<string name="frontpage_no_connection">Vous n\'êtes pas connecté(e). Vérifiez votre connexion réseau.</string>
<string name="frontpage_user_connected">Vous êtes connecté(e)</string>
<string name="frontpage_user_notconnected">Vous n\'êtes pas authentifié(e)</string>
+<string name="score_your_score">Votre score</string>
+<string name="score_your_answers">Vos réponses</string>
+<string name="score_explanation">(Détail du calcul du score entre parenthèse)</string>
+<string name="score_no_answers">(aucune réponse)</string>
</resources>
diff --git a/code/PtiClic/src/org/pticlic/BaseScore.java b/code/PtiClic/src/org/pticlic/BaseScore.java
@@ -1,5 +1,6 @@
package org.pticlic;
+import org.pticlic.R.string;
import org.pticlic.exception.PtiClicException;
import org.pticlic.model.Constant;
import org.pticlic.model.DownloadedBaseGame;
@@ -85,6 +86,7 @@ public class BaseScore extends Activity implements OnClickListener{
setContentView(R.layout.score);
this.networkStuff();
+ this.networkStuff();
// TODO : Attention, le cast en (BaseGame) n'est pas sûr !
DownloadedBaseGame bg = (DownloadedBaseGame)gamePlayed.getGame();
@@ -95,33 +97,34 @@ public class BaseScore extends Activity implements OnClickListener{
((TextView)findViewById(R.id.scoreRel4)).setText(bg.getCatString(4));
String res;
+ String noAnswers = getString(string.score_no_answers);
res = "";
for (int i : gamePlayed.getRelation1()) {
res += bg.getWordInCloud(i).getName();
res += " (" + String.valueOf(sr.getScoreOfWord(i)) + "), ";
}
- ((TextView)findViewById(R.id.scoreWords1)).setText(res);
+ ((TextView)findViewById(R.id.scoreWords1)).setText(res.length() < 1 ? noAnswers : res);
- res = "";
+ res = noAnswers;
for (int i : gamePlayed.getRelation2()) {
res += bg.getWordInCloud(i).getName();
res += " (" + String.valueOf(sr.getScoreOfWord(i)) + "), ";
}
- ((TextView)findViewById(R.id.scoreWords2)).setText(res);
+ ((TextView)findViewById(R.id.scoreWords2)).setText(res.length() < 1 ? noAnswers : res);
- res = "";
+ res = noAnswers;
for (int i : gamePlayed.getRelation3()) {
res += bg.getWordInCloud(i).getName();
res += " (" + String.valueOf(sr.getScoreOfWord(i)) + "), ";
}
- ((TextView)findViewById(R.id.scoreWords3)).setText(res);
+ ((TextView)findViewById(R.id.scoreWords3)).setText(res.length() < 1 ? noAnswers : res);
- res = "";
+ res = noAnswers;
for (int i : gamePlayed.getRelation4()) {
res += bg.getWordInCloud(i).getName();
res += " (" + String.valueOf(sr.getScoreOfWord(i)) + "), ";
}
- ((TextView)findViewById(R.id.scoreWords4)).setText(res);
+ ((TextView)findViewById(R.id.scoreWords4)).setText(res.length() < 1 ? noAnswers : res);
((Button)findViewById(R.id.saw)).setOnClickListener(this);
}
diff --git a/code/PtiClic/src/org/pticlic/model/Network.java b/code/PtiClic/src/org/pticlic/model/Network.java
@@ -32,19 +32,29 @@ public class Network {
private int scoreTotal;
private int[] scores;
private String newGame;
+ private boolean alreadyPlayed;
+
public ScoreResponse() {}
+
public int[] getScores() {
return scores;
}
+
public int getScoreOfWord(int i) {
return scores[i];
}
+
public int getScoreTotal() {
return scoreTotal;
}
+
public String getNewGame() {
return newGame;
}
+
+ public boolean getAlreadyPlayed() {
+ return alreadyPlayed;
+ }
}
public static class Check implements Serializable {
@@ -300,7 +310,8 @@ public class Network {
+ "&passwd=" + this.passwd
+ "&pgid=" + game.getGame().getPgid()
+ "&gid=" + game.getGame().getGid()
- + "&mode="+mode.value();
+ + "&mode="+mode.value()
+ + "&nb="+((DownloadedBaseGame)(game.getGame())).getNbWord();
// TODO : faut gere le mode
for (Integer i : game.getRelation1()) {
diff --git a/code/PtiClic/src/org/pticlic/model/TotalScore.java b/code/PtiClic/src/org/pticlic/model/TotalScore.java
@@ -1,45 +0,0 @@
-package org.pticlic.model;
-
-/**
- *
- * @author John CHARRON
- *
- */
-
-public class TotalScore {
-
- private TotalScore scoreTotal;
- private WordScore scores;
-
- public TotalScore() {
- }
-
- public TotalScore(TotalScore scoreTotal, WordScore wordscores) {
- this.scoreTotal = scoreTotal;
- this.scores = wordscores;
- }
-
- public TotalScore getScoreTotal() {
- return scoreTotal;
- }
-
- public void setScoreTotal(TotalScore scoreTotal) {
- this.scoreTotal = scoreTotal;
- }
-
- public WordScore getWordscores() {
- return scores;
- }
-
- public void setWordscores(WordScore wordscores) {
- this.scores = wordscores;
- }
-
- @Override
- public String toString() {
- return "TotalScore [scoreTotal=" + scoreTotal + ", wordscores="
- + scores + "]";
- }
-
-
-}
-\ No newline at end of file
diff --git a/code/PtiClic/src/org/pticlic/model/WordScore.java b/code/PtiClic/src/org/pticlic/model/WordScore.java
@@ -1,62 +0,0 @@
-package org.pticlic.model;
-
-/**
- *
- * @author John CHARRON
- *
- */
-
-public class WordScore {
-
- private int idmot;
- private double score;
- private double probaR1;
- private double probaR2;
-
- public WordScore() {}
-
- public WordScore(int idmot, double score, double probaR1, double probaR2) {
- this.idmot = idmot;
- this.score = score;
- this.probaR1 = probaR1;
- this.probaR2 = probaR2;
- }
-
- public int getIdmot() {
- return idmot;
- }
-
- public void setIdmot(int idmot) {
- this.idmot = idmot;
- }
-
- public double getScore() {
- return score;
- }
-
- public void setScore(double score) {
- this.score = score;
- }
-
- public double getProbaR1() {
- return probaR1;
- }
-
- public void setProbaR1(double probaR1) {
- this.probaR1 = probaR1;
- }
-
- public double getProbaR2() {
- return probaR2;
- }
-
- public void setProbaR2(double probaR2) {
- this.probaR2 = probaR2;
- }
-
- @Override
- public String toString() {
- return "WordScore [idmot=" + idmot + ", score=" + score + ", probaR1="
- + probaR1 + ", probaR2=" + probaR2 + "]";
- }
-}