diff --git a/.DS_Store b/.DS_Store
index 38af5f1..5b107d8 100644
Binary files a/.DS_Store and b/.DS_Store differ
diff --git a/Doc/algo gen.pages b/Doc/algo gen.pages
index 97707e8..c6636f9 100755
Binary files a/Doc/algo gen.pages and b/Doc/algo gen.pages differ
diff --git a/site/vue/index.html b/site/vue/index.html
index c74a90a..af9c7bb 100644
--- a/site/vue/index.html
+++ b/site/vue/index.html
@@ -56,7 +56,7 @@
-
+
Colonnes :
diff --git a/site/vue/js/createElement.js b/site/vue/js/createElement.js
index a18b2f5..d12df16 100644
--- a/site/vue/js/createElement.js
+++ b/site/vue/js/createElement.js
@@ -5,12 +5,12 @@ function createEnd() {
var X = stage.width() - stage.width() / 100 * 5;
var Y = stage.height() / 2;
- var endShape = new Konva.RegularPolygon({
- x: X,
- y: Y,
- sides: 6,
- radius: 30,
+ var endShape = new Konva.Rect({
+ x: X - 25,
+ y: Y - 25,
fill: colorEnd,
+ width: 50,
+ height: 50,
stroke: 'black',
strokeWidth: 4,
id: "end",
@@ -27,6 +27,19 @@ function createEnd() {
layer.add(endShape);
}
+
+function createCircle(x, y) {
+ var circle = new Konva.Circle({
+ x: x,
+ y: y,
+ radius: 10,
+ fill: 'black',
+ stroke: 'black',
+ strokeWidth: 4,
+ });
+ layer.add(circle);
+}
+
function createSwitch(id, x, y) {
var switche = {
id: id,
@@ -53,13 +66,25 @@ function createSwitch(id, x, y) {
layer.add(rect1);
}
-function createLine(points, id) {
+function createLine(points, id, end) {
let startX = points[0],
startY = points[1],
endX = points[2],
endY = points[3];
- let distance20 = (endX - startX) / 100 * pourcentageBreak;
- let newPoints = [startX, startY, startX + distance20, startY, endX - distance20, endY, endX, endY];
+ var newPoints;
+ if (end != undefined && end != null && end === true) {
+ let distance20 = (endX - startX) / 100 * 5;
+ let distance80 = (endX - startX) / 100 * 90;
+ newPoints = [startX, startY, startX + distance80, startY, endX - distance20, endY, endX, endY];
+ } else if (end != undefined && end != null && end === false) {
+ let distance20 = (endX - startX) / 100 * 10;
+ let distance80 = (endX - startX) / 100 * 80;
+ newPoints = [startX, startY, startX + distance80, startY, endX - distance20, endY, endX, endY];
+ } else {
+ let distance20 = (endX - startX) / 100 * pourcentageBreak;
+ newPoints = [startX, startY, startX + distance20, startY, endX - distance20, endY, endX, endY];
+ }
+
let line = new Konva.Line({
points: newPoints,
stroke: colorLineInnactive,
@@ -95,7 +120,7 @@ function createLink(entre, sortie) {
} else {
var logiqueMidY = sortie.y + (imageHeight / 3);
}
- createLine([switchMidX, switchMidY, logiqueMidX, logiqueMidY], "line" + lineId);
+ createLine([switchMidX, switchMidY, logiqueMidX, logiqueMidY], "line" + lineId, false);
setLine(sortie, "id1", "line" + lineId);
let truc = entre.x;
@@ -103,7 +128,7 @@ function createLink(entre, sortie) {
break;
case "id2":
- createLine([entre.getX() + entre.getWidth(), entre.getY() + entre.getHeight() / 2, sortie.x, sortie.y + (imageHeight / 3) * 2], "line" + lineId);
+ createLine([entre.getX() + entre.getWidth(), entre.getY() + entre.getHeight() / 2, sortie.x, sortie.y + (imageHeight / 3) * 2], "line" + lineId, false);
setLine(sortie, "id2", "line" + lineId);
getSwitchById(entre.id()).id3.push("line" + lineId);
@@ -138,7 +163,10 @@ function createLink(entre, sortie) {
break;
default:
endLines.push(lineId);
- createLine([entre.x + imageWidth, entre.y + imageHeight / 2, sortie.x, sortie.y], "line" + lineId);
+ if (end.position === 1) createLine([entre.x + imageWidth, entre.y + imageHeight / 2, sortie.x, (end.y + (50 / (end.position + 1) * (end.let-end.position)))], "line" + lineId, true);
+
+ else createLine([entre.x + imageWidth, entre.y + imageHeight / 2, sortie.x, (end.y + (50 / (end.position + 1) * (end.let+1 - end.position)))], "line" + lineId, true);
+
setLine(entre, "id3", "line" + lineId);
end.let--;
break;
@@ -147,7 +175,6 @@ function createLink(entre, sortie) {
default:
console.log("error");
break;
-
}
}
diff --git a/site/vue/js/func.js b/site/vue/js/func.js
index 365c908..a66f1ff 100644
--- a/site/vue/js/func.js
+++ b/site/vue/js/func.js
@@ -364,7 +364,6 @@ function checkSortieLogique(logiqueId) {
case "et":
if (line1State == true && line2State == true) {
element.id3.forEach(function (line) {
- console.log("oui");
changeLineColorYellow(line);
});
} else {
@@ -466,6 +465,7 @@ function lineUpdate(swithId) {
var lineId = getSwitchById(swithId).id3;
var currLogique = getLogiqueByLine(lineId[0]);
updateLines(currLogique);
+ stage.draw();
}
function getRandomArbitrary(min, max) {
@@ -520,6 +520,12 @@ function checkEnd(mode) {
success(mode);
}, 100);
}
+ if (ter) {
+ stage.findOne("#end").fill("yellow");
+ } else {
+ stage.findOne("#end").fill(colorEnd);
+ }
+ stage.draw();
}
function success(mode) {
diff --git a/site/vue/js/generateGame.js b/site/vue/js/generateGame.js
index cb4dfc5..288d894 100644
--- a/site/vue/js/generateGame.js
+++ b/site/vue/js/generateGame.js
@@ -290,7 +290,7 @@ function createGameOne(niveau) {
numberColonne2 = 1;
timeEnd = 20;
break;
- //Fin premiere serie
+ //Fin premiere serie
case 5:
firstTime.push("inv");
isNotAllowed = true;
@@ -526,7 +526,6 @@ function generate2(col, matchs, fork) {
let logiqueEntre = new Array();
let sameId = null;
listeLogiqueObj.forEach(function (logique) {
-
if (logique.col === col + 1) {
if (sameId === null) {
sameId = logique.matchId1;
@@ -536,11 +535,15 @@ function generate2(col, matchs, fork) {
}
});
logiqueFork.id3 = "done";
+ var loEntre = null;
//creation du lien avec fork :
for (let i = 0; i < logiqueEntre.length; i++) {
createLink(findLogique(logiqueFork.id), findLogique(logiqueEntre[i].id));
+ loEntre = findLogique(logiqueEntre[i].id);
}
-
+ logiques.forEach(function (logique) {
+ if (logique.name === logiqueFork.id) createCircle(logique.x + imageWidth + ((loEntre.x - findLogique(logiqueFork.id).x) / 100 * pourcentageBreak), findLogique(logiqueFork.id).y + imageHeight / 2);
+ });
fork.splice(fork.indexOf(element), 1);
}
});
diff --git a/site/vue/js/init.js b/site/vue/js/init.js
index a6d3584..3fb7835 100644
--- a/site/vue/js/init.js
+++ b/site/vue/js/init.js
@@ -52,4 +52,7 @@ function initEnd() {
listeLogique.forEach(function (element) {
createLink(element, end);
});
+ switchs.forEach(function (element) {
+ lineUpdate(element);
+ })
}
\ No newline at end of file
diff --git a/site/vue/js/timer.js b/site/vue/js/timer.js
index 3032444..726ba43 100644
--- a/site/vue/js/timer.js
+++ b/site/vue/js/timer.js
@@ -31,9 +31,7 @@ var timer = new easytimer.Timer();
timer.start();
timer.addEventListener('secondsUpdated', function (e) {
if (timer.getTimeValues().seconds <= timeEnd) {
- switchs.forEach(function (element) {
- lineUpdate(element);
- });
+
move();
} else {