parent
28c6e09bf9
commit
ec67becd4c
@ -1,33 +1,173 @@
|
|||||||
class gameData {
|
class GameData {
|
||||||
|
|
||||||
constructor(hauteur, largeur) {
|
hauteur;
|
||||||
this.hauteur = hauteur;
|
largeur;
|
||||||
this.largeur = largeur;
|
timeEnd;
|
||||||
|
numberColonne1;
|
||||||
|
numberColonne2;
|
||||||
|
isEtNonAllowed;
|
||||||
|
isOuNonAllowed;
|
||||||
|
niveau;
|
||||||
|
isTuto;
|
||||||
|
mode;
|
||||||
|
container;
|
||||||
|
colonneTot;
|
||||||
|
|
||||||
|
constructor(hauteur, largeur, colonneTot, timeEnd, mode, isTuto, container) {
|
||||||
|
this.hauteur = hauteur;
|
||||||
|
this.largeur = largeur;
|
||||||
|
this.timeEnd = timeEnd;
|
||||||
|
this.numberColonne1 = 2;
|
||||||
|
this.numberColonne2 = 1;
|
||||||
|
this.isEtNonAllowed = false;
|
||||||
|
this.isOuNonAllowed = false;
|
||||||
|
this.niveau = 1;
|
||||||
|
this.mode = mode;
|
||||||
|
this.isTuto = isTuto;
|
||||||
|
this.container = container;
|
||||||
|
this.colonneTot = colonneTot;
|
||||||
|
}
|
||||||
|
|
||||||
|
createStageCanvas() {
|
||||||
|
stage = new Konva.Stage({
|
||||||
|
container: this.container,
|
||||||
|
/*rotation: -90,
|
||||||
|
x: 20,
|
||||||
|
y: 1000,*/
|
||||||
|
width: this.hauteur,
|
||||||
|
height: this.largeur,
|
||||||
|
});
|
||||||
|
stage.add(layer);
|
||||||
|
}
|
||||||
|
|
||||||
|
generateRandomDoor() {
|
||||||
|
numberPerColonne = [this.numberColonne1, this.numberColonne2];
|
||||||
|
var logiqueCount = 0;
|
||||||
|
|
||||||
|
for (let i = 0; i < this.colonneTot; i++) {
|
||||||
|
liveColonneNumber.push([]);
|
||||||
|
}
|
||||||
|
for (let i = 0; i < this.colonneTot; i++) {
|
||||||
|
for (let j = 0; j < numberPerColonne[i]; j++) {
|
||||||
|
logiqueCount++;
|
||||||
|
let type = null;
|
||||||
|
switch (getRandomArbitrary(0, 4)) {
|
||||||
|
case 0:
|
||||||
|
type = "et";
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
type = "ou";
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
if (this.isEtNonAllowed) {
|
||||||
|
type = "etnon";
|
||||||
|
} else {
|
||||||
|
type = "et";
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
if (this.isOuNonAllowed) {
|
||||||
|
type = "nonou";
|
||||||
|
} else {
|
||||||
|
type = "et";
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
insertLogiqueColonne("logique" + logiqueCount, type, i);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
logiques.forEach(function (element) {
|
||||||
|
createLinkAuto(element.name);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
setDifficulty(niveau) {
|
||||||
|
switch (niveau) {
|
||||||
|
case 1:
|
||||||
|
case 2:
|
||||||
|
timeEnd = 5;
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
case 4:
|
||||||
|
timeEnd = 4;
|
||||||
|
break;
|
||||||
|
case 5:
|
||||||
|
timeEnd = 3;
|
||||||
|
break;
|
||||||
|
case 6:
|
||||||
|
case 7:
|
||||||
|
case 8:
|
||||||
|
isEtNonAllowed = true;
|
||||||
|
timeEnd = 5;
|
||||||
|
numberColonne1 = 3;
|
||||||
|
break;
|
||||||
|
case 9:
|
||||||
|
case 10:
|
||||||
|
case 11:
|
||||||
|
isEtNonAllowed = true;
|
||||||
|
timeEnd = 4;
|
||||||
|
numberColonne1 = 3;
|
||||||
|
break;
|
||||||
|
case 12:
|
||||||
|
case 13:
|
||||||
|
case 14:
|
||||||
|
isEtNonAllowed = true;
|
||||||
|
isOuNonAllowed = true;
|
||||||
|
timeEnd = 4;
|
||||||
|
numberColonne1 = 3;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
isEtNonAllowed = true;
|
||||||
|
isOuNonAllowed = true;
|
||||||
|
timeEnd = 3;
|
||||||
|
numberColonne1 = 4;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
createGame(){
|
||||||
|
|
||||||
|
this.setDifficulty(this.niveau);
|
||||||
|
|
||||||
|
initTimer();
|
||||||
|
this.createStageCanvas();
|
||||||
|
this.generateRandomDoor();
|
||||||
|
|
||||||
|
calculNombreSwitch();
|
||||||
|
switchCreator(numberOfSwitch);
|
||||||
|
console.log(stage);
|
||||||
|
createAllLinkSwitch();
|
||||||
|
|
||||||
|
initAllSwitch();
|
||||||
|
createEnd();
|
||||||
|
initEnd();
|
||||||
|
|
||||||
|
checkAllSortieLogique();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function createSwitch(id, x, y) {
|
function createSwitch(id, x, y) {
|
||||||
var switche = {
|
var switche = {
|
||||||
id : id,
|
id: id,
|
||||||
x : x,
|
x: x,
|
||||||
y : y,
|
y: y,
|
||||||
};
|
};
|
||||||
switchsInfo.push(switche);
|
switchsInfo.push(switche);
|
||||||
switchsInfoCopy.push(switche);
|
switchsInfoCopy.push(switche);
|
||||||
switchs.push(id);
|
switchs.push(id);
|
||||||
var num = lineCount.length;
|
var num = lineCount.length;
|
||||||
lineCount.push(1);
|
lineCount.push(1);
|
||||||
var rect1 = new Konva.Rect({
|
var rect1 = new Konva.Rect({
|
||||||
x: x,
|
x: x,
|
||||||
y: y,
|
y: y,
|
||||||
width: SwitchWidth,
|
width: SwitchWidth,
|
||||||
height: SwitchHeight,
|
height: SwitchHeight,
|
||||||
stroke: colorSwitchBorder,
|
stroke: colorSwitchBorder,
|
||||||
fill: colorSwitchInnactiveBackground,
|
fill: colorSwitchInnactiveBackground,
|
||||||
strokeWidth: 4,
|
strokeWidth: 4,
|
||||||
id: id,
|
id: id,
|
||||||
id3: null,
|
id3: null,
|
||||||
});
|
});
|
||||||
layer.add(rect1);
|
layer.add(rect1);
|
||||||
}
|
}
|
@ -0,0 +1,32 @@
|
|||||||
|
ctrl + enter to add
|
||||||
|
alt+d to set done
|
||||||
|
|
||||||
|
Responsive :
|
||||||
|
☐ enlever les borders au format mobile
|
||||||
|
☐ Faire en sorte que le canvas se réajuste
|
||||||
|
`Piste`
|
||||||
|
Faire en sorte que le canvas soit plus grand de base et le redimensionner par la suite (produit en croix pour simplement le repositionner => taille de base *4/5 puis on redivise)
|
||||||
|
Suite :
|
||||||
|
☐ Changer de direction lorsqu'on atteint un certain format
|
||||||
|
`Piste`
|
||||||
|
Quand la largeur est inférieur à la hauteur ???
|
||||||
|
En dessous d'un certains nombre de pixels ??? Attention aux téléphone haute résolution
|
||||||
|
|
||||||
|
Paramètres :
|
||||||
|
Choix du types de porte :
|
||||||
|
☐ Refaire les portes dans le canvas avec un rectangle qui a à l'intérieur du text ou une image
|
||||||
|
☐ Ajouter au menu des paramètres la possibilité de choisir entre les 2 types de portes
|
||||||
|
☐ Mettre tout les types de portes dans la prévisualisation
|
||||||
|
|
||||||
|
Jeu :
|
||||||
|
☐ Refaire entièrement le "not" pour éviter la fuite de mémoire
|
||||||
|
☐ Ajouter la possibilité qu'une sortie puisse acceuillir plusieurs lignes
|
||||||
|
`Piste`
|
||||||
|
Remplacer l'id3 par une liste d'id3 qu'on parcourerait
|
||||||
|
☐ Faire en sorte que les portes d'une colonne autres que la 1ere n'ai que des lignes qui viennent de porte et non des switchs
|
||||||
|
|
||||||
|
UI/UX :
|
||||||
|
☐ Trouver une police d'écriture bien pour le jeu
|
||||||
|
☐ Corriger les fautes d'orthographes
|
||||||
|
☐ Faire la traduction en anglais
|
||||||
|
|
Loading…
Reference in new issue