modification niveau memory

This commit is contained in:
DonRenando 2015-03-16 16:01:24 +01:00
parent b69f8c03b6
commit aa6bd3ea05
4 changed files with 33 additions and 29 deletions

View File

@ -34,7 +34,9 @@ class GameController extends Controller {
} else {
$oes = Oeuvre::orderByRaw("RAND()")->take(5)->get();
}
return view('frontend/memo', ['oeuvres' => $oes, 'niveau' => $niveau]);
$params = json_decode($configjeu->parametres);
return view('frontend/memo', ['oeuvres' => $oes, 'niveau' => $niveau, 'nbBloc'=>$params->{"m".$niveau}]);
}
public function chooseDifPuzzle() {

View File

@ -31,10 +31,11 @@
*
*/
function Memory( options, level ) {
function Memory( options, level, nbcase ) {
console.log(nbcase);
this.options = extend( {}, this.options );
extend( this.options, options );
this._init(level);
this._init(level, nbcase);
}
/**
@ -44,7 +45,7 @@
* ready for game setup.
*/
Memory.prototype._init = function(level) {
Memory.prototype._init = function(level,nbcase) {
this.game = document.createElement("div");
this.game.id = "mg";
this.game.className = "mg";
@ -65,7 +66,7 @@
this.gameMessages.id = "mg__onend";
this.gameMessages.className = "mg__onend";
this._setupGame(level);
this._setupGame(level,nbcase);
};
/**
@ -85,7 +86,7 @@
* 3 : game is finished
*/
Memory.prototype._setupGame = function(level) {
Memory.prototype._setupGame = function(level, nbcase) {
var self = this;
this.gameState = 1;
this.cards = shuffle(this.options.cards);
@ -98,7 +99,7 @@
this.flippedTiles = 0;
this.chosenLevel = "";
this.numMoves = 0;
this._setupGameWrapper(level);
this._setupGameWrapper(level, nbcase);
}
/**
@ -108,7 +109,8 @@
* tiles will reside and where all the game play happens.
*/
Memory.prototype._setupGameWrapper = function(levelNode) {
Memory.prototype._setupGameWrapper = function(levelNode,nbcase) {
this.nbcase = nbcase;
this.level = levelNode;
this.gameContents.className = "mg__contents mg__level-"+this.level;
this.game.appendChild(this.gameWrapper);
@ -137,7 +139,7 @@
else if(this.level == 2) {this.gridX = 3; this.gridY= 2; }
else { this.gridX = 2; this.gridY=4 ; }
// this.gridY = this.gridX ;
this.numTiles = this.gridX * this.gridY;
this.numTiles = this.nbcase*2;
//this.halfNumTiles = this.gridX;
this.halfNumTiles = this.numTiles/2;
this.newCards = [];

Binary file not shown.

After

Width:  |  Height:  |  Size: 148 KiB

View File

@ -32,7 +32,7 @@
cards : cards2,
onGameStart : function() { return false; },
onGameEnd : function() { return false; }
}, {{$niveau}});
}, {{$niveau}}, {{$nbBloc}});
</script>