diff --git a/code/PtiClic/res/values/strings.xml b/code/PtiClic/res/values/strings.xml index cdda3fb..846e425 100644 --- a/code/PtiClic/res/values/strings.xml +++ b/code/PtiClic/res/values/strings.xml @@ -3,4 +3,6 @@ PtiClic Préférences Jouer + Ce projet a été réalisé l + #FF0000 diff --git a/code/PtiClic/src/org/pticlic/Score.java b/code/PtiClic/src/org/pticlic/Score.java new file mode 100644 index 0000000..a7536f1 --- /dev/null +++ b/code/PtiClic/src/org/pticlic/Score.java @@ -0,0 +1,51 @@ +package org.pticlic; + +import org.pticlic.model.Constant; +import org.pticlic.model.GamePlayed; + +import android.app.Activity; +import android.content.Intent; +import android.os.Bundle; +import android.view.View; +import android.view.View.OnClickListener; + +public class Score extends Activity implements OnClickListener{ + + private GamePlayed gamePlayed; + + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.score); + + if (getIntent().getExtras() != null) { + // Pour JC : GamePlayed contient toutes les infos sur la partie jouee + this.gamePlayed = (GamePlayed) getIntent().getExtras().get(Constant.SCORE_INTENT); + } +// ((TextView)findViewById(R.id.corrects)).setText("Mots corrects : " +// + this.corrects); +// ((TextView)findViewById(R.id.manquants)).setText("Mots manquants : " +// + this.manquants); +// ((TextView)findViewById(R.id.mauvais)).setText("Mots mauvais : " +// + this.mauvais); +// ((TextView)findViewById(R.id.total)).setText("Total de " + total +// + "point(s)"); +// ((Button)findViewById(R.id.jaivu)).setOnClickListener(this); + } + + + + protected double calculateTotal(){ + throw new UnsupportedOperationException(); + //return this.corrects - this.manquants - this.mauvais; + } + + @Override + public void onClick(View v) { + if (v.getId()==R.id.jaivu) { + startActivity(new Intent(this, Main.class)); + } + + } +} diff --git a/code/PtiClic/src/org/pticlic/games/BaseGame.java b/code/PtiClic/src/org/pticlic/games/BaseGame.java index 0049dfc..d7eac51 100644 --- a/code/PtiClic/src/org/pticlic/games/BaseGame.java +++ b/code/PtiClic/src/org/pticlic/games/BaseGame.java @@ -1,6 +1,7 @@ package org.pticlic.games; import org.pticlic.R; +import org.pticlic.Score; import org.pticlic.model.Constant; import org.pticlic.model.Game; import org.pticlic.model.GamePlayed; @@ -8,6 +9,7 @@ import org.pticlic.model.Network; import org.pticlic.model.Network.Mode; import android.app.Activity; +import android.content.Intent; import android.content.SharedPreferences; import android.os.Bundle; import android.preference.PreferenceManager; @@ -33,7 +35,7 @@ public class BaseGame extends Activity implements OnClickListener { setContentView(R.layout.game); SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(this); - String serverURL = sp.getString(Constant.SERVER_URL, "http://serveur/pticlic.php"); + String serverURL = sp.getString(Constant.SERVER_URL, "http://serveur/pticlic.php"); // TODO : Mettre comme valeur par defaut l'adresse reel du serveur Network network = new Network(serverURL, Mode.SIMPLE_GAME); game = network.getGames(1); @@ -55,6 +57,8 @@ public class BaseGame extends Activity implements OnClickListener { if (nbrel > 2) { r3.setOnClickListener(this); } else { r3.setVisibility(View.GONE); } if (nbrel > 3) { r4.setOnClickListener(this); } else { r4.setVisibility(View.GONE); } + + //TODO : Faudrait gere dynamiquement la gestion des nom des relations. r1.setText("="); r2.setText("Poubelle"); r3.setText("∈"); @@ -68,6 +72,9 @@ public class BaseGame extends Activity implements OnClickListener { start(); } + /** + * Cette methode permet au mot courant de partir du mot central vers le centre de l'appareil. + */ private void arrivalView() { //On recupere la largueur de l'ecran. Display display = getWindowManager().getDefaultDisplay(); @@ -93,17 +100,24 @@ public class BaseGame extends Activity implements OnClickListener { findViewById(R.id.currentWord).startAnimation(set); } + /** + * Cette methode permet de passer au mot courant suivant et de lancer l'animation. + */ private void start() { ((TextView)findViewById(R.id.currentWord)).setText(Game.getName(game.getWordInCloud(currentWord))); arrivalView(); } + /** + * Permet de verifier si la partie est fini auquel cas on lance l'activite Score, sinon on passe au mot suivant. + */ private void next() { if (currentWord < nbWord) { currentWord++; start(); } else { - //TODO : Ajout l'envoie de GamePlayed a Score + Intent intent = new Intent(this, Score.class); + intent.putExtra(Constant.SCORE_INTENT, gamePlayed); } } diff --git a/code/PtiClic/src/org/pticlic/model/Constant.java b/code/PtiClic/src/org/pticlic/model/Constant.java index 69a7e62..f4d2c94 100644 --- a/code/PtiClic/src/org/pticlic/model/Constant.java +++ b/code/PtiClic/src/org/pticlic/model/Constant.java @@ -2,4 +2,7 @@ package org.pticlic.model; public class Constant { public static final String SERVER_URL = "SERVER_URL"; + + // Constant pour les intents + public static final String SCORE_INTENT = "SCORE_INTENT"; } diff --git a/code/PtiClic/src/org/pticlic/model/GamePlayed.java b/code/PtiClic/src/org/pticlic/model/GamePlayed.java index 8eba77c..a7dbf84 100644 --- a/code/PtiClic/src/org/pticlic/model/GamePlayed.java +++ b/code/PtiClic/src/org/pticlic/model/GamePlayed.java @@ -1,13 +1,16 @@ package org.pticlic.model; +import java.io.Serializable; import java.util.ArrayList; -public class GamePlayed { +public class GamePlayed implements Serializable { + + private static final long serialVersionUID = 1L; private ArrayList relation1; private ArrayList relation2; private ArrayList relation3; - private ArrayList relation4; - private Game game; + private ArrayList relation4; + private Game game; public GamePlayed() { relation1 = new ArrayList(); @@ -18,6 +21,10 @@ public class GamePlayed { public void setGame(Game game) { this.game = game; + } + + public Game getGame() { + return game; } public void add(int relation, CharSequence word) { diff --git a/feuille-route/gantt.pdf b/feuille-route/gantt.pdf deleted file mode 100644 index 518af4d..0000000 Binary files a/feuille-route/gantt.pdf and /dev/null differ