Ajout de la boite de dialogue explicative du fonctionnement du jeux comme la suggere John

This commit is contained in:
Bertrand BRUN 2011-02-26 12:03:57 +01:00
parent e48d32edb1
commit c7b6721bd1
3 changed files with 35 additions and 2 deletions

View File

@ -6,4 +6,6 @@
<string name="textInfo"></string>
<string name="version">0.1</string>
<string name="server_down">Il y a actuellement un probleme avec le serveur. Veuillez re-essayer dans quelque minutes.</string>
<string name="basegame_title">Le principe du jeu</string>
<string name="basegame_explication">Choisissez l\'association qui lie le plus convenablement les mots apparaissant successivement au mot cible en haut de l\'écran. Optez pour la poubelle si aucune relation vous convient.</string>
</resources>

View File

@ -86,8 +86,36 @@ public class BaseGame extends Activity implements OnClickListener {
Gson gson = new Gson();
if (gameJson == null) game = (DownloadedBaseGame)network.getGames(1);
else game = gson.fromJson(gameJson, DownloadedBaseGame.class);
runMatch();
start();
SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(this);
Boolean first = sp.getBoolean(Constant.FIRST_TIME, true);
if (first) {
AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setTitle(getString(R.string.basegame_title))
.setIcon(android.R.drawable.ic_dialog_info)
.setMessage(getString(R.string.basegame_explication))
.setCancelable(false)
.setNegativeButton("Fermez", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
dialog.cancel();
runMatch();
start();
}
})
.setPositiveButton("Ne plus afficher", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(getApplicationContext());
sp.edit().putBoolean(Constant.FIRST_TIME, false).commit();
dialog.cancel();
runMatch();
start();
}
});
AlertDialog alert = builder.create();
alert.show();
} else {
runMatch();
start();
}
} catch (PtiClicException e) {
AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setTitle(getString(R.string.app_name))

View File

@ -15,4 +15,7 @@ public class Constant {
// Constant pour les intents
public static final String SCORE_GAMEPLAYED = "SCORE_INTENT";
public static final String SCORE_MODE = "SCORE_MODE";
// Constant pour BaseGame
public static final String FIRST_TIME = "FIRST_TIME";
}