commit 001a45a1dd4c662035d7b8f3034b747cfb5d7de7
parent f1ba2ed1f4c8e67ef14b18d7a38a4c1fcf494933
Author: Bertrand BRUN <bertrand0brun@gmail.com>
Date: Thu, 28 Apr 2011 10:22:27 +0200
Correction bug avec Interface Android
Diffstat:
1 file changed, 28 insertions(+), 26 deletions(-)
diff --git a/code/serveur/php/ressources/pticlic.js b/code/serveur/php/ressources/pticlic.js
@@ -201,6 +201,7 @@ game.buildUi = function () {
.appendTo("#game .relations");
});
game.updateText();
+ UI.dismiss();
}
game.leave = function () {
@@ -250,40 +251,41 @@ game.nextWord = function(click, button) {
}
}
-game.ui = function () {
- updateText();
- UI.dismiss();
-}
-
// ==== Code métier pour les scores
score = {};
-score.enter = function () {
- UI.show("PtiClic", "Calcul de votre score");
- $.getJSON("server.php?callback=?", {
- user: "foo",
- passwd: "bar",
- action: 1,
- pgid: state.game.pgid,
- gid: state.game.gid,
- answers: state.game.answers,
- nonce: Math.random()
- }, function(data) {
- for (var i = 0; i < data.scores.length; i++) {
- state.game.cloud[i].score = data.scores[i];
- }
- delete data.score;
- $.extend(state.game, data);
- state.commit();
- score.ui();
- }).error(ajaxError);
- jss();
-}
score.jss = function(w, h, iconSize) {
$(".screen")
.css('text-align', 'center');
};
+score.enter = function () {
+ if (!state.hasScore) {
+ UI.show("PtiClic", "Calcul de votre score");
+ $.getJSON("server.php?callback=?", {
+ user: "foo",
+ passwd: "bar",
+ action: 1,
+ pgid: state.game.pgid,
+ gid: state.game.gid,
+ answers: state.game.answers,
+ nonce: Math.random()
+ }, function(data) {
+ for (var i = 0; i < data.scores.length; i++) {
+ state.game.cloud[i].score = data.scores[i];
+ }
+ delete data.score;
+ $.extend(state.game, data);
+ state.hasScore = true;
+ state.commit();
+ score.ui();
+ }).error(ajaxError);
+ } else {
+ score.ui();
+ }
+ jss();
+}
+
score.ui = function () {
$("#score .scores").empty();
$.each(state.game.cloud, function(i,e) {